qwc2 2025.11.5 → 2025.11.13

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 (54) hide show
  1. package/actions/layers.js +6 -29
  2. package/components/AttributeForm.js +104 -77
  3. package/components/AttributeTableWidget.js +89 -88
  4. package/components/IdentifyViewer.js +4 -2
  5. package/components/LinkFeatureForm.js +17 -9
  6. package/components/LocationRecorder.js +1 -1
  7. package/components/PickFeature.js +45 -33
  8. package/components/QtDesignerForm.js +20 -18
  9. package/components/StandardApp.js +4 -0
  10. package/components/ThemeList.js +9 -10
  11. package/package.json +2 -1
  12. package/plugins/Cyclomedia.js +1 -1
  13. package/plugins/Editing.js +306 -72
  14. package/plugins/FeatureForm.js +103 -111
  15. package/plugins/LayerTree.js +4 -1
  16. package/plugins/NewsPopup.js +2 -2
  17. package/plugins/Portal.js +3 -1
  18. package/plugins/Print.js +4 -4
  19. package/plugins/ThemeSwitcher.js +3 -0
  20. package/plugins/map/EditingSupport.js +2 -2
  21. package/plugins/map/RedliningSupport.js +1 -1
  22. package/plugins/style/Editing.css +34 -0
  23. package/reducers/editing.js +12 -7
  24. package/reducers/layers.js +27 -5
  25. package/reducers/locale.js +3 -0
  26. package/static/translations/bg-BG.json +9 -0
  27. package/static/translations/ca-ES.json +9 -0
  28. package/static/translations/cs-CZ.json +9 -0
  29. package/static/translations/de-CH.json +9 -0
  30. package/static/translations/de-DE.json +9 -0
  31. package/static/translations/en-US.json +9 -0
  32. package/static/translations/es-ES.json +9 -0
  33. package/static/translations/fi-FI.json +9 -0
  34. package/static/translations/fr-FR.json +9 -0
  35. package/static/translations/hu-HU.json +9 -0
  36. package/static/translations/it-IT.json +9 -0
  37. package/static/translations/ja-JP.json +9 -0
  38. package/static/translations/nl-NL.json +9 -0
  39. package/static/translations/no-NO.json +9 -0
  40. package/static/translations/pl-PL.json +9 -0
  41. package/static/translations/pt-BR.json +9 -0
  42. package/static/translations/pt-PT.json +9 -0
  43. package/static/translations/ro-RO.json +9 -0
  44. package/static/translations/ru-RU.json +9 -0
  45. package/static/translations/sv-SE.json +9 -0
  46. package/static/translations/tr-TR.json +9 -0
  47. package/static/translations/tsconfig.json +9 -0
  48. package/static/translations/uk-UA.json +9 -0
  49. package/utils/EditingUtils.js +11 -9
  50. package/utils/ElevationInterface.js +1 -2
  51. package/utils/LayerUtils.js +11 -7
  52. package/utils/LocaleUtils.js +0 -15
  53. package/utils/ServiceLayerUtils.js +55 -2
  54. package/utils/ThemeUtils.js +7 -2
@@ -864,14 +864,16 @@ var LayerUtils = {
864
864
  }
865
865
  return null;
866
866
  },
