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