@gravity-ui/dynamic-forms 1.9.2 → 1.11.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.
|
@@ -29,18 +29,17 @@ const useField = ({ name, spec, initialValue, value: externalValue, validate: pr
|
|
|
29
29
|
}
|
|
30
30
|
const error = validate === null || validate === void 0 ? void 0 : validate(value);
|
|
31
31
|
const dirty = !lodash_1.default.isEqual(value, initialValue);
|
|
32
|
-
const pristine = value === initialValue;
|
|
33
32
|
return {
|
|
34
33
|
active: false,
|
|
35
34
|
dirty,
|
|
36
35
|
error,
|
|
37
36
|
invalid: Boolean(error),
|
|
38
|
-
modified: dirty
|
|
39
|
-
pristine,
|
|
40
|
-
touched:
|
|
37
|
+
modified: dirty,
|
|
38
|
+
pristine: true,
|
|
39
|
+
touched: false,
|
|
41
40
|
valid: !error,
|
|
42
41
|
value,
|
|
43
|
-
visited:
|
|
42
|
+
visited: false,
|
|
44
43
|
childErrors: {},
|
|
45
44
|
};
|
|
46
45
|
});
|
|
@@ -69,7 +68,7 @@ const useField = ({ name, spec, initialValue, value: externalValue, validate: pr
|
|
|
69
68
|
(externalParentOnUnmount ? externalParentOnUnmount : tools.onUnmount)(name);
|
|
70
69
|
}
|
|
71
70
|
else {
|
|
72
|
-
onChange(undefined);
|
|
71
|
+
onChange(undefined, { [name]: false });
|
|
73
72
|
}
|
|
74
73
|
};
|
|
75
74
|
return { onChange, onDrop };
|
|
@@ -25,18 +25,17 @@ export const useField = ({ name, spec, initialValue, value: externalValue, valid
|
|
|
25
25
|
}
|
|
26
26
|
const error = validate === null || validate === void 0 ? void 0 : validate(value);
|
|
27
27
|
const dirty = !_.isEqual(value, initialValue);
|
|
28
|
-
const pristine = value === initialValue;
|
|
29
28
|
return {
|
|
30
29
|
active: false,
|
|
31
30
|
dirty,
|
|
32
31
|
error,
|
|
33
32
|
invalid: Boolean(error),
|
|
34
|
-
modified: dirty
|
|
35
|
-
pristine,
|
|
36
|
-
touched:
|
|
33
|
+
modified: dirty,
|
|
34
|
+
pristine: true,
|
|
35
|
+
touched: false,
|
|
37
36
|
valid: !error,
|
|
38
37
|
value,
|
|
39
|
-
visited:
|
|
38
|
+
visited: false,
|
|
40
39
|
childErrors: {},
|
|
41
40
|
};
|
|
42
41
|
});
|
|
@@ -65,7 +64,7 @@ export const useField = ({ name, spec, initialValue, value: externalValue, valid
|
|
|
65
64
|
(externalParentOnUnmount ? externalParentOnUnmount : tools.onUnmount)(name);
|
|
66
65
|
}
|
|
67
66
|
else {
|
|
68
|
-
onChange(undefined);
|
|
67
|
+
onChange(undefined, { [name]: false });
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
return { onChange, onDrop };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/dynamic-forms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "jest",
|
|
32
32
|
"typecheck": "tsc --noEmit",
|
|
33
33
|
"build": "gulp",
|
|
34
|
-
"build-storybook": "build
|
|
35
|
-
"dev": "
|
|
36
|
-
"start": "
|
|
34
|
+
"build-storybook": "sb build",
|
|
35
|
+
"dev": "sb dev -p 6006",
|
|
36
|
+
"start": "sb dev",
|
|
37
37
|
"prepublishOnly": "npm run build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -52,9 +52,10 @@
|
|
|
52
52
|
"@gravity-ui/stylelint-config": "^2.0.0",
|
|
53
53
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
54
54
|
"@gravity-ui/uikit": "^4.10.0",
|
|
55
|
-
"@storybook/addon-essentials": "^
|
|
55
|
+
"@storybook/addon-essentials": "^7.0.27",
|
|
56
56
|
"@storybook/preset-scss": "^1.0.3",
|
|
57
|
-
"@storybook/react": "^
|
|
57
|
+
"@storybook/react": "^7.0.27",
|
|
58
|
+
"@storybook/react-webpack5": "^7.0.27",
|
|
58
59
|
"@testing-library/jest-dom": "^5.16.5",
|
|
59
60
|
"@testing-library/react": "^14.0.0",
|
|
60
61
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"rimraf": "^4.1.2",
|
|
89
90
|
"sass": "^1.57.1",
|
|
90
91
|
"sass-loader": "^10.1.1",
|
|
92
|
+
"storybook": "^7.0.27",
|
|
91
93
|
"style-loader": "^2.0.0",
|
|
92
94
|
"stylelint": "^14.15.0",
|
|
93
95
|
"stylelint-scss": "^4.2.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [1.9.2](https://github.com/gravity-ui/dynamic-forms/compare/v1.9.1...v1.9.2) (2023-06-13)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Bug Fixes
|
|
7
|
-
|
|
8
|
-
* fix oneof and view layouts styles ([#62](https://github.com/gravity-ui/dynamic-forms/issues/62)) ([06794e2](https://github.com/gravity-ui/dynamic-forms/commit/06794e2a1891d9f630cb7a7820890f49f0bfcba1))
|
|
9
|
-
|
|
10
|
-
## [1.9.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.9.0...v1.9.1) (2023-06-07)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* fixed styles for transperant and toggler oneof ([#60](https://github.com/gravity-ui/dynamic-forms/issues/60)) ([64ca12a](https://github.com/gravity-ui/dynamic-forms/commit/64ca12ad87ffd50fdda24901cd8f2e70e8c03868))
|
|
16
|
-
|
|
17
|
-
## [1.9.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.8.1...v1.9.0) (2023-06-07)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* add ability to disable final-form insertion delay ([#56](https://github.com/gravity-ui/dynamic-forms/issues/56)) ([4df2b00](https://github.com/gravity-ui/dynamic-forms/commit/4df2b00c5b07bdacbbd399acdb5cf01af5521dbc))
|
|
23
|
-
* add copy button for view layouts ([#59](https://github.com/gravity-ui/dynamic-forms/issues/59)) ([c31fcbf](https://github.com/gravity-ui/dynamic-forms/commit/c31fcbfe0da0ba369cd16595b2cb9190ac4498f0))
|
|
24
|
-
* add store and entity unmount callbacks ([#55](https://github.com/gravity-ui/dynamic-forms/issues/55)) ([8f7c4c6](https://github.com/gravity-ui/dynamic-forms/commit/8f7c4c6a624941e10c624dc3098e4e601639d25e))
|
|
25
|
-
|
|
26
|
-
## [1.8.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.8.0...v1.8.1) (2023-05-30)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Bug Fixes
|
|
30
|
-
|
|
31
|
-
* fixed deleting numbers from arrays ([#50](https://github.com/gravity-ui/dynamic-forms/issues/50)) ([76fba69](https://github.com/gravity-ui/dynamic-forms/commit/76fba69c47e016fb806d5d2d06fa367f4672c524))
|
|
32
|
-
|
|
33
|
-
## [1.8.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.7.1...v1.8.0) (2023-05-25)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Features
|
|
37
|
-
|
|
38
|
-
* **Switch:** added new input switch ([#48](https://github.com/gravity-ui/dynamic-forms/issues/48)) ([47e2f51](https://github.com/gravity-ui/dynamic-forms/commit/47e2f51dcda0579b00f6fadc3008d2e78a2f47e7))
|
|
39
|
-
|
|
40
|
-
## [1.7.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.7.0...v1.7.1) (2023-05-22)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Bug Fixes
|
|
44
|
-
|
|
45
|
-
* **OneOf:** fixed styles in inputs and view ([#46](https://github.com/gravity-ui/dynamic-forms/issues/46)) ([e7a824d](https://github.com/gravity-ui/dynamic-forms/commit/e7a824d4fec537ebef10f96049279bfc7a759f3b))
|
|
46
|
-
|
|
47
|
-
## [1.7.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.6.2...v1.7.0) (2023-05-22)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Features
|
|
51
|
-
|
|
52
|
-
* add flat oneof input, add oneof params to object spec ([#44](https://github.com/gravity-ui/dynamic-forms/issues/44)) ([25e9a35](https://github.com/gravity-ui/dynamic-forms/commit/25e9a3588b359cc251e5fdc19a1b51c5a614abb8))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Bug Fixes
|
|
56
|
-
|
|
57
|
-
* initial value ([#39](https://github.com/gravity-ui/dynamic-forms/issues/39)) ([ce52d65](https://github.com/gravity-ui/dynamic-forms/commit/ce52d6531b8dbabd3462dfd430b947b99e00b433))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Performance Improvements
|
|
61
|
-
|
|
62
|
-
* remove strict mode wrapper and react version check ([#43](https://github.com/gravity-ui/dynamic-forms/issues/43)) ([ec823bf](https://github.com/gravity-ui/dynamic-forms/commit/ec823bf56d4bec192649b8cd2c3da16def094bfb))
|
|
63
|
-
|
|
64
|
-
## [1.6.2](https://github.com/gravity-ui/dynamic-forms/compare/v1.6.1...v1.6.2) (2023-05-16)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* add css rule for errors ([#41](https://github.com/gravity-ui/dynamic-forms/issues/41)) ([a6661bc](https://github.com/gravity-ui/dynamic-forms/commit/a6661bcd3a86a29ec3b457bccbf6d8f46aaf0408))
|
|
70
|
-
* add number value transform ([#40](https://github.com/gravity-ui/dynamic-forms/issues/40)) ([d422d90](https://github.com/gravity-ui/dynamic-forms/commit/d422d901e675c6f7014a07f9bfae972fcd555b76))
|
|
71
|
-
|
|
72
|
-
## [1.6.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.6.0...v1.6.1) (2023-05-02)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Bug Fixes
|
|
76
|
-
|
|
77
|
-
* object inputs layout child ([#37](https://github.com/gravity-ui/dynamic-forms/issues/37)) ([821398e](https://github.com/gravity-ui/dynamic-forms/commit/821398eee3b19b590f6177896fc038ecd9bdd0df))
|
|
78
|
-
|
|
79
|
-
## [1.6.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.5.0...v1.6.0) (2023-04-28)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Features
|
|
83
|
-
|
|
84
|
-
* adapt useStore and useField with 18 react ([#31](https://github.com/gravity-ui/dynamic-forms/issues/31)) ([d64ae4a](https://github.com/gravity-ui/dynamic-forms/commit/d64ae4a1b3f9f2e8b02288c1088679b5c848f738))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Bug Fixes
|
|
88
|
-
|
|
89
|
-
* fixed display for accordeon layoutDescription ([#34](https://github.com/gravity-ui/dynamic-forms/issues/34)) ([fa58210](https://github.com/gravity-ui/dynamic-forms/commit/fa58210239df31911f3865262a4d33bd653e1b01))
|
|
90
|
-
* fixed display for one of ([#33](https://github.com/gravity-ui/dynamic-forms/issues/33)) ([823c8fc](https://github.com/gravity-ui/dynamic-forms/commit/823c8fceddcb9a7e0cf021c1b122470cf58db4df))
|
|
91
|
-
|
|
92
|
-
## [1.5.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.4.1...v1.5.0) (2023-04-18)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Features
|
|
96
|
-
|
|
97
|
-
* **ObjectValue:** added new input object value ([#28](https://github.com/gravity-ui/dynamic-forms/issues/28)) ([67214a1](https://github.com/gravity-ui/dynamic-forms/commit/67214a13f5ed67dd46071caf0d0ad0bee1a4d071))
|
|
98
|
-
|
|
99
|
-
## [1.4.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.4.0...v1.4.1) (2023-04-13)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
### Bug Fixes
|
|
103
|
-
|
|
104
|
-
* **GroupIndent:** fixed styles ([#26](https://github.com/gravity-ui/dynamic-forms/issues/26)) ([ca3e845](https://github.com/gravity-ui/dynamic-forms/commit/ca3e845169c8f68036744fba13de79879421a806))
|
|
105
|
-
|
|
106
|
-
## [1.4.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.3.0...v1.4.0) (2023-04-11)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### Features
|
|
110
|
-
|
|
111
|
-
* **FileInput:** added new input file input ([#24](https://github.com/gravity-ui/dynamic-forms/issues/24)) ([1553318](https://github.com/gravity-ui/dynamic-forms/commit/155331839e50ab4192b69ba32992e37b972378c4))
|
|
112
|
-
|
|
113
|
-
## [1.3.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.2.0...v1.3.0) (2023-03-31)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Features
|
|
117
|
-
|
|
118
|
-
* update row note position ([#20](https://github.com/gravity-ui/dynamic-forms/issues/20)) ([4f15395](https://github.com/gravity-ui/dynamic-forms/commit/4f153959596d3325ddeb2c2e9b24382e36d2db75))
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
### Bug Fixes
|
|
122
|
-
|
|
123
|
-
* add fixes + tests ([#15](https://github.com/gravity-ui/dynamic-forms/issues/15)) ([80113dd](https://github.com/gravity-ui/dynamic-forms/commit/80113dd05737b18158865506ed3ac8479d69e8d0))
|
|
124
|
-
* **search:** fixed bug related to form blinking ([#21](https://github.com/gravity-ui/dynamic-forms/issues/21)) ([20bab2f](https://github.com/gravity-ui/dynamic-forms/commit/20bab2f628d698714bcee35993583f2c7712e843))
|
|
125
|
-
* **textArea:** fixed row for text area ([#22](https://github.com/gravity-ui/dynamic-forms/issues/22)) ([d5469e7](https://github.com/gravity-ui/dynamic-forms/commit/d5469e7dd0eee86b26e8daba94e93d2fa9465b96))
|
|
126
|
-
|
|
127
|
-
## [1.2.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.1.1...v1.2.0) (2023-03-23)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### Features
|
|
131
|
-
|
|
132
|
-
* search ([#10](https://github.com/gravity-ui/dynamic-forms/issues/10)) ([4ed7d5c](https://github.com/gravity-ui/dynamic-forms/commit/4ed7d5c85dbb890f4c8148d4de43a626917cec0f))
|
|
133
|
-
|
|
134
|
-
## [1.1.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.1.0...v1.1.1) (2023-03-21)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
### Bug Fixes
|
|
138
|
-
|
|
139
|
-
* fix incorrect unmount ([#12](https://github.com/gravity-ui/dynamic-forms/issues/12)) ([592652b](https://github.com/gravity-ui/dynamic-forms/commit/592652b2814567b2188ec43779eb591b7dec6ade))
|
|
140
|
-
|
|
141
|
-
## [1.1.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.0.2...v1.1.0) (2023-03-19)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### Features
|
|
145
|
-
|
|
146
|
-
* add `row_verbose` layout ([#7](https://github.com/gravity-ui/dynamic-forms/issues/7)) ([a3030e1](https://github.com/gravity-ui/dynamic-forms/commit/a3030e105708c41211339d8ddd0b21e0b16cebfa))
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### Bug Fixes
|
|
150
|
-
|
|
151
|
-
* fix store errors ([#11](https://github.com/gravity-ui/dynamic-forms/issues/11)) ([3ed0d8e](https://github.com/gravity-ui/dynamic-forms/commit/3ed0d8e7cb4faefad351c5551b48461e7f6fd529))
|
|
152
|
-
|
|
153
|
-
## [1.0.2](https://github.com/gravity-ui/dynamic-forms/compare/v1.0.1...v1.0.2) (2023-03-15)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Bug Fixes
|
|
157
|
-
|
|
158
|
-
* updated package.json ([#5](https://github.com/gravity-ui/dynamic-forms/issues/5)) ([233053d](https://github.com/gravity-ui/dynamic-forms/commit/233053dbdef63a2416f3abd442dcda9cdd0ff3de))
|
|
159
|
-
|
|
160
|
-
## [1.0.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.0.0...v1.0.1) (2023-03-14)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
### Bug Fixes
|
|
164
|
-
|
|
165
|
-
* added prepublishOnly ([#3](https://github.com/gravity-ui/dynamic-forms/issues/3)) ([0ed29ca](https://github.com/gravity-ui/dynamic-forms/commit/0ed29ca7eb2d5cb4350f1f191b30c7d1bbed6ed8))
|
|
166
|
-
|
|
167
|
-
## 1.0.0 (2023-03-14)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
### Features
|
|
171
|
-
|
|
172
|
-
* code migration ([#1](https://github.com/gravity-ui/dynamic-forms/issues/1)) ([41d30e4](https://github.com/gravity-ui/dynamic-forms/commit/41d30e4d1d43ffc0555fe2b671d638a520c317b7))
|