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
|
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
const
|
|
33
|
+
const ErrorImage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-612063c5"]]);
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
ErrorImage as E
|
|
36
36
|
};
|
package/dist/FgCascader.css
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
.fg-doc-view-img-loading__box[data-v-
|
|
2
|
+
.fg-doc-view-img-loading__box[data-v-b5803c68] {
|
|
3
3
|
width: 200px;
|
|
4
4
|
height: 120px;
|
|
5
5
|
background: #fafafa;
|
|
6
6
|
border: 1px dashed var(--el-border-color);
|
|
7
7
|
border-radius: 8px;
|
|
8
8
|
}
|
|
9
|
-
.fg-doc-view-img-loading__box[data-v-
|
|
9
|
+
.fg-doc-view-img-loading__box[data-v-b5803c68] .fg-view-img {
|
|
10
10
|
width: 100%;
|
|
11
11
|
height: 100%;
|
|
12
12
|
}
|
|
13
|
-
.fg-doc-view-img-loading__ph[data-v-
|
|
13
|
+
.fg-doc-view-img-loading__ph[data-v-b5803c68] {
|
|
14
14
|
font-size: 13px;
|
|
15
15
|
color: var(--el-color-primary);
|
|
16
|
-
}
|
|
17
|
-
.fg-doc-view-img-loading__hint[data-v-552a6f88] {
|
|
18
|
-
margin-top: 8px;
|
|
19
|
-
font-size: 13px;
|
|
20
|
-
color: var(--vp-c-text-2);
|
|
21
|
-
}
|
|
22
|
-
.fg-doc-view-img-loading__hint code[data-v-552a6f88] {
|
|
23
|
-
font-size: 12px;
|
|
24
16
|
}
|
|
25
17
|
.cascader-virtual-list[data-v-a251fab9] {
|
|
26
18
|
height: 100%;
|
|
@@ -50,13 +50,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
-
import { getCurrentScope, onScopeDispose, watch, computed, toValue, shallowRef, getCurrentInstance, onMounted, warn, defineComponent, ref, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx,
|
|
53
|
+
import { getCurrentScope, onScopeDispose, watch, computed, toValue, shallowRef, getCurrentInstance, onMounted, warn, defineComponent, ref, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, h, inject, resolveComponent, normalizeClass, createBlock, withModifiers, createCommentVNode, Fragment, normalizeStyle, createTextVNode, toDisplayString, provide, reactive, onBeforeUpdate, nextTick, renderList, useAttrs, withDirectives, vShow, renderSlot, withKeys, vModelText, useSlots, useModel, onBeforeUnmount, mergeProps, mergeModels, render } from "vue";
|
|
54
54
|
import { p as process$1 } from "./index-C9zyi90j.js";
|
|
55
55
|
import { fromPairs, isEqual, flattenDeep, cloneDeep, debounce } from "lodash-unified";
|
|
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-CD4QJK4R.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({}) : {};
|
|
@@ -341,21 +341,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
341
341
|
])]),
|
|
342
342
|
_: 1
|
|
343
343
|
}, 8, ["loading"])
|
|
344
|
-
])
|
|
345
|
-
_cache[1] || (_cache[1] = createElementVNode("p", { class: "fg-doc-view-img-loading__hint" }, [
|
|
346
|
-
createTextVNode(" 外部 "),
|
|
347
|
-
createElementVNode("code", null, "loading"),
|
|
348
|
-
createTextVNode(" 为 "),
|
|
349
|
-
createElementVNode("code", null, "true"),
|
|
350
|
-
createTextVNode(" 时展示 "),
|
|
351
|
-
createElementVNode("code", null, "#placeholder"),
|
|
352
|
-
createTextVNode(";约 2 秒后自动结束(模拟接口返回)。 ")
|
|
353
|
-
], -1))
|
|
344
|
+
])
|
|
354
345
|
]);
|
|
355
346
|
};
|
|
356
347
|
}
|
|
357
348
|
});
|
|
358
|
-
const __unplugin_components_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
349
|
+
const __unplugin_components_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-b5803c68"]]);
|
|
359
350
|
const NodeContent = defineComponent({
|
|
360
351
|
name: "NodeContent",
|
|
361
352
|
setup() {
|
|
@@ -41,7 +41,7 @@ import { ElPopover, ElIcon, ElTag } from "element-plus/es";
|
|
|
41
41
|
import { defineComponent, useModel, ref, watch, computed, nextTick, onUnmounted, onMounted, openBlock, createBlock, withCtx, createVNode, unref, createElementBlock, createCommentVNode, toDisplayString, withModifiers, renderSlot, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createTextVNode, withDirectives, vModelText, mergeModels } from "vue";
|
|
42
42
|
import { q as debounce } from "./common-D0EYVGB2.js";
|
|
43
43
|
import { Check, ArrowDown, CircleClose } from "@element-plus/icons-vue";
|
|
44
|
-
import { L as LazyPopover } from "./LazyPopover-
|
|
44
|
+
import { L as LazyPopover } from "./LazyPopover-CcvilJ6U.js";
|
|
45
45
|
import { s as script$1, a as script } from "./vue-virtual-scroller.esm-ZgBoGAjX.js";
|
|
46
46
|
import { isEqual } from "lodash-unified";
|
|
47
47
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, useSlots, ref, openBlock, createBlock, createSlots, withCtx, createElementVNode, renderSlot, toDisplayString, renderList, unref, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import { H as HSelect } from "./HSelect-
|
|
2
|
+
import { H as HSelect } from "./HSelect-0w2mSrtm.js";
|
|
3
3
|
const _hoisted_1 = { class: "px-[10px] py-[10px] bg-[#fff] border-b cursor-pointer" };
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
__name: "HSelectAll",
|
|
@@ -41,7 +41,7 @@ import { ElPopover, ElIcon, ElTag } from "element-plus/es";
|
|
|
41
41
|
import { defineComponent, useModel, ref, watch, computed, nextTick, onUnmounted, onMounted, openBlock, createBlock, withCtx, createVNode, unref, createElementBlock, createCommentVNode, toDisplayString, withModifiers, renderSlot, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createTextVNode, withDirectives, vModelText, mergeModels } from "vue";
|
|
42
42
|
import { q as debounce } from "./common-D0EYVGB2.js";
|
|
43
43
|
import { Check, ArrowDown, CircleClose } from "@element-plus/icons-vue";
|
|
44
|
-
import { L as LazyPopover } from "./LazyPopover-
|
|
44
|
+
import { L as LazyPopover } from "./LazyPopover-CcvilJ6U.js";
|
|
45
45
|
import { s as script$1, a as script } from "./vue-virtual-scroller.esm-ZgBoGAjX.js";
|
|
46
46
|
import { isEqual } from "lodash-unified";
|
|
47
47
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
@@ -1,11 +1,48 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref } from "vue";
|
|
1
|
+
import { defineComponent, onMounted, onBeforeUnmount, openBlock, createBlock, unref } from "vue";
|
|
2
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-
|
|
3
|
+
import { u as useImgViewerState, I as ImgViewerStore } from "./imgViewerStore-Ajm-L7R5.js";
|
|
4
|
+
let manualHostCount = 0;
|
|
5
|
+
let autoHostCount = 0;
|
|
6
|
+
let autoHostCleanup = null;
|
|
7
|
+
function setImgViewerAutoHostCleanup(cleanup) {
|
|
8
|
+
autoHostCleanup = cleanup;
|
|
9
|
+
}
|
|
10
|
+
function registerImgViewerHost(kind = "manual") {
|
|
11
|
+
if (kind === "auto") {
|
|
12
|
+
autoHostCount += 1;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
manualHostCount += 1;
|
|
16
|
+
if (autoHostCount > 0) {
|
|
17
|
+
autoHostCleanup == null ? void 0 : autoHostCleanup();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function unregisterImgViewerHost(kind = "manual") {
|
|
21
|
+
if (kind === "auto") {
|
|
22
|
+
autoHostCount = Math.max(0, autoHostCount - 1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
manualHostCount = Math.max(0, manualHostCount - 1);
|
|
26
|
+
}
|
|
27
|
+
function hasImgViewerHost() {
|
|
28
|
+
return manualHostCount > 0 || autoHostCount > 0;
|
|
29
|
+
}
|
|
4
30
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
31
|
__name: "ImgViewerHost",
|
|
32
|
+
props: {
|
|
33
|
+
autoHost: { type: Boolean, default: false }
|
|
34
|
+
},
|
|
6
35
|
setup(__props) {
|
|
36
|
+
const props = __props;
|
|
7
37
|
const state = useImgViewerState();
|
|
8
38
|
const imgViewerStore = ImgViewerStore();
|
|
39
|
+
const hostKind = props.autoHost ? "auto" : "manual";
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
registerImgViewerHost(hostKind);
|
|
42
|
+
});
|
|
43
|
+
onBeforeUnmount(() => {
|
|
44
|
+
unregisterImgViewerHost(hostKind);
|
|
45
|
+
});
|
|
9
46
|
function handlePreviewClose() {
|
|
10
47
|
var _a;
|
|
11
48
|
(_a = state.onClose) == null ? void 0 : _a.call(state);
|
|
@@ -49,5 +86,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
49
86
|
}
|
|
50
87
|
});
|
|
51
88
|
export {
|
|
52
|
-
_sfc_main as _
|
|
89
|
+
_sfc_main as _,
|
|
90
|
+
hasImgViewerHost as h,
|
|
91
|
+
setImgViewerAutoHostCleanup as s
|
|
53
92
|
};
|
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { defineComponent, useAttrs, computed, ref, openBlock, createElementBlock, Fragment, createElementVNode, mergeProps, renderSlot, createBlock, unref, withCtx, createCommentVNode } from "vue";
|
|
32
|
+
import { defineComponent, useAttrs, computed, ref, watch, openBlock, createElementBlock, Fragment, createElementVNode, mergeProps, renderSlot, createBlock, unref, withCtx, createCommentVNode } from "vue";
|
|
33
33
|
import { ElPopover } from "element-plus";
|
|
34
34
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
35
35
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
@@ -37,7 +37,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
37
37
|
}), {
|
|
38
38
|
__name: "LazyPopover",
|
|
39
39
|
props: {
|
|
40
|
-
props: { default: () => ({}) }
|
|
40
|
+
props: { default: () => ({}) },
|
|
41
|
+
disabled: { type: Boolean, default: false }
|
|
41
42
|
},
|
|
42
43
|
setup(__props) {
|
|
43
44
|
const props = __props;
|
|
@@ -107,6 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
107
108
|
}, hideAfterMs.value);
|
|
108
109
|
}
|
|
109
110
|
function onTriggerMouseEnter() {
|
|
111
|
+
if (props.disabled) return;
|
|
110
112
|
if (!mounted.value) {
|
|
111
113
|
mounted.value = true;
|
|
112
114
|
}
|
|
@@ -131,6 +133,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
131
133
|
}
|
|
132
134
|
const popoverBind = computed(() => {
|
|
133
135
|
const userProps = __spreadValues(__spreadValues({}, attrsPopoverProps.value), props.props);
|
|
136
|
+
if (props.disabled) {
|
|
137
|
+
const rest2 = __spreadValues({}, userProps);
|
|
138
|
+
delete rest2.trigger;
|
|
139
|
+
delete rest2.visible;
|
|
140
|
+
return __spreadProps(__spreadValues({}, rest2), {
|
|
141
|
+
trigger: "manual",
|
|
142
|
+
visible: false
|
|
143
|
+
});
|
|
144
|
+
}
|
|
134
145
|
if (!isHoverTrigger.value) {
|
|
135
146
|
return userProps;
|
|
136
147
|
}
|
|
@@ -150,6 +161,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
150
161
|
visible: visible.value
|
|
151
162
|
});
|
|
152
163
|
});
|
|
164
|
+
watch(
|
|
165
|
+
() => props.disabled,
|
|
166
|
+
(disabled) => {
|
|
167
|
+
if (!disabled) return;
|
|
168
|
+
clearShowTimer();
|
|
169
|
+
clearHideTimer();
|
|
170
|
+
visible.value = false;
|
|
171
|
+
inTrigger = false;
|
|
172
|
+
inPopper = false;
|
|
173
|
+
}
|
|
174
|
+
);
|
|
153
175
|
return (_ctx, _cache) => {
|
|
154
176
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
155
177
|
createElementVNode("span", mergeProps({
|
|
@@ -182,7 +204,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
182
204
|
};
|
|
183
205
|
}
|
|
184
206
|
}));
|
|
185
|
-
const LazyPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
207
|
+
const LazyPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-63cfbcce"]]);
|
|
186
208
|
export {
|
|
187
209
|
LazyPopover as L
|
|
188
210
|
};
|
package/dist/LazyPopover.css
CHANGED
|
@@ -19,7 +19,7 @@ import './SelectTree.css';var __async = (__this, __arguments, generator) => {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
import { ElPopover, ElTreeV2, ElTag, ElIcon } from "element-plus/es";
|
|
22
|
-
import { L as LazyPopover } from "./LazyPopover-
|
|
22
|
+
import { L as LazyPopover } from "./LazyPopover-CcvilJ6U.js";
|
|
23
23
|
import { defineComponent, ref, computed, watch, nextTick, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, toDisplayString, createCommentVNode, createVNode, createElementVNode, normalizeStyle, normalizeClass, createTextVNode, withDirectives, withModifiers, vModelText, toRaw } from "vue";
|
|
24
24
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
25
25
|
const global = globalThis || void 0 || self;
|
|
@@ -29,12 +29,84 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { defineComponent,
|
|
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
|
-
import { n as networkKey, i as imgUrlConfigKey, m as montageImgUrl } from "./montageImgUrl-CwgYnB2h.js";
|
|
36
|
-
import { F as FgErrorImage } from "./ErrorImage-CFVt1ht_.js";
|
|
32
|
+
import { defineComponent, computed, openBlock, createElementBlock, Fragment, createElementVNode, toDisplayString, reactive, useAttrs, ref, watch, normalizeStyle, unref, normalizeClass, withDirectives, mergeProps, vShow, renderSlot, normalizeProps, guardReactiveProps, createBlock, resolveDynamicComponent, createCommentVNode } from "vue";
|
|
37
33
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
34
|
+
import { I as ImgViewerStore } from "./imgViewerStore-Ajm-L7R5.js";
|
|
35
|
+
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";
|
|
36
|
+
import { n as networkKey, i as imgUrlConfigKey, m as montageImgUrl } from "./montageImgUrl-DP5jMHCX.js";
|
|
37
|
+
const _hoisted_1$1 = { class: "fg-view-img__error-default" };
|
|
38
|
+
const _hoisted_2$1 = {
|
|
39
|
+
class: "fg-view-img__error-icon",
|
|
40
|
+
viewBox: "0 0 1088 1024",
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
42
|
+
};
|
|
43
|
+
const _hoisted_3$1 = ["fill"];
|
|
44
|
+
const _hoisted_4 = { class: "fg-view-img__error-label" };
|
|
45
|
+
const DEFAULT_FAIL_COLOR = "#c3c6ca";
|
|
46
|
+
const LEGACY_ERROR_COLOR = "#f5f5f5";
|
|
47
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
48
|
+
__name: "ViewImgErrorFallback",
|
|
49
|
+
props: {
|
|
50
|
+
src: { default: "" },
|
|
51
|
+
errorText: { default: "" },
|
|
52
|
+
errorColor: { default: "" }
|
|
53
|
+
},
|
|
54
|
+
setup(__props) {
|
|
55
|
+
const props = __props;
|
|
56
|
+
const isEmptySrc = computed(() => !props.src.trim());
|
|
57
|
+
const resolvedLabel = computed(() => props.errorText || "加载失败");
|
|
58
|
+
const resolvedFailColor = computed(() => {
|
|
59
|
+
var _a;
|
|
60
|
+
const color = (_a = props.errorColor) == null ? void 0 : _a.trim();
|
|
61
|
+
if (!color || color === LEGACY_ERROR_COLOR) return DEFAULT_FAIL_COLOR;
|
|
62
|
+
return color;
|
|
63
|
+
});
|
|
64
|
+
return (_ctx, _cache) => {
|
|
65
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
66
|
+
isEmptySrc.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
67
|
+
_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
68
|
+
class: "fg-view-img__error-icon",
|
|
69
|
+
viewBox: "0 0 1131 1024",
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
71
|
+
}, [
|
|
72
|
+
createElementVNode("path", {
|
|
73
|
+
d: "M764.191528 125.736421a125.844211 125.844211 0 0 0 125.898106 125.763368 125.844211 125.844211 0 0 0 125.898105-125.763368A125.844211 125.844211 0 0 0 890.089634 0a125.844211 125.844211 0 0 0-125.898106 125.736421zM317.269423 317.493895L18.261423 807.909053c-50.364632 84.884211 9.431579 191.757474 107.008 191.757473h601.168842c97.549474 0 157.372632-106.873263 106.981053-191.757473L534.465213 317.493895c-50.364632-78.578526-166.804211-78.578526-217.19579 0z",
|
|
74
|
+
fill: "#D4DADC"
|
|
75
|
+
}),
|
|
76
|
+
createElementVNode("path", {
|
|
77
|
+
d: "M742.148581 556.409263l-157.372632 257.778526c-50.337684 84.884211 9.458526 191.784421 107.034948 191.784422h314.745263c97.549474 0 157.372632-106.900211 107.008-191.784422l-157.372632-257.778526c-47.211789-81.731368-166.804211-81.731368-214.016 0z",
|
|
78
|
+
fill: "#E1E4E5"
|
|
79
|
+
})
|
|
80
|
+
], -1)),
|
|
81
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "fg-view-img__error-label" }, "无图", -1))
|
|
82
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
83
|
+
(openBlock(), createElementBlock("svg", _hoisted_2$1, [
|
|
84
|
+
createElementVNode("path", {
|
|
85
|
+
d: "M640 138.688a32 32 0 0 1 27.456 48.448L613.76 276.416l31.488 47.232a32 32 0 0 1-12.288 46.336L482.944 444.928l18.112 126.592a32.064 32.064 0 0 1-22.912 35.264l-118.976 33.92 55.68 204.224a32 32 0 0 1-30.848 40.448H149.376a74.688 74.688 0 0 1-74.688-74.688V213.376c0-41.216 33.472-74.688 74.688-74.688H640z m234.624 0c41.216 0 74.688 33.472 74.688 74.688v597.312c0 41.216-33.472 74.688-74.688 74.688H512a32.064 32.064 0 0 1-30.784-23.232l-42.624-149.312a32 32 0 0 1 21.888-39.552l122.944-35.2-17.92-143.36a32 32 0 0 1 18.816-33.28l158.912-70.72-45.376-75.584a32 32 0 0 1 0.832-34.176l85.312-128a32 32 0 0 1 26.624-14.272h64z m-725.248 64a10.688 10.688 0 0 0-10.688 10.688v597.312c0 5.888 4.8 10.688 10.688 10.688h192.768l-52.992-194.24a32 32 0 0 1 22.08-39.168l122.432-35.072-17.344-121.728a32 32 0 0 1 17.344-33.088l138.24-69.12-22.528-33.856a32.064 32.064 0 0 1-0.832-34.24l34.944-58.176H149.376z m613.76 96.896l53.632 89.28a32 32 0 0 1-14.464 45.76L632 510.272l18.368 147.072a32 32 0 0 1-22.912 34.752l-118.656 33.92 27.328 95.36h338.496a10.688 10.688 0 0 0 10.688-10.688V213.376a10.688 10.688 0 0 0-10.688-10.688h-46.848l-64.64 96.896zM309.312 288a64 64 0 1 1 0 128 64 64 0 0 1 0-128z",
|
|
86
|
+
fill: resolvedFailColor.value
|
|
87
|
+
}, null, 8, _hoisted_3$1)
|
|
88
|
+
])),
|
|
89
|
+
createElementVNode("span", _hoisted_4, toDisplayString(resolvedLabel.value), 1)
|
|
90
|
+
], 64))
|
|
91
|
+
]);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const ViewImgErrorFallback = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-454f216f"]]);
|
|
96
|
+
const viewImgDefaults = reactive({});
|
|
97
|
+
function configureViewImgDefaults(defaults) {
|
|
98
|
+
resetViewImgDefaults();
|
|
99
|
+
Object.assign(viewImgDefaults, defaults);
|
|
100
|
+
}
|
|
101
|
+
function resetViewImgDefaults() {
|
|
102
|
+
delete viewImgDefaults.placeholder;
|
|
103
|
+
delete viewImgDefaults.error;
|
|
104
|
+
delete viewImgDefaults.waterMarkTitle;
|
|
105
|
+
delete viewImgDefaults.loadingIconColor;
|
|
106
|
+
}
|
|
107
|
+
function useViewImgDefaults() {
|
|
108
|
+
return viewImgDefaults;
|
|
109
|
+
}
|
|
38
110
|
const _hoisted_1 = ["src", "loading"];
|
|
39
111
|
const _hoisted_2 = {
|
|
40
112
|
key: 0,
|
|
@@ -44,11 +116,6 @@ const _hoisted_3 = {
|
|
|
44
116
|
key: 1,
|
|
45
117
|
class: "fg-view-img__error"
|
|
46
118
|
};
|
|
47
|
-
const _hoisted_4 = { class: "fg-view-img__error-default" };
|
|
48
|
-
const _hoisted_5 = {
|
|
49
|
-
key: 1,
|
|
50
|
-
class: "fg-view-img__error-text"
|
|
51
|
-
};
|
|
52
119
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
53
120
|
inheritAttrs: false
|
|
54
121
|
}), {
|
|
@@ -97,6 +164,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
97
164
|
const retried = ref(false);
|
|
98
165
|
const internalLoading = ref(false);
|
|
99
166
|
const loadError = ref(false);
|
|
167
|
+
const viewImgDefaults2 = useViewImgDefaults();
|
|
100
168
|
const imgAttrs = computed(() => {
|
|
101
169
|
const _a = attrs, { class: _, style: __ } = _a, rest = __objRest(_a, ["class", "style"]);
|
|
102
170
|
return rest;
|
|
@@ -106,19 +174,43 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
106
174
|
return { objectFit: props.fit };
|
|
107
175
|
});
|
|
108
176
|
const showPlaceholder = computed(
|
|
109
|
-
() => !!props.src && (props.loading || internalLoading.value) && !loadError.value
|
|
177
|
+
() => !!props.src.trim() && (props.loading || internalLoading.value) && !loadError.value
|
|
110
178
|
);
|
|
111
|
-
const
|
|
179
|
+
const defaultSlotPayload = computed(() => ({
|
|
180
|
+
src: props.src,
|
|
181
|
+
displaySrc: displaySrc.value,
|
|
182
|
+
loading: props.loading || internalLoading.value,
|
|
183
|
+
loadError: loadError.value,
|
|
184
|
+
errorText: props.errorText,
|
|
185
|
+
errorColor: props.errorColor,
|
|
186
|
+
errorOffset: props.errorOffset
|
|
187
|
+
}));
|
|
188
|
+
const globalPlaceholderComponent = computed(() => {
|
|
189
|
+
const renderPlaceholder = viewImgDefaults2.placeholder;
|
|
190
|
+
if (!renderPlaceholder) return null;
|
|
191
|
+
return {
|
|
192
|
+
render: () => renderPlaceholder(defaultSlotPayload.value)
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
const globalErrorComponent = computed(() => {
|
|
196
|
+
const renderError = viewImgDefaults2.error;
|
|
197
|
+
if (!renderError) return null;
|
|
198
|
+
return {
|
|
199
|
+
render: () => renderError(defaultSlotPayload.value)
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
const previewEnabled = computed(() => (props.preview || props.previewSrcList.length > 0) && !!displaySrc.value && !loadError.value);
|
|
112
203
|
const previewUrlList = computed(() => {
|
|
113
|
-
const rawList = props.previewSrcList.length ? props.previewSrcList : props.src ? [props.src] : [];
|
|
204
|
+
const rawList = props.previewSrcList.length ? props.previewSrcList : props.src.trim() ? [props.src] : [];
|
|
114
205
|
return rawList.map((url) => applyPreviewUrlFallback(url));
|
|
115
206
|
});
|
|
116
|
-
const previewInitialIndex = computed(() =>
|
|
207
|
+
const previewInitialIndex = computed(() => resolvePreviewInitialIndex(previewUrlList.value));
|
|
208
|
+
function resolvePreviewInitialIndex(previewList) {
|
|
117
209
|
if (props.defImgPreviewIndex != null) return props.defImgPreviewIndex;
|
|
118
210
|
if (props.initialIndex != null) return props.initialIndex;
|
|
119
|
-
const index =
|
|
211
|
+
const index = previewList.indexOf(applyPreviewUrlFallback(props.src));
|
|
120
212
|
return index >= 0 ? index : 0;
|
|
121
|
-
}
|
|
213
|
+
}
|
|
122
214
|
const resolvedToolbarBgColor = computed(() => props.toolbarBgColor || props.backgroundColor || DEFAULT_TOOLBAR_BG_COLOR);
|
|
123
215
|
const resolvedPreviewTeleported = computed(
|
|
124
216
|
() => {
|
|
@@ -140,8 +232,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
140
232
|
}
|
|
141
233
|
function resetState(src) {
|
|
142
234
|
retried.value = false;
|
|
235
|
+
internalLoading.value = false;
|
|
236
|
+
if (!src.trim()) {
|
|
237
|
+
displaySrc.value = "";
|
|
238
|
+
loadError.value = true;
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
143
241
|
loadError.value = false;
|
|
144
|
-
internalLoading.value =
|
|
242
|
+
internalLoading.value = true;
|
|
145
243
|
displaySrc.value = resolveImgUrl(src, props.imgSize);
|
|
146
244
|
}
|
|
147
245
|
function handleLoad(event) {
|
|
@@ -170,11 +268,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
170
268
|
displaySrc.value = stripped;
|
|
171
269
|
emit("retry", { from: urlBefore, to: stripped });
|
|
172
270
|
}
|
|
173
|
-
function openPreview() {
|
|
174
|
-
|
|
271
|
+
function openPreview(previewList) {
|
|
272
|
+
const previewImgList = previewList ? previewList.map((url) => applyPreviewUrlFallback(url)) : previewUrlList.value;
|
|
273
|
+
if (!previewImgList.length) return;
|
|
175
274
|
ImgViewerStore().showImgViewer({
|
|
176
|
-
previewImgList
|
|
177
|
-
defImgPreviewIndex: previewInitialIndex.value,
|
|
275
|
+
previewImgList,
|
|
276
|
+
defImgPreviewIndex: previewList ? resolvePreviewInitialIndex(previewImgList) : previewInitialIndex.value,
|
|
178
277
|
toolbarBgColor: resolvedToolbarBgColor.value,
|
|
179
278
|
toolbarIconColor: props.toolbarIconColor,
|
|
180
279
|
infinite: props.infinite,
|
|
@@ -227,28 +326,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
227
326
|
onError: handleError,
|
|
228
327
|
onClick: handlePreviewClick
|
|
229
328
|
}), null, 16, _hoisted_1), [
|
|
230
|
-
[vShow, !loadError.value]
|
|
329
|
+
[vShow, !loadError.value && !showPlaceholder.value]
|
|
231
330
|
]),
|
|
232
331
|
showPlaceholder.value ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
233
|
-
renderSlot(_ctx.$slots, "placeholder",
|
|
332
|
+
renderSlot(_ctx.$slots, "placeholder", normalizeProps(guardReactiveProps(defaultSlotPayload.value)), () => [
|
|
333
|
+
globalPlaceholderComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(globalPlaceholderComponent.value), { key: 0 })) : createCommentVNode("", true)
|
|
334
|
+
], true)
|
|
234
335
|
])) : createCommentVNode("", true),
|
|
235
336
|
loadError.value ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
|
236
|
-
renderSlot(_ctx.$slots, "error",
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}, null, 8, ["color", "offset"])) : (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(__props.errorText), 1))
|
|
244
|
-
])
|
|
337
|
+
renderSlot(_ctx.$slots, "error", normalizeProps(guardReactiveProps(defaultSlotPayload.value)), () => [
|
|
338
|
+
globalErrorComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(globalErrorComponent.value), { key: 0 })) : (openBlock(), createBlock(ViewImgErrorFallback, {
|
|
339
|
+
key: 1,
|
|
340
|
+
src: __props.src,
|
|
341
|
+
"error-text": __props.errorText,
|
|
342
|
+
"error-color": __props.errorColor
|
|
343
|
+
}, null, 8, ["src", "error-text", "error-color"]))
|
|
245
344
|
], true)
|
|
246
345
|
])) : createCommentVNode("", true)
|
|
247
346
|
], 6);
|
|
248
347
|
};
|
|
249
348
|
}
|
|
250
349
|
}));
|
|
251
|
-
const FgViewImg = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
350
|
+
const FgViewImg = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f968b8c2"]]);
|
|
252
351
|
export {
|
|
253
|
-
FgViewImg as F
|
|
352
|
+
FgViewImg as F,
|
|
353
|
+
ViewImgErrorFallback as V,
|
|
354
|
+
configureViewImgDefaults as c,
|
|
355
|
+
resetViewImgDefaults as r,
|
|
356
|
+
useViewImgDefaults as u
|
|
254
357
|
};
|
package/dist/ViewImg.css
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
.fg-view-
|
|
1
|
+
.fg-view-img__error-default[data-v-454f216f] {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
gap: 6px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
padding: 8px;
|
|
11
|
+
}
|
|
12
|
+
.fg-view-img__error-icon[data-v-454f216f] {
|
|
13
|
+
display: block;
|
|
14
|
+
flex: none;
|
|
15
|
+
width: 40%;
|
|
16
|
+
height: auto;
|
|
17
|
+
max-width: 56px;
|
|
18
|
+
max-height: 48px;
|
|
19
|
+
aspect-ratio: 1;
|
|
20
|
+
}
|
|
21
|
+
.fg-view-img__error-label[data-v-454f216f] {
|
|
22
|
+
flex: none;
|
|
23
|
+
color: #a8abb2;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
line-height: 1.2;
|
|
26
|
+
text-align: center;
|
|
27
|
+
}.fg-view-img[data-v-f968b8c2] {
|
|
2
28
|
display: block;
|
|
3
29
|
position: relative;
|
|
4
30
|
overflow: hidden;
|
|
@@ -7,50 +33,20 @@
|
|
|
7
33
|
vertical-align: top;
|
|
8
34
|
line-height: 0;
|
|
9
35
|
}
|
|
10
|
-
.fg-view-img__inner[data-v-
|
|
36
|
+
.fg-view-img__inner[data-v-f968b8c2] {
|
|
11
37
|
display: block;
|
|
12
38
|
width: 100%;
|
|
13
39
|
height: 100%;
|
|
14
40
|
}
|
|
15
|
-
.fg-view-img__inner--preview[data-v-
|
|
41
|
+
.fg-view-img__inner--preview[data-v-f968b8c2] {
|
|
16
42
|
cursor: zoom-in;
|
|
17
43
|
}
|
|
18
|
-
.fg-view-img__placeholder[data-v-
|
|
19
|
-
.fg-view-img__error[data-v-
|
|
44
|
+
.fg-view-img__placeholder[data-v-f968b8c2],
|
|
45
|
+
.fg-view-img__error[data-v-f968b8c2] {
|
|
20
46
|
position: absolute;
|
|
21
47
|
inset: 0;
|
|
22
48
|
display: flex;
|
|
23
49
|
align-items: center;
|
|
24
50
|
justify-content: center;
|
|
25
51
|
background: #f5f7fa;
|
|
26
|
-
}
|
|
27
|
-
.fg-view-img__error[data-v-c6ff5d38] .error-image {
|
|
28
|
-
width: 100%;
|
|
29
|
-
height: 100%;
|
|
30
|
-
}
|
|
31
|
-
.fg-view-img__error-default[data-v-c6ff5d38] {
|
|
32
|
-
position: relative;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
align-items: center;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
gap: 8px;
|
|
40
|
-
padding: 8px;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
}
|
|
43
|
-
.fg-view-img__error-icon[data-v-c6ff5d38] {
|
|
44
|
-
flex: none;
|
|
45
|
-
width: 56%;
|
|
46
|
-
height: 56%;
|
|
47
|
-
max-width: 80px;
|
|
48
|
-
max-height: 80px;
|
|
49
|
-
}
|
|
50
|
-
.fg-view-img__error-text[data-v-c6ff5d38] {
|
|
51
|
-
font-size: 13px;
|
|
52
|
-
line-height: 1.4;
|
|
53
|
-
color: #909399;
|
|
54
|
-
text-align: center;
|
|
55
|
-
word-break: break-all;
|
|
56
52
|
}
|