umap-project 2.2.1__py3-none-any.whl → 2.3.0__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 (144) hide show
  1. umap/__init__.py +1 -1
  2. umap/static/umap/base.css +83 -44
  3. umap/static/umap/css/icon.css +6 -0
  4. umap/static/umap/css/panel.css +9 -4
  5. umap/static/umap/img/16.svg +2 -2
  6. umap/static/umap/img/source/16.svg +3 -3
  7. umap/static/umap/js/modules/browser.js +63 -22
  8. umap/static/umap/js/modules/facets.js +14 -39
  9. umap/static/umap/js/modules/orderable.js +1 -1
  10. umap/static/umap/js/modules/schema.js +4 -4
  11. umap/static/umap/js/modules/urls.js +1 -1
  12. umap/static/umap/js/modules/utils.js +9 -1
  13. umap/static/umap/js/umap.controls.js +15 -11
  14. umap/static/umap/js/umap.core.js +17 -15
  15. umap/static/umap/js/umap.features.js +8 -2
  16. umap/static/umap/js/umap.forms.js +92 -33
  17. umap/static/umap/js/umap.js +19 -24
  18. umap/static/umap/js/umap.layer.js +3 -6
  19. umap/static/umap/locale/am_ET.js +11 -12
  20. umap/static/umap/locale/am_ET.json +11 -12
  21. umap/static/umap/locale/ar.js +11 -12
  22. umap/static/umap/locale/ar.json +11 -12
  23. umap/static/umap/locale/ast.js +11 -12
  24. umap/static/umap/locale/ast.json +11 -12
  25. umap/static/umap/locale/bg.js +11 -12
  26. umap/static/umap/locale/bg.json +11 -12
  27. umap/static/umap/locale/br.js +11 -12
  28. umap/static/umap/locale/br.json +11 -12
  29. umap/static/umap/locale/ca.js +11 -12
  30. umap/static/umap/locale/ca.json +11 -12
  31. umap/static/umap/locale/cs_CZ.js +11 -12
  32. umap/static/umap/locale/cs_CZ.json +11 -12
  33. umap/static/umap/locale/da.js +11 -12
  34. umap/static/umap/locale/da.json +11 -12
  35. umap/static/umap/locale/de.js +11 -12
  36. umap/static/umap/locale/de.json +11 -12
  37. umap/static/umap/locale/el.js +11 -12
  38. umap/static/umap/locale/el.json +11 -12
  39. umap/static/umap/locale/en.js +11 -12
  40. umap/static/umap/locale/en.json +11 -12
  41. umap/static/umap/locale/en_US.json +11 -12
  42. umap/static/umap/locale/es.js +11 -12
  43. umap/static/umap/locale/es.json +11 -12
  44. umap/static/umap/locale/et.js +11 -12
  45. umap/static/umap/locale/et.json +11 -12
  46. umap/static/umap/locale/eu.js +27 -16
  47. umap/static/umap/locale/eu.json +27 -16
  48. umap/static/umap/locale/fa_IR.js +11 -12
  49. umap/static/umap/locale/fa_IR.json +11 -12
  50. umap/static/umap/locale/fi.js +11 -12
  51. umap/static/umap/locale/fi.json +11 -12
  52. umap/static/umap/locale/fr.js +11 -12
  53. umap/static/umap/locale/fr.json +11 -12
  54. umap/static/umap/locale/gl.js +11 -12
  55. umap/static/umap/locale/gl.json +11 -12
  56. umap/static/umap/locale/he.js +11 -12
  57. umap/static/umap/locale/he.json +11 -12
  58. umap/static/umap/locale/hr.js +11 -12
  59. umap/static/umap/locale/hr.json +11 -12
  60. umap/static/umap/locale/hu.js +29 -30
  61. umap/static/umap/locale/hu.json +29 -30
  62. umap/static/umap/locale/id.js +11 -12
  63. umap/static/umap/locale/id.json +11 -12
  64. umap/static/umap/locale/is.js +11 -12
  65. umap/static/umap/locale/is.json +11 -12
  66. umap/static/umap/locale/it.js +11 -12
  67. umap/static/umap/locale/it.json +11 -12
  68. umap/static/umap/locale/ja.js +11 -12
  69. umap/static/umap/locale/ja.json +11 -12
  70. umap/static/umap/locale/ko.js +11 -12
  71. umap/static/umap/locale/ko.json +11 -12
  72. umap/static/umap/locale/lt.js +11 -12
  73. umap/static/umap/locale/lt.json +11 -12
  74. umap/static/umap/locale/ms.js +20 -21
  75. umap/static/umap/locale/ms.json +20 -21
  76. umap/static/umap/locale/nl.js +11 -12
  77. umap/static/umap/locale/nl.json +11 -12
  78. umap/static/umap/locale/no.js +11 -12
  79. umap/static/umap/locale/no.json +11 -12
  80. umap/static/umap/locale/pl.js +11 -12
  81. umap/static/umap/locale/pl.json +11 -12
  82. umap/static/umap/locale/pl_PL.json +11 -12
  83. umap/static/umap/locale/pt.js +11 -12
  84. umap/static/umap/locale/pt.json +11 -12
  85. umap/static/umap/locale/pt_BR.js +11 -12
  86. umap/static/umap/locale/pt_BR.json +11 -12
  87. umap/static/umap/locale/pt_PT.js +11 -12
  88. umap/static/umap/locale/pt_PT.json +11 -12
  89. umap/static/umap/locale/ro.js +11 -12
  90. umap/static/umap/locale/ro.json +11 -12
  91. umap/static/umap/locale/ru.js +11 -12
  92. umap/static/umap/locale/ru.json +11 -12
  93. umap/static/umap/locale/si.js +240 -227
  94. umap/static/umap/locale/si.json +240 -227
  95. umap/static/umap/locale/sk_SK.js +11 -12
  96. umap/static/umap/locale/sk_SK.json +11 -12
  97. umap/static/umap/locale/sl.js +11 -12
  98. umap/static/umap/locale/sl.json +11 -12
  99. umap/static/umap/locale/sr.js +11 -12
  100. umap/static/umap/locale/sr.json +11 -12
  101. umap/static/umap/locale/sv.js +11 -12
  102. umap/static/umap/locale/sv.json +11 -12
  103. umap/static/umap/locale/th_TH.js +11 -12
  104. umap/static/umap/locale/th_TH.json +11 -12
  105. umap/static/umap/locale/tr.js +11 -12
  106. umap/static/umap/locale/tr.json +11 -12
  107. umap/static/umap/locale/uk_UA.js +11 -12
  108. umap/static/umap/locale/uk_UA.json +11 -12
  109. umap/static/umap/locale/vi.js +11 -12
  110. umap/static/umap/locale/vi.json +11 -12
  111. umap/static/umap/locale/vi_VN.json +11 -12
  112. umap/static/umap/locale/zh.js +11 -12
  113. umap/static/umap/locale/zh.json +11 -12
  114. umap/static/umap/locale/zh_CN.json +11 -12
  115. umap/static/umap/locale/zh_TW.Big5.json +11 -12
  116. umap/static/umap/locale/zh_TW.js +11 -12
  117. umap/static/umap/locale/zh_TW.json +11 -12
  118. umap/static/umap/map.css +17 -2
  119. umap/static/umap/unittests/utils.js +7 -0
  120. umap/static/umap/vars.css +10 -0
  121. umap/static/umap/vendors/dompurify/purify.es.js +54 -5
  122. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -0
  123. umap/tests/integration/conftest.py +5 -4
  124. umap/tests/integration/test_browser.py +7 -0
  125. umap/tests/integration/test_choropleth.py +1 -1
  126. umap/tests/integration/test_draw_polygon.py +6 -0
  127. umap/tests/integration/test_draw_polyline.py +6 -0
  128. umap/tests/integration/test_edit_datalayer.py +5 -5
  129. umap/tests/integration/test_edit_map.py +4 -4
  130. umap/tests/integration/test_edit_marker.py +6 -6
  131. umap/tests/integration/test_edit_polygon.py +6 -6
  132. umap/tests/integration/test_facets_browser.py +82 -13
  133. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/METADATA +8 -7
  134. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/RECORD +137 -143
  135. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/WHEEL +1 -1
  136. umap/.DS_Store +0 -0
  137. umap/static/.DS_Store +0 -0
  138. umap/static/umap/.DS_Store +0 -0
  139. umap/static/umap/favicons/.DS_Store +0 -0
  140. umap/static/umap/fonts/.DS_Store +0 -0
  141. umap/tests/.DS_Store +0 -0
  142. umap/tests/integration/.DS_Store +0 -0
  143. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/entry_points.txt +0 -0
  144. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -196,8 +196,11 @@ U.ToggleEditAction = U.BaseFeatureAction.extend({
196
196
  },
197
197
 
198
198
  onClick: function (e) {
199
- if (this.feature._toggleEditing) this.feature._toggleEditing(e) // Path
200
- else this.feature.edit(e) // Marker
199
+ if (this.feature._toggleEditing) {
200
+ this.feature._toggleEditing(e) // Path
201
+ } else {
202
+ this.feature.edit(e) // Marker
203
+ }
201
204
  },
202
205
  })
