@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
package/lib/utils.js
CHANGED
|
@@ -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];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
36
|
var t = {};
|
|
23
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -33,8 +47,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
48
|
};
|
|
35
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
50
|
+
exports.classNames = exports.getFieldUUID = exports.getUUID = exports.assignUUID = exports.idSchemaIdToJSONPointer = exports.JSONPointerToId = exports.formatErrorMessage = exports.keyboardClick = exports.formDataEquals = exports.formDataIsEmpty = exports.filterItemIdsDeeply = exports.filterItemId = exports.filterLajiFormId = exports.syncScroll = exports._syncScroll = exports.shouldSyncScroll = exports.focusAndScroll = exports.focusById = exports.getSchemaElementById = exports.findNearestParentSchemaElemId = exports.focusNextInput = exports.getNextInput = exports.getNextInputInInputs = exports.ReactUtils = exports.isObject = void 0;
|
|
51
|
+
exports.isHidden = isHidden;
|
|
52
|
+
exports.isDefaultData = isDefaultData;
|
|
53
|
+
exports.getDefaultFormState = getDefaultFormState;
|
|
54
|
+
exports.hasData = hasData;
|
|
55
|
+
exports.propertyHasData = propertyHasData;
|
|
56
|
+
exports.getUpdateObjectFromJSONPath = getUpdateObjectFromJSONPath;
|
|
57
|
+
exports.getUpdateObjectFromJSONPointer = getUpdateObjectFromJSONPointer;
|
|
58
|
+
exports.immutableDelete = immutableDelete;
|
|
59
|
+
exports.getUiOptions = getUiOptions;
|
|
60
|
+
exports.getInnerUiSchema = getInnerUiSchema;
|
|
61
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
62
|
+
exports.isEmptyString = isEmptyString;
|
|
63
|
+
exports.parseJSONPointer = parseJSONPointer;
|
|
64
|
+
exports.getReactComponentName = getReactComponentName;
|
|
65
|
+
exports.isMultiSelect = isMultiSelect;
|
|
66
|
+
exports.isSelect = isSelect;
|
|
67
|
+
exports.getTabbableFields = getTabbableFields;
|
|
68
|
+
exports.isTabbableInput = isTabbableInput;
|
|
69
|
+
exports.canFocusNextInput = canFocusNextInput;
|
|
70
|
+
exports.findNearestParentSchemaElem = findNearestParentSchemaElem;
|
|
71
|
+
exports.findNearestParentTabbableElem = findNearestParentTabbableElem;
|
|
72
|
+
exports.getNestedTailUiSchema = getNestedTailUiSchema;
|
|
73
|
+
exports.updateTailUiSchema = updateTailUiSchema;
|
|
74
|
+
exports.getNestedUiFieldsList = getNestedUiFieldsList;
|
|
75
|
+
exports.getBootstrapCols = getBootstrapCols;
|
|
76
|
+
exports.isDescendant = isDescendant;
|
|
77
|
+
exports.getKeyHandlerTargetId = getKeyHandlerTargetId;
|
|
78
|
+
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
79
|
+
exports.decapitalizeFirstLetter = decapitalizeFirstLetter;
|
|
80
|
+
exports.stringifyKeyCombo = stringifyKeyCombo;
|
|
81
|
+
exports.canAdd = canAdd;
|
|
82
|
+
exports.bsSizeToPixels = bsSizeToPixels;
|
|
83
|
+
exports.pixelsToBsSize = pixelsToBsSize;
|
|
84
|
+
exports.applyFunction = applyFunction;
|
|
85
|
+
exports.getWindowScrolled = getWindowScrolled;
|
|
86
|
+
exports.getScrollPositionForScrollIntoViewIfNeeded = getScrollPositionForScrollIntoViewIfNeeded;
|
|
87
|
+
exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
|
|
88
|
+
exports.filter = filter;
|
|
89
|
+
exports.updateSafelyWithJSONPath = updateSafelyWithJSONPath;
|
|
90
|
+
exports.updateSafelyWithJSONPointer = updateSafelyWithJSONPointer;
|
|
91
|
+
exports.injectButtons = injectButtons;
|
|
92
|
+
exports.dictionarify = dictionarify;
|
|
93
|
+
exports.formatValue = formatValue;
|
|
94
|
+
exports.checkRules = checkRules;
|
|
95
|
+
exports.checkArrayRules = checkArrayRules;
|
|
96
|
+
exports.bringRemoteFormData = bringRemoteFormData;
|
|
97
|
+
exports.triggerParentComponent = triggerParentComponent;
|
|
98
|
+
exports.parseSchemaFromFormDataPointer = parseSchemaFromFormDataPointer;
|
|
99
|
+
exports.parseUiSchemaFromFormDataPointer = parseUiSchemaFromFormDataPointer;
|
|
100
|
+
exports.checkJSONPointer = checkJSONPointer;
|
|
101
|
+
exports.schemaJSONPointer = schemaJSONPointer;
|
|
102
|
+
exports.uiSchemaJSONPointer = uiSchemaJSONPointer;
|
|
103
|
+
exports.updateFormDataWithJSONPointer = updateFormDataWithJSONPointer;
|
|
104
|
+
exports.addLajiFormIds = addLajiFormIds;
|
|
105
|
+
exports.getAllLajiFormIdsDeeply = getAllLajiFormIdsDeeply;
|
|
106
|
+
exports.removeLajiFormIds = removeLajiFormIds;
|
|
107
|
+
exports.findPointerForLajiFormId = findPointerForLajiFormId;
|
|
108
|
+
exports.highlightElem = highlightElem;
|
|
109
|
+
exports.filteredErrors = filteredErrors;
|
|
110
|
+
exports.constructTranslations = constructTranslations;
|
|
111
|
+
exports.getIdxWithOffset = getIdxWithOffset;
|
|
112
|
+
exports.getIdxWithoutOffset = getIdxWithoutOffset;
|
|
113
|
+
exports.getFormDataIndex = getFormDataIndex;
|
|
114
|
+
exports.getReversedFormDataIndex = getReversedFormDataIndex;
|
|
115
|
+
exports.toJSONPointer = toJSONPointer;
|
|
116
|
+
exports.getTitle = getTitle;
|
|
117
|
+
exports.translate = translate;
|
|
118
|
+
exports.useBooleanSetter = useBooleanSetter;
|
|
119
|
+
exports.usePrevious = usePrevious;
|
|
120
|
+
exports.asArray = asArray;
|
|
121
|
+
exports.getLajiUri = getLajiUri;
|
|
38
122
|
const React = __importStar(require("react"));
|
|
39
123
|
const react_dom_1 = require("react-dom");
|
|
40
124
|
const utils_1 = require("@rjsf/utils");
|
|
@@ -52,7 +136,6 @@ function isHidden(uiSchema, property) {
|
|
|
52
136
|
uiSchema = uiSchema[property];
|
|
53
137
|
return !uiSchema || uiSchema["ui:widget"] == "HiddenWidget" || uiSchema["ui:field"] == "HiddenField";
|
|
54
138
|
}
|
|
55
|
-
exports.isHidden = isHidden;
|
|
56
139
|
function isDefaultData(formData, schema) {
|
|
57
140
|
switch (schema.type) {
|
|
58
141
|
case "object":
|
|
@@ -63,11 +146,9 @@ function isDefaultData(formData, schema) {
|
|
|
63
146
|
return formData === getDefaultFormState(schema);
|
|
64
147
|
}
|
|
65
148
|
}
|
|
66
|
-
exports.isDefaultData = isDefaultData;
|
|
67
149
|
function getDefaultFormState(schema, formData, rootSchema) {
|
|
68
|
-
return utils_1.getDefaultFormState(validator_ajv6_1.default, schema, formData, rootSchema);
|
|
150
|
+
return (0, utils_1.getDefaultFormState)(validator_ajv6_1.default, schema, formData, rootSchema);
|
|
69
151
|
}
|
|
70
|
-
exports.getDefaultFormState = getDefaultFormState;
|
|
71
152
|
/**
|
|
72
153
|
* If you use this with schema data, note that this function doesn't check default data.
|
|
73
154
|
*/
|
|
@@ -82,7 +163,7 @@ function hasData(formData) {
|
|
|
82
163
|
if (!Array.isArray(formData))
|
|
83
164
|
formData = [formData];
|
|
84
165
|
return formData.some((data) => {
|
|
85
|
-
if (exports.isObject(data)) {
|
|
166
|
+
if ((0, exports.isObject)(data)) {
|
|
86
167
|
return Object.keys(data).some(_field => propertyHasData(_field, data));
|
|
87
168
|
}
|
|
88
169
|
else
|
|
@@ -90,7 +171,6 @@ function hasData(formData) {
|
|
|
90
171
|
});
|
|
91
172
|
}
|
|
92
173
|
}
|
|
93
|
-
exports.hasData = hasData;
|
|
94
174
|
/**
|
|
95
175
|
* If you use this with schema data, note that this function doesn't check default data.
|
|
96
176
|
*/
|
|
@@ -99,15 +179,13 @@ function propertyHasData(field, container) {
|
|
|
99
179
|
return false;
|
|
100
180
|
const data = container[field];
|
|
101
181
|
return !!(data &&
|
|
102
|
-
(!exports.isObject(data) || (Object.keys(data).length > 0 && hasData(data))) &&
|
|
182
|
+
(!(0, exports.isObject)(data) || (Object.keys(data).length > 0 && hasData(data))) &&
|
|
103
183
|
(!Array.isArray(data) || (data.length > 0 && hasData(data))));
|
|
104
184
|
}
|
|
105
|
-
exports.propertyHasData = propertyHasData;
|
|
106
185
|
function getUpdateObjectFromJSONPath(path, injection) {
|
|
107
186
|
console.warn("'getUpdateObjectFromJSONPath' works with JSON pointers, not JSON path! This function is deprecated and will be removed in the future, please use 'getUpdateObjectFromJSONPointer' instead");
|
|
108
187
|
return getUpdateObjectFromJSONPointer(path, injection);
|
|
109
188
|
}
|
|
110
|
-
exports.getUpdateObjectFromJSONPath = getUpdateObjectFromJSONPath;
|
|
111
189
|
function getUpdateObjectFromJSONPointer(path, injection) {
|
|
112
190
|
let update = {};
|
|
113
191
|
let updatePointer = update;
|
|
@@ -125,7 +203,6 @@ function getUpdateObjectFromJSONPointer(path, injection) {
|
|
|
125
203
|
updatePointer[lastPathName] = injection;
|
|
126
204
|
return update;
|
|
127
205
|
}
|
|
128
|
-
exports.getUpdateObjectFromJSONPointer = getUpdateObjectFromJSONPointer;
|
|
129
206
|
function immutableDelete(_obj, _delProp) {
|
|
130
207
|
const simple = (obj, delProp) => {
|
|
131
208
|
if (!(delProp in obj)) {
|
|
@@ -141,7 +218,7 @@ function immutableDelete(_obj, _delProp) {
|
|
|
141
218
|
if (_delProp[0] === "/") {
|
|
142
219
|
const splits = _delProp.split("/");
|
|
143
220
|
const last = splits.pop();
|
|
144
|
-
const container = parseJSONPointer(_obj, "/" + splits.join("/"),
|
|
221
|
+
const container = parseJSONPointer(_obj, "/" + splits.join("/"), true);
|
|
145
222
|
if (!container || !(last in container)) {
|
|
146
223
|
return _obj;
|
|
147
224
|
}
|
|
@@ -151,7 +228,6 @@ function immutableDelete(_obj, _delProp) {
|
|
|
151
228
|
return simple(_obj, _delProp);
|
|
152
229
|
}
|
|
153
230
|
}
|
|
154
|
-
exports.immutableDelete = immutableDelete;
|
|
155
231
|
function getUiOptions(container) {
|
|
156
232
|
if (container) {
|
|
157
233
|
const options = container["ui:options"] || container.options;
|
|
@@ -159,12 +235,11 @@ function getUiOptions(container) {
|
|
|
159
235
|
}
|
|
160
236
|
return {};
|
|
161
237
|
}
|
|
162
|
-
exports.getUiOptions = getUiOptions;
|
|
163
238
|
function getInnerUiSchema(parentUiSchema = {}) {
|
|
164
239
|
let { uiSchema } = parentUiSchema, restOfUiSchema = __rest(parentUiSchema, ["uiSchema"]);
|
|
165
240
|
if (uiSchema
|
|
166
|
-
&& (Context_1.default("VIRTUAL_SCHEMA_NAMES")[uiSchema["ui:field"]]
|
|
167
|
-
|| Context_1.default("SCHEMA_FIELD_WRAPPERS")[uiSchema["ui:field"]]) && parentUiSchema["ui:buttons"]) {
|
|
241
|
+
&& ((0, Context_1.default)("VIRTUAL_SCHEMA_NAMES")[uiSchema["ui:field"]]
|
|
242
|
+
|| (0, Context_1.default)("SCHEMA_FIELD_WRAPPERS")[uiSchema["ui:field"]]) && parentUiSchema["ui:buttons"]) {
|
|
168
243
|
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:buttons": [
|
|
169
244
|
...(uiSchema["ui:buttons"] || []),
|
|
170
245
|
...(parentUiSchema["ui:buttons"] || [])
|
|
@@ -172,15 +247,12 @@ function getInnerUiSchema(parentUiSchema = {}) {
|
|
|
172
247
|
}
|
|
173
248
|
return Object.assign(Object.assign(Object.assign({}, restOfUiSchema), { "ui:field": undefined, "ui:settings": undefined, "ui:options": uiSchema ? undefined : restOfUiSchema["ui:options"], "ui:buttons": uiSchema ? undefined : parentUiSchema["ui:buttons"] }), (uiSchema || {}));
|
|
174
249
|
}
|
|
175
|
-
exports.getInnerUiSchema = getInnerUiSchema;
|
|
176
250
|
function isNullOrUndefined(val) {
|
|
177
251
|
return val === null || val === undefined;
|
|
178
252
|
}
|
|
179
|
-
exports.isNullOrUndefined = isNullOrUndefined;
|
|
180
253
|
function isEmptyString(val) {
|
|
181
254
|
return val === "" || isNullOrUndefined(val);
|
|
182
255
|
}
|
|
183
|
-
exports.isEmptyString = isEmptyString;
|
|
184
256
|
function parseJSONPointer(object, jsonPointer, safeMode, strictEmptyPath = false) {
|
|
185
257
|
if (jsonPointer === "" || jsonPointer === "/") {
|
|
186
258
|
return object;
|
|
@@ -206,24 +278,20 @@ function parseJSONPointer(object, jsonPointer, safeMode, strictEmptyPath = false
|
|
|
206
278
|
return o[s];
|
|
207
279
|
}, object);
|
|
208
280
|
}
|
|
209
|
-
exports.parseJSONPointer = parseJSONPointer;
|
|
210
281
|
function getReactComponentName(WrappedComponent) {
|
|
211
282
|
return (WrappedComponent.displayName ||
|
|
212
283
|
WrappedComponent.name ||
|
|
213
284
|
"Component");
|
|
214
285
|
}
|
|
215
|
-
exports.getReactComponentName = getReactComponentName;
|
|
216
286
|
function isMultiSelect(schema, uiSchema) {
|
|
217
|
-
return utils_1.isMultiSelect(validator_ajv6_1.default, schema) && !(schema.type === "array" &&
|
|
287
|
+
return (0, utils_1.isMultiSelect)(validator_ajv6_1.default, schema) && !(schema.type === "array" &&
|
|
218
288
|
uiSchema &&
|
|
219
289
|
uiSchema.items &&
|
|
220
290
|
uiSchema.items["ui:field"]);
|
|
221
291
|
}
|
|
222
|
-
exports.isMultiSelect = isMultiSelect;
|
|
223
292
|
function isSelect(schema) {
|
|
224
|
-
return utils_1.isSelect(validator_ajv6_1.default, schema);
|
|
293
|
+
return (0, utils_1.isSelect)(validator_ajv6_1.default, schema);
|
|
225
294
|
}
|
|
226
|
-
exports.isSelect = isSelect;
|
|
227
295
|
const SWITCH_CLASS = "laji-form-checkbox-widget-tab-target";
|
|
228
296
|
const IMG_ADD_CLASS = "laji-form-drop-zone";
|
|
229
297
|
const tabbableSelectors = [
|
|
@@ -241,53 +309,47 @@ function getTabbableFields(elem, reverse) {
|
|
|
241
309
|
fields = fields.reverse();
|
|
242
310
|
return fields;
|
|
243
311
|
}
|
|
244
|
-
exports.getTabbableFields = getTabbableFields;
|
|
245
312
|
function isTabbableInput(elem) {
|
|
246
313
|
return elem.id.match(/^_laji-form_/)
|
|
247
314
|
|| ["input", "select", "textarea"].includes(elem.tagName.toLowerCase())
|
|
248
315
|
|| elem.className.includes(SWITCH_CLASS)
|
|
249
316
|
|| elem.className.includes(IMG_ADD_CLASS);
|
|
250
317
|
}
|
|
251
|
-
exports.isTabbableInput = isTabbableInput;
|
|
252
318
|
function canFocusNextInput(root, inputElem) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return (((_a = node) === null || _a === void 0 ? void 0 : _a.querySelectorAll) && isTabbableInput(inputElem));
|
|
319
|
+
const node = (0, react_dom_1.findDOMNode)(root);
|
|
320
|
+
return ((node === null || node === void 0 ? void 0 : node.querySelectorAll) && isTabbableInput(inputElem));
|
|
256
321
|
}
|
|
257
|
-
exports.canFocusNextInput = canFocusNextInput;
|
|
258
322
|
function findNearestParentSchemaElem(elem) {
|
|
259
323
|
while (elem && !("id" in elem ? elem.id : "").match(/^_laji-form_/)) {
|
|
260
324
|
elem = elem.parentNode;
|
|
261
325
|
}
|
|
262
326
|
return elem;
|
|
263
327
|
}
|
|
264
|
-
exports.findNearestParentSchemaElem = findNearestParentSchemaElem;
|
|
265
328
|
function findNearestParentTabbableElem(elem) {
|
|
266
329
|
while (!isTabbableInput(elem)) {
|
|
267
330
|
elem = elem.parentNode;
|
|
268
331
|
}
|
|
269
332
|
return elem;
|
|
270
333
|
}
|
|
271
|
-
exports.findNearestParentTabbableElem = findNearestParentTabbableElem;
|
|
272
334
|
const ReactUtils = (context) => ({
|
|
273
335
|
findNearestParentSchemaElemId: exports.findNearestParentSchemaElemId,
|
|
274
336
|
getSchemaElementById: exports.getSchemaElementById,
|
|
275
337
|
focusById: _focusById(context),
|
|
276
338
|
focusAndScroll: _focusAndScroll(context),
|
|
277
339
|
shouldSyncScroll: _shouldSyncScroll(context),
|
|
278
|
-
syncScroll: exports._syncScroll(context),
|
|
340
|
+
syncScroll: (0, exports._syncScroll)(context),
|
|
279
341
|
filterItemIdsDeeply: _filterItemIdsDeeply(context),
|
|
280
342
|
formDataIsEmpty: _formDataIsEmpty(context),
|
|
281
343
|
formDataEquals: _formDataEquals(context),
|
|
282
344
|
keyboardClick: _keyboardClick(context),
|
|
283
|
-
getNextInput: exports.getNextInput(context),
|
|
284
|
-
focusNextInput: exports.focusNextInput(context),
|
|
285
|
-
getNextInputInInputs: exports.getNextInputInInputs(context)
|
|
345
|
+
getNextInput: (0, exports.getNextInput)(context),
|
|
346
|
+
focusNextInput: (0, exports.focusNextInput)(context),
|
|
347
|
+
getNextInputInInputs: (0, exports.getNextInputInInputs)(context)
|
|
286
348
|
});
|
|
287
349
|
exports.ReactUtils = ReactUtils;
|
|
288
350
|
const getNextInputInInputs = (formContext) => (inputElem, reverseDirection = false, fields) => {
|
|
289
351
|
const formReactNode = formContext.formRef.current;
|
|
290
|
-
const formElem = react_dom_1.findDOMNode(formReactNode);
|
|
352
|
+
const formElem = (0, react_dom_1.findDOMNode)(formReactNode);
|
|
291
353
|
if (!formElem) {
|
|
292
354
|
return undefined;
|
|
293
355
|
}
|
|
@@ -322,7 +384,7 @@ const getNextInputInInputs = (formContext) => (inputElem, reverseDirection = fal
|
|
|
322
384
|
};
|
|
323
385
|
exports.getNextInputInInputs = getNextInputInInputs;
|
|
324
386
|
const getNextInput = (formContext) => (inputElem, reverseDirection = false) => {
|
|
325
|
-
const formElem = react_dom_1.findDOMNode(formContext.formRef.current);
|
|
387
|
+
const formElem = (0, react_dom_1.findDOMNode)(formContext.formRef.current);
|
|
326
388
|
const fields = getTabbableFields(formElem);
|
|
327
389
|
const input = formContext.utils.getNextInputInInputs(inputElem, reverseDirection, fields);
|
|
328
390
|
if (!input) {
|
|
@@ -366,13 +428,13 @@ const getSchemaElementById = (id) => {
|
|
|
366
428
|
};
|
|
367
429
|
exports.getSchemaElementById = getSchemaElementById;
|
|
368
430
|
const _focusById = (context) => (id, focus = true) => {
|
|
369
|
-
const elem = exports.getSchemaElementById(id);
|
|
431
|
+
const elem = (0, exports.getSchemaElementById)(id);
|
|
370
432
|
if (elem && document.body.contains(elem)) {
|
|
371
433
|
const tabbableFields = getTabbableFields(elem);
|
|
372
434
|
if (tabbableFields && tabbableFields.length) {
|
|
373
435
|
focus && tabbableFields[0].focus();
|
|
374
436
|
scrollIntoViewIfNeeded(elem, context.topOffset, context.bottomOffset);
|
|
375
|
-
const rootContext = Context_1.default(context.contextId);
|
|
437
|
+
const rootContext = (0, Context_1.default)(context.contextId);
|
|
376
438
|
rootContext.lastIdToFocus = id; // Mark for components that manipulate scroll positions
|
|
377
439
|
rootContext.windowScrolled = getWindowScrolled();
|
|
378
440
|
return true;
|
|
@@ -384,14 +446,14 @@ const focusById = (context, id, focus) => _focusById(context)(id, focus);
|
|
|
384
446
|
exports.focusById = focusById;
|
|
385
447
|
const _focusAndScroll = (context) => (idToFocus, idToScroll, focus = true) => {
|
|
386
448
|
const { contextId, topOffset, bottomOffset } = context;
|
|
387
|
-
const _context = Context_1.default(contextId);
|
|
449
|
+
const _context = (0, Context_1.default)(contextId);
|
|
388
450
|
if (idToFocus === undefined && idToScroll === undefined)
|
|
389
451
|
return;
|
|
390
452
|
if (idToFocus && !context.utils.focusById(getKeyHandlerTargetId(idToFocus, _context), focus))
|
|
391
453
|
return false;
|
|
392
454
|
if (idToScroll) {
|
|
393
455
|
const elemToScroll = document.getElementById(getKeyHandlerTargetId(idToScroll, _context));
|
|
394
|
-
const elemToFocus = exports.getSchemaElementById(getKeyHandlerTargetId(idToFocus, _context));
|
|
456
|
+
const elemToFocus = (0, exports.getSchemaElementById)(getKeyHandlerTargetId(idToFocus, _context));
|
|
395
457
|
if (!elemToScroll || !elemToFocus) {
|
|
396
458
|
return end();
|
|
397
459
|
}
|
|
@@ -418,22 +480,22 @@ const _focusAndScroll = (context) => (idToFocus, idToScroll, focus = true) => {
|
|
|
418
480
|
const focusAndScroll = (context, idToFocus, idToScroll, focus) => _focusAndScroll(context)(idToFocus, idToScroll, focus);
|
|
419
481
|
exports.focusAndScroll = focusAndScroll;
|
|
420
482
|
const _shouldSyncScroll = (context) => () => {
|
|
421
|
-
return Context_1.default(context.contextId).windowScrolled === getWindowScrolled();
|
|
483
|
+
return (0, Context_1.default)(context.contextId).windowScrolled === getWindowScrolled();
|
|
422
484
|
};
|
|
423
485
|
const shouldSyncScroll = (context) => _shouldSyncScroll(context)();
|
|
424
486
|
exports.shouldSyncScroll = shouldSyncScroll;
|
|
425
487
|
const _syncScroll = (context) => (force = false) => {
|
|
426
|
-
if (force || exports.shouldSyncScroll(context)) {
|
|
427
|
-
const { lastIdToFocus, lastIdToScroll } = Context_1.default(context.contextId);
|
|
428
|
-
exports.focusAndScroll(context, lastIdToFocus, lastIdToScroll, false);
|
|
488
|
+
if (force || (0, exports.shouldSyncScroll)(context)) {
|
|
489
|
+
const { lastIdToFocus, lastIdToScroll } = (0, Context_1.default)(context.contextId);
|
|
490
|
+
(0, exports.focusAndScroll)(context, lastIdToFocus, lastIdToScroll, false);
|
|
429
491
|
}
|
|
430
492
|
};
|
|
431
493
|
exports._syncScroll = _syncScroll;
|
|
432
|
-
const syncScroll = (context, force) => exports._syncScroll(context)(force);
|
|
494
|
+
const syncScroll = (context, force) => (0, exports._syncScroll)(context)(force);
|
|
433
495
|
exports.syncScroll = syncScroll;
|
|
434
496
|
const filterLajiFormId = (item) => {
|
|
435
497
|
if (item && item._lajiFormId) {
|
|
436
|
-
const { _lajiFormId } = item, _item = __rest(item, ["_lajiFormId"]);
|
|
498
|
+
const { _lajiFormId } = item, _item = __rest(item, ["_lajiFormId"]);
|
|
437
499
|
item = _item;
|
|
438
500
|
}
|
|
439
501
|
return item;
|
|
@@ -441,7 +503,7 @@ const filterLajiFormId = (item) => {
|
|
|
441
503
|
exports.filterLajiFormId = filterLajiFormId;
|
|
442
504
|
const filterItemId = (item) => {
|
|
443
505
|
if (item && (item._lajiFormId || item.id)) {
|
|
444
|
-
const { _lajiFormId, id } = item, _item = __rest(item, ["_lajiFormId", "id"]);
|
|
506
|
+
const { _lajiFormId, id } = item, _item = __rest(item, ["_lajiFormId", "id"]);
|
|
445
507
|
item = _item;
|
|
446
508
|
}
|
|
447
509
|
return item;
|
|
@@ -474,7 +536,7 @@ const _keyboardClick = ({ contextId }) => (fn, keys = [" ", "Enter"]) => {
|
|
|
474
536
|
return (e) => {
|
|
475
537
|
var _a, _b;
|
|
476
538
|
if ((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.matches) === null || _b === void 0 ? void 0 : _b.call(_a, tabbableSelectorsQuery)) {
|
|
477
|
-
const { shortcuts } = Context_1.default(contextId);
|
|
539
|
+
const { shortcuts } = (0, Context_1.default)(contextId);
|
|
478
540
|
keys = keys.filter(k => !(shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts[k]));
|
|
479
541
|
}
|
|
480
542
|
if (e.altKey || e.ctrlKey || keys.every(k => e.key !== k)) {
|
|
@@ -495,7 +557,6 @@ function getNestedTailUiSchema(uiSchema) {
|
|
|
495
557
|
}
|
|
496
558
|
return uiSchema;
|
|
497
559
|
}
|
|
498
|
-
exports.getNestedTailUiSchema = getNestedTailUiSchema;
|
|
499
560
|
function updateTailUiSchema(uiSchema, updateObject) {
|
|
500
561
|
let tailPointer = {};
|
|
501
562
|
let root = tailPointer;
|
|
@@ -507,9 +568,8 @@ function updateTailUiSchema(uiSchema, updateObject) {
|
|
|
507
568
|
tailPointer = tailPointer.uiSchema;
|
|
508
569
|
}
|
|
509
570
|
tailPointer.uiSchema = updateObject;
|
|
510
|
-
return immutability_helper_1.default(uiSchema, root);
|
|
571
|
+
return (0, immutability_helper_1.default)(uiSchema, root);
|
|
511
572
|
}
|
|
512
|
-
exports.updateTailUiSchema = updateTailUiSchema;
|
|
513
573
|
function getNestedUiFieldsList(uiSchema) {
|
|
514
574
|
const list = [];
|
|
515
575
|
while (uiSchema.uiSchema && uiSchema.uiSchema["ui:field"]) {
|
|
@@ -518,14 +578,12 @@ function getNestedUiFieldsList(uiSchema) {
|
|
|
518
578
|
}
|
|
519
579
|
return list;
|
|
520
580
|
}
|
|
521
|
-
exports.getNestedUiFieldsList = getNestedUiFieldsList;
|
|
522
581
|
function getBootstrapCols(width) {
|
|
523
582
|
return ["lg", "md", "sm", "xs"].reduce((o, c) => {
|
|
524
583
|
o[c] = width;
|
|
525
584
|
return o;
|
|
526
585
|
}, {});
|
|
527
586
|
}
|
|
528
|
-
exports.getBootstrapCols = getBootstrapCols;
|
|
529
587
|
function isDescendant(parent, child) {
|
|
530
588
|
let node = child.parentNode;
|
|
531
589
|
while (node != null) {
|
|
@@ -536,7 +594,6 @@ function isDescendant(parent, child) {
|
|
|
536
594
|
}
|
|
537
595
|
return false;
|
|
538
596
|
}
|
|
539
|
-
exports.isDescendant = isDescendant;
|
|
540
597
|
function getKeyHandlerTargetId(target = "", context, formData) {
|
|
541
598
|
var _a;
|
|
542
599
|
while (target.match(/%\{([^{}]*)\}/)) {
|
|
@@ -547,15 +604,12 @@ function getKeyHandlerTargetId(target = "", context, formData) {
|
|
|
547
604
|
}
|
|
548
605
|
return target;
|
|
549
606
|
}
|
|
550
|
-
exports.getKeyHandlerTargetId = getKeyHandlerTargetId;
|
|
551
607
|
function capitalizeFirstLetter(string) {
|
|
552
608
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
553
609
|
}
|
|
554
|
-
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
555
610
|
function decapitalizeFirstLetter(string) {
|
|
556
611
|
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
557
612
|
}
|
|
558
|
-
exports.decapitalizeFirstLetter = decapitalizeFirstLetter;
|
|
559
613
|
function stringifyKeyCombo(keyCombo = "") {
|
|
560
614
|
return keyCombo.split("+").map(key => {
|
|
561
615
|
if (key === " ")
|
|
@@ -563,11 +617,9 @@ function stringifyKeyCombo(keyCombo = "") {
|
|
|
563
617
|
return capitalizeFirstLetter(key);
|
|
564
618
|
}).join(" + ");
|
|
565
619
|
}
|
|
566
|
-
exports.stringifyKeyCombo = stringifyKeyCombo;
|
|
567
620
|
function canAdd(props) {
|
|
568
621
|
return (!("canAdd" in props) || props.canAdd) && getUiOptions(props.uiSchema).canAdd !== false;
|
|
569
622
|
}
|
|
570
|
-
exports.canAdd = canAdd;
|
|
571
623
|
function bsSizeToPixels(bsSize) {
|
|
572
624
|
switch (bsSize) {
|
|
573
625
|
case "lg":
|
|
@@ -582,7 +634,6 @@ function bsSizeToPixels(bsSize) {
|
|
|
582
634
|
throw new Error(`Unknown bootstrap size ${bsSize}. Should be one of 'lg', 'md', 'sm' or 'xs'`);
|
|
583
635
|
}
|
|
584
636
|
}
|
|
585
|
-
exports.bsSizeToPixels = bsSizeToPixels;
|
|
586
637
|
function pixelsToBsSize(pixels) {
|
|
587
638
|
if (pixels < 576) {
|
|
588
639
|
return "xs";
|
|
@@ -598,7 +649,6 @@ function pixelsToBsSize(pixels) {
|
|
|
598
649
|
}
|
|
599
650
|
return "";
|
|
600
651
|
}
|
|
601
|
-
exports.pixelsToBsSize = pixelsToBsSize;
|
|
602
652
|
function applyFunction(props) {
|
|
603
653
|
let { "ui:functions": functions, "ui:childFunctions": childFunctions } = (props.uiSchema || {});
|
|
604
654
|
const asArrayIfDefined = (item) => item ? asArray(item) : [];
|
|
@@ -617,38 +667,25 @@ function applyFunction(props) {
|
|
|
617
667
|
}, Object.assign(Object.assign({}, props), { formContext: props.registry.formContext }));
|
|
618
668
|
return Object.assign(Object.assign({}, computedProps), { uiSchema: Object.assign(Object.assign({}, computedProps.uiSchema), { "ui:functions": undefined, "ui:childFunctions": undefined, "ui:field": props.uiSchema["ui:field"], "ui:options": props.uiSchema["ui:options"], uiSchema: props.uiSchema.uiSchema }) });
|
|
619
669
|
}
|
|
620
|
-
exports.applyFunction = applyFunction;
|
|
621
670
|
function getWindowScrolled() {
|
|
622
671
|
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
623
672
|
}
|
|
624
|
-
exports.getWindowScrolled = getWindowScrolled;
|
|
625
673
|
function getScrollPositionForScrollIntoViewIfNeeded(elem, topOffset = 0, bottomOffset = 0) {
|
|
626
674
|
if (!elem)
|
|
627
675
|
return getWindowScrolled();
|
|
628
676
|
const rect = elem.getBoundingClientRect();
|
|
629
677
|
const html = document.documentElement;
|
|
630
|
-
const height = elem.scrollHeight;
|
|
631
678
|
const inView = (rect.top >= topOffset &&
|
|
632
679
|
rect.bottom <= (window.innerHeight || html.clientHeight) - bottomOffset);
|
|
633
680
|
const elemTopDistFromViewportTop = rect.top;
|
|
634
|
-
const viewportHeight = (window.innerHeight || html.clientHeight);
|
|
635
|
-
const elemBottomDistFromViewportBottom = -(elemTopDistFromViewportTop + height - viewportHeight);
|
|
636
681
|
const pageScrolled = getWindowScrolled();
|
|
637
682
|
if (inView)
|
|
638
683
|
return pageScrolled;
|
|
639
|
-
|
|
640
|
-
if (pageScrolled + elemTopDistFromViewportTop - topOffset > elemTopDistFromViewportTop) {
|
|
641
|
-
return pageScrolled + elemTopDistFromViewportTop - topOffset;
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
return pageScrolled - elemBottomDistFromViewportBottom + bottomOffset;
|
|
645
|
-
}
|
|
684
|
+
return pageScrolled + elemTopDistFromViewportTop - topOffset;
|
|
646
685
|
}
|
|
647
|
-
exports.getScrollPositionForScrollIntoViewIfNeeded = getScrollPositionForScrollIntoViewIfNeeded;
|
|
648
686
|
function scrollIntoViewIfNeeded(elem, topOffset = 0, bottomOffset = 0) {
|
|
649
687
|
window.scrollTo(0, getScrollPositionForScrollIntoViewIfNeeded(elem, topOffset, bottomOffset));
|
|
650
688
|
}
|
|
651
|
-
exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
|
|
652
689
|
function filter(properties, filter, filterType = "blacklist", getValue) {
|
|
653
690
|
const filterDictionary = {};
|
|
654
691
|
filter.forEach(_enum => { filterDictionary[_enum] = true; });
|
|
@@ -658,12 +695,10 @@ function filter(properties, filter, filterType = "blacklist", getValue) {
|
|
|
658
695
|
};
|
|
659
696
|
return properties.filter(filterType === "whitelist" ? filterFn : e => !filterFn(e));
|
|
660
697
|
}
|
|
661
|
-
exports.filter = filter;
|
|
662
698
|
function updateSafelyWithJSONPath(obj, value, path, immutably, createNew) {
|
|
663
699
|
console.warn("'updateSafelyWithJSONPath' works with JSON pointers, not JSON path! This function is deprecated and will be removed in the future, please use 'updateSafelyWithJSONPointer' instead");
|
|
664
700
|
return updateSafelyWithJSONPointer(obj, value, path, immutably, createNew);
|
|
665
701
|
}
|
|
666
|
-
exports.updateSafelyWithJSONPath = updateSafelyWithJSONPath;
|
|
667
702
|
function updateSafelyWithJSONPointer(obj, value, path, immutably = true, createNew = () => ({})) {
|
|
668
703
|
if (path === "/") {
|
|
669
704
|
return value;
|
|
@@ -694,14 +729,14 @@ function updateSafelyWithJSONPointer(obj, value, path, immutably = true, createN
|
|
|
694
729
|
injectionTarget = makePath(injectionTarget);
|
|
695
730
|
}
|
|
696
731
|
const updateObject = getUpdateObjectFromJSONPointer(path, { $set: value });
|
|
697
|
-
return immutability_helper_1.default(obj, updateObject);
|
|
732
|
+
return (0, immutability_helper_1.default)(obj, updateObject);
|
|
698
733
|
function makePath(injectionTarget) {
|
|
699
734
|
const splitPath = path.split("/").filter(s => !isEmptyString(s));
|
|
700
735
|
let _splitPath = "";
|
|
701
736
|
splitPath.reduce((o, split) => {
|
|
702
737
|
_splitPath += `/${split}`;
|
|
703
738
|
if (!o[split]) {
|
|
704
|
-
obj = immutability_helper_1.default(obj, getUpdateObjectFromJSONPointer(_splitPath, { $set: createNew(obj, _splitPath, o, split) }));
|
|
739
|
+
obj = (0, immutability_helper_1.default)(obj, getUpdateObjectFromJSONPointer(_splitPath, { $set: createNew(obj, _splitPath, o, split) }));
|
|
705
740
|
}
|
|
706
741
|
const next = parseJSONPointer(obj, _splitPath);
|
|
707
742
|
injectionTarget = next;
|
|
@@ -710,19 +745,16 @@ function updateSafelyWithJSONPointer(obj, value, path, immutably = true, createN
|
|
|
710
745
|
return injectionTarget;
|
|
711
746
|
}
|
|
712
747
|
}
|
|
713
|
-
exports.updateSafelyWithJSONPointer = updateSafelyWithJSONPointer;
|
|
714
748
|
function injectButtons(uiSchema, buttons, buttonsPath) {
|
|
715
749
|
const existingButtons = parseJSONPointer(uiSchema, `${buttonsPath}/ui:options/buttons`);
|
|
716
750
|
return updateSafelyWithJSONPointer(uiSchema, existingButtons ? [...existingButtons, ...buttons] : buttons, `${buttonsPath}/ui:options/buttons`);
|
|
717
751
|
}
|
|
718
|
-
exports.injectButtons = injectButtons;
|
|
719
752
|
function dictionarify(array, getKey, getValue) {
|
|
720
753
|
return array.reduce((o, k) => {
|
|
721
754
|
o[getKey ? getKey(k) : k] = getValue ? getValue(k) : true;
|
|
722
755
|
return o;
|
|
723
756
|
}, {});
|
|
724
757
|
}
|
|
725
|
-
exports.dictionarify = dictionarify;
|
|
726
758
|
const tableFormatters = {
|
|
727
759
|
unknownTaxon: (item, formatted, options, parentProps = {}) => (isEmptyString(item) || (parentProps.formData || {})[options.idField])
|
|
728
760
|
? formatted
|
|
@@ -787,7 +819,6 @@ function formatValue(props, _formatter, parentProps) {
|
|
|
787
819
|
}
|
|
788
820
|
return formatted;
|
|
789
821
|
}
|
|
790
|
-
exports.formatValue = formatValue;
|
|
791
822
|
const formatErrorMessage = (msg) => msg.replace(/^\[.*\]/, "");
|
|
792
823
|
exports.formatErrorMessage = formatErrorMessage;
|
|
793
824
|
function checkRules(rules, props, cache, prop = "formData") {
|
|
@@ -841,7 +872,6 @@ function checkRules(rules, props, cache, prop = "formData") {
|
|
|
841
872
|
});
|
|
842
873
|
return cache ? { passes, cache } : passes;
|
|
843
874
|
}
|
|
844
|
-
exports.checkRules = checkRules;
|
|
845
875
|
function checkArrayRules(rules, props, idx, cache, prop = "formData") {
|
|
846
876
|
const arrayRules = (Array.isArray(rules) ? rules : [rules]).filter(rule => ["isLast", "idx"].some(r => r in rule));
|
|
847
877
|
const passes = arrayRules.every(rule => {
|
|
@@ -872,7 +902,6 @@ function checkArrayRules(rules, props, idx, cache, prop = "formData") {
|
|
|
872
902
|
return cache ? { cache, passes } : passes;
|
|
873
903
|
}
|
|
874
904
|
}
|
|
875
|
-
exports.checkArrayRules = checkArrayRules;
|
|
876
905
|
function bringRemoteFormData(formData, formContext) {
|
|
877
906
|
if (formContext.formDataTransformers) {
|
|
878
907
|
return formContext.formDataTransformers.reduce((formData, { "ui:field": uiField, props: fieldProps }) => {
|
|
@@ -884,14 +913,12 @@ function bringRemoteFormData(formData, formContext) {
|
|
|
884
913
|
return formData;
|
|
885
914
|
}
|
|
886
915
|
}
|
|
887
|
-
exports.bringRemoteFormData = bringRemoteFormData;
|
|
888
916
|
function triggerParentComponent(eventName, e, props) {
|
|
889
917
|
if (props && props[eventName]) {
|
|
890
918
|
e.persist && e.persist();
|
|
891
919
|
props[eventName](e);
|
|
892
920
|
}
|
|
893
921
|
}
|
|
894
|
-
exports.triggerParentComponent = triggerParentComponent;
|
|
895
922
|
function parseSchemaFromFormDataPointer(schema, pointer) {
|
|
896
923
|
const splits = pointer.split("/").filter(s => !isEmptyString(s));
|
|
897
924
|
const value = splits.reduce((o, s) => {
|
|
@@ -906,7 +933,6 @@ function parseSchemaFromFormDataPointer(schema, pointer) {
|
|
|
906
933
|
}, schema);
|
|
907
934
|
return value;
|
|
908
935
|
}
|
|
909
|
-
exports.parseSchemaFromFormDataPointer = parseSchemaFromFormDataPointer;
|
|
910
936
|
function parseUiSchemaFromFormDataPointer(uiSchema, pointer) {
|
|
911
937
|
const splits = pointer.split("/").filter(s => !isEmptyString(s));
|
|
912
938
|
return splits.reduce((o, s) => {
|
|
@@ -918,7 +944,6 @@ function parseUiSchemaFromFormDataPointer(uiSchema, pointer) {
|
|
|
918
944
|
return o ? o[s] : {};
|
|
919
945
|
}, uiSchema);
|
|
920
946
|
}
|
|
921
|
-
exports.parseUiSchemaFromFormDataPointer = parseUiSchemaFromFormDataPointer;
|
|
922
947
|
function checkJSONPointer(obj, pointer) {
|
|
923
948
|
if (!obj)
|
|
924
949
|
return false;
|
|
@@ -935,7 +960,6 @@ function checkJSONPointer(obj, pointer) {
|
|
|
935
960
|
return false;
|
|
936
961
|
}
|
|
937
962
|
}
|
|
938
|
-
exports.checkJSONPointer = checkJSONPointer;
|
|
939
963
|
const JSONPointerToId = (fieldName) => fieldName[0] === "/" ? fieldName.replace(/(?!^)\//g, "_").substr(1) : fieldName;
|
|
940
964
|
exports.JSONPointerToId = JSONPointerToId;
|
|
941
965
|
const idSchemaIdToJSONPointer = (id) => id.replace(/root_|_/g, "/");
|
|
@@ -961,7 +985,6 @@ function schemaJSONPointer(schema, JSONPointer) {
|
|
|
961
985
|
return undefined;
|
|
962
986
|
}, "");
|
|
963
987
|
}
|
|
964
|
-
exports.schemaJSONPointer = schemaJSONPointer;
|
|
965
988
|
function uiSchemaJSONPointer(schema, JSONPointer) {
|
|
966
989
|
if (JSONPointer[0] !== "/")
|
|
967
990
|
return JSONPointer;
|
|
@@ -986,12 +1009,11 @@ function uiSchemaJSONPointer(schema, JSONPointer) {
|
|
|
986
1009
|
return undefined;
|
|
987
1010
|
}, "");
|
|
988
1011
|
}
|
|
989
|
-
exports.uiSchemaJSONPointer = uiSchemaJSONPointer;
|
|
990
1012
|
function updateFormDataWithJSONPointer(schemaProps, value, path) {
|
|
991
1013
|
if (path === "/") {
|
|
992
1014
|
return value;
|
|
993
1015
|
}
|
|
994
|
-
return updateSafelyWithJSONPointer(schemaProps.formData, value, path,
|
|
1016
|
+
return updateSafelyWithJSONPointer(schemaProps.formData, value, path, true, (__formData, _path) => {
|
|
995
1017
|
const schemaPointer = schemaJSONPointer(schemaProps.schema, _path);
|
|
996
1018
|
if (schemaPointer === undefined) {
|
|
997
1019
|
throw new Error(`Bad JSON Schema pointer '${schemaPointer}!`);
|
|
@@ -1004,10 +1026,9 @@ function updateFormDataWithJSONPointer(schemaProps, value, path) {
|
|
|
1004
1026
|
return _default;
|
|
1005
1027
|
});
|
|
1006
1028
|
}
|
|
1007
|
-
exports.updateFormDataWithJSONPointer = updateFormDataWithJSONPointer;
|
|
1008
1029
|
let uuid = 0;
|
|
1009
1030
|
const assignUUID = (item, immutably = false) => {
|
|
1010
|
-
if (exports.isObject(item) && !item.id && !item._lajiFormId) {
|
|
1031
|
+
if ((0, exports.isObject)(item) && !item.id && !item._lajiFormId) {
|
|
1011
1032
|
uuid++;
|
|
1012
1033
|
if (immutably) {
|
|
1013
1034
|
return Object.assign(Object.assign({}, item), { _lajiFormId: uuid });
|
|
@@ -1025,7 +1046,7 @@ exports.getUUID = getUUID;
|
|
|
1025
1046
|
/**
|
|
1026
1047
|
* Return item UUID or the parent UUID
|
|
1027
1048
|
**/
|
|
1028
|
-
const getFieldUUID = (props) => exports.getUUID(props.formData) || props.formContext._parentLajiFormId || "root";
|
|
1049
|
+
const getFieldUUID = (props) => (0, exports.getUUID)(props.formData) || props.formContext._parentLajiFormId || "root";
|
|
1029
1050
|
exports.getFieldUUID = getFieldUUID;
|
|
1030
1051
|
function walkFormDataWithIdTree(_formData, tree, itemOperator) {
|
|
1031
1052
|
const ids = {};
|
|
@@ -1033,10 +1054,10 @@ function walkFormDataWithIdTree(_formData, tree, itemOperator) {
|
|
|
1033
1054
|
if (!tree)
|
|
1034
1055
|
return _formData;
|
|
1035
1056
|
const { _hasId } = tree, _tree = __rest(tree, ["_hasId"]);
|
|
1036
|
-
if (_hasId && exports.isObject(_formData)) {
|
|
1057
|
+
if (_hasId && (0, exports.isObject)(_formData)) {
|
|
1037
1058
|
_formData = itemOperator ? itemOperator(_formData) : _formData;
|
|
1038
1059
|
}
|
|
1039
|
-
if (Object.keys(_tree).length && exports.isObject(_formData)) {
|
|
1060
|
+
if (Object.keys(_tree).length && (0, exports.isObject)(_formData)) {
|
|
1040
1061
|
return Object.keys(_formData).reduce((f, k) => {
|
|
1041
1062
|
if (tree[k]) {
|
|
1042
1063
|
f[k] = walk(_formData[k], tree[k]);
|
|
@@ -1051,8 +1072,9 @@ function walkFormDataWithIdTree(_formData, tree, itemOperator) {
|
|
|
1051
1072
|
return _formData.map(item => {
|
|
1052
1073
|
item = walk(item, tree);
|
|
1053
1074
|
item = itemOperator ? itemOperator(item) : item;
|
|
1054
|
-
|
|
1055
|
-
|
|
1075
|
+
const uuid = (0, exports.getUUID)(item);
|
|
1076
|
+
if (uuid) {
|
|
1077
|
+
ids[uuid] = true;
|
|
1056
1078
|
}
|
|
1057
1079
|
return item;
|
|
1058
1080
|
});
|
|
@@ -1063,35 +1085,32 @@ function walkFormDataWithIdTree(_formData, tree, itemOperator) {
|
|
|
1063
1085
|
return [formData, ids];
|
|
1064
1086
|
}
|
|
1065
1087
|
function addLajiFormIds(_formData, tree, immutably = true) {
|
|
1066
|
-
const itemOperator = (item) => exports.assignUUID(item, immutably);
|
|
1088
|
+
const itemOperator = (item) => (0, exports.assignUUID)(item, immutably);
|
|
1067
1089
|
return walkFormDataWithIdTree(_formData, tree, itemOperator);
|
|
1068
1090
|
}
|
|
1069
|
-
exports.addLajiFormIds = addLajiFormIds;
|
|
1070
1091
|
function getAllLajiFormIdsDeeply(_formData, tree) {
|
|
1071
1092
|
return walkFormDataWithIdTree(_formData, tree)[1];
|
|
1072
1093
|
}
|
|
1073
|
-
exports.getAllLajiFormIdsDeeply = getAllLajiFormIdsDeeply;
|
|
1074
1094
|
function removeLajiFormIds(formData, tree) {
|
|
1075
1095
|
const itemOperator = (item) => immutableDelete(item, "_lajiFormId");
|
|
1076
1096
|
return walkFormDataWithIdTree(formData, tree, itemOperator)[0];
|
|
1077
1097
|
}
|
|
1078
|
-
exports.removeLajiFormIds = removeLajiFormIds;
|
|
1079
1098
|
function findPointerForLajiFormId(tmpIdTree = {}, formData, lajiFormId) {
|
|
1080
1099
|
if (tmpIdTree._hasId) {
|
|
1081
1100
|
if (Array.isArray(formData)) {
|
|
1082
1101
|
for (let idx in (formData || [])) {
|
|
1083
1102
|
const item = formData[idx];
|
|
1084
|
-
if (exports.getUUID(item) === lajiFormId) {
|
|
1103
|
+
if ((0, exports.getUUID)(item) === lajiFormId) {
|
|
1085
1104
|
return "/" + idx;
|
|
1086
1105
|
}
|
|
1087
1106
|
}
|
|
1088
1107
|
}
|
|
1089
|
-
else if (formData && exports.getUUID(formData) === lajiFormId) {
|
|
1108
|
+
else if (formData && (0, exports.getUUID)(formData) === lajiFormId) {
|
|
1090
1109
|
return "";
|
|
1091
1110
|
}
|
|
1092
1111
|
}
|
|
1093
1112
|
for (const k of Object.keys(tmpIdTree)) {
|
|
1094
|
-
if (exports.isObject(formData[k])) {
|
|
1113
|
+
if ((0, exports.isObject)(formData[k])) {
|
|
1095
1114
|
const find = findPointerForLajiFormId(tmpIdTree[k], formData[k], lajiFormId);
|
|
1096
1115
|
if (find !== undefined || find === "") {
|
|
1097
1116
|
return `/${k}${find}`;
|
|
@@ -1109,7 +1128,6 @@ function findPointerForLajiFormId(tmpIdTree = {}, formData, lajiFormId) {
|
|
|
1109
1128
|
}
|
|
1110
1129
|
return undefined;
|
|
1111
1130
|
}
|
|
1112
|
-
exports.findPointerForLajiFormId = findPointerForLajiFormId;
|
|
1113
1131
|
function highlightElem(elem) {
|
|
1114
1132
|
if (!elem)
|
|
1115
1133
|
return;
|
|
@@ -1117,7 +1135,6 @@ function highlightElem(elem) {
|
|
|
1117
1135
|
elem.className = elem.className.replace(" highlight-error-fire", "");
|
|
1118
1136
|
window.setTimeout(() => elem.className = `${elem.className} highlight-error-fire`);
|
|
1119
1137
|
}
|
|
1120
|
-
exports.highlightElem = highlightElem;
|
|
1121
1138
|
function filteredErrors(errorSchema) {
|
|
1122
1139
|
return Object.keys(errorSchema).reduce((_errorSchema, prop) => {
|
|
1123
1140
|
if (prop === "__errors") {
|
|
@@ -1133,7 +1150,6 @@ function filteredErrors(errorSchema) {
|
|
|
1133
1150
|
return _errorSchema;
|
|
1134
1151
|
}, {});
|
|
1135
1152
|
}
|
|
1136
|
-
exports.filteredErrors = filteredErrors;
|
|
1137
1153
|
function constructTranslations(translations) {
|
|
1138
1154
|
let dictionaries = { fi: {}, en: {}, sv: {} };
|
|
1139
1155
|
for (let word in translations) {
|
|
@@ -1145,21 +1161,18 @@ function constructTranslations(translations) {
|
|
|
1145
1161
|
}
|
|
1146
1162
|
return dictionaries;
|
|
1147
1163
|
}
|
|
1148
|
-
exports.constructTranslations = constructTranslations;
|
|
1149
1164
|
function getIdxWithOffset(idx, offsets, totalOffset) {
|
|
1150
1165
|
let offset = idx in (offsets || {})
|
|
1151
1166
|
? (offsets || {})[idx]
|
|
1152
1167
|
: totalOffset;
|
|
1153
1168
|
return (offset || 0) + idx;
|
|
1154
1169
|
}
|
|
1155
|
-
exports.getIdxWithOffset = getIdxWithOffset;
|
|
1156
1170
|
function getIdxWithoutOffset(idx, offsets, totalOffset) {
|
|
1157
1171
|
let offset = `_${idx}` in (offsets || {})
|
|
1158
1172
|
? (offsets || {})[`_${idx}`]
|
|
1159
1173
|
: totalOffset;
|
|
1160
1174
|
return idx - (offset || 0);
|
|
1161
1175
|
}
|
|
1162
|
-
exports.getIdxWithoutOffset = getIdxWithoutOffset;
|
|
1163
1176
|
/**
|
|
1164
1177
|
* The indices of the formData that a component receives doesn't match the actual root formData indices,
|
|
1165
1178
|
* if the data is sorted or has offsets. This returns the original index.
|
|
@@ -1170,7 +1183,6 @@ function getFormDataIndex(idx, uiSchema) {
|
|
|
1170
1183
|
const mappedIdx = (_a = idxMap[idx]) !== null && _a !== void 0 ? _a : idx;
|
|
1171
1184
|
return getIdxWithOffset(mappedIdx, idxOffsets, totalOffset);
|
|
1172
1185
|
}
|
|
1173
|
-
exports.getFormDataIndex = getFormDataIndex;
|
|
1174
1186
|
/**
|
|
1175
1187
|
* Given an index pointing to actual index in root formData, returns the index with sorting & offset applied.
|
|
1176
1188
|
*/
|
|
@@ -1180,13 +1192,11 @@ function getReversedFormDataIndex(idx, uiSchema) {
|
|
|
1180
1192
|
const mappedIdx = (_a = idxMap["_" + idx]) !== null && _a !== void 0 ? _a : idx;
|
|
1181
1193
|
return getIdxWithoutOffset(mappedIdx, idxOffsets, totalOffset);
|
|
1182
1194
|
}
|
|
1183
|
-
exports.getReversedFormDataIndex = getReversedFormDataIndex;
|
|
1184
1195
|
function toJSONPointer(s) {
|
|
1185
1196
|
return s[0] !== "/"
|
|
1186
1197
|
? "/" + s
|
|
1187
1198
|
: s;
|
|
1188
1199
|
}
|
|
1189
|
-
exports.toJSONPointer = toJSONPointer;
|
|
1190
1200
|
function getTitle(props, idx) {
|
|
1191
1201
|
var _a, _b, _c, _d;
|
|
1192
1202
|
let title = (_d = (_b = (_a = props.uiSchema) === null || _a === void 0 ? void 0 : _a["ui:title"]) !== null && _b !== void 0 ? _b : (_c = props.schema) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : props.name;
|
|
@@ -1208,13 +1218,11 @@ function getTitle(props, idx) {
|
|
|
1208
1218
|
return _title;
|
|
1209
1219
|
}, title);
|
|
1210
1220
|
}
|
|
1211
|
-
exports.getTitle = getTitle;
|
|
1212
1221
|
const classNames = (...cs) => cs.filter(s => typeof s === "string").join(" ");
|
|
1213
1222
|
exports.classNames = classNames;
|
|
1214
1223
|
function translate(translations, key, params) {
|
|
1215
1224
|
return Object.keys(params || {}).reduce((translated, param) => translated.replace(new RegExp(`%{${param}}`, "g"), (params === null || params === void 0 ? void 0 : params[param]) || ""), translations[key]);
|
|
1216
1225
|
}
|
|
1217
|
-
exports.translate = translate;
|
|
1218
1226
|
/**
|
|
1219
1227
|
* @param value the default value of the setter
|
|
1220
1228
|
* @returns [stateValue, setTrue, setFalse]
|
|
@@ -1225,7 +1233,6 @@ function useBooleanSetter(value) {
|
|
|
1225
1233
|
const setFalse = React.useCallback(() => setOpen(false), []);
|
|
1226
1234
|
return [open, setTrue, setFalse];
|
|
1227
1235
|
}
|
|
1228
|
-
exports.useBooleanSetter = useBooleanSetter;
|
|
1229
1236
|
function usePrevious(value) {
|
|
1230
1237
|
const ref = React.useRef();
|
|
1231
1238
|
React.useEffect(() => {
|
|
@@ -1233,11 +1240,9 @@ function usePrevious(value) {
|
|
|
1233
1240
|
});
|
|
1234
1241
|
return ref.current;
|
|
1235
1242
|
}
|
|
1236
|
-
exports.usePrevious = usePrevious;
|
|
1237
1243
|
function asArray(maybeArr) {
|
|
1238
1244
|
return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
|
|
1239
1245
|
}
|
|
1240
|
-
exports.asArray = asArray;
|
|
1241
1246
|
function getLajiUri(lajiId) {
|
|
1242
1247
|
const defaultDomain = "http://tun.fi/";
|
|
1243
1248
|
const domainMap = {
|
|
@@ -1256,4 +1261,3 @@ function getLajiUri(lajiId) {
|
|
|
1256
1261
|
return lajiId;
|
|
1257
1262
|
return defaultDomain + lajiId;
|
|
1258
1263
|
}
|
|
1259
|
-
exports.getLajiUri = getLajiUri;
|