fangguo-component 1.2.0 → 1.2.2

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +28 -5
  2. package/README.md +11 -0
  3. package/dist/{FgCascader.vue_vue_type_style_index_0_lang-Bm4HR37D.js → FgCascader.vue_vue_type_style_index_0_lang-CstlYwHs.js} +1 -1
  4. package/dist/{ImgViewerHost.vue_vue_type_script_setup_true_lang-CMoh7eWo.js → ImgViewerHost.vue_vue_type_script_setup_true_lang-DBs42WOq.js} +4 -3
  5. package/dist/{ViewImg-Bg1AQ0T6.js → ViewImg-DXhF20SL.js} +14 -7
  6. package/dist/ViewImg.css +9 -9
  7. package/dist/ViewImgPopover-QblZG0z5.js +343 -0
  8. package/dist/ViewImgPopover.css +79 -6
  9. package/dist/ViewImgPreview.css +32 -0
  10. package/dist/{ViewImgPreview.vue_vue_type_style_index_0_lang-CYuLovBR.js → ViewImgPreview.vue_vue_type_style_index_0_lang-C2i0p5IK.js} +19 -9
  11. package/dist/components/cascader/index.js +1 -1
  12. package/dist/components/imgViewerHost/imgViewerStore.d.ts +5 -1
  13. package/dist/components/imgViewerHost/index.js +2 -2
  14. package/dist/components/index.js +15 -11
  15. package/dist/components/viewImg/ViewImg.vue.d.ts +9 -1
  16. package/dist/components/viewImg/index.js +1 -1
  17. package/dist/components/viewImgPopover/ViewImgPopover.vue.d.ts +25 -4
  18. package/dist/components/viewImgPopover/index.js +1 -1
  19. package/dist/components/viewImgPreview/ViewImgPreview.vue.d.ts +4 -1
  20. package/dist/components/viewImgPreview/index.d.ts +2 -2
  21. package/dist/components/viewImgPreview/index.js +11 -7
  22. package/dist/components/viewImgPreview/types.d.ts +15 -0
  23. package/dist/{imgViewerStore-C5n16uYa.js → imgViewerStore-DK3zvGf4.js} +7 -1
  24. package/dist/{index-CckJZ8N-.js → index-Ce_edAQB.js} +11 -7
  25. package/dist/index.js +25 -21
  26. package/dist/types-Ccn_sb6f.js +49 -0
  27. package/package.json +97 -92
  28. package/dist/ViewImgPopover-b9PDEYbP.js +0 -275
  29. package/dist/types-BNFeGRer.js +0 -32
