@dxos/react-ui-form 0.8.2-main.5885341 → 0.8.2-main.5ca3450
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/lib/browser/index.mjs +83 -49
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +210 -177
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +83 -49
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +3 -2
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +33 -32
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts +2 -2
- package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
- package/dist/types/src/components/Form/Input.d.ts.map +1 -1
- package/dist/types/src/components/Form/RefField.d.ts +3 -2
- package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/factory.d.ts.map +1 -1
- package/dist/types/src/components/Form/index.d.ts +1 -0
- package/dist/types/src/components/Form/index.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.d.ts +2 -2
- package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/FormInput.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useForm.d.ts +2 -2
- package/dist/types/src/hooks/useForm.d.ts.map +1 -1
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +8 -0
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +1 -0
- package/dist/types/src/util/field.d.ts.map +1 -1
- package/dist/types/src/util/formatting.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/src/components/Form/ArrayField.tsx +5 -6
- package/src/components/Form/Defaults.tsx +4 -1
- package/src/components/Form/Form.stories.tsx +46 -41
- package/src/components/Form/Form.tsx +3 -2
- package/src/components/Form/FormContent.tsx +5 -6
- package/src/components/Form/RefField.tsx +2 -2
- package/src/components/Form/custom/SelectOptionsInput.stories.tsx +5 -4
- package/src/components/Form/index.ts +1 -1
- package/src/components/ViewEditor/ViewEditor.stories.tsx +3 -2
- package/src/components/ViewEditor/ViewEditor.tsx +9 -8
- package/src/components/deprecated/Form.tsx +6 -6
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useForm.ts +3 -3
- package/src/hooks/useRefQueryLookupHandler.ts +43 -0
|
@@ -181,7 +181,7 @@ var ControlFrameItem = ({ title, description, children }) => {
|
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
|
|
184
|
-
import React14, { useCallback as
|
|
184
|
+
import React14, { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useState as useState5 } from "react";
|
|
185
185
|
import { FormatEnum as FormatEnum2, FormatEnums, formatToType } from "@dxos/echo-schema";
|
|
186
186
|
import { log as log3 } from "@dxos/log";
|
|
187
187
|
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
@@ -546,23 +546,28 @@ var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, on
|
|
|
546
546
|
};
|
|
547
547
|
var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
|
|
548
548
|
const { status, error } = getStatus();
|
|
549
|
+
const value = getValue3();
|
|
550
|
+
const handleValueChange = useCallback3((value2) => onValueChange(type, value2), [
|
|
551
|
+
type,
|
|
552
|
+
onValueChange
|
|
553
|
+
]);
|
|
549
554
|
return /* @__PURE__ */ React7.createElement(Input6.Root, {
|
|
550
555
|
validationValence: status
|
|
551
556
|
}, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
|
|
552
557
|
error
|
|
553
558
|
}, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Select.Root, {
|
|
554
|
-
value
|
|
555
|
-
onValueChange:
|
|
559
|
+
value,
|
|
560
|
+
onValueChange: handleValueChange
|
|
556
561
|
}, /* @__PURE__ */ React7.createElement(Select.TriggerButton, {
|
|
557
562
|
classNames: "is-full",
|
|
558
563
|
disabled,
|
|
559
564
|
placeholder
|
|
560
|
-
}), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value, label: label2 }) => (
|
|
565
|
+
}), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value: value2, label: label2 }) => (
|
|
561
566
|
// NOTE: Numeric values are converted to and from strings.
|
|
562
567
|
/* @__PURE__ */ React7.createElement(Select.Option, {
|
|
563
|
-
key: String(
|
|
564
|
-
value: String(
|
|
565
|
-
}, label2 ?? String(
|
|
568
|
+
key: String(value2),
|
|
569
|
+
value: String(value2)
|
|
570
|
+
}, label2 ?? String(value2))
|
|
566
571
|
)))))), inputOnly && /* @__PURE__ */ React7.createElement(Input6.DescriptionAndValidation, null, error));
|
|
567
572
|
};
|
|
568
573
|
var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
@@ -621,7 +626,7 @@ import { getValue as getValue2 } from "@dxos/echo-schema";
|
|
|
621
626
|
import { createJsonPath as createJsonPath2 } from "@dxos/effect";
|
|
622
627
|
|
|
623
628
|
// packages/ui/react-ui-form/src/hooks/useForm.ts
|
|
624
|
-
import { SchemaAST
|
|
629
|
+
import { SchemaAST } from "effect";
|
|
625
630
|
import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo2, useState as useState3 } from "react";
|
|
626
631
|
import { getValue, setValue } from "@dxos/echo-schema";
|
|
627
632
|
import { createJsonPath, fromEffectValidationPath } from "@dxos/effect";
|
|
@@ -630,12 +635,12 @@ import { log } from "@dxos/log";
|
|
|
630
635
|
import { validateSchema } from "@dxos/schema";
|
|
631
636
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
|
|
632
637
|
var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
|
|
633
|
-
invariant(
|
|
638
|
+
invariant(SchemaAST.isTypeLiteral(schema.ast), void 0, {
|
|
634
639
|
F: __dxlog_file,
|
|
635
640
|
L: 93,
|
|
636
641
|
S: void 0,
|
|
637
642
|
A: [
|
|
638
|
-
"
|
|
643
|
+
"SchemaAST.isTypeLiteral(schema.ast)",
|
|
639
644
|
""
|
|
640
645
|
]
|
|
641
646
|
});
|
|
@@ -829,6 +834,35 @@ var flatMap = (errors) => {
|
|
|
829
834
|
}, {});
|
|
830
835
|
};
|
|
831
836
|
|
|
837
|
+
// packages/ui/react-ui-form/src/hooks/useRefQueryLookupHandler.ts
|
|
838
|
+
import { useCallback as useCallback5 } from "react";
|
|
839
|
+
import { getDXN } from "@dxos/echo-schema";
|
|
840
|
+
import { Filter } from "@dxos/react-client/echo";
|
|
841
|
+
import { isNonNullable } from "@dxos/util";
|
|
842
|
+
var useRefQueryLookupHandler = ({ space }) => {
|
|
843
|
+
const handleRefQueryLookup = useCallback5(async (typeInfo) => {
|
|
844
|
+
if (!space) {
|
|
845
|
+
return [];
|
|
846
|
+
}
|
|
847
|
+
const query = space.db.query(Filter.typename(typeInfo.typename));
|
|
848
|
+
const { objects } = await query.run();
|
|
849
|
+
return objects.map((object) => {
|
|
850
|
+
const dxn = getDXN(object);
|
|
851
|
+
if (!dxn) {
|
|
852
|
+
return void 0;
|
|
853
|
+
}
|
|
854
|
+
const item = {
|
|
855
|
+
dxn,
|
|
856
|
+
label: object?.name ?? object?.id ?? ""
|
|
857
|
+
};
|
|
858
|
+
return item;
|
|
859
|
+
}).filter(isNonNullable);
|
|
860
|
+
}, [
|
|
861
|
+
space
|
|
862
|
+
]);
|
|
863
|
+
return handleRefQueryLookup;
|
|
864
|
+
};
|
|
865
|
+
|
|
832
866
|
// packages/ui/react-ui-form/src/components/Form/FormContext.tsx
|
|
833
867
|
var FormContext = /* @__PURE__ */ createContext(void 0);
|
|
834
868
|
var useFormContext = () => {
|
|
@@ -920,20 +954,18 @@ var FormActions = ({ onCancel, readonly }) => {
|
|
|
920
954
|
};
|
|
921
955
|
|
|
922
956
|
// packages/ui/react-ui-form/src/components/Form/FormContent.tsx
|
|
923
|
-
import { pipe as pipe2 } from "effect";
|
|
957
|
+
import { Schema, SchemaAST as SchemaAST3, pipe as pipe2 } from "effect";
|
|
924
958
|
import { capitalize as capitalize2 } from "effect/String";
|
|
925
959
|
import React12, { useMemo as useMemo5 } from "react";
|
|
926
|
-
import { AST as AST3, S } from "@dxos/echo-schema";
|
|
927
960
|
import { createJsonPath as createJsonPath3, findNode as findNode2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
|
|
928
961
|
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
929
962
|
import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
|
|
930
963
|
import { isNotFalsy } from "@dxos/util";
|
|
931
964
|
|
|
932
965
|
// packages/ui/react-ui-form/src/components/Form/ArrayField.tsx
|
|
933
|
-
import { pipe } from "effect";
|
|
966
|
+
import { SchemaAST as SchemaAST2, pipe } from "effect";
|
|
934
967
|
import { capitalize } from "effect/String";
|
|
935
|
-
import React10, { useCallback as
|
|
936
|
-
import { AST as AST2 } from "@dxos/echo-schema";
|
|
968
|
+
import React10, { useCallback as useCallback6, useMemo as useMemo4 } from "react";
|
|
937
969
|
import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
|
|
938
970
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
939
971
|
import { IconButton as IconButton3, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
@@ -947,7 +979,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
947
979
|
const values = useFormValues(path ?? []) ?? [];
|
|
948
980
|
invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
|
|
949
981
|
F: __dxlog_file2,
|
|
950
|
-
L:
|
|
982
|
+
L: 38,
|
|
951
983
|
S: void 0,
|
|
952
984
|
A: [
|
|
953
985
|
"Array.isArray(values)",
|
|
@@ -955,11 +987,11 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
955
987
|
]
|
|
956
988
|
});
|
|
957
989
|
const label = title ?? pipe(name, capitalize);
|
|
958
|
-
const tupleType = findNode(ast,
|
|
990
|
+
const tupleType = findNode(ast, SchemaAST2.isTupleType);
|
|
959
991
|
const elementType = tupleType?.rest[0]?.type;
|
|
960
992
|
const getDefaultObjectValue = (typeNode) => {
|
|
961
993
|
const baseNode = findNode(typeNode, isDiscriminatedUnion);
|
|
962
|
-
const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode,
|
|
994
|
+
const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode, SchemaAST2.isTypeLiteral);
|
|
963
995
|
if (!typeLiteral) {
|
|
964
996
|
return {};
|
|
965
997
|
}
|
|
@@ -978,7 +1010,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
978
1010
|
type,
|
|
979
1011
|
elementType
|
|
980
1012
|
]);
|
|
981
|
-
const handleAdd =
|
|
1013
|
+
const handleAdd = useCallback6(() => {
|
|
982
1014
|
inputProps.onValueChange(type, [
|
|
983
1015
|
...values,
|
|
984
1016
|
newValue
|
|
@@ -990,7 +1022,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
990
1022
|
newValue,
|
|
991
1023
|
values
|
|
992
1024
|
]);
|
|
993
|
-
const handleRemove =
|
|
1025
|
+
const handleRemove = useCallback6((index) => {
|
|
994
1026
|
const newValues = values.filter((_, i) => i !== index);
|
|
995
1027
|
inputProps.onValueChange(type, newValues);
|
|
996
1028
|
}, [
|
|
@@ -1179,7 +1211,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1179
1211
|
]);
|
|
1180
1212
|
const FoundComponent = lookupComponent?.({
|
|
1181
1213
|
prop: name,
|
|
1182
|
-
schema:
|
|
1214
|
+
schema: Schema.make(ast),
|
|
1183
1215
|
inputProps: {
|
|
1184
1216
|
type,
|
|
1185
1217
|
format,
|
|
@@ -1261,14 +1293,14 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1261
1293
|
}
|
|
1262
1294
|
if (type === "object") {
|
|
1263
1295
|
const baseNode = findNode2(ast, isDiscriminatedUnion2);
|
|
1264
|
-
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast,
|
|
1296
|
+
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast, SchemaAST3.isTypeLiteral);
|
|
1265
1297
|
if (typeLiteral) {
|
|
1266
1298
|
return /* @__PURE__ */ React12.createElement("div", {
|
|
1267
1299
|
role: "none"
|
|
1268
1300
|
}, !inline && /* @__PURE__ */ React12.createElement("h3", {
|
|
1269
1301
|
className: "text-lg mbs-2 mbe-1"
|
|
1270
1302
|
}, label), /* @__PURE__ */ React12.createElement(FormFields, {
|
|
1271
|
-
schema:
|
|
1303
|
+
schema: Schema.make(typeLiteral),
|
|
1272
1304
|
path,
|
|
1273
1305
|
readonly,
|
|
1274
1306
|
onQueryRefOptions,
|
|
@@ -1394,7 +1426,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1394
1426
|
const [{ fieldSchema }, setFieldSchema] = useState5({
|
|
1395
1427
|
fieldSchema: getFormatSchema(props?.format)
|
|
1396
1428
|
});
|
|
1397
|
-
const handleValuesChanged =
|
|
1429
|
+
const handleValuesChanged = useCallback7((_props) => {
|
|
1398
1430
|
setFieldSchema((prev) => {
|
|
1399
1431
|
const fieldSchema2 = getFormatSchema(_props.format);
|
|
1400
1432
|
if (prev.fieldSchema === fieldSchema2) {
|
|
@@ -1429,7 +1461,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1429
1461
|
props.format,
|
|
1430
1462
|
props.referenceSchema
|
|
1431
1463
|
]);
|
|
1432
|
-
const handleValidate =
|
|
1464
|
+
const handleValidate = useCallback7(({ property }) => {
|
|
1433
1465
|
if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
|
|
1434
1466
|
return [
|
|
1435
1467
|
{
|
|
@@ -1442,7 +1474,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1442
1474
|
view.fields,
|
|
1443
1475
|
field
|
|
1444
1476
|
]);
|
|
1445
|
-
const handleSave =
|
|
1477
|
+
const handleSave = useCallback7((props2) => {
|
|
1446
1478
|
projection.setFieldProjection({
|
|
1447
1479
|
field,
|
|
1448
1480
|
props: props2
|
|
@@ -1453,7 +1485,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1453
1485
|
field,
|
|
1454
1486
|
onSave
|
|
1455
1487
|
]);
|
|
1456
|
-
const handleCancel =
|
|
1488
|
+
const handleCancel = useCallback7(() => {
|
|
1457
1489
|
requestAnimationFrame(() => onCancel?.());
|
|
1458
1490
|
onSave();
|
|
1459
1491
|
}, [
|
|
@@ -1485,7 +1517,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1485
1517
|
schemas,
|
|
1486
1518
|
referenceSchema
|
|
1487
1519
|
]);
|
|
1488
|
-
const propIsNotType =
|
|
1520
|
+
const propIsNotType = useCallback7((props2) => props2.filter((p) => p.name !== "type"), []);
|
|
1489
1521
|
if (!fieldSchema) {
|
|
1490
1522
|
log3.warn("invalid format", {
|
|
1491
1523
|
props
|
|
@@ -1516,8 +1548,9 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1516
1548
|
};
|
|
1517
1549
|
|
|
1518
1550
|
// packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
|
|
1519
|
-
import
|
|
1520
|
-
import {
|
|
1551
|
+
import { Schema as Schema2, SchemaAST as SchemaAST4 } from "effect";
|
|
1552
|
+
import React15, { useCallback as useCallback8, useMemo as useMemo8, useState as useState6 } from "react";
|
|
1553
|
+
import { Format } from "@dxos/echo-schema";
|
|
1521
1554
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1522
1555
|
import { IconButton as IconButton4, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1523
1556
|
import { List as List2 } from "@dxos/react-ui-list";
|
|
@@ -1525,14 +1558,14 @@ import { ghostHover, inputTextLabel, mx as mx9 } from "@dxos/react-ui-theme";
|
|
|
1525
1558
|
import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
|
|
1526
1559
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
1527
1560
|
var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
|
|
1528
|
-
var ViewMetaSchema =
|
|
1529
|
-
name:
|
|
1530
|
-
[
|
|
1561
|
+
var ViewMetaSchema = Schema2.Struct({
|
|
1562
|
+
name: Schema2.String.annotations({
|
|
1563
|
+
[SchemaAST4.TitleAnnotationId]: "View"
|
|
1531
1564
|
}),
|
|
1532
1565
|
typename: Format.URL.annotations({
|
|
1533
|
-
[
|
|
1566
|
+
[SchemaAST4.TitleAnnotationId]: "Typename"
|
|
1534
1567
|
})
|
|
1535
|
-
}).pipe(
|
|
1568
|
+
}).pipe(Schema2.mutable);
|
|
1536
1569
|
var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading = false, onTypenameChanged, onDelete }) => {
|
|
1537
1570
|
const { t } = useTranslation7(translationKey);
|
|
1538
1571
|
const projection = useMemo8(() => new ViewProjection(schema.jsonSchema, view), [
|
|
@@ -1550,13 +1583,13 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1550
1583
|
}, [
|
|
1551
1584
|
view
|
|
1552
1585
|
]);
|
|
1553
|
-
const handleSelect =
|
|
1586
|
+
const handleSelect = useCallback8((field2) => {
|
|
1554
1587
|
setField((f) => f === field2 ? void 0 : field2);
|
|
1555
1588
|
}, []);
|
|
1556
|
-
const handleAdd =
|
|
1589
|
+
const handleAdd = useCallback8(() => {
|
|
1557
1590
|
invariant3(!schema.readonly, void 0, {
|
|
1558
1591
|
F: __dxlog_file5,
|
|
1559
|
-
L:
|
|
1592
|
+
L: 77,
|
|
1560
1593
|
S: void 0,
|
|
1561
1594
|
A: [
|
|
1562
1595
|
"!schema.readonly",
|
|
@@ -1569,10 +1602,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1569
1602
|
schema,
|
|
1570
1603
|
view
|
|
1571
1604
|
]);
|
|
1572
|
-
const handleUpdate =
|
|
1605
|
+
const handleUpdate = useCallback8(({ name, typename }) => {
|
|
1573
1606
|
invariant3(!schema.readonly, void 0, {
|
|
1574
1607
|
F: __dxlog_file5,
|
|
1575
|
-
L:
|
|
1608
|
+
L: 84,
|
|
1576
1609
|
S: void 0,
|
|
1577
1610
|
A: [
|
|
1578
1611
|
"!schema.readonly",
|
|
@@ -1592,10 +1625,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1592
1625
|
view,
|
|
1593
1626
|
onTypenameChanged
|
|
1594
1627
|
]);
|
|
1595
|
-
const handleDelete =
|
|
1628
|
+
const handleDelete = useCallback8((fieldId) => {
|
|
1596
1629
|
invariant3(!schema.readonly, void 0, {
|
|
1597
1630
|
F: __dxlog_file5,
|
|
1598
|
-
L:
|
|
1631
|
+
L: 100,
|
|
1599
1632
|
S: void 0,
|
|
1600
1633
|
A: [
|
|
1601
1634
|
"!schema.readonly",
|
|
@@ -1611,10 +1644,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1611
1644
|
field,
|
|
1612
1645
|
onDelete
|
|
1613
1646
|
]);
|
|
1614
|
-
const handleMove =
|
|
1647
|
+
const handleMove = useCallback8((fromIndex, toIndex) => {
|
|
1615
1648
|
invariant3(!schema.readonly, void 0, {
|
|
1616
1649
|
F: __dxlog_file5,
|
|
1617
|
-
L:
|
|
1650
|
+
L: 112,
|
|
1618
1651
|
S: void 0,
|
|
1619
1652
|
A: [
|
|
1620
1653
|
"!schema.readonly",
|
|
@@ -1631,15 +1664,15 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1631
1664
|
schema,
|
|
1632
1665
|
view.fields
|
|
1633
1666
|
]);
|
|
1634
|
-
const handleClose =
|
|
1667
|
+
const handleClose = useCallback8(() => setField(void 0), []);
|
|
1635
1668
|
const hiddenProperties = projection.getHiddenProperties();
|
|
1636
|
-
const handleHide =
|
|
1669
|
+
const handleHide = useCallback8((fieldId) => {
|
|
1637
1670
|
setField(void 0);
|
|
1638
1671
|
projection.hideFieldProjection(fieldId);
|
|
1639
1672
|
}, [
|
|
1640
1673
|
projection
|
|
1641
1674
|
]);
|
|
1642
|
-
const handleShow =
|
|
1675
|
+
const handleShow = useCallback8((property) => {
|
|
1643
1676
|
setField(void 0);
|
|
1644
1677
|
projection.showFieldProjection(property);
|
|
1645
1678
|
}, [
|
|
@@ -1664,7 +1697,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1664
1697
|
className: mx9(inputTextLabel)
|
|
1665
1698
|
}, t("fields label"))), /* @__PURE__ */ React15.createElement(List2.Root, {
|
|
1666
1699
|
items: view.fields,
|
|
1667
|
-
isItem:
|
|
1700
|
+
isItem: Schema2.is(FieldSchema),
|
|
1668
1701
|
getId: (field2) => field2.id,
|
|
1669
1702
|
onMove: schema.readonly ? void 0 : handleMove
|
|
1670
1703
|
}, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("div", {
|
|
@@ -2032,6 +2065,7 @@ export {
|
|
|
2032
2065
|
useForm,
|
|
2033
2066
|
useFormContext,
|
|
2034
2067
|
useFormValues,
|
|
2035
|
-
useInputProps
|
|
2068
|
+
useInputProps,
|
|
2069
|
+
useRefQueryLookupHandler
|
|
2036
2070
|
};
|
|
2037
2071
|
//# sourceMappingURL=index.mjs.map
|