umap-project 2.6.0b0__py3-none-any.whl → 2.6.0b2__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.
Files changed (127) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/en/LC_MESSAGES/django.po +3 -3
  3. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/hu/LC_MESSAGES/django.po +18 -18
  5. umap/settings/base.py +6 -0
  6. umap/static/umap/js/modules/autocomplete.js +5 -9
  7. umap/static/umap/js/modules/data/features.js +6 -12
  8. umap/static/umap/js/modules/importers/overpass.js +22 -8
  9. umap/static/umap/js/modules/rendering/ui.js +41 -4
  10. umap/static/umap/js/modules/rules.js +16 -3
  11. umap/static/umap/js/modules/schema.js +1 -1
  12. umap/static/umap/js/umap.controls.js +2 -1
  13. umap/static/umap/js/umap.forms.js +9 -5
  14. umap/static/umap/js/umap.js +7 -2
  15. umap/static/umap/locale/am_ET.js +8 -2
  16. umap/static/umap/locale/am_ET.json +8 -2
  17. umap/static/umap/locale/ar.js +8 -2
  18. umap/static/umap/locale/ar.json +8 -2
  19. umap/static/umap/locale/ast.js +8 -2
  20. umap/static/umap/locale/ast.json +8 -2
  21. umap/static/umap/locale/bg.js +8 -2
  22. umap/static/umap/locale/bg.json +8 -2
  23. umap/static/umap/locale/br.js +8 -2
  24. umap/static/umap/locale/br.json +8 -2
  25. umap/static/umap/locale/ca.js +18 -12
  26. umap/static/umap/locale/ca.json +18 -12
  27. umap/static/umap/locale/cs_CZ.js +8 -2
  28. umap/static/umap/locale/cs_CZ.json +8 -2
  29. umap/static/umap/locale/da.js +8 -2
  30. umap/static/umap/locale/da.json +8 -2
  31. umap/static/umap/locale/de.js +8 -2
  32. umap/static/umap/locale/de.json +8 -2
  33. umap/static/umap/locale/el.js +8 -2
  34. umap/static/umap/locale/el.json +8 -2
  35. umap/static/umap/locale/en.js +4 -2
  36. umap/static/umap/locale/en.json +4 -2
  37. umap/static/umap/locale/en_US.json +8 -2
  38. umap/static/umap/locale/es.js +8 -2
  39. umap/static/umap/locale/es.json +8 -2
  40. umap/static/umap/locale/et.js +8 -2
  41. umap/static/umap/locale/et.json +8 -2
  42. umap/static/umap/locale/eu.js +344 -338
  43. umap/static/umap/locale/eu.json +344 -338
  44. umap/static/umap/locale/fa_IR.js +368 -362
  45. umap/static/umap/locale/fa_IR.json +368 -362
  46. umap/static/umap/locale/fi.js +8 -2
  47. umap/static/umap/locale/fi.json +8 -2
  48. umap/static/umap/locale/fr.js +4 -2
  49. umap/static/umap/locale/fr.json +4 -2
  50. umap/static/umap/locale/gl.js +8 -2
  51. umap/static/umap/locale/gl.json +8 -2
  52. umap/static/umap/locale/he.js +8 -2
  53. umap/static/umap/locale/he.json +8 -2
  54. umap/static/umap/locale/hr.js +8 -2
  55. umap/static/umap/locale/hr.json +8 -2
  56. umap/static/umap/locale/hu.js +31 -23
  57. umap/static/umap/locale/hu.json +31 -23
  58. umap/static/umap/locale/id.js +8 -2
  59. umap/static/umap/locale/id.json +8 -2
  60. umap/static/umap/locale/is.js +8 -2
  61. umap/static/umap/locale/is.json +8 -2
  62. umap/static/umap/locale/it.js +8 -2
  63. umap/static/umap/locale/it.json +8 -2
  64. umap/static/umap/locale/ja.js +8 -2
  65. umap/static/umap/locale/ja.json +8 -2
  66. umap/static/umap/locale/ko.js +8 -2
  67. umap/static/umap/locale/ko.json +8 -2
  68. umap/static/umap/locale/lt.js +8 -2
  69. umap/static/umap/locale/lt.json +8 -2
  70. umap/static/umap/locale/ms.js +8 -2
  71. umap/static/umap/locale/ms.json +8 -2
  72. umap/static/umap/locale/nl.js +8 -2
  73. umap/static/umap/locale/nl.json +8 -2
  74. umap/static/umap/locale/no.js +8 -2
  75. umap/static/umap/locale/no.json +8 -2
  76. umap/static/umap/locale/pl.js +54 -48
  77. umap/static/umap/locale/pl.json +54 -48
  78. umap/static/umap/locale/pl_PL.json +8 -2
  79. umap/static/umap/locale/pt.js +8 -2
  80. umap/static/umap/locale/pt.json +8 -2
  81. umap/static/umap/locale/pt_BR.js +8 -2
  82. umap/static/umap/locale/pt_BR.json +8 -2
  83. umap/static/umap/locale/pt_PT.js +8 -2
  84. umap/static/umap/locale/pt_PT.json +8 -2
  85. umap/static/umap/locale/ro.js +8 -2
  86. umap/static/umap/locale/ro.json +8 -2
  87. umap/static/umap/locale/ru.js +8 -2
  88. umap/static/umap/locale/ru.json +8 -2
  89. umap/static/umap/locale/sk_SK.js +8 -2
  90. umap/static/umap/locale/sk_SK.json +8 -2
  91. umap/static/umap/locale/sl.js +8 -2
  92. umap/static/umap/locale/sl.json +8 -2
  93. umap/static/umap/locale/sr.js +8 -2
  94. umap/static/umap/locale/sr.json +8 -2
  95. umap/static/umap/locale/sv.js +8 -2
  96. umap/static/umap/locale/sv.json +8 -2
  97. umap/static/umap/locale/th_TH.js +8 -2
  98. umap/static/umap/locale/th_TH.json +8 -2
  99. umap/static/umap/locale/tr.js +8 -2
  100. umap/static/umap/locale/tr.json +8 -2
  101. umap/static/umap/locale/uk_UA.js +8 -2
  102. umap/static/umap/locale/uk_UA.json +8 -2
  103. umap/static/umap/locale/vi.js +8 -2
  104. umap/static/umap/locale/vi.json +8 -2
  105. umap/static/umap/locale/vi_VN.json +8 -2
  106. umap/static/umap/locale/zh.js +8 -2
  107. umap/static/umap/locale/zh.json +8 -2
  108. umap/static/umap/locale/zh_CN.json +8 -2
  109. umap/static/umap/locale/zh_TW.Big5.json +8 -2
  110. umap/static/umap/locale/zh_TW.js +102 -96
  111. umap/static/umap/locale/zh_TW.json +102 -96
  112. umap/static/umap/map.css +4 -4
  113. umap/static/umap/vars.css +1 -0
  114. umap/static/umap/vendors/editable/Leaflet.Editable.js +2079 -1937
  115. umap/static/umap/vendors/markercluster/MarkerCluster.Default.css +1 -1
  116. umap/templates/umap/content_footer.html +1 -1
  117. umap/templates/umap/map_list.html +3 -1
  118. umap/tests/integration/test_conditional_rules.py +102 -17
  119. umap/tests/integration/test_draw_polygon.py +28 -0
  120. umap/tests/integration/test_edit_datalayer.py +2 -2
  121. umap/tests/integration/test_import.py +60 -0
  122. umap/tests/integration/test_querystring.py +7 -0
  123. {umap_project-2.6.0b0.dist-info → umap_project-2.6.0b2.dist-info}/METADATA +6 -6
  124. {umap_project-2.6.0b0.dist-info → umap_project-2.6.0b2.dist-info}/RECORD +127 -127
  125. {umap_project-2.6.0b0.dist-info → umap_project-2.6.0b2.dist-info}/WHEEL +0 -0
  126. {umap_project-2.6.0b0.dist-info → umap_project-2.6.0b2.dist-info}/entry_points.txt +0 -0
  127. {umap_project-2.6.0b0.dist-info → umap_project-2.6.0b2.dist-info}/licenses/LICENSE +0 -0
umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "2.6.0b0"
1
+ VERSION = "2.6.0b2"
@@ -8,7 +8,7 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2024-08-30 18:23+0000\n"
11
+ "POT-Creation-Date: 2024-09-04 14:02+0000\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -368,11 +368,11 @@ msgstr ""
368
368
  msgid "You are logged in. Continuing..."
369
369
  msgstr ""
370
370
 
371
- #: templates/umap/map_list.html:10 views.py:433
371
+ #: templates/umap/map_list.html:11 views.py:433
372
372
  msgid "by"
373
373
  msgstr ""
374
374
 
375
- #: templates/umap/map_list.html:18
375
+ #: templates/umap/map_list.html:20
376
376
  msgid "More"
377
377
  msgstr ""
378
378
 
Binary file
@@ -9,7 +9,7 @@ msgid ""
9
9
  msgstr ""
10
10
  "Project-Id-Version: uMap\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
- "POT-Creation-Date: 2024-08-30 18:23+0000\n"
12
+ "POT-Creation-Date: 2024-09-04 14:02+0000\n"
13
13
  "PO-Revision-Date: 2013-11-22 14:00+0000\n"
14
14
  "Last-Translator: Gábor Babos <gabor.babos@gmail.com>, 2017-2019,2023-2024\n"
15
15
  "Language-Team: Hungarian (http://app.transifex.com/openstreetmap/umap/language/hu/)\n"
