mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
Merge pull request #1900 from umap-project/explicit-import-paths
Multiple fixes for importers
This commit is contained in:
commit
c1576ee5ca
2 changed files with 31 additions and 17 deletions
|
@ -203,27 +203,24 @@ input[type=checkbox]:checked:after {
|
|||
label input[type="radio"] {
|
||||
appearance: none;
|
||||
margin-right: 10px;
|
||||
background: var(--color-darkGray);
|
||||
}
|
||||
input[type="radio"]:after {
|
||||
display: inline-block;
|
||||
content: ' ';
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
content: '⦾';
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--color-lightGray);
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
font-size: 1.3rem;
|
||||
line-height: 1rem;
|
||||
vertical-align: bottom;
|
||||
font-size: 1.2rem;
|
||||
line-height: 0.7;
|
||||
}
|
||||
label input[type="radio"]:checked:after {
|
||||
background-color: var(--color-lightCyan);
|
||||
content: '•';
|
||||
font-size: 3rem;
|
||||
line-height: 0.8rem;
|
||||
color: var(--color-darkGray);
|
||||
text-indent: -1px;
|
||||
content: '⦿';
|
||||
}
|
||||
|
||||
input[data-modified=true] {
|
||||
|
|
|
@ -12,14 +12,16 @@ const TEMPLATE = `
|
|||
<input type="file" multiple autofocus onchange />
|
||||
<input type="url" placeholder="${translate('Provide an URL here')}" onchange />
|
||||
<textarea onchange placeholder="${translate('Paste your data here')}"></textarea>
|
||||
<div class="importers">
|
||||
<div class="importers" hidden>
|
||||
<h4>${translate('Import helpers:')}</h4>
|
||||
<ul class="grid-container">
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="formbox">
|
||||
<legend class="counter" data-help="importFormats">${translate('Choose the format')}</legend>
|
||||
<legend class="counter" data-help="importFormats">${translate(
|
||||
'Choose the format'
|
||||
)}</legend>
|
||||
<select name="format" onchange></select>
|
||||
</fieldset>
|
||||
<fieldset id="destination" class="formbox">
|
||||
|
@ -55,10 +57,25 @@ export default class Importer {
|
|||
}
|
||||
|
||||
loadImporters() {
|
||||
for (const key of Object.keys(this.map.options.importers || {})) {
|
||||
import(`./importers/${key}.js`).then((mod) => {
|
||||
this.IMPORTERS.push(new mod.Importer(this.map, this.map.options.importers[key]))
|
||||
})
|
||||
for (const [name, config] of Object.entries(this.map.options.importers || {})) {
|
||||
const register = (mod) => {
|
||||
this.IMPORTERS.push(new mod.Importer(this.map, config))
|
||||
}
|
||||
// We need to have explicit static paths for Django's collectstatic with hashes.
|
||||
switch (name) {
|
||||
case 'geodatamine':
|
||||
import('./importers/geodatamine.js').then(register)
|
||||
break
|
||||
case 'communesfr':
|
||||
import('./importers/communesfr.js').then(register)
|
||||
break
|
||||
case 'overpass':
|
||||
import('./importers/overpass.js').then(register)
|
||||
break
|
||||
case 'datasets':
|
||||
import('./importers/datasets.js').then(register)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue