umap-project 3.3.5__py3-none-any.whl → 3.4.0b0__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/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +43 -33
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +43 -33
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +35 -29
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +35 -29
- umap/locale/en/LC_MESSAGES/django.po +34 -28
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +43 -33
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +58 -54
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +43 -33
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +43 -33
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +36 -30
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +43 -33
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +35 -29
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +43 -33
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +43 -33
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +35 -29
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +43 -33
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +43 -33
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +310 -109
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +80 -70
- umap/management/commands/switch_user.py +2 -2
- umap/static/umap/base.css +89 -32
- umap/static/umap/content.css +129 -33
- umap/static/umap/css/bar.css +82 -20
- umap/static/umap/css/browser.css +163 -0
- umap/static/umap/css/contextmenu.css +15 -0
- umap/static/umap/css/dialog.css +36 -16
- umap/static/umap/css/form.css +122 -32
- umap/static/umap/css/icon.css +46 -3
- umap/static/umap/css/panel.css +7 -3
- umap/static/umap/css/popup.css +34 -8
- umap/static/umap/css/tooltip.css +8 -4
- umap/static/umap/img/16-white.svg +26 -8
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/source/16-white.svg +36 -18
- umap/static/umap/img/source/16.svg +1 -1
- umap/static/umap/js/components/alerts/alert.css +69 -31
- umap/static/umap/js/components/alerts/alert.js +20 -2
- umap/static/umap/js/modules/browser.js +64 -56
- umap/static/umap/js/modules/caption.js +10 -7
- umap/static/umap/js/modules/data/features.js +82 -59
- umap/static/umap/js/modules/data/layer.js +75 -166
- umap/static/umap/js/modules/domutils.js +109 -0
- umap/static/umap/js/modules/filters.js +807 -0
- umap/static/umap/js/modules/form/builder.js +8 -5
- umap/static/umap/js/modules/form/fields.js +110 -220
- umap/static/umap/js/modules/formatter.js +24 -1
- umap/static/umap/js/modules/help.js +3 -2
- umap/static/umap/js/modules/importers/opendata.js +5 -0
- umap/static/umap/js/modules/importers/openrouteservice.js +6 -1
- umap/static/umap/js/modules/managers.js +265 -0
- umap/static/umap/js/modules/permissions.js +35 -31
- umap/static/umap/js/modules/rendering/controls.js +7 -7
- umap/static/umap/js/modules/rendering/icon.js +3 -8
- umap/static/umap/js/modules/rendering/layers/base.js +1 -1
- umap/static/umap/js/modules/rendering/layers/classified.js +17 -10
- umap/static/umap/js/modules/rendering/layers/cluster.js +2 -2
- umap/static/umap/js/modules/rendering/template.js +44 -8
- umap/static/umap/js/modules/rendering/ui.js +29 -23
- umap/static/umap/js/modules/rules.js +4 -3
- umap/static/umap/js/modules/schema.js +3 -6
- umap/static/umap/js/modules/share.js +4 -3
- umap/static/umap/js/modules/tableeditor.js +50 -38
- umap/static/umap/js/modules/templates.js +2 -3
- umap/static/umap/js/modules/ui/bar.js +42 -18
- umap/static/umap/js/modules/ui/dialog.js +33 -31
- umap/static/umap/js/modules/ui/panel.js +21 -7
- umap/static/umap/js/modules/ui/tooltip.js +6 -5
- umap/static/umap/js/modules/umap.js +155 -46
- umap/static/umap/js/modules/utils.js +23 -1
- umap/static/umap/js/umap.core.js +1 -110
- umap/static/umap/locale/am_ET.js +40 -14
- umap/static/umap/locale/am_ET.json +40 -14
- umap/static/umap/locale/ar.js +40 -14
- umap/static/umap/locale/ar.json +40 -14
- umap/static/umap/locale/ast.js +40 -14
- umap/static/umap/locale/ast.json +40 -14
- umap/static/umap/locale/bg.js +40 -14
- umap/static/umap/locale/bg.json +40 -14
- umap/static/umap/locale/br.js +47 -21
- umap/static/umap/locale/br.json +47 -21
- umap/static/umap/locale/ca.js +40 -14
- umap/static/umap/locale/ca.json +40 -14
- umap/static/umap/locale/cs_CZ.js +40 -14
- umap/static/umap/locale/cs_CZ.json +40 -14
- umap/static/umap/locale/da.js +40 -14
- umap/static/umap/locale/da.json +40 -14
- umap/static/umap/locale/de.js +39 -13
- umap/static/umap/locale/de.json +39 -13
- umap/static/umap/locale/el.js +40 -14
- umap/static/umap/locale/el.json +40 -14
- umap/static/umap/locale/en.js +39 -13
- umap/static/umap/locale/en.json +39 -13
- umap/static/umap/locale/en_US.json +40 -14
- umap/static/umap/locale/es.js +40 -14
- umap/static/umap/locale/es.json +40 -14
- umap/static/umap/locale/et.js +79 -53
- umap/static/umap/locale/et.json +79 -53
- umap/static/umap/locale/eu.js +72 -46
- umap/static/umap/locale/eu.json +72 -46
- umap/static/umap/locale/fa_IR.js +40 -14
- umap/static/umap/locale/fa_IR.json +40 -14
- umap/static/umap/locale/fi.js +40 -14
- umap/static/umap/locale/fi.json +40 -14
- umap/static/umap/locale/fr.js +39 -13
- umap/static/umap/locale/fr.json +39 -13
- umap/static/umap/locale/gl.js +40 -14
- umap/static/umap/locale/gl.json +40 -14
- umap/static/umap/locale/he.js +40 -14
- umap/static/umap/locale/he.json +40 -14
- umap/static/umap/locale/hr.js +40 -14
- umap/static/umap/locale/hr.json +40 -14
- umap/static/umap/locale/hu.js +40 -14
- umap/static/umap/locale/hu.json +40 -14
- umap/static/umap/locale/id.js +40 -14
- umap/static/umap/locale/id.json +40 -14
- umap/static/umap/locale/is.js +40 -14
- umap/static/umap/locale/is.json +40 -14
- umap/static/umap/locale/it.js +40 -14
- umap/static/umap/locale/it.json +40 -14
- umap/static/umap/locale/ja.js +40 -14
- umap/static/umap/locale/ja.json +40 -14
- umap/static/umap/locale/ko.js +40 -14
- umap/static/umap/locale/ko.json +40 -14
- umap/static/umap/locale/lt.js +40 -14
- umap/static/umap/locale/lt.json +40 -14
- umap/static/umap/locale/ms.js +40 -14
- umap/static/umap/locale/ms.json +40 -14
- umap/static/umap/locale/nl.js +40 -14
- umap/static/umap/locale/nl.json +40 -14
- umap/static/umap/locale/no.js +40 -14
- umap/static/umap/locale/no.json +40 -14
- umap/static/umap/locale/pl.js +40 -14
- umap/static/umap/locale/pl.json +40 -14
- umap/static/umap/locale/pl_PL.json +40 -14
- umap/static/umap/locale/pt.js +40 -14
- umap/static/umap/locale/pt.json +40 -14
- umap/static/umap/locale/pt_BR.js +40 -14
- umap/static/umap/locale/pt_BR.json +40 -14
- umap/static/umap/locale/pt_PT.js +40 -14
- umap/static/umap/locale/pt_PT.json +40 -14
- umap/static/umap/locale/ro.js +40 -14
- umap/static/umap/locale/ro.json +40 -14
- umap/static/umap/locale/ru.js +40 -14
- umap/static/umap/locale/ru.json +40 -14
- umap/static/umap/locale/sk_SK.js +40 -14
- umap/static/umap/locale/sk_SK.json +40 -14
- umap/static/umap/locale/sl.js +40 -14
- umap/static/umap/locale/sl.json +40 -14
- umap/static/umap/locale/sr.js +40 -14
- umap/static/umap/locale/sr.json +40 -14
- umap/static/umap/locale/sv.js +40 -14
- umap/static/umap/locale/sv.json +40 -14
- umap/static/umap/locale/th_TH.js +40 -14
- umap/static/umap/locale/th_TH.json +40 -14
- umap/static/umap/locale/tr.js +40 -14
- umap/static/umap/locale/tr.json +40 -14
- umap/static/umap/locale/uk_UA.js +40 -14
- umap/static/umap/locale/uk_UA.json +40 -14
- umap/static/umap/locale/vi.js +40 -14
- umap/static/umap/locale/vi.json +40 -14
- umap/static/umap/locale/vi_VN.json +40 -14
- umap/static/umap/locale/zh.js +40 -14
- umap/static/umap/locale/zh.json +40 -14
- umap/static/umap/locale/zh_CN.json +40 -14
- umap/static/umap/locale/zh_TW.Big5.json +40 -14
- umap/static/umap/locale/zh_TW.js +40 -14
- umap/static/umap/locale/zh_TW.json +40 -14
- umap/static/umap/map.css +60 -223
- umap/static/umap/unittests/utils.js +18 -0
- umap/static/umap/vars.css +23 -5
- umap/templates/umap/components/alerts/alert.html +32 -29
- umap/templates/umap/css.html +2 -1
- umap/templates/umap/login_popup_end.html +18 -9
- umap/templates/umap/user_map_table.html +7 -2
- umap/tests/integration/conftest.py +2 -6
- umap/tests/integration/test_anonymous_owned_map.py +89 -36
- umap/tests/integration/test_basics.py +25 -1
- umap/tests/integration/test_browser.py +37 -0
- umap/tests/integration/test_datalayer.py +9 -16
- umap/tests/integration/test_draw_polygon.py +2 -0
- umap/tests/integration/test_edit_marker.py +1 -1
- umap/tests/integration/test_export_map.py +19 -0
- umap/tests/integration/test_fields.py +522 -0
- umap/tests/integration/test_filters.py +617 -0
- umap/tests/integration/test_import.py +15 -42
- umap/tests/integration/test_remote_data.py +60 -4
- umap/tests/integration/test_share.py +4 -4
- umap/tests/integration/test_tableeditor.py +31 -7
- umap/tests/integration/test_websocket_sync.py +3 -1
- umap/tests/test_dashboard.py +10 -0
- umap/urls.py +1 -0
- umap/views.py +5 -0
- {umap_project-3.3.5.dist-info → umap_project-3.4.0b0.dist-info}/METADATA +12 -12
- {umap_project-3.3.5.dist-info → umap_project-3.4.0b0.dist-info}/RECORD +216 -213
- umap/static/umap/js/modules/facets.js +0 -164
- umap/tests/integration/test_facets_browser.py +0 -279
- {umap_project-3.3.5.dist-info → umap_project-3.4.0b0.dist-info}/WHEEL +0 -0
- {umap_project-3.3.5.dist-info → umap_project-3.4.0b0.dist-info}/entry_points.txt +0 -0
- {umap_project-3.3.5.dist-info → umap_project-3.4.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { DomEvent, DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
|
-
import { translate } from './i18n.js'
|
|
3
|
-
import * as Utils from './utils.js'
|
|
4
|
-
|
|
5
|
-
export default class Facets {
|
|
6
|
-
constructor(umap) {
|
|
7
|
-
this._umap = umap
|
|
8
|
-
this.selected = {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
compute(names, defined) {
|
|
12
|
-
const properties = {}
|
|
13
|
-
let selected
|
|
14
|
-
|
|
15
|
-
for (const name of names) {
|
|
16
|
-
const type = defined.get(name).type
|
|
17
|
-
properties[name] = { type: type }
|
|
18
|
-
selected = this.selected[name] || {}
|
|
19
|
-
selected.type = type
|
|
20
|
-
if (!['date', 'datetime', 'number'].includes(type)) {
|
|
21
|
-
properties[name].choices = []
|
|
22
|
-
selected.choices = selected.choices || []
|
|
23
|
-
}
|
|
24
|
-
this.selected[name] = selected
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this._umap.datalayers.browsable().map((datalayer) => {
|
|
28
|
-
datalayer.features.forEach((feature) => {
|
|
29
|
-
for (const name of names) {
|
|
30
|
-
let value = feature.properties[name]
|
|
31
|
-
const type = defined.get(name).type
|
|
32
|
-
const parser = this.getParser(type)
|
|
33
|
-
value = parser(value)
|
|
34
|
-
switch (type) {
|
|
35
|
-
case 'date':
|
|
36
|
-
case 'datetime':
|
|
37
|
-
case 'number':
|
|
38
|
-
if (!Number.isNaN(value)) {
|
|
39
|
-
// Special cases where we want to be lousy when checking isNaN without
|
|
40
|
-
// coercing to a Number first because we handle multiple types.
|
|
41
|
-
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/
|
|
42
|
-
// Reference/Global_Objects/Number/isNaN
|
|
43
|
-
// biome-ignore lint/suspicious/noGlobalIsNan: see above.
|
|
44
|
-
if (isNaN(properties[name].min) || properties[name].min > value) {
|
|
45
|
-
properties[name].min = value
|
|
46
|
-
}
|
|
47
|
-
// biome-ignore lint/suspicious/noGlobalIsNan: see above.
|
|
48
|
-
if (isNaN(properties[name].max) || properties[name].max < value) {
|
|
49
|
-
properties[name].max = value
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
break
|
|
53
|
-
default:
|
|
54
|
-
value = value || translate('<empty value>')
|
|
55
|
-
if (!properties[name].choices.includes(value)) {
|
|
56
|
-
properties[name].choices.push(value)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
return properties
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
isActive() {
|
|
66
|
-
for (const { type, min, max, choices } of Object.values(this.selected)) {
|
|
67
|
-
if (min !== undefined || max !== undefined || choices?.length) {
|
|
68
|
-
return true
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
build() {
|
|
75
|
-
const defined = this.getDefined()
|
|
76
|
-
const names = [...defined.keys()]
|
|
77
|
-
const facetProperties = this.compute(names, defined)
|
|
78
|
-
|
|
79
|
-
const fields = names.map((name) => {
|
|
80
|
-
const criteria = facetProperties[name]
|
|
81
|
-
let handler = 'FacetSearchChoices'
|
|
82
|
-
switch (criteria.type) {
|
|
83
|
-
case 'number':
|
|
84
|
-
handler = 'FacetSearchNumber'
|
|
85
|
-
break
|
|
86
|
-
case 'date':
|
|
87
|
-
handler = 'FacetSearchDate'
|
|
88
|
-
break
|
|
89
|
-
case 'datetime':
|
|
90
|
-
handler = 'FacetSearchDateTime'
|
|
91
|
-
break
|
|
92
|
-
}
|
|
93
|
-
const label = defined.get(name).label
|
|
94
|
-
return [
|
|
95
|
-
`selected.${name}`,
|
|
96
|
-
{
|
|
97
|
-
criteria: criteria,
|
|
98
|
-
handler: handler,
|
|
99
|
-
label: label,
|
|
100
|
-
},
|
|
101
|
-
]
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
return fields
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
getDefined() {
|
|
108
|
-
const defaultType = 'checkbox'
|
|
109
|
-
const allowedTypes = [defaultType, 'radio', 'number', 'date', 'datetime']
|
|
110
|
-
const defined = new Map()
|
|
111
|
-
if (!this._umap.properties.facetKey) return defined
|
|
112
|
-
return (this._umap.properties.facetKey || '').split(',').reduce((acc, curr) => {
|
|
113
|
-
let [name, label, type] = curr.split('|')
|
|
114
|
-
type = allowedTypes.includes(type) ? type : defaultType
|
|
115
|
-
acc.set(name, { label: label || name, type: type })
|
|
116
|
-
return acc
|
|
117
|
-
}, defined)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
getParser(type) {
|
|
121
|
-
switch (type) {
|
|
122
|
-
case 'number':
|
|
123
|
-
return Number.parseFloat
|
|
124
|
-
case 'datetime':
|
|
125
|
-
return (v) => new Date(v)
|
|
126
|
-
case 'date':
|
|
127
|
-
return Utils.parseNaiveDate
|
|
128
|
-
default:
|
|
129
|
-
return (v) => String(v || '')
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
dumps(parsed) {
|
|
134
|
-
const dumped = []
|
|
135
|
-
for (const [property, { label, type }] of parsed) {
|
|
136
|
-
dumped.push([property, label, type].filter(Boolean).join('|'))
|
|
137
|
-
}
|
|
138
|
-
const oldValue = this._umap.properties.facetKey
|
|
139
|
-
this._umap.properties.facetKey = dumped.join(',')
|
|
140
|
-
this._umap.sync.update(
|
|
141
|
-
'properties.facetKey',
|
|
142
|
-
this._umap.properties.facetKey,
|
|
143
|
-
oldValue
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
has(property) {
|
|
148
|
-
return this.getDefined().has(property)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
add(property, label, type) {
|
|
152
|
-
const defined = this.getDefined()
|
|
153
|
-
if (!defined.has(property)) {
|
|
154
|
-
defined.set(property, { label, type })
|
|
155
|
-
this.dumps(defined)
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
remove(property) {
|
|
160
|
-
const defined = this.getDefined()
|
|
161
|
-
defined.delete(property)
|
|
162
|
-
this.dumps(defined)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
import re
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
from playwright.sync_api import expect
|
|
6
|
-
|
|
7
|
-
from ..base import DataLayerFactory
|
|
8
|
-
|
|
9
|
-
pytestmark = pytest.mark.django_db
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
DATALAYER_DATA1 = {
|
|
13
|
-
"type": "FeatureCollection",
|
|
14
|
-
"features": [
|
|
15
|
-
{
|
|
16
|
-
"type": "Feature",
|
|
17
|
-
"properties": {
|
|
18
|
-
"mytype": "even",
|
|
19
|
-
"name": "Point 2",
|
|
20
|
-
"mynumber": 10,
|
|
21
|
-
"mydate": "2024/04/14 12:19:17",
|
|
22
|
-
},
|
|
23
|
-
"geometry": {"type": "Point", "coordinates": [0.065918, 48.385442]},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"type": "Feature",
|
|
27
|
-
"properties": {
|
|
28
|
-
"mytype": "odd",
|
|
29
|
-
"name": "Point 1",
|
|
30
|
-
"mynumber": 12,
|
|
31
|
-
"mydate": "2024/03/13 12:20:20",
|
|
32
|
-
},
|
|
33
|
-
"geometry": {"type": "Point", "coordinates": [3.55957, 49.767074]},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
"_umap_options": {
|
|
37
|
-
"name": "Calque 1",
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
DATALAYER_DATA2 = {
|
|
43
|
-
"type": "FeatureCollection",
|
|
44
|
-
"features": [
|
|
45
|
-
{
|
|
46
|
-
"type": "Feature",
|
|
47
|
-
"properties": {
|
|
48
|
-
"mytype": "even",
|
|
49
|
-
"name": "Point 4",
|
|
50
|
-
"mynumber": 10,
|
|
51
|
-
"mydate": "2024/08/18 13:14:15",
|
|
52
|
-
},
|
|
53
|
-
"geometry": {"type": "Point", "coordinates": [0.856934, 45.290347]},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "Feature",
|
|
57
|
-
"properties": {
|
|
58
|
-
"mytype": "odd",
|
|
59
|
-
"name": "Point 3",
|
|
60
|
-
"mynumber": 14,
|
|
61
|
-
"mydate": "2024-04-14T10:19:17.000Z",
|
|
62
|
-
},
|
|
63
|
-
"geometry": {"type": "Point", "coordinates": [4.372559, 47.945786]},
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
"_umap_options": {
|
|
67
|
-
"name": "Calque 2",
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
DATALAYER_DATA3 = {
|
|
73
|
-
"type": "FeatureCollection",
|
|
74
|
-
"features": [
|
|
75
|
-
{
|
|
76
|
-
"type": "Feature",
|
|
77
|
-
"properties": {"name": "a polygon"},
|
|
78
|
-
"geometry": {
|
|
79
|
-
"type": "Polygon",
|
|
80
|
-
"coordinates": [
|
|
81
|
-
[
|
|
82
|
-
[2.12, 49.57],
|
|
83
|
-
[1.08, 49.02],
|
|
84
|
-
[2.51, 47.55],
|
|
85
|
-
[3.19, 48.77],
|
|
86
|
-
[2.12, 49.57],
|
|
87
|
-
]
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
"_umap_options": {"name": "Calque 2", "browsable": False},
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def test_simple_facet_search(live_server, page, map):
|
|
97
|
-
map.settings["properties"]["onLoadPanel"] = "datafilters"
|
|
98
|
-
map.settings["properties"]["facetKey"] = "mytype|My type,mynumber|My Number|number"
|
|
99
|
-
map.settings["properties"]["showLabel"] = True
|
|
100
|
-
map.save()
|
|
101
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
102
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
103
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA3)
|
|
104
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
105
|
-
panel = page.locator(".panel.left.on")
|
|
106
|
-
expect(panel).to_have_class(re.compile(".*expanded.*"))
|
|
107
|
-
expect(panel.locator(".umap-browser")).to_be_visible()
|
|
108
|
-
# From a non browsable datalayer, should not be impacted
|
|
109
|
-
paths = page.locator(".leaflet-overlay-pane path")
|
|
110
|
-
expect(paths).to_be_visible()
|
|
111
|
-
expect(panel).to_be_visible()
|
|
112
|
-
# Facet name
|
|
113
|
-
expect(page.get_by_text("My type")).to_be_visible()
|
|
114
|
-
# Facet values
|
|
115
|
-
oven = page.get_by_text("even")
|
|
116
|
-
odd = page.get_by_text("odd")
|
|
117
|
-
expect(oven).to_be_visible()
|
|
118
|
-
expect(odd).to_be_visible()
|
|
119
|
-
expect(paths).to_be_visible()
|
|
120
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
121
|
-
expect(markers).to_have_count(4)
|
|
122
|
-
# Tooltips
|
|
123
|
-
expect(page.get_by_role("tooltip", name="Point 1")).to_be_visible()
|
|
124
|
-
expect(page.get_by_role("tooltip", name="Point 2")).to_be_visible()
|
|
125
|
-
expect(page.get_by_role("tooltip", name="Point 3")).to_be_visible()
|
|
126
|
-
expect(page.get_by_role("tooltip", name="Point 4")).to_be_visible()
|
|
127
|
-
|
|
128
|
-
# Datalist
|
|
129
|
-
expect(panel.get_by_text("Point 1")).to_be_visible()
|
|
130
|
-
expect(panel.get_by_text("Point 2")).to_be_visible()
|
|
131
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
132
|
-
expect(panel.get_by_text("Point 4")).to_be_visible()
|
|
133
|
-
|
|
134
|
-
# Now let's filter
|
|
135
|
-
odd.click()
|
|
136
|
-
expect(markers).to_have_count(2)
|
|
137
|
-
expect(page.get_by_role("tooltip", name="Point 2")).to_be_hidden()
|
|
138
|
-
expect(page.get_by_role("tooltip", name="Point 4")).to_be_hidden()
|
|
139
|
-
expect(page.get_by_role("tooltip", name="Point 1")).to_be_visible()
|
|
140
|
-
expect(page.get_by_role("tooltip", name="Point 3")).to_be_visible()
|
|
141
|
-
expect(panel.get_by_text("Point 2")).to_be_hidden()
|
|
142
|
-
expect(panel.get_by_text("Point 4")).to_be_hidden()
|
|
143
|
-
expect(panel.get_by_text("Point 1")).to_be_visible()
|
|
144
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
145
|
-
expect(paths).to_be_visible
|
|
146
|
-
# Now let's filter
|
|
147
|
-
odd.click()
|
|
148
|
-
expect(markers).to_have_count(4)
|
|
149
|
-
expect(paths).to_be_visible()
|
|
150
|
-
|
|
151
|
-
# Let's filter using the number facet
|
|
152
|
-
expect(page.get_by_text("My Number")).to_be_visible()
|
|
153
|
-
expect(page.get_by_label("Min")).to_have_value("10")
|
|
154
|
-
expect(page.get_by_label("Max")).to_have_value("14")
|
|
155
|
-
page.get_by_label("Min").fill("11")
|
|
156
|
-
page.keyboard.press("Tab") # Move out of the input, so the "change" event is sent
|
|
157
|
-
expect(markers).to_have_count(2)
|
|
158
|
-
expect(paths).to_be_visible()
|
|
159
|
-
page.get_by_label("Max").fill("13")
|
|
160
|
-
page.keyboard.press("Tab")
|
|
161
|
-
expect(markers).to_have_count(1)
|
|
162
|
-
|
|
163
|
-
# Now let's combine
|
|
164
|
-
page.get_by_label("Min").fill("10")
|
|
165
|
-
page.keyboard.press("Tab")
|
|
166
|
-
expect(markers).to_have_count(3)
|
|
167
|
-
odd.click()
|
|
168
|
-
expect(markers).to_have_count(1)
|
|
169
|
-
expect(paths).to_be_visible()
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
def test_date_facet_search(live_server, page, map):
|
|
173
|
-
map.settings["properties"]["onLoadPanel"] = "datafilters"
|
|
174
|
-
map.settings["properties"]["facetKey"] = "mydate|Date filter|date"
|
|
175
|
-
map.save()
|
|
176
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
177
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
178
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/47.5/-1.5")
|
|
179
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
180
|
-
expect(markers).to_have_count(4)
|
|
181
|
-
expect(page.get_by_text("Date Filter")).to_be_visible()
|
|
182
|
-
expect(page.get_by_label("From")).to_have_value("2024-03-13")
|
|
183
|
-
expect(page.get_by_label("Until")).to_have_value("2024-08-18")
|
|
184
|
-
page.get_by_label("From").fill("2024-03-14")
|
|
185
|
-
expect(markers).to_have_count(3)
|
|
186
|
-
page.get_by_label("Until").fill("2024-08-17")
|
|
187
|
-
expect(markers).to_have_count(2)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
def test_choice_with_empty_value(live_server, page, map):
|
|
191
|
-
map.settings["properties"]["onLoadPanel"] = "datafilters"
|
|
192
|
-
map.settings["properties"]["facetKey"] = "mytype|My type"
|
|
193
|
-
map.save()
|
|
194
|
-
data = copy.deepcopy(DATALAYER_DATA1)
|
|
195
|
-
data["features"][0]["properties"]["mytype"] = ""
|
|
196
|
-
del data["features"][1]["properties"]["mytype"]
|
|
197
|
-
DataLayerFactory(map=map, data=data)
|
|
198
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
199
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/47.5/-1.5")
|
|
200
|
-
expect(page.get_by_text("<empty value>")).to_be_visible()
|
|
201
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
202
|
-
expect(markers).to_have_count(4)
|
|
203
|
-
page.get_by_text("<empty value>").click()
|
|
204
|
-
expect(markers).to_have_count(2)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def test_number_with_zero_value(live_server, page, map):
|
|
208
|
-
map.settings["properties"]["onLoadPanel"] = "datafilters"
|
|
209
|
-
map.settings["properties"]["facetKey"] = "mynumber|Filter|number"
|
|
210
|
-
map.save()
|
|
211
|
-
data = copy.deepcopy(DATALAYER_DATA1)
|
|
212
|
-
data["features"][0]["properties"]["mynumber"] = 0
|
|
213
|
-
DataLayerFactory(map=map, data=data)
|
|
214
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
215
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/47.5/-1.5")
|
|
216
|
-
expect(page.get_by_label("Min")).to_have_value("0")
|
|
217
|
-
expect(page.get_by_label("Max")).to_have_value("14")
|
|
218
|
-
page.get_by_label("Min").fill("1")
|
|
219
|
-
page.keyboard.press("Tab") # Move out of the input, so the "change" event is sent
|
|
220
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
221
|
-
expect(markers).to_have_count(3)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
def test_facets_search_are_persistent_when_closing_panel(live_server, page, map):
|
|
225
|
-
map.settings["properties"]["onLoadPanel"] = "datafilters"
|
|
226
|
-
map.settings["properties"]["facetKey"] = "mytype|My type,mynumber|My Number|number"
|
|
227
|
-
map.save()
|
|
228
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
229
|
-
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
230
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
231
|
-
panel = page.locator(".panel.left")
|
|
232
|
-
|
|
233
|
-
# Facet values
|
|
234
|
-
odd = page.get_by_label("odd")
|
|
235
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
236
|
-
expect(markers).to_have_count(4)
|
|
237
|
-
|
|
238
|
-
# Datalist in the browser
|
|
239
|
-
expect(panel.get_by_text("Point 1")).to_be_visible()
|
|
240
|
-
expect(panel.get_by_text("Point 2")).to_be_visible()
|
|
241
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
242
|
-
expect(panel.get_by_text("Point 4")).to_be_visible()
|
|
243
|
-
|
|
244
|
-
# Now let's filter
|
|
245
|
-
odd.click()
|
|
246
|
-
expect(page.locator(".filters summary")).to_have_attribute("data-badge", " ")
|
|
247
|
-
expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ")
|
|
248
|
-
expect(markers).to_have_count(2)
|
|
249
|
-
expect(panel.get_by_text("Point 2")).to_be_hidden()
|
|
250
|
-
expect(panel.get_by_text("Point 4")).to_be_hidden()
|
|
251
|
-
expect(panel.get_by_text("Point 1")).to_be_visible()
|
|
252
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
253
|
-
|
|
254
|
-
# Let's filter using the number facet
|
|
255
|
-
expect(panel.get_by_label("Min")).to_have_value("10")
|
|
256
|
-
expect(panel.get_by_label("Max")).to_have_value("14")
|
|
257
|
-
page.get_by_label("Min").fill("13")
|
|
258
|
-
page.keyboard.press("Tab") # Move out of the input, so the "change" event is sent
|
|
259
|
-
expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true")
|
|
260
|
-
expect(markers).to_have_count(1)
|
|
261
|
-
expect(panel.get_by_text("Point 2")).to_be_hidden()
|
|
262
|
-
expect(panel.get_by_text("Point 4")).to_be_hidden()
|
|
263
|
-
expect(panel.get_by_text("Point 1")).to_be_hidden()
|
|
264
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
265
|
-
|
|
266
|
-
# Close panel
|
|
267
|
-
expect(panel.locator(".filters summary")).to_have_attribute("data-badge", " ")
|
|
268
|
-
expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ")
|
|
269
|
-
panel.get_by_role("button", name="Close").click()
|
|
270
|
-
page.get_by_role("button", name="Open browser").click()
|
|
271
|
-
expect(panel.get_by_label("Min")).to_have_value("13")
|
|
272
|
-
expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true")
|
|
273
|
-
expect(panel.get_by_label("odd")).to_be_checked()
|
|
274
|
-
|
|
275
|
-
# Datalist in the browser should be inchanged
|
|
276
|
-
expect(panel.get_by_text("Point 2")).to_be_hidden()
|
|
277
|
-
expect(panel.get_by_text("Point 4")).to_be_hidden()
|
|
278
|
-
expect(panel.get_by_text("Point 1")).to_be_hidden()
|
|
279
|
-
expect(panel.get_by_text("Point 3")).to_be_visible()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|