@@ -65,7 +65,7 @@ msgstr "Mindenki"
65
65
 
66
66
  #: models.py:168 models.py:174 models.py:425
67
67
  msgid "Editors and team only"
68
- msgstr ""
68
+ msgstr "Csak a szerkesztők és a csoport"
69
69
 
70
70
  #: models.py:169 models.py:426
71
71
  msgid "Owner only"
@@ -117,7 +117,7 @@ msgstr "szerkesztők"
117
117
 
118
118
  #: models.py:207
119
119
  msgid "team"
120
- msgstr ""
120
+ msgstr "csoport"
121
121
 
122
122
  #: models.py:213 models.py:447
123
123
  msgid "edit status"
@@ -323,19 +323,19 @@ msgstr "Ez egy demonstrációs változat, amelyet tesztelésre és még nem nyil
323
323
 
324
324
  #: templates/umap/content_footer.html:5
325
325
  msgid "An OpenStreetMap project"
326
- msgstr ""
326
+ msgstr "OpenStreetMap projekt"
327
327
 
328
328
  #: templates/umap/content_footer.html:6
329
329
  msgid "version"
330
- msgstr ""
330
+ msgstr "verzió"
331
331
 
332
332
  #: templates/umap/content_footer.html:7
333
333
  msgid "Hosted by"
334
- msgstr ""
334
+ msgstr "Tárhely:"
335
335
 
336
336
  #: templates/umap/content_footer.html:8
337
337
  msgid "Contact"
338
- msgstr ""
338
+ msgstr "Kapcsolat:"
339
339
 
340
340
  #: templates/umap/content_footer.html:9 templates/umap/navigation.html:25
341
341
  msgid "Help"
@@ -356,7 +356,7 @@ msgstr "Saját profil"
356
356
 
357
357
  #: templates/umap/dashboard_menu.html:13
358
358
  msgid "My teams"
359
- msgstr ""
359
+ msgstr "Csoportjaim"
360
360
 
361
361
  #: templates/umap/home.html:14
362
362
  msgid "Map of the uMaps"
@@ -370,11 +370,11 @@ msgstr "Szerezzen ihletet, böngésszen a térképek között!"
370
370
  msgid "You are logged in. Continuing..."
371
371
  msgstr "Be van jelentkezve. Továbblépés…"
372
372
 
373
- #: templates/umap/map_list.html:10 views.py:433
373
+ #: templates/umap/map_list.html:11 views.py:433
374
374
  msgid "by"
375
375
  msgstr "– készítette:"
376
376
 
377
- #: templates/umap/map_list.html:18
377
+ #: templates/umap/map_list.html:20
378
378
  msgid "More"
379
379
  msgstr "Még több"
380
380
 
@@ -550,20 +550,20 @@ msgstr "Keresés"
550
550
  #: templates/umap/team_detail.html:10
551
551
  #, python-format
552
552
  msgid "Browse %(current_team)s's maps"
553
- msgstr ""
553
+ msgstr "%(current_team)s csoport térképeinek böngészése"
554
554
 
555
555
  #: templates/umap/team_detail.html:22
556
556
  #, python-format
557
557
  msgid "%(current_team)s has no public maps."
558
- msgstr ""
558
+ msgstr "%(current_team)s csoportnak nincs nyilvános térképe."
559
559
 
560
560
  #: templates/umap/team_form.html:24
561
561
  msgid "Delete this team"
562
- msgstr ""
562
+ msgstr "Csoport törlése"
563
563
 
564
564
  #: templates/umap/team_form.html:47
565
565
  msgid "Add user"
566
- msgstr ""
566
+ msgstr "Felhasználó hozzáadása"
567
567
 
568
568
  #: templates/umap/user_dashboard.html:9 templates/umap/user_dashboard.html:25
569
569
  msgid "Search my maps"
@@ -584,20 +584,20 @@ msgstr "Önnek még nincs térképe."
584
584
 
585
585
  #: templates/umap/user_teams.html:17
586
586
  msgid "Users"
587
- msgstr ""
587
+ msgstr "Felhasználók"
588
588
 
589
589
  #: templates/umap/user_teams.html:48
590
590
  msgid "New team"
591
- msgstr ""
591
+ msgstr "Új csoport"
592
592
 
593
593
  #: views.py:235
594
594
  msgid "Cannot delete a team with more than one member"
595
- msgstr ""
595
+ msgstr "Egynél több tagú csoport nem törölhető"
596
596
 
