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