@dxos/react-ui-form 0.7.4 → 0.7.5-main.499c70c
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 +209 -184
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +302 -276
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +209 -184
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +2 -2
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +1 -1
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +5 -0
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/Input.d.ts +3 -3
- package/dist/types/src/components/Form/Input.d.ts.map +1 -1
- package/dist/types/src/components/Form/{Custom.d.ts → custom/GeoPointInput.d.ts} +3 -3
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -0
- package/dist/types/src/components/Form/custom/TupleInput.d.ts +7 -0
- package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +1 -0
- package/dist/types/src/components/Form/custom/index.d.ts +3 -0
- package/dist/types/src/components/Form/custom/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/factory.d.ts.map +1 -1
- package/dist/types/src/components/Form/index.d.ts +2 -2
- package/dist/types/src/components/Form/index.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +4 -4
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useForm.d.ts +9 -10
- package/dist/types/src/hooks/useForm.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +23 -23
- package/src/components/FieldEditor/FieldEditor.stories.tsx +2 -2
- package/src/components/FieldEditor/FieldEditor.tsx +21 -13
- package/src/components/Form/Form.stories.tsx +33 -1
- package/src/components/Form/Form.tsx +3 -4
- package/src/components/Form/Input.tsx +3 -3
- package/src/components/Form/{Custom.tsx → custom/GeoPointInput.tsx} +4 -16
- package/src/components/Form/custom/TupleInput.tsx +53 -0
- package/src/components/Form/custom/index.ts +6 -0
- package/src/components/Form/factory.tsx +2 -2
- package/src/components/Form/index.ts +3 -2
- package/src/components/ViewEditor/ViewEditor.stories.tsx +6 -5
- package/src/components/ViewEditor/ViewEditor.tsx +4 -4
- package/src/hooks/useForm.ts +32 -52
- package/dist/types/src/components/Form/Custom.d.ts.map +0 -1
package/dist/lib/node/index.cjs
CHANGED
|
@@ -33,11 +33,12 @@ __export(node_exports, {
|
|
|
33
33
|
FieldEditor: () => FieldEditor,
|
|
34
34
|
Form: () => Form,
|
|
35
35
|
FormActions: () => FormActions,
|
|
36
|
-
|
|
36
|
+
GeoPointInput: () => GeoPointInput,
|
|
37
37
|
InputHeader: () => InputHeader,
|
|
38
38
|
NumberInput: () => NumberInput,
|
|
39
39
|
SelectInput: () => SelectInput,
|
|
40
40
|
TextInput: () => TextInput,
|
|
41
|
+
TupleInput: () => TupleInput,
|
|
41
42
|
ViewEditor: () => ViewEditor,
|
|
42
43
|
cellClassesForFieldType: () => cellClassesForFieldType,
|
|
43
44
|
cellClassesForRowSelection: () => cellClassesForRowSelection,
|
|
@@ -56,37 +57,43 @@ var import_echo_schema = require("@dxos/echo-schema");
|
|
|
56
57
|
var import_log = require("@dxos/log");
|
|
57
58
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
58
59
|
var import_schema = require("@dxos/schema");
|
|
59
|
-
var import_effect = require("effect");
|
|
60
|
-
var import_String = require("effect/String");
|
|
61
60
|
var import_react3 = __toESM(require("react"));
|
|
62
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
63
|
-
var import_effect2 = require("@dxos/effect");
|
|
64
|
-
var import_log2 = require("@dxos/log");
|
|
65
61
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
66
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
67
|
-
var import_schema2 = require("@dxos/schema");
|
|
68
62
|
var import_util = require("@dxos/util");
|
|
69
63
|
var import_react4 = __toESM(require("react"));
|
|
70
64
|
var import_react_ui4 = require("@dxos/react-ui");
|
|
65
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
71
66
|
var import_react5 = __toESM(require("react"));
|
|
72
67
|
var import_react_ui5 = require("@dxos/react-ui");
|
|
73
68
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
74
|
-
var
|
|
69
|
+
var import_util2 = require("@dxos/util");
|
|
75
70
|
var import_react6 = __toESM(require("react"));
|
|
76
71
|
var import_react_ui6 = require("@dxos/react-ui");
|
|
77
|
-
var
|
|
72
|
+
var import_effect = require("effect");
|
|
73
|
+
var import_String = require("effect/String");
|
|
74
|
+
var import_react7 = __toESM(require("react"));
|
|
75
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
76
|
+
var import_effect2 = require("@dxos/effect");
|
|
77
|
+
var import_log2 = require("@dxos/log");
|
|
78
|
+
var import_react_ui7 = require("@dxos/react-ui");
|
|
79
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
80
|
+
var import_schema2 = require("@dxos/schema");
|
|
81
|
+
var import_util3 = require("@dxos/util");
|
|
82
|
+
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
83
|
+
var import_react8 = require("react");
|
|
84
|
+
var import_echo_schema4 = require("@dxos/echo-schema");
|
|
78
85
|
var import_invariant = require("@dxos/invariant");
|
|
79
86
|
var import_log3 = require("@dxos/log");
|
|
80
87
|
var import_schema3 = require("@dxos/schema");
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
88
|
+
var import_react9 = __toESM(require("react"));
|
|
89
|
+
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
90
|
+
var import_react_ui8 = require("@dxos/react-ui");
|
|
84
91
|
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
85
|
-
var
|
|
92
|
+
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
86
93
|
var import_schema4 = require("@dxos/schema");
|
|
87
|
-
var
|
|
88
|
-
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
94
|
+
var import_util4 = require("@dxos/util");
|
|
89
95
|
var import_echo_schema6 = require("@dxos/echo-schema");
|
|
96
|
+
var import_echo_schema7 = require("@dxos/echo-schema");
|
|
90
97
|
var translationKey = "react-ui-form";
|
|
91
98
|
var translations_default = [
|
|
92
99
|
{
|
|
@@ -163,123 +170,143 @@ var DeprecatedFormInput = ({ label, description, secondary, children }) => {
|
|
|
163
170
|
return primary;
|
|
164
171
|
};
|
|
165
172
|
var InputHeader = ({ children, error }) => {
|
|
166
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
167
174
|
role: "none",
|
|
168
175
|
className: "flex justify-between items-center mb-1"
|
|
169
|
-
}, children, error && /* @__PURE__ */
|
|
176
|
+
}, children, error && /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Tooltip.Root, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Tooltip.Trigger, {
|
|
170
177
|
asChild: true
|
|
171
|
-
}, /* @__PURE__ */
|
|
178
|
+
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Icon, {
|
|
172
179
|
icon: "ph--warning--regular",
|
|
173
180
|
size: 4,
|
|
174
|
-
classNames:
|
|
175
|
-
})), /* @__PURE__ */
|
|
181
|
+
classNames: import_react_ui_theme.errorText
|
|
182
|
+
})), /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Tooltip.Content, {
|
|
176
183
|
side: "bottom"
|
|
177
|
-
}, /* @__PURE__ */
|
|
184
|
+
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Tooltip.Arrow, null), error)));
|
|
185
|
+
};
|
|
186
|
+
var GeoPointInput = ({ property, type, label, disabled, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
187
|
+
const { t } = (0, import_react_ui3.useTranslation)(translationKey);
|
|
188
|
+
const { status, error } = getStatus?.(property);
|
|
189
|
+
const [lng = 0, lat = 0] = getValue2(property) ?? [];
|
|
190
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Input.Root, {
|
|
191
|
+
validationValence: status
|
|
192
|
+
}, /* @__PURE__ */ import_react3.default.createElement(InputHeader, {
|
|
193
|
+
error
|
|
194
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Input.Label, null, label)), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
195
|
+
className: "grid grid-cols-2 gap-2"
|
|
196
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Input.TextInput, {
|
|
197
|
+
type: "number",
|
|
198
|
+
disabled,
|
|
199
|
+
placeholder: t("placeholder longitude"),
|
|
200
|
+
value: lng,
|
|
201
|
+
onChange: (event) => onValueChange(property, type, [
|
|
202
|
+
lat,
|
|
203
|
+
(0, import_util.safeParseFloat)(event.target.value, 0)
|
|
204
|
+
]),
|
|
205
|
+
onBlur
|
|
206
|
+
}), /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Input.TextInput, {
|
|
207
|
+
type: "number",
|
|
208
|
+
disabled,
|
|
209
|
+
placeholder: t("placeholder latitude"),
|
|
210
|
+
value: lat,
|
|
211
|
+
onChange: (event) => onValueChange(property, type, [
|
|
212
|
+
(0, import_util.safeParseFloat)(event.target.value, 0),
|
|
213
|
+
lng
|
|
214
|
+
]),
|
|
215
|
+
onBlur
|
|
216
|
+
})));
|
|
178
217
|
};
|
|
179
|
-
var
|
|
218
|
+
var gridCols = [
|
|
219
|
+
"grid-cols-1",
|
|
220
|
+
"grid-cols-2",
|
|
221
|
+
"grid-cols-3",
|
|
222
|
+
"grid-cols-4"
|
|
223
|
+
];
|
|
224
|
+
var TupleInput = ({ binding, property, type, label, disabled, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
180
225
|
const { status, error } = getStatus?.(property);
|
|
181
|
-
|
|
226
|
+
const values = getValue2(property) ?? {};
|
|
227
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Input.Root, {
|
|
182
228
|
validationValence: status
|
|
183
|
-
},
|
|
229
|
+
}, /* @__PURE__ */ import_react5.default.createElement(InputHeader, {
|
|
184
230
|
error
|
|
185
|
-
}, /* @__PURE__ */
|
|
231
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Input.Label, null, label)), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
232
|
+
className: (0, import_react_ui_theme2.mx)("grid gap-2", gridCols[binding.length - 1])
|
|
233
|
+
}, binding.map((prop) => /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Input.TextInput, {
|
|
234
|
+
key: prop,
|
|
235
|
+
type: "number",
|
|
236
|
+
disabled,
|
|
237
|
+
value: values[prop],
|
|
238
|
+
onChange: (event) => onValueChange(property, type, {
|
|
239
|
+
...values,
|
|
240
|
+
[prop]: (0, import_util2.safeParseFloat)(event.target.value, 0)
|
|
241
|
+
}),
|
|
242
|
+
onBlur
|
|
243
|
+
}))));
|
|
244
|
+
};
|
|
245
|
+
var TextInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
246
|
+
const { status, error } = getStatus?.(property);
|
|
247
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
248
|
+
validationValence: status
|
|
249
|
+
}, !inputOnly && /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
250
|
+
error
|
|
251
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, null, label)), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.TextInput, {
|
|
186
252
|
disabled,
|
|
187
253
|
placeholder,
|
|
188
|
-
value:
|
|
254
|
+
value: getValue2(property) ?? "",
|
|
189
255
|
onChange: (event) => onValueChange(property, type, event.target.value),
|
|
190
256
|
onBlur
|
|
191
|
-
}), inputOnly && /* @__PURE__ */
|
|
257
|
+
}), inputOnly && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Validation, null, error));
|
|
192
258
|
};
|
|
193
|
-
var NumberInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue, onValueChange, onBlur }) => {
|
|
259
|
+
var NumberInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
194
260
|
const { status, error } = getStatus?.(property);
|
|
195
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
196
262
|
validationValence: status
|
|
197
|
-
}, !inputOnly && /* @__PURE__ */
|
|
263
|
+
}, !inputOnly && /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
198
264
|
error
|
|
199
|
-
}, /* @__PURE__ */
|
|
265
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, null, label)), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.TextInput, {
|
|
200
266
|
type: "number",
|
|
201
267
|
disabled,
|
|
202
268
|
placeholder,
|
|
203
|
-
value:
|
|
269
|
+
value: getValue2(property) ?? 0,
|
|
204
270
|
onChange: (event) => onValueChange(property, type, event.target.value),
|
|
205
271
|
onBlur
|
|
206
|
-
}), inputOnly && /* @__PURE__ */
|
|
272
|
+
}), inputOnly && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.DescriptionAndValidation, null, error));
|
|
207
273
|
};
|
|
208
|
-
var BooleanInput = ({ property, type, label, inputOnly, getStatus, getValue, onValueChange }) => {
|
|
274
|
+
var BooleanInput = ({ property, type, label, inputOnly, getStatus, getValue: getValue2, onValueChange }) => {
|
|
209
275
|
const { status, error } = getStatus?.(property);
|
|
210
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
211
277
|
validationValence: status
|
|
212
|
-
}, !inputOnly && /* @__PURE__ */
|
|
278
|
+
}, !inputOnly && /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
213
279
|
error
|
|
214
|
-
}, /* @__PURE__ */
|
|
215
|
-
checked:
|
|
280
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, null, label)), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Switch, {
|
|
281
|
+
checked: getValue2(property),
|
|
216
282
|
onCheckedChange: (value) => onValueChange(property, type, value)
|
|
217
|
-
}), inputOnly && /* @__PURE__ */
|
|
283
|
+
}), inputOnly && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.DescriptionAndValidation, null, error));
|
|
218
284
|
};
|
|
219
|
-
var SelectInput = ({ property, type, label, inputOnly, disabled, placeholder, options, getStatus, getValue, onValueChange }) => {
|
|
285
|
+
var SelectInput = ({ property, type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue2, onValueChange }) => {
|
|
220
286
|
const { status, error } = getStatus?.(property);
|
|
221
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
222
288
|
validationValence: status
|
|
223
|
-
}, !inputOnly && /* @__PURE__ */
|
|
289
|
+
}, !inputOnly && /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
224
290
|
error
|
|
225
|
-
}, /* @__PURE__ */
|
|
226
|
-
value:
|
|
291
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, null, label)), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.Root, {
|
|
292
|
+
value: getValue2(property),
|
|
227
293
|
onValueChange: (value) => onValueChange(property, type, value)
|
|
228
|
-
}, /* @__PURE__ */
|
|
294
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.TriggerButton, {
|
|
229
295
|
classNames: "is-full",
|
|
230
296
|
disabled,
|
|
231
297
|
placeholder
|
|
232
|
-
}), /* @__PURE__ */
|
|
298
|
+
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.Portal, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.Content, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.Viewport, null, options?.map(({ value, label: label2 }) => (
|
|
233
299
|
// NOTE: Numeric values are converted to and from strings.
|
|
234
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Select.Option, {
|
|
235
301
|
key: String(value),
|
|
236
302
|
value: String(value)
|
|
237
303
|
}, label2 ?? String(value))
|
|
238
|
-
)))))), inputOnly && /* @__PURE__ */
|
|
239
|
-
};
|
|
240
|
-
var GeiPointInput = ({ property, type, label, disabled, getStatus, getValue, onValueChange, onBlur }) => {
|
|
241
|
-
const { t } = (0, import_react_ui6.useTranslation)(translationKey);
|
|
242
|
-
const { status, error } = getStatus?.(property);
|
|
243
|
-
const [lng = 0, lat = 0] = getValue(property) ?? [];
|
|
244
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Root, {
|
|
245
|
-
validationValence: status
|
|
246
|
-
}, /* @__PURE__ */ import_react6.default.createElement(InputHeader, {
|
|
247
|
-
error
|
|
248
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.Label, null, label)), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
249
|
-
className: "grid grid-cols-2 gap-2"
|
|
250
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.TextInput, {
|
|
251
|
-
type: "number",
|
|
252
|
-
disabled,
|
|
253
|
-
placeholder: t("placeholder longitude"),
|
|
254
|
-
value: lng,
|
|
255
|
-
onChange: (event) => onValueChange(property, type, [
|
|
256
|
-
lat,
|
|
257
|
-
safeParseFloat(event.target.value, 0)
|
|
258
|
-
]),
|
|
259
|
-
onBlur
|
|
260
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.TextInput, {
|
|
261
|
-
type: "number",
|
|
262
|
-
disabled,
|
|
263
|
-
placeholder: t("placeholder latitude"),
|
|
264
|
-
value: lat,
|
|
265
|
-
onChange: (event) => onValueChange(property, type, [
|
|
266
|
-
safeParseFloat(event.target.value, 0),
|
|
267
|
-
lng
|
|
268
|
-
]),
|
|
269
|
-
onBlur
|
|
270
|
-
})));
|
|
271
|
-
};
|
|
272
|
-
var safeParseFloat = (str, defaultValue) => {
|
|
273
|
-
try {
|
|
274
|
-
return parseFloat(str);
|
|
275
|
-
} catch {
|
|
276
|
-
return defaultValue ?? 0;
|
|
277
|
-
}
|
|
304
|
+
)))))), inputOnly && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.Input.DescriptionAndValidation, null, error));
|
|
278
305
|
};
|
|
279
306
|
var getInputComponent = (type, format) => {
|
|
280
307
|
switch (format) {
|
|
281
308
|
case import_echo_schema3.FormatEnum.LatLng:
|
|
282
|
-
return
|
|
309
|
+
return GeoPointInput;
|
|
283
310
|
}
|
|
284
311
|
switch (type) {
|
|
285
312
|
case "string":
|
|
@@ -292,32 +319,34 @@ var getInputComponent = (type, format) => {
|
|
|
292
319
|
};
|
|
293
320
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
|
|
294
321
|
var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
|
|
295
|
-
const [values, setValues] = (0,
|
|
296
|
-
(0,
|
|
322
|
+
const [values, setValues] = (0, import_react8.useState)(initialValues);
|
|
323
|
+
(0, import_react8.useEffect)(() => {
|
|
297
324
|
setValues(initialValues);
|
|
298
325
|
}, [
|
|
299
326
|
initialValues
|
|
300
327
|
]);
|
|
301
|
-
const [touched, setTouched] = (0,
|
|
302
|
-
const [changed, setChanged] = (0,
|
|
303
|
-
const [errors, setErrors] = (0,
|
|
304
|
-
const [saving, setSaving] = (0,
|
|
305
|
-
const validate = (0,
|
|
328
|
+
const [touched, setTouched] = (0, import_react8.useState)(createKeySet(initialValues, false));
|
|
329
|
+
const [changed, setChanged] = (0, import_react8.useState)(createKeySet(initialValues, false));
|
|
330
|
+
const [errors, setErrors] = (0, import_react8.useState)({});
|
|
331
|
+
const [saving, setSaving] = (0, import_react8.useState)(false);
|
|
332
|
+
const validate = (0, import_react8.useCallback)((values2) => {
|
|
306
333
|
let errors2 = (0, import_schema3.validateSchema)(schema, values2) ?? [];
|
|
307
334
|
if (errors2.length === 0 && onValidate) {
|
|
308
|
-
|
|
335
|
+
const validatedValues = values2;
|
|
336
|
+
errors2 = onValidate(validatedValues) ?? [];
|
|
309
337
|
}
|
|
310
338
|
setErrors(flatMap(errors2));
|
|
311
|
-
|
|
339
|
+
const valid = errors2.length === 0;
|
|
340
|
+
return valid;
|
|
312
341
|
}, [
|
|
313
342
|
schema,
|
|
314
343
|
onValidate
|
|
315
344
|
]);
|
|
316
|
-
const [schemaDirty, setSchemaDirty] = (0,
|
|
317
|
-
(0,
|
|
345
|
+
const [schemaDirty, setSchemaDirty] = (0, import_react8.useState)(false);
|
|
346
|
+
(0, import_react8.useEffect)(() => setSchemaDirty(true), [
|
|
318
347
|
schema
|
|
319
348
|
]);
|
|
320
|
-
(0,
|
|
349
|
+
(0, import_react8.useEffect)(() => {
|
|
321
350
|
if (schemaDirty) {
|
|
322
351
|
validate(values);
|
|
323
352
|
setSchemaDirty(false);
|
|
@@ -326,13 +355,13 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
326
355
|
values,
|
|
327
356
|
schemaDirty
|
|
328
357
|
]);
|
|
329
|
-
const canSave = (0,
|
|
358
|
+
const canSave = (0, import_react8.useMemo)(() => !saving && Object.keys(values).every((property) => touched[property] === false || !errors[property]), [
|
|
330
359
|
values,
|
|
331
360
|
touched,
|
|
332
361
|
errors,
|
|
333
362
|
saving
|
|
334
363
|
]);
|
|
335
|
-
const handleSave = (0,
|
|
364
|
+
const handleSave = (0, import_react8.useCallback)(async () => {
|
|
336
365
|
if (validate(values)) {
|
|
337
366
|
setSaving(true);
|
|
338
367
|
try {
|
|
@@ -346,17 +375,18 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
346
375
|
}, [
|
|
347
376
|
values,
|
|
348
377
|
validate,
|
|
349
|
-
onSave
|
|
378
|
+
onSave,
|
|
379
|
+
changed
|
|
350
380
|
]);
|
|
351
|
-
const getStatus = (0,
|
|
381
|
+
const getStatus = (0, import_react8.useCallback)((property) => ({
|
|
352
382
|
status: errors[property] ? "error" : void 0,
|
|
353
383
|
error: errors[property] ? errors[property] : void 0
|
|
354
384
|
}), [
|
|
355
385
|
touched,
|
|
356
386
|
errors
|
|
357
387
|
]);
|
|
358
|
-
const
|
|
359
|
-
return
|
|
388
|
+
const getFormValue = (property) => {
|
|
389
|
+
return (0, import_echo_schema4.getValue)(values, property);
|
|
360
390
|
};
|
|
361
391
|
const onValueChange = (property, type, value) => {
|
|
362
392
|
let parsedValue = value;
|
|
@@ -367,13 +397,15 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
367
397
|
} catch (err) {
|
|
368
398
|
import_log3.log.catch(err, void 0, {
|
|
369
399
|
F: __dxlog_file,
|
|
370
|
-
L:
|
|
400
|
+
L: 178,
|
|
371
401
|
S: void 0,
|
|
372
402
|
C: (f, a) => f(...a)
|
|
373
403
|
});
|
|
374
404
|
parsedValue = void 0;
|
|
375
405
|
}
|
|
376
|
-
const newValues =
|
|
406
|
+
const newValues = {
|
|
407
|
+
...(0, import_echo_schema4.setValue)(values, property, parsedValue)
|
|
408
|
+
};
|
|
377
409
|
setValues(newValues);
|
|
378
410
|
setChanged((prev) => ({
|
|
379
411
|
...prev,
|
|
@@ -387,7 +419,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
387
419
|
});
|
|
388
420
|
}
|
|
389
421
|
};
|
|
390
|
-
const onBlur = (0,
|
|
422
|
+
const onBlur = (0, import_react8.useCallback)((event) => {
|
|
391
423
|
const { name } = event.target;
|
|
392
424
|
setTouched((touched2) => ({
|
|
393
425
|
...touched2,
|
|
@@ -411,7 +443,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
411
443
|
handleSave,
|
|
412
444
|
// Field utils.
|
|
413
445
|
getStatus,
|
|
414
|
-
getValue,
|
|
446
|
+
getValue: getFormValue,
|
|
415
447
|
onValueChange,
|
|
416
448
|
onBlur
|
|
417
449
|
};
|
|
@@ -419,7 +451,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
419
451
|
var createKeySet = (obj, value) => {
|
|
420
452
|
(0, import_invariant.invariant)(obj, void 0, {
|
|
421
453
|
F: __dxlog_file,
|
|
422
|
-
L:
|
|
454
|
+
L: 229,
|
|
423
455
|
S: void 0,
|
|
424
456
|
A: [
|
|
425
457
|
"obj",
|
|
@@ -439,24 +471,10 @@ var flatMap = (errors) => {
|
|
|
439
471
|
return result;
|
|
440
472
|
}, {});
|
|
441
473
|
};
|
|
442
|
-
var getByPath = (obj, path) => {
|
|
443
|
-
const [key, index] = path.split(".");
|
|
444
|
-
return index === void 0 ? obj[key] : obj[key][parseInt(index)];
|
|
445
|
-
};
|
|
446
|
-
var setByPath = (obj, path, value) => {
|
|
447
|
-
const [key, index] = path.split(".");
|
|
448
|
-
const newValue = index === void 0 ? value : [
|
|
449
|
-
...obj[key]
|
|
450
|
-
].map((v, i) => i === parseInt(index) ? value : v);
|
|
451
|
-
return {
|
|
452
|
-
...obj,
|
|
453
|
-
[key]: newValue
|
|
454
|
-
};
|
|
455
|
-
};
|
|
456
474
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/Form.tsx";
|
|
457
475
|
var padding = "px-2";
|
|
458
476
|
var Form = ({ classNames, schema, values: initialValues, path = [], readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, Custom }) => {
|
|
459
|
-
const onValid = (0,
|
|
477
|
+
const onValid = (0, import_react7.useMemo)(() => autoSave ? onSave : void 0, [
|
|
460
478
|
autoSave,
|
|
461
479
|
onSave
|
|
462
480
|
]);
|
|
@@ -468,7 +486,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
468
486
|
onValid,
|
|
469
487
|
onSave
|
|
470
488
|
});
|
|
471
|
-
const properties = (0,
|
|
489
|
+
const properties = (0, import_react7.useMemo)(() => {
|
|
472
490
|
const props = (0, import_schema2.getSchemaProperties)(schema.ast, values);
|
|
473
491
|
const filtered = filter ? filter(props) : props;
|
|
474
492
|
const findIndex = (props2, prop) => {
|
|
@@ -481,13 +499,13 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
481
499
|
filter,
|
|
482
500
|
values
|
|
483
501
|
]);
|
|
484
|
-
(0,
|
|
502
|
+
(0, import_react7.useEffect)(() => {
|
|
485
503
|
if (errors && Object.keys(errors).length) {
|
|
486
504
|
import_log2.log.warn("validation", {
|
|
487
505
|
errors
|
|
488
506
|
}, {
|
|
489
507
|
F: __dxlog_file2,
|
|
490
|
-
L:
|
|
508
|
+
L: 99,
|
|
491
509
|
S: void 0,
|
|
492
510
|
C: (f, a) => f(...a)
|
|
493
511
|
});
|
|
@@ -495,9 +513,9 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
495
513
|
}, [
|
|
496
514
|
errors
|
|
497
515
|
]);
|
|
498
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
499
517
|
role: "form",
|
|
500
|
-
className: (0,
|
|
518
|
+
className: (0, import_react_ui_theme3.mx)("flex flex-col w-full gap-2 py-2", classNames),
|
|
501
519
|
"data-testid": testId
|
|
502
520
|
}, properties.map((property) => {
|
|
503
521
|
const { ast, name, type, format, title, description, examples, options, array } = property;
|
|
@@ -510,11 +528,11 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
510
528
|
let InputComponent = Custom?.[key.join(".")];
|
|
511
529
|
if (!InputComponent) {
|
|
512
530
|
if (options) {
|
|
513
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
514
532
|
key: name,
|
|
515
533
|
role: "none",
|
|
516
534
|
className: padding
|
|
517
|
-
}, /* @__PURE__ */
|
|
535
|
+
}, /* @__PURE__ */ import_react7.default.createElement(SelectInput, {
|
|
518
536
|
type,
|
|
519
537
|
format,
|
|
520
538
|
property: name,
|
|
@@ -530,7 +548,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
530
548
|
}
|
|
531
549
|
InputComponent = getInputComponent(type, format);
|
|
532
550
|
if (array) {
|
|
533
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ import_react7.default.createElement(ArrayField, {
|
|
534
552
|
key: name,
|
|
535
553
|
name,
|
|
536
554
|
type,
|
|
@@ -552,12 +570,12 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
552
570
|
const typeLiteral = baseNode ? (0, import_effect2.getDiscriminatedType)(baseNode, values[name]) : (0, import_effect2.findNode)(ast, import_echo_schema2.AST.isTypeLiteral);
|
|
553
571
|
if (typeLiteral) {
|
|
554
572
|
const schema2 = import_echo_schema2.S.make(typeLiteral);
|
|
555
|
-
return /* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
556
574
|
key: name,
|
|
557
575
|
role: "none"
|
|
558
|
-
}, /* @__PURE__ */
|
|
576
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
559
577
|
className: padding
|
|
560
|
-
}, label), /* @__PURE__ */
|
|
578
|
+
}, label), /* @__PURE__ */ import_react7.default.createElement(Form, {
|
|
561
579
|
schema: schema2,
|
|
562
580
|
path: key,
|
|
563
581
|
values: values[name] ?? {},
|
|
@@ -573,17 +591,17 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
573
591
|
type
|
|
574
592
|
}, {
|
|
575
593
|
F: __dxlog_file2,
|
|
576
|
-
L:
|
|
594
|
+
L: 184,
|
|
577
595
|
S: void 0,
|
|
578
596
|
C: (f, a) => f(...a)
|
|
579
597
|
});
|
|
580
598
|
return null;
|
|
581
599
|
}
|
|
582
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
583
601
|
key: name,
|
|
584
602
|
role: "none",
|
|
585
603
|
className: padding
|
|
586
|
-
}, /* @__PURE__ */
|
|
604
|
+
}, /* @__PURE__ */ import_react7.default.createElement(InputComponent, {
|
|
587
605
|
type,
|
|
588
606
|
format,
|
|
589
607
|
property: name,
|
|
@@ -592,7 +610,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
592
610
|
placeholder,
|
|
593
611
|
...inputProps
|
|
594
612
|
}));
|
|
595
|
-
}).filter(
|
|
613
|
+
}).filter(import_util3.isNotFalsy), (onCancel || onSave) && !autoSave && /* @__PURE__ */ import_react7.default.createElement(FormActions, {
|
|
596
614
|
onCancel,
|
|
597
615
|
onSubmit: handleSave,
|
|
598
616
|
canSubmit: canSave,
|
|
@@ -600,7 +618,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
600
618
|
}));
|
|
601
619
|
};
|
|
602
620
|
var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholder, inputProps, Custom }) => {
|
|
603
|
-
const { t } = (0,
|
|
621
|
+
const { t } = (0, import_react_ui7.useTranslation)(translationKey);
|
|
604
622
|
const arrayValues = values[name] ?? [];
|
|
605
623
|
const key = [
|
|
606
624
|
name
|
|
@@ -612,26 +630,26 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
612
630
|
const typeLiteral = baseNode ? (0, import_effect2.getDiscriminatedType)(baseNode, values[name]) : (0, import_effect2.findNode)(elementType, import_echo_schema2.AST.isTypeLiteral);
|
|
613
631
|
if (typeLiteral) {
|
|
614
632
|
const schema = import_echo_schema2.S.make(typeLiteral);
|
|
615
|
-
return /* @__PURE__ */
|
|
633
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
616
634
|
key: name,
|
|
617
635
|
role: "none",
|
|
618
|
-
className: (0,
|
|
619
|
-
}, /* @__PURE__ */
|
|
636
|
+
className: (0, import_react_ui_theme3.mx)(padding)
|
|
637
|
+
}, /* @__PURE__ */ import_react7.default.createElement(InputHeader, null, label), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
620
638
|
role: "none",
|
|
621
639
|
className: "flex flex-col gap-1"
|
|
622
640
|
}, arrayValues.map((value, index) => {
|
|
623
|
-
return /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
624
642
|
key: index,
|
|
625
643
|
role: "none",
|
|
626
644
|
className: "flex items-center gap-1"
|
|
627
|
-
}, /* @__PURE__ */
|
|
645
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
628
646
|
role: "none",
|
|
629
647
|
className: "flex-1"
|
|
630
|
-
}, /* @__PURE__ */
|
|
648
|
+
}, /* @__PURE__ */ import_react7.default.createElement(Form, {
|
|
631
649
|
schema,
|
|
632
650
|
path: [
|
|
633
651
|
...key,
|
|
634
|
-
index
|
|
652
|
+
`[${index}]`
|
|
635
653
|
],
|
|
636
654
|
values: value,
|
|
637
655
|
onValuesChanged: (childValues) => {
|
|
@@ -642,7 +660,7 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
642
660
|
inputProps.onValueChange(name, "object", newValues);
|
|
643
661
|
},
|
|
644
662
|
Custom
|
|
645
|
-
})), /* @__PURE__ */
|
|
663
|
+
})), /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
646
664
|
icon: "ph--trash--regular",
|
|
647
665
|
iconOnly: true,
|
|
648
666
|
label: t("button remove"),
|
|
@@ -651,10 +669,10 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
651
669
|
inputProps.onValueChange(name, type, newValues);
|
|
652
670
|
}
|
|
653
671
|
}));
|
|
654
|
-
})), /* @__PURE__ */
|
|
672
|
+
})), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
655
673
|
role: "none",
|
|
656
674
|
className: "flex justify-between items-center plb-1"
|
|
657
|
-
}, /* @__PURE__ */
|
|
675
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
658
676
|
icon: "ph--plus--regular",
|
|
659
677
|
iconOnly: true,
|
|
660
678
|
label: t("button add"),
|
|
@@ -667,7 +685,7 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
667
685
|
}
|
|
668
686
|
})));
|
|
669
687
|
}
|
|
670
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
671
689
|
key: name,
|
|
672
690
|
role: "none"
|
|
673
691
|
}, "Nested form not supported in arrays, yet.");
|
|
@@ -676,30 +694,30 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
676
694
|
if (!InputComponent) {
|
|
677
695
|
return null;
|
|
678
696
|
}
|
|
679
|
-
return /* @__PURE__ */
|
|
697
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
680
698
|
role: "none",
|
|
681
699
|
key: "meta-input",
|
|
682
|
-
className: (0,
|
|
683
|
-
}, /* @__PURE__ */
|
|
700
|
+
className: (0, import_react_ui_theme3.mx)(padding)
|
|
701
|
+
}, /* @__PURE__ */ import_react7.default.createElement(InputHeader, null, label), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
684
702
|
role: "none",
|
|
685
703
|
className: "flex flex-col gap-1"
|
|
686
|
-
}, arrayValues.map((_, index) => /* @__PURE__ */
|
|
704
|
+
}, arrayValues.map((_, index) => /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
687
705
|
key: index,
|
|
688
706
|
role: "none",
|
|
689
707
|
className: "flex items-start gap-1"
|
|
690
|
-
}, /* @__PURE__ */
|
|
708
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
691
709
|
role: "none",
|
|
692
710
|
className: "flex-1"
|
|
693
|
-
}, /* @__PURE__ */
|
|
711
|
+
}, /* @__PURE__ */ import_react7.default.createElement(InputComponent, {
|
|
694
712
|
type,
|
|
695
713
|
format,
|
|
696
714
|
label,
|
|
697
715
|
inputOnly: true,
|
|
698
|
-
property: `${name}
|
|
716
|
+
property: `${name}[${index}]`,
|
|
699
717
|
disabled: readonly,
|
|
700
718
|
placeholder,
|
|
701
719
|
...inputProps
|
|
702
|
-
})), /* @__PURE__ */
|
|
720
|
+
})), /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
703
721
|
icon: "ph--trash--regular",
|
|
704
722
|
iconOnly: true,
|
|
705
723
|
label: t("button remove"),
|
|
@@ -707,10 +725,10 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
707
725
|
const newValues = arrayValues.filter((_2, i) => i !== index);
|
|
708
726
|
inputProps.onValueChange(name, type, newValues);
|
|
709
727
|
}
|
|
710
|
-
})))), /* @__PURE__ */
|
|
728
|
+
})))), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
711
729
|
role: "none",
|
|
712
730
|
className: "flex justify-between items-center plb-1"
|
|
713
|
-
}, /* @__PURE__ */
|
|
731
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
714
732
|
icon: "ph--plus--regular",
|
|
715
733
|
iconOnly: true,
|
|
716
734
|
label: t("button add"),
|
|
@@ -724,19 +742,19 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
724
742
|
})));
|
|
725
743
|
};
|
|
726
744
|
var FormActions = ({ onCancel, onSubmit, canSubmit, readonly }) => {
|
|
727
|
-
const { t } = (0,
|
|
728
|
-
return /* @__PURE__ */
|
|
745
|
+
const { t } = (0, import_react_ui7.useTranslation)(translationKey);
|
|
746
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
729
747
|
role: "none",
|
|
730
748
|
className: "flex justify-center"
|
|
731
|
-
}, /* @__PURE__ */
|
|
749
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
732
750
|
role: "none",
|
|
733
|
-
className: (0,
|
|
734
|
-
}, onCancel && !readonly && /* @__PURE__ */
|
|
751
|
+
className: (0, import_react_ui_theme3.mx)(onCancel && !readonly && "grid grid-cols-2 gap-2")
|
|
752
|
+
}, onCancel && !readonly && /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
735
753
|
"data-testid": "cancel-button",
|
|
736
754
|
icon: "ph--x--regular",
|
|
737
755
|
label: t("button cancel"),
|
|
738
756
|
onClick: onCancel
|
|
739
|
-
}), onSubmit && /* @__PURE__ */
|
|
757
|
+
}), onSubmit && /* @__PURE__ */ import_react7.default.createElement(import_react_ui7.IconButton, {
|
|
740
758
|
type: "submit",
|
|
741
759
|
"data-testid": "save-button",
|
|
742
760
|
disabled: !canSubmit,
|
|
@@ -758,9 +776,11 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
758
776
|
if (!registry) {
|
|
759
777
|
return;
|
|
760
778
|
}
|
|
761
|
-
const subscription = registry.subscribe(setSchemas)
|
|
779
|
+
const subscription = registry.query().subscribe((query) => setSchemas(query.results), {
|
|
780
|
+
fire: true
|
|
781
|
+
});
|
|
762
782
|
const t2 = setTimeout(async () => {
|
|
763
|
-
const schemas2 = await registry.query();
|
|
783
|
+
const schemas2 = await registry.query().run();
|
|
764
784
|
setSchemas(schemas2);
|
|
765
785
|
});
|
|
766
786
|
return () => {
|
|
@@ -781,11 +801,15 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
781
801
|
fieldSchema: (0, import_schema.getFormatSchema)(props?.format)
|
|
782
802
|
});
|
|
783
803
|
const handleValuesChanged = (0, import_react2.useCallback)((_props) => {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
804
|
+
setFieldSchema((prev) => {
|
|
805
|
+
const fieldSchema2 = (0, import_schema.getFormatSchema)(_props.format);
|
|
806
|
+
if (prev.fieldSchema === fieldSchema2) {
|
|
807
|
+
return prev;
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
fieldSchema: fieldSchema2
|
|
811
|
+
};
|
|
812
|
+
});
|
|
789
813
|
if (_props.referenceSchema !== props.referenceSchema) {
|
|
790
814
|
setSchema(schemas.find((schema2) => schema2.typename === _props.referenceSchema));
|
|
791
815
|
}
|
|
@@ -802,7 +826,8 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
802
826
|
});
|
|
803
827
|
}, [
|
|
804
828
|
schemas,
|
|
805
|
-
props
|
|
829
|
+
props.format,
|
|
830
|
+
props.referenceSchema
|
|
806
831
|
]);
|
|
807
832
|
const handleValidate = (0, import_react2.useCallback)(({ property }) => {
|
|
808
833
|
if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
|
|
@@ -839,7 +864,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
839
864
|
props
|
|
840
865
|
}, {
|
|
841
866
|
F: __dxlog_file3,
|
|
842
|
-
L:
|
|
867
|
+
L: 126,
|
|
843
868
|
S: void 0,
|
|
844
869
|
C: (f, a) => f(...a)
|
|
845
870
|
});
|
|
@@ -875,7 +900,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
875
900
|
}),
|
|
876
901
|
["referencePath"]: (props2) => /* @__PURE__ */ import_react2.default.createElement(SelectInput, {
|
|
877
902
|
...props2,
|
|
878
|
-
options: schema ? (0, import_schema.getSchemaProperties)(schema.
|
|
903
|
+
options: schema ? (0, import_schema.getSchemaProperties)(schema.ast).sort(import_schema.sortProperties).map((p) => ({
|
|
879
904
|
value: p.name
|
|
880
905
|
})) : []
|
|
881
906
|
})
|
|
@@ -883,22 +908,22 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
883
908
|
});
|
|
884
909
|
};
|
|
885
910
|
var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
|
|
886
|
-
var ViewMetaSchema =
|
|
887
|
-
name:
|
|
888
|
-
[
|
|
911
|
+
var ViewMetaSchema = import_echo_schema5.S.Struct({
|
|
912
|
+
name: import_echo_schema5.S.String.annotations({
|
|
913
|
+
[import_echo_schema5.AST.TitleAnnotationId]: "View"
|
|
889
914
|
}),
|
|
890
|
-
typename:
|
|
891
|
-
[
|
|
915
|
+
typename: import_echo_schema5.Format.DXN.annotations({
|
|
916
|
+
[import_echo_schema5.AST.TitleAnnotationId]: "Typename"
|
|
892
917
|
})
|
|
893
|
-
}).pipe(
|
|
918
|
+
}).pipe(import_echo_schema5.S.mutable);
|
|
894
919
|
var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading = false, onDelete }) => {
|
|
895
|
-
const { t } = (0,
|
|
896
|
-
const projection = (0,
|
|
920
|
+
const { t } = (0, import_react_ui8.useTranslation)(translationKey);
|
|
921
|
+
const projection = (0, import_react9.useMemo)(() => new import_schema4.ViewProjection(schema, view), [
|
|
897
922
|
schema,
|
|
898
923
|
view
|
|
899
924
|
]);
|
|
900
|
-
const [field, setField] = (0,
|
|
901
|
-
const viewValues = (0,
|
|
925
|
+
const [field, setField] = (0, import_react9.useState)();
|
|
926
|
+
const viewValues = (0, import_react9.useMemo)(() => {
|
|
902
927
|
return {
|
|
903
928
|
name: view.name,
|
|
904
929
|
// TODO(burdon): Need to warn user of possible consequences of editing.
|
|
@@ -908,7 +933,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
908
933
|
}, [
|
|
909
934
|
view
|
|
910
935
|
]);
|
|
911
|
-
const handleViewUpdate = (0,
|
|
936
|
+
const handleViewUpdate = (0, import_react9.useCallback)(({ name, typename }) => {
|
|
912
937
|
requestAnimationFrame(() => {
|
|
913
938
|
view.name = name;
|
|
914
939
|
view.query.type = typename;
|
|
@@ -918,67 +943,67 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
918
943
|
view,
|
|
919
944
|
schema
|
|
920
945
|
]);
|
|
921
|
-
const handleSelect = (0,
|
|
946
|
+
const handleSelect = (0, import_react9.useCallback)((field2) => {
|
|
922
947
|
setField((f) => f === field2 ? void 0 : field2);
|
|
923
948
|
}, []);
|
|
924
|
-
const handleAdd = (0,
|
|
949
|
+
const handleAdd = (0, import_react9.useCallback)(() => {
|
|
925
950
|
const field2 = projection.createFieldProjection();
|
|
926
951
|
setField(field2);
|
|
927
952
|
}, [
|
|
928
953
|
view
|
|
929
954
|
]);
|
|
930
|
-
const handleMove = (0,
|
|
931
|
-
(0,
|
|
955
|
+
const handleMove = (0, import_react9.useCallback)((fromIndex, toIndex) => {
|
|
956
|
+
(0, import_util4.arrayMove)(view.fields, fromIndex, toIndex);
|
|
932
957
|
}, [
|
|
933
958
|
view.fields
|
|
934
959
|
]);
|
|
935
|
-
const handleClose = (0,
|
|
936
|
-
return /* @__PURE__ */
|
|
960
|
+
const handleClose = (0, import_react9.useCallback)(() => setField(void 0), []);
|
|
961
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
937
962
|
role: "none",
|
|
938
|
-
className: (0,
|
|
939
|
-
}, /* @__PURE__ */
|
|
963
|
+
className: (0, import_react_ui_theme4.mx)("flex flex-col w-full divide-y divide-separator", classNames)
|
|
964
|
+
}, /* @__PURE__ */ import_react9.default.createElement(Form, {
|
|
940
965
|
autoFocus: true,
|
|
941
966
|
autoSave: true,
|
|
942
967
|
schema: ViewMetaSchema,
|
|
943
968
|
values: viewValues,
|
|
944
969
|
onSave: handleViewUpdate
|
|
945
|
-
}), /* @__PURE__ */
|
|
970
|
+
}), /* @__PURE__ */ import_react9.default.createElement("div", null, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
946
971
|
role: "none",
|
|
947
972
|
className: "p-2"
|
|
948
|
-
}, /* @__PURE__ */
|
|
949
|
-
className: (0,
|
|
950
|
-
}, t("fields label"))), /* @__PURE__ */
|
|
973
|
+
}, /* @__PURE__ */ import_react9.default.createElement("label", {
|
|
974
|
+
className: (0, import_react_ui_theme4.mx)(import_react_ui_theme4.inputTextLabel)
|
|
975
|
+
}, t("fields label"))), /* @__PURE__ */ import_react9.default.createElement(import_react_ui_list.List.Root, {
|
|
951
976
|
items: view.fields,
|
|
952
|
-
isItem:
|
|
977
|
+
isItem: import_echo_schema5.S.is(import_schema4.FieldSchema),
|
|
953
978
|
getId: (field2) => field2.id,
|
|
954
979
|
onMove: handleMove
|
|
955
|
-
}, ({ items: fields }) => /* @__PURE__ */
|
|
980
|
+
}, ({ items: fields }) => /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, showHeading && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
956
981
|
role: "heading",
|
|
957
982
|
className: grid
|
|
958
|
-
}, /* @__PURE__ */
|
|
983
|
+
}, /* @__PURE__ */ import_react9.default.createElement("div", null), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
959
984
|
className: "flex items-center text-sm"
|
|
960
|
-
}, t("field path label"))), /* @__PURE__ */
|
|
985
|
+
}, t("field path label"))), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
961
986
|
role: "list",
|
|
962
987
|
className: "flex flex-col w-full"
|
|
963
|
-
}, fields?.map((field2) => /* @__PURE__ */
|
|
988
|
+
}, fields?.map((field2) => /* @__PURE__ */ import_react9.default.createElement(import_react_ui_list.List.Item, {
|
|
964
989
|
key: field2.id,
|
|
965
990
|
item: field2,
|
|
966
|
-
classNames: (0,
|
|
967
|
-
}, /* @__PURE__ */
|
|
991
|
+
classNames: (0, import_react_ui_theme4.mx)(grid, import_react_ui_theme4.ghostHover, "cursor-pointer")
|
|
992
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui_list.List.ItemDragHandle, null), /* @__PURE__ */ import_react9.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
968
993
|
onClick: () => handleSelect(field2)
|
|
969
|
-
}, field2.path), /* @__PURE__ */
|
|
994
|
+
}, field2.path), /* @__PURE__ */ import_react9.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
970
995
|
disabled: view.fields.length <= 1,
|
|
971
996
|
onClick: () => onDelete(field2.id)
|
|
972
|
-
}))))))), field && /* @__PURE__ */
|
|
997
|
+
}))))))), field && /* @__PURE__ */ import_react9.default.createElement(FieldEditor, {
|
|
973
998
|
key: field.id,
|
|
974
999
|
view,
|
|
975
1000
|
projection,
|
|
976
1001
|
field,
|
|
977
1002
|
registry,
|
|
978
1003
|
onSave: handleClose
|
|
979
|
-
}), !readonly && !field && /* @__PURE__ */
|
|
1004
|
+
}), !readonly && !field && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
980
1005
|
className: "flex p-2 justify-center"
|
|
981
|
-
}, /* @__PURE__ */
|
|
1006
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui8.IconButton, {
|
|
982
1007
|
icon: "ph--plus--regular",
|
|
983
1008
|
label: t("button add property"),
|
|
984
1009
|
onClick: handleAdd,
|
|
@@ -992,7 +1017,7 @@ var parseValue = ({ type, format, value }) => {
|
|
|
992
1017
|
}
|
|
993
1018
|
const parseScalar = (type2) => {
|
|
994
1019
|
switch (type2) {
|
|
995
|
-
case
|
|
1020
|
+
case import_echo_schema6.TypeEnum.Boolean: {
|
|
996
1021
|
if (typeof value === "string") {
|
|
997
1022
|
const lowercaseValue = value.toLowerCase();
|
|
998
1023
|
if (lowercaseValue === "0" || lowercaseValue === "false") {
|
|
@@ -1003,13 +1028,13 @@ var parseValue = ({ type, format, value }) => {
|
|
|
1003
1028
|
}
|
|
1004
1029
|
return Boolean(value);
|
|
1005
1030
|
}
|
|
1006
|
-
case
|
|
1031
|
+
case import_echo_schema6.TypeEnum.Number: {
|
|
1007
1032
|
const cleaned = typeof value === "string" ? value.replace(/[^0-9.-]+/g, "") : value;
|
|
1008
1033
|
const num = Number(cleaned);
|
|
1009
1034
|
return Number.isNaN(num) ? null : num;
|
|
1010
1035
|
}
|
|
1011
|
-
case
|
|
1012
|
-
case
|
|
1036
|
+
case import_echo_schema6.TypeEnum.String:
|
|
1037
|
+
case import_echo_schema6.TypeEnum.Ref:
|
|
1013
1038
|
return String(value);
|
|
1014
1039
|
default: {
|
|
1015
1040
|
return value;
|
|
@@ -1020,22 +1045,22 @@ var parseValue = ({ type, format, value }) => {
|
|
|
1020
1045
|
return parseScalar(type);
|
|
1021
1046
|
}
|
|
1022
1047
|
switch (format) {
|
|
1023
|
-
case
|
|
1024
|
-
return parseScalar(
|
|
1025
|
-
case
|
|
1026
|
-
case
|
|
1027
|
-
case
|
|
1028
|
-
return parseScalar(
|
|
1029
|
-
case
|
|
1030
|
-
case
|
|
1031
|
-
return parseScalar(
|
|
1048
|
+
case import_echo_schema6.FormatEnum.Boolean:
|
|
1049
|
+
return parseScalar(import_echo_schema6.TypeEnum.Boolean);
|
|
1050
|
+
case import_echo_schema6.FormatEnum.Number:
|
|
1051
|
+
case import_echo_schema6.FormatEnum.Percent:
|
|
1052
|
+
case import_echo_schema6.FormatEnum.Currency:
|
|
1053
|
+
return parseScalar(import_echo_schema6.TypeEnum.Number);
|
|
1054
|
+
case import_echo_schema6.FormatEnum.String:
|
|
1055
|
+
case import_echo_schema6.FormatEnum.Markdown: {
|
|
1056
|
+
return parseScalar(import_echo_schema6.TypeEnum.String);
|
|
1032
1057
|
}
|
|
1033
|
-
case
|
|
1034
|
-
throw new Error(`unexpected format: ${
|
|
1035
|
-
case
|
|
1036
|
-
case
|
|
1037
|
-
case
|
|
1038
|
-
case
|
|
1058
|
+
case import_echo_schema6.FormatEnum.Ref:
|
|
1059
|
+
throw new Error(`unexpected format: ${import_echo_schema6.FormatEnum.Ref}`);
|
|
1060
|
+
case import_echo_schema6.FormatEnum.DateTime:
|
|
1061
|
+
case import_echo_schema6.FormatEnum.Date:
|
|
1062
|
+
case import_echo_schema6.FormatEnum.Time:
|
|
1063
|
+
case import_echo_schema6.FormatEnum.Timestamp: {
|
|
1039
1064
|
const date = new Date(value);
|
|
1040
1065
|
return isNaN(date.getTime()) ? null : date;
|
|
1041
1066
|
}
|
|
@@ -1047,19 +1072,19 @@ var parseValue = ({ type, format, value }) => {
|
|
|
1047
1072
|
var cellClassesForFieldType = ({ type, format }) => {
|
|
1048
1073
|
if (!format) {
|
|
1049
1074
|
switch (type) {
|
|
1050
|
-
case
|
|
1075
|
+
case import_echo_schema6.TypeEnum.Number:
|
|
1051
1076
|
return [
|
|
1052
1077
|
"text-right",
|
|
1053
1078
|
"font-mono"
|
|
1054
1079
|
];
|
|
1055
|
-
case
|
|
1080
|
+
case import_echo_schema6.TypeEnum.Boolean:
|
|
1056
1081
|
return [
|
|
1057
1082
|
"text-right",
|
|
1058
1083
|
"font-mono"
|
|
1059
1084
|
];
|
|
1060
|
-
case
|
|
1085
|
+
case import_echo_schema6.TypeEnum.String:
|
|
1061
1086
|
return void 0;
|
|
1062
|
-
case
|
|
1087
|
+
case import_echo_schema6.TypeEnum.Ref:
|
|
1063
1088
|
return void 0;
|
|
1064
1089
|
default: {
|
|
1065
1090
|
return void 0;
|
|
@@ -1067,20 +1092,20 @@ var cellClassesForFieldType = ({ type, format }) => {
|
|
|
1067
1092
|
}
|
|
1068
1093
|
}
|
|
1069
1094
|
switch (format) {
|
|
1070
|
-
case
|
|
1095
|
+
case import_echo_schema6.FormatEnum.Markdown:
|
|
1071
1096
|
return void 0;
|
|
1072
|
-
case
|
|
1073
|
-
case
|
|
1074
|
-
case
|
|
1075
|
-
case
|
|
1097
|
+
case import_echo_schema6.FormatEnum.Timestamp:
|
|
1098
|
+
case import_echo_schema6.FormatEnum.DateTime:
|
|
1099
|
+
case import_echo_schema6.FormatEnum.Date:
|
|
1100
|
+
case import_echo_schema6.FormatEnum.Time:
|
|
1076
1101
|
return [
|
|
1077
1102
|
"font-mono"
|
|
1078
1103
|
];
|
|
1079
|
-
case
|
|
1104
|
+
case import_echo_schema6.FormatEnum.Currency:
|
|
1080
1105
|
return [
|
|
1081
1106
|
"text-right"
|
|
1082
1107
|
];
|
|
1083
|
-
case
|
|
1108
|
+
case import_echo_schema6.FormatEnum.JSON:
|
|
1084
1109
|
return [
|
|
1085
1110
|
"font-mono"
|
|
1086
1111
|
];
|
|
@@ -1098,12 +1123,12 @@ var pathNotUniqueError = (path) => ({
|
|
|
1098
1123
|
var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
1099
1124
|
const formatScalar = (type2) => {
|
|
1100
1125
|
switch (type2) {
|
|
1101
|
-
case
|
|
1126
|
+
case import_echo_schema7.TypeEnum.Boolean:
|
|
1102
1127
|
return value.toLocaleString().toUpperCase();
|
|
1103
|
-
case
|
|
1128
|
+
case import_echo_schema7.TypeEnum.Number:
|
|
1104
1129
|
return value.toLocaleString(locale);
|
|
1105
|
-
case
|
|
1106
|
-
case
|
|
1130
|
+
case import_echo_schema7.TypeEnum.String:
|
|
1131
|
+
case import_echo_schema7.TypeEnum.Ref:
|
|
1107
1132
|
return String(value);
|
|
1108
1133
|
default: {
|
|
1109
1134
|
return String(value);
|
|
@@ -1114,20 +1139,20 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
|
1114
1139
|
return formatScalar(type);
|
|
1115
1140
|
}
|
|
1116
1141
|
switch (format) {
|
|
1117
|
-
case
|
|
1118
|
-
return formatScalar(
|
|
1142
|
+
case import_echo_schema7.FormatEnum.Boolean: {
|
|
1143
|
+
return formatScalar(import_echo_schema7.TypeEnum.Boolean);
|
|
1119
1144
|
}
|
|
1120
|
-
case
|
|
1121
|
-
return formatScalar(
|
|
1145
|
+
case import_echo_schema7.FormatEnum.Number: {
|
|
1146
|
+
return formatScalar(import_echo_schema7.TypeEnum.Number);
|
|
1122
1147
|
}
|
|
1123
|
-
case
|
|
1124
|
-
case
|
|
1125
|
-
return formatScalar(
|
|
1148
|
+
case import_echo_schema7.FormatEnum.String:
|
|
1149
|
+
case import_echo_schema7.FormatEnum.Ref: {
|
|
1150
|
+
return formatScalar(import_echo_schema7.TypeEnum.String);
|
|
1126
1151
|
}
|
|
1127
|
-
case
|
|
1152
|
+
case import_echo_schema7.FormatEnum.Percent: {
|
|
1128
1153
|
return `${value * 100}%`;
|
|
1129
1154
|
}
|
|
1130
|
-
case
|
|
1155
|
+
case import_echo_schema7.FormatEnum.Currency: {
|
|
1131
1156
|
return value.toLocaleString(locale, {
|
|
1132
1157
|
style: "currency",
|
|
1133
1158
|
currency: "USD",
|
|
@@ -1135,13 +1160,13 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
|
1135
1160
|
maximumFractionDigits: 2
|
|
1136
1161
|
});
|
|
1137
1162
|
}
|
|
1138
|
-
case
|
|
1139
|
-
case
|
|
1140
|
-
case
|
|
1163
|
+
case import_echo_schema7.FormatEnum.DateTime:
|
|
1164
|
+
case import_echo_schema7.FormatEnum.Date:
|
|
1165
|
+
case import_echo_schema7.FormatEnum.Time: {
|
|
1141
1166
|
const date = new Date(value);
|
|
1142
|
-
if (format ===
|
|
1167
|
+
if (format === import_echo_schema7.FormatEnum.DateTime) {
|
|
1143
1168
|
return date.toLocaleString(locale);
|
|
1144
|
-
} else if (format ===
|
|
1169
|
+
} else if (format === import_echo_schema7.FormatEnum.Date) {
|
|
1145
1170
|
return date.toLocaleDateString(locale);
|
|
1146
1171
|
} else {
|
|
1147
1172
|
return date.toLocaleTimeString(locale);
|
|
@@ -1158,10 +1183,10 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
|
|
|
1158
1183
|
var formatForEditing = ({ type, format, value, locale = void 0 }) => {
|
|
1159
1184
|
const formatScalar = (type2) => {
|
|
1160
1185
|
switch (type2) {
|
|
1161
|
-
case
|
|
1162
|
-
case
|
|
1163
|
-
case
|
|
1164
|
-
case
|
|
1186
|
+
case import_echo_schema7.TypeEnum.Boolean:
|
|
1187
|
+
case import_echo_schema7.TypeEnum.Number:
|
|
1188
|
+
case import_echo_schema7.TypeEnum.String:
|
|
1189
|
+
case import_echo_schema7.TypeEnum.Ref:
|
|
1165
1190
|
return String(value);
|
|
1166
1191
|
default:
|
|
1167
1192
|
return String(value);
|
|
@@ -1171,27 +1196,27 @@ var formatForEditing = ({ type, format, value, locale = void 0 }) => {
|
|
|
1171
1196
|
return formatScalar(type);
|
|
1172
1197
|
}
|
|
1173
1198
|
switch (format) {
|
|
1174
|
-
case
|
|
1175
|
-
case
|
|
1176
|
-
case
|
|
1177
|
-
case
|
|
1199
|
+
case import_echo_schema7.FormatEnum.Boolean:
|
|
1200
|
+
case import_echo_schema7.FormatEnum.Number:
|
|
1201
|
+
case import_echo_schema7.FormatEnum.String:
|
|
1202
|
+
case import_echo_schema7.FormatEnum.Ref: {
|
|
1178
1203
|
return formatScalar(type);
|
|
1179
1204
|
}
|
|
1180
|
-
case
|
|
1205
|
+
case import_echo_schema7.FormatEnum.Percent: {
|
|
1181
1206
|
return String(value * 100);
|
|
1182
1207
|
}
|
|
1183
|
-
case
|
|
1208
|
+
case import_echo_schema7.FormatEnum.Currency: {
|
|
1184
1209
|
return String(value);
|
|
1185
1210
|
}
|
|
1186
|
-
case
|
|
1211
|
+
case import_echo_schema7.FormatEnum.DateTime: {
|
|
1187
1212
|
const date = new Date(value);
|
|
1188
1213
|
return date.toISOString();
|
|
1189
1214
|
}
|
|
1190
|
-
case
|
|
1215
|
+
case import_echo_schema7.FormatEnum.Date: {
|
|
1191
1216
|
const date = new Date(value);
|
|
1192
1217
|
return date.toISOString().split("T")[0];
|
|
1193
1218
|
}
|
|
1194
|
-
case
|
|
1219
|
+
case import_echo_schema7.FormatEnum.Time: {
|
|
1195
1220
|
const date = new Date(value);
|
|
1196
1221
|
return date.toISOString().split("T")[1].split(".")[0];
|
|
1197
1222
|
}
|
|
@@ -1207,11 +1232,12 @@ var formatForEditing = ({ type, format, value, locale = void 0 }) => {
|
|
|
1207
1232
|
FieldEditor,
|
|
1208
1233
|
Form,
|
|
1209
1234
|
FormActions,
|
|
1210
|
-
|
|
1235
|
+
GeoPointInput,
|
|
1211
1236
|
InputHeader,
|
|
1212
1237
|
NumberInput,
|
|
1213
1238
|
SelectInput,
|
|
1214
1239
|
TextInput,
|
|
1240
|
+
TupleInput,
|
|
1215
1241
|
ViewEditor,
|
|
1216
1242
|
cellClassesForFieldType,
|
|
1217
1243
|
cellClassesForRowSelection,
|