@luomus/laji-form 15.1.113 → 15.1.115
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/lib/components/LajiForm.js +20 -5
- package/lib/components/components/ErrorPanel.js +1 -1
- package/lib/components/fields/ScientificNameTaxonAutosuggestField.d.ts +1 -0
- package/lib/components/fields/ScientificNameTaxonAutosuggestField.js +4 -1
- package/lib/components/fields/TaxonSetPopulatorField.js +2 -1
- package/lib/components/templates/ErrorListTemplate.js +20 -18
- package/lib/components/widgets/AutosuggestWidget.js +16 -8
- package/lib/components/widgets/DateTimeWidget.d.ts +1 -0
- package/lib/components/widgets/DateTimeWidget.js +11 -1
- package/lib/translations.json +6 -1
- package/package.json +2 -2
- package/test-export/test-utils.d.ts +2 -0
- package/test-export/test-utils.js +1 -2
|
@@ -203,7 +203,7 @@ class LajiForm extends React.Component {
|
|
|
203
203
|
const mergedInternalErrors = (0, deepmerge_1.default)(_liveValidations, !nonlive
|
|
204
204
|
? (this.cachedNonliveValidations || {})
|
|
205
205
|
: (0, deepmerge_1.default)(_validations, schemaErrors));
|
|
206
|
-
|
|
206
|
+
const mergedAll = addExternalErrors(mergedInternalErrors, this.state.externalErrors || {});
|
|
207
207
|
this.validating = false;
|
|
208
208
|
resolve(!Object.keys(mergedAll).length);
|
|
209
209
|
if (!equals((this.state.extraErrors || {}), mergedAll)) {
|
|
@@ -393,22 +393,22 @@ class LajiForm extends React.Component {
|
|
|
393
393
|
this.state = this.getStateFromProps(props);
|
|
394
394
|
}
|
|
395
395
|
UNSAFE_componentWillReceiveProps(props) {
|
|
396
|
+
var _a;
|
|
396
397
|
if (props.apiClient && props.apiClient !== this.apiClient.apiClient) {
|
|
397
398
|
this.apiClient = new ApiClient_1.default(props.apiClient, props.lang, this.translations);
|
|
398
399
|
}
|
|
399
400
|
if (this.apiClient && "lang" in props && this.props.lang !== props.lang) {
|
|
400
401
|
this.apiClient.setLang(props.lang);
|
|
401
402
|
}
|
|
402
|
-
|
|
403
|
+
const popErrorList = props.extraErrors !== ((_a = this.state) === null || _a === void 0 ? void 0 : _a.externalErrors);
|
|
404
|
+
this.setState(this.getStateFromProps(props), popErrorList ? this.popErrorListIfNeeded : undefined);
|
|
403
405
|
}
|
|
404
406
|
getStateFromProps(props) {
|
|
405
407
|
var _a;
|
|
406
408
|
const state = {
|
|
407
409
|
formContext: this.getMemoizedFormContext(props),
|
|
408
410
|
externalErrors: props.extraErrors,
|
|
409
|
-
extraErrors: ((_a = this.state) === null || _a === void 0 ? void 0 : _a.extraErrors)
|
|
410
|
-
? (0, deepmerge_1.default)(this.state.extraErrors, props.extraErrors || {})
|
|
411
|
-
: props.extraErrors
|
|
411
|
+
extraErrors: addExternalErrors(((_a = this.state) === null || _a === void 0 ? void 0 : _a.extraErrors) || {}, props.extraErrors || {})
|
|
412
412
|
};
|
|
413
413
|
if (((!this.state && props.schema && Object.keys(props.schema).length) || (this.state && !("formData" in this.state))) || ("formData" in props && props.formData !== this.props.formData)) {
|
|
414
414
|
state.formData = state.formContext.services.ids.addLajiFormIds((0, utils_1.getDefaultFormState)(props.schema, props.formData, props.schema))[0];
|
|
@@ -605,3 +605,18 @@ const getShortcuts = (uiSchema) => {
|
|
|
605
605
|
const { "ui:shortcuts": shortcuts } = uiSchema || {};
|
|
606
606
|
return shortcuts;
|
|
607
607
|
};
|
|
608
|
+
const addExternalErrors = (internalErrors, externalErrors) => {
|
|
609
|
+
return (0, deepmerge_1.default)(internalErrors, processExternalErrors(externalErrors));
|
|
610
|
+
};
|
|
611
|
+
const processExternalErrors = (errors) => {
|
|
612
|
+
const result = {};
|
|
613
|
+
if (errors.__errors) {
|
|
614
|
+
result.__errors = errors.__errors.map(error => `[external]${error}`);
|
|
615
|
+
}
|
|
616
|
+
for (const key in errors) {
|
|
617
|
+
if (key !== "__errors" && errors[key]) {
|
|
618
|
+
result[key] = processExternalErrors(errors[key]);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return result;
|
|
622
|
+
};
|
|
@@ -62,7 +62,7 @@ class ErrorPanel extends React.Component {
|
|
|
62
62
|
title,
|
|
63
63
|
React.createElement("span", { className: "pull-right" },
|
|
64
64
|
React.createElement(components_1.GlyphButton, { glyph: this.state.expanded ? "chevron-up" : "chevron-down", variant: "link" }, translations[this.state.expanded ? "Close" : "Open"]),
|
|
65
|
-
showToggle && React.createElement(components_1.GlyphButton, { glyph: "new-window", variant: "link", onClick: poppedToggle }, translations[popped ? "Unpop" : "Pop"]))))),
|
|
65
|
+
showToggle && React.createElement(components_1.GlyphButton, { glyph: popped ? "pushpin" : "new-window", variant: "link", onClick: poppedToggle }, translations[popped ? "Unpop" : "Pop"]))))),
|
|
66
66
|
React.createElement(Panel.Collapse, { in: this.state.expanded },
|
|
67
67
|
React.createElement(ListGroup, null, errors.map((props, i) => React.createElement(ErrorPanelError, Object.assign({ key: i, clickHandler: clickHandler }, props))))),
|
|
68
68
|
footer
|
|
@@ -28,6 +28,7 @@ export default class ScientificNameTaxonAutosuggestField extends React.Component
|
|
|
28
28
|
state: State;
|
|
29
29
|
getUiSchema: (props: FieldProps<JSONSchemaObject>) => any;
|
|
30
30
|
getSuggestionValue: (suggestion: any) => string;
|
|
31
|
+
findExactMatch: (suggestions: any[], inputValue?: string) => any;
|
|
31
32
|
onSuggestionSelected: (suggestion: any, mounted: boolean) => void;
|
|
32
33
|
onUnsuggestionSelected: (value: any) => void;
|
|
33
34
|
isValueSuggested: (value?: string, valueContext?: ValueContext) => boolean | undefined;
|
|
@@ -78,7 +78,7 @@ class ScientificNameTaxonAutosuggestField extends React.Component {
|
|
|
78
78
|
if (taxonRank) {
|
|
79
79
|
taxonRankLabel = (_a = (this.getTaxonRankOptions() || []).find(option => option.const === taxonRank)) === null || _a === void 0 ? void 0 : _a.title;
|
|
80
80
|
}
|
|
81
|
-
let options = Object.assign(Object.assign({}, uiOptions), { autosuggestField: "taxon", onSuggestionSelected: this.onSuggestionSelected, onUnsuggestedSelected: this.onUnsuggestionSelected, isValueSuggested: this.isValueSuggested, getSuggestionFromValue: this.getSuggestionFromValue, getSuggestionValue: this.getSuggestionValue, renderSuggestion: this.renderSuggestion, valueContext: { taxonRank, author }, taxonRankLabel, Wrapper: TaxonWrapper });
|
|
81
|
+
let options = Object.assign(Object.assign({}, uiOptions), { autosuggestField: "taxon", onSuggestionSelected: this.onSuggestionSelected, onUnsuggestedSelected: this.onUnsuggestionSelected, isValueSuggested: this.isValueSuggested, getSuggestionFromValue: this.getSuggestionFromValue, getSuggestionValue: this.getSuggestionValue, findExactMatch: this.findExactMatch, renderSuggestion: this.renderSuggestion, valueContext: { taxonRank, author }, taxonRankLabel, Wrapper: TaxonWrapper });
|
|
82
82
|
if (!(0, utils_1.isEmptyString)(scientificName)) {
|
|
83
83
|
options.value = scientificName;
|
|
84
84
|
}
|
|
@@ -94,6 +94,9 @@ class ScientificNameTaxonAutosuggestField extends React.Component {
|
|
|
94
94
|
this.getSuggestionValue = (suggestion) => {
|
|
95
95
|
return suggestion.scientificName;
|
|
96
96
|
};
|
|
97
|
+
this.findExactMatch = (suggestions, inputValue = "") => {
|
|
98
|
+
return suggestions.find(suggestion => { var _a; return (((_a = suggestion === null || suggestion === void 0 ? void 0 : suggestion.scientificName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === inputValue.trim().toLowerCase()); });
|
|
99
|
+
};
|
|
97
100
|
this.onSuggestionSelected = (suggestion, mounted) => {
|
|
98
101
|
if (suggestion === null)
|
|
99
102
|
suggestion = undefined;
|
|
@@ -100,7 +100,8 @@ let TaxonSetPopulatorField = class TaxonSetPopulatorField extends React.Componen
|
|
|
100
100
|
return this.unitTaxonSets[unit.identifications[0].taxonID]
|
|
101
101
|
&& this.unitTaxonSets[unit.identifications[0].taxonID].includes(deletedTaxonSetId);
|
|
102
102
|
});
|
|
103
|
-
observationsExist = deletedTaxonSetUnits.some((unit) => unit.observationStatus !== "MY.observationStatusIgnored"
|
|
103
|
+
observationsExist = deletedTaxonSetUnits.some((unit) => unit.observationStatus !== "MY.observationStatusIgnored" &&
|
|
104
|
+
unit.observationStatus !== "MY.observationStatusNotObserved");
|
|
104
105
|
if (observationsExist) {
|
|
105
106
|
window.alert(translations === null || translations === void 0 ? void 0 : translations.TaxonSetDeletionFailed);
|
|
106
107
|
const restoredFormData = Object.assign(Object.assign({}, formData), { taxonCensus: [
|
|
@@ -84,23 +84,23 @@ class ErrorListTemplate extends React.Component {
|
|
|
84
84
|
const { __errors } = errorSchema, properties = __rest(errorSchema, ["__errors"]);
|
|
85
85
|
const _schema = (0, utils_1.parseJSONPointer)(schema, path);
|
|
86
86
|
const title = _schema.title || defaultTitle;
|
|
87
|
-
let { errors, warnings } = (__errors || []).reduce(({ errors, warnings }, _error) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
let { externalErrors, errors, warnings } = (__errors || []).reduce(({ externalErrors, errors, warnings }, _error) => {
|
|
88
|
+
const error = {
|
|
89
|
+
label: title,
|
|
90
|
+
error: (0, utils_1.formatErrorMessage)(_error),
|
|
91
|
+
id: id
|
|
92
|
+
};
|
|
93
|
+
if (_error.includes("[external]")) {
|
|
94
|
+
externalErrors.push(error);
|
|
95
|
+
}
|
|
96
|
+
else if (_error.includes("[warning]")) {
|
|
97
|
+
warnings.push(error);
|
|
94
98
|
}
|
|
95
99
|
else {
|
|
96
|
-
errors.push(
|
|
97
|
-
label: title,
|
|
98
|
-
error: (0, utils_1.formatErrorMessage)(_error),
|
|
99
|
-
id: id
|
|
100
|
-
});
|
|
100
|
+
errors.push(error);
|
|
101
101
|
}
|
|
102
|
-
return { errors, warnings };
|
|
103
|
-
}, { errors: [], warnings: [] });
|
|
102
|
+
return { externalErrors, errors, warnings };
|
|
103
|
+
}, { externalErrors: [], errors: [], warnings: [] });
|
|
104
104
|
Object.keys(properties).forEach(prop => {
|
|
105
105
|
let _path = path;
|
|
106
106
|
if (prop.match(/^\d+$/))
|
|
@@ -109,13 +109,14 @@ class ErrorListTemplate extends React.Component {
|
|
|
109
109
|
_path = `${_path}/properties/${prop}`;
|
|
110
110
|
const _defaultTitle = _schema.type === "array" || uiSchema["ui:multiLanguage"] ? `${title} (${prop})` : prop;
|
|
111
111
|
const childErrors = walkErrors(_path, `${id}_${prop}`, errorSchema[prop], uiSchema[prop] || {}, _defaultTitle);
|
|
112
|
+
externalErrors = [...externalErrors, ...childErrors.externalErrors];
|
|
112
113
|
errors = [...errors, ...childErrors.errors];
|
|
113
114
|
warnings = [...warnings, ...childErrors.warnings];
|
|
114
115
|
});
|
|
115
|
-
return { errors, warnings };
|
|
116
|
+
return { externalErrors, errors, warnings };
|
|
116
117
|
}
|
|
117
118
|
const { Glyphicon } = this.context.theme;
|
|
118
|
-
const { errors, warnings } = walkErrors("", "root", errorSchema, uiSchema, "");
|
|
119
|
+
const { externalErrors, errors, warnings } = walkErrors("", "root", errorSchema, uiSchema, "");
|
|
119
120
|
const footer = (errors.length > 0
|
|
120
121
|
? React.createElement(components_1.Button, { onClick: this.revalidate },
|
|
121
122
|
React.createElement(Glyphicon, { glyph: "refresh" }),
|
|
@@ -123,8 +124,9 @@ class ErrorListTemplate extends React.Component {
|
|
|
123
124
|
translations.Revalidate)
|
|
124
125
|
: React.createElement(components_1.Button, { onClick: this.submitWithWarnings, variant: "success", disabled: disabled || readonly }, translations.SubmitWithWarnings));
|
|
125
126
|
return (React.createElement("div", { className: `laji-form-error-list${this.state.popped ? " laji-form-popped" : ""}${errors.length === 0 ? " laji-form-warning-list" : ""}`, style: this.state.popped ? { top: (this.props.formContext.topOffset || 0) + 5 } : null },
|
|
126
|
-
React.createElement(components_1.ErrorPanel, { classNames: "error-panel", ref: "
|
|
127
|
-
React.createElement(components_1.ErrorPanel, { classNames: "
|
|
127
|
+
React.createElement(components_1.ErrorPanel, { classNames: "error-panel", ref: "externalErrorPanel", errors: externalErrors, title: translations.ExternalErrors, clickHandler: clickHandler, showToggle: true, poppedToggle: this.poppedToggle, popped: this.state.popped, formContext: this.props.formContext, footer: null }),
|
|
128
|
+
React.createElement(components_1.ErrorPanel, { classNames: "error-panel", ref: "errorPanel", errors: errors, title: translations.Errors, clickHandler: clickHandler, showToggle: externalErrors.length === 0, poppedToggle: this.poppedToggle, popped: this.state.popped, formContext: this.props.formContext, footer: warnings.length === 0 ? footer : null }),
|
|
129
|
+
React.createElement(components_1.ErrorPanel, { classNames: "warning-panel", ref: "warningPanel", errors: warnings, title: translations.Warnings, clickHandler: clickHandler, showToggle: externalErrors.length === 0 && errors.length === 0, poppedToggle: this.poppedToggle, popped: this.state.popped, formContext: this.props.formContext, footer: footer })));
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
ErrorListTemplate.contextType = ReactContext_1.default;
|
|
@@ -650,6 +650,10 @@ class Autosuggest extends React.Component {
|
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
652
|
const parsedInputValue = this.props.parseInputValue ? this.props.parseInputValue(inputValue) : inputValue;
|
|
653
|
+
if (this.state.suggestion && inputValue === this.getSuggestionValue(this.state.suggestion)) {
|
|
654
|
+
callback && callback();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
653
657
|
const { selectOnlyOne, selectOnlyNonMatchingBeforeUnsuggested = true, informalTaxonGroups, informalTaxonGroupsValue, allowNonsuggestedValue } = this.props;
|
|
654
658
|
const exactMatch = this.findExactMatch(suggestions, parsedInputValue);
|
|
655
659
|
const onlyOneMatch = selectOnlyOne ? this.findTheOnlyOneMatch(suggestions) : undefined;
|
|
@@ -818,7 +822,6 @@ class Autosuggest extends React.Component {
|
|
|
818
822
|
});
|
|
819
823
|
}
|
|
820
824
|
else if (valueContextChanged) {
|
|
821
|
-
this.setState({ isLoading: true });
|
|
822
825
|
if (this.triggerConvertTimeout) {
|
|
823
826
|
clearTimeout(this.triggerConvertTimeout);
|
|
824
827
|
}
|
|
@@ -848,7 +851,7 @@ class Autosuggest extends React.Component {
|
|
|
848
851
|
return React.createElement(React.Fragment, null,
|
|
849
852
|
renderExtra && renderExtra(),
|
|
850
853
|
React.createElement("div", { className: (0, utils_1.classNames)("autosuggest-wrapper", props.wrapperClassName) },
|
|
851
|
-
React.createElement(ReactAutosuggest, { id: `${this.props.id}-autosuggest`, inputProps: inputProps, renderInputComponent: this.renderInput, suggestions: suggestions, renderSuggestion: this.renderSuggestion, onSuggestionsFetchRequested: this.onSuggestionsFetchRequested, onSuggestionsClearRequested: this.onSuggestionsClearRequested, onSuggestionSelected: this.onSuggestionSelected, onUnsuggestedSelected: this.onUnsuggestedSelected, highlightFirstSuggestion: highlightFirstSuggestion, suggestionsOpenOnFocus: !this.isSuggested(), theme: cssClasses, formContext: this.props.formContext, ref: this.setRef })));
|
|
854
|
+
React.createElement(ReactAutosuggest, { id: `${this.props.id}-autosuggest`, inputProps: inputProps, renderInputComponent: this.renderInput, suggestions: suggestions, renderSuggestion: this.renderSuggestion, onSuggestionsFetchRequested: this.onSuggestionsFetchRequested, onSuggestionsClearRequested: this.onSuggestionsClearRequested, onSuggestionSelected: this.onSuggestionSelected, onUnsuggestedSelected: this.onUnsuggestedSelected, highlightFirstSuggestion: highlightFirstSuggestion, suggestionsOpenOnFocus: !this.isSuggested(), getSuggestionValue: this.getSuggestionValue, theme: cssClasses, formContext: this.props.formContext, ref: this.setRef })));
|
|
852
855
|
}
|
|
853
856
|
}
|
|
854
857
|
exports.Autosuggest = Autosuggest;
|
|
@@ -1091,6 +1094,11 @@ const TaxonName = ({ scientificName, vernacularName = "", cursiveName, finnish,
|
|
|
1091
1094
|
class ReactAutosuggest extends React.Component {
|
|
1092
1095
|
constructor(props) {
|
|
1093
1096
|
super(props);
|
|
1097
|
+
this.getDisplayValue = (suggestion) => {
|
|
1098
|
+
return this.props.getSuggestionValue
|
|
1099
|
+
? this.props.getSuggestionValue(suggestion)
|
|
1100
|
+
: suggestion.value;
|
|
1101
|
+
};
|
|
1094
1102
|
this.onInputFocus = (e) => {
|
|
1095
1103
|
this.setState({ focused: true, hideSuggestions: false });
|
|
1096
1104
|
this.requestFetch(this.state.inputValue);
|
|
@@ -1123,7 +1131,7 @@ class ReactAutosuggest extends React.Component {
|
|
|
1123
1131
|
touched: true
|
|
1124
1132
|
};
|
|
1125
1133
|
if (state.focusedIdx !== undefined) {
|
|
1126
|
-
state.inputValue = this.props.suggestions[state.focusedIdx]
|
|
1134
|
+
state.inputValue = this.getDisplayValue(this.props.suggestions[state.focusedIdx]);
|
|
1127
1135
|
}
|
|
1128
1136
|
this.setState(state);
|
|
1129
1137
|
break;
|
|
@@ -1131,7 +1139,7 @@ class ReactAutosuggest extends React.Component {
|
|
|
1131
1139
|
e.preventDefault();
|
|
1132
1140
|
state = { focusedIdx: this.state.focusedIdx > 0 ? this.state.focusedIdx - 1 : undefined, touched: true };
|
|
1133
1141
|
if (state.focusedIdx !== undefined) {
|
|
1134
|
-
state.inputValue = this.props.suggestions[state.focusedIdx]
|
|
1142
|
+
state.inputValue = this.getDisplayValue(this.props.suggestions[state.focusedIdx]);
|
|
1135
1143
|
}
|
|
1136
1144
|
this.setState(state);
|
|
1137
1145
|
break;
|
|
@@ -1172,12 +1180,12 @@ class ReactAutosuggest extends React.Component {
|
|
|
1172
1180
|
this.suggestionMouseDownFlag = true;
|
|
1173
1181
|
};
|
|
1174
1182
|
this.onSuggestionMouseUp = (e) => {
|
|
1183
|
+
var _a, _b;
|
|
1175
1184
|
this.suggestionMouseDownFlag = false;
|
|
1176
1185
|
const suggestion = this.getSuggestionFromClick(e);
|
|
1177
|
-
this.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
});
|
|
1186
|
+
this.onSuggestionSelected(suggestion);
|
|
1187
|
+
this.setState({ focused: false, focusedIdx: undefined, touched: false });
|
|
1188
|
+
(_b = (_a = this.props.inputProps) === null || _a === void 0 ? void 0 : _a.onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e, true);
|
|
1181
1189
|
};
|
|
1182
1190
|
this.getSuggestionFromClick = ({ target }) => {
|
|
1183
1191
|
let idx;
|
|
@@ -72,6 +72,7 @@ export default class DateTimeWidget extends React.Component<any, any, any> {
|
|
|
72
72
|
containerRef: any;
|
|
73
73
|
onTextWidgetFocus: () => void;
|
|
74
74
|
onBlur: () => void;
|
|
75
|
+
onDateTimePickerSelect: (dateTime: any) => void;
|
|
75
76
|
onDateTimePickerChange: (value: any) => void;
|
|
76
77
|
render(): JSX.Element;
|
|
77
78
|
renderButtons(showButtons: any): JSX.Element[];
|
|
@@ -101,6 +101,16 @@ class DateTimeWidget extends React.Component {
|
|
|
101
101
|
this.onBlur = () => {
|
|
102
102
|
!(0, utils_1.isDescendant)((0, react_dom_1.findDOMNode)(this.containerRef), document.activeElement) && this.setState({ textInputFocused: false });
|
|
103
103
|
};
|
|
104
|
+
// used to display time when 00:00 (same as default time) is selected
|
|
105
|
+
this.onDateTimePickerSelect = (dateTime) => {
|
|
106
|
+
if (this.toggle === "time") {
|
|
107
|
+
const { value } = this.props;
|
|
108
|
+
const momentValue = (0, moment_1.default)(dateTime);
|
|
109
|
+
if (value && !value.includes("T") && momentValue.isValid()) {
|
|
110
|
+
this.onChange(momentValue.format("YYYY-MM-DDTHH:mm"));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
104
114
|
this.onDateTimePickerChange = (value) => {
|
|
105
115
|
const momentValue = (0, moment_1.default)(value);
|
|
106
116
|
let formattedValue = momentValue.format("YYYY-MM-DDTHH:mm");
|
|
@@ -228,7 +238,7 @@ class DateTimeWidget extends React.Component {
|
|
|
228
238
|
const options = (0, utils_1.getUiOptions)(this.props);
|
|
229
239
|
const showTimeList = options.showTimeList !== undefined ? options.showTimeList : true;
|
|
230
240
|
const culture = lang === "en" ? "en-gb" : lang;
|
|
231
|
-
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: {
|
|
241
|
+
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, onSelect: this.onDateTimePickerSelect, onChange: this.onDateTimePickerChange, value: value && momentValue.isValid() ? momentValue.toDate() : null, parse: this.parse, disabled: readonly || disabled, culture: culture, messages: {
|
|
232
242
|
calendarButton: translations.ChooseDate,
|
|
233
243
|
timeButton: translations.ChooseTime
|
|
234
244
|
}, onBlur: this.onBlur }));
|
package/lib/translations.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"unknownName": {
|
|
68
68
|
"fi": "Ei tunnettu nimi",
|
|
69
|
-
"en": "
|
|
69
|
+
"en": "Name not known",
|
|
70
70
|
"sv": "Okänt namn"
|
|
71
71
|
},
|
|
72
72
|
"unknownOrganization": {
|
|
@@ -359,6 +359,11 @@
|
|
|
359
359
|
"en": "below",
|
|
360
360
|
"sv": "under"
|
|
361
361
|
},
|
|
362
|
+
"externalErrors": {
|
|
363
|
+
"fi": "virheet tallennettaessa",
|
|
364
|
+
"en": "errors while saving",
|
|
365
|
+
"sv": "fel när du sparar"
|
|
366
|
+
},
|
|
362
367
|
"errors": {
|
|
363
368
|
"fi": "virheet",
|
|
364
369
|
"en": "errors",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luomus/laji-form",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.115",
|
|
4
4
|
"description": "React module capable of building dynamic forms from Laji form json schemas",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@luomus/laji-map": "^5.1.19",
|
|
44
|
-
"@luomus/laji-validate": "^0.0.
|
|
44
|
+
"@luomus/laji-validate": "^0.0.133",
|
|
45
45
|
"@rjsf/core": "~5.1.0",
|
|
46
46
|
"@rjsf/utils": "~5.1.0",
|
|
47
47
|
"@rjsf/validator-ajv6": "~5.1.0",
|
|
@@ -28,6 +28,7 @@ export interface DateWidgetPO {
|
|
|
28
28
|
$today: Locator;
|
|
29
29
|
};
|
|
30
30
|
clock: {
|
|
31
|
+
"$00:00": Locator;
|
|
31
32
|
"$01:00": Locator;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -127,6 +128,7 @@ export declare class Form {
|
|
|
127
128
|
$today: Locator;
|
|
128
129
|
};
|
|
129
130
|
clock: {
|
|
131
|
+
"$00:00": Locator;
|
|
130
132
|
"$01:00": Locator;
|
|
131
133
|
};
|
|
132
134
|
};
|
|
@@ -266,6 +266,7 @@ class Form {
|
|
|
266
266
|
$today: $widget.locator(".rw-calendar-footer button"),
|
|
267
267
|
},
|
|
268
268
|
clock: {
|
|
269
|
+
"$00:00": $widget.locator(".rw-list li").nth(0),
|
|
269
270
|
"$01:00": $widget.locator(".rw-list li").nth(2),
|
|
270
271
|
}
|
|
271
272
|
};
|
|
@@ -327,10 +328,8 @@ class DemoPageForm extends Form {
|
|
|
327
328
|
}
|
|
328
329
|
setState(state) {
|
|
329
330
|
return this.page.evaluate((state) => {
|
|
330
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
331
331
|
// @ts-ignore
|
|
332
332
|
const onSubmit = function (data) { window.submittedData = data.formData; };
|
|
333
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
334
333
|
// @ts-ignore
|
|
335
334
|
const onChange = function (formData) { window.changedData = formData; };
|
|
336
335
|
return window.lajiForm.setState(Object.assign({ onSubmit,
|