umap-project 2.2.0__py3-none-any.whl → 2.2.0b0__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 (124) hide show
  1. umap/__init__.py +1 -1
  2. umap/static/umap/base.css +5 -14
  3. umap/static/umap/js/modules/browser.js +1 -16
  4. umap/static/umap/js/modules/facets.js +0 -1
  5. umap/static/umap/js/modules/utils.js +2 -2
  6. umap/static/umap/js/umap.autocomplete.js +25 -40
  7. umap/static/umap/js/umap.controls.js +43 -48
  8. umap/static/umap/js/umap.core.js +12 -27
  9. umap/static/umap/js/umap.features.js +2 -2
  10. umap/static/umap/js/umap.forms.js +18 -24
  11. umap/static/umap/js/umap.importer.js +46 -60
  12. umap/static/umap/js/umap.js +11 -9
  13. umap/static/umap/js/umap.layer.js +1 -9
  14. umap/static/umap/js/umap.permissions.js +3 -9
  15. umap/static/umap/js/umap.popup.js +9 -16
  16. umap/static/umap/js/umap.share.js +1 -1
  17. umap/static/umap/js/umap.ui.js +9 -10
  18. umap/static/umap/locale/am_ET.js +3 -4
  19. umap/static/umap/locale/am_ET.json +3 -4
  20. umap/static/umap/locale/ar.js +3 -4
  21. umap/static/umap/locale/ar.json +3 -4
  22. umap/static/umap/locale/ast.js +3 -4
  23. umap/static/umap/locale/ast.json +3 -4
  24. umap/static/umap/locale/bg.js +3 -4
  25. umap/static/umap/locale/bg.json +3 -4
  26. umap/static/umap/locale/br.js +14 -15
  27. umap/static/umap/locale/br.json +14 -15
  28. umap/static/umap/locale/ca.js +3 -4
  29. umap/static/umap/locale/ca.json +3 -4
  30. umap/static/umap/locale/cs_CZ.js +3 -4
  31. umap/static/umap/locale/cs_CZ.json +3 -4
  32. umap/static/umap/locale/da.js +3 -4
  33. umap/static/umap/locale/da.json +3 -4
  34. umap/static/umap/locale/de.js +3 -4
  35. umap/static/umap/locale/de.json +3 -4
  36. umap/static/umap/locale/el.js +3 -4
  37. umap/static/umap/locale/el.json +3 -4
  38. umap/static/umap/locale/en.js +3 -4
  39. umap/static/umap/locale/en.json +3 -4
  40. umap/static/umap/locale/en_US.json +3 -4
  41. umap/static/umap/locale/es.js +3 -4
  42. umap/static/umap/locale/es.json +3 -4
  43. umap/static/umap/locale/et.js +3 -4
  44. umap/static/umap/locale/et.json +3 -4
  45. umap/static/umap/locale/fa_IR.js +3 -4
  46. umap/static/umap/locale/fa_IR.json +3 -4
  47. umap/static/umap/locale/fi.js +3 -4
  48. umap/static/umap/locale/fi.json +3 -4
  49. umap/static/umap/locale/fr.js +3 -4
  50. umap/static/umap/locale/fr.json +3 -4
  51. umap/static/umap/locale/gl.js +3 -4
  52. umap/static/umap/locale/gl.json +3 -4
  53. umap/static/umap/locale/he.js +3 -4
  54. umap/static/umap/locale/he.json +3 -4
  55. umap/static/umap/locale/hr.js +3 -4
  56. umap/static/umap/locale/hr.json +3 -4
  57. umap/static/umap/locale/hu.js +3 -4
  58. umap/static/umap/locale/hu.json +3 -4
  59. umap/static/umap/locale/id.js +3 -4
  60. umap/static/umap/locale/id.json +3 -4
  61. umap/static/umap/locale/is.js +3 -4
  62. umap/static/umap/locale/is.json +3 -4
  63. umap/static/umap/locale/it.js +3 -4
  64. umap/static/umap/locale/it.json +3 -4
  65. umap/static/umap/locale/ja.js +3 -4
  66. umap/static/umap/locale/ja.json +3 -4
  67. umap/static/umap/locale/ko.js +3 -4
  68. umap/static/umap/locale/ko.json +3 -4
  69. umap/static/umap/locale/lt.js +3 -4
  70. umap/static/umap/locale/lt.json +3 -4
  71. umap/static/umap/locale/ms.js +3 -4
  72. umap/static/umap/locale/ms.json +3 -4
  73. umap/static/umap/locale/nl.js +3 -4
  74. umap/static/umap/locale/nl.json +3 -4
  75. umap/static/umap/locale/no.js +3 -4
  76. umap/static/umap/locale/no.json +3 -4
  77. umap/static/umap/locale/pl.js +3 -4
  78. umap/static/umap/locale/pl.json +3 -4
  79. umap/static/umap/locale/pl_PL.json +3 -4
  80. umap/static/umap/locale/pt.js +3 -4
  81. umap/static/umap/locale/pt.json +3 -4
  82. umap/static/umap/locale/pt_BR.js +3 -4
  83. umap/static/umap/locale/pt_BR.json +3 -4
  84. umap/static/umap/locale/pt_PT.js +3 -4
  85. umap/static/umap/locale/pt_PT.json +3 -4
  86. umap/static/umap/locale/ro.js +3 -4
  87. umap/static/umap/locale/ro.json +3 -4
  88. umap/static/umap/locale/ru.js +3 -4
  89. umap/static/umap/locale/ru.json +3 -4
  90. umap/static/umap/locale/sk_SK.js +3 -4
  91. umap/static/umap/locale/sk_SK.json +3 -4
  92. umap/static/umap/locale/sl.js +3 -4
  93. umap/static/umap/locale/sl.json +3 -4
  94. umap/static/umap/locale/sr.js +3 -4
  95. umap/static/umap/locale/sr.json +3 -4
  96. umap/static/umap/locale/sv.js +3 -4
  97. umap/static/umap/locale/sv.json +3 -4
  98. umap/static/umap/locale/th_TH.js +3 -4
  99. umap/static/umap/locale/th_TH.json +3 -4
  100. umap/static/umap/locale/tr.js +3 -4
  101. umap/static/umap/locale/tr.json +3 -4
  102. umap/static/umap/locale/uk_UA.js +3 -4
  103. umap/static/umap/locale/uk_UA.json +3 -4
  104. umap/static/umap/locale/vi.js +3 -4
  105. umap/static/umap/locale/vi.json +3 -4
  106. umap/static/umap/locale/vi_VN.json +3 -4
  107. umap/static/umap/locale/zh.js +3 -4
  108. umap/static/umap/locale/zh.json +3 -4
  109. umap/static/umap/locale/zh_CN.json +3 -4
  110. umap/static/umap/locale/zh_TW.Big5.json +3 -4
  111. umap/static/umap/locale/zh_TW.js +3 -4
  112. umap/static/umap/locale/zh_TW.json +3 -4
  113. umap/static/umap/map.css +1 -12
  114. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +0 -1
  115. umap/tests/integration/test_anonymous_owned_map.py +0 -21
  116. umap/tests/integration/test_basics.py +0 -21
  117. umap/tests/integration/test_edit_map.py +0 -7
  118. umap/tests/integration/test_import.py +2 -4
  119. umap/tests/integration/test_tilelayer.py +0 -10
  120. {umap_project-2.2.0.dist-info → umap_project-2.2.0b0.dist-info}/METADATA +7 -7
  121. {umap_project-2.2.0.dist-info → umap_project-2.2.0b0.dist-info}/RECORD +124 -124
  122. {umap_project-2.2.0.dist-info → umap_project-2.2.0b0.dist-info}/WHEEL +1 -1
  123. {umap_project-2.2.0.dist-info → umap_project-2.2.0b0.dist-info}/entry_points.txt +0 -0
  124. {umap_project-2.2.0.dist-info → umap_project-2.2.0b0.dist-info}/licenses/LICENSE +0 -0
umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "2.2.0"
1
+ VERSION = "2.2.0b0"
umap/static/umap/base.css CHANGED
@@ -580,29 +580,20 @@ i.info {
580
580
  margin-top: -8px;
581
581
  padding: 0 5px;
582
582
  }
583
- .flat-tabs {
583
+ .pictogram-tabs {
584
584
  display: flex;
585
585
  justify-content: space-around;
586
586
  font-size: 1.2em;
587
- margin-bottom: 20px;
588
- border-bottom: 1px solid #bebebe;
587
+ padding-bottom: 20px;
589
588
  }
590
- .flat-tabs button {
589
+ .pictogram-tabs button {
591
590
  padding: 10px;
591
+ color: #fff;
592
592
  text-decoration: none;
593
593
  cursor: pointer;
594
- border-bottom: 1px solid transparent;
595
594
  }
596
- .flat-tabs button:hover,
597
- .flat-tabs .on {
595
+ .pictogram-tabs .on {
598
596
  font-weight: bold;
599
- border-bottom: 1px solid #444;
600
- }
601
- .dark .flat-tabs button {
602
- color: #fff;
603
- }
604
- .dark .flat-tabs button:hover,
605
- .dark .flat-tabs .on {
606
597
  border-bottom: 1px solid #fff;
607
598
  }
608
599
  .umap-pictogram-category h6 {
@@ -44,7 +44,7 @@ export default class Browser {
44
44
  U.Icon.setIconContrast(icon, colorBox, symbol, bgcolor)
45
45
  }
46
46
  const viewFeature = (e) => {
47
- feature.zoomTo({ ...e, callback: feature.view })
47
+ feature.zoomTo({...e, callback: feature.view})
48
48
  }
49
49
  DomEvent.on(zoom_to, 'click', viewFeature)
50
50
  DomEvent.on(title, 'click', viewFeature)
@@ -135,7 +135,6 @@ export default class Browser {
135
135
  DomEvent.disableClickPropagation(container)
136
136
 
137
137
  DomUtil.createTitle(container, translate('Browse data'), 'icon-layers')
138
- this.tabsMenu(container, 'browse')
139
138
  const formContainer = DomUtil.create('div', '', container)
140
139
  this.dataContainer = DomUtil.create('div', '', container)
141
140
 
@@ -166,18 +165,4 @@ export default class Browser {
166
165
  DomEvent.on(button, 'click', map.openBrowser, map)
167
166
  return button
168
167
  }
169
-
170
- tabsMenu(container, active) {
171
- const tabs = L.DomUtil.create('div', 'flat-tabs', container)
172
- const browse = L.DomUtil.add('button', 'flat tab-browse', tabs, L._('Data'))
173
- DomEvent.on(browse, 'click', this.open, this)
174
- if (this.map.options.facetKey) {
175
- const facets = L.DomUtil.add('button', 'flat tab-facets', tabs, L._('Filters'))
176
- DomEvent.on(facets, 'click', this.map.facets.open, this.map.facets)
177
- }
178
- const info = L.DomUtil.add('button', 'flat tab-info', tabs, L._('About'))
179
- DomEvent.on(info, 'click', this.map.displayCaption, this.map)
180
- let el = tabs.querySelector(`.tab-${active}`)
181
- L.DomUtil.addClass(el, 'on')
182
- }
183
168
  }
@@ -69,7 +69,6 @@ export default class Facets {
69
69
  container,
70
70
  translate('Facet search')
71
71
  )
72
- this.map.browser.tabsMenu(container, 'facets')
73
72
  const defined = this.getDefined()
74
73
  const names = Object.keys(defined)
75
74
  const facetProperties = this.compute(names, defined)
@@ -70,6 +70,7 @@ export default function getPurify() {
70
70
  export function escapeHTML(s) {
71
71
  s = s ? s.toString() : ''
72
72
  s = getPurify().sanitize(s, {
73
+ USE_PROFILES: { html: true },
73
74
  ADD_TAGS: ['iframe'],
74
75
  ALLOWED_TAGS: [
75
76
  'h3',
@@ -85,10 +86,9 @@ export function escapeHTML(s) {
85
86
  'iframe',
86
87
  'img',
87
88
  'br',
88
- 'span',
89
89
  ],
90
90
  ADD_ATTR: ['target', 'allow', 'allowfullscreen', 'frameborder', 'scrolling'],
91
- ALLOWED_ATTR: ['href', 'src', 'width', 'height', 'style'],
91
+ ALLOWED_ATTR: ['href', 'src', 'width', 'height'],
92
92
  // Added: `geo:` URL scheme as defined in RFC5870:
93
93
  // https://www.rfc-editor.org/rfc/rfc5870.html
94
94
  // The base RegExp comes from:
@@ -35,25 +35,27 @@ U.AutoComplete = L.Class.extend({
35
35
  },
36
36
 
37
37
  createInput: function () {
38
- this.input = L.DomUtil.element({
39
- tagName: 'input',
40
- type: 'text',
41
- parent: this.el,
42
- placeholder: this.options.placeholder,
43
- autocomplete: 'off',
44
- className: this.options.className,
45
- })
38
+ this.input = L.DomUtil.element(
39
+ 'input',
40
+ {
41
+ type: 'text',
42
+ placeholder: this.options.placeholder,
43
+ autocomplete: 'off',
44
+ className: this.options.className,
45
+ },
46
+ this.el
47
+ )
46
48
  L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this)
47
49
  L.DomEvent.on(this.input, 'keyup', this.onKeyUp, this)
48
50
  L.DomEvent.on(this.input, 'blur', this.onBlur, this)
49
51
  },
50
52
 
51
53
  createContainer: function () {
52
- this.container = L.DomUtil.element({
53
- tagName: 'ul',
54
- parent: document.body,
55
- className: 'umap-autocomplete',
56
- })
54
+ this.container = L.DomUtil.element(
55
+ 'ul',
56
+ { className: 'umap-autocomplete' },
57
+ document.body
58
+ )
57
59
  },
58
60
 
59
61
  resizeContainer: function () {
@@ -172,11 +174,8 @@ U.AutoComplete = L.Class.extend({
172
174
  },
173
175
 
174
176
  createResult: function (item) {
175
- const el = L.DomUtil.element({
176
- tagName: 'li',
177
- parent: this.container,
178
- textContent: item.label,
179
- })
177
+ const el = L.DomUtil.element('li', {}, this.container)
178
+ el.textContent = item.label
180
179
  const result = {
181
180
  item: item,
182
181
  el: el,
@@ -277,22 +276,15 @@ U.AutoComplete.Ajax.SelectMultiple = U.AutoComplete.Ajax.extend({
277
276
  initSelectedContainer: function () {
278
277
  return L.DomUtil.after(
279
278
  this.input,
280
- L.DomUtil.element({ tagName: 'ul', className: 'umap-multiresult' })
279
+ L.DomUtil.element('ul', { className: 'umap-multiresult' })
281
280
  )
282
281
  },
283
282
 
284
283
  displaySelected: function (result) {
285
- const result_el = L.DomUtil.element({
286
- tagName: 'li',
287
- parent: this.selected_container,
288
- })
284
+ const result_el = L.DomUtil.element('li', {}, this.selected_container)
289
285
  result_el.textContent = result.item.label
290
- const close = L.DomUtil.element({
291
- tagName: 'span',
292
- parent: result_el,
293
- className: 'close',
294
- textContent: '×',
295
- })
286
+ const close = L.DomUtil.element('span', { className: 'close' }, result_el)
287
+ close.textContent = '×'
296
288
  L.DomEvent.on(
297
289
  close,
298
290
  'click',
@@ -310,22 +302,15 @@ U.AutoComplete.Ajax.Select = U.AutoComplete.Ajax.extend({
310
302
  initSelectedContainer: function () {
311
303
  return L.DomUtil.after(
312
304
  this.input,
313
- L.DomUtil.element({ tagName: 'div', className: 'umap-singleresult' })
305
+ L.DomUtil.element('div', { className: 'umap-singleresult' })
314
306
  )
315
307
  },
316
308
 
317
309
  displaySelected: function (result) {
318
- const result_el = L.DomUtil.element({
319
- tagName: 'div',
320
- parent: this.selected_container,
321
- })
310
+ const result_el = L.DomUtil.element('div', {}, this.selected_container)
322
311
  result_el.textContent = result.item.label
323
- const close = L.DomUtil.element({
324
- tagName: 'span',
325
- parent: result_el,
326
- className: 'close',
327
- textContent: '×',
328
- })
312
+ const close = L.DomUtil.element('span', { className: 'close' }, result_el)
313
+ close.textContent = '×'
329
314
  this.input.style.display = 'none'
330
315
  L.DomEvent.on(
331
316
  close,
@@ -392,7 +392,7 @@ U.EditControl = L.Control.extend({
392
392
  'mouseover',
393
393
  function () {
394
394
  map.ui.tooltip({
395
- content: map.help.displayLabel('TOGGLE_EDIT'),
395
+ content: `${L._('Switch to edit mode')} (<kbd>Ctrl+E</kbd>)`,
396
396
  anchor: enableEditing,
397
397
  position: 'bottom',
398
398
  delay: 750,
@@ -668,29 +668,21 @@ const ControlsMixin = {
668
668
  const container = L.DomUtil.create('div', 'umap-caption')
669
669
  L.DomUtil.createTitle(container, this.options.name, 'icon-caption')
670
670
  this.permissions.addOwnerLink('h5', container)
671
- this.browser.tabsMenu(container, 'info')
672
671
  if (this.options.description) {
673
- const description = L.DomUtil.element({
674
- tagName: 'div',
675
- className: 'umap-map-description',
676
- safeHTML: U.Utils.toHTML(this.options.description),
677
- parent: container,
678
- })
672
+ const description = L.DomUtil.create('div', 'umap-map-description', container)
673
+ description.innerHTML = U.Utils.toHTML(this.options.description)
679
674
  }
680
675
  const datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container)
681
676
  this.eachVisibleDataLayer((datalayer) => {
682
677
  if (!datalayer.options.inCaption) return
683
678
  const p = L.DomUtil.create('p', 'datalayer-legend', datalayerContainer),
684
679
  legend = L.DomUtil.create('span', '', p),
685
- headline = L.DomUtil.create('strong', '', p)
680
+ headline = L.DomUtil.create('strong', '', p),
681
+ description = L.DomUtil.create('span', '', p)
686
682
  datalayer.onceLoaded(function () {
687
683
  datalayer.renderLegend(legend)
688
684
  if (datalayer.options.description) {
689
- L.DomUtil.element({
690
- tagName: 'span',
691
- parent: p,
692
- safeHTML: U.Utils.toHTML(datalayer.options.description),
693
- })
685
+ description.innerHTML = U.Utils.toHTML(datalayer.options.description)
694
686
  }
695
687
  })
696
688
  datalayer.renderToolbox(headline)
@@ -700,11 +692,12 @@ const ControlsMixin = {
700
692
  credits = L.DomUtil.createFieldset(creditsContainer, L._('Credits'))
701
693
  title = L.DomUtil.add('h5', '', credits, L._('User content credits'))
702
694
  if (this.options.shortCredit || this.options.longCredit) {
703
- L.DomUtil.element({
704
- tagName: 'p',
705
- parent: credits,
706
- safeHTML: U.Utils.toHTML(this.options.longCredit || this.options.shortCredit),
707
- })
695
+ L.DomUtil.add(
696
+ 'p',
697
+ '',
698
+ credits,
699
+ U.Utils.toHTML(this.options.longCredit || this.options.shortCredit)
700
+ )
708
701
  }
709
702
  if (this.options.licence) {
710
703
  const licence = L.DomUtil.add(
@@ -722,27 +715,24 @@ const ControlsMixin = {
722
715
  } else {
723
716
  L.DomUtil.add('p', '', credits, L._('No licence has been set'))
724
717
  }
718
+ L.DomUtil.create('hr', '', credits)
725
719
  title = L.DomUtil.create('h5', '', credits)
726
720
  title.textContent = L._('Map background credits')
727
- const tilelayerCredit = L.DomUtil.create('p', '', credits)
728
- L.DomUtil.element({
729
- tagName: 'strong',
730
- parent: tilelayerCredit,
731
- textContent: `${this.selected_tilelayer.options.name} `,
732
- })
733
- L.DomUtil.element({
734
- tagName: 'span',
735
- parent: tilelayerCredit,
736
- safeHTML: this.selected_tilelayer.getAttribution(),
737
- })
738
- const urls = {
739
- leaflet: 'http://leafletjs.com',
740
- django: 'https://www.djangoproject.com',
741
- umap: 'http://wiki.openstreetmap.org/wiki/UMap',
742
- changelog: 'https://umap-project.readthedocs.io/en/master/changelog/',
743
- version: this.options.umap_version,
744
- }
745
- const creditHTML = L._(
721
+ const tilelayerCredit = L.DomUtil.create('p', '', credits),
722
+ name = L.DomUtil.create('strong', '', tilelayerCredit),
723
+ attribution = L.DomUtil.create('span', '', tilelayerCredit)
724
+ name.textContent = `${this.selected_tilelayer.options.name} `
725
+ attribution.innerHTML = this.selected_tilelayer.getAttribution()
726
+ L.DomUtil.create('hr', '', credits)
727
+ const umapCredit = L.DomUtil.create('p', '', credits),
728
+ urls = {
729
+ leaflet: 'http://leafletjs.com',
730
+ django: 'https://www.djangoproject.com',
731
+ umap: 'http://wiki.openstreetmap.org/wiki/UMap',
732
+ changelog: 'https://umap-project.readthedocs.io/en/master/changelog/',
733
+ version: this.options.umap_version,
734
+ }
735
+ umapCredit.innerHTML = L._(
746
736
  `
747
737
  Powered by <a href="{leaflet}">Leaflet</a> and
748
738
  <a href="{django}">Django</a>,
@@ -751,7 +741,6 @@ const ControlsMixin = {
751
741
  `,
752
742
  urls
753
743
  )
754
- L.DomUtil.element({ tagName: 'p', innerHTML: creditHTML, parent: credits })
755
744
  this.panel.open({ content: container })
756
745
  },
757
746
 
@@ -765,7 +754,13 @@ const ControlsMixin = {
765
754
  const rightContainer = L.DomUtil.create('div', 'umap-right-edit-toolbox', container)
766
755
  const logo = L.DomUtil.create('div', 'logo', leftContainer)
767
756
  L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage'))
768
- const nameButton = L.DomUtil.createButton('map-name', leftContainer, '')
757
+ const nameButton = L.DomUtil.createButton(
758
+ 'map-name',
759
+ leftContainer,
760
+ '',
761
+ this.edit,
762
+ this
763
+ )
769
764
  L.DomEvent.on(
770
765
  nameButton,
771
766
  'mouseover',
@@ -814,7 +809,7 @@ const ControlsMixin = {
814
809
  update()
815
810
  this.once('saved', L.bind(update, this))
816
811
  if (this.options.editMode === 'advanced') {
817
- L.DomEvent.on(nameButton, 'click', this.editCaption, this)
812
+ L.DomEvent.on(nameButton, 'click', this.edit, this)
818
813
  L.DomEvent.on(shareStatusButton, 'click', this.permissions.edit, this.permissions)
819
814
  }
820
815
  this.on('postsync', L.bind(update, this))
@@ -1057,16 +1052,16 @@ U.AttributionControl = L.Control.Attribution.extend({
1057
1052
  // Use our own container, so we can hide/show on small screens
1058
1053
  const credits = this._container.innerHTML
1059
1054
  this._container.innerHTML = ''
1060
- const container = L.DomUtil.create('div', 'attribution-container', this._container)
1061
- container.innerHTML = credits
1055
+ const container = L.DomUtil.add(
1056
+ 'div',
1057
+ 'attribution-container',
1058
+ this._container,
1059
+ credits
1060
+ )
1062
1061
  const shortCredit = this._map.getOption('shortCredit'),
1063
1062
  captionMenus = this._map.getOption('captionMenus')
1064
1063
  if (shortCredit) {
1065
- L.DomUtil.element({
1066
- tagName: 'span',
1067
- parent: container,
1068
- safeHTML: ` — ${U.Utils.toHTML(shortCredit)}`,
1069
- })
1064
+ L.DomUtil.add('span', '', container, ` — ${U.Utils.toHTML(shortCredit)}`)
1070
1065
  }
1071
1066
  if (captionMenus) {
1072
1067
  const link = L.DomUtil.add('a', '', container, ` — ${L._('About')}`)
@@ -118,21 +118,19 @@ L.DomUtil.createLink = (className, container, content, url, target, title) => {
118
118
  }
119
119
 
120
120
  L.DomUtil.createIcon = (parent, className, title, size = 16) => {
121
- return L.DomUtil.element({
122
- tagName: 'i',
123
- parent: parent,
124
- className: `icon icon-${size} ${className}`,
125
- title: title || '',
126
- })
121
+ return L.DomUtil.element(
122
+ 'i',
123
+ { className: `icon icon-${size} ${className}`, title: title || '' },
124
+ parent
125
+ )
127
126
  }
128
127
 
129
128
  L.DomUtil.createButtonIcon = (parent, className, title, size = 16) => {
130
- return L.DomUtil.element({
131
- tagName: 'button',
132
- parent: parent,
133
- className: `icon icon-${size} ${className}`,
134
- title: title || '',
135
- })
129
+ return L.DomUtil.element(
130
+ 'button',
131
+ { className: `icon icon-${size} ${className}`, title: title || '' },
132
+ parent
133
+ )
136
134
  }
137
135
 
138
136
  L.DomUtil.createTitle = (parent, text, className, tag = 'h3') => {
@@ -165,13 +163,8 @@ L.DomUtil.classIf = (el, className, bool) => {
165
163
  else L.DomUtil.removeClass(el, className)
166
164
  }
167
165
 
168
- L.DomUtil.element = ({ tagName, parent, ...attrs }) => {
169
- const el = document.createElement(tagName)
170
- if (attrs.innerHTML) {
171
- attrs.innerHTML = U.Utils.escapeHTML(attrs.innerHTML)
172
- } else if (attrs.safeHTML) {
173
- attrs.innerHTML = attrs.safeHTML
174
- }
166
+ L.DomUtil.element = (what, attrs, parent) => {
167
+ const el = document.createElement(what)
175
168
  for (const attr in attrs) {
176
169
  el[attr] = attrs[attr]
177
170
  }
@@ -321,14 +314,6 @@ U.Help = L.Class.extend({
321
314
  shortcut: 'Modifier+S',
322
315
  label: L._('Save current edits'),
323
316
  },
324
- EDIT_FEATURE_LAYER: {
325
- shortcut: 'Modifier+⇧+Click',
326
- label: L._("Edit feature's layer"),
327
- },
328
- CONTINUE_LINE: {
329
- shortcut: 'Modifier+Click',
330
- label: L._('Continue line'),
331
- },
332
317
  },
333
318
 
334
319
  displayLabel: function (action, withKbdTag = true) {
@@ -448,7 +448,7 @@ U.FeatureMixin = {
448
448
  }
449
449
  items = items.concat(
450
450
  {
451
- text: this.map.help.displayLabel('EDIT_FEATURE_LAYER'),
451
+ text: L._("Edit feature's layer") + ' (Ctrl+⇧+Click)',
452
452
  callback: this.datalayer.edit,
453
453
  context: this.datalayer,
454
454
  iconCls: 'umap-edit',
@@ -1055,7 +1055,7 @@ U.Polyline = L.Polyline.extend({
1055
1055
  })
1056
1056
  } else if (index === 0 || index === e.vertex.getLastIndex()) {
1057
1057
  items.push({
1058
- text: this.map.help.displayLabel('CONTINUE_LINE'),
1058
+ text: L._('Continue line (Ctrl+Click)'),
1059
1059
  callback: e.vertex.continue,
1060
1060
  context: e.vertex.continue,
1061
1061
  })
@@ -475,7 +475,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
475
475
  build: function () {
476
476
  L.FormBuilder.BlurInput.prototype.build.call(this)
477
477
  this.buttons = L.DomUtil.create('div', '', this.parentNode)
478
- this.tabs = L.DomUtil.create('div', 'flat-tabs', this.parentNode)
478
+ this.tabs = L.DomUtil.create('div', 'pictogram-tabs', this.parentNode)
479
479
  this.body = L.DomUtil.create('div', 'umap-pictogram-body', this.parentNode)
480
480
  this.footer = L.DomUtil.create('div', '', this.parentNode)
481
481
  this.updatePreview()
@@ -757,15 +757,12 @@ L.FormBuilder.FacetSearchChoices = L.FormBuilder.Element.extend({
757
757
  },
758
758
 
759
759
  buildLabel: function () {
760
- this.label = L.DomUtil.element({
761
- tagName: 'legend',
762
- textContent: this.options.label,
763
- })
760
+ this.label = L.DomUtil.element('legend', {textContent: this.options.label})
764
761
  },
765
762
 
766
763
  buildLi: function (value) {
767
764
  const property_li = L.DomUtil.create('li', '', this.ul)
768
- const label = L.DomUtil.create('label', '', property_li)
765
+ const label = L.DomUtil.add('label', '', property_li)
769
766
  const input = L.DomUtil.create('input', '', label)
770
767
  L.DomUtil.add('span', '', label, value)
771
768
 
@@ -803,14 +800,14 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
803
800
  build: function () {
804
801
  this.container = L.DomUtil.create('fieldset', 'umap-facet', this.parentNode)
805
802
  this.container.appendChild(this.label)
806
- const { min, max, type } = this.options.criteria
803
+ const {min, max, type} = this.options.criteria
807
804
  this.type = type
808
805
  this.inputType = this.getInputType(this.type)
809
806
 
810
807
  const [minLabel, maxLabel] = this.getLabels()
811
808
 
812
809
  this.minLabel = L.DomUtil.create('label', '', this.container)
813
- this.minLabel.textContent = minLabel
810
+ this.minLabel.innerHTML = minLabel
814
811
 
815
812
  this.minInput = L.DomUtil.create('input', '', this.minLabel)
816
813
  this.minInput.type = this.inputType
@@ -820,8 +817,9 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
820
817
  this.minInput.dataset.value = min
821
818
  }
822
819
 
820
+
823
821
  this.maxLabel = L.DomUtil.create('label', '', this.container)
824
- this.maxLabel.textContent = maxLabel
822
+ this.maxLabel.innerHTML = maxLabel
825
823
 
826
824
  this.maxInput = L.DomUtil.create('input', '', this.maxLabel)
827
825
  this.maxInput.type = this.inputType
@@ -836,10 +834,7 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.Element.extend({
836
834
  },
837
835
 
838
836
  buildLabel: function () {
839
- this.label = L.DomUtil.element({
840
- tagName: 'legend',
841
- textContent: this.options.label,
842
- })
837
+ this.label = L.DomUtil.element('legend', {textContent: this.options.label})
843
838
  },
844
839
 
845
840
  toJS: function () {
@@ -979,23 +974,22 @@ L.FormBuilder.Range = L.FormBuilder.FloatInput.extend({
979
974
  },
980
975
 
981
976
  buildHelpText: function () {
977
+ const datalist = L.DomUtil.create(
978
+ 'datalist',
979
+ 'umap-field-datalist',
980
+ this.getHelpTextParent()
981
+ )
982
+ datalist.id = `range-${this.options.label || this.name}`
983
+ this.input.setAttribute('list', datalist.id)
982
984
  let options = ''
983
- const step = this.options.step || 1
984
- const digits = step < 1 ? 1 : 0
985
- const id = `range-${this.options.label || this.name}`
985
+ const step = this.options.step || 1,
986
+ digits = step < 1 ? 1 : 0
986
987
  for (let i = this.options.min; i <= this.options.max; i += this.options.step) {
987
988
  options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(
988
989
  digits
989
990
  )}"></option>`
990
991
  }
991
- const datalist = L.DomUtil.element({
992
- tagName: 'datalist',
993
- parent: this.getHelpTextParent(),
994
- className: 'umap-field-datalist',
995
- safeHTML: options,
996
- id: id,
997
- })
998
- this.input.setAttribute('list', id)
992
+ datalist.innerHTML = options
999
993
  L.FormBuilder.Input.prototype.buildHelpText.call(this)
1000
994
  },
1001
995
  })