@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,35 +0,0 @@
|
|
|
1
|
-
export default class SumField extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
|
-
sums: PropTypes.Validator<PropTypes.InferProps<{
|
|
6
|
-
resultField: PropTypes.Validator<string>;
|
|
7
|
-
summedFields: PropTypes.Validator<(string | null | undefined)[]>;
|
|
8
|
-
summedProperty: PropTypes.Requireable<string>;
|
|
9
|
-
}> | (PropTypes.InferProps<{
|
|
10
|
-
resultField: PropTypes.Validator<string>;
|
|
11
|
-
summedFields: PropTypes.Validator<(string | null | undefined)[]>;
|
|
12
|
-
summedProperty: PropTypes.Requireable<string>;
|
|
13
|
-
}> | null | undefined)[]>;
|
|
14
|
-
}>>;
|
|
15
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
16
|
-
}>>;
|
|
17
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
18
|
-
type: PropTypes.Requireable<string>;
|
|
19
|
-
}>>;
|
|
20
|
-
formData: PropTypes.Validator<object>;
|
|
21
|
-
};
|
|
22
|
-
static getName(): string;
|
|
23
|
-
constructor(props: any);
|
|
24
|
-
constructor(props: any, context: any);
|
|
25
|
-
getStateFromProps({ formData }: {
|
|
26
|
-
formData: any;
|
|
27
|
-
}): {
|
|
28
|
-
prevResult: {};
|
|
29
|
-
onChange: (formData: any) => void;
|
|
30
|
-
};
|
|
31
|
-
onChange: (formData: any) => void;
|
|
32
|
-
getSums: (formData: any) => {};
|
|
33
|
-
}
|
|
34
|
-
import * as React from "react";
|
|
35
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,83 +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 VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
12
|
-
const sumPropType = PropTypes.shape({
|
|
13
|
-
resultField: PropTypes.string.isRequired,
|
|
14
|
-
summedFields: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
15
|
-
summedProperty: PropTypes.string
|
|
16
|
-
});
|
|
17
|
-
let SumField = class SumField extends React.Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.onChange = (formData) => {
|
|
21
|
-
let { sums } = this.getUiOptions();
|
|
22
|
-
sums = Array.isArray(sums) ? sums : [sums];
|
|
23
|
-
const newSums = this.getSums(formData);
|
|
24
|
-
sums.forEach(options => {
|
|
25
|
-
if (newSums[options.resultField] !== this.state.prevResult[options.resultField]) {
|
|
26
|
-
formData = Object.assign(Object.assign({}, formData), { [options.resultField]: newSums[options.resultField] });
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
this.props.onChange(formData);
|
|
30
|
-
};
|
|
31
|
-
this.getSums = (formData) => {
|
|
32
|
-
let { sums } = this.getUiOptions();
|
|
33
|
-
sums = Array.isArray(sums) ? sums : [sums];
|
|
34
|
-
const results = {};
|
|
35
|
-
sums.forEach(options => {
|
|
36
|
-
const { resultField, summedFields, summedProperty } = options;
|
|
37
|
-
const resultType = this.props.schema.properties[resultField].type;
|
|
38
|
-
let result = 0;
|
|
39
|
-
let allEmpty = true;
|
|
40
|
-
summedFields.forEach(field => {
|
|
41
|
-
if (formData[field] !== undefined) {
|
|
42
|
-
if (summedProperty === "arrayLength") {
|
|
43
|
-
result += formData[field].length;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
result += Number(formData[field]);
|
|
47
|
-
}
|
|
48
|
-
allEmpty = false;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
result = allEmpty || isNaN(result) ? undefined : result;
|
|
52
|
-
if (result !== undefined && resultType !== "number" && resultType !== "integer") {
|
|
53
|
-
result = result + "";
|
|
54
|
-
}
|
|
55
|
-
results[resultField] = result;
|
|
56
|
-
});
|
|
57
|
-
return results;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
static getName() { return "SumField"; }
|
|
61
|
-
getStateFromProps({ formData }) {
|
|
62
|
-
return { prevResult: this.getSums(formData), onChange: this.onChange };
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
SumField.propTypes = {
|
|
66
|
-
uiSchema: PropTypes.shape({
|
|
67
|
-
"ui:options": PropTypes.shape({
|
|
68
|
-
"sums": PropTypes.oneOfType([
|
|
69
|
-
sumPropType,
|
|
70
|
-
PropTypes.arrayOf(sumPropType)
|
|
71
|
-
]).isRequired
|
|
72
|
-
}),
|
|
73
|
-
uiSchema: PropTypes.object
|
|
74
|
-
}).isRequired,
|
|
75
|
-
schema: PropTypes.shape({
|
|
76
|
-
type: PropTypes.oneOf(["object"])
|
|
77
|
-
}).isRequired,
|
|
78
|
-
formData: PropTypes.object.isRequired
|
|
79
|
-
};
|
|
80
|
-
SumField = __decorate([
|
|
81
|
-
VirtualSchemaField_1.default
|
|
82
|
-
], SumField);
|
|
83
|
-
exports.default = SumField;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default class TableField extends React.Component<any, any, any> {
|
|
2
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
3
|
-
static propTypes: {
|
|
4
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
-
specialRules: PropTypes.Requireable<string | (string | null | undefined)[]>;
|
|
7
|
-
}>>;
|
|
8
|
-
}>>;
|
|
9
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
10
|
-
type: PropTypes.Requireable<string>;
|
|
11
|
-
items: PropTypes.Requireable<object>;
|
|
12
|
-
}>>;
|
|
13
|
-
};
|
|
14
|
-
constructor(props: any);
|
|
15
|
-
constructor(props: any, context: any);
|
|
16
|
-
}
|
|
17
|
-
import * as React from "react";
|
|
18
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,136 +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 utils_1 = require("../../utils");
|
|
12
|
-
const utils_2 = require("@rjsf/utils");
|
|
13
|
-
const components_1 = require("../components");
|
|
14
|
-
const ArrayFieldTemplate_1 = require("../templates/ArrayFieldTemplate");
|
|
15
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
16
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
17
|
-
const specialRules = {
|
|
18
|
-
legEditors: {
|
|
19
|
-
filterProperties: ({ properties, formData, uiSchemaContext }) => {
|
|
20
|
-
if (!uiSchemaContext)
|
|
21
|
-
return properties;
|
|
22
|
-
const { creator } = uiSchemaContext;
|
|
23
|
-
return (!formData ||
|
|
24
|
-
formData.some(item => item && item.leg && item.leg.match(/MA\.\d+/) && item.leg !== creator)) ? properties : properties.filter(field => field !== "editors");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const specialRulesPropTypes = PropTypes.oneOf(["legEditors"]);
|
|
29
|
-
let TableField = class TableField extends React.Component {
|
|
30
|
-
render() {
|
|
31
|
-
const { schema, uiSchema = {}, formData, registry: { fields: { ArrayField } }, formContext } = this.props;
|
|
32
|
-
const { uiSchemaContext } = formContext;
|
|
33
|
-
const schemaProps = schema.additionalItems ? schema.additionalItems.properties : schema.items.properties;
|
|
34
|
-
const options = utils_1.getUiOptions(uiSchema);
|
|
35
|
-
let schemaPropsArray = Object.keys(schemaProps);
|
|
36
|
-
const optionsSpecialRules = options.specialRules;
|
|
37
|
-
if (optionsSpecialRules) {
|
|
38
|
-
(Array.isArray(optionsSpecialRules) ? optionsSpecialRules : [optionsSpecialRules]).forEach(specialRule => {
|
|
39
|
-
schemaPropsArray = specialRules[specialRule].filterProperties({
|
|
40
|
-
properties: schemaPropsArray, uiSchema, uiSchemaContext, formData
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const schemaLength = schemaPropsArray.filter(col => !utils_1.isHidden(uiSchema.items, col)).length;
|
|
45
|
-
const defaultCol = parseInt(12 / schemaLength);
|
|
46
|
-
const defaultWrapperCol = parseInt(12 / (1 + (Object.keys(schemaProps).filter(col => !utils_1.isHidden(uiSchema.items, col)).length - schemaLength)));
|
|
47
|
-
const cols = { xs: undefined, sm: undefined, md: undefined, lg: undefined };
|
|
48
|
-
const wrapperCols = Object.assign({}, cols);
|
|
49
|
-
Object.keys(cols).forEach(col => {
|
|
50
|
-
cols[col] = options[col] ? Math.min(options[col], defaultCol) : defaultCol;
|
|
51
|
-
wrapperCols[col] = options[col] ? Math.min(options[col], defaultWrapperCol) : defaultWrapperCol;
|
|
52
|
-
});
|
|
53
|
-
const itemsSchema = schemaPropsArray.reduce((constructedSchema, prop) => {
|
|
54
|
-
constructedSchema.properties[prop] = schema.items.properties[prop];
|
|
55
|
-
return constructedSchema;
|
|
56
|
-
}, Object.assign(Object.assign({}, schema.items), { properties: {} }));
|
|
57
|
-
const itemsUiSchema = {
|
|
58
|
-
"ui:field": "GridLayoutField",
|
|
59
|
-
"ui:options": Object.assign(Object.assign({}, cols), { label: false }),
|
|
60
|
-
};
|
|
61
|
-
let _uiSchema = uiSchema;
|
|
62
|
-
if (uiSchema.items) {
|
|
63
|
-
if (uiSchema.items.uiSchema) {
|
|
64
|
-
_uiSchema = Object.assign(Object.assign({}, _uiSchema), { items: utils_1.updateTailUiSchema(uiSchema.items, { $merge: { uiSchema: itemsUiSchema } }) });
|
|
65
|
-
}
|
|
66
|
-
else if (uiSchema.items["ui:field"] || uiSchema.items["ui:functions"]) {
|
|
67
|
-
_uiSchema = Object.assign(Object.assign({}, _uiSchema), { items: Object.assign(Object.assign({}, _uiSchema.items), { uiSchema: itemsUiSchema }) });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
_uiSchema = Object.assign(Object.assign({}, _uiSchema), { items: Object.assign(Object.assign(Object.assign({}, (uiSchema.items || {})), itemsUiSchema), { "ui:options": Object.assign(Object.assign({}, utils_1.getUiOptions(uiSchema.items)), utils_1.getUiOptions(itemsUiSchema)) }) });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_uiSchema["ui:ArrayFieldTemplate"] = TableArrayFieldTemplate;
|
|
74
|
-
const _formContext = Object.assign(Object.assign({}, formContext), { cols,
|
|
75
|
-
wrapperCols,
|
|
76
|
-
schemaPropsArray });
|
|
77
|
-
return (React.createElement(ArrayField, Object.assign({}, this.props, { schema: Object.assign(Object.assign({}, schema), { items: itemsSchema }), uiSchema: _uiSchema, registry: Object.assign(Object.assign({}, this.props.registry), { formContext: _formContext }), formContext: _formContext })));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
TableField.contextType = ReactContext_1.default;
|
|
81
|
-
TableField.propTypes = {
|
|
82
|
-
uiSchema: PropTypes.shape({
|
|
83
|
-
"ui:options": PropTypes.shape({
|
|
84
|
-
specialRules: PropTypes.oneOfType([
|
|
85
|
-
specialRulesPropTypes,
|
|
86
|
-
PropTypes.arrayOf(specialRulesPropTypes)
|
|
87
|
-
])
|
|
88
|
-
})
|
|
89
|
-
}),
|
|
90
|
-
schema: PropTypes.shape({
|
|
91
|
-
type: PropTypes.oneOf(["array"]),
|
|
92
|
-
items: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
|
|
93
|
-
}).isRequired
|
|
94
|
-
};
|
|
95
|
-
TableField = __decorate([
|
|
96
|
-
BaseComponent_1.default
|
|
97
|
-
], TableField);
|
|
98
|
-
exports.default = TableField;
|
|
99
|
-
let TableArrayFieldTemplate = class TableArrayFieldTemplate extends React.Component {
|
|
100
|
-
render() {
|
|
101
|
-
const { props } = this;
|
|
102
|
-
const { schema, uiSchema, formContext: { cols, wrapperCols, schemaPropsArray }, idSchema, readonly, disabled } = props;
|
|
103
|
-
const schemaProps = schema.additionalItems ? schema.additionalItems.properties : schema.items.properties;
|
|
104
|
-
const { Label } = this.props.formContext;
|
|
105
|
-
const { Row, Col } = this.context.theme;
|
|
106
|
-
const labels = utils_2.orderProperties(schemaPropsArray.filter(col => !utils_1.isHidden(uiSchema.items, col)), (uiSchema.items || {})["ui:order"]).map(propName => {
|
|
107
|
-
const propUiSchema = uiSchema && uiSchema.items && uiSchema.items[propName] || {};
|
|
108
|
-
return (React.createElement(Col, Object.assign({}, cols, { key: propName + "-label" }),
|
|
109
|
-
React.createElement(Label, { label: "title" in schemaProps[propName] ? schemaProps[propName].title : propName, disabled: false, id: idSchema[propName].$id, required: (schema.items.required && schema.items.required.indexOf(propName) > -1)
|
|
110
|
-
|| propUiSchema["ui:required"], uiSchema: propUiSchema })));
|
|
111
|
-
});
|
|
112
|
-
const options = utils_1.getUiOptions(props.uiSchema);
|
|
113
|
-
const { confirmDelete, deleteCorner, removable = true, nonRemovables = [], buttons, "ui:deleteHelp": deleteHelp } = options;
|
|
114
|
-
if (!this.deleteButtonRefs)
|
|
115
|
-
this.deleteButtonRefs = [];
|
|
116
|
-
const getRefFor = i => elem => { this.deleteButtonRefs[i] = elem; };
|
|
117
|
-
return (React.createElement("div", { className: "table-field" },
|
|
118
|
-
React.createElement(Row, null,
|
|
119
|
-
React.createElement("div", { className: "laji-form-field-template-item" },
|
|
120
|
-
React.createElement("div", { className: "laji-form-field-template-schema" }, labels),
|
|
121
|
-
React.createElement("div", { className: "laji-form-field-template-buttons" }))),
|
|
122
|
-
props.items.map((item, i) => {
|
|
123
|
-
const deleteButton = (React.createElement(components_1.DeleteButton, { ref: getRefFor(i), id: `${props.idSchema.$id}_${i}`, disabled: readonly || disabled, onClick: item.onDropIndexClick(item.index), confirm: confirmDelete, corner: deleteCorner, tooltip: deleteHelp, translations: props.formContext.translations }));
|
|
124
|
-
return (React.createElement(Row, { key: utils_1.getUUID(props.formData[item.index]) || item.key },
|
|
125
|
-
React.createElement(Col, Object.assign({}, wrapperCols),
|
|
126
|
-
React.createElement("div", { className: "laji-form-field-template-item keep-vertical" },
|
|
127
|
-
React.createElement("div", { className: "laji-form-field-template-schema" }, item.children),
|
|
128
|
-
item.hasRemove && !nonRemovables.includes(item.index) && removable && deleteButton))));
|
|
129
|
-
}),
|
|
130
|
-
ArrayFieldTemplate_1.getButtonElems(buttons, props)));
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
TableArrayFieldTemplate.contextType = ReactContext_1.default;
|
|
134
|
-
TableArrayFieldTemplate = __decorate([
|
|
135
|
-
ArrayFieldTemplate_1.handlesArrayKeys
|
|
136
|
-
], TableArrayFieldTemplate);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export default class TagArrayField extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
4
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
|
-
separatorKeys: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
6
|
-
showDeleteButton: PropTypes.Requireable<boolean>;
|
|
7
|
-
}>>;
|
|
8
|
-
}>>;
|
|
9
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
10
|
-
type: PropTypes.Requireable<string>;
|
|
11
|
-
}>>;
|
|
12
|
-
formData: PropTypes.Requireable<any[]>;
|
|
13
|
-
};
|
|
14
|
-
constructor(props: any);
|
|
15
|
-
constructor(props: any, context: any);
|
|
16
|
-
}
|
|
17
|
-
export class TagInputComponent extends React.Component<any, any, any> {
|
|
18
|
-
constructor(props: any);
|
|
19
|
-
getStateFromProps: ({ value }: {
|
|
20
|
-
value: any;
|
|
21
|
-
}) => {
|
|
22
|
-
value: any;
|
|
23
|
-
};
|
|
24
|
-
getSeparatorKeys: (uiSchema: any) => any;
|
|
25
|
-
onKeyDown: (e: any) => void;
|
|
26
|
-
onRemove: ((idx: any) => () => void) & memoize.Memoized<(idx: any) => () => void>;
|
|
27
|
-
onFocus: (e: any) => void;
|
|
28
|
-
onBlur: (e: any) => void;
|
|
29
|
-
setInputRef: (ref: any) => void;
|
|
30
|
-
inputRef: any;
|
|
31
|
-
onClick: () => void;
|
|
32
|
-
onInputChange: (e: any) => void;
|
|
33
|
-
onTagClick: ((idx: any) => () => void) & memoize.Memoized<(idx: any) => () => void>;
|
|
34
|
-
getTrimmedValue(): any;
|
|
35
|
-
}
|
|
36
|
-
import * as React from "react";
|
|
37
|
-
import * as PropTypes from "prop-types";
|
|
38
|
-
import * as memoize from "memoizee";
|
|
@@ -1,128 +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
|
-
exports.TagInputComponent = void 0;
|
|
10
|
-
const React = require("react");
|
|
11
|
-
const react_dom_1 = require("react-dom");
|
|
12
|
-
const PropTypes = require("prop-types");
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
15
|
-
const memoize = require("memoizee");
|
|
16
|
-
let TagArrayField = class TagArrayField extends React.Component {
|
|
17
|
-
render() {
|
|
18
|
-
const { FieldTemplate } = this.props.registry.templates;
|
|
19
|
-
const { uiSchema } = this.props;
|
|
20
|
-
return (React.createElement(FieldTemplate, Object.assign({}, this.props, { forceDisplayLabel: true, rawHelp: uiSchema["ui:help"], description: uiSchema["ui:description"], rawErrors: [] }),
|
|
21
|
-
React.createElement(TagInputComponent, Object.assign({}, this.props, { id: this.props.idSchema.$id, tags: this.props.formData }))));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
TagArrayField.propTypes = {
|
|
25
|
-
uiSchema: PropTypes.shape({
|
|
26
|
-
"ui:options": PropTypes.shape({
|
|
27
|
-
separatorKeys: PropTypes.arrayOf(PropTypes.string),
|
|
28
|
-
showDeleteButton: PropTypes.bool
|
|
29
|
-
})
|
|
30
|
-
}),
|
|
31
|
-
schema: PropTypes.shape({
|
|
32
|
-
type: PropTypes.oneOf(["array"])
|
|
33
|
-
}).isRequired,
|
|
34
|
-
formData: PropTypes.array
|
|
35
|
-
};
|
|
36
|
-
TagArrayField = __decorate([
|
|
37
|
-
BaseComponent_1.default
|
|
38
|
-
], TagArrayField);
|
|
39
|
-
exports.default = TagArrayField;
|
|
40
|
-
class TagInputComponent extends React.Component {
|
|
41
|
-
constructor(props) {
|
|
42
|
-
super(props);
|
|
43
|
-
this.getStateFromProps = ({ value }) => {
|
|
44
|
-
return { value };
|
|
45
|
-
};
|
|
46
|
-
this.getSeparatorKeys = (uiSchema) => {
|
|
47
|
-
const { separatorKeys = ["Enter", ",", ";"] } = utils_1.getUiOptions(uiSchema);
|
|
48
|
-
return separatorKeys;
|
|
49
|
-
};
|
|
50
|
-
this.onKeyDown = (e) => {
|
|
51
|
-
const value = this.getTrimmedValue();
|
|
52
|
-
const { tags = [] } = this.props;
|
|
53
|
-
const separatorKeys = this.getSeparatorKeys(this.props.uiSchema);
|
|
54
|
-
if (separatorKeys.includes(e.key) && !utils_1.isEmptyString(value)) {
|
|
55
|
-
this.props.onChange([...tags, value], "enter");
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
}
|
|
59
|
-
else if (e.key === "Backspace" && utils_1.isEmptyString(value) && tags.length) {
|
|
60
|
-
this.onRemove(tags.length - 1)();
|
|
61
|
-
}
|
|
62
|
-
utils_1.triggerParentComponent("onKeyDown", e, this.props);
|
|
63
|
-
};
|
|
64
|
-
this.onRemove = memoize((idx) => () => {
|
|
65
|
-
const tags = [...(this.props.tags || [])];
|
|
66
|
-
tags.splice(idx, 1);
|
|
67
|
-
this.props.onChange(tags, "remove");
|
|
68
|
-
});
|
|
69
|
-
this.onFocus = (e) => {
|
|
70
|
-
this.setState({ focused: true }, () => {
|
|
71
|
-
utils_1.triggerParentComponent("onFocus", e, this.props);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
this.onBlur = (e) => {
|
|
75
|
-
this.setState({ focused: false });
|
|
76
|
-
utils_1.triggerParentComponent("onBlur", e, this.props);
|
|
77
|
-
const value = this.getTrimmedValue();
|
|
78
|
-
if (!utils_1.isEmptyString(value)) {
|
|
79
|
-
this.props.onChange([...(this.props.tags || []), value], "blur");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this.setInputRef = (ref) => {
|
|
83
|
-
this.inputRef = ref;
|
|
84
|
-
};
|
|
85
|
-
this.onClick = () => {
|
|
86
|
-
react_dom_1.findDOMNode(this.inputRef).focus();
|
|
87
|
-
};
|
|
88
|
-
this.onInputChange = (e) => {
|
|
89
|
-
const { onInputChange } = this.props;
|
|
90
|
-
onInputChange && e.persist();
|
|
91
|
-
const { target: { value } } = e;
|
|
92
|
-
const separatorKeys = this.getSeparatorKeys(this.props.uiSchema);
|
|
93
|
-
const splitted = separatorKeys.reduce((splitted, separator) => splitted.reduce((_splitted, i) => ([..._splitted, ...i.split(separator)]), []), [value]).map(s => s.trim()).filter(s => !utils_1.isEmptyString(s));
|
|
94
|
-
this.setState({ value }, () => {
|
|
95
|
-
onInputChange && this.props.onInputChange(e);
|
|
96
|
-
if (splitted.length > 1) {
|
|
97
|
-
this.props.onChange([...(this.props.tags || []), ...splitted]);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
this.onTagClick = memoize((idx) => () => {
|
|
102
|
-
const { onTagClick } = utils_1.getUiOptions(this.props.uiSchema);
|
|
103
|
-
onTagClick === null || onTagClick === void 0 ? void 0 : onTagClick(idx);
|
|
104
|
-
});
|
|
105
|
-
this.state = this.getStateFromProps(props);
|
|
106
|
-
}
|
|
107
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
108
|
-
this.setState(this.getStateFromProps(props));
|
|
109
|
-
}
|
|
110
|
-
getTrimmedValue() {
|
|
111
|
-
const { value } = this.state;
|
|
112
|
-
return value === null || value === void 0 ? void 0 : value.trim();
|
|
113
|
-
}
|
|
114
|
-
render() {
|
|
115
|
-
let { tags = [], InputComponent, readonly, disabled, uiSchema } = this.props;
|
|
116
|
-
tags = tags.filter(s => !utils_1.isEmptyString(s));
|
|
117
|
-
const { value = "" } = this.state;
|
|
118
|
-
const inputProps = Object.assign(Object.assign({ type: "text", className: "rw-input-reset", ref: this.setInputRef, value: value, onChange: this.onInputChange, id: this.props.id }, this.props.inputProps), { onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown });
|
|
119
|
-
const { showDeleteButton = true } = utils_1.getUiOptions(uiSchema);
|
|
120
|
-
return (React.createElement("div", { className: `rw-multiselect rw-widget${this.state.focused ? " rw-state-focus" : ""}${readonly || disabled ? " rw-state-disabled" : ""}`, onClick: this.onClick },
|
|
121
|
-
React.createElement("div", { className: "rw-widget-input rw-widget-picked rw-widget-container" },
|
|
122
|
-
React.createElement("ul", { className: "rw-multiselect-taglist" }, tags.map((item, idx) => React.createElement("li", { key: idx, className: "rw-multiselect-tag", onClick: this.onTagClick(idx) },
|
|
123
|
-
item,
|
|
124
|
-
showDeleteButton ? React.createElement("span", { className: "rw-tag-btn", onClick: this.onRemove(idx), tabIndex: 0, onKeyDown: this.props.formContext.utils.keyboardClick(this.onRemove(idx)) }, "\u00D7") : ""))),
|
|
125
|
-
InputComponent ? React.createElement(InputComponent, Object.assign({}, inputProps)) : React.createElement("input", Object.assign({}, inputProps, { disabled: disabled || readonly })))));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.TagInputComponent = TagInputComponent;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default class ToggleAdditionalArrayFieldsField extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
|
-
additionalFields: PropTypes.Validator<(string | null | undefined)[]>;
|
|
6
|
-
toggleLabel: PropTypes.Requireable<string>;
|
|
7
|
-
toggleClassName: PropTypes.Requireable<string>;
|
|
8
|
-
toggleHelp: PropTypes.Requireable<string>;
|
|
9
|
-
}>>;
|
|
10
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
11
|
-
}>>;
|
|
12
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
13
|
-
type: PropTypes.Requireable<string>;
|
|
14
|
-
}>>;
|
|
15
|
-
formData: PropTypes.Validator<any[]>;
|
|
16
|
-
};
|
|
17
|
-
constructor(props: any);
|
|
18
|
-
getTogglePersistenceContextKey: (props: any) => string;
|
|
19
|
-
getInitialVisible(props: any): unknown;
|
|
20
|
-
getStateFromProps(props: any): {
|
|
21
|
-
uiSchema: any;
|
|
22
|
-
};
|
|
23
|
-
toggleVisibility: () => void;
|
|
24
|
-
}
|
|
25
|
-
import * as React from "react";
|
|
26
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,81 +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 utils_1 = require("../../utils");
|
|
12
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
13
|
-
const Context_1 = require("../../Context");
|
|
14
|
-
let ToggleAdditionalArrayFieldsField = class ToggleAdditionalArrayFieldsField extends React.Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.getTogglePersistenceContextKey = (props) => `$additional_toggle_persistence_${props.idSchema.$id}`;
|
|
18
|
-
this.toggleVisibility = () => {
|
|
19
|
-
const visible = !this.state.visible;
|
|
20
|
-
const context = Context_1.default(this.props.formContext.contextId);
|
|
21
|
-
context[this.getTogglePersistenceContextKey(this.props)] = visible;
|
|
22
|
-
this.setState({ visible });
|
|
23
|
-
};
|
|
24
|
-
this.state = Object.assign({ visible: this.getInitialVisible(props) }, this.getStateFromProps(props));
|
|
25
|
-
}
|
|
26
|
-
getInitialVisible(props) {
|
|
27
|
-
const { additionalFields } = utils_1.getUiOptions(props.uiSchema);
|
|
28
|
-
const context = Context_1.default(props.formContext.contextId);
|
|
29
|
-
let visible = context[this.getTogglePersistenceContextKey(props)] || false;
|
|
30
|
-
if (!visible) {
|
|
31
|
-
for (const data of props.formData) {
|
|
32
|
-
for (const field of additionalFields) {
|
|
33
|
-
if (!utils_1.isDefaultData(utils_1.parseJSONPointer(data, field), utils_1.parseSchemaFromFormDataPointer(props.schema, field))) {
|
|
34
|
-
visible = true;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return visible;
|
|
41
|
-
}
|
|
42
|
-
getStateFromProps(props) {
|
|
43
|
-
const innerUiSchema = utils_1.getInnerUiSchema(props.uiSchema);
|
|
44
|
-
return { uiSchema: innerUiSchema };
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
const { CheckboxWidget } = this.props.registry.widgets;
|
|
48
|
-
const { SchemaField } = this.props.registry.fields;
|
|
49
|
-
const { additionalFields = [], toggleLabel, toggleClassName, toggleHelp } = utils_1.getUiOptions(this.props.uiSchema);
|
|
50
|
-
const shouldShow = Object.values(this.props.errorSchema || {}).some(error => additionalFields.some(field => utils_1.parseJSONPointer(error, field))) || this.state.visible;
|
|
51
|
-
let _uiSchema = this.state.uiSchema;
|
|
52
|
-
if (!shouldShow) {
|
|
53
|
-
additionalFields.forEach(field => {
|
|
54
|
-
_uiSchema = utils_1.updateSafelyWithJSONPointer(_uiSchema, { "ui:field": "HiddenField" }, "items/" + field);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return (React.createElement(React.Fragment, null,
|
|
58
|
-
React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: _uiSchema })),
|
|
59
|
-
React.createElement("div", { className: toggleClassName },
|
|
60
|
-
React.createElement(CheckboxWidget, Object.assign({}, this.props, { id: this.props.idSchema.$id + "_toggle", schema: { type: "boolean" }, value: this.state.visible, onChange: this.toggleVisibility, label: toggleLabel || "", options: { allowUndefined: false, help: toggleHelp }, required: false })))));
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
ToggleAdditionalArrayFieldsField.propTypes = {
|
|
64
|
-
uiSchema: PropTypes.shape({
|
|
65
|
-
"ui:options": PropTypes.shape({
|
|
66
|
-
additionalFields: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
67
|
-
toggleLabel: PropTypes.string,
|
|
68
|
-
toggleClassName: PropTypes.string,
|
|
69
|
-
toggleHelp: PropTypes.string
|
|
70
|
-
}),
|
|
71
|
-
uiSchema: PropTypes.object
|
|
72
|
-
}).isRequired,
|
|
73
|
-
schema: PropTypes.shape({
|
|
74
|
-
type: PropTypes.oneOf(["array"])
|
|
75
|
-
}).isRequired,
|
|
76
|
-
formData: PropTypes.oneOfType([PropTypes.array]).isRequired
|
|
77
|
-
};
|
|
78
|
-
ToggleAdditionalArrayFieldsField = __decorate([
|
|
79
|
-
BaseComponent_1.default
|
|
80
|
-
], ToggleAdditionalArrayFieldsField);
|
|
81
|
-
exports.default = ToggleAdditionalArrayFieldsField;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class UiFieldApplierField extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
type: PropTypes.Requireable<string>;
|
|
5
|
-
}>>;
|
|
6
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
8
|
-
field: PropTypes.Requireable<string>;
|
|
9
|
-
functions: PropTypes.Requireable<PropTypes.InferProps<{
|
|
10
|
-
"ui:field": PropTypes.Validator<string>;
|
|
11
|
-
"ui:options": PropTypes.Requireable<object>;
|
|
12
|
-
}> | (PropTypes.InferProps<{
|
|
13
|
-
"ui:field": PropTypes.Validator<string>;
|
|
14
|
-
"ui:options": PropTypes.Requireable<object>;
|
|
15
|
-
}> | null | undefined)[]>;
|
|
16
|
-
}>>;
|
|
17
|
-
}>>;
|
|
18
|
-
formData: PropTypes.Requireable<object>;
|
|
19
|
-
};
|
|
20
|
-
static getName(): string;
|
|
21
|
-
constructor(props: any);
|
|
22
|
-
functions: any[];
|
|
23
|
-
getFunctions: () => any;
|
|
24
|
-
getStateFromProps(props: any): any;
|
|
25
|
-
onChange: (formData: any) => void;
|
|
26
|
-
onChangeFormData: any;
|
|
27
|
-
combinedOnChange(formData: any): void;
|
|
28
|
-
}
|
|
29
|
-
import * as React from "react";
|
|
30
|
-
import * as PropTypes from "prop-types";
|