umap-project 2.8.2__py3-none-any.whl → 2.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

Files changed (260) hide show
  1. umap/__init__.py +1 -1
  2. umap/admin.py +15 -2
  3. umap/asgi.py +12 -7
  4. umap/context_processors.py +1 -0
  5. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/br/LC_MESSAGES/django.po +111 -67
  7. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/cs_CZ/LC_MESSAGES/django.po +110 -66
  9. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/el/LC_MESSAGES/django.po +129 -85
  11. umap/locale/en/LC_MESSAGES/django.po +103 -60
  12. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  13. umap/locale/es/LC_MESSAGES/django.po +114 -69
  14. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  15. umap/locale/fr/LC_MESSAGES/django.po +105 -61
  16. umap/locale/gl/LC_MESSAGES/django.mo +0 -0
  17. umap/locale/gl/LC_MESSAGES/django.po +216 -171
  18. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  19. umap/locale/it/LC_MESSAGES/django.po +142 -98
  20. umap/locale/nl/LC_MESSAGES/django.mo +0 -0
  21. umap/locale/nl/LC_MESSAGES/django.po +196 -151
  22. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/pt/LC_MESSAGES/django.po +115 -71
  24. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/zh_TW/LC_MESSAGES/django.po +109 -65
  26. umap/management/commands/empty_trash.py +12 -1
  27. umap/migrations/0026_datalayer_modified_at_datalayer_share_status.py +26 -0
  28. umap/models.py +43 -13
  29. umap/settings/base.py +5 -2
  30. umap/static/umap/base.css +5 -2
  31. umap/static/umap/content.css +2 -22
  32. umap/static/umap/css/bar.css +39 -10
  33. umap/static/umap/css/contextmenu.css +14 -2
  34. umap/static/umap/css/form.css +33 -39
  35. umap/static/umap/css/icon.css +47 -5
  36. umap/static/umap/css/panel.css +20 -2
  37. umap/static/umap/css/popup.css +0 -1
  38. umap/static/umap/css/tooltip.css +33 -31
  39. umap/static/umap/img/16-white.svg +5 -3
  40. umap/static/umap/img/16.svg +1 -1
  41. umap/static/umap/img/24-white.svg +17 -16
  42. umap/static/umap/img/24.svg +29 -18
  43. umap/static/umap/img/providers/bitbucket.png +0 -0
  44. umap/static/umap/img/providers/github.png +0 -0
  45. umap/static/umap/img/providers/keycloak.png +0 -0
  46. umap/static/umap/img/providers/openstreetmap-oauth2.png +0 -0
  47. umap/static/umap/img/providers/twitter-oauth2.png +0 -0
  48. umap/static/umap/img/source/16-white.svg +6 -4
  49. umap/static/umap/img/source/16.svg +1 -1
  50. umap/static/umap/img/source/24-white.svg +20 -18
  51. umap/static/umap/img/source/24.svg +30 -19
  52. umap/static/umap/js/components/alerts/alert.js +4 -1
  53. umap/static/umap/js/modules/browser.js +8 -8
  54. umap/static/umap/js/modules/caption.js +30 -7
  55. umap/static/umap/js/modules/data/features.js +101 -56
  56. umap/static/umap/js/modules/data/layer.js +108 -83
  57. umap/static/umap/js/modules/form/builder.js +242 -0
  58. umap/static/umap/js/modules/form/fields.js +1346 -0
  59. umap/static/umap/js/modules/formatter.js +9 -8
  60. umap/static/umap/js/modules/help.js +20 -24
  61. umap/static/umap/js/modules/importer.js +6 -3
  62. umap/static/umap/js/modules/permissions.js +11 -6
  63. umap/static/umap/js/modules/rendering/icon.js +5 -1
  64. umap/static/umap/js/modules/rendering/layers/classified.js +12 -8
  65. umap/static/umap/js/modules/rendering/layers/cluster.js +11 -1
  66. umap/static/umap/js/modules/rendering/map.js +1 -23
  67. umap/static/umap/js/modules/rendering/ui.js +20 -38
  68. umap/static/umap/js/modules/rules.js +3 -2
  69. umap/static/umap/js/modules/saving.js +5 -0
  70. umap/static/umap/js/modules/schema.js +8 -6
  71. umap/static/umap/js/modules/share.js +3 -3
  72. umap/static/umap/js/modules/sync/engine.js +56 -26
  73. umap/static/umap/js/modules/sync/updaters.js +15 -6
  74. umap/static/umap/js/modules/sync/websocket.js +50 -37
  75. umap/static/umap/js/modules/tableeditor.js +3 -2
  76. umap/static/umap/js/modules/ui/bar.js +101 -9
  77. umap/static/umap/js/modules/ui/base.js +7 -24
  78. umap/static/umap/js/modules/ui/contextmenu.js +9 -2
  79. umap/static/umap/js/modules/ui/panel.js +5 -1
  80. umap/static/umap/js/modules/ui/tooltip.js +19 -11
  81. umap/static/umap/js/modules/umap.js +121 -68
  82. umap/static/umap/js/modules/utils.js +196 -12
  83. umap/static/umap/js/umap.controls.js +11 -353
  84. umap/static/umap/locale/am_ET.js +17 -5
  85. umap/static/umap/locale/am_ET.json +17 -5
  86. umap/static/umap/locale/ar.js +17 -5
  87. umap/static/umap/locale/ar.json +17 -5
  88. umap/static/umap/locale/ast.js +17 -5
  89. umap/static/umap/locale/ast.json +17 -5
  90. umap/static/umap/locale/bg.js +17 -5
  91. umap/static/umap/locale/bg.json +17 -5
  92. umap/static/umap/locale/br.js +33 -20
  93. umap/static/umap/locale/br.json +33 -20
  94. umap/static/umap/locale/ca.js +17 -5
  95. umap/static/umap/locale/ca.json +17 -5
  96. umap/static/umap/locale/cs_CZ.js +15 -5
  97. umap/static/umap/locale/cs_CZ.json +15 -5
  98. umap/static/umap/locale/da.js +17 -5
  99. umap/static/umap/locale/da.json +17 -5
  100. umap/static/umap/locale/de.js +17 -5
  101. umap/static/umap/locale/de.json +17 -5
  102. umap/static/umap/locale/el.js +63 -51
  103. umap/static/umap/locale/el.json +63 -51
  104. umap/static/umap/locale/en.js +15 -5
  105. umap/static/umap/locale/en.json +15 -5
  106. umap/static/umap/locale/en_US.json +17 -5
  107. umap/static/umap/locale/es.js +25 -13
  108. umap/static/umap/locale/es.json +25 -13
  109. umap/static/umap/locale/et.js +17 -5
  110. umap/static/umap/locale/et.json +17 -5
  111. umap/static/umap/locale/eu.js +17 -5
  112. umap/static/umap/locale/eu.json +17 -5
  113. umap/static/umap/locale/fa_IR.js +17 -5
  114. umap/static/umap/locale/fa_IR.json +17 -5
  115. umap/static/umap/locale/fi.js +17 -5
  116. umap/static/umap/locale/fi.json +17 -5
  117. umap/static/umap/locale/fr.js +16 -6
  118. umap/static/umap/locale/fr.json +16 -6
  119. umap/static/umap/locale/gl.js +357 -345
  120. umap/static/umap/locale/gl.json +357 -345
  121. umap/static/umap/locale/he.js +17 -5
  122. umap/static/umap/locale/he.json +17 -5
  123. umap/static/umap/locale/hr.js +17 -5
  124. umap/static/umap/locale/hr.json +17 -5
  125. umap/static/umap/locale/hu.js +14 -5
  126. umap/static/umap/locale/hu.json +14 -5
  127. umap/static/umap/locale/id.js +17 -5
  128. umap/static/umap/locale/id.json +17 -5
  129. umap/static/umap/locale/is.js +17 -5
  130. umap/static/umap/locale/is.json +17 -5
  131. umap/static/umap/locale/it.js +125 -113
  132. umap/static/umap/locale/it.json +125 -113
  133. umap/static/umap/locale/ja.js +17 -5
  134. umap/static/umap/locale/ja.json +17 -5
  135. umap/static/umap/locale/ko.js +17 -5
  136. umap/static/umap/locale/ko.json +17 -5
  137. umap/static/umap/locale/lt.js +17 -5
  138. umap/static/umap/locale/lt.json +17 -5
  139. umap/static/umap/locale/ms.js +17 -5
  140. umap/static/umap/locale/ms.json +17 -5
  141. umap/static/umap/locale/nl.js +132 -119
  142. umap/static/umap/locale/nl.json +132 -119
  143. umap/static/umap/locale/no.js +17 -5
  144. umap/static/umap/locale/no.json +17 -5
  145. umap/static/umap/locale/pl.js +17 -5
  146. umap/static/umap/locale/pl.json +17 -5
  147. umap/static/umap/locale/pl_PL.json +17 -5
  148. umap/static/umap/locale/pt.js +38 -25
  149. umap/static/umap/locale/pt.json +38 -25
  150. umap/static/umap/locale/pt_BR.js +17 -5
  151. umap/static/umap/locale/pt_BR.json +17 -5
  152. umap/static/umap/locale/pt_PT.js +17 -5
  153. umap/static/umap/locale/pt_PT.json +17 -5
  154. umap/static/umap/locale/ro.js +17 -5
  155. umap/static/umap/locale/ro.json +17 -5
  156. umap/static/umap/locale/ru.js +17 -5
  157. umap/static/umap/locale/ru.json +17 -5
  158. umap/static/umap/locale/sk_SK.js +17 -5
  159. umap/static/umap/locale/sk_SK.json +17 -5
  160. umap/static/umap/locale/sl.js +17 -5
  161. umap/static/umap/locale/sl.json +17 -5
  162. umap/static/umap/locale/sr.js +17 -5
  163. umap/static/umap/locale/sr.json +17 -5
  164. umap/static/umap/locale/sv.js +17 -5
  165. umap/static/umap/locale/sv.json +17 -5
  166. umap/static/umap/locale/th_TH.js +17 -5
  167. umap/static/umap/locale/th_TH.json +17 -5
  168. umap/static/umap/locale/tr.js +17 -5
  169. umap/static/umap/locale/tr.json +17 -5
  170. umap/static/umap/locale/uk_UA.js +17 -5
  171. umap/static/umap/locale/uk_UA.json +17 -5
  172. umap/static/umap/locale/vi.js +17 -5
  173. umap/static/umap/locale/vi.json +17 -5
  174. umap/static/umap/locale/vi_VN.json +17 -5
  175. umap/static/umap/locale/zh.js +17 -5
  176. umap/static/umap/locale/zh.json +17 -5
  177. umap/static/umap/locale/zh_CN.json +17 -5
  178. umap/static/umap/locale/zh_TW.Big5.json +17 -5
  179. umap/static/umap/locale/zh_TW.js +15 -5
  180. umap/static/umap/locale/zh_TW.json +15 -5
  181. umap/static/umap/map.css +29 -76
  182. umap/static/umap/nav.css +6 -3
  183. umap/static/umap/unittests/utils.js +14 -0
  184. umap/static/umap/vars.css +3 -0
  185. umap/static/umap/vendors/dompurify/purify.es.js +138 -354
  186. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
  187. umap/static/umap/vendors/editable/Leaflet.Editable.js +1 -0
  188. umap/sync/__init__.py +0 -0
  189. umap/sync/app.py +187 -0
  190. umap/sync/payloads.py +56 -0
  191. umap/templates/auth/user_detail.html +4 -0
  192. umap/templates/auth/user_form.html +9 -6
  193. umap/templates/auth/user_stars.html +4 -0
  194. umap/templates/base.html +1 -1
  195. umap/templates/registration/login.html +2 -5
  196. umap/templates/umap/about.html +5 -0
  197. umap/templates/umap/about_summary.html +2 -2
  198. umap/templates/umap/components/provider.html +8 -0
  199. umap/templates/umap/content_footer.html +1 -1
  200. umap/templates/umap/css.html +0 -2
  201. umap/templates/umap/js.html +0 -4
  202. umap/templates/umap/map_detail.html +1 -1
  203. umap/templates/umap/password_change.html +4 -0
  204. umap/templates/umap/password_change_done.html +4 -0
  205. umap/templates/umap/search.html +4 -0
  206. umap/templates/umap/search_bar.html +1 -0
  207. umap/templates/umap/team_confirm_delete.html +4 -0
  208. umap/templates/umap/team_detail.html +4 -0
  209. umap/templates/umap/team_form.html +4 -0
  210. umap/templates/umap/user_dashboard.html +1 -1
  211. umap/templates/umap/user_teams.html +4 -0
  212. umap/tests/base.py +3 -1
  213. umap/tests/integration/conftest.py +16 -23
  214. umap/tests/integration/test_anonymous_owned_map.py +2 -2
  215. umap/tests/integration/test_basics.py +4 -7
  216. umap/tests/integration/test_caption.py +1 -0
  217. umap/tests/integration/test_categorized_layer.py +4 -8
  218. umap/tests/integration/test_choropleth.py +1 -1
  219. umap/tests/integration/test_conditional_rules.py +3 -3
  220. umap/tests/integration/test_draw_polygon.py +14 -22
  221. umap/tests/integration/test_draw_polyline.py +6 -14
  222. umap/tests/integration/test_edit_datalayer.py +11 -11
  223. umap/tests/integration/test_edit_map.py +30 -4
  224. umap/tests/integration/test_edit_marker.py +5 -5
  225. umap/tests/integration/test_edit_polygon.py +6 -6
  226. umap/tests/integration/test_features_id_generation.py +2 -6
  227. umap/tests/integration/test_import.py +115 -29
  228. umap/tests/integration/test_optimistic_merge.py +1 -0
  229. umap/tests/integration/test_owned_map.py +1 -1
  230. umap/tests/integration/test_picto.py +8 -8
  231. umap/tests/integration/test_save.py +3 -2
  232. umap/tests/integration/test_star.py +13 -9
  233. umap/tests/integration/test_tableeditor.py +8 -7
  234. umap/tests/integration/test_view_marker.py +10 -0
  235. umap/tests/integration/test_websocket_sync.py +239 -64
  236. umap/tests/settings.py +2 -0
  237. umap/tests/test_datalayer.py +2 -3
  238. umap/tests/test_datalayer_views.py +20 -1
  239. umap/tests/test_empty_trash.py +10 -3
  240. umap/tests/test_map_views.py +11 -0
  241. umap/utils.py +27 -11
  242. umap/views.py +37 -6
  243. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/METADATA +22 -22
  244. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/RECORD +247 -248
  245. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/WHEEL +1 -1
  246. umap/management/commands/run_websocket_server.py +0 -23
  247. umap/settings/local_s3.py +0 -45
  248. umap/static/umap/bitbucket.png +0 -0
  249. umap/static/umap/github.png +0 -0
  250. umap/static/umap/js/umap.forms.js +0 -1242
  251. umap/static/umap/keycloak.png +0 -0
  252. umap/static/umap/openstreetmap.png +0 -0
  253. umap/static/umap/twitter.png +0 -0
  254. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +0 -468
  255. umap/static/umap/vendors/toolbar/leaflet.toolbar.css +0 -1
  256. umap/static/umap/vendors/toolbar/leaflet.toolbar.js +0 -1
  257. umap/tests/test_websocket_server.py +0 -22
  258. umap/websocket_server.py +0 -202
  259. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/entry_points.txt +0 -0
  260. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/licenses/LICENSE +0 -0
