jit-viewer 1.0.9 → 1.1.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/iife/jit-viewer.min.css +1 -1
- package/dist/iife/jit-viewer.min.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.ts +106 -1
- package/dist/index.js +830 -183
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,18 @@ const EXTENSION_MAP = {
|
|
|
21
21
|
"markdown": "markdown",
|
|
22
22
|
"ofd": "ofd",
|
|
23
23
|
"html": "html",
|
|
24
|
-
"htm": "html"
|
|
24
|
+
"htm": "html",
|
|
25
|
+
// 图片格式
|
|
26
|
+
"jpg": "image",
|
|
27
|
+
"jpeg": "image",
|
|
28
|
+
"png": "image",
|
|
29
|
+
"gif": "image",
|
|
30
|
+
"webp": "image",
|
|
31
|
+
"svg": "image",
|
|
32
|
+
"bmp": "image",
|
|
33
|
+
"tiff": "image",
|
|
34
|
+
"tif": "image",
|
|
35
|
+
"ico": "image"
|
|
25
36
|
};
|
|
26
37
|
const MIME_MAP = {
|
|
27
38
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
@@ -35,7 +46,17 @@ const MIME_MAP = {
|
|
|
35
46
|
"text/x-markdown": "md",
|
|
36
47
|
"application/ofd": "ofd",
|
|
37
48
|
"text/html": "html",
|
|
38
|
-
"application/xhtml+xml": "html"
|
|
49
|
+
"application/xhtml+xml": "html",
|
|
50
|
+
// 图片 MIME 类型
|
|
51
|
+
"image/jpeg": "image",
|
|
52
|
+
"image/png": "image",
|
|
53
|
+
"image/gif": "image",
|
|
54
|
+
"image/webp": "image",
|
|
55
|
+
"image/svg+xml": "image",
|
|
56
|
+
"image/bmp": "image",
|
|
57
|
+
"image/tiff": "image",
|
|
58
|
+
"image/x-icon": "image",
|
|
59
|
+
"image/vnd.microsoft.icon": "image"
|
|
39
60
|
};
|
|
40
61
|
function getFileExtension(filename) {
|
|
41
62
|
const match = filename.toLowerCase().match(/\.([a-z0-9]+)$/);
|
|
@@ -13834,13 +13855,13 @@ function useViewerState() {
|
|
|
13834
13855
|
}
|
|
13835
13856
|
return context;
|
|
13836
13857
|
}
|
|
13837
|
-
const _hoisted_1$
|
|
13838
|
-
const _hoisted_2$
|
|
13839
|
-
const _hoisted_3$
|
|
13858
|
+
const _hoisted_1$d = ["disabled", "title"];
|
|
13859
|
+
const _hoisted_2$8 = { class: "jv-toolbar-btn__icon" };
|
|
13860
|
+
const _hoisted_3$3 = {
|
|
13840
13861
|
key: 0,
|
|
13841
13862
|
class: "jv-toolbar-btn__label"
|
|
13842
13863
|
};
|
|
13843
|
-
const _sfc_main$
|
|
13864
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
13844
13865
|
__name: "ActionButton",
|
|
13845
13866
|
props: {
|
|
13846
13867
|
type: {},
|
|
@@ -13864,11 +13885,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
13864
13885
|
title: __props.title,
|
|
13865
13886
|
onClick: handleClick
|
|
13866
13887
|
}, [
|
|
13867
|
-
createBaseVNode("span", _hoisted_2$
|
|
13888
|
+
createBaseVNode("span", _hoisted_2$8, [
|
|
13868
13889
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
13869
13890
|
]),
|
|
13870
|
-
__props.label ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
13871
|
-
], 10, _hoisted_1$
|
|
13891
|
+
__props.label ? (openBlock(), createElementBlock("span", _hoisted_3$3, toDisplayString(__props.label), 1)) : createCommentVNode("", true)
|
|
13892
|
+
], 10, _hoisted_1$d);
|
|
13872
13893
|
};
|
|
13873
13894
|
}
|
|
13874
13895
|
});
|
|
@@ -13879,11 +13900,11 @@ const _export_sfc = (sfc, props) => {
|
|
|
13879
13900
|
}
|
|
13880
13901
|
return target;
|
|
13881
13902
|
};
|
|
13882
|
-
const ActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
13883
|
-
const _hoisted_1$
|
|
13884
|
-
const _hoisted_2$
|
|
13903
|
+
const ActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-9abd52f0"]]);
|
|
13904
|
+
const _hoisted_1$c = { class: "jv-zoom-control" };
|
|
13905
|
+
const _hoisted_2$7 = { class: "jv-zoom-control__value" };
|
|
13885
13906
|
const ZOOM_STEP = 0.1;
|
|
13886
|
-
const _sfc_main$
|
|
13907
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
13887
13908
|
__name: "ZoomControl",
|
|
13888
13909
|
setup(__props) {
|
|
13889
13910
|
const { t } = useLocale();
|
|
@@ -13898,7 +13919,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
13898
13919
|
resetTransform();
|
|
13899
13920
|
}
|
|
13900
13921
|
return (_ctx, _cache) => {
|
|
13901
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
13922
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
13902
13923
|
createVNode(ActionButton, {
|
|
13903
13924
|
type: "zoom-out",
|
|
13904
13925
|
title: unref(t)("toolbar.zoomOut"),
|
|
@@ -13932,7 +13953,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
13932
13953
|
])]),
|
|
13933
13954
|
_: 1
|
|
13934
13955
|
}, 8, ["title"]),
|
|
13935
|
-
createBaseVNode("span", _hoisted_2$
|
|
13956
|
+
createBaseVNode("span", _hoisted_2$7, toDisplayString(Math.round(unref(zoom) * 100)) + "%", 1),
|
|
13936
13957
|
createVNode(ActionButton, {
|
|
13937
13958
|
type: "zoom-in",
|
|
13938
13959
|
title: unref(t)("toolbar.zoomIn"),
|
|
@@ -14006,10 +14027,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
14006
14027
|
};
|
|
14007
14028
|
}
|
|
14008
14029
|
});
|
|
14009
|
-
const ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14010
|
-
const _hoisted_1$
|
|
14030
|
+
const ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-874ddbac"]]);
|
|
14031
|
+
const _hoisted_1$b = { class: "jv-rotate-control" };
|
|
14011
14032
|
const ROTATE_STEP = 90;
|
|
14012
|
-
const _sfc_main$
|
|
14033
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
14013
14034
|
__name: "RotateControl",
|
|
14014
14035
|
setup(__props) {
|
|
14015
14036
|
const { t } = useLocale();
|
|
@@ -14021,7 +14042,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14021
14042
|
setRotate(ROTATE_STEP);
|
|
14022
14043
|
}
|
|
14023
14044
|
return (_ctx, _cache) => {
|
|
14024
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
14045
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
14025
14046
|
createVNode(ActionButton, {
|
|
14026
14047
|
type: "rotate-left",
|
|
14027
14048
|
title: unref(t)("toolbar.rotateLeft"),
|
|
@@ -14060,22 +14081,22 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14060
14081
|
};
|
|
14061
14082
|
}
|
|
14062
14083
|
});
|
|
14063
|
-
const RotateControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14064
|
-
const _hoisted_1$
|
|
14084
|
+
const RotateControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ad291658"]]);
|
|
14085
|
+
const _hoisted_1$a = {
|
|
14065
14086
|
key: 0,
|
|
14066
14087
|
viewBox: "0 0 24 24",
|
|
14067
14088
|
fill: "none",
|
|
14068
14089
|
stroke: "currentColor",
|
|
14069
14090
|
"stroke-width": "2"
|
|
14070
14091
|
};
|
|
14071
|
-
const _hoisted_2$
|
|
14092
|
+
const _hoisted_2$6 = {
|
|
14072
14093
|
key: 1,
|
|
14073
14094
|
viewBox: "0 0 24 24",
|
|
14074
14095
|
fill: "none",
|
|
14075
14096
|
stroke: "currentColor",
|
|
14076
14097
|
"stroke-width": "2"
|
|
14077
14098
|
};
|
|
14078
|
-
const _sfc_main$
|
|
14099
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
14079
14100
|
__name: "FullscreenButton",
|
|
14080
14101
|
setup(__props) {
|
|
14081
14102
|
const { t } = useLocale();
|
|
@@ -14104,9 +14125,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14104
14125
|
onClick: toggleFullscreen
|
|
14105
14126
|
}, {
|
|
14106
14127
|
default: withCtx(() => [
|
|
14107
|
-
!isFullscreen.value ? (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
14128
|
+
!isFullscreen.value ? (openBlock(), createElementBlock("svg", _hoisted_1$a, [..._cache[0] || (_cache[0] = [
|
|
14108
14129
|
createBaseVNode("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }, null, -1)
|
|
14109
|
-
])])) : (openBlock(), createElementBlock("svg", _hoisted_2$
|
|
14130
|
+
])])) : (openBlock(), createElementBlock("svg", _hoisted_2$6, [..._cache[1] || (_cache[1] = [
|
|
14110
14131
|
createBaseVNode("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }, null, -1)
|
|
14111
14132
|
])]))
|
|
14112
14133
|
]),
|
|
@@ -14115,18 +14136,18 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14115
14136
|
};
|
|
14116
14137
|
}
|
|
14117
14138
|
});
|
|
14118
|
-
const _hoisted_1$
|
|
14139
|
+
const _hoisted_1$9 = {
|
|
14119
14140
|
key: 0,
|
|
14120
14141
|
class: "jv-pagination"
|
|
14121
14142
|
};
|
|
14122
|
-
const _hoisted_2$
|
|
14123
|
-
const _sfc_main$
|
|
14143
|
+
const _hoisted_2$5 = { class: "jv-pagination__info" };
|
|
14144
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
14124
14145
|
__name: "Pagination",
|
|
14125
14146
|
setup(__props) {
|
|
14126
14147
|
const { t } = useLocale();
|
|
14127
14148
|
const { currentPage, totalPages, prevPage, nextPage } = useViewerState();
|
|
14128
14149
|
return (_ctx, _cache) => {
|
|
14129
|
-
return unref(totalPages) > 1 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
14150
|
+
return unref(totalPages) > 1 ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
14130
14151
|
createVNode(ActionButton, {
|
|
14131
14152
|
type: "prev",
|
|
14132
14153
|
title: unref(t)("toolbar.prevPage"),
|
|
@@ -14145,7 +14166,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14145
14166
|
])]),
|
|
14146
14167
|
_: 1
|
|
14147
14168
|
}, 8, ["title", "disabled", "onClick"]),
|
|
14148
|
-
createBaseVNode("span", _hoisted_2$
|
|
14169
|
+
createBaseVNode("span", _hoisted_2$5, toDisplayString(unref(t)("toolbar.pageInfo", { current: unref(currentPage).toString(), total: unref(totalPages).toString() })), 1),
|
|
14149
14170
|
createVNode(ActionButton, {
|
|
14150
14171
|
type: "next",
|
|
14151
14172
|
title: unref(t)("toolbar.nextPage"),
|
|
@@ -14168,17 +14189,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14168
14189
|
};
|
|
14169
14190
|
}
|
|
14170
14191
|
});
|
|
14171
|
-
const Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14172
|
-
const _hoisted_1$
|
|
14192
|
+
const Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-97c0759f"]]);
|
|
14193
|
+
const _hoisted_1$8 = {
|
|
14173
14194
|
key: 0,
|
|
14174
14195
|
class: "jv-toolbar__top"
|
|
14175
14196
|
};
|
|
14176
|
-
const _hoisted_2$
|
|
14177
|
-
const _hoisted_3$
|
|
14197
|
+
const _hoisted_2$4 = { class: "jv-toolbar__left" };
|
|
14198
|
+
const _hoisted_3$2 = {
|
|
14178
14199
|
key: 0,
|
|
14179
14200
|
class: "jv-toolbar__filename"
|
|
14180
14201
|
};
|
|
14181
|
-
const _hoisted_4$
|
|
14202
|
+
const _hoisted_4$2 = { class: "jv-toolbar__center" };
|
|
14182
14203
|
const _hoisted_5$1 = { class: "jv-toolbar__right" };
|
|
14183
14204
|
const _hoisted_6$1 = {
|
|
14184
14205
|
key: 1,
|
|
@@ -14187,7 +14208,7 @@ const _hoisted_6$1 = {
|
|
|
14187
14208
|
const _hoisted_7$1 = { class: "jv-toolbar__left" };
|
|
14188
14209
|
const _hoisted_8$1 = { class: "jv-toolbar__center" };
|
|
14189
14210
|
const _hoisted_9 = { class: "jv-toolbar__right" };
|
|
14190
|
-
const _sfc_main$
|
|
14211
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
14191
14212
|
__name: "Toolbar",
|
|
14192
14213
|
props: {
|
|
14193
14214
|
config: {},
|
|
@@ -14245,20 +14266,20 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
14245
14266
|
return openBlock(), createElementBlock("div", {
|
|
14246
14267
|
class: normalizeClass(["jv-toolbar", [positionClass.value, { "jv-toolbar--hidden": !__props.visible }]])
|
|
14247
14268
|
}, [
|
|
14248
|
-
showTop.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
14249
|
-
createBaseVNode("div", _hoisted_2$
|
|
14269
|
+
showTop.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
14270
|
+
createBaseVNode("div", _hoisted_2$4, [
|
|
14250
14271
|
renderSlot(_ctx.$slots, "top-left", {}, () => [
|
|
14251
|
-
unref(filename) ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
14272
|
+
unref(filename) ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(unref(filename)), 1)) : createCommentVNode("", true)
|
|
14252
14273
|
], true)
|
|
14253
14274
|
]),
|
|
14254
|
-
createBaseVNode("div", _hoisted_4$
|
|
14275
|
+
createBaseVNode("div", _hoisted_4$2, [
|
|
14255
14276
|
renderSlot(_ctx.$slots, "top-center", {}, void 0, true)
|
|
14256
14277
|
]),
|
|
14257
14278
|
createBaseVNode("div", _hoisted_5$1, [
|
|
14258
14279
|
renderSlot(_ctx.$slots, "top-right", {}, () => [
|
|
14259
14280
|
hasItem("zoom") ? (openBlock(), createBlock(ZoomControl, { key: 0 })) : createCommentVNode("", true),
|
|
14260
14281
|
hasItem("rotate") ? (openBlock(), createBlock(RotateControl, { key: 1 })) : createCommentVNode("", true),
|
|
14261
|
-
hasItem("fullscreen") ? (openBlock(), createBlock(_sfc_main$
|
|
14282
|
+
hasItem("fullscreen") ? (openBlock(), createBlock(_sfc_main$d, { key: 2 })) : createCommentVNode("", true)
|
|
14262
14283
|
], true)
|
|
14263
14284
|
])
|
|
14264
14285
|
])) : createCommentVNode("", true),
|
|
@@ -14305,7 +14326,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
14305
14326
|
};
|
|
14306
14327
|
}
|
|
14307
14328
|
});
|
|
14308
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14329
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-74d3b30f"]]);
|
|
14309
14330
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
14310
14331
|
function getDefaultExportFromCjs(x) {
|
|
14311
14332
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -19431,7 +19452,7 @@ section.${e}>footer { z-index: 1; }
|
|
|
19431
19452
|
})(lib$4);
|
|
19432
19453
|
var libExports$3 = lib$4.exports;
|
|
19433
19454
|
const VueOfficeDocx = /* @__PURE__ */ getDefaultExportFromCjs(libExports$3);
|
|
19434
|
-
const _sfc_main$
|
|
19455
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
19435
19456
|
__name: "DocxRender",
|
|
19436
19457
|
props: {
|
|
19437
19458
|
source: {},
|
|
@@ -19486,7 +19507,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
19486
19507
|
};
|
|
19487
19508
|
}
|
|
19488
19509
|
});
|
|
19489
|
-
const DocxRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
19510
|
+
const DocxRender = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-9181c8b1"]]);
|
|
19490
19511
|
var lib$2 = { exports: {} };
|
|
19491
19512
|
(function(module, exports$1) {
|
|
19492
19513
|
!function(e, t) {
|
|
@@ -62273,7 +62294,7 @@ var lib$2 = { exports: {} };
|
|
|
62273
62294
|
})(lib$2);
|
|
62274
62295
|
var libExports$2 = lib$2.exports;
|
|
62275
62296
|
const VueOfficeExcel = /* @__PURE__ */ getDefaultExportFromCjs(libExports$2);
|
|
62276
|
-
const _sfc_main$
|
|
62297
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
62277
62298
|
__name: "ExcelRender",
|
|
62278
62299
|
props: {
|
|
62279
62300
|
source: {},
|
|
@@ -62328,7 +62349,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
62328
62349
|
};
|
|
62329
62350
|
}
|
|
62330
62351
|
});
|
|
62331
|
-
const ExcelRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
62352
|
+
const ExcelRender = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a8c7c89f"]]);
|
|
62332
62353
|
var lib$1 = { exports: {} };
|
|
62333
62354
|
(function(module, exports$1) {
|
|
62334
62355
|
(function(Q, k) {
|
|
@@ -64031,8 +64052,8 @@ var t={4186:(t,e,r)=>{var n=r(3749),i=r(8055),a=TypeError;t.exports=function(t){
|
|
|
64031
64052
|
})(lib$1);
|
|
64032
64053
|
var libExports$1 = lib$1.exports;
|
|
64033
64054
|
const VueOfficePdf = /* @__PURE__ */ getDefaultExportFromCjs(libExports$1);
|
|
64034
|
-
const _hoisted_1$
|
|
64035
|
-
const _sfc_main$
|
|
64055
|
+
const _hoisted_1$7 = ["src"];
|
|
64056
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
64036
64057
|
__name: "PdfRender",
|
|
64037
64058
|
props: {
|
|
64038
64059
|
source: {},
|
|
@@ -64131,12 +64152,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
64131
64152
|
style: normalizeStyle(renderStyle.value),
|
|
64132
64153
|
frameborder: "0",
|
|
64133
64154
|
onLoad: handleRendered
|
|
64134
|
-
}, null, 44, _hoisted_1$
|
|
64155
|
+
}, null, 44, _hoisted_1$7))
|
|
64135
64156
|
], 512);
|
|
64136
64157
|
};
|
|
64137
64158
|
}
|
|
64138
64159
|
});
|
|
64139
|
-
const PdfRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
64160
|
+
const PdfRender = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-32fed398"]]);
|
|
64140
64161
|
var lib = { exports: {} };
|
|
64141
64162
|
(function(module, exports$1) {
|
|
64142
64163
|
(function(Ma, No) {
|
|
@@ -102505,7 +102526,7 @@ echarts.use([` + E + "]);" : "Unknown series " + P));
|
|
|
102505
102526
|
})(lib);
|
|
102506
102527
|
var libExports = lib.exports;
|
|
102507
102528
|
const VueOfficePptx = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
102508
|
-
const _sfc_main$
|
|
102529
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
102509
102530
|
__name: "PptxRender",
|
|
102510
102531
|
props: {
|
|
102511
102532
|
source: {},
|
|
@@ -102560,9 +102581,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
102560
102581
|
};
|
|
102561
102582
|
}
|
|
102562
102583
|
});
|
|
102563
|
-
const PptxRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
102564
|
-
const _hoisted_1$
|
|
102565
|
-
const _sfc_main$
|
|
102584
|
+
const PptxRender = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-b31abca4"]]);
|
|
102585
|
+
const _hoisted_1$6 = { class: "jv-text-content" };
|
|
102586
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
102566
102587
|
__name: "TextRender",
|
|
102567
102588
|
props: {
|
|
102568
102589
|
source: {}
|
|
@@ -102594,14 +102615,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
102594
102615
|
ref: containerRef,
|
|
102595
102616
|
class: "jv-file-render jv-file-render--text"
|
|
102596
102617
|
}, [
|
|
102597
|
-
createBaseVNode("pre", _hoisted_1$
|
|
102618
|
+
createBaseVNode("pre", _hoisted_1$6, toDisplayString(content.value), 1)
|
|
102598
102619
|
], 512);
|
|
102599
102620
|
};
|
|
102600
102621
|
}
|
|
102601
102622
|
});
|
|
102602
|
-
const TextRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
102603
|
-
const _hoisted_1$
|
|
102604
|
-
const _sfc_main$
|
|
102623
|
+
const TextRender = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-f5957104"]]);
|
|
102624
|
+
const _hoisted_1$5 = ["innerHTML"];
|
|
102625
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
102605
102626
|
__name: "MarkdownRender",
|
|
102606
102627
|
props: {
|
|
102607
102628
|
source: {}
|
|
@@ -102618,7 +102639,89 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
102618
102639
|
});
|
|
102619
102640
|
function simpleMarkdownToHtml(md) {
|
|
102620
102641
|
if (!md) return "";
|
|
102621
|
-
|
|
102642
|
+
let html = md.replace(/```(\w+)?\n([\s\S]*?)```/g, "<pre><code>$2</code></pre>").replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
102643
|
+
html = parseTables(html);
|
|
102644
|
+
html = html.replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*\*(.*?)\*\*\*/g, "<strong><em>$1</em></strong>").replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/___(.*?)___/g, "<strong><em>$1</em></strong>").replace(/__(.*?)__/g, "<strong>$1</strong>").replace(/_(.*?)_/g, "<em>$1</em>").replace(/~~(.*?)~~/g, "<del>$1</del>").replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>').replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img alt="$1" src="$2" />').replace(/^>\s+(.*$)/gim, "<blockquote>$1</blockquote>").replace(/^---$/gim, "<hr />").replace(/^\*\*\*$/gim, "<hr />").replace(/^___$/gim, "<hr />");
|
|
102645
|
+
html = parseLists(html);
|
|
102646
|
+
html = html.replace(/\n\n/g, "</p><p>").replace(/\n/g, "<br />").replace(/^(.+)$/gim, "<p>$1</p>").replace(/<p><\/p>/g, "").replace(/<p>(<[uo]l>)/g, "$1").replace(/(<\/[uo]l>)<\/p>/g, "$1").replace(/<p>(<[hb]r)/g, "$1").replace(/(<\/blockquote>)<\/p>/g, "$1");
|
|
102647
|
+
return html;
|
|
102648
|
+
}
|
|
102649
|
+
function parseTables(md) {
|
|
102650
|
+
const lines = md.split("\n");
|
|
102651
|
+
const result = [];
|
|
102652
|
+
let i = 0;
|
|
102653
|
+
while (i < lines.length) {
|
|
102654
|
+
const line = lines[i];
|
|
102655
|
+
if (line.includes("|")) {
|
|
102656
|
+
const nextLine = lines[i + 1];
|
|
102657
|
+
if (nextLine && /^\|?[\s|:|-]+\|/.test(nextLine)) {
|
|
102658
|
+
const headerLine = line;
|
|
102659
|
+
i += 2;
|
|
102660
|
+
const headers = headerLine.split("|").map((cell) => cell.trim()).filter((cell) => cell !== "").map((cell) => `<th>${cell}</th>`).join("");
|
|
102661
|
+
const rows = [];
|
|
102662
|
+
while (i < lines.length && lines[i].includes("|")) {
|
|
102663
|
+
const rowCells = lines[i].split("|").map((cell) => cell.trim()).filter((cell) => cell !== "").map((cell) => `<td>${cell}</td>`).join("");
|
|
102664
|
+
if (rowCells) {
|
|
102665
|
+
rows.push(`<tr>${rowCells}</tr>`);
|
|
102666
|
+
}
|
|
102667
|
+
i++;
|
|
102668
|
+
}
|
|
102669
|
+
const tableHtml = `<table><thead><tr>${headers}</tr></thead><tbody>${rows.join("")}</tbody></table>`;
|
|
102670
|
+
result.push(tableHtml);
|
|
102671
|
+
continue;
|
|
102672
|
+
}
|
|
102673
|
+
}
|
|
102674
|
+
result.push(line);
|
|
102675
|
+
i++;
|
|
102676
|
+
}
|
|
102677
|
+
return result.join("\n");
|
|
102678
|
+
}
|
|
102679
|
+
function parseLists(md) {
|
|
102680
|
+
const lines = md.split("\n");
|
|
102681
|
+
const result = [];
|
|
102682
|
+
let inUl = false;
|
|
102683
|
+
let inOl = false;
|
|
102684
|
+
for (let i = 0; i < lines.length; i++) {
|
|
102685
|
+
const line = lines[i];
|
|
102686
|
+
const ulMatch = line.match(/^(\s*)[-*+]\s+(.+)$/);
|
|
102687
|
+
const olMatch = line.match(/^(\s*)\d+\.\s+(.+)$/);
|
|
102688
|
+
if (ulMatch) {
|
|
102689
|
+
const content2 = ulMatch[2];
|
|
102690
|
+
if (!inUl) {
|
|
102691
|
+
if (inOl) {
|
|
102692
|
+
result.push("</ol>");
|
|
102693
|
+
inOl = false;
|
|
102694
|
+
}
|
|
102695
|
+
result.push("<ul>");
|
|
102696
|
+
inUl = true;
|
|
102697
|
+
}
|
|
102698
|
+
result.push(`<li>${content2}</li>`);
|
|
102699
|
+
} else if (olMatch) {
|
|
102700
|
+
const content2 = olMatch[2];
|
|
102701
|
+
if (!inOl) {
|
|
102702
|
+
if (inUl) {
|
|
102703
|
+
result.push("</ul>");
|
|
102704
|
+
inUl = false;
|
|
102705
|
+
}
|
|
102706
|
+
result.push("<ol>");
|
|
102707
|
+
inOl = true;
|
|
102708
|
+
}
|
|
102709
|
+
result.push(`<li>${content2}</li>`);
|
|
102710
|
+
} else {
|
|
102711
|
+
if (inUl) {
|
|
102712
|
+
result.push("</ul>");
|
|
102713
|
+
inUl = false;
|
|
102714
|
+
}
|
|
102715
|
+
if (inOl) {
|
|
102716
|
+
result.push("</ol>");
|
|
102717
|
+
inOl = false;
|
|
102718
|
+
}
|
|
102719
|
+
result.push(line);
|
|
102720
|
+
}
|
|
102721
|
+
}
|
|
102722
|
+
if (inUl) result.push("</ul>");
|
|
102723
|
+
if (inOl) result.push("</ol>");
|
|
102724
|
+
return result.join("\n");
|
|
102622
102725
|
}
|
|
102623
102726
|
async function loadFile() {
|
|
102624
102727
|
try {
|
|
@@ -102643,12 +102746,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
102643
102746
|
createBaseVNode("div", {
|
|
102644
102747
|
class: "jv-markdown-content",
|
|
102645
102748
|
innerHTML: renderedContent.value
|
|
102646
|
-
}, null, 8, _hoisted_1$
|
|
102749
|
+
}, null, 8, _hoisted_1$5)
|
|
102647
102750
|
], 512);
|
|
102648
102751
|
};
|
|
102649
102752
|
}
|
|
102650
102753
|
});
|
|
102651
|
-
const MarkdownRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
102754
|
+
const MarkdownRender = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-2d9fb509"]]);
|
|
102652
102755
|
var dist = { exports: {} };
|
|
102653
102756
|
/*! For license information please see index.js.LICENSE.txt */
|
|
102654
102757
|
(function(module, exports$1) {
|
|
@@ -128282,12 +128385,12 @@ class LiteOfdAdapter {
|
|
|
128282
128385
|
this.instance = null;
|
|
128283
128386
|
}
|
|
128284
128387
|
}
|
|
128285
|
-
const _hoisted_1$
|
|
128388
|
+
const _hoisted_1$4 = {
|
|
128286
128389
|
key: 0,
|
|
128287
128390
|
class: "jv-ofd-error"
|
|
128288
128391
|
};
|
|
128289
|
-
const _hoisted_2$
|
|
128290
|
-
const _sfc_main$
|
|
128392
|
+
const _hoisted_2$3 = { class: "jv-ofd-loading" };
|
|
128393
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
128291
128394
|
__name: "OfdRender",
|
|
128292
128395
|
props: {
|
|
128293
128396
|
source: {},
|
|
@@ -128518,7 +128621,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
128518
128621
|
ref: containerRef,
|
|
128519
128622
|
class: "jv-file-render jv-file-render--ofd"
|
|
128520
128623
|
}, [
|
|
128521
|
-
error.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
128624
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
128522
128625
|
createBaseVNode("span", null, toDisplayString(error.value), 1)
|
|
128523
128626
|
])) : (openBlock(), createElementBlock("div", {
|
|
128524
128627
|
key: 1,
|
|
@@ -128537,7 +128640,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
128537
128640
|
}, null, 512)
|
|
128538
128641
|
], 4)
|
|
128539
128642
|
], 512)),
|
|
128540
|
-
withDirectives(createBaseVNode("div", _hoisted_2$
|
|
128643
|
+
withDirectives(createBaseVNode("div", _hoisted_2$3, [
|
|
128541
128644
|
createBaseVNode("span", null, toDisplayString(t("loading")), 1)
|
|
128542
128645
|
], 512), [
|
|
128543
128646
|
[vShow, loading.value]
|
|
@@ -128546,13 +128649,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
128546
128649
|
};
|
|
128547
128650
|
}
|
|
128548
128651
|
});
|
|
128549
|
-
const OfdRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
128550
|
-
const _hoisted_1$
|
|
128551
|
-
const _hoisted_2$
|
|
128652
|
+
const OfdRender = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-f933a20c"]]);
|
|
128653
|
+
const _hoisted_1$3 = { class: "jv-html-loading" };
|
|
128654
|
+
const _hoisted_2$2 = {
|
|
128552
128655
|
key: 0,
|
|
128553
128656
|
class: "jv-html-error"
|
|
128554
128657
|
};
|
|
128555
|
-
const _sfc_main$
|
|
128658
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
128556
128659
|
__name: "HtmlRender",
|
|
128557
128660
|
props: {
|
|
128558
128661
|
source: {},
|
|
@@ -128710,20 +128813,546 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
128710
128813
|
style: normalizeStyle(renderStyle.value),
|
|
128711
128814
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-forms allow-top-navigation"
|
|
128712
128815
|
}, null, 4),
|
|
128713
|
-
withDirectives(createBaseVNode("div", _hoisted_1$
|
|
128816
|
+
withDirectives(createBaseVNode("div", _hoisted_1$3, [..._cache[0] || (_cache[0] = [
|
|
128714
128817
|
createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1),
|
|
128715
128818
|
createBaseVNode("span", null, "加载中...", -1)
|
|
128716
128819
|
])], 512), [
|
|
128717
128820
|
[vShow, loading.value]
|
|
128718
128821
|
]),
|
|
128719
|
-
error.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
128822
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
128720
128823
|
createBaseVNode("span", null, toDisplayString(error.value), 1)
|
|
128721
128824
|
])) : createCommentVNode("", true)
|
|
128722
128825
|
], 512);
|
|
128723
128826
|
};
|
|
128724
128827
|
}
|
|
128725
128828
|
});
|
|
128726
|
-
const HtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
128829
|
+
const HtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-c52b0b01"]]);
|
|
128830
|
+
const _hoisted_1$2 = {
|
|
128831
|
+
key: 0,
|
|
128832
|
+
class: "jv-image-loading"
|
|
128833
|
+
};
|
|
128834
|
+
const _hoisted_2$1 = {
|
|
128835
|
+
key: 1,
|
|
128836
|
+
class: "jv-image-error"
|
|
128837
|
+
};
|
|
128838
|
+
const _hoisted_3$1 = ["src", "alt"];
|
|
128839
|
+
const _hoisted_4$1 = {
|
|
128840
|
+
key: 2,
|
|
128841
|
+
class: "jv-image-info"
|
|
128842
|
+
};
|
|
128843
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
128844
|
+
__name: "ImageRender",
|
|
128845
|
+
props: {
|
|
128846
|
+
source: {},
|
|
128847
|
+
zoom: { default: 1 }
|
|
128848
|
+
},
|
|
128849
|
+
emits: ["load", "error"],
|
|
128850
|
+
setup(__props, { emit: __emit }) {
|
|
128851
|
+
const props = __props;
|
|
128852
|
+
const emit2 = __emit;
|
|
128853
|
+
const containerRef = /* @__PURE__ */ ref();
|
|
128854
|
+
const imageWrapperRef = /* @__PURE__ */ ref();
|
|
128855
|
+
const imageRef = /* @__PURE__ */ ref();
|
|
128856
|
+
const loading = /* @__PURE__ */ ref(true);
|
|
128857
|
+
const error = /* @__PURE__ */ ref(null);
|
|
128858
|
+
const imageSrc = /* @__PURE__ */ ref("");
|
|
128859
|
+
const imageAlt = /* @__PURE__ */ ref("");
|
|
128860
|
+
const imageInfo = /* @__PURE__ */ ref(null);
|
|
128861
|
+
const scale = /* @__PURE__ */ ref(1);
|
|
128862
|
+
const rotation = /* @__PURE__ */ ref(0);
|
|
128863
|
+
const translateX = /* @__PURE__ */ ref(0);
|
|
128864
|
+
const translateY = /* @__PURE__ */ ref(0);
|
|
128865
|
+
const isDragging = /* @__PURE__ */ ref(false);
|
|
128866
|
+
const dragStart = /* @__PURE__ */ ref({ x: 0, y: 0 });
|
|
128867
|
+
const initialTranslate = /* @__PURE__ */ ref({ x: 0, y: 0 });
|
|
128868
|
+
const naturalSize = /* @__PURE__ */ ref({ width: 0, height: 0 });
|
|
128869
|
+
const imageStyle = computed(() => ({
|
|
128870
|
+
transform: `translate(${translateX.value}px, ${translateY.value}px) rotate(${rotation.value}deg) scale(${scale.value})`,
|
|
128871
|
+
transition: isDragging.value ? "none" : "transform 0.2s ease",
|
|
128872
|
+
cursor: isDragging.value ? "grabbing" : scale.value > 1 ? "grab" : "default"
|
|
128873
|
+
}));
|
|
128874
|
+
async function loadImage() {
|
|
128875
|
+
try {
|
|
128876
|
+
loading.value = true;
|
|
128877
|
+
error.value = null;
|
|
128878
|
+
const blob = await fileToBlob(props.source);
|
|
128879
|
+
imageInfo.value = {
|
|
128880
|
+
width: 0,
|
|
128881
|
+
height: 0,
|
|
128882
|
+
size: blob.size
|
|
128883
|
+
};
|
|
128884
|
+
imageSrc.value = URL.createObjectURL(blob);
|
|
128885
|
+
if (props.source instanceof File) {
|
|
128886
|
+
imageAlt.value = props.source.name;
|
|
128887
|
+
}
|
|
128888
|
+
} catch (err) {
|
|
128889
|
+
loading.value = false;
|
|
128890
|
+
error.value = err;
|
|
128891
|
+
emit2("error", err);
|
|
128892
|
+
}
|
|
128893
|
+
}
|
|
128894
|
+
function handleImageLoad() {
|
|
128895
|
+
if (imageRef.value) {
|
|
128896
|
+
naturalSize.value = {
|
|
128897
|
+
width: imageRef.value.naturalWidth,
|
|
128898
|
+
height: imageRef.value.naturalHeight
|
|
128899
|
+
};
|
|
128900
|
+
if (imageInfo.value) {
|
|
128901
|
+
imageInfo.value.width = imageRef.value.naturalWidth;
|
|
128902
|
+
imageInfo.value.height = imageRef.value.naturalHeight;
|
|
128903
|
+
}
|
|
128904
|
+
fitToScreen();
|
|
128905
|
+
loading.value = false;
|
|
128906
|
+
emit2("load");
|
|
128907
|
+
}
|
|
128908
|
+
}
|
|
128909
|
+
function handleImageError() {
|
|
128910
|
+
loading.value = false;
|
|
128911
|
+
error.value = new Error("图片加载失败");
|
|
128912
|
+
emit2("error", error.value);
|
|
128913
|
+
}
|
|
128914
|
+
function zoomIn() {
|
|
128915
|
+
scale.value = Math.min(scale.value * 1.25, 10);
|
|
128916
|
+
}
|
|
128917
|
+
function zoomOut() {
|
|
128918
|
+
scale.value = Math.max(scale.value / 1.25, 0.1);
|
|
128919
|
+
if (scale.value <= 1) {
|
|
128920
|
+
translateX.value = 0;
|
|
128921
|
+
translateY.value = 0;
|
|
128922
|
+
}
|
|
128923
|
+
}
|
|
128924
|
+
function resetZoom() {
|
|
128925
|
+
scale.value = 1;
|
|
128926
|
+
rotation.value = 0;
|
|
128927
|
+
translateX.value = 0;
|
|
128928
|
+
translateY.value = 0;
|
|
128929
|
+
}
|
|
128930
|
+
function fitToScreen() {
|
|
128931
|
+
if (!imageRef.value || !containerRef.value) return;
|
|
128932
|
+
const containerRect = containerRef.value.getBoundingClientRect();
|
|
128933
|
+
const containerWidth = containerRect.width - 40;
|
|
128934
|
+
const containerHeight = containerRect.height - 40;
|
|
128935
|
+
const imgWidth = naturalSize.value.width;
|
|
128936
|
+
const imgHeight = naturalSize.value.height;
|
|
128937
|
+
const scaleX = containerWidth / imgWidth;
|
|
128938
|
+
const scaleY = containerHeight / imgHeight;
|
|
128939
|
+
const fitScale = Math.min(scaleX, scaleY, 1);
|
|
128940
|
+
scale.value = fitScale;
|
|
128941
|
+
rotation.value = 0;
|
|
128942
|
+
translateX.value = 0;
|
|
128943
|
+
translateY.value = 0;
|
|
128944
|
+
}
|
|
128945
|
+
function rotateLeft() {
|
|
128946
|
+
rotation.value -= 90;
|
|
128947
|
+
}
|
|
128948
|
+
function rotateRight() {
|
|
128949
|
+
rotation.value += 90;
|
|
128950
|
+
}
|
|
128951
|
+
function handleWheel(e) {
|
|
128952
|
+
const delta = e.deltaY > 0 ? 0.9 : 1.1;
|
|
128953
|
+
const newScale = Math.min(Math.max(scale.value * delta, 0.1), 10);
|
|
128954
|
+
if (newScale !== scale.value && imageWrapperRef.value) {
|
|
128955
|
+
const rect = imageWrapperRef.value.getBoundingClientRect();
|
|
128956
|
+
const mouseX = e.clientX - rect.left - rect.width / 2;
|
|
128957
|
+
const mouseY = e.clientY - rect.top - rect.height / 2;
|
|
128958
|
+
const scaleRatio = newScale / scale.value;
|
|
128959
|
+
translateX.value = translateX.value * scaleRatio + mouseX * (scaleRatio - 1);
|
|
128960
|
+
translateY.value = translateY.value * scaleRatio + mouseY * (scaleRatio - 1);
|
|
128961
|
+
scale.value = newScale;
|
|
128962
|
+
if (scale.value <= 1) {
|
|
128963
|
+
translateX.value = 0;
|
|
128964
|
+
translateY.value = 0;
|
|
128965
|
+
}
|
|
128966
|
+
}
|
|
128967
|
+
}
|
|
128968
|
+
function handleDoubleClick() {
|
|
128969
|
+
if (scale.value !== 1) {
|
|
128970
|
+
resetZoom();
|
|
128971
|
+
} else {
|
|
128972
|
+
scale.value = 2;
|
|
128973
|
+
}
|
|
128974
|
+
}
|
|
128975
|
+
function handleMouseDown(e) {
|
|
128976
|
+
if (scale.value <= 1) return;
|
|
128977
|
+
isDragging.value = true;
|
|
128978
|
+
dragStart.value = { x: e.clientX, y: e.clientY };
|
|
128979
|
+
initialTranslate.value = { x: translateX.value, y: translateY.value };
|
|
128980
|
+
}
|
|
128981
|
+
function handleMouseMove(e) {
|
|
128982
|
+
if (!isDragging.value) return;
|
|
128983
|
+
const dx = e.clientX - dragStart.value.x;
|
|
128984
|
+
const dy = e.clientY - dragStart.value.y;
|
|
128985
|
+
translateX.value = initialTranslate.value.x + dx;
|
|
128986
|
+
translateY.value = initialTranslate.value.y + dy;
|
|
128987
|
+
}
|
|
128988
|
+
function handleMouseUp() {
|
|
128989
|
+
isDragging.value = false;
|
|
128990
|
+
}
|
|
128991
|
+
function toggleFullscreen() {
|
|
128992
|
+
if (!containerRef.value) return;
|
|
128993
|
+
if (!document.fullscreenElement) {
|
|
128994
|
+
containerRef.value.requestFullscreen();
|
|
128995
|
+
} else {
|
|
128996
|
+
document.exitFullscreen();
|
|
128997
|
+
}
|
|
128998
|
+
}
|
|
128999
|
+
async function downloadImage() {
|
|
129000
|
+
await downloadFile(props.source, imageAlt.value || "image");
|
|
129001
|
+
}
|
|
129002
|
+
function formatFileSize(bytes) {
|
|
129003
|
+
if (bytes === 0) return "0 B";
|
|
129004
|
+
const k = 1024;
|
|
129005
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
129006
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
129007
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
129008
|
+
}
|
|
129009
|
+
watch(() => props.zoom, (newZoom) => {
|
|
129010
|
+
scale.value = newZoom;
|
|
129011
|
+
});
|
|
129012
|
+
watch(() => props.source, () => {
|
|
129013
|
+
if (imageSrc.value) {
|
|
129014
|
+
URL.revokeObjectURL(imageSrc.value);
|
|
129015
|
+
}
|
|
129016
|
+
resetZoom();
|
|
129017
|
+
loadImage();
|
|
129018
|
+
}, { immediate: true });
|
|
129019
|
+
onUnmounted(() => {
|
|
129020
|
+
if (imageSrc.value) {
|
|
129021
|
+
URL.revokeObjectURL(imageSrc.value);
|
|
129022
|
+
}
|
|
129023
|
+
});
|
|
129024
|
+
return (_ctx, _cache) => {
|
|
129025
|
+
return openBlock(), createElementBlock("div", {
|
|
129026
|
+
ref_key: "containerRef",
|
|
129027
|
+
ref: containerRef,
|
|
129028
|
+
class: "jv-file-render jv-file-render--image"
|
|
129029
|
+
}, [
|
|
129030
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [..._cache[0] || (_cache[0] = [
|
|
129031
|
+
createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1),
|
|
129032
|
+
createBaseVNode("span", null, "加载中...", -1)
|
|
129033
|
+
])])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
129034
|
+
_cache[1] || (_cache[1] = createBaseVNode("svg", {
|
|
129035
|
+
viewBox: "0 0 24 24",
|
|
129036
|
+
fill: "none",
|
|
129037
|
+
stroke: "currentColor",
|
|
129038
|
+
"stroke-width": "2"
|
|
129039
|
+
}, [
|
|
129040
|
+
createBaseVNode("circle", {
|
|
129041
|
+
cx: "12",
|
|
129042
|
+
cy: "12",
|
|
129043
|
+
r: "10"
|
|
129044
|
+
}),
|
|
129045
|
+
createBaseVNode("line", {
|
|
129046
|
+
x1: "12",
|
|
129047
|
+
y1: "8",
|
|
129048
|
+
x2: "12",
|
|
129049
|
+
y2: "12"
|
|
129050
|
+
}),
|
|
129051
|
+
createBaseVNode("line", {
|
|
129052
|
+
x1: "12",
|
|
129053
|
+
y1: "16",
|
|
129054
|
+
x2: "12.01",
|
|
129055
|
+
y2: "16"
|
|
129056
|
+
})
|
|
129057
|
+
], -1)),
|
|
129058
|
+
createBaseVNode("span", null, toDisplayString(error.value.message || "图片加载失败"), 1)
|
|
129059
|
+
])) : createCommentVNode("", true),
|
|
129060
|
+
withDirectives(createBaseVNode("div", {
|
|
129061
|
+
ref_key: "imageWrapperRef",
|
|
129062
|
+
ref: imageWrapperRef,
|
|
129063
|
+
class: normalizeClass(["jv-image-wrapper", { "jv-image-wrapper--dragging": isDragging.value }]),
|
|
129064
|
+
onWheel: withModifiers(handleWheel, ["prevent"]),
|
|
129065
|
+
onMousedown: withModifiers(handleMouseDown, ["prevent"]),
|
|
129066
|
+
onMousemove: handleMouseMove,
|
|
129067
|
+
onMouseup: handleMouseUp,
|
|
129068
|
+
onMouseleave: handleMouseUp,
|
|
129069
|
+
onDblclick: handleDoubleClick
|
|
129070
|
+
}, [
|
|
129071
|
+
imageSrc.value ? (openBlock(), createElementBlock("img", {
|
|
129072
|
+
key: 0,
|
|
129073
|
+
ref_key: "imageRef",
|
|
129074
|
+
ref: imageRef,
|
|
129075
|
+
src: imageSrc.value,
|
|
129076
|
+
alt: imageAlt.value,
|
|
129077
|
+
class: "jv-image",
|
|
129078
|
+
style: normalizeStyle(imageStyle.value),
|
|
129079
|
+
draggable: "false",
|
|
129080
|
+
onLoad: handleImageLoad,
|
|
129081
|
+
onError: handleImageError
|
|
129082
|
+
}, null, 44, _hoisted_3$1)) : createCommentVNode("", true)
|
|
129083
|
+
], 34), [
|
|
129084
|
+
[vShow, !loading.value && !error.value]
|
|
129085
|
+
]),
|
|
129086
|
+
createBaseVNode("div", { class: "jv-image-controls" }, [
|
|
129087
|
+
createBaseVNode("button", {
|
|
129088
|
+
class: "jv-image-btn",
|
|
129089
|
+
title: "放大",
|
|
129090
|
+
onClick: zoomIn
|
|
129091
|
+
}, [..._cache[2] || (_cache[2] = [
|
|
129092
|
+
createStaticVNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-40d06872><circle cx="11" cy="11" r="8" data-v-40d06872></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-40d06872></line><line x1="11" y1="8" x2="11" y2="14" data-v-40d06872></line><line x1="8" y1="11" x2="14" y2="11" data-v-40d06872></line></svg>', 1)
|
|
129093
|
+
])]),
|
|
129094
|
+
createBaseVNode("button", {
|
|
129095
|
+
class: "jv-image-btn",
|
|
129096
|
+
title: "缩小",
|
|
129097
|
+
onClick: zoomOut
|
|
129098
|
+
}, [..._cache[3] || (_cache[3] = [
|
|
129099
|
+
createBaseVNode("svg", {
|
|
129100
|
+
viewBox: "0 0 24 24",
|
|
129101
|
+
fill: "none",
|
|
129102
|
+
stroke: "currentColor",
|
|
129103
|
+
"stroke-width": "2"
|
|
129104
|
+
}, [
|
|
129105
|
+
createBaseVNode("circle", {
|
|
129106
|
+
cx: "11",
|
|
129107
|
+
cy: "11",
|
|
129108
|
+
r: "8"
|
|
129109
|
+
}),
|
|
129110
|
+
createBaseVNode("line", {
|
|
129111
|
+
x1: "21",
|
|
129112
|
+
y1: "21",
|
|
129113
|
+
x2: "16.65",
|
|
129114
|
+
y2: "16.65"
|
|
129115
|
+
}),
|
|
129116
|
+
createBaseVNode("line", {
|
|
129117
|
+
x1: "8",
|
|
129118
|
+
y1: "11",
|
|
129119
|
+
x2: "14",
|
|
129120
|
+
y2: "11"
|
|
129121
|
+
})
|
|
129122
|
+
], -1)
|
|
129123
|
+
])]),
|
|
129124
|
+
createBaseVNode("button", {
|
|
129125
|
+
class: "jv-image-btn",
|
|
129126
|
+
title: "适应屏幕",
|
|
129127
|
+
onClick: fitToScreen
|
|
129128
|
+
}, [..._cache[4] || (_cache[4] = [
|
|
129129
|
+
createBaseVNode("svg", {
|
|
129130
|
+
viewBox: "0 0 24 24",
|
|
129131
|
+
fill: "none",
|
|
129132
|
+
stroke: "currentColor",
|
|
129133
|
+
"stroke-width": "2"
|
|
129134
|
+
}, [
|
|
129135
|
+
createBaseVNode("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
129136
|
+
], -1)
|
|
129137
|
+
])]),
|
|
129138
|
+
createBaseVNode("button", {
|
|
129139
|
+
class: "jv-image-btn",
|
|
129140
|
+
title: "实际大小",
|
|
129141
|
+
onClick: resetZoom
|
|
129142
|
+
}, [..._cache[5] || (_cache[5] = [
|
|
129143
|
+
createBaseVNode("svg", {
|
|
129144
|
+
viewBox: "0 0 24 24",
|
|
129145
|
+
fill: "none",
|
|
129146
|
+
stroke: "currentColor",
|
|
129147
|
+
"stroke-width": "2"
|
|
129148
|
+
}, [
|
|
129149
|
+
createBaseVNode("rect", {
|
|
129150
|
+
x: "3",
|
|
129151
|
+
y: "3",
|
|
129152
|
+
width: "18",
|
|
129153
|
+
height: "18",
|
|
129154
|
+
rx: "2",
|
|
129155
|
+
ry: "2"
|
|
129156
|
+
}),
|
|
129157
|
+
createBaseVNode("line", {
|
|
129158
|
+
x1: "9",
|
|
129159
|
+
y1: "3",
|
|
129160
|
+
x2: "9",
|
|
129161
|
+
y2: "21"
|
|
129162
|
+
})
|
|
129163
|
+
], -1)
|
|
129164
|
+
])]),
|
|
129165
|
+
createBaseVNode("button", {
|
|
129166
|
+
class: "jv-image-btn",
|
|
129167
|
+
title: "向左旋转",
|
|
129168
|
+
onClick: rotateLeft
|
|
129169
|
+
}, [..._cache[6] || (_cache[6] = [
|
|
129170
|
+
createBaseVNode("svg", {
|
|
129171
|
+
viewBox: "0 0 24 24",
|
|
129172
|
+
fill: "none",
|
|
129173
|
+
stroke: "currentColor",
|
|
129174
|
+
"stroke-width": "2"
|
|
129175
|
+
}, [
|
|
129176
|
+
createBaseVNode("polyline", { points: "9 14 4 9 9 4" }),
|
|
129177
|
+
createBaseVNode("path", { d: "M4 9h10a5 5 0 0 1 5 5v0" })
|
|
129178
|
+
], -1)
|
|
129179
|
+
])]),
|
|
129180
|
+
createBaseVNode("button", {
|
|
129181
|
+
class: "jv-image-btn",
|
|
129182
|
+
title: "向右旋转",
|
|
129183
|
+
onClick: rotateRight
|
|
129184
|
+
}, [..._cache[7] || (_cache[7] = [
|
|
129185
|
+
createBaseVNode("svg", {
|
|
129186
|
+
viewBox: "0 0 24 24",
|
|
129187
|
+
fill: "none",
|
|
129188
|
+
stroke: "currentColor",
|
|
129189
|
+
"stroke-width": "2"
|
|
129190
|
+
}, [
|
|
129191
|
+
createBaseVNode("polyline", { points: "15 14 20 9 15 4" }),
|
|
129192
|
+
createBaseVNode("path", { d: "M20 9H10a5 5 0 0 0-5 5v0" })
|
|
129193
|
+
], -1)
|
|
129194
|
+
])]),
|
|
129195
|
+
createBaseVNode("button", {
|
|
129196
|
+
class: "jv-image-btn",
|
|
129197
|
+
title: "全屏查看",
|
|
129198
|
+
onClick: toggleFullscreen
|
|
129199
|
+
}, [..._cache[8] || (_cache[8] = [
|
|
129200
|
+
createBaseVNode("svg", {
|
|
129201
|
+
viewBox: "0 0 24 24",
|
|
129202
|
+
fill: "none",
|
|
129203
|
+
stroke: "currentColor",
|
|
129204
|
+
"stroke-width": "2"
|
|
129205
|
+
}, [
|
|
129206
|
+
createBaseVNode("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
129207
|
+
], -1)
|
|
129208
|
+
])]),
|
|
129209
|
+
createBaseVNode("button", {
|
|
129210
|
+
class: "jv-image-btn",
|
|
129211
|
+
title: "下载图片",
|
|
129212
|
+
onClick: downloadImage
|
|
129213
|
+
}, [..._cache[9] || (_cache[9] = [
|
|
129214
|
+
createBaseVNode("svg", {
|
|
129215
|
+
viewBox: "0 0 24 24",
|
|
129216
|
+
fill: "none",
|
|
129217
|
+
stroke: "currentColor",
|
|
129218
|
+
"stroke-width": "2"
|
|
129219
|
+
}, [
|
|
129220
|
+
createBaseVNode("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
129221
|
+
createBaseVNode("polyline", { points: "7 10 12 15 17 10" }),
|
|
129222
|
+
createBaseVNode("line", {
|
|
129223
|
+
x1: "12",
|
|
129224
|
+
y1: "15",
|
|
129225
|
+
x2: "12",
|
|
129226
|
+
y2: "3"
|
|
129227
|
+
})
|
|
129228
|
+
], -1)
|
|
129229
|
+
])])
|
|
129230
|
+
]),
|
|
129231
|
+
imageInfo.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(imageInfo.value.width) + " × " + toDisplayString(imageInfo.value.height) + " | " + toDisplayString(formatFileSize(imageInfo.value.size)), 1)) : createCommentVNode("", true)
|
|
129232
|
+
], 512);
|
|
129233
|
+
};
|
|
129234
|
+
}
|
|
129235
|
+
});
|
|
129236
|
+
const ImageRender = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-40d06872"]]);
|
|
129237
|
+
const _hoisted_1$1 = ["src"];
|
|
129238
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
129239
|
+
__name: "Watermark",
|
|
129240
|
+
props: {
|
|
129241
|
+
watermark: { default: null }
|
|
129242
|
+
},
|
|
129243
|
+
setup(__props) {
|
|
129244
|
+
const props = __props;
|
|
129245
|
+
const watermarkRef = /* @__PURE__ */ ref();
|
|
129246
|
+
const containerStyle = computed(() => {
|
|
129247
|
+
if (!props.watermark) return {};
|
|
129248
|
+
const baseStyle = {
|
|
129249
|
+
opacity: props.watermark.opacity || 0.3,
|
|
129250
|
+
transform: `rotate(${props.watermark.rotate || -30}deg)`,
|
|
129251
|
+
pointerEvents: "none",
|
|
129252
|
+
userSelect: "none",
|
|
129253
|
+
zIndex: props.watermark.position === "top" ? 9999 : 1
|
|
129254
|
+
};
|
|
129255
|
+
if (props.watermark.width) {
|
|
129256
|
+
baseStyle.width = typeof props.watermark.width === "number" ? `${props.watermark.width}px` : props.watermark.width;
|
|
129257
|
+
}
|
|
129258
|
+
if (props.watermark.height) {
|
|
129259
|
+
baseStyle.height = typeof props.watermark.height === "number" ? `${props.watermark.height}px` : props.watermark.height;
|
|
129260
|
+
}
|
|
129261
|
+
return baseStyle;
|
|
129262
|
+
});
|
|
129263
|
+
const lineStyle = computed(() => {
|
|
129264
|
+
var _a, _b, _c, _d, _e;
|
|
129265
|
+
const style = {
|
|
129266
|
+
fontSize: `${((_a = props.watermark) == null ? void 0 : _a.fontSize) || 16}px`,
|
|
129267
|
+
color: ((_b = props.watermark) == null ? void 0 : _b.color) || "#cccccc",
|
|
129268
|
+
fontFamily: ((_c = props.watermark) == null ? void 0 : _c.fontFamily) || "Arial",
|
|
129269
|
+
fontWeight: ((_d = props.watermark) == null ? void 0 : _d.fontWeight) || "normal",
|
|
129270
|
+
whiteSpace: "nowrap"
|
|
129271
|
+
};
|
|
129272
|
+
if ((_e = props.watermark) == null ? void 0 : _e.width) {
|
|
129273
|
+
style.width = typeof props.watermark.width === "number" ? `${props.watermark.width}px` : props.watermark.width;
|
|
129274
|
+
}
|
|
129275
|
+
return style;
|
|
129276
|
+
});
|
|
129277
|
+
const rowStyle = computed(() => {
|
|
129278
|
+
var _a;
|
|
129279
|
+
return {
|
|
129280
|
+
display: "flex",
|
|
129281
|
+
alignItems: "center",
|
|
129282
|
+
justifyContent: "center",
|
|
129283
|
+
gap: `${((_a = props.watermark) == null ? void 0 : _a.gapX) || 100}px`
|
|
129284
|
+
};
|
|
129285
|
+
});
|
|
129286
|
+
const imageStyle = computed(() => {
|
|
129287
|
+
var _a, _b;
|
|
129288
|
+
return {
|
|
129289
|
+
width: `${((_a = props.watermark) == null ? void 0 : _a.imageWidth) || 100}px`,
|
|
129290
|
+
height: `${((_b = props.watermark) == null ? void 0 : _b.imageHeight) || 100}px`,
|
|
129291
|
+
objectFit: "contain"
|
|
129292
|
+
};
|
|
129293
|
+
});
|
|
129294
|
+
const position = computed(() => {
|
|
129295
|
+
var _a;
|
|
129296
|
+
return ((_a = props.watermark) == null ? void 0 : _a.position) || "bottom";
|
|
129297
|
+
});
|
|
129298
|
+
const watermarkLines = computed(() => {
|
|
129299
|
+
if (!props.watermark || props.watermark.type !== "text") return [];
|
|
129300
|
+
const gapY = props.watermark.gapY || 50;
|
|
129301
|
+
const containerHeight = 800;
|
|
129302
|
+
const linesCount = Math.ceil(containerHeight / gapY);
|
|
129303
|
+
return Array(linesCount).fill(props.watermark.content);
|
|
129304
|
+
});
|
|
129305
|
+
const imageRows = computed(() => {
|
|
129306
|
+
if (!props.watermark || props.watermark.type !== "image") return [];
|
|
129307
|
+
const gapX = props.watermark.gapX || 100;
|
|
129308
|
+
const gapY = props.watermark.gapY || 50;
|
|
129309
|
+
const containerWidth = 1200;
|
|
129310
|
+
const containerHeight = 800;
|
|
129311
|
+
const colsCount = Math.ceil(containerWidth / gapX);
|
|
129312
|
+
const rowsCount = Math.ceil(containerHeight / gapY);
|
|
129313
|
+
return Array(rowsCount).fill(Array(colsCount).fill(0));
|
|
129314
|
+
});
|
|
129315
|
+
return (_ctx, _cache) => {
|
|
129316
|
+
return openBlock(), createElementBlock("div", {
|
|
129317
|
+
class: normalizeClass(["jv-watermark-container", [{ "jv-watermark--top": position.value === "top" }]])
|
|
129318
|
+
}, [
|
|
129319
|
+
__props.watermark ? (openBlock(), createElementBlock("div", {
|
|
129320
|
+
key: 0,
|
|
129321
|
+
ref_key: "watermarkRef",
|
|
129322
|
+
ref: watermarkRef,
|
|
129323
|
+
class: "jv-watermark-layer",
|
|
129324
|
+
style: normalizeStyle(containerStyle.value)
|
|
129325
|
+
}, [
|
|
129326
|
+
__props.watermark.type === "text" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(watermarkLines.value, (_, index2) => {
|
|
129327
|
+
return openBlock(), createElementBlock("div", {
|
|
129328
|
+
key: index2,
|
|
129329
|
+
class: "jv-watermark-line",
|
|
129330
|
+
style: normalizeStyle(lineStyle.value)
|
|
129331
|
+
}, toDisplayString(__props.watermark.content), 5);
|
|
129332
|
+
}), 128)) : __props.watermark.type === "image" ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(imageRows.value, (row, rowIndex) => {
|
|
129333
|
+
return openBlock(), createElementBlock("div", {
|
|
129334
|
+
key: rowIndex,
|
|
129335
|
+
class: "jv-watermark-row",
|
|
129336
|
+
style: normalizeStyle(rowStyle.value)
|
|
129337
|
+
}, [
|
|
129338
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (_, colIndex) => {
|
|
129339
|
+
return openBlock(), createElementBlock("img", {
|
|
129340
|
+
key: `${rowIndex}-${colIndex}`,
|
|
129341
|
+
src: __props.watermark.image,
|
|
129342
|
+
alt: "watermark",
|
|
129343
|
+
class: "jv-watermark-image",
|
|
129344
|
+
style: normalizeStyle(imageStyle.value)
|
|
129345
|
+
}, null, 12, _hoisted_1$1);
|
|
129346
|
+
}), 128))
|
|
129347
|
+
], 4);
|
|
129348
|
+
}), 128)) : createCommentVNode("", true)
|
|
129349
|
+
], 4)) : createCommentVNode("", true),
|
|
129350
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
129351
|
+
], 2);
|
|
129352
|
+
};
|
|
129353
|
+
}
|
|
129354
|
+
});
|
|
129355
|
+
const Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3c7535d0"]]);
|
|
128727
129356
|
const _hoisted_1 = {
|
|
128728
129357
|
key: 0,
|
|
128729
129358
|
class: "jv-viewer__error"
|
|
@@ -128737,11 +129366,11 @@ const _hoisted_4 = { class: "jv-empty-text" };
|
|
|
128737
129366
|
const _hoisted_5 = { class: "jv-viewer__loading-overlay" };
|
|
128738
129367
|
const _hoisted_6 = { class: "jv-loading-text" };
|
|
128739
129368
|
const _hoisted_7 = {
|
|
128740
|
-
key:
|
|
129369
|
+
key: 9,
|
|
128741
129370
|
class: "jv-viewer__unsupported"
|
|
128742
129371
|
};
|
|
128743
129372
|
const _hoisted_8 = {
|
|
128744
|
-
key:
|
|
129373
|
+
key: 10,
|
|
128745
129374
|
class: "jv-viewer__unsupported"
|
|
128746
129375
|
};
|
|
128747
129376
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -128760,6 +129389,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
128760
129389
|
className: {},
|
|
128761
129390
|
style: {},
|
|
128762
129391
|
pdfRender: {},
|
|
129392
|
+
watermark: {},
|
|
128763
129393
|
proxyUrl: {},
|
|
128764
129394
|
requestAdapter: {},
|
|
128765
129395
|
onReady: {},
|
|
@@ -129139,120 +129769,135 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129139
129769
|
ref: contentRef,
|
|
129140
129770
|
class: "jv-viewer__content"
|
|
129141
129771
|
}, [
|
|
129142
|
-
|
|
129143
|
-
|
|
129144
|
-
|
|
129145
|
-
|
|
129146
|
-
|
|
129147
|
-
|
|
129148
|
-
"
|
|
129149
|
-
|
|
129150
|
-
|
|
129151
|
-
|
|
129152
|
-
|
|
129153
|
-
|
|
129154
|
-
|
|
129155
|
-
|
|
129156
|
-
|
|
129157
|
-
|
|
129158
|
-
|
|
129159
|
-
|
|
129160
|
-
|
|
129161
|
-
|
|
129162
|
-
|
|
129163
|
-
|
|
129164
|
-
|
|
129165
|
-
|
|
129166
|
-
|
|
129167
|
-
|
|
129168
|
-
|
|
129169
|
-
|
|
129170
|
-
|
|
129171
|
-
|
|
129172
|
-
|
|
129173
|
-
|
|
129174
|
-
|
|
129175
|
-
|
|
129176
|
-
|
|
129177
|
-
|
|
129178
|
-
|
|
129179
|
-
|
|
129180
|
-
|
|
129772
|
+
__props.watermark ? (openBlock(), createBlock(unref(Watermark), {
|
|
129773
|
+
key: 0,
|
|
129774
|
+
watermark: __props.watermark,
|
|
129775
|
+
style: { width: "100%", height: "100%" }
|
|
129776
|
+
}, {
|
|
129777
|
+
default: withCtx(() => [
|
|
129778
|
+
unref(error) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
129779
|
+
_cache[1] || (_cache[1] = createBaseVNode("svg", {
|
|
129780
|
+
class: "jv-error-icon",
|
|
129781
|
+
viewBox: "0 0 24 24",
|
|
129782
|
+
fill: "none",
|
|
129783
|
+
stroke: "currentColor",
|
|
129784
|
+
"stroke-width": "2"
|
|
129785
|
+
}, [
|
|
129786
|
+
createBaseVNode("circle", {
|
|
129787
|
+
cx: "12",
|
|
129788
|
+
cy: "12",
|
|
129789
|
+
r: "10"
|
|
129790
|
+
}),
|
|
129791
|
+
createBaseVNode("line", {
|
|
129792
|
+
x1: "12",
|
|
129793
|
+
y1: "8",
|
|
129794
|
+
x2: "12",
|
|
129795
|
+
y2: "12"
|
|
129796
|
+
}),
|
|
129797
|
+
createBaseVNode("line", {
|
|
129798
|
+
x1: "12",
|
|
129799
|
+
y1: "16",
|
|
129800
|
+
x2: "12.01",
|
|
129801
|
+
y2: "16"
|
|
129802
|
+
})
|
|
129803
|
+
], -1)),
|
|
129804
|
+
createBaseVNode("span", _hoisted_2, toDisplayString(unref(error).message || unref(t)("error.loadFailed")), 1)
|
|
129805
|
+
])) : !unref(fileSource) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
129806
|
+
createBaseVNode("span", _hoisted_4, toDisplayString(unref(t)("empty")), 1)
|
|
129807
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
129808
|
+
key: 2,
|
|
129809
|
+
class: "jv-viewer__render",
|
|
129810
|
+
style: normalizeStyle(renderStyle.value)
|
|
129811
|
+
}, [
|
|
129812
|
+
withDirectives(createBaseVNode("div", _hoisted_5, [
|
|
129813
|
+
_cache[2] || (_cache[2] = createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1)),
|
|
129814
|
+
createBaseVNode("span", _hoisted_6, toDisplayString(unref(t)("loading")), 1)
|
|
129815
|
+
], 512), [
|
|
129816
|
+
[vShow, unref(loading)]
|
|
129817
|
+
]),
|
|
129818
|
+
unref(fileType) === "docx" ? (openBlock(), createBlock(unref(DocxRender), {
|
|
129819
|
+
key: 0,
|
|
129820
|
+
source: unref(fileSource),
|
|
129821
|
+
zoom: unref(zoom),
|
|
129822
|
+
"proxy-url": proxyUrl.value,
|
|
129823
|
+
"request-adapter": requestAdapter.value,
|
|
129824
|
+
onLoad: handleLoad,
|
|
129825
|
+
onError: handleError2
|
|
129826
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "xlsx" || unref(fileType) === "xls" ? (openBlock(), createBlock(unref(ExcelRender), {
|
|
129827
|
+
key: 1,
|
|
129828
|
+
source: unref(fileSource),
|
|
129829
|
+
zoom: unref(zoom),
|
|
129830
|
+
"proxy-url": proxyUrl.value,
|
|
129831
|
+
"request-adapter": requestAdapter.value,
|
|
129832
|
+
onLoad: handleLoad,
|
|
129833
|
+
onError: handleError2
|
|
129834
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "pdf" ? (openBlock(), createBlock(unref(PdfRender), {
|
|
129835
|
+
key: 2,
|
|
129836
|
+
source: unref(fileSource),
|
|
129837
|
+
zoom: unref(zoom),
|
|
129838
|
+
"proxy-url": proxyUrl.value,
|
|
129839
|
+
"request-adapter": requestAdapter.value,
|
|
129840
|
+
"pdf-render": pdfRenderMode.value,
|
|
129841
|
+
onLoad: handleLoad,
|
|
129842
|
+
onError: handleError2
|
|
129843
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter", "pdf-render"])) : unref(fileType) === "pptx" || unref(fileType) === "ppt" ? (openBlock(), createBlock(unref(PptxRender), {
|
|
129844
|
+
key: 3,
|
|
129845
|
+
source: unref(fileSource),
|
|
129846
|
+
zoom: unref(zoom),
|
|
129847
|
+
"proxy-url": proxyUrl.value,
|
|
129848
|
+
"request-adapter": requestAdapter.value,
|
|
129849
|
+
onLoad: handleLoad,
|
|
129850
|
+
onError: handleError2
|
|
129851
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "txt" ? (openBlock(), createBlock(unref(TextRender), {
|
|
129852
|
+
key: 4,
|
|
129853
|
+
source: unref(fileSource),
|
|
129854
|
+
onLoad: handleLoad,
|
|
129855
|
+
onError: handleError2
|
|
129856
|
+
}, null, 8, ["source"])) : unref(fileType) === "md" || unref(fileType) === "markdown" ? (openBlock(), createBlock(unref(MarkdownRender), {
|
|
129857
|
+
key: 5,
|
|
129858
|
+
source: unref(fileSource),
|
|
129859
|
+
onLoad: handleLoad,
|
|
129860
|
+
onError: handleError2
|
|
129861
|
+
}, null, 8, ["source"])) : unref(fileType) === "ofd" ? (openBlock(), createBlock(unref(OfdRender), {
|
|
129862
|
+
key: 6,
|
|
129863
|
+
ref_key: "ofdRenderRef",
|
|
129864
|
+
ref: ofdRenderRef,
|
|
129865
|
+
source: unref(fileSource),
|
|
129866
|
+
zoom: unref(zoom),
|
|
129867
|
+
"proxy-url": proxyUrl.value,
|
|
129868
|
+
"request-adapter": requestAdapter.value,
|
|
129869
|
+
onLoad: handleLoad,
|
|
129870
|
+
onError: handleError2,
|
|
129871
|
+
onPageChange: handleOfdPageChange
|
|
129872
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "html" ? (openBlock(), createBlock(unref(HtmlRender), {
|
|
129873
|
+
key: 7,
|
|
129874
|
+
source: unref(fileSource),
|
|
129875
|
+
zoom: unref(zoom),
|
|
129876
|
+
"proxy-url": proxyUrl.value,
|
|
129877
|
+
"request-adapter": requestAdapter.value,
|
|
129878
|
+
onLoad: handleLoad,
|
|
129879
|
+
onError: handleError2
|
|
129880
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "image" ? (openBlock(), createBlock(unref(ImageRender), {
|
|
129881
|
+
key: 8,
|
|
129882
|
+
source: unref(fileSource),
|
|
129883
|
+
zoom: unref(zoom),
|
|
129884
|
+
onLoad: handleLoad,
|
|
129885
|
+
onError: handleError2
|
|
129886
|
+
}, null, 8, ["source", "zoom"])) : unref(fileType) === "unknown" && unref(fileSource) ? (openBlock(), createElementBlock("div", _hoisted_7, [..._cache[3] || (_cache[3] = [
|
|
129887
|
+
createBaseVNode("span", null, "未知文件类型", -1)
|
|
129888
|
+
])])) : (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
129889
|
+
createBaseVNode("span", null, toDisplayString(unref(t)("error.unsupportedType")), 1)
|
|
129890
|
+
]))
|
|
129891
|
+
], 4))
|
|
129181
129892
|
]),
|
|
129182
|
-
|
|
129183
|
-
|
|
129184
|
-
source: unref(fileSource),
|
|
129185
|
-
zoom: unref(zoom),
|
|
129186
|
-
"proxy-url": proxyUrl.value,
|
|
129187
|
-
"request-adapter": requestAdapter.value,
|
|
129188
|
-
onLoad: handleLoad,
|
|
129189
|
-
onError: handleError2
|
|
129190
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "xlsx" || unref(fileType) === "xls" ? (openBlock(), createBlock(unref(ExcelRender), {
|
|
129191
|
-
key: 1,
|
|
129192
|
-
source: unref(fileSource),
|
|
129193
|
-
zoom: unref(zoom),
|
|
129194
|
-
"proxy-url": proxyUrl.value,
|
|
129195
|
-
"request-adapter": requestAdapter.value,
|
|
129196
|
-
onLoad: handleLoad,
|
|
129197
|
-
onError: handleError2
|
|
129198
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "pdf" ? (openBlock(), createBlock(unref(PdfRender), {
|
|
129199
|
-
key: 2,
|
|
129200
|
-
source: unref(fileSource),
|
|
129201
|
-
zoom: unref(zoom),
|
|
129202
|
-
"proxy-url": proxyUrl.value,
|
|
129203
|
-
"request-adapter": requestAdapter.value,
|
|
129204
|
-
"pdf-render": pdfRenderMode.value,
|
|
129205
|
-
onLoad: handleLoad,
|
|
129206
|
-
onError: handleError2
|
|
129207
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter", "pdf-render"])) : unref(fileType) === "pptx" || unref(fileType) === "ppt" ? (openBlock(), createBlock(unref(PptxRender), {
|
|
129208
|
-
key: 3,
|
|
129209
|
-
source: unref(fileSource),
|
|
129210
|
-
zoom: unref(zoom),
|
|
129211
|
-
"proxy-url": proxyUrl.value,
|
|
129212
|
-
"request-adapter": requestAdapter.value,
|
|
129213
|
-
onLoad: handleLoad,
|
|
129214
|
-
onError: handleError2
|
|
129215
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "txt" ? (openBlock(), createBlock(unref(TextRender), {
|
|
129216
|
-
key: 4,
|
|
129217
|
-
source: unref(fileSource),
|
|
129218
|
-
onLoad: handleLoad,
|
|
129219
|
-
onError: handleError2
|
|
129220
|
-
}, null, 8, ["source"])) : unref(fileType) === "md" || unref(fileType) === "markdown" ? (openBlock(), createBlock(unref(MarkdownRender), {
|
|
129221
|
-
key: 5,
|
|
129222
|
-
source: unref(fileSource),
|
|
129223
|
-
onLoad: handleLoad,
|
|
129224
|
-
onError: handleError2
|
|
129225
|
-
}, null, 8, ["source"])) : unref(fileType) === "ofd" ? (openBlock(), createBlock(unref(OfdRender), {
|
|
129226
|
-
key: 6,
|
|
129227
|
-
ref_key: "ofdRenderRef",
|
|
129228
|
-
ref: ofdRenderRef,
|
|
129229
|
-
source: unref(fileSource),
|
|
129230
|
-
zoom: unref(zoom),
|
|
129231
|
-
"proxy-url": proxyUrl.value,
|
|
129232
|
-
"request-adapter": requestAdapter.value,
|
|
129233
|
-
onLoad: handleLoad,
|
|
129234
|
-
onError: handleError2,
|
|
129235
|
-
onPageChange: handleOfdPageChange
|
|
129236
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "html" ? (openBlock(), createBlock(unref(HtmlRender), {
|
|
129237
|
-
key: 7,
|
|
129238
|
-
source: unref(fileSource),
|
|
129239
|
-
zoom: unref(zoom),
|
|
129240
|
-
"proxy-url": proxyUrl.value,
|
|
129241
|
-
"request-adapter": requestAdapter.value,
|
|
129242
|
-
onLoad: handleLoad,
|
|
129243
|
-
onError: handleError2
|
|
129244
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "unknown" && unref(fileSource) ? (openBlock(), createElementBlock("div", _hoisted_7, [..._cache[3] || (_cache[3] = [
|
|
129245
|
-
createBaseVNode("span", null, "未知文件类型", -1)
|
|
129246
|
-
])])) : (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
129247
|
-
createBaseVNode("span", null, toDisplayString(unref(t)("error.unsupportedType")), 1)
|
|
129248
|
-
]))
|
|
129249
|
-
], 4))
|
|
129893
|
+
_: 1
|
|
129894
|
+
}, 8, ["watermark"])) : createCommentVNode("", true)
|
|
129250
129895
|
], 512)
|
|
129251
129896
|
], 6);
|
|
129252
129897
|
};
|
|
129253
129898
|
}
|
|
129254
129899
|
});
|
|
129255
|
-
const Viewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
129900
|
+
const Viewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-550d6985"]]);
|
|
129256
129901
|
function createViewer(options) {
|
|
129257
129902
|
const events = createEventBus();
|
|
129258
129903
|
let app = null;
|
|
@@ -129404,6 +130049,7 @@ export {
|
|
|
129404
130049
|
DocxRender,
|
|
129405
130050
|
ExcelRender,
|
|
129406
130051
|
HtmlRender,
|
|
130052
|
+
ImageRender,
|
|
129407
130053
|
MarkdownRender,
|
|
129408
130054
|
OfdRender,
|
|
129409
130055
|
PdfRender,
|
|
@@ -129411,6 +130057,7 @@ export {
|
|
|
129411
130057
|
TextRender,
|
|
129412
130058
|
Toolbar,
|
|
129413
130059
|
Viewer,
|
|
130060
|
+
Watermark,
|
|
129414
130061
|
createElement,
|
|
129415
130062
|
createEventBus,
|
|
129416
130063
|
createViewer,
|