@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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
@@ -55,12 +69,12 @@ let InjectField = class InjectField extends React.Component {
|
|
|
55
69
|
const options = this.getUiOptions();
|
|
56
70
|
(Array.isArray(options.injections) ? options.injections.slice(0).reverse() : [options.injections]).forEach((injection) => {
|
|
57
71
|
let { fields, target } = injection;
|
|
58
|
-
target = utils_1.toJSONPointer(target);
|
|
72
|
+
target = (0, utils_1.toJSONPointer)(target);
|
|
59
73
|
formData = fields.reduce((formData, fieldPointer) => {
|
|
60
|
-
fieldPointer = utils_1.toJSONPointer(fieldPointer);
|
|
74
|
+
fieldPointer = (0, utils_1.toJSONPointer)(fieldPointer);
|
|
61
75
|
const fieldName = fieldPointer.split("/").pop();
|
|
62
|
-
formData = utils_1.updateFormDataWithJSONPointer(Object.assign(Object.assign({}, this.props), { formData }), utils_1.parseJSONPointer(formData, `${target}/${fieldName}`), fieldPointer);
|
|
63
|
-
formData = utils_1.immutableDelete(formData, `${target}/${fieldName}`);
|
|
76
|
+
formData = (0, utils_1.updateFormDataWithJSONPointer)(Object.assign(Object.assign({}, this.props), { formData }), (0, utils_1.parseJSONPointer)(formData, `${target}/${fieldName}`), fieldPointer);
|
|
77
|
+
formData = (0, utils_1.immutableDelete)(formData, `${target}/${fieldName}`);
|
|
64
78
|
return formData;
|
|
65
79
|
}, formData);
|
|
66
80
|
});
|
|
@@ -69,21 +83,21 @@ let InjectField = class InjectField extends React.Component {
|
|
|
69
83
|
}
|
|
70
84
|
static getName() { return "InjectField"; }
|
|
71
85
|
getStateFromProps(props) {
|
|
72
|
-
const options = utils_1.getUiOptions(props.uiSchema);
|
|
86
|
+
const options = (0, utils_1.getUiOptions)(props.uiSchema);
|
|
73
87
|
const { injections } = options;
|
|
74
88
|
let { schema, uiSchema, idSchema, formData, errorSchema } = props;
|
|
75
89
|
(Array.isArray(injections) ? injections : [injections]).forEach((injection) => {
|
|
76
90
|
let { fields, target } = injection;
|
|
77
|
-
target = utils_1.toJSONPointer(target);
|
|
91
|
+
target = (0, utils_1.toJSONPointer)(target);
|
|
78
92
|
const origSchema = schema;
|
|
79
93
|
fields.forEach((fieldPath) => {
|
|
80
|
-
fieldPath = utils_1.toJSONPointer(fieldPath);
|
|
94
|
+
fieldPath = (0, utils_1.toJSONPointer)(fieldPath);
|
|
81
95
|
const fieldName = fieldPath.split("/").pop();
|
|
82
|
-
schema = utils_1.updateSafelyWithJSONPointer(schema, utils_1.parseJSONPointer(origSchema, utils_1.schemaJSONPointer(origSchema, fieldPath)), `${utils_1.schemaJSONPointer(origSchema, target)}/properties/${fieldName}`);
|
|
83
|
-
schema = utils_1.immutableDelete(schema, utils_1.schemaJSONPointer(origSchema, fieldPath));
|
|
84
|
-
uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, utils_1.parseJSONPointer(uiSchema, utils_1.uiSchemaJSONPointer(origSchema, fieldPath)), `${utils_1.uiSchemaJSONPointer(origSchema, target)}/${fieldName}`);
|
|
85
|
-
uiSchema = utils_1.immutableDelete(uiSchema, utils_1.uiSchemaJSONPointer(origSchema, fieldPath));
|
|
86
|
-
const [_formData, _idSchema, _errorSchema] = [formData, idSchema, errorSchema].map(prop => utils_1.immutableDelete(utils_1.updateSafelyWithJSONPointer(prop, utils_1.parseJSONPointer(prop, fieldPath), `${target}/${fieldName}`), fieldPath));
|
|
96
|
+
schema = (0, utils_1.updateSafelyWithJSONPointer)(schema, (0, utils_1.parseJSONPointer)(origSchema, (0, utils_1.schemaJSONPointer)(origSchema, fieldPath)), `${(0, utils_1.schemaJSONPointer)(origSchema, target)}/properties/${fieldName}`);
|
|
97
|
+
schema = (0, utils_1.immutableDelete)(schema, (0, utils_1.schemaJSONPointer)(origSchema, fieldPath));
|
|
98
|
+
uiSchema = (0, utils_1.updateSafelyWithJSONPointer)(uiSchema, (0, utils_1.parseJSONPointer)(uiSchema, (0, utils_1.uiSchemaJSONPointer)(origSchema, fieldPath)), `${(0, utils_1.uiSchemaJSONPointer)(origSchema, target)}/${fieldName}`);
|
|
99
|
+
uiSchema = (0, utils_1.immutableDelete)(uiSchema, (0, utils_1.uiSchemaJSONPointer)(origSchema, fieldPath));
|
|
100
|
+
const [_formData, _idSchema, _errorSchema] = [formData, idSchema, errorSchema].map(prop => (0, utils_1.immutableDelete)((0, utils_1.updateSafelyWithJSONPointer)(prop, (0, utils_1.parseJSONPointer)(prop, fieldPath), `${target}/${fieldName}`), fieldPath));
|
|
87
101
|
formData = _formData;
|
|
88
102
|
errorSchema = _errorSchema;
|
|
89
103
|
idSchema = _idSchema;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export default class InputWithDefaultValueButtonField extends React.Component<any, any, any> {
|
|
2
2
|
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
3
|
+
uiSchema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
4
|
+
"ui:options": PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
5
5
|
buttonLabel: PropTypes.Validator<string>;
|
|
6
6
|
buttonField: PropTypes.Validator<string>;
|
|
7
|
-
valueFields: PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
+
valueFields: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
8
8
|
field: PropTypes.Validator<string>;
|
|
9
9
|
contextFieldForDefaultValue: PropTypes.Validator<string>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
10
|
+
}>>[]>;
|
|
11
|
+
}>>>;
|
|
12
|
+
}>>>;
|
|
13
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
14
14
|
type: PropTypes.Requireable<string>;
|
|
15
|
-
}
|
|
15
|
+
}>>>;
|
|
16
16
|
formData: PropTypes.Validator<object>;
|
|
17
17
|
};
|
|
18
18
|
static getName(): string;
|
|
@@ -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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
@@ -39,9 +53,9 @@ let InputWithDefaultValueButtonField = class InputWithDefaultValueButtonField ex
|
|
|
39
53
|
this.onClick = () => {
|
|
40
54
|
let { uiSchema, formData } = this.props;
|
|
41
55
|
const uiSchemaContext = this.props.formContext.uiSchemaContext || {};
|
|
42
|
-
const { valueFields } = utils_1.getUiOptions(uiSchema);
|
|
56
|
+
const { valueFields } = (0, utils_1.getUiOptions)(uiSchema);
|
|
43
57
|
valueFields.forEach(({ field, contextFieldForDefaultValue }) => {
|
|
44
|
-
formData = utils_1.updateSafelyWithJSONPointer(formData, uiSchemaContext[contextFieldForDefaultValue], field);
|
|
58
|
+
formData = (0, utils_1.updateSafelyWithJSONPointer)(formData, uiSchemaContext[contextFieldForDefaultValue], field);
|
|
45
59
|
});
|
|
46
60
|
this.props.onChange(formData);
|
|
47
61
|
};
|
|
@@ -49,17 +63,17 @@ let InputWithDefaultValueButtonField = class InputWithDefaultValueButtonField ex
|
|
|
49
63
|
static getName() { return "InputWithDefaultValueButtonField"; }
|
|
50
64
|
getStateFromProps(props) {
|
|
51
65
|
let { schema, uiSchema } = props;
|
|
52
|
-
const { buttonField, buttonLabel } = utils_1.getUiOptions(uiSchema);
|
|
53
|
-
const innerUiSchema = utils_1.getInnerUiSchema(uiSchema);
|
|
54
|
-
const buttonFieldJSONPointer = utils_1.uiSchemaJSONPointer(schema, buttonField);
|
|
55
|
-
const buttonFieldUiSchema = deepmerge_1.default(utils_1.parseJSONPointer(innerUiSchema, buttonFieldJSONPointer) || {}, {
|
|
66
|
+
const { buttonField, buttonLabel } = (0, utils_1.getUiOptions)(uiSchema);
|
|
67
|
+
const innerUiSchema = (0, utils_1.getInnerUiSchema)(uiSchema);
|
|
68
|
+
const buttonFieldJSONPointer = (0, utils_1.uiSchemaJSONPointer)(schema, buttonField);
|
|
69
|
+
const buttonFieldUiSchema = (0, deepmerge_1.default)((0, utils_1.parseJSONPointer)(innerUiSchema, buttonFieldJSONPointer) || {}, {
|
|
56
70
|
"ui:widget": "InputWithDefaultValueButtonWidget",
|
|
57
71
|
"ui:options": {
|
|
58
72
|
buttonLabel,
|
|
59
73
|
onClick: this.onClick
|
|
60
74
|
}
|
|
61
75
|
});
|
|
62
|
-
uiSchema = utils_1.updateSafelyWithJSONPointer(innerUiSchema, buttonFieldUiSchema, buttonFieldJSONPointer);
|
|
76
|
+
uiSchema = (0, utils_1.updateSafelyWithJSONPointer)(innerUiSchema, buttonFieldUiSchema, buttonFieldJSONPointer);
|
|
63
77
|
return Object.assign(Object.assign({}, props), { uiSchema });
|
|
64
78
|
}
|
|
65
79
|
};
|
|
@@ -2,12 +2,14 @@ export default class LocalityField extends React.Component<any, any, any> {
|
|
|
2
2
|
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
3
3
|
static propTypes: {
|
|
4
4
|
uiSchema: PropTypes.Requireable<object>;
|
|
5
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
5
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
6
6
|
type: PropTypes.Requireable<string>;
|
|
7
|
-
}
|
|
7
|
+
}>>>;
|
|
8
8
|
formData: PropTypes.Validator<object>;
|
|
9
9
|
};
|
|
10
10
|
constructor(props: any);
|
|
11
|
+
state: {};
|
|
12
|
+
render(): JSX.Element;
|
|
11
13
|
showEditor: () => void;
|
|
12
14
|
hideEditor: () => void;
|
|
13
15
|
setFormRef: (elem: any) => void;
|
|
@@ -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)
|
|
@@ -60,12 +74,12 @@ let LocalityField = class LocalityField extends React.Component {
|
|
|
60
74
|
this.lajiForm = elem;
|
|
61
75
|
};
|
|
62
76
|
this.renderModal = () => {
|
|
63
|
-
const _a = this.props, { onChange } = _a, props = __rest(_a, ["onChange"]);
|
|
77
|
+
const _a = this.props, { onChange } = _a, props = __rest(_a, ["onChange"]);
|
|
64
78
|
const { Modal } = this.context.theme;
|
|
65
79
|
return (React.createElement(Modal, { dialogClassName: "laji-form image-modal", show: true, onHide: this.hideEditor },
|
|
66
80
|
React.createElement(Modal.Header, { closeButton: true }),
|
|
67
81
|
React.createElement(Modal.Body, null,
|
|
68
|
-
React.createElement(LajiForm_1.default, Object.assign({ ref: this.setFormRef }, props, { uiSchema: utils_1.getInnerUiSchema(this.props.uiSchema), onSubmit: this.onSubmit, lang: this.props.formContext.lang, showShortcutButton: false, renderSubmit: false, validators: {}, warnings: {}, apiClient: this.props.formContext.apiClient.apiClient, uiSchemaContext: this.props.formContext.uiSchemaContext })),
|
|
82
|
+
React.createElement(LajiForm_1.default, Object.assign({ ref: this.setFormRef }, props, { uiSchema: (0, utils_1.getInnerUiSchema)(this.props.uiSchema), onSubmit: this.onSubmit, lang: this.props.formContext.lang, showShortcutButton: false, renderSubmit: false, validators: {}, warnings: {}, apiClient: this.props.formContext.apiClient.apiClient, uiSchemaContext: this.props.formContext.uiSchemaContext })),
|
|
69
83
|
React.createElement(components_1.Button, { block: true, onClick: this.onSubmitClick }, "OK"),
|
|
70
84
|
React.createElement(components_1.Button, { block: true, onClick: this.hideEditor }, this.props.formContext.translations.Cancel))));
|
|
71
85
|
};
|
|
@@ -79,13 +93,13 @@ let LocalityField = class LocalityField extends React.Component {
|
|
|
79
93
|
this.state = {};
|
|
80
94
|
}
|
|
81
95
|
render() {
|
|
82
|
-
const { radius: _radius, geometry } = utils_1.getUiOptions(this.props.uiSchema);
|
|
96
|
+
const { radius: _radius, geometry } = (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
83
97
|
const fields = Object.keys(this.props.schema.properties);
|
|
84
|
-
const values = fields.filter(s => !utils_1.isEmptyString(this.props.formData[s])).map(f => this.props.formData[f]);
|
|
98
|
+
const values = fields.filter(s => !(0, utils_1.isEmptyString)(this.props.formData[s])).map(f => this.props.formData[f]);
|
|
85
99
|
const radius = typeof _radius === "number"
|
|
86
100
|
? _radius
|
|
87
101
|
: geometry
|
|
88
|
-
? MapField_1.getCenterAndRadiusFromGeometry(geometry).radius
|
|
102
|
+
? (0, MapField_1.getCenterAndRadiusFromGeometry)(geometry).radius
|
|
89
103
|
: undefined;
|
|
90
104
|
if (typeof radius === "number") {
|
|
91
105
|
values.push(`(${this.props.formContext.translations.accuracy}: ${parseInt(radius)}m)`);
|
|
@@ -93,7 +107,7 @@ let LocalityField = class LocalityField extends React.Component {
|
|
|
93
107
|
const { Panel, Row, Col } = this.context.theme;
|
|
94
108
|
return (React.createElement(Row, null,
|
|
95
109
|
React.createElement(Col, { xs: 12 },
|
|
96
|
-
React.createElement(Panel, { className: utils_1.getUiOptions(this.props.uiSchema).panelClassName },
|
|
110
|
+
React.createElement(Panel, { className: (0, utils_1.getUiOptions)(this.props.uiSchema).panelClassName },
|
|
97
111
|
React.createElement(Panel.Body, null,
|
|
98
112
|
values.map((v, i) => (React.createElement("span", { key: i },
|
|
99
113
|
v,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default class LocationChooserField extends React.Component<any, any, any> {
|
|
2
2
|
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
3
|
+
uiSchema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
4
4
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
5
|
uiSchema: PropTypes.Requireable<object>;
|
|
6
6
|
taxonField: PropTypes.Requireable<string>;
|
|
@@ -11,10 +11,10 @@ export default class LocationChooserField extends React.Component<any, any, any>
|
|
|
11
11
|
preselectMarker: PropTypes.Requireable<boolean>;
|
|
12
12
|
color: PropTypes.Requireable<string>;
|
|
13
13
|
}>>;
|
|
14
|
-
}
|
|
15
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
14
|
+
}>>>;
|
|
15
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
16
16
|
type: PropTypes.Requireable<string>;
|
|
17
|
-
}
|
|
17
|
+
}>>>;
|
|
18
18
|
formData: PropTypes.Validator<object>;
|
|
19
19
|
};
|
|
20
20
|
constructor(props: any);
|
|
@@ -22,6 +22,7 @@ export default class LocationChooserField extends React.Component<any, any, any>
|
|
|
22
22
|
getStateFromProps(props: any): {
|
|
23
23
|
uiSchema: import("../../types").UiSchema<any>;
|
|
24
24
|
};
|
|
25
|
+
render(): JSX.Element;
|
|
25
26
|
}
|
|
26
27
|
import * as React from "react";
|
|
27
28
|
import * as PropTypes from "prop-types";
|
|
@@ -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)
|
|
@@ -50,7 +64,7 @@ const MapArrayField_1 = require("./MapArrayField");
|
|
|
50
64
|
const ReactContext_1 = __importDefault(require("../../ReactContext"));
|
|
51
65
|
let LocationChooserField = class LocationChooserField extends React.Component {
|
|
52
66
|
getStateFromProps(props) {
|
|
53
|
-
let uiSchema = utils_1.getInnerUiSchema(props.uiSchema);
|
|
67
|
+
let uiSchema = (0, utils_1.getInnerUiSchema)(props.uiSchema);
|
|
54
68
|
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:buttons": [
|
|
55
69
|
...(uiSchema["ui:buttons"] || []),
|
|
56
70
|
React.createElement(LocationButton, { key: `$${this.props.idSchema.$id}-location`, that: this })
|
|
@@ -95,22 +109,22 @@ class LocationButton extends React.Component {
|
|
|
95
109
|
};
|
|
96
110
|
this.getGeometryField = () => {
|
|
97
111
|
const { that } = this.props;
|
|
98
|
-
const { geometryField = "geometry" } = utils_1.getUiOptions(that.props.uiSchema);
|
|
112
|
+
const { geometryField = "geometry" } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
99
113
|
return geometryField;
|
|
100
114
|
};
|
|
101
115
|
this.hasCoordinates = () => {
|
|
102
|
-
return MapArrayField_1.parseGeometries(this.getGeometry()).length;
|
|
116
|
+
return (0, MapArrayField_1.parseGeometries)(this.getGeometry()).length;
|
|
103
117
|
};
|
|
104
118
|
this.getGeometry = () => {
|
|
105
119
|
const geometryField = this.getGeometryField();
|
|
106
|
-
return utils_1.parseJSONPointer(this.props.that.props.formData, geometryField);
|
|
120
|
+
return (0, utils_1.parseJSONPointer)(this.props.that.props.formData, geometryField);
|
|
107
121
|
};
|
|
108
122
|
this.onMouseEnter = () => {
|
|
109
123
|
const { that } = this.props;
|
|
110
124
|
const idx = this.getIdx();
|
|
111
125
|
this._hovered = true;
|
|
112
126
|
if (typeof idx === "number") {
|
|
113
|
-
that.props.formContext.services.customEvents.send(that.props.idSchema.$id, "startHighlight", { id: utils_1.getUUID(that.props.formData), idx });
|
|
127
|
+
that.props.formContext.services.customEvents.send(that.props.idSchema.$id, "startHighlight", { id: (0, utils_1.getUUID)(that.props.formData), idx });
|
|
114
128
|
}
|
|
115
129
|
};
|
|
116
130
|
this.onMouseLeave = () => {
|
|
@@ -118,14 +132,14 @@ class LocationButton extends React.Component {
|
|
|
118
132
|
const idx = this.getIdx();
|
|
119
133
|
this._hovered = false;
|
|
120
134
|
if (typeof idx === "number") {
|
|
121
|
-
that.props.formContext.services.customEvents.send(that.props.idSchema.$id, "endHighlight", { id: utils_1.getUUID(that.props.formData), idx });
|
|
135
|
+
that.props.formContext.services.customEvents.send(that.props.idSchema.$id, "endHighlight", { id: (0, utils_1.getUUID)(that.props.formData), idx });
|
|
122
136
|
}
|
|
123
137
|
};
|
|
124
138
|
this.getUnitDrawFeatureStyle = () => ({ color: "#55AEFA" });
|
|
125
139
|
this.getDataFeatureStyle = () => ({ color: "#aaaaaa", opacity: 0.7 });
|
|
126
140
|
this.getData = () => {
|
|
127
141
|
const { that } = this.props;
|
|
128
|
-
const { strategy = "unit" } = utils_1.getUiOptions(that.props.uiSchema);
|
|
142
|
+
const { strategy = "unit" } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
129
143
|
switch (strategy) {
|
|
130
144
|
case "unit":
|
|
131
145
|
return this.getUnitData();
|
|
@@ -136,7 +150,7 @@ class LocationButton extends React.Component {
|
|
|
136
150
|
};
|
|
137
151
|
this.getUnitData = () => {
|
|
138
152
|
const { that } = this.props;
|
|
139
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
153
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
140
154
|
const { map } = mapContext;
|
|
141
155
|
const emptyFeatureCollection = { featureCollection: { type: "FeatureCollection", features: [] } };
|
|
142
156
|
const gatheringData = map ? map.getDraw() : emptyFeatureCollection;
|
|
@@ -179,14 +193,14 @@ class LocationButton extends React.Component {
|
|
|
179
193
|
};
|
|
180
194
|
this.getLolifeData = () => {
|
|
181
195
|
const { that } = this.props;
|
|
182
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
196
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
183
197
|
const { map } = mapContext;
|
|
184
|
-
const { strategy = "unit" } = utils_1.getUiOptions(that.props.uiSchema);
|
|
198
|
+
const { strategy = "unit" } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
185
199
|
let draw;
|
|
186
200
|
if (strategy === "lolife") {
|
|
187
201
|
draw = map.getDraw();
|
|
188
202
|
}
|
|
189
|
-
const id = utils_1.getUUID(that.props.formData);
|
|
203
|
+
const id = (0, utils_1.getUUID)(that.props.formData);
|
|
190
204
|
let data = map.data.filter((item) => {
|
|
191
205
|
const isCurrent = item.featureCollection.features[0].properties.id === id;
|
|
192
206
|
if (strategy === "lolifeUnit" && isCurrent) {
|
|
@@ -205,13 +219,13 @@ class LocationButton extends React.Component {
|
|
|
205
219
|
this.onClick = () => {
|
|
206
220
|
const { that } = this.props;
|
|
207
221
|
const { disabled, readonly } = that.props;
|
|
208
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
222
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
209
223
|
const { map } = mapContext;
|
|
210
224
|
this.triggerLayer = undefined;
|
|
211
225
|
let [draw, data] = this.getData();
|
|
212
226
|
data = data.map(d => (Object.assign(Object.assign({}, d), { editable: false })));
|
|
213
|
-
const _a = map ? map.getOptions() : { mapOptions: {} }, { rootElem, customControls, zoom, center } = _a, mapOptions = __rest(_a, ["rootElem", "customControls", "zoom", "center"]);
|
|
214
|
-
const { mapOptions: { marker = true, polyline = false, rectangle = false, polygon = false, circle = false } = {} } = utils_1.getUiOptions(that.props.uiSchema);
|
|
227
|
+
const _a = map ? map.getOptions() : { mapOptions: {} }, { rootElem, customControls, zoom, center } = _a, mapOptions = __rest(_a, ["rootElem", "customControls", "zoom", "center"]);
|
|
228
|
+
const { mapOptions: { marker = true, polyline = false, rectangle = false, polygon = false, circle = false } = {} } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
215
229
|
const modalMap = Object.assign(Object.assign({}, mapOptions), { data, draw: Object.assign(Object.assign({}, draw), { marker,
|
|
216
230
|
polyline,
|
|
217
231
|
rectangle,
|
|
@@ -231,7 +245,7 @@ class LocationButton extends React.Component {
|
|
|
231
245
|
this.getFeatureStyle = () => ({ color: "#75CEFA" });
|
|
232
246
|
this.onChange = (events) => {
|
|
233
247
|
const { that } = this.props;
|
|
234
|
-
const { maxShapes = 1 } = utils_1.getUiOptions(that.props.uiSchema);
|
|
248
|
+
const { maxShapes = 1 } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
235
249
|
const _that = this;
|
|
236
250
|
function close() {
|
|
237
251
|
_that.triggerLayer && _that.triggerLayer.disable();
|
|
@@ -240,7 +254,7 @@ class LocationButton extends React.Component {
|
|
|
240
254
|
const geometryField = this.getGeometryField();
|
|
241
255
|
for (let event of events) {
|
|
242
256
|
const { type } = event;
|
|
243
|
-
const geometryRef = utils_1.parseJSONPointer(that.props.formData, geometryField);
|
|
257
|
+
const geometryRef = (0, utils_1.parseJSONPointer)(that.props.formData, geometryField);
|
|
244
258
|
switch (type) {
|
|
245
259
|
case "create": {
|
|
246
260
|
if (geometryRef && geometryRef.type && (maxShapes > 1 || maxShapes === -1)) {
|
|
@@ -253,10 +267,10 @@ class LocationButton extends React.Component {
|
|
|
253
267
|
: geometryRef && geometryRef.type
|
|
254
268
|
? [geometryRef]
|
|
255
269
|
: [];
|
|
256
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, { type: "GeometryCollection", geometries: [...geometries, event.feature.geometry] }, geometryField));
|
|
270
|
+
that.props.onChange((0, utils_1.updateFormDataWithJSONPointer)(that.props, { type: "GeometryCollection", geometries: [...geometries, event.feature.geometry] }, geometryField));
|
|
257
271
|
}
|
|
258
272
|
else {
|
|
259
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, event.feature.geometry, geometryField));
|
|
273
|
+
that.props.onChange((0, utils_1.updateFormDataWithJSONPointer)(that.props, event.feature.geometry, geometryField));
|
|
260
274
|
}
|
|
261
275
|
// TODO LajiMap doesn't send a sequence of events containing multiple events if
|
|
262
276
|
// it sends a create event, but this isn't necessarily true in the future and
|
|
@@ -268,7 +282,7 @@ class LocationButton extends React.Component {
|
|
|
268
282
|
if (!geometryRef || !geometryRef.type) {
|
|
269
283
|
break;
|
|
270
284
|
}
|
|
271
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, undefined, geometryField));
|
|
285
|
+
that.props.onChange((0, utils_1.updateFormDataWithJSONPointer)(that.props, undefined, geometryField));
|
|
272
286
|
break;
|
|
273
287
|
}
|
|
274
288
|
case "edit": {
|
|
@@ -280,11 +294,11 @@ class LocationButton extends React.Component {
|
|
|
280
294
|
const feature = event.features[idx];
|
|
281
295
|
geometry = Object.assign(Object.assign({}, geometry), { geometries: Object.assign(Object.assign({}, geometry.geometries), { [idx]: feature.geometry }) });
|
|
282
296
|
return geometry;
|
|
283
|
-
}, utils_1.parseJSONPointer(that.props.formData, geometryField));
|
|
284
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, geometry, geometryField));
|
|
297
|
+
}, (0, utils_1.parseJSONPointer)(that.props.formData, geometryField));
|
|
298
|
+
that.props.onChange((0, utils_1.updateFormDataWithJSONPointer)(that.props, geometry, geometryField));
|
|
285
299
|
}
|
|
286
300
|
else if (geometryRef.type) {
|
|
287
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, event.features[0].geometry, geometryField));
|
|
301
|
+
that.props.onChange((0, utils_1.updateFormDataWithJSONPointer)(that.props, event.features[0].geometry, geometryField));
|
|
288
302
|
}
|
|
289
303
|
}
|
|
290
304
|
}
|
|
@@ -299,7 +313,7 @@ class LocationButton extends React.Component {
|
|
|
299
313
|
this.onMapMounted = (map) => {
|
|
300
314
|
const { that } = this.props;
|
|
301
315
|
const { disabled, readonly } = that.props;
|
|
302
|
-
const { preselectMarker = true } = utils_1.getUiOptions(that.props.uiSchema);
|
|
316
|
+
const { preselectMarker = true } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
303
317
|
map.resetDrawUndoStack();
|
|
304
318
|
if (!disabled && !readonly && preselectMarker) {
|
|
305
319
|
this.triggerLayer = map.triggerDrawing("marker");
|
|
@@ -307,7 +321,7 @@ class LocationButton extends React.Component {
|
|
|
307
321
|
};
|
|
308
322
|
this.getMiniMapData = () => {
|
|
309
323
|
const { that } = this.props;
|
|
310
|
-
const { strategy = "unit" } = utils_1.getUiOptions(that.props.uiSchema);
|
|
324
|
+
const { strategy = "unit" } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
311
325
|
switch (strategy) {
|
|
312
326
|
case "unit":
|
|
313
327
|
return this.getUnitMiniMapData();
|
|
@@ -319,7 +333,7 @@ class LocationButton extends React.Component {
|
|
|
319
333
|
};
|
|
320
334
|
this.getUnitMiniMapData = () => {
|
|
321
335
|
const { that } = this.props;
|
|
322
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
336
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
323
337
|
const { map } = mapContext;
|
|
324
338
|
const geometry = this.getGeometry();
|
|
325
339
|
const data = [
|
|
@@ -337,7 +351,7 @@ class LocationButton extends React.Component {
|
|
|
337
351
|
};
|
|
338
352
|
this.getLolifeMiniMapData = () => {
|
|
339
353
|
const { that } = this.props;
|
|
340
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
354
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
341
355
|
const { map } = mapContext;
|
|
342
356
|
const draw = map.getDraw();
|
|
343
357
|
return [
|
|
@@ -352,9 +366,9 @@ class LocationButton extends React.Component {
|
|
|
352
366
|
};
|
|
353
367
|
this.getLolifeUnitMiniMapData = () => {
|
|
354
368
|
const { that } = this.props;
|
|
355
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
369
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
356
370
|
const { map } = mapContext;
|
|
357
|
-
const id = utils_1.getUUID(that.props.formData);
|
|
371
|
+
const id = (0, utils_1.getUUID)(that.props.formData);
|
|
358
372
|
return [
|
|
359
373
|
[
|
|
360
374
|
...map.data.map((item) => (Object.assign(Object.assign({}, item), { getPopup: undefined, on: undefined, editable: false, getFeatureStyle: item.getFeatureStyle
|
|
@@ -369,22 +383,22 @@ class LocationButton extends React.Component {
|
|
|
369
383
|
};
|
|
370
384
|
this.getFeatureStyleWithLowerOpacity = getFeatureStyle => (...params) => {
|
|
371
385
|
const style = getFeatureStyle(...params);
|
|
372
|
-
return MapArrayField_1.getFeatureStyleWithLowerOpacity(style);
|
|
386
|
+
return (0, MapArrayField_1.getFeatureStyleWithLowerOpacity)(style);
|
|
373
387
|
};
|
|
374
388
|
this.getFeatureStyleWithHighlight = getFeatureStyle => (...params) => {
|
|
375
389
|
const style = getFeatureStyle(...params);
|
|
376
|
-
return MapArrayField_1.getFeatureStyleWithHighlight(style);
|
|
390
|
+
return (0, MapArrayField_1.getFeatureStyleWithHighlight)(style);
|
|
377
391
|
};
|
|
378
392
|
this.onEntered = () => {
|
|
379
393
|
const { that } = this.props;
|
|
380
|
-
const mapContext = Context_1.default(`${that.props.formContext.contextId}_MAP`);
|
|
394
|
+
const mapContext = (0, Context_1.default)(`${that.props.formContext.contextId}_MAP`);
|
|
381
395
|
if (!mapContext) {
|
|
382
396
|
return;
|
|
383
397
|
}
|
|
384
398
|
const { map } = mapContext;
|
|
385
399
|
let mapOptions = {};
|
|
386
400
|
if (map) {
|
|
387
|
-
const _a = map.getOptions(), { rootElem, zoom, center } = _a, _mapOptions = __rest(_a, ["rootElem", "zoom", "center"]);
|
|
401
|
+
const _a = map.getOptions(), { rootElem, zoom, center } = _a, _mapOptions = __rest(_a, ["rootElem", "zoom", "center"]);
|
|
388
402
|
mapOptions = _mapOptions;
|
|
389
403
|
}
|
|
390
404
|
const [data, zoomToData] = this.getMiniMapData();
|
|
@@ -410,14 +424,14 @@ class LocationButton extends React.Component {
|
|
|
410
424
|
this.setButtonRef = (elem) => {
|
|
411
425
|
this.buttonRef = elem;
|
|
412
426
|
};
|
|
413
|
-
this.getButtonElem = () => react_dom_1.findDOMNode(this.buttonRef);
|
|
427
|
+
this.getButtonElem = () => (0, react_dom_1.findDOMNode)(this.buttonRef);
|
|
414
428
|
this.renderButton = () => {
|
|
415
429
|
const { that, glyph = "map-marker", label } = this.props;
|
|
416
430
|
const id = that.props.idSchema.$id;
|
|
417
|
-
const { color } = utils_1.getUiOptions(that.props.uiSchema);
|
|
431
|
+
const { color } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
418
432
|
const hasCoordinates = this.hasCoordinates();
|
|
419
433
|
const geometryField = this.getGeometryField();
|
|
420
|
-
const hasErrors = utils_1.parseJSONPointer(utils_1.filteredErrors(that.props.errorSchema), geometryField);
|
|
434
|
+
const hasErrors = (0, utils_1.parseJSONPointer)((0, utils_1.filteredErrors)(that.props.errorSchema), geometryField);
|
|
421
435
|
const variant = hasErrors
|
|
422
436
|
? "danger"
|
|
423
437
|
: undefined;
|
|
@@ -427,8 +441,8 @@ class LocationButton extends React.Component {
|
|
|
427
441
|
return (React.createElement(React.Fragment, null,
|
|
428
442
|
button,
|
|
429
443
|
React.createElement(Overlay, { show: true, container: this, target: this.getButtonElem, placement: "left" },
|
|
430
|
-
React.createElement(Tooltip, { id: `laji-form-error-container-${id}_${utils_1.JSONPointerToId(geometryField)}`, className: "location-chooser-errors" },
|
|
431
|
-
React.createElement("ul", null, hasErrors.__errors.map((e, i) => React.createElement("li", { key: i }, utils_1.formatErrorMessage(e))))))));
|
|
444
|
+
React.createElement(Tooltip, { id: `laji-form-error-container-${id}_${(0, utils_1.JSONPointerToId)(geometryField)}`, className: "location-chooser-errors" },
|
|
445
|
+
React.createElement("ul", null, hasErrors.__errors.map((e, i) => React.createElement("li", { key: i }, (0, utils_1.formatErrorMessage)(e))))))));
|
|
432
446
|
}
|
|
433
447
|
else {
|
|
434
448
|
const { translations } = that.props.formContext;
|
|
@@ -445,7 +459,7 @@ class LocationButton extends React.Component {
|
|
|
445
459
|
render() {
|
|
446
460
|
const { that } = this.props;
|
|
447
461
|
const { shapeAlert } = this.state;
|
|
448
|
-
const { taxonField, title } = utils_1.getUiOptions(that.props.uiSchema);
|
|
462
|
+
const { taxonField, title } = (0, utils_1.getUiOptions)(that.props.uiSchema);
|
|
449
463
|
const { translations } = that.props.formContext;
|
|
450
464
|
const { Modal, Alert } = this.context.theme;
|
|
451
465
|
return (React.createElement(React.Fragment, null,
|