@dxos/react-ui-form 0.8.3 → 0.8.4-main.84f28bd
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 +40 -40
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +40 -40
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +1 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts +1 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +56 -57
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -32
- package/src/components/ControlSection/ControlSection.stories.tsx +2 -2
- package/src/components/FieldEditor/FieldEditor.stories.tsx +2 -2
- package/src/components/Form/Form.stories.tsx +2 -2
- package/src/components/Form/RefField.tsx +1 -1
- package/src/components/Form/custom/SelectOptionsInput.stories.tsx +2 -2
- package/src/components/ViewEditor/ViewEditor.stories.tsx +2 -2
- package/src/components/ViewEditor/ViewEditor.test.tsx +23 -23
- package/src/components/deprecated/Form.stories.tsx +2 -2
- package/src/components/testing.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/translations.ts +4 -2
- package/dist/lib/node/index.cjs +0 -2416
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/types/src/components/ViewEditor/Test.stories.d.ts +0 -10
- package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +0 -1
- package/src/components/ViewEditor/Test.stories.tsx +0 -45
package/dist/lib/node/index.cjs
DELETED
|
@@ -1,2416 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var node_exports = {};
|
|
30
|
-
__export(node_exports, {
|
|
31
|
-
BooleanInput: () => BooleanInput,
|
|
32
|
-
ControlFrame: () => ControlFrame,
|
|
33
|
-
ControlFrameItem: () => ControlFrameItem,
|
|
34
|
-
ControlGroup: () => ControlGroup,
|
|
35
|
-
ControlGroupButton: () => ControlGroupButton,
|
|
36
|
-
ControlItem: () => ControlItem,
|
|
37
|
-
ControlItemInput: () => ControlItemInput,
|
|
38
|
-
ControlPage: () => ControlPage,
|
|
39
|
-
ControlSection: () => ControlSection,
|
|
40
|
-
ControlSectionHeading: () => ControlSectionHeading,
|
|
41
|
-
DeprecatedFormContainer: () => DeprecatedFormContainer,
|
|
42
|
-
DeprecatedFormInput: () => DeprecatedFormInput,
|
|
43
|
-
FieldEditor: () => FieldEditor,
|
|
44
|
-
Form: () => Form,
|
|
45
|
-
FormProvider: () => FormProvider,
|
|
46
|
-
GeoPointInput: () => GeoPointInput,
|
|
47
|
-
InputHeader: () => InputHeader,
|
|
48
|
-
MarkdownInput: () => MarkdownInput,
|
|
49
|
-
NumberInput: () => NumberInput,
|
|
50
|
-
SelectInput: () => SelectInput,
|
|
51
|
-
SelectOptionInput: () => SelectOptionInput,
|
|
52
|
-
TextInput: () => TextInput,
|
|
53
|
-
TupleInput: () => TupleInput,
|
|
54
|
-
ViewEditor: () => ViewEditor,
|
|
55
|
-
cellClassesForFieldType: () => cellClassesForFieldType,
|
|
56
|
-
controlItemClasses: () => controlItemClasses,
|
|
57
|
-
findArrayElementType: () => findArrayElementType,
|
|
58
|
-
formatForDisplay: () => formatForDisplay,
|
|
59
|
-
formatForEditing: () => formatForEditing,
|
|
60
|
-
getRefProps: () => getRefProps,
|
|
61
|
-
parseValue: () => parseValue,
|
|
62
|
-
pathNotUniqueError: () => pathNotUniqueError,
|
|
63
|
-
translations: () => translations_default,
|
|
64
|
-
useForm: () => useForm,
|
|
65
|
-
useFormContext: () => useFormContext,
|
|
66
|
-
useFormValues: () => useFormValues,
|
|
67
|
-
useInputProps: () => useInputProps,
|
|
68
|
-
useQueryRefOptions: () => useQueryRefOptions,
|
|
69
|
-
useRefQueryLookupHandler: () => useRefQueryLookupHandler
|
|
70
|
-
});
|
|
71
|
-
module.exports = __toCommonJS(node_exports);
|
|
72
|
-
var import_tracking = require("@preact-signals/safe-react/tracking");
|
|
73
|
-
var import_react = __toESM(require("react"));
|
|
74
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
75
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
76
|
-
var import_tracking2 = require("@preact-signals/safe-react/tracking");
|
|
77
|
-
var import_react2 = __toESM(require("react"));
|
|
78
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
79
|
-
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
80
|
-
var import_tracking3 = require("@preact-signals/safe-react/tracking");
|
|
81
|
-
var import_react3 = __toESM(require("react"));
|
|
82
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
83
|
-
var import_log = require("@dxos/log");
|
|
84
|
-
var import_react_ui3 = require("@dxos/react-ui");
|
|
85
|
-
var import_schema = require("@dxos/schema");
|
|
86
|
-
var import_tracking4 = require("@preact-signals/safe-react/tracking");
|
|
87
|
-
var import_react4 = __toESM(require("react"));
|
|
88
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
89
|
-
var import_react_ui4 = require("@dxos/react-ui");
|
|
90
|
-
var import_util = require("@dxos/util");
|
|
91
|
-
var import_tracking5 = require("@preact-signals/safe-react/tracking");
|
|
92
|
-
var import_react5 = __toESM(require("react"));
|
|
93
|
-
var import_react_ui5 = require("@dxos/react-ui");
|
|
94
|
-
var import_react_ui_stack = require("@dxos/react-ui-stack");
|
|
95
|
-
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
96
|
-
var import_tracking6 = require("@preact-signals/safe-react/tracking");
|
|
97
|
-
var import_react6 = __toESM(require("react"));
|
|
98
|
-
var import_keys = require("@dxos/keys");
|
|
99
|
-
var import_react_ui6 = require("@dxos/react-ui");
|
|
100
|
-
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
101
|
-
var import_react_ui_pickers = require("@dxos/react-ui-pickers");
|
|
102
|
-
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
103
|
-
var import_tracking7 = require("@preact-signals/safe-react/tracking");
|
|
104
|
-
var import_react7 = __toESM(require("react"));
|
|
105
|
-
var import_react_ui7 = require("@dxos/react-ui");
|
|
106
|
-
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
107
|
-
var import_util2 = require("@dxos/util");
|
|
108
|
-
var import_tracking8 = require("@preact-signals/safe-react/tracking");
|
|
109
|
-
var import_react8 = __toESM(require("react"));
|
|
110
|
-
var import_react_ui8 = require("@dxos/react-ui");
|
|
111
|
-
var import_tracking9 = require("@preact-signals/safe-react/tracking");
|
|
112
|
-
var import_react9 = __toESM(require("react"));
|
|
113
|
-
var import_react_ui_stack2 = require("@dxos/react-ui-stack");
|
|
114
|
-
var import_tracking10 = require("@preact-signals/safe-react/tracking");
|
|
115
|
-
var import_react10 = __toESM(require("react"));
|
|
116
|
-
var import_react_ui9 = require("@dxos/react-ui");
|
|
117
|
-
var import_react_ui_stack3 = require("@dxos/react-ui-stack");
|
|
118
|
-
var import_react_ui_theme6 = require("@dxos/react-ui-theme");
|
|
119
|
-
var import_tracking11 = require("@preact-signals/safe-react/tracking");
|
|
120
|
-
var import_react11 = __toESM(require("react"));
|
|
121
|
-
var import_debug = require("@dxos/debug");
|
|
122
|
-
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
123
|
-
var import_effect = require("@dxos/effect");
|
|
124
|
-
var import_effect2 = require("effect");
|
|
125
|
-
var import_react12 = require("react");
|
|
126
|
-
var import_echo_schema4 = require("@dxos/echo-schema");
|
|
127
|
-
var import_effect3 = require("@dxos/effect");
|
|
128
|
-
var import_invariant = require("@dxos/invariant");
|
|
129
|
-
var import_log2 = require("@dxos/log");
|
|
130
|
-
var import_schema2 = require("@dxos/schema");
|
|
131
|
-
var import_react13 = require("react");
|
|
132
|
-
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
133
|
-
var import_echo = require("@dxos/react-client/echo");
|
|
134
|
-
var import_util3 = require("@dxos/util");
|
|
135
|
-
var import_react14 = require("react");
|
|
136
|
-
var import_log3 = require("@dxos/log");
|
|
137
|
-
var import_tracking12 = require("@preact-signals/safe-react/tracking");
|
|
138
|
-
var import_effect4 = require("effect");
|
|
139
|
-
var import_String = require("effect/String");
|
|
140
|
-
var import_react15 = __toESM(require("react"));
|
|
141
|
-
var import_effect5 = require("@dxos/effect");
|
|
142
|
-
var import_react_ui_theme7 = require("@dxos/react-ui-theme");
|
|
143
|
-
var import_schema3 = require("@dxos/schema");
|
|
144
|
-
var import_util4 = require("@dxos/util");
|
|
145
|
-
var import_tracking13 = require("@preact-signals/safe-react/tracking");
|
|
146
|
-
var import_effect6 = require("effect");
|
|
147
|
-
var import_String2 = require("effect/String");
|
|
148
|
-
var import_react16 = __toESM(require("react"));
|
|
149
|
-
var import_effect7 = require("@dxos/effect");
|
|
150
|
-
var import_invariant2 = require("@dxos/invariant");
|
|
151
|
-
var import_react_ui10 = require("@dxos/react-ui");
|
|
152
|
-
var import_schema4 = require("@dxos/schema");
|
|
153
|
-
var import_echo_schema6 = require("@dxos/echo-schema");
|
|
154
|
-
var import_format = require("date-fns/format");
|
|
155
|
-
var import_echo_schema7 = require("@dxos/echo-schema");
|
|
156
|
-
var import_echo_schema8 = require("@dxos/echo-schema");
|
|
157
|
-
var import_effect8 = require("@dxos/effect");
|
|
158
|
-
var import_effect9 = require("effect");
|
|
159
|
-
var import_effect10 = require("@dxos/effect");
|
|
160
|
-
var import_tracking14 = require("@preact-signals/safe-react/tracking");
|
|
161
|
-
var import_react17 = __toESM(require("react"));
|
|
162
|
-
var import_echo_schema9 = require("@dxos/echo-schema");
|
|
163
|
-
var import_effect11 = require("@dxos/effect");
|
|
164
|
-
var import_keys2 = require("@dxos/keys");
|
|
165
|
-
var import_react18 = require("@dxos/lit-ui/react");
|
|
166
|
-
var import_react_ui11 = require("@dxos/react-ui");
|
|
167
|
-
var import_react_ui_tag_picker = require("@dxos/react-ui-tag-picker");
|
|
168
|
-
var import_react_ui_theme8 = require("@dxos/react-ui-theme");
|
|
169
|
-
var import_util5 = require("@dxos/util");
|
|
170
|
-
var import_echo_schema10 = require("@dxos/echo-schema");
|
|
171
|
-
var import_tracking15 = require("@preact-signals/safe-react/tracking");
|
|
172
|
-
var import_effect12 = require("effect");
|
|
173
|
-
var import_react19 = __toESM(require("react"));
|
|
174
|
-
var import_echo_schema11 = require("@dxos/echo-schema");
|
|
175
|
-
var import_invariant3 = require("@dxos/invariant");
|
|
176
|
-
var import_react_ui12 = require("@dxos/react-ui");
|
|
177
|
-
var import_react_ui_list2 = require("@dxos/react-ui-list");
|
|
178
|
-
var import_react_ui_stack4 = require("@dxos/react-ui-stack");
|
|
179
|
-
var import_react_ui_theme9 = require("@dxos/react-ui-theme");
|
|
180
|
-
var import_schema5 = require("@dxos/schema");
|
|
181
|
-
var translationKey = "react-ui-form";
|
|
182
|
-
var translations_default = [
|
|
183
|
-
{
|
|
184
|
-
"en-US": {
|
|
185
|
-
[translationKey]: {
|
|
186
|
-
"fields label": "Fields",
|
|
187
|
-
"hidden fields label": "Hidden Fields",
|
|
188
|
-
"empty readonly ref field label": "(none)",
|
|
189
|
-
// TODO(burdon): Standardize field/property.
|
|
190
|
-
"button add property": "Add property",
|
|
191
|
-
"field property label": "Property",
|
|
192
|
-
"field property placeholder": "Property name",
|
|
193
|
-
"field format label": "Type",
|
|
194
|
-
"field path label": "Field path",
|
|
195
|
-
"add field": "Add field",
|
|
196
|
-
"delete field": "Delete field",
|
|
197
|
-
"field limit reached": "Maximum number of fields reached",
|
|
198
|
-
"boolean input true value": "Yes",
|
|
199
|
-
"boolean input false value": "No",
|
|
200
|
-
// TODO(burdon): Factor out?
|
|
201
|
-
"button cancel": "Cancel",
|
|
202
|
-
"button save": "Save",
|
|
203
|
-
// FormatEnum
|
|
204
|
-
"format boolean": "Boolean",
|
|
205
|
-
"format currency": "Currency",
|
|
206
|
-
"format date": "Date",
|
|
207
|
-
"format date-time": "DateTime",
|
|
208
|
-
"format did": "DID",
|
|
209
|
-
"format duration": "Duration",
|
|
210
|
-
"format dxn": "DXN",
|
|
211
|
-
"format email": "Email",
|
|
212
|
-
"format formula": "Formula",
|
|
213
|
-
"format hostname": "Hostname",
|
|
214
|
-
"format integer": "Integer",
|
|
215
|
-
"format json": "JSON",
|
|
216
|
-
"format latlng": "Geopoint",
|
|
217
|
-
"format markdown": "Markdown",
|
|
218
|
-
"format percent": "Percent",
|
|
219
|
-
"format ref": "Reference",
|
|
220
|
-
"format regex": "RegExp",
|
|
221
|
-
"format string": "String",
|
|
222
|
-
"format single-select": "Select",
|
|
223
|
-
"format multi-select": "Multi-select",
|
|
224
|
-
"format text": "Long text",
|
|
225
|
-
"format time": "Time",
|
|
226
|
-
"format timestamp": "Timestamp",
|
|
227
|
-
"format user": "User",
|
|
228
|
-
"format number": "Number",
|
|
229
|
-
"format uri": "URI",
|
|
230
|
-
"format url": "URL",
|
|
231
|
-
"format uuid": "UUID",
|
|
232
|
-
// Placeholders.
|
|
233
|
-
"placeholder latitude": "Latitude",
|
|
234
|
-
"placeholder longitude": "Longitude",
|
|
235
|
-
// SelectOptionsInput.
|
|
236
|
-
"select option label": "Label",
|
|
237
|
-
"select option label placeholder": "Option label",
|
|
238
|
-
"select option color": "Color",
|
|
239
|
-
"select option delete": "Delete",
|
|
240
|
-
"select option add": "Add option",
|
|
241
|
-
// System schema message.
|
|
242
|
-
"system schema title": "System Schema",
|
|
243
|
-
"system schema description": "This is a system schema and cannot be modified."
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
];
|
|
248
|
-
var DeprecatedFormContainer = ({ children, classNames }) => {
|
|
249
|
-
var _effect = (0, import_tracking.useSignals)();
|
|
250
|
-
try {
|
|
251
|
-
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
252
|
-
role: "none",
|
|
253
|
-
className: "container-max-width p-4 justify-center overflow-x-hidden overflow-y-auto"
|
|
254
|
-
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
255
|
-
role: "form",
|
|
256
|
-
className: (0, import_react_ui_theme.mx)("flex flex-col", import_react_ui_theme.textBlockWidth, classNames)
|
|
257
|
-
}, children));
|
|
258
|
-
} finally {
|
|
259
|
-
_effect.f();
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
var DeprecatedFormInput = ({ label, description, secondary, children }) => {
|
|
263
|
-
var _effect = (0, import_tracking.useSignals)();
|
|
264
|
-
try {
|
|
265
|
-
const primary = /* @__PURE__ */ import_react.default.createElement("div", {
|
|
266
|
-
role: "none",
|
|
267
|
-
className: "flex w-full gap-4 py-1"
|
|
268
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
269
|
-
role: "none",
|
|
270
|
-
className: "flex flex-col w-full"
|
|
271
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Label, {
|
|
272
|
-
classNames: "flex min-bs-[--rail-action] items-center",
|
|
273
|
-
style: {
|
|
274
|
-
fontSize: "unset"
|
|
275
|
-
}
|
|
276
|
-
}, label), description && /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.DescriptionAndValidation, {
|
|
277
|
-
classNames: "mbs-0.5"
|
|
278
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Description, null, description))), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
279
|
-
role: "none"
|
|
280
|
-
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
281
|
-
role: "none",
|
|
282
|
-
className: "flex min-bs-[--rail-action] items-center"
|
|
283
|
-
}, children))));
|
|
284
|
-
if (secondary) {
|
|
285
|
-
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
286
|
-
role: "none"
|
|
287
|
-
}, primary, secondary);
|
|
288
|
-
}
|
|
289
|
-
return primary;
|
|
290
|
-
} finally {
|
|
291
|
-
_effect.f();
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
var ControlPage = ({ children, classNames, ...props }) => {
|
|
295
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
296
|
-
try {
|
|
297
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
298
|
-
role: "none",
|
|
299
|
-
className: (0, import_react_ui_theme2.mx)("pli-cardSpacingInline", classNames),
|
|
300
|
-
...props
|
|
301
|
-
}, children);
|
|
302
|
-
} finally {
|
|
303
|
-
_effect.f();
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
var ControlSection = ({ title, description, children }) => {
|
|
307
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
308
|
-
try {
|
|
309
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(ControlSectionHeading, {
|
|
310
|
-
title,
|
|
311
|
-
description
|
|
312
|
-
}), children);
|
|
313
|
-
} finally {
|
|
314
|
-
_effect.f();
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
var ControlSectionHeading = ({ title, description }) => {
|
|
318
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
319
|
-
try {
|
|
320
|
-
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
321
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("h2", {
|
|
322
|
-
className: "pli-trimMd container-max-width text-xl mbs-trimLg mbe-trimMd"
|
|
323
|
-
}, (0, import_react_ui2.toLocalizedString)(title, t)), description && /* @__PURE__ */ import_react2.default.createElement("p", {
|
|
324
|
-
className: "pli-trimMd mlb-trimMd container-max-width text-description"
|
|
325
|
-
}, (0, import_react_ui2.toLocalizedString)(description, t)));
|
|
326
|
-
} finally {
|
|
327
|
-
_effect.f();
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
var ControlGroupButton = ({ classNames, ...props }) => {
|
|
331
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
332
|
-
try {
|
|
333
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Button, {
|
|
334
|
-
...props,
|
|
335
|
-
classNames: [
|
|
336
|
-
"md:col-span-2",
|
|
337
|
-
classNames
|
|
338
|
-
]
|
|
339
|
-
});
|
|
340
|
-
} finally {
|
|
341
|
-
_effect.f();
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
var ControlGroup = ({ children, classNames }) => {
|
|
345
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
346
|
-
try {
|
|
347
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
348
|
-
role: "none",
|
|
349
|
-
className: (0, import_react_ui_theme2.mx)("group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-trimMd", classNames)
|
|
350
|
-
}, children);
|
|
351
|
-
} finally {
|
|
352
|
-
_effect.f();
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
var ControlFrame = ({ children }) => {
|
|
356
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
357
|
-
try {
|
|
358
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
359
|
-
role: "none",
|
|
360
|
-
className: "p-trimMd container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-trimSm md:gap-trimMd border border-separator rounded-md"
|
|
361
|
-
}, children);
|
|
362
|
-
} finally {
|
|
363
|
-
_effect.f();
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
var controlItemClasses = "pli-trimMd plb-trimMd container-max-width grid md:col-span-2 grid-cols-subgrid items-center gap-trimSm border border-separator rounded-md *:first:!mbs-0 *:last:!mbe-0";
|
|
367
|
-
var controlItemTitleClasses = "text-lg font-normal";
|
|
368
|
-
var controlItemDescriptionClasses = "text-base mlb-trimSm md:mbe-0 text-description";
|
|
369
|
-
var ControlItem = ({ title, description, children }) => {
|
|
370
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
371
|
-
try {
|
|
372
|
-
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
373
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
374
|
-
className: controlItemClasses
|
|
375
|
-
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
376
|
-
role: "none"
|
|
377
|
-
}, /* @__PURE__ */ import_react2.default.createElement("h3", {
|
|
378
|
-
className: controlItemTitleClasses
|
|
379
|
-
}, (0, import_react_ui2.toLocalizedString)(title, t)), description && /* @__PURE__ */ import_react2.default.createElement("p", {
|
|
380
|
-
className: controlItemDescriptionClasses
|
|
381
|
-
}, (0, import_react_ui2.toLocalizedString)(description, t))), children);
|
|
382
|
-
} finally {
|
|
383
|
-
_effect.f();
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var ControlItemInput = ({ title, description, children }) => {
|
|
387
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
388
|
-
try {
|
|
389
|
-
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
390
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
391
|
-
className: controlItemClasses
|
|
392
|
-
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
393
|
-
role: "none"
|
|
394
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.Label, {
|
|
395
|
-
classNames: controlItemTitleClasses
|
|
396
|
-
}, (0, import_react_ui2.toLocalizedString)(title, t)), description && /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.DescriptionAndValidation, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.Description, {
|
|
397
|
-
classNames: controlItemDescriptionClasses
|
|
398
|
-
}, (0, import_react_ui2.toLocalizedString)(description, t)))), children));
|
|
399
|
-
} finally {
|
|
400
|
-
_effect.f();
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
var ControlFrameItem = ({ title, description, children }) => {
|
|
404
|
-
var _effect = (0, import_tracking2.useSignals)();
|
|
405
|
-
try {
|
|
406
|
-
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
407
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
408
|
-
role: "group",
|
|
409
|
-
className: "min-is-0"
|
|
410
|
-
}, /* @__PURE__ */ import_react2.default.createElement("h3", {
|
|
411
|
-
className: "text-lg mbe-2"
|
|
412
|
-
}, (0, import_react_ui2.toLocalizedString)(title, t)), description && /* @__PURE__ */ import_react2.default.createElement("p", {
|
|
413
|
-
className: "mlb-trimSm md:mbe-0 text-description"
|
|
414
|
-
}, (0, import_react_ui2.toLocalizedString)(description, t)), children);
|
|
415
|
-
} finally {
|
|
416
|
-
_effect.f();
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
var InputHeader = ({ error, label, readonly }) => {
|
|
420
|
-
var _effect = (0, import_tracking5.useSignals)();
|
|
421
|
-
try {
|
|
422
|
-
const Label = readonly ? "span" : import_react_ui5.Input.Label;
|
|
423
|
-
const labelProps = readonly ? {} : {
|
|
424
|
-
classNames: "!mlb-0"
|
|
425
|
-
};
|
|
426
|
-
return /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
427
|
-
role: "none",
|
|
428
|
-
className: (0, import_react_ui_theme3.mx)("flex justify-between items-center", import_react_ui_stack.labelSpacing)
|
|
429
|
-
}, /* @__PURE__ */ import_react5.default.createElement(Label, labelProps, label), error && /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Tooltip.Trigger, {
|
|
430
|
-
asChild: true,
|
|
431
|
-
content: error,
|
|
432
|
-
side: "bottom"
|
|
433
|
-
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Icon, {
|
|
434
|
-
icon: "ph--warning--regular",
|
|
435
|
-
size: 4,
|
|
436
|
-
classNames: import_react_ui_theme3.errorText
|
|
437
|
-
})));
|
|
438
|
-
} finally {
|
|
439
|
-
_effect.f();
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
443
|
-
var _effect = (0, import_tracking4.useSignals)();
|
|
444
|
-
try {
|
|
445
|
-
const { t } = (0, import_react_ui4.useTranslation)(translationKey);
|
|
446
|
-
const { status, error } = getStatus();
|
|
447
|
-
const geoPoint = (0, import_react4.useMemo)(() => getValue3() ?? [
|
|
448
|
-
0,
|
|
449
|
-
0
|
|
450
|
-
], [
|
|
451
|
-
getValue3
|
|
452
|
-
]);
|
|
453
|
-
const geoLocation = (0, import_react4.useMemo)(() => import_echo_schema2.GeoLocation.fromGeoPoint(geoPoint), [
|
|
454
|
-
geoPoint
|
|
455
|
-
]);
|
|
456
|
-
const [longitudeText, setLongitudeText] = (0, import_react4.useState)(geoLocation.longitude?.toString());
|
|
457
|
-
const [latitudeText, setLatitudeText] = (0, import_react4.useState)(geoLocation.latitude?.toString());
|
|
458
|
-
(0, import_react4.useEffect)(() => {
|
|
459
|
-
const location = import_echo_schema2.GeoLocation.fromGeoPoint(geoPoint);
|
|
460
|
-
setLongitudeText(location.longitude.toString());
|
|
461
|
-
setLatitudeText(location.latitude.toString());
|
|
462
|
-
}, [
|
|
463
|
-
geoPoint
|
|
464
|
-
]);
|
|
465
|
-
const handleCoordinateChange = (0, import_react4.useCallback)((coordinateType, setText) => (event) => {
|
|
466
|
-
const inputText = event.target.value;
|
|
467
|
-
setText(inputText);
|
|
468
|
-
if (inputText !== "" && inputText !== "-") {
|
|
469
|
-
const coord = (0, import_util.safeParseFloat)(inputText);
|
|
470
|
-
if (coord !== void 0 && !isNaN(coord)) {
|
|
471
|
-
const currentLocation = import_echo_schema2.GeoLocation.fromGeoPoint(getValue3() ?? [
|
|
472
|
-
0,
|
|
473
|
-
0
|
|
474
|
-
]);
|
|
475
|
-
const newLocation = {
|
|
476
|
-
...currentLocation,
|
|
477
|
-
[coordinateType]: coord
|
|
478
|
-
};
|
|
479
|
-
const newValue = import_echo_schema2.GeoLocation.toGeoPoint(newLocation);
|
|
480
|
-
onValueChange(type, newValue);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}, [
|
|
484
|
-
getValue3,
|
|
485
|
-
onValueChange,
|
|
486
|
-
type
|
|
487
|
-
]);
|
|
488
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Input.Root, {
|
|
489
|
-
validationValence: status
|
|
490
|
-
}, /* @__PURE__ */ import_react4.default.createElement(InputHeader, {
|
|
491
|
-
error,
|
|
492
|
-
label
|
|
493
|
-
}), /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
494
|
-
role: "none",
|
|
495
|
-
className: "grid grid-cols-2 gap-2"
|
|
496
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Input.TextInput, {
|
|
497
|
-
type: "text",
|
|
498
|
-
pattern: "^-?[0-9]*\\.?[0-9]*$",
|
|
499
|
-
disabled,
|
|
500
|
-
placeholder: t("placeholder latitude"),
|
|
501
|
-
value: latitudeText,
|
|
502
|
-
onChange: handleCoordinateChange("latitude", setLatitudeText),
|
|
503
|
-
onBlur
|
|
504
|
-
}), /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Input.TextInput, {
|
|
505
|
-
type: "text",
|
|
506
|
-
pattern: "^-?[0-9]*\\.?[0-9]*$",
|
|
507
|
-
disabled,
|
|
508
|
-
placeholder: t("placeholder longitude"),
|
|
509
|
-
value: longitudeText,
|
|
510
|
-
onChange: handleCoordinateChange("longitude", setLongitudeText),
|
|
511
|
-
onBlur
|
|
512
|
-
})));
|
|
513
|
-
} finally {
|
|
514
|
-
_effect.f();
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
|
|
518
|
-
var _effect = (0, import_tracking6.useSignals)();
|
|
519
|
-
try {
|
|
520
|
-
const [selected, setSelectedId] = (0, import_react6.useState)(null);
|
|
521
|
-
const [isNewOption, setIsNewOption] = (0, import_react6.useState)(false);
|
|
522
|
-
const inputRef = (0, import_react6.useRef)(null);
|
|
523
|
-
const { t } = (0, import_react_ui6.useTranslation)(translationKey);
|
|
524
|
-
const { status, error } = getStatus();
|
|
525
|
-
const options = getValue3();
|
|
526
|
-
(0, import_react6.useEffect)(() => {
|
|
527
|
-
if (options === void 0) {
|
|
528
|
-
onValueChange(type, []);
|
|
529
|
-
}
|
|
530
|
-
}, [
|
|
531
|
-
options,
|
|
532
|
-
onValueChange,
|
|
533
|
-
type
|
|
534
|
-
]);
|
|
535
|
-
const randomHue = () => {
|
|
536
|
-
const usedHues = new Set(options?.map((option) => option.color) ?? []);
|
|
537
|
-
const unusedHues = import_react_ui_theme4.hues.filter((hue) => !usedHues.has(hue));
|
|
538
|
-
if (unusedHues.length > 0) {
|
|
539
|
-
return unusedHues[Math.floor(Math.random() * unusedHues.length)];
|
|
540
|
-
}
|
|
541
|
-
const lastThree = new Set(options?.slice(-3).map((option) => option.color) ?? []);
|
|
542
|
-
const availableHues = import_react_ui_theme4.hues.filter((hue) => !lastThree.has(hue));
|
|
543
|
-
return availableHues[Math.floor(Math.random() * availableHues.length)] ?? import_react_ui_theme4.hues[Math.floor(Math.random() * import_react_ui_theme4.hues.length)];
|
|
544
|
-
};
|
|
545
|
-
const handleAdd = (0, import_react6.useCallback)(() => {
|
|
546
|
-
const newId = import_keys.PublicKey.random().truncate();
|
|
547
|
-
const newOption = {
|
|
548
|
-
id: newId,
|
|
549
|
-
title: "",
|
|
550
|
-
color: randomHue()
|
|
551
|
-
};
|
|
552
|
-
onValueChange(type, [
|
|
553
|
-
...options ?? [],
|
|
554
|
-
newOption
|
|
555
|
-
]);
|
|
556
|
-
setSelectedId(newId);
|
|
557
|
-
setIsNewOption(true);
|
|
558
|
-
}, [
|
|
559
|
-
options,
|
|
560
|
-
type,
|
|
561
|
-
onValueChange
|
|
562
|
-
]);
|
|
563
|
-
const handleDelete = (0, import_react6.useCallback)((id) => {
|
|
564
|
-
const newOptions = options?.filter((option) => option.id !== id) ?? [];
|
|
565
|
-
onValueChange(type, newOptions);
|
|
566
|
-
setSelectedId(null);
|
|
567
|
-
}, [
|
|
568
|
-
options,
|
|
569
|
-
type,
|
|
570
|
-
onValueChange
|
|
571
|
-
]);
|
|
572
|
-
const handleMove = (0, import_react6.useCallback)((from, to) => {
|
|
573
|
-
if (!options) {
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
const newOptions = [
|
|
577
|
-
...options
|
|
578
|
-
];
|
|
579
|
-
const [removed] = newOptions.splice(from, 1);
|
|
580
|
-
newOptions.splice(to, 0, removed);
|
|
581
|
-
onValueChange(type, newOptions);
|
|
582
|
-
}, [
|
|
583
|
-
options,
|
|
584
|
-
type,
|
|
585
|
-
onValueChange
|
|
586
|
-
]);
|
|
587
|
-
const handleClick = (0, import_react6.useCallback)((id) => {
|
|
588
|
-
setSelectedId((current) => current === id ? null : id);
|
|
589
|
-
}, []);
|
|
590
|
-
const handleTitleChange = (0, import_react6.useCallback)((id) => (e) => {
|
|
591
|
-
const newOptions = options?.map((o) => o.id === id ? {
|
|
592
|
-
...o,
|
|
593
|
-
title: e.target.value
|
|
594
|
-
} : o);
|
|
595
|
-
onValueChange(type, newOptions ?? []);
|
|
596
|
-
}, [
|
|
597
|
-
options,
|
|
598
|
-
type,
|
|
599
|
-
onValueChange
|
|
600
|
-
]);
|
|
601
|
-
const handleKeyDown = (0, import_react6.useCallback)((e) => {
|
|
602
|
-
if (e.key === "Enter") {
|
|
603
|
-
setSelectedId(null);
|
|
604
|
-
}
|
|
605
|
-
}, []);
|
|
606
|
-
const handleColorChange = (0, import_react6.useCallback)((id) => (hue) => {
|
|
607
|
-
const newOptions = options?.map((o) => o.id === id ? {
|
|
608
|
-
...o,
|
|
609
|
-
color: hue
|
|
610
|
-
} : o);
|
|
611
|
-
onValueChange(type, newOptions ?? []);
|
|
612
|
-
}, [
|
|
613
|
-
options,
|
|
614
|
-
type,
|
|
615
|
-
onValueChange
|
|
616
|
-
]);
|
|
617
|
-
(0, import_react6.useEffect)(() => {
|
|
618
|
-
if (selected && isNewOption && inputRef.current) {
|
|
619
|
-
inputRef.current.focus();
|
|
620
|
-
setIsNewOption(false);
|
|
621
|
-
}
|
|
622
|
-
}, [
|
|
623
|
-
selected,
|
|
624
|
-
isNewOption
|
|
625
|
-
]);
|
|
626
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
627
|
-
validationValence: status
|
|
628
|
-
}, /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
629
|
-
error,
|
|
630
|
-
label
|
|
631
|
-
}), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
632
|
-
role: "none"
|
|
633
|
-
}, options && /* @__PURE__ */ import_react6.default.createElement(import_react_ui_list.List.Root, {
|
|
634
|
-
items: options,
|
|
635
|
-
isItem: (item) => true,
|
|
636
|
-
onMove: handleMove
|
|
637
|
-
}, ({ items }) => /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
638
|
-
role: "list",
|
|
639
|
-
className: "w-full overflow-auto"
|
|
640
|
-
}, items?.map((item) => /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
641
|
-
key: item.id
|
|
642
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_list.List.Item, {
|
|
643
|
-
role: "button",
|
|
644
|
-
item,
|
|
645
|
-
classNames: (0, import_react_ui_theme4.mx)("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
|
|
646
|
-
"aria-expanded": selected === item.id
|
|
647
|
-
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
648
|
-
className: "flex items-center"
|
|
649
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_list.List.ItemDragHandle, null), /* @__PURE__ */ import_react6.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
650
|
-
onClick: () => handleClick(item.id),
|
|
651
|
-
classNames: "flex-1"
|
|
652
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Tag, {
|
|
653
|
-
palette: item.color
|
|
654
|
-
}, item.title || "\u200B")), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Icon, {
|
|
655
|
-
icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
|
|
656
|
-
onClick: () => handleClick(item.id)
|
|
657
|
-
})), selected === item.id && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
658
|
-
className: "mis-4 mbs-2 flex flex-col gap-1"
|
|
659
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, {
|
|
660
|
-
classNames: "text-xs"
|
|
661
|
-
}, t("select option label")), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
662
|
-
className: "flex flex-row items-center gap-1"
|
|
663
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.TextInput, {
|
|
664
|
-
placeholder: t("select option label placeholder"),
|
|
665
|
-
ref: selected === item.id ? inputRef : void 0,
|
|
666
|
-
value: item.title,
|
|
667
|
-
onChange: handleTitleChange(item.id),
|
|
668
|
-
onKeyDown: handleKeyDown,
|
|
669
|
-
classNames: "flex-1",
|
|
670
|
-
"data-no-submit": true
|
|
671
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Toolbar.Root, {
|
|
672
|
-
classNames: "p-0 m-0 !is-auto"
|
|
673
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_pickers.HuePicker, {
|
|
674
|
-
value: item.color,
|
|
675
|
-
onChange: handleColorChange(item.id),
|
|
676
|
-
rootVariant: "toolbar-button"
|
|
677
|
-
})), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.IconButton, {
|
|
678
|
-
icon: "ph--trash--fill",
|
|
679
|
-
iconOnly: true,
|
|
680
|
-
label: t("select option delete"),
|
|
681
|
-
onClick: () => handleDelete(item.id)
|
|
682
|
-
})))))), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
683
|
-
role: "listitem"
|
|
684
|
-
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
685
|
-
role: "button",
|
|
686
|
-
className: (0, import_react_ui_theme4.mx)("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
|
|
687
|
-
onClick: handleAdd
|
|
688
|
-
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
689
|
-
className: "flex items-center gap-1"
|
|
690
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Icon, {
|
|
691
|
-
icon: "ph--plus--regular"
|
|
692
|
-
}), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
693
|
-
className: "text-sm"
|
|
694
|
-
}, t("select option add")))))))));
|
|
695
|
-
} finally {
|
|
696
|
-
_effect.f();
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
var gridCols = [
|
|
700
|
-
"grid-cols-1",
|
|
701
|
-
"grid-cols-2",
|
|
702
|
-
"grid-cols-3",
|
|
703
|
-
"grid-cols-4"
|
|
704
|
-
];
|
|
705
|
-
var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
706
|
-
var _effect = (0, import_tracking7.useSignals)();
|
|
707
|
-
try {
|
|
708
|
-
const { status, error } = getStatus();
|
|
709
|
-
const values = getValue3() ?? {};
|
|
710
|
-
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.Input.Root, {
|
|
711
|
-
validationValence: status
|
|
712
|
-
}, /* @__PURE__ */ import_react7.default.createElement(InputHeader, {
|
|
713
|
-
error,
|
|
714
|
-
label
|
|
715
|
-
}), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
716
|
-
className: (0, import_react_ui_theme5.mx)("grid gap-2", gridCols[binding.length - 1])
|
|
717
|
-
}, binding.map((prop) => /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.Input.TextInput, {
|
|
718
|
-
key: prop,
|
|
719
|
-
type: "number",
|
|
720
|
-
disabled,
|
|
721
|
-
value: values[prop],
|
|
722
|
-
onChange: (event) => onValueChange(type, {
|
|
723
|
-
...values,
|
|
724
|
-
[prop]: (0, import_util2.safeParseFloat)(event.target.value, 0)
|
|
725
|
-
}),
|
|
726
|
-
onBlur
|
|
727
|
-
}))));
|
|
728
|
-
} finally {
|
|
729
|
-
_effect.f();
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
var TextInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
733
|
-
var _effect = (0, import_tracking8.useSignals)();
|
|
734
|
-
try {
|
|
735
|
-
const { status, error } = getStatus();
|
|
736
|
-
return disabled && !getValue3() ? null : disabled && inputOnly ? /* @__PURE__ */ import_react8.default.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
737
|
-
validationValence: status
|
|
738
|
-
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
739
|
-
error,
|
|
740
|
-
label
|
|
741
|
-
}), disabled ? /* @__PURE__ */ import_react8.default.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.TextInput, {
|
|
742
|
-
disabled,
|
|
743
|
-
placeholder,
|
|
744
|
-
value: getValue3() ?? "",
|
|
745
|
-
onChange: (event) => onValueChange(type, event.target.value),
|
|
746
|
-
onBlur
|
|
747
|
-
}), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Validation, null, error));
|
|
748
|
-
} finally {
|
|
749
|
-
_effect.f();
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
var NumberInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
753
|
-
var _effect = (0, import_tracking8.useSignals)();
|
|
754
|
-
try {
|
|
755
|
-
const { status, error } = getStatus();
|
|
756
|
-
return disabled && !getValue3() ? null : disabled && inputOnly ? /* @__PURE__ */ import_react8.default.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
757
|
-
validationValence: status
|
|
758
|
-
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
759
|
-
error,
|
|
760
|
-
label
|
|
761
|
-
}), disabled ? /* @__PURE__ */ import_react8.default.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.TextInput, {
|
|
762
|
-
type: "number",
|
|
763
|
-
disabled,
|
|
764
|
-
placeholder,
|
|
765
|
-
value: getValue3() ?? 0,
|
|
766
|
-
onChange: (event) => onValueChange(type, event.target.value),
|
|
767
|
-
onBlur
|
|
768
|
-
}), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.DescriptionAndValidation, null, error));
|
|
769
|
-
} finally {
|
|
770
|
-
_effect.f();
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, onValueChange, disabled }) => {
|
|
774
|
-
var _effect = (0, import_tracking8.useSignals)();
|
|
775
|
-
try {
|
|
776
|
-
const { status, error } = getStatus();
|
|
777
|
-
const checked = Boolean(getValue3());
|
|
778
|
-
const { t } = (0, import_react_ui8.useTranslation)(translationKey);
|
|
779
|
-
return /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
780
|
-
validationValence: status
|
|
781
|
-
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
782
|
-
error,
|
|
783
|
-
label
|
|
784
|
-
}), disabled ? /* @__PURE__ */ import_react8.default.createElement("p", null, t(checked ? "boolean input true value" : "boolean input false value")) : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Switch, {
|
|
785
|
-
checked,
|
|
786
|
-
onCheckedChange: (value) => onValueChange(type, value)
|
|
787
|
-
}), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.DescriptionAndValidation, null, error));
|
|
788
|
-
} finally {
|
|
789
|
-
_effect.f();
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
|
|
793
|
-
var _effect = (0, import_tracking8.useSignals)();
|
|
794
|
-
try {
|
|
795
|
-
const { status, error } = getStatus();
|
|
796
|
-
const value = getValue3();
|
|
797
|
-
const handleValueChange = (0, import_react8.useCallback)((value2) => onValueChange(type, value2), [
|
|
798
|
-
type,
|
|
799
|
-
onValueChange
|
|
800
|
-
]);
|
|
801
|
-
return disabled && !value ? null : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
802
|
-
validationValence: status
|
|
803
|
-
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
804
|
-
error,
|
|
805
|
-
label
|
|
806
|
-
}), disabled ? /* @__PURE__ */ import_react8.default.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value)?.label ?? String(value)) : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Root, {
|
|
807
|
-
value,
|
|
808
|
-
onValueChange: handleValueChange
|
|
809
|
-
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.TriggerButton, {
|
|
810
|
-
classNames: "is-full",
|
|
811
|
-
disabled,
|
|
812
|
-
placeholder
|
|
813
|
-
}), /* @__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: value2, label: label2 }) => (
|
|
814
|
-
// NOTE: Numeric values are converted to and from strings.
|
|
815
|
-
/* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Select.Option, {
|
|
816
|
-
key: String(value2),
|
|
817
|
-
value: String(value2)
|
|
818
|
-
}, label2 ?? String(value2))
|
|
819
|
-
)))))), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.DescriptionAndValidation, null, error));
|
|
820
|
-
} finally {
|
|
821
|
-
_effect.f();
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
|
|
825
|
-
var _effect = (0, import_tracking8.useSignals)();
|
|
826
|
-
try {
|
|
827
|
-
const { status, error } = getStatus();
|
|
828
|
-
const textareaRef = (0, import_react8.useRef)(null);
|
|
829
|
-
const adjustHeight = (0, import_react8.useCallback)(() => {
|
|
830
|
-
const textarea = textareaRef.current;
|
|
831
|
-
if (textarea) {
|
|
832
|
-
textarea.style.blockSize = "auto";
|
|
833
|
-
textarea.style.blockSize = `${textarea.scrollHeight + 2}px`;
|
|
834
|
-
}
|
|
835
|
-
}, []);
|
|
836
|
-
(0, import_react8.useEffect)(() => {
|
|
837
|
-
adjustHeight();
|
|
838
|
-
}, [
|
|
839
|
-
adjustHeight
|
|
840
|
-
]);
|
|
841
|
-
(0, import_react8.useEffect)(() => {
|
|
842
|
-
adjustHeight();
|
|
843
|
-
}, [
|
|
844
|
-
getValue3(),
|
|
845
|
-
adjustHeight
|
|
846
|
-
]);
|
|
847
|
-
return /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Root, {
|
|
848
|
-
validationValence: status
|
|
849
|
-
}, !inputOnly && /* @__PURE__ */ import_react8.default.createElement(InputHeader, {
|
|
850
|
-
error,
|
|
851
|
-
label
|
|
852
|
-
}), disabled ? /* @__PURE__ */ import_react8.default.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.TextArea, {
|
|
853
|
-
ref: textareaRef,
|
|
854
|
-
disabled,
|
|
855
|
-
placeholder,
|
|
856
|
-
value: getValue3() ?? "",
|
|
857
|
-
classNames: "min-bs-auto max-h-40 overflow-auto",
|
|
858
|
-
onChange: (event) => onValueChange(type, event.target.value),
|
|
859
|
-
onBlur,
|
|
860
|
-
style: {
|
|
861
|
-
resize: "none"
|
|
862
|
-
},
|
|
863
|
-
spellCheck: false
|
|
864
|
-
}), inputOnly && /* @__PURE__ */ import_react8.default.createElement(import_react_ui8.Input.Validation, null, error));
|
|
865
|
-
} finally {
|
|
866
|
-
_effect.f();
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
|
|
870
|
-
var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
|
|
871
|
-
(0, import_invariant.invariant)(import_effect2.SchemaAST.isTypeLiteral(schema.ast), void 0, {
|
|
872
|
-
F: __dxlog_file,
|
|
873
|
-
L: 93,
|
|
874
|
-
S: void 0,
|
|
875
|
-
A: [
|
|
876
|
-
"SchemaAST.isTypeLiteral(schema.ast)",
|
|
877
|
-
""
|
|
878
|
-
]
|
|
879
|
-
});
|
|
880
|
-
const [values, setValues] = (0, import_react12.useState)(initialValues);
|
|
881
|
-
(0, import_react12.useEffect)(() => {
|
|
882
|
-
setValues(initialValues);
|
|
883
|
-
}, [
|
|
884
|
-
initialValues
|
|
885
|
-
]);
|
|
886
|
-
const [touched, setTouched] = (0, import_react12.useState)(createKeySet(initialValues, false));
|
|
887
|
-
const [changed, setChanged] = (0, import_react12.useState)(createKeySet(initialValues, false));
|
|
888
|
-
const [errors, setErrors] = (0, import_react12.useState)({});
|
|
889
|
-
const [saving, setSaving] = (0, import_react12.useState)(false);
|
|
890
|
-
const validate = (0, import_react12.useCallback)((values2) => {
|
|
891
|
-
let errors2 = (0, import_schema2.validateSchema)(schema, values2) ?? [];
|
|
892
|
-
if (errors2.length === 0 && onValidate) {
|
|
893
|
-
const validatedValues = values2;
|
|
894
|
-
errors2 = onValidate(validatedValues) ?? [];
|
|
895
|
-
}
|
|
896
|
-
setErrors(flatMap(errors2));
|
|
897
|
-
const valid = errors2.length === 0;
|
|
898
|
-
return valid;
|
|
899
|
-
}, [
|
|
900
|
-
schema,
|
|
901
|
-
onValidate
|
|
902
|
-
]);
|
|
903
|
-
const [schemaDirty, setSchemaDirty] = (0, import_react12.useState)(false);
|
|
904
|
-
(0, import_react12.useEffect)(() => setSchemaDirty(true), [
|
|
905
|
-
schema
|
|
906
|
-
]);
|
|
907
|
-
(0, import_react12.useEffect)(() => {
|
|
908
|
-
if (schemaDirty) {
|
|
909
|
-
validate(values);
|
|
910
|
-
setSchemaDirty(false);
|
|
911
|
-
}
|
|
912
|
-
}, [
|
|
913
|
-
values,
|
|
914
|
-
schemaDirty
|
|
915
|
-
]);
|
|
916
|
-
const formIsValid = (0, import_react12.useMemo)(() => {
|
|
917
|
-
return Object.keys(errors).length === 0;
|
|
918
|
-
}, [
|
|
919
|
-
errors
|
|
920
|
-
]);
|
|
921
|
-
const canSave = (0, import_react12.useMemo)(() => !saving && // Check if any error paths that are touched have errors.
|
|
922
|
-
!Object.entries(touched).some(([path, isTouched]) => isTouched && Object.keys(errors).some((errorPath) => errorPath === path || errorPath.startsWith(`${path}.`) || errorPath.startsWith(`${path}[`))), [
|
|
923
|
-
touched,
|
|
924
|
-
errors,
|
|
925
|
-
saving
|
|
926
|
-
]);
|
|
927
|
-
const handleSave = (0, import_react12.useCallback)(async () => {
|
|
928
|
-
if (validate(values)) {
|
|
929
|
-
setSaving(true);
|
|
930
|
-
try {
|
|
931
|
-
await onSave?.(values, {
|
|
932
|
-
changed
|
|
933
|
-
});
|
|
934
|
-
} finally {
|
|
935
|
-
setSaving(false);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}, [
|
|
939
|
-
values,
|
|
940
|
-
validate,
|
|
941
|
-
onSave,
|
|
942
|
-
changed
|
|
943
|
-
]);
|
|
944
|
-
const getStatus = (0, import_react12.useCallback)((path) => {
|
|
945
|
-
const jsonPath = Array.isArray(path) ? (0, import_effect3.createJsonPath)(path) : path;
|
|
946
|
-
const matchingError = Object.entries(errors).find(([errorPath]) => errorPath === jsonPath || errorPath.startsWith(`${jsonPath}.`) || errorPath.startsWith(`${jsonPath}[`));
|
|
947
|
-
const isTouched = touched[jsonPath];
|
|
948
|
-
if (!isTouched) {
|
|
949
|
-
return {
|
|
950
|
-
status: void 0,
|
|
951
|
-
error: void 0
|
|
952
|
-
};
|
|
953
|
-
}
|
|
954
|
-
return {
|
|
955
|
-
status: matchingError ? "error" : void 0,
|
|
956
|
-
error: matchingError ? matchingError[1] : void 0
|
|
957
|
-
};
|
|
958
|
-
}, [
|
|
959
|
-
errors,
|
|
960
|
-
touched
|
|
961
|
-
]);
|
|
962
|
-
const getFormValue = (0, import_react12.useCallback)((path) => {
|
|
963
|
-
return (0, import_echo_schema4.getValue)(values, (0, import_effect3.createJsonPath)(path));
|
|
964
|
-
}, [
|
|
965
|
-
values
|
|
966
|
-
]);
|
|
967
|
-
const onValueChange = (0, import_react12.useCallback)((path, type, value) => {
|
|
968
|
-
const jsonPath = (0, import_effect3.createJsonPath)(path);
|
|
969
|
-
let parsedValue = value;
|
|
970
|
-
try {
|
|
971
|
-
if (type === "number") {
|
|
972
|
-
parsedValue = parseFloat(value) || 0;
|
|
973
|
-
}
|
|
974
|
-
} catch (err) {
|
|
975
|
-
import_log2.log.catch(err, void 0, {
|
|
976
|
-
F: __dxlog_file,
|
|
977
|
-
L: 213,
|
|
978
|
-
S: void 0,
|
|
979
|
-
C: (f, a) => f(...a)
|
|
980
|
-
});
|
|
981
|
-
parsedValue = void 0;
|
|
982
|
-
}
|
|
983
|
-
const newValues = {
|
|
984
|
-
...(0, import_echo_schema4.setValue)(values, jsonPath, parsedValue)
|
|
985
|
-
};
|
|
986
|
-
setValues(newValues);
|
|
987
|
-
setChanged((prev) => ({
|
|
988
|
-
...prev,
|
|
989
|
-
[jsonPath]: true
|
|
990
|
-
}));
|
|
991
|
-
onValuesChanged?.(newValues);
|
|
992
|
-
const isValid = validate(newValues);
|
|
993
|
-
if (isValid && onValid) {
|
|
994
|
-
onValid(newValues, {
|
|
995
|
-
changed
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
}, [
|
|
999
|
-
values,
|
|
1000
|
-
onValuesChanged,
|
|
1001
|
-
validate,
|
|
1002
|
-
onValid,
|
|
1003
|
-
changed
|
|
1004
|
-
]);
|
|
1005
|
-
const onTouched = (0, import_react12.useCallback)((path) => {
|
|
1006
|
-
const jsonPath = (0, import_effect3.createJsonPath)(path);
|
|
1007
|
-
setTouched((touched2) => ({
|
|
1008
|
-
...touched2,
|
|
1009
|
-
[jsonPath]: true
|
|
1010
|
-
}));
|
|
1011
|
-
validate(values);
|
|
1012
|
-
}, [
|
|
1013
|
-
validate,
|
|
1014
|
-
values
|
|
1015
|
-
]);
|
|
1016
|
-
return (0, import_react12.useMemo)(() => ({
|
|
1017
|
-
// State.
|
|
1018
|
-
values,
|
|
1019
|
-
errors,
|
|
1020
|
-
touched,
|
|
1021
|
-
changed,
|
|
1022
|
-
canSave,
|
|
1023
|
-
formIsValid,
|
|
1024
|
-
// Actions.
|
|
1025
|
-
handleSave,
|
|
1026
|
-
// Field utils.
|
|
1027
|
-
getStatus,
|
|
1028
|
-
getValue: getFormValue,
|
|
1029
|
-
onValueChange,
|
|
1030
|
-
onTouched
|
|
1031
|
-
}), [
|
|
1032
|
-
values,
|
|
1033
|
-
errors,
|
|
1034
|
-
touched,
|
|
1035
|
-
changed,
|
|
1036
|
-
canSave,
|
|
1037
|
-
formIsValid,
|
|
1038
|
-
handleSave,
|
|
1039
|
-
getStatus,
|
|
1040
|
-
getFormValue,
|
|
1041
|
-
onValueChange,
|
|
1042
|
-
onTouched
|
|
1043
|
-
]);
|
|
1044
|
-
};
|
|
1045
|
-
var createKeySet = (obj, value) => {
|
|
1046
|
-
(0, import_invariant.invariant)(obj, void 0, {
|
|
1047
|
-
F: __dxlog_file,
|
|
1048
|
-
L: 275,
|
|
1049
|
-
S: void 0,
|
|
1050
|
-
A: [
|
|
1051
|
-
"obj",
|
|
1052
|
-
""
|
|
1053
|
-
]
|
|
1054
|
-
});
|
|
1055
|
-
return Object.keys(obj).reduce((acc, key) => ({
|
|
1056
|
-
...acc,
|
|
1057
|
-
[key]: value
|
|
1058
|
-
}), {});
|
|
1059
|
-
};
|
|
1060
|
-
var flatMap = (errors) => {
|
|
1061
|
-
return errors.reduce((result, { path, message }) => {
|
|
1062
|
-
const jsonPath = (0, import_effect3.fromEffectValidationPath)(path);
|
|
1063
|
-
if (!(jsonPath in result)) {
|
|
1064
|
-
result[jsonPath] = message;
|
|
1065
|
-
}
|
|
1066
|
-
return result;
|
|
1067
|
-
}, {});
|
|
1068
|
-
};
|
|
1069
|
-
var useRefQueryLookupHandler = ({ space }) => {
|
|
1070
|
-
return (0, import_react13.useCallback)(async (typeInfo) => {
|
|
1071
|
-
if (!space) {
|
|
1072
|
-
return [];
|
|
1073
|
-
}
|
|
1074
|
-
const query = space.db.query(import_echo.Filter.typename(typeInfo.typename));
|
|
1075
|
-
const { objects } = await query.run();
|
|
1076
|
-
return objects.map((object) => {
|
|
1077
|
-
const dxn = (0, import_echo_schema5.getObjectDXN)(object);
|
|
1078
|
-
if (!dxn) {
|
|
1079
|
-
return void 0;
|
|
1080
|
-
}
|
|
1081
|
-
const item = {
|
|
1082
|
-
dxn,
|
|
1083
|
-
label: object?.name ?? object?.id ?? ""
|
|
1084
|
-
};
|
|
1085
|
-
return item;
|
|
1086
|
-
}).filter(import_util3.isNonNullable);
|
|
1087
|
-
}, [
|
|
1088
|
-
space
|
|
1089
|
-
]);
|
|
1090
|
-
};
|
|
1091
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useQueryRefOptions.ts";
|
|
1092
|
-
var useQueryRefOptions = ({ refTypeInfo, onQueryRefOptions }) => {
|
|
1093
|
-
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
1094
|
-
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
1095
|
-
(0, import_react14.useEffect)(() => {
|
|
1096
|
-
if (!refTypeInfo || !onQueryRefOptions) {
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
const fetchOptions = async () => {
|
|
1100
|
-
setLoading(true);
|
|
1101
|
-
try {
|
|
1102
|
-
const fetchedOptions = await onQueryRefOptions(refTypeInfo);
|
|
1103
|
-
setOptions(fetchedOptions.map((option) => {
|
|
1104
|
-
const dxn = option.dxn.toString();
|
|
1105
|
-
return {
|
|
1106
|
-
id: dxn,
|
|
1107
|
-
label: option.label ?? dxn,
|
|
1108
|
-
hue: "neutral"
|
|
1109
|
-
};
|
|
1110
|
-
}));
|
|
1111
|
-
} catch (error) {
|
|
1112
|
-
import_log3.log.error("Failed to fetch ref options:", error, {
|
|
1113
|
-
F: __dxlog_file2,
|
|
1114
|
-
L: 42,
|
|
1115
|
-
S: void 0,
|
|
1116
|
-
C: (f, a) => f(...a)
|
|
1117
|
-
});
|
|
1118
|
-
setOptions([]);
|
|
1119
|
-
} finally {
|
|
1120
|
-
setLoading(false);
|
|
1121
|
-
}
|
|
1122
|
-
};
|
|
1123
|
-
void fetchOptions();
|
|
1124
|
-
}, [
|
|
1125
|
-
refTypeInfo,
|
|
1126
|
-
onQueryRefOptions
|
|
1127
|
-
]);
|
|
1128
|
-
return {
|
|
1129
|
-
options,
|
|
1130
|
-
loading
|
|
1131
|
-
};
|
|
1132
|
-
};
|
|
1133
|
-
var FormContext = /* @__PURE__ */ (0, import_react11.createContext)(void 0);
|
|
1134
|
-
var useFormContext = () => {
|
|
1135
|
-
return (0, import_react11.useContext)(FormContext) ?? (0, import_debug.raise)(new Error("Missing FormContext"));
|
|
1136
|
-
};
|
|
1137
|
-
var useFormValues = (path = []) => {
|
|
1138
|
-
const { values: formValues } = useFormContext();
|
|
1139
|
-
const jsonPath = (0, import_effect.createJsonPath)(path);
|
|
1140
|
-
return (0, import_echo_schema3.getValue)(formValues, jsonPath);
|
|
1141
|
-
};
|
|
1142
|
-
var useInputProps = (path = []) => {
|
|
1143
|
-
const { getStatus, getValue: getFormValue, onValueChange, onTouched } = useFormContext();
|
|
1144
|
-
const stablePath = (0, import_react11.useMemo)(() => path, [
|
|
1145
|
-
Array.isArray(path) ? path.join(".") : path
|
|
1146
|
-
]);
|
|
1147
|
-
return (0, import_react11.useMemo)(() => ({
|
|
1148
|
-
getStatus: () => getStatus(stablePath),
|
|
1149
|
-
getValue: () => getFormValue(stablePath),
|
|
1150
|
-
onValueChange: (type, value) => onValueChange(stablePath, type, value),
|
|
1151
|
-
onBlur: () => onTouched(stablePath)
|
|
1152
|
-
}), [
|
|
1153
|
-
getStatus,
|
|
1154
|
-
getFormValue,
|
|
1155
|
-
onValueChange,
|
|
1156
|
-
onTouched,
|
|
1157
|
-
stablePath
|
|
1158
|
-
]);
|
|
1159
|
-
};
|
|
1160
|
-
var FormProvider = ({ children, formRef, autoSave, ...formOptions }) => {
|
|
1161
|
-
var _effect = (0, import_tracking11.useSignals)();
|
|
1162
|
-
try {
|
|
1163
|
-
const form = useForm(formOptions);
|
|
1164
|
-
const handleKeyDown = (0, import_react11.useCallback)((event) => {
|
|
1165
|
-
const keyIsEnter = event.key === "Enter";
|
|
1166
|
-
const modifierUsed = event.ctrlKey || event.altKey || event.metaKey || event.shiftKey;
|
|
1167
|
-
const inputIsTextarea = event.target.tagName.toLowerCase() === "textarea";
|
|
1168
|
-
const inputOptOut = event.target.hasAttribute("data-no-submit") || event.target.closest("[data-no-submit]") !== null;
|
|
1169
|
-
const shouldSubmitRegularInput = !inputIsTextarea && keyIsEnter && !modifierUsed;
|
|
1170
|
-
const shouldSubmitTextarea = inputIsTextarea && keyIsEnter && event.metaKey;
|
|
1171
|
-
if ((shouldSubmitRegularInput || shouldSubmitTextarea) && !inputOptOut) {
|
|
1172
|
-
if (!autoSave && form.canSave) {
|
|
1173
|
-
form.handleSave();
|
|
1174
|
-
}
|
|
1175
|
-
if (autoSave && form.formIsValid) {
|
|
1176
|
-
event.target.blur();
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}, [
|
|
1180
|
-
form,
|
|
1181
|
-
autoSave
|
|
1182
|
-
]);
|
|
1183
|
-
(0, import_react11.useEffect)(() => {
|
|
1184
|
-
if (!formRef?.current) {
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
const formElement = formRef.current;
|
|
1188
|
-
formElement.addEventListener("keydown", handleKeyDown);
|
|
1189
|
-
return () => formElement.removeEventListener("keydown", handleKeyDown);
|
|
1190
|
-
}, [
|
|
1191
|
-
formRef,
|
|
1192
|
-
form.canSave,
|
|
1193
|
-
form.formIsValid,
|
|
1194
|
-
form.handleSave,
|
|
1195
|
-
autoSave
|
|
1196
|
-
]);
|
|
1197
|
-
return /* @__PURE__ */ import_react11.default.createElement(FormContext.Provider, {
|
|
1198
|
-
value: form
|
|
1199
|
-
}, children);
|
|
1200
|
-
} finally {
|
|
1201
|
-
_effect.f();
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
|
|
1205
|
-
var _effect = (0, import_tracking10.useSignals)();
|
|
1206
|
-
try {
|
|
1207
|
-
const { t } = (0, import_react_ui9.useTranslation)(translationKey);
|
|
1208
|
-
const { canSave, handleSave } = useFormContext();
|
|
1209
|
-
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1210
|
-
role: "none",
|
|
1211
|
-
className: (0, import_react_ui_theme6.mx)(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? import_react_ui_stack3.cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
|
|
1212
|
-
}, onCancel && !readonly && /* @__PURE__ */ import_react10.default.createElement(import_react_ui9.IconButton, {
|
|
1213
|
-
"data-testid": "cancel-button",
|
|
1214
|
-
icon: "ph--x--regular",
|
|
1215
|
-
label: t("button cancel"),
|
|
1216
|
-
onClick: onCancel
|
|
1217
|
-
}), handleSave && /* @__PURE__ */ import_react10.default.createElement(import_react_ui9.IconButton, {
|
|
1218
|
-
type: "submit",
|
|
1219
|
-
"data-testid": "save-button",
|
|
1220
|
-
disabled: !canSave,
|
|
1221
|
-
icon: "ph--check--regular",
|
|
1222
|
-
label: t("button save"),
|
|
1223
|
-
onClick: handleSave
|
|
1224
|
-
}));
|
|
1225
|
-
} finally {
|
|
1226
|
-
_effect.f();
|
|
1227
|
-
}
|
|
1228
|
-
};
|
|
1229
|
-
var parseValue = ({ type, format, value }) => {
|
|
1230
|
-
if (value === void 0 || value === null || value === "") {
|
|
1231
|
-
return void 0;
|
|
1232
|
-
}
|
|
1233
|
-
const parseScalar = (type2) => {
|
|
1234
|
-
switch (type2) {
|
|
1235
|
-
case import_echo_schema6.TypeEnum.Boolean: {
|
|
1236
|
-
if (typeof value === "string") {
|
|
1237
|
-
const lowercaseValue = value.toLowerCase();
|
|
1238
|
-
if (lowercaseValue === "0" || lowercaseValue === "false") {
|
|
1239
|
-
return false;
|
|
1240
|
-
} else if (lowercaseValue === "1" || lowercaseValue === "true") {
|
|
1241
|
-
return true;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
return Boolean(value);
|
|
1245
|
-
}
|
|
1246
|
-
case import_echo_schema6.TypeEnum.Number: {
|
|
1247
|
-
const cleaned = typeof value === "string" ? value.replace(/[^0-9.-]+/g, "") : value;
|
|
1248
|
-
const num = Number(cleaned);
|
|
1249
|
-
return Number.isNaN(num) ? null : num;
|
|
1250
|
-
}
|
|
1251
|
-
case import_echo_schema6.TypeEnum.String:
|
|
1252
|
-
case import_echo_schema6.TypeEnum.Ref:
|
|
1253
|
-
return String(value);
|
|
1254
|
-
default: {
|
|
1255
|
-
return value;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
};
|
|
1259
|
-
if (!format) {
|
|
1260
|
-
return parseScalar(type);
|
|
1261
|
-
}
|
|
1262
|
-
switch (format) {
|
|
1263
|
-
case import_echo_schema6.FormatEnum.Boolean:
|
|
1264
|
-
return parseScalar(import_echo_schema6.TypeEnum.Boolean);
|
|
1265
|
-
case import_echo_schema6.FormatEnum.Number:
|
|
1266
|
-
case import_echo_schema6.FormatEnum.Percent:
|
|
1267
|
-
case import_echo_schema6.FormatEnum.Currency:
|
|
1268
|
-
return parseScalar(import_echo_schema6.TypeEnum.Number);
|
|
1269
|
-
case import_echo_schema6.FormatEnum.String:
|
|
1270
|
-
case import_echo_schema6.FormatEnum.Markdown: {
|
|
1271
|
-
return parseScalar(import_echo_schema6.TypeEnum.String);
|
|
1272
|
-
}
|
|
1273
|
-
case import_echo_schema6.FormatEnum.Ref:
|
|
1274
|
-
throw new Error(`unexpected format: ${import_echo_schema6.FormatEnum.Ref}`);
|
|
1275
|
-
case import_echo_schema6.FormatEnum.DateTime:
|
|
1276
|
-
case import_echo_schema6.FormatEnum.Date:
|
|
1277
|
-
case import_echo_schema6.FormatEnum.Time:
|
|
1278
|
-
case import_echo_schema6.FormatEnum.Timestamp: {
|
|
1279
|
-
const date = new Date(value);
|
|
1280
|
-
return isNaN(date.getTime()) ? null : date;
|
|
1281
|
-
}
|
|
1282
|
-
case import_echo_schema6.FormatEnum.GeoPoint: {
|
|
1283
|
-
if (typeof value === "string") {
|
|
1284
|
-
const cleaned = value.replace(/[^0-9.,-]+/g, "");
|
|
1285
|
-
const parts = cleaned.split(",");
|
|
1286
|
-
if (parts.length === 2) {
|
|
1287
|
-
const lat = parseFloat(parts[0]);
|
|
1288
|
-
const long = parseFloat(parts[1]);
|
|
1289
|
-
if (!isNaN(lat) && !isNaN(long)) {
|
|
1290
|
-
return import_echo_schema6.GeoLocation.toGeoPoint({
|
|
1291
|
-
latitude: lat,
|
|
1292
|
-
longitude: long
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
return [
|
|
1298
|
-
0,
|
|
1299
|
-
0
|
|
1300
|
-
];
|
|
1301
|
-
}
|
|
1302
|
-
default: {
|
|
1303
|
-
return value;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
var cellClassesForFieldType = ({ type, format }) => {
|
|
1308
|
-
if (!format) {
|
|
1309
|
-
switch (type) {
|
|
1310
|
-
case import_echo_schema6.TypeEnum.Number:
|
|
1311
|
-
return [
|
|
1312
|
-
"text-right",
|
|
1313
|
-
"font-mono"
|
|
1314
|
-
];
|
|
1315
|
-
case import_echo_schema6.TypeEnum.Boolean:
|
|
1316
|
-
return [
|
|
1317
|
-
"text-right",
|
|
1318
|
-
"font-mono"
|
|
1319
|
-
];
|
|
1320
|
-
case import_echo_schema6.TypeEnum.String:
|
|
1321
|
-
return void 0;
|
|
1322
|
-
case import_echo_schema6.TypeEnum.Ref:
|
|
1323
|
-
return void 0;
|
|
1324
|
-
default: {
|
|
1325
|
-
return void 0;
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
switch (format) {
|
|
1330
|
-
case import_echo_schema6.FormatEnum.Markdown:
|
|
1331
|
-
return void 0;
|
|
1332
|
-
case import_echo_schema6.FormatEnum.Time:
|
|
1333
|
-
case import_echo_schema6.FormatEnum.Timestamp:
|
|
1334
|
-
case import_echo_schema6.FormatEnum.DateTime:
|
|
1335
|
-
case import_echo_schema6.FormatEnum.Date:
|
|
1336
|
-
case import_echo_schema6.FormatEnum.Duration:
|
|
1337
|
-
return [
|
|
1338
|
-
"font-mono",
|
|
1339
|
-
"text-right"
|
|
1340
|
-
];
|
|
1341
|
-
case import_echo_schema6.FormatEnum.Currency:
|
|
1342
|
-
return [
|
|
1343
|
-
"text-right"
|
|
1344
|
-
];
|
|
1345
|
-
case import_echo_schema6.FormatEnum.JSON:
|
|
1346
|
-
case import_echo_schema6.FormatEnum.DID:
|
|
1347
|
-
return [
|
|
1348
|
-
"font-mono"
|
|
1349
|
-
];
|
|
1350
|
-
default:
|
|
1351
|
-
return void 0;
|
|
1352
|
-
}
|
|
1353
|
-
};
|
|
1354
|
-
var pathNotUniqueError = (path) => ({
|
|
1355
|
-
path: "path",
|
|
1356
|
-
message: `'${path}' is already present`
|
|
1357
|
-
});
|
|
1358
|
-
var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
1359
|
-
const formatScalar = (type2) => {
|
|
1360
|
-
switch (type2) {
|
|
1361
|
-
case import_echo_schema7.TypeEnum.Boolean:
|
|
1362
|
-
return value.toLocaleString().toUpperCase();
|
|
1363
|
-
case import_echo_schema7.TypeEnum.Number:
|
|
1364
|
-
return value.toLocaleString(locale);
|
|
1365
|
-
case import_echo_schema7.TypeEnum.String:
|
|
1366
|
-
case import_echo_schema7.TypeEnum.Ref:
|
|
1367
|
-
return String(value);
|
|
1368
|
-
default: {
|
|
1369
|
-
return String(value);
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
if (!format) {
|
|
1374
|
-
return formatScalar(type);
|
|
1375
|
-
}
|
|
1376
|
-
switch (format) {
|
|
1377
|
-
case import_echo_schema7.FormatEnum.Boolean: {
|
|
1378
|
-
return formatScalar(import_echo_schema7.TypeEnum.Boolean);
|
|
1379
|
-
}
|
|
1380
|
-
case import_echo_schema7.FormatEnum.Number: {
|
|
1381
|
-
return formatScalar(import_echo_schema7.TypeEnum.Number);
|
|
1382
|
-
}
|
|
1383
|
-
case import_echo_schema7.FormatEnum.String:
|
|
1384
|
-
case import_echo_schema7.FormatEnum.Ref: {
|
|
1385
|
-
return formatScalar(import_echo_schema7.TypeEnum.String);
|
|
1386
|
-
}
|
|
1387
|
-
case import_echo_schema7.FormatEnum.Percent: {
|
|
1388
|
-
return `${value * 100}%`;
|
|
1389
|
-
}
|
|
1390
|
-
case import_echo_schema7.FormatEnum.Currency: {
|
|
1391
|
-
return value.toLocaleString(locale, {
|
|
1392
|
-
style: "currency",
|
|
1393
|
-
currency: "USD",
|
|
1394
|
-
minimumFractionDigits: 2,
|
|
1395
|
-
maximumFractionDigits: 2
|
|
1396
|
-
});
|
|
1397
|
-
}
|
|
1398
|
-
case import_echo_schema7.FormatEnum.Date: {
|
|
1399
|
-
try {
|
|
1400
|
-
return (0, import_format.format)(new Date(value), "yyyy-MM-dd");
|
|
1401
|
-
} catch (error) {
|
|
1402
|
-
return "Invalid Date";
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
case import_echo_schema7.FormatEnum.Time: {
|
|
1406
|
-
try {
|
|
1407
|
-
return (0, import_format.format)(new Date(value), "HH:mm:ss");
|
|
1408
|
-
} catch (error) {
|
|
1409
|
-
return "Invalid Time";
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
case import_echo_schema7.FormatEnum.DateTime: {
|
|
1413
|
-
try {
|
|
1414
|
-
return (0, import_format.format)(new Date(value), "yyyy-MM-dd HH:mm:ss");
|
|
1415
|
-
} catch (error) {
|
|
1416
|
-
return "Invalid DateTime";
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
case import_echo_schema7.FormatEnum.GeoPoint: {
|
|
1420
|
-
if (value === null || value === void 0) {
|
|
1421
|
-
return "";
|
|
1422
|
-
}
|
|
1423
|
-
if (Array.isArray(value) && value.length >= 2 && value.every(Number.isFinite)) {
|
|
1424
|
-
const { latitude, longitude } = import_echo_schema7.GeoLocation.fromGeoPoint(value);
|
|
1425
|
-
return `${latitude},${longitude}`;
|
|
1426
|
-
}
|
|
1427
|
-
return String(value);
|
|
1428
|
-
}
|
|
1429
|
-
default: {
|
|
1430
|
-
if (value === null || value === "undefined") {
|
|
1431
|
-
return "";
|
|
1432
|
-
}
|
|
1433
|
-
return String(value);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
};
|
|
1437
|
-
var formatForEditing = ({ type, format, value, locale = void 0 }) => {
|
|
1438
|
-
const formatScalar = (type2) => {
|
|
1439
|
-
switch (type2) {
|
|
1440
|
-
case import_echo_schema7.TypeEnum.Boolean:
|
|
1441
|
-
case import_echo_schema7.TypeEnum.Number:
|
|
1442
|
-
case import_echo_schema7.TypeEnum.String:
|
|
1443
|
-
case import_echo_schema7.TypeEnum.Ref:
|
|
1444
|
-
return String(value);
|
|
1445
|
-
default:
|
|
1446
|
-
return String(value);
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
if (!format) {
|
|
1450
|
-
return formatScalar(type);
|
|
1451
|
-
}
|
|
1452
|
-
switch (format) {
|
|
1453
|
-
case import_echo_schema7.FormatEnum.Boolean:
|
|
1454
|
-
case import_echo_schema7.FormatEnum.Number:
|
|
1455
|
-
case import_echo_schema7.FormatEnum.String:
|
|
1456
|
-
case import_echo_schema7.FormatEnum.Ref: {
|
|
1457
|
-
return formatScalar(type);
|
|
1458
|
-
}
|
|
1459
|
-
case import_echo_schema7.FormatEnum.Percent: {
|
|
1460
|
-
return String(value * 100);
|
|
1461
|
-
}
|
|
1462
|
-
case import_echo_schema7.FormatEnum.Currency: {
|
|
1463
|
-
return String(value);
|
|
1464
|
-
}
|
|
1465
|
-
case import_echo_schema7.FormatEnum.DateTime: {
|
|
1466
|
-
const date = new Date(value);
|
|
1467
|
-
return date.toISOString();
|
|
1468
|
-
}
|
|
1469
|
-
case import_echo_schema7.FormatEnum.Date: {
|
|
1470
|
-
const date = new Date(value);
|
|
1471
|
-
return date.toISOString().split("T")[0];
|
|
1472
|
-
}
|
|
1473
|
-
case import_echo_schema7.FormatEnum.Time: {
|
|
1474
|
-
const date = new Date(value);
|
|
1475
|
-
return date.toISOString().split("T")[1].split(".")[0];
|
|
1476
|
-
}
|
|
1477
|
-
case import_echo_schema7.FormatEnum.GeoPoint: {
|
|
1478
|
-
if (value === null || value === void 0) {
|
|
1479
|
-
return "";
|
|
1480
|
-
}
|
|
1481
|
-
if (Array.isArray(value) && value.length >= 2 && value.every(Number.isFinite)) {
|
|
1482
|
-
const { latitude, longitude } = import_echo_schema7.GeoLocation.fromGeoPoint(value);
|
|
1483
|
-
return `${latitude},${longitude}`;
|
|
1484
|
-
}
|
|
1485
|
-
return String(value);
|
|
1486
|
-
}
|
|
1487
|
-
default: {
|
|
1488
|
-
return String(value);
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
};
|
|
1492
|
-
var findArrayElementType = (ast) => {
|
|
1493
|
-
const tupleType = (0, import_effect10.findNode)(ast, import_effect9.SchemaAST.isTupleType);
|
|
1494
|
-
const elementType = tupleType?.rest[0]?.type;
|
|
1495
|
-
return elementType;
|
|
1496
|
-
};
|
|
1497
|
-
var getRefProps = (property) => {
|
|
1498
|
-
const { ast, format, array } = property;
|
|
1499
|
-
if (format === import_echo_schema8.FormatEnum.Ref) {
|
|
1500
|
-
return {
|
|
1501
|
-
ast,
|
|
1502
|
-
isArray: false
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
if (array) {
|
|
1506
|
-
const elementType = findArrayElementType(ast);
|
|
1507
|
-
if (elementType) {
|
|
1508
|
-
const annotation = (0, import_effect8.findAnnotation)(elementType, import_echo_schema8.ReferenceAnnotationId);
|
|
1509
|
-
if (annotation) {
|
|
1510
|
-
return {
|
|
1511
|
-
ast: elementType,
|
|
1512
|
-
isArray: true
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
return void 0;
|
|
1518
|
-
};
|
|
1519
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
|
|
1520
|
-
var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
|
|
1521
|
-
var _effect = (0, import_tracking13.useSignals)();
|
|
1522
|
-
try {
|
|
1523
|
-
const { t } = (0, import_react_ui10.useTranslation)(translationKey);
|
|
1524
|
-
const { ast, name, type, title } = property;
|
|
1525
|
-
const values = useFormValues(path ?? []) ?? [];
|
|
1526
|
-
(0, import_invariant2.invariant)(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
|
|
1527
|
-
F: __dxlog_file3,
|
|
1528
|
-
L: 36,
|
|
1529
|
-
S: void 0,
|
|
1530
|
-
A: [
|
|
1531
|
-
"Array.isArray(values)",
|
|
1532
|
-
"`Values at path ${path?.join('.')} must be an array.`"
|
|
1533
|
-
]
|
|
1534
|
-
});
|
|
1535
|
-
const label = title ?? (0, import_effect6.pipe)(name, import_String2.capitalize);
|
|
1536
|
-
const elementType = findArrayElementType(ast);
|
|
1537
|
-
const getDefaultObjectValue = (typeNode) => {
|
|
1538
|
-
const baseNode = (0, import_effect7.findNode)(typeNode, import_effect7.isDiscriminatedUnion);
|
|
1539
|
-
const typeLiteral = baseNode ? (0, import_effect7.getDiscriminatedType)(baseNode, {}) : (0, import_effect7.findNode)(typeNode, import_effect6.SchemaAST.isTypeLiteral);
|
|
1540
|
-
if (!typeLiteral) {
|
|
1541
|
-
return {};
|
|
1542
|
-
}
|
|
1543
|
-
return Object.fromEntries((0, import_schema4.getSchemaProperties)(typeLiteral, {}).map((prop) => [
|
|
1544
|
-
prop.name,
|
|
1545
|
-
prop.defaultValue
|
|
1546
|
-
]));
|
|
1547
|
-
};
|
|
1548
|
-
const getDefaultValue = () => type === "object" && elementType ? getDefaultObjectValue(elementType) : import_effect7.SimpleType.getDefaultValue(type);
|
|
1549
|
-
const handleAdd = (0, import_react16.useCallback)(() => {
|
|
1550
|
-
inputProps.onValueChange(type, [
|
|
1551
|
-
...values,
|
|
1552
|
-
getDefaultValue()
|
|
1553
|
-
]);
|
|
1554
|
-
}, [
|
|
1555
|
-
type,
|
|
1556
|
-
elementType,
|
|
1557
|
-
inputProps,
|
|
1558
|
-
values
|
|
1559
|
-
]);
|
|
1560
|
-
const handleRemove = (0, import_react16.useCallback)((index) => {
|
|
1561
|
-
const newValues = values.filter((_, i) => i !== index);
|
|
1562
|
-
inputProps.onValueChange(type, newValues);
|
|
1563
|
-
}, [
|
|
1564
|
-
type,
|
|
1565
|
-
inputProps,
|
|
1566
|
-
values
|
|
1567
|
-
]);
|
|
1568
|
-
if (!elementType) {
|
|
1569
|
-
return null;
|
|
1570
|
-
}
|
|
1571
|
-
return readonly && values.length < 1 ? null : /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(InputHeader, {
|
|
1572
|
-
readonly: true,
|
|
1573
|
-
label
|
|
1574
|
-
}), /* @__PURE__ */ import_react16.default.createElement("div", {
|
|
1575
|
-
role: "none",
|
|
1576
|
-
className: readonly ? "flex flex-wrap gap-1 mlb-1" : values.length > 0 ? "grid gap-1 grid-cols-[1fr_min-content] mlb-1" : "hidden"
|
|
1577
|
-
}, values.map((_value, index) => {
|
|
1578
|
-
const field = /* @__PURE__ */ import_react16.default.createElement(FormField, {
|
|
1579
|
-
property: {
|
|
1580
|
-
...property,
|
|
1581
|
-
array: false,
|
|
1582
|
-
ast: elementType
|
|
1583
|
-
},
|
|
1584
|
-
path: [
|
|
1585
|
-
...path ?? [],
|
|
1586
|
-
index
|
|
1587
|
-
],
|
|
1588
|
-
readonly,
|
|
1589
|
-
inline: true,
|
|
1590
|
-
Custom,
|
|
1591
|
-
lookupComponent
|
|
1592
|
-
});
|
|
1593
|
-
return readonly ? field : /* @__PURE__ */ import_react16.default.createElement(import_react16.Fragment, {
|
|
1594
|
-
key: index
|
|
1595
|
-
}, /* @__PURE__ */ import_react16.default.createElement("div", {
|
|
1596
|
-
role: "none"
|
|
1597
|
-
}, field), /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.IconButton, {
|
|
1598
|
-
icon: "ph--trash--regular",
|
|
1599
|
-
iconOnly: true,
|
|
1600
|
-
label: t("button remove"),
|
|
1601
|
-
onClick: () => handleRemove(index),
|
|
1602
|
-
classNames: "self-center"
|
|
1603
|
-
}));
|
|
1604
|
-
})), !readonly && /* @__PURE__ */ import_react16.default.createElement(import_react_ui10.IconButton, {
|
|
1605
|
-
classNames: "is-full mlb-1 flex",
|
|
1606
|
-
icon: "ph--plus--regular",
|
|
1607
|
-
label: t("add field"),
|
|
1608
|
-
onClick: handleAdd
|
|
1609
|
-
}));
|
|
1610
|
-
} finally {
|
|
1611
|
-
_effect.f();
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, getValue: getValue3, onBlur, onQueryRefOptions, onValueChange, ...restInputProps }) => {
|
|
1615
|
-
var _effect = (0, import_tracking14.useSignals)();
|
|
1616
|
-
try {
|
|
1617
|
-
const { t } = (0, import_react_ui11.useTranslation)(translationKey);
|
|
1618
|
-
const refTypeInfo = (0, import_react17.useMemo)(() => ast ? (0, import_effect11.findAnnotation)(ast, import_echo_schema9.ReferenceAnnotationId) : void 0, [
|
|
1619
|
-
ast
|
|
1620
|
-
]);
|
|
1621
|
-
const { options: availableOptions, loading: _loading } = useQueryRefOptions({
|
|
1622
|
-
refTypeInfo,
|
|
1623
|
-
onQueryRefOptions
|
|
1624
|
-
});
|
|
1625
|
-
if (refTypeInfo && refTypeInfo?.typename === (0, import_echo_schema9.getTypeAnnotation)(import_echo_schema9.Expando)?.typename || !onQueryRefOptions) {
|
|
1626
|
-
return /* @__PURE__ */ import_react17.default.createElement(RefFieldFallback, {
|
|
1627
|
-
type,
|
|
1628
|
-
label,
|
|
1629
|
-
placeholder,
|
|
1630
|
-
disabled,
|
|
1631
|
-
inputOnly,
|
|
1632
|
-
getValue: getValue3,
|
|
1633
|
-
onBlur,
|
|
1634
|
-
onValueChange,
|
|
1635
|
-
...restInputProps
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
const handleGetValue = (0, import_react17.useCallback)(() => {
|
|
1639
|
-
const formValue = getValue3();
|
|
1640
|
-
const unknownToRefOption = (val) => {
|
|
1641
|
-
if (import_echo_schema9.Ref.isRef(val)) {
|
|
1642
|
-
const dxnString = val.dxn.toString();
|
|
1643
|
-
const matchingOption = availableOptions.find((option2) => option2.id === dxnString);
|
|
1644
|
-
if (matchingOption) {
|
|
1645
|
-
return matchingOption;
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
return void 0;
|
|
1649
|
-
};
|
|
1650
|
-
if (array && Array.isArray(formValue)) {
|
|
1651
|
-
return formValue.map(unknownToRefOption).filter(import_util5.isNonNullable) ?? [];
|
|
1652
|
-
}
|
|
1653
|
-
const option = unknownToRefOption(formValue);
|
|
1654
|
-
if (option) {
|
|
1655
|
-
return [
|
|
1656
|
-
option
|
|
1657
|
-
];
|
|
1658
|
-
}
|
|
1659
|
-
return [];
|
|
1660
|
-
}, [
|
|
1661
|
-
getValue3,
|
|
1662
|
-
availableOptions,
|
|
1663
|
-
array
|
|
1664
|
-
]);
|
|
1665
|
-
const handleSearch = (0, import_react17.useCallback)((text, ids) => availableOptions.filter((option) => !ids.includes(option.id)).filter((option) => option.label.toLowerCase().includes(text.toLowerCase())).map((option) => ({
|
|
1666
|
-
id: option.id,
|
|
1667
|
-
label: option.label,
|
|
1668
|
-
hue: option.hue
|
|
1669
|
-
})), [
|
|
1670
|
-
availableOptions
|
|
1671
|
-
]);
|
|
1672
|
-
const handleUpdate = (0, import_react17.useCallback)((ids) => {
|
|
1673
|
-
if (ids.length === 0) {
|
|
1674
|
-
onValueChange("object", void 0);
|
|
1675
|
-
return;
|
|
1676
|
-
}
|
|
1677
|
-
const refs = ids.map((id) => {
|
|
1678
|
-
const item = availableOptions.find((option) => option.id === id);
|
|
1679
|
-
if (item) {
|
|
1680
|
-
const dxn = import_keys2.DXN.parse(item.id);
|
|
1681
|
-
return import_echo_schema9.Ref.fromDXN(dxn);
|
|
1682
|
-
}
|
|
1683
|
-
return null;
|
|
1684
|
-
}).filter(import_util5.isNonNullable);
|
|
1685
|
-
if (array) {
|
|
1686
|
-
onValueChange("object", refs);
|
|
1687
|
-
} else {
|
|
1688
|
-
onValueChange("object", refs[0]);
|
|
1689
|
-
}
|
|
1690
|
-
}, [
|
|
1691
|
-
availableOptions,
|
|
1692
|
-
array,
|
|
1693
|
-
onValueChange
|
|
1694
|
-
]);
|
|
1695
|
-
const tagPickerMode = (0, import_react17.useMemo)(() => array ? "multi-select" : "single-select", [
|
|
1696
|
-
array
|
|
1697
|
-
]);
|
|
1698
|
-
if (!refTypeInfo) {
|
|
1699
|
-
return null;
|
|
1700
|
-
}
|
|
1701
|
-
const { status, error } = restInputProps.getStatus();
|
|
1702
|
-
const items = handleGetValue();
|
|
1703
|
-
return disabled && items.length < 1 ? null : /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Input.Root, {
|
|
1704
|
-
validationValence: status
|
|
1705
|
-
}, !inputOnly && /* @__PURE__ */ import_react17.default.createElement(InputHeader, {
|
|
1706
|
-
error,
|
|
1707
|
-
label
|
|
1708
|
-
}), /* @__PURE__ */ import_react17.default.createElement("div", {
|
|
1709
|
-
"data-no-submit": true
|
|
1710
|
-
}, disabled ? items.length < 1 ? /* @__PURE__ */ import_react17.default.createElement("p", {
|
|
1711
|
-
className: (0, import_react_ui_theme8.mx)(import_react_ui_theme8.descriptionText, "mbe-2")
|
|
1712
|
-
}, t("empty readonly ref field label")) : items.map((item) => /* @__PURE__ */ import_react17.default.createElement(import_react18.DxRefTag, {
|
|
1713
|
-
key: item.id,
|
|
1714
|
-
refid: item.id,
|
|
1715
|
-
rootclassname: "mie-1",
|
|
1716
|
-
style: {
|
|
1717
|
-
marginInlineEnd: ".25rem"
|
|
1718
|
-
}
|
|
1719
|
-
}, item.label)) : /* @__PURE__ */ import_react17.default.createElement(import_react_ui_tag_picker.TagPicker, {
|
|
1720
|
-
readonly: disabled,
|
|
1721
|
-
items,
|
|
1722
|
-
mode: tagPickerMode,
|
|
1723
|
-
onBlur: (event) => onBlur(event),
|
|
1724
|
-
onUpdate: handleUpdate,
|
|
1725
|
-
onSearch: handleSearch,
|
|
1726
|
-
classNames: "rounded-sm bg-inputSurface p-1.5"
|
|
1727
|
-
})), inputOnly && /* @__PURE__ */ import_react17.default.createElement(import_react_ui11.Input.DescriptionAndValidation, null, error));
|
|
1728
|
-
} finally {
|
|
1729
|
-
_effect.f();
|
|
1730
|
-
}
|
|
1731
|
-
};
|
|
1732
|
-
var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValue: getValue3, onValueChange, ...restInputProps }) => {
|
|
1733
|
-
var _effect = (0, import_tracking14.useSignals)();
|
|
1734
|
-
try {
|
|
1735
|
-
const handleOnValueChange = (_type, dxnString) => {
|
|
1736
|
-
const dxn = import_keys2.DXN.tryParse(dxnString);
|
|
1737
|
-
if (dxn) {
|
|
1738
|
-
onValueChange?.("object", import_echo_schema9.Ref.fromDXN(dxn));
|
|
1739
|
-
} else if (dxnString === "") {
|
|
1740
|
-
onValueChange?.("object", void 0);
|
|
1741
|
-
} else {
|
|
1742
|
-
onValueChange?.("string", dxnString);
|
|
1743
|
-
}
|
|
1744
|
-
};
|
|
1745
|
-
const handleGetValue = () => {
|
|
1746
|
-
const formValue = getValue3();
|
|
1747
|
-
if (typeof formValue === "string") {
|
|
1748
|
-
return formValue;
|
|
1749
|
-
}
|
|
1750
|
-
if (import_echo_schema9.Ref.isRef(formValue)) {
|
|
1751
|
-
return formValue.dxn.toString();
|
|
1752
|
-
}
|
|
1753
|
-
return void 0;
|
|
1754
|
-
};
|
|
1755
|
-
return /* @__PURE__ */ import_react17.default.createElement(TextInput, {
|
|
1756
|
-
type,
|
|
1757
|
-
label,
|
|
1758
|
-
disabled,
|
|
1759
|
-
placeholder,
|
|
1760
|
-
inputOnly,
|
|
1761
|
-
getValue: handleGetValue,
|
|
1762
|
-
onValueChange: handleOnValueChange,
|
|
1763
|
-
...restInputProps
|
|
1764
|
-
});
|
|
1765
|
-
} finally {
|
|
1766
|
-
_effect.f();
|
|
1767
|
-
}
|
|
1768
|
-
};
|
|
1769
|
-
var getInputComponent = (type, format) => {
|
|
1770
|
-
switch (format) {
|
|
1771
|
-
case import_echo_schema10.FormatEnum.GeoPoint:
|
|
1772
|
-
return GeoPointInput;
|
|
1773
|
-
case import_echo_schema10.FormatEnum.Markdown:
|
|
1774
|
-
return MarkdownInput;
|
|
1775
|
-
}
|
|
1776
|
-
switch (type) {
|
|
1777
|
-
case "string":
|
|
1778
|
-
return TextInput;
|
|
1779
|
-
case "number":
|
|
1780
|
-
return NumberInput;
|
|
1781
|
-
case "boolean":
|
|
1782
|
-
return BooleanInput;
|
|
1783
|
-
}
|
|
1784
|
-
};
|
|
1785
|
-
var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupComponent, Custom }) => {
|
|
1786
|
-
var _effect = (0, import_tracking12.useSignals)();
|
|
1787
|
-
try {
|
|
1788
|
-
const { ast, name, type, format, title, description, options, examples, array } = property;
|
|
1789
|
-
const inputProps = useInputProps(path);
|
|
1790
|
-
const label = (0, import_react15.useMemo)(() => title ?? (0, import_effect4.pipe)(name, import_String.capitalize), [
|
|
1791
|
-
title,
|
|
1792
|
-
name
|
|
1793
|
-
]);
|
|
1794
|
-
const placeholder = (0, import_react15.useMemo)(() => examples?.length ? `Example: "${examples[0]}"` : description, [
|
|
1795
|
-
examples,
|
|
1796
|
-
description
|
|
1797
|
-
]);
|
|
1798
|
-
const FoundComponent = lookupComponent?.({
|
|
1799
|
-
prop: name,
|
|
1800
|
-
schema: import_effect4.Schema.make(ast),
|
|
1801
|
-
inputProps: {
|
|
1802
|
-
type,
|
|
1803
|
-
format,
|
|
1804
|
-
label,
|
|
1805
|
-
disabled: readonly,
|
|
1806
|
-
placeholder,
|
|
1807
|
-
...inputProps
|
|
1808
|
-
}
|
|
1809
|
-
});
|
|
1810
|
-
if (FoundComponent) {
|
|
1811
|
-
return FoundComponent;
|
|
1812
|
-
}
|
|
1813
|
-
const jsonPath = (0, import_effect5.createJsonPath)(path ?? []);
|
|
1814
|
-
const CustomComponent = Custom?.[jsonPath];
|
|
1815
|
-
if (CustomComponent) {
|
|
1816
|
-
return /* @__PURE__ */ import_react15.default.createElement(CustomComponent, {
|
|
1817
|
-
type,
|
|
1818
|
-
format,
|
|
1819
|
-
label,
|
|
1820
|
-
inputOnly: inline,
|
|
1821
|
-
placeholder,
|
|
1822
|
-
disabled: readonly,
|
|
1823
|
-
...inputProps
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
|
-
const refProps = getRefProps(property);
|
|
1827
|
-
if (refProps) {
|
|
1828
|
-
return /* @__PURE__ */ import_react15.default.createElement(RefField, {
|
|
1829
|
-
ast: refProps.ast,
|
|
1830
|
-
array: refProps.isArray,
|
|
1831
|
-
type,
|
|
1832
|
-
format,
|
|
1833
|
-
label,
|
|
1834
|
-
placeholder,
|
|
1835
|
-
disabled: readonly,
|
|
1836
|
-
inputOnly: inline,
|
|
1837
|
-
onQueryRefOptions,
|
|
1838
|
-
...inputProps
|
|
1839
|
-
});
|
|
1840
|
-
}
|
|
1841
|
-
if (array) {
|
|
1842
|
-
return /* @__PURE__ */ import_react15.default.createElement(ArrayField, {
|
|
1843
|
-
property,
|
|
1844
|
-
path,
|
|
1845
|
-
inputProps,
|
|
1846
|
-
readonly,
|
|
1847
|
-
Custom
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1850
|
-
const InputComponent = getInputComponent(type, format);
|
|
1851
|
-
if (InputComponent) {
|
|
1852
|
-
return /* @__PURE__ */ import_react15.default.createElement(InputComponent, {
|
|
1853
|
-
type,
|
|
1854
|
-
format,
|
|
1855
|
-
label,
|
|
1856
|
-
inputOnly: inline,
|
|
1857
|
-
placeholder,
|
|
1858
|
-
disabled: readonly,
|
|
1859
|
-
...inputProps
|
|
1860
|
-
});
|
|
1861
|
-
}
|
|
1862
|
-
if (options) {
|
|
1863
|
-
return /* @__PURE__ */ import_react15.default.createElement(SelectInput, {
|
|
1864
|
-
type,
|
|
1865
|
-
format,
|
|
1866
|
-
disabled: readonly,
|
|
1867
|
-
inputOnly: inline,
|
|
1868
|
-
label,
|
|
1869
|
-
options: options.map((option) => ({
|
|
1870
|
-
value: option,
|
|
1871
|
-
label: String(option)
|
|
1872
|
-
})),
|
|
1873
|
-
placeholder,
|
|
1874
|
-
...inputProps
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
if (type === "object") {
|
|
1878
|
-
const baseNode = (0, import_effect5.findNode)(ast, import_effect5.isDiscriminatedUnion);
|
|
1879
|
-
const typeLiteral = baseNode ? (0, import_effect5.getDiscriminatedType)(baseNode, inputProps.getValue()) : (0, import_effect5.findNode)(ast, import_effect4.SchemaAST.isTypeLiteral);
|
|
1880
|
-
if (typeLiteral) {
|
|
1881
|
-
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, !inline && /* @__PURE__ */ import_react15.default.createElement("h3", {
|
|
1882
|
-
className: (0, import_react_ui_theme7.mx)("text-lg mlb-inputSpacingBlock first:mbs-0")
|
|
1883
|
-
}, label), /* @__PURE__ */ import_react15.default.createElement(FormFields, {
|
|
1884
|
-
schema: import_effect4.Schema.make(typeLiteral),
|
|
1885
|
-
path,
|
|
1886
|
-
readonly,
|
|
1887
|
-
onQueryRefOptions,
|
|
1888
|
-
Custom,
|
|
1889
|
-
lookupComponent
|
|
1890
|
-
}));
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
return null;
|
|
1894
|
-
} finally {
|
|
1895
|
-
_effect.f();
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1898
|
-
var FormFields = /* @__PURE__ */ (0, import_react15.forwardRef)(({ classNames, testId, schema, path, filter, sort, readonly, lookupComponent, Custom, onQueryRefOptions }, forwardRef2) => {
|
|
1899
|
-
var _effect = (0, import_tracking12.useSignals)();
|
|
1900
|
-
try {
|
|
1901
|
-
const values = useFormValues(path);
|
|
1902
|
-
const properties = (0, import_react15.useMemo)(() => {
|
|
1903
|
-
const props = (0, import_schema3.getSchemaProperties)(schema.ast, values);
|
|
1904
|
-
const filtered = filter ? filter(props) : props;
|
|
1905
|
-
return sort ? filtered.sort((a, b) => sort.indexOf(a.name) - sort.indexOf(b.name)) : filtered;
|
|
1906
|
-
}, [
|
|
1907
|
-
schema,
|
|
1908
|
-
values,
|
|
1909
|
-
filter,
|
|
1910
|
-
sort
|
|
1911
|
-
]);
|
|
1912
|
-
return /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
1913
|
-
role: "form",
|
|
1914
|
-
className: (0, import_react_ui_theme7.mx)("is-full", classNames),
|
|
1915
|
-
ref: forwardRef2
|
|
1916
|
-
}, properties.map((property) => {
|
|
1917
|
-
return /* @__PURE__ */ import_react15.default.createElement(FormField, {
|
|
1918
|
-
key: property.name,
|
|
1919
|
-
property,
|
|
1920
|
-
path: [
|
|
1921
|
-
...path ?? [],
|
|
1922
|
-
property.name
|
|
1923
|
-
],
|
|
1924
|
-
readonly,
|
|
1925
|
-
onQueryRefOptions,
|
|
1926
|
-
lookupComponent,
|
|
1927
|
-
Custom
|
|
1928
|
-
});
|
|
1929
|
-
}).filter(import_util4.isNotFalsy));
|
|
1930
|
-
} finally {
|
|
1931
|
-
_effect.f();
|
|
1932
|
-
}
|
|
1933
|
-
});
|
|
1934
|
-
var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, autoSave, outerSpacing = true, onCancel, schema, onValuesChanged, onValidate, onSave, ...props }) => {
|
|
1935
|
-
var _effect = (0, import_tracking9.useSignals)();
|
|
1936
|
-
try {
|
|
1937
|
-
const formRef = (0, import_react9.useRef)(null);
|
|
1938
|
-
const handleValid = (0, import_react9.useMemo)(() => autoSave ? onSave : void 0, [
|
|
1939
|
-
autoSave,
|
|
1940
|
-
onSave
|
|
1941
|
-
]);
|
|
1942
|
-
(0, import_react9.useEffect)(() => {
|
|
1943
|
-
if (autoFocus && formRef.current) {
|
|
1944
|
-
const input = formRef.current.querySelector("input");
|
|
1945
|
-
if (input) {
|
|
1946
|
-
input.focus();
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
}, [
|
|
1950
|
-
autoFocus
|
|
1951
|
-
]);
|
|
1952
|
-
return /* @__PURE__ */ import_react9.default.createElement(FormProvider, {
|
|
1953
|
-
formRef,
|
|
1954
|
-
schema,
|
|
1955
|
-
autoSave,
|
|
1956
|
-
initialValues,
|
|
1957
|
-
onValuesChanged,
|
|
1958
|
-
onValidate,
|
|
1959
|
-
onValid: handleValid,
|
|
1960
|
-
onSave
|
|
1961
|
-
}, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1962
|
-
role: "none",
|
|
1963
|
-
className: "contents",
|
|
1964
|
-
"data-testid": testId
|
|
1965
|
-
}, /* @__PURE__ */ import_react9.default.createElement(FormFields, {
|
|
1966
|
-
...props,
|
|
1967
|
-
ref: formRef,
|
|
1968
|
-
classNames: [
|
|
1969
|
-
outerSpacing === "blockStart-0" ? "pli-cardSpacingInline mbe-cardSpacingBlock [&>.mbs-inputSpacingBlock:first-child]:!mbs-0" : outerSpacing === "scroll-fields" ? "pli-cardSpacingInline pbe-cardSpacingBlock" : outerSpacing ? import_react_ui_stack2.cardSpacing : false,
|
|
1970
|
-
outerSpacing === "scroll-fields" && import_react_ui_stack2.cardDialogOverflow,
|
|
1971
|
-
classNames
|
|
1972
|
-
],
|
|
1973
|
-
readonly,
|
|
1974
|
-
schema
|
|
1975
|
-
}), (onCancel || onSave) && !autoSave && /* @__PURE__ */ import_react9.default.createElement(FormActions, {
|
|
1976
|
-
readonly,
|
|
1977
|
-
onCancel,
|
|
1978
|
-
outerSpacing
|
|
1979
|
-
})));
|
|
1980
|
-
} finally {
|
|
1981
|
-
_effect.f();
|
|
1982
|
-
}
|
|
1983
|
-
};
|
|
1984
|
-
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
|
|
1985
|
-
var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerSpacing }) => {
|
|
1986
|
-
var _effect = (0, import_tracking3.useSignals)();
|
|
1987
|
-
try {
|
|
1988
|
-
const { t } = (0, import_react_ui3.useTranslation)(translationKey);
|
|
1989
|
-
const [props, setProps] = (0, import_react3.useState)(projection.getFieldProjection(field.id).props);
|
|
1990
|
-
(0, import_react3.useEffect)(() => setProps(projection.getFieldProjection(field.id).props), [
|
|
1991
|
-
field,
|
|
1992
|
-
projection
|
|
1993
|
-
]);
|
|
1994
|
-
const [schemas, setSchemas] = (0, import_react3.useState)([]);
|
|
1995
|
-
(0, import_react3.useEffect)(() => {
|
|
1996
|
-
if (!registry) {
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
const subscription = registry.query().subscribe((query) => setSchemas(query.results), {
|
|
2000
|
-
fire: true
|
|
2001
|
-
});
|
|
2002
|
-
const t2 = setTimeout(async () => {
|
|
2003
|
-
const schemas2 = await registry.query().run();
|
|
2004
|
-
setSchemas(schemas2);
|
|
2005
|
-
});
|
|
2006
|
-
return () => {
|
|
2007
|
-
clearTimeout(t2);
|
|
2008
|
-
subscription?.();
|
|
2009
|
-
};
|
|
2010
|
-
}, [
|
|
2011
|
-
registry
|
|
2012
|
-
]);
|
|
2013
|
-
const [referenceSchema, setReferenceSchema] = (0, import_react3.useState)();
|
|
2014
|
-
(0, import_react3.useEffect)(() => {
|
|
2015
|
-
setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
|
|
2016
|
-
}, [
|
|
2017
|
-
schemas,
|
|
2018
|
-
props?.referenceSchema
|
|
2019
|
-
]);
|
|
2020
|
-
const [{ fieldSchema }, setFieldSchema] = (0, import_react3.useState)({
|
|
2021
|
-
fieldSchema: (0, import_schema.getFormatSchema)(props?.format)
|
|
2022
|
-
});
|
|
2023
|
-
const handleValuesChanged = (0, import_react3.useCallback)((_props) => {
|
|
2024
|
-
setFieldSchema((prev) => {
|
|
2025
|
-
const fieldSchema2 = (0, import_schema.getFormatSchema)(_props.format);
|
|
2026
|
-
if (prev.fieldSchema === fieldSchema2) {
|
|
2027
|
-
return prev;
|
|
2028
|
-
}
|
|
2029
|
-
return {
|
|
2030
|
-
fieldSchema: fieldSchema2
|
|
2031
|
-
};
|
|
2032
|
-
});
|
|
2033
|
-
setReferenceSchema((prev) => {
|
|
2034
|
-
if (_props.referenceSchema !== prev?.typename) {
|
|
2035
|
-
const newSchema = schemas.find((schema) => schema.typename === _props.referenceSchema);
|
|
2036
|
-
if (newSchema) {
|
|
2037
|
-
return newSchema;
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
return prev;
|
|
2041
|
-
});
|
|
2042
|
-
setProps((props2) => {
|
|
2043
|
-
const type = import_echo_schema.formatToType[_props.format];
|
|
2044
|
-
if (props2.type !== type) {
|
|
2045
|
-
return {
|
|
2046
|
-
...props2,
|
|
2047
|
-
..._props,
|
|
2048
|
-
type
|
|
2049
|
-
};
|
|
2050
|
-
}
|
|
2051
|
-
return _props;
|
|
2052
|
-
});
|
|
2053
|
-
}, [
|
|
2054
|
-
schemas,
|
|
2055
|
-
props.format,
|
|
2056
|
-
props.referenceSchema
|
|
2057
|
-
]);
|
|
2058
|
-
const handleValidate = (0, import_react3.useCallback)(({ property }) => {
|
|
2059
|
-
if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
|
|
2060
|
-
return [
|
|
2061
|
-
{
|
|
2062
|
-
path: "property",
|
|
2063
|
-
message: `property is not unique: '${property}'`
|
|
2064
|
-
}
|
|
2065
|
-
];
|
|
2066
|
-
}
|
|
2067
|
-
}, [
|
|
2068
|
-
view.fields,
|
|
2069
|
-
field
|
|
2070
|
-
]);
|
|
2071
|
-
const handleSave = (0, import_react3.useCallback)((props2) => {
|
|
2072
|
-
projection.setFieldProjection({
|
|
2073
|
-
field,
|
|
2074
|
-
props: props2
|
|
2075
|
-
});
|
|
2076
|
-
onSave();
|
|
2077
|
-
}, [
|
|
2078
|
-
projection,
|
|
2079
|
-
field,
|
|
2080
|
-
onSave
|
|
2081
|
-
]);
|
|
2082
|
-
const handleCancel = (0, import_react3.useCallback)(() => {
|
|
2083
|
-
requestAnimationFrame(() => onCancel?.());
|
|
2084
|
-
onSave();
|
|
2085
|
-
}, [
|
|
2086
|
-
onSave
|
|
2087
|
-
]);
|
|
2088
|
-
const custom = (0, import_react3.useMemo)(() => ({
|
|
2089
|
-
["format"]: (props2) => /* @__PURE__ */ import_react3.default.createElement(SelectInput, {
|
|
2090
|
-
...props2,
|
|
2091
|
-
options: import_echo_schema.FormatEnums.filter((value) => value !== import_echo_schema.FormatEnum.None).map((value) => ({
|
|
2092
|
-
value,
|
|
2093
|
-
label: t(`format ${value}`)
|
|
2094
|
-
}))
|
|
2095
|
-
}),
|
|
2096
|
-
["referenceSchema"]: (props2) => /* @__PURE__ */ import_react3.default.createElement(SelectInput, {
|
|
2097
|
-
...props2,
|
|
2098
|
-
options: schemas.map((schema) => ({
|
|
2099
|
-
value: schema.typename
|
|
2100
|
-
}))
|
|
2101
|
-
}),
|
|
2102
|
-
["referencePath"]: (props2) => /* @__PURE__ */ import_react3.default.createElement(SelectInput, {
|
|
2103
|
-
...props2,
|
|
2104
|
-
options: referenceSchema ? (0, import_schema.getSchemaProperties)(referenceSchema.ast).sort(import_schema.sortProperties).map((p) => ({
|
|
2105
|
-
value: p.name
|
|
2106
|
-
})) : []
|
|
2107
|
-
}),
|
|
2108
|
-
["options"]: (props2) => /* @__PURE__ */ import_react3.default.createElement(SelectOptionInput, props2)
|
|
2109
|
-
}), [
|
|
2110
|
-
t,
|
|
2111
|
-
schemas,
|
|
2112
|
-
referenceSchema
|
|
2113
|
-
]);
|
|
2114
|
-
const propIsNotType = (0, import_react3.useCallback)((props2) => props2.filter((p) => p.name !== "type"), []);
|
|
2115
|
-
if (!fieldSchema) {
|
|
2116
|
-
import_log.log.warn("invalid format", {
|
|
2117
|
-
props
|
|
2118
|
-
}, {
|
|
2119
|
-
F: __dxlog_file4,
|
|
2120
|
-
L: 183,
|
|
2121
|
-
S: void 0,
|
|
2122
|
-
C: (f, a) => f(...a)
|
|
2123
|
-
});
|
|
2124
|
-
return null;
|
|
2125
|
-
}
|
|
2126
|
-
return /* @__PURE__ */ import_react3.default.createElement(Form, {
|
|
2127
|
-
key: field.id,
|
|
2128
|
-
autoFocus: true,
|
|
2129
|
-
values: props,
|
|
2130
|
-
schema: fieldSchema,
|
|
2131
|
-
filter: propIsNotType,
|
|
2132
|
-
sort: [
|
|
2133
|
-
"property",
|
|
2134
|
-
"format"
|
|
2135
|
-
],
|
|
2136
|
-
onValuesChanged: handleValuesChanged,
|
|
2137
|
-
onValidate: handleValidate,
|
|
2138
|
-
onSave: handleSave,
|
|
2139
|
-
onCancel: handleCancel,
|
|
2140
|
-
Custom: custom,
|
|
2141
|
-
outerSpacing
|
|
2142
|
-
});
|
|
2143
|
-
} finally {
|
|
2144
|
-
_effect.f();
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
2148
|
-
var grid = "grid grid-cols-[32px_1fr_32px_32px] min-bs-[2.5rem]";
|
|
2149
|
-
var ViewMetaSchema = import_effect12.Schema.Struct({
|
|
2150
|
-
name: import_effect12.Schema.String.annotations({
|
|
2151
|
-
title: "View"
|
|
2152
|
-
}),
|
|
2153
|
-
typename: import_echo_schema11.Format.URL.annotations({
|
|
2154
|
-
title: "Typename"
|
|
2155
|
-
})
|
|
2156
|
-
}).pipe(import_effect12.Schema.mutable);
|
|
2157
|
-
var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, showHeading = false, onTypenameChanged, onDelete, outerSpacing = true }) => {
|
|
2158
|
-
var _effect = (0, import_tracking15.useSignals)();
|
|
2159
|
-
try {
|
|
2160
|
-
const { t } = (0, import_react_ui12.useTranslation)(translationKey);
|
|
2161
|
-
const projection = (0, import_react19.useMemo)(() => {
|
|
2162
|
-
const jsonSchema = schema instanceof import_echo_schema11.EchoSchema ? schema.jsonSchema : (0, import_echo_schema11.toJsonSchema)(schema);
|
|
2163
|
-
return new import_schema5.ViewProjection(jsonSchema, view);
|
|
2164
|
-
}, [
|
|
2165
|
-
schema,
|
|
2166
|
-
view
|
|
2167
|
-
]);
|
|
2168
|
-
const [field, setField] = (0, import_react19.useState)();
|
|
2169
|
-
const readonly = _readonly || !(0, import_echo_schema11.isMutable)(schema);
|
|
2170
|
-
const viewValues = (0, import_react19.useMemo)(() => {
|
|
2171
|
-
return {
|
|
2172
|
-
name: view.name,
|
|
2173
|
-
// TODO(burdon): Need to warn user of possible consequences of editing.
|
|
2174
|
-
// TODO(burdon): Settings should have domain name owned by user.
|
|
2175
|
-
typename: view.query.typename
|
|
2176
|
-
};
|
|
2177
|
-
}, [
|
|
2178
|
-
view
|
|
2179
|
-
]);
|
|
2180
|
-
const handleSelect = (0, import_react19.useCallback)((field2) => {
|
|
2181
|
-
if (readonly) {
|
|
2182
|
-
return;
|
|
2183
|
-
}
|
|
2184
|
-
setField((f) => f === field2 ? void 0 : field2);
|
|
2185
|
-
}, [
|
|
2186
|
-
readonly
|
|
2187
|
-
]);
|
|
2188
|
-
const handleAdd = (0, import_react19.useCallback)(() => {
|
|
2189
|
-
(0, import_invariant3.invariant)(!readonly, void 0, {
|
|
2190
|
-
F: __dxlog_file5,
|
|
2191
|
-
L: 92,
|
|
2192
|
-
S: void 0,
|
|
2193
|
-
A: [
|
|
2194
|
-
"!readonly",
|
|
2195
|
-
""
|
|
2196
|
-
]
|
|
2197
|
-
});
|
|
2198
|
-
const field2 = projection.createFieldProjection();
|
|
2199
|
-
setField(field2);
|
|
2200
|
-
}, [
|
|
2201
|
-
schema,
|
|
2202
|
-
view,
|
|
2203
|
-
readonly
|
|
2204
|
-
]);
|
|
2205
|
-
const handleUpdate = (0, import_react19.useCallback)(({ name, typename }) => {
|
|
2206
|
-
(0, import_invariant3.invariant)(!readonly, void 0, {
|
|
2207
|
-
F: __dxlog_file5,
|
|
2208
|
-
L: 99,
|
|
2209
|
-
S: void 0,
|
|
2210
|
-
A: [
|
|
2211
|
-
"!readonly",
|
|
2212
|
-
""
|
|
2213
|
-
]
|
|
2214
|
-
});
|
|
2215
|
-
requestAnimationFrame(() => {
|
|
2216
|
-
if (view.name !== name) {
|
|
2217
|
-
view.name = name;
|
|
2218
|
-
}
|
|
2219
|
-
if (view.query.typename !== typename && !readonly) {
|
|
2220
|
-
onTypenameChanged?.(typename);
|
|
2221
|
-
}
|
|
2222
|
-
});
|
|
2223
|
-
}, [
|
|
2224
|
-
schema,
|
|
2225
|
-
view,
|
|
2226
|
-
onTypenameChanged,
|
|
2227
|
-
readonly
|
|
2228
|
-
]);
|
|
2229
|
-
const handleDelete = (0, import_react19.useCallback)((fieldId) => {
|
|
2230
|
-
(0, import_invariant3.invariant)(!readonly, void 0, {
|
|
2231
|
-
F: __dxlog_file5,
|
|
2232
|
-
L: 115,
|
|
2233
|
-
S: void 0,
|
|
2234
|
-
A: [
|
|
2235
|
-
"!readonly",
|
|
2236
|
-
""
|
|
2237
|
-
]
|
|
2238
|
-
});
|
|
2239
|
-
if (fieldId === field?.id) {
|
|
2240
|
-
setField(void 0);
|
|
2241
|
-
}
|
|
2242
|
-
onDelete?.(fieldId);
|
|
2243
|
-
}, [
|
|
2244
|
-
schema,
|
|
2245
|
-
field,
|
|
2246
|
-
onDelete,
|
|
2247
|
-
readonly
|
|
2248
|
-
]);
|
|
2249
|
-
const handleMove = (0, import_react19.useCallback)((fromIndex, toIndex) => {
|
|
2250
|
-
(0, import_invariant3.invariant)(!readonly, void 0, {
|
|
2251
|
-
F: __dxlog_file5,
|
|
2252
|
-
L: 127,
|
|
2253
|
-
S: void 0,
|
|
2254
|
-
A: [
|
|
2255
|
-
"!readonly",
|
|
2256
|
-
""
|
|
2257
|
-
]
|
|
2258
|
-
});
|
|
2259
|
-
const fields = [
|
|
2260
|
-
...view.fields
|
|
2261
|
-
];
|
|
2262
|
-
const [moved] = fields.splice(fromIndex, 1);
|
|
2263
|
-
fields.splice(toIndex, 0, moved);
|
|
2264
|
-
view.fields = fields;
|
|
2265
|
-
}, [
|
|
2266
|
-
schema,
|
|
2267
|
-
view.fields,
|
|
2268
|
-
readonly
|
|
2269
|
-
]);
|
|
2270
|
-
const handleClose = (0, import_react19.useCallback)(() => setField(void 0), []);
|
|
2271
|
-
const hiddenProperties = projection.getHiddenProperties();
|
|
2272
|
-
const handleHide = (0, import_react19.useCallback)((fieldId) => {
|
|
2273
|
-
setField(void 0);
|
|
2274
|
-
projection.hideFieldProjection(fieldId);
|
|
2275
|
-
}, [
|
|
2276
|
-
projection
|
|
2277
|
-
]);
|
|
2278
|
-
const handleShow = (0, import_react19.useCallback)((property) => {
|
|
2279
|
-
setField(void 0);
|
|
2280
|
-
projection.showFieldProjection(property);
|
|
2281
|
-
}, [
|
|
2282
|
-
projection
|
|
2283
|
-
]);
|
|
2284
|
-
return /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2285
|
-
role: "none",
|
|
2286
|
-
className: (0, import_react_ui_theme9.mx)(classNames)
|
|
2287
|
-
}, readonly && /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2288
|
-
role: "none",
|
|
2289
|
-
className: (0, import_react_ui_theme9.mx)("is-full", outerSpacing && "plb-cardSpacingBlock pli-cardSpacingInline")
|
|
2290
|
-
}, /* @__PURE__ */ import_react19.default.createElement(import_react_ui12.Callout.Root, {
|
|
2291
|
-
valence: "info"
|
|
2292
|
-
}, /* @__PURE__ */ import_react19.default.createElement(import_react_ui12.Callout.Title, null, t("system schema description")))), /* @__PURE__ */ import_react19.default.createElement(Form, {
|
|
2293
|
-
autoSave: true,
|
|
2294
|
-
schema: ViewMetaSchema,
|
|
2295
|
-
values: viewValues,
|
|
2296
|
-
readonly,
|
|
2297
|
-
onSave: handleUpdate,
|
|
2298
|
-
outerSpacing
|
|
2299
|
-
}), /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2300
|
-
role: "none",
|
|
2301
|
-
className: outerSpacing ? import_react_ui_stack4.cardSpacing : "mlb-cardSpacingBlock"
|
|
2302
|
-
}, /* @__PURE__ */ import_react19.default.createElement("label", {
|
|
2303
|
-
className: (0, import_react_ui_theme9.mx)(import_react_ui_theme9.inputTextLabel)
|
|
2304
|
-
}, t("fields label")), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.Root, {
|
|
2305
|
-
items: view.fields,
|
|
2306
|
-
isItem: import_effect12.Schema.is(import_schema5.FieldSchema),
|
|
2307
|
-
getId: (field2) => field2.id,
|
|
2308
|
-
readonly,
|
|
2309
|
-
onMove: readonly ? void 0 : handleMove
|
|
2310
|
-
}, ({ items: fields }) => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, showHeading && /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2311
|
-
role: "heading",
|
|
2312
|
-
className: grid
|
|
2313
|
-
}, /* @__PURE__ */ import_react19.default.createElement("div", null), /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2314
|
-
className: "flex items-center text-sm"
|
|
2315
|
-
}, t("field path label"))), /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2316
|
-
role: "list",
|
|
2317
|
-
className: "flex flex-col is-full"
|
|
2318
|
-
}, fields?.map((field2) => /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.Item, {
|
|
2319
|
-
key: field2.id,
|
|
2320
|
-
item: field2,
|
|
2321
|
-
classNames: (0, import_react_ui_theme9.mx)(grid, import_react_ui_theme9.ghostHover, "overflow-hidden", !readonly && "cursor-pointer")
|
|
2322
|
-
}, /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemDragHandle, null), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemTitle, {
|
|
2323
|
-
onClick: () => handleSelect(field2)
|
|
2324
|
-
}, field2.path), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemButton, {
|
|
2325
|
-
"data-testid": "hide-field-button",
|
|
2326
|
-
icon: "ph--eye-slash--regular",
|
|
2327
|
-
// TDOO(burdon): Is this the correct test?
|
|
2328
|
-
disabled: view.fields.length <= 1,
|
|
2329
|
-
onClick: () => handleHide(field2.id)
|
|
2330
|
-
}), !readonly && /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemDeleteButton, {
|
|
2331
|
-
disabled: view.fields.length <= 1,
|
|
2332
|
-
onClick: () => handleDelete(field2.id)
|
|
2333
|
-
})))))), hiddenProperties.length > 0 && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement("label", {
|
|
2334
|
-
className: (0, import_react_ui_theme9.mx)(import_react_ui_theme9.inputTextLabel)
|
|
2335
|
-
}, t("hidden fields label")), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.Root, {
|
|
2336
|
-
items: hiddenProperties,
|
|
2337
|
-
isItem: (item) => typeof item === "string",
|
|
2338
|
-
getId: (property) => property
|
|
2339
|
-
}, ({ items: properties }) => /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2340
|
-
role: "list",
|
|
2341
|
-
className: "flex flex-col is-full"
|
|
2342
|
-
}, properties?.map((property) => /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.Item, {
|
|
2343
|
-
key: property,
|
|
2344
|
-
item: property,
|
|
2345
|
-
classNames: (0, import_react_ui_theme9.mx)(grid, import_react_ui_theme9.ghostHover, !readonly && "cursor-pointer")
|
|
2346
|
-
}, /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemDragHandle, {
|
|
2347
|
-
disabled: true
|
|
2348
|
-
}), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemTitle, null, property), /* @__PURE__ */ import_react19.default.createElement(import_react_ui_list2.List.ItemButton, {
|
|
2349
|
-
icon: "ph--eye--regular",
|
|
2350
|
-
onClick: () => handleShow(property),
|
|
2351
|
-
"data-testid": "show-field-button"
|
|
2352
|
-
}))))))), field && /* @__PURE__ */ import_react19.default.createElement(FieldEditor, {
|
|
2353
|
-
key: field.id,
|
|
2354
|
-
view,
|
|
2355
|
-
projection,
|
|
2356
|
-
field,
|
|
2357
|
-
registry,
|
|
2358
|
-
onSave: handleClose
|
|
2359
|
-
}), !readonly && !field && /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
2360
|
-
role: "none",
|
|
2361
|
-
className: outerSpacing ? import_react_ui_stack4.cardSpacing : "mlb-cardSpacingBlock"
|
|
2362
|
-
}, /* @__PURE__ */ import_react19.default.createElement(import_react_ui12.IconButton, {
|
|
2363
|
-
icon: "ph--plus--regular",
|
|
2364
|
-
label: t("button add property"),
|
|
2365
|
-
onClick: readonly ? void 0 : handleAdd,
|
|
2366
|
-
// TODO(burdon): Show field limit in ux (not tooltip).
|
|
2367
|
-
disabled: view.fields.length >= import_schema5.VIEW_FIELD_LIMIT,
|
|
2368
|
-
classNames: "flex is-full"
|
|
2369
|
-
})));
|
|
2370
|
-
} finally {
|
|
2371
|
-
_effect.f();
|
|
2372
|
-
}
|
|
2373
|
-
};
|
|
2374
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2375
|
-
0 && (module.exports = {
|
|
2376
|
-
BooleanInput,
|
|
2377
|
-
ControlFrame,
|
|
2378
|
-
ControlFrameItem,
|
|
2379
|
-
ControlGroup,
|
|
2380
|
-
ControlGroupButton,
|
|
2381
|
-
ControlItem,
|
|
2382
|
-
ControlItemInput,
|
|
2383
|
-
ControlPage,
|
|
2384
|
-
ControlSection,
|
|
2385
|
-
ControlSectionHeading,
|
|
2386
|
-
DeprecatedFormContainer,
|
|
2387
|
-
DeprecatedFormInput,
|
|
2388
|
-
FieldEditor,
|
|
2389
|
-
Form,
|
|
2390
|
-
FormProvider,
|
|
2391
|
-
GeoPointInput,
|
|
2392
|
-
InputHeader,
|
|
2393
|
-
MarkdownInput,
|
|
2394
|
-
NumberInput,
|
|
2395
|
-
SelectInput,
|
|
2396
|
-
SelectOptionInput,
|
|
2397
|
-
TextInput,
|
|
2398
|
-
TupleInput,
|
|
2399
|
-
ViewEditor,
|
|
2400
|
-
cellClassesForFieldType,
|
|
2401
|
-
controlItemClasses,
|
|
2402
|
-
findArrayElementType,
|
|
2403
|
-
formatForDisplay,
|
|
2404
|
-
formatForEditing,
|
|
2405
|
-
getRefProps,
|
|
2406
|
-
parseValue,
|
|
2407
|
-
pathNotUniqueError,
|
|
2408
|
-
translations,
|
|
2409
|
-
useForm,
|
|
2410
|
-
useFormContext,
|
|
2411
|
-
useFormValues,
|
|
2412
|
-
useInputProps,
|
|
2413
|
-
useQueryRefOptions,
|
|
2414
|
-
useRefQueryLookupHandler
|
|
2415
|
-
});
|
|
2416
|
-
//# sourceMappingURL=index.cjs.map
|