umap-project 2.1.3__py3-none-any.whl → 2.2.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.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/context_processors.py +1 -0
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/en/LC_MESSAGES/django.po +32 -32
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/migrations/0020_alter_tilelayer_url_template.py +19 -0
- umap/migrations/0021_remove_map_description.py +16 -0
- umap/models.py +8 -6
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +43 -156
- umap/static/umap/content.css +7 -25
- umap/static/umap/css/icon.css +112 -0
- umap/static/umap/css/panel.css +140 -0
- umap/static/umap/img/16-white.svg +5 -1
- umap/static/umap/img/16.svg +7 -4
- umap/static/umap/img/24-white.svg +3 -1
- umap/static/umap/img/24.svg +3 -4
- umap/static/umap/img/source/16-white.svg +176 -940
- umap/static/umap/img/source/16.svg +8 -5
- umap/static/umap/img/source/24-white.svg +5 -3
- umap/static/umap/img/source/24.svg +6 -7
- umap/static/umap/js/modules/browser.js +97 -73
- umap/static/umap/js/modules/dompurify.js +12 -0
- umap/static/umap/js/modules/facets.js +149 -0
- umap/static/umap/js/modules/global.js +9 -1
- umap/static/umap/js/modules/i18n.js +7 -0
- umap/static/umap/js/modules/orderable.js +84 -0
- umap/static/umap/js/modules/panel.js +76 -0
- umap/static/umap/js/modules/request.js +0 -1
- umap/static/umap/js/modules/schema.js +324 -223
- umap/static/umap/js/modules/urls.js +1 -16
- umap/static/umap/js/modules/utils.js +340 -0
- umap/static/umap/js/umap.autocomplete.js +40 -25
- umap/static/umap/js/umap.controls.js +227 -369
- umap/static/umap/js/umap.core.js +77 -366
- umap/static/umap/js/umap.datalayer.permissions.js +1 -1
- umap/static/umap/js/umap.features.js +62 -42
- umap/static/umap/js/umap.forms.js +128 -36
- umap/static/umap/js/umap.icon.js +11 -4
- umap/static/umap/js/umap.importer.js +78 -57
- umap/static/umap/js/umap.js +179 -156
- umap/static/umap/js/umap.layer.js +79 -40
- umap/static/umap/js/umap.permissions.js +13 -9
- umap/static/umap/js/umap.popup.js +26 -30
- umap/static/umap/js/umap.share.js +12 -9
- umap/static/umap/js/umap.tableeditor.js +4 -6
- umap/static/umap/js/umap.ui.js +10 -60
- umap/static/umap/locale/am_ET.js +243 -227
- umap/static/umap/locale/am_ET.json +21 -9
- umap/static/umap/locale/ar.js +243 -227
- umap/static/umap/locale/ar.json +21 -9
- umap/static/umap/locale/ast.js +243 -227
- umap/static/umap/locale/ast.json +21 -9
- umap/static/umap/locale/bg.js +243 -227
- umap/static/umap/locale/bg.json +21 -9
- umap/static/umap/locale/br.js +253 -237
- umap/static/umap/locale/br.json +25 -13
- umap/static/umap/locale/ca.js +243 -227
- umap/static/umap/locale/ca.json +21 -9
- umap/static/umap/locale/cs_CZ.js +243 -227
- umap/static/umap/locale/cs_CZ.json +21 -9
- umap/static/umap/locale/da.js +243 -227
- umap/static/umap/locale/da.json +21 -9
- umap/static/umap/locale/de.js +243 -227
- umap/static/umap/locale/de.json +21 -9
- umap/static/umap/locale/el.js +243 -227
- umap/static/umap/locale/el.json +21 -9
- umap/static/umap/locale/en.js +243 -234
- umap/static/umap/locale/en.json +22 -10
- umap/static/umap/locale/en_US.json +21 -9
- umap/static/umap/locale/es.js +243 -227
- umap/static/umap/locale/es.json +21 -9
- umap/static/umap/locale/et.js +243 -227
- umap/static/umap/locale/et.json +21 -9
- umap/static/umap/locale/eu.js +227 -199
- umap/static/umap/locale/eu.json +1 -1
- umap/static/umap/locale/fa_IR.js +243 -227
- umap/static/umap/locale/fa_IR.json +21 -9
- umap/static/umap/locale/fi.js +243 -227
- umap/static/umap/locale/fi.json +21 -9
- umap/static/umap/locale/fr.js +243 -234
- umap/static/umap/locale/fr.json +21 -9
- umap/static/umap/locale/gl.js +243 -227
- umap/static/umap/locale/gl.json +21 -9
- umap/static/umap/locale/he.js +243 -227
- umap/static/umap/locale/he.json +21 -9
- umap/static/umap/locale/hr.js +243 -227
- umap/static/umap/locale/hr.json +21 -9
- umap/static/umap/locale/hu.js +243 -234
- umap/static/umap/locale/hu.json +21 -9
- umap/static/umap/locale/id.js +243 -227
- umap/static/umap/locale/id.json +21 -9
- umap/static/umap/locale/is.js +243 -227
- umap/static/umap/locale/is.json +21 -9
- umap/static/umap/locale/it.js +243 -234
- umap/static/umap/locale/it.json +21 -9
- umap/static/umap/locale/ja.js +243 -227
- umap/static/umap/locale/ja.json +21 -9
- umap/static/umap/locale/ko.js +243 -227
- umap/static/umap/locale/ko.json +21 -9
- umap/static/umap/locale/lt.js +243 -227
- umap/static/umap/locale/lt.json +21 -9
- umap/static/umap/locale/ms.js +243 -234
- umap/static/umap/locale/ms.json +22 -10
- umap/static/umap/locale/nl.js +246 -230
- umap/static/umap/locale/nl.json +21 -9
- umap/static/umap/locale/no.js +243 -227
- umap/static/umap/locale/no.json +21 -9
- umap/static/umap/locale/pl.js +243 -227
- umap/static/umap/locale/pl.json +21 -9
- umap/static/umap/locale/pl_PL.json +21 -9
- umap/static/umap/locale/pt.js +243 -227
- umap/static/umap/locale/pt.json +21 -9
- umap/static/umap/locale/pt_BR.js +243 -227
- umap/static/umap/locale/pt_BR.json +21 -9
- umap/static/umap/locale/pt_PT.js +243 -227
- umap/static/umap/locale/pt_PT.json +21 -9
- umap/static/umap/locale/ro.js +243 -227
- umap/static/umap/locale/ro.json +21 -9
- umap/static/umap/locale/ru.js +243 -227
- umap/static/umap/locale/ru.json +21 -9
- umap/static/umap/locale/si.js +1 -1
- umap/static/umap/locale/si.json +1 -1
- umap/static/umap/locale/sk_SK.js +243 -227
- umap/static/umap/locale/sk_SK.json +21 -9
- umap/static/umap/locale/sl.js +243 -227
- umap/static/umap/locale/sl.json +21 -9
- umap/static/umap/locale/sr.js +243 -227
- umap/static/umap/locale/sr.json +21 -9
- umap/static/umap/locale/sv.js +243 -227
- umap/static/umap/locale/sv.json +21 -9
- umap/static/umap/locale/th_TH.js +243 -227
- umap/static/umap/locale/th_TH.json +21 -9
- umap/static/umap/locale/tr.js +243 -227
- umap/static/umap/locale/tr.json +21 -9
- umap/static/umap/locale/uk_UA.js +243 -227
- umap/static/umap/locale/uk_UA.json +21 -9
- umap/static/umap/locale/vi.js +243 -227
- umap/static/umap/locale/vi.json +21 -9
- umap/static/umap/locale/vi_VN.json +21 -9
- umap/static/umap/locale/zh.js +243 -227
- umap/static/umap/locale/zh.json +21 -9
- umap/static/umap/locale/zh_CN.json +21 -9
- umap/static/umap/locale/zh_TW.Big5.json +21 -9
- umap/static/umap/locale/zh_TW.js +243 -234
- umap/static/umap/locale/zh_TW.json +21 -9
- umap/static/umap/map.css +124 -264
- umap/static/umap/test/DataLayer.js +463 -0
- umap/static/umap/test/Feature.js +0 -226
- umap/static/umap/test/TableEditor.js +104 -0
- umap/static/umap/test/Util.js +0 -521
- umap/static/umap/test/index.html +0 -1
- umap/static/umap/unittests/URLs.js +1 -1
- umap/static/umap/unittests/utils.js +610 -0
- umap/static/umap/vars.css +9 -0
- umap/static/umap/vendors/dompurify/purify.es.mjs +1525 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +1 -0
- umap/static/umap/vendors/iconlayers/iconLayers.js +1 -1
- umap/templates/umap/css.html +2 -0
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +4 -0
- umap/templates/umap/map_table.html +12 -10
- umap/templatetags/umap_tags.py +5 -0
- umap/tests/integration/conftest.py +12 -1
- umap/tests/integration/test_anonymous_owned_map.py +27 -5
- umap/tests/integration/test_basics.py +21 -0
- umap/tests/integration/test_browser.py +12 -25
- umap/tests/integration/test_choropleth.py +1 -1
- umap/tests/integration/test_dashboard.py +10 -0
- umap/tests/integration/test_datalayer.py +8 -6
- umap/tests/integration/test_edit_datalayer.py +24 -19
- umap/tests/integration/test_edit_map.py +189 -2
- umap/tests/integration/test_edit_marker.py +120 -0
- umap/tests/integration/test_edit_polygon.py +122 -0
- umap/tests/integration/test_facets_browser.py +104 -14
- umap/tests/integration/test_import.py +72 -20
- umap/tests/integration/test_map.py +19 -17
- umap/tests/integration/test_map_list.py +28 -0
- umap/tests/integration/test_owned_map.py +10 -10
- umap/tests/integration/test_picto.py +5 -5
- umap/tests/integration/test_querystring.py +9 -15
- umap/tests/integration/test_slideshow.py +0 -5
- umap/tests/integration/test_statics.py +3 -2
- umap/tests/integration/test_tableeditor.py +1 -5
- umap/tests/integration/test_tilelayer.py +10 -0
- umap/tests/integration/test_view_marker.py +64 -0
- umap/tests/integration/test_view_polygon.py +59 -0
- umap/tests/integration/test_view_polyline.py +51 -0
- umap/tests/test_map_views.py +13 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0.dist-info}/METADATA +12 -12
- {umap_project-2.1.3.dist-info → umap_project-2.2.0.dist-info}/RECORD +198 -182
- {umap_project-2.1.3.dist-info → umap_project-2.2.0.dist-info}/WHEEL +1 -1
- umap/static/umap/vendors/dompurify/purify.min.js +0 -3
- umap/static/umap/vendors/dompurify/purify.min.js.map +0 -1
- /umap/tests/integration/{test_polygon.py → test_draw_polygon.py} +0 -0
- /umap/tests/integration/{test_polyline.py → test_draw_polyline.py} +0 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
|
+
|
|
3
|
+
export default class Orderable {
|
|
4
|
+
constructor(parent, onDrop, selector = '.orderable') {
|
|
5
|
+
this.parent = parent
|
|
6
|
+
this.onCommit = onDrop
|
|
7
|
+
this.src = null
|
|
8
|
+
this.dst = null
|
|
9
|
+
this.els = this.parent.querySelectorAll(selector)
|
|
10
|
+
for (let i = 0; i < this.els.length; i++) this.makeDraggable(this.els[i])
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
makeDraggable(node) {
|
|
14
|
+
node.draggable = true
|
|
15
|
+
DomEvent.on(node, 'dragstart', this.onDragStart, this)
|
|
16
|
+
DomEvent.on(node, 'dragenter', this.onDragEnter, this)
|
|
17
|
+
DomEvent.on(node, 'dragover', this.onDragOver, this)
|
|
18
|
+
DomEvent.on(node, 'dragleave', this.onDragLeave, this)
|
|
19
|
+
DomEvent.on(node, 'drop', this.onDrop, this)
|
|
20
|
+
DomEvent.on(node, 'dragend', this.onDragEnd, this)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nodeIndex(node) {
|
|
24
|
+
return Array.prototype.indexOf.call(this.parent.children, node)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
findTarget(node) {
|
|
28
|
+
while (node) {
|
|
29
|
+
if (this.nodeIndex(node) !== -1) return node
|
|
30
|
+
node = node.parentNode
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onDragStart(e) {
|
|
35
|
+
// e.target is the source node.
|
|
36
|
+
const realSrc = document.elementFromPoint(e.clientX, e.clientY);
|
|
37
|
+
// Only allow drag from the handle
|
|
38
|
+
if (!realSrc.classList.contains('icon-drag')) {
|
|
39
|
+
e.preventDefault()
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
this.src = e.target
|
|
43
|
+
this.initialIndex = this.nodeIndex(this.src)
|
|
44
|
+
this.src.classList.add('ordering')
|
|
45
|
+
e.dataTransfer.effectAllowed = 'move'
|
|
46
|
+
e.dataTransfer.setData('text/html', this.src.innerHTML)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onDragOver(e) {
|
|
50
|
+
DomEvent.stop(e)
|
|
51
|
+
if (e.preventDefault) e.preventDefault() // Necessary. Allows us to drop.
|
|
52
|
+
e.dataTransfer.dropEffect = 'move'
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onDragEnter(e) {
|
|
57
|
+
DomEvent.stop(e)
|
|
58
|
+
// e.target is the current hover target.
|
|
59
|
+
const dst = this.findTarget(e.target)
|
|
60
|
+
if (!dst || dst === this.src) return
|
|
61
|
+
this.dst = dst
|
|
62
|
+
const targetIndex = this.nodeIndex(this.dst),
|
|
63
|
+
srcIndex = this.nodeIndex(this.src)
|
|
64
|
+
if (targetIndex > srcIndex) this.parent.insertBefore(this.dst, this.src)
|
|
65
|
+
else this.parent.insertBefore(this.src, this.dst)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onDragLeave(e) {
|
|
69
|
+
// e.target is previous target element.
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onDrop(e) {
|
|
73
|
+
// e.target is current target element.
|
|
74
|
+
if (e.stopPropagation) e.stopPropagation() // Stops the browser from redirecting.
|
|
75
|
+
if (!this.dst) return
|
|
76
|
+
this.onCommit(this.src, this.dst, this.initialIndex, this.nodeIndex(this.src))
|
|
77
|
+
return false
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onDragEnd(e) {
|
|
81
|
+
// e.target is the source node.
|
|
82
|
+
this.src.classList.remove('ordering')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DomUtil, DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
|
+
import { translate } from './i18n.js'
|
|
3
|
+
|
|
4
|
+
export class Panel {
|
|
5
|
+
constructor(map) {
|
|
6
|
+
this.parent = map._controlContainer
|
|
7
|
+
this.map = map
|
|
8
|
+
this.container = DomUtil.create('div', '', this.parent)
|
|
9
|
+
this.mode = 'condensed'
|
|
10
|
+
this.classname = 'left'
|
|
11
|
+
DomEvent.disableClickPropagation(this.container)
|
|
12
|
+
DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu.
|
|
13
|
+
DomEvent.on(this.container, 'wheel', DomEvent.stopPropagation)
|
|
14
|
+
DomEvent.on(this.container, 'MozMousePixelScroll', DomEvent.stopPropagation)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
open({ content, className, actions = [] } = {}) {
|
|
18
|
+
this.container.className = `with-transition panel ${this.classname} ${this.mode}`
|
|
19
|
+
this.container.innerHTML = ''
|
|
20
|
+
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
|
|
21
|
+
const body = DomUtil.create('div', 'body', this.container)
|
|
22
|
+
body.appendChild(content)
|
|
23
|
+
const closeLink = DomUtil.create('li', 'umap-close-link', actionsContainer)
|
|
24
|
+
DomUtil.add('i', 'icon icon-16 icon-close', closeLink)
|
|
25
|
+
closeLink.title = translate('Close')
|
|
26
|
+
const resizeLink = DomUtil.create('li', 'umap-resize-link', actionsContainer)
|
|
27
|
+
DomUtil.add('i', 'icon icon-16 icon-resize', resizeLink)
|
|
28
|
+
resizeLink.title = translate('Toggle size')
|
|
29
|
+
for (let action of actions) {
|
|
30
|
+
actionsContainer.appendChild(action)
|
|
31
|
+
}
|
|
32
|
+
if (className) DomUtil.addClass(body, className)
|
|
33
|
+
const promise = new Promise((resolve, reject) => {
|
|
34
|
+
DomUtil.addClass(this.container, 'on')
|
|
35
|
+
resolve()
|
|
36
|
+
})
|
|
37
|
+
DomEvent.on(closeLink, 'click', this.close, this)
|
|
38
|
+
DomEvent.on(resizeLink, 'click', this.resize, this)
|
|
39
|
+
return promise
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
resize() {
|
|
43
|
+
if (this.mode === 'expanded') {
|
|
44
|
+
this.mode = 'condensed'
|
|
45
|
+
this.container.classList.remove('expanded')
|
|
46
|
+
this.container.classList.add('condensed')
|
|
47
|
+
} else {
|
|
48
|
+
this.mode = 'expanded'
|
|
49
|
+
this.container.classList.remove('condensed')
|
|
50
|
+
this.container.classList.add('expanded')
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
close() {
|
|
55
|
+
if (DomUtil.hasClass(this.container, 'on')) {
|
|
56
|
+
DomUtil.removeClass(this.container, 'on')
|
|
57
|
+
this.map.invalidateSize({ pan: false })
|
|
58
|
+
this.map.editedFeature = null
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class EditPanel extends Panel {
|
|
64
|
+
constructor(map) {
|
|
65
|
+
super(map)
|
|
66
|
+
this.classname = 'right dark'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export class FullPanel extends Panel {
|
|
71
|
+
constructor(map) {
|
|
72
|
+
super(map)
|
|
73
|
+
this.classname = 'full dark'
|
|
74
|
+
this.mode = 'expanded'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -128,7 +128,6 @@ export class ServerRequest extends Request {
|
|
|
128
128
|
const data = await response.json()
|
|
129
129
|
if (data.info) {
|
|
130
130
|
this.ui.alert({ content: data.info, level: 'info' })
|
|
131
|
-
this.ui.closePanel()
|
|
132
131
|
} else if (data.error) {
|
|
133
132
|
this.ui.alert({ content: data.error, level: 'error' })
|
|
134
133
|
return this._onError(new Error(data.error))
|