@dhis2/ui-forms 10.16.3 → 10.16.4
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/build/cjs/CheckboxFieldFF/CheckboxFieldFF.js +21 -24
- package/build/cjs/FieldGroupFF/FieldGroupFF.js +6 -7
- package/build/cjs/FileInputFieldFF/FileInputFieldFF.e2e.stories.js +6 -10
- package/build/cjs/FileInputFieldFF/FileInputFieldFF.js +15 -17
- package/build/cjs/InputFieldFF/InputFieldFF.js +24 -27
- package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.e2e.stories.js +10 -13
- package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.js +14 -15
- package/build/cjs/RadioFieldFF/RadioFieldFF.js +21 -24
- package/build/cjs/SimpleSingleSelectFieldFF/SimpleSingleSelectFieldFF.js +16 -20
- package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.e2e.stories.js +10 -13
- package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.js +14 -15
- package/build/cjs/SwitchFieldFF/SwitchFieldFF.js +21 -24
- package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.js +23 -26
- package/build/cjs/__tests__/__snapshots__/index.test.js.snap +1 -1
- package/build/cjs/formDecorator.js +5 -6
- package/build/cjs/index.js +1 -2
- package/build/cjs/locales/index.js +100 -61
- package/build/cjs/shared/helpers/createChangeHandler.js +16 -19
- package/build/cjs/shared/helpers/createSelectChangeHandler.js +6 -10
- package/build/cjs/transformers/arrayWithIdObjects.js +3 -6
- package/build/cjs/validators/composeValidators.js +2 -8
- package/build/es/CheckboxFieldFF/CheckboxFieldFF.js +21 -24
- package/build/es/FieldGroupFF/FieldGroupFF.js +6 -7
- package/build/es/FileInputFieldFF/FileInputFieldFF.e2e.stories.js +6 -10
- package/build/es/FileInputFieldFF/FileInputFieldFF.js +15 -17
- package/build/es/InputFieldFF/InputFieldFF.js +24 -27
- package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.e2e.stories.js +10 -13
- package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.js +14 -15
- package/build/es/RadioFieldFF/RadioFieldFF.js +21 -24
- package/build/es/SimpleSingleSelectFieldFF/SimpleSingleSelectFieldFF.js +16 -20
- package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.e2e.stories.js +10 -13
- package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.js +14 -15
- package/build/es/SwitchFieldFF/SwitchFieldFF.js +21 -24
- package/build/es/TextAreaFieldFF/TextAreaFieldFF.js +23 -26
- package/build/es/__tests__/__snapshots__/index.test.js.snap +1 -1
- package/build/es/formDecorator.js +5 -6
- package/build/es/locales/index.js +74 -35
- package/build/es/shared/helpers/createChangeHandler.js +16 -19
- package/build/es/shared/helpers/createSelectChangeHandler.js +6 -10
- package/build/es/transformers/arrayWithIdObjects.js +3 -6
- package/build/es/validators/composeValidators.js +2 -8
- package/package.json +10 -10
- package/src/__tests__/__snapshots__/index.test.js.snap +1 -1
- package/src/locales/index.js +108 -35
|
@@ -5,20 +5,19 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { createFocusHandler, createBlurHandler, hasError, isLoading, isValid, getValidationText } from '../shared/helpers.js';
|
|
7
7
|
import { inputPropType, metaPropType } from '../shared/propTypes.js';
|
|
8
|
-
export const SimpleSingleSelectFieldFF =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
8
|
+
export const SimpleSingleSelectFieldFF = ({
|
|
9
|
+
error,
|
|
10
|
+
input,
|
|
11
|
+
loading,
|
|
12
|
+
meta,
|
|
13
|
+
showLoadingStatus,
|
|
14
|
+
showValidStatus,
|
|
15
|
+
valid,
|
|
16
|
+
validationText,
|
|
17
|
+
onBlur,
|
|
18
|
+
onFocus,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
22
21
|
return /*#__PURE__*/React.createElement(SimpleSingleSelectField, _extends({}, rest, {
|
|
23
22
|
name: input.name,
|
|
24
23
|
error: hasError(meta, error),
|
|
@@ -103,12 +102,9 @@ SimpleSingleSelectFieldFF.propTypes = {
|
|
|
103
102
|
* be used to supply the text to be shown.
|
|
104
103
|
**/
|
|
105
104
|
valueLabel: requiredIf(props => {
|
|
106
|
-
if (props.options.find(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} = _ref2;
|
|
110
|
-
return props.value === value;
|
|
111
|
-
})) {
|
|
105
|
+
if (props.options.find(({
|
|
106
|
+
value
|
|
107
|
+
}) => props.value === value)) {
|
|
112
108
|
return false;
|
|
113
109
|
}
|
|
114
110
|
return props.value;
|
|
@@ -16,16 +16,13 @@ export default {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
export const Required = (_,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
options: cypressProps.options || defaultOptions
|
|
30
|
-
});
|
|
31
|
-
};
|
|
19
|
+
export const Required = (_, {
|
|
20
|
+
cypressProps
|
|
21
|
+
}) => /*#__PURE__*/React.createElement(Field, {
|
|
22
|
+
required: true,
|
|
23
|
+
name: "singleSelect",
|
|
24
|
+
label: "Single select",
|
|
25
|
+
component: SingleSelectFieldFF,
|
|
26
|
+
validate: hasValue,
|
|
27
|
+
options: cypressProps.options || defaultOptions
|
|
28
|
+
});
|
|
@@ -4,21 +4,20 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { createSelectChangeHandler, createFocusHandler, createBlurHandler, hasError, isLoading, isValid, getValidationText } from '../shared/helpers.js';
|
|
6
6
|
import { inputPropType, metaPropType } from '../shared/propTypes.js';
|
|
7
|
-
export const SingleSelectFieldFF =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
7
|
+
export const SingleSelectFieldFF = ({
|
|
8
|
+
error,
|
|
9
|
+
input,
|
|
10
|
+
loading,
|
|
11
|
+
meta,
|
|
12
|
+
onBlur,
|
|
13
|
+
onFocus,
|
|
14
|
+
options,
|
|
15
|
+
showLoadingStatus,
|
|
16
|
+
showValidStatus,
|
|
17
|
+
valid,
|
|
18
|
+
validationText,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
22
21
|
return /*#__PURE__*/React.createElement(SingleSelectField, _extends({}, rest, {
|
|
23
22
|
name: input.name,
|
|
24
23
|
error: hasError(meta, error),
|
|
@@ -4,30 +4,27 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { createToggleChangeHandler, createFocusHandler, createBlurHandler, hasError, isValid, getValidationText } from '../shared/helpers.js';
|
|
6
6
|
import { metaPropType, inputPropType } from '../shared/propTypes.js';
|
|
7
|
-
export const SwitchFieldFF =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onBlur: createBlurHandler(input, onBlur)
|
|
29
|
-
}));
|
|
30
|
-
};
|
|
7
|
+
export const SwitchFieldFF = ({
|
|
8
|
+
error,
|
|
9
|
+
input,
|
|
10
|
+
meta,
|
|
11
|
+
showValidStatus,
|
|
12
|
+
valid,
|
|
13
|
+
validationText,
|
|
14
|
+
onBlur,
|
|
15
|
+
onFocus,
|
|
16
|
+
...rest
|
|
17
|
+
}) => /*#__PURE__*/React.createElement(SwitchField, _extends({}, rest, {
|
|
18
|
+
checked: input.checked,
|
|
19
|
+
name: input.name,
|
|
20
|
+
value: input.value,
|
|
21
|
+
error: hasError(meta, error),
|
|
22
|
+
valid: isValid(meta, valid, showValidStatus),
|
|
23
|
+
validationText: getValidationText(meta, validationText, error),
|
|
24
|
+
onFocus: createFocusHandler(input, onFocus),
|
|
25
|
+
onChange: createToggleChangeHandler(input),
|
|
26
|
+
onBlur: createBlurHandler(input, onBlur)
|
|
27
|
+
}));
|
|
31
28
|
SwitchFieldFF.propTypes = {
|
|
32
29
|
/** `input` props received from Final Form `Field` */
|
|
33
30
|
input: inputPropType.isRequired,
|
|
@@ -4,32 +4,29 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { createChangeHandler, createFocusHandler, createBlurHandler, hasError, isLoading, isValid, getValidationText } from '../shared/helpers.js';
|
|
6
6
|
import { metaPropType, inputPropType } from '../shared/propTypes.js';
|
|
7
|
-
export const TextAreaFieldFF =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
value: input.value
|
|
31
|
-
}));
|
|
32
|
-
};
|
|
7
|
+
export const TextAreaFieldFF = ({
|
|
8
|
+
input,
|
|
9
|
+
meta,
|
|
10
|
+
error,
|
|
11
|
+
showValidStatus,
|
|
12
|
+
valid,
|
|
13
|
+
validationText,
|
|
14
|
+
onBlur,
|
|
15
|
+
onFocus,
|
|
16
|
+
loading,
|
|
17
|
+
showLoadingStatus,
|
|
18
|
+
...rest
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(TextAreaField, _extends({}, rest, {
|
|
20
|
+
name: input.name,
|
|
21
|
+
error: hasError(meta, error),
|
|
22
|
+
valid: isValid(meta, valid, showValidStatus),
|
|
23
|
+
loading: isLoading(meta, loading, showLoadingStatus),
|
|
24
|
+
validationText: getValidationText(meta, validationText, error),
|
|
25
|
+
onFocus: createFocusHandler(input, onFocus),
|
|
26
|
+
onChange: createChangeHandler(input),
|
|
27
|
+
onBlur: createBlurHandler(input, onBlur),
|
|
28
|
+
value: input.value
|
|
29
|
+
}));
|
|
33
30
|
TextAreaFieldFF.propTypes = {
|
|
34
31
|
/** `input` props received from Final Form `Field` */
|
|
35
32
|
input: inputPropType.isRequired,
|
|
@@ -12,8 +12,8 @@ const formProps = {
|
|
|
12
12
|
mutators: {}
|
|
13
13
|
};
|
|
14
14
|
class FormWithSpyAndSubmit extends React.Component {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...
|
|
15
|
+
constructor(...args) {
|
|
16
|
+
super(...args);
|
|
17
17
|
_defineProperty(this, "state", {
|
|
18
18
|
cypressProps: {}
|
|
19
19
|
});
|
|
@@ -50,10 +50,9 @@ class FormWithSpyAndSubmit extends React.Component {
|
|
|
50
50
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
51
51
|
primary: true,
|
|
52
52
|
type: "submit"
|
|
53
|
-
}, "Submit"), /*#__PURE__*/React.createElement(FormSpy, null,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} = _ref;
|
|
53
|
+
}, "Submit"), /*#__PURE__*/React.createElement(FormSpy, null, ({
|
|
54
|
+
values
|
|
55
|
+
}) => {
|
|
57
56
|
window.formValues = values;
|
|
58
57
|
return /*#__PURE__*/React.createElement("span", {
|
|
59
58
|
className: "form-spy-internal"
|
|
@@ -43,39 +43,78 @@ import viTranslations from './vi/translations.json';
|
|
|
43
43
|
import zhTranslations from './zh/translations.json';
|
|
44
44
|
import zh_CNTranslations from './zh_CN/translations.json';
|
|
45
45
|
const namespace = 'default';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
i18n.
|
|
51
|
-
i18n.
|
|
52
|
-
i18n.
|
|
53
|
-
i18n.
|
|
54
|
-
i18n.
|
|
55
|
-
i18n.
|
|
56
|
-
i18n.
|
|
57
|
-
i18n.
|
|
58
|
-
i18n.
|
|
59
|
-
i18n.
|
|
60
|
-
i18n.
|
|
61
|
-
i18n.
|
|
62
|
-
i18n.
|
|
63
|
-
i18n.
|
|
64
|
-
i18n.
|
|
65
|
-
i18n.
|
|
66
|
-
i18n.
|
|
67
|
-
i18n.
|
|
68
|
-
i18n.
|
|
69
|
-
i18n.
|
|
70
|
-
i18n.
|
|
71
|
-
i18n.
|
|
72
|
-
i18n.
|
|
73
|
-
i18n.
|
|
74
|
-
i18n.
|
|
75
|
-
i18n.
|
|
76
|
-
i18n.
|
|
77
|
-
i18n.
|
|
78
|
-
i18n.
|
|
79
|
-
i18n.
|
|
80
|
-
i18n.
|
|
46
|
+
|
|
47
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
48
|
+
// custom translations from the datastore (added by the app adapter)
|
|
49
|
+
|
|
50
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
51
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
52
|
+
i18n.addResourceBundle('ar_IQ', namespace, ar_IQTranslations, true, false);
|
|
53
|
+
i18n.addResourceBundle('ar-IQ', namespace, ar_IQTranslations, true, false);
|
|
54
|
+
i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
|
|
55
|
+
i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
|
|
56
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
57
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
58
|
+
i18n.addResourceBundle('da', namespace, daTranslations, true, false);
|
|
59
|
+
i18n.addResourceBundle('da', namespace, daTranslations, true, false);
|
|
60
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
61
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
62
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
63
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
64
|
+
i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
|
|
65
|
+
i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
|
|
66
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
67
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
68
|
+
i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false);
|
|
69
|
+
i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false);
|
|
70
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
71
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
72
|
+
i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
|
|
73
|
+
i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
|
|
74
|
+
i18n.addResourceBundle('ko_KR', namespace, ko_KRTranslations, true, false);
|
|
75
|
+
i18n.addResourceBundle('ko-KR', namespace, ko_KRTranslations, true, false);
|
|
76
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
77
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
78
|
+
i18n.addResourceBundle('my', namespace, myTranslations, true, false);
|
|
79
|
+
i18n.addResourceBundle('my', namespace, myTranslations, true, false);
|
|
80
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
81
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
82
|
+
i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
|
|
83
|
+
i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
|
|
84
|
+
i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
|
|
85
|
+
i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
|
|
86
|
+
i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
|
|
87
|
+
i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
|
|
88
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
89
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
90
|
+
i18n.addResourceBundle('pt_BR', namespace, pt_BRTranslations, true, false);
|
|
91
|
+
i18n.addResourceBundle('pt-BR', namespace, pt_BRTranslations, true, false);
|
|
92
|
+
i18n.addResourceBundle('ro', namespace, roTranslations, true, false);
|
|
93
|
+
i18n.addResourceBundle('ro', namespace, roTranslations, true, false);
|
|
94
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
95
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
96
|
+
i18n.addResourceBundle('si', namespace, siTranslations, true, false);
|
|
97
|
+
i18n.addResourceBundle('si', namespace, siTranslations, true, false);
|
|
98
|
+
i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
|
|
99
|
+
i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
|
|
100
|
+
i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
|
|
101
|
+
i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
|
|
102
|
+
i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
|
|
103
|
+
i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
|
|
104
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
105
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
106
|
+
i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
|
|
107
|
+
i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
|
|
108
|
+
i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false);
|
|
109
|
+
i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false);
|
|
110
|
+
i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
111
|
+
i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
112
|
+
i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
|
|
113
|
+
i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
|
|
114
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
115
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
116
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
117
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
118
|
+
i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
|
|
119
|
+
i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
|
|
81
120
|
export default i18n;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
const PRIMITIVE_TYPES = new Set(['string', 'number', 'boolean']);
|
|
2
|
-
const createChangeHandler =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
throw new Error('Could not process event payload');
|
|
19
|
-
}
|
|
20
|
-
};
|
|
2
|
+
const createChangeHandler = ({
|
|
3
|
+
onChange
|
|
4
|
+
}) => payload => {
|
|
5
|
+
if (payload && 'value' in payload) {
|
|
6
|
+
// ui event signature
|
|
7
|
+
onChange(payload.value);
|
|
8
|
+
} else if (payload && payload.target && 'value' in payload.target) {
|
|
9
|
+
// synthetic event
|
|
10
|
+
onChange(payload.target.value);
|
|
11
|
+
} else if (PRIMITIVE_TYPES.has(typeof payload)) {
|
|
12
|
+
// directly usable value
|
|
13
|
+
onChange(payload);
|
|
14
|
+
} else {
|
|
15
|
+
// ¯\_(ツ)_/¯
|
|
16
|
+
throw new Error('Could not process event payload');
|
|
17
|
+
}
|
|
21
18
|
};
|
|
22
19
|
export { createChangeHandler };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
const createSelectChangeHandler =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
selected
|
|
8
|
-
} = _ref2;
|
|
9
|
-
onChange(selected);
|
|
10
|
-
};
|
|
1
|
+
const createSelectChangeHandler = ({
|
|
2
|
+
onChange
|
|
3
|
+
}) => ({
|
|
4
|
+
selected
|
|
5
|
+
}) => {
|
|
6
|
+
onChange(selected);
|
|
11
7
|
};
|
|
12
8
|
export { createSelectChangeHandler };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
const format = value => !value ? [] : value.map(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} = _ref;
|
|
5
|
-
return id;
|
|
6
|
-
});
|
|
1
|
+
const format = value => !value ? [] : value.map(({
|
|
2
|
+
id
|
|
3
|
+
}) => id);
|
|
7
4
|
const parse = value => !value || Array.isArray(value) && value.length === 0 ? undefined : value.map(id => ({
|
|
8
5
|
id
|
|
9
6
|
}));
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
export const composeValidators =
|
|
2
|
-
|
|
3
|
-
validators[_key] = arguments[_key];
|
|
4
|
-
}
|
|
5
|
-
return function () {
|
|
6
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
7
|
-
args[_key2] = arguments[_key2];
|
|
8
|
-
}
|
|
1
|
+
export const composeValidators = (...validators) => {
|
|
2
|
+
return (...args) => {
|
|
9
3
|
return validators.reduce((error, validator) => error || validator(...args), undefined);
|
|
10
4
|
};
|
|
11
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/ui-forms",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.4",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"sideEffects": [
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@dhis2/prop-types": "^3.1.2",
|
|
38
|
-
"@dhis2-ui/button": "10.16.
|
|
39
|
-
"@dhis2-ui/checkbox": "10.16.
|
|
40
|
-
"@dhis2-ui/field": "10.16.
|
|
41
|
-
"@dhis2-ui/file-input": "10.16.
|
|
42
|
-
"@dhis2-ui/input": "10.16.
|
|
43
|
-
"@dhis2-ui/radio": "10.16.
|
|
44
|
-
"@dhis2-ui/select": "10.16.
|
|
45
|
-
"@dhis2-ui/switch": "10.16.
|
|
46
|
-
"@dhis2-ui/text-area": "10.16.
|
|
38
|
+
"@dhis2-ui/button": "10.16.4",
|
|
39
|
+
"@dhis2-ui/checkbox": "10.16.4",
|
|
40
|
+
"@dhis2-ui/field": "10.16.4",
|
|
41
|
+
"@dhis2-ui/file-input": "10.16.4",
|
|
42
|
+
"@dhis2-ui/input": "10.16.4",
|
|
43
|
+
"@dhis2-ui/radio": "10.16.4",
|
|
44
|
+
"@dhis2-ui/select": "10.16.4",
|
|
45
|
+
"@dhis2-ui/switch": "10.16.4",
|
|
46
|
+
"@dhis2-ui/text-area": "10.16.4",
|
|
47
47
|
"classnames": "^2.3.1",
|
|
48
48
|
"final-form": "^4.20.2",
|
|
49
49
|
"prop-types": "^15.7.2",
|