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