@dxos/react-ui-form 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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 +102 -253
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +161 -312
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +102 -253
- 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 → ControlSection.d.ts} +5 -8
- package/dist/types/src/components/ControlSection.d.ts.map +1 -0
- package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +1 -3
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +2 -4
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts +10 -13
- package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts +2 -2
- package/dist/types/src/components/Form/FormContext.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/index.d.ts.map +1 -1
- package/dist/types/src/util/formatting.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/components/{ControlSection/ControlSection.tsx → ControlSection.tsx} +14 -38
- package/src/components/Form/ArrayField.tsx +1 -3
- package/src/components/Form/Form.stories.tsx +5 -48
- package/src/components/Form/Form.tsx +0 -4
- package/src/components/Form/FormContent.tsx +15 -59
- package/src/components/Form/FormContext.tsx +2 -10
- package/src/components/Form/custom/GeoPointInput.tsx +2 -2
- package/src/components/Form/custom/SelectOptionsInput.tsx +2 -2
- package/src/components/deprecated/Form.stories.tsx +6 -6
- package/src/components/deprecated/FormInput.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/util/formatting.ts +3 -15
- package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -8
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/index.d.ts +0 -2
- package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
- package/dist/types/src/components/Form/RefField.d.ts +0 -23
- package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
- package/src/components/ControlSection/ControlSection.stories.tsx +0 -29
- package/src/components/ControlSection/index.ts +0 -5
- package/src/components/Form/RefField.tsx +0 -151
|
@@ -65,7 +65,7 @@ import { mx, textBlockWidth } from "@dxos/react-ui-theme";
|
|
|
65
65
|
var DeprecatedFormContainer = ({ children, classNames }) => {
|
|
66
66
|
return /* @__PURE__ */ React.createElement("div", {
|
|
67
67
|
role: "none",
|
|
68
|
-
className: "
|
|
68
|
+
className: "w-full p-4 justify-center overflow-x-hidden overflow-y-auto"
|
|
69
69
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
70
70
|
role: "form",
|
|
71
71
|
className: mx("flex flex-col", textBlockWidth, classNames)
|
|
@@ -99,23 +99,9 @@ var DeprecatedFormInput = ({ label, description, secondary, children }) => {
|
|
|
99
99
|
return primary;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
// packages/ui/react-ui-form/src/components/ControlSection
|
|
102
|
+
// packages/ui/react-ui-form/src/components/ControlSection.tsx
|
|
103
103
|
import React2 from "react";
|
|
104
|
-
import {
|
|
105
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
106
|
-
var ControlPage = ({ children, classNames, ...props }) => {
|
|
107
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
108
|
-
role: "none",
|
|
109
|
-
className: mx2("pli-2", classNames),
|
|
110
|
-
...props
|
|
111
|
-
}, children);
|
|
112
|
-
};
|
|
113
|
-
var ControlSection = ({ title, description, children }) => {
|
|
114
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
|
|
115
|
-
title,
|
|
116
|
-
description
|
|
117
|
-
}), children);
|
|
118
|
-
};
|
|
104
|
+
import { toLocalizedString, useTranslation, Input as Input2 } from "@dxos/react-ui";
|
|
119
105
|
var ControlSectionHeading = ({ title, description }) => {
|
|
120
106
|
const { t } = useTranslation(translationKey);
|
|
121
107
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
|
|
@@ -124,18 +110,15 @@ var ControlSectionHeading = ({ title, description }) => {
|
|
|
124
110
|
className: "pli-4 mlb-4 container-max-width text-description"
|
|
125
111
|
}, toLocalizedString(description, t)));
|
|
126
112
|
};
|
|
127
|
-
var
|
|
128
|
-
return /* @__PURE__ */ React2.createElement(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
classNames
|
|
133
|
-
]
|
|
134
|
-
});
|
|
113
|
+
var ControlSection = ({ title, description, children }) => {
|
|
114
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
|
|
115
|
+
title,
|
|
116
|
+
description
|
|
117
|
+
}), children);
|
|
135
118
|
};
|
|
136
|
-
var ControlGroup = ({ children
|
|
119
|
+
var ControlGroup = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
|
|
137
120
|
role: "none",
|
|
138
|
-
className:
|
|
121
|
+
className: "group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4"
|
|
139
122
|
}, children);
|
|
140
123
|
var ControlFrame = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
|
|
141
124
|
role: "none",
|
|
@@ -181,9 +164,9 @@ var ControlFrameItem = ({ title, description, children }) => {
|
|
|
181
164
|
};
|
|
182
165
|
|
|
183
166
|
// packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
|
|
184
|
-
import
|
|
167
|
+
import React13, { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo7, useState as useState4 } from "react";
|
|
185
168
|
import { FormatEnum as FormatEnum2, FormatEnums, formatToType } from "@dxos/echo-schema";
|
|
186
|
-
import { log as
|
|
169
|
+
import { log as log2 } from "@dxos/log";
|
|
187
170
|
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
188
171
|
import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
|
|
189
172
|
|
|
@@ -289,7 +272,7 @@ import { PublicKey } from "@dxos/keys";
|
|
|
289
272
|
import { Icon as Icon2, IconButton, Input as Input4, Tag, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
290
273
|
import { List } from "@dxos/react-ui-list";
|
|
291
274
|
import { HuePicker } from "@dxos/react-ui-pickers";
|
|
292
|
-
import { hues, mx as
|
|
275
|
+
import { hues, mx as mx2 } from "@dxos/react-ui-theme";
|
|
293
276
|
var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
|
|
294
277
|
const [selected, setSelectedId] = useState2(null);
|
|
295
278
|
const [isNewOption, setIsNewOption] = useState2(false);
|
|
@@ -415,7 +398,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
415
398
|
}, /* @__PURE__ */ React5.createElement(List.Item, {
|
|
416
399
|
role: "button",
|
|
417
400
|
item,
|
|
418
|
-
classNames:
|
|
401
|
+
classNames: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
|
|
419
402
|
"aria-expanded": selected === item.id
|
|
420
403
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
421
404
|
className: "flex items-center"
|
|
@@ -456,7 +439,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
456
439
|
role: "listitem"
|
|
457
440
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
458
441
|
role: "button",
|
|
459
|
-
className:
|
|
442
|
+
className: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
|
|
460
443
|
onClick: handleAdd
|
|
461
444
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
462
445
|
className: "flex items-center gap-1"
|
|
@@ -470,7 +453,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
470
453
|
// packages/ui/react-ui-form/src/components/Form/custom/TupleInput.tsx
|
|
471
454
|
import React6 from "react";
|
|
472
455
|
import { Input as Input5 } from "@dxos/react-ui";
|
|
473
|
-
import { mx as
|
|
456
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
474
457
|
import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
|
|
475
458
|
var gridCols = [
|
|
476
459
|
"grid-cols-1",
|
|
@@ -486,7 +469,7 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
|
|
|
486
469
|
}, /* @__PURE__ */ React6.createElement(InputHeader, {
|
|
487
470
|
error
|
|
488
471
|
}, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement("div", {
|
|
489
|
-
className:
|
|
472
|
+
className: mx3("grid gap-2", gridCols[binding.length - 1])
|
|
490
473
|
}, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input5.TextInput, {
|
|
491
474
|
key: prop,
|
|
492
475
|
type: "number",
|
|
@@ -606,13 +589,13 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
|
|
|
606
589
|
};
|
|
607
590
|
|
|
608
591
|
// packages/ui/react-ui-form/src/components/Form/Form.tsx
|
|
609
|
-
import
|
|
610
|
-
import { mx as
|
|
592
|
+
import React12, { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef3 } from "react";
|
|
593
|
+
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
611
594
|
|
|
612
595
|
// packages/ui/react-ui-form/src/components/Form/FormActions.tsx
|
|
613
596
|
import React9 from "react";
|
|
614
597
|
import { IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
615
|
-
import { mx as
|
|
598
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
616
599
|
|
|
617
600
|
// packages/ui/react-ui-form/src/components/Form/FormContext.tsx
|
|
618
601
|
import React8, { createContext, useContext, useEffect as useEffect5, useMemo as useMemo3 } from "react";
|
|
@@ -903,7 +886,7 @@ var FormActions = ({ onCancel, readonly }) => {
|
|
|
903
886
|
className: "mt-2 flex justify-center"
|
|
904
887
|
}, /* @__PURE__ */ React9.createElement("div", {
|
|
905
888
|
role: "none",
|
|
906
|
-
className:
|
|
889
|
+
className: mx4(onCancel && !readonly && "grid grid-cols-2 gap-2")
|
|
907
890
|
}, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
|
|
908
891
|
"data-testid": "cancel-button",
|
|
909
892
|
icon: "ph--x--regular",
|
|
@@ -922,10 +905,10 @@ var FormActions = ({ onCancel, readonly }) => {
|
|
|
922
905
|
// packages/ui/react-ui-form/src/components/Form/FormContent.tsx
|
|
923
906
|
import { pipe as pipe2 } from "effect";
|
|
924
907
|
import { capitalize as capitalize2 } from "effect/String";
|
|
925
|
-
import
|
|
908
|
+
import React11, { useMemo as useMemo5 } from "react";
|
|
926
909
|
import { AST as AST3, S } from "@dxos/echo-schema";
|
|
927
910
|
import { createJsonPath as createJsonPath3, findNode as findNode2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
|
|
928
|
-
import { mx as
|
|
911
|
+
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
929
912
|
import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
|
|
930
913
|
import { isNotFalsy } from "@dxos/util";
|
|
931
914
|
|
|
@@ -937,17 +920,17 @@ import { AST as AST2 } from "@dxos/echo-schema";
|
|
|
937
920
|
import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
|
|
938
921
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
939
922
|
import { IconButton as IconButton3, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
940
|
-
import { mx as
|
|
923
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
941
924
|
import { getSchemaProperties } from "@dxos/schema";
|
|
942
925
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
|
|
943
926
|
var padding = "px-2";
|
|
944
927
|
var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
|
|
945
928
|
const { t } = useTranslation5(translationKey);
|
|
946
929
|
const { ast, name, type, title } = property;
|
|
947
|
-
const values = useFormValues(path ?? [])
|
|
930
|
+
const values = useFormValues(path ?? []);
|
|
948
931
|
invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
|
|
949
932
|
F: __dxlog_file2,
|
|
950
|
-
L:
|
|
933
|
+
L: 37,
|
|
951
934
|
S: void 0,
|
|
952
935
|
A: [
|
|
953
936
|
"Array.isArray(values)",
|
|
@@ -1003,7 +986,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1003
986
|
}
|
|
1004
987
|
return /* @__PURE__ */ React10.createElement("div", {
|
|
1005
988
|
role: "none",
|
|
1006
|
-
className:
|
|
989
|
+
className: mx5(padding)
|
|
1007
990
|
}, /* @__PURE__ */ React10.createElement(InputHeader, null, label), /* @__PURE__ */ React10.createElement("div", {
|
|
1008
991
|
role: "none",
|
|
1009
992
|
className: "flex flex-col gap-1"
|
|
@@ -1044,108 +1027,6 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1044
1027
|
})));
|
|
1045
1028
|
};
|
|
1046
1029
|
|
|
1047
|
-
// packages/ui/react-ui-form/src/components/Form/RefField.tsx
|
|
1048
|
-
import React11, { useEffect as useEffect6, useState as useState4 } from "react";
|
|
1049
|
-
import { Expando, getTypeAnnotation, ReferenceAnnotationId } from "@dxos/echo-schema";
|
|
1050
|
-
import { findAnnotation } from "@dxos/effect";
|
|
1051
|
-
import { DXN } from "@dxos/keys";
|
|
1052
|
-
import { refFromDXN, RefImpl } from "@dxos/live-object";
|
|
1053
|
-
import { log as log2 } from "@dxos/log";
|
|
1054
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/RefField.tsx";
|
|
1055
|
-
var RefField = ({ ast, type, label, readonly, placeholder, inline, onQueryRefOptions, inputProps }) => {
|
|
1056
|
-
const { getValue: getValue3, onValueChange, ...restInputProps } = inputProps;
|
|
1057
|
-
const refTypeInfo = findAnnotation(ast, ReferenceAnnotationId);
|
|
1058
|
-
const [refOptions, setRefOptions] = useState4([]);
|
|
1059
|
-
const [loading, setLoading] = useState4(false);
|
|
1060
|
-
useEffect6(() => {
|
|
1061
|
-
if (!refTypeInfo || !onQueryRefOptions) {
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
const fetchOptions = async () => {
|
|
1065
|
-
setLoading(true);
|
|
1066
|
-
try {
|
|
1067
|
-
const options = await onQueryRefOptions(refTypeInfo);
|
|
1068
|
-
setRefOptions(options.map((option) => ({
|
|
1069
|
-
label: option.label,
|
|
1070
|
-
value: option.dxn.toString()
|
|
1071
|
-
})));
|
|
1072
|
-
} catch (error) {
|
|
1073
|
-
log2.error("Failed to fetch ref options:", error, {
|
|
1074
|
-
F: __dxlog_file3,
|
|
1075
|
-
L: 68,
|
|
1076
|
-
S: void 0,
|
|
1077
|
-
C: (f, a) => f(...a)
|
|
1078
|
-
});
|
|
1079
|
-
setRefOptions([]);
|
|
1080
|
-
} finally {
|
|
1081
|
-
setLoading(false);
|
|
1082
|
-
}
|
|
1083
|
-
};
|
|
1084
|
-
void fetchOptions();
|
|
1085
|
-
}, [
|
|
1086
|
-
refTypeInfo,
|
|
1087
|
-
onQueryRefOptions
|
|
1088
|
-
]);
|
|
1089
|
-
if (!refTypeInfo) {
|
|
1090
|
-
return null;
|
|
1091
|
-
}
|
|
1092
|
-
if (refTypeInfo.typename === getTypeAnnotation(Expando)?.typename || !onQueryRefOptions) {
|
|
1093
|
-
const handleOnValueChange = (_type, dxnString) => {
|
|
1094
|
-
const dxn = DXN.tryParse(dxnString);
|
|
1095
|
-
if (dxn) {
|
|
1096
|
-
onValueChange?.("object", refFromDXN(dxn));
|
|
1097
|
-
} else if (dxnString === "") {
|
|
1098
|
-
onValueChange?.("object", void 0);
|
|
1099
|
-
} else {
|
|
1100
|
-
onValueChange?.("string", dxnString);
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
const handleGetValue2 = () => {
|
|
1104
|
-
const formValue = getValue3();
|
|
1105
|
-
if (typeof formValue === "string") {
|
|
1106
|
-
return formValue;
|
|
1107
|
-
}
|
|
1108
|
-
if (formValue instanceof RefImpl) {
|
|
1109
|
-
return formValue.dxn.toString();
|
|
1110
|
-
}
|
|
1111
|
-
return void 0;
|
|
1112
|
-
};
|
|
1113
|
-
return /* @__PURE__ */ React11.createElement(TextInput, {
|
|
1114
|
-
type,
|
|
1115
|
-
label,
|
|
1116
|
-
disabled: readonly,
|
|
1117
|
-
placeholder,
|
|
1118
|
-
inputOnly: inline,
|
|
1119
|
-
getValue: handleGetValue2,
|
|
1120
|
-
onValueChange: handleOnValueChange,
|
|
1121
|
-
...restInputProps
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
const handleGetValue = () => {
|
|
1125
|
-
const formValue = getValue3();
|
|
1126
|
-
if (formValue instanceof RefImpl) {
|
|
1127
|
-
return formValue.dxn.toString();
|
|
1128
|
-
}
|
|
1129
|
-
return void 0;
|
|
1130
|
-
};
|
|
1131
|
-
const handleValueChanged = (_type, dxnString) => {
|
|
1132
|
-
const dxn = DXN.parse(dxnString);
|
|
1133
|
-
const ref = refFromDXN(dxn);
|
|
1134
|
-
onValueChange("object", ref);
|
|
1135
|
-
};
|
|
1136
|
-
return /* @__PURE__ */ React11.createElement(SelectInput, {
|
|
1137
|
-
type,
|
|
1138
|
-
label,
|
|
1139
|
-
disabled: readonly || loading,
|
|
1140
|
-
placeholder: loading ? "Loading options..." : placeholder,
|
|
1141
|
-
inputOnly: inline,
|
|
1142
|
-
getValue: handleGetValue,
|
|
1143
|
-
onValueChange: handleValueChanged,
|
|
1144
|
-
options: refOptions,
|
|
1145
|
-
...restInputProps
|
|
1146
|
-
});
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
1030
|
// packages/ui/react-ui-form/src/components/Form/factory.tsx
|
|
1150
1031
|
import { FormatEnum } from "@dxos/echo-schema";
|
|
1151
1032
|
var getInputComponent = (type, format) => {
|
|
@@ -1166,7 +1047,7 @@ var getInputComponent = (type, format) => {
|
|
|
1166
1047
|
};
|
|
1167
1048
|
|
|
1168
1049
|
// packages/ui/react-ui-form/src/components/Form/FormContent.tsx
|
|
1169
|
-
var FormField = ({ property, path, readonly, inline,
|
|
1050
|
+
var FormField = ({ property, path, readonly, inline, lookupComponent, Custom }) => {
|
|
1170
1051
|
const inputProps = useInputProps(path);
|
|
1171
1052
|
const { ast, name, type, format, title, description, options, examples, array } = property;
|
|
1172
1053
|
const label = useMemo5(() => title ?? pipe2(name, capitalize2), [
|
|
@@ -1190,14 +1071,14 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1190
1071
|
}
|
|
1191
1072
|
});
|
|
1192
1073
|
if (FoundComponent) {
|
|
1193
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1194
1075
|
role: "none"
|
|
1195
1076
|
}, FoundComponent);
|
|
1196
1077
|
}
|
|
1197
1078
|
const jsonPath = createJsonPath3(path ?? []);
|
|
1198
1079
|
const CustomComponent = Custom?.[jsonPath];
|
|
1199
1080
|
if (CustomComponent) {
|
|
1200
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ React11.createElement(CustomComponent, {
|
|
1201
1082
|
type,
|
|
1202
1083
|
format,
|
|
1203
1084
|
label,
|
|
@@ -1208,7 +1089,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1208
1089
|
});
|
|
1209
1090
|
}
|
|
1210
1091
|
if (array) {
|
|
1211
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ React11.createElement(ArrayField, {
|
|
1212
1093
|
property,
|
|
1213
1094
|
path,
|
|
1214
1095
|
inputProps,
|
|
@@ -1218,9 +1099,9 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1218
1099
|
}
|
|
1219
1100
|
const InputComponent = getInputComponent(type, format);
|
|
1220
1101
|
if (InputComponent) {
|
|
1221
|
-
return /* @__PURE__ */
|
|
1102
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1222
1103
|
role: "none"
|
|
1223
|
-
}, /* @__PURE__ */
|
|
1104
|
+
}, /* @__PURE__ */ React11.createElement(InputComponent, {
|
|
1224
1105
|
type,
|
|
1225
1106
|
format,
|
|
1226
1107
|
label,
|
|
@@ -1231,9 +1112,9 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1231
1112
|
}));
|
|
1232
1113
|
}
|
|
1233
1114
|
if (options) {
|
|
1234
|
-
return /* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1235
1116
|
role: "none"
|
|
1236
|
-
}, /* @__PURE__ */
|
|
1117
|
+
}, /* @__PURE__ */ React11.createElement(SelectInput, {
|
|
1237
1118
|
type,
|
|
1238
1119
|
format,
|
|
1239
1120
|
disabled: readonly,
|
|
@@ -1247,39 +1128,23 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1247
1128
|
...inputProps
|
|
1248
1129
|
}));
|
|
1249
1130
|
}
|
|
1250
|
-
if (format === "ref") {
|
|
1251
|
-
return /* @__PURE__ */ React12.createElement(RefField, {
|
|
1252
|
-
ast,
|
|
1253
|
-
type,
|
|
1254
|
-
label,
|
|
1255
|
-
readonly,
|
|
1256
|
-
placeholder,
|
|
1257
|
-
inline,
|
|
1258
|
-
onQueryRefOptions,
|
|
1259
|
-
inputProps
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
1131
|
if (type === "object") {
|
|
1263
1132
|
const baseNode = findNode2(ast, isDiscriminatedUnion2);
|
|
1264
1133
|
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast, AST3.isTypeLiteral);
|
|
1265
1134
|
if (typeLiteral) {
|
|
1266
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1267
1136
|
role: "none"
|
|
1268
|
-
}, !inline && /* @__PURE__ */
|
|
1269
|
-
className: "text-lg mbs-2 mbe-1"
|
|
1270
|
-
}, label), /* @__PURE__ */ React12.createElement(FormFields, {
|
|
1137
|
+
}, !inline && /* @__PURE__ */ React11.createElement("div", null, label), /* @__PURE__ */ React11.createElement(FormFields, {
|
|
1271
1138
|
schema: S.make(typeLiteral),
|
|
1272
1139
|
path,
|
|
1273
1140
|
readonly,
|
|
1274
|
-
|
|
1275
|
-
Custom,
|
|
1276
|
-
lookupComponent
|
|
1141
|
+
Custom
|
|
1277
1142
|
}));
|
|
1278
1143
|
}
|
|
1279
1144
|
}
|
|
1280
1145
|
return null;
|
|
1281
1146
|
};
|
|
1282
|
-
var FormFields = ({ schema, path, filter, sort, readonly,
|
|
1147
|
+
var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custom }) => {
|
|
1283
1148
|
const values = useFormValues(path);
|
|
1284
1149
|
const properties = useMemo5(() => {
|
|
1285
1150
|
const props = getSchemaProperties2(schema.ast, values);
|
|
@@ -1291,11 +1156,11 @@ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, loo
|
|
|
1291
1156
|
filter,
|
|
1292
1157
|
sort
|
|
1293
1158
|
]);
|
|
1294
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1295
1160
|
role: "form",
|
|
1296
|
-
className:
|
|
1161
|
+
className: mx6("flex flex-col w-full gap-2")
|
|
1297
1162
|
}, properties.map((property) => {
|
|
1298
|
-
return /* @__PURE__ */
|
|
1163
|
+
return /* @__PURE__ */ React11.createElement(FormField, {
|
|
1299
1164
|
key: property.name,
|
|
1300
1165
|
property,
|
|
1301
1166
|
path: [
|
|
@@ -1303,7 +1168,6 @@ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, loo
|
|
|
1303
1168
|
property.name
|
|
1304
1169
|
],
|
|
1305
1170
|
readonly,
|
|
1306
|
-
onQueryRefOptions,
|
|
1307
1171
|
lookupComponent,
|
|
1308
1172
|
Custom
|
|
1309
1173
|
});
|
|
@@ -1311,13 +1175,13 @@ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, loo
|
|
|
1311
1175
|
};
|
|
1312
1176
|
|
|
1313
1177
|
// packages/ui/react-ui-form/src/components/Form/Form.tsx
|
|
1314
|
-
var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel,
|
|
1178
|
+
var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, lookupComponent, Custom }) => {
|
|
1315
1179
|
const formRef = useRef3(null);
|
|
1316
1180
|
const onValid = useMemo6(() => autoSave ? onSave : void 0, [
|
|
1317
1181
|
autoSave,
|
|
1318
1182
|
onSave
|
|
1319
1183
|
]);
|
|
1320
|
-
|
|
1184
|
+
useEffect6(() => {
|
|
1321
1185
|
if (autoFocus && formRef.current) {
|
|
1322
1186
|
const input = formRef.current.querySelector("input");
|
|
1323
1187
|
if (input) {
|
|
@@ -1327,7 +1191,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
|
|
|
1327
1191
|
}, [
|
|
1328
1192
|
autoFocus
|
|
1329
1193
|
]);
|
|
1330
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ React12.createElement(FormProvider, {
|
|
1331
1195
|
formRef,
|
|
1332
1196
|
schema,
|
|
1333
1197
|
autoSave,
|
|
@@ -1336,37 +1200,36 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
|
|
|
1336
1200
|
onValidate,
|
|
1337
1201
|
onValid,
|
|
1338
1202
|
onSave
|
|
1339
|
-
}, /* @__PURE__ */
|
|
1203
|
+
}, /* @__PURE__ */ React12.createElement("div", {
|
|
1340
1204
|
ref: formRef,
|
|
1341
1205
|
role: "none",
|
|
1342
|
-
className:
|
|
1206
|
+
className: mx7("p-2", classNames),
|
|
1343
1207
|
"data-testid": testId
|
|
1344
|
-
}, /* @__PURE__ */
|
|
1208
|
+
}, /* @__PURE__ */ React12.createElement(FormFields, {
|
|
1345
1209
|
schema,
|
|
1346
1210
|
path,
|
|
1347
1211
|
readonly,
|
|
1348
1212
|
filter,
|
|
1349
1213
|
sort,
|
|
1350
|
-
onQueryRefOptions,
|
|
1351
1214
|
lookupComponent,
|
|
1352
1215
|
Custom
|
|
1353
|
-
}), (onCancel || onSave) && !autoSave && /* @__PURE__ */
|
|
1216
|
+
}), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React12.createElement(FormActions, {
|
|
1354
1217
|
onCancel,
|
|
1355
1218
|
readonly
|
|
1356
1219
|
})));
|
|
1357
1220
|
};
|
|
1358
1221
|
|
|
1359
1222
|
// packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
|
|
1360
|
-
var
|
|
1223
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
|
|
1361
1224
|
var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
1362
1225
|
const { t } = useTranslation6(translationKey);
|
|
1363
|
-
const [props, setProps] =
|
|
1364
|
-
|
|
1226
|
+
const [props, setProps] = useState4(projection.getFieldProjection(field.id).props);
|
|
1227
|
+
useEffect7(() => setProps(projection.getFieldProjection(field.id).props), [
|
|
1365
1228
|
field,
|
|
1366
1229
|
projection
|
|
1367
1230
|
]);
|
|
1368
|
-
const [schemas, setSchemas] =
|
|
1369
|
-
|
|
1231
|
+
const [schemas, setSchemas] = useState4([]);
|
|
1232
|
+
useEffect7(() => {
|
|
1370
1233
|
if (!registry) {
|
|
1371
1234
|
return;
|
|
1372
1235
|
}
|
|
@@ -1384,14 +1247,14 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1384
1247
|
}, [
|
|
1385
1248
|
registry
|
|
1386
1249
|
]);
|
|
1387
|
-
const [referenceSchema, setReferenceSchema] =
|
|
1388
|
-
|
|
1250
|
+
const [referenceSchema, setReferenceSchema] = useState4();
|
|
1251
|
+
useEffect7(() => {
|
|
1389
1252
|
setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
|
|
1390
1253
|
}, [
|
|
1391
1254
|
schemas,
|
|
1392
1255
|
props?.referenceSchema
|
|
1393
1256
|
]);
|
|
1394
|
-
const [{ fieldSchema }, setFieldSchema] =
|
|
1257
|
+
const [{ fieldSchema }, setFieldSchema] = useState4({
|
|
1395
1258
|
fieldSchema: getFormatSchema(props?.format)
|
|
1396
1259
|
});
|
|
1397
1260
|
const handleValuesChanged = useCallback6((_props) => {
|
|
@@ -1460,26 +1323,26 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1460
1323
|
onSave
|
|
1461
1324
|
]);
|
|
1462
1325
|
const Custom = useMemo7(() => ({
|
|
1463
|
-
["format"]: (props2) => /* @__PURE__ */
|
|
1326
|
+
["format"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
|
|
1464
1327
|
...props2,
|
|
1465
1328
|
options: FormatEnums.filter((value) => value !== FormatEnum2.None).map((value) => ({
|
|
1466
1329
|
value,
|
|
1467
1330
|
label: t(`format ${value}`)
|
|
1468
1331
|
}))
|
|
1469
1332
|
}),
|
|
1470
|
-
["referenceSchema"]: (props2) => /* @__PURE__ */
|
|
1333
|
+
["referenceSchema"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
|
|
1471
1334
|
...props2,
|
|
1472
1335
|
options: schemas.map((schema) => ({
|
|
1473
1336
|
value: schema.typename
|
|
1474
1337
|
}))
|
|
1475
1338
|
}),
|
|
1476
|
-
["referencePath"]: (props2) => /* @__PURE__ */
|
|
1339
|
+
["referencePath"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
|
|
1477
1340
|
...props2,
|
|
1478
1341
|
options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
|
|
1479
1342
|
value: p.name
|
|
1480
1343
|
})) : []
|
|
1481
1344
|
}),
|
|
1482
|
-
["options"]: (props2) => /* @__PURE__ */
|
|
1345
|
+
["options"]: (props2) => /* @__PURE__ */ React13.createElement(SelectOptionInput, props2)
|
|
1483
1346
|
}), [
|
|
1484
1347
|
t,
|
|
1485
1348
|
schemas,
|
|
@@ -1487,17 +1350,17 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1487
1350
|
]);
|
|
1488
1351
|
const propIsNotType = useCallback6((props2) => props2.filter((p) => p.name !== "type"), []);
|
|
1489
1352
|
if (!fieldSchema) {
|
|
1490
|
-
|
|
1353
|
+
log2.warn("invalid format", {
|
|
1491
1354
|
props
|
|
1492
1355
|
}, {
|
|
1493
|
-
F:
|
|
1356
|
+
F: __dxlog_file3,
|
|
1494
1357
|
L: 174,
|
|
1495
1358
|
S: void 0,
|
|
1496
1359
|
C: (f, a) => f(...a)
|
|
1497
1360
|
});
|
|
1498
1361
|
return null;
|
|
1499
1362
|
}
|
|
1500
|
-
return /* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ React13.createElement(Form, {
|
|
1501
1364
|
key: field.id,
|
|
1502
1365
|
autoFocus: true,
|
|
1503
1366
|
values: props,
|
|
@@ -1516,14 +1379,14 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
1516
1379
|
};
|
|
1517
1380
|
|
|
1518
1381
|
// packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
|
|
1519
|
-
import
|
|
1382
|
+
import React14, { useCallback as useCallback7, useMemo as useMemo8, useState as useState5 } from "react";
|
|
1520
1383
|
import { AST as AST4, Format, S as S2 } from "@dxos/echo-schema";
|
|
1521
1384
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1522
1385
|
import { IconButton as IconButton4, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1523
1386
|
import { List as List2 } from "@dxos/react-ui-list";
|
|
1524
|
-
import { ghostHover, inputTextLabel, mx as
|
|
1387
|
+
import { ghostHover, inputTextLabel, mx as mx8 } from "@dxos/react-ui-theme";
|
|
1525
1388
|
import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
|
|
1526
|
-
var
|
|
1389
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
1527
1390
|
var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
|
|
1528
1391
|
var ViewMetaSchema = S2.Struct({
|
|
1529
1392
|
name: S2.String.annotations({
|
|
@@ -1539,7 +1402,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1539
1402
|
schema,
|
|
1540
1403
|
view
|
|
1541
1404
|
]);
|
|
1542
|
-
const [field, setField] =
|
|
1405
|
+
const [field, setField] = useState5();
|
|
1543
1406
|
const viewValues = useMemo8(() => {
|
|
1544
1407
|
return {
|
|
1545
1408
|
name: view.name,
|
|
@@ -1555,7 +1418,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1555
1418
|
}, []);
|
|
1556
1419
|
const handleAdd = useCallback7(() => {
|
|
1557
1420
|
invariant3(!schema.readonly, void 0, {
|
|
1558
|
-
F:
|
|
1421
|
+
F: __dxlog_file4,
|
|
1559
1422
|
L: 76,
|
|
1560
1423
|
S: void 0,
|
|
1561
1424
|
A: [
|
|
@@ -1571,7 +1434,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1571
1434
|
]);
|
|
1572
1435
|
const handleUpdate = useCallback7(({ name, typename }) => {
|
|
1573
1436
|
invariant3(!schema.readonly, void 0, {
|
|
1574
|
-
F:
|
|
1437
|
+
F: __dxlog_file4,
|
|
1575
1438
|
L: 83,
|
|
1576
1439
|
S: void 0,
|
|
1577
1440
|
A: [
|
|
@@ -1594,7 +1457,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1594
1457
|
]);
|
|
1595
1458
|
const handleDelete = useCallback7((fieldId) => {
|
|
1596
1459
|
invariant3(!schema.readonly, void 0, {
|
|
1597
|
-
F:
|
|
1460
|
+
F: __dxlog_file4,
|
|
1598
1461
|
L: 99,
|
|
1599
1462
|
S: void 0,
|
|
1600
1463
|
A: [
|
|
@@ -1613,7 +1476,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1613
1476
|
]);
|
|
1614
1477
|
const handleMove = useCallback7((fromIndex, toIndex) => {
|
|
1615
1478
|
invariant3(!schema.readonly, void 0, {
|
|
1616
|
-
F:
|
|
1479
|
+
F: __dxlog_file4,
|
|
1617
1480
|
L: 111,
|
|
1618
1481
|
S: void 0,
|
|
1619
1482
|
A: [
|
|
@@ -1645,77 +1508,77 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
1645
1508
|
}, [
|
|
1646
1509
|
projection
|
|
1647
1510
|
]);
|
|
1648
|
-
return /* @__PURE__ */
|
|
1511
|
+
return /* @__PURE__ */ React14.createElement("div", {
|
|
1649
1512
|
role: "none",
|
|
1650
|
-
className:
|
|
1651
|
-
}, /* @__PURE__ */
|
|
1513
|
+
className: mx8("flex flex-col w-full divide-y divide-separator", classNames)
|
|
1514
|
+
}, /* @__PURE__ */ React14.createElement(Form, {
|
|
1652
1515
|
autoSave: true,
|
|
1653
1516
|
schema: ViewMetaSchema,
|
|
1654
1517
|
values: viewValues,
|
|
1655
1518
|
onSave: schema.readonly ? void 0 : handleUpdate
|
|
1656
|
-
}), /* @__PURE__ */
|
|
1519
|
+
}), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
|
|
1657
1520
|
role: "none",
|
|
1658
1521
|
className: "p-2"
|
|
1659
|
-
}, /* @__PURE__ */
|
|
1660
|
-
className:
|
|
1661
|
-
}, t("fields label"))), /* @__PURE__ */
|
|
1522
|
+
}, /* @__PURE__ */ React14.createElement("label", {
|
|
1523
|
+
className: mx8(inputTextLabel)
|
|
1524
|
+
}, t("fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
|
|
1662
1525
|
items: view.fields,
|
|
1663
1526
|
isItem: S2.is(FieldSchema),
|
|
1664
1527
|
getId: (field2) => field2.id,
|
|
1665
1528
|
onMove: schema.readonly ? void 0 : handleMove
|
|
1666
|
-
}, ({ items: fields }) => /* @__PURE__ */
|
|
1529
|
+
}, ({ items: fields }) => /* @__PURE__ */ React14.createElement(React14.Fragment, null, showHeading && /* @__PURE__ */ React14.createElement("div", {
|
|
1667
1530
|
role: "heading",
|
|
1668
1531
|
className: grid
|
|
1669
|
-
}, /* @__PURE__ */
|
|
1532
|
+
}, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement("div", {
|
|
1670
1533
|
className: "flex items-center text-sm"
|
|
1671
|
-
}, t("field path label"))), /* @__PURE__ */
|
|
1534
|
+
}, t("field path label"))), /* @__PURE__ */ React14.createElement("div", {
|
|
1672
1535
|
role: "list",
|
|
1673
1536
|
className: "flex flex-col w-full"
|
|
1674
|
-
}, fields?.map((field2) => /* @__PURE__ */
|
|
1537
|
+
}, fields?.map((field2) => /* @__PURE__ */ React14.createElement(List2.Item, {
|
|
1675
1538
|
key: field2.id,
|
|
1676
1539
|
item: field2,
|
|
1677
|
-
classNames:
|
|
1678
|
-
}, /* @__PURE__ */
|
|
1540
|
+
classNames: mx8(grid, ghostHover, "cursor-pointer")
|
|
1541
|
+
}, /* @__PURE__ */ React14.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, {
|
|
1679
1542
|
onClick: () => handleSelect(field2)
|
|
1680
|
-
}, field2.path), /* @__PURE__ */
|
|
1543
|
+
}, field2.path), /* @__PURE__ */ React14.createElement("div", {
|
|
1681
1544
|
className: "flex items-center gap-2 -ml-4"
|
|
1682
|
-
}, /* @__PURE__ */
|
|
1545
|
+
}, /* @__PURE__ */ React14.createElement(List2.ItemButton, {
|
|
1683
1546
|
icon: "ph--eye-slash--regular",
|
|
1684
1547
|
disabled: view.fields.length <= 1,
|
|
1685
1548
|
onClick: () => handleHide(field2.id)
|
|
1686
|
-
}), !schema.readonly && /* @__PURE__ */
|
|
1549
|
+
}), !schema.readonly && /* @__PURE__ */ React14.createElement(List2.ItemDeleteButton, {
|
|
1687
1550
|
icon: "ph--trash--regular",
|
|
1688
1551
|
disabled: view.fields.length <= 1,
|
|
1689
1552
|
onClick: () => handleDelete(field2.id)
|
|
1690
|
-
}))))))), hiddenProperties.length > 0 && /* @__PURE__ */
|
|
1553
|
+
}))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
|
|
1691
1554
|
role: "none",
|
|
1692
1555
|
className: "p-2"
|
|
1693
|
-
}, /* @__PURE__ */
|
|
1694
|
-
className:
|
|
1695
|
-
}, t("hidden fields label"))), /* @__PURE__ */
|
|
1556
|
+
}, /* @__PURE__ */ React14.createElement("label", {
|
|
1557
|
+
className: mx8(inputTextLabel)
|
|
1558
|
+
}, t("hidden fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
|
|
1696
1559
|
items: hiddenProperties,
|
|
1697
1560
|
isItem: (item) => typeof item === "string",
|
|
1698
1561
|
getId: (property) => property
|
|
1699
|
-
}, ({ items: properties }) => /* @__PURE__ */
|
|
1562
|
+
}, ({ items: properties }) => /* @__PURE__ */ React14.createElement("div", {
|
|
1700
1563
|
role: "list",
|
|
1701
1564
|
className: "flex flex-col w-full"
|
|
1702
|
-
}, properties?.map((property) => /* @__PURE__ */
|
|
1565
|
+
}, properties?.map((property) => /* @__PURE__ */ React14.createElement(List2.Item, {
|
|
1703
1566
|
key: property,
|
|
1704
1567
|
item: property,
|
|
1705
|
-
classNames:
|
|
1706
|
-
}, /* @__PURE__ */
|
|
1568
|
+
classNames: mx8(grid, ghostHover, "cursor-pointer")
|
|
1569
|
+
}, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React14.createElement(List2.ItemButton, {
|
|
1707
1570
|
icon: "ph--eye--regular",
|
|
1708
1571
|
onClick: () => handleShow(property)
|
|
1709
|
-
}))))))), field && /* @__PURE__ */
|
|
1572
|
+
}))))))), field && /* @__PURE__ */ React14.createElement(FieldEditor, {
|
|
1710
1573
|
key: field.id,
|
|
1711
1574
|
view,
|
|
1712
1575
|
projection,
|
|
1713
1576
|
field,
|
|
1714
1577
|
registry,
|
|
1715
1578
|
onSave: handleClose
|
|
1716
|
-
}), !readonly && !field && /* @__PURE__ */
|
|
1579
|
+
}), !readonly && !field && /* @__PURE__ */ React14.createElement("div", {
|
|
1717
1580
|
className: "flex p-2 justify-center"
|
|
1718
|
-
}, /* @__PURE__ */
|
|
1581
|
+
}, /* @__PURE__ */ React14.createElement(IconButton4, {
|
|
1719
1582
|
icon: "ph--plus--regular",
|
|
1720
1583
|
label: t("button add property"),
|
|
1721
1584
|
onClick: schema.readonly ? void 0 : handleAdd,
|
|
@@ -1900,25 +1763,13 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
|
1900
1763
|
});
|
|
1901
1764
|
}
|
|
1902
1765
|
case FormatEnum4.Date: {
|
|
1903
|
-
|
|
1904
|
-
return formatDate(new Date(value), "yyyy-MM-dd");
|
|
1905
|
-
} catch (error) {
|
|
1906
|
-
return "Invalid Date";
|
|
1907
|
-
}
|
|
1766
|
+
return formatDate(new Date(value), "yyyy-MM-dd");
|
|
1908
1767
|
}
|
|
1909
1768
|
case FormatEnum4.Time: {
|
|
1910
|
-
|
|
1911
|
-
return formatDate(new Date(value), "HH:mm:ss");
|
|
1912
|
-
} catch (error) {
|
|
1913
|
-
return "Invalid Time";
|
|
1914
|
-
}
|
|
1769
|
+
return formatDate(new Date(value), "HH:mm:ss");
|
|
1915
1770
|
}
|
|
1916
1771
|
case FormatEnum4.DateTime: {
|
|
1917
|
-
|
|
1918
|
-
return formatDate(new Date(value), "yyyy-MM-dd HH:mm:ss");
|
|
1919
|
-
} catch (error) {
|
|
1920
|
-
return "Invalid DateTime";
|
|
1921
|
-
}
|
|
1772
|
+
return formatDate(new Date(value), "yyyy-MM-dd HH:mm:ss");
|
|
1922
1773
|
}
|
|
1923
1774
|
case FormatEnum4.GeoPoint: {
|
|
1924
1775
|
if (value === null || value === void 0) {
|
|
@@ -1998,10 +1849,8 @@ export {
|
|
|
1998
1849
|
ControlFrame,
|
|
1999
1850
|
ControlFrameItem,
|
|
2000
1851
|
ControlGroup,
|
|
2001
|
-
ControlGroupButton,
|
|
2002
1852
|
ControlItem,
|
|
2003
1853
|
ControlItemInput,
|
|
2004
|
-
ControlPage,
|
|
2005
1854
|
ControlSection,
|
|
2006
1855
|
ControlSectionHeading,
|
|
2007
1856
|
DeprecatedFormContainer,
|