@@ -1,275 +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 } from "element-plus/es";
33
- import { defineComponent, useAttrs, ref, computed, openBlock, createBlock, withCtx, createElementBlock, Fragment, normalizeStyle, createSlots, renderSlot, createVNode, createCommentVNode, mergeProps, unref } from "vue";
34
- import { L as LazyPopover } from "./LazyPopover-7ebuh-QG.js";
35
- import { F as FgViewImg } from "./ViewImg-Bg1AQ0T6.js";
36
- import { m as montageImgUrl } from "./montageImgUrl-CwgYnB2h.js";
37
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
38
- const HOVER_POPOVER_PADDING = 10;
39
- const HOVER_POPOVER_MAX_HEIGHT = 400;
40
- const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
41
- inheritAttrs: false
42
- }), {
43
- __name: "ViewImgPopover",
44
- props: {
45
- src: { default: "" },
46
- fit: {},
47
- lazy: { type: Boolean },
48
- loading: { type: Boolean },
49
- preview: { type: Boolean },
50
- previewSrcList: {},
51
- initialIndex: {},
52
- defImgPreviewIndex: {},
53
- infinite: { type: Boolean },
54
- zIndex: {},
55
- hideOnClickModal: { type: Boolean },
56
- closeOnPressEscape: { type: Boolean },
57
- previewTeleported: { type: Boolean },
58
- teleported: { type: Boolean },
59
- zoomRate: {},
60
- scale: {},
61
- minScale: {},
62
- maxScale: {},
63
- showProgress: { type: Boolean },
64
- toolbarBgColor: {},
65
- backgroundColor: {},
66
- toolbarIconColor: {},
67
- simpleExtraTools: {},
68
- renderExtraTools: {},
69
- originalToolbar: {},
70
- errorColor: {},
71
- errorOffset: {},
72
- errorText: {},
73
- ossProcess: { type: Boolean },
74
- ossLinks: {},
75
- imgSize: {},
76
- previewStripQuery: { type: Boolean },
77
- hoverSrc: { default: "" },
78
- hoverImgSize: { default: void 0 },
79
- hoverPopoverProps: { default: () => ({}) },
80
- isShowWatermark: { type: Boolean, default: false },
81
- waterMarkTitle: { default: "" }
82
- },
83
- emits: ["load", "error", "retry", "show", "close", "switch"],
84
- setup(__props, { emit: __emit }) {
85
- const props = __props;
86
- const emit = __emit;
87
- const attrs = useAttrs();
88
- const viewImgRef = ref(null);
89
- const viewImgProps = computed(() => {
90
- const _a = props, {
91
- hoverSrc: _h,
92
- hoverImgSize: _hi,
93
- hoverPopoverProps: _hp,
94
- isShowWatermark: _w,
95
- waterMarkTitle: _wt
96
- } = _a, rest = __objRest(_a, [
97
- "hoverSrc",
98
- "hoverImgSize",
99
- "hoverPopoverProps",
100
- "isShowWatermark",
101
- "waterMarkTitle"
102
- ]);
103
- return rest;
104
- });
105
- function mergePopperStyle(base, extra) {
106
- if (!extra) return base;
107
- if (typeof extra === "string") return extra;
108
- return __spreadValues(__spreadValues({}, base), extra);
109
- }
110
- const HOVER_POPOVER_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT}px`;
111
- const HOVER_IMAGE_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT - HOVER_POPOVER_PADDING * 2}px`;
112
- const hoverPopoverPropsMerged = computed(() => {
113
- var _a;
114
- const _b = (_a = props.hoverPopoverProps) != null ? _a : {}, { popperStyle: userPopperStyle, popperClass: userPopperClass } = _b, restHoverPopoverProps = __objRest(_b, ["popperStyle", "popperClass"]);
115
- const popperClass = [userPopperClass, "fg-view-img-popover"].filter(Boolean).join(" ");
116
- return __spreadValues({
117
- placement: "right",
118
- trigger: "hover",
119
- width: 400,
120
- teleported: true,
121
- popperClass,
122
- popperStyle: mergePopperStyle(
123
- {
124
- maxHeight: HOVER_POPOVER_MAX_HEIGHT_CSS,
125
- overflow: "hidden",
126
- padding: `${HOVER_POPOVER_PADDING}px`,
127
- boxSizing: "border-box"
128
- },
129
- userPopperStyle
130
- )
131
- }, restHoverPopoverProps);
132
- });
133
- function stripQueryParams(url) {
134
- const index = url.indexOf("?");
135
- return index === -1 ? url : url.slice(0, index);
136
- }
137
- function resolveImgUrl(url, imgSize) {
138
- if (!props.ossProcess) return url;
139
- return montageImgUrl(url, imgSize, props.ossLinks ? { ossLinks: props.ossLinks } : void 0);
140
- }
141
- function applyPreviewUrlFallback(url) {
142
- if (!props.previewStripQuery || !url) return url;
143
- return stripQueryParams(url);
144
- }
145
- function resolvePreviewImgUrl(url, imgSize) {
146
- return applyPreviewUrlFallback(resolveImgUrl(url, imgSize));
147
- }
148
- function resolveViewImgDisplaySrc() {
149
- var _a;
150
- const fromRef = (_a = viewImgRef.value) == null ? void 0 : _a.displaySrc;
151
- if (fromRef) return fromRef;
152
- if (!props.src) return "";
153
- return resolveImgUrl(props.src, props.imgSize);
154
- }
155
- const hoverPreviewSrc = computed(() => {
156
- var _a, _b, _c;
157
- const displaySrc = resolveViewImgDisplaySrc();
158
- const retried = (_b = (_a = viewImgRef.value) == null ? void 0 : _a.retried) != null ? _b : false;
159
- if (props.hoverSrc) {
160
- return resolvePreviewImgUrl(props.hoverSrc, (_c = props.hoverImgSize) != null ? _c : props.imgSize);
161
- }
162
- if (!props.src) return displaySrc || "";
163
- if (!props.hoverImgSize) return displaySrc || "";
164
- let url = resolveImgUrl(props.src, props.hoverImgSize);
165
- if (retried) url = stripQueryParams(url);
166
- return applyPreviewUrlFallback(url);
167
- });
168
- const hoverImgStyle = computed(() => ({
169
- display: "block",
170
- maxWidth: "100%",
171
- maxHeight: HOVER_IMAGE_MAX_HEIGHT_CSS,
172
- width: "auto",
173
- height: "auto",
174
- minWidth: "120px",
175
- minHeight: "120px",
176
- objectFit: "contain"
177
- }));
178
- return (_ctx, _cache) => {
179
- const _component_el_watermark = ElWatermark;
180
- return openBlock(), createBlock(LazyPopover, {
181
- class: "fg-view-img-popover__trigger",
182
- props: hoverPopoverPropsMerged.value
183
- }, {
184
- reference: withCtx(() => [
185
- createVNode(FgViewImg, mergeProps({
186
- ref_key: "viewImgRef",
187
- ref: viewImgRef,
188
- class: unref(attrs).class,
189
- style: unref(attrs).style
190
- }, viewImgProps.value, {
191
- onLoad: _cache[0] || (_cache[0] = (e) => emit("load", e)),
192
- onError: _cache[1] || (_cache[1] = (e) => emit("error", e)),
193
- onRetry: _cache[2] || (_cache[2] = (p) => emit("retry", p)),
194
- onShow: _cache[3] || (_cache[3] = (p) => emit("show", p)),
195
- onClose: _cache[4] || (_cache[4] = ($event) => emit("close")),
196
- onSwitch: _cache[5] || (_cache[5] = (i) => emit("switch", i))
197
- }), createSlots({ _: 2 }, [
198
- _ctx.$slots.placeholder ? {
199
- name: "placeholder",
200
- fn: withCtx(() => [
201
- renderSlot(_ctx.$slots, "placeholder", {}, void 0, true)
202
- ]),
203
- key: "0"
204
- } : void 0,
205
- _ctx.$slots.error ? {
206
- name: "error",
207
- fn: withCtx(() => [
208
- renderSlot(_ctx.$slots, "error", {}, void 0, true)
209
- ]),
210
- key: "1"
211
- } : void 0
212
- ]), 1040, ["class", "style"])
213
- ]),
214
- default: withCtx(() => [
215
- hoverPreviewSrc.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
216
- !__props.isShowWatermark ? (openBlock(), createBlock(FgViewImg, {
217
- key: 0,
218
- class: "fg-view-img-popover__hover-image",
219
- src: hoverPreviewSrc.value,
220
- style: normalizeStyle(hoverImgStyle.value),
221
- preview: false,
222
- "oss-process": false,
223
- "error-color": __props.errorColor,
224
- "error-offset": __props.errorOffset,
225
- "error-text": __props.errorText,
226
- fit: "contain"
227
- }, createSlots({ _: 2 }, [
228
- _ctx.$slots.error ? {
229
- name: "error",
230
- fn: withCtx(() => [
231
- renderSlot(_ctx.$slots, "error", {}, void 0, true)
232
- ]),
233
- key: "0"
234
- } : void 0
235
- ]), 1032, ["src", "style", "error-color", "error-offset", "error-text"])) : (openBlock(), createBlock(_component_el_watermark, {
236
- key: 1,
237
- class: "fg-view-img-popover__watermark",
238
- content: [__props.waterMarkTitle],
239
- gap: [10, 10],
240
- font: { fontSize: 16, color: "rgba(0, 0, 0, 0.3)" }
241
- }, {
242
- default: withCtx(() => [
243
- createVNode(FgViewImg, {
244
- class: "fg-view-img-popover__hover-image",
245
- src: hoverPreviewSrc.value,
246
- style: normalizeStyle(hoverImgStyle.value),
247
- preview: false,
248
- "oss-process": false,
249
- "error-color": __props.errorColor,
250
- "error-offset": __props.errorOffset,
251
- "error-text": __props.errorText,
252
- fit: "contain"
253
- }, createSlots({ _: 2 }, [
254
- _ctx.$slots.error ? {
255
- name: "error",
256
- fn: withCtx(() => [
257
- renderSlot(_ctx.$slots, "error", {}, void 0, true)
258
- ]),
259
- key: "0"
260
- } : void 0
261
- ]), 1032, ["src", "style", "error-color", "error-offset", "error-text"])
262
- ]),
263
- _: 3
264
- }, 8, ["content"]))
265
- ], 64)) : createCommentVNode("", true)
266
- ]),
267
- _: 3
268
- }, 8, ["props"]);
269
- };
270
- }
271
- }));
272
- const ViewImgPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6955cede"]]);
273
- export {
274
- ViewImgPopover as V
275
- };
@@ -1,32 +0,0 @@
1
- const DEFAULT_ORIGINAL_TOOLBAR = [
2
- "zoomOut",
3
- "zoomIn",
4
- "anticlockwise",
5
- "clockwise",
6
- "reset"
7
- ];
8
- const DEFAULT_TOOLBAR_BG_COLOR = "#606266";
9
- const DEFAULT_TOOLBAR_ICON_COLOR = "#ffffff";
10
- const DEFAULT_PREVIEW_HIDE_ON_CLICK_MODAL = false;
11
- const DEFAULT_PREVIEW_CLOSE_ON_PRESS_ESCAPE = true;
12
- const DEFAULT_PREVIEW_TELEPORTED = true;
13
- const DEFAULT_PREVIEW_INFINITE = true;
14
- const DEFAULT_PREVIEW_ZOOM_RATE = 1.2;
15
- const DEFAULT_PREVIEW_SCALE = 1;
16
- const DEFAULT_PREVIEW_MIN_SCALE = 0.2;
17
- const DEFAULT_PREVIEW_MAX_SCALE = 7;
18
- const DEFAULT_PREVIEW_SHOW_PROGRESS = false;
19
- export {
20
- DEFAULT_ORIGINAL_TOOLBAR as D,
21
- DEFAULT_PREVIEW_CLOSE_ON_PRESS_ESCAPE as a,
22
- DEFAULT_PREVIEW_HIDE_ON_CLICK_MODAL as b,
23
- DEFAULT_PREVIEW_INFINITE as c,
24
- DEFAULT_PREVIEW_MAX_SCALE as d,
25
- DEFAULT_PREVIEW_MIN_SCALE as e,
26
- DEFAULT_PREVIEW_SCALE as f,
27
- DEFAULT_PREVIEW_SHOW_PROGRESS as g,
28
- DEFAULT_PREVIEW_TELEPORTED as h,
29
- DEFAULT_PREVIEW_ZOOM_RATE as i,
30
- DEFAULT_TOOLBAR_BG_COLOR as j,
31
- DEFAULT_TOOLBAR_ICON_COLOR as k
32
- };