jit-viewer 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +79 -787
- package/README.zh-CN.md +98 -336
- package/dist/iife/jit-viewer.min.css +1 -1
- package/dist/iife/jit-viewer.min.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +105 -21
- package/dist/index.js +745 -118
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -13,6 +13,8 @@ const EXTENSION_MAP = {
|
|
|
13
13
|
"docx": "docx",
|
|
14
14
|
"xlsx": "xlsx",
|
|
15
15
|
"xls": "xls",
|
|
16
|
+
"csv": "csv",
|
|
17
|
+
"tsv": "csv",
|
|
16
18
|
"pdf": "pdf",
|
|
17
19
|
"pptx": "pptx",
|
|
18
20
|
"ppt": "ppt",
|
|
@@ -32,12 +34,21 @@ const EXTENSION_MAP = {
|
|
|
32
34
|
"bmp": "image",
|
|
33
35
|
"tiff": "image",
|
|
34
36
|
"tif": "image",
|
|
35
|
-
"ico": "image"
|
|
37
|
+
"ico": "image",
|
|
38
|
+
// 视频格式
|
|
39
|
+
"mp4": "video",
|
|
40
|
+
"webm": "video",
|
|
41
|
+
"ogg": "video",
|
|
42
|
+
"ogv": "video",
|
|
43
|
+
"mov": "video"
|
|
36
44
|
};
|
|
37
45
|
const MIME_MAP = {
|
|
38
46
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
39
47
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
40
48
|
"application/vnd.ms-excel": "xls",
|
|
49
|
+
"text/csv": "csv",
|
|
50
|
+
"application/csv": "csv",
|
|
51
|
+
"text/tab-separated-values": "csv",
|
|
41
52
|
"application/pdf": "pdf",
|
|
42
53
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
43
54
|
"application/vnd.ms-powerpoint": "ppt",
|
|
@@ -56,7 +67,12 @@ const MIME_MAP = {
|
|
|
56
67
|
"image/bmp": "image",
|
|
57
68
|
"image/tiff": "image",
|
|
58
69
|
"image/x-icon": "image",
|
|
59
|
-
"image/vnd.microsoft.icon": "image"
|
|
70
|
+
"image/vnd.microsoft.icon": "image",
|
|
71
|
+
// 视频 MIME 类型
|
|
72
|
+
"video/mp4": "video",
|
|
73
|
+
"video/webm": "video",
|
|
74
|
+
"video/ogg": "video",
|
|
75
|
+
"video/quicktime": "video"
|
|
60
76
|
};
|
|
61
77
|
function normalizeMimeType(mimeType) {
|
|
62
78
|
var _a;
|
|
@@ -260,6 +276,7 @@ function isSupportedType(type) {
|
|
|
260
276
|
"docx",
|
|
261
277
|
"xlsx",
|
|
262
278
|
"xls",
|
|
279
|
+
"csv",
|
|
263
280
|
"pdf",
|
|
264
281
|
"pptx",
|
|
265
282
|
"ppt",
|
|
@@ -267,7 +284,9 @@ function isSupportedType(type) {
|
|
|
267
284
|
"md",
|
|
268
285
|
"markdown",
|
|
269
286
|
"ofd",
|
|
270
|
-
"html"
|
|
287
|
+
"html",
|
|
288
|
+
"image",
|
|
289
|
+
"video"
|
|
271
290
|
].includes(type);
|
|
272
291
|
}
|
|
273
292
|
function createEventBus() {
|
|
@@ -13869,13 +13888,13 @@ function useViewerState() {
|
|
|
13869
13888
|
}
|
|
13870
13889
|
return context;
|
|
13871
13890
|
}
|
|
13872
|
-
const _hoisted_1$
|
|
13873
|
-
const _hoisted_2$
|
|
13874
|
-
const _hoisted_3$
|
|
13891
|
+
const _hoisted_1$f = ["disabled", "title"];
|
|
13892
|
+
const _hoisted_2$a = { class: "jv-toolbar-btn__icon" };
|
|
13893
|
+
const _hoisted_3$5 = {
|
|
13875
13894
|
key: 0,
|
|
13876
13895
|
class: "jv-toolbar-btn__label"
|
|
13877
13896
|
};
|
|
13878
|
-
const _sfc_main$
|
|
13897
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
13879
13898
|
__name: "ActionButton",
|
|
13880
13899
|
props: {
|
|
13881
13900
|
type: {},
|
|
@@ -13899,11 +13918,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
13899
13918
|
title: __props.title,
|
|
13900
13919
|
onClick: handleClick
|
|
13901
13920
|
}, [
|
|
13902
|
-
createBaseVNode("span", _hoisted_2$
|
|
13921
|
+
createBaseVNode("span", _hoisted_2$a, [
|
|
13903
13922
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
13904
13923
|
]),
|
|
13905
|
-
__props.label ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
13906
|
-
], 10, _hoisted_1$
|
|
13924
|
+
__props.label ? (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(__props.label), 1)) : createCommentVNode("", true)
|
|
13925
|
+
], 10, _hoisted_1$f);
|
|
13907
13926
|
};
|
|
13908
13927
|
}
|
|
13909
13928
|
});
|
|
@@ -13914,11 +13933,11 @@ const _export_sfc = (sfc, props) => {
|
|
|
13914
13933
|
}
|
|
13915
13934
|
return target;
|
|
13916
13935
|
};
|
|
13917
|
-
const ActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
13918
|
-
const _hoisted_1$
|
|
13919
|
-
const _hoisted_2$
|
|
13936
|
+
const ActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-9abd52f0"]]);
|
|
13937
|
+
const _hoisted_1$e = { class: "jv-zoom-control" };
|
|
13938
|
+
const _hoisted_2$9 = { class: "jv-zoom-control__value" };
|
|
13920
13939
|
const ZOOM_STEP = 0.1;
|
|
13921
|
-
const _sfc_main$
|
|
13940
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
13922
13941
|
__name: "ZoomControl",
|
|
13923
13942
|
setup(__props) {
|
|
13924
13943
|
const { t } = useLocale();
|
|
@@ -13933,7 +13952,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
13933
13952
|
resetTransform();
|
|
13934
13953
|
}
|
|
13935
13954
|
return (_ctx, _cache) => {
|
|
13936
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
13955
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
13937
13956
|
createVNode(ActionButton, {
|
|
13938
13957
|
type: "zoom-out",
|
|
13939
13958
|
title: unref(t)("toolbar.zoomOut"),
|
|
@@ -13967,7 +13986,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
13967
13986
|
])]),
|
|
13968
13987
|
_: 1
|
|
13969
13988
|
}, 8, ["title"]),
|
|
13970
|
-
createBaseVNode("span", _hoisted_2$
|
|
13989
|
+
createBaseVNode("span", _hoisted_2$9, toDisplayString(Math.round(unref(zoom) * 100)) + "%", 1),
|
|
13971
13990
|
createVNode(ActionButton, {
|
|
13972
13991
|
type: "zoom-in",
|
|
13973
13992
|
title: unref(t)("toolbar.zoomIn"),
|
|
@@ -14041,10 +14060,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
14041
14060
|
};
|
|
14042
14061
|
}
|
|
14043
14062
|
});
|
|
14044
|
-
const ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14045
|
-
const _hoisted_1$
|
|
14063
|
+
const ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-874ddbac"]]);
|
|
14064
|
+
const _hoisted_1$d = { class: "jv-rotate-control" };
|
|
14046
14065
|
const ROTATE_STEP = 90;
|
|
14047
|
-
const _sfc_main$
|
|
14066
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
14048
14067
|
__name: "RotateControl",
|
|
14049
14068
|
setup(__props) {
|
|
14050
14069
|
const { t } = useLocale();
|
|
@@ -14056,7 +14075,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
14056
14075
|
setRotate(ROTATE_STEP);
|
|
14057
14076
|
}
|
|
14058
14077
|
return (_ctx, _cache) => {
|
|
14059
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
14078
|
+
return openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
14060
14079
|
createVNode(ActionButton, {
|
|
14061
14080
|
type: "rotate-left",
|
|
14062
14081
|
title: unref(t)("toolbar.rotateLeft"),
|
|
@@ -14095,22 +14114,22 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
14095
14114
|
};
|
|
14096
14115
|
}
|
|
14097
14116
|
});
|
|
14098
|
-
const RotateControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14099
|
-
const _hoisted_1$
|
|
14117
|
+
const RotateControl = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-ad291658"]]);
|
|
14118
|
+
const _hoisted_1$c = {
|
|
14100
14119
|
key: 0,
|
|
14101
14120
|
viewBox: "0 0 24 24",
|
|
14102
14121
|
fill: "none",
|
|
14103
14122
|
stroke: "currentColor",
|
|
14104
14123
|
"stroke-width": "2"
|
|
14105
14124
|
};
|
|
14106
|
-
const _hoisted_2$
|
|
14125
|
+
const _hoisted_2$8 = {
|
|
14107
14126
|
key: 1,
|
|
14108
14127
|
viewBox: "0 0 24 24",
|
|
14109
14128
|
fill: "none",
|
|
14110
14129
|
stroke: "currentColor",
|
|
14111
14130
|
"stroke-width": "2"
|
|
14112
14131
|
};
|
|
14113
|
-
const _sfc_main$
|
|
14132
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
14114
14133
|
__name: "FullscreenButton",
|
|
14115
14134
|
setup(__props) {
|
|
14116
14135
|
const { t } = useLocale();
|
|
@@ -14139,9 +14158,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
14139
14158
|
onClick: toggleFullscreen
|
|
14140
14159
|
}, {
|
|
14141
14160
|
default: withCtx(() => [
|
|
14142
|
-
!isFullscreen.value ? (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
14161
|
+
!isFullscreen.value ? (openBlock(), createElementBlock("svg", _hoisted_1$c, [..._cache[0] || (_cache[0] = [
|
|
14143
14162
|
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)
|
|
14144
|
-
])])) : (openBlock(), createElementBlock("svg", _hoisted_2$
|
|
14163
|
+
])])) : (openBlock(), createElementBlock("svg", _hoisted_2$8, [..._cache[1] || (_cache[1] = [
|
|
14145
14164
|
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)
|
|
14146
14165
|
])]))
|
|
14147
14166
|
]),
|
|
@@ -14150,18 +14169,18 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
14150
14169
|
};
|
|
14151
14170
|
}
|
|
14152
14171
|
});
|
|
14153
|
-
const _hoisted_1$
|
|
14172
|
+
const _hoisted_1$b = {
|
|
14154
14173
|
key: 0,
|
|
14155
14174
|
class: "jv-pagination"
|
|
14156
14175
|
};
|
|
14157
|
-
const _hoisted_2$
|
|
14158
|
-
const _sfc_main$
|
|
14176
|
+
const _hoisted_2$7 = { class: "jv-pagination__info" };
|
|
14177
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
14159
14178
|
__name: "Pagination",
|
|
14160
14179
|
setup(__props) {
|
|
14161
14180
|
const { t } = useLocale();
|
|
14162
14181
|
const { currentPage, totalPages, prevPage, nextPage } = useViewerState();
|
|
14163
14182
|
return (_ctx, _cache) => {
|
|
14164
|
-
return unref(totalPages) > 1 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
14183
|
+
return unref(totalPages) > 1 ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
14165
14184
|
createVNode(ActionButton, {
|
|
14166
14185
|
type: "prev",
|
|
14167
14186
|
title: unref(t)("toolbar.prevPage"),
|
|
@@ -14180,7 +14199,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14180
14199
|
])]),
|
|
14181
14200
|
_: 1
|
|
14182
14201
|
}, 8, ["title", "disabled", "onClick"]),
|
|
14183
|
-
createBaseVNode("span", _hoisted_2$
|
|
14202
|
+
createBaseVNode("span", _hoisted_2$7, toDisplayString(unref(t)("toolbar.pageInfo", { current: unref(currentPage).toString(), total: unref(totalPages).toString() })), 1),
|
|
14184
14203
|
createVNode(ActionButton, {
|
|
14185
14204
|
type: "next",
|
|
14186
14205
|
title: unref(t)("toolbar.nextPage"),
|
|
@@ -14203,26 +14222,26 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14203
14222
|
};
|
|
14204
14223
|
}
|
|
14205
14224
|
});
|
|
14206
|
-
const Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14207
|
-
const _hoisted_1$
|
|
14225
|
+
const Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-97c0759f"]]);
|
|
14226
|
+
const _hoisted_1$a = {
|
|
14208
14227
|
key: 0,
|
|
14209
14228
|
class: "jv-toolbar__top"
|
|
14210
14229
|
};
|
|
14211
|
-
const _hoisted_2$
|
|
14212
|
-
const _hoisted_3$
|
|
14230
|
+
const _hoisted_2$6 = { class: "jv-toolbar__left" };
|
|
14231
|
+
const _hoisted_3$4 = {
|
|
14213
14232
|
key: 0,
|
|
14214
14233
|
class: "jv-toolbar__filename"
|
|
14215
14234
|
};
|
|
14216
|
-
const _hoisted_4$
|
|
14217
|
-
const _hoisted_5$
|
|
14218
|
-
const _hoisted_6$
|
|
14235
|
+
const _hoisted_4$4 = { class: "jv-toolbar__center" };
|
|
14236
|
+
const _hoisted_5$3 = { class: "jv-toolbar__right" };
|
|
14237
|
+
const _hoisted_6$2 = {
|
|
14219
14238
|
key: 1,
|
|
14220
14239
|
class: "jv-toolbar__bottom"
|
|
14221
14240
|
};
|
|
14222
|
-
const _hoisted_7$
|
|
14241
|
+
const _hoisted_7$2 = { class: "jv-toolbar__left" };
|
|
14223
14242
|
const _hoisted_8$1 = { class: "jv-toolbar__center" };
|
|
14224
14243
|
const _hoisted_9 = { class: "jv-toolbar__right" };
|
|
14225
|
-
const _sfc_main$
|
|
14244
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
14226
14245
|
__name: "Toolbar",
|
|
14227
14246
|
props: {
|
|
14228
14247
|
config: {},
|
|
@@ -14280,25 +14299,25 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14280
14299
|
return openBlock(), createElementBlock("div", {
|
|
14281
14300
|
class: normalizeClass(["jv-toolbar", [positionClass.value, { "jv-toolbar--hidden": !__props.visible }]])
|
|
14282
14301
|
}, [
|
|
14283
|
-
showTop.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
14284
|
-
createBaseVNode("div", _hoisted_2$
|
|
14302
|
+
showTop.value ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
14303
|
+
createBaseVNode("div", _hoisted_2$6, [
|
|
14285
14304
|
renderSlot(_ctx.$slots, "top-left", {}, () => [
|
|
14286
|
-
unref(filename) ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
14305
|
+
unref(filename) ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(unref(filename)), 1)) : createCommentVNode("", true)
|
|
14287
14306
|
], true)
|
|
14288
14307
|
]),
|
|
14289
|
-
createBaseVNode("div", _hoisted_4$
|
|
14308
|
+
createBaseVNode("div", _hoisted_4$4, [
|
|
14290
14309
|
renderSlot(_ctx.$slots, "top-center", {}, void 0, true)
|
|
14291
14310
|
]),
|
|
14292
|
-
createBaseVNode("div", _hoisted_5$
|
|
14311
|
+
createBaseVNode("div", _hoisted_5$3, [
|
|
14293
14312
|
renderSlot(_ctx.$slots, "top-right", {}, () => [
|
|
14294
14313
|
hasItem("zoom") ? (openBlock(), createBlock(ZoomControl, { key: 0 })) : createCommentVNode("", true),
|
|
14295
14314
|
hasItem("rotate") ? (openBlock(), createBlock(RotateControl, { key: 1 })) : createCommentVNode("", true),
|
|
14296
|
-
hasItem("fullscreen") ? (openBlock(), createBlock(_sfc_main$
|
|
14315
|
+
hasItem("fullscreen") ? (openBlock(), createBlock(_sfc_main$f, { key: 2 })) : createCommentVNode("", true)
|
|
14297
14316
|
], true)
|
|
14298
14317
|
])
|
|
14299
14318
|
])) : createCommentVNode("", true),
|
|
14300
|
-
showBottom.value ? (openBlock(), createElementBlock("div", _hoisted_6$
|
|
14301
|
-
createBaseVNode("div", _hoisted_7$
|
|
14319
|
+
showBottom.value ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
|
|
14320
|
+
createBaseVNode("div", _hoisted_7$2, [
|
|
14302
14321
|
renderSlot(_ctx.$slots, "bottom-left", {}, () => [
|
|
14303
14322
|
hasItem("pagination") ? (openBlock(), createBlock(Pagination, { key: 0 })) : createCommentVNode("", true)
|
|
14304
14323
|
], true)
|
|
@@ -14340,7 +14359,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14340
14359
|
};
|
|
14341
14360
|
}
|
|
14342
14361
|
});
|
|
14343
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
14362
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-74d3b30f"]]);
|
|
14344
14363
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
14345
14364
|
function getDefaultExportFromCjs(x) {
|
|
14346
14365
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -19466,7 +19485,7 @@ section.${e}>footer { z-index: 1; }
|
|
|
19466
19485
|
})(lib$4);
|
|
19467
19486
|
var libExports$3 = lib$4.exports;
|
|
19468
19487
|
const VueOfficeDocx = /* @__PURE__ */ getDefaultExportFromCjs(libExports$3);
|
|
19469
|
-
const _sfc_main$
|
|
19488
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
19470
19489
|
__name: "DocxRender",
|
|
19471
19490
|
props: {
|
|
19472
19491
|
source: {},
|
|
@@ -19521,7 +19540,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
19521
19540
|
};
|
|
19522
19541
|
}
|
|
19523
19542
|
});
|
|
19524
|
-
const DocxRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
19543
|
+
const DocxRender = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-9181c8b1"]]);
|
|
19525
19544
|
var lib$2 = { exports: {} };
|
|
19526
19545
|
(function(module, exports$1) {
|
|
19527
19546
|
!function(e, t) {
|
|
@@ -62308,7 +62327,7 @@ var lib$2 = { exports: {} };
|
|
|
62308
62327
|
})(lib$2);
|
|
62309
62328
|
var libExports$2 = lib$2.exports;
|
|
62310
62329
|
const VueOfficeExcel = /* @__PURE__ */ getDefaultExportFromCjs(libExports$2);
|
|
62311
|
-
const _sfc_main$
|
|
62330
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
62312
62331
|
__name: "ExcelRender",
|
|
62313
62332
|
props: {
|
|
62314
62333
|
source: {},
|
|
@@ -62363,7 +62382,286 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
62363
62382
|
};
|
|
62364
62383
|
}
|
|
62365
62384
|
});
|
|
62366
|
-
const ExcelRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
62385
|
+
const ExcelRender = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-a8c7c89f"]]);
|
|
62386
|
+
const _hoisted_1$9 = { class: "jv-csv-toolbar" };
|
|
62387
|
+
const _hoisted_2$5 = { class: "jv-csv-meta" };
|
|
62388
|
+
const _hoisted_3$3 = { class: "jv-csv-meta" };
|
|
62389
|
+
const _hoisted_4$3 = { class: "jv-csv-scroll" };
|
|
62390
|
+
const _hoisted_5$2 = { class: "jv-csv-stage" };
|
|
62391
|
+
const _hoisted_6$1 = {
|
|
62392
|
+
key: 0,
|
|
62393
|
+
class: "jv-csv-empty"
|
|
62394
|
+
};
|
|
62395
|
+
const _hoisted_7$1 = { class: "jv-csv-index" };
|
|
62396
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
62397
|
+
__name: "CsvRender",
|
|
62398
|
+
props: {
|
|
62399
|
+
source: {},
|
|
62400
|
+
zoom: { default: 1 },
|
|
62401
|
+
proxyUrl: {},
|
|
62402
|
+
requestAdapter: {}
|
|
62403
|
+
},
|
|
62404
|
+
emits: ["load", "error"],
|
|
62405
|
+
setup(__props, { emit: __emit }) {
|
|
62406
|
+
const props = __props;
|
|
62407
|
+
const emit2 = __emit;
|
|
62408
|
+
const containerRef = /* @__PURE__ */ ref();
|
|
62409
|
+
const scrollRef = /* @__PURE__ */ ref();
|
|
62410
|
+
const tableRef = /* @__PURE__ */ ref();
|
|
62411
|
+
const dataRows = /* @__PURE__ */ ref([]);
|
|
62412
|
+
const delimiter = /* @__PURE__ */ ref(",");
|
|
62413
|
+
const fitScale = /* @__PURE__ */ ref(1);
|
|
62414
|
+
const measuredWidth = /* @__PURE__ */ ref(0);
|
|
62415
|
+
const measuredHeight = /* @__PURE__ */ ref(0);
|
|
62416
|
+
const viewportWidth = /* @__PURE__ */ ref(0);
|
|
62417
|
+
let resizeObserver = null;
|
|
62418
|
+
const columnCount = computed(() => {
|
|
62419
|
+
return dataRows.value.reduce((max, row) => Math.max(max, row.length), 0);
|
|
62420
|
+
});
|
|
62421
|
+
const headerRow = computed(() => normalizeRow(dataRows.value[0] || [], columnCount.value));
|
|
62422
|
+
const bodyRows = computed(() => dataRows.value.slice(1).map((row) => normalizeRow(row, columnCount.value)));
|
|
62423
|
+
const delimiterLabel = computed(() => {
|
|
62424
|
+
if (delimiter.value === " ") {
|
|
62425
|
+
return "Tab";
|
|
62426
|
+
}
|
|
62427
|
+
if (delimiter.value === ";") {
|
|
62428
|
+
return ";";
|
|
62429
|
+
}
|
|
62430
|
+
return ",";
|
|
62431
|
+
});
|
|
62432
|
+
const effectiveScale = computed(() => fitScale.value * props.zoom);
|
|
62433
|
+
const fitShellStyle = computed(() => ({
|
|
62434
|
+
width: `${Math.max(viewportWidth.value, measuredWidth.value * effectiveScale.value)}px`,
|
|
62435
|
+
height: `${measuredHeight.value * effectiveScale.value}px`
|
|
62436
|
+
}));
|
|
62437
|
+
const fitContentStyle = computed(() => {
|
|
62438
|
+
return {
|
|
62439
|
+
transform: `scale(${effectiveScale.value})`,
|
|
62440
|
+
transformOrigin: "top left",
|
|
62441
|
+
width: measuredWidth.value ? `${measuredWidth.value}px` : "max-content"
|
|
62442
|
+
};
|
|
62443
|
+
});
|
|
62444
|
+
function ensureResizeObserved() {
|
|
62445
|
+
if (!resizeObserver) {
|
|
62446
|
+
return;
|
|
62447
|
+
}
|
|
62448
|
+
if (scrollRef.value) {
|
|
62449
|
+
resizeObserver.observe(scrollRef.value);
|
|
62450
|
+
}
|
|
62451
|
+
if (tableRef.value) {
|
|
62452
|
+
resizeObserver.observe(tableRef.value);
|
|
62453
|
+
}
|
|
62454
|
+
}
|
|
62455
|
+
function updateScale() {
|
|
62456
|
+
if (!scrollRef.value || !tableRef.value || !dataRows.value.length) {
|
|
62457
|
+
fitScale.value = 1;
|
|
62458
|
+
measuredWidth.value = 0;
|
|
62459
|
+
measuredHeight.value = 0;
|
|
62460
|
+
viewportWidth.value = 0;
|
|
62461
|
+
return;
|
|
62462
|
+
}
|
|
62463
|
+
const nextViewportWidth = Math.max(scrollRef.value.clientWidth, 0);
|
|
62464
|
+
const nextMeasuredWidth = Math.max(tableRef.value.scrollWidth, 0);
|
|
62465
|
+
const nextMeasuredHeight = Math.max(tableRef.value.scrollHeight, 0);
|
|
62466
|
+
viewportWidth.value = nextViewportWidth;
|
|
62467
|
+
measuredWidth.value = nextMeasuredWidth;
|
|
62468
|
+
measuredHeight.value = nextMeasuredHeight;
|
|
62469
|
+
if (nextViewportWidth > 0 && nextMeasuredWidth > 0) {
|
|
62470
|
+
fitScale.value = Math.min(1, nextViewportWidth / nextMeasuredWidth);
|
|
62471
|
+
return;
|
|
62472
|
+
}
|
|
62473
|
+
fitScale.value = 1;
|
|
62474
|
+
}
|
|
62475
|
+
function normalizeRow(row, length) {
|
|
62476
|
+
if (row.length >= length) {
|
|
62477
|
+
return row;
|
|
62478
|
+
}
|
|
62479
|
+
return [...row, ...Array.from({ length: length - row.length }, () => "")];
|
|
62480
|
+
}
|
|
62481
|
+
function decodeCsvBuffer(buffer2) {
|
|
62482
|
+
const bytes = new Uint8Array(buffer2);
|
|
62483
|
+
if (bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) {
|
|
62484
|
+
return new TextDecoder("utf-8").decode(bytes.slice(3));
|
|
62485
|
+
}
|
|
62486
|
+
if (bytes.length >= 2 && bytes[0] === 255 && bytes[1] === 254) {
|
|
62487
|
+
return new TextDecoder("utf-16le").decode(bytes.slice(2));
|
|
62488
|
+
}
|
|
62489
|
+
if (bytes.length >= 2 && bytes[0] === 254 && bytes[1] === 255) {
|
|
62490
|
+
const swapped = new Uint8Array(bytes.length - 2);
|
|
62491
|
+
for (let index2 = 2; index2 < bytes.length; index2 += 2) {
|
|
62492
|
+
swapped[index2 - 2] = bytes[index2 + 1] ?? 0;
|
|
62493
|
+
swapped[index2 - 1] = bytes[index2];
|
|
62494
|
+
}
|
|
62495
|
+
return new TextDecoder("utf-16le").decode(swapped);
|
|
62496
|
+
}
|
|
62497
|
+
return new TextDecoder("utf-8").decode(bytes);
|
|
62498
|
+
}
|
|
62499
|
+
function countDelimiter(line, target) {
|
|
62500
|
+
let count = 0;
|
|
62501
|
+
let inQuotes = false;
|
|
62502
|
+
for (let index2 = 0; index2 < line.length; index2++) {
|
|
62503
|
+
const char = line[index2];
|
|
62504
|
+
if (char === '"') {
|
|
62505
|
+
if (inQuotes && line[index2 + 1] === '"') {
|
|
62506
|
+
index2++;
|
|
62507
|
+
} else {
|
|
62508
|
+
inQuotes = !inQuotes;
|
|
62509
|
+
}
|
|
62510
|
+
continue;
|
|
62511
|
+
}
|
|
62512
|
+
if (!inQuotes && char === target) {
|
|
62513
|
+
count++;
|
|
62514
|
+
}
|
|
62515
|
+
}
|
|
62516
|
+
return count;
|
|
62517
|
+
}
|
|
62518
|
+
function detectDelimiter(text) {
|
|
62519
|
+
const sampleLines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(0, 10);
|
|
62520
|
+
const candidates = [",", " ", ";"];
|
|
62521
|
+
let resolved = ",";
|
|
62522
|
+
let maxScore = -1;
|
|
62523
|
+
for (const candidate of candidates) {
|
|
62524
|
+
const score = sampleLines.reduce((total, line) => total + countDelimiter(line, candidate), 0);
|
|
62525
|
+
if (score > maxScore) {
|
|
62526
|
+
maxScore = score;
|
|
62527
|
+
resolved = candidate;
|
|
62528
|
+
}
|
|
62529
|
+
}
|
|
62530
|
+
return resolved;
|
|
62531
|
+
}
|
|
62532
|
+
function parseDelimitedText(text, splitChar) {
|
|
62533
|
+
const rows = [];
|
|
62534
|
+
let currentRow = [];
|
|
62535
|
+
let currentCell = "";
|
|
62536
|
+
let inQuotes = false;
|
|
62537
|
+
for (let index2 = 0; index2 < text.length; index2++) {
|
|
62538
|
+
const char = text[index2];
|
|
62539
|
+
const nextChar = text[index2 + 1];
|
|
62540
|
+
if (char === '"') {
|
|
62541
|
+
if (inQuotes && nextChar === '"') {
|
|
62542
|
+
currentCell += '"';
|
|
62543
|
+
index2++;
|
|
62544
|
+
} else {
|
|
62545
|
+
inQuotes = !inQuotes;
|
|
62546
|
+
}
|
|
62547
|
+
continue;
|
|
62548
|
+
}
|
|
62549
|
+
if (!inQuotes && char === splitChar) {
|
|
62550
|
+
currentRow.push(currentCell);
|
|
62551
|
+
currentCell = "";
|
|
62552
|
+
continue;
|
|
62553
|
+
}
|
|
62554
|
+
if (!inQuotes && (char === "\n" || char === "\r")) {
|
|
62555
|
+
if (char === "\r" && nextChar === "\n") {
|
|
62556
|
+
index2++;
|
|
62557
|
+
}
|
|
62558
|
+
currentRow.push(currentCell);
|
|
62559
|
+
rows.push(currentRow);
|
|
62560
|
+
currentRow = [];
|
|
62561
|
+
currentCell = "";
|
|
62562
|
+
continue;
|
|
62563
|
+
}
|
|
62564
|
+
currentCell += char;
|
|
62565
|
+
}
|
|
62566
|
+
if (currentCell.length || currentRow.length) {
|
|
62567
|
+
currentRow.push(currentCell);
|
|
62568
|
+
rows.push(currentRow);
|
|
62569
|
+
}
|
|
62570
|
+
return rows.filter((row) => row.some((cell) => cell.length > 0));
|
|
62571
|
+
}
|
|
62572
|
+
async function loadFile() {
|
|
62573
|
+
try {
|
|
62574
|
+
const buffer2 = await fileToArrayBuffer(props.source, {
|
|
62575
|
+
proxyUrl: props.proxyUrl,
|
|
62576
|
+
requestAdapter: props.requestAdapter
|
|
62577
|
+
});
|
|
62578
|
+
const text = decodeCsvBuffer(buffer2);
|
|
62579
|
+
delimiter.value = detectDelimiter(text);
|
|
62580
|
+
dataRows.value = parseDelimitedText(text, delimiter.value);
|
|
62581
|
+
await nextTick();
|
|
62582
|
+
ensureResizeObserved();
|
|
62583
|
+
updateScale();
|
|
62584
|
+
emit2("load");
|
|
62585
|
+
} catch (error) {
|
|
62586
|
+
emit2("error", error);
|
|
62587
|
+
}
|
|
62588
|
+
}
|
|
62589
|
+
watch(() => props.source, loadFile, { immediate: true });
|
|
62590
|
+
watch(() => props.zoom, () => nextTick(updateScale));
|
|
62591
|
+
watch(columnCount, () => nextTick(updateScale));
|
|
62592
|
+
onMounted(() => {
|
|
62593
|
+
resizeObserver = new ResizeObserver(() => updateScale());
|
|
62594
|
+
ensureResizeObserved();
|
|
62595
|
+
});
|
|
62596
|
+
onUnmounted(() => {
|
|
62597
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
62598
|
+
});
|
|
62599
|
+
return (_ctx, _cache) => {
|
|
62600
|
+
return openBlock(), createElementBlock("div", {
|
|
62601
|
+
ref_key: "containerRef",
|
|
62602
|
+
ref: containerRef,
|
|
62603
|
+
class: "jv-file-render jv-file-render--csv"
|
|
62604
|
+
}, [
|
|
62605
|
+
createBaseVNode("div", _hoisted_1$9, [
|
|
62606
|
+
createBaseVNode("span", _hoisted_2$5, "共 " + toDisplayString(dataRows.value.length) + " 行," + toDisplayString(columnCount.value) + " 列", 1),
|
|
62607
|
+
createBaseVNode("span", _hoisted_3$3, "分隔符:" + toDisplayString(delimiterLabel.value), 1)
|
|
62608
|
+
]),
|
|
62609
|
+
createBaseVNode("div", _hoisted_4$3, [
|
|
62610
|
+
createBaseVNode("div", _hoisted_5$2, [
|
|
62611
|
+
!dataRows.value.length ? (openBlock(), createElementBlock("div", _hoisted_6$1, "CSV 内容为空")) : (openBlock(), createElementBlock("div", {
|
|
62612
|
+
key: 1,
|
|
62613
|
+
ref_key: "scrollRef",
|
|
62614
|
+
ref: scrollRef,
|
|
62615
|
+
class: "jv-csv-fit-scroll"
|
|
62616
|
+
}, [
|
|
62617
|
+
createBaseVNode("div", {
|
|
62618
|
+
class: "jv-csv-fit-shell",
|
|
62619
|
+
style: normalizeStyle(fitShellStyle.value)
|
|
62620
|
+
}, [
|
|
62621
|
+
createBaseVNode("div", {
|
|
62622
|
+
class: "jv-csv-fit-content",
|
|
62623
|
+
style: normalizeStyle(fitContentStyle.value)
|
|
62624
|
+
}, [
|
|
62625
|
+
createBaseVNode("table", {
|
|
62626
|
+
ref_key: "tableRef",
|
|
62627
|
+
ref: tableRef,
|
|
62628
|
+
class: "jv-csv-table"
|
|
62629
|
+
}, [
|
|
62630
|
+
createBaseVNode("thead", null, [
|
|
62631
|
+
createBaseVNode("tr", null, [
|
|
62632
|
+
_cache[0] || (_cache[0] = createBaseVNode("th", { class: "jv-csv-index" }, "#", -1)),
|
|
62633
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(headerRow.value, (cell, index2) => {
|
|
62634
|
+
return openBlock(), createElementBlock("th", {
|
|
62635
|
+
key: `head-${index2}`
|
|
62636
|
+
}, toDisplayString(cell || `列 ${index2 + 1}`), 1);
|
|
62637
|
+
}), 128))
|
|
62638
|
+
])
|
|
62639
|
+
]),
|
|
62640
|
+
createBaseVNode("tbody", null, [
|
|
62641
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(bodyRows.value, (row, rowIndex) => {
|
|
62642
|
+
return openBlock(), createElementBlock("tr", {
|
|
62643
|
+
key: `row-${rowIndex}`
|
|
62644
|
+
}, [
|
|
62645
|
+
createBaseVNode("td", _hoisted_7$1, toDisplayString(rowIndex + 2), 1),
|
|
62646
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellIndex) => {
|
|
62647
|
+
return openBlock(), createElementBlock("td", {
|
|
62648
|
+
key: `cell-${rowIndex}-${cellIndex}`
|
|
62649
|
+
}, toDisplayString(cell), 1);
|
|
62650
|
+
}), 128))
|
|
62651
|
+
]);
|
|
62652
|
+
}), 128))
|
|
62653
|
+
])
|
|
62654
|
+
], 512)
|
|
62655
|
+
], 4)
|
|
62656
|
+
], 4)
|
|
62657
|
+
], 512))
|
|
62658
|
+
])
|
|
62659
|
+
])
|
|
62660
|
+
], 512);
|
|
62661
|
+
};
|
|
62662
|
+
}
|
|
62663
|
+
});
|
|
62664
|
+
const CsvRender = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dc1ca7d"]]);
|
|
62367
62665
|
var lib$1 = { exports: {} };
|
|
62368
62666
|
(function(module, exports$1) {
|
|
62369
62667
|
(function(Q, k) {
|
|
@@ -64066,8 +64364,8 @@ var t={4186:(t,e,r)=>{var n=r(3749),i=r(8055),a=TypeError;t.exports=function(t){
|
|
|
64066
64364
|
})(lib$1);
|
|
64067
64365
|
var libExports$1 = lib$1.exports;
|
|
64068
64366
|
const VueOfficePdf = /* @__PURE__ */ getDefaultExportFromCjs(libExports$1);
|
|
64069
|
-
const _hoisted_1$
|
|
64070
|
-
const _sfc_main$
|
|
64367
|
+
const _hoisted_1$8 = ["src"];
|
|
64368
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
64071
64369
|
__name: "PdfRender",
|
|
64072
64370
|
props: {
|
|
64073
64371
|
source: {},
|
|
@@ -64166,12 +64464,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
64166
64464
|
style: normalizeStyle(renderStyle.value),
|
|
64167
64465
|
frameborder: "0",
|
|
64168
64466
|
onLoad: handleRendered
|
|
64169
|
-
}, null, 44, _hoisted_1$
|
|
64467
|
+
}, null, 44, _hoisted_1$8))
|
|
64170
64468
|
], 512);
|
|
64171
64469
|
};
|
|
64172
64470
|
}
|
|
64173
64471
|
});
|
|
64174
|
-
const PdfRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
64472
|
+
const PdfRender = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-32fed398"]]);
|
|
64175
64473
|
var lib = { exports: {} };
|
|
64176
64474
|
(function(module, exports$1) {
|
|
64177
64475
|
(function(Ma, No) {
|
|
@@ -102540,7 +102838,7 @@ echarts.use([` + E + "]);" : "Unknown series " + P));
|
|
|
102540
102838
|
})(lib);
|
|
102541
102839
|
var libExports = lib.exports;
|
|
102542
102840
|
const VueOfficePptx = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
102543
|
-
const _sfc_main$
|
|
102841
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
102544
102842
|
__name: "PptxRender",
|
|
102545
102843
|
props: {
|
|
102546
102844
|
source: {},
|
|
@@ -102595,9 +102893,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
102595
102893
|
};
|
|
102596
102894
|
}
|
|
102597
102895
|
});
|
|
102598
|
-
const PptxRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
102599
|
-
const _hoisted_1$
|
|
102600
|
-
const _sfc_main$
|
|
102896
|
+
const PptxRender = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b31abca4"]]);
|
|
102897
|
+
const _hoisted_1$7 = { class: "jv-text-content" };
|
|
102898
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
102601
102899
|
__name: "TextRender",
|
|
102602
102900
|
props: {
|
|
102603
102901
|
source: {}
|
|
@@ -102629,14 +102927,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
102629
102927
|
ref: containerRef,
|
|
102630
102928
|
class: "jv-file-render jv-file-render--text"
|
|
102631
102929
|
}, [
|
|
102632
|
-
createBaseVNode("pre", _hoisted_1$
|
|
102930
|
+
createBaseVNode("pre", _hoisted_1$7, toDisplayString(content.value), 1)
|
|
102633
102931
|
], 512);
|
|
102634
102932
|
};
|
|
102635
102933
|
}
|
|
102636
102934
|
});
|
|
102637
|
-
const TextRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
102638
|
-
const _hoisted_1$
|
|
102639
|
-
const _sfc_main$
|
|
102935
|
+
const TextRender = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-f5957104"]]);
|
|
102936
|
+
const _hoisted_1$6 = ["innerHTML"];
|
|
102937
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
102640
102938
|
__name: "MarkdownRender",
|
|
102641
102939
|
props: {
|
|
102642
102940
|
source: {}
|
|
@@ -102760,12 +103058,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
102760
103058
|
createBaseVNode("div", {
|
|
102761
103059
|
class: "jv-markdown-content",
|
|
102762
103060
|
innerHTML: renderedContent.value
|
|
102763
|
-
}, null, 8, _hoisted_1$
|
|
103061
|
+
}, null, 8, _hoisted_1$6)
|
|
102764
103062
|
], 512);
|
|
102765
103063
|
};
|
|
102766
103064
|
}
|
|
102767
103065
|
});
|
|
102768
|
-
const MarkdownRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
103066
|
+
const MarkdownRender = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2d9fb509"]]);
|
|
102769
103067
|
var dist = { exports: {} };
|
|
102770
103068
|
/*! For license information please see index.js.LICENSE.txt */
|
|
102771
103069
|
(function(module, exports$1) {
|
|
@@ -128399,12 +128697,12 @@ class LiteOfdAdapter {
|
|
|
128399
128697
|
this.instance = null;
|
|
128400
128698
|
}
|
|
128401
128699
|
}
|
|
128402
|
-
const _hoisted_1$
|
|
128700
|
+
const _hoisted_1$5 = {
|
|
128403
128701
|
key: 0,
|
|
128404
128702
|
class: "jv-ofd-error"
|
|
128405
128703
|
};
|
|
128406
|
-
const _hoisted_2$
|
|
128407
|
-
const _sfc_main$
|
|
128704
|
+
const _hoisted_2$4 = { class: "jv-ofd-loading" };
|
|
128705
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
128408
128706
|
__name: "OfdRender",
|
|
128409
128707
|
props: {
|
|
128410
128708
|
source: {},
|
|
@@ -128635,7 +128933,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
128635
128933
|
ref: containerRef,
|
|
128636
128934
|
class: "jv-file-render jv-file-render--ofd"
|
|
128637
128935
|
}, [
|
|
128638
|
-
error.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
128936
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
128639
128937
|
createBaseVNode("span", null, toDisplayString(error.value), 1)
|
|
128640
128938
|
])) : (openBlock(), createElementBlock("div", {
|
|
128641
128939
|
key: 1,
|
|
@@ -128654,7 +128952,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
128654
128952
|
}, null, 512)
|
|
128655
128953
|
], 4)
|
|
128656
128954
|
], 512)),
|
|
128657
|
-
withDirectives(createBaseVNode("div", _hoisted_2$
|
|
128955
|
+
withDirectives(createBaseVNode("div", _hoisted_2$4, [
|
|
128658
128956
|
createBaseVNode("span", null, toDisplayString(t("loading")), 1)
|
|
128659
128957
|
], 512), [
|
|
128660
128958
|
[vShow, loading.value]
|
|
@@ -128663,13 +128961,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
128663
128961
|
};
|
|
128664
128962
|
}
|
|
128665
128963
|
});
|
|
128666
|
-
const OfdRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
128667
|
-
const _hoisted_1$
|
|
128668
|
-
const _hoisted_2$
|
|
128964
|
+
const OfdRender = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f933a20c"]]);
|
|
128965
|
+
const _hoisted_1$4 = { class: "jv-html-loading" };
|
|
128966
|
+
const _hoisted_2$3 = {
|
|
128669
128967
|
key: 0,
|
|
128670
128968
|
class: "jv-html-error"
|
|
128671
128969
|
};
|
|
128672
|
-
const _sfc_main$
|
|
128970
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
128673
128971
|
__name: "HtmlRender",
|
|
128674
128972
|
props: {
|
|
128675
128973
|
source: {},
|
|
@@ -128932,34 +129230,34 @@ ${document2.documentElement.outerHTML}`;
|
|
|
128932
129230
|
onLoad: handleIframeLoad,
|
|
128933
129231
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-forms allow-top-navigation"
|
|
128934
129232
|
}, null, 36),
|
|
128935
|
-
withDirectives(createBaseVNode("div", _hoisted_1$
|
|
129233
|
+
withDirectives(createBaseVNode("div", _hoisted_1$4, [..._cache[0] || (_cache[0] = [
|
|
128936
129234
|
createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1),
|
|
128937
129235
|
createBaseVNode("span", null, "加载中...", -1)
|
|
128938
129236
|
])], 512), [
|
|
128939
129237
|
[vShow, loading.value]
|
|
128940
129238
|
]),
|
|
128941
|
-
error.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
129239
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
|
|
128942
129240
|
createBaseVNode("span", null, toDisplayString(error.value), 1)
|
|
128943
129241
|
])) : createCommentVNode("", true)
|
|
128944
129242
|
], 512);
|
|
128945
129243
|
};
|
|
128946
129244
|
}
|
|
128947
129245
|
});
|
|
128948
|
-
const HtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
128949
|
-
const _hoisted_1$
|
|
129246
|
+
const HtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-be7a9198"]]);
|
|
129247
|
+
const _hoisted_1$3 = {
|
|
128950
129248
|
key: 0,
|
|
128951
129249
|
class: "jv-image-loading"
|
|
128952
129250
|
};
|
|
128953
|
-
const _hoisted_2$
|
|
129251
|
+
const _hoisted_2$2 = {
|
|
128954
129252
|
key: 1,
|
|
128955
129253
|
class: "jv-image-error"
|
|
128956
129254
|
};
|
|
128957
|
-
const _hoisted_3$
|
|
128958
|
-
const _hoisted_4$
|
|
129255
|
+
const _hoisted_3$2 = ["src", "alt"];
|
|
129256
|
+
const _hoisted_4$2 = {
|
|
128959
129257
|
key: 2,
|
|
128960
129258
|
class: "jv-image-info"
|
|
128961
129259
|
};
|
|
128962
|
-
const _sfc_main$
|
|
129260
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
128963
129261
|
__name: "ImageRender",
|
|
128964
129262
|
props: {
|
|
128965
129263
|
source: {},
|
|
@@ -129146,10 +129444,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
129146
129444
|
ref: containerRef,
|
|
129147
129445
|
class: "jv-file-render jv-file-render--image"
|
|
129148
129446
|
}, [
|
|
129149
|
-
loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
129447
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$3, [..._cache[0] || (_cache[0] = [
|
|
129150
129448
|
createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1),
|
|
129151
129449
|
createBaseVNode("span", null, "加载中...", -1)
|
|
129152
|
-
])])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
129450
|
+
])])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
129153
129451
|
_cache[1] || (_cache[1] = createBaseVNode("svg", {
|
|
129154
129452
|
viewBox: "0 0 24 24",
|
|
129155
129453
|
fill: "none",
|
|
@@ -129198,7 +129496,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
129198
129496
|
draggable: "false",
|
|
129199
129497
|
onLoad: handleImageLoad,
|
|
129200
129498
|
onError: handleImageError
|
|
129201
|
-
}, null, 44, _hoisted_3$
|
|
129499
|
+
}, null, 44, _hoisted_3$2)) : createCommentVNode("", true)
|
|
129202
129500
|
], 34), [
|
|
129203
129501
|
[vShow, !loading.value && !error.value]
|
|
129204
129502
|
]),
|
|
@@ -129208,7 +129506,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
129208
129506
|
title: "放大",
|
|
129209
129507
|
onClick: zoomIn
|
|
129210
129508
|
}, [..._cache[2] || (_cache[2] = [
|
|
129211
|
-
createStaticVNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-
|
|
129509
|
+
createStaticVNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-4810f73a><circle cx="11" cy="11" r="8" data-v-4810f73a></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-4810f73a></line><line x1="11" y1="8" x2="11" y2="14" data-v-4810f73a></line><line x1="8" y1="11" x2="14" y2="11" data-v-4810f73a></line></svg>', 1)
|
|
129212
129510
|
])]),
|
|
129213
129511
|
createBaseVNode("button", {
|
|
129214
129512
|
class: "jv-image-btn",
|
|
@@ -129347,12 +129645,195 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
129347
129645
|
], -1)
|
|
129348
129646
|
])])
|
|
129349
129647
|
]),
|
|
129350
|
-
imageInfo.value ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
129648
|
+
imageInfo.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, toDisplayString(imageInfo.value.width) + " × " + toDisplayString(imageInfo.value.height) + " | " + toDisplayString(formatFileSize(imageInfo.value.size)), 1)) : createCommentVNode("", true)
|
|
129649
|
+
], 512);
|
|
129650
|
+
};
|
|
129651
|
+
}
|
|
129652
|
+
});
|
|
129653
|
+
const ImageRender = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4810f73a"]]);
|
|
129654
|
+
const _hoisted_1$2 = {
|
|
129655
|
+
key: 0,
|
|
129656
|
+
class: "jv-video-error"
|
|
129657
|
+
};
|
|
129658
|
+
const _hoisted_2$1 = {
|
|
129659
|
+
key: 1,
|
|
129660
|
+
class: "jv-video-stage"
|
|
129661
|
+
};
|
|
129662
|
+
const _hoisted_3$1 = { class: "jv-video-loading" };
|
|
129663
|
+
const _hoisted_4$1 = ["src", "title"];
|
|
129664
|
+
const _hoisted_5$1 = {
|
|
129665
|
+
key: 0,
|
|
129666
|
+
class: "jv-video-info"
|
|
129667
|
+
};
|
|
129668
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
129669
|
+
__name: "VideoRender",
|
|
129670
|
+
props: {
|
|
129671
|
+
source: {},
|
|
129672
|
+
zoom: { default: 1 },
|
|
129673
|
+
proxyUrl: {},
|
|
129674
|
+
requestAdapter: {}
|
|
129675
|
+
},
|
|
129676
|
+
emits: ["load", "error"],
|
|
129677
|
+
setup(__props, { emit: __emit }) {
|
|
129678
|
+
const props = __props;
|
|
129679
|
+
const emit2 = __emit;
|
|
129680
|
+
const containerRef = /* @__PURE__ */ ref();
|
|
129681
|
+
const videoRef = /* @__PURE__ */ ref();
|
|
129682
|
+
const loading = /* @__PURE__ */ ref(true);
|
|
129683
|
+
const error = /* @__PURE__ */ ref(null);
|
|
129684
|
+
const videoSrc = /* @__PURE__ */ ref("");
|
|
129685
|
+
const videoName = /* @__PURE__ */ ref("");
|
|
129686
|
+
const videoInfo = /* @__PURE__ */ ref(null);
|
|
129687
|
+
const stageStyle = computed(() => {
|
|
129688
|
+
if (props.zoom === 1) {
|
|
129689
|
+
return {};
|
|
129690
|
+
}
|
|
129691
|
+
return {
|
|
129692
|
+
transform: `scale(${props.zoom})`,
|
|
129693
|
+
transformOrigin: "top center"
|
|
129694
|
+
};
|
|
129695
|
+
});
|
|
129696
|
+
function cleanupObjectUrl() {
|
|
129697
|
+
if (videoSrc.value.startsWith("blob:")) {
|
|
129698
|
+
URL.revokeObjectURL(videoSrc.value);
|
|
129699
|
+
}
|
|
129700
|
+
videoSrc.value = "";
|
|
129701
|
+
}
|
|
129702
|
+
async function loadVideo() {
|
|
129703
|
+
try {
|
|
129704
|
+
loading.value = true;
|
|
129705
|
+
error.value = null;
|
|
129706
|
+
cleanupObjectUrl();
|
|
129707
|
+
const blob = await fileToBlob(props.source, {
|
|
129708
|
+
proxyUrl: props.proxyUrl,
|
|
129709
|
+
requestAdapter: props.requestAdapter
|
|
129710
|
+
});
|
|
129711
|
+
videoSrc.value = URL.createObjectURL(blob);
|
|
129712
|
+
videoName.value = getFilename(props.source);
|
|
129713
|
+
videoInfo.value = {
|
|
129714
|
+
width: 0,
|
|
129715
|
+
height: 0,
|
|
129716
|
+
duration: 0,
|
|
129717
|
+
size: blob.size
|
|
129718
|
+
};
|
|
129719
|
+
} catch (err) {
|
|
129720
|
+
loading.value = false;
|
|
129721
|
+
error.value = err;
|
|
129722
|
+
emit2("error", err);
|
|
129723
|
+
}
|
|
129724
|
+
}
|
|
129725
|
+
function handleLoadedMetadata() {
|
|
129726
|
+
if (!videoRef.value || !videoInfo.value) {
|
|
129727
|
+
return;
|
|
129728
|
+
}
|
|
129729
|
+
videoInfo.value = {
|
|
129730
|
+
...videoInfo.value,
|
|
129731
|
+
width: videoRef.value.videoWidth,
|
|
129732
|
+
height: videoRef.value.videoHeight,
|
|
129733
|
+
duration: videoRef.value.duration
|
|
129734
|
+
};
|
|
129735
|
+
loading.value = false;
|
|
129736
|
+
emit2("load");
|
|
129737
|
+
}
|
|
129738
|
+
function handleVideoError() {
|
|
129739
|
+
loading.value = false;
|
|
129740
|
+
error.value = new Error("视频加载失败");
|
|
129741
|
+
emit2("error", error.value);
|
|
129742
|
+
}
|
|
129743
|
+
function formatFileSize(bytes) {
|
|
129744
|
+
if (bytes === 0) {
|
|
129745
|
+
return "0 B";
|
|
129746
|
+
}
|
|
129747
|
+
const base = 1024;
|
|
129748
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
129749
|
+
const index2 = Math.min(Math.floor(Math.log(bytes) / Math.log(base)), units.length - 1);
|
|
129750
|
+
return `${parseFloat((bytes / Math.pow(base, index2)).toFixed(2))} ${units[index2]}`;
|
|
129751
|
+
}
|
|
129752
|
+
function formatDuration(duration) {
|
|
129753
|
+
if (!Number.isFinite(duration) || duration <= 0) {
|
|
129754
|
+
return "00:00";
|
|
129755
|
+
}
|
|
129756
|
+
const totalSeconds = Math.floor(duration);
|
|
129757
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
129758
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
129759
|
+
const seconds = totalSeconds % 60;
|
|
129760
|
+
if (hours > 0) {
|
|
129761
|
+
return [hours, minutes, seconds].map((value) => value.toString().padStart(2, "0")).join(":");
|
|
129762
|
+
}
|
|
129763
|
+
return [minutes, seconds].map((value) => value.toString().padStart(2, "0")).join(":");
|
|
129764
|
+
}
|
|
129765
|
+
watch(() => props.source, loadVideo, { immediate: true });
|
|
129766
|
+
onUnmounted(() => {
|
|
129767
|
+
cleanupObjectUrl();
|
|
129768
|
+
});
|
|
129769
|
+
return (_ctx, _cache) => {
|
|
129770
|
+
return openBlock(), createElementBlock("div", {
|
|
129771
|
+
ref_key: "containerRef",
|
|
129772
|
+
ref: containerRef,
|
|
129773
|
+
class: "jv-file-render jv-file-render--video"
|
|
129774
|
+
}, [
|
|
129775
|
+
error.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
129776
|
+
_cache[0] || (_cache[0] = createBaseVNode("svg", {
|
|
129777
|
+
viewBox: "0 0 24 24",
|
|
129778
|
+
fill: "none",
|
|
129779
|
+
stroke: "currentColor",
|
|
129780
|
+
"stroke-width": "2"
|
|
129781
|
+
}, [
|
|
129782
|
+
createBaseVNode("circle", {
|
|
129783
|
+
cx: "12",
|
|
129784
|
+
cy: "12",
|
|
129785
|
+
r: "10"
|
|
129786
|
+
}),
|
|
129787
|
+
createBaseVNode("line", {
|
|
129788
|
+
x1: "12",
|
|
129789
|
+
y1: "8",
|
|
129790
|
+
x2: "12",
|
|
129791
|
+
y2: "12"
|
|
129792
|
+
}),
|
|
129793
|
+
createBaseVNode("line", {
|
|
129794
|
+
x1: "12",
|
|
129795
|
+
y1: "16",
|
|
129796
|
+
x2: "12.01",
|
|
129797
|
+
y2: "16"
|
|
129798
|
+
})
|
|
129799
|
+
], -1)),
|
|
129800
|
+
createBaseVNode("span", null, toDisplayString(error.value.message || "视频加载失败"), 1)
|
|
129801
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
129802
|
+
withDirectives(createBaseVNode("div", _hoisted_3$1, [..._cache[1] || (_cache[1] = [
|
|
129803
|
+
createBaseVNode("div", { class: "jv-loading-spinner" }, null, -1),
|
|
129804
|
+
createBaseVNode("span", null, "加载中...", -1)
|
|
129805
|
+
])], 512), [
|
|
129806
|
+
[vShow, loading.value]
|
|
129807
|
+
]),
|
|
129808
|
+
createBaseVNode("div", {
|
|
129809
|
+
class: "jv-video-stage__inner",
|
|
129810
|
+
style: normalizeStyle(stageStyle.value)
|
|
129811
|
+
}, [
|
|
129812
|
+
videoSrc.value ? (openBlock(), createElementBlock("video", {
|
|
129813
|
+
key: 0,
|
|
129814
|
+
ref_key: "videoRef",
|
|
129815
|
+
ref: videoRef,
|
|
129816
|
+
class: "jv-video-player",
|
|
129817
|
+
src: videoSrc.value,
|
|
129818
|
+
title: videoName.value,
|
|
129819
|
+
controls: "",
|
|
129820
|
+
preload: "metadata",
|
|
129821
|
+
playsinline: "",
|
|
129822
|
+
onLoadedmetadata: handleLoadedMetadata,
|
|
129823
|
+
onError: handleVideoError
|
|
129824
|
+
}, null, 40, _hoisted_4$1)) : createCommentVNode("", true)
|
|
129825
|
+
], 4),
|
|
129826
|
+
videoInfo.value ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
129827
|
+
createBaseVNode("span", null, toDisplayString(videoInfo.value.width) + " × " + toDisplayString(videoInfo.value.height), 1),
|
|
129828
|
+
createBaseVNode("span", null, toDisplayString(formatDuration(videoInfo.value.duration)), 1),
|
|
129829
|
+
createBaseVNode("span", null, toDisplayString(formatFileSize(videoInfo.value.size)), 1)
|
|
129830
|
+
])) : createCommentVNode("", true)
|
|
129831
|
+
]))
|
|
129351
129832
|
], 512);
|
|
129352
129833
|
};
|
|
129353
129834
|
}
|
|
129354
129835
|
});
|
|
129355
|
-
const
|
|
129836
|
+
const VideoRender = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-39a588be"]]);
|
|
129356
129837
|
const _hoisted_1$1 = ["src"];
|
|
129357
129838
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
129358
129839
|
__name: "Watermark",
|
|
@@ -129485,13 +129966,16 @@ const _hoisted_4 = { class: "jv-empty-text" };
|
|
|
129485
129966
|
const _hoisted_5 = { class: "jv-viewer__loading-overlay" };
|
|
129486
129967
|
const _hoisted_6 = { class: "jv-loading-text" };
|
|
129487
129968
|
const _hoisted_7 = {
|
|
129488
|
-
key:
|
|
129969
|
+
key: 11,
|
|
129489
129970
|
class: "jv-viewer__unsupported"
|
|
129490
129971
|
};
|
|
129491
129972
|
const _hoisted_8 = {
|
|
129492
|
-
key:
|
|
129973
|
+
key: 12,
|
|
129493
129974
|
class: "jv-viewer__unsupported"
|
|
129494
129975
|
};
|
|
129976
|
+
const BRANDING_LINK = "https://github.com/jitOffice/jit-viewer-sdk";
|
|
129977
|
+
const BRANDING_TITLE = "JitViewer";
|
|
129978
|
+
const BRANDING_TEXT = "提供文档预览支持";
|
|
129495
129979
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
129496
129980
|
__name: "Viewer",
|
|
129497
129981
|
props: {
|
|
@@ -129529,6 +130013,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129529
130013
|
let viewerRoot = null;
|
|
129530
130014
|
let copyrightObserver = null;
|
|
129531
130015
|
let copyrightCheckInterval = null;
|
|
130016
|
+
let copyrightHeadObserver = null;
|
|
129532
130017
|
const events = createEventBus();
|
|
129533
130018
|
const { t, setLocale } = useLocaleProvider(props.locale);
|
|
129534
130019
|
const viewerRefForTheme = computed(() => viewerRef.value || null);
|
|
@@ -129619,32 +130104,141 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129619
130104
|
}
|
|
129620
130105
|
});
|
|
129621
130106
|
}
|
|
129622
|
-
function
|
|
129623
|
-
|
|
129624
|
-
if (
|
|
129625
|
-
|
|
129626
|
-
|
|
130107
|
+
function resolveViewerRoot() {
|
|
130108
|
+
var _a2;
|
|
130109
|
+
if (viewerRoot && document.body.contains(viewerRoot)) {
|
|
130110
|
+
return viewerRoot;
|
|
130111
|
+
}
|
|
130112
|
+
viewerRoot = ((_a2 = brandingRef.value) == null ? void 0 : _a2.closest(".jv-viewer")) || viewerRef.value || null;
|
|
130113
|
+
return viewerRoot;
|
|
130114
|
+
}
|
|
130115
|
+
function setImportantStyle(element, styles) {
|
|
130116
|
+
Object.entries(styles).forEach(([key, value]) => {
|
|
130117
|
+
element.style.setProperty(key, value, "important");
|
|
130118
|
+
});
|
|
130119
|
+
}
|
|
130120
|
+
function ensureBrandingStructure(repair = true) {
|
|
130121
|
+
const root = resolveViewerRoot();
|
|
130122
|
+
if (!root || !document.body.contains(root)) {
|
|
130123
|
+
return null;
|
|
129627
130124
|
}
|
|
129628
|
-
|
|
130125
|
+
let branding = brandingRef.value && root.contains(brandingRef.value) ? brandingRef.value : root.querySelector(".jv-viewer__branding");
|
|
130126
|
+
if (!branding) {
|
|
130127
|
+
if (!repair) {
|
|
130128
|
+
return null;
|
|
130129
|
+
}
|
|
130130
|
+
branding = document.createElement("div");
|
|
130131
|
+
branding.className = "jv-viewer__branding";
|
|
130132
|
+
root.appendChild(branding);
|
|
130133
|
+
}
|
|
130134
|
+
let link = branding.querySelector(".jv-branding-link");
|
|
130135
|
+
if (!link) {
|
|
130136
|
+
if (!repair) {
|
|
130137
|
+
return null;
|
|
130138
|
+
}
|
|
130139
|
+
link = document.createElement("a");
|
|
130140
|
+
branding.appendChild(link);
|
|
130141
|
+
}
|
|
130142
|
+
let textNode = branding.querySelector(".jv-branding-text");
|
|
130143
|
+
if (!textNode) {
|
|
130144
|
+
if (!repair) {
|
|
130145
|
+
return null;
|
|
130146
|
+
}
|
|
130147
|
+
textNode = document.createElement("span");
|
|
130148
|
+
branding.appendChild(textNode);
|
|
130149
|
+
}
|
|
130150
|
+
if (repair) {
|
|
130151
|
+
link.className = "jv-branding-link";
|
|
130152
|
+
link.href = BRANDING_LINK;
|
|
130153
|
+
link.target = "_blank";
|
|
130154
|
+
link.rel = "noopener noreferrer";
|
|
130155
|
+
link.textContent = BRANDING_TITLE;
|
|
130156
|
+
textNode.className = "jv-branding-text";
|
|
130157
|
+
textNode.textContent = BRANDING_TEXT;
|
|
130158
|
+
setImportantStyle(branding, {
|
|
130159
|
+
display: "flex",
|
|
130160
|
+
visibility: "visible",
|
|
130161
|
+
opacity: "1",
|
|
130162
|
+
position: "relative",
|
|
130163
|
+
padding: "8px 16px",
|
|
130164
|
+
"text-align": "center",
|
|
130165
|
+
"font-size": "12px",
|
|
130166
|
+
"line-height": "1.5",
|
|
130167
|
+
"flex-shrink": "0",
|
|
130168
|
+
"align-items": "center",
|
|
130169
|
+
"justify-content": "center",
|
|
130170
|
+
gap: "4px",
|
|
130171
|
+
background: "var(--jv-bg-secondary)",
|
|
130172
|
+
color: "var(--jv-text-secondary)",
|
|
130173
|
+
border: "0",
|
|
130174
|
+
"border-top": "1px solid var(--jv-border-color)",
|
|
130175
|
+
overflow: "visible",
|
|
130176
|
+
clip: "auto",
|
|
130177
|
+
"clip-path": "none",
|
|
130178
|
+
transform: "none",
|
|
130179
|
+
"pointer-events": "auto",
|
|
130180
|
+
"min-height": "32px",
|
|
130181
|
+
width: "auto",
|
|
130182
|
+
height: "auto",
|
|
130183
|
+
"max-width": "100%"
|
|
130184
|
+
});
|
|
130185
|
+
setImportantStyle(link, {
|
|
130186
|
+
display: "inline",
|
|
130187
|
+
visibility: "visible",
|
|
130188
|
+
opacity: "1",
|
|
130189
|
+
color: "var(--jv-primary-color)",
|
|
130190
|
+
"text-decoration": "none",
|
|
130191
|
+
"font-weight": "500",
|
|
130192
|
+
"pointer-events": "auto"
|
|
130193
|
+
});
|
|
130194
|
+
setImportantStyle(textNode, {
|
|
130195
|
+
display: "inline",
|
|
130196
|
+
visibility: "visible",
|
|
130197
|
+
opacity: "1",
|
|
130198
|
+
color: "var(--jv-text-secondary)"
|
|
130199
|
+
});
|
|
130200
|
+
}
|
|
130201
|
+
brandingRef.value = branding;
|
|
130202
|
+
return {
|
|
130203
|
+
branding,
|
|
130204
|
+
link,
|
|
130205
|
+
textNode
|
|
130206
|
+
};
|
|
130207
|
+
}
|
|
130208
|
+
function isElementEffectivelyHidden(element) {
|
|
130209
|
+
const style = window.getComputedStyle(element);
|
|
130210
|
+
const rect = element.getBoundingClientRect();
|
|
130211
|
+
return style.display === "none" || style.visibility === "hidden" || style.visibility === "collapse" || Number.parseFloat(style.opacity || "1") === 0 || rect.width <= 1 || rect.height <= 1;
|
|
130212
|
+
}
|
|
130213
|
+
function handleCopyrightTamper() {
|
|
130214
|
+
ensureBrandingStructure(true);
|
|
130215
|
+
showCopyrightWarning();
|
|
130216
|
+
}
|
|
130217
|
+
function checkCopyright() {
|
|
130218
|
+
const root = resolveViewerRoot();
|
|
130219
|
+
if (!root || !document.body.contains(root)) {
|
|
129629
130220
|
return false;
|
|
129630
130221
|
}
|
|
129631
|
-
|
|
129632
|
-
|
|
130222
|
+
const brandingState = ensureBrandingStructure(false);
|
|
130223
|
+
if (!brandingState) {
|
|
129633
130224
|
return false;
|
|
129634
130225
|
}
|
|
129635
|
-
const link =
|
|
129636
|
-
if (!
|
|
129637
|
-
|
|
130226
|
+
const { branding, link, textNode } = brandingState;
|
|
130227
|
+
if (!root.contains(branding)) {
|
|
130228
|
+
handleCopyrightTamper();
|
|
129638
130229
|
return false;
|
|
129639
130230
|
}
|
|
129640
|
-
|
|
129641
|
-
|
|
129642
|
-
showCopyrightWarning();
|
|
130231
|
+
if (link.getAttribute("href") !== BRANDING_LINK || link.textContent !== BRANDING_TITLE || textNode.textContent !== BRANDING_TEXT) {
|
|
130232
|
+
handleCopyrightTamper();
|
|
129643
130233
|
return false;
|
|
129644
130234
|
}
|
|
129645
130235
|
const text = branding.textContent || "";
|
|
129646
|
-
if (!text.includes(
|
|
129647
|
-
|
|
130236
|
+
if (!text.includes(BRANDING_TITLE) || !text.includes(BRANDING_TEXT)) {
|
|
130237
|
+
handleCopyrightTamper();
|
|
130238
|
+
return false;
|
|
130239
|
+
}
|
|
130240
|
+
if (isElementEffectivelyHidden(branding) || isElementEffectivelyHidden(link) || isElementEffectivelyHidden(textNode)) {
|
|
130241
|
+
handleCopyrightTamper();
|
|
129648
130242
|
return false;
|
|
129649
130243
|
}
|
|
129650
130244
|
return true;
|
|
@@ -129741,7 +130335,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129741
130335
|
});
|
|
129742
130336
|
}
|
|
129743
130337
|
}
|
|
129744
|
-
|
|
130338
|
+
copyrightHeadObserver = new MutationObserver(() => {
|
|
130339
|
+
checkCopyright();
|
|
130340
|
+
});
|
|
130341
|
+
if (document.head) {
|
|
130342
|
+
copyrightHeadObserver.observe(document.head, {
|
|
130343
|
+
childList: true,
|
|
130344
|
+
subtree: true,
|
|
130345
|
+
attributes: true,
|
|
130346
|
+
characterData: true
|
|
130347
|
+
});
|
|
130348
|
+
}
|
|
130349
|
+
copyrightCheckInterval = setInterval(checkCopyright, 500);
|
|
129745
130350
|
}
|
|
129746
130351
|
function stopCopyrightProtection() {
|
|
129747
130352
|
if (copyrightObserver) {
|
|
@@ -129752,6 +130357,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129752
130357
|
clearInterval(copyrightCheckInterval);
|
|
129753
130358
|
copyrightCheckInterval = null;
|
|
129754
130359
|
}
|
|
130360
|
+
if (copyrightHeadObserver) {
|
|
130361
|
+
copyrightHeadObserver.disconnect();
|
|
130362
|
+
copyrightHeadObserver = null;
|
|
130363
|
+
}
|
|
129755
130364
|
viewerRoot = null;
|
|
129756
130365
|
}
|
|
129757
130366
|
async function mount(target) {
|
|
@@ -129935,17 +130544,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129935
130544
|
"request-adapter": requestAdapter.value,
|
|
129936
130545
|
onLoad: handleLoad,
|
|
129937
130546
|
onError: handleError2
|
|
129938
|
-
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "
|
|
130547
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "csv" ? (openBlock(), createBlock(unref(CsvRender), {
|
|
129939
130548
|
key: 2,
|
|
129940
130549
|
source: unref(fileSource),
|
|
129941
130550
|
zoom: unref(zoom),
|
|
129942
130551
|
"proxy-url": proxyUrl.value,
|
|
129943
130552
|
"request-adapter": requestAdapter.value,
|
|
130553
|
+
onLoad: handleLoad,
|
|
130554
|
+
onError: handleError2
|
|
130555
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "pdf" ? (openBlock(), createBlock(unref(PdfRender), {
|
|
130556
|
+
key: 3,
|
|
130557
|
+
source: unref(fileSource),
|
|
130558
|
+
zoom: unref(zoom),
|
|
130559
|
+
"proxy-url": proxyUrl.value,
|
|
130560
|
+
"request-adapter": requestAdapter.value,
|
|
129944
130561
|
"pdf-render": pdfRenderMode.value,
|
|
129945
130562
|
onLoad: handleLoad,
|
|
129946
130563
|
onError: handleError2
|
|
129947
130564
|
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter", "pdf-render"])) : unref(fileType) === "pptx" || unref(fileType) === "ppt" ? (openBlock(), createBlock(unref(PptxRender), {
|
|
129948
|
-
key:
|
|
130565
|
+
key: 4,
|
|
129949
130566
|
source: unref(fileSource),
|
|
129950
130567
|
zoom: unref(zoom),
|
|
129951
130568
|
"proxy-url": proxyUrl.value,
|
|
@@ -129953,17 +130570,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129953
130570
|
onLoad: handleLoad,
|
|
129954
130571
|
onError: handleError2
|
|
129955
130572
|
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "txt" ? (openBlock(), createBlock(unref(TextRender), {
|
|
129956
|
-
key:
|
|
130573
|
+
key: 5,
|
|
129957
130574
|
source: unref(fileSource),
|
|
129958
130575
|
onLoad: handleLoad,
|
|
129959
130576
|
onError: handleError2
|
|
129960
130577
|
}, null, 8, ["source"])) : unref(fileType) === "md" || unref(fileType) === "markdown" ? (openBlock(), createBlock(unref(MarkdownRender), {
|
|
129961
|
-
key:
|
|
130578
|
+
key: 6,
|
|
129962
130579
|
source: unref(fileSource),
|
|
129963
130580
|
onLoad: handleLoad,
|
|
129964
130581
|
onError: handleError2
|
|
129965
130582
|
}, null, 8, ["source"])) : unref(fileType) === "ofd" ? (openBlock(), createBlock(unref(OfdRender), {
|
|
129966
|
-
key:
|
|
130583
|
+
key: 7,
|
|
129967
130584
|
ref_key: "ofdRenderRef",
|
|
129968
130585
|
ref: ofdRenderRef,
|
|
129969
130586
|
source: unref(fileSource),
|
|
@@ -129974,7 +130591,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129974
130591
|
onError: handleError2,
|
|
129975
130592
|
onPageChange: handleOfdPageChange
|
|
129976
130593
|
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "html" ? (openBlock(), createBlock(unref(HtmlRender), {
|
|
129977
|
-
key:
|
|
130594
|
+
key: 8,
|
|
129978
130595
|
source: unref(fileSource),
|
|
129979
130596
|
zoom: unref(zoom),
|
|
129980
130597
|
"proxy-url": proxyUrl.value,
|
|
@@ -129982,12 +130599,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129982
130599
|
onLoad: handleLoad,
|
|
129983
130600
|
onError: handleError2
|
|
129984
130601
|
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "image" ? (openBlock(), createBlock(unref(ImageRender), {
|
|
129985
|
-
key:
|
|
130602
|
+
key: 9,
|
|
130603
|
+
source: unref(fileSource),
|
|
130604
|
+
zoom: unref(zoom),
|
|
130605
|
+
onLoad: handleLoad,
|
|
130606
|
+
onError: handleError2
|
|
130607
|
+
}, null, 8, ["source", "zoom"])) : unref(fileType) === "video" ? (openBlock(), createBlock(unref(VideoRender), {
|
|
130608
|
+
key: 10,
|
|
129986
130609
|
source: unref(fileSource),
|
|
129987
130610
|
zoom: unref(zoom),
|
|
130611
|
+
"proxy-url": proxyUrl.value,
|
|
130612
|
+
"request-adapter": requestAdapter.value,
|
|
129988
130613
|
onLoad: handleLoad,
|
|
129989
130614
|
onError: handleError2
|
|
129990
|
-
}, null, 8, ["source", "zoom"])) : unref(fileType) === "unknown" && unref(fileSource) ? (openBlock(), createElementBlock("div", _hoisted_7, [..._cache[2] || (_cache[2] = [
|
|
130615
|
+
}, null, 8, ["source", "zoom", "proxy-url", "request-adapter"])) : unref(fileType) === "unknown" && unref(fileSource) ? (openBlock(), createElementBlock("div", _hoisted_7, [..._cache[2] || (_cache[2] = [
|
|
129991
130616
|
createBaseVNode("span", null, "未知文件类型", -1)
|
|
129992
130617
|
])])) : (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
129993
130618
|
createBaseVNode("span", null, toDisplayString(unref(t)("error.unsupportedType")), 1)
|
|
@@ -130014,7 +130639,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
130014
130639
|
};
|
|
130015
130640
|
}
|
|
130016
130641
|
});
|
|
130017
|
-
const Viewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
130642
|
+
const Viewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b10b4a5f"]]);
|
|
130018
130643
|
function createViewer(options) {
|
|
130019
130644
|
const events = createEventBus();
|
|
130020
130645
|
let app = null;
|
|
@@ -130170,6 +130795,7 @@ const JitViewer = {
|
|
|
130170
130795
|
Viewer
|
|
130171
130796
|
};
|
|
130172
130797
|
export {
|
|
130798
|
+
CsvRender,
|
|
130173
130799
|
DocxRender,
|
|
130174
130800
|
ExcelRender,
|
|
130175
130801
|
HtmlRender,
|
|
@@ -130180,6 +130806,7 @@ export {
|
|
|
130180
130806
|
PptxRender,
|
|
130181
130807
|
TextRender,
|
|
130182
130808
|
Toolbar,
|
|
130809
|
+
VideoRender,
|
|
130183
130810
|
Viewer,
|
|
130184
130811
|
Watermark,
|
|
130185
130812
|
createElement,
|