zhihao-ui 1.2.51 → 1.2.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.2.51",
3
+ "version": "1.2.53",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",
@@ -1,197 +0,0 @@
1
- import { defineComponent as W, onBeforeMount as Z, useSlots as j, ref as u, computed as I, onMounted as z, onActivated as H, onUnmounted as U, onDeactivated as N, provide as g, watch as $, onBeforeUpdate as T, onUpdated as O, openBlock as L, createElementBlock as k, normalizeStyle as S, renderSlot as M, useAttrs as q, inject as v, watchEffect as F, withDirectives as J, vShow as K, reactive as Q } from "vue";
2
- import { g as V } from "./Table-xnTrdqL9.js";
3
- import { w as D } from "./utils-BSQSj8Ii.js";
4
- const X = /* @__PURE__ */ W({
5
- name: "Grid",
6
- __name: "Grid",
7
- props: {
8
- cols: { default: () => ({ xs: 1, sm: 2, md: 2, lg: 4, xl: 4 }) },
9
- collapsed: { type: Boolean, default: !1 },
10
- collapsedRows: { default: 1 },
11
- gap: { default: 16 }
12
- },
13
- setup(l, { expose: d }) {
14
- const t = l;
15
- Z(() => t.collapsed && y()), z(() => {
16
- a({ target: { innerWidth: window.innerWidth } }), window.addEventListener("resize", a);
17
- }), H(() => {
18
- a({ target: { innerWidth: window.innerWidth } }), window.addEventListener("resize", a);
19
- }), U(() => {
20
- window.removeEventListener("resize", a);
21
- }), N(() => {
22
- window.removeEventListener("resize", a);
23
- });
24
- const a = (o) => {
25
- let r = o.target.innerWidth;
26
- switch (!!r) {
27
- case r < 768:
28
- e.value = "xs";
29
- break;
30
- case (r >= 768 && r < 992):
31
- e.value = "sm";
32
- break;
33
- case (r >= 992 && r < 1200):
34
- e.value = "md";
35
- break;
36
- case (r >= 1200 && r < 1920):
37
- e.value = "lg";
38
- break;
39
- case r >= 1920:
40
- e.value = "xl";
41
- break;
42
- }
43
- };
44
- g("gap", Array.isArray(t.gap) ? t.gap[0] : t.gap);
45
- let e = u("xl");
46
- g("breakPoint", e);
47
- const c = u(-1);
48
- g("shouldHiddenIndex", c);
49
- const f = I(() => typeof t.cols == "object" ? t.cols[e.value] ?? t.cols : t.cols);
50
- g("cols", f);
51
- const m = j().default(), y = () => {
52
- var G, b, s, i;
53
- let o = [], r = null;
54
- m.forEach((n) => {
55
- var p;
56
- typeof n.type == "object" && n.type.name === "GridItem" && ((p = n.props) == null ? void 0 : p.suffix) !== void 0 && (r = n), typeof n.type == "symbol" && Array.isArray(n.children) && o.push(...n.children);
57
- });
58
- let w = 0;
59
- r && (w = (((G = r.props[e.value]) == null ? void 0 : G.span) ?? ((b = r.props) == null ? void 0 : b.span) ?? 1) + (((s = r.props[e.value]) == null ? void 0 : s.offset) ?? ((i = r.props) == null ? void 0 : i.offset) ?? 0));
60
- try {
61
- let n = !1;
62
- o.reduce((p = 0, C, P) => {
63
- var E, A, R, B;
64
- if (p += (((E = C.props[e.value]) == null ? void 0 : E.span) ?? ((A = C.props) == null ? void 0 : A.span) ?? 1) + (((R = C.props[e.value]) == null ? void 0 : R.offset) ?? ((B = C.props) == null ? void 0 : B.offset) ?? 0), Number(p) > t.collapsedRows * f.value - w)
65
- throw c.value = P, n = !0, "find it";
66
- return p;
67
- }, 0), n || (c.value = -1);
68
- } catch {
69
- }
70
- };
71
- $(
72
- () => e.value,
73
- () => {
74
- t.collapsed && y();
75
- }
76
- ), $(
77
- () => t.collapsed,
78
- (o) => {
79
- if (o) return y();
80
- c.value = -1;
81
- }
82
- );
83
- const _ = I(() => typeof t.gap == "number" ? `${t.gap}px` : Array.isArray(t.gap) ? `${t.gap[1]}px ${t.gap[0]}px` : "unset"), h = I(() => ({
84
- display: "grid",
85
- gridGap: _.value,
86
- gridTemplateColumns: `repeat(${f.value}, minmax(0, 1fr))`
87
- })), x = u(!1);
88
- return z(() => {
89
- x.value = !0;
90
- }), T(() => {
91
- x.value = !1;
92
- }), O(() => {
93
- x.value = !0;
94
- }), g("isRegistrationComplete", x), d({ breakPoint: e }), (o, r) => (L(), k("div", {
95
- style: S(h.value)
96
- }, [
97
- M(o.$slots, "default")
98
- ], 4));
99
- }
100
- }), Y = /* @__PURE__ */ W({
101
- name: "GridItem",
102
- __name: "GridItem",
103
- props: {
104
- offset: { default: 0 },
105
- span: { default: 1 },
106
- suffix: { type: Boolean, default: !1 },
107
- xs: { default: void 0 },
108
- sm: { default: void 0 },
109
- md: { default: void 0 },
110
- lg: { default: void 0 },
111
- xl: { default: void 0 },
112
- label: {}
113
- },
114
- setup(l) {
115
- const d = l, t = q(), a = u(!0), e = v("breakPoint", u("xl")), c = v("shouldHiddenIndex", u(-1));
116
- $(
117
- () => [c.value, e.value],
118
- (s) => {
119
- t.index && (a.value = !(s[0] !== -1 && parseInt(t.index) >= Number(s[0])));
120
- },
121
- { immediate: !0 }
122
- );
123
- const f = v("gap", 0), m = v("cols", u(4)), y = I(() => {
124
- var n, p;
125
- let s = ((n = d[e.value]) == null ? void 0 : n.span) ?? d.span, i = ((p = d[e.value]) == null ? void 0 : p.offset) ?? d.offset;
126
- return d.suffix ? {
127
- gridColumnStart: m.value - s - i + 1,
128
- gridColumnEnd: `span ${s + i}`,
129
- marginLeft: i !== 0 ? `calc(((100% + ${f}px) / ${s + i}) * ${i})` : "unset"
130
- } : {
131
- gridColumn: `span ${s + i > m.value ? m.value : s + i}/span ${s + i > m.value ? m.value : s + i}`,
132
- marginLeft: i !== 0 ? `calc(((100% + ${f}px) / ${s + i}) * ${i})` : "unset"
133
- };
134
- }), _ = v("isMultiGrid", u(!1)), h = u(null), x = u(0), o = u(0), r = v("registerGridItem", null), w = v(
135
- "getColumnData",
136
- null
137
- ), G = v("isRegistrationComplete", u(!1)), b = () => {
138
- if (h.value && r) {
139
- const s = h.value.parentElement;
140
- if (s) {
141
- const i = h.value.offsetLeft, n = s.offsetWidth / m.value;
142
- o.value = Math.floor(i / n) + 1, r(o.value, d.label || "");
143
- }
144
- }
145
- };
146
- return F(() => {
147
- if (_.value && G.value && d.label && h.value && (b(), w)) {
148
- const s = w(o.value);
149
- x.value = s.maxWidth || 0;
150
- }
151
- }), (s, i) => J((L(), k("div", {
152
- style: S(y.value),
153
- ref_key: "gridItemRef",
154
- ref: h
155
- }, [
156
- M(s.$slots, "default", {
157
- maxLabelWidthInCol: x.value,
158
- columnIndex: o.value
159
- })
160
- ], 4)), [
161
- [K, a.value]
162
- ]);
163
- }
164
- }), ee = () => {
165
- const l = Q({});
166
- return {
167
- gridItemData: l,
168
- registerGridItem: (a, e) => {
169
- var f;
170
- if (!e) return;
171
- l[a] || (l[a] = { labels: [], maxLength: 0, maxWidth: 0 }), (f = l[a]) == null || f.labels.push(e), l[a].maxLength = Math.max(
172
- e.length,
173
- l[a].maxLength
174
- );
175
- const c = Math.ceil(V(e, 14));
176
- l[a].maxWidth = Math.max(
177
- c || 0,
178
- l[a].maxWidth
179
- );
180
- },
181
- getColumnData: (a) => l[a] || {}
182
- };
183
- }, te = { class: "multi-grid" }, ae = /* @__PURE__ */ W({
184
- name: "MultiGrid",
185
- __name: "MultiGrid",
186
- setup(l) {
187
- const { getColumnData: d, registerGridItem: t } = ee();
188
- return g("registerGridItem", t), g("getColumnData", d), g("isMultiGrid", u(!0)), (a, e) => (L(), k("div", te, [
189
- M(a.$slots, "default")
190
- ]));
191
- }
192
- }), ne = D(X), le = D(Y), oe = D(ae);
193
- export {
194
- le as Z,
195
- ne as a,
196
- oe as b
197
- };