umap-project 2.8.0b0__py3-none-any.whl → 2.8.1__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 (112) hide show
  1. umap/__init__.py +1 -1
  2. umap/decorators.py +3 -1
  3. umap/locale/ar/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/ar/LC_MESSAGES/django.po +45 -30
  5. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/br/LC_MESSAGES/django.po +49 -34
  7. umap/locale/ca/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/ca/LC_MESSAGES/django.po +45 -30
  9. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/cs_CZ/LC_MESSAGES/django.po +52 -37
  11. umap/locale/da/LC_MESSAGES/django.mo +0 -0
  12. umap/locale/da/LC_MESSAGES/django.po +45 -30
  13. umap/locale/de/LC_MESSAGES/django.mo +0 -0
  14. umap/locale/de/LC_MESSAGES/django.po +45 -30
  15. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  16. umap/locale/el/LC_MESSAGES/django.po +45 -30
  17. umap/locale/en/LC_MESSAGES/django.po +44 -29
  18. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  19. umap/locale/es/LC_MESSAGES/django.po +45 -30
  20. umap/locale/et/LC_MESSAGES/django.mo +0 -0
  21. umap/locale/et/LC_MESSAGES/django.po +45 -30
  22. umap/locale/eu/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/eu/LC_MESSAGES/django.po +65 -50
  24. umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/fa_IR/LC_MESSAGES/django.po +45 -30
  26. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  27. umap/locale/fr/LC_MESSAGES/django.po +45 -30
  28. umap/locale/gl/LC_MESSAGES/django.mo +0 -0
  29. umap/locale/gl/LC_MESSAGES/django.po +45 -30
  30. umap/locale/he/LC_MESSAGES/django.mo +0 -0
  31. umap/locale/he/LC_MESSAGES/django.po +45 -30
  32. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  33. umap/locale/hu/LC_MESSAGES/django.po +45 -30
  34. umap/locale/is/LC_MESSAGES/django.mo +0 -0
  35. umap/locale/is/LC_MESSAGES/django.po +45 -30
  36. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  37. umap/locale/it/LC_MESSAGES/django.po +45 -30
  38. umap/locale/ja/LC_MESSAGES/django.mo +0 -0
  39. umap/locale/ja/LC_MESSAGES/django.po +45 -30
  40. umap/locale/ko/LC_MESSAGES/django.mo +0 -0
  41. umap/locale/ko/LC_MESSAGES/django.po +45 -30
  42. umap/locale/lt/LC_MESSAGES/django.mo +0 -0
  43. umap/locale/lt/LC_MESSAGES/django.po +45 -30
  44. umap/locale/ms/LC_MESSAGES/django.mo +0 -0
  45. umap/locale/ms/LC_MESSAGES/django.po +45 -30
  46. umap/locale/nl/LC_MESSAGES/django.mo +0 -0
  47. umap/locale/nl/LC_MESSAGES/django.po +45 -30
  48. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  49. umap/locale/pl/LC_MESSAGES/django.po +45 -30
  50. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  51. umap/locale/pt/LC_MESSAGES/django.po +45 -30
  52. umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  53. umap/locale/pt_BR/LC_MESSAGES/django.po +45 -30
  54. umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  55. umap/locale/pt_PT/LC_MESSAGES/django.po +45 -30
  56. umap/locale/ru/LC_MESSAGES/django.mo +0 -0
  57. umap/locale/ru/LC_MESSAGES/django.po +45 -30
  58. umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  59. umap/locale/sk_SK/LC_MESSAGES/django.po +45 -30
  60. umap/locale/sl/LC_MESSAGES/django.mo +0 -0
  61. umap/locale/sl/LC_MESSAGES/django.po +45 -30
  62. umap/locale/sr/LC_MESSAGES/django.mo +0 -0
  63. umap/locale/sr/LC_MESSAGES/django.po +45 -30
  64. umap/locale/sv/LC_MESSAGES/django.mo +0 -0
  65. umap/locale/sv/LC_MESSAGES/django.po +45 -30
  66. umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
  67. umap/locale/th_TH/LC_MESSAGES/django.po +45 -30
  68. umap/locale/tr/LC_MESSAGES/django.mo +0 -0
  69. umap/locale/tr/LC_MESSAGES/django.po +45 -30
  70. umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
  71. umap/locale/uk_UA/LC_MESSAGES/django.po +45 -30
  72. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  73. umap/locale/zh_TW/LC_MESSAGES/django.po +50 -35
  74. umap/static/umap/content.css +18 -13
  75. umap/static/umap/css/bar.css +4 -0
  76. umap/static/umap/img/logo_lightcyan.svg +4 -0
  77. umap/static/umap/js/modules/caption.js +73 -73
  78. umap/static/umap/js/modules/data/features.js +8 -5
  79. umap/static/umap/js/modules/data/layer.js +13 -8
  80. umap/static/umap/js/modules/drop.js +55 -0
  81. umap/static/umap/js/modules/importer.js +10 -5
  82. umap/static/umap/js/modules/rendering/map.js +2 -1
  83. umap/static/umap/js/modules/rendering/popup.js +9 -10
  84. umap/static/umap/js/modules/rendering/template.js +53 -9
  85. umap/static/umap/js/modules/schema.js +1 -0
  86. umap/static/umap/js/modules/sync/engine.js +56 -13
  87. umap/static/umap/js/modules/sync/updaters.js +4 -1
  88. umap/static/umap/js/modules/sync/websocket.js +47 -2
  89. umap/static/umap/js/modules/ui/bar.js +1 -1
  90. umap/static/umap/js/modules/umap.js +37 -21
  91. umap/static/umap/js/modules/utils.js +2 -0
  92. umap/static/umap/js/umap.controls.js +1 -51
  93. umap/static/umap/locale/cs_CZ.js +13 -11
  94. umap/static/umap/locale/cs_CZ.json +13 -11
  95. umap/static/umap/locale/en.js +2 -1
  96. umap/static/umap/locale/en.json +2 -1
  97. umap/static/umap/locale/fr.js +2 -1
  98. umap/static/umap/locale/fr.json +2 -1
  99. umap/static/umap/locale/zh_TW.js +13 -11
  100. umap/static/umap/locale/zh_TW.json +13 -11
  101. umap/static/umap/unittests/sync.js +4 -1
  102. umap/templates/403.html +12 -0
  103. umap/templates/404.html +4 -13
  104. umap/templates/40x.html +9 -0
  105. umap/tests/integration/conftest.py +3 -3
  106. umap/tests/integration/test_websocket_sync.py +69 -0
  107. umap/websocket_server.py +8 -1
  108. {umap_project-2.8.0b0.dist-info → umap_project-2.8.1.dist-info}/METADATA +5 -5
  109. {umap_project-2.8.0b0.dist-info → umap_project-2.8.1.dist-info}/RECORD +112 -108
  110. {umap_project-2.8.0b0.dist-info → umap_project-2.8.1.dist-info}/WHEEL +0 -0
  111. {umap_project-2.8.0b0.dist-info → umap_project-2.8.1.dist-info}/entry_points.txt +0 -0
  112. {umap_project-2.8.0b0.dist-info → umap_project-2.8.1.dist-info}/licenses/LICENSE +0 -0
