@dxos/react-ui-form 0.8.2-main.2f9c567 → 0.8.2-main.36232bc
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 +117 -275
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +103 -258
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +117 -275
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +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 -6
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +32 -35
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts +11 -14
- package/dist/types/src/components/Form/FormContent.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/index.d.ts +0 -1
- package/dist/types/src/components/Form/index.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/hooks/index.d.ts +0 -1
- 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/package.json +25 -25
- package/src/components/Form/ArrayField.tsx +6 -5
- package/src/components/Form/Defaults.tsx +1 -4
- package/src/components/Form/Form.stories.tsx +38 -86
- package/src/components/Form/Form.tsx +2 -7
- package/src/components/Form/FormContent.tsx +19 -62
- package/src/components/Form/custom/SelectOptionsInput.stories.tsx +4 -5
- package/src/components/Form/index.ts +1 -1
- package/src/components/ViewEditor/ViewEditor.stories.tsx +2 -3
- package/src/components/ViewEditor/ViewEditor.tsx +10 -12
- package/src/components/deprecated/Form.tsx +6 -6
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useForm.ts +3 -3
- package/dist/types/src/components/Form/RefField.d.ts +0 -24
- package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +0 -8
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +0 -1
- package/src/components/Form/RefField.tsx +0 -152
- package/src/hooks/useRefQueryLookupHandler.ts +0 -43
package/dist/lib/node/index.cjs
CHANGED
|
@@ -62,8 +62,7 @@ __export(node_exports, {
|
|
|
62
62
|
useForm: () => useForm,
|
|
63
63
|
useFormContext: () => useFormContext,
|
|
64
64
|
useFormValues: () => useFormValues,
|
|
65
|
-
useInputProps: () => useInputProps
|
|
66
|
-
useRefQueryLookupHandler: () => useRefQueryLookupHandler
|
|
65
|
+
useInputProps: () => useInputProps
|
|
67
66
|
});
|
|
68
67
|
module.exports = __toCommonJS(node_exports);
|
|
69
68
|
var import_react = __toESM(require("react"));
|
|
@@ -112,34 +111,25 @@ var import_effect3 = require("@dxos/effect");
|
|
|
112
111
|
var import_invariant = require("@dxos/invariant");
|
|
113
112
|
var import_log2 = require("@dxos/log");
|
|
114
113
|
var import_schema2 = require("@dxos/schema");
|
|
115
|
-
var import_react13 = require("react");
|
|
116
|
-
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
117
|
-
var import_echo = require("@dxos/react-client/echo");
|
|
118
|
-
var import_util3 = require("@dxos/util");
|
|
119
114
|
var import_effect4 = require("effect");
|
|
120
115
|
var import_String = require("effect/String");
|
|
121
|
-
var
|
|
116
|
+
var import_react13 = __toESM(require("react"));
|
|
117
|
+
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
122
118
|
var import_effect5 = require("@dxos/effect");
|
|
123
119
|
var import_react_ui_theme8 = require("@dxos/react-ui-theme");
|
|
124
120
|
var import_schema3 = require("@dxos/schema");
|
|
125
|
-
var
|
|
121
|
+
var import_util3 = require("@dxos/util");
|
|
126
122
|
var import_effect6 = require("effect");
|
|
127
123
|
var import_String2 = require("effect/String");
|
|
128
|
-
var
|
|
124
|
+
var import_react14 = __toESM(require("react"));
|
|
125
|
+
var import_echo_schema6 = require("@dxos/echo-schema");
|
|
129
126
|
var import_effect7 = require("@dxos/effect");
|
|
130
127
|
var import_invariant2 = require("@dxos/invariant");
|
|
131
128
|
var import_react_ui10 = require("@dxos/react-ui");
|
|
132
129
|
var import_react_ui_theme9 = require("@dxos/react-ui-theme");
|
|
133
130
|
var import_schema4 = require("@dxos/schema");
|
|
134
|
-
var import_react16 = __toESM(require("react"));
|
|
135
|
-
var import_echo_schema6 = require("@dxos/echo-schema");
|
|
136
|
-
var import_effect8 = require("@dxos/effect");
|
|
137
|
-
var import_keys2 = require("@dxos/keys");
|
|
138
|
-
var import_live_object = require("@dxos/live-object");
|
|
139
|
-
var import_log3 = require("@dxos/log");
|
|
140
131
|
var import_echo_schema7 = require("@dxos/echo-schema");
|
|
141
|
-
var
|
|
142
|
-
var import_react17 = __toESM(require("react"));
|
|
132
|
+
var import_react15 = __toESM(require("react"));
|
|
143
133
|
var import_echo_schema8 = require("@dxos/echo-schema");
|
|
144
134
|
var import_invariant3 = require("@dxos/invariant");
|
|
145
135
|
var import_react_ui11 = require("@dxos/react-ui");
|
|
@@ -648,28 +638,23 @@ var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, on
|
|
|
648
638
|
};
|
|
649
639
|
var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
|
|
650
640
|
const { status, error } = getStatus();
|
|
651
|
-
const value = getValue3();
|
|
652
|
-
const handleValueChange = (0, import_react8.useCallback)((value2) => onValueChange(type, value2), [
|
|
653
|
-
type,
|
|
654
|
-
onValueChange
|
|
655
|
-
]);
|
|
656
641
|
return /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
657
642
|
validationValence: status
|
|
658
643
|
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
659
644
|
error
|
|
660
645
|
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Label, null, label)), /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Root, {
|
|
661
|
-
value,
|
|
662
|
-
onValueChange:
|
|
646
|
+
value: getValue3(),
|
|
647
|
+
onValueChange: (value) => onValueChange(type, value)
|
|
663
648
|
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.TriggerButton, {
|
|
664
649
|
classNames: "is-full",
|
|
665
650
|
disabled,
|
|
666
651
|
placeholder
|
|
667
|
-
}), /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Portal, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Content, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Viewport, null, options?.map(({ value
|
|
652
|
+
}), /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Portal, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Content, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Viewport, null, options?.map(({ value, label: label2 }) => (
|
|
668
653
|
// NOTE: Numeric values are converted to and from strings.
|
|
669
654
|
/* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Option, {
|
|
670
|
-
key: String(
|
|
671
|
-
value: String(
|
|
672
|
-
}, label2 ?? String(
|
|
655
|
+
key: String(value),
|
|
656
|
+
value: String(value)
|
|
657
|
+
}, label2 ?? String(value))
|
|
673
658
|
)))))), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.DescriptionAndValidation, null, error));
|
|
674
659
|
};
|
|
675
660
|
var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
@@ -718,7 +703,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
718
703
|
L: 93,
|
|
719
704
|
S: void 0,
|
|
720
705
|
A: [
|
|
721
|
-
"
|
|
706
|
+
"AST.isTypeLiteral(schema.ast)",
|
|
722
707
|
""
|
|
723
708
|
]
|
|
724
709
|
});
|
|
@@ -911,29 +896,6 @@ var flatMap = (errors) => {
|
|
|
911
896
|
return result;
|
|
912
897
|
}, {});
|
|
913
898
|
};
|
|
914
|
-
var useRefQueryLookupHandler = ({ space }) => {
|
|
915
|
-
const handleRefQueryLookup = (0, import_react13.useCallback)(async (typeInfo) => {
|
|
916
|
-
if (!space) {
|
|
917
|
-
return [];
|
|
918
|
-
}
|
|
919
|
-
const query = space.db.query(import_echo.Filter.typename(typeInfo.typename));
|
|
920
|
-
const { objects } = await query.run();
|
|
921
|
-
return objects.map((object) => {
|
|
922
|
-
const dxn = (0, import_echo_schema5.getDXN)(object);
|
|
923
|
-
if (!dxn) {
|
|
924
|
-
return void 0;
|
|
925
|
-
}
|
|
926
|
-
const item = {
|
|
927
|
-
dxn,
|
|
928
|
-
label: object?.name ?? object?.id ?? ""
|
|
929
|
-
};
|
|
930
|
-
return item;
|
|
931
|
-
}).filter(import_util3.isNonNullable);
|
|
932
|
-
}, [
|
|
933
|
-
space
|
|
934
|
-
]);
|
|
935
|
-
return handleRefQueryLookup;
|
|
936
|
-
};
|
|
937
899
|
var FormContext = /* @__PURE__ */ (0, import_react11.createContext)(void 0);
|
|
938
900
|
var useFormContext = () => {
|
|
939
901
|
return (0, import_react11.useContext)(FormContext) ?? (0, import_debug.raise)(new Error("Missing FormContext"));
|
|
@@ -1028,7 +990,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1028
990
|
const values = useFormValues(path ?? []) ?? [];
|
|
1029
991
|
(0, import_invariant2.invariant)(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
|
|
1030
992
|
F: __dxlog_file2,
|
|
1031
|
-
L:
|
|
993
|
+
L: 39,
|
|
1032
994
|
S: void 0,
|
|
1033
995
|
A: [
|
|
1034
996
|
"Array.isArray(values)",
|
|
@@ -1036,11 +998,11 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1036
998
|
]
|
|
1037
999
|
});
|
|
1038
1000
|
const label = title ?? (0, import_effect6.pipe)(name, import_String2.capitalize);
|
|
1039
|
-
const tupleType = (0, import_effect7.findNode)(ast,
|
|
1001
|
+
const tupleType = (0, import_effect7.findNode)(ast, import_echo_schema6.AST.isTupleType);
|
|
1040
1002
|
const elementType = tupleType?.rest[0]?.type;
|
|
1041
1003
|
const getDefaultObjectValue = (typeNode) => {
|
|
1042
1004
|
const baseNode = (0, import_effect7.findNode)(typeNode, import_effect7.isDiscriminatedUnion);
|
|
1043
|
-
const typeLiteral = baseNode ? (0, import_effect7.getDiscriminatedType)(baseNode, {}) : (0, import_effect7.findNode)(typeNode,
|
|
1005
|
+
const typeLiteral = baseNode ? (0, import_effect7.getDiscriminatedType)(baseNode, {}) : (0, import_effect7.findNode)(typeNode, import_echo_schema6.AST.isTypeLiteral);
|
|
1044
1006
|
if (!typeLiteral) {
|
|
1045
1007
|
return {};
|
|
1046
1008
|
}
|
|
@@ -1049,7 +1011,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1049
1011
|
prop.defaultValue
|
|
1050
1012
|
]));
|
|
1051
1013
|
};
|
|
1052
|
-
const newValue = (0,
|
|
1014
|
+
const newValue = (0, import_react14.useMemo)(() => {
|
|
1053
1015
|
if (type === "object" && elementType) {
|
|
1054
1016
|
return getDefaultObjectValue(elementType);
|
|
1055
1017
|
} else {
|
|
@@ -1059,7 +1021,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1059
1021
|
type,
|
|
1060
1022
|
elementType
|
|
1061
1023
|
]);
|
|
1062
|
-
const handleAdd = (0,
|
|
1024
|
+
const handleAdd = (0, import_react14.useCallback)(() => {
|
|
1063
1025
|
inputProps.onValueChange(type, [
|
|
1064
1026
|
...values,
|
|
1065
1027
|
newValue
|
|
@@ -1071,7 +1033,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1071
1033
|
newValue,
|
|
1072
1034
|
values
|
|
1073
1035
|
]);
|
|
1074
|
-
const handleRemove = (0,
|
|
1036
|
+
const handleRemove = (0, import_react14.useCallback)((index) => {
|
|
1075
1037
|
const newValues = values.filter((_, i) => i !== index);
|
|
1076
1038
|
inputProps.onValueChange(type, newValues);
|
|
1077
1039
|
}, [
|
|
@@ -1082,20 +1044,20 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1082
1044
|
if (!elementType) {
|
|
1083
1045
|
return null;
|
|
1084
1046
|
}
|
|
1085
|
-
return /* @__PURE__ */
|
|
1047
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
1086
1048
|
role: "none",
|
|
1087
1049
|
className: (0, import_react_ui_theme9.mx)(padding)
|
|
1088
|
-
}, /* @__PURE__ */
|
|
1050
|
+
}, /* @__PURE__ */ import_react14.default.createElement(InputHeader, null, label), /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
1089
1051
|
role: "none",
|
|
1090
1052
|
className: "flex flex-col gap-1"
|
|
1091
|
-
}, values.map((_value, index) => /* @__PURE__ */
|
|
1053
|
+
}, values.map((_value, index) => /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
1092
1054
|
key: index,
|
|
1093
1055
|
role: "none",
|
|
1094
1056
|
className: "flex items-center gap-1"
|
|
1095
|
-
}, /* @__PURE__ */
|
|
1057
|
+
}, /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
1096
1058
|
role: "none",
|
|
1097
1059
|
className: "flex-1"
|
|
1098
|
-
}, /* @__PURE__ */
|
|
1060
|
+
}, /* @__PURE__ */ import_react14.default.createElement(FormField, {
|
|
1099
1061
|
property: {
|
|
1100
1062
|
...property,
|
|
1101
1063
|
array: false,
|
|
@@ -1109,115 +1071,21 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1109
1071
|
inline: true,
|
|
1110
1072
|
Custom,
|
|
1111
1073
|
lookupComponent
|
|
1112
|
-
})), /* @__PURE__ */
|
|
1074
|
+
})), /* @__PURE__ */ import_react14.default.createElement(import_react_ui10.IconButton, {
|
|
1113
1075
|
icon: "ph--trash--regular",
|
|
1114
1076
|
iconOnly: true,
|
|
1115
1077
|
label: t("button remove"),
|
|
1116
1078
|
onClick: () => handleRemove(index)
|
|
1117
|
-
})))), /* @__PURE__ */
|
|
1079
|
+
})))), /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
1118
1080
|
role: "none",
|
|
1119
1081
|
className: "flex justify-between items-center plb-1"
|
|
1120
|
-
}, /* @__PURE__ */
|
|
1082
|
+
}, /* @__PURE__ */ import_react14.default.createElement(import_react_ui10.IconButton, {
|
|
1121
1083
|
icon: "ph--plus--regular",
|
|
1122
1084
|
iconOnly: true,
|
|
1123
1085
|
label: t("button add"),
|
|
1124
1086
|
onClick: handleAdd
|
|
1125
1087
|
})));
|
|
1126
1088
|
};
|
|
1127
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/RefField.tsx";
|
|
1128
|
-
var RefField = ({ ast, type, label, readonly, placeholder, inline, onQueryRefOptions, inputProps }) => {
|
|
1129
|
-
const { getValue: getValue3, onValueChange, ...restInputProps } = inputProps;
|
|
1130
|
-
const refTypeInfo = (0, import_effect8.findAnnotation)(ast, import_echo_schema6.ReferenceAnnotationId);
|
|
1131
|
-
const [refOptions, setRefOptions] = (0, import_react16.useState)([]);
|
|
1132
|
-
const [loading, setLoading] = (0, import_react16.useState)(false);
|
|
1133
|
-
(0, import_react16.useEffect)(() => {
|
|
1134
|
-
if (!refTypeInfo || !onQueryRefOptions) {
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
const fetchOptions = async () => {
|
|
1138
|
-
setLoading(true);
|
|
1139
|
-
try {
|
|
1140
|
-
const options = await onQueryRefOptions(refTypeInfo);
|
|
1141
|
-
setRefOptions(options.map((option) => ({
|
|
1142
|
-
label: option.label,
|
|
1143
|
-
value: option.dxn.toString()
|
|
1144
|
-
})));
|
|
1145
|
-
} catch (error) {
|
|
1146
|
-
import_log3.log.error("Failed to fetch ref options:", error, {
|
|
1147
|
-
F: __dxlog_file3,
|
|
1148
|
-
L: 69,
|
|
1149
|
-
S: void 0,
|
|
1150
|
-
C: (f, a) => f(...a)
|
|
1151
|
-
});
|
|
1152
|
-
setRefOptions([]);
|
|
1153
|
-
} finally {
|
|
1154
|
-
setLoading(false);
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1157
|
-
void fetchOptions();
|
|
1158
|
-
}, [
|
|
1159
|
-
refTypeInfo,
|
|
1160
|
-
onQueryRefOptions
|
|
1161
|
-
]);
|
|
1162
|
-
if (!refTypeInfo) {
|
|
1163
|
-
return null;
|
|
1164
|
-
}
|
|
1165
|
-
if (refTypeInfo.typename === (0, import_echo_schema6.getTypeAnnotation)(import_echo_schema6.Expando)?.typename || !onQueryRefOptions) {
|
|
1166
|
-
const handleOnValueChange = (_type, dxnString) => {
|
|
1167
|
-
const dxn = import_keys2.DXN.tryParse(dxnString);
|
|
1168
|
-
if (dxn) {
|
|
1169
|
-
onValueChange?.("object", (0, import_live_object.refFromDXN)(dxn));
|
|
1170
|
-
} else if (dxnString === "") {
|
|
1171
|
-
onValueChange?.("object", void 0);
|
|
1172
|
-
} else {
|
|
1173
|
-
onValueChange?.("string", dxnString);
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
const handleGetValue2 = () => {
|
|
1177
|
-
const formValue = getValue3();
|
|
1178
|
-
if (typeof formValue === "string") {
|
|
1179
|
-
return formValue;
|
|
1180
|
-
}
|
|
1181
|
-
if (import_echo_schema6.Ref.isRef(formValue)) {
|
|
1182
|
-
return formValue.dxn.toString();
|
|
1183
|
-
}
|
|
1184
|
-
return void 0;
|
|
1185
|
-
};
|
|
1186
|
-
return /* @__PURE__ */ import_react16.default.createElement(TextInput, {
|
|
1187
|
-
type,
|
|
1188
|
-
label,
|
|
1189
|
-
disabled: readonly,
|
|
1190
|
-
placeholder,
|
|
1191
|
-
inputOnly: inline,
|
|
1192
|
-
getValue: handleGetValue2,
|
|
1193
|
-
onValueChange: handleOnValueChange,
|
|
1194
|
-
...restInputProps
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
const handleGetValue = () => {
|
|
1198
|
-
const formValue = getValue3();
|
|
1199
|
-
if (import_echo_schema6.Ref.isRef(formValue)) {
|
|
1200
|
-
return formValue.dxn.toString();
|
|
1201
|
-
}
|
|
1202
|
-
return void 0;
|
|
1203
|
-
};
|
|
1204
|
-
const handleValueChanged = (_type, dxnString) => {
|
|
1205
|
-
const dxn = import_keys2.DXN.parse(dxnString);
|
|
1206
|
-
const ref = (0, import_live_object.refFromDXN)(dxn);
|
|
1207
|
-
onValueChange("object", ref);
|
|
1208
|
-
};
|
|
1209
|
-
return /* @__PURE__ */ import_react16.default.createElement(SelectInput, {
|
|
1210
|
-
type,
|
|
1211
|
-
label,
|
|
1212
|
-
disabled: readonly || loading,
|
|
1213
|
-
placeholder: loading ? "Loading options..." : placeholder,
|
|
1214
|
-
inputOnly: inline,
|
|
1215
|
-
getValue: handleGetValue,
|
|
1216
|
-
onValueChange: handleValueChanged,
|
|
1217
|
-
options: refOptions,
|
|
1218
|
-
...restInputProps
|
|
1219
|
-
});
|
|
1220
|
-
};
|
|
1221
1089
|
var getInputComponent = (type, format) => {
|
|
1222
1090
|
switch (format) {
|
|
1223
1091
|
case import_echo_schema7.FormatEnum.GeoPoint:
|
|
@@ -1234,20 +1102,20 @@ var getInputComponent = (type, format) => {
|
|
|
1234
1102
|
return BooleanInput;
|
|
1235
1103
|
}
|
|
1236
1104
|
};
|
|
1237
|
-
var FormField = ({ property, path, readonly, inline,
|
|
1105
|
+
var FormField = ({ property, path, readonly, inline, lookupComponent, Custom }) => {
|
|
1238
1106
|
const inputProps = useInputProps(path);
|
|
1239
1107
|
const { ast, name, type, format, title, description, options, examples, array } = property;
|
|
1240
|
-
const label = (0,
|
|
1108
|
+
const label = (0, import_react13.useMemo)(() => title ?? (0, import_effect4.pipe)(name, import_String.capitalize), [
|
|
1241
1109
|
title,
|
|
1242
1110
|
name
|
|
1243
1111
|
]);
|
|
1244
|
-
const placeholder = (0,
|
|
1112
|
+
const placeholder = (0, import_react13.useMemo)(() => examples?.length ? `Example: "${examples[0]}"` : description, [
|
|
1245
1113
|
examples,
|
|
1246
1114
|
description
|
|
1247
1115
|
]);
|
|
1248
1116
|
const FoundComponent = lookupComponent?.({
|
|
1249
1117
|
prop: name,
|
|
1250
|
-
schema:
|
|
1118
|
+
schema: import_echo_schema5.S.make(ast),
|
|
1251
1119
|
inputProps: {
|
|
1252
1120
|
type,
|
|
1253
1121
|
format,
|
|
@@ -1258,14 +1126,14 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1258
1126
|
}
|
|
1259
1127
|
});
|
|
1260
1128
|
if (FoundComponent) {
|
|
1261
|
-
return /* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1262
1130
|
role: "none"
|
|
1263
1131
|
}, FoundComponent);
|
|
1264
1132
|
}
|
|
1265
1133
|
const jsonPath = (0, import_effect5.createJsonPath)(path ?? []);
|
|
1266
1134
|
const CustomComponent = Custom?.[jsonPath];
|
|
1267
1135
|
if (CustomComponent) {
|
|
1268
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ import_react13.default.createElement(CustomComponent, {
|
|
1269
1137
|
type,
|
|
1270
1138
|
format,
|
|
1271
1139
|
label,
|
|
@@ -1276,7 +1144,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1276
1144
|
});
|
|
1277
1145
|
}
|
|
1278
1146
|
if (array) {
|
|
1279
|
-
return /* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ import_react13.default.createElement(ArrayField, {
|
|
1280
1148
|
property,
|
|
1281
1149
|
path,
|
|
1282
1150
|
inputProps,
|
|
@@ -1286,9 +1154,9 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1286
1154
|
}
|
|
1287
1155
|
const InputComponent = getInputComponent(type, format);
|
|
1288
1156
|
if (InputComponent) {
|
|
1289
|
-
return /* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1290
1158
|
role: "none"
|
|
1291
|
-
}, /* @__PURE__ */
|
|
1159
|
+
}, /* @__PURE__ */ import_react13.default.createElement(InputComponent, {
|
|
1292
1160
|
type,
|
|
1293
1161
|
format,
|
|
1294
1162
|
label,
|
|
@@ -1299,9 +1167,9 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1299
1167
|
}));
|
|
1300
1168
|
}
|
|
1301
1169
|
if (options) {
|
|
1302
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1303
1171
|
role: "none"
|
|
1304
|
-
}, /* @__PURE__ */
|
|
1172
|
+
}, /* @__PURE__ */ import_react13.default.createElement(SelectInput, {
|
|
1305
1173
|
type,
|
|
1306
1174
|
format,
|
|
1307
1175
|
disabled: readonly,
|
|
@@ -1315,41 +1183,25 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1315
1183
|
...inputProps
|
|
1316
1184
|
}));
|
|
1317
1185
|
}
|
|
1318
|
-
if (format === "ref") {
|
|
1319
|
-
return /* @__PURE__ */ import_react14.default.createElement(RefField, {
|
|
1320
|
-
ast,
|
|
1321
|
-
type,
|
|
1322
|
-
label,
|
|
1323
|
-
readonly,
|
|
1324
|
-
placeholder,
|
|
1325
|
-
inline,
|
|
1326
|
-
onQueryRefOptions,
|
|
1327
|
-
inputProps
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
1186
|
if (type === "object") {
|
|
1331
1187
|
const baseNode = (0, import_effect5.findNode)(ast, import_effect5.isDiscriminatedUnion);
|
|
1332
|
-
const typeLiteral = baseNode ? (0, import_effect5.getDiscriminatedType)(baseNode, inputProps.getValue()) : (0, import_effect5.findNode)(ast,
|
|
1188
|
+
const typeLiteral = baseNode ? (0, import_effect5.getDiscriminatedType)(baseNode, inputProps.getValue()) : (0, import_effect5.findNode)(ast, import_echo_schema5.AST.isTypeLiteral);
|
|
1333
1189
|
if (typeLiteral) {
|
|
1334
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1335
1191
|
role: "none"
|
|
1336
|
-
}, !inline && /* @__PURE__ */
|
|
1337
|
-
|
|
1338
|
-
}, label), /* @__PURE__ */ import_react14.default.createElement(FormFields, {
|
|
1339
|
-
schema: import_effect4.Schema.make(typeLiteral),
|
|
1192
|
+
}, !inline && /* @__PURE__ */ import_react13.default.createElement("div", null, label), /* @__PURE__ */ import_react13.default.createElement(FormFields, {
|
|
1193
|
+
schema: import_echo_schema5.S.make(typeLiteral),
|
|
1340
1194
|
path,
|
|
1341
1195
|
readonly,
|
|
1342
|
-
|
|
1343
|
-
Custom,
|
|
1344
|
-
lookupComponent
|
|
1196
|
+
Custom
|
|
1345
1197
|
}));
|
|
1346
1198
|
}
|
|
1347
1199
|
}
|
|
1348
1200
|
return null;
|
|
1349
1201
|
};
|
|
1350
|
-
var FormFields = ({ schema, path, filter, sort, readonly,
|
|
1202
|
+
var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custom }) => {
|
|
1351
1203
|
const values = useFormValues(path);
|
|
1352
|
-
const properties = (0,
|
|
1204
|
+
const properties = (0, import_react13.useMemo)(() => {
|
|
1353
1205
|
const props = (0, import_schema3.getSchemaProperties)(schema.ast, values);
|
|
1354
1206
|
const filtered = filter ? filter(props) : props;
|
|
1355
1207
|
return sort ? filtered.sort((a, b) => sort.indexOf(a.name) - sort.indexOf(b.name)) : filtered;
|
|
@@ -1359,11 +1211,11 @@ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, loo
|
|
|
1359
1211
|
filter,
|
|
1360
1212
|
sort
|
|
1361
1213
|
]);
|
|
1362
|
-
return /* @__PURE__ */
|
|
1214
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1363
1215
|
role: "form",
|
|
1364
1216
|
className: (0, import_react_ui_theme8.mx)("flex flex-col w-full gap-2")
|
|
1365
1217
|
}, properties.map((property) => {
|
|
1366
|
-
return /* @__PURE__ */
|
|
1218
|
+
return /* @__PURE__ */ import_react13.default.createElement(FormField, {
|
|
1367
1219
|
key: property.name,
|
|
1368
1220
|
property,
|
|
1369
1221
|
path: [
|
|
@@ -1371,13 +1223,12 @@ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, loo
|
|
|
1371
1223
|
property.name
|
|
1372
1224
|
],
|
|
1373
1225
|
readonly,
|
|
1374
|
-
onQueryRefOptions,
|
|
1375
1226
|
lookupComponent,
|
|
1376
1227
|
Custom
|
|
1377
1228
|
});
|
|
1378
|
-
}).filter(
|
|
1229
|
+
}).filter(import_util3.isNotFalsy));
|
|
1379
1230
|
};
|
|
1380
|
-
var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel,
|
|
1231
|
+
var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, lookupComponent, Custom }) => {
|
|
1381
1232
|
const formRef = (0, import_react9.useRef)(null);
|
|
1382
1233
|
const onValid = (0, import_react9.useMemo)(() => autoSave ? onSave : void 0, [
|
|
1383
1234
|
autoSave,
|
|
@@ -1413,7 +1264,6 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
|
|
|
1413
1264
|
readonly,
|
|
1414
1265
|
filter,
|
|
1415
1266
|
sort,
|
|
1416
|
-
onQueryRefOptions,
|
|
1417
1267
|
lookupComponent,
|
|
1418
1268
|
Custom
|
|
1419
1269
|
}), (onCancel || onSave) && !autoSave && /* @__PURE__ */ import_react9.default.createElement(FormActions, {
|
|
@@ -1421,7 +1271,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
|
|
|
1421
1271
|
readonly
|
|
1422
1272
|
})));
|
|
1423
1273
|
};
|
|
1424
|
-
var
|
|
1274
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
|
|
1425
1275
|
var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
1426
1276
|
const { t } = (0, import_react_ui3.useTranslation)(translationKey);
|
|
1427
1277
|
const [props, setProps] = (0, import_react3.useState)(projection.getFieldProjection(field.id).props);
|
|
@@ -1554,7 +1404,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1554
1404
|
import_log.log.warn("invalid format", {
|
|
1555
1405
|
props
|
|
1556
1406
|
}, {
|
|
1557
|
-
F:
|
|
1407
|
+
F: __dxlog_file3,
|
|
1558
1408
|
L: 174,
|
|
1559
1409
|
S: void 0,
|
|
1560
1410
|
C: (f, a) => f(...a)
|
|
@@ -1578,24 +1428,24 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1578
1428
|
Custom
|
|
1579
1429
|
});
|
|
1580
1430
|
};
|
|
1581
|
-
var
|
|
1431
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
1582
1432
|
var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
|
|
1583
|
-
var ViewMetaSchema =
|
|
1584
|
-
name:
|
|
1585
|
-
[
|
|
1433
|
+
var ViewMetaSchema = import_echo_schema8.S.Struct({
|
|
1434
|
+
name: import_echo_schema8.S.String.annotations({
|
|
1435
|
+
[import_echo_schema8.AST.TitleAnnotationId]: "View"
|
|
1586
1436
|
}),
|
|
1587
1437
|
typename: import_echo_schema8.Format.URL.annotations({
|
|
1588
|
-
[
|
|
1438
|
+
[import_echo_schema8.AST.TitleAnnotationId]: "Typename"
|
|
1589
1439
|
})
|
|
1590
|
-
}).pipe(
|
|
1440
|
+
}).pipe(import_echo_schema8.S.mutable);
|
|
1591
1441
|
var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading = false, onTypenameChanged, onDelete }) => {
|
|
1592
1442
|
const { t } = (0, import_react_ui11.useTranslation)(translationKey);
|
|
1593
|
-
const projection = (0,
|
|
1443
|
+
const projection = (0, import_react15.useMemo)(() => new import_schema5.ViewProjection(schema.jsonSchema, view), [
|
|
1594
1444
|
schema,
|
|
1595
1445
|
view
|
|
1596
1446
|
]);
|
|
1597
|
-
const [field, setField] = (0,
|
|
1598
|
-
const viewValues = (0,
|
|
1447
|
+
const [field, setField] = (0, import_react15.useState)();
|
|
1448
|
+
const viewValues = (0, import_react15.useMemo)(() => {
|
|
1599
1449
|
return {
|
|
1600
1450
|
name: view.name,
|
|
1601
1451
|
// TODO(burdon): Need to warn user of possible consequences of editing.
|
|
@@ -1605,13 +1455,13 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1605
1455
|
}, [
|
|
1606
1456
|
view
|
|
1607
1457
|
]);
|
|
1608
|
-
const handleSelect = (0,
|
|
1458
|
+
const handleSelect = (0, import_react15.useCallback)((field2) => {
|
|
1609
1459
|
setField((f) => f === field2 ? void 0 : field2);
|
|
1610
1460
|
}, []);
|
|
1611
|
-
const handleAdd = (0,
|
|
1461
|
+
const handleAdd = (0, import_react15.useCallback)(() => {
|
|
1612
1462
|
(0, import_invariant3.invariant)(!schema.readonly, void 0, {
|
|
1613
|
-
F:
|
|
1614
|
-
L:
|
|
1463
|
+
F: __dxlog_file4,
|
|
1464
|
+
L: 76,
|
|
1615
1465
|
S: void 0,
|
|
1616
1466
|
A: [
|
|
1617
1467
|
"!schema.readonly",
|
|
@@ -1624,10 +1474,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1624
1474
|
schema,
|
|
1625
1475
|
view
|
|
1626
1476
|
]);
|
|
1627
|
-
const handleUpdate = (0,
|
|
1477
|
+
const handleUpdate = (0, import_react15.useCallback)(({ name, typename }) => {
|
|
1628
1478
|
(0, import_invariant3.invariant)(!schema.readonly, void 0, {
|
|
1629
|
-
F:
|
|
1630
|
-
L:
|
|
1479
|
+
F: __dxlog_file4,
|
|
1480
|
+
L: 83,
|
|
1631
1481
|
S: void 0,
|
|
1632
1482
|
A: [
|
|
1633
1483
|
"!schema.readonly",
|
|
@@ -1647,10 +1497,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1647
1497
|
view,
|
|
1648
1498
|
onTypenameChanged
|
|
1649
1499
|
]);
|
|
1650
|
-
const handleDelete = (0,
|
|
1500
|
+
const handleDelete = (0, import_react15.useCallback)((fieldId) => {
|
|
1651
1501
|
(0, import_invariant3.invariant)(!schema.readonly, void 0, {
|
|
1652
|
-
F:
|
|
1653
|
-
L:
|
|
1502
|
+
F: __dxlog_file4,
|
|
1503
|
+
L: 99,
|
|
1654
1504
|
S: void 0,
|
|
1655
1505
|
A: [
|
|
1656
1506
|
"!schema.readonly",
|
|
@@ -1666,10 +1516,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1666
1516
|
field,
|
|
1667
1517
|
onDelete
|
|
1668
1518
|
]);
|
|
1669
|
-
const handleMove = (0,
|
|
1519
|
+
const handleMove = (0, import_react15.useCallback)((fromIndex, toIndex) => {
|
|
1670
1520
|
(0, import_invariant3.invariant)(!schema.readonly, void 0, {
|
|
1671
|
-
F:
|
|
1672
|
-
L:
|
|
1521
|
+
F: __dxlog_file4,
|
|
1522
|
+
L: 111,
|
|
1673
1523
|
S: void 0,
|
|
1674
1524
|
A: [
|
|
1675
1525
|
"!schema.readonly",
|
|
@@ -1686,95 +1536,91 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1686
1536
|
schema,
|
|
1687
1537
|
view.fields
|
|
1688
1538
|
]);
|
|
1689
|
-
const handleClose = (0,
|
|
1539
|
+
const handleClose = (0, import_react15.useCallback)(() => setField(void 0), []);
|
|
1690
1540
|
const hiddenProperties = projection.getHiddenProperties();
|
|
1691
|
-
const handleHide = (0,
|
|
1541
|
+
const handleHide = (0, import_react15.useCallback)((fieldId) => {
|
|
1692
1542
|
setField(void 0);
|
|
1693
1543
|
projection.hideFieldProjection(fieldId);
|
|
1694
1544
|
}, [
|
|
1695
1545
|
projection
|
|
1696
1546
|
]);
|
|
1697
|
-
const handleShow = (0,
|
|
1547
|
+
const handleShow = (0, import_react15.useCallback)((property) => {
|
|
1698
1548
|
setField(void 0);
|
|
1699
1549
|
projection.showFieldProjection(property);
|
|
1700
1550
|
}, [
|
|
1701
1551
|
projection
|
|
1702
1552
|
]);
|
|
1703
|
-
return /* @__PURE__ */
|
|
1553
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1704
1554
|
role: "none",
|
|
1705
|
-
className: (0, import_react_ui_theme10.mx)("
|
|
1706
|
-
}, /* @__PURE__ */
|
|
1555
|
+
className: (0, import_react_ui_theme10.mx)("flex flex-col w-full divide-y divide-separator", classNames)
|
|
1556
|
+
}, /* @__PURE__ */ import_react15.default.createElement(Form, {
|
|
1707
1557
|
autoSave: true,
|
|
1708
1558
|
schema: ViewMetaSchema,
|
|
1709
1559
|
values: viewValues,
|
|
1710
|
-
onSave: schema.readonly ? void 0 : handleUpdate
|
|
1711
|
-
|
|
1712
|
-
}), /* @__PURE__ */ import_react17.default.createElement("div", {
|
|
1713
|
-
role: "none",
|
|
1714
|
-
className: "border-bs border-separator min-bs-0 overflow-y-auto"
|
|
1715
|
-
}, /* @__PURE__ */ import_react17.default.createElement("div", {
|
|
1560
|
+
onSave: schema.readonly ? void 0 : handleUpdate
|
|
1561
|
+
}), /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1716
1562
|
role: "none",
|
|
1717
1563
|
className: "p-2"
|
|
1718
|
-
}, /* @__PURE__ */
|
|
1564
|
+
}, /* @__PURE__ */ import_react15.default.createElement("label", {
|
|
1719
1565
|
className: (0, import_react_ui_theme10.mx)(import_react_ui_theme10.inputTextLabel)
|
|
1720
|
-
}, t("fields label"))), /* @__PURE__ */
|
|
1566
|
+
}, t("fields label"))), /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.Root, {
|
|
1721
1567
|
items: view.fields,
|
|
1722
|
-
isItem:
|
|
1568
|
+
isItem: import_echo_schema8.S.is(import_schema5.FieldSchema),
|
|
1723
1569
|
getId: (field2) => field2.id,
|
|
1724
1570
|
onMove: schema.readonly ? void 0 : handleMove
|
|
1725
|
-
}, ({ items: fields }) => /* @__PURE__ */
|
|
1571
|
+
}, ({ items: fields }) => /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, showHeading && /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1726
1572
|
role: "heading",
|
|
1727
1573
|
className: grid
|
|
1728
|
-
}, /* @__PURE__ */
|
|
1574
|
+
}, /* @__PURE__ */ import_react15.default.createElement("div", null), /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1729
1575
|
className: "flex items-center text-sm"
|
|
1730
|
-
}, t("field path label"))), /* @__PURE__ */
|
|
1576
|
+
}, t("field path label"))), /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1731
1577
|
role: "list",
|
|
1732
1578
|
className: "flex flex-col w-full"
|
|
1733
|
-
}, fields?.map((field2) => /* @__PURE__ */
|
|
1579
|
+
}, fields?.map((field2) => /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.Item, {
|
|
1734
1580
|
key: field2.id,
|
|
1735
1581
|
item: field2,
|
|
1736
1582
|
classNames: (0, import_react_ui_theme10.mx)(grid, import_react_ui_theme10.ghostHover, "cursor-pointer")
|
|
1737
|
-
}, /* @__PURE__ */
|
|
1583
|
+
}, /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemDragHandle, null), /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemTitle, {
|
|
1738
1584
|
onClick: () => handleSelect(field2)
|
|
1739
|
-
}, field2.path), /* @__PURE__ */
|
|
1585
|
+
}, field2.path), /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1740
1586
|
className: "flex items-center gap-2 -ml-4"
|
|
1741
|
-
}, /* @__PURE__ */
|
|
1587
|
+
}, /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemButton, {
|
|
1742
1588
|
icon: "ph--eye-slash--regular",
|
|
1743
1589
|
disabled: view.fields.length <= 1,
|
|
1744
1590
|
onClick: () => handleHide(field2.id)
|
|
1745
|
-
}), !schema.readonly && /* @__PURE__ */
|
|
1591
|
+
}), !schema.readonly && /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemDeleteButton, {
|
|
1746
1592
|
icon: "ph--trash--regular",
|
|
1747
1593
|
disabled: view.fields.length <= 1,
|
|
1748
1594
|
onClick: () => handleDelete(field2.id)
|
|
1749
|
-
}))))))), hiddenProperties.length > 0 && /* @__PURE__ */
|
|
1595
|
+
}))))))), hiddenProperties.length > 0 && /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1750
1596
|
role: "none",
|
|
1751
1597
|
className: "p-2"
|
|
1752
|
-
}, /* @__PURE__ */
|
|
1598
|
+
}, /* @__PURE__ */ import_react15.default.createElement("label", {
|
|
1753
1599
|
className: (0, import_react_ui_theme10.mx)(import_react_ui_theme10.inputTextLabel)
|
|
1754
|
-
}, t("hidden fields label"))), /* @__PURE__ */
|
|
1600
|
+
}, t("hidden fields label"))), /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.Root, {
|
|
1755
1601
|
items: hiddenProperties,
|
|
1756
1602
|
isItem: (item) => typeof item === "string",
|
|
1757
1603
|
getId: (property) => property
|
|
1758
|
-
}, ({ items: properties }) => /* @__PURE__ */
|
|
1604
|
+
}, ({ items: properties }) => /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1759
1605
|
role: "list",
|
|
1760
1606
|
className: "flex flex-col w-full"
|
|
1761
|
-
}, properties?.map((property) => /* @__PURE__ */
|
|
1607
|
+
}, properties?.map((property) => /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.Item, {
|
|
1762
1608
|
key: property,
|
|
1763
1609
|
item: property,
|
|
1764
1610
|
classNames: (0, import_react_ui_theme10.mx)(grid, import_react_ui_theme10.ghostHover, "cursor-pointer")
|
|
1765
|
-
}, /* @__PURE__ */
|
|
1611
|
+
}, /* @__PURE__ */ import_react15.default.createElement("div", null), /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemTitle, null, property), /* @__PURE__ */ import_react15.default.createElement(import_react_ui_list2.List.ItemButton, {
|
|
1766
1612
|
icon: "ph--eye--regular",
|
|
1767
1613
|
onClick: () => handleShow(property)
|
|
1768
|
-
}))))))), field && /* @__PURE__ */
|
|
1614
|
+
}))))))), field && /* @__PURE__ */ import_react15.default.createElement(FieldEditor, {
|
|
1769
1615
|
key: field.id,
|
|
1770
1616
|
view,
|
|
1771
1617
|
projection,
|
|
1772
1618
|
field,
|
|
1773
1619
|
registry,
|
|
1774
1620
|
onSave: handleClose
|
|
1775
|
-
}), !readonly && !field && /* @__PURE__ */
|
|
1621
|
+
}), !readonly && !field && /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1776
1622
|
className: "flex p-2 justify-center"
|
|
1777
|
-
}, /* @__PURE__ */
|
|
1623
|
+
}, /* @__PURE__ */ import_react15.default.createElement(import_react_ui11.IconButton, {
|
|
1778
1624
|
icon: "ph--plus--regular",
|
|
1779
1625
|
label: t("button add property"),
|
|
1780
1626
|
onClick: schema.readonly ? void 0 : handleAdd,
|
|
@@ -2081,7 +1927,6 @@ var formatForEditing = ({ type, format, value, locale = void 0 }) => {
|
|
|
2081
1927
|
useForm,
|
|
2082
1928
|
useFormContext,
|
|
2083
1929
|
useFormValues,
|
|
2084
|
-
useInputProps
|
|
2085
|
-
useRefQueryLookupHandler
|
|
1930
|
+
useInputProps
|
|
2086
1931
|
});
|
|
2087
1932
|
//# sourceMappingURL=index.cjs.map
|