fangguo-component 1.2.2 → 1.2.4
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/{ErrorImage-CFVt1ht_.js → ErrorImage-Ao9kEEUg.js} +2 -2
- package/dist/FgCascader.css +3 -11
- package/dist/{FgCascader.vue_vue_type_style_index_0_lang-CstlYwHs.js → FgCascader.vue_vue_type_style_index_0_lang-DzvTfHp4.js} +4 -13
- package/dist/{HSelect-DgFjd08Y.js → HSelect-0w2mSrtm.js} +1 -1
- package/dist/{HSelectAll.vue_vue_type_script_setup_true_lang-C6qzdQT-.js → HSelectAll.vue_vue_type_script_setup_true_lang-xHFbYs59.js} +1 -1
- package/dist/{HSelectSJ-DOFUzTZV.js → HSelectSJ-Cm573j6B.js} +1 -1
- package/dist/{ImgViewerHost.vue_vue_type_script_setup_true_lang-DBs42WOq.js → ImgViewerHost.vue_vue_type_script_setup_true_lang-DO9s-b9s.js} +42 -3
- package/dist/{LazyPopover-7ebuh-QG.js → LazyPopover-CcvilJ6U.js} +25 -3
- package/dist/LazyPopover.css +1 -1
- package/dist/{SelectTree-DUH92Iwr.js → SelectTree-BHvvkiQi.js} +1 -1
- package/dist/{ViewImg-DXhF20SL.js → ViewImg-CD4QJK4R.js} +137 -34
- package/dist/ViewImg.css +31 -35
- package/dist/ViewImgPopover-D-1b2nEa.js +497 -0
- package/dist/ViewImgPopover.css +35 -12
- 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 +7 -1
- package/dist/components/imgViewerHost/imgViewerAutoHost.d.ts +2 -0
- package/dist/components/imgViewerHost/imgViewerHostRegistry.d.ts +5 -0
- package/dist/components/imgViewerHost/index.js +2 -2
- package/dist/components/index.js +22 -18
- package/dist/components/lazyPopover/LazyPopover.vue.d.ts +2 -0
- package/dist/components/lazyPopover/index.js +1 -1
- package/dist/components/selectTree/index.js +1 -1
- package/dist/components/viewImg/ViewImg.vue.d.ts +32 -14
- package/dist/components/viewImg/ViewImgErrorFallback.vue.d.ts +14 -0
- package/dist/components/viewImg/defaults.d.ts +28 -0
- package/dist/components/viewImg/index.d.ts +3 -0
- package/dist/components/viewImg/index.js +6 -2
- package/dist/components/viewImgPopover/ViewImgPopover.vue.d.ts +158 -66
- package/dist/components/viewImgPopover/index.js +1 -1
- package/dist/components/viewImgPreview/ViewImgPreview.vue.d.ts +6 -6
- package/dist/imgViewerAutoHost-BQVVGop1.js +32 -0
- package/dist/{imgViewerStore-DK3zvGf4.js → imgViewerStore-Ajm-L7R5.js} +7 -0
- package/dist/{index-Ce_edAQB.js → index-CALlgLrT.js} +17 -13
- package/dist/{index-Qkq7I01c.js → index-rEz2pixF.js} +5 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +56 -48
- package/dist/montageImgUrl-DP5jMHCX.js +445 -0
- package/dist/tools/ImageParserUtils/index.d.ts +1 -1
- package/dist/tools/imgUrl/imageUrl.d.ts +209 -0
- package/dist/tools/imgUrl/index.d.ts +2 -0
- package/dist/tools/imgUrl/index.js +12 -8
- package/dist/tools/imgUrl/montageImgUrl.d.ts +11 -5
- package/dist/tools/index.js +17 -13
- package/package.json +1 -1
- package/dist/ViewImgPopover-QblZG0z5.js +0 -343
- package/dist/montageImgUrl-CwgYnB2h.js +0 -204
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { D, c, g, a,
|
|
1
|
+
import { D, b, c, g, a, d, e, f, i, h, j, m, n, k, r, l, t } from "../../montageImgUrl-DP5jMHCX.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEFAULT_IMG_FASTEN,
|
|
4
|
+
b as buildPlatformImageResizeUrl,
|
|
4
5
|
c as configureImgUrl,
|
|
5
|
-
g as
|
|
6
|
-
a as
|
|
7
|
-
|
|
6
|
+
g as getImageResizeRuleName,
|
|
7
|
+
a as getImgFasten,
|
|
8
|
+
d as getNetworkAdaptiveOptions,
|
|
9
|
+
e as getOssLinks,
|
|
10
|
+
f as getPlatformOriginalImageUrl,
|
|
8
11
|
i as imgUrlConfigKey,
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
h as initNetworkListener,
|
|
13
|
+
j as isUnsupportedImg,
|
|
11
14
|
m as montageImgUrl,
|
|
12
15
|
n as networkKey,
|
|
13
|
-
|
|
14
|
-
r as
|
|
16
|
+
k as notSupportedImgTypes,
|
|
17
|
+
r as removeImageUrlQuery,
|
|
18
|
+
l as replaceUnsupportedImg,
|
|
15
19
|
t as temuThumbUrl
|
|
16
20
|
};
|
|
@@ -4,12 +4,18 @@ export declare const notSupportedImgTypes: string[];
|
|
|
4
4
|
export declare function isUnsupportedImg(url: string): boolean;
|
|
5
5
|
/** 命中不支持格式时返回占位图,否则返回原 url */
|
|
6
6
|
export declare function replaceUnsupportedImg(url?: string): string;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* TEMU 平台缩略图。
|
|
9
|
+
* 统一走 imageView2(与 buildTemuImageResizeUrl 一致),会清掉原有 query(含非法双 ?)。
|
|
10
|
+
*/
|
|
8
11
|
export declare function temuThumbUrl(url: string, imgSize?: ImgSizeOptions): string;
|
|
9
12
|
/**
|
|
10
|
-
* 拼接图片 url
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* 拼接图片 url(占位图 / 各平台 resize 规则)
|
|
14
|
+
*
|
|
15
|
+
* - 空图、不支持格式 → 占位图
|
|
16
|
+
* - oss → 网络自适应后再拼接
|
|
17
|
+
* - 其余命中规则(temu / shein / amazon / etsy …)→ buildPlatformImageResizeUrl
|
|
18
|
+
*
|
|
19
|
+
* 注意:不会再拼接 imageMogr2;若结果里仍出现 imageMogr2,说明别处还在用旧 temuThumbUrl。
|
|
14
20
|
*/
|
|
15
21
|
export declare function montageImgUrl(url?: string, imgSize?: ImgSizeOptions, options?: MontageImgUrlOptions): string;
|
package/dist/tools/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D, c, g, a,
|
|
2
|
-
import { a as a2, b as b2, c as c2, d as d2, e as e2, f as f2, g as g2, h, i as i2, j, k, l, m as m2, n as n2, o, p, q, r as r2, s, t as t2, u, v, w, x, y, z, A, B, C, D as D2, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as } from "../common-D0EYVGB2.js";
|
|
1
|
+
import { D, b, c, g, a, d, e, f, i, h, j, m, n, k, r, l, t } from "../montageImgUrl-DP5jMHCX.js";
|
|
2
|
+
import { a as a2, b as b2, c as c2, d as d2, e as e2, f as f2, g as g2, h as h2, i as i2, j as j2, k as k2, l as l2, m as m2, n as n2, o, p, q, r as r2, s, t as t2, u, v, w, x, y, z, A, B, C, D as D2, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as } from "../common-D0EYVGB2.js";
|
|
3
3
|
import { detectFileType, formatFileSize, parseFile, parseFiles, parseImage, parseImageFile, parsePSD, parsePSDFile, parseTIFF, parseTIFFFile } from "./ImageParserUtils/index.js";
|
|
4
4
|
import { s as s2 } from "../dateShortcuts-DjFC_Txu.js";
|
|
5
5
|
export {
|
|
@@ -11,12 +11,13 @@ export {
|
|
|
11
11
|
e2 as argFormate,
|
|
12
12
|
f2 as base64ToBlob,
|
|
13
13
|
g2 as base64ToFile,
|
|
14
|
-
|
|
14
|
+
h2 as boldPoint,
|
|
15
|
+
b as buildPlatformImageResizeUrl,
|
|
15
16
|
i2 as checkGoodValue,
|
|
16
|
-
|
|
17
|
+
j2 as cleanEmptyFields,
|
|
17
18
|
c as configureImgUrl,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
k2 as convertImageFormat,
|
|
20
|
+
l2 as copyText,
|
|
20
21
|
m2 as copyWord,
|
|
21
22
|
n2 as createFileLocalUrl,
|
|
22
23
|
o as createUuid,
|
|
@@ -46,24 +47,26 @@ export {
|
|
|
46
47
|
K as getArrayBufferFromInput,
|
|
47
48
|
L as getFileFolderToEnums,
|
|
48
49
|
M as getFilenameAndExtension,
|
|
50
|
+
g as getImageResizeRuleName,
|
|
49
51
|
N as getImageSizeByFile,
|
|
50
|
-
|
|
52
|
+
a as getImgFasten,
|
|
51
53
|
O as getMobileSubmitParams,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
d as getNetworkAdaptiveOptions,
|
|
55
|
+
e as getOssLinks,
|
|
56
|
+
f as getPlatformOriginalImageUrl,
|
|
54
57
|
P as getQueryParams,
|
|
55
58
|
Q as getUUID,
|
|
56
59
|
R as getUrlSuffix,
|
|
57
60
|
S as getXmlKeyValue,
|
|
58
61
|
T as hasInvalidFileNameChars,
|
|
59
62
|
i as imgUrlConfigKey,
|
|
60
|
-
|
|
63
|
+
h as initNetworkListener,
|
|
61
64
|
U as isCmykPsd,
|
|
62
65
|
V as isFuction,
|
|
63
66
|
W as isMobileDevice,
|
|
64
67
|
X as isPdfUrl,
|
|
65
68
|
Y as isSameDay,
|
|
66
|
-
|
|
69
|
+
j as isUnsupportedImg,
|
|
67
70
|
Z as localUrlToFile,
|
|
68
71
|
_ as longestContinuousMatch,
|
|
69
72
|
$ as mergeColumns,
|
|
@@ -74,7 +77,7 @@ export {
|
|
|
74
77
|
m as montageImgUrl,
|
|
75
78
|
a4 as nameReg,
|
|
76
79
|
n as networkKey,
|
|
77
|
-
|
|
80
|
+
k as notSupportedImgTypes,
|
|
78
81
|
a5 as numberFilter,
|
|
79
82
|
a6 as numberToChinese,
|
|
80
83
|
a7 as numberToRatio,
|
|
@@ -96,7 +99,8 @@ export {
|
|
|
96
99
|
af as preventDefaultHandler,
|
|
97
100
|
ag as pwdReg,
|
|
98
101
|
ah as ratioToNumber,
|
|
99
|
-
r as
|
|
102
|
+
r as removeImageUrlQuery,
|
|
103
|
+
l as replaceUnsupportedImg,
|
|
100
104
|
s2 as shortcuts,
|
|
101
105
|
ai as sleep,
|
|
102
106
|
aj as splitArray,
|
package/package.json
CHANGED
|
@@ -1,343 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { ref } from "vue";
|
|
18
|
-
const DEFAULT_IMG_FASTEN = {
|
|
19
|
-
notSupported: "//static.fangguo.com/assets/img/pic-fasten/not-supported.png",
|
|
20
|
-
error: "//static.fangguo.com/assets/img/pic-fasten/error.png",
|
|
21
|
-
empty: "//static.fangguo.com/assets/img/pic-fasten/empty.png"
|
|
22
|
-
};
|
|
23
|
-
let ossLinks = [];
|
|
24
|
-
let imgFasten = __spreadValues({}, DEFAULT_IMG_FASTEN);
|
|
25
|
-
const imgUrlConfigKey = ref(0);
|
|
26
|
-
function getOssLinks() {
|
|
27
|
-
return ossLinks;
|
|
28
|
-
}
|
|
29
|
-
function getImgFasten() {
|
|
30
|
-
return imgFasten;
|
|
31
|
-
}
|
|
32
|
-
function configureImgUrl(config = {}) {
|
|
33
|
-
let changed = false;
|
|
34
|
-
if (config.ossLinks) {
|
|
35
|
-
ossLinks = [...config.ossLinks];
|
|
36
|
-
changed = true;
|
|
37
|
-
}
|
|
38
|
-
if (config.imgFasten) {
|
|
39
|
-
imgFasten = __spreadValues(__spreadValues({}, imgFasten), config.imgFasten);
|
|
40
|
-
changed = true;
|
|
41
|
-
}
|
|
42
|
-
if (changed) {
|
|
43
|
-
imgUrlConfigKey.value++;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
let lastEffectiveType = null;
|
|
47
|
-
let lastSaveData = null;
|
|
48
|
-
let networkListenerInitialized = false;
|
|
49
|
-
const cachedResults = /* @__PURE__ */ new Map();
|
|
50
|
-
const MAX_CACHE_ENTRIES = 500;
|
|
51
|
-
const networkKey = ref(0);
|
|
52
|
-
function normalizeCacheKeyOptions(baseOptions) {
|
|
53
|
-
const o = baseOptions != null ? baseOptions : {};
|
|
54
|
-
const w = typeof o.w === "number" ? o.w : "";
|
|
55
|
-
const h = typeof o.h === "number" ? o.h : "";
|
|
56
|
-
const Q = typeof o.Q === "number" ? o.Q : "";
|
|
57
|
-
const q = typeof o.q === "number" ? o.q : "";
|
|
58
|
-
const format = typeof o.format === "string" ? o.format : "";
|
|
59
|
-
return `w=${w}&h=${h}&Q=${Q}&q=${q}&format=${format}`;
|
|
60
|
-
}
|
|
61
|
-
function lruGet(key) {
|
|
62
|
-
const hit = cachedResults.get(key);
|
|
63
|
-
if (!hit) return null;
|
|
64
|
-
cachedResults.delete(key);
|
|
65
|
-
cachedResults.set(key, hit);
|
|
66
|
-
return hit;
|
|
67
|
-
}
|
|
68
|
-
function lruSet(key, value) {
|
|
69
|
-
if (cachedResults.has(key)) cachedResults.delete(key);
|
|
70
|
-
cachedResults.set(key, value);
|
|
71
|
-
if (cachedResults.size > MAX_CACHE_ENTRIES) {
|
|
72
|
-
const oldestKey = cachedResults.keys().next().value;
|
|
73
|
-
if (oldestKey) cachedResults.delete(oldestKey);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function getNetworkAdaptiveOptions(baseOptions = { h: 260, Q: 92 }) {
|
|
77
|
-
var _a;
|
|
78
|
-
const conn = navigator.connection;
|
|
79
|
-
const effectiveType = (conn == null ? void 0 : conn.effectiveType) || "4g";
|
|
80
|
-
const saveData = (_a = conn == null ? void 0 : conn.saveData) != null ? _a : false;
|
|
81
|
-
const key = `${effectiveType}|${String(saveData)}|${normalizeCacheKeyOptions(baseOptions)}`;
|
|
82
|
-
if (effectiveType === lastEffectiveType && saveData === lastSaveData) {
|
|
83
|
-
const hit = lruGet(key);
|
|
84
|
-
if (hit) return hit;
|
|
85
|
-
}
|
|
86
|
-
let scale = 1;
|
|
87
|
-
let quality = baseOptions.Q || 92;
|
|
88
|
-
switch (effectiveType) {
|
|
89
|
-
case "slow-2g":
|
|
90
|
-
case "2g":
|
|
91
|
-
scale = saveData ? 0.3 : 0.4;
|
|
92
|
-
quality = saveData ? 40 : 50;
|
|
93
|
-
break;
|
|
94
|
-
case "3g":
|
|
95
|
-
scale = saveData ? 0.5 : 0.7;
|
|
96
|
-
quality = saveData ? 60 : 82;
|
|
97
|
-
break;
|
|
98
|
-
case "4g":
|
|
99
|
-
default:
|
|
100
|
-
scale = saveData ? 0.7 : 1;
|
|
101
|
-
quality = saveData ? 85 : baseOptions.Q || 92;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
const options = __spreadValues({}, baseOptions);
|
|
105
|
-
if (options.w) options.w = Math.round(options.w * scale);
|
|
106
|
-
if (options.h) options.h = Math.round(options.h * scale);
|
|
107
|
-
options.Q = quality;
|
|
108
|
-
lastEffectiveType = effectiveType;
|
|
109
|
-
lastSaveData = saveData;
|
|
110
|
-
lruSet(key, options);
|
|
111
|
-
return options;
|
|
112
|
-
}
|
|
113
|
-
function initNetworkListener() {
|
|
114
|
-
if (networkListenerInitialized) return;
|
|
115
|
-
networkListenerInitialized = true;
|
|
116
|
-
const conn = navigator.connection;
|
|
117
|
-
if (conn == null ? void 0 : conn.addEventListener) {
|
|
118
|
-
conn.addEventListener("change", () => {
|
|
119
|
-
cachedResults.clear();
|
|
120
|
-
lastEffectiveType = null;
|
|
121
|
-
lastSaveData = null;
|
|
122
|
-
networkKey.value++;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
getNetworkAdaptiveOptions();
|
|
126
|
-
}
|
|
127
|
-
const notSupportedImgTypes = ["tif", "tiff", "psd"];
|
|
128
|
-
function isUnsupportedImg(url) {
|
|
129
|
-
const pathname = url.split(/[?#]/)[0];
|
|
130
|
-
const filename = pathname.slice(pathname.lastIndexOf("/") + 1);
|
|
131
|
-
const dot = filename.lastIndexOf(".");
|
|
132
|
-
if (dot === -1) return false;
|
|
133
|
-
return notSupportedImgTypes.includes(filename.slice(dot + 1).toLowerCase());
|
|
134
|
-
}
|
|
135
|
-
function replaceUnsupportedImg(url = "") {
|
|
136
|
-
if (!url) return url;
|
|
137
|
-
return isUnsupportedImg(url) ? getImgFasten().notSupported : url;
|
|
138
|
-
}
|
|
139
|
-
function temuThumbUrl(url, imgSize) {
|
|
140
|
-
const { w, h } = imgSize || {};
|
|
141
|
-
if (url.indexOf("imageMogr2/thumbnail/") > -1) {
|
|
142
|
-
return url;
|
|
143
|
-
}
|
|
144
|
-
const resizeUrl = `?imageMogr2/thumbnail/${w || h || 200}x`;
|
|
145
|
-
return `${url}${resizeUrl}`;
|
|
146
|
-
}
|
|
147
|
-
function montageImgUrl(url = "", imgSize, options = {}) {
|
|
148
|
-
var _a;
|
|
149
|
-
const imgFasten2 = getImgFasten();
|
|
150
|
-
if (!url) return imgFasten2.empty;
|
|
151
|
-
if (isUnsupportedImg(url)) return imgFasten2.notSupported;
|
|
152
|
-
if (url.includes("/img.kwcdn.com")) {
|
|
153
|
-
return temuThumbUrl(url, imgSize);
|
|
154
|
-
}
|
|
155
|
-
const ossLinks2 = (_a = options.ossLinks) != null ? _a : getOssLinks();
|
|
156
|
-
if (ossLinks2.some((domain) => url.includes(domain))) {
|
|
157
|
-
const networkOpts = getNetworkAdaptiveOptions(imgSize || { h: 260, Q: 92 });
|
|
158
|
-
const finalParams = __spreadValues(__spreadValues({}, imgSize), networkOpts);
|
|
159
|
-
const { w, h, Q, q, format = "" } = finalParams;
|
|
160
|
-
const qualityVal = Q != null ? Q : q;
|
|
161
|
-
const formatPart = format ? `/format,${format}` : "";
|
|
162
|
-
let finalUrl = url;
|
|
163
|
-
const hasProcess = url.includes("x-oss-process=");
|
|
164
|
-
if (hasProcess) {
|
|
165
|
-
if (h) finalUrl = finalUrl.replace(/h_\d+/, `h_${h}`);
|
|
166
|
-
if (w) finalUrl = finalUrl.replace(/w_\d+/, `w_${w}`);
|
|
167
|
-
if (qualityVal) {
|
|
168
|
-
finalUrl = finalUrl.replace(/quality,[Qq]_\d+/, `quality,${Q ? "Q" : "q"}_${qualityVal}`);
|
|
169
|
-
}
|
|
170
|
-
if (format) {
|
|
171
|
-
if (finalUrl.includes("/format,")) {
|
|
172
|
-
finalUrl = finalUrl.replace(/\/format,\w+/, formatPart);
|
|
173
|
-
} else {
|
|
174
|
-
finalUrl += formatPart;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
} else {
|
|
178
|
-
let resizeStr = "resize,";
|
|
179
|
-
if (w) resizeStr += `w_${w}`;
|
|
180
|
-
else if (h) resizeStr += `h_${h}`;
|
|
181
|
-
else resizeStr += "l_120";
|
|
182
|
-
const qualityPart = qualityVal && qualityVal >= 1 && qualityVal <= 100 ? `/quality,${Q ? "Q" : "q"}_${qualityVal}` : "";
|
|
183
|
-
const connector = url.includes("?") ? "&" : "?";
|
|
184
|
-
finalUrl = `${url}${connector}x-oss-process=image/${resizeStr}${qualityPart}${formatPart}`;
|
|
185
|
-
}
|
|
186
|
-
return finalUrl;
|
|
187
|
-
}
|
|
188
|
-
return url;
|
|
189
|
-
}
|
|
190
|
-
export {
|
|
191
|
-
DEFAULT_IMG_FASTEN as D,
|
|
192
|
-
getNetworkAdaptiveOptions as a,
|
|
193
|
-
getOssLinks as b,
|
|
194
|
-
configureImgUrl as c,
|
|
195
|
-
initNetworkListener as d,
|
|
196
|
-
isUnsupportedImg as e,
|
|
197
|
-
notSupportedImgTypes as f,
|
|
198
|
-
getImgFasten as g,
|
|
199
|
-
imgUrlConfigKey as i,
|
|
200
|
-
montageImgUrl as m,
|
|
201
|
-
networkKey as n,
|
|
202
|
-
replaceUnsupportedImg as r,
|
|
203
|
-
temuThumbUrl as t
|
|
204
|
-
};
|