@@ -15,7 +15,7 @@ msgid ""
15
15
  msgstr ""
16
16
  "Project-Id-Version: uMap\n"
17
17
  "Report-Msgid-Bugs-To: \n"
18
- "POT-Creation-Date: 2024-12-11 17:05+0000\n"
18
+ "POT-Creation-Date: 2024-12-24 08:39+0000\n"
19
19
  "PO-Revision-Date: 2013-11-22 14:00+0000\n"
20
20
  "Last-Translator: Supaplex <bejokeup@gmail.com>, 2019,2023-2024\n"
21
21
  "Language-Team: Chinese (Taiwan) (http://app.transifex.com/openstreetmap/umap/language/zh_TW/)\n"
@@ -29,6 +29,10 @@ msgstr ""
29
29
  msgid "CSV Export"
30
30
  msgstr "CSV 匯出"
31
31
 
32
+ #: decorators.py:60
33
+ msgid "This map is not publicly available"
34
+ msgstr ""
35
+
32
36
  #: middleware.py:13
33
37
  msgid "Site is readonly for maintenance"
34
38
  msgstr "網站目前因維護中設定為唯讀狀態"
@@ -79,7 +83,7 @@ msgstr "只有擁有者"
79
83
 
80
84
  #: models.py:184
81
85
  msgid "Draft (private)"
82
- msgstr ""
86
+ msgstr "草稿 (私人)"
83
87
 
84
88
  #: models.py:185
85
89
  msgid "Everyone (public)"
