@react-typed-forms/schemas 3.0.0-dev.82 → 3.0.0-dev.83
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"packages/schemas/.rush/temp/shrinkwrap-deps.json": "6ad43bbf71e5f191d9f571da269a25bb4d9e8909",
|
|
4
|
-
"packages/schemas/package.json": "
|
|
5
|
-
"packages/schemas/src/controlRender.tsx": "
|
|
4
|
+
"packages/schemas/package.json": "4849e807c422f7b462cccb4fc953e40198a08c8e",
|
|
5
|
+
"packages/schemas/src/controlRender.tsx": "b54a8e7ad36207ccd6684c30af2027789d9f806d",
|
|
6
6
|
"packages/schemas/src/hooks.ts": "a34545b7c63dc78ea77974f6c2fc386daaee80ea",
|
|
7
7
|
"packages/schemas/src/index.ts": "b15fbb6de132cd912cf8141d5c4d2329e947546e",
|
|
8
8
|
"packages/schemas/src/schemaBuilder.ts": "4662698fd46ac14459f429ce24d919ef91992de2",
|
package/lib/controlRender.js
CHANGED
|
@@ -150,11 +150,11 @@ function DataRenderer({ hooks, formState, controlDef, wrapElem, fieldData, }) {
|
|
|
150
150
|
const renderer = useFormRendererComponents();
|
|
151
151
|
const props = hooks.useDataProperties(formState, controlDef, fieldData);
|
|
152
152
|
const scalarControl = (_a = formState.data.fields[fieldData.field]) !== null && _a !== void 0 ? _a : (0, core_1.newControl)(undefined);
|
|
153
|
-
(0, core_1.
|
|
154
|
-
if (props.defaultValue && !
|
|
155
|
-
|
|
153
|
+
(0, core_1.useControlEffect)(() => scalarControl.value, (v) => {
|
|
154
|
+
if (props.defaultValue && !v) {
|
|
155
|
+
scalarControl.value = props.defaultValue;
|
|
156
156
|
}
|
|
157
|
-
},
|
|
157
|
+
}, true);
|
|
158
158
|
if (!props.visible) {
|
|
159
159
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
160
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-typed-forms/schemas",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.83",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"material-ui"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@react-typed-forms/core": "3.0.0-dev.
|
|
27
|
+
"@react-typed-forms/core": "3.0.0-dev.83"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/react": "^18.0.22",
|
package/schemas.build.log
CHANGED
package/src/controlRender.tsx
CHANGED
|
@@ -14,11 +14,10 @@ import {
|
|
|
14
14
|
} from "./types";
|
|
15
15
|
import React, { createContext, Key, ReactElement, useContext } from "react";
|
|
16
16
|
import {
|
|
17
|
-
AnyControl,
|
|
18
17
|
Control,
|
|
19
18
|
ControlChange,
|
|
20
19
|
newControl,
|
|
21
|
-
|
|
20
|
+
useControlEffect,
|
|
22
21
|
} from "@react-typed-forms/core";
|
|
23
22
|
|
|
24
23
|
export interface FormEditHooks {
|
|
@@ -331,15 +330,13 @@ function DataRenderer({
|
|
|
331
330
|
const props = hooks.useDataProperties(formState, controlDef, fieldData);
|
|
332
331
|
const scalarControl =
|
|
333
332
|
formState.data.fields[fieldData.field] ?? newControl(undefined);
|
|
334
|
-
|
|
335
|
-
scalarControl,
|
|
336
|
-
(
|
|
337
|
-
if (props.defaultValue && !
|
|
338
|
-
|
|
333
|
+
useControlEffect(
|
|
334
|
+
() => scalarControl.value,
|
|
335
|
+
(v) => {
|
|
336
|
+
if (props.defaultValue && !v) {
|
|
337
|
+
scalarControl.value = props.defaultValue;
|
|
339
338
|
}
|
|
340
339
|
},
|
|
341
|
-
ControlChange.Value,
|
|
342
|
-
[scalarControl, props.defaultValue],
|
|
343
340
|
true
|
|
344
341
|
);
|
|
345
342
|
if (!props.visible) {
|