203
206
 
@@ -496,8 +499,11 @@ L.Control.Button = L.Control.extend({
496
499
  this
497
500
  )
498
501
  L.DomEvent.on(button, 'dblclick', L.DomEvent.stopPropagation)
502
+ this.afterAdd(container)
499
503
  return container
500
504
  },
505
+
506
+ afterAdd: function (container) {},
501
507
  })
502
508
 
503
509
  U.DataLayersControl = L.Control.Button.extend({
@@ -507,6 +513,10 @@ U.DataLayersControl = L.Control.Button.extend({
507
513
  title: L._('See layers'),
508
514
  },
509
515
 
516
+ afterAdd: function (container) {
517
+ U.Utils.toggleBadge(container, this.map.browser.hasFilters())
518
+ },
519
+
510
520
  onClick: function () {
511
521
  this.map.openBrowser()
512
522
  },
@@ -660,15 +670,11 @@ const ControlsMixin = {
660
670
  'star',
661
671
  'tilelayers',
662
672
  ],
663
- _openFacet: function () {
664
- this.facets.open()
665
- },
666
673
 
667
674
  displayCaption: function () {
668
675
  const container = L.DomUtil.create('div', 'umap-caption')
669
676
  L.DomUtil.createTitle(container, this.options.name, 'icon-caption')
670
677
  this.permissions.addOwnerLink('h5', container)
671
- this.browser.tabsMenu(container, 'info')
672
678
  if (this.options.description) {
673
679
  const description = L.DomUtil.element({
674
680
  tagName: 'div',
@@ -1255,7 +1261,7 @@ U.SearchControl = L.Control.extend({
1255
1261
  this.map.fire('dataload', { id: id })
1256
1262
  })
1257
1263
  this.search.resultsContainer = resultsContainer
1258
- this.map.panel.open({ content: container }).then(input.focus)
1264
+ this.map.panel.open({ content: container }).then(input.focus())
1259
1265
  },
1260
1266
  })
1261
1267
 
@@ -1316,16 +1322,14 @@ U.ContextMenu = L.Map.ContextMenu.extend({
1316
1322
  U.Editable = L.Editable.extend({
1317
1323
  initialize: function (map, options) {
1318
1324
  L.Editable.prototype.initialize.call(this, map, options)
1319
- this.on(
1320
- 'editable:drawing:start editable:drawing:click editable:drawing:move',
1321
- this.drawingTooltip
1322
- )
1325
+ this.on('editable:drawing:click editable:drawing:move', this.drawingTooltip)
1323
1326
  this.on('editable:drawing:end', (e) => {
1324
1327
  this.closeTooltip()
1325
1328
  // Leaflet.Editable will delete the drawn shape if invalid
1326
1329
  // (eg. line has only one drawn point)
1327
1330
  // So let's check if the layer has no more shape
1328
1331
  if (!e.layer.hasGeom()) e.layer.del()
1332
+ else e.layer.edit()
1329
1333
  })
1330
1334
  // Layer for items added by users
1331
1335
  this.on('editable:drawing:cancel', (e) => {
@@ -81,24 +81,26 @@ L.DomUtil.add = (tagName, className, container, content) => {
81
81
 
82
82
  L.DomUtil.createFieldset = (container, legend, options) => {
83
83
  options = options || {}
84
- const fieldset = L.DomUtil.create('div', 'fieldset toggle', container)
85
- const legendEl = L.DomUtil.add('h5', 'legend style_options_toggle', fieldset, legend)
86
- const fieldsEl = L.DomUtil.add('div', 'fields with-transition', fieldset)
87
- L.DomEvent.on(legendEl, 'click', function () {
88
- if (L.DomUtil.hasClass(fieldset, 'on')) {
89
- L.DomUtil.removeClass(fieldset, 'on')
90
- } else {
91
- L.DomUtil.addClass(fieldset, 'on')
92
- if (options.callback) options.callback.call(options.context || this)
93
- }
94
- })
95
- return fieldsEl
84
+ const details = L.DomUtil.create('details', options.className || '', container)
85
+ const summary = L.DomUtil.add('summary', '', details)
86
+ if (options.icon) L.DomUtil.createIcon(summary, options.icon)
87
+ L.DomUtil.add('span', '', summary, legend)
88
+ const fieldset = L.DomUtil.add('fieldset', '', details)
89
+ details.open = options.on === true
90
+ if (options.callback) {
91
+ L.DomEvent.on(details, 'toggle', () => {
92
+ if (details.open) options.callback.call(options.context || this)
93
+ })
94
+ }
95
+ return fieldset
96
96
  }
97
97
 
98
98
  L.DomUtil.createButton = (className, container, content, callback, context) => {
99
99
  const el = L.DomUtil.add('button', className, container, content)
100
100
  el.type = 'button'
101
- el.title = content
101
+ if (!content.nodeType) {
102
+ el.title = content
103
+ }
102
104
  if (callback) {
103
105
  L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback, context)
104
106
  }
@@ -554,9 +556,9 @@ U.Help = L.Class.extend({
554
556
  'Comma separated list of properties to use for sorting features. To reverse the sort, put a minus sign (-) before. Eg. mykey,-otherkey.'
555
557
  ),
556
558
  slugKey: L._('The name of the property to use as feature unique identifier.'),
557
- filterKey: L._('Comma separated list of properties to use when filtering features'),
559
+ filterKey: L._('Comma separated list of properties to use when filtering features by text input'),
558
560
  facetKey: L._(
559
- 'Comma separated list of properties to use for facet search (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.'
561
+ 'Comma separated list of properties to use for filters (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.'
560
562
  ),
561
563
  interactive: L._(
562
564
  'If false, the polygon or line will act as a part of the underlying map.'
@@ -494,6 +494,14 @@ U.FeatureMixin = {
494
494
  this.bindTooltip(U.Utils.escapeHTML(displayName), options)
495
495
  },
496
496
 
497
+ isFiltered: function () {
498
+ const filterKeys = this.map.getFilterKeys()
499
+ const filter = this.map.browser.options.filter
500
+ if (filter && !this.matchFilter(filter, filterKeys)) return true
501
+ if (!this.matchFacets()) return true
502
+ return false
503
+ },
504
+
497
505
  matchFilter: function (filter, keys) {
498
506
  filter = filter.toLowerCase()
499
507
  for (let i = 0, value; i < keys.length; i++) {
@@ -513,8 +521,6 @@ U.FeatureMixin = {
513
521
  case 'date':
514
522
  case 'datetime':
515
523
  case 'number':
516
- min = parser(min)
517
- max = parser(max)
518
524
  if (!isNaN(min) && !isNaN(value) && min > value) return false
519
525
  if (!isNaN(max) && !isNaN(value) && max < value) return false
520
526
  break
@@ -744,7 +744,17 @@ L.FormBuilder.Switch = L.FormBuilder.CheckBox.extend({
744
744
  },
745
745
  })
746
746
 
747
- L.FormBuilder.FacetSearchChoices = L.FormBuilder.Element.extend({
747
+ L.FormBuilder.FacetSearchBase = L.FormBuilder.Element.extend({
748
+
749
+ buildLabel: function () {
750
+ this.label = L.DomUtil.element({
751
+ tagName: 'legend',
752
+ textContent: this.options.label,
753
+ })
754
+ }
755
+
756
+ })
757
+ L.FormBuilder.FacetSearchChoices = L.FormBuilder.FacetSearchBase.extend({
748
758
  build: function () {
749
759
  this.container = L.DomUtil.create('fieldset', 'umap-facet', this.parentNode)
750
760
  this.container.appendChild(this.label)
@@ -756,13 +766,6 @@ L.FormBuilder.FacetSearchChoices = L.FormBuilder.Element.extend({
756
766
  choices.forEach((value) => this.buildLi(value))
757
767
  },
758
768
 
759
- buildLabel: function () {
760
- this.label = L.DomUtil.element({
761
- tagName: 'legend',
762
- textContent: this.options.label,
763
- })
764
- },
765
-
766
769
  buildLi: function (value) {
767
770
  const property_li = L.DomUtil.create('li', '', this.ul)
768
771
  const label = L.DomUtil.create('label', '', property_li)
@@ -787,7 +790,7 @@ L.FormBuilder.FacetSearchChoices = L.FormBuilder.Element.extend({
787
790
  },
788
791
  })
789
792
 
790
- L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
793
+ L.FormBuilder.MinMaxBase = L.FormBuilder.FacetSearchBase.extend({
791
794
  getInputType: function (type) {
792
795
  return type
793
796
  },
@@ -796,7 +799,7 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
796
799
  return [L._('Min'), L._('Max')]
797
800
  },
798
801
 
799
- castValue: function (value) {
802
+ prepareForHTML: function (value) {
800
803
  return value.valueOf()
801
804
  },
802
805
 
@@ -804,6 +807,10 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
804
807
  this.container = L.DomUtil.create('fieldset', 'umap-facet', this.parentNode)
805
808
  this.container.appendChild(this.label)
806
809
  const { min, max, type } = this.options.criteria
810
+ const { min: modifiedMin, max: modifiedMax } = this.get()
811
+
812
+ const currentMin = modifiedMin !== undefined ? modifiedMin : min
813
+ const currentMax = modifiedMax !== undefined ? modifiedMax : max
807
814
  this.type = type
808
815
  this.inputType = this.getInputType(this.type)
809
816
 
@@ -815,9 +822,17 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
815
822
  this.minInput = L.DomUtil.create('input', '', this.minLabel)
816
823
  this.minInput.type = this.inputType
817
824
  this.minInput.step = 'any'
825
+ this.minInput.min = this.prepareForHTML(min)
826
+ this.minInput.max = this.prepareForHTML(max)
818
827
  if (min != null) {
819
- this.minInput.valueAsNumber = this.castValue(min)
820
- this.minInput.dataset.value = min
828
+ // The value stored using setAttribute is not modified by
829
+ // user input, and will be used as initial value when calling
830
+ // form.reset(), and can also be retrieve later on by using
831
+ // getAttributing, to compare with current value and know
832
+ // if this value has been modified by the user
833
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset
834
+ this.minInput.setAttribute('value', this.prepareForHTML(min))
835
+ this.minInput.value = this.prepareForHTML(currentMin)
821
836
  }
822
837
 
823
838
  this.maxLabel = L.DomUtil.create('label', '', this.container)
@@ -826,37 +841,76 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
826
841
  this.maxInput = L.DomUtil.create('input', '', this.maxLabel)
827
842
  this.maxInput.type = this.inputType
828
843
  this.maxInput.step = 'any'
844
+ this.maxInput.min = this.prepareForHTML(min)
845
+ this.maxInput.max = this.prepareForHTML(max)
829
846
  if (max != null) {
830
- this.maxInput.valueAsNumber = this.castValue(max)
831
- this.maxInput.dataset.value = max
847
+ // Cf comment above about setAttribute vs value
848
+ this.maxInput.setAttribute('value', this.prepareForHTML(max))
849
+ this.maxInput.value = this.prepareForHTML(currentMax)
832
850
  }
851
+ this.toggleStatus()
833
852
 
834
- L.DomEvent.on(this.minInput, 'change', (e) => this.sync())
835
- L.DomEvent.on(this.maxInput, 'change', (e) => this.sync())
853
+ L.DomEvent.on(this.minInput, 'change', () => this.sync())
854
+ L.DomEvent.on(this.maxInput, 'change', () => this.sync())
836
855
  },
837
856
 
838
- buildLabel: function () {
839
- this.label = L.DomUtil.element({
840
- tagName: 'legend',
841
- textContent: this.options.label,
842
- })
857
+ toggleStatus: function () {
858
+ this.minInput.dataset.modified = this.isMinModified()
859
+ this.maxInput.dataset.modified = this.isMaxModified()
860
+ },
861
+
862
+ sync: function () {
863
+ L.FormBuilder.Element.prototype.sync.call(this)
864
+ this.toggleStatus()
865
+ },
866
+
867
+ isMinModified: function () {
868
+ const default_ = this.minInput.getAttribute("value")
869
+ const current = this.minInput.value
870
+ return current != default_
871
+ },
872
+
873
+ isMaxModified: function () {
874
+ const default_ = this.maxInput.getAttribute("value")
875
+ const current = this.maxInput.value
876
+ return current != default_
843
877
  },
844
878
 
845
879
  toJS: function () {
846
- return {
880
+ const opts = {
847
881
  type: this.type,
848
- min: this.minInput.value,
849
- max: this.maxInput.value,
850
882
  }
883
+ if (this.minInput.value !== '' && this.isMinModified()) {
884
+ opts.min = this.prepareForJS(this.minInput.value)
885
+ }
886
+ if (this.maxInput.value !== '' && this.isMaxModified()) {
887
+ opts.max = this.prepareForJS(this.maxInput.value)
888
+ }
889
+ return opts
851
890
  },
852
891
  })
853
892
 
854
- L.FormBuilder.FacetSearchNumber = L.FormBuilder.MinMaxBase.extend({})
893
+ L.FormBuilder.FacetSearchNumber = L.FormBuilder.MinMaxBase.extend({
894
+ prepareForJS: function (value) {
895
+ return new Number(value)
896
+ },
897
+ })
855
898
 
856
899
  L.FormBuilder.FacetSearchDate = L.FormBuilder.MinMaxBase.extend({
857
- castValue: function (value) {
858
- return value.valueOf() - value.getTimezoneOffset() * 60000
900
+ prepareForJS: function (value) {
901
+ return new Date(value)
902
+ },
903
+
904
+ toLocaleDateTime: function (dt) {
905
+ return new Date(dt.valueOf() - dt.getTimezoneOffset() * 60000)
906
+ },
907
+
908
+ prepareForHTML: function (value) {
909
+ // Value must be in local time
910
+ if (isNaN(value)) return
911
+ return this.toLocaleDateTime(value).toISOString().substr(0, 10)
859
912
  },
913
+
860
914
  getLabels: function () {
861
915
  return [L._('From'), L._('Until')]
862
916
  },
@@ -866,6 +920,12 @@ L.FormBuilder.FacetSearchDateTime = L.FormBuilder.FacetSearchDate.extend({
866
920
  getInputType: function (type) {
867
921
  return 'datetime-local'
868
922
  },
923
+
924
+ prepareForHTML: function (value) {
925
+ // Value must be in local time
926
+ if (isNaN(value)) return
927
+ return this.toLocaleDateTime(value).toISOString().slice(0, -1)
928
+ },
869
929
  })
870
930
 
871
931
  L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
@@ -878,12 +938,11 @@ L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
878
938
  },
879
939
 
880
940
  fetch: function () {
881
- let value = (this.backup = this.toHTML())
882
- if (!this.container.querySelector(`input[type="radio"][value="${value}"]`))
883
- value =
884
- typeof this.options.default !== 'undefined'
885
- ? this.options.default
886
- : this.default
941
+ this.backup = this.toHTML()
942
+ let value = this.backup
943
+ if (!this.container.querySelector(`input[type="radio"][value="${value}"]`)) {
944
+ value = this.options.default !== undefined ? this.options.default : this.default
945
+ }
887
946
  this.container.querySelector(`input[type="radio"][value="${value}"]`).checked = true
888
947
  },
889
948
 
@@ -149,6 +149,9 @@ U.Map = L.Map.extend({
149
149
  if (this.options.datalayersControl === 'expanded') {
150
150
  this.options.onLoadPanel = 'datalayers'
151
151
  }
152
+ if (this.options.onLoadPanel === 'facet') {
153
+ this.options.onLoadPanel = 'datafilters'
154
+ }
152
155
 
153
156
  let isDirty = false // self status
154
157
  try {
@@ -211,15 +214,15 @@ U.Map = L.Map.extend({
211
214
  if (L.Util.queryString('share')) {
212
215
  this.share.open()
213
216
  } else if (this.options.onLoadPanel === 'databrowser') {
214
- this.openBrowser('expanded')
217
+ this.openBrowser('data')
215
218
  } else if (this.options.onLoadPanel === 'datalayers') {
216
- this.openBrowser('condensed')
219
+ this.openBrowser('layers')
220
+ } else if (this.options.onLoadPanel === 'datafilters') {
221
+ this.panel.mode = 'expanded'
222
+ this.openBrowser('filters')
217
223
  } else if (this.options.onLoadPanel === 'caption') {
218
224
  this.panel.mode = 'condensed'
219
225
  this.displayCaption()
220
- } else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) {
221
- this.panel.mode = 'expanded'
222
- this.openFacet()
223
226
  }
224
227
  if (L.Util.queryString('edit')) {
225
228
  if (this.hasEditMode()) this.enableEdit()
@@ -252,7 +255,7 @@ U.Map = L.Map.extend({
252
255
  this.initCaptionBar()
253
256
  this.renderEditToolbar()
254
257
  this.renderControls()
255
- this.facets.redraw()
258
+ this.browser.redraw()
256
259
  break
257
260
  case 'data':
258
261
  this.redrawVisibleDataLayers()
@@ -908,15 +911,8 @@ U.Map = L.Map.extend({
908
911
  },
909
912
 
910
913
  openBrowser: function (mode) {
911
- if (mode) this.panel.mode = mode
912
914
  this.onceDatalayersLoaded(function () {
913
- this.browser.open()
914
- })
915
- },
916
-
917
- openFacet: function () {
918
- this.onceDataLoaded(function () {
919
- this._openFacet()
915
+ this.browser.open(mode)
920
916
  })
921
917
  },
922
918
 
@@ -1229,7 +1225,7 @@ U.Map = L.Map.extend({
1229
1225
  handler: 'Input',
1230
1226
  helpEntries: 'filterKey',
1231
1227
  placeholder: L._('Default: name'),
1232
- label: L._('Filter keys'),
1228
+ label: L._('Search keys'),
1233
1229
  inheritable: true,
1234
1230
  },
1235
1231
  ],
@@ -1239,7 +1235,7 @@ U.Map = L.Map.extend({
1239
1235
  handler: 'BlurInput',
1240
1236
  helpEntries: 'facetKey',
1241
1237
  placeholder: L._('Example: key1,key2|Label 2,key3|Label 3|checkbox'),
1242
- label: L._('Facet keys'),
1238
+ label: L._('Filters keys'),
1243
1239
  },
1244
1240
  ],
1245
1241
  [
@@ -1602,15 +1598,14 @@ U.Map = L.Map.extend({
1602
1598
  'umap-open-browser-link flat',
1603
1599
  container,
1604
1600
  L._('Browse data'),
1605
- () => this.openBrowser('expanded')
1601
+ () => this.openBrowser('data')
1606
1602
  )
1607
1603
  if (this.options.facetKey) {
1608
1604
  L.DomUtil.createButton(
1609
1605
  'umap-open-filter-link flat',
1610
1606
  container,
1611
- L._('Select data'),
1612
- this.openFacet,
1613
- this
1607
+ L._('Filter data'),
1608
+ () => this.openBrowser('filters')
1614
1609
  )
1615
1610
  }
1616
1611
  }
@@ -1747,17 +1742,17 @@ U.Map = L.Map.extend({
1747
1742
  '-',
1748
1743
  {
1749
1744
  text: L._('See layers'),
1750
- callback: () => this.openBrowser('condensed'),
1745
+ callback: () => this.openBrowser('layers'),
1751
1746
  },
1752
1747
  {
1753
1748
  text: L._('Browse data'),
1754
- callback: () => this.openBrowser('expanded'),
1749
+ callback: () => this.openBrowser('data'),
1755
1750
  }
1756
1751
  )
1757
1752
  if (this.options.facetKey) {
1758
1753
  items.push({
1759
- text: L._('Facet search'),
1760
- callback: this.openFacet,
1754
+ text: L._('Filter data'),
1755
+ callback: () => this.openBrowser('filters'),
1761
1756
  })
1762
1757
  }
1763
1758
  items.push(
@@ -463,8 +463,8 @@ U.Layer.Heat = L.HeatLayer.extend({
463
463
  this._latlngs[i].alt !== undefined
464
464
  ? this._latlngs[i].alt
465
465
  : this._latlngs[i][2] !== undefined
466
- ? +this._latlngs[i][2]
467
- : 1
466
+ ? +this._latlngs[i][2]
467
+ : 1
468
468
 
469
469
  grid[y] = grid[y] || []
470
470
  cell = grid[y][x]
@@ -875,10 +875,7 @@ U.DataLayer = L.Evented.extend({
875
875
  },
876
876
 
877
877
  showFeature: function (feature) {
878
- const filterKeys = this.map.getFilterKeys(),
879
- filter = this.map.browser.options.filter
880
- if (filter && !feature.matchFilter(filter, filterKeys)) return
881
- if (!feature.matchFacets()) return
878
+ if (feature.isFiltered()) return
882
879
  this.layer.addLayer(feature)
883
880
  },
884
881
 
@@ -83,7 +83,6 @@ const locale = {
83
83
  "color": "ከለር",
84
84
  "Comma separated list of numbers, including min and max values.": "Comma separated list of numbers, including min and max values.",
85
85
  "Comma separated list of properties to use for sorting features. To reverse the sort, put a minus sign (-) before. Eg. mykey,-otherkey.": "Comma separated list of properties to use for sorting features. To reverse the sort, put a minus sign (-) before. Eg. mykey,-otherkey.",
86
- "Comma separated list of properties to use when filtering features": "ፊቸሮችን በሚያጣሩበት ጊዜ ሊጠቀሙ የሚችሏቸው በኮማ የተከፋፈሉ የባህርያት ዝርዝር",
87
86
  "Comma, tab or semi-colon separated values. SRS WGS84 is implied. Only Point geometries are imported. The import will look at the column headers for any mention of «lat» and «lon» at the begining of the header, case insensitive. All other column are imported as properties.": "በኮማ፣ታብ፣ግማሽኮለን የተከፋፈሉ ውጤቶች። SRSWG84 ተመላክቷል። የነጥብ ጂኦሜትሪዎች ብቻ መጥተዋል። የማምጣት ሂደቱ የኮለምን ሄደሮችን በማሰስ «ላቲትዩድ» እና «ሎንጊትዩድ» የሚሉትን ቃላት መኖር ከመጀመሪያው በመነሳት ያጣራል። ሁሉም ኮለምኖች እንደባህርይ መጥተዋል።",
88
87
  "Congratulations, your map has been created!": "Congratulations, your map has been created!",
89
88
  "Continue line": "መስመሩን ቀጥል",
@@ -96,7 +95,6 @@ const locale = {
96
95
  "Custom background": "የተስተካከለ ጀርባ",
97
96
  "Custom overlay": "Custom overlay",
98
97
  "dash array": "ዳሽ አሬይ",
99
- "Data browser": "የመረጃ ማሰሻ",
100
98
  "Data is browsable": "Data is browsable",
101
99
  "Datalayers": "Datalayers",
102
100
  "Default interaction options": "Default interaction options",
@@ -165,16 +163,12 @@ const locale = {
165
163
  "Exit Fullscreen": "Exit Fullscreen",
166
164
  "expanded": "expanded",
167
165
  "Extract shape to separate feature": "ፊቸሩን ለመለየት ቅርፁን ነጥለህ አውጣ",
168
- "Facet keys": "Facet keys",
169
- "Facet search": "Facet search",
170
166
  "Feature identifier key": "Feature identifier key",
171
167
  "Feature properties": "Feature properties",
172
168
  "Fetch data each time map view changes.": "Fetch data each time map view changes.",
173
169
  "fill color": "ከለር ሙላ",
174
170
  "fill opacity": "ኦፓሲቲውን ሙላ",
175
171
  "fill": "ሙላ",
176
- "Filter keys": "Filter keys",
177
- "Filter": "Filter",
178
172
  "Fit all data": "Fit all data",
179
173
  "Format": "ፎርማት",
180
174
  "From zoom": "ከዙም",
@@ -267,7 +261,6 @@ const locale = {
267
261
  "NM": "NM",
268
262
  "No cache": "No cache",
269
263
  "No licence has been set": "ምንም ፈቃድ አልተሰጠም",
270
- "No results for these facets": "No results for these facets",
271
264
  "No results": "No results",
272
265
  "no": "አይደለም",
273
266
  "No.": "No.",
@@ -332,7 +325,6 @@ const locale = {
332
325
  "See layers": "See layers",
333
326
  "See full screen": "ሙሉውን ስክሪን ተመልከት",
334
327
  "See on OpenStreetMap": "See on OpenStreetMap",
335
- "Select data": "Select data",
336
328
  "Send me the link": "Send me the link",
337
329
  "Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…": "Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…",
338
330
  "settings": "settings",
@@ -434,9 +426,7 @@ const locale = {
434
426
  "Edit map details": "Edit map details",
435
427
  "Back to browser": "Back to browser",
436
428
  "Toggle size": "Toggle size",
437
- "Layers": "Layers",
438
429
  "Display the caption control": "Display the caption control",
439
- "Comma separated list of properties to use for facet search (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.": "Comma separated list of properties to use for facet search (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.",
440
430
  "<empty value>": "<empty value>",
441
431
  "Min": "Min",
442
432
  "Max": "Max",
@@ -446,8 +436,17 @@ const locale = {
446
436
  "Edit in OpenStreetMap": "Edit in OpenStreetMap",
447
437
  "Cannot determine latitude and longitude columns.": "Cannot determine latitude and longitude columns.",
448
438
  "Back to layers": "Back to layers",
449
- "Data": "Data",
450
- "Filters": "Filters"
439
+ "Filters": "Filters",
440
+ "Comma separated list of properties to use when filtering features by text input": "Comma separated list of properties to use when filtering features by text input",
441
+ "Comma separated list of properties to use for filters (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.": "Comma separated list of properties to use for filters (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.",
442
+ "Search keys": "Search keys",
443
+ "Filters keys": "Filters keys",
444
+ "Filter data": "Filter data",
445
+ "Search map features…": "Search map features…",
446
+ "Reset all": "Reset all",
447
+ "Browser in data mode": "Browser in data mode",
448
+ "Browser in layers mode": "Browser in layers mode",
449
+ "Browser in filters mode": "Browser in filters mode"
451
450
  }
452
451
  L.registerLocale("am_ET", locale)
453
452
  L.setLocale("am_ET")
@@ -83,7 +83,6 @@
83
83
  "color": "ከለር",
84
84
  "Comma separated list of numbers, including min and max values.": "Comma separated list of numbers, including min and max values.",
85
85
  "Comma separated list of properties to use for sorting features. To reverse the sort, put a minus sign (-) before. Eg. mykey,-otherkey.": "Comma separated list of properties to use for sorting features. To reverse the sort, put a minus sign (-) before. Eg. mykey,-otherkey.",
86
- "Comma separated list of properties to use when filtering features": "ፊቸሮችን በሚያጣሩበት ጊዜ ሊጠቀሙ የሚችሏቸው በኮማ የተከፋፈሉ የባህርያት ዝርዝር",
87
86
  "Comma, tab or semi-colon separated values. SRS WGS84 is implied. Only Point geometries are imported. The import will look at the column headers for any mention of «lat» and «lon» at the begining of the header, case insensitive. All other column are imported as properties.": "በኮማ፣ታብ፣ግማሽኮለን የተከፋፈሉ ውጤቶች። SRSWG84 ተመላክቷል። የነጥብ ጂኦሜትሪዎች ብቻ መጥተዋል። የማምጣት ሂደቱ የኮለምን ሄደሮችን በማሰስ «ላቲትዩድ» እና «ሎንጊትዩድ» የሚሉትን ቃላት መኖር ከመጀመሪያው በመነሳት ያጣራል። ሁሉም ኮለምኖች እንደባህርይ መጥተዋል።",
88
87
  "Congratulations, your map has been created!": "Congratulations, your map has been created!",
89
88
  "Continue line": "መስመሩን ቀጥል",
@@ -96,7 +95,6 @@
96
95
  "Custom background": "የተስተካከለ ጀርባ",
97
96
  "Custom overlay": "Custom overlay",
98
97
  "dash array": "ዳሽ አሬይ",
99
- "Data browser": "የመረጃ ማሰሻ",
100
98
  "Data is browsable": "Data is browsable",
101
99
  "Datalayers": "Datalayers",
102
100
  "Default interaction options": "Default interaction options",
@@ -165,16 +163,12 @@
165
163
  "Exit Fullscreen": "Exit Fullscreen",
166
164
  "expanded": "expanded",
167
165
  "Extract shape to separate feature": "ፊቸሩን ለመለየት ቅርፁን ነጥለህ አውጣ",
168
- "Facet keys": "Facet keys",
169
- "Facet search": "Facet search",
170
166
  "Feature identifier key": "Feature identifier key",
171
167
  "Feature properties": "Feature properties",
172
168
  "Fetch data each time map view changes.": "Fetch data each time map view changes.",
173
169
  "fill color": "ከለር ሙላ",
174
170
  "fill opacity": "ኦፓሲቲውን ሙላ",
175
171
  "fill": "ሙላ",
176
- "Filter keys": "Filter keys",
177
- "Filter": "Filter",
178
172
  "Fit all data": "Fit all data",
179
173
  "Format": "ፎርማት",
180
174
  "From zoom": "ከዙም",
@@ -267,7 +261,6 @@
267
261
  "NM": "NM",
268
262
  "No cache": "No cache",
269
263
  "No licence has been set": "ምንም ፈቃድ አልተሰጠም",
270
- "No results for these facets": "No results for these facets",
271
264
  "No results": "No results",
272
265
  "no": "አይደለም",
273
266
  "No.": "No.",
@@ -332,7 +325,6 @@
332
325
  "See layers": "See layers",
333
326
  "See full screen": "ሙሉውን ስክሪን ተመልከት",
334
327
  "See on OpenStreetMap": "See on OpenStreetMap",
335
- "Select data": "Select data",
336
328
  "Send me the link": "Send me the link",
337
329
  "Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…": "Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…",
338
330
  "settings": "settings",
@@ -434,9 +426,7 @@
434
426
  "Edit map details": "Edit map details",
435
427
  "Back to browser": "Back to browser",
436
428
  "Toggle size": "Toggle size",
437
- "Layers": "Layers",
438
429
  "Display the caption control": "Display the caption control",
439
- "Comma separated list of properties to use for facet search (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.": "Comma separated list of properties to use for facet search (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.",
440
430
  "<empty value>": "<empty value>",
441
431
  "Min": "Min",
442
432
  "Max": "Max",
@@ -446,6 +436,15 @@
446
436
  "Edit in OpenStreetMap": "Edit in OpenStreetMap",
447
437
  "Cannot determine latitude and longitude columns.": "Cannot determine latitude and longitude columns.",
448
438
  "Back to layers": "Back to layers",
449
- "Data": "Data",
450
- "Filters": "Filters"
439
+ "Filters": "Filters",
440
+ "Comma separated list of properties to use when filtering features by text input": "Comma separated list of properties to use when filtering features by text input",
441
+ "Comma separated list of properties to use for filters (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.": "Comma separated list of properties to use for filters (eg.: mykey,otherkey). To control label, add it after a | (eg.: mykey|My Key,otherkey|Other Key). To control input field type, add it after another | (eg.: mykey|My Key|checkbox,otherkey|Other Key|datetime). Allowed values for the input field type are checkbox (default), radio, number, date and datetime.",
442
+ "Search keys": "Search keys",
443
+ "Filters keys": "Filters keys",
444
+ "Filter data": "Filter data",
445
+ "Search map features…": "Search map features…",
446
+ "Reset all": "Reset all",
447
+ "Browser in data mode": "Browser in data mode",
448
+ "Browser in layers mode": "Browser in layers mode",
449
+ "Browser in filters mode": "Browser in filters mode"
451
450
  }