@@ -95,7 +99,7 @@ msgstr "已經封銷了"
95
99
 
96
100
  #: models.py:191
97
101
  msgid "Deleted"
98
- msgstr ""
102
+ msgstr "已刪除"
99
103
 
100
104
  #: models.py:194
101
105
  msgid "center"
@@ -161,9 +165,20 @@ msgstr "載入時顯示"
161
165
  msgid "Display this layer on load."
162
166
  msgstr "載入此圖層時顯示"
163
167
 
164
- #: templates/404.html:8
165
- msgid "Take me to the home page"
166
- msgstr "帶我回主頁"
168
+ #: templates/403.html:8
169
+ msgid ""
170
+ "<a href=\"https://discover.umap-project.org/support/faq/#map-statuses\" "
171
+ "target=\"_blank\">Find out here the documentation</a> on how to manage map’s"
172
+ " permissions."
173
+ msgstr ""
174
+
175
+ #: templates/403.html:10 templates/404.html:8
176
+ msgid "← Go to the homepage"
177
+ msgstr ""
178
+
179
+ #: templates/404.html:7
180
+ msgid "404 Page Not Found"
181
+ msgstr ""
167
182
 
168
183
  #: templates/auth/user_detail.html:8
169
184
  #, python-format
@@ -215,11 +230,11 @@ msgstr "登入"
215
230
 
216
231
  #: templates/registration/login.html:22
217
232
  msgid "To save and easily find your maps, identify yourself."
218
- msgstr ""
233
+ msgstr "要儲存與更容易找到宗的地圖,請識別你自己"
219
234
 
220
235
  #: templates/registration/login.html:25
221
236
  msgid "Please log in with your account:"
222
- msgstr ""
237
+ msgstr "你使用你的帳號來登入:"
223
238
 
224
239
  #: templates/registration/login.html:42
225
240
  msgid "Username"
@@ -231,7 +246,7 @@ msgstr "密碼"
231
246
 
232
247
  #: templates/registration/login.html:52
233
248
  msgid "Please choose a provider:"
234
- msgstr ""
249
+ msgstr "請選擇提供商:"
235
250
 
236
251
  #: templates/umap/about_summary.html:12
237
252
  #, python-format
@@ -282,13 +297,13 @@ msgstr "建立地圖"
282
297
  msgid "Play with the demo"
283
298
  msgstr "播放展示"
284
299
 
285
- #: templates/umap/components/alerts/alert.html:15
286
- #: templates/umap/components/alerts/alert.html:64
287
- #: templates/umap/components/alerts/alert.html:92
300
+ #: templates/umap/components/alerts/alert.html:17
301
+ #: templates/umap/components/alerts/alert.html:66
302
+ #: templates/umap/components/alerts/alert.html:94
288
303
  msgid "Close"
289
304
  msgstr "關閉"
290
305
 
291
- #: templates/umap/components/alerts/alert.html:30
306
+ #: templates/umap/components/alerts/alert.html:32
292
307
  #, python-format
293
308
  msgid ""
294
309
  "Pro-tip: to easily find back your maps, <a href=\"%(login_url)s\" "
@@ -296,35 +311,35 @@ msgid ""
296
311
  "target=\"_blank\">log in</a>."
297
312
  msgstr "進階技巧:要輕易找到你先前的地圖,<a href=\"%(login_url)s\" target=\"_blank\">創建帳號</a>或是<a href=\"%(login_url)s\" target=\"_blank\">登入</a>。"
298
313
 
299
- #: templates/umap/components/alerts/alert.html:35
314
+ #: templates/umap/components/alerts/alert.html:37
300
315
  msgid "Here is your secret link to edit the map, please keep it safe:"
301
316
  msgstr "這裡是編輯地圖的祕密連結,請好好保管:"
302
317
 
303
- #: templates/umap/components/alerts/alert.html:39
318
+ #: templates/umap/components/alerts/alert.html:41
304
319
  msgid "Copy link"
305
320
  msgstr "複製連結"
306
321
 
307
- #: templates/umap/components/alerts/alert.html:46
322
+ #: templates/umap/components/alerts/alert.html:48
308
323
  msgid "Enter your email address to receive the secret link:"
309
324
  msgstr "輸入你的電子郵件來取得祕密連結:"
310
325
 
311
- #: templates/umap/components/alerts/alert.html:52
326
+ #: templates/umap/components/alerts/alert.html:54
312
327
  msgid "Email"
