umap-project 2.7.3__py3-none-any.whl → 2.8.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.
Files changed (292) hide show
  1. umap/__init__.py +1 -1
  2. umap/forms.py +4 -14
  3. umap/locale/am_ET/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/am_ET/LC_MESSAGES/django.po +278 -151
  5. umap/locale/ar/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/ar/LC_MESSAGES/django.po +335 -141
  7. umap/locale/bg/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/bg/LC_MESSAGES/django.po +279 -152
  9. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/br/LC_MESSAGES/django.po +95 -79
  11. umap/locale/ca/LC_MESSAGES/django.mo +0 -0
  12. umap/locale/ca/LC_MESSAGES/django.po +85 -68
  13. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  14. umap/locale/cs_CZ/LC_MESSAGES/django.po +78 -66
  15. umap/locale/da/LC_MESSAGES/django.mo +0 -0
  16. umap/locale/da/LC_MESSAGES/django.po +280 -153
  17. umap/locale/de/LC_MESSAGES/django.mo +0 -0
  18. umap/locale/de/LC_MESSAGES/django.po +80 -64
  19. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  20. umap/locale/el/LC_MESSAGES/django.po +82 -66
  21. umap/locale/en/LC_MESSAGES/django.po +73 -61
  22. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/es/LC_MESSAGES/django.po +75 -63
  24. umap/locale/et/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/et/LC_MESSAGES/django.po +280 -153
  26. umap/locale/eu/LC_MESSAGES/django.mo +0 -0
  27. umap/locale/eu/LC_MESSAGES/django.po +82 -66
  28. umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
  29. umap/locale/fa_IR/LC_MESSAGES/django.po +80 -64
  30. umap/locale/fi/LC_MESSAGES/django.mo +0 -0
  31. umap/locale/fi/LC_MESSAGES/django.po +278 -151
  32. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  33. umap/locale/fr/LC_MESSAGES/django.po +75 -63
  34. umap/locale/gl/LC_MESSAGES/django.mo +0 -0
  35. umap/locale/gl/LC_MESSAGES/django.po +280 -153
  36. umap/locale/he/LC_MESSAGES/django.mo +0 -0
  37. umap/locale/he/LC_MESSAGES/django.po +281 -154
  38. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  39. umap/locale/hu/LC_MESSAGES/django.po +80 -64
  40. umap/locale/is/LC_MESSAGES/django.mo +0 -0
  41. umap/locale/is/LC_MESSAGES/django.po +280 -153
  42. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  43. umap/locale/it/LC_MESSAGES/django.po +82 -66
  44. umap/locale/ja/LC_MESSAGES/django.mo +0 -0
  45. umap/locale/ja/LC_MESSAGES/django.po +280 -153
  46. umap/locale/ko/LC_MESSAGES/django.mo +0 -0
  47. umap/locale/ko/LC_MESSAGES/django.po +280 -153
  48. umap/locale/lt/LC_MESSAGES/django.mo +0 -0
  49. umap/locale/lt/LC_MESSAGES/django.po +280 -153
  50. umap/locale/ms/LC_MESSAGES/django.mo +0 -0
  51. umap/locale/ms/LC_MESSAGES/django.po +82 -66
  52. umap/locale/nl/LC_MESSAGES/django.mo +0 -0
  53. umap/locale/nl/LC_MESSAGES/django.po +280 -153
  54. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  55. umap/locale/pl/LC_MESSAGES/django.po +82 -66
  56. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  57. umap/locale/pt/LC_MESSAGES/django.po +75 -63
  58. umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  59. umap/locale/pt_BR/LC_MESSAGES/django.po +280 -153
  60. umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  61. umap/locale/pt_PT/LC_MESSAGES/django.po +280 -153
  62. umap/locale/ru/LC_MESSAGES/django.mo +0 -0
  63. umap/locale/ru/LC_MESSAGES/django.po +280 -153
  64. umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  65. umap/locale/sk_SK/LC_MESSAGES/django.po +280 -153
  66. umap/locale/sl/LC_MESSAGES/django.mo +0 -0
  67. umap/locale/sl/LC_MESSAGES/django.po +280 -153
  68. umap/locale/sr/LC_MESSAGES/django.mo +0 -0
  69. umap/locale/sr/LC_MESSAGES/django.po +280 -153
  70. umap/locale/sv/LC_MESSAGES/django.mo +0 -0
  71. umap/locale/sv/LC_MESSAGES/django.po +81 -65
  72. umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
  73. umap/locale/th_TH/LC_MESSAGES/django.po +257 -185
  74. umap/locale/tr/LC_MESSAGES/django.mo +0 -0
  75. umap/locale/tr/LC_MESSAGES/django.po +280 -153
  76. umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
  77. umap/locale/uk_UA/LC_MESSAGES/django.po +280 -153
  78. umap/locale/vi/LC_MESSAGES/django.mo +0 -0
  79. umap/locale/vi/LC_MESSAGES/django.po +278 -151
  80. umap/locale/zh/LC_MESSAGES/django.mo +0 -0
  81. umap/locale/zh/LC_MESSAGES/django.po +278 -151
  82. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  83. umap/locale/zh_TW/LC_MESSAGES/django.po +97 -81
  84. umap/management/commands/empty_trash.py +35 -0
  85. umap/management/commands/migrate_to_S3.py +29 -0
  86. umap/migrations/0023_alter_datalayer_uuid.py +19 -0
  87. umap/migrations/0024_alter_map_share_status.py +30 -0
  88. umap/migrations/0025_alter_datalayer_geojson.py +24 -0
  89. umap/models.py +68 -116
  90. umap/settings/base.py +23 -3
  91. umap/settings/local_s3.py +45 -0
  92. umap/static/umap/base.css +3 -603
  93. umap/static/umap/content.css +5 -3
  94. umap/static/umap/css/bar.css +202 -0
  95. umap/static/umap/css/form.css +620 -0
  96. umap/static/umap/css/icon.css +21 -1
  97. umap/static/umap/css/popup.css +125 -0
  98. umap/static/umap/img/16-white.svg +16 -4
  99. umap/static/umap/img/16.svg +1 -1
  100. umap/static/umap/img/source/16-white.svg +46 -45
  101. umap/static/umap/img/source/16.svg +1 -753
  102. umap/static/umap/js/components/fragment.js +3 -1
  103. umap/static/umap/js/modules/browser.js +20 -19
  104. umap/static/umap/js/modules/caption.js +21 -22
  105. umap/static/umap/js/modules/data/features.js +120 -78
  106. umap/static/umap/js/modules/data/layer.js +195 -153
  107. umap/static/umap/js/modules/facets.js +9 -9
  108. umap/static/umap/js/modules/formatter.js +5 -5
  109. umap/static/umap/js/modules/global.js +4 -52
  110. umap/static/umap/js/modules/help.js +18 -21
  111. umap/static/umap/js/modules/importer.js +133 -56
  112. umap/static/umap/js/modules/importers/cadastrefr.js +4 -0
  113. umap/static/umap/js/modules/importers/geodatamine.js +3 -3
  114. umap/static/umap/js/modules/importers/overpass.js +5 -0
  115. umap/static/umap/js/modules/permissions.js +85 -87
  116. umap/static/umap/js/modules/rendering/icon.js +2 -1
  117. umap/static/umap/js/modules/rendering/layers/base.js +15 -15
  118. umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
  119. umap/static/umap/js/modules/rendering/layers/cluster.js +1 -1
  120. umap/static/umap/js/modules/rendering/layers/heat.js +1 -1
  121. umap/static/umap/js/modules/rendering/map.js +390 -0
  122. umap/static/umap/js/modules/rendering/popup.js +19 -19
  123. umap/static/umap/js/modules/rendering/template.js +88 -21
  124. umap/static/umap/js/modules/rendering/ui.js +63 -14
  125. umap/static/umap/js/modules/request.js +2 -2
  126. umap/static/umap/js/modules/rules.js +22 -25
  127. umap/static/umap/js/modules/saving.js +47 -0
  128. umap/static/umap/js/modules/schema.js +6 -0
  129. umap/static/umap/js/modules/share.js +21 -24
  130. umap/static/umap/js/modules/slideshow.js +24 -20
  131. umap/static/umap/js/modules/sync/updaters.js +7 -9
  132. umap/static/umap/js/modules/tableeditor.js +20 -19
  133. umap/static/umap/js/modules/ui/bar.js +196 -0
  134. umap/static/umap/js/modules/ui/dialog.js +5 -0
  135. umap/static/umap/js/modules/ui/panel.js +10 -9
  136. umap/static/umap/js/modules/umap.js +1691 -0
  137. umap/static/umap/js/modules/urls.js +2 -2
  138. umap/static/umap/js/modules/utils.js +22 -6
  139. umap/static/umap/js/umap.controls.js +81 -305
  140. umap/static/umap/js/umap.core.js +29 -50
  141. umap/static/umap/js/umap.forms.js +78 -27
  142. umap/static/umap/keycloak.png +0 -0
  143. umap/static/umap/locale/am_ET.js +26 -10
  144. umap/static/umap/locale/am_ET.json +26 -10
  145. umap/static/umap/locale/ar.js +26 -10
  146. umap/static/umap/locale/ar.json +26 -10
  147. umap/static/umap/locale/ast.js +26 -10
  148. umap/static/umap/locale/ast.json +26 -10
  149. umap/static/umap/locale/bg.js +26 -10
  150. umap/static/umap/locale/bg.json +26 -10
  151. umap/static/umap/locale/br.js +27 -20
  152. umap/static/umap/locale/br.json +27 -20
  153. umap/static/umap/locale/ca.js +32 -29
  154. umap/static/umap/locale/ca.json +32 -29
  155. umap/static/umap/locale/cs_CZ.js +24 -17
  156. umap/static/umap/locale/cs_CZ.json +24 -17
  157. umap/static/umap/locale/da.js +26 -10
  158. umap/static/umap/locale/da.json +26 -10
  159. umap/static/umap/locale/de.js +21 -14
  160. umap/static/umap/locale/de.json +21 -14
  161. umap/static/umap/locale/el.js +28 -12
  162. umap/static/umap/locale/el.json +28 -12
  163. umap/static/umap/locale/en.js +14 -9
  164. umap/static/umap/locale/en.json +14 -9
  165. umap/static/umap/locale/en_US.json +26 -10
  166. umap/static/umap/locale/es.js +16 -13
  167. umap/static/umap/locale/es.json +16 -13
  168. umap/static/umap/locale/et.js +26 -10
  169. umap/static/umap/locale/et.json +26 -10
  170. umap/static/umap/locale/eu.js +16 -9
  171. umap/static/umap/locale/eu.json +16 -9
  172. umap/static/umap/locale/fa_IR.js +16 -9
  173. umap/static/umap/locale/fa_IR.json +16 -9
  174. umap/static/umap/locale/fi.js +26 -10
  175. umap/static/umap/locale/fi.json +26 -10
  176. umap/static/umap/locale/fr.js +14 -9
  177. umap/static/umap/locale/fr.json +14 -9
  178. umap/static/umap/locale/gl.js +26 -10
  179. umap/static/umap/locale/gl.json +26 -10
  180. umap/static/umap/locale/he.js +26 -10
  181. umap/static/umap/locale/he.json +26 -10
  182. umap/static/umap/locale/hr.js +26 -10
  183. umap/static/umap/locale/hr.json +26 -10
  184. umap/static/umap/locale/hu.js +16 -9
  185. umap/static/umap/locale/hu.json +16 -9
  186. umap/static/umap/locale/id.js +26 -10
  187. umap/static/umap/locale/id.json +26 -10
  188. umap/static/umap/locale/is.js +26 -10
  189. umap/static/umap/locale/is.json +26 -10
  190. umap/static/umap/locale/it.js +26 -10
  191. umap/static/umap/locale/it.json +26 -10
  192. umap/static/umap/locale/ja.js +26 -10
  193. umap/static/umap/locale/ja.json +26 -10
  194. umap/static/umap/locale/ko.js +26 -10
  195. umap/static/umap/locale/ko.json +26 -10
  196. umap/static/umap/locale/lt.js +26 -10
  197. umap/static/umap/locale/lt.json +26 -10
  198. umap/static/umap/locale/ms.js +28 -12
  199. umap/static/umap/locale/ms.json +28 -12
  200. umap/static/umap/locale/nl.js +28 -12
  201. umap/static/umap/locale/nl.json +28 -12
  202. umap/static/umap/locale/no.js +26 -10
  203. umap/static/umap/locale/no.json +26 -10
  204. umap/static/umap/locale/pl.js +28 -12
  205. umap/static/umap/locale/pl.json +28 -12
  206. umap/static/umap/locale/pl_PL.json +26 -10
  207. umap/static/umap/locale/pt.js +16 -9
  208. umap/static/umap/locale/pt.json +16 -9
  209. umap/static/umap/locale/pt_BR.js +26 -10
  210. umap/static/umap/locale/pt_BR.json +26 -10
  211. umap/static/umap/locale/pt_PT.js +16 -9
  212. umap/static/umap/locale/pt_PT.json +16 -9
  213. umap/static/umap/locale/ro.js +26 -10
  214. umap/static/umap/locale/ro.json +26 -10
  215. umap/static/umap/locale/ru.js +26 -10
  216. umap/static/umap/locale/ru.json +26 -10
  217. umap/static/umap/locale/si.js +7 -7
  218. umap/static/umap/locale/si.json +7 -7
  219. umap/static/umap/locale/sk_SK.js +26 -10
  220. umap/static/umap/locale/sk_SK.json +26 -10
  221. umap/static/umap/locale/sl.js +26 -10
  222. umap/static/umap/locale/sl.json +26 -10
  223. umap/static/umap/locale/sr.js +26 -10
  224. umap/static/umap/locale/sr.json +26 -10
  225. umap/static/umap/locale/sv.js +27 -11
  226. umap/static/umap/locale/sv.json +27 -11
  227. umap/static/umap/locale/th_TH.js +28 -12
  228. umap/static/umap/locale/th_TH.json +28 -12
  229. umap/static/umap/locale/tr.js +26 -10
  230. umap/static/umap/locale/tr.json +26 -10
  231. umap/static/umap/locale/uk_UA.js +26 -10
  232. umap/static/umap/locale/uk_UA.json +26 -10
  233. umap/static/umap/locale/vi.js +26 -10
  234. umap/static/umap/locale/vi.json +26 -10
  235. umap/static/umap/locale/vi_VN.json +26 -10
  236. umap/static/umap/locale/zh.js +26 -10
  237. umap/static/umap/locale/zh.json +26 -10
  238. umap/static/umap/locale/zh_CN.json +26 -10
  239. umap/static/umap/locale/zh_TW.Big5.json +26 -10
  240. umap/static/umap/locale/zh_TW.js +34 -27
  241. umap/static/umap/locale/zh_TW.json +34 -27
  242. umap/static/umap/map.css +39 -530
  243. umap/static/umap/unittests/URLs.js +15 -15
  244. umap/static/umap/unittests/utils.js +23 -1
  245. umap/static/umap/vars.css +2 -1
  246. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
  247. umap/storage/__init__.py +3 -0
  248. umap/storage/fs.py +101 -0
  249. umap/storage/s3.py +61 -0
  250. umap/templates/base.html +2 -0
  251. umap/templates/registration/login.html +7 -6
  252. umap/templates/umap/components/alerts/alert.html +4 -0
  253. umap/templates/umap/css.html +6 -0
  254. umap/templates/umap/js.html +3 -2
  255. umap/templates/umap/map_init.html +6 -5
  256. umap/templates/umap/user_dashboard.html +20 -19
  257. umap/tests/base.py +5 -1
  258. umap/tests/fixtures/test_upload_simple_marker.json +19 -0
  259. umap/tests/integration/conftest.py +2 -1
  260. umap/tests/integration/test_anonymous_owned_map.py +18 -10
  261. umap/tests/integration/test_browser.py +16 -1
  262. umap/tests/integration/test_dashboard.py +1 -1
  263. umap/tests/integration/test_edit_datalayer.py +29 -7
  264. umap/tests/integration/test_import.py +28 -6
  265. umap/tests/integration/test_optimistic_merge.py +31 -8
  266. umap/tests/integration/test_owned_map.py +22 -16
  267. umap/tests/integration/test_popup.py +44 -0
  268. umap/tests/integration/test_save.py +35 -0
  269. umap/tests/integration/test_view_marker.py +12 -0
  270. umap/tests/integration/test_view_polyline.py +257 -0
  271. umap/tests/integration/test_websocket_sync.py +81 -9
  272. umap/tests/test_dashboard.py +82 -0
  273. umap/tests/test_datalayer.py +6 -7
  274. umap/tests/test_datalayer_s3.py +135 -0
  275. umap/tests/test_datalayer_views.py +28 -10
  276. umap/tests/test_empty_trash.py +34 -0
  277. umap/tests/test_map.py +12 -3
  278. umap/tests/test_map_views.py +69 -37
  279. umap/tests/test_statics.py +1 -1
  280. umap/tests/test_team_views.py +35 -1
  281. umap/tests/test_views.py +31 -52
  282. umap/urls.py +3 -3
  283. umap/views.py +126 -90
  284. {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/METADATA +16 -13
  285. {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/RECORD +289 -269
  286. umap/management/commands/purge_purgatory.py +0 -28
  287. umap/static/umap/js/umap.js +0 -1903
  288. umap/tests/test_purge_purgatory.py +0 -25
  289. /umap/{storage.py → storage/staticfiles.py} +0 -0
  290. {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/WHEEL +0 -0
  291. {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/entry_points.txt +0 -0
  292. {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,7 +2,7 @@ U.BaseAction = L.ToolbarAction.extend({
2
2
  initialize: function (map) {
3
3
  this.map = map
4
4
  if (this.options.label) {
5
- this.options.tooltip = this.map.help.displayLabel(
5
+ this.options.tooltip = this.map._umap.help.displayLabel(
6
6
  this.options.label,
7
7
  (withKbdTag = false)
8
8
  )
@@ -12,8 +12,8 @@ U.BaseAction = L.ToolbarAction.extend({
12
12
  tooltip: this.options.tooltip,
13
13
  }
14
14
  L.ToolbarAction.prototype.initialize.call(this)
15
- if (this.options.helpMenu && !this.map.helpMenuActions[this.options.className])
16
- this.map.helpMenuActions[this.options.className] = this
15
+ if (this.options.helpMenu && !U.Help.MENU_ACTIONS[this.options.className])
16
+ U.Help.MENU_ACTIONS[this.options.className] = this
17
17
  },
18
18
  })
19
19
 
@@ -25,7 +25,7 @@ U.ImportAction = U.BaseAction.extend({
25
25
  },
26
26
 
27
27
  addHooks: function () {
28
- this.map.importer.open()
28
+ this.map._umap.importer.open()
29
29
  },
30
30
  })
31
31
 
@@ -37,7 +37,7 @@ U.EditLayersAction = U.BaseAction.extend({
37
37
  },
38
38
 
39
39
  addHooks: function () {
40
- this.map.editDatalayers()
40
+ this.map._umap.editDatalayers()
41
41
  },
42
42
  })
43
43
 
@@ -49,7 +49,7 @@ U.EditCaptionAction = U.BaseAction.extend({
49
49
  },
50
50
 
51
51
  addHooks: function () {
52
- this.map.editCaption()
52
+ this.map._umap.editCaption()
53
53
  },
54
54
  })
55
55
 
@@ -61,7 +61,7 @@ U.EditPropertiesAction = U.BaseAction.extend({
61
61
  },
62
62
 
63
63
  addHooks: function () {
64
- this.map.edit()
64
+ this.map._umap.edit()
65
65
  },
66
66
  })
67
67
 
@@ -84,7 +84,7 @@ U.UpdateExtentAction = U.BaseAction.extend({
84
84
  },
85
85
 
86
86
  addHooks: function () {
87
- this.map.setCenterAndZoom()
87
+ this.map._umap.setCenterAndZoom()
88
88
  },
89
89
  })
90
90
 
@@ -95,7 +95,7 @@ U.UpdatePermsAction = U.BaseAction.extend({
95
95
  },
96
96
 
97
97
  addHooks: function () {
98
- this.map.permissions.edit()
98
+ this.map._umap.permissions.edit()
99
99
  },
100
100
  })
101
101
 
@@ -107,7 +107,7 @@ U.DrawMarkerAction = U.BaseAction.extend({
107
107
  },
108
108
 
109
109
  addHooks: function () {
110
- this.map.startMarker()
110
+ this.map.editTools.startMarker()
111
111
  },
112
112
  })
113
113
 
@@ -119,7 +119,7 @@ U.DrawPolylineAction = U.BaseAction.extend({
119
119
  },
120
120
 
121
121
  addHooks: function () {
122
- this.map.startPolyline()
122
+ this.map.editTools.startPolyline()
123
123
  },
124
124
  })
