@luomus/laji-form 15.1.63 → 15.1.65
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/dist/laji-form.js +1 -1
- package/dist/laji-form.js.LICENSE.txt +1 -1
- package/lib/Context.d.ts +1 -1
- package/lib/Context.js +1 -2
- package/lib/ReactContext.js +22 -8
- package/lib/components/BaseComponent.d.ts +1 -2
- package/lib/components/BaseComponent.js +2 -3
- package/lib/components/LajiForm.d.ts +13 -13
- package/lib/components/LajiForm.js +51 -35
- package/lib/components/VirtualSchemaField.d.ts +14 -14
- package/lib/components/VirtualSchemaField.js +31 -18
- package/lib/components/components/Affix.d.ts +2 -2
- package/lib/components/components/Affix.js +25 -12
- package/lib/components/components/Button.d.ts +6 -6
- package/lib/components/components/Button.js +23 -9
- package/lib/components/components/DeleteButton.d.ts +4 -4
- package/lib/components/components/DeleteButton.js +25 -11
- package/lib/components/components/ErrorPanel.d.ts +3 -3
- package/lib/components/components/ErrorPanel.js +22 -8
- package/lib/components/components/FailedBackgroundJobsPanel.d.ts +2 -2
- package/lib/components/components/FailedBackgroundJobsPanel.js +25 -11
- package/lib/components/components/FetcherInput.d.ts +1 -1
- package/lib/components/components/FetcherInput.js +28 -14
- package/lib/components/components/Fullscreen.d.ts +1 -1
- package/lib/components/components/Fullscreen.js +23 -9
- package/lib/components/components/GlyphButton.d.ts +5 -5
- package/lib/components/components/GlyphButton.js +22 -8
- package/lib/components/components/Help.d.ts +1 -1
- package/lib/components/components/Help.js +25 -12
- package/lib/components/components/Label.d.ts +1 -1
- package/lib/components/components/Label.js +24 -11
- package/lib/components/components/OverlayTrigger.d.ts +4 -4
- package/lib/components/components/OverlayTrigger.js +22 -8
- package/lib/components/components/Stretch.d.ts +4 -4
- package/lib/components/components/Stretch.js +25 -11
- package/lib/components/components/TooltipComponent.d.ts +1 -1
- package/lib/components/components/TooltipComponent.js +26 -12
- package/lib/components/components/index.js +5 -1
- package/lib/components/fields/AnnotationField.d.ts +8 -4
- package/lib/components/fields/AnnotationField.js +34 -20
- package/lib/components/fields/AnyToBooleanField.d.ts +4 -4
- package/lib/components/fields/AnyToBooleanField.js +22 -8
- package/lib/components/fields/ArrayBulkField.d.ts +9 -4
- package/lib/components/fields/ArrayBulkField.js +24 -10
- package/lib/components/fields/ArrayCombinerField.d.ts +4 -4
- package/lib/components/fields/ArrayCombinerField.js +25 -11
- package/lib/components/fields/ArrayField.d.ts +1 -0
- package/lib/components/fields/ArrayField.js +41 -27
- package/lib/components/fields/ArrayPropertySumField.d.ts +2 -2
- package/lib/components/fields/ArrayPropertySumField.js +24 -10
- package/lib/components/fields/AsArrayField.d.ts +7 -5
- package/lib/components/fields/AsArrayField.js +22 -8
- package/lib/components/fields/AudioArrayField.js +22 -8
- package/lib/components/fields/AutoArrayField.d.ts +2 -2
- package/lib/components/fields/AutoArrayField.js +26 -12
- package/lib/components/fields/AutosuggestField.d.ts +14 -6
- package/lib/components/fields/AutosuggestField.js +61 -47
- package/lib/components/fields/CombinedValueDisplayField.d.ts +6 -6
- package/lib/components/fields/CombinedValueDisplayField.js +24 -10
- package/lib/components/fields/CondensedObjectField.d.ts +3 -3
- package/lib/components/fields/CondensedObjectField.js +33 -19
- package/lib/components/fields/ConditionalOnChangeField.d.ts +7 -7
- package/lib/components/fields/ConditionalOnChangeField.js +22 -8
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +19 -19
- package/lib/components/fields/ConditionalUiSchemaField.js +28 -14
- package/lib/components/fields/ContextInjectionField.d.ts +7 -7
- package/lib/components/fields/ContextInjectionField.js +26 -13
- package/lib/components/fields/DataLeakerField.d.ts +6 -6
- package/lib/components/fields/DataLeakerField.js +25 -11
- package/lib/components/fields/DefaultValueArrayField.d.ts +6 -6
- package/lib/components/fields/DefaultValueArrayField.js +23 -9
- package/lib/components/fields/DependentBooleanField.d.ts +6 -6
- package/lib/components/fields/DependentBooleanField.js +24 -10
- package/lib/components/fields/DependentDisableField.d.ts +4 -4
- package/lib/components/fields/DependentDisableField.js +24 -10
- package/lib/components/fields/EnumRangeArrayField.d.ts +2 -3
- package/lib/components/fields/EnumRangeArrayField.js +26 -12
- package/lib/components/fields/ExtraLabelRowField.d.ts +9 -8
- package/lib/components/fields/ExtraLabelRowField.js +27 -13
- package/lib/components/fields/FakePropertyField.d.ts +2 -2
- package/lib/components/fields/FakePropertyField.js +26 -12
- package/lib/components/fields/FillDateRangeField.d.ts +28 -0
- package/lib/components/fields/FillDateRangeField.js +91 -0
- package/lib/components/fields/FilterArrayField.d.ts +13 -12
- package/lib/components/fields/FilterArrayField.js +27 -13
- package/lib/components/fields/FlatField.d.ts +4 -4
- package/lib/components/fields/FlatField.js +35 -21
- package/lib/components/fields/GeocoderField.d.ts +12 -4
- package/lib/components/fields/GeocoderField.js +38 -24
- package/lib/components/fields/GridLayoutField.d.ts +7 -7
- package/lib/components/fields/GridLayoutField.js +23 -9
- package/lib/components/fields/HiddenField.d.ts +2 -2
- package/lib/components/fields/HiddenField.js +22 -8
- package/lib/components/fields/HiddenWithTextField.d.ts +6 -7
- package/lib/components/fields/HiddenWithTextField.js +22 -8
- package/lib/components/fields/ImageArrayField.d.ts +17 -17
- package/lib/components/fields/ImageArrayField.js +53 -39
- package/lib/components/fields/ImageDisplayField.d.ts +4 -3
- package/lib/components/fields/ImageDisplayField.js +25 -11
- package/lib/components/fields/InitiallyHiddenField.d.ts +9 -4
- package/lib/components/fields/InitiallyHiddenField.js +23 -9
- package/lib/components/fields/InjectDefaultValueField.d.ts +6 -6
- package/lib/components/fields/InjectDefaultValueField.js +23 -9
- package/lib/components/fields/InjectField.d.ts +8 -8
- package/lib/components/fields/InjectField.js +34 -20
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +8 -8
- package/lib/components/fields/InputWithDefaultValueButtonField.js +29 -15
- package/lib/components/fields/LocalityField.d.ts +4 -2
- package/lib/components/fields/LocalityField.js +28 -14
- package/lib/components/fields/LocationChooserField.d.ts +5 -4
- package/lib/components/fields/LocationChooserField.js +60 -46
- package/lib/components/fields/MapArrayField.d.ts +17 -4
- package/lib/components/fields/MapArrayField.js +137 -132
- package/lib/components/fields/MapField.d.ts +10 -2
- package/lib/components/fields/MapField.js +42 -29
- package/lib/components/fields/MultiActiveArrayField.d.ts +3 -3
- package/lib/components/fields/MultiActiveArrayField.js +29 -15
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +6 -2
- package/lib/components/fields/MultiAnyToBooleanField.js +25 -11
- package/lib/components/fields/MultiArrayField.d.ts +11 -10
- package/lib/components/fields/MultiArrayField.js +45 -31
- package/lib/components/fields/MultiLanguageField.d.ts +3 -2
- package/lib/components/fields/MultiLanguageField.js +23 -9
- package/lib/components/fields/MultiTagArrayField.d.ts +8 -4
- package/lib/components/fields/MultiTagArrayField.js +34 -20
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.d.ts +2 -2
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.js +25 -11
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.d.ts +6 -6
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.js +29 -16
- package/lib/components/fields/NamedPlaceChooserField/Popup.d.ts +1 -1
- package/lib/components/fields/NamedPlaceChooserField/Popup.js +29 -15
- package/lib/components/fields/NamedPlaceSaverField.d.ts +7 -5
- package/lib/components/fields/NamedPlaceSaverField.js +35 -21
- package/lib/components/fields/NestField.d.ts +4 -4
- package/lib/components/fields/NestField.js +36 -23
- package/lib/components/fields/ObjectField.js +36 -22
- package/lib/components/fields/PdfArrayField.js +22 -8
- package/lib/components/fields/PrefillingArrayField.d.ts +2 -2
- package/lib/components/fields/PrefillingArrayField.js +23 -9
- package/lib/components/fields/PrefixArrayField.d.ts +35 -0
- package/lib/components/fields/PrefixArrayField.js +138 -0
- package/lib/components/fields/SchemaField.d.ts +1 -1
- package/lib/components/fields/SchemaField.js +34 -20
- package/lib/components/fields/ScopeField.d.ts +14 -6
- package/lib/components/fields/ScopeField.js +53 -39
- package/lib/components/fields/SectionArrayField.d.ts +2 -2
- package/lib/components/fields/SectionArrayField.js +110 -96
- package/lib/components/fields/SelectTreeField.d.ts +0 -1
- package/lib/components/fields/SelectTreeField.js +30 -16
- package/lib/components/fields/SingleActiveArrayField.d.ts +14 -2
- package/lib/components/fields/SingleActiveArrayField.js +112 -98
- package/lib/components/fields/SingleItemArrayField.d.ts +3 -2
- package/lib/components/fields/SingleItemArrayField.js +28 -14
- package/lib/components/fields/SortArrayField.d.ts +9 -9
- package/lib/components/fields/SortArrayField.js +43 -29
- package/lib/components/fields/SplitField.d.ts +4 -4
- package/lib/components/fields/SplitField.js +26 -12
- package/lib/components/fields/StringToArrayField.d.ts +5 -5
- package/lib/components/fields/StringToArrayField.js +23 -9
- package/lib/components/fields/SumField.d.ts +6 -6
- package/lib/components/fields/SumField.js +22 -8
- package/lib/components/fields/TableField.d.ts +4 -3
- package/lib/components/fields/TableField.js +31 -17
- package/lib/components/fields/TagArrayField.d.ts +8 -2
- package/lib/components/fields/TagArrayField.js +37 -23
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +10 -5
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +30 -16
- package/lib/components/fields/UiFieldApplierField.d.ts +4 -4
- package/lib/components/fields/UiFieldApplierField.js +33 -19
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +7 -6
- package/lib/components/fields/UiFieldMapperArrayField.js +26 -12
- package/lib/components/fields/UnitCountShorthandField.d.ts +6 -6
- package/lib/components/fields/UnitCountShorthandField.js +31 -17
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +6 -5
- package/lib/components/fields/UnitListShorthandArrayField.js +31 -17
- package/lib/components/fields/UnitShorthandField.d.ts +11 -5
- package/lib/components/fields/UnitShorthandField.js +41 -27
- package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
- package/lib/components/templates/ArrayFieldTemplate.js +60 -46
- package/lib/components/templates/BaseInputTemplate.d.ts +3 -0
- package/lib/components/templates/BaseInputTemplate.js +26 -13
- package/lib/components/templates/DescriptionField.js +25 -11
- package/lib/components/templates/ErrorListTemplate.d.ts +5 -0
- package/lib/components/templates/ErrorListTemplate.js +26 -12
- package/lib/components/templates/FieldTemplate.d.ts +8 -0
- package/lib/components/templates/FieldTemplate.js +31 -17
- package/lib/components/templates/ObjectFieldTemplate.js +30 -17
- package/lib/components/templates/TitleField.js +27 -13
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +6 -6
- package/lib/components/widgets/AnyToBooleanWidget.js +24 -10
- package/lib/components/widgets/AutosuggestWidget.d.ts +14 -2
- package/lib/components/widgets/AutosuggestWidget.js +49 -35
- package/lib/components/widgets/CheckboxWidget.d.ts +3 -0
- package/lib/components/widgets/CheckboxWidget.js +32 -18
- package/lib/components/widgets/DateTimeWidget.d.ts +16 -8
- package/lib/components/widgets/DateTimeWidget.js +67 -35
- package/lib/components/widgets/DateWidget.d.ts +11 -11
- package/lib/components/widgets/DateWidget.js +36 -14
- package/lib/components/widgets/HiddenWidget.d.ts +4 -4
- package/lib/components/widgets/HiddenWidget.js +22 -8
- package/lib/components/widgets/ImageSelectWidget.d.ts +1 -0
- package/lib/components/widgets/ImageSelectWidget.js +24 -10
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +12 -0
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +26 -12
- package/lib/components/widgets/InputGroupWidget.d.ts +4 -3
- package/lib/components/widgets/InputGroupWidget.js +25 -11
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +18 -8
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +50 -14
- package/lib/components/widgets/NumberWidget.d.ts +3 -2
- package/lib/components/widgets/NumberWidget.js +23 -9
- package/lib/components/widgets/PlainTextWidget.d.ts +3 -3
- package/lib/components/widgets/PlainTextWidget.js +24 -10
- package/lib/components/widgets/SelectWidget.d.ts +5 -6
- package/lib/components/widgets/SelectWidget.js +92 -72
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +3 -2
- package/lib/components/widgets/SeparatedDateTimeWidget.js +22 -8
- package/lib/components/widgets/TaxonImageWidget.d.ts +3 -2
- package/lib/components/widgets/TaxonImageWidget.js +24 -10
- package/lib/components/widgets/TextSelectWidget.d.ts +10 -2
- package/lib/components/widgets/TextSelectWidget.js +26 -12
- package/lib/components/widgets/TextareaWidget.d.ts +5 -0
- package/lib/components/widgets/TextareaWidget.js +25 -11
- package/lib/components/widgets/TimeWidget.d.ts +2 -2
- package/lib/components/widgets/TimeWidget.js +24 -10
- package/lib/components/widgets/URLWidget.d.ts +2 -2
- package/lib/components/widgets/URLWidget.js +22 -8
- package/lib/components/widgets/UpperCaseWidget.d.ts +3 -2
- package/lib/components/widgets/UpperCaseWidget.js +23 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +25 -11
- package/lib/services/custom-event-service.d.ts +1 -1
- package/lib/services/focus-service.d.ts +1 -1
- package/lib/services/focus-service.js +3 -3
- package/lib/services/id-service.d.ts +1 -1
- package/lib/services/id-service.js +5 -6
- package/lib/services/key-handler-service.d.ts +3 -4
- package/lib/services/key-handler-service.js +4 -4
- package/lib/services/multi-active-array-service.d.ts +1 -1
- package/lib/services/settings-service.d.ts +2 -3
- package/lib/services/settings-service.js +3 -3
- package/lib/services/submit-hook-service.js +1 -1
- package/lib/themes/bs3.js +22 -8
- package/lib/themes/bs5.js +23 -9
- package/lib/themes/stub.js +22 -8
- package/lib/themes/theme.d.ts +15 -15
- package/lib/translations.json +5 -0
- package/lib/types.d.ts +18 -19
- package/lib/types.js +3 -4
- package/lib/utils.d.ts +9 -9
- package/lib/utils.js +138 -134
- package/lib/validation.js +28 -12
- package/package.json +12 -11
- package/test-export/test-utils.d.ts +7 -7
- package/test-export/test-utils.js +36 -22
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,13 +21,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
23
|
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
27
41
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
28
42
|
var t = {};
|
|
29
43
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -39,7 +53,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
54
|
};
|
|
41
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.getFeatureStyleWithHighlight = exports.getFeatureStyleWithLowerOpacity = exports.Map = exports.MapComponent =
|
|
56
|
+
exports.getFeatureStyleWithHighlight = exports.getFeatureStyleWithLowerOpacity = exports.Map = exports.MapComponent = void 0;
|
|
57
|
+
exports.parseGeometries = parseGeometries;
|
|
43
58
|
const React = __importStar(require("react"));
|
|
44
59
|
const PropTypes = __importStar(require("prop-types"));
|
|
45
60
|
const react_dom_1 = require("react-dom");
|
|
@@ -71,10 +86,9 @@ function parseGeometries(geometry) {
|
|
|
71
86
|
return geometries;
|
|
72
87
|
}, []);
|
|
73
88
|
}
|
|
74
|
-
exports.parseGeometries = parseGeometries;
|
|
75
89
|
class MapArrayField extends React.Component {
|
|
76
90
|
render() {
|
|
77
|
-
const { geometryMapper = "default" } = utils_2.getUiOptions(this.props.uiSchema);
|
|
91
|
+
const { geometryMapper = "default" } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
78
92
|
switch (geometryMapper) {
|
|
79
93
|
case "default":
|
|
80
94
|
return React.createElement(DefaultMapArrayField, Object.assign({}, this.props));
|
|
@@ -87,7 +101,6 @@ class MapArrayField extends React.Component {
|
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
|
-
exports.default = MapArrayField;
|
|
91
104
|
MapArrayField.propTypes = {
|
|
92
105
|
uiSchema: PropTypes.shape({
|
|
93
106
|
"ui:options": PropTypes.shape({
|
|
@@ -116,6 +129,7 @@ MapArrayField.propTypes = {
|
|
|
116
129
|
}).isRequired,
|
|
117
130
|
formData: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
|
|
118
131
|
};
|
|
132
|
+
exports.default = MapArrayField;
|
|
119
133
|
let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
120
134
|
constructor(props) {
|
|
121
135
|
super(props);
|
|
@@ -127,7 +141,7 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
127
141
|
const { formData } = this.props;
|
|
128
142
|
const geometries = this.getData();
|
|
129
143
|
const emptyMode = !formData || !formData.length;
|
|
130
|
-
const draw = (options.draw === false || (utils_2.isNullOrUndefined(this.state.activeIdx) && !emptyMode)) ? false : Object.assign({ featureCollection: {
|
|
144
|
+
const draw = (options.draw === false || ((0, utils_2.isNullOrUndefined)(this.state.activeIdx) && !emptyMode)) ? false : Object.assign({ featureCollection: {
|
|
131
145
|
type: "FeatureCollection",
|
|
132
146
|
features: (geometries || []).map(geometry => {
|
|
133
147
|
return { type: "Feature", properties: {}, geometry };
|
|
@@ -146,13 +160,13 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
146
160
|
return { draw, controls, emptyMode, data: [...data, ...extraData] };
|
|
147
161
|
}
|
|
148
162
|
onMapChangeCreateGathering(events) {
|
|
149
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
163
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
150
164
|
if (!geometryField) {
|
|
151
165
|
return;
|
|
152
166
|
}
|
|
153
|
-
let formData = utils_2.getDefaultFormState(this.props.schema.items);
|
|
167
|
+
let formData = (0, utils_2.getDefaultFormState)(this.props.schema.items);
|
|
154
168
|
const geometries = events.filter(e => e.type === "create").map(e => e.feature.geometry);
|
|
155
|
-
let splittedPath = geometryField.split("/").filter(s => !utils_2.isEmptyString(s));
|
|
169
|
+
let splittedPath = geometryField.split("/").filter(s => !(0, utils_2.isEmptyString)(s));
|
|
156
170
|
let _cumulatedPointer = "";
|
|
157
171
|
let _schema = this.props.schema.items;
|
|
158
172
|
formData = splittedPath.reduce((_formData, split, i) => {
|
|
@@ -160,20 +174,20 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
160
174
|
_schema = _schema.properties
|
|
161
175
|
? _schema.properties[split]
|
|
162
176
|
: _schema.items;
|
|
163
|
-
return immutability_helper_1.default(_formData, utils_2.getUpdateObjectFromJSONPointer(_cumulatedPointer, { $set: i === splittedPath.length - 1
|
|
177
|
+
return (0, immutability_helper_1.default)(_formData, (0, utils_2.getUpdateObjectFromJSONPointer)(_cumulatedPointer, { $set: i === splittedPath.length - 1
|
|
164
178
|
? {
|
|
165
179
|
type: "GeometryCollection",
|
|
166
180
|
geometries
|
|
167
181
|
}
|
|
168
|
-
: utils_2.getDefaultFormState(_schema)
|
|
182
|
+
: (0, utils_2.getDefaultFormState)(_schema)
|
|
169
183
|
}));
|
|
170
184
|
}, formData);
|
|
171
|
-
this.props.onChange(ArrayField_1.onArrayFieldChange([formData], this.props));
|
|
185
|
+
this.props.onChange((0, ArrayField_1.onArrayFieldChange)([formData], this.props));
|
|
172
186
|
this.setState({ activeIdx: 0 });
|
|
173
187
|
}
|
|
174
188
|
getGeometry(formData, _geometryField) {
|
|
175
189
|
const { uiSchema } = this.props;
|
|
176
|
-
const { geometryField } = utils_2.getUiOptions(uiSchema);
|
|
190
|
+
const { geometryField } = (0, utils_2.getUiOptions)(uiSchema);
|
|
177
191
|
const { activeIdx } = this.state;
|
|
178
192
|
if (!formData) {
|
|
179
193
|
return;
|
|
@@ -182,7 +196,7 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
182
196
|
if (activeIdx === undefined || !item) {
|
|
183
197
|
return;
|
|
184
198
|
}
|
|
185
|
-
const geometryItem = utils_2.parseJSONPointer(formData[activeIdx], _geometryField || geometryField);
|
|
199
|
+
const geometryItem = (0, utils_2.parseJSONPointer)(formData[activeIdx], _geometryField || geometryField);
|
|
186
200
|
return geometryItem;
|
|
187
201
|
}
|
|
188
202
|
getGeometries() {
|
|
@@ -197,7 +211,7 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
197
211
|
}
|
|
198
212
|
onChange(events) {
|
|
199
213
|
let formData = this.props.formData ||
|
|
200
|
-
[utils_2.getDefaultFormState(this.props.schema.items)];
|
|
214
|
+
[(0, utils_2.getDefaultFormState)(this.props.schema.items)];
|
|
201
215
|
let addOrDelete = false;
|
|
202
216
|
events.forEach(e => {
|
|
203
217
|
switch (e.type) {
|
|
@@ -218,26 +232,26 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
218
232
|
break;
|
|
219
233
|
}
|
|
220
234
|
});
|
|
221
|
-
this.props.onChange(addOrDelete ? ArrayField_1.onArrayFieldChange(formData, this.props) : formData);
|
|
235
|
+
this.props.onChange(addOrDelete ? (0, ArrayField_1.onArrayFieldChange)(formData, this.props) : formData);
|
|
222
236
|
}
|
|
223
237
|
onAdd({ feature: { geometry } }, formData) {
|
|
224
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
225
|
-
return utils_2.updateSafelyWithJSONPointer(formData, { type: "GeometryCollection", geometries: [...parseGeometries(this.getGeometry(formData)), geometry] }, `/${this.state.activeIdx}/${geometryField}`);
|
|
238
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
239
|
+
return (0, utils_2.updateSafelyWithJSONPointer)(formData, { type: "GeometryCollection", geometries: [...parseGeometries(this.getGeometry(formData)), geometry] }, `/${this.state.activeIdx}/${geometryField}`);
|
|
226
240
|
}
|
|
227
241
|
onRemove({ idxs }, formData) {
|
|
228
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
242
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
229
243
|
let splices = [];
|
|
230
244
|
idxs.sort().reverse().forEach((idx) => {
|
|
231
245
|
splices.push([idx, 1]);
|
|
232
246
|
});
|
|
233
247
|
const geometry = this.getGeometry(formData);
|
|
234
|
-
return immutability_helper_1.default(formData, { [this.state.activeIdx]: utils_2.getUpdateObjectFromJSONPointer(geometryField, geometry && geometry.type === "GeometryCollection" ?
|
|
248
|
+
return (0, immutability_helper_1.default)(formData, { [this.state.activeIdx]: (0, utils_2.getUpdateObjectFromJSONPointer)(geometryField, geometry && geometry.type === "GeometryCollection" ?
|
|
235
249
|
{ geometries: { $splice: splices } } : { $set: undefined }) });
|
|
236
250
|
}
|
|
237
251
|
onEdited({ features }, formData) {
|
|
238
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
252
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
239
253
|
const geometry = this.getGeometry(formData);
|
|
240
|
-
return immutability_helper_1.default(formData, { [this.state.activeIdx]: utils_2.getUpdateObjectFromJSONPointer(geometryField, geometry.type === "GeometryCollection" ? {
|
|
254
|
+
return (0, immutability_helper_1.default)(formData, { [this.state.activeIdx]: (0, utils_2.getUpdateObjectFromJSONPointer)(geometryField, geometry.type === "GeometryCollection" ? {
|
|
241
255
|
geometries: Object.keys(features).reduce((obj, idx) => {
|
|
242
256
|
obj[idx] = { $set: features[idx].geometry };
|
|
243
257
|
return obj;
|
|
@@ -245,8 +259,8 @@ let DefaultMapArrayField = class DefaultMapArrayField extends React.Component {
|
|
|
245
259
|
} : { $set: features[0].geometry }) });
|
|
246
260
|
}
|
|
247
261
|
onInsert({ idx, feature }, formData) {
|
|
248
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
249
|
-
return immutability_helper_1.default(formData, { [this.state.activeIdx]: utils_2.getUpdateObjectFromJSONPointer(geometryField, {
|
|
262
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
263
|
+
return (0, immutability_helper_1.default)(formData, { [this.state.activeIdx]: (0, utils_2.getUpdateObjectFromJSONPointer)(geometryField, {
|
|
250
264
|
geometries: { $splice: [[idx, 0, feature.geometry]] }
|
|
251
265
|
}) });
|
|
252
266
|
}
|
|
@@ -270,7 +284,7 @@ let UnitsMapArrayField = class UnitsMapArrayField extends React.Component {
|
|
|
270
284
|
const { formData } = this.props;
|
|
271
285
|
const { gatherings = [], units = [] } = this.getData();
|
|
272
286
|
const emptyMode = !formData || !formData.length;
|
|
273
|
-
const draw = (options.draw === false || (utils_2.isNullOrUndefined(this.state.activeIdx) && !emptyMode)) ? false : Object.assign({ featureCollection: {
|
|
287
|
+
const draw = (options.draw === false || ((0, utils_2.isNullOrUndefined)(this.state.activeIdx) && !emptyMode)) ? false : Object.assign({ featureCollection: {
|
|
274
288
|
type: "FeatureCollection",
|
|
275
289
|
features: gatherings.map(geometry => {
|
|
276
290
|
return { type: "Feature", properties: {}, geometry };
|
|
@@ -344,19 +358,19 @@ let UnitsMapArrayField = class UnitsMapArrayField extends React.Component {
|
|
|
344
358
|
})
|
|
345
359
|
];
|
|
346
360
|
this.unitFeatures = data[0].featureCollection.features;
|
|
347
|
-
const controls = (emptyMode || !utils_2.isNullOrUndefined(this.state.activeIdx)) ?
|
|
361
|
+
const controls = (emptyMode || !(0, utils_2.isNullOrUndefined)(this.state.activeIdx)) ?
|
|
348
362
|
{} : { draw: false };
|
|
349
363
|
return { draw, data, controls, emptyMode };
|
|
350
364
|
};
|
|
351
365
|
this.getUnitFeatureStyle = () => {
|
|
352
366
|
let color = "#55AEFA";
|
|
353
367
|
if (this._highlightedUnit !== undefined) {
|
|
354
|
-
color = utils_1.combineColors(color, "#ffffff", 30);
|
|
368
|
+
color = (0, utils_1.combineColors)(color, "#ffffff", 30);
|
|
355
369
|
}
|
|
356
370
|
return { color: color, fillColor: color, weight: 4 };
|
|
357
371
|
};
|
|
358
372
|
this.startHighlight = ({ idx }) => {
|
|
359
|
-
const color = utils_1.combineColors(this.getUnitFeatureStyle().color, "#ffffff", 30);
|
|
373
|
+
const color = (0, utils_1.combineColors)(this.getUnitFeatureStyle().color, "#ffffff", 30);
|
|
360
374
|
if (idx in this.unitIdxToGeometryCollectionIdx) {
|
|
361
375
|
const _idx = this.unitIdxToGeometryCollectionIdx[idx];
|
|
362
376
|
this.map.data[_idx + 1].group.getLayers().forEach(layer => {
|
|
@@ -429,18 +443,18 @@ let UnitsMapArrayField = class UnitsMapArrayField extends React.Component {
|
|
|
429
443
|
obj[idx] = {
|
|
430
444
|
unitGathering: {
|
|
431
445
|
geometry: {
|
|
432
|
-
$set: utils_2.getDefaultFormState(this.props.schema.items.properties.units.items.properties.unitGathering.properties.geometry)
|
|
446
|
+
$set: (0, utils_2.getDefaultFormState)(this.props.schema.items.properties.units.items.properties.unitGathering.properties.geometry)
|
|
433
447
|
}
|
|
434
448
|
}
|
|
435
449
|
};
|
|
436
450
|
return obj;
|
|
437
451
|
}, {})
|
|
438
452
|
} };
|
|
439
|
-
this.props.onChange(immutability_helper_1.default(formData, updateObject));
|
|
453
|
+
this.props.onChange((0, immutability_helper_1.default)(formData, updateObject));
|
|
440
454
|
}
|
|
441
455
|
else { // Is a geometry collection.
|
|
442
456
|
const { idxs } = e;
|
|
443
|
-
this.props.onChange(immutability_helper_1.default(this.props.formData, {
|
|
457
|
+
this.props.onChange((0, immutability_helper_1.default)(this.props.formData, {
|
|
444
458
|
[this.state.activeIdx]: {
|
|
445
459
|
units: {
|
|
446
460
|
[unitIdx]: {
|
|
@@ -471,10 +485,10 @@ let UnitsMapArrayField = class UnitsMapArrayField extends React.Component {
|
|
|
471
485
|
}, {})
|
|
472
486
|
}
|
|
473
487
|
};
|
|
474
|
-
this.props.onChange(immutability_helper_1.default(this.props.formData, updateObject));
|
|
488
|
+
this.props.onChange((0, immutability_helper_1.default)(this.props.formData, updateObject));
|
|
475
489
|
}
|
|
476
490
|
else { // Is a geometry collection.
|
|
477
|
-
this.props.onChange(immutability_helper_1.default(this.props.formData, {
|
|
491
|
+
this.props.onChange((0, immutability_helper_1.default)(this.props.formData, {
|
|
478
492
|
[this.state.activeIdx]: {
|
|
479
493
|
units: {
|
|
480
494
|
[unitIdx]: {
|
|
@@ -519,7 +533,7 @@ let UnitsMapArrayField = class UnitsMapArrayField extends React.Component {
|
|
|
519
533
|
const units = ((item && item.units) ? item.units : []).reduce((units, unit, idx) => {
|
|
520
534
|
if (unit.unitGathering) {
|
|
521
535
|
const { unitGathering: { geometry } } = unit;
|
|
522
|
-
if (geometry && utils_2.hasData(geometry)) {
|
|
536
|
+
if (geometry && (0, utils_2.hasData)(geometry)) {
|
|
523
537
|
units[idx] = geometry;
|
|
524
538
|
}
|
|
525
539
|
}
|
|
@@ -545,11 +559,11 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
545
559
|
constructor(props) {
|
|
546
560
|
super(props);
|
|
547
561
|
this.onLineCreate = ([event]) => {
|
|
548
|
-
this.props.onChange(ArrayField_1.onArrayFieldChange(immutability_helper_1.default(this.props.formData, { 0: { geometry: { $set: event.feature.geometry
|
|
562
|
+
this.props.onChange((0, ArrayField_1.onArrayFieldChange)((0, immutability_helper_1.default)(this.props.formData, { 0: { geometry: { $set: event.feature.geometry
|
|
549
563
|
} } }), this.props));
|
|
550
564
|
};
|
|
551
565
|
this.onChange = (events) => {
|
|
552
|
-
const { geometryField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
566
|
+
const { geometryField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
553
567
|
let state = {};
|
|
554
568
|
let { formData } = this.props;
|
|
555
569
|
let formDataChanged = false;
|
|
@@ -559,16 +573,16 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
559
573
|
case "insert": {
|
|
560
574
|
formDataChanged = true;
|
|
561
575
|
addOrDelete = true;
|
|
562
|
-
const newItem = utils_2.getDefaultFormState(this.props.schema.items);
|
|
576
|
+
const newItem = (0, utils_2.getDefaultFormState)(this.props.schema.items);
|
|
563
577
|
newItem[geometryField] = e.geometry;
|
|
564
|
-
formData = immutability_helper_1.default(formData, {
|
|
578
|
+
formData = (0, immutability_helper_1.default)(formData, {
|
|
565
579
|
$splice: [[e.idx, 0, newItem]]
|
|
566
580
|
});
|
|
567
581
|
break;
|
|
568
582
|
}
|
|
569
583
|
case "edit": {
|
|
570
584
|
formDataChanged = true;
|
|
571
|
-
formData = immutability_helper_1.default(formData, {
|
|
585
|
+
formData = (0, immutability_helper_1.default)(formData, {
|
|
572
586
|
[e.idx]: {
|
|
573
587
|
[geometryField]: { $set: e.geometry }
|
|
574
588
|
}
|
|
@@ -578,23 +592,23 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
578
592
|
case "delete": {
|
|
579
593
|
formDataChanged = true;
|
|
580
594
|
addOrDelete = true;
|
|
581
|
-
formData = immutability_helper_1.default(formData, { $splice: [[e.idx, 1]] });
|
|
595
|
+
formData = (0, immutability_helper_1.default)(formData, { $splice: [[e.idx, 1]] });
|
|
582
596
|
break;
|
|
583
597
|
}
|
|
584
598
|
case "merge": {
|
|
585
599
|
formDataChanged = true;
|
|
586
600
|
addOrDelete = true;
|
|
587
601
|
const [first, second] = e.idxs;
|
|
588
|
-
formData = immutability_helper_1.default(formData, { [first]: { units: { $set: [
|
|
602
|
+
formData = (0, immutability_helper_1.default)(formData, { [first]: { units: { $set: [
|
|
589
603
|
...(formData[first].units || []),
|
|
590
604
|
...(formData[second].units || [])
|
|
591
605
|
] } } });
|
|
592
|
-
formData = immutability_helper_1.default(formData, {
|
|
606
|
+
formData = (0, immutability_helper_1.default)(formData, {
|
|
593
607
|
[first]: {
|
|
594
608
|
[geometryField]: { $set: e.geometry }
|
|
595
609
|
}
|
|
596
610
|
});
|
|
597
|
-
formData = immutability_helper_1.default(formData, { $splice: [[second, 1]] });
|
|
611
|
+
formData = (0, immutability_helper_1.default)(formData, { $splice: [[second, 1]] });
|
|
598
612
|
break;
|
|
599
613
|
}
|
|
600
614
|
case "move": {
|
|
@@ -607,7 +621,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
607
621
|
// Splices must be executed in reverse order to keep idxs correct.
|
|
608
622
|
if (target > idx)
|
|
609
623
|
splices = splices.reverse();
|
|
610
|
-
formData = immutability_helper_1.default(formData, { $splice: splices });
|
|
624
|
+
formData = (0, immutability_helper_1.default)(formData, { $splice: splices });
|
|
611
625
|
break;
|
|
612
626
|
}
|
|
613
627
|
case "active": {
|
|
@@ -618,7 +632,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
618
632
|
const afterState = () => {
|
|
619
633
|
if (formDataChanged) {
|
|
620
634
|
formData = syncLineTransectStartEnd(formData);
|
|
621
|
-
this.props.onChange(addOrDelete ? ArrayField_1.onArrayFieldChange(formData, this.props) : formData);
|
|
635
|
+
this.props.onChange(addOrDelete ? (0, ArrayField_1.onArrayFieldChange)(formData, this.props) : formData);
|
|
622
636
|
}
|
|
623
637
|
if ("activeIdx" in state) {
|
|
624
638
|
this.afterActiveChange(state.activeIdx);
|
|
@@ -628,7 +642,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
628
642
|
};
|
|
629
643
|
this.getFeatureStyle = ({ lineIdx, style, type }) => {
|
|
630
644
|
if (this.props.errorSchema[lineIdx]) {
|
|
631
|
-
return (type === L.CircleMarker)
|
|
645
|
+
return (type === L.CircleMarker)
|
|
632
646
|
? style
|
|
633
647
|
: Object.assign(Object.assign({}, style), { fillColor: "#f33" });
|
|
634
648
|
}
|
|
@@ -655,7 +669,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
655
669
|
return;
|
|
656
670
|
}
|
|
657
671
|
this.props.formContext.setTimeout(() => {
|
|
658
|
-
this.map && this.map.fitBounds(L.featureGroup(this.map._corridorLayers[idx]).getBounds(), { paddingInMeters: 100 });
|
|
672
|
+
this.map && this.map.fitBounds(L.featureGroup(this.map._corridorLayers[idx]).getBounds(), { paddingInMeters: 100 });
|
|
659
673
|
});
|
|
660
674
|
};
|
|
661
675
|
this.state = { showLTTools: false };
|
|
@@ -663,7 +677,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
663
677
|
}
|
|
664
678
|
getOptions() {
|
|
665
679
|
const { formData, disabled, readonly } = this.props;
|
|
666
|
-
const { geometryField, placeholderGeometry } = utils_2.getUiOptions(this.props.uiSchema);
|
|
680
|
+
const { geometryField, placeholderGeometry } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
667
681
|
const lineTransect = this.hasLineTransectFeature(this.props)
|
|
668
682
|
? { type: "MultiLineString", coordinates: formData.map(item => item[geometryField].coordinates) }
|
|
669
683
|
: undefined;
|
|
@@ -717,7 +731,7 @@ let LineTransectMapArrayField = class LineTransectMapArrayField extends React.Co
|
|
|
717
731
|
this.focusOnMap(idx);
|
|
718
732
|
}
|
|
719
733
|
hasLineTransectFeature(props) {
|
|
720
|
-
const { geometryField } = utils_2.getUiOptions(props.uiSchema);
|
|
734
|
+
const { geometryField } = (0, utils_2.getUiOptions)(props.uiSchema);
|
|
721
735
|
return props.formData && props.formData[0] && Object.keys(props.formData[0][geometryField] || {}).length;
|
|
722
736
|
}
|
|
723
737
|
componentDidUpdate(prevProps) {
|
|
@@ -740,12 +754,12 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
740
754
|
events.forEach(e => {
|
|
741
755
|
switch (e.type) {
|
|
742
756
|
case "edit":
|
|
743
|
-
formData = immutability_helper_1.default(formData, formData[idx].geometry.type === "GeometryCollection"
|
|
757
|
+
formData = (0, immutability_helper_1.default)(formData, formData[idx].geometry.type === "GeometryCollection"
|
|
744
758
|
? Object.keys(e.features).reduce((updates, _idx) => (Object.assign(Object.assign({}, updates), { [idx]: { geometry: { geometries: { [_idx]: { $set: e.features[_idx].geometry } } } } })), {})
|
|
745
759
|
: { [idx]: { geometry: { $set: e.features[0].geometry } } });
|
|
746
760
|
break;
|
|
747
761
|
case "create":
|
|
748
|
-
formData = immutability_helper_1.default(formData, { [idx]: { geometry: { $set: e.feature.geometry } } });
|
|
762
|
+
formData = (0, immutability_helper_1.default)(formData, { [idx]: { geometry: { $set: e.feature.geometry } } });
|
|
749
763
|
break;
|
|
750
764
|
case "delete":
|
|
751
765
|
if (formData[idx].geometry.type === "GeometryCollection") {
|
|
@@ -753,10 +767,10 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
753
767
|
e.idxs.sort().reverse().forEach((idx) => {
|
|
754
768
|
splices.push([idx, 1]);
|
|
755
769
|
});
|
|
756
|
-
formData = immutability_helper_1.default(formData, { [idx]: { geometry: { geometries: { $splice: splices } } } });
|
|
770
|
+
formData = (0, immutability_helper_1.default)(formData, { [idx]: { geometry: { geometries: { $splice: splices } } } });
|
|
757
771
|
}
|
|
758
772
|
else {
|
|
759
|
-
formData = immutability_helper_1.default(formData, { [idx]: { geometry: { $set: undefined } } });
|
|
773
|
+
formData = (0, immutability_helper_1.default)(formData, { [idx]: { geometry: { $set: undefined } } });
|
|
760
774
|
}
|
|
761
775
|
break;
|
|
762
776
|
}
|
|
@@ -768,16 +782,16 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
768
782
|
events.forEach(e => {
|
|
769
783
|
switch (e.type) {
|
|
770
784
|
case "edit":
|
|
771
|
-
formData = utils_2.updateSafelyWithJSONPointer(formData, e.features[0].geometry, `/${e.features[0].properties.idx}/unitGathering/geometry`);
|
|
785
|
+
formData = (0, utils_2.updateSafelyWithJSONPointer)(formData, e.features[0].geometry, `/${e.features[0].properties.idx}/unitGathering/geometry`);
|
|
772
786
|
break;
|
|
773
787
|
case "create":
|
|
774
788
|
throw new Error("Lolife map shouldn't me able to send create for unit");
|
|
775
789
|
case "delete":
|
|
776
|
-
formData = utils_2.updateSafelyWithJSONPointer(formData, undefined, `/${e.features[0].properties.idx}/unitGathering/geometry`);
|
|
790
|
+
formData = (0, utils_2.updateSafelyWithJSONPointer)(formData, undefined, `/${e.features[0].properties.idx}/unitGathering/geometry`);
|
|
777
791
|
break;
|
|
778
792
|
}
|
|
779
793
|
});
|
|
780
|
-
this.props.onChange(utils_2.updateSafelyWithJSONPointer(this.props.formData, formData, "/0/units"));
|
|
794
|
+
this.props.onChange((0, utils_2.updateSafelyWithJSONPointer)(this.props.formData, formData, "/0/units"));
|
|
781
795
|
};
|
|
782
796
|
this.getFeatureStyle = ({ feature }, highlight) => {
|
|
783
797
|
if (!feature) {
|
|
@@ -793,7 +807,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
793
807
|
let idx = undefined;
|
|
794
808
|
const gathering = this.props.formData.find((item, _idx) => {
|
|
795
809
|
idx = _idx;
|
|
796
|
-
return utils_2.getUUID(item) === feature.properties.id;
|
|
810
|
+
return (0, utils_2.getUUID)(item) === feature.properties.id;
|
|
797
811
|
});
|
|
798
812
|
if (!gathering) {
|
|
799
813
|
return {};
|
|
@@ -825,9 +839,9 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
825
839
|
const { activeIdx } = this.state;
|
|
826
840
|
if (highlight || activeIdx !== undefined) {
|
|
827
841
|
if (idx !== activeIdx) {
|
|
828
|
-
return exports.getFeatureStyleWithLowerOpacity(style);
|
|
842
|
+
return (0, exports.getFeatureStyleWithLowerOpacity)(style);
|
|
829
843
|
}
|
|
830
|
-
return exports.getFeatureStyleWithHighlight(style);
|
|
844
|
+
return (0, exports.getFeatureStyleWithHighlight)(style);
|
|
831
845
|
}
|
|
832
846
|
return style;
|
|
833
847
|
};
|
|
@@ -835,7 +849,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
835
849
|
const droppingsTreeStyle = { color: "#b89220" };
|
|
836
850
|
const nestTreeStyle = { color: "#9e713b" };
|
|
837
851
|
const observationStyle = { color: globals_1.NORMAL_COLOR };
|
|
838
|
-
const unit = this.props.formData[0].units.find((item) => utils_2.getUUID(item) === feature.properties.id);
|
|
852
|
+
const unit = this.props.formData[0].units.find((item) => (0, utils_2.getUUID)(item) === feature.properties.id);
|
|
839
853
|
if (!unit) {
|
|
840
854
|
return {};
|
|
841
855
|
}
|
|
@@ -849,7 +863,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
849
863
|
}
|
|
850
864
|
const { activeIdx } = this.state;
|
|
851
865
|
if (activeIdx !== undefined) {
|
|
852
|
-
return exports.getFeatureStyleWithLowerOpacity(style);
|
|
866
|
+
return (0, exports.getFeatureStyleWithLowerOpacity)(style);
|
|
853
867
|
}
|
|
854
868
|
return style;
|
|
855
869
|
};
|
|
@@ -859,7 +873,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
859
873
|
if (!style.color) {
|
|
860
874
|
return;
|
|
861
875
|
}
|
|
862
|
-
const color = utils_1.combineColors(style.color, "#ffffff", 150);
|
|
876
|
+
const color = (0, utils_1.combineColors)(style.color, "#ffffff", 150);
|
|
863
877
|
const layer = this.map.getLayerByIdxTuple([mapIdx, 0]);
|
|
864
878
|
layer && this.map.setLayerStyle(layer, Object.assign(Object.assign({}, style), { color, fillColor: color }));
|
|
865
879
|
};
|
|
@@ -885,8 +899,8 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
885
899
|
this.setState({ activeIdx: idx });
|
|
886
900
|
}
|
|
887
901
|
const elem = this.getHighlightElem(idx, unit);
|
|
888
|
-
utils_2.scrollIntoViewIfNeeded(elem, topOffset, bottomOffset);
|
|
889
|
-
utils_2.highlightElem(elem);
|
|
902
|
+
(0, utils_2.scrollIntoViewIfNeeded)(elem, topOffset, bottomOffset);
|
|
903
|
+
(0, utils_2.highlightElem)(elem);
|
|
890
904
|
};
|
|
891
905
|
this.onMouseOver = this.onMouseOver.bind(this);
|
|
892
906
|
this.onMouseOut = this.onMouseOut.bind(this);
|
|
@@ -921,7 +935,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
921
935
|
};
|
|
922
936
|
}
|
|
923
937
|
getDraftStyle() {
|
|
924
|
-
return this.getFeatureStyle({ feature: { properties: { id: utils_2.getUUID(this.props.formData[this.state.activeIdx]) } } }, !!"higlight");
|
|
938
|
+
return this.getFeatureStyle({ feature: { properties: { id: (0, utils_2.getUUID)(this.props.formData[this.state.activeIdx]) } } }, !!"higlight");
|
|
925
939
|
}
|
|
926
940
|
getDraw() {
|
|
927
941
|
const active = this.props.formData[this.state.activeIdx];
|
|
@@ -947,7 +961,7 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
947
961
|
return onChangeForIdx;
|
|
948
962
|
}
|
|
949
963
|
getFeatureCollection(geometryContainer, properties = {}, geometryField = "/geometry") {
|
|
950
|
-
return { type: "FeatureCollection", features: parseGeometries(utils_2.parseJSONPointer(geometryContainer, geometryField)).map(g => ({ type: "Feature", properties: Object.assign({ id: utils_2.getUUID(geometryContainer) }, properties), geometry: g })) };
|
|
964
|
+
return { type: "FeatureCollection", features: parseGeometries((0, utils_2.parseJSONPointer)(geometryContainer, geometryField)).map(g => ({ type: "Feature", properties: Object.assign({ id: (0, utils_2.getUUID)(geometryContainer) }, properties), geometry: g })) };
|
|
951
965
|
}
|
|
952
966
|
getData() {
|
|
953
967
|
return this._getData(this.props.formData);
|
|
@@ -1026,9 +1040,9 @@ let LolifeMapArrayField = class LolifeMapArrayField extends React.Component {
|
|
|
1026
1040
|
}
|
|
1027
1041
|
getFormDataForPopup({ feature }) {
|
|
1028
1042
|
if (feature.properties.unit) {
|
|
1029
|
-
return this.props.formData[0].units.find(item => utils_2.getUUID(item) === feature.properties.id);
|
|
1043
|
+
return this.props.formData[0].units.find(item => (0, utils_2.getUUID)(item) === feature.properties.id);
|
|
1030
1044
|
}
|
|
1031
|
-
return this.props.formData.find(item => utils_2.getUUID(item) === feature.properties.id);
|
|
1045
|
+
return this.props.formData.find(item => (0, utils_2.getUUID)(item) === feature.properties.id);
|
|
1032
1046
|
}
|
|
1033
1047
|
};
|
|
1034
1048
|
LolifeMapArrayField = __decorate([
|
|
@@ -1042,7 +1056,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1042
1056
|
this.geocode = () => {
|
|
1043
1057
|
// Zoom map to area. Area ID is accessed from schema field defined in options.areaField
|
|
1044
1058
|
const item = (this.props.formData || [])[this.state.activeIdx];
|
|
1045
|
-
const { areaField } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1059
|
+
const { areaField } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1046
1060
|
if (!item || !areaField) {
|
|
1047
1061
|
return;
|
|
1048
1062
|
}
|
|
@@ -1061,7 +1075,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1061
1075
|
const { activeIdx } = this.state;
|
|
1062
1076
|
if (activeIdx === undefined)
|
|
1063
1077
|
return;
|
|
1064
|
-
let { computeAreaField, areaInHectares } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1078
|
+
let { computeAreaField, areaInHectares } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1065
1079
|
const { formData } = this.props;
|
|
1066
1080
|
if (!computeAreaField)
|
|
1067
1081
|
return;
|
|
@@ -1077,14 +1091,14 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1077
1091
|
const area = sumArea === 0
|
|
1078
1092
|
? undefined
|
|
1079
1093
|
: Math.round(areaInHectares ? sumArea / 10000 : sumArea);
|
|
1080
|
-
const currentArea = utils_2.parseJSONPointer(formData[activeIdx], computeAreaField, true);
|
|
1081
|
-
currentArea !== area && this.props.onChange(utils_2.updateSafelyWithJSONPointer(formData, area, `/${activeIdx}/${computeAreaField}`));
|
|
1094
|
+
const currentArea = (0, utils_2.parseJSONPointer)(formData[activeIdx], computeAreaField, true);
|
|
1095
|
+
currentArea !== area && this.props.onChange((0, utils_2.updateSafelyWithJSONPointer)(formData, area, `/${activeIdx}/${computeAreaField}`));
|
|
1082
1096
|
};
|
|
1083
1097
|
this.onResize = () => this.refs.map.map.map.invalidateSize({ debounceMoveend: true });
|
|
1084
1098
|
this.onPopupClose = () => {
|
|
1085
1099
|
// Move popup content back to the React container so React won't crash.
|
|
1086
1100
|
if (this.refs.popupContainer && this.refs.popup.refs.popup) {
|
|
1087
|
-
react_dom_1.findDOMNode(this.refs.popupContainer).appendChild(this.refs.popup.refs.popup);
|
|
1101
|
+
(0, react_dom_1.findDOMNode)(this.refs.popupContainer).appendChild(this.refs.popup.refs.popup);
|
|
1088
1102
|
}
|
|
1089
1103
|
this.setState({ popupIdx: undefined });
|
|
1090
1104
|
};
|
|
@@ -1100,7 +1114,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1100
1114
|
this.afterActiveChange(this.state.activeIdx, !!"initial call");
|
|
1101
1115
|
};
|
|
1102
1116
|
this.getMapOptions = () => {
|
|
1103
|
-
const options = utils_2.getUiOptions(this.props.uiSchema);
|
|
1117
|
+
const options = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1104
1118
|
let _options = deepmerge_1.default.all([
|
|
1105
1119
|
{ clickBeforeZoomAndPan: true },
|
|
1106
1120
|
(options.mapOptions || {}),
|
|
@@ -1113,14 +1127,14 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1113
1127
|
}
|
|
1114
1128
|
const { readonly, disabled } = this.props;
|
|
1115
1129
|
if (readonly || disabled) {
|
|
1116
|
-
if (utils_2.isObject(_options.draw)) {
|
|
1130
|
+
if ((0, utils_2.isObject)(_options.draw)) {
|
|
1117
1131
|
changes.draw = Object.assign(Object.assign({}, _options.draw), { editable: false });
|
|
1118
1132
|
}
|
|
1119
1133
|
if (_options.data) {
|
|
1120
1134
|
if (_options.data instanceof Array) {
|
|
1121
1135
|
changes.data = _options.data.map(d => (Object.assign(Object.assign({}, d), { editable: false })));
|
|
1122
1136
|
}
|
|
1123
|
-
else if (utils_2.isObject(_options.data)) {
|
|
1137
|
+
else if ((0, utils_2.isObject)(_options.data)) {
|
|
1124
1138
|
changes.data = Object.assign(Object.assign({}, _options.data), { editable: false });
|
|
1125
1139
|
}
|
|
1126
1140
|
}
|
|
@@ -1140,7 +1154,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1140
1154
|
};
|
|
1141
1155
|
this.customAdd = () => () => {
|
|
1142
1156
|
const nextActive = this.props.formData.length;
|
|
1143
|
-
this.props.onChange(ArrayField_1.onArrayFieldChange([...this.props.formData, utils_2.getDefaultFormState(this.props.schema.items)], this.props));
|
|
1157
|
+
this.props.onChange((0, ArrayField_1.onArrayFieldChange)([...this.props.formData, (0, utils_2.getDefaultFormState)(this.props.schema.items)], this.props));
|
|
1144
1158
|
this.setState({ activeIdx: nextActive });
|
|
1145
1159
|
};
|
|
1146
1160
|
this.mapKeyFunctions = {
|
|
@@ -1152,7 +1166,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1152
1166
|
if (!this.refs.popup)
|
|
1153
1167
|
return;
|
|
1154
1168
|
this.setState({ popupIdx: this.filterPopupOptions(options) }, () => {
|
|
1155
|
-
this.refs.popup && utils_2.hasData(this.getPopupData(options)) && openPopupCallback(this.refs.popup.refs.popup);
|
|
1169
|
+
this.refs.popup && (0, utils_2.hasData)(this.getPopupData(options)) && openPopupCallback(this.refs.popup.refs.popup);
|
|
1156
1170
|
});
|
|
1157
1171
|
};
|
|
1158
1172
|
this.popupStrategies = {
|
|
@@ -1172,7 +1186,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1172
1186
|
this.getFeaturePopupData = (options) => {
|
|
1173
1187
|
if (!options)
|
|
1174
1188
|
return [];
|
|
1175
|
-
const { popupFields } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1189
|
+
const { popupFields } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1176
1190
|
const formData = this.getFormDataForPopup(options);
|
|
1177
1191
|
let data = [];
|
|
1178
1192
|
popupFields.forEach(({ field: col, template, value: _value, title: _title, if: _if, strategy }) => {
|
|
@@ -1192,13 +1206,13 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1192
1206
|
if (this.parsePopupPointer) {
|
|
1193
1207
|
col = this.parsePopupPointer(col, options);
|
|
1194
1208
|
}
|
|
1195
|
-
const _formData = utils_2.parseJSONPointer(formData, col);
|
|
1196
|
-
const schema = utils_2.parseSchemaFromFormDataPointer(this.props.schema.items || this.props.schema, col);
|
|
1197
|
-
const uiSchema = utils_2.parseUiSchemaFromFormDataPointer(this.props.uiSchema.items || this.props.uiSchema, col);
|
|
1209
|
+
const _formData = (0, utils_2.parseJSONPointer)(formData, col);
|
|
1210
|
+
const schema = (0, utils_2.parseSchemaFromFormDataPointer)(this.props.schema.items || this.props.schema, col);
|
|
1211
|
+
const uiSchema = (0, utils_2.parseUiSchemaFromFormDataPointer)(this.props.uiSchema.items || this.props.uiSchema, col);
|
|
1198
1212
|
title = schema.title;
|
|
1199
|
-
value = utils_2.formatValue(Object.assign(Object.assign({}, this.props), { formData: _formData, schema, uiSchema }));
|
|
1213
|
+
value = (0, utils_2.formatValue)(Object.assign(Object.assign({}, this.props), { formData: _formData, schema, uiSchema }));
|
|
1200
1214
|
}
|
|
1201
|
-
if (!utils_2.isEmptyString(value)) {
|
|
1215
|
+
if (!(0, utils_2.isEmptyString)(value)) {
|
|
1202
1216
|
let result;
|
|
1203
1217
|
if (_if) {
|
|
1204
1218
|
result = ["dataIdx", "featureIdx"].every(opt => !(opt in _if) || options[opt] === _if[opt]);
|
|
@@ -1221,7 +1235,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1221
1235
|
if (!this.location)
|
|
1222
1236
|
return;
|
|
1223
1237
|
const { latlng, radius } = this.location;
|
|
1224
|
-
const { createOnLocate } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1238
|
+
const { createOnLocate } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1225
1239
|
if (!createOnLocate)
|
|
1226
1240
|
return;
|
|
1227
1241
|
const geometry = this.getGeometry(this.props.formData);
|
|
@@ -1241,11 +1255,11 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1241
1255
|
}
|
|
1242
1256
|
};
|
|
1243
1257
|
this.props.formContext.services.settings.bind(this, props);
|
|
1244
|
-
this._context = Context_1.default(`${props.formContext.contextId}_MAP_CONTAINER`);
|
|
1258
|
+
this._context = (0, Context_1.default)(`${props.formContext.contextId}_MAP_CONTAINER`);
|
|
1245
1259
|
this._context.featureIdxsToItemIdxs = {};
|
|
1246
1260
|
this._context.setState = (state, callback) => this.setState(state, callback);
|
|
1247
1261
|
const initialState = Object.assign(Object.assign({}, (this.state || {})), { activeIdx: (this.props.formData || []).length === 1 ? 0 : undefined });
|
|
1248
|
-
const options = utils_2.getUiOptions(props.uiSchema);
|
|
1262
|
+
const options = (0, utils_2.getUiOptions)(props.uiSchema);
|
|
1249
1263
|
if ((this.props.formData || []).length && "activeIdx" in options)
|
|
1250
1264
|
initialState.activeIdx = options.activeIdx;
|
|
1251
1265
|
this.state = Object.assign(Object.assign({}, initialState), (this.state || {}));
|
|
@@ -1288,17 +1302,17 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1288
1302
|
componentDidUpdate(...params) {
|
|
1289
1303
|
if (super.componentDidUpdate)
|
|
1290
1304
|
super.componentDidUpdate(...params);
|
|
1291
|
-
const [prevProps, prevState] = params;
|
|
1305
|
+
const [prevProps, prevState] = params;
|
|
1292
1306
|
if (prevState.activeIdx !== this.state.activeIdx) {
|
|
1293
1307
|
if (!this.nestedHandledActiveChange && this.state.activeIdx !== undefined) {
|
|
1294
|
-
const { idToFocusAfterNavigate, idToScrollAfterNavigate } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1308
|
+
const { idToFocusAfterNavigate, idToScrollAfterNavigate } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1295
1309
|
this.props.formContext.utils.focusAndScroll(idToFocusAfterNavigate || `${this.props.idSchema.$id}_${this.state.activeIdx}`, idToScrollAfterNavigate);
|
|
1296
1310
|
}
|
|
1297
1311
|
this.nestedHandledActiveChange = false;
|
|
1298
1312
|
this.afterActiveChange(this.state.activeIdx);
|
|
1299
1313
|
}
|
|
1300
1314
|
if (this.refs.stretch) {
|
|
1301
|
-
const { resizeTimeout } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1315
|
+
const { resizeTimeout } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1302
1316
|
if (resizeTimeout) {
|
|
1303
1317
|
this.props.formContext.setTimeout(this.refs.stretch.update, resizeTimeout);
|
|
1304
1318
|
}
|
|
@@ -1332,7 +1346,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1332
1346
|
render() {
|
|
1333
1347
|
const { registry: { fields: { SchemaField } } } = this.props;
|
|
1334
1348
|
let { uiSchema, errorSchema, schema } = this.getSchemas();
|
|
1335
|
-
const options = utils_2.getUiOptions(this.props.uiSchema);
|
|
1349
|
+
const options = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1336
1350
|
const { popupFields, geometryField, topOffset, bottomOffset, belowFields, propsToPassToInlineSchema = [], emptyHelp, passActiveIdxToBelow = true } = options;
|
|
1337
1351
|
let { belowUiSchemaRoot = {}, inlineUiSchemaRoot = {}, idToFocusAfterNavigate, idToScrollAfterNavigate } = options;
|
|
1338
1352
|
const { activeIdx } = this.state;
|
|
@@ -1342,12 +1356,12 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1342
1356
|
idToFocusAfterNavigate,
|
|
1343
1357
|
idToScrollAfterNavigate
|
|
1344
1358
|
};
|
|
1345
|
-
uiSchema = utils_2.getInnerUiSchema(uiSchema);
|
|
1346
|
-
if (utils_2.getUiOptions(this.props.uiSchema).buttons) {
|
|
1347
|
-
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:options": Object.assign(Object.assign({}, uiSchema["ui:options"]), { buttons: [...(uiSchema["ui:options"].buttons || []), ...utils_2.getUiOptions(this.props.uiSchema).buttons] }) });
|
|
1359
|
+
uiSchema = (0, utils_2.getInnerUiSchema)(uiSchema);
|
|
1360
|
+
if ((0, utils_2.getUiOptions)(this.props.uiSchema).buttons) {
|
|
1361
|
+
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:options": Object.assign(Object.assign({}, uiSchema["ui:options"]), { buttons: [...(uiSchema["ui:options"].buttons || []), ...(0, utils_2.getUiOptions)(this.props.uiSchema).buttons] }) });
|
|
1348
1362
|
}
|
|
1349
1363
|
let mapOptions = this.getMapOptions();
|
|
1350
|
-
const mapSizes = options.mapSizes || utils_2.getBootstrapCols(6);
|
|
1364
|
+
const mapSizes = options.mapSizes || (0, utils_2.getBootstrapCols)(6);
|
|
1351
1365
|
const schemaSizes = ["lg", "md", "sm", "xs"].reduce((sizes, size) => {
|
|
1352
1366
|
sizes[size] = 12 - mapSizes[size] || 12;
|
|
1353
1367
|
return sizes;
|
|
@@ -1368,7 +1382,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1368
1382
|
if (!this.onChangeFor[key]) {
|
|
1369
1383
|
this.onChangeFor[key] = formData => {
|
|
1370
1384
|
this.props.onChange(formData.map((item, idx) => {
|
|
1371
|
-
return Object.assign(Object.assign({}, (this.props.formData[idx] || utils_2.getDefaultFormState(this.props.schema.items))), item);
|
|
1385
|
+
return Object.assign(Object.assign({}, (this.props.formData[idx] || (0, utils_2.getDefaultFormState)(this.props.schema.items))), item);
|
|
1372
1386
|
}));
|
|
1373
1387
|
};
|
|
1374
1388
|
}
|
|
@@ -1380,8 +1394,8 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1380
1394
|
return _props;
|
|
1381
1395
|
}, {});
|
|
1382
1396
|
const childProps = getChildProps();
|
|
1383
|
-
const inlineSchemaProps = putChildsToParents(NestField_1.getPropsForFields(childProps, Object.keys(schema.items.properties).filter(field => !(belowFields || []).includes(field))));
|
|
1384
|
-
const belowSchemaProps = belowFields ? putChildsToParents(NestField_1.getPropsForFields(childProps, belowFields)) : null;
|
|
1397
|
+
const inlineSchemaProps = putChildsToParents((0, NestField_1.getPropsForFields)(childProps, Object.keys(schema.items.properties).filter(field => !(belowFields || []).includes(field))));
|
|
1398
|
+
const belowSchemaProps = belowFields ? putChildsToParents((0, NestField_1.getPropsForFields)(childProps, belowFields)) : null;
|
|
1385
1399
|
const inlineItemsUiSchema = Object.assign(Object.assign({}, uiSchema.items), inlineSchemaProps.uiSchema.items);
|
|
1386
1400
|
let inlineUiSchema = Object.assign({}, inlineSchemaProps.uiSchema);
|
|
1387
1401
|
if (inlineUiSchemaRoot) {
|
|
@@ -1401,7 +1415,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1401
1415
|
belowUiSchema.items["ui:options"] = {};
|
|
1402
1416
|
}
|
|
1403
1417
|
belowUiSchema.items["ui:options"].reserveId = false;
|
|
1404
|
-
const { buttonsPath, addButtonPath, showErrors = true } = utils_2.getUiOptions(this.props.uiSchema);
|
|
1418
|
+
const { buttonsPath, addButtonPath, showErrors = true } = (0, utils_2.getUiOptions)(this.props.uiSchema);
|
|
1405
1419
|
if (addButtonPath)
|
|
1406
1420
|
console.warn("addButtonPath option for MapArrayField is deprecated - use buttonsPath instead!");
|
|
1407
1421
|
let _buttonsPath = buttonsPath || addButtonPath;
|
|
@@ -1417,7 +1431,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1417
1431
|
if ((mapOptions.emptyMode || activeIdx !== undefined) && options.buttons) {
|
|
1418
1432
|
if (_buttonsPath) {
|
|
1419
1433
|
buttons = prependAddButton(options.buttons);
|
|
1420
|
-
belowUiSchema = utils_2.injectButtons(belowUiSchema, buttons, _buttonsPath);
|
|
1434
|
+
belowUiSchema = (0, utils_2.injectButtons)(belowUiSchema, buttons, _buttonsPath);
|
|
1421
1435
|
inlineUiSchema["ui:options"].renderAdd = false;
|
|
1422
1436
|
}
|
|
1423
1437
|
else if (options.renderButtonsBelow) {
|
|
@@ -1435,7 +1449,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1435
1449
|
const inlineSchema = React.createElement(SchemaField, Object.assign({}, defaultProps, inlineSchemaProps, { uiSchema: inlineUiSchema }, overrideProps));
|
|
1436
1450
|
const belowSchema = belowFields ? React.createElement(SchemaField, Object.assign({}, this.props, belowSchemaProps, { uiSchema: belowUiSchema })) : null;
|
|
1437
1451
|
buttons = buttons && (!_buttonsPath || mapOptions.emptyMode)
|
|
1438
|
-
? buttons.map(button => ArrayFieldTemplate_1.getButton(button, {
|
|
1452
|
+
? buttons.map(button => (0, ArrayFieldTemplate_1.getButton)(button, {
|
|
1439
1453
|
canAdd: mapOptions.emptyMode ? (button.fn !== "add" && button.fnName !== "add") : true,
|
|
1440
1454
|
uiSchema: this.props.uiSchema,
|
|
1441
1455
|
idSchema: this.props.idSchema,
|
|
@@ -1445,7 +1459,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1445
1459
|
readonly: this.props.readonly,
|
|
1446
1460
|
})).filter(button => button)
|
|
1447
1461
|
: undefined;
|
|
1448
|
-
const _errors = errorSchema && utils_2.parseJSONPointer(errorSchema[activeIdx] || {}, geometryField);
|
|
1462
|
+
const _errors = errorSchema && (0, utils_2.parseJSONPointer)(errorSchema[activeIdx] || {}, geometryField);
|
|
1449
1463
|
const errors = _errors
|
|
1450
1464
|
? _errors.__errors.map(utils_2.formatErrorMessage)
|
|
1451
1465
|
: null;
|
|
@@ -1465,12 +1479,12 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1465
1479
|
onResize: this.onResize,
|
|
1466
1480
|
mounted: this.state.mounted,
|
|
1467
1481
|
className: this.state.focusGrabbed ? "pass-block" : "",
|
|
1468
|
-
minHeight: utils_2.getUiOptions(this.props.uiSchema).minHeight,
|
|
1482
|
+
minHeight: (0, utils_2.getUiOptions)(this.props.uiSchema).minHeight,
|
|
1469
1483
|
onEnterViewPort: this.onEnterViewPort,
|
|
1470
1484
|
enterViewPortTreshold: 200
|
|
1471
1485
|
};
|
|
1472
1486
|
const wrappedMap = (React.createElement(components_1.Stretch, Object.assign({}, wrapperProps, { ref: "stretch" }), map));
|
|
1473
|
-
const TitleFieldTemplate = utils_3.getTemplate("TitleFieldTemplate", this.props.registry, utils_2.getUiOptions(this.props.uiSchema));
|
|
1487
|
+
const TitleFieldTemplate = (0, utils_3.getTemplate)("TitleFieldTemplate", this.props.registry, (0, utils_2.getUiOptions)(this.props.uiSchema));
|
|
1474
1488
|
const { Popover, Row, Col, ButtonToolbar } = this.context.theme;
|
|
1475
1489
|
return (React.createElement(React.Fragment, null,
|
|
1476
1490
|
React.createElement(Row, null,
|
|
@@ -1487,7 +1501,7 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1487
1501
|
React.createElement(Popup, { data: this.getPopupData(this.state.popupIdx), ref: "popup" })) : null,
|
|
1488
1502
|
React.createElement(Row, null, mapOptions.emptyMode ? null : belowSchema),
|
|
1489
1503
|
renderButtonsBelow && !mapOptions.emptyMode && buttons.length ? (React.createElement(Row, { className: "map-array-field-below-buttons" },
|
|
1490
|
-
React.createElement(TitleFieldTemplate, { title: utils_2.getUiOptions(uiSchema).buttonsTitle, schema: this.props.schema }),
|
|
1504
|
+
React.createElement(TitleFieldTemplate, { title: (0, utils_2.getUiOptions)(uiSchema).buttonsTitle, schema: this.props.schema }),
|
|
1491
1505
|
React.createElement(ButtonToolbar, null, buttons))) : null));
|
|
1492
1506
|
}
|
|
1493
1507
|
getDraftStyle() {
|
|
@@ -1515,9 +1529,9 @@ function _MapArrayField(ComposedComponent) {
|
|
|
1515
1529
|
return this.state.activeIdx !== undefined ? this.props.formData[this.state.activeIdx] : undefined;
|
|
1516
1530
|
}
|
|
1517
1531
|
}
|
|
1518
|
-
}
|
|
1532
|
+
}
|
|
1519
1533
|
_MapArrayField.contextType = ReactContext_1.default;
|
|
1520
|
-
return _MapArrayField;
|
|
1534
|
+
return _MapArrayField;
|
|
1521
1535
|
}
|
|
1522
1536
|
class Popup extends React.Component {
|
|
1523
1537
|
render() {
|
|
@@ -1596,8 +1610,8 @@ class MapComponent extends React.Component {
|
|
|
1596
1610
|
this._permaCallback = fn;
|
|
1597
1611
|
};
|
|
1598
1612
|
this.state = { mapOptions: {} };
|
|
1599
|
-
this.mainContext = Context_1.default(props.formContext.contextId);
|
|
1600
|
-
this._context = Context_1.default(`${props.formContext.contextId}_MAP`);
|
|
1613
|
+
this.mainContext = (0, Context_1.default)(props.formContext.contextId);
|
|
1614
|
+
this._context = (0, Context_1.default)(`${props.formContext.contextId}_MAP`);
|
|
1601
1615
|
this._context.grabFocus = this.grabFocus;
|
|
1602
1616
|
this._context.releaseFocus = this.releaseFocus;
|
|
1603
1617
|
this._context.showPanel = this.showPanel;
|
|
@@ -1630,7 +1644,7 @@ class MapComponent extends React.Component {
|
|
|
1630
1644
|
this._permaCallback();
|
|
1631
1645
|
}
|
|
1632
1646
|
render() {
|
|
1633
|
-
const _a = this.props, { panel, onFocusGrab, onFocusRelease, onOptionsChanged } = _a, mapOptions = __rest(_a, ["panel", "onFocusGrab", "onFocusRelease", "onOptionsChanged"]);
|
|
1647
|
+
const _a = this.props, { panel, onFocusGrab, onFocusRelease, onOptionsChanged } = _a, mapOptions = __rest(_a, ["panel", "onFocusGrab", "onFocusRelease", "onOptionsChanged"]);
|
|
1634
1648
|
const { Modal } = this.context.theme;
|
|
1635
1649
|
const controlledPanel = panel ?
|
|
1636
1650
|
React.createElement(MapPanel, { id: panel.id, variant: panel.variant || undefined, buttonThemeRole: panel.buttonThemeRole, header: panel.header, text: panel.panelTextContent })
|
|
@@ -1644,7 +1658,7 @@ class MapComponent extends React.Component {
|
|
|
1644
1658
|
React.createElement(Modal.Header, { closeButton: true }),
|
|
1645
1659
|
React.createElement(Modal.Body, null,
|
|
1646
1660
|
React.createElement("span", { dangerouslySetInnerHTML: { __html: mapOptions.help } }))),
|
|
1647
|
-
React.createElement(Map, Object.assign({ className: this.props.className, style: this.props.style, ref: "map", showHelp: this.showHelp, hideHelp: this.hideHelp, formContext: this.props.formContext },
|
|
1661
|
+
React.createElement(Map, Object.assign({ className: this.props.className, style: this.props.style, ref: "map", showHelp: this.showHelp, hideHelp: this.hideHelp, formContext: this.props.formContext }, mapOptions, this.state.mapOptions))));
|
|
1648
1662
|
}
|
|
1649
1663
|
}
|
|
1650
1664
|
exports.MapComponent = MapComponent;
|
|
@@ -1653,23 +1667,14 @@ class Map extends React.Component {
|
|
|
1653
1667
|
constructor(props) {
|
|
1654
1668
|
super(props);
|
|
1655
1669
|
this.getMapOptions = (props) => {
|
|
1656
|
-
const { className,
|
|
1657
|
-
style, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1658
|
-
hidden, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1659
|
-
singleton, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1660
|
-
emptyMode, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1661
|
-
onComponentDidMount, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1662
|
-
fullscreenable, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1663
|
-
formContext, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1664
|
-
controlSettings } = props, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1665
|
-
mapOptions = __rest(props, ["className", "style", "hidden", "singleton", "emptyMode", "onComponentDidMount", "fullscreenable", "formContext", "controlSettings"]);
|
|
1670
|
+
const { className, style, hidden, singleton, emptyMode, onComponentDidMount, fullscreenable, formContext, controlSettings } = props, mapOptions = __rest(props, ["className", "style", "hidden", "singleton", "emptyMode", "onComponentDidMount", "fullscreenable", "formContext", "controlSettings"]);
|
|
1666
1671
|
return mapOptions;
|
|
1667
1672
|
};
|
|
1668
1673
|
this.getEnhancedMapOptions = (props) => {
|
|
1669
1674
|
const mapOptions = this.getMapOptions(props);
|
|
1670
1675
|
const { fullscreenable, help, formContext = {} } = props;
|
|
1671
1676
|
if (fullscreenable) {
|
|
1672
|
-
mapOptions.controls = Object.assign({ fullscreen: true }, (utils_2.isObject(mapOptions.controls)
|
|
1677
|
+
mapOptions.controls = Object.assign({ fullscreen: true }, ((0, utils_2.isObject)(mapOptions.controls)
|
|
1673
1678
|
? mapOptions.controls
|
|
1674
1679
|
: {}));
|
|
1675
1680
|
}
|
|
@@ -1745,7 +1750,7 @@ class Map extends React.Component {
|
|
|
1745
1750
|
// Backward compatibility for bad settings.
|
|
1746
1751
|
["tileLayerName", "overlayNames", "tileLayerOpacity"].forEach(prop => {
|
|
1747
1752
|
if (prop in options && options[prop] === undefined) {
|
|
1748
|
-
options = utils_2.immutableDelete(options, prop);
|
|
1753
|
+
options = (0, utils_2.immutableDelete)(options, prop);
|
|
1749
1754
|
}
|
|
1750
1755
|
});
|
|
1751
1756
|
if (this.props.hidden) {
|
|
@@ -1807,7 +1812,7 @@ const getFeatureStyleWithLowerOpacity = style => (Object.assign(Object.assign({}
|
|
|
1807
1812
|
exports.getFeatureStyleWithLowerOpacity = getFeatureStyleWithLowerOpacity;
|
|
1808
1813
|
const getFeatureStyleWithHighlight = style => {
|
|
1809
1814
|
const color = style.color
|
|
1810
|
-
? utils_1.combineColors(style.color, "#ffffff", 30)
|
|
1815
|
+
? (0, utils_1.combineColors)(style.color, "#ffffff", 30)
|
|
1811
1816
|
: undefined;
|
|
1812
1817
|
return Object.assign(Object.assign({}, style), { color, fillOpacity: saneOpacityRange(style.fillOpacity || 0.4 + 0.4) });
|
|
1813
1818
|
};
|
|
@@ -1818,7 +1823,7 @@ const syncLineTransectStartEnd = (formData) => {
|
|
|
1818
1823
|
: undefined;
|
|
1819
1824
|
if (lineTransectFeature) {
|
|
1820
1825
|
return formData.map((item, idx) => {
|
|
1821
|
-
const [start, end] = utils_4.getLineTransectStartEndDistancesForIdx(lineTransectFeature, idx, 10);
|
|
1826
|
+
const [start, end] = (0, utils_4.getLineTransectStartEndDistancesForIdx)(lineTransectFeature, idx, 10);
|
|
1822
1827
|
if (!item.gatheringFact) {
|
|
1823
1828
|
item.gatheringFact = {};
|
|
1824
1829
|
}
|