@nivaro/react 0.3.116 → 0.3.118
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 +140 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3855 -3785
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4220 -4175
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ReportView.js +1086 -1091
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/cbv/column-totals.js +62 -57
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/charts/category-axis.js +93 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +54 -53
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +94 -85
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +320 -299
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/use-query-entry.js +17 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,98 +1,123 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Clock as Oe, Download as ze, Loader2 as ve, Upload as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { useFileHealth as
|
|
7
|
-
import { get as ye, post as
|
|
8
|
-
import { trackedUpload as
|
|
9
|
-
import { cn as
|
|
10
|
-
import { useFileDownloadStats as
|
|
11
|
-
import { useOnceVisible as
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Te, useQuery as we } from "@tanstack/react-query";
|
|
3
|
+
import { Clock as Oe, Download as ze, Loader2 as ve, Upload as Le, X as ke, Plus as nt, File as Ue, FileVideo as rt, FileAudio as at, FileText as Ce, FileSpreadsheet as it, FileCode as ot } from "lucide-react";
|
|
4
|
+
import { useId as Re, useState as w, useRef as K, useEffect as D } from "react";
|
|
5
|
+
import { useNivaroClient as $e, useApiFetchConfig as Ke, useGridFlush as Me, useParentDraft as Ae } from "../../context.js";
|
|
6
|
+
import { useFileHealth as Ee } from "../../hooks/useFileHealth.js";
|
|
7
|
+
import { get as ye, post as Se, del as Pe } from "../../lib/commands.js";
|
|
8
|
+
import { trackedUpload as Qe } from "../../lib/upload-presence.js";
|
|
9
|
+
import { cn as ce, formatDateTime as dt } from "../../lib/utils.js";
|
|
10
|
+
import { useFileDownloadStats as Be, FileDownloadCount as Ve } from "./FileDownloadCount.js";
|
|
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
|
|
15
|
-
import { liveRecordWrite as
|
|
16
|
-
import { useM2MStaging as
|
|
17
|
-
import { RemoteUploadRows as
|
|
18
|
-
function ue(
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
const
|
|
23
|
-
return
|
|
13
|
+
import { OWN_FILE_CHANGE_MS as ct, RemovedFileRow as Xe, lastWriterName as Ze, noteOwnFileChange as be, useLiveFileList as ut, REMOVED_SHOW_MS as We, REMOVED_FADE_MS as mt } from "./file-live.js";
|
|
14
|
+
import { useFileProcessing as Ye, FileProcessingBadge as Ie, FileProcessingTile as ht, chipThumbUrl as qe } from "./file-processing.js";
|
|
15
|
+
import { liveRecordWrite as ft } from "./live-record-marks.js";
|
|
16
|
+
import { useM2MStaging as pt } from "./M2MStagingContext.js";
|
|
17
|
+
import { RemoteUploadRows as et } from "./RemoteUploads.js";
|
|
18
|
+
function ue(s) {
|
|
19
|
+
var x;
|
|
20
|
+
const n = ((s == null ? void 0 : s.title) ?? "").trim(), d = ((s == null ? void 0 : s.filename_download) ?? "").trim();
|
|
21
|
+
if (!n) return d;
|
|
22
|
+
const h = (x = /\.([A-Za-z0-9]{1,8})$/.exec(d)) == null ? void 0 : x[1];
|
|
23
|
+
return h ? new RegExp(`\\.${h}$`, "i").test(n) ? n : `${n}.${h}` : n;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function Ne(s) {
|
|
26
|
+
return s ? s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB` : null;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function tt(s) {
|
|
29
|
+
return s ? dt(s) : null;
|
|
30
30
|
}
|
|
31
|
-
function je(
|
|
32
|
-
return !!
|
|
31
|
+
function je(s) {
|
|
32
|
+
return !!s && s.startsWith("image/");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function _e(s, n) {
|
|
35
|
+
var x;
|
|
36
|
+
const d = (s ?? "").toLowerCase(), h = ((x = (n ?? "").split(".").pop()) == null ? void 0 : x.toUpperCase()) ?? "";
|
|
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
|
+
}
|
|
39
|
+
function xt(s) {
|
|
40
|
+
const n = (s ?? "").toLowerCase();
|
|
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
|
+
}
|
|
43
|
+
function gt(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(Ue, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e(Ue, { className: n, strokeWidth: 1.5 });
|
|
36
45
|
}
|
|
37
46
|
function me({
|
|
38
|
-
url:
|
|
39
|
-
type:
|
|
40
|
-
filename:
|
|
41
|
-
size:
|
|
42
|
-
processing:
|
|
47
|
+
url: s,
|
|
48
|
+
type: n,
|
|
49
|
+
filename: d,
|
|
50
|
+
size: h = "md",
|
|
51
|
+
processing: x = !1
|
|
43
52
|
}) {
|
|
44
|
-
const P =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
if (D(() => {
|
|
55
|
+
q.current && !x && (W(!1), p(!1), f(Date.now())), q.current = x;
|
|
56
|
+
}, [x]), je(n) && x) return /* @__PURE__ */ e(ht, { className: P });
|
|
57
|
+
if (je(n) && !N) {
|
|
58
|
+
const z = () => {
|
|
59
|
+
if (!g && qe(s) !== s) {
|
|
60
|
+
W(!0);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
p(!0);
|
|
64
|
+
}, v = g ? s : qe(s);
|
|
65
|
+
return /* @__PURE__ */ e(
|
|
66
|
+
"img",
|
|
67
|
+
{
|
|
68
|
+
src: u && !/^(blob|data):/i.test(v) ? `${v}${v.includes("?") ? "&" : "?"}v=${u}` : v,
|
|
69
|
+
alt: d,
|
|
70
|
+
"data-file-thumb": !0,
|
|
71
|
+
className: ce(P, "object-cover rounded shrink-0"),
|
|
72
|
+
loading: "lazy",
|
|
73
|
+
onError: z,
|
|
74
|
+
onLoad: (j) => {
|
|
75
|
+
j.currentTarget.naturalWidth === 0 && z();
|
|
57
76
|
}
|
|
58
|
-
w.target.style.display = "none";
|
|
59
77
|
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ e(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: ce(P, "flex items-center justify-center rounded shrink-0", xt(n)),
|
|
84
|
+
children: gt(n, h === "sm" ? "h-4 w-4" : "h-6 w-6")
|
|
60
85
|
}
|
|
61
|
-
)
|
|
86
|
+
);
|
|
62
87
|
}
|
|
63
|
-
function
|
|
64
|
-
selected:
|
|
65
|
-
multi:
|
|
66
|
-
onSelect:
|
|
67
|
-
onClose:
|
|
68
|
-
getUrl:
|
|
88
|
+
function lt({
|
|
89
|
+
selected: s,
|
|
90
|
+
multi: n,
|
|
91
|
+
onSelect: d,
|
|
92
|
+
onClose: h,
|
|
93
|
+
getUrl: x
|
|
69
94
|
}) {
|
|
70
|
-
const P =
|
|
71
|
-
queryKey: ["file-browser",
|
|
95
|
+
const P = $e(), [g, W] = w(""), { data: N = [], isLoading: p } = we({
|
|
96
|
+
queryKey: ["file-browser", g],
|
|
72
97
|
queryFn: () => P.request(
|
|
73
98
|
ye("/files", {
|
|
74
99
|
limit: "60",
|
|
75
100
|
sort: "-uploaded_on",
|
|
76
101
|
fields: "id,filename_download,title,type,filesize,width,height,missing_at",
|
|
77
|
-
...
|
|
102
|
+
...g ? { search: g } : {}
|
|
78
103
|
})
|
|
79
104
|
).then((u) => u.data ?? []),
|
|
80
105
|
staleTime: 3e4
|
|
81
106
|
});
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ i("div", { className: "flex flex-col", style: { width: 480, maxHeight: 420 }, children: [
|
|
108
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 shrink-0", children: [
|
|
109
|
+
/* @__PURE__ */ i("p", { className: "text-[12px] font-medium text-slate-700", children: [
|
|
85
110
|
"Select file",
|
|
86
|
-
|
|
111
|
+
n ? "s" : ""
|
|
87
112
|
] }),
|
|
88
113
|
/* @__PURE__ */ e(
|
|
89
114
|
"button",
|
|
90
115
|
{
|
|
91
116
|
type: "button",
|
|
92
117
|
"aria-label": "Close",
|
|
93
|
-
onClick:
|
|
118
|
+
onClick: h,
|
|
94
119
|
className: "text-slate-400 hover:text-slate-600",
|
|
95
|
-
children: /* @__PURE__ */ e(
|
|
120
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
96
121
|
}
|
|
97
122
|
)
|
|
98
123
|
] }),
|
|
@@ -101,38 +126,38 @@ function et({
|
|
|
101
126
|
{
|
|
102
127
|
type: "text",
|
|
103
128
|
placeholder: "Search files…",
|
|
104
|
-
value:
|
|
129
|
+
value: g,
|
|
105
130
|
onChange: (u) => W(u.target.value),
|
|
106
131
|
className: "w-full h-7 rounded border border-slate-200 px-2 text-[12px] focus:outline-none focus:ring-1 focus:ring-nvr-cyan",
|
|
107
132
|
autoFocus: !0
|
|
108
133
|
}
|
|
109
134
|
) }),
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
!
|
|
113
|
-
!
|
|
114
|
-
const
|
|
115
|
-
return /* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ i("div", { className: "overflow-y-auto flex-1 p-3", children: [
|
|
136
|
+
p && /* @__PURE__ */ e("div", { className: "flex justify-center py-6", children: /* @__PURE__ */ e(ve, { className: "h-5 w-5 animate-spin text-slate-300" }) }),
|
|
137
|
+
!p && N.length === 0 && /* @__PURE__ */ e("p", { className: "text-center text-[12px] text-slate-400 py-6", children: "No files found" }),
|
|
138
|
+
!p && N.length > 0 && /* @__PURE__ */ e("div", { className: "grid grid-cols-5 gap-2", children: N.map((u) => {
|
|
139
|
+
const f = s.includes(u.id);
|
|
140
|
+
return /* @__PURE__ */ i(
|
|
116
141
|
"button",
|
|
117
142
|
{
|
|
118
143
|
type: "button",
|
|
119
|
-
onClick: () =>
|
|
120
|
-
className:
|
|
144
|
+
onClick: () => d(u.id),
|
|
145
|
+
className: ce(
|
|
121
146
|
"nvr-rise-in group flex flex-col items-center gap-1 rounded-lg p-1.5 text-left transition-colors border",
|
|
122
|
-
|
|
147
|
+
f ? "border-nvr-cyan bg-nvr-cyan/5" : "border-transparent hover:border-slate-200 hover:bg-slate-50"
|
|
123
148
|
),
|
|
124
149
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ i("div", { className: "relative", children: [
|
|
126
151
|
/* @__PURE__ */ e(
|
|
127
152
|
me,
|
|
128
153
|
{
|
|
129
|
-
url:
|
|
154
|
+
url: x(u.id),
|
|
130
155
|
type: u.type,
|
|
131
156
|
filename: u.filename_download,
|
|
132
157
|
size: "md"
|
|
133
158
|
}
|
|
134
159
|
),
|
|
135
|
-
|
|
160
|
+
f && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center rounded bg-nvr-cyan/20", children: /* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-full bg-nvr-cyan flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
136
161
|
"svg",
|
|
137
162
|
{
|
|
138
163
|
className: "h-2.5 w-2.5 text-white",
|
|
@@ -167,147 +192,166 @@ function et({
|
|
|
167
192
|
] })
|
|
168
193
|
] });
|
|
169
194
|
}
|
|
170
|
-
function
|
|
171
|
-
field:
|
|
172
|
-
value:
|
|
173
|
-
onChange:
|
|
174
|
-
disabled:
|
|
175
|
-
allowUpload:
|
|
195
|
+
function jt({
|
|
196
|
+
field: s,
|
|
197
|
+
value: n,
|
|
198
|
+
onChange: d,
|
|
199
|
+
disabled: h,
|
|
200
|
+
allowUpload: x = !0,
|
|
176
201
|
allowPick: P = !0,
|
|
177
|
-
showUsage:
|
|
202
|
+
showUsage: g = !0,
|
|
178
203
|
showDownloads: W = !0
|
|
179
204
|
}) {
|
|
180
|
-
var ge,
|
|
181
|
-
const
|
|
205
|
+
var ge, ie, oe;
|
|
206
|
+
const N = $e(), p = Ke(), u = Te(), f = Me(), q = Re(), [z, v] = w(!1), [j, te] = w(!1), [M, Y] = w(null), [b, H] = w(null), [le, U] = w(null), C = K(null), a = !b && n ? String(n) : null, L = (m) => N.fileUrl(m), I = Ge(), o = Ae(), R = ((ge = o == null ? void 0 : o.draft) == null ? void 0 : ge.id) != null ? String(o.draft.id) : null, A = Ye(a ? [a] : [], {
|
|
182
207
|
collection: o == null ? void 0 : o.collection,
|
|
183
|
-
itemId:
|
|
184
|
-
}), [he,
|
|
208
|
+
itemId: R
|
|
209
|
+
}), [he, T] = De(!!a), O = He(
|
|
185
210
|
o == null ? void 0 : o.collection,
|
|
186
|
-
|
|
211
|
+
R,
|
|
187
212
|
a ? [a] : [],
|
|
188
|
-
|
|
189
|
-
),
|
|
213
|
+
T && g
|
|
214
|
+
), se = Be(
|
|
190
215
|
o == null ? void 0 : o.collection,
|
|
191
|
-
|
|
216
|
+
R,
|
|
192
217
|
a ? [a] : [],
|
|
193
|
-
|
|
218
|
+
T && W
|
|
194
219
|
);
|
|
195
|
-
|
|
196
|
-
if (!
|
|
220
|
+
D(() => {
|
|
221
|
+
if (!b) {
|
|
197
222
|
U(null);
|
|
198
223
|
return;
|
|
199
224
|
}
|
|
200
|
-
const
|
|
201
|
-
return U(
|
|
202
|
-
}, [
|
|
203
|
-
if (!(!
|
|
204
|
-
return
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
}), () =>
|
|
208
|
-
}, [
|
|
209
|
-
const
|
|
225
|
+
const m = URL.createObjectURL(b);
|
|
226
|
+
return U(m), () => URL.revokeObjectURL(m);
|
|
227
|
+
}, [b]), D(() => {
|
|
228
|
+
if (!(!f || !b))
|
|
229
|
+
return f.register(q, async () => {
|
|
230
|
+
const m = await N.upload(b);
|
|
231
|
+
d(m.id), H(null), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
232
|
+
}), () => f.unregister(q);
|
|
233
|
+
}, [f, b, q, N, d, u]);
|
|
234
|
+
const k = Ee([a]), { data: r, isLoading: ne } = we({
|
|
210
235
|
queryKey: ["file-meta", a],
|
|
211
|
-
queryFn: () =>
|
|
236
|
+
queryFn: () => N.request(ye(`/files/${a}/meta`)).then((m) => m.data ?? null),
|
|
212
237
|
enabled: !!a,
|
|
213
238
|
staleTime: 6e4
|
|
214
|
-
}),
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
if (fe.current = a,
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
const
|
|
221
|
-
a ? (
|
|
222
|
-
() =>
|
|
223
|
-
|
|
224
|
-
),
|
|
225
|
-
}, [a]),
|
|
226
|
-
const
|
|
239
|
+
}), E = K(0), fe = K(a), re = K(null), [$, y] = w(!1), [J, Q] = w(null), B = K([]);
|
|
240
|
+
r && (re.current = ue(r) || re.current), D(() => {
|
|
241
|
+
const m = fe.current;
|
|
242
|
+
if (fe.current = a, m === a || b) return;
|
|
243
|
+
const S = Date.now() - E.current < ct, G = o == null ? void 0 : o.collection;
|
|
244
|
+
if (S || !G || !R || !ft(G, R)) return;
|
|
245
|
+
const X = (t, l) => B.current.push(setTimeout(t, l));
|
|
246
|
+
a ? (Q(null), y(!0), X(() => y(!1), 2e3)) : m && (Q({ name: re.current ?? "A file", leaving: !1 }), X(
|
|
247
|
+
() => Q((t) => t && { ...t, leaving: !0 }),
|
|
248
|
+
We - mt
|
|
249
|
+
), X(() => Q(null), We));
|
|
250
|
+
}, [a]), D(() => {
|
|
251
|
+
const m = B.current;
|
|
227
252
|
return () => {
|
|
228
|
-
for (const
|
|
253
|
+
for (const S of m) clearTimeout(S);
|
|
229
254
|
};
|
|
230
255
|
}, []);
|
|
231
|
-
async function
|
|
232
|
-
var
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
if (
|
|
236
|
-
|
|
256
|
+
async function ae(m) {
|
|
257
|
+
var G;
|
|
258
|
+
const S = (G = m.target.files) == null ? void 0 : G[0];
|
|
259
|
+
if (S)
|
|
260
|
+
if (C.current && (C.current.value = ""), E.current = Date.now(), f)
|
|
261
|
+
H(S);
|
|
237
262
|
else {
|
|
238
263
|
te(!0), Y(null);
|
|
239
264
|
try {
|
|
240
|
-
const
|
|
241
|
-
cfg:
|
|
242
|
-
fallback: (t) =>
|
|
243
|
-
field:
|
|
265
|
+
const X = await Qe(S, {
|
|
266
|
+
cfg: p,
|
|
267
|
+
fallback: (t) => N.upload(t),
|
|
268
|
+
field: s,
|
|
244
269
|
collection: o == null ? void 0 : o.collection,
|
|
245
|
-
item:
|
|
270
|
+
item: R ?? void 0,
|
|
246
271
|
onProgress: Y
|
|
247
272
|
});
|
|
248
|
-
|
|
273
|
+
d(X.id), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
249
274
|
} catch {
|
|
250
275
|
} finally {
|
|
251
276
|
te(!1), Y(null);
|
|
252
277
|
}
|
|
253
278
|
}
|
|
254
279
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
280
|
+
function Fe(m) {
|
|
281
|
+
E.current = Date.now(), H(null), d(m), v(!1);
|
|
257
282
|
}
|
|
258
283
|
function pe() {
|
|
259
|
-
|
|
284
|
+
E.current = Date.now(), H(null), d(null);
|
|
260
285
|
}
|
|
261
|
-
const
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
!xe &&
|
|
264
|
-
|
|
286
|
+
const _ = !!b, xe = _ || !!a;
|
|
287
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
288
|
+
!xe && J && /* @__PURE__ */ e("div", { className: "mb-1.5", children: /* @__PURE__ */ e(
|
|
289
|
+
Xe,
|
|
290
|
+
{
|
|
291
|
+
name: J.name,
|
|
292
|
+
leaving: J.leaving,
|
|
293
|
+
by: Ze(
|
|
294
|
+
u.getQueryData(["last-touch", o == null ? void 0 : o.collection, String(R)])
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
298
|
+
xe ? /* @__PURE__ */ i(
|
|
265
299
|
"div",
|
|
266
300
|
{
|
|
267
301
|
ref: he,
|
|
268
|
-
"data-file-fresh":
|
|
269
|
-
className:
|
|
270
|
-
"flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
|
|
271
|
-
|
|
302
|
+
"data-file-fresh": $ ? "" : void 0,
|
|
303
|
+
className: ce(
|
|
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
|
+
$ && "nvr-row-enter"
|
|
272
306
|
),
|
|
273
307
|
children: [
|
|
274
|
-
|
|
308
|
+
_ ? /* @__PURE__ */ e(
|
|
275
309
|
me,
|
|
276
310
|
{
|
|
277
311
|
url: le ?? "",
|
|
278
|
-
type:
|
|
279
|
-
filename:
|
|
312
|
+
type: b.type || null,
|
|
313
|
+
filename: b.name,
|
|
280
314
|
size: "sm"
|
|
281
315
|
}
|
|
282
|
-
) :
|
|
316
|
+
) : ne ? /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }) : (
|
|
283
317
|
// Every file click downloads (2026-11-08): no in-app preview.
|
|
284
318
|
/* @__PURE__ */ e(
|
|
285
319
|
"a",
|
|
286
320
|
{
|
|
287
|
-
href: `${
|
|
288
|
-
download: (
|
|
289
|
-
onClick: I(`${
|
|
321
|
+
href: `${L(a)}?download=1`,
|
|
322
|
+
download: (r == null ? void 0 : r.filename_download) || !0,
|
|
323
|
+
onClick: I(`${L(a)}?download=1`, r == null ? void 0 : r.filename_download),
|
|
290
324
|
title: "Download",
|
|
291
325
|
className: "shrink-0",
|
|
292
326
|
children: /* @__PURE__ */ e(
|
|
293
327
|
me,
|
|
294
328
|
{
|
|
295
|
-
url:
|
|
296
|
-
type: (
|
|
297
|
-
filename: (
|
|
329
|
+
url: L(a),
|
|
330
|
+
type: (r == null ? void 0 : r.type) ?? null,
|
|
331
|
+
filename: (r == null ? void 0 : r.filename_download) ?? "",
|
|
298
332
|
size: "sm",
|
|
299
|
-
processing: !!a &&
|
|
333
|
+
processing: !!a && A.isProcessing(a)
|
|
300
334
|
}
|
|
301
335
|
)
|
|
302
336
|
}
|
|
303
337
|
)
|
|
304
338
|
),
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
339
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
340
|
+
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
341
|
+
_ && /* @__PURE__ */ e(Oe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
342
|
+
/* @__PURE__ */ e(
|
|
343
|
+
"p",
|
|
344
|
+
{
|
|
345
|
+
"data-file-name": !0,
|
|
346
|
+
className: "min-w-0 text-[12px] font-medium text-slate-700 truncate dark:text-slate-100",
|
|
347
|
+
children: _ ? b.name : r ? ue(r) || "Untitled file" : (
|
|
348
|
+
// Never the raw file id while the name loads.
|
|
349
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: "Loading name…" })
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
!_ && !!a && A.isProcessing(a) && /* @__PURE__ */ e(Ie, {}),
|
|
354
|
+
!_ && (k.verdict(a) ?? !!(r != null && r.missing_at)) && /* @__PURE__ */ e(
|
|
311
355
|
"span",
|
|
312
356
|
{
|
|
313
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",
|
|
@@ -316,69 +360,69 @@ function Pt({
|
|
|
316
360
|
}
|
|
317
361
|
)
|
|
318
362
|
] }),
|
|
319
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children:
|
|
320
|
-
|
|
321
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
363
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: _ ? /* @__PURE__ */ i(de, { children: [
|
|
364
|
+
b.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: _e(b.type, b.name) }),
|
|
365
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Ne(b.size) }),
|
|
322
366
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
|
|
323
|
-
] }) : /* @__PURE__ */
|
|
324
|
-
(
|
|
325
|
-
(
|
|
326
|
-
(
|
|
327
|
-
(
|
|
367
|
+
] }) : /* @__PURE__ */ i(de, { children: [
|
|
368
|
+
(r == null ? void 0 : r.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: _e(r.type, r.filename_download) }),
|
|
369
|
+
(r == null ? void 0 : r.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Ne(r.filesize) }),
|
|
370
|
+
(r == null ? void 0 : r.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: tt(r.uploaded_on) }),
|
|
371
|
+
(r == null ? void 0 : r.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500", children: [
|
|
328
372
|
"by ",
|
|
329
|
-
|
|
373
|
+
r.uploaded_by_name
|
|
330
374
|
] })
|
|
331
375
|
] }) })
|
|
332
376
|
] }),
|
|
333
|
-
|
|
334
|
-
|
|
377
|
+
g && !_ && a && /* @__PURE__ */ e(
|
|
378
|
+
Je,
|
|
335
379
|
{
|
|
336
380
|
fileId: a,
|
|
337
|
-
uses: (
|
|
338
|
-
loading:
|
|
381
|
+
uses: (ie = O.data) == null ? void 0 : ie[a],
|
|
382
|
+
loading: O.isLoading,
|
|
339
383
|
collection: o == null ? void 0 : o.collection,
|
|
340
|
-
itemId:
|
|
384
|
+
itemId: R
|
|
341
385
|
}
|
|
342
386
|
),
|
|
343
|
-
W && !
|
|
344
|
-
!
|
|
387
|
+
W && !_ && a && /* @__PURE__ */ e(Ve, { fileId: a, stat: (oe = se.data) == null ? void 0 : oe[a] }),
|
|
388
|
+
!_ && a && /* @__PURE__ */ e(
|
|
345
389
|
"a",
|
|
346
390
|
{
|
|
347
|
-
href: `${
|
|
348
|
-
onClick: I(`${
|
|
391
|
+
href: `${L(a)}?download=1`,
|
|
392
|
+
onClick: I(`${L(a)}?download=1`, r == null ? void 0 : r.filename_download),
|
|
349
393
|
title: "Download",
|
|
350
394
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
351
395
|
children: /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" })
|
|
352
396
|
}
|
|
353
397
|
),
|
|
354
|
-
!
|
|
398
|
+
!h && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
355
399
|
P && /* @__PURE__ */ e(
|
|
356
400
|
"button",
|
|
357
401
|
{
|
|
358
402
|
type: "button",
|
|
359
|
-
onClick: () =>
|
|
403
|
+
onClick: () => v(!0),
|
|
360
404
|
className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400",
|
|
361
405
|
children: "Replace"
|
|
362
406
|
}
|
|
363
407
|
),
|
|
364
|
-
|
|
365
|
-
/* @__PURE__ */
|
|
408
|
+
x && /* @__PURE__ */ i(de, { children: [
|
|
409
|
+
/* @__PURE__ */ i(
|
|
366
410
|
"button",
|
|
367
411
|
{
|
|
368
412
|
type: "button",
|
|
369
413
|
onClick: () => {
|
|
370
|
-
var
|
|
371
|
-
return (
|
|
414
|
+
var m;
|
|
415
|
+
return (m = C.current) == null ? void 0 : m.click();
|
|
372
416
|
},
|
|
373
|
-
disabled:
|
|
417
|
+
disabled: j,
|
|
374
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",
|
|
375
419
|
children: [
|
|
376
|
-
|
|
377
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
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 && M != null ? `${M}%` : "Upload" })
|
|
378
422
|
]
|
|
379
423
|
}
|
|
380
424
|
),
|
|
381
|
-
/* @__PURE__ */ e("input", { ref:
|
|
425
|
+
/* @__PURE__ */ e("input", { ref: C, type: "file", className: "hidden", onChange: ae })
|
|
382
426
|
] }),
|
|
383
427
|
/* @__PURE__ */ e(
|
|
384
428
|
"button",
|
|
@@ -387,218 +431,223 @@ function Pt({
|
|
|
387
431
|
"aria-label": "Remove file",
|
|
388
432
|
onClick: pe,
|
|
389
433
|
className: "text-slate-300 hover:text-red-400 p-0.5",
|
|
390
|
-
children: /* @__PURE__ */ e(
|
|
434
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
391
435
|
}
|
|
392
436
|
)
|
|
393
437
|
] })
|
|
394
438
|
]
|
|
395
439
|
},
|
|
396
440
|
a ?? "pending"
|
|
397
|
-
) : /* @__PURE__ */
|
|
441
|
+
) : /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
398
442
|
P && /* @__PURE__ */ e(
|
|
399
443
|
"button",
|
|
400
444
|
{
|
|
401
445
|
type: "button",
|
|
402
|
-
disabled:
|
|
403
|
-
onClick: () =>
|
|
404
|
-
className: "flex h-9 flex-1 items-center gap-2 rounded-md border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 disabled:opacity-40 transition-colors",
|
|
446
|
+
disabled: h,
|
|
447
|
+
onClick: () => v(!0),
|
|
448
|
+
className: "flex h-9 flex-1 items-center gap-2 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",
|
|
405
449
|
children: "Select file…"
|
|
406
450
|
}
|
|
407
451
|
),
|
|
408
|
-
|
|
409
|
-
/* @__PURE__ */
|
|
452
|
+
x && !h && /* @__PURE__ */ i(de, { children: [
|
|
453
|
+
/* @__PURE__ */ i(
|
|
410
454
|
"button",
|
|
411
455
|
{
|
|
412
456
|
type: "button",
|
|
413
457
|
onClick: () => {
|
|
414
|
-
var
|
|
415
|
-
return (
|
|
458
|
+
var m;
|
|
459
|
+
return (m = C.current) == null ? void 0 : m.click();
|
|
416
460
|
},
|
|
417
|
-
disabled:
|
|
418
|
-
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 disabled:opacity-40 transition-colors",
|
|
461
|
+
disabled: j,
|
|
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",
|
|
419
463
|
children: [
|
|
420
|
-
|
|
421
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
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 && M != null ? `${M}%` : "Upload" })
|
|
422
466
|
]
|
|
423
467
|
}
|
|
424
468
|
),
|
|
425
|
-
/* @__PURE__ */ e("input", { ref:
|
|
469
|
+
/* @__PURE__ */ e("input", { ref: C, type: "file", className: "hidden", onChange: ae })
|
|
426
470
|
] })
|
|
427
471
|
] }),
|
|
428
|
-
/* @__PURE__ */ e(
|
|
429
|
-
|
|
472
|
+
/* @__PURE__ */ e(et, { collection: o == null ? void 0 : o.collection, item: R, field: s }),
|
|
473
|
+
z && /* @__PURE__ */ e(
|
|
430
474
|
"div",
|
|
431
475
|
{
|
|
432
476
|
className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
|
|
433
477
|
style: { minWidth: 480 },
|
|
434
478
|
children: /* @__PURE__ */ e(
|
|
435
|
-
|
|
479
|
+
lt,
|
|
436
480
|
{
|
|
437
481
|
selected: a ? [a] : [],
|
|
438
482
|
multi: !1,
|
|
439
|
-
onSelect:
|
|
440
|
-
onClose: () =>
|
|
441
|
-
getUrl:
|
|
483
|
+
onSelect: Fe,
|
|
484
|
+
onClose: () => v(!1),
|
|
485
|
+
getUrl: L
|
|
442
486
|
}
|
|
443
487
|
)
|
|
444
488
|
}
|
|
445
489
|
)
|
|
446
490
|
] });
|
|
447
491
|
}
|
|
448
|
-
function
|
|
449
|
-
relation:
|
|
450
|
-
parentId:
|
|
451
|
-
allRelations:
|
|
452
|
-
disabled:
|
|
453
|
-
allowUpload:
|
|
492
|
+
function Tt({
|
|
493
|
+
relation: s,
|
|
494
|
+
parentId: n,
|
|
495
|
+
allRelations: d,
|
|
496
|
+
disabled: h,
|
|
497
|
+
allowUpload: x = !0,
|
|
454
498
|
allowPick: P = !0,
|
|
455
|
-
pendingSave:
|
|
499
|
+
pendingSave: g = !1,
|
|
456
500
|
showUsage: W = !0,
|
|
457
|
-
showDownloads:
|
|
501
|
+
showDownloads: N = !0
|
|
458
502
|
}) {
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}, []),
|
|
463
|
-
if (!
|
|
503
|
+
const p = $e(), u = Te(), f = Me(), q = Re(), z = Re(), v = pt(), [j, te] = w(!1), [M, Y] = w(!1), b = Ke(), [H, le] = w(null), [U, C] = w([]), a = K(null), [L, I] = w([]), [o, R] = w(/* @__PURE__ */ new Set()), A = K(/* @__PURE__ */ new Map()), he = K(/* @__PURE__ */ new Map()), T = s.junction_field ?? "", O = s.many_field ?? "", se = s.one_field ?? `${s.many_collection}.${T}`, k = n === "new", r = (t) => p.fileUrl(t), ne = Ge();
|
|
504
|
+
D(() => () => {
|
|
505
|
+
C((t) => (t.forEach((l) => URL.revokeObjectURL(l.url)), []));
|
|
506
|
+
}, []), D(() => {
|
|
507
|
+
if (!f || !U.length || g) return;
|
|
464
508
|
const t = U;
|
|
465
|
-
return
|
|
509
|
+
return f.register(q, async () => {
|
|
466
510
|
for (const l of t) {
|
|
467
|
-
const c = await
|
|
468
|
-
URL.revokeObjectURL(l.url), await
|
|
511
|
+
const c = await p.upload(l.file);
|
|
512
|
+
URL.revokeObjectURL(l.url), await S(c.id);
|
|
469
513
|
}
|
|
470
|
-
|
|
471
|
-
}), () =>
|
|
472
|
-
}, [
|
|
473
|
-
if (!
|
|
474
|
-
if (!(
|
|
475
|
-
|
|
514
|
+
C([]), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
515
|
+
}), () => f.unregister(q);
|
|
516
|
+
}, [f, U, q, g]), D(() => {
|
|
517
|
+
if (!f || !g) return;
|
|
518
|
+
if (!(L.length > 0 || o.size > 0 || U.length > 0)) {
|
|
519
|
+
f.unregister(z);
|
|
476
520
|
return;
|
|
477
521
|
}
|
|
478
|
-
const l =
|
|
479
|
-
return
|
|
480
|
-
const
|
|
481
|
-
for (const
|
|
482
|
-
const ee = await
|
|
483
|
-
URL.revokeObjectURL(
|
|
522
|
+
const l = L, c = new Set(o), F = U;
|
|
523
|
+
return f.register(z, async () => {
|
|
524
|
+
const Z = [];
|
|
525
|
+
for (const V of F) {
|
|
526
|
+
const ee = await p.upload(V.file);
|
|
527
|
+
URL.revokeObjectURL(V.url), Z.push(ee.id);
|
|
484
528
|
}
|
|
485
|
-
for (const
|
|
486
|
-
be(
|
|
487
|
-
|
|
488
|
-
[
|
|
489
|
-
[
|
|
529
|
+
for (const V of [...l, ...Z])
|
|
530
|
+
be(A, V), await p.request(
|
|
531
|
+
Se(`/items/${s.many_collection}`, {
|
|
532
|
+
[O]: n,
|
|
533
|
+
[T]: V
|
|
490
534
|
})
|
|
491
535
|
);
|
|
492
|
-
for (const
|
|
493
|
-
be(
|
|
494
|
-
const ee =
|
|
495
|
-
ee != null && ee.id && await
|
|
536
|
+
for (const V of c) {
|
|
537
|
+
be(A, V);
|
|
538
|
+
const ee = E.find((st) => String(st[T]) === V);
|
|
539
|
+
ee != null && ee.id && await p.request(Pe(`/items/${s.many_collection}/${ee.id}`));
|
|
496
540
|
}
|
|
497
|
-
I([]),
|
|
498
|
-
queryKey: ["m2m-items",
|
|
541
|
+
I([]), R(/* @__PURE__ */ new Set()), C([]), u.invalidateQueries({
|
|
542
|
+
queryKey: ["m2m-items", s.many_collection, O, n]
|
|
499
543
|
}), u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
500
|
-
}), () =>
|
|
501
|
-
}, [
|
|
502
|
-
const { data:
|
|
503
|
-
queryKey: ["m2m-items",
|
|
504
|
-
queryFn: () =>
|
|
505
|
-
ye(`/items/${
|
|
506
|
-
filter: JSON.stringify({ [
|
|
544
|
+
}), () => f.unregister(z);
|
|
545
|
+
}, [f, g, L, o, U, z]);
|
|
546
|
+
const { data: E = [], isFetched: fe } = we({
|
|
547
|
+
queryKey: ["m2m-items", s.many_collection, O, n],
|
|
548
|
+
queryFn: () => p.request(
|
|
549
|
+
ye(`/items/${s.many_collection}`, {
|
|
550
|
+
filter: JSON.stringify({ [O]: { _eq: n } }),
|
|
507
551
|
limit: "200",
|
|
508
|
-
fields: `id,${
|
|
552
|
+
fields: `id,${T}`
|
|
509
553
|
})
|
|
510
554
|
).then((t) => t.data ?? []),
|
|
511
|
-
enabled: !!
|
|
555
|
+
enabled: !!n && !k,
|
|
512
556
|
staleTime: 3e4
|
|
513
|
-
}),
|
|
514
|
-
collection:
|
|
515
|
-
itemId:
|
|
516
|
-
}), [
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
557
|
+
}), re = k && v ? v.getStagedLinks(se) : [], $ = E.map((t) => String(t[T])), y = k ? re : g ? [...$.filter((t) => !o.has(t)), ...L] : $, J = ut(k || !fe ? null : $, A), Q = Ae(), B = (Q == null ? void 0 : Q.collection) ?? s.one_collection ?? null, ae = Ye(k ? [] : $, {
|
|
558
|
+
collection: B,
|
|
559
|
+
itemId: k ? null : n
|
|
560
|
+
}), [Fe, pe] = De($.length > 0), _ = He(
|
|
561
|
+
B,
|
|
562
|
+
k ? null : n,
|
|
563
|
+
$,
|
|
520
564
|
pe && W
|
|
521
|
-
), xe =
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
pe &&
|
|
526
|
-
), ge =
|
|
527
|
-
queryKey: ["files-meta", ...
|
|
565
|
+
), xe = Be(
|
|
566
|
+
B,
|
|
567
|
+
k ? null : n,
|
|
568
|
+
$,
|
|
569
|
+
pe && N
|
|
570
|
+
), ge = Ee(y), { data: ie = {} } = we({
|
|
571
|
+
queryKey: ["files-meta", ...y.sort()],
|
|
528
572
|
queryFn: async () => {
|
|
529
|
-
if (!
|
|
530
|
-
const t = await
|
|
573
|
+
if (!y.length) return {};
|
|
574
|
+
const t = await p.request(
|
|
531
575
|
ye("/files", {
|
|
532
|
-
filter: JSON.stringify({ id: { _in:
|
|
533
|
-
limit: String(
|
|
576
|
+
filter: JSON.stringify({ id: { _in: y } }),
|
|
577
|
+
limit: String(y.length),
|
|
534
578
|
fields: "id,filename_download,title,type,filesize,uploaded_on,uploaded_by_name,missing_at"
|
|
535
579
|
})
|
|
536
580
|
).then((c) => c.data ?? []), l = {};
|
|
537
|
-
for (const c of t) l[c.id] = c;
|
|
581
|
+
for (const c of t) l[String(c.id).toLowerCase()] = c;
|
|
538
582
|
return l;
|
|
539
583
|
},
|
|
540
|
-
enabled:
|
|
584
|
+
enabled: y.length > 0,
|
|
541
585
|
staleTime: 6e4,
|
|
586
|
+
// A file linked a moment ago may not read yet: ask again a few times, not for a minute.
|
|
587
|
+
refetchInterval: (t) => {
|
|
588
|
+
const l = t.state.data;
|
|
589
|
+
return !l || t.state.dataUpdateCount > 8 ? !1 : y.some((c) => !l[c.toLowerCase()]) ? 2e3 : !1;
|
|
590
|
+
},
|
|
542
591
|
// A changed id list keeps the names already known on screen while the new read runs.
|
|
543
592
|
placeholderData: (t) => t
|
|
544
593
|
});
|
|
545
|
-
for (const [t, l] of Object.entries(
|
|
594
|
+
for (const [t, l] of Object.entries(ie)) {
|
|
546
595
|
const c = ue(l);
|
|
547
596
|
c && he.current.set(t.toLowerCase(), c);
|
|
548
597
|
}
|
|
549
|
-
const oe =
|
|
550
|
-
(t) => !
|
|
598
|
+
const oe = J.removed.filter(
|
|
599
|
+
(t) => !y.some((l) => l.toLowerCase() === t.toLowerCase())
|
|
551
600
|
);
|
|
552
|
-
async function
|
|
553
|
-
if (be(
|
|
554
|
-
|
|
601
|
+
async function m(t) {
|
|
602
|
+
if (be(A, t), k && v) {
|
|
603
|
+
v.unstageLink(se, t);
|
|
555
604
|
return;
|
|
556
605
|
}
|
|
557
|
-
if (
|
|
558
|
-
|
|
606
|
+
if (g) {
|
|
607
|
+
L.includes(t) ? I((c) => c.filter((F) => F !== t)) : R((c) => /* @__PURE__ */ new Set([...c, t]));
|
|
559
608
|
return;
|
|
560
609
|
}
|
|
561
|
-
const l =
|
|
562
|
-
l != null && l.id && (await
|
|
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, O, n] }));
|
|
563
612
|
}
|
|
564
|
-
async function
|
|
565
|
-
if (!
|
|
566
|
-
if (be(
|
|
567
|
-
|
|
613
|
+
async function S(t) {
|
|
614
|
+
if (!y.includes(t)) {
|
|
615
|
+
if (be(A, t), k && v) {
|
|
616
|
+
v.stageLink(se, t);
|
|
568
617
|
return;
|
|
569
618
|
}
|
|
570
|
-
if (
|
|
619
|
+
if (g) {
|
|
571
620
|
I((l) => l.includes(t) ? l : [...l, t]);
|
|
572
621
|
return;
|
|
573
622
|
}
|
|
574
|
-
await
|
|
575
|
-
|
|
576
|
-
), u.invalidateQueries({ queryKey: ["m2m-items",
|
|
623
|
+
await p.request(
|
|
624
|
+
Se(`/items/${s.many_collection}`, { [O]: n, [T]: t })
|
|
625
|
+
), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, O, n] });
|
|
577
626
|
}
|
|
578
627
|
}
|
|
579
|
-
function
|
|
580
|
-
URL.revokeObjectURL(t),
|
|
628
|
+
function G(t) {
|
|
629
|
+
URL.revokeObjectURL(t), C((l) => l.filter((c) => c.url !== t));
|
|
581
630
|
}
|
|
582
|
-
async function
|
|
631
|
+
async function X(t) {
|
|
583
632
|
const l = Array.from(t.target.files ?? []);
|
|
584
633
|
if (l.length)
|
|
585
|
-
if (a.current && (a.current.value = ""),
|
|
586
|
-
const c = l.map((
|
|
587
|
-
|
|
634
|
+
if (a.current && (a.current.value = ""), f) {
|
|
635
|
+
const c = l.map((F) => ({ file: F, url: URL.createObjectURL(F) }));
|
|
636
|
+
C((F) => [...F, ...c]);
|
|
588
637
|
} else {
|
|
589
638
|
Y(!0);
|
|
590
639
|
try {
|
|
591
640
|
for (const c of l) {
|
|
592
641
|
le(null);
|
|
593
|
-
const
|
|
594
|
-
cfg:
|
|
595
|
-
fallback: (
|
|
596
|
-
field:
|
|
597
|
-
collection:
|
|
598
|
-
item:
|
|
642
|
+
const F = await Qe(c, {
|
|
643
|
+
cfg: b,
|
|
644
|
+
fallback: (Z) => p.upload(Z),
|
|
645
|
+
field: s.one_field ?? void 0,
|
|
646
|
+
collection: s.one_collection ?? void 0,
|
|
647
|
+
item: k ? void 0 : String(n),
|
|
599
648
|
onProgress: le
|
|
600
649
|
});
|
|
601
|
-
await
|
|
650
|
+
await S(F.id);
|
|
602
651
|
}
|
|
603
652
|
u.invalidateQueries({ queryKey: ["file-browser"] });
|
|
604
653
|
} catch {
|
|
@@ -607,67 +656,72 @@ function St({
|
|
|
607
656
|
}
|
|
608
657
|
}
|
|
609
658
|
}
|
|
610
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
611
660
|
/* @__PURE__ */ e(
|
|
612
|
-
|
|
661
|
+
et,
|
|
613
662
|
{
|
|
614
|
-
collection:
|
|
615
|
-
item:
|
|
616
|
-
field:
|
|
663
|
+
collection: s.one_collection,
|
|
664
|
+
item: k ? null : String(n),
|
|
665
|
+
field: s.one_field
|
|
617
666
|
}
|
|
618
667
|
),
|
|
619
|
-
(
|
|
620
|
-
|
|
621
|
-
var
|
|
622
|
-
const l =
|
|
623
|
-
return c && !l ? null : /* @__PURE__ */
|
|
668
|
+
(y.length > 0 || U.length > 0 || oe.length > 0) && /* @__PURE__ */ i("div", { ref: Fe, className: "flex flex-col gap-1.5", children: [
|
|
669
|
+
y.map((t) => {
|
|
670
|
+
var F, Z;
|
|
671
|
+
const l = ie[t.toLowerCase()], c = J.fresh.has(t);
|
|
672
|
+
return c && !l ? null : /* @__PURE__ */ i(
|
|
624
673
|
"div",
|
|
625
674
|
{
|
|
626
675
|
"data-file-fresh": c ? "" : void 0,
|
|
627
|
-
className:
|
|
628
|
-
"flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
|
|
676
|
+
className: ce(
|
|
677
|
+
"flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50 dark:border-border dark:bg-white/[0.03]",
|
|
629
678
|
c && "nvr-row-enter"
|
|
630
679
|
),
|
|
631
680
|
children: [
|
|
632
681
|
/* @__PURE__ */ e(
|
|
633
682
|
"a",
|
|
634
683
|
{
|
|
635
|
-
href: `${
|
|
684
|
+
href: `${r(t)}?download=1`,
|
|
636
685
|
download: (l == null ? void 0 : l.filename_download) || !0,
|
|
637
|
-
onClick:
|
|
686
|
+
onClick: ne(`${r(t)}?download=1`, l == null ? void 0 : l.filename_download),
|
|
638
687
|
title: "Download",
|
|
639
688
|
className: "shrink-0",
|
|
640
689
|
children: /* @__PURE__ */ e(
|
|
641
690
|
me,
|
|
642
691
|
{
|
|
643
|
-
url:
|
|
692
|
+
url: r(t),
|
|
644
693
|
type: (l == null ? void 0 : l.type) ?? null,
|
|
645
694
|
filename: (l == null ? void 0 : l.filename_download) ?? t,
|
|
646
695
|
size: "sm",
|
|
647
|
-
processing:
|
|
696
|
+
processing: ae.isProcessing(t)
|
|
648
697
|
}
|
|
649
698
|
)
|
|
650
699
|
}
|
|
651
700
|
),
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
(
|
|
670
|
-
|
|
701
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
702
|
+
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
703
|
+
/* @__PURE__ */ e(
|
|
704
|
+
"a",
|
|
705
|
+
{
|
|
706
|
+
href: `${r(t)}?download=1`,
|
|
707
|
+
download: (l == null ? void 0 : l.filename_download) || !0,
|
|
708
|
+
onClick: ne(`${r(t)}?download=1`, l == null ? void 0 : l.filename_download),
|
|
709
|
+
title: "Download",
|
|
710
|
+
"data-file-name": !0,
|
|
711
|
+
className: "min-w-0 truncate text-left text-[12px] font-medium text-slate-700 hover:underline dark:text-slate-100",
|
|
712
|
+
children: l ? ue(l) || "Untitled file" : (
|
|
713
|
+
// The name is still loading: never show the raw file id.
|
|
714
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: "Loading name…" })
|
|
715
|
+
)
|
|
716
|
+
}
|
|
717
|
+
),
|
|
718
|
+
ae.isProcessing(t) && /* @__PURE__ */ e(Ie, {})
|
|
719
|
+
] }),
|
|
720
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
|
|
721
|
+
(l == null ? void 0 : l.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: _e(l.type, l.filename_download) }),
|
|
722
|
+
(l == null ? void 0 : l.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: Ne(l.filesize) }),
|
|
723
|
+
(l == null ? void 0 : l.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: tt(l.uploaded_on) }),
|
|
724
|
+
(l == null ? void 0 : l.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: [
|
|
671
725
|
"by ",
|
|
672
726
|
l.uploaded_by_name
|
|
673
727
|
] })
|
|
@@ -681,35 +735,35 @@ function St({
|
|
|
681
735
|
children: "file missing"
|
|
682
736
|
}
|
|
683
737
|
),
|
|
684
|
-
W && !
|
|
685
|
-
|
|
738
|
+
W && !k && $.includes(t) && /* @__PURE__ */ e(
|
|
739
|
+
Je,
|
|
686
740
|
{
|
|
687
741
|
fileId: t,
|
|
688
|
-
uses: (
|
|
689
|
-
loading:
|
|
690
|
-
collection:
|
|
691
|
-
itemId:
|
|
742
|
+
uses: (F = _.data) == null ? void 0 : F[t],
|
|
743
|
+
loading: _.isLoading,
|
|
744
|
+
collection: B,
|
|
745
|
+
itemId: n
|
|
692
746
|
}
|
|
693
747
|
),
|
|
694
|
-
|
|
748
|
+
N && !k && $.includes(t) && /* @__PURE__ */ e(Ve, { fileId: t, stat: (Z = xe.data) == null ? void 0 : Z[t] }),
|
|
695
749
|
/* @__PURE__ */ e(
|
|
696
750
|
"a",
|
|
697
751
|
{
|
|
698
|
-
href: `${
|
|
699
|
-
onClick:
|
|
752
|
+
href: `${r(t)}?download=1`,
|
|
753
|
+
onClick: ne(`${r(t)}?download=1`, l == null ? void 0 : l.filename_download),
|
|
700
754
|
title: "Download",
|
|
701
755
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
702
756
|
children: /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" })
|
|
703
757
|
}
|
|
704
758
|
),
|
|
705
|
-
!
|
|
759
|
+
!h && /* @__PURE__ */ e(
|
|
706
760
|
"button",
|
|
707
761
|
{
|
|
708
762
|
type: "button",
|
|
709
763
|
"aria-label": "Remove file",
|
|
710
|
-
onClick: () =>
|
|
764
|
+
onClick: () => m(t),
|
|
711
765
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
712
|
-
children: /* @__PURE__ */ e(
|
|
766
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
713
767
|
}
|
|
714
768
|
)
|
|
715
769
|
]
|
|
@@ -718,14 +772,17 @@ function St({
|
|
|
718
772
|
);
|
|
719
773
|
}),
|
|
720
774
|
oe.map((t) => /* @__PURE__ */ e(
|
|
721
|
-
|
|
775
|
+
Xe,
|
|
722
776
|
{
|
|
723
777
|
name: he.current.get(t.toLowerCase()) ?? "A file",
|
|
724
|
-
leaving:
|
|
778
|
+
leaving: J.leaving.has(t),
|
|
779
|
+
by: Ze(
|
|
780
|
+
u.getQueryData(["last-touch", B, String(n)])
|
|
781
|
+
)
|
|
725
782
|
},
|
|
726
783
|
`removed-${t}`
|
|
727
784
|
)),
|
|
728
|
-
U.map((t) => /* @__PURE__ */
|
|
785
|
+
U.map((t) => /* @__PURE__ */ i(
|
|
729
786
|
"div",
|
|
730
787
|
{
|
|
731
788
|
className: "flex items-center gap-2 rounded-lg border border-amber-200 p-2 bg-amber-50/50",
|
|
@@ -739,25 +796,32 @@ function St({
|
|
|
739
796
|
size: "sm"
|
|
740
797
|
}
|
|
741
798
|
),
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
800
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
744
801
|
/* @__PURE__ */ e(Oe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
745
|
-
/* @__PURE__ */ e(
|
|
802
|
+
/* @__PURE__ */ e(
|
|
803
|
+
"p",
|
|
804
|
+
{
|
|
805
|
+
"data-file-name": !0,
|
|
806
|
+
className: "text-[12px] font-medium text-slate-700 truncate dark:text-slate-100",
|
|
807
|
+
children: t.file.name
|
|
808
|
+
}
|
|
809
|
+
)
|
|
746
810
|
] }),
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
t.file.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: t.file.type }),
|
|
749
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
811
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
|
|
812
|
+
t.file.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-500 dark:text-slate-400", children: _e(t.file.type, t.file.name) }),
|
|
813
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Ne(t.file.size) }),
|
|
750
814
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
|
|
751
815
|
] })
|
|
752
816
|
] }),
|
|
753
|
-
!
|
|
817
|
+
!h && /* @__PURE__ */ e(
|
|
754
818
|
"button",
|
|
755
819
|
{
|
|
756
820
|
type: "button",
|
|
757
821
|
"aria-label": "Remove file",
|
|
758
|
-
onClick: () =>
|
|
822
|
+
onClick: () => G(t.url),
|
|
759
823
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
760
|
-
children: /* @__PURE__ */ e(
|
|
824
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
761
825
|
}
|
|
762
826
|
)
|
|
763
827
|
]
|
|
@@ -765,40 +829,40 @@ function St({
|
|
|
765
829
|
t.url
|
|
766
830
|
))
|
|
767
831
|
] }),
|
|
768
|
-
!
|
|
769
|
-
P && /* @__PURE__ */
|
|
770
|
-
/* @__PURE__ */
|
|
832
|
+
!h && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
833
|
+
P && /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
834
|
+
/* @__PURE__ */ i(
|
|
771
835
|
"button",
|
|
772
836
|
{
|
|
773
837
|
type: "button",
|
|
774
838
|
onClick: () => te((t) => !t),
|
|
775
|
-
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 transition-colors",
|
|
839
|
+
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 transition-colors",
|
|
776
840
|
children: [
|
|
777
|
-
/* @__PURE__ */ e(
|
|
841
|
+
/* @__PURE__ */ e(nt, { className: "h-3.5 w-3.5" }),
|
|
778
842
|
"Add existing…"
|
|
779
843
|
]
|
|
780
844
|
}
|
|
781
845
|
),
|
|
782
|
-
|
|
846
|
+
j && /* @__PURE__ */ e(
|
|
783
847
|
"div",
|
|
784
848
|
{
|
|
785
849
|
className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
|
|
786
850
|
style: { minWidth: 480 },
|
|
787
851
|
children: /* @__PURE__ */ e(
|
|
788
|
-
|
|
852
|
+
lt,
|
|
789
853
|
{
|
|
790
|
-
selected:
|
|
854
|
+
selected: y,
|
|
791
855
|
multi: !0,
|
|
792
|
-
onSelect: (t) =>
|
|
856
|
+
onSelect: (t) => S(t),
|
|
793
857
|
onClose: () => te(!1),
|
|
794
|
-
getUrl:
|
|
858
|
+
getUrl: r
|
|
795
859
|
}
|
|
796
860
|
)
|
|
797
861
|
}
|
|
798
862
|
)
|
|
799
863
|
] }),
|
|
800
|
-
|
|
801
|
-
/* @__PURE__ */
|
|
864
|
+
x && /* @__PURE__ */ i(de, { children: [
|
|
865
|
+
/* @__PURE__ */ i(
|
|
802
866
|
"button",
|
|
803
867
|
{
|
|
804
868
|
type: "button",
|
|
@@ -806,11 +870,11 @@ function St({
|
|
|
806
870
|
var t;
|
|
807
871
|
return (t = a.current) == null ? void 0 : t.click();
|
|
808
872
|
},
|
|
809
|
-
disabled:
|
|
810
|
-
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 disabled:opacity-40 transition-colors",
|
|
873
|
+
disabled: M,
|
|
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",
|
|
811
875
|
children: [
|
|
812
|
-
|
|
813
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
876
|
+
M ? /* @__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: M && H != null ? `Uploading ${H}%` : "Upload…" })
|
|
814
878
|
]
|
|
815
879
|
}
|
|
816
880
|
),
|
|
@@ -821,7 +885,7 @@ function St({
|
|
|
821
885
|
type: "file",
|
|
822
886
|
multiple: !0,
|
|
823
887
|
className: "hidden",
|
|
824
|
-
onChange:
|
|
888
|
+
onChange: X
|
|
825
889
|
}
|
|
826
890
|
)
|
|
827
891
|
] })
|
|
@@ -829,7 +893,8 @@ function St({
|
|
|
829
893
|
] });
|
|
830
894
|
}
|
|
831
895
|
export {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
ue as fileDisplayName
|
|
896
|
+
Tt as FileM2MField,
|
|
897
|
+
jt as FilePickerField,
|
|
898
|
+
ue as fileDisplayName,
|
|
899
|
+
_e as friendlyFileType
|
|
835
900
|
};
|