umap-project 1.14.0a1__py3-none-any.whl → 1.14.0a2__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/static/.gitignore +0 -0
- umap/static/umap/base.css +994 -0
- umap/static/umap/bitbucket.png +0 -0
- umap/static/umap/content.css +395 -0
- umap/static/umap/favicons/apple-touch-icon.png +0 -0
- umap/static/umap/favicons/favicon.ico +0 -0
- umap/static/umap/favicons/icon-192.png +0 -0
- umap/static/umap/favicons/icon-512.png +0 -0
- umap/static/umap/favicons/icon.svg +5 -0
- umap/static/umap/font/FiraSans-Light.woff +0 -0
- umap/static/umap/font/FiraSans-Light.woff2 +0 -0
- umap/static/umap/font/FiraSans-LightItalic.woff +0 -0
- umap/static/umap/font/FiraSans-LightItalic.woff2 +0 -0
- umap/static/umap/font/FiraSans-SemiBold.woff +0 -0
- umap/static/umap/font/FiraSans-SemiBold.woff2 +0 -0
- umap/static/umap/font.css +33 -0
- umap/static/umap/github.png +0 -0
- umap/static/umap/img/16-white.svg +190 -0
- umap/static/umap/img/16.svg +182 -0
- umap/static/umap/img/24-white.svg +62 -0
- umap/static/umap/img/24.svg +90 -0
- umap/static/umap/img/edit.svg +7 -0
- umap/static/umap/img/icon-bg.png +0 -0
- umap/static/umap/img/logo.svg +4 -0
- umap/static/umap/img/logo_filigree.png +0 -0
- umap/static/umap/img/logo_small.svg +14 -0
- umap/static/umap/img/marker.png +0 -0
- umap/static/umap/img/opensource.svg +7 -0
- umap/static/umap/img/osm.svg +7 -0
- umap/static/umap/img/search.gif +0 -0
- umap/static/umap/img/source/16-white.svg +980 -0
- umap/static/umap/img/source/16.svg +201 -0
- umap/static/umap/img/source/24-white.svg +83 -0
- umap/static/umap/img/source/24.svg +110 -0
- umap/static/umap/js/components/fragment.js +13 -0
- umap/static/umap/js/modules/global.js +8 -0
- umap/static/umap/js/modules/urls.js +29 -0
- umap/static/umap/js/umap.autocomplete.js +336 -0
- umap/static/umap/js/umap.browser.js +148 -0
- umap/static/umap/js/umap.controls.js +1542 -0
- umap/static/umap/js/umap.core.js +851 -0
- umap/static/umap/js/umap.datalayer.permissions.js +72 -0
- umap/static/umap/js/umap.features.js +1216 -0
- umap/static/umap/js/umap.forms.js +1267 -0
- umap/static/umap/js/umap.icon.js +234 -0
- umap/static/umap/js/umap.importer.js +166 -0
- umap/static/umap/js/umap.js +2010 -0
- umap/static/umap/js/umap.layer.js +1636 -0
- umap/static/umap/js/umap.permissions.js +212 -0
- umap/static/umap/js/umap.popup.js +340 -0
- umap/static/umap/js/umap.share.js +254 -0
- umap/static/umap/js/umap.slideshow.js +165 -0
- umap/static/umap/js/umap.tableeditor.js +120 -0
- umap/static/umap/js/umap.ui.js +240 -0
- umap/static/umap/js/umap.xhr.js +304 -0
- umap/static/umap/locale/am_ET.js +447 -0
- umap/static/umap/locale/am_ET.json +445 -0
- umap/static/umap/locale/ar.js +447 -0
- umap/static/umap/locale/ar.json +445 -0
- umap/static/umap/locale/ast.js +447 -0
- umap/static/umap/locale/ast.json +445 -0
- umap/static/umap/locale/bg.js +447 -0
- umap/static/umap/locale/bg.json +445 -0
- umap/static/umap/locale/br.js +447 -0
- umap/static/umap/locale/br.json +445 -0
- umap/static/umap/locale/ca.js +447 -0
- umap/static/umap/locale/ca.json +445 -0
- umap/static/umap/locale/cs_CZ.js +447 -0
- umap/static/umap/locale/cs_CZ.json +445 -0
- umap/static/umap/locale/da.js +447 -0
- umap/static/umap/locale/da.json +445 -0
- umap/static/umap/locale/de.js +447 -0
- umap/static/umap/locale/de.json +445 -0
- umap/static/umap/locale/el.js +447 -0
- umap/static/umap/locale/el.json +445 -0
- umap/static/umap/locale/en.js +447 -0
- umap/static/umap/locale/en.json +445 -0
- umap/static/umap/locale/en_US.json +445 -0
- umap/static/umap/locale/es.js +447 -0
- umap/static/umap/locale/es.json +445 -0
- umap/static/umap/locale/et.js +447 -0
- umap/static/umap/locale/et.json +445 -0
- umap/static/umap/locale/eu.js +413 -0
- umap/static/umap/locale/eu.json +411 -0
- umap/static/umap/locale/fa_IR.js +447 -0
- umap/static/umap/locale/fa_IR.json +445 -0
- umap/static/umap/locale/fi.js +447 -0
- umap/static/umap/locale/fi.json +445 -0
- umap/static/umap/locale/fr.js +447 -0
- umap/static/umap/locale/fr.json +445 -0
- umap/static/umap/locale/gl.js +447 -0
- umap/static/umap/locale/gl.json +445 -0
- umap/static/umap/locale/he.js +447 -0
- umap/static/umap/locale/he.json +445 -0
- umap/static/umap/locale/hr.js +447 -0
- umap/static/umap/locale/hr.json +445 -0
- umap/static/umap/locale/hu.js +447 -0
- umap/static/umap/locale/hu.json +445 -0
- umap/static/umap/locale/id.js +447 -0
- umap/static/umap/locale/id.json +445 -0
- umap/static/umap/locale/is.js +447 -0
- umap/static/umap/locale/is.json +445 -0
- umap/static/umap/locale/it.js +447 -0
- umap/static/umap/locale/it.json +445 -0
- umap/static/umap/locale/ja.js +447 -0
- umap/static/umap/locale/ja.json +445 -0
- umap/static/umap/locale/ko.js +447 -0
- umap/static/umap/locale/ko.json +445 -0
- umap/static/umap/locale/lt.js +447 -0
- umap/static/umap/locale/lt.json +445 -0
- umap/static/umap/locale/ms.js +447 -0
- umap/static/umap/locale/ms.json +445 -0
- umap/static/umap/locale/nl.js +447 -0
- umap/static/umap/locale/nl.json +445 -0
- umap/static/umap/locale/no.js +447 -0
- umap/static/umap/locale/no.json +445 -0
- umap/static/umap/locale/pl.js +447 -0
- umap/static/umap/locale/pl.json +445 -0
- umap/static/umap/locale/pl_PL.json +445 -0
- umap/static/umap/locale/pt.js +447 -0
- umap/static/umap/locale/pt.json +445 -0
- umap/static/umap/locale/pt_BR.js +447 -0
- umap/static/umap/locale/pt_BR.json +445 -0
- umap/static/umap/locale/pt_PT.js +447 -0
- umap/static/umap/locale/pt_PT.json +445 -0
- umap/static/umap/locale/ro.js +447 -0
- umap/static/umap/locale/ro.json +445 -0
- umap/static/umap/locale/ru.js +447 -0
- umap/static/umap/locale/ru.json +445 -0
- umap/static/umap/locale/si.js +439 -0
- umap/static/umap/locale/si.json +437 -0
- umap/static/umap/locale/sk_SK.js +447 -0
- umap/static/umap/locale/sk_SK.json +445 -0
- umap/static/umap/locale/sl.js +447 -0
- umap/static/umap/locale/sl.json +445 -0
- umap/static/umap/locale/sr.js +447 -0
- umap/static/umap/locale/sr.json +445 -0
- umap/static/umap/locale/sv.js +447 -0
- umap/static/umap/locale/sv.json +445 -0
- umap/static/umap/locale/th_TH.js +447 -0
- umap/static/umap/locale/th_TH.json +445 -0
- umap/static/umap/locale/tr.js +447 -0
- umap/static/umap/locale/tr.json +445 -0
- umap/static/umap/locale/uk_UA.js +447 -0
- umap/static/umap/locale/uk_UA.json +445 -0
- umap/static/umap/locale/vi.js +447 -0
- umap/static/umap/locale/vi.json +445 -0
- umap/static/umap/locale/vi_VN.json +445 -0
- umap/static/umap/locale/zh.js +447 -0
- umap/static/umap/locale/zh.json +445 -0
- umap/static/umap/locale/zh_CN.json +445 -0
- umap/static/umap/locale/zh_TW.Big5.json +445 -0
- umap/static/umap/locale/zh_TW.js +447 -0
- umap/static/umap/locale/zh_TW.json +445 -0
- umap/static/umap/map.css +1843 -0
- umap/static/umap/nav.css +81 -0
- umap/static/umap/openstreetmap.png +0 -0
- umap/static/umap/test/.eslintrc +22 -0
- umap/static/umap/test/Choropleth.js +243 -0
- umap/static/umap/test/Controls.js +100 -0
- umap/static/umap/test/DataLayer.js +495 -0
- umap/static/umap/test/Feature.js +382 -0
- umap/static/umap/test/Map.Export.js +106 -0
- umap/static/umap/test/Map.Init.js +46 -0
- umap/static/umap/test/Map.js +342 -0
- umap/static/umap/test/Marker.js +122 -0
- umap/static/umap/test/Permissions.js +74 -0
- umap/static/umap/test/Polygon.js +367 -0
- umap/static/umap/test/Polyline.js +402 -0
- umap/static/umap/test/TableEditor.js +100 -0
- umap/static/umap/test/URLs.js +54 -0
- umap/static/umap/test/Util.js +549 -0
- umap/static/umap/test/_pre.js +460 -0
- umap/static/umap/test/index.html +135 -0
- umap/static/umap/theme.css +1 -0
- umap/static/umap/twitter.png +0 -0
- {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/METADATA +1 -1
- {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/RECORD +182 -6
- {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/WHEEL +0 -0
- {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/entry_points.txt +0 -0
- {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,1267 @@
|
|
|
1
|
+
L.FormBuilder.Element.include({
|
|
2
|
+
undefine: function () {
|
|
3
|
+
L.DomUtil.addClass(this.wrapper, 'undefined')
|
|
4
|
+
this.clear()
|
|
5
|
+
this.sync()
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
getParentNode: function () {
|
|
9
|
+
if (this.options.wrapper) {
|
|
10
|
+
return L.DomUtil.create(
|
|
11
|
+
this.options.wrapper,
|
|
12
|
+
this.options.wrapperClass || '',
|
|
13
|
+
this.form
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
let className = 'formbox'
|
|
17
|
+
if (this.options.inheritable) {
|
|
18
|
+
className +=
|
|
19
|
+
this.get(true) === undefined ? ' inheritable undefined' : ' inheritable '
|
|
20
|
+
}
|
|
21
|
+
className += ` umap-field-${this.name}`
|
|
22
|
+
this.wrapper = L.DomUtil.create('div', className, this.form)
|
|
23
|
+
this.header = L.DomUtil.create('div', 'header', this.wrapper)
|
|
24
|
+
if (this.options.inheritable) {
|
|
25
|
+
const undefine = L.DomUtil.add('a', 'button undefine', this.header, L._('clear'))
|
|
26
|
+
const define = L.DomUtil.add('a', 'button define', this.header, L._('define'))
|
|
27
|
+
L.DomEvent.on(
|
|
28
|
+
define,
|
|
29
|
+
'click',
|
|
30
|
+
function (e) {
|
|
31
|
+
L.DomEvent.stop(e)
|
|
32
|
+
this.fetch()
|
|
33
|
+
this.fire('define')
|
|
34
|
+
L.DomUtil.removeClass(this.wrapper, 'undefined')
|
|
35
|
+
},
|
|
36
|
+
this
|
|
37
|
+
)
|
|
38
|
+
L.DomEvent.on(undefine, 'click', L.DomEvent.stop).on(
|
|
39
|
+
undefine,
|
|
40
|
+
'click',
|
|
41
|
+
this.undefine,
|
|
42
|
+
this
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
this.quickContainer = L.DomUtil.create(
|
|
46
|
+
'span',
|
|
47
|
+
'quick-actions show-on-defined',
|
|
48
|
+
this.header
|
|
49
|
+
)
|
|
50
|
+
this.extendedContainer = L.DomUtil.create('div', 'show-on-defined', this.wrapper)
|
|
51
|
+
return this.extendedContainer
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
getLabelParent: function () {
|
|
55
|
+
return this.header
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
clear: function () {
|
|
59
|
+
this.input.value = ''
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
get: function (own) {
|
|
63
|
+
if (!this.options.inheritable || own) return this.builder.getter(this.field)
|
|
64
|
+
const path = this.field.split('.'),
|
|
65
|
+
key = path[path.length - 1]
|
|
66
|
+
return this.obj.getOption(key)
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
buildLabel: function () {
|
|
70
|
+
if (this.options.label) {
|
|
71
|
+
this.label = L.DomUtil.create('label', '', this.getLabelParent())
|
|
72
|
+
this.label.textContent = this.label.title = this.options.label
|
|
73
|
+
if (this.options.helpEntries)
|
|
74
|
+
this.builder.map.help.button(this.label, this.options.helpEntries)
|
|
75
|
+
else if (this.options.helpTooltip) {
|
|
76
|
+
const info = L.DomUtil.create('i', 'info', this.label)
|
|
77
|
+
L.DomEvent.on(
|
|
78
|
+
info,
|
|
79
|
+
'mouseover',
|
|
80
|
+
function () {
|
|
81
|
+
this.builder.map.ui.tooltip({
|
|
82
|
+
anchor: info,
|
|
83
|
+
content: this.options.helpTooltip,
|
|
84
|
+
position: 'top',
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
this
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
L.FormBuilder.Select.include({
|
|
95
|
+
clear: function () {
|
|
96
|
+
this.select.value = ''
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
getDefault: function () {
|
|
100
|
+
if (this.options.inheritable) return undefined
|
|
101
|
+
return this.getOptions()[0][0]
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
L.FormBuilder.CheckBox.include({
|
|
106
|
+
value: function () {
|
|
107
|
+
return L.DomUtil.hasClass(this.wrapper, 'undefined')
|
|
108
|
+
? undefined
|
|
109
|
+
: this.input.checked
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
clear: function () {
|
|
113
|
+
this.fetch()
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
L.FormBuilder.ColorPicker = L.FormBuilder.Input.extend({
|
|
118
|
+
colors: [
|
|
119
|
+
'Black',
|
|
120
|
+
'Navy',
|
|
121
|
+
'DarkBlue',
|
|
122
|
+
'MediumBlue',
|
|
123
|
+
'Blue',
|
|
124
|
+
'DarkGreen',
|
|
125
|
+
'Green',
|
|
126
|
+
'Teal',
|
|
127
|
+
'DarkCyan',
|
|
128
|
+
'DeepSkyBlue',
|
|
129
|
+
'DarkTurquoise',
|
|
130
|
+
'MediumSpringGreen',
|
|
131
|
+
'Lime',
|
|
132
|
+
'SpringGreen',
|
|
133
|
+
'Aqua',
|
|
134
|
+
'Cyan',
|
|
135
|
+
'MidnightBlue',
|
|
136
|
+
'DodgerBlue',
|
|
137
|
+
'LightSeaGreen',
|
|
138
|
+
'ForestGreen',
|
|
139
|
+
'SeaGreen',
|
|
140
|
+
'DarkSlateGray',
|
|
141
|
+
'DarkSlateGrey',
|
|
142
|
+
'LimeGreen',
|
|
143
|
+
'MediumSeaGreen',
|
|
144
|
+
'Turquoise',
|
|
145
|
+
'RoyalBlue',
|
|
146
|
+
'SteelBlue',
|
|
147
|
+
'DarkSlateBlue',
|
|
148
|
+
'MediumTurquoise',
|
|
149
|
+
'Indigo',
|
|
150
|
+
'DarkOliveGreen',
|
|
151
|
+
'CadetBlue',
|
|
152
|
+
'CornflowerBlue',
|
|
153
|
+
'MediumAquaMarine',
|
|
154
|
+
'DimGray',
|
|
155
|
+
'DimGrey',
|
|
156
|
+
'SlateBlue',
|
|
157
|
+
'OliveDrab',
|
|
158
|
+
'SlateGray',
|
|
159
|
+
'SlateGrey',
|
|
160
|
+
'LightSlateGray',
|
|
161
|
+
'LightSlateGrey',
|
|
162
|
+
'MediumSlateBlue',
|
|
163
|
+
'LawnGreen',
|
|
164
|
+
'Chartreuse',
|
|
165
|
+
'Aquamarine',
|
|
166
|
+
'Maroon',
|
|
167
|
+
'Purple',
|
|
168
|
+
'Olive',
|
|
169
|
+
'Gray',
|
|
170
|
+
'Grey',
|
|
171
|
+
'SkyBlue',
|
|
172
|
+
'LightSkyBlue',
|
|
173
|
+
'BlueViolet',
|
|
174
|
+
'DarkRed',
|
|
175
|
+
'DarkMagenta',
|
|
176
|
+
'SaddleBrown',
|
|
177
|
+
'DarkSeaGreen',
|
|
178
|
+
'LightGreen',
|
|
179
|
+
'MediumPurple',
|
|
180
|
+
'DarkViolet',
|
|
181
|
+
'PaleGreen',
|
|
182
|
+
'DarkOrchid',
|
|
183
|
+
'YellowGreen',
|
|
184
|
+
'Sienna',
|
|
185
|
+
'Brown',
|
|
186
|
+
'DarkGray',
|
|
187
|
+
'DarkGrey',
|
|
188
|
+
'LightBlue',
|
|
189
|
+
'GreenYellow',
|
|
190
|
+
'PaleTurquoise',
|
|
191
|
+
'LightSteelBlue',
|
|
192
|
+
'PowderBlue',
|
|
193
|
+
'FireBrick',
|
|
194
|
+
'DarkGoldenRod',
|
|
195
|
+
'MediumOrchid',
|
|
196
|
+
'RosyBrown',
|
|
197
|
+
'DarkKhaki',
|
|
198
|
+
'Silver',
|
|
199
|
+
'MediumVioletRed',
|
|
200
|
+
'IndianRed',
|
|
201
|
+
'Peru',
|
|
202
|
+
'Chocolate',
|
|
203
|
+
'Tan',
|
|
204
|
+
'LightGray',
|
|
205
|
+
'LightGrey',
|
|
206
|
+
'Thistle',
|
|
207
|
+
'Orchid',
|
|
208
|
+
'GoldenRod',
|
|
209
|
+
'PaleVioletRed',
|
|
210
|
+
'Crimson',
|
|
211
|
+
'Gainsboro',
|
|
212
|
+
'Plum',
|
|
213
|
+
'BurlyWood',
|
|
214
|
+
'LightCyan',
|
|
215
|
+
'Lavender',
|
|
216
|
+
'DarkSalmon',
|
|
217
|
+
'Violet',
|
|
218
|
+
'PaleGoldenRod',
|
|
219
|
+
'LightCoral',
|
|
220
|
+
'Khaki',
|
|
221
|
+
'AliceBlue',
|
|
222
|
+
'HoneyDew',
|
|
223
|
+
'Azure',
|
|
224
|
+
'SandyBrown',
|
|
225
|
+
'Wheat',
|
|
226
|
+
'Beige',
|
|
227
|
+
'WhiteSmoke',
|
|
228
|
+
'MintCream',
|
|
229
|
+
'GhostWhite',
|
|
230
|
+
'Salmon',
|
|
231
|
+
'AntiqueWhite',
|
|
232
|
+
'Linen',
|
|
233
|
+
'LightGoldenRodYellow',
|
|
234
|
+
'OldLace',
|
|
235
|
+
'Red',
|
|
236
|
+
'Fuchsia',
|
|
237
|
+
'Magenta',
|
|
238
|
+
'DeepPink',
|
|
239
|
+
'OrangeRed',
|
|
240
|
+
'Tomato',
|
|
241
|
+
'HotPink',
|
|
242
|
+
'Coral',
|
|
243
|
+
'DarkOrange',
|
|
244
|
+
'LightSalmon',
|
|
245
|
+
'Orange',
|
|
246
|
+
'LightPink',
|
|
247
|
+
'Pink',
|
|
248
|
+
'Gold',
|
|
249
|
+
'PeachPuff',
|
|
250
|
+
'NavajoWhite',
|
|
251
|
+
'Moccasin',
|
|
252
|
+
'Bisque',
|
|
253
|
+
'MistyRose',
|
|
254
|
+
'BlanchedAlmond',
|
|
255
|
+
'PapayaWhip',
|
|
256
|
+
'LavenderBlush',
|
|
257
|
+
'SeaShell',
|
|
258
|
+
'Cornsilk',
|
|
259
|
+
'LemonChiffon',
|
|
260
|
+
'FloralWhite',
|
|
261
|
+
'Snow',
|
|
262
|
+
'Yellow',
|
|
263
|
+
'LightYellow',
|
|
264
|
+
'Ivory',
|
|
265
|
+
'White',
|
|
266
|
+
],
|
|
267
|
+
|
|
268
|
+
getParentNode: function () {
|
|
269
|
+
L.FormBuilder.CheckBox.prototype.getParentNode.call(this)
|
|
270
|
+
return this.quickContainer
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
build: function () {
|
|
274
|
+
L.FormBuilder.Input.prototype.build.call(this)
|
|
275
|
+
this.input.placeholder = this.options.placeholder || L._('Inherit')
|
|
276
|
+
this.container = L.DomUtil.create(
|
|
277
|
+
'div',
|
|
278
|
+
'umap-color-picker',
|
|
279
|
+
this.extendedContainer
|
|
280
|
+
)
|
|
281
|
+
this.container.style.display = 'none'
|
|
282
|
+
for (const idx in this.colors) {
|
|
283
|
+
this.addColor(this.colors[idx])
|
|
284
|
+
}
|
|
285
|
+
this.spreadColor()
|
|
286
|
+
this.input.autocomplete = 'off'
|
|
287
|
+
L.DomEvent.on(this.input, 'focus', this.onFocus, this)
|
|
288
|
+
L.DomEvent.on(this.input, 'blur', this.onBlur, this)
|
|
289
|
+
L.DomEvent.on(this.input, 'change', this.sync, this)
|
|
290
|
+
this.on('define', this.onFocus)
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
onFocus: function () {
|
|
294
|
+
this.container.style.display = 'block'
|
|
295
|
+
this.spreadColor()
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
onBlur: function () {
|
|
299
|
+
const self = this,
|
|
300
|
+
closePicker = () => {
|
|
301
|
+
self.container.style.display = 'none'
|
|
302
|
+
}
|
|
303
|
+
// We must leave time for the click to be listened.
|
|
304
|
+
window.setTimeout(closePicker, 100)
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
sync: function () {
|
|
308
|
+
this.spreadColor()
|
|
309
|
+
L.FormBuilder.Input.prototype.sync.call(this)
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
spreadColor: function () {
|
|
313
|
+
if (this.input.value) this.input.style.backgroundColor = this.input.value
|
|
314
|
+
else this.input.style.backgroundColor = 'inherit'
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
addColor: function (colorName) {
|
|
318
|
+
const span = L.DomUtil.create('span', '', this.container)
|
|
319
|
+
span.style.backgroundColor = span.title = colorName
|
|
320
|
+
const updateColorInput = function () {
|
|
321
|
+
this.input.value = colorName
|
|
322
|
+
this.sync()
|
|
323
|
+
this.container.style.display = 'none'
|
|
324
|
+
}
|
|
325
|
+
L.DomEvent.on(span, 'mousedown', updateColorInput, this)
|
|
326
|
+
},
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
L.FormBuilder.TextColorPicker = L.FormBuilder.ColorPicker.extend({
|
|
330
|
+
colors: [
|
|
331
|
+
'Black',
|
|
332
|
+
'DarkSlateGrey',
|
|
333
|
+
'DimGrey',
|
|
334
|
+
'SlateGrey',
|
|
335
|
+
'LightSlateGrey',
|
|
336
|
+
'Grey',
|
|
337
|
+
'DarkGrey',
|
|
338
|
+
'LightGrey',
|
|
339
|
+
'White',
|
|
340
|
+
],
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
L.FormBuilder.IconClassSwitcher = L.FormBuilder.Select.extend({
|
|
344
|
+
selectOptions: [
|
|
345
|
+
['Default', L._('Default')],
|
|
346
|
+
['Circle', L._('Circle')],
|
|
347
|
+
['Drop', L._('Drop')],
|
|
348
|
+
['Ball', L._('Ball')],
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
L.FormBuilder.ProxyTTLSelect = L.FormBuilder.Select.extend({
|
|
353
|
+
selectOptions: [
|
|
354
|
+
[undefined, L._('No cache')],
|
|
355
|
+
['300', L._('5 min')],
|
|
356
|
+
['3600', L._('1 hour')],
|
|
357
|
+
['86400', L._('1 day')],
|
|
358
|
+
],
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
L.FormBuilder.PopupShape = L.FormBuilder.Select.extend({
|
|
362
|
+
selectOptions: [
|
|
363
|
+
['Default', L._('Popup')],
|
|
364
|
+
['Large', L._('Popup (large)')],
|
|
365
|
+
['Panel', L._('Side panel')],
|
|
366
|
+
],
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
L.FormBuilder.PopupContent = L.FormBuilder.Select.extend({
|
|
370
|
+
selectOptions: [
|
|
371
|
+
['Default', L._('Default')],
|
|
372
|
+
['Table', L._('Table')],
|
|
373
|
+
['GeoRSSImage', L._('GeoRSS (title + image)')],
|
|
374
|
+
['GeoRSSLink', L._('GeoRSS (only link)')],
|
|
375
|
+
['OSM', L._('OpenStreetMap')],
|
|
376
|
+
],
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
L.FormBuilder.LayerTypeChooser = L.FormBuilder.Select.extend({
|
|
380
|
+
getOptions: function () {
|
|
381
|
+
const layer_classes = [
|
|
382
|
+
L.U.Layer.Default,
|
|
383
|
+
L.U.Layer.Cluster,
|
|
384
|
+
L.U.Layer.Heat,
|
|
385
|
+
L.U.Layer.Choropleth,
|
|
386
|
+
]
|
|
387
|
+
return layer_classes.map((class_) => [class_.TYPE, class_.NAME])
|
|
388
|
+
},
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
L.FormBuilder.SlideshowDelay = L.FormBuilder.IntSelect.extend({
|
|
392
|
+
getOptions: function () {
|
|
393
|
+
const options = []
|
|
394
|
+
for (let i = 1; i < 30; i++) {
|
|
395
|
+
options.push([i * 1000, L._('{delay} seconds', { delay: i })])
|
|
396
|
+
}
|
|
397
|
+
return options
|
|
398
|
+
},
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
L.FormBuilder.DataLayerSwitcher = L.FormBuilder.Select.extend({
|
|
402
|
+
getOptions: function () {
|
|
403
|
+
const options = []
|
|
404
|
+
this.builder.map.eachDataLayerReverse((datalayer) => {
|
|
405
|
+
if (
|
|
406
|
+
datalayer.isLoaded() &&
|
|
407
|
+
!datalayer.isDataReadOnly() &&
|
|
408
|
+
datalayer.canBrowse()
|
|
409
|
+
) {
|
|
410
|
+
options.push([L.stamp(datalayer), datalayer.getName()])
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
return options
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
toHTML: function () {
|
|
417
|
+
return L.stamp(this.obj.datalayer)
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
toJS: function () {
|
|
421
|
+
return this.builder.map.datalayers[this.value()]
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
set: function () {
|
|
425
|
+
this.builder.map.lastUsedDataLayer = this.toJS()
|
|
426
|
+
this.obj.changeDataLayer(this.toJS())
|
|
427
|
+
},
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
L.FormBuilder.DefaultView = L.FormBuilder.Select.extend({
|
|
431
|
+
selectOptions: [
|
|
432
|
+
['center', L._('Saved center and zoom')],
|
|
433
|
+
['data', L._('Fit all data')],
|
|
434
|
+
['latest', L._('Latest feature')],
|
|
435
|
+
['locate', L._('User location')],
|
|
436
|
+
],
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
L.FormBuilder.OnLoadPanel = L.FormBuilder.Select.extend({
|
|
440
|
+
selectOptions: [
|
|
441
|
+
['none', L._('None')],
|
|
442
|
+
['caption', L._('Caption')],
|
|
443
|
+
['databrowser', L._('Data browser')],
|
|
444
|
+
['facet', L._('Facet search')],
|
|
445
|
+
],
|
|
446
|
+
})
|
|
447
|
+
|
|
448
|
+
L.FormBuilder.DataFormat = L.FormBuilder.Select.extend({
|
|
449
|
+
selectOptions: [
|
|
450
|
+
[undefined, L._('Choose the data format')],
|
|
451
|
+
['geojson', 'geojson'],
|
|
452
|
+
['osm', 'osm'],
|
|
453
|
+
['csv', 'csv'],
|
|
454
|
+
['gpx', 'gpx'],
|
|
455
|
+
['kml', 'kml'],
|
|
456
|
+
['georss', 'georss'],
|
|
457
|
+
],
|
|
458
|
+
})
|
|
459
|
+
|
|
460
|
+
L.FormBuilder.LabelDirection = L.FormBuilder.Select.extend({
|
|
461
|
+
selectOptions: [
|
|
462
|
+
['auto', L._('Automatic')],
|
|
463
|
+
['left', L._('On the left')],
|
|
464
|
+
['right', L._('On the right')],
|
|
465
|
+
['top', L._('On the top')],
|
|
466
|
+
['bottom', L._('On the bottom')],
|
|
467
|
+
],
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
L.FormBuilder.LicenceChooser = L.FormBuilder.Select.extend({
|
|
471
|
+
getOptions: function () {
|
|
472
|
+
const licences = []
|
|
473
|
+
const licencesList = this.builder.obj.options.licences
|
|
474
|
+
let licence
|
|
475
|
+
for (const i in licencesList) {
|
|
476
|
+
licence = licencesList[i]
|
|
477
|
+
licences.push([i, licence.name])
|
|
478
|
+
}
|
|
479
|
+
return licences
|
|
480
|
+
},
|
|
481
|
+
|
|
482
|
+
toHTML: function () {
|
|
483
|
+
return this.get().name
|
|
484
|
+
},
|
|
485
|
+
|
|
486
|
+
toJS: function () {
|
|
487
|
+
return this.builder.obj.options.licences[this.value()]
|
|
488
|
+
},
|
|
489
|
+
})
|
|
490
|
+
|
|
491
|
+
L.FormBuilder.NullableBoolean = L.FormBuilder.Select.extend({
|
|
492
|
+
selectOptions: [
|
|
493
|
+
[undefined, L._('inherit')],
|
|
494
|
+
[true, L._('yes')],
|
|
495
|
+
[false, L._('no')],
|
|
496
|
+
],
|
|
497
|
+
|
|
498
|
+
toJS: function () {
|
|
499
|
+
let value = this.value()
|
|
500
|
+
switch (value) {
|
|
501
|
+
case 'true':
|
|
502
|
+
case true:
|
|
503
|
+
value = true
|
|
504
|
+
break
|
|
505
|
+
case 'false':
|
|
506
|
+
case false:
|
|
507
|
+
value = false
|
|
508
|
+
break
|
|
509
|
+
default:
|
|
510
|
+
value = undefined
|
|
511
|
+
}
|
|
512
|
+
return value
|
|
513
|
+
},
|
|
514
|
+
})
|
|
515
|
+
|
|
516
|
+
L.FormBuilder.BlurInput.include({
|
|
517
|
+
build: function () {
|
|
518
|
+
this.options.className = 'blur'
|
|
519
|
+
L.FormBuilder.Input.prototype.build.call(this)
|
|
520
|
+
const button = L.DomUtil.create('span', 'button blur-button')
|
|
521
|
+
L.DomUtil.after(this.input, button)
|
|
522
|
+
},
|
|
523
|
+
})
|
|
524
|
+
|
|
525
|
+
L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
|
|
526
|
+
type: function () {
|
|
527
|
+
return 'hidden'
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
build: function () {
|
|
531
|
+
L.FormBuilder.BlurInput.prototype.build.call(this)
|
|
532
|
+
this.buttons = L.DomUtil.create('div', '', this.parentNode)
|
|
533
|
+
this.tabs = L.DomUtil.create('div', 'pictogram-tabs', this.parentNode)
|
|
534
|
+
this.body = L.DomUtil.create('div', 'umap-pictogram-body', this.parentNode)
|
|
535
|
+
this.footer = L.DomUtil.create('div', '', this.parentNode)
|
|
536
|
+
this.updatePreview()
|
|
537
|
+
this.on('define', this.onDefine)
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
onDefine: function () {
|
|
541
|
+
this.buttons.innerHTML = ''
|
|
542
|
+
this.footer.innerHTML = ''
|
|
543
|
+
this.buildTabs()
|
|
544
|
+
const value = this.value()
|
|
545
|
+
if (!value || L.Util.isPath(value)) this.showSymbolsTab()
|
|
546
|
+
else if (L.Util.isRemoteUrl(value) || L.Util.isDataImage(value)) this.showURLTab()
|
|
547
|
+
else this.showCharsTab()
|
|
548
|
+
const closeButton = L.DomUtil.createButton(
|
|
549
|
+
'button action-button',
|
|
550
|
+
this.footer,
|
|
551
|
+
L._('Close'),
|
|
552
|
+
function (e) {
|
|
553
|
+
this.body.innerHTML = ''
|
|
554
|
+
this.tabs.innerHTML = ''
|
|
555
|
+
this.footer.innerHTML = ''
|
|
556
|
+
if (this.isDefault()) this.undefine(e)
|
|
557
|
+
else this.updatePreview()
|
|
558
|
+
},
|
|
559
|
+
this
|
|
560
|
+
)
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
buildTabs: function () {
|
|
564
|
+
this.tabs.innerHTML = ''
|
|
565
|
+
const symbol = L.DomUtil.add(
|
|
566
|
+
'button',
|
|
567
|
+
'flat tab-symbols',
|
|
568
|
+
this.tabs,
|
|
569
|
+
L._('Symbol')
|
|
570
|
+
),
|
|
571
|
+
char = L.DomUtil.add(
|
|
572
|
+
'button',
|
|
573
|
+
'flat tab-chars',
|
|
574
|
+
this.tabs,
|
|
575
|
+
L._('Emoji & Character')
|
|
576
|
+
)
|
|
577
|
+
url = L.DomUtil.add('button', 'flat tab-url', this.tabs, L._('URL'))
|
|
578
|
+
L.DomEvent.on(symbol, 'click', L.DomEvent.stop).on(
|
|
579
|
+
symbol,
|
|
580
|
+
'click',
|
|
581
|
+
this.showSymbolsTab,
|
|
582
|
+
this
|
|
583
|
+
)
|
|
584
|
+
L.DomEvent.on(char, 'click', L.DomEvent.stop).on(
|
|
585
|
+
char,
|
|
586
|
+
'click',
|
|
587
|
+
this.showCharsTab,
|
|
588
|
+
this
|
|
589
|
+
)
|
|
590
|
+
L.DomEvent.on(url, 'click', L.DomEvent.stop).on(url, 'click', this.showURLTab, this)
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
openTab: function (name) {
|
|
594
|
+
const els = this.tabs.querySelectorAll('button')
|
|
595
|
+
for (let el of els) {
|
|
596
|
+
L.DomUtil.removeClass(el, 'on')
|
|
597
|
+
}
|
|
598
|
+
let el = this.tabs.querySelector(`.tab-${name}`)
|
|
599
|
+
L.DomUtil.addClass(el, 'on')
|
|
600
|
+
this.body.innerHTML = ''
|
|
601
|
+
},
|
|
602
|
+
|
|
603
|
+
updatePreview: function () {
|
|
604
|
+
this.buttons.innerHTML = ''
|
|
605
|
+
if (this.isDefault()) return
|
|
606
|
+
if (!L.Util.hasVar(this.value())) {
|
|
607
|
+
// Do not try to render URL with variables
|
|
608
|
+
const box = L.DomUtil.create('div', 'umap-pictogram-choice', this.buttons)
|
|
609
|
+
L.DomEvent.on(box, 'click', this.onDefine, this)
|
|
610
|
+
const icon = L.U.Icon.makeIconElement(this.value(), box)
|
|
611
|
+
}
|
|
612
|
+
this.button = L.DomUtil.createButton(
|
|
613
|
+
'button action-button',
|
|
614
|
+
this.buttons,
|
|
615
|
+
this.value() ? L._('Change') : L._('Add'),
|
|
616
|
+
this.onDefine,
|
|
617
|
+
this
|
|
618
|
+
)
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
addIconPreview: function (pictogram, parent) {
|
|
622
|
+
const baseClass = 'umap-pictogram-choice',
|
|
623
|
+
value = pictogram.src,
|
|
624
|
+
search = L.Util.normalize(this.searchInput.value),
|
|
625
|
+
title = pictogram.attribution
|
|
626
|
+
? `${pictogram.name} — © ${pictogram.attribution}`
|
|
627
|
+
: pictogram.name
|
|
628
|
+
if (search && L.Util.normalize(title).indexOf(search) === -1) return
|
|
629
|
+
const className = value === this.value() ? `${baseClass} selected` : baseClass,
|
|
630
|
+
container = L.DomUtil.create('div', className, parent),
|
|
631
|
+
img = L.DomUtil.create('img', '', container)
|
|
632
|
+
img.src = value
|
|
633
|
+
container.title = title
|
|
634
|
+
L.DomEvent.on(
|
|
635
|
+
container,
|
|
636
|
+
'click',
|
|
637
|
+
function (e) {
|
|
638
|
+
this.input.value = value
|
|
639
|
+
this.sync()
|
|
640
|
+
this.unselectAll(this.grid)
|
|
641
|
+
L.DomUtil.addClass(container, 'selected')
|
|
642
|
+
},
|
|
643
|
+
this
|
|
644
|
+
)
|
|
645
|
+
return true // Icon has been added (not filtered)
|
|
646
|
+
},
|
|
647
|
+
|
|
648
|
+
clear: function () {
|
|
649
|
+
this.input.value = ''
|
|
650
|
+
this.unselectAll(this.body)
|
|
651
|
+
this.sync()
|
|
652
|
+
this.body.innerHTML = ''
|
|
653
|
+
this.updatePreview()
|
|
654
|
+
},
|
|
655
|
+
|
|
656
|
+
addCategory: function (category, items) {
|
|
657
|
+
const parent = L.DomUtil.create('div', 'umap-pictogram-category'),
|
|
658
|
+
title = L.DomUtil.add('h6', '', parent, category),
|
|
659
|
+
grid = L.DomUtil.create('div', 'umap-pictogram-grid', parent)
|
|
660
|
+
let status = false
|
|
661
|
+
for (let item of items) {
|
|
662
|
+
status = this.addIconPreview(item, grid) || status
|
|
663
|
+
}
|
|
664
|
+
if (status) this.grid.appendChild(parent)
|
|
665
|
+
},
|
|
666
|
+
|
|
667
|
+
buildSymbolsList: function () {
|
|
668
|
+
this.grid.innerHTML = ''
|
|
669
|
+
const categories = {}
|
|
670
|
+
let category
|
|
671
|
+
for (const props of this.pictogram_list) {
|
|
672
|
+
category = props.category || L._('Generic')
|
|
673
|
+
categories[category] = categories[category] || []
|
|
674
|
+
categories[category].push(props)
|
|
675
|
+
}
|
|
676
|
+
const sorted = Object.entries(categories).toSorted(([a], [b]) =>
|
|
677
|
+
L.Util.naturalSort(a, b)
|
|
678
|
+
)
|
|
679
|
+
for (let [category, items] of sorted) {
|
|
680
|
+
this.addCategory(category, items)
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
|
|
684
|
+
isDefault: function () {
|
|
685
|
+
return !this.value() || this.value() === this.obj.getMap().options.default_iconUrl
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
showSymbolsTab: function () {
|
|
689
|
+
this.openTab('symbols')
|
|
690
|
+
this.searchInput = L.DomUtil.create('input', '', this.body)
|
|
691
|
+
this.searchInput.type = 'search'
|
|
692
|
+
this.searchInput.placeholder = L._('Search')
|
|
693
|
+
this.grid = L.DomUtil.create('div', '', this.body)
|
|
694
|
+
L.DomEvent.on(this.searchInput, 'input', this.buildSymbolsList, this)
|
|
695
|
+
if (this.pictogram_list) {
|
|
696
|
+
this.buildSymbolsList()
|
|
697
|
+
} else {
|
|
698
|
+
this.builder.map.get(this.builder.map.options.urls.pictogram_list_json, {
|
|
699
|
+
callback: (data) => {
|
|
700
|
+
this.pictogram_list = data.pictogram_list
|
|
701
|
+
this.buildSymbolsList()
|
|
702
|
+
},
|
|
703
|
+
context: this,
|
|
704
|
+
})
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
|
|
708
|
+
showCharsTab: function () {
|
|
709
|
+
this.openTab('chars')
|
|
710
|
+
const value = !L.U.Icon.isImg(this.value()) ? this.value() : null
|
|
711
|
+
const input = this.buildInput(this.body, value)
|
|
712
|
+
input.placeholder = L._('Type char or paste emoji')
|
|
713
|
+
input.type = 'text'
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
showURLTab: function () {
|
|
717
|
+
this.openTab('url')
|
|
718
|
+
const value =
|
|
719
|
+
L.Util.isRemoteUrl(this.value()) || L.Util.isDataImage(this.value())
|
|
720
|
+
? this.value()
|
|
721
|
+
: null
|
|
722
|
+
const input = this.buildInput(this.body, value)
|
|
723
|
+
input.placeholder = L._('Add image URL')
|
|
724
|
+
input.type = 'url'
|
|
725
|
+
},
|
|
726
|
+
|
|
727
|
+
buildInput: function (parent, value) {
|
|
728
|
+
const input = L.DomUtil.create('input', 'blur', parent)
|
|
729
|
+
const button = L.DomUtil.create('span', 'button blur-button', parent)
|
|
730
|
+
if (value) input.value = value
|
|
731
|
+
L.DomEvent.on(input, 'blur', () => {
|
|
732
|
+
// Do not clear this.input when focus-blur
|
|
733
|
+
// empty input
|
|
734
|
+
if (input.value === value) return
|
|
735
|
+
this.input.value = input.value
|
|
736
|
+
this.sync()
|
|
737
|
+
})
|
|
738
|
+
return input
|
|
739
|
+
},
|
|
740
|
+
|
|
741
|
+
unselectAll: function (container) {
|
|
742
|
+
const els = container.querySelectorAll('div.selected')
|
|
743
|
+
for (const el in els) {
|
|
744
|
+
if (els.hasOwnProperty(el)) L.DomUtil.removeClass(els[el], 'selected')
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
})
|
|
748
|
+
|
|
749
|
+
L.FormBuilder.Url = L.FormBuilder.Input.extend({
|
|
750
|
+
type: function () {
|
|
751
|
+
return 'url'
|
|
752
|
+
},
|
|
753
|
+
})
|
|
754
|
+
|
|
755
|
+
L.FormBuilder.Switch = L.FormBuilder.CheckBox.extend({
|
|
756
|
+
getParentNode: function () {
|
|
757
|
+
L.FormBuilder.CheckBox.prototype.getParentNode.call(this)
|
|
758
|
+
if (this.options.inheritable) return this.quickContainer
|
|
759
|
+
return this.extendedContainer
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
build: function () {
|
|
763
|
+
L.FormBuilder.CheckBox.prototype.build.apply(this)
|
|
764
|
+
if (this.options.inheritable)
|
|
765
|
+
this.label = L.DomUtil.create('label', '', this.input.parentNode)
|
|
766
|
+
else this.input.parentNode.appendChild(this.label)
|
|
767
|
+
L.DomUtil.addClass(this.input.parentNode, 'with-switch')
|
|
768
|
+
const id = `${this.builder.options.id || Date.now()}.${this.name}`
|
|
769
|
+
this.label.setAttribute('for', id)
|
|
770
|
+
L.DomUtil.addClass(this.input, 'switch')
|
|
771
|
+
this.input.id = id
|
|
772
|
+
},
|
|
773
|
+
})
|
|
774
|
+
|
|
775
|
+
L.FormBuilder.FacetSearch = L.FormBuilder.Element.extend({
|
|
776
|
+
build: function () {
|
|
777
|
+
this.container = L.DomUtil.create('div', 'umap-facet', this.parentNode)
|
|
778
|
+
this.ul = L.DomUtil.create('ul', '', this.container)
|
|
779
|
+
const choices = this.options.choices
|
|
780
|
+
choices.sort()
|
|
781
|
+
choices.forEach((value) => this.buildLi(value))
|
|
782
|
+
},
|
|
783
|
+
|
|
784
|
+
buildLabel: function () {
|
|
785
|
+
this.label = L.DomUtil.add('h5', '', this.parentNode, this.options.label)
|
|
786
|
+
},
|
|
787
|
+
|
|
788
|
+
buildLi: function (value) {
|
|
789
|
+
const property_li = L.DomUtil.create('li', '', this.ul),
|
|
790
|
+
input = L.DomUtil.create('input', '', property_li),
|
|
791
|
+
label = L.DomUtil.create('label', '', property_li)
|
|
792
|
+
input.type = 'checkbox'
|
|
793
|
+
input.id = `checkbox_${this.name}_${value}`
|
|
794
|
+
input.checked = this.get().includes(value)
|
|
795
|
+
input.dataset.value = value
|
|
796
|
+
label.htmlFor = `checkbox_${this.name}_${value}`
|
|
797
|
+
label.innerHTML = value
|
|
798
|
+
L.DomEvent.on(input, 'change', (e) => this.sync())
|
|
799
|
+
},
|
|
800
|
+
|
|
801
|
+
toJS: function () {
|
|
802
|
+
return [...this.ul.querySelectorAll('input:checked')].map((i) => i.dataset.value)
|
|
803
|
+
},
|
|
804
|
+
})
|
|
805
|
+
|
|
806
|
+
L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
|
|
807
|
+
default: 'null',
|
|
808
|
+
className: 'umap-multiplechoice',
|
|
809
|
+
|
|
810
|
+
clear: function () {
|
|
811
|
+
const checked = this.container.querySelector('input[type="radio"]:checked')
|
|
812
|
+
if (checked) checked.checked = false
|
|
813
|
+
},
|
|
814
|
+
|
|
815
|
+
fetch: function () {
|
|
816
|
+
let value = (this.backup = this.toHTML())
|
|
817
|
+
if (!this.container.querySelector(`input[type="radio"][value="${value}"]`))
|
|
818
|
+
value =
|
|
819
|
+
typeof this.options.default !== 'undefined'
|
|
820
|
+
? this.options.default
|
|
821
|
+
: this.default
|
|
822
|
+
this.container.querySelector(`input[type="radio"][value="${value}"]`).checked = true
|
|
823
|
+
},
|
|
824
|
+
|
|
825
|
+
value: function () {
|
|
826
|
+
const checked = this.container.querySelector('input[type="radio"]:checked')
|
|
827
|
+
if (checked) return checked.value
|
|
828
|
+
},
|
|
829
|
+
|
|
830
|
+
getChoices: function () {
|
|
831
|
+
return this.options.choices || this.choices
|
|
832
|
+
},
|
|
833
|
+
|
|
834
|
+
build: function () {
|
|
835
|
+
const choices = this.getChoices()
|
|
836
|
+
this.container = L.DomUtil.create(
|
|
837
|
+
'div',
|
|
838
|
+
`${this.className} by${choices.length}`,
|
|
839
|
+
this.parentNode
|
|
840
|
+
)
|
|
841
|
+
for (let i = 0; i < choices.length; i++) {
|
|
842
|
+
this.addChoice(choices[i][0], choices[i][1], i)
|
|
843
|
+
}
|
|
844
|
+
this.fetch()
|
|
845
|
+
},
|
|
846
|
+
|
|
847
|
+
addChoice: function (value, label, counter) {
|
|
848
|
+
const input = L.DomUtil.create('input', '', this.container)
|
|
849
|
+
label = L.DomUtil.add('label', '', this.container, label)
|
|
850
|
+
input.type = 'radio'
|
|
851
|
+
input.name = this.name
|
|
852
|
+
input.value = value
|
|
853
|
+
const id = `${Date.now()}.${this.name}.${counter}`
|
|
854
|
+
label.setAttribute('for', id)
|
|
855
|
+
input.id = id
|
|
856
|
+
L.DomEvent.on(input, 'change', this.sync, this)
|
|
857
|
+
},
|
|
858
|
+
})
|
|
859
|
+
|
|
860
|
+
L.FormBuilder.TernaryChoices = L.FormBuilder.MultiChoice.extend({
|
|
861
|
+
default: 'null',
|
|
862
|
+
|
|
863
|
+
toJS: function () {
|
|
864
|
+
let value = this.value()
|
|
865
|
+
switch (value) {
|
|
866
|
+
case 'true':
|
|
867
|
+
case true:
|
|
868
|
+
value = true
|
|
869
|
+
break
|
|
870
|
+
case 'false':
|
|
871
|
+
case false:
|
|
872
|
+
value = false
|
|
873
|
+
break
|
|
874
|
+
default:
|
|
875
|
+
value = null
|
|
876
|
+
}
|
|
877
|
+
return value
|
|
878
|
+
},
|
|
879
|
+
})
|
|
880
|
+
|
|
881
|
+
L.FormBuilder.ControlChoice = L.FormBuilder.TernaryChoices.extend({
|
|
882
|
+
choices: [
|
|
883
|
+
[true, L._('always')],
|
|
884
|
+
[false, L._('never')],
|
|
885
|
+
['null', L._('hidden')],
|
|
886
|
+
],
|
|
887
|
+
})
|
|
888
|
+
|
|
889
|
+
L.FormBuilder.LabelChoice = L.FormBuilder.TernaryChoices.extend({
|
|
890
|
+
default: false,
|
|
891
|
+
|
|
892
|
+
choices: [
|
|
893
|
+
[true, L._('always')],
|
|
894
|
+
[false, L._('never')],
|
|
895
|
+
['null', L._('on hover')],
|
|
896
|
+
],
|
|
897
|
+
})
|
|
898
|
+
|
|
899
|
+
L.FormBuilder.DataLayersControl = L.FormBuilder.ControlChoice.extend({
|
|
900
|
+
choices: [
|
|
901
|
+
[true, L._('collapsed')],
|
|
902
|
+
['expanded', L._('expanded')],
|
|
903
|
+
[false, L._('never')],
|
|
904
|
+
['null', L._('hidden')],
|
|
905
|
+
],
|
|
906
|
+
|
|
907
|
+
toJS: function () {
|
|
908
|
+
let value = this.value()
|
|
909
|
+
if (value !== 'expanded')
|
|
910
|
+
value = L.FormBuilder.ControlChoice.prototype.toJS.call(this)
|
|
911
|
+
return value
|
|
912
|
+
},
|
|
913
|
+
})
|
|
914
|
+
|
|
915
|
+
L.FormBuilder.OutlinkTarget = L.FormBuilder.MultiChoice.extend({
|
|
916
|
+
default: 'blank',
|
|
917
|
+
|
|
918
|
+
choices: [
|
|
919
|
+
['blank', L._('new window')],
|
|
920
|
+
['self', L._('iframe')],
|
|
921
|
+
['parent', L._('parent window')],
|
|
922
|
+
],
|
|
923
|
+
})
|
|
924
|
+
|
|
925
|
+
L.FormBuilder.Range = L.FormBuilder.FloatInput.extend({
|
|
926
|
+
type: function () {
|
|
927
|
+
return 'range'
|
|
928
|
+
},
|
|
929
|
+
|
|
930
|
+
value: function () {
|
|
931
|
+
return L.DomUtil.hasClass(this.wrapper, 'undefined')
|
|
932
|
+
? undefined
|
|
933
|
+
: L.FormBuilder.FloatInput.prototype.value.call(this)
|
|
934
|
+
},
|
|
935
|
+
|
|
936
|
+
buildHelpText: function () {
|
|
937
|
+
const datalist = L.DomUtil.create(
|
|
938
|
+
'datalist',
|
|
939
|
+
'umap-field-datalist',
|
|
940
|
+
this.getHelpTextParent()
|
|
941
|
+
)
|
|
942
|
+
datalist.id = `range-${this.options.label || this.name}`
|
|
943
|
+
this.input.setAttribute('list', datalist.id)
|
|
944
|
+
let options = ''
|
|
945
|
+
const step = this.options.step || 1,
|
|
946
|
+
digits = step < 1 ? 1 : 0
|
|
947
|
+
for (let i = this.options.min; i <= this.options.max; i += this.options.step) {
|
|
948
|
+
options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(
|
|
949
|
+
digits
|
|
950
|
+
)}"></option>`
|
|
951
|
+
}
|
|
952
|
+
datalist.innerHTML = options
|
|
953
|
+
L.FormBuilder.Input.prototype.buildHelpText.call(this)
|
|
954
|
+
},
|
|
955
|
+
})
|
|
956
|
+
|
|
957
|
+
L.FormBuilder.ManageOwner = L.FormBuilder.Element.extend({
|
|
958
|
+
build: function () {
|
|
959
|
+
const options = {
|
|
960
|
+
className: 'edit-owner',
|
|
961
|
+
on_select: L.bind(this.onSelect, this),
|
|
962
|
+
}
|
|
963
|
+
this.autocomplete = new L.U.AutoComplete.Ajax.Select(this.parentNode, options)
|
|
964
|
+
const owner = this.toHTML()
|
|
965
|
+
if (owner)
|
|
966
|
+
this.autocomplete.displaySelected({
|
|
967
|
+
item: { value: owner.id, label: owner.name },
|
|
968
|
+
})
|
|
969
|
+
},
|
|
970
|
+
|
|
971
|
+
value: function () {
|
|
972
|
+
return this._value
|
|
973
|
+
},
|
|
974
|
+
|
|
975
|
+
onSelect: function (choice) {
|
|
976
|
+
this._value = {
|
|
977
|
+
id: choice.item.value,
|
|
978
|
+
name: choice.item.label,
|
|
979
|
+
url: choice.item.url,
|
|
980
|
+
}
|
|
981
|
+
this.set()
|
|
982
|
+
},
|
|
983
|
+
})
|
|
984
|
+
|
|
985
|
+
L.FormBuilder.ManageEditors = L.FormBuilder.Element.extend({
|
|
986
|
+
build: function () {
|
|
987
|
+
const options = {
|
|
988
|
+
className: 'edit-editors',
|
|
989
|
+
on_select: L.bind(this.onSelect, this),
|
|
990
|
+
on_unselect: L.bind(this.onUnselect, this),
|
|
991
|
+
}
|
|
992
|
+
this.autocomplete = new L.U.AutoComplete.Ajax.SelectMultiple(
|
|
993
|
+
this.parentNode,
|
|
994
|
+
options
|
|
995
|
+
)
|
|
996
|
+
this._values = this.toHTML()
|
|
997
|
+
if (this._values)
|
|
998
|
+
for (let i = 0; i < this._values.length; i++)
|
|
999
|
+
this.autocomplete.displaySelected({
|
|
1000
|
+
item: { value: this._values[i].id, label: this._values[i].name },
|
|
1001
|
+
})
|
|
1002
|
+
},
|
|
1003
|
+
|
|
1004
|
+
value: function () {
|
|
1005
|
+
return this._values
|
|
1006
|
+
},
|
|
1007
|
+
|
|
1008
|
+
onSelect: function (choice) {
|
|
1009
|
+
this._values.push({
|
|
1010
|
+
id: choice.item.value,
|
|
1011
|
+
name: choice.item.label,
|
|
1012
|
+
url: choice.item.url,
|
|
1013
|
+
})
|
|
1014
|
+
this.set()
|
|
1015
|
+
},
|
|
1016
|
+
|
|
1017
|
+
onUnselect: function (choice) {
|
|
1018
|
+
const index = this._values.findIndex((item) => item.id === choice.item.value)
|
|
1019
|
+
if (index !== -1) {
|
|
1020
|
+
this._values.splice(index, 1)
|
|
1021
|
+
this.set()
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
})
|
|
1025
|
+
|
|
1026
|
+
L.U.FormBuilder = L.FormBuilder.extend({
|
|
1027
|
+
options: {
|
|
1028
|
+
className: 'umap-form',
|
|
1029
|
+
},
|
|
1030
|
+
|
|
1031
|
+
defaultOptions: {
|
|
1032
|
+
name: { label: L._('name') },
|
|
1033
|
+
description: {
|
|
1034
|
+
label: L._('description'),
|
|
1035
|
+
handler: 'Textarea',
|
|
1036
|
+
helpEntries: 'textFormatting',
|
|
1037
|
+
},
|
|
1038
|
+
color: {
|
|
1039
|
+
handler: 'ColorPicker',
|
|
1040
|
+
label: L._('color'),
|
|
1041
|
+
helpEntries: 'colorValue',
|
|
1042
|
+
inheritable: true,
|
|
1043
|
+
},
|
|
1044
|
+
iconOpacity: {
|
|
1045
|
+
handler: 'Range',
|
|
1046
|
+
min: 0.1,
|
|
1047
|
+
max: 1,
|
|
1048
|
+
step: 0.1,
|
|
1049
|
+
label: L._('icon opacity'),
|
|
1050
|
+
inheritable: true,
|
|
1051
|
+
},
|
|
1052
|
+
opacity: {
|
|
1053
|
+
handler: 'Range',
|
|
1054
|
+
min: 0.1,
|
|
1055
|
+
max: 1,
|
|
1056
|
+
step: 0.1,
|
|
1057
|
+
label: L._('opacity'),
|
|
1058
|
+
inheritable: true,
|
|
1059
|
+
},
|
|
1060
|
+
stroke: {
|
|
1061
|
+
handler: 'Switch',
|
|
1062
|
+
label: L._('stroke'),
|
|
1063
|
+
helpEntries: 'stroke',
|
|
1064
|
+
inheritable: true,
|
|
1065
|
+
},
|
|
1066
|
+
weight: {
|
|
1067
|
+
handler: 'Range',
|
|
1068
|
+
min: 1,
|
|
1069
|
+
max: 20,
|
|
1070
|
+
step: 1,
|
|
1071
|
+
label: L._('weight'),
|
|
1072
|
+
inheritable: true,
|
|
1073
|
+
},
|
|
1074
|
+
fill: {
|
|
1075
|
+
handler: 'Switch',
|
|
1076
|
+
label: L._('fill'),
|
|
1077
|
+
helpEntries: 'fill',
|
|
1078
|
+
inheritable: true,
|
|
1079
|
+
},
|
|
1080
|
+
fillColor: {
|
|
1081
|
+
handler: 'ColorPicker',
|
|
1082
|
+
label: L._('fill color'),
|
|
1083
|
+
helpEntries: 'fillColor',
|
|
1084
|
+
inheritable: true,
|
|
1085
|
+
},
|
|
1086
|
+
fillOpacity: {
|
|
1087
|
+
handler: 'Range',
|
|
1088
|
+
min: 0.1,
|
|
1089
|
+
max: 1,
|
|
1090
|
+
step: 0.1,
|
|
1091
|
+
label: L._('fill opacity'),
|
|
1092
|
+
inheritable: true,
|
|
1093
|
+
},
|
|
1094
|
+
smoothFactor: {
|
|
1095
|
+
handler: 'Range',
|
|
1096
|
+
min: 0,
|
|
1097
|
+
max: 10,
|
|
1098
|
+
step: 0.5,
|
|
1099
|
+
label: L._('Simplify'),
|
|
1100
|
+
helpEntries: 'smoothFactor',
|
|
1101
|
+
inheritable: true,
|
|
1102
|
+
},
|
|
1103
|
+
dashArray: {
|
|
1104
|
+
label: L._('dash array'),
|
|
1105
|
+
helpEntries: 'dashArray',
|
|
1106
|
+
inheritable: true,
|
|
1107
|
+
},
|
|
1108
|
+
iconClass: {
|
|
1109
|
+
handler: 'IconClassSwitcher',
|
|
1110
|
+
label: L._('Icon shape'),
|
|
1111
|
+
inheritable: true,
|
|
1112
|
+
},
|
|
1113
|
+
iconUrl: {
|
|
1114
|
+
handler: 'IconUrl',
|
|
1115
|
+
label: L._('Icon symbol'),
|
|
1116
|
+
inheritable: true,
|
|
1117
|
+
helpText: L.U.Help.formatIconSymbol,
|
|
1118
|
+
},
|
|
1119
|
+
popupShape: { handler: 'PopupShape', label: L._('Popup shape'), inheritable: true },
|
|
1120
|
+
popupTemplate: {
|
|
1121
|
+
handler: 'PopupContent',
|
|
1122
|
+
label: L._('Popup content style'),
|
|
1123
|
+
inheritable: true,
|
|
1124
|
+
},
|
|
1125
|
+
popupContentTemplate: {
|
|
1126
|
+
label: L._('Popup content template'),
|
|
1127
|
+
handler: 'Textarea',
|
|
1128
|
+
helpEntries: ['dynamicProperties', 'textFormatting'],
|
|
1129
|
+
placeholder: '# {name}',
|
|
1130
|
+
inheritable: true,
|
|
1131
|
+
},
|
|
1132
|
+
datalayer: {
|
|
1133
|
+
handler: 'DataLayerSwitcher',
|
|
1134
|
+
label: L._('Choose the layer of the feature'),
|
|
1135
|
+
},
|
|
1136
|
+
moreControl: {
|
|
1137
|
+
handler: 'Switch',
|
|
1138
|
+
label: L._('Do you want to display the «more» control?'),
|
|
1139
|
+
},
|
|
1140
|
+
scrollWheelZoom: { handler: 'Switch', label: L._('Allow scroll wheel zoom?') },
|
|
1141
|
+
miniMap: { handler: 'Switch', label: L._('Do you want to display a minimap?') },
|
|
1142
|
+
scaleControl: {
|
|
1143
|
+
handler: 'Switch',
|
|
1144
|
+
label: L._('Do you want to display the scale control?'),
|
|
1145
|
+
},
|
|
1146
|
+
onLoadPanel: {
|
|
1147
|
+
handler: 'OnLoadPanel',
|
|
1148
|
+
label: L._('Do you want to display a panel on load?'),
|
|
1149
|
+
},
|
|
1150
|
+
defaultView: {
|
|
1151
|
+
handler: 'DefaultView',
|
|
1152
|
+
label: L._('Default view'),
|
|
1153
|
+
},
|
|
1154
|
+
displayPopupFooter: {
|
|
1155
|
+
handler: 'Switch',
|
|
1156
|
+
label: L._('Do you want to display popup footer?'),
|
|
1157
|
+
},
|
|
1158
|
+
captionBar: {
|
|
1159
|
+
handler: 'Switch',
|
|
1160
|
+
label: L._('Do you want to display a caption bar?'),
|
|
1161
|
+
},
|
|
1162
|
+
captionMenus: {
|
|
1163
|
+
handler: 'Switch',
|
|
1164
|
+
label: L._('Do you want to display caption menus?'),
|
|
1165
|
+
},
|
|
1166
|
+
zoomTo: {
|
|
1167
|
+
handler: 'IntInput',
|
|
1168
|
+
placeholder: L._('Inherit'),
|
|
1169
|
+
helpEntries: 'zoomTo',
|
|
1170
|
+
label: L._('Default zoom level'),
|
|
1171
|
+
inheritable: true,
|
|
1172
|
+
},
|
|
1173
|
+
showLabel: {
|
|
1174
|
+
handler: 'LabelChoice',
|
|
1175
|
+
label: L._('Display label'),
|
|
1176
|
+
inheritable: true,
|
|
1177
|
+
},
|
|
1178
|
+
labelDirection: {
|
|
1179
|
+
handler: 'LabelDirection',
|
|
1180
|
+
label: L._('Label direction'),
|
|
1181
|
+
inheritable: true,
|
|
1182
|
+
},
|
|
1183
|
+
labelInteractive: {
|
|
1184
|
+
handler: 'Switch',
|
|
1185
|
+
label: L._('Labels are clickable'),
|
|
1186
|
+
inheritable: true,
|
|
1187
|
+
},
|
|
1188
|
+
outlink: {
|
|
1189
|
+
label: L._('Link to…'),
|
|
1190
|
+
helpEntries: 'outlink',
|
|
1191
|
+
placeholder: 'http://...',
|
|
1192
|
+
inheritable: true,
|
|
1193
|
+
},
|
|
1194
|
+
outlinkTarget: {
|
|
1195
|
+
handler: 'OutlinkTarget',
|
|
1196
|
+
label: L._('Open link in…'),
|
|
1197
|
+
inheritable: true,
|
|
1198
|
+
},
|
|
1199
|
+
labelKey: {
|
|
1200
|
+
helpEntries: 'labelKey',
|
|
1201
|
+
placeholder: L._('Default: name'),
|
|
1202
|
+
label: L._('Label key'),
|
|
1203
|
+
inheritable: true,
|
|
1204
|
+
},
|
|
1205
|
+
zoomControl: { handler: 'ControlChoice', label: L._('Display the zoom control') },
|
|
1206
|
+
searchControl: {
|
|
1207
|
+
handler: 'ControlChoice',
|
|
1208
|
+
label: L._('Display the search control'),
|
|
1209
|
+
},
|
|
1210
|
+
fullscreenControl: {
|
|
1211
|
+
handler: 'ControlChoice',
|
|
1212
|
+
label: L._('Display the fullscreen control'),
|
|
1213
|
+
},
|
|
1214
|
+
embedControl: { handler: 'ControlChoice', label: L._('Display the embed control') },
|
|
1215
|
+
locateControl: {
|
|
1216
|
+
handler: 'ControlChoice',
|
|
1217
|
+
label: L._('Display the locate control'),
|
|
1218
|
+
},
|
|
1219
|
+
measureControl: {
|
|
1220
|
+
handler: 'ControlChoice',
|
|
1221
|
+
label: L._('Display the measure control'),
|
|
1222
|
+
},
|
|
1223
|
+
tilelayersControl: {
|
|
1224
|
+
handler: 'ControlChoice',
|
|
1225
|
+
label: L._('Display the tile layers control'),
|
|
1226
|
+
},
|
|
1227
|
+
editinosmControl: {
|
|
1228
|
+
handler: 'ControlChoice',
|
|
1229
|
+
label: L._('Display the control to open OpenStreetMap editor'),
|
|
1230
|
+
},
|
|
1231
|
+
datalayersControl: {
|
|
1232
|
+
handler: 'DataLayersControl',
|
|
1233
|
+
label: L._('Display the data layers control'),
|
|
1234
|
+
},
|
|
1235
|
+
starControl: {
|
|
1236
|
+
handler: 'ControlChoice',
|
|
1237
|
+
label: L._('Display the star map button'),
|
|
1238
|
+
},
|
|
1239
|
+
fromZoom: {
|
|
1240
|
+
handler: 'IntInput',
|
|
1241
|
+
label: L._('From zoom'),
|
|
1242
|
+
helpText: L._('Optional.'),
|
|
1243
|
+
},
|
|
1244
|
+
toZoom: { handler: 'IntInput', label: L._('To zoom'), helpText: L._('Optional.') },
|
|
1245
|
+
interactive: {
|
|
1246
|
+
handler: 'Switch',
|
|
1247
|
+
label: L._('Allow interactions'),
|
|
1248
|
+
helpEntries: 'interactive',
|
|
1249
|
+
inheritable: true,
|
|
1250
|
+
},
|
|
1251
|
+
},
|
|
1252
|
+
|
|
1253
|
+
initialize: function (obj, fields, options) {
|
|
1254
|
+
this.map = obj.map || obj.getMap()
|
|
1255
|
+
L.FormBuilder.prototype.initialize.call(this, obj, fields, options)
|
|
1256
|
+
this.on('finish', this.finish)
|
|
1257
|
+
},
|
|
1258
|
+
|
|
1259
|
+
setter: function (field, value) {
|
|
1260
|
+
L.FormBuilder.prototype.setter.call(this, field, value)
|
|
1261
|
+
if (this.options.makeDirty !== false) this.obj.isDirty = true
|
|
1262
|
+
},
|
|
1263
|
+
|
|
1264
|
+
finish: function () {
|
|
1265
|
+
this.map.ui.closePanel()
|
|
1266
|
+
},
|
|
1267
|
+
})
|