@luomus/laji-form 15.1.64 → 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/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 +25 -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)
|
|
@@ -49,13 +63,14 @@ const functionPropType = PropTypes.shape({
|
|
|
49
63
|
"ui:options": PropTypes.object
|
|
50
64
|
});
|
|
51
65
|
let UiFieldMapperArrayField = class UiFieldMapperArrayField extends React.Component {
|
|
66
|
+
static getName() { return "UiFieldMapperArrayField"; }
|
|
52
67
|
constructor(props) {
|
|
53
68
|
super(props);
|
|
54
69
|
this.updateChildProps = (props) => {
|
|
55
70
|
(props.formData || []).forEach((item, idx) => {
|
|
56
71
|
const currentFieldProps = this.childProps[idx];
|
|
57
72
|
const nextFieldProps = this.getFieldPropsForIdx(props, idx);
|
|
58
|
-
if (!utils_1.deepEquals([currentFieldProps, nextFieldProps])) {
|
|
73
|
+
if (!(0, utils_1.deepEquals)([currentFieldProps, nextFieldProps])) {
|
|
59
74
|
this.functionOutputProps[idx] = this.applyFunctionsToChildProps(props, nextFieldProps);
|
|
60
75
|
this.childProps[idx] = nextFieldProps;
|
|
61
76
|
}
|
|
@@ -67,7 +82,7 @@ let UiFieldMapperArrayField = class UiFieldMapperArrayField extends React.Compon
|
|
|
67
82
|
} });
|
|
68
83
|
};
|
|
69
84
|
this.applyFunctionsToChildProps = (props, childProps) => {
|
|
70
|
-
let { functions } = utils_2.getUiOptions(props.uiSchema);
|
|
85
|
+
let { functions } = (0, utils_2.getUiOptions)(props.uiSchema);
|
|
71
86
|
return ((Array.isArray(functions)) ? functions : [functions]).reduce((_props, { "ui:field": uiField, "ui:options": uiOptions }) => {
|
|
72
87
|
const _a = _props.uiSchema || {}, { "ui:functions": uiFunctions, uiSchema, "ui:field": origUiField, "ui:options": origUiOptions, "ui:settings": origUiSettings } = _a, _propsUiSchema = __rest(_a, ["ui:functions", "uiSchema", "ui:field", "ui:options", "ui:settings"]);
|
|
73
88
|
_props = Object.assign(Object.assign({}, _props), { uiSchema: Object.assign(Object.assign({}, _propsUiSchema), { "ui:field": uiField, "ui:options": uiOptions }) });
|
|
@@ -80,7 +95,7 @@ let UiFieldMapperArrayField = class UiFieldMapperArrayField extends React.Compon
|
|
|
80
95
|
};
|
|
81
96
|
this.onChange = (formData) => {
|
|
82
97
|
this.props.onChange(formData.map((item, idx) => {
|
|
83
|
-
if (!utils_1.deepEquals(item, (this.props.formData || [])[idx])) {
|
|
98
|
+
if (!(0, utils_1.deepEquals)(item, (this.props.formData || [])[idx])) {
|
|
84
99
|
const output = this.functionOutputProps[idx] || this.getFunctionOutputForIdx(this.props, idx);
|
|
85
100
|
output.onChange(item); // Will trigger child instance onChange, which will set this.tmpItemFormData.
|
|
86
101
|
return this.tmpItemFormData;
|
|
@@ -92,7 +107,6 @@ let UiFieldMapperArrayField = class UiFieldMapperArrayField extends React.Compon
|
|
|
92
107
|
this.functionOutputProps = [];
|
|
93
108
|
this.updateChildProps(props);
|
|
94
109
|
}
|
|
95
|
-
static getName() { return "UiFieldMapperArrayField"; }
|
|
96
110
|
UNSAFE_componentWillReceiveProps(props) {
|
|
97
111
|
this.updateChildProps(props);
|
|
98
112
|
this.setState(this.getStateFromProps(props));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default class UnitCountShorthandField 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
|
shorthandField: PropTypes.Validator<string>;
|
|
6
6
|
pairCountField: PropTypes.Validator<string>;
|
|
7
7
|
taxonIDField: PropTypes.Validator<string>;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
8
|
+
}>>>;
|
|
9
|
+
}>>>;
|
|
10
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
11
11
|
type: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
12
|
+
}>>>;
|
|
13
13
|
formData: PropTypes.Validator<object>;
|
|
14
14
|
};
|
|
15
15
|
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
|
};
|
|
@@ -44,26 +58,26 @@ let UnitCountShorthandField = class UnitCountShorthandField extends React.Compon
|
|
|
44
58
|
static getName() { return "UnitCountShorthandField"; }
|
|
45
59
|
getStateFromProps(props) {
|
|
46
60
|
const { uiSchema, formData } = props;
|
|
47
|
-
const { shorthandField, taxonIDField } = utils_1.getUiOptions(props.uiSchema);
|
|
48
|
-
const shortHandUiSchema = deepmerge_1.default(utils_1.parseJSONPointer(props.uiSchema, shorthandField) || {}, {
|
|
61
|
+
const { shorthandField, taxonIDField } = (0, utils_1.getUiOptions)(props.uiSchema);
|
|
62
|
+
const shortHandUiSchema = (0, deepmerge_1.default)((0, utils_1.parseJSONPointer)(props.uiSchema, shorthandField) || {}, {
|
|
49
63
|
"ui:widget": CodeReader,
|
|
50
64
|
"ui:options": {
|
|
51
65
|
parseCode: this.parseCode,
|
|
52
|
-
taxonID: utils_1.parseJSONPointer(formData, taxonIDField)
|
|
66
|
+
taxonID: (0, utils_1.parseJSONPointer)(formData, taxonIDField)
|
|
53
67
|
}
|
|
54
68
|
});
|
|
55
|
-
const _uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, shortHandUiSchema, shorthandField);
|
|
69
|
+
const _uiSchema = (0, utils_1.updateSafelyWithJSONPointer)(uiSchema, shortHandUiSchema, shorthandField);
|
|
56
70
|
return Object.assign(Object.assign({}, props), { uiSchema: _uiSchema });
|
|
57
71
|
}
|
|
58
72
|
parseCode(value, taxonId) {
|
|
59
73
|
const { apiClient } = this.props.formContext;
|
|
60
74
|
let formData = this.props.formData;
|
|
61
|
-
const { shorthandField, pairCountField } = utils_1.getUiOptions(this.props.uiSchema);
|
|
75
|
+
const { shorthandField, pairCountField } = (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
62
76
|
let timestamp = Date.now();
|
|
63
77
|
this.promiseTimestamp = timestamp;
|
|
64
78
|
return new Promise((resolve, reject) => {
|
|
65
79
|
if (!value || !taxonId) {
|
|
66
|
-
formData = utils_1.updateSafelyWithJSONPointer(formData, undefined, pairCountField);
|
|
80
|
+
formData = (0, utils_1.updateSafelyWithJSONPointer)(formData, undefined, pairCountField);
|
|
67
81
|
this.props.onChange(formData);
|
|
68
82
|
resolve({ success: undefined });
|
|
69
83
|
return;
|
|
@@ -73,8 +87,8 @@ let UnitCountShorthandField = class UnitCountShorthandField extends React.Compon
|
|
|
73
87
|
reject();
|
|
74
88
|
return;
|
|
75
89
|
}
|
|
76
|
-
formData = utils_1.updateSafelyWithJSONPointer(formData, suggestion.key, shorthandField);
|
|
77
|
-
formData = utils_1.updateSafelyWithJSONPointer(formData, suggestion.value, pairCountField);
|
|
90
|
+
formData = (0, utils_1.updateSafelyWithJSONPointer)(formData, suggestion.key, shorthandField);
|
|
91
|
+
formData = (0, utils_1.updateSafelyWithJSONPointer)(formData, suggestion.value, pairCountField);
|
|
78
92
|
this.props.onChange(formData);
|
|
79
93
|
resolve({ success: suggestion.key ? true : undefined, value: suggestion.key });
|
|
80
94
|
}).catch(() => {
|
|
@@ -82,7 +96,7 @@ let UnitCountShorthandField = class UnitCountShorthandField extends React.Compon
|
|
|
82
96
|
reject();
|
|
83
97
|
return;
|
|
84
98
|
}
|
|
85
|
-
formData = utils_1.updateSafelyWithJSONPointer(formData, undefined, pairCountField);
|
|
99
|
+
formData = (0, utils_1.updateSafelyWithJSONPointer)(formData, undefined, pairCountField);
|
|
86
100
|
this.props.onChange(formData);
|
|
87
101
|
resolve({ success: false, value: value });
|
|
88
102
|
});
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
export default class UnitListShorthandArrayField extends React.Component<any, any, any> {
|
|
5
5
|
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
6
6
|
static propTypes: {
|
|
7
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
7
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
8
8
|
type: PropTypes.Requireable<string>;
|
|
9
|
-
}
|
|
9
|
+
}>>>;
|
|
10
10
|
formData: PropTypes.Validator<any[]>;
|
|
11
11
|
};
|
|
12
12
|
constructor(props: any);
|
|
@@ -35,7 +35,7 @@ export default class UnitListShorthandArrayField extends React.Component<any, an
|
|
|
35
35
|
"ui:placeholder"?: string | undefined;
|
|
36
36
|
"ui:help"?: string | undefined;
|
|
37
37
|
"ui:autofocus"?: boolean | undefined;
|
|
38
|
-
"ui:autocomplete"?:
|
|
38
|
+
"ui:autocomplete"?: AutoFill | undefined;
|
|
39
39
|
"ui:disabled"?: boolean | undefined;
|
|
40
40
|
"ui:emptyValue"?: any;
|
|
41
41
|
"ui:enumDisabled"?: (string | number | boolean)[] | undefined;
|
|
@@ -52,9 +52,9 @@ export default class UnitListShorthandArrayField extends React.Component<any, an
|
|
|
52
52
|
"ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
|
|
53
53
|
"ui:widget"?: string | import("@rjsf/utils").Widget<any, any, import("../LajiForm").FormContext> | undefined;
|
|
54
54
|
"ui:duplicateKeySuffixSeparator"?: string | undefined;
|
|
55
|
-
"ui:rootFieldId"?: string
|
|
55
|
+
"ui:rootFieldId"?: string;
|
|
56
56
|
"ui:field"?: string | import("@rjsf/utils").Field<any, any, import("../LajiForm").FormContext> | undefined;
|
|
57
|
-
"ui:fieldReplacesAnyOrOneOf"?: boolean
|
|
57
|
+
"ui:fieldReplacesAnyOrOneOf"?: boolean;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
onButtonClick: () => () => void;
|
|
@@ -64,6 +64,7 @@ export default class UnitListShorthandArrayField extends React.Component<any, an
|
|
|
64
64
|
onKeyDown: (e: any) => void;
|
|
65
65
|
setTagArrayRef: (ref: any) => void;
|
|
66
66
|
tagRef: any;
|
|
67
|
+
render(): JSX.Element;
|
|
67
68
|
}
|
|
68
69
|
import * as React from "react";
|
|
69
70
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
@@ -51,20 +65,20 @@ let UnitListShorthandArrayField = class UnitListShorthandArrayField extends Reac
|
|
|
51
65
|
this.setState({ value: tags.join(",") });
|
|
52
66
|
};
|
|
53
67
|
this.onSubmit = () => {
|
|
54
|
-
const value = this.state.value + (utils_1.isEmptyString(this.tagRef.state.value) ? "" : `,${this.tagRef.state.value}`);
|
|
68
|
+
const value = this.state.value + ((0, utils_1.isEmptyString)(this.tagRef.state.value) ? "" : `,${this.tagRef.state.value}`);
|
|
55
69
|
this.onHide();
|
|
56
70
|
const { translations, notifier, apiClient } = this.props.formContext;
|
|
57
71
|
this.props.formContext.services.blocker.push();
|
|
58
72
|
apiClient.fetch("/autocomplete/unit", { q: value, list: true, includePayload: true }).then(({ payload: { units, nonMatchingCount } }) => {
|
|
59
73
|
units = units.map(unit => {
|
|
60
|
-
unit = utils_1.getDefaultFormState(this.props.schema.items, unit);
|
|
61
|
-
unit = utils_1.bringRemoteFormData(unit, this.props.formContext);
|
|
62
|
-
unit = utils_1.assignUUID(unit);
|
|
74
|
+
unit = (0, utils_1.getDefaultFormState)(this.props.schema.items, unit);
|
|
75
|
+
unit = (0, utils_1.bringRemoteFormData)(unit, this.props.formContext);
|
|
76
|
+
unit = (0, utils_1.assignUUID)(unit);
|
|
63
77
|
return unit;
|
|
64
78
|
});
|
|
65
79
|
const formData = this.props.formData;
|
|
66
80
|
const last = formData[formData.length - 1];
|
|
67
|
-
if (last && utils_1.isDefaultData(last, this.props.schema.items)) {
|
|
81
|
+
if (last && (0, utils_1.isDefaultData)(last, this.props.schema.items)) {
|
|
68
82
|
formData.pop();
|
|
69
83
|
}
|
|
70
84
|
this.props.onChange([...formData, ...units]);
|
|
@@ -95,8 +109,8 @@ let UnitListShorthandArrayField = class UnitListShorthandArrayField extends Reac
|
|
|
95
109
|
canAdd: true
|
|
96
110
|
}
|
|
97
111
|
};
|
|
98
|
-
const innerUiSchema = utils_1.getInnerUiSchema(props.uiSchema);
|
|
99
|
-
const options = utils_1.getUiOptions(innerUiSchema);
|
|
112
|
+
const innerUiSchema = (0, utils_1.getInnerUiSchema)(props.uiSchema);
|
|
113
|
+
const options = (0, utils_1.getUiOptions)(innerUiSchema);
|
|
100
114
|
const uiSchema = Object.assign(Object.assign({}, innerUiSchema), { "ui:options": Object.assign(Object.assign({}, options), { buttons: [
|
|
101
115
|
...(options.buttons || []),
|
|
102
116
|
buttonDefinition
|
|
@@ -110,11 +124,11 @@ let UnitListShorthandArrayField = class UnitListShorthandArrayField extends Reac
|
|
|
110
124
|
React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: this.state.uiSchema })),
|
|
111
125
|
this.state.show && (React.createElement(Modal, { show: true, onHide: this.onHide, dialogClassName: "unit-list-shorthand-modal" },
|
|
112
126
|
React.createElement(Modal.Body, null,
|
|
113
|
-
React.createElement(TagArrayField_1.TagInputComponent, { tags: utils_1.isEmptyString(this.state.value) ? [] : this.state.value.split(",").filter(s => !utils_1.isEmptyString(s)), onChange: this.onTagFieldChange, schema: {}, idSchema: {}, uiSchema: { "ui:options": { separatorKeys: [","] } }, inputProps: { autoFocus: true }, onKeyDown: this.onKeyDown, ref: this.setTagArrayRef, formContext: this.props.formContext }),
|
|
127
|
+
React.createElement(TagArrayField_1.TagInputComponent, { tags: (0, utils_1.isEmptyString)(this.state.value) ? [] : this.state.value.split(",").filter(s => !(0, utils_1.isEmptyString)(s)), onChange: this.onTagFieldChange, schema: {}, idSchema: {}, uiSchema: { "ui:options": { separatorKeys: [","] } }, inputProps: { autoFocus: true }, onKeyDown: this.onKeyDown, ref: this.setTagArrayRef, formContext: this.props.formContext }),
|
|
114
128
|
React.createElement("span", { className: "text-muted" },
|
|
115
129
|
React.createElement("i", null, this.props.formContext.translations.UnitListShorthandHelp)),
|
|
116
130
|
React.createElement("br", null),
|
|
117
|
-
React.createElement(components_1.Button, { type: "submit", disabled: utils_1.isEmptyString(this.state.value), onClick: this.onSubmit }, this.props.formContext.translations.Add))))));
|
|
131
|
+
React.createElement(components_1.Button, { type: "submit", disabled: (0, utils_1.isEmptyString)(this.state.value), onClick: this.onSubmit }, this.props.formContext.translations.Add))))));
|
|
118
132
|
}
|
|
119
133
|
};
|
|
120
134
|
UnitListShorthandArrayField.contextType = ReactContext_1.default;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
export default class UnitShorthandField extends React.Component<any, any, any> {
|
|
2
2
|
static propTypes: {
|
|
3
3
|
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
4
|
-
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
+
"ui:options": PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
5
5
|
shorthandField: PropTypes.Requireable<string>;
|
|
6
6
|
formID: PropTypes.Requireable<string>;
|
|
7
7
|
showSchema: PropTypes.Requireable<boolean>;
|
|
8
8
|
persistenceKey: PropTypes.Requireable<string>;
|
|
9
|
-
}
|
|
9
|
+
}>>>;
|
|
10
10
|
uiSchema: PropTypes.Requireable<object>;
|
|
11
11
|
}>>;
|
|
12
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
12
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
13
13
|
type: PropTypes.Requireable<string>;
|
|
14
|
-
}
|
|
14
|
+
}>>>;
|
|
15
15
|
formData: PropTypes.Validator<object>;
|
|
16
16
|
};
|
|
17
17
|
constructor(props: any);
|
|
18
|
-
|
|
18
|
+
state: any;
|
|
19
|
+
getStateFromProps: (props: any) => {
|
|
20
|
+
showSchema: any;
|
|
21
|
+
};
|
|
22
|
+
UNSAFE_componentWillReceiveProps: (props: any) => void;
|
|
23
|
+
componentDidUpdate(): void;
|
|
19
24
|
onNextTick: (() => void) | undefined;
|
|
20
25
|
shouldShowSchema: (props: any) => any;
|
|
21
26
|
onToggleButtonClick: () => () => void;
|
|
@@ -27,6 +32,7 @@ export default class UnitShorthandField extends React.Component<any, any, any> {
|
|
|
27
32
|
active: boolean;
|
|
28
33
|
};
|
|
29
34
|
onCodeChange: (formData?: {}) => void;
|
|
35
|
+
render(): JSX.Element;
|
|
30
36
|
}
|
|
31
37
|
import * as React from "react";
|
|
32
38
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
@@ -42,10 +56,10 @@ let UnitShorthandField = class UnitShorthandField extends React.Component {
|
|
|
42
56
|
constructor(props) {
|
|
43
57
|
super(props);
|
|
44
58
|
this.getStateFromProps = (props) => {
|
|
45
|
-
const { persistenceKey } = utils_1.getUiOptions(props.uiSchema);
|
|
59
|
+
const { persistenceKey } = (0, utils_1.getUiOptions)(props.uiSchema);
|
|
46
60
|
let showSchema = undefined;
|
|
47
61
|
if (persistenceKey) {
|
|
48
|
-
const persistingContainer = Context_1.default(`${props.formContext.contextId}_UNIT_SHORTHAND_FIELD_PERSISTENCE_${persistenceKey}`);
|
|
62
|
+
const persistingContainer = (0, Context_1.default)(`${props.formContext.contextId}_UNIT_SHORTHAND_FIELD_PERSISTENCE_${persistenceKey}`);
|
|
49
63
|
if (persistingContainer && "value" in persistingContainer) {
|
|
50
64
|
showSchema = persistingContainer.value;
|
|
51
65
|
}
|
|
@@ -69,10 +83,10 @@ let UnitShorthandField = class UnitShorthandField extends React.Component {
|
|
|
69
83
|
return showSchema;
|
|
70
84
|
};
|
|
71
85
|
this.onToggleButtonClick = () => () => {
|
|
72
|
-
const { persistenceKey } = utils_1.getUiOptions(this.props.uiSchema);
|
|
86
|
+
const { persistenceKey } = (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
73
87
|
this.setState({ showSchema: !this.state.showSchema }, () => {
|
|
74
88
|
this.props.formContext.utils.focusById(this.props.idSchema.$id);
|
|
75
|
-
Context_1.default(`${this.props.formContext.contextId}_UNIT_SHORTHAND_FIELD_PERSISTENCE_${persistenceKey}`).value = this.state.showSchema;
|
|
89
|
+
(0, Context_1.default)(`${this.props.formContext.contextId}_UNIT_SHORTHAND_FIELD_PERSISTENCE_${persistenceKey}`).value = this.state.showSchema;
|
|
76
90
|
});
|
|
77
91
|
};
|
|
78
92
|
this.getToggleButton = () => {
|
|
@@ -85,7 +99,7 @@ let UnitShorthandField = class UnitShorthandField extends React.Component {
|
|
|
85
99
|
};
|
|
86
100
|
};
|
|
87
101
|
this.onCodeChange = (formData = {}) => {
|
|
88
|
-
const { autocopy, autofocus } = utils_1.getUiOptions(this.props.uiSchema);
|
|
102
|
+
const { autocopy, autofocus } = (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
89
103
|
if (!autofocus)
|
|
90
104
|
this.props.formContext.globals.idToFocus = this.props.idSchema.$id;
|
|
91
105
|
this.onNextTick = () => {
|
|
@@ -97,9 +111,9 @@ let UnitShorthandField = class UnitShorthandField extends React.Component {
|
|
|
97
111
|
}
|
|
98
112
|
this.setState({ showSchema: true });
|
|
99
113
|
};
|
|
100
|
-
this.props.onChange(utils_1.getDefaultFormState(this.props.schema, Object.assign(Object.assign({}, this.props.formData), formData)));
|
|
114
|
+
this.props.onChange((0, utils_1.getDefaultFormState)(this.props.schema, Object.assign(Object.assign({}, this.props.formData), formData)));
|
|
101
115
|
};
|
|
102
|
-
this.state = { showSchema: utils_1.getUiOptions(props.uiSchema).showSchema };
|
|
116
|
+
this.state = { showSchema: (0, utils_1.getUiOptions)(props.uiSchema).showSchema };
|
|
103
117
|
this.state = Object.assign(Object.assign({}, this.state), this.getStateFromProps(props));
|
|
104
118
|
}
|
|
105
119
|
componentDidUpdate() {
|
|
@@ -111,23 +125,23 @@ let UnitShorthandField = class UnitShorthandField extends React.Component {
|
|
|
111
125
|
render() {
|
|
112
126
|
const { uiSchema, formContext, disabled, readonly } = this.props;
|
|
113
127
|
const { SchemaField } = this.props.registry.fields;
|
|
114
|
-
const shorthandFieldName = utils_1.getUiOptions(this.props.uiSchema).shorthandField;
|
|
128
|
+
const shorthandFieldName = (0, utils_1.getUiOptions)(this.props.uiSchema).shorthandField;
|
|
115
129
|
const toggleButton = this.getToggleButton();
|
|
116
|
-
const tailUiSchema = utils_1.getNestedTailUiSchema(uiSchema);
|
|
130
|
+
const tailUiSchema = (0, utils_1.getNestedTailUiSchema)(uiSchema);
|
|
117
131
|
let help = tailUiSchema && tailUiSchema[shorthandFieldName] && tailUiSchema[shorthandFieldName]["ui:belowHelp"];
|
|
118
|
-
const uiSchemaWithoutHelp = utils_1.isEmptyString(help) ? uiSchema : utils_1.updateTailUiSchema(uiSchema, { [shorthandFieldName]: { "ui:belowHelp": { $set: undefined } } });
|
|
132
|
+
const uiSchemaWithoutHelp = (0, utils_1.isEmptyString)(help) ? uiSchema : (0, utils_1.updateTailUiSchema)(uiSchema, { [shorthandFieldName]: { "ui:belowHelp": { $set: undefined } } });
|
|
119
133
|
const id = (shorthandFieldName && this.props.idSchema[shorthandFieldName]) ?
|
|
120
134
|
this.props.idSchema[shorthandFieldName].$id :
|
|
121
135
|
`${this.props.idSchema.$id}_shortHandField`;
|
|
122
136
|
let innerUiSchema = undefined;
|
|
123
137
|
if (this.state.showSchema) {
|
|
124
|
-
innerUiSchema = utils_1.getInnerUiSchema(Object.assign({}, uiSchemaWithoutHelp));
|
|
125
|
-
const innerOptions = utils_1.getUiOptions(innerUiSchema);
|
|
138
|
+
innerUiSchema = (0, utils_1.getInnerUiSchema)(Object.assign({}, uiSchemaWithoutHelp));
|
|
139
|
+
const innerOptions = (0, utils_1.getUiOptions)(innerUiSchema);
|
|
126
140
|
innerUiSchema = Object.assign(Object.assign({}, innerUiSchema), { "ui:options": Object.assign(Object.assign({}, innerOptions), { buttons: [...(innerOptions.buttons || []), toggleButton] }) });
|
|
127
141
|
}
|
|
128
142
|
return !this.state.showSchema ? (React.createElement("div", { className: "laji-form-field-template-item", id: `_laji-form_${id}` },
|
|
129
|
-
React.createElement(CodeReader, { translations: this.props.formContext.translations, onChange: this.onCodeChange, value: this.props.formData[shorthandFieldName], formID: utils_1.getUiOptions(this.props.uiSchema).formID || formContext.formID || formContext.uiSchemaContext.formID, help: help, id: id, formContext: formContext, disabled: disabled, readonly: readonly, className: "laji-form-field-template-schema" }),
|
|
130
|
-
React.createElement("div", { className: "laji-form-field-template-buttons" }, ArrayFieldTemplate_1.getButton(toggleButton)))) : (React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: innerUiSchema })));
|
|
143
|
+
React.createElement(CodeReader, { translations: this.props.formContext.translations, onChange: this.onCodeChange, value: this.props.formData[shorthandFieldName], formID: (0, utils_1.getUiOptions)(this.props.uiSchema).formID || formContext.formID || formContext.uiSchemaContext.formID, help: help, id: id, formContext: formContext, disabled: disabled, readonly: readonly, className: "laji-form-field-template-schema" }),
|
|
144
|
+
React.createElement("div", { className: "laji-form-field-template-buttons" }, (0, ArrayFieldTemplate_1.getButton)(toggleButton)))) : (React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: innerUiSchema })));
|
|
131
145
|
}
|
|
132
146
|
};
|
|
133
147
|
UnitShorthandField.propTypes = {
|
|
@@ -154,7 +168,7 @@ let CodeReader = class CodeReader extends React.Component {
|
|
|
154
168
|
super(props);
|
|
155
169
|
this.getStateFromProps = (props) => {
|
|
156
170
|
let state = this.state;
|
|
157
|
-
if (this.state.value === "" && !utils_1.isEmptyString(props.value)) {
|
|
171
|
+
if (this.state.value === "" && !(0, utils_1.isEmptyString)(props.value)) {
|
|
158
172
|
state.value = props.value;
|
|
159
173
|
}
|
|
160
174
|
return state;
|
|
@@ -173,7 +187,7 @@ let CodeReader = class CodeReader extends React.Component {
|
|
|
173
187
|
};
|
|
174
188
|
this.onSuggestionSelected = ({ payload: { unit } }) => {
|
|
175
189
|
const { formContext } = this.props;
|
|
176
|
-
unit = utils_1.bringRemoteFormData(unit, formContext);
|
|
190
|
+
unit = (0, utils_1.bringRemoteFormData)(unit, formContext);
|
|
177
191
|
this.props.onChange(unit);
|
|
178
192
|
};
|
|
179
193
|
this.renderSuggestion = (suggestion) => {
|
|
@@ -190,10 +204,10 @@ let CodeReader = class CodeReader extends React.Component {
|
|
|
190
204
|
};
|
|
191
205
|
this.getCode = () => {
|
|
192
206
|
const { value } = this.state;
|
|
193
|
-
if (!utils_1.isEmptyString(this.props.value) && utils_1.isEmptyString(value) && (!this.value || this.value.length < 3)) {
|
|
207
|
+
if (!(0, utils_1.isEmptyString)(this.props.value) && (0, utils_1.isEmptyString)(value) && (!this.value || this.value.length < 3)) {
|
|
194
208
|
this.mounted && this.setState({ loading: true });
|
|
195
209
|
this.mounted && this.setState({ failed: false, loading: false }, () => {
|
|
196
|
-
utils_1.isEmptyString(this.value) && this.props.onChange(undefined);
|
|
210
|
+
(0, utils_1.isEmptyString)(this.value) && this.props.onChange(undefined);
|
|
197
211
|
});
|
|
198
212
|
}
|
|
199
213
|
else if (value.length >= 3) {
|
|
@@ -220,7 +234,7 @@ let CodeReader = class CodeReader extends React.Component {
|
|
|
220
234
|
let validationState = null;
|
|
221
235
|
if (this.state.failed === true)
|
|
222
236
|
validationState = "warning";
|
|
223
|
-
else if (!utils_1.isEmptyString(this.props.value) && this.props.value === this.state.value)
|
|
237
|
+
else if (!(0, utils_1.isEmptyString)(this.props.value) && this.props.value === this.state.value)
|
|
224
238
|
validationState = "success";
|
|
225
239
|
const { formID, formContext } = this.props;
|
|
226
240
|
const inputElem = LINE_TRANSECT_IDS.includes(formID) ? (React.createElement(components_1.FetcherInput, { id: this.props.id, loading: this.state.loading, value: this.state.value, validationState: validationState, onChange: this.onFetcherInputChange, onBlur: this.getCode, onKeyDown: this.onKeyDown, readonly: readonly, disabled: disabled })) : (React.createElement("div", { className: "unit-shorthand" },
|
|
@@ -36,9 +36,10 @@ export class ArrayFieldTemplateWithoutKeyHandling extends React.Component<any, a
|
|
|
36
36
|
}) => void;
|
|
37
37
|
onFocuses: any[];
|
|
38
38
|
getOnFocus: (i: any) => () => void;
|
|
39
|
+
render(): JSX.Element;
|
|
39
40
|
deleteButtonRefs: any[] | undefined;
|
|
40
41
|
}
|
|
41
|
-
declare
|
|
42
|
+
declare const _default: {
|
|
42
43
|
new (): {
|
|
43
44
|
[x: string]: any;
|
|
44
45
|
componentDidMount(): void;
|