umap-project 2.8.2__py3-none-any.whl → 2.9.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.

Files changed (260) hide show
  1. umap/__init__.py +1 -1
  2. umap/admin.py +15 -2
  3. umap/asgi.py +12 -7
  4. umap/context_processors.py +1 -0
  5. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/br/LC_MESSAGES/django.po +111 -67
  7. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/cs_CZ/LC_MESSAGES/django.po +110 -66
  9. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/el/LC_MESSAGES/django.po +129 -85
  11. umap/locale/en/LC_MESSAGES/django.po +103 -60
  12. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  13. umap/locale/es/LC_MESSAGES/django.po +114 -69
  14. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  15. umap/locale/fr/LC_MESSAGES/django.po +105 -61
  16. umap/locale/gl/LC_MESSAGES/django.mo +0 -0
  17. umap/locale/gl/LC_MESSAGES/django.po +216 -171
  18. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  19. umap/locale/it/LC_MESSAGES/django.po +142 -98
  20. umap/locale/nl/LC_MESSAGES/django.mo +0 -0
  21. umap/locale/nl/LC_MESSAGES/django.po +196 -151
  22. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/pt/LC_MESSAGES/django.po +115 -71
  24. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/zh_TW/LC_MESSAGES/django.po +109 -65
  26. umap/management/commands/empty_trash.py +12 -1
  27. umap/migrations/0026_datalayer_modified_at_datalayer_share_status.py +26 -0
  28. umap/models.py +43 -13
  29. umap/settings/base.py +5 -2
  30. umap/static/umap/base.css +5 -2
  31. umap/static/umap/content.css +2 -22
  32. umap/static/umap/css/bar.css +39 -10
  33. umap/static/umap/css/contextmenu.css +14 -2
  34. umap/static/umap/css/form.css +33 -39
  35. umap/static/umap/css/icon.css +47 -5
  36. umap/static/umap/css/panel.css +20 -2
  37. umap/static/umap/css/popup.css +0 -1
  38. umap/static/umap/css/tooltip.css +33 -31
  39. umap/static/umap/img/16-white.svg +5 -3
  40. umap/static/umap/img/16.svg +1 -1
  41. umap/static/umap/img/24-white.svg +17 -16
  42. umap/static/umap/img/24.svg +29 -18
  43. umap/static/umap/img/providers/bitbucket.png +0 -0
  44. umap/static/umap/img/providers/github.png +0 -0
  45. umap/static/umap/img/providers/keycloak.png +0 -0
  46. umap/static/umap/img/providers/openstreetmap-oauth2.png +0 -0
  47. umap/static/umap/img/providers/twitter-oauth2.png +0 -0
  48. umap/static/umap/img/source/16-white.svg +6 -4
  49. umap/static/umap/img/source/16.svg +1 -1
  50. umap/static/umap/img/source/24-white.svg +20 -18
  51. umap/static/umap/img/source/24.svg +30 -19
  52. umap/static/umap/js/components/alerts/alert.js +4 -1
  53. umap/static/umap/js/modules/browser.js +8 -8
  54. umap/static/umap/js/modules/caption.js +30 -7
  55. umap/static/umap/js/modules/data/features.js +101 -56
  56. umap/static/umap/js/modules/data/layer.js +108 -83
  57. umap/static/umap/js/modules/form/builder.js +242 -0
  58. umap/static/umap/js/modules/form/fields.js +1346 -0
  59. umap/static/umap/js/modules/formatter.js +9 -8
  60. umap/static/umap/js/modules/help.js +20 -24
  61. umap/static/umap/js/modules/importer.js +6 -3
  62. umap/static/umap/js/modules/permissions.js +11 -6
  63. umap/static/umap/js/modules/rendering/icon.js +5 -1
  64. umap/static/umap/js/modules/rendering/layers/classified.js +12 -8
  65. umap/static/umap/js/modules/rendering/layers/cluster.js +11 -1
  66. umap/static/umap/js/modules/rendering/map.js +1 -23
  67. umap/static/umap/js/modules/rendering/ui.js +20 -38
  68. umap/static/umap/js/modules/rules.js +3 -2
  69. umap/static/umap/js/modules/saving.js +5 -0
  70. umap/static/umap/js/modules/schema.js +8 -6
  71. umap/static/umap/js/modules/share.js +3 -3
  72. umap/static/umap/js/modules/sync/engine.js +56 -26
  73. umap/static/umap/js/modules/sync/updaters.js +15 -6
  74. umap/static/umap/js/modules/sync/websocket.js +50 -37
  75. umap/static/umap/js/modules/tableeditor.js +3 -2
  76. umap/static/umap/js/modules/ui/bar.js +101 -9
  77. umap/static/umap/js/modules/ui/base.js +7 -24
  78. umap/static/umap/js/modules/ui/contextmenu.js +9 -2
  79. umap/static/umap/js/modules/ui/panel.js +5 -1
  80. umap/static/umap/js/modules/ui/tooltip.js +19 -11
  81. umap/static/umap/js/modules/umap.js +121 -68
  82. umap/static/umap/js/modules/utils.js +196 -12
  83. umap/static/umap/js/umap.controls.js +11 -353
  84. umap/static/umap/locale/am_ET.js +17 -5
  85. umap/static/umap/locale/am_ET.json +17 -5
  86. umap/static/umap/locale/ar.js +17 -5
  87. umap/static/umap/locale/ar.json +17 -5
  88. umap/static/umap/locale/ast.js +17 -5
  89. umap/static/umap/locale/ast.json +17 -5
  90. umap/static/umap/locale/bg.js +17 -5
  91. umap/static/umap/locale/bg.json +17 -5
  92. umap/static/umap/locale/br.js +33 -20
  93. umap/static/umap/locale/br.json +33 -20
  94. umap/static/umap/locale/ca.js +17 -5
  95. umap/static/umap/locale/ca.json +17 -5
  96. umap/static/umap/locale/cs_CZ.js +15 -5
  97. umap/static/umap/locale/cs_CZ.json +15 -5
  98. umap/static/umap/locale/da.js +17 -5
  99. umap/static/umap/locale/da.json +17 -5
  100. umap/static/umap/locale/de.js +17 -5
  101. umap/static/umap/locale/de.json +17 -5
  102. umap/static/umap/locale/el.js +63 -51
  103. umap/static/umap/locale/el.json +63 -51
  104. umap/static/umap/locale/en.js +15 -5
  105. umap/static/umap/locale/en.json +15 -5
  106. umap/static/umap/locale/en_US.json +17 -5
  107. umap/static/umap/locale/es.js +25 -13
  108. umap/static/umap/locale/es.json +25 -13
  109. umap/static/umap/locale/et.js +17 -5
  110. umap/static/umap/locale/et.json +17 -5
  111. umap/static/umap/locale/eu.js +17 -5
  112. umap/static/umap/locale/eu.json +17 -5
  113. umap/static/umap/locale/fa_IR.js +17 -5
  114. umap/static/umap/locale/fa_IR.json +17 -5
  115. umap/static/umap/locale/fi.js +17 -5
  116. umap/static/umap/locale/fi.json +17 -5
  117. umap/static/umap/locale/fr.js +16 -6
  118. umap/static/umap/locale/fr.json +16 -6
  119. umap/static/umap/locale/gl.js +357 -345
  120. umap/static/umap/locale/gl.json +357 -345
  121. umap/static/umap/locale/he.js +17 -5
  122. umap/static/umap/locale/he.json +17 -5
  123. umap/static/umap/locale/hr.js +17 -5
  124. umap/static/umap/locale/hr.json +17 -5
  125. umap/static/umap/locale/hu.js +14 -5
  126. umap/static/umap/locale/hu.json +14 -5
  127. umap/static/umap/locale/id.js +17 -5
  128. umap/static/umap/locale/id.json +17 -5
  129. umap/static/umap/locale/is.js +17 -5
  130. umap/static/umap/locale/is.json +17 -5
  131. umap/static/umap/locale/it.js +125 -113
  132. umap/static/umap/locale/it.json +125 -113
  133. umap/static/umap/locale/ja.js +17 -5
  134. umap/static/umap/locale/ja.json +17 -5
  135. umap/static/umap/locale/ko.js +17 -5
  136. umap/static/umap/locale/ko.json +17 -5
  137. umap/static/umap/locale/lt.js +17 -5
  138. umap/static/umap/locale/lt.json +17 -5
  139. umap/static/umap/locale/ms.js +17 -5
  140. umap/static/umap/locale/ms.json +17 -5
  141. umap/static/umap/locale/nl.js +132 -119
  142. umap/static/umap/locale/nl.json +132 -119
  143. umap/static/umap/locale/no.js +17 -5
  144. umap/static/umap/locale/no.json +17 -5
  145. umap/static/umap/locale/pl.js +17 -5
  146. umap/static/umap/locale/pl.json +17 -5
  147. umap/static/umap/locale/pl_PL.json +17 -5
  148. umap/static/umap/locale/pt.js +38 -25
  149. umap/static/umap/locale/pt.json +38 -25
  150. umap/static/umap/locale/pt_BR.js +17 -5
  151. umap/static/umap/locale/pt_BR.json +17 -5
  152. umap/static/umap/locale/pt_PT.js +17 -5
  153. umap/static/umap/locale/pt_PT.json +17 -5
  154. umap/static/umap/locale/ro.js +17 -5
  155. umap/static/umap/locale/ro.json +17 -5
  156. umap/static/umap/locale/ru.js +17 -5
  157. umap/static/umap/locale/ru.json +17 -5
  158. umap/static/umap/locale/sk_SK.js +17 -5
  159. umap/static/umap/locale/sk_SK.json +17 -5
  160. umap/static/umap/locale/sl.js +17 -5
  161. umap/static/umap/locale/sl.json +17 -5
  162. umap/static/umap/locale/sr.js +17 -5
  163. umap/static/umap/locale/sr.json +17 -5
  164. umap/static/umap/locale/sv.js +17 -5
  165. umap/static/umap/locale/sv.json +17 -5
  166. umap/static/umap/locale/th_TH.js +17 -5
  167. umap/static/umap/locale/th_TH.json +17 -5
  168. umap/static/umap/locale/tr.js +17 -5
  169. umap/static/umap/locale/tr.json +17 -5
  170. umap/static/umap/locale/uk_UA.js +17 -5
  171. umap/static/umap/locale/uk_UA.json +17 -5
  172. umap/static/umap/locale/vi.js +17 -5
  173. umap/static/umap/locale/vi.json +17 -5
  174. umap/static/umap/locale/vi_VN.json +17 -5
  175. umap/static/umap/locale/zh.js +17 -5
  176. umap/static/umap/locale/zh.json +17 -5
  177. umap/static/umap/locale/zh_CN.json +17 -5
  178. umap/static/umap/locale/zh_TW.Big5.json +17 -5
  179. umap/static/umap/locale/zh_TW.js +15 -5
  180. umap/static/umap/locale/zh_TW.json +15 -5
  181. umap/static/umap/map.css +29 -76
  182. umap/static/umap/nav.css +6 -3
  183. umap/static/umap/unittests/utils.js +14 -0
  184. umap/static/umap/vars.css +3 -0
  185. umap/static/umap/vendors/dompurify/purify.es.js +138 -354
  186. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
  187. umap/static/umap/vendors/editable/Leaflet.Editable.js +1 -0
  188. umap/sync/__init__.py +0 -0
  189. umap/sync/app.py +187 -0
  190. umap/sync/payloads.py +56 -0
  191. umap/templates/auth/user_detail.html +4 -0
  192. umap/templates/auth/user_form.html +9 -6
  193. umap/templates/auth/user_stars.html +4 -0
  194. umap/templates/base.html +1 -1
  195. umap/templates/registration/login.html +2 -5
  196. umap/templates/umap/about.html +5 -0
  197. umap/templates/umap/about_summary.html +2 -2
  198. umap/templates/umap/components/provider.html +8 -0
  199. umap/templates/umap/content_footer.html +1 -1
  200. umap/templates/umap/css.html +0 -2
  201. umap/templates/umap/js.html +0 -4
  202. umap/templates/umap/map_detail.html +1 -1
  203. umap/templates/umap/password_change.html +4 -0
  204. umap/templates/umap/password_change_done.html +4 -0
  205. umap/templates/umap/search.html +4 -0
  206. umap/templates/umap/search_bar.html +1 -0
  207. umap/templates/umap/team_confirm_delete.html +4 -0
  208. umap/templates/umap/team_detail.html +4 -0
  209. umap/templates/umap/team_form.html +4 -0
  210. umap/templates/umap/user_dashboard.html +1 -1
  211. umap/templates/umap/user_teams.html +4 -0
  212. umap/tests/base.py +3 -1
  213. umap/tests/integration/conftest.py +16 -23
  214. umap/tests/integration/test_anonymous_owned_map.py +2 -2
  215. umap/tests/integration/test_basics.py +4 -7
  216. umap/tests/integration/test_caption.py +1 -0
  217. umap/tests/integration/test_categorized_layer.py +4 -8
  218. umap/tests/integration/test_choropleth.py +1 -1
  219. umap/tests/integration/test_conditional_rules.py +3 -3
  220. umap/tests/integration/test_draw_polygon.py +14 -22
  221. umap/tests/integration/test_draw_polyline.py +6 -14
  222. umap/tests/integration/test_edit_datalayer.py +11 -11
  223. umap/tests/integration/test_edit_map.py +30 -4
  224. umap/tests/integration/test_edit_marker.py +5 -5
  225. umap/tests/integration/test_edit_polygon.py +6 -6
  226. umap/tests/integration/test_features_id_generation.py +2 -6
  227. umap/tests/integration/test_import.py +115 -29
  228. umap/tests/integration/test_optimistic_merge.py +1 -0
  229. umap/tests/integration/test_owned_map.py +1 -1
  230. umap/tests/integration/test_picto.py +8 -8
  231. umap/tests/integration/test_save.py +3 -2
  232. umap/tests/integration/test_star.py +13 -9
  233. umap/tests/integration/test_tableeditor.py +8 -7
  234. umap/tests/integration/test_view_marker.py +10 -0
  235. umap/tests/integration/test_websocket_sync.py +239 -64
  236. umap/tests/settings.py +2 -0
  237. umap/tests/test_datalayer.py +2 -3
  238. umap/tests/test_datalayer_views.py +20 -1
  239. umap/tests/test_empty_trash.py +10 -3
  240. umap/tests/test_map_views.py +11 -0
  241. umap/utils.py +27 -11
  242. umap/views.py +37 -6
  243. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/METADATA +22 -22
  244. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/RECORD +247 -248
  245. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/WHEEL +1 -1
  246. umap/management/commands/run_websocket_server.py +0 -23
  247. umap/settings/local_s3.py +0 -45
  248. umap/static/umap/bitbucket.png +0 -0
  249. umap/static/umap/github.png +0 -0
  250. umap/static/umap/js/umap.forms.js +0 -1242
  251. umap/static/umap/keycloak.png +0 -0
  252. umap/static/umap/openstreetmap.png +0 -0
  253. umap/static/umap/twitter.png +0 -0
  254. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +0 -468
  255. umap/static/umap/vendors/toolbar/leaflet.toolbar.css +0 -1
  256. umap/static/umap/vendors/toolbar/leaflet.toolbar.js +0 -1
  257. umap/tests/test_websocket_server.py +0 -22
  258. umap/websocket_server.py +0 -202
  259. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/entry_points.txt +0 -0
  260. {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/licenses/LICENSE +0 -0
Binary file
Binary file
Binary file
@@ -1,468 +0,0 @@
1
- L.FormBuilder = L.Evented.extend({
2
- options: {
3
- className: 'leaflet-form',
4
- },
5
-
6
- defaultOptions: {
7
- // Eg.:
8
- // name: {label: L._('name')},
9
- // description: {label: L._('description'), handler: 'Textarea'},
10
- // opacity: {label: L._('opacity'), helpText: L._('Opacity, from 0.1 to 1.0 (opaque).')},
11
- },
12
-
13
- initialize: function (obj, fields, options) {
14
- L.setOptions(this, options)
15
- this.obj = obj
16
- this.form = L.DomUtil.create('form', this.options.className)
17
- this.setFields(fields)
18
- if (this.options.id) {
19
- this.form.id = this.options.id
20
- }
21
- if (this.options.className) {
22
- L.DomUtil.addClass(this.form, this.options.className)
23
- }
24
- },
25
-
26
- setFields: function (fields) {
27
- this.fields = fields || []
28
- this.helpers = {}
29
- },
30
-
31
- build: function () {
32
- this.form.innerHTML = ''
33
- for (const idx in this.fields) {
34
- this.buildField(this.fields[idx])
35
- }
36
- this.on('postsync', this.onPostSync)
37
- return this.form
38
- },
39
-
40
- buildField: function (field) {
41
- // field can be either a string like "option.name" or a full definition array,
42
- // like ['options.tilelayer.tms', {handler: 'CheckBox', helpText: 'TMS format'}]
43
- let type
44
- let helper
45
- let options
46
- if (Array.isArray(field)) {
47
- options = field[1] || {}
48
- field = field[0]
49
- } else {
50
- options = this.defaultOptions[this.getName(field)] || {}
51
- }
52
- type = options.handler || 'Input'
53
- if (typeof type === 'string' && L.FormBuilder[type]) {
54
- helper = new L.FormBuilder[type](this, field, options)
55
- } else {
56
- helper = new type(this, field, options)
57
- }
58
- this.helpers[field] = helper
59
- return helper
60
- },
61
-
62
- getter: function (field) {
63
- const path = field.split('.')
64
- let value = this.obj
65
- for (const sub of path) {
66
- try {
67
- value = value[sub]
68
- } catch {
69
- console.log(field)
70
- }
71
- }
72
- return value
73
- },
74
-
75
- setter: function (field, value) {
76
- const path = field.split('.')
77
- let obj = this.obj
78
- let what
79
- for (let i = 0, l = path.length; i < l; i++) {
80
- what = path[i]
81
- if (what === path[l - 1]) {
82
- if (typeof value === 'undefined') {
83
- delete obj[what]
84
- } else {
85
- obj[what] = value
86
- }
87
- } else {
88
- obj = obj[what]
89
- }
90
- }
91
- },
92
-
93
- restoreField: function (field) {
94
- const initial = this.helpers[field].initial
95
- this.setter(field, initial)
96
- },
97
-
98
- getName: (field) => {
99
- const fieldEls = field.split('.')
100
- return fieldEls[fieldEls.length - 1]
101
- },
102
-
103
- fetchAll: function () {
104
- for (const helper of Object.values(this.helpers)) {
105
- helper.fetch()
106
- }
107
- },
108
-
109
- syncAll: function () {
110
- for (const helper of Object.values(this.helpers)) {
111
- helper.sync()
112
- }
113
- },
114
-
115
- onPostSync: function (e) {
116
- if (e.helper.options.callback) {
117
- e.helper.options.callback.call(e.helper.options.callbackContext || this.obj, e)
118
- }
119
- if (this.options.callback) {
120
- this.options.callback.call(this.options.callbackContext || this.obj, e)
121
- }
122
- },
123
- })
124
-
125
- L.FormBuilder.Element = L.Evented.extend({
126
- initialize: function (builder, field, options) {
127
- this.builder = builder
128
- this.obj = this.builder.obj
129
- this.form = this.builder.form
130
- this.field = field
131
- L.setOptions(this, options)
132
- this.fieldEls = this.field.split('.')
133
- this.name = this.builder.getName(field)
134
- this.parentNode = this.getParentNode()
135
- this.buildLabel()
136
- this.build()
137
- this.buildHelpText()
138
- this.fireAndForward('helper:init')
139
- },
140
-
141
- fireAndForward: function (type, e = {}) {
142
- e.helper = this
143
- this.fire(type, e)
144
- this.builder.fire(type, e)
145
- if (this.obj.fire) this.obj.fire(type, e)
146
- },
147
-
148
- getParentNode: function () {
149
- return this.options.wrapper
150
- ? L.DomUtil.create(
151
- this.options.wrapper,
152
- this.options.wrapperClass || '',
153
- this.form
154
- )
155
- : this.form
156
- },
157
-
158
- get: function () {
159
- return this.builder.getter(this.field)
160
- },
161
-
162
- toHTML: function () {
163
- return this.get()
164
- },
165
-
166
- toJS: function () {
167
- return this.value()
168
- },
169
-
170
- sync: function () {
171
- this.fireAndForward('presync')
172
- this.set()
173
- this.fireAndForward('postsync')
174
- },
175
-
176
- set: function () {
177
- this.builder.setter(this.field, this.toJS())
178
- },
179
-
180
- getLabelParent: function () {
181
- return this.parentNode
182
- },
183
-
184
- getHelpTextParent: function () {
185
- return this.parentNode
186
- },
187
-
188
- buildLabel: function () {
189
- if (this.options.label) {
190
- this.label = L.DomUtil.create('label', '', this.getLabelParent())
191
- this.label.innerHTML = this.options.label
192
- }
193
- },
194
-
195
- buildHelpText: function () {
196
- if (this.options.helpText) {
197
- const container = L.DomUtil.create('small', 'help-text', this.getHelpTextParent())
198
- container.innerHTML = this.options.helpText
199
- }
200
- },
201
-
202
- fetch: () => {},
203
-
204
- finish: function () {
205
- this.fireAndForward('finish')
206
- },
207
- })
208
-
209
- L.FormBuilder.Textarea = L.FormBuilder.Element.extend({
210
- build: function () {
211
- this.input = L.DomUtil.create(
212
- 'textarea',
213
- this.options.className || '',
214
- this.parentNode
215
- )
216
- if (this.options.placeholder) this.input.placeholder = this.options.placeholder
217
- this.fetch()
218
- L.DomEvent.on(this.input, 'input', this.sync, this)
219
- L.DomEvent.on(this.input, 'keypress', this.onKeyPress, this)
220
- },
221
-
222
- fetch: function () {
223
- const value = this.toHTML()
224
- this.initial = value
225
- if (value) {
226
- this.input.value = value
227
- }
228
- },
229
-
230
- value: function () {
231
- return this.input.value
232
- },
233
-
234
- onKeyPress: function (e) {
235
- if (e.key === 'Enter' && (e.shiftKey || e.ctrlKey)) {
236
- L.DomEvent.stop(e)
237
- this.finish()
238
- }
239
- },
240
- })
241
-
242
- L.FormBuilder.Input = L.FormBuilder.Element.extend({
243
- build: function () {
244
- this.input = L.DomUtil.create(
245
- 'input',
246
- this.options.className || '',
247
- this.parentNode
248
- )
249
- this.input.type = this.type()
250
- this.input.name = this.name
251
- this.input._helper = this
252
- if (this.options.placeholder) {
253
- this.input.placeholder = this.options.placeholder
254
- }
255
- if (this.options.min !== undefined) {
256
- this.input.min = this.options.min
257
- }
258
- if (this.options.max !== undefined) {
259
- this.input.max = this.options.max
260
- }
261
- if (this.options.step) {
262
- this.input.step = this.options.step
263
- }
264
- this.fetch()
265
- L.DomEvent.on(this.input, this.getSyncEvent(), this.sync, this)
266
- L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this)
267
- },
268
-
269
- fetch: function () {
270
- const value = this.toHTML() !== undefined ? this.toHTML() : null
271
- this.initial = value
272
- this.input.value = value
273
- },
274
-
275
- getSyncEvent: () => 'input',
276
-
277
- type: function () {
278
- return this.options.type || 'text'
279
- },
280
-
281
- value: function () {
282
- return this.input.value || undefined
283
- },
284
-
285
- onKeyDown: function (e) {
286
- if (e.key === 'Enter') {
287
- L.DomEvent.stop(e)
288
- this.finish()
289
- }
290
- },
291
- })
292
-
293
- L.FormBuilder.BlurInput = L.FormBuilder.Input.extend({
294
- getSyncEvent: () => 'blur',
295
-
296
- build: function () {
297
- L.FormBuilder.Input.prototype.build.call(this)
298
- L.DomEvent.on(this.input, 'focus', this.fetch, this)
299
- },
300
-
301
- finish: function () {
302
- this.sync()
303
- L.FormBuilder.Input.prototype.finish.call(this)
304
- },
305
-
306
- sync: function () {
307
- // Do not commit any change if user only clicked
308
- // on the field than clicked outside
309
- if (this.initial !== this.value()) {
310
- L.FormBuilder.Input.prototype.sync.call(this)
311
- }
312
- },
313
- })
314
-
315
- L.FormBuilder.IntegerMixin = {
316
- value: function () {
317
- return !isNaN(this.input.value) && this.input.value !== ''
318
- ? parseInt(this.input.value, 10)
319
- : undefined
320
- },
321
-
322
- type: () => 'number',
323
- }
324
-
325
- L.FormBuilder.IntInput = L.FormBuilder.Input.extend({
326
- includes: [L.FormBuilder.IntegerMixin],
327
- })
328
-
329
- L.FormBuilder.BlurIntInput = L.FormBuilder.BlurInput.extend({
330
- includes: [L.FormBuilder.IntegerMixin],
331
- })
332
-
333
- L.FormBuilder.FloatMixin = {
334
- value: function () {
335
- return !isNaN(this.input.value) && this.input.value !== ''
336
- ? parseFloat(this.input.value)
337
- : undefined
338
- },
339
-
340
- type: () => 'number',
341
- }
342
-
343
- L.FormBuilder.FloatInput = L.FormBuilder.Input.extend({
344
- options: {
345
- step: 'any',
346
- },
347
-
348
- includes: [L.FormBuilder.FloatMixin],
349
- })
350
-
351
- L.FormBuilder.BlurFloatInput = L.FormBuilder.BlurInput.extend({
352
- options: {
353
- step: 'any',
354
- },
355
-
356
- includes: [L.FormBuilder.FloatMixin],
357
- })
358
-
359
- L.FormBuilder.CheckBox = L.FormBuilder.Element.extend({
360
- build: function () {
361
- const container = L.DomUtil.create('div', 'checkbox-wrapper', this.parentNode)
362
- this.input = L.DomUtil.create('input', this.options.className || '', container)
363
- this.input.type = 'checkbox'
364
- this.input.name = this.name
365
- this.input._helper = this
366
- this.fetch()
367
- L.DomEvent.on(this.input, 'change', this.sync, this)
368
- },
369
-
370
- fetch: function () {
371
- this.initial = this.toHTML()
372
- this.input.checked = this.initial === true
373
- },
374
-
375
- value: function () {
376
- return this.input.checked
377
- },
378
-
379
- toHTML: function () {
380
- return [1, true].indexOf(this.get()) !== -1
381
- },
382
- })
383
-
384
- L.FormBuilder.Select = L.FormBuilder.Element.extend({
385
- selectOptions: [['value', 'label']],
386
-
387
- build: function () {
388
- this.select = L.DomUtil.create('select', '', this.parentNode)
389
- this.select.name = this.name
390
- this.validValues = []
391
- this.buildOptions()
392
- L.DomEvent.on(this.select, 'change', this.sync, this)
393
- },
394
-
395
- getOptions: function () {
396
- return this.options.selectOptions || this.selectOptions
397
- },
398
-
399
- fetch: function () {
400
- this.buildOptions()
401
- },
402
-
403
- buildOptions: function () {
404
- this.select.innerHTML = ''
405
- for (const option of this.getOptions()) {
406
- if (typeof option === 'string') this.buildOption(option, option)
407
- else this.buildOption(option[0], option[1])
408
- }
409
- },
410
-
411
- buildOption: function (value, label) {
412
- this.validValues.push(value)
413
- const option = L.DomUtil.create('option', '', this.select)
414
- option.value = value
415
- option.innerHTML = label
416
- if (this.toHTML() === value) {
417
- option.selected = 'selected'
418
- }
419
- },
420
-
421
- value: function () {
422
- if (this.select[this.select.selectedIndex])
423
- return this.select[this.select.selectedIndex].value
424
- },
425
-
426
- getDefault: function () {
427
- return this.getOptions()[0][0]
428
- },
429
-
430
- toJS: function () {
431
- const value = this.value()
432
- if (this.validValues.indexOf(value) !== -1) {
433
- return value
434
- }
435
- return this.getDefault()
436
- },
437
- })
438
-
439
- L.FormBuilder.IntSelect = L.FormBuilder.Select.extend({
440
- value: function () {
441
- return parseInt(L.FormBuilder.Select.prototype.value.apply(this), 10)
442
- },
443
- })
444
-
445
- L.FormBuilder.NullableBoolean = L.FormBuilder.Select.extend({
446
- selectOptions: [
447
- [undefined, 'inherit'],
448
- [true, 'yes'],
449
- [false, 'no'],
450
- ],
451
-
452
- toJS: function () {
453
- let value = this.value()
454
- switch (value) {
455
- case 'true':
456
- case true:
457
- value = true
458
- break
459
- case 'false':
460
- case false:
461
- value = false
462
- break
463
- default:
464
- value = undefined
465
- }
466
- return value
467
- },
468
- })
@@ -1 +0,0 @@
1
- .leaflet-toolbar-0{list-style:none;padding-left:0;box-shadow:0 1px 5px rgba(0,0,0,.65)}.leaflet-toolbar-0>li{position:relative}.leaflet-toolbar-0>li>.leaflet-toolbar-icon{display:block;width:26px;height:26px;line-height:26px;margin-right:0;padding-right:0;border-right:0;text-align:center;text-decoration:none;background-color:#fff}.leaflet-toolbar-0>li>.leaflet-toolbar-icon:hover{background-color:#f4f4f4}.leaflet-toolbar-0 .leaflet-toolbar-1{display:none;list-style:none}.leaflet-toolbar-tip-container{margin:0 auto;height:12px;position:relative;overflow:hidden}.leaflet-toolbar-tip{width:12px;height:12px;margin:-6px auto 0;background-color:#fff;box-shadow:0 1px 5px rgba(0,0,0,.65);-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-control-toolbar>li>.leaflet-toolbar-icon{border-bottom:1px solid #ccc}.leaflet-control-toolbar>li:first-child>.leaflet-toolbar-icon{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-control-toolbar>li:last-child>.leaflet-toolbar-icon{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom-width:0}.leaflet-control-toolbar .leaflet-toolbar-1{margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap;height:26px}.leaflet-control-toolbar .leaflet-toolbar-1>li{display:inline-block}.leaflet-control-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon{display:block;background-color:#919187;border-left:1px solid #aaa;color:#fff;font:11px/19px "Helvetica Neue",Arial,Helvetica,sans-serif;line-height:26px;text-decoration:none;padding-left:10px;padding-right:10px;height:26px}.leaflet-control-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon:hover{background-color:#a0a098}.leaflet-popup-toolbar{position:relative}.leaflet-popup-toolbar>li{float:left}.leaflet-popup-toolbar>li:first-child>.leaflet-toolbar-icon{border-top-left-radius:4px;border-bottom-left-radius:4px}.leaflet-popup-toolbar>li:last-child>.leaflet-toolbar-icon{border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-width:0}.leaflet-popup-toolbar .leaflet-toolbar-1{position:absolute;top:26px;left:0;padding-left:0}.leaflet-popup-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon{position:relative;float:left;width:26px;height:26px}
@@ -1 +0,0 @@
1
- !function(a,b,c){"use strict";L.Toolbar=(L.Layer||L.Class).extend({statics:{baseClass:"leaflet-toolbar"},includes:L.Mixin.Events,options:{className:"",filter:function(){return!0},actions:[]},initialize:function(a){L.setOptions(this,a),this._toolbar_type=this.constructor._toolbar_class_id},addTo:function(a){return this._arguments=[].slice.call(arguments),a.addLayer(this),this},onAdd:function(a){var b=a._toolbars[this._toolbar_type];0===this._calculateDepth()&&(b&&a.removeLayer(b),a._toolbars[this._toolbar_type]=this)},onRemove:function(a){0===this._calculateDepth()&&delete a._toolbars[this._toolbar_type]},appendToContainer:function(a){var b,c,d,e,f,g,h=this.constructor.baseClass+"-"+this._calculateDepth(),i=h+" "+this.options.className;for(this._container=a,this._ul=L.DomUtil.create("ul",i,a),this._disabledEvents=["click","mousemove","dblclick"],e=0,g=this._disabledEvents.length;g>e;e++)L.DomEvent.on(this._ul,this._disabledEvents[e],L.DomEvent.stopPropagation);for(d=0,f=this.options.actions.length;f>d;d++)b=this._getActionConstructor(this.options.actions[d]),c=new b,c._createIcon(this,this._ul,this._arguments)},_getActionConstructor:function(a){var b=this._arguments,c=this;return a.extend({initialize:function(){a.prototype.initialize.apply(this,b)},enable:function(b){c._active&&c._active.disable(),c._active=this,a.prototype.enable.call(this,b)}})},_hide:function(){this._ul.style.display="none"},_show:function(){this._ul.style.display="block"},_calculateDepth:function(){for(var a=0,b=this.parentToolbar;b;)a+=1,b=b.parentToolbar;return a}}),L.toolbar={};var d=0;L.Toolbar.extend=function(a){var b=L.extend({},a.statics,{_toolbar_class_id:d});return d+=1,L.extend(a,{statics:b}),L.Class.extend.call(this,a)},L.Map.addInitHook(function(){this._toolbars={}}),L.ToolbarAction=L.Handler.extend({statics:{baseClass:"leaflet-toolbar-icon"},options:{toolbarIcon:{html:"",className:"",tooltip:""},subToolbar:new L.Toolbar},initialize:function(a){var b=L.ToolbarAction.prototype.options.toolbarIcon;L.setOptions(this,a),this.options.toolbarIcon=L.extend({},b,this.options.toolbarIcon)},enable:function(a){a&&L.DomEvent.preventDefault(a),this._enabled||(this._enabled=!0,this.addHooks&&this.addHooks())},disable:function(){this._enabled&&(this._enabled=!1,this.removeHooks&&this.removeHooks())},_createIcon:function(a,b,c){var d=this.options.toolbarIcon;this.toolbar=a,this._icon=L.DomUtil.create("li","",b),this._link=L.DomUtil.create("a","",this._icon),this._link.innerHTML=d.html,this._link.setAttribute("href","#"),this._link.setAttribute("title",d.tooltip),L.DomUtil.addClass(this._link,this.constructor.baseClass),d.className&&L.DomUtil.addClass(this._link,d.className),L.DomEvent.on(this._link,"click",this.enable,this),this._addSubToolbar(a,this._icon,c)},_addSubToolbar:function(a,b,c){var d=this.options.subToolbar,e=this.addHooks,f=this.removeHooks;d.parentToolbar=a,d.options.actions.length>0&&(c=[].slice.call(c),c.push(this),d.addTo.apply(d,c),d.appendToContainer(b),this.addHooks=function(a){"function"==typeof e&&e.call(this,a),d._show()},this.removeHooks=function(a){"function"==typeof f&&f.call(this,a),d._hide()})}}),L.toolbarAction=function(a){return new L.ToolbarAction(a)},L.ToolbarAction.extendOptions=function(a){return this.extend({options:a})},L.Toolbar.Control=L.Toolbar.extend({statics:{baseClass:"leaflet-control-toolbar "+L.Toolbar.baseClass},initialize:function(a){L.Toolbar.prototype.initialize.call(this,a),this._control=new L.Control.Toolbar(this.options)},onAdd:function(a){this._control.addTo(a),L.Toolbar.prototype.onAdd.call(this,a),this.appendToContainer(this._control.getContainer())},onRemove:function(a){L.Toolbar.prototype.onRemove.call(this,a),this._control.remove?this._control.remove():this._control.removeFrom(a)}}),L.Control.Toolbar=L.Control.extend({onAdd:function(){return L.DomUtil.create("div","")}}),L.toolbar.control=function(a){return new L.Toolbar.Control(a)},L.Toolbar.Popup=L.Toolbar.extend({statics:{baseClass:"leaflet-popup-toolbar "+L.Toolbar.baseClass},options:{anchor:[0,0]},initialize:function(a,b){L.Toolbar.prototype.initialize.call(this,b),this._marker=new L.Marker(a,{icon:new L.DivIcon({className:this.options.className,iconAnchor:[0,0]})})},onAdd:function(a){this._map=a,this._marker.addTo(a),L.Toolbar.prototype.onAdd.call(this,a),this.appendToContainer(this._marker._icon),this._setStyles()},onRemove:function(a){a.removeLayer(this._marker),L.Toolbar.prototype.onRemove.call(this,a),delete this._map},setLatLng:function(a){return this._marker.setLatLng(a),this},_setStyles:function(){for(var a,b,d,e=this._container,f=this._ul,g=L.point(this.options.anchor),h=f.querySelectorAll(".leaflet-toolbar-icon"),i=[],j=0,k=0,l=h.length;l>k;k++)h[k].parentNode.parentNode===f&&(i.push(parseInt(L.DomUtil.getStyle(h[k],"height"),10)),j+=Math.ceil(parseFloat(L.DomUtil.getStyle(h[k],"width"))));f.style.width=j+"px",this._tipContainer=L.DomUtil.create("div","leaflet-toolbar-tip-container",e),this._tipContainer.style.width=j+"px",this._tip=L.DomUtil.create("div","leaflet-toolbar-tip",this._tipContainer),a=Math.max.apply(c,i),b=parseInt(L.DomUtil.getStyle(this._tip,"width"),10),d=new L.Point(j/2,a+.7071*b),e.style.marginLeft=g.x-d.x+"px",e.style.marginTop=g.y-d.y+"px"}}),L.toolbar.popup=function(a){return new L.Toolbar.Popup(a)}}(window,document);
@@ -1,22 +0,0 @@
1
- from umap.websocket_server import OperationMessage, PeerMessage, Request, ServerRequest
2
-
3
-
4
- def test_messages_are_parsed_correctly():
5
- server = Request.model_validate(dict(kind="Server", action="list-peers")).root
6
- assert type(server) is ServerRequest
7
-
8
- operation = Request.model_validate(
9
- dict(
10
- kind="OperationMessage",
11
- verb="upsert",
12
- subject="map",
13
- metadata={},
14
- key="key",
15
- )
16
- ).root
17
- assert type(operation) is OperationMessage
18
-
19
- peer_message = Request.model_validate(
20
- dict(kind="PeerMessage", sender="Alice", recipient="Bob", message={})
21
- ).root
22
- assert type(peer_message) is PeerMessage