umap-project 3.4.0b3__py3-none-any.whl → 3.4.2__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 (185) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/da/LC_MESSAGES/django.mo +0 -0
  3. umap/locale/da/LC_MESSAGES/django.po +18 -14
  4. umap/locale/en/LC_MESSAGES/django.po +5 -1
  5. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/es/LC_MESSAGES/django.po +20 -16
  7. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/fr/LC_MESSAGES/django.po +18 -14
  9. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/pl/LC_MESSAGES/django.po +72 -71
  11. umap/static/umap/content.css +0 -3
  12. umap/static/umap/css/bar.css +9 -6
  13. umap/static/umap/css/form.css +25 -9
  14. umap/static/umap/css/popup.css +1 -0
  15. umap/static/umap/js/components/copiable.js +47 -0
  16. umap/static/umap/js/modules/autocomplete.js +31 -58
  17. umap/static/umap/js/modules/browser.js +4 -4
  18. umap/static/umap/js/modules/data/features.js +32 -35
  19. umap/static/umap/js/modules/data/fields.js +189 -23
  20. umap/static/umap/js/modules/data/layer.js +72 -87
  21. umap/static/umap/js/modules/domutils.js +21 -1
  22. umap/static/umap/js/modules/filters.js +13 -40
  23. umap/static/umap/js/modules/form/fields.js +4 -4
  24. umap/static/umap/js/modules/formatter.js +9 -1
  25. umap/static/umap/js/modules/help.js +12 -13
  26. umap/static/umap/js/modules/importer.js +17 -26
  27. umap/static/umap/js/modules/importers/banfr.js +0 -1
  28. umap/static/umap/js/modules/importers/cadastrefr.js +19 -19
  29. umap/static/umap/js/modules/importers/communesfr.js +7 -8
  30. umap/static/umap/js/modules/importers/datasets.js +14 -14
  31. umap/static/umap/js/modules/importers/geodatamine.js +20 -22
  32. umap/static/umap/js/modules/importers/opendata.js +10 -0
  33. umap/static/umap/js/modules/importers/overpass.js +19 -18
  34. umap/static/umap/js/modules/managers.js +1 -1
  35. umap/static/umap/js/modules/permissions.js +5 -3
  36. umap/static/umap/js/modules/rendering/controls.js +2 -2
  37. umap/static/umap/js/modules/rendering/icon.js +5 -9
  38. umap/static/umap/js/modules/rendering/layers/base.js +1 -1
  39. umap/static/umap/js/modules/rendering/layers/classified.js +15 -10
  40. umap/static/umap/js/modules/rendering/layers/heat.js +1 -0
  41. umap/static/umap/js/modules/rendering/map.js +22 -22
  42. umap/static/umap/js/modules/rendering/popup.js +6 -3
  43. umap/static/umap/js/modules/rendering/template.js +28 -34
  44. umap/static/umap/js/modules/rendering/ui.js +1 -2
  45. umap/static/umap/js/modules/rules.js +34 -41
  46. umap/static/umap/js/modules/schema.js +0 -7
  47. umap/static/umap/js/modules/share.js +36 -69
  48. umap/static/umap/js/modules/slideshow.js +3 -3
  49. umap/static/umap/js/modules/tableeditor.js +0 -1
  50. umap/static/umap/js/modules/ui/bar.js +51 -32
  51. umap/static/umap/js/modules/ui/panel.js +26 -21
  52. umap/static/umap/js/modules/ui/tooltip.js +1 -1
  53. umap/static/umap/js/modules/umap.js +75 -80
  54. umap/static/umap/js/modules/utils.js +12 -3
  55. umap/static/umap/js/umap.controls.js +33 -14
  56. umap/static/umap/locale/am_ET.js +6 -4
  57. umap/static/umap/locale/am_ET.json +6 -4
  58. umap/static/umap/locale/ar.js +6 -4
  59. umap/static/umap/locale/ar.json +6 -4
  60. umap/static/umap/locale/ast.js +6 -4
  61. umap/static/umap/locale/ast.json +6 -4
  62. umap/static/umap/locale/bg.js +6 -4
  63. umap/static/umap/locale/bg.json +6 -4
  64. umap/static/umap/locale/br.js +19 -8
  65. umap/static/umap/locale/br.json +19 -8
  66. umap/static/umap/locale/ca.js +6 -4
  67. umap/static/umap/locale/ca.json +6 -4
  68. umap/static/umap/locale/cs_CZ.js +7 -5
  69. umap/static/umap/locale/cs_CZ.json +7 -5
  70. umap/static/umap/locale/da.js +8 -6
  71. umap/static/umap/locale/da.json +8 -6
  72. umap/static/umap/locale/de.js +38 -36
  73. umap/static/umap/locale/de.json +38 -36
  74. umap/static/umap/locale/el.js +7 -5
  75. umap/static/umap/locale/el.json +7 -5
  76. umap/static/umap/locale/en.js +7 -5
  77. umap/static/umap/locale/en.json +7 -5
  78. umap/static/umap/locale/en_US.json +6 -4
  79. umap/static/umap/locale/es.js +19 -17
  80. umap/static/umap/locale/es.json +19 -17
  81. umap/static/umap/locale/et.js +7 -5
  82. umap/static/umap/locale/et.json +7 -5
  83. umap/static/umap/locale/eu.js +23 -21
  84. umap/static/umap/locale/eu.json +23 -21
  85. umap/static/umap/locale/fa_IR.js +7 -5
  86. umap/static/umap/locale/fa_IR.json +7 -5
  87. umap/static/umap/locale/fi.js +6 -4
  88. umap/static/umap/locale/fi.json +6 -4
  89. umap/static/umap/locale/fr.js +8 -6
  90. umap/static/umap/locale/fr.json +8 -6
  91. umap/static/umap/locale/gl.js +147 -145
  92. umap/static/umap/locale/gl.json +147 -145
  93. umap/static/umap/locale/he.js +6 -4
  94. umap/static/umap/locale/he.json +6 -4
  95. umap/static/umap/locale/hr.js +6 -4
  96. umap/static/umap/locale/hr.json +6 -4
  97. umap/static/umap/locale/hu.js +7 -5
  98. umap/static/umap/locale/hu.json +7 -5
  99. umap/static/umap/locale/id.js +6 -4
  100. umap/static/umap/locale/id.json +6 -4
  101. umap/static/umap/locale/is.js +7 -5
  102. umap/static/umap/locale/is.json +7 -5
  103. umap/static/umap/locale/it.js +7 -5
  104. umap/static/umap/locale/it.json +7 -5
  105. umap/static/umap/locale/ja.js +6 -4
  106. umap/static/umap/locale/ja.json +6 -4
  107. umap/static/umap/locale/ko.js +6 -4
  108. umap/static/umap/locale/ko.json +6 -4
  109. umap/static/umap/locale/lt.js +6 -4
  110. umap/static/umap/locale/lt.json +6 -4
  111. umap/static/umap/locale/ms.js +7 -5
  112. umap/static/umap/locale/ms.json +7 -5
  113. umap/static/umap/locale/nl.js +7 -5
  114. umap/static/umap/locale/nl.json +7 -5
  115. umap/static/umap/locale/no.js +6 -4
  116. umap/static/umap/locale/no.json +6 -4
  117. umap/static/umap/locale/pl.js +53 -51
  118. umap/static/umap/locale/pl.json +53 -51
  119. umap/static/umap/locale/pl_PL.json +6 -4
  120. umap/static/umap/locale/pt.js +7 -5
  121. umap/static/umap/locale/pt.json +7 -5
  122. umap/static/umap/locale/pt_BR.js +6 -4
  123. umap/static/umap/locale/pt_BR.json +6 -4
  124. umap/static/umap/locale/pt_PT.js +6 -4
  125. umap/static/umap/locale/pt_PT.json +6 -4
  126. umap/static/umap/locale/ro.js +6 -4
  127. umap/static/umap/locale/ro.json +6 -4
  128. umap/static/umap/locale/ru.js +6 -4
  129. umap/static/umap/locale/ru.json +6 -4
  130. umap/static/umap/locale/sk_SK.js +6 -4
  131. umap/static/umap/locale/sk_SK.json +6 -4
  132. umap/static/umap/locale/sl.js +6 -4
  133. umap/static/umap/locale/sl.json +6 -4
  134. umap/static/umap/locale/sr.js +6 -4
  135. umap/static/umap/locale/sr.json +6 -4
  136. umap/static/umap/locale/sv.js +6 -4
  137. umap/static/umap/locale/sv.json +6 -4
  138. umap/static/umap/locale/th_TH.js +6 -4
  139. umap/static/umap/locale/th_TH.json +6 -4
  140. umap/static/umap/locale/tr.js +6 -4
  141. umap/static/umap/locale/tr.json +6 -4
  142. umap/static/umap/locale/uk_UA.js +6 -4
  143. umap/static/umap/locale/uk_UA.json +6 -4
  144. umap/static/umap/locale/vi.js +6 -4
  145. umap/static/umap/locale/vi.json +6 -4
  146. umap/static/umap/locale/vi_VN.json +6 -4
  147. umap/static/umap/locale/zh.js +6 -4
  148. umap/static/umap/locale/zh.json +6 -4
  149. umap/static/umap/locale/zh_CN.json +6 -4
  150. umap/static/umap/locale/zh_TW.Big5.json +6 -4
  151. umap/static/umap/locale/zh_TW.js +20 -18
  152. umap/static/umap/locale/zh_TW.json +20 -18
  153. umap/static/umap/map.css +5 -4
  154. umap/static/umap/unittests/utils.js +7 -7
  155. umap/templates/umap/content_footer.html +1 -0
  156. umap/templates/umap/css.html +0 -2
  157. umap/templates/umap/js.html +1 -3
  158. umap/tests/integration/conftest.py +3 -2
  159. umap/tests/integration/test_anonymous_owned_map.py +1 -1
  160. umap/tests/integration/test_conditional_rules.py +106 -51
  161. umap/tests/integration/test_draw_polygon.py +4 -0
  162. umap/tests/integration/test_draw_polyline.py +11 -0
  163. umap/tests/integration/test_edit_datalayer.py +1 -1
  164. umap/tests/integration/test_fields.py +19 -0
  165. umap/tests/integration/test_iframe.py +1 -1
  166. umap/tests/integration/test_import.py +23 -0
  167. umap/tests/integration/test_map.py +2 -2
  168. umap/tests/integration/test_owned_map.py +2 -2
  169. umap/tests/integration/test_popup.py +31 -0
  170. umap/tests/integration/test_remote_data.py +4 -4
  171. umap/tests/integration/test_search.py +41 -0
  172. umap/tests/integration/test_share.py +2 -2
  173. umap/tests/integration/test_team.py +1 -1
  174. umap/tests/integration/test_websocket_sync.py +6 -1
  175. umap/tests/test_utils.py +4 -1
  176. umap/utils.py +1 -0
  177. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/METADATA +15 -15
  178. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/RECORD +181 -183
  179. umap/static/umap/js/umap.core.js +0 -93
  180. umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.css +0 -46
  181. umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.js +0 -240
  182. umap/static/umap/vendors/editinosm/edit-in-osm.png +0 -0
  183. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/WHEEL +0 -0
  184. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/entry_points.txt +0 -0
  185. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,26 +1,28 @@
