@luomus/laji-form 15.1.63 → 15.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laji-form.js +1 -1
- package/dist/laji-form.js.LICENSE.txt +1 -1
- package/lib/Context.d.ts +1 -1
- package/lib/Context.js +1 -2
- package/lib/ReactContext.js +22 -8
- package/lib/components/BaseComponent.d.ts +1 -2
- package/lib/components/BaseComponent.js +2 -3
- package/lib/components/LajiForm.d.ts +13 -13
- package/lib/components/LajiForm.js +51 -35
- package/lib/components/VirtualSchemaField.d.ts +14 -14
- package/lib/components/VirtualSchemaField.js +31 -18
- package/lib/components/components/Affix.d.ts +2 -2
- package/lib/components/components/Affix.js +25 -12
- package/lib/components/components/Button.d.ts +6 -6
- package/lib/components/components/Button.js +23 -9
- package/lib/components/components/DeleteButton.d.ts +4 -4
- package/lib/components/components/DeleteButton.js +25 -11
- package/lib/components/components/ErrorPanel.d.ts +3 -3
- package/lib/components/components/ErrorPanel.js +22 -8
- package/lib/components/components/FailedBackgroundJobsPanel.d.ts +2 -2
- package/lib/components/components/FailedBackgroundJobsPanel.js +25 -11
- package/lib/components/components/FetcherInput.d.ts +1 -1
- package/lib/components/components/FetcherInput.js +28 -14
- package/lib/components/components/Fullscreen.d.ts +1 -1
- package/lib/components/components/Fullscreen.js +23 -9
- package/lib/components/components/GlyphButton.d.ts +5 -5
- package/lib/components/components/GlyphButton.js +22 -8
- package/lib/components/components/Help.d.ts +1 -1
- package/lib/components/components/Help.js +25 -12
- package/lib/components/components/Label.d.ts +1 -1
- package/lib/components/components/Label.js +24 -11
- package/lib/components/components/OverlayTrigger.d.ts +4 -4
- package/lib/components/components/OverlayTrigger.js +22 -8
- package/lib/components/components/Stretch.d.ts +4 -4
- package/lib/components/components/Stretch.js +25 -11
- package/lib/components/components/TooltipComponent.d.ts +1 -1
- package/lib/components/components/TooltipComponent.js +26 -12
- package/lib/components/components/index.js +5 -1
- package/lib/components/fields/AnnotationField.d.ts +8 -4
- package/lib/components/fields/AnnotationField.js +34 -20
- package/lib/components/fields/AnyToBooleanField.d.ts +4 -4
- package/lib/components/fields/AnyToBooleanField.js +22 -8
- package/lib/components/fields/ArrayBulkField.d.ts +9 -4
- package/lib/components/fields/ArrayBulkField.js +24 -10
- package/lib/components/fields/ArrayCombinerField.d.ts +4 -4
- package/lib/components/fields/ArrayCombinerField.js +25 -11
- package/lib/components/fields/ArrayField.d.ts +1 -0
- package/lib/components/fields/ArrayField.js +41 -27
- package/lib/components/fields/ArrayPropertySumField.d.ts +2 -2
- package/lib/components/fields/ArrayPropertySumField.js +24 -10
- package/lib/components/fields/AsArrayField.d.ts +7 -5
- package/lib/components/fields/AsArrayField.js +22 -8
- package/lib/components/fields/AudioArrayField.js +22 -8
- package/lib/components/fields/AutoArrayField.d.ts +2 -2
- package/lib/components/fields/AutoArrayField.js +26 -12
- package/lib/components/fields/AutosuggestField.d.ts +14 -6
- package/lib/components/fields/AutosuggestField.js +61 -47
- package/lib/components/fields/CombinedValueDisplayField.d.ts +6 -6
- package/lib/components/fields/CombinedValueDisplayField.js +24 -10
- package/lib/components/fields/CondensedObjectField.d.ts +3 -3
- package/lib/components/fields/CondensedObjectField.js +33 -19
- package/lib/components/fields/ConditionalOnChangeField.d.ts +7 -7
- package/lib/components/fields/ConditionalOnChangeField.js +22 -8
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +19 -19
- package/lib/components/fields/ConditionalUiSchemaField.js +28 -14
- package/lib/components/fields/ContextInjectionField.d.ts +7 -7
- package/lib/components/fields/ContextInjectionField.js +26 -13
- package/lib/components/fields/DataLeakerField.d.ts +6 -6
- package/lib/components/fields/DataLeakerField.js +25 -11
- package/lib/components/fields/DefaultValueArrayField.d.ts +6 -6
- package/lib/components/fields/DefaultValueArrayField.js +23 -9
- package/lib/components/fields/DependentBooleanField.d.ts +6 -6
- package/lib/components/fields/DependentBooleanField.js +24 -10
- package/lib/components/fields/DependentDisableField.d.ts +4 -4
- package/lib/components/fields/DependentDisableField.js +24 -10
- package/lib/components/fields/EnumRangeArrayField.d.ts +2 -3
- package/lib/components/fields/EnumRangeArrayField.js +26 -12
- package/lib/components/fields/ExtraLabelRowField.d.ts +9 -8
- package/lib/components/fields/ExtraLabelRowField.js +27 -13
- package/lib/components/fields/FakePropertyField.d.ts +2 -2
- package/lib/components/fields/FakePropertyField.js +26 -12
- package/lib/components/fields/FillDateRangeField.d.ts +28 -0
- package/lib/components/fields/FillDateRangeField.js +91 -0
- package/lib/components/fields/FilterArrayField.d.ts +13 -12
- package/lib/components/fields/FilterArrayField.js +27 -13
- package/lib/components/fields/FlatField.d.ts +4 -4
- package/lib/components/fields/FlatField.js +35 -21
- package/lib/components/fields/GeocoderField.d.ts +12 -4
- package/lib/components/fields/GeocoderField.js +38 -24
- package/lib/components/fields/GridLayoutField.d.ts +7 -7
- package/lib/components/fields/GridLayoutField.js +23 -9
- package/lib/components/fields/HiddenField.d.ts +2 -2
- package/lib/components/fields/HiddenField.js +22 -8
- package/lib/components/fields/HiddenWithTextField.d.ts +6 -7
- package/lib/components/fields/HiddenWithTextField.js +22 -8
- package/lib/components/fields/ImageArrayField.d.ts +17 -17
- package/lib/components/fields/ImageArrayField.js +53 -39
- package/lib/components/fields/ImageDisplayField.d.ts +4 -3
- package/lib/components/fields/ImageDisplayField.js +25 -11
- package/lib/components/fields/InitiallyHiddenField.d.ts +9 -4
- package/lib/components/fields/InitiallyHiddenField.js +23 -9
- package/lib/components/fields/InjectDefaultValueField.d.ts +6 -6
- package/lib/components/fields/InjectDefaultValueField.js +23 -9
- package/lib/components/fields/InjectField.d.ts +8 -8
- package/lib/components/fields/InjectField.js +34 -20
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +8 -8
- package/lib/components/fields/InputWithDefaultValueButtonField.js +29 -15
- package/lib/components/fields/LocalityField.d.ts +4 -2
- package/lib/components/fields/LocalityField.js +28 -14
- package/lib/components/fields/LocationChooserField.d.ts +5 -4
- package/lib/components/fields/LocationChooserField.js +60 -46
- package/lib/components/fields/MapArrayField.d.ts +17 -4
- package/lib/components/fields/MapArrayField.js +137 -132
- package/lib/components/fields/MapField.d.ts +10 -2
- package/lib/components/fields/MapField.js +42 -29
- package/lib/components/fields/MultiActiveArrayField.d.ts +3 -3
- package/lib/components/fields/MultiActiveArrayField.js +29 -15
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +6 -2
- package/lib/components/fields/MultiAnyToBooleanField.js +25 -11
- package/lib/components/fields/MultiArrayField.d.ts +11 -10
- package/lib/components/fields/MultiArrayField.js +45 -31
- package/lib/components/fields/MultiLanguageField.d.ts +3 -2
- package/lib/components/fields/MultiLanguageField.js +23 -9
- package/lib/components/fields/MultiTagArrayField.d.ts +8 -4
- package/lib/components/fields/MultiTagArrayField.js +34 -20
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.d.ts +2 -2
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.js +25 -11
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.d.ts +6 -6
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.js +29 -16
- package/lib/components/fields/NamedPlaceChooserField/Popup.d.ts +1 -1
- package/lib/components/fields/NamedPlaceChooserField/Popup.js +29 -15
- package/lib/components/fields/NamedPlaceSaverField.d.ts +7 -5
- package/lib/components/fields/NamedPlaceSaverField.js +35 -21
- package/lib/components/fields/NestField.d.ts +4 -4
- package/lib/components/fields/NestField.js +36 -23
- package/lib/components/fields/ObjectField.js +36 -22
- package/lib/components/fields/PdfArrayField.js +22 -8
- package/lib/components/fields/PrefillingArrayField.d.ts +2 -2
- package/lib/components/fields/PrefillingArrayField.js +23 -9
- package/lib/components/fields/PrefixArrayField.d.ts +35 -0
- package/lib/components/fields/PrefixArrayField.js +138 -0
- package/lib/components/fields/SchemaField.d.ts +1 -1
- package/lib/components/fields/SchemaField.js +34 -20
- package/lib/components/fields/ScopeField.d.ts +14 -6
- package/lib/components/fields/ScopeField.js +53 -39
- package/lib/components/fields/SectionArrayField.d.ts +2 -2
- package/lib/components/fields/SectionArrayField.js +110 -96
- package/lib/components/fields/SelectTreeField.d.ts +0 -1
- package/lib/components/fields/SelectTreeField.js +30 -16
- package/lib/components/fields/SingleActiveArrayField.d.ts +14 -2
- package/lib/components/fields/SingleActiveArrayField.js +112 -98
- package/lib/components/fields/SingleItemArrayField.d.ts +3 -2
- package/lib/components/fields/SingleItemArrayField.js +28 -14
- package/lib/components/fields/SortArrayField.d.ts +9 -9
- package/lib/components/fields/SortArrayField.js +43 -29
- package/lib/components/fields/SplitField.d.ts +4 -4
- package/lib/components/fields/SplitField.js +26 -12
- package/lib/components/fields/StringToArrayField.d.ts +5 -5
- package/lib/components/fields/StringToArrayField.js +23 -9
- package/lib/components/fields/SumField.d.ts +6 -6
- package/lib/components/fields/SumField.js +22 -8
- package/lib/components/fields/TableField.d.ts +4 -3
- package/lib/components/fields/TableField.js +31 -17
- package/lib/components/fields/TagArrayField.d.ts +8 -2
- package/lib/components/fields/TagArrayField.js +37 -23
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +10 -5
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +30 -16
- package/lib/components/fields/UiFieldApplierField.d.ts +4 -4
- package/lib/components/fields/UiFieldApplierField.js +33 -19
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +7 -6
- package/lib/components/fields/UiFieldMapperArrayField.js +26 -12
- package/lib/components/fields/UnitCountShorthandField.d.ts +6 -6
- package/lib/components/fields/UnitCountShorthandField.js +31 -17
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +6 -5
- package/lib/components/fields/UnitListShorthandArrayField.js +31 -17
- package/lib/components/fields/UnitShorthandField.d.ts +11 -5
- package/lib/components/fields/UnitShorthandField.js +41 -27
- package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
- package/lib/components/templates/ArrayFieldTemplate.js +60 -46
- package/lib/components/templates/BaseInputTemplate.d.ts +3 -0
- package/lib/components/templates/BaseInputTemplate.js +26 -13
- package/lib/components/templates/DescriptionField.js +25 -11
- package/lib/components/templates/ErrorListTemplate.d.ts +5 -0
- package/lib/components/templates/ErrorListTemplate.js +26 -12
- package/lib/components/templates/FieldTemplate.d.ts +8 -0
- package/lib/components/templates/FieldTemplate.js +31 -17
- package/lib/components/templates/ObjectFieldTemplate.js +30 -17
- package/lib/components/templates/TitleField.js +27 -13
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +6 -6
- package/lib/components/widgets/AnyToBooleanWidget.js +24 -10
- package/lib/components/widgets/AutosuggestWidget.d.ts +14 -2
- package/lib/components/widgets/AutosuggestWidget.js +49 -35
- package/lib/components/widgets/CheckboxWidget.d.ts +3 -0
- package/lib/components/widgets/CheckboxWidget.js +32 -18
- package/lib/components/widgets/DateTimeWidget.d.ts +16 -8
- package/lib/components/widgets/DateTimeWidget.js +67 -35
- package/lib/components/widgets/DateWidget.d.ts +11 -11
- package/lib/components/widgets/DateWidget.js +36 -14
- package/lib/components/widgets/HiddenWidget.d.ts +4 -4
- package/lib/components/widgets/HiddenWidget.js +22 -8
- package/lib/components/widgets/ImageSelectWidget.d.ts +1 -0
- package/lib/components/widgets/ImageSelectWidget.js +24 -10
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +12 -0
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +26 -12
- package/lib/components/widgets/InputGroupWidget.d.ts +4 -3
- package/lib/components/widgets/InputGroupWidget.js +25 -11
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +18 -8
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +50 -14
- package/lib/components/widgets/NumberWidget.d.ts +3 -2
- package/lib/components/widgets/NumberWidget.js +23 -9
- package/lib/components/widgets/PlainTextWidget.d.ts +3 -3
- package/lib/components/widgets/PlainTextWidget.js +24 -10
- package/lib/components/widgets/SelectWidget.d.ts +5 -6
- package/lib/components/widgets/SelectWidget.js +92 -72
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +3 -2
- package/lib/components/widgets/SeparatedDateTimeWidget.js +22 -8
- package/lib/components/widgets/TaxonImageWidget.d.ts +3 -2
- package/lib/components/widgets/TaxonImageWidget.js +24 -10
- package/lib/components/widgets/TextSelectWidget.d.ts +10 -2
- package/lib/components/widgets/TextSelectWidget.js +26 -12
- package/lib/components/widgets/TextareaWidget.d.ts +5 -0
- package/lib/components/widgets/TextareaWidget.js +25 -11
- package/lib/components/widgets/TimeWidget.d.ts +2 -2
- package/lib/components/widgets/TimeWidget.js +24 -10
- package/lib/components/widgets/URLWidget.d.ts +2 -2
- package/lib/components/widgets/URLWidget.js +22 -8
- package/lib/components/widgets/UpperCaseWidget.d.ts +3 -2
- package/lib/components/widgets/UpperCaseWidget.js +23 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +25 -11
- package/lib/services/custom-event-service.d.ts +1 -1
- package/lib/services/focus-service.d.ts +1 -1
- package/lib/services/focus-service.js +3 -3
- package/lib/services/id-service.d.ts +1 -1
- package/lib/services/id-service.js +5 -6
- package/lib/services/key-handler-service.d.ts +3 -4
- package/lib/services/key-handler-service.js +4 -4
- package/lib/services/multi-active-array-service.d.ts +1 -1
- package/lib/services/settings-service.d.ts +2 -3
- package/lib/services/settings-service.js +3 -3
- package/lib/services/submit-hook-service.js +1 -1
- package/lib/themes/bs3.js +22 -8
- package/lib/themes/bs5.js +23 -9
- package/lib/themes/stub.js +22 -8
- package/lib/themes/theme.d.ts +15 -15
- package/lib/translations.json +5 -0
- package/lib/types.d.ts +18 -19
- package/lib/types.js +3 -4
- package/lib/utils.d.ts +9 -9
- package/lib/utils.js +138 -134
- package/lib/validation.js +28 -12
- package/package.json +12 -11
- package/test-export/test-utils.d.ts +7 -7
- package/test-export/test-utils.js +36 -22
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,19 +21,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
21
|
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;
|
|
18
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
23
|
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
27
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
30
44
|
var DateTimeWidget_1;
|
|
31
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.YEAR_MATCH = void 0;
|
|
46
|
+
exports.YEAR_MONTH_MATCH = exports.YEAR_MATCH = void 0;
|
|
33
47
|
const React = __importStar(require("react"));
|
|
34
48
|
const react_dom_1 = require("react-dom");
|
|
35
49
|
const PropTypes = __importStar(require("prop-types"));
|
|
@@ -42,6 +56,7 @@ const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
|
42
56
|
const ReactContext_1 = __importDefault(require("../../ReactContext"));
|
|
43
57
|
const DATE_TIME_SEPARATOR = ", ";
|
|
44
58
|
exports.YEAR_MATCH = /^\d{4}$/;
|
|
59
|
+
exports.YEAR_MONTH_MATCH = /^\d{4}-\d{1,2}$/;
|
|
45
60
|
let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Component {
|
|
46
61
|
constructor(props) {
|
|
47
62
|
super(props);
|
|
@@ -51,21 +66,29 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
51
66
|
this.parse = (value) => {
|
|
52
67
|
if (!value)
|
|
53
68
|
value = "";
|
|
54
|
-
const { allowOnlyYear } = utils_1.getUiOptions(this.props);
|
|
69
|
+
const { allowOnlyYear, allowOnlyYearAndMonth } = (0, utils_1.getUiOptions)(this.props);
|
|
55
70
|
const hasTime = value.includes(DATE_TIME_SEPARATOR) || this.state.time && !this.state.calendar;
|
|
56
71
|
const onlyYear = allowOnlyYear && this.state.calendar && value.match(exports.YEAR_MATCH);
|
|
57
|
-
let
|
|
72
|
+
let onlyYearAndMonth = false;
|
|
73
|
+
let momentValue = (0, moment_1.default)(value, onlyYear ? "YYYY" : this.state.format);
|
|
74
|
+
if (!momentValue.isValid() && allowOnlyYearAndMonth) {
|
|
75
|
+
momentValue = (0, moment_1.default)(value, this.state.yearAndMonthDateFormat);
|
|
76
|
+
onlyYearAndMonth = true;
|
|
77
|
+
}
|
|
58
78
|
if (!momentValue.isValid()) {
|
|
59
79
|
return "";
|
|
60
80
|
}
|
|
61
81
|
const isoValue = onlyYear
|
|
62
82
|
? value
|
|
63
|
-
:
|
|
64
|
-
? momentValue.
|
|
65
|
-
:
|
|
83
|
+
: onlyYearAndMonth
|
|
84
|
+
? momentValue.format("YYYY-MM")
|
|
85
|
+
: hasTime
|
|
86
|
+
? momentValue.toISOString()
|
|
87
|
+
: momentValue.format("YYYY-MM-DD");
|
|
66
88
|
this.timeWritten = hasTime;
|
|
67
89
|
this.onlyYearWritten = onlyYear;
|
|
68
|
-
|
|
90
|
+
this.onlyYearAndMonthWritten = onlyYearAndMonth;
|
|
91
|
+
return onlyYear || onlyYearAndMonth ? isoValue : (0, moment_1.default)(isoValue).toDate();
|
|
69
92
|
};
|
|
70
93
|
this.onChange = (value) => {
|
|
71
94
|
this.props.onChange(value, !!"force");
|
|
@@ -84,12 +107,12 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
84
107
|
this.setState({ textInputFocused: true }, this.focus);
|
|
85
108
|
};
|
|
86
109
|
this.onBlur = () => {
|
|
87
|
-
!utils_1.isDescendant(react_dom_1.findDOMNode(this.containerRef), document.activeElement) && this.setState({ textInputFocused: false });
|
|
110
|
+
!(0, utils_1.isDescendant)((0, react_dom_1.findDOMNode)(this.containerRef), document.activeElement) && this.setState({ textInputFocused: false });
|
|
88
111
|
};
|
|
89
112
|
this.onDateTimePickerChange = (value) => {
|
|
90
|
-
const momentValue = moment_1.default(value);
|
|
113
|
+
const momentValue = (0, moment_1.default)(value);
|
|
91
114
|
let formattedValue = momentValue.format("YYYY-MM-DDTHH:mm");
|
|
92
|
-
if (this.onlyYearWritten) {
|
|
115
|
+
if (this.onlyYearWritten || this.onlyYearAndMonthWritten) {
|
|
93
116
|
formattedValue = value;
|
|
94
117
|
}
|
|
95
118
|
else if (value !== null && !momentValue.isValid()) {
|
|
@@ -103,6 +126,7 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
103
126
|
this.toggle = undefined;
|
|
104
127
|
this.timeWritten = false;
|
|
105
128
|
this.onlyYearWritten = false;
|
|
129
|
+
this.onlyYearAndMonthWritten = false;
|
|
106
130
|
};
|
|
107
131
|
this.getDateWithCurrentTime = (date) => {
|
|
108
132
|
const { value } = this.props;
|
|
@@ -110,22 +134,22 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
110
134
|
return time ? `${date}T${time}` : date;
|
|
111
135
|
};
|
|
112
136
|
this.setToday = () => {
|
|
113
|
-
this.onChange(this.getDateWithCurrentTime(moment_1.default().format("YYYY-MM-DD")));
|
|
137
|
+
this.onChange(this.getDateWithCurrentTime((0, moment_1.default)().format("YYYY-MM-DD")));
|
|
114
138
|
};
|
|
115
139
|
this.setYesterday = () => {
|
|
116
|
-
this.onChange(this.getDateWithCurrentTime(moment_1.default().subtract(1, "d").format("YYYY-MM-DD")));
|
|
140
|
+
this.onChange(this.getDateWithCurrentTime((0, moment_1.default)().subtract(1, "d").format("YYYY-MM-DD")));
|
|
117
141
|
};
|
|
118
142
|
this.setSameAsToday = () => {
|
|
119
143
|
const formData = this.props.formContext.services.rootInstance.getFormData();
|
|
120
|
-
const sameOptions = utils_1.getUiOptions(this.props).showButtons.same || {};
|
|
144
|
+
const sameOptions = (0, utils_1.getUiOptions)(this.props).showButtons.same || {};
|
|
121
145
|
const { path = "/gatheringEvent/dateBegin" } = sameOptions;
|
|
122
|
-
const today = utils_1.parseJSONPointer(formData, path, !!"safely");
|
|
146
|
+
const today = (0, utils_1.parseJSONPointer)(formData, path, !!"safely");
|
|
123
147
|
if (today) {
|
|
124
148
|
this.onChange(today);
|
|
125
149
|
}
|
|
126
150
|
};
|
|
127
151
|
this.setPlusSixMonths = () => {
|
|
128
|
-
const plusSixMonthOptions = utils_1.getUiOptions(this.props).showButtons.plusSixMonths || {};
|
|
152
|
+
const plusSixMonthOptions = (0, utils_1.getUiOptions)(this.props).showButtons.plusSixMonths || {};
|
|
129
153
|
const { path } = plusSixMonthOptions;
|
|
130
154
|
const date = this.getCurrentDateOrPathDate(path);
|
|
131
155
|
if (date) {
|
|
@@ -133,14 +157,14 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
133
157
|
}
|
|
134
158
|
};
|
|
135
159
|
this.setPlusYear = () => {
|
|
136
|
-
const plusYearOptions = utils_1.getUiOptions(this.props).showButtons.plusYear || {};
|
|
160
|
+
const plusYearOptions = (0, utils_1.getUiOptions)(this.props).showButtons.plusYear || {};
|
|
137
161
|
const { path } = plusYearOptions;
|
|
138
162
|
const date = this.getCurrentDateOrPathDate(path);
|
|
139
163
|
if (date) {
|
|
140
164
|
this.onChange(date.add(1, "y").format("YYYY-MM-DD"));
|
|
141
165
|
}
|
|
142
166
|
};
|
|
143
|
-
react_widgets_moment_1.default(moment_1.default);
|
|
167
|
+
(0, react_widgets_moment_1.default)(moment_1.default);
|
|
144
168
|
}
|
|
145
169
|
componentDidMount() {
|
|
146
170
|
this.props.formContext.services.focus.addFocusHandler(this.props.id, this.focus);
|
|
@@ -149,15 +173,18 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
149
173
|
this.props.formContext.services.focus.removeFocusHandler(this.props.id, this.focus);
|
|
150
174
|
}
|
|
151
175
|
getStateFromProps(props) {
|
|
176
|
+
var _a;
|
|
152
177
|
const { lang, translations } = props.formContext;
|
|
153
178
|
const formatLang = lang === "sv" ? "fi" : lang === "en" ? "en-gb" : lang;
|
|
154
|
-
let localeFormats = moment_1.default().locale(formatLang)._locale._longDateFormat;
|
|
155
|
-
let { allowOnlyYear, dateFormat = "" } = utils_1.getUiOptions(props);
|
|
179
|
+
let localeFormats = (0, moment_1.default)().locale(formatLang)._locale._longDateFormat;
|
|
180
|
+
let { allowOnlyYear, allowOnlyYearAndMonth, dateFormat = "", yearAndMonthDateFormat = "" } = (0, utils_1.getUiOptions)(props);
|
|
156
181
|
let timeFormat = "";
|
|
157
182
|
let placeholder = "";
|
|
158
183
|
if (props.calendar) {
|
|
159
184
|
if (!dateFormat)
|
|
160
185
|
dateFormat = localeFormats.L;
|
|
186
|
+
if (!yearAndMonthDateFormat)
|
|
187
|
+
yearAndMonthDateFormat = dateFormat.replace(/([^YM]DD)|(DD[^YM])/, "");
|
|
161
188
|
placeholder += translations[dateFormat.toLowerCase()] || dateFormat;
|
|
162
189
|
}
|
|
163
190
|
if (props.time) {
|
|
@@ -171,12 +198,15 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
171
198
|
const hasTime = props.value && splitted.length > 1 && splitted[1] !== "";
|
|
172
199
|
let inputFormat = allowOnlyYear && props.value && props.value.match(exports.YEAR_MATCH)
|
|
173
200
|
? "YYYY"
|
|
174
|
-
:
|
|
175
|
-
?
|
|
176
|
-
:
|
|
201
|
+
: allowOnlyYearAndMonth && ((_a = props.value) === null || _a === void 0 ? void 0 : _a.match(exports.YEAR_MONTH_MATCH))
|
|
202
|
+
? yearAndMonthDateFormat
|
|
203
|
+
: hasTime
|
|
204
|
+
? format
|
|
205
|
+
: dateFormat;
|
|
177
206
|
const state = {
|
|
178
207
|
dateFormat,
|
|
179
208
|
timeFormat,
|
|
209
|
+
yearAndMonthDateFormat,
|
|
180
210
|
format,
|
|
181
211
|
inputFormat,
|
|
182
212
|
placeholder
|
|
@@ -194,12 +224,12 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
194
224
|
render() {
|
|
195
225
|
const { value, readonly, disabled } = this.props;
|
|
196
226
|
const { translations, lang } = this.props.formContext;
|
|
197
|
-
const momentValue = moment_1.default(value);
|
|
227
|
+
const momentValue = (0, moment_1.default)(value);
|
|
198
228
|
if (!this.state.textInputFocused && value !== null && !momentValue.isValid()) {
|
|
199
229
|
const { TextWidget } = this.props.registry.widgets;
|
|
200
230
|
return React.createElement(TextWidget, Object.assign({}, this.props, { onFocus: this.onTextWidgetFocus }));
|
|
201
231
|
}
|
|
202
|
-
const options = utils_1.getUiOptions(this.props);
|
|
232
|
+
const options = (0, utils_1.getUiOptions)(this.props);
|
|
203
233
|
const showTimeList = options.showTimeList !== undefined ? options.showTimeList : true;
|
|
204
234
|
const culture = lang === "en" ? "en-gb" : lang;
|
|
205
235
|
const datePicker = (React.createElement(DateTimePicker, { ref: this.setRef, date: this.state.calendar, time: this.state.time && showTimeList, format: this.state.inputFormat, timeFormat: this.state.timeFormat, placeholder: this.state.placeholder, onToggle: this.onToggle, onChange: this.onDateTimePickerChange, value: value && momentValue.isValid() ? momentValue.toDate() : null, parse: this.parse, disabled: readonly || disabled, culture: culture, messages: {
|
|
@@ -259,11 +289,11 @@ let DateTimeWidget = DateTimeWidget_1 = class DateTimeWidget extends React.Compo
|
|
|
259
289
|
}
|
|
260
290
|
getCurrentDateOrPathDate(path) {
|
|
261
291
|
const formData = this.props.formContext.services.rootInstance.getFormData();
|
|
262
|
-
const value = this.props.value || (path ? utils_1.parseJSONPointer(formData, path, !!"safely") : undefined);
|
|
292
|
+
const value = this.props.value || (path ? (0, utils_1.parseJSONPointer)(formData, path, !!"safely") : undefined);
|
|
263
293
|
if (!value) {
|
|
264
294
|
return;
|
|
265
295
|
}
|
|
266
|
-
const date = moment_1.default(value);
|
|
296
|
+
const date = (0, moment_1.default)(value);
|
|
267
297
|
if (date.isValid()) {
|
|
268
298
|
return date;
|
|
269
299
|
}
|
|
@@ -300,7 +330,9 @@ DateTimeWidget.propTypes = {
|
|
|
300
330
|
]),
|
|
301
331
|
showTimeList: PropTypes.bool,
|
|
302
332
|
allowOnlyYear: PropTypes.bool,
|
|
303
|
-
|
|
333
|
+
allowOnlyYearAndMonth: PropTypes.bool,
|
|
334
|
+
dateFormat: PropTypes.string,
|
|
335
|
+
yearAndMonthDateFormat: PropTypes.string
|
|
304
336
|
})
|
|
305
337
|
}),
|
|
306
338
|
schema: PropTypes.shape({
|
|
@@ -2,28 +2,28 @@ export default DateWidget;
|
|
|
2
2
|
declare function DateWidget(props: any): JSX.Element;
|
|
3
3
|
declare namespace DateWidget {
|
|
4
4
|
namespace propTypes {
|
|
5
|
-
|
|
5
|
+
let uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
6
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
-
showButtons: PropTypes.Requireable<boolean | PropTypes.InferProps<{
|
|
7
|
+
showButtons: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
8
8
|
today: PropTypes.Requireable<boolean>;
|
|
9
9
|
yesterday: PropTypes.Requireable<boolean>;
|
|
10
|
-
same: PropTypes.Requireable<boolean | PropTypes.InferProps<{
|
|
10
|
+
same: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
11
11
|
path: PropTypes.Requireable<string>;
|
|
12
|
-
}>>;
|
|
13
|
-
plusSixMonths: PropTypes.Requireable<boolean | PropTypes.InferProps<{
|
|
12
|
+
}> | null | undefined>>;
|
|
13
|
+
plusSixMonths: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
14
14
|
path: PropTypes.Requireable<string>;
|
|
15
|
-
}>>;
|
|
16
|
-
plusSixYear: PropTypes.Requireable<boolean | PropTypes.InferProps<{
|
|
15
|
+
}> | null | undefined>>;
|
|
16
|
+
plusSixYear: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
17
17
|
path: PropTypes.Requireable<string>;
|
|
18
|
-
}>>;
|
|
19
|
-
}>>;
|
|
18
|
+
}> | null | undefined>>;
|
|
19
|
+
}> | null | undefined>>;
|
|
20
20
|
allowOnlyYear: PropTypes.Requireable<boolean>;
|
|
21
21
|
}>>;
|
|
22
22
|
}>>;
|
|
23
|
-
|
|
23
|
+
let schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
24
24
|
type: PropTypes.Requireable<string>;
|
|
25
25
|
}>>;
|
|
26
|
-
|
|
26
|
+
let value: PropTypes.Requireable<string>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
import * as PropTypes from "prop-types";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
37
|
};
|
|
@@ -27,14 +41,22 @@ const PropTypes = __importStar(require("prop-types"));
|
|
|
27
41
|
const moment_1 = __importDefault(require("moment"));
|
|
28
42
|
const DateTimeWidget_1 = __importStar(require("./DateTimeWidget"));
|
|
29
43
|
const utils_1 = require("../../utils");
|
|
30
|
-
const format = (allowOnlyYear, value) =>
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
const format = (allowOnlyYear, allowOnlyYearAndMonth, value) => {
|
|
45
|
+
const momentValue = (0, moment_1.default)(value);
|
|
46
|
+
if (!momentValue.isValid()) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
return momentValue.format(allowOnlyYear && value.match(DateTimeWidget_1.YEAR_MATCH)
|
|
50
|
+
? "YYYY"
|
|
51
|
+
: allowOnlyYearAndMonth && value.match(DateTimeWidget_1.YEAR_MONTH_MATCH)
|
|
52
|
+
? "YYYY-MM"
|
|
53
|
+
: "YYYY-MM-DD");
|
|
54
|
+
};
|
|
33
55
|
const DateWidget = (props) => {
|
|
34
56
|
const { onChange } = props;
|
|
35
|
-
const { allowOnlyYear } = utils_1.getUiOptions(props);
|
|
36
|
-
const _onChange = React.useCallback((value) => onChange(utils_1.isEmptyString(value) ? undefined : format(allowOnlyYear, value)), [allowOnlyYear, onChange]);
|
|
37
|
-
return (React.createElement(DateTimeWidget_1.default, Object.assign({}, props, { onChange: _onChange, time: false, value: props.value ? format(allowOnlyYear, props.value) : null })));
|
|
57
|
+
const { allowOnlyYear, allowOnlyYearAndMonth } = (0, utils_1.getUiOptions)(props);
|
|
58
|
+
const _onChange = React.useCallback((value) => onChange((0, utils_1.isEmptyString)(value) ? undefined : format(allowOnlyYear, allowOnlyYearAndMonth, value)), [allowOnlyYear, allowOnlyYearAndMonth, onChange]);
|
|
59
|
+
return (React.createElement(DateTimeWidget_1.default, Object.assign({}, props, { onChange: _onChange, time: false, value: props.value ? format(allowOnlyYear, allowOnlyYearAndMonth, props.value) : null })));
|
|
38
60
|
};
|
|
39
61
|
DateWidget.propTypes = {
|
|
40
62
|
uiSchema: PropTypes.shape({
|
|
@@ -5,11 +5,11 @@ declare function HiddenWidget({ id, value }: {
|
|
|
5
5
|
}): JSX.Element;
|
|
6
6
|
declare namespace HiddenWidget {
|
|
7
7
|
namespace propTypes {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
let id: PropTypes.Validator<string>;
|
|
9
|
+
let value: PropTypes.Requireable<NonNullable<string | number | boolean | null | undefined>>;
|
|
10
|
+
let schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
11
11
|
type: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
12
|
+
}>>>;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
import * as PropTypes from "prop-types";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
36
|
const React = __importStar(require("react"));
|
|
23
37
|
const PropTypes = __importStar(require("prop-types"));
|
|
@@ -8,6 +8,7 @@ export default class ImageSelectWidget extends React.Component<any, any, any> {
|
|
|
8
8
|
};
|
|
9
9
|
constructor(props: any);
|
|
10
10
|
_context: Record<string, unknown>;
|
|
11
|
+
render(): JSX.Element;
|
|
11
12
|
renderImg: (enumName: any, fallback: any) => any;
|
|
12
13
|
}
|
|
13
14
|
import * as React from "react";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,13 +21,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
21
|
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;
|
|
18
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
23
|
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
27
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
@@ -39,7 +53,7 @@ let ImageSelectWidget = class ImageSelectWidget extends React.Component {
|
|
|
39
53
|
constructor(props) {
|
|
40
54
|
super(props);
|
|
41
55
|
this.renderImg = (enumName, fallback) => {
|
|
42
|
-
const imgName = utils_1.getUiOptions(this.props).images[enumName];
|
|
56
|
+
const imgName = (0, utils_1.getUiOptions)(this.props).images[enumName];
|
|
43
57
|
if (imgName === undefined)
|
|
44
58
|
return fallback;
|
|
45
59
|
let path = this._context[enumName] || {};
|
|
@@ -54,7 +68,7 @@ let ImageSelectWidget = class ImageSelectWidget extends React.Component {
|
|
|
54
68
|
React.createElement("img", { src: path.png })));
|
|
55
69
|
}
|
|
56
70
|
};
|
|
57
|
-
this._context = Context_1.default("IMAGES");
|
|
71
|
+
this._context = (0, Context_1.default)("IMAGES");
|
|
58
72
|
}
|
|
59
73
|
render() {
|
|
60
74
|
return (React.createElement(SelectWidget_1.default, Object.assign({}, this.props, { selectProps: {
|
|
@@ -8,7 +8,11 @@ export default class InformalTaxonGroupChooserWidget extends React.Component<any
|
|
|
8
8
|
value: PropTypes.Requireable<string>;
|
|
9
9
|
};
|
|
10
10
|
constructor(props: any);
|
|
11
|
+
state: {};
|
|
12
|
+
componentDidMount(): void;
|
|
11
13
|
mounted: boolean | undefined;
|
|
14
|
+
UNSAFE_componentWillReceiveProps(props: any): void;
|
|
15
|
+
componentWillUnmount(): void;
|
|
12
16
|
getDefaultOptions: (props: any) => {
|
|
13
17
|
button: any;
|
|
14
18
|
rootOnly: any;
|
|
@@ -18,6 +22,7 @@ export default class InformalTaxonGroupChooserWidget extends React.Component<any
|
|
|
18
22
|
show: () => void;
|
|
19
23
|
hide: () => void;
|
|
20
24
|
onClear: (e: any) => void;
|
|
25
|
+
render(): JSX.Element;
|
|
21
26
|
}
|
|
22
27
|
export class InformalTaxonGroupChooser extends React.Component<any, any, any> {
|
|
23
28
|
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
@@ -26,7 +31,13 @@ export class InformalTaxonGroupChooser extends React.Component<any, any, any> {
|
|
|
26
31
|
formContext: PropTypes.Validator<object>;
|
|
27
32
|
};
|
|
28
33
|
constructor(props: any);
|
|
34
|
+
state: {
|
|
35
|
+
path: undefined[];
|
|
36
|
+
};
|
|
37
|
+
componentDidMount(): void;
|
|
29
38
|
mounted: boolean | undefined;
|
|
39
|
+
UNSAFE_componentWillReceiveProps(props: any): void;
|
|
40
|
+
componentWillUnmount(): void;
|
|
30
41
|
onSelected: (id: any) => () => void;
|
|
31
42
|
onSubgroupSelected: (id: any) => () => void;
|
|
32
43
|
Container: ({ children }: {
|
|
@@ -38,6 +49,7 @@ export class InformalTaxonGroupChooser extends React.Component<any, any, any> {
|
|
|
38
49
|
children: any;
|
|
39
50
|
}) => JSX.Element;
|
|
40
51
|
Item: (id: any) => JSX.Element;
|
|
52
|
+
render(): JSX.Element;
|
|
41
53
|
}
|
|
42
54
|
import * as React from "react";
|
|
43
55
|
import * as PropTypes from "prop-types";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,18 +21,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
21
|
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;
|
|
18
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
23
|
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
27
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
30
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.InformalTaxonGroupChooser =
|
|
45
|
+
exports.InformalTaxonGroupChooser = void 0;
|
|
46
|
+
exports.getInformalGroups = getInformalGroups;
|
|
32
47
|
const React = __importStar(require("react"));
|
|
33
48
|
const PropTypes = __importStar(require("prop-types"));
|
|
34
49
|
const components_1 = require("../components");
|
|
@@ -41,7 +56,7 @@ let InformalTaxonGroupChooserWidget = class InformalTaxonGroupChooserWidget exte
|
|
|
41
56
|
constructor(props) {
|
|
42
57
|
super(props);
|
|
43
58
|
this.getDefaultOptions = (props) => {
|
|
44
|
-
const { button = true, rootOnly = false, grid = { lg: 1, md: 2, sm: 3, xs: 12 } } = utils_1.getUiOptions(props);
|
|
59
|
+
const { button = true, rootOnly = false, grid = { lg: 1, md: 2, sm: 3, xs: 12 } } = (0, utils_1.getUiOptions)(props);
|
|
45
60
|
return { button, rootOnly, grid };
|
|
46
61
|
};
|
|
47
62
|
this.onSelected = (id) => {
|
|
@@ -151,11 +166,10 @@ function getInformalGroups(apiClient) {
|
|
|
151
166
|
const informalTaxonGroups = mapGroupsById(response.results);
|
|
152
167
|
// Contains all groups in flat object.
|
|
153
168
|
const informalTaxonGroupsById = walk({}, response.results);
|
|
154
|
-
Context_1.default().informalTaxonGroupsById = informalTaxonGroupsById;
|
|
169
|
+
(0, Context_1.default)().informalTaxonGroupsById = informalTaxonGroupsById;
|
|
155
170
|
return Promise.resolve({ informalTaxonGroups, informalTaxonGroupsById });
|
|
156
171
|
});
|
|
157
172
|
}
|
|
158
|
-
exports.getInformalGroups = getInformalGroups;
|
|
159
173
|
class InformalTaxonGroupChooser extends React.Component {
|
|
160
174
|
constructor(props) {
|
|
161
175
|
super(props);
|
|
@@ -8,14 +8,15 @@ export default class InputGroupWidget extends React.Component<any, any, any> {
|
|
|
8
8
|
className: PropTypes.Requireable<string>;
|
|
9
9
|
}>>;
|
|
10
10
|
}>>;
|
|
11
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
11
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
12
12
|
type: PropTypes.Requireable<string>;
|
|
13
|
-
}
|
|
14
|
-
value: PropTypes.Requireable<string | number
|
|
13
|
+
}>>>;
|
|
14
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
15
15
|
required: PropTypes.Requireable<boolean>;
|
|
16
16
|
};
|
|
17
17
|
constructor(props: any);
|
|
18
18
|
constructor(props: any, context: any);
|
|
19
|
+
render(): JSX.Element;
|
|
19
20
|
}
|
|
20
21
|
import * as React from "react";
|
|
21
22
|
import * as PropTypes from "prop-types";
|