fangguo-component 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{FgCascader.vue_vue_type_style_index_0_lang-Bm4HR37D.js → FgCascader.vue_vue_type_style_index_0_lang-CstlYwHs.js} +1 -1
- package/dist/{ImgViewerHost.vue_vue_type_script_setup_true_lang-CMoh7eWo.js → ImgViewerHost.vue_vue_type_script_setup_true_lang-DBs42WOq.js} +4 -3
- package/dist/{ViewImg-Bg1AQ0T6.js → ViewImg-DXhF20SL.js} +14 -7
- package/dist/ViewImg.css +9 -9
- package/dist/ViewImgPopover-QblZG0z5.js +343 -0
- package/dist/ViewImgPopover.css +79 -6
- package/dist/ViewImgPreview.css +32 -0
- package/dist/{ViewImgPreview.vue_vue_type_style_index_0_lang-CYuLovBR.js → ViewImgPreview.vue_vue_type_style_index_0_lang-C2i0p5IK.js} +19 -9
- package/dist/components/cascader/index.js +1 -1
- package/dist/components/imgViewerHost/imgViewerStore.d.ts +5 -1
- package/dist/components/imgViewerHost/index.js +2 -2
- package/dist/components/index.js +15 -11
- package/dist/components/viewImg/ViewImg.vue.d.ts +9 -1
- package/dist/components/viewImg/index.js +1 -1
- package/dist/components/viewImgPopover/ViewImgPopover.vue.d.ts +25 -4
- package/dist/components/viewImgPopover/index.js +1 -1
- package/dist/components/viewImgPreview/ViewImgPreview.vue.d.ts +4 -1
- package/dist/components/viewImgPreview/index.d.ts +2 -2
- package/dist/components/viewImgPreview/index.js +11 -7
- package/dist/components/viewImgPreview/types.d.ts +15 -0
- package/dist/{imgViewerStore-C5n16uYa.js → imgViewerStore-DK3zvGf4.js} +7 -1
- package/dist/{index-CckJZ8N-.js → index-Ce_edAQB.js} +11 -7
- package/dist/index.js +25 -21
- package/dist/types-Ccn_sb6f.js +49 -0
- package/package.json +1 -1
- package/dist/ViewImgPopover-b9PDEYbP.js +0 -275
- package/dist/types-BNFeGRer.js +0 -32
|
@@ -56,7 +56,7 @@ import { fromPairs, isEqual, flattenDeep, cloneDeep, debounce } from "lodash-uni
|
|
|
56
56
|
import { ArrowRight, Loading, Check, CircleClose, ArrowDown } from "@element-plus/icons-vue";
|
|
57
57
|
import { useNamespace, ElIcon, ElRadio, ElCheckbox, ElScrollbar, useLocale, UPDATE_MODEL_EVENT, CHANGE_EVENT, EVENT_CODE, tagProps, useTooltipContentProps, CommonProps as CommonProps$1, useSizeProp, useFormItem, useFormSize, ElConfigProvider, ElTooltip, ElInput, ElTag, ClickOutside } from "element-plus";
|
|
58
58
|
import { ElCheckbox as ElCheckbox$1, ElRadio as ElRadio$1, ElIcon as ElIcon$1 } from "element-plus/es";
|
|
59
|
-
import { F as FgViewImg } from "./ViewImg-
|
|
59
|
+
import { F as FgViewImg } from "./ViewImg-DXhF20SL.js";
|
|
60
60
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
61
61
|
import { b as script$2 } from "./vue-virtual-scroller.esm-ZgBoGAjX.js";
|
|
62
62
|
!!(process$1.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref } from "vue";
|
|
2
|
-
import { _ as _sfc_main$1 } from "./ViewImgPreview.vue_vue_type_style_index_0_lang-
|
|
3
|
-
import { u as useImgViewerState, I as ImgViewerStore } from "./imgViewerStore-
|
|
2
|
+
import { _ as _sfc_main$1 } from "./ViewImgPreview.vue_vue_type_style_index_0_lang-C2i0p5IK.js";
|
|
3
|
+
import { u as useImgViewerState, I as ImgViewerStore } from "./imgViewerStore-DK3zvGf4.js";
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
__name: "ImgViewerHost",
|
|
6
6
|
setup(__props) {
|
|
@@ -40,10 +40,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
40
|
"simple-extra-tools": unref(state).simpleExtraTools,
|
|
41
41
|
"render-extra-tools": unref(state).renderExtraTools,
|
|
42
42
|
"original-toolbar": unref(state).originalToolbar,
|
|
43
|
+
"preview-side-nav": unref(state).previewSideNav,
|
|
43
44
|
onClose: handlePreviewClose,
|
|
44
45
|
onSwitch: handlePreviewSwitch,
|
|
45
46
|
onShow: handlePreviewShow
|
|
46
|
-
}, null, 8, ["visible", "url-list", "initial-index", "infinite", "z-index", "toolbar-bg-color", "toolbar-icon-color", "hide-on-click-modal", "close-on-press-escape", "teleported", "zoom-rate", "scale", "min-scale", "max-scale", "show-progress", "simple-extra-tools", "render-extra-tools", "original-toolbar"]);
|
|
47
|
+
}, null, 8, ["visible", "url-list", "initial-index", "infinite", "z-index", "toolbar-bg-color", "toolbar-icon-color", "hide-on-click-modal", "close-on-press-escape", "teleported", "zoom-rate", "scale", "min-scale", "max-scale", "show-progress", "simple-extra-tools", "render-extra-tools", "original-toolbar", "preview-side-nav"]);
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
});
|
|
@@ -30,8 +30,8 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import { defineComponent, useAttrs, ref, computed, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createElementVNode, mergeProps, vShow, renderSlot, createCommentVNode, createBlock, toDisplayString } from "vue";
|
|
33
|
-
import { I as ImgViewerStore } from "./imgViewerStore-
|
|
34
|
-
import { D as DEFAULT_ORIGINAL_TOOLBAR,
|
|
33
|
+
import { I as ImgViewerStore } from "./imgViewerStore-DK3zvGf4.js";
|
|
34
|
+
import { h as DEFAULT_PREVIEW_SIDE_NAV, D as DEFAULT_ORIGINAL_TOOLBAR, l as DEFAULT_TOOLBAR_ICON_COLOR, k as DEFAULT_TOOLBAR_BG_COLOR, g as DEFAULT_PREVIEW_SHOW_PROGRESS, d as DEFAULT_PREVIEW_MAX_SCALE, e as DEFAULT_PREVIEW_MIN_SCALE, f as DEFAULT_PREVIEW_SCALE, j as DEFAULT_PREVIEW_ZOOM_RATE, a as DEFAULT_PREVIEW_CLOSE_ON_PRESS_ESCAPE, b as DEFAULT_PREVIEW_HIDE_ON_CLICK_MODAL, c as DEFAULT_PREVIEW_INFINITE, i as DEFAULT_PREVIEW_TELEPORTED } from "./types-Ccn_sb6f.js";
|
|
35
35
|
import { n as networkKey, i as imgUrlConfigKey, m as montageImgUrl } from "./montageImgUrl-CwgYnB2h.js";
|
|
36
36
|
import { F as FgErrorImage } from "./ErrorImage-CFVt1ht_.js";
|
|
37
37
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
@@ -85,7 +85,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
85
85
|
ossProcess: { type: Boolean, default: true },
|
|
86
86
|
ossLinks: { default: void 0 },
|
|
87
87
|
imgSize: { default: () => ({}) },
|
|
88
|
-
previewStripQuery: { type: Boolean, default: true }
|
|
88
|
+
previewStripQuery: { type: Boolean, default: true },
|
|
89
|
+
previewSideNav: { type: [Boolean, String], default: DEFAULT_PREVIEW_SIDE_NAV }
|
|
89
90
|
},
|
|
90
91
|
emits: ["load", "error", "retry", "show", "close", "switch"],
|
|
91
92
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -169,8 +170,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
169
170
|
displaySrc.value = stripped;
|
|
170
171
|
emit("retry", { from: urlBefore, to: stripped });
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
-
if (!
|
|
173
|
+
function openPreview() {
|
|
174
|
+
if (!previewUrlList.value.length) return;
|
|
174
175
|
ImgViewerStore().showImgViewer({
|
|
175
176
|
previewImgList: previewUrlList.value,
|
|
176
177
|
defImgPreviewIndex: previewInitialIndex.value,
|
|
@@ -189,11 +190,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
189
190
|
simpleExtraTools: props.simpleExtraTools,
|
|
190
191
|
renderExtraTools: props.renderExtraTools,
|
|
191
192
|
originalToolbar: props.originalToolbar,
|
|
193
|
+
previewSideNav: props.previewSideNav,
|
|
192
194
|
onShow: (payload) => emit("show", payload),
|
|
193
195
|
onClose: () => emit("close"),
|
|
194
196
|
onSwitch: (index) => emit("switch", index)
|
|
195
197
|
});
|
|
196
198
|
}
|
|
199
|
+
function handlePreviewClick() {
|
|
200
|
+
if (!previewEnabled.value) return;
|
|
201
|
+
openPreview();
|
|
202
|
+
}
|
|
197
203
|
watch(
|
|
198
204
|
[() => props.src, () => props.ossProcess, () => props.ossLinks, () => props.imgSize, networkKey, imgUrlConfigKey],
|
|
199
205
|
([src]) => {
|
|
@@ -203,7 +209,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
203
209
|
);
|
|
204
210
|
__expose({
|
|
205
211
|
displaySrc,
|
|
206
|
-
retried
|
|
212
|
+
retried,
|
|
213
|
+
openPreview
|
|
207
214
|
});
|
|
208
215
|
return (_ctx, _cache) => {
|
|
209
216
|
return openBlock(), createElementBlock("span", {
|
|
@@ -241,7 +248,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
241
248
|
};
|
|
242
249
|
}
|
|
243
250
|
}));
|
|
244
|
-
const FgViewImg = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
251
|
+
const FgViewImg = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c6ff5d38"]]);
|
|
245
252
|
export {
|
|
246
253
|
FgViewImg as F
|
|
247
254
|
};
|
package/dist/ViewImg.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.fg-view-img[data-v-
|
|
1
|
+
.fg-view-img[data-v-c6ff5d38] {
|
|
2
2
|
display: block;
|
|
3
3
|
position: relative;
|
|
4
4
|
overflow: hidden;
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
vertical-align: top;
|
|
8
8
|
line-height: 0;
|
|
9
9
|
}
|
|
10
|
-
.fg-view-img__inner[data-v-
|
|
10
|
+
.fg-view-img__inner[data-v-c6ff5d38] {
|
|
11
11
|
display: block;
|
|
12
12
|
width: 100%;
|
|
13
13
|
height: 100%;
|
|
14
14
|
}
|
|
15
|
-
.fg-view-img__inner--preview[data-v-
|
|
15
|
+
.fg-view-img__inner--preview[data-v-c6ff5d38] {
|
|
16
16
|
cursor: zoom-in;
|
|
17
17
|
}
|
|
18
|
-
.fg-view-img__placeholder[data-v-
|
|
19
|
-
.fg-view-img__error[data-v-
|
|
18
|
+
.fg-view-img__placeholder[data-v-c6ff5d38],
|
|
19
|
+
.fg-view-img__error[data-v-c6ff5d38] {
|
|
20
20
|
position: absolute;
|
|
21
21
|
inset: 0;
|
|
22
22
|
display: flex;
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
justify-content: center;
|
|
25
25
|
background: #f5f7fa;
|
|
26
26
|
}
|
|
27
|
-
.fg-view-img__error[data-v-
|
|
27
|
+
.fg-view-img__error[data-v-c6ff5d38] .error-image {
|
|
28
28
|
width: 100%;
|
|
29
29
|
height: 100%;
|
|
30
30
|
}
|
|
31
|
-
.fg-view-img__error-default[data-v-
|
|
31
|
+
.fg-view-img__error-default[data-v-c6ff5d38] {
|
|
32
32
|
position: relative;
|
|
33
33
|
width: 100%;
|
|
34
34
|
height: 100%;
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
padding: 8px;
|
|
41
41
|
box-sizing: border-box;
|
|
42
42
|
}
|
|
43
|
-
.fg-view-img__error-icon[data-v-
|
|
43
|
+
.fg-view-img__error-icon[data-v-c6ff5d38] {
|
|
44
44
|
flex: none;
|
|
45
45
|
width: 56%;
|
|
46
46
|
height: 56%;
|
|
47
47
|
max-width: 80px;
|
|
48
48
|
max-height: 80px;
|
|
49
49
|
}
|
|
50
|
-
.fg-view-img__error-text[data-v-
|
|
50
|
+
.fg-view-img__error-text[data-v-c6ff5d38] {
|
|
51
51
|
font-size: 13px;
|
|
52
52
|
line-height: 1.4;
|
|
53
53
|
color: #909399;
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import './ViewImgPopover.css';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { ElWatermark, ElIcon } from "element-plus/es";
|
|
33
|
+
import { defineComponent, useAttrs, ref, computed, watch, openBlock, createElementBlock, createVNode, withCtx, Fragment, normalizeStyle, renderSlot, toDisplayString, createBlock, createElementVNode, createSlots, createCommentVNode, mergeProps, unref, withModifiers } from "vue";
|
|
34
|
+
import { CirclePlus } from "@element-plus/icons-vue";
|
|
35
|
+
import { L as LazyPopover } from "./LazyPopover-7ebuh-QG.js";
|
|
36
|
+
import { F as FgViewImg } from "./ViewImg-DXhF20SL.js";
|
|
37
|
+
import { m as montageImgUrl } from "./montageImgUrl-CwgYnB2h.js";
|
|
38
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
39
|
+
const _hoisted_1 = { class: "fg-view-img-popover__reference" };
|
|
40
|
+
const _hoisted_2 = {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "fg-view-img-popover__hover-error-text"
|
|
43
|
+
};
|
|
44
|
+
const _hoisted_3 = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "fg-view-img-popover__hover-error-text"
|
|
47
|
+
};
|
|
48
|
+
const HOVER_POPOVER_PADDING = 10;
|
|
49
|
+
const HOVER_POPOVER_MAX_HEIGHT = 400;
|
|
50
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
51
|
+
inheritAttrs: false
|
|
52
|
+
}), {
|
|
53
|
+
__name: "ViewImgPopover",
|
|
54
|
+
props: {
|
|
55
|
+
src: { default: "" },
|
|
56
|
+
fit: {},
|
|
57
|
+
lazy: { type: Boolean },
|
|
58
|
+
loading: { type: Boolean },
|
|
59
|
+
preview: { type: Boolean },
|
|
60
|
+
previewSrcList: {},
|
|
61
|
+
initialIndex: {},
|
|
62
|
+
defImgPreviewIndex: {},
|
|
63
|
+
infinite: { type: Boolean },
|
|
64
|
+
zIndex: {},
|
|
65
|
+
hideOnClickModal: { type: Boolean },
|
|
66
|
+
closeOnPressEscape: { type: Boolean },
|
|
67
|
+
previewTeleported: { type: Boolean },
|
|
68
|
+
teleported: { type: Boolean },
|
|
69
|
+
zoomRate: {},
|
|
70
|
+
scale: {},
|
|
71
|
+
minScale: {},
|
|
72
|
+
maxScale: {},
|
|
73
|
+
showProgress: { type: Boolean },
|
|
74
|
+
toolbarBgColor: {},
|
|
75
|
+
backgroundColor: {},
|
|
76
|
+
toolbarIconColor: {},
|
|
77
|
+
simpleExtraTools: {},
|
|
78
|
+
renderExtraTools: {},
|
|
79
|
+
originalToolbar: {},
|
|
80
|
+
errorColor: {},
|
|
81
|
+
errorOffset: {},
|
|
82
|
+
errorText: {},
|
|
83
|
+
ossProcess: { type: Boolean },
|
|
84
|
+
ossLinks: {},
|
|
85
|
+
imgSize: {},
|
|
86
|
+
previewStripQuery: { type: Boolean },
|
|
87
|
+
hoverSrc: { default: "" },
|
|
88
|
+
hoverImgSize: { default: void 0 },
|
|
89
|
+
hoverPopoverProps: { default: () => ({}) },
|
|
90
|
+
isShowWatermark: { type: Boolean, default: false },
|
|
91
|
+
waterMarkTitle: { default: "" },
|
|
92
|
+
showPreviewIcon: { type: Boolean, default: false }
|
|
93
|
+
},
|
|
94
|
+
emits: ["load", "error", "retry", "show", "close", "switch"],
|
|
95
|
+
setup(__props, { emit: __emit }) {
|
|
96
|
+
const props = __props;
|
|
97
|
+
const emit = __emit;
|
|
98
|
+
const attrs = useAttrs();
|
|
99
|
+
const viewImgRef = ref(null);
|
|
100
|
+
const referenceLoadError = ref(false);
|
|
101
|
+
const viewImgProps = computed(() => {
|
|
102
|
+
const _a = props, {
|
|
103
|
+
hoverSrc: _h,
|
|
104
|
+
hoverImgSize: _hi,
|
|
105
|
+
hoverPopoverProps: _hp,
|
|
106
|
+
isShowWatermark: _w,
|
|
107
|
+
waterMarkTitle: _wt,
|
|
108
|
+
showPreviewIcon: _spi
|
|
109
|
+
} = _a, rest = __objRest(_a, [
|
|
110
|
+
"hoverSrc",
|
|
111
|
+
"hoverImgSize",
|
|
112
|
+
"hoverPopoverProps",
|
|
113
|
+
"isShowWatermark",
|
|
114
|
+
"waterMarkTitle",
|
|
115
|
+
"showPreviewIcon"
|
|
116
|
+
]);
|
|
117
|
+
return rest;
|
|
118
|
+
});
|
|
119
|
+
function handlePreviewIconClick() {
|
|
120
|
+
var _a;
|
|
121
|
+
(_a = viewImgRef.value) == null ? void 0 : _a.openPreview();
|
|
122
|
+
}
|
|
123
|
+
function mergePopperStyle(base, extra) {
|
|
124
|
+
if (!extra) return base;
|
|
125
|
+
if (typeof extra === "string") return extra;
|
|
126
|
+
return __spreadValues(__spreadValues({}, base), extra);
|
|
127
|
+
}
|
|
128
|
+
const HOVER_POPOVER_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT}px`;
|
|
129
|
+
const HOVER_IMAGE_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT - HOVER_POPOVER_PADDING * 2}px`;
|
|
130
|
+
const hoverPopoverPropsMerged = computed(() => {
|
|
131
|
+
var _a;
|
|
132
|
+
const _b = (_a = props.hoverPopoverProps) != null ? _a : {}, { popperStyle: userPopperStyle, popperClass: userPopperClass } = _b, restHoverPopoverProps = __objRest(_b, ["popperStyle", "popperClass"]);
|
|
133
|
+
const popperClass = [userPopperClass, "fg-view-img-popover"].filter(Boolean).join(" ");
|
|
134
|
+
return __spreadValues({
|
|
135
|
+
placement: "right",
|
|
136
|
+
trigger: "hover",
|
|
137
|
+
width: 400,
|
|
138
|
+
teleported: true,
|
|
139
|
+
popperClass,
|
|
140
|
+
popperStyle: mergePopperStyle(
|
|
141
|
+
{
|
|
142
|
+
maxHeight: HOVER_POPOVER_MAX_HEIGHT_CSS,
|
|
143
|
+
overflow: "hidden",
|
|
144
|
+
padding: `${HOVER_POPOVER_PADDING}px`,
|
|
145
|
+
boxSizing: "border-box"
|
|
146
|
+
},
|
|
147
|
+
userPopperStyle
|
|
148
|
+
)
|
|
149
|
+
}, restHoverPopoverProps);
|
|
150
|
+
});
|
|
151
|
+
function stripQueryParams(url) {
|
|
152
|
+
const index = url.indexOf("?");
|
|
153
|
+
return index === -1 ? url : url.slice(0, index);
|
|
154
|
+
}
|
|
155
|
+
function resolveImgUrl(url, imgSize) {
|
|
156
|
+
if (!props.ossProcess) return url;
|
|
157
|
+
return montageImgUrl(url, imgSize, props.ossLinks ? { ossLinks: props.ossLinks } : void 0);
|
|
158
|
+
}
|
|
159
|
+
function applyPreviewUrlFallback(url) {
|
|
160
|
+
if (!props.previewStripQuery || !url) return url;
|
|
161
|
+
return stripQueryParams(url);
|
|
162
|
+
}
|
|
163
|
+
function resolvePreviewImgUrl(url, imgSize) {
|
|
164
|
+
return applyPreviewUrlFallback(resolveImgUrl(url, imgSize));
|
|
165
|
+
}
|
|
166
|
+
function handleReferenceLoad(event) {
|
|
167
|
+
referenceLoadError.value = false;
|
|
168
|
+
emit("load", event);
|
|
169
|
+
}
|
|
170
|
+
function handleReferenceError(event) {
|
|
171
|
+
referenceLoadError.value = true;
|
|
172
|
+
emit("error", event);
|
|
173
|
+
}
|
|
174
|
+
function handleReferenceRetry(payload) {
|
|
175
|
+
referenceLoadError.value = false;
|
|
176
|
+
emit("retry", payload);
|
|
177
|
+
}
|
|
178
|
+
watch(
|
|
179
|
+
() => props.src,
|
|
180
|
+
() => {
|
|
181
|
+
referenceLoadError.value = false;
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
function resolveViewImgDisplaySrc() {
|
|
185
|
+
var _a;
|
|
186
|
+
const fromRef = (_a = viewImgRef.value) == null ? void 0 : _a.displaySrc;
|
|
187
|
+
if (fromRef) return fromRef;
|
|
188
|
+
if (!props.src) return "";
|
|
189
|
+
return resolveImgUrl(props.src, props.imgSize);
|
|
190
|
+
}
|
|
191
|
+
const hoverPreviewSrc = computed(() => {
|
|
192
|
+
var _a, _b, _c;
|
|
193
|
+
const displaySrc = resolveViewImgDisplaySrc();
|
|
194
|
+
const retried = (_b = (_a = viewImgRef.value) == null ? void 0 : _a.retried) != null ? _b : false;
|
|
195
|
+
if (props.hoverSrc) {
|
|
196
|
+
return resolvePreviewImgUrl(props.hoverSrc, (_c = props.hoverImgSize) != null ? _c : props.imgSize);
|
|
197
|
+
}
|
|
198
|
+
if (!props.src) return displaySrc || "";
|
|
199
|
+
if (!props.hoverImgSize) return displaySrc || "";
|
|
200
|
+
let url = resolveImgUrl(props.src, props.hoverImgSize);
|
|
201
|
+
if (retried) url = stripQueryParams(url);
|
|
202
|
+
return applyPreviewUrlFallback(url);
|
|
203
|
+
});
|
|
204
|
+
const hoverImgStyle = computed(() => ({
|
|
205
|
+
width: "100%",
|
|
206
|
+
height: HOVER_IMAGE_MAX_HEIGHT_CSS
|
|
207
|
+
}));
|
|
208
|
+
return (_ctx, _cache) => {
|
|
209
|
+
const _component_el_watermark = ElWatermark;
|
|
210
|
+
const _component_el_icon = ElIcon;
|
|
211
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
212
|
+
createVNode(LazyPopover, {
|
|
213
|
+
class: "fg-view-img-popover__trigger",
|
|
214
|
+
props: hoverPopoverPropsMerged.value
|
|
215
|
+
}, {
|
|
216
|
+
reference: withCtx(() => [
|
|
217
|
+
createVNode(FgViewImg, mergeProps({
|
|
218
|
+
ref_key: "viewImgRef",
|
|
219
|
+
ref: viewImgRef,
|
|
220
|
+
class: unref(attrs).class,
|
|
221
|
+
style: unref(attrs).style
|
|
222
|
+
}, viewImgProps.value, {
|
|
223
|
+
onLoad: handleReferenceLoad,
|
|
224
|
+
onError: handleReferenceError,
|
|
225
|
+
onRetry: handleReferenceRetry,
|
|
226
|
+
onShow: _cache[0] || (_cache[0] = (p) => emit("show", p)),
|
|
227
|
+
onClose: _cache[1] || (_cache[1] = ($event) => emit("close")),
|
|
228
|
+
onSwitch: _cache[2] || (_cache[2] = (i) => emit("switch", i))
|
|
229
|
+
}), createSlots({ _: 2 }, [
|
|
230
|
+
_ctx.$slots.placeholder ? {
|
|
231
|
+
name: "placeholder",
|
|
232
|
+
fn: withCtx(() => [
|
|
233
|
+
renderSlot(_ctx.$slots, "placeholder", {}, void 0, true)
|
|
234
|
+
]),
|
|
235
|
+
key: "0"
|
|
236
|
+
} : void 0,
|
|
237
|
+
_ctx.$slots.error ? {
|
|
238
|
+
name: "error",
|
|
239
|
+
fn: withCtx(() => [
|
|
240
|
+
renderSlot(_ctx.$slots, "error", {}, void 0, true)
|
|
241
|
+
]),
|
|
242
|
+
key: "1"
|
|
243
|
+
} : void 0
|
|
244
|
+
]), 1040, ["class", "style"])
|
|
245
|
+
]),
|
|
246
|
+
default: withCtx(() => [
|
|
247
|
+
hoverPreviewSrc.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
248
|
+
referenceLoadError.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
249
|
+
!__props.isShowWatermark ? (openBlock(), createElementBlock("div", {
|
|
250
|
+
key: 0,
|
|
251
|
+
class: "fg-view-img-popover__hover-image fg-view-img-popover__hover-error",
|
|
252
|
+
style: normalizeStyle(hoverImgStyle.value)
|
|
253
|
+
}, [
|
|
254
|
+
_ctx.$slots.error ? renderSlot(_ctx.$slots, "error", { key: 0 }, void 0, true) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.errorText || "加载失败"), 1))
|
|
255
|
+
], 4)) : (openBlock(), createBlock(_component_el_watermark, {
|
|
256
|
+
key: 1,
|
|
257
|
+
class: "fg-view-img-popover__watermark",
|
|
258
|
+
content: [__props.waterMarkTitle],
|
|
259
|
+
gap: [10, 10],
|
|
260
|
+
font: { fontSize: 16, color: "rgba(0, 0, 0, 0.3)" }
|
|
261
|
+
}, {
|
|
262
|
+
default: withCtx(() => [
|
|
263
|
+
createElementVNode("div", {
|
|
264
|
+
class: "fg-view-img-popover__hover-image fg-view-img-popover__hover-error",
|
|
265
|
+
style: normalizeStyle(hoverImgStyle.value)
|
|
266
|
+
}, [
|
|
267
|
+
_ctx.$slots.error ? renderSlot(_ctx.$slots, "error", { key: 0 }, void 0, true) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.errorText || "加载失败"), 1))
|
|
268
|
+
], 4)
|
|
269
|
+
]),
|
|
270
|
+
_: 3
|
|
271
|
+
}, 8, ["content"]))
|
|
272
|
+
], 64)) : !__props.isShowWatermark ? (openBlock(), createBlock(FgViewImg, {
|
|
273
|
+
key: 1,
|
|
274
|
+
class: "fg-view-img-popover__hover-image",
|
|
275
|
+
src: hoverPreviewSrc.value,
|
|
276
|
+
style: normalizeStyle(hoverImgStyle.value),
|
|
277
|
+
preview: false,
|
|
278
|
+
"oss-process": false,
|
|
279
|
+
"error-color": __props.errorColor,
|
|
280
|
+
"error-offset": __props.errorOffset,
|
|
281
|
+
"error-text": __props.errorText,
|
|
282
|
+
fit: "contain"
|
|
283
|
+
}, createSlots({ _: 2 }, [
|
|
284
|
+
_ctx.$slots.error ? {
|
|
285
|
+
name: "error",
|
|
286
|
+
fn: withCtx(() => [
|
|
287
|
+
renderSlot(_ctx.$slots, "error", {}, void 0, true)
|
|
288
|
+
]),
|
|
289
|
+
key: "0"
|
|
290
|
+
} : void 0
|
|
291
|
+
]), 1032, ["src", "style", "error-color", "error-offset", "error-text"])) : (openBlock(), createBlock(_component_el_watermark, {
|
|
292
|
+
key: 2,
|
|
293
|
+
class: "fg-view-img-popover__watermark",
|
|
294
|
+
content: [__props.waterMarkTitle],
|
|
295
|
+
gap: [10, 10],
|
|
296
|
+
font: { fontSize: 16, color: "rgba(0, 0, 0, 0.3)" }
|
|
297
|
+
}, {
|
|
298
|
+
default: withCtx(() => [
|
|
299
|
+
createVNode(FgViewImg, {
|
|
300
|
+
class: "fg-view-img-popover__hover-image",
|
|
301
|
+
src: hoverPreviewSrc.value,
|
|
302
|
+
style: normalizeStyle(hoverImgStyle.value),
|
|
303
|
+
preview: false,
|
|
304
|
+
"oss-process": false,
|
|
305
|
+
"error-color": __props.errorColor,
|
|
306
|
+
"error-offset": __props.errorOffset,
|
|
307
|
+
"error-text": __props.errorText,
|
|
308
|
+
fit: "contain"
|
|
309
|
+
}, createSlots({ _: 2 }, [
|
|
310
|
+
_ctx.$slots.error ? {
|
|
311
|
+
name: "error",
|
|
312
|
+
fn: withCtx(() => [
|
|
313
|
+
renderSlot(_ctx.$slots, "error", {}, void 0, true)
|
|
314
|
+
]),
|
|
315
|
+
key: "0"
|
|
316
|
+
} : void 0
|
|
317
|
+
]), 1032, ["src", "style", "error-color", "error-offset", "error-text"])
|
|
318
|
+
]),
|
|
319
|
+
_: 3
|
|
320
|
+
}, 8, ["content"]))
|
|
321
|
+
], 64)) : createCommentVNode("", true)
|
|
322
|
+
]),
|
|
323
|
+
_: 3
|
|
324
|
+
}, 8, ["props"]),
|
|
325
|
+
__props.showPreviewIcon ? (openBlock(), createBlock(_component_el_icon, {
|
|
326
|
+
key: 0,
|
|
327
|
+
class: "fg-view-img-popover__preview-icon",
|
|
328
|
+
size: 14,
|
|
329
|
+
onClick: withModifiers(handlePreviewIconClick, ["stop"])
|
|
330
|
+
}, {
|
|
331
|
+
default: withCtx(() => [
|
|
332
|
+
createVNode(unref(CirclePlus))
|
|
333
|
+
]),
|
|
334
|
+
_: 1
|
|
335
|
+
})) : createCommentVNode("", true)
|
|
336
|
+
]);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}));
|
|
340
|
+
const ViewImgPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-868c46fb"]]);
|
|
341
|
+
export {
|
|
342
|
+
ViewImgPopover as V
|
|
343
|
+
};
|
package/dist/ViewImgPopover.css
CHANGED
|
@@ -1,12 +1,74 @@
|
|
|
1
|
-
.fg-view-img-
|
|
1
|
+
.fg-view-img-popover__reference[data-v-868c46fb] {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
.fg-view-img-popover__preview-icon[data-v-868c46fb] {
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 4px;
|
|
10
|
+
right: 4px;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
color: var(--el-text-color-primary);
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
.fg-view-img-popover__preview-icon[data-v-868c46fb]:hover {
|
|
17
|
+
color: var(--el-color-primary);
|
|
18
|
+
}
|
|
19
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] {
|
|
20
|
+
display: block;
|
|
2
21
|
vertical-align: top;
|
|
22
|
+
background: #7f7f7f;
|
|
23
|
+
}
|
|
24
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] .fg-view-img__inner {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
object-fit: contain;
|
|
28
|
+
}
|
|
29
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] .fg-view-img__placeholder,
|
|
30
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] .fg-view-img__error {
|
|
31
|
+
position: absolute;
|
|
32
|
+
inset: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
background: #f5f7fa;
|
|
37
|
+
line-height: 1.4;
|
|
38
|
+
}
|
|
39
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] .fg-view-img__error-default {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
color: #909399;
|
|
46
|
+
font-size: 13px;
|
|
47
|
+
text-align: center;
|
|
3
48
|
}
|
|
4
|
-
.fg-view-img-popover__hover-image[data-v-
|
|
5
|
-
|
|
6
|
-
|
|
49
|
+
.fg-view-img-popover__hover-image[data-v-868c46fb] .fg-view-img__error-text {
|
|
50
|
+
color: #909399;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
line-height: 1.4;
|
|
53
|
+
text-align: center;
|
|
54
|
+
}
|
|
55
|
+
.fg-view-img-popover__hover-error[data-v-868c46fb] {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
width: 100%;
|
|
60
|
+
background: #f5f7fa;
|
|
61
|
+
color: #909399;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
line-height: 1.4;
|
|
64
|
+
text-align: center;
|
|
65
|
+
}.fg-view-img-popover__reference {
|
|
66
|
+
display: block;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
7
69
|
max-width: 100%;
|
|
8
|
-
|
|
9
|
-
|
|
70
|
+
}
|
|
71
|
+
.fg-view-img-popover__trigger {
|
|
10
72
|
display: block;
|
|
11
73
|
width: 100%;
|
|
12
74
|
height: 100%;
|
|
@@ -23,11 +85,22 @@
|
|
|
23
85
|
display: flex;
|
|
24
86
|
justify-content: center;
|
|
25
87
|
align-items: center;
|
|
88
|
+
width: 100%;
|
|
26
89
|
max-width: 100%;
|
|
90
|
+
max-height: 100%;
|
|
27
91
|
line-height: 0;
|
|
28
92
|
}
|
|
29
93
|
.fg-view-img-popover.el-popper .fg-view-img-popover__watermark {
|
|
30
94
|
display: block;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 380px;
|
|
31
97
|
max-width: 100%;
|
|
32
98
|
max-height: 380px;
|
|
99
|
+
}
|
|
100
|
+
.fg-view-img-popover.el-popper .fg-view-img-popover__watermark .el-watermark__content {
|
|
101
|
+
display: block;
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
max-width: 100%;
|
|
105
|
+
max-height: 100%;
|
|
33
106
|
}
|
package/dist/ViewImgPreview.css
CHANGED
|
@@ -22,6 +22,26 @@
|
|
|
22
22
|
opacity: 1 !important;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/* 仅展示左侧箭头 */
|
|
26
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__prev {
|
|
27
|
+
display: inline-flex !important;
|
|
28
|
+
visibility: visible !important;
|
|
29
|
+
opacity: 1 !important;
|
|
30
|
+
}
|
|
31
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__next {
|
|
32
|
+
display: none !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* 仅展示右侧箭头 */
|
|
36
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__next {
|
|
37
|
+
display: inline-flex !important;
|
|
38
|
+
visibility: visible !important;
|
|
39
|
+
opacity: 1 !important;
|
|
40
|
+
}
|
|
41
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__prev {
|
|
42
|
+
display: none !important;
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
/* 保证预览图在视口内居中适配(避免业务全局 img { width/height: 100% } 导致铺满) */
|
|
26
46
|
.el-image-viewer__wrapper .el-image-viewer__canvas {
|
|
27
47
|
display: flex;
|
|
@@ -38,16 +58,22 @@
|
|
|
38
58
|
|
|
39
59
|
/* 画布置于蒙层之上 */
|
|
40
60
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__mask,
|
|
61
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__mask,
|
|
62
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__mask,
|
|
41
63
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__mask,
|
|
42
64
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__mask {
|
|
43
65
|
z-index: 1;
|
|
44
66
|
}
|
|
45
67
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__canvas,
|
|
68
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__canvas,
|
|
69
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__canvas,
|
|
46
70
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__canvas,
|
|
47
71
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__canvas {
|
|
48
72
|
z-index: 2;
|
|
49
73
|
}
|
|
50
74
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__img,
|
|
75
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__img,
|
|
76
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__img,
|
|
51
77
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__img,
|
|
52
78
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__img {
|
|
53
79
|
z-index: 2;
|
|
@@ -55,6 +81,12 @@
|
|
|
55
81
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__btn,
|
|
56
82
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__close,
|
|
57
83
|
.el-image-viewer__wrapper.fg-view-img-preview--has-nav .el-image-viewer__actions,
|
|
84
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__btn,
|
|
85
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__close,
|
|
86
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-prev .el-image-viewer__actions,
|
|
87
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__btn,
|
|
88
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__close,
|
|
89
|
+
.el-image-viewer__wrapper.fg-view-img-preview--has-nav-next .el-image-viewer__actions,
|
|
58
90
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__btn,
|
|
59
91
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-nav .el-image-viewer__close,
|
|
60
92
|
.el-image-viewer__wrapper.fg-view-img-preview--hide-toolbar .el-image-viewer__btn,
|