1
- import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { uMapAlert as Alert } from '../../components/alerts/alert.js'
3
2
  import { BaseAjax, SingleMixin } from '../autocomplete.js'
4
3
  import { translate } from '../i18n.js'
5
4
  import * as Util from '../utils.js'
5
+ import * as DOMUtils from '../domutils.js'
6
6
  import { AutocompleteCommunes } from './communesfr.js'
7
7
 
8
8
  const TEMPLATE = `
9
- <h3>Cadastre</h3>
10
- <p>Importer les données cadastrales d’une commune française.</p>
11
- <div class="formbox">
12
- <select name="theme">
13
- <option value="batiments">Bâtiments</option>
14
- <option value="communes">Communes</option>
15
- <option value="feuilles">Feuilles</option>
16
- <option value="lieux_dits">Lieux dits</option>
17
- <option value="parcelles" selected>Parcelles</option>
18
- <option value="prefixes_sections">Préfixes sections</option>
19
- <option value="sections">Sections</option>
20
- <option value="subdivisions_fiscales">Subdivisions fiscales</option>
21
- </select>
22
- <label id="boundary">
23
- </label>
9
+ <div>
10
+ <h3>Cadastre</h3>
11
+ <p>Importer les données cadastrales d’une commune française.</p>
12
+ <div class="formbox">
13
+ <select name="theme" data-ref="select">
14
+ <option value="batiments">Bâtiments</option>
15
+ <option value="communes">Communes</option>
16
+ <option value="feuilles">Feuilles</option>
17
+ <option value="lieux_dits">Lieux dits</option>
18
+ <option value="parcelles" selected>Parcelles</option>
19
+ <option value="prefixes_sections">Préfixes sections</option>
20
+ <option value="sections">Sections</option>
21
+ <option value="subdivisions_fiscales">Subdivisions fiscales</option>
22
+ </select>
23
+ <label id="boundary">
24
+ </label>
25
+ </div>
24
26
  </div>
25
27
  `
