xlzw-component 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xlzw-components
2
2
 
3
- 基于 Vue3 + Ant Design Vue 的自定义组件库。
3
+ 基于 Vue3 + Ant Design Vue 的自定义组件库,包含按钮、弹窗、删除确认对话框等组件。
4
4
 
5
5
  ## 技术栈
6
6
 
@@ -1,22 +1,23 @@
1
- import { ref as d, resolveComponent as Y, openBlock as $, createElementBlock as E, renderSlot as k, createCommentVNode as z, createBlock as L, withCtx as O, isRef as U, toRefs as q, customRef as F, toValue as u, watch as V, computed as R, unref as J, defineComponent as K, watchEffect as Q, createVNode as Z, createElementVNode as T, normalizeStyle as j, resolveDynamicComponent as ee, toDisplayString as te } from "vue";
2
- const W = (e, a) => {
3
- const t = e.__vccOpts || e;
4
- for (const [n, o] of a)
5
- t[n] = o;
6
- return t;
7
- }, ne = {
1
+ import { ref as s, resolveComponent as O, openBlock as x, createElementBlock as T, renderSlot as M, createCommentVNode as N, createBlock as Y, withCtx as k, isRef as J, toRefs as K, customRef as Q, toValue as u, watch as X, computed as A, unref as Z, defineComponent as j, watchEffect as ee, createVNode as P, createElementVNode as B, normalizeStyle as te, resolveDynamicComponent as ne, toDisplayString as I, createTextVNode as W } from "vue";
2
+ import "ant-design-vue";
3
+ const G = (e, l) => {
4
+ const n = e.__vccOpts || e;
5
+ for (const [t, o] of l)
6
+ n[t] = o;
7
+ return n;
8
+ }, oe = {
8
9
  key: 0,
9
10
  id: "reset"
10
- }, oe = {
11
+ }, le = {
11
12
  key: 1,
12
13
  id: "cancel"
13
- }, le = {
14
+ }, ie = {
14
15
  key: 2,
15
16
  id: "submit"
16
17
  }, ae = {
17
18
  key: 3,
18
19
  id: "sweep"
19
- }, ie = {
20
+ }, re = {
20
21
  __name: "xlzw-button",
21
22
  props: {
22
23
  type: {
@@ -24,230 +25,284 @@ const W = (e, a) => {
24
25
  }
25
26
  },
26
27
  setup(e) {
27
- const a = d(!0);
28
- return (t, n) => {
29
- const o = Y("a-button");
30
- return $(), E("div", null, [
31
- e.type == "reset" ? ($(), E("div", ne, [
32
- k(t.$slots, "default", {}, void 0, !0)
33
- ])) : z("", !0),
34
- e.type == "cancel" ? ($(), E("div", oe, [
35
- k(t.$slots, "default", {}, void 0, !0)
36
- ])) : e.type == "submit" ? ($(), E("div", le, [
37
- k(t.$slots, "default", {}, void 0, !0)
38
- ])) : e.type == "sweep" ? ($(), E("div", ae, [
39
- k(t.$slots, "default", {}, void 0, !0)
40
- ])) : e.type == "disabled" ? ($(), L(o, {
28
+ const l = s(!0);
29
+ return (n, t) => {
30
+ const o = O("a-button");
31
+ return x(), T("div", null, [
32
+ e.type == "reset" ? (x(), T("div", oe, [
33
+ M(n.$slots, "default", {}, void 0, !0)
34
+ ])) : N("", !0),
35
+ e.type == "cancel" ? (x(), T("div", le, [
36
+ M(n.$slots, "default", {}, void 0, !0)
37
+ ])) : e.type == "submit" ? (x(), T("div", ie, [
38
+ M(n.$slots, "default", {}, void 0, !0)
39
+ ])) : e.type == "sweep" ? (x(), T("div", ae, [
40
+ M(n.$slots, "default", {}, void 0, !0)
41
+ ])) : e.type == "disabled" ? (x(), Y(o, {
41
42
  key: 4,
42
43
  type: "primary",
43
- disabled: a.value
44
+ disabled: l.value
44
45
  }, {
45
- default: O(() => [
46
- k(t.$slots, "default", {}, void 0, !0)
46
+ default: k(() => [
47
+ M(n.$slots, "default", {}, void 0, !0)
47
48
  ]),
48
49
  _: 3
49
- }, 8, ["disabled"])) : z("", !0)
50
+ }, 8, ["disabled"])) : N("", !0)
50
51
  ]);
51
52
  };
52
53
  }
53
- }, he = /* @__PURE__ */ W(ie, [["__scopeId", "data-v-b09240e9"]]), I = typeof window < "u" && typeof document < "u";
54
+ }, xe = /* @__PURE__ */ G(re, [["__scopeId", "data-v-b09240e9"]]), H = typeof window < "u" && typeof document < "u";
54
55
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
55
- const re = Object.prototype.toString, ue = (e) => re.call(e) === "[object Object]";
56
- function A(e) {
56
+ const ue = Object.prototype.toString, se = (e) => ue.call(e) === "[object Object]";
57
+ function V(e) {
57
58
  return Array.isArray(e) ? e : [e];
58
59
  }
59
- function se(e, a = {}) {
60
- if (!U(e)) return q(e);
61
- const t = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
62
- for (const n in e.value) t[n] = F(() => ({
60
+ function de(e, l = {}) {
61
+ if (!J(e)) return K(e);
62
+ const n = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
63
+ for (const t in e.value) n[t] = Q(() => ({
63
64
  get() {
64
- return e.value[n];
65
+ return e.value[t];
65
66
  },
66
67
  set(o) {
67
- var i;
68
- if (!((i = u(a.replaceRef)) !== null && i !== void 0) || i) if (Array.isArray(e.value)) {
69
- const r = [...e.value];
70
- r[n] = o, e.value = r;
68
+ var r;
69
+ if (!((r = u(l.replaceRef)) !== null && r !== void 0) || r) if (Array.isArray(e.value)) {
70
+ const a = [...e.value];
71
+ a[t] = o, e.value = a;
71
72
  } else {
72
- const r = {
73
+ const a = {
73
74
  ...e.value,
74
- [n]: o
75
+ [t]: o
75
76
  };
76
- Object.setPrototypeOf(r, Object.getPrototypeOf(e.value)), e.value = r;
77
+ Object.setPrototypeOf(a, Object.getPrototypeOf(e.value)), e.value = a;
77
78
  }
78
- else e.value[n] = o;
79
+ else e.value[t] = o;
79
80
  }
80
81
  }));
81
- return t;
82
+ return n;
82
83
  }
83
- function de(e, a, t) {
84
- return V(e, a, {
85
- ...t,
84
+ function ce(e, l, n) {
85
+ return X(e, l, {
86
+ ...n,
86
87
  immediate: !0
87
88
  });
88
89
  }
89
- const N = I ? window : void 0;
90
- function ce(e) {
91
- var a;
92
- const t = u(e);
93
- return (a = t == null ? void 0 : t.$el) !== null && a !== void 0 ? a : t;
90
+ const U = H ? window : void 0;
91
+ function ve(e) {
92
+ var l;
93
+ const n = u(e);
94
+ return (l = n == null ? void 0 : n.$el) !== null && l !== void 0 ? l : n;
94
95
  }
95
- function P(...e) {
96
- const a = (n, o, i, r) => (n.addEventListener(o, i, r), () => n.removeEventListener(o, i, r)), t = R(() => {
97
- const n = A(u(e[0])).filter((o) => o != null);
98
- return n.every((o) => typeof o != "string") ? n : void 0;
96
+ function z(...e) {
97
+ const l = (t, o, r, a) => (t.addEventListener(o, r, a), () => t.removeEventListener(o, r, a)), n = A(() => {
98
+ const t = V(u(e[0])).filter((o) => o != null);
99
+ return t.every((o) => typeof o != "string") ? t : void 0;
99
100
  });
100
- return de(() => {
101
- var n, o;
101
+ return ce(() => {
102
+ var t, o;
102
103
  return [
103
- (n = (o = t.value) === null || o === void 0 ? void 0 : o.map((i) => ce(i))) !== null && n !== void 0 ? n : [N].filter((i) => i != null),
104
- A(u(t.value ? e[1] : e[0])),
105
- A(J(t.value ? e[2] : e[1])),
106
- u(t.value ? e[3] : e[2])
104
+ (t = (o = n.value) === null || o === void 0 ? void 0 : o.map((r) => ve(r))) !== null && t !== void 0 ? t : [U].filter((r) => r != null),
105
+ V(u(n.value ? e[1] : e[0])),
106
+ V(Z(n.value ? e[2] : e[1])),
107
+ u(n.value ? e[3] : e[2])
107
108
  ];
108
- }, ([n, o, i, r], c, h) => {
109
- if (!(n != null && n.length) || !(o != null && o.length) || !(i != null && i.length)) return;
110
- const x = ue(r) ? { ...r } : r, _ = n.flatMap((f) => o.flatMap((y) => i.map((b) => a(f, y, b, x))));
111
- h(() => {
112
- _.forEach((f) => f());
109
+ }, ([t, o, r, a], d, g) => {
110
+ if (!(t != null && t.length) || !(o != null && o.length) || !(r != null && r.length)) return;
111
+ const b = se(a) ? { ...a } : a, m = t.flatMap((v) => o.flatMap((f) => r.map((_) => l(v, f, _, b))));
112
+ g(() => {
113
+ m.forEach((v) => v());
113
114
  });
114
115
  }, { flush: "post" });
115
116
  }
116
- function ve(e, a = {}) {
117
- var t;
118
- const { pointerTypes: n, preventDefault: o, stopPropagation: i, exact: r, onMove: c, onEnd: h, onStart: x, initialValue: _, axis: f = "both", draggingElement: y = N, containerElement: b, handle: M = e, buttons: D = [0] } = a, p = d((t = u(_)) !== null && t !== void 0 ? t : {
117
+ function fe(e, l = {}) {
118
+ var n;
119
+ const { pointerTypes: t, preventDefault: o, stopPropagation: r, exact: a, onMove: d, onEnd: g, onStart: b, initialValue: m, axis: v = "both", draggingElement: f = U, containerElement: _, handle: D = e, buttons: S = [0] } = l, h = s((n = u(m)) !== null && n !== void 0 ? n : {
119
120
  x: 0,
120
121
  y: 0
121
- }), s = d(), S = (l) => n ? n.includes(l.pointerType) : !0, w = (l) => {
122
- u(o) && l.preventDefault(), u(i) && l.stopPropagation();
123
- }, B = (l) => {
124
- var v;
125
- if (!u(D).includes(l.button) || u(a.disabled) || !S(l) || u(r) && l.target !== u(e)) return;
126
- const m = u(b), C = m == null || (v = m.getBoundingClientRect) === null || v === void 0 ? void 0 : v.call(m), g = u(e).getBoundingClientRect(), X = {
127
- x: l.clientX - (m ? g.left - C.left + m.scrollLeft : g.left),
128
- y: l.clientY - (m ? g.top - C.top + m.scrollTop : g.top)
122
+ }), c = s(), E = (i) => t ? t.includes(i.pointerType) : !0, w = (i) => {
123
+ u(o) && i.preventDefault(), u(r) && i.stopPropagation();
124
+ }, R = (i) => {
125
+ var p;
126
+ if (!u(S).includes(i.button) || u(l.disabled) || !E(i) || u(a) && i.target !== u(e)) return;
127
+ const y = u(_), C = y == null || (p = y.getBoundingClientRect) === null || p === void 0 ? void 0 : p.call(y), $ = u(e).getBoundingClientRect(), L = {
128
+ x: i.clientX - (y ? $.left - C.left + y.scrollLeft : $.left),
129
+ y: i.clientY - (y ? $.top - C.top + y.scrollTop : $.top)
129
130
  };
130
- (x == null ? void 0 : x(X, l)) !== !1 && (s.value = X, w(l));
131
- }, G = (l) => {
132
- if (u(a.disabled) || !S(l) || !s.value) return;
133
- const v = u(b), m = u(e).getBoundingClientRect();
134
- let { x: C, y: g } = p.value;
135
- (f === "x" || f === "both") && (C = l.clientX - s.value.x, v && (C = Math.min(Math.max(0, C), v.scrollWidth - m.width))), (f === "y" || f === "both") && (g = l.clientY - s.value.y, v && (g = Math.min(Math.max(0, g), v.scrollHeight - m.height))), p.value = {
131
+ (b == null ? void 0 : b(L, i)) !== !1 && (c.value = L, w(i));
132
+ }, q = (i) => {
133
+ if (u(l.disabled) || !E(i) || !c.value) return;
134
+ const p = u(_), y = u(e).getBoundingClientRect();
135
+ let { x: C, y: $ } = h.value;
136
+ (v === "x" || v === "both") && (C = i.clientX - c.value.x, p && (C = Math.min(Math.max(0, C), p.scrollWidth - y.width))), (v === "y" || v === "both") && ($ = i.clientY - c.value.y, p && ($ = Math.min(Math.max(0, $), p.scrollHeight - y.height))), h.value = {
136
137
  x: C,
137
- y: g
138
- }, c == null || c(p.value, l), w(l);
139
- }, H = (l) => {
140
- u(a.disabled) || !S(l) || s.value && (s.value = void 0, h == null || h(p.value, l), w(l));
138
+ y: $
139
+ }, d == null || d(h.value, i), w(i);
140
+ }, F = (i) => {
141
+ u(l.disabled) || !E(i) || c.value && (c.value = void 0, g == null || g(h.value, i), w(i));
141
142
  };
142
- if (I) {
143
- const l = () => {
144
- var v;
143
+ if (H) {
144
+ const i = () => {
145
+ var p;
145
146
  return {
146
- capture: (v = a.capture) !== null && v !== void 0 ? v : !0,
147
+ capture: (p = l.capture) !== null && p !== void 0 ? p : !0,
147
148
  passive: !u(o)
148
149
  };
149
150
  };
150
- P(M, "pointerdown", B, l), P(y, "pointermove", G, l), P(y, "pointerup", H, l);
151
+ z(D, "pointerdown", R, i), z(f, "pointermove", q, i), z(f, "pointerup", F, i);
151
152
  }
152
153
  return {
153
- ...se(p),
154
- position: p,
155
- isDragging: R(() => !!s.value),
156
- style: R(() => `left:${p.value.x}px;top:${p.value.y}px;`)
154
+ ...de(h),
155
+ position: h,
156
+ isDragging: A(() => !!c.value),
157
+ style: A(() => `left:${h.value.x}px;top:${h.value.y}px;`)
157
158
  };
158
159
  }
159
- const fe = K({
160
+ const pe = j({
160
161
  props: {
161
162
  title: String,
162
163
  width: String
163
164
  },
164
165
  emits: ["resetData"],
165
- setup(e, a) {
166
- const t = d(!1), n = d(null), o = () => {
167
- t.value = !0;
168
- }, i = () => {
169
- a.emit("resetData");
170
- }, { x: r, y: c, isDragging: h } = ve(n), x = (w) => {
171
- t.value = !1;
172
- }, _ = d(0), f = d(0), y = d(!1), b = d(0), M = d(0), D = d(0), p = d(0), s = d({
166
+ setup(e, l) {
167
+ const n = s(!1), t = s(null), o = () => {
168
+ n.value = !0;
169
+ }, r = () => {
170
+ l.emit("resetData");
171
+ }, { x: a, y: d, isDragging: g } = fe(t), b = (w) => {
172
+ n.value = !1;
173
+ }, m = s(0), v = s(0), f = s(!1), _ = s(0), D = s(0), S = s(0), h = s(0), c = s({
173
174
  left: 0,
174
175
  right: 0,
175
176
  top: 0,
176
177
  bottom: 0
177
178
  });
178
- V([r, c], () => {
179
- if (!y.value) {
180
- _.value = r.value, f.value = c.value;
181
- const w = document.body.getBoundingClientRect(), B = n.value.getBoundingClientRect();
182
- s.value.right = w.width - B.width, s.value.bottom = w.height - B.height, D.value = b.value, p.value = M.value;
179
+ X([a, d], () => {
180
+ if (!f.value) {
181
+ m.value = a.value, v.value = d.value;
182
+ const w = document.body.getBoundingClientRect(), R = t.value.getBoundingClientRect();
183
+ c.value.right = w.width - R.width, c.value.bottom = w.height - R.height, S.value = _.value, h.value = D.value;
183
184
  }
184
- y.value = !0;
185
- }), V(h, () => {
186
- h || (y.value = !1);
187
- }), Q(() => {
188
- y.value && (b.value = D.value + Math.min(
189
- Math.max(s.value.left, r.value),
190
- s.value.right
191
- ) - _.value, M.value = p.value + Math.min(
192
- Math.max(s.value.top, c.value),
193
- s.value.bottom
194
- ) - f.value);
185
+ f.value = !0;
186
+ }), X(g, () => {
187
+ g || (f.value = !1);
188
+ }), ee(() => {
189
+ f.value && (_.value = S.value + Math.min(
190
+ Math.max(c.value.left, a.value),
191
+ c.value.right
192
+ ) - m.value, D.value = h.value + Math.min(
193
+ Math.max(c.value.top, d.value),
194
+ c.value.bottom
195
+ ) - v.value);
195
196
  });
196
- const S = R(() => ({
197
- transform: `translate(${b.value}px, ${M.value}px)`
197
+ const E = A(() => ({
198
+ transform: `translate(${_.value}px, ${D.value}px)`
198
199
  }));
199
200
  return {
200
- visible: t,
201
+ visible: n,
201
202
  showModal: o,
202
- handleCancel: x,
203
- modalTitleRef: n,
204
- transformStyle: S,
205
- cancel: i
203
+ handleCancel: b,
204
+ modalTitleRef: t,
205
+ transformStyle: E,
206
+ cancel: r
206
207
  };
207
208
  }
208
- }), pe = { style: { background: "#fff", "border-radius": "5px" } }, me = { style: { background: "rgb(255, 255, 255)", height: "44px", display: "flex", "align-items": "center", "justify-content": "end", "margin-top": "10px", padding: "0 10px", "border-radius": "5px" } };
209
- function ye(e, a, t, n, o, i) {
210
- const r = Y("a-modal");
211
- return $(), E("div", null, [
212
- Z(r, {
209
+ }), me = { style: { background: "#fff", "border-radius": "5px" } }, he = { style: { background: "rgb(255, 255, 255)", height: "44px", display: "flex", "align-items": "center", "justify-content": "end", "margin-top": "10px", padding: "0 10px", "border-radius": "5px" } };
210
+ function ye(e, l, n, t, o, r) {
211
+ const a = O("a-modal");
212
+ return x(), T("div", null, [
213
+ P(a, {
213
214
  destroyOnClose: "",
214
215
  maskClosable: !1,
215
216
  onCancel: e.cancel,
216
217
  ref: "modalRef",
217
218
  visible: e.visible,
218
- "onUpdate:visible": a[0] || (a[0] = (c) => e.visible = c),
219
+ "onUpdate:visible": l[0] || (l[0] = (d) => e.visible = d),
219
220
  "wrap-style": { overflow: "hidden" },
220
221
  width: e.width,
221
222
  footer: null
222
223
  }, {
223
- title: O(() => [
224
- T("div", {
224
+ title: k(() => [
225
+ B("div", {
225
226
  ref: "modalTitleRef",
226
227
  style: { width: "100%", cursor: "move", color: "#fff" }
227
- }, te(e.title), 513)
228
+ }, I(e.title), 513)
228
229
  ]),
229
- modalRender: O(({ originVNode: c }) => [
230
- T("div", {
231
- style: j(e.transformStyle)
230
+ modalRender: k(({ originVNode: d }) => [
231
+ B("div", {
232
+ style: te(e.transformStyle)
232
233
  }, [
233
- ($(), L(ee(c)))
234
+ (x(), Y(ne(d)))
234
235
  ], 4)
235
236
  ]),
236
- default: O(() => [
237
- T("div", pe, [
238
- k(e.$slots, "content", {}, void 0, !0)
237
+ default: k(() => [
238
+ B("div", me, [
239
+ M(e.$slots, "content", {}, void 0, !0)
239
240
  ]),
240
- T("div", me, [
241
- k(e.$slots, "footer", {}, void 0, !0)
241
+ B("div", he, [
242
+ M(e.$slots, "footer", {}, void 0, !0)
242
243
  ])
243
244
  ]),
244
245
  _: 3
245
246
  }, 8, ["onCancel", "visible", "width"])
246
247
  ]);
247
248
  }
248
- const be = /* @__PURE__ */ W(fe, [["render", ye], ["__scopeId", "data-v-868a4dd6"]]);
249
+ const ke = /* @__PURE__ */ G(pe, [["render", ye], ["__scopeId", "data-v-868a4dd6"]]), ge = { style: { "font-size": "13px", "font-weight": "700", padding: "15px 0px", height: "116px" } }, be = { style: { padding: "0 24px" } }, we = {
250
+ __name: "xlzw-deletePrompt",
251
+ emits: ["delOk"],
252
+ setup(e, { expose: l, emit: n }) {
253
+ const t = s(null), o = s("");
254
+ function r() {
255
+ g("delOk"), a();
256
+ }
257
+ function a() {
258
+ o.value = "", t.value.handleCancel();
259
+ }
260
+ function d(b) {
261
+ o.value = b, t.value.showModal();
262
+ }
263
+ const g = n;
264
+ return l({ showModal: d }), (b, m) => {
265
+ const v = O("Title"), f = O("Button"), _ = O("Modal");
266
+ return x(), Y(_, {
267
+ width: "430px",
268
+ ref_key: "modalRef",
269
+ ref: t,
270
+ title: "确认对话框"
271
+ }, {
272
+ content: k(() => [
273
+ B("div", ge, [
274
+ P(v, { title: "提交" }),
275
+ B("div", be, I(o.value), 1)
276
+ ])
277
+ ]),
278
+ footer: k(() => [
279
+ P(f, {
280
+ type: "reset",
281
+ onClick: a
282
+ }, {
283
+ default: k(() => [...m[0] || (m[0] = [
284
+ W("取消", -1)
285
+ ])]),
286
+ _: 1
287
+ }),
288
+ P(f, {
289
+ type: "submit",
290
+ onClick: r
291
+ }, {
292
+ default: k(() => [...m[1] || (m[1] = [
293
+ W("确定", -1)
294
+ ])]),
295
+ _: 1
296
+ })
297
+ ]),
298
+ _: 1
299
+ }, 512);
300
+ };
301
+ }
302
+ };
249
303
  export {
250
- he as XlzwButton,
251
- be as model
304
+ xe as Button,
305
+ we as DeletePrompt,
306
+ ke as Model
252
307
  };
253
308
  //# sourceMappingURL=xlzw-component.js.map