@jt-home/mfe-components 1.0.47 → 1.0.49
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/JtAttachmentPreview/index.cjs +1 -1
- package/dist/JtAttachmentPreview/index.mjs +1 -1
- package/dist/{index-BXyTJFiJ.js → index-CTj7lrC9.js} +588 -474
- package/dist/{index-CoLqaicq.cjs → index-CgZdzYF1.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/style.css +1 -1
- package/dist/types/components/JtAttachmentPreview/index.d.ts +2 -2
- package/dist/types/components/JtAttachmentPreview/types.d.ts +28 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { ElIcon as
|
|
3
|
-
const
|
|
1
|
+
import { ref as j, isRef as ue, watch as $, defineComponent as x, openBlock as O, createElementBlock as N, createElementVNode as V, onBeforeUnmount as G, h as o, computed as E, onMounted as ee, nextTick as we, render as _ } from "vue";
|
|
2
|
+
import { ElIcon as J } from "element-plus";
|
|
3
|
+
const be = {
|
|
4
4
|
common: {
|
|
5
5
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js 无法读取该文件,已切换为浏览器内置预览",
|
|
6
6
|
PDF加载中___: "PDF 加载中...",
|
|
@@ -56,7 +56,7 @@ const he = {
|
|
|
56
56
|
附件预览: "附件预览",
|
|
57
57
|
附件预览未初始化: "附件预览未初始化"
|
|
58
58
|
}
|
|
59
|
-
},
|
|
59
|
+
}, ye = {
|
|
60
60
|
common: {
|
|
61
61
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js cannot read the file. It has been switched to browser built-in preview",
|
|
62
62
|
PDF加载中___: "PDF loading...",
|
|
@@ -112,7 +112,7 @@ const he = {
|
|
|
112
112
|
附件预览: "Attachment Preview",
|
|
113
113
|
附件预览未初始化: "Attachment preview not initialized"
|
|
114
114
|
}
|
|
115
|
-
},
|
|
115
|
+
}, ke = {
|
|
116
116
|
common: {
|
|
117
117
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js ไม่สามารถอ่านไฟล์ได้ เปลี่ยนเป็นตัวอย่างในตัวเบราว์เซอร์",
|
|
118
118
|
PDF加载中___: "กําลังโหลดไฟล์ PDF ...",
|
|
@@ -168,7 +168,7 @@ const he = {
|
|
|
168
168
|
附件预览: "เอกสารแนบตัวอย่าง",
|
|
169
169
|
附件预览未初始化: "การแสดงตัวอย่างของสิ่งที่แนบมาไม่ได้เริ่มต้น"
|
|
170
170
|
}
|
|
171
|
-
},
|
|
171
|
+
}, Pe = {
|
|
172
172
|
common: {
|
|
173
173
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js không thể đọc tập tin, đã chuyển sang trình duyệt built-in xem trước",
|
|
174
174
|
PDF加载中___: "Đang tải PDF...",
|
|
@@ -224,7 +224,7 @@ const he = {
|
|
|
224
224
|
附件预览: "Xem trước tệp đính kèm",
|
|
225
225
|
附件预览未初始化: "Bản xem trước đính kèm không được khởi tạo"
|
|
226
226
|
}
|
|
227
|
-
},
|
|
227
|
+
}, _e = {
|
|
228
228
|
common: {
|
|
229
229
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js no puede leer este archivo, cambió a la vista previa integrada del navegador",
|
|
230
230
|
PDF加载中___: "Carga de PDF...",
|
|
@@ -280,7 +280,7 @@ const he = {
|
|
|
280
280
|
附件预览: "Anexo Preview",
|
|
281
281
|
附件预览未初始化: "Anexo Preview no inicializado"
|
|
282
282
|
}
|
|
283
|
-
},
|
|
283
|
+
}, De = {
|
|
284
284
|
common: {
|
|
285
285
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js tidak dapat membaca file ini, telah beralih ke pratinjau built-in browser",
|
|
286
286
|
PDF加载中___: "PDF sedang memuat...",
|
|
@@ -336,7 +336,7 @@ const he = {
|
|
|
336
336
|
附件预览: "Lampiran Pratinjau",
|
|
337
337
|
附件预览未初始化: "Lampiran Pratinjau tidak diinisialisasi Lampiran Pratinjau tidak diinisialisasi Lampiran Pratinjau tidak diinisialisasi Lampiran Pratinjau tidak diinisialisasi"
|
|
338
338
|
}
|
|
339
|
-
},
|
|
339
|
+
}, Ae = {
|
|
340
340
|
common: {
|
|
341
341
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "PDF.js kann die Datei nicht lesen, wurde auf die eingebaute Vorschau des Browsers umgeschaltet",
|
|
342
342
|
PDF加载中___: "PDF wird geladen...",
|
|
@@ -392,7 +392,7 @@ const he = {
|
|
|
392
392
|
附件预览: "Anhang Vorschau",
|
|
393
393
|
附件预览未初始化: "Anlage Vorschau nicht initialisiert"
|
|
394
394
|
}
|
|
395
|
-
},
|
|
395
|
+
}, je = {
|
|
396
396
|
common: {
|
|
397
397
|
"PDF_js无法读取该文件,已切换为浏览器内置预览": "O PDF.js não pode ler o arquivo, mudou para a visualização integrada do navegador",
|
|
398
398
|
PDF加载中___: "PDF Carregando...",
|
|
@@ -448,17 +448,17 @@ const he = {
|
|
|
448
448
|
附件预览: "Anexo Preview",
|
|
449
449
|
附件预览未初始化: "Anexo Preview não inicializado"
|
|
450
450
|
}
|
|
451
|
-
},
|
|
452
|
-
"zh-cn":
|
|
453
|
-
en:
|
|
454
|
-
th:
|
|
455
|
-
vi:
|
|
456
|
-
es:
|
|
457
|
-
id:
|
|
458
|
-
de:
|
|
459
|
-
pt:
|
|
460
|
-
km:
|
|
461
|
-
},
|
|
451
|
+
}, Le = {}, Ee = {
|
|
452
|
+
"zh-cn": be,
|
|
453
|
+
en: ye,
|
|
454
|
+
th: ke,
|
|
455
|
+
vi: Pe,
|
|
456
|
+
es: _e,
|
|
457
|
+
id: De,
|
|
458
|
+
de: Ae,
|
|
459
|
+
pt: je,
|
|
460
|
+
km: Le
|
|
461
|
+
}, U = [
|
|
462
462
|
{ key: "zh", label: "简体中文", displayLabel: "简体中文", elementPlusLocale: "zh-cn" },
|
|
463
463
|
{ key: "en", label: "英语", displayLabel: "English", elementPlusLocale: "en" },
|
|
464
464
|
{ key: "th", label: "泰语", displayLabel: "ไทย", elementPlusLocale: "th" },
|
|
@@ -470,27 +470,27 @@ const he = {
|
|
|
470
470
|
{ key: "km", label: "柬埔寨语", displayLabel: "ភាសាខ្មែរ", elementPlusLocale: "km" }
|
|
471
471
|
];
|
|
472
472
|
Object.freeze(
|
|
473
|
-
Object.fromEntries(
|
|
473
|
+
Object.fromEntries(U.map((e) => [e.key, e.elementPlusLocale]))
|
|
474
474
|
);
|
|
475
|
-
function
|
|
476
|
-
const
|
|
477
|
-
return
|
|
475
|
+
function xe(e, t = {}) {
|
|
476
|
+
const a = t.fallback ?? "zh", r = Be(t.languageList), n = e.toLowerCase();
|
|
477
|
+
return r.find((i) => i.key === n) ?? r.find((i) => i.key === a) ?? U[0];
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
479
|
+
function Re(e, t = {}) {
|
|
480
|
+
return xe(e, t).elementPlusLocale;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Be(e) {
|
|
483
483
|
return e != null && e.length ? e.map((t) => {
|
|
484
|
-
const
|
|
484
|
+
const a = t.key ?? t.value, r = U.find((n) => n.key === a) ?? U[0];
|
|
485
485
|
return {
|
|
486
|
-
...
|
|
486
|
+
...r,
|
|
487
487
|
...t,
|
|
488
|
-
key:
|
|
489
|
-
elementPlusLocale: t.elementPlusLocale ??
|
|
488
|
+
key: r.key,
|
|
489
|
+
elementPlusLocale: t.elementPlusLocale ?? r.elementPlusLocale
|
|
490
490
|
};
|
|
491
|
-
}) :
|
|
491
|
+
}) : U;
|
|
492
492
|
}
|
|
493
|
-
const
|
|
493
|
+
const Te = {
|
|
494
494
|
"zh-hans": "zh",
|
|
495
495
|
"zh-cn": "zh",
|
|
496
496
|
cn: "zh",
|
|
@@ -504,69 +504,69 @@ const xe = {
|
|
|
504
504
|
"pt-br": "pt",
|
|
505
505
|
"km-kh": "km"
|
|
506
506
|
};
|
|
507
|
-
function
|
|
507
|
+
function q(e) {
|
|
508
508
|
const t = String(e || "zh-cn").trim().toLowerCase().replace(/_/g, "-");
|
|
509
|
-
return
|
|
509
|
+
return Re(Te[t] || t) || "zh-cn";
|
|
510
510
|
}
|
|
511
|
-
const
|
|
512
|
-
let
|
|
511
|
+
const C = j("zh-cn");
|
|
512
|
+
let Q;
|
|
513
513
|
function te() {
|
|
514
|
-
|
|
514
|
+
Q?.(), Q = void 0;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
return e ? typeof e == "function" ?
|
|
516
|
+
function le(e) {
|
|
517
|
+
return e ? typeof e == "function" ? q(e()) : ue(e) ? q(e.value) : q(e) : C.value;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Ce(e, t) {
|
|
520
520
|
if (e)
|
|
521
|
-
return t.split(".").reduce((
|
|
522
|
-
if (!(!
|
|
523
|
-
return
|
|
521
|
+
return t.split(".").reduce((a, r) => {
|
|
522
|
+
if (!(!a || typeof a != "object"))
|
|
523
|
+
return a[r];
|
|
524
524
|
}, e);
|
|
525
525
|
}
|
|
526
|
-
function
|
|
527
|
-
const
|
|
528
|
-
return typeof
|
|
526
|
+
function se(e, t) {
|
|
527
|
+
const a = Ce(Ee[e], t);
|
|
528
|
+
return typeof a == "string" ? a : void 0;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
return t ? e.replace(/\{(\w+)\}/g, (
|
|
532
|
-
const
|
|
533
|
-
return
|
|
530
|
+
function Se(e, t) {
|
|
531
|
+
return t ? e.replace(/\{(\w+)\}/g, (a, r) => {
|
|
532
|
+
const n = t[r];
|
|
533
|
+
return n == null ? a : String(n);
|
|
534
534
|
}) : e;
|
|
535
535
|
}
|
|
536
|
-
function
|
|
537
|
-
te(),
|
|
536
|
+
function ft(e) {
|
|
537
|
+
te(), C.value = q(e);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
return
|
|
539
|
+
function pt() {
|
|
540
|
+
return C.value;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
te(),
|
|
542
|
+
function vt() {
|
|
543
|
+
te(), C.value = "zh-cn";
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ht(e, t = {}) {
|
|
546
546
|
if (te(), t.locale) {
|
|
547
|
-
if (typeof t.locale == "function" ||
|
|
548
|
-
|
|
549
|
-
() =>
|
|
550
|
-
(
|
|
551
|
-
|
|
547
|
+
if (typeof t.locale == "function" || ue(t.locale)) {
|
|
548
|
+
Q = $(
|
|
549
|
+
() => le(t.locale),
|
|
550
|
+
(a) => {
|
|
551
|
+
C.value = a;
|
|
552
552
|
},
|
|
553
553
|
{ immediate: !0, flush: "sync" }
|
|
554
554
|
);
|
|
555
555
|
return;
|
|
556
556
|
}
|
|
557
|
-
|
|
557
|
+
C.value = le(t.locale);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
562
|
-
return
|
|
560
|
+
function c(e, t = e, a) {
|
|
561
|
+
const r = t || e, n = C.value, i = se(n, e) || se("zh-cn", e) || r || e;
|
|
562
|
+
return Se(i, a);
|
|
563
563
|
}
|
|
564
564
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
565
|
-
var
|
|
565
|
+
var ze = /* @__PURE__ */ x({
|
|
566
566
|
name: "Download",
|
|
567
567
|
__name: "download",
|
|
568
568
|
setup(e) {
|
|
569
|
-
return (t,
|
|
569
|
+
return (t, a) => (O(), N("svg", {
|
|
570
570
|
xmlns: "http://www.w3.org/2000/svg",
|
|
571
571
|
viewBox: "0 0 1024 1024"
|
|
572
572
|
}, [
|
|
@@ -576,11 +576,11 @@ var Be = /* @__PURE__ */ E({
|
|
|
576
576
|
})
|
|
577
577
|
]));
|
|
578
578
|
}
|
|
579
|
-
}),
|
|
579
|
+
}), Me = ze, Fe = /* @__PURE__ */ x({
|
|
580
580
|
name: "RefreshLeft",
|
|
581
581
|
__name: "refresh-left",
|
|
582
582
|
setup(e) {
|
|
583
|
-
return (t,
|
|
583
|
+
return (t, a) => (O(), N("svg", {
|
|
584
584
|
xmlns: "http://www.w3.org/2000/svg",
|
|
585
585
|
viewBox: "0 0 1024 1024"
|
|
586
586
|
}, [
|
|
@@ -590,11 +590,11 @@ var Be = /* @__PURE__ */ E({
|
|
|
590
590
|
})
|
|
591
591
|
]));
|
|
592
592
|
}
|
|
593
|
-
}),
|
|
593
|
+
}), Ue = Fe, Ie = /* @__PURE__ */ x({
|
|
594
594
|
name: "ZoomIn",
|
|
595
595
|
__name: "zoom-in",
|
|
596
596
|
setup(e) {
|
|
597
|
-
return (t,
|
|
597
|
+
return (t, a) => (O(), N("svg", {
|
|
598
598
|
xmlns: "http://www.w3.org/2000/svg",
|
|
599
599
|
viewBox: "0 0 1024 1024"
|
|
600
600
|
}, [
|
|
@@ -604,11 +604,11 @@ var Be = /* @__PURE__ */ E({
|
|
|
604
604
|
})
|
|
605
605
|
]));
|
|
606
606
|
}
|
|
607
|
-
}),
|
|
607
|
+
}), Je = Ie, qe = /* @__PURE__ */ x({
|
|
608
608
|
name: "ZoomOut",
|
|
609
609
|
__name: "zoom-out",
|
|
610
610
|
setup(e) {
|
|
611
|
-
return (t,
|
|
611
|
+
return (t, a) => (O(), N("svg", {
|
|
612
612
|
xmlns: "http://www.w3.org/2000/svg",
|
|
613
613
|
viewBox: "0 0 1024 1024"
|
|
614
614
|
}, [
|
|
@@ -618,8 +618,8 @@ var Be = /* @__PURE__ */ E({
|
|
|
618
618
|
})
|
|
619
619
|
]));
|
|
620
620
|
}
|
|
621
|
-
}),
|
|
622
|
-
const
|
|
621
|
+
}), Ye = qe;
|
|
622
|
+
const Oe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAAAAaVBMVEUAAABWapNVapKeqsLJztx3hKnGzN2yu8////9XapWcqMGps8lXapVYa5RWaZWps8lfcJjS1+KjrsVXapWapr////9sfaKrtMrV2uWBj7B4iKqWob1wgaXr7fOBj6/Ax9dhc5yhq8OKl7Wba+6tAAAAE3RSTlMAgGDuDyVLoYDe2XuXRb68cy6e4BCQEAAAAyZJREFUeNrt29tyokAUheGOQjIoeMhuCQ4e0Pd/yCE1STU4mGq7bXqzZ/23ufoqYblTqkIIIYQQQggNlM42Lzctf5nMD22bKQYVOQ30sTPt6dEO74mKXLoiCgDTi1RFbUMUBhZXluQUDKbnWxWtjMLB2pYqUjmFg8WUzSg0TL+rCKVZeJheRJj9DYWHRRnHbBSYnr+qcSsoKCyeLKcfK/emc2UqH4LFGMcVWVftTC4w/TbmhGQjwvR6RBmNAbMYx4nD7k/I1GF3ZZOH3RtHAbDhcZQAG5SJgOn1Vt0mAzYwIUJgvjJ/2OVo2pcmcoQZWehxpBGue5sJEQTryyTBeuMoCtadEFmwjkwYzIyjNJief02IONj3OAqE/ZVJhJnZj3RS1c4nld04ijiC/5EJhbUyobBWJhT2OY5CYa1MKKyVCYXpdSIUphdbobB2HIXCWplQmJGFhZUn07kyNaFgbUsx1/1tb1Jh+i1hDmu0Y+uEN4xqV9ki5Q27atfmKWtYqd1lW84wqj1kr5xhB+3RkjGMrl4yxrCm9pG984V5ytZJINjpY7hmLNki5XjdP0fGFkZ0qL1kfGEt7erzgsYY1lYefrtWsIZ5NAMMMBNg9gEGmD3sejbVnRpyjAvs5rr3DzDAAOsEmH2AAQZYJ8Ds4wJrSlN1NE3+CDYJu+5NgNkHGGCAdQLMPsAAA0zuEQyYbYABBlgnwOwDDDDAOvVhl5NJ1Fu1O6lHMGA/xQl2rPodpcBq6gfYYIABBpgJsAdiBDvX/cTAxF4egNkEWGDY5Q5s8v9onoZdR3KNC4yOg7AzOccFNvi36POJIy4wqgZgF/KIC6yporuCwNrq/nNW7ckzLjCi/bO//MEF9mCAAQYYYDwCDDAmAQYYkwADjEmAAcYkwABjEmCAMQkwwJgEGGBMAgwwJgEGGJMAA4xJgAHGJMD+B1hGE6hwgK1oAqUOsJz4lymHCuJfrpTM9SicYC/EvUw5lRD3Psde4lP29YSJG8bse+ulvZZ5uFTCV5YZl6hpXKXKs5TlL22jnlCaM7uHV7NEPam02LwwaVYkCiGEEEIIITTUH1Fqd5V0WMtQAAAAAElFTkSuQmCC", Ne = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAAAAdVBMVEUAAAD/XgD/XQD/z7f/omz/r4H/h0v/0Lf/omz/XwP/XgD/XgD/XQD/tIv/pnH/zK7/XgD/XAD/rH7/XQD/XgD/nmb/////fjL/ciD/dib/6+D/9e//ml//aBD/18D/r4D/w6D/hkD/uJD/pHD/kE//4c//zbBB3kudAAAAFHRSTlMAgGAP7q8hPNo33pe+mH9Z73BZULJO58YAAAW3SURBVHja7NZJDsJADERREzoTYZa94P4XJQhaZOgoWViYLvnf4C1cMnme53me53mel6gqbjvVCvqD2u7K2j3KPRnXHpn1e0hTkWk3jinDbGX7jmPqMAk1mXXgmD6s70xGdRzTh1nKCh6nD5OSDKoOPEkfJs2m2c9iEEewreOYx3IMYBbj2HIqfZiEO62UyyQOYBbjeOSV9GByWpmQbE5sCpPyhzJOpA9bH8fMYcvjmDtMwoWSZQ9bGkcAWHocEWDJcYSASTOfEAxYYhxBYHMZCmw2+zCw6TgCwcbjiAQbyaBgw9nHgg0mBAz2laHBJHzGEQ4WJwQQ9pYhwqSsiSBh0tSgMAk1KEzCBRTWy0Bhr28fFNbPPijsyY297DYIA1EYlnpJ20WyqA7G8QVi4uT9H7Go0oDDkrHEkf+Vt58ijyfMskZhs6xR2PygNQqbH7RGYbOsUdj8oDUK67pLq7Du3CpsHvvksNjtlnHDEPbKvk/csNzt7eNEDbPdftkXMwxBIfvlgcUcQu5R1HeKLiSwNJj/3N1iKatkDLB4M0suQYpBIzsTwB6mLFSSfb4fDZvMS95Wkn2fjoVZs2nAwTLU6Wa2Jaxdg0p2JMybbSPKrlnzoB0HS8LxTk4PbLLXfm8/h8HuwknrFImo1tthsHHVZDlaKGKByezwxXzMUMQGc8UcCVDEApsKmGsJNhawoSVYkDvWGiwVM35oaXhEgfUrLEERC2yZGHfAL0ZNLDCZ90/EpjaPZafyMckJqlhgdlkWZfIPUMUCgxOPfCKYoIsFNplNd+higaUtLEEXCwx+A4M2Ftj46npAGwvMvsImaGOBYTBlGepYYNmUWahjgcHXvmIssLH2FWOBRV/5FWOBFT+ZR5VYYNFIT1SJBYabwBzqxAKbaq/ALDBnJB9RIxJY3+ZKBUxN/m35o9buclyFYSgAb8ICK78OhO5/ibfS3JkAdksn5OHMeS5Sv0Jty+QZN3q8B4EV9UrzZlBg0lBjFosoMHeCuUj3AgILjTSmMqLAHk00pk2DwHjS8Uz9QYGF5hnzN0OB7cYpdfKoKyCw1sRCGVJAUGCyW+MsI/o0CKyVDiGiNKA0gsDkMG+w38sCdQQF5o7Vok63ZRiwcEbkKxlHehcUmFPLDrFkXEOW5L4/vaWlMtnBgBVdA+N2kOW6yuYnIymQDgosGSt7dtOHcZXOAYHta30L+09luteBwMR+xzJ/KNO9DgTG+wVwh0xt61BgojZTTdb1MILA+NViikO68tiXgsDE6sMcxNsEv4Ra+Jm5rOKsQwYgMJ7OzTmWxb2r7jK3izdc2OmGxTX56871WMsciTg8YGGHG/ZUKcS2BI7y9/5j7SsnrXJLjW0otqIbBQisvG5NEiLRxYSl6w4KzE1m3FLonPCG5ugnCLBoN6qUmXQ0Ta/5MWAx+wuVjv1L+K/xHgNmspxSqbAuMcL0DAaMxRopCn2UWPJj+3/NJutXiYGAWaxUI/0qkbndKQhYXJTK50j9wYDF7Me+LQKBVWc2of5gwNis1kzdAYGt3nIJdQcDFpM9DTF1BgQ2u1fja2dAYMHbLqHOgMDCsW352w8iCKweWDHffhBBYOyba2Nabz+IKDB3eFk+36+IILDQXPlQRnpdKLC0d+W9sjMoMN8kJY04woEC+6kbJY05dIMC86OPSaHA0ugREQWWR7tQYP/atZcUBmEoCsNHA4FEBxHvyKJQ7P7X2EGdlHbiNYNjON8OfvIkZP2Zi9tqV7CE2V77TyxL2PdkXJ52GUuYvZbKL1IsYcfr9GPbq2WxhJ2gMIUpTGEcFKYwEgpTGAmFKYyEwhRGQmEKI+EJy3YDCeeNdgOesMH4ZTgk4zfAoxi9GR6dsctwCfRD1sNnNm7HCmtuY8wRH42dZSXCL/CW5QQcmtoax4iLIuOglQkVpIHrPlzGPqCSNE8diT4FiIiIiIjIP2/v9e/hKQXqEwAAAABJRU5ErkJggg==", Ve = /* @__PURE__ */ new Set([
|
|
623
623
|
"jpg",
|
|
624
624
|
"jpeg",
|
|
625
625
|
"png",
|
|
@@ -629,7 +629,7 @@ const Ue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAA
|
|
|
629
629
|
"svg",
|
|
630
630
|
"avif",
|
|
631
631
|
"ico"
|
|
632
|
-
]),
|
|
632
|
+
]), Ge = /* @__PURE__ */ new Set(["mp4", "webm", "ogg", "ogv", "mov", "m4v"]), He = /* @__PURE__ */ new Set([
|
|
633
633
|
"mp3",
|
|
634
634
|
"wav",
|
|
635
635
|
"ogg",
|
|
@@ -637,7 +637,7 @@ const Ue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAA
|
|
|
637
637
|
"m4a",
|
|
638
638
|
"aac",
|
|
639
639
|
"flac"
|
|
640
|
-
]),
|
|
640
|
+
]), Ke = /* @__PURE__ */ new Set([
|
|
641
641
|
"html",
|
|
642
642
|
"htm",
|
|
643
643
|
"txt",
|
|
@@ -646,7 +646,7 @@ const Ue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAA
|
|
|
646
646
|
"csv",
|
|
647
647
|
"md",
|
|
648
648
|
"log"
|
|
649
|
-
]),
|
|
649
|
+
]), We = /* @__PURE__ */ new Set([
|
|
650
650
|
"doc",
|
|
651
651
|
"docx",
|
|
652
652
|
"xls",
|
|
@@ -656,147 +656,150 @@ const Ue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAA
|
|
|
656
656
|
"zip",
|
|
657
657
|
"rar",
|
|
658
658
|
"7z"
|
|
659
|
-
]),
|
|
659
|
+
]), X = {
|
|
660
660
|
component: "JtAttachmentPreview",
|
|
661
|
-
marker: "2026-06-25-download-
|
|
661
|
+
marker: "2026-06-25-download-error-detail",
|
|
662
662
|
source: "@jt-home/mfe-components/src/components/JtAttachmentPreview/index.ts",
|
|
663
663
|
pdfLoadMode: "fetch-bytes-then-pdfjs-data",
|
|
664
|
-
previewDownloadMode: "
|
|
664
|
+
previewDownloadMode: "openByParams-uses-registered-downloadRequest",
|
|
665
|
+
downloadResponseMode: "supports-blob-and-axios-response-data-blob"
|
|
665
666
|
};
|
|
666
|
-
function
|
|
667
|
-
console.info(`[JtAttachmentPreview DEBUG ${
|
|
668
|
-
...
|
|
667
|
+
function p(e, t) {
|
|
668
|
+
console.info(`[JtAttachmentPreview DEBUG ${X.marker}] ${e}`, {
|
|
669
|
+
...X,
|
|
669
670
|
...t
|
|
670
671
|
});
|
|
671
672
|
}
|
|
672
|
-
typeof window < "u" && (window.__JT_ATTACHMENT_PREVIEW_DEBUG__ =
|
|
673
|
-
let
|
|
674
|
-
async function
|
|
675
|
-
return
|
|
673
|
+
typeof window < "u" && (window.__JT_ATTACHMENT_PREVIEW_DEBUG__ = X, p("module-loaded"));
|
|
674
|
+
let D = null, K = null, A = null;
|
|
675
|
+
async function Qe() {
|
|
676
|
+
return K || (K = Promise.all([
|
|
676
677
|
import("./pdf-BmBuG7of.js"),
|
|
677
678
|
import("./pdf.worker.min-4PI-nNLo.js")
|
|
678
|
-
]).then(([e, t]) => (e.GlobalWorkerOptions.workerSrc = t.default, e))),
|
|
679
|
+
]).then(([e, t]) => (e.GlobalWorkerOptions.workerSrc = t.default, e))), K;
|
|
679
680
|
}
|
|
680
|
-
function
|
|
681
|
+
function Xe(e) {
|
|
681
682
|
return typeof e == "string" ? { url: e } : e;
|
|
682
683
|
}
|
|
683
|
-
function
|
|
684
|
+
function de(e) {
|
|
684
685
|
const [t] = e.split(/[?#]/);
|
|
685
686
|
return t ?? "";
|
|
686
687
|
}
|
|
687
|
-
function
|
|
688
|
+
function ae(e, t) {
|
|
688
689
|
if (t?.trim()) return t.trim();
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
690
|
+
const a = de(e).split("/").filter(Boolean).pop();
|
|
691
|
+
if (!a) return c("common.附件预览");
|
|
691
692
|
try {
|
|
692
|
-
return decodeURIComponent(
|
|
693
|
+
return decodeURIComponent(a);
|
|
693
694
|
} catch {
|
|
694
|
-
return
|
|
695
|
+
return a;
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
|
-
function
|
|
698
|
-
return
|
|
698
|
+
function Z(e) {
|
|
699
|
+
return de(e).match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase() ?? "";
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function Ze(e) {
|
|
701
702
|
return e?.trim().replace(/^\./, "").toLowerCase() ?? "";
|
|
702
703
|
}
|
|
703
|
-
function
|
|
704
|
-
const t =
|
|
705
|
-
return
|
|
704
|
+
function $e(e) {
|
|
705
|
+
const t = Ze(e);
|
|
706
|
+
return Ve.has(t) ? "image" : t === "pdf" ? "pdf" : Ge.has(t) ? "video" : He.has(t) ? "audio" : Ke.has(t) ? "iframe" : We.has(t) ? "unsupported" : "unknown";
|
|
706
707
|
}
|
|
707
|
-
function
|
|
708
|
+
function ne(e) {
|
|
708
709
|
const t = e.toLowerCase().split(";")[0]?.trim() ?? "";
|
|
709
710
|
return t.startsWith("image/") ? "image" : t === "application/pdf" ? "pdf" : t.startsWith("video/") ? "video" : t.startsWith("audio/") ? "audio" : t.startsWith("text/") ? "iframe" : "unknown";
|
|
710
711
|
}
|
|
711
|
-
function
|
|
712
|
+
function me(e) {
|
|
712
713
|
if (!e.url.trim()) return "empty";
|
|
713
714
|
if (e.mode && e.mode !== "auto") return e.mode;
|
|
714
715
|
if (e.mimeType) {
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
716
|
+
const a = ne(e.mimeType);
|
|
717
|
+
if (a !== "unknown") return a;
|
|
717
718
|
}
|
|
718
|
-
const t =
|
|
719
|
-
e.extension ||
|
|
719
|
+
const t = $e(
|
|
720
|
+
e.extension || Z(e.name || "") || Z(e.url)
|
|
720
721
|
);
|
|
721
722
|
return t !== "unknown" ? t : "unknown";
|
|
722
723
|
}
|
|
723
|
-
async function
|
|
724
|
+
async function et(e) {
|
|
724
725
|
try {
|
|
725
|
-
const
|
|
726
|
-
return
|
|
726
|
+
const a = (await fetch(e, { method: "HEAD" })).headers.get("content-type") ?? "";
|
|
727
|
+
return ne(a);
|
|
727
728
|
} catch {
|
|
728
729
|
return "unknown";
|
|
729
730
|
}
|
|
730
731
|
}
|
|
731
|
-
async function
|
|
732
|
-
const
|
|
733
|
-
if (!
|
|
734
|
-
return
|
|
732
|
+
async function fe(e, t) {
|
|
733
|
+
const a = await fetch(e, t);
|
|
734
|
+
if (!a.ok) throw new Error(`fetch failed: ${a.status}`);
|
|
735
|
+
return a.blob();
|
|
735
736
|
}
|
|
736
|
-
async function
|
|
737
|
-
|
|
737
|
+
async function tt(e) {
|
|
738
|
+
p("fetch-pdf-bytes-start", {
|
|
738
739
|
url: e
|
|
739
740
|
});
|
|
740
741
|
const t = await fetch(e);
|
|
741
742
|
if (!t.ok) throw new Error(`fetch failed: ${t.status}`);
|
|
742
|
-
const
|
|
743
|
-
return
|
|
743
|
+
const a = new Uint8Array(await t.arrayBuffer());
|
|
744
|
+
return p("fetch-pdf-bytes-done", {
|
|
744
745
|
url: e,
|
|
745
|
-
byteLength:
|
|
746
|
+
byteLength: a.byteLength,
|
|
746
747
|
contentType: t.headers.get("content-type") ?? ""
|
|
747
|
-
}),
|
|
748
|
+
}), a;
|
|
748
749
|
}
|
|
749
|
-
function
|
|
750
|
-
const
|
|
751
|
-
return
|
|
750
|
+
function at(e, t) {
|
|
751
|
+
const a = Z(t);
|
|
752
|
+
return a === "doc" || a === "docx" ? "W" : a === "xls" || a === "xlsx" ? "X" : a === "ppt" || a === "pptx" ? "P" : a === "zip" || a === "rar" || a === "7z" ? "ZIP" : e === "pdf" ? "PDF" : "FILE";
|
|
752
753
|
}
|
|
753
|
-
function
|
|
754
|
-
return
|
|
754
|
+
function pe(e, t, a, r = !1) {
|
|
755
|
+
return o(
|
|
755
756
|
"button",
|
|
756
757
|
{
|
|
757
|
-
class:
|
|
758
|
+
class: a,
|
|
758
759
|
type: "button",
|
|
759
760
|
onClick: () => {
|
|
760
|
-
|
|
761
|
-
url: e,
|
|
761
|
+
p("download-button-click", {
|
|
762
|
+
url: e.url,
|
|
762
763
|
downloadName: t,
|
|
763
|
-
fallbackToRawUrl:
|
|
764
|
-
}),
|
|
764
|
+
fallbackToRawUrl: r
|
|
765
|
+
}), he(e, t, {
|
|
766
|
+
fallbackToRawUrl: r
|
|
767
|
+
});
|
|
765
768
|
}
|
|
766
769
|
},
|
|
767
770
|
[
|
|
768
|
-
|
|
769
|
-
|
|
771
|
+
o(
|
|
772
|
+
J,
|
|
770
773
|
{ class: "jt-attachment-preview-service__download-icon" },
|
|
771
|
-
() =>
|
|
774
|
+
() => o(Me)
|
|
772
775
|
),
|
|
773
|
-
|
|
776
|
+
o(
|
|
774
777
|
"span",
|
|
775
778
|
{ class: "jt-attachment-preview-service__download-text" },
|
|
776
|
-
|
|
779
|
+
c("common.下载")
|
|
777
780
|
)
|
|
778
781
|
]
|
|
779
782
|
);
|
|
780
783
|
}
|
|
781
|
-
function
|
|
784
|
+
function W(e) {
|
|
782
785
|
return e === "image" || e === "pdf";
|
|
783
786
|
}
|
|
784
|
-
function
|
|
785
|
-
return
|
|
787
|
+
function ve(e) {
|
|
788
|
+
return o(
|
|
786
789
|
"div",
|
|
787
790
|
{ class: "jt-attachment-preview-service__preview-fallback" },
|
|
788
791
|
[
|
|
789
|
-
|
|
792
|
+
o("img", {
|
|
790
793
|
class: "jt-attachment-preview-service__preview-fallback-icon",
|
|
791
794
|
src: e.icon,
|
|
792
795
|
alt: ""
|
|
793
796
|
}),
|
|
794
|
-
|
|
797
|
+
o(
|
|
795
798
|
"div",
|
|
796
799
|
{ class: "jt-attachment-preview-service__unsupported-text" },
|
|
797
|
-
|
|
800
|
+
c("common.暂不支持预览此类型的文件")
|
|
798
801
|
),
|
|
799
|
-
|
|
802
|
+
o(
|
|
800
803
|
"div",
|
|
801
804
|
{
|
|
802
805
|
class: "jt-attachment-preview-service__file-name",
|
|
@@ -807,36 +810,145 @@ function me(e) {
|
|
|
807
810
|
]
|
|
808
811
|
);
|
|
809
812
|
}
|
|
810
|
-
function
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
+
function oe(e, t) {
|
|
814
|
+
const a = document.createElement("a");
|
|
815
|
+
a.href = e, a.download = t, a.style.display = "none", document.body.appendChild(a), a.click(), a.remove();
|
|
816
|
+
}
|
|
817
|
+
function re(e, t) {
|
|
818
|
+
const a = URL.createObjectURL(e);
|
|
819
|
+
oe(a, t), window.setTimeout(() => URL.revokeObjectURL(a), 1e3);
|
|
820
|
+
}
|
|
821
|
+
function Y(e) {
|
|
822
|
+
return e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]";
|
|
823
|
+
}
|
|
824
|
+
function nt(e, t) {
|
|
825
|
+
if (Y(e))
|
|
826
|
+
return e;
|
|
827
|
+
if (e && typeof e == "object") {
|
|
828
|
+
const a = e;
|
|
829
|
+
if (Y(a.data)) {
|
|
830
|
+
const r = a.data;
|
|
831
|
+
return {
|
|
832
|
+
blob: a.data,
|
|
833
|
+
name: a.fileName || a.name || r.name || t
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return null;
|
|
813
838
|
}
|
|
814
|
-
async function
|
|
815
|
-
|
|
839
|
+
async function ot(e, t, a = {}) {
|
|
840
|
+
p("download-start", {
|
|
816
841
|
url: e,
|
|
817
842
|
downloadName: t,
|
|
818
|
-
fallbackToRawUrl: !!
|
|
843
|
+
fallbackToRawUrl: !!a.fallbackToRawUrl,
|
|
844
|
+
hasRequestInit: !!a.requestInit
|
|
819
845
|
});
|
|
820
|
-
let o = "";
|
|
821
846
|
try {
|
|
822
|
-
const
|
|
823
|
-
|
|
847
|
+
const r = await fe(e, a.requestInit);
|
|
848
|
+
p("download-blob-ready", {
|
|
824
849
|
url: e,
|
|
825
850
|
downloadName: t,
|
|
826
|
-
blobType:
|
|
827
|
-
blobSize:
|
|
828
|
-
}),
|
|
851
|
+
blobType: r.type,
|
|
852
|
+
blobSize: r.size
|
|
853
|
+
}), re(r, t);
|
|
829
854
|
} catch {
|
|
830
|
-
|
|
855
|
+
p("download-blob-failed", {
|
|
831
856
|
url: e,
|
|
832
857
|
downloadName: t,
|
|
833
|
-
fallbackToRawUrl: !!
|
|
834
|
-
}),
|
|
835
|
-
} finally {
|
|
836
|
-
o && window.setTimeout(() => URL.revokeObjectURL(o), 1e3);
|
|
858
|
+
fallbackToRawUrl: !!a.fallbackToRawUrl
|
|
859
|
+
}), a.fallbackToRawUrl && oe(e, t);
|
|
837
860
|
}
|
|
838
861
|
}
|
|
839
|
-
|
|
862
|
+
function ce(e, t) {
|
|
863
|
+
return e instanceof Blob ? { blob: e, name: t } : e ? {
|
|
864
|
+
url: e.url,
|
|
865
|
+
blob: e.blob,
|
|
866
|
+
name: e.name || t,
|
|
867
|
+
requestInit: e.requestInit,
|
|
868
|
+
fallbackToRawUrl: e.fallbackToRawUrl
|
|
869
|
+
} : null;
|
|
870
|
+
}
|
|
871
|
+
async function he(e, t, a = {}) {
|
|
872
|
+
const r = {
|
|
873
|
+
url: e.url,
|
|
874
|
+
name: t,
|
|
875
|
+
params: e.requestParams,
|
|
876
|
+
options: e
|
|
877
|
+
};
|
|
878
|
+
try {
|
|
879
|
+
let n = null;
|
|
880
|
+
if (p("download-resolve-start", {
|
|
881
|
+
url: e.url,
|
|
882
|
+
downloadName: t,
|
|
883
|
+
hasCustomDownload: !!e.download,
|
|
884
|
+
hasRegisteredDownload: !!A?.downloadRequest,
|
|
885
|
+
useRegisteredDownload: !!e.useRegisteredDownload,
|
|
886
|
+
hasRequestParams: Object.prototype.hasOwnProperty.call(
|
|
887
|
+
e,
|
|
888
|
+
"requestParams"
|
|
889
|
+
)
|
|
890
|
+
}), e.download) {
|
|
891
|
+
p("download-custom-handler-start", {
|
|
892
|
+
url: e.url,
|
|
893
|
+
downloadName: t
|
|
894
|
+
});
|
|
895
|
+
const l = await e.download(r);
|
|
896
|
+
if (n = ce(l, t), !n) {
|
|
897
|
+
p("download-custom-handler-done", {
|
|
898
|
+
url: e.url,
|
|
899
|
+
downloadName: t
|
|
900
|
+
});
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
} else if (e.useRegisteredDownload && A?.downloadRequest) {
|
|
904
|
+
p("download-setup-request-start", {
|
|
905
|
+
url: e.url,
|
|
906
|
+
downloadName: t,
|
|
907
|
+
params: e.requestParams
|
|
908
|
+
});
|
|
909
|
+
const l = await A.downloadRequest(
|
|
910
|
+
e.requestParams
|
|
911
|
+
);
|
|
912
|
+
p("download-request-response", {
|
|
913
|
+
isBlob: Y(l),
|
|
914
|
+
isDataBlob: !!l && typeof l == "object" && Y(l.data),
|
|
915
|
+
responseType: Object.prototype.toString.call(l)
|
|
916
|
+
});
|
|
917
|
+
const h = nt(l, t), f = h || (A.mapDownloadResponse ? A.mapDownloadResponse(
|
|
918
|
+
l,
|
|
919
|
+
e.requestParams
|
|
920
|
+
) : l);
|
|
921
|
+
n = ce(f, t);
|
|
922
|
+
}
|
|
923
|
+
if (n?.blob) {
|
|
924
|
+
p("download-result-blob", {
|
|
925
|
+
downloadName: n.name,
|
|
926
|
+
blobType: n.blob.type,
|
|
927
|
+
blobSize: n.blob.size
|
|
928
|
+
}), re(n.blob, n.name);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
const i = n?.url || e.downloadUrl || e.url, u = n?.name || t;
|
|
932
|
+
await ot(i, u, {
|
|
933
|
+
requestInit: n?.requestInit || e.downloadRequestInit,
|
|
934
|
+
fallbackToRawUrl: n?.fallbackToRawUrl ?? e.downloadFallbackToRawUrl ?? a.fallbackToRawUrl
|
|
935
|
+
});
|
|
936
|
+
} catch (n) {
|
|
937
|
+
p("download-handler-failed", {
|
|
938
|
+
url: e.url,
|
|
939
|
+
downloadName: t,
|
|
940
|
+
errorName: n instanceof Error ? n.name : "",
|
|
941
|
+
errorMessage: n instanceof Error ? n.message : String(n),
|
|
942
|
+
errorStack: n instanceof Error ? n.stack : "",
|
|
943
|
+
errorResponseStatus: n && typeof n == "object" ? n.response?.status : void 0,
|
|
944
|
+
errorResponseType: n && typeof n == "object" ? Object.prototype.toString.call(
|
|
945
|
+
n.response?.data
|
|
946
|
+
) : void 0,
|
|
947
|
+
errorResponseDataType: n && typeof n == "object" ? n.response?.data?.type : void 0
|
|
948
|
+
}), a.fallbackToRawUrl && oe(e.downloadUrl || e.url, t);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
const rt = x({
|
|
840
952
|
name: "JtAttachmentPreviewPdfCanvas",
|
|
841
953
|
props: {
|
|
842
954
|
url: {
|
|
@@ -861,149 +973,149 @@ const et = E({
|
|
|
861
973
|
previewError: (e) => e instanceof Event
|
|
862
974
|
},
|
|
863
975
|
setup(e, { emit: t }) {
|
|
864
|
-
const
|
|
865
|
-
let
|
|
866
|
-
async function v(
|
|
867
|
-
if (!
|
|
868
|
-
const
|
|
869
|
-
return !Array.isArray(
|
|
976
|
+
const a = j("loading"), r = j([]), n = j([]), i = /* @__PURE__ */ new Map(), u = j("");
|
|
977
|
+
let l = null, h = [], f = 0;
|
|
978
|
+
async function v(s, d) {
|
|
979
|
+
if (!d) return null;
|
|
980
|
+
const w = typeof d == "string" ? await s.getDestination(d) : d;
|
|
981
|
+
return !Array.isArray(w) || !w[0] ? null : await s.getPageIndex(w[0]) + 1;
|
|
870
982
|
}
|
|
871
|
-
async function
|
|
872
|
-
if (!
|
|
873
|
-
const
|
|
874
|
-
for (const L of
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
title: L.title ||
|
|
878
|
-
pageNumber:
|
|
879
|
-
level:
|
|
983
|
+
async function k(s, d, w = 0) {
|
|
984
|
+
if (!d?.length) return [];
|
|
985
|
+
const b = [];
|
|
986
|
+
for (const L of d) {
|
|
987
|
+
const S = await v(s, L.dest);
|
|
988
|
+
b.push({
|
|
989
|
+
title: L.title || c("common.未命名标题"),
|
|
990
|
+
pageNumber: S,
|
|
991
|
+
level: w
|
|
880
992
|
});
|
|
881
|
-
const
|
|
882
|
-
|
|
993
|
+
const B = await k(s, L.items, w + 1);
|
|
994
|
+
b.push(...B);
|
|
883
995
|
}
|
|
884
|
-
return
|
|
996
|
+
return b;
|
|
885
997
|
}
|
|
886
|
-
function
|
|
998
|
+
function g() {
|
|
887
999
|
f += 1;
|
|
888
|
-
for (const
|
|
889
|
-
|
|
890
|
-
|
|
1000
|
+
for (const s of h)
|
|
1001
|
+
s.cancel();
|
|
1002
|
+
h = [], l?.destroy(), l = null, i.clear();
|
|
891
1003
|
}
|
|
892
|
-
async function
|
|
893
|
-
|
|
894
|
-
const
|
|
895
|
-
|
|
1004
|
+
async function R() {
|
|
1005
|
+
g();
|
|
1006
|
+
const s = f;
|
|
1007
|
+
a.value = "loading", u.value = "", r.value = [], n.value = [];
|
|
896
1008
|
try {
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
byteLength:
|
|
903
|
-
}),
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
|
|
907
|
-
{ length:
|
|
908
|
-
(
|
|
909
|
-
),
|
|
910
|
-
|
|
911
|
-
await
|
|
912
|
-
), await
|
|
913
|
-
const L =
|
|
1009
|
+
const d = await Qe();
|
|
1010
|
+
if (s !== f) return;
|
|
1011
|
+
const w = await tt(e.url);
|
|
1012
|
+
if (s !== f) return;
|
|
1013
|
+
p("render-pdf-get-document-data", {
|
|
1014
|
+
byteLength: w.byteLength
|
|
1015
|
+
}), l = d.getDocument({ data: w });
|
|
1016
|
+
const b = await l.promise;
|
|
1017
|
+
if (s !== f) return;
|
|
1018
|
+
r.value = Array.from(
|
|
1019
|
+
{ length: b.numPages },
|
|
1020
|
+
(B, T) => T + 1
|
|
1021
|
+
), n.value = await k(
|
|
1022
|
+
b,
|
|
1023
|
+
await b.getOutline()
|
|
1024
|
+
), await we();
|
|
1025
|
+
const L = i.values().next().value, S = Math.max(
|
|
914
1026
|
(L?.parentElement?.clientWidth ?? 800) - 32,
|
|
915
1027
|
320
|
|
916
1028
|
);
|
|
917
|
-
for (const
|
|
918
|
-
if (
|
|
919
|
-
const
|
|
1029
|
+
for (const B of r.value) {
|
|
1030
|
+
if (s !== f) return;
|
|
1031
|
+
const T = await b.getPage(B), y = i.get(B), z = y?.getContext("2d");
|
|
920
1032
|
if (!y || !z) continue;
|
|
921
|
-
const
|
|
922
|
-
y.width = Math.floor(
|
|
923
|
-
const ie =
|
|
1033
|
+
const H = T.getViewport({ scale: 1 }), m = Math.min(S / H.width, 2), M = T.getViewport({ scale: m }), I = window.devicePixelRatio || 1;
|
|
1034
|
+
y.width = Math.floor(M.width * I), y.height = Math.floor(M.height * I), y.style.width = `${Math.floor(M.width)}px`, y.style.height = `${Math.floor(M.height)}px`, z.setTransform(I, 0, 0, I, 0, 0);
|
|
1035
|
+
const ie = T.render({
|
|
924
1036
|
canvas: y,
|
|
925
1037
|
canvasContext: z,
|
|
926
|
-
viewport:
|
|
1038
|
+
viewport: M
|
|
927
1039
|
});
|
|
928
|
-
|
|
1040
|
+
h.push(ie), await ie.promise;
|
|
929
1041
|
}
|
|
930
|
-
if (
|
|
931
|
-
|
|
932
|
-
} catch (
|
|
933
|
-
if (
|
|
934
|
-
|
|
1042
|
+
if (s !== f) return;
|
|
1043
|
+
a.value = "ready", t("previewLoad", new Event("load"));
|
|
1044
|
+
} catch (d) {
|
|
1045
|
+
if (s !== f) return;
|
|
1046
|
+
a.value = "error", u.value = d instanceof Error ? d.message : c("common.PDF加载失败"), t("previewError", new Event("error"));
|
|
935
1047
|
}
|
|
936
1048
|
}
|
|
937
|
-
$(() => e.url,
|
|
938
|
-
function
|
|
939
|
-
if (!
|
|
940
|
-
|
|
1049
|
+
$(() => e.url, R, { immediate: !0 }), G(g);
|
|
1050
|
+
function P(s) {
|
|
1051
|
+
if (!s) return;
|
|
1052
|
+
i.get(s)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
941
1053
|
}
|
|
942
|
-
return () =>
|
|
943
|
-
|
|
1054
|
+
return () => o("div", { class: "jt-attachment-preview-service__pdf-viewer" }, [
|
|
1055
|
+
a.value === "loading" ? o(
|
|
944
1056
|
"div",
|
|
945
1057
|
{ class: "jt-attachment-preview-service__pdf-state" },
|
|
946
|
-
|
|
1058
|
+
c("common.PDF加载中___")
|
|
947
1059
|
) : null,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
icon:
|
|
1060
|
+
a.value === "error" ? o("div", { class: "jt-attachment-preview-service__pdf-state" }, [
|
|
1061
|
+
ve({
|
|
1062
|
+
icon: Ne,
|
|
951
1063
|
name: e.name
|
|
952
1064
|
})
|
|
953
1065
|
]) : null,
|
|
954
1066
|
null,
|
|
955
1067
|
null,
|
|
956
|
-
|
|
1068
|
+
o(
|
|
957
1069
|
"div",
|
|
958
1070
|
{
|
|
959
1071
|
class: [
|
|
960
1072
|
"jt-attachment-preview-service__pdf-layout",
|
|
961
|
-
|
|
1073
|
+
a.value !== "ready" ? "jt-attachment-preview-service__pdf-layout--hidden" : ""
|
|
962
1074
|
]
|
|
963
1075
|
},
|
|
964
1076
|
[
|
|
965
|
-
|
|
1077
|
+
n.value.length ? o(
|
|
966
1078
|
"aside",
|
|
967
1079
|
{ class: "jt-attachment-preview-service__pdf-outline" },
|
|
968
1080
|
[
|
|
969
|
-
|
|
1081
|
+
o(
|
|
970
1082
|
"div",
|
|
971
1083
|
{
|
|
972
1084
|
class: "jt-attachment-preview-service__pdf-outline-title"
|
|
973
1085
|
},
|
|
974
|
-
|
|
1086
|
+
c("common.目录")
|
|
975
1087
|
),
|
|
976
|
-
|
|
1088
|
+
o(
|
|
977
1089
|
"div",
|
|
978
1090
|
{
|
|
979
1091
|
class: "jt-attachment-preview-service__pdf-outline-list"
|
|
980
1092
|
},
|
|
981
|
-
|
|
982
|
-
(
|
|
1093
|
+
n.value.map(
|
|
1094
|
+
(s, d) => o(
|
|
983
1095
|
"button",
|
|
984
1096
|
{
|
|
985
|
-
key: `${
|
|
1097
|
+
key: `${s.title}-${d}`,
|
|
986
1098
|
class: "jt-attachment-preview-service__pdf-outline-item",
|
|
987
|
-
style: { paddingLeft: `${12 +
|
|
1099
|
+
style: { paddingLeft: `${12 + s.level * 14}px` },
|
|
988
1100
|
type: "button",
|
|
989
|
-
disabled: !
|
|
990
|
-
title:
|
|
991
|
-
onClick: () =>
|
|
1101
|
+
disabled: !s.pageNumber,
|
|
1102
|
+
title: s.title,
|
|
1103
|
+
onClick: () => P(s.pageNumber)
|
|
992
1104
|
},
|
|
993
|
-
|
|
1105
|
+
s.title
|
|
994
1106
|
)
|
|
995
1107
|
)
|
|
996
1108
|
)
|
|
997
1109
|
]
|
|
998
1110
|
) : null,
|
|
999
|
-
|
|
1111
|
+
o(
|
|
1000
1112
|
"div",
|
|
1001
1113
|
{ class: "jt-attachment-preview-service__pdf-pages" },
|
|
1002
|
-
|
|
1003
|
-
(
|
|
1004
|
-
key:
|
|
1005
|
-
ref: (
|
|
1006
|
-
|
|
1114
|
+
r.value.map(
|
|
1115
|
+
(s) => o("canvas", {
|
|
1116
|
+
key: s,
|
|
1117
|
+
ref: (d) => {
|
|
1118
|
+
d instanceof HTMLCanvasElement && i.set(s, d);
|
|
1007
1119
|
},
|
|
1008
1120
|
class: "jt-attachment-preview-service__pdf-page"
|
|
1009
1121
|
})
|
|
@@ -1013,7 +1125,7 @@ const et = E({
|
|
|
1013
1125
|
)
|
|
1014
1126
|
]);
|
|
1015
1127
|
}
|
|
1016
|
-
}),
|
|
1128
|
+
}), it = x({
|
|
1017
1129
|
name: "JtAttachmentPreviewImageTransform",
|
|
1018
1130
|
props: {
|
|
1019
1131
|
url: {
|
|
@@ -1042,130 +1154,130 @@ const et = E({
|
|
|
1042
1154
|
previewError: (e) => e instanceof Event
|
|
1043
1155
|
},
|
|
1044
1156
|
setup(e, { emit: t }) {
|
|
1045
|
-
const
|
|
1046
|
-
let
|
|
1047
|
-
const
|
|
1157
|
+
const a = j(null), r = j("ready"), n = j(1), i = j(!1);
|
|
1158
|
+
let u = 0, l = 0, h = 0, f = 0, v = 0, k = 0, g = 0;
|
|
1159
|
+
const R = E(
|
|
1048
1160
|
() => ({
|
|
1049
1161
|
"--jt-attachment-preview-service-image-fit": e.fit,
|
|
1050
|
-
transform: `translate(${
|
|
1162
|
+
transform: `translate(${u}px, ${l}px) scale(${n.value})`
|
|
1051
1163
|
})
|
|
1052
1164
|
);
|
|
1053
|
-
function
|
|
1054
|
-
|
|
1165
|
+
function P() {
|
|
1166
|
+
a.value && (a.value.style.transform = `translate(${u}px, ${l}px) scale(${n.value})`);
|
|
1055
1167
|
}
|
|
1056
|
-
function
|
|
1057
|
-
|
|
1058
|
-
|
|
1168
|
+
function s() {
|
|
1169
|
+
g || (g = window.requestAnimationFrame(() => {
|
|
1170
|
+
g = 0, P();
|
|
1059
1171
|
}));
|
|
1060
1172
|
}
|
|
1061
|
-
function
|
|
1062
|
-
|
|
1063
|
-
}
|
|
1064
|
-
function g() {
|
|
1065
|
-
u(i.value + 0.2);
|
|
1173
|
+
function d(m) {
|
|
1174
|
+
n.value = Math.min(Math.max(Number(m.toFixed(2)), 0.2), 5), n.value <= 1 && (u = 0, l = 0), P();
|
|
1066
1175
|
}
|
|
1067
1176
|
function w() {
|
|
1068
|
-
|
|
1069
|
-
|
|
1177
|
+
d(n.value + 0.2);
|
|
1178
|
+
}
|
|
1179
|
+
function b() {
|
|
1180
|
+
const m = Math.max(Number((n.value - 0.2).toFixed(2)), 0.2);
|
|
1181
|
+
n.value = m, m <= 1 && (u = 0, l = 0), P();
|
|
1070
1182
|
}
|
|
1071
1183
|
function L() {
|
|
1072
|
-
|
|
1184
|
+
u = 0, l = 0, d(1);
|
|
1073
1185
|
}
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1186
|
+
function S(m) {
|
|
1187
|
+
r.value = "ready", t("previewLoad", m);
|
|
1076
1188
|
}
|
|
1077
|
-
function
|
|
1078
|
-
|
|
1189
|
+
function B(m) {
|
|
1190
|
+
r.value = "error", t("previewError", m);
|
|
1079
1191
|
}
|
|
1080
|
-
function
|
|
1081
|
-
|
|
1192
|
+
function T(m) {
|
|
1193
|
+
n.value <= 1 || (m.preventDefault(), i.value = !0, h = m.clientX, f = m.clientY, v = u, k = l, window.addEventListener("pointermove", y), window.addEventListener("pointerup", z, { once: !0 }));
|
|
1082
1194
|
}
|
|
1083
|
-
function y(
|
|
1084
|
-
|
|
1195
|
+
function y(m) {
|
|
1196
|
+
i.value && (u = v + m.clientX - h, l = k + m.clientY - f, s());
|
|
1085
1197
|
}
|
|
1086
1198
|
function z() {
|
|
1087
|
-
|
|
1199
|
+
i.value = !1, window.removeEventListener("pointermove", y);
|
|
1088
1200
|
}
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1201
|
+
function H(m) {
|
|
1202
|
+
m.preventDefault(), d(n.value + (m.deltaY < 0 ? 0.1 : -0.1));
|
|
1091
1203
|
}
|
|
1092
|
-
return ee(
|
|
1204
|
+
return ee(P), $(
|
|
1093
1205
|
() => e.url,
|
|
1094
1206
|
() => {
|
|
1095
|
-
|
|
1207
|
+
r.value = "ready", L();
|
|
1096
1208
|
}
|
|
1097
|
-
),
|
|
1098
|
-
window.removeEventListener("pointermove", y),
|
|
1099
|
-
}), () =>
|
|
1209
|
+
), G(() => {
|
|
1210
|
+
window.removeEventListener("pointermove", y), g && window.cancelAnimationFrame(g);
|
|
1211
|
+
}), () => o(
|
|
1100
1212
|
"div",
|
|
1101
1213
|
{ class: "jt-attachment-preview-service__image-viewer" },
|
|
1102
|
-
|
|
1103
|
-
icon:
|
|
1214
|
+
r.value === "error" ? ve({
|
|
1215
|
+
icon: Oe,
|
|
1104
1216
|
name: e.name
|
|
1105
1217
|
}) : [
|
|
1106
|
-
|
|
1107
|
-
ref:
|
|
1218
|
+
o("img", {
|
|
1219
|
+
ref: a,
|
|
1108
1220
|
class: [
|
|
1109
1221
|
"jt-attachment-preview-service__media",
|
|
1110
1222
|
"jt-attachment-preview-service__image",
|
|
1111
|
-
|
|
1112
|
-
|
|
1223
|
+
n.value > 1 ? "jt-attachment-preview-service__image--draggable" : "",
|
|
1224
|
+
i.value ? "jt-attachment-preview-service__image--dragging" : ""
|
|
1113
1225
|
],
|
|
1114
1226
|
src: e.url,
|
|
1115
1227
|
alt: e.name,
|
|
1116
|
-
style:
|
|
1117
|
-
onLoad:
|
|
1118
|
-
onError:
|
|
1119
|
-
onPointerdown:
|
|
1120
|
-
onWheel:
|
|
1121
|
-
onDragstart: (
|
|
1228
|
+
style: R.value,
|
|
1229
|
+
onLoad: S,
|
|
1230
|
+
onError: B,
|
|
1231
|
+
onPointerdown: T,
|
|
1232
|
+
onWheel: H,
|
|
1233
|
+
onDragstart: (m) => m.preventDefault(),
|
|
1122
1234
|
draggable: !1
|
|
1123
1235
|
}),
|
|
1124
|
-
|
|
1236
|
+
o(
|
|
1125
1237
|
"div",
|
|
1126
1238
|
{ class: "jt-attachment-preview-service__image-toolbar" },
|
|
1127
1239
|
[
|
|
1128
|
-
|
|
1240
|
+
o(
|
|
1129
1241
|
"button",
|
|
1130
1242
|
{
|
|
1131
1243
|
class: "jt-attachment-preview-service__image-tool",
|
|
1132
1244
|
type: "button",
|
|
1133
|
-
title:
|
|
1134
|
-
onClick:
|
|
1245
|
+
title: c("common.缩小"),
|
|
1246
|
+
onClick: b
|
|
1135
1247
|
},
|
|
1136
|
-
[
|
|
1248
|
+
[o(J, () => o(Ye))]
|
|
1137
1249
|
),
|
|
1138
|
-
|
|
1250
|
+
o(
|
|
1139
1251
|
"span",
|
|
1140
1252
|
{ class: "jt-attachment-preview-service__image-scale" },
|
|
1141
|
-
`${Math.round(
|
|
1253
|
+
`${Math.round(n.value * 100)}%`
|
|
1142
1254
|
),
|
|
1143
|
-
|
|
1255
|
+
o(
|
|
1144
1256
|
"button",
|
|
1145
1257
|
{
|
|
1146
1258
|
class: "jt-attachment-preview-service__image-tool",
|
|
1147
1259
|
type: "button",
|
|
1148
|
-
title:
|
|
1149
|
-
onClick:
|
|
1260
|
+
title: c("common.放大"),
|
|
1261
|
+
onClick: w
|
|
1150
1262
|
},
|
|
1151
|
-
[
|
|
1263
|
+
[o(J, () => o(Je))]
|
|
1152
1264
|
),
|
|
1153
|
-
|
|
1265
|
+
o(
|
|
1154
1266
|
"button",
|
|
1155
1267
|
{
|
|
1156
1268
|
class: "jt-attachment-preview-service__image-tool",
|
|
1157
1269
|
type: "button",
|
|
1158
|
-
title:
|
|
1270
|
+
title: c("common.复位"),
|
|
1159
1271
|
onClick: L
|
|
1160
1272
|
},
|
|
1161
|
-
[
|
|
1273
|
+
[o(J, () => o(Ue))]
|
|
1162
1274
|
)
|
|
1163
1275
|
]
|
|
1164
1276
|
)
|
|
1165
1277
|
]
|
|
1166
1278
|
);
|
|
1167
1279
|
}
|
|
1168
|
-
}),
|
|
1280
|
+
}), lt = x({
|
|
1169
1281
|
name: "JtAttachmentPreviewService",
|
|
1170
1282
|
props: {
|
|
1171
1283
|
options: {
|
|
@@ -1178,49 +1290,49 @@ const et = E({
|
|
|
1178
1290
|
}
|
|
1179
1291
|
},
|
|
1180
1292
|
setup(e) {
|
|
1181
|
-
const t =
|
|
1182
|
-
() =>
|
|
1183
|
-
),
|
|
1293
|
+
const t = E(
|
|
1294
|
+
() => ae(e.options.url, e.options.name)
|
|
1295
|
+
), a = E(
|
|
1184
1296
|
() => e.options.downloadName || t.value
|
|
1185
|
-
),
|
|
1186
|
-
() =>
|
|
1187
|
-
),
|
|
1297
|
+
), r = E(() => me(e.options)), n = E(
|
|
1298
|
+
() => at(r.value, e.options.url)
|
|
1299
|
+
), i = E(
|
|
1188
1300
|
() => ({
|
|
1189
1301
|
zIndex: e.options.zIndex ?? 3e3,
|
|
1190
1302
|
"--jt-attachment-preview-service-image-fit": e.options.fit ?? "contain"
|
|
1191
1303
|
})
|
|
1192
1304
|
);
|
|
1193
|
-
function
|
|
1305
|
+
function u() {
|
|
1194
1306
|
e.options.onClose?.(), e.onDestroy();
|
|
1195
1307
|
}
|
|
1196
|
-
function
|
|
1197
|
-
v.key === "Escape" && e.options.closeOnPressEscape !== !1 &&
|
|
1308
|
+
function l(v) {
|
|
1309
|
+
v.key === "Escape" && e.options.closeOnPressEscape !== !1 && u();
|
|
1198
1310
|
}
|
|
1199
|
-
function
|
|
1311
|
+
function h(v) {
|
|
1200
1312
|
e.options.onLoad?.(v);
|
|
1201
1313
|
}
|
|
1202
1314
|
function f(v) {
|
|
1203
1315
|
e.options.onError?.(v);
|
|
1204
1316
|
}
|
|
1205
1317
|
return ee(() => {
|
|
1206
|
-
document.addEventListener("keydown",
|
|
1207
|
-
}),
|
|
1208
|
-
document.removeEventListener("keydown",
|
|
1318
|
+
document.addEventListener("keydown", l), document.body.classList.add("jt-attachment-preview-service-lock");
|
|
1319
|
+
}), G(() => {
|
|
1320
|
+
document.removeEventListener("keydown", l), document.body.classList.remove("jt-attachment-preview-service-lock");
|
|
1209
1321
|
}), () => {
|
|
1210
1322
|
const v = e.options.downloadable === !1 ? [] : [
|
|
1211
|
-
|
|
1212
|
-
e.options
|
|
1213
|
-
|
|
1323
|
+
pe(
|
|
1324
|
+
e.options,
|
|
1325
|
+
a.value,
|
|
1214
1326
|
"jt-attachment-preview-service__top-download"
|
|
1215
1327
|
)
|
|
1216
1328
|
];
|
|
1217
|
-
return
|
|
1329
|
+
return o(
|
|
1218
1330
|
"div",
|
|
1219
|
-
{ class: "jt-attachment-preview-service", style:
|
|
1331
|
+
{ class: "jt-attachment-preview-service", style: i.value },
|
|
1220
1332
|
[
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1333
|
+
o("div", { class: "jt-attachment-preview-service__modal" }, [
|
|
1334
|
+
o("div", { class: "jt-attachment-preview-service__header" }, [
|
|
1335
|
+
o(
|
|
1224
1336
|
"div",
|
|
1225
1337
|
{
|
|
1226
1338
|
class: "jt-attachment-preview-service__filename",
|
|
@@ -1228,34 +1340,35 @@ const et = E({
|
|
|
1228
1340
|
},
|
|
1229
1341
|
t.value
|
|
1230
1342
|
),
|
|
1231
|
-
|
|
1343
|
+
o(
|
|
1232
1344
|
"div",
|
|
1233
1345
|
{ class: "jt-attachment-preview-service__header-actions" },
|
|
1234
1346
|
[
|
|
1235
1347
|
...v,
|
|
1236
|
-
|
|
1348
|
+
o(
|
|
1237
1349
|
"button",
|
|
1238
1350
|
{
|
|
1239
1351
|
class: "jt-attachment-preview-service__close",
|
|
1240
1352
|
type: "button",
|
|
1241
|
-
"aria-label":
|
|
1242
|
-
onClick:
|
|
1353
|
+
"aria-label": c("common.关闭"),
|
|
1354
|
+
onClick: u
|
|
1243
1355
|
},
|
|
1244
1356
|
"×"
|
|
1245
1357
|
)
|
|
1246
1358
|
]
|
|
1247
1359
|
)
|
|
1248
1360
|
]),
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
type:
|
|
1361
|
+
o("div", { class: "jt-attachment-preview-service__body" }, [
|
|
1362
|
+
st({
|
|
1363
|
+
type: r.value,
|
|
1252
1364
|
url: e.options.url,
|
|
1253
1365
|
name: t.value,
|
|
1254
|
-
downloadName:
|
|
1366
|
+
downloadName: a.value,
|
|
1367
|
+
sourceOptions: e.options,
|
|
1255
1368
|
sandbox: e.options.sandbox,
|
|
1256
|
-
iconText:
|
|
1369
|
+
iconText: n.value,
|
|
1257
1370
|
downloadable: e.options.downloadable !== !1,
|
|
1258
|
-
onLoad:
|
|
1371
|
+
onLoad: h,
|
|
1259
1372
|
onError: f
|
|
1260
1373
|
})
|
|
1261
1374
|
])
|
|
@@ -1264,7 +1377,7 @@ const et = E({
|
|
|
1264
1377
|
);
|
|
1265
1378
|
};
|
|
1266
1379
|
}
|
|
1267
|
-
}),
|
|
1380
|
+
}), F = x({
|
|
1268
1381
|
name: "JtAttachmentPreviewDetectingService",
|
|
1269
1382
|
props: {
|
|
1270
1383
|
options: {
|
|
@@ -1277,11 +1390,11 @@ const et = E({
|
|
|
1277
1390
|
},
|
|
1278
1391
|
title: {
|
|
1279
1392
|
type: String,
|
|
1280
|
-
default:
|
|
1393
|
+
default: c("common.正在识别文件类型")
|
|
1281
1394
|
},
|
|
1282
1395
|
desc: {
|
|
1283
1396
|
type: String,
|
|
1284
|
-
default:
|
|
1397
|
+
default: c("common.请稍候,识别完成后将自动预览或下载")
|
|
1285
1398
|
},
|
|
1286
1399
|
spinning: {
|
|
1287
1400
|
type: Boolean,
|
|
@@ -1289,28 +1402,28 @@ const et = E({
|
|
|
1289
1402
|
}
|
|
1290
1403
|
},
|
|
1291
1404
|
setup(e) {
|
|
1292
|
-
const t =
|
|
1293
|
-
() =>
|
|
1294
|
-
),
|
|
1405
|
+
const t = E(
|
|
1406
|
+
() => ae(e.options.url, e.options.name)
|
|
1407
|
+
), a = E(() => ({
|
|
1295
1408
|
zIndex: e.options.zIndex ?? 3e3
|
|
1296
1409
|
}));
|
|
1297
|
-
function
|
|
1410
|
+
function r() {
|
|
1298
1411
|
e.options.onClose?.(), e.onDestroy();
|
|
1299
1412
|
}
|
|
1300
|
-
function i
|
|
1301
|
-
|
|
1413
|
+
function n(i) {
|
|
1414
|
+
i.key === "Escape" && e.options.closeOnPressEscape !== !1 && r();
|
|
1302
1415
|
}
|
|
1303
1416
|
return ee(() => {
|
|
1304
|
-
document.addEventListener("keydown",
|
|
1305
|
-
}),
|
|
1306
|
-
document.removeEventListener("keydown",
|
|
1307
|
-
}), () =>
|
|
1417
|
+
document.addEventListener("keydown", n), document.body.classList.add("jt-attachment-preview-service-lock");
|
|
1418
|
+
}), G(() => {
|
|
1419
|
+
document.removeEventListener("keydown", n), document.body.classList.remove("jt-attachment-preview-service-lock");
|
|
1420
|
+
}), () => o(
|
|
1308
1421
|
"div",
|
|
1309
|
-
{ class: "jt-attachment-preview-service", style:
|
|
1422
|
+
{ class: "jt-attachment-preview-service", style: a.value },
|
|
1310
1423
|
[
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1424
|
+
o("div", { class: "jt-attachment-preview-service__modal" }, [
|
|
1425
|
+
o("div", { class: "jt-attachment-preview-service__header" }, [
|
|
1426
|
+
o(
|
|
1314
1427
|
"div",
|
|
1315
1428
|
{
|
|
1316
1429
|
class: "jt-attachment-preview-service__filename",
|
|
@@ -1318,34 +1431,34 @@ const et = E({
|
|
|
1318
1431
|
},
|
|
1319
1432
|
t.value
|
|
1320
1433
|
),
|
|
1321
|
-
|
|
1434
|
+
o(
|
|
1322
1435
|
"div",
|
|
1323
1436
|
{ class: "jt-attachment-preview-service__header-actions" },
|
|
1324
1437
|
[
|
|
1325
|
-
|
|
1438
|
+
o(
|
|
1326
1439
|
"button",
|
|
1327
1440
|
{
|
|
1328
1441
|
class: "jt-attachment-preview-service__close",
|
|
1329
1442
|
type: "button",
|
|
1330
|
-
"aria-label":
|
|
1331
|
-
onClick:
|
|
1443
|
+
"aria-label": c("common.关闭"),
|
|
1444
|
+
onClick: r
|
|
1332
1445
|
},
|
|
1333
1446
|
"×"
|
|
1334
1447
|
)
|
|
1335
1448
|
]
|
|
1336
1449
|
)
|
|
1337
1450
|
]),
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
e.spinning ?
|
|
1451
|
+
o("div", { class: "jt-attachment-preview-service__body" }, [
|
|
1452
|
+
o("div", { class: "jt-attachment-preview-service__detecting" }, [
|
|
1453
|
+
e.spinning ? o("span", {
|
|
1341
1454
|
class: "jt-attachment-preview-service__detecting-spinner"
|
|
1342
1455
|
}) : null,
|
|
1343
|
-
|
|
1456
|
+
o(
|
|
1344
1457
|
"span",
|
|
1345
1458
|
{ class: "jt-attachment-preview-service__detecting-title" },
|
|
1346
1459
|
e.title
|
|
1347
1460
|
),
|
|
1348
|
-
|
|
1461
|
+
o(
|
|
1349
1462
|
"span",
|
|
1350
1463
|
{ class: "jt-attachment-preview-service__detecting-desc" },
|
|
1351
1464
|
e.desc
|
|
@@ -1357,57 +1470,57 @@ const et = E({
|
|
|
1357
1470
|
);
|
|
1358
1471
|
}
|
|
1359
1472
|
});
|
|
1360
|
-
function
|
|
1361
|
-
return e.type === "empty" ?
|
|
1473
|
+
function st(e) {
|
|
1474
|
+
return e.type === "empty" ? o(
|
|
1362
1475
|
"div",
|
|
1363
1476
|
{ class: "jt-attachment-preview-service__empty" },
|
|
1364
|
-
|
|
1365
|
-
) : e.type === "image" ?
|
|
1477
|
+
c("common.暂无附件")
|
|
1478
|
+
) : e.type === "image" ? o(it, {
|
|
1366
1479
|
url: e.url,
|
|
1367
1480
|
name: e.name,
|
|
1368
1481
|
downloadName: e.downloadName,
|
|
1369
1482
|
downloadable: e.downloadable,
|
|
1370
1483
|
onPreviewLoad: e.onLoad,
|
|
1371
1484
|
onPreviewError: e.onError
|
|
1372
|
-
}) : e.type === "video" ?
|
|
1485
|
+
}) : e.type === "video" ? o("video", {
|
|
1373
1486
|
class: "jt-attachment-preview-service__media",
|
|
1374
1487
|
src: e.url,
|
|
1375
1488
|
controls: !0,
|
|
1376
1489
|
onLoadeddata: e.onLoad,
|
|
1377
1490
|
onError: e.onError
|
|
1378
|
-
}) : e.type === "audio" ?
|
|
1491
|
+
}) : e.type === "audio" ? o("audio", {
|
|
1379
1492
|
class: "jt-attachment-preview-service__audio",
|
|
1380
1493
|
src: e.url,
|
|
1381
1494
|
controls: !0,
|
|
1382
1495
|
onLoadeddata: e.onLoad,
|
|
1383
1496
|
onError: e.onError
|
|
1384
|
-
}) : e.type === "pdf" ?
|
|
1497
|
+
}) : e.type === "pdf" ? o(rt, {
|
|
1385
1498
|
url: e.url,
|
|
1386
1499
|
name: e.name,
|
|
1387
1500
|
downloadName: e.downloadName,
|
|
1388
1501
|
downloadable: e.downloadable,
|
|
1389
1502
|
onPreviewLoad: e.onLoad,
|
|
1390
1503
|
onPreviewError: e.onError
|
|
1391
|
-
}) : e.type === "iframe" ?
|
|
1504
|
+
}) : e.type === "iframe" ? o("iframe", {
|
|
1392
1505
|
class: "jt-attachment-preview-service__iframe",
|
|
1393
1506
|
src: e.url,
|
|
1394
1507
|
title: e.name,
|
|
1395
1508
|
sandbox: e.sandbox || void 0,
|
|
1396
1509
|
onLoad: e.onLoad
|
|
1397
|
-
}) :
|
|
1398
|
-
|
|
1399
|
-
|
|
1510
|
+
}) : o("div", { class: "jt-attachment-preview-service__unsupported" }, [
|
|
1511
|
+
o("div", { class: "jt-attachment-preview-service__file-card" }, [
|
|
1512
|
+
o(
|
|
1400
1513
|
"div",
|
|
1401
1514
|
{ class: "jt-attachment-preview-service__file-icon" },
|
|
1402
1515
|
e.iconText
|
|
1403
1516
|
),
|
|
1404
|
-
|
|
1517
|
+
o(
|
|
1405
1518
|
"div",
|
|
1406
1519
|
{ class: "jt-attachment-preview-service__unsupported-text" },
|
|
1407
|
-
|
|
1520
|
+
c("common.暂不支持预览此类型的文件")
|
|
1408
1521
|
)
|
|
1409
1522
|
]),
|
|
1410
|
-
|
|
1523
|
+
o(
|
|
1411
1524
|
"div",
|
|
1412
1525
|
{
|
|
1413
1526
|
class: "jt-attachment-preview-service__file-name",
|
|
@@ -1415,158 +1528,159 @@ function at(e) {
|
|
|
1415
1528
|
},
|
|
1416
1529
|
e.name
|
|
1417
1530
|
),
|
|
1418
|
-
e.downloadable ?
|
|
1419
|
-
e.
|
|
1531
|
+
e.downloadable ? pe(
|
|
1532
|
+
e.sourceOptions,
|
|
1420
1533
|
e.downloadName,
|
|
1421
1534
|
"jt-attachment-preview-service__primary-download"
|
|
1422
1535
|
) : null
|
|
1423
1536
|
]);
|
|
1424
1537
|
}
|
|
1425
|
-
function
|
|
1538
|
+
function ge(e) {
|
|
1426
1539
|
if (typeof document > "u")
|
|
1427
1540
|
return { close: () => {
|
|
1428
1541
|
} };
|
|
1429
|
-
|
|
1542
|
+
p("open-called", {
|
|
1430
1543
|
rawOptions: typeof e == "string" ? e : { ...e }
|
|
1431
|
-
}),
|
|
1432
|
-
const t =
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1544
|
+
}), D?.close();
|
|
1545
|
+
const t = Xe(
|
|
1546
|
+
e
|
|
1547
|
+
), a = t.downloadName || ae(t.url, t.name);
|
|
1548
|
+
let r = !1, n = null, i = null;
|
|
1549
|
+
const u = () => {
|
|
1550
|
+
r = !0, n && (_(null, n), n.remove(), n = null), i && (URL.revokeObjectURL(i), i = null), D?.close === u && (D = null);
|
|
1436
1551
|
};
|
|
1437
|
-
function
|
|
1438
|
-
|
|
1439
|
-
|
|
1552
|
+
function l() {
|
|
1553
|
+
r || (n || (n = document.createElement("div"), document.body.appendChild(n)), _(
|
|
1554
|
+
o(lt, {
|
|
1440
1555
|
options: t,
|
|
1441
|
-
onDestroy:
|
|
1556
|
+
onDestroy: u
|
|
1442
1557
|
}),
|
|
1443
|
-
|
|
1558
|
+
n
|
|
1444
1559
|
));
|
|
1445
1560
|
}
|
|
1446
|
-
function
|
|
1447
|
-
|
|
1448
|
-
|
|
1561
|
+
function h() {
|
|
1562
|
+
r || (n || (n = document.createElement("div"), document.body.appendChild(n)), _(
|
|
1563
|
+
o(F, {
|
|
1449
1564
|
options: t,
|
|
1450
|
-
onDestroy:
|
|
1565
|
+
onDestroy: u
|
|
1451
1566
|
}),
|
|
1452
|
-
|
|
1567
|
+
n
|
|
1453
1568
|
));
|
|
1454
1569
|
}
|
|
1455
1570
|
function f() {
|
|
1456
|
-
|
|
1571
|
+
n && (_(null, n), n.remove(), n = null);
|
|
1457
1572
|
}
|
|
1458
1573
|
function v() {
|
|
1459
|
-
|
|
1574
|
+
r || he(t, a, {
|
|
1460
1575
|
fallbackToRawUrl: !0
|
|
1461
1576
|
});
|
|
1462
1577
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
Z(p, n), URL.revokeObjectURL(p);
|
|
1467
|
-
}
|
|
1468
|
-
const h = ce(t);
|
|
1469
|
-
return k("type-resolved", {
|
|
1470
|
-
resolvedType: h,
|
|
1578
|
+
const k = me(t);
|
|
1579
|
+
return p("type-resolved", {
|
|
1580
|
+
resolvedType: k,
|
|
1471
1581
|
url: t.url,
|
|
1472
1582
|
name: t.name,
|
|
1473
1583
|
mode: t.mode,
|
|
1474
1584
|
mimeType: t.mimeType,
|
|
1475
1585
|
extension: t.extension
|
|
1476
|
-
}),
|
|
1477
|
-
if (!
|
|
1478
|
-
if (
|
|
1479
|
-
t.mode =
|
|
1586
|
+
}), W(k) ? l() : k === "unknown" ? (h(), et(t.url).then(async (g) => {
|
|
1587
|
+
if (!r) {
|
|
1588
|
+
if (W(g)) {
|
|
1589
|
+
t.mode = g, l();
|
|
1480
1590
|
return;
|
|
1481
1591
|
}
|
|
1482
1592
|
try {
|
|
1483
|
-
const
|
|
1484
|
-
if (
|
|
1485
|
-
|
|
1593
|
+
const R = await fe(t.url), P = ne(R.type);
|
|
1594
|
+
if (W(P)) {
|
|
1595
|
+
i = URL.createObjectURL(R), t.url = i, t.mode = P, l();
|
|
1486
1596
|
return;
|
|
1487
1597
|
}
|
|
1488
|
-
f(),
|
|
1598
|
+
f(), re(R, a);
|
|
1489
1599
|
} catch {
|
|
1490
1600
|
f(), v();
|
|
1491
1601
|
}
|
|
1492
1602
|
}
|
|
1493
|
-
})) : v(),
|
|
1603
|
+
})) : v(), D = { close: u }, D;
|
|
1494
1604
|
}
|
|
1495
|
-
function
|
|
1496
|
-
|
|
1605
|
+
function ct(e) {
|
|
1606
|
+
A = e;
|
|
1497
1607
|
}
|
|
1498
|
-
function
|
|
1608
|
+
function ut(e) {
|
|
1499
1609
|
if (typeof document > "u")
|
|
1500
1610
|
return { close: () => {
|
|
1501
1611
|
} };
|
|
1502
|
-
|
|
1503
|
-
let t = !1,
|
|
1504
|
-
document.body.appendChild(
|
|
1505
|
-
const
|
|
1506
|
-
t = !0,
|
|
1507
|
-
},
|
|
1508
|
-
return
|
|
1509
|
-
|
|
1510
|
-
options: { url: "", name:
|
|
1511
|
-
title:
|
|
1512
|
-
desc:
|
|
1612
|
+
D?.close();
|
|
1613
|
+
let t = !1, a = document.createElement("div");
|
|
1614
|
+
document.body.appendChild(a);
|
|
1615
|
+
const r = () => {
|
|
1616
|
+
t = !0, a && (_(null, a), a.remove(), a = null), D?.close === r && (D = null);
|
|
1617
|
+
}, n = { close: r };
|
|
1618
|
+
return D = n, A ? (_(
|
|
1619
|
+
o(F, {
|
|
1620
|
+
options: { url: "", name: c("common.附件预览") },
|
|
1621
|
+
title: c("common.正在获取文件信息"),
|
|
1622
|
+
desc: c("common.请稍候,获取完成后将自动预览或下载"),
|
|
1513
1623
|
spinning: !0,
|
|
1514
|
-
onDestroy:
|
|
1624
|
+
onDestroy: r
|
|
1515
1625
|
}),
|
|
1516
|
-
|
|
1517
|
-
),
|
|
1626
|
+
a
|
|
1627
|
+
), A.request(e).then((i) => {
|
|
1518
1628
|
if (t) return;
|
|
1519
|
-
const
|
|
1520
|
-
if (!
|
|
1629
|
+
const u = A?.mapResponse(i, e);
|
|
1630
|
+
if (!u?.url) {
|
|
1521
1631
|
_(
|
|
1522
|
-
|
|
1523
|
-
options: { url: "", name:
|
|
1524
|
-
title:
|
|
1525
|
-
desc:
|
|
1632
|
+
o(F, {
|
|
1633
|
+
options: { url: "", name: c("common.附件预览") },
|
|
1634
|
+
title: c("common.文件信息缺少URL"),
|
|
1635
|
+
desc: c("common.请检查mapResponse是否返回了url字段"),
|
|
1526
1636
|
spinning: !1,
|
|
1527
|
-
onDestroy:
|
|
1637
|
+
onDestroy: r
|
|
1528
1638
|
}),
|
|
1529
|
-
|
|
1639
|
+
a
|
|
1530
1640
|
);
|
|
1531
1641
|
return;
|
|
1532
1642
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1643
|
+
ge({
|
|
1644
|
+
...u,
|
|
1645
|
+
requestParams: e,
|
|
1646
|
+
useRegisteredDownload: !0
|
|
1647
|
+
});
|
|
1648
|
+
}).catch((i) => {
|
|
1535
1649
|
if (t) return;
|
|
1536
|
-
const
|
|
1650
|
+
const u = i instanceof Error ? i.message : c("common.接口请求失败");
|
|
1537
1651
|
_(
|
|
1538
|
-
|
|
1539
|
-
options: { url: "", name:
|
|
1540
|
-
title:
|
|
1541
|
-
desc:
|
|
1652
|
+
o(F, {
|
|
1653
|
+
options: { url: "", name: c("common.附件预览") },
|
|
1654
|
+
title: c("common.文件信息获取失败"),
|
|
1655
|
+
desc: u,
|
|
1542
1656
|
spinning: !1,
|
|
1543
|
-
onDestroy:
|
|
1657
|
+
onDestroy: r
|
|
1544
1658
|
}),
|
|
1545
|
-
|
|
1659
|
+
a
|
|
1546
1660
|
);
|
|
1547
|
-
}),
|
|
1548
|
-
|
|
1549
|
-
options: { url: "", name:
|
|
1550
|
-
title:
|
|
1551
|
-
desc:
|
|
1661
|
+
}), n) : (_(
|
|
1662
|
+
o(F, {
|
|
1663
|
+
options: { url: "", name: c("common.附件预览") },
|
|
1664
|
+
title: c("common.附件预览未初始化"),
|
|
1665
|
+
desc: c("common.请先调用setupJtAttachmentPreview注册请求配置"),
|
|
1552
1666
|
spinning: !1,
|
|
1553
|
-
onDestroy:
|
|
1667
|
+
onDestroy: r
|
|
1554
1668
|
}),
|
|
1555
|
-
|
|
1556
|
-
),
|
|
1669
|
+
a
|
|
1670
|
+
), n);
|
|
1557
1671
|
}
|
|
1558
|
-
const
|
|
1559
|
-
openByParams:
|
|
1560
|
-
setup:
|
|
1672
|
+
const gt = Object.assign(ge, {
|
|
1673
|
+
openByParams: ut,
|
|
1674
|
+
setup: ct
|
|
1561
1675
|
});
|
|
1562
1676
|
export {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1677
|
+
gt as J,
|
|
1678
|
+
ut as a,
|
|
1679
|
+
ct as b,
|
|
1680
|
+
pt as g,
|
|
1681
|
+
ht as i,
|
|
1682
|
+
q as n,
|
|
1683
|
+
vt as r,
|
|
1684
|
+
ft as s,
|
|
1685
|
+
c as t
|
|
1572
1686
|
};
|