313
328
  msgstr "電子郵件"
314
329
 
315
- #: templates/umap/components/alerts/alert.html:55
330
+ #: templates/umap/components/alerts/alert.html:57
316
331
  msgid "Send me the link"
317
332
  msgstr "寄送連結"
318
333
 
319
- #: templates/umap/components/alerts/alert.html:79
334
+ #: templates/umap/components/alerts/alert.html:81
320
335
  msgid "See their edits in another tab"
321
336
  msgstr "在其他頁籤察看他們的編輯"
322
337
 
323
- #: templates/umap/components/alerts/alert.html:82
338
+ #: templates/umap/components/alerts/alert.html:84
324
339
  msgid "Keep your changes and loose theirs"
325
340
  msgstr "保留你的變動並且丟棄他們的"
326
341
 
327
- #: templates/umap/components/alerts/alert.html:85
342
+ #: templates/umap/components/alerts/alert.html:87
328
343
  msgid "Keep their changes and loose yours"
329
344
  msgstr "保留他們的變動並且丟棄自己的"
330
345
 
@@ -392,7 +407,7 @@ msgstr "找點子,瀏覽其他地圖"
392
407
  msgid "You are logged in. Continuing..."
393
408
  msgstr "您已登入,繼續中..."
394
409
 
395
- #: templates/umap/map_list.html:11 views.py:433
410
+ #: templates/umap/map_list.html:11 views.py:437
396
411
  msgid "by"
397
412
  msgstr "由"
398
413
 
@@ -620,61 +635,61 @@ msgstr "無法刪除超過一位成員的團隊"
620
635
  msgid "Team “%(name)s” has been deleted"
621
636
  msgstr "已經刪除團隊 \"%(name)s\" "
622
637
 
623
- #: views.py:438
638
+ #: views.py:442
624
639
  msgid "View the map"
625
640
  msgstr "檢視地圖"
626
641
 
627
- #: views.py:820
642
+ #: views.py:825
628
643
  msgid "See full screen"
629
644
  msgstr "檢視全螢幕"
630
645
 
631
- #: views.py:963
646
+ #: views.py:968
632
647
  msgid "Map editors updated with success!"
633
648
  msgstr "地圖編輯者更新完成"
634
649
 
635
- #: views.py:999
650
+ #: views.py:1004
636
651
  #, python-format
637
652
  msgid "The uMap edit link for your map: %(map_name)s"
638
653
  msgstr "你的地圖 uMap 編輯連結:%(map_name)s"
639
654
 
640
- #: views.py:1002
655
+ #: views.py:1007
641
656
  #, python-format
642
657
  msgid "Here is your secret edit link: %(link)s"
643
658
  msgstr "這是你的祕密編輯連結:%(link)s"
644
659
 
645
- #: views.py:1009
660
+ #: views.py:1014
646
661
  #, python-format
647
662
  msgid "Can't send email to %(email)s"
648
663
  msgstr "無法傳送電子郵件到%(email)s"
649
664
 
650
- #: views.py:1012
665
+ #: views.py:1017
651
666
  #, python-format
652
667
  msgid "Email sent to %(email)s"
653
668
  msgstr "電子郵件寄至 %(email)s"
654
669
 
655
- #: views.py:1023
670
+ #: views.py:1028
656
671
  msgid "Only its owner can delete the map."
657
672
  msgstr "只有擁有者可以刪除此地圖"
658
673
 
659
- #: views.py:1026
674
+ #: views.py:1031
660
675
  msgid "Map successfully deleted."
661
676
  msgstr "成功刪除地圖"
662
677
 
663
- #: views.py:1052
678
+ #: views.py:1057
664
679
  #, python-format
665
680
  msgid ""
666
681
  "Your map has been cloned! If you want to edit this map from another "
667
682
  "computer, please use this link: %(anonymous_url)s"
668
683
  msgstr "您的地圖已複製完成!如果您想在不同的機器編輯這個地圖,請使用這個連結:%(anonymous_url)s"
669
684
 
670
- #: views.py:1057
685
+ #: views.py:1062
671
686
  msgid "Congratulations, your map has been cloned!"
672
687
  msgstr "恭喜,您的地圖已被複製!"
673
688
 
674
- #: views.py:1308
689
+ #: views.py:1313
675
690
  msgid "Layer successfully deleted."
676
691
  msgstr "圖層已刪除"
677
692
 
