@emailmaker/filemanager 1.1.85-dev.6 → 1.1.85-dev.8
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/file-manager.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, Ct as r, F as i, G as a, H as o, L as s, M as c, N as l, O as u, P as d, Q as f, R as p, St as m, U as h, V as g, W as _, Z as v, _ as y, _t as b, a as ee, at as x, bt as S, c as C, ct as w, d as T, dt as E, et as te, f as ne, ft as re, g as D, gt as O, h as k, ht as
|
|
2
|
-
import { a as be, c as xe, i as Se, l as Ce, n as we, o as L, r as Te, s as Ee, t as De, u as Oe } from "./file-manager-urls-
|
|
1
|
+
import { $ as e, A as t, B as n, Ct as r, F as i, G as a, H as o, L as s, M as c, N as l, O as u, P as d, Q as f, R as p, St as m, U as h, V as g, W as _, Z as v, _ as y, _t as b, a as ee, at as x, bt as S, c as C, ct as w, d as T, dt as E, et as te, f as ne, ft as re, g as D, gt as O, h as k, ht as ie, i as ae, j as A, k as j, l as oe, m as se, mt as M, n as ce, o as le, p as ue, pt as N, r as P, rt as de, s as fe, t as pe, tt as me, u as F, ut as I, v as he, vt as ge, w as _e, wt as ve, z as ye } from "./file-manager-hooks-sL2VIffX.js";
|
|
2
|
+
import { a as be, c as xe, i as Se, l as Ce, n as we, o as L, r as Te, s as Ee, t as De, u as Oe } from "./file-manager-urls-DVGJqxB5.js";
|
|
3
3
|
import { n as ke, t as Ae } from "./file-manager-imageEditorTranslations-ClA7N5OU.js";
|
|
4
4
|
import * as je from "react";
|
|
5
5
|
import R, { Suspense as Me, createElement as Ne, forwardRef as Pe, memo as Fe, useCallback as z, useEffect as B, useImperativeHandle as Ie, useLayoutEffect as Le, useMemo as V, useRef as H, useState as U } from "react";
|
|
@@ -9,7 +9,29 @@ import { Fragment as pt, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
|
9
9
|
import { ArrowLeftOutlined as X, ArrowRightOutlined as mt, CheckCircleOutlined as ht, CheckOutlined as gt, CloseOutlined as _t, ExclamationCircleOutlined as vt, EyeOutlined as yt, FileImageOutlined as bt, LoadingOutlined as xt } from "@ant-design/icons";
|
|
10
10
|
import { StyleProvider as St } from "@ant-design/cssinjs";
|
|
11
11
|
import { createPortal as Ct } from "react-dom";
|
|
12
|
-
import {
|
|
12
|
+
import { Trash04 as wt } from "@untitledui/icons/Trash04";
|
|
13
|
+
import { FolderPlus as Tt } from "@untitledui/icons/FolderPlus";
|
|
14
|
+
import { ThumbsUp as Et } from "@untitledui/icons/ThumbsUp";
|
|
15
|
+
import { ChevronDown as Dt } from "@untitledui/icons/ChevronDown";
|
|
16
|
+
import { Copy04 as Ot } from "@untitledui/icons/Copy04";
|
|
17
|
+
import { Crop02 as kt } from "@untitledui/icons/Crop02";
|
|
18
|
+
import { FolderDownload as At } from "@untitledui/icons/FolderDownload";
|
|
19
|
+
import { Grid01 as jt } from "@untitledui/icons/Grid01";
|
|
20
|
+
import { List as Mt } from "@untitledui/icons/List";
|
|
21
|
+
import { Scale01 as Nt } from "@untitledui/icons/Scale01";
|
|
22
|
+
import { TextInput as Pt } from "@untitledui/icons/TextInput";
|
|
23
|
+
import { Trash03 as Ft } from "@untitledui/icons/Trash03";
|
|
24
|
+
import { SearchMd as It } from "@untitledui/icons/SearchMd";
|
|
25
|
+
import { DotsVertical as Lt } from "@untitledui/icons/DotsVertical";
|
|
26
|
+
import { Colors as Rt } from "@untitledui/icons/Colors";
|
|
27
|
+
import { Image03 as zt } from "@untitledui/icons/Image03";
|
|
28
|
+
import { Link01 as Bt } from "@untitledui/icons/Link01";
|
|
29
|
+
import { Lock01 as Vt } from "@untitledui/icons/Lock01";
|
|
30
|
+
import { PlaySquare as Ht } from "@untitledui/icons/PlaySquare";
|
|
31
|
+
import { PlusCircle as Ut } from "@untitledui/icons/PlusCircle";
|
|
32
|
+
import { QrCode02 as Wt } from "@untitledui/icons/QrCode02";
|
|
33
|
+
import { Star06 as Gt } from "@untitledui/icons/Star06";
|
|
34
|
+
import { RefreshCw05 as Kt } from "@untitledui/icons/RefreshCw05";
|
|
13
35
|
//#region packages/file-manager/src/components/CustomSpinIndicator/CustomSpinIndicator.tsx
|
|
14
36
|
var qt = () => /* @__PURE__ */ J(xt, {
|
|
15
37
|
style: {
|
|
@@ -350,7 +372,7 @@ var kn = ye(), An = ({ onSearch: e, placeholder: t, className: n }) => {
|
|
|
350
372
|
a(t), o.current?.(t);
|
|
351
373
|
},
|
|
352
374
|
placeholder: l,
|
|
353
|
-
prefix: /* @__PURE__ */ J(
|
|
375
|
+
prefix: /* @__PURE__ */ J(It, {
|
|
354
376
|
size: 16,
|
|
355
377
|
strokeWidth: c?.iconStrokeWidth
|
|
356
378
|
}),
|
|
@@ -469,7 +491,7 @@ var kn = ye(), An = ({ onSearch: e, placeholder: t, className: n }) => {
|
|
|
469
491
|
function Fn(e) {
|
|
470
492
|
if (!e || e.isFolder) return !1;
|
|
471
493
|
let t = e.extension || (e.name && e.name.includes(".") ? e.name.split(".").pop() : void 0) || (e.type?.startsWith("image/") ? e.type.split("/")[1]?.split(";")[0]?.trim() : void 0);
|
|
472
|
-
return !!(t &&
|
|
494
|
+
return !!(t && M.includes(t.toLowerCase()));
|
|
473
495
|
}
|
|
474
496
|
var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen: r, iconStrokeWidth: i, multiSelectEnabled: a = !0, features: o, viewMode: s, setViewMode: c, handleSearch: l, handleSortOptionChange: u, sortOptions: d, onClearSelection: f, onRename: p, onDelete: m, onCopy: h, onMove: g, onEdit: _, t: v }) => {
|
|
475
497
|
let y = V(() => d?.length ? jn.filter((e) => d.includes(e.value)) : jn, [d]), b = V(() => y.map((e) => e.value).join("|") || "all", [y]), ee = T((e) => e.selectedFiles), x = T((e) => e.selectedFiles.size), S = T((e) => e.selectAllVisible), C = e.length > 0 && x === e.length, w = V(() => Array.from(ee)[0], [ee]), E = V(() => w ? t.get(w) : void 0, [t, w]), te = E?.isFolder ? o?.enableRenameFolder !== !1 : o?.enableRenameFile !== !1, ne = V(() => Array.from(ee).every((e) => {
|
|
@@ -511,7 +533,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
511
533
|
title: r ? v("Deselected") : null,
|
|
512
534
|
children: /* @__PURE__ */ J(W, {
|
|
513
535
|
className: Z.buttonDeselected,
|
|
514
|
-
icon: /* @__PURE__ */ J(
|
|
536
|
+
icon: /* @__PURE__ */ J(Nt, {
|
|
515
537
|
size: 16,
|
|
516
538
|
strokeWidth: i
|
|
517
539
|
}),
|
|
@@ -524,7 +546,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
524
546
|
D && o?.enableEdit !== !1 && /* @__PURE__ */ J(q, {
|
|
525
547
|
title: r ? v("Edit") : null,
|
|
526
548
|
children: /* @__PURE__ */ J(W, {
|
|
527
|
-
icon: /* @__PURE__ */ J(
|
|
549
|
+
icon: /* @__PURE__ */ J(kt, {
|
|
528
550
|
size: 16,
|
|
529
551
|
strokeWidth: i
|
|
530
552
|
}),
|
|
@@ -536,7 +558,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
536
558
|
ne && /* @__PURE__ */ J(q, {
|
|
537
559
|
title: r ? v("Move to") : null,
|
|
538
560
|
children: /* @__PURE__ */ J(W, {
|
|
539
|
-
icon: /* @__PURE__ */ J(
|
|
561
|
+
icon: /* @__PURE__ */ J(At, {
|
|
540
562
|
size: 16,
|
|
541
563
|
strokeWidth: i
|
|
542
564
|
}),
|
|
@@ -547,7 +569,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
547
569
|
re && /* @__PURE__ */ J(q, {
|
|
548
570
|
title: r ? v("Copy") : null,
|
|
549
571
|
children: /* @__PURE__ */ J(W, {
|
|
550
|
-
icon: /* @__PURE__ */ J(
|
|
572
|
+
icon: /* @__PURE__ */ J(Ot, {
|
|
551
573
|
size: 16,
|
|
552
574
|
strokeWidth: i
|
|
553
575
|
}),
|
|
@@ -558,7 +580,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
558
580
|
x === 1 && te && /* @__PURE__ */ J(q, {
|
|
559
581
|
title: r ? v("Rename") : null,
|
|
560
582
|
children: /* @__PURE__ */ J(W, {
|
|
561
|
-
icon: /* @__PURE__ */ J(
|
|
583
|
+
icon: /* @__PURE__ */ J(Pt, {
|
|
562
584
|
size: 16,
|
|
563
585
|
strokeWidth: i
|
|
564
586
|
}),
|
|
@@ -571,7 +593,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
571
593
|
title: r ? v("Delete") : null,
|
|
572
594
|
children: /* @__PURE__ */ J(W, {
|
|
573
595
|
danger: !0,
|
|
574
|
-
icon: /* @__PURE__ */ J(
|
|
596
|
+
icon: /* @__PURE__ */ J(Ft, {
|
|
575
597
|
size: 16,
|
|
576
598
|
strokeWidth: i
|
|
577
599
|
}),
|
|
@@ -600,7 +622,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
600
622
|
onChange: u,
|
|
601
623
|
className: Z.sortSelect,
|
|
602
624
|
popupMatchSelectWidth: !1,
|
|
603
|
-
suffixIcon: /* @__PURE__ */ J(
|
|
625
|
+
suffixIcon: /* @__PURE__ */ J(Dt, {
|
|
604
626
|
size: 16,
|
|
605
627
|
strokeWidth: i
|
|
606
628
|
}),
|
|
@@ -620,7 +642,7 @@ var In = R.memo(({ files: e, filesById: t, currentSortOption: n, isSmallScreen:
|
|
|
620
642
|
})
|
|
621
643
|
}, {
|
|
622
644
|
value: "table",
|
|
623
|
-
icon: /* @__PURE__ */ J(
|
|
645
|
+
icon: /* @__PURE__ */ J(Mt, {
|
|
624
646
|
size: 20,
|
|
625
647
|
strokeWidth: i
|
|
626
648
|
})
|
|
@@ -674,35 +696,35 @@ var zn = R.memo(({ item: e, variant: t = "table", t: n, iconStrokeWidth: r, setC
|
|
|
674
696
|
return e.canEdit && t.push({
|
|
675
697
|
key: "edit",
|
|
676
698
|
label: n("Edit"),
|
|
677
|
-
icon: /* @__PURE__ */ J(
|
|
699
|
+
icon: /* @__PURE__ */ J(kt, {
|
|
678
700
|
size: 16,
|
|
679
701
|
strokeWidth: r
|
|
680
702
|
})
|
|
681
703
|
}), e.canMove && t.push({
|
|
682
704
|
key: "move",
|
|
683
705
|
label: n("Move to"),
|
|
684
|
-
icon: /* @__PURE__ */ J(
|
|
706
|
+
icon: /* @__PURE__ */ J(At, {
|
|
685
707
|
size: 16,
|
|
686
708
|
strokeWidth: r
|
|
687
709
|
})
|
|
688
710
|
}), e.canCopy && t.push({
|
|
689
711
|
key: "copy",
|
|
690
712
|
label: n("Copy"),
|
|
691
|
-
icon: /* @__PURE__ */ J(
|
|
713
|
+
icon: /* @__PURE__ */ J(Ot, {
|
|
692
714
|
size: 16,
|
|
693
715
|
strokeWidth: r
|
|
694
716
|
})
|
|
695
717
|
}), e.canRename && t.push({
|
|
696
718
|
key: "rename",
|
|
697
719
|
label: n("Rename"),
|
|
698
|
-
icon: /* @__PURE__ */ J(
|
|
720
|
+
icon: /* @__PURE__ */ J(Pt, {
|
|
699
721
|
size: 16,
|
|
700
722
|
strokeWidth: r
|
|
701
723
|
})
|
|
702
724
|
}), e.canDelete && t.push({
|
|
703
725
|
key: "delete",
|
|
704
726
|
label: n("Delete"),
|
|
705
|
-
icon: /* @__PURE__ */ J(
|
|
727
|
+
icon: /* @__PURE__ */ J(Ft, {
|
|
706
728
|
size: 16,
|
|
707
729
|
strokeWidth: r
|
|
708
730
|
}),
|
|
@@ -760,7 +782,7 @@ var zn = R.memo(({ item: e, variant: t = "table", t: n, iconStrokeWidth: r, setC
|
|
|
760
782
|
onClick: (e) => {
|
|
761
783
|
e.stopPropagation(), e.preventDefault();
|
|
762
784
|
},
|
|
763
|
-
children: /* @__PURE__ */ J(
|
|
785
|
+
children: /* @__PURE__ */ J(Lt, {
|
|
764
786
|
size: 16,
|
|
765
787
|
strokeWidth: r
|
|
766
788
|
})
|
|
@@ -769,7 +791,7 @@ var zn = R.memo(({ item: e, variant: t = "table", t: n, iconStrokeWidth: r, setC
|
|
|
769
791
|
onClick: (e) => {
|
|
770
792
|
e.stopPropagation(), e.preventDefault();
|
|
771
793
|
},
|
|
772
|
-
children: /* @__PURE__ */ J(
|
|
794
|
+
children: /* @__PURE__ */ J(Lt, {
|
|
773
795
|
size: 16,
|
|
774
796
|
strokeWidth: r
|
|
775
797
|
})
|
|
@@ -788,7 +810,7 @@ var Bn = ({ thumbnailSrc: e, previewSrc: t, lightboxSrc: n, alt: r, className: i
|
|
|
788
810
|
n,
|
|
789
811
|
t,
|
|
790
812
|
e
|
|
791
|
-
]), u =
|
|
813
|
+
]), u = ae(c), d = ae(l), { handleError: f, handleLoad: p } = d, m = u.src ?? "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+", h = d.src ?? u.src, g = H(!1);
|
|
792
814
|
B(() => {
|
|
793
815
|
g.current = !1;
|
|
794
816
|
}, [h]);
|
|
@@ -875,7 +897,7 @@ var Hn = [
|
|
|
875
897
|
function Wn(e) {
|
|
876
898
|
if (e.isFolder) return !1;
|
|
877
899
|
let t = typeof e.name == "string" ? e.name : "", n = t ? t.split(".").pop()?.toLowerCase() : void 0, r = e.extension?.toLowerCase() ?? n;
|
|
878
|
-
return typeof e.type == "string" && e.type.startsWith("image/") || typeof r == "string" &&
|
|
900
|
+
return typeof e.type == "string" && e.type.startsWith("image/") || typeof r == "string" && ie.includes(r);
|
|
879
901
|
}
|
|
880
902
|
//#endregion
|
|
881
903
|
//#region packages/file-manager/src/components/FileContent/presentation/FileGridItem.tsx
|
|
@@ -1131,11 +1153,11 @@ function rr(e) {
|
|
|
1131
1153
|
}
|
|
1132
1154
|
function ir(e) {
|
|
1133
1155
|
let t = rr(e);
|
|
1134
|
-
return !!(t &&
|
|
1156
|
+
return !!(t && ie.includes(t));
|
|
1135
1157
|
}
|
|
1136
1158
|
function ar(e) {
|
|
1137
1159
|
let t = rr(e);
|
|
1138
|
-
return !!(t &&
|
|
1160
|
+
return !!(t && M.includes(t));
|
|
1139
1161
|
}
|
|
1140
1162
|
function or(e, t) {
|
|
1141
1163
|
if (t.previewFallbackToFileUrl !== !1) return e.url && ir(e) ? e.url : void 0;
|
|
@@ -1280,7 +1302,7 @@ function gr({ files: e, folderFileCounts: t, features: n, t: r, viewMode: i, pre
|
|
|
1280
1302
|
//#endregion
|
|
1281
1303
|
//#region packages/file-manager/src/components/FileContent/FileContent.tsx
|
|
1282
1304
|
var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrder: i, handleSortOptionChange: a, pagination: o, setPagination: c, loading: l, handleItemClick: u, onClearSelection: d, onRename: f, onDelete: p, onCopy: m, onMove: h, showRenameModal: _, showDeleteConfirm: y, showCopyModal: b, showMoveModal: ee, onEdit: x, getFileData: C, handleAddFile: w }) => {
|
|
1283
|
-
let { t: T } = v(), E = s(), { DropZoneFileIcon: te, BigStockIcon: ne, BigAIIcon: re, FolderIcon: D } = Oe(), { options: O, actions: k, state:
|
|
1305
|
+
let { t: T } = v(), E = s(), { DropZoneFileIcon: te, BigStockIcon: ne, BigAIIcon: re, FolderIcon: D } = Oe(), { options: O, actions: k, state: ie } = g(), { dataProviders: ae, config: A } = O, j = A?.disablePagination, { setCurrentMenuFile: oe, setActiveLibraryItem: se } = k, M = ie?.selectedFolder === "Trash", le = ie?.multiSelect !== !1, { viewMode: ue, setViewMode: N } = Zn(), [de, fe] = U({}), [pe, me] = U(!1), F = H(0), I = H(null);
|
|
1284
1306
|
B(() => {
|
|
1285
1307
|
let e = window.matchMedia("(max-width: 1199px)"), t = (e) => {
|
|
1286
1308
|
me(e.matches);
|
|
@@ -1289,7 +1311,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1289
1311
|
let n = (e) => t(e);
|
|
1290
1312
|
return typeof e.addEventListener == "function" ? (e.addEventListener("change", n), () => e.removeEventListener("change", n)) : (e.addListener(n), () => e.removeListener(n));
|
|
1291
1313
|
}, []);
|
|
1292
|
-
let ge = V(() =>
|
|
1314
|
+
let ge = V(() => A?.features || {}, [A?.features]), _e = A?.iconStrokeWidth, ve = A?.sortOptions, ye = V(() => ve?.length ? new Set(ve) : null, [ve]), be = `${r}-${i}`;
|
|
1293
1315
|
B(() => {
|
|
1294
1316
|
if (ye && !ye.has(be)) {
|
|
1295
1317
|
let e = jn.find((e) => ye.has(e.value))?.value;
|
|
@@ -1305,19 +1327,19 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1305
1327
|
folderFileCounts: de,
|
|
1306
1328
|
features: ge,
|
|
1307
1329
|
t: T,
|
|
1308
|
-
viewMode:
|
|
1309
|
-
previewFallbackToFileUrl:
|
|
1330
|
+
viewMode: ue,
|
|
1331
|
+
previewFallbackToFileUrl: A?.previewFallbackToFileUrl
|
|
1310
1332
|
}), Ee = z(async (e) => {
|
|
1311
1333
|
try {
|
|
1312
|
-
if (
|
|
1313
|
-
if (
|
|
1314
|
-
let { files: t, pagination: n } = await
|
|
1334
|
+
if (ae?.getChildrenCount) return await ae.getChildrenCount(e === "folders" ? void 0 : e);
|
|
1335
|
+
if (ae?.getFiles) {
|
|
1336
|
+
let { files: t, pagination: n } = await ae.getFiles({
|
|
1315
1337
|
folderId: e === "folders" ? void 0 : e,
|
|
1316
1338
|
itemType: "all",
|
|
1317
|
-
page:
|
|
1318
|
-
limit:
|
|
1339
|
+
page: j ? void 0 : 1,
|
|
1340
|
+
limit: j ? void 0 : 1
|
|
1319
1341
|
});
|
|
1320
|
-
return
|
|
1342
|
+
return j ? Array.isArray(t) ? t.length : 0 : n?.total ?? (Array.isArray(t) ? t.length : 0);
|
|
1321
1343
|
}
|
|
1322
1344
|
return 0;
|
|
1323
1345
|
} catch (t) {
|
|
@@ -1327,9 +1349,9 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1327
1349
|
console.error(`Error getting the number of files for the folder ${e}:`, t);
|
|
1328
1350
|
let r = await he({
|
|
1329
1351
|
folderId: e,
|
|
1330
|
-
dataProviders:
|
|
1331
|
-
folders: Array.isArray(
|
|
1332
|
-
pathHistory:
|
|
1352
|
+
dataProviders: ae,
|
|
1353
|
+
folders: Array.isArray(ie.folders) ? ie.folders : [],
|
|
1354
|
+
pathHistory: ie.pathHistory,
|
|
1333
1355
|
t: T
|
|
1334
1356
|
});
|
|
1335
1357
|
return E.error({
|
|
@@ -1346,11 +1368,11 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1346
1368
|
}), null;
|
|
1347
1369
|
}
|
|
1348
1370
|
}, [
|
|
1349
|
-
|
|
1350
|
-
|
|
1371
|
+
ae,
|
|
1372
|
+
j,
|
|
1351
1373
|
E,
|
|
1352
|
-
|
|
1353
|
-
|
|
1374
|
+
ie.folders,
|
|
1375
|
+
ie.pathHistory,
|
|
1354
1376
|
T
|
|
1355
1377
|
]), De = z(async () => {
|
|
1356
1378
|
let t = F.current + 1;
|
|
@@ -1375,22 +1397,22 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1375
1397
|
B(() => {
|
|
1376
1398
|
De();
|
|
1377
1399
|
}, [De]), B(() => {
|
|
1378
|
-
I.current && Te(
|
|
1400
|
+
I.current && Te(ce(I.current));
|
|
1379
1401
|
}, [
|
|
1380
1402
|
e.length,
|
|
1381
1403
|
Te,
|
|
1382
|
-
|
|
1404
|
+
ue
|
|
1383
1405
|
]), B(() => {
|
|
1384
1406
|
if (!I.current || typeof ResizeObserver > "u") return;
|
|
1385
1407
|
let e = I.current, t = new ResizeObserver(() => {
|
|
1386
|
-
Te(
|
|
1408
|
+
Te(ce(e));
|
|
1387
1409
|
});
|
|
1388
1410
|
return t.observe(e), () => {
|
|
1389
1411
|
t.disconnect();
|
|
1390
1412
|
};
|
|
1391
1413
|
}, [Te]);
|
|
1392
1414
|
let ke = z((e) => {
|
|
1393
|
-
let t =
|
|
1415
|
+
let t = ce(e);
|
|
1394
1416
|
Te(t);
|
|
1395
1417
|
}, [Te]);
|
|
1396
1418
|
B(() => {
|
|
@@ -1409,10 +1431,10 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1409
1431
|
}, [
|
|
1410
1432
|
e.length,
|
|
1411
1433
|
ke,
|
|
1412
|
-
|
|
1434
|
+
ue
|
|
1413
1435
|
]);
|
|
1414
1436
|
let Ae = z((e, t) => e !== t, []), je = V(() => [
|
|
1415
|
-
...
|
|
1437
|
+
...le ? [{
|
|
1416
1438
|
key: "selection",
|
|
1417
1439
|
width: 46,
|
|
1418
1440
|
shouldCellUpdate: Ae,
|
|
@@ -1491,7 +1513,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1491
1513
|
variant: "table",
|
|
1492
1514
|
t: T,
|
|
1493
1515
|
iconStrokeWidth: _e,
|
|
1494
|
-
setCurrentMenuFile:
|
|
1516
|
+
setCurrentMenuFile: oe,
|
|
1495
1517
|
showMoveModal: ee,
|
|
1496
1518
|
showCopyModal: b,
|
|
1497
1519
|
showRenameModal: _,
|
|
@@ -1504,9 +1526,9 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1504
1526
|
C,
|
|
1505
1527
|
L,
|
|
1506
1528
|
_e,
|
|
1507
|
-
|
|
1529
|
+
le,
|
|
1508
1530
|
x,
|
|
1509
|
-
|
|
1531
|
+
oe,
|
|
1510
1532
|
Ae,
|
|
1511
1533
|
b,
|
|
1512
1534
|
y,
|
|
@@ -1523,7 +1545,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1523
1545
|
}
|
|
1524
1546
|
O.onEditorOk && Wn(e.file) && O.onEditorOk(e.file);
|
|
1525
1547
|
}
|
|
1526
|
-
} }), [u, O]), Ne =
|
|
1548
|
+
} }), [u, O]), Ne = ue === "table" ? /* @__PURE__ */ J(qn, {
|
|
1527
1549
|
rows: Se,
|
|
1528
1550
|
columns: je,
|
|
1529
1551
|
topOffset: we.topOffset,
|
|
@@ -1538,7 +1560,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1538
1560
|
iconStrokeWidth: _e,
|
|
1539
1561
|
FolderIcon: D,
|
|
1540
1562
|
handleItemClick: u,
|
|
1541
|
-
setCurrentMenuFile:
|
|
1563
|
+
setCurrentMenuFile: oe,
|
|
1542
1564
|
showMoveModal: ee,
|
|
1543
1565
|
showCopyModal: b,
|
|
1544
1566
|
showRenameModal: _,
|
|
@@ -1546,13 +1568,13 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1546
1568
|
onEdit: x,
|
|
1547
1569
|
onEditorOk: O.onEditorOk,
|
|
1548
1570
|
getFileData: C,
|
|
1549
|
-
showSelectionCheckbox:
|
|
1571
|
+
showSelectionCheckbox: le
|
|
1550
1572
|
});
|
|
1551
1573
|
t && !e.length && (Ne = /* @__PURE__ */ J(Ce, {}));
|
|
1552
|
-
let Pe =
|
|
1574
|
+
let Pe = A?.availableImageExtensions?.map((e) => "." + e).join(", "), Fe = M ? /* @__PURE__ */ Y("div", {
|
|
1553
1575
|
className: `${Z.noFiles} ant-layout-sider-light`,
|
|
1554
1576
|
children: [
|
|
1555
|
-
/* @__PURE__ */ J(
|
|
1577
|
+
/* @__PURE__ */ J(wt, {
|
|
1556
1578
|
size: 48,
|
|
1557
1579
|
className: Z.noFilesIcon
|
|
1558
1580
|
}),
|
|
@@ -1589,7 +1611,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1589
1611
|
children: [/* @__PURE__ */ Y("button", {
|
|
1590
1612
|
className: Z.btnPhoto,
|
|
1591
1613
|
onClick: () => {
|
|
1592
|
-
|
|
1614
|
+
se && se(S);
|
|
1593
1615
|
},
|
|
1594
1616
|
children: [/* @__PURE__ */ J("div", {
|
|
1595
1617
|
className: Z.icon,
|
|
@@ -1607,7 +1629,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1607
1629
|
}), /* @__PURE__ */ Y("button", {
|
|
1608
1630
|
className: Z.btnAi,
|
|
1609
1631
|
onClick: () => {
|
|
1610
|
-
|
|
1632
|
+
se && se("ai");
|
|
1611
1633
|
},
|
|
1612
1634
|
children: [/* @__PURE__ */ J("div", {
|
|
1613
1635
|
className: Z.icon,
|
|
@@ -1639,10 +1661,10 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1639
1661
|
currentSortOption: be,
|
|
1640
1662
|
isSmallScreen: pe,
|
|
1641
1663
|
iconStrokeWidth: _e,
|
|
1642
|
-
multiSelectEnabled:
|
|
1664
|
+
multiSelectEnabled: le,
|
|
1643
1665
|
features: ge,
|
|
1644
|
-
viewMode:
|
|
1645
|
-
setViewMode:
|
|
1666
|
+
viewMode: ue,
|
|
1667
|
+
setViewMode: N,
|
|
1646
1668
|
handleSearch: n,
|
|
1647
1669
|
handleSortOptionChange: a,
|
|
1648
1670
|
sortOptions: ve,
|
|
@@ -1664,7 +1686,7 @@ var _r = R.memo(({ files: e, searchTerm: t, handleSearch: n, sortBy: r, sortOrde
|
|
|
1664
1686
|
children: /* @__PURE__ */ J(ct, { size: "large" })
|
|
1665
1687
|
}) : null]
|
|
1666
1688
|
}),
|
|
1667
|
-
!
|
|
1689
|
+
!j && o.total > o.pageSize && /* @__PURE__ */ J("div", {
|
|
1668
1690
|
className: Z.paginationContainer,
|
|
1669
1691
|
children: /* @__PURE__ */ J(tt, {
|
|
1670
1692
|
current: o.current,
|
|
@@ -1719,14 +1741,14 @@ var vr = Fe(({ folderId: e, activeFormField: t, EmptyFolderIcon: n, targetForm:
|
|
|
1719
1741
|
});
|
|
1720
1742
|
});
|
|
1721
1743
|
vr.displayName = "CustomFolderInput";
|
|
1722
|
-
var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r, selectedFolder: i, folders: a, isUrlModalVisible: o, setIsUrlModalVisible: s, handleAddFileByUrl: c, urlForm: l, isRenameModalVisible: d, handleRenameOk: f, handleRenameCancel: p, renameForm: m, fileToRename: h, files: _, isMoveModalVisible: y, handleMoveOk: b, handleMoveCancel: ee, moveForm: x, selectedFiles: S, isRenameFolderModalVisible: C, handleRenameFolderOk: w, handleRenameFolderCancel: T, renameFolderForm: E, folderToRename: te, isCopyModalVisible: ne, handleCopyOk: re, handleCopyCancel: D, copyForm: O, isDeleteConfirmVisible: k, handleDeleteConfirmOk:
|
|
1723
|
-
let { t:
|
|
1744
|
+
var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r, selectedFolder: i, folders: a, isUrlModalVisible: o, setIsUrlModalVisible: s, handleAddFileByUrl: c, urlForm: l, isRenameModalVisible: d, handleRenameOk: f, handleRenameCancel: p, renameForm: m, fileToRename: h, files: _, isMoveModalVisible: y, handleMoveOk: b, handleMoveCancel: ee, moveForm: x, selectedFiles: S, isRenameFolderModalVisible: C, handleRenameFolderOk: w, handleRenameFolderCancel: T, renameFolderForm: E, folderToRename: te, isCopyModalVisible: ne, handleCopyOk: re, handleCopyCancel: D, copyForm: O, isDeleteConfirmVisible: k, handleDeleteConfirmOk: ie, handleDeleteConfirmCancel: ae, isClearTrashConfirmVisible: A, handleClearTrashConfirm: j, handleClearTrashCancel: oe, fetchChildFolders: se }) => {
|
|
1745
|
+
let { t: M } = v(), { state: ce, actions: le, options: ue } = g(), { setCurrentMenuFile: N } = le, { config: P, getModalContainer: de } = ue, { currentMenuFile: fe } = ce, pe = K.useWatch("folderName", r), { EmptyFolderIcon: me } = Oe(), [F, I] = U(!1), he = V(() => P?.defaultFolderName?.trim() || M("New folder"), [P?.defaultFolderName, M]), ge = !pe || String(pe).trim().length === 0, _e = V(() => Array.isArray(_) ? _ : [], [_]), ve = h ? _e.find((e) => e.id === h)?.name : "", ye = Array.isArray(a) ? a : [], xe = te ? ye.find((e) => e.id === te)?.name : "", { activeFormField: Se, setActiveFormField: Ce, generateMenuItemsFromFolders: we } = be({
|
|
1724
1746
|
folders: ye,
|
|
1725
1747
|
selectedFolder: i,
|
|
1726
1748
|
EmptyFolderIcon: me,
|
|
1727
1749
|
handleCreateFolderModalOk: t,
|
|
1728
1750
|
setIsLoading: (e) => I(!!e),
|
|
1729
|
-
t:
|
|
1751
|
+
t: M
|
|
1730
1752
|
});
|
|
1731
1753
|
B(() => {
|
|
1732
1754
|
if (k) {
|
|
@@ -1782,13 +1804,13 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1782
1804
|
/* @__PURE__ */ J(et, {
|
|
1783
1805
|
title: /* @__PURE__ */ J("div", {
|
|
1784
1806
|
className: "modal-title",
|
|
1785
|
-
children:
|
|
1807
|
+
children: M("Creating a new folder")
|
|
1786
1808
|
}),
|
|
1787
1809
|
open: e,
|
|
1788
1810
|
onOk: () => t(),
|
|
1789
1811
|
onCancel: n,
|
|
1790
|
-
okText:
|
|
1791
|
-
cancelText:
|
|
1812
|
+
okText: M("Create"),
|
|
1813
|
+
cancelText: M("Cancel"),
|
|
1792
1814
|
okButtonProps: {
|
|
1793
1815
|
disabled: ge,
|
|
1794
1816
|
loading: F
|
|
@@ -1804,11 +1826,11 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1804
1826
|
name: "folderName",
|
|
1805
1827
|
label: /* @__PURE__ */ J("div", {
|
|
1806
1828
|
className: "form-label",
|
|
1807
|
-
children:
|
|
1829
|
+
children: M("Folder name")
|
|
1808
1830
|
}),
|
|
1809
1831
|
rules: [{
|
|
1810
1832
|
required: !0,
|
|
1811
|
-
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(
|
|
1833
|
+
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(M("Enter the name of the folder"))) : Promise.resolve()
|
|
1812
1834
|
}],
|
|
1813
1835
|
initialValue: he,
|
|
1814
1836
|
className: "form-item",
|
|
@@ -1817,7 +1839,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1817
1839
|
autoFocus: !0,
|
|
1818
1840
|
className: "form-input",
|
|
1819
1841
|
disabled: F,
|
|
1820
|
-
placeholder:
|
|
1842
|
+
placeholder: M("Enter the name"),
|
|
1821
1843
|
onPressEnter: async () => {
|
|
1822
1844
|
I(!0);
|
|
1823
1845
|
try {
|
|
@@ -1830,21 +1852,21 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1830
1852
|
}), /* @__PURE__ */ J("div", { children: i && i !== "folders" ? /* @__PURE__ */ Y("p", {
|
|
1831
1853
|
className: "fm-note",
|
|
1832
1854
|
children: [
|
|
1833
|
-
|
|
1855
|
+
M("A folder will be created inside:"),
|
|
1834
1856
|
" ",
|
|
1835
|
-
ye.find((e) => e.id === i)?.name ||
|
|
1857
|
+
ye.find((e) => e.id === i)?.name || M("selected folder"),
|
|
1836
1858
|
"."
|
|
1837
1859
|
]
|
|
1838
1860
|
}) : /* @__PURE__ */ J("p", {
|
|
1839
1861
|
className: "fm-note",
|
|
1840
|
-
children:
|
|
1862
|
+
children: M("The folder will be created in the root directory.")
|
|
1841
1863
|
}) })]
|
|
1842
1864
|
})
|
|
1843
1865
|
}),
|
|
1844
1866
|
/* @__PURE__ */ J(et, {
|
|
1845
1867
|
title: /* @__PURE__ */ J("div", {
|
|
1846
1868
|
className: "modal-title",
|
|
1847
|
-
children:
|
|
1869
|
+
children: M("Upload file by URL")
|
|
1848
1870
|
}),
|
|
1849
1871
|
open: o,
|
|
1850
1872
|
onOk: async () => {
|
|
@@ -1857,9 +1879,9 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1857
1879
|
}
|
|
1858
1880
|
},
|
|
1859
1881
|
onCancel: () => s(!1),
|
|
1860
|
-
okText:
|
|
1882
|
+
okText: M("Download"),
|
|
1861
1883
|
okButtonProps: { loading: F },
|
|
1862
|
-
cancelText:
|
|
1884
|
+
cancelText: M("Cancel"),
|
|
1863
1885
|
cancelButtonProps: { disabled: F },
|
|
1864
1886
|
afterClose: () => I(!1),
|
|
1865
1887
|
centered: !0,
|
|
@@ -1871,17 +1893,17 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1871
1893
|
name: "fileUrl",
|
|
1872
1894
|
label: /* @__PURE__ */ J("div", {
|
|
1873
1895
|
className: "form-label",
|
|
1874
|
-
children:
|
|
1896
|
+
children: M("File URL")
|
|
1875
1897
|
}),
|
|
1876
1898
|
rules: [{
|
|
1877
1899
|
required: !0,
|
|
1878
|
-
message:
|
|
1900
|
+
message: M("Enter the URL of the image")
|
|
1879
1901
|
}, { validator: (e, t) => {
|
|
1880
1902
|
if (!t || !String(t).trim()) return Promise.resolve();
|
|
1881
1903
|
try {
|
|
1882
|
-
return u(String(t),
|
|
1904
|
+
return u(String(t), M), Promise.resolve();
|
|
1883
1905
|
} catch (e) {
|
|
1884
|
-
return Promise.reject(Error(e instanceof Error ? e.message :
|
|
1906
|
+
return Promise.reject(Error(e instanceof Error ? e.message : M("The specified URL is not valid.")));
|
|
1885
1907
|
}
|
|
1886
1908
|
} }],
|
|
1887
1909
|
validateTrigger: "onBlur",
|
|
@@ -1907,17 +1929,17 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1907
1929
|
/* @__PURE__ */ J(et, {
|
|
1908
1930
|
title: /* @__PURE__ */ J("div", {
|
|
1909
1931
|
className: "modal-title",
|
|
1910
|
-
children: Te ? `${
|
|
1932
|
+
children: Te ? `${M("Rename folder")} ${ve}` : M("Rename file", { currentFileName: ve })
|
|
1911
1933
|
}),
|
|
1912
1934
|
open: d,
|
|
1913
1935
|
onOk: f,
|
|
1914
|
-
okText:
|
|
1936
|
+
okText: M("Rename"),
|
|
1915
1937
|
okButtonProps: { loading: F },
|
|
1916
1938
|
onCancel: p,
|
|
1917
|
-
cancelText:
|
|
1939
|
+
cancelText: M("Cancel"),
|
|
1918
1940
|
cancelButtonProps: { disabled: F },
|
|
1919
1941
|
afterClose: () => {
|
|
1920
|
-
I(!1),
|
|
1942
|
+
I(!1), N && N("");
|
|
1921
1943
|
},
|
|
1922
1944
|
centered: !0,
|
|
1923
1945
|
getContainer: de,
|
|
@@ -1928,11 +1950,11 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1928
1950
|
name: "newFileName",
|
|
1929
1951
|
label: /* @__PURE__ */ J("div", {
|
|
1930
1952
|
className: "form-label",
|
|
1931
|
-
children:
|
|
1953
|
+
children: M(Te ? "New folder name" : "New file name")
|
|
1932
1954
|
}),
|
|
1933
1955
|
rules: [{
|
|
1934
1956
|
required: !0,
|
|
1935
|
-
message:
|
|
1957
|
+
message: M(Te ? "Enter a new folder name" : "Enter a new file name")
|
|
1936
1958
|
}],
|
|
1937
1959
|
className: "form-item",
|
|
1938
1960
|
children: /* @__PURE__ */ J(Xe, {
|
|
@@ -1954,7 +1976,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1954
1976
|
/* @__PURE__ */ J(et, {
|
|
1955
1977
|
title: /* @__PURE__ */ J("div", {
|
|
1956
1978
|
className: "modal-title",
|
|
1957
|
-
children:
|
|
1979
|
+
children: M("Move to")
|
|
1958
1980
|
}),
|
|
1959
1981
|
open: y,
|
|
1960
1982
|
onCancel: ee,
|
|
@@ -1970,20 +1992,20 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
1970
1992
|
});
|
|
1971
1993
|
},
|
|
1972
1994
|
loading: F,
|
|
1973
|
-
children: [/* @__PURE__ */ J(
|
|
1995
|
+
children: [/* @__PURE__ */ J(Tt, {
|
|
1974
1996
|
size: 18,
|
|
1975
1997
|
strokeWidth: P?.iconStrokeWidth
|
|
1976
|
-
}),
|
|
1998
|
+
}), M("Create folder")]
|
|
1977
1999
|
}), /* @__PURE__ */ J(W, {
|
|
1978
2000
|
type: "primary",
|
|
1979
2001
|
className: L.folderButton,
|
|
1980
2002
|
onClick: ee,
|
|
1981
2003
|
loading: F,
|
|
1982
|
-
children:
|
|
2004
|
+
children: M("Done")
|
|
1983
2005
|
})]
|
|
1984
2006
|
}),
|
|
1985
2007
|
afterClose: () => {
|
|
1986
|
-
|
|
2008
|
+
N && N(""), Ce(""), I(!1);
|
|
1987
2009
|
},
|
|
1988
2010
|
loading: F,
|
|
1989
2011
|
centered: !0,
|
|
@@ -2008,7 +2030,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2008
2030
|
name: "targetFolder",
|
|
2009
2031
|
rules: [{
|
|
2010
2032
|
required: !0,
|
|
2011
|
-
message:
|
|
2033
|
+
message: M("Select the destination folder")
|
|
2012
2034
|
}],
|
|
2013
2035
|
className: L.formItem,
|
|
2014
2036
|
children: /* @__PURE__ */ J(Ee, {
|
|
@@ -2017,9 +2039,9 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2017
2039
|
targetForm: x,
|
|
2018
2040
|
onTreeSelect: De,
|
|
2019
2041
|
onComplete: je,
|
|
2020
|
-
actionButtonText:
|
|
2042
|
+
actionButtonText: M("Move here")
|
|
2021
2043
|
}),
|
|
2022
|
-
fetchChildFolders:
|
|
2044
|
+
fetchChildFolders: se,
|
|
2023
2045
|
disabledFolders: Me,
|
|
2024
2046
|
mode: "selection",
|
|
2025
2047
|
className: "folderSelectionTree",
|
|
@@ -2031,7 +2053,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2031
2053
|
style: { display: "none" },
|
|
2032
2054
|
rules: [{
|
|
2033
2055
|
required: !0,
|
|
2034
|
-
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(
|
|
2056
|
+
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(M("Enter the name of the folder"))) : Promise.resolve()
|
|
2035
2057
|
}],
|
|
2036
2058
|
children: /* @__PURE__ */ J(Xe, {})
|
|
2037
2059
|
}),
|
|
@@ -2048,7 +2070,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2048
2070
|
/* @__PURE__ */ J(et, {
|
|
2049
2071
|
title: /* @__PURE__ */ J("div", {
|
|
2050
2072
|
className: "modal-title",
|
|
2051
|
-
children:
|
|
2073
|
+
children: M("Copy to folder")
|
|
2052
2074
|
}),
|
|
2053
2075
|
open: ne,
|
|
2054
2076
|
onCancel: D,
|
|
@@ -2064,20 +2086,20 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2064
2086
|
});
|
|
2065
2087
|
},
|
|
2066
2088
|
loading: F,
|
|
2067
|
-
children: [/* @__PURE__ */ J(
|
|
2089
|
+
children: [/* @__PURE__ */ J(Tt, {
|
|
2068
2090
|
size: 18,
|
|
2069
2091
|
strokeWidth: P?.iconStrokeWidth
|
|
2070
|
-
}),
|
|
2092
|
+
}), M("Create folder")]
|
|
2071
2093
|
}), /* @__PURE__ */ J(W, {
|
|
2072
2094
|
type: "primary",
|
|
2073
2095
|
className: L.folderButton,
|
|
2074
2096
|
onClick: D,
|
|
2075
2097
|
loading: F,
|
|
2076
|
-
children:
|
|
2098
|
+
children: M("Done")
|
|
2077
2099
|
})]
|
|
2078
2100
|
}),
|
|
2079
2101
|
afterClose: () => {
|
|
2080
|
-
|
|
2102
|
+
N && N(""), Ce(""), I(!1);
|
|
2081
2103
|
},
|
|
2082
2104
|
loading: F,
|
|
2083
2105
|
centered: !0,
|
|
@@ -2102,7 +2124,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2102
2124
|
name: "targetFolder",
|
|
2103
2125
|
rules: [{
|
|
2104
2126
|
required: !0,
|
|
2105
|
-
message:
|
|
2127
|
+
message: M("Select the destination folder")
|
|
2106
2128
|
}],
|
|
2107
2129
|
className: L.formItem,
|
|
2108
2130
|
children: /* @__PURE__ */ J(Ee, {
|
|
@@ -2111,9 +2133,9 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2111
2133
|
targetForm: O,
|
|
2112
2134
|
onTreeSelect: Ae,
|
|
2113
2135
|
onComplete: R,
|
|
2114
|
-
actionButtonText:
|
|
2136
|
+
actionButtonText: M("Copy here")
|
|
2115
2137
|
}),
|
|
2116
|
-
fetchChildFolders:
|
|
2138
|
+
fetchChildFolders: se,
|
|
2117
2139
|
disabledFolders: Me,
|
|
2118
2140
|
mode: "selection",
|
|
2119
2141
|
className: "folderSelectionTree",
|
|
@@ -2125,7 +2147,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2125
2147
|
style: { display: "none" },
|
|
2126
2148
|
rules: [{
|
|
2127
2149
|
required: !0,
|
|
2128
|
-
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(
|
|
2150
|
+
validator: (e, t) => typeof t == "string" && t.trim().length === 0 ? Promise.reject(Error(M("Enter the name of the folder"))) : Promise.resolve()
|
|
2129
2151
|
}],
|
|
2130
2152
|
children: /* @__PURE__ */ J(Xe, {})
|
|
2131
2153
|
}),
|
|
@@ -2143,7 +2165,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2143
2165
|
title: /* @__PURE__ */ Y("div", {
|
|
2144
2166
|
className: "modal-title",
|
|
2145
2167
|
children: [
|
|
2146
|
-
|
|
2168
|
+
M("Rename folder"),
|
|
2147
2169
|
" ",
|
|
2148
2170
|
xe
|
|
2149
2171
|
]
|
|
@@ -2151,12 +2173,12 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2151
2173
|
open: C,
|
|
2152
2174
|
onOk: w,
|
|
2153
2175
|
onCancel: T,
|
|
2154
|
-
okText:
|
|
2155
|
-
cancelText:
|
|
2176
|
+
okText: M("Rename"),
|
|
2177
|
+
cancelText: M("Cancel"),
|
|
2156
2178
|
okButtonProps: { loading: F },
|
|
2157
2179
|
cancelButtonProps: { disabled: F },
|
|
2158
2180
|
afterClose: () => {
|
|
2159
|
-
I(!1),
|
|
2181
|
+
I(!1), N && N("");
|
|
2160
2182
|
},
|
|
2161
2183
|
centered: !0,
|
|
2162
2184
|
getContainer: de,
|
|
@@ -2167,11 +2189,11 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2167
2189
|
name: "newFolderName",
|
|
2168
2190
|
label: /* @__PURE__ */ J("div", {
|
|
2169
2191
|
className: "form-label",
|
|
2170
|
-
children:
|
|
2192
|
+
children: M("New folder name")
|
|
2171
2193
|
}),
|
|
2172
2194
|
rules: [{
|
|
2173
2195
|
required: !0,
|
|
2174
|
-
message:
|
|
2196
|
+
message: M("Enter a new folder name")
|
|
2175
2197
|
}],
|
|
2176
2198
|
className: "form-item",
|
|
2177
2199
|
children: /* @__PURE__ */ J(Xe, {
|
|
@@ -2193,7 +2215,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2193
2215
|
/* @__PURE__ */ J(et, {
|
|
2194
2216
|
className: `${L.deleteModal} deleteModal`,
|
|
2195
2217
|
title: (() => {
|
|
2196
|
-
let e = P?.enableTrashFolder && i === "Trash" || !P?.enableTrashFolder ?
|
|
2218
|
+
let e = P?.enableTrashFolder && i === "Trash" || !P?.enableTrashFolder ? M("Permanently delete") : M("Move to Trash");
|
|
2197
2219
|
return /* @__PURE__ */ J("div", {
|
|
2198
2220
|
className: "modal-title",
|
|
2199
2221
|
children: e
|
|
@@ -2203,21 +2225,21 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2203
2225
|
onOk: () => {
|
|
2204
2226
|
I(!0);
|
|
2205
2227
|
try {
|
|
2206
|
-
|
|
2228
|
+
ie && ie();
|
|
2207
2229
|
} catch (e) {
|
|
2208
2230
|
console.error(e), I(!1);
|
|
2209
2231
|
}
|
|
2210
2232
|
},
|
|
2211
|
-
onCancel: () =>
|
|
2212
|
-
okText: P?.enableTrashFolder && i === "Trash" ?
|
|
2213
|
-
cancelText:
|
|
2233
|
+
onCancel: () => ae && ae(),
|
|
2234
|
+
okText: P?.enableTrashFolder && i === "Trash" ? M("Delete permanently") : P?.enableTrashFolder ? M("Move to Trash") : M("Delete"),
|
|
2235
|
+
cancelText: M("Cancel"),
|
|
2214
2236
|
okButtonProps: {
|
|
2215
2237
|
danger: !P?.enableTrashFolder || i === "Trash",
|
|
2216
2238
|
loading: F
|
|
2217
2239
|
},
|
|
2218
2240
|
cancelButtonProps: { disabled: F },
|
|
2219
2241
|
afterClose: () => {
|
|
2220
|
-
I(!1),
|
|
2242
|
+
I(!1), N && N("");
|
|
2221
2243
|
},
|
|
2222
2244
|
closeIcon: /* @__PURE__ */ J(_t, { className: L.closeIcon }),
|
|
2223
2245
|
centered: !0,
|
|
@@ -2228,28 +2250,28 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2228
2250
|
let e;
|
|
2229
2251
|
if (r === 1 && a === 1) {
|
|
2230
2252
|
let n = t[0], r = n?.name || "", i = n?.childCount ?? 0;
|
|
2231
|
-
e =
|
|
2253
|
+
e = M("delete_folder_permanent", {
|
|
2232
2254
|
name: r,
|
|
2233
2255
|
count: i
|
|
2234
2256
|
});
|
|
2235
|
-
} else e = a === 0 && o > 0 ?
|
|
2257
|
+
} else e = a === 0 && o > 0 ? M("delete_files_permanent", { count: o }) : M("delete_mixed_permanent", {
|
|
2236
2258
|
total: r,
|
|
2237
2259
|
folders: a,
|
|
2238
2260
|
images: o
|
|
2239
2261
|
});
|
|
2240
2262
|
return /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", { children: e }), /* @__PURE__ */ J("p", {
|
|
2241
2263
|
className: L.permanentDeleteWarning,
|
|
2242
|
-
children:
|
|
2264
|
+
children: M("permanent_delete_warning")
|
|
2243
2265
|
})] });
|
|
2244
2266
|
}
|
|
2245
2267
|
if (r === 1 && a === 1) {
|
|
2246
2268
|
let e = t[0], n = e?.name || "", r = e?.childCount ?? 0;
|
|
2247
|
-
return /* @__PURE__ */ J("div", { children:
|
|
2269
|
+
return /* @__PURE__ */ J("div", { children: M("move_folder_to_trash", {
|
|
2248
2270
|
name: n,
|
|
2249
2271
|
count: r
|
|
2250
2272
|
}) });
|
|
2251
2273
|
}
|
|
2252
|
-
return a === 0 && o > 0 ? /* @__PURE__ */ J("div", { children:
|
|
2274
|
+
return a === 0 && o > 0 ? /* @__PURE__ */ J("div", { children: M("move_files_to_trash", { count: o }) }) : /* @__PURE__ */ J("div", { children: M("move_mixed_to_trash", {
|
|
2253
2275
|
total: r,
|
|
2254
2276
|
folders: a,
|
|
2255
2277
|
images: o
|
|
@@ -2260,15 +2282,15 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2260
2282
|
className: `${L.deleteModal} deleteModal`,
|
|
2261
2283
|
title: /* @__PURE__ */ J("div", {
|
|
2262
2284
|
className: "modal-title",
|
|
2263
|
-
children:
|
|
2285
|
+
children: M("Clear Trash")
|
|
2264
2286
|
}),
|
|
2265
|
-
open: !!
|
|
2287
|
+
open: !!A,
|
|
2266
2288
|
onOk: async () => {
|
|
2267
|
-
I(!0),
|
|
2289
|
+
I(!0), j && await j(), I(!1);
|
|
2268
2290
|
},
|
|
2269
|
-
onCancel: () =>
|
|
2270
|
-
okText:
|
|
2271
|
-
cancelText:
|
|
2291
|
+
onCancel: () => oe && oe(),
|
|
2292
|
+
okText: M("Delete permanently"),
|
|
2293
|
+
cancelText: M("Cancel"),
|
|
2272
2294
|
okButtonProps: {
|
|
2273
2295
|
danger: !0,
|
|
2274
2296
|
loading: F
|
|
@@ -2280,7 +2302,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2280
2302
|
closeIcon: /* @__PURE__ */ J(_t, { className: L.closeIcon }),
|
|
2281
2303
|
centered: !0,
|
|
2282
2304
|
getContainer: de,
|
|
2283
|
-
children: [/* @__PURE__ */ J("div", { children:
|
|
2305
|
+
children: [/* @__PURE__ */ J("div", { children: M("Are you sure you want to permanently delete all items from Trash?") }), F && /* @__PURE__ */ Y("div", {
|
|
2284
2306
|
className: L.clearTrashProgress,
|
|
2285
2307
|
children: [/* @__PURE__ */ J(nt, {
|
|
2286
2308
|
percent: 99,
|
|
@@ -2288,7 +2310,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2288
2310
|
showInfo: !1
|
|
2289
2311
|
}), /* @__PURE__ */ J("div", {
|
|
2290
2312
|
className: L.progressText,
|
|
2291
|
-
children:
|
|
2313
|
+
children: M("Deleting items...")
|
|
2292
2314
|
})]
|
|
2293
2315
|
})]
|
|
2294
2316
|
})
|
|
@@ -2325,7 +2347,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2325
2347
|
}, xr = Fe(Pe(({ selectedFolder: e, generateMenuItems: t, onFolderSelect: n, folders: r, fetchChildFolders: i, handleAddFile: a, setIsUrlModalVisible: c, handleCreateFolder: l, activeLibraryItem: u, setActiveLibraryItem: d }, f) => {
|
|
2326
2348
|
let p = V(() => Array.isArray(r) ? r : [], [r]), { t: m } = v(), h = s(), [_, y] = U({}), { options: ee, state: x } = g(), { dataProviders: C, config: w } = ee, T = x.pathHistory, E = w?.features?.enableGif !== !1 && (!w?.enabledTabs || w.enabledTabs.includes("gif")), te = w?.features?.enableStockImages !== !1 && (!w?.enabledTabs || w.enabledTabs.includes("stock")), ne = w?.features?.enableIconStock !== !1 && (!w?.enabledTabs || w.enabledTabs.includes("icons")), D = w?.features?.enableQrBarcodeTab !== !1 && (!w?.enabledTabs || w.enabledTabs.includes("codes")), O = z((e, t) => o(t, w) ? /* @__PURE__ */ Y("span", {
|
|
2327
2349
|
className: br.lockedTabIcon,
|
|
2328
|
-
children: [e, /* @__PURE__ */ J(
|
|
2350
|
+
children: [e, /* @__PURE__ */ J(Vt, {
|
|
2329
2351
|
size: 12,
|
|
2330
2352
|
strokeWidth: 2.5,
|
|
2331
2353
|
className: br.lockedTabLock
|
|
@@ -2333,22 +2355,22 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2333
2355
|
}) : e, [w]), k = z((e, t) => o(t, w) ? /* @__PURE__ */ J("span", {
|
|
2334
2356
|
className: br.lockedTabLabel,
|
|
2335
2357
|
children: e
|
|
2336
|
-
}) : e, [w]),
|
|
2358
|
+
}) : e, [w]), ie = z((e) => {
|
|
2337
2359
|
let t = [], n = (e) => {
|
|
2338
2360
|
e.forEach((e) => {
|
|
2339
2361
|
t.push(e.key), e.children && n(e.children);
|
|
2340
2362
|
});
|
|
2341
2363
|
};
|
|
2342
2364
|
return n(e), t;
|
|
2343
|
-
}, []), [
|
|
2365
|
+
}, []), [ae, A] = U(() => {
|
|
2344
2366
|
if (w?.expandAllFoldersOnInit === !0 && w?.folderTreeLoading !== "lazy") {
|
|
2345
2367
|
let e = t();
|
|
2346
|
-
return
|
|
2368
|
+
return ie(e);
|
|
2347
2369
|
}
|
|
2348
2370
|
return w?.expandRootFolderOnInit === !0 ? ["folders"] : [];
|
|
2349
|
-
}),
|
|
2371
|
+
}), j = H(!1), oe = H(!1);
|
|
2350
2372
|
B(() => {
|
|
2351
|
-
|
|
2373
|
+
j.current || w?.folderTreeLoading === "lazy" && w?.expandRootFolderOnInit === !0 && (j.current = !0, (async () => {
|
|
2352
2374
|
try {
|
|
2353
2375
|
await i?.(null);
|
|
2354
2376
|
} catch (e) {
|
|
@@ -2360,37 +2382,37 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2360
2382
|
w?.expandRootFolderOnInit,
|
|
2361
2383
|
i
|
|
2362
2384
|
]), B(() => {
|
|
2363
|
-
w?.expandRootFolderOnInit === !0 && Array.isArray(p) && p.length > 0 && !
|
|
2385
|
+
w?.expandRootFolderOnInit === !0 && Array.isArray(p) && p.length > 0 && !oe.current && (!ae || ae.length === 0) && (oe.current = !0, A(["folders"]));
|
|
2364
2386
|
}, [
|
|
2365
2387
|
w?.expandRootFolderOnInit,
|
|
2366
2388
|
p,
|
|
2367
|
-
|
|
2389
|
+
ae
|
|
2368
2390
|
]), B(() => {
|
|
2369
2391
|
if (w?.expandAllFoldersOnInit === !0 && w?.folderTreeLoading !== "lazy") {
|
|
2370
|
-
let e = t(), n =
|
|
2371
|
-
|
|
2392
|
+
let e = t(), n = ie(e);
|
|
2393
|
+
A(n);
|
|
2372
2394
|
return;
|
|
2373
2395
|
}
|
|
2374
|
-
w?.expandRootFolderOnInit === !0 &&
|
|
2396
|
+
w?.expandRootFolderOnInit === !0 && A((e) => e && e.length > 0 ? [...e] : ["folders"]);
|
|
2375
2397
|
}, [
|
|
2376
2398
|
p,
|
|
2377
2399
|
t,
|
|
2378
|
-
|
|
2400
|
+
ie,
|
|
2379
2401
|
w?.expandAllFoldersOnInit,
|
|
2380
2402
|
w?.folderTreeLoading,
|
|
2381
2403
|
w?.expandRootFolderOnInit
|
|
2382
2404
|
]);
|
|
2383
|
-
let
|
|
2405
|
+
let se = w?.disablePagination, M = z(async (e) => {
|
|
2384
2406
|
try {
|
|
2385
2407
|
if (C?.getChildrenCount) return await C.getChildrenCount(e === "folders" ? void 0 : e);
|
|
2386
2408
|
if (C?.getFiles) {
|
|
2387
2409
|
let { files: t, pagination: n } = await C.getFiles({
|
|
2388
2410
|
folderId: e === "folders" ? void 0 : e,
|
|
2389
2411
|
itemType: "all",
|
|
2390
|
-
page:
|
|
2391
|
-
limit:
|
|
2412
|
+
page: se ? void 0 : 1,
|
|
2413
|
+
limit: se ? void 0 : 1
|
|
2392
2414
|
});
|
|
2393
|
-
return
|
|
2415
|
+
return se ? Array.isArray(t) ? t.length : 0 : n?.total ?? (Array.isArray(t) ? t.length : 0);
|
|
2394
2416
|
}
|
|
2395
2417
|
return 0;
|
|
2396
2418
|
} catch (t) {
|
|
@@ -2420,33 +2442,33 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2420
2442
|
}
|
|
2421
2443
|
}, [
|
|
2422
2444
|
C,
|
|
2423
|
-
|
|
2445
|
+
se,
|
|
2424
2446
|
h,
|
|
2425
2447
|
T,
|
|
2426
2448
|
p,
|
|
2427
2449
|
m
|
|
2428
|
-
]),
|
|
2450
|
+
]), ce = z(async () => {
|
|
2429
2451
|
if (p.length === 0) return;
|
|
2430
2452
|
let e = {};
|
|
2431
|
-
e.folders = await
|
|
2453
|
+
e.folders = await M("folders");
|
|
2432
2454
|
let t = p.map(async (t) => {
|
|
2433
2455
|
if (typeof t.childCount == "number") {
|
|
2434
2456
|
e[t.id] = t.childCount;
|
|
2435
2457
|
return;
|
|
2436
2458
|
}
|
|
2437
|
-
e[t.id] = await
|
|
2459
|
+
e[t.id] = await M(t.id);
|
|
2438
2460
|
});
|
|
2439
2461
|
await Promise.all(t), y(e);
|
|
2440
|
-
}, [p,
|
|
2441
|
-
let t = await
|
|
2462
|
+
}, [p, M]), le = z(async (e) => {
|
|
2463
|
+
let t = await M(e);
|
|
2442
2464
|
y((n) => ({
|
|
2443
2465
|
...n,
|
|
2444
2466
|
[e]: t
|
|
2445
2467
|
}));
|
|
2446
|
-
}, [
|
|
2447
|
-
Ie(f, () => ({ refreshFileCounts:
|
|
2448
|
-
|
|
2449
|
-
}, [
|
|
2468
|
+
}, [M]);
|
|
2469
|
+
Ie(f, () => ({ refreshFileCounts: ce }), [ce]), B(() => {
|
|
2470
|
+
ce();
|
|
2471
|
+
}, [ce]), B(() => {
|
|
2450
2472
|
if (!e || e === "folders") return;
|
|
2451
2473
|
let t = (e, n = /* @__PURE__ */ new Set()) => {
|
|
2452
2474
|
if (n.has(e)) return console.warn(`Cycle detected in the path to the folder with id=${e}`), [];
|
|
@@ -2455,22 +2477,22 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2455
2477
|
let i = new Set(n);
|
|
2456
2478
|
return i.add(e), [...t(r.parentId, i), r.parentId];
|
|
2457
2479
|
}, n = t(e);
|
|
2458
|
-
n.length > 0 ?
|
|
2480
|
+
n.length > 0 ? A((e) => {
|
|
2459
2481
|
let t = new Set(e);
|
|
2460
2482
|
return n.forEach((e) => t.add(e)), t.add("folders"), Array.from(t);
|
|
2461
|
-
}) :
|
|
2483
|
+
}) : A((e) => e.includes("folders") ? e : [...e, "folders"]);
|
|
2462
2484
|
}, [e, p]);
|
|
2463
|
-
let
|
|
2464
|
-
await a(), e ? await
|
|
2485
|
+
let ue = z(async () => {
|
|
2486
|
+
await a(), e ? await le(e) : await le("folders");
|
|
2465
2487
|
}, [
|
|
2466
2488
|
a,
|
|
2467
2489
|
e,
|
|
2468
|
-
|
|
2490
|
+
le
|
|
2469
2491
|
]), P = [
|
|
2470
2492
|
{
|
|
2471
2493
|
key: b,
|
|
2472
2494
|
label: k(m("My files"), b),
|
|
2473
|
-
icon: O(/* @__PURE__ */ J(
|
|
2495
|
+
icon: O(/* @__PURE__ */ J(zt, {
|
|
2474
2496
|
size: 20,
|
|
2475
2497
|
strokeWidth: w?.iconStrokeWidth
|
|
2476
2498
|
}), b)
|
|
@@ -2478,7 +2500,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2478
2500
|
{
|
|
2479
2501
|
key: "gif",
|
|
2480
2502
|
label: k(m("GIF"), "gif"),
|
|
2481
|
-
icon: O(/* @__PURE__ */ J(
|
|
2503
|
+
icon: O(/* @__PURE__ */ J(Ht, {
|
|
2482
2504
|
size: 20,
|
|
2483
2505
|
strokeWidth: w?.iconStrokeWidth
|
|
2484
2506
|
}), "gif"),
|
|
@@ -2487,7 +2509,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2487
2509
|
{
|
|
2488
2510
|
key: S,
|
|
2489
2511
|
label: k(m("Stock images"), S),
|
|
2490
|
-
icon: O(/* @__PURE__ */ J(
|
|
2512
|
+
icon: O(/* @__PURE__ */ J(Rt, {
|
|
2491
2513
|
size: 20,
|
|
2492
2514
|
strokeWidth: w?.iconStrokeWidth
|
|
2493
2515
|
}), S),
|
|
@@ -2496,25 +2518,25 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2496
2518
|
{
|
|
2497
2519
|
key: re,
|
|
2498
2520
|
label: k(m("Icons"), re),
|
|
2499
|
-
icon: O(/* @__PURE__ */ J(
|
|
2521
|
+
icon: O(/* @__PURE__ */ J(Et, {
|
|
2500
2522
|
size: 20,
|
|
2501
2523
|
strokeWidth: w?.iconStrokeWidth
|
|
2502
2524
|
}), re),
|
|
2503
2525
|
disabled: !ne
|
|
2504
2526
|
},
|
|
2505
2527
|
{
|
|
2506
|
-
key:
|
|
2507
|
-
label: k(m("QR & Barcode"),
|
|
2508
|
-
icon: O(/* @__PURE__ */ J(
|
|
2528
|
+
key: N,
|
|
2529
|
+
label: k(m("QR & Barcode"), N),
|
|
2530
|
+
icon: O(/* @__PURE__ */ J(Wt, {
|
|
2509
2531
|
size: 20,
|
|
2510
2532
|
strokeWidth: w?.iconStrokeWidth
|
|
2511
|
-
}),
|
|
2533
|
+
}), N),
|
|
2512
2534
|
disabled: !D
|
|
2513
2535
|
},
|
|
2514
2536
|
{
|
|
2515
2537
|
key: "ai",
|
|
2516
2538
|
label: k(m("AI"), "ai"),
|
|
2517
|
-
icon: O(/* @__PURE__ */ J(
|
|
2539
|
+
icon: O(/* @__PURE__ */ J(Gt, {
|
|
2518
2540
|
size: 20,
|
|
2519
2541
|
strokeWidth: w?.iconStrokeWidth
|
|
2520
2542
|
}), "ai"),
|
|
@@ -2535,7 +2557,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2535
2557
|
}
|
|
2536
2558
|
d(e);
|
|
2537
2559
|
}, [w, d]), pe = z(async (e, t) => {
|
|
2538
|
-
if (
|
|
2560
|
+
if (A(e), w?.folderTreeLoading !== "lazy") return;
|
|
2539
2561
|
let n = t?.node?.key || void 0;
|
|
2540
2562
|
if (n && n !== "folders") try {
|
|
2541
2563
|
await i?.(n);
|
|
@@ -2578,11 +2600,11 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2578
2600
|
children: [/* @__PURE__ */ J(W, {
|
|
2579
2601
|
type: "primary",
|
|
2580
2602
|
size: "large",
|
|
2581
|
-
icon: /* @__PURE__ */ J(
|
|
2603
|
+
icon: /* @__PURE__ */ J(Ut, {
|
|
2582
2604
|
size: 24,
|
|
2583
2605
|
strokeWidth: w?.iconStrokeWidth
|
|
2584
2606
|
}),
|
|
2585
|
-
onClick:
|
|
2607
|
+
onClick: ue,
|
|
2586
2608
|
className: br.uploadButton,
|
|
2587
2609
|
style: { whiteSpace: "nowrap" },
|
|
2588
2610
|
disabled: e === "Trash",
|
|
@@ -2593,7 +2615,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2593
2615
|
}), /* @__PURE__ */ J(W, {
|
|
2594
2616
|
type: "primary",
|
|
2595
2617
|
size: "large",
|
|
2596
|
-
icon: /* @__PURE__ */ J(
|
|
2618
|
+
icon: /* @__PURE__ */ J(Bt, {
|
|
2597
2619
|
size: 24,
|
|
2598
2620
|
strokeWidth: w?.iconStrokeWidth
|
|
2599
2621
|
}),
|
|
@@ -2621,8 +2643,8 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2621
2643
|
fetchChildFolders: i,
|
|
2622
2644
|
showFileCounts: !0,
|
|
2623
2645
|
folderFileCounts: _,
|
|
2624
|
-
expandedKeys:
|
|
2625
|
-
setExpandedKeys:
|
|
2646
|
+
expandedKeys: ae,
|
|
2647
|
+
setExpandedKeys: A,
|
|
2626
2648
|
showTrashFolder: w?.enableTrashFolder
|
|
2627
2649
|
}), /* @__PURE__ */ J("div", {
|
|
2628
2650
|
className: br.folderActions,
|
|
@@ -2631,7 +2653,7 @@ var yr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
|
|
|
2631
2653
|
e.stopPropagation(), l();
|
|
2632
2654
|
},
|
|
2633
2655
|
className: br.button,
|
|
2634
|
-
icon: /* @__PURE__ */ J(
|
|
2656
|
+
icon: /* @__PURE__ */ J(Tt, {
|
|
2635
2657
|
size: 18,
|
|
2636
2658
|
strokeWidth: w?.iconStrokeWidth
|
|
2637
2659
|
}),
|
|
@@ -2867,7 +2889,7 @@ var Sr = R.lazy(async () => ({ default: (await import("./file-manager-FilerobotE
|
|
|
2867
2889
|
gif: l("GIF"),
|
|
2868
2890
|
[S]: l("Stock images"),
|
|
2869
2891
|
[re]: l("Icons"),
|
|
2870
|
-
[
|
|
2892
|
+
[N]: l("QR & Barcode"),
|
|
2871
2893
|
ai: l("AI image generation")
|
|
2872
2894
|
};
|
|
2873
2895
|
je.useEffect(() => {
|
|
@@ -2903,7 +2925,7 @@ var Sr = R.lazy(async () => ({ default: (await import("./file-manager-FilerobotE
|
|
|
2903
2925
|
children: /* @__PURE__ */ J(W, {
|
|
2904
2926
|
type: "text",
|
|
2905
2927
|
className: "folder-refresh-button",
|
|
2906
|
-
icon: /* @__PURE__ */ J(
|
|
2928
|
+
icon: /* @__PURE__ */ J(Kt, { size: 16 }),
|
|
2907
2929
|
onClick: o,
|
|
2908
2930
|
disabled: s
|
|
2909
2931
|
})
|
|
@@ -2912,7 +2934,7 @@ var Sr = R.lazy(async () => ({ default: (await import("./file-manager-FilerobotE
|
|
|
2912
2934
|
})
|
|
2913
2935
|
});
|
|
2914
2936
|
}, jr = ({ imageId: e, sourceUrl: t, shouldLoad: n = !0, loader: r, onLoad: i, ...a }) => {
|
|
2915
|
-
let o = V(() => [t], [t]), s =
|
|
2937
|
+
let o = V(() => [t], [t]), s = ae(o), [c, l] = U(() => r.getSnapshot(e, t)), u = H(null);
|
|
2916
2938
|
return B(() => (l(r.getSnapshot(e, t)), r.subscribe(e, t, l)), [
|
|
2917
2939
|
e,
|
|
2918
2940
|
r,
|
|
@@ -2978,15 +3000,15 @@ var Ir = {
|
|
|
2978
3000
|
}, [n]), B(() => {
|
|
2979
3001
|
w.setFieldsValue({ keywords: n.keywords });
|
|
2980
3002
|
}, []);
|
|
2981
|
-
let k = u?.handleProxyUrl,
|
|
3003
|
+
let k = u?.handleProxyUrl, ie = u?.fetchWithProxy, ae = async (e) => k ? await Promise.resolve(k(e)) ?? e : e, A = z(async (e) => ie ? Promise.resolve(ie(e, void 0, { intent: "metadata" })) : fetch(await ae(e)), [ie, ae]), j = async function({ query: e, page: t }) {
|
|
2982
3004
|
let n = e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
|
|
2983
3005
|
try {
|
|
2984
3006
|
let e = u?.REACT_APP_GIPHY_KEY ?? "Nh77eBlPeMn1ed9MBAvL542NUGeNO26F", i = `${r}/search?api_key=${e}&q=${encodeURIComponent(n)}&limit=${Lr}&offset=${t}&lang=en`;
|
|
2985
|
-
return { data: await (await
|
|
3007
|
+
return { data: await (await A(i)).json() };
|
|
2986
3008
|
} catch (e) {
|
|
2987
3009
|
console.warn(e);
|
|
2988
3010
|
}
|
|
2989
|
-
}, { positionedItems:
|
|
3011
|
+
}, { positionedItems: oe, containerHeight: se, isNearEnd: M, viewportMetrics: ce, handleViewportChange: le } = Se({
|
|
2990
3012
|
items: t,
|
|
2991
3013
|
getId: (e) => e.id,
|
|
2992
3014
|
getPreviewSrc: Hr,
|
|
@@ -2998,7 +3020,7 @@ var Ir = {
|
|
|
2998
3020
|
estimatedItemHeight: 220,
|
|
2999
3021
|
prefetchThresholdPx: Br,
|
|
3000
3022
|
resolveColumnCount: Vr
|
|
3001
|
-
}),
|
|
3023
|
+
}), ue = pe(le, [t.length]), N = () => {
|
|
3002
3024
|
E.current &&= (clearTimeout(E.current), null);
|
|
3003
3025
|
}, P = (e) => !O.current.has(e) && (O.current.add(e), !0), de = (e) => {
|
|
3004
3026
|
O.current.delete(e);
|
|
@@ -3010,7 +3032,7 @@ var Ir = {
|
|
|
3010
3032
|
let r = re.current;
|
|
3011
3033
|
x(!0);
|
|
3012
3034
|
try {
|
|
3013
|
-
let t = await
|
|
3035
|
+
let t = await j({
|
|
3014
3036
|
query: T.current,
|
|
3015
3037
|
page: D.current
|
|
3016
3038
|
});
|
|
@@ -3035,7 +3057,7 @@ var Ir = {
|
|
|
3035
3057
|
b,
|
|
3036
3058
|
e
|
|
3037
3059
|
]), me = async () => {
|
|
3038
|
-
|
|
3060
|
+
N();
|
|
3039
3061
|
let t = T.current.keywords?.trim();
|
|
3040
3062
|
if (!t) {
|
|
3041
3063
|
te.current = null, ne.current = null, re.current += 1, D.current = 0, e([]), h(/* @__PURE__ */ new Set()), C(!1), x(!1);
|
|
@@ -3047,7 +3069,7 @@ var Ir = {
|
|
|
3047
3069
|
let r = re.current + 1;
|
|
3048
3070
|
re.current = r, te.current = t, D.current = 0, e([]), h(/* @__PURE__ */ new Set()), C(!1), x(!1), y(!0);
|
|
3049
3071
|
try {
|
|
3050
|
-
let n = await
|
|
3072
|
+
let n = await j({
|
|
3051
3073
|
query: T.current,
|
|
3052
3074
|
page: 0
|
|
3053
3075
|
});
|
|
@@ -3070,13 +3092,13 @@ var Ir = {
|
|
|
3070
3092
|
}, 2e3), o(e, Fr(n, t) ?? t);
|
|
3071
3093
|
};
|
|
3072
3094
|
return B(() => () => {
|
|
3073
|
-
|
|
3095
|
+
N();
|
|
3074
3096
|
}, []), B(() => {
|
|
3075
|
-
!_ && !b && S && t.length > 0 &&
|
|
3097
|
+
!_ && !b && S && t.length > 0 && M && fe();
|
|
3076
3098
|
}, [
|
|
3077
3099
|
S,
|
|
3078
3100
|
t.length,
|
|
3079
|
-
|
|
3101
|
+
M,
|
|
3080
3102
|
fe,
|
|
3081
3103
|
_,
|
|
3082
3104
|
b
|
|
@@ -3086,7 +3108,7 @@ var Ir = {
|
|
|
3086
3108
|
className: Ir.searchOutputWrapper,
|
|
3087
3109
|
children: /* @__PURE__ */ Y("div", {
|
|
3088
3110
|
id: "scrollableDiv",
|
|
3089
|
-
ref:
|
|
3111
|
+
ref: ue,
|
|
3090
3112
|
className: Ir.scrollableDiv,
|
|
3091
3113
|
children: [
|
|
3092
3114
|
/* @__PURE__ */ Y(K, {
|
|
@@ -3097,7 +3119,7 @@ var Ir = {
|
|
|
3097
3119
|
...T.current,
|
|
3098
3120
|
keywords: e.keywords
|
|
3099
3121
|
};
|
|
3100
|
-
i(t), T.current = t,
|
|
3122
|
+
i(t), T.current = t, N(), E.current = setTimeout(me, 800);
|
|
3101
3123
|
}
|
|
3102
3124
|
},
|
|
3103
3125
|
className: t.length > 0 ? Ir.searchResults : Ir.search,
|
|
@@ -3110,7 +3132,7 @@ var Ir = {
|
|
|
3110
3132
|
placeholder: s("Search GIFs"),
|
|
3111
3133
|
ref: a,
|
|
3112
3134
|
spellCheck: "false",
|
|
3113
|
-
prefix: /* @__PURE__ */ J(
|
|
3135
|
+
prefix: /* @__PURE__ */ J(It, {
|
|
3114
3136
|
size: 16,
|
|
3115
3137
|
strokeWidth: u?.iconStrokeWidth,
|
|
3116
3138
|
onClick: () => void me()
|
|
@@ -3141,9 +3163,9 @@ var Ir = {
|
|
|
3141
3163
|
!t.length && _ && /* @__PURE__ */ J(ke, {}),
|
|
3142
3164
|
t.length > 0 && /* @__PURE__ */ Y(pt, { children: [/* @__PURE__ */ J("div", {
|
|
3143
3165
|
className: Ir.virtualCanvas,
|
|
3144
|
-
style: { height:
|
|
3145
|
-
children:
|
|
3146
|
-
let n = e.item, r = m.has(n.id), i = Hr(n), a = t.bottom >=
|
|
3166
|
+
style: { height: se },
|
|
3167
|
+
children: oe.map(({ row: e, layout: t }) => {
|
|
3168
|
+
let n = e.item, r = m.has(n.id), i = Hr(n), a = t.bottom >= ce.scrollTop - zr && t.top <= ce.scrollTop + ce.viewportHeight + zr;
|
|
3147
3169
|
return /* @__PURE__ */ Y("div", {
|
|
3148
3170
|
className: `${Ir.listItem} ${r ? Ir.loaded : ""}`,
|
|
3149
3171
|
onClick: () => F(n.images.downsized.url, n.id, n.title),
|
|
@@ -3234,10 +3256,10 @@ var Ir = {
|
|
|
3234
3256
|
let n = new URL(e);
|
|
3235
3257
|
return n.searchParams.set("w", t.toString()), n.toString();
|
|
3236
3258
|
}, $r = ({ imageStockList: e, setImageStockList: t, currentReq: n, setCurrentReq: r, inputRef: i, customRequest: a }) => {
|
|
3237
|
-
let { t: o } = v(), { StockBigIcon: s, MixedViewIcon: c, LandscapeViewIcon: l, PortraitViewIcon: u, SquareViewIcon: d } = Oe(), { options: f } = g(), { config: p } = f, m = ee({ maxConcurrent: Kr }), [h, _] = U(!1), [y, b] = U(!1), [x, S] = U(!1), [C, w] = U(null), [T, E] = U(/* @__PURE__ */ new Set()), [te] = K.useForm(), ne = p?.fetchWithProxy, re = p?.handleProxyUrl, D = p?.UNSPLASH_KEY ?? "HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0", O = p?.locale?.slice(0, 2) || "ru", k = H(n),
|
|
3238
|
-
|
|
3239
|
-
},
|
|
3240
|
-
|
|
3259
|
+
let { t: o } = v(), { StockBigIcon: s, MixedViewIcon: c, LandscapeViewIcon: l, PortraitViewIcon: u, SquareViewIcon: d } = Oe(), { options: f } = g(), { config: p } = f, m = ee({ maxConcurrent: Kr }), [h, _] = U(!1), [y, b] = U(!1), [x, S] = U(!1), [C, w] = U(null), [T, E] = U(/* @__PURE__ */ new Set()), [te] = K.useForm(), ne = p?.fetchWithProxy, re = p?.handleProxyUrl, D = p?.UNSPLASH_KEY ?? "HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0", O = p?.locale?.slice(0, 2) || "ru", k = H(n), ie = H(null), ae = H(null), A = H(0), j = H(1), oe = H(/* @__PURE__ */ new Set()), M = async (e) => re ? await Promise.resolve(re(e)) ?? e : e, ce = z(async (e) => ne ? Promise.resolve(ne(e, void 0, { intent: "metadata" })) : fetch(await M(e)), [ne, M]), le = () => {
|
|
3260
|
+
ie.current &&= (clearTimeout(ie.current), null);
|
|
3261
|
+
}, ue = (e) => !oe.current.has(e) && (oe.current.add(e), !0), N = (e) => {
|
|
3262
|
+
oe.current.delete(e);
|
|
3241
3263
|
}, P = (e) => e.map((e) => ({
|
|
3242
3264
|
...e,
|
|
3243
3265
|
urls: {
|
|
@@ -3262,7 +3284,7 @@ var Ir = {
|
|
|
3262
3284
|
let de = async function(e) {
|
|
3263
3285
|
try {
|
|
3264
3286
|
let t = `${e}${e.includes("?") ? "&" : "?"}client_id=${D}`;
|
|
3265
|
-
return { data: await (await
|
|
3287
|
+
return { data: await (await ce(t)).json() };
|
|
3266
3288
|
} catch (e) {
|
|
3267
3289
|
console.warn(e);
|
|
3268
3290
|
}
|
|
@@ -3270,7 +3292,7 @@ var Ir = {
|
|
|
3270
3292
|
let n = e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
|
|
3271
3293
|
try {
|
|
3272
3294
|
let r = `${Wr}/search/photos?client_id=${D}&lang=${O}&per_page=${Gr}&query=${encodeURIComponent(n)}&page=${t}`;
|
|
3273
|
-
return e.color !== "" && (r += `&color=${e.color}`), e.orientation !== "" && (r += `&orientation=${e.orientation}`), { data: await (await
|
|
3295
|
+
return e.color !== "" && (r += `&color=${e.color}`), e.orientation !== "" && (r += `&orientation=${e.orientation}`), { data: await (await ce(r)).json() };
|
|
3274
3296
|
} catch (e) {
|
|
3275
3297
|
console.warn(e);
|
|
3276
3298
|
}
|
|
@@ -3288,28 +3310,28 @@ var Ir = {
|
|
|
3288
3310
|
resolveColumnCount: Zr
|
|
3289
3311
|
}), _e = pe(ge, [e.length]), ye = z(async () => {
|
|
3290
3312
|
if (h || y || !x || !k.current.keywords.trim()) return;
|
|
3291
|
-
let e =
|
|
3292
|
-
if (
|
|
3313
|
+
let e = A.current, n = j.current, r = `stock:${`${k.current.keywords.trim()}|${k.current.color}|${k.current.orientation}`}:${n}`;
|
|
3314
|
+
if (ue(r)) {
|
|
3293
3315
|
b(!0);
|
|
3294
3316
|
try {
|
|
3295
3317
|
let r = await fe({
|
|
3296
3318
|
query: k.current,
|
|
3297
3319
|
page: n
|
|
3298
3320
|
});
|
|
3299
|
-
if (e !==
|
|
3321
|
+
if (e !== A.current) return;
|
|
3300
3322
|
let i = r?.data?.results ?? [];
|
|
3301
3323
|
if (i.length === 0) {
|
|
3302
3324
|
S(!1);
|
|
3303
3325
|
return;
|
|
3304
3326
|
}
|
|
3305
3327
|
let a = P(i);
|
|
3306
|
-
if (e !==
|
|
3328
|
+
if (e !== A.current) return;
|
|
3307
3329
|
t((e) => {
|
|
3308
3330
|
let t = new Set(e.map((e) => e.id)), n = a.filter((e) => !t.has(e.id));
|
|
3309
3331
|
return n.length > 0 ? [...e, ...n] : e;
|
|
3310
|
-
}),
|
|
3332
|
+
}), j.current = n + 1, S(i.length === Gr);
|
|
3311
3333
|
} finally {
|
|
3312
|
-
|
|
3334
|
+
N(r), e === A.current && b(!1);
|
|
3313
3335
|
}
|
|
3314
3336
|
}
|
|
3315
3337
|
}, [
|
|
@@ -3318,36 +3340,36 @@ var Ir = {
|
|
|
3318
3340
|
y,
|
|
3319
3341
|
t
|
|
3320
3342
|
]), be = async () => {
|
|
3321
|
-
|
|
3343
|
+
le();
|
|
3322
3344
|
let e = `${k.current.keywords.trim()}|${k.current.color}|${k.current.orientation}`;
|
|
3323
3345
|
if (!k.current.keywords.trim()) {
|
|
3324
|
-
|
|
3346
|
+
ae.current = null;
|
|
3325
3347
|
return;
|
|
3326
3348
|
}
|
|
3327
|
-
if (
|
|
3349
|
+
if (ae.current === e) return;
|
|
3328
3350
|
let n = `stock:${e}:1`;
|
|
3329
|
-
if (!
|
|
3330
|
-
let r =
|
|
3331
|
-
|
|
3351
|
+
if (!ue(n)) return;
|
|
3352
|
+
let r = A.current + 1;
|
|
3353
|
+
A.current = r, _(!0), b(!1), S(!1), j.current = 1, t([]), E(/* @__PURE__ */ new Set());
|
|
3332
3354
|
try {
|
|
3333
3355
|
let n = await fe({
|
|
3334
3356
|
query: k.current,
|
|
3335
3357
|
page: 1
|
|
3336
3358
|
});
|
|
3337
|
-
if (r !==
|
|
3359
|
+
if (r !== A.current) return;
|
|
3338
3360
|
let i = n?.data?.results ?? [];
|
|
3339
3361
|
if (i.length > 0) {
|
|
3340
3362
|
let e = P(i);
|
|
3341
|
-
if (r !==
|
|
3342
|
-
t(e),
|
|
3363
|
+
if (r !== A.current) return;
|
|
3364
|
+
t(e), j.current = 2, S(i.length === Gr);
|
|
3343
3365
|
} else S(!1);
|
|
3344
|
-
|
|
3366
|
+
ae.current = e;
|
|
3345
3367
|
} finally {
|
|
3346
|
-
|
|
3368
|
+
N(n), _(!1);
|
|
3347
3369
|
}
|
|
3348
3370
|
};
|
|
3349
3371
|
B(() => () => {
|
|
3350
|
-
|
|
3372
|
+
le();
|
|
3351
3373
|
}, []), B(() => {
|
|
3352
3374
|
!h && !y && x && e.length > 0 && I && ye();
|
|
3353
3375
|
}, [
|
|
@@ -3361,7 +3383,7 @@ var Ir = {
|
|
|
3361
3383
|
let xe = async (e, t, n, r) => {
|
|
3362
3384
|
de(t.download_location), w(n), setTimeout(() => w(null), 2e3);
|
|
3363
3385
|
let i = e.raw;
|
|
3364
|
-
a(i, Fr(r, n) ??
|
|
3386
|
+
a(i, Fr(r, n) ?? se(i));
|
|
3365
3387
|
};
|
|
3366
3388
|
return /* @__PURE__ */ J("div", {
|
|
3367
3389
|
className: $.stockTab,
|
|
@@ -3380,7 +3402,7 @@ var Ir = {
|
|
|
3380
3402
|
...ve,
|
|
3381
3403
|
...n
|
|
3382
3404
|
};
|
|
3383
|
-
r(i), k.current = i,
|
|
3405
|
+
r(i), k.current = i, le(), i.keywords === "" ? (ae.current = null, A.current += 1, j.current = 1, t([]), E(/* @__PURE__ */ new Set()), S(!1), b(!1), r({ ...ve }), k.current = ve, te.resetFields()) : ie.current = setTimeout(be, 800);
|
|
3384
3406
|
},
|
|
3385
3407
|
className: e.length > 0 ? $.searchResults : $.search,
|
|
3386
3408
|
children: [/* @__PURE__ */ Y(it, {
|
|
@@ -3395,7 +3417,7 @@ var Ir = {
|
|
|
3395
3417
|
placeholder: o("Search image"),
|
|
3396
3418
|
ref: i,
|
|
3397
3419
|
spellCheck: "false",
|
|
3398
|
-
prefix: /* @__PURE__ */ J(
|
|
3420
|
+
prefix: /* @__PURE__ */ J(It, {
|
|
3399
3421
|
size: 16,
|
|
3400
3422
|
strokeWidth: p?.iconStrokeWidth
|
|
3401
3423
|
})
|
|
@@ -3678,16 +3700,16 @@ function ri(e) {
|
|
|
3678
3700
|
//#endregion
|
|
3679
3701
|
//#region packages/file-manager/src/components/ImageAI/useImageAIGeneration/useImageAIGeneration.ts
|
|
3680
3702
|
function ii({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded: r, setIsImageUploaded: i, aiImageRequest: a, imageAiList: o, setImageAiList: c, isLoadingAi: l, setIsLoadingAi: u }) {
|
|
3681
|
-
let { t: f } = v(), { options: p } = g(), m = p.config, h = s(), _ = ti(), { messages: y } = p.config, [b, ee] = U([]), [x, S] = U(0), [C, w] = U(null), [T, E] = U(!1), [te, ne] = U(f("Evaluating the task")), [re, D] = U(!1), O = H(/* @__PURE__ */ new Set()), k = H(/* @__PURE__ */ new Set()),
|
|
3703
|
+
let { t: f } = v(), { options: p } = g(), m = p.config, h = s(), _ = ti(), { messages: y } = p.config, [b, ee] = U([]), [x, S] = U(0), [C, w] = U(null), [T, E] = U(!1), [te, ne] = U(f("Evaluating the task")), [re, D] = U(!1), O = H(/* @__PURE__ */ new Set()), k = H(/* @__PURE__ */ new Set()), ie = H(/* @__PURE__ */ new Set());
|
|
3682
3704
|
B(() => {
|
|
3683
3705
|
ee(y);
|
|
3684
3706
|
}, [y]), B(() => {
|
|
3685
|
-
!o.length && !C && (ee([]), O.current.clear(), k.current.clear(),
|
|
3707
|
+
!o.length && !C && (ee([]), O.current.clear(), k.current.clear(), ie.current.clear(), j.current = -1);
|
|
3686
3708
|
}, [o, C]);
|
|
3687
|
-
let
|
|
3709
|
+
let ae = V(() => m && typeof m?.sendAIImageRequest == "function" ? m?.sendAIImageRequest : () => Promise.resolve({}), [m]), A = z((e) => {
|
|
3688
3710
|
let t = `${C}-${e.progress}-${JSON.stringify(e.images || e.data)}`;
|
|
3689
|
-
if (!
|
|
3690
|
-
if (
|
|
3711
|
+
if (!ie.current.has(t)) {
|
|
3712
|
+
if (ie.current.add(t), e.status !== "error" && e.status !== "Canceled") {
|
|
3691
3713
|
if (e.images) {
|
|
3692
3714
|
if (ne(String(e.status)), e.progress === 100) {
|
|
3693
3715
|
u(!1), c(e.images);
|
|
@@ -3739,37 +3761,37 @@ function ii({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
|
|
|
3739
3761
|
C,
|
|
3740
3762
|
h,
|
|
3741
3763
|
D
|
|
3742
|
-
]),
|
|
3764
|
+
]), j = H(-1);
|
|
3743
3765
|
B(() => {
|
|
3744
3766
|
if (b.length > 0) {
|
|
3745
3767
|
let e = b.length - 1;
|
|
3746
|
-
e >
|
|
3768
|
+
e > j.current && (j.current = e, A(b[e]));
|
|
3747
3769
|
}
|
|
3748
|
-
}, [
|
|
3749
|
-
let
|
|
3770
|
+
}, [A, b]);
|
|
3771
|
+
let oe = V(() => {
|
|
3750
3772
|
if (m && typeof m?.sseQuery == "function") {
|
|
3751
3773
|
let e = m?.sseQuery;
|
|
3752
3774
|
return (t) => e(t);
|
|
3753
3775
|
}
|
|
3754
3776
|
return (e) => {};
|
|
3755
|
-
}, [m]),
|
|
3756
|
-
|
|
3777
|
+
}, [m]), se = V(() => m && typeof m?.handleLimitUsageEmitter == "object" ? m?.handleLimitUsageEmitter : { fire: () => {} }, [m]), M = m?.elementId, { projectId: ce } = m, { limits: le } = m?.limits ? m : { limits: { ai_img_limit: 0 } }, { ai_img_limit: ue } = le, N = ue > 0 && x >= ue, P = !!(m?.limits && m.counters) && ge.isPlugin, de = z(() => {
|
|
3778
|
+
se.fire({
|
|
3757
3779
|
name: "AiImgCount",
|
|
3758
3780
|
count: x + 1
|
|
3759
3781
|
});
|
|
3760
|
-
}, [
|
|
3761
|
-
|
|
3782
|
+
}, [se, x]), fe = V(() => !N && (!P || ue === 0 || x < ue), [
|
|
3783
|
+
N,
|
|
3762
3784
|
P,
|
|
3763
3785
|
x,
|
|
3764
|
-
|
|
3786
|
+
ue
|
|
3765
3787
|
]), pe = z(async () => {
|
|
3766
3788
|
ne(f("Evaluating the task")), a !== "" && !l && (u(!0), D(!0), c([]), ee([]), _({
|
|
3767
3789
|
event: "submit_form",
|
|
3768
3790
|
action: "ai_image_generation",
|
|
3769
|
-
entity_id:
|
|
3770
|
-
project_id:
|
|
3771
|
-
}),
|
|
3772
|
-
project_id:
|
|
3791
|
+
entity_id: M,
|
|
3792
|
+
project_id: ce
|
|
3793
|
+
}), ae({ body: {
|
|
3794
|
+
project_id: ce,
|
|
3773
3795
|
request: "create-image",
|
|
3774
3796
|
connection: "midjourney",
|
|
3775
3797
|
message: a
|
|
@@ -3794,9 +3816,9 @@ function ii({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
|
|
|
3794
3816
|
taskId: s,
|
|
3795
3817
|
response: r?.data
|
|
3796
3818
|
}
|
|
3797
|
-
}),
|
|
3819
|
+
}), oe({
|
|
3798
3820
|
task_id: o?.id,
|
|
3799
|
-
entity_id:
|
|
3821
|
+
entity_id: M
|
|
3800
3822
|
})) : (u(!1), D(!1), s && !k.current.has(s) && (k.current.add(s), h.error({
|
|
3801
3823
|
id: "AI_IMAGE_GENERATION_FAILED",
|
|
3802
3824
|
message: r?.message || f("Something went wrong, please try again"),
|
|
@@ -3833,11 +3855,11 @@ function ii({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
|
|
|
3833
3855
|
D,
|
|
3834
3856
|
c,
|
|
3835
3857
|
_,
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
ie,
|
|
3839
|
-
h,
|
|
3858
|
+
M,
|
|
3859
|
+
ce,
|
|
3840
3860
|
ae,
|
|
3861
|
+
h,
|
|
3862
|
+
oe,
|
|
3841
3863
|
f,
|
|
3842
3864
|
C
|
|
3843
3865
|
]), me = z(() => {
|
|
@@ -3907,8 +3929,8 @@ function ii({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
|
|
|
3907
3929
|
]), {
|
|
3908
3930
|
aiImageCounter: x,
|
|
3909
3931
|
setAiImageCounter: S,
|
|
3910
|
-
currentAiImgLimits:
|
|
3911
|
-
isFieldsDisabled:
|
|
3932
|
+
currentAiImgLimits: ue,
|
|
3933
|
+
isFieldsDisabled: N,
|
|
3912
3934
|
canGenerateImage: fe,
|
|
3913
3935
|
aiImageRequest: a,
|
|
3914
3936
|
imageAiList: o,
|
|
@@ -4366,7 +4388,7 @@ var fi = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
|
|
|
4366
4388
|
imageStock: "jpg",
|
|
4367
4389
|
gif: "gif"
|
|
4368
4390
|
}, wi = () => {
|
|
4369
|
-
let e =
|
|
4391
|
+
let e = A(), n = F(), r = oe(), a = C(), o = mi(), u = ne(), { deleteItems: f } = t(), h = s(), { t: _ } = v(), { options: y, state: b, actions: ee } = g(), x = y, S = x?.onChangeSelection, w = b, E = x?.config, { dataProviders: re } = x, { form: O, urlForm: k, renameForm: ie, moveForm: ae, renameFolderForm: j, copyForm: M, isModalVisible: ce, isUrlModalVisible: ue, isMoveModalVisible: N, isRenameFolderModalVisible: P, isCopyModalVisible: de, isDeleteConfirmVisible: pe, folderToRename: me, activeLibraryItem: I } = b, { setIsUrlModalVisible: he, setActiveLibraryItem: ge } = ee, { config: _e } = y, { DropZoneFileIcon: ye } = Oe(), [be, xe] = U(!1), [Se, Ce] = U(!1), [we, L] = U(!1), Te = H(0), Ee = H(!1);
|
|
4370
4392
|
Ee.current = Se;
|
|
4371
4393
|
let De = R.useRef(null), Ae = R.useRef([]), [je, Me] = U(!1), [Ne, Pe] = U(!1), Fe = T((e) => e.selectedFiles), Ie = T((e) => e.clearSelection), V = T((e) => e.syncVisibleFiles), { folders: Re, loading: ze } = e.state, { fetchFolders: Be, fetchChildFolders: Ve, handleCreateFolder: W, handleModalOk: He, handleModalCancel: Ue, generateMenuItems: We } = e.actions, Ge = pi(Be), { files: G, loading: qe, isRenamingFile: Je, fileToRename: K } = n.state, { fetchFiles: Ye, handleDeleteFile: Xe, handleDeleteFolder: Qe, handleAddFile: $e, handleAddFileByUrl: et, showRenameModal: tt, handleRenameCancel: nt, handleRenameOk: rt, handleDroppedFiles: it, showMoveModal: at, handleMoveCancel: ot, handleMoveOk: st, handleCopyOk: lt, handleCopyCancel: ut, showDeleteConfirm: q, handleDeleteConfirmCancel: dt, handleDeleteConfirmOk: ft } = n.actions, { selectedFolder: X, pathHistory: mt } = r.state, { handleFolderSelect: ht, handleItemClick: gt } = r.actions, { pagination: _t } = a.state, vt = p(Ye), { searchTerm: yt, sortBy: bt, sortOrder: xt } = vt.state, { handleSearch: St, handleSort: wt, handlePaginationChange: Tt } = vt.actions, Et = z(async () => {
|
|
4372
4394
|
let e = l(mt || []);
|
|
@@ -4398,7 +4420,7 @@ var fi = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
|
|
|
4398
4420
|
X,
|
|
4399
4421
|
bt,
|
|
4400
4422
|
xt
|
|
4401
|
-
]), Dt =
|
|
4423
|
+
]), Dt = le({
|
|
4402
4424
|
files: G || [],
|
|
4403
4425
|
fetchFiles: Ye,
|
|
4404
4426
|
selectedFolder: X || null
|
|
@@ -4674,7 +4696,7 @@ var fi = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
|
|
|
4674
4696
|
]), Ut = R.useCallback(async (e, t, n, r) => {
|
|
4675
4697
|
try {
|
|
4676
4698
|
Me(!0);
|
|
4677
|
-
let a = te(n || e &&
|
|
4699
|
+
let a = te(n || e && se(e) || "uploaded-file", E), s = Ci[r ?? ""], c = s && !D(a) ? `${a}.${s}` : a, l = o.startUploadByUrl(X || void 0, c);
|
|
4678
4700
|
try {
|
|
4679
4701
|
let i = await et(e, t, !0, r ?? "uploadByUrl", n);
|
|
4680
4702
|
if (o.updateProgress(l, 100), i) {
|
|
@@ -5167,36 +5189,36 @@ var fi = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
|
|
|
5167
5189
|
children: /* @__PURE__ */ J(ct, { size: "large" })
|
|
5168
5190
|
}),
|
|
5169
5191
|
/* @__PURE__ */ J(yr, {
|
|
5170
|
-
isModalVisible:
|
|
5192
|
+
isModalVisible: ce,
|
|
5171
5193
|
handleModalOk: He,
|
|
5172
5194
|
handleModalCancel: Ue,
|
|
5173
5195
|
form: O,
|
|
5174
5196
|
selectedFolder: X || null,
|
|
5175
5197
|
folders: Re || [],
|
|
5176
|
-
isUrlModalVisible:
|
|
5198
|
+
isUrlModalVisible: ue,
|
|
5177
5199
|
setIsUrlModalVisible: (e) => he?.(e),
|
|
5178
5200
|
handleAddFileByUrl: Ut,
|
|
5179
5201
|
urlForm: k,
|
|
5180
5202
|
isRenameModalVisible: Je,
|
|
5181
5203
|
handleRenameOk: () => rt?.(),
|
|
5182
5204
|
handleRenameCancel: () => nt?.(),
|
|
5183
|
-
renameForm:
|
|
5205
|
+
renameForm: ie,
|
|
5184
5206
|
fileToRename: K,
|
|
5185
5207
|
files: G || [],
|
|
5186
|
-
isMoveModalVisible:
|
|
5208
|
+
isMoveModalVisible: N,
|
|
5187
5209
|
handleMoveOk: Bt,
|
|
5188
5210
|
handleMoveCancel: ot,
|
|
5189
|
-
moveForm:
|
|
5211
|
+
moveForm: ae,
|
|
5190
5212
|
selectedFiles: Fe || /* @__PURE__ */ new Set(),
|
|
5191
5213
|
isRenameFolderModalVisible: P,
|
|
5192
5214
|
handleRenameFolderOk: Fn,
|
|
5193
5215
|
handleRenameFolderCancel: Yt,
|
|
5194
|
-
renameFolderForm:
|
|
5216
|
+
renameFolderForm: j,
|
|
5195
5217
|
folderToRename: me,
|
|
5196
5218
|
isCopyModalVisible: de,
|
|
5197
5219
|
handleCopyOk: Vt,
|
|
5198
5220
|
handleCopyCancel: ut,
|
|
5199
|
-
copyForm:
|
|
5221
|
+
copyForm: M,
|
|
5200
5222
|
isDeleteConfirmVisible: pe,
|
|
5201
5223
|
handleDeleteConfirmOk: It,
|
|
5202
5224
|
handleDeleteConfirmCancel: () => dt?.(),
|
|
@@ -6931,11 +6953,11 @@ var ka = class {
|
|
|
6931
6953
|
_folderFromResolvedPath(e, t) {
|
|
6932
6954
|
if (e.isFolder !== !0) {
|
|
6933
6955
|
let n = e.isFolder === !1 ? "Path '%s' resolves to a file, not a folder".replace("%s", t) : "Path '%s' resolved to an item that is not marked as a folder".replace("%s", t);
|
|
6934
|
-
throw new
|
|
6956
|
+
throw new j(n, "ValidationError");
|
|
6935
6957
|
}
|
|
6936
6958
|
if (!e.id) {
|
|
6937
6959
|
let e = "Path '%s' resolved to a folder without id".replace("%s", t);
|
|
6938
|
-
throw new
|
|
6960
|
+
throw new j(e, "ValidationError");
|
|
6939
6961
|
}
|
|
6940
6962
|
let n = {
|
|
6941
6963
|
id: e.id,
|
|
@@ -6959,7 +6981,7 @@ var ka = class {
|
|
|
6959
6981
|
let t = Oa(e);
|
|
6960
6982
|
if (t.length > Sa) {
|
|
6961
6983
|
let e = "Path depth exceeds maximum limit of %s".replace("%s", String(Sa));
|
|
6962
|
-
throw new
|
|
6984
|
+
throw new j(e, "ValidationError");
|
|
6963
6985
|
}
|
|
6964
6986
|
let n = await this._resolveFolderByPath(e);
|
|
6965
6987
|
if (n) return n;
|
|
@@ -6972,7 +6994,7 @@ var ka = class {
|
|
|
6972
6994
|
if (i) {
|
|
6973
6995
|
if (!i.isFolder) {
|
|
6974
6996
|
let t = "Path component '%s' in '%s' is not a folder".replace("%s", n).replace("%s", e);
|
|
6975
|
-
throw new
|
|
6997
|
+
throw new j(t, "ValidationError");
|
|
6976
6998
|
}
|
|
6977
6999
|
r = {
|
|
6978
7000
|
id: i.id,
|
|
@@ -6980,7 +7002,7 @@ var ka = class {
|
|
|
6980
7002
|
parentId: i.folderId
|
|
6981
7003
|
};
|
|
6982
7004
|
} else {
|
|
6983
|
-
if (typeof this._dataProvider.createFolder != "function") throw new
|
|
7005
|
+
if (typeof this._dataProvider.createFolder != "function") throw new j("Create folder operation is not supported by data provider", "UnsupportedOperation");
|
|
6984
7006
|
r = await this.createFolder({
|
|
6985
7007
|
name: n,
|
|
6986
7008
|
parentId: r?.id
|
|
@@ -6993,7 +7015,7 @@ var ka = class {
|
|
|
6993
7015
|
let e = await this._findOrCreateFolderByPath(this._getTrashPath());
|
|
6994
7016
|
if (!e) {
|
|
6995
7017
|
let e = "Trash folder path '%s' could not be resolved".replace("%s", this._getTrashPath());
|
|
6996
|
-
throw new
|
|
7018
|
+
throw new j(e, "FolderNotFound");
|
|
6997
7019
|
}
|
|
6998
7020
|
return e;
|
|
6999
7021
|
}
|
|
@@ -7002,7 +7024,7 @@ var ka = class {
|
|
|
7002
7024
|
if (e) try {
|
|
7003
7025
|
return await this._findOrCreateFolderByPath(e);
|
|
7004
7026
|
} catch (e) {
|
|
7005
|
-
if (e instanceof
|
|
7027
|
+
if (e instanceof j && e.code === "ValidationError") throw e;
|
|
7006
7028
|
console.warn("getTempFolder: temp folder unavailable, falling back to root", e);
|
|
7007
7029
|
return;
|
|
7008
7030
|
}
|
|
@@ -7075,10 +7097,10 @@ var ka = class {
|
|
|
7075
7097
|
};
|
|
7076
7098
|
}
|
|
7077
7099
|
_validateName(e, t = !1) {
|
|
7078
|
-
if (!e || e.trim().length === 0) throw new
|
|
7100
|
+
if (!e || e.trim().length === 0) throw new j(t ? "Folder name cannot be empty" : "File name cannot be empty", t ? "FolderInvalidName" : "FileInvalidName");
|
|
7079
7101
|
if (/[/\\:*?"<>|]/.test(e)) {
|
|
7080
7102
|
let n = t ? "FolderInvalidName" : "FileInvalidName", r = t ? "Folder name contains invalid characters: %s".replace("%s", e) : "File name contains invalid characters: %s".replace("%s", e);
|
|
7081
|
-
throw new
|
|
7103
|
+
throw new j(r, n);
|
|
7082
7104
|
}
|
|
7083
7105
|
}
|
|
7084
7106
|
_validateTargetFolderType(e) {
|
|
@@ -7087,7 +7109,7 @@ var ka = class {
|
|
|
7087
7109
|
let n = this._cache.getEntity(t);
|
|
7088
7110
|
if (n && !n.isFolder) {
|
|
7089
7111
|
let t = "Target item with id '%s' is not a folder".replace("%s", e);
|
|
7090
|
-
throw new
|
|
7112
|
+
throw new j(t, "ValidationError");
|
|
7091
7113
|
}
|
|
7092
7114
|
}
|
|
7093
7115
|
_checkNameExistsInCache(e, t, n, r) {
|
|
@@ -7273,10 +7295,10 @@ var ka = class {
|
|
|
7273
7295
|
childrenCount: e.childCount
|
|
7274
7296
|
});
|
|
7275
7297
|
if (typeof this._dataProvider.getFileData == "function") return await this._dataProvider.getFileData(i, r);
|
|
7276
|
-
if (!i.url && typeof this._dataProvider.getUrl != "function") throw new
|
|
7298
|
+
if (!i.url && typeof this._dataProvider.getUrl != "function") throw new j("Cannot read file", "FileReadError");
|
|
7277
7299
|
let a = i.url || (typeof this._dataProvider.getUrl == "function" ? await this._dataProvider.getUrl(i) : "");
|
|
7278
7300
|
if (a) return (await (this._config.fetchWithProxy ?? fetch)(a, r?.forceReload ? { cache: "no-store" } : void 0)).blob();
|
|
7279
|
-
throw new
|
|
7301
|
+
throw new j("Unable to get file data", "FileReadError");
|
|
7280
7302
|
}
|
|
7281
7303
|
async findFileByUrl(e) {
|
|
7282
7304
|
let t = this._cache.searchByUrl(e);
|
|
@@ -7325,10 +7347,10 @@ var ka = class {
|
|
|
7325
7347
|
}
|
|
7326
7348
|
async _uploadFile(e) {
|
|
7327
7349
|
let t = this.normalizeId(e.folderId ?? this._rootId);
|
|
7328
|
-
if (typeof this._dataProvider.uploadFile != "function") throw new
|
|
7350
|
+
if (typeof this._dataProvider.uploadFile != "function") throw new j("Upload file operation is not supported by data provider", "UnsupportedOperation");
|
|
7329
7351
|
if (this._validateName(e.name, !1), this._validateDuplicates && this._checkNameExistsInCache(t, e.name, !1)) {
|
|
7330
7352
|
let t = "File '%s' already exists in target folder".replace("%s", e.name);
|
|
7331
|
-
throw new
|
|
7353
|
+
throw new j(t, "FileAlreadyExists");
|
|
7332
7354
|
}
|
|
7333
7355
|
let n = await this._dataProvider.uploadFile({
|
|
7334
7356
|
...e,
|
|
@@ -7358,7 +7380,7 @@ var ka = class {
|
|
|
7358
7380
|
let t = this.normalizeId(e.folderId ?? i);
|
|
7359
7381
|
if (this._checkNameExistsInCache(t, e.name, !1)) {
|
|
7360
7382
|
let t = "File '%s' already exists in target folder".replace("%s", e.name);
|
|
7361
|
-
throw new
|
|
7383
|
+
throw new j(t, "FileAlreadyExists");
|
|
7362
7384
|
}
|
|
7363
7385
|
}
|
|
7364
7386
|
}
|
|
@@ -7421,7 +7443,7 @@ var ka = class {
|
|
|
7421
7443
|
};
|
|
7422
7444
|
}
|
|
7423
7445
|
})), a.success = !a.detailed.some((e) => !e.success);
|
|
7424
|
-
else throw new
|
|
7446
|
+
else throw new j("Upload files is not supported by data provider", "UnsupportedOperation");
|
|
7425
7447
|
if (a.success && this._enableTrash) try {
|
|
7426
7448
|
this._cache.forceInvalidate(i);
|
|
7427
7449
|
} catch {}
|
|
@@ -7478,7 +7500,7 @@ var ka = class {
|
|
|
7478
7500
|
return {
|
|
7479
7501
|
requestId: e,
|
|
7480
7502
|
success: !1,
|
|
7481
|
-
error: new
|
|
7503
|
+
error: new j(t, "FileNotFound")
|
|
7482
7504
|
};
|
|
7483
7505
|
}
|
|
7484
7506
|
try {
|
|
@@ -7503,9 +7525,9 @@ var ka = class {
|
|
|
7503
7525
|
let t = this._cache.getEntity(e);
|
|
7504
7526
|
if (!t) {
|
|
7505
7527
|
let t = "Item with id '%s' not found in cache".replace("%s", e);
|
|
7506
|
-
throw new
|
|
7528
|
+
throw new j(t, "FileNotFound");
|
|
7507
7529
|
}
|
|
7508
|
-
if (typeof this._dataProvider.deleteItem != "function") throw new
|
|
7530
|
+
if (typeof this._dataProvider.deleteItem != "function") throw new j("Delete item operation is not supported by data provider", "DeleteNotAllowed");
|
|
7509
7531
|
if (await this._dataProvider.deleteItem(t, { permanent: !0 }), this._cache.deleteEntity(e), this._enableTrash) try {
|
|
7510
7532
|
let e = await this.getTrashFolder();
|
|
7511
7533
|
e && this._cache.forceInvalidate(e.id);
|
|
@@ -7513,7 +7535,7 @@ var ka = class {
|
|
|
7513
7535
|
return !0;
|
|
7514
7536
|
}
|
|
7515
7537
|
async cleanTrash() {
|
|
7516
|
-
if (!this._enableTrash) throw new
|
|
7538
|
+
if (!this._enableTrash) throw new j("Trash is not enabled", "UnsupportedOperation");
|
|
7517
7539
|
if (typeof this._dataProvider.cleanTrash == "function") {
|
|
7518
7540
|
let e = await this._dataProvider.cleanTrash();
|
|
7519
7541
|
try {
|
|
@@ -7522,13 +7544,13 @@ var ka = class {
|
|
|
7522
7544
|
} catch {}
|
|
7523
7545
|
return e;
|
|
7524
7546
|
}
|
|
7525
|
-
throw new
|
|
7547
|
+
throw new j("Clean trash is not supported by data provider", "UnsupportedOperation");
|
|
7526
7548
|
}
|
|
7527
7549
|
async createFolder({ name: e, parentId: t, is_force_create: n }) {
|
|
7528
7550
|
let r = this.normalizeId(t ?? this._rootId);
|
|
7529
7551
|
if (this._validateName(e, !0), this._validateDuplicates && this._checkNameExistsInCache(r, e, !0)) {
|
|
7530
7552
|
let t = "Folder '%s' already exists in parent folder".replace("%s", e);
|
|
7531
|
-
throw new
|
|
7553
|
+
throw new j(t, "FolderAlreadyExists");
|
|
7532
7554
|
}
|
|
7533
7555
|
let i = await this._dataProvider.createFolder(e, r, n), a = Ta({
|
|
7534
7556
|
id: i.id,
|
|
@@ -7562,17 +7584,17 @@ var ka = class {
|
|
|
7562
7584
|
}
|
|
7563
7585
|
}
|
|
7564
7586
|
async renameFolder(e, t) {
|
|
7565
|
-
if (typeof this._dataProvider.renameItem != "function") throw new
|
|
7587
|
+
if (typeof this._dataProvider.renameItem != "function") throw new j("Rename folder is not supported", "RenameNotAllowed");
|
|
7566
7588
|
let n = this.normalizeId(e), r = this._cache.getEntity(n);
|
|
7567
7589
|
if (!r) {
|
|
7568
7590
|
let t = "Folder with id '%s' not found in cache".replace("%s", e);
|
|
7569
|
-
throw new
|
|
7591
|
+
throw new j(t, "FolderNotFound");
|
|
7570
7592
|
}
|
|
7571
7593
|
if (this._validateName(t, !0), this._validateDuplicates) {
|
|
7572
7594
|
let e = this.normalizeId(r.folderId);
|
|
7573
7595
|
if (this._checkNameExistsInCache(e, t, !0, n)) {
|
|
7574
7596
|
let e = "Folder '%s' already exists in parent folder".replace("%s", t);
|
|
7575
|
-
throw new
|
|
7597
|
+
throw new j(e, "FolderAlreadyExists");
|
|
7576
7598
|
}
|
|
7577
7599
|
}
|
|
7578
7600
|
let i = Da(await this._dataProvider.renameItem(r, t));
|
|
@@ -7582,18 +7604,18 @@ var ka = class {
|
|
|
7582
7604
|
})), this._cache.getEntity(i.id);
|
|
7583
7605
|
}
|
|
7584
7606
|
async renameFile(e, t) {
|
|
7585
|
-
if (typeof this._dataProvider.renameItem != "function") throw new
|
|
7607
|
+
if (typeof this._dataProvider.renameItem != "function") throw new j("Rename file is not supported", "RenameNotAllowed");
|
|
7586
7608
|
let n = this._cache.getEntity(e);
|
|
7587
7609
|
if (!n) {
|
|
7588
7610
|
let t = "File with id '%s' not found in cache".replace("%s", e);
|
|
7589
|
-
throw new
|
|
7611
|
+
throw new j(t, "FileNotFound");
|
|
7590
7612
|
}
|
|
7591
7613
|
let r = this.normalizeId(e);
|
|
7592
7614
|
if (this._validateName(t, !1), this._validateDuplicates) {
|
|
7593
7615
|
let e = this.normalizeId(n.folderId);
|
|
7594
7616
|
if (this._checkNameExistsInCache(e, t, !1, r)) {
|
|
7595
7617
|
let e = "File '%s' already exists in parent folder".replace("%s", t);
|
|
7596
|
-
throw new
|
|
7618
|
+
throw new j(e, "FileAlreadyExists");
|
|
7597
7619
|
}
|
|
7598
7620
|
}
|
|
7599
7621
|
let i = Da(await this._dataProvider.renameItem(n, t));
|
|
@@ -7603,7 +7625,7 @@ var ka = class {
|
|
|
7603
7625
|
})), this._cache.getEntity(r);
|
|
7604
7626
|
}
|
|
7605
7627
|
async moveItem({ itemId: e, targetFolderId: t, isFolder: n }) {
|
|
7606
|
-
if (typeof this._dataProvider.moveItem != "function") throw new
|
|
7628
|
+
if (typeof this._dataProvider.moveItem != "function") throw new j("Move item operation is not supported by data provider", "MoveNotAllowed");
|
|
7607
7629
|
let r = this.normalizeId(t);
|
|
7608
7630
|
this._validateTargetFolderType(t);
|
|
7609
7631
|
let i = this._cache.getEntity(e);
|
|
@@ -7629,12 +7651,12 @@ var ka = class {
|
|
|
7629
7651
|
return !0;
|
|
7630
7652
|
}
|
|
7631
7653
|
if (i.isFolder) {
|
|
7632
|
-
if (e === r) throw new
|
|
7633
|
-
if (this._isAncestor(e, r)) throw new
|
|
7654
|
+
if (e === r) throw new j("Cannot move folder into itself", "MoveIntoSelf");
|
|
7655
|
+
if (this._isAncestor(e, r)) throw new j("Cannot move folder into its descendant", "MoveIntoDescendant");
|
|
7634
7656
|
}
|
|
7635
7657
|
if (this._validateDuplicates && r !== this.normalizeId(i.folderId) && i.name && this._checkNameExistsInCache(r, i.name, !!i.isFolder, e)) {
|
|
7636
7658
|
let e = i.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
|
|
7637
|
-
throw new
|
|
7659
|
+
throw new j(`${i.isFolder ? "Folder" : "File"} '${i.name}' already exists in target folder`, e);
|
|
7638
7660
|
}
|
|
7639
7661
|
let a = Da(await this._dataProvider.moveItem(i, r));
|
|
7640
7662
|
if (a.id === e) {
|
|
@@ -7661,16 +7683,16 @@ var ka = class {
|
|
|
7661
7683
|
if (e.isFolder) {
|
|
7662
7684
|
if (e.id === n) {
|
|
7663
7685
|
let t = "Cannot move folder '%s' into itself".replace("%s", e.name);
|
|
7664
|
-
throw new
|
|
7686
|
+
throw new j(t, "MoveIntoSelf");
|
|
7665
7687
|
}
|
|
7666
7688
|
if (this._isAncestor(e.id, n)) {
|
|
7667
7689
|
let t = "Cannot move folder '%s' into its descendant".replace("%s", e.name);
|
|
7668
|
-
throw new
|
|
7690
|
+
throw new j(t, "MoveIntoDescendant");
|
|
7669
7691
|
}
|
|
7670
7692
|
}
|
|
7671
7693
|
if (this._validateDuplicates && n !== this.normalizeId(e.folderId) && e.name && this._checkNameExistsInCache(n, e.name, !!e.isFolder, e.id)) {
|
|
7672
7694
|
let t = e.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
|
|
7673
|
-
throw new
|
|
7695
|
+
throw new j(`${e.isFolder ? "Folder" : "File"} '${e.name}' already exists in target folder`, t);
|
|
7674
7696
|
}
|
|
7675
7697
|
}
|
|
7676
7698
|
let i = {
|
|
@@ -7699,7 +7721,7 @@ var ka = class {
|
|
|
7699
7721
|
};
|
|
7700
7722
|
}
|
|
7701
7723
|
}));
|
|
7702
|
-
else throw new
|
|
7724
|
+
else throw new j("Move items is not supported", "MoveNotAllowed");
|
|
7703
7725
|
if (i.success) {
|
|
7704
7726
|
let e = i.detailed || t.map((e) => ({
|
|
7705
7727
|
requestId: e,
|
|
@@ -7725,11 +7747,11 @@ var ka = class {
|
|
|
7725
7747
|
}
|
|
7726
7748
|
return {
|
|
7727
7749
|
success: !1,
|
|
7728
|
-
error: i.error || new
|
|
7750
|
+
error: i.error || new j("Move items failed", "MoveNotAllowed")
|
|
7729
7751
|
};
|
|
7730
7752
|
}
|
|
7731
7753
|
async copyItem({ itemId: e, targetFolderId: t }) {
|
|
7732
|
-
if (typeof this._dataProvider.copyItem != "function") throw new
|
|
7754
|
+
if (typeof this._dataProvider.copyItem != "function") throw new j("Copy item is not supported", "CopyNotAllowed");
|
|
7733
7755
|
let n = this.normalizeId(t);
|
|
7734
7756
|
this._validateTargetFolderType(t);
|
|
7735
7757
|
let r = this._cache.getEntity(e);
|
|
@@ -7747,7 +7769,7 @@ var ka = class {
|
|
|
7747
7769
|
let t = n === this.normalizeId(r.folderId) ? e : void 0;
|
|
7748
7770
|
if (this._checkNameExistsInCache(n, r.name, !!r.isFolder, t)) {
|
|
7749
7771
|
let e = r.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
|
|
7750
|
-
throw new
|
|
7772
|
+
throw new j(`${r.isFolder ? "Folder" : "File"} '${r.name}' already exists in target folder`, e);
|
|
7751
7773
|
}
|
|
7752
7774
|
}
|
|
7753
7775
|
let i = Da(await this._dataProvider.copyItem(r, n));
|
|
@@ -7775,7 +7797,7 @@ var ka = class {
|
|
|
7775
7797
|
let r = n === this.normalizeId(t.folderId) ? i[e] : void 0;
|
|
7776
7798
|
if (this._checkNameExistsInCache(n, t.name, !!t.isFolder, r)) {
|
|
7777
7799
|
let e = t.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
|
|
7778
|
-
throw new
|
|
7800
|
+
throw new j(`${t.isFolder ? "Folder" : "File"} '${t.name}' already exists in target folder`, e);
|
|
7779
7801
|
}
|
|
7780
7802
|
}
|
|
7781
7803
|
}
|
|
@@ -7804,7 +7826,7 @@ var ka = class {
|
|
|
7804
7826
|
};
|
|
7805
7827
|
}
|
|
7806
7828
|
}));
|
|
7807
|
-
else throw new
|
|
7829
|
+
else throw new j("Copy items is not supported", "CopyNotAllowed");
|
|
7808
7830
|
if (o.success && o.detailed) for (let e = 0, t = o.detailed.length; e < t; e++) {
|
|
7809
7831
|
let t = o.detailed[e];
|
|
7810
7832
|
if (t.success) {
|
|
@@ -7820,7 +7842,7 @@ var ka = class {
|
|
|
7820
7842
|
} else console.error("batchResult in copy method must have ids");
|
|
7821
7843
|
}
|
|
7822
7844
|
}
|
|
7823
|
-
else if (!o.detailed) throw new
|
|
7845
|
+
else if (!o.detailed) throw new j("batchResult in copy method must have detailed results", "ValidationError");
|
|
7824
7846
|
return o;
|
|
7825
7847
|
}
|
|
7826
7848
|
async uploadFileByUrl(e) {
|
|
@@ -7843,17 +7865,17 @@ var ka = class {
|
|
|
7843
7865
|
}
|
|
7844
7866
|
}
|
|
7845
7867
|
async updateFile(e, t) {
|
|
7846
|
-
if (typeof this._dataProvider.updateFile != "function") throw new
|
|
7868
|
+
if (typeof this._dataProvider.updateFile != "function") throw new j("Update file is not supported", "UnsupportedOperation");
|
|
7847
7869
|
let n = this.normalizeId(e), r = this._cache.getEntity(n);
|
|
7848
7870
|
if (!r) {
|
|
7849
7871
|
let t = "File with id '%s' not found in cache".replace("%s", e);
|
|
7850
|
-
throw new
|
|
7872
|
+
throw new j(t, "FileNotFound");
|
|
7851
7873
|
}
|
|
7852
7874
|
if (t.name && t.name !== r.name && this._validateName(t.name, !1), this._validateDuplicates && t.name && t.name !== r.name) {
|
|
7853
7875
|
let e = this.normalizeId(r.folderId);
|
|
7854
7876
|
if (this._checkNameExistsInCache(e, t.name, !1, n)) {
|
|
7855
7877
|
let e = "File '%s' already exists in parent folder".replace("%s", t.name);
|
|
7856
|
-
throw new
|
|
7878
|
+
throw new j(e, "FileAlreadyExists");
|
|
7857
7879
|
}
|
|
7858
7880
|
}
|
|
7859
7881
|
let i = Da(await this._dataProvider.updateFile(r, { ...t }));
|
|
@@ -7936,7 +7958,7 @@ var ka = class {
|
|
|
7936
7958
|
if (n) return `unknown folder ${e}`;
|
|
7937
7959
|
{
|
|
7938
7960
|
let t = `Path for id '${e}' not found in mapping`;
|
|
7939
|
-
throw new
|
|
7961
|
+
throw new j(t, "FileNotFound");
|
|
7940
7962
|
}
|
|
7941
7963
|
}
|
|
7942
7964
|
let i = 0;
|
|
@@ -7979,7 +8001,7 @@ var ka = class {
|
|
|
7979
8001
|
};
|
|
7980
8002
|
}
|
|
7981
8003
|
async renameItem(e, t) {
|
|
7982
|
-
if (typeof this._inner.renameItem != "function") throw new
|
|
8004
|
+
if (typeof this._inner.renameItem != "function") throw new j("Rename item is not supported by inner storage", "RenameNotAllowed");
|
|
7983
8005
|
let n = this.pathForId(e.id, e.isFolder ?? !1), r = n, { ...i } = await this._inner.renameItem({
|
|
7984
8006
|
...e,
|
|
7985
8007
|
id: n,
|
|
@@ -7994,7 +8016,7 @@ var ka = class {
|
|
|
7994
8016
|
};
|
|
7995
8017
|
}
|
|
7996
8018
|
async deleteItem(e, t) {
|
|
7997
|
-
if (typeof this._inner.deleteItem != "function") throw new
|
|
8019
|
+
if (typeof this._inner.deleteItem != "function") throw new j("Delete item is not supported by inner storage", "DeleteNotAllowed");
|
|
7998
8020
|
let n = this.pathForId(e.id, e.isFolder ?? !1);
|
|
7999
8021
|
await this._inner.deleteItem({
|
|
8000
8022
|
...e,
|
|
@@ -8003,7 +8025,7 @@ var ka = class {
|
|
|
8003
8025
|
}, t), this.recursivelyRemoveMappings(e.id, n);
|
|
8004
8026
|
}
|
|
8005
8027
|
async uploadFile(e) {
|
|
8006
|
-
if (typeof this._inner.uploadFile != "function") throw new
|
|
8028
|
+
if (typeof this._inner.uploadFile != "function") throw new j("Upload file is not supported by inner storage", "UnsupportedOperation");
|
|
8007
8029
|
let t = e.folderId ? this.pathForId(e.folderId, !0) : this.rootPath, n = await this._inner.uploadFile({
|
|
8008
8030
|
...e,
|
|
8009
8031
|
folderId: t
|
|
@@ -8061,7 +8083,7 @@ var ka = class {
|
|
|
8061
8083
|
};
|
|
8062
8084
|
}
|
|
8063
8085
|
async moveItem(e, t) {
|
|
8064
|
-
if (typeof this._inner.moveItem != "function") throw new
|
|
8086
|
+
if (typeof this._inner.moveItem != "function") throw new j("Move item is not supported by inner storage", "MoveNotAllowed");
|
|
8065
8087
|
let n = this.pathForId(e.id, e.isFolder ?? !1), r = t ? this.pathForId(t, !0) : this.rootPath, i = await this._inner.moveItem({
|
|
8066
8088
|
...e,
|
|
8067
8089
|
id: n,
|
|
@@ -8076,7 +8098,7 @@ var ka = class {
|
|
|
8076
8098
|
};
|
|
8077
8099
|
}
|
|
8078
8100
|
async moveItems(e, t) {
|
|
8079
|
-
if (typeof this._inner.moveItems != "function") throw new
|
|
8101
|
+
if (typeof this._inner.moveItems != "function") throw new j("Move items is not supported by inner storage", "MoveNotAllowed");
|
|
8080
8102
|
let n = t ? this.pathForId(t, !0) : this.rootPath, r = e.map((e) => ({
|
|
8081
8103
|
...e,
|
|
8082
8104
|
id: this.pathForId(e.id, e.isFolder ?? !1),
|
|
@@ -8128,7 +8150,7 @@ var ka = class {
|
|
|
8128
8150
|
};
|
|
8129
8151
|
}
|
|
8130
8152
|
async copyItems(e, t) {
|
|
8131
|
-
if (typeof this._inner.copyItems != "function") throw new
|
|
8153
|
+
if (typeof this._inner.copyItems != "function") throw new j("Copy items is not supported by inner storage", "CopyNotAllowed");
|
|
8132
8154
|
let n = t ? this.pathForId(t, !0) : this.rootPath, r = e.map((e) => ({
|
|
8133
8155
|
...e,
|
|
8134
8156
|
id: this.pathForId(e.id, e.isFolder ?? !1),
|
|
@@ -8196,7 +8218,7 @@ var ka = class {
|
|
|
8196
8218
|
};
|
|
8197
8219
|
}
|
|
8198
8220
|
async deleteItems(e, t) {
|
|
8199
|
-
if (typeof this._inner.deleteItems != "function") throw new
|
|
8221
|
+
if (typeof this._inner.deleteItems != "function") throw new j("Delete items is not supported by inner storage", "DeleteNotAllowed");
|
|
8200
8222
|
let n = e.map((e) => ({
|
|
8201
8223
|
...e,
|
|
8202
8224
|
id: this.pathForId(e.id, e.isFolder ?? !1),
|
|
@@ -8282,7 +8304,7 @@ var ka = class {
|
|
|
8282
8304
|
for (let e = 0; e < r.length; e++) this._idToPath.delete(r[e]), this._pathToId.delete(i[e]);
|
|
8283
8305
|
}
|
|
8284
8306
|
async copyItem(e, t) {
|
|
8285
|
-
if (typeof this._inner.copyItem != "function") throw new
|
|
8307
|
+
if (typeof this._inner.copyItem != "function") throw new j("Copy item is not supported by inner storage", "CopyNotAllowed");
|
|
8286
8308
|
let n = this.pathForId(e.id, e.isFolder ?? !1), r = t ? this.pathForId(t, !0) : this.rootPath, i = await this._inner.copyItem({
|
|
8287
8309
|
...e,
|
|
8288
8310
|
id: n,
|
|
@@ -8295,7 +8317,7 @@ var ka = class {
|
|
|
8295
8317
|
};
|
|
8296
8318
|
}
|
|
8297
8319
|
async updateFile(e, t) {
|
|
8298
|
-
if (typeof this._inner.updateFile != "function") throw new
|
|
8320
|
+
if (typeof this._inner.updateFile != "function") throw new j("Update file is not supported by inner storage", "UnsupportedOperation");
|
|
8299
8321
|
let n = this.pathForId(e.id, !1), { ...r } = await this._inner.updateFile({
|
|
8300
8322
|
...e,
|
|
8301
8323
|
id: n,
|
|
@@ -8317,11 +8339,11 @@ var ka = class {
|
|
|
8317
8339
|
folderId: this.pathForId(e.folderId ?? "", !0)
|
|
8318
8340
|
}, t);
|
|
8319
8341
|
let r = e.url || (typeof this.getUrl == "function" ? await this.getUrl(e) : void 0);
|
|
8320
|
-
if (!r) throw new
|
|
8342
|
+
if (!r) throw new j("Cannot get file data: no url and no inner.getFileData", "FileReadError");
|
|
8321
8343
|
return fetch(r, t?.forceReload ? { cache: "no-store" } : void 0).then((e) => e.blob());
|
|
8322
8344
|
}
|
|
8323
8345
|
async cleanTrash() {
|
|
8324
|
-
if (typeof this._inner.cleanTrash != "function") throw new
|
|
8346
|
+
if (typeof this._inner.cleanTrash != "function") throw new j("Clean trash is not supported by inner storage", "UnsupportedOperation");
|
|
8325
8347
|
return await this._inner.cleanTrash();
|
|
8326
8348
|
}
|
|
8327
8349
|
}, Na = {
|
|
@@ -8332,6 +8354,6 @@ var ka = class {
|
|
|
8332
8354
|
initFileManager: Ri
|
|
8333
8355
|
};
|
|
8334
8356
|
//#endregion
|
|
8335
|
-
export { ia as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, ka as DataSourceProxyBase, Vi as FailedRequestCache, _r as FileContent,
|
|
8357
|
+
export { ia as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, ka as DataSourceProxyBase, Vi as FailedRequestCache, _r as FileContent, j as FileManagerApiError, Ti as FileManagerApp, Ai as FileManagerAppWithContext, yr as FileModals, Fi as FilerobotOnlyApp, xr as FolderSidebar, Hi as MutationRegistry, Ma as PathAwareStorageAdapter, Qi as TRASH_FOLDER_ID, ha as TreeCache, ma as ViewCacheManager, De as buildAssetsPath, Wi as compareFileSystemItems, ta as createSystemFolderByPathResolver, Na as default, Yi as defaultChildrenViewFilterMatch, Ji as defaultFileSystemItemComparator, Xi as defaultHasSortValue, ua as defaultIsFolderNotFoundError, ue as fetchRemoteImageBlobByUrl, we as getAssetsBase, Ae as getImageEditorTranslations, ea as getTrashFolderLookupCandidates, Ki as hasComparableSortValue, Mi as init, Ri as initFileManager, Ii as initFilerobotEditor, En as installResizeObserverErrorHandler, Te as joinUrls, zi as mapHttpStatusToErrorCode, qi as matchesChildrenViewFilter, $i as normalizeSystemFolderPath, Ui as resolveSortParams, Zi as resolveViewStrategyOptions, Dn as uninstallResizeObserverErrorHandler, Ni as unmount, Li as unmountFilerobotEditor };
|
|
8336
8358
|
|
|
8337
8359
|
//# sourceMappingURL=file-manager.esm.js.map
|