@digigov/form 0.9.0 → 0.10.0
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/CHANGELOG.md +15 -1
- package/Field/index.js +10 -10
- package/FieldArray/index.js +10 -8
- package/Fieldset/index.js +14 -5
- package/Fieldset/types.d.ts +4 -2
- package/MultiplicityField/MultiplicityField.mdx +542 -110
- package/MultiplicityField/add-objects.d.ts +1 -1
- package/MultiplicityField/add-objects.js +2 -0
- package/MultiplicityField/index.js +1 -0
- package/__stories__/AutoCompleteField.js +1 -1
- package/es/Field/index.js +10 -10
- package/es/FieldArray/index.js +8 -6
- package/es/Fieldset/index.js +13 -5
- package/es/MultiplicityField/MultiplicityField.mdx +542 -110
- package/es/MultiplicityField/add-objects.js +2 -0
- package/es/MultiplicityField/index.js +1 -0
- package/es/__stories__/AutoCompleteField.js +1 -1
- package/es/inputs/Checkboxes/index.js +4 -1
- package/es/inputs/Select/Select.stories.playwright.json +22 -0
- package/esm/Field/index.js +10 -10
- package/esm/FieldArray/index.js +8 -6
- package/esm/Fieldset/index.js +13 -5
- package/esm/MultiplicityField/MultiplicityField.mdx +542 -110
- package/esm/MultiplicityField/add-objects.js +2 -0
- package/esm/MultiplicityField/index.js +1 -0
- package/esm/__stories__/AutoCompleteField.js +1 -1
- package/esm/index.js +1 -1
- package/esm/inputs/Checkboxes/index.js +4 -1
- package/esm/inputs/Select/Select.stories.playwright.json +22 -0
- package/inputs/Checkboxes/index.js +4 -1
- package/inputs/Select/Select.stories.playwright.json +22 -0
- package/package.json +4 -4
|
@@ -17,6 +17,7 @@ import FieldObject from '@digigov/form/FieldObject';
|
|
|
17
17
|
export var AddObjects = function AddObjects(_ref) {
|
|
18
18
|
var name = _ref.name,
|
|
19
19
|
fields = _ref.fields,
|
|
20
|
+
formState = _ref.formState,
|
|
20
21
|
extra = _ref.extra,
|
|
21
22
|
append = _ref.append,
|
|
22
23
|
remove = _ref.remove,
|
|
@@ -57,6 +58,7 @@ export var AddObjects = function AddObjects(_ref) {
|
|
|
57
58
|
name: currentName,
|
|
58
59
|
error: error && error[currentIndex],
|
|
59
60
|
register: register,
|
|
61
|
+
formState: formState,
|
|
60
62
|
control: control
|
|
61
63
|
}, extra === null || extra === void 0 ? void 0 : extra.of, {
|
|
62
64
|
label: (extra === null || extra === void 0 ? void 0 : extra.label.question.objectLabel) || (extra === null || extra === void 0 ? void 0 : extra.of.label)
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import FormBuilder from '@digigov/form/FormBuilder';
|
|
3
3
|
import { Field } from '@digigov/form/Field';
|
|
4
4
|
import Button from '@digigov/ui/core/Button';
|
|
5
|
-
import { results } from '@digigov/ui/admin/AutoComplete/
|
|
5
|
+
import { results } from '@digigov/ui/admin/AutoComplete/utils';
|
|
6
6
|
var fields = [{
|
|
7
7
|
key: 'autocomplete',
|
|
8
8
|
label: {
|
package/esm/index.js
CHANGED
|
@@ -32,8 +32,11 @@ export var Checkboxes = function Checkboxes(_ref) {
|
|
|
32
32
|
newValue = value.filter(function (val) {
|
|
33
33
|
return val !== optionValue;
|
|
34
34
|
});
|
|
35
|
-
}
|
|
35
|
+
} // reset value to undefined instead of an empty array
|
|
36
|
+
// so the error state mechanism can throw validation errors
|
|
36
37
|
|
|
38
|
+
|
|
39
|
+
if (newValue.length === 0) newValue = undefined;
|
|
37
40
|
onChange(newValue);
|
|
38
41
|
};
|
|
39
42
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "4",
|
|
3
|
+
"stories": {
|
|
4
|
+
"digigov-form-inputs-select--default": {
|
|
5
|
+
"actionSets": [
|
|
6
|
+
{
|
|
7
|
+
"actions": [
|
|
8
|
+
{
|
|
9
|
+
"name": "selectHtmlOption",
|
|
10
|
+
"args": {
|
|
11
|
+
"selector": "html>body>div:nth-child(5)>form>div>label>select",
|
|
12
|
+
"values": "greece"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"id": "nGzokC6y1_5m",
|
|
17
|
+
"title": "select option"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -48,8 +48,11 @@ var Checkboxes = function Checkboxes(_ref) {
|
|
|
48
48
|
newValue = value.filter(function (val) {
|
|
49
49
|
return val !== optionValue;
|
|
50
50
|
});
|
|
51
|
-
}
|
|
51
|
+
} // reset value to undefined instead of an empty array
|
|
52
|
+
// so the error state mechanism can throw validation errors
|
|
52
53
|
|
|
54
|
+
|
|
55
|
+
if (newValue.length === 0) newValue = undefined;
|
|
53
56
|
onChange(newValue);
|
|
54
57
|
};
|
|
55
58
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "4",
|
|
3
|
+
"stories": {
|
|
4
|
+
"digigov-form-inputs-select--default": {
|
|
5
|
+
"actionSets": [
|
|
6
|
+
{
|
|
7
|
+
"actions": [
|
|
8
|
+
{
|
|
9
|
+
"name": "selectHtmlOption",
|
|
10
|
+
"args": {
|
|
11
|
+
"selector": "html>body>div:nth-child(5)>form>div>label>select",
|
|
12
|
+
"values": "greece"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"id": "nGzokC6y1_5m",
|
|
17
|
+
"title": "select option"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "@digigov form builder",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@hookform/resolvers": "2.9.6"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@digigov/ui": "0.
|
|
22
|
-
"@digigov/react-core": "0.
|
|
23
|
-
"@digigov/react-extensions": "0.
|
|
21
|
+
"@digigov/ui": "0.27.0",
|
|
22
|
+
"@digigov/react-core": "0.17.0",
|
|
23
|
+
"@digigov/react-extensions": "0.19.0",
|
|
24
24
|
"clsx": "1.1.1",
|
|
25
25
|
"react": "^16.8.0 || ^17.0.0",
|
|
26
26
|
"react-dom": "^16.8.0 || ^17.0.0"
|