@@ -159,16 +159,13 @@ export function toHTML(r, options) {
159
159
  r = r.replace(/\*(.*?)\*/g, '<em>$1</em>')
160
160
 
161
161
  // links
162
- r = r.replace(/(\[\[http)/g, '[[h_t_t_p') // Escape for avoiding clash between [[http://xxx]] and http://xxx
163
- r = r.replace(/({{http)/g, '{{h_t_t_p')
164
- r = r.replace(/(=http)/g, '=h_t_t_p') // http://xxx as query string, see https://github.com/umap-project/umap/issues/607
165
- r = r.replace(/(https?:[^ \<)\n]*)/g, `<a target="_${target}" href="$1">$1</a>`)
166
162
  r = r.replace(
167
- /\[\[(h_t_t_ps?:[^\]|]*?)\]\]/g,
168
- `<a target="_${target}" href="$1">$1</a>`
163
+ /(^|\s|>|\()(https?:[^ \<)\n]*)/g,
164
+ `$1<a target="_${target}" href="$2">$2</a>`
169
165
  )
166
+ r = r.replace(/\[\[(https?:[^\]|]*?)\]\]/g, `<a target="_${target}" href="$1">$1</a>`)
170
167
  r = r.replace(
171
- /\[\[(h_t_t_ps?:[^|]*?)\|(.*?)\]\]/g,
168
+ /\[\[(https?:[^|]*?)\|(.*?)\]\]/g,
172
169
  `<a target="_${target}" href="$1">$2</a>`
173
170
  )
174
171
  r = r.replace(/\[\[([^\]|]*?)\]\]/g, `<a target="_${target}" href="$1">$1</a>`)
@@ -176,15 +173,15 @@ export function toHTML(r, options) {
176
173
 
177
174
  // iframe
178
175
  r = r.replace(
179
- /{{{(h_t_t_ps?[^|{]*)}}}/g,
176
+ /{{{(https?[^|{]*)}}}/g,
180
177
  '<div><iframe frameborder="0" src="$1" width="100%" height="300px"></iframe></div>'
181
178
  )
182
179
  r = r.replace(
183
- /{{{(h_t_t_ps?[^|{]*)\|(\d*)(px)?}}}/g,
180
+ /{{{(https?[^|{]*)\|(\d*)(px)?}}}/g,
184
181
  '<div><iframe frameborder="0" src="$1" width="100%" height="$2px"></iframe></div>'
185
182
  )
186
183
  r = r.replace(
187
- /{{{(h_t_t_ps?[^|{]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g,
184
+ /{{{(https?[^|{]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g,
188
185
  '<div><iframe frameborder="0" src="$1" width="$4px" height="$2px"></iframe></div>'
189
186
  )
190
187
 
@@ -416,9 +413,11 @@ export function loadTemplate(html) {
416
413
  }
417
414
 
418
415
  export function loadTemplateWithRefs(html) {
419
- const element = loadTemplate(html)
416
+ const template = document.createElement('template')
417
+ template.innerHTML = html
418
+ const element = template.content.firstElementChild
420
419
  const elements = {}
421
- for (const node of element.querySelectorAll('[data-ref]')) {
420
+ for (const node of template.content.querySelectorAll('[data-ref]')) {
422
421
  elements[node.dataset.ref] = node
423
422
  }
424
423
  return [element, elements]
@@ -446,3 +445,188 @@ export function eachElement(selector, callback) {
446
445
  callback(el)
447
446
  }
448
447
  }
448
+
449
+ export class WithEvents {
450
+ constructor() {
451
+ this._target = new EventTarget()
452
+ }
453
+
454
+ on(eventType, callback) {
455
+ if (typeof callback !== 'function') return
456
+ this._target.addEventListener(eventType, callback)
457
+ }
458
+
459
+ fire(eventType, detail) {
460
+ const event = new CustomEvent(eventType, { detail })
461
+ this._target.dispatchEvent(event)
462
+ }
463
+ }
464
+
465
+ export function isWritable(element) {
466
+ if (['TEXTAREA', 'INPUT'].includes(element.tagName)) return true
467
+ if (element.isContentEditable) return true
468
+ return false
469
+ }
470
+
471
+ // From https://www.joshwcomeau.com/snippets/javascript/debounce/
472
+ export const debounce = (callback, wait) => {
473
+ let timeoutId = null
474
+
475
+ return (...args) => {
476
+ window.clearTimeout(timeoutId)
477
+
478
+ timeoutId = window.setTimeout(() => {
479
+ callback.apply(null, args)
480
+ }, wait)
481
+ }
482
+ }
483
+
484
+ export const COLORS = [
485
+ 'Black',
486
+ 'Navy',
487
+ 'DarkBlue',
488
+ 'MediumBlue',
489
+ 'Blue',
490
+ 'DarkGreen',
491
+ 'Green',
492
+ 'Teal',
493
+ 'DarkCyan',
494
+ 'DeepSkyBlue',
495
+ 'DarkTurquoise',
496
+ 'MediumSpringGreen',
497
+ 'Lime',
498
+ 'SpringGreen',
499
+ 'Aqua',
500
+ 'Cyan',
501
+ 'MidnightBlue',
502
+ 'DodgerBlue',
503
+ 'LightSeaGreen',
504
+ 'ForestGreen',
505
+ 'SeaGreen',
506
+ 'DarkSlateGray',
507
+ 'DarkSlateGrey',
508
+ 'LimeGreen',
509
+ 'MediumSeaGreen',
510
+ 'Turquoise',
511
+ 'RoyalBlue',
512
+ 'SteelBlue',
513
+ 'DarkSlateBlue',
514
+ 'MediumTurquoise',
515
+ 'Indigo',
516
+ 'DarkOliveGreen',
517
+ 'CadetBlue',
518
+ 'CornflowerBlue',
519
+ 'MediumAquaMarine',
520
+ 'DimGray',
521
+ 'DimGrey',
522
+ 'SlateBlue',
523
+ 'OliveDrab',
524
+ 'SlateGray',
525
+ 'SlateGrey',
526
+ 'LightSlateGray',
527
+ 'LightSlateGrey',
528
+ 'MediumSlateBlue',
529
+ 'LawnGreen',
530
+ 'Chartreuse',
531
+ 'Aquamarine',
532
+ 'Maroon',
533
+ 'Purple',
534
+ 'Olive',
535
+ 'Gray',
536
+ 'Grey',
537
+ 'SkyBlue',
538
+ 'LightSkyBlue',
539
+ 'BlueViolet',
540
+ 'DarkRed',
541
+ 'DarkMagenta',
542
+ 'SaddleBrown',
543
+ 'DarkSeaGreen',
544
+ 'LightGreen',
545
+ 'MediumPurple',
546
+ 'DarkViolet',
547
+ 'PaleGreen',
548
+ 'DarkOrchid',
549
+ 'YellowGreen',
550
+ 'Sienna',
551
+ 'Brown',
552
+ 'DarkGray',
553
+ 'DarkGrey',
554
+ 'LightBlue',
555
+ 'GreenYellow',
556
+ 'PaleTurquoise',
557
+ 'LightSteelBlue',
558
+ 'PowderBlue',
559
+ 'FireBrick',
560
+ 'DarkGoldenRod',
561
+ 'MediumOrchid',
562
+ 'RosyBrown',
563
+ 'DarkKhaki',
564
+ 'Silver',
565
+ 'MediumVioletRed',
566
+ 'IndianRed',
567
+ 'Peru',
568
+ 'Chocolate',
569
+ 'Tan',
570
+ 'LightGray',
571
+ 'LightGrey',
572
+ 'Thistle',
573
+ 'Orchid',
574
+ 'GoldenRod',
575
+ 'PaleVioletRed',
576
+ 'Crimson',
577
+ 'Gainsboro',
578
+ 'Plum',
579
+ 'BurlyWood',
580
+ 'LightCyan',
581
+ 'Lavender',
582
+ 'DarkSalmon',
583
+ 'Violet',
584
+ 'PaleGoldenRod',
585
+ 'LightCoral',
586
+ 'Khaki',
587
+ 'AliceBlue',
588
+ 'HoneyDew',
589
+ 'Azure',
590
+ 'SandyBrown',
591
+ 'Wheat',
592
+ 'Beige',
593
+ 'WhiteSmoke',
594
+ 'MintCream',
595
+ 'GhostWhite',
596
+ 'Salmon',
597
+ 'AntiqueWhite',
598
+ 'Linen',
599
+ 'LightGoldenRodYellow',
600
+ 'OldLace',
601
+ 'Red',
602
+ 'Fuchsia',
603
+ 'Magenta',
604
+ 'DeepPink',
605
+ 'OrangeRed',
606
+ 'Tomato',
607
+ 'HotPink',
608
+ 'Coral',
609
+ 'DarkOrange',
610
+ 'LightSalmon',
611
+ 'Orange',
612
+ 'LightPink',
613
+ 'Pink',
614
+ 'Gold',
615
+ 'PeachPuff',
616
+ 'NavajoWhite',
617
+ 'Moccasin',
618
+ 'Bisque',
619
+ 'MistyRose',
620
+ 'BlanchedAlmond',
621
+ 'PapayaWhip',
622
+ 'LavenderBlush',
623
+ 'SeaShell',
624
+ 'Cornsilk',
625
+ 'LemonChiffon',
626
+ 'FloralWhite',
627
+ 'Snow',
628
+ 'Yellow',
629
+ 'LightYellow',
630
+ 'Ivory',
631
+ 'White',
632
+ ]
@@ -1,342 +1,3 @@
1
- U.BaseAction = L.ToolbarAction.extend({
2
- initialize: function (map) {
3
- this.map = map
4
- if (this.options.label) {
5
- this.options.tooltip = this.map._umap.help.displayLabel(
6
- this.options.label,
7
- (withKbdTag = false)
8
- )
9
- }
10
- this.options.toolbarIcon = {
11
- className: this.options.className,
12
- tooltip: this.options.tooltip,
13
- }
14
- L.ToolbarAction.prototype.initialize.call(this)
15
- if (this.options.helpMenu && !U.Help.MENU_ACTIONS[this.options.className])
16
- U.Help.MENU_ACTIONS[this.options.className] = this
17
- },
18
- })
19
-
20
- U.ImportAction = U.BaseAction.extend({
21
- options: {
22
- helpMenu: true,
23
- className: 'upload-data dark',
24
- label: 'IMPORT_PANEL',
25
- },
26
-
27
- addHooks: function () {
28
- this.map._umap.importer.open()
29
- },
30
- })
31
-
32
- U.EditLayersAction = U.BaseAction.extend({
33
- options: {
34
- helpMenu: true,
35
- className: 'umap-control-browse dark',
36
- tooltip: L._('Manage layers'),
37
- },
38
-
39
- addHooks: function () {
40
- this.map._umap.editDatalayers()
41
- },
42
- })
43
-
44
- U.EditCaptionAction = U.BaseAction.extend({
45
- options: {
46
- helpMenu: true,
47
- className: 'umap-control-caption dark',
48
- tooltip: L._('Edit map name and caption'),
49
- },
50
-
51
- addHooks: function () {
52
- this.map._umap.editCaption()
53
- },
54
- })
55
-
56
- U.EditPropertiesAction = U.BaseAction.extend({
57
- options: {
58
- helpMenu: true,
59
- className: 'update-map-settings dark',
60
- tooltip: L._('Map advanced properties'),
61
- },
62
-
63
- addHooks: function () {
64
- this.map._umap.edit()
65
- },
66
- })
67
-
68
- U.ChangeTileLayerAction = U.BaseAction.extend({
69
- options: {
70
- helpMenu: true,
71
- className: 'dark update-map-tilelayers',
72
- tooltip: L._('Change tilelayers'),
73
- },
74
-
75
- addHooks: function () {
76
- this.map.updateTileLayers()
77
- },
78
- })
79
-
80
- U.UpdateExtentAction = U.BaseAction.extend({
81
- options: {
82
- className: 'update-map-extent dark',
83
- tooltip: L._('Save this center and zoom'),
84
- },
85
-
86
- addHooks: function () {
87
- this.map._umap.setCenterAndZoom()
88
- },
89
- })
90
-
91
- U.UpdatePermsAction = U.BaseAction.extend({
92
- options: {
93
- className: 'update-map-permissions dark',
94
- tooltip: L._('Update permissions and editors'),
95
- },
96
-
97
- addHooks: function () {
98
- this.map._umap.permissions.edit()
99
- },
100
- })
101
-
102
- U.DrawMarkerAction = U.BaseAction.extend({
103
- options: {
104
- helpMenu: true,
105
- className: 'umap-draw-marker dark',
106
- label: 'DRAW_MARKER',
107
- },
108
-
109
- addHooks: function () {
110
- this.map.editTools.startMarker()
111
- },
112
- })
113
-
114
- U.DrawPolylineAction = U.BaseAction.extend({
115
- options: {
116
- helpMenu: true,
117
- className: 'umap-draw-polyline dark',
118
- label: 'DRAW_LINE',
119
- },
120
-
121
- addHooks: function () {
122
- this.map.editTools.startPolyline()
123
- },
124
- })
125
-
126
- U.DrawPolygonAction = U.BaseAction.extend({
127
- options: {
128
- helpMenu: true,
129
- className: 'umap-draw-polygon dark',
130
- label: 'DRAW_POLYGON',
131
- },
132
-
133
- addHooks: function () {
134
- this.map.editTools.startPolygon()
135
- },
136
- })
137
-
138
- U.AddPolylineShapeAction = U.BaseAction.extend({
139
- options: {
140
- className: 'umap-draw-polyline-multi dark',
141
- tooltip: L._('Add a line to the current multi'),
142
- },
143
-
144
- addHooks: function () {
145
- // FIXME: smells bad
146
- this.map._umap.editedFeature.ui.editor.newShape()
147
- },
148
- })
149
-
150
- U.AddPolygonShapeAction = U.AddPolylineShapeAction.extend({
151
- options: {
152
- className: 'umap-draw-polygon-multi dark',
153
- tooltip: L._('Add a polygon to the current multi'),
154
- },
155
- })
156
-
157
- U.BaseFeatureAction = L.ToolbarAction.extend({
158
- initialize: function (map, feature, latlng) {
159
- this.map = map
160
- this.feature = feature
161
- this.latlng = latlng
162
- L.ToolbarAction.prototype.initialize.call(this)
163
- this.postInit()
164
- },
165
-
166
- postInit: () => {},
167
-
168
- hideToolbar: function () {
169
- this.map.removeLayer(this.toolbar)
170
- },
171
-
172
- addHooks: function () {
173
- this.onClick({ latlng: this.latlng })
174
- this.hideToolbar()
175
- },
176
- })
177
-
178
- U.CreateHoleAction = U.BaseFeatureAction.extend({
179
- options: {
180
- toolbarIcon: {
181
- className: 'umap-new-hole',
182
- tooltip: L._('Start a hole here'),
183
- },
184
- },
185
-
186
- onClick: function (event) {
187
- this.feature.ui.startHole(event)
188
- },
189
- })
190
-
191
- U.ToggleEditAction = U.BaseFeatureAction.extend({
192
- options: {
193
- toolbarIcon: {
194
- className: 'umap-toggle-edit',
195
- tooltip: L._('Toggle edit mode (⇧+Click)'),
196
- },
197
- },
198
-
199
- onClick: function (event) {
200
- if (this.feature._toggleEditing) {
201
- this.feature._toggleEditing(event) // Path
202
- } else {
203
- this.feature.edit(event) // Marker
204
- }
205
- },
206
- })
207
-
208
- U.DeleteFeatureAction = U.BaseFeatureAction.extend({
209
- options: {
210
- toolbarIcon: {
211
- className: 'umap-delete-all',
212
- tooltip: L._('Delete this feature'),
213
- },
214
- },
215
-
216
- postInit: function () {
217
- if (!this.feature.isMulti())
218
- this.options.toolbarIcon.className = 'umap-delete-one-of-one'
219
- },
220
-
221
- onClick: function (e) {
222
- this.feature.confirmDelete(e)
223
- },
224
- })
225
-
226
- U.DeleteShapeAction = U.BaseFeatureAction.extend({
227
- options: {
228
- toolbarIcon: {
229
- className: 'umap-delete-one-of-multi',
230
- tooltip: L._('Delete this shape'),
231
- },
232
- },
233
-
234
- onClick: function (e) {
235
- this.feature.ui.enableEdit().deleteShapeAt(e.latlng)
236
- },
237
- })
238
-
239
- U.ExtractShapeFromMultiAction = U.BaseFeatureAction.extend({
240
- options: {
241
- toolbarIcon: {
242
- className: 'umap-extract-shape-from-multi',
243
- tooltip: L._('Extract shape to separate feature'),
244
- },
245
- },
246
-
247
- onClick: function (e) {
248
- this.feature.ui.isolateShape(e.latlng)
249
- },
250
- })
251
-
252
- U.BaseVertexAction = U.BaseFeatureAction.extend({
253
- initialize: function (map, feature, latlng, vertex) {
254
- this.vertex = vertex
255
- U.BaseFeatureAction.prototype.initialize.call(this, map, feature, latlng)
256
- },
257
- })
258
-
259
- U.DeleteVertexAction = U.BaseVertexAction.extend({
260
- options: {
261
- toolbarIcon: {
262
- className: 'umap-delete-vertex',
263
- tooltip: L._('Delete this vertex (Alt+Click)'),
264
- },
265
- },
266
-
267
- onClick: function () {
268
- this.vertex.delete()
269
- },
270
- })
271
-
272
- U.SplitLineAction = U.BaseVertexAction.extend({
273
- options: {
274
- toolbarIcon: {
275
- className: 'umap-split-line',
276
- tooltip: L._('Split line'),
277
- },
278
- },
279
-
280
- onClick: function () {
281
- this.vertex.split()
282
- },
283
- })
284
-
285
- U.ContinueLineAction = U.BaseVertexAction.extend({
286
- options: {
287
- toolbarIcon: {
288
- className: 'umap-continue-line',
289
- tooltip: L._('Continue line'),
290
- },
291
- },
292
-
293
- onClick: function () {
294
- this.vertex.continue()
295
- },
296
- })
297
-
298
- // Leaflet.Toolbar doesn't allow twice same toolbar class…
299
- U.SettingsToolbar = L.Toolbar.Control.extend({})
300
- U.DrawToolbar = L.Toolbar.Control.extend({
301
- initialize: function (options) {
302
- L.Toolbar.Control.prototype.initialize.call(this, options)
303
- this.map = this.options.map
304
- this.map.on('seteditedfeature', this.redraw, this)
305
- },
306
-
307
- appendToContainer: function (container) {
308
- this.options.actions = []
309
- if (this.map._umap.properties.enableMarkerDraw) {
310
- this.options.actions.push(U.DrawMarkerAction)
311
- }
312
- if (this.map._umap.properties.enablePolylineDraw) {
313
- this.options.actions.push(U.DrawPolylineAction)
314
- if (
315
- this.map._umap.editedFeature &&
316
- this.map._umap.editedFeature instanceof U.LineString
317
- ) {
318
- this.options.actions.push(U.AddPolylineShapeAction)
319
- }
320
- }
321
- if (this.map._umap.properties.enablePolygonDraw) {
322
- this.options.actions.push(U.DrawPolygonAction)
323
- if (
324
- this.map._umap.editedFeature &&
325
- this.map._umap.editedFeature instanceof U.Polygon
326
- ) {
327
- this.options.actions.push(U.AddPolygonShapeAction)
328
- }
329
- }
330
- L.Toolbar.Control.prototype.appendToContainer.call(this, container)
331
- },
332
-
333
- redraw: function () {
334
- const container = this._control.getContainer()
335
- container.innerHTML = ''
336
- this.appendToContainer(container)
337
- },
338
- })
339
-
340
1
  U.EditControl = L.Control.extend({
341
2
  options: {
342
3
  position: 'topright',
@@ -491,18 +152,6 @@ U.CaptionControl = L.Control.Button.extend({
491
152
  },
492
153
  })
493
154
 
494
- U.StarControl = L.Control.Button.extend({
495
- options: {
496
- position: 'topleft',
497
- title: L._('Star this map'),
498
- className: 'leaflet-control-star map-star umap-control',
499
- },
500
-
501
- onClick: function () {
502
- this._umap.star()
503
- },
504
- })
505
-
506
155
  L.Control.Embed = L.Control.Button.extend({
507
156
  options: {
508
157
  position: 'topleft',
@@ -600,12 +249,12 @@ U.TileLayerChooser = L.Control.extend({
600
249
  },
601
250
 
602
251
  openSwitcher: function (options = {}) {
603
- const container = L.DomUtil.create('div', 'umap-tilelayer-switcher-container')
252
+ const container = L.DomUtil.create('div', 'umap-edit-tilelayers')
604
253
  L.DomUtil.createTitle(container, L._('Change tilelayers'), 'icon-tilelayer')
605
254
  this._tilelayers_container = L.DomUtil.create('ul', '', container)
606
255
  this.buildList(options)
607
256
  const panel = options.edit ? this.map._umap.editPanel : this.map._umap.panel
608
- panel.open({ content: container })
257
+ panel.open({ content: container, highlight: 'tilelayers' })
609
258
  },
610
259
 
611
260
  buildList: function (options) {
@@ -1041,15 +690,24 @@ U.Editable = L.Editable.extend({
1041
690
  onEscape: function () {
1042
691
  this.once('editable:drawing:end', (event) => {
1043
692
  this._umap.tooltip.close()
693
+ // When hitting Escape before adding a marker,
694
+ // it tries to edit an unconnected marker.
695
+ if (event?.layer?.feature?.datalayer === null) return
1044
696
  // Leaflet.Editable will delete the drawn shape if invalid
1045
697
  // (eg. line has only one drawn point)
1046
698
  // So let's check if the layer has no more shape
1047
699
  if (!event.layer.feature.hasGeom()) {
1048
700
  event.layer.feature.del()
1049
701
  } else {
702
+ event.layer.feature.onCommit()
1050
703
  event.layer.feature.edit()
1051
704
  }
1052
705
  })
1053
706
  this.stopDrawing()
1054
707
  },
708
+
709
+ createVertexIcon: (options) =>
710
+ L.Browser.mobile && L.Browser.touch
711
+ ? L.divIcon({ iconSize: new L.Point(20, 20), ...options })
712
+ : L.divIcon({ iconSize: new L.Point(12, 12), ...options }),
1055
713
  })
@@ -19,7 +19,6 @@ const locale = {
19
19
  "Add a new property": "አዲስ ባህርይ ጨምር",
20
20
  "Add a polygon to the current multi": "ላሁኑ ብዝሀ ፖሊጎን ጨምር",
21
21
  "Add image URL": "Add image URL",
22
- "Add": "Add",
23
22
  "Advanced actions": "ተጨማሪ ተግባራት",
24
23
  "Advanced properties": "ተጨማሪ ባህርያት",
25
24
  "All data and settings of the map": "All data and settings of the map",
@@ -120,7 +119,6 @@ const locale = {
120
119
  "Display the locate control": "Display the locate control",
121
120
  "Display the measure control": "Display the measure control",
122
121
  "Display the search control": "Display the search control",
123
- "Display the star map button": "Display the star map button",
124
122
  "Display the tile layers control": "Display the tile layers control",
125
123
  "Display the zoom control": "Display the zoom control",
126
124
  "Do you want to display a caption bar?": "የካፕሽን ባሩን ማሳየት ትፈልጋለህ?",
@@ -301,7 +299,6 @@ const locale = {
301
299
  "Restore this version": "ይህንን እትም መልስ",
302
300
  "Save current edits": "የአሁኑን እርማቶች አስቀምጥ/አድን",
303
301
  "Save map": "Save map",
304
- "Save this center and zoom": "ይህንን ዙም እና መሀከል አስቀምጥ/አድን",
305
302
  "Save this location as new feature": "Save this location as new feature",
306
303
  "Save": "አድን/አስቀምጥ",
307
304
  "Saved center and zoom": "Saved center and zoom",
@@ -516,11 +513,26 @@ const locale = {
516
513
  "show/hide all layers": "show/hide all layers",
517
514
  "zoom to data extent": "zoom to data extent",
518
515
  "download visible data": "download visible data",
519
- "{connectedPeers} peer(s) currently connected to this map": "{connectedPeers} peer(s) currently connected to this map",
520
516
  "Import helpers": "Import helpers",
521
517
  "Import helpers will fill the URL field for you.": "Import helpers will fill the URL field for you.",
522
518
  "Wikipedia": "Wikipedia",
523
- "Save draft": "Save draft"
519
+ "Save draft": "Save draft",
520
+ "No data has been found for import": "No data has been found for import",
521
+ "Successfully imported {count} feature(s)": "Successfully imported {count} feature(s)",
522
+ "Disconnected": "Disconnected",
523
+ "You must be logged in": "You must be logged in",
524
+ "on hover": "on hover",
525
+ "Cannot load remote data for layer \"{layer}\" with url \"{url}\"": "Cannot load remote data for layer \"{layer}\" with url \"{url}\"",
526
+ "Cannot parse remote data for layer \"{layer}\" with url \"{url}\"": "Cannot parse remote data for layer \"{layer}\" with url \"{url}\"",
527
+ "Import failed: invalid data": "Import failed: invalid data",
528
+ "Anonymous": "Anonymous",
529
+ "created at {date}": "created at {date}",
530
+ "modified at {date}": "modified at {date}",
531
+ "Default zoom": "Default zoom",
532
+ "Default latitude": "Default latitude",
533
+ "Default longitude": "Default longitude",
534
+ "Edit map default view": "Edit map default view",
535
+ "Use current center and zoom": "Use current center and zoom"
524
536
  }
525
537
  L.registerLocale("am_ET", locale)
526
538
  L.setLocale("am_ET")