678
- #: views.py:1330
693
+ #: views.py:1335
679
694
  msgid "Permissions updated with success!"
680
695
  msgstr "權限更新完成"
@@ -208,31 +208,36 @@ input[type="submit"],
208
208
  }
209
209
 
210
210
  /* **************************** */
211
- /* 404 */
211
+ /* 40x */
212
212
  /* **************************** */
213
- .content404 {
214
- width: 400px;
213
+ .content-40x {
214
+ max-width: 600px;
215
215
  margin-left: auto;
216
216
  margin-right: auto;
217
217
  margin-top: 100px;
218
- text-align: center;
219
218
  }
220
- .content404 a {
219
+ .content-40x a {
221
220
  color: #3A4259;
222
221
  }
223
- .content404 h1 {
224
- font-size: 10em;
222
+ .content-40x h1 {
223
+ font-size: 2em;
225
224
  margin-bottom: 0;
226
- line-height: 0.5em;
227
225
  margin-top: 40px;
228
226
  }
229
- .content404 h2 {
230
- font-size: 4em;
231
- margin-top: 0;
232
- }
233
- .content404 img {
227
+ .content-404 img {
234
228
  width: 32%;
235
229
  }
230
+ .page-40x {
231
+ background-image: url('./img/logo_lightcyan.svg');
232
+ background-repeat: no-repeat;
233
+ background-size: contain;
234
+ background-position: center;
235
+ height: 75vh;
236
+ margin: 1rem;
237
+ }
238
+ .page-40x a {
239
+ text-decoration: underline;
240
+ }
236
241
 
237
242
 
238
243
  /* **************************** */
@@ -32,6 +32,10 @@
32
32
  background-color: var(--color-lightCyan);
33
33
  color: var(--color-dark);
34
34
  }
35
+ .dark .off.connected-peers {
36
+ background-color: var(--color-lightGray);
37
+ color: var(--color-darkGray);
38
+ }
35
39
 
36
40
  .leaflet-container .edit-cancel,
37
41
  .leaflet-container .edit-disable,
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
2
+ <path d="M36.5 6.2A64 64 0 0 0 64 128C14.5 81.8 3.1 24.8 36.5 6.2zM64 128A64 64 0 0 0 91.5 6.2c33.4 18.6 22 75.6-27.5 121.8z" fill="#eafcf1"/>
3
+ <path d="M87.7 33.8a23.7 23.7 0 1 1-47.4 0 23.7 23.7 0 0 1 47.4 0z" fill="#eafcf1"/>
4
+ </svg>
@@ -1,11 +1,39 @@
1
- import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
2
1
  import { translate } from './i18n.js'
3
2
  import * as Utils from './utils.js'
4
3
 
5
- export default class Caption {
4
+ const TEMPLATE = `
5
+ <div class="umap-caption">
6
+ <hgroup>
7
+ <h3>
8
+ <i class="icon icon-16 icon-caption icon-block"></i>
9
+ <span class="map-name" data-ref="name"></span>
10
+ </h3>
11
+ <h4 data-ref="author"></h4>
12
+ </hgroup>
13
+ <div class="umap-map-description text" data-ref="description"></div>
14
+ <div class="datalayer-container" data-ref="datalayersContainer"></div>
15
+ <div class="credits-container">
16
+ <details>
17
+ <summary>${translate('Credits')}</summary>
18
+ <fieldset>
19
+ <h5>${translate('User content credits')}</h5>
20
+ <p data-ref="userCredits"></p>
21
+ <p data-ref="licence">${translate('Map user content has been published under licence')} <a href="#" data-ref="licenceLink"></a></p>
22
+ <p data-ref="noLicence">${translate('No licence has been set')}</p>
23
+ <h5>${translate('Map background credits')}</h5>
24
+ <p><strong data-ref="bgName"></strong> <span data-ref="bgAttribution"></span></p>
25
+ <p data-ref="poweredBy"></p>
26
+ </fieldset>
27
+ </details>
28
+ </div>
29
+ </div>`
30
+
31
+ export default class Caption extends Utils.WithTemplate {
6
32
  constructor(umap, leafletMap) {
33
+ super()
7
34
  this._umap = umap
8
35
  this._leafletMap = leafletMap
36
+ this.loadTemplate(TEMPLATE)
9
37
  }
10
38
 
11
39
  isOpen() {
@@ -18,94 +46,67 @@ export default class Caption {
18
46
  }
19
47
 
20
48
  open() {
21
- const container = DomUtil.create('div', 'umap-caption')
22
- const hgroup = DomUtil.element({ tagName: 'hgroup', parent: container })
23
- DomUtil.createTitle(
24
- hgroup,
25
- this._umap.getDisplayName(),
26
- 'icon-caption icon-block',
27
- 'map-name'
28
- )
29
- const title = Utils.loadTemplate('<h4></h4>')
30
- hgroup.appendChild(title)
31
- this._umap.addAuthorLink(title)
49
+ this.elements.name.textContent = this._umap.getDisplayName()
50
+ this.elements.author.innerHTML = ''
51
+ this._umap.addAuthorLink(this.elements.author)
32
52
  if (this._umap.properties.description) {
33
- const description = DomUtil.element({
34
- tagName: 'div',
35
- className: 'umap-map-description text',
36
- safeHTML: Utils.toHTML(this._umap.properties.description),
37
- parent: container,
38
- })
53
+ this.elements.description.innerHTML = Utils.toHTML(
54
+ this._umap.properties.description
55
+ )
56
+ } else {
57
+ this.elements.description.hidden = true
39
58
  }
40
- const datalayerContainer = DomUtil.create('div', 'datalayer-container', container)
59
+ this.elements.datalayersContainer.innerHTML = ''
41
60
  this._umap.eachDataLayerReverse((datalayer) =>
42
- this.addDataLayer(datalayer, datalayerContainer)
61
+ this.addDataLayer(datalayer, this.elements.datalayersContainer)
43
62
  )
44
- const creditsContainer = DomUtil.create('div', 'credits-container', container)
45
- this.addCredits(creditsContainer)
46
- this._umap.panel.open({ content: container }).then(() => {
63
+ this.addCredits()
64
+ this._umap.panel.open({ content: this.element }).then(() => {
47
65
  // Create the legend when the panel is actually on the DOM
48
66
  this._umap.eachDataLayerReverse((datalayer) => datalayer.renderLegend())
49
67
  })
50
68
  }
51
69
 
52
- addDataLayer(datalayer, container) {
70
+ addDataLayer(datalayer, parent) {
53
71
  if (!datalayer.options.inCaption) return
54
- const p = DomUtil.create('p', `caption-item ${datalayer.cssId}`, container)
55
- const legend = DomUtil.create('span', 'datalayer-legend', p)
56
- const headline = DomUtil.create('strong', '', p)
72
+ const template = `
73
+ <p class="caption-item ${datalayer.cssId}">
74
+ <span class="datalayer-legend"></span>
75
+ <strong data-ref="toolbox"></strong>
76
+ <span class="text" data-ref="description"></span>
77
+ </p>`
78
+ const [element, { toolbox, description }] = Utils.loadTemplateWithRefs(template)
57
79
  if (datalayer.options.description) {
58
- DomUtil.element({
59
- tagName: 'span',
60
- parent: p,
61
- safeHTML: Utils.toHTML(datalayer.options.description),
62
- })
80
+ description.innerHTML = Utils.toHTML(datalayer.options.description)
81
+ } else {
82
+ description.hidden = true
63
83
  }
64
- datalayer.renderToolbox(headline)
65
- DomUtil.add('span', '', headline, `${datalayer.options.name} `)
84
+ datalayer.renderToolbox(toolbox)
85
+ parent.appendChild(element)
86
+ // Use textContent for security
87
+ const name = Utils.loadTemplate('<span></span>')
88
+ name.textContent = datalayer.options.name
89
+ toolbox.appendChild(name)
66
90
  }
67
91
 
68
- addCredits(container) {
69
- const credits = DomUtil.createFieldset(container, translate('Credits'))
70
- let title = DomUtil.add('h5', '', credits, translate('User content credits'))
92
+ addCredits() {
71
93
  if (this._umap.properties.shortCredit || this._umap.properties.longCredit) {
72
- DomUtil.element({
73
- tagName: 'p',
74
- parent: credits,
75
- safeHTML: Utils.toHTML(
76
- this._umap.properties.longCredit || this._umap.properties.shortCredit
77
- ),
78
- })
94
+ this.elements.userCredits.innerHTML = Utils.toHTML(
95
+ this._umap.properties.longCredit || this._umap.properties.shortCredit
96
+ )
97
+ } else {
98
+ this.elements.userCredits.hidden = true
79
99
  }
80
100
  if (this._umap.properties.licence) {
81
- const licence = DomUtil.add(
82
- 'p',
83
- '',
84
- credits,
85
- `${translate('Map user content has been published under licence')} `
86
- )
87
- DomUtil.createLink(
88
- '',
89
- licence,
90
- this._umap.properties.licence.name,
91
- this._umap.properties.licence.url
92
- )
101
+ this.elements.licenceLink.href = this._umap.properties.licence.url
102
+ this.elements.licenceLink.textContent = this._umap.properties.licence.name
103
+ this.elements.noLicence.hidden = true
93
104
  } else {
94
- DomUtil.add('p', '', credits, translate('No licence has been set'))
105
+ this.elements.licence.hidden = true
95
106
  }
96
- title = DomUtil.create('h5', '', credits)
97
- title.textContent = translate('Map background credits')
98
- const tilelayerCredit = DomUtil.create('p', '', credits)
99
- DomUtil.element({
100
- tagName: 'strong',
101
- parent: tilelayerCredit,
102
- textContent: `${this._leafletMap.selectedTilelayer.options.name} `,
103
- })
104
- DomUtil.element({
105
- tagName: 'span',
106
- parent: tilelayerCredit,
107
- safeHTML: this._leafletMap.selectedTilelayer.getAttribution(),
108
- })
107
+ this.elements.bgName.textContent = this._leafletMap.selectedTilelayer.options.name
108
+ this.elements.bgAttribution.innerHTML =
109
+ this._leafletMap.selectedTilelayer.getAttribution()
109
110
  const urls = {
110
111
  leaflet: 'http://leafletjs.com',
111
112
  django: 'https://www.djangoproject.com',
@@ -113,7 +114,7 @@ export default class Caption {
113
114
  changelog: 'https://docs.umap-project.org/en/master/changelog/',
114
115
  version: this._umap.properties.umap_version,
115
116
  }
116
- const creditHTML = translate(
117
+ this.elements.poweredBy.innerHTML = translate(
117
118
  `
118
119
  Powered by <a href="{leaflet}">Leaflet</a> and
119
120
  <a href="{django}">Django</a>,
@@ -122,6 +123,5 @@ export default class Caption {
122
123
  `,
123
124
  urls
124
125
  )
125
- DomUtil.element({ tagName: 'p', innerHTML: creditHTML, parent: credits })
126
126
  }
127
127
  }
@@ -20,7 +20,7 @@ import loadPopup from '../rendering/popup.js'
20
20
  class Feature {
21
21
  constructor(umap, datalayer, geojson = {}, id = null) {
22
22
  this._umap = umap
23
- this.sync = umap.sync_engine.proxy(this)
23
+ this.sync = umap.syncEngine.proxy(this)
24
24
  this._marked_for_deletion = false
25
25
  this._isDirty = false
26
26
  this._ui = null
@@ -199,8 +199,9 @@ class Feature {
199
199
  this._umap.slideshow.current = this
200
200
  }
201
201
  this._umap.currentFeature = this
202
- this.attachPopup()
203
- this.ui.openPopup(latlng || this.center)
202
+ this.attachPopup().then(() => {
203
+ this.ui.openPopup(latlng || this.center)
204
+ })
204
205
  }
205
206
 
206
207
  render(fields) {
@@ -355,9 +356,11 @@ class Feature {
355
356
  return loadPopup(this.getOption('popupShape') || old)
356
357
  }
357
358
 
358
- attachPopup() {
359
+ async attachPopup() {
359
360
  const Class = this.getPopupClass()
360
- this.ui.bindPopup(new Class(this))
361
+ const popup = new Class(this)
362
+ this.ui.bindPopup(popup)
363
+ return popup.loadContent()
361
364
  }
362
365
 
363
366
  async confirmDelete() {
@@ -41,7 +41,7 @@ export class DataLayer extends ServerStored {
41
41
  constructor(umap, leafletMap, data = {}) {
42
42
  super()
43
43
  this._umap = umap
44
- this.sync = umap.sync_engine.proxy(this)
44
+ this.sync = umap.syncEngine.proxy(this)
45
45
  this._index = Array()
46
46
  this._features = {}
47
47
  this._geojson = null
@@ -88,7 +88,6 @@ export class DataLayer extends ServerStored {
88
88
 
89
89
  if (!this.createdOnServer) {
90
90
  if (this.showAtLoad()) this.show()
91
- this.isDirty = true
92
91
  }
93
92
 
94
93
  // Only layers that are displayed on load must be hidden/shown
@@ -151,7 +150,6 @@ export class DataLayer extends ServerStored {
151
150
  for (const field of fields) {
152
151
  this.layer.onEdit(field, builder)
153
152
  }
154
- this.redraw()
155
153
  this.show()
156
154
  break
157
155
  case 'remote-data':
@@ -592,7 +590,7 @@ export class DataLayer extends ServerStored {
592
590
  options.name = translate('Clone of {name}', { name: this.options.name })
593
591
  delete options.id
594
592
  const geojson = Utils.CopyJSON(this._geojson)
595
- const datalayer = this._umap.createDataLayer(options)
593
+ const datalayer = this._umap.createDirtyDataLayer(options)
596
594
  datalayer.fromGeoJSON(geojson)
597
595
  return datalayer
598
596
  }
@@ -611,7 +609,10 @@ export class DataLayer extends ServerStored {
611
609
  }
612
610
 
613
611
  reset() {
614
- if (!this.createdOnServer) this.erase()
612
+ if (!this.createdOnServer) {
613
+ this.erase()
614
+ return
615
+ }
615
616
 
616
617
  this.resetOptions()
617
618
  this.parentPane.appendChild(this.pane)
@@ -949,9 +950,13 @@ export class DataLayer extends ServerStored {
949
950
  else this.hide()
950
951
  }
951
952
 
952
- zoomTo(bounds) {
953
+ zoomTo() {
953
954
  if (!this.isVisible()) return
954
- bounds = bounds || this.layer.getBounds()
955
+ const bounds = this.layer.getBounds()
956
+ this.zoomToBounds(bounds)
957
+ }
958
+
959
+ zoomToBounds(bounds) {
955
960
  if (bounds.isValid()) {
956
961
  const options = { maxZoom: this.getOption('zoomTo') }
957
962
  this._leafletMap.fitBounds(bounds, options)
@@ -1063,7 +1068,7 @@ export class DataLayer extends ServerStored {
1063
1068
 
1064
1069
  setReferenceVersion({ response, sync }) {
1065
1070
  this._referenceVersion = response.headers.get('X-Datalayer-Version')
1066
- this.sync.update('_referenceVersion', this._referenceVersion)
1071
+ if (sync) this.sync.update('_referenceVersion', this._referenceVersion)
1067
1072
  }
1068
1073
 
1069
1074
  async save() {
@@ -0,0 +1,55 @@
1
+ export default class DropControl {
2
+ constructor(umap, leafletMap, dropzone) {
3
+ this._umap = umap
4
+ this._leafletMap = leafletMap
5
+ this.dropzone = dropzone
6
+ }
7
+
8
+ enable() {
9
+ this.controller = new AbortController()
10
+ this.dropzone.addEventListener('dragenter', (e) => this.dragenter(e), {
11
+ signal: this.controller.signal,
12
+ })
13
+ this.dropzone.addEventListener('dragover', (e) => this.dragover(e), {
14
+ signal: this.controller.signal,
15
+ })
16
+ this.dropzone.addEventListener('drop', (e) => this.drop(e), {
17
+ signal: this.controller.signal,
18
+ })
19
+ this.dropzone.addEventListener('dragleave', (e) => this.dragleave(e), {
20
+ signal: this.controller.signal,
21
+ })
22
+ }
23
+
24
+ disable() {
25
+ this.controller.abort()
26
+ }
27
+
28
+ dragenter(event) {
29
+ event.stopPropagation()
30
+ event.preventDefault()
31
+ this._leafletMap.scrollWheelZoom.disable()
32
+ this.dropzone.classList.add('umap-dragover')
33
+ }
34
+
35
+ dragover(event) {
36
+ event.stopPropagation()
37
+ event.preventDefault()
38
+ }
39
+
40
+ drop(event) {
41
+ this._leafletMap.scrollWheelZoom.enable()
42
+ this.dropzone.classList.remove('umap-dragover')
43
+ event.stopPropagation()
44
+ event.preventDefault()
45
+ const importer = this._umap.importer
46
+ importer.build()
47
+ importer.files = event.dataTransfer.files
48
+ importer.submit()
49
+ }
50
+
51
+ dragleave() {
52
+ this._leafletMap.scrollWheelZoom.enable()
53
+ this.dropzone.classList.remove('umap-dragover')
54
+ }
55
+ }