@nivaro/react 0.2.51 → 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 +4044 -3866
- package/dist/shared/components/RecordDrilldownSheet.js +114 -97
- package/dist/shared/components/RecordReadView.js +637 -570
- package/dist/shared/components/ai/ExplainButton.js +1 -1
- 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 +1 -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/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/request-gate.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as L } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronDown as B, Check as K } from "lucide-react";
|
|
4
|
+
import { useState as b, useRef as U, useEffect as A } from "react";
|
|
5
|
+
import { useNivaroClient as J } from "../../../context.js";
|
|
6
|
+
import { get as N } from "../../../lib/commands.js";
|
|
7
|
+
import { extractTemplateFields as Q, renderDisplayTemplate as d } from "../../pipeline/relations.js";
|
|
8
|
+
import { Input as C } from "../../ui/input.js";
|
|
9
|
+
import { Popover as V, PopoverTrigger as z, PopoverContent as G } from "../../ui/popover.js";
|
|
10
|
+
import { ScrollArea as H } from "../../ui/scroll-area.js";
|
|
11
|
+
import { useCollectionBody as W } from "../collection-meta.js";
|
|
12
|
+
function oe({
|
|
13
|
+
relatedCollection: a,
|
|
14
|
+
value: r,
|
|
15
|
+
onChange: m,
|
|
16
|
+
disabled: v,
|
|
17
|
+
extraFilter: _,
|
|
18
|
+
placeholder: I
|
|
19
|
+
}) {
|
|
20
|
+
const h = J(), [S, f] = b(!1), [x, P] = b(""), [g, $] = b(""), i = U(null);
|
|
21
|
+
A(() => (i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
22
|
+
$(x);
|
|
23
|
+
}, 200), () => {
|
|
24
|
+
i.current && clearTimeout(i.current);
|
|
25
|
+
}), [x]);
|
|
26
|
+
const l = a === "nivaro_users", { data: s, isError: j } = W(a, {
|
|
27
|
+
retry: !1,
|
|
28
|
+
enabled: !l
|
|
29
|
+
}), o = l ? "{{first_name}} {{last_name}}" : (s == null ? void 0 : s.display_template) ?? null, D = Q(o), w = r != null && r !== "", { data: k, isLoading: E } = L({
|
|
30
|
+
queryKey: ["relation-item", a, String(r)],
|
|
31
|
+
queryFn: async () => {
|
|
32
|
+
const t = l ? `/users/${r}` : `/items/${a}/${r}`;
|
|
33
|
+
return (await h.request(
|
|
34
|
+
N(t, l ? void 0 : { fields: "*" })
|
|
35
|
+
)).data;
|
|
36
|
+
},
|
|
37
|
+
enabled: w,
|
|
38
|
+
staleTime: 1800 * 1e3,
|
|
39
|
+
retry: !1
|
|
40
|
+
}), T = s ? D.join(",") : "*", p = [l ? null : s == null ? void 0 : s.picker_filter, _].filter(Boolean), q = p.length > 0 ? JSON.stringify(p.length === 1 ? p[0] : { _and: p }) : void 0, { data: u, isLoading: y } = L({
|
|
41
|
+
queryKey: ["relation-search", a, T, g, q],
|
|
42
|
+
queryFn: async () => l ? (await h.request(
|
|
43
|
+
N("/users", { limit: 200, search: g || void 0 })
|
|
44
|
+
)).data ?? [] : (await h.request(
|
|
45
|
+
N(`/items/${a}`, {
|
|
46
|
+
limit: 200,
|
|
47
|
+
fields: T,
|
|
48
|
+
search: g || void 0,
|
|
49
|
+
filter: q,
|
|
50
|
+
picker: "1"
|
|
51
|
+
})
|
|
52
|
+
)).data ?? [],
|
|
53
|
+
enabled: S,
|
|
54
|
+
staleTime: 30 * 1e3
|
|
55
|
+
}), F = w ? k ? d(o, k) : String(r) : null;
|
|
56
|
+
return j ? /* @__PURE__ */ e(
|
|
57
|
+
C,
|
|
58
|
+
{
|
|
59
|
+
value: String(r ?? ""),
|
|
60
|
+
onChange: (t) => m(t.target.value),
|
|
61
|
+
disabled: v,
|
|
62
|
+
className: "h-9 text-[13px]",
|
|
63
|
+
placeholder: "Unknown collection"
|
|
64
|
+
}
|
|
65
|
+
) : /* @__PURE__ */ c(V, { open: S, onOpenChange: f, children: [
|
|
66
|
+
/* @__PURE__ */ e(z, { asChild: !0, children: /* @__PURE__ */ c(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
disabled: v,
|
|
71
|
+
className: "w-full h-9 px-3 text-[13px] border border-slate-200 rounded-md bg-white text-left flex items-center justify-between hover:bg-slate-50 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
|
|
72
|
+
children: [
|
|
73
|
+
E ? /* @__PURE__ */ e("span", { className: "text-slate-400 text-[12px]", children: "Loading…" }) : F !== null ? /* @__PURE__ */ e("span", { className: "text-slate-800 truncate", children: F }) : /* @__PURE__ */ e("span", { className: "text-slate-400", children: I ?? "Select…" }),
|
|
74
|
+
/* @__PURE__ */ e(B, { className: "h-3.5 w-3.5 text-slate-400 shrink-0 ml-2" })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ c(G, { className: "w-[320px] p-2", align: "start", children: [
|
|
79
|
+
/* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(
|
|
80
|
+
C,
|
|
81
|
+
{
|
|
82
|
+
placeholder: "Search…",
|
|
83
|
+
value: x,
|
|
84
|
+
onChange: (t) => P(t.target.value),
|
|
85
|
+
className: "h-8 text-[13px]",
|
|
86
|
+
autoFocus: !0
|
|
87
|
+
}
|
|
88
|
+
) }),
|
|
89
|
+
/* @__PURE__ */ e(H, { className: "h-[200px]", children: /* @__PURE__ */ c("div", { className: "space-y-0.5", children: [
|
|
90
|
+
/* @__PURE__ */ e(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
onClick: () => {
|
|
95
|
+
m(null), f(!1);
|
|
96
|
+
},
|
|
97
|
+
className: "flex items-center gap-2 px-3 py-2 text-[13px] text-slate-400 hover:bg-slate-50 cursor-pointer rounded-md w-full text-left",
|
|
98
|
+
children: "Clear selection"
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
y && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[13px] text-slate-400", children: "Loading…" }),
|
|
102
|
+
!y && (u == null ? void 0 : u.length) === 0 && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[13px] text-slate-400", children: "No results" }),
|
|
103
|
+
!y && [...u ?? []].sort(
|
|
104
|
+
(t, n) => d(o, t).localeCompare(
|
|
105
|
+
d(o, n)
|
|
106
|
+
)
|
|
107
|
+
).map((t) => {
|
|
108
|
+
const n = t.id, O = d(o, t), R = String(n) === String(r);
|
|
109
|
+
return /* @__PURE__ */ c(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
onClick: () => {
|
|
114
|
+
m(n), f(!1);
|
|
115
|
+
},
|
|
116
|
+
className: "flex items-center gap-2 px-3 py-2 text-[13px] hover:bg-slate-50 cursor-pointer rounded-md w-full text-left",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ e(
|
|
119
|
+
K,
|
|
120
|
+
{
|
|
121
|
+
className: `h-3.5 w-3.5 shrink-0 ${R ? "text-nvr-cyan" : "text-transparent"}`
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-800", children: O })
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
String(n)
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
] }) })
|
|
131
|
+
] })
|
|
132
|
+
] });
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
oe as RelationPicker
|
|
136
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const i = [
|
|
2
|
+
"active-layout",
|
|
3
|
+
"summary-layout",
|
|
4
|
+
"file-layouts",
|
|
5
|
+
"field-config",
|
|
6
|
+
"drilldown-layout",
|
|
7
|
+
"addendum-layout"
|
|
8
|
+
];
|
|
9
|
+
function t(e, o) {
|
|
10
|
+
for (const a of i) e.invalidateQueries({ queryKey: [a, o] });
|
|
11
|
+
e.invalidateQueries({ queryKey: ["layout-meta"] });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
t as invalidateRecordLayoutQueries
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as f, Fragment as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Setting as a, PickList as d } from "./controls.js";
|
|
3
|
+
import { changeLabel as n } from "./section-props.js";
|
|
4
|
+
import { useWorkflowTemplates as s, useCollectionLayoutList as w } from "./settings-api.js";
|
|
5
|
+
import { ToggleSetting as u } from "./ToggleSetting.js";
|
|
6
|
+
function L(l) {
|
|
7
|
+
const { layout: t, kind: i, collection: m } = l, r = s(i === "addendum"), _ = w(m, "addendum");
|
|
8
|
+
return /* @__PURE__ */ f(c, { children: [
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
a,
|
|
11
|
+
{
|
|
12
|
+
k: "layout.workflow_template_id",
|
|
13
|
+
control: /* @__PURE__ */ o(
|
|
14
|
+
d,
|
|
15
|
+
{
|
|
16
|
+
ariaLabel: "Addendum workflow",
|
|
17
|
+
value: t.workflow_template_id ? String(t.workflow_template_id) : null,
|
|
18
|
+
options: r.map((e) => ({ value: e.id, label: e.name })),
|
|
19
|
+
clearLabel: "No workflow",
|
|
20
|
+
emptyText: "No workflows yet",
|
|
21
|
+
onChange: (e) => l.set({ workflow_template_id: e }, n("layout.workflow_template_id"))
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ o(u, { k: "layout.single_active_addendum", props: l }),
|
|
27
|
+
/* @__PURE__ */ o(
|
|
28
|
+
a,
|
|
29
|
+
{
|
|
30
|
+
k: "layout.addendum_layout_id",
|
|
31
|
+
control: /* @__PURE__ */ o(
|
|
32
|
+
d,
|
|
33
|
+
{
|
|
34
|
+
ariaLabel: "Addendum form",
|
|
35
|
+
value: t.addendum_layout_id == null ? null : String(t.addendum_layout_id),
|
|
36
|
+
options: _.map((e) => ({ value: String(e.id), label: e.name })),
|
|
37
|
+
clearLabel: "Collection's default",
|
|
38
|
+
emptyText: "This collection has no addendum forms",
|
|
39
|
+
onChange: (e) => l.set(
|
|
40
|
+
{ addendum_layout_id: e ? Number(e) : null },
|
|
41
|
+
n("layout.addendum_layout_id")
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ o(u, { k: "layout.addendum_default_view", props: l })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
L as AddendumSection
|
|
52
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as d, Fragment as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { flag as a } from "./section-props.js";
|
|
3
|
+
import { TextSetting as s } from "./TextSetting.js";
|
|
4
|
+
import { ToggleSetting as l } from "./ToggleSetting.js";
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e.kind !== "grouped" ? "No effect on this kind of layout: the Dossier button follows the default form." : a(e.layout.is_active) ? null : "Takes effect while this form is the default; until then the default form decides.";
|
|
7
|
+
}
|
|
8
|
+
function c(e) {
|
|
9
|
+
const i = a(e.layout.dossier_enabled), o = r(e), n = e.kind !== "grouped";
|
|
10
|
+
return /* @__PURE__ */ d(u, { children: [
|
|
11
|
+
/* @__PURE__ */ t(l, { k: "layout.ai_enabled", props: e }),
|
|
12
|
+
/* @__PURE__ */ t(
|
|
13
|
+
l,
|
|
14
|
+
{
|
|
15
|
+
k: "layout.dossier_enabled",
|
|
16
|
+
props: e,
|
|
17
|
+
disabled: n && !i,
|
|
18
|
+
note: o ?? void 0
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ t(
|
|
22
|
+
s,
|
|
23
|
+
{
|
|
24
|
+
k: "layout.dossier_label",
|
|
25
|
+
props: e,
|
|
26
|
+
placeholder: "Dossier",
|
|
27
|
+
disabled: !i,
|
|
28
|
+
note: i ? o : "Turn on the Dossier button first."
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ t(l, { k: "layout.disable_comments", props: e }),
|
|
32
|
+
/* @__PURE__ */ t(l, { k: "layout.disable_tasks", props: e }),
|
|
33
|
+
/* @__PURE__ */ t(l, { k: "layout.disable_revisions", props: e }),
|
|
34
|
+
/* @__PURE__ */ t(l, { k: "layout.disable_clone", props: e }),
|
|
35
|
+
/* @__PURE__ */ t(l, { k: "layout.disable_delete", props: e }),
|
|
36
|
+
/* @__PURE__ */ t(l, { k: "layout.hide_integrity_banner", props: e }),
|
|
37
|
+
/* @__PURE__ */ t(l, { k: "layout.hide_sla_banner", props: e }),
|
|
38
|
+
/* @__PURE__ */ t(l, { k: "layout.changes_tray", props: e }),
|
|
39
|
+
/* @__PURE__ */ t(l, { k: "layout.allow_schedule", props: e }),
|
|
40
|
+
/* @__PURE__ */ t(l, { k: "layout.allow_disable_pickers", props: e })
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
c as ButtonsSection
|
|
45
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as p, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { DefaultValuesEditor as h } from "../editors/DefaultValuesEditor.js";
|
|
3
|
+
import { seedSteps as y, QuickPickerStepsEditor as _, QUICK_PICKER_MAX as g } from "../editors/QuickPickerStepsEditor.js";
|
|
4
|
+
import { Setting as u, quietText as S, smallBtn as q } from "./controls.js";
|
|
5
|
+
import { changeLabel as f } from "./section-props.js";
|
|
6
|
+
import { useFieldSources as v } from "./settings-api.js";
|
|
7
|
+
function C(t) {
|
|
8
|
+
let e = t;
|
|
9
|
+
if (typeof e == "string")
|
|
10
|
+
try {
|
|
11
|
+
e = JSON.parse(e);
|
|
12
|
+
} catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return Array.isArray(e) ? e.filter((s) => typeof s == "string") : [];
|
|
16
|
+
}
|
|
17
|
+
function j(t) {
|
|
18
|
+
const { layout: e, collection: s } = t, { fields: o, columns: d, relations: r } = v(s), k = C(e.quick_picker), a = (i, n) => t.set({ quick_picker: i.length ? i.slice(0, g) : null }, n), c = y(o, r, s);
|
|
19
|
+
return /* @__PURE__ */ m(p, { children: [
|
|
20
|
+
/* @__PURE__ */ l(u, { k: "layout.default_values", children: /* @__PURE__ */ l(
|
|
21
|
+
h,
|
|
22
|
+
{
|
|
23
|
+
collection: s,
|
|
24
|
+
value: e.default_values,
|
|
25
|
+
fields: o,
|
|
26
|
+
columns: d,
|
|
27
|
+
relations: r,
|
|
28
|
+
onBlur: t.flush,
|
|
29
|
+
onChange: (i, { text: n }) => (n ? t.setText : t.set)(
|
|
30
|
+
{ default_values: i },
|
|
31
|
+
f("layout.default_values")
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
) }),
|
|
35
|
+
/* @__PURE__ */ l(u, { k: "layout.quick_picker", children: /* @__PURE__ */ l(
|
|
36
|
+
_,
|
|
37
|
+
{
|
|
38
|
+
steps: k,
|
|
39
|
+
fields: o,
|
|
40
|
+
relations: r,
|
|
41
|
+
collection: s,
|
|
42
|
+
showSeed: !1,
|
|
43
|
+
onChange: (i) => a(i, f("layout.quick_picker"))
|
|
44
|
+
}
|
|
45
|
+
) }),
|
|
46
|
+
/* @__PURE__ */ l(
|
|
47
|
+
u,
|
|
48
|
+
{
|
|
49
|
+
k: "layout.quick_picker_seed",
|
|
50
|
+
control: /* @__PURE__ */ l(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
type: "button",
|
|
54
|
+
className: q,
|
|
55
|
+
disabled: c.length === 0,
|
|
56
|
+
onClick: () => a(c, "Fill quick picker steps from cascade rules"),
|
|
57
|
+
children: "Fill steps"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
note: c.length === 0 ? /* @__PURE__ */ l("span", { className: S, children: "No cascade rules on this collection's relation fields." }) : null
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
j as DefaultsSection
|
|
67
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Search as w, X as T } from "lucide-react";
|
|
3
|
+
import { useState as B, useMemo as m, useCallback as F } from "react";
|
|
4
|
+
import { cn as p } from "../../../lib/utils.js";
|
|
5
|
+
import { PanelHeader as q } from "../panel-frame.js";
|
|
6
|
+
import { groupTitle as A } from "../panel-style.js";
|
|
7
|
+
import { AddendumSection as I } from "./AddendumSection.js";
|
|
8
|
+
import { ButtonsSection as M } from "./ButtonsSection.js";
|
|
9
|
+
import { inputCls as O, quietText as P, VisibleSettingsContext as R } from "./controls.js";
|
|
10
|
+
import { DefaultsSection as _ } from "./DefaultsSection.js";
|
|
11
|
+
import { InheritanceSection as j } from "./InheritanceSection.js";
|
|
12
|
+
import { LayoutSection as D } from "./LayoutSection.js";
|
|
13
|
+
import { PdfSection as E } from "./PdfSection.js";
|
|
14
|
+
import { ReadSection as W } from "./ReadSection.js";
|
|
15
|
+
import { layoutKindOf as $, visibleSections as z } from "./settings-registry.js";
|
|
16
|
+
import { ToolsSection as H } from "./ToolsSection.js";
|
|
17
|
+
import { WhoSection as K } from "./WhoSection.js";
|
|
18
|
+
const L = {
|
|
19
|
+
who: K,
|
|
20
|
+
layout: D,
|
|
21
|
+
buttons: M,
|
|
22
|
+
read: W,
|
|
23
|
+
pdf: E,
|
|
24
|
+
addendum: I,
|
|
25
|
+
defaults: _,
|
|
26
|
+
inheritance: j,
|
|
27
|
+
tools: H
|
|
28
|
+
};
|
|
29
|
+
function dt({
|
|
30
|
+
bundle: r,
|
|
31
|
+
apply: c,
|
|
32
|
+
flush: n,
|
|
33
|
+
collection: u,
|
|
34
|
+
onPreviewRole: g,
|
|
35
|
+
previewRoleId: y,
|
|
36
|
+
onPreviewRoleChange: S
|
|
37
|
+
}) {
|
|
38
|
+
const [a, f] = B(""), i = $(r.layout), l = m(() => z(i, a), [i, a]), x = m(
|
|
39
|
+
() => new Set(l.flatMap((t) => t.settings.map((e) => e.key))),
|
|
40
|
+
[l]
|
|
41
|
+
), h = F(() => n == null ? void 0 : n(), [n]), v = m(
|
|
42
|
+
() => ({
|
|
43
|
+
bundle: r,
|
|
44
|
+
layout: r.layout,
|
|
45
|
+
kind: i,
|
|
46
|
+
collection: u,
|
|
47
|
+
set: (t, e, s) => c(
|
|
48
|
+
[{ op: "layout_update", patch: t }],
|
|
49
|
+
(s == null ? void 0 : s.undoable) === !1 ? { label: e, undoable: !1 } : { label: e }
|
|
50
|
+
),
|
|
51
|
+
setText: (t, e) => c([{ op: "layout_update", patch: t }], { label: e, text: !0 }),
|
|
52
|
+
flush: h
|
|
53
|
+
}),
|
|
54
|
+
[r, i, u, c, h]
|
|
55
|
+
), k = typeof r.layout.name == "string" ? r.layout.name : "", N = (t) => {
|
|
56
|
+
const e = t.currentTarget, s = e.getBoundingClientRect().top;
|
|
57
|
+
for (const b of e.querySelectorAll("[data-section-title]")) {
|
|
58
|
+
const C = e.scrollTop > 0 && Math.abs(b.getBoundingClientRect().top - s) < 1;
|
|
59
|
+
b.toggleAttribute("data-stuck", C);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ d("div", { className: "flex h-full min-h-0 flex-col", "data-form-settings": i, children: [
|
|
63
|
+
/* @__PURE__ */ o(
|
|
64
|
+
q,
|
|
65
|
+
{
|
|
66
|
+
eyebrow: "Form settings",
|
|
67
|
+
title: k || "This form",
|
|
68
|
+
sub: "Who gets this form and how it behaves",
|
|
69
|
+
children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
70
|
+
/* @__PURE__ */ o(w, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
71
|
+
/* @__PURE__ */ o(
|
|
72
|
+
"input",
|
|
73
|
+
{
|
|
74
|
+
value: a,
|
|
75
|
+
onChange: (t) => f(t.target.value),
|
|
76
|
+
placeholder: "Find a setting…",
|
|
77
|
+
"aria-label": "Find a setting",
|
|
78
|
+
"data-settings-search": !0,
|
|
79
|
+
className: p(O, "pl-8 pr-8")
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
a && /* @__PURE__ */ o(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-label": "Clear search",
|
|
87
|
+
onClick: () => f(""),
|
|
88
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-slate-400 hover:text-slate-700 dark:hover:text-foreground",
|
|
89
|
+
children: /* @__PURE__ */ o(T, { className: "h-3.5 w-3.5" })
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] })
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ o(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
"data-panel-body": "",
|
|
99
|
+
onScroll: N,
|
|
100
|
+
className: "min-h-0 flex-1 overflow-y-auto px-4 pb-8",
|
|
101
|
+
children: l.length === 0 ? /* @__PURE__ */ d("p", { className: p("py-8 text-center", P), children: [
|
|
102
|
+
"No setting matches “",
|
|
103
|
+
a.trim(),
|
|
104
|
+
"”."
|
|
105
|
+
] }) : /* @__PURE__ */ o(R.Provider, { value: x, children: l.map(({ section: t }) => {
|
|
106
|
+
const e = L[t.id];
|
|
107
|
+
return /* @__PURE__ */ d(
|
|
108
|
+
"section",
|
|
109
|
+
{
|
|
110
|
+
"data-section": t.id,
|
|
111
|
+
"aria-labelledby": `form-settings-${t.id}`,
|
|
112
|
+
className: "border-t border-slate-100 pb-6 first:border-t-0 dark:border-border/60",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ o(
|
|
115
|
+
"h3",
|
|
116
|
+
{
|
|
117
|
+
id: `form-settings-${t.id}`,
|
|
118
|
+
"data-section-title": "",
|
|
119
|
+
className: p(
|
|
120
|
+
A,
|
|
121
|
+
"sticky top-0 z-10 -mx-4 border-b border-transparent bg-white px-4 pb-3 pt-4 data-[stuck]:border-slate-200 dark:bg-card dark:data-[stuck]:border-border"
|
|
122
|
+
),
|
|
123
|
+
children: t.title
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ o("div", { className: "space-y-5", children: /* @__PURE__ */ o(
|
|
127
|
+
e,
|
|
128
|
+
{
|
|
129
|
+
...v,
|
|
130
|
+
onPreviewRole: g,
|
|
131
|
+
previewRoleId: y,
|
|
132
|
+
onPreviewRoleChange: S
|
|
133
|
+
}
|
|
134
|
+
) })
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
t.id
|
|
138
|
+
);
|
|
139
|
+
}) })
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
dt as FormSettings
|
|
146
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as l, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Setting as c, quietText as h, PickList as d } from "./controls.js";
|
|
3
|
+
import { changeLabel as p } from "./section-props.js";
|
|
4
|
+
import { useCollectionLayoutList as y } from "./settings-api.js";
|
|
5
|
+
function L(o) {
|
|
6
|
+
const { layout: n, collection: u } = o, i = Number(n.id), a = y(u), r = n.parent_layout_id == null ? null : String(n.parent_layout_id), e = a.filter((t) => Number(t.parent_layout_id) === i), m = a.filter((t) => t.id !== i && !t.parent_layout_id).map((t) => ({ value: String(t.id), label: t.name }));
|
|
7
|
+
return /* @__PURE__ */ l(
|
|
8
|
+
c,
|
|
9
|
+
{
|
|
10
|
+
k: "layout.parent_layout_id",
|
|
11
|
+
control: /* @__PURE__ */ l(
|
|
12
|
+
d,
|
|
13
|
+
{
|
|
14
|
+
ariaLabel: "Inherit from",
|
|
15
|
+
value: r,
|
|
16
|
+
options: m,
|
|
17
|
+
clearLabel: "Nothing",
|
|
18
|
+
disabled: e.length > 0 && !r,
|
|
19
|
+
emptyText: "No other layout to inherit from",
|
|
20
|
+
onChange: (t) => o.set(
|
|
21
|
+
{ parent_layout_id: t ? Number(t) : null },
|
|
22
|
+
p("layout.parent_layout_id")
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
note: e.length > 0 ? /* @__PURE__ */ s("span", { className: h, children: [
|
|
27
|
+
e.map((t) => t.name).join(", "),
|
|
28
|
+
" ",
|
|
29
|
+
e.length === 1 ? "inherits" : "inherit",
|
|
30
|
+
" from this layout, so it cannot inherit from another."
|
|
31
|
+
] }) : null
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
L as InheritanceSection
|
|
37
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Setting as b, Segmented as g, quietText as c, PickList as _, Toggle as h } from "./controls.js";
|
|
3
|
+
import { changeLabel as y, toggleLabel as w } from "./section-props.js";
|
|
4
|
+
import { useFieldSources as L, numericFieldNames as S, fieldOptions as k } from "./settings-api.js";
|
|
5
|
+
import { ToggleSetting as u } from "./ToggleSetting.js";
|
|
6
|
+
function F(e) {
|
|
7
|
+
const { layout: l } = e, a = l.tab_mode === "steps" ? "steps" : "tabs";
|
|
8
|
+
return /* @__PURE__ */ m(f, { children: [
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
b,
|
|
11
|
+
{
|
|
12
|
+
k: "layout.tab_mode",
|
|
13
|
+
control: /* @__PURE__ */ o(
|
|
14
|
+
g,
|
|
15
|
+
{
|
|
16
|
+
ariaLabel: "Loose tabs show as",
|
|
17
|
+
value: a,
|
|
18
|
+
options: [
|
|
19
|
+
{ value: "tabs", label: "Tabs" },
|
|
20
|
+
{ value: "steps", label: "Steps" }
|
|
21
|
+
],
|
|
22
|
+
onChange: (n) => e.set({ tab_mode: n }, y("layout.tab_mode"))
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ o(u, { k: "layout.validate_before_next", props: e }),
|
|
28
|
+
/* @__PURE__ */ o(u, { k: "layout.accordion_mode", props: e }),
|
|
29
|
+
/* @__PURE__ */ o(v, { ...e })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function v(e) {
|
|
33
|
+
const { fields: l, columns: a, relations: n } = L(e.collection), i = S(e.collection, l, a, n), r = e.layout.row_order_field ? String(e.layout.row_order_field) : null, d = k(l, i);
|
|
34
|
+
return /* @__PURE__ */ o(
|
|
35
|
+
b,
|
|
36
|
+
{
|
|
37
|
+
k: "layout.row_order_field",
|
|
38
|
+
control: /* @__PURE__ */ o(
|
|
39
|
+
h,
|
|
40
|
+
{
|
|
41
|
+
label: "Let people reorder rows",
|
|
42
|
+
checked: !!r,
|
|
43
|
+
disabled: !r && i.length === 0,
|
|
44
|
+
onChange: (t) => {
|
|
45
|
+
var s;
|
|
46
|
+
return e.set(
|
|
47
|
+
{ row_order_field: t ? ((s = d[0]) == null ? void 0 : s.value) ?? null : null },
|
|
48
|
+
w("layout.row_order_field", t)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
children: r ? /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
54
|
+
/* @__PURE__ */ o("span", { className: c, children: "Order is saved in" }),
|
|
55
|
+
/* @__PURE__ */ o(
|
|
56
|
+
_,
|
|
57
|
+
{
|
|
58
|
+
ariaLabel: "Order field",
|
|
59
|
+
value: r,
|
|
60
|
+
options: d,
|
|
61
|
+
onChange: (t) => t && e.set({ row_order_field: t }, "Change the field rows are ordered by")
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }) : i.length === 0 ? /* @__PURE__ */ o("p", { className: c, children: "This collection has no number field to keep the order in." }) : null
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
F as LayoutSection
|
|
70
|
+
};
|