867
- searchLayer: function searchLayer(layers, layerUrl, layerName) {
867
+ searchLayer: function searchLayer(layers, attr, value, subattr, subval) {
868
868
  var match = null;
869
869
  layers.find(function (layer) {
870
870
  var sublayer = null;
871
- if (layer.url === layerUrl && (sublayer = LayerUtils.searchSubLayer(layer, 'name', layerName))) {
871
+ var path = [];
872
+ if (layer[attr] === value && (sublayer = LayerUtils.searchSubLayer(layer, subattr, subval, path))) {
872
873
  match = {
873
874
  layer: layer,
874
- sublayer: sublayer
875
+ sublayer: sublayer,
876
+ path: path
875
877
  };
876
878
  return true;
877
879
  }
@@ -1464,16 +1466,18 @@ var LayerUtils = {
1464
1466
  return reports;
1465
1467
  },
1466
1468
  computeVisbilityPreset: function computeVisbilityPreset(layer) {
1469
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
1467
1470
  var result = {};
1468
1471
  if (layer.sublayers) {
1472
+ var istoplevel = !!layer.url;
1469
1473
  layer.sublayers.forEach(function (sublayer) {
1470
- return Object.assign(result, LayerUtils.computeVisbilityPreset(sublayer));
1474
+ return Object.assign(result, LayerUtils.computeVisbilityPreset(sublayer, !istoplevel ? path + layer.name + "/" : ""));
1471
1475
  });
1472
- if (layer.visibility && !layer.url) {
1473
- result[layer.name] = "";
1476
+ if (layer.visibility && !istoplevel) {
1477
+ result[path + layer.name] = "";
1474
1478
  }
1475
1479
  } else if (layer.visibility) {
1476
- result[layer.name] = layer.style;
1480
+ result[path + layer.name] = layer.style;
1477
1481
  }
1478
1482
  return result;
1479
1483
  },
@@ -11,7 +11,6 @@ import axios from 'axios';
11
11
  import deepmerge from 'deepmerge';
12
12
  import StandardApp from '../components/StandardApp';
13
13
  import ConfigUtils from './ConfigUtils';
14
- var themeTranslationCache = {};
15
14
  var LocaleUtils = {
16
15
  loadLocale: function loadLocale(lang, fallbackLangData) {
17
16
  return new Promise(function (resolve) {
@@ -105,20 +104,6 @@ var LocaleUtils = {
105
104
  } else {
106
105
  return number.toFixed(decimals);
107
106
  }
108
- },
109
- loadThemeTranslations: function loadThemeTranslations(serviceUrl) {
110
- return new Promise(function (resolve) {
111
- if (serviceUrl in themeTranslationCache) {
112
- resolve(themeTranslationCache[serviceUrl]);
113
- } else {
114
- axios.get(serviceUrl + "?SERVICE=GetTranslations&LANG=" + LocaleUtils.lang()).then(function (response) {
115
- themeTranslationCache[serviceUrl] = response.data;
116
- resolve(response.data);
117
- })["catch"](function (e) {
118
- resolve({});
119
- });
120
- }
121
- });
122
107
  }
123
108
  };
124
109
  export default LocaleUtils;
@@ -34,7 +34,9 @@ import { LayerRole } from '../actions/layers';
34
34
  import ConfigUtils from './ConfigUtils';
35
35
  import CoordinatesUtils from './CoordinatesUtils';
36
36
  import LayerUtils from './LayerUtils';
37
+ import LocaleUtils from './LocaleUtils';
37
38
  import MiscUtils from './MiscUtils';
39
+ import StandardApp from '../components/StandardApp';
38
40
  function strcmp(a, b) {
39
41
  var al = a.toLowerCase();
40
42
  var bl = b.toLowerCase();
@@ -298,6 +300,20 @@ var ServiceLayerUtils = {
298
300
  } catch (e) {
299
301
  /* pass */
300
302
  }
303
+ var editConfigUrl = null;
304
+ var wmsName = null;
305
+ try {
306
+ editConfigUrl = layer.EditConfig.OnlineResource.href;
307
+ wmsName = layer.EditConfig.wms_name;
308
+ } catch (e) {
309
+ /* pass */
310
+ }
311
+ var translationsUrl = null;
312
+ try {
313
+ translationsUrl = layer.Traslations.OnlineResource.href;
314
+ } catch (e) {
315
+ /* pass */
316
+ }
301
317
  var dimensions = [];
302
318
  MiscUtils.ensureArray(layer.Dimension).forEach(function (dim) {
303
319
  var _dim$fieldName, _dim$endFieldName;
@@ -327,6 +343,9 @@ var ServiceLayerUtils = {
327
343
  url: getMapUrl,
328
344
  featureInfoUrl: featureInfoUrl,
329
345
  legendUrl: legendUrl,
346
+ editConfigUrl: editConfigUrl,
347
+ translationsUrl: translationsUrl,
348
+ wms_name: wmsName,
330
349
  version: version,
331
350
  infoFormats: infoFormats,
332
351
  mapFormats: mapFormats,
@@ -341,7 +360,8 @@ var ServiceLayerUtils = {
341
360
  maxScale: layer.MinScaleDenominator !== undefined ? Number(layer.MaxScaleDenominator) : undefined,
342
361
  dimensions: dimensions,
343
362
  styles: styles,
344
- style: style
363
+ style: style,
364
+ serverType: translationsUrl ? 'qgis' : null // If there is a translationsUrl, assume it is the qwc-ogc-service
345
365
  };
346
366
  },
347
367
  getWFSLayers: function getWFSLayers(capabilities, calledServiceUrl, mapCrs) {
@@ -606,7 +626,40 @@ var ServiceLayerUtils = {
606
626
  LAYERS: layerConfig.name
607
627
  };
608
628
  }
609
- callback(layerConfig.id, layer);
629
+ var metadataRequests = [new Promise(function (resolve, reject) {
630
+ if (layer.editConfigUrl) {
631
+ axios.get(layer.editConfigUrl).then(function (response) {
632
+ layer.editConfig = response.data;
633
+ delete layer.editConfigUrl;
634
+ resolve();
635
+ })["catch"](function (e) {
636
+ delete layer.editConfigUrl;
637
+ resolve();
638
+ });
639
+ } else {
640
+ resolve();
641
+ }
642
+ }), new Promise(function (resolve, reject) {
643
+ if (layer.translationsUrl) {
644
+ axios.get(layer.translationsUrl.replace('{lang}', LocaleUtils.lang())).then(function (response) {
645
+ layer.translations = response.data;
646
+ delete layer.translationsUrl;
647
+ resolve();
648
+ })["catch"](function (e) {
649
+ delete layer.translationsUrl;
650
+ resolve();
651
+ });
652
+ } else {
653
+ resolve();
654
+ }
655
+ })];
656
+ Promise.all(metadataRequests).then(function () {
657
+ if (layer.translations) {
658
+ var commonTranslations = StandardApp.store.getState().locale.messagesTree.maptranslations || {};
659
+ layer = LayerUtils.applyTranslations(layer, deepmerge(commonTranslations, layer.translations));
660
+ }
661
+ callback(layerConfig.id, layer);
662
+ });
610
663
  } else {
611
664
  // eslint-disable-next-line
612
665
  console.warn("Could not find layer " + layerConfig.name);
@@ -19,11 +19,13 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  */
21
21
 
22
+ import deepmerge from 'deepmerge';
22
23
  import { remove as removeDiacritics } from 'diacritics';
23
24
  import isEmpty from 'lodash.isempty';
24
25
  import url from 'url';
25
26
  import { v4 as uuidv4 } from 'uuid';
26
27
  import { LayerRole } from '../actions/layers';
28
+ import StandardApp from '../components/StandardApp';
27
29
  import { SearchResultType } from '../utils/SearchProviders';
28
30
  import ConfigUtils from './ConfigUtils';
29
31
  import LayerUtils from './LayerUtils';
@@ -173,7 +175,9 @@ var ThemeUtils = {
173
175
  LayerUtils.completeExternalLayer(res[cur.internalLayer], LayerUtils.searchSubLayer(theme, 'name', cur.internalLayer));
174
176
  return res;
175
177
  }, {})),
176
- translations: theme.translations
178
+ translations: theme.translations,
179
+ editConfig: theme.editConfig,
180
+ wms_name: theme.wms_name
177
181
  };
178
182
  layer = LayerUtils.recomputeLayerBBox(layer);
179
183
  // Drawing order only makes sense if layer reordering is disabled
@@ -332,11 +336,12 @@ var ThemeUtils = {
332
336
  }).filter(Boolean);
333
337
  },
334
338
  applyTranslations: function applyTranslations(group) {
339
+ var commonTranslations = StandardApp.store.getState().locale.messagesTree.maptranslations || {};
335
340
  return _objectSpread(_objectSpread({}, group), {}, {
336
341
  subdirs: group.subdirs ? group.subdirs.map(ThemeUtils.applyTranslations) : null,
337
342
  items: group.items ? group.items.map(function (item) {
338
343
  var _item$translations$th, _item$translations;
339
- return _objectSpread(_objectSpread({}, LayerUtils.applyTranslations(item, item.translations)), {}, {
344
+ return _objectSpread(_objectSpread({}, LayerUtils.applyTranslations(item, deepmerge(commonTranslations, item.translations))), {}, {
340
345
  title: (_item$translations$th = (_item$translations = item.translations) === null || _item$translations === void 0 || (_item$translations = _item$translations.theme) === null || _item$translations === void 0 ? void 0 : _item$translations.title) !== null && _item$translations$th !== void 0 ? _item$translations$th : item.title
341
346
  });
342
347
  }) : null