597
597
  #: views.py:239
598
598
  #, python-format
599
599
  msgid "Team “%(name)s” has been deleted"
600
- msgstr ""
600
+ msgstr "%(name)s csoport törölve"
601
601
 
602
602
  #: views.py:438
603
603
  msgid "View the map"
umap/settings/base.py CHANGED
@@ -51,6 +51,12 @@ LANG_INFO.update(
51
51
  "name": "Malay",
52
52
  "name_local": "Bahasa Melayu",
53
53
  },
54
+ "fa-ir": {
55
+ "bidi": True,
56
+ "code": "fa-ir",
57
+ "name": "Persian (Iran)",
58
+ "name_local": "فارسی",
59
+ },
54
60
  }
55
61
  )
56
62
  # Local time zone for this installation. Choices can be found here:
@@ -306,15 +306,11 @@ export const SingleMixin = (Base) =>
306
306
  textContent: '×',
307
307
  })
308
308
  this.input.style.display = 'none'
309
- DomEvent.on(
310
- close,
311
- 'click',
312
- function () {
313
- this.selectedContainer.innerHTML = ''
314
- this.input.style.display = 'block'
315
- },
316
- this
317
- )
309
+ DomEvent.on(close, 'click', () => {
310
+ this.selectedContainer.innerHTML = ''
311
+ this.input.style.display = 'block'
312
+ this.options.on_unselect(result)
313
+ })
318
314
  this.hide()
319
315
  }
320
316
  }
@@ -98,6 +98,10 @@ class Feature {
98
98
  this.pushGeometry()
99
99
  }
100
100
 
101
+ isOnScreen(bounds) {
102
+ return this.ui?.isOnScreen(bounds)
103
+ }
104
+
101
105
  pushGeometry() {
102
106
  this.ui.setLatLngs(this.toLatLngs())
103
107
  }
@@ -257,7 +261,7 @@ class Feature {
257
261
  builder.helpers['properties.name'].input.focus()
258
262
  })
259
263
  this.map.editedFeature = this
260
- if (!this.isOnScreen()) this.zoomTo(event)
264
+ if (!this.ui.isOnScreen(this.map.getBounds())) this.zoomTo(event)
261
265
  }
262
266
 
263
267
  getAdvancedEditActions(container) {
@@ -661,11 +665,6 @@ export class Point extends Feature {
661
665
  super.zoomTo(event)
662
666
  }
663
667
  }
664
-
665
- isOnScreen(bounds) {
666
- bounds = bounds || this.map.getBounds()
667
- return bounds.contains(this.toLatLngs())
668
- }
669
668
  }
670
669
 
