mwl-components 0.1.1 → 0.1.2

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.
@@ -1,16 +1,12 @@
1
1
  import { PropType } from 'vue';
2
2
  import { FormItem, ComponentMapType } from '../types';
3
- export declare const getPlaceholder: (item: FormItem) => string;
3
+ export declare const getPlaceholder: (item: FormItem) => string | undefined;
4
4
  export declare const componentsMap: ComponentMapType[];
5
5
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<globalThis.ExtractPropTypes<{
6
6
  inline: {
7
7
  type: BooleanConstructor;
8
8
  default: boolean;
9
9
  };
10
- formData: {
11
- type: PropType<Record<string, any>>;
12
- required: true;
13
- };
14
10
  formItems: {
15
11
  type: PropType<FormItem[]>;
16
12
  default: () => never[];
@@ -23,15 +19,16 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<gl
23
19
  type: StringConstructor[];
24
20
  default: string;
25
21
  };
26
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
22
+ modelValue: {
23
+ type: PropType<Record<string, any>>;
24
+ };
25
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
26
+ "update:modelValue": (value: Record<string, any>) => any;
27
+ }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
27
28
  inline: {
28
29
  type: BooleanConstructor;
29
30
  default: boolean;
30
31
  };
31
- formData: {
32
- type: PropType<Record<string, any>>;
33
- required: true;
34
- };
35
32
  formItems: {
36
33
  type: PropType<FormItem[]>;
37
34
  default: () => never[];
@@ -44,7 +41,12 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<gl
44
41
  type: StringConstructor[];
45
42
  default: string;
46
43
  };
