@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,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const Combobox = require("react-widgets/lib/Combobox");
|
|
6
|
-
const Multiselect = require("react-widgets/lib/Multiselect");
|
|
7
|
-
const components_1 = require("../components");
|
|
8
|
-
const Context_1 = require("../../Context");
|
|
9
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
class SelectWidget extends React.Component {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
this.multiSelectOnChange = (values) => {
|
|
15
|
-
const lengthBeforeFiltering = values.length;
|
|
16
|
-
values = values.filter(v => v.value !== "");
|
|
17
|
-
if (this.props.value.length === lengthBeforeFiltering) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this.props.onChange(values.map(({ value }) => this.getEnum(value)));
|
|
21
|
-
};
|
|
22
|
-
this.selectOnChange = (item) => {
|
|
23
|
-
this.props.onChange(this.getEnum(item.value));
|
|
24
|
-
};
|
|
25
|
-
this.onClick = () => {
|
|
26
|
-
!this.props.disabled && !this.props.readonly && this.setState({ open: true });
|
|
27
|
-
};
|
|
28
|
-
this.onFocus = () => this.setState({ open: true });
|
|
29
|
-
this.onBlur = () => this.setState({ open: false });
|
|
30
|
-
this.onSelect = (item) => {
|
|
31
|
-
this.state.open && this.props.formContext.setTimeout(() => this.mounted && this.setState({ open: false, value: item.value }));
|
|
32
|
-
const value = this.getEnum(item.value);
|
|
33
|
-
(!this.state.value || value !== this.state.value.value) && this.props.onChange(value);
|
|
34
|
-
};
|
|
35
|
-
// Quelch a warning from react-widgets with noop handler.
|
|
36
|
-
this.onToggle = () => { };
|
|
37
|
-
this.onKeyDown = (e) => {
|
|
38
|
-
if (e.key !== "Tab") {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const item = this.elemRef.state.focusedItem;
|
|
42
|
-
item && this.elemRef.handleSelect(item, e);
|
|
43
|
-
};
|
|
44
|
-
this.setRef = elem => {
|
|
45
|
-
this.elemRef = elem;
|
|
46
|
-
};
|
|
47
|
-
this.getEnum = val => utils_1.isEmptyString(val) ? undefined : val;
|
|
48
|
-
this.state = this.getStateFromProps(props);
|
|
49
|
-
this._context = Context_1.default(this.props.formContext.contextId);
|
|
50
|
-
}
|
|
51
|
-
componentDidMount() {
|
|
52
|
-
this.mounted = true;
|
|
53
|
-
this.props.formContext.services.focus.addFocusHandler(this.props.id, this.onFocus);
|
|
54
|
-
}
|
|
55
|
-
componentWillUnmount() {
|
|
56
|
-
this.mounted = false;
|
|
57
|
-
this.props.formContext.services.focus.removeFocusHandler(this.props.id, this.onFocus);
|
|
58
|
-
}
|
|
59
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
60
|
-
this.setState(this.getStateFromProps(props));
|
|
61
|
-
}
|
|
62
|
-
getEnumOptions(props) {
|
|
63
|
-
return utils_1.getUiOptions(props.uiSchema).enumOptions || props.options.enumOptions;
|
|
64
|
-
}
|
|
65
|
-
getStateFromProps(props) {
|
|
66
|
-
let { multiple, value } = props;
|
|
67
|
-
let enumOptions = this.getEnumOptions(props);
|
|
68
|
-
function sort(enumOptions, order) {
|
|
69
|
-
if (!Array.isArray(order))
|
|
70
|
-
return enumOptions;
|
|
71
|
-
const idxs = order.reduce((idxs, _enum, i) => {
|
|
72
|
-
idxs[_enum] = i;
|
|
73
|
-
return idxs;
|
|
74
|
-
}, {});
|
|
75
|
-
return enumOptions.slice(0).sort((a, b) => {
|
|
76
|
-
return idxs[a.value] - idxs[b.value];
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const { filter: _filter, filterType, labels, order } = utils_1.getUiOptions(props);
|
|
80
|
-
if (_filter) {
|
|
81
|
-
enumOptions = utils_1.filter(enumOptions, _filter, filterType, item => item.value);
|
|
82
|
-
}
|
|
83
|
-
if (labels) {
|
|
84
|
-
enumOptions = enumOptions.map(({ value, label }) => {
|
|
85
|
-
return { value, label: value in labels ? labels[value] : label };
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (enumOptions.every(({ value: _value }) => value !== _value)) {
|
|
89
|
-
const _enum = this.getEnumOptions(props).find(({ value: _value }) => value === _value);
|
|
90
|
-
if (_enum) {
|
|
91
|
-
enumOptions.push(_enum);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (order)
|
|
95
|
-
enumOptions = sort(enumOptions, order);
|
|
96
|
-
const valsToItems = enumOptions.reduce((map, item) => {
|
|
97
|
-
map[item.value] = item;
|
|
98
|
-
return map;
|
|
99
|
-
}, {});
|
|
100
|
-
return {
|
|
101
|
-
valsToItems,
|
|
102
|
-
enumOptions,
|
|
103
|
-
value: multiple ? value : valsToItems[value]
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
render() {
|
|
107
|
-
const { id, disabled, readonly, multiple, formContext, } = this.props;
|
|
108
|
-
const { enumOptions } = this.state;
|
|
109
|
-
const commonOptions = {
|
|
110
|
-
id,
|
|
111
|
-
value: this.state.value,
|
|
112
|
-
placeholder: utils_1.getUiOptions(this.props).placeholder,
|
|
113
|
-
data: enumOptions,
|
|
114
|
-
valueField: "value",
|
|
115
|
-
textField: "label",
|
|
116
|
-
disabled: disabled || readonly,
|
|
117
|
-
filter: "contains",
|
|
118
|
-
messages: {
|
|
119
|
-
open: formContext.translations.Open,
|
|
120
|
-
emptyList: formContext.translations.NoResults,
|
|
121
|
-
emptyFilter: formContext.translations.NoResults
|
|
122
|
-
},
|
|
123
|
-
onFocus: this.onFocus,
|
|
124
|
-
onBlur: this.onBlur,
|
|
125
|
-
onToggle: this.onToggle,
|
|
126
|
-
open: this.state.open,
|
|
127
|
-
onKeyDown: this.onKeyDown
|
|
128
|
-
};
|
|
129
|
-
const selectComponent = multiple ? (React.createElement(Multiselect, Object.assign({}, commonOptions, { onChange: this.multiSelectOnChange, ref: this.setRef }))) : (React.createElement(Combobox, Object.assign({}, commonOptions, { onChange: this.selectOnChange, ref: this.setRef, onClick: this.onClick, onSelect: this.onSelect })));
|
|
130
|
-
return (React.createElement(components_1.TooltipComponent, { placement: "top", trigger: "hover", tooltip: (multiple || utils_1.isEmptyString(this.props.value)) ? undefined : this.state.valsToItems[this.props.value].label },
|
|
131
|
-
React.createElement("div", null, selectComponent)));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
SelectWidget.contextType = ReactContext_1.default;
|
|
135
|
-
SelectWidget.defaultProps = {
|
|
136
|
-
autofocus: false,
|
|
137
|
-
};
|
|
138
|
-
SelectWidget.propTypes = {
|
|
139
|
-
schema: PropTypes.shape({
|
|
140
|
-
type: PropTypes.oneOf(["string", "array"])
|
|
141
|
-
}),
|
|
142
|
-
id: PropTypes.string.isRequired,
|
|
143
|
-
uiSchema: PropTypes.shape({
|
|
144
|
-
"ui:options": PropTypes.shape({
|
|
145
|
-
enumOptions: PropTypes.array,
|
|
146
|
-
order: PropTypes.array,
|
|
147
|
-
filter: PropTypes.array,
|
|
148
|
-
filterType: PropTypes.string,
|
|
149
|
-
labels: PropTypes.object,
|
|
150
|
-
})
|
|
151
|
-
}),
|
|
152
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
153
|
-
required: PropTypes.bool,
|
|
154
|
-
multiple: PropTypes.bool,
|
|
155
|
-
autofocus: PropTypes.bool,
|
|
156
|
-
onChange: PropTypes.func,
|
|
157
|
-
};
|
|
158
|
-
exports.default = SelectWidget;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default class SeparatedDateTimeWidget extends React.Component<any, any, any> {
|
|
2
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
3
|
-
static propTypes: {
|
|
4
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
5
|
-
type: PropTypes.Requireable<string>;
|
|
6
|
-
}>>;
|
|
7
|
-
value: PropTypes.Requireable<string>;
|
|
8
|
-
};
|
|
9
|
-
constructor(props: any);
|
|
10
|
-
constructor(props: any, context: any);
|
|
11
|
-
getStateFromProps(props: any): {
|
|
12
|
-
date: any;
|
|
13
|
-
time: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
onDateChange: (value: any) => void;
|
|
16
|
-
onTimeChange: (value: any) => void;
|
|
17
|
-
}
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
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 DateWidget_1 = require("./DateWidget");
|
|
12
|
-
const TimeWidget_1 = require("./TimeWidget");
|
|
13
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
14
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
15
|
-
let SeparatedDateTimeWidget = class SeparatedDateTimeWidget extends React.Component {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.onDateChange = (value) => {
|
|
19
|
-
this.props.onChange(value ? (this.state.time ? value + this.state.time : value) : null);
|
|
20
|
-
};
|
|
21
|
-
this.onTimeChange = (value) => {
|
|
22
|
-
this.props.onChange(value ? this.state.date + value : this.state.date);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
getStateFromProps(props) {
|
|
26
|
-
let { value } = props;
|
|
27
|
-
let date, time;
|
|
28
|
-
if (value) {
|
|
29
|
-
let splitted = value.split("T");
|
|
30
|
-
if (splitted.length == 2) {
|
|
31
|
-
time = "T" + splitted[1];
|
|
32
|
-
}
|
|
33
|
-
date = splitted[0];
|
|
34
|
-
}
|
|
35
|
-
return { date, time };
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
const hasDate = !!this.state.date;
|
|
39
|
-
const { Row, Col, FormGroup } = this.context.theme;
|
|
40
|
-
return (React.createElement(Row, null,
|
|
41
|
-
React.createElement(Col, { lg: hasDate ? 6 : 12 },
|
|
42
|
-
React.createElement(FormGroup, null,
|
|
43
|
-
React.createElement(DateWidget_1.default, Object.assign({}, this.props, { onChange: this.onDateChange, value: this.state.date })))),
|
|
44
|
-
hasDate ? (React.createElement(Col, { lg: 6 },
|
|
45
|
-
React.createElement(FormGroup, null,
|
|
46
|
-
React.createElement(TimeWidget_1.default, Object.assign({}, this.props, { onChange: this.onTimeChange, value: this.state.time }))))) : null));
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
SeparatedDateTimeWidget.contextType = ReactContext_1.default;
|
|
50
|
-
SeparatedDateTimeWidget.propTypes = {
|
|
51
|
-
schema: PropTypes.shape({
|
|
52
|
-
type: PropTypes.oneOf(["string"])
|
|
53
|
-
}).isRequired,
|
|
54
|
-
value: PropTypes.string
|
|
55
|
-
};
|
|
56
|
-
SeparatedDateTimeWidget = __decorate([
|
|
57
|
-
BaseComponent_1.default
|
|
58
|
-
], SeparatedDateTimeWidget);
|
|
59
|
-
exports.default = SeparatedDateTimeWidget;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default class TaxonImageWidget extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
type: PropTypes.Requireable<string>;
|
|
5
|
-
}>>;
|
|
6
|
-
value: PropTypes.Requireable<string>;
|
|
7
|
-
};
|
|
8
|
-
constructor(props: any);
|
|
9
|
-
constructor(props: any, context: any);
|
|
10
|
-
onTaxonImageClick: (taxonID: any) => () => void;
|
|
11
|
-
}
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
class TaxonImageWidget extends React.Component {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.onTaxonImageClick = (taxonID) => () => {
|
|
10
|
-
this.props.onChange(taxonID);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
render() {
|
|
14
|
-
const { SchemaField } = this.props.registry.fields;
|
|
15
|
-
const { uiSchema } = utils_1.getUiOptions(this.props);
|
|
16
|
-
const schemaField = uiSchema
|
|
17
|
-
? React.createElement(SchemaField, Object.assign({}, this.props, { schema: Object.assign(Object.assign({}, this.props.schema), { title: "" }), uiSchema: Object.assign(Object.assign({}, uiSchema), { "ui:title": "" }) }))
|
|
18
|
-
: null;
|
|
19
|
-
return (React.createElement(React.Fragment, null,
|
|
20
|
-
["MX.45", "MX.255"].map(taxonID => React.createElement("div", { key: taxonID, style: { height: 100, width: 100 }, onClick: this.onTaxonImageClick(taxonID) })),
|
|
21
|
-
schemaField));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.default = TaxonImageWidget;
|
|
25
|
-
TaxonImageWidget.propTypes = {
|
|
26
|
-
schema: PropTypes.shape({
|
|
27
|
-
type: PropTypes.oneOf(["string"])
|
|
28
|
-
}).isRequired,
|
|
29
|
-
value: PropTypes.string
|
|
30
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default TextSelectWidget;
|
|
2
|
-
declare class TextSelectWidget extends React.Component<any, any, any> {
|
|
3
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
4
|
-
static propTypes: {
|
|
5
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
6
|
-
type: PropTypes.Requireable<string>;
|
|
7
|
-
}>>;
|
|
8
|
-
value: PropTypes.Requireable<string>;
|
|
9
|
-
};
|
|
10
|
-
constructor(props: any);
|
|
11
|
-
getInitialState(props: any): {
|
|
12
|
-
selectedCheckboxes: Set<any>;
|
|
13
|
-
enums: any;
|
|
14
|
-
otherValue: string;
|
|
15
|
-
freeTextField: any;
|
|
16
|
-
};
|
|
17
|
-
getStateFromProps(props: any): {
|
|
18
|
-
otherValue: string;
|
|
19
|
-
};
|
|
20
|
-
onCheckBoxChange: (label: any) => () => void;
|
|
21
|
-
onInputChange: (value: any) => void;
|
|
22
|
-
onChange: (textValue: any) => void;
|
|
23
|
-
}
|
|
24
|
-
import * as React from "react";
|
|
25
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const immutability_helper_1 = require("immutability-helper");
|
|
7
|
-
const BaseInputTemplate_1 = require("../templates/BaseInputTemplate");
|
|
8
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
9
|
-
class TextSelectWidget extends React.Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
this.onCheckBoxChange = (label) => () => {
|
|
13
|
-
const selectedCheckboxes = this.state.selectedCheckboxes;
|
|
14
|
-
if (selectedCheckboxes.has(label)) {
|
|
15
|
-
selectedCheckboxes.delete(label);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
selectedCheckboxes.add(label);
|
|
19
|
-
}
|
|
20
|
-
this.setState({ selectedCheckboxes: selectedCheckboxes });
|
|
21
|
-
this.onChange(this.state.otherValue);
|
|
22
|
-
};
|
|
23
|
-
this.onInputChange = (value) => {
|
|
24
|
-
this.onChange(value);
|
|
25
|
-
};
|
|
26
|
-
this.onChange = (textValue) => {
|
|
27
|
-
let newValue = [...Array.from(this.state.selectedCheckboxes)];
|
|
28
|
-
if (this.state.selectedCheckboxes.has(this.state.freeTextField)) {
|
|
29
|
-
if (textValue && textValue.length > 0) {
|
|
30
|
-
newValue = immutability_helper_1.default(newValue, { $push: [textValue] });
|
|
31
|
-
}
|
|
32
|
-
newValue.splice(newValue.indexOf(this.state.freeTextField), 1);
|
|
33
|
-
}
|
|
34
|
-
this.props.onChange(newValue.join(", "));
|
|
35
|
-
};
|
|
36
|
-
this.state = this.getInitialState(props);
|
|
37
|
-
}
|
|
38
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
39
|
-
this.setState(this.getStateFromProps(props));
|
|
40
|
-
}
|
|
41
|
-
getInitialState(props) {
|
|
42
|
-
let { enums = [], delimiter = ", ", freeTextField } = utils_1.getUiOptions(props);
|
|
43
|
-
const { value } = props;
|
|
44
|
-
const selectedCheckboxes = new Set();
|
|
45
|
-
const values = !value ? [] : value.split(delimiter);
|
|
46
|
-
const otherValues = [];
|
|
47
|
-
values.map(val => {
|
|
48
|
-
if (enums.indexOf(val) !== -1) {
|
|
49
|
-
selectedCheckboxes.add(val);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
otherValues.push(val);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
if (otherValues.length > 0) {
|
|
56
|
-
selectedCheckboxes.add(freeTextField);
|
|
57
|
-
}
|
|
58
|
-
return { selectedCheckboxes, enums, otherValue: otherValues.join(delimiter), freeTextField };
|
|
59
|
-
}
|
|
60
|
-
getStateFromProps(props) {
|
|
61
|
-
let { enums = [], delimiter = ", " } = utils_1.getUiOptions(props);
|
|
62
|
-
const { value } = props;
|
|
63
|
-
const values = !value ? [] : value.split(delimiter);
|
|
64
|
-
const otherValues = [];
|
|
65
|
-
values.map(val => {
|
|
66
|
-
if (enums.indexOf(val) === -1) {
|
|
67
|
-
otherValues.push(val);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return { otherValue: otherValues.join(delimiter) };
|
|
71
|
-
}
|
|
72
|
-
render() {
|
|
73
|
-
let { enums, otherValue, freeTextField, selectedCheckboxes } = this.state;
|
|
74
|
-
if (freeTextField) {
|
|
75
|
-
enums = immutability_helper_1.default(enums, { $push: [freeTextField] });
|
|
76
|
-
}
|
|
77
|
-
const { Checkbox } = this.context.theme;
|
|
78
|
-
return (React.createElement("div", { className: "laji-text-select" },
|
|
79
|
-
enums.map((label, i) => {
|
|
80
|
-
return (React.createElement(Checkbox, { key: i, title: label, checked: selectedCheckboxes.has(label), onChange: this.onCheckBoxChange(label) }, label));
|
|
81
|
-
}),
|
|
82
|
-
freeTextField ?
|
|
83
|
-
React.createElement(BaseInputTemplate_1.default, Object.assign({}, this.props, { id: this.props.id + "_input", value: otherValue, onChange: this.onInputChange, disabled: !selectedCheckboxes.has(freeTextField) }))
|
|
84
|
-
: null));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
TextSelectWidget.contextType = ReactContext_1.default;
|
|
88
|
-
TextSelectWidget.propTypes = {
|
|
89
|
-
schema: PropTypes.shape({
|
|
90
|
-
type: PropTypes.oneOf(["string"])
|
|
91
|
-
}).isRequired,
|
|
92
|
-
value: PropTypes.string
|
|
93
|
-
};
|
|
94
|
-
exports.default = TextSelectWidget;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export default class TextareaWidget extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
4
|
-
emptyValue: PropTypes.Requireable<string>;
|
|
5
|
-
rows: PropTypes.Requireable<number>;
|
|
6
|
-
}>>;
|
|
7
|
-
schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
8
|
-
type: PropTypes.Requireable<string>;
|
|
9
|
-
}>>;
|
|
10
|
-
value: PropTypes.Requireable<string>;
|
|
11
|
-
};
|
|
12
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
13
|
-
constructor(props: any);
|
|
14
|
-
textareaRef: React.RefObject<any>;
|
|
15
|
-
_context: Record<string, unknown>;
|
|
16
|
-
getStateFromProps: (props: any) => {
|
|
17
|
-
value: any;
|
|
18
|
-
};
|
|
19
|
-
onFocus: (e: any) => void;
|
|
20
|
-
focused: boolean | undefined;
|
|
21
|
-
onBlur: (e: any) => void;
|
|
22
|
-
onChange: (value: any) => void;
|
|
23
|
-
timeout: any;
|
|
24
|
-
_onChange: ({ target: { value } }: {
|
|
25
|
-
target: {
|
|
26
|
-
value: any;
|
|
27
|
-
};
|
|
28
|
-
}) => void;
|
|
29
|
-
onKeyDown: (e: any) => void;
|
|
30
|
-
}
|
|
31
|
-
import * as React from "react";
|
|
32
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const components_1 = require("../components");
|
|
7
|
-
const Context_1 = require("../../Context");
|
|
8
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
9
|
-
const utils_2 = require("../../utils");
|
|
10
|
-
class TextareaWidget extends React.Component {
|
|
11
|
-
constructor(props) {
|
|
12
|
-
super(props);
|
|
13
|
-
this.getStateFromProps = (props) => {
|
|
14
|
-
return { value: props.value };
|
|
15
|
-
};
|
|
16
|
-
this.onFocus = (e) => {
|
|
17
|
-
this.focused = true;
|
|
18
|
-
this.props.onFocus && this.props.onFocus(e);
|
|
19
|
-
};
|
|
20
|
-
this.onBlur = (e) => {
|
|
21
|
-
this.focused = false;
|
|
22
|
-
if (this.state.value !== this.props.value) {
|
|
23
|
-
this.props.onChange(this.state.value);
|
|
24
|
-
}
|
|
25
|
-
if (this.timeout)
|
|
26
|
-
clearTimeout(this.timeout);
|
|
27
|
-
this.props.onBlur && this.props.onBlur(e);
|
|
28
|
-
};
|
|
29
|
-
this.onChange = (value) => {
|
|
30
|
-
this.setState({ value }, () => {
|
|
31
|
-
if (!this.focused) {
|
|
32
|
-
this.props.onChange(value);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (this.timeout)
|
|
36
|
-
clearTimeout(this.timeout);
|
|
37
|
-
this.timeout = this.props.formContext.setTimeout(() => {
|
|
38
|
-
this.props.onChange(value === "" ? utils_2.getUiOptions(this.props).emptyValue : value);
|
|
39
|
-
}, 1000);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
this._onChange = ({ target: { value } }) => {
|
|
44
|
-
this.onChange(value);
|
|
45
|
-
};
|
|
46
|
-
this.onKeyDown = (e) => {
|
|
47
|
-
const inputAllowed = !this.props.disabled && !this.props.readonly;
|
|
48
|
-
const isCtrlEnter = e.ctrlKey && e.key === "Enter";
|
|
49
|
-
if (this.state.enterReserved && inputAllowed && isCtrlEnter) {
|
|
50
|
-
this.onChange(this.state.value + "\n");
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
this.state = this.getStateFromProps(props);
|
|
56
|
-
this.textareaRef = React.createRef();
|
|
57
|
-
this._context = Context_1.default(props.formContext.contextId);
|
|
58
|
-
Object.keys(props.formContext.services.keyHandler.shortcuts).some(keyCombo => {
|
|
59
|
-
if (keyCombo === "Enter") {
|
|
60
|
-
// // Direct mutation should be ok in constructor.
|
|
61
|
-
this.state.enterReserved = true; // eslint-disable-line react/no-direct-mutation-state
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
66
|
-
this.setState(this.getStateFromProps(props));
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
const { id, options, placeholder, disabled, readonly, autofocus } = this.props;
|
|
70
|
-
const { value } = this.state;
|
|
71
|
-
const { required = this.props.required } = options;
|
|
72
|
-
const textarea = React.createElement("textarea", { id: id, className: "form-control", value: typeof value === "undefined" ? "" : value, placeholder: placeholder, required: required, disabled: disabled, readOnly: readonly, autoFocus: autofocus, rows: options.rows, onFocus: this.onFocus, onBlur: this.onBlur, onChange: this._onChange, onKeyDown: this.onKeyDown });
|
|
73
|
-
return this.state.enterReserved ? (React.createElement(components_1.TooltipComponent, { tooltip: `${utils_1.stringifyKeyCombo("ctrl+Enter")} ${this.props.formContext.translations.textareaHint}`, placement: "bottom" }, textarea)) : textarea;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.default = TextareaWidget;
|
|
77
|
-
TextareaWidget.propTypes = {
|
|
78
|
-
"ui:options": PropTypes.shape({
|
|
79
|
-
emptyValue: PropTypes.string,
|
|
80
|
-
rows: PropTypes.number,
|
|
81
|
-
}),
|
|
82
|
-
schema: PropTypes.shape({
|
|
83
|
-
type: PropTypes.oneOf(["string"])
|
|
84
|
-
}),
|
|
85
|
-
value: PropTypes.string
|
|
86
|
-
};
|
|
87
|
-
TextareaWidget.contextType = ReactContext_1.default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export default TimeWidget;
|
|
2
|
-
declare function TimeWidget(props: any): JSX.Element;
|
|
3
|
-
declare namespace TimeWidget {
|
|
4
|
-
namespace propTypes {
|
|
5
|
-
const schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
-
type: PropTypes.Requireable<string>;
|
|
7
|
-
}>>;
|
|
8
|
-
const value: PropTypes.Requireable<string>;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const moment = require("moment");
|
|
6
|
-
const DateTimeWidget_1 = require("./DateTimeWidget");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const TimeWidget = (props) => {
|
|
9
|
-
const { onChange } = props;
|
|
10
|
-
const _onChange = React.useCallback((value) => onChange(utils_1.isEmptyString(value) ? undefined : (moment(value).format("HH:mm"))), [onChange]);
|
|
11
|
-
return (React.createElement(DateTimeWidget_1.default, Object.assign({}, props, { onChange: _onChange, calendar: false, value: props.value ? (moment().format("YYYY-MM-DD") + `T${props.value}`) : null })));
|
|
12
|
-
};
|
|
13
|
-
TimeWidget.propTypes = {
|
|
14
|
-
schema: PropTypes.shape({
|
|
15
|
-
type: PropTypes.oneOf(["string"])
|
|
16
|
-
}),
|
|
17
|
-
value: PropTypes.string
|
|
18
|
-
};
|
|
19
|
-
exports.default = TimeWidget;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default URLWidget;
|
|
2
|
-
declare function URLWidget({ value, options }: {
|
|
3
|
-
value: any;
|
|
4
|
-
options?: {} | undefined;
|
|
5
|
-
}): JSX.Element;
|
|
6
|
-
declare namespace URLWidget {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
const schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
9
|
-
type: PropTypes.Requireable<string>;
|
|
10
|
-
}>>;
|
|
11
|
-
const value: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const URLWidget = ({ value, options = {} }) => React.createElement("a", { href: `${options.template || ""}${value}`, target: "_blank", rel: "noopener noreferrer" }, `${options.template || ""}${value}`);
|
|
6
|
-
URLWidget.propTypes = {
|
|
7
|
-
schema: PropTypes.shape({
|
|
8
|
-
type: PropTypes.oneOf(["string"])
|
|
9
|
-
}),
|
|
10
|
-
value: PropTypes.string
|
|
11
|
-
};
|
|
12
|
-
exports.default = URLWidget;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default class UpperCaseWidget extends React.Component<any, any, any> {
|
|
2
|
-
static propTypes: {
|
|
3
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
4
|
-
type: PropTypes.Requireable<string>;
|
|
5
|
-
}>>;
|
|
6
|
-
value: PropTypes.Requireable<string>;
|
|
7
|
-
};
|
|
8
|
-
constructor(props: any);
|
|
9
|
-
constructor(props: any, context: any);
|
|
10
|
-
formatValue: (value: any) => any;
|
|
11
|
-
}
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const BaseInputTemplate_1 = require("../templates/BaseInputTemplate");
|
|
6
|
-
class UpperCaseWidget extends React.Component {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.formatValue = (value) => typeof value === "string" ? value.toUpperCase() : value;
|
|
10
|
-
}
|
|
11
|
-
render() {
|
|
12
|
-
return React.createElement(BaseInputTemplate_1.default, Object.assign({}, this.props, { formatValue: this.formatValue }));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = UpperCaseWidget;
|
|
16
|
-
UpperCaseWidget.propTypes = {
|
|
17
|
-
schema: PropTypes.shape({
|
|
18
|
-
type: PropTypes.oneOf(["string"])
|
|
19
|
-
}).isRequired,
|
|
20
|
-
value: PropTypes.string
|
|
21
|
-
};
|
package/lib/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import LajiForm, { LajiFormProps } from "./components/LajiForm";
|
|
2
|
-
declare type LajiFormWrapperProps = LajiFormProps & {
|
|
3
|
-
rootElem: HTMLDivElement;
|
|
4
|
-
};
|
|
5
|
-
export default class LajiFormWrapper {
|
|
6
|
-
props: LajiFormProps;
|
|
7
|
-
state: LajiFormProps;
|
|
8
|
-
rootElem: HTMLDivElement;
|
|
9
|
-
lajiForm: LajiForm;
|
|
10
|
-
constructor(props: LajiFormWrapperProps);
|
|
11
|
-
submit: () => void;
|
|
12
|
-
submitOnlySchemaValidations: () => void;
|
|
13
|
-
setState: (state: Partial<LajiFormProps>) => void;
|
|
14
|
-
pushBlockingLoader: () => void;
|
|
15
|
-
popBlockingLoader: () => void;
|
|
16
|
-
getSettings: () => {};
|
|
17
|
-
destroy: () => void;
|
|
18
|
-
unmount: () => void;
|
|
19
|
-
}
|
|
20
|
-
export {};
|