@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
|
@@ -80,27 +80,16 @@ var DeprecatedFormInput = ({ label, description, secondary, children }) => {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
// packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
|
|
83
|
-
import
|
|
83
|
+
import React7, { useCallback as useCallback2, useEffect as useEffect3, useState as useState2 } from "react";
|
|
84
84
|
import { FormatEnum as FormatEnum2, FormatEnums, formatToType } from "@dxos/echo-schema";
|
|
85
85
|
import { log as log3 } from "@dxos/log";
|
|
86
86
|
import { useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
87
87
|
import { getFormatSchema, getSchemaProperties as getSchemaProperties2, sortProperties } from "@dxos/schema";
|
|
88
88
|
|
|
89
|
-
// packages/ui/react-ui-form/src/components/Form/
|
|
90
|
-
import { pipe } from "effect";
|
|
91
|
-
import { capitalize } from "effect/String";
|
|
92
|
-
import React5, { useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
93
|
-
import { AST, S } from "@dxos/echo-schema";
|
|
94
|
-
import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
|
|
95
|
-
import { log as log2 } from "@dxos/log";
|
|
96
|
-
import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
97
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
98
|
-
import { getSchemaProperties } from "@dxos/schema";
|
|
99
|
-
import { isNotFalsy } from "@dxos/util";
|
|
100
|
-
|
|
101
|
-
// packages/ui/react-ui-form/src/components/Form/Defaults.tsx
|
|
89
|
+
// packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
|
|
102
90
|
import React3 from "react";
|
|
103
|
-
import { Input as Input2,
|
|
91
|
+
import { Input as Input2, useTranslation } from "@dxos/react-ui";
|
|
92
|
+
import { safeParseFloat } from "@dxos/util";
|
|
104
93
|
|
|
105
94
|
// packages/ui/react-ui-form/src/components/Form/Input.tsx
|
|
106
95
|
import React2 from "react";
|
|
@@ -121,120 +110,156 @@ var InputHeader = ({ children, error }) => {
|
|
|
121
110
|
}, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), error)));
|
|
122
111
|
};
|
|
123
112
|
|
|
124
|
-
// packages/ui/react-ui-form/src/components/Form/
|
|
125
|
-
var
|
|
113
|
+
// packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
|
|
114
|
+
var GeoPointInput = ({ property, type, label, disabled, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
115
|
+
const { t } = useTranslation(translationKey);
|
|
126
116
|
const { status, error } = getStatus?.(property);
|
|
117
|
+
const [lng = 0, lat = 0] = getValue2(property) ?? [];
|
|
127
118
|
return /* @__PURE__ */ React3.createElement(Input2.Root, {
|
|
128
119
|
validationValence: status
|
|
129
|
-
},
|
|
120
|
+
}, /* @__PURE__ */ React3.createElement(InputHeader, {
|
|
121
|
+
error
|
|
122
|
+
}, /* @__PURE__ */ React3.createElement(Input2.Label, null, label)), /* @__PURE__ */ React3.createElement("div", {
|
|
123
|
+
className: "grid grid-cols-2 gap-2"
|
|
124
|
+
}, /* @__PURE__ */ React3.createElement(Input2.TextInput, {
|
|
125
|
+
type: "number",
|
|
126
|
+
disabled,
|
|
127
|
+
placeholder: t("placeholder longitude"),
|
|
128
|
+
value: lng,
|
|
129
|
+
onChange: (event) => onValueChange(property, type, [
|
|
130
|
+
lat,
|
|
131
|
+
safeParseFloat(event.target.value, 0)
|
|
132
|
+
]),
|
|
133
|
+
onBlur
|
|
134
|
+
}), /* @__PURE__ */ React3.createElement(Input2.TextInput, {
|
|
135
|
+
type: "number",
|
|
136
|
+
disabled,
|
|
137
|
+
placeholder: t("placeholder latitude"),
|
|
138
|
+
value: lat,
|
|
139
|
+
onChange: (event) => onValueChange(property, type, [
|
|
140
|
+
safeParseFloat(event.target.value, 0),
|
|
141
|
+
lng
|
|
142
|
+
]),
|
|
143
|
+
onBlur
|
|
144
|
+
})));
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// packages/ui/react-ui-form/src/components/Form/custom/TupleInput.tsx
|
|
148
|
+
import React4 from "react";
|
|
149
|
+
import { Input as Input3 } from "@dxos/react-ui";
|
|
150
|
+
import { mx } from "@dxos/react-ui-theme";
|
|
151
|
+
import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
|
|
152
|
+
var gridCols = [
|
|
153
|
+
"grid-cols-1",
|
|
154
|
+
"grid-cols-2",
|
|
155
|
+
"grid-cols-3",
|
|
156
|
+
"grid-cols-4"
|
|
157
|
+
];
|
|
158
|
+
var TupleInput = ({ binding, property, type, label, disabled, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
159
|
+
const { status, error } = getStatus?.(property);
|
|
160
|
+
const values = getValue2(property) ?? {};
|
|
161
|
+
return /* @__PURE__ */ React4.createElement(Input3.Root, {
|
|
162
|
+
validationValence: status
|
|
163
|
+
}, /* @__PURE__ */ React4.createElement(InputHeader, {
|
|
164
|
+
error
|
|
165
|
+
}, /* @__PURE__ */ React4.createElement(Input3.Label, null, label)), /* @__PURE__ */ React4.createElement("div", {
|
|
166
|
+
className: mx("grid gap-2", gridCols[binding.length - 1])
|
|
167
|
+
}, binding.map((prop) => /* @__PURE__ */ React4.createElement(Input3.TextInput, {
|
|
168
|
+
key: prop,
|
|
169
|
+
type: "number",
|
|
170
|
+
disabled,
|
|
171
|
+
value: values[prop],
|
|
172
|
+
onChange: (event) => onValueChange(property, type, {
|
|
173
|
+
...values,
|
|
174
|
+
[prop]: safeParseFloat2(event.target.value, 0)
|
|
175
|
+
}),
|
|
176
|
+
onBlur
|
|
177
|
+
}))));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// packages/ui/react-ui-form/src/components/Form/Defaults.tsx
|
|
181
|
+
import React5 from "react";
|
|
182
|
+
import { Input as Input4, Select } from "@dxos/react-ui";
|
|
183
|
+
var TextInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
184
|
+
const { status, error } = getStatus?.(property);
|
|
185
|
+
return /* @__PURE__ */ React5.createElement(Input4.Root, {
|
|
186
|
+
validationValence: status
|
|
187
|
+
}, !inputOnly && /* @__PURE__ */ React5.createElement(InputHeader, {
|
|
130
188
|
error
|
|
131
|
-
}, /* @__PURE__ */
|
|
189
|
+
}, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement(Input4.TextInput, {
|
|
132
190
|
disabled,
|
|
133
191
|
placeholder,
|
|
134
|
-
value:
|
|
192
|
+
value: getValue2(property) ?? "",
|
|
135
193
|
onChange: (event) => onValueChange(property, type, event.target.value),
|
|
136
194
|
onBlur
|
|
137
|
-
}), inputOnly && /* @__PURE__ */
|
|
195
|
+
}), inputOnly && /* @__PURE__ */ React5.createElement(Input4.Validation, null, error));
|
|
138
196
|
};
|
|
139
|
-
var NumberInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue, onValueChange, onBlur }) => {
|
|
197
|
+
var NumberInput = ({ property, type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue2, onValueChange, onBlur }) => {
|
|
140
198
|
const { status, error } = getStatus?.(property);
|
|
141
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ React5.createElement(Input4.Root, {
|
|
142
200
|
validationValence: status
|
|
143
|
-
}, !inputOnly && /* @__PURE__ */
|
|
201
|
+
}, !inputOnly && /* @__PURE__ */ React5.createElement(InputHeader, {
|
|
144
202
|
error
|
|
145
|
-
}, /* @__PURE__ */
|
|
203
|
+
}, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement(Input4.TextInput, {
|
|
146
204
|
type: "number",
|
|
147
205
|
disabled,
|
|
148
206
|
placeholder,
|
|
149
|
-
value:
|
|
207
|
+
value: getValue2(property) ?? 0,
|
|
150
208
|
onChange: (event) => onValueChange(property, type, event.target.value),
|
|
151
209
|
onBlur
|
|
152
|
-
}), inputOnly && /* @__PURE__ */
|
|
210
|
+
}), inputOnly && /* @__PURE__ */ React5.createElement(Input4.DescriptionAndValidation, null, error));
|
|
153
211
|
};
|
|
154
|
-
var BooleanInput = ({ property, type, label, inputOnly, getStatus, getValue, onValueChange }) => {
|
|
212
|
+
var BooleanInput = ({ property, type, label, inputOnly, getStatus, getValue: getValue2, onValueChange }) => {
|
|
155
213
|
const { status, error } = getStatus?.(property);
|
|
156
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ React5.createElement(Input4.Root, {
|
|
157
215
|
validationValence: status
|
|
158
|
-
}, !inputOnly && /* @__PURE__ */
|
|
216
|
+
}, !inputOnly && /* @__PURE__ */ React5.createElement(InputHeader, {
|
|
159
217
|
error
|
|
160
|
-
}, /* @__PURE__ */
|
|
161
|
-
checked:
|
|
218
|
+
}, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement(Input4.Switch, {
|
|
219
|
+
checked: getValue2(property),
|
|
162
220
|
onCheckedChange: (value) => onValueChange(property, type, value)
|
|
163
|
-
}), inputOnly && /* @__PURE__ */
|
|
221
|
+
}), inputOnly && /* @__PURE__ */ React5.createElement(Input4.DescriptionAndValidation, null, error));
|
|
164
222
|
};
|
|
165
|
-
var SelectInput = ({ property, type, label, inputOnly, disabled, placeholder, options, getStatus, getValue, onValueChange }) => {
|
|
223
|
+
var SelectInput = ({ property, type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue2, onValueChange }) => {
|
|
166
224
|
const { status, error } = getStatus?.(property);
|
|
167
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ React5.createElement(Input4.Root, {
|
|
168
226
|
validationValence: status
|
|
169
|
-
}, !inputOnly && /* @__PURE__ */
|
|
227
|
+
}, !inputOnly && /* @__PURE__ */ React5.createElement(InputHeader, {
|
|
170
228
|
error
|
|
171
|
-
}, /* @__PURE__ */
|
|
172
|
-
value:
|
|
229
|
+
}, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement(Select.Root, {
|
|
230
|
+
value: getValue2(property),
|
|
173
231
|
onValueChange: (value) => onValueChange(property, type, value)
|
|
174
|
-
}, /* @__PURE__ */
|
|
232
|
+
}, /* @__PURE__ */ React5.createElement(Select.TriggerButton, {
|
|
175
233
|
classNames: "is-full",
|
|
176
234
|
disabled,
|
|
177
235
|
placeholder
|
|
178
|
-
}), /* @__PURE__ */
|
|
236
|
+
}), /* @__PURE__ */ React5.createElement(Select.Portal, null, /* @__PURE__ */ React5.createElement(Select.Content, null, /* @__PURE__ */ React5.createElement(Select.Viewport, null, options?.map(({ value, label: label2 }) => (
|
|
179
237
|
// NOTE: Numeric values are converted to and from strings.
|
|
180
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ React5.createElement(Select.Option, {
|
|
181
239
|
key: String(value),
|
|
182
240
|
value: String(value)
|
|
183
241
|
}, label2 ?? String(value))
|
|
184
|
-
)))))), inputOnly && /* @__PURE__ */
|
|
242
|
+
)))))), inputOnly && /* @__PURE__ */ React5.createElement(Input4.DescriptionAndValidation, null, error));
|
|
185
243
|
};
|
|
186
244
|
|
|
187
|
-
// packages/ui/react-ui-form/src/components/Form/
|
|
188
|
-
import {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
import
|
|
192
|
-
import {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
validationValence: status
|
|
199
|
-
}, /* @__PURE__ */ React4.createElement(InputHeader, {
|
|
200
|
-
error
|
|
201
|
-
}, /* @__PURE__ */ React4.createElement(Input3.Label, null, label)), /* @__PURE__ */ React4.createElement("div", {
|
|
202
|
-
className: "grid grid-cols-2 gap-2"
|
|
203
|
-
}, /* @__PURE__ */ React4.createElement(Input3.TextInput, {
|
|
204
|
-
type: "number",
|
|
205
|
-
disabled,
|
|
206
|
-
placeholder: t("placeholder longitude"),
|
|
207
|
-
value: lng,
|
|
208
|
-
onChange: (event) => onValueChange(property, type, [
|
|
209
|
-
lat,
|
|
210
|
-
safeParseFloat(event.target.value, 0)
|
|
211
|
-
]),
|
|
212
|
-
onBlur
|
|
213
|
-
}), /* @__PURE__ */ React4.createElement(Input3.TextInput, {
|
|
214
|
-
type: "number",
|
|
215
|
-
disabled,
|
|
216
|
-
placeholder: t("placeholder latitude"),
|
|
217
|
-
value: lat,
|
|
218
|
-
onChange: (event) => onValueChange(property, type, [
|
|
219
|
-
safeParseFloat(event.target.value, 0),
|
|
220
|
-
lng
|
|
221
|
-
]),
|
|
222
|
-
onBlur
|
|
223
|
-
})));
|
|
224
|
-
};
|
|
225
|
-
var safeParseFloat = (str, defaultValue) => {
|
|
226
|
-
try {
|
|
227
|
-
return parseFloat(str);
|
|
228
|
-
} catch {
|
|
229
|
-
return defaultValue ?? 0;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
245
|
+
// packages/ui/react-ui-form/src/components/Form/Form.tsx
|
|
246
|
+
import { pipe } from "effect";
|
|
247
|
+
import { capitalize } from "effect/String";
|
|
248
|
+
import React6, { useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
249
|
+
import { AST, S } from "@dxos/echo-schema";
|
|
250
|
+
import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
|
|
251
|
+
import { log as log2 } from "@dxos/log";
|
|
252
|
+
import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
253
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
254
|
+
import { getSchemaProperties } from "@dxos/schema";
|
|
255
|
+
import { isNotFalsy } from "@dxos/util";
|
|
232
256
|
|
|
233
257
|
// packages/ui/react-ui-form/src/components/Form/factory.tsx
|
|
258
|
+
import { FormatEnum } from "@dxos/echo-schema";
|
|
234
259
|
var getInputComponent = (type, format) => {
|
|
235
260
|
switch (format) {
|
|
236
261
|
case FormatEnum.LatLng:
|
|
237
|
-
return
|
|
262
|
+
return GeoPointInput;
|
|
238
263
|
}
|
|
239
264
|
switch (type) {
|
|
240
265
|
case "string":
|
|
@@ -248,6 +273,7 @@ var getInputComponent = (type, format) => {
|
|
|
248
273
|
|
|
249
274
|
// packages/ui/react-ui-form/src/hooks/useForm.ts
|
|
250
275
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
276
|
+
import { getValue, setValue } from "@dxos/echo-schema";
|
|
251
277
|
import { invariant } from "@dxos/invariant";
|
|
252
278
|
import { log } from "@dxos/log";
|
|
253
279
|
import { validateSchema } from "@dxos/schema";
|
|
@@ -266,10 +292,12 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
266
292
|
const validate = useCallback((values2) => {
|
|
267
293
|
let errors2 = validateSchema(schema, values2) ?? [];
|
|
268
294
|
if (errors2.length === 0 && onValidate) {
|
|
269
|
-
|
|
295
|
+
const validatedValues = values2;
|
|
296
|
+
errors2 = onValidate(validatedValues) ?? [];
|
|
270
297
|
}
|
|
271
298
|
setErrors(flatMap(errors2));
|
|
272
|
-
|
|
299
|
+
const valid = errors2.length === 0;
|
|
300
|
+
return valid;
|
|
273
301
|
}, [
|
|
274
302
|
schema,
|
|
275
303
|
onValidate
|
|
@@ -307,7 +335,8 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
307
335
|
}, [
|
|
308
336
|
values,
|
|
309
337
|
validate,
|
|
310
|
-
onSave
|
|
338
|
+
onSave,
|
|
339
|
+
changed
|
|
311
340
|
]);
|
|
312
341
|
const getStatus = useCallback((property) => ({
|
|
313
342
|
status: errors[property] ? "error" : void 0,
|
|
@@ -316,8 +345,8 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
316
345
|
touched,
|
|
317
346
|
errors
|
|
318
347
|
]);
|
|
319
|
-
const
|
|
320
|
-
return
|
|
348
|
+
const getFormValue = (property) => {
|
|
349
|
+
return getValue(values, property);
|
|
321
350
|
};
|
|
322
351
|
const onValueChange = (property, type, value) => {
|
|
323
352
|
let parsedValue = value;
|
|
@@ -328,13 +357,15 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
328
357
|
} catch (err) {
|
|
329
358
|
log.catch(err, void 0, {
|
|
330
359
|
F: __dxlog_file,
|
|
331
|
-
L:
|
|
360
|
+
L: 178,
|
|
332
361
|
S: void 0,
|
|
333
362
|
C: (f, a) => f(...a)
|
|
334
363
|
});
|
|
335
364
|
parsedValue = void 0;
|
|
336
365
|
}
|
|
337
|
-
const newValues =
|
|
366
|
+
const newValues = {
|
|
367
|
+
...setValue(values, property, parsedValue)
|
|
368
|
+
};
|
|
338
369
|
setValues(newValues);
|
|
339
370
|
setChanged((prev) => ({
|
|
340
371
|
...prev,
|
|
@@ -372,7 +403,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
372
403
|
handleSave,
|
|
373
404
|
// Field utils.
|
|
374
405
|
getStatus,
|
|
375
|
-
getValue,
|
|
406
|
+
getValue: getFormValue,
|
|
376
407
|
onValueChange,
|
|
377
408
|
onBlur
|
|
378
409
|
};
|
|
@@ -380,7 +411,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
380
411
|
var createKeySet = (obj, value) => {
|
|
381
412
|
invariant(obj, void 0, {
|
|
382
413
|
F: __dxlog_file,
|
|
383
|
-
L:
|
|
414
|
+
L: 229,
|
|
384
415
|
S: void 0,
|
|
385
416
|
A: [
|
|
386
417
|
"obj",
|
|
@@ -400,20 +431,6 @@ var flatMap = (errors) => {
|
|
|
400
431
|
return result;
|
|
401
432
|
}, {});
|
|
402
433
|
};
|
|
403
|
-
var getByPath = (obj, path) => {
|
|
404
|
-
const [key, index] = path.split(".");
|
|
405
|
-
return index === void 0 ? obj[key] : obj[key][parseInt(index)];
|
|
406
|
-
};
|
|
407
|
-
var setByPath = (obj, path, value) => {
|
|
408
|
-
const [key, index] = path.split(".");
|
|
409
|
-
const newValue = index === void 0 ? value : [
|
|
410
|
-
...obj[key]
|
|
411
|
-
].map((v, i) => i === parseInt(index) ? value : v);
|
|
412
|
-
return {
|
|
413
|
-
...obj,
|
|
414
|
-
[key]: newValue
|
|
415
|
-
};
|
|
416
|
-
};
|
|
417
434
|
|
|
418
435
|
// packages/ui/react-ui-form/src/components/Form/Form.tsx
|
|
419
436
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/Form.tsx";
|
|
@@ -450,7 +467,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
450
467
|
errors
|
|
451
468
|
}, {
|
|
452
469
|
F: __dxlog_file2,
|
|
453
|
-
L:
|
|
470
|
+
L: 99,
|
|
454
471
|
S: void 0,
|
|
455
472
|
C: (f, a) => f(...a)
|
|
456
473
|
});
|
|
@@ -458,9 +475,9 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
458
475
|
}, [
|
|
459
476
|
errors
|
|
460
477
|
]);
|
|
461
|
-
return /* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
462
479
|
role: "form",
|
|
463
|
-
className:
|
|
480
|
+
className: mx2("flex flex-col w-full gap-2 py-2", classNames),
|
|
464
481
|
"data-testid": testId
|
|
465
482
|
}, properties.map((property) => {
|
|
466
483
|
const { ast, name, type, format, title, description, examples, options, array } = property;
|
|
@@ -473,11 +490,11 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
473
490
|
let InputComponent = Custom?.[key.join(".")];
|
|
474
491
|
if (!InputComponent) {
|
|
475
492
|
if (options) {
|
|
476
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
477
494
|
key: name,
|
|
478
495
|
role: "none",
|
|
479
496
|
className: padding
|
|
480
|
-
}, /* @__PURE__ */
|
|
497
|
+
}, /* @__PURE__ */ React6.createElement(SelectInput, {
|
|
481
498
|
type,
|
|
482
499
|
format,
|
|
483
500
|
property: name,
|
|
@@ -493,7 +510,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
493
510
|
}
|
|
494
511
|
InputComponent = getInputComponent(type, format);
|
|
495
512
|
if (array) {
|
|
496
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ React6.createElement(ArrayField, {
|
|
497
514
|
key: name,
|
|
498
515
|
name,
|
|
499
516
|
type,
|
|
@@ -515,12 +532,12 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
515
532
|
const typeLiteral = baseNode ? getDiscriminatedType(baseNode, values[name]) : findNode(ast, AST.isTypeLiteral);
|
|
516
533
|
if (typeLiteral) {
|
|
517
534
|
const schema2 = S.make(typeLiteral);
|
|
518
|
-
return /* @__PURE__ */
|
|
535
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
519
536
|
key: name,
|
|
520
537
|
role: "none"
|
|
521
|
-
}, /* @__PURE__ */
|
|
538
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
522
539
|
className: padding
|
|
523
|
-
}, label), /* @__PURE__ */
|
|
540
|
+
}, label), /* @__PURE__ */ React6.createElement(Form, {
|
|
524
541
|
schema: schema2,
|
|
525
542
|
path: key,
|
|
526
543
|
values: values[name] ?? {},
|
|
@@ -536,17 +553,17 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
536
553
|
type
|
|
537
554
|
}, {
|
|
538
555
|
F: __dxlog_file2,
|
|
539
|
-
L:
|
|
556
|
+
L: 184,
|
|
540
557
|
S: void 0,
|
|
541
558
|
C: (f, a) => f(...a)
|
|
542
559
|
});
|
|
543
560
|
return null;
|
|
544
561
|
}
|
|
545
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
546
563
|
key: name,
|
|
547
564
|
role: "none",
|
|
548
565
|
className: padding
|
|
549
|
-
}, /* @__PURE__ */
|
|
566
|
+
}, /* @__PURE__ */ React6.createElement(InputComponent, {
|
|
550
567
|
type,
|
|
551
568
|
format,
|
|
552
569
|
property: name,
|
|
@@ -555,7 +572,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], readonly, fi
|
|
|
555
572
|
placeholder,
|
|
556
573
|
...inputProps
|
|
557
574
|
}));
|
|
558
|
-
}).filter(isNotFalsy), (onCancel || onSave) && !autoSave && /* @__PURE__ */
|
|
575
|
+
}).filter(isNotFalsy), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React6.createElement(FormActions, {
|
|
559
576
|
onCancel,
|
|
560
577
|
onSubmit: handleSave,
|
|
561
578
|
canSubmit: canSave,
|
|
@@ -575,26 +592,26 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
575
592
|
const typeLiteral = baseNode ? getDiscriminatedType(baseNode, values[name]) : findNode(elementType, AST.isTypeLiteral);
|
|
576
593
|
if (typeLiteral) {
|
|
577
594
|
const schema = S.make(typeLiteral);
|
|
578
|
-
return /* @__PURE__ */
|
|
595
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
579
596
|
key: name,
|
|
580
597
|
role: "none",
|
|
581
|
-
className:
|
|
582
|
-
}, /* @__PURE__ */
|
|
598
|
+
className: mx2(padding)
|
|
599
|
+
}, /* @__PURE__ */ React6.createElement(InputHeader, null, label), /* @__PURE__ */ React6.createElement("div", {
|
|
583
600
|
role: "none",
|
|
584
601
|
className: "flex flex-col gap-1"
|
|
585
602
|
}, arrayValues.map((value, index) => {
|
|
586
|
-
return /* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
587
604
|
key: index,
|
|
588
605
|
role: "none",
|
|
589
606
|
className: "flex items-center gap-1"
|
|
590
|
-
}, /* @__PURE__ */
|
|
607
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
591
608
|
role: "none",
|
|
592
609
|
className: "flex-1"
|
|
593
|
-
}, /* @__PURE__ */
|
|
610
|
+
}, /* @__PURE__ */ React6.createElement(Form, {
|
|
594
611
|
schema,
|
|
595
612
|
path: [
|
|
596
613
|
...key,
|
|
597
|
-
index
|
|
614
|
+
`[${index}]`
|
|
598
615
|
],
|
|
599
616
|
values: value,
|
|
600
617
|
onValuesChanged: (childValues) => {
|
|
@@ -605,7 +622,7 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
605
622
|
inputProps.onValueChange(name, "object", newValues);
|
|
606
623
|
},
|
|
607
624
|
Custom
|
|
608
|
-
})), /* @__PURE__ */
|
|
625
|
+
})), /* @__PURE__ */ React6.createElement(IconButton, {
|
|
609
626
|
icon: "ph--trash--regular",
|
|
610
627
|
iconOnly: true,
|
|
611
628
|
label: t("button remove"),
|
|
@@ -614,10 +631,10 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
614
631
|
inputProps.onValueChange(name, type, newValues);
|
|
615
632
|
}
|
|
616
633
|
}));
|
|
617
|
-
})), /* @__PURE__ */
|
|
634
|
+
})), /* @__PURE__ */ React6.createElement("div", {
|
|
618
635
|
role: "none",
|
|
619
636
|
className: "flex justify-between items-center plb-1"
|
|
620
|
-
}, /* @__PURE__ */
|
|
637
|
+
}, /* @__PURE__ */ React6.createElement(IconButton, {
|
|
621
638
|
icon: "ph--plus--regular",
|
|
622
639
|
iconOnly: true,
|
|
623
640
|
label: t("button add"),
|
|
@@ -630,7 +647,7 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
630
647
|
}
|
|
631
648
|
})));
|
|
632
649
|
}
|
|
633
|
-
return /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
634
651
|
key: name,
|
|
635
652
|
role: "none"
|
|
636
653
|
}, "Nested form not supported in arrays, yet.");
|
|
@@ -639,30 +656,30 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
639
656
|
if (!InputComponent) {
|
|
640
657
|
return null;
|
|
641
658
|
}
|
|
642
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
643
660
|
role: "none",
|
|
644
661
|
key: "meta-input",
|
|
645
|
-
className:
|
|
646
|
-
}, /* @__PURE__ */
|
|
662
|
+
className: mx2(padding)
|
|
663
|
+
}, /* @__PURE__ */ React6.createElement(InputHeader, null, label), /* @__PURE__ */ React6.createElement("div", {
|
|
647
664
|
role: "none",
|
|
648
665
|
className: "flex flex-col gap-1"
|
|
649
|
-
}, arrayValues.map((_, index) => /* @__PURE__ */
|
|
666
|
+
}, arrayValues.map((_, index) => /* @__PURE__ */ React6.createElement("div", {
|
|
650
667
|
key: index,
|
|
651
668
|
role: "none",
|
|
652
669
|
className: "flex items-start gap-1"
|
|
653
|
-
}, /* @__PURE__ */
|
|
670
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
654
671
|
role: "none",
|
|
655
672
|
className: "flex-1"
|
|
656
|
-
}, /* @__PURE__ */
|
|
673
|
+
}, /* @__PURE__ */ React6.createElement(InputComponent, {
|
|
657
674
|
type,
|
|
658
675
|
format,
|
|
659
676
|
label,
|
|
660
677
|
inputOnly: true,
|
|
661
|
-
property: `${name}
|
|
678
|
+
property: `${name}[${index}]`,
|
|
662
679
|
disabled: readonly,
|
|
663
680
|
placeholder,
|
|
664
681
|
...inputProps
|
|
665
|
-
})), /* @__PURE__ */
|
|
682
|
+
})), /* @__PURE__ */ React6.createElement(IconButton, {
|
|
666
683
|
icon: "ph--trash--regular",
|
|
667
684
|
iconOnly: true,
|
|
668
685
|
label: t("button remove"),
|
|
@@ -670,10 +687,10 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
670
687
|
const newValues = arrayValues.filter((_2, i) => i !== index);
|
|
671
688
|
inputProps.onValueChange(name, type, newValues);
|
|
672
689
|
}
|
|
673
|
-
})))), /* @__PURE__ */
|
|
690
|
+
})))), /* @__PURE__ */ React6.createElement("div", {
|
|
674
691
|
role: "none",
|
|
675
692
|
className: "flex justify-between items-center plb-1"
|
|
676
|
-
}, /* @__PURE__ */
|
|
693
|
+
}, /* @__PURE__ */ React6.createElement(IconButton, {
|
|
677
694
|
icon: "ph--plus--regular",
|
|
678
695
|
iconOnly: true,
|
|
679
696
|
label: t("button add"),
|
|
@@ -688,18 +705,18 @@ var ArrayField = ({ name, type, label, ast, values, format, readonly, placeholde
|
|
|
688
705
|
};
|
|
689
706
|
var FormActions = ({ onCancel, onSubmit, canSubmit, readonly }) => {
|
|
690
707
|
const { t } = useTranslation2(translationKey);
|
|
691
|
-
return /* @__PURE__ */
|
|
708
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
692
709
|
role: "none",
|
|
693
710
|
className: "flex justify-center"
|
|
694
|
-
}, /* @__PURE__ */
|
|
711
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
695
712
|
role: "none",
|
|
696
|
-
className:
|
|
697
|
-
}, onCancel && !readonly && /* @__PURE__ */
|
|
713
|
+
className: mx2(onCancel && !readonly && "grid grid-cols-2 gap-2")
|
|
714
|
+
}, onCancel && !readonly && /* @__PURE__ */ React6.createElement(IconButton, {
|
|
698
715
|
"data-testid": "cancel-button",
|
|
699
716
|
icon: "ph--x--regular",
|
|
700
717
|
label: t("button cancel"),
|
|
701
718
|
onClick: onCancel
|
|
702
|
-
}), onSubmit && /* @__PURE__ */
|
|
719
|
+
}), onSubmit && /* @__PURE__ */ React6.createElement(IconButton, {
|
|
703
720
|
type: "submit",
|
|
704
721
|
"data-testid": "save-button",
|
|
705
722
|
disabled: !canSubmit,
|
|
@@ -723,9 +740,11 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
723
740
|
if (!registry) {
|
|
724
741
|
return;
|
|
725
742
|
}
|
|
726
|
-
const subscription = registry.subscribe(setSchemas)
|
|
743
|
+
const subscription = registry.query().subscribe((query) => setSchemas(query.results), {
|
|
744
|
+
fire: true
|
|
745
|
+
});
|
|
727
746
|
const t2 = setTimeout(async () => {
|
|
728
|
-
const schemas2 = await registry.query();
|
|
747
|
+
const schemas2 = await registry.query().run();
|
|
729
748
|
setSchemas(schemas2);
|
|
730
749
|
});
|
|
731
750
|
return () => {
|
|
@@ -746,11 +765,15 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
746
765
|
fieldSchema: getFormatSchema(props?.format)
|
|
747
766
|
});
|
|
748
767
|
const handleValuesChanged = useCallback2((_props) => {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
768
|
+
setFieldSchema((prev) => {
|
|
769
|
+
const fieldSchema2 = getFormatSchema(_props.format);
|
|
770
|
+
if (prev.fieldSchema === fieldSchema2) {
|
|
771
|
+
return prev;
|
|
772
|
+
}
|
|
773
|
+
return {
|
|
774
|
+
fieldSchema: fieldSchema2
|
|
775
|
+
};
|
|
776
|
+
});
|
|
754
777
|
if (_props.referenceSchema !== props.referenceSchema) {
|
|
755
778
|
setSchema(schemas.find((schema2) => schema2.typename === _props.referenceSchema));
|
|
756
779
|
}
|
|
@@ -767,7 +790,8 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
767
790
|
});
|
|
768
791
|
}, [
|
|
769
792
|
schemas,
|
|
770
|
-
props
|
|
793
|
+
props.format,
|
|
794
|
+
props.referenceSchema
|
|
771
795
|
]);
|
|
772
796
|
const handleValidate = useCallback2(({ property }) => {
|
|
773
797
|
if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
|
|
@@ -804,13 +828,13 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
804
828
|
props
|
|
805
829
|
}, {
|
|
806
830
|
F: __dxlog_file3,
|
|
807
|
-
L:
|
|
831
|
+
L: 126,
|
|
808
832
|
S: void 0,
|
|
809
833
|
C: (f, a) => f(...a)
|
|
810
834
|
});
|
|
811
835
|
return null;
|
|
812
836
|
}
|
|
813
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React7.createElement(Form, {
|
|
814
838
|
key: field.id,
|
|
815
839
|
autoFocus: true,
|
|
816
840
|
values: props,
|
|
@@ -825,22 +849,22 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
825
849
|
onSave: handleSave,
|
|
826
850
|
onCancel: handleCancel,
|
|
827
851
|
Custom: {
|
|
828
|
-
["format"]: (props2) => /* @__PURE__ */
|
|
852
|
+
["format"]: (props2) => /* @__PURE__ */ React7.createElement(SelectInput, {
|
|
829
853
|
...props2,
|
|
830
854
|
options: FormatEnums.filter((value) => value !== FormatEnum2.None).map((value) => ({
|
|
831
855
|
value,
|
|
832
856
|
label: t(`format ${value}`)
|
|
833
857
|
}))
|
|
834
858
|
}),
|
|
835
|
-
["referenceSchema"]: (props2) => /* @__PURE__ */
|
|
859
|
+
["referenceSchema"]: (props2) => /* @__PURE__ */ React7.createElement(SelectInput, {
|
|
836
860
|
...props2,
|
|
837
861
|
options: schemas.map((schema2) => ({
|
|
838
862
|
value: schema2.typename
|
|
839
863
|
}))
|
|
840
864
|
}),
|
|
841
|
-
["referencePath"]: (props2) => /* @__PURE__ */
|
|
865
|
+
["referencePath"]: (props2) => /* @__PURE__ */ React7.createElement(SelectInput, {
|
|
842
866
|
...props2,
|
|
843
|
-
options: schema ? getSchemaProperties2(schema.
|
|
867
|
+
options: schema ? getSchemaProperties2(schema.ast).sort(sortProperties).map((p) => ({
|
|
844
868
|
value: p.name
|
|
845
869
|
})) : []
|
|
846
870
|
})
|
|
@@ -849,11 +873,11 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
|
|
|
849
873
|
};
|
|
850
874
|
|
|
851
875
|
// packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
|
|
852
|
-
import
|
|
876
|
+
import React8, { useCallback as useCallback3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
853
877
|
import { AST as AST2, Format, S as S2 } from "@dxos/echo-schema";
|
|
854
878
|
import { IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
855
879
|
import { List } from "@dxos/react-ui-list";
|
|
856
|
-
import { ghostHover, inputTextLabel, mx as
|
|
880
|
+
import { ghostHover, inputTextLabel, mx as mx3 } from "@dxos/react-ui-theme";
|
|
857
881
|
import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
|
|
858
882
|
import { arrayMove } from "@dxos/util";
|
|
859
883
|
var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
|
|
@@ -907,52 +931,52 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
|
|
|
907
931
|
view.fields
|
|
908
932
|
]);
|
|
909
933
|
const handleClose = useCallback3(() => setField(void 0), []);
|
|
910
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
911
935
|
role: "none",
|
|
912
|
-
className:
|
|
913
|
-
}, /* @__PURE__ */
|
|
936
|
+
className: mx3("flex flex-col w-full divide-y divide-separator", classNames)
|
|
937
|
+
}, /* @__PURE__ */ React8.createElement(Form, {
|
|
914
938
|
autoFocus: true,
|
|
915
939
|
autoSave: true,
|
|
916
940
|
schema: ViewMetaSchema,
|
|
917
941
|
values: viewValues,
|
|
918
942
|
onSave: handleViewUpdate
|
|
919
|
-
}), /* @__PURE__ */
|
|
943
|
+
}), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", {
|
|
920
944
|
role: "none",
|
|
921
945
|
className: "p-2"
|
|
922
|
-
}, /* @__PURE__ */
|
|
923
|
-
className:
|
|
924
|
-
}, t("fields label"))), /* @__PURE__ */
|
|
946
|
+
}, /* @__PURE__ */ React8.createElement("label", {
|
|
947
|
+
className: mx3(inputTextLabel)
|
|
948
|
+
}, t("fields label"))), /* @__PURE__ */ React8.createElement(List.Root, {
|
|
925
949
|
items: view.fields,
|
|
926
950
|
isItem: S2.is(FieldSchema),
|
|
927
951
|
getId: (field2) => field2.id,
|
|
928
952
|
onMove: handleMove
|
|
929
|
-
}, ({ items: fields }) => /* @__PURE__ */
|
|
953
|
+
}, ({ items: fields }) => /* @__PURE__ */ React8.createElement(React8.Fragment, null, showHeading && /* @__PURE__ */ React8.createElement("div", {
|
|
930
954
|
role: "heading",
|
|
931
955
|
className: grid
|
|
932
|
-
}, /* @__PURE__ */
|
|
956
|
+
}, /* @__PURE__ */ React8.createElement("div", null), /* @__PURE__ */ React8.createElement("div", {
|
|
933
957
|
className: "flex items-center text-sm"
|
|
934
|
-
}, t("field path label"))), /* @__PURE__ */
|
|
958
|
+
}, t("field path label"))), /* @__PURE__ */ React8.createElement("div", {
|
|
935
959
|
role: "list",
|
|
936
960
|
className: "flex flex-col w-full"
|
|
937
|
-
}, fields?.map((field2) => /* @__PURE__ */
|
|
961
|
+
}, fields?.map((field2) => /* @__PURE__ */ React8.createElement(List.Item, {
|
|
938
962
|
key: field2.id,
|
|
939
963
|
item: field2,
|
|
940
|
-
classNames:
|
|
941
|
-
}, /* @__PURE__ */
|
|
964
|
+
classNames: mx3(grid, ghostHover, "cursor-pointer")
|
|
965
|
+
}, /* @__PURE__ */ React8.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React8.createElement(List.ItemTitle, {
|
|
942
966
|
onClick: () => handleSelect(field2)
|
|
943
|
-
}, field2.path), /* @__PURE__ */
|
|
967
|
+
}, field2.path), /* @__PURE__ */ React8.createElement(List.ItemDeleteButton, {
|
|
944
968
|
disabled: view.fields.length <= 1,
|
|
945
969
|
onClick: () => onDelete(field2.id)
|
|
946
|
-
}))))))), field && /* @__PURE__ */
|
|
970
|
+
}))))))), field && /* @__PURE__ */ React8.createElement(FieldEditor, {
|
|
947
971
|
key: field.id,
|
|
948
972
|
view,
|
|
949
973
|
projection,
|
|
950
974
|
field,
|
|
951
975
|
registry,
|
|
952
976
|
onSave: handleClose
|
|
953
|
-
}), !readonly && !field && /* @__PURE__ */
|
|
977
|
+
}), !readonly && !field && /* @__PURE__ */ React8.createElement("div", {
|
|
954
978
|
className: "flex p-2 justify-center"
|
|
955
|
-
}, /* @__PURE__ */
|
|
979
|
+
}, /* @__PURE__ */ React8.createElement(IconButton2, {
|
|
956
980
|
icon: "ph--plus--regular",
|
|
957
981
|
label: t("button add property"),
|
|
958
982
|
onClick: handleAdd,
|
|
@@ -1186,11 +1210,12 @@ export {
|
|
|
1186
1210
|
FieldEditor,
|
|
1187
1211
|
Form,
|
|
1188
1212
|
FormActions,
|
|
1189
|
-
|
|
1213
|
+
GeoPointInput,
|
|
1190
1214
|
InputHeader,
|
|
1191
1215
|
NumberInput,
|
|
1192
1216
|
SelectInput,
|
|
1193
1217
|
TextInput,
|
|
1218
|
+
TupleInput,
|
|
1194
1219
|
ViewEditor,
|
|
1195
1220
|
cellClassesForFieldType,
|
|
1196
1221
|
cellClassesForRowSelection,
|