671
670
  class Path extends Feature {
@@ -681,8 +680,8 @@ class Path extends Feature {
681
680
 
682
681
  edit(event) {
683
682
  if (this.map.editEnabled) {
684
- if (!this.ui.editEnabled()) this.ui.enableEdit()
685
683
  super.edit(event)
684
+ if (!this.ui.editEnabled()) this.ui.makeGeometryEditable()
686
685
  }
687
686
  }
688
687
 
@@ -753,11 +752,6 @@ class Path extends Feature {
753
752
  return items
754
753
  }
755
754
 
756
- isOnScreen(bounds) {
757
- bounds = bounds || this.map.getBounds()
758
- return bounds.overlaps(this.bounds)
759
- }
760
-
761
755
  zoomTo({ easing, callback }) {
762
756
  // Use bounds instead of centroid for paths.
763
757
  easing = easing || this.map.getOption('easing')
@@ -25,10 +25,20 @@ class Autocomplete extends SingleMixin(BaseAjax) {
25
25
  }
26
26
 
27
27
  createResult(item) {
28
+ const labels = [item.properties.name]
29
+ if (item.properties.county) {
30
+ labels.push(item.properties.county)
31
+ }
32
+ if (item.properties.state) {
33
+ labels.push(item.properties.state)
34
+ }
35
+ if (item.properties.country) {
36
+ labels.push(item.properties.country)
37
+ }
28
38
  return super.createResult({
29
39
  // Overpass convention to get their id from an osm one.
30
40
  value: item.properties.osm_id + 3600000000,
31
- label: `${item.properties.name}`,
41
+ label: labels.join(', '),
32
42
  })
33
43
  }
34
44
  }
@@ -42,11 +52,10 @@ export class Importer {
42
52
  options?.searchUrl ||
43
53
  'https://photon.komoot.io/api?q={q}&layer=county&layer=city&layer=state'
44
54
  this.id = 'overpass'
55
+ this.boundaryChoice = null
45
56
  }
46
57
 
47
58
  async open(importer) {
48
- let boundary = null
49
- let boundaryName = null
50
59
  const container = DomUtil.create('div')
51
60
  container.innerHTML = TEMPLATE
52
61
  this.autocomplete = new Autocomplete(container.querySelector('#area'), {
@@ -55,10 +64,15 @@ export class Importer {
55
64
  'Type area name, or let empty to load data in current map view'
56
65
  ),
57
66
  on_select: (choice) => {
58
- boundary = choice.item.value
59
- boundaryName = choice.item.label
67
+ this.boundaryChoice = choice
68
+ },
69
+ on_unselect: (choice) => {
70
+ this.boundaryChoice = null
60
71
  },
61
72
  })
73
+ if (this.boundaryChoice) {
74
+ this.autocomplete.displaySelected(this.boundaryChoice)
75
+ }
62
76
  this.map.help.parse(container)
63
77
 
64
78
  const confirm = (form) => {
@@ -69,10 +83,10 @@ export class Importer {
69
83
  let tags = form.tags
70
84
  if (!tags.startsWith('[')) tags = `[${tags}]`
71
85
  let area = '{south},{west},{north},{east}'
72
- if (boundary) area = `area:${boundary}`
86
+ if (this.boundaryChoice) area = `area:${this.boundaryChoice.item.value}`
73
87
  const query = `[out:json];nwr${tags}(${area});out ${form.out};`
74
88
  importer.url = `${this.baseUrl}?data=${query}`
75
- if (boundary) importer.layerName = boundaryName
89
+ if (this.boundaryChoice) importer.layerName = this.boundaryChoice.item.label
76
90
  importer.format = 'osm'
77
91
  }
78
92
 
@@ -81,7 +95,7 @@ export class Importer {
81
95
  template: container,
82
96
  className: `${this.id} importer dark`,
83
97
  accept: translate('Choose this data'),
84
- cancel: false
98
+ cancel: false,
85
99
  })
86
100
  .then(confirm)
87
101
  }
@@ -93,13 +93,21 @@ const FeatureMixin = {
93
93
  getContextMenuItems: function (event) {
94
94
  const permalink = this.feature.getPermalink()
95
95
  let items = []
96
- if (permalink)
96
+ if (permalink) {
97
97
  items.push({
98
98
  text: translate('Permalink'),
99
99
  callback: () => {
100
100
  window.open(permalink)
101
101
  },
102
102
  })
103
+ }
104
+ items.push({
105
+ text: translate('Copy as GeoJSON'),
106
+ callback: () => {
107
+ L.Util.copyToClipboard(JSON.stringify(this.feature.toGeoJSON()))
108
+ this._map.tooltip.open({ content: L._('✅ Copied!') })
109
+ },
110
+ })
103
111
  if (this._map.editEnabled && !this.feature.isReadOnly()) {
104
112
  items = items.concat(this.getContextMenuEditItems(event))
105
113
  }
@@ -146,9 +154,15 @@ const FeatureMixin = {
146
154
  getPopupToolbarAnchor: () => [0, 0],
147
155
  }
148
156
 
157
+ const PointMixin = {
158
+ isOnScreen: function (bounds) {
159
+ return bounds.contains(this.getCenter())
160
+ },
161
+ }
162
+
149
163
  export const LeafletMarker = Marker.extend({
150
164
  parentClass: Marker,
151
- includes: [FeatureMixin],
165
+ includes: [FeatureMixin, PointMixin],
152
166
 
153
167
  initialize: function (feature, latlng) {
154
168
  FeatureMixin.initialize.call(this, feature, latlng)
@@ -274,6 +288,21 @@ const PathMixin = {
274
288
  }
275
289
  },
276
290
 
291
+ makeGeometryEditable: function () {
292
+ if (this._map.editedFeature !== this.feature) {
293
+ this.disableEdit()
294
+ return
295
+ }
296
+ this._map.once('moveend', this.makeGeometryEditable, this)
297
+ const pointsCount = this._parts.reduce((acc, part) => acc + part.length, 0)
298
+ if (pointsCount > 100 && this._map.getZoom() < this._map.getMaxZoom()) {
299
+ this._map.tooltip.open({ content: L._('Please zoom in to edit the geometry') })
300
+ this.disableEdit()
301
+ } else {
302
+ this.enableEdit()
303
+ }
304
+ },
305
+
277
306
  addInteractions: function () {
278
307
  FeatureMixin.addInteractions.call(this)
279
308
  this.on('editable:disable', this.onCommit)
@@ -369,7 +398,7 @@ const PathMixin = {
369
398
  getContextMenuEditItems: function (event) {
370
399
  const items = FeatureMixin.getContextMenuEditItems.call(this, event)
371
400
  if (
372
- this._map?.editedFeature !== this &&
401
+ this._map?.editedFeature !== this.feature &&
373
402
  this.feature.isSameClass(this._map.editedFeature)
374
403
  ) {
375
404
  items.push({
@@ -411,6 +440,10 @@ const PathMixin = {
411
440
  'dashArray',
412
441
  'interactive',
413
442
  ],
443
+
444
+ isOnScreen: function (bounds) {
445
+ return bounds.overlaps(this.getBounds())
446
+ },
414
447
  }
415
448
 
416
449
  export const LeafletPolyline = Polyline.extend({
@@ -552,7 +585,7 @@ export const MaskPolygon = LeafletPolygon.extend({
552
585
 
553
586
  export const CircleMarker = BaseCircleMarker.extend({
554
587
  parentClass: BaseCircleMarker,
555
- includes: [FeatureMixin, PathMixin],
588
+ includes: [FeatureMixin, PathMixin, PointMixin],
556
589
  initialize: function (feature, latlng) {
557
590
  if (Array.isArray(latlng) && !(latlng[0] instanceof Number)) {
558
591
  // Must be a line or polygon
@@ -570,4 +603,8 @@ export const CircleMarker = BaseCircleMarker.extend({
570
603
  getCenter: function () {
571
604
  return this._latlng
572
605
  },
606
+ // FIXME when Leaflet.Editable knows about CircleMarker
607
+ editEnabled: () => false,
608
+ enableEdit: () => {}, // No-op
609
+ disableEdit: () => {}, // No-op
573
610
  })
@@ -3,6 +3,8 @@ import { translate } from './i18n.js'
3
3
  import * as Utils from './utils.js'
4
4
  import { AutocompleteDatalist } from './autocomplete.js'
5
5
 
6
+ const EMPTY_VALUES = ['', undefined, null]
7
+
6
8
  class Rule {
7
9
  get condition() {
8
10
  return this._condition
@@ -75,13 +77,22 @@ class Rule {
75
77
  if (vars.length !== 2) return
76
78
  this.key = vars[0]
77
79
  this.expected = vars[1]
80
+ if (EMPTY_VALUES.includes(this.expected)) {
81
+ this.cast = (v) => EMPTY_VALUES.includes(v)
82
+ }
78
83
  // Special cases where we want to be lousy when checking isNaN without
79
84
  // coercing to a Number first because we handle multiple types.
80
85
  // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/
81
86
  // Reference/Global_Objects/Number/isNaN
82
87
  // biome-ignore lint/suspicious/noGlobalIsNan: expected might not be a number.
83
- if (!isNaN(this.expected)) this.cast = Number.parseFloat
84
- else if (['true', 'false'].includes(this.expected)) this.cast = (v) => !!v
88
+ else if (!isNaN(this.expected)) {
89
+ this.cast = Number.parseFloat
90
+ } else if (['true', 'false'].includes(this.expected)) {
91
+ this.cast = (v) => {
92
+ if (`${v}`.toLowerCase() === 'true') return true
93
+ if (`${v}`.toLowerCase() === 'false') return false
94
+ }
95
+ }
85
96
  this.expected = this.cast(this.expected)
86
97
  }
87
98
 
@@ -133,7 +144,9 @@ class Rule {
133
144
  autocomplete.suggestions = [`${value}=`, `${value}!=`, `${value}>`, `${value}<`]
134
145
  } else if (value.endsWith('=')) {
135
146
  const key = value.split('!')[0].split('=')[0]
136
- autocomplete.suggestions = this.map.sortedValues(key).map((str) => `${value}${str || ''}`)
147
+ autocomplete.suggestions = this.map
148
+ .sortedValues(key)
149
+ .map((str) => `${value}${str || ''}`)
137
150
  }
138
151
  })
139
152
  this.map.editPanel.open({ content: container })
@@ -81,7 +81,7 @@ export const SCHEMA = {
81
81
  impacts: ['ui'],
82
82
  nullable: true,
83
83
  handler: 'DataLayersControl',
84
- label: translate('Display the data layers control'),
84
+ label: translate('Display the open browser control'),
85
85
  default: true,
86
86
  },
87
87
  defaultView: {
@@ -795,13 +795,14 @@ U.TileLayerControl = L.Control.IconLayers.extend({
795
795
  }
796
796
  })
797
797
  }
798
+ this._allLayers = layers
798
799
  L.Control.IconLayers.prototype.setLayers.call(this, layers.slice(0, this.maxShown))
799
800
  if (this.map.selected_tilelayer) this.setActiveLayer(this.map.selected_tilelayer)
800
801
  },
801
802
 
802
803
  _createLayerElements: function () {
803
804
  L.Control.IconLayers.prototype._createLayerElements.call(this)
804
- if (Object.keys(this._layers) <= this.maxShown) return
805
+ if (Object.keys(this._allLayers).length <= this.maxShown) return
805
806
  const lastRow = this._container.querySelector(
806
807
  '.leaflet-iconLayers-layersRow:last-child'
807
808
  )
@@ -902,8 +902,8 @@ L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
902
902
  if (!this.container.querySelector(`input[type="radio"][value="${value}"]`)) {
903
903
  value = this.options.default !== undefined ? this.options.default : this.default
904
904
  }
905
- const choices = this.getChoices().map(([value, label]) => value)
906
- if (choices.includes(value)) {
905
+ const choices = this.getChoices().map(([value, label]) => `${value}`)
906
+ if (choices.includes(`${value}`)) {
907
907
  this.container.querySelector(`input[type="radio"][value="${value}"]`).checked =
908
908
  true
909
909
  }
@@ -925,8 +925,8 @@ L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
925
925
  `${this.className} by${choices.length}`,
926
926
  this.parentNode
927
927
  )
928
- for (let i = 0; i < choices.length; i++) {
929
- this.addChoice(choices[i][0], choices[i][1], i)
928
+ for (const [i, [value, label]] of choices.entries()) {
929
+ this.addChoice(value, label, i)
930
930
  }
931
931
  this.fetch()
932
932
  },
@@ -958,8 +958,12 @@ L.FormBuilder.TernaryChoices = L.FormBuilder.MultiChoice.extend({
958
958
  case false:
959
959
  value = false
960
960
  break
961
- default:
961
+ case 'null':
962
+ case null:
962
963
  value = null
964
+ break
965
+ default:
966
+ value = undefined
963
967
  }
964
968
  return value
965
969
  },
@@ -144,7 +144,10 @@ U.Map = L.Map.extend({
144
144
  delete this.options.displayDataBrowserOnLoad
145
145
  }
146
146
  if (this.options.datalayersControl === 'expanded') {
147
- this.options.onLoadPanel = 'datalayers'
147
+ if (!this.options.onLoadPanel) {
148
+ this.options.onLoadPanel = 'datalayers'
149
+ }
150
+ delete this.options.datalayersControl
148
151
  }
149
152
  if (this.options.onLoadPanel === 'facet') {
150
153
  this.options.onLoadPanel = 'datafilters'
@@ -280,7 +283,9 @@ U.Map = L.Map.extend({
280
283
  // Specific case for datalayersControl
281
284
  // which accepts "expanded" value, on top of true/false/null
282
285
  if (L.Util.queryString('datalayersControl') === 'expanded') {
283
- options.onLoadPanel = 'datalayers'
286
+ if (!options.onLoadPanel) {
287
+ options.onLoadPanel = 'datalayers'
288
+ }
284
289
  }
285
290
  },
286
291
 
@@ -115,7 +115,6 @@ const locale = {
115
115
  "display name": "ስሙን አሳይ",
116
116
  "Display on load": "በመጫን ላይ እያለ አሳይ",
117
117
  "Display the control to open OpenStreetMap editor": "Display the control to open OpenStreetMap editor",
118
- "Display the data layers control": "Display the data layers control",
119
118
  "Display the embed control": "Display the embed control",
120
119
  "Display the fullscreen control": "Display the fullscreen control",
121
120
  "Display the locate control": "Display the locate control",
@@ -498,7 +497,14 @@ const locale = {
498
497
  "Found {count} rows. Are you sure you want to delete all?": "Found {count} rows. Are you sure you want to delete all?",
499
498
  "Expression is empty": "Expression is empty",
500
499
  "OK": "OK",
501
- "Cancel": "Cancel"
500
+ "Cancel": "Cancel",
501
+ "Attach map to a team": "Attach map to a team",
502
+ "Display the polygon inverted": "Display the polygon inverted",
503
+ "Proportional circles": "Proportional circles",
504
+ "Property name to compute circles": "Property name to compute circles",
505
+ "Min circle radius": "Min circle radius",
506
+ "Max circle radius": "Max circle radius",
507
+ "Display the open browser control": "Display the open browser control"
502
508
  }
503
509
  L.registerLocale("am_ET", locale)
504
510
  L.setLocale("am_ET")
@@ -115,7 +115,6 @@
115
115
  "display name": "ስሙን አሳይ",
116
116
  "Display on load": "በመጫን ላይ እያለ አሳይ",
117
117
  "Display the control to open OpenStreetMap editor": "Display the control to open OpenStreetMap editor",
118
- "Display the data layers control": "Display the data layers control",
119
118
  "Display the embed control": "Display the embed control",
120
119
  "Display the fullscreen control": "Display the fullscreen control",
121
120
  "Display the locate control": "Display the locate control",
@@ -498,5 +497,12 @@
498
497
  "Found {count} rows. Are you sure you want to delete all?": "Found {count} rows. Are you sure you want to delete all?",
499
498
  "Expression is empty": "Expression is empty",
500
499
  "OK": "OK",
501
- "Cancel": "Cancel"
500
+ "Cancel": "Cancel",
501
+ "Attach map to a team": "Attach map to a team",
502
+ "Display the polygon inverted": "Display the polygon inverted",
503
+ "Proportional circles": "Proportional circles",
504
+ "Property name to compute circles": "Property name to compute circles",
505
+ "Min circle radius": "Min circle radius",
506
+ "Max circle radius": "Max circle radius",
507
+ "Display the open browser control": "Display the open browser control"
502
508
  }
@@ -115,7 +115,6 @@ const locale = {
115
115
  "display name": "display name",
116
116
  "Display on load": "Display on load",
117
117
  "Display the control to open OpenStreetMap editor": "Display the control to open OpenStreetMap editor",
118
- "Display the data layers control": "Display the data layers control",
119
118
  "Display the embed control": "Display the embed control",
120
119
  "Display the fullscreen control": "Display the fullscreen control",
121
120
  "Display the locate control": "Display the locate control",
@@ -498,7 +497,14 @@ const locale = {
498
497
  "Found {count} rows. Are you sure you want to delete all?": "Found {count} rows. Are you sure you want to delete all?",
499
498
  "Expression is empty": "Expression is empty",
500
499
  "OK": "OK",
501
- "Cancel": "Cancel"
500
+ "Cancel": "Cancel",
501
+ "Attach map to a team": "Attach map to a team",
502
+ "Display the polygon inverted": "Display the polygon inverted",
503
+ "Proportional circles": "Proportional circles",
504
+ "Property name to compute circles": "Property name to compute circles",
505
+ "Min circle radius": "Min circle radius",
506
+ "Max circle radius": "Max circle radius",
507
+ "Display the open browser control": "Display the open browser control"
502
508
  }
503
509
  L.registerLocale("ar", locale)
504
510
  L.setLocale("ar")
@@ -115,7 +115,6 @@
115
115
  "display name": "display name",
116
116
  "Display on load": "Display on load",
117
117
  "Display the control to open OpenStreetMap editor": "Display the control to open OpenStreetMap editor",
118
- "Display the data layers control": "Display the data layers control",
119
118
  "Display the embed control": "Display the embed control",
120
119
  "Display the fullscreen control": "Display the fullscreen control",
121
120
  "Display the locate control": "Display the locate control",
@@ -498,5 +497,12 @@
498
497
  "Found {count} rows. Are you sure you want to delete all?": "Found {count} rows. Are you sure you want to delete all?",
499
498
  "Expression is empty": "Expression is empty",
500
499
  "OK": "OK",
501
- "Cancel": "Cancel"
500
+ "Cancel": "Cancel",
501
+ "Attach map to a team": "Attach map to a team",
502
+ "Display the polygon inverted": "Display the polygon inverted",
503
+ "Proportional circles": "Proportional circles",
504
+ "Property name to compute circles": "Property name to compute circles",
505
+ "Min circle radius": "Min circle radius",
506
+ "Max circle radius": "Max circle radius",
507
+ "Display the open browser control": "Display the open browser control"
502
508
  }
@@ -115,7 +115,6 @@ const locale = {
115
115
  "display name": "display name",
116
116
  "Display on load": "Display on load",
117
117
  "Display the control to open OpenStreetMap editor": "Display the control to open OpenStreetMap editor",
118
- "Display the data layers control": "Display the data layers control",
119
118
  "Display the embed control": "Display the embed control",
120
119
  "Display the fullscreen control": "Display the fullscreen control",
121
120
  "Display the locate control": "Display the locate control",
@@ -498,7 +497,14 @@ const locale = {
498
497
  "Found {count} rows. Are you sure you want to delete all?": "Found {count} rows. Are you sure you want to delete all?",
499
498
  "Expression is empty": "Expression is empty",
500
499
  "OK": "OK",
501
- "Cancel": "Cancel"
500
+ "Cancel": "Cancel",
501
+ "Attach map to a team": "Attach map to a team",
502
+ "Display the polygon inverted": "Display the polygon inverted",
503
+ "Proportional circles": "Proportional circles",
504
+ "Property name to compute circles": "Property name to compute circles",
505
+ "Min circle radius": "Min circle radius",
506
+ "Max circle radius": "Max circle radius",
507
+ "Display the open browser control": "Display the open browser control"
502
508
  }
503
509
  L.registerLocale("ast", locale)
504
510
  L.setLocale("ast")