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