@nivaro/react 0.3.67 → 0.3.68
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 +7 -0
- package/dist/index.js +836 -835
- package/dist/shared/components/ConformanceView.js +34 -34
- package/dist/shared/components/ReportView.js +196 -196
- package/dist/shared/components/SlaRulesView.js +36 -36
- package/dist/shared/components/chat/ChatPanel.js +484 -487
- package/dist/shared/components/chat/ChatViews.js +66 -66
- package/dist/shared/components/chat/RoomParts.js +159 -157
- package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
- package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
- package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
- package/dist/shared/components/item-edit/FieldRow.js +87 -87
- package/dist/shared/components/item-edit/FilePickerField.js +281 -297
- package/dist/shared/components/item-edit/RecordInsights.js +90 -91
- package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
- package/dist/shared/components/panels/AddendumPanel.js +409 -411
- package/dist/shared/components/panels/CommentPanel.js +169 -162
- package/dist/shared/components/panels/PipelinePanel.js +75 -75
- package/dist/shared/components/panels/RevisionsPanel.js +103 -103
- package/dist/shared/components/queue/QueueWorklist.js +142 -141
- package/dist/shared/lib/format-value.js +15 -15
- package/dist/shared/lib/utils.js +58 -53
- package/package.json +1 -1
|
@@ -1,74 +1,71 @@
|
|
|
1
|
-
import { jsxs as i, jsx as e, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Clock as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { useFileHealth as
|
|
7
|
-
import { get as
|
|
8
|
-
import { cn as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return h ? new RegExp(`\\.${h}$`, "i").test(a) ? a : `${a}.${h}` : a;
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as pe, useQuery as X } from "@tanstack/react-query";
|
|
3
|
+
import { Clock as fe, Download as xe, Loader2 as Z, Upload as ae, X as Y, Plus as qe, File as ue, FileVideo as je, FileAudio as Se, FileText as ne, FileSpreadsheet as We, FileCode as ze } from "lucide-react";
|
|
4
|
+
import { useId as ie, useState as $, useRef as ge, useEffect as B } from "react";
|
|
5
|
+
import { useNivaroClient as oe, useGridFlush as be, useParentDraft as we } from "../../context.js";
|
|
6
|
+
import { useFileHealth as ye } from "../../hooks/useFileHealth.js";
|
|
7
|
+
import { get as I, post as me, del as he } from "../../lib/commands.js";
|
|
8
|
+
import { cn as re, formatDateTime as Ke } from "../../lib/utils.js";
|
|
9
|
+
import { useOnceVisible as Ne, useFileUsage as ve, FileUsageChip as ke } from "./FileUsage.js";
|
|
10
|
+
import { useFileDownload as _e } from "./file-download.js";
|
|
11
|
+
import { useM2MStaging as Pe } from "./M2MStagingContext.js";
|
|
12
|
+
function de(s) {
|
|
13
|
+
var y;
|
|
14
|
+
const a = ((s == null ? void 0 : s.title) ?? "").trim(), v = ((s == null ? void 0 : s.filename_download) ?? "").trim();
|
|
15
|
+
if (!a) return v;
|
|
16
|
+
const m = (y = /\.([A-Za-z0-9]{1,8})$/.exec(v)) == null ? void 0 : y[1];
|
|
17
|
+
return m ? new RegExp(`\\.${m}$`, "i").test(a) ? a : `${a}.${m}` : a;
|
|
19
18
|
}
|
|
20
|
-
function
|
|
19
|
+
function ee(s) {
|
|
21
20
|
return s ? s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB` : null;
|
|
22
21
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
const a = new Date(s);
|
|
26
|
-
return a.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" }) + " " + a.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
22
|
+
function Fe(s) {
|
|
23
|
+
return s ? Ke(s) : null;
|
|
27
24
|
}
|
|
28
|
-
function
|
|
25
|
+
function Oe(s) {
|
|
29
26
|
return !!s && s.startsWith("image/");
|
|
30
27
|
}
|
|
31
|
-
function
|
|
32
|
-
return s ? s.startsWith("video/") ? /* @__PURE__ */ e(
|
|
28
|
+
function Qe(s, a) {
|
|
29
|
+
return s ? s.startsWith("video/") ? /* @__PURE__ */ e(je, { className: a, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(Se, { className: a, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(We, { className: a, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ze, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(ue, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(ue, { className: a, strokeWidth: 1.5 });
|
|
33
30
|
}
|
|
34
|
-
function
|
|
31
|
+
function V({
|
|
35
32
|
url: s,
|
|
36
33
|
type: a,
|
|
37
|
-
filename:
|
|
38
|
-
size:
|
|
34
|
+
filename: v,
|
|
35
|
+
size: m = "md"
|
|
39
36
|
}) {
|
|
40
|
-
const
|
|
41
|
-
return
|
|
37
|
+
const y = m === "sm" ? "h-10 w-10" : m === "lg" ? "h-20 w-20" : "h-14 w-14";
|
|
38
|
+
return Oe(a) ? /* @__PURE__ */ e(
|
|
42
39
|
"img",
|
|
43
40
|
{
|
|
44
41
|
src: s,
|
|
45
|
-
alt:
|
|
42
|
+
alt: v,
|
|
46
43
|
"data-file-thumb": !0,
|
|
47
|
-
className:
|
|
44
|
+
className: re(y, "object-cover rounded shrink-0"),
|
|
48
45
|
loading: "lazy",
|
|
49
|
-
onError: (
|
|
50
|
-
|
|
46
|
+
onError: (k) => {
|
|
47
|
+
k.target.style.display = "none";
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
) : /* @__PURE__ */ e("div", { className:
|
|
50
|
+
) : /* @__PURE__ */ e("div", { className: re(y, "flex items-center justify-center rounded bg-slate-100 shrink-0"), children: Qe(a, m === "sm" ? "h-4 w-4" : "h-6 w-6") });
|
|
54
51
|
}
|
|
55
|
-
function
|
|
52
|
+
function Re({
|
|
56
53
|
selected: s,
|
|
57
54
|
multi: a,
|
|
58
|
-
onSelect:
|
|
59
|
-
onClose:
|
|
60
|
-
getUrl:
|
|
55
|
+
onSelect: v,
|
|
56
|
+
onClose: m,
|
|
57
|
+
getUrl: y
|
|
61
58
|
}) {
|
|
62
|
-
const
|
|
63
|
-
queryKey: ["file-browser",
|
|
64
|
-
queryFn: () =>
|
|
65
|
-
|
|
59
|
+
const k = oe(), [h, u] = $(""), { data: g = [], isLoading: p } = X({
|
|
60
|
+
queryKey: ["file-browser", h],
|
|
61
|
+
queryFn: () => k.request(
|
|
62
|
+
I("/files", {
|
|
66
63
|
limit: "60",
|
|
67
64
|
sort: "-uploaded_on",
|
|
68
65
|
fields: "id,filename_download,title,type,filesize,width,height,missing_at",
|
|
69
|
-
...
|
|
66
|
+
...h ? { search: h } : {}
|
|
70
67
|
})
|
|
71
|
-
).then((
|
|
68
|
+
).then((d) => d.data ?? []),
|
|
72
69
|
staleTime: 3e4
|
|
73
70
|
});
|
|
74
71
|
return /* @__PURE__ */ i("div", { className: "flex flex-col", style: { width: 480, maxHeight: 420 }, children: [
|
|
@@ -82,9 +79,9 @@ function Ue({
|
|
|
82
79
|
{
|
|
83
80
|
type: "button",
|
|
84
81
|
"aria-label": "Close",
|
|
85
|
-
onClick:
|
|
82
|
+
onClick: m,
|
|
86
83
|
className: "text-slate-400 hover:text-slate-600",
|
|
87
|
-
children: /* @__PURE__ */ e(
|
|
84
|
+
children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
|
|
88
85
|
}
|
|
89
86
|
)
|
|
90
87
|
] }),
|
|
@@ -93,38 +90,38 @@ function Ue({
|
|
|
93
90
|
{
|
|
94
91
|
type: "text",
|
|
95
92
|
placeholder: "Search files…",
|
|
96
|
-
value:
|
|
97
|
-
onChange: (
|
|
93
|
+
value: h,
|
|
94
|
+
onChange: (d) => u(d.target.value),
|
|
98
95
|
className: "w-full h-7 rounded border border-slate-200 px-2 text-[12px] focus:outline-none focus:ring-1 focus:ring-nvr-cyan",
|
|
99
96
|
autoFocus: !0
|
|
100
97
|
}
|
|
101
98
|
) }),
|
|
102
99
|
/* @__PURE__ */ i("div", { className: "overflow-y-auto flex-1 p-3", children: [
|
|
103
|
-
|
|
104
|
-
!
|
|
105
|
-
!
|
|
106
|
-
const
|
|
100
|
+
p && /* @__PURE__ */ e("div", { className: "flex justify-center py-6", children: /* @__PURE__ */ e(Z, { className: "h-5 w-5 animate-spin text-slate-300" }) }),
|
|
101
|
+
!p && g.length === 0 && /* @__PURE__ */ e("p", { className: "text-center text-[12px] text-slate-400 py-6", children: "No files found" }),
|
|
102
|
+
!p && g.length > 0 && /* @__PURE__ */ e("div", { className: "grid grid-cols-5 gap-2", children: g.map((d) => {
|
|
103
|
+
const N = s.includes(d.id);
|
|
107
104
|
return /* @__PURE__ */ i(
|
|
108
105
|
"button",
|
|
109
106
|
{
|
|
110
107
|
type: "button",
|
|
111
|
-
onClick: () =>
|
|
112
|
-
className:
|
|
108
|
+
onClick: () => v(d.id),
|
|
109
|
+
className: re(
|
|
113
110
|
"nvr-rise-in group flex flex-col items-center gap-1 rounded-lg p-1.5 text-left transition-colors border",
|
|
114
|
-
|
|
111
|
+
N ? "border-nvr-cyan bg-nvr-cyan/5" : "border-transparent hover:border-slate-200 hover:bg-slate-50"
|
|
115
112
|
),
|
|
116
113
|
children: [
|
|
117
114
|
/* @__PURE__ */ i("div", { className: "relative", children: [
|
|
118
115
|
/* @__PURE__ */ e(
|
|
119
|
-
|
|
116
|
+
V,
|
|
120
117
|
{
|
|
121
|
-
url:
|
|
122
|
-
type:
|
|
123
|
-
filename:
|
|
118
|
+
url: y(d.id),
|
|
119
|
+
type: d.type,
|
|
120
|
+
filename: d.filename_download,
|
|
124
121
|
size: "md"
|
|
125
122
|
}
|
|
126
123
|
),
|
|
127
|
-
|
|
124
|
+
N && /* @__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(
|
|
128
125
|
"svg",
|
|
129
126
|
{
|
|
130
127
|
className: "h-2.5 w-2.5 text-white",
|
|
@@ -148,124 +145,121 @@ function Ue({
|
|
|
148
145
|
{
|
|
149
146
|
"data-file-name": !0,
|
|
150
147
|
className: "text-[10px] text-slate-500 truncate w-full text-center leading-tight",
|
|
151
|
-
children:
|
|
148
|
+
children: de(d)
|
|
152
149
|
}
|
|
153
150
|
)
|
|
154
151
|
]
|
|
155
152
|
},
|
|
156
|
-
|
|
153
|
+
d.id
|
|
157
154
|
);
|
|
158
155
|
}) })
|
|
159
156
|
] })
|
|
160
157
|
] });
|
|
161
158
|
}
|
|
162
|
-
function
|
|
159
|
+
function Ze({
|
|
163
160
|
value: s,
|
|
164
161
|
onChange: a,
|
|
165
|
-
disabled:
|
|
166
|
-
allowUpload:
|
|
167
|
-
allowPick:
|
|
162
|
+
disabled: v,
|
|
163
|
+
allowUpload: m = !0,
|
|
164
|
+
allowPick: y = !0
|
|
168
165
|
}) {
|
|
169
|
-
var
|
|
170
|
-
const
|
|
166
|
+
var j, J;
|
|
167
|
+
const k = oe(), h = pe(), u = be(), g = ie(), [p, d] = $(!1), [N, L] = $(!1), [f, z] = $(null), [D, E] = $(null), x = ge(null), r = !f && s ? String(s) : null, _ = (c) => k.fileUrl(c), S = _e(), b = we(), K = ((j = b == null ? void 0 : b.draft) == null ? void 0 : j.id) != null ? String(b.draft.id) : null, [H, q] = Ne(!!r), R = ve(
|
|
171
168
|
b == null ? void 0 : b.collection,
|
|
172
|
-
|
|
169
|
+
K,
|
|
173
170
|
r ? [r] : [],
|
|
174
171
|
q
|
|
175
172
|
);
|
|
176
|
-
|
|
177
|
-
if (!
|
|
178
|
-
|
|
173
|
+
B(() => {
|
|
174
|
+
if (!f) {
|
|
175
|
+
E(null);
|
|
179
176
|
return;
|
|
180
177
|
}
|
|
181
|
-
const
|
|
182
|
-
return
|
|
183
|
-
}, [
|
|
184
|
-
if (!(!u || !
|
|
178
|
+
const c = URL.createObjectURL(f);
|
|
179
|
+
return E(c), () => URL.revokeObjectURL(c);
|
|
180
|
+
}, [f]), B(() => {
|
|
181
|
+
if (!(!u || !f))
|
|
185
182
|
return u.register(g, async () => {
|
|
186
|
-
const
|
|
187
|
-
a(
|
|
183
|
+
const c = await k.upload(f);
|
|
184
|
+
a(c.id), z(null), h.invalidateQueries({ queryKey: ["file-browser"] });
|
|
188
185
|
}), () => u.unregister(g);
|
|
189
|
-
}, [u,
|
|
190
|
-
const
|
|
186
|
+
}, [u, f, g, k, a, h]);
|
|
187
|
+
const T = ye([r]), { data: n, isLoading: C } = X({
|
|
191
188
|
queryKey: ["file-meta", r],
|
|
192
|
-
queryFn: () =>
|
|
189
|
+
queryFn: () => k.request(I(`/files/${r}/meta`)).then((c) => c.data ?? null),
|
|
193
190
|
enabled: !!r,
|
|
194
191
|
staleTime: 6e4
|
|
195
192
|
});
|
|
196
|
-
async function
|
|
197
|
-
var
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
193
|
+
async function P(c) {
|
|
194
|
+
var G;
|
|
195
|
+
const W = (G = c.target.files) == null ? void 0 : G[0];
|
|
196
|
+
if (W)
|
|
200
197
|
if (x.current && (x.current.value = ""), u)
|
|
201
|
-
|
|
198
|
+
z(W);
|
|
202
199
|
else {
|
|
203
|
-
|
|
204
|
-
new CustomEvent("nvr:upload-state", { detail: { name:
|
|
200
|
+
L(!0), window.dispatchEvent(
|
|
201
|
+
new CustomEvent("nvr:upload-state", { detail: { name: W.name, state: "start" } })
|
|
205
202
|
);
|
|
206
203
|
try {
|
|
207
|
-
const
|
|
208
|
-
a(
|
|
204
|
+
const le = await k.upload(W);
|
|
205
|
+
a(le.id), h.invalidateQueries({ queryKey: ["file-browser"] });
|
|
209
206
|
} catch {
|
|
210
207
|
} finally {
|
|
211
|
-
|
|
212
|
-
new CustomEvent("nvr:upload-state", { detail: { name:
|
|
208
|
+
L(!1), window.dispatchEvent(
|
|
209
|
+
new CustomEvent("nvr:upload-state", { detail: { name: W.name, state: "done" } })
|
|
213
210
|
);
|
|
214
211
|
}
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
214
|
+
function A(c) {
|
|
215
|
+
z(null), a(c), d(!1);
|
|
219
216
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
217
|
+
function te() {
|
|
218
|
+
z(null), a(null);
|
|
222
219
|
}
|
|
223
|
-
const
|
|
220
|
+
const w = !!f;
|
|
224
221
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
225
|
-
|
|
226
|
-
y || !!r ? /* @__PURE__ */ i(
|
|
222
|
+
w || !!r ? /* @__PURE__ */ i(
|
|
227
223
|
"div",
|
|
228
224
|
{
|
|
229
|
-
ref:
|
|
225
|
+
ref: H,
|
|
230
226
|
className: "flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
|
|
231
227
|
children: [
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
w ? /* @__PURE__ */ e(
|
|
229
|
+
V,
|
|
234
230
|
{
|
|
235
231
|
url: D ?? "",
|
|
236
|
-
type:
|
|
237
|
-
filename:
|
|
232
|
+
type: f.type || null,
|
|
233
|
+
filename: f.name,
|
|
238
234
|
size: "sm"
|
|
239
235
|
}
|
|
240
|
-
) :
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)
|
|
262
|
-
}
|
|
236
|
+
) : C ? /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }) : (
|
|
237
|
+
// Every file click downloads (2026-11-08): no in-app preview.
|
|
238
|
+
/* @__PURE__ */ e(
|
|
239
|
+
"a",
|
|
240
|
+
{
|
|
241
|
+
href: `${_(r)}?download=1`,
|
|
242
|
+
download: (n == null ? void 0 : n.filename_download) || !0,
|
|
243
|
+
onClick: S(`${_(r)}?download=1`, n == null ? void 0 : n.filename_download),
|
|
244
|
+
title: "Download",
|
|
245
|
+
className: "shrink-0",
|
|
246
|
+
children: /* @__PURE__ */ e(
|
|
247
|
+
V,
|
|
248
|
+
{
|
|
249
|
+
url: _(r),
|
|
250
|
+
type: (n == null ? void 0 : n.type) ?? null,
|
|
251
|
+
filename: (n == null ? void 0 : n.filename_download) ?? "",
|
|
252
|
+
size: "sm"
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
)
|
|
263
257
|
),
|
|
264
258
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
265
259
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
266
|
-
|
|
267
|
-
/* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children:
|
|
268
|
-
!
|
|
260
|
+
w && /* @__PURE__ */ e(fe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
261
|
+
/* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children: w ? f.name : de(n) || r }),
|
|
262
|
+
!w && (T.verdict(r) ?? !!(n != null && n.missing_at)) && /* @__PURE__ */ e(
|
|
269
263
|
"span",
|
|
270
264
|
{
|
|
271
265
|
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",
|
|
@@ -274,205 +268,205 @@ function et({
|
|
|
274
268
|
}
|
|
275
269
|
)
|
|
276
270
|
] }),
|
|
277
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children:
|
|
278
|
-
|
|
279
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
271
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: w ? /* @__PURE__ */ i(M, { children: [
|
|
272
|
+
f.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: f.type }),
|
|
273
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(f.size) }),
|
|
280
274
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
|
|
281
|
-
] }) : /* @__PURE__ */ i(
|
|
275
|
+
] }) : /* @__PURE__ */ i(M, { children: [
|
|
282
276
|
(n == null ? void 0 : n.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: n.type }),
|
|
283
|
-
(n == null ? void 0 : n.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
284
|
-
(n == null ? void 0 : n.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
277
|
+
(n == null ? void 0 : n.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(n.filesize) }),
|
|
278
|
+
(n == null ? void 0 : n.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Fe(n.uploaded_on) }),
|
|
285
279
|
(n == null ? void 0 : n.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500", children: [
|
|
286
280
|
"by ",
|
|
287
281
|
n.uploaded_by_name
|
|
288
282
|
] })
|
|
289
283
|
] }) })
|
|
290
284
|
] }),
|
|
291
|
-
!
|
|
292
|
-
|
|
285
|
+
!w && r && /* @__PURE__ */ e(
|
|
286
|
+
ke,
|
|
293
287
|
{
|
|
294
288
|
fileId: r,
|
|
295
|
-
uses: (
|
|
296
|
-
loading:
|
|
289
|
+
uses: (J = R.data) == null ? void 0 : J[r],
|
|
290
|
+
loading: R.isLoading,
|
|
297
291
|
collection: b == null ? void 0 : b.collection,
|
|
298
|
-
itemId:
|
|
292
|
+
itemId: K
|
|
299
293
|
}
|
|
300
294
|
),
|
|
301
|
-
!
|
|
295
|
+
!w && r && /* @__PURE__ */ e(
|
|
302
296
|
"a",
|
|
303
297
|
{
|
|
304
|
-
href: `${
|
|
305
|
-
onClick:
|
|
298
|
+
href: `${_(r)}?download=1`,
|
|
299
|
+
onClick: S(`${_(r)}?download=1`, n == null ? void 0 : n.filename_download),
|
|
306
300
|
title: "Download",
|
|
307
301
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
308
|
-
children: /* @__PURE__ */ e(
|
|
302
|
+
children: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" })
|
|
309
303
|
}
|
|
310
304
|
),
|
|
311
|
-
!
|
|
312
|
-
|
|
305
|
+
!v && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
306
|
+
y && /* @__PURE__ */ e(
|
|
313
307
|
"button",
|
|
314
308
|
{
|
|
315
309
|
type: "button",
|
|
316
|
-
onClick: () =>
|
|
310
|
+
onClick: () => d(!0),
|
|
317
311
|
className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400",
|
|
318
312
|
children: "Replace"
|
|
319
313
|
}
|
|
320
314
|
),
|
|
321
|
-
|
|
315
|
+
m && /* @__PURE__ */ i(M, { children: [
|
|
322
316
|
/* @__PURE__ */ i(
|
|
323
317
|
"button",
|
|
324
318
|
{
|
|
325
319
|
type: "button",
|
|
326
320
|
onClick: () => {
|
|
327
|
-
var
|
|
328
|
-
return (
|
|
321
|
+
var c;
|
|
322
|
+
return (c = x.current) == null ? void 0 : c.click();
|
|
329
323
|
},
|
|
330
|
-
disabled:
|
|
324
|
+
disabled: N,
|
|
331
325
|
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",
|
|
332
326
|
children: [
|
|
333
|
-
|
|
327
|
+
N ? /* @__PURE__ */ e(Z, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3 w-3" }),
|
|
334
328
|
"Upload"
|
|
335
329
|
]
|
|
336
330
|
}
|
|
337
331
|
),
|
|
338
|
-
/* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange:
|
|
332
|
+
/* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: P })
|
|
339
333
|
] }),
|
|
340
334
|
/* @__PURE__ */ e(
|
|
341
335
|
"button",
|
|
342
336
|
{
|
|
343
337
|
type: "button",
|
|
344
338
|
"aria-label": "Remove file",
|
|
345
|
-
onClick:
|
|
339
|
+
onClick: te,
|
|
346
340
|
className: "text-slate-300 hover:text-red-400 p-0.5",
|
|
347
|
-
children: /* @__PURE__ */ e(
|
|
341
|
+
children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
|
|
348
342
|
}
|
|
349
343
|
)
|
|
350
344
|
] })
|
|
351
345
|
]
|
|
352
346
|
}
|
|
353
347
|
) : /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
354
|
-
|
|
348
|
+
y && /* @__PURE__ */ e(
|
|
355
349
|
"button",
|
|
356
350
|
{
|
|
357
351
|
type: "button",
|
|
358
|
-
disabled:
|
|
359
|
-
onClick: () =>
|
|
352
|
+
disabled: v,
|
|
353
|
+
onClick: () => d(!0),
|
|
360
354
|
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",
|
|
361
355
|
children: "Select file…"
|
|
362
356
|
}
|
|
363
357
|
),
|
|
364
|
-
|
|
358
|
+
m && !v && /* @__PURE__ */ i(M, { children: [
|
|
365
359
|
/* @__PURE__ */ i(
|
|
366
360
|
"button",
|
|
367
361
|
{
|
|
368
362
|
type: "button",
|
|
369
363
|
onClick: () => {
|
|
370
|
-
var
|
|
371
|
-
return (
|
|
364
|
+
var c;
|
|
365
|
+
return (c = x.current) == null ? void 0 : c.click();
|
|
372
366
|
},
|
|
373
|
-
disabled:
|
|
367
|
+
disabled: N,
|
|
374
368
|
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",
|
|
375
369
|
children: [
|
|
376
|
-
|
|
370
|
+
N ? /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" }),
|
|
377
371
|
"Upload"
|
|
378
372
|
]
|
|
379
373
|
}
|
|
380
374
|
),
|
|
381
|
-
/* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange:
|
|
375
|
+
/* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: P })
|
|
382
376
|
] })
|
|
383
377
|
] }),
|
|
384
|
-
|
|
378
|
+
p && /* @__PURE__ */ e(
|
|
385
379
|
"div",
|
|
386
380
|
{
|
|
387
381
|
className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
|
|
388
382
|
style: { minWidth: 480 },
|
|
389
383
|
children: /* @__PURE__ */ e(
|
|
390
|
-
|
|
384
|
+
Re,
|
|
391
385
|
{
|
|
392
386
|
selected: r ? [r] : [],
|
|
393
387
|
multi: !1,
|
|
394
|
-
onSelect:
|
|
395
|
-
onClose: () =>
|
|
396
|
-
getUrl:
|
|
388
|
+
onSelect: A,
|
|
389
|
+
onClose: () => d(!1),
|
|
390
|
+
getUrl: _
|
|
397
391
|
}
|
|
398
392
|
)
|
|
399
393
|
}
|
|
400
394
|
)
|
|
401
395
|
] });
|
|
402
396
|
}
|
|
403
|
-
function
|
|
397
|
+
function Ye({
|
|
404
398
|
relation: s,
|
|
405
399
|
parentId: a,
|
|
406
|
-
allRelations:
|
|
407
|
-
disabled:
|
|
408
|
-
allowUpload:
|
|
409
|
-
allowPick:
|
|
410
|
-
pendingSave:
|
|
400
|
+
allRelations: v,
|
|
401
|
+
disabled: m,
|
|
402
|
+
allowUpload: y = !0,
|
|
403
|
+
allowPick: k = !0,
|
|
404
|
+
pendingSave: h = !1
|
|
411
405
|
}) {
|
|
412
|
-
const u =
|
|
413
|
-
|
|
406
|
+
const u = oe(), g = pe(), p = be(), d = ie(), N = ie(), L = Pe(), [f, z] = $(!1), [D, E] = $(!1), [x, r] = $([]), _ = ge(null), [S, b] = $([]), [K, H] = $(/* @__PURE__ */ new Set()), q = s.junction_field ?? "", R = s.many_field ?? "", T = s.one_field ?? `${s.many_collection}.${q}`, n = a === "new", C = (l) => u.fileUrl(l), P = _e();
|
|
407
|
+
B(() => () => {
|
|
414
408
|
r((l) => (l.forEach((t) => URL.revokeObjectURL(t.url)), []));
|
|
415
|
-
}, []),
|
|
416
|
-
if (!
|
|
409
|
+
}, []), B(() => {
|
|
410
|
+
if (!p || !x.length || h) return;
|
|
417
411
|
const l = x;
|
|
418
|
-
return
|
|
412
|
+
return p.register(d, async () => {
|
|
419
413
|
for (const t of l) {
|
|
420
414
|
const o = await u.upload(t.file);
|
|
421
|
-
URL.revokeObjectURL(t.url), await
|
|
415
|
+
URL.revokeObjectURL(t.url), await se(o.id);
|
|
422
416
|
}
|
|
423
417
|
r([]), g.invalidateQueries({ queryKey: ["file-browser"] });
|
|
424
|
-
}), () =>
|
|
425
|
-
}, [
|
|
426
|
-
if (!
|
|
427
|
-
if (!(
|
|
428
|
-
|
|
418
|
+
}), () => p.unregister(d);
|
|
419
|
+
}, [p, x, d, h]), B(() => {
|
|
420
|
+
if (!p || !h) return;
|
|
421
|
+
if (!(S.length > 0 || K.size > 0 || x.length > 0)) {
|
|
422
|
+
p.unregister(N);
|
|
429
423
|
return;
|
|
430
424
|
}
|
|
431
|
-
const t =
|
|
432
|
-
return
|
|
433
|
-
const
|
|
434
|
-
for (const O of
|
|
425
|
+
const t = S, o = new Set(K), U = x;
|
|
426
|
+
return p.register(N, async () => {
|
|
427
|
+
const ce = [];
|
|
428
|
+
for (const O of U) {
|
|
435
429
|
const Q = await u.upload(O.file);
|
|
436
|
-
URL.revokeObjectURL(O.url),
|
|
430
|
+
URL.revokeObjectURL(O.url), ce.push(Q.id);
|
|
437
431
|
}
|
|
438
|
-
for (const O of [...t, ...
|
|
432
|
+
for (const O of [...t, ...ce])
|
|
439
433
|
await u.request(
|
|
440
|
-
|
|
441
|
-
[
|
|
434
|
+
me(`/items/${s.many_collection}`, {
|
|
435
|
+
[R]: a,
|
|
442
436
|
[q]: O
|
|
443
437
|
})
|
|
444
438
|
);
|
|
445
439
|
for (const O of o) {
|
|
446
|
-
const Q =
|
|
447
|
-
Q != null && Q.id && await u.request(
|
|
440
|
+
const Q = A.find((Le) => String(Le[q]) === O);
|
|
441
|
+
Q != null && Q.id && await u.request(he(`/items/${s.many_collection}/${Q.id}`));
|
|
448
442
|
}
|
|
449
|
-
b([]),
|
|
450
|
-
queryKey: ["m2m-items", s.many_collection,
|
|
443
|
+
b([]), H(/* @__PURE__ */ new Set()), r([]), g.invalidateQueries({
|
|
444
|
+
queryKey: ["m2m-items", s.many_collection, R, a]
|
|
451
445
|
}), g.invalidateQueries({ queryKey: ["file-browser"] });
|
|
452
|
-
}), () =>
|
|
453
|
-
}, [
|
|
454
|
-
const { data:
|
|
455
|
-
queryKey: ["m2m-items", s.many_collection,
|
|
446
|
+
}), () => p.unregister(N);
|
|
447
|
+
}, [p, h, S, K, x, N]);
|
|
448
|
+
const { data: A = [] } = X({
|
|
449
|
+
queryKey: ["m2m-items", s.many_collection, R, a],
|
|
456
450
|
queryFn: () => u.request(
|
|
457
|
-
|
|
458
|
-
filter: JSON.stringify({ [
|
|
451
|
+
I(`/items/${s.many_collection}`, {
|
|
452
|
+
filter: JSON.stringify({ [R]: { _eq: a } }),
|
|
459
453
|
limit: "200",
|
|
460
454
|
fields: `id,${q}`
|
|
461
455
|
})
|
|
462
456
|
).then((l) => l.data ?? []),
|
|
463
457
|
enabled: !!a && !n,
|
|
464
458
|
staleTime: 3e4
|
|
465
|
-
}),
|
|
466
|
-
|
|
459
|
+
}), te = n && L ? L.getStagedLinks(T) : [], w = A.map((l) => String(l[q])), F = n ? te : h ? [...w.filter((l) => !K.has(l)), ...S] : w, j = we(), [J, c] = Ne(w.length > 0), W = ve(
|
|
460
|
+
j == null ? void 0 : j.collection,
|
|
467
461
|
n ? null : a,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
),
|
|
462
|
+
w,
|
|
463
|
+
c
|
|
464
|
+
), G = ye(F), { data: le = {} } = X({
|
|
471
465
|
queryKey: ["files-meta", ...F.sort()],
|
|
472
466
|
queryFn: async () => {
|
|
473
467
|
if (!F.length) return {};
|
|
474
468
|
const l = await u.request(
|
|
475
|
-
|
|
469
|
+
I("/files", {
|
|
476
470
|
filter: JSON.stringify({ id: { _in: F } }),
|
|
477
471
|
limit: String(F.length),
|
|
478
472
|
fields: "id,filename_download,title,type,filesize,uploaded_on,uploaded_by_name,missing_at"
|
|
@@ -484,84 +478,78 @@ function tt({
|
|
|
484
478
|
enabled: F.length > 0,
|
|
485
479
|
staleTime: 6e4
|
|
486
480
|
});
|
|
487
|
-
async function
|
|
488
|
-
if (n &&
|
|
489
|
-
|
|
481
|
+
async function Ce(l) {
|
|
482
|
+
if (n && L) {
|
|
483
|
+
L.unstageLink(T, l);
|
|
490
484
|
return;
|
|
491
485
|
}
|
|
492
|
-
if (
|
|
493
|
-
|
|
486
|
+
if (h) {
|
|
487
|
+
S.includes(l) ? b((o) => o.filter((U) => U !== l)) : H((o) => /* @__PURE__ */ new Set([...o, l]));
|
|
494
488
|
return;
|
|
495
489
|
}
|
|
496
|
-
const t =
|
|
497
|
-
t != null && t.id && (await u.request(
|
|
490
|
+
const t = A.find((o) => String(o[q]) === l);
|
|
491
|
+
t != null && t.id && (await u.request(he(`/items/${s.many_collection}/${t.id}`)), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, R, a] }));
|
|
498
492
|
}
|
|
499
|
-
async function
|
|
493
|
+
async function se(l) {
|
|
500
494
|
if (!F.includes(l)) {
|
|
501
|
-
if (n &&
|
|
502
|
-
|
|
495
|
+
if (n && L) {
|
|
496
|
+
L.stageLink(T, l);
|
|
503
497
|
return;
|
|
504
498
|
}
|
|
505
|
-
if (
|
|
499
|
+
if (h) {
|
|
506
500
|
b((t) => t.includes(l) ? t : [...t, l]);
|
|
507
501
|
return;
|
|
508
502
|
}
|
|
509
503
|
await u.request(
|
|
510
|
-
|
|
511
|
-
), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection,
|
|
504
|
+
me(`/items/${s.many_collection}`, { [R]: a, [q]: l })
|
|
505
|
+
), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, R, a] });
|
|
512
506
|
}
|
|
513
507
|
}
|
|
514
|
-
function
|
|
508
|
+
function Ue(l) {
|
|
515
509
|
URL.revokeObjectURL(l), r((t) => t.filter((o) => o.url !== l));
|
|
516
510
|
}
|
|
517
511
|
async function $e(l) {
|
|
518
512
|
const t = Array.from(l.target.files ?? []);
|
|
519
513
|
if (t.length)
|
|
520
|
-
if (
|
|
521
|
-
const o = t.map((
|
|
522
|
-
r((
|
|
514
|
+
if (_.current && (_.current.value = ""), p) {
|
|
515
|
+
const o = t.map((U) => ({ file: U, url: URL.createObjectURL(U) }));
|
|
516
|
+
r((U) => [...U, ...o]);
|
|
523
517
|
} else {
|
|
524
|
-
|
|
518
|
+
E(!0);
|
|
525
519
|
try {
|
|
526
520
|
for (const o of t) {
|
|
527
|
-
const
|
|
528
|
-
await
|
|
521
|
+
const U = await u.upload(o);
|
|
522
|
+
await se(U.id);
|
|
529
523
|
}
|
|
530
524
|
g.invalidateQueries({ queryKey: ["file-browser"] });
|
|
531
525
|
} catch {
|
|
532
526
|
} finally {
|
|
533
|
-
|
|
527
|
+
E(!1);
|
|
534
528
|
}
|
|
535
529
|
}
|
|
536
530
|
}
|
|
537
531
|
return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
538
|
-
|
|
539
|
-
(F.length > 0 || x.length > 0) && /* @__PURE__ */ i("div", { ref: Z, className: "flex flex-col gap-1.5", children: [
|
|
532
|
+
(F.length > 0 || x.length > 0) && /* @__PURE__ */ i("div", { ref: J, className: "flex flex-col gap-1.5", children: [
|
|
540
533
|
F.map((l) => {
|
|
541
534
|
var o;
|
|
542
|
-
const t =
|
|
535
|
+
const t = le[l];
|
|
543
536
|
return /* @__PURE__ */ i(
|
|
544
537
|
"div",
|
|
545
538
|
{
|
|
546
539
|
className: "flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
|
|
547
540
|
children: [
|
|
548
541
|
/* @__PURE__ */ e(
|
|
549
|
-
"
|
|
542
|
+
"a",
|
|
550
543
|
{
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
onClick: ()
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
name: E(t) || l,
|
|
557
|
-
type: (t == null ? void 0 : t.type) ?? null,
|
|
558
|
-
size: (t == null ? void 0 : t.filesize) ?? null
|
|
559
|
-
}),
|
|
560
|
-
className: "shrink-0 cursor-zoom-in",
|
|
544
|
+
href: `${C(l)}?download=1`,
|
|
545
|
+
download: (t == null ? void 0 : t.filename_download) || !0,
|
|
546
|
+
onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
|
|
547
|
+
title: "Download",
|
|
548
|
+
className: "shrink-0",
|
|
561
549
|
children: /* @__PURE__ */ e(
|
|
562
|
-
|
|
550
|
+
V,
|
|
563
551
|
{
|
|
564
|
-
url:
|
|
552
|
+
url: C(l),
|
|
565
553
|
type: (t == null ? void 0 : t.type) ?? null,
|
|
566
554
|
filename: (t == null ? void 0 : t.filename_download) ?? l,
|
|
567
555
|
size: "sm"
|
|
@@ -571,32 +559,28 @@ function tt({
|
|
|
571
559
|
),
|
|
572
560
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
573
561
|
/* @__PURE__ */ e(
|
|
574
|
-
"
|
|
562
|
+
"a",
|
|
575
563
|
{
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
name: E(t) || l,
|
|
581
|
-
type: (t == null ? void 0 : t.type) ?? null,
|
|
582
|
-
size: (t == null ? void 0 : t.filesize) ?? null
|
|
583
|
-
}),
|
|
564
|
+
href: `${C(l)}?download=1`,
|
|
565
|
+
download: (t == null ? void 0 : t.filename_download) || !0,
|
|
566
|
+
onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
|
|
567
|
+
title: "Download",
|
|
584
568
|
"data-file-name": !0,
|
|
585
569
|
className: "block w-full truncate text-left text-[12px] font-medium text-slate-700 hover:underline",
|
|
586
|
-
children:
|
|
570
|
+
children: de(t) || l
|
|
587
571
|
}
|
|
588
572
|
),
|
|
589
573
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
|
|
590
574
|
(t == null ? void 0 : t.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: t.type }),
|
|
591
|
-
(t == null ? void 0 : t.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
592
|
-
(t == null ? void 0 : t.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
575
|
+
(t == null ? void 0 : t.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(t.filesize) }),
|
|
576
|
+
(t == null ? void 0 : t.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Fe(t.uploaded_on) }),
|
|
593
577
|
(t == null ? void 0 : t.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500", children: [
|
|
594
578
|
"by ",
|
|
595
579
|
t.uploaded_by_name
|
|
596
580
|
] })
|
|
597
581
|
] })
|
|
598
582
|
] }),
|
|
599
|
-
(
|
|
583
|
+
(G.verdict(l) ?? !!(t != null && t.missing_at)) && /* @__PURE__ */ e(
|
|
600
584
|
"span",
|
|
601
585
|
{
|
|
602
586
|
className: "shrink-0 self-center 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",
|
|
@@ -604,34 +588,34 @@ function tt({
|
|
|
604
588
|
children: "file missing"
|
|
605
589
|
}
|
|
606
590
|
),
|
|
607
|
-
!n &&
|
|
608
|
-
|
|
591
|
+
!n && w.includes(l) && /* @__PURE__ */ e(
|
|
592
|
+
ke,
|
|
609
593
|
{
|
|
610
594
|
fileId: l,
|
|
611
|
-
uses: (o =
|
|
612
|
-
loading:
|
|
613
|
-
collection:
|
|
595
|
+
uses: (o = W.data) == null ? void 0 : o[l],
|
|
596
|
+
loading: W.isLoading,
|
|
597
|
+
collection: j == null ? void 0 : j.collection,
|
|
614
598
|
itemId: a
|
|
615
599
|
}
|
|
616
600
|
),
|
|
617
601
|
/* @__PURE__ */ e(
|
|
618
602
|
"a",
|
|
619
603
|
{
|
|
620
|
-
href: `${
|
|
621
|
-
onClick:
|
|
604
|
+
href: `${C(l)}?download=1`,
|
|
605
|
+
onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
|
|
622
606
|
title: "Download",
|
|
623
607
|
className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
|
|
624
|
-
children: /* @__PURE__ */ e(
|
|
608
|
+
children: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" })
|
|
625
609
|
}
|
|
626
610
|
),
|
|
627
|
-
!
|
|
611
|
+
!m && /* @__PURE__ */ e(
|
|
628
612
|
"button",
|
|
629
613
|
{
|
|
630
614
|
type: "button",
|
|
631
615
|
"aria-label": "Remove file",
|
|
632
|
-
onClick: () =>
|
|
616
|
+
onClick: () => Ce(l),
|
|
633
617
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
634
|
-
children: /* @__PURE__ */ e(
|
|
618
|
+
children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
|
|
635
619
|
}
|
|
636
620
|
)
|
|
637
621
|
]
|
|
@@ -645,7 +629,7 @@ function tt({
|
|
|
645
629
|
className: "flex items-center gap-2 rounded-lg border border-amber-200 p-2 bg-amber-50/50",
|
|
646
630
|
children: [
|
|
647
631
|
/* @__PURE__ */ e(
|
|
648
|
-
|
|
632
|
+
V,
|
|
649
633
|
{
|
|
650
634
|
url: l.url,
|
|
651
635
|
type: l.file.type || null,
|
|
@@ -655,23 +639,23 @@ function tt({
|
|
|
655
639
|
),
|
|
656
640
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
657
641
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
658
|
-
/* @__PURE__ */ e(
|
|
642
|
+
/* @__PURE__ */ e(fe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
|
|
659
643
|
/* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children: l.file.name })
|
|
660
644
|
] }),
|
|
661
645
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
|
|
662
646
|
l.file.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: l.file.type }),
|
|
663
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children:
|
|
647
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(l.file.size) }),
|
|
664
648
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
|
|
665
649
|
] })
|
|
666
650
|
] }),
|
|
667
|
-
!
|
|
651
|
+
!m && /* @__PURE__ */ e(
|
|
668
652
|
"button",
|
|
669
653
|
{
|
|
670
654
|
type: "button",
|
|
671
655
|
"aria-label": "Remove file",
|
|
672
|
-
onClick: () =>
|
|
656
|
+
onClick: () => Ue(l.url),
|
|
673
657
|
className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
|
|
674
|
-
children: /* @__PURE__ */ e(
|
|
658
|
+
children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
|
|
675
659
|
}
|
|
676
660
|
)
|
|
677
661
|
]
|
|
@@ -679,51 +663,51 @@ function tt({
|
|
|
679
663
|
l.url
|
|
680
664
|
))
|
|
681
665
|
] }),
|
|
682
|
-
!
|
|
683
|
-
|
|
666
|
+
!m && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
667
|
+
k && /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
684
668
|
/* @__PURE__ */ i(
|
|
685
669
|
"button",
|
|
686
670
|
{
|
|
687
671
|
type: "button",
|
|
688
|
-
onClick: () =>
|
|
672
|
+
onClick: () => z((l) => !l),
|
|
689
673
|
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",
|
|
690
674
|
children: [
|
|
691
|
-
/* @__PURE__ */ e(
|
|
675
|
+
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
692
676
|
"Add existing…"
|
|
693
677
|
]
|
|
694
678
|
}
|
|
695
679
|
),
|
|
696
|
-
|
|
680
|
+
f && /* @__PURE__ */ e(
|
|
697
681
|
"div",
|
|
698
682
|
{
|
|
699
683
|
className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
|
|
700
684
|
style: { minWidth: 480 },
|
|
701
685
|
children: /* @__PURE__ */ e(
|
|
702
|
-
|
|
686
|
+
Re,
|
|
703
687
|
{
|
|
704
688
|
selected: F,
|
|
705
689
|
multi: !0,
|
|
706
|
-
onSelect: (l) =>
|
|
707
|
-
onClose: () =>
|
|
708
|
-
getUrl:
|
|
690
|
+
onSelect: (l) => se(l),
|
|
691
|
+
onClose: () => z(!1),
|
|
692
|
+
getUrl: C
|
|
709
693
|
}
|
|
710
694
|
)
|
|
711
695
|
}
|
|
712
696
|
)
|
|
713
697
|
] }),
|
|
714
|
-
|
|
698
|
+
y && /* @__PURE__ */ i(M, { children: [
|
|
715
699
|
/* @__PURE__ */ i(
|
|
716
700
|
"button",
|
|
717
701
|
{
|
|
718
702
|
type: "button",
|
|
719
703
|
onClick: () => {
|
|
720
704
|
var l;
|
|
721
|
-
return (l =
|
|
705
|
+
return (l = _.current) == null ? void 0 : l.click();
|
|
722
706
|
},
|
|
723
|
-
disabled:
|
|
707
|
+
disabled: D,
|
|
724
708
|
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",
|
|
725
709
|
children: [
|
|
726
|
-
|
|
710
|
+
D ? /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" }),
|
|
727
711
|
"Upload…"
|
|
728
712
|
]
|
|
729
713
|
}
|
|
@@ -731,7 +715,7 @@ function tt({
|
|
|
731
715
|
/* @__PURE__ */ e(
|
|
732
716
|
"input",
|
|
733
717
|
{
|
|
734
|
-
ref:
|
|
718
|
+
ref: _,
|
|
735
719
|
type: "file",
|
|
736
720
|
multiple: !0,
|
|
737
721
|
className: "hidden",
|
|
@@ -743,7 +727,7 @@ function tt({
|
|
|
743
727
|
] });
|
|
744
728
|
}
|
|
745
729
|
export {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
730
|
+
Ye as FileM2MField,
|
|
731
|
+
Ze as FilePickerField,
|
|
732
|
+
de as fileDisplayName
|
|
749
733
|
};
|