umap-project 1.14.0a5__py3-none-any.whl → 2.0.0a0__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/decorators.py +0 -14
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +137 -85
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +136 -84
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +136 -84
- umap/locale/en/LC_MESSAGES/django.po +128 -88
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +136 -84
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +131 -91
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +137 -85
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +136 -84
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +136 -84
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +136 -84
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +135 -83
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +143 -91
- umap/models.py +23 -1
- umap/settings/__init__.py +1 -4
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +5 -0
- umap/static/umap/content.css +185 -13
- umap/static/umap/favicons/icon.svg +2 -2
- umap/static/umap/img/edit.svg +3 -3
- umap/static/umap/img/icon-delete.svg +4 -0
- umap/static/umap/img/icon-download.svg +13 -0
- umap/static/umap/img/icon-duplicate.svg +5 -0
- umap/static/umap/img/icon-edit.svg +12 -0
- umap/static/umap/img/icon-share.svg +11 -0
- umap/static/umap/img/icon-view.svg +12 -0
- umap/static/umap/img/logo.svg +2 -2
- umap/static/umap/img/logo_small.svg +2 -2
- umap/static/umap/img/marker.svg +4 -0
- umap/static/umap/img/opensource.svg +2 -2
- umap/static/umap/img/osm.svg +2 -2
- umap/static/umap/js/components/fragment.js +1 -1
- umap/static/umap/js/modules/browser.js +159 -0
- umap/static/umap/js/modules/global.js +3 -1
- umap/static/umap/js/modules/request.js +155 -0
- umap/static/umap/js/umap.autocomplete.js +28 -38
- umap/static/umap/js/umap.controls.js +73 -58
- umap/static/umap/js/umap.core.js +4 -9
- umap/static/umap/js/umap.datalayer.permissions.js +13 -12
- umap/static/umap/js/umap.features.js +51 -49
- umap/static/umap/js/umap.forms.js +19 -19
- umap/static/umap/js/umap.icon.js +17 -17
- umap/static/umap/js/umap.importer.js +2 -1
- umap/static/umap/js/umap.js +242 -291
- umap/static/umap/js/umap.layer.js +173 -141
- umap/static/umap/js/umap.permissions.js +24 -25
- umap/static/umap/js/umap.popup.js +14 -14
- umap/static/umap/js/umap.share.js +4 -4
- umap/static/umap/js/umap.slideshow.js +4 -4
- umap/static/umap/js/umap.tableeditor.js +2 -2
- umap/static/umap/js/umap.ui.js +1 -1
- umap/static/umap/locale/am_ET.js +1 -11
- umap/static/umap/locale/am_ET.json +1 -11
- umap/static/umap/locale/ar.js +1 -11
- umap/static/umap/locale/ar.json +1 -11
- umap/static/umap/locale/ast.js +1 -11
- umap/static/umap/locale/ast.json +1 -11
- umap/static/umap/locale/bg.js +1 -11
- umap/static/umap/locale/bg.json +1 -11
- umap/static/umap/locale/br.js +1 -11
- umap/static/umap/locale/br.json +1 -11
- umap/static/umap/locale/ca.js +1 -11
- umap/static/umap/locale/ca.json +1 -11
- umap/static/umap/locale/cs_CZ.js +1 -11
- umap/static/umap/locale/cs_CZ.json +1 -11
- umap/static/umap/locale/da.js +1 -11
- umap/static/umap/locale/da.json +1 -11
- umap/static/umap/locale/de.js +1 -11
- umap/static/umap/locale/de.json +1 -11
- umap/static/umap/locale/el.js +1 -11
- umap/static/umap/locale/el.json +1 -11
- umap/static/umap/locale/en.js +1 -11
- umap/static/umap/locale/en.json +1 -11
- umap/static/umap/locale/en_US.json +1 -11
- umap/static/umap/locale/es.js +1 -11
- umap/static/umap/locale/es.json +1 -11
- umap/static/umap/locale/et.js +1 -11
- umap/static/umap/locale/et.json +1 -11
- umap/static/umap/locale/fa_IR.js +6 -16
- umap/static/umap/locale/fa_IR.json +6 -16
- umap/static/umap/locale/fi.js +1 -11
- umap/static/umap/locale/fi.json +1 -11
- umap/static/umap/locale/fr.js +1 -11
- umap/static/umap/locale/fr.json +1 -11
- umap/static/umap/locale/gl.js +1 -11
- umap/static/umap/locale/gl.json +1 -11
- umap/static/umap/locale/he.js +1 -11
- umap/static/umap/locale/he.json +1 -11
- umap/static/umap/locale/hr.js +1 -11
- umap/static/umap/locale/hr.json +1 -11
- umap/static/umap/locale/hu.js +1 -11
- umap/static/umap/locale/hu.json +1 -11
- umap/static/umap/locale/id.js +1 -11
- umap/static/umap/locale/id.json +1 -11
- umap/static/umap/locale/is.js +1 -11
- umap/static/umap/locale/is.json +1 -11
- umap/static/umap/locale/it.js +1 -11
- umap/static/umap/locale/it.json +1 -11
- umap/static/umap/locale/ja.js +1 -11
- umap/static/umap/locale/ja.json +1 -11
- umap/static/umap/locale/ko.js +1 -11
- umap/static/umap/locale/ko.json +1 -11
- umap/static/umap/locale/lt.js +1 -11
- umap/static/umap/locale/lt.json +1 -11
- umap/static/umap/locale/ms.js +1 -11
- umap/static/umap/locale/ms.json +1 -11
- umap/static/umap/locale/nl.js +1 -11
- umap/static/umap/locale/nl.json +1 -11
- umap/static/umap/locale/no.js +1 -11
- umap/static/umap/locale/no.json +1 -11
- umap/static/umap/locale/pl.js +1 -11
- umap/static/umap/locale/pl.json +1 -11
- umap/static/umap/locale/pl_PL.json +1 -11
- umap/static/umap/locale/pt.js +1 -11
- umap/static/umap/locale/pt.json +1 -11
- umap/static/umap/locale/pt_BR.js +1 -11
- umap/static/umap/locale/pt_BR.json +1 -11
- umap/static/umap/locale/pt_PT.js +1 -11
- umap/static/umap/locale/pt_PT.json +1 -11
- umap/static/umap/locale/ro.js +1 -11
- umap/static/umap/locale/ro.json +1 -11
- umap/static/umap/locale/ru.js +1 -11
- umap/static/umap/locale/ru.json +1 -11
- umap/static/umap/locale/sk_SK.js +1 -11
- umap/static/umap/locale/sk_SK.json +1 -11
- umap/static/umap/locale/sl.js +1 -11
- umap/static/umap/locale/sl.json +1 -11
- umap/static/umap/locale/sr.js +1 -11
- umap/static/umap/locale/sr.json +1 -11
- umap/static/umap/locale/sv.js +1 -11
- umap/static/umap/locale/sv.json +1 -11
- umap/static/umap/locale/th_TH.js +1 -11
- umap/static/umap/locale/th_TH.json +1 -11
- umap/static/umap/locale/tr.js +1 -11
- umap/static/umap/locale/tr.json +1 -11
- umap/static/umap/locale/uk_UA.js +1 -11
- umap/static/umap/locale/uk_UA.json +1 -11
- umap/static/umap/locale/vi.js +1 -11
- umap/static/umap/locale/vi.json +1 -11
- umap/static/umap/locale/vi_VN.json +1 -11
- umap/static/umap/locale/zh.js +1 -11
- umap/static/umap/locale/zh.json +1 -11
- umap/static/umap/locale/zh_CN.json +1 -11
- umap/static/umap/locale/zh_TW.Big5.json +1 -11
- umap/static/umap/locale/zh_TW.js +17 -27
- umap/static/umap/locale/zh_TW.json +17 -27
- umap/static/umap/map.css +2 -2
- umap/static/umap/nav.css +2 -1
- umap/static/umap/test/.eslintrc +0 -1
- umap/static/umap/test/Choropleth.js +29 -27
- umap/static/umap/test/DataLayer.js +207 -239
- umap/static/umap/test/Feature.js +33 -58
- umap/static/umap/test/Map.Export.js +11 -11
- umap/static/umap/test/Map.js +66 -67
- umap/static/umap/test/Marker.js +36 -32
- umap/static/umap/test/Polygon.js +95 -95
- umap/static/umap/test/Polyline.js +31 -31
- umap/static/umap/test/TableEditor.js +29 -25
- umap/static/umap/test/_pre.js +2 -7
- umap/static/umap/test/index.html +4 -4
- umap/static/umap/vendors/contextmenu/leaflet.contextmenu.css +54 -0
- umap/static/umap/vendors/contextmenu/leaflet.contextmenu.js +586 -0
- umap/static/umap/vendors/csv2geojson/index.js +259 -0
- umap/static/umap/vendors/dompurify/purify.js +1633 -0
- umap/static/umap/vendors/locatecontrol/L.Control.Locate.css +63 -0
- umap/static/umap/vendors/locatecontrol/L.Control.Locate.js +950 -0
- umap/static/umap/vendors/minimap/Control.MiniMap.css +88 -0
- umap/static/umap/vendors/minimap/Control.MiniMap.js +352 -0
- umap/static/umap/vendors/togeojson/togeojson.js +2 -0
- umap/templates/auth/user_form.html +3 -2
- umap/templates/base.html +1 -0
- umap/templates/registration/login.html +51 -36
- umap/templates/umap/about_summary.html +1 -1
- umap/templates/umap/branding.html +3 -0
- umap/templates/umap/content.html +15 -39
- umap/templates/umap/header.html +0 -0
- umap/templates/umap/home.html +4 -2
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +9 -0
- umap/templates/umap/map_init.html +1 -1
- umap/templates/umap/map_messages.html +4 -2
- umap/templates/umap/map_table.html +130 -69
- umap/templates/umap/navigation.html +2 -4
- umap/templates/umap/user_dashboard.html +29 -6
- umap/tests/base.py +1 -1
- umap/tests/integration/conftest.py +18 -0
- umap/tests/integration/test_anonymous_owned_map.py +6 -3
- umap/tests/integration/test_browser.py +166 -6
- umap/tests/integration/test_collaborative_editing.py +23 -5
- umap/tests/integration/test_dashboard.py +17 -0
- umap/tests/integration/test_edit_datalayer.py +4 -3
- umap/tests/integration/test_export_map.py +1 -1
- umap/tests/integration/test_import.py +9 -4
- umap/tests/integration/test_map.py +64 -0
- umap/tests/integration/test_map_preview.py +75 -0
- umap/tests/integration/test_owned_map.py +11 -25
- umap/tests/integration/test_picto.py +3 -3
- umap/tests/integration/test_querystring.py +52 -0
- umap/tests/integration/test_share.py +22 -0
- umap/tests/test_map_views.py +157 -14
- umap/tests/test_views.py +50 -11
- umap/urls.py +6 -12
- umap/views.py +170 -47
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/METADATA +13 -15
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/RECORD +220 -199
- umap/static/umap/js/umap.browser.js +0 -148
- umap/static/umap/js/umap.xhr.js +0 -304
- umap/static/umap/test/Controls.js +0 -100
- umap/static/umap/test/Map.Init.js +0 -46
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/WHEEL +0 -0
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/entry_points.txt +0 -0
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Uses `L._`` from Leaflet.i18n which we cannot import as a module yet
|
|
2
|
+
import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
3
|
+
|
|
4
|
+
export class RequestError extends Error {}
|
|
5
|
+
|
|
6
|
+
export class HTTPError extends RequestError {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message)
|
|
9
|
+
this.name = this.constructor.name
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class NOKError extends RequestError {
|
|
14
|
+
constructor(response) {
|
|
15
|
+
super(response.status)
|
|
16
|
+
this.response = response
|
|
17
|
+
this.status = response.status
|
|
18
|
+
this.name = this.constructor.name
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class BaseRequest {
|
|
23
|
+
async _fetch(method, uri, headers, data) {
|
|
24
|
+
let response
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
response = await fetch(uri, {
|
|
28
|
+
method: method,
|
|
29
|
+
mode: 'cors',
|
|
30
|
+
headers: headers,
|
|
31
|
+
body: data,
|
|
32
|
+
})
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error(error)
|
|
35
|
+
throw new HTTPError(error.message)
|
|
36
|
+
}
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new NOKError(response)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return response
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Basic class to issue request
|
|
46
|
+
// It returns a response, or null in case of error
|
|
47
|
+
// In case of error, an alert is sent, but non 20X status are not handled
|
|
48
|
+
// The consumer must check the response status by hand
|
|
49
|
+
export class Request extends BaseRequest {
|
|
50
|
+
constructor(ui) {
|
|
51
|
+
super()
|
|
52
|
+
this.ui = ui
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async _fetch(method, uri, headers, data) {
|
|
56
|
+
const id = Math.random()
|
|
57
|
+
this.ui.fire('dataloading', { id: id })
|
|
58
|
+
try {
|
|
59
|
+
const response = await BaseRequest.prototype._fetch.call(
|
|
60
|
+
this,
|
|
61
|
+
method,
|
|
62
|
+
uri,
|
|
63
|
+
headers,
|
|
64
|
+
data
|
|
65
|
+
)
|
|
66
|
+
return response
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (error instanceof NOKError) return this._onNOK(error)
|
|
69
|
+
return this._onError(error)
|
|
70
|
+
} finally {
|
|
71
|
+
this.ui.fire('dataload', { id: id })
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async get(uri, headers) {
|
|
76
|
+
return await this._fetch('GET', uri, headers)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async post(uri, headers, data) {
|
|
80
|
+
return await this._fetch('POST', uri, headers, data)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_onError(error) {
|
|
84
|
+
this.ui.alert({ content: L._('Problem in the response'), level: 'error' })
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_onNOK(error) {
|
|
88
|
+
this._onError(error)
|
|
89
|
+
return error.response
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Adds uMap specifics to requests handling
|
|
94
|
+
// like logging, CSRF, etc.
|
|
95
|
+
// It expects only json responses.
|
|
96
|
+
// Returns an array of three elements: [data, response, error]
|
|
97
|
+
// The consumer must check the error to proceed or not with using the data or response
|
|
98
|
+
export class ServerRequest extends Request {
|
|
99
|
+
async _fetch(method, uri, headers, data) {
|
|
100
|
+
// Add a flag so backend can know we are in ajax and adapt the response
|
|
101
|
+
// See is_ajax in utils.py
|
|
102
|
+
headers = headers || {}
|
|
103
|
+
headers['X-Requested-With'] = 'XMLHttpRequest'
|
|
104
|
+
return await Request.prototype._fetch.call(this, method, uri, headers, data)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async post(uri, headers, data) {
|
|
108
|
+
const token = document.cookie.replace(
|
|
109
|
+
/(?:(?:^|.*;\s*)csrftoken\s*\=\s*([^;]*).*$)|^.*$/,
|
|
110
|
+
'$1'
|
|
111
|
+
)
|
|
112
|
+
if (token) {
|
|
113
|
+
headers = headers || {}
|
|
114
|
+
headers['X-CSRFToken'] = token
|
|
115
|
+
}
|
|
116
|
+
const response = await Request.prototype.post.call(this, uri, headers, data)
|
|
117
|
+
return await this._as_json(response)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async get(uri, headers) {
|
|
121
|
+
const response = await Request.prototype.get.call(this, uri, headers)
|
|
122
|
+
return await this._as_json(response)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async _as_json(response) {
|
|
126
|
+
if (Array.isArray(response)) return response
|
|
127
|
+
try {
|
|
128
|
+
const data = await response.json()
|
|
129
|
+
if (data.info) {
|
|
130
|
+
this.ui.alert({ content: data.info, level: 'info' })
|
|
131
|
+
this.ui.closePanel()
|
|
132
|
+
} else if (data.error) {
|
|
133
|
+
this.ui.alert({ content: data.error, level: 'error' })
|
|
134
|
+
return this._onError(new Error(data.error))
|
|
135
|
+
}
|
|
136
|
+
return [data, response, null]
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return this._onError(error)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_onError(error) {
|
|
143
|
+
return [{}, null, error]
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
_onNOK(error) {
|
|
147
|
+
if (error.status === 403) {
|
|
148
|
+
this.ui.alert({
|
|
149
|
+
content: message || L._('Action not allowed :('),
|
|
150
|
+
level: 'error',
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
return [{}, error.response, error]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
U.AutoComplete = L.Class.extend({
|
|
2
2
|
options: {
|
|
3
3
|
placeholder: 'Start typing...',
|
|
4
4
|
emptyMessage: 'No result',
|
|
@@ -12,8 +12,8 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
12
12
|
|
|
13
13
|
initialize: function (el, options) {
|
|
14
14
|
this.el = el
|
|
15
|
-
const ui = new
|
|
16
|
-
this.
|
|
15
|
+
const ui = new U.UI(document.querySelector('header'))
|
|
16
|
+
this.server = new U.ServerRequest(ui)
|
|
17
17
|
L.setOptions(this, options)
|
|
18
18
|
let CURRENT = null
|
|
19
19
|
try {
|
|
@@ -69,19 +69,19 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
69
69
|
|
|
70
70
|
onKeyDown: function (e) {
|
|
71
71
|
switch (e.keyCode) {
|
|
72
|
-
case
|
|
72
|
+
case U.Keys.TAB:
|
|
73
73
|
if (this.CURRENT !== null) this.setChoice()
|
|
74
74
|
L.DomEvent.stop(e)
|
|
75
75
|
break
|
|
76
|
-
case
|
|
76
|
+
case U.Keys.ENTER:
|
|
77
77
|
L.DomEvent.stop(e)
|
|
78
78
|
this.setChoice()
|
|
79
79
|
break
|
|
80
|
-
case
|
|
80
|
+
case U.Keys.ESC:
|
|
81
81
|
L.DomEvent.stop(e)
|
|
82
82
|
this.hide()
|
|
83
83
|
break
|
|
84
|
-
case
|
|
84
|
+
case U.Keys.DOWN:
|
|
85
85
|
if (this.RESULTS.length > 0) {
|
|
86
86
|
if (this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) {
|
|
87
87
|
// what if one result?
|
|
@@ -93,7 +93,7 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
break
|
|
96
|
-
case
|
|
96
|
+
case U.Keys.UP:
|
|
97
97
|
if (this.CURRENT !== null) {
|
|
98
98
|
L.DomEvent.stop(e)
|
|
99
99
|
}
|
|
@@ -112,16 +112,16 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
112
112
|
|
|
113
113
|
onKeyUp: function (e) {
|
|
114
114
|
const special = [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
U.Keys.TAB,
|
|
116
|
+
U.Keys.ENTER,
|
|
117
|
+
U.Keys.LEFT,
|
|
118
|
+
U.Keys.RIGHT,
|
|
119
|
+
U.Keys.DOWN,
|
|
120
|
+
U.Keys.UP,
|
|
121
|
+
U.Keys.APPLE,
|
|
122
|
+
U.Keys.SHIFT,
|
|
123
|
+
U.Keys.ALT,
|
|
124
|
+
U.Keys.CTRL,
|
|
125
125
|
]
|
|
126
126
|
if (special.indexOf(e.keyCode) === -1) {
|
|
127
127
|
this.search()
|
|
@@ -158,21 +158,19 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
|
|
161
|
-
search: function () {
|
|
162
|
-
|
|
161
|
+
search: async function () {
|
|
162
|
+
let val = this.input.value
|
|
163
163
|
if (val.length < this.options.minChar) {
|
|
164
164
|
this.clear()
|
|
165
165
|
return
|
|
166
166
|
}
|
|
167
167
|
if (`${val}` === `${this.CACHE}`) return
|
|
168
168
|
else this.CACHE = val
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.handleResults(data.data)
|
|
173
|
-
},
|
|
174
|
-
this
|
|
169
|
+
val = val.toLowerCase()
|
|
170
|
+
const [{ data }, response] = await this.server.get(
|
|
171
|
+
`/agnocomplete/AutocompleteUser/?q=${encodeURIComponent(val)}`
|
|
175
172
|
)
|
|
173
|
+
this.handleResults(data)
|
|
176
174
|
},
|
|
177
175
|
|
|
178
176
|
createResult: function (item) {
|
|
@@ -257,9 +255,9 @@ L.U.AutoComplete = L.Class.extend({
|
|
|
257
255
|
},
|
|
258
256
|
})
|
|
259
257
|
|
|
260
|
-
|
|
258
|
+
U.AutoComplete.Ajax = U.AutoComplete.extend({
|
|
261
259
|
initialize: function (el, options) {
|
|
262
|
-
|
|
260
|
+
U.AutoComplete.prototype.initialize.call(this, el, options)
|
|
263
261
|
if (!this.el) return this
|
|
264
262
|
this.createInput()
|
|
265
263
|
this.createContainer()
|
|
@@ -272,17 +270,9 @@ L.U.AutoComplete.Ajax = L.U.AutoComplete.extend({
|
|
|
272
270
|
label: option.innerHTML,
|
|
273
271
|
}
|
|
274
272
|
},
|
|
275
|
-
|
|
276
|
-
_do_search: function (val, callback, context) {
|
|
277
|
-
val = val.toLowerCase()
|
|
278
|
-
this.xhr.get(`/agnocomplete/AutocompleteUser/?q=${encodeURIComponent(val)}`, {
|
|
279
|
-
callback: callback,
|
|
280
|
-
context: context || this,
|
|
281
|
-
})
|
|
282
|
-
},
|
|
283
273
|
})
|
|
284
274
|
|
|
285
|
-
|
|
275
|
+
U.AutoComplete.Ajax.SelectMultiple = U.AutoComplete.Ajax.extend({
|
|
286
276
|
initSelectedContainer: function () {
|
|
287
277
|
return L.DomUtil.after(
|
|
288
278
|
this.input,
|
|
@@ -308,7 +298,7 @@ L.U.AutoComplete.Ajax.SelectMultiple = L.U.AutoComplete.Ajax.extend({
|
|
|
308
298
|
},
|
|
309
299
|
})
|
|
310
300
|
|
|
311
|
-
|
|
301
|
+
U.AutoComplete.Ajax.Select = U.AutoComplete.Ajax.extend({
|
|
312
302
|
initSelectedContainer: function () {
|
|
313
303
|
return L.DomUtil.after(
|
|
314
304
|
this.input,
|