qwc2 2026.8.6 → 2026.8.7
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 +8 -0
- package/components/EditUploadField.js +7 -6
- package/components/LinkFeatureForm.js +7 -2
- package/components/QtDesignerForm.js +99 -84
- package/components/style/QtDesignerForm.css +11 -13
- package/components/style/SearchBox.css +7 -4
- package/components/widgets/TextInput.js +3 -9
- package/package.json +1 -1
|
@@ -575,6 +575,10 @@ var AttributeForm = /*#__PURE__*/function (_React$Component) {
|
|
|
575
575
|
// Ensure numeric values are numbers and not strings
|
|
576
576
|
value = Number(value);
|
|
577
577
|
}
|
|
578
|
+
if (nrelFieldConfig.type === 'boolean' && value !== null && typeof value === "string") {
|
|
579
|
+
// Ensure boolean values are bools
|
|
580
|
+
value = value.trim().toLowerCase() === "true";
|
|
581
|
+
}
|
|
578
582
|
|
|
579
583
|
// relationValues for table must exist as rows are either pre-existing or were added
|
|
580
584
|
if (!(field in relationValues[datasetname].features[index].properties)) {
|
|
@@ -621,6 +625,10 @@ var AttributeForm = /*#__PURE__*/function (_React$Component) {
|
|
|
621
625
|
// Ensure numeric values are numbers and not strings
|
|
622
626
|
value = Number(value);
|
|
623
627
|
}
|
|
628
|
+
if (fieldConfig.type === 'boolean' && value !== null && typeof value === "string") {
|
|
629
|
+
// Ensure boolean values are bools
|
|
630
|
+
value = value.trim().toLowerCase() === "true";
|
|
631
|
+
}
|
|
624
632
|
if (!(name in feature.properties)) {
|
|
625
633
|
feature.defaultedProperties = [].concat(_toConsumableArray(feature.defaultedProperties || []), [name]);
|
|
626
634
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
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
2
|
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
3
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
4
|
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); } }
|
|
7
5
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -210,18 +208,21 @@ var EditUploadField = /*#__PURE__*/function (_React$Component) {
|
|
|
210
208
|
}, {
|
|
211
209
|
key: "render",
|
|
212
210
|
value: function render() {
|
|
213
|
-
var _this$
|
|
211
|
+
var _this$props$constrain,
|
|
212
|
+
_this$props$constrain2,
|
|
213
|
+
_this$state$imageData2,
|
|
214
214
|
_fileType$startsWith2,
|
|
215
215
|
_this2 = this;
|
|
216
216
|
var isAttachment = this.props.value.startsWith("attachment:");
|
|
217
217
|
var fileValue = isAttachment ? this.props.value.replace(/attachment:\/\//, '') : this.props.value;
|
|
218
218
|
var fileType = mime.lookup(fileValue);
|
|
219
219
|
var fileUrl = isAttachment ? this.props.iface.resolveAttachmentUrl(this.props.dataset, fileValue) : fileValue;
|
|
220
|
-
var constraints =
|
|
221
|
-
|
|
220
|
+
var constraints = {
|
|
221
|
+
required: (_this$props$constrain = this.props.constraints) === null || _this$props$constrain === void 0 ? void 0 : _this$props$constrain.required,
|
|
222
|
+
accept: (((_this$props$constrain2 = this.props.constraints) === null || _this$props$constrain2 === void 0 ? void 0 : _this$props$constrain2.accept) || "").split(",").map(function (ext) {
|
|
222
223
|
return mime.lookup(ext);
|
|
223
224
|
}).join(",")
|
|
224
|
-
}
|
|
225
|
+
};
|
|
225
226
|
var mediaSupport = 'mediaDevices' in navigator && constraints.accept.split(",").includes("image/jpeg");
|
|
226
227
|
var imageData = (_this$state$imageData2 = this.state.imageData) !== null && _this$state$imageData2 !== void 0 ? _this$state$imageData2 : fileType !== null && fileType !== void 0 && (_fileType$startsWith2 = fileType.startsWith) !== null && _fileType$startsWith2 !== void 0 && _fileType$startsWith2.call(fileType, 'image/') ? fileUrl : null;
|
|
227
228
|
if (imageData) {
|
|
@@ -31,6 +31,7 @@ import { getFeatureTemplate } from '../utils/EditingUtils';
|
|
|
31
31
|
import LocaleUtils from '../utils/LocaleUtils';
|
|
32
32
|
import MapUtils from '../utils/MapUtils';
|
|
33
33
|
import AttributeForm from './AttributeForm';
|
|
34
|
+
import Icon from './Icon';
|
|
34
35
|
import './style/LinkFeatureForm.css';
|
|
35
36
|
var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
36
37
|
function LinkFeatureForm() {
|
|
@@ -203,7 +204,9 @@ var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
|
203
204
|
}, /*#__PURE__*/React.createElement("button", {
|
|
204
205
|
className: "button",
|
|
205
206
|
onClick: this.close
|
|
206
|
-
},
|
|
207
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
208
|
+
icon: "remove"
|
|
209
|
+
}), LocaleUtils.tr("common.close"))));
|
|
207
210
|
} else if (editContext.feature) {
|
|
208
211
|
var drawing = editContext.action === 'Draw' && !editContext.feature.geometry && this.props.editConfig.geomType;
|
|
209
212
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -223,7 +226,9 @@ var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
|
223
226
|
}, /*#__PURE__*/React.createElement("button", {
|
|
224
227
|
className: "button",
|
|
225
228
|
onClick: this.close
|
|
226
|
-
},
|
|
229
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
230
|
+
icon: "remove"
|
|
231
|
+
}), editContext.action === 'Draw' ? LocaleUtils.tr("common.cancel") : LocaleUtils.tr("common.close"))));
|
|
227
232
|
} else {
|
|
228
233
|
return null;
|
|
229
234
|
}
|
|
@@ -5,7 +5,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
5
5
|
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; }
|
|
6
6
|
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; } }
|
|
7
7
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
-
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); }
|
|
9
8
|
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; }
|
|
10
9
|
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; }
|
|
11
10
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -78,6 +77,12 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
78
77
|
_defineProperty(_this, "state", {
|
|
79
78
|
reevaluate: 0
|
|
80
79
|
});
|
|
80
|
+
_defineProperty(_this, "isVertical", function (orientation) {
|
|
81
|
+
return orientation === "Qt::Vertical" || orientation === "Qt::Orientation::Vertical";
|
|
82
|
+
});
|
|
83
|
+
_defineProperty(_this, "isHorizontal", function (orientation) {
|
|
84
|
+
return orientation === "Qt::Horizontal" || orientation === "Qt::Orientation::Horizontal";
|
|
85
|
+
});
|
|
81
86
|
_defineProperty(_this, "renderLayout", function (layout, feature, editConfig, updateField) {
|
|
82
87
|
var _this$props$editConfi;
|
|
83
88
|
var nametransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (name) {
|
|
@@ -110,6 +115,9 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
110
115
|
};
|
|
111
116
|
} else if (layout["class"] === "QVBoxLayout") {
|
|
112
117
|
containerClass = "qt-designer-layout-grid";
|
|
118
|
+
containerStyle = {
|
|
119
|
+
gridTemplateRows: _this.computeLayoutRows(layout.item, true).join(" ")
|
|
120
|
+
};
|
|
113
121
|
itemStyle = function itemStyle(item, idx) {
|
|
114
122
|
return {
|
|
115
123
|
gridArea: 1 + idx + "/1/ span 1/ span 1"
|
|
@@ -138,7 +146,8 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
138
146
|
containerStyle.display = 'none';
|
|
139
147
|
}
|
|
140
148
|
if (layout.item.find(function (item) {
|
|
141
|
-
|
|
149
|
+
var _item$spacer$property;
|
|
150
|
+
return item.spacer && _this.isVertical((_item$spacer$property = item.spacer.property) === null || _item$spacer$property === void 0 ? void 0 : _item$spacer$property.orientation);
|
|
142
151
|
})) {
|
|
143
152
|
containerStyle.height = '100%';
|
|
144
153
|
}
|
|
@@ -172,18 +181,14 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
172
181
|
var useIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
173
182
|
var columns = [];
|
|
174
183
|
var hasAuto = false;
|
|
175
|
-
var hasSpacer = items.find(function (item) {
|
|
176
|
-
var _item$spacer;
|
|
177
|
-
return ((_item$spacer = item.spacer) === null || _item$spacer === void 0 || (_item$spacer = _item$spacer.property) === null || _item$spacer === void 0 ? void 0 : _item$spacer.orientation) === "Qt::Horizontal";
|
|
178
|
-
});
|
|
179
184
|
items.forEach(function (item, index) {
|
|
180
|
-
var _item$
|
|
185
|
+
var _item$spacer, _item$widget;
|
|
181
186
|
var col = useIndex ? index : parseInt(item.column, 10) || 0;
|
|
182
187
|
var colSpan = useIndex ? 1 : parseInt(item.colspan, 10) || 1;
|
|
183
|
-
if (((_item$
|
|
184
|
-
columns[col] = '
|
|
188
|
+
if (_this.isHorizontal((_item$spacer = item.spacer) === null || _item$spacer === void 0 || (_item$spacer = _item$spacer.property) === null || _item$spacer === void 0 ? void 0 : _item$spacer.orientation)) {
|
|
189
|
+
columns[col] = '1fr';
|
|
185
190
|
hasAuto = true;
|
|
186
|
-
} else if (!
|
|
191
|
+
} else if (!hFitWidgets.includes((_item$widget = item.widget) === null || _item$widget === void 0 ? void 0 : _item$widget["class"]) && colSpan === 1) {
|
|
187
192
|
columns[col] = 'auto';
|
|
188
193
|
hasAuto = true;
|
|
189
194
|
} else {
|
|
@@ -200,20 +205,18 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
200
205
|
_defineProperty(_this, "computeLayoutRows", function (items) {
|
|
201
206
|
var useIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
202
207
|
var rows = [];
|
|
203
|
-
var hasSpacer = items.find(function (item) {
|
|
204
|
-
var _item$spacer3;
|
|
205
|
-
return ((_item$spacer3 = item.spacer) === null || _item$spacer3 === void 0 || (_item$spacer3 = _item$spacer3.property) === null || _item$spacer3 === void 0 ? void 0 : _item$spacer3.orientation) === "Qt::Vertical";
|
|
206
|
-
});
|
|
207
208
|
items.forEach(function (item, index) {
|
|
208
|
-
var _item$
|
|
209
|
+
var _item$spacer2, _item$widget$layout, _item$widget2, _item$widget4, _item$widget4$startsW, _item$widget5;
|
|
209
210
|
var row = useIndex ? index : parseInt(item.row, 10) || 0;
|
|
210
211
|
var rowSpan = useIndex ? 1 : parseInt(item.rowspan, 10) || 1;
|
|
211
|
-
if (((_item$
|
|
212
|
+
if (_this.isVertical((_item$spacer2 = item.spacer) === null || _item$spacer2 === void 0 || (_item$spacer2 = _item$spacer2.property) === null || _item$spacer2 === void 0 ? void 0 : _item$spacer2.orientation)) {
|
|
213
|
+
rows[row] = '1fr';
|
|
214
|
+
} else if ((_item$widget$layout = (_item$widget2 = item.widget) === null || _item$widget2 === void 0 ? void 0 : _item$widget2.layout) !== null && _item$widget$layout !== void 0 ? _item$widget$layout : item.layout) {
|
|
215
|
+
var _item$widget3, _item$layout;
|
|
216
|
+
rows[row] = (_item$widget3 = item.widget) !== null && _item$widget3 !== void 0 && (_item$widget3 = _item$widget3.layout) !== null && _item$widget3 !== void 0 && _item$widget3.verticalFill || (_item$layout = item.layout) !== null && _item$layout !== void 0 && _item$layout.verticalFill ? 'auto' : null; // Placeholder replaced by fit-content below
|
|
217
|
+
} else if ((_item$widget4 = item.widget) !== null && _item$widget4 !== void 0 && (_item$widget4 = _item$widget4.name) !== null && _item$widget4 !== void 0 && (_item$widget4$startsW = _item$widget4.startsWith) !== null && _item$widget4$startsW !== void 0 && _item$widget4$startsW.call(_item$widget4, "nrel_")) {
|
|
212
218
|
rows[row] = 'auto';
|
|
213
|
-
} else if ((
|
|
214
|
-
var _item$widget4, _item$layout;
|
|
215
|
-
rows[row] = (_item$widget4 = item.widget) !== null && _item$widget4 !== void 0 && (_item$widget4 = _item$widget4.layout) !== null && _item$widget4 !== void 0 && _item$widget4.verticalFill || (_item$layout = item.layout) !== null && _item$layout !== void 0 && _item$layout.verticalFill ? 'auto' : null; // Placeholder replaced by fit-content below
|
|
216
|
-
} else if (!hasSpacer && !vFitWidgets.includes((_item$widget5 = item.widget) === null || _item$widget5 === void 0 ? void 0 : _item$widget5["class"]) && rowSpan === 1) {
|
|
219
|
+
} else if (!vFitWidgets.includes((_item$widget5 = item.widget) === null || _item$widget5 === void 0 ? void 0 : _item$widget5["class"]) && rowSpan === 1) {
|
|
217
220
|
rows[row] = 'auto';
|
|
218
221
|
} else {
|
|
219
222
|
var _rows$row;
|
|
@@ -241,11 +244,10 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
241
244
|
var attr = widget.attribute || {};
|
|
242
245
|
var fieldname = widget.name.replace(/kvrel__/, '').split("__")[isRelWidget ? 1 : 0];
|
|
243
246
|
var field = fields[fieldname];
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
inputConstraints.placeholder = prop.placeholderText || fieldConstraints.placeholder || "";
|
|
247
|
+
var constraints = (field === null || field === void 0 ? void 0 : field.constraints) || {};
|
|
248
|
+
constraints.readOnly = _this.props.readOnly || constraints.readOnly === true || String(prop.readOnly) === "true" || String(prop.enabled) === "false" || disabled;
|
|
249
|
+
constraints.required = !constraints.readOnly && (constraints.required || String(prop.required) === "true");
|
|
250
|
+
constraints.placeholder = prop.placeholderText || constraints.placeholder || "";
|
|
249
251
|
var fontProps = prop.font || {};
|
|
250
252
|
var fontStyle = {
|
|
251
253
|
fontWeight: String(fontProps.bold) === "true" ? "bold" : "normal",
|
|
@@ -269,16 +271,16 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
269
271
|
if (widget.name.startsWith("ext__")) {
|
|
270
272
|
updateField = null;
|
|
271
273
|
value = _this.state.formData.externalFields[widget.name.slice(5)];
|
|
272
|
-
|
|
274
|
+
constraints.readOnly = true;
|
|
273
275
|
} else {
|
|
274
276
|
elname = nametransform(widget.name);
|
|
275
277
|
}
|
|
276
278
|
if (widget.component) {
|
|
277
279
|
return /*#__PURE__*/React.createElement(widget.component, {
|
|
278
280
|
addRelationRecord: _this.props.addRelationRecord,
|
|
281
|
+
constraints: constraints,
|
|
279
282
|
editConfigs: _this.props.editConfigs,
|
|
280
283
|
feature: _this.props.feature,
|
|
281
|
-
inputConstraints: inputConstraints,
|
|
282
284
|
mapPrefix: _this.props.mapPrefix,
|
|
283
285
|
name: elname,
|
|
284
286
|
onChange: function onChange(val) {
|
|
@@ -315,7 +317,7 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
315
317
|
}
|
|
316
318
|
} else if (widget["class"] === "Line") {
|
|
317
319
|
var _widget$property;
|
|
318
|
-
var linetype = ((_widget$property = widget.property) === null || _widget$property === void 0 ? void 0 : _widget$property.orientation)
|
|
320
|
+
var linetype = _this.isVertical((_widget$property = widget.property) === null || _widget$property === void 0 ? void 0 : _widget$property.orientation) ? "vline" : "hline";
|
|
319
321
|
return /*#__PURE__*/React.createElement("div", {
|
|
320
322
|
className: "qt-designer-form-" + linetype
|
|
321
323
|
});
|
|
@@ -411,17 +413,19 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
411
413
|
}, value);
|
|
412
414
|
} else {
|
|
413
415
|
var addLinkAnchors = ConfigUtils.getConfigProp("editingAddLinkAnchors") !== false;
|
|
414
|
-
return /*#__PURE__*/React.createElement(TextInput,
|
|
416
|
+
return /*#__PURE__*/React.createElement(TextInput, {
|
|
415
417
|
addLinkAnchors: addLinkAnchors,
|
|
416
418
|
multiline: true,
|
|
417
419
|
name: elname,
|
|
418
420
|
onChange: function onChange(val) {
|
|
419
421
|
return updateField(widget.name, val);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
+
},
|
|
423
|
+
placeholder: constraints.placeholder,
|
|
424
|
+
readOnly: constraints.readOnly,
|
|
425
|
+
required: constraints.required,
|
|
422
426
|
style: fontStyle,
|
|
423
427
|
value: String(value)
|
|
424
|
-
})
|
|
428
|
+
});
|
|
425
429
|
}
|
|
426
430
|
} else if (widget["class"] === "QLineEdit") {
|
|
427
431
|
if (widget.name.endsWith("__upload")) {
|
|
@@ -429,14 +433,14 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
429
433
|
var fieldId = widget.name.replace(/__upload/, '');
|
|
430
434
|
var uploadValue = ((_feature$properties4 = feature.properties) === null || _feature$properties4 === void 0 ? void 0 : _feature$properties4[fieldId]) || "";
|
|
431
435
|
var uploadElName = elname.replace(/__upload/, '');
|
|
432
|
-
var
|
|
436
|
+
var widgetConstraints = {
|
|
433
437
|
accept: prop.text || "",
|
|
434
|
-
required:
|
|
438
|
+
required: constraints.required
|
|
435
439
|
};
|
|
436
440
|
return /*#__PURE__*/React.createElement(EditUploadField, {
|
|
437
|
-
constraints:
|
|
441
|
+
constraints: widgetConstraints,
|
|
438
442
|
dataset: editConfig.editDataset,
|
|
439
|
-
disabled:
|
|
443
|
+
disabled: constraints.readOnly,
|
|
440
444
|
fieldId: fieldId,
|
|
441
445
|
iface: _this.props.iface,
|
|
442
446
|
name: uploadElName,
|
|
@@ -446,8 +450,8 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
446
450
|
});
|
|
447
451
|
} else {
|
|
448
452
|
var _feature$properties$w4, _feature$properties5;
|
|
449
|
-
if (
|
|
450
|
-
value = value.toFixed(
|
|
453
|
+
if (constraints.prec !== undefined && typeof value === 'number') {
|
|
454
|
+
value = value.toFixed(constraints.prec);
|
|
451
455
|
} else if (value === "" && ((_feature$properties$w4 = (_feature$properties5 = feature.properties) === null || _feature$properties5 === void 0 ? void 0 : _feature$properties5[widget.name]) !== null && _feature$properties$w4 !== void 0 ? _feature$properties$w4 : null) === null) {
|
|
452
456
|
var _ConfigUtils$getConfi2;
|
|
453
457
|
value = (_ConfigUtils$getConfi2 = ConfigUtils.getConfigProp("editTextNullValue")) !== null && _ConfigUtils$getConfi2 !== void 0 ? _ConfigUtils$getConfi2 : "";
|
|
@@ -455,21 +459,23 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
455
459
|
if (_this.props.report) {
|
|
456
460
|
return /*#__PURE__*/React.createElement("div", {
|
|
457
461
|
style: fontStyle
|
|
458
|
-
}, value ||
|
|
462
|
+
}, value || constraints.placeholder);
|
|
459
463
|
} else {
|
|
460
464
|
var _addLinkAnchors = ConfigUtils.getConfigProp("editingAddLinkAnchors") !== false;
|
|
461
465
|
var editTextNullValue = ConfigUtils.getConfigProp("editTextNullValue");
|
|
462
|
-
return /*#__PURE__*/React.createElement(TextInput,
|
|
466
|
+
return /*#__PURE__*/React.createElement(TextInput, {
|
|
463
467
|
addLinkAnchors: _addLinkAnchors,
|
|
464
468
|
clearValue: editTextNullValue,
|
|
465
469
|
name: elname,
|
|
466
470
|
onChange: function onChange(val) {
|
|
467
471
|
return updateField(widget.name, val);
|
|
468
|
-
}
|
|
469
|
-
|
|
472
|
+
},
|
|
473
|
+
placeholder: constraints.placeholder,
|
|
474
|
+
readOnly: constraints.readOnly,
|
|
475
|
+
required: constraints.required,
|
|
470
476
|
style: fontStyle,
|
|
471
477
|
value: String(value)
|
|
472
|
-
})
|
|
478
|
+
});
|
|
473
479
|
}
|
|
474
480
|
}
|
|
475
481
|
} else if (widget["class"] === "QCheckBox" || widget["class"] === "QRadioButton") {
|
|
@@ -479,17 +485,17 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
479
485
|
var checked = inGroup ? ((_this$props$feature$p = _this.props.feature.properties) === null || _this$props$feature$p === void 0 ? void 0 : _this$props$feature$p[_this.groupOrName(widget)]) === widget.name : value;
|
|
480
486
|
return /*#__PURE__*/React.createElement("label", {
|
|
481
487
|
style: fontStyle
|
|
482
|
-
}, /*#__PURE__*/React.createElement("input",
|
|
488
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
483
489
|
checked: checked,
|
|
484
|
-
disabled:
|
|
490
|
+
disabled: constraints.readOnly,
|
|
485
491
|
name: nametransform(_this.groupOrName(widget)),
|
|
486
492
|
onChange: function onChange(ev) {
|
|
487
493
|
return updateField(_this.groupOrName(widget), inGroup ? widget.name : ev.target.checked);
|
|
488
|
-
}
|
|
489
|
-
|
|
494
|
+
},
|
|
495
|
+
required: constraints.required,
|
|
490
496
|
type: type,
|
|
491
497
|
value: widget.name
|
|
492
|
-
})
|
|
498
|
+
}), widget.property.text);
|
|
493
499
|
} else if (widget["class"] === "QComboBox") {
|
|
494
500
|
var parts = widget.name.split("__");
|
|
495
501
|
if ((parts.length === 5 || parts.length === 6) && parts[0] === "kvrel") {
|
|
@@ -517,33 +523,34 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
517
523
|
mapPrefix: _this.props.mapPrefix,
|
|
518
524
|
multiSelect: widget.property.allowMulti === true || widget.allowMulti === "true",
|
|
519
525
|
name: nametransform(_fieldId),
|
|
520
|
-
placeholder:
|
|
521
|
-
readOnly:
|
|
522
|
-
required:
|
|
523
|
-
showAdd:
|
|
524
|
-
showEdit:
|
|
526
|
+
placeholder: constraints.placeholder,
|
|
527
|
+
readOnly: constraints.readOnly,
|
|
528
|
+
required: constraints.required,
|
|
529
|
+
showAdd: constraints.showAdd,
|
|
530
|
+
showEdit: constraints.showEdit,
|
|
525
531
|
style: fontStyle,
|
|
526
532
|
switchEditContext: _this.props.switchEditContext,
|
|
527
533
|
updateField: updateField,
|
|
528
534
|
value: value
|
|
529
535
|
});
|
|
530
536
|
} else {
|
|
531
|
-
var values
|
|
537
|
+
var _constraints$values;
|
|
538
|
+
var values = widget.item ? MiscUtils.ensureArray(widget.item).map(function (item) {
|
|
532
539
|
var _item$property$value;
|
|
533
540
|
return {
|
|
534
541
|
label: item.property.text,
|
|
535
542
|
value: (_item$property$value = item.property.value) !== null && _item$property$value !== void 0 ? _item$property$value : item.property.text
|
|
536
543
|
};
|
|
537
|
-
});
|
|
544
|
+
}) : (_constraints$values = constraints.values) !== null && _constraints$values !== void 0 ? _constraints$values : [];
|
|
538
545
|
return /*#__PURE__*/React.createElement(EditComboField, {
|
|
539
546
|
editIface: _this.props.iface,
|
|
540
547
|
fieldId: widget.name,
|
|
541
548
|
key: widget.name,
|
|
542
549
|
mapPrefix: _this.props.mapPrefix,
|
|
543
550
|
name: elname,
|
|
544
|
-
placeholder:
|
|
545
|
-
readOnly:
|
|
546
|
-
required:
|
|
551
|
+
placeholder: constraints.placeholder,
|
|
552
|
+
readOnly: constraints.readOnly,
|
|
553
|
+
required: constraints.required,
|
|
547
554
|
style: fontStyle,
|
|
548
555
|
updateField: updateField,
|
|
549
556
|
value: value,
|
|
@@ -556,67 +563,75 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
556
563
|
var f = parseFloat(x);
|
|
557
564
|
return isNaN(f) ? undefined : f;
|
|
558
565
|
};
|
|
559
|
-
var min = floatConstraint((_prop$minimum = prop.minimum) !== null && _prop$minimum !== void 0 ? _prop$minimum :
|
|
560
|
-
var max = floatConstraint((_prop$maximum = prop.maximum) !== null && _prop$maximum !== void 0 ? _prop$maximum :
|
|
561
|
-
var step = (_ref = (_prop$singleStep = prop.singleStep) !== null && _prop$singleStep !== void 0 ? _prop$singleStep :
|
|
566
|
+
var min = floatConstraint((_prop$minimum = prop.minimum) !== null && _prop$minimum !== void 0 ? _prop$minimum : constraints.min);
|
|
567
|
+
var max = floatConstraint((_prop$maximum = prop.maximum) !== null && _prop$maximum !== void 0 ? _prop$maximum : constraints.max);
|
|
568
|
+
var step = (_ref = (_prop$singleStep = prop.singleStep) !== null && _prop$singleStep !== void 0 ? _prop$singleStep : constraints.step) !== null && _ref !== void 0 ? _ref : 1;
|
|
562
569
|
var precision = (_prop$decimals = prop.decimals) !== null && _prop$decimals !== void 0 ? _prop$decimals : 0;
|
|
563
570
|
if (widget["class"] === "QSlider") {
|
|
564
|
-
return /*#__PURE__*/React.createElement("input",
|
|
571
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
565
572
|
max: max,
|
|
566
573
|
min: min,
|
|
567
574
|
name: elname,
|
|
568
575
|
onChange: function onChange(ev) {
|
|
569
576
|
return updateField(widget.name, ev.target.value);
|
|
570
|
-
}
|
|
571
|
-
|
|
577
|
+
},
|
|
578
|
+
placeholder: constraints.placeholder,
|
|
579
|
+
readOnly: constraints.readOnly,
|
|
580
|
+
required: constraints.required,
|
|
572
581
|
size: 5,
|
|
573
582
|
step: step,
|
|
574
583
|
style: fontStyle,
|
|
575
584
|
type: "range",
|
|
576
585
|
value: value
|
|
577
|
-
})
|
|
586
|
+
});
|
|
578
587
|
} else {
|
|
579
588
|
var _feature$properties6;
|
|
580
|
-
return /*#__PURE__*/React.createElement(NumberInput,
|
|
589
|
+
return /*#__PURE__*/React.createElement(NumberInput, {
|
|
581
590
|
decimals: precision,
|
|
582
591
|
max: max,
|
|
583
592
|
min: min,
|
|
584
593
|
name: elname,
|
|
585
594
|
onChange: function onChange(val) {
|
|
586
595
|
return updateField(widget.name, val);
|
|
587
|
-
}
|
|
588
|
-
|
|
596
|
+
},
|
|
597
|
+
placeholder: constraints.placeholder,
|
|
598
|
+
readOnly: constraints.readOnly,
|
|
599
|
+
required: constraints.required,
|
|
589
600
|
step: step,
|
|
590
601
|
style: fontStyle,
|
|
591
602
|
value: (_feature$properties6 = feature.properties) === null || _feature$properties6 === void 0 ? void 0 : _feature$properties6[widget.name]
|
|
592
|
-
})
|
|
603
|
+
});
|
|
593
604
|
}
|
|
594
605
|
} else if (widget["class"] === "QDateEdit") {
|
|
595
606
|
var _min = prop.minimumDate ? _this.dateConstraint(prop.minimumDate) : "1600-01-01";
|
|
596
607
|
var _max = prop.maximumDate ? _this.dateConstraint(prop.maximumDate) : "9999-12-31";
|
|
597
|
-
return /*#__PURE__*/React.createElement("input",
|
|
608
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
598
609
|
max: _max,
|
|
599
610
|
min: _min,
|
|
600
611
|
name: elname,
|
|
601
612
|
onChange: function onChange(ev) {
|
|
602
613
|
return updateField(widget.name, ev.target.value);
|
|
603
|
-
}
|
|
604
|
-
|
|
614
|
+
},
|
|
615
|
+
placeholder: constraints.placeholder,
|
|
616
|
+
readOnly: constraints.readOnly,
|
|
617
|
+
required: constraints.required,
|
|
605
618
|
style: fontStyle,
|
|
606
619
|
type: "date",
|
|
607
620
|
value: value.split("T")[0]
|
|
608
|
-
})
|
|
621
|
+
});
|
|
609
622
|
} else if (widget["class"] === "QTimeEdit") {
|
|
610
|
-
return /*#__PURE__*/React.createElement("input",
|
|
623
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
611
624
|
name: elname,
|
|
612
625
|
onChange: function onChange(ev) {
|
|
613
626
|
return updateField(widget.name, ev.target.value);
|
|
614
|
-
}
|
|
615
|
-
|
|
627
|
+
},
|
|
628
|
+
placeholder: constraints.placeholder,
|
|
629
|
+
readOnly: constraints.readOnly,
|
|
630
|
+
required: constraints.required,
|
|
616
631
|
style: fontStyle,
|
|
617
632
|
type: "time",
|
|
618
633
|
value: value
|
|
619
|
-
})
|
|
634
|
+
});
|
|
620
635
|
} else if (widget["class"] === "QDateTimeEdit") {
|
|
621
636
|
var _min2 = prop.minimumDate ? _this.dateConstraint(prop.minimumDate) : "1600-01-01";
|
|
622
637
|
var _max2 = prop.maximumDate ? _this.dateConstraint(prop.maximumDate) : "9999-12-31";
|
|
@@ -627,8 +642,8 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
627
642
|
onChange: function onChange(val) {
|
|
628
643
|
return updateField(widget.name, val);
|
|
629
644
|
},
|
|
630
|
-
readOnly:
|
|
631
|
-
required:
|
|
645
|
+
readOnly: constraints.readOnly,
|
|
646
|
+
required: constraints.required,
|
|
632
647
|
style: fontStyle,
|
|
633
648
|
value: value,
|
|
634
649
|
valueHasTz: field.data_type === "timestamp with time zone"
|
|
@@ -638,8 +653,8 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
638
653
|
onChange: function onChange(val) {
|
|
639
654
|
return updateField(widget.name, val);
|
|
640
655
|
},
|
|
641
|
-
readOnly:
|
|
642
|
-
required:
|
|
656
|
+
readOnly: constraints.readOnly,
|
|
657
|
+
required: constraints.required,
|
|
643
658
|
type: field.type.slice(0, -2),
|
|
644
659
|
value: value
|
|
645
660
|
});
|
|
@@ -655,7 +670,7 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
655
670
|
if (widget.name.startsWith("btn__") && widget.onClick) {
|
|
656
671
|
return /*#__PURE__*/React.createElement("button", {
|
|
657
672
|
className: "button",
|
|
658
|
-
disabled:
|
|
673
|
+
disabled: constraints.readOnly,
|
|
659
674
|
onClick: function onClick() {
|
|
660
675
|
return widget.onClick(_this.props.setFormBusy);
|
|
661
676
|
},
|
|
@@ -910,7 +925,7 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
910
925
|
container.style.maxHeight = 'initial';
|
|
911
926
|
var startMouseY = ev.clientY;
|
|
912
927
|
var resizeInput = function resizeInput(event) {
|
|
913
|
-
container.style.height = Math.max(MiscUtils.convertEmToPx(
|
|
928
|
+
container.style.height = Math.max(MiscUtils.convertEmToPx(2.5), startHeight + (event.clientY - startMouseY)) + 'px';
|
|
914
929
|
};
|
|
915
930
|
ev.view.document.body.style.userSelect = 'none';
|
|
916
931
|
ev.view.addEventListener("pointermove", resizeInput);
|
|
@@ -1066,7 +1081,7 @@ var QtDesignerForm = /*#__PURE__*/function (_React$Component) {
|
|
|
1066
1081
|
return key !== "name";
|
|
1067
1082
|
})]));
|
|
1068
1083
|
}, {});
|
|
1069
|
-
if (item.spacer.property.orientation
|
|
1084
|
+
if (_this.isVertical(item.spacer.property.orientation)) {
|
|
1070
1085
|
verticalFill = true;
|
|
1071
1086
|
}
|
|
1072
1087
|
} else if (item.layout) {
|
|
@@ -2,16 +2,6 @@ div.qt-designer-form {
|
|
|
2
2
|
overflow: auto;
|
|
3
3
|
margin-bottom: 0.25em;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
div.qt-designer-form textarea {
|
|
7
|
-
height: 100%;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
div.qt-designer-form div.text-input-wrapper-multiline,
|
|
11
|
-
div.qt-designer-form div.text-input-wrapper-multiline > pre {
|
|
12
|
-
height: 100%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
5
|
div.qt-designer-form label > input {
|
|
16
6
|
margin-right: 0.25em;
|
|
17
7
|
}
|
|
@@ -92,8 +82,8 @@ div.qt-designer-widget-relation {
|
|
|
92
82
|
div.qt-designer-widget-relation-resize-handle {
|
|
93
83
|
touch-action: none;
|
|
94
84
|
position: absolute;
|
|
95
|
-
right:
|
|
96
|
-
bottom:
|
|
85
|
+
right: 1px;
|
|
86
|
+
bottom: 1px;
|
|
97
87
|
width: 0;
|
|
98
88
|
height: 0;
|
|
99
89
|
border-bottom: 10px solid var(--border-color);
|
|
@@ -102,6 +92,11 @@ div.qt-designer-widget-relation-resize-handle {
|
|
|
102
92
|
cursor: ns-resize;
|
|
103
93
|
}
|
|
104
94
|
|
|
95
|
+
div.qt-designer-form-frame > div.qt-designer-widget-relation > div.qt-designer-widget-relation-resize-handle {
|
|
96
|
+
right: calc(-0.25em + 1px);
|
|
97
|
+
bottom: calc(-0.25em + 1px);
|
|
98
|
+
}
|
|
99
|
+
|
|
105
100
|
div.qt-designer-widget-relation-table-container {
|
|
106
101
|
overflow-y: auto;
|
|
107
102
|
flex: 1 1 auto;
|
|
@@ -182,6 +177,10 @@ div.qt-designer-form label {
|
|
|
182
177
|
align-items: center;
|
|
183
178
|
}
|
|
184
179
|
|
|
180
|
+
div.qt-designer-form div.text-input-wrapper-multiline {
|
|
181
|
+
height: 100%;
|
|
182
|
+
}
|
|
183
|
+
|
|
185
184
|
div.qt-designer-form-featurelink-buttons {
|
|
186
185
|
display: flex;
|
|
187
186
|
}
|
|
@@ -199,7 +198,6 @@ div.qt-designer-report {
|
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
div.qt-designer-report input,
|
|
202
|
-
div.qt-designer-report textarea,
|
|
203
201
|
div.qt-designer-report select {
|
|
204
202
|
border: none!important;
|
|
205
203
|
outline: none!important;
|
|
@@ -10,12 +10,15 @@ div.searchbox-field {
|
|
|
10
10
|
button.searchbox-filter-button {
|
|
11
11
|
flex: 0 0 auto;
|
|
12
12
|
border-left-width: 0;
|
|
13
|
-
padding: 0
|
|
13
|
+
padding: 0 1em 0 0.5em;
|
|
14
|
+
position: relative;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
button.searchbox-filter-button > span.icon
|
|
17
|
-
font-size:
|
|
18
|
-
|
|
17
|
+
button.searchbox-filter-button > span.icon-chevron-down {
|
|
18
|
+
font-size: 80%;
|
|
19
|
+
position: absolute;
|
|
20
|
+
bottom: 0.25em;
|
|
21
|
+
right: 0.25em;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
div.searchbox-field > div.spinner {
|
|
@@ -196,11 +196,6 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
196
196
|
(_this$props$onNoChang = (_this$props = _this.props).onNoChange) === null || _this$props$onNoChang === void 0 || _this$props$onNoChang.call(_this$props);
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
|
-
_defineProperty(_this, "storeInitialHeight", function (el) {
|
|
200
|
-
if (el) {
|
|
201
|
-
_this.initialHeight = el.offsetHeight;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
199
|
_defineProperty(_this, "startResize", function (ev) {
|
|
205
200
|
var container = ev.target.parentElement;
|
|
206
201
|
if (!container) {
|
|
@@ -209,7 +204,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
209
204
|
var startHeight = container.offsetHeight;
|
|
210
205
|
var startMouseY = ev.clientY;
|
|
211
206
|
var resizeInput = function resizeInput(event) {
|
|
212
|
-
container.style.height = Math.max(
|
|
207
|
+
container.style.height = Math.max(MiscUtils.convertEmToPx(2), startHeight + (event.clientY - startMouseY)) + 'px';
|
|
213
208
|
};
|
|
214
209
|
document.body.style.userSelect = 'none';
|
|
215
210
|
ev.view.addEventListener("pointermove", resizeInput);
|
|
@@ -221,7 +216,6 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
221
216
|
});
|
|
222
217
|
});
|
|
223
218
|
_this.focusEnterClick = false;
|
|
224
|
-
_this.initialHeight = null;
|
|
225
219
|
_this.input = null;
|
|
226
220
|
_this.tooltipEl = null;
|
|
227
221
|
_this.tooltipTimeout = null;
|
|
@@ -246,6 +240,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
246
240
|
var _this2 = this;
|
|
247
241
|
var wrapperClassName = classNames({
|
|
248
242
|
"TextInput": true,
|
|
243
|
+
"text-input-wrapper-multiline": this.props.multiline,
|
|
249
244
|
"text-input-wrapper": true,
|
|
250
245
|
"text-input-wrapper-focused": this.state.focus
|
|
251
246
|
});
|
|
@@ -263,8 +258,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
263
258
|
}
|
|
264
259
|
return /*#__PURE__*/React.createElement("div", {
|
|
265
260
|
className: wrapperClassName + " " + (this.props.className || ""),
|
|
266
|
-
onClick: MiscUtils.killEvent
|
|
267
|
-
ref: this.storeInitialHeight
|
|
261
|
+
onClick: MiscUtils.killEvent
|
|
268
262
|
}, this.props.name ? /*#__PURE__*/React.createElement("textarea", {
|
|
269
263
|
className: "text-input-form-el",
|
|
270
264
|
name: this.props.name,
|