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
|
@@ -14,10 +14,11 @@ const TEMPLATE = `
|
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
export default class TableEditor extends WithTemplate {
|
|
17
|
-
constructor(datalayer) {
|
|
17
|
+
constructor(umap, datalayer, leafletMap) {
|
|
18
18
|
super()
|
|
19
19
|
this.datalayer = datalayer
|
|
20
|
-
this.
|
|
20
|
+
this._umap = umap
|
|
21
|
+
this._leafletMap = leafletMap
|
|
21
22
|
this.contextmenu = new ContextMenu({ className: 'dark' })
|
|
22
23
|
this.table = this.loadTemplate(TEMPLATE)
|
|
23
24
|
if (!this.datalayer.isRemoteLayer()) {
|
|
@@ -36,20 +37,20 @@ export default class TableEditor extends WithTemplate {
|
|
|
36
37
|
openHeaderMenu(property) {
|
|
37
38
|
const actions = []
|
|
38
39
|
let filterItem
|
|
39
|
-
if (this.
|
|
40
|
+
if (this._umap.facets.has(property)) {
|
|
40
41
|
filterItem = {
|
|
41
42
|
label: translate('Remove filter for this column'),
|
|
42
43
|
action: () => {
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
44
|
+
this._umap.facets.remove(property)
|
|
45
|
+
this._umap.browser.open('filters')
|
|
45
46
|
},
|
|
46
47
|
}
|
|
47
48
|
} else {
|
|
48
49
|
filterItem = {
|
|
49
50
|
label: translate('Add filter for this column'),
|
|
50
51
|
action: () => {
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
52
|
+
this._umap.facets.add(property)
|
|
53
|
+
this._umap.browser.open('filters')
|
|
53
54
|
},
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -86,8 +87,8 @@ export default class TableEditor extends WithTemplate {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
renderBody() {
|
|
89
|
-
const bounds = this.
|
|
90
|
-
const inBbox = this.
|
|
90
|
+
const bounds = this._leafletMap.getBounds()
|
|
91
|
+
const inBbox = this._umap.browser.options.inBbox
|
|
91
92
|
let html = ''
|
|
92
93
|
this.datalayer.eachFeature((feature) => {
|
|
93
94
|
if (feature.isFiltered()) return
|
|
@@ -104,7 +105,7 @@ export default class TableEditor extends WithTemplate {
|
|
|
104
105
|
resetProperties() {
|
|
105
106
|
this.properties = this.datalayer._propertiesIndex
|
|
106
107
|
if (this.properties.length === 0) {
|
|
107
|
-
this.properties = [
|
|
108
|
+
this.properties = [U.DEFAULT_LABEL_KEY, 'description']
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -121,7 +122,7 @@ export default class TableEditor extends WithTemplate {
|
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
renameProperty(property) {
|
|
124
|
-
this.
|
|
125
|
+
this._umap.dialog
|
|
125
126
|
.prompt(translate('Please enter the new name of this property'))
|
|
126
127
|
.then(({ prompt }) => {
|
|
127
128
|
if (!prompt || !this.validateName(prompt)) return
|
|
@@ -135,7 +136,7 @@ export default class TableEditor extends WithTemplate {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
deleteProperty(property) {
|
|
138
|
-
this.
|
|
139
|
+
this._umap.dialog
|
|
139
140
|
.confirm(
|
|
140
141
|
translate('Are you sure you want to delete this property on all the features?')
|
|
141
142
|
)
|
|
@@ -150,7 +151,7 @@ export default class TableEditor extends WithTemplate {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
addProperty() {
|
|
153
|
-
this.
|
|
154
|
+
this._umap.dialog
|
|
154
155
|
.prompt(translate('Please enter the name of the property'))
|
|
155
156
|
.then(({ prompt }) => {
|
|
156
157
|
if (!prompt || !this.validateName(prompt)) return
|
|
@@ -187,10 +188,10 @@ export default class TableEditor extends WithTemplate {
|
|
|
187
188
|
<button class="flat" type="button" data-ref="filters">
|
|
188
189
|
<i class="icon icon-16 icon-filters"></i>${translate('Filter data')}
|
|
189
190
|
</button>`)
|
|
190
|
-
filterButton.addEventListener('click', () => this.
|
|
191
|
+
filterButton.addEventListener('click', () => this._umap.browser.open('filters'))
|
|
191
192
|
actions.push(filterButton)
|
|
192
193
|
|
|
193
|
-
this.
|
|
194
|
+
this._umap.fullPanel.open({
|
|
194
195
|
content: this.table,
|
|
195
196
|
className: 'umap-table-editor',
|
|
196
197
|
actions: actions,
|
|
@@ -304,7 +305,7 @@ export default class TableEditor extends WithTemplate {
|
|
|
304
305
|
deleteRows() {
|
|
305
306
|
const selectedRows = this.getSelectedRows()
|
|
306
307
|
if (!selectedRows.length) return
|
|
307
|
-
this.
|
|
308
|
+
this._umap.dialog
|
|
308
309
|
.confirm(
|
|
309
310
|
translate('Found {count} rows. Are you sure you want to delete all?', {
|
|
310
311
|
count: selectedRows.length,
|
|
@@ -320,9 +321,9 @@ export default class TableEditor extends WithTemplate {
|
|
|
320
321
|
this.datalayer.show()
|
|
321
322
|
this.datalayer.dataChanged()
|
|
322
323
|
this.renderBody()
|
|
323
|
-
if (this.
|
|
324
|
-
this.
|
|
325
|
-
this.
|
|
324
|
+
if (this._umap.browser.isOpen()) {
|
|
325
|
+
this._umap.browser.resetFilters()
|
|
326
|
+
this._umap.browser.open('filters')
|
|
326
327
|
}
|
|
327
328
|
})
|
|
328
329
|
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { DomEvent } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
|
+
import { translate } from '../i18n.js'
|
|
3
|
+
import { WithTemplate } from '../utils.js'
|
|
4
|
+
import ContextMenu from './contextmenu.js'
|
|
5
|
+
|
|
6
|
+
const TOP_BAR_TEMPLATE = `
|
|
7
|
+
<div class="umap-main-edit-toolbox with-transition dark">
|
|
8
|
+
<div class="umap-left-edit-toolbox" data-ref="left">
|
|
9
|
+
<div class="logo"><a class="" href="/" title="${translate('Go to the homepage')}">uMap</a></div>
|
|
10
|
+
<button class="map-name" type="button" data-ref="name"></button>
|
|
11
|
+
<button class="share-status" type="button" data-ref="share"></button>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="umap-right-edit-toolbox" data-ref="right">
|
|
14
|
+
<button class="connected-peers round" type="button" data-ref="peers">
|
|
15
|
+
<i class="icon icon-16 icon-peers icon-black"></i>
|
|
16
|
+
<span></span>
|
|
17
|
+
</button>
|
|
18
|
+
<button class="umap-user flat" type="button" data-ref="user">
|
|
19
|
+
<i class="icon icon-16 icon-profile"></i>
|
|
20
|
+
<span class="username" data-ref="username"></span>
|
|
21
|
+
</button>
|
|
22
|
+
<button class="umap-help-link" type="button" title="${translate('Help')}" data-ref="help">${translate('Help')}</button>
|
|
23
|
+
<button class="edit-cancel round" type="button" data-ref="cancel">
|
|
24
|
+
<i class="icon icon-16 icon-restore"></i>
|
|
25
|
+
<span class="">${translate('Cancel edits')}</span>
|
|
26
|
+
</button>
|
|
27
|
+
<button class="edit-disable round" type="button" data-ref="view">
|
|
28
|
+
<i class="icon icon-16 icon-eye"></i>
|
|
29
|
+
<span class="">${translate('View')}</span>
|
|
30
|
+
</button>
|
|
31
|
+
<button class="edit-save button round" type="button" data-ref="save">
|
|
32
|
+
<i class="icon icon-16 icon-save"></i>
|
|
33
|
+
<i class="icon icon-16 icon-save-disabled"></i>
|
|
34
|
+
<span hidden data-ref="saveLabel">${translate('Save')}</span>
|
|
35
|
+
<span hidden data-ref="saveDraftLabel">${translate('Save draft')}</span>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>`
|
|
39
|
+
|
|
40
|
+
export class TopBar extends WithTemplate {
|
|
41
|
+
constructor(umap, parent) {
|
|
42
|
+
super()
|
|
43
|
+
this._umap = umap
|
|
44
|
+
this._menu = new ContextMenu({ className: 'dark', fixed: true })
|
|
45
|
+
this.loadTemplate(TOP_BAR_TEMPLATE)
|
|
46
|
+
this.parent = parent
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setup() {
|
|
50
|
+
this.parent.appendChild(this.element)
|
|
51
|
+
this.elements.name.addEventListener('mouseover', () => {
|
|
52
|
+
this._umap.tooltip.open({
|
|
53
|
+
content: translate('Edit the title of the map'),
|
|
54
|
+
anchor: this.elements.name,
|
|
55
|
+
position: 'bottom',
|
|
56
|
+
delay: 500,
|
|
57
|
+
duration: 5000,
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
this.elements.share.addEventListener('mouseover', () => {
|
|
61
|
+
this._umap.tooltip.open({
|
|
62
|
+
content: translate('Update who can see and edit the map'),
|
|
63
|
+
anchor: this.elements.share,
|
|
64
|
+
position: 'bottom',
|
|
65
|
+
delay: 500,
|
|
66
|
+
duration: 5000,
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
if (this._umap.properties.editMode === 'advanced') {
|
|
70
|
+
this.elements.name.addEventListener('click', () => this._umap.editCaption())
|
|
71
|
+
this.elements.share.addEventListener('click', () => this._umap.permissions.edit())
|
|
72
|
+
}
|
|
73
|
+
this.elements.user.addEventListener('click', () => {
|
|
74
|
+
if (this._umap.properties.user?.id) {
|
|
75
|
+
const actions = [
|
|
76
|
+
{
|
|
77
|
+
label: translate('New map'),
|
|
78
|
+
action: this._umap.urls.get('map_new'),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: translate('My maps'),
|
|
82
|
+
action: this._umap.urls.get('user_dashboard'),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: translate('My teams'),
|
|
86
|
+
action: this._umap.urls.get('user_teams'),
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
if (this._umap.urls.has('user_profile')) {
|
|
90
|
+
actions.push({
|
|
91
|
+
label: translate('My profile'),
|
|
92
|
+
action: this._umap.urls.get('user_profile'),
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
this._menu.openBelow(this.elements.user, actions)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const connectedPeers = this._umap.sync.getNumberOfConnectedPeers()
|
|
100
|
+
this.elements.peers.addEventListener('mouseover', () => {
|
|
101
|
+
if (!connectedPeers) return
|
|
102
|
+
this._umap.tooltip.open({
|
|
103
|
+
content: translate('{connectedPeers} peer(s) currently connected to this map', {
|
|
104
|
+
connectedPeers: connectedPeers,
|
|
105
|
+
}),
|
|
106
|
+
anchor: this.elements.peers,
|
|
107
|
+
position: 'bottom',
|
|
108
|
+
delay: 500,
|
|
109
|
+
duration: 5000,
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
this.elements.help.addEventListener('click', () => this._umap.showGetStarted())
|
|
114
|
+
this.elements.cancel.addEventListener('click', () => this._umap.askForReset())
|
|
115
|
+
this.elements.cancel.addEventListener('mouseover', () => {
|
|
116
|
+
this._umap.tooltip.open({
|
|
117
|
+
content: this._umap.help.displayLabel('CANCEL'),
|
|
118
|
+
anchor: this.elements.cancel,
|
|
119
|
+
position: 'bottom',
|
|
120
|
+
delay: 500,
|
|
121
|
+
duration: 5000,
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
this.elements.view.addEventListener('click', () => this._umap.disableEdit())
|
|
125
|
+
this.elements.view.addEventListener('mouseover', () => {
|
|
126
|
+
this._umap.tooltip.open({
|
|
127
|
+
content: this._umap.help.displayLabel('PREVIEW'),
|
|
128
|
+
anchor: this.elements.view,
|
|
129
|
+
position: 'bottom',
|
|
130
|
+
delay: 500,
|
|
131
|
+
duration: 5000,
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
this.elements.save.addEventListener('click', () => this._umap.saveAll())
|
|
135
|
+
this.elements.save.addEventListener('mouseover', () => {
|
|
136
|
+
this._umap.tooltip.open({
|
|
137
|
+
content: this._umap.help.displayLabel('SAVE'),
|
|
138
|
+
anchor: this.elements.save,
|
|
139
|
+
position: 'bottom',
|
|
140
|
+
delay: 500,
|
|
141
|
+
duration: 5000,
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
this.redraw()
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
redraw() {
|
|
148
|
+
this.elements.peers.hidden = !this._umap.getProperty('syncEnabled')
|
|
149
|
+
this.elements.saveLabel.hidden = this._umap.permissions.isDraft()
|
|
150
|
+
this.elements.saveDraftLabel.hidden = !this._umap.permissions.isDraft()
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const BOTTOM_BAR_TEMPLATE = `
|
|
155
|
+
<div class="umap-caption-bar">
|
|
156
|
+
<h3 class="map-name"></h3>
|
|
157
|
+
<span data-ref="author"></span>
|
|
158
|
+
<button class="umap-about-link flat" type="button" title="${translate('Open caption')}" data-ref="caption">${translate('Open caption')}</button>
|
|
159
|
+
<button class="umap-open-browser-link flat" type="button" title="${translate('Browse data')}" data-ref="browse">${translate('Browse data')}</button>
|
|
160
|
+
<button class="umap-open-browser-link flat" type="button" title="${translate('Filter data')}" data-ref="filter">${translate('Filter data')}</button>
|
|
161
|
+
</div>
|
|
162
|
+
`
|
|
163
|
+
|
|
164
|
+
export class BottomBar extends WithTemplate {
|
|
165
|
+
constructor(umap, slideshow, parent) {
|
|
166
|
+
super()
|
|
167
|
+
this._umap = umap
|
|
168
|
+
this._slideshow = slideshow
|
|
169
|
+
this.loadTemplate(BOTTOM_BAR_TEMPLATE)
|
|
170
|
+
this.parent = parent
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
setup() {
|
|
174
|
+
this.parent.appendChild(this.element)
|
|
175
|
+
DomEvent.disableClickPropagation(this.element)
|
|
176
|
+
this._umap.addAuthorLink(this.elements.author)
|
|
177
|
+
this.elements.caption.addEventListener('click', () => this._umap.openCaption())
|
|
178
|
+
this.elements.browse.addEventListener('click', () => this._umap.openBrowser('data'))
|
|
179
|
+
this.elements.filter.addEventListener('click', () =>
|
|
180
|
+
this._umap.openBrowser('filters')
|
|
181
|
+
)
|
|
182
|
+
this._slideshow.renderToolbox(this.element)
|
|
183
|
+
this.redraw()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
redraw() {
|
|
187
|
+
const hasSlideshow = this._slideshow.isEnabled()
|
|
188
|
+
const barEnabled = this._umap.properties.captionBar || hasSlideshow
|
|
189
|
+
document.body.classList.toggle('umap-caption-bar-enabled', barEnabled)
|
|
190
|
+
document.body.classList.toggle('umap-slideshow-enabled', hasSlideshow)
|
|
191
|
+
const showMenus = this._umap.getProperty('captionMenus')
|
|
192
|
+
this.elements.caption.hidden = !showMenus
|
|
193
|
+
this.elements.browse.hidden = !showMenus
|
|
194
|
+
this.elements.filter.hidden = !showMenus || !this._umap.properties.facetKey
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -6,6 +6,7 @@ const TEMPLATE = `
|
|
|
6
6
|
<form method="dialog" data-ref="form">
|
|
7
7
|
<ul class="buttons">
|
|
8
8
|
<li><i class="icon icon-16 icon-close" data-close></i></li>
|
|
9
|
+
<li hidden data-ref="back"><i class="icon icon-16 icon-back"></i></li>
|
|
9
10
|
</ul>
|
|
10
11
|
<h3 data-ref="message" id="${Math.round(Date.now()).toString(36)}"></h3>
|
|
11
12
|
<fieldset data-ref="fieldset" role="document">
|
|
@@ -123,6 +124,10 @@ export default class Dialog extends WithTemplate {
|
|
|
123
124
|
} else {
|
|
124
125
|
this.elements.template.innerHTML = dialog.template || ''
|
|
125
126
|
}
|
|
127
|
+
this.elements.back.hidden = !dialog.back
|
|
128
|
+
if (dialog.back) {
|
|
129
|
+
this.elements.back.addEventListener('click', dialog.back)
|
|
130
|
+
}
|
|
126
131
|
|
|
127
132
|
this.focusable = this.getFocusable()
|
|
128
133
|
this.hasFormData = this.elements.fieldset.elements.length > 0
|
|
@@ -2,9 +2,10 @@ import { DomEvent, DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
|
2
2
|
import { translate } from '../i18n.js'
|
|
3
3
|
|
|
4
4
|
export class Panel {
|
|
5
|
-
constructor(
|
|
6
|
-
this.parent =
|
|
7
|
-
this.
|
|
5
|
+
constructor(umap, leafletMap) {
|
|
6
|
+
this.parent = leafletMap._controlContainer
|
|
7
|
+
this._umap = umap
|
|
8
|
+
this._leafletMap = leafletMap
|
|
8
9
|
this.container = DomUtil.create('div', '', this.parent)
|
|
9
10
|
// This will be set once according to the panel configurated at load
|
|
10
11
|
// or by using panels as popups
|
|
@@ -80,26 +81,26 @@ export class Panel {
|
|
|
80
81
|
onClose() {
|
|
81
82
|
if (DomUtil.hasClass(this.container, 'on')) {
|
|
82
83
|
DomUtil.removeClass(this.container, 'on')
|
|
83
|
-
this.
|
|
84
|
+
this._leafletMap.invalidateSize({ pan: false })
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export class EditPanel extends Panel {
|
|
89
|
-
constructor(
|
|
90
|
-
super(
|
|
90
|
+
constructor(umap, leafletMap) {
|
|
91
|
+
super(umap, leafletMap)
|
|
91
92
|
this.className = 'right dark'
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
onClose() {
|
|
95
96
|
super.onClose()
|
|
96
|
-
this.
|
|
97
|
+
this._umap.editedFeature = null
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
export class FullPanel extends Panel {
|
|
101
|
-
constructor(
|
|
102
|
-
super(
|
|
102
|
+
constructor(umap, leafletMap) {
|
|
103
|
+
super(umap, leafletMap)
|
|
103
104
|
this.className = 'full dark'
|
|
104
105
|
this.mode = 'expanded'
|
|
105
106
|
}
|