qwc2 2025.11.12 → 2025.11.15
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.
- package/components/AttributeForm.js +3 -5
- package/package.json +1 -1
- package/plugins/Editing.js +0 -1
- package/reducers/locale.js +3 -0
- package/utils/LayerUtils.js +15 -15
- package/utils/LocaleUtils.js +0 -15
- package/utils/ServiceLayerUtils.js +3 -1
- package/utils/ThemeUtils.js +4 -1
|
@@ -655,13 +655,12 @@ var AttributeForm = /*#__PURE__*/function (_React$Component) {
|
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
657
|
});
|
|
658
|
-
// Remove
|
|
658
|
+
// Remove expression fields
|
|
659
659
|
Object.keys(feature.properties).forEach(function (key) {
|
|
660
|
-
var _fieldConfig$constrai;
|
|
661
660
|
var fieldConfig = editConfig.fields.find(function (field) {
|
|
662
661
|
return field.id === key;
|
|
663
662
|
}) || {};
|
|
664
|
-
if (fieldConfig !== null && fieldConfig !== void 0 &&
|
|
663
|
+
if (fieldConfig !== null && fieldConfig !== void 0 && fieldConfig.expression) {
|
|
665
664
|
delete feature.properties[key];
|
|
666
665
|
}
|
|
667
666
|
});
|
|
@@ -676,11 +675,10 @@ var AttributeForm = /*#__PURE__*/function (_React$Component) {
|
|
|
676
675
|
var relEditConfig = _this.props.editConfigs[mapName][layerName];
|
|
677
676
|
entry.features.forEach(function (f) {
|
|
678
677
|
Object.keys(f.properties).forEach(function (key) {
|
|
679
|
-
var _fieldConfig$constrai2;
|
|
680
678
|
var fieldConfig = relEditConfig.fields.find(function (field) {
|
|
681
679
|
return field.id === key;
|
|
682
680
|
}) || {};
|
|
683
|
-
if (fieldConfig !== null && fieldConfig !== void 0 &&
|
|
681
|
+
if (fieldConfig !== null && fieldConfig !== void 0 && fieldConfig.expression) {
|
|
684
682
|
delete f.properties[key];
|
|
685
683
|
}
|
|
686
684
|
});
|
package/package.json
CHANGED
package/plugins/Editing.js
CHANGED
|
@@ -314,7 +314,6 @@ var Editing = /*#__PURE__*/function (_React$Component) {
|
|
|
314
314
|
});
|
|
315
315
|
_defineProperty(_this, "geomPicked", function (layer, feature, mapName) {
|
|
316
316
|
var _this$props$editConte2;
|
|
317
|
-
console.log(mapName);
|
|
318
317
|
var geomType = _this.props.editContext.geomType;
|
|
319
318
|
var geometry = feature.geometry;
|
|
320
319
|
if (geometry.type !== geomType) {
|
package/reducers/locale.js
CHANGED
|
@@ -13,6 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import deepmerge from 'deepmerge';
|
|
16
17
|
import { flatten } from 'flat';
|
|
17
18
|
import { CHANGE_LOCALE, ADD_TRANSLATIONS } from '../actions/locale';
|
|
18
19
|
var defaultState = {
|
|
@@ -27,6 +28,7 @@ export default function locale() {
|
|
|
27
28
|
case CHANGE_LOCALE:
|
|
28
29
|
{
|
|
29
30
|
return {
|
|
31
|
+
messagesTree: action.messages,
|
|
30
32
|
messages: flatten(action.messages),
|
|
31
33
|
fallbackMessages: flatten(action.fallbackMessages),
|
|
32
34
|
current: action.locale
|
|
@@ -35,6 +37,7 @@ export default function locale() {
|
|
|
35
37
|
case ADD_TRANSLATIONS:
|
|
36
38
|
{
|
|
37
39
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
40
|
+
messagesTree: deepmerge(state.messages, action.translations[state.current]),
|
|
38
41
|
messages: _objectSpread(_objectSpread({}, state.messages), flatten(action.translations[state.current] || {}))
|
|
39
42
|
});
|
|
40
43
|
}
|
package/utils/LayerUtils.js
CHANGED
|
@@ -1466,16 +1466,18 @@ var LayerUtils = {
|
|
|
1466
1466
|
return reports;
|
|
1467
1467
|
},
|
|
1468
1468
|
computeVisbilityPreset: function computeVisbilityPreset(layer) {
|
|
1469
|
+
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1469
1470
|
var result = {};
|
|
1470
1471
|
if (layer.sublayers) {
|
|
1472
|
+
var istoplevel = !!layer.url;
|
|
1471
1473
|
layer.sublayers.forEach(function (sublayer) {
|
|
1472
|
-
return Object.assign(result, LayerUtils.computeVisbilityPreset(sublayer));
|
|
1474
|
+
return Object.assign(result, LayerUtils.computeVisbilityPreset(sublayer, !istoplevel ? path + layer.name + "/" : ""));
|
|
1473
1475
|
});
|
|
1474
|
-
if (layer.visibility && !
|
|
1475
|
-
result[layer.name] = "";
|
|
1476
|
+
if (layer.visibility && !istoplevel) {
|
|
1477
|
+
result[path + layer.name] = "";
|
|
1476
1478
|
}
|
|
1477
1479
|
} else if (layer.visibility) {
|
|
1478
|
-
result[layer.name] = layer.style;
|
|
1480
|
+
result[path + layer.name] = layer.style;
|
|
1479
1481
|
}
|
|
1480
1482
|
return result;
|
|
1481
1483
|
},
|
|
@@ -1500,23 +1502,21 @@ var LayerUtils = {
|
|
|
1500
1502
|
return null;
|
|
1501
1503
|
},
|
|
1502
1504
|
applyVisibilityPreset: function applyVisibilityPreset(layer, preset) {
|
|
1505
|
+
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1503
1506
|
var newLayer = _objectSpread({}, layer);
|
|
1507
|
+
var itempath = [].concat(_toConsumableArray(path.slice(1)), [newLayer.name]).join("/");
|
|
1504
1508
|
if (newLayer.sublayers) {
|
|
1505
|
-
|
|
1509
|
+
newLayer.visibility = itempath in preset;
|
|
1506
1510
|
newLayer.sublayers = newLayer.sublayers.map(function (sublayer) {
|
|
1507
|
-
|
|
1508
|
-
haveVisibileSublayer || (haveVisibileSublayer = newSublayer.visibility === true);
|
|
1509
|
-
return newSublayer;
|
|
1511
|
+
return LayerUtils.applyVisibilityPreset(sublayer, preset, [].concat(_toConsumableArray(path), [layer.name]));
|
|
1510
1512
|
});
|
|
1511
|
-
|
|
1512
|
-
if (
|
|
1513
|
+
} else {
|
|
1514
|
+
if (itempath in preset) {
|
|
1513
1515
|
newLayer.visibility = true;
|
|
1516
|
+
newLayer.style = preset[itempath];
|
|
1517
|
+
} else {
|
|
1518
|
+
newLayer.visibility = false;
|
|
1514
1519
|
}
|
|
1515
|
-
} else if (newLayer.name in preset) {
|
|
1516
|
-
newLayer.visibility = true;
|
|
1517
|
-
newLayer.style = preset[newLayer.name];
|
|
1518
|
-
} else {
|
|
1519
|
-
newLayer.visibility = false;
|
|
1520
1520
|
}
|
|
1521
1521
|
return newLayer;
|
|
1522
1522
|
},
|
package/utils/LocaleUtils.js
CHANGED
|
@@ -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;
|
|
@@ -36,6 +36,7 @@ import CoordinatesUtils from './CoordinatesUtils';
|
|
|
36
36
|
import LayerUtils from './LayerUtils';
|
|
37
37
|
import LocaleUtils from './LocaleUtils';
|
|
38
38
|
import MiscUtils from './MiscUtils';
|
|
39
|
+
import StandardApp from '../components/StandardApp';
|
|
39
40
|
function strcmp(a, b) {
|
|
40
41
|
var al = a.toLowerCase();
|
|
41
42
|
var bl = b.toLowerCase();
|
|
@@ -654,7 +655,8 @@ var ServiceLayerUtils = {
|
|
|
654
655
|
})];
|
|
655
656
|
Promise.all(metadataRequests).then(function () {
|
|
656
657
|
if (layer.translations) {
|
|
657
|
-
|
|
658
|
+
var commonTranslations = StandardApp.store.getState().locale.messagesTree.maptranslations || {};
|
|
659
|
+
layer = LayerUtils.applyTranslations(layer, deepmerge(commonTranslations, layer.translations));
|
|
658
660
|
}
|
|
659
661
|
callback(layerConfig.id, layer);
|
|
660
662
|
});
|
package/utils/ThemeUtils.js
CHANGED
|
@@ -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';
|
|
@@ -334,11 +336,12 @@ var ThemeUtils = {
|
|
|
334
336
|
}).filter(Boolean);
|
|
335
337
|
},
|
|
336
338
|
applyTranslations: function applyTranslations(group) {
|
|
339
|
+
var commonTranslations = StandardApp.store.getState().locale.messagesTree.maptranslations || {};
|
|
337
340
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
338
341
|
subdirs: group.subdirs ? group.subdirs.map(ThemeUtils.applyTranslations) : null,
|
|
339
342
|
items: group.items ? group.items.map(function (item) {
|
|
340
343
|
var _item$translations$th, _item$translations;
|
|
341
|
-
return _objectSpread(_objectSpread({}, LayerUtils.applyTranslations(item, item.translations)), {}, {
|
|
344
|
+
return _objectSpread(_objectSpread({}, LayerUtils.applyTranslations(item, deepmerge(commonTranslations, item.translations))), {}, {
|
|
342
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
|
|
343
346
|
});
|
|
344
347
|
}) : null
|