125
125
 
@@ -131,7 +131,7 @@ U.DrawPolygonAction = U.BaseAction.extend({
131
131
  },
132
132
 
133
133
  addHooks: function () {
134
- this.map.startPolygon()
134
+ this.map.editTools.startPolygon()
135
135
  },
136
136
  })
137
137
 
@@ -142,7 +142,8 @@ U.AddPolylineShapeAction = U.BaseAction.extend({
142
142
  },
143
143
 
144
144
  addHooks: function () {
145
- this.map.editedFeature.ui.editor.newShape()
145
+ // FIXME: smells bad
146
+ this.map._umap.editedFeature.ui.editor.newShape()
146
147
  },
147
148
  })
148
149
 
@@ -305,18 +306,24 @@ U.DrawToolbar = L.Toolbar.Control.extend({
305
306
 
306
307
  appendToContainer: function (container) {
307
308
  this.options.actions = []
308
- if (this.map.options.enableMarkerDraw) {
309
+ if (this.map._umap.properties.enableMarkerDraw) {
309
310
  this.options.actions.push(U.DrawMarkerAction)
310
311
  }
311
- if (this.map.options.enablePolylineDraw) {
312
+ if (this.map._umap.properties.enablePolylineDraw) {
312
313
  this.options.actions.push(U.DrawPolylineAction)
313
- if (this.map.editedFeature && this.map.editedFeature instanceof U.LineString) {
314
+ if (
315
+ this.map._umap.editedFeature &&
316
+ this.map._umap.editedFeature instanceof U.LineString
317
+ ) {
314
318
  this.options.actions.push(U.AddPolylineShapeAction)
315
319
  }
316
320
  }
317
- if (this.map.options.enablePolygonDraw) {
321
+ if (this.map._umap.properties.enablePolygonDraw) {
318
322
  this.options.actions.push(U.DrawPolygonAction)
319
- if (this.map.editedFeature && this.map.editedFeature instanceof U.Polygon) {
323
+ if (
324
+ this.map._umap.editedFeature &&
325
+ this.map._umap.editedFeature instanceof U.Polygon
326
+ ) {
320
327
  this.options.actions.push(U.AddPolygonShapeAction)
321
328
  }
322
329
  }
@@ -350,24 +357,24 @@ U.DropControl = L.Class.extend({
350
357
  L.DomEvent.off(this.dropzone, 'dragleave', this.dragleave, this)
351
358
  },
352
359
 
353
- dragenter: function (e) {
354
- L.DomEvent.stop(e)
360
+ dragenter: function (event) {
361
+ L.DomEvent.stop(event)
355
362
  this.map.scrollWheelZoom.disable()
356
363
  this.dropzone.classList.add('umap-dragover')
357
364
  },
358
365
 
359
- dragover: (e) => {
360
- L.DomEvent.stop(e)
366
+ dragover: (event) => {
367
+ L.DomEvent.stop(event)
361
368
  },
362
369
 
363
- drop: function (e) {
370
+ drop: function (event) {
364
371
  this.map.scrollWheelZoom.enable()
365
372
  this.dropzone.classList.remove('umap-dragover')
366
- L.DomEvent.stop(e)
367
- for (let i = 0, file; (file = e.dataTransfer.files[i]); i++) {
368
- this.map.processFileToImport(file)
373
+ L.DomEvent.stop(event)
374
+ for (const file of event.dataTransfer.files) {
375
+ this.map._umap.processFileToImport(file)
369
376
  }
370
- this.map.onceDataLoaded(this.map.fitDataBounds)
377
+ this.map._umap.onceDataLoaded(this.map._umap.fitDataBounds)
371
378
  },
372
379
 
373
380
  dragleave: function () {
@@ -382,20 +389,20 @@ U.EditControl = L.Control.extend({
382
389
  },
383
390
 
384
391
  onAdd: function (map) {
385
- const container = L.DomUtil.create('div', 'leaflet-control-edit-enable')
392
+ const container = L.DomUtil.create('div', 'edit-enable')
386
393
  const enableEditing = L.DomUtil.createButton(
387
394
  '',
388
395
  container,
389
396
  L._('Edit'),
390
- map.enableEdit,
391
- map
397
+ map._umap.enableEdit,
398
+ map._umap
392
399
  )
393
400
  L.DomEvent.on(
394
401
  enableEditing,
395
402
  'mouseover',
396
403
  () => {
397
- map.tooltip.open({
398
- content: map.help.displayLabel('TOGGLE_EDIT'),
404
+ map._umap.tooltip.open({
405
+ content: map._umap.help.displayLabel('TOGGLE_EDIT'),
399
406
  anchor: enableEditing,
400
407
  position: 'bottom',
401
408
  delay: 750,
@@ -476,8 +483,8 @@ U.PermanentCreditsControl = L.Control.extend({
476
483
  })
477
484
 
478
485
  L.Control.Button = L.Control.extend({
479
- initialize: function (map, options) {
480
- this.map = map
486
+ initialize: function (umap, options) {
487
+ this._umap = umap
481
488
  L.Control.prototype.initialize.call(this, options)
482
489
  },
483
490
 
@@ -510,11 +517,11 @@ U.DataLayersControl = L.Control.Button.extend({
510
517
  },
511
518
 
512
519
  afterAdd: function (container) {
513
- U.Utils.toggleBadge(container, this.map.browser.hasFilters())
520
+ U.Utils.toggleBadge(container, this._umap.browser?.hasFilters())
514
521
  },
515
522
 
516
523
  onClick: function () {
517
- this.map.openBrowser()
524
+ this._umap.openBrowser()
518
525
  },
519
526
  })
520
527
 
@@ -526,7 +533,7 @@ U.CaptionControl = L.Control.Button.extend({
526
533
  },
527
534
 
528
535
  onClick: function () {
529
- this.map.openCaption()
536
+ this._umap.openCaption()
530
537
  },
531
538
  })
532
539
 
@@ -537,12 +544,12 @@ U.StarControl = L.Control.Button.extend({
537
544
  },
538
545
 
539
546
  getClassName: function () {
540
- const status = this.map.options.starred ? ' starred' : ''
547
+ const status = this._umap.properties.starred ? ' starred' : ''
541
548
  return `leaflet-control-star umap-control${status}`
542
549
  },
543
550
 
544
551
  onClick: function () {
545
- this.map.star()
552
+ this._umap.star()
546
553
  },
547
554
  })
548
555
 
@@ -554,248 +561,10 @@ L.Control.Embed = L.Control.Button.extend({
554
561
  },
555
562
 
556
563
  onClick: function () {
557
- this.map.share.open()
564
+ this._umap.share.open()
558
565
  },
559
566
  })
560
567
 
561
- const ControlsMixin = {
562
- HIDDABLE_CONTROLS: [
563
- 'zoom',
564
- 'search',
565
- 'fullscreen',
566
- 'embed',
567
- 'datalayers',
568
- 'caption',
569
- 'locate',
570
- 'measure',
571
- 'editinosm',
572
- 'star',
573
- 'tilelayers',
574
- ],
575
-
576
- renderEditToolbar: function () {
577
- const className = 'umap-main-edit-toolbox'
578
- const container =
579
- document.querySelector(`.${className}`) ||
580
- L.DomUtil.create(
581
- 'div',
582
- `${className} with-transition dark`,
583
- this._controlContainer
584
- )
585
- container.innerHTML = ''
586
- const leftContainer = L.DomUtil.create('div', 'umap-left-edit-toolbox', container)
587
- const rightContainer = L.DomUtil.create('div', 'umap-right-edit-toolbox', container)
588
- const logo = L.DomUtil.create('div', 'logo', leftContainer)
589
- L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage'))
590
- const nameButton = L.DomUtil.createButton('map-name', leftContainer, '')
591
- L.DomEvent.on(
592
- nameButton,
593
- 'mouseover',
594
- function () {
595
- this.tooltip.open({
596
- content: L._('Edit the title of the map'),
597
- anchor: nameButton,
598
- position: 'bottom',
599
- delay: 500,
600
- duration: 5000,
601
- })
602
- },
603
- this
604
- )
605
- const shareStatusButton = L.DomUtil.createButton(
606
- 'share-status',
607
- leftContainer,
608
- '',
609
- this.permissions.edit,
610
- this.permissions
611
- )
612
- L.DomEvent.on(
613
- shareStatusButton,
614
- 'mouseover',
615
- function () {
616
- this.tooltip.open({
617
- content: L._('Update who can see and edit the map'),
618
- anchor: shareStatusButton,
619
- position: 'bottom',
620
- delay: 500,
621
- duration: 5000,
622
- })
623
- },
624
- this
625
- )
626
- if (this.options.editMode === 'advanced') {
627
- L.DomEvent.on(nameButton, 'click', this.editCaption, this)
628
- L.DomEvent.on(shareStatusButton, 'click', this.permissions.edit, this.permissions)
629
- }
630
- if (this.options.user?.id) {
631
- const button = U.Utils.loadTemplate(`
632
- <button class="umap-user flat" type="button">
633
- <i class="icon icon-16 icon-profile"></i>
634
- <span>${this.options.user.name}</span>
635
- </button>
636
- `)
637
- rightContainer.appendChild(button)
638
- const menu = new U.ContextMenu({ className: 'dark', fixed: true })
639
- const actions = [
640
- {
641
- label: L._('New map'),
642
- action: this.urls.get('map_new'),
643
- },
644
- {
645
- label: L._('My maps'),
646
- action: this.urls.get('user_dashboard'),
647
- },
648
- {
649
- label: L._('My teams'),
650
- action: this.urls.get('user_teams'),
651
- },
652
- ]
653
- if (this.urls.has('user_profile')) {
654
- actions.push({
655
- label: L._('My profile'),
656
- action: this.urls.get('user_profile'),
657
- })
658
- }
659
- button.addEventListener('click', () => {
660
- menu.openBelow(button, actions)
661
- })
662
- }
663
-
664
- const connectedPeers = this.sync.getNumberOfConnectedPeers()
665
- if (connectedPeers !== 0) {
666
- const connectedPeersCount = L.DomUtil.createButton(
667
- 'leaflet-control-connected-peers',
668
- rightContainer,
669
- ''
670
- )
671
- L.DomEvent.on(connectedPeersCount, 'mouseover', () => {
672
- this.tooltip.open({
673
- content: L._('{connectedPeers} peer(s) currently connected to this map', {
674
- connectedPeers: connectedPeers,
675
- }),
676
- anchor: connectedPeersCount,
677
- position: 'bottom',
678
- delay: 500,
679
- duration: 5000,
680
- })
681
- })
682
-
683
- const updateConnectedPeersCount = () => {
684
- connectedPeersCount.innerHTML =
685
- '<span>' + this.sync.getNumberOfConnectedPeers() + '</span>'
686
- }
687
- updateConnectedPeersCount()
688
- }
689
-
690
- this.help.getStartedLink(rightContainer)
691
- const controlEditCancel = L.DomUtil.createButton(
692
- 'leaflet-control-edit-cancel',
693
- rightContainer,
694
- L.DomUtil.add('span', '', null, L._('Cancel edits')),
695
- this.askForReset,
696
- this
697
- )
698
- L.DomEvent.on(
699
- controlEditCancel,
700
- 'mouseover',
701
- function () {
702
- this.tooltip.open({
703
- content: this.help.displayLabel('CANCEL'),
704
- anchor: controlEditCancel,
705
- position: 'bottom',
706
- delay: 500,
707
- duration: 5000,
708
- })
709
- },
710
- this
711
- )
712
- const controlEditDisable = L.DomUtil.createButton(
713
- 'leaflet-control-edit-disable',
714
- rightContainer,
715
- L.DomUtil.add('span', '', null, L._('View')),
716
- this.disableEdit,
717
- this
718
- )
719
- L.DomEvent.on(
720
- controlEditDisable,
721
- 'mouseover',
722
- function () {
723
- this.tooltip.open({
724
- content: this.help.displayLabel('PREVIEW'),
725
- anchor: controlEditDisable,
726
- position: 'bottom',
727
- delay: 500,
728
- duration: 5000,
729
- })
730
- },
731
- this
732
- )
733
- const controlEditSave = L.DomUtil.createButton(
734
- 'leaflet-control-edit-save button',
735
- rightContainer,
736
- L.DomUtil.add('span', '', null, L._('Save')),
737
- this.save,
738
- this
739
- )
740
- L.DomEvent.on(
741
- controlEditSave,
742
- 'mouseover',
743
- function () {
744
- this.tooltip.open({
745
- content: this.help.displayLabel('SAVE'),
746
- anchor: controlEditSave,
747
- position: 'bottom',
748
- delay: 500,
749
- duration: 5000,
750
- })
751
- },
752
- this
753
- )
754
- },
755
-
756
- editDatalayers: function () {
757
- if (!this.editEnabled) return
758
- const container = L.DomUtil.create('div')
759
- L.DomUtil.createTitle(container, L._('Manage layers'), 'icon-layers')
760
- const ul = L.DomUtil.create('ul', '', container)
761
- this.eachDataLayerReverse((datalayer) => {
762
- const row = L.DomUtil.create('li', 'orderable', ul)
763
- L.DomUtil.createIcon(row, 'icon-drag', L._('Drag to reorder'))
764
- datalayer.renderToolbox(row)
765
- const title = L.DomUtil.add('span', '', row, datalayer.options.name)
766
- row.classList.toggle('off', !datalayer.isVisible())
767
- title.textContent = datalayer.options.name
768
- row.dataset.id = L.stamp(datalayer)
769
- })
770
- const onReorder = (src, dst, initialIndex, finalIndex) => {
771
- const layer = this.datalayers[src.dataset.id]
772
- const other = this.datalayers[dst.dataset.id]
773
- const minIndex = Math.min(layer.getRank(), other.getRank())
774
- const maxIndex = Math.max(layer.getRank(), other.getRank())
775
- if (finalIndex === 0) layer.bringToTop()
776
- else if (finalIndex > initialIndex) layer.insertBefore(other)
777
- else layer.insertAfter(other)
778
- this.eachDataLayerReverse((datalayer) => {
779
- if (datalayer.getRank() >= minIndex && datalayer.getRank() <= maxIndex)
780
- datalayer.isDirty = true
781
- })
782
- this.indexDatalayers()
783
- }
784
- const orderable = new U.Orderable(ul, onReorder)
785
-
786
- const bar = L.DomUtil.create('div', 'button-bar', container)
787
- L.DomUtil.createButton(
788
- 'show-on-edit block add-datalayer button',
789
- bar,
790
- L._('Add a layer'),
791
- this.newDataLayer,
792
- this
793
- )
794
-
795
- this.editPanel.open({ content: container })
796
- },
797
- }
798
-
799
568
  /* Used in view mode to define the current tilelayer */
800
569
  U.TileLayerControl = L.Control.IconLayers.extend({
801
570
  initialize: function (map, options) {
@@ -819,7 +588,7 @@ U.TileLayerControl = L.Control.IconLayers.extend({
819
588
  // Fixme when https://github.com/Leaflet/Leaflet/pull/9201 is released
820
589
  const icon = U.Utils.template(
821
590
  layer.options.url_template,
822
- this.map.demoTileInfos
591
+ this.map.options.demoTileInfos
823
592
  )
824
593
  layers.push({
825
594
  title: layer.options.name,
@@ -885,7 +654,7 @@ U.TileLayerChooser = L.Control.extend({
885
654
  L.DomUtil.createTitle(container, L._('Change tilelayers'), 'icon-tilelayer')
886
655
  this._tilelayers_container = L.DomUtil.create('ul', '', container)
887
656
  this.buildList(options)
888
- const panel = options.edit ? this.map.editPanel : this.map.panel
657
+ const panel = options.edit ? this.map._umap.editPanel : this.map._umap.panel
889
658
  panel.open({ content: container })
890
659
  },
891
660
 
@@ -905,16 +674,22 @@ U.TileLayerChooser = L.Control.extend({
905
674
  const el = L.DomUtil.create('li', selectedClass, this._tilelayers_container)
906
675
  const img = L.DomUtil.create('img', '', el)
907
676
  const name = L.DomUtil.create('div', '', el)
908
- img.src = U.Utils.template(tilelayer.options.url_template, this.map.demoTileInfos)
677
+ img.src = U.Utils.template(
678
+ tilelayer.options.url_template,
679
+ this.map.options.demoTileInfos
680
+ )
909
681
  img.loading = 'lazy'
910
682
  name.textContent = tilelayer.options.name
911
683
  L.DomEvent.on(
912
684
  el,
913
685
  'click',
914
- function () {
686
+ () => {
915
687
  this.map.selectTileLayer(tilelayer)
916
688
  this.map._controls.tilelayers.setLayers()
917
- if (options?.callback) options.callback(tilelayer)
689
+ if (options?.edit) {
690
+ this.map._umap.properties.tilelayer = tilelayer.toJSON()
691
+ this.map._umap.isDirty = true
692
+ }
918
693
  },
919
694
  this
920
695
  )
@@ -935,8 +710,8 @@ U.AttributionControl = L.Control.Attribution.extend({
935
710
  this._container.innerHTML = ''
936
711
  const container = L.DomUtil.create('div', 'attribution-container', this._container)
937
712
  container.innerHTML = credits
938
- const shortCredit = this._map.getOption('shortCredit')
939
- const captionMenus = this._map.getOption('captionMenus')
713
+ const shortCredit = this._map._umap.getProperty('shortCredit')
714
+ const captionMenus = this._map._umap.getProperty('captionMenus')
940
715
  if (shortCredit) {
941
716
  L.DomUtil.element({
942
717
  tagName: 'span',
@@ -947,7 +722,7 @@ U.AttributionControl = L.Control.Attribution.extend({
947
722
  if (captionMenus) {
948
723
  const link = L.DomUtil.add('a', '', container, ` — ${L._('Open caption')}`)
949
724
  L.DomEvent.on(link, 'click', L.DomEvent.stop)
950
- .on(link, 'click', this._map.openCaption, this._map)
725
+ .on(link, 'click', () => this._map._umap.openCaption())
951
726
  .on(link, 'dblclick', L.DomEvent.stop)
952
727
  }
953
728
  if (window.top === window.self && captionMenus) {
@@ -1139,7 +914,7 @@ U.SearchControl = L.Control.extend({
1139
914
  this.map.fire('dataload', { id: id })
1140
915
  })
1141
916
  this.search.resultsContainer = resultsContainer
1142
- this.map.panel.open({ content: container }).then(input.focus())
917
+ this.map._umap.panel.open({ content: container }).then(input.focus())
1143
918
  },
1144
919
  })
1145
920
 
@@ -1170,17 +945,18 @@ L.Control.Loading.include({
1170
945
  },
1171
946
 
1172
947
  _showIndicator: function () {
1173
- L.DomUtil.addClass(this._map._container, 'umap-loading')
948
+ this._map._container.classList.add('umap-loading')
1174
949
  },
1175
950
 
1176
951
  _hideIndicator: function () {
1177
- L.DomUtil.removeClass(this._map._container, 'umap-loading')
952
+ this._map._container.classList.remove('umap-loading')
1178
953
  },
1179
954
  })
1180
955
 
1181
956
  U.Editable = L.Editable.extend({
1182
- initialize: function (map, options) {
1183
- L.Editable.prototype.initialize.call(this, map, options)
957
+ initialize: function (umap, options) {
958
+ this._umap = umap
959
+ L.Editable.prototype.initialize.call(this, umap._leafletMap, options)
1184
960
  this.on('editable:drawing:click editable:drawing:move', this.drawingTooltip)
1185
961
  // Layer for items added by users
1186
962
  this.on('editable:drawing:cancel', (event) => {
@@ -1188,7 +964,7 @@ U.Editable = L.Editable.extend({
1188
964
  })
1189
965
  this.on('editable:drawing:commit', function (event) {
1190
966
  event.layer.feature.isDirty = true
1191
- if (this.map.editedFeature !== event.layer) event.layer.feature.edit(event)
967
+ if (this._umap.editedFeature !== event.layer) event.layer.feature.edit(event)
1192
968
  })
1193
969
  this.on('editable:editing', (event) => {
1194
970
  const feature = event.layer.feature
@@ -1210,24 +986,24 @@ U.Editable = L.Editable.extend({
1210
986
  },
1211
987
 
1212
988
  createPolyline: function (latlngs) {
1213
- const datalayer = this.map.defaultEditDataLayer()
1214
- const point = new U.LineString(datalayer, {
989
+ const datalayer = this._umap.defaultEditDataLayer()
990
+ const point = new U.LineString(this._umap, datalayer, {
1215
991
  geometry: { type: 'LineString', coordinates: [] },
1216
992
  })
1217
993
  return point.ui
1218
994
  },
1219
995
 
1220
996
  createPolygon: function (latlngs) {
1221
- const datalayer = this.map.defaultEditDataLayer()
1222
- const point = new U.Polygon(datalayer, {
997
+ const datalayer = this._umap.defaultEditDataLayer()
998
+ const point = new U.Polygon(this._umap, datalayer, {
1223
999
  geometry: { type: 'Polygon', coordinates: [] },
1224
1000
  })
1225
1001
  return point.ui
1226
1002
  },
1227
1003
 
1228
1004
  createMarker: function (latlng) {
1229
- const datalayer = this.map.defaultEditDataLayer()
1230
- const point = new U.Point(datalayer, {
1005
+ const datalayer = this._umap.defaultEditDataLayer()
1006
+ const point = new U.Point(this._umap, datalayer, {
1231
1007
  geometry: { type: 'Point', coordinates: [latlng.lng, latlng.lat] },
1232
1008
  })
1233
1009
  return point.ui
@@ -1235,15 +1011,15 @@ U.Editable = L.Editable.extend({
1235
1011
 
1236
1012
  _getDefaultProperties: function () {
1237
1013
  const result = {}
1238
- if (this.map.options.featuresHaveOwner?.user) {
1239
- result.geojson = { properties: { owner: this.map.options.user.id } }
1014
+ if (this._umap.properties.featuresHaveOwner?.user) {
1015
+ result.geojson = { properties: { owner: this._umap.properties.user.id } }
1240
1016
  }
1241
1017
  return result
1242
1018
  },
1243
1019
 
1244
1020
  connectCreatedToMap: function (layer) {
1245
1021
  // Overrided from Leaflet.Editable
1246
- const datalayer = this.map.defaultEditDataLayer()
1022
+ const datalayer = this._umap.defaultEditDataLayer()
1247
1023
  datalayer.addFeature(layer.feature)
1248
1024
  layer.isDirty = true
1249
1025
  return layer
@@ -1251,7 +1027,7 @@ U.Editable = L.Editable.extend({
1251
1027
 
1252
1028
  drawingTooltip: function (e) {
1253
1029
  if (e.layer instanceof L.Marker && e.type === 'editable:drawing:start') {
1254
- this.map.tooltip.open({ content: L._('Click to add a marker') })
1030
+ this._umap.tooltip.open({ content: L._('Click to add a marker') })
1255
1031
  }
1256
1032
  if (!(e.layer instanceof L.Polyline)) {
1257
1033
  // only continue with Polylines and Polygons
@@ -1298,12 +1074,12 @@ U.Editable = L.Editable.extend({
1298
1074
  }
1299
1075
  }
1300
1076
  if (content) {
1301
- this.map.tooltip.open({ content: content })
1077
+ this._umap.tooltip.open({ content: content })
1302
1078
  }
1303
1079
  },
1304
1080
 
1305
1081
  closeTooltip: function () {
1306
- this.map.ui.closeTooltip()
1082
+ this._umap.closeTooltip()
1307
1083
  },
1308
1084
 
1309
1085
  onVertexRawClick: (e) => {
@@ -1314,7 +1090,7 @@ U.Editable = L.Editable.extend({
1314
1090
 
1315
1091
  onEscape: function () {
1316
1092
  this.once('editable:drawing:end', (event) => {
1317
- this.map.tooltip.close()
1093
+ this._umap.tooltip.close()
1318
1094
  // Leaflet.Editable will delete the drawn shape if invalid
1319
1095
  // (eg. line has only one drawn point)
1320
1096
  // So let's check if the layer has no more shape