@nivaro/react 0.2.50 → 0.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +204 -6
- package/dist/index.js +442 -439
- package/dist/layout-editor.d.ts +80 -0
- package/dist/layout-editor.js +11 -0
- package/dist/shared/components/ItemEditForm.js +4117 -3882
- package/dist/shared/components/RecordDrilldownSheet.js +114 -97
- package/dist/shared/components/RecordReadView.js +662 -596
- package/dist/shared/components/ai/ExplainButton.js +1 -1
- package/dist/shared/components/chat/ChatPanel.js +1053 -993
- package/dist/shared/components/import/DocumentAutofillButton.js +141 -129
- package/dist/shared/components/item-edit/GroupSection.js +489 -466
- package/dist/shared/components/item-edit/HeaderBand.js +47 -44
- package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
- package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
- package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
- package/dist/shared/components/item-edit/StepsBar.js +49 -43
- package/dist/shared/components/item-edit/SummaryPanel.js +2 -1
- package/dist/shared/components/item-edit/config-update.js +6 -0
- package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
- package/dist/shared/components/layout-editor/AddPanel.js +301 -0
- package/dist/shared/components/layout-editor/DesignNode.js +173 -0
- package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
- package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
- package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
- package/dist/shared/components/layout-editor/add-target.js +103 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
- package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
- package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
- package/dist/shared/components/layout-editor/collection-meta.js +22 -0
- package/dist/shared/components/layout-editor/design-canvas.js +81 -0
- package/dist/shared/components/layout-editor/design-context.js +21 -0
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
- package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
- package/dist/shared/components/layout-editor/dnd/node.js +164 -0
- package/dist/shared/components/layout-editor/dnd/order.js +122 -0
- package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
- package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
- package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
- package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
- package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
- package/dist/shared/components/layout-editor/editors/controls.js +73 -0
- package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
- package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
- package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
- package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
- package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
- package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
- package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
- package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
- package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
- package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
- package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
- package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
- package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
- package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
- package/dist/shared/components/layout-editor/host.js +15 -0
- package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
- package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
- package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
- package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
- package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
- package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
- package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
- package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
- package/dist/shared/components/layout-editor/inspector/model.js +307 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
- package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
- package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
- package/dist/shared/components/layout-editor/panel-frame.js +99 -0
- package/dist/shared/components/layout-editor/panel-style.js +19 -0
- package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
- package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
- package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
- package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
- package/dist/shared/components/layout-editor/record-queries.js +15 -0
- package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
- package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
- package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
- package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
- package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
- package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
- package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
- package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
- package/dist/shared/components/layout-editor/settings/controls.js +214 -0
- package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
- package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
- package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
- package/dist/shared/components/layout-editor/slot-names.js +20 -0
- package/dist/shared/components/layout-editor/summary-pref.js +21 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
- package/dist/shared/components/pipeline/relations.js +28 -23
- package/dist/shared/components/ui/dialog.js +11 -11
- package/dist/shared/components/ui/popover.js +17 -17
- package/dist/shared/components/ui/scroll-area.js +38 -0
- package/dist/shared/hooks/useRelationOptions.js +60 -0
- package/dist/shared/lib/layout-grants.js +9 -0
- package/dist/shared/lib/layout-ops.js +348 -0
- package/dist/shared/lib/layout-slots.js +11 -7
- package/dist/shared/lib/presence-state.js +43 -13
- package/dist/shared/lib/request-gate.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useState as J, useEffect as z } from "react";
|
|
3
|
+
import { titleCase as T } from "../../../lib/utils.js";
|
|
4
|
+
import { RoleConditionRow as K } from "../editors/lock-conditions.js";
|
|
5
|
+
import { O2MAggFieldCombobox as Q } from "../editors/o2m-agg-field.js";
|
|
6
|
+
import { SwapConfigEditor as V } from "../editors/swap-config.js";
|
|
7
|
+
import { IconPicker as Z } from "../pickers/icon-picker.js";
|
|
8
|
+
import { useCollectionMeta as ee } from "./field-context.js";
|
|
9
|
+
import { useInspectorEnv as te, Setting as d, TextInput as G, Choice as L, Segmented as w, Toggle as O, TextArea as le, Section as A, FieldMultiPicker as ae, ConditionBuilder as ne } from "./kit.js";
|
|
10
|
+
import { groupFields as oe, asArray as b, relKindOf as ie, describeField as se, relatedCollectionOf as re } from "./model.js";
|
|
11
|
+
const C = {
|
|
12
|
+
section: "Section",
|
|
13
|
+
tab: "Tab or step",
|
|
14
|
+
metadata: "Record info (read-only)",
|
|
15
|
+
container: "Tabs or steps holder",
|
|
16
|
+
content: "Text block"
|
|
17
|
+
};
|
|
18
|
+
function de(l) {
|
|
19
|
+
return typeof l == "string" ? { field: l } : l && typeof l == "object" && typeof l.field == "string" ? l : null;
|
|
20
|
+
}
|
|
21
|
+
function ce(l) {
|
|
22
|
+
const { field: y, label: c, agg: h, agg_field: m, field_options: p } = l;
|
|
23
|
+
return !c && !h ? y : {
|
|
24
|
+
field: y,
|
|
25
|
+
...c ? { label: c } : {},
|
|
26
|
+
...h ? { agg: h, agg_field: m, ...p ? { field_options: p } : {} } : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const g = (l) => l.length ? JSON.stringify(l) : null;
|
|
30
|
+
function ve({ group: l, readOnly: y }) {
|
|
31
|
+
var P;
|
|
32
|
+
const c = te(), { data: h } = ee(c.collection), m = (h == null ? void 0 : h.fields) ?? [], p = (h == null ? void 0 : h.relations) ?? [], a = l.label || T(l.key), r = l.type, o = (e, n, f) => c.apply([{ op: "group_update", key: l.key, patch: e }], { label: n, text: f }), x = c.bundle.groups.filter((e) => e.parent_key === l.key), B = c.bundle.groups.filter((e) => e.type === "container" && e.key !== l.key), E = c.bundle.placements.some((e) => e.group_key === l.key), H = (l.parent_key ? ["tab"] : Object.keys(C)).filter((e) => e === r || !(E && (e === "container" || e === "content"))).map((e) => ({ value: e, label: C[e] })), _ = r === "section" || r === "metadata" || r === "tab", I = m.filter((e) => !e.field.startsWith("__") && e.type !== "alias").map((e) => ({ value: e.field, label: e.label || T(e.field) })).sort((e, n) => e.label.localeCompare(n.label)), F = oe(c.bundle, l.key), k = b(l.summary_fields).map(de).filter((e) => !!e), M = (e, n, f) => o({ summary_fields: g(e.map(ce)) }, n, f), D = b(l.visible_when), v = JSON.stringify(D), [U, R] = J(D);
|
|
33
|
+
z(() => {
|
|
34
|
+
R(
|
|
35
|
+
(e) => JSON.stringify(e.filter((n) => n.field)) === v ? e : JSON.parse(v)
|
|
36
|
+
);
|
|
37
|
+
}, [v]);
|
|
38
|
+
const [X, W] = J(!1);
|
|
39
|
+
return /* @__PURE__ */ s("fieldset", { disabled: y, className: "min-w-0 space-y-5", children: [
|
|
40
|
+
/* @__PURE__ */ t(d, { k: "group.label", label: "Name", effect: "The heading people see.", children: /* @__PURE__ */ t(
|
|
41
|
+
G,
|
|
42
|
+
{
|
|
43
|
+
ariaLabel: "Name",
|
|
44
|
+
value: l.label,
|
|
45
|
+
onChange: (e) => o({ label: e }, `Rename ${a}`, !0)
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
/* @__PURE__ */ t(d, { k: "group.icon", label: "Icon", effect: "Shown before the section title.", children: /* @__PURE__ */ t(
|
|
49
|
+
Z,
|
|
50
|
+
{
|
|
51
|
+
className: "h-8 rounded-md border-slate-200 bg-white px-2.5 text-[13px] hover:bg-white dark:border-border dark:bg-background dark:hover:bg-background",
|
|
52
|
+
value: l.icon ?? "",
|
|
53
|
+
onChange: (e) => o({ icon: e || null }, `Change the icon of ${a}`)
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
d,
|
|
58
|
+
{
|
|
59
|
+
k: "group.type",
|
|
60
|
+
label: "Kind",
|
|
61
|
+
effect: r === "container" && x.length ? "Move its tabs out before changing what this is." : E && !l.parent_key ? "What this part of the form is. To make it a tabs holder or a text block, move its fields out first." : "What this part of the form is.",
|
|
62
|
+
children: /* @__PURE__ */ t(
|
|
63
|
+
L,
|
|
64
|
+
{
|
|
65
|
+
ariaLabel: "Kind",
|
|
66
|
+
disabled: r === "container" && x.length > 0,
|
|
67
|
+
value: r,
|
|
68
|
+
options: H,
|
|
69
|
+
onChange: (e) => {
|
|
70
|
+
var n;
|
|
71
|
+
return o(
|
|
72
|
+
e === "container" ? { type: e, tab_mode: l.tab_mode ?? "tabs" } : { type: e },
|
|
73
|
+
`Make ${a} a ${(n = C[e]) == null ? void 0 : n.toLowerCase()}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
r === "container" && /* @__PURE__ */ t(
|
|
81
|
+
d,
|
|
82
|
+
{
|
|
83
|
+
k: "group.tab_mode",
|
|
84
|
+
label: "Show its tabs as",
|
|
85
|
+
effect: "Steps walk people through in order.",
|
|
86
|
+
children: /* @__PURE__ */ t(
|
|
87
|
+
w,
|
|
88
|
+
{
|
|
89
|
+
value: l.tab_mode === "steps" ? "steps" : "tabs",
|
|
90
|
+
options: [
|
|
91
|
+
{ value: "tabs", label: "Tabs" },
|
|
92
|
+
{ value: "steps", label: "Steps" }
|
|
93
|
+
],
|
|
94
|
+
onChange: (e) => o({ tab_mode: e }, `Show ${a} as ${e}`)
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
r === "tab" && /* @__PURE__ */ t(
|
|
100
|
+
d,
|
|
101
|
+
{
|
|
102
|
+
k: "group.container_id",
|
|
103
|
+
label: "Sits in",
|
|
104
|
+
effect: "Tabs show inside a tabs or steps holder.",
|
|
105
|
+
children: /* @__PURE__ */ t(
|
|
106
|
+
L,
|
|
107
|
+
{
|
|
108
|
+
ariaLabel: "Sits in",
|
|
109
|
+
value: l.parent_key ?? "",
|
|
110
|
+
options: [
|
|
111
|
+
{ value: "", label: "The form itself" },
|
|
112
|
+
...B.map((e) => ({ value: e.key, label: e.label || T(e.key) }))
|
|
113
|
+
],
|
|
114
|
+
onChange: (e) => c.apply(
|
|
115
|
+
[
|
|
116
|
+
{
|
|
117
|
+
op: "group_move",
|
|
118
|
+
key: l.key,
|
|
119
|
+
parent_key: e || null,
|
|
120
|
+
index: Number.MAX_SAFE_INTEGER
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
{ label: e ? `Move ${a} into a holder` : `Move ${a} out of its holder` }
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
(r === "section" || r === "metadata") && /* @__PURE__ */ t(
|
|
130
|
+
O,
|
|
131
|
+
{
|
|
132
|
+
k: "group.is_collapsed",
|
|
133
|
+
label: "Starts collapsed",
|
|
134
|
+
effect: "The section opens folded; people unfold it.",
|
|
135
|
+
checked: l.is_collapsed,
|
|
136
|
+
onChange: (e) => o({ is_collapsed: e }, e ? `Collapse ${a}` : `Expand ${a}`)
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
r === "content" && /* @__PURE__ */ s(j, { children: [
|
|
140
|
+
/* @__PURE__ */ t(
|
|
141
|
+
d,
|
|
142
|
+
{
|
|
143
|
+
k: "group.content_tone",
|
|
144
|
+
label: "Style",
|
|
145
|
+
effect: "Note and Warning are coloured boxes; Divider is a line with the text.",
|
|
146
|
+
children: /* @__PURE__ */ t(
|
|
147
|
+
w,
|
|
148
|
+
{
|
|
149
|
+
value: l.content_tone ?? "info",
|
|
150
|
+
options: [
|
|
151
|
+
{ value: "info", label: "Note" },
|
|
152
|
+
{ value: "warn", label: "Warning" },
|
|
153
|
+
{ value: "divider", label: "Divider" }
|
|
154
|
+
],
|
|
155
|
+
onChange: (e) => o({ content_tone: e }, `Change the style of ${a}`)
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ t(d, { k: "group.content", label: "Text", effect: "The words this block shows on the form.", children: /* @__PURE__ */ t(
|
|
161
|
+
le,
|
|
162
|
+
{
|
|
163
|
+
ariaLabel: "Text",
|
|
164
|
+
value: l.content ?? "",
|
|
165
|
+
onChange: (e) => o({ content: e || null }, `Edit the text of ${a}`, !0)
|
|
166
|
+
}
|
|
167
|
+
) })
|
|
168
|
+
] }),
|
|
169
|
+
_ && /* @__PURE__ */ s(j, { children: [
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
d,
|
|
172
|
+
{
|
|
173
|
+
k: "group.visibility_mode",
|
|
174
|
+
label: "Show",
|
|
175
|
+
effect: "On new records, existing ones or both.",
|
|
176
|
+
children: /* @__PURE__ */ t(
|
|
177
|
+
w,
|
|
178
|
+
{
|
|
179
|
+
value: l.visibility_mode ?? "always",
|
|
180
|
+
options: [
|
|
181
|
+
{ value: "always", label: "Always" },
|
|
182
|
+
{ value: "new_only", label: "New records" },
|
|
183
|
+
{ value: "existing_only", label: "Existing" }
|
|
184
|
+
],
|
|
185
|
+
onChange: (e) => o({ visibility_mode: e }, `Change when ${a} shows`)
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ t(
|
|
191
|
+
O,
|
|
192
|
+
{
|
|
193
|
+
k: "group.hide_when_empty",
|
|
194
|
+
label: "Hide when all its fields are empty",
|
|
195
|
+
effect: "The section disappears while none of its fields has a value.",
|
|
196
|
+
checked: l.hide_when_empty,
|
|
197
|
+
onChange: (e) => o({ hide_when_empty: e }, `Change when ${a} hides`)
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ t(
|
|
201
|
+
d,
|
|
202
|
+
{
|
|
203
|
+
k: "group.read_width",
|
|
204
|
+
label: "Width when reading",
|
|
205
|
+
effect: "On the read view, summary and detail panels. Automatic: half for a short list, full for grids.",
|
|
206
|
+
children: /* @__PURE__ */ t(
|
|
207
|
+
w,
|
|
208
|
+
{
|
|
209
|
+
value: l.read_width ?? "",
|
|
210
|
+
options: [
|
|
211
|
+
{ value: "", label: "Automatic" },
|
|
212
|
+
{ value: "full", label: "Full" },
|
|
213
|
+
{ value: "half", label: "½" },
|
|
214
|
+
{ value: "third", label: "⅓" }
|
|
215
|
+
],
|
|
216
|
+
onChange: (e) => o({ read_width: e || null }, `Change the read width of ${a}`)
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
] }),
|
|
222
|
+
r === "tab" && /* @__PURE__ */ s(A, { title: "As a step", children: [
|
|
223
|
+
/* @__PURE__ */ t(
|
|
224
|
+
d,
|
|
225
|
+
{
|
|
226
|
+
k: "group.skip_if_filled",
|
|
227
|
+
label: "Skip as the first step when filled",
|
|
228
|
+
effect: "Opens on a later step when these fields already have values.",
|
|
229
|
+
children: /* @__PURE__ */ t(
|
|
230
|
+
ae,
|
|
231
|
+
{
|
|
232
|
+
ariaLabel: "Skip as the first step when filled",
|
|
233
|
+
value: b(l.skip_if_filled),
|
|
234
|
+
options: I,
|
|
235
|
+
onChange: (e) => o({ skip_if_filled: g(e) }, `Change when ${a} is skipped`)
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ t(
|
|
241
|
+
d,
|
|
242
|
+
{
|
|
243
|
+
k: "group.visible_when",
|
|
244
|
+
label: "Only when",
|
|
245
|
+
effect: "The step shows only while every condition holds. No conditions: always.",
|
|
246
|
+
children: /* @__PURE__ */ t(
|
|
247
|
+
ne,
|
|
248
|
+
{
|
|
249
|
+
value: U,
|
|
250
|
+
fields: I,
|
|
251
|
+
onChange: (e) => {
|
|
252
|
+
R(e);
|
|
253
|
+
const n = e.filter((f) => f.field);
|
|
254
|
+
JSON.stringify(n) !== v && o({ visible_when: g(n) }, `Change when ${a} shows`, !0);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
] }),
|
|
261
|
+
_ && /* @__PURE__ */ s(A, { title: "Who", children: [
|
|
262
|
+
/* @__PURE__ */ t(
|
|
263
|
+
d,
|
|
264
|
+
{
|
|
265
|
+
k: "group.hidden_for_roles",
|
|
266
|
+
label: "Hidden for",
|
|
267
|
+
effect: "People in these roles do not see it. Admins always do.",
|
|
268
|
+
children: /* @__PURE__ */ t(
|
|
269
|
+
K,
|
|
270
|
+
{
|
|
271
|
+
roleIds: b(l.hidden_for_roles),
|
|
272
|
+
onRoleIdsChange: (e) => o({ hidden_for_roles: g(e) }, `Change who sees ${a}`)
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ t(
|
|
278
|
+
d,
|
|
279
|
+
{
|
|
280
|
+
k: "group.locked_for_roles",
|
|
281
|
+
label: "Read-only for",
|
|
282
|
+
effect: "People in these roles cannot change it; the server drops their writes. Admins are exempt.",
|
|
283
|
+
children: /* @__PURE__ */ t(
|
|
284
|
+
K,
|
|
285
|
+
{
|
|
286
|
+
roleIds: b(l.locked_for_roles),
|
|
287
|
+
onRoleIdsChange: (e) => o({ locked_for_roles: g(e) }, `Change who can edit ${a}`)
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] }),
|
|
293
|
+
_ && /* @__PURE__ */ s(A, { title: "When collapsed", children: [
|
|
294
|
+
/* @__PURE__ */ t(
|
|
295
|
+
d,
|
|
296
|
+
{
|
|
297
|
+
k: "group.summary_fields",
|
|
298
|
+
label: "Show these values in the heading",
|
|
299
|
+
effect: "A short summary while the section is closed.",
|
|
300
|
+
children: F.length === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: [
|
|
301
|
+
"Place fields in ",
|
|
302
|
+
a,
|
|
303
|
+
" first."
|
|
304
|
+
] }) : /* @__PURE__ */ t("div", { className: "space-y-1.5", children: F.map((e) => {
|
|
305
|
+
const n = k.find((i) => i.field === e), f = ie(e, p) === "O2M", Y = c.bundle.placements.find((i) => i.field === e) ?? null, N = se(e, m, p, Y).label, S = (i, u, q) => M(
|
|
306
|
+
k.map(($) => $.field === e ? { ...$, ...i } : $),
|
|
307
|
+
u,
|
|
308
|
+
q
|
|
309
|
+
);
|
|
310
|
+
return /* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
311
|
+
/* @__PURE__ */ s("label", { className: "flex items-center gap-2 text-[12px]", children: [
|
|
312
|
+
/* @__PURE__ */ t(
|
|
313
|
+
"input",
|
|
314
|
+
{
|
|
315
|
+
type: "checkbox",
|
|
316
|
+
checked: !!n,
|
|
317
|
+
onChange: (i) => M(
|
|
318
|
+
i.target.checked ? [...k, f ? { field: e, agg: "count" } : { field: e }] : k.filter((u) => u.field !== e),
|
|
319
|
+
`Change the summary of ${a}`
|
|
320
|
+
),
|
|
321
|
+
className: "h-3.5 w-3.5 accent-nvr-cyan"
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ t("span", { className: "flex-1 truncate", children: N }),
|
|
325
|
+
f && /* @__PURE__ */ t("span", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "list" })
|
|
326
|
+
] }),
|
|
327
|
+
n && /* @__PURE__ */ s("div", { className: "space-y-1 pl-5", children: [
|
|
328
|
+
/* @__PURE__ */ t("div", { "data-setting": "group.summary_fields.label", children: /* @__PURE__ */ t(
|
|
329
|
+
G,
|
|
330
|
+
{
|
|
331
|
+
ariaLabel: `Label for ${N}`,
|
|
332
|
+
value: n.label ?? "",
|
|
333
|
+
placeholder: `Label (${N})`,
|
|
334
|
+
onChange: (i) => S(
|
|
335
|
+
{ label: i || null },
|
|
336
|
+
`Change the summary of ${a}`,
|
|
337
|
+
!0
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
) }),
|
|
341
|
+
f && /* @__PURE__ */ s("div", { className: "flex gap-1", children: [
|
|
342
|
+
/* @__PURE__ */ t("div", { className: "flex-1", "data-setting": "group.summary_fields.agg", children: /* @__PURE__ */ t(
|
|
343
|
+
L,
|
|
344
|
+
{
|
|
345
|
+
ariaLabel: "Show",
|
|
346
|
+
value: n.agg ?? "count",
|
|
347
|
+
options: [
|
|
348
|
+
{ value: "count", label: "Count" },
|
|
349
|
+
{ value: "sum", label: "Sum" },
|
|
350
|
+
{ value: "avg", label: "Average" },
|
|
351
|
+
{ value: "min", label: "Smallest" },
|
|
352
|
+
{ value: "max", label: "Largest" }
|
|
353
|
+
],
|
|
354
|
+
onChange: (i) => S(
|
|
355
|
+
i === "count" ? { agg: i, agg_field: void 0, field_options: void 0 } : { agg: i },
|
|
356
|
+
`Change the summary of ${a}`
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
) }),
|
|
360
|
+
(n.agg ?? "count") !== "count" && /* @__PURE__ */ t(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: "flex-1",
|
|
364
|
+
"data-setting": "group.summary_fields.agg_field",
|
|
365
|
+
children: /* @__PURE__ */ t(
|
|
366
|
+
Q,
|
|
367
|
+
{
|
|
368
|
+
relatedCollection: re(e, p),
|
|
369
|
+
value: n.agg_field ?? "",
|
|
370
|
+
onChange: (i, u) => S(
|
|
371
|
+
{ agg_field: i, field_options: u },
|
|
372
|
+
`Change the summary of ${a}`
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
] })
|
|
379
|
+
] })
|
|
380
|
+
] }, e);
|
|
381
|
+
}) })
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ t(
|
|
385
|
+
O,
|
|
386
|
+
{
|
|
387
|
+
k: "group.summary_hide_empty",
|
|
388
|
+
label: "Leave out empty values",
|
|
389
|
+
effect: "Fields without a value are left out of the summary line.",
|
|
390
|
+
checked: l.summary_hide_empty,
|
|
391
|
+
onChange: (e) => o({ summary_hide_empty: e }, `Change the summary of ${a}`)
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
] }),
|
|
395
|
+
_ && /* @__PURE__ */ t(
|
|
396
|
+
V,
|
|
397
|
+
{
|
|
398
|
+
group: { id: l.id ?? 0, swap_config: l.swap_config },
|
|
399
|
+
allFields: m.map((e) => ({ field: e.field, type: e.type ?? void 0 })),
|
|
400
|
+
onGroupSettings: (e, n) => o(n, `Change the field swap of ${a}`)
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
/* @__PURE__ */ t(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
"data-setting": "group.delete",
|
|
407
|
+
className: "border-t border-slate-200 pt-3 dark:border-border",
|
|
408
|
+
children: X ? /* @__PURE__ */ s("div", { className: "space-y-2 rounded-md border border-red-200 bg-red-50 p-2.5 text-[12px] text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100", children: [
|
|
409
|
+
/* @__PURE__ */ s("p", { children: [
|
|
410
|
+
"Delete ",
|
|
411
|
+
a,
|
|
412
|
+
"? Its fields move to the top of the form",
|
|
413
|
+
x.length ? " and its tabs move out" : "",
|
|
414
|
+
". Undo brings it back."
|
|
415
|
+
] }),
|
|
416
|
+
/* @__PURE__ */ s("div", { className: "flex gap-2", children: [
|
|
417
|
+
/* @__PURE__ */ t(
|
|
418
|
+
"button",
|
|
419
|
+
{
|
|
420
|
+
type: "button",
|
|
421
|
+
onClick: () => c.apply([{ op: "group_remove", key: l.key, placements: "ungroup" }], {
|
|
422
|
+
label: `Delete ${a}`
|
|
423
|
+
}),
|
|
424
|
+
className: "rounded-md bg-red-600 px-2.5 py-1 text-[12px] font-medium text-white hover:bg-red-700",
|
|
425
|
+
children: "Delete"
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ t(
|
|
429
|
+
"button",
|
|
430
|
+
{
|
|
431
|
+
type: "button",
|
|
432
|
+
onClick: () => W(!1),
|
|
433
|
+
className: "rounded-md px-2.5 py-1 text-[12px] hover:bg-red-100 dark:hover:bg-red-900/40",
|
|
434
|
+
children: "Keep"
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
] })
|
|
438
|
+
] }) : /* @__PURE__ */ s(
|
|
439
|
+
"button",
|
|
440
|
+
{
|
|
441
|
+
type: "button",
|
|
442
|
+
onClick: () => W(!0),
|
|
443
|
+
className: "text-[12px] text-red-600 hover:underline dark:text-red-400",
|
|
444
|
+
children: [
|
|
445
|
+
"Delete ",
|
|
446
|
+
((P = C[r]) == null ? void 0 : P.toLowerCase()) ?? "section"
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
] });
|
|
453
|
+
}
|
|
454
|
+
export {
|
|
455
|
+
ve as GroupInspector
|
|
456
|
+
};
|