47
- }>> & Readonly<{}>, {
44
+ modelValue: {
45
+ type: PropType<Record<string, any>>;
46
+ };
47
+ }>> & Readonly<{
48
+ "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
49
+ }>, {
48
50
  labelWidth: string | number;
49
51
  inline: boolean;
50
52
  formItems: FormItem[];
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { default as ContentWarp } from './ContentWarp/index.vue';
2
2
  import { default as Dialog } from './Dialog/index.vue';
3
- import { default as EasyForm, componentsMap } from './EasyForm/index.vue';
3
+ import { default as EasyForm, componentsMap, getPlaceholder } from './EasyForm/index.vue';
4
4
  import { default as EasyTable } from './EasyTable/index.vue';
5
5
  import { default as MenuTree } from './MenuTree/components/index.vue';
6
6
  import { default as Pagination } from './Pagination/index.vue';
7
- export { ContentWarp, Dialog, EasyForm, EasyTable, MenuTree, Pagination, componentsMap };
7
+ export { ContentWarp, Dialog, EasyForm, EasyTable, MenuTree, Pagination, componentsMap, getPlaceholder };
8
8
  export declare const install: (app: any, options: any) => void;
9
9
  declare const _default: {
10
10
  install: (app: any, options: any) => void;
11
11
  };
12
12
  export default _default;
13
- export type { Options, FormItem, Rule, Placement, TableColumn, buttonType, ComponentMapType } from './types';
13
+ export type { Options, FormItem, Rule, Placement, TableColumn, buttonType, ComponentMapType, } from './types';
package/dist/index.js CHANGED
@@ -1,11 +1,9 @@
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 = {
1
+ import { defineComponent as D, useSlots as V, ref as H, resolveComponent as m, createBlock as p, openBlock as r, normalizeClass as X, createSlots as L, withCtx as i, renderSlot as S, createElementVNode as I, createElementBlock as _, createCommentVNode as E, toDisplayString as Y, watch as Z, nextTick as ee, computed as F, unref as A, mergeProps as O, normalizeStyle as U, createTextVNode as j, createVNode as N, mergeModels as te, useModel as ne, getCurrentInstance as K, Fragment as M, renderList as P, resolveDynamicComponent as $, h as z, inject as oe, onMounted as ae, onUnmounted as le, withDirectives as G, vShow as J, normalizeProps as re, guardReactiveProps as se } from "vue";
2
+ import { configProviderContextKey as ue } from "element-plus";
3
+ const ce = { class: "card-header" }, ie = {
3
4
  key: 0,
4
- class: "flex justify-end"
5
- }, ue = {
6
- key: 0,
7
- class: "mt-8px flex items-center"
8
- }, ie = /* @__PURE__ */ H({
5
+ class: "card-header__message"
6
+ }, de = /* @__PURE__ */ D({
9
7
  name: "ContentWarp",
10
8
  __name: "index",
11
9
  props: {
@@ -13,61 +11,44 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
13
11
  message: String
14
12
  },
15
13
  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]"]),
14
+ const a = V(), t = H("content-wrap");
15
+ return (s, u) => {
16
+ const c = m("ElCard");
17
+ return r(), p(c, {
18
+ class: X([t.value]),
21
19
  shadow: "never"
22
- }, j({
20
+ }, L({
23
21
  default: i(() => [
24
- _(s.$slots, "default", {}, void 0, !0)
22
+ S(s.$slots, "default", {}, void 0, !0)
25
23
  ]),
26
24
  _: 2
27
25
  }, [
28
26
  e.title ? {
29
27
  name: "header",
30
28
  fn: i(() => [
31
- S("div", ae, [
32
- S("div", le, [
33
- S("span", re, $(e.title), 1),
34
- e.message ? (a(), f(l, {
35
- key: 0,
36
- effect: "dark",
37
- placement: "right"
38
- }, {
39
- content: i(() => [
40
- S("div", se, $(e.message), 1)
41
- ]),
42
- default: i(() => [
43
- Y(p, {
44
- size: 14,
45
- class: "ml-5px",
46
- icon: "ep:question-filled"
47
- })
48
- ]),
49
- _: 1
50
- })) : D("", !0)
51
- ]),
52
- t.buttonTip ? (a(), v("div", ce, [
53
- _(s.$slots, "buttonTip", {}, void 0, !0)
54
- ])) : D("", !0)
55
- ]),
56
- t.descTip ? (a(), v("div", ue, [
57
- _(s.$slots, "descTip", {}, void 0, !0)
58
- ])) : D("", !0)
29
+ I("div", ce, [
30
+ I("span", null, Y(e.title), 1),
31
+ e.message ? (r(), _("span", ie, Y(e.message), 1)) : E("", !0)
32
+ ])
59
33
  ]),
60
34
  key: "0"
35
+ } : void 0,
36
+ a.footer ? {
37
+ name: "footer",
38
+ fn: i(() => [
39
+ S(s.$slots, "footer", {}, void 0, !0)
40
+ ]),
41
+ key: "1"
61
42
  } : void 0
62
43
  ]), 1032, ["class"]);
63
44
  };
64
45
  }
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({
46
+ }), W = (e, a) => {
47
+ const t = e.__vccOpts || e;
48
+ for (const [s, u] of a)
49
+ t[s] = u;
50
+ return t;
51
+ }, me = /* @__PURE__ */ W(de, [["__scopeId", "data-v-fdaaba5e"]]), pe = { class: "dialog-header" }, fe = /* @__PURE__ */ D({
71
52
  name: "Dialog",
72
53
  __name: "index",
73
54
  props: {
@@ -85,7 +66,7 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
85
66
  },
86
67
  width: {
87
68
  type: String,
88
- default: "50%"
69
+ default: "61.8%"
89
70
  },
90
71
  maxHeight: {
91
72
  type: [String, Number],
@@ -93,64 +74,65 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
93
74
  }
94
75
  },
95
76
  setup(e) {
96
- const t = W(), n = e, s = I(n.fullscreen), c = () => {
77
+ const a = V(), t = e, s = H(t.fullscreen), u = () => {
97
78
  s.value = !A(s);
98
- }, p = I(n.maxHeight);
99
- X(
79
+ }, c = H(t.maxHeight);
80
+ Z(
100
81
  () => s.value,
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`;
82
+ async (l) => {
83
+ if (await ee(), l) {
84
+ const n = document.documentElement.offsetHeight;
85
+ c.value = `${n - 55 - 40 - (a.footer ? 63 : 0)}px`;
105
86
  } else
106
- p.value = n.maxHeight;
87
+ c.value = t.maxHeight;
107
88
  },
108
89
  {
109
90
  immediate: !0
110
91
  }
111
92
  );
112
- const l = F(() => {
113
- if (n.maxHeight)
93
+ const g = F(() => {
94
+ if (t.maxHeight)
114
95
  return {
115
- height: A(p)
96
+ height: A(c)
116
97
  };
117
98
  });
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, {
99
+ return (l, n) => {
100
+ const f = m("FullScreen"), k = m("el-icon"), x = m("ElScrollbar"), h = m("ElDialog");
101
+ return r(), p(h, O({
121
102
  "close-on-click-modal": !1,
122
- fullscreen: s.value,
123
- width: e.width,
124
103
  "destroy-on-close": "",
125
104
  draggable: "",
126
105
  "lock-scroll": "",
127
106
  class: "custom-dialog",
128
107
  "append-to-body": ""
129
- }), j({
108
+ }, l.$attrs, {
109
+ fullscreen: s.value,
110
+ width: e.width
111
+ }), L({
130
112
  default: i(() => [
131
- e.scroll ? (a(), f(g, {
113
+ e.scroll ? (r(), p(x, {
132
114
  key: 0,
133
- style: L(l.value)
115
+ style: U(g.value)
134
116
  }, {
135
117
  default: i(() => [
136
- _(o.$slots, "default")
118
+ S(l.$slots, "default")
137
119
  ]),
138
120
  _: 3
139
- }, 8, ["style"])) : _(o.$slots, "default", { key: 1 })
121
+ }, 8, ["style"])) : S(l.$slots, "default", { key: 1 })
140
122
  ]),
141
123
  _: 2
142
124
  }, [
143
125
  e.title ? {
144
126
  name: "header",
145
127
  fn: i(() => [
146
- S("div", me, [
147
- _(o.$slots, "title", {}, () => [
148
- U($(e.title), 1)
128
+ I("div", pe, [
129
+ S(l.$slots, "title", {}, () => [
130
+ j(Y(e.title), 1)
149
131
  ]),
150
- S("div", { onClick: c }, [
151
- Y(k, { class: "fullScreen" }, {
132
+ I("div", { onClick: u }, [
133
+ N(k, { class: "fullScreen" }, {
152
134
  default: i(() => [
153
- Y(h)
135
+ N(f)
154
136
  ]),
155
137
  _: 1
156
138
  })
@@ -159,34 +141,37 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
159
141
  ]),
160
142
  key: "0"
161
143
  } : void 0,
162
- t.footer ? {
144
+ a.footer ? {
163
145
  name: "footer",
164
146
  fn: i(() => [
165
- _(o.$slots, "footer")
147
+ S(l.$slots, "footer")
166
148
  ]),
167
149
  key: "1"
168
150
  } : void 0
169
151
  ]), 1040, ["fullscreen", "width"]);
170
152
  };
171
153
  }
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}`;
154
+ }), ge = { key: 1 }, he = (e) => {
155
+ let a = e.label;
156
+ if (e.label && typeof e.label == "function" && (a = e.label()), e.type.indexOf("select") > -1 || e.type.indexOf("cascader") > -1 || e.type.indexOf("date") > -1)
157
+ return `请选择${a}`;
158
+ if (e.type.indexOf("text") > -1 || e.type.indexOf("number") > -1)
159
+ return `请输入${a}`;
175
160
  }, R = {
176
161
  valueFormat: "YYYY-MM-DD HH:mm:ss",
177
162
  format: "YYYY-MM-DD HH:mm:ss"
178
- }, he = (e) => {
179
- const { options: t } = e;
163
+ }, ye = (e) => {
164
+ const { options: a } = e;
180
165
  return {
181
- default: () => t?.map((n) => N(d("el-option"), {
182
- label: n.label,
183
- value: n.value,
184
- key: n.value
166
+ default: () => a?.map((t) => z(m("el-option"), {
167
+ label: t.label,
168
+ value: t.value,
169
+ key: t.value
185
170
  }))
186
171
  };
187
- }, O = {
172
+ }, T = {
188
173
  clearable: !0
189
- }, ye = [
174
+ }, be = [
190
175
  {
191
176
  type: "slider",
192
177
  component: "el-slider"
@@ -195,14 +180,14 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
195
180
  type: "text",
196
181
  component: "el-input",
197
182
  attrs: {
198
- ...O
183
+ ...T
199
184
  }
200
185
  },
201
186
  {
202
187
  type: "textarea",
203
188
  component: "el-input",
204
189
  attrs: {
205
- ...O
190
+ ...T
206
191
  }
207
192
  },
208
193
  {
@@ -220,15 +205,15 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
220
205
  type: "checkbox",
221
206
  component: "el-checkbox-group",
222
207
  slots: (e) => {
223
- const { options: t } = e;
208
+ const { options: a } = e;
224
209
  return {
225
- default: () => t?.map((n) => N(
226
- d("el-checkbox"),
210
+ default: () => a?.map((t) => z(
211
+ m("el-checkbox"),
227
212
  {
228
- value: n.value
213
+ value: t.value
229
214
  },
230
215
  {
231
- default: () => n.label
216
+ default: () => t.label
232
217
  }
233
218
  ))
234
219
  };
@@ -238,15 +223,15 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
238
223
  type: "radio",
239
224
  component: "el-radio-group",
240
225
  slots: (e) => {
241
- const { options: t } = e;
226
+ const { options: a } = e;
242
227
  return {
243
- default: () => t?.map((n) => N(
244
- d("el-radio"),
228
+ default: () => a?.map((t) => z(
229
+ m("el-radio"),
245
230
  {
246
- value: n.value
231
+ value: t.value
247
232
  },
248
233
  {
249
- default: () => n.label
234
+ default: () => t.label
250
235
  }
251
236
  ))
252
237
  };
@@ -255,7 +240,7 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
255
240
  {
256
241
  type: "select",
257
242
  component: "el-select",
258
- slots: he
243
+ slots: ye
259
244
  },
260
245
  {
261
246
  type: "select-v2",
@@ -265,7 +250,7 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
265
250
  type: "tree-select",
266
251
  component: "el-tree-select",
267
252
  attrs: {
268
- ...O,
253
+ ...T,
269
254
  checkStrictly: !0,
270
255
  //是否严格的遵循父子不互相关联的做法,默认为 false
271
256
  renderAfterExpand: !0
@@ -308,7 +293,7 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
308
293
  }
309
294
  },
310
295
  {
311
- type: "datetimerange,daterange,,monthrange,yearrange",
296
+ type: "datetimerange,daterange,monthrange,yearrange",
312
297
  component: "el-date-picker",
313
298
  attrs: {
314
299
  showConfirm: !1,
@@ -333,19 +318,19 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
333
318
  type: "custom",
334
319
  component: "el-form-item"
335
320
  }
336
- ], be = /* @__PURE__ */ H({
321
+ ], ve = /* @__PURE__ */ D({
337
322
  name: "EasyForm",
338
323
  __name: "index",
339
- props: {
324
+ props: /* @__PURE__ */ te({
340
325
  inline: {
341
326
  type: Boolean,
342
327
  default: !0
343
328
  },
344
- // 表单数据对象
345
- formData: {
346
- type: Object,
347
- required: !0
348
- },
329
+ // // 表单数据对象
330
+ // formData: {
331
+ // type: Object as PropType<Record<string, any>>,
332
+ // required: true,
333
+ // },
349
334
  // 表单项配置数组
350
335
  formItems: {
351
336
  type: Array,
@@ -361,96 +346,108 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
361
346
  type: [String],
362
347
  default: "200px"
363
348
  }
364
- },
349
+ }, {
350
+ modelValue: {
351
+ default: {},
352
+ type: Object
353
+ },
354
+ modelModifiers: {}
355
+ }),
356
+ emits: ["update:modelValue"],
365
357
  setup(e) {
366
- const t = q(), n = (l) => {
367
- s(l, "formRef");
368
- }, s = (l, o) => {
358
+ const a = ne(e, "modelValue"), t = K(), s = (l) => {
359
+ u(l, "formRef");
360
+ }, u = (l, n) => {
369
361
  if (!l) {
370
- delete t?.exposeProxy?.[o], delete t?.exposed?.[o];
362
+ delete t?.exposeProxy?.[n], delete t?.exposed?.[n];
371
363
  return;
372
364
  }
373
365
  t.exposeProxy = {
374
366
  ...t?.exposed,
375
- [o]: l
367
+ [n]: l
376
368
  }, t.exposed = {
377
369
  ...t?.exposed,
378
- [o]: l
370
+ [n]: l
379
371
  };
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)
372
+ }, c = V(), g = (l, n, f) => {
373
+ const { value: k, component: x, ...h } = n, d = be.find(
374
+ (b) => !!l && b.type.indexOf(l) > -1
375
+ ), C = d?.component === "el-select" && n.props, y = n.options && !C ? d?.slots?.(n) : {};
376
+ if (!d && !n.component)
383
377
  return new Error(`未找到type为${l}的组件且当前也未传递component`);
384
- const r = E(m?.component || k);
385
- if (r)
386
- return N(
387
- r,
378
+ const o = $(d?.component || x);
379
+ if (o)
380
+ return z(
381
+ o,
388
382
  {
389
- ...m?.attrs,
383
+ ...d?.attrs,
390
384
  // 这里的ref还是从配置注入吧。不是每次都要用到ref
391
385
  // ref: (el: any) => {
392
386
  // setRefs(el, formItem.prop)
393
387
  // },
394
- ...g,
388
+ ...h,
395
389
  //外部传入的 优先级最高
396
- placeholder: g.placeholder || ge(o)
390
+ placeholder: h.placeholder || he(n)
397
391
  },
398
- { ...y, ...u }
392
+ { ...y, ...f }
399
393
  );
400
394
  };
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,
395
+ return (l, n) => {
396
+ const f = m("el-form-item"), k = m("el-form");
397
+ return r(), p(k, O({
398
+ model: a.value,
405
399
  "label-width": e.labelWidth,
406
400
  inline: e.inline,
407
401
  "scroll-to-error": !0
408
402
  }, { ...l.$attrs }, {
409
- ref: n,
403
+ ref: s,
410
404
  class: "easy-form"
411
405
  }), {
412
406
  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({
415
- key: 0,
416
- ref_for: !0
417
- }, { ...r }), {
407
+ (r(!0), _(M, null, P(e.formItems, ({ id: x, type: h, rule: d, width: C, slots: y, ...o }, b) => (r(), _(M, null, [
408
+ h != "custom" && !o.hidden ? (r(), p(f, {
409
+ prop: o.prop,
410
+ key: b,
411
+ "label-width": o.labelWidth,
412
+ rules: d,
413
+ required: o.required
414
+ }, {
418
415
  label: i(() => [
419
- r.label && typeof r.label == "function" ? (a(), f(E(r.label), { key: 0 })) : (a(), v("span", fe, $(r.label), 1))
416
+ o.label && typeof o.label == "function" ? (r(), p($(o.label), { key: 0 })) : (r(), _("span", ge, Y(o.label), 1))
420
417
  ]),
421
418
  default: i(() => [
422
- c[r.prop] ? _(l.$slots, r.prop, {
419
+ c[o.prop] ? S(l.$slots, o.prop, {
423
420
  key: 0,
424
- item: r
425
- }, void 0, !0) : (a(), f(E(p(g, { ...r, type: g }, y)), {
421
+ item: o
422
+ }, void 0, !0) : (r(), p($(g(h, { ...o, type: h }, y)), {
426
423
  key: 1,
427
- modelValue: e.formData[r.prop],
428
- "onUpdate:modelValue": (b) => e.formData[r.prop] = b,
424
+ modelValue: a.value[o.prop],
425
+ "onUpdate:modelValue": (v) => a.value[o.prop] = v,
429
426
  modelModifiers: { trim: !0 },
430
- style: L({ width: C || e.itemWidth })
427
+ style: U({ width: C || e.itemWidth })
431
428
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]))
432
429
  ]),
433
430
  _: 2
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, {
431
+ }, 1032, ["prop", "label-width", "rules", "required"])) : E("", !0),
432
+ h == "custom" ? (r(), _(M, { key: 1 }, [
433
+ y?.[o.prop] ? (r(), p($(y[o.prop]), { key: 0 })) : S(l.$slots, o.prop, {
437
434
  key: 1,
438
- item: { width: C, rule: m, ...r }
435
+ item: { width: C, rule: d, ...o }
439
436
  }, void 0, !0)
440
- ], 64)) : D("", !0)
437
+ ], 64)) : E("", !0)
441
438
  ], 64))), 256)),
442
- c.append ? (a(), f(u, { key: 0 }, {
439
+ c.append ? (r(), p(f, { key: 0 }, {
443
440
  default: i(() => [
444
- _(l.$slots, "append", {}, void 0, !0)
441
+ S(l.$slots, "append", {}, void 0, !0)
445
442
  ]),
446
443
  _: 3
447
- })) : D("", !0)
444
+ })) : E("", !0)
448
445
  ]),
449
446
  _: 3
450
447
  }, 16, ["model", "label-width", "inline"]);
451
448
  };
452
449
  }
453
- }), ve = /* @__PURE__ */ P(be, [["__scopeId", "data-v-eb8139e8"]]), ke = /* @__PURE__ */ H({
450
+ }), ke = /* @__PURE__ */ W(ve, [["__scopeId", "data-v-ebcd5674"]]), xe = /* @__PURE__ */ D({
454
451
  name: "EasyTable",
455
452
  __name: "index",
456
453
  props: {
@@ -489,104 +486,105 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
489
486
  }
490
487
  },
491
488
  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();
489
+ const a = oe(ue), t = e, s = F(() => t.buttonWidth.toString().indexOf("px") > -1 ? t.buttonWidth.toString().slice(0, -2) : t.buttonWidth), u = H(), c = H("auto");
490
+ let g = K();
494
491
  const l = () => {
495
- let m = "auto";
496
- if (p?.parent?.attrs?.class?.indexOf("content-wrap") > -1) {
497
- const r = t.footerHeight;
492
+ let d = "auto";
493
+ if (g?.parent?.attrs?.class?.indexOf("content-wrap") > -1) {
494
+ let o = t.footerHeight;
495
+ a?.value?.size === "small" ? o = o - 8 : a?.value?.size === "large" && (o = o + 8);
498
496
  try {
499
- const b = p?.refs.tableRef, { top: x } = b?.getBoundingClientRect();
500
- m = document.documentElement.clientHeight - x - r - 20;
497
+ const b = g?.refs.tableRef, { top: v } = b?.getBoundingClientRect();
498
+ d = document.documentElement.clientHeight - v - o - 20;
501
499
  } catch {
502
500
  }
503
- return m;
501
+ return d;
504
502
  }
505
- return m;
506
- }, o = I(), u = () => {
507
- o.value && clearTimeout(o.value), o.value = setTimeout(() => {
508
- c.value = l(), o.value = null;
503
+ return d;
504
+ }, n = H(), f = () => {
505
+ n.value && clearTimeout(n.value), n.value = setTimeout(() => {
506
+ c.value = l(), n.value = null;
509
507
  }, 100);
510
508
  };
511
- ee(() => {
512
- c.value = l(), window.addEventListener("resize", u);
513
- }), te(() => {
514
- window.removeEventListener("resize", u);
509
+ ae(() => {
510
+ c.value = l(), window.addEventListener("resize", f);
511
+ }), le(() => {
512
+ window.removeEventListener("resize", f);
515
513
  });
516
- const h = d("el-table-column"), k = W(), g = (m) => {
517
- const { slots: C = {}, children: y = [], ...r } = m;
514
+ const k = m("el-table-column"), x = V(), h = (d) => {
515
+ const { slots: C = {}, children: y = [], ...o } = d;
518
516
  if (y && y.length > 0) {
519
- const b = y.map((x) => g(x));
520
- return N(
521
- h,
517
+ const b = y.map((v) => h(v));
518
+ return z(
519
+ k,
522
520
  {
523
521
  align: t.align,
524
- ...r
522
+ ...o
525
523
  },
526
524
  // default 插槽默认使用 childrenNode 不能被slots 覆盖
527
525
  { ...C, default: () => b }
528
526
  );
529
527
  }
530
- return N(
531
- h,
528
+ return z(
529
+ k,
532
530
  {
533
531
  align: t.align,
534
- ...r
532
+ ...o
535
533
  },
536
534
  // 最里层的表格列 default 插槽 slots传递的优先级最高 模版直接传递的可被 slots 覆盖
537
535
  {
538
- default: (b) => k[m.prop] && k[m.prop](b),
536
+ default: (b) => x[d.prop] && x[d.prop](b),
539
537
  ...C
540
538
  }
541
539
  );
542
540
  };
543
- return (m, C) => {
544
- const y = d("el-button"), r = d("el-table-column"), b = d("el-table");
545
- return a(), v("div", {
541
+ return (d, C) => {
542
+ const y = m("el-button"), o = m("el-table-column"), b = m("el-table");
543
+ return r(), _("div", {
546
544
  ref_key: "tableRef",
547
- ref: s
545
+ ref: u
548
546
  }, [
549
- Y(b, T({ style: { width: "100%" } }, m.$attrs, {
547
+ N(b, O({ style: { width: "100%" } }, d.$attrs, {
550
548
  data: e.data,
551
549
  height: e.height,
552
550
  maxHeight: e.maxHeight ? e.maxHeight : c.value
553
551
  }), {
554
552
  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, {
553
+ (r(!0), _(M, null, P(e.tableColumns, (v, w) => (r(), p($(h(v)), { key: w }))), 128)),
554
+ e.buttons && e.buttons.length ? (r(), p(o, {
557
555
  key: 0,
558
556
  align: "center",
559
557
  fixed: "right",
560
558
  label: "操作",
561
- width: n.value
559
+ width: s.value
562
560
  }, {
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,
561
+ default: i((v) => [
562
+ (r(!0), _(M, null, P(e.buttons, (w, Q) => G((r(), p(y, O({ ref_for: !0 }, { ...w }, {
563
+ key: Q,
566
564
  type: w.type.includes("del") ? "danger" : "primary",
567
565
  onClick: () => {
568
- w.click?.(x.row);
566
+ w.click?.(v.row);
569
567
  },
570
- disabled: w.disabled?.(x.row) || !1,
571
- link: w.link?.(x.row) || !0
568
+ disabled: w.disabled?.(v.row) || !1,
569
+ link: w.link?.(v.row) || !0
572
570
  }), {
573
571
  default: i(() => [
574
- U($(w.label), 1)
572
+ j(Y(w.label), 1)
575
573
  ]),
576
574
  _: 2
577
575
  }, 1040, ["type", "onClick", "disabled", "link"])), [
578
- [J, w.show?.(x.row) || !0]
576
+ [J, w.show?.(v.row) || !0]
579
577
  ])), 128))
580
578
  ]),
581
579
  _: 1
582
- }, 8, ["width"])) : D("", !0)
580
+ }, 8, ["width"])) : E("", !0)
583
581
  ]),
584
582
  _: 1
585
583
  }, 16, ["data", "height", "maxHeight"])
586
584
  ], 512);
587
585
  };
588
586
  }
589
- }), xe = /* @__PURE__ */ P(ke, [["__scopeId", "data-v-6bcfc120"]]), _e = {
587
+ }), _e = /* @__PURE__ */ W(xe, [["__scopeId", "data-v-1c87357b"]]), Ce = {
590
588
  name: "",
591
589
  components: {},
592
590
  props: {
@@ -596,13 +594,13 @@ const ae = { class: "flex items-center justify-between" }, le = { class: "flex i
596
594
  }
597
595
  }
598
596
  };
599
- function Ce(e, t, n, s, c, p) {
600
- return n.icon ? (a(), f(E(n.icon), {
597
+ function we(e, a, t, s, u, c) {
598
+ return t.icon ? (r(), p($(t.icon), {
601
599
  key: 0,
602
600
  class: "menu_icon"
603
- })) : D("", !0);
601
+ })) : E("", !0);
604
602
  }
605
- const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"]]), we = /* @__PURE__ */ H({
603
+ const B = /* @__PURE__ */ W(Ce, [["render", we], ["__scopeId", "data-v-261ce99a"]]), Se = /* @__PURE__ */ D({
606
604
  name: "subMenu",
607
605
  __name: "subMenu",
608
606
  props: {
@@ -612,43 +610,43 @@ const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"
612
610
  }
613
611
  },
614
612
  emits: ["handleMenuItemClick"],
615
- setup(e, { emit: t }) {
616
- const n = t;
617
- function s(c) {
618
- n("handleMenuItemClick", c);
613
+ setup(e, { emit: a }) {
614
+ const t = a;
615
+ function s(u) {
616
+ t("handleMenuItemClick", u);
619
617
  }
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, {
618
+ return (u, c) => {
619
+ const g = m("subMenu", !0), l = m("el-sub-menu"), n = m("el-menu-item");
620
+ return e.routeData.children && e.routeData.children.length > 0 ? (r(), p(l, {
623
621
  key: 0,
624
622
  index: e.routeData.path
625
623
  }, {
626
624
  title: i(() => [
627
- Y(V, {
625
+ N(B, {
628
626
  icon: e.routeData.meta.icon
629
627
  }, null, 8, ["icon"]),
630
- S("span", null, $(e.routeData.meta.title), 1)
628
+ I("span", null, Y(e.routeData.meta.title), 1)
631
629
  ]),
632
630
  default: i(() => [
633
- (a(!0), v(M, null, z(e.routeData.children, (h, k) => (a(), f(l, {
631
+ (r(!0), _(M, null, P(e.routeData.children, (f, k) => (r(), p(g, {
634
632
  onHandleMenuItemClick: s,
635
- routeData: h,
633
+ routeData: f,
636
634
  key: k
637
635
  }, null, 8, ["routeData"]))), 128))
638
636
  ]),
639
637
  _: 1
640
- }, 8, ["index"])) : (a(), v("div", {
638
+ }, 8, ["index"])) : (r(), _("div", {
641
639
  key: 1,
642
- onClick: p[0] || (p[0] = (h) => s(e.routeData))
640
+ onClick: c[0] || (c[0] = (f) => s(e.routeData))
643
641
  }, [
644
- Y(u, {
642
+ N(n, {
645
643
  index: e.routeData.path
646
644
  }, {
647
645
  title: i(() => [
648
- S("span", null, $(e.routeData.meta.title), 1)
646
+ I("span", null, Y(e.routeData.meta.title), 1)
649
647
  ]),
650
648
  default: i(() => [
651
- Y(V, {
649
+ N(B, {
652
650
  icon: e.routeData.meta.icon
653
651
  }, null, 8, ["icon"])
654
652
  ]),
@@ -657,7 +655,7 @@ const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"
657
655
  ]));
658
656
  };
659
657
  }
660
- }), Se = /* @__PURE__ */ H({
658
+ }), Me = /* @__PURE__ */ D({
661
659
  name: "MenuTree",
662
660
  __name: "index",
663
661
  props: {
@@ -667,16 +665,16 @@ const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"
667
665
  }
668
666
  },
669
667
  emits: ["handleMenuItemClick"],
670
- setup(e, { emit: t }) {
671
- const n = t, s = (c) => {
672
- n("handleMenuItemClick", c);
668
+ setup(e, { emit: a }) {
669
+ const t = a, s = (u) => {
670
+ t("handleMenuItemClick", u);
673
671
  };
674
- return (c, p) => {
675
- const l = d("el-menu");
676
- return a(), f(l, ne(oe(c.$attrs)), {
672
+ return (u, c) => {
673
+ const g = m("el-menu");
674
+ return r(), p(g, re(se(u.$attrs)), {
677
675
  default: i(() => [
678
- (a(!0), v(M, null, z(e.menuList, (o) => (a(), f(we, {
679
- routeData: o,
676
+ (r(!0), _(M, null, P(e.menuList, (l) => (r(), p(Se, {
677
+ routeData: l,
680
678
  onHandleMenuItemClick: s
681
679
  }, null, 8, ["routeData"]))), 256))
682
680
  ]),
@@ -684,7 +682,7 @@ const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"
684
682
  }, 16);
685
683
  };
686
684
  }
687
- }), De = /* @__PURE__ */ H({
685
+ }), Ye = /* @__PURE__ */ D({
688
686
  name: "Pagination",
689
687
  __name: "index",
690
688
  props: {
@@ -712,67 +710,68 @@ const V = /* @__PURE__ */ P(_e, [["render", Ce], ["__scopeId", "data-v-261ce99a"
712
710
  onPagination: { type: Function }
713
711
  },
714
712
  emits: ["update:page", "update:limit", "pagination"],
715
- setup(e, { emit: t }) {
716
- const n = e, s = t, c = F({
713
+ setup(e, { emit: a }) {
714
+ const t = e, s = a, u = F({
717
715
  get() {
718
- return n.page;
716
+ return t.page;
719
717
  },
720
- set(u) {
721
- s("update:page", u);
718
+ set(n) {
719
+ s("update:page", n);
722
720
  }
723
- }), p = F({
721
+ }), c = F({
724
722
  get() {
725
- return n.limit;
723
+ return t.limit;
726
724
  },
727
- set(u) {
728
- s("update:limit", u);
725
+ set(n) {
726
+ s("update:limit", n);
729
727
  }
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 });
728
+ }), g = (n) => {
729
+ u.value * n > t.total && (u.value = 1), s("pagination", { page: u.value, limit: n });
730
+ }, l = (n) => {
731
+ s("pagination", { page: n, limit: c.value });
734
732
  };
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),
733
+ return (n, f) => {
734
+ const k = m("el-pagination");
735
+ return G((r(), p(k, {
736
+ "current-page": u.value,
737
+ "onUpdate:currentPage": f[0] || (f[0] = (x) => u.value = x),
738
+ "page-size": c.value,
739
+ "onUpdate:pageSize": f[1] || (f[1] = (x) => c.value = x),
742
740
  background: !0,
743
741
  "page-sizes": [10, 20, 30, 50, 100],
744
742
  "pager-count": e.pagerCount,
745
743
  total: e.total,
746
744
  class: "pagination",
747
745
  layout: "total, sizes, prev, pager, next, jumper",
748
- onSizeChange: l,
749
- onCurrentChange: o
746
+ onSizeChange: g,
747
+ onCurrentChange: l
750
748
  }, null, 8, ["current-page", "page-size", "pager-count", "total"])), [
751
749
  [J, e.total > 0]
752
750
  ]);
753
751
  };
754
752
  }
755
- }), Ye = /* @__PURE__ */ P(De, [["__scopeId", "data-v-1e34e383"]]), Me = [
756
- de,
757
- pe,
758
- ve,
753
+ }), De = /* @__PURE__ */ W(Ye, [["__scopeId", "data-v-1e34e383"]]), $e = [
754
+ me,
755
+ fe,
756
+ ke,
759
757
  // 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 };
758
+ _e,
759
+ Me,
760
+ De
761
+ ], q = [], He = (e, a) => {
762
+ $e.forEach((t) => {
763
+ q.push(t.name), e.component(t.name, t);
764
+ }), console.log("mwl-components", q);
765
+ }, Ie = { install: He };
768
766
  export {
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,
777
- $e as install
767
+ me as ContentWarp,
768
+ fe as Dialog,
769
+ ke as EasyForm,
770
+ _e as EasyTable,
771
+ Me as MenuTree,
772
+ De as Pagination,
773
+ be as componentsMap,
774
+ Ie as default,
775
+ he as getPlaceholder,
776
+ He as install
778
777
  };
@@ -1 +1 @@
1
- .el-card[data-v-6e7d743c]{background-color:transparent;margin-bottom:10px}[data-v-6e7d743c] .el-card__body:has(>.el-form){padding:18px 20px 0}[data-v-6e7d743c] .el-card__body{padding:20px;height:100%}.custom-dialog{padding:0;box-shadow:0 0 5px 0 var(--el-text-color-secondary)}.custom-dialog .el-dialog__header{padding:0}.dialog-header{--el-dialog-padding-primary: 20px;border-bottom:1px solid var(--el-border-color);padding:var(--el-dialog-padding-primary);padding-bottom:10px;padding-right:44px;display:flex;align-items:center;justify-content:space-between;color:var(--el-text-color-primary)}.dialog-header .fullScreen{cursor:pointer;z-index:99}.dialog-header .fullScreen:hover{color:var(--el-color-primary)}.el-dialog__headerbtn{--el-message-close-size: 20px;top:7px;margin-right:10px;width:20px}.el-dialog__body{padding:20px 30px}.el-dialog__footer{padding:10px 20px 20px;border-top:1px solid var(--el-border-color)}.is-hover:hover{color:var(--el-color-primary)}[data-v-eb8139e8] .el-form-item__label{font-size:var(--el-font-size-base)}.easy-form .el-form-item[data-v-eb8139e8]{margin-right:10px}[data-v-eb8139e8] .el-date-editor{flex-grow:initial}[data-v-6bcfc120] .el-table,[data-v-6bcfc120] th.el-table__cell,[data-v-6bcfc120] tr{background-color:transparent!important}.menu_icon[data-v-261ce99a]{width:22px;height:22px;margin-right:5px;fill:currentColor;display:inline-block;font-size:16px}.pagination[data-v-1e34e383]{margin-top:15px;margin-bottom:15px;float:right}@media screen and (max-width: 1370px){.pagination[data-v-1e34e383]{margin-top:8px;margin-bottom:8px}}
1
+ .el-card[data-v-fdaaba5e]{background-color:transparent;margin-bottom:10px}[data-v-fdaaba5e] .el-card__body:has(>.el-form){padding:18px 20px 0}[data-v-fdaaba5e] .el-card__body{padding:20px;height:100%}[data-v-fdaaba5e] .el-card__footer{padding:0 20px}.custom-dialog{padding:0;box-shadow:0 0 5px 0 var(--el-text-color-secondary)}.custom-dialog .el-dialog__header{padding:0}.dialog-header{--el-dialog-padding-primary: 20px;border-bottom:1px solid var(--el-border-color);padding:var(--el-dialog-padding-primary);padding-bottom:10px;padding-right:44px;display:flex;align-items:center;justify-content:space-between;color:var(--el-text-color-primary)}.dialog-header .fullScreen{cursor:pointer;z-index:99}.dialog-header .fullScreen:hover{color:var(--el-color-primary)}.el-dialog__headerbtn{--el-message-close-size: 20px;top:7px;margin-right:10px;width:20px}.el-dialog__body{padding:20px 30px}.el-dialog__footer{padding:10px 20px 20px;border-top:1px solid var(--el-border-color)}.is-hover:hover{color:var(--el-color-primary)}[data-v-ebcd5674] .el-form-item__label{font-size:var(--el-font-size-base)}.easy-form .el-form-item[data-v-ebcd5674]{margin-right:10px}[data-v-ebcd5674] .el-date-editor{flex-grow:initial}[data-v-1c87357b] .el-table,[data-v-1c87357b] th.el-table__cell,[data-v-1c87357b] tr{background-color:transparent!important}.menu_icon[data-v-261ce99a]{width:22px;height:22px;margin-right:5px;fill:currentColor;display:inline-block;font-size:16px}.pagination[data-v-1e34e383]{margin-top:15px;margin-bottom:15px;float:right}@media screen and (max-width: 1370px){.pagination[data-v-1e34e383]{margin-top:8px;margin-bottom:8px}}
@@ -51,6 +51,7 @@ export interface FormItem {
51
51
  };
52
52
  maxlength?: number;
53
53
  options?: Options;
54
+ data?: Array<any>;
54
55
  valueFormat?: string;
55
56
  format?: string;
56
57
  showType?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mwl-components",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "module": "dist/index.js",