@dhis2/ui-forms 8.1.11 → 8.2.2
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
@@ -19,20 +19,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
19
19
|
|
20
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
21
21
|
|
22
|
-
const SingleSelectFieldFF =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
22
|
+
const SingleSelectFieldFF = _ref => {
|
23
|
+
let {
|
24
|
+
error,
|
25
|
+
input,
|
26
|
+
loading,
|
27
|
+
meta,
|
28
|
+
onBlur,
|
29
|
+
onFocus,
|
30
|
+
options,
|
31
|
+
showLoadingStatus,
|
32
|
+
showValidStatus,
|
33
|
+
valid,
|
34
|
+
validationText,
|
35
|
+
...rest
|
36
|
+
} = _ref;
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_select.SingleSelectField, _extends({}, rest, {
|
37
38
|
name: input.name,
|
38
39
|
error: (0, _helpers.hasError)(meta, error),
|
@@ -22,13 +22,16 @@ const defaultOptions = [{
|
|
22
22
|
options: {
|
23
23
|
showPanel: false
|
24
24
|
}
|
25
|
-
}).add('Required', (_, {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
}).add('Required', (_, _ref) => {
|
26
|
+
let {
|
27
|
+
cypressProps
|
28
|
+
} = _ref;
|
29
|
+
return /*#__PURE__*/_react2.default.createElement(_reactFinalForm.Field, {
|
30
|
+
required: true,
|
31
|
+
name: "singleSelect",
|
32
|
+
label: "Single select",
|
33
|
+
component: _SingleSelectFieldFF.SingleSelectFieldFF,
|
34
|
+
validate: _index.hasValue,
|
35
|
+
options: cypressProps.options || defaultOptions
|
36
|
+
});
|
37
|
+
});
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = exports.InitialValue = exports.Default = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -17,33 +17,7 @@ var _SingleSelectFieldFF = require("./SingleSelectFieldFF.js");
|
|
17
17
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
19
|
|
20
|
-
const description = `
|
21
|
-
The \`SingleSelectFieldFF\` is a wrapper around a \`SingleSelectField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
|
22
|
-
|
23
|
-
#### Final Form
|
24
|
-
|
25
|
-
See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
|
26
|
-
|
27
|
-
Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={SingleSelectFieldFF} />\`. See the code samples below for examples.
|
28
|
-
|
29
|
-
#### Props
|
30
|
-
|
31
|
-
The props shown in the table below are generally provided to the \`SingleSelectFieldFF\` wrapper by the Final Form \`Field\`.
|
32
|
-
|
33
|
-
Note that any props beyond the API of the \`Field\` component will be spread to the \`SingleSelectFieldFF\`, which passes any extra props to the underlying \`SingleSelectField\` using \`{...rest}\`.
|
34
|
-
|
35
|
-
Therefore, to add any props to the \`SingleSelectFieldFF\` or \`SingleSelectField\`, add those props to the parent Final Form \`Field\` component.
|
36
|
-
|
37
|
-
Also see \`SingleSelect\` and \`SingleSelectField\` for notes about props and implementation.
|
38
|
-
|
39
|
-
\`\`\`js
|
40
|
-
import { SingleSelectFieldFF } from '@dhis2/ui'
|
41
|
-
\`\`\`
|
42
|
-
|
43
|
-
Press **Submit** to see the form values logged to the console.
|
44
|
-
|
45
|
-
_**Note:** Dropdowns may not appear correctly on this page. See the affected demos in the 'Canvas' tab for propper dropdown placement._
|
46
|
-
`;
|
20
|
+
const description = "\nThe `SingleSelectFieldFF` is a wrapper around a `SingleSelectField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={SingleSelectFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `SingleSelectFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `SingleSelectFieldFF`, which passes any extra props to the underlying `SingleSelectField` using `{...rest}`.\n\nTherefore, to add any props to the `SingleSelectFieldFF` or `SingleSelectField`, add those props to the parent Final Form `Field` component.\n\nAlso see `SingleSelect` and `SingleSelectField` for notes about props and implementation.\n\n```js\nimport { SingleSelectFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n\n_**Note:** Dropdowns may not appear correctly on this page. See the affected demos in the 'Canvas' tab for propper dropdown placement._\n";
|
47
21
|
const options = [{
|
48
22
|
value: '1',
|
49
23
|
label: 'one'
|
@@ -76,7 +50,7 @@ const options = [{
|
|
76
50
|
label: 'ten'
|
77
51
|
}];
|
78
52
|
var _default = {
|
79
|
-
title: '
|
53
|
+
title: 'Single Select Field (Final Form)',
|
80
54
|
component: _SingleSelectFieldFF.SingleSelectFieldFF,
|
81
55
|
decorators: [_formDecorator.formDecorator],
|
82
56
|
parameters: {
|
@@ -19,27 +19,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
19
19
|
|
20
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
21
21
|
|
22
|
-
const SwitchFieldFF =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
22
|
+
const SwitchFieldFF = _ref => {
|
23
|
+
let {
|
24
|
+
error,
|
25
|
+
input,
|
26
|
+
meta,
|
27
|
+
showValidStatus,
|
28
|
+
valid,
|
29
|
+
validationText,
|
30
|
+
onBlur,
|
31
|
+
onFocus,
|
32
|
+
...rest
|
33
|
+
} = _ref;
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_switch.SwitchField, _extends({}, rest, {
|
35
|
+
checked: input.checked,
|
36
|
+
name: input.name,
|
37
|
+
value: input.value,
|
38
|
+
error: (0, _helpers.hasError)(meta, error),
|
39
|
+
valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
|
40
|
+
validationText: (0, _helpers.getValidationText)(meta, validationText, error),
|
41
|
+
onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
|
42
|
+
onChange: (0, _helpers.createToggleChangeHandler)(input),
|
43
|
+
onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
|
44
|
+
}));
|
45
|
+
};
|
43
46
|
|
44
47
|
exports.SwitchFieldFF = SwitchFieldFF;
|
45
48
|
SwitchFieldFF.propTypes = {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = exports.ValueWhenChecked = exports.Statuses = exports.Required = exports.HelpText = exports.Disabled = exports.Default = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -19,33 +19,9 @@ var _SwitchFieldFF = require("./SwitchFieldFF.js");
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
const description = `
|
23
|
-
The \`SwitchFieldFF\` is a wrapper around a \`SwitchField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
|
24
|
-
|
25
|
-
#### Final Form
|
26
|
-
|
27
|
-
See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
|
28
|
-
|
29
|
-
Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={SwitchFieldFF} />\`. See the code samples below for examples.
|
30
|
-
|
31
|
-
#### Props
|
32
|
-
|
33
|
-
The props shown in the table below are generally provided to the \`SwitchFieldFF\` wrapper by the Final Form \`Field\`.
|
34
|
-
|
35
|
-
Note that any props beyond the API of the \`Field\` component will be spread to the \`SwitchFieldFF\`, which passes any extra props to the underlying \`SwitchField\` using \`{...rest}\`.
|
36
|
-
|
37
|
-
Therefore, to add any props to the \`SwitchFieldFF\` or \`SwitchField\`, add those props to the parent Final Form \`Field\` component.
|
38
|
-
|
39
|
-
Also see \`Switch\` and \`SwitchField\` for notes about props and implementation.
|
40
|
-
|
41
|
-
\`\`\`js
|
42
|
-
import { SwitchFieldFF } from '@dhis2/ui'
|
43
|
-
\`\`\`
|
44
|
-
|
45
|
-
Press **Submit** to see the form values logged to the console.
|
46
|
-
`;
|
22
|
+
const description = "\nThe `SwitchFieldFF` is a wrapper around a `SwitchField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={SwitchFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `SwitchFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `SwitchFieldFF`, which passes any extra props to the underlying `SwitchField` using `{...rest}`.\n\nTherefore, to add any props to the `SwitchFieldFF` or `SwitchField`, add those props to the parent Final Form `Field` component.\n\nAlso see `Switch` and `SwitchField` for notes about props and implementation.\n\n```js\nimport { SwitchFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
|
47
23
|
var _default = {
|
48
|
-
title: '
|
24
|
+
title: 'Switch Field (Final Form)',
|
49
25
|
component: _SwitchFieldFF.SwitchFieldFF,
|
50
26
|
decorators: [_formDecorator.formDecorator],
|
51
27
|
parameters: {
|
@@ -19,29 +19,32 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
19
19
|
|
20
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
21
21
|
|
22
|
-
const TextAreaFieldFF =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
22
|
+
const TextAreaFieldFF = _ref => {
|
23
|
+
let {
|
24
|
+
input,
|
25
|
+
meta,
|
26
|
+
error,
|
27
|
+
showValidStatus,
|
28
|
+
valid,
|
29
|
+
validationText,
|
30
|
+
onBlur,
|
31
|
+
onFocus,
|
32
|
+
loading,
|
33
|
+
showLoadingStatus,
|
34
|
+
...rest
|
35
|
+
} = _ref;
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_textArea.TextAreaField, _extends({}, rest, {
|
37
|
+
name: input.name,
|
38
|
+
error: (0, _helpers.hasError)(meta, error),
|
39
|
+
valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
|
40
|
+
loading: (0, _helpers.isLoading)(meta, loading, showLoadingStatus),
|
41
|
+
validationText: (0, _helpers.getValidationText)(meta, validationText, error),
|
42
|
+
onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
|
43
|
+
onChange: (0, _helpers.createChangeHandler)(input),
|
44
|
+
onBlur: (0, _helpers.createBlurHandler)(input, onBlur),
|
45
|
+
value: input.value
|
46
|
+
}));
|
47
|
+
};
|
45
48
|
|
46
49
|
exports.TextAreaFieldFF = TextAreaFieldFF;
|
47
50
|
TextAreaFieldFF.propTypes = {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = exports.Statuses = exports.Required = exports.HelpText = exports.Disabled = exports.Default = exports.Autogrow = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -19,33 +19,9 @@ var _TextAreaFieldFF = require("./TextAreaFieldFF.js");
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
const description = `
|
23
|
-
The \`TextAreaFieldFF\` is a wrapper around a \`TextAreaField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
|
24
|
-
|
25
|
-
#### Final Form
|
26
|
-
|
27
|
-
See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
|
28
|
-
|
29
|
-
Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={TextAreaFieldFF} />\`. See the code samples below for examples.
|
30
|
-
|
31
|
-
#### Props
|
32
|
-
|
33
|
-
The props shown in the table below are generally provided to the \`TextAreaFieldFF\` wrapper by the Final Form \`Field\`.
|
34
|
-
|
35
|
-
Note that any props beyond the API of the \`Field\` component will be spread to the \`TextAreaFieldFF\`, which passes any extra props to the underlying \`TextAreaField\` using \`{...rest}\`.
|
36
|
-
|
37
|
-
Therefore, to add any props to the \`TextAreaFieldFF\` or \`TextAreaField\`, add those props to the parent Final Form \`Field\` component.
|
38
|
-
|
39
|
-
Also see \`TextArea\` and \`TextAreaField\` for notes about props and implementation.
|
40
|
-
|
41
|
-
\`\`\`js
|
42
|
-
import { TextAreaFieldFF } from '@dhis2/ui'
|
43
|
-
\`\`\`
|
44
|
-
|
45
|
-
Press **Submit** to see the form values logged to the console.
|
46
|
-
`;
|
22
|
+
const description = "\nThe `TextAreaFieldFF` is a wrapper around a `TextAreaField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={TextAreaFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `TextAreaFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `TextAreaFieldFF`, which passes any extra props to the underlying `TextAreaField` using `{...rest}`.\n\nTherefore, to add any props to the `TextAreaFieldFF` or `TextAreaField`, add those props to the parent Final Form `Field` component.\n\nAlso see `TextArea` and `TextAreaField` for notes about props and implementation.\n\n```js\nimport { TextAreaFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
|
47
23
|
var _default = {
|
48
|
-
title: '
|
24
|
+
title: 'Text Area Field (Final Form)',
|
49
25
|
component: _TextAreaFieldFF.TextAreaFieldFF,
|
50
26
|
decorators: [_formDecorator.formDecorator],
|
51
27
|
parameters: {
|
@@ -25,8 +25,8 @@ const formProps = {
|
|
25
25
|
};
|
26
26
|
|
27
27
|
class FormWithSpyAndSubmit extends _react.default.Component {
|
28
|
-
constructor(
|
29
|
-
super(...
|
28
|
+
constructor() {
|
29
|
+
super(...arguments);
|
30
30
|
|
31
31
|
_defineProperty(this, "state", {
|
32
32
|
cypressProps: {}
|
@@ -68,9 +68,10 @@ class FormWithSpyAndSubmit extends _react.default.Component {
|
|
68
68
|
}), /*#__PURE__*/_react.default.createElement(_button.Button, {
|
69
69
|
primary: true,
|
70
70
|
type: "submit"
|
71
|
-
}, "Submit"), /*#__PURE__*/_react.default.createElement(_reactFinalForm.FormSpy, null,
|
72
|
-
|
73
|
-
|
71
|
+
}, "Submit"), /*#__PURE__*/_react.default.createElement(_reactFinalForm.FormSpy, null, _ref => {
|
72
|
+
let {
|
73
|
+
values
|
74
|
+
} = _ref;
|
74
75
|
window.formValues = values;
|
75
76
|
return /*#__PURE__*/_react.default.createElement("span", {
|
76
77
|
className: "form-spy-internal"
|
package/build/cjs/index.js
CHANGED
@@ -22,12 +22,19 @@ Object.defineProperty(exports, "CheckboxFieldFF", {
|
|
22
22
|
return _CheckboxFieldFF.CheckboxFieldFF;
|
23
23
|
}
|
24
24
|
});
|
25
|
+
Object.defineProperty(exports, "FieldGroupFF", {
|
26
|
+
enumerable: true,
|
27
|
+
get: function () {
|
28
|
+
return _FieldGroupFF.FieldGroupFF;
|
29
|
+
}
|
30
|
+
});
|
25
31
|
Object.defineProperty(exports, "FileInputFieldFF", {
|
26
32
|
enumerable: true,
|
27
33
|
get: function () {
|
28
34
|
return _FileInputFieldFF.FileInputFieldFF;
|
29
35
|
}
|
30
36
|
});
|
37
|
+
exports.FinalForm = void 0;
|
31
38
|
Object.defineProperty(exports, "InputFieldFF", {
|
32
39
|
enumerable: true,
|
33
40
|
get: function () {
|
@@ -40,16 +47,17 @@ Object.defineProperty(exports, "MultiSelectFieldFF", {
|
|
40
47
|
return _MultiSelectFieldFF.MultiSelectFieldFF;
|
41
48
|
}
|
42
49
|
});
|
43
|
-
Object.defineProperty(exports, "
|
50
|
+
Object.defineProperty(exports, "RadioFieldFF", {
|
44
51
|
enumerable: true,
|
45
52
|
get: function () {
|
46
|
-
return
|
53
|
+
return _RadioFieldFF.RadioFieldFF;
|
47
54
|
}
|
48
55
|
});
|
49
|
-
|
56
|
+
exports.ReactFinalForm = void 0;
|
57
|
+
Object.defineProperty(exports, "SingleSelectFieldFF", {
|
50
58
|
enumerable: true,
|
51
59
|
get: function () {
|
52
|
-
return
|
60
|
+
return _SingleSelectFieldFF.SingleSelectFieldFF;
|
53
61
|
}
|
54
62
|
});
|
55
63
|
Object.defineProperty(exports, "SwitchFieldFF", {
|
@@ -64,13 +72,6 @@ Object.defineProperty(exports, "TextAreaFieldFF", {
|
|
64
72
|
return _TextAreaFieldFF.TextAreaFieldFF;
|
65
73
|
}
|
66
74
|
});
|
67
|
-
Object.defineProperty(exports, "FieldGroupFF", {
|
68
|
-
enumerable: true,
|
69
|
-
get: function () {
|
70
|
-
return _FieldGroupFF.FieldGroupFF;
|
71
|
-
}
|
72
|
-
});
|
73
|
-
exports.ReactFinalForm = exports.FinalForm = void 0;
|
74
75
|
|
75
76
|
var FinalForm = _interopRequireWildcard(require("final-form"));
|
76
77
|
|
@@ -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": "Nahrát soubor",
|
3
3
|
"Upload files": "Nahrát soubory",
|
4
4
|
"Remove": "Odebrat",
|
5
|
-
"No file(s) selected yet": "Zatím není (nejsou) vybrány žádné soubory",
|
6
5
|
"Please provide an alpha-numeric value": "Uveďte alfanumerickou hodnotu",
|
7
6
|
"Please provide a boolean value": "Zadejte prosím booleovskou hodnotu",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "Zadejte prosím mezi {{lowerBound}} a {{upperBound}} znaky",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Upload file",
|
3
3
|
"Upload files": "Upload files",
|
4
4
|
"Remove": "Remove",
|
5
|
-
"No file(s) selected yet": "No file(s) selected yet",
|
6
5
|
"Please provide an alpha-numeric value": "Please provide an alpha-numeric value",
|
7
6
|
"Please provide a boolean value": "Please provide a boolean value",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "Please enter between {{lowerBound}} and {{upperBound}} characters",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Subir archivo",
|
3
3
|
"Upload files": "Subir archivos",
|
4
4
|
"Remove": "Eliminar",
|
5
|
-
"No file(s) selected yet": "Ningún archivo (s) seleccionado (s) todavía",
|
6
5
|
"Please provide an alpha-numeric value": "Proporcione un valor alfanumérico.",
|
7
6
|
"Please provide a boolean value": "Proporcione un valor booleano",
|
8
7
|
"Please enter between {{lowerBound}} and {{upperBound}} characters": "Ingresa entre {{lowerBound}} y {{upperBound}} caracteres",
|
@@ -2,7 +2,6 @@
|
|
2
2
|
"Upload file": "Charger fichier",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Supprimer",
|
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": "Last opp fil",
|
3
3
|
"Upload files": "",
|
4
4
|
"Remove": "Fjern",
|
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": "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": "",
|