umap-project 2.8.0__py3-none-any.whl → 2.8.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.
Files changed (53) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/en/LC_MESSAGES/django.po +13 -13
  3. umap/management/commands/empty_trash.py +2 -5
  4. umap/management/commands/migrate_to_S3.py +3 -3
  5. umap/settings/base.py +2 -2
  6. umap/static/umap/css/form.css +0 -3
  7. umap/static/umap/js/modules/data/features.js +4 -19
  8. umap/static/umap/js/modules/data/layer.js +19 -41
  9. umap/static/umap/js/modules/importer.js +20 -65
  10. umap/static/umap/js/modules/rendering/icon.js +1 -2
  11. umap/static/umap/js/modules/rendering/map.js +7 -7
  12. umap/static/umap/js/modules/rendering/popup.js +10 -9
  13. umap/static/umap/js/modules/rendering/template.js +9 -53
  14. umap/static/umap/js/modules/rendering/ui.js +2 -6
  15. umap/static/umap/js/modules/request.js +2 -2
  16. umap/static/umap/js/modules/schema.js +0 -1
  17. umap/static/umap/js/modules/ui/dialog.js +0 -5
  18. umap/static/umap/js/modules/umap.js +10 -33
  19. umap/static/umap/js/modules/utils.js +0 -2
  20. umap/static/umap/js/umap.controls.js +4 -7
  21. umap/static/umap/js/umap.forms.js +0 -44
  22. umap/static/umap/locale/en.js +1 -3
  23. umap/static/umap/locale/en.json +1 -3
  24. umap/static/umap/locale/fr.js +1 -3
  25. umap/static/umap/locale/fr.json +1 -3
  26. umap/static/umap/map.css +166 -34
  27. umap/static/umap/vars.css +1 -0
  28. umap/storage.py +216 -0
  29. umap/templates/base.html +0 -2
  30. umap/templates/umap/components/alerts/alert.html +0 -4
  31. umap/templates/umap/css.html +0 -3
  32. umap/templates/umap/js.html +0 -2
  33. umap/templates/umap/map_init.html +0 -2
  34. umap/templates/umap/user_dashboard.html +0 -2
  35. umap/tests/integration/test_edit_datalayer.py +0 -11
  36. umap/tests/integration/test_import.py +1 -20
  37. umap/tests/test_datalayer_s3.py +1 -1
  38. umap/tests/test_statics.py +1 -1
  39. umap/tests/test_team_views.py +1 -35
  40. umap/tests/test_views.py +74 -0
  41. umap/views.py +15 -20
  42. {umap_project-2.8.0.dist-info → umap_project-2.8.0a0.dist-info}/METADATA +1 -1
  43. {umap_project-2.8.0.dist-info → umap_project-2.8.0a0.dist-info}/RECORD +46 -52
  44. umap/settings/local_s3.py +0 -45
  45. umap/storage/__init__.py +0 -3
  46. umap/storage/fs.py +0 -101
  47. umap/storage/s3.py +0 -61
  48. umap/storage/staticfiles.py +0 -64
  49. umap/tests/fixtures/test_upload_simple_marker.json +0 -19
  50. umap/tests/test_dashboard.py +0 -82
  51. {umap_project-2.8.0.dist-info → umap_project-2.8.0a0.dist-info}/WHEEL +0 -0
  52. {umap_project-2.8.0.dist-info → umap_project-2.8.0a0.dist-info}/entry_points.txt +0 -0
  53. {umap_project-2.8.0.dist-info → umap_project-2.8.0a0.dist-info}/licenses/LICENSE +0 -0
