umap-project 2.3.0__py3-none-any.whl → 2.4.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.
- umap/__init__.py +1 -1
- umap/locale/en/LC_MESSAGES/django.po +81 -31
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +117 -66
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +83 -78
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +129 -123
- umap/management/commands/run_websocket_server.py +23 -0
- umap/models.py +6 -1
- umap/settings/base.py +11 -3
- umap/static/umap/base.css +68 -186
- umap/static/umap/content.css +3 -2
- umap/static/umap/css/dialog.css +18 -0
- umap/static/umap/css/icon.css +8 -0
- umap/static/umap/css/importers.css +51 -0
- umap/static/umap/css/panel.css +18 -57
- umap/static/umap/css/tooltip.css +59 -0
- umap/static/umap/css/window.css +35 -0
- umap/static/umap/img/16-white.svg +1 -3
- umap/static/umap/img/alert-icon-error.svg +8 -0
- umap/static/umap/img/alert-icon-info.svg +4 -0
- umap/static/umap/img/alert-icon-success.svg +3 -0
- umap/static/umap/img/icon-external-link.svg +3 -0
- umap/static/umap/img/importers/communesfr.svg +5 -0
- umap/static/umap/img/importers/datasets.svg +13 -0
- umap/static/umap/img/importers/geodatamine.svg +10 -0
- umap/static/umap/img/importers/overpass.svg +7 -0
- umap/static/umap/img/importers/random.svg +18 -0
- umap/static/umap/img/importers/random1.svg +4 -0
- umap/static/umap/img/importers/random2.svg +4 -0
- umap/static/umap/img/source/16-white.svg +2 -4
- umap/static/umap/js/components/alerts/alert.css +160 -0
- umap/static/umap/js/components/alerts/alert.js +169 -0
- umap/static/umap/js/components/base.js +54 -0
- umap/static/umap/js/modules/autocomplete.js +347 -0
- umap/static/umap/js/modules/browser.js +14 -21
- umap/static/umap/js/modules/caption.js +119 -0
- umap/static/umap/js/modules/global.js +37 -11
- umap/static/umap/js/modules/help.js +255 -0
- umap/static/umap/js/modules/importer.js +308 -0
- umap/static/umap/js/modules/importers/communesfr.js +44 -0
- umap/static/umap/js/modules/importers/datasets.js +42 -0
- umap/static/umap/js/modules/importers/geodatamine.js +95 -0
- umap/static/umap/js/modules/importers/overpass.js +84 -0
- umap/static/umap/js/modules/request.js +12 -14
- umap/static/umap/js/modules/rules.js +241 -0
- umap/static/umap/js/modules/schema.js +63 -14
- umap/static/umap/js/modules/sync/engine.js +93 -0
- umap/static/umap/js/modules/sync/updaters.js +109 -0
- umap/static/umap/js/modules/sync/websocket.js +25 -0
- umap/static/umap/js/modules/ui/dialog.js +52 -0
- umap/static/umap/js/modules/{panel.js → ui/panel.js} +37 -20
- umap/static/umap/js/modules/ui/tooltip.js +116 -0
- umap/static/umap/js/modules/utils.js +25 -18
- umap/static/umap/js/umap.controls.js +37 -112
- umap/static/umap/js/umap.core.js +1 -327
- umap/static/umap/js/umap.features.js +77 -29
- umap/static/umap/js/umap.forms.js +17 -19
- umap/static/umap/js/umap.js +265 -228
- umap/static/umap/js/umap.layer.js +154 -76
- umap/static/umap/js/umap.permissions.js +5 -9
- umap/static/umap/js/umap.popup.js +2 -1
- umap/static/umap/js/umap.tableeditor.js +8 -8
- umap/static/umap/locale/am_ET.js +51 -16
- umap/static/umap/locale/am_ET.json +51 -16
- umap/static/umap/locale/ar.js +51 -16
- umap/static/umap/locale/ar.json +51 -16
- umap/static/umap/locale/ast.js +51 -16
- umap/static/umap/locale/ast.json +51 -16
- umap/static/umap/locale/bg.js +51 -16
- umap/static/umap/locale/bg.json +51 -16
- umap/static/umap/locale/br.js +55 -20
- umap/static/umap/locale/br.json +55 -20
- umap/static/umap/locale/ca.js +51 -16
- umap/static/umap/locale/ca.json +51 -16
- umap/static/umap/locale/cs_CZ.js +93 -58
- umap/static/umap/locale/cs_CZ.json +93 -58
- umap/static/umap/locale/da.js +51 -16
- umap/static/umap/locale/da.json +51 -16
- umap/static/umap/locale/de.js +56 -21
- umap/static/umap/locale/de.json +56 -21
- umap/static/umap/locale/el.js +51 -16
- umap/static/umap/locale/el.json +51 -16
- umap/static/umap/locale/en.js +52 -16
- umap/static/umap/locale/en.json +52 -16
- umap/static/umap/locale/en_US.json +51 -16
- umap/static/umap/locale/es.js +51 -16
- umap/static/umap/locale/es.json +51 -16
- umap/static/umap/locale/et.js +51 -16
- umap/static/umap/locale/et.json +51 -16
- umap/static/umap/locale/eu.js +51 -16
- umap/static/umap/locale/eu.json +51 -16
- umap/static/umap/locale/fa_IR.js +51 -16
- umap/static/umap/locale/fa_IR.json +51 -16
- umap/static/umap/locale/fi.js +51 -16
- umap/static/umap/locale/fi.json +51 -16
- umap/static/umap/locale/fr.js +61 -25
- umap/static/umap/locale/fr.json +61 -25
- umap/static/umap/locale/gl.js +51 -16
- umap/static/umap/locale/gl.json +51 -16
- umap/static/umap/locale/he.js +51 -16
- umap/static/umap/locale/he.json +51 -16
- umap/static/umap/locale/hr.js +51 -16
- umap/static/umap/locale/hr.json +51 -16
- umap/static/umap/locale/hu.js +51 -16
- umap/static/umap/locale/hu.json +51 -16
- umap/static/umap/locale/id.js +51 -16
- umap/static/umap/locale/id.json +51 -16
- umap/static/umap/locale/is.js +51 -16
- umap/static/umap/locale/is.json +51 -16
- umap/static/umap/locale/it.js +51 -16
- umap/static/umap/locale/it.json +51 -16
- umap/static/umap/locale/ja.js +51 -16
- umap/static/umap/locale/ja.json +51 -16
- umap/static/umap/locale/ko.js +51 -16
- umap/static/umap/locale/ko.json +51 -16
- umap/static/umap/locale/lt.js +51 -16
- umap/static/umap/locale/lt.json +51 -16
- umap/static/umap/locale/ms.js +51 -16
- umap/static/umap/locale/ms.json +51 -16
- umap/static/umap/locale/nl.js +51 -16
- umap/static/umap/locale/nl.json +51 -16
- umap/static/umap/locale/no.js +51 -16
- umap/static/umap/locale/no.json +51 -16
- umap/static/umap/locale/pl.js +93 -58
- umap/static/umap/locale/pl.json +93 -58
- umap/static/umap/locale/pl_PL.json +51 -16
- umap/static/umap/locale/pt.js +215 -180
- umap/static/umap/locale/pt.json +215 -180
- umap/static/umap/locale/pt_BR.js +51 -16
- umap/static/umap/locale/pt_BR.json +51 -16
- umap/static/umap/locale/pt_PT.js +51 -16
- umap/static/umap/locale/pt_PT.json +51 -16
- umap/static/umap/locale/ro.js +51 -16
- umap/static/umap/locale/ro.json +51 -16
- umap/static/umap/locale/ru.js +51 -16
- umap/static/umap/locale/ru.json +51 -16
- umap/static/umap/locale/si.js +51 -16
- umap/static/umap/locale/si.json +51 -16
- umap/static/umap/locale/sk_SK.js +51 -16
- umap/static/umap/locale/sk_SK.json +51 -16
- umap/static/umap/locale/sl.js +51 -16
- umap/static/umap/locale/sl.json +51 -16
- umap/static/umap/locale/sr.js +51 -16
- umap/static/umap/locale/sr.json +51 -16
- umap/static/umap/locale/sv.js +51 -16
- umap/static/umap/locale/sv.json +51 -16
- umap/static/umap/locale/th_TH.js +51 -16
- umap/static/umap/locale/th_TH.json +51 -16
- umap/static/umap/locale/tr.js +51 -16
- umap/static/umap/locale/tr.json +51 -16
- umap/static/umap/locale/uk_UA.js +51 -16
- umap/static/umap/locale/uk_UA.json +51 -16
- umap/static/umap/locale/vi.js +51 -16
- umap/static/umap/locale/vi.json +51 -16
- umap/static/umap/locale/vi_VN.json +51 -16
- umap/static/umap/locale/zh.js +51 -16
- umap/static/umap/locale/zh.json +51 -16
- umap/static/umap/locale/zh_CN.json +51 -16
- umap/static/umap/locale/zh_TW.Big5.json +51 -16
- umap/static/umap/locale/zh_TW.js +51 -16
- umap/static/umap/locale/zh_TW.json +51 -16
- umap/static/umap/map.css +40 -53
- umap/static/umap/unittests/sync.js +105 -0
- umap/static/umap/unittests/utils.js +78 -36
- umap/static/umap/vars.css +19 -1
- umap/static/umap/vendors/dompurify/purify.es.js +50 -15
- umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +2 -2
- umap/templates/umap/components/alerts/alert.html +89 -0
- umap/templates/umap/content.html +4 -3
- umap/templates/umap/css.html +4 -0
- umap/templates/umap/home.html +3 -0
- umap/templates/umap/js.html +0 -3
- umap/templates/umap/map_init.html +2 -8
- umap/templates/umap/messages.html +9 -11
- umap/templates/umap/search.html +3 -0
- umap/tests/base.py +3 -0
- umap/tests/integration/conftest.py +30 -0
- umap/tests/integration/test_anonymous_owned_map.py +8 -13
- umap/tests/integration/test_browser.py +81 -6
- umap/tests/integration/test_caption.py +27 -0
- umap/tests/integration/test_conditional_rules.py +201 -0
- umap/tests/integration/test_dashboard.py +1 -1
- umap/tests/integration/test_datalayer.py +2 -3
- umap/tests/integration/test_edit_datalayer.py +32 -3
- umap/tests/integration/test_edit_map.py +1 -1
- umap/tests/integration/test_facets_browser.py +7 -4
- umap/tests/integration/test_import.py +185 -49
- umap/tests/integration/test_map.py +31 -17
- umap/tests/integration/{test_collaborative_editing.py → test_optimistic_merge.py} +7 -7
- umap/tests/integration/test_owned_map.py +1 -1
- umap/tests/integration/test_picto.py +2 -2
- umap/tests/integration/test_statics.py +1 -1
- umap/tests/integration/test_view_marker.py +19 -2
- umap/tests/integration/test_websocket_sync.py +283 -0
- umap/tests/settings.py +5 -0
- umap/tests/test_datalayer_views.py +0 -1
- umap/tests/test_views.py +53 -0
- umap/urls.py +5 -0
- umap/views.py +40 -11
- umap/websocket_server.py +92 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/METADATA +13 -11
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/RECORD +208 -172
- umap/static/umap/js/umap.autocomplete.js +0 -341
- umap/static/umap/js/umap.importer.js +0 -187
- umap/static/umap/js/umap.ui.js +0 -190
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/WHEEL +0 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
U.FeatureMixin = {
|
|
2
2
|
staticOptions: { mainColor: 'color' },
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
getSyncMetadata: function () {
|
|
5
|
+
return {
|
|
6
|
+
subject: 'feature',
|
|
7
|
+
metadata: {
|
|
8
|
+
id: this.id,
|
|
9
|
+
layerId: this.datalayer?.id || null,
|
|
10
|
+
featureType: this.getClassName(),
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
onCommit: function () {
|
|
16
|
+
// When the layer is a remote layer, we don't want to sync the creation of the
|
|
17
|
+
// points via the websocket, as the other peers will get them themselves.
|
|
18
|
+
if (this.datalayer.isRemoteLayer()) return
|
|
19
|
+
this.sync.upsert(this.toGeoJSON())
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
getGeometry: function () {
|
|
23
|
+
return this.toGeoJSON().geometry
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
syncDelete: function () {
|
|
27
|
+
this.sync.delete()
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
initialize: function (map, latlng, options, id) {
|
|
5
31
|
this.map = map
|
|
32
|
+
this.sync = map.sync_engine.proxy(this)
|
|
33
|
+
|
|
6
34
|
if (typeof options === 'undefined') {
|
|
7
35
|
options = {}
|
|
8
36
|
}
|
|
9
37
|
// DataLayer the marker belongs to
|
|
10
38
|
this.datalayer = options.datalayer || null
|
|
11
39
|
this.properties = { _umap_options: {} }
|
|
12
|
-
|
|
40
|
+
|
|
13
41
|
if (options.geojson) {
|
|
14
42
|
this.populate(options.geojson)
|
|
15
|
-
geojson_id = options.geojson.id
|
|
16
43
|
}
|
|
17
44
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.id = geojson_id
|
|
45
|
+
if (id) {
|
|
46
|
+
this.id = id
|
|
21
47
|
} else {
|
|
22
|
-
|
|
48
|
+
let geojson_id
|
|
49
|
+
if (options.geojson) {
|
|
50
|
+
geojson_id = options.geojson.id
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Each feature needs an unique identifier
|
|
54
|
+
if (U.Utils.checkId(geojson_id)) {
|
|
55
|
+
this.id = geojson_id
|
|
56
|
+
} else {
|
|
57
|
+
this.id = U.Utils.generateId()
|
|
58
|
+
}
|
|
23
59
|
}
|
|
24
60
|
let isDirty = false
|
|
25
61
|
const self = this
|
|
@@ -98,6 +134,7 @@ U.FeatureMixin = {
|
|
|
98
134
|
this.view()
|
|
99
135
|
}
|
|
100
136
|
}
|
|
137
|
+
this._redraw()
|
|
101
138
|
},
|
|
102
139
|
|
|
103
140
|
openPopup: function () {
|
|
@@ -107,7 +144,11 @@ U.FeatureMixin = {
|
|
|
107
144
|
edit: function (e) {
|
|
108
145
|
if (!this.map.editEnabled || this.isReadOnly()) return
|
|
109
146
|
const container = L.DomUtil.create('div', 'umap-feature-container')
|
|
110
|
-
L.DomUtil.createTitle(
|
|
147
|
+
L.DomUtil.createTitle(
|
|
148
|
+
container,
|
|
149
|
+
L._('Feature properties'),
|
|
150
|
+
`icon-${this.getClassName()}`
|
|
151
|
+
)
|
|
111
152
|
|
|
112
153
|
let builder = new U.FormBuilder(
|
|
113
154
|
this,
|
|
@@ -134,7 +175,6 @@ U.FeatureMixin = {
|
|
|
134
175
|
properties.unshift('properties.name')
|
|
135
176
|
builder = new U.FormBuilder(this, properties, {
|
|
136
177
|
id: 'umap-feature-properties',
|
|
137
|
-
callback: this._redraw, // In case we have dynamic options…
|
|
138
178
|
})
|
|
139
179
|
container.appendChild(builder.build())
|
|
140
180
|
this.appendEditFieldsets(container)
|
|
@@ -149,7 +189,7 @@ U.FeatureMixin = {
|
|
|
149
189
|
},
|
|
150
190
|
|
|
151
191
|
getAdvancedEditActions: function (container) {
|
|
152
|
-
|
|
192
|
+
L.DomUtil.createButton(
|
|
153
193
|
'button umap-delete',
|
|
154
194
|
container,
|
|
155
195
|
L._('Delete'),
|
|
@@ -165,7 +205,6 @@ U.FeatureMixin = {
|
|
|
165
205
|
const optionsFields = this.getShapeOptions()
|
|
166
206
|
let builder = new U.FormBuilder(this, optionsFields, {
|
|
167
207
|
id: 'umap-feature-shape-properties',
|
|
168
|
-
callback: this._redraw,
|
|
169
208
|
})
|
|
170
209
|
const shapeProperties = L.DomUtil.createFieldset(container, L._('Shape properties'))
|
|
171
210
|
shapeProperties.appendChild(builder.build())
|
|
@@ -173,7 +212,6 @@ U.FeatureMixin = {
|
|
|
173
212
|
const advancedOptions = this.getAdvancedOptions()
|
|
174
213
|
builder = new U.FormBuilder(this, advancedOptions, {
|
|
175
214
|
id: 'umap-feature-advanced-properties',
|
|
176
|
-
callback: this._redraw,
|
|
177
215
|
})
|
|
178
216
|
const advancedProperties = L.DomUtil.createFieldset(
|
|
179
217
|
container,
|
|
@@ -182,9 +220,7 @@ U.FeatureMixin = {
|
|
|
182
220
|
advancedProperties.appendChild(builder.build())
|
|
183
221
|
|
|
184
222
|
const interactionOptions = this.getInteractionOptions()
|
|
185
|
-
builder = new U.FormBuilder(this, interactionOptions
|
|
186
|
-
callback: this._redraw,
|
|
187
|
-
})
|
|
223
|
+
builder = new U.FormBuilder(this, interactionOptions)
|
|
188
224
|
const popupFieldset = L.DomUtil.createFieldset(
|
|
189
225
|
container,
|
|
190
226
|
L._('Interaction options')
|
|
@@ -240,13 +276,14 @@ U.FeatureMixin = {
|
|
|
240
276
|
}
|
|
241
277
|
return false
|
|
242
278
|
},
|
|
243
|
-
|
|
244
|
-
del: function () {
|
|
279
|
+
del: function (sync) {
|
|
245
280
|
this.isDirty = true
|
|
246
281
|
this.map.closePopup()
|
|
247
282
|
if (this.datalayer) {
|
|
248
283
|
this.datalayer.removeLayer(this)
|
|
249
284
|
this.disconnectFromDataLayer(this.datalayer)
|
|
285
|
+
|
|
286
|
+
if (sync !== false) this.syncDelete()
|
|
250
287
|
}
|
|
251
288
|
},
|
|
252
289
|
|
|
@@ -495,7 +532,7 @@ U.FeatureMixin = {
|
|
|
495
532
|
},
|
|
496
533
|
|
|
497
534
|
isFiltered: function () {
|
|
498
|
-
const filterKeys = this.
|
|
535
|
+
const filterKeys = this.datalayer.getFilterKeys()
|
|
499
536
|
const filter = this.map.browser.options.filter
|
|
500
537
|
if (filter && !this.matchFilter(filter, filterKeys)) return true
|
|
501
538
|
if (!this.matchFacets()) return true
|
|
@@ -504,6 +541,10 @@ U.FeatureMixin = {
|
|
|
504
541
|
|
|
505
542
|
matchFilter: function (filter, keys) {
|
|
506
543
|
filter = filter.toLowerCase()
|
|
544
|
+
if (U.Utils.hasVar(keys)) {
|
|
545
|
+
return this.getDisplayName().toLowerCase().indexOf(filter) !== -1
|
|
546
|
+
}
|
|
547
|
+
keys = keys.split(',')
|
|
507
548
|
for (let i = 0, value; i < keys.length; i++) {
|
|
508
549
|
value = (this.properties[keys[i]] || '') + ''
|
|
509
550
|
if (value.toLowerCase().indexOf(filter) !== -1) return true
|
|
@@ -549,7 +590,10 @@ U.FeatureMixin = {
|
|
|
549
590
|
},
|
|
550
591
|
|
|
551
592
|
clone: function () {
|
|
552
|
-
const
|
|
593
|
+
const geoJSON = this.toGeoJSON()
|
|
594
|
+
delete geoJSON.id
|
|
595
|
+
delete geoJSON.properties.id
|
|
596
|
+
const layer = this.datalayer.geojsonToFeatures(geoJSON)
|
|
553
597
|
layer.isDirty = true
|
|
554
598
|
layer.edit()
|
|
555
599
|
return layer
|
|
@@ -562,7 +606,7 @@ U.FeatureMixin = {
|
|
|
562
606
|
if (locale) properties.locale = locale
|
|
563
607
|
if (L.lang) properties.lang = L.lang
|
|
564
608
|
properties.rank = this.getRank() + 1
|
|
565
|
-
if (this.hasGeom()) {
|
|
609
|
+
if (this._map && this.hasGeom()) {
|
|
566
610
|
center = this.getCenter()
|
|
567
611
|
properties.lat = center.lat
|
|
568
612
|
properties.lon = center.lng
|
|
@@ -602,9 +646,11 @@ U.Marker = L.Marker.extend({
|
|
|
602
646
|
function (e) {
|
|
603
647
|
this.isDirty = true
|
|
604
648
|
this.edit(e)
|
|
649
|
+
this.sync.update('geometry', this.getGeometry())
|
|
605
650
|
},
|
|
606
651
|
this
|
|
607
652
|
)
|
|
653
|
+
this.on('editable:drawing:commit', this.onCommit)
|
|
608
654
|
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
|
609
655
|
this.on('mouseout', this._onMouseOut)
|
|
610
656
|
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
|
@@ -726,14 +772,10 @@ U.Marker = L.Marker.extend({
|
|
|
726
772
|
const builder = new U.FormBuilder(this, coordinatesOptions, {
|
|
727
773
|
callback: function () {
|
|
728
774
|
if (!this._latlng.isValid()) {
|
|
729
|
-
|
|
730
|
-
content: L._('Invalid latitude or longitude'),
|
|
731
|
-
level: 'error',
|
|
732
|
-
})
|
|
775
|
+
U.Alert.error(L._('Invalid latitude or longitude'))
|
|
733
776
|
builder.resetField('_latlng.lat')
|
|
734
777
|
builder.resetField('_latlng.lng')
|
|
735
778
|
}
|
|
736
|
-
this._redraw()
|
|
737
779
|
this.zoomTo({ easing: false })
|
|
738
780
|
},
|
|
739
781
|
callbackContext: this,
|
|
@@ -878,14 +920,15 @@ U.PathMixin = {
|
|
|
878
920
|
|
|
879
921
|
_onMouseOver: function () {
|
|
880
922
|
if (this.map.measureTools && this.map.measureTools.enabled()) {
|
|
881
|
-
this.map.
|
|
923
|
+
this.map.tooltip.open({ content: this.getMeasure(), anchor: this })
|
|
882
924
|
} else if (this.map.editEnabled && !this.map.editedFeature) {
|
|
883
|
-
this.map.
|
|
925
|
+
this.map.tooltip.open({ content: L._('Click to edit'), anchor: this })
|
|
884
926
|
}
|
|
885
927
|
},
|
|
886
928
|
|
|
887
929
|
addInteractions: function () {
|
|
888
930
|
U.FeatureMixin.addInteractions.call(this)
|
|
931
|
+
this.on('editable:disable', this.onCommit)
|
|
889
932
|
this.on('mouseover', this._onMouseOver)
|
|
890
933
|
this.on('edit', this.makeDirty)
|
|
891
934
|
this.on('drag editable:drag', this._onDrag)
|
|
@@ -928,7 +971,7 @@ U.PathMixin = {
|
|
|
928
971
|
items.push({
|
|
929
972
|
text: L._('Display measure'),
|
|
930
973
|
callback: function () {
|
|
931
|
-
|
|
974
|
+
U.Alert.info(this.getMeasure())
|
|
932
975
|
},
|
|
933
976
|
context: this,
|
|
934
977
|
})
|
|
@@ -1086,6 +1129,9 @@ U.Polyline = L.Polyline.extend({
|
|
|
1086
1129
|
geojson.geometry.coordinates = [
|
|
1087
1130
|
U.Utils.flattenCoordinates(geojson.geometry.coordinates),
|
|
1088
1131
|
]
|
|
1132
|
+
|
|
1133
|
+
delete geojson.id // delete the copied id, a new one will be generated.
|
|
1134
|
+
|
|
1089
1135
|
const polygon = this.datalayer.geojsonToFeatures(geojson)
|
|
1090
1136
|
polygon.edit()
|
|
1091
1137
|
this.del()
|
|
@@ -1093,7 +1139,7 @@ U.Polyline = L.Polyline.extend({
|
|
|
1093
1139
|
|
|
1094
1140
|
getAdvancedEditActions: function (container) {
|
|
1095
1141
|
U.FeatureMixin.getAdvancedEditActions.call(this, container)
|
|
1096
|
-
|
|
1142
|
+
L.DomUtil.createButton(
|
|
1097
1143
|
'button umap-to-polygon',
|
|
1098
1144
|
container,
|
|
1099
1145
|
L._('Transform to polygon'),
|
|
@@ -1223,6 +1269,8 @@ U.Polygon = L.Polygon.extend({
|
|
|
1223
1269
|
|
|
1224
1270
|
toPolyline: function () {
|
|
1225
1271
|
const geojson = this.toGeoJSON()
|
|
1272
|
+
delete geojson.id
|
|
1273
|
+
delete geojson.properties.id
|
|
1226
1274
|
geojson.geometry.type = 'LineString'
|
|
1227
1275
|
geojson.geometry.coordinates = U.Utils.flattenCoordinates(
|
|
1228
1276
|
geojson.geometry.coordinates
|
|
@@ -78,7 +78,7 @@ L.FormBuilder.Element.include({
|
|
|
78
78
|
info,
|
|
79
79
|
'mouseover',
|
|
80
80
|
function () {
|
|
81
|
-
this.builder.map.
|
|
81
|
+
this.builder.map.tooltip.open({
|
|
82
82
|
anchor: info,
|
|
83
83
|
content: this.options.helpTooltip,
|
|
84
84
|
position: 'top',
|
|
@@ -340,15 +340,6 @@ L.FormBuilder.TextColorPicker = L.FormBuilder.ColorPicker.extend({
|
|
|
340
340
|
],
|
|
341
341
|
})
|
|
342
342
|
|
|
343
|
-
L.FormBuilder.ProxyTTLSelect = L.FormBuilder.Select.extend({
|
|
344
|
-
selectOptions: [
|
|
345
|
-
[undefined, L._('No cache')],
|
|
346
|
-
['300', L._('5 min')],
|
|
347
|
-
['3600', L._('1 hour')],
|
|
348
|
-
['86400', L._('1 day')],
|
|
349
|
-
],
|
|
350
|
-
})
|
|
351
|
-
|
|
352
343
|
L.FormBuilder.LayerTypeChooser = L.FormBuilder.Select.extend({
|
|
353
344
|
getOptions: function () {
|
|
354
345
|
const layer_classes = [
|
|
@@ -745,14 +736,12 @@ L.FormBuilder.Switch = L.FormBuilder.CheckBox.extend({
|
|
|
745
736
|
})
|
|
746
737
|
|
|
747
738
|
L.FormBuilder.FacetSearchBase = L.FormBuilder.Element.extend({
|
|
748
|
-
|
|
749
739
|
buildLabel: function () {
|
|
750
740
|
this.label = L.DomUtil.element({
|
|
751
741
|
tagName: 'legend',
|
|
752
742
|
textContent: this.options.label,
|
|
753
743
|
})
|
|
754
|
-
}
|
|
755
|
-
|
|
744
|
+
},
|
|
756
745
|
})
|
|
757
746
|
L.FormBuilder.FacetSearchChoices = L.FormBuilder.FacetSearchBase.extend({
|
|
758
747
|
build: function () {
|
|
@@ -865,13 +854,13 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.FacetSearchBase.extend({
|
|
|
865
854
|
},
|
|
866
855
|
|
|
867
856
|
isMinModified: function () {
|
|
868
|
-
const default_ = this.minInput.getAttribute(
|
|
857
|
+
const default_ = this.minInput.getAttribute('value')
|
|
869
858
|
const current = this.minInput.value
|
|
870
859
|
return current != default_
|
|
871
860
|
},
|
|
872
861
|
|
|
873
862
|
isMaxModified: function () {
|
|
874
|
-
const default_ = this.maxInput.getAttribute(
|
|
863
|
+
const default_ = this.maxInput.getAttribute('value')
|
|
875
864
|
const current = this.maxInput.value
|
|
876
865
|
return current != default_
|
|
877
866
|
},
|
|
@@ -943,7 +932,11 @@ L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
|
|
|
943
932
|
if (!this.container.querySelector(`input[type="radio"][value="${value}"]`)) {
|
|
944
933
|
value = this.options.default !== undefined ? this.options.default : this.default
|
|
945
934
|
}
|
|
946
|
-
this.
|
|
935
|
+
const choices = this.getChoices().map(([value, label]) => value)
|
|
936
|
+
if (choices.includes(value)) {
|
|
937
|
+
this.container.querySelector(`input[type="radio"][value="${value}"]`).checked =
|
|
938
|
+
true
|
|
939
|
+
}
|
|
947
940
|
},
|
|
948
941
|
|
|
949
942
|
value: function () {
|
|
@@ -1065,7 +1058,7 @@ L.FormBuilder.ManageOwner = L.FormBuilder.Element.extend({
|
|
|
1065
1058
|
className: 'edit-owner',
|
|
1066
1059
|
on_select: L.bind(this.onSelect, this),
|
|
1067
1060
|
}
|
|
1068
|
-
this.autocomplete = new U.
|
|
1061
|
+
this.autocomplete = new U.AjaxAutocomplete(this.parentNode, options)
|
|
1069
1062
|
const owner = this.toHTML()
|
|
1070
1063
|
if (owner)
|
|
1071
1064
|
this.autocomplete.displaySelected({
|
|
@@ -1094,7 +1087,7 @@ L.FormBuilder.ManageEditors = L.FormBuilder.Element.extend({
|
|
|
1094
1087
|
on_select: L.bind(this.onSelect, this),
|
|
1095
1088
|
on_unselect: L.bind(this.onUnselect, this),
|
|
1096
1089
|
}
|
|
1097
|
-
this.autocomplete = new U.
|
|
1090
|
+
this.autocomplete = new U.AjaxAutocompleteMultiple(this.parentNode, options)
|
|
1098
1091
|
this._values = this.toHTML()
|
|
1099
1092
|
if (this._values)
|
|
1100
1093
|
for (let i = 0; i < this._values.length; i++)
|
|
@@ -1183,7 +1176,12 @@ U.FormBuilder = L.FormBuilder.extend({
|
|
|
1183
1176
|
setter: function (field, value) {
|
|
1184
1177
|
L.FormBuilder.prototype.setter.call(this, field, value)
|
|
1185
1178
|
this.obj.isDirty = true
|
|
1186
|
-
if ('render' in this.obj)
|
|
1179
|
+
if ('render' in this.obj) {
|
|
1180
|
+
this.obj.render([field], this)
|
|
1181
|
+
}
|
|
1182
|
+
if ('sync' in this.obj) {
|
|
1183
|
+
this.obj.sync.update(field, value)
|
|
1184
|
+
}
|
|
1187
1185
|
},
|
|
1188
1186
|
|
|
1189
1187
|
finish: function () {
|