@dhis2/ui-forms 8.2.0 → 8.2.3
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/CheckboxFieldFF/CheckboxFieldFF.js +24 -21
- package/build/cjs/CheckboxFieldFF/CheckboxFieldFF.stories.js +3 -27
- package/build/cjs/FieldGroupFF/FieldGroupFF.js +7 -6
- package/build/cjs/FieldGroupFF/FieldGroupFF.stories.js +3 -13
- package/build/cjs/FileInputFieldFF/FileInputFieldFF.js +17 -18
- package/build/cjs/FileInputFieldFF/FileInputFieldFF.stories.e2e.js +12 -8
- package/build/cjs/FileInputFieldFF/FileInputFieldFF.stories.js +3 -27
- package/build/cjs/InputFieldFF/InputFieldFF.js +27 -24
- package/build/cjs/InputFieldFF/InputFieldFF.stories.js +3 -27
- package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.js +15 -14
- package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.stories.e2e.js +13 -10
- package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +3 -29
- package/build/cjs/RadioFieldFF/RadioFieldFF.js +24 -21
- package/build/cjs/RadioFieldFF/RadioFieldFF.stories.js +3 -27
- package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.js +15 -14
- package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.e2e.js +13 -10
- package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +3 -29
- package/build/cjs/SwitchFieldFF/SwitchFieldFF.js +24 -21
- package/build/cjs/SwitchFieldFF/SwitchFieldFF.stories.js +3 -27
- package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.js +26 -23
- package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.stories.js +3 -27
- package/build/cjs/formDecorator.js +6 -5
- package/build/cjs/index.js +12 -11
- package/build/cjs/locales/ar/translations.json +0 -1
- package/build/cjs/locales/ar_IQ/translations.json +0 -1
- package/build/cjs/locales/ckb/translations.json +0 -1
- package/build/cjs/locales/cs/translations.json +0 -1
- package/build/cjs/locales/da/translations.json +0 -1
- package/build/cjs/locales/en/translations.json +0 -1
- package/build/cjs/locales/es/translations.json +0 -1
- package/build/cjs/locales/fr/translations.json +0 -1
- package/build/cjs/locales/id/translations.json +0 -1
- package/build/cjs/locales/km/translations.json +0 -1
- package/build/cjs/locales/lo/translations.json +0 -1
- package/build/cjs/locales/my/translations.json +0 -1
- package/build/cjs/locales/nb/translations.json +0 -1
- package/build/cjs/locales/prs/translations.json +0 -1
- package/build/cjs/locales/ps/translations.json +0 -1
- package/build/cjs/locales/pt/translations.json +0 -1
- package/build/cjs/locales/pt_BR/translations.json +0 -1
- package/build/cjs/locales/ru/translations.json +0 -1
- package/build/cjs/locales/sv/translations.json +0 -1
- package/build/cjs/locales/tet/translations.json +0 -1
- package/build/cjs/locales/tg/translations.json +0 -1
- package/build/cjs/locales/uk/translations.json +0 -1
- package/build/cjs/locales/ur/translations.json +0 -1
- package/build/cjs/locales/uz/translations.json +0 -1
- package/build/cjs/locales/uz_Latn/translations.json +0 -1
- package/build/cjs/locales/vi/translations.json +0 -1
- package/build/cjs/locales/zh/translations.json +0 -1
- package/build/cjs/locales/zh_CN/translations.json +0 -1
- package/build/cjs/shared/helpers/createChangeHandler.js +19 -16
- package/build/cjs/shared/helpers/createSelectChangeHandler.js +10 -6
- package/build/cjs/shared/propTypes.js +1 -1
- package/build/cjs/transformers/arrayWithIdObjects.js +6 -3
- package/build/cjs/validators/__tests__/createPattern.test.js +1 -1
- package/build/cjs/validators/composeValidators.js +10 -2
- package/build/cjs/validators/helpers/index.js +1 -1
- package/build/cjs/validators/number.js +1 -1
- package/build/cjs/validators/string.js +1 -1
- package/build/cjs/validators/test-helpers/index.js +2 -2
- package/build/cjs/validators/url.js +1 -1
- package/build/es/CheckboxFieldFF/CheckboxFieldFF.js +24 -21
- package/build/es/CheckboxFieldFF/CheckboxFieldFF.stories.js +2 -26
- package/build/es/FieldGroupFF/FieldGroupFF.js +7 -6
- package/build/es/FieldGroupFF/FieldGroupFF.stories.js +2 -12
- package/build/es/FileInputFieldFF/FileInputFieldFF.js +17 -18
- package/build/es/FileInputFieldFF/FileInputFieldFF.stories.e2e.js +12 -8
- package/build/es/FileInputFieldFF/FileInputFieldFF.stories.js +2 -26
- package/build/es/InputFieldFF/InputFieldFF.js +27 -24
- package/build/es/InputFieldFF/InputFieldFF.stories.js +2 -26
- package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.js +15 -14
- package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.stories.e2e.js +13 -10
- package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +2 -28
- package/build/es/RadioFieldFF/RadioFieldFF.js +24 -21
- package/build/es/RadioFieldFF/RadioFieldFF.stories.js +2 -26
- package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.js +15 -14
- package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.stories.e2e.js +13 -10
- package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +2 -28
- package/build/es/SwitchFieldFF/SwitchFieldFF.js +24 -21
- package/build/es/SwitchFieldFF/SwitchFieldFF.stories.js +2 -26
- package/build/es/TextAreaFieldFF/TextAreaFieldFF.js +26 -23
- package/build/es/TextAreaFieldFF/TextAreaFieldFF.stories.js +2 -26
- package/build/es/formDecorator.js +6 -5
- package/build/es/locales/ar/translations.json +0 -1
- package/build/es/locales/ar_IQ/translations.json +0 -1
- package/build/es/locales/ckb/translations.json +0 -1
- package/build/es/locales/cs/translations.json +0 -1
- package/build/es/locales/da/translations.json +0 -1
- package/build/es/locales/en/translations.json +0 -1
- package/build/es/locales/es/translations.json +0 -1
- package/build/es/locales/fr/translations.json +0 -1
- package/build/es/locales/id/translations.json +0 -1
- package/build/es/locales/km/translations.json +0 -1
- package/build/es/locales/lo/translations.json +0 -1
- package/build/es/locales/my/translations.json +0 -1
- package/build/es/locales/nb/translations.json +0 -1
- package/build/es/locales/prs/translations.json +0 -1
- package/build/es/locales/ps/translations.json +0 -1
- package/build/es/locales/pt/translations.json +0 -1
- package/build/es/locales/pt_BR/translations.json +0 -1
- package/build/es/locales/ru/translations.json +0 -1
- package/build/es/locales/sv/translations.json +0 -1
- package/build/es/locales/tet/translations.json +0 -1
- package/build/es/locales/tg/translations.json +0 -1
- package/build/es/locales/uk/translations.json +0 -1
- package/build/es/locales/ur/translations.json +0 -1
- package/build/es/locales/uz/translations.json +0 -1
- package/build/es/locales/uz_Latn/translations.json +0 -1
- package/build/es/locales/vi/translations.json +0 -1
- package/build/es/locales/zh/translations.json +0 -1
- package/build/es/locales/zh_CN/translations.json +0 -1
- package/build/es/shared/helpers/createChangeHandler.js +19 -16
- package/build/es/shared/helpers/createSelectChangeHandler.js +10 -6
- package/build/es/transformers/arrayWithIdObjects.js +6 -3
- package/build/es/validators/__tests__/createPattern.test.js +1 -1
- package/build/es/validators/composeValidators.js +10 -2
- package/build/es/validators/test-helpers/index.js +1 -1
- package/package.json +10 -10
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Carregar arquivo",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Remover",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Carregar arquivo",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Remover",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Загрузить файл",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Убрать",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Боркунии файл",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Тоза кардан",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Файлни юклаш",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Олиб ташлаш",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Faylni yuklash",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Олиб ташлаш",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Tải một tập tin",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Tháo ra",
|
5
|
-
"No file(s) selected yet": "",
|
6
5
|
"Please provide an alpha-numeric value": "",
|
7
6
|
"Please provide a boolean value": "",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "上传文件",
|
3
3
|
"Upload files": "上传文件",
|
4
4
|
"Remove": "移除",
|
5
|
-
"No file(s) selected yet": "尚未选择任何文件",
|
6
5
|
"Please provide an alpha-numeric value": "请提供字母数字值",
|
7
6
|
"Please provide a boolean value": "请提供一个布尔值",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "请在 {{lowerBound}} 和 {{upperBound}} 个字符之间输入",
|
@@ -1,21 +1,24 @@
|
|
1
1
|
const PRIMITIVE_TYPES = new Set(['string', 'number', 'boolean']);
|
2
2
|
|
3
|
-
const createChangeHandler =
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
const createChangeHandler = _ref => {
|
4
|
+
let {
|
5
|
+
onChange
|
6
|
+
} = _ref;
|
7
|
+
return payload => {
|
8
|
+
if (payload && 'value' in payload) {
|
9
|
+
// ui event signature
|
10
|
+
onChange(payload.value);
|
11
|
+
} else if (payload && payload.target && 'value' in payload.target) {
|
12
|
+
// synthetic event
|
13
|
+
onChange(payload.target.value);
|
14
|
+
} else if (PRIMITIVE_TYPES.has(typeof payload)) {
|
15
|
+
// directly usable value
|
16
|
+
onChange(payload);
|
17
|
+
} else {
|
18
|
+
// ¯\_(ツ)_/¯
|
19
|
+
throw new Error('Could not process event payload');
|
20
|
+
}
|
21
|
+
};
|
19
22
|
};
|
20
23
|
|
21
24
|
export { createChangeHandler };
|
@@ -1,9 +1,13 @@
|
|
1
|
-
const createSelectChangeHandler =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
const createSelectChangeHandler = _ref => {
|
2
|
+
let {
|
3
|
+
onChange
|
4
|
+
} = _ref;
|
5
|
+
return _ref2 => {
|
6
|
+
let {
|
7
|
+
selected
|
8
|
+
} = _ref2;
|
9
|
+
onChange(selected);
|
10
|
+
};
|
7
11
|
};
|
8
12
|
|
9
13
|
export { createSelectChangeHandler };
|
@@ -1,6 +1,9 @@
|
|
1
|
-
const format = value => !value ? [] : value.map(
|
2
|
-
|
3
|
-
|
1
|
+
const format = value => !value ? [] : value.map(_ref => {
|
2
|
+
let {
|
3
|
+
id
|
4
|
+
} = _ref;
|
5
|
+
return id;
|
6
|
+
});
|
4
7
|
|
5
8
|
const parse = value => !value || Array.isArray(value) && value.length === 0 ? undefined : value.map(id => ({
|
6
9
|
id
|
@@ -20,7 +20,7 @@ describe('validator: createPattern', () => {
|
|
20
20
|
});
|
21
21
|
it('should return an error string when input does not match the pattern', () => {
|
22
22
|
const escapedRegexString = '/^test$/';
|
23
|
-
const invalidMsg =
|
23
|
+
const invalidMsg = "Please make sure the value of this input matches the pattern ".concat(escapedRegexString, ".");
|
24
24
|
expect(equalToTestPattern('bad input')).toEqual(invalidMsg);
|
25
25
|
});
|
26
26
|
it('should return an custon error string when one was provided and input does not match the pattern', () => {
|
@@ -1,5 +1,13 @@
|
|
1
|
-
export const composeValidators = (
|
2
|
-
|
1
|
+
export const composeValidators = function () {
|
2
|
+
for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
|
3
|
+
validators[_key] = arguments[_key];
|
4
|
+
}
|
5
|
+
|
6
|
+
return function () {
|
7
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
8
|
+
args[_key2] = arguments[_key2];
|
9
|
+
}
|
10
|
+
|
3
11
|
return validators.reduce((error, validator) => error || validator(...args), undefined);
|
4
12
|
};
|
5
13
|
};
|
@@ -4,7 +4,7 @@ const testValidatorValues = (validator, returnValue, values) => {
|
|
4
4
|
for (const value of values) {
|
5
5
|
const type = typeof value;
|
6
6
|
const valueStr = type === 'object' ? JSON.stringify(value) : value;
|
7
|
-
it(
|
7
|
+
it("should return ".concat(returnValueStr, " for value `").concat(valueStr, "` of type ").concat(type), () => {
|
8
8
|
expect(validator(value)).toBe(returnValue);
|
9
9
|
});
|
10
10
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dhis2/ui-forms",
|
3
|
-
"version": "8.2.
|
3
|
+
"version": "8.2.3",
|
4
4
|
"main": "./build/cjs/index.js",
|
5
5
|
"module": "./build/es/index.js",
|
6
6
|
"sideEffects": [
|
@@ -34,15 +34,15 @@
|
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
36
|
"@dhis2/prop-types": "^3.0.0-beta.1",
|
37
|
-
"@dhis2-ui/button": "8.2.
|
38
|
-
"@dhis2-ui/checkbox": "8.2.
|
39
|
-
"@dhis2-ui/field": "8.2.
|
40
|
-
"@dhis2-ui/file-input": "8.2.
|
41
|
-
"@dhis2-ui/input": "8.2.
|
42
|
-
"@dhis2-ui/radio": "8.2.
|
43
|
-
"@dhis2-ui/select": "8.2.
|
44
|
-
"@dhis2-ui/switch": "8.2.
|
45
|
-
"@dhis2-ui/text-area": "8.2.
|
37
|
+
"@dhis2-ui/button": "8.2.3",
|
38
|
+
"@dhis2-ui/checkbox": "8.2.3",
|
39
|
+
"@dhis2-ui/field": "8.2.3",
|
40
|
+
"@dhis2-ui/file-input": "8.2.3",
|
41
|
+
"@dhis2-ui/input": "8.2.3",
|
42
|
+
"@dhis2-ui/radio": "8.2.3",
|
43
|
+
"@dhis2-ui/select": "8.2.3",
|
44
|
+
"@dhis2-ui/switch": "8.2.3",
|
45
|
+
"@dhis2-ui/text-area": "8.2.3",
|
46
46
|
"classnames": "^2.3.1",
|
47
47
|
"final-form": "^4.20.2",
|
48
48
|
"prop-types": "^15.7.2",
|