@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,123 +0,0 @@
|
|
|
1
|
-
export const rulePropType: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
2
|
-
container: PropTypes.Requireable<string>;
|
|
3
|
-
field: PropTypes.Validator<string>;
|
|
4
|
-
regexp: PropTypes.Requireable<string>;
|
|
5
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
6
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
7
|
-
complement: PropTypes.Requireable<boolean>;
|
|
8
|
-
}>>;
|
|
9
|
-
export const operationPropType: PropTypes.Requireable<PropTypes.InferProps<{
|
|
10
|
-
type: PropTypes.Requireable<string>;
|
|
11
|
-
uiSchema: PropTypes.Validator<object>;
|
|
12
|
-
}>>;
|
|
13
|
-
export const rulesPropType: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
14
|
-
container: PropTypes.Requireable<string>;
|
|
15
|
-
field: PropTypes.Validator<string>;
|
|
16
|
-
regexp: PropTypes.Requireable<string>;
|
|
17
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
18
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
19
|
-
complement: PropTypes.Requireable<boolean>;
|
|
20
|
-
}> | (string | PropTypes.InferProps<{
|
|
21
|
-
container: PropTypes.Requireable<string>;
|
|
22
|
-
field: PropTypes.Validator<string>;
|
|
23
|
-
regexp: PropTypes.Requireable<string>;
|
|
24
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
25
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
26
|
-
complement: PropTypes.Requireable<boolean>;
|
|
27
|
-
}> | null | undefined)[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Transforms uiSchema according to conditional cases. Cases are not mutually exclusive.
|
|
30
|
-
* uiSchema = {"ui:options": {
|
|
31
|
-
* cases: [
|
|
32
|
-
* rules: [
|
|
33
|
-
* {
|
|
34
|
-
* regexp: The regexp that the field must match.
|
|
35
|
-
* valueIn: An array that the field must be in.
|
|
36
|
-
* field: The field that the rule is being checked on (can be a JSON pointer or a field name)
|
|
37
|
-
* }
|
|
38
|
-
* ],
|
|
39
|
-
* operations: [ // All the operations are performed if all rules pass.
|
|
40
|
-
* {
|
|
41
|
-
* type: "merge" or "wrap" "replace". "merge" deeply merges the conditional uiSchema to the nested uiSchema.
|
|
42
|
-
* "wrap" sets the nested uiSchema inside conditional uiSchema.
|
|
43
|
-
* "replace" (default) replaces nested uiSchema with conditional uiSchema.
|
|
44
|
-
* uiSchema: conditional uiSchema to use.
|
|
45
|
-
* }
|
|
46
|
-
* ],
|
|
47
|
-
* else: [<same as operations>] // Operations performed if the rules do not pass.
|
|
48
|
-
* cache: <boolean> true by default. If you know the cases will cache, set this to false.
|
|
49
|
-
* There will be a performance penalty on valueIn rule, as they are not indexed without caching.
|
|
50
|
-
* ]
|
|
51
|
-
* }
|
|
52
|
-
* uiSchema: nested uiSchema
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
export default class ConditionalUiSchemaField extends React.Component<any, any, any> {
|
|
56
|
-
static propTypes: {
|
|
57
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
58
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
59
|
-
cases: PropTypes.Requireable<PropTypes.InferProps<{
|
|
60
|
-
rules: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
61
|
-
container: PropTypes.Requireable<string>;
|
|
62
|
-
field: PropTypes.Validator<string>;
|
|
63
|
-
regexp: PropTypes.Requireable<string>;
|
|
64
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
65
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
66
|
-
complement: PropTypes.Requireable<boolean>;
|
|
67
|
-
}> | (string | PropTypes.InferProps<{
|
|
68
|
-
container: PropTypes.Requireable<string>;
|
|
69
|
-
field: PropTypes.Validator<string>;
|
|
70
|
-
regexp: PropTypes.Requireable<string>;
|
|
71
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
72
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
73
|
-
complement: PropTypes.Requireable<boolean>;
|
|
74
|
-
}> | null | undefined)[]>;
|
|
75
|
-
operations: PropTypes.Requireable<PropTypes.InferProps<{
|
|
76
|
-
type: PropTypes.Requireable<string>;
|
|
77
|
-
uiSchema: PropTypes.Validator<object>;
|
|
78
|
-
}> | (PropTypes.InferProps<{
|
|
79
|
-
type: PropTypes.Requireable<string>;
|
|
80
|
-
uiSchema: PropTypes.Validator<object>;
|
|
81
|
-
}> | null | undefined)[]>;
|
|
82
|
-
}> | (PropTypes.InferProps<{
|
|
83
|
-
rules: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
84
|
-
container: PropTypes.Requireable<string>;
|
|
85
|
-
field: PropTypes.Validator<string>;
|
|
86
|
-
regexp: PropTypes.Requireable<string>;
|
|
87
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
88
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
89
|
-
complement: PropTypes.Requireable<boolean>;
|
|
90
|
-
}> | (string | PropTypes.InferProps<{
|
|
91
|
-
container: PropTypes.Requireable<string>;
|
|
92
|
-
field: PropTypes.Validator<string>;
|
|
93
|
-
regexp: PropTypes.Requireable<string>;
|
|
94
|
-
valueIn: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
95
|
-
valueLengthLessThan: PropTypes.Requireable<number>;
|
|
96
|
-
complement: PropTypes.Requireable<boolean>;
|
|
97
|
-
}> | null | undefined)[]>;
|
|
98
|
-
operations: PropTypes.Requireable<PropTypes.InferProps<{
|
|
99
|
-
type: PropTypes.Requireable<string>;
|
|
100
|
-
uiSchema: PropTypes.Validator<object>;
|
|
101
|
-
}> | (PropTypes.InferProps<{
|
|
102
|
-
type: PropTypes.Requireable<string>;
|
|
103
|
-
uiSchema: PropTypes.Validator<object>;
|
|
104
|
-
}> | null | undefined)[]>;
|
|
105
|
-
}> | null | undefined)[]>;
|
|
106
|
-
cache: any;
|
|
107
|
-
}>>;
|
|
108
|
-
}>>;
|
|
109
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
110
|
-
type: PropTypes.Requireable<string>;
|
|
111
|
-
}>>;
|
|
112
|
-
};
|
|
113
|
-
static getName(): string;
|
|
114
|
-
constructor(props: any);
|
|
115
|
-
constructor(props: any, context: any);
|
|
116
|
-
cache: {};
|
|
117
|
-
getStateFromProps(props: any): {
|
|
118
|
-
uiSchema: any;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
export function computeUiSchema(uiSchema: any, operations: any, arrayMerge?: string): any;
|
|
122
|
-
import * as PropTypes from "prop-types";
|
|
123
|
-
import * as React from "react";
|
|
@@ -1,143 +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.computeUiSchema = exports.rulesPropType = exports.operationPropType = exports.rulePropType = void 0;
|
|
10
|
-
const React = require("react");
|
|
11
|
-
const PropTypes = require("prop-types");
|
|
12
|
-
const VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
13
|
-
const deepmerge = require("deepmerge");
|
|
14
|
-
const utils_1 = require("../../utils");
|
|
15
|
-
exports.rulePropType = PropTypes.oneOfType([
|
|
16
|
-
PropTypes.shape({
|
|
17
|
-
container: PropTypes.string,
|
|
18
|
-
field: PropTypes.string.isRequired,
|
|
19
|
-
regexp: PropTypes.string,
|
|
20
|
-
valueIn: PropTypes.arrayOf(PropTypes.string),
|
|
21
|
-
valueLengthLessThan: PropTypes.number,
|
|
22
|
-
complement: PropTypes.bool
|
|
23
|
-
}),
|
|
24
|
-
PropTypes.oneOf(["isAdmin", "isEdit"])
|
|
25
|
-
]);
|
|
26
|
-
exports.operationPropType = PropTypes.shape({
|
|
27
|
-
type: PropTypes.oneOf(["merge", "wrap"]),
|
|
28
|
-
uiSchema: PropTypes.object.isRequired,
|
|
29
|
-
});
|
|
30
|
-
exports.rulesPropType = PropTypes.oneOfType([
|
|
31
|
-
exports.rulePropType,
|
|
32
|
-
PropTypes.arrayOf(exports.rulePropType)
|
|
33
|
-
]);
|
|
34
|
-
const casePropType = PropTypes.shape({
|
|
35
|
-
rules: exports.rulesPropType,
|
|
36
|
-
operations: PropTypes.oneOfType([
|
|
37
|
-
exports.operationPropType,
|
|
38
|
-
PropTypes.arrayOf(exports.operationPropType)
|
|
39
|
-
])
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* Transforms uiSchema according to conditional cases. Cases are not mutually exclusive.
|
|
43
|
-
* uiSchema = {"ui:options": {
|
|
44
|
-
* cases: [
|
|
45
|
-
* rules: [
|
|
46
|
-
* {
|
|
47
|
-
* regexp: The regexp that the field must match.
|
|
48
|
-
* valueIn: An array that the field must be in.
|
|
49
|
-
* field: The field that the rule is being checked on (can be a JSON pointer or a field name)
|
|
50
|
-
* }
|
|
51
|
-
* ],
|
|
52
|
-
* operations: [ // All the operations are performed if all rules pass.
|
|
53
|
-
* {
|
|
54
|
-
* type: "merge" or "wrap" "replace". "merge" deeply merges the conditional uiSchema to the nested uiSchema.
|
|
55
|
-
* "wrap" sets the nested uiSchema inside conditional uiSchema.
|
|
56
|
-
* "replace" (default) replaces nested uiSchema with conditional uiSchema.
|
|
57
|
-
* uiSchema: conditional uiSchema to use.
|
|
58
|
-
* }
|
|
59
|
-
* ],
|
|
60
|
-
* else: [<same as operations>] // Operations performed if the rules do not pass.
|
|
61
|
-
* cache: <boolean> true by default. If you know the cases will cache, set this to false.
|
|
62
|
-
* There will be a performance penalty on valueIn rule, as they are not indexed without caching.
|
|
63
|
-
* ]
|
|
64
|
-
* }
|
|
65
|
-
* uiSchema: nested uiSchema
|
|
66
|
-
* }
|
|
67
|
-
*/
|
|
68
|
-
let ConditionalUiSchemaField = class ConditionalUiSchemaField extends React.Component {
|
|
69
|
-
constructor() {
|
|
70
|
-
super(...arguments);
|
|
71
|
-
this.cache = {};
|
|
72
|
-
}
|
|
73
|
-
static getName() { return "ConditionalUiSchemaField"; }
|
|
74
|
-
getStateFromProps(props) {
|
|
75
|
-
const { cases = [], cache = true, arrayMerge } = this.getUiOptions();
|
|
76
|
-
const { uiSchema } = props;
|
|
77
|
-
let computedUiSchema = uiSchema;
|
|
78
|
-
(Array.isArray(cases) ? cases : [cases]).forEach(({ rules = [], operations = [], else: _else, arrayMerge: _arrayMerge }, idx) => {
|
|
79
|
-
let passes;
|
|
80
|
-
if (cache) {
|
|
81
|
-
if (!this.cache[idx]) {
|
|
82
|
-
this.cache[idx] = {};
|
|
83
|
-
}
|
|
84
|
-
const check = utils_1.checkRules(rules, props, this.cache[idx]);
|
|
85
|
-
const { cache } = check;
|
|
86
|
-
passes = check.passes;
|
|
87
|
-
this.cache = cache;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
passes = utils_1.checkRules(rules, props);
|
|
91
|
-
}
|
|
92
|
-
if (passes) {
|
|
93
|
-
computedUiSchema = exports.computeUiSchema(computedUiSchema, operations, _arrayMerge || arrayMerge);
|
|
94
|
-
}
|
|
95
|
-
else if (_else) {
|
|
96
|
-
computedUiSchema = exports.computeUiSchema(computedUiSchema, _else, _arrayMerge || arrayMerge);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return { uiSchema: computedUiSchema };
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
ConditionalUiSchemaField.propTypes = {
|
|
103
|
-
uiSchema: PropTypes.shape({
|
|
104
|
-
"ui:options": PropTypes.shape({
|
|
105
|
-
cases: PropTypes.oneOfType([
|
|
106
|
-
casePropType,
|
|
107
|
-
PropTypes.arrayOf(casePropType)
|
|
108
|
-
]),
|
|
109
|
-
cache: PropTypes.boolean
|
|
110
|
-
})
|
|
111
|
-
}),
|
|
112
|
-
schema: PropTypes.shape({
|
|
113
|
-
type: PropTypes.oneOf(["array", "object", "string", "integer", "number", "boolean"])
|
|
114
|
-
}).isRequired,
|
|
115
|
-
};
|
|
116
|
-
ConditionalUiSchemaField = __decorate([
|
|
117
|
-
VirtualSchemaField_1.default
|
|
118
|
-
], ConditionalUiSchemaField);
|
|
119
|
-
exports.default = ConditionalUiSchemaField;
|
|
120
|
-
const computeUiSchema = (uiSchema, operations, arrayMerge = "replace") => {
|
|
121
|
-
if (!operations)
|
|
122
|
-
return uiSchema;
|
|
123
|
-
return (Array.isArray(operations) ? operations : [operations]).reduce((_uiSchema, op) => {
|
|
124
|
-
switch (op.type) {
|
|
125
|
-
case "merge":
|
|
126
|
-
uiSchema = deepmerge(uiSchema, op.uiSchema, { arrayMerge: arrayMerge === "replace"
|
|
127
|
-
? (a1, a2) => a2
|
|
128
|
-
: (a1, a2) => [...a1, ...a2] });
|
|
129
|
-
break;
|
|
130
|
-
case "wrap":
|
|
131
|
-
uiSchema = Object.assign(Object.assign({}, op.uiSchema), { uiSchema });
|
|
132
|
-
break;
|
|
133
|
-
case "jsonPointer":
|
|
134
|
-
uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, op.value, op.pointer);
|
|
135
|
-
break;
|
|
136
|
-
case "replace":
|
|
137
|
-
default:
|
|
138
|
-
uiSchema = op.uiSchema;
|
|
139
|
-
}
|
|
140
|
-
return uiSchema;
|
|
141
|
-
}, uiSchema);
|
|
142
|
-
};
|
|
143
|
-
exports.computeUiSchema = computeUiSchema;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function getInjectedUiSchema(uiSchema: any, injections: any, uiSchemaContext: any): any;
|
|
2
|
-
export default class ContextInjectionField extends React.Component<any, any, any> {
|
|
3
|
-
static propTypes: {
|
|
4
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
5
|
-
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
6
|
-
injections: PropTypes.Validator<object>;
|
|
7
|
-
target: PropTypes.Requireable<string>;
|
|
8
|
-
}>>;
|
|
9
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
10
|
-
}>>;
|
|
11
|
-
formData: PropTypes.Requireable<string | number | boolean | object>;
|
|
12
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
13
|
-
type: PropTypes.Requireable<string>;
|
|
14
|
-
}>>;
|
|
15
|
-
};
|
|
16
|
-
static getName(): string;
|
|
17
|
-
constructor(props: any);
|
|
18
|
-
constructor(props: any, context: any);
|
|
19
|
-
getStateFromProps(props: any): {
|
|
20
|
-
[x: number]: any;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
import * as React from "react";
|
|
24
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,68 +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.getInjectedUiSchema = void 0;
|
|
10
|
-
const React = require("react");
|
|
11
|
-
const PropTypes = require("prop-types");
|
|
12
|
-
const immutability_helper_1 = require("immutability-helper");
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
15
|
-
let ContextInjectionField = class ContextInjectionField extends React.Component {
|
|
16
|
-
static getName() { return "ContextInjectionField"; }
|
|
17
|
-
getStateFromProps(props) {
|
|
18
|
-
const { injections, target = "uiSchema" } = this.getUiOptions();
|
|
19
|
-
const container = props[target];
|
|
20
|
-
return { [target]: getInjectedUiSchema(container, injections, props.formContext.uiSchemaContext) };
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
ContextInjectionField.propTypes = {
|
|
24
|
-
uiSchema: PropTypes.shape({
|
|
25
|
-
"ui:options": PropTypes.shape({
|
|
26
|
-
injections: PropTypes.object.isRequired,
|
|
27
|
-
target: PropTypes.oneOf(["uiSchema", "schema"]),
|
|
28
|
-
}).isRequired,
|
|
29
|
-
uiSchema: PropTypes.object
|
|
30
|
-
}).isRequired,
|
|
31
|
-
formData: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
32
|
-
schema: PropTypes.shape({
|
|
33
|
-
type: PropTypes.oneOf(["array", "object", "string", "integer", "number", "boolean"])
|
|
34
|
-
}).isRequired,
|
|
35
|
-
};
|
|
36
|
-
ContextInjectionField = __decorate([
|
|
37
|
-
VirtualSchemaField_1.default
|
|
38
|
-
], ContextInjectionField);
|
|
39
|
-
exports.default = ContextInjectionField;
|
|
40
|
-
function getInjectedUiSchema(uiSchema, injections, uiSchemaContext) {
|
|
41
|
-
let injected = false;
|
|
42
|
-
const updateObject = {};
|
|
43
|
-
for (let injectionPath in injections) {
|
|
44
|
-
const splitted = injectionPath.substring(1).split("/");
|
|
45
|
-
const last = splitted.pop();
|
|
46
|
-
const tail = splitted.reduce((pointer, path) => {
|
|
47
|
-
if (!pointer[path])
|
|
48
|
-
pointer[path] = {};
|
|
49
|
-
return pointer[path];
|
|
50
|
-
}, updateObject);
|
|
51
|
-
let value = injections[injectionPath];
|
|
52
|
-
if (value.match(/%{.*}/)) {
|
|
53
|
-
while (value.match(/%{.*}/)) {
|
|
54
|
-
const [match, innerValue] = value.match(/%{(.*)}/);
|
|
55
|
-
value = value.replace(match, utils_1.parseJSONPointer(uiSchemaContext, innerValue));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
value = utils_1.parseJSONPointer(uiSchemaContext, value);
|
|
60
|
-
}
|
|
61
|
-
tail[last] = { $set: value };
|
|
62
|
-
injected = true;
|
|
63
|
-
}
|
|
64
|
-
if (injected)
|
|
65
|
-
uiSchema = immutability_helper_1.default(uiSchema, updateObject);
|
|
66
|
-
return uiSchema;
|
|
67
|
-
}
|
|
68
|
-
exports.getInjectedUiSchema = getInjectedUiSchema;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enables leaking any prop to any other prop container.
|
|
3
|
-
*
|
|
4
|
-
* uiSchema = {"ui:options": {
|
|
5
|
-
* props: [
|
|
6
|
-
* {
|
|
7
|
-
* from: If a regular string, a property to copy from formData. If a JSON pointer, the root will be this.props.
|
|
8
|
-
* target: Target where to copy the 'from'. If a regular string, it will be copied to /uischema/ui:options. If a JSON pointer, the root will be this.props.
|
|
9
|
-
* }
|
|
10
|
-
*/
|
|
11
|
-
export default class DataLeakerField extends React.Component<any, any, any> {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
14
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
15
|
-
props: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
-
from: PropTypes.Validator<string>;
|
|
17
|
-
fromArrayKey: PropTypes.Requireable<string>;
|
|
18
|
-
target: PropTypes.Requireable<string>;
|
|
19
|
-
joinArray: PropTypes.Requireable<boolean>;
|
|
20
|
-
}> | (PropTypes.InferProps<{
|
|
21
|
-
from: PropTypes.Validator<string>;
|
|
22
|
-
fromArrayKey: PropTypes.Requireable<string>;
|
|
23
|
-
target: PropTypes.Requireable<string>;
|
|
24
|
-
joinArray: PropTypes.Requireable<boolean>;
|
|
25
|
-
}> | null | undefined)[]>;
|
|
26
|
-
}>>;
|
|
27
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
28
|
-
}>>;
|
|
29
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
30
|
-
type: PropTypes.Requireable<string>;
|
|
31
|
-
}>>;
|
|
32
|
-
formData: PropTypes.Requireable<object>;
|
|
33
|
-
};
|
|
34
|
-
static getName(): string;
|
|
35
|
-
constructor(props: any);
|
|
36
|
-
constructor(props: any, context: any);
|
|
37
|
-
getStateFromProps(props: any): any;
|
|
38
|
-
}
|
|
39
|
-
import * as React from "react";
|
|
40
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,68 +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 VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
13
|
-
const propsPropType = PropTypes.shape({
|
|
14
|
-
from: PropTypes.string.isRequired,
|
|
15
|
-
fromArrayKey: PropTypes.string,
|
|
16
|
-
target: PropTypes.string,
|
|
17
|
-
joinArray: PropTypes.bool
|
|
18
|
-
});
|
|
19
|
-
/**
|
|
20
|
-
* Enables leaking any prop to any other prop container.
|
|
21
|
-
*
|
|
22
|
-
* uiSchema = {"ui:options": {
|
|
23
|
-
* props: [
|
|
24
|
-
* {
|
|
25
|
-
* from: If a regular string, a property to copy from formData. If a JSON pointer, the root will be this.props.
|
|
26
|
-
* target: Target where to copy the 'from'. If a regular string, it will be copied to /uischema/ui:options. If a JSON pointer, the root will be this.props.
|
|
27
|
-
* }
|
|
28
|
-
*/
|
|
29
|
-
let DataLeakerField = class DataLeakerField extends React.Component {
|
|
30
|
-
static getName() { return "DataLeakerField"; }
|
|
31
|
-
getStateFromProps(props) {
|
|
32
|
-
const { props: _props = [] } = this.getUiOptions(props.uiSchema);
|
|
33
|
-
return (Array.isArray(_props) ? _props : [_props]).reduce((props, strOrObjProp) => {
|
|
34
|
-
const [fromPath, fromArrayKey, targetPath, joinArray] = ["from", "fromArrayKey", "target", "joinArray"]
|
|
35
|
-
.map(p => strOrObjProp[p]);
|
|
36
|
-
let from = fromPath[0] === "/"
|
|
37
|
-
? utils_1.parseJSONPointer(props, fromPath)
|
|
38
|
-
: utils_1.parseJSONPointer(props.formData, fromPath);
|
|
39
|
-
if (fromArrayKey) {
|
|
40
|
-
from = (from || []).map(obj => obj[fromArrayKey]);
|
|
41
|
-
}
|
|
42
|
-
if (joinArray && Array.isArray(from)) {
|
|
43
|
-
from = from.join(",");
|
|
44
|
-
}
|
|
45
|
-
const _targetPath = targetPath[0] === "/"
|
|
46
|
-
? targetPath
|
|
47
|
-
: `/uiSchema/ui:options/${targetPath}`;
|
|
48
|
-
props = utils_1.updateSafelyWithJSONPointer(props, from, _targetPath);
|
|
49
|
-
return props;
|
|
50
|
-
}, props);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
DataLeakerField.propTypes = {
|
|
54
|
-
uiSchema: PropTypes.shape({
|
|
55
|
-
"ui:options": PropTypes.shape({
|
|
56
|
-
props: PropTypes.oneOfType([PropTypes.arrayOf(propsPropType), propsPropType])
|
|
57
|
-
}),
|
|
58
|
-
uiSchema: PropTypes.object
|
|
59
|
-
}).isRequired,
|
|
60
|
-
schema: PropTypes.shape({
|
|
61
|
-
type: PropTypes.oneOf(["array", "object"])
|
|
62
|
-
}).isRequired,
|
|
63
|
-
formData: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
|
|
64
|
-
};
|
|
65
|
-
DataLeakerField = __decorate([
|
|
66
|
-
VirtualSchemaField_1.default
|
|
67
|
-
], DataLeakerField);
|
|
68
|
-
exports.default = DataLeakerField;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets given default values to target fields.
|
|
3
|
-
* uiSchema = { "ui:options": {
|
|
4
|
-
* "default": [
|
|
5
|
-
* {
|
|
6
|
-
* field1: defaultValue1,
|
|
7
|
-
* field2: defaultValue2
|
|
8
|
-
* }
|
|
9
|
-
* ...
|
|
10
|
-
* ]
|
|
11
|
-
* }}
|
|
12
|
-
*/
|
|
13
|
-
export default class DefaultValueArrayField extends React.Component<any, any, any> {
|
|
14
|
-
static propTypes: {
|
|
15
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
16
|
-
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
17
|
-
default: PropTypes.Validator<object>;
|
|
18
|
-
}>>;
|
|
19
|
-
}>>;
|
|
20
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
21
|
-
type: PropTypes.Requireable<string>;
|
|
22
|
-
}>>;
|
|
23
|
-
formData: PropTypes.Validator<any[]>;
|
|
24
|
-
};
|
|
25
|
-
static getName(): string;
|
|
26
|
-
constructor(props: any);
|
|
27
|
-
constructor(props: any, context: any);
|
|
28
|
-
getStateFromProps(): {
|
|
29
|
-
onChange: (formData: any) => void;
|
|
30
|
-
};
|
|
31
|
-
onChange: (formData: any) => void;
|
|
32
|
-
}
|
|
33
|
-
import * as React from "react";
|
|
34
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,59 +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 immutability_helper_1 = require("immutability-helper");
|
|
12
|
-
const VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
13
|
-
/**
|
|
14
|
-
* Sets given default values to target fields.
|
|
15
|
-
* uiSchema = { "ui:options": {
|
|
16
|
-
* "default": [
|
|
17
|
-
* {
|
|
18
|
-
* field1: defaultValue1,
|
|
19
|
-
* field2: defaultValue2
|
|
20
|
-
* }
|
|
21
|
-
* ...
|
|
22
|
-
* ]
|
|
23
|
-
* }}
|
|
24
|
-
*/
|
|
25
|
-
let DefaultValueArrayField = class DefaultValueArrayField extends React.Component {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.onChange = (formData) => {
|
|
29
|
-
const options = this.getUiOptions();
|
|
30
|
-
const _default = options.default;
|
|
31
|
-
Object.keys(_default).forEach(field => {
|
|
32
|
-
if (formData)
|
|
33
|
-
formData.forEach((item, i) => {
|
|
34
|
-
formData = immutability_helper_1.default(formData, { $splice: [[i, 1, immutability_helper_1.default(item, { $merge: { [field]: _default[field] } })]] });
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
this.props.onChange(formData);
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
static getName() { return "DefaultValueArrayField"; }
|
|
41
|
-
getStateFromProps() {
|
|
42
|
-
return { onChange: this.onChange };
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
DefaultValueArrayField.propTypes = {
|
|
46
|
-
uiSchema: PropTypes.shape({
|
|
47
|
-
"ui:options": PropTypes.shape({
|
|
48
|
-
default: PropTypes.object.isRequired
|
|
49
|
-
}).isRequired
|
|
50
|
-
}).isRequired,
|
|
51
|
-
schema: PropTypes.shape({
|
|
52
|
-
type: PropTypes.oneOf(["array"])
|
|
53
|
-
}).isRequired,
|
|
54
|
-
formData: PropTypes.oneOfType([PropTypes.array]).isRequired
|
|
55
|
-
};
|
|
56
|
-
DefaultValueArrayField = __decorate([
|
|
57
|
-
VirtualSchemaField_1.default
|
|
58
|
-
], DefaultValueArrayField);
|
|
59
|
-
exports.default = DefaultValueArrayField;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transforms an array field to o boolean field, where each value is true/false according to another array field.
|
|
3
|
-
* Each value is true, if formData[booleanDefiner] == formData[booleanField].
|
|
4
|
-
* uiSchema = { "ui:options": {
|
|
5
|
-
* booleanField: <array field name>,
|
|
6
|
-
* booleanDefiner: <array field name>,
|
|
7
|
-
* uiSchema: <uiSchema> (uiSchema used for each object).
|
|
8
|
-
* }}
|
|
9
|
-
*/
|
|
10
|
-
export default class DependentBooleanField extends React.Component<any, any, any> {
|
|
11
|
-
static propTypes: {
|
|
12
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
13
|
-
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
14
|
-
booleanField: PropTypes.Validator<string>;
|
|
15
|
-
booleanDefiner: PropTypes.Validator<string>;
|
|
16
|
-
}>>;
|
|
17
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
18
|
-
}>>;
|
|
19
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
20
|
-
type: PropTypes.Requireable<string>;
|
|
21
|
-
}>>;
|
|
22
|
-
formData: PropTypes.Validator<object>;
|
|
23
|
-
};
|
|
24
|
-
static getName(): string;
|
|
25
|
-
constructor(props: any);
|
|
26
|
-
constructor(props: any, context: any);
|
|
27
|
-
getStateFromProps(props: any): {
|
|
28
|
-
schema: any;
|
|
29
|
-
uiSchema: any;
|
|
30
|
-
formData: any;
|
|
31
|
-
onChange: (formData: any) => void;
|
|
32
|
-
};
|
|
33
|
-
onChange: (formData: any) => void;
|
|
34
|
-
getDictionarifiedFormData: (formData: any, field: any) => {};
|
|
35
|
-
getDictionarifiedBooleanFieldData: (formData: any) => {};
|
|
36
|
-
}
|
|
37
|
-
import * as React from "react";
|
|
38
|
-
import * as PropTypes from "prop-types";
|