@@ -238,15 +238,11 @@ export const LeafletMarker = Marker.extend({
238
238
  },
239
239
 
240
240
  highlight: function () {
241
- this.feature.activate()
242
- this._redraw()
243
- this._bringToFront()
241
+ DomUtil.addClass(this.options.icon.elements.main, 'umap-icon-active')
244
242
  },
245
243
 
246
244
  resetHighlight: function () {
247
- this.feature.deactivate()
248
- this._redraw()
249
- this._resetZIndex()
245
+ DomUtil.removeClass(this.options.icon.elements.main, 'umap-icon-active')
250
246
  },
251
247
 
252
248
  getPopupToolbarAnchor: function () {
@@ -47,8 +47,8 @@ class BaseRequest {
47
47
  // In case of error, an alert is sent, but non 20X status are not handled
48
48
  // The consumer must check the response status by hand
49
49
  export class Request extends BaseRequest {
50
- fire(name, detail) {
51
- document.body.dispatchEvent(new CustomEvent(name, { detail }))
50
+ fire(name, params) {
51
+ document.body.dispatchEvent(new CustomEvent(name, params))
52
52
  }
53
53
 
54
54
  async _fetch(method, uri, headers, data) {
@@ -404,7 +404,6 @@ export const SCHEMA = {
404
404
  ['GeoRSSImage', translate('GeoRSS (title + image)')],
405
405
  ['GeoRSSLink', translate('GeoRSS (only link)')],
406
406
  ['OSM', translate('OpenStreetMap')],
407
- ['Wikipedia', translate('Wikipedia')],
408
407
  ],
409
408
  default: 'Default',
410
409
  },
@@ -6,7 +6,6 @@ const TEMPLATE = `
6
6
  <form method="dialog" data-ref="form">
7
7
  <ul class="buttons">
8
8
  <li><i class="icon icon-16 icon-close" data-close></i></li>
9
- <li hidden data-ref="back"><i class="icon icon-16 icon-back"></i></li>
10
9
  </ul>
11
10
  <h3 data-ref="message" id="${Math.round(Date.now()).toString(36)}"></h3>
12
11
  <fieldset data-ref="fieldset" role="document">
@@ -124,10 +123,6 @@ export default class Dialog extends WithTemplate {
124
123
  } else {
125
124
  this.elements.template.innerHTML = dialog.template || ''
126
125
  }
127
- this.elements.back.hidden = !dialog.back
128
- if (dialog.back) {
129
- this.elements.back.addEventListener('click', dialog.back)
130
- }
131
126
 
132
127
  this.focusable = this.getFocusable()
133
128
  this.hasFormData = this.elements.fieldset.elements.length > 0
@@ -218,14 +218,6 @@ export default class Umap extends ServerStored {
218
218
  this.fire('seteditedfeature')
219
219
  }
220
220
 
221
- get activeFeature() {
222
- return this._activeFeature
223
- }
224
-
225
- set activeFeature(feature) {
226
- this._activeFeature = feature
227
- }
228
-
229
221
  setPropertiesFromQueryString() {
230
222
  const asBoolean = (key) => {
231
223
  const value = this.searchParams.get(key)
@@ -324,14 +316,12 @@ export default class Umap extends ServerStored {
324
316
  dataUrl = this.renderUrl(dataUrl)
325
317
  dataUrl = this.proxyUrl(dataUrl)
326
318
  const datalayer = this.createDataLayer()
327
- await datalayer
328
- .importFromUrl(dataUrl, dataFormat)
329
- .then(() => datalayer.zoomTo())
319
+ await datalayer.importFromUrl(dataUrl, dataFormat)
330
320
  }
331
321
  } else if (data) {
332
322
  data = decodeURIComponent(data)
333
323
  const datalayer = this.createDataLayer()
334
- await datalayer.importRaw(data, dataFormat).then(() => datalayer.zoomTo())
324
+ await datalayer.importRaw(data, dataFormat)
335
325
  }
336
326
  }
337
327
 
@@ -578,11 +568,9 @@ export default class Umap extends ServerStored {
578
568
  }
579
569
  this.datalayersLoaded = true
580
570
  this.fire('datalayersloaded')
581
- const toLoad = []
582
571
  for (const datalayer of this.datalayersIndex) {
583
- if (datalayer.showAtLoad()) toLoad.push(datalayer.show())
572
+ if (datalayer.showAtLoad()) await datalayer.show()
584
573
  }
585
- await Promise.all(toLoad)
586
574
  this.dataloaded = true
587
575
  this.fire('dataloaded')
588
576
  }
@@ -653,12 +641,6 @@ export default class Umap extends ServerStored {
653
641
  // have changed, we'll be more subtil when we'll remove the
654
642
  // save action
655
643
  this.render(['name', 'user', 'permissions'])
656
- if (!this._leafletMap.listens('saved')) {
657
- // When we save only layers, we don't have the map feedback message
658
- this._leafletMap.on('saved', () => {
659
- Alert.success(translate('Map has been saved!'))
660
- })
661
- }
662
644
  this.fire('saved')
663
645
  }
664
646
 
@@ -1117,8 +1099,8 @@ export default class Umap extends ServerStored {
1117
1099
  }
1118
1100
  this.ensurePanesOrder()
1119
1101
  this._leafletMap.initTileLayers()
1102
+ this.isDirty = false
1120
1103
  this.onDataLayersChanged()
1121
- this.isDirty = !this.id
1122
1104
  }
1123
1105
 
1124
1106
  async save() {
@@ -1200,7 +1182,7 @@ export default class Umap extends ServerStored {
1200
1182
  geometry() {
1201
1183
  /* Return a GeoJSON geometry Object */
1202
1184
  const latlng = this._leafletMap.latLng(
1203
- this.properties.center || this._leafletMap.getCenter()
1185
+ this._leafletMap.options.center || this._leafletMap.getCenter()
1204
1186
  )
1205
1187
  return {
1206
1188
  type: 'Point',
@@ -1442,14 +1424,9 @@ export default class Umap extends ServerStored {
1442
1424
  const row = DomUtil.create('li', 'orderable', ul)
1443
1425
  DomUtil.createIcon(row, 'icon-drag', translate('Drag to reorder'))
1444
1426
  datalayer.renderToolbox(row)
1445
- const builder = new U.FormBuilder(
1446
- datalayer,
1447
- [['options.name', { handler: 'EditableText' }]],
1448
- { className: 'umap-form-inline' }
1449
- )
1450
- const form = builder.build()
1451
- row.appendChild(form)
1427
+ const title = DomUtil.add('span', '', row, datalayer.options.name)
1452
1428
  row.classList.toggle('off', !datalayer.isVisible())
1429
+ title.textContent = datalayer.options.name
1453
1430
  row.dataset.id = stamp(datalayer)
1454
1431
  })
1455
1432
  const onReorder = (src, dst, initialIndex, finalIndex) => {
@@ -1537,7 +1514,7 @@ export default class Umap extends ServerStored {
1537
1514
  processFileToImport(file, layer, type) {
1538
1515
  type = type || Utils.detectFileType(file)
1539
1516
  if (!type) {
1540
- Alert.error(
1517
+ U.Alert.error(
1541
1518
  translate('Unable to detect format of file {filename}', {
1542
1519
  filename: file.name,
1543
1520
  })
@@ -1683,8 +1660,8 @@ export default class Umap extends ServerStored {
1683
1660
  }
1684
1661
 
1685
1662
  _setCenterAndZoom() {
1686
- this.properties.center = this._leafletMap.getCenter()
1687
- this.properties.zoom = this._leafletMap.getZoom()
1663
+ this._leafletMap.options.center = this._leafletMap.getCenter()
1664
+ this._leafletMap.options.zoom = this._leafletMap.getZoom()
1688
1665
  this.isDirty = true
1689
1666
  this._defaultExtent = false
1690
1667
  }
@@ -115,8 +115,6 @@ export function escapeHTML(s) {
115
115
  'span',
116
116
  'dt',
117
117
  'dd',
118
- 'b',
119
- 'i',
120
118
  ],
121
119
  ADD_ATTR: [
122
120
  'target',
@@ -683,13 +683,10 @@ U.TileLayerChooser = L.Control.extend({
683
683
  L.DomEvent.on(
684
684
  el,
685
685
  'click',
686
- () => {
686
+ function () {
687
687
  this.map.selectTileLayer(tilelayer)
688
688
  this.map._controls.tilelayers.setLayers()
689
- if (options?.edit) {
690
- this.map._umap.properties.tilelayer = tilelayer.toJSON()
691
- this.map._umap.isDirty = true
692
- }
689
+ if (options?.callback) options.callback(tilelayer)
693
690
  },
694
691
  this
695
692
  )
@@ -945,11 +942,11 @@ L.Control.Loading.include({
945
942
  },
946
943
 
947
944
  _showIndicator: function () {
948
- this._map._container.classList.add('umap-loading')
945
+ L.DomUtil.addClass(this._map._container, 'umap-loading')
949
946
  },
950
947
 
951
948
  _hideIndicator: function () {
952
- this._map._container.classList.remove('umap-loading')
949
+ L.DomUtil.removeClass(this._map._container, 'umap-loading')
953
950
  },
954
951
  })
955
952
 
@@ -259,35 +259,6 @@ L.FormBuilder.CheckBox.include({
259
259
  },
260
260
  })
261
261
 
262
- L.FormBuilder.EditableText = L.FormBuilder.Element.extend({
263
- build: function () {
264
- this.input = L.DomUtil.create('span', this.options.className || '', this.parentNode)
265
- this.input.contentEditable = true
266
- this.fetch()
267
- L.DomEvent.on(this.input, 'input', this.sync, this)
268
- L.DomEvent.on(this.input, 'keypress', this.onKeyPress, this)
269
- },
270
-
271
- getParentNode: function () {
272
- return this.form
273
- },
274
-
275
- value: function () {
276
- return this.input.textContent
277
- },
278
-
279
- fetch: function () {
280
- this.input.textContent = this.toHTML()
281
- },
282
-
283
- onKeyPress: function (event) {
284
- if (event.keyCode === 13) {
285
- event.preventDefault()
286
- this.input.blur()
287
- }
288
- },
289
- })
290
-
291
262
  L.FormBuilder.ColorPicker = L.FormBuilder.Input.extend({
292
263
  colors: U.COLORS,
293
264
  getParentNode: function () {
@@ -1221,21 +1192,6 @@ U.FormBuilder = L.FormBuilder.extend({
1221
1192
  }
1222
1193
  },
1223
1194
 
1224
- getter: function (field) {
1225
- const path = field.split('.')
1226
- let value = this.obj
1227
- let sub
1228
- for (sub of path) {
1229
- try {
1230
- value = value[sub]
1231
- } catch {
1232
- console.log(field)
1233
- }
1234
- }
1235
- if (value === undefined) values = U.SCHEMA[sub]?.default
1236
- return value
1237
- },
1238
-
1239
1195
  finish: (event) => {
1240
1196
  event.helper?.input?.blur()
1241
1197
  },
@@ -520,9 +520,7 @@ const locale = {
520
520
  "Import helpers": "Import helpers",
521
521
  "Import helpers will fill the URL field for you.": "Import helpers will fill the URL field for you.",
522
522
  "Wikipedia": "Wikipedia",
523
- "Save draft": "Save draft",
524
- "No data has been found for import": "No data has been found for import",
525
- "Successfully imported {count} feature(s)": "Successfully imported {count} feature(s)"
523
+ "Save draft": "Save draft"
526
524
  }
527
525
  L.registerLocale("en", locale)
528
526
  L.setLocale("en")
@@ -520,7 +520,5 @@
520
520
  "Import helpers": "Import helpers",
521
521
  "Import helpers will fill the URL field for you.": "Import helpers will fill the URL field for you.",
522
522
  "Wikipedia": "Wikipedia",
523
- "Save draft": "Save draft",
524
- "No data has been found for import": "No data has been found for import",
525
- "Successfully imported {count} feature(s)": "Successfully imported {count} feature(s)"
523
+ "Save draft": "Save draft"
526
524
  }
@@ -520,9 +520,7 @@ const locale = {
520
520
  "Import helpers": "Assistants d'import",
521
521
  "Import helpers will fill the URL field for you.": "Les assistants d'import vont renseigner le champ URL pour vous.",
522
522
  "Wikipedia": "Wikipedia",
523
- "Save draft": "Enregistrer le brouillon",
524
- "No data has been found for import": "Aucunes données à importer",
525
- "Successfully imported {count} feature(s)": "{count} élément(s) ajouté(s) à la carte"
523
+ "Save draft": "Enregistrer le brouillon"
526
524
  }
527
525
  L.registerLocale("fr", locale)
528
526
  L.setLocale("fr")
@@ -520,7 +520,5 @@
520
520
  "Import helpers": "Assistants d'import",
521
521
  "Import helpers will fill the URL field for you.": "Les assistants d'import vont renseigner le champ URL pour vous.",
522
522
  "Wikipedia": "Wikipedia",
523
- "Save draft": "Enregistrer le brouillon",
524
- "No data has been found for import": "Aucunes données à importer",
525
- "Successfully imported {count} feature(s)": "{count} élément(s) ajouté(s) à la carte"
523
+ "Save draft": "Enregistrer le brouillon"
526
524
  }
umap/static/umap/map.css CHANGED
@@ -924,6 +924,7 @@ a.umap-control-caption,
924
924
  width: 2px;
925
925
  }
926
926
  .umap-icon-active {
927
+ z-index: var(--zindex-icon-active)!important;
927
928
  opacity: 1.0!important;
928
929
  }
929
930
  .umap-edit-enabled .readonly {
@@ -934,42 +935,173 @@ a.umap-control-caption,
934
935
  /* ********************************* */
935
936
  /* Ajax loader */
936
937
  /* ********************************* */
938
+ .umap-loading .umap-loader
939
+ {
940
+ display: block;
941
+ -webkit-animation: shift-rightwards 3s ease-in-out infinite;
942
+ -moz-animation: shift-rightwards 3s ease-in-out infinite;
943
+ -ms-animation: shift-rightwards 3s ease-in-out infinite;
944
+ -o-animation: shift-rightwards 3s ease-in-out infinite;
945
+ animation: shift-rightwards 3s ease-in-out infinite;
946
+ -webkit-animation-delay: .2s;
947
+ -moz-animation-delay: .2s;
948
+ -o-animation-delay: .2s;
949
+ animation-delay: .2s;
950
+ }
937
951
  .umap-loader {
938
- width: 100%;
939
- height: 6px;
940
- display: inline-block;
941
- position: absolute;
942
- background: var(--color-brightCyan);
943
- overflow: hidden;
944
- display: none;
945
- top: 0;
946
- left: 0;
947
- right: 0;
948
- height: 4px;
949
- z-index: var(--zindex-loader);
950
- }
951
- .umap-loader::after {
952
- content: '';
953
- box-sizing: border-box;
954
- width: 0;
955
- height: 4.8px;
956
- background: var(--color-darkerGray);
957
- position: absolute;
958
- top: 0;
959
- left: 0;
960
- animation: animFw 10s linear infinite;
961
- }
962
-
963
- @keyframes animFw {
964
- 0% {
965
- width: 0;
966
- }
967
- 100% {
968
- width: 100%;
969
- }
952
+ position: absolute;
953
+ display: none;
954
+ top: 0;
955
+ left: 0;
956
+ right: 0;
957
+ height: 4px;
958
+ z-index: var(--zindex-loader);
959
+ background-color: #79c1c0 !important;
960
+ -webkit-transform: translateX(100%);
961
+ -moz-transform: translateX(100%);
962
+ -o-transform: translateX(100%);
963
+ transform: translateX(100%);
970
964
  }
971
- .umap-loading .umap-loader {
972
- display: block;
965
+
966
+
967
+ @-webkit-keyframes shift-rightwards
968
+ {
969
+ 0%
970
+ {
971
+ -webkit-transform:translateX(-100%);
972
+ -moz-transform:translateX(-100%);
973
+ -o-transform:translateX(-100%);
974
+ transform:translateX(-100%);
975
+ }
976
+
977
+ 40%
978
+ {
979
+ -webkit-transform:translateX(0%);
980
+ -moz-transform:translateX(0%);
981
+ -o-transform:translateX(0%);
982
+ transform:translateX(0%);
983
+ }
984
+
985
+ 60%
986
+ {
987
+ -webkit-transform:translateX(0%);
988
+ -moz-transform:translateX(0%);
989
+ -o-transform:translateX(0%);
990
+ transform:translateX(0%);
991
+ }
992
+
993
+ 100%
994
+ {
995
+ -webkit-transform:translateX(100%);
996
+ -moz-transform:translateX(100%);
997
+ -o-transform:translateX(100%);
998
+ transform:translateX(100%);
999
+ }
1000
+
1001
+ }
1002
+ @-moz-keyframes shift-rightwards
1003
+ {
1004
+ 0%
1005
+ {
1006
+ -webkit-transform:translateX(-100%);
1007
+ -moz-transform:translateX(-100%);
1008
+ -o-transform:translateX(-100%);
1009
+ transform:translateX(-100%);
1010
+ }
1011
+
1012
+ 40%
1013
+ {
1014
+ -webkit-transform:translateX(0%);
1015
+ -moz-transform:translateX(0%);
1016
+ -o-transform:translateX(0%);
1017
+ transform:translateX(0%);
1018
+ }
1019
+
1020
+ 60%
1021
+ {
1022
+ -webkit-transform:translateX(0%);
1023
+ -moz-transform:translateX(0%);
1024
+ -o-transform:translateX(0%);
1025
+ transform:translateX(0%);
1026
+ }
1027
+
1028
+ 100%
1029
+ {
1030
+ -webkit-transform:translateX(100%);
1031
+ -moz-transform:translateX(100%);
1032
+ -o-transform:translateX(100%);
1033
+ transform:translateX(100%);
1034
+ }
1035
+
1036
+ }
1037
+ @-o-keyframes shift-rightwards
1038
+ {
1039
+ 0%
1040
+ {
1041
+ -webkit-transform:translateX(-100%);
1042
+ -moz-transform:translateX(-100%);
1043
+ -o-transform:translateX(-100%);
1044
+ transform:translateX(-100%);
1045
+ }
1046
+
1047
+ 40%
1048
+ {
1049
+ -webkit-transform:translateX(0%);
1050
+ -moz-transform:translateX(0%);
1051
+ -o-transform:translateX(0%);
1052
+ transform:translateX(0%);
1053
+ }
1054
+
1055
+ 60%
1056
+ {
1057
+ -webkit-transform:translateX(0%);
1058
+ -moz-transform:translateX(0%);
1059
+ -o-transform:translateX(0%);
1060
+ transform:translateX(0%);
1061
+ }
1062
+
1063
+ 100%
1064
+ {
1065
+ -webkit-transform:translateX(100%);
1066
+ -moz-transform:translateX(100%);
1067
+ -o-transform:translateX(100%);
1068
+ transform:translateX(100%);
1069
+ }
1070
+
1071
+ }
1072
+ @keyframes shift-rightwards
1073
+ {
1074
+ 0%
1075
+ {
1076
+ -webkit-transform:translateX(-100%);
1077
+ -moz-transform:translateX(-100%);
1078
+ -o-transform:translateX(-100%);
1079
+ transform:translateX(-100%);
1080
+ }
1081
+
1082
+ 40%
1083
+ {
1084
+ -webkit-transform:translateX(0%);
1085
+ -moz-transform:translateX(0%);
1086
+ -o-transform:translateX(0%);
1087
+ transform:translateX(0%);
1088
+ }
1089
+
1090
+ 60%
1091
+ {
1092
+ -webkit-transform:translateX(0%);
1093
+ -moz-transform:translateX(0%);
1094
+ -o-transform:translateX(0%);
1095
+ transform:translateX(0%);
1096
+ }
1097
+
1098
+ 100%
1099
+ {
1100
+ -webkit-transform:translateX(100%);
1101
+ -moz-transform:translateX(100%);
1102
+ -o-transform:translateX(100%);
1103
+ transform:translateX(100%);
1104
+ }
973
1105
  }
974
1106
 
975
1107
  /* *************************** */
umap/static/umap/vars.css CHANGED
@@ -48,6 +48,7 @@
48
48
  --zindex-autocomplete: 470;
49
49
  --zindex-dialog: 460;
50
50
  --zindex-contextmenu: 455;
51
+ --zindex-icon-active: 450;
51
52
  --zindex-tooltip: 445;
52
53
  --zindex-panels: 440;
53
54
  --zindex-controls: 430;