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