umap-project 3.4.0b3__py3-none-any.whl → 3.4.2__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.
- umap/__init__.py +1 -1
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +18 -14
- umap/locale/en/LC_MESSAGES/django.po +5 -1
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +20 -16
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +18 -14
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +72 -71
- umap/static/umap/content.css +0 -3
- umap/static/umap/css/bar.css +9 -6
- umap/static/umap/css/form.css +25 -9
- umap/static/umap/css/popup.css +1 -0
- umap/static/umap/js/components/copiable.js +47 -0
- umap/static/umap/js/modules/autocomplete.js +31 -58
- umap/static/umap/js/modules/browser.js +4 -4
- umap/static/umap/js/modules/data/features.js +32 -35
- umap/static/umap/js/modules/data/fields.js +189 -23
- umap/static/umap/js/modules/data/layer.js +72 -87
- umap/static/umap/js/modules/domutils.js +21 -1
- umap/static/umap/js/modules/filters.js +13 -40
- umap/static/umap/js/modules/form/fields.js +4 -4
- umap/static/umap/js/modules/formatter.js +9 -1
- umap/static/umap/js/modules/help.js +12 -13
- umap/static/umap/js/modules/importer.js +17 -26
- umap/static/umap/js/modules/importers/banfr.js +0 -1
- umap/static/umap/js/modules/importers/cadastrefr.js +19 -19
- umap/static/umap/js/modules/importers/communesfr.js +7 -8
- umap/static/umap/js/modules/importers/datasets.js +14 -14
- umap/static/umap/js/modules/importers/geodatamine.js +20 -22
- umap/static/umap/js/modules/importers/opendata.js +10 -0
- umap/static/umap/js/modules/importers/overpass.js +19 -18
- umap/static/umap/js/modules/managers.js +1 -1
- umap/static/umap/js/modules/permissions.js +5 -3
- umap/static/umap/js/modules/rendering/controls.js +2 -2
- umap/static/umap/js/modules/rendering/icon.js +5 -9
- umap/static/umap/js/modules/rendering/layers/base.js +1 -1
- umap/static/umap/js/modules/rendering/layers/classified.js +15 -10
- umap/static/umap/js/modules/rendering/layers/heat.js +1 -0
- umap/static/umap/js/modules/rendering/map.js +22 -22
- umap/static/umap/js/modules/rendering/popup.js +6 -3
- umap/static/umap/js/modules/rendering/template.js +28 -34
- umap/static/umap/js/modules/rendering/ui.js +1 -2
- umap/static/umap/js/modules/rules.js +34 -41
- umap/static/umap/js/modules/schema.js +0 -7
- umap/static/umap/js/modules/share.js +36 -69
- umap/static/umap/js/modules/slideshow.js +3 -3
- umap/static/umap/js/modules/tableeditor.js +0 -1
- umap/static/umap/js/modules/ui/bar.js +51 -32
- umap/static/umap/js/modules/ui/panel.js +26 -21
- umap/static/umap/js/modules/ui/tooltip.js +1 -1
- umap/static/umap/js/modules/umap.js +75 -80
- umap/static/umap/js/modules/utils.js +12 -3
- umap/static/umap/js/umap.controls.js +33 -14
- umap/static/umap/locale/am_ET.js +6 -4
- umap/static/umap/locale/am_ET.json +6 -4
- umap/static/umap/locale/ar.js +6 -4
- umap/static/umap/locale/ar.json +6 -4
- umap/static/umap/locale/ast.js +6 -4
- umap/static/umap/locale/ast.json +6 -4
- umap/static/umap/locale/bg.js +6 -4
- umap/static/umap/locale/bg.json +6 -4
- umap/static/umap/locale/br.js +19 -8
- umap/static/umap/locale/br.json +19 -8
- umap/static/umap/locale/ca.js +6 -4
- umap/static/umap/locale/ca.json +6 -4
- umap/static/umap/locale/cs_CZ.js +7 -5
- umap/static/umap/locale/cs_CZ.json +7 -5
- umap/static/umap/locale/da.js +8 -6
- umap/static/umap/locale/da.json +8 -6
- umap/static/umap/locale/de.js +38 -36
- umap/static/umap/locale/de.json +38 -36
- umap/static/umap/locale/el.js +7 -5
- umap/static/umap/locale/el.json +7 -5
- umap/static/umap/locale/en.js +7 -5
- umap/static/umap/locale/en.json +7 -5
- umap/static/umap/locale/en_US.json +6 -4
- umap/static/umap/locale/es.js +19 -17
- umap/static/umap/locale/es.json +19 -17
- umap/static/umap/locale/et.js +7 -5
- umap/static/umap/locale/et.json +7 -5
- umap/static/umap/locale/eu.js +23 -21
- umap/static/umap/locale/eu.json +23 -21
- umap/static/umap/locale/fa_IR.js +7 -5
- umap/static/umap/locale/fa_IR.json +7 -5
- umap/static/umap/locale/fi.js +6 -4
- umap/static/umap/locale/fi.json +6 -4
- umap/static/umap/locale/fr.js +8 -6
- umap/static/umap/locale/fr.json +8 -6
- umap/static/umap/locale/gl.js +147 -145
- umap/static/umap/locale/gl.json +147 -145
- umap/static/umap/locale/he.js +6 -4
- umap/static/umap/locale/he.json +6 -4
- umap/static/umap/locale/hr.js +6 -4
- umap/static/umap/locale/hr.json +6 -4
- umap/static/umap/locale/hu.js +7 -5
- umap/static/umap/locale/hu.json +7 -5
- umap/static/umap/locale/id.js +6 -4
- umap/static/umap/locale/id.json +6 -4
- umap/static/umap/locale/is.js +7 -5
- umap/static/umap/locale/is.json +7 -5
- umap/static/umap/locale/it.js +7 -5
- umap/static/umap/locale/it.json +7 -5
- umap/static/umap/locale/ja.js +6 -4
- umap/static/umap/locale/ja.json +6 -4
- umap/static/umap/locale/ko.js +6 -4
- umap/static/umap/locale/ko.json +6 -4
- umap/static/umap/locale/lt.js +6 -4
- umap/static/umap/locale/lt.json +6 -4
- umap/static/umap/locale/ms.js +7 -5
- umap/static/umap/locale/ms.json +7 -5
- umap/static/umap/locale/nl.js +7 -5
- umap/static/umap/locale/nl.json +7 -5
- umap/static/umap/locale/no.js +6 -4
- umap/static/umap/locale/no.json +6 -4
- umap/static/umap/locale/pl.js +53 -51
- umap/static/umap/locale/pl.json +53 -51
- umap/static/umap/locale/pl_PL.json +6 -4
- umap/static/umap/locale/pt.js +7 -5
- umap/static/umap/locale/pt.json +7 -5
- umap/static/umap/locale/pt_BR.js +6 -4
- umap/static/umap/locale/pt_BR.json +6 -4
- umap/static/umap/locale/pt_PT.js +6 -4
- umap/static/umap/locale/pt_PT.json +6 -4
- umap/static/umap/locale/ro.js +6 -4
- umap/static/umap/locale/ro.json +6 -4
- umap/static/umap/locale/ru.js +6 -4
- umap/static/umap/locale/ru.json +6 -4
- umap/static/umap/locale/sk_SK.js +6 -4
- umap/static/umap/locale/sk_SK.json +6 -4
- umap/static/umap/locale/sl.js +6 -4
- umap/static/umap/locale/sl.json +6 -4
- umap/static/umap/locale/sr.js +6 -4
- umap/static/umap/locale/sr.json +6 -4
- umap/static/umap/locale/sv.js +6 -4
- umap/static/umap/locale/sv.json +6 -4
- umap/static/umap/locale/th_TH.js +6 -4
- umap/static/umap/locale/th_TH.json +6 -4
- umap/static/umap/locale/tr.js +6 -4
- umap/static/umap/locale/tr.json +6 -4
- umap/static/umap/locale/uk_UA.js +6 -4
- umap/static/umap/locale/uk_UA.json +6 -4
- umap/static/umap/locale/vi.js +6 -4
- umap/static/umap/locale/vi.json +6 -4
- umap/static/umap/locale/vi_VN.json +6 -4
- umap/static/umap/locale/zh.js +6 -4
- umap/static/umap/locale/zh.json +6 -4
- umap/static/umap/locale/zh_CN.json +6 -4
- umap/static/umap/locale/zh_TW.Big5.json +6 -4
- umap/static/umap/locale/zh_TW.js +20 -18
- umap/static/umap/locale/zh_TW.json +20 -18
- umap/static/umap/map.css +5 -4
- umap/static/umap/unittests/utils.js +7 -7
- umap/templates/umap/content_footer.html +1 -0
- umap/templates/umap/css.html +0 -2
- umap/templates/umap/js.html +1 -3
- umap/tests/integration/conftest.py +3 -2
- umap/tests/integration/test_anonymous_owned_map.py +1 -1
- umap/tests/integration/test_conditional_rules.py +106 -51
- umap/tests/integration/test_draw_polygon.py +4 -0
- umap/tests/integration/test_draw_polyline.py +11 -0
- umap/tests/integration/test_edit_datalayer.py +1 -1
- umap/tests/integration/test_fields.py +19 -0
- umap/tests/integration/test_iframe.py +1 -1
- umap/tests/integration/test_import.py +23 -0
- umap/tests/integration/test_map.py +2 -2
- umap/tests/integration/test_owned_map.py +2 -2
- umap/tests/integration/test_popup.py +31 -0
- umap/tests/integration/test_remote_data.py +4 -4
- umap/tests/integration/test_search.py +41 -0
- umap/tests/integration/test_share.py +2 -2
- umap/tests/integration/test_team.py +1 -1
- umap/tests/integration/test_websocket_sync.py +6 -1
- umap/tests/test_utils.py +4 -1
- umap/utils.py +1 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/METADATA +15 -15
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/RECORD +181 -183
- umap/static/umap/js/umap.core.js +0 -93
- umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.css +0 -46
- umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.js +0 -240
- umap/static/umap/vendors/editinosm/edit-in-osm.png +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/WHEEL +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/entry_points.txt +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DomEvent,
|
|
3
|
-
DomUtil,
|
|
4
|
-
CircleMarker,
|
|
5
|
-
} from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
1
|
+
import { DomEvent, CircleMarker } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
6
2
|
import { getLocale, translate } from '../i18n.js'
|
|
7
3
|
import { Request } from '../request.js'
|
|
8
4
|
import * as Utils from '../utils.js'
|
|
@@ -92,7 +88,11 @@ class PopupTemplate {
|
|
|
92
88
|
const title = this.renderTitle(feature)
|
|
93
89
|
if (title) container.appendChild(title)
|
|
94
90
|
const body = await this.renderBody(feature)
|
|
95
|
-
if (body)
|
|
91
|
+
if (body) {
|
|
92
|
+
const div = DOMUtils.loadTemplate('<div class="umap-popup-content"></div>')
|
|
93
|
+
div.appendChild(body)
|
|
94
|
+
container.appendChild(div)
|
|
95
|
+
}
|
|
96
96
|
const footer = this.renderFooter(feature)
|
|
97
97
|
if (footer) container.appendChild(footer)
|
|
98
98
|
}
|
|
@@ -108,18 +108,9 @@ export const TitleMixin = (Base) =>
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
class Table extends TitleMixin(PopupTemplate) {
|
|
111
|
-
|
|
112
|
-
// TODO, manage links (url, mailto, wikipedia...)
|
|
113
|
-
const value = Utils.escapeHTML(feature.properties[key]).trim()
|
|
114
|
-
if (value.indexOf('http') === 0) {
|
|
115
|
-
return `<a href="${value}" target="_blank">${value}</a>`
|
|
116
|
-
}
|
|
117
|
-
return value
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
makeRow(feature, key) {
|
|
111
|
+
makeRow(feature, field) {
|
|
121
112
|
return Utils.loadTemplate(
|
|
122
|
-
`<tr><th>${key}</th><td>${
|
|
113
|
+
`<tr><th>${field.key}</th><td>${field.render(feature.properties[field.key])}</td></tr>`
|
|
123
114
|
)
|
|
124
115
|
}
|
|
125
116
|
|
|
@@ -130,7 +121,7 @@ class Table extends TitleMixin(PopupTemplate) {
|
|
|
130
121
|
if (U.LABEL_KEYS.includes(field.key)) {
|
|
131
122
|
continue
|
|
132
123
|
}
|
|
133
|
-
table.appendChild(this.makeRow(feature, field
|
|
124
|
+
table.appendChild(this.makeRow(feature, field))
|
|
134
125
|
}
|
|
135
126
|
return table
|
|
136
127
|
}
|
|
@@ -138,16 +129,17 @@ class Table extends TitleMixin(PopupTemplate) {
|
|
|
138
129
|
|
|
139
130
|
class GeoRSSImage extends TitleMixin(PopupTemplate) {
|
|
140
131
|
async renderBody(feature) {
|
|
141
|
-
const body =
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
const body = DOMUtils.loadTemplate(
|
|
133
|
+
`<a href="${feature.properties.link}" target="_blank"></a>`
|
|
134
|
+
)
|
|
144
135
|
if (feature.properties.img) {
|
|
145
|
-
const img = DomUtil.create('img', '', body)
|
|
146
|
-
img.src = feature.properties.img
|
|
147
136
|
// Sadly, we are unable to override this from JS the clean way
|
|
148
137
|
// See https://github.com/Leaflet/Leaflet/commit/61d746818b99d362108545c151a27f09d60960ee#commitcomment-6061847
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
body.appendChild(
|
|
139
|
+
DOMUtils.loadTemplate(
|
|
140
|
+
`<img src=${feature.properties.img} style="max-width: 500px; max-height: 500px;">`
|
|
141
|
+
)
|
|
142
|
+
)
|
|
151
143
|
}
|
|
152
144
|
return body
|
|
153
145
|
}
|
|
@@ -165,15 +157,16 @@ class GeoRSSLink extends PopupTemplate {
|
|
|
165
157
|
|
|
166
158
|
class OSM extends PopupTemplate {
|
|
167
159
|
renderTitle(feature) {
|
|
168
|
-
const title = DomUtil.add('h3', 'popup-title')
|
|
169
160
|
const color = feature.getPreviewColor()
|
|
170
|
-
title
|
|
161
|
+
const [title, { iconContainer }] = DOMUtils.loadTemplateWithRefs(`
|
|
162
|
+
<h3 class="popup-title" style="background-color: ${color};">
|
|
163
|
+
<span data-ref="iconContainer"></span> ${this.getName(feature)}
|
|
164
|
+
</h3>`)
|
|
171
165
|
const iconUrl = feature.getDynamicOption('iconUrl')
|
|
172
|
-
const icon = Icon.makeElement(iconUrl,
|
|
173
|
-
|
|
166
|
+
const icon = Icon.makeElement(iconUrl, iconContainer)
|
|
167
|
+
icon.classList.add('icon')
|
|
174
168
|
Icon.setContrast(icon, title, iconUrl, color)
|
|
175
169
|
if (DOMUtils.contrastedColor(title, color)) title.style.color = 'white'
|
|
176
|
-
DomUtil.add('span', '', title, this.getName(feature))
|
|
177
170
|
return title
|
|
178
171
|
}
|
|
179
172
|
|
|
@@ -190,15 +183,16 @@ class OSM extends PopupTemplate {
|
|
|
190
183
|
const locale = getLocale()
|
|
191
184
|
const street = props['addr:street']
|
|
192
185
|
if (street) {
|
|
193
|
-
const row = DomUtil.add('address', 'address', body)
|
|
194
186
|
const number = props['addr:housenumber']
|
|
187
|
+
let content
|
|
195
188
|
if (number) {
|
|
196
189
|
// Poor way to deal with international forms of writing addresses
|
|
197
|
-
|
|
198
|
-
DomUtil.add('span', '', row, `${translate('Street')}: ${street}`)
|
|
190
|
+
content = `<span>${translate('№')}: ${number}</span><span>${translate('Street')}: ${street}</span>`
|
|
199
191
|
} else {
|
|
200
|
-
|
|
192
|
+
content = street
|
|
201
193
|
}
|
|
194
|
+
const row = DOMUtils.loadTemplate(`<address class="address">${content}</address>`)
|
|
195
|
+
body.appendChild(row)
|
|
202
196
|
}
|
|
203
197
|
if (props.website) {
|
|
204
198
|
body.appendChild(
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CircleMarker as BaseCircleMarker,
|
|
4
4
|
DomEvent,
|
|
5
|
-
DomUtil,
|
|
6
5
|
GeoJSON,
|
|
7
6
|
LatLng,
|
|
8
7
|
LatLngBounds,
|
|
@@ -314,7 +313,7 @@ const PathMixin = {
|
|
|
314
313
|
this.enableEdit()
|
|
315
314
|
} else {
|
|
316
315
|
this._map._umap.tooltip.open({
|
|
317
|
-
content:
|
|
316
|
+
content: translate('Please zoom in to edit the geometry'),
|
|
318
317
|
})
|
|
319
318
|
this.disableEdit()
|
|
320
319
|
}
|
|
@@ -6,6 +6,7 @@ import Orderable from './orderable.js'
|
|
|
6
6
|
import * as Utils from './utils.js'
|
|
7
7
|
import * as Icon from './rendering/icon.js'
|
|
8
8
|
import { SCHEMA } from './schema.js'
|
|
9
|
+
import { Registry as Fields } from './data/fields.js'
|
|
9
10
|
|
|
10
11
|
const EMPTY_VALUES = ['', undefined, null]
|
|
11
12
|
|
|
@@ -28,12 +29,12 @@ class Rule {
|
|
|
28
29
|
// cf https://caniuse.com/?search=public%20class%20field
|
|
29
30
|
this._condition = null
|
|
30
31
|
this.OPERATORS = [
|
|
31
|
-
['>',
|
|
32
|
-
['<',
|
|
32
|
+
['>', 'gt'],
|
|
33
|
+
['<', 'lt'],
|
|
33
34
|
// When sent by Django
|
|
34
|
-
['<',
|
|
35
|
-
['!=',
|
|
36
|
-
['=',
|
|
35
|
+
['<', 'lt'],
|
|
36
|
+
['!=', 'not_equal'],
|
|
37
|
+
['=', 'equal'],
|
|
37
38
|
]
|
|
38
39
|
this.parent = parent
|
|
39
40
|
this._umap = umap
|
|
@@ -47,58 +48,47 @@ class Rule {
|
|
|
47
48
|
this.parent.render(fields)
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
equal(other) {
|
|
51
|
-
return this.expected === other
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
not_equal(other) {
|
|
55
|
-
return this.expected !== other
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
gt(other) {
|
|
59
|
-
return other > this.expected
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
lt(other) {
|
|
63
|
-
return other < this.expected
|
|
64
|
-
}
|
|
65
|
-
|
|
66
51
|
parse() {
|
|
67
52
|
let vars = []
|
|
68
53
|
this.cast = (v) => v
|
|
69
54
|
this.operator = undefined
|
|
70
|
-
|
|
55
|
+
let operator = undefined
|
|
56
|
+
for (const [sign, funcName] of this.OPERATORS) {
|
|
71
57
|
if (this.condition.includes(sign)) {
|
|
72
|
-
|
|
58
|
+
operator = funcName
|
|
73
59
|
vars = this.condition.split(sign)
|
|
74
60
|
break
|
|
75
61
|
}
|
|
76
62
|
}
|
|
77
63
|
if (vars.length !== 2) return
|
|
78
|
-
this.
|
|
64
|
+
this.field = this.parent.fields.get(vars[0]) || new Fields.String(vars[0])
|
|
65
|
+
this.operator = this.field[operator]
|
|
79
66
|
this.expected = vars[1]
|
|
80
67
|
if (EMPTY_VALUES.includes(this.expected)) {
|
|
81
68
|
this.cast = (v) => EMPTY_VALUES.includes(v)
|
|
82
69
|
}
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
70
|
+
// TODO: deal with legacy rules on non typed fields
|
|
71
|
+
else {
|
|
72
|
+
this.cast = this.field.parse
|
|
73
|
+
if (
|
|
74
|
+
// Special cases where we want to be lousy when checking isNaN without
|
|
75
|
+
// coercing to a Number first because we handle multiple types.
|
|
76
|
+
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/
|
|
77
|
+
// Reference/Global_Objects/Number/isNaN
|
|
78
|
+
// biome-ignore lint/suspicious/noGlobalIsNan: expected might not be a number.
|
|
79
|
+
!isNaN(this.expected) &&
|
|
80
|
+
['gt', 'lt'].includes(operator) &&
|
|
81
|
+
this.field.TYPE !== 'Number'
|
|
82
|
+
) {
|
|
83
|
+
this.cast = Number.parseFloat
|
|
94
84
|
}
|
|
95
85
|
}
|
|
96
86
|
this.expected = this.cast(this.expected)
|
|
97
87
|
}
|
|
98
88
|
|
|
99
89
|
match(props) {
|
|
100
|
-
if (!this.operator || !this.active) return false
|
|
101
|
-
return this.operator(this.cast(props[this.key]))
|
|
90
|
+
if (!this.operator || !this.active || !this.field) return false
|
|
91
|
+
return this.operator(this.expected, this.cast(props[this.field.key]))
|
|
102
92
|
}
|
|
103
93
|
|
|
104
94
|
getOption(option) {
|
|
@@ -118,6 +108,7 @@ class Rule {
|
|
|
118
108
|
'name',
|
|
119
109
|
'properties.color',
|
|
120
110
|
'properties.iconClass',
|
|
111
|
+
'properties.iconSize',
|
|
121
112
|
'properties.iconUrl',
|
|
122
113
|
'properties.iconOpacity',
|
|
123
114
|
'properties.opacity',
|
|
@@ -132,7 +123,7 @@ class Rule {
|
|
|
132
123
|
const container = document.createElement('div')
|
|
133
124
|
container.appendChild(builder.build())
|
|
134
125
|
const autocomplete = new AutocompleteDatalist(builder.helpers.condition.input)
|
|
135
|
-
const properties = this.parent.
|
|
126
|
+
const properties = Array.from(this.parent.fields.keys())
|
|
136
127
|
autocomplete.suggestions = properties
|
|
137
128
|
autocomplete.input.addEventListener('input', (event) => {
|
|
138
129
|
const value = event.target.value
|
|
@@ -140,9 +131,11 @@ class Rule {
|
|
|
140
131
|
autocomplete.suggestions = [`${value}=`, `${value}!=`, `${value}>`, `${value}<`]
|
|
141
132
|
} else if (value.endsWith('=')) {
|
|
142
133
|
const key = value.split('!')[0].split('=')[0]
|
|
143
|
-
|
|
144
|
-
.
|
|
145
|
-
|
|
134
|
+
if (key) {
|
|
135
|
+
autocomplete.suggestions = this.parent
|
|
136
|
+
.sortedValues(key)
|
|
137
|
+
.map((str) => `${value}${str ?? ''}`)
|
|
138
|
+
}
|
|
146
139
|
}
|
|
147
140
|
})
|
|
148
141
|
const backButton = Utils.loadTemplate(`
|
|
@@ -123,13 +123,6 @@ export const SCHEMA = {
|
|
|
123
123
|
edit_status: {
|
|
124
124
|
type: Number,
|
|
125
125
|
},
|
|
126
|
-
editinosmControl: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
impacts: ['ui'],
|
|
129
|
-
nullable: true,
|
|
130
|
-
label: translate('Display the control to open OpenStreetMap editor'),
|
|
131
|
-
default: null,
|
|
132
|
-
},
|
|
133
126
|
editors: {
|
|
134
127
|
type: Array,
|
|
135
128
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { MutatingForm } from './form/builder.js'
|
|
3
2
|
import { EXPORT_FORMATS } from './formatter.js'
|
|
4
3
|
import { translate } from './i18n.js'
|
|
@@ -11,39 +10,35 @@ export default class Share {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
build() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
const downloadUrl = this._umap.urls.get('map_download', {
|
|
14
|
+
map_id: this._umap.id,
|
|
15
|
+
})
|
|
16
|
+
const [container, { shortUrl, list, customLink, textarea, iframeOptionsWrapper }] =
|
|
17
|
+
DOMUtils.loadTemplateWithRefs(`
|
|
18
|
+
<div>
|
|
19
|
+
<h3><i class="icon icon-16 icon-share"></i> ${translate('Share and download')}</h3>
|
|
20
|
+
<h4>${translate('Share')}</h4>
|
|
21
|
+
<copiable-input data-label="${translate('Link to view the map')}" data-value="${window.location.protocol + Utils.getBaseUrl()}"></copiable-input>
|
|
22
|
+
<copiable-input data-label="${translate('Short link')}" data-value="${this._umap.properties.shortUrl}" data-ref="shortUrl" hidden></copiable-input>
|
|
23
|
+
<copiable-textarea data-label="${translate('Customized link')}" data-ref="customLink"></copiable-textarea>
|
|
24
|
+
<copiable-textarea data-label="${translate('Iframe')}" data-ref="textarea"></copiable-textarea>
|
|
25
|
+
<div data-ref="iframeOptionsWrapper"></div>
|
|
26
|
+
<hr>
|
|
27
|
+
<h4>${translate('Download')}</h4>
|
|
28
|
+
<h5>${translate("Only visible layers' data")}</h5>
|
|
29
|
+
<ul data-ref="list" class="downloads"></ul>
|
|
30
|
+
<h5>${translate('All data and settings of the map')}</h5>
|
|
31
|
+
<p>
|
|
32
|
+
<a href="${downloadUrl}" download="backup.umap">
|
|
33
|
+
<i class="icon icon-16 icon-backup"></i>${translate('full backup')}
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
`)
|
|
38
|
+
this.container = container
|
|
27
39
|
if (this._umap.properties.shortUrl) {
|
|
28
|
-
|
|
29
|
-
this.container,
|
|
30
|
-
translate('Short link'),
|
|
31
|
-
this._umap.properties.shortUrl
|
|
32
|
-
)
|
|
40
|
+
shortUrl.hidden = false
|
|
33
41
|
}
|
|
34
|
-
|
|
35
|
-
DomUtil.create('hr', '', this.container)
|
|
36
|
-
|
|
37
|
-
DomUtil.add('h4', '', this.container, translate('Download'))
|
|
38
|
-
DomUtil.add(
|
|
39
|
-
'small',
|
|
40
|
-
'label',
|
|
41
|
-
this.container,
|
|
42
|
-
translate("Only visible layers' data")
|
|
43
|
-
)
|
|
44
|
-
const list = document.createElement('ul')
|
|
45
|
-
list.classList.add('downloads')
|
|
46
|
-
this.container.appendChild(list)
|
|
47
42
|
for (const format of Object.keys(EXPORT_FORMATS).concat('jpg', 'png')) {
|
|
48
43
|
const button = Utils.loadTemplate(`
|
|
49
44
|
<li>
|
|
@@ -55,38 +50,7 @@ export default class Share {
|
|
|
55
50
|
button.addEventListener('click', () => this.download(format))
|
|
56
51
|
list.appendChild(button)
|
|
57
52
|
}
|
|
58
|
-
DomUtil.create('div', 'vspace', this.container)
|
|
59
|
-
DomUtil.add(
|
|
60
|
-
'small',
|
|
61
|
-
'label',
|
|
62
|
-
this.container,
|
|
63
|
-
translate('All data and settings of the map')
|
|
64
|
-
)
|
|
65
|
-
const downloadUrl = this._umap.urls.get('map_download', {
|
|
66
|
-
map_id: this._umap.id,
|
|
67
|
-
})
|
|
68
|
-
const link = Utils.loadTemplate(`
|
|
69
|
-
<div>
|
|
70
|
-
<a href="${downloadUrl}">
|
|
71
|
-
<i class="icon icon-16 icon-backup"></i>${translate('full backup')}
|
|
72
|
-
</a>
|
|
73
|
-
</div>
|
|
74
|
-
`)
|
|
75
|
-
this.container.appendChild(link)
|
|
76
|
-
// File will be named by back-office
|
|
77
|
-
link.setAttribute('download', 'backup.umap')
|
|
78
|
-
DomUtil.create('hr', '', this.container)
|
|
79
53
|
|
|
80
|
-
const embedTitle = DomUtil.add('h4', '', this.container, translate('Embed the map'))
|
|
81
|
-
const iframe = DomUtil.create('textarea', 'umap-share-iframe', this.container)
|
|
82
|
-
const urlTitle = DomUtil.add('h4', '', this.container, translate('Direct link'))
|
|
83
|
-
const exportUrl = DOMUtils.copiableInput(
|
|
84
|
-
this.container,
|
|
85
|
-
translate('Share this link to open a customized map view'),
|
|
86
|
-
''
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
exportUrl.type = 'text'
|
|
90
54
|
const UIFields = [
|
|
91
55
|
['dimensions.width', { handler: 'Input', label: translate('width') }],
|
|
92
56
|
['dimensions.height', { handler: 'Input', label: translate('height') }],
|
|
@@ -123,14 +87,17 @@ export default class Share {
|
|
|
123
87
|
}
|
|
124
88
|
const iframeExporter = new IframeExporter(this._umap)
|
|
125
89
|
const buildIframeCode = () => {
|
|
126
|
-
|
|
127
|
-
|
|
90
|
+
textarea.setAttribute('value', iframeExporter.build())
|
|
91
|
+
customLink.setAttribute(
|
|
92
|
+
'value',
|
|
93
|
+
window.location.protocol + iframeExporter.buildUrl()
|
|
94
|
+
)
|
|
128
95
|
}
|
|
129
96
|
buildIframeCode()
|
|
130
97
|
const builder = new MutatingForm(iframeExporter, UIFields)
|
|
131
98
|
builder.on('set', buildIframeCode)
|
|
132
|
-
const iframeOptions =
|
|
133
|
-
|
|
99
|
+
const iframeOptions = DOMUtils.createFieldset(
|
|
100
|
+
iframeOptionsWrapper,
|
|
134
101
|
translate('Embed and link options')
|
|
135
102
|
)
|
|
136
103
|
iframeOptions.appendChild(builder.build())
|
|
@@ -222,13 +189,13 @@ class IframeExporter {
|
|
|
222
189
|
delete this.queryString.datalayers
|
|
223
190
|
}
|
|
224
191
|
const currentView = this.options.currentView ? window.location.hash : ''
|
|
225
|
-
const queryString =
|
|
192
|
+
const queryString = Object.assign({}, this.queryString, options)
|
|
226
193
|
return `${this.baseUrl}?${Utils.buildQueryString(queryString)}${currentView}`
|
|
227
194
|
}
|
|
228
195
|
|
|
229
196
|
build() {
|
|
230
197
|
const iframeUrl = this.buildUrl()
|
|
231
|
-
let code = `<iframe
|
|
198
|
+
let code = `<iframe style="width: ${this.dimensions.width}; height: ${this.dimensions.height}; border: 0;" allowfullscreen allow="geolocation" src="${iframeUrl}"></iframe>`
|
|
232
199
|
if (this.options.includeFullScreenLink) {
|
|
233
200
|
const fullUrl = this.buildUrl({ scrollWheelZoom: true })
|
|
234
201
|
code += `<p><a href="${fullUrl}">${translate('See full screen')}</a></p>`
|
|
@@ -89,8 +89,8 @@ export default class Slideshow extends WithTemplate {
|
|
|
89
89
|
play() {
|
|
90
90
|
if (this._id) return
|
|
91
91
|
if (this._umap.editEnabled || !this.isEnabled()) return
|
|
92
|
-
|
|
93
|
-
this._id = window.setInterval(
|
|
92
|
+
document.body.classList.add(this.CLASSNAME)
|
|
93
|
+
this._id = window.setInterval(() => this.loop(), this.properties.delay)
|
|
94
94
|
this.startSpinner()
|
|
95
95
|
this.loop()
|
|
96
96
|
}
|
|
@@ -103,7 +103,7 @@ export default class Slideshow extends WithTemplate {
|
|
|
103
103
|
pause() {
|
|
104
104
|
if (this._id) {
|
|
105
105
|
this.stopSpinner()
|
|
106
|
-
|
|
106
|
+
document.body.classList.remove(this.CLASSNAME)
|
|
107
107
|
window.clearInterval(this._id)
|
|
108
108
|
this._id = null
|
|
109
109
|
}
|
|
@@ -236,12 +236,18 @@ export class BottomBar extends WithTemplate {
|
|
|
236
236
|
this.elements.layers.addEventListener('change', () => {
|
|
237
237
|
const select = this.elements.layers
|
|
238
238
|
const selected = select.options[select.selectedIndex].value
|
|
239
|
-
|
|
240
|
-
this._umap.datalayers.active().map((datalayer) => {
|
|
239
|
+
for (const datalayer of this._umap.datalayers.active()) {
|
|
241
240
|
if (datalayer.properties.inCaption !== false) {
|
|
242
|
-
|
|
241
|
+
if (!selected) {
|
|
242
|
+
datalayer.autoVisibility = true
|
|
243
|
+
if (datalayer.showAtZoom() && !datalayer.isVisible()) {
|
|
244
|
+
datalayer.show()
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
datalayer.toggle(datalayer.id === selected)
|
|
248
|
+
}
|
|
243
249
|
}
|
|
244
|
-
}
|
|
250
|
+
}
|
|
245
251
|
})
|
|
246
252
|
}
|
|
247
253
|
|
|
@@ -263,7 +269,9 @@ export class BottomBar extends WithTemplate {
|
|
|
263
269
|
if (datalayers.length < 2) {
|
|
264
270
|
this.elements.layers.hidden = true
|
|
265
271
|
} else {
|
|
266
|
-
this.elements.layers.appendChild(
|
|
272
|
+
this.elements.layers.appendChild(
|
|
273
|
+
Utils.loadTemplate(`<option value="">${translate('All layers')}</option>`)
|
|
274
|
+
)
|
|
267
275
|
this.elements.layers.hidden = !this._umap.getProperty('layerSwitcher')
|
|
268
276
|
const visible = datalayers.filter((datalayer) => datalayer.isVisible())
|
|
269
277
|
for (const datalayer of datalayers) {
|
|
@@ -279,27 +287,30 @@ export class BottomBar extends WithTemplate {
|
|
|
279
287
|
}
|
|
280
288
|
|
|
281
289
|
const EDIT_BAR_TEMPLATE = `
|
|
282
|
-
<
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
290
|
+
<div class="umap-edit-bar dark with-transition">
|
|
291
|
+
<ul>
|
|
292
|
+
<li data-ref="marker"><button class="drawing-tool" type="button" data-getstarted><i class="icon icon-24 icon-marker"></i></button></li>
|
|
293
|
+
<li data-ref="polyline"><button class="drawing-tool" type="button" data-getstarted><i class="icon icon-24 icon-polyline"></i></button></li>
|
|
294
|
+
<li data-ref="multiline" hidden>
|
|
295
|
+
<button class="drawing-tool" type="button" title="${translate('Add a line to the current multi')}"><i class="icon icon-24 icon-multiline"></i></button>
|
|
296
|
+
</li>
|
|
297
|
+
<li data-ref="polygon"><button class="drawing-tool" type="button" data-getstarted><i class="icon icon-24 icon-polygon"></i></button></li>
|
|
298
|
+
<li data-ref="multipolygon" hidden>
|
|
299
|
+
<button class="drawing-tool" type="button" title="${translate('Add a polygon to the current multi')}"><i class="icon icon-24 icon-multipolygon"></i></button>
|
|
300
|
+
</li>
|
|
301
|
+
<li data-ref="route" hidden><button class="drawing-tool" type="button" data-getstarted title="${translate('Draw along routes')}"><i class="icon icon-24 icon-route"></i></button></li>
|
|
302
|
+
</ul>
|
|
303
|
+
<ul>
|
|
304
|
+
<li data-ref="caption" hidden><button data-getstarted type="button" title="${translate('Edit map name and caption')}"><i class="icon icon-24 icon-info"></i></button></li>
|
|
305
|
+
<li data-ref="import" hidden><button type="button"><i class="icon icon-24 icon-upload"></i></button></li>
|
|
306
|
+
<li data-ref="templates" hidden><button type="button" title="${translate('Load template')}" data-getstarted><i class="icon icon-24 icon-template"></i></button></li>
|
|
307
|
+
<li data-ref="layers" hidden><button type="button" title="${translate('Manage layers')}"><i class="icon icon-24 icon-layers"></i></button></li>
|
|
308
|
+
<li data-ref="tilelayers" hidden><button type="button" title="${translate('Change tilelayers')}"><i class="icon icon-24 icon-tilelayer"></i></button></li>
|
|
309
|
+
<li data-ref="center" hidden><button type="button"><i class="icon icon-24 icon-center"></i></button></li>
|
|
310
|
+
<li data-ref="permissions" hidden><button type="button" title="${translate('Update permissions and editors')}"><i class="icon icon-24 icon-key"></i></button></li>
|
|
311
|
+
<li data-ref="settings" hidden><button data-getstarted type="button" title="${translate('Map advanced properties')}"><i class="icon icon-24 icon-settings"></i></button></li>
|
|
312
|
+
</ul>
|
|
313
|
+
</div>
|
|
303
314
|
`
|
|
304
315
|
|
|
305
316
|
export class EditBar extends WithTemplate {
|
|
@@ -315,12 +326,12 @@ export class EditBar extends WithTemplate {
|
|
|
315
326
|
setup() {
|
|
316
327
|
this.parent.appendChild(this.element)
|
|
317
328
|
DomEvent.disableClickPropagation(this.element)
|
|
318
|
-
this.
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
329
|
+
this._onDrawing('marker', () => this._leafletMap.editTools.startMarker())
|
|
330
|
+
this._onDrawing('polyline', () => this._leafletMap.editTools.startPolyline())
|
|
331
|
+
this._onDrawing('multiline', () => this._umap.editedFeature.ui.editor.newShape())
|
|
332
|
+
this._onDrawing('polygon', () => this._leafletMap.editTools.startPolygon())
|
|
333
|
+
this._onDrawing('multipolygon', () => this._umap.editedFeature.ui.editor.newShape())
|
|
334
|
+
this._onDrawing('route', () => this._leafletMap.editTools.startRoute())
|
|
324
335
|
this._onClick('caption', () => this._umap.editCaption())
|
|
325
336
|
this._onClick('import', () => this._umap.importer.open())
|
|
326
337
|
this._onClick('templates', () => this.templateIimporter.open())
|
|
@@ -359,6 +370,14 @@ export class EditBar extends WithTemplate {
|
|
|
359
370
|
)
|
|
360
371
|
}
|
|
361
372
|
|
|
373
|
+
_onDrawing(ref, realAction) {
|
|
374
|
+
const action = (event) => {
|
|
375
|
+
event.target.closest('button').classList.add('on')
|
|
376
|
+
realAction(event)
|
|
377
|
+
}
|
|
378
|
+
this._onClick(ref, action)
|
|
379
|
+
}
|
|
380
|
+
|
|
362
381
|
_onClick(ref, action) {
|
|
363
382
|
// Put the click on the button, not on the li, but keep the data-ref on the li
|
|
364
383
|
// so to hide/show it when needed.
|