@nivaro/react 0.3.64 → 0.3.66
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 +62 -8
- package/dist/shared/components/CollectionBrowserView.js +3127 -3204
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4842 -4500
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -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 +1535 -1440
- 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/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
- 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 +398 -364
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -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/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +84 -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 +27 -16
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
- 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 +1522 -1347
- 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/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { useQuery as C } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as j, Lock as E } from "lucide-react";
|
|
4
|
+
import { useState as F, useMemo as w } from "react";
|
|
5
5
|
import { useNivaroClient as B } from "../../context.js";
|
|
6
|
-
import { post as
|
|
7
|
-
import { cn as
|
|
6
|
+
import { post as V, get as P } from "../../lib/commands.js";
|
|
7
|
+
import { cn as U } from "../../lib/utils.js";
|
|
8
8
|
import { FieldRenderer as D } from "../item-edit/FieldRenderer.js";
|
|
9
|
-
import { Command as G, CommandInput as M, CommandList as Q, CommandEmpty as R, CommandGroup as
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { Skeleton as
|
|
12
|
-
import { bulkFieldSections as
|
|
13
|
-
function
|
|
14
|
-
collection:
|
|
15
|
-
selectedIds:
|
|
16
|
-
disabled:
|
|
17
|
-
className:
|
|
18
|
-
onApply:
|
|
19
|
-
onSaveRecipe:
|
|
9
|
+
import { Command as G, CommandInput as M, CommandList as Q, CommandEmpty as R, CommandGroup as Y, CommandItem as z } from "../ui/command.js";
|
|
10
|
+
import { Popover as H, PopoverTrigger as I, PopoverContent as J } from "../ui/popover.js";
|
|
11
|
+
import { Skeleton as f } from "../ui/skeleton.js";
|
|
12
|
+
import { bulkFieldSections as W, bulkFieldNote as K } from "./bulk-field-options.js";
|
|
13
|
+
function ce({
|
|
14
|
+
collection: i,
|
|
15
|
+
selectedIds: m,
|
|
16
|
+
disabled: x,
|
|
17
|
+
className: N,
|
|
18
|
+
onApply: g,
|
|
19
|
+
onSaveRecipe: p
|
|
20
20
|
}) {
|
|
21
|
-
const [
|
|
21
|
+
const [y, a] = F(!1);
|
|
22
22
|
return /* @__PURE__ */ t(
|
|
23
|
-
|
|
23
|
+
H,
|
|
24
24
|
{
|
|
25
|
-
open:
|
|
26
|
-
onOpenChange: (
|
|
27
|
-
(!
|
|
25
|
+
open: y,
|
|
26
|
+
onOpenChange: (n) => {
|
|
27
|
+
(!x || !n) && a(n);
|
|
28
28
|
},
|
|
29
29
|
children: [
|
|
30
|
-
/* @__PURE__ */ e(
|
|
30
|
+
/* @__PURE__ */ e(I, { asChild: !0, children: /* @__PURE__ */ e(
|
|
31
31
|
"button",
|
|
32
32
|
{
|
|
33
33
|
type: "button",
|
|
34
|
-
disabled:
|
|
34
|
+
disabled: x,
|
|
35
35
|
"data-bulk-update-field": !0,
|
|
36
|
-
className:
|
|
36
|
+
className: N,
|
|
37
37
|
"aria-haspopup": "dialog",
|
|
38
38
|
children: "Update Field"
|
|
39
39
|
}
|
|
40
40
|
) }),
|
|
41
41
|
/* @__PURE__ */ e(
|
|
42
|
-
|
|
42
|
+
J,
|
|
43
43
|
{
|
|
44
44
|
side: "top",
|
|
45
45
|
align: "end",
|
|
46
46
|
sideOffset: 8,
|
|
47
47
|
className: "w-[380px] max-w-[calc(100vw-24px)] p-0",
|
|
48
|
-
onOpenAutoFocus: (
|
|
49
|
-
children:
|
|
50
|
-
|
|
48
|
+
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
49
|
+
children: y && /* @__PURE__ */ e(
|
|
50
|
+
X,
|
|
51
51
|
{
|
|
52
|
-
collection:
|
|
53
|
-
selectedIds:
|
|
52
|
+
collection: i,
|
|
53
|
+
selectedIds: m,
|
|
54
54
|
onCancel: () => a(!1),
|
|
55
|
-
onApply: (
|
|
56
|
-
a(!1),
|
|
55
|
+
onApply: (n, b) => {
|
|
56
|
+
a(!1), g(n, b);
|
|
57
57
|
},
|
|
58
|
-
onSaveRecipe:
|
|
59
|
-
a(!1),
|
|
58
|
+
onSaveRecipe: p ? (n, b) => {
|
|
59
|
+
a(!1), p(n, b);
|
|
60
60
|
} : void 0
|
|
61
61
|
}
|
|
62
62
|
)
|
|
@@ -66,39 +66,39 @@ function se({
|
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
collection:
|
|
71
|
-
selectedIds:
|
|
72
|
-
onCancel:
|
|
73
|
-
onApply:
|
|
74
|
-
onSaveRecipe:
|
|
69
|
+
function X({
|
|
70
|
+
collection: i,
|
|
71
|
+
selectedIds: m,
|
|
72
|
+
onCancel: x,
|
|
73
|
+
onApply: N,
|
|
74
|
+
onSaveRecipe: g
|
|
75
75
|
}) {
|
|
76
|
-
var
|
|
77
|
-
const
|
|
78
|
-
queryKey: ["bulk-fields",
|
|
79
|
-
queryFn: () =>
|
|
80
|
-
|
|
76
|
+
var T, L, O;
|
|
77
|
+
const p = B(), y = w(() => m.map(String).join(","), [m]), a = C({
|
|
78
|
+
queryKey: ["bulk-fields", i, y],
|
|
79
|
+
queryFn: () => p.request(
|
|
80
|
+
V(`/items/${i}/bulk-fields`, { ids: m })
|
|
81
81
|
).then((r) => r.data),
|
|
82
82
|
staleTime: 15e3,
|
|
83
83
|
retry: !1
|
|
84
|
-
}),
|
|
85
|
-
queryKey: ["bulk-fields-config",
|
|
86
|
-
queryFn: () =>
|
|
84
|
+
}), n = C({
|
|
85
|
+
queryKey: ["bulk-fields-config", i],
|
|
86
|
+
queryFn: () => p.request(P(`/field-config/${i}`)).then((r) => Array.isArray(r.data) ? r.data : []),
|
|
87
87
|
staleTime: 6e4
|
|
88
|
-
}),
|
|
89
|
-
queryKey: ["bulk-fields-relations",
|
|
90
|
-
queryFn: () =>
|
|
88
|
+
}), b = C({
|
|
89
|
+
queryKey: ["bulk-fields-relations", i],
|
|
90
|
+
queryFn: () => p.request(P(`/data-model/relations/for/${i}`)).then((r) => Array.isArray(r.data) ? r.data : []),
|
|
91
91
|
staleTime: 6e4
|
|
92
|
-
}),
|
|
92
|
+
}), A = w(() => {
|
|
93
93
|
const r = {};
|
|
94
|
-
for (const o of
|
|
94
|
+
for (const o of n.data ?? []) r[o.field] = o.label;
|
|
95
95
|
return r;
|
|
96
|
-
}, [
|
|
97
|
-
() => a.data ?
|
|
98
|
-
[a.data,
|
|
99
|
-
), [
|
|
100
|
-
if (
|
|
101
|
-
const r = (
|
|
96
|
+
}, [n.data]), $ = w(
|
|
97
|
+
() => a.data ? W(a.data, A) : [],
|
|
98
|
+
[a.data, A]
|
|
99
|
+
), [l, q] = F(null), [d, v] = F(null), s = ((T = a.data) == null ? void 0 : T.readable) ?? m.length, h = ((L = a.data) == null ? void 0 : L.forms) ?? [], S = a.data ? h.length === 0 ? "These records have no form, so every field you may change is listed." : h.length === 1 ? `Fields on their form, ${h[0].name}.` : `Fields on their ${h.length} forms, ${h[0].name} first.` : null;
|
|
100
|
+
if (l) {
|
|
101
|
+
const r = (n.data ?? []).find((k) => k.field === l.field), o = K(l, s), c = d == null || typeof d == "string" && d.trim() === "" || Array.isArray(d) && d.length === 0, u = l.required && c;
|
|
102
102
|
return /* @__PURE__ */ t("div", { className: "flex flex-col", "data-bulk-field-value": !0, children: [
|
|
103
103
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
104
104
|
/* @__PURE__ */ e(
|
|
@@ -106,26 +106,26 @@ function W({
|
|
|
106
106
|
{
|
|
107
107
|
type: "button",
|
|
108
108
|
onClick: () => {
|
|
109
|
-
|
|
109
|
+
q(null), v(null);
|
|
110
110
|
},
|
|
111
111
|
"aria-label": "Choose another field",
|
|
112
112
|
"data-tip": "Choose another field",
|
|
113
113
|
className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
114
|
-
children: /* @__PURE__ */ e(
|
|
114
|
+
children: /* @__PURE__ */ e(j, { className: "h-3.5 w-3.5" })
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
117
|
/* @__PURE__ */ t("div", { className: "min-w-0", children: [
|
|
118
118
|
/* @__PURE__ */ t("p", { className: "truncate text-[13px] font-semibold text-foreground", children: [
|
|
119
119
|
"Set ",
|
|
120
|
-
|
|
120
|
+
l.label
|
|
121
121
|
] }),
|
|
122
122
|
/* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", children: [
|
|
123
123
|
"On ",
|
|
124
|
-
|
|
124
|
+
l.writable,
|
|
125
125
|
" of ",
|
|
126
|
-
|
|
126
|
+
s,
|
|
127
127
|
" record",
|
|
128
|
-
|
|
128
|
+
s === 1 ? "" : "s"
|
|
129
129
|
] })
|
|
130
130
|
] })
|
|
131
131
|
] }),
|
|
@@ -134,23 +134,31 @@ function W({
|
|
|
134
134
|
D,
|
|
135
135
|
{
|
|
136
136
|
field: { ...r, readonly: !1 },
|
|
137
|
-
value:
|
|
138
|
-
onChange:
|
|
139
|
-
relations:
|
|
140
|
-
collection:
|
|
137
|
+
value: d,
|
|
138
|
+
onChange: v,
|
|
139
|
+
relations: b.data ?? [],
|
|
140
|
+
collection: i,
|
|
141
141
|
itemId: "new"
|
|
142
142
|
}
|
|
143
143
|
) : /* @__PURE__ */ e(
|
|
144
144
|
"input",
|
|
145
145
|
{
|
|
146
146
|
autoFocus: !0,
|
|
147
|
-
value:
|
|
148
|
-
onChange: (
|
|
149
|
-
"aria-label": `New ${
|
|
147
|
+
value: d == null ? "" : String(d),
|
|
148
|
+
onChange: (k) => v(k.target.value),
|
|
149
|
+
"aria-label": `New ${l.label}`,
|
|
150
150
|
className: "h-9 w-full rounded-md border border-input bg-background px-3 text-[13px] text-foreground focus-visible:border-nvr-cyan focus-visible:outline-none"
|
|
151
151
|
}
|
|
152
152
|
),
|
|
153
|
-
/* @__PURE__ */ e(
|
|
153
|
+
/* @__PURE__ */ e(
|
|
154
|
+
"p",
|
|
155
|
+
{
|
|
156
|
+
className: "text-[11.5px] leading-4 text-muted-foreground",
|
|
157
|
+
id: "bulk-field-hint",
|
|
158
|
+
"data-bulk-field-hint": !0,
|
|
159
|
+
children: u ? `${l.label} is required — choose a value to apply.` : c ? `Leave it empty to clear ${l.label} on every record.` : "Records that already hold this value are left as they are."
|
|
160
|
+
}
|
|
161
|
+
),
|
|
154
162
|
o && /* @__PURE__ */ t(
|
|
155
163
|
"p",
|
|
156
164
|
{
|
|
@@ -164,11 +172,11 @@ function W({
|
|
|
164
172
|
)
|
|
165
173
|
] }),
|
|
166
174
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 border-t border-border px-3 py-2", children: [
|
|
167
|
-
|
|
175
|
+
g && /* @__PURE__ */ e(
|
|
168
176
|
"button",
|
|
169
177
|
{
|
|
170
178
|
type: "button",
|
|
171
|
-
onClick: () =>
|
|
179
|
+
onClick: () => g(l.field, d),
|
|
172
180
|
"data-tip": "Save this update as a reusable recipe",
|
|
173
181
|
className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
174
182
|
children: "Save recipe"
|
|
@@ -179,7 +187,7 @@ function W({
|
|
|
179
187
|
"button",
|
|
180
188
|
{
|
|
181
189
|
type: "button",
|
|
182
|
-
onClick:
|
|
190
|
+
onClick: x,
|
|
183
191
|
className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
184
192
|
children: "Cancel"
|
|
185
193
|
}
|
|
@@ -188,13 +196,16 @@ function W({
|
|
|
188
196
|
"button",
|
|
189
197
|
{
|
|
190
198
|
type: "button",
|
|
191
|
-
disabled:
|
|
192
|
-
|
|
199
|
+
disabled: l.writable === 0 || u,
|
|
200
|
+
"aria-describedby": u ? "bulk-field-hint" : void 0,
|
|
201
|
+
onClick: () => N(l.field, d),
|
|
193
202
|
"data-bulk-field-apply": !0,
|
|
194
203
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white transition-colors hover:bg-nvr-cyan/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan focus-visible:ring-offset-2 disabled:opacity-40",
|
|
195
204
|
children: [
|
|
196
205
|
"Apply to ",
|
|
197
|
-
|
|
206
|
+
l.writable,
|
|
207
|
+
" record",
|
|
208
|
+
l.writable === 1 ? "" : "s"
|
|
198
209
|
]
|
|
199
210
|
}
|
|
200
211
|
)
|
|
@@ -205,18 +216,18 @@ function W({
|
|
|
205
216
|
/* @__PURE__ */ t("div", { className: "border-b border-border px-3 py-2.5", children: [
|
|
206
217
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-foreground", children: [
|
|
207
218
|
"Update a field on ",
|
|
208
|
-
|
|
219
|
+
s,
|
|
209
220
|
" record",
|
|
210
|
-
|
|
221
|
+
s === 1 ? "" : "s"
|
|
211
222
|
] }),
|
|
212
|
-
|
|
223
|
+
S ? /* @__PURE__ */ e("p", { className: "text-[11.5px] text-muted-foreground", children: S }) : /* @__PURE__ */ e(f, { className: "mt-1 h-3 w-48" })
|
|
213
224
|
] }),
|
|
214
225
|
a.isLoading ? /* @__PURE__ */ t("div", { className: "space-y-2 p-3", "aria-busy": "true", children: [
|
|
215
|
-
/* @__PURE__ */ e(
|
|
216
|
-
/* @__PURE__ */ e(
|
|
217
|
-
/* @__PURE__ */ e(
|
|
218
|
-
/* @__PURE__ */ e(
|
|
219
|
-
/* @__PURE__ */ e(
|
|
226
|
+
/* @__PURE__ */ e(f, { className: "h-3 w-20" }),
|
|
227
|
+
/* @__PURE__ */ e(f, { className: "h-7 w-full" }),
|
|
228
|
+
/* @__PURE__ */ e(f, { className: "h-7 w-full" }),
|
|
229
|
+
/* @__PURE__ */ e(f, { className: "h-3 w-24" }),
|
|
230
|
+
/* @__PURE__ */ e(f, { className: "h-7 w-full" })
|
|
220
231
|
] }) : a.isError ? /* @__PURE__ */ t("div", { className: "space-y-2 px-3 py-4 text-[12.5px] text-muted-foreground", children: [
|
|
221
232
|
/* @__PURE__ */ e("p", { children: "Could not read these records’ forms." }),
|
|
222
233
|
/* @__PURE__ */ e(
|
|
@@ -228,19 +239,19 @@ function W({
|
|
|
228
239
|
children: "Try again"
|
|
229
240
|
}
|
|
230
241
|
)
|
|
231
|
-
] }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children:
|
|
242
|
+
] }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children: s === 0 ? "You cannot open any of the selected records." : "Their form has no field you can change in bulk. Open a record to edit it there." }) : /* @__PURE__ */ t(G, { className: "rounded-none bg-transparent", children: [
|
|
232
243
|
/* @__PURE__ */ e(M, { placeholder: "Find a field…", className: "h-9 text-[13px]" }),
|
|
233
244
|
/* @__PURE__ */ t(Q, { className: "max-h-[320px]", children: [
|
|
234
245
|
/* @__PURE__ */ e(R, { className: "py-5 text-center text-[12.5px] text-muted-foreground", children: "No field on the form matches." }),
|
|
235
|
-
$.map((r) => /* @__PURE__ */ e(
|
|
236
|
-
const
|
|
246
|
+
$.map((r) => /* @__PURE__ */ e(Y, { heading: r.label, children: r.options.map((o) => {
|
|
247
|
+
const c = o.writable === 0, u = K(o, s);
|
|
237
248
|
return /* @__PURE__ */ t(
|
|
238
|
-
|
|
249
|
+
z,
|
|
239
250
|
{
|
|
240
251
|
value: `${r.label} ${o.label} ${o.field}`,
|
|
241
|
-
disabled:
|
|
252
|
+
disabled: c,
|
|
242
253
|
onSelect: () => {
|
|
243
|
-
|
|
254
|
+
q(o), v(null);
|
|
244
255
|
},
|
|
245
256
|
"data-bulk-field-option": o.field,
|
|
246
257
|
className: "items-start py-1.5 text-[13px] data-[disabled=true]:opacity-100",
|
|
@@ -249,26 +260,26 @@ function W({
|
|
|
249
260
|
/* @__PURE__ */ e(
|
|
250
261
|
"span",
|
|
251
262
|
{
|
|
252
|
-
className:
|
|
263
|
+
className: U(
|
|
253
264
|
"block truncate",
|
|
254
|
-
|
|
265
|
+
c ? "text-muted-foreground" : "text-foreground"
|
|
255
266
|
),
|
|
256
267
|
children: o.label
|
|
257
268
|
}
|
|
258
269
|
),
|
|
259
|
-
|
|
270
|
+
u && /* @__PURE__ */ e(
|
|
260
271
|
"span",
|
|
261
272
|
{
|
|
262
|
-
className:
|
|
273
|
+
className: U(
|
|
263
274
|
"block truncate text-[11px] leading-4",
|
|
264
|
-
|
|
275
|
+
c ? "text-muted-foreground" : "text-amber-700 dark:text-amber-300"
|
|
265
276
|
),
|
|
266
|
-
children:
|
|
277
|
+
children: u.charAt(0).toUpperCase() + u.slice(1)
|
|
267
278
|
}
|
|
268
279
|
)
|
|
269
280
|
] }),
|
|
270
|
-
|
|
271
|
-
|
|
281
|
+
c && /* @__PURE__ */ e(
|
|
282
|
+
E,
|
|
272
283
|
{
|
|
273
284
|
className: "mt-0.5 h-3.5 w-3.5 text-muted-foreground",
|
|
274
285
|
"aria-label": "Locked"
|
|
@@ -281,9 +292,9 @@ function W({
|
|
|
281
292
|
}) }, r.key))
|
|
282
293
|
] })
|
|
283
294
|
] }),
|
|
284
|
-
((
|
|
295
|
+
((O = a.data) == null ? void 0 : O.capped) && /* @__PURE__ */ e("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checked the first 1,000 selected records." })
|
|
285
296
|
] });
|
|
286
297
|
}
|
|
287
298
|
export {
|
|
288
|
-
|
|
299
|
+
ce as BulkFieldUpdate
|
|
289
300
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as b } from "@tanstack/react-query";
|
|
3
|
+
import { useState as h } from "react";
|
|
4
|
+
import { toast as n } from "sonner";
|
|
5
|
+
import { useNivaroClient as $ } from "../../context.js";
|
|
6
|
+
import { newBulkProgressId as U, startBulkProgress as v, endBulkProgress as w } from "../../lib/bulk-progress.js";
|
|
7
|
+
import { post as F } from "../../lib/commands.js";
|
|
8
|
+
import { errorToastOptions as P } from "../../lib/error-toast.js";
|
|
9
|
+
import { userErrorMessage as j } from "../../lib/safe-error.js";
|
|
10
|
+
import { invalidateRecordQueries as C } from "../item-edit/RecordLiveSync.js";
|
|
11
|
+
import { BulkFieldUpdate as q } from "./BulkFieldUpdate.js";
|
|
12
|
+
function z({
|
|
13
|
+
targets: o,
|
|
14
|
+
disabled: m,
|
|
15
|
+
className: p,
|
|
16
|
+
onDone: s
|
|
17
|
+
}) {
|
|
18
|
+
const y = $(), k = b(), [g, u] = h(!1), a = [...new Set(o.map((t) => t.collection))];
|
|
19
|
+
if (o.length === 0) return null;
|
|
20
|
+
if (a.length !== 1)
|
|
21
|
+
return /* @__PURE__ */ f(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
type: "button",
|
|
25
|
+
disabled: !0,
|
|
26
|
+
"data-tip": "Pick records of one kind to update a field on them together",
|
|
27
|
+
className: p,
|
|
28
|
+
children: "Update Field"
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
const i = a[0], r = o.map((t) => t.id), B = async (t, d) => {
|
|
32
|
+
u(!0);
|
|
33
|
+
const l = U();
|
|
34
|
+
v(l, r);
|
|
35
|
+
try {
|
|
36
|
+
const e = await y.request(
|
|
37
|
+
F(`/items/${i}/bulk-update?progress=${l}`, {
|
|
38
|
+
ids: r,
|
|
39
|
+
data: { [t]: d ?? null },
|
|
40
|
+
by_form: !0
|
|
41
|
+
})
|
|
42
|
+
), c = [
|
|
43
|
+
`Updated ${e.updated} record${e.updated === 1 ? "" : "s"}`,
|
|
44
|
+
e.skipped ? `${e.skipped} already set` : "",
|
|
45
|
+
e.refused ? `${e.refused} refused` : ""
|
|
46
|
+
].filter(Boolean);
|
|
47
|
+
e.refused ? n.warning(c.join(" · "), {
|
|
48
|
+
description: e.refused_reason ?? void 0,
|
|
49
|
+
duration: 8e3
|
|
50
|
+
}) : n.success(c.join(" · ")), C(k, i, r), s == null || s();
|
|
51
|
+
} catch (e) {
|
|
52
|
+
n.error(
|
|
53
|
+
j(e, "Could not update the field"),
|
|
54
|
+
P(e, { action: "Update Field" })
|
|
55
|
+
);
|
|
56
|
+
} finally {
|
|
57
|
+
w(l), u(!1);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ f(
|
|
61
|
+
q,
|
|
62
|
+
{
|
|
63
|
+
collection: i,
|
|
64
|
+
selectedIds: r,
|
|
65
|
+
disabled: m || g,
|
|
66
|
+
onApply: (t, d) => void B(t, d),
|
|
67
|
+
className: p
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
z as BulkFieldUpdateButton
|
|
73
|
+
};
|