umap-project 2.7.3__py3-none-any.whl → 2.8.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.
- umap/__init__.py +1 -1
- umap/forms.py +4 -14
- umap/locale/am_ET/LC_MESSAGES/django.mo +0 -0
- umap/locale/am_ET/LC_MESSAGES/django.po +278 -151
- umap/locale/ar/LC_MESSAGES/django.mo +0 -0
- umap/locale/ar/LC_MESSAGES/django.po +335 -141
- umap/locale/bg/LC_MESSAGES/django.mo +0 -0
- umap/locale/bg/LC_MESSAGES/django.po +279 -152
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +95 -79
- umap/locale/ca/LC_MESSAGES/django.mo +0 -0
- umap/locale/ca/LC_MESSAGES/django.po +85 -68
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +78 -66
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +280 -153
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +80 -64
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +82 -66
- umap/locale/en/LC_MESSAGES/django.po +73 -61
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +75 -63
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +280 -153
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +82 -66
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +80 -64
- umap/locale/fi/LC_MESSAGES/django.mo +0 -0
- umap/locale/fi/LC_MESSAGES/django.po +278 -151
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +75 -63
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +280 -153
- umap/locale/he/LC_MESSAGES/django.mo +0 -0
- umap/locale/he/LC_MESSAGES/django.po +281 -154
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +80 -64
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +280 -153
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +82 -66
- umap/locale/ja/LC_MESSAGES/django.mo +0 -0
- umap/locale/ja/LC_MESSAGES/django.po +280 -153
- umap/locale/ko/LC_MESSAGES/django.mo +0 -0
- umap/locale/ko/LC_MESSAGES/django.po +280 -153
- umap/locale/lt/LC_MESSAGES/django.mo +0 -0
- umap/locale/lt/LC_MESSAGES/django.po +280 -153
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +82 -66
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +280 -153
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +82 -66
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +75 -63
- umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_BR/LC_MESSAGES/django.po +280 -153
- umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_PT/LC_MESSAGES/django.po +280 -153
- umap/locale/ru/LC_MESSAGES/django.mo +0 -0
- umap/locale/ru/LC_MESSAGES/django.po +280 -153
- umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
- umap/locale/sk_SK/LC_MESSAGES/django.po +280 -153
- umap/locale/sl/LC_MESSAGES/django.mo +0 -0
- umap/locale/sl/LC_MESSAGES/django.po +280 -153
- umap/locale/sr/LC_MESSAGES/django.mo +0 -0
- umap/locale/sr/LC_MESSAGES/django.po +280 -153
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +81 -65
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +257 -185
- umap/locale/tr/LC_MESSAGES/django.mo +0 -0
- umap/locale/tr/LC_MESSAGES/django.po +280 -153
- umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
- umap/locale/uk_UA/LC_MESSAGES/django.po +280 -153
- umap/locale/vi/LC_MESSAGES/django.mo +0 -0
- umap/locale/vi/LC_MESSAGES/django.po +278 -151
- umap/locale/zh/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh/LC_MESSAGES/django.po +278 -151
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +97 -81
- umap/management/commands/empty_trash.py +35 -0
- umap/management/commands/migrate_to_S3.py +29 -0
- umap/migrations/0023_alter_datalayer_uuid.py +19 -0
- umap/migrations/0024_alter_map_share_status.py +30 -0
- umap/migrations/0025_alter_datalayer_geojson.py +24 -0
- umap/models.py +68 -116
- umap/settings/base.py +23 -3
- umap/settings/local_s3.py +45 -0
- umap/static/umap/base.css +3 -603
- umap/static/umap/content.css +5 -3
- umap/static/umap/css/bar.css +202 -0
- umap/static/umap/css/form.css +620 -0
- umap/static/umap/css/icon.css +21 -1
- umap/static/umap/css/popup.css +125 -0
- umap/static/umap/img/16-white.svg +16 -4
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/source/16-white.svg +46 -45
- umap/static/umap/img/source/16.svg +1 -753
- umap/static/umap/js/components/fragment.js +3 -1
- umap/static/umap/js/modules/browser.js +20 -19
- umap/static/umap/js/modules/caption.js +21 -22
- umap/static/umap/js/modules/data/features.js +120 -78
- umap/static/umap/js/modules/data/layer.js +195 -153
- umap/static/umap/js/modules/facets.js +9 -9
- umap/static/umap/js/modules/formatter.js +5 -5
- umap/static/umap/js/modules/global.js +4 -52
- umap/static/umap/js/modules/help.js +18 -21
- umap/static/umap/js/modules/importer.js +133 -56
- umap/static/umap/js/modules/importers/cadastrefr.js +4 -0
- umap/static/umap/js/modules/importers/geodatamine.js +3 -3
- umap/static/umap/js/modules/importers/overpass.js +5 -0
- umap/static/umap/js/modules/permissions.js +85 -87
- umap/static/umap/js/modules/rendering/icon.js +2 -1
- umap/static/umap/js/modules/rendering/layers/base.js +15 -15
- umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
- umap/static/umap/js/modules/rendering/layers/cluster.js +1 -1
- umap/static/umap/js/modules/rendering/layers/heat.js +1 -1
- umap/static/umap/js/modules/rendering/map.js +390 -0
- umap/static/umap/js/modules/rendering/popup.js +19 -19
- umap/static/umap/js/modules/rendering/template.js +88 -21
- umap/static/umap/js/modules/rendering/ui.js +63 -14
- umap/static/umap/js/modules/request.js +2 -2
- umap/static/umap/js/modules/rules.js +22 -25
- umap/static/umap/js/modules/saving.js +47 -0
- umap/static/umap/js/modules/schema.js +6 -0
- umap/static/umap/js/modules/share.js +21 -24
- umap/static/umap/js/modules/slideshow.js +24 -20
- umap/static/umap/js/modules/sync/updaters.js +7 -9
- umap/static/umap/js/modules/tableeditor.js +20 -19
- umap/static/umap/js/modules/ui/bar.js +196 -0
- umap/static/umap/js/modules/ui/dialog.js +5 -0
- umap/static/umap/js/modules/ui/panel.js +10 -9
- umap/static/umap/js/modules/umap.js +1691 -0
- umap/static/umap/js/modules/urls.js +2 -2
- umap/static/umap/js/modules/utils.js +22 -6
- umap/static/umap/js/umap.controls.js +81 -305
- umap/static/umap/js/umap.core.js +29 -50
- umap/static/umap/js/umap.forms.js +78 -27
- umap/static/umap/keycloak.png +0 -0
- umap/static/umap/locale/am_ET.js +26 -10
- umap/static/umap/locale/am_ET.json +26 -10
- umap/static/umap/locale/ar.js +26 -10
- umap/static/umap/locale/ar.json +26 -10
- umap/static/umap/locale/ast.js +26 -10
- umap/static/umap/locale/ast.json +26 -10
- umap/static/umap/locale/bg.js +26 -10
- umap/static/umap/locale/bg.json +26 -10
- umap/static/umap/locale/br.js +27 -20
- umap/static/umap/locale/br.json +27 -20
- umap/static/umap/locale/ca.js +32 -29
- umap/static/umap/locale/ca.json +32 -29
- umap/static/umap/locale/cs_CZ.js +24 -17
- umap/static/umap/locale/cs_CZ.json +24 -17
- umap/static/umap/locale/da.js +26 -10
- umap/static/umap/locale/da.json +26 -10
- umap/static/umap/locale/de.js +21 -14
- umap/static/umap/locale/de.json +21 -14
- umap/static/umap/locale/el.js +28 -12
- umap/static/umap/locale/el.json +28 -12
- umap/static/umap/locale/en.js +14 -9
- umap/static/umap/locale/en.json +14 -9
- umap/static/umap/locale/en_US.json +26 -10
- umap/static/umap/locale/es.js +16 -13
- umap/static/umap/locale/es.json +16 -13
- umap/static/umap/locale/et.js +26 -10
- umap/static/umap/locale/et.json +26 -10
- umap/static/umap/locale/eu.js +16 -9
- umap/static/umap/locale/eu.json +16 -9
- umap/static/umap/locale/fa_IR.js +16 -9
- umap/static/umap/locale/fa_IR.json +16 -9
- umap/static/umap/locale/fi.js +26 -10
- umap/static/umap/locale/fi.json +26 -10
- umap/static/umap/locale/fr.js +14 -9
- umap/static/umap/locale/fr.json +14 -9
- umap/static/umap/locale/gl.js +26 -10
- umap/static/umap/locale/gl.json +26 -10
- umap/static/umap/locale/he.js +26 -10
- umap/static/umap/locale/he.json +26 -10
- umap/static/umap/locale/hr.js +26 -10
- umap/static/umap/locale/hr.json +26 -10
- umap/static/umap/locale/hu.js +16 -9
- umap/static/umap/locale/hu.json +16 -9
- umap/static/umap/locale/id.js +26 -10
- umap/static/umap/locale/id.json +26 -10
- umap/static/umap/locale/is.js +26 -10
- umap/static/umap/locale/is.json +26 -10
- umap/static/umap/locale/it.js +26 -10
- umap/static/umap/locale/it.json +26 -10
- umap/static/umap/locale/ja.js +26 -10
- umap/static/umap/locale/ja.json +26 -10
- umap/static/umap/locale/ko.js +26 -10
- umap/static/umap/locale/ko.json +26 -10
- umap/static/umap/locale/lt.js +26 -10
- umap/static/umap/locale/lt.json +26 -10
- umap/static/umap/locale/ms.js +28 -12
- umap/static/umap/locale/ms.json +28 -12
- umap/static/umap/locale/nl.js +28 -12
- umap/static/umap/locale/nl.json +28 -12
- umap/static/umap/locale/no.js +26 -10
- umap/static/umap/locale/no.json +26 -10
- umap/static/umap/locale/pl.js +28 -12
- umap/static/umap/locale/pl.json +28 -12
- umap/static/umap/locale/pl_PL.json +26 -10
- umap/static/umap/locale/pt.js +16 -9
- umap/static/umap/locale/pt.json +16 -9
- umap/static/umap/locale/pt_BR.js +26 -10
- umap/static/umap/locale/pt_BR.json +26 -10
- umap/static/umap/locale/pt_PT.js +16 -9
- umap/static/umap/locale/pt_PT.json +16 -9
- umap/static/umap/locale/ro.js +26 -10
- umap/static/umap/locale/ro.json +26 -10
- umap/static/umap/locale/ru.js +26 -10
- umap/static/umap/locale/ru.json +26 -10
- umap/static/umap/locale/si.js +7 -7
- umap/static/umap/locale/si.json +7 -7
- umap/static/umap/locale/sk_SK.js +26 -10
- umap/static/umap/locale/sk_SK.json +26 -10
- umap/static/umap/locale/sl.js +26 -10
- umap/static/umap/locale/sl.json +26 -10
- umap/static/umap/locale/sr.js +26 -10
- umap/static/umap/locale/sr.json +26 -10
- umap/static/umap/locale/sv.js +27 -11
- umap/static/umap/locale/sv.json +27 -11
- umap/static/umap/locale/th_TH.js +28 -12
- umap/static/umap/locale/th_TH.json +28 -12
- umap/static/umap/locale/tr.js +26 -10
- umap/static/umap/locale/tr.json +26 -10
- umap/static/umap/locale/uk_UA.js +26 -10
- umap/static/umap/locale/uk_UA.json +26 -10
- umap/static/umap/locale/vi.js +26 -10
- umap/static/umap/locale/vi.json +26 -10
- umap/static/umap/locale/vi_VN.json +26 -10
- umap/static/umap/locale/zh.js +26 -10
- umap/static/umap/locale/zh.json +26 -10
- umap/static/umap/locale/zh_CN.json +26 -10
- umap/static/umap/locale/zh_TW.Big5.json +26 -10
- umap/static/umap/locale/zh_TW.js +34 -27
- umap/static/umap/locale/zh_TW.json +34 -27
- umap/static/umap/map.css +39 -530
- umap/static/umap/unittests/URLs.js +15 -15
- umap/static/umap/unittests/utils.js +23 -1
- umap/static/umap/vars.css +2 -1
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
- umap/storage/__init__.py +3 -0
- umap/storage/fs.py +101 -0
- umap/storage/s3.py +61 -0
- umap/templates/base.html +2 -0
- umap/templates/registration/login.html +7 -6
- umap/templates/umap/components/alerts/alert.html +4 -0
- umap/templates/umap/css.html +6 -0
- umap/templates/umap/js.html +3 -2
- umap/templates/umap/map_init.html +6 -5
- umap/templates/umap/user_dashboard.html +20 -19
- umap/tests/base.py +5 -1
- umap/tests/fixtures/test_upload_simple_marker.json +19 -0
- umap/tests/integration/conftest.py +2 -1
- umap/tests/integration/test_anonymous_owned_map.py +18 -10
- umap/tests/integration/test_browser.py +16 -1
- umap/tests/integration/test_dashboard.py +1 -1
- umap/tests/integration/test_edit_datalayer.py +29 -7
- umap/tests/integration/test_import.py +28 -6
- umap/tests/integration/test_optimistic_merge.py +31 -8
- umap/tests/integration/test_owned_map.py +22 -16
- umap/tests/integration/test_popup.py +44 -0
- umap/tests/integration/test_save.py +35 -0
- umap/tests/integration/test_view_marker.py +12 -0
- umap/tests/integration/test_view_polyline.py +257 -0
- umap/tests/integration/test_websocket_sync.py +81 -9
- umap/tests/test_dashboard.py +82 -0
- umap/tests/test_datalayer.py +6 -7
- umap/tests/test_datalayer_s3.py +135 -0
- umap/tests/test_datalayer_views.py +28 -10
- umap/tests/test_empty_trash.py +34 -0
- umap/tests/test_map.py +12 -3
- umap/tests/test_map_views.py +69 -37
- umap/tests/test_statics.py +1 -1
- umap/tests/test_team_views.py +35 -1
- umap/tests/test_views.py +31 -52
- umap/urls.py +3 -3
- umap/views.py +126 -90
- {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/METADATA +16 -13
- {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/RECORD +289 -269
- umap/management/commands/purge_purgatory.py +0 -28
- umap/static/umap/js/umap.js +0 -1903
- umap/tests/test_purge_purgatory.py +0 -25
- /umap/{storage.py → storage/staticfiles.py} +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/WHEEL +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,9 +6,10 @@ import { EXPORT_FORMATS } from './formatter.js'
|
|
|
6
6
|
import ContextMenu from './ui/contextmenu.js'
|
|
7
7
|
|
|
8
8
|
export default class Browser {
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
9
|
+
constructor(umap, leafletMap) {
|
|
10
|
+
this._umap = umap
|
|
11
|
+
this._leafletMap = leafletMap
|
|
12
|
+
this._leafletMap.on('moveend', this.onMoveEnd, this)
|
|
12
13
|
this.options = {
|
|
13
14
|
filter: '',
|
|
14
15
|
inBbox: false,
|
|
@@ -82,7 +83,7 @@ export default class Browser {
|
|
|
82
83
|
|
|
83
84
|
updateDatalayer(datalayer) {
|
|
84
85
|
// Compute once, but use it for each feature later.
|
|
85
|
-
this.bounds = this.
|
|
86
|
+
this.bounds = this._leafletMap.getBounds()
|
|
86
87
|
const parent = DomUtil.get(this.datalayerId(datalayer))
|
|
87
88
|
// Panel is not open
|
|
88
89
|
if (!parent) return
|
|
@@ -115,10 +116,10 @@ export default class Browser {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
onFormChange() {
|
|
118
|
-
this.
|
|
119
|
+
this._umap.eachBrowsableDataLayer((datalayer) => {
|
|
119
120
|
datalayer.resetLayer(true)
|
|
120
121
|
this.updateDatalayer(datalayer)
|
|
121
|
-
if (this.
|
|
122
|
+
if (this._umap.fullPanel?.isOpen()) datalayer.tableEdit()
|
|
122
123
|
})
|
|
123
124
|
this.toggleBadge()
|
|
124
125
|
}
|
|
@@ -132,13 +133,13 @@ export default class Browser {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
hasFilters() {
|
|
135
|
-
return !!this.options.filter || this.
|
|
136
|
+
return !!this.options.filter || this._umap.facets.isActive()
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
onMoveEnd() {
|
|
139
140
|
if (!this.isOpen()) return
|
|
140
141
|
const isListDynamic = this.options.inBbox
|
|
141
|
-
this.
|
|
142
|
+
this._umap.eachBrowsableDataLayer((datalayer) => {
|
|
142
143
|
if (!isListDynamic && !datalayer.hasDynamicData()) return
|
|
143
144
|
this.updateDatalayer(datalayer)
|
|
144
145
|
})
|
|
@@ -147,7 +148,7 @@ export default class Browser {
|
|
|
147
148
|
update() {
|
|
148
149
|
if (!this.isOpen()) return
|
|
149
150
|
this.dataContainer.innerHTML = ''
|
|
150
|
-
this.
|
|
151
|
+
this._umap.eachBrowsableDataLayer((datalayer) => {
|
|
151
152
|
this.addDataLayer(datalayer, this.dataContainer)
|
|
152
153
|
})
|
|
153
154
|
}
|
|
@@ -186,9 +187,9 @@ export default class Browser {
|
|
|
186
187
|
DomEvent.on(builder.form, 'reset', () => {
|
|
187
188
|
window.setTimeout(builder.syncAll.bind(builder))
|
|
188
189
|
})
|
|
189
|
-
if (this.
|
|
190
|
-
fields = this.
|
|
191
|
-
filtersBuilder = new L.FormBuilder(this.
|
|
190
|
+
if (this._umap.properties.facetKey) {
|
|
191
|
+
fields = this._umap.facets.build()
|
|
192
|
+
filtersBuilder = new L.FormBuilder(this._umap.facets, fields, {
|
|
192
193
|
callback: () => this.onFormChange(),
|
|
193
194
|
})
|
|
194
195
|
DomEvent.on(filtersBuilder.form, 'reset', () => {
|
|
@@ -206,7 +207,7 @@ export default class Browser {
|
|
|
206
207
|
textContent: translate('Reset all'),
|
|
207
208
|
})
|
|
208
209
|
|
|
209
|
-
this.
|
|
210
|
+
this._umap.panel.open({
|
|
210
211
|
content: container,
|
|
211
212
|
className: 'umap-browser',
|
|
212
213
|
})
|
|
@@ -230,7 +231,7 @@ export default class Browser {
|
|
|
230
231
|
`)
|
|
231
232
|
container.appendChild(toolbox)
|
|
232
233
|
toggle.addEventListener('click', () => this.toggleLayers())
|
|
233
|
-
fitBounds.addEventListener('click', () => this.
|
|
234
|
+
fitBounds.addEventListener('click', () => this._umap.fitDataBounds())
|
|
234
235
|
download.addEventListener('click', () => this.downloadVisible(download))
|
|
235
236
|
}
|
|
236
237
|
|
|
@@ -240,7 +241,7 @@ export default class Browser {
|
|
|
240
241
|
for (const format of Object.keys(EXPORT_FORMATS)) {
|
|
241
242
|
items.push({
|
|
242
243
|
label: format,
|
|
243
|
-
action: () => this.
|
|
244
|
+
action: () => this._umap.share.download(format),
|
|
244
245
|
})
|
|
245
246
|
}
|
|
246
247
|
menu.openBelow(element, items)
|
|
@@ -250,10 +251,10 @@ export default class Browser {
|
|
|
250
251
|
// If at least one layer is shown, hide it
|
|
251
252
|
// otherwise show all
|
|
252
253
|
let allHidden = true
|
|
253
|
-
this.
|
|
254
|
+
this._umap.eachBrowsableDataLayer((datalayer) => {
|
|
254
255
|
if (datalayer.isVisible()) allHidden = false
|
|
255
256
|
})
|
|
256
|
-
this.
|
|
257
|
+
this._umap.eachBrowsableDataLayer((datalayer) => {
|
|
257
258
|
if (allHidden) {
|
|
258
259
|
datalayer.show()
|
|
259
260
|
} else {
|
|
@@ -262,7 +263,7 @@ export default class Browser {
|
|
|
262
263
|
})
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
static backButton(
|
|
266
|
+
static backButton(umap) {
|
|
266
267
|
const button = DomUtil.createButtonIcon(
|
|
267
268
|
DomUtil.create('li', '', undefined),
|
|
268
269
|
'icon-back',
|
|
@@ -271,7 +272,7 @@ export default class Browser {
|
|
|
271
272
|
// Fixme: remove me when this is merged and released
|
|
272
273
|
// https://github.com/Leaflet/Leaflet/pull/9052
|
|
273
274
|
DomEvent.disableClickPropagation(button)
|
|
274
|
-
DomEvent.on(button, 'click',
|
|
275
|
+
DomEvent.on(button, 'click', () => umap.openBrowser())
|
|
275
276
|
return button
|
|
276
277
|
}
|
|
277
278
|
}
|
|
@@ -3,8 +3,9 @@ import { translate } from './i18n.js'
|
|
|
3
3
|
import * as Utils from './utils.js'
|
|
4
4
|
|
|
5
5
|
export default class Caption {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(umap, leafletMap) {
|
|
7
|
+
this._umap = umap
|
|
8
|
+
this._leafletMap = leafletMap
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
isOpen() {
|
|
@@ -21,38 +22,36 @@ export default class Caption {
|
|
|
21
22
|
const hgroup = DomUtil.element({ tagName: 'hgroup', parent: container })
|
|
22
23
|
DomUtil.createTitle(
|
|
23
24
|
hgroup,
|
|
24
|
-
this.
|
|
25
|
+
this._umap.getDisplayName(),
|
|
25
26
|
'icon-caption icon-block',
|
|
26
27
|
'map-name'
|
|
27
28
|
)
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const title = Utils.loadTemplate('<h4></h4>')
|
|
30
|
+
hgroup.appendChild(title)
|
|
31
|
+
this._umap.addAuthorLink(title)
|
|
32
|
+
if (this._umap.properties.description) {
|
|
30
33
|
const description = DomUtil.element({
|
|
31
34
|
tagName: 'div',
|
|
32
35
|
className: 'umap-map-description text',
|
|
33
|
-
safeHTML: Utils.toHTML(this.
|
|
36
|
+
safeHTML: Utils.toHTML(this._umap.properties.description),
|
|
34
37
|
parent: container,
|
|
35
38
|
})
|
|
36
39
|
}
|
|
37
40
|
const datalayerContainer = DomUtil.create('div', 'datalayer-container', container)
|
|
38
|
-
this.
|
|
41
|
+
this._umap.eachDataLayerReverse((datalayer) =>
|
|
39
42
|
this.addDataLayer(datalayer, datalayerContainer)
|
|
40
43
|
)
|
|
41
44
|
const creditsContainer = DomUtil.create('div', 'credits-container', container)
|
|
42
45
|
this.addCredits(creditsContainer)
|
|
43
|
-
this.
|
|
46
|
+
this._umap.panel.open({ content: container }).then(() => {
|
|
44
47
|
// Create the legend when the panel is actually on the DOM
|
|
45
|
-
this.
|
|
48
|
+
this._umap.eachDataLayerReverse((datalayer) => datalayer.renderLegend())
|
|
46
49
|
})
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
addDataLayer(datalayer, container) {
|
|
50
53
|
if (!datalayer.options.inCaption) return
|
|
51
|
-
const p = DomUtil.create(
|
|
52
|
-
'p',
|
|
53
|
-
`caption-item ${datalayer.cssId}`,
|
|
54
|
-
container
|
|
55
|
-
)
|
|
54
|
+
const p = DomUtil.create('p', `caption-item ${datalayer.cssId}`, container)
|
|
56
55
|
const legend = DomUtil.create('span', 'datalayer-legend', p)
|
|
57
56
|
const headline = DomUtil.create('strong', '', p)
|
|
58
57
|
if (datalayer.options.description) {
|
|
@@ -69,16 +68,16 @@ export default class Caption {
|
|
|
69
68
|
addCredits(container) {
|
|
70
69
|
const credits = DomUtil.createFieldset(container, translate('Credits'))
|
|
71
70
|
let title = DomUtil.add('h5', '', credits, translate('User content credits'))
|
|
72
|
-
if (this.
|
|
71
|
+
if (this._umap.properties.shortCredit || this._umap.properties.longCredit) {
|
|
73
72
|
DomUtil.element({
|
|
74
73
|
tagName: 'p',
|
|
75
74
|
parent: credits,
|
|
76
75
|
safeHTML: Utils.toHTML(
|
|
77
|
-
this.
|
|
76
|
+
this._umap.properties.longCredit || this._umap.properties.shortCredit
|
|
78
77
|
),
|
|
79
78
|
})
|
|
80
79
|
}
|
|
81
|
-
if (this.
|
|
80
|
+
if (this._umap.properties.licence) {
|
|
82
81
|
const licence = DomUtil.add(
|
|
83
82
|
'p',
|
|
84
83
|
'',
|
|
@@ -88,8 +87,8 @@ export default class Caption {
|
|
|
88
87
|
DomUtil.createLink(
|
|
89
88
|
'',
|
|
90
89
|
licence,
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
90
|
+
this._umap.properties.licence.name,
|
|
91
|
+
this._umap.properties.licence.url
|
|
93
92
|
)
|
|
94
93
|
} else {
|
|
95
94
|
DomUtil.add('p', '', credits, translate('No licence has been set'))
|
|
@@ -100,19 +99,19 @@ export default class Caption {
|
|
|
100
99
|
DomUtil.element({
|
|
101
100
|
tagName: 'strong',
|
|
102
101
|
parent: tilelayerCredit,
|
|
103
|
-
textContent: `${this.
|
|
102
|
+
textContent: `${this._leafletMap.selectedTilelayer.options.name} `,
|
|
104
103
|
})
|
|
105
104
|
DomUtil.element({
|
|
106
105
|
tagName: 'span',
|
|
107
106
|
parent: tilelayerCredit,
|
|
108
|
-
safeHTML: this.
|
|
107
|
+
safeHTML: this._leafletMap.selectedTilelayer.getAttribution(),
|
|
109
108
|
})
|
|
110
109
|
const urls = {
|
|
111
110
|
leaflet: 'http://leafletjs.com',
|
|
112
111
|
django: 'https://www.djangoproject.com',
|
|
113
112
|
umap: 'https://umap-project.org/',
|
|
114
113
|
changelog: 'https://docs.umap-project.org/en/master/changelog/',
|
|
115
|
-
version: this.
|
|
114
|
+
version: this._umap.properties.umap_version,
|
|
116
115
|
}
|
|
117
116
|
const creditHTML = translate(
|
|
118
117
|
`
|