@elementplus-kit/uikit 1.6.0 → 1.7.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.
Files changed (65) hide show
  1. package/build.log +0 -0
  2. package/components/button/index.ts +4 -0
  3. package/components/button/src/constants.ts +50 -0
  4. package/components/button/src/index.ts +264 -0
  5. package/components/button/style/index.scss +3 -0
  6. package/components/config.ts +4 -0
  7. package/components/dialog/index.ts +6 -0
  8. package/components/dialog/src/constants.ts +3 -0
  9. package/components/dialog/src/index.ts +54 -0
  10. package/components/dialog/style/index.scss +18 -0
  11. package/components/dictLabel/index.ts +4 -0
  12. package/components/dictLabel/src/index.vue +21 -0
  13. package/components/drawer/index.ts +4 -0
  14. package/components/drawer/src/constants.ts +3 -0
  15. package/components/drawer/src/index.ts +53 -0
  16. package/components/drawer/style/index.scss +18 -0
  17. package/components/form/index.ts +4 -0
  18. package/components/form/src/FormItem.ts +398 -0
  19. package/components/form/src/constants.ts +161 -0
  20. package/components/form/src/index.ts +198 -0
  21. package/components/form/src/types.ts +39 -0
  22. package/components/form/src/utils.ts +4 -0
  23. package/components/form/style/index.scss +5 -0
  24. package/components/pagination/index.ts +4 -0
  25. package/components/pagination/src/constants.ts +5 -0
  26. package/components/pagination/src/index.ts +50 -0
  27. package/components/search/index.ts +4 -0
  28. package/components/search/src/index.tsx +294 -0
  29. package/components/search/style/index.scss +104 -0
  30. package/components/table/index.ts +4 -0
  31. package/components/table/src/TableColumn.ts +116 -0
  32. package/components/table/src/constants.ts +42 -0
  33. package/components/table/src/index.ts +250 -0
  34. package/components/table/src/index2.ts +219 -0
  35. package/components/table/src/index3.ts +233 -0
  36. package/components/table/src/tableDictLabel.vue +21 -0
  37. package/components/table/src/tableaa.ts +71 -0
  38. package/components/table/src/type.ts +0 -0
  39. package/components/table/type/index.scss +0 -0
  40. package/components/table2/index.ts +4 -0
  41. package/components/table2/src/config.ts +5 -0
  42. package/components/table2/src/index.ts +12 -0
  43. package/components/table2/src/render.ts +136 -0
  44. package/components/table2/src/types.ts +39 -0
  45. package/components/table2/style/index.scss +0 -0
  46. package/components//346/250/241/346/235/277/index.tsx +57 -0
  47. package/components//346/250/241/346/235/277/ttt.ts +66 -0
  48. package/components//346/250/241/346/235/277/ttt.vue +18 -0
  49. package/index.ts +2 -0
  50. package/package.json +1 -4
  51. package/vite.config.ts +30 -0
  52. package//345/205/266/344/273/226/core/dialog/elementPlus/dialogWarp.vue +151 -0
  53. package//345/205/266/344/273/226/core/dialog/index.ts +10 -0
  54. package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.ts +15 -0
  55. package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.vue +16 -0
  56. package//345/205/266/344/273/226/core/form/elementPlus/formRender.ts +55 -0
  57. package//345/205/266/344/273/226/core/form/index.ts +10 -0
  58. package//345/205/266/344/273/226/core/table/config.ts +5 -0
  59. package//345/205/266/344/273/226/core/table/render.ts +91 -0
  60. package//345/205/266/344/273/226/core/table/warp.ts +11 -0
  61. package//345/205/266/344/273/226/core/utils/fetch.ts +58 -0
  62. package//345/205/266/344/273/226/useMessage.ts +95 -0
  63. package/dist/index.css +0 -1
  64. package/dist/index.mjs +0 -1079
  65. package/dist/index.umd.js +0 -1
