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.
- package/dist/chunks/{CkOTGeqV.mjs → Ck0Cdfr_.mjs} +1 -1
- package/dist/chunks/{BpLzP99j.mjs → DbOTUn3A.mjs} +25 -21
- package/dist/chunks/{DCtof1rf.mjs → qN7meZTV.mjs} +1256 -1249
- package/dist/components/zf-app.mjs +1 -1
- package/dist/components/zf-scale-container.mjs +1 -1
- package/dist/index.d.ts +44 -23
- package/dist/index.mjs +109 -95
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import { defineComponent as v, ref as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
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(
|
|
11
|
-
const t =
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
window.addEventListener("resize",
|
|
18
|
+
w(() => {
|
|
19
|
+
window.addEventListener("resize", o), o();
|
|
16
20
|
}), $(() => {
|
|
17
|
-
window.removeEventListener("resize",
|
|
21
|
+
window.removeEventListener("resize", o);
|
|
18
22
|
});
|
|
19
|
-
const
|
|
23
|
+
const m = {
|
|
20
24
|
// 自适应模式
|
|
21
25
|
adaptive(e) {
|
|
22
|
-
const n = a.value / t.width,
|
|
23
|
-
return
|
|
24
|
-
width: `${
|
|
25
|
-
height: `${
|
|
26
|
-
transform: `scale(${
|
|
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
|
-
},
|
|
116
|
+
}, g = x(() => m[t.mode]?.() ?? {});
|
|
113
117
|
return (e, n) => (_(), b("div", {
|
|
114
118
|
ref_key: "containerElement",
|
|
115
|
-
ref:
|
|
119
|
+
ref: r,
|
|
116
120
|
class: "zf-scale-container"
|
|
117
121
|
}, [
|
|
118
122
|
E("div", {
|
|
119
123
|
class: "zf-scale-wrapper",
|
|
120
|
-
style: F(
|
|
124
|
+
style: F(S(g))
|
|
121
125
|
}, [
|
|
122
|
-
|
|
126
|
+
z(e.$slots, "default", {}, void 0, !0)
|
|
123
127
|
], 4)
|
|
124
128
|
], 512));
|
|
125
129
|
}
|
|
126
|
-
}),
|
|
130
|
+
}), L = /* @__PURE__ */ y(M, [["__scopeId", "data-v-21eb743f"]]);
|
|
127
131
|
export {
|
|
128
|
-
|
|
132
|
+
L as Z
|
|
129
133
|
};
|