@react-typed-forms/schemas 16.0.1 → 16.0.2
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/lib/index.cjs +22 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +16 -6
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderForm.tsx +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-typed-forms/schemas",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"clsx": "^1 || ^2",
|
|
35
35
|
"uuid": "^10.0.0",
|
|
36
36
|
"jsonata": "^2.0.4",
|
|
37
|
-
"@astroapps/forms-core": "^1.0.
|
|
37
|
+
"@astroapps/forms-core": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.2.0 || ^19",
|
package/src/RenderForm.tsx
CHANGED
|
@@ -45,6 +45,7 @@ export interface RenderFormProps {
|
|
|
45
45
|
renderer: FormRenderer;
|
|
46
46
|
options?: ControlRenderOptions;
|
|
47
47
|
}
|
|
48
|
+
|
|
48
49
|
/* @trackControls */
|
|
49
50
|
export function RenderForm({
|
|
50
51
|
data,
|
|
@@ -56,7 +57,10 @@ export function RenderForm({
|
|
|
56
57
|
const [formState, setFormState] = useState(
|
|
57
58
|
() => options?.formState ?? createFormState(schemaInterface),
|
|
58
59
|
);
|
|
59
|
-
const
|
|
60
|
+
const effects: (() => void)[] = [];
|
|
61
|
+
const state = formState.getControlState(data, form, options, (cb) =>
|
|
62
|
+
effects.push(cb),
|
|
63
|
+
);
|
|
60
64
|
|
|
61
65
|
useEffect(() => {
|
|
62
66
|
if (!options?.formState) {
|
|
@@ -160,6 +164,7 @@ export function RenderForm({
|
|
|
160
164
|
parent ?? state.dataNode ?? data,
|
|
161
165
|
child,
|
|
162
166
|
childOptions,
|
|
167
|
+
(cb) => effects.push(cb),
|
|
163
168
|
);
|
|
164
169
|
},
|
|
165
170
|
runExpression: (scope, expr, returnResult) => {
|
|
@@ -169,6 +174,7 @@ export function RenderForm({
|
|
|
169
174
|
dataNode: data,
|
|
170
175
|
schemaInterface,
|
|
171
176
|
returnResult,
|
|
177
|
+
runAsync: (cb) => effects.push(cb),
|
|
172
178
|
});
|
|
173
179
|
}
|
|
174
180
|
},
|
|
@@ -182,7 +188,14 @@ export function RenderForm({
|
|
|
182
188
|
const renderedControl = renderer.renderLayout(
|
|
183
189
|
options.adjustLayout?.(dataContext, layoutProps) ?? layoutProps,
|
|
184
190
|
);
|
|
185
|
-
|
|
191
|
+
const rendered = renderer.renderVisibility({
|
|
192
|
+
visibility,
|
|
193
|
+
...renderedControl,
|
|
194
|
+
});
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
effects.forEach((cb) => cb());
|
|
197
|
+
}, [effects]);
|
|
198
|
+
return rendered;
|
|
186
199
|
}
|
|
187
200
|
|
|
188
201
|
/**
|