qwc2 2025.10.9 → 2025.10.14
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/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
|
@@ -1,37 +1,933 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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; } }
|
|
9
|
+
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
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); } }
|
|
17
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
|
+
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); }
|
|
20
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
+
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); }
|
|
24
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
25
|
+
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; }
|
|
26
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
27
|
+
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); }
|
|
28
|
+
/**
|
|
2
29
|
* Copyright 2017-2024 Sourcepole AG
|
|
3
30
|
* All rights reserved.
|
|
4
31
|
*
|
|
5
32
|
* This source code is licensed under the BSD-style license found in the
|
|
6
33
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_this
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import React from 'react';
|
|
37
|
+
import { connect } from 'react-redux';
|
|
38
|
+
import clone from 'clone';
|
|
39
|
+
import isEmpty from 'lodash.isempty';
|
|
40
|
+
import PropTypes from 'prop-types';
|
|
41
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
42
|
+
import { setEditContext, clearEditContext } from '../actions/editing';
|
|
43
|
+
import { LayerRole, refreshLayer } from '../actions/layers';
|
|
44
|
+
import { setCurrentTaskBlocked } from '../actions/task';
|
|
45
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
46
|
+
import CoordinatesUtils from '../utils/CoordinatesUtils';
|
|
47
|
+
import { getFeatureTemplate, parseExpressionsAsync } from '../utils/EditingUtils';
|
|
48
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
49
|
+
import AutoEditForm from './AutoEditForm';
|
|
50
|
+
import LinkFeatureForm from './LinkFeatureForm';
|
|
51
|
+
import QtDesignerForm from './QtDesignerForm';
|
|
52
|
+
import ButtonBar from './widgets/ButtonBar';
|
|
53
|
+
import ReCaptchaWidget from './widgets/ReCaptchaWidget';
|
|
54
|
+
import './style/AttributeForm.css';
|
|
55
|
+
var AttributeForm = /*#__PURE__*/function (_React$Component) {
|
|
56
|
+
function AttributeForm(props) {
|
|
57
|
+
var _this;
|
|
58
|
+
_classCallCheck(this, AttributeForm);
|
|
59
|
+
_this = _callSuper(this, AttributeForm, [props]);
|
|
60
|
+
_defineProperty(_this, "state", {
|
|
61
|
+
busy: false,
|
|
62
|
+
deleteClicked: false,
|
|
63
|
+
childEdit: null,
|
|
64
|
+
relationTables: {},
|
|
65
|
+
formValid: true,
|
|
66
|
+
captchaResponse: null
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(_this, "editLayerId", function (layerId) {
|
|
69
|
+
return _this.props.editConfig || layerId;
|
|
70
|
+
});
|
|
71
|
+
_defineProperty(_this, "render", function () {
|
|
72
|
+
var captchaRequired = ConfigUtils.getConfigProp("editServiceCaptchaSiteKey") && !ConfigUtils.getConfigProp("username");
|
|
73
|
+
var captchaPending = captchaRequired && !_this.state.captchaResponse;
|
|
74
|
+
var commitBar = null;
|
|
75
|
+
if (_this.props.editContext.changed) {
|
|
76
|
+
var commitButtons = [{
|
|
77
|
+
key: 'Commit',
|
|
78
|
+
icon: _this.state.formValid ? 'ok' : 'warning',
|
|
79
|
+
label: _this.state.formValid ? LocaleUtils.tr("editing.commit") : LocaleUtils.tr("editing.invalidform"),
|
|
80
|
+
extraClasses: _this.state.formValid ? "button-accept" : "button-warning",
|
|
81
|
+
type: "submit",
|
|
82
|
+
disabled: !_this.state.formValid || captchaPending
|
|
83
|
+
}, {
|
|
84
|
+
key: 'Discard',
|
|
85
|
+
icon: 'remove',
|
|
86
|
+
label: LocaleUtils.tr("editing.discard"),
|
|
87
|
+
extraClasses: "button-reject"
|
|
88
|
+
}];
|
|
89
|
+
commitBar = /*#__PURE__*/React.createElement(ButtonBar, {
|
|
90
|
+
buttons: commitButtons,
|
|
91
|
+
onClick: _this.onDiscard
|
|
92
|
+
}); /* submit is handled via onSubmit in the form */
|
|
93
|
+
}
|
|
94
|
+
var curConfig = _this.props.editConfig;
|
|
95
|
+
var editPermissions = curConfig.permissions || {};
|
|
96
|
+
var readOnly = _this.props.readOnly || editPermissions.updatable === false && _this.props.editContext.action === 'Pick';
|
|
97
|
+
var deleteBar = null;
|
|
98
|
+
if (!_this.props.hideDelete && _this.props.editContext.action === 'Pick' && _this.props.editContext.feature && !_this.props.editContext.changed && editPermissions.deletable !== false && !_this.props.readOnly) {
|
|
99
|
+
// Delete button bar will appear by default if no permissions are defined in editConfig or when deletable permission is set
|
|
100
|
+
if (!_this.state.deleteClicked) {
|
|
101
|
+
var _this$props$deleteLab;
|
|
102
|
+
var deleteButtons = [{
|
|
103
|
+
key: 'Delete',
|
|
104
|
+
icon: 'trash',
|
|
105
|
+
label: (_this$props$deleteLab = _this.props.deleteLabel) !== null && _this$props$deleteLab !== void 0 ? _this$props$deleteLab : LocaleUtils.tr("editing.delete")
|
|
106
|
+
}];
|
|
107
|
+
deleteBar = /*#__PURE__*/React.createElement(ButtonBar, {
|
|
108
|
+
buttons: deleteButtons,
|
|
109
|
+
onClick: _this.deleteClicked
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
var _deleteButtons = [{
|
|
113
|
+
key: 'Yes',
|
|
114
|
+
icon: 'ok',
|
|
115
|
+
label: LocaleUtils.tr("editing.reallydelete"),
|
|
116
|
+
extraClasses: "button-accept",
|
|
117
|
+
disabled: captchaPending
|
|
118
|
+
}, {
|
|
119
|
+
key: 'No',
|
|
120
|
+
icon: 'remove',
|
|
121
|
+
label: LocaleUtils.tr("editing.canceldelete"),
|
|
122
|
+
extraClasses: "button-reject"
|
|
123
|
+
}];
|
|
124
|
+
deleteBar = /*#__PURE__*/React.createElement(ButtonBar, {
|
|
125
|
+
buttons: _deleteButtons,
|
|
126
|
+
onClick: _this.deleteFeature
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
var busyDiv = null;
|
|
131
|
+
if (_this.state.busy) {
|
|
132
|
+
busyDiv = /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: "attrib-form-busy"
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
var childAttributeForm = null;
|
|
137
|
+
if (_this.state.childEdit) {
|
|
138
|
+
childAttributeForm = /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
className: "link-feature-form-container"
|
|
140
|
+
}, /*#__PURE__*/React.createElement(LinkFeatureForm, _extends({}, _this.state.childEdit, {
|
|
141
|
+
finished: _this.state.childEdit.finishCallback,
|
|
142
|
+
iface: _this.props.iface,
|
|
143
|
+
pickFilter: _this.props.childPickFilter,
|
|
144
|
+
readOnly: _this.props.readOnly
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
147
|
+
var captchaButton = null;
|
|
148
|
+
if (captchaRequired && (_this.props.editContext.changed || _this.state.deleteClicked)) {
|
|
149
|
+
captchaButton = /*#__PURE__*/React.createElement(ReCaptchaWidget, {
|
|
150
|
+
onChange: function onChange(value) {
|
|
151
|
+
return _this.setState({
|
|
152
|
+
captchaResponse: value
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
sitekey: ConfigUtils.getConfigProp("editServiceCaptchaSiteKey")
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
var readOnlyMsg = null;
|
|
159
|
+
if (!readOnly && _this.props.editContext.geomReadOnly) {
|
|
160
|
+
readOnlyMsg = LocaleUtils.tr("editing.geomreadonly");
|
|
161
|
+
} else if (!readOnly && _this.props.editContext.geomNonZeroZ) {
|
|
162
|
+
readOnlyMsg = LocaleUtils.tr("editing.geomnonzeroz");
|
|
163
|
+
}
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: "AttributeForm"
|
|
166
|
+
}, readOnlyMsg ? /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "attrib-form-geom-readonly"
|
|
168
|
+
}, readOnlyMsg) : null, /*#__PURE__*/React.createElement("form", {
|
|
169
|
+
action: "",
|
|
170
|
+
onChange: function onChange(ev) {
|
|
171
|
+
return _this.formChanged(ev);
|
|
172
|
+
},
|
|
173
|
+
onSubmit: _this.onSubmit,
|
|
174
|
+
ref: _this.setupChangedObserver
|
|
175
|
+
}, _this.props.editConfig.form ? /*#__PURE__*/React.createElement(QtDesignerForm, {
|
|
176
|
+
addRelationRecord: _this.addRelationRecord,
|
|
177
|
+
editConfig: _this.props.editConfig,
|
|
178
|
+
editConfigs: _this.props.theme.editConfig,
|
|
179
|
+
editRelationRecord: _this.editRelationRecord,
|
|
180
|
+
feature: _this.props.editContext.feature,
|
|
181
|
+
iface: _this.props.iface,
|
|
182
|
+
mapCrs: _this.props.map.projection,
|
|
183
|
+
mapPrefix: _this.editMapPrefix(),
|
|
184
|
+
readOnly: readOnly,
|
|
185
|
+
removeRelationRecord: _this.removeRelationRecord,
|
|
186
|
+
reorderRelationRecord: _this.reorderRelationRecord,
|
|
187
|
+
report: _this.props.report,
|
|
188
|
+
setFormBusy: _this.setFormBusy,
|
|
189
|
+
setRelationTables: _this.setRelationTables,
|
|
190
|
+
switchEditContext: _this.startChildEdit,
|
|
191
|
+
translations: _this.props.theme.translations,
|
|
192
|
+
updateField: _this.updateField,
|
|
193
|
+
updateRelationField: _this.updateRelationField
|
|
194
|
+
}) : /*#__PURE__*/React.createElement(AutoEditForm, {
|
|
195
|
+
editLayerId: _this.props.editConfig.editDataset,
|
|
196
|
+
fields: _this.props.editConfig.fields,
|
|
197
|
+
iface: _this.props.iface,
|
|
198
|
+
readOnly: readOnly,
|
|
199
|
+
touchFriendly: _this.props.touchFriendly,
|
|
200
|
+
updateField: _this.updateField,
|
|
201
|
+
values: _this.props.editContext.feature.properties
|
|
202
|
+
}), captchaButton, commitBar), deleteBar, busyDiv, childAttributeForm);
|
|
203
|
+
});
|
|
204
|
+
_defineProperty(_this, "setFormBusy", function (busy) {
|
|
205
|
+
_this.setState({
|
|
206
|
+
busy: busy
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
_defineProperty(_this, "updateField", function (key, value) {
|
|
210
|
+
var newProperties = _objectSpread(_objectSpread({}, _this.props.editContext.feature.properties), {}, _defineProperty({}, key, value));
|
|
211
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
212
|
+
properties: newProperties
|
|
213
|
+
});
|
|
214
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
215
|
+
feature: newFeature,
|
|
216
|
+
changed: true
|
|
217
|
+
});
|
|
218
|
+
_this.validateFieldConstraints(newFeature);
|
|
219
|
+
});
|
|
220
|
+
_defineProperty(_this, "editMapPrefix", function () {
|
|
221
|
+
return (_this.props.editConfig.editDataset.match(/^[^.]+\./) || [""])[0];
|
|
222
|
+
});
|
|
223
|
+
_defineProperty(_this, "setRelationTables", function (relationTables) {
|
|
224
|
+
_this.setState({
|
|
225
|
+
relationTables: relationTables
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
_defineProperty(_this, "loadRelationValues", function (feature, callback) {
|
|
229
|
+
if (!isEmpty(_this.state.relationTables)) {
|
|
230
|
+
if (feature.id) {
|
|
231
|
+
var relTables = Object.entries(_this.state.relationTables).map(function (_ref) {
|
|
232
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
233
|
+
name = _ref2[0],
|
|
234
|
+
entry = _ref2[1];
|
|
235
|
+
if (entry.sortcol) {
|
|
236
|
+
return name + ":" + entry.fk + ":" + entry.sortcol;
|
|
237
|
+
} else {
|
|
238
|
+
return name + ":" + entry.fk;
|
|
239
|
+
}
|
|
240
|
+
}).join(",");
|
|
241
|
+
_this.props.iface.getRelations(_this.props.editConfig, feature.id, _this.props.map.projection, relTables, _this.props.theme.editConfig, function (relationValues) {
|
|
242
|
+
var newFeature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
243
|
+
relationValues: relationValues
|
|
244
|
+
});
|
|
245
|
+
callback(newFeature);
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
var relationValues = _objectSpread(_objectSpread({}, Object.entries(_this.state.relationTables).reduce(function (res, _ref3) {
|
|
249
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
250
|
+
name = _ref4[0],
|
|
251
|
+
entry = _ref4[1];
|
|
252
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, name, {
|
|
253
|
+
fk: entry.fk,
|
|
254
|
+
features: []
|
|
255
|
+
}));
|
|
256
|
+
}, {})), feature.relationValues);
|
|
257
|
+
var newFeature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
258
|
+
relationValues: relationValues
|
|
259
|
+
});
|
|
260
|
+
callback(newFeature);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
_defineProperty(_this, "addRelationRecord", function (table) {
|
|
265
|
+
var newRelationValues = _objectSpread({}, _this.props.editContext.feature.relationValues);
|
|
266
|
+
var editConfig = _this.props.theme.editConfig[table.split('.').slice(-1)];
|
|
267
|
+
var mapPrefix = (editConfig.editDataset.match(/^[^.]+\./) || [""])[0];
|
|
268
|
+
getFeatureTemplate(editConfig, {
|
|
269
|
+
type: "Feature",
|
|
270
|
+
properties: {}
|
|
271
|
+
}, _this.props.iface, mapPrefix, _this.props.map.projection, function (newRelFeature) {
|
|
272
|
+
newRelFeature.__status__ = "empty";
|
|
273
|
+
if (editConfig.geomType === null) {
|
|
274
|
+
newRelFeature.geometry = null;
|
|
275
|
+
}
|
|
276
|
+
// If feature id is known, i.e. not when drawing new feature, set foreign key
|
|
277
|
+
if (_this.props.editContext.action !== "Draw") {
|
|
278
|
+
newRelFeature.properties[_this.state.relationTables[table].fk] = _this.props.editContext.feature.id;
|
|
279
|
+
}
|
|
280
|
+
newRelationValues[table] = _objectSpread({}, newRelationValues[table]);
|
|
281
|
+
newRelationValues[table].features = newRelationValues[table].features.concat([newRelFeature]);
|
|
282
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
283
|
+
relationValues: newRelationValues
|
|
284
|
+
});
|
|
285
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
286
|
+
feature: newFeature,
|
|
287
|
+
changed: true
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
_defineProperty(_this, "reorderRelationRecord", function (table, idx, dir) {
|
|
292
|
+
var nFeatures = _this.props.editContext.feature.relationValues[table].features.length;
|
|
293
|
+
if (dir < 0 && idx === 0 || dir > 0 && idx >= nFeatures - 1) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
var newRelationValues = _objectSpread({}, _this.props.editContext.feature.relationValues);
|
|
297
|
+
newRelationValues[table] = _objectSpread({}, newRelationValues[table]);
|
|
298
|
+
var newFeatures = newRelationValues[table].features.slice(0);
|
|
299
|
+
var offset = dir < 0 ? 0 : 1;
|
|
300
|
+
newFeatures.splice(idx - 1 + offset, 2, newFeatures[idx + offset], newFeatures[idx - 1 + offset]);
|
|
301
|
+
newFeatures[idx - 1 + offset].properties = _objectSpread({}, newFeatures[idx - 1 + offset].properties);
|
|
302
|
+
newFeatures[idx + offset].properties = _objectSpread({}, newFeatures[idx + offset].properties);
|
|
303
|
+
newFeatures[idx - 1 + offset].__status__ = ["new", "empty"].includes(newFeatures[idx - 1 + offset].__status__) ? "new" : "changed";
|
|
304
|
+
newFeatures[idx + offset].__status__ = ["new", "empty"].includes(newFeatures[idx + offset].__status__) ? "new" : "changed";
|
|
305
|
+
newRelationValues[table].features = newFeatures;
|
|
306
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
307
|
+
relationValues: newRelationValues
|
|
308
|
+
});
|
|
309
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
310
|
+
feature: newFeature,
|
|
311
|
+
changed: true
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
_defineProperty(_this, "removeRelationRecord", function (table, idx) {
|
|
315
|
+
var newRelationValues = _objectSpread({}, _this.props.editContext.feature.relationValues);
|
|
316
|
+
newRelationValues[table] = _objectSpread({}, newRelationValues[table]);
|
|
317
|
+
newRelationValues[table].features = newRelationValues[table].features.slice(0);
|
|
318
|
+
var fieldStatus = newRelationValues[table].features[idx].__status__ || "";
|
|
319
|
+
// If field was new, delete it directly, else mark it as deleted
|
|
320
|
+
if (["new", "empty"].includes(fieldStatus)) {
|
|
321
|
+
newRelationValues[table].features.splice(idx, 1);
|
|
322
|
+
} else {
|
|
323
|
+
newRelationValues[table].features[idx] = _objectSpread(_objectSpread({}, newRelationValues[table].features[idx]), {}, {
|
|
324
|
+
__status__: fieldStatus.startsWith("deleted") ? fieldStatus.substr(8) : "deleted:" + fieldStatus
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
328
|
+
relationValues: newRelationValues
|
|
329
|
+
});
|
|
330
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
331
|
+
feature: newFeature,
|
|
332
|
+
changed: true
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
_defineProperty(_this, "updateRelationField", function (table, idx, key, value) {
|
|
336
|
+
var newRelationValues = _objectSpread({}, _this.props.editContext.feature.relationValues);
|
|
337
|
+
newRelationValues[table] = _objectSpread({}, newRelationValues[table]);
|
|
338
|
+
newRelationValues[table].features = newRelationValues[table].features.slice(0);
|
|
339
|
+
newRelationValues[table].features[idx] = _objectSpread(_objectSpread({}, newRelationValues[table].features[idx]), {}, {
|
|
340
|
+
properties: _objectSpread(_objectSpread({}, newRelationValues[table].features[idx].properties), {}, _defineProperty({}, key, value)),
|
|
341
|
+
__status__: ["new", "empty"].includes(newRelationValues[table].features[idx].__status__) ? "new" : "changed"
|
|
342
|
+
});
|
|
343
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
344
|
+
relationValues: newRelationValues
|
|
345
|
+
});
|
|
346
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
347
|
+
feature: newFeature,
|
|
348
|
+
changed: true
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
_defineProperty(_this, "editRelationRecord", function (action, layer, dataset, idx, displayField) {
|
|
352
|
+
var editConfig = (_this.props.theme.editConfig || {})[layer];
|
|
353
|
+
var feature = _this.props.editContext.feature.relationValues[dataset].features[idx];
|
|
354
|
+
_this.setState({
|
|
355
|
+
childEdit: {
|
|
356
|
+
action: action,
|
|
357
|
+
editConfig: editConfig,
|
|
358
|
+
editContextId: ':' + layer,
|
|
359
|
+
dataset: dataset,
|
|
360
|
+
idx: idx,
|
|
361
|
+
feature: feature,
|
|
362
|
+
finishCallback: _this.finishEditRelationRecord,
|
|
363
|
+
displayField: displayField,
|
|
364
|
+
hideDelete: true
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
_defineProperty(_this, "finishEditRelationRecord", function (feature) {
|
|
369
|
+
_this.props.clearEditContext(_this.state.childEdit.editContextId, _this.props.editContext.id);
|
|
370
|
+
if (feature) {
|
|
371
|
+
var table = _this.state.childEdit.dataset;
|
|
372
|
+
var idx = _this.state.childEdit.idx;
|
|
373
|
+
var newRelationValues = _objectSpread({}, _this.props.editContext.feature.relationValues);
|
|
374
|
+
newRelationValues[table] = _objectSpread({}, newRelationValues[table]);
|
|
375
|
+
newRelationValues[table].features = newRelationValues[table].features.slice(0);
|
|
376
|
+
newRelationValues[table].features[idx] = _objectSpread(_objectSpread({}, feature), {}, {
|
|
377
|
+
properties: _objectSpread({}, feature.properties)
|
|
378
|
+
});
|
|
379
|
+
// If feature id is known, i.e. not when drawing new feature, set foreign key
|
|
380
|
+
var changed = _this.props.editContext.changed;
|
|
381
|
+
var fk = _this.state.relationTables[table].fk;
|
|
382
|
+
if (_this.props.editContext.action !== "Draw" && feature.properties[fk] !== _this.props.editContext.feature.id) {
|
|
383
|
+
newRelationValues[table].features[idx].properties[fk] = _this.props.editContext.feature.id;
|
|
384
|
+
newRelationValues[table].features[idx].__status__ = "changed";
|
|
385
|
+
changed = true;
|
|
386
|
+
}
|
|
387
|
+
var newFeature = _objectSpread(_objectSpread({}, _this.props.editContext.feature), {}, {
|
|
388
|
+
relationValues: newRelationValues
|
|
389
|
+
});
|
|
390
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
391
|
+
feature: newFeature,
|
|
392
|
+
changed: changed
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
_this.setState({
|
|
396
|
+
childEdit: null
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
_defineProperty(_this, "onDiscard", function (action) {
|
|
400
|
+
if (action === "Discard") {
|
|
401
|
+
_this.props.setCurrentTaskBlocked(false);
|
|
402
|
+
if (!_this.props.onDiscard || !_this.props.onDiscard()) {
|
|
403
|
+
if (_this.props.editContext.action === 'Pick') {
|
|
404
|
+
// Re-query the original feature
|
|
405
|
+
_this.setState({
|
|
406
|
+
busy: true
|
|
407
|
+
});
|
|
408
|
+
_this.props.iface.getFeatureById(_this.props.editConfig, _this.props.editContext.feature.id, _this.props.map.projection, function (feature) {
|
|
409
|
+
_this.setState({
|
|
410
|
+
busy: false
|
|
411
|
+
});
|
|
412
|
+
if (!isEmpty(_this.state.relationTables)) {
|
|
413
|
+
// Re-load relation values
|
|
414
|
+
_this.loadRelationValues(feature, function (newFeature) {
|
|
415
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
416
|
+
feature: newFeature,
|
|
417
|
+
changed: false
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
// Re-validate feature field constraints
|
|
421
|
+
_this.validateFieldConstraints(feature);
|
|
422
|
+
} else {
|
|
423
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
424
|
+
feature: feature,
|
|
425
|
+
changed: false
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
} else {
|
|
430
|
+
var featureSkel = {
|
|
431
|
+
type: "Feature",
|
|
432
|
+
properties: {}
|
|
433
|
+
};
|
|
434
|
+
var mapPrefix = (_this.props.editConfig.editDataset.match(/^[^.]+\./) || [""])[0];
|
|
435
|
+
getFeatureTemplate(_this.props.editConfig, featureSkel, _this.props.iface, mapPrefix, _this.props.map.projection, function (feature) {
|
|
436
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
437
|
+
feature: feature,
|
|
438
|
+
changed: false
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
_defineProperty(_this, "setupChangedObserver", function (form) {
|
|
446
|
+
_this.form = form;
|
|
447
|
+
if (form) {
|
|
448
|
+
form.observer = new MutationObserver(function () {
|
|
449
|
+
_this.setState({
|
|
450
|
+
formValid: form.checkValidity()
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
form.observer.observe(form, {
|
|
454
|
+
subtree: true,
|
|
455
|
+
childList: true,
|
|
456
|
+
attributes: true
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
_defineProperty(_this, "formChanged", function (ev) {
|
|
461
|
+
var _ev$target;
|
|
462
|
+
var form = ev.currentTarget;
|
|
463
|
+
if ((_ev$target = ev.target) !== null && _ev$target !== void 0 && _ev$target.setCustomValidity) {
|
|
464
|
+
ev.target.setCustomValidity("");
|
|
465
|
+
}
|
|
466
|
+
if (form) {
|
|
467
|
+
_this.setState({
|
|
468
|
+
formValid: form.checkValidity()
|
|
469
|
+
});
|
|
470
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
471
|
+
changed: true
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
_defineProperty(_this, "validateFieldConstraints", function (feature) {
|
|
476
|
+
var validCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
477
|
+
var invalidCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
478
|
+
var constraintExpressions = _this.props.editConfig.fields.reduce(function (res, cur) {
|
|
479
|
+
var _cur$constraints;
|
|
480
|
+
if ((_cur$constraints = cur.constraints) !== null && _cur$constraints !== void 0 && _cur$constraints.expression) {
|
|
481
|
+
return [].concat(_toConsumableArray(res), [{
|
|
482
|
+
field: cur.id,
|
|
483
|
+
expression: cur.constraints.expression
|
|
484
|
+
}]);
|
|
485
|
+
}
|
|
486
|
+
return res;
|
|
487
|
+
}, []);
|
|
488
|
+
parseExpressionsAsync(constraintExpressions, feature, _this.props.editConfig, _this.props.iface, _this.editMapPrefix(), _this.props.map.projection, false).then(function (result) {
|
|
489
|
+
var valid = true;
|
|
490
|
+
var reasons = [];
|
|
491
|
+
Object.entries(result).forEach(function (_ref5) {
|
|
492
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
493
|
+
key = _ref6[0],
|
|
494
|
+
value = _ref6[1];
|
|
495
|
+
var element = _this.form.elements.namedItem(key);
|
|
496
|
+
if (element) {
|
|
497
|
+
if (value === false) {
|
|
498
|
+
var _this$props$editConfi, _this$props$editConfi2;
|
|
499
|
+
valid = false;
|
|
500
|
+
var reason = (_this$props$editConfi = (_this$props$editConfi2 = _this.props.editConfig.fields.find(function (field) {
|
|
501
|
+
return field.id === key;
|
|
502
|
+
})) === null || _this$props$editConfi2 === void 0 || (_this$props$editConfi2 = _this$props$editConfi2.constraints) === null || _this$props$editConfi2 === void 0 ? void 0 : _this$props$editConfi2.placeholder) !== null && _this$props$editConfi !== void 0 ? _this$props$editConfi : LocaleUtils.tr("editing.contraintviolation");
|
|
503
|
+
reasons.push(reason);
|
|
504
|
+
element.setCustomValidity(reason);
|
|
505
|
+
} else {
|
|
506
|
+
element.setCustomValidity("");
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
if (!valid) {
|
|
511
|
+
_this.setState({
|
|
512
|
+
formValid: false
|
|
513
|
+
});
|
|
514
|
+
if (invalidCallback) {
|
|
515
|
+
invalidCallback(reasons);
|
|
516
|
+
}
|
|
517
|
+
} else {
|
|
518
|
+
if (validCallback) {
|
|
519
|
+
validCallback();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
_defineProperty(_this, "onSubmit", function (ev) {
|
|
525
|
+
ev.preventDefault();
|
|
526
|
+
_this.validateFieldConstraints(_this.props.editContext.feature, _this.doSubmit, function (reasons) {
|
|
527
|
+
/* eslint-disable-next-line */
|
|
528
|
+
alert(LocaleUtils.tr("editing.contraintviolation") + ":\n" + reasons.join("\n"));
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
_defineProperty(_this, "doSubmit", function () {
|
|
532
|
+
_this.setState({
|
|
533
|
+
busy: true
|
|
534
|
+
});
|
|
535
|
+
var feature = _this.props.editContext.feature;
|
|
536
|
+
// Ensure properties is not null
|
|
537
|
+
feature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
538
|
+
type: "Feature",
|
|
539
|
+
properties: _objectSpread({}, feature.properties || {}),
|
|
540
|
+
crs: {
|
|
541
|
+
type: "name",
|
|
542
|
+
properties: {
|
|
543
|
+
name: CoordinatesUtils.toOgcUrnCrs(_this.props.map.projection)
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
// Omit geometry if it is read-only
|
|
548
|
+
if (_this.props.editContext.geomReadOnly) {
|
|
549
|
+
delete feature.geometry;
|
|
550
|
+
}
|
|
551
|
+
var curConfig = _this.props.editConfig;
|
|
552
|
+
var mapPrefix = _this.editMapPrefix();
|
|
553
|
+
var textNullValue = ConfigUtils.getConfigProp("editTextNullValue");
|
|
554
|
+
|
|
555
|
+
// Keep relation values separate
|
|
556
|
+
var relationValues = clone(feature.relationValues || {});
|
|
557
|
+
delete feature.relationValues;
|
|
558
|
+
var relationUploads = {};
|
|
559
|
+
var featureUploads = {};
|
|
560
|
+
|
|
561
|
+
// Collect all values from form fields
|
|
562
|
+
var fieldnames = Array.from(_this.form.elements).map(function (element) {
|
|
563
|
+
return element.name;
|
|
564
|
+
}).filter(function (x) {
|
|
565
|
+
return x && x !== "g-recaptcha-response";
|
|
566
|
+
});
|
|
567
|
+
fieldnames.forEach(function (name) {
|
|
568
|
+
var element = _this.form.elements.namedItem(name);
|
|
569
|
+
if (element) {
|
|
570
|
+
var parts = name.split("__");
|
|
571
|
+
var value = element.type === "radio" || element.type === "checkbox" ? element.checked : element.value;
|
|
572
|
+
var nullElements = ["date", "number", "radio"];
|
|
573
|
+
var nullFieldTypes = ["date", "number"];
|
|
574
|
+
if (parts.length >= 3) {
|
|
575
|
+
var _this$props$theme$edi, _this$props$theme$edi2, _this$props$theme$edi3;
|
|
576
|
+
// Relation value
|
|
577
|
+
// Usually <table>__<field>__<index>, but <field> might also contain __ (i.e. upload__user)
|
|
578
|
+
var tablename = parts[0];
|
|
579
|
+
var datasetname = mapPrefix + tablename;
|
|
580
|
+
var field = parts.slice(1, parts.length - 1).join("__");
|
|
581
|
+
var index = parseInt(parts[parts.length - 1], 10);
|
|
582
|
+
var nrelFieldConfig = (_this$props$theme$edi = (_this$props$theme$edi2 = _this.props.theme.editConfig[tablename].fields) === null || _this$props$theme$edi2 === void 0 || (_this$props$theme$edi3 = _this$props$theme$edi2.find) === null || _this$props$theme$edi3 === void 0 ? void 0 : _this$props$theme$edi3.call(_this$props$theme$edi2, function (f) {
|
|
583
|
+
return f.id === field;
|
|
584
|
+
})) !== null && _this$props$theme$edi !== void 0 ? _this$props$theme$edi : {};
|
|
585
|
+
var nrelFieldDataType = nrelFieldConfig.type;
|
|
586
|
+
if (nrelFieldConfig.expression) {
|
|
587
|
+
// Skip virtual fields
|
|
588
|
+
delete relationValues[datasetname].features[index][field];
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if ((element instanceof RadioNodeList || nullElements.includes(element.type) || nullFieldTypes.includes(nrelFieldDataType)) && element.value === "") {
|
|
592
|
+
// Set empty value to null instead of empty string
|
|
593
|
+
value = null;
|
|
594
|
+
}
|
|
595
|
+
if (nrelFieldDataType === "text" && textNullValue !== undefined && element.value === textNullValue) {
|
|
596
|
+
// Convert text NULL to null
|
|
597
|
+
value = null;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// relationValues for table must exist as rows are either pre-existing or were added
|
|
601
|
+
if (!(field in relationValues[datasetname].features[index].properties)) {
|
|
602
|
+
relationValues[datasetname].features[index].defaultedProperties = [].concat(_toConsumableArray(relationValues[datasetname].features[index].defaultedProperties || []), [field]);
|
|
603
|
+
}
|
|
604
|
+
relationValues[datasetname].features[index].properties[field] = value;
|
|
605
|
+
if (relationValues[datasetname].features[index].__status__ === "empty") {
|
|
606
|
+
relationValues[datasetname].features[index].__status__ = "new";
|
|
607
|
+
}
|
|
608
|
+
if (element.type === "file" && element.files.length > 0) {
|
|
609
|
+
relationUploads[name] = element.files[0];
|
|
610
|
+
relationValues[datasetname].features[index].properties[field] = "";
|
|
611
|
+
} else if (element.type === "hidden" && element.value.startsWith("data:")) {
|
|
612
|
+
var filename = element.dataset.filename;
|
|
613
|
+
var type = element.value.match(/image\/\w+/)[0];
|
|
614
|
+
if (!filename) {
|
|
615
|
+
var ext = type.split("/")[1];
|
|
616
|
+
filename = uuidv4() + "." + ext;
|
|
617
|
+
}
|
|
618
|
+
relationUploads[name] = new File([_this.dataUriToBlob(element.value)], filename, {
|
|
619
|
+
type: type
|
|
620
|
+
});
|
|
621
|
+
relationValues[datasetname].features[index].properties[field] = "";
|
|
622
|
+
}
|
|
623
|
+
} else {
|
|
624
|
+
var fieldConfig = (curConfig.fields || []).find(function (field) {
|
|
625
|
+
return field.id === name;
|
|
626
|
+
}) || {};
|
|
627
|
+
if (fieldConfig.expression) {
|
|
628
|
+
// Skip virtual fields
|
|
629
|
+
delete feature.properties[name];
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
var dataType = fieldConfig.type;
|
|
633
|
+
if ((element instanceof RadioNodeList || nullElements.includes(element.type) || nullFieldTypes.includes(dataType)) && element.value === "") {
|
|
634
|
+
// Set empty value to null instead of empty string
|
|
635
|
+
value = null;
|
|
636
|
+
}
|
|
637
|
+
if (dataType === "text" && textNullValue !== undefined && element.value === textNullValue) {
|
|
638
|
+
// Convert text NULL to null
|
|
639
|
+
value = null;
|
|
640
|
+
}
|
|
641
|
+
if (!(name in feature.properties)) {
|
|
642
|
+
feature.defaultedProperties = [].concat(_toConsumableArray(feature.defaultedProperties || []), [name]);
|
|
643
|
+
}
|
|
644
|
+
feature.properties[name] = value;
|
|
645
|
+
if (element.type === "file" && element.files.length > 0) {
|
|
646
|
+
featureUploads[name] = element.files[0];
|
|
647
|
+
feature.properties[name] = "";
|
|
648
|
+
} else if (element.type === "hidden" && element.value.startsWith("data:")) {
|
|
649
|
+
var _filename = element.dataset.filename;
|
|
650
|
+
var _type = element.value.match(/image\/\w+/)[0];
|
|
651
|
+
if (!_filename) {
|
|
652
|
+
var _ext = _type.split("/")[1];
|
|
653
|
+
_filename = uuidv4() + "." + _ext;
|
|
654
|
+
}
|
|
655
|
+
featureUploads[name] = new File([_this.dataUriToBlob(element.value)], _filename, {
|
|
656
|
+
type: _type
|
|
657
|
+
});
|
|
658
|
+
feature.properties[name] = "";
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// Set relation values CRS and sort index if necessary
|
|
665
|
+
Object.keys(relationValues).forEach(function (relTable) {
|
|
666
|
+
relationValues[relTable].features = relationValues[relTable].features.filter(function (relFeature) {
|
|
667
|
+
return relFeature.__status__ !== "empty";
|
|
668
|
+
}).map(function (relFeature, idx) {
|
|
669
|
+
var newRelFeature = _objectSpread(_objectSpread({}, relFeature), {}, {
|
|
670
|
+
crs: {
|
|
671
|
+
type: "name",
|
|
672
|
+
properties: {
|
|
673
|
+
name: CoordinatesUtils.toOgcUrnCrs(_this.props.map.projection)
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
var sortcol = _this.state.relationTables[relTable].sortcol;
|
|
678
|
+
var noreorder = _this.state.relationTables[relTable].noreorder;
|
|
679
|
+
if (sortcol && !noreorder) {
|
|
680
|
+
newRelFeature.__status__ = feature.__status__ || (newRelFeature.properties[sortcol] !== idx ? "changed" : "");
|
|
681
|
+
newRelFeature.properties[sortcol] = idx;
|
|
682
|
+
}
|
|
683
|
+
return newRelFeature;
|
|
684
|
+
});
|
|
685
|
+
});
|
|
686
|
+
feature.relationValues = relationValues;
|
|
687
|
+
var featureData = new FormData();
|
|
688
|
+
featureData.set('feature', JSON.stringify(feature));
|
|
689
|
+
Object.entries(featureUploads).forEach(function (_ref7) {
|
|
690
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
691
|
+
key = _ref8[0],
|
|
692
|
+
value = _ref8[1];
|
|
693
|
+
return featureData.set('file:' + key, value);
|
|
694
|
+
});
|
|
695
|
+
Object.entries(relationUploads).forEach(function (_ref9) {
|
|
696
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
697
|
+
key = _ref10[0],
|
|
698
|
+
value = _ref10[1];
|
|
699
|
+
return featureData.set('relfile:' + mapPrefix + key, value);
|
|
700
|
+
});
|
|
701
|
+
if (_this.state.captchaResponse) {
|
|
702
|
+
featureData.set('g-recaptcha-response', _this.state.captchaResponse);
|
|
703
|
+
}
|
|
704
|
+
if (_this.props.editContext.action === "Draw") {
|
|
705
|
+
if (_this.props.iface.addFeatureMultipart) {
|
|
706
|
+
_this.props.iface.addFeatureMultipart(_this.props.editConfig, _this.props.map.projection, featureData, function (success, result) {
|
|
707
|
+
return _this.featureCommited(success, result);
|
|
708
|
+
});
|
|
709
|
+
} else {
|
|
710
|
+
_this.props.iface.addFeature(_this.props.editConfig.editDataset, feature, _this.props.map.projection, function (success, result) {
|
|
711
|
+
return _this.featureCommited(success, result);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
} else if (_this.props.editContext.action === "Pick") {
|
|
715
|
+
if (_this.props.iface.editFeatureMultipart) {
|
|
716
|
+
_this.props.iface.editFeatureMultipart(_this.props.editConfig, _this.props.map.projection, feature.id, featureData, function (success, result) {
|
|
717
|
+
return _this.featureCommited(success, result);
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
_this.props.iface.editFeature(_this.props.editConfig.editDataset, feature, _this.props.map.projection, function (success, result) {
|
|
721
|
+
return _this.featureCommited(success, result);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
_defineProperty(_this, "featureCommited", function (success, result) {
|
|
727
|
+
if (!success) {
|
|
728
|
+
_this.commitFinished(false, result);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
// Check for relation records which failed to commit
|
|
732
|
+
var relationValueErrors = Object.values(result.relationValues || []).find(function (entry) {
|
|
733
|
+
return (entry.features || []).find(function (f) {
|
|
734
|
+
return f.error;
|
|
735
|
+
});
|
|
736
|
+
}) !== undefined;
|
|
737
|
+
if (relationValueErrors) {
|
|
738
|
+
// Relation values commit failed, switch to pick to avoid adding feature again on next attempt
|
|
739
|
+
_this.commitFinished(false, LocaleUtils.tr("editing.relationcommitfailed"));
|
|
740
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
741
|
+
action: "Pick",
|
|
742
|
+
feature: result,
|
|
743
|
+
changed: true
|
|
744
|
+
});
|
|
745
|
+
} else {
|
|
746
|
+
_this.commitFinished(true, result);
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
_defineProperty(_this, "deleteClicked", function () {
|
|
750
|
+
_this.setState({
|
|
751
|
+
deleteClicked: true
|
|
752
|
+
});
|
|
753
|
+
_this.props.setCurrentTaskBlocked(true, LocaleUtils.tr("editing.unsavedchanged"));
|
|
754
|
+
});
|
|
755
|
+
_defineProperty(_this, "deleteFeature", function (action) {
|
|
756
|
+
if (action === 'Yes') {
|
|
757
|
+
_this.setState({
|
|
758
|
+
busy: true
|
|
759
|
+
});
|
|
760
|
+
var recaptchaResponse = null;
|
|
761
|
+
if (_this.state.captchaResponse) {
|
|
762
|
+
recaptchaResponse = _this.state.captchaResponse;
|
|
763
|
+
}
|
|
764
|
+
_this.props.iface.deleteFeature(_this.props.editConfig, _this.props.editContext.feature.id, _this.deleteFinished, recaptchaResponse);
|
|
765
|
+
} else {
|
|
766
|
+
_this.setState({
|
|
767
|
+
deleteClicked: false
|
|
768
|
+
});
|
|
769
|
+
_this.props.setCurrentTaskBlocked(false);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
_defineProperty(_this, "commitFinished", function (success, result) {
|
|
773
|
+
_this.setState({
|
|
774
|
+
busy: false
|
|
775
|
+
});
|
|
776
|
+
if (success) {
|
|
777
|
+
_this.props.refreshLayer(function (layer) {
|
|
778
|
+
return layer.role === LayerRole.THEME;
|
|
779
|
+
});
|
|
780
|
+
_this.props.setCurrentTaskBlocked(false);
|
|
781
|
+
if (!_this.props.onCommit || !_this.props.onCommit(result)) {
|
|
782
|
+
if (!isEmpty(_this.state.relationTables)) {
|
|
783
|
+
// Re-load relation values
|
|
784
|
+
_this.loadRelationValues(result, function (newFeature) {
|
|
785
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
786
|
+
action: 'Pick',
|
|
787
|
+
feature: newFeature,
|
|
788
|
+
changed: false
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
// Re-validate feature field constraints
|
|
792
|
+
_this.validateFieldConstraints(result);
|
|
793
|
+
} else {
|
|
794
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
795
|
+
action: 'Pick',
|
|
796
|
+
feature: result,
|
|
797
|
+
changed: false
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
} else {
|
|
802
|
+
// eslint-disable-next-line
|
|
803
|
+
alert(result);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
_defineProperty(_this, "deleteFinished", function (success, result) {
|
|
807
|
+
_this.setState({
|
|
808
|
+
busy: false
|
|
809
|
+
});
|
|
810
|
+
if (success) {
|
|
811
|
+
_this.setState({
|
|
812
|
+
deleteClicked: false
|
|
813
|
+
});
|
|
814
|
+
_this.props.setCurrentTaskBlocked(false);
|
|
815
|
+
_this.props.refreshLayer(function (layer) {
|
|
816
|
+
return layer.role === LayerRole.THEME;
|
|
817
|
+
});
|
|
818
|
+
if (!_this.props.onDelete || !_this.props.onDelete(result)) {
|
|
819
|
+
_this.props.setEditContext(_this.props.editContext.id, {
|
|
820
|
+
feature: null,
|
|
821
|
+
changed: false
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
} else {
|
|
825
|
+
// eslint-disable-next-line
|
|
826
|
+
alert(result);
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
_defineProperty(_this, "dataUriToBlob", function (dataUri) {
|
|
830
|
+
var parts = dataUri.split(',');
|
|
831
|
+
var byteString = parts[0].indexOf('base64') >= 0 ? atob(parts[1]) : decodeURI(parts[1]);
|
|
832
|
+
var mimeString = parts[0].split(':')[1].split(';')[0];
|
|
833
|
+
var ia = new Uint8Array(byteString.length);
|
|
834
|
+
for (var i = 0; i < byteString.length; i++) {
|
|
835
|
+
ia[i] = byteString.charCodeAt(i);
|
|
836
|
+
}
|
|
837
|
+
return new Blob([ia], {
|
|
838
|
+
type: mimeString
|
|
839
|
+
});
|
|
840
|
+
});
|
|
841
|
+
_defineProperty(_this, "startChildEdit", function (action, layer, featureId, updateField, displayField) {
|
|
842
|
+
var editConfig = (_this.props.theme.editConfig || {})[layer];
|
|
843
|
+
if (!editConfig) {
|
|
844
|
+
// eslint-disable-next-line
|
|
845
|
+
console.warn("No edit config found for linked edit layer " + layer);
|
|
846
|
+
} else {
|
|
847
|
+
_this.setState({
|
|
848
|
+
childEdit: {
|
|
849
|
+
action: action,
|
|
850
|
+
editConfig: editConfig,
|
|
851
|
+
editContextId: ':' + layer,
|
|
852
|
+
displayField: displayField,
|
|
853
|
+
featureId: featureId,
|
|
854
|
+
updateField: updateField,
|
|
855
|
+
finishCallback: _this.finishChildEdit
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
_defineProperty(_this, "finishChildEdit", function (feature) {
|
|
861
|
+
_this.props.clearEditContext(_this.state.childEdit.editContextId, _this.props.editContext.id);
|
|
862
|
+
if (feature && feature.id !== _this.state.childEdit.featureId) {
|
|
863
|
+
_this.state.childEdit.updateField(feature.id);
|
|
864
|
+
}
|
|
865
|
+
_this.setState({
|
|
866
|
+
childEdit: null
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
_this.form = null;
|
|
870
|
+
return _this;
|
|
871
|
+
}
|
|
872
|
+
_inherits(AttributeForm, _React$Component);
|
|
873
|
+
return _createClass(AttributeForm, [{
|
|
874
|
+
key: "componentDidUpdate",
|
|
875
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
876
|
+
var _this2 = this;
|
|
877
|
+
if (prevProps.editContext.changed !== this.props.editContext.changed) {
|
|
878
|
+
this.props.setCurrentTaskBlocked(this.props.editContext.changed === true, LocaleUtils.tr("editing.unsavedchanged"));
|
|
879
|
+
}
|
|
880
|
+
if ((!this.props.editContext.feature || this.props.editContext.changed) && this.state.deleteClicked) {
|
|
881
|
+
this.setState({
|
|
882
|
+
deleteClicked: false
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
// Reload relation values if necessary
|
|
886
|
+
var feature = this.props.editContext.feature;
|
|
887
|
+
var prevFeature = prevProps.editContext.feature;
|
|
888
|
+
if ((!this.props.editContext.changed || !feature.relationValues) && (this.state.relationTables !== prevState.relationTables || feature.id !== (prevFeature || {}).id)) {
|
|
889
|
+
this.loadRelationValues(this.props.editContext.feature, function (newFeature) {
|
|
890
|
+
_this2.props.setEditContext(_this2.props.editContext.id, {
|
|
891
|
+
feature: newFeature
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
// Re-validate feature field constraints
|
|
895
|
+
this.validateFieldConstraints(this.props.editContext.feature);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}]);
|
|
899
|
+
}(React.Component);
|
|
900
|
+
_defineProperty(AttributeForm, "propTypes", {
|
|
901
|
+
childPickFilter: PropTypes.func,
|
|
902
|
+
clearEditContext: PropTypes.func,
|
|
903
|
+
deleteLabel: PropTypes.string,
|
|
904
|
+
editConfig: PropTypes.object,
|
|
905
|
+
editContext: PropTypes.object,
|
|
906
|
+
hideDelete: PropTypes.bool,
|
|
907
|
+
iface: PropTypes.object,
|
|
908
|
+
map: PropTypes.object,
|
|
909
|
+
onCommit: PropTypes.func,
|
|
910
|
+
onDelete: PropTypes.func,
|
|
911
|
+
onDiscard: PropTypes.func,
|
|
912
|
+
readOnly: PropTypes.bool,
|
|
913
|
+
refreshLayer: PropTypes.func,
|
|
914
|
+
report: PropTypes.bool,
|
|
915
|
+
setCurrentTaskBlocked: PropTypes.func,
|
|
916
|
+
setEditContext: PropTypes.func,
|
|
917
|
+
theme: PropTypes.object,
|
|
918
|
+
touchFriendly: PropTypes.bool
|
|
919
|
+
});
|
|
920
|
+
_defineProperty(AttributeForm, "defaultProps", {
|
|
921
|
+
touchFriendly: true
|
|
922
|
+
});
|
|
923
|
+
export default connect(function (state) {
|
|
924
|
+
return {
|
|
925
|
+
map: state.map,
|
|
926
|
+
theme: state.theme.current
|
|
927
|
+
};
|
|
928
|
+
}, {
|
|
929
|
+
clearEditContext: clearEditContext,
|
|
930
|
+
setEditContext: setEditContext,
|
|
931
|
+
setCurrentTaskBlocked: setCurrentTaskBlocked,
|
|
932
|
+
refreshLayer: refreshLayer
|
|
933
|
+
})(AttributeForm);
|