package/dist/index.mjs DELETED
@@ -1,1079 +0,0 @@
1
- import { defineComponent as j, inject as ne, toRefs as J, h as a, provide as oe, ref as R, getCurrentInstance as K, computed as W, toDisplayString as se, onMounted as ue, onUnmounted as ce, createVNode as S, mergeProps as H, resolveComponent as I, Fragment as ie, createTextVNode as V, isVNode as de } from "vue";
2
- import { ElFormItem as fe, ElText as pe, ElSwitch as me, ElSlider as ve, ElColorPicker as be, ElRate as he, ElTimePicker as ge, ElDatePicker as ye, ElTimeSelect as Ee, ElCheckboxGroup as Oe, ElCheckbox as Se, ElRadioGroup as Ae, ElRadioButton as Ce, ElRadio as Ne, ElTreeSelect as xe, ElCascader as we, ElSelectV2 as Te, ElSelect as Re, ElOption as Le, ElInputNumber as je, ElInput as G, ElForm as ke, ElRow as Ie, ElCol as _e, ElTable as Q, ElTableColumn as F, ElPagination as De, ElDialog as Fe, ElDrawer as Be, ElDropdown as Pe, ElDropdownItem as $e, ElButton as Ve } from "element-plus";
3
- import M, { isFunction as $, isBoolean as X, has as Y, isArray as Z, capitalize as Ye } from "lodash-es";
4
- import { ArrowUpBold as ze } from "@element-plus/icons-vue";
5
- const z = {
6
- input: {
7
- elName: "input",
8
- defaultAttrs: {},
9
- events: [
10
- "blur",
11
- "focus",
12
- "change",
13
- "input",
14
- "clear",
15
- "keydown",
16
- "mouseleave",
17
- "mouseenter",
18
- "compositionstart",
19
- "compositionupdate",
20
- "compositionend"
21
- ],
22
- slots: ["prefix", "suffix", "prepend", "append"]
23
- },
24
- textarea: {
25
- elName: "textarea",
26
- defaultAttrs: {},
27
- events: ["blur", "focus", "change", "input"]
28
- },
29
- "input-number": {
30
- elName: "input-number",
31
- defaultAttrs: {},
32
- events: ["change", "Function", "blur", "focus"],
33
- slots: ["decrease-icon", "increase-icon", "prefix", "suffix"]
34
- },
35
- select: {
36
- elName: "select",
37
- defaultAttrs: {},
38
- events: ["change", "visible-change", "remove-tag", "clear", "blur", "focus", "popup-scroll"],
39
- slots: ["default", "header", "footer", "prefix", "empty", "tag", "loading", "label"]
40
- },
41
- "select-v2": {
42
- elName: "select-v2",
43
- defaultAttrs: {},
44
- events: ["focus", "blur", "selectedLabel"],
45
- slots: ["default", "header", "footer", "prefix", "empty", "tag", "loading", "label"]
46
- },
47
- cascader: {
48
- elName: "cascader",
49
- defaultAttrs: {},
50
- events: ["change", "expand-change", "blur", "focus", "clear", "visible-change", "remove-tag"],
51
- slots: ["default", "empty", "prefix", "suggestion-item", "tag"]
52
- },
53
- "tree-select": {
54
- elName: "tree-select",
55
- defaultAttrs: {},
56
- events: ["change", "clear", "blur", "focus"],
57
- slots: ["default"]
58
- },
59
- radio: {
60
- elName: "radio",
61
- defaultAttrs: {},
62
- events: ["change"]
63
- // slots: ['default'],
64
- },
65
- checkbox: {
66
- elName: "checkbox",
67
- defaultAttrs: {},
68
- events: ["change"]
69
- // slots: ['default'],
70
- },
71
- "time-select": {
72
- elName: "time-select",
73
- defaultAttrs: {},
74
- events: ["change", "blur", "focus", "clear"]
75
- },
76
- "date-picker": {
77
- elName: "date-picker",
78
- defaultAttrs: {},
79
- events: [
80
- "change",
81
- "blur",
82
- "focus",
83
- "clear",
84
- "calendar-change",
85
- "panel-change",
86
- "visible-change"
87
- ],
88
- slots: ["default", "range-separator", "prev-month", "next-month", "prev-year", "next-year"]
89
- },
90
- "time-picker": {
91
- elName: "time-picker",
92
- defaultAttrs: {},
93
- events: ["change", "blur", "focus", "clear", "visible-change"],
94
- slots: []
95
- },
96
- rate: {
97
- elName: "rate",
98
- defaultAttrs: {},
99
- events: ["change"]
100
- },
101
- "color-picker": {
102
- elName: "color-picker",
103
- defaultAttrs: {},
104
- events: ["change", "active-change", "focus", "blur"]
105
- },
106
- slider: {
107
- elName: "slider",
108
- defaultAttrs: {},
109
- events: ["change", "input"]
110
- },
111
- switch: {
112
- elName: "switch",
113
- defaultAttrs: {},
114
- events: ["change"],
115
- slots: ["active-action", "inactive-action"]
116
- },
117
- text: {
118
- elName: "text",
119
- defaultAttrs: {},
120
- slots: ["default"]
121
- },
122
- html: {},
123
- slot: {}
124
- }, Me = () => {
125
- let e = [];
126
- return Object.keys(z).map((t) => {
127
- const f = z[t]?.events;
128
- f?.length > 0 && e.push(...f);
129
- }), e = [...new Set(e)], e;
130
- }, We = (e) => e.replace(/(?:^|-)(\w)/g, (t, f) => f.toUpperCase()), He = {
131
- model: { type: Object, default: () => {
132
- } },
133
- // 表单名称
134
- label: { type: String, default: "" },
135
- // 表单类型
136
- type: { type: String, default: "" },
137
- // 表单key
138
- prop: { type: String, default: "" },
139
- // 必填
140
- required: { type: Boolean, default: !1 },
141
- // 全部只读
142
- // allReadonly: { type: Boolean<PropType<Boolean | Object>>, default: false },
143
- allReadonly: { type: Object, default: null },
144
- // todo 上面传的类型是null报警告
145
- // formItem 属性
146
- formItem: { type: Object, default: () => {
147
- } },
148
- // 表单类型属性
149
- attrs: { type: Object, default: () => {
150
- } },
151
- // 字典
152
- dictType: { type: String, default: void 0 },
153
- // 字典选项
154
- options: { type: Array, default: () => [] },
155
- // 字典选项
156
- optionsRef: { type: Object, default: () => {
157
- } },
158
- mergeParams: { type: Object, default: () => {
159
- } }
160
- }, Ue = j({
161
- props: He,
162
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
163
- const { formSlots: c, events: E } = ne("formContext"), {
164
- model: g,
165
- type: O,
166
- label: C,
167
- prop: i,
168
- required: n,
169
- allReadonly: p,
170
- formItem: l,
171
- attrs: d,
172
- dictType: A,
173
- options: N
174
- } = J(e), y = () => {
175
- const v = {};
176
- return z[O.value]?.slots?.forEach((h) => {
177
- const T = `${i.value}.${h}`;
178
- Object.keys(c).map((x) => {
179
- x === T && (v[h] = c[x]);
180
- });
181
- }), v;
182
- }, o = () => {
183
- const v = {};
184
- return z[O.value]?.events?.forEach((h) => {
185
- const T = `on${We(h)}`;
186
- v[T] = (...x) => E(h, i.value, ...x);
187
- }), v;
188
- }, b = () => {
189
- let v = !1;
190
- return $(d.value?.disabled) && (v = d.value.disabled(e.mergeParams)), X(d.value?.disabled) && (v = d.value.disabled), p.value && (v = !0), { disabled: v };
191
- }, r = () => {
192
- const v = z[O.value]?.defaultAttrs || {}, s = {
193
- ref: (h) => _(h, i.value),
194
- // modelValue: model.value[prop.value],
195
- // 'onUpdate:modelValue': (val) => (model.value[prop.value] = val),
196
- ...v,
197
- ...d.value,
198
- ...b()
199
- };
200
- return ["html"].includes(O.value) || (s.modelValue = g.value[i.value], s["onUpdate:modelValue"] = (h) => g.value[i.value] = h), s;
201
- }, _ = (v, s) => {
202
- e.optionsRef[`${s}Ref`] = v;
203
- }, w = {
204
- input: () => a(
205
- G,
206
- {
207
- clearable: !0,
208
- ...r(),
209
- ...o()
210
- },
211
- { ...y() }
212
- ),
213
- textarea: () => a(G, {
214
- ...r(),
215
- ...o(),
216
- type: "textarea"
217
- }),
218
- "input-number": () => a(
219
- je,
220
- {
221
- ...r(),
222
- ...o()
223
- },
224
- { ...y() }
225
- ),
226
- select: () => a(
227
- Re,
228
- {
229
- clearable: !0,
230
- ...r(),
231
- ...o()
232
- },
233
- () => N?.value?.map((v) => a(Le, {
234
- ...v,
235
- label: v.label,
236
- value: v.value,
237
- key: v.value
238
- }))
239
- ),
240
- "select-v2": () => a(Te, {
241
- options: N.value,
242
- clearable: !0,
243
- ...r(),
244
- ...o()
245
- }),
246
- cascader: () => a(
247
- we,
248
- {
249
- options: N.value,
250
- clearable: !0,
251
- ...r(),
252
- ...o()
253
- },
254
- { ...y() }
255
- ),
256
- "tree-select": () => a(
257
- xe,
258
- {
259
- data: N.value,
260
- clearable: !0,
261
- ...r(),
262
- ...o()
263
- },
264
- { ...y() }
265
- ),
266
- radio: () => a(
267
- Ae,
268
- {
269
- ...r(),
270
- ...o()
271
- },
272
- {
273
- default: () => N?.value?.map((s) => a(s.radioButton ? Ce : Ne, {
274
- ...s,
275
- label: s.label,
276
- value: s.value,
277
- key: s.value
278
- }))
279
- }
280
- ),
281
- checkbox: () => a(
282
- Oe,
283
- {
284
- ...r(),
285
- ...o()
286
- },
287
- {
288
- default: () => N?.value?.map((s) => a(Se, {
289
- ...s,
290
- label: s.label,
291
- value: s.value,
292
- key: s.value
293
- }))
294
- }
295
- ),
296
- "time-select": () => a(Ee, {
297
- ...r(),
298
- ...o()
299
- }),
300
- "date-picker": () => {
301
- const v = d.value?.type || "date", h = {
302
- year: "YYYY",
303
- month: "YYYY-MM",
304
- date: "YYYY-MM-DD"
305
- }[v];
306
- return a(
307
- ye,
308
- {
309
- type: v,
310
- valueFormat: h,
311
- ...r(),
312
- ...o()
313
- },
314
- { ...y() }
315
- );
316
- },
317
- "time-picker": () => a(ge, {
318
- valueFormat: "HH:mm:ss",
319
- ...r(),
320
- ...o()
321
- }),
322
- rate: () => a(he, {
323
- ...r(),
324
- ...o()
325
- }),
326
- "color-picker": () => a(be, {
327
- ...r(),
328
- ...o()
329
- }),
330
- slider: () => a(ve, {
331
- ...r(),
332
- ...o()
333
- }),
334
- switch: () => a(
335
- me,
336
- {
337
- ...r(),
338
- ...o()
339
- },
340
- { ...y() }
341
- ),
342
- text: () => a(pe, {
343
- ...r()
344
- }),
345
- html: () => a("div", {
346
- innerHTML: g.value[i.value],
347
- ...r()
348
- }),
349
- slot: () => c[i.value]?.(g.value)
350
- }, D = () => c[i.value] ? w.slot() : O.value === "slot" ? `表单属性 ${i.value} 插槽模板未定义` : w[O.value] ? w[O.value]() : (console.error(`不支持的表单类型 ${O.value}`), `不支持的表单类型 ${O.value}`), k = () => {
351
- const v = D();
352
- return a(
353
- fe,
354
- {
355
- label: C.value,
356
- prop: i.value,
357
- rules: n.value ? [
358
- {
359
- required: !0,
360
- message: `${C.value} 必填`,
361
- trigger: "blur"
362
- }
363
- ] : void 0,
364
- ...l.value
365
- },
366
- {
367
- default: () => v
368
- }
369
- );
370
- };
371
- return () => k();
372
- }
373
- }), qe = {
374
- // 表单数据
375
- model: { type: Object, default: () => ({}) },
376
- // 表单项
377
- formOptions: { type: Array, default: () => [] },
378
- // 只读
379
- readonly: { type: Boolean, default: !1 },
380
- // row 间距
381
- gutter: {
382
- // tode 类型错误警告
383
- type: Number || String,
384
- default: void 0
385
- },
386
- // row 列数
387
- col: { type: Number, default: void 0 },
388
- // 额外业务全局参数
389
- params: { type: Object, default: () => ({}) }
390
- }, Ge = j({
391
- props: qe,
392
- emits: [...Me()],
393
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
394
- oe("formContext", {
395
- formSlots: u,
396
- events: (b, ...r) => {
397
- f(b, ...r);
398
- }
399
- });
400
- const c = R({});
401
- m({
402
- optionsRef: c
403
- });
404
- const { model: E, formOptions: g, readonly: O, gutter: C, col: i } = J(e), n = K(), p = (b) => {
405
- b && (n.exposed = b, n.exposeProxy = b);
406
- }, l = W(() => O.value), d = W(
407
- () => ["", 0].includes(C?.value) || i?.value || g?.value.some((b) => Y(b, "col"))
408
- ), A = () => {
409
- const b = y();
410
- return d.value ? a(
411
- Ie,
412
- {
413
- class: "c-row",
414
- // gutter: gutter.value === 0 || gutter.value ? gutter.value : 10,
415
- gutter: C.value || 20,
416
- ...t
417
- },
418
- {
419
- default: () => b
420
- }
421
- ) : b;
422
- }, N = W(() => ({ formData: E.value, params: e.params })), y = () => {
423
- const b = [];
424
- return g.value.map((r) => {
425
- $(r?.vIf) && r.vIf(N.value) !== void 0 ? r.vIf(N.value) && b.push(r) : b.push(r);
426
- }), b.map((r) => {
427
- const _ = () => a(Ue, {
428
- class: "c-form-itme",
429
- model: E.value,
430
- allReadonly: l,
431
- mergeParams: N.value,
432
- ...r,
433
- optionsRef: c.value
434
- });
435
- if (d.value) {
436
- let w, D = `col.${r.prop}`;
437
- return r?.colSlot ? Y(u, D) ? w = u[D] : w = () => "col插槽模板未定义" : Y(u, D) && (w = u[D]), a(
438
- _e,
439
- {
440
- class: "c-col",
441
- span: Y(r, "col") ? r.col : i?.value ? i?.value : d.value ? 8 : void 0
442
- },
443
- {
444
- default: () => w ? w() : _()
445
- }
446
- );
447
- } else
448
- return _();
449
- });
450
- }, o = () => a(
451
- ke,
452
- {
453
- ref: p,
454
- ...t,
455
- model: E.value,
456
- class: l.value ? "isReadonly c-form" : "c-form"
457
- // 放在 $attrs 后面可自动合并 放在 $attrs 前面会被 $attrs.class 覆盖, h函数渲染的是标签就会覆盖 是组件就会合并不用管顺序
458
- },
459
- {
460
- default: () => A()
461
- }
462
- );
463
- return () => o();
464
- }
465
- }), Je = /* @__PURE__ */ j({
466
- __name: "tableDictLabel",
467
- props: {
468
- options: {
469
- type: Array,
470
- default: () => []
471
- },
472
- value: {
473
- type: String,
474
- default: ""
475
- }
476
- },
477
- setup(e) {
478
- const t = e, f = W(() => t.options?.find((m) => m.value == t.value.toString())?.label || t.value);
479
- return (u, m) => se(f.value);
480
- }
481
- }), Ke = ["default", "append", "empty"], Qe = ["default", "header", "filter-icon", "expand"], Xe = {
482
- module: {
483
- type: Object,
484
- default: () => {
485
- }
486
- },
487
- params: {
488
- // 额外业务全局参数
489
- type: Object,
490
- default: () => {
491
- }
492
- },
493
- // isRadio: { // 是否为单选框
494
- // type: Boolean,
495
- // default: false,
496
- // },
497
- // isCheckbox: { // 是否为复选框
498
- // type: Boolean,
499
- // default: false,
500
- // },
501
- columns: {
502
- // 列数据
503
- type: Array,
504
- default: () => []
505
- },
506
- showSelection: {
507
- // 是否显示选择列
508
- type: Boolean,
509
- default: !1
510
- },
511
- showIndex: {
512
- // 是否显示索引列
513
- type: Boolean,
514
- default: !1
515
- }
516
- }, Ze = j({
517
- props: Xe,
518
- // emits: eventList,
519
- // attrs, emit会继承, slots需要设置
520
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
521
- const c = K(), E = (i) => {
522
- i && (c.exposed = i, c.exposeProxy = i);
523
- }, g = () => {
524
- const i = [];
525
- e.showSelection && i.push(
526
- a(F, {
527
- type: "selection",
528
- width: 50,
529
- align: "center"
530
- })
531
- ), e.showIndex && i.push(
532
- a(F, {
533
- label: "序号",
534
- type: "index",
535
- width: 60,
536
- align: "center"
537
- })
538
- );
539
- const n = (p, l) => {
540
- p.map((d) => {
541
- const { children: A, ...N } = d;
542
- if ($(d.vIf) && d.vIf(e.params) !== void 0 && !d.vIf(e.params))
543
- return;
544
- const y = [];
545
- A?.length && n(A, y);
546
- const o = {};
547
- if (Qe.map((b) => {
548
- const r = `${d.prop}.${b}`;
549
- u[r] && (o[b] = u[r]);
550
- }), u[d.prop] ? o.default = u[d.prop] : $(d.render) ? o.default = d.render : Z(d.options) && (o.default = (b) => a(Je, {
551
- options: d.options,
552
- value: b.row[d.prop]
553
- })), Object.keys(o).length) {
554
- const b = () => {
555
- let r;
556
- return y.length ? r = { ...o, default: () => y } : r = { ...o }, r;
557
- };
558
- l.push(
559
- a(
560
- F,
561
- { ...N, class: "c-table-column" },
562
- b()
563
- )
564
- );
565
- } else {
566
- const b = () => {
567
- let r;
568
- return y.length && (r = { default: () => y }), r;
569
- };
570
- l.push(
571
- a(
572
- F,
573
- { ...N, class: "c-table-column" },
574
- b()
575
- )
576
- );
577
- }
578
- });
579
- };
580
- return n(e.columns, i), i;
581
- }, O = () => {
582
- const i = {};
583
- return Ke.map((n) => {
584
- u[n] && (i[n] = u[n]);
585
- }), i;
586
- }, C = () => {
587
- const i = g();
588
- return a(
589
- Q,
590
- {
591
- ref: E,
592
- ...t,
593
- class: "c-table"
594
- },
595
- {
596
- default: () => i,
597
- ...O()
598
- }
599
- );
600
- };
601
- return () => C();
602
- }
603
- }), L = {
604
- OPERATION_COL_LABEL: "操作",
605
- OPERATION_SLOT_NAME: "custom",
606
- CHILDREN_SLOT_KEY: "children"
607
- };
608
- function et(e, t, f, u) {
609
- return a(Q, { data: t, class: "c-table" }, {
610
- default: () => tt(e, u)
611
- });
612
- }
613
- function tt(e, t) {
614
- const f = [];
615
- if (M.isObject(e) && Object.keys(e).forEach((m) => {
616
- let c = e[m], E = t[m];
617
- if (t[`${m}.header`]) {
618
- let g = te(m, c), O = {
619
- header: (C) => t[`${m}.header`](C)
620
- };
621
- t[m] && (O.default = (C) => [t[m](C)]), f.push(a(F, g, O));
622
- } else
623
- f.push(ee(m, c, E, t));
624
- }), t[L.OPERATION_SLOT_NAME]) {
625
- let u = { label: L.OPERATION_COL_LABEL };
626
- if (t[`${L.OPERATION_SLOT_NAME}.header`]) {
627
- let m = {
628
- header: (c) => t[`${L.OPERATION_SLOT_NAME}.header`](c),
629
- default: (c) => [t[L.OPERATION_SLOT_NAME](c)]
630
- };
631
- f.push(a(F, u, m));
632
- } else {
633
- let m = {
634
- default: (c) => [t[L.OPERATION_SLOT_NAME](c)]
635
- };
636
- f.push(a(F, u, m));
637
- }
638
- }
639
- return f;
640
- }
641
- function ee(e, t, f, u) {
642
- let m = te(e, t);
643
- delete m[L.CHILDREN_SLOT_KEY];
644
- let c = [];
645
- if (t[L.CHILDREN_SLOT_KEY] && M.isObject(t[L.CHILDREN_SLOT_KEY])) {
646
- let g = t[L.CHILDREN_SLOT_KEY];
647
- M.isObject(g) && Object.keys(g).forEach((C) => {
648
- let i = g[C], n = u[C];
649
- c.push(
650
- ee(C, i, n, u)
651
- );
652
- });
653
- }
654
- let E = () => [];
655
- return f ? E = {
656
- default: (g) => [...c, f(g)]
657
- } : E = {
658
- default: () => [...c]
659
- }, a(F, m, E);
660
- }
661
- function te(e, t) {
662
- if (M.isString(t))
663
- return {
664
- prop: e,
665
- label: t
666
- };
667
- if (M.isObject(t))
668
- return {
669
- prop: e,
670
- ...t
671
- };
672
- }
673
- const lt = j({
674
- props: ["schema", "data"],
675
- emits: [],
676
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
677
- return () => et(e.schema, e.data, f, u);
678
- }
679
- }), rt = {
680
- // small: false,
681
- pageSizes: [10, 20, 50, 100, 200, 500],
682
- layout: "total, sizes, prev, pager, next, jumper"
683
- }, at = j({
684
- // props: propsAttrs,
685
- // emits: eventList,
686
- // attrs, emit会继承, slots需要设置
687
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
688
- const c = () => ({
689
- ...rt
690
- // 设置默认值
691
- // ...attrs, // 当前传入覆盖默认值 第一层标签就是组件可以不用传入
692
- }), E = () => a(De, {
693
- // ref: pageRef,
694
- ...c(),
695
- class: "c-pagination"
696
- });
697
- return () => E();
698
- }
699
- }), nt = {
700
- destroyOnClose: !0
701
- }, ot = Ye("C"), st = j({
702
- name: `${ot}Dialog`,
703
- // props: propsAttrs,
704
- // emits: eventList,
705
- // attrs, emit会继承, slots需要设置
706
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
707
- const c = () => ({
708
- ...nt
709
- // 设置默认值
710
- }), E = () => a(
711
- Fe,
712
- {
713
- // ref: dialogRef,
714
- ...c(),
715
- class: "c-dialog"
716
- },
717
- u
718
- );
719
- return () => E();
720
- }
721
- }), ut = {
722
- destroyOnClose: !0
723
- }, ct = j({
724
- // props: propsAttrs,
725
- // emits: eventList,
726
- // attrs, emit会继承, slots需要设置
727
- setup(e, { attrs: t, emit: f, slots: u, expose: m }) {
728
- const c = () => ({
729
- ...ut
730
- // 设置默认值
731
- }), E = () => a(
732
- Be,
733
- {
734
- // ref: drawerRef,
735
- ...c(),
736
- class: "c-drawer"
737
- },
738
- u
739
- );
740
- return () => E();
741
- }
742
- });
743
- function U(e) {
744
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !de(e);
745
- }
746
- const it = /* @__PURE__ */ j({
747
- props: {
748
- modelValue: {
749
- type: Object,
750
- default: {}
751
- },
752
- formOptions: {
753
- type: Array,
754
- default: () => []
755
- },
756
- isDrawer: {
757
- type: Boolean,
758
- default: !1
759
- }
760
- },
761
- emits: ["update:modelValue", "search", "reset", "close"],
762
- setup(e, {
763
- emit: t,
764
- slots: f,
765
- attrs: u,
766
- expose: m
767
- }) {
768
- const c = ["btn-left", "btn-right"], E = () => {
769
- let s = {};
770
- return Object.keys(u)?.forEach((h) => {
771
- h.indexOf("on") === 0 && (s[h] = u[h]);
772
- }), s;
773
- }, g = () => {
774
- let s = {};
775
- return Object.keys(f).forEach((h) => {
776
- c.includes(h) || (s[h] = f[h]);
777
- }), s;
778
- }, O = () => {
779
- t("search"), l.value = !1, document.removeEventListener("click", p);
780
- }, C = () => {
781
- t("reset");
782
- }, i = () => {
783
- l.value = !1, document.removeEventListener("click", p), t("close");
784
- }, n = R(null), p = (s) => {
785
- l.value && n.value && !n.value?.$el?.contains(s.target) && (l.value = !1, document.removeEventListener("click", p));
786
- }, l = R(!1), d = () => {
787
- l.value ? (l.value = !1, document.removeEventListener("click", p)) : (l.value = !0, setTimeout(() => {
788
- document.addEventListener("click", p);
789
- }, 0));
790
- }, A = R(6), N = R(null), y = R(null), o = R(null), b = R(null), r = R(null);
791
- let _ = null;
792
- const w = () => {
793
- _ && clearTimeout(_), _ = setTimeout(() => {
794
- D();
795
- }, 200);
796
- }, D = () => {
797
- if (o.value) {
798
- const s = o.value.children[0], h = y.value.offsetWidth;
799
- let T = 0;
800
- A.value = s?.children?.length, Array.from(s.children).map((x, B) => {
801
- if (x.style.display = "inline-flex", T > h) {
802
- x.style.display = "none";
803
- return;
804
- }
805
- const le = window.getComputedStyle(x).marginRight, re = parseFloat(le), ae = x.offsetWidth + re;
806
- T = T + ae, T > h && (x.style.display = "none", A.value = B, T = 1e5);
807
- });
808
- }
809
- }, k = R(0), v = () => {
810
- const s = y.value.children[0];
811
- new ResizeObserver((T) => {
812
- for (const B of T) {
813
- const P = B.contentRect.width;
814
- P !== k.value && (k.value === 0 || P < k.value - 25 ? (k.value = P, w()) : P > k.value + 25 && (w(), k.value = P));
815
- }
816
- }).observe(s);
817
- };
818
- return ue(() => {
819
- v(), window.addEventListener("resize", w);
820
- }), ce(() => {
821
- window.removeEventListener("resize", w), document.removeEventListener("click", p);
822
- }), () => {
823
- let s, h, T;
824
- return S("div", {
825
- className: "c-search"
826
- }, [S("div", {
827
- className: "c-search-simple",
828
- ref: N
829
- }, [S("div", {
830
- className: "c-search-simple-form",
831
- ref: y
832
- }, [S("div", {
833
- className: "c-simple-form-container",
834
- ref: o
835
- }, [S(q, H({
836
- ref: (x) => r.value = x
837
- }, E(), {
838
- inline: !0,
839
- model: e.modelValue,
840
- formOptions: e.formOptions
841
- }), U(s = g()) ? s : {
842
- default: () => [s]
843
- })])]), S("div", {
844
- className: "c-search-simple-btn",
845
- ref: b
846
- }, [f["arrow-left"]?.(), A.value < e.formOptions?.length && S("div", {
847
- className: `c-search-simple-icon ${l.value ? "icon-rotate" : ""}`,
848
- onClick: d
849
- }, [S(I("el-icon"), {
850
- className: "el-icon c-search-icon"
851
- }, {
852
- default: () => [S(ze, null, null)]
853
- })]), f["search-btn"] ? f["search-btn"]() : S(ie, null, [f["btn-left"]?.(), S(I("el-button"), {
854
- type: "primary",
855
- onClick: O
856
- }, {
857
- default: () => [V("搜索")]
858
- }), S(I("el-button"), {
859
- type: "primary",
860
- onClick: C
861
- }, {
862
- default: () => [V("重置")]
863
- }), f["btn-right"]?.()])])]), !e.isDrawer && l.value && S(I("transition"), {
864
- name: "search-form-transition"
865
- }, {
866
- default: () => [S(I("el-card"), {
867
- ref: n,
868
- className: "c-search-form el-card is-always-shadow"
869
- }, {
870
- default: () => [S(q, H(E(), {
871
- inline: !0,
872
- model: e.modelValue,
873
- formOptions: e.formOptions.filter((x, B) => B >= A.value),
874
- ref: "formRef"
875
- }), U(h = g()) ? h : {
876
- default: () => [h]
877
- }), S("div", {
878
- style: "text-align: right;"
879
- }, [S(I("el-button"), {
880
- type: "primary",
881
- onClick: O
882
- }, {
883
- default: () => [V("搜索")]
884
- }), S(I("el-button"), {
885
- type: "primary",
886
- onClick: i
887
- }, {
888
- default: () => [V("关闭")]
889
- })])]
890
- })]
891
- }), e.isDrawer && S(ft, {
892
- title: "搜索",
893
- modelValue: l.value,
894
- "onUpdate:modelValue": (x) => l.value = x,
895
- size: "660px"
896
- }, {
897
- default: () => [S(q, H(E(), {
898
- col: 12,
899
- model: e.modelValue,
900
- formOptions: e.formOptions.filter((x, B) => B >= A.value),
901
- ref: "formRef"
902
- }), U(T = g()) ? T : {
903
- default: () => [T]
904
- }), S("div", {
905
- style: "text-align: right;"
906
- }, [S(I("el-button"), {
907
- type: "primary",
908
- onClick: O
909
- }, {
910
- default: () => [V("搜索")]
911
- }), S(I("el-button"), {
912
- type: "primary",
913
- onClick: i
914
- }, {
915
- default: () => [V("关闭")]
916
- })])]
917
- })]);
918
- };
919
- }
920
- }), dt = j({
921
- props: {
922
- params: {
923
- // 用于验证自定义函数的外部数据
924
- type: Object,
925
- default: () => ({})
926
- },
927
- btnOptions: {
928
- type: Array,
929
- default: () => []
930
- },
931
- // 权限验证函数
932
- permit: {
933
- type: Function
934
- },
935
- size: {
936
- type: String,
937
- default: void 0
938
- },
939
- plain: {
940
- type: Boolean,
941
- default: void 0
942
- },
943
- text: {
944
- type: Boolean,
945
- default: void 0
946
- },
947
- link: {
948
- type: Boolean,
949
- default: void 0
950
- },
951
- // 折叠
952
- fold: {
953
- type: Boolean,
954
- default: !1
955
- },
956
- // 折叠数量
957
- foldNum: {
958
- type: Number,
959
- default: 0
960
- }
961
- // // 权限函数
962
- // hasRole: {
963
- // type: Function,
964
- // default: () => true
965
- // },
966
- },
967
- emits: ["btnAction"],
968
- setup(e, { emit: t, slots: f, attrs: u, expose: m }) {
969
- const c = (n) => {
970
- let p = {
971
- size: e.size,
972
- plain: e.plain,
973
- text: e.text,
974
- link: e.link,
975
- class: `c-btn-alias-${n.alias || ""}`
976
- };
977
- const l = ["label", "alias", "permit", "vIf", "disable"];
978
- return Object.keys(n).map((d) => {
979
- l.includes(d) || (p[d] = n[d]);
980
- }), X(n.disable) && (p.disabled = n.disable), $(n.disable) && n.disable(e.params) !== void 0 && (p.disabled = n.disable(e.params)), p;
981
- }, E = (n) => {
982
- const p = c(n), l = {
983
- splitButton: !0
984
- };
985
- return [
986
- "type",
987
- "size",
988
- "splitButton",
989
- "disabled",
990
- "placement",
991
- "effect",
992
- "trigger"
993
- ].forEach((A) => {
994
- p[A] !== void 0 && (l[A] = p[A]);
995
- }), l;
996
- }, g = () => {
997
- const n = [];
998
- e.btnOptions.map((l) => {
999
- Z(l.permit) && l.permit.length > 0 && $(e.permit) ? e.permit(l.permit) && n.push(l) : n.push(l);
1000
- });
1001
- const p = [];
1002
- return n.map((l) => {
1003
- Y(l, "vIf") && $(l.vIf) && l.vIf(e.params) !== void 0 ? l.vIf(e.params) && p.push(l) : p.push(l);
1004
- }), p;
1005
- }, O = (n) => a(
1006
- Ve,
1007
- {
1008
- ...c(n),
1009
- onClick: () => {
1010
- t("btnAction", n.alias, e.params);
1011
- }
1012
- },
1013
- {
1014
- default: () => n?.label
1015
- }
1016
- ), C = (n) => {
1017
- const p = [], l = [], d = [];
1018
- n.map((y, o) => {
1019
- o < e.foldNum ? p.push(y) : o === e.foldNum ? l.push(y) : d.push(y);
1020
- }), l.length > 0 && d.length === 0 && p.push(l[0]);
1021
- let A = [];
1022
- const N = p.map((y) => O(y));
1023
- if (N.length > 0 && (A = A.concat(N)), l.length > 0 && d.length > 0) {
1024
- const y = a(
1025
- Pe,
1026
- {
1027
- ...E(l[0]),
1028
- class: "c-btn-dropdown",
1029
- buttonProps: c(l[0]),
1030
- splitButton: !0,
1031
- // splitButton: dropdownItemList.length > 0,
1032
- onClick: () => {
1033
- t("btnAction", l[0].alias, e.params);
1034
- },
1035
- onCommand: (o) => {
1036
- t("btnAction", o, e.params);
1037
- }
1038
- },
1039
- {
1040
- default: () => l[0].label,
1041
- dropdown: () => d.map((o) => a(
1042
- $e,
1043
- {
1044
- command: o.alias
1045
- },
1046
- {
1047
- default: () => o?.label
1048
- }
1049
- ))
1050
- }
1051
- );
1052
- A = A.concat(y);
1053
- }
1054
- return A;
1055
- }, i = () => {
1056
- const n = g();
1057
- return e.fold ? C(n) : n.map((p) => O(p));
1058
- };
1059
- return () => i();
1060
- }
1061
- }), q = Ge, ht = Ze, gt = lt, yt = at, Et = st, ft = ct, Ot = it, St = dt;
1062
- export {
1063
- dt as Button,
1064
- St as CButton,
1065
- Et as CDialog,
1066
- ft as CDrawer,
1067
- q as CForm,
1068
- yt as CPagination,
1069
- Ot as CSearch,
1070
- ht as CTable,
1071
- gt as CTable2,
1072
- st as Dialog,
1073
- ct as Drawer,
1074
- Ge as Form,
1075
- at as Pagination,
1076
- it as Search,
1077
- Ze as Table,
1078
- lt as Table2
1079
- };