fangguo-component 1.2.5 → 1.2.6

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.
@@ -36,7 +36,8 @@ import { V as ViewImgErrorFallback, F as FgViewImg, u as useViewImgDefaults } fr
36
36
  import { h as hasPlatformImageResizeParams, m as montageImgUrl } from "./montageImgUrl-B9ZmJ7TF.js";
37
37
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
38
38
  const HOVER_POPOVER_PADDING = 10;
39
- const HOVER_POPOVER_MAX_HEIGHT = 400;
39
+ const DEFAULT_HOVER_BOX_WIDTH = 400;
40
+ const DEFAULT_HOVER_BOX_HEIGHT = 380;
40
41
  const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
41
42
  inheritAttrs: false
42
43
  }), {
@@ -62,7 +63,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
62
63
  maxScale: {},
63
64
  showProgress: { type: Boolean },
64
65
  toolbarBgColor: {},
65
- backgroundColor: {},
66
+ hoverBackgroundColor: {},
67
+ hoverBoxWidth: {},
68
+ hoverBoxHeight: {},
66
69
  toolbarIconColor: {},
67
70
  simpleExtraTools: {},
68
71
  renderExtraTools: {},
@@ -118,6 +121,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
118
121
  return ((_a = props.fallbackColor) == null ? void 0 : _a.trim()) || ((_b = props.loadingIconColor) == null ? void 0 : _b.trim()) || viewImgDefaults.loadingIconColor || "";
119
122
  }
120
123
  );
124
+ const resolvedHoverBackgroundColor = computed(() => {
125
+ var _a;
126
+ return ((_a = props.hoverBackgroundColor) == null ? void 0 : _a.trim()) || "";
127
+ });
121
128
  const shouldEnableReferencePreview = computed(() => {
122
129
  var _a;
123
130
  return props.preview || !!((_a = props.previewSrcList) == null ? void 0 : _a.length);
@@ -133,7 +140,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
133
140
  showPreviewIcon: _spi,
134
141
  showHoverOnError: _shoe,
135
142
  loadingIconColor: _lic,
136
- fallbackColor: _fc
143
+ fallbackColor: _fc,
144
+ hoverBackgroundColor: _hbc,
145
+ hoverBoxWidth: _hbw,
146
+ hoverBoxHeight: _hbh
137
147
  } = _a, rest = __objRest(_a, [
138
148
  "hoverSrc",
139
149
  "previewSrc",
@@ -144,7 +154,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
144
154
  "showPreviewIcon",
145
155
  "showHoverOnError",
146
156
  "loadingIconColor",
147
- "fallbackColor"
157
+ "fallbackColor",
158
+ "hoverBackgroundColor",
159
+ "hoverBoxWidth",
160
+ "hoverBoxHeight"
148
161
  ]);
149
162
  return __spreadProps(__spreadValues({}, rest), {
150
163
  fallbackColor: resolvedFallbackColor.value,
@@ -152,7 +165,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
152
165
  });
153
166
  });
154
167
  const referenceViewImgBind = computed(() => {
155
- const _a = attrs, { class: _class, style: _style } = _a, rest = __objRest(_a, ["class", "style"]);
168
+ const _a = attrs, {
169
+ class: _class,
170
+ style: _style,
171
+ backgroundColor: _backgroundColor,
172
+ "background-color": _backgroundColorKebab
173
+ } = _a, rest = __objRest(_a, [
174
+ "class",
175
+ "style",
176
+ "backgroundColor",
177
+ "background-color"
178
+ ]);
156
179
  return __spreadValues(__spreadValues({}, rest), viewImgProps.value);
157
180
  });
158
181
  const handlePreviewIconClick = () => {
@@ -165,9 +188,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
165
188
  if (typeof extra === "string") return extra;
166
189
  return __spreadValues(__spreadValues({}, base), extra);
167
190
  };
