umap-project 2.4.0b1__py3-none-any.whl → 2.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

Files changed (53) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/en/LC_MESSAGES/django.po +11 -11
  3. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/fr/LC_MESSAGES/django.po +12 -11
  5. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/pt/LC_MESSAGES/django.po +87 -37
  7. umap/static/umap/base.css +20 -28
  8. umap/static/umap/css/importers.css +8 -1
  9. umap/static/umap/css/panel.css +0 -1
  10. umap/static/umap/img/16-white.svg +1 -3
  11. umap/static/umap/img/source/16-white.svg +2 -4
  12. umap/static/umap/js/modules/browser.js +5 -5
  13. umap/static/umap/js/modules/caption.js +1 -1
  14. umap/static/umap/js/modules/importer.js +20 -9
  15. umap/static/umap/js/modules/importers/datasets.js +1 -0
  16. umap/static/umap/js/modules/utils.js +3 -3
  17. umap/static/umap/js/umap.features.js +11 -3
  18. umap/static/umap/js/umap.js +47 -48
  19. umap/static/umap/js/umap.layer.js +11 -1
  20. umap/static/umap/js/umap.popup.js +1 -1
  21. umap/static/umap/locale/en.js +2 -1
  22. umap/static/umap/locale/en.json +2 -1
  23. umap/static/umap/locale/es.js +9 -8
  24. umap/static/umap/locale/es.json +9 -8
  25. umap/static/umap/locale/fr.js +16 -15
  26. umap/static/umap/locale/fr.json +16 -15
  27. umap/static/umap/locale/pt.js +61 -60
  28. umap/static/umap/locale/pt.json +61 -60
  29. umap/static/umap/map.css +14 -13
  30. umap/static/umap/unittests/utils.js +5 -5
  31. umap/static/umap/vars.css +2 -1
  32. umap/static/umap/vendors/dompurify/purify.es.js +59 -5
  33. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
  34. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +2 -2
  35. umap/tests/integration/test_browser.py +76 -3
  36. umap/tests/integration/test_edit_polygon.py +11 -0
  37. umap/tests/integration/test_import.py +47 -0
  38. umap/tests/integration/test_map.py +29 -0
  39. umap/tests/integration/test_view_marker.py +2 -2
  40. {umap_project-2.4.0b1.dist-info → umap_project-2.4.1.dist-info}/METADATA +5 -5
  41. {umap_project-2.4.0b1.dist-info → umap_project-2.4.1.dist-info}/RECORD +44 -53
  42. {umap_project-2.4.0b1.dist-info → umap_project-2.4.1.dist-info}/WHEEL +1 -1
  43. umap/.DS_Store +0 -0
  44. umap/static/.DS_Store +0 -0
  45. umap/static/umap/.DS_Store +0 -0
  46. umap/static/umap/favicons/.DS_Store +0 -0
  47. umap/static/umap/fonts/.DS_Store +0 -0
  48. umap/static/umap/img/.DS_Store +0 -0
  49. umap/static/umap/img/source/.DS_Store +0 -0
  50. umap/tests/.DS_Store +0 -0
  51. umap/tests/integration/.DS_Store +0 -0
  52. {umap_project-2.4.0b1.dist-info → umap_project-2.4.1.dist-info}/entry_points.txt +0 -0
  53. {umap_project-2.4.0b1.dist-info → umap_project-2.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -16,7 +16,7 @@
16
16
  <path d="M 16.0401,2.3158 H 2.005 v 14.0351 h 14.0351 z" fill="#ffffff" id="path1259" />
17
17
  </mask>
18
18
  </defs>
19
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="25.599967" inkscape:cx="37.558642" inkscape:cy="19.121119" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" inkscape:snap-grids="true" inkscape:snap-to-guides="true" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1">
19
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="10.391897" inkscape:cx="112.73207" inkscape:cy="34.401804" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" inkscape:snap-grids="true" inkscape:snap-to-guides="true" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1">
20
20
  <inkscape:grid type="xygrid" id="grid3004" empspacing="4" visible="true" enabled="true" snapvisiblegridlinesonly="true" originx="0" originy="0" spacingy="1" spacingx="1" units="px" />
21
21
  <sodipodi:guide orientation="-1,0" position="24,168" id="guide3084" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
22
22
  <sodipodi:guide orientation="0,1" position="0,96" id="guide3086" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
@@ -40,6 +40,7 @@
40
40
  </rdf:RDF>
41
41
  </metadata>
42
42
  <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-812.36218)">
