@nivaro/react 0.3.63 → 0.3.65
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 +54 -5
- package/dist/shared/components/CollectionBrowserView.js +3029 -2947
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4469 -4266
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/bulk-field-options.js +29 -23
- package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
- package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
- package/dist/shared/components/integrations/SendCurrentData.js +126 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
- package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
- package/dist/shared/components/item-edit/FieldRow.js +413 -403
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
- package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
- package/dist/shared/components/item-edit/PlanGrid.js +783 -724
- package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
- package/dist/shared/components/item-edit/RecordInsights.js +113 -111
- package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
- package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
- package/dist/shared/components/item-edit/collision-format.js +37 -0
- package/dist/shared/components/item-edit/field-a11y.js +25 -0
- package/dist/shared/components/item-edit/line-merge.js +58 -0
- package/dist/shared/components/item-edit/line-midair.js +94 -87
- package/dist/shared/components/item-edit/move-guard.js +17 -0
- package/dist/shared/components/item-edit/picker-search.js +22 -15
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +322 -291
- package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
- package/dist/shared/components/panels/CommentPanel.js +142 -136
- package/dist/shared/components/panels/ItemLockBanner.js +246 -240
- package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
- package/dist/shared/components/panels/RevisionsPanel.js +106 -102
- package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
- package/dist/shared/components/panels/SlaClock.js +90 -68
- package/dist/shared/components/queue/QueueItemSheet.js +94 -87
- package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
- package/dist/shared/components/queue/worklist-csv.js +75 -0
- package/dist/shared/components/queue/worklist-helpers.js +20 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
- package/dist/shared/lib/bulk-copy.js +17 -0
- package/dist/shared/lib/cbv-export.js +122 -0
- package/dist/shared/lib/delete-offer.js +13 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/leave-guard.js +41 -26
- package/dist/shared/lib/list-link.js +72 -56
- package/dist/shared/lib/live-queries.js +32 -30
- package/dist/shared/lib/moved-notice.js +25 -0
- package/dist/shared/lib/notification-target.js +56 -54
- package/dist/shared/lib/obligation-banner.js +11 -8
- package/dist/shared/lib/obligation-reason-text.js +6 -6
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as a, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { usePresence as
|
|
8
|
-
import { titleCase as
|
|
9
|
-
import { DesignCanvas as
|
|
10
|
-
import { Sheet as
|
|
11
|
-
const
|
|
1
|
+
import { jsxs as a, Fragment as U, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as G, useQuery as J } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as X, Eye as Y, ExternalLink as Z } from "lucide-react";
|
|
4
|
+
import { useState as L, useCallback as K, useMemo as P, Suspense as q, lazy as j } from "react";
|
|
5
|
+
import { useNivaroClient as ee, useItemNavigation as te, useDrilldownViews as le, DrilldownContext as y } from "../context.js";
|
|
6
|
+
import { get as re } from "../lib/commands.js";
|
|
7
|
+
import { usePresence as oe } from "../lib/presence-hooks.js";
|
|
8
|
+
import { titleCase as ne } from "../lib/utils.js";
|
|
9
|
+
import { DesignCanvas as ae } from "./layout-editor/design-canvas.js";
|
|
10
|
+
import { Sheet as ie, SheetContent as ce, SheetHeader as se, SheetTitle as de } from "./ui/sheet.js";
|
|
11
|
+
const me = j(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEditForm }))), F = j(
|
|
12
12
|
() => import("./RecordReadView.js").then((n) => ({ default: n.RecordReadView }))
|
|
13
13
|
), b = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(
|
|
14
14
|
"div",
|
|
@@ -17,59 +17,60 @@ const se = j(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEdi
|
|
|
17
17
|
},
|
|
18
18
|
n
|
|
19
19
|
)) });
|
|
20
|
-
function
|
|
20
|
+
function ke({
|
|
21
21
|
collection: n,
|
|
22
22
|
itemId: E,
|
|
23
23
|
layoutId: W,
|
|
24
|
-
rootLayoutSlug:
|
|
25
|
-
width:
|
|
26
|
-
title:
|
|
27
|
-
stack:
|
|
24
|
+
rootLayoutSlug: w,
|
|
25
|
+
width: p,
|
|
26
|
+
title: Q,
|
|
27
|
+
stack: x,
|
|
28
28
|
onPush: u,
|
|
29
29
|
onPop: h,
|
|
30
|
-
onClose:
|
|
31
|
-
design: l
|
|
30
|
+
onClose: _,
|
|
31
|
+
design: l,
|
|
32
|
+
onOpenRecord: g
|
|
32
33
|
}) {
|
|
33
|
-
var
|
|
34
|
-
const
|
|
35
|
-
{ collection: n, itemId: E, layoutId: W, width:
|
|
36
|
-
]), s =
|
|
37
|
-
(
|
|
38
|
-
s ? u == null || u(
|
|
34
|
+
var R;
|
|
35
|
+
const A = G(), O = ee(), { open: V, urlFor: z } = te(), [B, k] = L([
|
|
36
|
+
{ collection: n, itemId: E, layoutId: W, width: p, title: Q }
|
|
37
|
+
]), s = x != null, i = s && x.length ? x : B, e = l ? i[0] : i[i.length - 1], I = K(
|
|
38
|
+
(r) => {
|
|
39
|
+
s ? u == null || u(r) : k((f) => [...f, r]);
|
|
39
40
|
},
|
|
40
41
|
[s, u]
|
|
41
|
-
),
|
|
42
|
-
s ? h == null || h() :
|
|
43
|
-
}, [s, h]), { viewers: c } =
|
|
42
|
+
), N = K(() => {
|
|
43
|
+
s ? h == null || h() : k((r) => r.slice(0, -1));
|
|
44
|
+
}, [s, h]), { viewers: c } = oe(
|
|
44
45
|
l ? null : e.collection,
|
|
45
46
|
l ? null : e.itemId
|
|
46
|
-
),
|
|
47
|
+
), v = P(() => l ? null : { open: I }, [l, I]), H = le(), d = l ? null : H[e.collection] ?? null, m = !l && i.length === 1 && !!w, { data: M, isLoading: T } = J({
|
|
47
48
|
queryKey: ["drilldown-layout", e.collection, e.layoutId ?? null],
|
|
48
49
|
enabled: !m && !l,
|
|
49
|
-
queryFn: () =>
|
|
50
|
-
|
|
50
|
+
queryFn: () => O.request(
|
|
51
|
+
re(
|
|
51
52
|
`/collection-layouts/detail/${e.collection}`,
|
|
52
53
|
e.layoutId ? { layout_id: e.layoutId } : {}
|
|
53
54
|
)
|
|
54
|
-
).then((
|
|
55
|
-
}),
|
|
55
|
+
).then((r) => r.data ?? null)
|
|
56
|
+
}), o = l ? {
|
|
56
57
|
...l.layout,
|
|
57
58
|
layout: l.layout.layout ?? { id: 0, name: "", slug: null }
|
|
58
|
-
} :
|
|
59
|
+
} : M, S = m ? w ?? void 0 : (o == null ? void 0 : o.layout.slug) ?? void 0, C = (R = o == null ? void 0 : o.layout) == null ? void 0 : R.sheet_width, D = /* @__PURE__ */ a(U, { children: [
|
|
59
60
|
/* @__PURE__ */ a("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
60
61
|
i.length > 1 && /* @__PURE__ */ t(
|
|
61
62
|
"button",
|
|
62
63
|
{
|
|
63
64
|
type: "button",
|
|
64
65
|
"aria-label": "Back",
|
|
65
|
-
onClick:
|
|
66
|
+
onClick: N,
|
|
66
67
|
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",
|
|
67
|
-
children: /* @__PURE__ */ t(
|
|
68
|
+
children: /* @__PURE__ */ t(X, { className: "h-4 w-4" })
|
|
68
69
|
}
|
|
69
70
|
),
|
|
70
71
|
/* @__PURE__ */ a("span", { className: "truncate", children: [
|
|
71
|
-
|
|
72
|
-
!m &&
|
|
72
|
+
ne(e.collection),
|
|
73
|
+
!m && o ? ` · ${o.layout.name}` : ""
|
|
73
74
|
] })
|
|
74
75
|
] }),
|
|
75
76
|
!l && c.length > 0 && /* @__PURE__ */ a(
|
|
@@ -77,79 +78,86 @@ function we({
|
|
|
77
78
|
{
|
|
78
79
|
className: "ml-auto flex min-w-0 items-center gap-1 text-[11px] font-normal text-slate-500 dark:text-slate-400",
|
|
79
80
|
"data-drill-viewers": c.length,
|
|
80
|
-
"data-tip": `Also viewing: ${c.map((
|
|
81
|
+
"data-tip": `Also viewing: ${c.map((r) => r.name).join(", ")}`,
|
|
81
82
|
children: [
|
|
82
|
-
/* @__PURE__ */ t(
|
|
83
|
+
/* @__PURE__ */ t(Y, { className: "h-3 w-3 shrink-0" }),
|
|
83
84
|
/* @__PURE__ */ t("span", { className: "truncate", children: c.length === 1 ? c[0].name : `${c.length} others` })
|
|
84
85
|
]
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
!l &&
|
|
88
|
-
|
|
88
|
+
!l && // A real link (army 11 Q1-4): Cmd/Ctrl/middle-click opens the record in a new
|
|
89
|
+
// tab and keeps this list where it is; a plain click goes through the host.
|
|
90
|
+
/* @__PURE__ */ a(
|
|
91
|
+
"a",
|
|
89
92
|
{
|
|
90
|
-
|
|
91
|
-
onClick: () =>
|
|
93
|
+
href: z({ collection: e.collection, itemId: e.itemId }),
|
|
94
|
+
onClick: (r) => {
|
|
95
|
+
if (r.metaKey || r.ctrlKey || r.shiftKey || r.altKey || r.button !== 0) return;
|
|
96
|
+
r.preventDefault();
|
|
97
|
+
const f = { collection: e.collection, itemId: String(e.itemId) };
|
|
98
|
+
g ? g(f) : V(f);
|
|
99
|
+
},
|
|
92
100
|
className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
|
|
93
101
|
children: [
|
|
94
102
|
"Open record ",
|
|
95
|
-
/* @__PURE__ */ t(
|
|
103
|
+
/* @__PURE__ */ t(Z, { className: "h-3 w-3" })
|
|
96
104
|
]
|
|
97
105
|
}
|
|
98
106
|
)
|
|
99
|
-
] }),
|
|
107
|
+
] }), $ = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: d ? /* @__PURE__ */ t(y.Provider, { value: v, children: d.render({ itemId: String(e.itemId) }) }) : T && !m ? b : !m && (o == null ? void 0 : o.layout.display_mode) === "read" ? (
|
|
100
108
|
// Read-only presentation — definition grids + tabbed child lists,
|
|
101
109
|
// no form inputs. Editing lives on the full record page.
|
|
102
|
-
/* @__PURE__ */ t(
|
|
103
|
-
|
|
110
|
+
/* @__PURE__ */ t(y.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: b, children: l ? /* @__PURE__ */ t(F, { collection: e.collection, design: l }) : /* @__PURE__ */ t(
|
|
111
|
+
F,
|
|
104
112
|
{
|
|
105
113
|
collection: e.collection,
|
|
106
114
|
itemId: e.itemId,
|
|
107
|
-
layoutData:
|
|
115
|
+
layoutData: o
|
|
108
116
|
},
|
|
109
117
|
`${e.collection}:${e.itemId}:read`
|
|
110
118
|
) }) })
|
|
111
|
-
) : /* @__PURE__ */ t(
|
|
112
|
-
|
|
119
|
+
) : /* @__PURE__ */ t(y.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: b, children: /* @__PURE__ */ t(
|
|
120
|
+
me,
|
|
113
121
|
{
|
|
114
122
|
collection: e.collection,
|
|
115
123
|
itemId: e.itemId,
|
|
116
|
-
layoutSlug:
|
|
124
|
+
layoutSlug: S,
|
|
117
125
|
onSaved: () => {
|
|
118
|
-
|
|
126
|
+
A.invalidateQueries({ queryKey: ["queue-items"] });
|
|
119
127
|
},
|
|
120
128
|
design: l
|
|
121
129
|
},
|
|
122
|
-
`${e.collection}:${e.itemId}:${
|
|
130
|
+
`${e.collection}:${e.itemId}:${S ?? "default"}`
|
|
123
131
|
) }) }) });
|
|
124
|
-
return l ? /* @__PURE__ */ t(
|
|
132
|
+
return l ? /* @__PURE__ */ t(ae, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ a(
|
|
125
133
|
"div",
|
|
126
134
|
{
|
|
127
135
|
"data-design-sheet": !0,
|
|
128
136
|
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",
|
|
129
|
-
style: { width:
|
|
137
|
+
style: { width: C ?? p ?? 640, maxWidth: "100%" },
|
|
130
138
|
children: [
|
|
131
|
-
/* @__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:
|
|
132
|
-
|
|
139
|
+
/* @__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: D }) }),
|
|
140
|
+
$
|
|
133
141
|
]
|
|
134
142
|
}
|
|
135
|
-
) }) : /* @__PURE__ */ t(
|
|
136
|
-
|
|
143
|
+
) }) : /* @__PURE__ */ t(ie, { open: !0, onOpenChange: (r) => !r && _(), children: /* @__PURE__ */ a(
|
|
144
|
+
ce,
|
|
137
145
|
{
|
|
138
146
|
className: "flex flex-col gap-0 overflow-hidden p-0",
|
|
139
147
|
style: {
|
|
140
|
-
width: (d == null ? void 0 : d.width) ?? e.width ??
|
|
148
|
+
width: (d == null ? void 0 : d.width) ?? e.width ?? C ?? p ?? 640,
|
|
141
149
|
maxWidth: "96vw"
|
|
142
150
|
},
|
|
143
|
-
onEscapeKeyDown: i.length > 1 ? (
|
|
144
|
-
|
|
151
|
+
onEscapeKeyDown: i.length > 1 ? (r) => {
|
|
152
|
+
r.preventDefault(), N();
|
|
145
153
|
} : void 0,
|
|
146
154
|
children: [
|
|
147
|
-
/* @__PURE__ */ t(
|
|
148
|
-
|
|
155
|
+
/* @__PURE__ */ t(se, { 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(de, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: D }) }),
|
|
156
|
+
$
|
|
149
157
|
]
|
|
150
158
|
}
|
|
151
159
|
) });
|
|
152
160
|
}
|
|
153
161
|
export {
|
|
154
|
-
|
|
162
|
+
ke as RecordDrilldownSheet
|
|
155
163
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
1
|
+
import { jsxs as p, Fragment as X, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Y, useQuery as Z } from "@tanstack/react-query";
|
|
3
3
|
import { Loader2 as Q } from "lucide-react";
|
|
4
4
|
import { useState as y } from "react";
|
|
5
5
|
import { toast as O } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { useNivaroClient as z } from "../../context.js";
|
|
7
|
+
import { outcomeName as H } from "../../lib/bulk-copy.js";
|
|
8
|
+
import { newBulkProgressId as D, startBulkProgress as ee, endBulkProgress as te } from "../../lib/bulk-progress.js";
|
|
9
|
+
import { get as re, post as R } from "../../lib/commands.js";
|
|
10
|
+
import { errorToastOptions as ne } from "../../lib/error-toast.js";
|
|
11
|
+
import { userErrorMessage as oe } from "../../lib/safe-error.js";
|
|
11
12
|
import { cn as j } from "../../lib/utils.js";
|
|
12
|
-
import { invalidateRecordQueries as
|
|
13
|
-
import { Popover as
|
|
14
|
-
import { PushBulkButtons as
|
|
13
|
+
import { invalidateRecordQueries as se } from "../item-edit/RecordLiveSync.js";
|
|
14
|
+
import { Popover as ie, PopoverTrigger as le, PopoverContent as ae } from "../ui/popover.js";
|
|
15
|
+
import { PushBulkButtons as ce } from "./PushBulkButtons.js";
|
|
15
16
|
function x(t) {
|
|
16
17
|
return t === !0 || t === 1 || t === "1" || t === "true" ? "true" : t === !1 || t === 0 || t === "0" || t === "false" ? "false" : String(t ?? "");
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
19
|
+
const U = (t) => t == null || t === "";
|
|
20
|
+
function Be(t, i) {
|
|
20
21
|
for (const n of t ?? []) {
|
|
21
22
|
if (!n || typeof n.field != "string") continue;
|
|
22
23
|
if (!(n.field in i)) return null;
|
|
@@ -28,9 +29,9 @@ function Pe(t, i) {
|
|
|
28
29
|
case "neq":
|
|
29
30
|
return x(s) !== x(o);
|
|
30
31
|
case "null":
|
|
31
|
-
return
|
|
32
|
+
return U(s);
|
|
32
33
|
case "nnull":
|
|
33
|
-
return !
|
|
34
|
+
return !U(s);
|
|
34
35
|
case "in":
|
|
35
36
|
return c().includes(x(s));
|
|
36
37
|
case "nin":
|
|
@@ -42,9 +43,9 @@ function Pe(t, i) {
|
|
|
42
43
|
}
|
|
43
44
|
return !0;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
const i =
|
|
47
|
-
return
|
|
46
|
+
function G(t) {
|
|
47
|
+
const i = z(), n = [...new Set(t)].sort().join(",");
|
|
48
|
+
return Z({
|
|
48
49
|
queryKey: ["bulk-actions-available", n],
|
|
49
50
|
queryFn: async () => {
|
|
50
51
|
const s = {};
|
|
@@ -52,7 +53,7 @@ function z(t) {
|
|
|
52
53
|
n.split(",").map(async (o) => {
|
|
53
54
|
try {
|
|
54
55
|
const c = await i.request(
|
|
55
|
-
|
|
56
|
+
re("/bulk-actions/available", { collection: o })
|
|
56
57
|
);
|
|
57
58
|
s[o] = c.data ?? [];
|
|
58
59
|
} catch {
|
|
@@ -65,103 +66,103 @@ function z(t) {
|
|
|
65
66
|
staleTime: 6e4
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function K(t, i, n) {
|
|
69
70
|
return t ? t.includes(n) || t.includes(`${i}:${n}`) : !0;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
const { data: n } =
|
|
72
|
+
function Oe(t, i) {
|
|
73
|
+
const { data: n } = G(t), s = !!n && Object.values(n).some((o) => o.some((c) => c.source === "builtin"));
|
|
73
74
|
return (o) => s ? t.some(
|
|
74
|
-
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) &&
|
|
75
|
+
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) && K(i, c, o)
|
|
75
76
|
) : !0;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function de(t, i, n) {
|
|
78
79
|
const s = /* @__PURE__ */ new Map();
|
|
79
80
|
for (const o of i)
|
|
80
81
|
for (const c of (t == null ? void 0 : t[o]) ?? []) {
|
|
81
|
-
if (c.source === "builtin" || !
|
|
82
|
+
if (c.source === "builtin" || !K(n, o, c.key)) continue;
|
|
82
83
|
const g = `${c.source}:${c.key}`, k = s.get(g);
|
|
83
84
|
k ? k.collections.push(o) : s.set(g, { ...c, collections: [o] });
|
|
84
85
|
}
|
|
85
86
|
return [...s.values()];
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function ue(t, i, n) {
|
|
88
89
|
const s = [`${i.succeeded} done`];
|
|
89
90
|
return i.skipped && s.push(`${i.skipped} skipped`), i.failed && s.push(`${i.failed} failed`), `${t}: ${s.join(" · ")}${n !== i.succeeded + i.skipped + i.failed ? ` of ${n}` : ""}`;
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function Re({
|
|
92
93
|
targets: t,
|
|
93
94
|
enabledKeys: i,
|
|
94
95
|
tone: n = "light",
|
|
95
96
|
disabled: s,
|
|
96
97
|
onDone: o
|
|
97
98
|
}) {
|
|
98
|
-
const c =
|
|
99
|
+
const c = z(), g = Y(), k = [...new Set(t.map((e) => e.collection))], { data: L } = G(k), C = de(L, k, i), [J, $] = y(null), [N, _] = y(""), [P, S] = y(null), [A, q] = y({}), [T, E] = y(!1), V = async (e) => {
|
|
99
100
|
const u = `${e.source}:${e.key}`;
|
|
100
101
|
if (e.source === "db") {
|
|
101
|
-
q((
|
|
102
|
+
q((l) => ({ ...l, [u]: "loading" }));
|
|
102
103
|
try {
|
|
103
|
-
const
|
|
104
|
+
const l = { would_change: 0, skipped: 0, failed: 0, outcomes: [] };
|
|
104
105
|
for (const h of e.collections) {
|
|
105
106
|
const d = t.filter((r) => r.collection === h).map((r) => r.id);
|
|
106
107
|
if (d.length === 0) continue;
|
|
107
108
|
const b = await c.request(
|
|
108
109
|
R("/bulk-actions/preview", { collection: h, key: e.key, ids: d })
|
|
109
110
|
);
|
|
110
|
-
|
|
111
|
+
l.would_change += b.data.would_change, l.skipped += b.data.skipped, l.failed += b.data.failed, l.outcomes.push(...b.data.outcomes);
|
|
111
112
|
}
|
|
112
|
-
q((h) => ({ ...h, [u]:
|
|
113
|
+
q((h) => ({ ...h, [u]: l }));
|
|
113
114
|
} catch {
|
|
114
|
-
q((
|
|
115
|
+
q((l) => ({ ...l, [u]: null }));
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
}, M = /* @__PURE__ */ f(
|
|
118
|
-
|
|
119
|
+
ce,
|
|
119
120
|
{
|
|
120
121
|
targets: t,
|
|
121
122
|
enabledKeys: i,
|
|
122
123
|
tone: n,
|
|
123
124
|
disabled: s || !!P,
|
|
124
|
-
onDone: (e) => o == null ? void 0 : o({ ...e, action:
|
|
125
|
+
onDone: (e) => o == null ? void 0 : o({ ...e, action: me })
|
|
125
126
|
}
|
|
126
127
|
);
|
|
127
128
|
if (C.length === 0) return M;
|
|
128
129
|
const F = async (e) => {
|
|
129
130
|
const u = `${e.source}:${e.key}`;
|
|
130
131
|
S(u);
|
|
131
|
-
const
|
|
132
|
+
const l = { succeeded: 0, failed: 0, skipped: 0, errors: [] };
|
|
132
133
|
let h = 0;
|
|
133
134
|
try {
|
|
134
135
|
for (const r of e.collections) {
|
|
135
136
|
const m = t.filter((B) => B.collection === r).map((B) => B.id);
|
|
136
137
|
if (m.length === 0) continue;
|
|
137
138
|
h += m.length;
|
|
138
|
-
const w = { collection: r, ids: m, reason: N.trim() || null },
|
|
139
|
-
|
|
139
|
+
const w = { collection: r, ids: m, reason: N.trim() || null }, a = e.source === "db" ? D() : null;
|
|
140
|
+
a && ee(a, m);
|
|
140
141
|
const v = (e.source === "db" ? await c.request(
|
|
141
|
-
R(`/bulk-actions/run?progress=${
|
|
142
|
-
).finally(() =>
|
|
142
|
+
R(`/bulk-actions/run?progress=${a}`, { ...w, key: e.key })
|
|
143
|
+
).finally(() => te(a)) : await c.request(
|
|
143
144
|
R(`/bulk-actions/${e.key}/execute`, w)
|
|
144
145
|
)).data ?? {};
|
|
145
|
-
|
|
146
|
+
l.succeeded += v.succeeded ?? (e.source === "extension" ? m.length : 0), l.failed += v.failed ?? 0, l.skipped += v.skipped ?? 0, l.errors.push(...v.errors ?? []);
|
|
146
147
|
}
|
|
147
148
|
for (const r of e.collections)
|
|
148
|
-
|
|
149
|
+
se(
|
|
149
150
|
g,
|
|
150
151
|
r,
|
|
151
152
|
t.filter((m) => m.collection === r).map((m) => m.id)
|
|
152
153
|
);
|
|
153
|
-
const d =
|
|
154
|
+
const d = ue(e.label, l, h), b = l.errors.slice(0, 3).map((r) => `${H(r, t)}: ${r.error}`).join(`
|
|
154
155
|
`);
|
|
155
|
-
|
|
156
|
+
l.failed > 0 ? O.warning(d, { description: b || void 0, duration: 8e3 }) : O.success(d, { duration: 4e3 }), o == null || o({ ...l, action: e }), $(null), _("");
|
|
156
157
|
} catch (d) {
|
|
157
158
|
O.error(
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
oe(d, `${e.label} failed`),
|
|
160
|
+
ne(d, { action: e.label })
|
|
160
161
|
);
|
|
161
162
|
} finally {
|
|
162
163
|
S(null);
|
|
163
164
|
}
|
|
164
|
-
},
|
|
165
|
+
}, W = (e, u) => n === "dark" ? j(
|
|
165
166
|
"h-8 rounded-md px-3 text-[12.5px] font-medium transition-colors disabled:opacity-50",
|
|
166
167
|
e.variant === "danger" ? "border border-red-400/50 text-red-200 hover:bg-red-500/20 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10" : "border border-white/20 hover:bg-white/10 dark:border-border dark:hover:bg-muted",
|
|
167
168
|
u && (e.variant === "danger" ? "bg-red-500/20" : "bg-white/10")
|
|
@@ -170,30 +171,30 @@ function Be({
|
|
|
170
171
|
e.variant === "danger" ? "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
171
172
|
u && (e.variant === "danger" ? "bg-red-50 dark:bg-red-500/10" : "bg-slate-100 dark:bg-muted")
|
|
172
173
|
);
|
|
173
|
-
return /* @__PURE__ */ p(
|
|
174
|
+
return /* @__PURE__ */ p(X, { children: [
|
|
174
175
|
C.map((e) => {
|
|
175
|
-
const u = `${e.source}:${e.key}`,
|
|
176
|
+
const u = `${e.source}:${e.key}`, l = J === u, h = P === u, d = t.filter((r) => e.collections.includes(r.collection)).length, b = d > 0 && (!e.require_reason || N.trim().length > 0) && !h;
|
|
176
177
|
return /* @__PURE__ */ p(
|
|
177
|
-
|
|
178
|
+
ie,
|
|
178
179
|
{
|
|
179
|
-
open:
|
|
180
|
+
open: l,
|
|
180
181
|
onOpenChange: (r) => {
|
|
181
|
-
$(r ? u : null), r ? (E(!1),
|
|
182
|
+
$(r ? u : null), r ? (E(!1), V(e)) : _("");
|
|
182
183
|
},
|
|
183
184
|
children: [
|
|
184
|
-
/* @__PURE__ */ f(
|
|
185
|
+
/* @__PURE__ */ f(le, { asChild: !0, children: /* @__PURE__ */ f(
|
|
185
186
|
"button",
|
|
186
187
|
{
|
|
187
188
|
type: "button",
|
|
188
189
|
disabled: s || !!P,
|
|
189
190
|
"data-bulk-action": e.key,
|
|
190
191
|
title: e.summary,
|
|
191
|
-
className:
|
|
192
|
+
className: W(e, l),
|
|
192
193
|
children: h ? /* @__PURE__ */ f(Q, { className: "inline h-3.5 w-3.5 animate-spin" }) : e.label
|
|
193
194
|
}
|
|
194
195
|
) }),
|
|
195
196
|
/* @__PURE__ */ p(
|
|
196
|
-
|
|
197
|
+
ae,
|
|
197
198
|
{
|
|
198
199
|
align: "center",
|
|
199
200
|
side: "top",
|
|
@@ -216,11 +217,11 @@ function Be({
|
|
|
216
217
|
if (r === "loading")
|
|
217
218
|
return /* @__PURE__ */ f("p", { className: "mt-2 text-[11.5px] text-slate-400", "data-bulk-preview": "loading", children: "Checking what would change…" });
|
|
218
219
|
if (!r) return null;
|
|
219
|
-
const m = r.outcomes.filter((
|
|
220
|
-
for (const
|
|
220
|
+
const m = r.outcomes.filter((a) => a.outcome !== "change"), w = /* @__PURE__ */ new Map();
|
|
221
|
+
for (const a of m)
|
|
221
222
|
w.set(
|
|
222
|
-
|
|
223
|
-
(w.get(
|
|
223
|
+
a.reason ?? a.outcome,
|
|
224
|
+
(w.get(a.reason ?? a.outcome) ?? 0) + 1
|
|
224
225
|
);
|
|
225
226
|
return /* @__PURE__ */ p(
|
|
226
227
|
"div",
|
|
@@ -235,14 +236,14 @@ function Be({
|
|
|
235
236
|
" would change",
|
|
236
237
|
m.length > 0 && /* @__PURE__ */ p("span", { className: "font-normal text-slate-500", children: [
|
|
237
238
|
" · ",
|
|
238
|
-
[...w.entries()].map(([
|
|
239
|
+
[...w.entries()].map(([a, I]) => `${I} ${a}`).join(" · ")
|
|
239
240
|
] })
|
|
240
241
|
] }),
|
|
241
242
|
m.length > 0 && /* @__PURE__ */ p(
|
|
242
243
|
"button",
|
|
243
244
|
{
|
|
244
245
|
type: "button",
|
|
245
|
-
onClick: () => E((
|
|
246
|
+
onClick: () => E((a) => !a),
|
|
246
247
|
className: "mt-0.5 text-[11px] text-slate-500 underline-offset-2 hover:underline",
|
|
247
248
|
"data-bulk-preview-toggle": !0,
|
|
248
249
|
children: [
|
|
@@ -251,12 +252,11 @@ function Be({
|
|
|
251
252
|
]
|
|
252
253
|
}
|
|
253
254
|
),
|
|
254
|
-
T && /* @__PURE__ */ f("ul", { className: "mt-1 max-h-32 space-y-0.5 overflow-auto font-mono text-[10.5px] text-slate-600 dark:text-slate-300", children: m.slice(0, 50).map((
|
|
255
|
-
|
|
256
|
-
l.item,
|
|
255
|
+
T && /* @__PURE__ */ f("ul", { className: "mt-1 max-h-32 space-y-0.5 overflow-auto font-mono text-[10.5px] text-slate-600 dark:text-slate-300", children: m.slice(0, 50).map((a) => /* @__PURE__ */ p("li", { "data-bulk-preview-row": !0, children: [
|
|
256
|
+
H(a, t),
|
|
257
257
|
" — ",
|
|
258
|
-
|
|
259
|
-
] }, `${
|
|
258
|
+
a.reason ?? a.outcome
|
|
259
|
+
] }, `${a.item}:${a.outcome}`)) })
|
|
260
260
|
]
|
|
261
261
|
}
|
|
262
262
|
);
|
|
@@ -320,7 +320,7 @@ function Be({
|
|
|
320
320
|
M
|
|
321
321
|
] });
|
|
322
322
|
}
|
|
323
|
-
const
|
|
323
|
+
const me = {
|
|
324
324
|
key: "push",
|
|
325
325
|
source: "builtin",
|
|
326
326
|
collection: null,
|
|
@@ -333,10 +333,10 @@ const ue = {
|
|
|
333
333
|
summary: "Integration push"
|
|
334
334
|
};
|
|
335
335
|
export {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
Re as BulkActionButtons,
|
|
337
|
+
K as bulkActionEnabled,
|
|
338
|
+
Be as guardMatches,
|
|
339
|
+
de as mergeBulkActions,
|
|
340
|
+
G as useAvailableBulkActions,
|
|
341
|
+
Oe as useBuiltinGate
|
|
342
342
|
};
|