umap-project 2.2.1__py3-none-any.whl → 2.3.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 (144) hide show
  1. umap/__init__.py +1 -1
  2. umap/static/umap/base.css +83 -44
  3. umap/static/umap/css/icon.css +6 -0
  4. umap/static/umap/css/panel.css +9 -4
  5. umap/static/umap/img/16.svg +2 -2
  6. umap/static/umap/img/source/16.svg +3 -3
  7. umap/static/umap/js/modules/browser.js +63 -22
  8. umap/static/umap/js/modules/facets.js +14 -39
  9. umap/static/umap/js/modules/orderable.js +1 -1
  10. umap/static/umap/js/modules/schema.js +4 -4
  11. umap/static/umap/js/modules/urls.js +1 -1
  12. umap/static/umap/js/modules/utils.js +9 -1
  13. umap/static/umap/js/umap.controls.js +15 -11
  14. umap/static/umap/js/umap.core.js +17 -15
  15. umap/static/umap/js/umap.features.js +8 -2
  16. umap/static/umap/js/umap.forms.js +92 -33
  17. umap/static/umap/js/umap.js +19 -24
  18. umap/static/umap/js/umap.layer.js +3 -6
  19. umap/static/umap/locale/am_ET.js +11 -12
  20. umap/static/umap/locale/am_ET.json +11 -12
  21. umap/static/umap/locale/ar.js +11 -12
  22. umap/static/umap/locale/ar.json +11 -12
  23. umap/static/umap/locale/ast.js +11 -12
  24. umap/static/umap/locale/ast.json +11 -12
  25. umap/static/umap/locale/bg.js +11 -12
  26. umap/static/umap/locale/bg.json +11 -12
  27. umap/static/umap/locale/br.js +11 -12
  28. umap/static/umap/locale/br.json +11 -12
  29. umap/static/umap/locale/ca.js +11 -12
  30. umap/static/umap/locale/ca.json +11 -12
  31. umap/static/umap/locale/cs_CZ.js +11 -12
  32. umap/static/umap/locale/cs_CZ.json +11 -12
  33. umap/static/umap/locale/da.js +11 -12
  34. umap/static/umap/locale/da.json +11 -12
  35. umap/static/umap/locale/de.js +11 -12
  36. umap/static/umap/locale/de.json +11 -12
  37. umap/static/umap/locale/el.js +11 -12
  38. umap/static/umap/locale/el.json +11 -12
  39. umap/static/umap/locale/en.js +11 -12
  40. umap/static/umap/locale/en.json +11 -12
  41. umap/static/umap/locale/en_US.json +11 -12
  42. umap/static/umap/locale/es.js +11 -12
  43. umap/static/umap/locale/es.json +11 -12
  44. umap/static/umap/locale/et.js +11 -12
  45. umap/static/umap/locale/et.json +11 -12
  46. umap/static/umap/locale/eu.js +27 -16
  47. umap/static/umap/locale/eu.json +27 -16
  48. umap/static/umap/locale/fa_IR.js +11 -12
  49. umap/static/umap/locale/fa_IR.json +11 -12
  50. umap/static/umap/locale/fi.js +11 -12
  51. umap/static/umap/locale/fi.json +11 -12
  52. umap/static/umap/locale/fr.js +11 -12
  53. umap/static/umap/locale/fr.json +11 -12
  54. umap/static/umap/locale/gl.js +11 -12
  55. umap/static/umap/locale/gl.json +11 -12
  56. umap/static/umap/locale/he.js +11 -12
  57. umap/static/umap/locale/he.json +11 -12
  58. umap/static/umap/locale/hr.js +11 -12
  59. umap/static/umap/locale/hr.json +11 -12
  60. umap/static/umap/locale/hu.js +29 -30
  61. umap/static/umap/locale/hu.json +29 -30
  62. umap/static/umap/locale/id.js +11 -12
  63. umap/static/umap/locale/id.json +11 -12
  64. umap/static/umap/locale/is.js +11 -12
  65. umap/static/umap/locale/is.json +11 -12
  66. umap/static/umap/locale/it.js +11 -12
  67. umap/static/umap/locale/it.json +11 -12
  68. umap/static/umap/locale/ja.js +11 -12
  69. umap/static/umap/locale/ja.json +11 -12
  70. umap/static/umap/locale/ko.js +11 -12
  71. umap/static/umap/locale/ko.json +11 -12
  72. umap/static/umap/locale/lt.js +11 -12
  73. umap/static/umap/locale/lt.json +11 -12
  74. umap/static/umap/locale/ms.js +20 -21
  75. umap/static/umap/locale/ms.json +20 -21
  76. umap/static/umap/locale/nl.js +11 -12
  77. umap/static/umap/locale/nl.json +11 -12
  78. umap/static/umap/locale/no.js +11 -12
  79. umap/static/umap/locale/no.json +11 -12
  80. umap/static/umap/locale/pl.js +11 -12
  81. umap/static/umap/locale/pl.json +11 -12
  82. umap/static/umap/locale/pl_PL.json +11 -12
  83. umap/static/umap/locale/pt.js +11 -12
  84. umap/static/umap/locale/pt.json +11 -12
  85. umap/static/umap/locale/pt_BR.js +11 -12
  86. umap/static/umap/locale/pt_BR.json +11 -12
  87. umap/static/umap/locale/pt_PT.js +11 -12
  88. umap/static/umap/locale/pt_PT.json +11 -12
  89. umap/static/umap/locale/ro.js +11 -12
  90. umap/static/umap/locale/ro.json +11 -12
  91. umap/static/umap/locale/ru.js +11 -12
  92. umap/static/umap/locale/ru.json +11 -12
  93. umap/static/umap/locale/si.js +240 -227
  94. umap/static/umap/locale/si.json +240 -227
  95. umap/static/umap/locale/sk_SK.js +11 -12
  96. umap/static/umap/locale/sk_SK.json +11 -12
  97. umap/static/umap/locale/sl.js +11 -12
  98. umap/static/umap/locale/sl.json +11 -12
  99. umap/static/umap/locale/sr.js +11 -12
  100. umap/static/umap/locale/sr.json +11 -12
  101. umap/static/umap/locale/sv.js +11 -12
  102. umap/static/umap/locale/sv.json +11 -12
  103. umap/static/umap/locale/th_TH.js +11 -12
  104. umap/static/umap/locale/th_TH.json +11 -12
  105. umap/static/umap/locale/tr.js +11 -12
  106. umap/static/umap/locale/tr.json +11 -12
  107. umap/static/umap/locale/uk_UA.js +11 -12
  108. umap/static/umap/locale/uk_UA.json +11 -12
  109. umap/static/umap/locale/vi.js +11 -12
  110. umap/static/umap/locale/vi.json +11 -12
  111. umap/static/umap/locale/vi_VN.json +11 -12
  112. umap/static/umap/locale/zh.js +11 -12
  113. umap/static/umap/locale/zh.json +11 -12
  114. umap/static/umap/locale/zh_CN.json +11 -12
  115. umap/static/umap/locale/zh_TW.Big5.json +11 -12
  116. umap/static/umap/locale/zh_TW.js +11 -12
  117. umap/static/umap/locale/zh_TW.json +11 -12
  118. umap/static/umap/map.css +17 -2
  119. umap/static/umap/unittests/utils.js +7 -0
  120. umap/static/umap/vars.css +10 -0
  121. umap/static/umap/vendors/dompurify/purify.es.js +54 -5
  122. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -0
  123. umap/tests/integration/conftest.py +5 -4
  124. umap/tests/integration/test_browser.py +7 -0
  125. umap/tests/integration/test_choropleth.py +1 -1
  126. umap/tests/integration/test_draw_polygon.py +6 -0
  127. umap/tests/integration/test_draw_polyline.py +6 -0
  128. umap/tests/integration/test_edit_datalayer.py +5 -5
  129. umap/tests/integration/test_edit_map.py +4 -4
  130. umap/tests/integration/test_edit_marker.py +6 -6
  131. umap/tests/integration/test_edit_polygon.py +6 -6
  132. umap/tests/integration/test_facets_browser.py +82 -13
  133. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/METADATA +8 -7
  134. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/RECORD +137 -143
  135. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/WHEEL +1 -1
  136. umap/.DS_Store +0 -0
  137. umap/static/.DS_Store +0 -0
  138. umap/static/umap/.DS_Store +0 -0
  139. umap/static/umap/favicons/.DS_Store +0 -0
  140. umap/static/umap/fonts/.DS_Store +0 -0
  141. umap/tests/.DS_Store +0 -0
  142. umap/tests/integration/.DS_Store +0 -0
  143. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/entry_points.txt +0 -0
  144. {umap_project-2.2.1.dist-info → umap_project-2.3.0.dist-info}/licenses/LICENSE +0 -0
umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "2.2.1"
1
+ VERSION = "2.3.0"
umap/static/umap/base.css CHANGED
@@ -159,6 +159,51 @@ input[type="range"] {
159
159
  input[type="checkbox"] {
160
160
  margin: 0 5px;
161
161
  vertical-align: middle;
162
+ appearance: none;
163
+ }
164
+ input[type="checkbox"]:after {
165
+ display: inline-block;
166
+ content: ' ';
167
+ width: 12px;
168
+ height: 12px;
169
+ border: 1px solid var(--color-lightGray);
170
+ cursor: pointer;
171
+ text-align: center;
172
+ font-size: 1.3rem;
173
+ line-height: 1rem;
174
+ }
175
+ input[type=checkbox]:checked:after {
176
+ background-color: var(--color-lightCyan);
177
+ content: '✓';
178
+ }
179
+ label input[type="radio"] {
180
+ appearance: none;
181
+ margin-right: 10px;
182
+ }
183
+ input[type="radio"]:after {
184
+ display: inline-block;
185
+ content: ' ';
186
+ width: 12px;
187
+ height: 12px;
188
+ border-radius: 50%;
189
+ border: 1px solid var(--color-lightGray);
190
+ cursor: pointer;
191
+ text-align: center;
192
+ font-size: 1.3rem;
193
+ line-height: 1rem;
194
+ vertical-align: bottom;
195
+ }
196
+ label input[type="radio"]:checked:after {
197
+ background-color: var(--color-lightCyan);
198
+ content: '•';
199
+ font-size: 3rem;
200
+ line-height: 1.1rem;
201
+ color: var(--color-darkGray);
202
+ }
203
+
204
+ input[data-modified=true] {
205
+ background-color: var(--color-lightCyan);
206
+ border: 1px solid var(--color-darkGray);
162
207
  }
163
208
  textarea {
164
209
  height: inherit;
@@ -263,9 +308,6 @@ input[type="checkbox"] + label {
263
308
  display: inline;
264
309
  padding: 0 14px;
265
310
  }
266
- label input[type="radio"] {
267
- margin-right: 10px;
268
- }
269
311
  select + .error,
270
312
  input + .error {
271
313
  display: block;
@@ -290,67 +332,59 @@ input:invalid {
290
332
  border-color: #1b1f20;
291
333
  color: #efefef;
292
334
  }
293
- .fieldset {
335
+ details {
294
336
  margin-bottom: 5px;
295
337
  border-top-left-radius: 4px;
296
338
  border-top-right-radius: 4px;
297
339
  }
298
- .dark .fieldset {
340
+ .dark details {
299
341
  border: 1px solid #222;
300
342
  }
301
- .fieldset .fields {
302
- visibility: hidden;
303
- opacity: 0;
304
- transition: visibility 0s, opacity 0.5s linear;
305
- height: 0;
343
+ details fieldset {
306
344
  overflow: hidden;
345
+ border: 1px solid var(--color-lightGray);
346
+ margin: 0;
347
+ padding-top: 10px;
307
348
  }
308
- .fieldset.toggle.on .fields {
309
- visibility: visible;
310
- opacity: 1;
311
- height: initial;
312
- padding: 10px;
313
- }
314
- .fieldset.toggle .legend {
315
- text-align: left;
316
- display: block;
349
+ details summary {
317
350
  cursor: pointer;
318
351
  background-color: var(--color-lightGray);
319
- height: 30px;
320
352
  line-height: 30px;
321
- margin: 0;
322
- font-family: fira_sans;
323
- font-weight: normal;
324
353
  font-size: 1.2em;
325
354
  padding: 0 5px;
326
355
  }
327
- .dark .fieldset.toggle .legend {
356
+ .dark details summary {
328
357
  background-color: #232729;
329
358
  color: #fff;
330
359
  }
331
- .fieldset.toggle .legend:before {
332
- background-repeat: no-repeat;
333
- text-indent: 24px;
334
- height: 24px;
335
- width: 24px;
336
- line-height: 24px;
337
- display: inline-block;
338
- background-image: url('./img/16.svg');
339
- vertical-align: bottom;
340
- content: " ";
341
- background-position: -144px -76px;
342
- }
343
- .dark .fieldset.toggle .legend:before {
344
- background-image: url('./img/16-white.svg');
345
- }
346
- .fieldset.toggle.on .legend:before {
347
- background-position: -144px -51px;
360
+ .dark details fieldset {
361
+ border: 1px solid var(--color-darkGray);
348
362
  }
349
363
  fieldset legend {
350
364
  font-size: 1.1rem;
351
365
  padding: 0 5px;
352
366
  }
353
367
 
368
+ [data-badge] {
369
+ position: relative;
370
+ }
371
+ [data-badge]:after {
372
+ position: absolute;
373
+ right: -6px;
374
+ top: -6px;
375
+ min-width: 8px;
376
+ min-height: 8px;
377
+ line-height: 8px;
378
+ padding: 2px;
379
+ font-weight: bold;
380
+ background-color: var(--color-accent);
381
+ color: var(--color-darkBlue);
382
+ text-align: center;
383
+ font-size: .75rem;
384
+ border-radius: 50%;
385
+ content: attr(data-badge);
386
+ }
387
+
354
388
  /* Switch */
355
389
  input.switch:empty {
356
390
  display: none;
@@ -408,11 +442,16 @@ input.switch:checked:empty ~ label:after {
408
442
  }
409
443
  .dark input.switch:checked ~ label:before,
410
444
  input.switch:checked ~ label:before {
411
- background-color: #215d9c;
445
+ background-color: var(--color-lightCyan);
446
+ border: 1px solid var(--color-lightGray);
447
+ color: var(--color-darkGray);
412
448
  content: "ON";
413
449
  text-indent: 0.7em;
414
450
  text-align: left;
415
451
  font-weight: bold;
452
+ .dark input.switch:checked ~ label:before {
453
+ border: none;
454
+ }
416
455
  }
417
456
  input.switch:checked ~ label:after {
418
457
  margin-left: 3em;
@@ -458,9 +497,9 @@ input.switch:checked ~ label:after {
458
497
  background-color: #2c3233;
459
498
  }
460
499
  .umap-multiplechoice input[type='radio']:checked + label {
461
- background-color: #215d9c;
500
+ background-color: var(--color-lightCyan);
462
501
  box-shadow: inset 0 0 6px 0px #2c3233;
463
- color: #ededed;
502
+ color: var(--color-darkGray);
464
503
  }
465
504
  .inheritable .header,
466
505
  .inheritable {
@@ -55,6 +55,9 @@
55
55
  .off .icon-edit {
56
56
  background-position: -51px -73px;
57
57
  }
58
+ .icon-filters {
59
+ background-position: -4px -24px;
60
+ }
58
61
  .icon-key {
59
62
  background-position: -144px -121px;
60
63
  }
@@ -76,6 +79,9 @@
76
79
  .icon-resize {
77
80
  background-position: -74px -144px;
78
81
  }
82
+ .icon-restore {
83
+ background-position: -121px -74px;
84
+ }
79
85
  .expanded .icon-resize {
80
86
  background-position: -50px -144px;
81
87
  }
@@ -6,7 +6,7 @@
6
6
  bottom: var(--panel-bottom);
7
7
  overflow-x: auto;
8
8
  z-index: 1010;
9
- background-color: #fff;
9
+ background-color: var(--background-color);
10
10
  opacity: 0.98;
11
11
  cursor: initial;
12
12
  border-radius: 5px;
@@ -14,7 +14,6 @@
14
14
  }
15
15
  .panel.dark {
16
16
  border: 1px solid #222;
17
- background-color: var(--color-darkGray);
18
17
  color: #efefef;
19
18
  }
20
19
  .panel.full {
@@ -90,6 +89,7 @@
90
89
  top: 0;
91
90
  margin-top: var(--panel-gutter);
92
91
  width: var(--panel-width);
92
+ max-width: calc(100% - var(--panel-gutter) * 2 - var(--control-size))
93
93
  }
94
94
  .panel.condensed {
95
95
  max-height: 500px;
@@ -129,12 +129,17 @@
129
129
  left: 0;
130
130
  visibility: visible;
131
131
  }
132
- .panel li.umap-resize-link {
133
- display: none;
132
+ .panel.expanded {
133
+ height: 100%;
134
+ max-height: 100%;
134
135
  }
135
136
  .umap-caption-bar-enabled .panel {
136
137
  bottom: var(--footer-height);
137
138
  border-bottom-left-radius: 0;
138
139
  border-bottom-right-radius: 0;
139
140
  }
141
+ .umap-caption-bar-enabled .panel.expanded {
142
+ height: calc(100% - var(--footer-height));
143
+ max-height: calc(100% - var(--footer-height));
144
+ }
140
145
  }
@@ -28,7 +28,6 @@
28
28
  <path id="rect3787" d="m2 1047.9 13-10 1 1-13 10z"/>
29
29
  </g>
30
30
  <path id="table-disabled" d="m78 819.36v2h12v-2zm0 3v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1z" fill="#b3b3b3"/>
31
- <path id="add-disabled" d="m35 843.36v4h-4v2h4v4h2v-4h4v-2h-4v-4z" fill="#f2f2f2"/>
32
31
  <path id="zoom" d="m13.518 866.36c-2.4668 0-4.4825 2.0158-4.4825 4.4826 0 0.8297 0.23375 1.5964 0.63035 2.2646l-3.6654 3.6653 1.5875 1.5876 3.6654-3.6654c0.66814 0.3966 1.4348 0.6303 2.2646 0.6303 2.4668 0 4.4825-2.0157 4.4825-4.4824 0-2.4668-2.0157-4.4826-4.4825-4.4826zm0 1.4943c1.6593 0 2.9883 1.329 2.9883 2.9883 0 1.6592-1.3291 2.9883-2.9883 2.9883s-2.9883-1.3291-2.9883-2.9883c0-1.6593 1.3291-2.9883 2.9883-2.9883zm0 1.4941c-0.81635 0-1.4942 0.6779-1.4942 1.4942s0.67781 1.4942 1.4942 1.4942 1.4942-0.6779 1.4942-1.4942-0.67781-1.4942-1.4942-1.4942z" color="#000000" fill="#4d4d4d" style="text-decoration-line:none;text-indent:0;text-transform:none"/>
33
32
  <path id="zoom-disabled" d="m37.518 866.36c-2.4668 0-4.4825 2.0157-4.4825 4.4825 0 0.8298 0.23375 1.5964 0.63035 2.2645l-3.6654 3.6655 1.5875 1.5875 3.6654-3.6654c0.66814 0.39662 1.4348 0.63042 2.2646 0.63042 2.4668 0 4.4825-2.0157 4.4825-4.4825s-2.0157-4.4825-4.4825-4.4825zm0 1.4942c1.6593 0 2.9883 1.329 2.9883 2.9883s-1.3291 2.9883-2.9883 2.9883-2.9883-1.329-2.9883-2.9883 1.3291-2.9883 2.9883-2.9883zm0 1.4941c-0.81636 0-1.4942 0.6779-1.4942 1.4942s0.67781 1.4942 1.4942 1.4942 1.4942-0.6779 1.4942-1.4942-0.67781-1.4942-1.4942-1.4942z" color="#000000" fill="#b3b3b3" style="text-decoration-line:none;text-indent:0;text-transform:none"/>
34
33
  <path id="path5321" d="m36 889.36c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7s7-3.134 7-7c0-3.866-3.134-7-7-7zm-0.15625 2.9687a1.0001 1.0001 0 0 1 0.09375 0 1.0001 1.0001 0 0 1 0.65625 1.8125l-1.625 1.2188h5.0312a1.0001 1.0001 0 1 1 0 2h-5l1.5938 1.1875a1.0001 1.0001 0 1 1-1.1875 1.5937l-3.7188-2.7812a1.0044 1.0044 0 0 1-0.15625-1.9063l3.875-2.9062a1.0001 1.0001 0 0 1 0.4375-0.2188z" fill="#f2f2f2"/>
@@ -36,7 +35,8 @@
36
35
  <path id="path5340" d="m12 913.36c-3.866 0-7 3.134-7 7 0 3.8661 3.134 7.0001 7 7.0001s7-3.134 7-7.0001c0-3.866-3.134-7-7-7zm-0.15625 1.7187a1.2501 1.2501 0 0 1 0.125 0 1.2501 1.2501 0 0 1 1.2812 1.2813v2.75h2.75a1.2501 1.2501 0 1 1 0 2.5h-2.75v2.7501a1.2501 1.2501 0 1 1-2.5 0v-2.7501h-2.75a1.2516 1.2516 0 0 1-0.125-2.5 1.2501 1.2501 0 0 1 0.125 0h2.75v-2.75a1.2501 1.2501 0 0 1 1.0938-1.2813z" fill="#f2f2f2"/>
37
36
  <path id="table" d="m54 819.36v2h12v-2zm0 3v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1zm-5 2v1h4v-1zm5 0v1h7v-1z" fill="#464646"/>
38
37
  <path id="close-9" d="m32.353 820.01-0.70703 0.70704 3.6465 3.6465-3.6465 3.6465 0.70703 0.70704 3.6465-3.6465 3.6465 3.6465 0.70703-0.70704-3.6465-3.6465 3.6465-3.6465-0.70703-0.70704-3.6465 3.6465z" color="#000000" fill="#4d4d4d" fill-rule="evenodd"/>
39
- <path id="add" d="m11.192 853.36 2e-6 -4.1999-4.1923 1e-5 -3e-6 -1.6267h4.1923v-4.1733l1.6088 7e-3 0.0067 4.1666h4.1923l-3.9e-5 1.6266-4.1922 4e-5 -1.5e-5 4.1999h-1.6155" fill="#4d4d4d"/>
38
+ <path id="add" d="m35.192 853.36 2e-6 -4.1999-4.1923 1e-5 -3e-6 -1.6267h4.1923v-4.1733l1.6088 7e-3 0.0067 4.1666h4.1923l-3.9e-5 1.6266-4.1922 4e-5 -1.5e-5 4.1999h-1.6155" fill="#4d4d4d"/>
39
+ <path id="path1-3" d="m16.557 844.08c0.12973-0.17297 0.25946-0.38919 0.3027-0.64865h2.6811c0.25946 0 0.43243-0.17297 0.43243-0.43243s-0.17297-0.43243-0.43243-0.43243h-2.6811c-0.08649-0.38919-0.34595-0.77838-0.69189-1.0378-0.82162-0.60541-1.9459-0.38919-2.5081 0.38919-0.12973 0.17297-0.21622 0.38919-0.3027 0.64865h-8.9514c-0.25946 0-0.43243 0.17297-0.43243 0.43243s0.17297 0.43243 0.43243 0.43243h8.9514c0.08649 0.38919 0.34595 0.77838 0.69189 1.0378 0.77838 0.6054 1.9459 0.43243 2.5081-0.38919zm-1.9892-0.3027c-0.21622-0.12973-0.34595-0.34595-0.38919-0.60541-0.04324-0.25946 0-0.47567 0.17297-0.69189 0.3027-0.43243 0.90811-0.51892 1.2973-0.21622 0.21622 0.12973 0.34595 0.34595 0.38919 0.60541v0.12973c0 0.21621-0.04324 0.38919-0.17297 0.56216-0.3027 0.43243-0.90811 0.51892-1.2973 0.21622zm-4.4108 5.2324c0.12973-0.17297 0.25946-0.38919 0.3027-0.64865h9.0811c0.25946 0 0.43243-0.17297 0.43243-0.43243s-0.17297-0.43243-0.43243-0.43243h-9.0811c-0.08649-0.38919-0.34594-0.77838-0.69189-1.0378-0.82162-0.60541-1.9459-0.38919-2.5081 0.38919-0.12973 0.17297-0.21622 0.38919-0.3027 0.64865h-2.5514c-0.25946 0-0.43243 0.17297-0.43243 0.43243s0.17297 0.43243 0.43243 0.43243h2.5514c0.086486 0.38919 0.34595 0.77838 0.69189 1.0378 0.77838 0.56216 1.9027 0.38919 2.5081-0.38919zm-1.9892-0.34595c-0.21622-0.12973-0.34595-0.34594-0.38919-0.6054-0.043243-0.25946 0-0.47568 0.17297-0.69189 0.3027-0.43244 0.90811-0.51892 1.2973-0.21622 0.21622 0.12973 0.34595 0.34595 0.38919 0.60541v0.12973c0 0.21621-0.043243 0.38918-0.17297 0.56216-0.3027 0.43243-0.90811 0.51892-1.2973 0.21621zm6.7027 5.2324c0.12973-0.17298 0.25946-0.38919 0.3027-0.64865h4.3676c0.25946 0 0.43243-0.17298 0.43243-0.43244 0-0.25945-0.17297-0.43243-0.43243-0.43243h-4.3676c-0.08649-0.38919-0.34595-0.77838-0.69189-1.0378-0.38919-0.3027-0.86486-0.38918-1.3405-0.34594-0.47568 0.0865-0.90811 0.34594-1.1676 0.73513-0.12973 0.21622-0.21622 0.38919-0.3027 0.64865h-7.2649c-0.25946 0-0.43243 0.17298-0.43243 0.43243 0 0.25946 0.17297 0.43244 0.43243 0.43244h7.3081c0.08649 0.38919 0.34594 0.77838 0.69189 1.0378 0.77838 0.56216 1.9027 0.38918 2.4649-0.38919zm-1.9892-0.30271c-0.21622-0.17297-0.34595-0.38919-0.38919-0.64865v-0.0865-0.0865c0-0.17297 0.08649-0.3027 0.17297-0.43243 0.12973-0.21622 0.34595-0.34595 0.6054-0.38919 0.25946-0.0432 0.47568 0.0432 0.69189 0.17297 0.21622 0.12973 0.34595 0.34595 0.38919 0.60541v0.12973c0 0.21621-0.04324 0.38919-0.17297 0.56216-0.3027 0.38919-0.86486 0.47568-1.2973 0.17297z" fill="#4d4d4d"/>
40
40
  <path id="edit" d="m63.714 866.36-1.1428 1.1429 2.2857 2.2857 1.1428-1.1429zm-1.7143 1.7143-6.2857 6.2857 2.2857 2.2857 6.2857-6.2857zm-6.2857 6.2857-1.7143 4 4-1.7143z" fill="#4d4d4d"/>
41
41
  <text id="text4457-6" x="39.647079" y="918.79706" fill="#000000" font-family="sans-serif" letter-spacing="0px" word-spacing="0px" style="line-height:0%" xml:space="preserve"><tspan id="tspan4459-6" x="39.647079" y="918.79706" font-family="sans-serif" font-size="30.476px" style="line-height:1.25"> </tspan></text>
42
42
  <g id="text4356-2" transform="translate(44,-124)" fill="#fff" stroke="#000" stroke-width=".1">
@@ -10,7 +10,7 @@
10
10
  <path d="M 16.0401,2.3158 H 2.005 v 14.0351 h 14.0351 z" fill="#ffffff" id="path2351" />
11
11
  </mask>
12
12
  </defs>
13
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="21.380532" inkscape:cx="34.119824" inkscape:cy="18.264279" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" inkscape:snap-grids="true" inkscape:snap-to-guides="true" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1">
13
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="8.783299" inkscape:cx="35.578887" inkscape:cy="40.702246" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" inkscape:snap-grids="true" inkscape:snap-to-guides="true" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1">
14
14
  <inkscape:grid type="xygrid" id="grid3004" empspacing="4" visible="true" enabled="true" snapvisiblegridlinesonly="true" originx="0" originy="0" spacingy="1" spacingx="1" units="px" />
15
15
  <sodipodi:guide orientation="-1,0" position="24,168" id="guide3084" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
16
16
  <sodipodi:guide orientation="0,1" position="0,120" id="guide3086" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
@@ -46,7 +46,6 @@
46
46
  <path sodipodi:nodetypes="ccccc" inkscape:connector-curvature="0" id="rect3787" d="m 2,1047.8622 13,-10 1,1 -13,10 z" style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none" />
47
47
  </g>
48
48
  <path style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 78,819.36214 v 2 h 12 v -2 z m 0,3 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z" id="table-disabled" inkscape:connector-curvature="0" inkscape:label="" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/browse-data.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" />
49
- <path style="fill:#f2f2f2;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 35,843.36218 v 4 h -4 v 2 h 4 v 4 h 2 v -4 h 4 v -2 h -4 v -4 z" id="add-disabled" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/add-layer-grey-18.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccc" />
50
49
  <path style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:Sans;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:3;marker:none;enable-background:accumulate" d="m 13.51751,866.36211 c -2.466762,0 -4.48249,2.0158 -4.48249,4.4826 0,0.8297 0.233748,1.5964 0.63035,2.26462 L 6,876.77465 l 1.587549,1.5876 3.66537,-3.66542 c 0.668139,0.3966 1.434831,0.6303 2.264591,0.6303 2.466762,0 4.48249,-2.0157 4.48249,-4.48242 0,-2.4668 -2.015728,-4.4826 -4.48249,-4.4826 z m 0,1.4943 c 1.659256,0 2.988326,1.329 2.988326,2.9883 0,1.6592 -1.32907,2.98832 -2.988326,2.98832 -1.659256,0 -2.988326,-1.32912 -2.988326,-2.98832 0,-1.6593 1.32907,-2.9883 2.988326,-2.9883 z m 0,1.4941 c -0.816354,0 -1.494163,0.6779 -1.494163,1.4942 0,0.8163 0.677809,1.4942 1.494163,1.4942 0.816354,0 1.494163,-0.6779 1.494163,-1.4942 0,-0.8163 -0.677809,-1.4942 -1.494163,-1.4942 z" id="zoom" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/zoom_to.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" inkscape:connector-curvature="0" />
51
50
  <path id="zoom-disabled" d="m 37.51751,866.36216 c -2.466762,0 -4.482491,2.0157 -4.482491,4.4825 0,0.8298 0.233749,1.5964 0.630351,2.2645 L 30,876.7747 l 1.587549,1.5875 3.665369,-3.66544 c 0.668139,0.39662 1.434831,0.63042 2.264592,0.63042 2.466762,0 4.48249,-2.01572 4.48249,-4.48252 0,-2.4668 -2.015728,-4.4825 -4.48249,-4.4825 z m 0,1.4942 c 1.659256,0 2.988327,1.329 2.988327,2.9883 0,1.6593 -1.329071,2.9883 -2.988327,2.9883 -1.659256,0 -2.988327,-1.329 -2.988327,-2.9883 0,-1.6593 1.329071,-2.9883 2.988327,-2.9883 z m 0,1.4941 c -0.816355,0 -1.494164,0.6779 -1.494164,1.4942 0,0.8163 0.677809,1.4942 1.494164,1.4942 0.816355,0 1.494163,-0.6779 1.494163,-1.4942 0,-0.8163 -0.677808,-1.4942 -1.494163,-1.4942 z" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:Sans;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#b3b3b3;fill-opacity:1;stroke:none;stroke-width:3;marker:none;enable-background:accumulate" inkscape:connector-curvature="0" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/zoom_to-off.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" />
52
51
  <path inkscape:connector-curvature="0" style="fill:#f2f2f2;fill-opacity:1;stroke:none" d="m 36,889.36215 c -3.865993,0 -7,3.134 -7,7 0,3.86602 3.134007,7.00005 7,7.00005 3.865993,0 7,-3.13404 7,-7.00005 0,-3.866 -3.134007,-7 -7,-7 z m -0.15625,2.9687 a 1.0001,1.0001 0 0 1 0.09375,0 1.0001,1.0001 0 0 1 0.65625,1.8125 l -1.625,1.2188 H 40 a 1.0001,1.0001 0 1 1 0,2 h -5 l 1.59375,1.1875 a 1.0001,1.0001 0 1 1 -1.1875,1.59372 l -3.71875,-2.78122 a 1.0043849,1.0043849 0 0 1 -0.15625,-1.9063 l 3.875,-2.9062 a 1.0001,1.0001 0 0 1 0.4375,-0.2188 z" id="path5321" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/arrow-left-16.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" />
@@ -55,7 +54,8 @@
55
54
  <path style="fill:#464646;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 54,819.36218 v 2 h 12 v -2 z m 0,3 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z m -5,2 v 1 h 4 v -1 z m 5,0 v 1 h 7 v -1 z" id="table" inkscape:connector-curvature="0" inkscape:label="" inkscape:export-filename="/home/ybon/Code/js/leaflet-storage/src/img/browse-data.png" inkscape:export-xdpi="89.996864" inkscape:export-ydpi="89.996864" />
56
55
  <g transform="translate(32,-54.000118)" style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none" id="text3784-6" />
57
56
  <path id="close-9" style="color:#000000;fill:#4d4d4d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.188976;stroke-dasharray:none;stroke-opacity:1" d="m 32.353032,820.00818 -0.707032,0.70704 3.646485,3.64648 -3.646485,3.64648 0.707032,0.70704 3.646484,-3.64649 3.646484,3.64649 0.707032,-0.70704 -3.646485,-3.64648 3.646485,-3.64648 -0.707032,-0.70704 -3.646484,3.64649 z" />
58
- <path inkscape:connector-curvature="0" d="m 11.192241,853.36196 2e-6,-4.19993 -4.192255,1e-5 -3e-6,-1.62667 h 4.192263 v -4.17331 l 1.608812,0.007 0.0067,4.16664 h 4.192255 l -3.9e-5,1.62662 -4.19222,4e-5 -1.5e-5,4.19994 h -1.615475" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none" id="add" />
57
+ <path inkscape:connector-curvature="0" d="m 35.192241,853.36196 2e-6,-4.19993 -4.192255,1e-5 -3e-6,-1.62667 h 4.192263 v -4.17331 l 1.608812,0.007 0.0067,4.16664 h 4.192255 l -3.9e-5,1.62662 -4.19222,4e-5 -1.5e-5,4.19994 h -1.615475" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none" id="add" />
58
+ <path d="m 16.556757,844.0811 c 0.129729,-0.17297 0.259459,-0.38919 0.302702,-0.64865 h 2.681081 c 0.25946,0 0.432433,-0.17297 0.432433,-0.43243 0,-0.25946 -0.172973,-0.43243 -0.432433,-0.43243 h -2.681081 c -0.08649,-0.38919 -0.345946,-0.77838 -0.691891,-1.03784 -0.821622,-0.60541 -1.945946,-0.38919 -2.508109,0.38919 -0.129729,0.17297 -0.216216,0.38919 -0.302702,0.64865 h -8.9513515 c -0.2594595,0 -0.4324325,0.17297 -0.4324325,0.43243 0,0.25946 0.172973,0.43243 0.4324325,0.43243 h 8.9513515 c 0.08649,0.38919 0.345946,0.77838 0.691892,1.03784 0.778378,0.6054 1.945946,0.43243 2.508108,-0.38919 z m -1.989189,-0.3027 c -0.216217,-0.12973 -0.345946,-0.34595 -0.38919,-0.60541 -0.04324,-0.25946 0,-0.47567 0.172973,-0.69189 0.302703,-0.43243 0.908109,-0.51892 1.297298,-0.21622 0.216216,0.12973 0.345946,0.34595 0.389189,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0.21621 -0.04324,0.38919 -0.172973,0.56216 -0.302703,0.43243 -0.908108,0.51892 -1.297297,0.21622 z m -4.410811,5.23243 c 0.129729,-0.17297 0.259459,-0.38919 0.302702,-0.64865 h 9.081081 c 0.25946,0 0.432433,-0.17297 0.432433,-0.43243 0,-0.25946 -0.172973,-0.43243 -0.432433,-0.43243 h -9.081081 c -0.08649,-0.38919 -0.345945,-0.77838 -0.6918914,-1.03784 -0.8216216,-0.60541 -1.9459459,-0.38919 -2.5081081,0.38919 -0.1297297,0.17297 -0.2162162,0.38919 -0.3027027,0.64865 h -2.5513513 c -0.2594595,0 -0.4324325,0.17297 -0.4324325,0.43243 0,0.25946 0.172973,0.43243 0.4324325,0.43243 h 2.5513513 c 0.086486,0.38919 0.3459459,0.77838 0.6918919,1.03784 0.7783784,0.56216 1.9027027,0.38919 2.5081083,-0.38919 z m -1.9891894,-0.34595 c -0.2162162,-0.12973 -0.3459459,-0.34594 -0.3891892,-0.6054 -0.043243,-0.25946 0,-0.47568 0.172973,-0.69189 0.3027027,-0.43244 0.9081081,-0.51892 1.2972973,-0.21622 0.2162162,0.12973 0.3459459,0.34595 0.3891892,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0 0,0 0,0 0,0 0,0 0,0 0,0.21621 -0.043243,0.38918 -0.172973,0.56216 -0.3027027,0.43243 -0.9081081,0.51892 -1.2972973,0.21621 z m 6.7027024,5.23244 c 0.12973,-0.17298 0.25946,-0.38919 0.302703,-0.64865 h 4.367567 c 0.25946,0 0.432433,-0.17298 0.432433,-0.43244 0,-0.25945 -0.172973,-0.43243 -0.432433,-0.43243 h -4.367567 c -0.08649,-0.38919 -0.345946,-0.77838 -0.691892,-1.03784 -0.389189,-0.3027 -0.864865,-0.38918 -1.34054,-0.34594 -0.475676,0.0865 -0.908109,0.34594 -1.167568,0.73513 -0.12973,0.21622 -0.216216,0.38919 -0.302703,0.64865 h -7.2648645 c -0.2594595,0 -0.4324325,0.17298 -0.4324325,0.43243 0,0.25946 0.172973,0.43244 0.4324325,0.43244 h 7.3081085 c 0.08649,0.38919 0.345945,0.77838 0.691891,1.03784 0.778379,0.56216 1.902703,0.38918 2.464865,-0.38919 z m -1.989189,-0.30271 c -0.216216,-0.17297 -0.345946,-0.38919 -0.389189,-0.64865 0,-0.0432 0,-0.0865 0,-0.0865 0,-0.0433 0,-0.0865 0,-0.0865 0,-0.17297 0.08649,-0.3027 0.172973,-0.43243 0.12973,-0.21622 0.345946,-0.34595 0.605405,-0.38919 0.25946,-0.0432 0.475676,0.0432 0.691892,0.17297 0.216216,0.12973 0.345946,0.34595 0.389189,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0 0,0 0,0 0,0 0,0 0,0 0,0.21621 -0.04324,0.38919 -0.172973,0.56216 -0.302702,0.38919 -0.864864,0.47568 -1.297297,0.17297 z" id="path1-3" style="stroke-width:1;fill:#4d4d4d;fill-opacity:1" />
59
59
  <path style="fill:#4d4d4d;fill-opacity:1;stroke:none" d="m 63.71429,866.36218 -1.14285,1.14286 2.28571,2.28572 L 66,868.6479 Z M 62,868.07646 l -6.285714,6.28574 2.285715,2.2857 6.285719,-6.28572 z M 55.714286,874.3622 54,878.36219 58.000001,876.6479 Z" id="edit" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccccc" />
60
60
  <text xml:space="preserve" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" x="39.647079" y="918.79706" id="text4457-6"><tspan y="918.79706" x="39.647079" sodipodi:role="line" id="tspan4459-6" style="font-size:30.4762px;line-height:1.25;font-family:sans-serif"> </tspan></text>
61
61
  <g id="text4356-2" style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-dasharray:none;stroke-opacity:1" transform="translate(44,-124)">
@@ -9,11 +9,22 @@ export default class Browser {
9
9
  filter: '',
10
10
  inBbox: false,
11
11
  }
12
+ this._mode = 'layers'
13
+ }
14
+
15
+ set mode(value) {
16
+ // Store the mode so we can respect it when we redraw
17
+ if (['data', 'filters'].includes(value)) this.map.panel.mode = 'expanded'
18
+ else if (value === 'layers') this.map.panel.mode = 'condensed'
19
+ this._mode = value
20
+ }
21
+
22
+ get mode() {
23
+ return this._mode
12
24
  }
13
25
 
14
26
  addFeature(feature, parent) {
15
- const filter = this.options.filter
16
- if (filter && !feature.matchFilter(filter, this.filterKeys)) return
27
+ if (feature.isFiltered()) return
17
28
  if (this.options.inBbox && !feature.isOnScreen(this.bounds)) return
18
29
  const row = DomUtil.create('li', `${feature.getClassName()} feature`)
19
30
  const zoom_to = DomUtil.createButtonIcon(
@@ -98,15 +109,29 @@ export default class Browser {
98
109
  counter.title = translate(`Features in this layer: ${count}`)
99
110
  }
100
111
 
112
+ toggleBadge() {
113
+ U.Utils.toggleBadge(this.filtersTitle, this.hasFilters())
114
+ U.Utils.toggleBadge('.umap-control-browse', this.hasFilters())
115
+ }
116
+
101
117
  onFormChange() {
102
118
  this.map.eachBrowsableDataLayer((datalayer) => {
103
119
  datalayer.resetLayer(true)
104
120
  this.updateDatalayer(datalayer)
105
121
  })
122
+ this.toggleBadge()
123
+ }
124
+
125
+ redraw() {
126
+ if (this.isOpen()) this.open()
106
127
  }
107
128
 
108
129
  isOpen() {
109
- return !!document.querySelector('.umap-browser')
130
+ return !!document.querySelector('.on .umap-browser')
131
+ }
132
+
133
+ hasFilters() {
134
+ return !!this.options.filter || this.map.facets.isActive()
110
135
  }
111
136
 
112
137
  onMoveEnd() {
@@ -126,7 +151,9 @@ export default class Browser {
126
151
  })
127
152
  }
128
153
 
129
- open() {
154
+ open(mode) {
155
+ // Force only if mode is known, otherwise keep current mode.
156
+ if (mode) this.mode = mode
130
157
  // Get once but use it for each feature later
131
158
  this.filterKeys = this.map.getFilterKeys()
132
159
  const container = DomUtil.create('div')
@@ -135,18 +162,46 @@ export default class Browser {
135
162
  DomEvent.disableClickPropagation(container)
136
163
 
137
164
  DomUtil.createTitle(container, translate('Browse data'), 'icon-layers')
138
- this.tabsMenu(container, 'browse')
139
- const formContainer = DomUtil.create('div', '', container)
165
+ const formContainer = DomUtil.createFieldset(container, L._('Filters'), {
166
+ on: this.mode === 'filters',
167
+ className: 'filters',
168
+ icon: 'icon-filters',
169
+ })
170
+ this.filtersTitle = container.querySelector('summary')
171
+ this.toggleBadge()
140
172
  this.dataContainer = DomUtil.create('div', '', container)
141
173
 
142
- const fields = [
143
- ['options.filter', { handler: 'Input', placeholder: translate('Filter') }],
174
+ let fields = [
175
+ [
176
+ 'options.filter',
177
+ { handler: 'Input', placeholder: translate('Search map features…') },
178
+ ],
144
179
  ['options.inBbox', { handler: 'Switch', label: translate('Current map view') }],
145
180
  ]
146
181
  const builder = new L.FormBuilder(this, fields, {
147
182
  callback: () => this.onFormChange(),
148
183
  })
184
+ let filtersBuilder
149
185
  formContainer.appendChild(builder.build())
186
+ DomEvent.on(builder.form, 'reset', () => {
187
+ window.setTimeout(builder.syncAll.bind(builder))
188
+ })
189
+ if (this.map.options.facetKey) {
190
+ fields = this.map.facets.build()
191
+ filtersBuilder = new L.FormBuilder(this.map.facets, fields, {
192
+ callback: () => this.onFormChange(),
193
+ })
194
+ DomEvent.on(filtersBuilder.form, 'reset', () => {
195
+ window.setTimeout(filtersBuilder.syncAll.bind(filtersBuilder))
196
+ })
197
+ formContainer.appendChild(filtersBuilder.build())
198
+ }
199
+ const reset = DomUtil.createButton('flat', formContainer, '', () => {
200
+ builder.form.reset()
201
+ if (filtersBuilder) filtersBuilder.form.reset()
202
+ })
203
+ DomUtil.createIcon(reset, 'icon-restore')
204
+ DomUtil.element({ tagName: 'span', parent: reset, textContent: translate('Reset all') })
150
205
 
151
206
  this.map.panel.open({
152
207
  content: container,
@@ -166,18 +221,4 @@ export default class Browser {
166
221
  DomEvent.on(button, 'click', map.openBrowser, map)
167
222
  return button
168
223
  }
169
-
170
- tabsMenu(container, active) {
171
- const tabs = L.DomUtil.create('div', 'flat-tabs', container)
172
- const browse = L.DomUtil.add('button', 'flat tab-browse', tabs, L._('Data'))
173
- DomEvent.on(browse, 'click', this.open, this)
174
- if (this.map.options.facetKey) {
175
- const facets = L.DomUtil.add('button', 'flat tab-facets', tabs, L._('Filters'))
176
- DomEvent.on(facets, 'click', this.map.facets.open, this.map.facets)
177
- }
178
- const info = L.DomUtil.add('button', 'flat tab-info', tabs, L._('About'))
179
- DomEvent.on(info, 'click', this.map.displayCaption, this.map)
180
- let el = tabs.querySelector(`.tab-${active}`)
181
- L.DomUtil.addClass(el, 'on')
182
- }
183
224
  }
@@ -10,15 +10,18 @@ export default class Facets {
10
10
 
11
11
  compute(names, defined) {
12
12
  const properties = {}
13
+ let selected
13
14
 
14
15
  names.forEach((name) => {
15
16
  const type = defined[name]['type']
16
17
  properties[name] = { type: type }
17
- this.selected[name] = { type: type }
18
+ selected = this.selected[name] || {}
19
+ selected.type = type
18
20
  if (!['date', 'datetime', 'number'].includes(type)) {
19
21
  properties[name].choices = []
20
- this.selected[name].choices = []
22
+ selected.choices = selected.choices || []
21
23
  }
24
+ this.selected[name] = selected
22
25
  })
23
26
 
24
27
  this.map.eachBrowsableDataLayer((datalayer) => {
@@ -53,42 +56,20 @@ export default class Facets {
53
56
  return properties
54
57
  }
55
58
 
56
- redraw() {
57
- if (this.isOpen()) this.open()
58
- }
59
-
60
- isOpen() {
61
- return !!document.querySelector('.umap-facet-search')
59
+ isActive() {
60
+ for (let { type, min, max, choices } of Object.values(this.selected)) {
61
+ if (min !== undefined || max != undefined || choices?.length) {
62
+ return true
63
+ }
64
+ }
65
+ return false
62
66
  }
63
67
 
64
- open() {
65
- const container = L.DomUtil.create('div', 'umap-facet-search')
66
- const title = L.DomUtil.add(
67
- 'h3',
68
- 'umap-filter-title',
69
- container,
70
- translate('Facet search')
71
- )
72
- this.map.browser.tabsMenu(container, 'facets')
68
+ build() {
73
69
  const defined = this.getDefined()
74
70
  const names = Object.keys(defined)
75
71
  const facetProperties = this.compute(names, defined)
76
72
 
77
- const filterFeatures = function () {
78
- let found = false
79
- this.map.eachBrowsableDataLayer((datalayer) => {
80
- datalayer.resetLayer(true)
81
- if (datalayer.hasDataVisible()) found = true
82
- })
83
- // TODO: display a results counter in the panel instead.
84
- if (!found) {
85
- this.map.ui.alert({
86
- content: translate('No results for these facets'),
87
- level: 'info',
88
- })
89
- }
90
- }
91
-
92
73
  const fields = names.map((name) => {
93
74
  let criteria = facetProperties[name]
94
75
  let handler = 'FacetSearchChoices'
@@ -114,13 +95,7 @@ export default class Facets {
114
95
  ]
115
96
  })
116
97
 
117
- const builder = new L.FormBuilder(this, fields, {
118
- callback: filterFeatures,
119
- callbackContext: this,
120
- })
121
- container.appendChild(builder.build())
122
-
123
- this.map.panel.open({ content: container })
98
+ return fields
124
99
  }
125
100
 
126
101
  getDefined() {
@@ -33,7 +33,7 @@ export default class Orderable {
33
33
 
34
34
  onDragStart(e) {
35
35
  // e.target is the source node.
36
- const realSrc = document.elementFromPoint(e.clientX, e.clientY);
36
+ const realSrc = document.elementFromPoint(e.clientX, e.clientY)
37
37
  // Only allow drag from the handle
38
38
  if (!realSrc.classList.contains('icon-drag')) {
39
39
  e.preventDefault()
@@ -83,7 +83,7 @@ export const SCHEMA = {
83
83
  easing: {
84
84
  type: Boolean,
85
85
  impacts: [],
86
- default: false
86
+ default: false,
87
87
  },
88
88
  editinosmControl: {
89
89
  type: Boolean,
@@ -272,9 +272,9 @@ export const SCHEMA = {
272
272
  choices: [
273
273
  ['none', translate('None')],
274
274
  ['caption', translate('Caption')],
275
- ['databrowser', translate('Data browser')],
276
- ['datalayers', translate('Layers')],
277
- ['facet', translate('Facet search')],
275
+ ['databrowser', translate('Browser in data mode')],
276
+ ['datalayers', translate('Browser in layers mode')],
277
+ ['datafilters', translate('Browser in filters mode')],
278
278
  ],
279
279
  default: 'none',
280
280
  },
@@ -1,4 +1,4 @@
1
- import { template } from "./utils.js"
1
+ import { template } from './utils.js'
2
2
 
3
3
  export default class URLs {
4
4
  constructor(serverUrls) {
@@ -88,7 +88,7 @@ export function escapeHTML(s) {
88
88
  'span',
89
89
  ],
90
90
  ADD_ATTR: ['target', 'allow', 'allowfullscreen', 'frameborder', 'scrolling'],
91
- ALLOWED_ATTR: ['href', 'src', 'width', 'height', 'style'],
91
+ ALLOWED_ATTR: ['href', 'src', 'width', 'height', 'style', 'dir', 'title'],
92
92
  // Added: `geo:` URL scheme as defined in RFC5870:
93
93
  // https://www.rfc-editor.org/rfc/rfc5870.html
94
94
  // The base RegExp comes from:
@@ -362,3 +362,11 @@ export function parseNaiveDate(value) {
362
362
  // Let's pretend naive date are UTC, and remove time…
363
363
  return new Date(Date.UTC(naive.getFullYear(), naive.getMonth(), naive.getDate()))
364
364
  }
365
+
366
+ export function toggleBadge(element, value) {
367
+ if (!element.nodeType) element = document.querySelector(element)
368
+ if (!element) return
369
+ // True means simple badge, without content
370
+ if (value) element.dataset.badge = value === true ? ' ' : value
371
+ else delete element.dataset.badge
372
+ }