@cocoar/vue-file-explorer-core 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +138 -149
- package/dist/use-file-explorer.d.ts +13 -1
- package/dist/use-file-explorer.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -358,20 +358,22 @@ function g(s) {
|
|
|
358
358
|
}, D = (e) => {
|
|
359
359
|
let t = v.value.filter((t) => t.parentId === e), n = E(w.value);
|
|
360
360
|
return n ? t.sort(n) : t;
|
|
361
|
-
}, ee = e(() => D(null)),
|
|
361
|
+
}, ee = e(() => D(null)), O = "loadChildren" in c && typeof c.loadChildren == "function", k = r(/* @__PURE__ */ new Set()), te = (e) => e.id, ne = (e) => {
|
|
362
|
+
if (e.kind === "folder" && !(O && !k.value.has(e.id))) return D(e.id);
|
|
363
|
+
}, re = (e) => e.name, ie = (e) => e.kind === "folder" && e.hasChildren !== !1, A = s.initialExpandedIds ?? (O ? [] : v.value.filter((e) => e.parentId === null && e.kind === "folder").map((e) => e.id)), j = r(new Set(A)), M = r(null), N = r(/* @__PURE__ */ new Set()), P = r(/* @__PURE__ */ new Set()), F = (e, t, n) => {
|
|
362
364
|
let r = new Set(e.value);
|
|
363
365
|
n ? r.add(t) : r.delete(t), e.value = r;
|
|
364
|
-
},
|
|
366
|
+
}, I = i([]), L = r(null), ae = e(() => I.value.find((e) => e.id === L.value) ?? null), R = (e) => e.content !== e.savedContent, z = e(() => I.value.some(R)), B = (e) => v.value.find((t) => t.id === e) ?? null, oe = e(() => M.value ? B(M.value) : null), se = (e) => {
|
|
365
367
|
let t = new Set([e]), n = !0;
|
|
366
368
|
for (; n;) {
|
|
367
369
|
n = !1;
|
|
368
370
|
for (let e of v.value) e.parentId && t.has(e.parentId) && !t.has(e.id) && (t.add(e.id), n = !0);
|
|
369
371
|
}
|
|
370
372
|
return t;
|
|
371
|
-
},
|
|
372
|
-
meta: e.kind === "file" ?
|
|
373
|
-
path:
|
|
374
|
-
}),
|
|
373
|
+
}, V = (e) => u(e, { getFileMeta: d }), H = (e) => h(e, {
|
|
374
|
+
meta: e.kind === "file" ? V(e) : null,
|
|
375
|
+
path: X(e.id)
|
|
376
|
+
}), U = /* @__PURE__ */ new Set(), W = async (e) => {
|
|
375
377
|
let t = u({
|
|
376
378
|
id: "",
|
|
377
379
|
name: e.name,
|
|
@@ -381,7 +383,7 @@ function g(s) {
|
|
|
381
383
|
if (!t) return console.warn(`[file-explorer] Unsupported file type: ${e.name}`), null;
|
|
382
384
|
if (t.editor === "pdf" || t.editor === "image") {
|
|
383
385
|
let n = URL.createObjectURL(e);
|
|
384
|
-
return
|
|
386
|
+
return U.add(n), {
|
|
385
387
|
content: n,
|
|
386
388
|
editor: t.editor
|
|
387
389
|
};
|
|
@@ -390,20 +392,20 @@ function g(s) {
|
|
|
390
392
|
content: await e.text(),
|
|
391
393
|
editor: t.editor
|
|
392
394
|
};
|
|
393
|
-
},
|
|
395
|
+
}, G = async (e, t) => {
|
|
394
396
|
try {
|
|
395
397
|
let n = await c.createFolder(e, t);
|
|
396
|
-
return b([n]), e && (
|
|
398
|
+
return b([n]), e && (j.value = new Set(j.value).add(e)), n;
|
|
397
399
|
} catch (n) {
|
|
398
400
|
return p("createFolder", n, {
|
|
399
401
|
parentId: e,
|
|
400
402
|
name: t
|
|
401
403
|
}), null;
|
|
402
404
|
}
|
|
403
|
-
},
|
|
405
|
+
}, ce = async (e, t) => {
|
|
404
406
|
let n = Array.from(t), r = !1;
|
|
405
407
|
for (let t of n) {
|
|
406
|
-
let n = await
|
|
408
|
+
let n = await W(t);
|
|
407
409
|
if (!n) continue;
|
|
408
410
|
let i;
|
|
409
411
|
try {
|
|
@@ -415,7 +417,7 @@ function g(s) {
|
|
|
415
417
|
});
|
|
416
418
|
continue;
|
|
417
419
|
}
|
|
418
|
-
b([i]), P
|
|
420
|
+
b([i]), F(P, i.id, !0);
|
|
419
421
|
try {
|
|
420
422
|
await c.save(i.id, n.content), r = !0;
|
|
421
423
|
} catch (e) {
|
|
@@ -424,30 +426,30 @@ function g(s) {
|
|
|
424
426
|
name: i.name
|
|
425
427
|
});
|
|
426
428
|
} finally {
|
|
427
|
-
P
|
|
429
|
+
F(P, i.id, !1);
|
|
428
430
|
}
|
|
429
431
|
}
|
|
430
|
-
r && e && (
|
|
432
|
+
r && e && (j.value = new Set(j.value).add(e));
|
|
431
433
|
}, le = async (e) => {
|
|
432
434
|
let t = se(e.id);
|
|
433
435
|
for (let e of t) {
|
|
434
436
|
let t = c._contents?.get(e);
|
|
435
|
-
typeof t == "string" &&
|
|
437
|
+
typeof t == "string" && U.has(t) && (URL.revokeObjectURL(t), U.delete(t));
|
|
436
438
|
}
|
|
437
|
-
t.size > 0 && (
|
|
439
|
+
t.size > 0 && (I.value = I.value.filter((e) => !t.has(e.id)), L.value && t.has(L.value) && (L.value = I.value[0]?.id ?? null)), F(P, e.id, !0);
|
|
438
440
|
try {
|
|
439
|
-
await c.delete(e.id), S(t);
|
|
441
|
+
await c.delete(e.id), S(t), O && t.size > 0 && (k.value = new Set([...k.value].filter((e) => !t.has(e))));
|
|
440
442
|
} catch (t) {
|
|
441
443
|
p("delete", t, {
|
|
442
444
|
id: e.id,
|
|
443
445
|
name: e.name
|
|
444
446
|
});
|
|
445
447
|
} finally {
|
|
446
|
-
P
|
|
448
|
+
F(P, e.id, !1);
|
|
447
449
|
}
|
|
448
|
-
},
|
|
450
|
+
}, ue = async (e) => {
|
|
449
451
|
let { source: t, target: n, position: r } = e, i = T.value;
|
|
450
|
-
P
|
|
452
|
+
F(P, t.id, !0);
|
|
451
453
|
try {
|
|
452
454
|
if (!n) {
|
|
453
455
|
await c.move(t.id, null), C(t.id, { parentId: null });
|
|
@@ -455,7 +457,7 @@ function g(s) {
|
|
|
455
457
|
}
|
|
456
458
|
if (r === "inside") {
|
|
457
459
|
if (n.kind !== "folder") return;
|
|
458
|
-
await c.move(t.id, n.id), C(t.id, { parentId: n.id }),
|
|
460
|
+
await c.move(t.id, n.id), C(t.id, { parentId: n.id }), j.value = new Set(j.value).add(n.id);
|
|
459
461
|
return;
|
|
460
462
|
}
|
|
461
463
|
if (!i) {
|
|
@@ -470,12 +472,12 @@ function g(s) {
|
|
|
470
472
|
name: t.name
|
|
471
473
|
});
|
|
472
474
|
} finally {
|
|
473
|
-
P
|
|
475
|
+
F(P, t.id, !1);
|
|
474
476
|
}
|
|
475
|
-
},
|
|
476
|
-
let n =
|
|
477
|
+
}, de = async (e, t) => {
|
|
478
|
+
let n = B(e);
|
|
477
479
|
if (!(!n || n.name === t)) {
|
|
478
|
-
P
|
|
480
|
+
F(P, e, !0);
|
|
479
481
|
try {
|
|
480
482
|
await c.rename(e, t), C(e, { name: t });
|
|
481
483
|
} catch (n) {
|
|
@@ -485,56 +487,56 @@ function g(s) {
|
|
|
485
487
|
});
|
|
486
488
|
return;
|
|
487
489
|
} finally {
|
|
488
|
-
P
|
|
490
|
+
F(P, e, !1);
|
|
489
491
|
}
|
|
490
492
|
if (n.kind === "file") {
|
|
491
|
-
let r =
|
|
493
|
+
let r = I.value.findIndex((t) => t.id === e);
|
|
492
494
|
if (r >= 0) {
|
|
493
|
-
let e = u(n, { getFileMeta: d }), i =
|
|
495
|
+
let e = u(n, { getFileMeta: d }), i = I.value.slice();
|
|
494
496
|
i[r] = {
|
|
495
497
|
...i[r],
|
|
496
498
|
name: t,
|
|
497
499
|
editor: e?.editor ?? i[r].editor,
|
|
498
500
|
language: e?.language
|
|
499
|
-
},
|
|
501
|
+
}, I.value = i;
|
|
500
502
|
}
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
}, K = (e) => {
|
|
504
|
-
let t =
|
|
505
|
-
if (t < 0 ||
|
|
506
|
-
let n =
|
|
506
|
+
let t = I.value.findIndex((t) => t.id === e);
|
|
507
|
+
if (t < 0 || I.value[t].pinned) return;
|
|
508
|
+
let n = I.value.slice();
|
|
507
509
|
n[t] = {
|
|
508
510
|
...n[t],
|
|
509
511
|
pinned: !0
|
|
510
|
-
},
|
|
511
|
-
},
|
|
512
|
+
}, I.value = n;
|
|
513
|
+
}, fe = (e, t, n) => {
|
|
512
514
|
if (e === t) return;
|
|
513
|
-
let r =
|
|
515
|
+
let r = I.value, i = r.findIndex((t) => t.id === e), a = r.findIndex((e) => e.id === t);
|
|
514
516
|
if (i < 0 || a < 0) return;
|
|
515
517
|
let o = r.slice(), [s] = o.splice(i, 1), c = i < a ? a - 1 : a, l = n === "before" ? c : c + 1;
|
|
516
|
-
o.splice(l, 0, s),
|
|
517
|
-
},
|
|
518
|
-
let t =
|
|
519
|
-
if (t < 0 || !
|
|
520
|
-
let n =
|
|
518
|
+
o.splice(l, 0, s), I.value = o;
|
|
519
|
+
}, pe = (e) => {
|
|
520
|
+
let t = I.value.findIndex((t) => t.id === e);
|
|
521
|
+
if (t < 0 || !I.value[t].pinned) return;
|
|
522
|
+
let n = I.value.filter((t) => t.pinned || t.id === e), r = n.findIndex((t) => t.id === e);
|
|
521
523
|
n[r] = {
|
|
522
524
|
...n[r],
|
|
523
525
|
pinned: !1
|
|
524
|
-
},
|
|
525
|
-
},
|
|
526
|
-
let n =
|
|
526
|
+
}, I.value = n;
|
|
527
|
+
}, me = (e, t) => {
|
|
528
|
+
let n = I.value.findIndex((t) => t.id === e);
|
|
527
529
|
if (n < 0) return;
|
|
528
|
-
let r =
|
|
530
|
+
let r = I.value.slice(), i = !r[n].pinned, a = t !== r[n].savedContent;
|
|
529
531
|
r[n] = {
|
|
530
532
|
...r[n],
|
|
531
533
|
content: t,
|
|
532
534
|
pinned: i && a ? !0 : r[n].pinned
|
|
533
|
-
},
|
|
535
|
+
}, I.value = r;
|
|
534
536
|
}, q = async (e, t = { pinned: !1 }) => {
|
|
535
|
-
let n =
|
|
537
|
+
let n = I.value.findIndex((t) => t.id === e.id);
|
|
536
538
|
if (n >= 0) {
|
|
537
|
-
t.pinned && !
|
|
539
|
+
t.pinned && !I.value[n].pinned && K(e.id), L.value = e.id;
|
|
538
540
|
return;
|
|
539
541
|
}
|
|
540
542
|
let r = u(e, { getFileMeta: d });
|
|
@@ -551,42 +553,42 @@ function g(s) {
|
|
|
551
553
|
savedContent: "",
|
|
552
554
|
pinned: t.pinned
|
|
553
555
|
};
|
|
554
|
-
if (t.pinned)
|
|
556
|
+
if (t.pinned) I.value = [...I.value, i];
|
|
555
557
|
else {
|
|
556
|
-
let e =
|
|
557
|
-
e >= 0 ? t.splice(e, 1, i) : t.push(i),
|
|
558
|
+
let e = I.value.findIndex((e) => !e.pinned), t = I.value.slice();
|
|
559
|
+
e >= 0 ? t.splice(e, 1, i) : t.push(i), I.value = t;
|
|
558
560
|
}
|
|
559
|
-
|
|
561
|
+
L.value = e.id;
|
|
560
562
|
let a;
|
|
561
|
-
|
|
563
|
+
F(N, e.id, !0);
|
|
562
564
|
try {
|
|
563
565
|
a = await c.loadContent(e.id);
|
|
564
566
|
} catch (t) {
|
|
565
567
|
p("loadContent", t, {
|
|
566
568
|
id: e.id,
|
|
567
569
|
name: e.name
|
|
568
|
-
}),
|
|
570
|
+
}), I.value = I.value.filter((t) => t.id !== e.id), L.value === e.id && (L.value = I.value[I.value.length - 1]?.id ?? null);
|
|
569
571
|
return;
|
|
570
572
|
} finally {
|
|
571
|
-
|
|
573
|
+
F(N, e.id, !1);
|
|
572
574
|
}
|
|
573
|
-
let o = typeof a == "string" ? a : "", s =
|
|
575
|
+
let o = typeof a == "string" ? a : "", s = I.value.findIndex((t) => t.id === e.id);
|
|
574
576
|
if (s >= 0) {
|
|
575
|
-
let e =
|
|
577
|
+
let e = I.value.slice();
|
|
576
578
|
e[s] = {
|
|
577
579
|
...e[s],
|
|
578
580
|
content: o,
|
|
579
581
|
savedContent: o
|
|
580
|
-
},
|
|
582
|
+
}, I.value = e;
|
|
581
583
|
}
|
|
582
|
-
},
|
|
584
|
+
}, he = (e) => {
|
|
583
585
|
e.kind === "file" && q(e, { pinned: !0 });
|
|
584
586
|
}, J = async (e) => {
|
|
585
|
-
let t =
|
|
587
|
+
let t = I.value.findIndex((t) => t.id === e);
|
|
586
588
|
if (t < 0) return !1;
|
|
587
|
-
let n =
|
|
588
|
-
if (!
|
|
589
|
-
P
|
|
589
|
+
let n = I.value[t];
|
|
590
|
+
if (!R(n)) return !0;
|
|
591
|
+
F(P, e, !0);
|
|
590
592
|
try {
|
|
591
593
|
await c.save(n.id, n.content);
|
|
592
594
|
} catch (t) {
|
|
@@ -595,81 +597,67 @@ function g(s) {
|
|
|
595
597
|
name: n.name
|
|
596
598
|
}), !1;
|
|
597
599
|
} finally {
|
|
598
|
-
P
|
|
600
|
+
F(P, e, !1);
|
|
599
601
|
}
|
|
600
|
-
let r =
|
|
602
|
+
let r = I.value.slice();
|
|
601
603
|
return r[t] = {
|
|
602
604
|
...n,
|
|
603
605
|
savedContent: n.content
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
|
|
607
|
-
}, ge = (e) => {
|
|
608
|
-
let t = F.value.findIndex((t) => t.id === e);
|
|
609
|
-
if (t < 0 || N.value.has(e)) return;
|
|
610
|
-
let n = F.value[t];
|
|
611
|
-
if (L(n) && !f(`Discard unsaved changes to "${n.name}"?`)) return;
|
|
612
|
-
let r = F.value.filter((t) => t.id !== e);
|
|
613
|
-
F.value = r, I.value === e && (I.value = r[t]?.id ?? r[t - 1]?.id ?? null);
|
|
606
|
+
}, I.value = r, !0;
|
|
607
|
+
}, ge = async () => {
|
|
608
|
+
L.value && await J(L.value);
|
|
614
609
|
}, _e = (e) => {
|
|
615
|
-
let t =
|
|
616
|
-
if (t
|
|
617
|
-
let n =
|
|
618
|
-
|
|
610
|
+
let t = I.value.findIndex((t) => t.id === e);
|
|
611
|
+
if (t < 0 || P.value.has(e)) return;
|
|
612
|
+
let n = I.value[t];
|
|
613
|
+
if (R(n) && !f(`Discard unsaved changes to "${n.name}"?`)) return;
|
|
614
|
+
let r = I.value.filter((t) => t.id !== e);
|
|
615
|
+
I.value = r, L.value === e && (L.value = r[t]?.id ?? r[t - 1]?.id ?? null);
|
|
619
616
|
}, ve = (e) => {
|
|
620
|
-
let t =
|
|
617
|
+
let t = I.value.filter((t) => t.id !== e && R(t));
|
|
618
|
+
if (t.length > 0 && !f(`Close ${I.value.length - 1 - t.length} other tabs? ${t.length} unsaved tab(s) will be kept open.`)) return;
|
|
619
|
+
let n = new Set([e, ...t.map((e) => e.id)]);
|
|
620
|
+
I.value = I.value.filter((e) => n.has(e.id)), L.value = e;
|
|
621
|
+
}, Y = (e) => {
|
|
622
|
+
let t = I.value.findIndex((t) => t.id === e);
|
|
621
623
|
if (t < 0) return;
|
|
622
|
-
let n =
|
|
623
|
-
r.length > 0 && !f(`Close ${n.length} tab(s)? ${r.length} have unsaved changes.`) || (
|
|
624
|
+
let n = I.value.slice(t + 1), r = n.filter(R);
|
|
625
|
+
r.length > 0 && !f(`Close ${n.length} tab(s)? ${r.length} have unsaved changes.`) || (I.value = I.value.slice(0, t + 1), L.value && !I.value.some((e) => e.id === L.value) && (L.value = e));
|
|
624
626
|
}, ye = () => {
|
|
625
|
-
let e =
|
|
626
|
-
e.length > 0 && !f(`Close all ${
|
|
627
|
+
let e = I.value.filter(R);
|
|
628
|
+
e.length > 0 && !f(`Close all ${I.value.length} tabs? ${e.length} have unsaved changes.`) || (I.value = [], L.value = null);
|
|
627
629
|
}, be = (e, n) => {
|
|
628
|
-
let r = new Set(
|
|
629
|
-
for (; i;) r.add(i), i =
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
let r = new Set(j.value), i = B(e)?.parentId ?? null;
|
|
631
|
+
for (; i;) r.add(i), i = B(i)?.parentId ?? null;
|
|
632
|
+
j.value = r, t(() => {
|
|
633
|
+
M.value = e, n?.(e);
|
|
632
634
|
});
|
|
633
635
|
};
|
|
634
|
-
function
|
|
635
|
-
let t = [], n =
|
|
636
|
-
for (; n;) t.unshift(n.name), n = n.parentId ?
|
|
636
|
+
function X(e) {
|
|
637
|
+
let t = [], n = B(e);
|
|
638
|
+
for (; n;) t.unshift(n.name), n = n.parentId ? B(n.parentId) : null;
|
|
637
639
|
return t;
|
|
638
640
|
}
|
|
639
|
-
let xe = e(() =>
|
|
640
|
-
o(
|
|
641
|
+
let xe = e(() => L.value ? X(L.value) : []);
|
|
642
|
+
o(M, (e) => {
|
|
641
643
|
if (!e) return;
|
|
642
|
-
let t =
|
|
644
|
+
let t = B(e);
|
|
643
645
|
t && t.kind === "file" && q(t, { pinned: !1 });
|
|
644
646
|
});
|
|
645
|
-
let
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
});
|
|
651
|
-
for (let e of n) if (!X.value.has(e)) {
|
|
652
|
-
P(M, e, !0);
|
|
653
|
-
try {
|
|
654
|
-
b(await c.loadChildren(e)), X.value = new Set(X.value).add(e);
|
|
655
|
-
} catch (t) {
|
|
656
|
-
p("loadChildren", t, { id: e });
|
|
657
|
-
} finally {
|
|
658
|
-
P(M, e, !1);
|
|
659
|
-
}
|
|
647
|
+
let Se = O ? async (e) => {
|
|
648
|
+
try {
|
|
649
|
+
b(await c.loadChildren(e.id)), k.value = new Set(k.value).add(e.id);
|
|
650
|
+
} catch (t) {
|
|
651
|
+
throw p("loadChildren", t, { id: e.id }), t;
|
|
660
652
|
}
|
|
661
|
-
}, {
|
|
662
|
-
deep: !0,
|
|
663
|
-
immediate: !0
|
|
664
|
-
});
|
|
665
|
-
let Z = !1, Q = async () => {
|
|
653
|
+
} : void 0, Z = !1, Q = async () => {
|
|
666
654
|
if (!_) {
|
|
667
655
|
y.value = !Z;
|
|
668
656
|
try {
|
|
669
657
|
let e = await c.loadTree();
|
|
670
|
-
if (x(e), !Z && (Z = !0, s.initialExpandedIds === void 0 && !
|
|
658
|
+
if (x(e), !Z && (Z = !0, s.initialExpandedIds === void 0 && !O)) {
|
|
671
659
|
let t = e.filter((e) => e.parentId === null && e.kind === "folder").map((e) => e.id);
|
|
672
|
-
t.length > 0 && (
|
|
660
|
+
t.length > 0 && (j.value = new Set([...j.value, ...t]));
|
|
673
661
|
}
|
|
674
662
|
} catch (e) {
|
|
675
663
|
p("loadTree", e, {});
|
|
@@ -677,18 +665,18 @@ function g(s) {
|
|
|
677
665
|
y.value = !1;
|
|
678
666
|
}
|
|
679
667
|
}
|
|
680
|
-
},
|
|
668
|
+
}, Ce = async (e) => {
|
|
681
669
|
if (!_) {
|
|
682
670
|
if (e == null) return Q();
|
|
683
|
-
if (
|
|
684
|
-
|
|
671
|
+
if (O) {
|
|
672
|
+
F(N, e, !0);
|
|
685
673
|
try {
|
|
686
674
|
let t = await c.loadChildren(e);
|
|
687
|
-
m.value = [...m.value.filter((t) => t.parentId !== e), ...t],
|
|
675
|
+
m.value = [...m.value.filter((t) => t.parentId !== e), ...t], k.value = new Set(k.value).add(e);
|
|
688
676
|
} catch (t) {
|
|
689
677
|
p("loadChildren", t, { id: e });
|
|
690
678
|
} finally {
|
|
691
|
-
|
|
679
|
+
F(N, e, !1);
|
|
692
680
|
}
|
|
693
681
|
return;
|
|
694
682
|
}
|
|
@@ -697,54 +685,55 @@ function g(s) {
|
|
|
697
685
|
};
|
|
698
686
|
Q();
|
|
699
687
|
let $ = (e) => {
|
|
700
|
-
|
|
688
|
+
z.value && (e.preventDefault(), e.returnValue = "");
|
|
701
689
|
};
|
|
702
690
|
return window.addEventListener("beforeunload", $), n(() => {
|
|
703
691
|
window.removeEventListener("beforeunload", $);
|
|
704
|
-
for (let e of
|
|
705
|
-
|
|
692
|
+
for (let e of U) URL.revokeObjectURL(e);
|
|
693
|
+
U.clear();
|
|
706
694
|
}), {
|
|
707
695
|
assets: v,
|
|
708
696
|
rootNodes: ee,
|
|
709
|
-
selectedId:
|
|
697
|
+
selectedId: M,
|
|
710
698
|
selectedAsset: oe,
|
|
711
|
-
expanded:
|
|
699
|
+
expanded: j,
|
|
712
700
|
getId: te,
|
|
713
701
|
getChildren: ne,
|
|
714
|
-
getLabel:
|
|
715
|
-
isExpandable:
|
|
702
|
+
getLabel: re,
|
|
703
|
+
isExpandable: ie,
|
|
704
|
+
loadChildren: Se,
|
|
716
705
|
reorderable: T,
|
|
717
706
|
loading: y,
|
|
718
|
-
loadingNodes:
|
|
719
|
-
savingNodes:
|
|
720
|
-
openTabs:
|
|
721
|
-
activeId:
|
|
707
|
+
loadingNodes: N,
|
|
708
|
+
savingNodes: P,
|
|
709
|
+
openTabs: I,
|
|
710
|
+
activeId: L,
|
|
722
711
|
activeTab: ae,
|
|
723
|
-
anyDirty:
|
|
724
|
-
isDirty:
|
|
725
|
-
setContent:
|
|
726
|
-
addFolder:
|
|
727
|
-
addFiles:
|
|
712
|
+
anyDirty: z,
|
|
713
|
+
isDirty: R,
|
|
714
|
+
setContent: me,
|
|
715
|
+
addFolder: G,
|
|
716
|
+
addFiles: ce,
|
|
728
717
|
deleteNode: le,
|
|
729
|
-
moveNode:
|
|
730
|
-
rename:
|
|
731
|
-
refresh:
|
|
718
|
+
moveNode: ue,
|
|
719
|
+
rename: de,
|
|
720
|
+
refresh: Ce,
|
|
732
721
|
openFile: q,
|
|
733
|
-
activateNode:
|
|
722
|
+
activateNode: he,
|
|
734
723
|
saveTab: J,
|
|
735
|
-
saveActive:
|
|
736
|
-
closeTab:
|
|
737
|
-
closeOthers:
|
|
738
|
-
closeToRight:
|
|
724
|
+
saveActive: ge,
|
|
725
|
+
closeTab: _e,
|
|
726
|
+
closeOthers: ve,
|
|
727
|
+
closeToRight: Y,
|
|
739
728
|
closeAll: ye,
|
|
740
729
|
pinTab: K,
|
|
741
|
-
unpinTab:
|
|
742
|
-
reorderTab:
|
|
730
|
+
unpinTab: pe,
|
|
731
|
+
reorderTab: fe,
|
|
743
732
|
revealInTree: be,
|
|
744
733
|
breadcrumbPath: xe,
|
|
745
|
-
pathOf:
|
|
746
|
-
fileMeta:
|
|
747
|
-
describeAsset:
|
|
734
|
+
pathOf: X,
|
|
735
|
+
fileMeta: V,
|
|
736
|
+
describeAsset: H
|
|
748
737
|
};
|
|
749
738
|
}
|
|
750
739
|
//#endregion
|
|
@@ -57,6 +57,14 @@ export interface UseFileExplorerReturn<T = unknown> {
|
|
|
57
57
|
getChildren: (a: Asset<T>) => readonly Asset<T>[] | undefined;
|
|
58
58
|
getLabel: (a: Asset<T>) => string;
|
|
59
59
|
isExpandable: (a: Asset<T>) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Lazy children loader for `<CoarTree :load-children>`. `undefined` for eager
|
|
62
|
+
* stores (everything is already visible). When set, the tree calls it on first
|
|
63
|
+
* expand of an unloaded folder, owns the per-node loading/error state, and the
|
|
64
|
+
* consumer renders the spinner from the `isLoading` slot prop. Re-throws so the
|
|
65
|
+
* tree flips the row to its error state + emits `@load-error`.
|
|
66
|
+
*/
|
|
67
|
+
loadChildren?: (node: Asset<T>) => Promise<void>;
|
|
60
68
|
/**
|
|
61
69
|
* `true` when `sortMode === 'manual'`. Reactive so a sort-mode toolbar
|
|
62
70
|
* can flip it at runtime. Drives whether `move` honors a `position` arg —
|
|
@@ -70,7 +78,11 @@ export interface UseFileExplorerReturn<T = unknown> {
|
|
|
70
78
|
* `loadingNodes` instead — `loading` is strictly the initial-load signal.
|
|
71
79
|
*/
|
|
72
80
|
readonly loading: Readonly<Ref<boolean>>;
|
|
73
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Files whose content is being loaded via `store.loadContent`. Folder
|
|
83
|
+
* lazy-loads are owned by CoarTree now (read its `isLoading` slot prop), so
|
|
84
|
+
* this no longer carries folder ids during expand.
|
|
85
|
+
*/
|
|
74
86
|
readonly loadingNodes: Readonly<Ref<ReadonlySet<string>>>;
|
|
75
87
|
/** Assets with an in-flight save/rename/delete/move. */
|
|
76
88
|
readonly savingNodes: Readonly<Ref<ReadonlySet<string>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-file-explorer.d.ts","sourceRoot":"","sources":["../src/use-file-explorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,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ACH,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IAGjC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAG,IAAI,CAAC;IAC/C;;;;;OAKG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC;CACrD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,OAAO,EACzC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,qBAAqB,CAAC,CAAC,CAAC,CAkxB1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-file-explorer-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "VSCode-style file/asset explorer for Vue 3 — composable + types over a pluggable AssetStore<T> backend.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"typecheck": "vue-tsc --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@cocoar/vue-script-editor": "2.
|
|
41
|
-
"@cocoar/vue-ui": "2.
|
|
40
|
+
"@cocoar/vue-script-editor": "2.8.0",
|
|
41
|
+
"@cocoar/vue-ui": "2.8.0",
|
|
42
42
|
"vue": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|