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