zf-dbs 1.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Z as e } from "./BpLzP99j.mjs";
1
+ import { Z as e } from "./DbOTUn3A.mjs";
2
2
  const t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
3
  __proto__: null,
4
4
  ZfScaleContainer: e,
@@ -1,29 +1,33 @@
1
- import { defineComponent as v, ref as h, onMounted as g, nextTick as w, onBeforeUnmount as $, computed as x, openBlock as _, createElementBlock as b, createElementVNode as E, normalizeStyle as F, unref as z, renderSlot as O } from "vue";
2
- import { _ as S } from "./CHgC5LLL.mjs";
3
- const y = /* @__PURE__ */ v({
1
+ import { defineComponent as v, ref as c, onMounted as w, onBeforeUnmount as $, computed as x, openBlock as _, createElementBlock as b, createElementVNode as E, normalizeStyle as F, unref as S, renderSlot as z, nextTick as O } from "vue";
2
+ import { _ as y } from "./CHgC5LLL.mjs";
3
+ const M = /* @__PURE__ */ v({
4
4
  __name: "zf-scale-container",
5
5
  props: {
6
6
  width: { default: void 0 },
7
7
  height: { default: void 0 },
8
8
  mode: { default: "aspectFit" }
9
9
  },
10
- setup(u) {
11
- const t = u, s = h(null), a = h(0), i = h(0), r = () => {
12
- a.value = s.value?.clientWidth || 0, i.value = s.value?.clientHeight || 0;
10
+ setup(f) {
11
+ const t = f, r = c(null), a = c(0), i = c(0);
12
+ let s = !1;
13
+ const o = () => {
14
+ s || (s = !0, O(() => {
15
+ a.value = r.value?.clientWidth || 0, i.value = r.value?.clientHeight || 0, s = !1;
16
+ }));
13
17
  };
14
- g(() => {
15
- window.addEventListener("resize", r), w(r), r();
18
+ w(() => {
19
+ window.addEventListener("resize", o), o();
16
20
  }), $(() => {
17
- window.removeEventListener("resize", r);
21
+ window.removeEventListener("resize", o);
18
22
  });
19
- const f = {
23
+ const m = {
20
24
  // 自适应模式
21
25
  adaptive(e) {
22
- const n = a.value / t.width, o = i.value / t.height, l = e ?? a.value < i.value, c = l ? n : o, p = l ? t.width : a.value / o, d = l ? i.value / n : t.height;
23
- return p < t.width || d < t.height ? Math.abs(n - o) > 0.2 ? this.aspectFit() : this.scaleToFill() : {
24
- width: `${p}px`,
25
- height: `${d}px`,
26
- transform: `scale(${c}, ${c}) translate(-50%, -50%)`,
26
+ const n = a.value / t.width, l = i.value / t.height, h = e ?? a.value < i.value, p = h ? n : l, d = h ? t.width : a.value / l, u = h ? i.value / n : t.height;
27
+ return d < t.width || u < t.height ? Math.abs(n - l) > 0.2 ? this.aspectFit() : this.scaleToFill() : {
28
+ width: `${d}px`,
29
+ height: `${u}px`,
30
+ transform: `scale(${p}, ${p}) translate(-50%, -50%)`,
27
31
  transformOrigin: "0 0",
28
32
  position: "absolute",
29
33
  top: "50%",
@@ -109,21 +113,21 @@ const y = /* @__PURE__ */ v({
109
113
  transform: "translate(-50%, -50%)"
110
114
  };
111
115
  }
112
- }, m = x(() => f[t.mode]?.() ?? {});
116
+ }, g = x(() => m[t.mode]?.() ?? {});
113
117
  return (e, n) => (_(), b("div", {
114
118
  ref_key: "containerElement",
115
- ref: s,
119
+ ref: r,
116
120
  class: "zf-scale-container"
117
121
  }, [
118
122
  E("div", {
119
123
  class: "zf-scale-wrapper",
120
- style: F(z(m))
124
+ style: F(S(g))
121
125
  }, [
122
- O(e.$slots, "default", {}, void 0, !0)
126
+ z(e.$slots, "default", {}, void 0, !0)
123
127
  ], 4)
124
128
  ], 512));
125
129
  }
126
- }), B = /* @__PURE__ */ S(y, [["__scopeId", "data-v-b6c691a2"]]);
130
+ }), L = /* @__PURE__ */ y(M, [["__scopeId", "data-v-21eb743f"]]);
127
131
  export {
128
- B as Z
132
+ L as Z
129
133
  };