@nivaro/react 0.3.138 → 0.3.140
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/components/InlineGridField.js +95 -92
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +36 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2677 -2658
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3038 -3027
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +671 -670
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +121 -121
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +316 -278
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as de } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as Te, useQuery as we } from "@tanstack/react-query";
|
|
3
|
-
import { Clock as
|
|
3
|
+
import { Clock as ze, Download as Oe, Loader2 as ve, Upload as Le, X as ye, Plus as nt, File as $e, FileVideo as rt, FileAudio as at, FileText as Ce, FileSpreadsheet as it, FileCode as ot } from "lucide-react";
|
|
4
4
|
import { useId as Re, useState as w, useRef as K, useEffect as D } from "react";
|
|
5
|
-
import { useNivaroClient as
|
|
5
|
+
import { useNivaroClient as Ue, useApiFetchConfig as Ke, useGridFlush as Ae, useParentDraft as Me } from "../../context.js";
|
|
6
6
|
import { useFileHealth as Ee } from "../../hooks/useFileHealth.js";
|
|
7
|
-
import { get as
|
|
7
|
+
import { get as ke, post as Se, del as Pe } from "../../lib/commands.js";
|
|
8
8
|
import { trackedUpload as Qe } from "../../lib/upload-presence.js";
|
|
9
|
-
import { cn as ce,
|
|
10
|
-
import { useFileDownloadStats as
|
|
9
|
+
import { cn as ce, formatFileSize as dt, formatDateTime as ct } from "../../lib/utils.js";
|
|
10
|
+
import { useFileDownloadStats as Ve, FileDownloadCount as Be } from "./FileDownloadCount.js";
|
|
11
11
|
import { useOnceVisible as De, useFileUsage as He, FileUsageChip as Je } from "./FileUsage.js";
|
|
12
12
|
import { useFileDownload as Ge } from "./file-download.js";
|
|
13
|
-
import { OWN_FILE_CHANGE_MS as
|
|
14
|
-
import { useFileProcessing as Ye, FileProcessingBadge as Ie, FileProcessingTile as
|
|
15
|
-
import { liveRecordWrite as
|
|
16
|
-
import { useM2MStaging as
|
|
13
|
+
import { OWN_FILE_CHANGE_MS as ut, RemovedFileRow as Xe, lastWriterName as Ze, noteOwnFileChange as be, useLiveFileList as mt, REMOVED_SHOW_MS as We, REMOVED_FADE_MS as ht } from "./file-live.js";
|
|
14
|
+
import { useFileProcessing as Ye, FileProcessingBadge as Ie, FileProcessingTile as ft, chipThumbUrl as qe } from "./file-processing.js";
|
|
15
|
+
import { liveRecordWrite as pt } from "./live-record-marks.js";
|
|
16
|
+
import { useM2MStaging as xt } from "./M2MStagingContext.js";
|
|
17
17
|
import { RemoteUploadRows as et } from "./RemoteUploads.js";
|
|
18
18
|
function ue(s) {
|
|
19
19
|
var x;
|
|
@@ -23,10 +23,10 @@ function ue(s) {
|
|
|
23
23
|
return h ? new RegExp(`\\.${h}$`, "i").test(n) ? n : `${n}.${h}` : n;
|
|
24
24
|
}
|
|
25
25
|
function Ne(s) {
|
|
26
|
-
return s ?
|
|
26
|
+
return s ? dt(s) : null;
|
|
27
27
|
}
|
|
28
28
|
function tt(s) {
|
|
29
|
-
return s ?
|
|
29
|
+
return s ? ct(s) : null;
|
|
30
30
|
}
|
|
31
31
|
function je(s) {
|
|
32
32
|
return !!s && s.startsWith("image/");
|
|
@@ -36,12 +36,12 @@ function _e(s, n) {
|
|
|
36
36
|
const d = (s ?? "").toLowerCase(), h = ((x = (n ?? "").split(".").pop()) == null ? void 0 : x.toUpperCase()) ?? "";
|
|
37
37
|
return d === "application/pdf" ? "PDF" : d === "text/csv" ? "CSV" : d.includes("spreadsheet") || d.includes("excel") ? "Spreadsheet" : d.includes("wordprocessing") || d.includes("msword") ? "Word document" : d.includes("presentation") || d.includes("powerpoint") ? "Presentation" : d.startsWith("image/") ? `Image${h && (n != null && n.includes(".")) ? ` (${h})` : ""}` : d.startsWith("video/") ? "Video" : d.startsWith("audio/") ? "Audio" : d.includes("zip") || d.includes("compressed") ? "ZIP archive" : d === "text/plain" ? "Text" : d.includes("json") ? "JSON" : d.includes("xml") ? "XML" : h && h.length <= 5 && (n != null && n.includes(".")) ? h : "File";
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function gt(s) {
|
|
40
40
|
const n = (s ?? "").toLowerCase();
|
|
41
41
|
return n === "application/pdf" ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : n.includes("spreadsheet") || n.includes("excel") || n === "text/csv" ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300" : n.includes("wordprocessing") || n.includes("msword") ? "bg-sky-50 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-300";
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return s ? s.startsWith("video/") ? /* @__PURE__ */ e(rt, { className: n, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(at, { className: n, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(it, { className: n, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ot, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e(
|
|
43
|
+
function bt(s, n) {
|
|
44
|
+
return s ? s.startsWith("video/") ? /* @__PURE__ */ e(rt, { className: n, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(at, { className: n, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(it, { className: n, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ot, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e($e, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e($e, { className: n, strokeWidth: 1.5 });
|
|
45
45
|
}
|
|
46
46
|
function me({
|
|
47
47
|
url: s,
|
|
@@ -53,9 +53,9 @@ function me({
|
|
|
53
53
|
const P = h === "sm" ? "h-10 w-10" : h === "lg" ? "h-20 w-20" : "h-14 w-14", [g, W] = w(!1), [N, p] = w(!1), [u, f] = w(0), q = K(x);
|
|
54
54
|
if (D(() => {
|
|
55
55
|
q.current && !x && (W(!1), p(!1), f(Date.now())), q.current = x;
|
|
56
|
-
}, [x]), je(n) && x) return /* @__PURE__ */ e(
|
|
56
|
+
}, [x]), je(n) && x) return /* @__PURE__ */ e(ft, { className: P });
|
|
57
57
|
if (je(n) && !N) {
|
|
58
|
-
const
|
|
58
|
+
const O = () => {
|
|
59
59
|
if (!g && qe(s) !== s) {
|
|
60
60
|
W(!0);
|
|
61
61
|
return;
|
|
@@ -70,9 +70,9 @@ function me({
|
|
|
70
70
|
"data-file-thumb": !0,
|
|
71
71
|
className: ce(P, "object-cover rounded shrink-0"),
|
|
72
72
|
loading: "lazy",
|
|
73
|
-
onError:
|
|
73
|
+
onError: O,
|
|
74
74
|
onLoad: (j) => {
|
|
75
|
-
j.currentTarget.naturalWidth === 0 &&
|
|
75
|
+
j.currentTarget.naturalWidth === 0 && O();
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
);
|
|
@@ -80,8 +80,8 @@ function me({
|
|
|
80
80
|
return /* @__PURE__ */ e(
|
|
81
81
|
"div",
|
|
82
82
|
{
|
|
83
|
-
className: ce(P, "flex items-center justify-center rounded shrink-0",
|
|
84
|
-
children:
|
|
83
|
+
className: ce(P, "flex items-center justify-center rounded shrink-0", gt(n)),
|
|
84
|
+
children: bt(n, h === "sm" ? "h-4 w-4" : "h-6 w-6")
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
}
|
|
@@ -92,10 +92,10 @@ function lt({
|
|
|
92
92
|
onClose: h,
|
|
93
93
|
getUrl: x
|
|
94
94
|
}) {
|
|
95
|
-
const P =
|
|
95
|
+
const P = Ue(), [g, W] = w(""), { data: N = [], isLoading: p } = we({
|
|
96
96
|
queryKey: ["file-browser", g],
|
|
97
97
|
queryFn: () => P.request(
|
|
98
|
-
|
|
98
|
+
ke("/files", {
|
|
99
99
|
limit: "60",
|
|
100
100
|
sort: "-uploaded_on",
|
|
101
101
|
fields: "id,filename_download,title,type,filesize,width,height,missing_at",
|
|
@@ -117,7 +117,7 @@ function lt({
|
|
|
117
117
|
"aria-label": "Close",
|
|
118
118
|
onClick: h,
|
|
119
119
|
className: "text-slate-400 hover:text-slate-600",
|
|
120
|
-
children: /* @__PURE__ */ e(
|
|
120
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
] }),
|
|
@@ -192,7 +192,7 @@ function lt({
|
|
|
192
192
|
] })
|
|
193
193
|
] });
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Tt({
|
|
196
196
|
field: s,
|
|
197
197
|
value: n,
|
|
198
198
|
onChange: d,
|
|
@@ -203,15 +203,15 @@ function jt({
|
|
|
203
203
|
showDownloads: W = !0
|
|
204
204
|
}) {
|
|
205
205
|
var ge, ie, oe;
|
|
206
|
-
const N =
|
|
206
|
+
const N = Ue(), p = Ke(), u = Te(), f = Ae(), q = Re(), [O, v] = w(!1), [j, te] = w(!1), [A, Y] = w(null), [b, H] = w(null), [le, $] = w(null), C = K(null), a = !b && n ? String(n) : null, L = (m) => N.fileUrl(m), I = Ge(), o = Me(), R = ((ge = o == null ? void 0 : o.draft) == null ? void 0 : ge.id) != null ? String(o.draft.id) : null, M = Ye(a ? [a] : [], {
|
|
207
207
|
collection: o == null ? void 0 : o.collection,
|
|
208
208
|
itemId: R
|
|
209
|
-
}), [he, T] = De(!!a),
|
|
209
|
+
}), [he, T] = De(!!a), z = He(
|
|
210
210
|
o == null ? void 0 : o.collection,
|
|
211
211
|
R,
|
|
212
212
|
a ? [a] : [],
|
|
213
213
|
T && g
|
|
214
|
-
), se =
|
|
214
|
+
), se = Ve(
|
|
215
215
|
o == null ? void 0 : o.collection,
|
|
216
216
|
R,
|
|
217
217
|
a ? [a] : [],
|
|
@@ -219,11 +219,11 @@ function jt({
|
|
|
219
219
|
);
|
|
220
220
|
D(() => {
|
|
221
221
|
if (!b) {
|
|
222
|
-
|
|
222
|
+
$(null);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
const m = URL.createObjectURL(b);
|
|
226
|
-
return
|
|
226
|
+
return $(m), () => URL.revokeObjectURL(m);
|
|
227
227
|
}, [b]), D(() => {
|
|
228
228
|
if (!(!f || !b))
|
|
229
229
|
return f.register(q, async () => {
|
|
@@ -231,24 +231,24 @@ function jt({
|
|
|
231
231
|
d(m.id), H(null), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
232
232
|
}), () => f.unregister(q);
|
|
233
233
|
}, [f, b, q, N, d, u]);
|
|
234
|
-
const
|
|
234
|
+
const y = Ee([a]), { data: r, isLoading: ne } = we({
|
|
235
235
|
queryKey: ["file-meta", a],
|
|
236
|
-
queryFn: () => N.request(
|
|
236
|
+
queryFn: () => N.request(ke(`/files/${a}/meta`)).then((m) => m.data ?? null),
|
|
237
237
|
enabled: !!a,
|
|
238
238
|
staleTime: 6e4
|
|
239
|
-
}), E = K(0), fe = K(a), re = K(null), [
|
|
239
|
+
}), E = K(0), fe = K(a), re = K(null), [U, k] = w(!1), [J, Q] = w(null), V = K([]);
|
|
240
240
|
r && (re.current = ue(r) || re.current), D(() => {
|
|
241
241
|
const m = fe.current;
|
|
242
242
|
if (fe.current = a, m === a || b) return;
|
|
243
|
-
const S = Date.now() - E.current <
|
|
244
|
-
if (S || !G || !R || !
|
|
245
|
-
const X = (t, l) =>
|
|
246
|
-
a ? (Q(null),
|
|
243
|
+
const S = Date.now() - E.current < ut, G = o == null ? void 0 : o.collection;
|
|
244
|
+
if (S || !G || !R || !pt(G, R)) return;
|
|
245
|
+
const X = (t, l) => V.current.push(setTimeout(t, l));
|
|
246
|
+
a ? (Q(null), k(!0), X(() => k(!1), 2e3)) : m && (Q({ name: re.current ?? "A file", leaving: !1 }), X(
|
|
247
247
|
() => Q((t) => t && { ...t, leaving: !0 }),
|
|
248
|
-
We -
|
|
248
|
+
We - ht
|
|
249
249
|
), X(() => Q(null), We));
|
|
250
250
|
}, [a]), D(() => {
|
|
251
|
-
const m =
|
|
251
|
+
const m = V.current;
|
|
252
252
|
return () => {
|
|
253
253
|
for (const S of m) clearTimeout(S);
|
|
254
254
|
};
|
|
@@ -299,10 +299,10 @@ function jt({
|
|
|
299
299
|
"div",
|
|
300
300
|
{
|
|
301
301
|
ref: he,
|
|
302
|
-
"data-file-fresh":
|
|
302
|
+
"data-file-fresh": U ? "" : void 0,
|
|
303
303
|
className: ce(
|
|
304
304
|
"flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50 dark:border-border dark:bg-white/[0.03]",
|
|
305
|
-
|
|
305
|
+
U && "nvr-row-enter"
|
|
306
306
|
),
|
|
307
307
|
children: [
|
|
308
308
|
_ ? /* @__PURE__ */ e(
|
|
@@ -330,7 +330,7 @@ function jt({
|
|
|
330
330
|
type: (r == null ? void 0 : r.type) ?? null,
|
|
331
331
|
filename: (r == null ? void 0 : r.filename_download) ?? "",
|
|
332
332
|
size: "sm",
|
|
333
|
-
processing: !!a &&
|
|
333
|
+
processing: !!a && M.isProcessing(a)
|
|
334
334
|
}
|
|
335
335
|
)
|
|
336
336
|
}
|
|
@@ -338,7 +338,7 @@ function jt({
|
|
|
338
338
|
),
|
|
339
339
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
340
340
|
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
341
|
-
_ && /* @__PURE__ */ e(
|
|
341
|
+
_ && /* @__PURE__ */ e(ze, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
342
342
|
/* @__PURE__ */ e(
|
|
343
343
|
"p",
|
|
344
344
|
{
|
|
@@ -350,8 +350,8 @@ function jt({
|
|
|
350
350
|
)
|
|
351
351
|
}
|
|
352
352
|
),
|
|
353
|
-
!_ && !!a &&
|
|
354
|
-
!_ && (
|
|
353
|
+
!_ && !!a && M.isProcessing(a) && /* @__PURE__ */ e(Ie, {}),
|
|
354
|
+
!_ && (y.verdict(a) ?? !!(r != null && r.missing_at)) && /* @__PURE__ */ e(
|
|
355
355
|
"span",
|
|
356
356
|
{
|
|
357
357
|
className: "shrink-0 rounded bg-red-500/10 px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",
|
|
@@ -378,13 +378,13 @@ function jt({
|
|
|
378
378
|
Je,
|
|
379
379
|
{
|
|
380
380
|
fileId: a,
|
|
381
|
-
uses: (ie =
|
|
382
|
-
loading:
|
|
381
|
+
uses: (ie = z.data) == null ? void 0 : ie[a],
|
|
382
|
+
loading: z.isLoading,
|
|
383
383
|
collection: o == null ? void 0 : o.collection,
|
|
384
384
|
itemId: R
|
|
385
385
|
}
|
|
386
386
|
),
|
|
387
|
-
W && !_ && a && /* @__PURE__ */ e(
|
|
387
|
+
W && !_ && a && /* @__PURE__ */ e(Be, { fileId: a, stat: (oe = se.data) == null ? void 0 : oe[a] }),
|
|
388
388
|
!_ && a && /* @__PURE__ */ e(
|
|
389
389
|
"a",
|
|
390
390
|
{
|
|
@@ -392,7 +392,7 @@ function jt({
|
|
|
392
392
|
onClick: I(`${L(a)}?download=1`, r == null ? void 0 : r.filename_download),
|
|
393
393
|
title: "Download",
|
|
394
394
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
395
|
-
children: /* @__PURE__ */ e(
|
|
395
|
+
children: /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" })
|
|
396
396
|
}
|
|
397
397
|
),
|
|
398
398
|
!h && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
@@ -418,7 +418,7 @@ function jt({
|
|
|
418
418
|
className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400 disabled:opacity-40 flex items-center gap-1",
|
|
419
419
|
children: [
|
|
420
420
|
j ? /* @__PURE__ */ e(ve, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3 w-3" }),
|
|
421
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children: j &&
|
|
421
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: j && A != null ? `${A}%` : "Upload" })
|
|
422
422
|
]
|
|
423
423
|
}
|
|
424
424
|
),
|
|
@@ -431,7 +431,7 @@ function jt({
|
|
|
431
431
|
"aria-label": "Remove file",
|
|
432
432
|
onClick: pe,
|
|
433
433
|
className: "text-slate-300 hover:text-red-400 p-0.5",
|
|
434
|
-
children: /* @__PURE__ */ e(
|
|
434
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
435
435
|
}
|
|
436
436
|
)
|
|
437
437
|
] })
|
|
@@ -462,7 +462,7 @@ function jt({
|
|
|
462
462
|
className: "flex h-9 items-center gap-1.5 rounded-md border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 dark:border-border dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-200 disabled:opacity-40 transition-colors",
|
|
463
463
|
children: [
|
|
464
464
|
j ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3.5 w-3.5" }),
|
|
465
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children: j &&
|
|
465
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: j && A != null ? `${A}%` : "Upload" })
|
|
466
466
|
]
|
|
467
467
|
}
|
|
468
468
|
),
|
|
@@ -470,7 +470,7 @@ function jt({
|
|
|
470
470
|
] })
|
|
471
471
|
] }),
|
|
472
472
|
/* @__PURE__ */ e(et, { collection: o == null ? void 0 : o.collection, item: R, field: s }),
|
|
473
|
-
|
|
473
|
+
O && /* @__PURE__ */ e(
|
|
474
474
|
"div",
|
|
475
475
|
{
|
|
476
476
|
className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
|
|
@@ -489,7 +489,7 @@ function jt({
|
|
|
489
489
|
)
|
|
490
490
|
] });
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function zt({
|
|
493
493
|
relation: s,
|
|
494
494
|
parentId: n,
|
|
495
495
|
allRelations: d,
|
|
@@ -500,12 +500,12 @@ function Tt({
|
|
|
500
500
|
showUsage: W = !0,
|
|
501
501
|
showDownloads: N = !0
|
|
502
502
|
}) {
|
|
503
|
-
const p =
|
|
503
|
+
const p = Ue(), u = Te(), f = Ae(), q = Re(), O = Re(), v = xt(), [j, te] = w(!1), [A, Y] = w(!1), b = Ke(), [H, le] = w(null), [$, C] = w([]), a = K(null), [L, I] = w([]), [o, R] = w(/* @__PURE__ */ new Set()), M = K(/* @__PURE__ */ new Map()), he = K(/* @__PURE__ */ new Map()), T = s.junction_field ?? "", z = s.many_field ?? "", se = s.one_field ?? `${s.many_collection}.${T}`, y = n === "new", r = (t) => p.fileUrl(t), ne = Ge();
|
|
504
504
|
D(() => () => {
|
|
505
505
|
C((t) => (t.forEach((l) => URL.revokeObjectURL(l.url)), []));
|
|
506
506
|
}, []), D(() => {
|
|
507
|
-
if (!f ||
|
|
508
|
-
const t =
|
|
507
|
+
if (!f || !$.length || g) return;
|
|
508
|
+
const t = $;
|
|
509
509
|
return f.register(q, async () => {
|
|
510
510
|
for (const l of t) {
|
|
511
511
|
const c = await p.upload(l.file);
|
|
@@ -513,80 +513,80 @@ function Tt({
|
|
|
513
513
|
}
|
|
514
514
|
C([]), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
515
515
|
}), () => f.unregister(q);
|
|
516
|
-
}, [f,
|
|
516
|
+
}, [f, $, q, g]), D(() => {
|
|
517
517
|
if (!f || !g) return;
|
|
518
|
-
if (!(L.length > 0 || o.size > 0 ||
|
|
519
|
-
f.unregister(
|
|
518
|
+
if (!(L.length > 0 || o.size > 0 || $.length > 0)) {
|
|
519
|
+
f.unregister(O);
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
|
-
const l = L, c = new Set(o), F =
|
|
523
|
-
return f.register(
|
|
522
|
+
const l = L, c = new Set(o), F = $;
|
|
523
|
+
return f.register(O, async () => {
|
|
524
524
|
const Z = [];
|
|
525
|
-
for (const
|
|
526
|
-
const ee = await p.upload(
|
|
527
|
-
URL.revokeObjectURL(
|
|
525
|
+
for (const B of F) {
|
|
526
|
+
const ee = await p.upload(B.file);
|
|
527
|
+
URL.revokeObjectURL(B.url), Z.push(ee.id);
|
|
528
528
|
}
|
|
529
|
-
for (const
|
|
530
|
-
be(
|
|
529
|
+
for (const B of [...l, ...Z])
|
|
530
|
+
be(M, B), await p.request(
|
|
531
531
|
Se(`/items/${s.many_collection}`, {
|
|
532
|
-
[
|
|
533
|
-
[T]:
|
|
532
|
+
[z]: n,
|
|
533
|
+
[T]: B
|
|
534
534
|
})
|
|
535
535
|
);
|
|
536
|
-
for (const
|
|
537
|
-
be(
|
|
538
|
-
const ee = E.find((st) => String(st[T]) ===
|
|
536
|
+
for (const B of c) {
|
|
537
|
+
be(M, B);
|
|
538
|
+
const ee = E.find((st) => String(st[T]) === B);
|
|
539
539
|
ee != null && ee.id && await p.request(Pe(`/items/${s.many_collection}/${ee.id}`));
|
|
540
540
|
}
|
|
541
541
|
I([]), R(/* @__PURE__ */ new Set()), C([]), u.invalidateQueries({
|
|
542
|
-
queryKey: ["m2m-items", s.many_collection,
|
|
542
|
+
queryKey: ["m2m-items", s.many_collection, z, n]
|
|
543
543
|
}), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
544
|
-
}), () => f.unregister(
|
|
545
|
-
}, [f, g, L, o,
|
|
544
|
+
}), () => f.unregister(O);
|
|
545
|
+
}, [f, g, L, o, $, O]);
|
|
546
546
|
const { data: E = [], isFetched: fe } = we({
|
|
547
|
-
queryKey: ["m2m-items", s.many_collection,
|
|
547
|
+
queryKey: ["m2m-items", s.many_collection, z, n],
|
|
548
548
|
queryFn: () => p.request(
|
|
549
|
-
|
|
550
|
-
filter: JSON.stringify({ [
|
|
549
|
+
ke(`/items/${s.many_collection}`, {
|
|
550
|
+
filter: JSON.stringify({ [z]: { _eq: n } }),
|
|
551
551
|
limit: "200",
|
|
552
552
|
fields: `id,${T}`
|
|
553
553
|
})
|
|
554
554
|
).then((t) => t.data ?? []),
|
|
555
|
-
enabled: !!n && !
|
|
555
|
+
enabled: !!n && !y,
|
|
556
556
|
staleTime: 3e4
|
|
557
|
-
}), re =
|
|
558
|
-
collection:
|
|
559
|
-
itemId:
|
|
560
|
-
}), [Fe, pe] = De(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
557
|
+
}), re = y && v ? v.getStagedLinks(se) : [], U = E.map((t) => String(t[T])), k = y ? re : g ? [...U.filter((t) => !o.has(t)), ...L] : U, J = mt(y || !fe ? null : U, M), Q = Me(), V = (Q == null ? void 0 : Q.collection) ?? s.one_collection ?? null, ae = Ye(y ? [] : U, {
|
|
558
|
+
collection: V,
|
|
559
|
+
itemId: y ? null : n
|
|
560
|
+
}), [Fe, pe] = De(U.length > 0), _ = He(
|
|
561
|
+
V,
|
|
562
|
+
y ? null : n,
|
|
563
|
+
U,
|
|
564
564
|
pe && W
|
|
565
|
-
), xe =
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
565
|
+
), xe = Ve(
|
|
566
|
+
V,
|
|
567
|
+
y ? null : n,
|
|
568
|
+
U,
|
|
569
569
|
pe && N
|
|
570
|
-
), ge = Ee(
|
|
571
|
-
queryKey: ["files-meta", ...
|
|
570
|
+
), ge = Ee(k), { data: ie = {} } = we({
|
|
571
|
+
queryKey: ["files-meta", ...k.sort()],
|
|
572
572
|
queryFn: async () => {
|
|
573
|
-
if (!
|
|
573
|
+
if (!k.length) return {};
|
|
574
574
|
const t = await p.request(
|
|
575
|
-
|
|
576
|
-
filter: JSON.stringify({ id: { _in:
|
|
577
|
-
limit: String(
|
|
575
|
+
ke("/files", {
|
|
576
|
+
filter: JSON.stringify({ id: { _in: k } }),
|
|
577
|
+
limit: String(k.length),
|
|
578
578
|
fields: "id,filename_download,title,type,filesize,uploaded_on,uploaded_by_name,missing_at"
|
|
579
579
|
})
|
|
580
580
|
).then((c) => c.data ?? []), l = {};
|
|
581
581
|
for (const c of t) l[String(c.id).toLowerCase()] = c;
|
|
582
582
|
return l;
|
|
583
583
|
},
|
|
584
|
-
enabled:
|
|
584
|
+
enabled: k.length > 0,
|
|
585
585
|
staleTime: 6e4,
|
|
586
586
|
// A file linked a moment ago may not read yet: ask again a few times, not for a minute.
|
|
587
587
|
refetchInterval: (t) => {
|
|
588
588
|
const l = t.state.data;
|
|
589
|
-
return !l || t.state.dataUpdateCount > 8 ? !1 :
|
|
589
|
+
return !l || t.state.dataUpdateCount > 8 ? !1 : k.some((c) => !l[c.toLowerCase()]) ? 2e3 : !1;
|
|
590
590
|
},
|
|
591
591
|
// A changed id list keeps the names already known on screen while the new read runs.
|
|
592
592
|
placeholderData: (t) => t
|
|
@@ -596,10 +596,10 @@ function Tt({
|
|
|
596
596
|
c && he.current.set(t.toLowerCase(), c);
|
|
597
597
|
}
|
|
598
598
|
const oe = J.removed.filter(
|
|
599
|
-
(t) => !
|
|
599
|
+
(t) => !k.some((l) => l.toLowerCase() === t.toLowerCase())
|
|
600
600
|
);
|
|
601
601
|
async function m(t) {
|
|
602
|
-
if (be(
|
|
602
|
+
if (be(M, t), y && v) {
|
|
603
603
|
v.unstageLink(se, t);
|
|
604
604
|
return;
|
|
605
605
|
}
|
|
@@ -608,11 +608,11 @@ function Tt({
|
|
|
608
608
|
return;
|
|
609
609
|
}
|
|
610
610
|
const l = E.find((c) => String(c[T]) === t);
|
|
611
|
-
l != null && l.id && (await p.request(Pe(`/items/${s.many_collection}/${l.id}`)), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection,
|
|
611
|
+
l != null && l.id && (await p.request(Pe(`/items/${s.many_collection}/${l.id}`)), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, z, n] }));
|
|
612
612
|
}
|
|
613
613
|
async function S(t) {
|
|
614
|
-
if (!
|
|
615
|
-
if (be(
|
|
614
|
+
if (!k.includes(t)) {
|
|
615
|
+
if (be(M, t), y && v) {
|
|
616
616
|
v.stageLink(se, t);
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
@@ -621,8 +621,8 @@ function Tt({
|
|
|
621
621
|
return;
|
|
622
622
|
}
|
|
623
623
|
await p.request(
|
|
624
|
-
Se(`/items/${s.many_collection}`, { [
|
|
625
|
-
), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection,
|
|
624
|
+
Se(`/items/${s.many_collection}`, { [z]: n, [T]: t })
|
|
625
|
+
), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, z, n] });
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
function G(t) {
|
|
@@ -644,7 +644,7 @@ function Tt({
|
|
|
644
644
|
fallback: (Z) => p.upload(Z),
|
|
645
645
|
field: s.one_field ?? void 0,
|
|
646
646
|
collection: s.one_collection ?? void 0,
|
|
647
|
-
item:
|
|
647
|
+
item: y ? void 0 : String(n),
|
|
648
648
|
onProgress: le
|
|
649
649
|
});
|
|
650
650
|
await S(F.id);
|
|
@@ -661,12 +661,12 @@ function Tt({
|
|
|
661
661
|
et,
|
|
662
662
|
{
|
|
663
663
|
collection: s.one_collection,
|
|
664
|
-
item:
|
|
664
|
+
item: y ? null : String(n),
|
|
665
665
|
field: s.one_field
|
|
666
666
|
}
|
|
667
667
|
),
|
|
668
|
-
(
|
|
669
|
-
|
|
668
|
+
(k.length > 0 || $.length > 0 || oe.length > 0) && /* @__PURE__ */ i("div", { ref: Fe, className: "flex flex-col gap-1.5", children: [
|
|
669
|
+
k.map((t) => {
|
|
670
670
|
var F, Z;
|
|
671
671
|
const l = ie[t.toLowerCase()], c = J.fresh.has(t);
|
|
672
672
|
return c && !l ? null : /* @__PURE__ */ i(
|
|
@@ -735,17 +735,17 @@ function Tt({
|
|
|
735
735
|
children: "file missing"
|
|
736
736
|
}
|
|
737
737
|
),
|
|
738
|
-
W && !
|
|
738
|
+
W && !y && U.includes(t) && /* @__PURE__ */ e(
|
|
739
739
|
Je,
|
|
740
740
|
{
|
|
741
741
|
fileId: t,
|
|
742
742
|
uses: (F = _.data) == null ? void 0 : F[t],
|
|
743
743
|
loading: _.isLoading,
|
|
744
|
-
collection:
|
|
744
|
+
collection: V,
|
|
745
745
|
itemId: n
|
|
746
746
|
}
|
|
747
747
|
),
|
|
748
|
-
N && !
|
|
748
|
+
N && !y && U.includes(t) && /* @__PURE__ */ e(Be, { fileId: t, stat: (Z = xe.data) == null ? void 0 : Z[t] }),
|
|
749
749
|
/* @__PURE__ */ e(
|
|
750
750
|
"a",
|
|
751
751
|
{
|
|
@@ -753,7 +753,7 @@ function Tt({
|
|
|
753
753
|
onClick: ne(`${r(t)}?download=1`, l == null ? void 0 : l.filename_download),
|
|
754
754
|
title: "Download",
|
|
755
755
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
756
|
-
children: /* @__PURE__ */ e(
|
|
756
|
+
children: /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" })
|
|
757
757
|
}
|
|
758
758
|
),
|
|
759
759
|
!h && /* @__PURE__ */ e(
|
|
@@ -763,7 +763,7 @@ function Tt({
|
|
|
763
763
|
"aria-label": "Remove file",
|
|
764
764
|
onClick: () => m(t),
|
|
765
765
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
766
|
-
children: /* @__PURE__ */ e(
|
|
766
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
767
767
|
}
|
|
768
768
|
)
|
|
769
769
|
]
|
|
@@ -777,12 +777,12 @@ function Tt({
|
|
|
777
777
|
name: he.current.get(t.toLowerCase()) ?? "A file",
|
|
778
778
|
leaving: J.leaving.has(t),
|
|
779
779
|
by: Ze(
|
|
780
|
-
u.getQueryData(["last-touch",
|
|
780
|
+
u.getQueryData(["last-touch", V, String(n)])
|
|
781
781
|
)
|
|
782
782
|
},
|
|
783
783
|
`removed-${t}`
|
|
784
784
|
)),
|
|
785
|
-
|
|
785
|
+
$.map((t) => /* @__PURE__ */ i(
|
|
786
786
|
"div",
|
|
787
787
|
{
|
|
788
788
|
className: "flex items-center gap-2 rounded-lg border border-amber-200 p-2 bg-amber-50/50",
|
|
@@ -798,7 +798,7 @@ function Tt({
|
|
|
798
798
|
),
|
|
799
799
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
800
800
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
801
|
-
/* @__PURE__ */ e(
|
|
801
|
+
/* @__PURE__ */ e(ze, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
802
802
|
/* @__PURE__ */ e(
|
|
803
803
|
"p",
|
|
804
804
|
{
|
|
@@ -821,7 +821,7 @@ function Tt({
|
|
|
821
821
|
"aria-label": "Remove file",
|
|
822
822
|
onClick: () => G(t.url),
|
|
823
823
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
824
|
-
children: /* @__PURE__ */ e(
|
|
824
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
825
825
|
}
|
|
826
826
|
)
|
|
827
827
|
]
|
|
@@ -851,7 +851,7 @@ function Tt({
|
|
|
851
851
|
children: /* @__PURE__ */ e(
|
|
852
852
|
lt,
|
|
853
853
|
{
|
|
854
|
-
selected:
|
|
854
|
+
selected: k,
|
|
855
855
|
multi: !0,
|
|
856
856
|
onSelect: (t) => S(t),
|
|
857
857
|
onClose: () => te(!1),
|
|
@@ -870,11 +870,11 @@ function Tt({
|
|
|
870
870
|
var t;
|
|
871
871
|
return (t = a.current) == null ? void 0 : t.click();
|
|
872
872
|
},
|
|
873
|
-
disabled:
|
|
873
|
+
disabled: A,
|
|
874
874
|
className: "flex h-8 items-center gap-1.5 rounded border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 dark:border-border dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-200 disabled:opacity-40 transition-colors",
|
|
875
875
|
children: [
|
|
876
|
-
|
|
877
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
876
|
+
A ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3.5 w-3.5" }),
|
|
877
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: A && H != null ? `Uploading ${H}%` : "Upload…" })
|
|
878
878
|
]
|
|
879
879
|
}
|
|
880
880
|
),
|
|
@@ -893,8 +893,8 @@ function Tt({
|
|
|
893
893
|
] });
|
|
894
894
|
}
|
|
895
895
|
export {
|
|
896
|
-
|
|
897
|
-
|
|
896
|
+
zt as FileM2MField,
|
|
897
|
+
Tt as FilePickerField,
|
|
898
898
|
ue as fileDisplayName,
|
|
899
899
|
_e as friendlyFileType
|
|
900
900
|
};
|