@dxos/react-ui-form 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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/README.md +0 -1
- package/dist/lib/browser/index.mjs +1003 -668
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1003 -668
- 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 +3 -3
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +62 -61
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +23 -18
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +68 -67
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField.d.ts +7 -1
- package/dist/types/src/components/Form/FormField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormFieldComponent.d.ts +0 -1
- package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +2 -2
- package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormFieldSet.d.ts +9 -10
- package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -1
- package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/fields/RefField.d.ts +8 -6
- package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -1
- package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -1
- package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +62 -61
- package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +9 -0
- package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
- package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
- package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +10 -2
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
- package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +62 -61
- package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +83 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
- package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
- package/dist/types/src/components/Settings/Settings.d.ts +35 -0
- package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
- package/dist/types/src/components/Settings/Settings.stories.d.ts +82 -0
- package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
- package/dist/types/src/components/Settings/index.d.ts +2 -0
- package/dist/types/src/components/Settings/index.d.ts.map +1 -0
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -5
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +66 -64
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useKeyHandler.d.ts +2 -1
- package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +62 -61
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/refs.d.ts +1 -0
- package/dist/types/src/util/refs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -38
- package/src/components/FieldEditor/FieldEditor.stories.tsx +7 -8
- package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
- package/src/components/FieldEditor/FieldEditor.tsx +3 -4
- package/src/components/Form/AUDIT.md +17 -0
- package/src/components/Form/Form.stories.tsx +25 -26
- package/src/components/Form/Form.tsx +101 -66
- package/src/components/Form/FormField.tsx +32 -14
- package/src/components/Form/FormFieldComponent.stories.tsx +5 -5
- package/src/components/Form/FormFieldComponent.tsx +17 -20
- package/src/components/Form/FormFieldSet.tsx +126 -105
- package/src/components/Form/fields/ArrayField.tsx +11 -8
- package/src/components/Form/fields/GeoPointField.tsx +6 -6
- package/src/components/Form/fields/MarkdownField.tsx +1 -1
- package/src/components/Form/fields/RefField.tsx +37 -20
- package/src/components/Form/fields/SelectField.tsx +1 -1
- package/src/components/Form/fields/SelectOptionField.stories.tsx +2 -3
- package/src/components/Form/fields/SelectOptionField.tsx +9 -10
- package/src/components/Form/fields/TupleField.tsx +1 -1
- package/src/components/ObjectForm/ObjectForm.tsx +113 -0
- package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
- package/src/components/ObjectPicker/ObjectPicker.stories.tsx +13 -18
- package/src/components/ObjectPicker/ObjectPicker.tsx +71 -60
- package/src/components/ObjectProperties/ObjectProperties.stories.tsx +63 -0
- package/src/components/ObjectProperties/ObjectProperties.tsx +129 -0
- package/src/components/ObjectProperties/index.ts +5 -0
- package/src/components/Settings/Settings.stories.tsx +55 -0
- package/src/components/Settings/Settings.tsx +129 -0
- package/src/components/Settings/index.ts +5 -0
- package/src/components/ViewEditor/ViewEditor.stories.tsx +36 -33
- package/src/components/ViewEditor/ViewEditor.test.tsx +3 -7
- package/src/components/ViewEditor/ViewEditor.tsx +117 -85
- package/src/components/index.ts +3 -1
- package/src/components/testing.tsx +20 -8
- package/src/hooks/useFormHandler.ts +42 -18
- package/src/hooks/useKeyHandler.tsx +7 -7
- package/src/translations.ts +63 -63
- package/src/util/refs.ts +7 -3
- package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
- package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -87
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/index.d.ts +0 -2
- package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
- package/dist/types/src/components/Form/Form-old.stories.d.ts +0 -131
- package/dist/types/src/components/Form/Form-old.stories.d.ts.map +0 -1
- package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
- package/src/components/ControlSection/ControlSection.tsx +0 -153
- package/src/components/Form/Form-old.stories.tsx +0 -314
|
@@ -6,173 +6,83 @@ var translations = [
|
|
|
6
6
|
{
|
|
7
7
|
"en-US": {
|
|
8
8
|
[translationKey]: {
|
|
9
|
-
"fields
|
|
10
|
-
"hidden
|
|
11
|
-
"empty
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"field
|
|
15
|
-
"field
|
|
16
|
-
"field
|
|
17
|
-
"field
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"field
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"ref
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"example
|
|
30
|
-
"latitude
|
|
31
|
-
"longitude
|
|
32
|
-
"cancel
|
|
33
|
-
"save
|
|
34
|
-
//
|
|
35
|
-
"format
|
|
36
|
-
"format
|
|
37
|
-
"format
|
|
38
|
-
"format
|
|
39
|
-
"format
|
|
40
|
-
"format
|
|
41
|
-
"format
|
|
42
|
-
"format
|
|
43
|
-
"format
|
|
44
|
-
"format
|
|
45
|
-
"format
|
|
46
|
-
"format
|
|
47
|
-
"format
|
|
48
|
-
"format
|
|
49
|
-
"format
|
|
50
|
-
"format
|
|
51
|
-
"format
|
|
52
|
-
"format
|
|
53
|
-
"format
|
|
54
|
-
"format
|
|
55
|
-
"format
|
|
56
|
-
"format
|
|
57
|
-
"format
|
|
58
|
-
"format
|
|
59
|
-
"format
|
|
60
|
-
"format
|
|
61
|
-
"format
|
|
62
|
-
"format
|
|
9
|
+
"fields.label": "Fields",
|
|
10
|
+
"hidden-fields.label": "Hidden Fields",
|
|
11
|
+
"empty-readonly-ref-field.label": "(none)",
|
|
12
|
+
"add-property-button.label": "Add property",
|
|
13
|
+
"field-property.label": "Property",
|
|
14
|
+
"field-property.placeholder": "Property name",
|
|
15
|
+
"field-format.label": "Type",
|
|
16
|
+
"field-path.label": "Field path",
|
|
17
|
+
"add-field.button": "Add field",
|
|
18
|
+
"boolean-input-true.value": "Yes",
|
|
19
|
+
"boolean-input-false.value": "No",
|
|
20
|
+
"show-field.label": "Show field",
|
|
21
|
+
"hide-field.label": "Hide field",
|
|
22
|
+
"delete-field.label": "Delete field",
|
|
23
|
+
"ref-field-combobox-input.placeholder": "Search\u2026",
|
|
24
|
+
"ref-field.placeholder": "Select\u2026",
|
|
25
|
+
"ref-field.placeholder_one": "Select\u2026",
|
|
26
|
+
"ref-field.placeholder_other": "Select items\u2026",
|
|
27
|
+
"create-option.label": "Create",
|
|
28
|
+
"add-tag.label": "Add tag",
|
|
29
|
+
"example.placeholder": "Example",
|
|
30
|
+
"latitude.placeholder": "Latitude (e.g., 40.7128)",
|
|
31
|
+
"longitude.placeholder": "Longitude (e.g., -74.0060)",
|
|
32
|
+
"cancel-button.label": "Cancel",
|
|
33
|
+
"save-button.label": "Save",
|
|
34
|
+
// TypeFormat
|
|
35
|
+
"format.boolean.label": "Boolean",
|
|
36
|
+
"format.currency.label": "Currency",
|
|
37
|
+
"format.date.label": "Date",
|
|
38
|
+
"format.date-time.label": "DateTime",
|
|
39
|
+
"format.did.label": "DID",
|
|
40
|
+
"format.duration.label": "Duration",
|
|
41
|
+
"format.dxn.label": "DXN",
|
|
42
|
+
"format.email.label": "Email",
|
|
43
|
+
"format.formula.label": "Formula",
|
|
44
|
+
"format.hostname.label": "Hostname",
|
|
45
|
+
"format.integer.label": "Integer",
|
|
46
|
+
"format.json.label": "JSON",
|
|
47
|
+
"format.lnglat.label": "Geopoint",
|
|
48
|
+
"format.markdown.label": "Markdown",
|
|
49
|
+
"format.percent.label": "Percent",
|
|
50
|
+
"format.ref.label": "Reference",
|
|
51
|
+
"format.regex.label": "RegExp",
|
|
52
|
+
"format.string.label": "String",
|
|
53
|
+
"format.single-select.label": "Select",
|
|
54
|
+
"format.multi-select.label": "Multi-select",
|
|
55
|
+
"format.text.label": "Long text",
|
|
56
|
+
"format.time.label": "Time",
|
|
57
|
+
"format.timestamp.label": "Timestamp",
|
|
58
|
+
"format.user.label": "User",
|
|
59
|
+
"format.number.label": "Number",
|
|
60
|
+
"format.uri.label": "URI",
|
|
61
|
+
"format.url.label": "URL",
|
|
62
|
+
"format.uuid.label": "UUID",
|
|
63
63
|
// GeoPointField.
|
|
64
|
-
"latitude
|
|
65
|
-
"longitude
|
|
64
|
+
"latitude.label": "Latitude",
|
|
65
|
+
"longitude.label": "Longitude",
|
|
66
66
|
// SelectOptionsField.
|
|
67
|
-
"select
|
|
68
|
-
"select
|
|
69
|
-
"select
|
|
70
|
-
"select
|
|
71
|
-
"select option add": "Add option",
|
|
67
|
+
"select-option.label": "Label",
|
|
68
|
+
"select-option-label.placeholder": "Option label",
|
|
69
|
+
"select-option-delete.button": "Delete",
|
|
70
|
+
"select-option-add.button": "Add option",
|
|
72
71
|
// System schema message.
|
|
73
|
-
"system
|
|
74
|
-
"system
|
|
72
|
+
"system-schema.title": "System type",
|
|
73
|
+
"system-schema.description": "System type: cannot add or remove fields.",
|
|
74
|
+
"remove.button": "Remove"
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
];
|
|
79
79
|
|
|
80
|
-
// src/components/ControlSection/ControlSection.tsx
|
|
81
|
-
import React from "react";
|
|
82
|
-
import { Button, Input, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
83
|
-
import { Layout } from "@dxos/react-ui-mosaic";
|
|
84
|
-
import { mx } from "@dxos/ui-theme";
|
|
85
|
-
var ControlPage = ({ children, classNames, ...props }) => {
|
|
86
|
-
return /* @__PURE__ */ React.createElement(Layout.Container, {
|
|
87
|
-
scrollable: true,
|
|
88
|
-
classNames: "[--control-spacing:var(--dx-trimMd)]"
|
|
89
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
90
|
-
role: "none",
|
|
91
|
-
className: mx("pli-cardSpacingInline pbe-trimMd", classNames),
|
|
92
|
-
...props
|
|
93
|
-
}, children));
|
|
94
|
-
};
|
|
95
|
-
var ControlSection = ({ title, description, children }) => {
|
|
96
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ControlSectionHeading, {
|
|
97
|
-
title,
|
|
98
|
-
description
|
|
99
|
-
}), children);
|
|
100
|
-
};
|
|
101
|
-
var ControlSectionHeading = ({ title, description }) => {
|
|
102
|
-
const { t } = useTranslation(translationKey);
|
|
103
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", {
|
|
104
|
-
className: "pli-trimMd container-max-width text-xl mbs-trimMd mbe-trimMd"
|
|
105
|
-
}, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
|
|
106
|
-
className: "pli-trimMd mlb-trimMd container-max-width text-description"
|
|
107
|
-
}, toLocalizedString(description, t)));
|
|
108
|
-
};
|
|
109
|
-
var ControlGroupButton = ({ classNames, ...props }) => {
|
|
110
|
-
return /* @__PURE__ */ React.createElement(Button, {
|
|
111
|
-
...props,
|
|
112
|
-
classNames: [
|
|
113
|
-
"md:col-span-2",
|
|
114
|
-
classNames
|
|
115
|
-
]
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
var ControlGroup = ({ children, classNames }) => /* @__PURE__ */ React.createElement("div", {
|
|
119
|
-
role: "none",
|
|
120
|
-
className: mx("group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-trimMd", "[--control-spacing:0px] [&_input]:justify-self-end [&_button]:justify-self-end", classNames)
|
|
121
|
-
}, children);
|
|
122
|
-
var ControlFrame = ({ children }) => /* @__PURE__ */ React.createElement("div", {
|
|
123
|
-
role: "none",
|
|
124
|
-
className: mx("container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-trimSm md:gap-trimMd p-trimMd", "border border-separator rounded-md")
|
|
125
|
-
}, children);
|
|
126
|
-
var controlItemClasses = mx([
|
|
127
|
-
"container-max-width grid md:col-span-2 grid-cols-subgrid gap-trimSm items-center",
|
|
128
|
-
// TODO(burdon): Use grid gap consistently or apply margins consistently?
|
|
129
|
-
"mlb-[--control-spacing] *:first:!mbs-0 *:last:!mbe-0 pli-trimMd plb-trimMd",
|
|
130
|
-
"border border-separator rounded-md"
|
|
131
|
-
]);
|
|
132
|
-
var controlItemTitleClasses = "mbe-0 text-lg text-baseText font-normal";
|
|
133
|
-
var controlItemDescriptionClasses = "mlb-trimSm md:mbe-0 text-base text-description";
|
|
134
|
-
var ControlItem = ({ title, description, children }) => {
|
|
135
|
-
const { t } = useTranslation(translationKey);
|
|
136
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
137
|
-
className: controlItemClasses
|
|
138
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
139
|
-
role: "none"
|
|
140
|
-
}, /* @__PURE__ */ React.createElement("h3", {
|
|
141
|
-
className: controlItemTitleClasses
|
|
142
|
-
}, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
|
|
143
|
-
className: controlItemDescriptionClasses
|
|
144
|
-
}, toLocalizedString(description, t))), children);
|
|
145
|
-
};
|
|
146
|
-
var ControlItemInput = ({ title, description, children }) => {
|
|
147
|
-
const { t } = useTranslation(translationKey);
|
|
148
|
-
return /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
149
|
-
className: controlItemClasses
|
|
150
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
151
|
-
role: "none"
|
|
152
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, {
|
|
153
|
-
classNames: controlItemTitleClasses
|
|
154
|
-
}, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Description, {
|
|
155
|
-
classNames: controlItemDescriptionClasses
|
|
156
|
-
}, toLocalizedString(description, t)))), children));
|
|
157
|
-
};
|
|
158
|
-
var ControlFrameItem = ({ title, description, children }) => {
|
|
159
|
-
const { t } = useTranslation(translationKey);
|
|
160
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
161
|
-
role: "group",
|
|
162
|
-
className: "min-is-0"
|
|
163
|
-
}, /* @__PURE__ */ React.createElement("h3", {
|
|
164
|
-
className: "text-lg mbe-2"
|
|
165
|
-
}, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
|
|
166
|
-
className: "mlb-trimSm md:mbe-0 text-description"
|
|
167
|
-
}, toLocalizedString(description, t)), children);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
80
|
// src/components/FieldEditor/FieldEditor.tsx
|
|
171
|
-
import
|
|
172
|
-
import { Obj } from "@dxos/echo";
|
|
81
|
+
import React17, { useCallback as useCallback14, useEffect as useEffect6, useMemo as useMemo7, useState as useState5 } from "react";
|
|
82
|
+
import { Obj as Obj2 } from "@dxos/echo";
|
|
173
83
|
import { Format as Format4, FormatEnums, formatToType } from "@dxos/echo/internal";
|
|
174
84
|
import { log as log2 } from "@dxos/log";
|
|
175
|
-
import { useAsyncEffect, useTranslation as
|
|
85
|
+
import { useAsyncEffect, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
176
86
|
import { formatToAdditionalPropertyAttributes, getFormatSchema } from "@dxos/schema";
|
|
177
87
|
|
|
178
88
|
// src/util/field.ts
|
|
@@ -444,23 +354,28 @@ var getFormProperties = (ast) => {
|
|
|
444
354
|
|
|
445
355
|
// src/util/refs.ts
|
|
446
356
|
import { Ref } from "@dxos/echo";
|
|
447
|
-
import {
|
|
357
|
+
import { ReferenceAnnotationId } from "@dxos/echo/internal";
|
|
358
|
+
import { findAnnotation, getArrayElementType, isArrayType } from "@dxos/effect";
|
|
448
359
|
var getRefProps = (ast) => {
|
|
449
360
|
if (isArrayType(ast)) {
|
|
450
361
|
const elementType = getArrayElementType(ast);
|
|
451
362
|
if (elementType) {
|
|
452
363
|
if (Ref.isRefType(elementType)) {
|
|
364
|
+
const typename = findAnnotation(elementType, ReferenceAnnotationId)?.typename;
|
|
453
365
|
return {
|
|
454
366
|
ast: elementType,
|
|
455
|
-
isArray: true
|
|
367
|
+
isArray: true,
|
|
368
|
+
typename
|
|
456
369
|
};
|
|
457
370
|
}
|
|
458
371
|
}
|
|
459
372
|
}
|
|
460
373
|
if (Ref.isRefType(ast)) {
|
|
374
|
+
const typename = findAnnotation(ast, ReferenceAnnotationId)?.typename;
|
|
461
375
|
return {
|
|
462
376
|
ast,
|
|
463
|
-
isArray: false
|
|
377
|
+
isArray: false,
|
|
378
|
+
typename
|
|
464
379
|
};
|
|
465
380
|
}
|
|
466
381
|
return void 0;
|
|
@@ -468,23 +383,24 @@ var getRefProps = (ast) => {
|
|
|
468
383
|
|
|
469
384
|
// src/components/Form/fields/ArrayField.tsx
|
|
470
385
|
import * as Option3 from "effect/Option";
|
|
471
|
-
import * as
|
|
472
|
-
import
|
|
386
|
+
import * as SchemaAST3 from "effect/SchemaAST";
|
|
387
|
+
import React5, { useCallback as useCallback3 } from "react";
|
|
473
388
|
import { findNode as findNode2, getArrayElementType as getArrayElementType2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2, isNestedType as isNestedType2 } from "@dxos/effect";
|
|
474
|
-
import { IconButton as IconButton2, useTranslation as
|
|
389
|
+
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
475
390
|
|
|
476
391
|
// src/components/Form/Form.tsx
|
|
477
392
|
import { createContext } from "@radix-ui/react-context";
|
|
478
393
|
import * as Schema2 from "effect/Schema";
|
|
479
|
-
import
|
|
480
|
-
import {
|
|
481
|
-
import {
|
|
482
|
-
import {
|
|
394
|
+
import * as SchemaAST2 from "effect/SchemaAST";
|
|
395
|
+
import React4, { useEffect as useEffect2, useMemo as useMemo4, useRef } from "react";
|
|
396
|
+
import { createJsonPath as createJsonPath3, getValue as getValue$2 } from "@dxos/effect";
|
|
397
|
+
import { IconButton, ScrollArea, useMergeRefs, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
398
|
+
import { composable, composableProps, mx } from "@dxos/ui-theme";
|
|
483
399
|
|
|
484
400
|
// src/hooks/useFormHandler.ts
|
|
485
401
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
486
402
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
487
|
-
import { createJsonPath, fromEffectValidationPath, getValue as getValue
|
|
403
|
+
import { createJsonPath, fromEffectValidationPath, getValue as getValue$ } from "@dxos/effect";
|
|
488
404
|
import { log } from "@dxos/log";
|
|
489
405
|
import { useDefaultValue } from "@dxos/react-ui";
|
|
490
406
|
import { validateSchema } from "@dxos/schema";
|
|
@@ -499,11 +415,13 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
|
|
|
499
415
|
prop: valuesProp,
|
|
500
416
|
defaultProp: defaultValues,
|
|
501
417
|
onChange: () => {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
418
|
+
if (valuesProp !== void 0) {
|
|
419
|
+
setValues(valuesProp ?? defaultValues);
|
|
420
|
+
setChanged({});
|
|
421
|
+
setTouched({});
|
|
422
|
+
setErrors({});
|
|
423
|
+
setSaving(false);
|
|
424
|
+
}
|
|
507
425
|
}
|
|
508
426
|
});
|
|
509
427
|
const values = values$;
|
|
@@ -517,7 +435,7 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
|
|
|
517
435
|
errors: errors2
|
|
518
436
|
}, {
|
|
519
437
|
F: __dxlog_file,
|
|
520
|
-
L:
|
|
438
|
+
L: 155,
|
|
521
439
|
S: void 0,
|
|
522
440
|
C: (f, a) => f(...a)
|
|
523
441
|
});
|
|
@@ -610,11 +528,12 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
|
|
|
610
528
|
value: value3
|
|
611
529
|
}, {
|
|
612
530
|
F: __dxlog_file,
|
|
613
|
-
L:
|
|
531
|
+
L: 254,
|
|
614
532
|
S: void 0,
|
|
615
533
|
C: (f, a) => f(...a)
|
|
616
534
|
});
|
|
617
535
|
const jsonPath = createJsonPath(path);
|
|
536
|
+
const pathArray = path;
|
|
618
537
|
let parsedValue = value3;
|
|
619
538
|
try {
|
|
620
539
|
if (type._tag === "NumberKeyword") {
|
|
@@ -623,33 +542,33 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
|
|
|
623
542
|
} catch (err) {
|
|
624
543
|
log.catch(err, void 0, {
|
|
625
544
|
F: __dxlog_file,
|
|
626
|
-
L:
|
|
545
|
+
L: 264,
|
|
627
546
|
S: void 0,
|
|
628
547
|
C: (f, a) => f(...a)
|
|
629
548
|
});
|
|
630
549
|
parsedValue = void 0;
|
|
631
550
|
}
|
|
632
|
-
const newValues =
|
|
633
|
-
...setValue$(values, jsonPath, parsedValue)
|
|
634
|
-
};
|
|
635
|
-
setValues(newValues);
|
|
551
|
+
const newValues = mergeAtPath(values, pathArray, parsedValue);
|
|
636
552
|
const newChanged = {
|
|
637
553
|
[jsonPath]: true
|
|
638
554
|
};
|
|
639
|
-
setChanged({
|
|
640
|
-
...
|
|
555
|
+
setChanged((prev) => ({
|
|
556
|
+
...prev,
|
|
641
557
|
...newChanged
|
|
642
|
-
});
|
|
558
|
+
}));
|
|
643
559
|
const isValid2 = validate(newValues);
|
|
644
560
|
onValuesChanged?.(newValues, {
|
|
645
561
|
isValid: isValid2,
|
|
646
562
|
changed: newChanged
|
|
647
563
|
});
|
|
564
|
+
if (valuesProp === void 0) {
|
|
565
|
+
setValues(newValues);
|
|
566
|
+
}
|
|
648
567
|
}, [
|
|
649
568
|
values,
|
|
650
|
-
changed,
|
|
651
569
|
validate,
|
|
652
|
-
onValuesChanged
|
|
570
|
+
onValuesChanged,
|
|
571
|
+
valuesProp
|
|
653
572
|
]);
|
|
654
573
|
const onBlur = useCallback(async (path) => {
|
|
655
574
|
const jsonPath = createJsonPath(path);
|
|
@@ -706,6 +625,24 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
|
|
|
706
625
|
onCancel
|
|
707
626
|
]);
|
|
708
627
|
};
|
|
628
|
+
var mergeAtPath = (obj, path, value3) => {
|
|
629
|
+
if (path.length === 0) {
|
|
630
|
+
return value3;
|
|
631
|
+
}
|
|
632
|
+
const [head2, ...rest] = path;
|
|
633
|
+
const child = rest.length === 0 ? value3 : mergeAtPath(obj?.[head2], rest, value3);
|
|
634
|
+
if (Array.isArray(obj)) {
|
|
635
|
+
const copy = [
|
|
636
|
+
...obj
|
|
637
|
+
];
|
|
638
|
+
copy[head2] = child;
|
|
639
|
+
return copy;
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
...obj,
|
|
643
|
+
[head2]: child
|
|
644
|
+
};
|
|
645
|
+
};
|
|
709
646
|
var flatMap = (errors) => {
|
|
710
647
|
return errors.reduce((result, { path, message }) => {
|
|
711
648
|
const jsonPath = fromEffectValidationPath(path);
|
|
@@ -717,9 +654,9 @@ var flatMap = (errors) => {
|
|
|
717
654
|
};
|
|
718
655
|
|
|
719
656
|
// src/hooks/useKeyHandler.tsx
|
|
720
|
-
import { useCallback as useCallback2,
|
|
657
|
+
import { useCallback as useCallback2, useLayoutEffect } from "react";
|
|
721
658
|
import { addEventListener } from "@dxos/async";
|
|
722
|
-
var useKeyHandler = (
|
|
659
|
+
var useKeyHandler = (elRef, form) => {
|
|
723
660
|
const handleKeyDown = useCallback2((event) => {
|
|
724
661
|
switch (event.key) {
|
|
725
662
|
case "Enter": {
|
|
@@ -735,40 +672,37 @@ var useKeyHandler = (formElement, form) => {
|
|
|
735
672
|
form.onSave,
|
|
736
673
|
form.autoSave
|
|
737
674
|
]);
|
|
738
|
-
|
|
739
|
-
|
|
675
|
+
useLayoutEffect(() => {
|
|
676
|
+
const el = elRef.current;
|
|
677
|
+
if (!el) {
|
|
740
678
|
return;
|
|
741
679
|
}
|
|
742
|
-
return addEventListener(
|
|
680
|
+
return addEventListener(el, "keydown", handleKeyDown);
|
|
743
681
|
}, [
|
|
744
|
-
|
|
682
|
+
elRef,
|
|
745
683
|
handleKeyDown
|
|
746
684
|
]);
|
|
747
685
|
};
|
|
748
686
|
|
|
749
687
|
// src/components/Form/FormFieldComponent.tsx
|
|
750
|
-
import
|
|
751
|
-
import { Icon, Input
|
|
752
|
-
import {
|
|
753
|
-
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
688
|
+
import React, { Component } from "react";
|
|
689
|
+
import { Icon, Input, Tooltip } from "@dxos/react-ui";
|
|
690
|
+
import { inputTextLabel } from "@dxos/ui-theme";
|
|
754
691
|
var FormFieldLabel = ({ label, error, readonly, asChild }) => {
|
|
755
|
-
const Label = readonly || asChild ? "span" :
|
|
756
|
-
|
|
757
|
-
className: "text-description text-sm"
|
|
758
|
-
} : {
|
|
759
|
-
classNames: "!mlb-0 text-sm"
|
|
760
|
-
};
|
|
761
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
692
|
+
const Label = readonly || asChild ? "span" : Input.Label;
|
|
693
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
762
694
|
role: "none",
|
|
763
|
-
className:
|
|
764
|
-
}, /* @__PURE__ */
|
|
695
|
+
className: "flex items-center justify-between"
|
|
696
|
+
}, /* @__PURE__ */ React.createElement(Label, {
|
|
697
|
+
className: inputTextLabel
|
|
698
|
+
}, label), error && /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
765
699
|
asChild: true,
|
|
766
700
|
content: error,
|
|
767
701
|
side: "bottom"
|
|
768
|
-
}, /* @__PURE__ */
|
|
702
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
769
703
|
icon: "ph--warning--regular",
|
|
770
704
|
size: 4,
|
|
771
|
-
classNames:
|
|
705
|
+
classNames: "text-error-text"
|
|
772
706
|
})));
|
|
773
707
|
};
|
|
774
708
|
FormFieldLabel.displayName = "Form.FieldLabel";
|
|
@@ -780,15 +714,18 @@ var FormFieldWrapper = (props) => {
|
|
|
780
714
|
return null;
|
|
781
715
|
}
|
|
782
716
|
const str = String(value3 ?? "");
|
|
783
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
718
|
+
role: "none",
|
|
719
|
+
className: "contents"
|
|
720
|
+
}, /* @__PURE__ */ React.createElement(Input.Root, {
|
|
784
721
|
validationValence: status
|
|
785
|
-
}, layout !== "inline" && /* @__PURE__ */
|
|
722
|
+
}, layout !== "inline" && /* @__PURE__ */ React.createElement(FormFieldLabel, {
|
|
786
723
|
error,
|
|
787
724
|
readonly,
|
|
788
725
|
label
|
|
789
|
-
}), layout === "static" ? /* @__PURE__ */
|
|
726
|
+
}), layout === "static" ? /* @__PURE__ */ React.createElement("p", null, str) : children ? children({
|
|
790
727
|
value: value3
|
|
791
|
-
}) : null, layout === "full" && /* @__PURE__ */
|
|
728
|
+
}) : null, layout === "full" && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, error))));
|
|
792
729
|
};
|
|
793
730
|
var FormFieldErrorBoundary = class extends Component {
|
|
794
731
|
static getDerivedStateFromError(error) {
|
|
@@ -806,10 +743,10 @@ var FormFieldErrorBoundary = class extends Component {
|
|
|
806
743
|
}
|
|
807
744
|
render() {
|
|
808
745
|
if (this.state.error) {
|
|
809
|
-
return /* @__PURE__ */
|
|
810
|
-
className: "flex gap-2 border border-
|
|
811
|
-
}, /* @__PURE__ */
|
|
812
|
-
className: "bg-
|
|
746
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
747
|
+
className: "flex gap-2 border border-rose-fill font-mono text-sm"
|
|
748
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
749
|
+
className: "bg-rose-fill text-surface-text px-1 font-thin"
|
|
813
750
|
}, "ERROR"), String(this.props.path?.join(".")));
|
|
814
751
|
}
|
|
815
752
|
return this.props.children;
|
|
@@ -822,9 +759,7 @@ var FormFieldErrorBoundary = class extends Component {
|
|
|
822
759
|
};
|
|
823
760
|
|
|
824
761
|
// src/components/Form/FormFieldSet.tsx
|
|
825
|
-
import
|
|
826
|
-
import { mx as mx3 } from "@dxos/ui-theme";
|
|
827
|
-
import { isTruthy } from "@dxos/util";
|
|
762
|
+
import React3, { useMemo as useMemo3 } from "react";
|
|
828
763
|
|
|
829
764
|
// src/components/Form/FormField.tsx
|
|
830
765
|
import * as Match from "effect/Match";
|
|
@@ -832,10 +767,10 @@ import * as Option2 from "effect/Option";
|
|
|
832
767
|
import * as Schema from "effect/Schema";
|
|
833
768
|
import * as SchemaAST from "effect/SchemaAST";
|
|
834
769
|
import * as String2 from "effect/String";
|
|
835
|
-
import
|
|
770
|
+
import React2, { useMemo as useMemo2 } from "react";
|
|
836
771
|
import { Format as Format3 } from "@dxos/echo";
|
|
837
772
|
import { createJsonPath as createJsonPath2, findNode, getAnnotation, getDiscriminatedType, isArrayType as isArrayType2, isDiscriminatedUnion, isLiteralUnion, isNestedType } from "@dxos/effect";
|
|
838
|
-
import { useTranslation
|
|
773
|
+
import { useTranslation } from "@dxos/react-ui";
|
|
839
774
|
var FormField = (props) => {
|
|
840
775
|
const {
|
|
841
776
|
type,
|
|
@@ -847,15 +782,17 @@ var FormField = (props) => {
|
|
|
847
782
|
readonly,
|
|
848
783
|
layout,
|
|
849
784
|
// RefFieldProps
|
|
785
|
+
createTypename,
|
|
850
786
|
createOptionLabel,
|
|
851
787
|
createOptionIcon,
|
|
852
788
|
createInitialValuePath,
|
|
789
|
+
createFieldMap: createFieldMap3,
|
|
853
790
|
db,
|
|
854
791
|
schemaHook,
|
|
855
|
-
getOptions
|
|
792
|
+
getOptions,
|
|
856
793
|
onCreate
|
|
857
794
|
} = props;
|
|
858
|
-
const { t } =
|
|
795
|
+
const { t } = useTranslation(translationKey);
|
|
859
796
|
const title = getAnnotation(SchemaAST.TitleAnnotationId)(type);
|
|
860
797
|
const description = getAnnotation(SchemaAST.DescriptionAnnotationId)(type);
|
|
861
798
|
const examples = getAnnotation(SchemaAST.ExamplesAnnotationId)(type);
|
|
@@ -863,7 +800,7 @@ var FormField = (props) => {
|
|
|
863
800
|
title,
|
|
864
801
|
name
|
|
865
802
|
]);
|
|
866
|
-
const placeholder = useMemo2(() => examples?.length ? `${t("example
|
|
803
|
+
const placeholder = useMemo2(() => examples?.length ? `${t("example.placeholder")}: ${examples[0]}` : description ?? label, [
|
|
867
804
|
examples,
|
|
868
805
|
description,
|
|
869
806
|
label
|
|
@@ -881,7 +818,7 @@ var FormField = (props) => {
|
|
|
881
818
|
const jsonPath = createJsonPath2(path ?? []);
|
|
882
819
|
const CustomField = fieldMap?.[jsonPath];
|
|
883
820
|
if (CustomField) {
|
|
884
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ React2.createElement(CustomField, fieldProps);
|
|
885
822
|
}
|
|
886
823
|
const component = fieldProvider?.({
|
|
887
824
|
schema: Schema.make(type),
|
|
@@ -892,7 +829,7 @@ var FormField = (props) => {
|
|
|
892
829
|
return component;
|
|
893
830
|
}
|
|
894
831
|
if (isArrayType2(type)) {
|
|
895
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ React2.createElement(ArrayField, {
|
|
896
833
|
fieldProps: fieldState,
|
|
897
834
|
label,
|
|
898
835
|
...props
|
|
@@ -900,29 +837,37 @@ var FormField = (props) => {
|
|
|
900
837
|
}
|
|
901
838
|
const Field = getFormField(fieldProps);
|
|
902
839
|
if (Field) {
|
|
903
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ React2.createElement(Field, fieldProps);
|
|
904
841
|
}
|
|
905
|
-
const options =
|
|
842
|
+
const options = getSelectOptions(type);
|
|
906
843
|
if (options) {
|
|
907
|
-
|
|
844
|
+
const fieldProjections = projection?.getFieldProjections();
|
|
845
|
+
const fieldProjection = fieldProjections?.find((fp) => fp.field.path === name);
|
|
846
|
+
const selectOptions = fieldProjection?.props.options;
|
|
847
|
+
return /* @__PURE__ */ React2.createElement(SelectField, {
|
|
908
848
|
...fieldProps,
|
|
909
|
-
options: options.map((option) =>
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
849
|
+
options: options.map((option) => {
|
|
850
|
+
const selectOption = selectOptions?.find((so) => so.id === globalThis.String(option));
|
|
851
|
+
return {
|
|
852
|
+
value: option,
|
|
853
|
+
label: selectOption?.title ?? option.toString()
|
|
854
|
+
};
|
|
855
|
+
})
|
|
913
856
|
});
|
|
914
857
|
}
|
|
915
858
|
const refProps = getRefProps(type);
|
|
916
859
|
if (refProps) {
|
|
917
|
-
|
|
860
|
+
const isCreateTarget = !createTypename || refProps.typename === createTypename;
|
|
861
|
+
return /* @__PURE__ */ React2.createElement(RefField, {
|
|
918
862
|
...fieldProps,
|
|
919
863
|
...refProps,
|
|
920
|
-
createOptionLabel,
|
|
921
|
-
createOptionIcon,
|
|
922
|
-
createInitialValuePath,
|
|
864
|
+
createOptionLabel: isCreateTarget ? createOptionLabel : void 0,
|
|
865
|
+
createOptionIcon: isCreateTarget ? createOptionIcon : void 0,
|
|
866
|
+
createInitialValuePath: isCreateTarget ? createInitialValuePath : void 0,
|
|
867
|
+
createFieldMap: isCreateTarget ? createFieldMap3 : void 0,
|
|
923
868
|
db,
|
|
924
869
|
schemaHook,
|
|
925
|
-
getOptions
|
|
870
|
+
getOptions,
|
|
926
871
|
onCreate
|
|
927
872
|
});
|
|
928
873
|
}
|
|
@@ -931,7 +876,7 @@ var FormField = (props) => {
|
|
|
931
876
|
const typeLiteral = baseNode ? getDiscriminatedType(baseNode, fieldState.getValue()) : findNode(type, SchemaAST.isTypeLiteral);
|
|
932
877
|
if (typeLiteral) {
|
|
933
878
|
const schema = Schema.make(typeLiteral);
|
|
934
|
-
return /* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ React2.createElement(FormFieldSet, {
|
|
935
880
|
schema,
|
|
936
881
|
path,
|
|
937
882
|
readonly,
|
|
@@ -945,7 +890,7 @@ var FormField = (props) => {
|
|
|
945
890
|
createInitialValuePath,
|
|
946
891
|
db,
|
|
947
892
|
schemaHook,
|
|
948
|
-
getOptions
|
|
893
|
+
getOptions,
|
|
949
894
|
onCreate
|
|
950
895
|
});
|
|
951
896
|
}
|
|
@@ -969,7 +914,7 @@ var getFormField = ({ type, format }) => {
|
|
|
969
914
|
return BooleanField;
|
|
970
915
|
}
|
|
971
916
|
};
|
|
972
|
-
var
|
|
917
|
+
var getSelectOptions = (ast) => {
|
|
973
918
|
if (isLiteralUnion(ast)) {
|
|
974
919
|
return ast.types.map((type) => type.literal).filter((v) => v !== null);
|
|
975
920
|
}
|
|
@@ -977,58 +922,31 @@ var getOptions = (ast) => {
|
|
|
977
922
|
};
|
|
978
923
|
|
|
979
924
|
// src/components/Form/FormFieldSet.tsx
|
|
980
|
-
var
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
return [];
|
|
985
|
-
}
|
|
986
|
-
const props2 = getFormProperties(schema.ast);
|
|
987
|
-
if (projection) {
|
|
988
|
-
const fieldProjections = projection.getFieldProjections();
|
|
989
|
-
const hiddenProperties = new Set(projection.getHiddenProperties());
|
|
990
|
-
const visibleProps = props2.filter((prop) => !hiddenProperties.has(prop.name.toString()));
|
|
991
|
-
const orderedProps = [];
|
|
992
|
-
for (const fieldProjection of fieldProjections) {
|
|
993
|
-
const fieldPath = String(fieldProjection.field.path);
|
|
994
|
-
const prop = visibleProps.find((p) => p.name === fieldPath);
|
|
995
|
-
if (prop) {
|
|
996
|
-
orderedProps.push(prop);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
const projectionPaths = new Set(fieldProjections.map((projection2) => String(projection2.field.path)));
|
|
1000
|
-
const remainingProps = visibleProps.filter((prop) => !projectionPaths.has(prop.name.toString()));
|
|
1001
|
-
orderedProps.push(...remainingProps);
|
|
1002
|
-
return orderedProps;
|
|
1003
|
-
}
|
|
1004
|
-
const filtered = exclude ? exclude(props2) : props2;
|
|
1005
|
-
return sort ? filtered.sort(({ name: a }, { name: b }) => sort.indexOf(a.toString()) - sort.indexOf(b.toString())) : filtered;
|
|
1006
|
-
}, [
|
|
925
|
+
var FORM_FIELDSET_NAME = "Form.FieldSet";
|
|
926
|
+
var FormFieldSet = ({ label, schema, readonly, path, sort, exclude, projection, layout, ...props }) => {
|
|
927
|
+
const values = useFormValues(FORM_FIELDSET_NAME, path);
|
|
928
|
+
const properties = useFormFieldSetProperties({
|
|
1007
929
|
schema,
|
|
1008
930
|
values,
|
|
1009
931
|
exclude,
|
|
1010
932
|
sort,
|
|
1011
|
-
projection
|
|
1012
|
-
|
|
933
|
+
projection
|
|
934
|
+
});
|
|
1013
935
|
if ((readonly || layout === "static") && values == null) {
|
|
1014
936
|
return null;
|
|
1015
937
|
}
|
|
1016
|
-
return /* @__PURE__ */
|
|
1017
|
-
role: "form",
|
|
1018
|
-
className: mx3("is-full", layout === "inline" && "flex flex-col gap-2", classNames),
|
|
1019
|
-
ref: forwardRef4
|
|
1020
|
-
}, layout !== "inline" && label && /* @__PURE__ */ React4.createElement(FormFieldLabel, {
|
|
938
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, layout !== "inline" && label && /* @__PURE__ */ React3.createElement(FormFieldLabel, {
|
|
1021
939
|
label,
|
|
1022
940
|
asChild: true
|
|
1023
941
|
}), properties.map((property) => {
|
|
1024
942
|
const name = property.name.toString();
|
|
1025
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React3.createElement(FormFieldErrorBoundary, {
|
|
1026
944
|
key: name,
|
|
1027
945
|
path: [
|
|
1028
946
|
...path ?? [],
|
|
1029
947
|
name
|
|
1030
948
|
]
|
|
1031
|
-
}, /* @__PURE__ */
|
|
949
|
+
}, /* @__PURE__ */ React3.createElement(FormField, {
|
|
1032
950
|
type: property.type,
|
|
1033
951
|
name,
|
|
1034
952
|
path: [
|
|
@@ -1040,24 +958,67 @@ var FormFieldSet = /* @__PURE__ */ forwardRef(({ classNames, label, schema, read
|
|
|
1040
958
|
projection,
|
|
1041
959
|
...props
|
|
1042
960
|
}));
|
|
1043
|
-
})
|
|
1044
|
-
}
|
|
1045
|
-
FormFieldSet.displayName =
|
|
961
|
+
}));
|
|
962
|
+
};
|
|
963
|
+
FormFieldSet.displayName = FORM_FIELDSET_NAME;
|
|
964
|
+
var useFormFieldSetProperties = ({ schema, exclude, projection, values, sort }) => {
|
|
965
|
+
return useMemo3(() => {
|
|
966
|
+
if (!schema) {
|
|
967
|
+
return [];
|
|
968
|
+
}
|
|
969
|
+
const schemaProps = getFormProperties(schema.ast);
|
|
970
|
+
const filteredProps = exclude ? exclude(schemaProps) : schemaProps;
|
|
971
|
+
if (projection) {
|
|
972
|
+
const fieldProjections = projection.getFieldProjections();
|
|
973
|
+
const hiddenProperties = new Set(projection.getHiddenProperties());
|
|
974
|
+
const visibleProps = filteredProps.filter((prop) => !hiddenProperties.has(prop.name.toString()));
|
|
975
|
+
const orderedProps = [];
|
|
976
|
+
for (const fieldProjection of fieldProjections) {
|
|
977
|
+
const fieldPath = String(fieldProjection.field.path);
|
|
978
|
+
const prop = visibleProps.find((prop2) => prop2.name === fieldPath);
|
|
979
|
+
if (prop) {
|
|
980
|
+
orderedProps.push(prop);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const projectionPaths = new Set(fieldProjections.map((projection2) => String(projection2.field.path)));
|
|
984
|
+
const remainingProps = visibleProps.filter((prop) => !projectionPaths.has(prop.name.toString()));
|
|
985
|
+
orderedProps.push(...remainingProps);
|
|
986
|
+
return orderedProps;
|
|
987
|
+
}
|
|
988
|
+
return sort ? [
|
|
989
|
+
...filteredProps
|
|
990
|
+
].sort(({ name: a }, { name: b }) => sort.indexOf(a.toString()) - sort.indexOf(b.toString())) : filteredProps;
|
|
991
|
+
}, [
|
|
992
|
+
schema,
|
|
993
|
+
values,
|
|
994
|
+
exclude,
|
|
995
|
+
sort,
|
|
996
|
+
projection
|
|
997
|
+
]);
|
|
998
|
+
};
|
|
1046
999
|
|
|
1047
1000
|
// src/components/Form/Form.tsx
|
|
1048
1001
|
var omitId = (schema) => schema.pipe(Schema2.omit("id"));
|
|
1049
1002
|
var [FormContextProvider, useFormContext] = createContext("Form");
|
|
1050
|
-
var useFormValues = (componentName, path
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1003
|
+
var useFormValues = (componentName, path, defaultValue) => {
|
|
1004
|
+
const stablePath = useMemo4(() => path ?? [], [
|
|
1005
|
+
path ? path.join(".") : void 0
|
|
1006
|
+
]);
|
|
1007
|
+
const jsonPath = createJsonPath3(stablePath);
|
|
1008
|
+
const { form: { values, onValueChange } } = useFormContext(componentName);
|
|
1053
1009
|
const value3 = getValue$2(values, jsonPath);
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1010
|
+
const lastAppliedPathRef = useRef(null);
|
|
1011
|
+
useEffect2(() => {
|
|
1012
|
+
if (value3 == null && defaultValue && lastAppliedPathRef.current !== jsonPath) {
|
|
1013
|
+
lastAppliedPathRef.current = jsonPath;
|
|
1014
|
+
onValueChange(stablePath, SchemaAST2.stringKeyword, defaultValue());
|
|
1057
1015
|
}
|
|
1058
1016
|
}, [
|
|
1059
1017
|
value3,
|
|
1060
|
-
defaultValue
|
|
1018
|
+
defaultValue,
|
|
1019
|
+
onValueChange,
|
|
1020
|
+
stablePath,
|
|
1021
|
+
jsonPath
|
|
1061
1022
|
]);
|
|
1062
1023
|
return value3;
|
|
1063
1024
|
};
|
|
@@ -1087,116 +1048,142 @@ var FormRoot = ({ children, schema, values, onSave, onCancel, ...props }) => {
|
|
|
1087
1048
|
onCancel,
|
|
1088
1049
|
...props
|
|
1089
1050
|
});
|
|
1090
|
-
return /* @__PURE__ */
|
|
1051
|
+
return /* @__PURE__ */ React4.createElement(FormContextProvider, {
|
|
1091
1052
|
form,
|
|
1092
1053
|
...props
|
|
1093
1054
|
}, children);
|
|
1094
1055
|
};
|
|
1095
1056
|
FormRoot.displayName = "Form.Root";
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1057
|
+
var FORM_VIEWPORT_NAME = "Form.Viewport";
|
|
1058
|
+
var FormViewport = composable(({ children, ...props }, forwardedRef) => {
|
|
1059
|
+
return /* @__PURE__ */ React4.createElement(ScrollArea.Root, {
|
|
1060
|
+
...composableProps(props),
|
|
1061
|
+
orientation: "vertical",
|
|
1062
|
+
centered: true,
|
|
1063
|
+
padding: true,
|
|
1064
|
+
thin: true,
|
|
1065
|
+
ref: forwardedRef
|
|
1066
|
+
}, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, children));
|
|
1067
|
+
});
|
|
1068
|
+
FormViewport.displayName = FORM_VIEWPORT_NAME;
|
|
1069
|
+
var FORM_CONTENT_NAME = "Form.Content";
|
|
1070
|
+
var FormContent = composable(({ children, ...props }, forwardedRef) => {
|
|
1071
|
+
const { form, testId } = useFormContext(FORM_CONTENT_NAME);
|
|
1072
|
+
const localRef = useRef(null);
|
|
1073
|
+
const mergedRef = useMergeRefs([
|
|
1074
|
+
forwardedRef,
|
|
1075
|
+
localRef
|
|
1076
|
+
]);
|
|
1077
|
+
useKeyHandler(localRef, form);
|
|
1078
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1079
|
+
...composableProps(props, {
|
|
1080
|
+
role: "form",
|
|
1081
|
+
classNames: "flex flex-col w-full pb-form-gap"
|
|
1082
|
+
}),
|
|
1083
|
+
"data-testid": testId,
|
|
1084
|
+
ref: mergedRef
|
|
1116
1085
|
}, children);
|
|
1117
|
-
};
|
|
1118
|
-
FormContent.displayName =
|
|
1119
|
-
var
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1086
|
+
});
|
|
1087
|
+
FormContent.displayName = FORM_CONTENT_NAME;
|
|
1088
|
+
var FORM_FIELDSET_NAME2 = "Form.FieldSet";
|
|
1089
|
+
var FormFieldSet2 = (props) => {
|
|
1090
|
+
const { form, ...contextProps } = useFormContext(FORM_FIELDSET_NAME2);
|
|
1091
|
+
return /* @__PURE__ */ React4.createElement(FormFieldSet, {
|
|
1123
1092
|
schema: form.schema,
|
|
1093
|
+
...contextProps,
|
|
1124
1094
|
...props
|
|
1125
1095
|
});
|
|
1126
1096
|
};
|
|
1127
|
-
FormFieldSet2.displayName =
|
|
1097
|
+
FormFieldSet2.displayName = FORM_FIELDSET_NAME2;
|
|
1098
|
+
var FORM_ACTIONS_NAME = "Form.Actions";
|
|
1128
1099
|
var FormActions = ({ classNames }) => {
|
|
1129
|
-
const { t } =
|
|
1130
|
-
const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(
|
|
1100
|
+
const { t } = useTranslation2(translationKey);
|
|
1101
|
+
const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(FORM_ACTIONS_NAME);
|
|
1131
1102
|
if (readonly || layout === "static") {
|
|
1132
1103
|
return null;
|
|
1133
1104
|
}
|
|
1134
|
-
return /* @__PURE__ */
|
|
1105
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1135
1106
|
role: "none",
|
|
1136
|
-
className:
|
|
1137
|
-
}, onCancel && /* @__PURE__ */
|
|
1107
|
+
className: mx("grid grid-flow-col gap-form-gap auto-cols-fr py-form-padding", classNames)
|
|
1108
|
+
}, onCancel && /* @__PURE__ */ React4.createElement(IconButton, {
|
|
1138
1109
|
icon: "ph--x--regular",
|
|
1139
1110
|
iconEnd: true,
|
|
1140
|
-
label: t("cancel
|
|
1111
|
+
label: t("cancel-button.label"),
|
|
1141
1112
|
onClick: onCancel,
|
|
1142
1113
|
"data-testid": "cancel-button"
|
|
1143
|
-
}), onSave && /* @__PURE__ */
|
|
1114
|
+
}), onSave && /* @__PURE__ */ React4.createElement(IconButton, {
|
|
1144
1115
|
type: "submit",
|
|
1145
1116
|
variant: "primary",
|
|
1146
1117
|
disabled: !canSave,
|
|
1147
1118
|
icon: "ph--check--regular",
|
|
1148
1119
|
iconEnd: true,
|
|
1149
|
-
label: t("save
|
|
1120
|
+
label: t("save-button.label"),
|
|
1150
1121
|
onClick: onSave,
|
|
1151
1122
|
"data-testid": "save-button"
|
|
1152
1123
|
}));
|
|
1153
1124
|
};
|
|
1154
|
-
FormActions.displayName =
|
|
1155
|
-
var
|
|
1156
|
-
|
|
1157
|
-
|
|
1125
|
+
FormActions.displayName = FORM_ACTIONS_NAME;
|
|
1126
|
+
var FORM_SECTION_NAME = "Form.Section";
|
|
1127
|
+
var FormSection = composable(({ children, label, description, ...props }, forwardedRef) => {
|
|
1128
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1129
|
+
...composableProps(props, {
|
|
1130
|
+
classNames: "flex flex-col pt-form-section-gap first:pt-0"
|
|
1131
|
+
}),
|
|
1132
|
+
ref: forwardedRef
|
|
1133
|
+
}, /* @__PURE__ */ React4.createElement("h2", {
|
|
1134
|
+
className: "text-lg"
|
|
1135
|
+
}, label), description && /* @__PURE__ */ React4.createElement("p", {
|
|
1136
|
+
className: "text-description"
|
|
1137
|
+
}, description), children);
|
|
1138
|
+
});
|
|
1139
|
+
FormSection.displayName = FORM_SECTION_NAME;
|
|
1140
|
+
var FORM_SUBMIT_NAME = "Form.Submit";
|
|
1141
|
+
var FormSubmit = ({ classNames, label, icon, disabled }) => {
|
|
1142
|
+
const { t } = useTranslation2(translationKey);
|
|
1143
|
+
const { form: { canSave, onSave }, readonly, layout } = useFormContext(FORM_SUBMIT_NAME);
|
|
1158
1144
|
if (readonly || layout === "static") {
|
|
1159
1145
|
return null;
|
|
1160
1146
|
}
|
|
1161
|
-
return /* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1162
1148
|
role: "none",
|
|
1163
|
-
className:
|
|
1164
|
-
}, /* @__PURE__ */
|
|
1165
|
-
classNames: "
|
|
1149
|
+
className: mx("flex w-full pt-form-padding", classNames)
|
|
1150
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
1151
|
+
classNames: "w-full",
|
|
1166
1152
|
type: "submit",
|
|
1167
1153
|
variant: "primary",
|
|
1168
|
-
disabled: !canSave,
|
|
1154
|
+
disabled: disabled ?? !canSave,
|
|
1169
1155
|
icon: icon ?? "ph--check--regular",
|
|
1170
|
-
label: label ?? t("save
|
|
1156
|
+
label: label ?? t("save-button.label"),
|
|
1171
1157
|
onClick: onSave,
|
|
1172
1158
|
"data-testid": "save-button"
|
|
1173
1159
|
}));
|
|
1174
1160
|
};
|
|
1175
|
-
FormSubmit.displayName =
|
|
1161
|
+
FormSubmit.displayName = FORM_SUBMIT_NAME;
|
|
1176
1162
|
var Form = {
|
|
1177
1163
|
Root: FormRoot,
|
|
1178
1164
|
Viewport: FormViewport,
|
|
1179
1165
|
Content: FormContent,
|
|
1166
|
+
Section: FormSection,
|
|
1180
1167
|
FieldSet: FormFieldSet2,
|
|
1168
|
+
Label: FormFieldLabel,
|
|
1181
1169
|
Actions: FormActions,
|
|
1182
|
-
Submit: FormSubmit
|
|
1183
|
-
Label: FormFieldLabel
|
|
1170
|
+
Submit: FormSubmit
|
|
1184
1171
|
};
|
|
1185
1172
|
|
|
1186
1173
|
// src/components/Form/fields/ArrayField.tsx
|
|
1187
1174
|
var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps, ...props }) => {
|
|
1188
|
-
const { t } =
|
|
1175
|
+
const { t } = useTranslation3(translationKey);
|
|
1189
1176
|
const elementType = getArrayElementType2(type);
|
|
1190
1177
|
const { onValueChange } = inputProps;
|
|
1191
1178
|
const values = useFormValues(ArrayField.displayName, path, () => []);
|
|
1192
1179
|
const getDefaultObjectValue = (typeNode) => {
|
|
1193
1180
|
const baseNode = findNode2(typeNode, isDiscriminatedUnion2);
|
|
1194
|
-
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode,
|
|
1181
|
+
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode, SchemaAST3.isTypeLiteral);
|
|
1195
1182
|
if (!typeLiteral) {
|
|
1196
1183
|
return {};
|
|
1197
1184
|
}
|
|
1198
1185
|
return Object.fromEntries(getFormProperties(typeLiteral).map((prop) => {
|
|
1199
|
-
const defaultValue =
|
|
1186
|
+
const defaultValue = SchemaAST3.getDefaultAnnotation(prop.type).pipe((annotation) => Option3.getOrUndefined(annotation));
|
|
1200
1187
|
return [
|
|
1201
1188
|
prop.name,
|
|
1202
1189
|
defaultValue
|
|
@@ -1225,19 +1212,19 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
|
|
|
1225
1212
|
if (!elementType || (readonly || layout === "static") && values && values.length < 1) {
|
|
1226
1213
|
return null;
|
|
1227
1214
|
}
|
|
1228
|
-
return /* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, (layout !== "static" || values && values.length > 0) && /* @__PURE__ */ React5.createElement(FormFieldLabel, {
|
|
1229
1216
|
readonly,
|
|
1230
1217
|
label,
|
|
1231
1218
|
asChild: true
|
|
1232
|
-
}), /* @__PURE__ */
|
|
1219
|
+
}), /* @__PURE__ */ React5.createElement("div", {
|
|
1233
1220
|
role: "none",
|
|
1234
|
-
className: "flex flex-col gap-
|
|
1221
|
+
className: "flex flex-col gap-form-gap"
|
|
1235
1222
|
}, values?.map((_, index) => {
|
|
1236
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
1237
1224
|
role: "none",
|
|
1238
1225
|
key: index,
|
|
1239
|
-
className: "
|
|
1240
|
-
}, /* @__PURE__ */
|
|
1226
|
+
className: "flex gap-form-gap last:mb-form-gap items-center"
|
|
1227
|
+
}, /* @__PURE__ */ React5.createElement(FormField, {
|
|
1241
1228
|
autoFocus: index === values.length - 1,
|
|
1242
1229
|
type: elementType,
|
|
1243
1230
|
path: [
|
|
@@ -1247,23 +1234,23 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
|
|
|
1247
1234
|
readonly: readonly || layout === "static",
|
|
1248
1235
|
layout: "inline",
|
|
1249
1236
|
...props
|
|
1250
|
-
}), !readonly && layout !== "static" && /* @__PURE__ */
|
|
1237
|
+
}), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement("div", {
|
|
1251
1238
|
role: "none",
|
|
1252
|
-
className: "flex flex-col
|
|
1253
|
-
}, /* @__PURE__ */
|
|
1239
|
+
className: "flex flex-col h-full justify-end"
|
|
1240
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
1254
1241
|
role: "none",
|
|
1255
|
-
className: "flex items-center
|
|
1256
|
-
}, /* @__PURE__ */
|
|
1242
|
+
className: "flex items-center h-[2rem]"
|
|
1243
|
+
}, /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
1257
1244
|
icon: "ph--x--regular",
|
|
1258
1245
|
iconOnly: true,
|
|
1259
|
-
label: t("button
|
|
1246
|
+
label: t("remove.button"),
|
|
1260
1247
|
onClick: () => handleDelete(index),
|
|
1261
1248
|
classNames: "self-center"
|
|
1262
1249
|
}))));
|
|
1263
|
-
})), !readonly && layout !== "static" && /* @__PURE__ */
|
|
1264
|
-
classNames: "flex
|
|
1250
|
+
})), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
1251
|
+
classNames: "flex w-full",
|
|
1265
1252
|
icon: "ph--plus--regular",
|
|
1266
|
-
label: t("add
|
|
1253
|
+
label: t("add-field.button"),
|
|
1267
1254
|
onClick: handleAdd
|
|
1268
1255
|
}));
|
|
1269
1256
|
};
|
|
@@ -1279,6 +1266,9 @@ var getDefaultValue = (ast) => {
|
|
|
1279
1266
|
case "BooleanKeyword": {
|
|
1280
1267
|
return false;
|
|
1281
1268
|
}
|
|
1269
|
+
case "Suspend": {
|
|
1270
|
+
return getDefaultValue(ast.f());
|
|
1271
|
+
}
|
|
1282
1272
|
default: {
|
|
1283
1273
|
if (ast && isNestedType2(ast)) {
|
|
1284
1274
|
return {};
|
|
@@ -1290,17 +1280,17 @@ var getDefaultValue = (ast) => {
|
|
|
1290
1280
|
};
|
|
1291
1281
|
|
|
1292
1282
|
// src/components/Form/fields/BooleanField.tsx
|
|
1293
|
-
import
|
|
1294
|
-
import { Input as
|
|
1283
|
+
import React6, { useCallback as useCallback4 } from "react";
|
|
1284
|
+
import { Input as Input2 } from "@dxos/react-ui";
|
|
1295
1285
|
var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
|
|
1296
1286
|
const handleChange = useCallback4((value3) => onValueChange?.(type, value3), [
|
|
1297
1287
|
type,
|
|
1298
1288
|
onValueChange
|
|
1299
1289
|
]);
|
|
1300
|
-
return /* @__PURE__ */
|
|
1290
|
+
return /* @__PURE__ */ React6.createElement(FormFieldWrapper, {
|
|
1301
1291
|
readonly,
|
|
1302
1292
|
...props
|
|
1303
|
-
}, ({ value: value3 }) => /* @__PURE__ */
|
|
1293
|
+
}, ({ value: value3 }) => /* @__PURE__ */ React6.createElement(Input2.Switch, {
|
|
1304
1294
|
disabled: !!readonly,
|
|
1305
1295
|
checked: value3,
|
|
1306
1296
|
onCheckedChange: handleChange
|
|
@@ -1308,12 +1298,12 @@ var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
|
|
|
1308
1298
|
};
|
|
1309
1299
|
|
|
1310
1300
|
// src/components/Form/fields/GeoPointField.tsx
|
|
1311
|
-
import
|
|
1301
|
+
import React7, { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo5, useState as useState2 } from "react";
|
|
1312
1302
|
import { GeoLocation as GeoLocation3 } from "@dxos/echo/internal";
|
|
1313
|
-
import { Input as
|
|
1303
|
+
import { Input as Input3, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
1314
1304
|
import { safeParseFloat } from "@dxos/util";
|
|
1315
1305
|
var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onValueChange, onBlur }) => {
|
|
1316
|
-
const { t } =
|
|
1306
|
+
const { t } = useTranslation4(translationKey);
|
|
1317
1307
|
const { status, error } = getStatus();
|
|
1318
1308
|
const geoPoint = useMemo5(() => getValue() ?? [
|
|
1319
1309
|
0,
|
|
@@ -1326,7 +1316,7 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
|
|
|
1326
1316
|
]);
|
|
1327
1317
|
const [longitudeText, setLongitudeText] = useState2(value3.longitude?.toString());
|
|
1328
1318
|
const [latitudeText, setLatitudeText] = useState2(value3.latitude?.toString());
|
|
1329
|
-
|
|
1319
|
+
useEffect3(() => {
|
|
1330
1320
|
const location = GeoLocation3.fromGeoPoint(geoPoint);
|
|
1331
1321
|
setLongitudeText(location.longitude?.toString());
|
|
1332
1322
|
setLatitudeText(location.latitude?.toString());
|
|
@@ -1359,33 +1349,33 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
|
|
|
1359
1349
|
if ((readonly || layout === "static") && !value3?.latitude && !value3?.longitude) {
|
|
1360
1350
|
return null;
|
|
1361
1351
|
}
|
|
1362
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ React7.createElement(Input3.Root, {
|
|
1363
1353
|
validationValence: status
|
|
1364
|
-
}, layout !== "inline" && /* @__PURE__ */
|
|
1354
|
+
}, layout !== "inline" && /* @__PURE__ */ React7.createElement(FormFieldLabel, {
|
|
1365
1355
|
error,
|
|
1366
1356
|
readonly,
|
|
1367
1357
|
label,
|
|
1368
1358
|
asChild: true
|
|
1369
|
-
}), layout === "static" ? /* @__PURE__ */
|
|
1359
|
+
}), layout === "static" ? /* @__PURE__ */ React7.createElement(LatLng, value3) : /* @__PURE__ */ React7.createElement("div", {
|
|
1370
1360
|
role: "none",
|
|
1371
|
-
className: "grid grid-cols-2 gap-
|
|
1372
|
-
}, /* @__PURE__ */
|
|
1361
|
+
className: "grid grid-cols-2 gap-form-gap"
|
|
1362
|
+
}, /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement(Input3.Root, null, layout !== "inline" && /* @__PURE__ */ React7.createElement(Input3.Label, null, t("latitude.label")), /* @__PURE__ */ React7.createElement(Input3.TextInput, {
|
|
1373
1363
|
type: "number",
|
|
1374
1364
|
step: "0.00001",
|
|
1375
1365
|
min: "-90",
|
|
1376
1366
|
max: "90",
|
|
1377
1367
|
disabled: !!readonly,
|
|
1378
|
-
placeholder: t("latitude
|
|
1368
|
+
placeholder: t("latitude.placeholder"),
|
|
1379
1369
|
value: latitudeText ?? "",
|
|
1380
1370
|
onChange: handleChange("latitude", setLatitudeText),
|
|
1381
1371
|
onBlur
|
|
1382
|
-
}))), /* @__PURE__ */
|
|
1372
|
+
}))), /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement(Input3.Root, null, layout !== "inline" && /* @__PURE__ */ React7.createElement(Input3.Label, null, t("longitude.label")), /* @__PURE__ */ React7.createElement(Input3.TextInput, {
|
|
1383
1373
|
type: "number",
|
|
1384
1374
|
step: "0.00001",
|
|
1385
1375
|
min: "-180",
|
|
1386
1376
|
max: "180",
|
|
1387
1377
|
disabled: !!readonly,
|
|
1388
|
-
placeholder: t("longitude
|
|
1378
|
+
placeholder: t("longitude.placeholder"),
|
|
1389
1379
|
value: longitudeText ?? "",
|
|
1390
1380
|
onChange: handleChange("longitude", setLongitudeText),
|
|
1391
1381
|
onBlur
|
|
@@ -1394,18 +1384,18 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
|
|
|
1394
1384
|
var LatLng = ({ latitude = 0, longitude = 0 }) => {
|
|
1395
1385
|
const latHem = latitude >= 0 ? "N" : "S";
|
|
1396
1386
|
const lngHem = longitude >= 0 ? "E" : "W";
|
|
1397
|
-
return /* @__PURE__ */
|
|
1398
|
-
className: "inline-flex items-center gap-
|
|
1399
|
-
}, /* @__PURE__ */
|
|
1387
|
+
return /* @__PURE__ */ React7.createElement("span", {
|
|
1388
|
+
className: "inline-flex items-center gap-form-gap"
|
|
1389
|
+
}, /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(latitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
|
|
1400
1390
|
className: "text-subdued"
|
|
1401
|
-
}, "\xB0", latHem)), /* @__PURE__ */
|
|
1391
|
+
}, "\xB0", latHem)), /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(longitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
|
|
1402
1392
|
className: "text-subdued"
|
|
1403
1393
|
}, "\xB0", lngHem)));
|
|
1404
1394
|
};
|
|
1405
1395
|
|
|
1406
1396
|
// src/components/Form/fields/MarkdownField.tsx
|
|
1407
|
-
import
|
|
1408
|
-
import { Input as
|
|
1397
|
+
import React8, { useCallback as useCallback6, useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
1398
|
+
import { Input as Input4 } from "@dxos/react-ui";
|
|
1409
1399
|
var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, getValue, onValueChange, onBlur }) => {
|
|
1410
1400
|
const { status, error } = getStatus();
|
|
1411
1401
|
const textareaRef = useRef2(null);
|
|
@@ -1416,12 +1406,12 @@ var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, ge
|
|
|
1416
1406
|
textarea.style.blockSize = `${textarea.scrollHeight + 2}px`;
|
|
1417
1407
|
}
|
|
1418
1408
|
}, []);
|
|
1419
|
-
|
|
1409
|
+
useEffect4(() => {
|
|
1420
1410
|
adjustHeight();
|
|
1421
1411
|
}, [
|
|
1422
1412
|
adjustHeight
|
|
1423
1413
|
]);
|
|
1424
|
-
|
|
1414
|
+
useEffect4(() => {
|
|
1425
1415
|
adjustHeight();
|
|
1426
1416
|
}, [
|
|
1427
1417
|
getValue(),
|
|
@@ -1435,40 +1425,40 @@ var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, ge
|
|
|
1435
1425
|
if ((readonly || layout === "static") && !value3) {
|
|
1436
1426
|
return null;
|
|
1437
1427
|
}
|
|
1438
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ React8.createElement(Input4.Root, {
|
|
1439
1429
|
validationValence: status
|
|
1440
|
-
}, layout !== "inline" && /* @__PURE__ */
|
|
1430
|
+
}, layout !== "inline" && /* @__PURE__ */ React8.createElement(FormFieldLabel, {
|
|
1441
1431
|
error,
|
|
1442
1432
|
readonly,
|
|
1443
1433
|
label
|
|
1444
|
-
}), layout === "static" ? /* @__PURE__ */
|
|
1434
|
+
}), layout === "static" ? /* @__PURE__ */ React8.createElement("p", null, value3) : /* @__PURE__ */ React8.createElement(Input4.TextArea, {
|
|
1445
1435
|
ref: textareaRef,
|
|
1446
1436
|
disabled: !!readonly,
|
|
1447
1437
|
placeholder,
|
|
1448
1438
|
value: value3 ?? "",
|
|
1449
|
-
classNames: "min-
|
|
1439
|
+
classNames: "min-h-auto max-h-40 overflow-auto",
|
|
1450
1440
|
onChange: handleChange,
|
|
1451
1441
|
onBlur,
|
|
1452
1442
|
style: {
|
|
1453
1443
|
resize: "none"
|
|
1454
1444
|
},
|
|
1455
1445
|
spellCheck: false
|
|
1456
|
-
}), layout === "full" && /* @__PURE__ */
|
|
1446
|
+
}), layout === "full" && /* @__PURE__ */ React8.createElement(Input4.Validation, null, error));
|
|
1457
1447
|
};
|
|
1458
1448
|
|
|
1459
1449
|
// src/components/Form/fields/NumberField.tsx
|
|
1460
|
-
import
|
|
1461
|
-
import { Input as
|
|
1450
|
+
import React9, { useCallback as useCallback7 } from "react";
|
|
1451
|
+
import { Input as Input5 } from "@dxos/react-ui";
|
|
1462
1452
|
import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
|
|
1463
1453
|
var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
|
|
1464
1454
|
const handleChange = useCallback7((event) => onValueChange(type, safeParseFloat2(event.target.value) || 0), [
|
|
1465
1455
|
type,
|
|
1466
1456
|
onValueChange
|
|
1467
1457
|
]);
|
|
1468
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ React9.createElement(FormFieldWrapper, {
|
|
1469
1459
|
readonly,
|
|
1470
1460
|
...props
|
|
1471
|
-
}, ({ value: value3 = "" }) => /* @__PURE__ */
|
|
1461
|
+
}, ({ value: value3 = "" }) => /* @__PURE__ */ React9.createElement(Input5.TextInput, {
|
|
1472
1462
|
type: "number",
|
|
1473
1463
|
disabled: !!readonly,
|
|
1474
1464
|
placeholder,
|
|
@@ -1479,40 +1469,24 @@ var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...prop
|
|
|
1479
1469
|
};
|
|
1480
1470
|
|
|
1481
1471
|
// src/components/Form/fields/RefField.tsx
|
|
1472
|
+
import React11, { useCallback as useCallback9, useMemo as useMemo6 } from "react";
|
|
1482
1473
|
import "@dxos/lit-ui/dx-tag-picker.pcss";
|
|
1483
|
-
import
|
|
1484
|
-
import { Entity, Filter, Ref as Ref2 } from "@dxos/echo";
|
|
1485
|
-
import { ReferenceAnnotationId } from "@dxos/echo/internal";
|
|
1474
|
+
import { Entity, Filter, Obj, Ref as Ref2, Type } from "@dxos/echo";
|
|
1486
1475
|
import { useQuery, useSchema as useSchema$ } from "@dxos/echo-react";
|
|
1487
|
-
import {
|
|
1476
|
+
import { ReferenceAnnotationId as ReferenceAnnotationId2 } from "@dxos/echo/internal";
|
|
1477
|
+
import { findAnnotation as findAnnotation2 } from "@dxos/effect";
|
|
1488
1478
|
import { DXN } from "@dxos/keys";
|
|
1489
1479
|
import { DxAnchor } from "@dxos/lit-ui/react";
|
|
1490
|
-
import { Button
|
|
1491
|
-
import {
|
|
1480
|
+
import { Button, Icon as Icon2, Input as Input6, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
1481
|
+
import { ParentLabelAnnotationId } from "@dxos/schema";
|
|
1482
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
1492
1483
|
|
|
1493
1484
|
// src/components/ObjectPicker/ObjectPicker.tsx
|
|
1494
|
-
import
|
|
1495
|
-
import { Popover, useTranslation as
|
|
1496
|
-
import { Combobox, useSearchListInput, useSearchListResults } from "@dxos/react-ui-
|
|
1497
|
-
var
|
|
1498
|
-
const { t } =
|
|
1499
|
-
const { query } = useSearchListInput();
|
|
1500
|
-
return /* @__PURE__ */ React11.createElement(Combobox.Item, {
|
|
1501
|
-
value: "__create__",
|
|
1502
|
-
label: t(createOptionLabel[0], {
|
|
1503
|
-
ns: createOptionLabel[1].ns,
|
|
1504
|
-
text: query
|
|
1505
|
-
}),
|
|
1506
|
-
icon: createOptionIcon,
|
|
1507
|
-
classNames: "flex items-center gap-2",
|
|
1508
|
-
closeOnSelect: false,
|
|
1509
|
-
onSelect: () => {
|
|
1510
|
-
onCreateItemSelect(query);
|
|
1511
|
-
}
|
|
1512
|
-
});
|
|
1513
|
-
};
|
|
1514
|
-
var ObjectPickerContent = /* @__PURE__ */ forwardRef2(({ options, selectedIds, createSchema, createOptionLabel, createOptionIcon, createInitialValuePath, onSelect, onCreate, ...props }, ref) => {
|
|
1515
|
-
const { t } = useTranslation6(translationKey);
|
|
1485
|
+
import React10, { forwardRef, useCallback as useCallback8, useState as useState3 } from "react";
|
|
1486
|
+
import { Popover, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
1487
|
+
import { Combobox, useSearchListInput, useSearchListResults } from "@dxos/react-ui-search";
|
|
1488
|
+
var ObjectPickerContent = /* @__PURE__ */ forwardRef(({ options, selectedIds, createSchema, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap: createFieldMap3, onSelect, onCreate, ...props }, forwardedRef) => {
|
|
1489
|
+
const { t } = useTranslation5(translationKey);
|
|
1516
1490
|
const [showForm, setShowForm] = useState3(false);
|
|
1517
1491
|
const [formInitialValue, setFormInitialValue] = useState3("");
|
|
1518
1492
|
const { results, handleSearch } = useSearchListResults({
|
|
@@ -1541,39 +1515,66 @@ var ObjectPickerContent = /* @__PURE__ */ forwardRef2(({ options, selectedIds, c
|
|
|
1541
1515
|
}, [
|
|
1542
1516
|
createSchema
|
|
1543
1517
|
]);
|
|
1544
|
-
|
|
1518
|
+
if (showForm && createSchema) {
|
|
1519
|
+
return /* @__PURE__ */ React10.createElement(Combobox.Content, {
|
|
1520
|
+
...props,
|
|
1521
|
+
onSearch: handleSearch,
|
|
1522
|
+
onKeyDownCapture: handleKeyDown,
|
|
1523
|
+
ref: forwardedRef
|
|
1524
|
+
}, /* @__PURE__ */ React10.createElement(Popover.Viewport, null, /* @__PURE__ */ React10.createElement(Form.Root, {
|
|
1525
|
+
testId: "create-referenced-object-form",
|
|
1526
|
+
schema: createSchema,
|
|
1527
|
+
defaultValues: createInitialValuePath ? {
|
|
1528
|
+
[createInitialValuePath]: formInitialValue
|
|
1529
|
+
} : {},
|
|
1530
|
+
fieldMap: createFieldMap3,
|
|
1531
|
+
onSave: handleFormSave,
|
|
1532
|
+
onCancel: handleFormCancel
|
|
1533
|
+
}, /* @__PURE__ */ React10.createElement(Form.Viewport, null, /* @__PURE__ */ React10.createElement(Form.Content, null, /* @__PURE__ */ React10.createElement(Form.FieldSet, null), /* @__PURE__ */ React10.createElement(Form.Actions, null))))), /* @__PURE__ */ React10.createElement(Combobox.Arrow, null));
|
|
1534
|
+
}
|
|
1535
|
+
return /* @__PURE__ */ React10.createElement(Combobox.Content, {
|
|
1545
1536
|
...props,
|
|
1546
|
-
ref,
|
|
1547
1537
|
onSearch: handleSearch,
|
|
1548
|
-
onKeyDownCapture: handleKeyDown
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
values: createInitialValuePath ? {
|
|
1553
|
-
[createInitialValuePath]: formInitialValue
|
|
1554
|
-
} : {},
|
|
1555
|
-
onSave: handleFormSave,
|
|
1556
|
-
onCancel: handleFormCancel
|
|
1557
|
-
}, /* @__PURE__ */ React11.createElement(Form.Viewport, null, /* @__PURE__ */ React11.createElement(Form.Content, null, /* @__PURE__ */ React11.createElement(Form.FieldSet, null), /* @__PURE__ */ React11.createElement(Form.Actions, null))))) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Combobox.Input, {
|
|
1558
|
-
placeholder: t("ref field combobox input placeholder"),
|
|
1538
|
+
onKeyDownCapture: handleKeyDown,
|
|
1539
|
+
ref: forwardedRef
|
|
1540
|
+
}, /* @__PURE__ */ React10.createElement(Combobox.Input, {
|
|
1541
|
+
placeholder: t("ref-field-combobox-input.placeholder"),
|
|
1559
1542
|
autoFocus: true
|
|
1560
|
-
}), /* @__PURE__ */
|
|
1543
|
+
}), /* @__PURE__ */ React10.createElement(Combobox.List, null, results.map((option) => /* @__PURE__ */ React10.createElement(Combobox.Item, {
|
|
1561
1544
|
key: option.id,
|
|
1562
1545
|
value: option.id,
|
|
1563
1546
|
label: option.label,
|
|
1564
1547
|
checked: selectedIds?.includes(option.id),
|
|
1565
1548
|
onSelect: () => onSelect(option.id),
|
|
1566
1549
|
classNames: "flex items-center gap-2"
|
|
1567
|
-
})),
|
|
1550
|
+
})), createSchema && onCreate && /* @__PURE__ */ React10.createElement(CreateItem, {
|
|
1568
1551
|
createOptionLabel,
|
|
1569
|
-
createOptionIcon,
|
|
1552
|
+
createOptionIcon: createOptionIcon ?? "ph--plus--regular",
|
|
1570
1553
|
onCreateItemSelect: (query) => {
|
|
1571
1554
|
setFormInitialValue(query);
|
|
1572
1555
|
setShowForm(true);
|
|
1573
1556
|
}
|
|
1574
|
-
}))
|
|
1557
|
+
})), /* @__PURE__ */ React10.createElement(Combobox.Arrow, null));
|
|
1575
1558
|
});
|
|
1576
|
-
|
|
1559
|
+
var CreateItem = ({ createOptionLabel, createOptionIcon, onCreateItemSelect }) => {
|
|
1560
|
+
const { t } = useTranslation5(translationKey);
|
|
1561
|
+
const { query } = useSearchListInput();
|
|
1562
|
+
const label = createOptionLabel ? t(createOptionLabel[0], {
|
|
1563
|
+
ns: createOptionLabel[1].ns,
|
|
1564
|
+
text: query
|
|
1565
|
+
}) : t("create-option.label");
|
|
1566
|
+
return /* @__PURE__ */ React10.createElement(Combobox.Item, {
|
|
1567
|
+
value: "__create__",
|
|
1568
|
+
label,
|
|
1569
|
+
icon: createOptionIcon,
|
|
1570
|
+
classNames: "flex items-center gap-2",
|
|
1571
|
+
closeOnSelect: false,
|
|
1572
|
+
onSelect: () => {
|
|
1573
|
+
onCreateItemSelect(query);
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
ObjectPickerContent.displayName = "ObjectPicker.Content";
|
|
1577
1578
|
var ObjectPicker = {
|
|
1578
1579
|
Root: Combobox.Root,
|
|
1579
1580
|
Portal: Combobox.Portal,
|
|
@@ -1586,26 +1587,33 @@ var ObjectPicker = {
|
|
|
1586
1587
|
var isRefSnapshot = (val) => {
|
|
1587
1588
|
return typeof val === "object" && typeof val?.["/"] === "string";
|
|
1588
1589
|
};
|
|
1589
|
-
var defaultGetOptions = (results) => results.map((result) => {
|
|
1590
|
+
var defaultGetOptions = (results, { parentLabel } = {}) => results.map((result) => {
|
|
1590
1591
|
const id = Entity.getDXN(result).toString();
|
|
1591
|
-
const
|
|
1592
|
+
const parent = parentLabel ? Obj.getParent(result) : void 0;
|
|
1593
|
+
const label = parent ? Entity.getLabel(parent) : Entity.getLabel(result);
|
|
1592
1594
|
return {
|
|
1593
1595
|
id,
|
|
1594
1596
|
label: label ?? id
|
|
1595
1597
|
};
|
|
1596
1598
|
});
|
|
1597
|
-
var defaultResultsHook = (db, typename) => useQuery(db, typename ? Filter.typename(typename) : Filter.nothing());
|
|
1599
|
+
var defaultResultsHook = (db, typename) => useQuery(db, typename ? typename === Type.getTypename(Obj.Unknown) ? Filter.everything() : Filter.typename(typename) : Filter.nothing());
|
|
1598
1600
|
var RefField = (props) => {
|
|
1599
|
-
const { type, readonly, label, placeholder, layout, getStatus, getValue, createOptionLabel, createOptionIcon, createInitialValuePath, db, resultsHook: useResults = defaultResultsHook, schemaHook: useSchema = useSchema$, getOptions
|
|
1600
|
-
const { t } =
|
|
1601
|
+
const { type, readonly, label, placeholder, layout, getStatus, getValue, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap: createFieldMap3, db, resultsHook: useResults = defaultResultsHook, schemaHook: useSchema = useSchema$, getOptions = defaultGetOptions, onCreate, onValueChange } = props;
|
|
1602
|
+
const { t } = useTranslation6(translationKey);
|
|
1601
1603
|
const { status, error } = getStatus();
|
|
1602
|
-
const typename = useMemo6(() => type ?
|
|
1604
|
+
const typename = useMemo6(() => type ? findAnnotation2(type, ReferenceAnnotationId2)?.typename : void 0, [
|
|
1603
1605
|
type
|
|
1604
1606
|
]);
|
|
1605
1607
|
const results = useResults(db, typename);
|
|
1606
|
-
const options = useMemo6(() =>
|
|
1608
|
+
const options = useMemo6(() => {
|
|
1609
|
+
const parentLabel = type ? findAnnotation2(type, ParentLabelAnnotationId) === true : false;
|
|
1610
|
+
return getOptions(results, {
|
|
1611
|
+
parentLabel
|
|
1612
|
+
});
|
|
1613
|
+
}, [
|
|
1607
1614
|
results,
|
|
1608
|
-
|
|
1615
|
+
getOptions,
|
|
1616
|
+
type
|
|
1609
1617
|
]);
|
|
1610
1618
|
const handleGetValue = useCallback9(() => {
|
|
1611
1619
|
const formValue = getValue();
|
|
@@ -1662,55 +1670,56 @@ var RefField = (props) => {
|
|
|
1662
1670
|
if (!typename || (readonly || layout === "static") && !item) {
|
|
1663
1671
|
return null;
|
|
1664
1672
|
}
|
|
1665
|
-
return /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ React11.createElement(Input6.Root, {
|
|
1666
1674
|
validationValence: status
|
|
1667
|
-
}, layout !== "inline" && /* @__PURE__ */
|
|
1675
|
+
}, layout !== "inline" && /* @__PURE__ */ React11.createElement(FormFieldLabel, {
|
|
1668
1676
|
error,
|
|
1669
1677
|
readonly,
|
|
1670
1678
|
label
|
|
1671
|
-
}), /* @__PURE__ */
|
|
1672
|
-
className:
|
|
1673
|
-
}, t("empty
|
|
1679
|
+
}), /* @__PURE__ */ React11.createElement("div", null, readonly ? !item ? /* @__PURE__ */ React11.createElement("p", {
|
|
1680
|
+
className: mx2("text-description", "mb-2")
|
|
1681
|
+
}, t("empty-readonly-ref-field.label")) : /* @__PURE__ */ React11.createElement(DxAnchor, {
|
|
1674
1682
|
key: item.id,
|
|
1675
|
-
|
|
1676
|
-
rootclassname: "
|
|
1677
|
-
}, item.label) : /* @__PURE__ */
|
|
1683
|
+
dxn: item.id,
|
|
1684
|
+
rootclassname: "me-1"
|
|
1685
|
+
}, item.label) : /* @__PURE__ */ React11.createElement(ObjectPicker.Root, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Trigger, {
|
|
1678
1686
|
asChild: true,
|
|
1679
1687
|
classNames: "p-0"
|
|
1680
|
-
}, item ? /* @__PURE__ */
|
|
1681
|
-
className: "flex gap-
|
|
1682
|
-
}, /* @__PURE__ */
|
|
1688
|
+
}, item ? /* @__PURE__ */ React11.createElement("div", {
|
|
1689
|
+
className: "flex gap-form-gap w-full"
|
|
1690
|
+
}, /* @__PURE__ */ React11.createElement(Input6.Root, {
|
|
1683
1691
|
key: item.id
|
|
1684
|
-
}, /* @__PURE__ */
|
|
1692
|
+
}, /* @__PURE__ */ React11.createElement(Input6.TextInput, {
|
|
1685
1693
|
value: item.label,
|
|
1686
1694
|
readOnly: true,
|
|
1687
|
-
classNames: "
|
|
1688
|
-
}))) : /* @__PURE__ */
|
|
1689
|
-
classNames: "
|
|
1690
|
-
}, /* @__PURE__ */
|
|
1695
|
+
classNames: "w-full"
|
|
1696
|
+
}))) : /* @__PURE__ */ React11.createElement(Button, {
|
|
1697
|
+
classNames: "w-full text-start gap-form-gap"
|
|
1698
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1691
1699
|
role: "none",
|
|
1692
1700
|
className: "grow overflow-hidden"
|
|
1693
|
-
}, /* @__PURE__ */
|
|
1701
|
+
}, /* @__PURE__ */ React11.createElement("span", {
|
|
1694
1702
|
className: "flex truncate text-description"
|
|
1695
|
-
}, placeholder ?? t("ref
|
|
1703
|
+
}, placeholder ?? t("ref-field.placeholder"))), /* @__PURE__ */ React11.createElement(Icon2, {
|
|
1696
1704
|
size: 3,
|
|
1697
1705
|
icon: "ph--caret-down--bold"
|
|
1698
|
-
}))), /* @__PURE__ */
|
|
1699
|
-
classNames: "
|
|
1706
|
+
}))), /* @__PURE__ */ React11.createElement(ObjectPicker.Portal, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Content, {
|
|
1707
|
+
classNames: "dx-card-popover-width",
|
|
1700
1708
|
options,
|
|
1701
1709
|
selectedIds,
|
|
1702
1710
|
createSchema: createSchema && omitId(createSchema),
|
|
1703
1711
|
createOptionLabel,
|
|
1704
1712
|
createOptionIcon,
|
|
1705
1713
|
createInitialValuePath,
|
|
1714
|
+
createFieldMap: createFieldMap3,
|
|
1706
1715
|
onCreate: handleCreate,
|
|
1707
1716
|
onSelect: handleSelect
|
|
1708
|
-
})))), layout === "full" && /* @__PURE__ */
|
|
1717
|
+
})))), layout === "full" && /* @__PURE__ */ React11.createElement(Input6.DescriptionAndValidation, null, error));
|
|
1709
1718
|
};
|
|
1710
1719
|
|
|
1711
1720
|
// src/components/Form/fields/SelectField.tsx
|
|
1712
|
-
import
|
|
1713
|
-
import { Input as
|
|
1721
|
+
import React12, { useCallback as useCallback10 } from "react";
|
|
1722
|
+
import { Input as Input7, Select } from "@dxos/react-ui";
|
|
1714
1723
|
var SelectField = ({ type, readonly, label, layout, placeholder, options, getStatus, getValue, onValueChange }) => {
|
|
1715
1724
|
const { status, error } = getStatus();
|
|
1716
1725
|
const value3 = getValue();
|
|
@@ -1721,43 +1730,43 @@ var SelectField = ({ type, readonly, label, layout, placeholder, options, getSta
|
|
|
1721
1730
|
if ((readonly || layout === "static") && value3 == null) {
|
|
1722
1731
|
return null;
|
|
1723
1732
|
}
|
|
1724
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ React12.createElement(Input7.Root, {
|
|
1725
1734
|
validationValence: status
|
|
1726
|
-
}, layout !== "inline" && /* @__PURE__ */
|
|
1735
|
+
}, layout !== "inline" && /* @__PURE__ */ React12.createElement(FormFieldLabel, {
|
|
1727
1736
|
error,
|
|
1728
1737
|
readonly,
|
|
1729
1738
|
label
|
|
1730
|
-
}), layout === "static" ? /* @__PURE__ */
|
|
1739
|
+
}), layout === "static" ? /* @__PURE__ */ React12.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value3)?.label ?? String(value3)) : /* @__PURE__ */ React12.createElement(Select.Root, {
|
|
1731
1740
|
value: value3,
|
|
1732
1741
|
onValueChange: handleValueChange
|
|
1733
|
-
}, /* @__PURE__ */
|
|
1734
|
-
classNames: "
|
|
1742
|
+
}, /* @__PURE__ */ React12.createElement(Select.TriggerButton, {
|
|
1743
|
+
classNames: "w-full",
|
|
1735
1744
|
disabled: !!readonly,
|
|
1736
1745
|
placeholder
|
|
1737
|
-
}), /* @__PURE__ */
|
|
1746
|
+
}), /* @__PURE__ */ React12.createElement(Select.Portal, null, /* @__PURE__ */ React12.createElement(Select.Content, null, /* @__PURE__ */ React12.createElement(Select.Viewport, null, options?.map(({ value: value4, label: label2 }) => (
|
|
1738
1747
|
// NOTE: Numeric values are converted to and from strings.
|
|
1739
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ React12.createElement(Select.Option, {
|
|
1740
1749
|
key: String(value4),
|
|
1741
1750
|
value: String(value4)
|
|
1742
1751
|
}, label2 ?? String(value4))
|
|
1743
|
-
))), /* @__PURE__ */
|
|
1752
|
+
))), /* @__PURE__ */ React12.createElement(Select.Arrow, null)))), layout === "full" && /* @__PURE__ */ React12.createElement(Input7.DescriptionAndValidation, null, error));
|
|
1744
1753
|
};
|
|
1745
1754
|
|
|
1746
1755
|
// src/components/Form/fields/SelectOptionField.tsx
|
|
1747
|
-
import
|
|
1756
|
+
import React13, { useCallback as useCallback11, useEffect as useEffect5, useRef as useRef3, useState as useState4 } from "react";
|
|
1748
1757
|
import { PublicKey } from "@dxos/keys";
|
|
1749
|
-
import { IconButton as IconButton3, Input as
|
|
1758
|
+
import { IconButton as IconButton3, Input as Input8, Tag, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1750
1759
|
import { List } from "@dxos/react-ui-list";
|
|
1751
1760
|
import { HuePicker } from "@dxos/react-ui-pickers";
|
|
1752
1761
|
import { hues, osTranslations, subtleHover } from "@dxos/ui-theme";
|
|
1753
1762
|
var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueChange }) => {
|
|
1754
|
-
const { t } =
|
|
1763
|
+
const { t } = useTranslation7(translationKey);
|
|
1755
1764
|
const { status, error } = getStatus();
|
|
1756
1765
|
const [selected, setSelectedId] = useState4(null);
|
|
1757
1766
|
const [isNewOption, setIsNewOption] = useState4(false);
|
|
1758
1767
|
const inputRef = useRef3(null);
|
|
1759
1768
|
const options = getValue();
|
|
1760
|
-
|
|
1769
|
+
useEffect5(() => {
|
|
1761
1770
|
if (options === void 0) {
|
|
1762
1771
|
onValueChange(type, []);
|
|
1763
1772
|
}
|
|
@@ -1848,7 +1857,7 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
|
|
|
1848
1857
|
type,
|
|
1849
1858
|
onValueChange
|
|
1850
1859
|
]);
|
|
1851
|
-
|
|
1860
|
+
useEffect5(() => {
|
|
1852
1861
|
if (selected && isNewOption && inputRef.current) {
|
|
1853
1862
|
inputRef.current.focus();
|
|
1854
1863
|
setIsNewOption(false);
|
|
@@ -1857,42 +1866,42 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
|
|
|
1857
1866
|
selected,
|
|
1858
1867
|
isNewOption
|
|
1859
1868
|
]);
|
|
1860
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ React13.createElement(Input8.Root, {
|
|
1861
1870
|
validationValence: status
|
|
1862
|
-
}, /* @__PURE__ */
|
|
1871
|
+
}, /* @__PURE__ */ React13.createElement(FormFieldLabel, {
|
|
1863
1872
|
error,
|
|
1864
1873
|
readonly,
|
|
1865
1874
|
label
|
|
1866
|
-
}), /* @__PURE__ */
|
|
1875
|
+
}), /* @__PURE__ */ React13.createElement("div", {
|
|
1867
1876
|
role: "none"
|
|
1868
|
-
}, options && /* @__PURE__ */
|
|
1877
|
+
}, options && /* @__PURE__ */ React13.createElement(List.Root, {
|
|
1869
1878
|
items: options,
|
|
1870
1879
|
isItem: (_item) => true,
|
|
1871
1880
|
onMove: readonly ? void 0 : handleMove,
|
|
1872
1881
|
readonly: !!readonly
|
|
1873
|
-
}, ({ items }) => /* @__PURE__ */
|
|
1882
|
+
}, ({ items }) => /* @__PURE__ */ React13.createElement("div", {
|
|
1874
1883
|
role: "list",
|
|
1875
|
-
className: "
|
|
1876
|
-
}, items?.map((item) => /* @__PURE__ */
|
|
1884
|
+
className: "w-full overflow-auto"
|
|
1885
|
+
}, items?.map((item) => /* @__PURE__ */ React13.createElement("div", {
|
|
1877
1886
|
key: item.id
|
|
1878
|
-
}, /* @__PURE__ */
|
|
1887
|
+
}, /* @__PURE__ */ React13.createElement(List.Item, {
|
|
1879
1888
|
role: "button",
|
|
1880
1889
|
item,
|
|
1881
1890
|
classNames: [
|
|
1882
1891
|
subtleHover,
|
|
1883
|
-
"flex flex-col cursor-pointer rounded-
|
|
1892
|
+
"flex flex-col cursor-pointer rounded-xs"
|
|
1884
1893
|
],
|
|
1885
1894
|
"aria-expanded": selected === item.id
|
|
1886
|
-
}, /* @__PURE__ */
|
|
1895
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1887
1896
|
className: "flex items-center"
|
|
1888
|
-
}, /* @__PURE__ */
|
|
1897
|
+
}, /* @__PURE__ */ React13.createElement(List.ItemDragHandle, {
|
|
1889
1898
|
disabled: !!readonly
|
|
1890
|
-
}), /* @__PURE__ */
|
|
1899
|
+
}), /* @__PURE__ */ React13.createElement(List.ItemTitle, {
|
|
1891
1900
|
onClick: () => handleClick(item.id),
|
|
1892
1901
|
classNames: "flex-1"
|
|
1893
|
-
}, /* @__PURE__ */
|
|
1902
|
+
}, /* @__PURE__ */ React13.createElement(Tag, {
|
|
1894
1903
|
palette: item.color
|
|
1895
|
-
}, item.title || "\u200B")), /* @__PURE__ */
|
|
1904
|
+
}, item.title || "\u200B")), /* @__PURE__ */ React13.createElement(IconButton3, {
|
|
1896
1905
|
iconOnly: true,
|
|
1897
1906
|
variant: "ghost",
|
|
1898
1907
|
label: t(selected === item.id ? "collapse label" : "expand label", {
|
|
@@ -1900,52 +1909,52 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
|
|
|
1900
1909
|
}),
|
|
1901
1910
|
icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
|
|
1902
1911
|
onClick: () => handleClick(item.id)
|
|
1903
|
-
})), selected === item.id && /* @__PURE__ */
|
|
1904
|
-
className: "
|
|
1905
|
-
}, /* @__PURE__ */
|
|
1912
|
+
})), selected === item.id && /* @__PURE__ */ React13.createElement("div", {
|
|
1913
|
+
className: "flex flex-col p-form-padding gap-form-gap dx-density-fine"
|
|
1914
|
+
}, /* @__PURE__ */ React13.createElement(Input8.Label, {
|
|
1906
1915
|
classNames: "text-xs"
|
|
1907
|
-
}, t("select
|
|
1908
|
-
className: "grid grid-cols-[1fr_min-content_min-content] gap-
|
|
1909
|
-
}, /* @__PURE__ */
|
|
1916
|
+
}, t("select-option.label")), /* @__PURE__ */ React13.createElement("div", {
|
|
1917
|
+
className: "grid grid-cols-[1fr_min-content_min-content] gap-form-gap"
|
|
1918
|
+
}, /* @__PURE__ */ React13.createElement(Input8.TextInput, {
|
|
1910
1919
|
disabled: !!readonly,
|
|
1911
|
-
placeholder: t("select
|
|
1920
|
+
placeholder: t("select-option-label.placeholder"),
|
|
1912
1921
|
ref: selected === item.id ? inputRef : void 0,
|
|
1913
1922
|
value: item.title,
|
|
1914
1923
|
onChange: handleTitleChange(item.id),
|
|
1915
1924
|
onKeyDown: handleKeyDown,
|
|
1916
1925
|
classNames: "flex-1"
|
|
1917
|
-
}), /* @__PURE__ */
|
|
1926
|
+
}), /* @__PURE__ */ React13.createElement(HuePicker, {
|
|
1918
1927
|
disabled: !!readonly,
|
|
1919
1928
|
value: item.color,
|
|
1920
1929
|
onChange: handleColorChange(item.id)
|
|
1921
|
-
}), /* @__PURE__ */
|
|
1930
|
+
}), /* @__PURE__ */ React13.createElement(IconButton3, {
|
|
1922
1931
|
disabled: !!readonly,
|
|
1923
1932
|
icon: "ph--trash--fill",
|
|
1924
1933
|
iconOnly: true,
|
|
1925
|
-
label: t("select
|
|
1934
|
+
label: t("select-option-delete.button"),
|
|
1926
1935
|
onClick: () => handleDelete(item.id)
|
|
1927
|
-
})))))), /* @__PURE__ */
|
|
1936
|
+
})))))), /* @__PURE__ */ React13.createElement(IconButton3, {
|
|
1928
1937
|
variant: "ghost",
|
|
1929
1938
|
icon: "ph--plus--regular",
|
|
1930
|
-
label: t("select
|
|
1939
|
+
label: t("select-option-add.button"),
|
|
1931
1940
|
onClick: handleAdd,
|
|
1932
1941
|
disabled: !!readonly,
|
|
1933
|
-
classNames: "
|
|
1942
|
+
classNames: "w-full"
|
|
1934
1943
|
})))));
|
|
1935
1944
|
};
|
|
1936
1945
|
|
|
1937
1946
|
// src/components/Form/fields/TextField.tsx
|
|
1938
|
-
import
|
|
1939
|
-
import { Input as
|
|
1947
|
+
import React14, { useCallback as useCallback12 } from "react";
|
|
1948
|
+
import { Input as Input9 } from "@dxos/react-ui";
|
|
1940
1949
|
var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
|
|
1941
1950
|
const handleChange = useCallback12((event) => onValueChange(type, event.target.value), [
|
|
1942
1951
|
type,
|
|
1943
1952
|
onValueChange
|
|
1944
1953
|
]);
|
|
1945
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ React14.createElement(FormFieldWrapper, {
|
|
1946
1955
|
readonly,
|
|
1947
1956
|
...props
|
|
1948
|
-
}, ({ value: value3 = "" }) => /* @__PURE__ */
|
|
1957
|
+
}, ({ value: value3 = "" }) => /* @__PURE__ */ React14.createElement(Input9.TextInput, {
|
|
1949
1958
|
noAutoFill: true,
|
|
1950
1959
|
disabled: !!readonly,
|
|
1951
1960
|
placeholder,
|
|
@@ -1956,17 +1965,17 @@ var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props
|
|
|
1956
1965
|
};
|
|
1957
1966
|
|
|
1958
1967
|
// src/components/Form/fields/TextAreaField.tsx
|
|
1959
|
-
import
|
|
1960
|
-
import { Input as
|
|
1968
|
+
import React15, { useCallback as useCallback13 } from "react";
|
|
1969
|
+
import { Input as Input10 } from "@dxos/react-ui";
|
|
1961
1970
|
var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
|
|
1962
1971
|
const handleChange = useCallback13((event) => onValueChange(type, event.target.value), [
|
|
1963
1972
|
type,
|
|
1964
1973
|
onValueChange
|
|
1965
1974
|
]);
|
|
1966
|
-
return /* @__PURE__ */
|
|
1975
|
+
return /* @__PURE__ */ React15.createElement(FormFieldWrapper, {
|
|
1967
1976
|
readonly,
|
|
1968
1977
|
...props
|
|
1969
|
-
}, ({ value: value3 = "" }) => /* @__PURE__ */
|
|
1978
|
+
}, ({ value: value3 = "" }) => /* @__PURE__ */ React15.createElement(Input10.TextArea, {
|
|
1970
1979
|
rows: 3,
|
|
1971
1980
|
disabled: !!readonly,
|
|
1972
1981
|
placeholder,
|
|
@@ -1977,9 +1986,9 @@ var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...pr
|
|
|
1977
1986
|
};
|
|
1978
1987
|
|
|
1979
1988
|
// src/components/Form/fields/TupleField.tsx
|
|
1980
|
-
import
|
|
1981
|
-
import { Input as
|
|
1982
|
-
import { mx as
|
|
1989
|
+
import React16 from "react";
|
|
1990
|
+
import { Input as Input11 } from "@dxos/react-ui";
|
|
1991
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
1983
1992
|
import { safeParseFloat as safeParseFloat3 } from "@dxos/util";
|
|
1984
1993
|
var gridCols = [
|
|
1985
1994
|
"grid-cols-1",
|
|
@@ -1990,15 +1999,15 @@ var gridCols = [
|
|
|
1990
1999
|
var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValueChange, onBlur }) => {
|
|
1991
2000
|
const { status, error } = getStatus();
|
|
1992
2001
|
const values = getValue() ?? {};
|
|
1993
|
-
return /* @__PURE__ */
|
|
2002
|
+
return /* @__PURE__ */ React16.createElement(Input11.Root, {
|
|
1994
2003
|
validationValence: status
|
|
1995
|
-
}, /* @__PURE__ */
|
|
2004
|
+
}, /* @__PURE__ */ React16.createElement(FormFieldLabel, {
|
|
1996
2005
|
error,
|
|
1997
2006
|
readonly,
|
|
1998
2007
|
label
|
|
1999
|
-
}), /* @__PURE__ */
|
|
2000
|
-
className:
|
|
2001
|
-
}, binding.map((prop) => /* @__PURE__ */
|
|
2008
|
+
}), /* @__PURE__ */ React16.createElement("div", {
|
|
2009
|
+
className: mx3("grid gap-form-gap", gridCols[binding.length - 1])
|
|
2010
|
+
}, binding.map((prop) => /* @__PURE__ */ React16.createElement(Input11.TextInput, {
|
|
2002
2011
|
key: prop,
|
|
2003
2012
|
type: "number",
|
|
2004
2013
|
disabled: !!readonly,
|
|
@@ -2016,9 +2025,9 @@ var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValue
|
|
|
2016
2025
|
// src/components/FieldEditor/FieldEditor.tsx
|
|
2017
2026
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
|
|
2018
2027
|
var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCancel }) => {
|
|
2019
|
-
const { t } =
|
|
2028
|
+
const { t } = useTranslation8(translationKey);
|
|
2020
2029
|
const [props, setProps] = useState5(projection.getFieldProjection(field.id).props);
|
|
2021
|
-
|
|
2030
|
+
useEffect6(() => setProps(projection.getFieldProjection(field.id).props), [
|
|
2022
2031
|
field,
|
|
2023
2032
|
projection
|
|
2024
2033
|
]);
|
|
@@ -2037,7 +2046,7 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
|
|
|
2037
2046
|
registry
|
|
2038
2047
|
]);
|
|
2039
2048
|
const [referenceSchema, setReferenceSchema] = useState5();
|
|
2040
|
-
|
|
2049
|
+
useEffect6(() => {
|
|
2041
2050
|
setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
|
|
2042
2051
|
}, [
|
|
2043
2052
|
schemas,
|
|
@@ -2047,26 +2056,26 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
|
|
|
2047
2056
|
fieldSchema: getFormatSchema(props?.format)
|
|
2048
2057
|
});
|
|
2049
2058
|
const fieldMap = useMemo7(() => ({
|
|
2050
|
-
["format"]: (props2) => /* @__PURE__ */
|
|
2059
|
+
["format"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
|
|
2051
2060
|
...props2,
|
|
2052
2061
|
options: FormatEnums.filter((value3) => value3 !== Format4.TypeFormat.None).map((value3) => ({
|
|
2053
2062
|
value: value3,
|
|
2054
|
-
label: t(`format
|
|
2063
|
+
label: t(`format.${value3}.label`)
|
|
2055
2064
|
}))
|
|
2056
2065
|
}),
|
|
2057
|
-
["referenceSchema"]: (props2) => /* @__PURE__ */
|
|
2066
|
+
["referenceSchema"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
|
|
2058
2067
|
...props2,
|
|
2059
2068
|
options: schemas.map((schema) => ({
|
|
2060
2069
|
value: schema.typename
|
|
2061
2070
|
}))
|
|
2062
2071
|
}),
|
|
2063
|
-
["referencePath"]: (props2) => /* @__PURE__ */
|
|
2072
|
+
["referencePath"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
|
|
2064
2073
|
...props2,
|
|
2065
2074
|
options: referenceSchema ? getFormProperties(referenceSchema.ast).sort((a, b) => a.name.toString().localeCompare(b.name.toString())).map((p) => ({
|
|
2066
2075
|
value: p.name.toString()
|
|
2067
2076
|
})) : []
|
|
2068
2077
|
}),
|
|
2069
|
-
["options"]: (props2) => /* @__PURE__ */
|
|
2078
|
+
["options"]: (props2) => /* @__PURE__ */ React17.createElement(SelectOptionField, props2)
|
|
2070
2079
|
}), [
|
|
2071
2080
|
t,
|
|
2072
2081
|
schemas,
|
|
@@ -2125,7 +2134,7 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
|
|
|
2125
2134
|
]);
|
|
2126
2135
|
const handleSave = useCallback14((props2) => {
|
|
2127
2136
|
if (view) {
|
|
2128
|
-
|
|
2137
|
+
Obj2.change(view, () => {
|
|
2129
2138
|
projection.setFieldProjection({
|
|
2130
2139
|
field,
|
|
2131
2140
|
props: props2
|
|
@@ -2155,13 +2164,13 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
|
|
|
2155
2164
|
props
|
|
2156
2165
|
}, {
|
|
2157
2166
|
F: __dxlog_file2,
|
|
2158
|
-
L:
|
|
2167
|
+
L: 172,
|
|
2159
2168
|
S: void 0,
|
|
2160
2169
|
C: (f, a) => f(...a)
|
|
2161
2170
|
});
|
|
2162
2171
|
return null;
|
|
2163
2172
|
}
|
|
2164
|
-
return /* @__PURE__ */
|
|
2173
|
+
return /* @__PURE__ */ React17.createElement(Form.Root, {
|
|
2165
2174
|
key: field.id,
|
|
2166
2175
|
fieldMap,
|
|
2167
2176
|
autoFocus: true,
|
|
@@ -2177,34 +2186,348 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
|
|
|
2177
2186
|
onValidate: handleValidate,
|
|
2178
2187
|
onSave: handleSave,
|
|
2179
2188
|
onCancel: handleCancel
|
|
2180
|
-
}, /* @__PURE__ */
|
|
2189
|
+
}, /* @__PURE__ */ React17.createElement(Form.Content, null, /* @__PURE__ */ React17.createElement(Form.FieldSet, null), /* @__PURE__ */ React17.createElement(Form.Actions, null)));
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
// src/components/ObjectForm/ObjectForm.tsx
|
|
2193
|
+
import * as Schema3 from "effect/Schema";
|
|
2194
|
+
import React18, { useCallback as useCallback15, useMemo as useMemo8 } from "react";
|
|
2195
|
+
import { DXN as DXN2, Obj as Obj3, Ref as Ref3, Tag as Tag2, Type as Type2 } from "@dxos/echo";
|
|
2196
|
+
import { splitJsonPath } from "@dxos/echo/internal";
|
|
2197
|
+
import { invariant } from "@dxos/invariant";
|
|
2198
|
+
import { HuePicker as HuePicker2 } from "@dxos/react-ui-pickers";
|
|
2199
|
+
import { isNonNullable } from "@dxos/util";
|
|
2200
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ObjectForm/ObjectForm.tsx";
|
|
2201
|
+
var createFieldMap = {
|
|
2202
|
+
hue: ({ type, label, layout, getValue, onValueChange }) => {
|
|
2203
|
+
const handleChange = useCallback15((nextHue) => onValueChange(type, nextHue), [
|
|
2204
|
+
onValueChange,
|
|
2205
|
+
type
|
|
2206
|
+
]);
|
|
2207
|
+
const handleReset = useCallback15(() => onValueChange(type, void 0), [
|
|
2208
|
+
onValueChange,
|
|
2209
|
+
type
|
|
2210
|
+
]);
|
|
2211
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, layout !== "inline" && /* @__PURE__ */ React18.createElement(Form.Label, {
|
|
2212
|
+
label
|
|
2213
|
+
}), /* @__PURE__ */ React18.createElement(HuePicker2, {
|
|
2214
|
+
value: getValue(),
|
|
2215
|
+
onChange: handleChange,
|
|
2216
|
+
onReset: handleReset
|
|
2217
|
+
}));
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
var ObjectForm = ({ object, schema }) => {
|
|
2221
|
+
const db = Obj3.getDatabase(object);
|
|
2222
|
+
const meta = Obj3.getMeta(object);
|
|
2223
|
+
const tags = (meta.tags ?? []).map((tag) => db?.makeRef(DXN2.parse(tag))).filter(isNonNullable);
|
|
2224
|
+
const values = useMemo8(() => ({
|
|
2225
|
+
tags,
|
|
2226
|
+
...object
|
|
2227
|
+
}), [
|
|
2228
|
+
object,
|
|
2229
|
+
tags
|
|
2230
|
+
]);
|
|
2231
|
+
const formSchema = useMemo8(() => omitId(Schema3.Struct({
|
|
2232
|
+
tags: Schema3.Array(Ref3.Ref(Tag2.Tag)).pipe(Schema3.optional)
|
|
2233
|
+
}).pipe(Schema3.extend(schema))), [
|
|
2234
|
+
schema
|
|
2235
|
+
]);
|
|
2236
|
+
const handleCreate = useCallback15((schema2, values2) => {
|
|
2237
|
+
invariant(db, void 0, {
|
|
2238
|
+
F: __dxlog_file3,
|
|
2239
|
+
L: 51,
|
|
2240
|
+
S: void 0,
|
|
2241
|
+
A: [
|
|
2242
|
+
"db",
|
|
2243
|
+
""
|
|
2244
|
+
]
|
|
2245
|
+
});
|
|
2246
|
+
invariant(Type2.isObjectSchema(schema2), void 0, {
|
|
2247
|
+
F: __dxlog_file3,
|
|
2248
|
+
L: 52,
|
|
2249
|
+
S: void 0,
|
|
2250
|
+
A: [
|
|
2251
|
+
"Type.isObjectSchema(schema)",
|
|
2252
|
+
""
|
|
2253
|
+
]
|
|
2254
|
+
});
|
|
2255
|
+
const newObject = db.add(Obj3.make(schema2, values2));
|
|
2256
|
+
if (Obj3.instanceOf(Tag2.Tag, newObject)) {
|
|
2257
|
+
Obj3.change(object, (object2) => {
|
|
2258
|
+
Obj3.getMeta(object2).tags = [
|
|
2259
|
+
...Obj3.getMeta(object2).tags ?? [],
|
|
2260
|
+
Obj3.getDXN(newObject).toString()
|
|
2261
|
+
];
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
}, []);
|
|
2265
|
+
const handleChange = useCallback15(({ tags: tags2, ...values2 }, { isValid, changed }) => {
|
|
2266
|
+
if (!isValid) {
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path]);
|
|
2270
|
+
const hasTagsChange = changedPaths.some((path) => splitJsonPath(path)[0] === "tags");
|
|
2271
|
+
if (hasTagsChange) {
|
|
2272
|
+
Obj3.change(object, (object2) => {
|
|
2273
|
+
Obj3.getMeta(object2).tags = tags2?.map((tag) => tag.dxn.toString()) ?? [];
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
const nonTagPaths = changedPaths.filter((path) => splitJsonPath(path)[0] !== "tags");
|
|
2277
|
+
if (nonTagPaths.length > 0) {
|
|
2278
|
+
Obj3.change(object, () => {
|
|
2279
|
+
for (const path of nonTagPaths) {
|
|
2280
|
+
const parts = splitJsonPath(path);
|
|
2281
|
+
const value3 = Obj3.getValue(values2, parts);
|
|
2282
|
+
Obj3.setValue(object, parts, value3);
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
}, [
|
|
2287
|
+
object
|
|
2288
|
+
]);
|
|
2289
|
+
return /* @__PURE__ */ React18.createElement(Form.Root, {
|
|
2290
|
+
schema: formSchema,
|
|
2291
|
+
defaultValues: values,
|
|
2292
|
+
createTypename: Type2.getTypename(Tag2.Tag),
|
|
2293
|
+
createOptionIcon: "ph--plus--regular",
|
|
2294
|
+
createOptionLabel: [
|
|
2295
|
+
"add-tag.label",
|
|
2296
|
+
{
|
|
2297
|
+
ns: translationKey
|
|
2298
|
+
}
|
|
2299
|
+
],
|
|
2300
|
+
createInitialValuePath: "label",
|
|
2301
|
+
createFieldMap,
|
|
2302
|
+
db,
|
|
2303
|
+
onValuesChanged: handleChange,
|
|
2304
|
+
onCreate: handleCreate
|
|
2305
|
+
}, /* @__PURE__ */ React18.createElement(Form.Viewport, null, /* @__PURE__ */ React18.createElement(Form.Content, null, /* @__PURE__ */ React18.createElement(Form.FieldSet, null))));
|
|
2306
|
+
};
|
|
2307
|
+
|
|
2308
|
+
// src/components/ObjectProperties/ObjectProperties.tsx
|
|
2309
|
+
import * as Function from "effect/Function";
|
|
2310
|
+
import * as Option4 from "effect/Option";
|
|
2311
|
+
import * as Schema4 from "effect/Schema";
|
|
2312
|
+
import React19, { useCallback as useCallback16, useMemo as useMemo9 } from "react";
|
|
2313
|
+
import { DXN as DXN3, Obj as Obj4, Ref as Ref4, Tag as Tag3, Type as Type3 } from "@dxos/echo";
|
|
2314
|
+
import { splitJsonPath as splitJsonPath2 } from "@dxos/echo/internal";
|
|
2315
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
2316
|
+
import { HuePicker as HuePicker3 } from "@dxos/react-ui-pickers";
|
|
2317
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
|
|
2318
|
+
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
2319
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ObjectProperties/ObjectProperties.tsx";
|
|
2320
|
+
var ObjectProperties = composable2(({ children, object, ...props }, forwardedRef) => {
|
|
2321
|
+
const db = Obj4.getDatabase(object);
|
|
2322
|
+
const meta = Obj4.getMeta(object);
|
|
2323
|
+
const tags = (meta.tags ?? []).map((tag) => db?.makeRef(DXN3.parse(tag))).filter(isNonNullable2);
|
|
2324
|
+
const values = useMemo9(() => ({
|
|
2325
|
+
tags,
|
|
2326
|
+
...object
|
|
2327
|
+
}), [
|
|
2328
|
+
object,
|
|
2329
|
+
tags
|
|
2330
|
+
]);
|
|
2331
|
+
const formSchema = useMemo9(() => {
|
|
2332
|
+
return Function.pipe(Obj4.getSchema(object), Option4.fromNullable, Option4.map((schema) => omitId(BaseSchema.pipe(Schema4.extend(schema)))), Option4.getOrUndefined);
|
|
2333
|
+
}, [
|
|
2334
|
+
object
|
|
2335
|
+
]);
|
|
2336
|
+
const handleCreate = useCallback16((schema, values2) => {
|
|
2337
|
+
invariant2(db, void 0, {
|
|
2338
|
+
F: __dxlog_file4,
|
|
2339
|
+
L: 40,
|
|
2340
|
+
S: void 0,
|
|
2341
|
+
A: [
|
|
2342
|
+
"db",
|
|
2343
|
+
""
|
|
2344
|
+
]
|
|
2345
|
+
});
|
|
2346
|
+
invariant2(Type3.isObjectSchema(schema), void 0, {
|
|
2347
|
+
F: __dxlog_file4,
|
|
2348
|
+
L: 41,
|
|
2349
|
+
S: void 0,
|
|
2350
|
+
A: [
|
|
2351
|
+
"Type.isObjectSchema(schema)",
|
|
2352
|
+
""
|
|
2353
|
+
]
|
|
2354
|
+
});
|
|
2355
|
+
const newObject = db.add(Obj4.make(schema, values2));
|
|
2356
|
+
if (Obj4.instanceOf(Tag3.Tag, newObject)) {
|
|
2357
|
+
Obj4.change(object, (object2) => {
|
|
2358
|
+
Obj4.getMeta(object2).tags = [
|
|
2359
|
+
...Obj4.getMeta(object2).tags ?? [],
|
|
2360
|
+
Obj4.getDXN(newObject).toString()
|
|
2361
|
+
];
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
}, []);
|
|
2365
|
+
const handleChange = useCallback16(({ tags: tags2, ...values2 }, { isValid, changed }) => {
|
|
2366
|
+
if (!isValid) {
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path]);
|
|
2370
|
+
const hasTagsChange = changedPaths.some((path) => splitJsonPath2(path)[0] === "tags");
|
|
2371
|
+
if (hasTagsChange) {
|
|
2372
|
+
Obj4.change(object, (object2) => {
|
|
2373
|
+
Obj4.getMeta(object2).tags = tags2?.map((tag) => tag.dxn.toString()) ?? [];
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
const nonTagPaths = changedPaths.filter((path) => splitJsonPath2(path)[0] !== "tags");
|
|
2377
|
+
if (nonTagPaths.length > 0) {
|
|
2378
|
+
Obj4.change(object, () => {
|
|
2379
|
+
for (const path of nonTagPaths) {
|
|
2380
|
+
const parts = splitJsonPath2(path);
|
|
2381
|
+
const value3 = Obj4.getValue(values2, parts);
|
|
2382
|
+
Obj4.setValue(object, parts, value3);
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
}, [
|
|
2387
|
+
object
|
|
2388
|
+
]);
|
|
2389
|
+
if (!formSchema) {
|
|
2390
|
+
return null;
|
|
2391
|
+
}
|
|
2392
|
+
return /* @__PURE__ */ React19.createElement(Form.Root, {
|
|
2393
|
+
schema: formSchema,
|
|
2394
|
+
defaultValues: values,
|
|
2395
|
+
createTypename: Type3.getTypename(Tag3.Tag),
|
|
2396
|
+
createOptionIcon: "ph--plus--regular",
|
|
2397
|
+
createOptionLabel: [
|
|
2398
|
+
"add-tag.label",
|
|
2399
|
+
{
|
|
2400
|
+
ns: translationKey
|
|
2401
|
+
}
|
|
2402
|
+
],
|
|
2403
|
+
createInitialValuePath: "label",
|
|
2404
|
+
createFieldMap: createFieldMap2,
|
|
2405
|
+
db,
|
|
2406
|
+
onValuesChanged: handleChange,
|
|
2407
|
+
onCreate: handleCreate
|
|
2408
|
+
}, /* @__PURE__ */ React19.createElement(Form.Viewport, {
|
|
2409
|
+
...composableProps2(props),
|
|
2410
|
+
ref: forwardedRef
|
|
2411
|
+
}, /* @__PURE__ */ React19.createElement(Form.Content, null, /* @__PURE__ */ React19.createElement(Form.FieldSet, null), children)));
|
|
2412
|
+
});
|
|
2413
|
+
var createFieldMap2 = {
|
|
2414
|
+
hue: ({ type, label, layout, getValue, onValueChange }) => {
|
|
2415
|
+
const handleChange = useCallback16((nextHue) => onValueChange(type, nextHue), [
|
|
2416
|
+
onValueChange,
|
|
2417
|
+
type
|
|
2418
|
+
]);
|
|
2419
|
+
const handleReset = useCallback16(() => onValueChange(type, void 0), [
|
|
2420
|
+
onValueChange,
|
|
2421
|
+
type
|
|
2422
|
+
]);
|
|
2423
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, layout !== "inline" && /* @__PURE__ */ React19.createElement(Form.Label, {
|
|
2424
|
+
label
|
|
2425
|
+
}), /* @__PURE__ */ React19.createElement(HuePicker3, {
|
|
2426
|
+
value: getValue(),
|
|
2427
|
+
onChange: handleChange,
|
|
2428
|
+
onReset: handleReset
|
|
2429
|
+
}));
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
var BaseSchema = Schema4.Struct({
|
|
2433
|
+
tags: Schema4.Array(Ref4.Ref(Tag3.Tag)).pipe(Schema4.optional)
|
|
2434
|
+
});
|
|
2435
|
+
|
|
2436
|
+
// src/components/Settings/Settings.tsx
|
|
2437
|
+
import React20 from "react";
|
|
2438
|
+
import { Input as Input12, ScrollArea as ScrollArea2, toLocalizedString, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
2439
|
+
import { composable as composable3, composableProps as composableProps3, mx as mx4 } from "@dxos/ui-theme";
|
|
2440
|
+
var SETTINGS_ROOT_NAME = "Settings.Root";
|
|
2441
|
+
var SETTINGS_VIEWPORT_NAME = "Settings.Viewport";
|
|
2442
|
+
var SETTINGS_SECTION_NAME = "Settings.Section";
|
|
2443
|
+
var SETTINGS_PANEL_NAME = "Settings.Panel";
|
|
2444
|
+
var SETTINGS_ITEM_NAME = "Settings.Item";
|
|
2445
|
+
var SettingsRoot = ({ children, classNames }) => {
|
|
2446
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
2447
|
+
className: mx4("flex flex-col gap-2", classNames)
|
|
2448
|
+
}, children);
|
|
2449
|
+
};
|
|
2450
|
+
SettingsRoot.displayName = SETTINGS_ROOT_NAME;
|
|
2451
|
+
var SettingsViewport = composable3(({ children, ...props }, forwardedRef) => {
|
|
2452
|
+
return /* @__PURE__ */ React20.createElement(ScrollArea2.Root, {
|
|
2453
|
+
...composableProps3(props),
|
|
2454
|
+
orientation: "vertical",
|
|
2455
|
+
centered: true,
|
|
2456
|
+
thin: true,
|
|
2457
|
+
ref: forwardedRef
|
|
2458
|
+
}, /* @__PURE__ */ React20.createElement(ScrollArea2.Viewport, {
|
|
2459
|
+
classNames: "px-4 pointer-coarse:px-2"
|
|
2460
|
+
}, /* @__PURE__ */ React20.createElement("div", {
|
|
2461
|
+
role: "none",
|
|
2462
|
+
className: "dx-document flex flex-col gap-2 py-4"
|
|
2463
|
+
}, children)));
|
|
2464
|
+
});
|
|
2465
|
+
SettingsViewport.displayName = SETTINGS_VIEWPORT_NAME;
|
|
2466
|
+
var SettingsSection = ({ title, description, children }) => {
|
|
2467
|
+
const { t } = useTranslation9(translationKey);
|
|
2468
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement("h2", {
|
|
2469
|
+
className: "px-trim-md mt-trim-md text-xl"
|
|
2470
|
+
}, toLocalizedString(title, t)), description && /* @__PURE__ */ React20.createElement("p", {
|
|
2471
|
+
className: "px-trim-md text-description"
|
|
2472
|
+
}, toLocalizedString(description, t)), /* @__PURE__ */ React20.createElement("div", {
|
|
2473
|
+
className: "w-full pt-trim-md space-y-trim-md"
|
|
2474
|
+
}, children));
|
|
2475
|
+
};
|
|
2476
|
+
SettingsSection.displayName = SETTINGS_SECTION_NAME;
|
|
2477
|
+
var SettingsPanel = ({ classNames, children }) => {
|
|
2478
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
2479
|
+
role: "none",
|
|
2480
|
+
className: mx4("flex flex-col gap-3 p-trim-md border border-separator rounded-sm", classNames)
|
|
2481
|
+
}, children);
|
|
2482
|
+
};
|
|
2483
|
+
SettingsPanel.displayName = SETTINGS_PANEL_NAME;
|
|
2484
|
+
var SettingsItem = ({ title, description = "", children }) => {
|
|
2485
|
+
const { t } = useTranslation9(translationKey);
|
|
2486
|
+
return /* @__PURE__ */ React20.createElement(Input12.Root, null, /* @__PURE__ */ React20.createElement(SettingsPanel, {
|
|
2487
|
+
classNames: "grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-x-trim-lg gap-y-0"
|
|
2488
|
+
}, /* @__PURE__ */ React20.createElement(Input12.Label, {
|
|
2489
|
+
classNames: "pb-trim-md text-base-surface-text text-lg md:col-span-2"
|
|
2490
|
+
}, toLocalizedString(title, t)), /* @__PURE__ */ React20.createElement(Input12.DescriptionAndValidation, null, /* @__PURE__ */ React20.createElement(Input12.Description, {
|
|
2491
|
+
classNames: "text-base text-description"
|
|
2492
|
+
}, toLocalizedString(description, t))), /* @__PURE__ */ React20.createElement("div", {
|
|
2493
|
+
role: "none",
|
|
2494
|
+
className: "text-end py-1"
|
|
2495
|
+
}, children)));
|
|
2496
|
+
};
|
|
2497
|
+
SettingsItem.displayName = SETTINGS_ITEM_NAME;
|
|
2498
|
+
var Settings = {
|
|
2499
|
+
Root: SettingsRoot,
|
|
2500
|
+
Viewport: SettingsViewport,
|
|
2501
|
+
Section: SettingsSection,
|
|
2502
|
+
Panel: SettingsPanel,
|
|
2503
|
+
Item: SettingsItem
|
|
2181
2504
|
};
|
|
2182
2505
|
|
|
2183
2506
|
// src/components/ViewEditor/ViewEditor.tsx
|
|
2184
2507
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
2185
|
-
import * as
|
|
2508
|
+
import * as Array4 from "effect/Array";
|
|
2186
2509
|
import * as Match2 from "effect/Match";
|
|
2187
|
-
import * as
|
|
2188
|
-
import * as
|
|
2189
|
-
import
|
|
2190
|
-
import { Filter as Filter2, Format as Format5, Obj as
|
|
2510
|
+
import * as Option5 from "effect/Option";
|
|
2511
|
+
import * as Schema5 from "effect/Schema";
|
|
2512
|
+
import React21, { forwardRef as forwardRef2, useCallback as useCallback17, useContext, useImperativeHandle, useMemo as useMemo10, useState as useState6 } from "react";
|
|
2513
|
+
import { Entity as Entity2, Feed, Filter as Filter2, Format as Format5, Obj as Obj5, Query, QueryAST, Ref as Ref5 } from "@dxos/echo";
|
|
2514
|
+
import { View } from "@dxos/echo";
|
|
2191
2515
|
import { EchoSchema, isMutable, toJsonSchema } from "@dxos/echo/internal";
|
|
2192
|
-
import { invariant } from "@dxos/invariant";
|
|
2193
|
-
import {
|
|
2516
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
2517
|
+
import { useObject, useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
2518
|
+
import { IconButton as IconButton4, Input as Input13, Message, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
2194
2519
|
import { QueryForm } from "@dxos/react-ui-components";
|
|
2195
2520
|
import { List as List2 } from "@dxos/react-ui-list";
|
|
2196
|
-
import {
|
|
2197
|
-
import { mx as
|
|
2198
|
-
var
|
|
2199
|
-
var
|
|
2200
|
-
var listItemGrid = "grid grid-cols-subgrid col-span-5";
|
|
2201
|
-
var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode = "schema", registry, readonly, showHeading = false, types, tags, onQueryChanged, onDelete }, forwardedRef) => {
|
|
2521
|
+
import { ParentLabelAnnotation, ProjectionModel, VIEW_FIELD_LIMIT, createEchoChangeCallback, getTypenameFromQuery } from "@dxos/schema";
|
|
2522
|
+
import { mx as mx5, osTranslations as osTranslations2, subtleHover as subtleHover2 } from "@dxos/ui-theme";
|
|
2523
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
2524
|
+
var ViewEditor = /* @__PURE__ */ forwardRef2(({ classNames, schema, view, mode = "schema", registry, db, readonly, showHeading = false, types, tags, onQueryChanged, onDelete }, forwardedRef) => {
|
|
2202
2525
|
const atomRegistry = useContext(RegistryContext);
|
|
2203
2526
|
const schemaReadonly = !isMutable(schema);
|
|
2204
2527
|
const { t } = useTranslation10(translationKey);
|
|
2205
|
-
const projectionModel =
|
|
2528
|
+
const projectionModel = useMemo10(() => {
|
|
2206
2529
|
const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
|
|
2207
|
-
const change = schema instanceof EchoSchema ?
|
|
2530
|
+
const change = createEchoChangeCallback(view, schema instanceof EchoSchema ? schema : void 0);
|
|
2208
2531
|
const model = new ProjectionModel({
|
|
2209
2532
|
registry: atomRegistry,
|
|
2210
2533
|
view,
|
|
@@ -2220,14 +2543,27 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
|
|
|
2220
2543
|
useImperativeHandle(forwardedRef, () => projectionModel, [
|
|
2221
2544
|
projectionModel
|
|
2222
2545
|
]);
|
|
2223
|
-
const [expandedField, setExpandedField] = useState6();
|
|
2224
2546
|
const queueTarget = Match2.value(view.query.ast).pipe(Match2.when({
|
|
2225
|
-
type: "
|
|
2226
|
-
}, ({
|
|
2227
|
-
|
|
2547
|
+
type: "from"
|
|
2548
|
+
}, ({ from }) => {
|
|
2549
|
+
if (from._tag !== "scope") {
|
|
2550
|
+
return void 0;
|
|
2551
|
+
}
|
|
2552
|
+
return Option5.fromNullable(from.scope.queues).pipe(Option5.flatMap((queues) => Array4.head(queues)), Option5.map(String), Option5.getOrUndefined);
|
|
2228
2553
|
}), Match2.orElse(() => void 0));
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2554
|
+
const feeds = useQuery2(db, Filter2.type(Feed.Feed));
|
|
2555
|
+
const targetRef = useMemo10(() => {
|
|
2556
|
+
if (!queueTarget) {
|
|
2557
|
+
return void 0;
|
|
2558
|
+
}
|
|
2559
|
+
const feed = feeds.find((feed2) => Feed.getQueueDxn(feed2)?.toString() === queueTarget);
|
|
2560
|
+
return feed ? Ref5.fromDXN(Entity2.getDXN(feed)) : void 0;
|
|
2561
|
+
}, [
|
|
2562
|
+
queueTarget,
|
|
2563
|
+
feeds
|
|
2564
|
+
]);
|
|
2565
|
+
const viewSchema = useMemo10(() => {
|
|
2566
|
+
const base = Schema5.Struct({
|
|
2231
2567
|
query: mode === "schema" ? Format5.URL.annotations({
|
|
2232
2568
|
title: "Record type"
|
|
2233
2569
|
}) : QueryAST.Query.annotations({
|
|
@@ -2235,26 +2571,27 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
|
|
|
2235
2571
|
})
|
|
2236
2572
|
});
|
|
2237
2573
|
if (mode === "tag") {
|
|
2238
|
-
return
|
|
2574
|
+
return Schema5.Struct({
|
|
2239
2575
|
...base.fields,
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2576
|
+
// TODO(wittjosiah): Replace Type.Feed with Dataset.Dataset when Ref.Ref supports unions.
|
|
2577
|
+
target: Ref5.Ref(Feed.Feed).pipe(Schema5.annotations({
|
|
2578
|
+
title: "Target Feed"
|
|
2579
|
+
}), ParentLabelAnnotation.set(true), Schema5.optional)
|
|
2580
|
+
}).pipe(Schema5.mutable);
|
|
2244
2581
|
}
|
|
2245
|
-
return base.pipe(
|
|
2582
|
+
return base.pipe(Schema5.mutable);
|
|
2246
2583
|
}, [
|
|
2247
2584
|
mode
|
|
2248
2585
|
]);
|
|
2249
|
-
const viewValues =
|
|
2586
|
+
const viewValues = useMemo10(() => ({
|
|
2250
2587
|
query: mode === "schema" ? getTypenameFromQuery(view.query.ast) : view.query.ast,
|
|
2251
|
-
target:
|
|
2588
|
+
target: targetRef
|
|
2252
2589
|
}), [
|
|
2253
2590
|
mode,
|
|
2254
2591
|
view.query.ast,
|
|
2255
|
-
|
|
2592
|
+
targetRef
|
|
2256
2593
|
]);
|
|
2257
|
-
const fieldMap =
|
|
2594
|
+
const fieldMap = useMemo10(() => mode === "tag" ? customFields({
|
|
2258
2595
|
types,
|
|
2259
2596
|
tags
|
|
2260
2597
|
}) : void 0, [
|
|
@@ -2262,93 +2599,70 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
|
|
|
2262
2599
|
types,
|
|
2263
2600
|
tags
|
|
2264
2601
|
]);
|
|
2265
|
-
const
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
}
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
}, [
|
|
2278
|
-
projectionModel,
|
|
2279
|
-
readonly
|
|
2280
|
-
]);
|
|
2281
|
-
const handleUpdate = useCallback15((values) => {
|
|
2282
|
-
requestAnimationFrame(() => {
|
|
2283
|
-
const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : values.query;
|
|
2284
|
-
onQueryChanged?.(query, values.target);
|
|
2285
|
-
});
|
|
2602
|
+
const handleUpdate = useCallback17((values) => {
|
|
2603
|
+
const targetValue = values.target;
|
|
2604
|
+
let queueDxn;
|
|
2605
|
+
if (Ref5.isRef(targetValue)) {
|
|
2606
|
+
const feedDxn = targetValue.dxn.toString();
|
|
2607
|
+
const feed = feeds.find((feed2) => Obj5.getDXN(feed2).toString() === feedDxn);
|
|
2608
|
+
if (feed) {
|
|
2609
|
+
queueDxn = Feed.getQueueDxn(feed)?.toString();
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : JSON.parse(JSON.stringify(values.query));
|
|
2613
|
+
onQueryChanged?.(query, queueDxn);
|
|
2286
2614
|
}, [
|
|
2287
2615
|
onQueryChanged,
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
mode
|
|
2616
|
+
mode,
|
|
2617
|
+
feeds
|
|
2291
2618
|
]);
|
|
2292
|
-
const handleDelete =
|
|
2293
|
-
|
|
2294
|
-
F:
|
|
2295
|
-
L:
|
|
2619
|
+
const handleDelete = useCallback17((fieldId) => {
|
|
2620
|
+
invariant3(!readonly, void 0, {
|
|
2621
|
+
F: __dxlog_file5,
|
|
2622
|
+
L: 185,
|
|
2296
2623
|
S: void 0,
|
|
2297
2624
|
A: [
|
|
2298
2625
|
"!readonly",
|
|
2299
2626
|
""
|
|
2300
2627
|
]
|
|
2301
2628
|
});
|
|
2302
|
-
if (fieldId === expandedField) {
|
|
2303
|
-
setExpandedField(void 0);
|
|
2304
|
-
}
|
|
2305
2629
|
onDelete?.(fieldId);
|
|
2306
2630
|
}, [
|
|
2307
|
-
expandedField,
|
|
2308
2631
|
onDelete,
|
|
2309
2632
|
readonly
|
|
2310
2633
|
]);
|
|
2311
|
-
return /* @__PURE__ */
|
|
2634
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
2312
2635
|
role: "none",
|
|
2313
|
-
className:
|
|
2314
|
-
}, schemaReadonly && !readonly && /* @__PURE__ */
|
|
2636
|
+
className: mx5(classNames)
|
|
2637
|
+
}, schemaReadonly && !readonly && /* @__PURE__ */ React21.createElement(Message.Root, {
|
|
2315
2638
|
valence: "info",
|
|
2316
|
-
classNames: "
|
|
2317
|
-
}, /* @__PURE__ */
|
|
2639
|
+
classNames: "my-form-padding"
|
|
2640
|
+
}, /* @__PURE__ */ React21.createElement(Message.Title, null, t("system-schema.description"))), /* @__PURE__ */ React21.createElement(Form.Root, {
|
|
2318
2641
|
schema: viewSchema,
|
|
2319
2642
|
values: viewValues,
|
|
2320
2643
|
fieldMap,
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
}, /* @__PURE__ */
|
|
2324
|
-
label: t("fields
|
|
2644
|
+
db,
|
|
2645
|
+
onValuesChanged: handleUpdate
|
|
2646
|
+
}, /* @__PURE__ */ React21.createElement(Form.FieldSet, null), /* @__PURE__ */ React21.createElement(FormFieldLabel, {
|
|
2647
|
+
label: t("fields.label"),
|
|
2325
2648
|
asChild: true
|
|
2326
|
-
}), /* @__PURE__ */
|
|
2649
|
+
}), /* @__PURE__ */ React21.createElement(FieldList, {
|
|
2327
2650
|
schema,
|
|
2328
2651
|
view,
|
|
2329
2652
|
registry,
|
|
2330
2653
|
readonly,
|
|
2331
2654
|
showHeading,
|
|
2332
2655
|
onDelete: handleDelete
|
|
2333
|
-
})), !readonly && !expandedField && /* @__PURE__ */ React19.createElement("div", {
|
|
2334
|
-
role: "none",
|
|
2335
|
-
className: "mlb-cardSpacingBlock"
|
|
2336
|
-
}, /* @__PURE__ */ React19.createElement(IconButton4, {
|
|
2337
|
-
icon: "ph--plus--regular",
|
|
2338
|
-
label: t("add property button label"),
|
|
2339
|
-
onClick: readonly ? void 0 : handleAdd,
|
|
2340
|
-
// TODO(burdon): Show field limit in ux (not tooltip).
|
|
2341
|
-
disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,
|
|
2342
|
-
classNames: "is-full"
|
|
2343
2656
|
})));
|
|
2344
2657
|
});
|
|
2345
2658
|
var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDelete }) => {
|
|
2346
2659
|
const atomRegistry = useContext(RegistryContext);
|
|
2347
2660
|
const schemaReadonly = !isMutable(schema);
|
|
2348
2661
|
const { t } = useTranslation10(translationKey);
|
|
2349
|
-
const
|
|
2662
|
+
const [viewSnapshot] = useObject(view);
|
|
2663
|
+
const projectionModel = useMemo10(() => {
|
|
2350
2664
|
const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
|
|
2351
|
-
const change = schema instanceof EchoSchema ?
|
|
2665
|
+
const change = createEchoChangeCallback(view, schema instanceof EchoSchema ? schema : void 0);
|
|
2352
2666
|
const model = new ProjectionModel({
|
|
2353
2667
|
registry: atomRegistry,
|
|
2354
2668
|
view,
|
|
@@ -2362,15 +2676,31 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
|
|
|
2362
2676
|
view
|
|
2363
2677
|
]);
|
|
2364
2678
|
const [expandedField, setExpandedField] = useState6();
|
|
2365
|
-
const
|
|
2679
|
+
const handleAdd = useCallback17(() => {
|
|
2680
|
+
invariant3(!readonly, void 0, {
|
|
2681
|
+
F: __dxlog_file5,
|
|
2682
|
+
L: 250,
|
|
2683
|
+
S: void 0,
|
|
2684
|
+
A: [
|
|
2685
|
+
"!readonly",
|
|
2686
|
+
""
|
|
2687
|
+
]
|
|
2688
|
+
});
|
|
2689
|
+
const field = projectionModel.createFieldProjection();
|
|
2690
|
+
setExpandedField(field.id);
|
|
2691
|
+
}, [
|
|
2692
|
+
projectionModel,
|
|
2693
|
+
readonly
|
|
2694
|
+
]);
|
|
2695
|
+
const handleToggleField = useCallback17((field) => {
|
|
2366
2696
|
setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
|
|
2367
2697
|
}, [
|
|
2368
2698
|
readonly
|
|
2369
2699
|
]);
|
|
2370
|
-
const handleDelete =
|
|
2371
|
-
|
|
2372
|
-
F:
|
|
2373
|
-
L:
|
|
2700
|
+
const handleDelete = useCallback17((fieldId) => {
|
|
2701
|
+
invariant3(!readonly, void 0, {
|
|
2702
|
+
F: __dxlog_file5,
|
|
2703
|
+
L: 264,
|
|
2374
2704
|
S: void 0,
|
|
2375
2705
|
A: [
|
|
2376
2706
|
"!readonly",
|
|
@@ -2386,110 +2716,122 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
|
|
|
2386
2716
|
onDelete,
|
|
2387
2717
|
readonly
|
|
2388
2718
|
]);
|
|
2389
|
-
const handleMove =
|
|
2390
|
-
|
|
2391
|
-
F:
|
|
2392
|
-
L:
|
|
2719
|
+
const handleMove = useCallback17((fromIndex, toIndex) => {
|
|
2720
|
+
invariant3(!readonly, void 0, {
|
|
2721
|
+
F: __dxlog_file5,
|
|
2722
|
+
L: 276,
|
|
2393
2723
|
S: void 0,
|
|
2394
2724
|
A: [
|
|
2395
2725
|
"!readonly",
|
|
2396
2726
|
""
|
|
2397
2727
|
]
|
|
2398
2728
|
});
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2729
|
+
Obj5.change(view, (view2) => {
|
|
2730
|
+
const fields = [
|
|
2731
|
+
...view2.projection.fields
|
|
2732
|
+
];
|
|
2733
|
+
const [moved] = fields.splice(fromIndex, 1);
|
|
2734
|
+
fields.splice(toIndex, 0, moved);
|
|
2735
|
+
view2.projection.fields = fields;
|
|
2406
2736
|
});
|
|
2407
2737
|
}, [
|
|
2408
|
-
view
|
|
2738
|
+
view,
|
|
2409
2739
|
readonly
|
|
2410
2740
|
]);
|
|
2411
|
-
const handleClose =
|
|
2412
|
-
const handleHide =
|
|
2741
|
+
const handleClose = useCallback17(() => setExpandedField(void 0), []);
|
|
2742
|
+
const handleHide = useCallback17((fieldId) => {
|
|
2413
2743
|
setExpandedField(void 0);
|
|
2414
2744
|
projectionModel.hideFieldProjection(fieldId);
|
|
2415
2745
|
}, [
|
|
2416
2746
|
projectionModel
|
|
2417
2747
|
]);
|
|
2418
|
-
const handleShow =
|
|
2748
|
+
const handleShow = useCallback17((property) => {
|
|
2419
2749
|
setExpandedField(void 0);
|
|
2420
2750
|
projectionModel.showFieldProjection(property);
|
|
2421
2751
|
}, [
|
|
2422
2752
|
projectionModel
|
|
2423
2753
|
]);
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2754
|
+
if (!viewSnapshot) {
|
|
2755
|
+
return null;
|
|
2756
|
+
}
|
|
2757
|
+
return /* @__PURE__ */ React21.createElement(List2.Root, {
|
|
2758
|
+
items: viewSnapshot.projection.fields,
|
|
2759
|
+
isItem: Schema5.is(View.FieldSchema),
|
|
2427
2760
|
getId: (field) => field.id,
|
|
2428
2761
|
onMove: readonly ? void 0 : handleMove,
|
|
2429
2762
|
readonly
|
|
2430
|
-
}, ({ items: fields }) => /* @__PURE__ */
|
|
2763
|
+
}, ({ items: fields }) => /* @__PURE__ */ React21.createElement(React21.Fragment, null, showHeading && /* @__PURE__ */ React21.createElement("h3", {
|
|
2431
2764
|
className: "text-sm"
|
|
2432
|
-
}, t("field
|
|
2765
|
+
}, t("field-path.label")), /* @__PURE__ */ React21.createElement("div", {
|
|
2433
2766
|
role: "list",
|
|
2434
|
-
className:
|
|
2767
|
+
className: "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]"
|
|
2435
2768
|
}, fields?.map((field) => {
|
|
2436
2769
|
const hidden = field.visible === false;
|
|
2437
|
-
return /* @__PURE__ */
|
|
2770
|
+
return /* @__PURE__ */ React21.createElement(List2.Item, {
|
|
2438
2771
|
key: field.id,
|
|
2439
2772
|
item: field,
|
|
2440
|
-
classNames:
|
|
2773
|
+
classNames: "grid grid-cols-subgrid col-span-5",
|
|
2441
2774
|
"aria-expanded": expandedField === field.id
|
|
2442
|
-
}, /* @__PURE__ */
|
|
2775
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
|
2443
2776
|
role: "none",
|
|
2444
|
-
className:
|
|
2445
|
-
}, /* @__PURE__ */
|
|
2777
|
+
className: mx5(subtleHover2, "grid grid-cols-subgrid col-span-5", "rounded-xs cursor-pointer min-h-10")
|
|
2778
|
+
}, /* @__PURE__ */ React21.createElement(List2.ItemDragHandle, {
|
|
2446
2779
|
disabled: readonly || schemaReadonly
|
|
2447
|
-
}), /* @__PURE__ */
|
|
2780
|
+
}), /* @__PURE__ */ React21.createElement(List2.ItemTitle, {
|
|
2448
2781
|
classNames: hidden && "text-subdued",
|
|
2449
2782
|
onClick: () => handleToggleField(field)
|
|
2450
|
-
}, field.path), /* @__PURE__ */
|
|
2783
|
+
}, field.path), /* @__PURE__ */ React21.createElement(List2.ItemIconButton, {
|
|
2451
2784
|
label: t(hidden ? "show field label" : "hide field label"),
|
|
2452
2785
|
"data-testid": hidden ? "show-field-button" : "hide-field-button",
|
|
2453
2786
|
icon: hidden ? "ph--eye-closed--regular" : "ph--eye--regular",
|
|
2454
2787
|
autoHide: false,
|
|
2455
2788
|
disabled: readonly || !hidden && projectionModel.getFields().length <= 1,
|
|
2456
2789
|
onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
|
|
2457
|
-
}), !readonly && /* @__PURE__ */
|
|
2458
|
-
label: t("delete
|
|
2790
|
+
}), !readonly && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(List2.ItemDeleteButton, {
|
|
2791
|
+
label: t("delete-field.label"),
|
|
2459
2792
|
autoHide: false,
|
|
2460
|
-
disabled: readonly || schemaReadonly ||
|
|
2793
|
+
disabled: readonly || schemaReadonly || viewSnapshot.projection.fields.length <= 1,
|
|
2461
2794
|
onClick: () => handleDelete(field.id),
|
|
2462
2795
|
"data-testid": "field.delete"
|
|
2463
|
-
}), /* @__PURE__ */
|
|
2796
|
+
}), /* @__PURE__ */ React21.createElement(List2.ItemIconButton, {
|
|
2464
2797
|
iconOnly: true,
|
|
2465
2798
|
variant: "ghost",
|
|
2466
|
-
label: t("toggle
|
|
2799
|
+
label: t("toggle-expand.label", {
|
|
2467
2800
|
ns: osTranslations2
|
|
2468
2801
|
}),
|
|
2469
2802
|
icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
|
|
2470
2803
|
onClick: () => handleToggleField(field),
|
|
2471
2804
|
"data-testid": "field.toggle"
|
|
2472
|
-
}))), expandedField === field.id && !readonly && /* @__PURE__ */
|
|
2805
|
+
}))), expandedField === field.id && !readonly && /* @__PURE__ */ React21.createElement("div", {
|
|
2473
2806
|
role: "none",
|
|
2474
|
-
className: "col-span-
|
|
2475
|
-
}, /* @__PURE__ */
|
|
2807
|
+
className: "col-span-full mt-1 mb-1 border border-separator rounded-md"
|
|
2808
|
+
}, /* @__PURE__ */ React21.createElement(FieldEditor, {
|
|
2476
2809
|
readonly: readonly || schemaReadonly,
|
|
2477
2810
|
registry,
|
|
2478
2811
|
projection: projectionModel,
|
|
2479
2812
|
field,
|
|
2480
2813
|
onSave: handleClose
|
|
2481
2814
|
})));
|
|
2815
|
+
})), !readonly && !expandedField && /* @__PURE__ */ React21.createElement("div", {
|
|
2816
|
+
role: "none",
|
|
2817
|
+
className: "my-form-padding"
|
|
2818
|
+
}, /* @__PURE__ */ React21.createElement(IconButton4, {
|
|
2819
|
+
icon: "ph--plus--regular",
|
|
2820
|
+
label: t("add-property-button.label"),
|
|
2821
|
+
onClick: handleAdd,
|
|
2822
|
+
disabled: viewSnapshot.projection.fields.length >= VIEW_FIELD_LIMIT,
|
|
2823
|
+
classNames: "w-full"
|
|
2482
2824
|
}))));
|
|
2483
2825
|
};
|
|
2484
2826
|
var customFields = ({ types, tags }) => ({
|
|
2485
2827
|
query: ({ type, readonly, label, getValue, onValueChange }) => {
|
|
2486
|
-
const handleChange =
|
|
2828
|
+
const handleChange = useCallback17((query) => onValueChange(type, query.ast), [
|
|
2487
2829
|
onValueChange
|
|
2488
2830
|
]);
|
|
2489
|
-
return /* @__PURE__ */
|
|
2831
|
+
return /* @__PURE__ */ React21.createElement(Input13.Root, null, /* @__PURE__ */ React21.createElement(FormFieldLabel, {
|
|
2490
2832
|
readonly,
|
|
2491
2833
|
label
|
|
2492
|
-
}), /* @__PURE__ */
|
|
2834
|
+
}), /* @__PURE__ */ React21.createElement(QueryForm, {
|
|
2493
2835
|
initialQuery: getValue(),
|
|
2494
2836
|
types,
|
|
2495
2837
|
tags,
|
|
@@ -2500,15 +2842,6 @@ var customFields = ({ types, tags }) => ({
|
|
|
2500
2842
|
export {
|
|
2501
2843
|
ArrayField,
|
|
2502
2844
|
BooleanField,
|
|
2503
|
-
ControlFrame,
|
|
2504
|
-
ControlFrameItem,
|
|
2505
|
-
ControlGroup,
|
|
2506
|
-
ControlGroupButton,
|
|
2507
|
-
ControlItem,
|
|
2508
|
-
ControlItemInput,
|
|
2509
|
-
ControlPage,
|
|
2510
|
-
ControlSection,
|
|
2511
|
-
ControlSectionHeading,
|
|
2512
2845
|
FieldEditor,
|
|
2513
2846
|
Form,
|
|
2514
2847
|
FormFieldErrorBoundary,
|
|
@@ -2517,16 +2850,18 @@ export {
|
|
|
2517
2850
|
GeoPointField,
|
|
2518
2851
|
MarkdownField,
|
|
2519
2852
|
NumberField,
|
|
2853
|
+
ObjectForm,
|
|
2520
2854
|
ObjectPicker,
|
|
2855
|
+
ObjectProperties,
|
|
2521
2856
|
RefField,
|
|
2522
2857
|
SelectField,
|
|
2523
2858
|
SelectOptionField,
|
|
2859
|
+
Settings,
|
|
2524
2860
|
TextAreaField,
|
|
2525
2861
|
TextField,
|
|
2526
2862
|
TupleField,
|
|
2527
2863
|
ViewEditor,
|
|
2528
2864
|
cellClassesForFieldType,
|
|
2529
|
-
controlItemClasses,
|
|
2530
2865
|
formatForDisplay,
|
|
2531
2866
|
formatForEditing,
|
|
2532
2867
|
getDefaultValue,
|