fangguo-component 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/README.md +57 -0
- package/dist/{ErrorImage-Ao9kEEUg.js → ErrorImage-CFVt1ht_.js} +2 -2
- package/dist/FgCascader.css +24 -0
- package/dist/{FgCascader.vue_vue_type_style_index_0_lang-CM8FxFLJ.js → FgCascader.vue_vue_type_style_index_0_lang-Bm4HR37D.js} +45 -4
- package/dist/{HSelect-BFkWiCFi.js → HSelect-DgFjd08Y.js} +3 -3
- package/dist/{HSelectAll.vue_vue_type_script_setup_true_lang-BZX7ch2I.js → HSelectAll.vue_vue_type_script_setup_true_lang-C6qzdQT-.js} +1 -1
- package/dist/{HSelectSJ-DZmtdyjF.js → HSelectSJ-DOFUzTZV.js} +3 -3
- package/dist/ImgViewerHost.vue_vue_type_script_setup_true_lang-CMoh7eWo.js +52 -0
- package/dist/LazyPopover-7ebuh-QG.js +188 -0
- package/dist/LazyPopover.css +5 -0
- package/dist/{SelectTree-DHbWogEU.js → SelectTree-DUH92Iwr.js} +2 -2
- package/dist/{TextCopy-th0FAxwl.js → TextCopy-lpbeqOUI.js} +1 -1
- package/dist/ViewImg-Bg1AQ0T6.js +247 -0
- package/dist/ViewImg.css +56 -0
- package/dist/ViewImgPopover-b9PDEYbP.js +275 -0
- package/dist/ViewImgPopover.css +33 -0
- package/dist/ViewImgPreview.css +100 -0
- package/dist/ViewImgPreview.vue_vue_type_style_index_0_lang-CYuLovBR.js +306 -0
- package/dist/{common-B1nSpTGn.js → common-D0EYVGB2.js} +1 -1
- package/dist/components/cascader/index.js +1 -1
- package/dist/components/errorImage/index.js +2 -2
- package/dist/components/hSelect/index.js +1 -1
- package/dist/components/hSelectAll/index.js +1 -1
- package/dist/components/hSelectSJ/index.js +1 -1
- package/dist/components/imgViewerHost/ImgViewerHost.vue.d.ts +2 -0
- package/dist/components/imgViewerHost/imgViewerStore.d.ts +195 -0
- package/dist/components/imgViewerHost/index.d.ts +4 -0
- package/dist/components/imgViewerHost/index.js +10 -0
- package/dist/components/imgViewerHost/utils.d.ts +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +45 -18
- package/dist/components/lazyPopover/LazyPopover.vue.d.ts +12 -15
- package/dist/components/lazyPopover/index.js +2 -2
- package/dist/components/selectTree/index.js +1 -1
- package/dist/components/textCopy/index.js +1 -1
- package/dist/components/viewImg/ViewImg.vue.d.ts +141 -0
- package/dist/components/viewImg/index.d.ts +1 -0
- package/dist/components/viewImg/index.js +4 -0
- package/dist/components/viewImgPopover/ViewImgPopover.vue.d.ts +705 -0
- package/dist/components/viewImgPopover/index.d.ts +1 -0
- package/dist/components/viewImgPopover/index.js +4 -0
- package/dist/components/viewImgPreview/ViewImgPreview.vue.d.ts +50 -0
- package/dist/components/viewImgPreview/index.d.ts +3 -0
- package/dist/components/viewImgPreview/index.js +17 -0
- package/dist/components/viewImgPreview/types.d.ts +78 -0
- package/dist/imgViewerStore-C5n16uYa.js +241 -0
- package/dist/{index-DzdLpetc.js → index-BtQgIf7F.js} +1414 -1402
- package/dist/{index-uQXqC9BF.js → index-CckJZ8N-.js} +40 -13
- package/dist/{index-BPnixsfc.js → index-Qkq7I01c.js} +15 -1
- package/dist/index.d.ts +17 -3
- package/dist/index.js +103 -60
- package/dist/montageImgUrl-CwgYnB2h.js +204 -0
- package/dist/tools/ImageParserUtils/index.js +346 -346
- package/dist/tools/common/index.js +1 -1
- package/dist/tools/imgUrl/config.d.ts +10 -0
- package/dist/tools/imgUrl/index.d.ts +4 -0
- package/dist/tools/imgUrl/index.js +16 -0
- package/dist/tools/imgUrl/montageImgUrl.d.ts +15 -0
- package/dist/tools/imgUrl/networkAdaptive.d.ts +7 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +29 -15
- package/dist/types-BNFeGRer.js +32 -0
- package/package.json +92 -92
- package/dist/LazyPopover.vue_vue_type_script_setup_true_lang-B2vtU4f4.js +0 -34
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.fg-view-img-preview__toolbar-capture {
|
|
3
|
+
display: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* 无工具项时隐藏底部工具栏容器 */
|
|
7
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__actions {
|
|
8
|
+
display: none !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* 未配置切换按钮或仅单图时隐藏左右箭头(关闭按钮不受影响) */
|
|
12
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__prev,
|
|
13
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__next {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 多图且配置了 prev/next 等时,显式展示左右箭头 */
|
|
18
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__prev,
|
|
19
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__next {
|
|
20
|
+
display: inline-flex !important;
|
|
21
|
+
visibility: visible !important;
|
|
22
|
+
opacity: 1 !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* 保证预览图在视口内居中适配(避免业务全局 img { width/height: 100% } 导致铺满) */
|
|
26
|
+
.el-image-viewer__wrapper .el-image-viewer__canvas {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
.el-image-viewer__wrapper .el-image-viewer__img {
|
|
34
|
+
max-width: 100% !important;
|
|
35
|
+
max-height: 100% !important;
|
|
36
|
+
object-fit: contain !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* 画布置于蒙层之上 */
|
|
40
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__mask,
|
|
41
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__mask,
|
|
42
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__mask {
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
45
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__canvas,
|
|
46
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__canvas,
|
|
47
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__canvas {
|
|
48
|
+
z-index: 2;
|
|
49
|
+
}
|
|
50
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__img,
|
|
51
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__img,
|
|
52
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__img {
|
|
53
|
+
z-index: 2;
|
|
54
|
+
}
|
|
55
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__btn,
|
|
56
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__close,
|
|
57
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__actions,
|
|
58
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__btn,
|
|
59
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__close,
|
|
60
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__btn,
|
|
61
|
+
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__close {
|
|
62
|
+
z-index: 3;
|
|
63
|
+
}
|
|
64
|
+
.el-image-viewer__wrapper .el-image-viewer__img.fg-view-img-preview__img--broken {
|
|
65
|
+
position: absolute;
|
|
66
|
+
z-index: 2;
|
|
67
|
+
max-width: 100%;
|
|
68
|
+
max-height: 100%;
|
|
69
|
+
object-fit: contain;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* 自定义工具栏样式 */
|
|
73
|
+
.el-image-viewer__actions:has(.fg-view-img-preview__toolbar) {
|
|
74
|
+
height: auto;
|
|
75
|
+
padding: 0;
|
|
76
|
+
background-color: transparent !important;
|
|
77
|
+
border: none;
|
|
78
|
+
}
|
|
79
|
+
.el-image-viewer__actions__inner:has(.fg-view-img-preview__toolbar) {
|
|
80
|
+
width: auto;
|
|
81
|
+
height: auto;
|
|
82
|
+
padding: 0;
|
|
83
|
+
gap: 0;
|
|
84
|
+
color: inherit;
|
|
85
|
+
}
|
|
86
|
+
.fg-view-img-preview__toolbar {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
gap: 16px;
|
|
91
|
+
padding: 8px 16px;
|
|
92
|
+
border-radius: 22px;
|
|
93
|
+
color: var(--fg-view-img-toolbar-color, #ffffff);
|
|
94
|
+
background-color: var(--fg-view-img-toolbar-bg, #606266);
|
|
95
|
+
}
|
|
96
|
+
.fg-view-img-preview__action {
|
|
97
|
+
font-size: 23px;
|
|
98
|
+
color: var(--fg-view-img-toolbar-color, #ffffff);
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { defineComponent, shallowRef, watch, nextTick, computed, openBlock, createBlock, unref, withCtx, createElementVNode, toDisplayString, createElementBlock, normalizeStyle, Fragment, renderList, resolveDynamicComponent, createCommentVNode } from "vue";
|
|
2
|
+
import { ElImageViewer, ElIcon } from "element-plus";
|
|
3
|
+
import { Refresh, RefreshRight, RefreshLeft, ZoomIn, ZoomOut, DArrowRight, DArrowLeft, Right, Back } from "@element-plus/icons-vue";
|
|
4
|
+
import { D as DEFAULT_ORIGINAL_TOOLBAR, g as DEFAULT_PREVIEW_SHOW_PROGRESS, d as DEFAULT_PREVIEW_MAX_SCALE, e as DEFAULT_PREVIEW_MIN_SCALE, f as DEFAULT_PREVIEW_SCALE, i as DEFAULT_PREVIEW_ZOOM_RATE, h as DEFAULT_PREVIEW_TELEPORTED, a as DEFAULT_PREVIEW_CLOSE_ON_PRESS_ESCAPE, b as DEFAULT_PREVIEW_HIDE_ON_CLICK_MODAL, k as DEFAULT_TOOLBAR_ICON_COLOR, j as DEFAULT_TOOLBAR_BG_COLOR, c as DEFAULT_PREVIEW_INFINITE } from "./types-BNFeGRer.js";
|
|
5
|
+
import './ViewImgPreview.css';const _hoisted_1 = {
|
|
6
|
+
class: "fg-view-img-preview__toolbar-capture",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
};
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "ViewImgPreview",
|
|
11
|
+
props: {
|
|
12
|
+
visible: { type: Boolean, default: false },
|
|
13
|
+
urlList: { default: () => [] },
|
|
14
|
+
initialIndex: { default: 0 },
|
|
15
|
+
infinite: { type: Boolean, default: DEFAULT_PREVIEW_INFINITE },
|
|
16
|
+
zIndex: { default: 2e3 },
|
|
17
|
+
toolbarBgColor: { default: DEFAULT_TOOLBAR_BG_COLOR },
|
|
18
|
+
toolbarIconColor: { default: DEFAULT_TOOLBAR_ICON_COLOR },
|
|
19
|
+
hideOnClickModal: { type: Boolean, default: DEFAULT_PREVIEW_HIDE_ON_CLICK_MODAL },
|
|
20
|
+
closeOnPressEscape: { type: Boolean, default: DEFAULT_PREVIEW_CLOSE_ON_PRESS_ESCAPE },
|
|
21
|
+
teleported: { type: Boolean, default: DEFAULT_PREVIEW_TELEPORTED },
|
|
22
|
+
zoomRate: { default: DEFAULT_PREVIEW_ZOOM_RATE },
|
|
23
|
+
scale: { default: DEFAULT_PREVIEW_SCALE },
|
|
24
|
+
minScale: { default: DEFAULT_PREVIEW_MIN_SCALE },
|
|
25
|
+
maxScale: { default: DEFAULT_PREVIEW_MAX_SCALE },
|
|
26
|
+
showProgress: { type: Boolean, default: DEFAULT_PREVIEW_SHOW_PROGRESS },
|
|
27
|
+
simpleExtraTools: { default: () => [] },
|
|
28
|
+
renderExtraTools: { default: null },
|
|
29
|
+
originalToolbar: { default: () => [...DEFAULT_ORIGINAL_TOOLBAR] }
|
|
30
|
+
},
|
|
31
|
+
emits: ["close", "switch", "show"],
|
|
32
|
+
setup(__props, { emit: __emit }) {
|
|
33
|
+
const props = __props;
|
|
34
|
+
const emit = __emit;
|
|
35
|
+
const toolbarCtx = shallowRef(null);
|
|
36
|
+
let resetTimer;
|
|
37
|
+
function captureToolbar(toolbar) {
|
|
38
|
+
toolbarCtx.value = toolbar;
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
function syncViewerWrapperFlags() {
|
|
42
|
+
const wrapper = document.querySelector(".el-image-viewer__wrapper");
|
|
43
|
+
if (!wrapper) return;
|
|
44
|
+
wrapper.classList.remove(
|
|
45
|
+
"fg-view-img-preview--hide-toolbar",
|
|
46
|
+
"fg-view-img-preview--hide-nav",
|
|
47
|
+
"fg-view-img-preview--has-nav"
|
|
48
|
+
);
|
|
49
|
+
if (!props.visible) return;
|
|
50
|
+
if (!showToolbar.value) wrapper.classList.add("fg-view-img-preview--hide-toolbar");
|
|
51
|
+
if (showSideNav.value) wrapper.classList.add("fg-view-img-preview--has-nav");
|
|
52
|
+
else wrapper.classList.add("fg-view-img-preview--hide-nav");
|
|
53
|
+
}
|
|
54
|
+
function resetViewerOnce() {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = toolbarCtx.value) == null ? void 0 : _a.reset();
|
|
57
|
+
}
|
|
58
|
+
function scheduleResetOnce() {
|
|
59
|
+
if (resetTimer) clearTimeout(resetTimer);
|
|
60
|
+
nextTick(() => {
|
|
61
|
+
syncViewerWrapperFlags();
|
|
62
|
+
resetViewerOnce();
|
|
63
|
+
});
|
|
64
|
+
resetTimer = setTimeout(() => {
|
|
65
|
+
syncViewerWrapperFlags();
|
|
66
|
+
resetViewerOnce();
|
|
67
|
+
}, 50);
|
|
68
|
+
}
|
|
69
|
+
function centerBrokenViewerImage() {
|
|
70
|
+
const img = document.querySelector(".el-image-viewer__wrapper .el-image-viewer__img");
|
|
71
|
+
if (!img || !img.complete) return;
|
|
72
|
+
const broken = img.naturalWidth === 0 || img.naturalHeight === 0;
|
|
73
|
+
if (!broken) return;
|
|
74
|
+
img.classList.add("fg-view-img-preview__img--broken");
|
|
75
|
+
img.style.left = "50%";
|
|
76
|
+
img.style.top = "50%";
|
|
77
|
+
img.style.transform = "translate(-50%, -50%) scale(1)";
|
|
78
|
+
}
|
|
79
|
+
function clearBrokenViewerImageStyles() {
|
|
80
|
+
const img = document.querySelector(".el-image-viewer__wrapper .el-image-viewer__img");
|
|
81
|
+
if (!img) return;
|
|
82
|
+
img.classList.remove("fg-view-img-preview__img--broken");
|
|
83
|
+
img.style.removeProperty("left");
|
|
84
|
+
img.style.removeProperty("top");
|
|
85
|
+
img.style.removeProperty("transform");
|
|
86
|
+
}
|
|
87
|
+
function bindViewerImageEvents() {
|
|
88
|
+
const img = document.querySelector(".el-image-viewer__wrapper .el-image-viewer__img");
|
|
89
|
+
if (!img) return;
|
|
90
|
+
const onLoad = () => {
|
|
91
|
+
nextTick(() => {
|
|
92
|
+
clearBrokenViewerImageStyles();
|
|
93
|
+
scheduleResetOnce();
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const onError = () => {
|
|
97
|
+
nextTick(centerBrokenViewerImage);
|
|
98
|
+
};
|
|
99
|
+
if (img.complete) {
|
|
100
|
+
if (img.naturalWidth === 0 || img.naturalHeight === 0) onError();
|
|
101
|
+
else onLoad();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
img.addEventListener("load", onLoad, { once: true });
|
|
105
|
+
img.addEventListener("error", onError, { once: true });
|
|
106
|
+
}
|
|
107
|
+
function handleSwitch(index) {
|
|
108
|
+
emit("switch", index);
|
|
109
|
+
nextTick(() => {
|
|
110
|
+
syncViewerWrapperFlags();
|
|
111
|
+
clearBrokenViewerImageStyles();
|
|
112
|
+
bindViewerImageEvents();
|
|
113
|
+
scheduleResetOnce();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
watch(
|
|
117
|
+
() => props.visible,
|
|
118
|
+
(visible, wasVisible) => {
|
|
119
|
+
if (!visible) {
|
|
120
|
+
toolbarCtx.value = null;
|
|
121
|
+
if (resetTimer) clearTimeout(resetTimer);
|
|
122
|
+
syncViewerWrapperFlags();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (!wasVisible) {
|
|
126
|
+
emit("show", {
|
|
127
|
+
index: props.initialIndex,
|
|
128
|
+
urlList: [...props.urlList]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
nextTick(() => {
|
|
132
|
+
syncViewerWrapperFlags();
|
|
133
|
+
bindViewerImageEvents();
|
|
134
|
+
scheduleResetOnce();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
const NAV_TOOLBAR_KEYS = ["prev", "next", "fistImg", "lastImg"];
|
|
139
|
+
const showToolbar = computed(
|
|
140
|
+
() => props.originalToolbar.length > 0 || props.simpleExtraTools.length > 0 || !!props.renderExtraTools
|
|
141
|
+
);
|
|
142
|
+
const showSideNav = computed(
|
|
143
|
+
() => props.urlList.length > 1 && props.originalToolbar.some((key) => NAV_TOOLBAR_KEYS.includes(key))
|
|
144
|
+
);
|
|
145
|
+
watch(
|
|
146
|
+
[showToolbar, showSideNav, () => props.urlList.length],
|
|
147
|
+
() => {
|
|
148
|
+
if (props.visible) nextTick(syncViewerWrapperFlags);
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
const toolbarStyle = computed(() => ({
|
|
152
|
+
"--fg-view-img-toolbar-bg": props.toolbarBgColor,
|
|
153
|
+
"--fg-view-img-toolbar-color": props.toolbarIconColor
|
|
154
|
+
}));
|
|
155
|
+
const renderExtraToolsComponent = computed(() => {
|
|
156
|
+
if (!props.renderExtraTools) return null;
|
|
157
|
+
return {
|
|
158
|
+
render: () => props.renderExtraTools
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
const toolbarActions = {
|
|
162
|
+
prev: {
|
|
163
|
+
icon: Back,
|
|
164
|
+
title: "上一张",
|
|
165
|
+
handler: ({ prev }) => prev()
|
|
166
|
+
},
|
|
167
|
+
next: {
|
|
168
|
+
icon: Right,
|
|
169
|
+
title: "下一张",
|
|
170
|
+
handler: ({ next }) => next()
|
|
171
|
+
},
|
|
172
|
+
fistImg: {
|
|
173
|
+
icon: DArrowLeft,
|
|
174
|
+
title: "第一张",
|
|
175
|
+
handler: ({ setActiveItem }) => setActiveItem(0)
|
|
176
|
+
},
|
|
177
|
+
lastImg: {
|
|
178
|
+
icon: DArrowRight,
|
|
179
|
+
title: "最后一张",
|
|
180
|
+
handler: ({ setActiveItem }) => setActiveItem(Math.max(props.urlList.length - 1, 0))
|
|
181
|
+
},
|
|
182
|
+
zoomOut: {
|
|
183
|
+
icon: ZoomOut,
|
|
184
|
+
title: "缩小",
|
|
185
|
+
handler: ({ actions }) => actions("zoomOut")
|
|
186
|
+
},
|
|
187
|
+
zoomIn: {
|
|
188
|
+
icon: ZoomIn,
|
|
189
|
+
title: "放大",
|
|
190
|
+
handler: ({ actions }) => actions("zoomIn")
|
|
191
|
+
},
|
|
192
|
+
anticlockwise: {
|
|
193
|
+
icon: RefreshLeft,
|
|
194
|
+
title: "逆时针",
|
|
195
|
+
handler: ({ actions }) => actions("anticlockwise")
|
|
196
|
+
},
|
|
197
|
+
clockwise: {
|
|
198
|
+
icon: RefreshRight,
|
|
199
|
+
title: "顺时针",
|
|
200
|
+
handler: ({ actions }) => actions("clockwise")
|
|
201
|
+
},
|
|
202
|
+
reset: {
|
|
203
|
+
icon: Refresh,
|
|
204
|
+
title: "重置",
|
|
205
|
+
handler: ({ reset }) => reset()
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
function buildToolParams(toolbar) {
|
|
209
|
+
var _a;
|
|
210
|
+
return {
|
|
211
|
+
url: (_a = props.urlList[toolbar.activeIndex]) != null ? _a : "",
|
|
212
|
+
index: toolbar.activeIndex,
|
|
213
|
+
actions: toolbar.actions,
|
|
214
|
+
reset: toolbar.reset,
|
|
215
|
+
prev: toolbar.prev,
|
|
216
|
+
next: toolbar.next,
|
|
217
|
+
setActiveItem: toolbar.setActiveItem
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function handleSimpleToolClick(tool, toolbar) {
|
|
221
|
+
toolbarCtx.value = toolbar;
|
|
222
|
+
tool.handler(buildToolParams(toolbar));
|
|
223
|
+
}
|
|
224
|
+
function hasToolbarAction(toolKey) {
|
|
225
|
+
return !!toolbarActions[toolKey];
|
|
226
|
+
}
|
|
227
|
+
function getToolbarTitle(toolKey) {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
return (_b = (_a = toolbarActions[toolKey]) == null ? void 0 : _a.title) != null ? _b : "";
|
|
230
|
+
}
|
|
231
|
+
function getToolbarIcon(toolKey) {
|
|
232
|
+
var _a;
|
|
233
|
+
return (_a = toolbarActions[toolKey]) == null ? void 0 : _a.icon;
|
|
234
|
+
}
|
|
235
|
+
function runToolbarAction(toolKey, toolbar) {
|
|
236
|
+
var _a;
|
|
237
|
+
toolbarCtx.value = toolbar;
|
|
238
|
+
(_a = toolbarActions[toolKey]) == null ? void 0 : _a.handler(toolbar);
|
|
239
|
+
}
|
|
240
|
+
function handleClose() {
|
|
241
|
+
emit("close");
|
|
242
|
+
}
|
|
243
|
+
return (_ctx, _cache) => {
|
|
244
|
+
return __props.visible ? (openBlock(), createBlock(unref(ElImageViewer), {
|
|
245
|
+
key: 0,
|
|
246
|
+
"url-list": __props.urlList,
|
|
247
|
+
"initial-index": __props.initialIndex,
|
|
248
|
+
infinite: __props.infinite,
|
|
249
|
+
"z-index": __props.zIndex,
|
|
250
|
+
"hide-on-click-modal": __props.hideOnClickModal,
|
|
251
|
+
"close-on-press-escape": __props.closeOnPressEscape,
|
|
252
|
+
teleported: __props.teleported,
|
|
253
|
+
"zoom-rate": __props.zoomRate,
|
|
254
|
+
scale: __props.scale,
|
|
255
|
+
"min-scale": __props.minScale,
|
|
256
|
+
"max-scale": __props.maxScale,
|
|
257
|
+
"show-progress": __props.showProgress,
|
|
258
|
+
onClose: handleClose,
|
|
259
|
+
onSwitch: handleSwitch
|
|
260
|
+
}, {
|
|
261
|
+
toolbar: withCtx((toolbar) => [
|
|
262
|
+
createElementVNode("div", _hoisted_1, toDisplayString(captureToolbar(toolbar)), 1),
|
|
263
|
+
showToolbar.value ? (openBlock(), createElementBlock("div", {
|
|
264
|
+
key: 0,
|
|
265
|
+
class: "fg-view-img-preview__toolbar",
|
|
266
|
+
style: normalizeStyle(toolbarStyle.value)
|
|
267
|
+
}, [
|
|
268
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.originalToolbar, (toolKey) => {
|
|
269
|
+
return openBlock(), createElementBlock(Fragment, { key: toolKey }, [
|
|
270
|
+
hasToolbarAction(toolKey) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
271
|
+
key: 0,
|
|
272
|
+
class: "fg-view-img-preview__action",
|
|
273
|
+
title: getToolbarTitle(toolKey),
|
|
274
|
+
onClick: ($event) => runToolbarAction(toolKey, toolbar)
|
|
275
|
+
}, {
|
|
276
|
+
default: withCtx(() => [
|
|
277
|
+
(openBlock(), createBlock(resolveDynamicComponent(getToolbarIcon(toolKey))))
|
|
278
|
+
]),
|
|
279
|
+
_: 2
|
|
280
|
+
}, 1032, ["title", "onClick"])) : createCommentVNode("", true)
|
|
281
|
+
], 64);
|
|
282
|
+
}), 128)),
|
|
283
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.simpleExtraTools, (tool) => {
|
|
284
|
+
return openBlock(), createBlock(unref(ElIcon), {
|
|
285
|
+
key: tool.label,
|
|
286
|
+
class: "fg-view-img-preview__action",
|
|
287
|
+
title: tool.label,
|
|
288
|
+
onClick: ($event) => handleSimpleToolClick(tool, toolbar)
|
|
289
|
+
}, {
|
|
290
|
+
default: withCtx(() => [
|
|
291
|
+
(openBlock(), createBlock(resolveDynamicComponent(tool.icon)))
|
|
292
|
+
]),
|
|
293
|
+
_: 2
|
|
294
|
+
}, 1032, ["title", "onClick"]);
|
|
295
|
+
}), 128)),
|
|
296
|
+
__props.renderExtraTools ? (openBlock(), createBlock(resolveDynamicComponent(renderExtraToolsComponent.value), { key: 0 })) : createCommentVNode("", true)
|
|
297
|
+
], 4)) : createCommentVNode("", true)
|
|
298
|
+
]),
|
|
299
|
+
_: 1
|
|
300
|
+
}, 8, ["url-list", "initial-index", "infinite", "z-index", "hide-on-click-modal", "close-on-press-escape", "teleported", "zoom-rate", "scale", "min-scale", "max-scale", "show-progress"])) : createCommentVNode("", true);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
export {
|
|
305
|
+
_sfc_main as _
|
|
306
|
+
};
|
|
@@ -38,7 +38,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./_commonjsHelpers-DnzVkjQg.js";
|
|
41
|
-
import { c as commonjsRequire, r as requireCryptoBrowserify } from "./index-
|
|
41
|
+
import { c as commonjsRequire, r as requireCryptoBrowserify } from "./index-BtQgIf7F.js";
|
|
42
42
|
import { ElMessage } from "element-plus";
|
|
43
43
|
var cryptoJs$1 = { exports: {} };
|
|
44
44
|
var core$1 = { exports: {} };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
import { OriginalToolbarItem, SimpleCustomTool, PreviewShowPayload, ViewImgPreviewViewerOptions } from '../viewImgPreview/types';
|
|
3
|
+
export interface ShowImgViewerOptions extends ViewImgPreviewViewerOptions {
|
|
4
|
+
previewImgList?: string[];
|
|
5
|
+
defImgPreviewIndex?: number;
|
|
6
|
+
/** 兼容旧字段,等同 `toolbarBgColor` */
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
toolbarBgColor?: string;
|
|
9
|
+
toolbarIconColor?: string;
|
|
10
|
+
simpleExtraTools?: SimpleCustomTool[];
|
|
11
|
+
renderExtraTools?: VNode | null;
|
|
12
|
+
originalToolbar?: OriginalToolbarItem[];
|
|
13
|
+
/** 预览层打开时触发 */
|
|
14
|
+
onShow?: (payload: PreviewShowPayload) => void;
|
|
15
|
+
/** 预览层关闭时触发 */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
/** 预览切换图片时触发 */
|
|
18
|
+
onSwitch?: (index: number) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ImgViewerStoreInstance {
|
|
21
|
+
readonly hostActivated: boolean;
|
|
22
|
+
readonly showImgPreview: boolean;
|
|
23
|
+
readonly previewImgList: string[];
|
|
24
|
+
readonly defImgPreviewIndex: number;
|
|
25
|
+
readonly infinite: boolean;
|
|
26
|
+
readonly zIndex: number;
|
|
27
|
+
readonly toolbarBgColor: string;
|
|
28
|
+
readonly toolbarIconColor: string;
|
|
29
|
+
readonly hideOnClickModal: boolean;
|
|
30
|
+
readonly closeOnPressEscape: boolean;
|
|
31
|
+
readonly teleported: boolean;
|
|
32
|
+
readonly zoomRate: number;
|
|
33
|
+
readonly scale: number;
|
|
34
|
+
readonly minScale: number;
|
|
35
|
+
readonly maxScale: number;
|
|
36
|
+
readonly showProgress: boolean;
|
|
37
|
+
readonly simpleExtraTools: SimpleCustomTool[];
|
|
38
|
+
readonly renderExtraTools: VNode | null;
|
|
39
|
+
readonly originalToolbar: OriginalToolbarItem[];
|
|
40
|
+
showImgViewer: (options?: ShowImgViewerOptions) => void;
|
|
41
|
+
hideImgViewer: () => void;
|
|
42
|
+
setDefImgPreviewIndex: (defImgPreviewIndex: number) => void;
|
|
43
|
+
setInfinite: (bol: boolean) => void;
|
|
44
|
+
setZindex: (index: number) => void;
|
|
45
|
+
}
|
|
46
|
+
/** 获取图片预览全局 store(单例) */
|
|
47
|
+
export declare function useImgViewerStore(): ImgViewerStoreInstance;
|
|
48
|
+
/** Pinia 风格调用:`const imgViewerStore = ImgViewerStore()` */
|
|
49
|
+
export declare function ImgViewerStore(): ImgViewerStoreInstance;
|
|
50
|
+
/** 供 Host 组件订阅的 reactive 状态 */
|
|
51
|
+
export declare function useImgViewerState(): {
|
|
52
|
+
hostActivated: boolean;
|
|
53
|
+
showImgPreview: boolean;
|
|
54
|
+
previewImgList: string[];
|
|
55
|
+
defImgPreviewIndex: number;
|
|
56
|
+
infinite: boolean;
|
|
57
|
+
zIndex: number;
|
|
58
|
+
toolbarBgColor: string;
|
|
59
|
+
toolbarIconColor: string;
|
|
60
|
+
hideOnClickModal: boolean;
|
|
61
|
+
closeOnPressEscape: boolean;
|
|
62
|
+
teleported: boolean;
|
|
63
|
+
zoomRate: number;
|
|
64
|
+
scale: number;
|
|
65
|
+
minScale: number;
|
|
66
|
+
maxScale: number;
|
|
67
|
+
showProgress: boolean;
|
|
68
|
+
simpleExtraTools: {
|
|
69
|
+
[x: string]: unknown;
|
|
70
|
+
label: string;
|
|
71
|
+
icon: import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
72
|
+
new (...args: any[]): any;
|
|
73
|
+
__isFragment?: never;
|
|
74
|
+
__isTeleport?: never;
|
|
75
|
+
__isSuspense?: never;
|
|
76
|
+
} | {
|
|
77
|
+
[x: string]: any;
|
|
78
|
+
setup?: (this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
79
|
+
attrs: import('vue').Attrs;
|
|
80
|
+
slots: Readonly<{
|
|
81
|
+
[name: string]: import('vue').Slot<any>;
|
|
82
|
+
}>;
|
|
83
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
84
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
85
|
+
}) => any;
|
|
86
|
+
name?: string;
|
|
87
|
+
template?: string | object;
|
|
88
|
+
render?: Function;
|
|
89
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>>;
|
|
90
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>>;
|
|
91
|
+
inheritAttrs?: boolean;
|
|
92
|
+
emits?: any;
|
|
93
|
+
slots?: {};
|
|
94
|
+
expose?: string[];
|
|
95
|
+
serverPrefetch?: () => void | Promise<any>;
|
|
96
|
+
compilerOptions?: {
|
|
97
|
+
isCustomElement?: (tag: string) => boolean;
|
|
98
|
+
whitespace?: "preserve" | "condense";
|
|
99
|
+
comments?: boolean;
|
|
100
|
+
delimiters?: [string, string];
|
|
101
|
+
};
|
|
102
|
+
call?: (this: unknown, ...args: unknown[]) => never;
|
|
103
|
+
__isFragment?: never;
|
|
104
|
+
__isTeleport?: never;
|
|
105
|
+
__isSuspense?: never;
|
|
106
|
+
__defaults?: {};
|
|
107
|
+
compatConfig?: {
|
|
108
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning";
|
|
109
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning";
|
|
110
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning";
|
|
111
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning";
|
|
112
|
+
GLOBAL_SET?: boolean | "suppress-warning";
|
|
113
|
+
GLOBAL_DELETE?: boolean | "suppress-warning";
|
|
114
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning";
|
|
115
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning";
|
|
116
|
+
CONFIG_SILENT?: boolean | "suppress-warning";
|
|
117
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning";
|
|
118
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning";
|
|
119
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning";
|
|
120
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning";
|
|
121
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning";
|
|
122
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning";
|
|
123
|
+
INSTANCE_SET?: boolean | "suppress-warning";
|
|
124
|
+
INSTANCE_DELETE?: boolean | "suppress-warning";
|
|
125
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning";
|
|
126
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning";
|
|
127
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning";
|
|
128
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning";
|
|
129
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning";
|
|
130
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning";
|
|
131
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning";
|
|
132
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning";
|
|
133
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning";
|
|
134
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning";
|
|
135
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning";
|
|
136
|
+
WATCH_ARRAY?: boolean | "suppress-warning";
|
|
137
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning";
|
|
138
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning";
|
|
139
|
+
CUSTOM_DIR?: boolean | "suppress-warning";
|
|
140
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning";
|
|
141
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning";
|
|
142
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning";
|
|
143
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning";
|
|
144
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning";
|
|
145
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning";
|
|
146
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning";
|
|
147
|
+
RENDER_FUNCTION?: boolean | "suppress-warning";
|
|
148
|
+
FILTERS?: boolean | "suppress-warning";
|
|
149
|
+
PRIVATE_APIS?: boolean | "suppress-warning";
|
|
150
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3);
|
|
151
|
+
};
|
|
152
|
+
data?: (this: any, vm: any) => any;
|
|
153
|
+
computed?: import('vue').ComputedOptions;
|
|
154
|
+
methods?: import('vue').MethodOptions;
|
|
155
|
+
watch?: {
|
|
156
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
157
|
+
handler: import('vue').WatchCallback | string;
|
|
158
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
159
|
+
handler: import('vue').WatchCallback | string;
|
|
160
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
161
|
+
};
|
|
162
|
+
provide?: import('vue').ComponentProvideOptions;
|
|
163
|
+
inject?: {} | string[];
|
|
164
|
+
filters?: Record<string, Function>;
|
|
165
|
+
mixins?: any[];
|
|
166
|
+
extends?: any;
|
|
167
|
+
beforeCreate?: () => any;
|
|
168
|
+
created?: () => any;
|
|
169
|
+
beforeMount?: () => any;
|
|
170
|
+
mounted?: () => any;
|
|
171
|
+
beforeUpdate?: () => any;
|
|
172
|
+
updated?: () => any;
|
|
173
|
+
activated?: () => any;
|
|
174
|
+
deactivated?: () => any;
|
|
175
|
+
beforeDestroy?: () => any;
|
|
176
|
+
beforeUnmount?: () => any;
|
|
177
|
+
destroyed?: () => any;
|
|
178
|
+
unmounted?: () => any;
|
|
179
|
+
renderTracked?: (e: import('vue').DebuggerEvent) => void;
|
|
180
|
+
renderTriggered?: (e: import('vue').DebuggerEvent) => void;
|
|
181
|
+
errorCaptured?: (err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void;
|
|
182
|
+
delimiters?: [string, string];
|
|
183
|
+
__differentiator?: string | number | symbol;
|
|
184
|
+
__isBuiltIn?: boolean;
|
|
185
|
+
__file?: string;
|
|
186
|
+
__name?: string;
|
|
187
|
+
};
|
|
188
|
+
handler: (params: import('..').ToolHandlerParams) => void;
|
|
189
|
+
}[];
|
|
190
|
+
renderExtraTools: VNode | null;
|
|
191
|
+
originalToolbar: OriginalToolbarItem[];
|
|
192
|
+
onShow: ((payload: PreviewShowPayload) => void) | null;
|
|
193
|
+
onClose: (() => void) | null;
|
|
194
|
+
onSwitch: ((index: number) => void) | null;
|
|
195
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as FgImgViewerHost } from './ImgViewerHost.vue';
|
|
2
|
+
export { ImgViewerStore, useImgViewerStore, useImgViewerState } from './imgViewerStore';
|
|
3
|
+
export type { ImgViewerStoreInstance, ShowImgViewerOptions } from './imgViewerStore';
|
|
4
|
+
export { getDialogZindex, PREVIEW_BASE_Z_INDEX } from './utils';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { _ } from "../../ImgViewerHost.vue_vue_type_script_setup_true_lang-CMoh7eWo.js";
|
|
2
|
+
import { I, P, g, u, a } from "../../imgViewerStore-C5n16uYa.js";
|
|
3
|
+
export {
|
|
4
|
+
_ as FgImgViewerHost,
|
|
5
|
+
I as ImgViewerStore,
|
|
6
|
+
P as PREVIEW_BASE_Z_INDEX,
|
|
7
|
+
g as getDialogZindex,
|
|
8
|
+
u as useImgViewerState,
|
|
9
|
+
a as useImgViewerStore
|
|
10
|
+
};
|