qwc2 2025.10.15 → 2025.10.24
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/actions/locate.js +3 -2
- package/components/AttributeTableWidget.js +24 -15
- package/components/FeatureAttributesWindow.js +177 -0
- package/components/IdentifyViewer.js +450 -319
- package/components/LocationRecorder.js +138 -0
- package/components/PickFeature.js +87 -26
- package/components/PluginsContainer.js +16 -3
- package/components/map/OlLayer.js +2 -1
- package/components/map3d/HeightProfile3D.js +2 -0
- package/components/map3d/Map3D.js +1 -1
- package/components/style/App.css +18 -0
- package/components/style/AttributeTableWidget.css +2 -1
- package/components/style/FeatureAttributesWindow.css +16 -0
- package/components/style/IdentifyViewer.css +56 -80
- package/components/style/LocationRecorder.css +10 -0
- package/components/style/NumericInputWindow.css +7 -0
- package/components/style/PluginsContainer.css +16 -0
- package/components/widgets/LayerCatalogWidget.js +40 -16
- package/components/widgets/NavBar.js +12 -5
- package/components/widgets/style/NavBar.css +0 -1
- package/icons/circle_full.svg +75 -0
- package/icons/eye-slash.svg +138 -0
- package/icons/pin.svg +41 -0
- package/icons/unpin.svg +41 -0
- package/package.json +1 -1
- package/plugins/AttributeTable.js +4 -0
- package/plugins/GeometryDigitizer.js +3 -0
- package/plugins/HeightProfile.js +2 -0
- package/plugins/Identify.js +12 -7
- package/plugins/ObjectList.js +116 -0
- package/plugins/Redlining.js +14 -55
- package/plugins/map/EditingSupport.js +22 -1
- package/plugins/map/LocateSupport.js +8 -1
- package/plugins/map/RedliningSupport.js +108 -18
- package/plugins/map/SnappingSupport.js +11 -6
- package/plugins/map/style/SnappingSupport.css +2 -13
- package/reducers/locate.js +4 -2
- package/reducers/redlining.js +2 -1
- package/static/translations/bg-BG.json +16 -1
- package/static/translations/ca-ES.json +16 -1
- package/static/translations/cs-CZ.json +15 -0
- package/static/translations/de-CH.json +17 -2
- package/static/translations/de-DE.json +18 -3
- package/static/translations/en-US.json +16 -1
- package/static/translations/es-ES.json +15 -0
- package/static/translations/fi-FI.json +15 -0
- package/static/translations/fr-FR.json +16 -1
- package/static/translations/hu-HU.json +15 -0
- package/static/translations/it-IT.json +16 -1
- package/static/translations/ja-JP.json +16 -1
- package/static/translations/nl-NL.json +15 -0
- package/static/translations/no-NO.json +15 -0
- package/static/translations/pl-PL.json +15 -0
- package/static/translations/pt-BR.json +15 -0
- package/static/translations/pt-PT.json +15 -0
- package/static/translations/ro-RO.json +15 -0
- package/static/translations/ru-RU.json +15 -0
- package/static/translations/sv-SE.json +15 -0
- package/static/translations/tr-TR.json +15 -0
- package/static/translations/tsconfig.json +12 -0
- package/static/translations/uk-UA.json +15 -0
- package/utils/EditingInterface.js +4 -1
- package/utils/EditingUtils.js +3 -1
- package/utils/MiscUtils.js +118 -0
- package/utils/expr_grammar/grammar.js +104 -22
- package/utils/expr_grammar/grammar.ne +2 -0
- package/utils/expr_grammar/test.js +21 -4
package/actions/locate.js
CHANGED
|
@@ -19,10 +19,11 @@ export function changeLocateState(state) {
|
|
|
19
19
|
state: state
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
export function changeLocatePosition(position) {
|
|
22
|
+
export function changeLocatePosition(position, mapPos) {
|
|
23
23
|
return {
|
|
24
24
|
type: CHANGE_LOCATE_POSITION,
|
|
25
|
-
position: position
|
|
25
|
+
position: position,
|
|
26
|
+
mapPos: mapPos
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
export function onLocateError(error) {
|
|
@@ -123,7 +123,7 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
123
123
|
loadedLayer: ""
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
}, bbox, (_this$props$filter$fi = _this.props.filter.filterParams) === null || _this$props$filter$fi === void 0 ? void 0 : _this$props$filter$fi[selectedLayer], _this.props.filter.filterGeom);
|
|
126
|
+
}, bbox, (_this$props$filter$fi = _this.props.filter.filterParams) === null || _this$props$filter$fi === void 0 ? void 0 : _this$props$filter$fi[selectedLayer], _this.props.filter.filterGeom, _this.props.showDisplayFieldOnly ? [currentEditConfig.displayField, "geometry"] : null);
|
|
127
127
|
return _objectSpread(_objectSpread({}, AttributeTableWidget.defaultState), {}, {
|
|
128
128
|
loading: true,
|
|
129
129
|
selectedLayer: selectedLayer,
|
|
@@ -663,7 +663,9 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
663
663
|
if (!currentEditConfig) {
|
|
664
664
|
return;
|
|
665
665
|
}
|
|
666
|
-
var fields = currentEditConfig.fields.filter(function (field) {
|
|
666
|
+
var fields = _this.props.showDisplayFieldOnly ? currentEditConfig.fields.filter(function (field) {
|
|
667
|
+
return field.name === currentEditConfig.displayField;
|
|
668
|
+
}) : currentEditConfig.fields.filter(function (field) {
|
|
667
669
|
return field.id !== 'id';
|
|
668
670
|
});
|
|
669
671
|
var data = "";
|
|
@@ -692,6 +694,7 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
692
694
|
_this.state = AttributeTableWidget.defaultState;
|
|
693
695
|
_this.table = null;
|
|
694
696
|
_this.attribTableContents = null;
|
|
697
|
+
_this.state.limitToExtent = props.limitToExtent;
|
|
695
698
|
return _this;
|
|
696
699
|
}
|
|
697
700
|
_inherits(AttributeTableWidget, _React$Component);
|
|
@@ -735,7 +738,7 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
735
738
|
var editConfig = this.props.theme.editConfig || {};
|
|
736
739
|
var currentEditConfig = editConfig[this.state.loadedLayer];
|
|
737
740
|
var editPermissions = (editConfig[this.state.loadedLayer] || {}).permissions || {};
|
|
738
|
-
var readOnly = editPermissions.updatable === false;
|
|
741
|
+
var readOnly = this.props.readOnly || editPermissions.updatable === false;
|
|
739
742
|
var loadOverlay = null;
|
|
740
743
|
if (this.state.selectedLayer && this.state.selectedLayer !== this.state.loadedLayer) {
|
|
741
744
|
if (this.state.loading) {
|
|
@@ -755,11 +758,11 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
755
758
|
var table = null;
|
|
756
759
|
var footbar = null;
|
|
757
760
|
if (currentEditConfig && this.state.features) {
|
|
758
|
-
var fields = currentEditConfig.fields.filter(function (field) {
|
|
759
|
-
return field.
|
|
760
|
-
}).filter(function (field) {
|
|
761
|
+
var fields = this.props.showDisplayFieldOnly ? currentEditConfig.fields.filter(function (field) {
|
|
762
|
+
return field.name === currentEditConfig.displayField;
|
|
763
|
+
}) : currentEditConfig.fields.filter(function (field) {
|
|
761
764
|
var _field$constraints;
|
|
762
|
-
return _this2.props.showHiddenFields || ((_field$constraints = field.constraints) === null || _field$constraints === void 0 ? void 0 : _field$constraints.hidden) !== true;
|
|
765
|
+
return field.id !== "id" && (_this2.props.showHiddenFields || ((_field$constraints = field.constraints) === null || _field$constraints === void 0 ? void 0 : _field$constraints.hidden) !== true);
|
|
763
766
|
});
|
|
764
767
|
var indexOffset = this.state.currentPage * this.state.pageSize;
|
|
765
768
|
var features = this.state.filteredSortedFeatures.slice(indexOffset, indexOffset + this.state.pageSize);
|
|
@@ -768,14 +771,14 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
768
771
|
ref: function ref(el) {
|
|
769
772
|
_this2.table = el;
|
|
770
773
|
}
|
|
771
|
-
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null), /*#__PURE__*/React.createElement("th", {
|
|
774
|
+
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null), !this.props.showDisplayFieldOnly ? /*#__PURE__*/React.createElement("th", {
|
|
772
775
|
onClick: function onClick() {
|
|
773
776
|
return _this2.sortBy("id");
|
|
774
777
|
},
|
|
775
778
|
title: this.translateFieldName("id", this.state.loadedLayer)
|
|
776
779
|
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
|
|
777
780
|
className: "attribtable-table-headername"
|
|
778
|
-
}, this.translateFieldName("id", this.state.loadedLayer)), this.renderSortIndicator("id"), this.renderColumnResizeHandle(1, 'r'))), fields.map(function (field, idx) {
|
|
781
|
+
}, this.translateFieldName("id", this.state.loadedLayer)), this.renderSortIndicator("id"), this.renderColumnResizeHandle(1, 'r'))) : null, fields.map(function (field, idx) {
|
|
779
782
|
return /*#__PURE__*/React.createElement("th", {
|
|
780
783
|
key: field.id,
|
|
781
784
|
onClick: function onClick() {
|
|
@@ -790,7 +793,7 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
790
793
|
var disabled = readOnly || _this2.state.changedFeatureIdx !== null && _this2.state.changedFeatureIdx !== featureidx;
|
|
791
794
|
var key = _this2.state.changedFeatureIdx === featureidx && _this2.state.newFeature ? "newfeature" : feature.id;
|
|
792
795
|
return /*#__PURE__*/React.createElement("tr", {
|
|
793
|
-
className: disabled ? "row-disabled" : "",
|
|
796
|
+
className: disabled && !_this2.props.readOnly ? "row-disabled" : "",
|
|
794
797
|
key: key,
|
|
795
798
|
onMouseEnter: function onMouseEnter() {
|
|
796
799
|
return _this2.setState({
|
|
@@ -814,7 +817,7 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
814
817
|
});
|
|
815
818
|
},
|
|
816
819
|
type: "checkbox"
|
|
817
|
-
}), _this2.renderRowResizeHandle(filteredIndex + 1, 'b'))), /*#__PURE__*/React.createElement("td", null, feature.id), fields.map(function (field) {
|
|
820
|
+
}), _this2.renderRowResizeHandle(filteredIndex + 1, 'b'))), !_this2.props.showDisplayFieldOnly ? /*#__PURE__*/React.createElement("td", null, feature.id) : null, fields.map(function (field) {
|
|
818
821
|
return /*#__PURE__*/React.createElement("td", {
|
|
819
822
|
key: field.id
|
|
820
823
|
}, _this2.renderField(currentEditConfig, field, featureidx, indexOffset + filteredIndex, disabled || !!_this2.state.filterVal && field.id === _this2.state.filterField));
|
|
@@ -907,9 +910,9 @@ var AttributeTableWidget = /*#__PURE__*/function (_React$Component) {
|
|
|
907
910
|
var editing = this.state.changedFeatureIdx !== null;
|
|
908
911
|
var layerChanged = this.state.selectedLayer !== this.state.loadedLayer;
|
|
909
912
|
var hasGeometry = (currentEditConfig || {}).geomType !== null;
|
|
910
|
-
var showAddButton = editPermissions.creatable !== false && (this.props.allowAddForGeometryLayers || !hasGeometry);
|
|
911
|
-
var showDelButton = editPermissions.deletable !== false;
|
|
912
|
-
var showEditButton = ConfigUtils.havePlugin("Editing") && this.props.showEditFormButton;
|
|
913
|
+
var showAddButton = !this.props.readOnly && editPermissions.creatable !== false && (this.props.allowAddForGeometryLayers || !hasGeometry);
|
|
914
|
+
var showDelButton = !this.props.readOnly && editPermissions.deletable !== false;
|
|
915
|
+
var showEditButton = !this.props.readOnly && ConfigUtils.havePlugin("Editing") && this.props.showEditFormButton;
|
|
913
916
|
var deleteButton = showDelButton ? /*#__PURE__*/React.createElement("button", {
|
|
914
917
|
className: "button",
|
|
915
918
|
disabled: layerChanged || editing || !Object.values(this.state.selectedFeatures).find(function (entry) {
|
|
@@ -1043,12 +1046,17 @@ _defineProperty(AttributeTableWidget, "propTypes", {
|
|
|
1043
1046
|
iface: PropTypes.object,
|
|
1044
1047
|
initialLayer: PropTypes.string,
|
|
1045
1048
|
layers: PropTypes.array,
|
|
1049
|
+
/** Whether to limit to the extent by default. */
|
|
1050
|
+
limitToExtent: PropTypes.bool,
|
|
1046
1051
|
mapBbox: PropTypes.object,
|
|
1047
1052
|
mapCrs: PropTypes.string,
|
|
1048
1053
|
mapScales: PropTypes.array,
|
|
1054
|
+
readOnly: PropTypes.bool,
|
|
1049
1055
|
removeLayer: PropTypes.func,
|
|
1050
1056
|
setCurrentTask: PropTypes.func,
|
|
1051
1057
|
setCurrentTaskBlocked: PropTypes.func,
|
|
1058
|
+
/** Whether to show the display field only */
|
|
1059
|
+
showDisplayFieldOnly: PropTypes.bool,
|
|
1052
1060
|
/** Whether to show a button to open the edit form for selected layer. Requires the Editing plugin to be enabled. */
|
|
1053
1061
|
showEditFormButton: PropTypes.bool,
|
|
1054
1062
|
/** Whether to show hidden Fields. */
|
|
@@ -1067,7 +1075,8 @@ _defineProperty(AttributeTableWidget, "defaultProps", {
|
|
|
1067
1075
|
zoomLevel: 1000,
|
|
1068
1076
|
showEditFormButton: true,
|
|
1069
1077
|
showHiddenFields: true,
|
|
1070
|
-
showLayerSelection: true
|
|
1078
|
+
showLayerSelection: true,
|
|
1079
|
+
limitToExtent: false
|
|
1071
1080
|
});
|
|
1072
1081
|
_defineProperty(AttributeTableWidget, "defaultState", {
|
|
1073
1082
|
loading: false,
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
23
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
+
/**
|
|
28
|
+
* Copyright 2025 Sourcepole AG
|
|
29
|
+
* All rights reserved.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the BSD-style license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { connect } from 'react-redux';
|
|
37
|
+
import PropTypes from 'prop-types';
|
|
38
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
39
|
+
import Icon from './Icon';
|
|
40
|
+
import ResizeableWindow from './ResizeableWindow';
|
|
41
|
+
import TextInput from './widgets/TextInput';
|
|
42
|
+
import './style/FeatureAttributesWindow.css';
|
|
43
|
+
var FeatureAttributesWindow = /*#__PURE__*/function (_React$Component) {
|
|
44
|
+
function FeatureAttributesWindow() {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, FeatureAttributesWindow);
|
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
_this = _callSuper(this, FeatureAttributesWindow, [].concat(args));
|
|
51
|
+
_defineProperty(_this, "renderAttributesList", function () {
|
|
52
|
+
var featureAttribs = new Set(Object.keys(_this.props.feature.properties || {}));
|
|
53
|
+
featureAttribs.add("label");
|
|
54
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
55
|
+
action: "",
|
|
56
|
+
onSubmit: _this.addAttrib
|
|
57
|
+
}, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, Object.entries(_this.props.feature.properties || {}).filter(function (_ref) {
|
|
58
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
59
|
+
name = _ref2[0],
|
|
60
|
+
value = _ref2[1];
|
|
61
|
+
return name !== "label" && typeof value === 'string';
|
|
62
|
+
}).map(function (_ref3) {
|
|
63
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
64
|
+
name = _ref4[0],
|
|
65
|
+
value = _ref4[1];
|
|
66
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
67
|
+
key: name
|
|
68
|
+
}, /*#__PURE__*/React.createElement("td", null, name), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(TextInput, {
|
|
69
|
+
onChange: function onChange(text) {
|
|
70
|
+
return _this.updateAttrib(name, text);
|
|
71
|
+
},
|
|
72
|
+
value: value
|
|
73
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
className: "button",
|
|
75
|
+
type: "button"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
77
|
+
icon: "trash",
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
return _this.removeAttrib(name);
|
|
80
|
+
}
|
|
81
|
+
}))));
|
|
82
|
+
}), _this.props.allAttribs.filter(function (attrib) {
|
|
83
|
+
return !featureAttribs.has(attrib);
|
|
84
|
+
}).map(function (name) {
|
|
85
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
86
|
+
key: name
|
|
87
|
+
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("i", null, name)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(TextInput, {
|
|
88
|
+
onChange: function onChange(text) {
|
|
89
|
+
return _this.updateAttrib(name, text);
|
|
90
|
+
},
|
|
91
|
+
value: ""
|
|
92
|
+
})), /*#__PURE__*/React.createElement("td", null));
|
|
93
|
+
}), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
|
|
94
|
+
name: "name",
|
|
95
|
+
placeholder: LocaleUtils.tr("featureattributes.name"),
|
|
96
|
+
type: "text"
|
|
97
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
|
|
98
|
+
name: "value",
|
|
99
|
+
placeholder: LocaleUtils.tr("featureattributes.value"),
|
|
100
|
+
type: "text"
|
|
101
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("button", {
|
|
102
|
+
className: "button",
|
|
103
|
+
type: "submit"
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
105
|
+
icon: "plus"
|
|
106
|
+
})))))));
|
|
107
|
+
});
|
|
108
|
+
_defineProperty(_this, "updateAttrib", function (name, value) {
|
|
109
|
+
var newFeature = _objectSpread({}, _this.props.feature);
|
|
110
|
+
newFeature.properties = _objectSpread({}, newFeature.properties);
|
|
111
|
+
newFeature.properties[name] = value.trim();
|
|
112
|
+
_this.props.onFeatureChanged(newFeature);
|
|
113
|
+
});
|
|
114
|
+
_defineProperty(_this, "removeAttrib", function (name) {
|
|
115
|
+
var newFeature = _objectSpread({}, _this.props.feature);
|
|
116
|
+
newFeature.properties = _objectSpread({}, newFeature.properties);
|
|
117
|
+
delete newFeature.properties[name];
|
|
118
|
+
_this.props.onFeatureChanged(newFeature, [name]);
|
|
119
|
+
});
|
|
120
|
+
_defineProperty(_this, "addAttrib", function (ev) {
|
|
121
|
+
ev.preventDefault();
|
|
122
|
+
var newFeature = _objectSpread({}, _this.props.feature);
|
|
123
|
+
newFeature.properties = _objectSpread({}, newFeature.properties);
|
|
124
|
+
var name = ev.target.elements.name.value.trim();
|
|
125
|
+
var value = ev.target.elements.value.value.trim();
|
|
126
|
+
if (name && !(name in newFeature.properties)) {
|
|
127
|
+
newFeature.properties[name] = value;
|
|
128
|
+
_this.props.onFeatureChanged(newFeature);
|
|
129
|
+
ev.target.elements.name.value = "";
|
|
130
|
+
ev.target.elements.value.value = "";
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return _this;
|
|
134
|
+
}
|
|
135
|
+
_inherits(FeatureAttributesWindow, _React$Component);
|
|
136
|
+
return _createClass(FeatureAttributesWindow, [{
|
|
137
|
+
key: "render",
|
|
138
|
+
value: function render() {
|
|
139
|
+
var body = null;
|
|
140
|
+
if (!this.props.feature) {
|
|
141
|
+
body = /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("featureattributes.nofeature"));
|
|
142
|
+
} else {
|
|
143
|
+
body = this.renderAttributesList();
|
|
144
|
+
}
|
|
145
|
+
return /*#__PURE__*/React.createElement(ResizeableWindow, {
|
|
146
|
+
fitHeight: true,
|
|
147
|
+
icon: "list-alt",
|
|
148
|
+
initialWidth: 320,
|
|
149
|
+
onClose: this.props.onClose,
|
|
150
|
+
scrollable: true,
|
|
151
|
+
title: LocaleUtils.tr("featureattributes.windowtitle")
|
|
152
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: "feature-attributes-body",
|
|
154
|
+
role: "body"
|
|
155
|
+
}, body));
|
|
156
|
+
}
|
|
157
|
+
}]);
|
|
158
|
+
}(React.Component);
|
|
159
|
+
_defineProperty(FeatureAttributesWindow, "propTypes", {
|
|
160
|
+
allAttribs: PropTypes.array,
|
|
161
|
+
feature: PropTypes.object,
|
|
162
|
+
onClose: PropTypes.func,
|
|
163
|
+
onFeatureChanged: PropTypes.func
|
|
164
|
+
});
|
|
165
|
+
export default connect(function (state, ownProps) {
|
|
166
|
+
var _state$layers$flat$fi, _state$layers$flat$fi2;
|
|
167
|
+
return {
|
|
168
|
+
allAttribs: _toConsumableArray(((_state$layers$flat$fi = (_state$layers$flat$fi2 = state.layers.flat.find(function (layer) {
|
|
169
|
+
return layer.id === ownProps.layerid;
|
|
170
|
+
})) === null || _state$layers$flat$fi2 === void 0 ? void 0 : _state$layers$flat$fi2.features) !== null && _state$layers$flat$fi !== void 0 ? _state$layers$flat$fi : []).reduce(function (res, feature) {
|
|
171
|
+
Object.keys(feature.properties || {}).forEach(function (key) {
|
|
172
|
+
return res.add(key);
|
|
173
|
+
});
|
|
174
|
+
return res;
|
|
175
|
+
}, new Set()))
|
|
176
|
+
};
|
|
177
|
+
}, {})(FeatureAttributesWindow);
|