168
- const HOVER_POPOVER_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT}px`;
169
- const HOVER_IMAGE_MAX_HEIGHT_CSS = `${HOVER_POPOVER_MAX_HEIGHT - HOVER_POPOVER_PADDING * 2}px`;
170
191
  const DEFAULT_HOVER_IMG_SIZE = { h: 420 };
192
+ const formatCssSize = (size) => typeof size === "number" ? `${size}px` : size;
193
+ const resolvedHoverBoxWidth = computed(() => {
194
+ var _a, _b;
195
+ const width = (_b = props.hoverBoxWidth) != null ? _b : (_a = props.hoverPopoverProps) == null ? void 0 : _a.width;
196
+ return width != null ? width : DEFAULT_HOVER_BOX_WIDTH;
197
+ });
198
+ const resolvedHoverBoxHeightCss = computed(
199
+ () => {
200
+ var _a;
201
+ return formatCssSize((_a = props.hoverBoxHeight) != null ? _a : DEFAULT_HOVER_BOX_HEIGHT);
202
+ }
203
+ );
204
+ const resolvedHoverPopoverMaxHeight = computed(
205
+ () => `calc(${resolvedHoverBoxHeightCss.value} + ${HOVER_POPOVER_PADDING * 2}px)`
206
+ );
171
207
  const defaultSlotPayload = computed(() => {
172
208
  var _a, _b;
173
209
  return {
@@ -188,17 +224,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
188
224
  );
189
225
  const hoverPopoverPropsMerged = computed(() => {
190
226
  var _a;
191
- const _b = (_a = props.hoverPopoverProps) != null ? _a : {}, { popperStyle: userPopperStyle, popperClass: userPopperClass } = _b, restHoverPopoverProps = __objRest(_b, ["popperStyle", "popperClass"]);
227
+ const _b = (_a = props.hoverPopoverProps) != null ? _a : {}, {
228
+ width: _userWidth,
229
+ popperStyle: userPopperStyle,
230
+ popperClass: userPopperClass
231
+ } = _b, restHoverPopoverProps = __objRest(_b, [
232
+ "width",
233
+ "popperStyle",
234
+ "popperClass"
235
+ ]);
192
236
  const popperClass = [userPopperClass, "fg-view-img-popover"].filter(Boolean).join(" ");
193
237
  return __spreadValues({
194
238
  placement: "right",
195
239
  trigger: "hover",
196
- width: 400,
240
+ width: resolvedHoverBoxWidth.value,
197
241
  teleported: true,
198
242
  popperClass,
199
243
  popperStyle: mergePopperStyle(
200
244
  {
201
- maxHeight: HOVER_POPOVER_MAX_HEIGHT_CSS,
245
+ maxHeight: resolvedHoverPopoverMaxHeight.value,
202
246
  overflow: "hidden",
203
247
  padding: `${HOVER_POPOVER_PADDING}px`,
204
248
  boxSizing: "border-box"
@@ -263,7 +307,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
263
307
  });
264
308
  const hoverImgStyle = computed(() => ({
265
309
  width: "100%",
266
- height: HOVER_IMAGE_MAX_HEIGHT_CSS
310
+ height: resolvedHoverBoxHeightCss.value,
311
+ backgroundColor: resolvedHoverBackgroundColor.value || void 0
312
+ }));
313
+ const hoverWatermarkStyle = computed(() => ({
314
+ width: "100%",
315
+ height: resolvedHoverBoxHeightCss.value,
316
+ maxHeight: resolvedHoverBoxHeightCss.value
267
317
  }));
268
318
  return (_ctx, _cache) => {
269
319
  const _component_el_watermark = ElWatermark;
@@ -334,6 +384,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
334
384
  ], 4)) : (openBlock(), createBlock(_component_el_watermark, {
335
385
  key: 1,
336
386
  class: "fg-view-img-popover__watermark",
387
+ style: normalizeStyle(hoverWatermarkStyle.value),
337
388
  content: [resolvedWaterMarkTitle.value],
338
389
  gap: [10, 10],
339
390
  font: { fontSize: 16, color: "rgba(0, 0, 0, 0.3)" }
@@ -356,7 +407,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
356
407
  ], 4)
357
408
  ]),
358
409
  _: 3
359
- }, 8, ["content"]))
410
+ }, 8, ["style", "content"]))
360
411
  ], 64)) : !__props.isShowWatermark ? (openBlock(), createBlock(FgViewImg, {
361
412
  key: 1,
362
413
  class: "fg-view-img-popover__hover-image",
@@ -395,6 +446,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
395
446
  ]), 1032, ["src", "style", "fallback-color", "error-text", "loading"])) : (openBlock(), createBlock(_component_el_watermark, {
396
447
  key: 2,
397
448
  class: "fg-view-img-popover__watermark",
449
+ style: normalizeStyle(hoverWatermarkStyle.value),
398
450
  content: [resolvedWaterMarkTitle.value],
399
451
  gap: [10, 10],
400
452
  font: { fontSize: 16, color: "rgba(0, 0, 0, 0.3)" }
@@ -437,7 +489,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
437
489
  ]), 1032, ["src", "style", "fallback-color", "error-text", "loading"])
438
490
  ]),
439
491
  _: 3
440
- }, 8, ["content"]))
492
+ }, 8, ["style", "content"]))
441
493
  ], 64)) : createCommentVNode("", true)
442
494
  ]),
443
495
  _: 3
@@ -457,7 +509,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
457
509
  };
458
510
  }
459
511
  }));
460
- const ViewImgPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fe90e338"]]);
512
+ const ViewImgPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0c64a317"]]);
461
513
  export {
462
514
  ViewImgPopover as V
463
515
  };
@@ -1,12 +1,12 @@
1
1
  @charset "UTF-8";
2
2
  /* :where 降低默认宽高优先级,避免压过外部 Tailwind 等工具类(如 w-[200px]) */
3
- :where(.fg-view-img-popover__reference[data-v-fe90e338]) {
3
+ :where(.fg-view-img-popover__reference[data-v-0c64a317]) {
4
4
  position: relative;
5
5
  display: block;
6
6
  width: 100%;
7
7
  height: 100%;
8
8
  }
9
- .fg-view-img-popover__preview-icon[data-v-fe90e338] {
9
+ .fg-view-img-popover__preview-icon[data-v-0c64a317] {
10
10
  position: absolute;
11
11
  top: 4px;
12
12
  right: 4px;
@@ -18,21 +18,21 @@
18
18
  color: var(--el-text-color-primary);
19
19
  cursor: pointer;
20
20
  }
21
- .fg-view-img-popover__preview-icon[data-v-fe90e338]:hover {
21
+ .fg-view-img-popover__preview-icon[data-v-0c64a317]:hover {
22
22
  color: var(--el-color-primary);
23
23
  }
24
- .fg-view-img-popover__hover-image[data-v-fe90e338] {
24
+ .fg-view-img-popover__hover-image[data-v-0c64a317] {
25
25
  display: block;
26
26
  vertical-align: top;
27
27
  background: #7f7f7f;
28
28
  }
29
- .fg-view-img-popover__hover-image[data-v-fe90e338] .fg-view-img__inner {
29
+ .fg-view-img-popover__hover-image[data-v-0c64a317] .fg-view-img__inner {
30
30
  width: 100%;
31
31
  height: 100%;
32
32
  object-fit: contain;
33
33
  }
34
- .fg-view-img-popover__hover-image[data-v-fe90e338] .fg-view-img__placeholder,
35
- .fg-view-img-popover__hover-image[data-v-fe90e338] .fg-view-img__error {
34
+ .fg-view-img-popover__hover-image[data-v-0c64a317] .fg-view-img__placeholder,
35
+ .fg-view-img-popover__hover-image[data-v-0c64a317] .fg-view-img__error {
36
36
  position: absolute;
37
37
  inset: 0;
38
38
  display: flex;
@@ -41,7 +41,7 @@
41
41
  background: #f5f7fa;
42
42
  line-height: 1.4;
43
43
  }
44
- .fg-view-img-popover__hover-error[data-v-fe90e338] {
44
+ .fg-view-img-popover__hover-error[data-v-0c64a317] {
45
45
  display: flex;
46
46
  align-items: center;
47
47
  justify-content: center;
@@ -32,7 +32,7 @@ import { S as S2 } from "../SelectTree-BHvvkiQi.js";
32
32
  import { S as S3 } from "../SvgIcon-DIg0upEk.js";
33
33
  import { T } from "../TextCopy-lpbeqOUI.js";
34
34
  import { F, V, c as c2, r as r2, u } from "../ViewImg-CLRjYOUN.js";
35
- import { V as V2 } from "../ViewImgPopover-BtFnYval.js";
35
+ import { V as V2 } from "../ViewImgPopover-koNFPgjR.js";
36
36
  import { I, P, g as g2, u as u2, a as a2 } from "../imgViewerStore-Ajm-L7R5.js";
37
37
  import { V as V3 } from "../VirtualTable-Cm_L7q9W.js";
38
38
  export {
@@ -2,6 +2,7 @@ import { VNode } from 'vue';
2
2
  import { ImgSizeOptions } from '../../tools/imgUrl';
3
3
  import { OriginalToolbarItem, SimpleCustomTool, PreviewShowPayload, PreviewSideNav } from '../viewImgPreview/types';
4
4
  type ObjectFit = "fill" | "contain" | "cover" | "none" | "scale-down" | "";
5
+ type CssSize = string | number;
5
6
  type __VLS_Props = {
6
7
  /** 图片地址 */
7
8
  src?: string;
@@ -43,8 +44,12 @@ type __VLS_Props = {
43
44
  showProgress?: boolean;
44
45
  /** 预览工具栏背景色 */
45
46
  toolbarBgColor?: string;
46
- /** 兼容旧字段,等同 `toolbarBgColor` */
47
- backgroundColor?: string;
47
+ /** 悬停 Popover 大图背景色 */
48
+ hoverBackgroundColor?: string;
49
+ /** 悬停 Popover 大图盒子宽度;默认保持当前 400 */
50
+ hoverBoxWidth?: CssSize;
51
+ /** 悬停 Popover 大图盒子高度;默认保持当前 380px */
52
+ hoverBoxHeight?: CssSize;
48
53
  /** 预览工具栏图标/文字颜色 */
49
54
  toolbarIconColor?: string;
50
55
  /** 预览工具栏自定义工具 */
@@ -1,4 +1,4 @@
1
- import { V } from "../../ViewImgPopover-BtFnYval.js";
1
+ import { V } from "../../ViewImgPopover-koNFPgjR.js";
2
2
  export {
3
3
  V as FgViewImgPopover
4
4
  };
@@ -32,7 +32,7 @@ import { S as SelectTree } from "./SelectTree-BHvvkiQi.js";
32
32
  import { S as SvgIcon } from "./SvgIcon-DIg0upEk.js";
33
33
  import { T as TextCopy } from "./TextCopy-lpbeqOUI.js";
34
34
  import { F as FgViewImg, V as ViewImgErrorFallback, c as configureViewImgDefaults, r as resetViewImgDefaults, u as useViewImgDefaults } from "./ViewImg-CLRjYOUN.js";
35
- import { V as ViewImgPopover } from "./ViewImgPopover-BtFnYval.js";
35
+ import { V as ViewImgPopover } from "./ViewImgPopover-koNFPgjR.js";
36
36
  import { I as ImgViewerStore, P as PREVIEW_BASE_Z_INDEX, g as getDialogZindex, u as useImgViewerState, a as useImgViewerStore } from "./imgViewerStore-Ajm-L7R5.js";
37
37
  import { V as VirtualTable } from "./VirtualTable-Cm_L7q9W.js";
38
38
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __spreadValues = (a10, b4) => {
14
14
  }
15
15
  return a10;
16
16
  };
17
- import { c as components } from "./index-wDrpgKQT.js";
17
+ import { c as components } from "./index-CNW8PtZ1.js";
18
18
  import { t as tools } from "./index-DsfY1yqo.js";
19
19
  import { d as directives } from "./index-CSMWzzp0.js";
20
20
  import { h as hooks } from "./index-DfQiknXJ.js";
@@ -55,7 +55,7 @@ import { S as S2 } from "./SelectTree-BHvvkiQi.js";
55
55
  import { S as S3 } from "./SvgIcon-DIg0upEk.js";
56
56
  import { T } from "./TextCopy-lpbeqOUI.js";
57
57
  import { F, V, c as c2, r as r3, u } from "./ViewImg-CLRjYOUN.js";
58
- import { V as V2 } from "./ViewImgPopover-BtFnYval.js";
58
+ import { V as V2 } from "./ViewImgPopover-koNFPgjR.js";
59
59
  import { I, P, g as g3, u as u2, a as a3 } from "./imgViewerStore-Ajm-L7R5.js";
60
60
  import { V as V3 } from "./VirtualTable-Cm_L7q9W.js";
61
61
  import { a as a4, b as b3, c as c3, d as d3, e as e3, f as f3, g as g4, h as h3, i as i3, j as j3, k as k3, l as l4, m as m2, n as n2, o as o2, p, q, r as r4, s as s2, t as t2, u as u3, v, w, x, y, z, A, B as B2, C as C4, D as D4, E as E2, F as F2, G, H as H3, I as I2, J, K, L as L3, M as M3, N as N2, O, P as P2, Q, R, S as S4, T as T2, U, V as V4, W, X, Y, Z, _ as _17, $, a0, a1, a2 as a22, a3 as a32, a4 as a42, 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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fangguo-component",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",