43
+ <path style="fill:#f2f2f2;fill-opacity:1;stroke-width:0.25;paint-order:fill markers stroke;stroke:#999999;stroke-opacity:1" d="m 106.58891,43.849359 c -3.10089,-0.58252 -5.52944,-2.863466 -6.31937,-5.935298 -0.23482,-0.913171 -0.294235,-2.2415 -0.14177,-3.169542 0.51108,-3.110805 2.83364,-5.667956 5.86284,-6.455008 3.72982,-0.969088 7.59776,0.861664 9.2444,4.375508 0.52616,1.122793 0.76105,2.331963 0.7086,3.647677 -0.0496,1.245447 -0.28677,2.18265 -0.82249,3.250829 -1.04984,2.093266 -2.88939,3.559535 -5.24807,4.183141 -0.49134,0.129903 -0.73215,0.154443 -1.68896,0.172114 -0.81094,0.01498 -1.24691,-0.004 -1.59518,-0.06942 z m 2.43966,-5.8477 v -3.046165 h -1.02544 -1.02544 v 3.046165 3.046164 h 1.02544 1.02544 z m -0.53434,-4.563852 c 0.33094,-0.09915 0.70763,-0.444612 0.87372,-0.801282 0.4662,-1.001185 -0.2615,-2.144718 -1.36482,-2.144718 -0.44164,0 -0.73107,0.12392 -1.06527,0.456086 -0.42453,0.421956 -0.54914,0.937689 -0.37666,1.558908 0.0814,0.293275 0.60383,0.829099 0.89905,0.922151 0.28553,0.09 0.74987,0.09398 1.03398,0.0089 z" id="path6" transform="translate(0,812.36218)" />
43
44
  <text xml:space="preserve" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" x="5.7867966" y="897.80786" id="text4457"><tspan y="897.80786" x="5.7867966" sodipodi:role="line" id="tspan4459" style="font-size:40px;line-height:1.25;font-family:sans-serif"> </tspan></text>
44
45
  <g id="g3001" transform="translate(-23.255701,-119.38651)">
45
46
  <path style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#f2f2f2;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m 35.255701,935.74851 c -4.412356,0 -8.00014,3.58778 -8.00014,8.00014 0,4.41235 3.587784,8.00014 8.00014,8.00014 4.412356,0 8.00014,-3.58779 8.00014,-8.00014 0,-4.41236 -3.587784,-8.00014 -8.00014,-8.00014 z m 0,1.00028 c 3.871916,0 6.99986,3.12794 6.99986,6.99986 0,3.87191 -3.127944,6.99986 -6.99986,6.99986 -3.871916,0 -6.999861,-3.12795 -6.999861,-6.99986 0,-3.87192 3.127945,-6.99986 6.999861,-6.99986 z" id="path3014" inkscape:connector-curvature="0" />
@@ -63,8 +64,6 @@
63
64
  </g>
64
65
  <path style="fill:#b3b3b3;fill-opacity:1;stroke:none" d="m 63.71429,890.36216 -1.14285,1.1428 2.28571,2.2858 L 66,892.64786 Z M 62,892.07646 55.714286,898.36218 58,900.64788 l 6.28572,-6.2857 z m -6.285714,6.28572 -1.714286,4 4,-1.7143 z" id="path3684-2" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccccc" />
65
66
  <path inkscape:connector-curvature="0" id="table-5-8-8-6-1" style="fill:#f2f2f2;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 54,914.3622 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z m -2,2 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z m -2,2 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z m -2,2 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z m -2,2 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z m -2,2 v 1 h 1 v -1 z m 2,0 v 1 h 10 v -1 z" />
66
- <circle style="fill:#f2f2f2;fill-opacity:1;stroke:#999999;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path3764" cx="108" cy="844.36218" r="1.5" />
67
- <path style="fill:#f2f2f2;fill-opacity:1;stroke:#999999;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 107,847.36218 h 2 v 6 h -2 z" id="rect4274" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" />
68
67
  <g id="g4717" transform="translate(-54.789185,-114.477)">
69
68
  <path style="fill:#f2f2f2;fill-opacity:1;fill-rule:evenodd;stroke:#999999;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 141.26953,173.42383 -6.75586,2.67969 0.95313,6.3457 5.87109,3.12695 4.14844,-7.87305 z m -1.44726,2.48828 2.99023,1.60156 -0.5918,2.43164 -3.35742,1.50391 -1.73828,-3.81055 z" transform="translate(-1.210815,854.83918)" id="path3862" inkscape:connector-curvature="0" />
70
69
  </g>
