@luomus/laji-form 15.0.0 → 15.1.1
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/CHANGELOG.md +0 -4
- package/dist/laji-form.js +1 -1
- package/dist/styles.css +81 -90
- package/jsonconfig.json +26 -0
- package/migrate.sh +0 -1
- package/package.json +8 -8
- package/test-export/array-spec.js +204 -0
- package/test-export/bird-point-count-spec.d.ts +1 -0
- package/test-export/bird-point-count-spec.js +62 -0
- package/test-export/collection-contest-form-spec.d.ts +1 -0
- package/test-export/collection-contest-form-spec.js +38 -0
- package/test-export/dataset-form-spec.d.ts +1 -0
- package/test-export/dataset-form-spec.js +50 -0
- package/test-export/date-time-widget-spec.d.ts +1 -0
- package/test-export/date-time-widget-spec.js +188 -0
- package/test-export/geocoder-spec.d.ts +1 -0
- package/test-export/geocoder-spec.js +135 -0
- package/test-export/image-array-spec.d.ts +1 -0
- package/test-export/image-array-spec.js +94 -0
- package/test-export/inject-field-spec.d.ts +1 -0
- package/test-export/inject-field-spec.js +148 -0
- package/test-export/internal-uuids-spec.d.ts +1 -0
- package/test-export/internal-uuids-spec.js +157 -0
- package/test-export/invasive-species-eradication-np-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-np-spec.js +18 -0
- package/test-export/invasive-species-eradication-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-spec.js +25 -0
- package/test-export/line-transect-spec.d.ts +1 -0
- package/test-export/line-transect-spec.js +121 -0
- package/test-export/mobile-form-spec.d.ts +1 -0
- package/test-export/mobile-form-spec.js +84 -0
- package/test-export/nafi-spec.d.ts +1 -0
- package/test-export/nafi-spec.js +85 -0
- package/test-export/select-widget-spec.d.ts +1 -0
- package/test-export/select-widget-spec.js +68 -0
- package/test-export/single-item-array-field-spec.d.ts +1 -0
- package/test-export/single-item-array-field-spec.js +92 -0
- package/test-export/syke-butterfly-spec.d.ts +1 -0
- package/test-export/syke-butterfly-spec.js +163 -0
- package/test-export/test-utils.d.ts +150 -176
- package/test-export/test-utils.js +218 -210
- package/test-export/transaction-form-spec.d.ts +1 -0
- package/test-export/transaction-form-spec.js +63 -0
- package/test-export/trip-report-autosuggest-spec.d.ts +1 -0
- package/test-export/trip-report-autosuggest-spec.js +272 -0
- package/test-export/trip-report-spec.d.ts +1 -0
- package/test-export/trip-report-spec.js +456 -0
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +1 -0
- package/test-export/unit-list-shorthand-array-field-spec.js +71 -0
- package/test-export/validation-spec.d.ts +1 -0
- package/test-export/validation-spec.js +336 -0
- package/test-export/water-bird-spec.d.ts +1 -0
- package/test-export/water-bird-spec.js +30 -0
- package/test-export/wbc-spec.d.ts +1 -0
- package/test-export/wbc-spec.js +82 -0
- package/tsconfig.test.json +1 -1
- package/xsel -b +9 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and closes suggestion list (failed).png +0 -0
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and is marked as suggested (failed).png +0 -0
- package/lib/ApiClient.d.ts +0 -46
- package/lib/ApiClient.js +0 -93
- package/lib/Context.d.ts +0 -8
- package/lib/Context.js +0 -18
- package/lib/ReactContext.d.ts +0 -7
- package/lib/ReactContext.js +0 -5
- package/lib/components/BaseComponent.d.ts +0 -9
- package/lib/components/BaseComponent.js +0 -29
- package/lib/components/LajiForm.d.ts +0 -221
- package/lib/components/LajiForm.js +0 -615
- package/lib/components/VirtualSchemaField.d.ts +0 -42
- package/lib/components/VirtualSchemaField.js +0 -74
- package/lib/components/components.d.ts +0 -119
- package/lib/components/components.js +0 -606
- package/lib/components/fields/AnnotationField.d.ts +0 -34
- package/lib/components/fields/AnnotationField.js +0 -242
- package/lib/components/fields/AnyToBooleanField.d.ts +0 -18
- package/lib/components/fields/AnyToBooleanField.js +0 -20
- package/lib/components/fields/ArrayBulkField.d.ts +0 -23
- package/lib/components/fields/ArrayBulkField.js +0 -82
- package/lib/components/fields/ArrayCombinerField.d.ts +0 -36
- package/lib/components/fields/ArrayCombinerField.js +0 -138
- package/lib/components/fields/ArrayField.d.ts +0 -39
- package/lib/components/fields/ArrayField.js +0 -148
- package/lib/components/fields/AudioArrayField.d.ts +0 -22
- package/lib/components/fields/AudioArrayField.js +0 -100
- package/lib/components/fields/AutoArrayField.d.ts +0 -24
- package/lib/components/fields/AutoArrayField.js +0 -56
- package/lib/components/fields/AutosuggestField.d.ts +0 -69
- package/lib/components/fields/AutosuggestField.js +0 -299
- package/lib/components/fields/CombinedValueDisplayField.d.ts +0 -41
- package/lib/components/fields/CombinedValueDisplayField.js +0 -100
- package/lib/components/fields/ConditionalOnChangeField.d.ts +0 -42
- package/lib/components/fields/ConditionalOnChangeField.js +0 -107
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +0 -123
- package/lib/components/fields/ConditionalUiSchemaField.js +0 -143
- package/lib/components/fields/ContextInjectionField.d.ts +0 -24
- package/lib/components/fields/ContextInjectionField.js +0 -68
- package/lib/components/fields/DataLeakerField.d.ts +0 -40
- package/lib/components/fields/DataLeakerField.js +0 -68
- package/lib/components/fields/DefaultValueArrayField.d.ts +0 -34
- package/lib/components/fields/DefaultValueArrayField.js +0 -59
- package/lib/components/fields/DependentBooleanField.d.ts +0 -38
- package/lib/components/fields/DependentBooleanField.js +0 -87
- package/lib/components/fields/DependentDisableField.d.ts +0 -35
- package/lib/components/fields/DependentDisableField.js +0 -71
- package/lib/components/fields/EnumRangeArrayField.d.ts +0 -27
- package/lib/components/fields/EnumRangeArrayField.js +0 -115
- package/lib/components/fields/ExtraLabelRowField.d.ts +0 -38
- package/lib/components/fields/ExtraLabelRowField.js +0 -100
- package/lib/components/fields/FakePropertyField.d.ts +0 -18
- package/lib/components/fields/FakePropertyField.js +0 -48
- package/lib/components/fields/FilterArrayField.d.ts +0 -73
- package/lib/components/fields/FilterArrayField.js +0 -121
- package/lib/components/fields/FlatField.d.ts +0 -29
- package/lib/components/fields/FlatField.js +0 -171
- package/lib/components/fields/GeocoderField.d.ts +0 -47
- package/lib/components/fields/GeocoderField.js +0 -372
- package/lib/components/fields/GridLayoutField.d.ts +0 -18
- package/lib/components/fields/GridLayoutField.js +0 -32
- package/lib/components/fields/HiddenField.d.ts +0 -10
- package/lib/components/fields/HiddenField.js +0 -11
- package/lib/components/fields/ImageArrayField.d.ts +0 -172
- package/lib/components/fields/ImageArrayField.js +0 -697
- package/lib/components/fields/ImageDisplayField.d.ts +0 -18
- package/lib/components/fields/ImageDisplayField.js +0 -44
- package/lib/components/fields/InitiallyHiddenField.d.ts +0 -21
- package/lib/components/fields/InitiallyHiddenField.js +0 -58
- package/lib/components/fields/InjectDefaultValueField.d.ts +0 -37
- package/lib/components/fields/InjectDefaultValueField.js +0 -68
- package/lib/components/fields/InjectField.d.ts +0 -46
- package/lib/components/fields/InjectField.js +0 -88
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +0 -25
- package/lib/components/fields/InputWithDefaultValueButtonField.js +0 -61
- package/lib/components/fields/LocalityField.d.ts +0 -22
- package/lib/components/fields/LocalityField.js +0 -94
- package/lib/components/fields/LocationChooserField.d.ts +0 -27
- package/lib/components/fields/LocationChooserField.js +0 -440
- package/lib/components/fields/MapArrayField.d.ts +0 -78
- package/lib/components/fields/MapArrayField.js +0 -1783
- package/lib/components/fields/MapField.d.ts +0 -48
- package/lib/components/fields/MapField.js +0 -434
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +0 -25
- package/lib/components/fields/MultiAnyToBooleanField.js +0 -100
- package/lib/components/fields/MultiArrayField.d.ts +0 -53
- package/lib/components/fields/MultiArrayField.js +0 -224
- package/lib/components/fields/MultiLanguageField.d.ts +0 -13
- package/lib/components/fields/MultiLanguageField.js +0 -52
- package/lib/components/fields/MultiTagArrayField.d.ts +0 -36
- package/lib/components/fields/MultiTagArrayField.js +0 -142
- package/lib/components/fields/NamedPlaceChooserField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceChooserField.js +0 -380
- package/lib/components/fields/NamedPlaceSaverField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceSaverField.js +0 -237
- package/lib/components/fields/NestField.d.ts +0 -148
- package/lib/components/fields/NestField.js +0 -289
- package/lib/components/fields/ObjectField.d.ts +0 -2
- package/lib/components/fields/ObjectField.js +0 -119
- package/lib/components/fields/PdfArrayField.d.ts +0 -21
- package/lib/components/fields/PdfArrayField.js +0 -40
- package/lib/components/fields/PrefillingArrayField.d.ts +0 -22
- package/lib/components/fields/PrefillingArrayField.js +0 -65
- package/lib/components/fields/SchemaField.d.ts +0 -7
- package/lib/components/fields/SchemaField.js +0 -109
- package/lib/components/fields/ScopeField.d.ts +0 -85
- package/lib/components/fields/ScopeField.js +0 -521
- package/lib/components/fields/SectionArrayField.d.ts +0 -38
- package/lib/components/fields/SectionArrayField.js +0 -618
- package/lib/components/fields/SelectTreeField.d.ts +0 -39
- package/lib/components/fields/SelectTreeField.js +0 -143
- package/lib/components/fields/SingleActiveArrayField.d.ts +0 -49
- package/lib/components/fields/SingleActiveArrayField.js +0 -974
- package/lib/components/fields/SingleItemArrayField.d.ts +0 -15
- package/lib/components/fields/SingleItemArrayField.js +0 -60
- package/lib/components/fields/SortArrayField.d.ts +0 -73
- package/lib/components/fields/SortArrayField.js +0 -351
- package/lib/components/fields/SplitField.d.ts +0 -28
- package/lib/components/fields/SplitField.js +0 -65
- package/lib/components/fields/StringToArrayField.d.ts +0 -24
- package/lib/components/fields/StringToArrayField.js +0 -48
- package/lib/components/fields/SumField.d.ts +0 -35
- package/lib/components/fields/SumField.js +0 -83
- package/lib/components/fields/TableField.d.ts +0 -18
- package/lib/components/fields/TableField.js +0 -136
- package/lib/components/fields/TagArrayField.d.ts +0 -38
- package/lib/components/fields/TagArrayField.js +0 -128
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -26
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +0 -81
- package/lib/components/fields/UiFieldApplierField.d.ts +0 -30
- package/lib/components/fields/UiFieldApplierField.js +0 -106
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +0 -42
- package/lib/components/fields/UiFieldMapperArrayField.js +0 -121
- package/lib/components/fields/UnitCountShorthandField.d.ts +0 -22
- package/lib/components/fields/UnitCountShorthandField.js +0 -149
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +0 -26
- package/lib/components/fields/UnitListShorthandArrayField.js +0 -108
- package/lib/components/fields/UnitShorthandField.d.ts +0 -32
- package/lib/components/fields/UnitShorthandField.js +0 -220
- package/lib/components/templates/ArrayFieldTemplate.d.ts +0 -85
- package/lib/components/templates/ArrayFieldTemplate.js +0 -417
- package/lib/components/templates/BaseInputTemplate.d.ts +0 -11
- package/lib/components/templates/BaseInputTemplate.js +0 -80
- package/lib/components/templates/DescriptionField.d.ts +0 -1
- package/lib/components/templates/DescriptionField.js +0 -37
- package/lib/components/templates/ErrorListTemplate.d.ts +0 -9
- package/lib/components/templates/ErrorListTemplate.js +0 -95
- package/lib/components/templates/FieldTemplate.d.ts +0 -6
- package/lib/components/templates/FieldTemplate.js +0 -112
- package/lib/components/templates/ObjectFieldTemplate.d.ts +0 -7
- package/lib/components/templates/ObjectFieldTemplate.js +0 -66
- package/lib/components/templates/TitleField.d.ts +0 -9
- package/lib/components/templates/TitleField.js +0 -51
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +0 -20
- package/lib/components/widgets/AnyToBooleanWidget.js +0 -49
- package/lib/components/widgets/AutosuggestWidget.d.ts +0 -66
- package/lib/components/widgets/AutosuggestWidget.js +0 -1127
- package/lib/components/widgets/CheckboxWidget.d.ts +0 -37
- package/lib/components/widgets/CheckboxWidget.js +0 -139
- package/lib/components/widgets/DateTimeWidget.d.ts +0 -62
- package/lib/components/widgets/DateTimeWidget.js +0 -251
- package/lib/components/widgets/DateWidget.d.ts +0 -23
- package/lib/components/widgets/DateWidget.js +0 -41
- package/lib/components/widgets/HiddenWidget.d.ts +0 -15
- package/lib/components/widgets/HiddenWidget.js +0 -19
- package/lib/components/widgets/ImageSelectWidget.d.ts +0 -14
- package/lib/components/widgets/ImageSelectWidget.js +0 -57
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +0 -43
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +0 -237
- package/lib/components/widgets/InputGroupWidget.d.ts +0 -21
- package/lib/components/widgets/InputGroupWidget.js +0 -36
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +0 -21
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +0 -47
- package/lib/components/widgets/NumberWidget.d.ts +0 -13
- package/lib/components/widgets/NumberWidget.js +0 -21
- package/lib/components/widgets/PlainTextWidget.d.ts +0 -12
- package/lib/components/widgets/PlainTextWidget.js +0 -24
- package/lib/components/widgets/SelectWidget.d.ts +0 -52
- package/lib/components/widgets/SelectWidget.js +0 -158
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +0 -19
- package/lib/components/widgets/SeparatedDateTimeWidget.js +0 -59
- package/lib/components/widgets/TaxonImageWidget.d.ts +0 -13
- package/lib/components/widgets/TaxonImageWidget.js +0 -30
- package/lib/components/widgets/TextSelectWidget.d.ts +0 -25
- package/lib/components/widgets/TextSelectWidget.js +0 -94
- package/lib/components/widgets/TextareaWidget.d.ts +0 -32
- package/lib/components/widgets/TextareaWidget.js +0 -87
- package/lib/components/widgets/TimeWidget.d.ts +0 -11
- package/lib/components/widgets/TimeWidget.js +0 -19
- package/lib/components/widgets/URLWidget.d.ts +0 -14
- package/lib/components/widgets/URLWidget.js +0 -12
- package/lib/components/widgets/UpperCaseWidget.d.ts +0 -13
- package/lib/components/widgets/UpperCaseWidget.js +0 -21
- package/lib/index.d.ts +0 -20
- package/lib/index.js +0 -50
- package/lib/services/blocker-service.d.ts +0 -11
- package/lib/services/blocker-service.js +0 -55
- package/lib/services/custom-event-service.d.ts +0 -17
- package/lib/services/custom-event-service.js +0 -35
- package/lib/services/dom-id-service.d.ts +0 -8
- package/lib/services/dom-id-service.js +0 -30
- package/lib/services/focus-service.d.ts +0 -13
- package/lib/services/focus-service.js +0 -60
- package/lib/services/id-service.d.ts +0 -22
- package/lib/services/id-service.js +0 -130
- package/lib/services/key-handler-service.d.ts +0 -56
- package/lib/services/key-handler-service.js +0 -184
- package/lib/services/root-instance-service.d.ts +0 -25
- package/lib/services/root-instance-service.js +0 -49
- package/lib/services/settings-service.d.ts +0 -34
- package/lib/services/settings-service.js +0 -154
- package/lib/services/singleton-map-service.d.ts +0 -23
- package/lib/services/singleton-map-service.js +0 -44
- package/lib/services/submit-hook-service.d.ts +0 -24
- package/lib/services/submit-hook-service.js +0 -73
- package/lib/styles.js +0 -4
- package/lib/themes/bs3.d.ts +0 -3
- package/lib/themes/bs3.js +0 -133
- package/lib/themes/bs5.d.ts +0 -3
- package/lib/themes/bs5.js +0 -111
- package/lib/themes/glyphicon-fa-mapping.d.ts +0 -3
- package/lib/themes/glyphicon-fa-mapping.js +0 -271
- package/lib/themes/stub.d.ts +0 -3
- package/lib/themes/stub.js +0 -82
- package/lib/themes/theme.d.ts +0 -233
- package/lib/themes/theme.js +0 -2
- package/lib/translations.json +0 -847
- package/lib/utils.d.ts +0 -171
- package/lib/utils.js +0 -1191
- package/lib/validation.d.ts +0 -7
- package/lib/validation.js +0 -141
- package/llol +0 -10
- package/llol.pdf +0 -10
- package/playwright-report/index.html +0 -62
- package/q +0 -196
- package/rename.sh +0 -24
- package/trip-report.spec.ts +0 -594
- /package/{lib/styles.d.ts → test-export/array-spec.d.ts} +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const React = require("react");
|
|
10
|
-
const PropTypes = require("prop-types");
|
|
11
|
-
const ConditionalUiSchemaField_1 = require("./ConditionalUiSchemaField");
|
|
12
|
-
const FilterArrayField_1 = require("./FilterArrayField");
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
15
|
-
const Context_1 = require("../../Context");
|
|
16
|
-
const ArrayFieldTemplate_1 = require("../templates/ArrayFieldTemplate");
|
|
17
|
-
let MultiArrayField = class MultiArrayField extends React.Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.itemIds = {};
|
|
21
|
-
this.onChange = (idx) => (formData) => {
|
|
22
|
-
let offset = 0;
|
|
23
|
-
for (let i = 0; i < idx; i++) {
|
|
24
|
-
offset += Object.keys(this.groupedItems[i]).length;
|
|
25
|
-
}
|
|
26
|
-
let { persistenceKey } = utils_1.getUiOptions(this.props.uiSchema);
|
|
27
|
-
const lengthChange = formData.length - this.groupedItems[idx].length;
|
|
28
|
-
const context = Context_1.default(`${persistenceKey}_MULTI`);
|
|
29
|
-
// Fix idxs map for items after this group.
|
|
30
|
-
if (lengthChange && context.nonGroupedMap) {
|
|
31
|
-
const changes = {};
|
|
32
|
-
const changeFrom = {};
|
|
33
|
-
for (let i = offset + Object.keys(this.groupedItems[idx]).length; i < (this.props.formData || []).length; i++) {
|
|
34
|
-
if (context.nonGroupedMap[i]) {
|
|
35
|
-
changes[i + lengthChange] = context.nonGroupedMap[i];
|
|
36
|
-
changeFrom[i] = true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
context.nonGroupedMap = Object.assign(Object.assign({}, context.nonGroupedMap), changes);
|
|
40
|
-
Object.keys(changeFrom).filter(idx => !(idx in changes)).forEach(idx => {
|
|
41
|
-
delete context.nonGroupedMap[idx];
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (typeof persistenceKey === "string" && formData.length !== this.groupedItems[idx].length) {
|
|
45
|
-
if (!context.nonGroupedMap) {
|
|
46
|
-
context.nonGroupedMap = {};
|
|
47
|
-
}
|
|
48
|
-
context.nonGroupedMap[offset + formData.length - 1] = idx;
|
|
49
|
-
}
|
|
50
|
-
formData.forEach(item => {
|
|
51
|
-
this.groupItemIds[idx][utils_1.getUUID(item)] = true;
|
|
52
|
-
});
|
|
53
|
-
const newFormData = this.groupedItems.reduce((flat, groupItems, _idx) => {
|
|
54
|
-
if (_idx === idx)
|
|
55
|
-
return [...flat, ...formData];
|
|
56
|
-
return [...flat, ...groupItems];
|
|
57
|
-
}, []);
|
|
58
|
-
this.props.onChange(newFormData);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
const { props } = this;
|
|
63
|
-
let { groups, cache = true, arrayMerge, persistByParent, persistenceKey, renderNonGrouped = false, nonGroupedOperations } = utils_1.getUiOptions(this.props.uiSchema);
|
|
64
|
-
if (groups.length && !this.cache) {
|
|
65
|
-
this.cache = Array(groups.length).fill(undefined).map(_ => ({})); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
66
|
-
}
|
|
67
|
-
if (groups.length) {
|
|
68
|
-
this.arrayKeyFunctions = Array(groups.length + 1).fill(undefined).map((_, idx) => getArrayKeyFunctions(this, idx));
|
|
69
|
-
}
|
|
70
|
-
if (groups.length && !this.groupItemIds) {
|
|
71
|
-
const getGroupItemIds = () => Array(groups.length + 1).fill(undefined).map(_ => ({})); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
72
|
-
if (persistByParent) {
|
|
73
|
-
const parentId = this.props.formContext._parentLajiFormId;
|
|
74
|
-
const context = Context_1.default(`${parentId}_MULTI`);
|
|
75
|
-
this.groupItemIds = context.groupItemIds || getGroupItemIds();
|
|
76
|
-
context.groupItemIds = this.groupItemIds;
|
|
77
|
-
}
|
|
78
|
-
else if (typeof persistenceKey === "string") {
|
|
79
|
-
const context = Context_1.default(`${persistenceKey}_MULTI`);
|
|
80
|
-
this.groupItemIds = context.groupItemIds || getGroupItemIds();
|
|
81
|
-
context.groupItemIds = this.groupItemIds;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.groupItemIds = getGroupItemIds();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const itemGroups = Array(groups.length + 1).fill(undefined).map(_ => []); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
88
|
-
const addToGroup = (idx, item) => {
|
|
89
|
-
const id = utils_1.getUUID(item);
|
|
90
|
-
itemGroups[idx].push(item);
|
|
91
|
-
this.groupItemIds[idx][id] = true;
|
|
92
|
-
this.itemIds[id] = true;
|
|
93
|
-
return true;
|
|
94
|
-
};
|
|
95
|
-
(props.formData || []).forEach(item => {
|
|
96
|
-
this.groupItemIds.forEach((_, groupIdx) => {
|
|
97
|
-
if (this.groupItemIds[groupIdx][utils_1.getUUID(item)]) {
|
|
98
|
-
addToGroup(groupIdx, item);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
const nonGrouped = [];
|
|
103
|
-
const groupedItems = (props.formData || []).reduce((itemGroups, item, idx) => {
|
|
104
|
-
const addedToGroup = groups.some((group, groupIdx) => {
|
|
105
|
-
if (this.itemIds[utils_1.getUUID(item)]) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
const { rules = [] } = group;
|
|
109
|
-
let passes;
|
|
110
|
-
if (cache) {
|
|
111
|
-
const check = utils_1.checkArrayRules(rules, { formData: props.formData || [] }, idx, this.cache[groupIdx]);
|
|
112
|
-
const { cache } = check;
|
|
113
|
-
passes = check.passes;
|
|
114
|
-
this.cache[groupIdx] = cache;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
passes = utils_1.checkArrayRules(rules, { formData: props.formData || [] }, idx);
|
|
118
|
-
}
|
|
119
|
-
if (passes) {
|
|
120
|
-
return addToGroup(groupIdx, item);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
if (!addedToGroup) {
|
|
124
|
-
nonGrouped.push([item, idx]);
|
|
125
|
-
}
|
|
126
|
-
return itemGroups;
|
|
127
|
-
}, itemGroups);
|
|
128
|
-
nonGrouped.forEach(([item, idx]) => {
|
|
129
|
-
const context = Context_1.default(`${persistenceKey}_MULTI`);
|
|
130
|
-
const groupIdx = this.groupItemIds.length - 1;
|
|
131
|
-
if (typeof persistenceKey === "string" && (context.nonGroupedMap || {})[idx] !== undefined && this.groupItemIds[groupIdx]) {
|
|
132
|
-
addToGroup(context.nonGroupedMap[idx], item);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
addToGroup(groupIdx, item);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
this.groupedItems = groupedItems;
|
|
139
|
-
const withoutNonGrouped = [...groupedItems];
|
|
140
|
-
withoutNonGrouped.pop();
|
|
141
|
-
let offset = 0;
|
|
142
|
-
const offsets = (renderNonGrouped ? groupedItems : withoutNonGrouped).map((group, idx) => {
|
|
143
|
-
let idxOffsets;
|
|
144
|
-
if (!idx) {
|
|
145
|
-
idxOffsets = {};
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
idxOffsets = group.reduce((g, i, _idx) => {
|
|
149
|
-
g[_idx] = offset;
|
|
150
|
-
return g;
|
|
151
|
-
}, {});
|
|
152
|
-
}
|
|
153
|
-
offset += group.length;
|
|
154
|
-
return idxOffsets;
|
|
155
|
-
}, []);
|
|
156
|
-
return (renderNonGrouped ? groupedItems : withoutNonGrouped).map((items, idx) => {
|
|
157
|
-
const operations = renderNonGrouped && idx === groupedItems.length - 1
|
|
158
|
-
? nonGroupedOperations
|
|
159
|
-
: groups[idx].operations;
|
|
160
|
-
const innerUiSchema = utils_1.getInnerUiSchema(props.uiSchema);
|
|
161
|
-
let uiSchema = operations
|
|
162
|
-
? ConditionalUiSchemaField_1.computeUiSchema(innerUiSchema, operations, arrayMerge)
|
|
163
|
-
: innerUiSchema;
|
|
164
|
-
uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, this.arrayKeyFunctions[idx], "/ui:options/arrayKeyFunctions");
|
|
165
|
-
uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, offsets[idx], "/ui:options/idxOffsets");
|
|
166
|
-
let offset = 0;
|
|
167
|
-
for (let i = 0; i < idx; i++) {
|
|
168
|
-
offset += this.groupedItems[i].length;
|
|
169
|
-
}
|
|
170
|
-
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:options": Object.assign(Object.assign({}, utils_1.getUiOptions(uiSchema)), { startIdx: offset }) });
|
|
171
|
-
const errorSchema = {};
|
|
172
|
-
for (const key in props.errorSchema) {
|
|
173
|
-
if (key >= offset && key < offset + this.groupedItems[idx].length) {
|
|
174
|
-
errorSchema[key - offset] = Object.assign({}, props.errorSchema[key]);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const { SchemaField } = this.props.registry.fields;
|
|
178
|
-
return (React.createElement(SchemaField, Object.assign({ key: idx }, props, { uiSchema: uiSchema, errorSchema: errorSchema, formData: items, onChange: this.onChange(idx) })));
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
MultiArrayField.propTypes = {
|
|
183
|
-
uiSchema: PropTypes.shape({
|
|
184
|
-
"ui:options": PropTypes.shape({
|
|
185
|
-
rules: FilterArrayField_1.arrayRulesPropType,
|
|
186
|
-
itemsOperations: PropTypes.oneOfType([
|
|
187
|
-
ConditionalUiSchemaField_1.operationPropType,
|
|
188
|
-
PropTypes.arrayOf(ConditionalUiSchemaField_1.operationPropType)
|
|
189
|
-
]),
|
|
190
|
-
cache: PropTypes.boolean
|
|
191
|
-
})
|
|
192
|
-
}),
|
|
193
|
-
schema: PropTypes.shape({
|
|
194
|
-
type: PropTypes.oneOf(["array"])
|
|
195
|
-
}).isRequired,
|
|
196
|
-
formData: PropTypes.array
|
|
197
|
-
};
|
|
198
|
-
MultiArrayField = __decorate([
|
|
199
|
-
BaseComponent_1.default
|
|
200
|
-
], MultiArrayField);
|
|
201
|
-
exports.default = MultiArrayField;
|
|
202
|
-
const getArrayKeyFunctions = (that) => {
|
|
203
|
-
const { arrayKeyFunctions: optionsArrayKeyFunctions } = utils_1.getUiOptions(that.props.uiSchema);
|
|
204
|
-
const _arrayKeyFunctions = optionsArrayKeyFunctions || ArrayFieldTemplate_1.arrayKeyFunctions;
|
|
205
|
-
return Object.assign(Object.assign({}, _arrayKeyFunctions), { insert: (e, _props) => {
|
|
206
|
-
const props = _props.getProps();
|
|
207
|
-
const inputElem = utils_1.findNearestParentTabbableElem(document.activeElement);
|
|
208
|
-
if (!inputElem) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
if (!inputElem.id.startsWith(props.idSchema.$id)) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
const itemIdx = inputElem.id.replace(props.idSchema.$id, "").replace(/^_?([0-9]+).*$/, "$1");
|
|
215
|
-
const { startIdx } = utils_1.getUiOptions(props.uiSchema);
|
|
216
|
-
if (itemIdx < startIdx || itemIdx >= startIdx + (props.formData || []).length) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
return _arrayKeyFunctions.insert(e, _props);
|
|
220
|
-
}, navigateArray: (e, options) => {
|
|
221
|
-
const _options = Object.assign(Object.assign({}, options), { getProps: () => (Object.assign(Object.assign({}, options.getProps()), { formData: that.props.formData })) });
|
|
222
|
-
return _arrayKeyFunctions.navigateArray(e, _options);
|
|
223
|
-
} });
|
|
224
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default class MultiLanguageField extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Requireable<any>;
|
|
4
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
5
|
-
type: PropTypes.Requireable<string>;
|
|
6
|
-
}>>;
|
|
7
|
-
formData: PropTypes.Requireable<object>;
|
|
8
|
-
};
|
|
9
|
-
constructor(props: any);
|
|
10
|
-
onChange: (lang: any) => (formData: any) => void;
|
|
11
|
-
}
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const React = require("react");
|
|
10
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
11
|
-
const PropTypes = require("prop-types");
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
let MultiLanguageField = class MultiLanguageField extends React.Component {
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(props);
|
|
16
|
-
this.onChange = (lang) => (formData) => {
|
|
17
|
-
const newFormData = Object.assign(Object.assign({}, this.props.formData), { [lang]: formData });
|
|
18
|
-
this.props.onChange(newFormData);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
const SchemaField = this.props.registry.fields.SchemaField;
|
|
23
|
-
const { Label, lang } = this.props.formContext;
|
|
24
|
-
const { schema, uiSchema, idSchema, errorSchema, formData = {}, required } = this.props;
|
|
25
|
-
const uiOptions = utils_1.getUiOptions(uiSchema);
|
|
26
|
-
const languages = Object.keys(schema.properties).sort((a, b) => {
|
|
27
|
-
const sortA = Number(a !== lang);
|
|
28
|
-
const sortB = Number(b !== lang);
|
|
29
|
-
return sortA - sortB;
|
|
30
|
-
});
|
|
31
|
-
return (React.createElement(React.Fragment, null,
|
|
32
|
-
React.createElement(Label, { label: schema.title || "", required: required || uiSchema["ui:required"], uiSchema: uiSchema }),
|
|
33
|
-
languages.map(_lang => {
|
|
34
|
-
var _a;
|
|
35
|
-
return (React.createElement(SchemaField, Object.assign({}, this.props, { key: _lang, schema: Object.assign({ title: "" }, schema.properties[_lang]), uiSchema: {
|
|
36
|
-
"ui:widget": "InputGroupWidget",
|
|
37
|
-
"ui:options": Object.assign({ "inputGroupText": _lang, "className": "multi-lang-input-group" }, uiOptions)
|
|
38
|
-
}, errorSchema: errorSchema[_lang] || {}, idSchema: idSchema[_lang], formData: formData[_lang] || "", required: ((_a = uiSchema[_lang]) === null || _a === void 0 ? void 0 : _a["ui:required"]) || false, onChange: this.onChange(_lang) })));
|
|
39
|
-
})));
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
MultiLanguageField.propTypes = {
|
|
43
|
-
uiSchema: PropTypes.any,
|
|
44
|
-
schema: PropTypes.shape({
|
|
45
|
-
type: PropTypes.oneOf(["object"])
|
|
46
|
-
}).isRequired,
|
|
47
|
-
formData: PropTypes.object
|
|
48
|
-
};
|
|
49
|
-
MultiLanguageField = __decorate([
|
|
50
|
-
BaseComponent_1.default
|
|
51
|
-
], MultiLanguageField);
|
|
52
|
-
exports.default = MultiLanguageField;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as PropTypes from "prop-types";
|
|
3
|
-
import { FieldProps } from "../LajiForm";
|
|
4
|
-
import { ReactInstance } from "react";
|
|
5
|
-
import * as memoize from "memoizee";
|
|
6
|
-
interface State {
|
|
7
|
-
activeButtonIdx?: number;
|
|
8
|
-
}
|
|
9
|
-
export default class MultiTagArrayField extends React.Component<FieldProps, State> {
|
|
10
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
11
|
-
static propTypes: {
|
|
12
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
13
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
14
|
-
buttons: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
15
|
-
operation: PropTypes.Requireable<string>;
|
|
16
|
-
label: PropTypes.Requireable<string>;
|
|
17
|
-
className: PropTypes.Requireable<string>;
|
|
18
|
-
}> | null | undefined)[]>;
|
|
19
|
-
}>>;
|
|
20
|
-
}>>;
|
|
21
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
22
|
-
type: PropTypes.Requireable<string>;
|
|
23
|
-
}>>;
|
|
24
|
-
formData: PropTypes.Requireable<object>;
|
|
25
|
-
};
|
|
26
|
-
state: State;
|
|
27
|
-
private affixContainerElem;
|
|
28
|
-
setAffixContainer: (ref: ReactInstance) => void;
|
|
29
|
-
getAffixContainer: () => Element | null;
|
|
30
|
-
componentDidUpdate(prevProps: FieldProps): void;
|
|
31
|
-
render(): JSX.Element;
|
|
32
|
-
onChange: ((key: string) => (formData: any) => void) & memoize.Memoized<(key: string) => (formData: any) => void>;
|
|
33
|
-
onButtonClick: ((idx: number) => () => void) & memoize.Memoized<(idx: number) => () => void>;
|
|
34
|
-
onTagClick: ((fromField: string) => (idx: number) => void) & memoize.Memoized<(fromField: string) => (idx: number) => void>;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const React = require("react");
|
|
10
|
-
const PropTypes = require("prop-types");
|
|
11
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
14
|
-
const components_1 = require("../components");
|
|
15
|
-
const immutability_helper_1 = require("immutability-helper");
|
|
16
|
-
const memoize = require("memoizee");
|
|
17
|
-
const react_dom_1 = require("react-dom");
|
|
18
|
-
const equals = require("deep-equal");
|
|
19
|
-
let MultiTagArrayField = class MultiTagArrayField extends React.Component {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.state = { activeButtonIdx: undefined };
|
|
23
|
-
this.affixContainerElem = null;
|
|
24
|
-
this.setAffixContainer = (ref) => {
|
|
25
|
-
this.affixContainerElem = react_dom_1.findDOMNode(ref);
|
|
26
|
-
};
|
|
27
|
-
this.getAffixContainer = () => {
|
|
28
|
-
return this.affixContainerElem;
|
|
29
|
-
};
|
|
30
|
-
this.onChange = memoize((key) => (formData) => {
|
|
31
|
-
const newFormData = Object.assign(Object.assign({}, this.props.formData), { [key]: formData });
|
|
32
|
-
this.props.onChange(newFormData);
|
|
33
|
-
});
|
|
34
|
-
this.onButtonClick = memoize((idx) => () => {
|
|
35
|
-
const { activeButtonIdx } = this.state;
|
|
36
|
-
if (activeButtonIdx === idx) {
|
|
37
|
-
this.setState({ activeButtonIdx: undefined });
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const { buttons = [] } = utils_1.getUiOptions(this.props.uiSchema);
|
|
41
|
-
const options = buttons[idx];
|
|
42
|
-
const { operation } = options;
|
|
43
|
-
if (operation === "moveAll") {
|
|
44
|
-
const { toField, fromField } = options;
|
|
45
|
-
const toFieldNewValue = (this.props.formData[toField] || []).concat(this.props.formData[fromField] || []);
|
|
46
|
-
const newFormData = Object.assign(Object.assign({}, this.props.formData), { [fromField]: [], [toField]: toFieldNewValue });
|
|
47
|
-
this.props.onChange(newFormData);
|
|
48
|
-
}
|
|
49
|
-
else if (operation === "move" || operation === "delete") {
|
|
50
|
-
this.setState({ activeButtonIdx: idx });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
this.onTagClick = memoize((fromField) => (idx) => {
|
|
54
|
-
const { activeButtonIdx } = this.state;
|
|
55
|
-
if (activeButtonIdx === undefined) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const { buttons = [] } = utils_1.getUiOptions(this.props.uiSchema);
|
|
59
|
-
const options = buttons[activeButtonIdx];
|
|
60
|
-
const { operation } = options;
|
|
61
|
-
if (operation === "move" || operation === "delete") {
|
|
62
|
-
let formData = this.props.formData;
|
|
63
|
-
if (operation === "move") {
|
|
64
|
-
const { toField } = options;
|
|
65
|
-
if (fromField === toField) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const value = formData[fromField][idx];
|
|
69
|
-
formData = immutability_helper_1.default(formData, {
|
|
70
|
-
[fromField]: { $splice: [[idx, 1]] },
|
|
71
|
-
[toField]: { $apply: (values) => [...(values || []), value] }
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
formData = immutability_helper_1.default(formData, { [fromField]: { $splice: [[idx, 1]] } });
|
|
76
|
-
}
|
|
77
|
-
this.props.onChange(formData);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
componentDidUpdate(prevProps) {
|
|
82
|
-
if (this.state.activeButtonIdx !== undefined) {
|
|
83
|
-
const prevButtons = utils_1.getUiOptions(prevProps.uiSchema).buttons;
|
|
84
|
-
const currentButtons = utils_1.getUiOptions(this.props.uiSchema).buttons;
|
|
85
|
-
if (!equals(prevButtons, currentButtons)) {
|
|
86
|
-
this.setState({ activeButtonIdx: undefined });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
render() {
|
|
91
|
-
const SchemaField = this.props.registry.fields.SchemaField;
|
|
92
|
-
const { Row, Col } = this.context.theme;
|
|
93
|
-
const { schema, uiSchema, idSchema, errorSchema, formData = {}, disabled, readonly } = this.props;
|
|
94
|
-
const uiOptions = utils_1.getUiOptions(uiSchema);
|
|
95
|
-
const { buttons = [] } = uiOptions;
|
|
96
|
-
const { activeButtonIdx } = this.state;
|
|
97
|
-
const propertyKeys = Object.keys(schema.properties);
|
|
98
|
-
return (React.createElement(Row, { className: utils_1.classNames("laji-form-multi-tag-array-field", activeButtonIdx !== undefined && "laji-form-multi-tag-array-field-active"), ref: this.setAffixContainer },
|
|
99
|
-
React.createElement(Col, { xs: 3, sm: 3, md: 2, lg: 2, className: "laji-form-multi-tag-array-field-buttons" },
|
|
100
|
-
React.createElement(components_1.Affix, { getContainer: this.getAffixContainer, topOffset: this.props.formContext.topOffset + 15, bottomOffset: this.props.formContext.bottomOffset },
|
|
101
|
-
React.createElement("div", { className: "btn-group-vertical" }, buttons.map((btnProps, idx) => (React.createElement(components_1.Button, { key: idx, onClick: this.onButtonClick(idx), variant: btnProps.operation === "delete" ? "outline-danger" : "default", className: utils_1.classNames(btnProps.className, activeButtonIdx === idx ? "active" : ""), disabled: disabled || readonly }, btnProps.label)))))),
|
|
102
|
-
React.createElement(Col, { xs: 9, sm: 9, md: 10, lg: 10, className: "laji-form-multi-tag-array-field-content" }, propertyKeys.map(key => {
|
|
103
|
-
var _a, _b;
|
|
104
|
-
return (React.createElement(SchemaField, Object.assign({}, this.props, { key: key, schema: Object.assign({ title: "" }, schema.properties[key]), uiSchema: Object.assign(Object.assign({ "ui:field": "TagArrayField" }, uiSchema[key]), { "ui:options": Object.assign(Object.assign(Object.assign({}, uiOptions), { buttons: undefined, onTagClick: this.onTagClick(key) }), (_a = uiSchema[key]) === null || _a === void 0 ? void 0 : _a["ui:options"]) }), errorSchema: errorSchema[key] || {}, idSchema: idSchema[key], formData: formData[key] || [], required: ((_b = uiSchema[key]) === null || _b === void 0 ? void 0 : _b["ui:required"]) || false, onChange: this.onChange(key) })));
|
|
105
|
-
}))));
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
MultiTagArrayField.contextType = ReactContext_1.default;
|
|
109
|
-
MultiTagArrayField.propTypes = {
|
|
110
|
-
uiSchema: PropTypes.shape({
|
|
111
|
-
"ui:options": PropTypes.shape({
|
|
112
|
-
buttons: PropTypes.arrayOf(PropTypes.oneOfType([
|
|
113
|
-
PropTypes.shape({
|
|
114
|
-
operation: PropTypes.oneOf(["moveAll"]),
|
|
115
|
-
fromField: PropTypes.string.isRequired,
|
|
116
|
-
toField: PropTypes.string.isRequired,
|
|
117
|
-
label: PropTypes.string,
|
|
118
|
-
className: PropTypes.string
|
|
119
|
-
}),
|
|
120
|
-
PropTypes.shape({
|
|
121
|
-
operation: PropTypes.oneOf(["move"]),
|
|
122
|
-
toField: PropTypes.string.isRequired,
|
|
123
|
-
label: PropTypes.string,
|
|
124
|
-
className: PropTypes.string
|
|
125
|
-
}),
|
|
126
|
-
PropTypes.shape({
|
|
127
|
-
operation: PropTypes.oneOf(["delete"]),
|
|
128
|
-
label: PropTypes.string,
|
|
129
|
-
className: PropTypes.string
|
|
130
|
-
})
|
|
131
|
-
]))
|
|
132
|
-
})
|
|
133
|
-
}),
|
|
134
|
-
schema: PropTypes.shape({
|
|
135
|
-
type: PropTypes.oneOf(["object"])
|
|
136
|
-
}).isRequired,
|
|
137
|
-
formData: PropTypes.object
|
|
138
|
-
};
|
|
139
|
-
MultiTagArrayField = __decorate([
|
|
140
|
-
BaseComponent_1.default
|
|
141
|
-
], MultiTagArrayField);
|
|
142
|
-
exports.default = MultiTagArrayField;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compatible only with gatherings array and gathering object.
|
|
3
|
-
*/
|
|
4
|
-
export default class NamedPlaceChooserField extends React.Component<any, any, any> {
|
|
5
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
6
|
-
static propTypes: {
|
|
7
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
8
|
-
type: PropTypes.Requireable<string>;
|
|
9
|
-
}>>;
|
|
10
|
-
formData: PropTypes.Requireable<object>;
|
|
11
|
-
};
|
|
12
|
-
constructor(props: any);
|
|
13
|
-
apiClient: any;
|
|
14
|
-
removeIds: {};
|
|
15
|
-
getStateFromProps(props: any): {
|
|
16
|
-
uiSchema: any;
|
|
17
|
-
};
|
|
18
|
-
getUiSchema: (props: any) => any;
|
|
19
|
-
buttonDefinition: any;
|
|
20
|
-
isGatheringsArray: () => boolean;
|
|
21
|
-
onPlaceSelected: (place: any) => void;
|
|
22
|
-
onPlaceDeleted: (place: any, success: any) => void;
|
|
23
|
-
onButtonClick: () => () => void;
|
|
24
|
-
updatePlaces: () => void;
|
|
25
|
-
mounted: boolean | undefined;
|
|
26
|
-
onHide: () => void;
|
|
27
|
-
}
|
|
28
|
-
import * as React from "react";
|
|
29
|
-
import * as PropTypes from "prop-types";
|