@nivaro/react 0.2.51 → 0.2.53
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 +207 -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 +4015 -3835
- 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
|
@@ -1,122 +1,139 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { titleCase as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
)
|
|
1
|
+
import { jsxs as i, Fragment as H, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as M, useQuery as T } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as G, ExternalLink as J } from "lucide-react";
|
|
4
|
+
import { useState as U, useCallback as D, useMemo as X, Suspense as R, lazy as q } from "react";
|
|
5
|
+
import { useNivaroClient as Y, useItemNavigation as Z, useDrilldownViews as L, DrilldownContext as x } from "../context.js";
|
|
6
|
+
import { get as P } from "../lib/commands.js";
|
|
7
|
+
import { titleCase as ee } from "../lib/utils.js";
|
|
8
|
+
import { DesignCanvas as te } from "./layout-editor/design-canvas.js";
|
|
9
|
+
import { Sheet as le, SheetContent as re, SheetHeader as oe, SheetTitle as ne } from "./ui/sheet.js";
|
|
10
|
+
const ae = q(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEditForm }))), $ = q(
|
|
11
|
+
() => import("./RecordReadView.js").then((n) => ({ default: n.RecordReadView }))
|
|
12
|
+
), b = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(
|
|
12
13
|
"div",
|
|
13
14
|
{
|
|
14
15
|
className: "h-8 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
|
|
15
16
|
},
|
|
16
|
-
|
|
17
|
+
n
|
|
17
18
|
)) });
|
|
18
|
-
function
|
|
19
|
-
collection:
|
|
20
|
-
itemId:
|
|
21
|
-
layoutId:
|
|
19
|
+
function xe({
|
|
20
|
+
collection: n,
|
|
21
|
+
itemId: W,
|
|
22
|
+
layoutId: j,
|
|
22
23
|
rootLayoutSlug: v,
|
|
23
|
-
width:
|
|
24
|
-
title:
|
|
25
|
-
stack:
|
|
26
|
-
onPush:
|
|
27
|
-
onPop:
|
|
28
|
-
onClose:
|
|
24
|
+
width: h,
|
|
25
|
+
title: E,
|
|
26
|
+
stack: f,
|
|
27
|
+
onPush: m,
|
|
28
|
+
onPop: u,
|
|
29
|
+
onClose: F,
|
|
30
|
+
design: l
|
|
29
31
|
}) {
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
{ collection:
|
|
33
|
-
]),
|
|
34
|
-
(
|
|
35
|
-
|
|
32
|
+
var S;
|
|
33
|
+
const K = M(), O = Y(), { open: Q } = Z(), [_, y] = U([
|
|
34
|
+
{ collection: n, itemId: W, layoutId: j, width: h, title: E }
|
|
35
|
+
]), c = f != null, a = c && f.length ? f : _, e = l ? a[0] : a[a.length - 1], k = D(
|
|
36
|
+
(o) => {
|
|
37
|
+
c ? m == null || m(o) : y((B) => [...B, o]);
|
|
36
38
|
},
|
|
37
|
-
[
|
|
38
|
-
), w =
|
|
39
|
-
|
|
40
|
-
}, [
|
|
39
|
+
[c, m]
|
|
40
|
+
), w = D(() => {
|
|
41
|
+
c ? u == null || u() : y((o) => o.slice(0, -1));
|
|
42
|
+
}, [c, u]), p = X(() => l ? null : { open: k }, [l, k]), V = L(), d = l ? null : V[e.collection] ?? null, s = !l && a.length === 1 && !!v, { data: z, isLoading: A } = T({
|
|
41
43
|
queryKey: ["drilldown-layout", e.collection, e.layoutId ?? null],
|
|
42
|
-
enabled: !
|
|
43
|
-
queryFn: () =>
|
|
44
|
-
|
|
44
|
+
enabled: !s && !l,
|
|
45
|
+
queryFn: () => O.request(
|
|
46
|
+
P(
|
|
45
47
|
`/collection-layouts/detail/${e.collection}`,
|
|
46
48
|
e.layoutId ? { layout_id: e.layoutId } : {}
|
|
47
49
|
)
|
|
48
|
-
).then((
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
).then((o) => o.data ?? null)
|
|
51
|
+
}), r = l ? {
|
|
52
|
+
...l.layout,
|
|
53
|
+
layout: l.layout.layout ?? { id: 0, name: "", slug: null }
|
|
54
|
+
} : z, g = s ? v ?? void 0 : (r == null ? void 0 : r.layout.slug) ?? void 0, I = (S = r == null ? void 0 : r.layout) == null ? void 0 : S.sheet_width, N = /* @__PURE__ */ i(H, { children: [
|
|
55
|
+
/* @__PURE__ */ i("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
56
|
+
a.length > 1 && /* @__PURE__ */ t(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
type: "button",
|
|
60
|
+
"aria-label": "Back",
|
|
61
|
+
onClick: w,
|
|
62
|
+
className: "shrink-0 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
63
|
+
children: /* @__PURE__ */ t(G, { className: "h-4 w-4" })
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ i("span", { className: "truncate", children: [
|
|
67
|
+
ee(e.collection),
|
|
68
|
+
!s && r ? ` · ${r.layout.name}` : ""
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
!l && /* @__PURE__ */ i(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
type: "button",
|
|
75
|
+
onClick: () => Q({ collection: e.collection, itemId: e.itemId }),
|
|
76
|
+
className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
|
|
77
|
+
children: [
|
|
78
|
+
"Open record ",
|
|
79
|
+
/* @__PURE__ */ t(J, { className: "h-3 w-3" })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }), C = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: d ? /* @__PURE__ */ t(x.Provider, { value: p, children: d.render({ itemId: String(e.itemId) }) }) : A && !s ? b : !s && (r == null ? void 0 : r.layout.display_mode) === "read" ? (
|
|
84
|
+
// Read-only presentation — definition grids + tabbed child lists,
|
|
85
|
+
// no form inputs. Editing lives on the full record page.
|
|
86
|
+
/* @__PURE__ */ t(x.Provider, { value: p, children: /* @__PURE__ */ t(R, { fallback: b, children: l ? /* @__PURE__ */ t($, { collection: e.collection, design: l }) : /* @__PURE__ */ t(
|
|
87
|
+
$,
|
|
88
|
+
{
|
|
89
|
+
collection: e.collection,
|
|
90
|
+
itemId: e.itemId,
|
|
91
|
+
layoutData: r
|
|
92
|
+
},
|
|
93
|
+
`${e.collection}:${e.itemId}:read`
|
|
94
|
+
) }) })
|
|
95
|
+
) : /* @__PURE__ */ t(x.Provider, { value: p, children: /* @__PURE__ */ t(R, { fallback: b, children: /* @__PURE__ */ t(
|
|
96
|
+
ae,
|
|
97
|
+
{
|
|
98
|
+
collection: e.collection,
|
|
99
|
+
itemId: e.itemId,
|
|
100
|
+
layoutSlug: g,
|
|
101
|
+
onSaved: () => {
|
|
102
|
+
K.invalidateQueries({ queryKey: ["queue-items"] });
|
|
103
|
+
},
|
|
104
|
+
design: l
|
|
105
|
+
},
|
|
106
|
+
`${e.collection}:${e.itemId}:${g ?? "default"}`
|
|
107
|
+
) }) }) });
|
|
108
|
+
return l ? /* @__PURE__ */ t(te, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ i(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
"data-design-sheet": !0,
|
|
112
|
+
className: "flex h-full min-h-0 flex-col gap-0 overflow-hidden rounded-lg border border-slate-200 bg-background shadow-sm dark:border-border",
|
|
113
|
+
style: { width: I ?? h ?? 640, maxWidth: "100%" },
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ t("div", { className: "flex shrink-0 flex-col border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: N }) }),
|
|
116
|
+
C
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
) }) : /* @__PURE__ */ t(le, { open: !0, onOpenChange: (o) => !o && F(), children: /* @__PURE__ */ i(
|
|
120
|
+
re,
|
|
52
121
|
{
|
|
53
122
|
className: "flex flex-col gap-0 overflow-hidden p-0",
|
|
54
123
|
style: {
|
|
55
|
-
width: (
|
|
124
|
+
width: (d == null ? void 0 : d.width) ?? e.width ?? I ?? h ?? 640,
|
|
56
125
|
maxWidth: "96vw"
|
|
57
126
|
},
|
|
58
|
-
onEscapeKeyDown:
|
|
59
|
-
|
|
127
|
+
onEscapeKeyDown: a.length > 1 ? (o) => {
|
|
128
|
+
o.preventDefault(), w();
|
|
60
129
|
} : void 0,
|
|
61
130
|
children: [
|
|
62
|
-
/* @__PURE__ */ t(
|
|
63
|
-
|
|
64
|
-
i.length > 1 && /* @__PURE__ */ t(
|
|
65
|
-
"button",
|
|
66
|
-
{
|
|
67
|
-
type: "button",
|
|
68
|
-
"aria-label": "Back",
|
|
69
|
-
onClick: w,
|
|
70
|
-
className: "shrink-0 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
71
|
-
children: /* @__PURE__ */ t(V, { className: "h-4 w-4" })
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ s("span", { className: "truncate", children: [
|
|
75
|
-
G(e.collection),
|
|
76
|
-
!c && l ? ` · ${l.layout.name}` : ""
|
|
77
|
-
] })
|
|
78
|
-
] }),
|
|
79
|
-
/* @__PURE__ */ s(
|
|
80
|
-
"button",
|
|
81
|
-
{
|
|
82
|
-
type: "button",
|
|
83
|
-
onClick: () => j({ collection: e.collection, itemId: e.itemId }),
|
|
84
|
-
className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
|
|
85
|
-
children: [
|
|
86
|
-
"Open record ",
|
|
87
|
-
/* @__PURE__ */ t(z, { className: "h-3 w-3" })
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
] }) }),
|
|
92
|
-
/* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: a ? /* @__PURE__ */ t(p.Provider, { value: h, children: a.render({ itemId: String(e.itemId) }) }) : K && !c ? f : !c && (l == null ? void 0 : l.layout.display_mode) === "read" ? (
|
|
93
|
-
// Read-only presentation — definition grids + tabbed child lists,
|
|
94
|
-
// no form inputs. Editing lives on the full record page.
|
|
95
|
-
/* @__PURE__ */ t(p.Provider, { value: h, children: /* @__PURE__ */ t(N, { fallback: f, children: /* @__PURE__ */ t(
|
|
96
|
-
L,
|
|
97
|
-
{
|
|
98
|
-
collection: e.collection,
|
|
99
|
-
itemId: e.itemId,
|
|
100
|
-
layoutData: l
|
|
101
|
-
},
|
|
102
|
-
`${e.collection}:${e.itemId}:read`
|
|
103
|
-
) }) })
|
|
104
|
-
) : /* @__PURE__ */ t(p.Provider, { value: h, children: /* @__PURE__ */ t(N, { fallback: f, children: /* @__PURE__ */ t(
|
|
105
|
-
Z,
|
|
106
|
-
{
|
|
107
|
-
collection: e.collection,
|
|
108
|
-
itemId: e.itemId,
|
|
109
|
-
layoutSlug: b,
|
|
110
|
-
onSaved: () => {
|
|
111
|
-
q.invalidateQueries({ queryKey: ["queue-items"] });
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
`${e.collection}:${e.itemId}:${b ?? "default"}`
|
|
115
|
-
) }) }) })
|
|
131
|
+
/* @__PURE__ */ t(oe, { className: "shrink-0 border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t(ne, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: N }) }),
|
|
132
|
+
C
|
|
116
133
|
]
|
|
117
134
|
}
|
|
118
135
|
) });
|
|
119
136
|
}
|
|
120
137
|
export {
|
|
121
|
-
|
|
138
|
+
xe as RecordDrilldownSheet
|
|
122
139
|
};
|