@flowgram.ai/form-antd-materials 1.0.10 → 1.0.11
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/dist/esm/index.js +23 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/json-schema-editor/index.tsx +24 -2
package/dist/index.js
CHANGED
|
@@ -825,6 +825,7 @@ function TypeSelector(props) {
|
|
|
825
825
|
// src/components/json-schema-editor/index.tsx
|
|
826
826
|
var import_react11 = __toESM(require("react"));
|
|
827
827
|
var import_antd6 = require("antd");
|
|
828
|
+
var import_editor4 = require("@flowgram.ai/editor");
|
|
828
829
|
var import_icons3 = require("@ant-design/icons");
|
|
829
830
|
|
|
830
831
|
// src/components/json-schema-editor/styles.tsx
|
|
@@ -1328,7 +1329,25 @@ function BlurInput(props) {
|
|
|
1328
1329
|
}
|
|
1329
1330
|
|
|
1330
1331
|
// src/components/json-schema-editor/index.tsx
|
|
1331
|
-
|
|
1332
|
+
function getSchemaDefaultValue(schema) {
|
|
1333
|
+
switch (schema?.type) {
|
|
1334
|
+
case "string":
|
|
1335
|
+
return "";
|
|
1336
|
+
case "integer":
|
|
1337
|
+
case "number":
|
|
1338
|
+
return 0;
|
|
1339
|
+
case "boolean":
|
|
1340
|
+
return false;
|
|
1341
|
+
case "object":
|
|
1342
|
+
return "{}";
|
|
1343
|
+
case "array":
|
|
1344
|
+
return "[]";
|
|
1345
|
+
case "map":
|
|
1346
|
+
return "[]";
|
|
1347
|
+
default:
|
|
1348
|
+
return void 0;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1332
1351
|
function JsonSchemaEditor(props) {
|
|
1333
1352
|
const { value = { type: "object" }, config = {}, onChange: onChangeProps } = props;
|
|
1334
1353
|
const { propertyList, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(
|
|
@@ -1420,9 +1439,11 @@ function PropertyEdit(props) {
|
|
|
1420
1439
|
{
|
|
1421
1440
|
value: typeSelectorValue,
|
|
1422
1441
|
onChange: (_value) => {
|
|
1442
|
+
const nextTypeSchema = _value || {};
|
|
1423
1443
|
onChangeProps?.({
|
|
1424
1444
|
...value || {},
|
|
1425
|
-
...
|
|
1445
|
+
...nextTypeSchema,
|
|
1446
|
+
default: getSchemaDefaultValue(nextTypeSchema)
|
|
1426
1447
|
});
|
|
1427
1448
|
}
|
|
1428
1449
|
}
|