mwl-components 0.0.22 → 0.1.0

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/index.js CHANGED
@@ -1,73 +1,73 @@
1
- import { defineComponent as S, useSlots as j, ref as U, resolveComponent as u, createBlock as r, openBlock as a, normalizeClass as K, createSlots as N, withCtx as d, renderSlot as k, createElementVNode as H, createElementBlock as v, createCommentVNode as p, toDisplayString as $, createVNode as E, watch as Q, nextTick as X, computed as R, unref as L, mergeProps as D, normalizeStyle as A, createTextVNode as Y, Fragment as x, renderList as V, getCurrentInstance as Z, onMounted as ee, onUnmounted as te, withDirectives as G, vShow as J, resolveDynamicComponent as ae, normalizeProps as le, guardReactiveProps as ne } from "vue";
2
- const oe = { class: "flex items-center justify-between" }, re = { class: "flex items-center" }, ue = { class: "text-16px font-700" }, de = { class: "max-w-200px" }, se = {
1
+ import { defineComponent as E, useSlots as A, ref as N, resolveComponent as c, createBlock as f, openBlock as o, normalizeClass as K, createSlots as B, withCtx as i, renderSlot as w, createElementVNode as D, createElementBlock as _, createCommentVNode as Y, toDisplayString as H, createVNode as M, watch as Q, nextTick as X, computed as F, unref as O, mergeProps as z, normalizeStyle as j, createTextVNode as L, getCurrentInstance as U, Fragment as $, renderList as P, resolveDynamicComponent as T, h as I, onMounted as Z, onUnmounted as ee, withDirectives as q, vShow as G, normalizeProps as te, guardReactiveProps as ne } from "vue";
2
+ const oe = { class: "flex items-center justify-between" }, ae = { class: "flex items-center" }, le = { class: "text-16px font-700" }, re = { class: "max-w-200px" }, se = {
3
3
  key: 0,
4
4
  class: "flex justify-end"
5
- }, ce = {
5
+ }, ue = {
6
6
  key: 0,
7
7
  class: "mt-8px flex items-center"
8
- }, ie = /* @__PURE__ */ S({
8
+ }, ce = /* @__PURE__ */ E({
9
9
  name: "ContentWarp",
10
10
  __name: "index",
11
11
  props: {
12
12
  title: String,
13
13
  message: String
14
14
  },
15
- setup(t) {
16
- const i = j(), o = U("content-wrap");
17
- return (s, l) => {
18
- const m = u("ElIcon"), g = u("ElTooltip"), f = u("ElCard");
19
- return a(), r(f, {
20
- class: K([o.value, "mb-[10px]"]),
15
+ setup(e) {
16
+ const a = A(), l = N("content-wrap");
17
+ return (r, s) => {
18
+ const d = c("ElIcon"), h = c("ElTooltip"), u = c("ElCard");
19
+ return o(), f(u, {
20
+ class: K([l.value, "mb-[10px]"]),
21
21
  shadow: "never"
22
- }, N({
23
- default: d(() => [
24
- k(s.$slots, "default", {}, void 0, !0)
22
+ }, B({
23
+ default: i(() => [
24
+ w(r.$slots, "default", {}, void 0, !0)
25
25
  ]),
26
26
  _: 2
27
27
  }, [
28
- t.title ? {
28
+ e.title ? {
29
29
  name: "header",
30
- fn: d(() => [
31
- H("div", oe, [
32
- H("div", re, [
33
- H("span", ue, $(t.title), 1),
34
- t.message ? (a(), r(g, {
30
+ fn: i(() => [
31
+ D("div", oe, [
32
+ D("div", ae, [
33
+ D("span", le, H(e.title), 1),
34
+ e.message ? (o(), f(h, {
35
35
  key: 0,
36
36
  effect: "dark",
37
37
  placement: "right"
38
38
  }, {
39
- content: d(() => [
40
- H("div", de, $(t.message), 1)
39
+ content: i(() => [
40
+ D("div", re, H(e.message), 1)
41
41
  ]),
42
- default: d(() => [
43
- E(m, {
42
+ default: i(() => [
43
+ M(d, {
44
44
  size: 14,
45
45
  class: "ml-5px",
46
46
  icon: "ep:question-filled"
47
47
  })
48
48
  ]),
49
49
  _: 1
50
- })) : p("", !0)
50
+ })) : Y("", !0)
51
51
  ]),
52
- i.buttonTip ? (a(), v("div", se, [
53
- k(s.$slots, "buttonTip", {}, void 0, !0)
54
- ])) : p("", !0)
52
+ a.buttonTip ? (o(), _("div", se, [
53
+ w(r.$slots, "buttonTip", {}, void 0, !0)
54
+ ])) : Y("", !0)
55
55
  ]),
56
- i.descTip ? (a(), v("div", ce, [
57
- k(s.$slots, "descTip", {}, void 0, !0)
58
- ])) : p("", !0)
56
+ a.descTip ? (o(), _("div", ue, [
57
+ w(r.$slots, "descTip", {}, void 0, !0)
58
+ ])) : Y("", !0)
59
59
  ]),
60
60
  key: "0"
61
61
  } : void 0
62
62
  ]), 1032, ["class"]);
63
63
  };
64
64
  }
65
- }), T = (t, i) => {
66
- const o = t.__vccOpts || t;
67
- for (const [s, l] of i)
68
- o[s] = l;
69
- return o;
70
- }, me = /* @__PURE__ */ T(ie, [["__scopeId", "data-v-15c93817"]]), fe = { class: "dialog-header" }, he = /* @__PURE__ */ S({
65
+ }), W = (e, a) => {
66
+ const l = e.__vccOpts || e;
67
+ for (const [r, s] of a)
68
+ l[r] = s;
69
+ return l;
70
+ }, ie = /* @__PURE__ */ W(ce, [["__scopeId", "data-v-6e7d743c"]]), de = { class: "dialog-header" }, me = /* @__PURE__ */ E({
71
71
  name: "Dialog",
72
72
  __name: "index",
73
73
  props: {
@@ -92,78 +92,84 @@ const oe = { class: "flex items-center justify-between" }, re = { class: "flex i
92
92
  default: ""
93
93
  }
94
94
  },
95
- setup(t) {
96
- const i = j(), o = t, s = U(!1), l = () => {
97
- s.value = !L(s);
98
- }, m = U(o.maxHeight);
95
+ setup(e) {
96
+ const a = A(), l = e, r = N(l.fullscreen), s = () => {
97
+ r.value = !O(r);
98
+ }, d = N(l.maxHeight);
99
99
  Q(
100
- () => s.value,
101
- async (f) => {
102
- if (await X(), f) {
103
- const c = document.documentElement.offsetHeight;
104
- m.value = `${c - 55 - 40 - (i.footer ? 63 : 0)}px`;
100
+ () => r.value,
101
+ async (u) => {
102
+ if (await X(), u) {
103
+ const m = document.documentElement.offsetHeight;
104
+ d.value = `${m - 55 - 40 - (a.footer ? 63 : 0)}px`;
105
105
  } else
106
- m.value = o.maxHeight;
106
+ d.value = l.maxHeight;
107
107
  },
108
108
  {
109
109
  immediate: !0
110
110
  }
111
111
  );
112
- const g = R(() => {
113
- if (o.maxHeight)
112
+ const h = F(() => {
113
+ if (l.maxHeight)
114
114
  return {
115
- height: L(m)
115
+ height: O(d)
116
116
  };
117
117
  });
118
- return (f, c) => {
119
- const b = u("el-button"), y = u("ElScrollbar"), C = u("ElDialog");
120
- return a(), r(C, D(f.$attrs, {
118
+ return (u, m) => {
119
+ const y = c("FullScreen"), S = c("el-icon"), t = c("ElScrollbar"), n = c("ElDialog");
120
+ return o(), f(n, z(u.$attrs, {
121
121
  "close-on-click-modal": !1,
122
- fullscreen: s.value,
123
- width: t.width,
122
+ fullscreen: r.value,
123
+ width: e.width,
124
124
  "destroy-on-close": "",
125
125
  draggable: "",
126
126
  "lock-scroll": "",
127
127
  class: "custom-dialog",
128
128
  "append-to-body": ""
129
- }), N({
130
- header: d(() => [
131
- H("div", fe, [
132
- k(f.$slots, "title", {}, () => [
133
- Y($(t.title), 1)
134
- ]),
135
- H("div", { onClick: l }, [
136
- E(b, {
137
- link: "",
138
- icon: "FullScreen"
139
- })
140
- ])
141
- ])
142
- ]),
143
- default: d(() => [
144
- t.scroll ? (a(), r(y, {
129
+ }), B({
130
+ default: i(() => [
131
+ e.scroll ? (o(), f(t, {
145
132
  key: 0,
146
- style: A(g.value)
133
+ style: j(h.value)
147
134
  }, {
148
- default: d(() => [
149
- k(f.$slots, "default")
135
+ default: i(() => [
136
+ w(u.$slots, "default")
150
137
  ]),
151
138
  _: 3
152
- }, 8, ["style"])) : k(f.$slots, "default", { key: 1 })
139
+ }, 8, ["style"])) : w(u.$slots, "default", { key: 1 })
153
140
  ]),
154
141
  _: 2
155
142
  }, [
156
- i.footer ? {
157
- name: "footer",
158
- fn: d(() => [
159
- k(f.$slots, "footer")
143
+ e.title ? {
144
+ name: "header",
145
+ fn: i(() => [
146
+ D("div", de, [
147
+ w(u.$slots, "title", {}, () => [
148
+ L(H(e.title), 1)
149
+ ]),
150
+ D("div", { onClick: s }, [
151
+ M(S, { class: "fullScreen" }, {
152
+ default: i(() => [
153
+ M(y)
154
+ ]),
155
+ _: 1
156
+ })
157
+ ])
158
+ ])
160
159
  ]),
161
160
  key: "0"
161
+ } : void 0,
162
+ a.footer ? {
163
+ name: "footer",
164
+ fn: i(() => [
165
+ w(u.$slots, "footer")
166
+ ]),
167
+ key: "1"
162
168
  } : void 0
163
169
  ]), 1040, ["fullscreen", "width"]);
164
170
  };
165
171
  }
166
- }), pe = /* @__PURE__ */ S({
172
+ }), pe = { key: 1 }, fe = /* @__PURE__ */ E({
167
173
  name: "EasyForm",
168
174
  __name: "index",
169
175
  props: {
@@ -192,239 +198,251 @@ const oe = { class: "flex items-center justify-between" }, re = { class: "flex i
192
198
  default: "200px"
193
199
  }
194
200
  },
195
- setup(t, { expose: i }) {
196
- const o = U();
197
- return i({
198
- resetFields: () => {
199
- o.value?.resetFields();
201
+ setup(e) {
202
+ const a = U(), l = (t) => {
203
+ r(t, "formRef");
204
+ }, r = (t, n) => {
205
+ if (!t) {
206
+ delete a?.exposeProxy?.[n], delete a?.exposed?.[n];
207
+ return;
208
+ }
209
+ a.exposeProxy = {
210
+ ...a?.exposed,
211
+ [n]: t
212
+ }, a.exposed = {
213
+ ...a?.exposed,
214
+ [n]: t
215
+ };
216
+ }, s = (t) => {
217
+ let n = t.label;
218
+ return t.label && typeof t.label == "function" && (n = t.label()), t.type.indexOf("select") > -1 || t.type.indexOf("cascader") > -1 || t.type.indexOf("date") > -1 ? `请选择${n}` : `请输入${n}`;
219
+ }, d = {
220
+ valueFormat: "YYYY-MM-DD HH:mm:ss",
221
+ format: "YYYY-MM-DD HH:mm:ss"
222
+ }, h = (t) => {
223
+ const { options: n } = t;
224
+ return {
225
+ default: () => n?.map((p) => I(c("el-option"), {
226
+ label: p.label,
227
+ value: p.value,
228
+ key: p.value
229
+ }))
230
+ };
231
+ }, u = {
232
+ clearable: !0
233
+ }, m = [
234
+ {
235
+ type: "text",
236
+ component: "el-input",
237
+ attrs: {
238
+ ...u
239
+ }
240
+ },
241
+ {
242
+ type: "textarea",
243
+ component: "el-input",
244
+ attrs: {
245
+ ...u
246
+ }
247
+ },
248
+ {
249
+ type: "number",
250
+ component: "el-input-number",
251
+ attrs: {
252
+ controlsPosition: "right"
253
+ }
254
+ },
255
+ {
256
+ type: "switch",
257
+ component: "el-switch"
258
+ },
259
+ {
260
+ type: "checkbox",
261
+ component: "el-checkbox-group",
262
+ slots: (t) => {
263
+ const { options: n } = t;
264
+ return {
265
+ default: () => n?.map((p) => I(
266
+ c("el-checkbox"),
267
+ {
268
+ value: p.value
269
+ },
270
+ {
271
+ default: () => p.label
272
+ }
273
+ ))
274
+ };
275
+ }
276
+ },
277
+ {
278
+ type: "radio",
279
+ component: "el-radio-group",
280
+ slots: (t) => {
281
+ const { options: n } = t;
282
+ return {
283
+ default: () => n?.map((p) => I(
284
+ c("el-radio"),
285
+ {
286
+ value: p.value
287
+ },
288
+ {
289
+ default: () => p.label
290
+ }
291
+ ))
292
+ };
293
+ }
294
+ },
295
+ {
296
+ type: "multipleselect",
297
+ component: "el-select",
298
+ slots: h
299
+ },
300
+ {
301
+ type: "select",
302
+ component: "el-select",
303
+ slots: h
304
+ },
305
+ {
306
+ type: "select-v2",
307
+ component: "el-select-v2"
308
+ },
309
+ {
310
+ type: "tree-select",
311
+ component: "el-tree-select",
312
+ slots: h,
313
+ checkStrictly: !0,
314
+ //是否严格的遵循父子不互相关联的做法,默认为 false
315
+ clearable: !0,
316
+ // 是否可以清空选项,默认为 false
317
+ renderAfterExpand: !0
318
+ // 是否在第一次展开时即渲染子节点,默认为 false
319
+ },
320
+ {
321
+ type: "date",
322
+ component: "el-date-picker",
323
+ attrs: {
324
+ valueFormat: "YYYY-MM-DD",
325
+ format: "YYYY-MM-DD"
326
+ }
327
+ },
328
+ {
329
+ type: "datetime",
330
+ component: "el-date-picker",
331
+ attrs: {
332
+ ...d
333
+ }
334
+ },
335
+ {
336
+ type: "month",
337
+ component: "el-date-picker",
338
+ attrs: {
339
+ valueFormat: "YYYY-MM",
340
+ format: "YYYY-MM"
341
+ }
342
+ },
343
+ {
344
+ type: "year",
345
+ component: "el-date-picker",
346
+ attrs: {
347
+ valueFormat: "YYYY",
348
+ format: "YYYY"
349
+ }
350
+ },
351
+ {
352
+ type: "daterange",
353
+ component: "el-date-picker",
354
+ attrs: {
355
+ rangeSeparator: "至",
356
+ startPlaceholder: "开始日期",
357
+ endPlaceholder: "结束日期",
358
+ ...d
359
+ }
360
+ },
361
+ {
362
+ type: "cascader",
363
+ component: "el-cascader",
364
+ attrs: {
365
+ clearable: !0
366
+ }
200
367
  },
201
- getFormData: async () => {
202
- const m = await o.value.validate();
203
- return m || null;
368
+ {
369
+ type: "upload",
370
+ component: "el-upload"
371
+ },
372
+ {
373
+ type: "custom",
374
+ component: "el-form-item"
204
375
  }
205
- }), (m, g) => {
206
- const f = u("el-input"), c = u("el-input-number"), b = u("el-radio"), y = u("el-radio-group"), C = u("el-checkbox"), M = u("el-checkbox-group"), P = u("el-option"), W = u("el-select"), _ = u("el-cascader"), w = u("el-switch"), z = u("el-date-picker"), I = u("el-form-item"), B = u("el-form");
207
- return a(), r(B, {
208
- ref_key: "formRef",
209
- ref: o,
210
- model: t.formData,
211
- "label-width": t.labelWidth,
212
- inline: t.inline,
213
- "scroll-to-error": ""
214
- }, {
215
- default: d(() => [
216
- (a(!0), v(x, null, V(t.formItems, ({ type: h, ...e }) => (a(), v(x, null, [
217
- h != "custom" && !e.hidden ? (a(), r(I, {
376
+ ], y = A(), S = (t, n, p) => {
377
+ const v = m.find((b) => b.type === t);
378
+ if (!v)
379
+ return;
380
+ const k = v?.component === "el-select" && n.props, x = n.options && !k ? v?.slots?.(n) : {};
381
+ return I(
382
+ c(v.component),
383
+ {
384
+ ...v.attrs,
385
+ placeholder: s(n),
386
+ // 这里的ref还是从配置注入吧。不是每次都要用到ref
387
+ // ref: (el: any) => {
388
+ // setRefs(el, formItem.prop)
389
+ // },
390
+ ...n
391
+ //外部传入的 优先级最高
392
+ },
393
+ { ...x, ...p }
394
+ );
395
+ };
396
+ return (t, n) => {
397
+ const p = c("el-form-item"), v = c("el-form");
398
+ return o(), f(v, z({
399
+ model: e.formData,
400
+ "label-width": e.labelWidth,
401
+ inline: e.inline,
402
+ "scroll-to-error": !0
403
+ }, { ...t.$attrs }, { ref: l }), {
404
+ default: i(() => [
405
+ (o(!0), _($, null, P(e.formItems, ({ type: k, rule: x, width: b, slots: C, ...g }) => (o(), _($, null, [
406
+ k != "custom" && !g.hidden ? (o(), f(p, z({
218
407
  key: 0,
219
- label: e.label,
220
- prop: e.prop,
221
- rules: e.rule
222
- }, {
223
- default: d(() => [
224
- h == "text" || h == "" ? (a(), r(f, D({
408
+ ref_for: !0
409
+ }, { ...g }), {
410
+ label: i(() => [
411
+ g.label && typeof g.label == "function" ? (o(), f(T(g.label), { key: 0 })) : (o(), _("span", pe, H(g.label), 1))
412
+ ]),
413
+ default: i(() => [
414
+ y[g.prop] ? w(t.$slots, g.prop, {
225
415
  key: 0,
226
- placeholder: "请输入" + e.label
227
- }, { ref_for: !0 }, { ...e }, {
228
- modelValue: t.formData[e.prop],
229
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
230
- modelModifiers: { trim: !0 },
231
- "show-word-limit": "",
232
- style: { width: e.width ? e.width : t.itemWidth }
233
- }), null, 16, ["placeholder", "modelValue", "onUpdate:modelValue", "style"])) : p("", !0),
234
- h == "textarea" ? (a(), r(f, D({
416
+ item: g
417
+ }, void 0, !0) : (o(), f(T(S(k, { ...g, type: k }, C)), {
235
418
  key: 1,
236
- ref_for: !0
237
- }, { ...e }, {
238
- modelValue: t.formData[e.prop],
239
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
240
- type: "textarea",
241
- style: { width: e.width ? e.width : t.itemWidth }
242
- }), null, 16, ["modelValue", "onUpdate:modelValue", "style"])) : p("", !0),
243
- h == "number" ? (a(), r(c, D({
244
- key: 2,
245
- "controls-position": "right"
246
- }, { ref_for: !0 }, { ...e }, {
247
- modelValue: t.formData[e.prop],
248
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
249
- style: { width: e.width ? e.width : t.itemWidth }
250
- }), null, 16, ["modelValue", "onUpdate:modelValue", "style"])) : p("", !0),
251
- h == "radio" ? (a(), r(y, D({
252
- key: 3,
253
- modelValue: t.formData[e.prop],
254
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
255
- style: { width: e.width ? e.width : t.itemWidth },
256
- onChange: (n) => e.change && e.change(t.formData[e.prop])
257
- }, { ref_for: !0 }, { ...e }), {
258
- default: d(() => [
259
- (a(!0), v(x, null, V(e.options, (n, F) => (a(), r(b, {
260
- key: F,
261
- value: n.value
262
- }, {
263
- default: d(() => [
264
- Y($(n.label), 1)
265
- ]),
266
- _: 2
267
- }, 1032, ["value"]))), 128))
268
- ]),
269
- _: 2
270
- }, 1040, ["modelValue", "onUpdate:modelValue", "style", "onChange"])) : p("", !0),
271
- h == "checkbox" ? (a(), r(M, D({
272
- key: 4,
273
- modelValue: t.formData[e.prop],
274
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
275
- style: { width: e.width ? e.width : t.itemWidth },
276
- onChange: (n) => e.change && e.change(t.formData[e.prop])
277
- }, { ref_for: !0 }, { ...e }), {
278
- default: d(() => [
279
- (a(!0), v(x, null, V(e.options, (n, F) => (a(), r(C, {
280
- key: F,
281
- value: n.value
282
- }, {
283
- default: d(() => [
284
- Y($(n.label), 1)
285
- ]),
286
- _: 2
287
- }, 1032, ["value"]))), 128))
288
- ]),
289
- _: 2
290
- }, 1040, ["modelValue", "onUpdate:modelValue", "style", "onChange"])) : p("", !0),
291
- h == "select" || h == "multipleselect" ? (a(), r(W, D({
292
- key: 5,
293
- modelValue: t.formData[e.prop],
294
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
295
- placeholder: "请选择",
296
- style: { width: e.width ? e.width : t.itemWidth },
297
- onChange: (n) => e.change && e.change(t.formData[e.prop])
298
- }, { ref_for: !0 }, { ...e }), {
299
- default: d(() => [
300
- (a(!0), v(x, null, V(e.options, (n, F) => (a(), r(P, {
301
- key: F,
302
- label: e.defaultProp ? n[e.defaultProp.label] : n.label,
303
- value: e.defaultProp ? n[e.defaultProp.value] : n.value
304
- }, null, 8, ["label", "value"]))), 128))
305
- ]),
306
- _: 2
307
- }, 1040, ["modelValue", "onUpdate:modelValue", "style", "onChange"])) : p("", !0),
308
- h == "cascader" ? (a(), r(_, {
309
- key: 6,
310
- modelValue: t.formData[e.prop],
311
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
312
- options: e.options || [],
313
- props: e.defaultProp || { label: "label", value: "value" },
314
- style: A({ width: e.width ? e.width : t.itemWidth }),
315
- disabled: e.disabled,
316
- clearable: e.clearable,
317
- placeholder: e.placeholder,
318
- "popper-class": e.popperClass,
319
- teleported: e.teleported,
320
- "disabled-date": e.disabledDate,
321
- onChange: (n) => e.change && e.change(t.formData[e.prop])
322
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "style", "disabled", "clearable", "placeholder", "popper-class", "teleported", "disabled-date", "onChange"])) : p("", !0),
323
- h === "switch" ? (a(), r(w, {
324
- key: 7,
325
- modelValue: t.formData[e.prop],
326
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
327
- disabled: e.disabled,
328
- style: A({ width: e.width ? e.width : t.itemWidth }),
329
- onChange: (n) => e.change && e.change(t.formData[e.prop])
330
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "style", "onChange"])) : p("", !0),
331
- h == "date" || h == "datetime" || h == "year" || h == "month" ? (a(), r(z, D({
332
- key: 8,
333
- style: { width: e.width ? e.width : t.itemWidth },
334
- modelValue: t.formData[e.prop],
335
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n
336
- }, { ref_for: !0 }, { ...e }, {
337
- format: e.format || "YYYY-MM-DD HH:mm:ss",
338
- "value-format": e.valueFormat || "YYYY-MM-DD HH:mm:ss",
339
- disabled: e.disabled,
340
- clearable: e.clearable,
341
- placeholder: e.placeholder || "请选择",
342
- "disabled-date": e.disabledDate,
343
- type: h,
344
- onChange: (n) => e.change && e.change(t.formData[e.prop])
345
- }), null, 16, ["style", "modelValue", "onUpdate:modelValue", "format", "value-format", "disabled", "clearable", "placeholder", "disabled-date", "type", "onChange"])) : p("", !0),
346
- h == "daterange" ? (a(), r(z, {
347
- key: 9,
348
- modelValue: t.formData[e.prop],
349
- "onUpdate:modelValue": (n) => t.formData[e.prop] = n,
350
- format: e.format || "YYYY-MM-DD HH:mm:ss",
351
- "value-format": e.valueFormat || "YYYY-MM-DD HH:mm:ss",
352
- type: h,
353
- disabled: e.disabled,
354
- "range-separator": "至",
355
- "start-placeholder": "开始日期",
356
- "end-placeholder": "结束日期",
357
- onChange: (n) => e.change && e.change(t.formData[e.prop])
358
- }, null, 8, ["modelValue", "onUpdate:modelValue", "format", "value-format", "type", "disabled", "onChange"])) : p("", !0)
419
+ modelValue: e.formData[g.prop],
420
+ "onUpdate:modelValue": (J) => e.formData[g.prop] = J,
421
+ modelModifiers: { trim: !0 },
422
+ style: j({ width: b || e.itemWidth })
423
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]))
359
424
  ]),
360
425
  _: 2
361
- }, 1032, ["label", "prop", "rules"])) : p("", !0),
362
- h == "custom" ? k(m.$slots, e.prop, {
363
- key: 1,
364
- item: e
365
- }, void 0, !0) : p("", !0)
426
+ }, 1040)) : Y("", !0),
427
+ k == "custom" ? (o(), _($, { key: 1 }, [
428
+ C?.[g.prop] ? (o(), f(T(C[g.prop]), { key: 0 })) : w(t.$slots, g.prop, {
429
+ key: 1,
430
+ item: { width: b, rule: x, ...g }
431
+ }, void 0, !0)
432
+ ], 64)) : Y("", !0)
366
433
  ], 64))), 256)),
367
- E(I, null, {
368
- default: d(() => [
369
- k(m.$slots, "append", {}, void 0, !0)
434
+ y.append ? (o(), f(p, { key: 0 }, {
435
+ default: i(() => [
436
+ w(t.$slots, "append", {}, void 0, !0)
370
437
  ]),
371
438
  _: 3
372
- })
373
- ]),
374
- _: 3
375
- }, 8, ["model", "label-width", "inline"]);
376
- };
377
- }
378
- }), ge = /* @__PURE__ */ T(pe, [["__scopeId", "data-v-8dcb57aa"]]), be = /* @__PURE__ */ S({
379
- __name: "tableColumnItem",
380
- props: {
381
- tableColumn: {}
382
- },
383
- setup(t) {
384
- const i = j(), o = t, s = () => {
385
- const { tableColumn: l } = o;
386
- return l.children?.length || delete l.children, l;
387
- };
388
- return (l, m) => {
389
- const g = u("el-table-column"), f = u("tableColumnItem", !0);
390
- return !l.tableColumn.children || l.tableColumn.children?.length == 0 ? (a(), r(g, D({ key: 0 }, { ...s() }, {
391
- prop: l.tableColumn.prop,
392
- label: l.tableColumn.label
393
- }), N({ _: 2 }, [
394
- l.tableColumn.prop && i[l.tableColumn.prop] ? {
395
- name: "default",
396
- fn: d((c) => [
397
- k(l.$slots, l.tableColumn.prop, {
398
- row: c.row
399
- })
400
- ]),
401
- key: "0"
402
- } : void 0
403
- ]), 1040, ["prop", "label"])) : (a(), r(g, {
404
- key: 1,
405
- align: l.tableColumn.align,
406
- label: l.tableColumn.label
407
- }, {
408
- default: d(() => [
409
- (a(!0), v(x, null, V(l.tableColumn.children, (c, b) => (a(), r(f, {
410
- key: b,
411
- "table-column": { align: c.align || l.tableColumn.align, ...c }
412
- }, N({ _: 2 }, [
413
- V(i, (y, C) => ({
414
- name: C,
415
- fn: d(({ row: M }) => [
416
- k(l.$slots, C, { row: M }, () => [
417
- Y($(M[C]), 1)
418
- ])
419
- ])
420
- }))
421
- ]), 1032, ["table-column"]))), 128))
439
+ })) : Y("", !0)
422
440
  ]),
423
441
  _: 3
424
- }, 8, ["align", "label"]));
442
+ }, 16, ["model", "label-width", "inline"]);
425
443
  };
426
444
  }
427
- }), ye = /* @__PURE__ */ S({
445
+ }), ge = /* @__PURE__ */ W(fe, [["__scopeId", "data-v-5d6bf523"]]), he = /* @__PURE__ */ E({
428
446
  name: "EasyTable",
429
447
  __name: "index",
430
448
  props: {
@@ -458,88 +476,104 @@ const oe = { class: "flex items-center justify-between" }, re = { class: "flex i
458
476
  default: void 0
459
477
  }
460
478
  },
461
- setup(t) {
462
- const i = t, o = R(() => (i.buttonWidth.toString().indexOf("px") > -1 ? i.buttonWidth.toString().slice(0, -2) : i.buttonWidth, i.buttonWidth)), s = j(), l = U(), m = U("auto");
463
- let g = Z();
464
- const f = () => {
465
- let y = "auto";
466
- if (g?.parent?.attrs?.class?.indexOf("content-wrap") > -1) {
479
+ setup(e) {
480
+ const a = e, l = F(() => (a.buttonWidth.toString().indexOf("px") > -1 ? a.buttonWidth.toString().slice(0, -2) : a.buttonWidth, a.buttonWidth)), r = N(), s = N("auto");
481
+ let d = U();
482
+ const h = () => {
483
+ let n = "auto";
484
+ if (d?.parent?.attrs?.class?.indexOf("content-wrap") > -1) {
467
485
  try {
468
- const W = g?.refs.tableRef, { top: _ } = W?.getBoundingClientRect();
469
- y = document.documentElement.clientHeight - _ - 65 - 20;
486
+ const x = d?.refs.tableRef, { top: b } = x?.getBoundingClientRect();
487
+ n = document.documentElement.clientHeight - b - 65 - 20;
470
488
  } catch {
471
489
  }
472
- return y;
490
+ return n;
473
491
  }
474
- return y;
475
- }, c = U(), b = () => {
476
- c.value && clearTimeout(c.value), c.value = setTimeout(() => {
477
- m.value = f(), c.value = null;
492
+ return n;
493
+ }, u = N(), m = () => {
494
+ u.value && clearTimeout(u.value), u.value = setTimeout(() => {
495
+ s.value = h(), u.value = null;
478
496
  }, 100);
479
497
  };
480
- return ee(() => {
481
- m.value = f(), window.addEventListener("resize", b);
482
- }), te(() => {
483
- window.removeEventListener("resize", b);
484
- }), (y, C) => {
485
- const M = u("el-button"), P = u("el-table-column"), W = u("el-table");
486
- return a(), v("div", {
498
+ Z(() => {
499
+ s.value = h(), window.addEventListener("resize", m);
500
+ }), ee(() => {
501
+ window.removeEventListener("resize", m);
502
+ });
503
+ const y = c("el-table-column"), S = A(), t = (n) => {
504
+ const { slots: p = {}, children: v = [], ...k } = n;
505
+ if (v && v.length > 0) {
506
+ const x = v.map((b) => t(b));
507
+ return I(
508
+ y,
509
+ {
510
+ align: a.align,
511
+ ...k
512
+ },
513
+ // default 插槽默认使用 childrenNode 不能被slots 覆盖
514
+ { ...p, default: () => x }
515
+ );
516
+ }
517
+ return I(
518
+ y,
519
+ {
520
+ align: a.align,
521
+ ...k
522
+ },
523
+ // 最里层的表格列 default 插槽 slots传递的优先级最高 模版直接传递的可被 slots 覆盖
524
+ {
525
+ default: (x) => S[n.prop] && S[n.prop](x),
526
+ ...p
527
+ }
528
+ );
529
+ };
530
+ return (n, p) => {
531
+ const v = c("el-button"), k = c("el-table-column"), x = c("el-table");
532
+ return o(), _("div", {
487
533
  ref_key: "tableRef",
488
- ref: l
534
+ ref: r
489
535
  }, [
490
- E(W, D({ style: { width: "100%" } }, y.$attrs, {
491
- data: t.data,
492
- height: t.height,
493
- maxHeight: t.maxHeight ? t.maxHeight : m.value
536
+ M(x, z({ style: { width: "100%" } }, n.$attrs, {
537
+ data: e.data,
538
+ height: e.height,
539
+ maxHeight: e.maxHeight ? e.maxHeight : s.value
494
540
  }), {
495
- default: d(() => [
496
- (a(!0), v(x, null, V(t.tableColumns, (_, w) => (a(), r(be, {
497
- key: w,
498
- "table-column": { align: t.align, ..._ }
499
- }, N({ _: 2 }, [
500
- V(s, (z, I) => ({
501
- name: I,
502
- fn: d(({ row: B }) => [
503
- k(y.$slots, I, { row: B }, () => [
504
- Y($(B[I]), 1)
505
- ], !0)
506
- ])
507
- }))
508
- ]), 1032, ["table-column"]))), 128)),
509
- t.buttons && t.buttons.length ? (a(), r(P, {
541
+ default: i(() => [
542
+ (o(!0), _($, null, P(e.tableColumns, (b) => (o(), f(T(t(b))))), 256)),
543
+ e.buttons && e.buttons.length ? (o(), f(k, {
510
544
  key: 0,
511
545
  align: "center",
512
546
  fixed: "right",
513
547
  label: "操作",
514
- width: o.value
548
+ width: l.value
515
549
  }, {
516
- default: d((_) => [
517
- (a(!0), v(x, null, V(t.buttons, (w, z) => G((a(), r(M, D({ ref_for: !0 }, { ...w }, {
518
- key: z,
519
- type: w.type.includes("del") ? "danger" : "primary",
550
+ default: i((b) => [
551
+ (o(!0), _($, null, P(e.buttons, (C, g) => q((o(), f(v, z({ ref_for: !0 }, { ...C }, {
552
+ key: g,
553
+ type: C.type.includes("del") ? "danger" : "primary",
520
554
  onClick: () => {
521
- w.click?.(_.row);
555
+ C.click?.(b.row);
522
556
  },
523
- disabled: w.disabled?.(_.row) || !1,
524
- link: w.link?.(_.row) || !0
557
+ disabled: C.disabled?.(b.row) || !1,
558
+ link: C.link?.(b.row) || !0
525
559
  }), {
526
- default: d(() => [
527
- Y($(w.label), 1)
560
+ default: i(() => [
561
+ L(H(C.label), 1)
528
562
  ]),
529
563
  _: 2
530
564
  }, 1040, ["type", "onClick", "disabled", "link"])), [
531
- [J, w.show?.(_.row) || !0]
565
+ [G, C.show?.(b.row) || !0]
532
566
  ])), 128))
533
567
  ]),
534
568
  _: 1
535
- }, 8, ["width"])) : p("", !0)
569
+ }, 8, ["width"])) : Y("", !0)
536
570
  ]),
537
- _: 3
571
+ _: 1
538
572
  }, 16, ["data", "height", "maxHeight"])
539
573
  ], 512);
540
574
  };
541
575
  }
542
- }), ve = /* @__PURE__ */ T(ye, [["__scopeId", "data-v-721c94d4"]]), Ce = {
576
+ }), ye = /* @__PURE__ */ W(he, [["__scopeId", "data-v-51c45d02"]]), be = {
543
577
  name: "",
544
578
  components: {},
545
579
  props: {
@@ -549,13 +583,13 @@ const oe = { class: "flex items-center justify-between" }, re = { class: "flex i
549
583
  }
550
584
  }
551
585
  };
552
- function ke(t, i, o, s, l, m) {
553
- return o.icon ? (a(), r(ae(o.icon), {
586
+ function ve(e, a, l, r, s, d) {
587
+ return l.icon ? (o(), f(T(l.icon), {
554
588
  key: 0,
555
589
  class: "menu_icon"
556
- })) : p("", !0);
590
+ })) : Y("", !0);
557
591
  }
558
- const O = /* @__PURE__ */ T(Ce, [["render", ke], ["__scopeId", "data-v-261ce99a"]]), we = /* @__PURE__ */ S({
592
+ const R = /* @__PURE__ */ W(be, [["render", ve], ["__scopeId", "data-v-261ce99a"]]), ke = /* @__PURE__ */ E({
559
593
  name: "subMenu",
560
594
  __name: "subMenu",
561
595
  props: {
@@ -565,44 +599,44 @@ const O = /* @__PURE__ */ T(Ce, [["render", ke], ["__scopeId", "data-v-261ce99a"
565
599
  }
566
600
  },
567
601
  emits: ["handleMenuItemClick"],
568
- setup(t, { emit: i }) {
569
- const o = i;
570
- function s(l) {
571
- o("handleMenuItemClick", l);
602
+ setup(e, { emit: a }) {
603
+ const l = a;
604
+ function r(s) {
605
+ l("handleMenuItemClick", s);
572
606
  }
573
- return (l, m) => {
574
- const g = u("subMenu", !0), f = u("el-sub-menu"), c = u("el-menu-item");
575
- return t.routeData.children && t.routeData.children.length > 0 ? (a(), r(f, {
607
+ return (s, d) => {
608
+ const h = c("subMenu", !0), u = c("el-sub-menu"), m = c("el-menu-item");
609
+ return e.routeData.children && e.routeData.children.length > 0 ? (o(), f(u, {
576
610
  key: 0,
577
- index: t.routeData.path
611
+ index: e.routeData.path
578
612
  }, {
579
- title: d(() => [
580
- E(O, {
581
- icon: t.routeData.meta.icon
613
+ title: i(() => [
614
+ M(R, {
615
+ icon: e.routeData.meta.icon
582
616
  }, null, 8, ["icon"]),
583
- H("span", null, $(t.routeData.meta.title), 1)
617
+ D("span", null, H(e.routeData.meta.title), 1)
584
618
  ]),
585
- default: d(() => [
586
- (a(!0), v(x, null, V(t.routeData.children, (b, y) => (a(), r(g, {
587
- onHandleMenuItemClick: s,
588
- routeData: b,
589
- key: y
619
+ default: i(() => [
620
+ (o(!0), _($, null, P(e.routeData.children, (y, S) => (o(), f(h, {
621
+ onHandleMenuItemClick: r,
622
+ routeData: y,
623
+ key: S
590
624
  }, null, 8, ["routeData"]))), 128))
591
625
  ]),
592
626
  _: 1
593
- }, 8, ["index"])) : (a(), v("div", {
627
+ }, 8, ["index"])) : (o(), _("div", {
594
628
  key: 1,
595
- onClick: m[0] || (m[0] = (b) => s(t.routeData))
629
+ onClick: d[0] || (d[0] = (y) => r(e.routeData))
596
630
  }, [
597
- E(c, {
598
- index: t.routeData.path
631
+ M(m, {
632
+ index: e.routeData.path
599
633
  }, {
600
- title: d(() => [
601
- H("span", null, $(t.routeData.meta.title), 1)
634
+ title: i(() => [
635
+ D("span", null, H(e.routeData.meta.title), 1)
602
636
  ]),
603
- default: d(() => [
604
- E(O, {
605
- icon: t.routeData.meta.icon
637
+ default: i(() => [
638
+ M(R, {
639
+ icon: e.routeData.meta.icon
606
640
  }, null, 8, ["icon"])
607
641
  ]),
608
642
  _: 1
@@ -610,7 +644,7 @@ const O = /* @__PURE__ */ T(Ce, [["render", ke], ["__scopeId", "data-v-261ce99a"
610
644
  ]));
611
645
  };
612
646
  }
613
- }), De = /* @__PURE__ */ S({
647
+ }), xe = /* @__PURE__ */ E({
614
648
  name: "MenuTree",
615
649
  __name: "index",
616
650
  props: {
@@ -620,24 +654,24 @@ const O = /* @__PURE__ */ T(Ce, [["render", ke], ["__scopeId", "data-v-261ce99a"
620
654
  }
621
655
  },
622
656
  emits: ["handleMenuItemClick"],
623
- setup(t, { emit: i }) {
624
- const o = i, s = (l) => {
625
- o("handleMenuItemClick", l);
657
+ setup(e, { emit: a }) {
658
+ const l = a, r = (s) => {
659
+ l("handleMenuItemClick", s);
626
660
  };
627
- return (l, m) => {
628
- const g = u("el-menu");
629
- return a(), r(g, le(ne(l.$attrs)), {
630
- default: d(() => [
631
- (a(!0), v(x, null, V(t.menuList, (f) => (a(), r(we, {
632
- routeData: f,
633
- onHandleMenuItemClick: s
661
+ return (s, d) => {
662
+ const h = c("el-menu");
663
+ return o(), f(h, te(ne(s.$attrs)), {
664
+ default: i(() => [
665
+ (o(!0), _($, null, P(e.menuList, (u) => (o(), f(ke, {
666
+ routeData: u,
667
+ onHandleMenuItemClick: r
634
668
  }, null, 8, ["routeData"]))), 256))
635
669
  ]),
636
670
  _: 1
637
671
  }, 16);
638
672
  };
639
673
  }
640
- }), Ve = /* @__PURE__ */ S({
674
+ }), _e = /* @__PURE__ */ E({
641
675
  name: "Pagination",
642
676
  __name: "index",
643
677
  props: {
@@ -665,65 +699,65 @@ const O = /* @__PURE__ */ T(Ce, [["render", ke], ["__scopeId", "data-v-261ce99a"
665
699
  onPagination: { type: Function }
666
700
  },
667
701
  emits: ["update:page", "update:limit", "pagination"],
668
- setup(t, { emit: i }) {
669
- const o = t, s = i, l = R({
702
+ setup(e, { emit: a }) {
703
+ const l = e, r = a, s = F({
670
704
  get() {
671
- return o.page;
705
+ return l.page;
672
706
  },
673
- set(c) {
674
- s("update:page", c);
707
+ set(m) {
708
+ r("update:page", m);
675
709
  }
676
- }), m = R({
710
+ }), d = F({
677
711
  get() {
678
- return o.limit;
712
+ return l.limit;
679
713
  },
680
- set(c) {
681
- s("update:limit", c);
714
+ set(m) {
715
+ r("update:limit", m);
682
716
  }
683
- }), g = (c) => {
684
- l.value * c > o.total && (l.value = 1), s("pagination", { page: l.value, limit: c });
685
- }, f = (c) => {
686
- s("pagination", { page: c, limit: m.value });
717
+ }), h = (m) => {
718
+ s.value * m > l.total && (s.value = 1), r("pagination", { page: s.value, limit: m });
719
+ }, u = (m) => {
720
+ r("pagination", { page: m, limit: d.value });
687
721
  };
688
- return (c, b) => {
689
- const y = u("el-pagination");
690
- return G((a(), r(y, {
691
- "current-page": l.value,
692
- "onUpdate:currentPage": b[0] || (b[0] = (C) => l.value = C),
693
- "page-size": m.value,
694
- "onUpdate:pageSize": b[1] || (b[1] = (C) => m.value = C),
722
+ return (m, y) => {
723
+ const S = c("el-pagination");
724
+ return q((o(), f(S, {
725
+ "current-page": s.value,
726
+ "onUpdate:currentPage": y[0] || (y[0] = (t) => s.value = t),
727
+ "page-size": d.value,
728
+ "onUpdate:pageSize": y[1] || (y[1] = (t) => d.value = t),
695
729
  background: !0,
696
730
  "page-sizes": [10, 20, 30, 50, 100],
697
- "pager-count": t.pagerCount,
698
- total: t.total,
731
+ "pager-count": e.pagerCount,
732
+ total: e.total,
699
733
  class: "pagination",
700
734
  layout: "total, sizes, prev, pager, next, jumper",
701
- onSizeChange: g,
702
- onCurrentChange: f
735
+ onSizeChange: h,
736
+ onCurrentChange: u
703
737
  }, null, 8, ["current-page", "page-size", "pager-count", "total"])), [
704
- [J, t.total > 0]
738
+ [G, e.total > 0]
705
739
  ]);
706
740
  };
707
741
  }
708
- }), _e = /* @__PURE__ */ T(Ve, [["__scopeId", "data-v-1e34e383"]]), xe = [
742
+ }), Ce = /* @__PURE__ */ W(_e, [["__scopeId", "data-v-1e34e383"]]), Se = [
743
+ ie,
709
744
  me,
710
- he,
711
745
  ge,
712
- ve,
713
- De,
714
- _e
715
- ], q = [], $e = (t, i) => {
716
- xe.forEach((o) => {
717
- q.push(o.name), t.component(o.name, o);
718
- }), console.log("mwl-components", q);
719
- }, Se = { install: $e };
746
+ ye,
747
+ xe,
748
+ Ce
749
+ ], V = [], we = (e, a) => {
750
+ Se.forEach((l) => {
751
+ V.push(l.name), e.component(l.name, l);
752
+ }), console.log("mwl-components", V);
753
+ }, Ye = { install: we };
720
754
  export {
721
- me as ContentWarp,
722
- he as Dialog,
755
+ ie as ContentWarp,
756
+ me as Dialog,
723
757
  ge as EasyForm,
724
- ve as EasyTable,
725
- De as MenuTree,
726
- _e as Pagination,
727
- Se as default,
728
- $e as install
758
+ ye as EasyTable,
759
+ xe as MenuTree,
760
+ Ce as Pagination,
761
+ Ye as default,
762
+ we as install
729
763
  };