umap-project 3.0.3__py3-none-any.whl → 3.0.5__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/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +136 -56
- umap/locale/en/LC_MESSAGES/django.po +18 -18
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +136 -56
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +1 -1
- umap/models.py +1 -0
- umap/settings/base.py +1 -0
- umap/static/umap/css/bar.css +1 -1
- umap/static/umap/css/form.css +44 -44
- umap/static/umap/css/tooltip.css +13 -0
- umap/static/umap/js/modules/autocomplete.js +7 -8
- umap/static/umap/js/modules/browser.js +89 -94
- umap/static/umap/js/modules/caption.js +6 -4
- umap/static/umap/js/modules/data/features.js +1 -19
- umap/static/umap/js/modules/data/layer.js +100 -61
- umap/static/umap/js/modules/facets.js +1 -1
- umap/static/umap/js/modules/form/fields.js +1 -1
- umap/static/umap/js/modules/importer.js +1 -1
- umap/static/umap/js/modules/managers.js +46 -0
- umap/static/umap/js/modules/permissions.js +1 -1
- umap/static/umap/js/modules/rendering/controls.js +251 -0
- umap/static/umap/js/modules/rendering/layers/heat.js +5 -0
- umap/static/umap/js/modules/rendering/map.js +21 -10
- umap/static/umap/js/modules/rendering/ui.js +0 -1
- umap/static/umap/js/modules/rules.js +56 -46
- umap/static/umap/js/modules/schema.js +5 -1
- umap/static/umap/js/modules/share.js +2 -2
- umap/static/umap/js/modules/slideshow.js +1 -1
- umap/static/umap/js/modules/sync/engine.js +23 -9
- umap/static/umap/js/modules/ui/bar.js +2 -2
- umap/static/umap/js/modules/ui/base.js +13 -0
- umap/static/umap/js/modules/umap.js +70 -113
- umap/static/umap/js/umap.controls.js +0 -310
- umap/static/umap/js/umap.core.js +0 -40
- umap/static/umap/locale/am_ET.js +8 -3
- umap/static/umap/locale/am_ET.json +8 -3
- umap/static/umap/locale/ar.js +8 -3
- umap/static/umap/locale/ar.json +8 -3
- umap/static/umap/locale/ast.js +8 -3
- umap/static/umap/locale/ast.json +8 -3
- umap/static/umap/locale/bg.js +8 -3
- umap/static/umap/locale/bg.json +8 -3
- umap/static/umap/locale/br.js +8 -3
- umap/static/umap/locale/br.json +8 -3
- umap/static/umap/locale/ca.js +27 -22
- umap/static/umap/locale/ca.json +27 -22
- umap/static/umap/locale/cs_CZ.js +5 -2
- umap/static/umap/locale/cs_CZ.json +5 -2
- umap/static/umap/locale/da.js +8 -3
- umap/static/umap/locale/da.json +8 -3
- umap/static/umap/locale/de.js +5 -2
- umap/static/umap/locale/de.json +5 -2
- umap/static/umap/locale/el.js +92 -87
- umap/static/umap/locale/el.json +92 -87
- umap/static/umap/locale/en.js +5 -2
- umap/static/umap/locale/en.json +5 -2
- umap/static/umap/locale/en_US.json +8 -3
- umap/static/umap/locale/es.js +18 -15
- umap/static/umap/locale/es.json +18 -15
- umap/static/umap/locale/et.js +8 -3
- umap/static/umap/locale/et.json +8 -3
- umap/static/umap/locale/eu.js +5 -2
- umap/static/umap/locale/eu.json +5 -2
- umap/static/umap/locale/fa_IR.js +5 -2
- umap/static/umap/locale/fa_IR.json +5 -2
- umap/static/umap/locale/fi.js +8 -3
- umap/static/umap/locale/fi.json +8 -3
- umap/static/umap/locale/fr.js +5 -2
- umap/static/umap/locale/fr.json +5 -2
- umap/static/umap/locale/gl.js +5 -2
- umap/static/umap/locale/gl.json +5 -2
- umap/static/umap/locale/he.js +8 -3
- umap/static/umap/locale/he.json +8 -3
- umap/static/umap/locale/hr.js +8 -3
- umap/static/umap/locale/hr.json +8 -3
- umap/static/umap/locale/hu.js +5 -2
- umap/static/umap/locale/hu.json +5 -2
- umap/static/umap/locale/id.js +8 -3
- umap/static/umap/locale/id.json +8 -3
- umap/static/umap/locale/is.js +8 -3
- umap/static/umap/locale/is.json +8 -3
- umap/static/umap/locale/it.js +5 -2
- umap/static/umap/locale/it.json +5 -2
- umap/static/umap/locale/ja.js +8 -3
- umap/static/umap/locale/ja.json +8 -3
- umap/static/umap/locale/ko.js +8 -3
- umap/static/umap/locale/ko.json +8 -3
- umap/static/umap/locale/lt.js +8 -3
- umap/static/umap/locale/lt.json +8 -3
- umap/static/umap/locale/ms.js +8 -3
- umap/static/umap/locale/ms.json +8 -3
- umap/static/umap/locale/nl.js +7 -4
- umap/static/umap/locale/nl.json +7 -4
- umap/static/umap/locale/no.js +8 -3
- umap/static/umap/locale/no.json +8 -3
- umap/static/umap/locale/pl.js +8 -3
- umap/static/umap/locale/pl.json +8 -3
- umap/static/umap/locale/pl_PL.json +8 -3
- umap/static/umap/locale/pt.js +5 -2
- umap/static/umap/locale/pt.json +5 -2
- umap/static/umap/locale/pt_BR.js +8 -3
- umap/static/umap/locale/pt_BR.json +8 -3
- umap/static/umap/locale/pt_PT.js +5 -2
- umap/static/umap/locale/pt_PT.json +5 -2
- umap/static/umap/locale/ro.js +8 -3
- umap/static/umap/locale/ro.json +8 -3
- umap/static/umap/locale/ru.js +8 -3
- umap/static/umap/locale/ru.json +8 -3
- umap/static/umap/locale/sk_SK.js +8 -3
- umap/static/umap/locale/sk_SK.json +8 -3
- umap/static/umap/locale/sl.js +8 -3
- umap/static/umap/locale/sl.json +8 -3
- umap/static/umap/locale/sr.js +8 -3
- umap/static/umap/locale/sr.json +8 -3
- umap/static/umap/locale/sv.js +8 -3
- umap/static/umap/locale/sv.json +8 -3
- umap/static/umap/locale/th_TH.js +8 -3
- umap/static/umap/locale/th_TH.json +8 -3
- umap/static/umap/locale/tr.js +8 -3
- umap/static/umap/locale/tr.json +8 -3
- umap/static/umap/locale/uk_UA.js +8 -3
- umap/static/umap/locale/uk_UA.json +8 -3
- umap/static/umap/locale/vi.js +8 -3
- umap/static/umap/locale/vi.json +8 -3
- umap/static/umap/locale/vi_VN.json +8 -3
- umap/static/umap/locale/zh.js +8 -3
- umap/static/umap/locale/zh.json +8 -3
- umap/static/umap/locale/zh_CN.json +8 -3
- umap/static/umap/locale/zh_TW.Big5.json +8 -3
- umap/static/umap/locale/zh_TW.js +5 -2
- umap/static/umap/locale/zh_TW.json +5 -2
- umap/static/umap/map.css +11 -33
- umap/static/umap/vars.css +4 -0
- umap/static/umap/vendors/togeojson/togeojson.es.js +350 -177
- umap/static/umap/vendors/togeojson/togeojson.es.mjs.map +1 -1
- umap/templates/umap/design_system.html +355 -0
- umap/tests/base.py +2 -2
- umap/tests/fixtures/heatmap_data.json +1044 -0
- umap/tests/integration/test_browser.py +3 -3
- umap/tests/integration/test_conditional_rules.py +2 -2
- umap/tests/integration/test_datalayer.py +0 -1
- umap/tests/integration/test_edit_map.py +7 -7
- umap/tests/integration/test_facets_browser.py +2 -2
- umap/tests/integration/test_heatmap.py +41 -0
- umap/tests/integration/test_iframe.py +25 -0
- umap/tests/integration/test_import.py +58 -1
- umap/tests/integration/test_map.py +7 -8
- umap/tests/integration/test_optimistic_merge.py +12 -4
- umap/tests/integration/test_querystring.py +1 -1
- umap/tests/integration/test_remote_data.py +79 -0
- umap/tests/integration/test_websocket_sync.py +2 -2
- umap/urls.py +1 -0
- umap/views.py +7 -0
- {umap_project-3.0.3.dist-info → umap_project-3.0.5.dist-info}/METADATA +8 -8
- {umap_project-3.0.3.dist-info → umap_project-3.0.5.dist-info}/RECORD +161 -154
- {umap_project-3.0.3.dist-info → umap_project-3.0.5.dist-info}/WHEEL +0 -0
- {umap_project-3.0.3.dist-info → umap_project-3.0.5.dist-info}/entry_points.txt +0 -0
- {umap_project-3.0.3.dist-info → umap_project-3.0.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,6 +11,17 @@ import {
|
|
|
11
11
|
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
|
|
12
12
|
import DropControl from '../drop.js'
|
|
13
13
|
import { translate } from '../i18n.js'
|
|
14
|
+
import {
|
|
15
|
+
AttributionControl,
|
|
16
|
+
CaptionControl,
|
|
17
|
+
DataLayersControl,
|
|
18
|
+
EmbedControl,
|
|
19
|
+
EditControl,
|
|
20
|
+
HomeControl,
|
|
21
|
+
MoreControl,
|
|
22
|
+
PermanentCreditsControl,
|
|
23
|
+
TileLayerChooser,
|
|
24
|
+
} from './controls.js'
|
|
14
25
|
import * as Utils from '../utils.js'
|
|
15
26
|
import * as Icon from './icon.js'
|
|
16
27
|
|
|
@@ -40,15 +51,15 @@ const ControlsMixin = {
|
|
|
40
51
|
this._controls = {}
|
|
41
52
|
|
|
42
53
|
if (this._umap.hasEditMode() && !this.options.noControl) {
|
|
43
|
-
new
|
|
54
|
+
new EditControl(this).addTo(this)
|
|
44
55
|
}
|
|
45
|
-
this._controls.home = new
|
|
56
|
+
this._controls.home = new HomeControl(this._umap)
|
|
46
57
|
this._controls.zoom = new Control.Zoom({
|
|
47
58
|
zoomInTitle: translate('Zoom in'),
|
|
48
59
|
zoomOutTitle: translate('Zoom out'),
|
|
49
60
|
})
|
|
50
|
-
this._controls.datalayers = new
|
|
51
|
-
this._controls.caption = new
|
|
61
|
+
this._controls.datalayers = new DataLayersControl(this._umap)
|
|
62
|
+
this._controls.caption = new CaptionControl(this._umap)
|
|
52
63
|
this._controls.locate = new U.Locate(this, {
|
|
53
64
|
strings: {
|
|
54
65
|
title: translate('Center map on your location'),
|
|
@@ -69,8 +80,8 @@ const ControlsMixin = {
|
|
|
69
80
|
},
|
|
70
81
|
})
|
|
71
82
|
this._controls.search = new U.SearchControl()
|
|
72
|
-
this._controls.embed = new
|
|
73
|
-
this._controls.tilelayersChooser = new
|
|
83
|
+
this._controls.embed = new EmbedControl(this._umap)
|
|
84
|
+
this._controls.tilelayersChooser = new TileLayerChooser(this._umap)
|
|
74
85
|
this._controls.editinosm = new Control.EditInOSM({
|
|
75
86
|
position: 'topleft',
|
|
76
87
|
widgetOptions: {
|
|
@@ -80,9 +91,9 @@ const ControlsMixin = {
|
|
|
80
91
|
},
|
|
81
92
|
})
|
|
82
93
|
this._controls.measure = new L.MeasureControl().initHandler(this)
|
|
83
|
-
this._controls.more = new
|
|
94
|
+
this._controls.more = new MoreControl()
|
|
84
95
|
this._controls.scale = L.control.scale()
|
|
85
|
-
this._controls.permanentCredit = new
|
|
96
|
+
this._controls.permanentCredit = new PermanentCreditsControl(this)
|
|
86
97
|
this._umap.drop = new DropControl(this._umap, this, this._container)
|
|
87
98
|
this._controls.tilelayers = new U.TileLayerControl(this)
|
|
88
99
|
},
|
|
@@ -93,7 +104,7 @@ const ControlsMixin = {
|
|
|
93
104
|
}
|
|
94
105
|
if (this.options.noControl) return
|
|
95
106
|
|
|
96
|
-
this._controls.attribution = new
|
|
107
|
+
this._controls.attribution = new AttributionControl().addTo(this)
|
|
97
108
|
if (this.options.miniMap) {
|
|
98
109
|
this.whenReady(function () {
|
|
99
110
|
if (this.selectedTilelayer) {
|
|
@@ -316,7 +327,7 @@ export const LeafletMap = BaseMap.extend({
|
|
|
316
327
|
} else if (this.options.defaultView === 'latest') {
|
|
317
328
|
this._umap.onceDataLoaded(() => {
|
|
318
329
|
if (!this._umap.hasData()) return
|
|
319
|
-
const datalayer = this._umap.
|
|
330
|
+
const datalayer = this._umap.datalayers.visible()[0]
|
|
320
331
|
let feature
|
|
321
332
|
if (datalayer) {
|
|
322
333
|
const feature = datalayer.getFeatureByIndex(-1)
|
|
@@ -109,7 +109,6 @@ const PointMixin = {
|
|
|
109
109
|
addInteractions() {
|
|
110
110
|
FeatureMixin.addInteractions.call(this)
|
|
111
111
|
this.on('dragend', (event) => {
|
|
112
|
-
this.isDirty = true
|
|
113
112
|
this.feature.edit(event)
|
|
114
113
|
})
|
|
115
114
|
if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stamp } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
2
|
import { AutocompleteDatalist } from './autocomplete.js'
|
|
3
3
|
import { MutatingForm } from './form/builder.js'
|
|
4
4
|
import { translate } from './i18n.js'
|
|
@@ -119,10 +119,9 @@ class Rule {
|
|
|
119
119
|
'options.smoothFactor',
|
|
120
120
|
'options.dashArray',
|
|
121
121
|
]
|
|
122
|
-
const container = DomUtil.create('div')
|
|
123
122
|
const builder = new MutatingForm(this, options)
|
|
124
|
-
const
|
|
125
|
-
|
|
123
|
+
const container = document.createElement('div')
|
|
124
|
+
container.appendChild(builder.build())
|
|
126
125
|
const autocomplete = new AutocompleteDatalist(builder.helpers.condition.input)
|
|
127
126
|
const properties = this._umap.allProperties()
|
|
128
127
|
autocomplete.suggestions = properties
|
|
@@ -137,43 +136,45 @@ class Rule {
|
|
|
137
136
|
.map((str) => `${value}${str || ''}`)
|
|
138
137
|
}
|
|
139
138
|
})
|
|
140
|
-
|
|
139
|
+
const backButton = Utils.loadTemplate(`
|
|
140
|
+
<button class="flat" type="button" data-ref="add">
|
|
141
|
+
<i class="icon icon-16 icon-back" title="${translate('Back to list')}"></i>
|
|
142
|
+
</button>`)
|
|
143
|
+
backButton.addEventListener('click', () =>
|
|
144
|
+
this._umap.edit().then(() => {
|
|
145
|
+
this._umap.editPanel.container.querySelector('details#rules').open = true
|
|
146
|
+
})
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
this._umap.editPanel.open({
|
|
150
|
+
content: container,
|
|
151
|
+
highlight: 'settings',
|
|
152
|
+
actions: [backButton],
|
|
153
|
+
})
|
|
141
154
|
}
|
|
142
155
|
|
|
143
|
-
renderToolbox(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
translate('
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
'click',
|
|
164
|
-
function () {
|
|
165
|
-
if (!confirm(translate('Are you sure you want to delete this rule?'))) return
|
|
166
|
-
this._delete()
|
|
167
|
-
this._umap.editPanel.close()
|
|
168
|
-
},
|
|
169
|
-
this
|
|
170
|
-
)
|
|
171
|
-
DomUtil.add('span', '', row, this.condition || translate('empty rule'))
|
|
172
|
-
DomUtil.createIcon(row, 'icon-drag', translate('Drag to reorder'))
|
|
173
|
-
row.dataset.id = stamp(this)
|
|
174
|
-
DomEvent.on(toggle, 'click', () => {
|
|
156
|
+
renderToolbox(ul) {
|
|
157
|
+
const template = `
|
|
158
|
+
<li data-id="${stamp(this)}" class="orderable">
|
|
159
|
+
<button class="icon icon-16 icon-eye" title="${translate('Toggle rule')}" data-ref=toggle></button>
|
|
160
|
+
<button class="icon icon-16 icon-edit show-on-edit" title="${translate('Edit')}" data-ref=edit></button>
|
|
161
|
+
<button class="icon icon-16 icon-delete show-on-edit" title="${translate('Delete rule')}" data-ref=remove></button>
|
|
162
|
+
<span>${this.condition || translate('empty rule')}</span>
|
|
163
|
+
<i class="icon icon-16 icon-drag" title="${translate('Drag to reorder')}"></i>
|
|
164
|
+
</li>
|
|
165
|
+
`
|
|
166
|
+
const [li, { toggle, edit, remove }] = Utils.loadTemplateWithRefs(template)
|
|
167
|
+
ul.appendChild(li)
|
|
168
|
+
li.classList.toggle('off', !this.active)
|
|
169
|
+
edit.addEventListener('click', () => this.edit())
|
|
170
|
+
remove.addEventListener('click', () => {
|
|
171
|
+
if (!confirm(translate('Are you sure you want to delete this rule?'))) return
|
|
172
|
+
this._delete()
|
|
173
|
+
this._umap.editPanel.close()
|
|
174
|
+
})
|
|
175
|
+
toggle.addEventListener('click', () => {
|
|
175
176
|
this.active = !this.active
|
|
176
|
-
|
|
177
|
+
li.classList.toggle('off', !this.active)
|
|
177
178
|
this._umap.render(['rules'])
|
|
178
179
|
})
|
|
179
180
|
}
|
|
@@ -207,8 +208,9 @@ export default class Rules {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
onReorder(src, dst, initialIndex, finalIndex) {
|
|
210
|
-
const
|
|
211
|
-
const
|
|
211
|
+
const oldRules = Utils.CopyJSON(this._umap.properties.rules || {})
|
|
212
|
+
const moved = this.rules.find((rule) => stamp(rule) === +src.dataset.id)
|
|
213
|
+
const reference = this.rules.find((rule) => stamp(rule) === +dst.dataset.id)
|
|
212
214
|
const movedIdx = this.rules.indexOf(moved)
|
|
213
215
|
let referenceIdx = this.rules.indexOf(reference)
|
|
214
216
|
const minIndex = Math.min(movedIdx, referenceIdx)
|
|
@@ -222,20 +224,28 @@ export default class Rules {
|
|
|
222
224
|
this.rules.splice(newIdx, 0, moved)
|
|
223
225
|
this._umap.render(['rules'])
|
|
224
226
|
this.commit()
|
|
227
|
+
this._umap.sync.update('properties.rules', this._umap.properties.rules, oldRules)
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
edit(container) {
|
|
228
|
-
const
|
|
231
|
+
const template = `
|
|
232
|
+
<details id="rules">
|
|
233
|
+
<summary>${translate('Conditional style rules')}</summary>
|
|
234
|
+
<fieldset>
|
|
235
|
+
<ul data-ref=ul></ul>
|
|
236
|
+
<button class="umap-add" type="button" data-ref=add>${translate('Add rule')}</button>
|
|
237
|
+
</fieldset>
|
|
238
|
+
</details>
|
|
239
|
+
`
|
|
240
|
+
const [body, { ul, add }] = Utils.loadTemplateWithRefs(template)
|
|
229
241
|
if (this.rules.length) {
|
|
230
|
-
const ul = DomUtil.create('ul', '', body)
|
|
231
242
|
for (const rule of this.rules) {
|
|
232
|
-
rule.renderToolbox(
|
|
243
|
+
rule.renderToolbox(ul)
|
|
233
244
|
}
|
|
234
|
-
|
|
235
245
|
const orderable = new Orderable(ul, this.onReorder.bind(this))
|
|
236
246
|
}
|
|
237
|
-
|
|
238
|
-
|
|
247
|
+
add.addEventListener('click', () => this.addRule())
|
|
248
|
+
container.appendChild(body)
|
|
239
249
|
}
|
|
240
250
|
|
|
241
251
|
addRule() {
|
|
@@ -10,7 +10,7 @@ import { translate } from './i18n.js'
|
|
|
10
10
|
* - `type`: The type of the data
|
|
11
11
|
* - `impacts`: A list of impacts than happen when this property is updated, among
|
|
12
12
|
* 'ui', 'data', 'limit-bounds', 'datalayer-index', 'remote-data',
|
|
13
|
-
* 'background' 'sync'.
|
|
13
|
+
* 'background', 'sync', 'datalayer-rank'.
|
|
14
14
|
*
|
|
15
15
|
* - Extra keys are being passed to the FormBuilder automatically.
|
|
16
16
|
*/
|
|
@@ -436,6 +436,10 @@ export const SCHEMA = {
|
|
|
436
436
|
],
|
|
437
437
|
default: 'Default',
|
|
438
438
|
},
|
|
439
|
+
rank: {
|
|
440
|
+
type: Number,
|
|
441
|
+
impacts: ['datalayer-rank'],
|
|
442
|
+
},
|
|
439
443
|
remoteData: {
|
|
440
444
|
type: Object,
|
|
441
445
|
impacts: ['remote-data'],
|
|
@@ -204,8 +204,8 @@ class IframeExporter {
|
|
|
204
204
|
delete this.queryString.feature
|
|
205
205
|
}
|
|
206
206
|
if (this.options.keepCurrentDatalayers) {
|
|
207
|
-
this._umap.
|
|
208
|
-
if (datalayer.
|
|
207
|
+
this._umap.datalayers.visible().map((datalayer) => {
|
|
208
|
+
if (datalayer.createdOnServer) {
|
|
209
209
|
datalayers.push(datalayer.id)
|
|
210
210
|
}
|
|
211
211
|
})
|
|
@@ -207,31 +207,45 @@ export class SyncEngine {
|
|
|
207
207
|
this._send(operation)
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
const
|
|
210
|
+
_getDirtyObjects() {
|
|
211
|
+
const dirty = new Map()
|
|
212
212
|
if (!this._umap.id) {
|
|
213
213
|
// There is no operation for first map save
|
|
214
|
-
|
|
214
|
+
dirty.set(this._umap, [])
|
|
215
|
+
}
|
|
216
|
+
const addDirtyObject = (operation) => {
|
|
217
|
+
const updater = this._getUpdater(operation.subject)
|
|
218
|
+
const obj = updater.getStoredObject(operation.metadata)
|
|
219
|
+
if (!dirty.has(obj)) {
|
|
220
|
+
dirty.set(obj, [])
|
|
221
|
+
}
|
|
222
|
+
dirty.get(obj).push(operation)
|
|
215
223
|
}
|
|
216
224
|
for (const operation of this._operations.sorted()) {
|
|
217
225
|
if (operation.dirty) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
226
|
+
addDirtyObject(operation)
|
|
227
|
+
if (operation.verb === 'batch') {
|
|
228
|
+
for (const op of operation.operations) {
|
|
229
|
+
addDirtyObject(op)
|
|
230
|
+
}
|
|
222
231
|
}
|
|
223
|
-
needSave.get(obj).push(operation)
|
|
224
232
|
}
|
|
225
233
|
}
|
|
234
|
+
return dirty
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async save() {
|
|
238
|
+
const needSave = this._getDirtyObjects()
|
|
226
239
|
for (const [obj, operations] of needSave.entries()) {
|
|
227
240
|
const ok = await obj.save()
|
|
228
|
-
if (!ok)
|
|
241
|
+
if (!ok) return false
|
|
229
242
|
for (const operation of operations) {
|
|
230
243
|
operation.dirty = false
|
|
231
244
|
}
|
|
232
245
|
}
|
|
233
246
|
this.saved()
|
|
234
247
|
this._undoManager.toggleState()
|
|
248
|
+
return true
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
saved() {
|
|
@@ -207,7 +207,7 @@ export class BottomBar extends WithTemplate {
|
|
|
207
207
|
const select = this.elements.layers
|
|
208
208
|
const selected = select.options[select.selectedIndex].value
|
|
209
209
|
if (!selected) return
|
|
210
|
-
this._umap.
|
|
210
|
+
this._umap.datalayers.active().map((datalayer) => {
|
|
211
211
|
datalayer.toggle(datalayer.id === selected)
|
|
212
212
|
})
|
|
213
213
|
})
|
|
@@ -228,7 +228,7 @@ export class BottomBar extends WithTemplate {
|
|
|
228
228
|
|
|
229
229
|
buildDataLayerSwitcher() {
|
|
230
230
|
this.elements.layers.innerHTML = ''
|
|
231
|
-
const datalayers = this._umap.
|
|
231
|
+
const datalayers = this._umap.datalayers.filter((d) => d.options.inCaption)
|
|
232
232
|
if (datalayers.length < 2) {
|
|
233
233
|
this.elements.layers.hidden = true
|
|
234
234
|
} else {
|
|
@@ -4,6 +4,8 @@ export class Positioned {
|
|
|
4
4
|
this.anchorTop(anchor)
|
|
5
5
|
} else if (anchor && position === 'bottom') {
|
|
6
6
|
this.anchorBottom(anchor)
|
|
7
|
+
} else if (anchor && position === 'right') {
|
|
8
|
+
this.anchorRight(anchor)
|
|
7
9
|
} else {
|
|
8
10
|
this.anchorAbsolute()
|
|
9
11
|
}
|
|
@@ -12,6 +14,7 @@ export class Positioned {
|
|
|
12
14
|
toggleClassPosition(position) {
|
|
13
15
|
this.container.classList.toggle('tooltip-bottom', position === 'bottom')
|
|
14
16
|
this.container.classList.toggle('tooltip-top', position === 'top')
|
|
17
|
+
this.container.classList.toggle('tooltip-right', position === 'right')
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
anchorTop(el) {
|
|
@@ -33,6 +36,16 @@ export class Positioned {
|
|
|
33
36
|
})
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
anchorRight(el) {
|
|
40
|
+
this.toggleClassPosition('right')
|
|
41
|
+
const coords = this.getPosition(el)
|
|
42
|
+
console.log(coords)
|
|
43
|
+
this.setPosition({
|
|
44
|
+
left: coords.right + 11,
|
|
45
|
+
top: coords.top,
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
anchorAbsolute() {
|
|
37
50
|
const left =
|
|
38
51
|
this.parent.offsetLeft +
|