@@ -139,7 +138,6 @@
139
138
  <path inkscape:connector-curvature="0" id="path4353-1-6-1-3-3-9-6" transform="matrix(1.9000195,0,0,1.9000195,-245.02393,606.04174)" d="m 222.11328,179.64258 -1.04883,1.04883 1.58203,1.58007 -1.58203,1.58204 1.04883,1.04687 1.58203,-1.58008 1.58008,1.58008 1.04883,-1.04687 -1.58203,-1.58204 1.58203,-1.58007 -1.04883,-1.04883 -1.58008,1.58008 z" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#f2f2f2;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.81628;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
140
139
  </g>
141
140
  </g>
142
- <path style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#f2f2f2;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m 108,840.36204 c -4.41236,0 -8.00014,3.58778 -8.00014,8.00014 0,4.41235 3.58778,8.00014 8.00014,8.00014 4.41236,0 8.00014,-3.58779 8.00014,-8.00014 0,-4.41236 -3.58778,-8.00014 -8.00014,-8.00014 z m 0,1.00028 c 3.87192,0 6.99986,3.12794 6.99986,6.99986 0,3.87191 -3.12794,6.99986 -6.99986,6.99986 -3.87192,0 -6.99986,-3.12795 -6.99986,-6.99986 0,-3.87192 3.12794,-6.99986 6.99986,-6.99986 z" id="path3014-4" inkscape:connector-curvature="0" />
143
141
  <rect style="fill:#f2f2f2;fill-opacity:1;stroke:none;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="rect4237" width="2" height="2" x="77" y="889.36218" />
144
142
  <rect style="fill:#f2f2f2;fill-opacity:1;stroke:none;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="rect4239" width="2" height="2" x="81" y="889.36218" />
145
143
  <rect style="fill:#f2f2f2;fill-opacity:1;stroke:none;stroke-width:0.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="rect4241" width="2" height="2" x="85" y="889.36218" />