26
28
 
@@ -33,9 +35,7 @@ export class Importer {
33
35
  async open(importer) {
34
36
  let boundary = null
35
37
  let boundaryName = null
36
- const container = DomUtil.create('div')
37
- container.innerHTML = TEMPLATE
38
- const select = container.querySelector('select')
38
+ const [container, { select }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
39
39
  const options = {
40
40
  placeholder: 'Nom ou code INSEE…',
41
41
  url: 'https://geo.api.gouv.fr/communes?nom={q}&limit=5',
@@ -1,6 +1,6 @@
1
- import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { BaseAjax, SingleMixin } from '../autocomplete.js'
3
2
  import * as Util from '../utils.js'
3
+ import * as DOMUtils from '../domutils.js'
4
4
 
5
5
  export class AutocompleteCommunes extends SingleMixin(BaseAjax) {
6
6
  createResult(item) {
@@ -29,13 +29,12 @@ export class Importer {
29
29
  }
30
30
 
31
31
  async open(importer) {
32
- const container = DomUtil.create('div')
33
- DomUtil.createTitle(container, this.name)
34
- DomUtil.element({
35
- tagName: 'p',
36
- parent: container,
37
- textContent: "Importer les contours d'une commune française.",
38
- })
32
+ const container = DOMUtils.loadTemplate(`
33
+ <div>
34
+ <h3>${this.name}</h3>
35
+ <p>Importer les contours d'une commune française.</p>
36
+ </div>
37
+ `)
39
38
  const options = {
40
39
  placeholder: 'Nom ou code INSEE…',
41
40
  url: 'https://geo.api.gouv.fr/communes?nom={q}&limit=5',
@@ -1,5 +1,5 @@
1
- import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { translate } from '../i18n.js'
2
+ import * as DOMUtils from '../domutils.js'
3
3
 
4
4
  export class Importer {
5
5
  constructor(map, options) {
@@ -9,20 +9,20 @@ export class Importer {
9
9
  }
10
10
 
11
11
  async open(importer) {
12
- const container = DomUtil.create('div', 'formbox')
13
- DomUtil.element({ tagName: 'h3', textContent: this.name, parent: container })
14
- const select = DomUtil.create('select', '', container)
15
- const noPreset = DomUtil.element({
16
- tagName: 'option',
17
- parent: select,
18
- value: '',
19
- textContent: translate('Choose a dataset'),
20
- })
12
+ const [container, { select }] = DOMUtils.loadTemplateWithRefs(`
13
+ <div class="formbox">
14
+ <h3>${this.name}</h3>
15
+ <select data-ref="select">
16
+ <option value="">${translate('Choose a dataset')}</option>
17
+ </select>
18
+ </div>
19
+ `)
20
+
21
21
  for (const dataset of this.choices) {
22
- const option = DomUtil.create('option', '', select)
23
- option.value = dataset.url
24
- option.textContent = dataset.label
25
- option.dataset.format = dataset.format || 'geojson'
22
+ const option = DOMUtils.loadTemplate(
23
+ `<option value="${dataset.url}" data-format="${dataset.format || 'geojson'}">${dataset.label}</option>`
24
+ )
25
+ select.appendChild(option)
26
26
  }
27
27
  const confirm = () => {
28
28
  if (select.value) {
@@ -1,8 +1,8 @@
1
- import { DomEvent, DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { uMapAlert as Alert } from '../../components/alerts/alert.js'
3
2
  import { BaseAjax, SingleMixin } from '../autocomplete.js'
4
3
  import { translate } from '../i18n.js'
5
4
  import * as Utils from '../utils.js'
5
+ import * as DOMUtils from '../domutils.js'
6
6
 
7
7
  const BOUNDARY_TYPES = {
8
8
  admin_6: 'département',
@@ -14,18 +14,20 @@ const BOUNDARY_TYPES = {
14
14
  }
15
15
 
16
16
  const TEMPLATE = `
17
- <h3>GeoDataMine</h3>
18
- <p>${translate('GeoDataMine: thematic data from OpenStreetMap')}.</p>
19
- <div class="formbox">
20
- <select name="theme">
21
- <option value="">${translate('Choose a theme')}</option>
22
- </select>
23
- <label>
24
- <input type="checkbox" name="aspoint" />
25
- ${translate('Simplify all geometries to points')}
26
- </label>
27
- <label id="boundary">
28
- </label>
17
+ <div>
18
+ <h3>GeoDataMine</h3>
19
+ <p>${translate('GeoDataMine: thematic data from OpenStreetMap')}.</p>
20
+ <div class="formbox">
21
+ <select name="theme" data-ref="select">
22
+ <option value="">${translate('Choose a theme')}</option>
23
+ </select>
24
+ <label>
25
+ <input type="checkbox" name="aspoint" />
26
+ ${translate('Simplify all geometries to points')}
27
+ </label>
28
+ <label id="boundary">
29
+ </label>
30
+ </div>
29
31
  </div>
30
32
  `
31
33
 
@@ -49,20 +51,16 @@ export class Importer {
49
51
  async open(importer) {
50
52
  let boundary = null
51
53
  let boundaryName = null
52
- const container = DomUtil.create('div')
53
- container.innerHTML = TEMPLATE
54
+ const [container, { select }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
54
55
  const response = await this.umap.request.get(`${this.baseUrl}/themes`)
55
- const select = container.querySelector('select')
56
56
  if (response?.ok) {
57
57
  const { themes } = await response.json()
58
58
  themes.sort((a, b) => Utils.naturalSort(a['name:fr'], b['name:fr']))
59
59
  for (const theme of themes) {
60
- DomUtil.element({
61
- tagName: 'option',
62
- value: theme.id,
63
- textContent: theme['name:fr'],
64
- parent: select,
65
- })
60
+ const option = DOMUtils.loadTemplate(
61
+ `<option value="${theme.id}">${theme['name:fr']}</option>`
62
+ )
63
+ select.appendChild(option)
66
64
  }
67
65
  } else {
68
66
  console.error(response)
@@ -63,6 +63,16 @@ const PORTALS = [
63
63
  url: 'https://admin.geospm.com',
64
64
  platform: 'prodige',
65
65
  },
66
+ {
67
+ name: 'SNCF',
68
+ url: 'https://ressources.data.sncf.com',
69
+ platform: 'opendatasoft',
70
+ },
71
+ {
72
+ name: 'Réseau STAR Rennes',
73
+ url: 'https://data.explore.star.fr',
74
+ platform: 'opendatasoft',
75
+ },
66
76
  {
67
77
  name: 'Toulouse Métropole',
68
78
  url: 'https://data.toulouse-metropole.fr',
@@ -1,22 +1,24 @@
1
- import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { uMapAlert as Alert } from '../../components/alerts/alert.js'
3
2
  import { BaseAjax, SingleMixin } from '../autocomplete.js'
4
3
  import { translate } from '../i18n.js'
4
+ import * as DOMUtils from '../domutils.js'
5
5
 
6
6
  const TEMPLATE = `
7
- <h3>Overpass</h3>
8
- <label>
9
- <span data-help="overpassImporter">${translate('Expression')}</span>
10
- <input type="text" placeholder="amenity=drinking_water" name="tags" />
11
- </label>
12
- <label>
13
- ${translate('Geometry mode')}
14
- <select name="out">
15
- <option value="geom" selected>${translate('Default')}</option>
16
- <option value="center">${translate('Only geometry centers')}</option>
17
- </select>
18
- </label>
19
- <label id="area"><span>${translate('Search area')}</span></label>
7
+ <div>
8
+ <h3>Overpass</h3>
9
+ <label>
10
+ <span data-help="overpassImporter">${translate('Expression')}</span>
11
+ <input type="text" placeholder="amenity=drinking_water" name="tags" data-ref="tags" />
12
+ </label>
13
+ <label>
14
+ ${translate('Geometry mode')}
15
+ <select name="out">
16
+ <option value="geom" selected>${translate('Default')}</option>
17
+ <option value="center">${translate('Only geometry centers')}</option>
18
+ </select>
19
+ </label>
20
+ <label data-ref="area" id="area"><span>${translate('Search area')}</span></label>
21
+ </div>
20
22
  `
21
23
 
22
24
  class Autocomplete extends SingleMixin(BaseAjax) {
@@ -57,12 +59,11 @@ export class Importer {
57
59
  }
58
60
 
59
61
  async open(importer) {
60
- const container = DomUtil.create('div')
61
- container.innerHTML = TEMPLATE
62
+ const [container, { area, tags }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
62
63
  if (this.expression) {
63
- container.querySelector('[name=tags]').value = this.expression
64
+ tags.value = this.expression
64
65
  }
65
- this.autocomplete = new Autocomplete(container.querySelector('#area'), {
66
+ this.autocomplete = new Autocomplete(area, {
66
67
  url: this.searchUrl,
67
68
  placeholder: translate(
68
69
  'Type area name, or let empty to load data in current map view'
@@ -7,7 +7,7 @@ export class DataLayerManager extends Object {
7
7
  active() {
8
8
  return Object.values(this)
9
9
  .filter((datalayer) => !datalayer.isDeleted)
10
- .sort((a, b) => a.rank > b.rank)
10
+ .sort((a, b) => a.rank - b.rank)
11
11
  }
12
12
  reverse() {
13
13
  return this.active().reverse()
@@ -1,4 +1,3 @@
1
- import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { uMapAlert as Alert } from '../components/alerts/alert.js'
3
2
  import { MutatingForm } from './form/builder.js'
4
3
  import { translate } from './i18n.js'
@@ -177,8 +176,11 @@ export class MapPermissions {
177
176
  Alert.info(translate('Please save the map first'))
178
177
  return
179
178
  }
180
- const container = DomUtil.create('div', 'umap-edit-permissions')
181
- DomUtil.createTitle(container, translate('Update permissions'), 'icon-key')
179
+ const container = DOMUtils.loadTemplate(`
180
+ <div class="umap-edit-permissions">
181
+ <h3><i class="icon icon-16 icon-key"></i> ${translate('Update permissions')}</h3>
182
+ </div>
183
+ `)
182
184
  if (this.isAnonymousMap()) this._editAnonymous(container)
183
185
  else this._editWithOwner(container)
184
186
  this._editDatalayers(container)
@@ -1,4 +1,4 @@
1
- import { Control } from '../../../vendors/leaflet/leaflet-src.esm.js'
1
+ import { Control, LayerGroup } from '../../../vendors/leaflet/leaflet-src.esm.js'
2
2
  import * as Utils from '../utils.js'
3
3
  import { translate } from '../i18n.js'
4
4
 
@@ -221,7 +221,7 @@ export const SearchControl = BaseButton.extend({
221
221
  },
222
222
 
223
223
  afterAdd(container, map) {
224
- this.layer = L.layerGroup().addTo(map)
224
+ this.layer = new LayerGroup().addTo(map)
225
225
  this.photonOptions = {
226
226
  limit: 10,
227
227
  noResultLabel: translate('No results'),
@@ -237,14 +237,7 @@ const Ball = DefaultIcon.extend({
237
237
  _setIconStyles: function (img, name) {
238
238
  BaseIcon.prototype._setIconStyles.call(this, img, name)
239
239
  const color = this._getColor('color')
240
- let background
241
- if (L.Browser.ielt9) {
242
- background = color
243
- } else if (L.Browser.webkit) {
244
- background = `-webkit-gradient( radial, 6 38%, 0, 6 38%, 8, from(white), to(${color}) )`
245
- } else {
246
- background = `radial-gradient(circle at 6px 38% , white -4px, ${color} 8px) repeat scroll 0 0 transparent`
247
- }
240
+ const background = `radial-gradient(circle at 6px 38% , white -4px, ${color} 8px) repeat scroll 0 0 transparent`
248
241
  this.elements.ball.style.background = background
249
242
  this.elements.ball.style.opacity = this._getOpacity()
250
243
  },
@@ -309,5 +302,8 @@ export function setContrast(icon, parent, src, bgcolor) {
309
302
  }
310
303
 
311
304
  export function formatUrl(url, feature) {
312
- return Utils.greedyTemplate(url || '', feature ? feature.extendedProperties() : {})
305
+ if (Utils.hasVar(url)) {
306
+ return Utils.greedyTemplate(url || '', feature ? feature.extendedProperties() : {})
307
+ }
308
+ return url
313
309
  }
@@ -53,7 +53,7 @@ export const LayerMixin = {
53
53
  },
54
54
 
55
55
  onZoomEnd() {
56
- if (!this.datalayer.autoLoaded) return
56
+ if (!this.datalayer.autoVisibility) return
57
57
  if (!this.datalayer.showAtZoom() && this.datalayer.isVisible()) {
58
58
  this.datalayer.hide()
59
59
  }
@@ -1,5 +1,5 @@
1
1
  import colorbrewer from '../../../../vendors/colorbrewer/colorbrewer.js'
2
- import { DomUtil, FeatureGroup } from '../../../../vendors/leaflet/leaflet-src.esm.js'
2
+ import { FeatureGroup } from '../../../../vendors/leaflet/leaflet-src.esm.js'
3
3
  import { translate } from '../../i18n.js'
4
4
  import * as Utils from '../../utils.js'
5
5
  import * as DOMUtils from '../../domutils.js'
@@ -346,7 +346,8 @@ export const Circles = FeatureGroup.extend({
346
346
  },
347
347
 
348
348
  renderLegend: function (container) {
349
- const parent = DomUtil.create('ul', 'circles-layer-legend', container)
349
+ const parent = DOMUtils.loadTemplate('<ul class="circles-layer-legend"></ul>')
350
+ container.appendChild(parent)
350
351
  const color = this.datalayer.getProperty('color')
351
352
  const values = this.getValues()
352
353
  if (!values.length) return
@@ -360,14 +361,18 @@ export const Circles = FeatureGroup.extend({
360
361
  [this.options.maxPX, maxValue],
361
362
  ]
362
363
  for (const [size, label] of items) {
363
- const li = DomUtil.create('li', '', parent)
364
- const circleEl = DomUtil.create('span', 'circle', li)
365
- circleEl.style.backgroundColor = color
366
- circleEl.style.height = `${size * 2}px`
367
- circleEl.style.width = `${size * 2}px`
368
- circleEl.style.opacity = this.datalayer.getProperty('opacity')
369
- const labelEl = DomUtil.create('span', 'label', li)
370
- labelEl.textContent = label
364
+ parent.appendChild(
365
+ DOMUtils.loadTemplate(`
366
+ <li>
367
+ <span class="circle"
368
+ style="background-color: ${color};
369
+ height: ${size * 2}px;
370
+ width: ${size * 2}px;
371
+ opacity: ${this.datalayer.getProperty('fillOpacity')};"></span>
372
+ <span class="label">${label}</span>
373
+ </li>
374
+ `)
375
+ )
371
376
  }
372
377
  },
373
378
  })
@@ -102,6 +102,7 @@ export const Heat = L.HeatLayer.extend({
102
102
  }
103
103
  if (field === 'properties.heat.radius') {
104
104
  this.options.radius = this.datalayer.properties.heat.radius
105
+ this.redraw()
105
106
  }
106
107
  this._updateOptions()
107
108
  },
@@ -1,12 +1,14 @@
1
1
  // Goes here all code related to Leaflet, DOM and user interactions.
2
2
  import {
3
3
  Map as BaseMap,
4
+ Browser,
4
5
  Control,
5
6
  DomEvent,
6
- DomUtil,
7
7
  latLng,
8
- latLngBounds,
8
+ LatLng,
9
+ LatLngBounds,
9
10
  setOptions,
11
+ TileLayer,
10
12
  } from '../../../vendors/leaflet/leaflet-src.esm.js'
11
13
  import { uMapAlert as Alert } from '../../components/alerts/alert.js'
12
14
  import DropControl from '../drop.js'
@@ -46,7 +48,6 @@ const ControlsMixin = {
46
48
  'caption',
47
49
  'locate',
48
50
  'measure',
49
- 'editinosm',
50
51
  'print',
51
52
  'tilelayers',
52
53
  ],
@@ -91,17 +92,9 @@ const ControlsMixin = {
91
92
  this._controls.embed = new EmbedControl(this._umap)
92
93
  this._controls.print = new PrintControl(this._umap)
93
94
  this._controls.tilelayersChooser = new TileLayerChooser(this._umap)
94
- this._controls.editinosm = new Control.EditInOSM({
95
- position: 'topleft',
96
- widgetOptions: {
97
- helpText: translate(
98
- 'Open this map extent in a map editor to provide more accurate data to OpenStreetMap'
99
- ),
100
- },
101
- })
102
95
  this._controls.measure = new L.MeasureControl().initHandler(this)
103
96
  this._controls.more = new MoreControl()
104
- this._controls.scale = L.control.scale()
97
+ this._controls.scale = new Control.Scale()
105
98
  this._controls.permanentCredit = new PermanentCreditsControl(this)
106
99
  this._umap.drop = new DropControl(this._umap, this, this._container)
107
100
  this._controls.tilelayers = new U.TileLayerControl(this)
@@ -138,11 +131,10 @@ const ControlsMixin = {
138
131
  const control = this._controls[name]
139
132
  if (!control) continue
140
133
  control.addTo(this)
141
- if (status === undefined || status === null) {
142
- DomUtil.addClass(control._container, 'display-on-more')
143
- } else {
144
- DomUtil.removeClass(control._container, 'display-on-more')
145
- }
134
+ control._container.classList.toggle(
135
+ 'display-on-more',
136
+ status === undefined || status === null
137
+ )
146
138
  }
147
139
  if (this._umap.getProperty('permanentCredit'))
148
140
  this._controls.permanentCredit.addTo(this)
@@ -176,7 +168,7 @@ const ManageTilelayerMixin = {
176
168
  if (this._controls) this._controls.tilelayers.setLayers()
177
169
  },
178
170
 
179
- createTileLayer: (tilelayer) => new L.TileLayer(tilelayer.url_template, tilelayer),
171
+ createTileLayer: (tilelayer) => new TileLayer(tilelayer.url_template, tilelayer),
180
172
 
181
173
  selectTileLayer: function (tilelayer) {
182
174
  if (tilelayer === this.selectedTilelayer) {
@@ -303,7 +295,7 @@ export const LeafletMap = BaseMap.extend({
303
295
  // when scrolling the main page and touching the
304
296
  // map in an iframe. May be a bit dumb, but let's
305
297
  // try like this for now.
306
- if (L.Browser.mobile) this.dragging.disable()
298
+ if (Browser.mobile) this.dragging.disable()
307
299
  }
308
300
  // Needs tilelayer to exist for minimap
309
301
  this.renderControls()
@@ -312,7 +304,7 @@ export const LeafletMap = BaseMap.extend({
312
304
 
313
305
  latLng: (a, b, c) => {
314
306
  // manage geojson case and call original method
315
- if (!(a instanceof L.LatLng) && a.coordinates) {
307
+ if (!(a instanceof LatLng) && a.coordinates) {
316
308
  // Guess it's a geojson
317
309
  a = [a.coordinates[1], a.coordinates[0]]
318
310
  }
@@ -361,7 +353,7 @@ export const LeafletMap = BaseMap.extend({
361
353
  !Number.isNaN(north) &&
362
354
  !Number.isNaN(east)
363
355
  ) {
364
- const bounds = latLngBounds([
356
+ const bounds = new LatLngBounds([
365
357
  [south, west],
366
358
  [north, east],
367
359
  ])
@@ -381,7 +373,7 @@ export const LeafletMap = BaseMap.extend({
381
373
  setMaxBounds: function (bounds) {
382
374
  // Hack. Remove me when fix is released:
383
375
  // https://github.com/Leaflet/Leaflet/pull/4494
384
- bounds = latLngBounds(bounds)
376
+ bounds = new LatLngBounds(bounds)
385
377
 
386
378
  if (!bounds.isValid()) {
387
379
  this.options.maxBounds = null
@@ -390,6 +382,14 @@ export const LeafletMap = BaseMap.extend({
390
382
  return BaseMap.prototype.setMaxBounds.call(this, bounds)
391
383
  },
392
384
 
385
+ getLayersBounds: (layers) => {
386
+ const bounds = new LatLngBounds()
387
+ for (const layer of layers) {
388
+ bounds.extend(layer.getBounds())
389
+ }
390
+ return bounds
391
+ },
392
+
393
393
  initEditTools: function () {
394
394
  this.editTools = new U.Editable(this._umap)
395
395
  },
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Popup as BasePopup,
3
3
  DomEvent,
4
- DomUtil,
5
4
  Path,
6
5
  } from '../../../vendors/leaflet/leaflet-src.esm.js'
7
6
  import Browser from '../browser.js'
8
7
  import loadTemplate from './template.js'
8
+ import * as DOMUtils from '../domutils.js'
9
9
 
10
10
  export default function loadPopup(name) {
11
11
  switch (name) {
@@ -25,7 +25,8 @@ const Popup = BasePopup.extend({
25
25
  },
26
26
 
27
27
  loadContent: async function () {
28
- const container = DomUtil.create('div', 'umap-popup')
28
+ const container = document.createElement('div')
29
+ container.classList.add('umap-popup')
29
30
  const name = this.feature.getOption('popupTemplate')
30
31
  this.content = await loadTemplate(name, this.feature, container)
31
32
  const elements = container.querySelectorAll('img,iframe')
@@ -34,7 +35,9 @@ const Popup = BasePopup.extend({
34
35
  }
35
36
  if (!elements.length && container.textContent.replace('\n', '') === '') {
36
37
  container.innerHTML = ''
37
- DomUtil.add('h3', '', container, this.feature.getDisplayName())
38
+ container.appendChild(
39
+ DOMUtils.loadTemplate(`<h3>${this.feature.getDisplayName()}</h3>`)
40
+ )
38
41
  }
39
42
  this.setContent(container)
40
43
  },