@@ -143,8 +143,6 @@ export default class Browser {
143
143
  open(mode) {
144
144
  // Force only if mode is known, otherwise keep current mode.
145
145
  if (mode) this.mode = mode
146
- // Get once but use it for each feature later
147
- this.filterKeys = this.map.getFilterKeys()
148
146
  const container = DomUtil.create('div')
149
147
  // HOTFIX. Remove when this is released:
150
148
  // https://github.com/Leaflet/Leaflet/pull/9052
@@ -205,9 +203,11 @@ export default class Browser {
205
203
  }
206
204
 
207
205
  static backButton(map) {
208
- const button = DomUtil.create('li', '')
209
- DomUtil.create('i', 'icon icon-16 icon-back', button)
210
- button.title = translate('Back to browser')
206
+ const button = DomUtil.createButtonIcon(
207
+ DomUtil.create('li', '', undefined),
208
+ 'icon-back',
209
+ translate('Back to browser')
210
+ )
211
211
  // Fixme: remove me when this is merged and released
212
212
  // https://github.com/Leaflet/Leaflet/pull/9052
213
213
  DomEvent.disableClickPropagation(button)
@@ -24,7 +24,7 @@ export default class Caption {
24
24
  if (this.map.options.description) {
25
25
  const description = DomUtil.element({
26
26
  tagName: 'div',
27
- className: 'umap-map-description',
27
+ className: 'umap-map-description text',
28
28
  safeHTML: Utils.toHTML(this.map.options.description),
29
29
  parent: container,
30
30
  })
@@ -230,13 +230,21 @@ export default class Importer {
230
230
 
231
231
  openFiles() {
232
232
  this.open()
233
- this.fileInput.showPicker()
233
+ this.qs('[type=file]').showPicker()
234
234
  }
235
235
 
236
236
  submit() {
237
- if (this.format === 'umap') this.full()
238
- else if (!this.url) this.copy()
239
- else if (this.action) this[this.action]()
237
+ let hasErrors = false
238
+ if (this.format === 'umap') {
239
+ hasErrors = !this.full()
240
+ } else if (!this.url) {
241
+ hasErrors = !this.copy()
242
+ } else if (this.action) {
243
+ hasErrors = !this[this.action]()
244
+ }
245
+ if (!hasErrors) {
246
+ Alert.info(translate('Data successfully imported!'))
247
+ }
240
248
  }
241
249
 
242
250
  full() {
@@ -254,16 +262,19 @@ export default class Importer {
254
262
  } catch (e) {
255
263
  Alert.error(translate('Invalid umap data'))
256
264
  console.error(e)
265
+ return false
257
266
  }
258
267
  }
259
268
 
260
269
  link() {
261
- if (!this.url) return
270
+ if (!this.url) {
271
+ return false
272
+ }
262
273
  if (!this.format) {
263
274
  Alert.error(translate('Please choose a format'))
264
- return
275
+ return false
265
276
  }
266
- let layer = this.layer
277
+ const layer = this.layer
267
278
  layer.options.remoteData = {
268
279
  url: this.url,
269
280
  format: this.format,
@@ -280,9 +291,9 @@ export default class Importer {
280
291
  // Usefull in case of multiple files with different formats.
281
292
  if (!this.format && !this.files.length) {
282
293
  Alert.error(translate('Please choose a format'))
283
- return
294
+ return false
284
295
  }
285
- let layer = this.layer
296
+ const layer = this.layer
286
297
  if (this.clear) layer.empty()
287
298
  if (this.files.length) {
288
299
  for (const file of this.files) {
@@ -28,6 +28,7 @@ export class Importer {
28
28
  if (select.value) {
29
29
  importer.url = select.value
30
30
  importer.format = select.options[select.selectedIndex].dataset.format
31
+ importer.layerName = select.options[select.selectedIndex].textContent
31
32
  }
32
33
  importer.dialog.close()
33
34
  }
@@ -124,9 +124,9 @@ export function toHTML(r, options) {
124
124
  }
125
125
 
126
126
  // headings and hr
127
- r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '<h5>$1</h5>')
128
- r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '<h4>$1</h4>')
129
- r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '<h3>$1</h3>')
127
+ r = r.replace(/^### (.*)(\r\n|\r|\n)?/gm, '<h6>$1</h6>')
128
+ r = r.replace(/^## (.*)(\r\n|\r|\n)?/gm, '<h5>$1</h5>')
129
+ r = r.replace(/^# (.*)(\r\n|\r|\n)?/gm, '<h4>$1</h4>')
130
130
  r = r.replace(/^---/gm, '<hr>')
131
131
 
132
132
  // bold, italics
@@ -144,7 +144,11 @@ U.FeatureMixin = {
144
144
  edit: function (e) {
145
145
  if (!this.map.editEnabled || this.isReadOnly()) return
146
146
  const container = L.DomUtil.create('div', 'umap-feature-container')
147
- L.DomUtil.createTitle(container, L._('Feature properties'), `icon-${this.getClassName()}`)
147
+ L.DomUtil.createTitle(
148
+ container,
149
+ L._('Feature properties'),
150
+ `icon-${this.getClassName()}`
151
+ )
148
152
 
149
153
  let builder = new U.FormBuilder(
150
154
  this,
@@ -528,7 +532,7 @@ U.FeatureMixin = {
528
532
  },
529
533
 
530
534
  isFiltered: function () {
531
- const filterKeys = this.map.getFilterKeys()
535
+ const filterKeys = this.datalayer.getFilterKeys()
532
536
  const filter = this.map.browser.options.filter
533
537
  if (filter && !this.matchFilter(filter, filterKeys)) return true
534
538
  if (!this.matchFacets()) return true
@@ -537,6 +541,10 @@ U.FeatureMixin = {
537
541
 
538
542
  matchFilter: function (filter, keys) {
539
543
  filter = filter.toLowerCase()
544
+ if (U.Utils.hasVar(keys)) {
545
+ return this.getDisplayName().toLowerCase().indexOf(filter) !== -1
546
+ }
547
+ keys = keys.split(',')
540
548
  for (let i = 0, value; i < keys.length; i++) {
541
549
  value = (this.properties[keys[i]] || '') + ''
542
550
  if (value.toLowerCase().indexOf(filter) !== -1) return true
@@ -598,7 +606,7 @@ U.FeatureMixin = {
598
606
  if (locale) properties.locale = locale
599
607
  if (L.lang) properties.lang = L.lang
600
608
  properties.rank = this.getRank() + 1
601
- if (this.hasGeom()) {
609
+ if (this._map && this.hasGeom()) {
602
610
  center = this.getCenter()
603
611
  properties.lat = center.lat
604
612
  properties.lon = center.lng
@@ -1,5 +1,5 @@
1
1
  L.Map.mergeOptions({
2
- overlay: null,
2
+ overlay: {},
3
3
  datalayers: [],
4
4
  hash: true,
5
5
  maxZoomLimit: 24,
@@ -205,49 +205,9 @@ U.Map = L.Map.extend({
205
205
  this.editTools = new U.Editable(this)
206
206
  this.renderEditToolbar()
207
207
  }
208
- if (!U.Utils.isObject(this.options.overlay)) {
209
- this.options.overlay = {}
210
- }
211
- if (!U.Utils.isObject(this.options.tilelayer)) {
212
- this.options.tilelayer = {}
213
- }
214
208
 
215
209
  this.initShortcuts()
216
- this.onceDataLoaded(function () {
217
- const slug = L.Util.queryString('feature')
218
- if (slug && this.features_index[slug]) this.features_index[slug].view()
219
- if (this.options.noControl) return
220
- this.initCaptionBar()
221
- if (L.Util.queryString('share')) {
222
- this.share.open()
223
- } else if (this.options.onLoadPanel === 'databrowser') {
224
- this.panel.setDefaultMode('expanded')
225
- this.openBrowser('data')
226
- } else if (this.options.onLoadPanel === 'datalayers') {
227
- this.panel.setDefaultMode('condensed')
228
- this.openBrowser('layers')
229
- } else if (this.options.onLoadPanel === 'datafilters') {
230
- this.panel.setDefaultMode('expanded')
231
- this.openBrowser('filters')
232
- } else if (this.options.onLoadPanel === 'caption') {
233
- this.panel.setDefaultMode('condensed')
234
- this.openCaption()
235
- }
236
- if (L.Util.queryString('edit')) {
237
- if (this.hasEditMode()) this.enableEdit()
238
- // Sometimes users share the ?edit link by mistake, let's remove
239
- // this search parameter from URL to prevent this
240
- const url = new URL(window.location)
241
- url.searchParams.delete('edit')
242
- history.pushState({}, '', url)
243
- }
244
- if (L.Util.queryString('download')) {
245
- const download_url = this.urls.get('map_download', {
246
- map_id: this.options.umap_id,
247
- })
248
- window.location = download_url
249
- }
250
- })
210
+ this.onceDataLoaded(this.setViewFromQueryString)
251
211
 
252
212
  window.onbeforeunload = () => (this.editEnabled && this.isDirty) || null
253
213
  this.backup()
@@ -341,6 +301,44 @@ U.Map = L.Map.extend({
341
301
  }
342
302
  },
343
303
 
304
+ setViewFromQueryString: function () {
305
+ if (this.options.noControl) return
306
+ this.initCaptionBar()
307
+ if (L.Util.queryString('share')) {
308
+ this.share.open()
309
+ } else if (this.options.onLoadPanel === 'databrowser') {
310
+ this.panel.setDefaultMode('expanded')
311
+ this.openBrowser('data')
312
+ } else if (this.options.onLoadPanel === 'datalayers') {
313
+ this.panel.setDefaultMode('condensed')
314
+ this.openBrowser('layers')
315
+ } else if (this.options.onLoadPanel === 'datafilters') {
316
+ this.panel.setDefaultMode('expanded')
317
+ this.openBrowser('filters')
318
+ } else if (this.options.onLoadPanel === 'caption') {
319
+ this.panel.setDefaultMode('condensed')
320
+ this.openCaption()
321
+ }
322
+ // Comes after default panels, so if it opens in a panel it will
323
+ // take precedence.
324
+ const slug = L.Util.queryString('feature')
325
+ if (slug && this.features_index[slug]) this.features_index[slug].view()
326
+ if (L.Util.queryString('edit')) {
327
+ if (this.hasEditMode()) this.enableEdit()
328
+ // Sometimes users share the ?edit link by mistake, let's remove
329
+ // this search parameter from URL to prevent this
330
+ const url = new URL(window.location)
331
+ url.searchParams.delete('edit')
332
+ history.pushState({}, '', url)
333
+ }
334
+ if (L.Util.queryString('download')) {
335
+ const download_url = this.urls.get('map_download', {
336
+ map_id: this.options.umap_id,
337
+ })
338
+ window.location = download_url
339
+ }
340
+ },
341
+
344
342
  // Merge the given schema with the default one
345
343
  // Missing keys inside the schema are merged with the default ones.
346
344
  overrideSchema: function (schema) {
@@ -1296,6 +1294,9 @@ U.Map = L.Map.extend({
1296
1294
  },
1297
1295
 
1298
1296
  _editTilelayer: function (container) {
1297
+ if (!U.Utils.isObject(this.options.tilelayer)) {
1298
+ this.options.tilelayer = {}
1299
+ }
1299
1300
  const tilelayerFields = [
1300
1301
  [
1301
1302
  'options.tilelayer.name',
@@ -1343,6 +1344,9 @@ U.Map = L.Map.extend({
1343
1344
  },
1344
1345
 
1345
1346
  _editOverlay: function (container) {
1347
+ if (!U.Utils.isObject(this.options.overlay)) {
1348
+ this.options.overlay = {}
1349
+ }
1346
1350
  const overlayFields = [
1347
1351
  [
1348
1352
  'options.overlay.url_template',
@@ -1535,8 +1539,7 @@ U.Map = L.Map.extend({
1535
1539
  const container = L.DomUtil.create('div', 'umap-edit-container')
1536
1540
  const metadataFields = ['options.name', 'options.description']
1537
1541
 
1538
- const title = L.DomUtil.create('h3', '', container)
1539
- title.textContent = L._('Edit map details')
1542
+ L.DomUtil.createTitle(container, L._('Edit map details'), 'icon-caption')
1540
1543
  const builder = new U.FormBuilder(this, metadataFields, {
1541
1544
  className: 'map-metadata',
1542
1545
  })
@@ -1873,10 +1876,6 @@ U.Map = L.Map.extend({
1873
1876
  if (this._controls.search) this._controls.search.open()
1874
1877
  },
1875
1878
 
1876
- getFilterKeys: function () {
1877
- return (this.options.filterKey || this.options.sortKey || 'name').split(',')
1878
- },
1879
-
1880
1879
  getLayersBounds: function () {
1881
1880
  const bounds = new L.latLngBounds()
1882
1881
  this.eachBrowsableDataLayer((d) => {
@@ -913,10 +913,10 @@ U.DataLayer = L.Evented.extend({
913
913
 
914
914
  removeLayer: function (feature) {
915
915
  const id = L.stamp(feature)
916
+ this.layer.removeLayer(feature)
916
917
  feature.disconnectFromDataLayer(this)
917
918
  this._index.splice(this._index.indexOf(id), 1)
918
919
  delete this._layers[id]
919
- this.layer.removeLayer(feature)
920
920
  delete this.map.features_index[feature.getSlug()]
921
921
  if (this.hasDataLoaded()) this.fire('datachanged')
922
922
  },
@@ -1757,6 +1757,16 @@ U.DataLayer = L.Evented.extend({
1757
1757
  const editor = new U.TableEditor(this)
1758
1758
  editor.edit()
1759
1759
  },
1760
+
1761
+ getFilterKeys: function () {
1762
+ // This keys will be used to filter feature from the browser text input.
1763
+ // By default, it will we use the "name" property, which is also the one used as label in the features list.
1764
+ // When map owner has configured another label or sort key, we try to be smart and search in the same keys.
1765
+ if (this.map.options.filterKey) return this.map.options.filterKey
1766
+ else if (this.options.labelKey) return this.options.labelKey
1767
+ else if (this.map.options.sortKey) return this.map.options.sortKey
1768
+ else return 'name'
1769
+ },
1760
1770
  })
1761
1771
 
1762
1772
  L.TileLayer.include({
@@ -107,7 +107,7 @@ U.PopupTemplate.Default = L.Class.extend({
107
107
  renderBody: function () {
108
108
  const template = this.feature.getOption('popupContentTemplate')
109
109
  const target = this.feature.getOption('outlinkTarget')
110
- const container = L.DomUtil.create('div', 'umap-popup-container')
110
+ const container = L.DomUtil.create('div', 'umap-popup-container text')
111
111
  let content = ''
112
112
  let properties
113
113
  let center
@@ -481,7 +481,8 @@ const locale = {
481
481
  "Only geometry centers": "Only geometry centers",
482
482
  "Search area": "Search area",
483
483
  "Type area name, or let empty to load data in current map view": "Type area name, or let empty to load data in current map view",
484
- "Please define an expression for the query first": "Please define an expression for the query first"
484
+ "Please define an expression for the query first": "Please define an expression for the query first",
485
+ "Data successfully imported!": "Data successfully imported!"
485
486
  }
486
487
  L.registerLocale("en", locale)
487
488
  L.setLocale("en")
@@ -481,5 +481,6 @@
481
481
  "Only geometry centers": "Only geometry centers",
482
482
  "Search area": "Search area",
483
483
  "Type area name, or let empty to load data in current map view": "Type area name, or let empty to load data in current map view",
484
- "Please define an expression for the query first": "Please define an expression for the query first"
484
+ "Please define an expression for the query first": "Please define an expression for the query first",
485
+ "Data successfully imported!": "Data successfully imported!"
485
486
  }
@@ -12,13 +12,13 @@ const locale = {
12
12
  "5 min": "5 min",
13
13
  "A comma separated list of numbers that defines the stroke dash pattern. Ex.: \"5, 10, 15\".": "Una lista de números separados por comas que define el patrón de trazos. Por ejemplo: \"5, 10, 15\".",
14
14
  "About": "Acerca de",
15
- "Action not allowed :(": "Action not allowed :(",
15
+ "Action not allowed :(": "Acción no permitida :(",
16
16
  "Activate slideshow mode": "Activar el modo presentación de diapositivas",
17
17
  "Add a layer": "Añadir una capa",
18
18
  "Add a line to the current multi": "Añadir una línea para el multi elemento actual",
19
19
  "Add a new property": "Añadir una nueva propiedad",
20
20
  "Add a polygon to the current multi": "Añadir un polígono al multi elemento actual",
21
- "Add image URL": "Add image URL",
21
+ "Add image URL": "Añadir URL de la imagen",
22
22
  "Add": "Añadir",
23
23
  "Advanced actions": "Acciones avanzadas",
24
24
  "Advanced properties": "Propiedades avanzadas",
@@ -83,7 +83,7 @@ const locale = {
83
83
  "Congratulations, your map has been created!": "Enhorabuena, ¡su mapa ha sido creado!",
84
84
  "Continue line": "Línea continua",
85
85
  "Coordinates": "Coordenadas",
86
- "copy": "copy",
86
+ "copy": "copiar",
87
87
  "Credits": "Créditos",
88
88
  "Current map view": "Current map view",
89
89
  "Current view instead of default map view?": "¿Vista actual en lugar de la vista del mapa predeterminada?",
@@ -185,7 +185,7 @@ const locale = {
185
185
  "icon opacity": "opacidad del icono",
186
186
  "Icon shape": "Forma de icono",
187
187
  "Icon symbol": "Símbolo del icono",
188
- "If false, the polygon or line will act as a part of the underlying map.": "If false, the polygon or line will act as a part of the underlying map.",
188
+ "If false, the polygon or line will act as a part of the underlying map.": "Si está desactivado el polígono o la línea será como una parte del mapa subyacente.",
189
189
  "Iframe with custom height (in px): {{{http://iframe.url.com|height}}}": "Iframe con altura personalizada (en píxeles): {{{http://iframe.url.com|altura}}}",
190
190
  "Iframe with custom height and width (in px): {{{http://iframe.url.com|height*width}}}": "Iframe con alto y ancho (en px) personalizado: {{{http://iframe.url.com|height*width}}}",
191
191
  "iframe": "iframe",
@@ -305,7 +305,7 @@ const locale = {
305
305
  "Replace layer content": "Reemplaza el contenido de la capa",
306
306
  "Restore this version": "Restaurar esta versión",
307
307
  "Save current edits": "Guardar las ediciones actuales",
308
- "Save map": "Save map",
308
+ "Save map": "Guardar el mapa",
309
309
  "Save this center and zoom": "Guardar este centrado y acercamiento",
310
310
  "Save this location as new feature": "Guardar esta ubicación como nuevo elemento",
311
311
  "Save": "Guardar",
@@ -344,7 +344,7 @@ const locale = {
344
344
  "Table": "Tabla",
345
345
  "Text color for the cluster label": "Color del texto para la etiqueta clúster",
346
346
  "Text formatting": "Formato de texto",
347
- "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")": "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")",
347
+ "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")": "El nombre de la propiedad a utilizar como etiqueta de la característica (ej.: \"nombre\"). También puede utilizar propiedades entre llaves para utilizar más de una o mezclarlas con contenido estático (p. ej.: \"&lcub;nombre&rcub; en &lcub;lugar&rcub;\").",
348
348
  "The name of the property to use as feature unique identifier.": "El nombre de la propiedad a utilizar como identificador único del elemento.",
349
349
  "The zoom and center have been modified.": "Se han modificado el zoom y el centro.",
350
350
  "TMS format": "formato TMS",
@@ -409,7 +409,7 @@ const locale = {
409
409
  "{distance}&#8239;NM": "{distancia} NM",
410
410
  "{distance}&#8239;yd": "{distancia} yd",
411
411
  "Edit map name and caption": "Edit map name and caption",
412
- "Map advanced properties": "Map advanced properties",
412
+ "Map advanced properties": "Propiedades avanzadas del mapa",
413
413
  "Edit map details": "Edit map details",
414
414
  "Back to browser": "Back to browser",
415
415
  "Toggle size": "Toggle size",
@@ -481,7 +481,8 @@ const locale = {
481
481
  "Only geometry centers": "Only geometry centers",
482
482
  "Search area": "Search area",
483
483
  "Type area name, or let empty to load data in current map view": "Type area name, or let empty to load data in current map view",
484
- "Please define an expression for the query first": "Please define an expression for the query first"
484
+ "Please define an expression for the query first": "Please define an expression for the query first",
485
+ "Data successfully imported!": "Data successfully imported!"
485
486
  }
486
487
  L.registerLocale("es", locale)
487
488
  L.setLocale("es")
@@ -12,13 +12,13 @@
12
12
  "5 min": "5 min",
13
13
  "A comma separated list of numbers that defines the stroke dash pattern. Ex.: \"5, 10, 15\".": "Una lista de números separados por comas que define el patrón de trazos. Por ejemplo: \"5, 10, 15\".",
14
14
  "About": "Acerca de",
15
- "Action not allowed :(": "Action not allowed :(",
15
+ "Action not allowed :(": "Acción no permitida :(",
16
16
  "Activate slideshow mode": "Activar el modo presentación de diapositivas",
17
17
  "Add a layer": "Añadir una capa",
18
18
  "Add a line to the current multi": "Añadir una línea para el multi elemento actual",
19
19
  "Add a new property": "Añadir una nueva propiedad",
20
20
  "Add a polygon to the current multi": "Añadir un polígono al multi elemento actual",
21
- "Add image URL": "Add image URL",
21
+ "Add image URL": "Añadir URL de la imagen",
22
22
  "Add": "Añadir",
23
23
  "Advanced actions": "Acciones avanzadas",
24
24
  "Advanced properties": "Propiedades avanzadas",
@@ -83,7 +83,7 @@
83
83
  "Congratulations, your map has been created!": "Enhorabuena, ¡su mapa ha sido creado!",
84
84
  "Continue line": "Línea continua",
85
85
  "Coordinates": "Coordenadas",
86
- "copy": "copy",
86
+ "copy": "copiar",
87
87
  "Credits": "Créditos",
88
88
  "Current map view": "Current map view",
89
89
  "Current view instead of default map view?": "¿Vista actual en lugar de la vista del mapa predeterminada?",
@@ -185,7 +185,7 @@
185
185
  "icon opacity": "opacidad del icono",
186
186
  "Icon shape": "Forma de icono",
187
187
  "Icon symbol": "Símbolo del icono",
188
- "If false, the polygon or line will act as a part of the underlying map.": "If false, the polygon or line will act as a part of the underlying map.",
188
+ "If false, the polygon or line will act as a part of the underlying map.": "Si está desactivado el polígono o la línea será como una parte del mapa subyacente.",
189
189
  "Iframe with custom height (in px): {{{http://iframe.url.com|height}}}": "Iframe con altura personalizada (en píxeles): {{{http://iframe.url.com|altura}}}",
190
190
  "Iframe with custom height and width (in px): {{{http://iframe.url.com|height*width}}}": "Iframe con alto y ancho (en px) personalizado: {{{http://iframe.url.com|height*width}}}",
191
191
  "iframe": "iframe",
@@ -305,7 +305,7 @@
305
305
  "Replace layer content": "Reemplaza el contenido de la capa",
306
306
  "Restore this version": "Restaurar esta versión",
307
307
  "Save current edits": "Guardar las ediciones actuales",
308
- "Save map": "Save map",
308
+ "Save map": "Guardar el mapa",
309
309
  "Save this center and zoom": "Guardar este centrado y acercamiento",
310
310
  "Save this location as new feature": "Guardar esta ubicación como nuevo elemento",
311
311
  "Save": "Guardar",
@@ -344,7 +344,7 @@
344
344
  "Table": "Tabla",
345
345
  "Text color for the cluster label": "Color del texto para la etiqueta clúster",
346
346
  "Text formatting": "Formato de texto",
347
- "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")": "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")",
347
+ "The name of the property to use as feature label (eg.: \"nom\"). You can also use properties inside brackets to use more than one or mix with static content (eg.: \"&lcub;name&rcub; in &lcub;place&rcub;\")": "El nombre de la propiedad a utilizar como etiqueta de la característica (ej.: \"nombre\"). También puede utilizar propiedades entre llaves para utilizar más de una o mezclarlas con contenido estático (p. ej.: \"&lcub;nombre&rcub; en &lcub;lugar&rcub;\").",
348
348
  "The name of the property to use as feature unique identifier.": "El nombre de la propiedad a utilizar como identificador único del elemento.",
349
349
  "The zoom and center have been modified.": "Se han modificado el zoom y el centro.",
350
350
  "TMS format": "formato TMS",
@@ -409,7 +409,7 @@
409
409
  "{distance}&#8239;NM": "{distancia} NM",
410
410
  "{distance}&#8239;yd": "{distancia} yd",
411
411
  "Edit map name and caption": "Edit map name and caption",
412
- "Map advanced properties": "Map advanced properties",
412
+ "Map advanced properties": "Propiedades avanzadas del mapa",
413
413
  "Edit map details": "Edit map details",
414
414
  "Back to browser": "Back to browser",
415
415
  "Toggle size": "Toggle size",
@@ -481,5 +481,6 @@
481
481
  "Only geometry centers": "Only geometry centers",
482
482
  "Search area": "Search area",
483
483
  "Type area name, or let empty to load data in current map view": "Type area name, or let empty to load data in current map view",
484
- "Please define an expression for the query first": "Please define an expression for the query first"
484
+ "Please define an expression for the query first": "Please define an expression for the query first",
485
+ "Data successfully imported!": "Data successfully imported!"
485
486
  }