joy-admin-components 0.1.26 → 0.1.28

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,38 +1,643 @@
1
- import { ElForm as d, ElRow as i, ElCol as s } from "element-plus";
2
- import { defineComponent as c, ref as y, onMounted as g, h as r } from "vue";
3
- const u = c({
4
- name: "JoyForm",
5
- setup(o, { slots: t, attrs: n, emit: m }) {
6
- const f = y(null), a = () => t.default ? t.default().filter((e) => e.type !== Symbol.for("v-cmt")).map((e) => e.type === Symbol.for("v-fgt") ? e.children : e).flat().map(
7
- (e) => {
8
- var l;
9
- return r(
10
- s,
11
- { span: ((l = e.props) == null ? void 0 : l.span) || 24 },
1
+ import { ElForm as _e, ElRow as ve, ElCol as ye, dayjs as oe } from "element-plus";
2
+ import { defineComponent as re, ref as w, onMounted as ue, h as W, mergeModels as se, useAttrs as be, useModel as Ce, computed as P, resolveComponent as m, openBlock as f, createBlock as _, mergeProps as q, unref as A, withCtx as g, renderSlot as L, createVNode as x, createTextVNode as H, toDisplayString as T, createCommentVNode as B, createElementBlock as S, Fragment as Z, renderList as ie, withModifiers as ee, nextTick as ce, createElementVNode as Y, resolveDynamicComponent as de, withKeys as ke, normalizeStyle as xe, normalizeClass as te, reactive as X, onUnmounted as Ve } from "vue";
3
+ import { difference as $e, debounce as fe, cloneDeep as we } from "lodash";
4
+ import { useI18n as ne } from "vue-i18n";
5
+ const Ke = re({
6
+ name: "LayOutForm",
7
+ setup(n, { slots: u, attrs: t, emit: a }) {
8
+ const l = w(null), c = () => u.default ? u.default().filter((i) => i.type !== Symbol.for("v-cmt")).map((i) => i.type === Symbol.for("v-fgt") ? i.children : i).flat().map(
9
+ (i) => {
10
+ var r;
11
+ return W(
12
+ ye,
13
+ { span: ((r = i.props) == null ? void 0 : r.span) || 24 },
12
14
  {
13
- default: () => e
15
+ default: () => i
14
16
  }
15
17
  );
16
18
  }
17
19
  ) : null;
18
- g(() => {
19
- m("ref", f.value);
20
+ ue(() => {
21
+ a("ref", l.value);
20
22
  });
21
- function p() {
22
- return r(
23
- d,
24
- { ...n, ref: f },
25
- () => r(i, { gutter: n.gutter ?? 20 }, { default: () => a() })
23
+ function o() {
24
+ return W(
25
+ _e,
26
+ { ...t, ref: l },
27
+ () => W(ve, { gutter: t.gutter ?? 20 }, { default: () => c() })
26
28
  );
27
29
  }
28
- return p;
30
+ return o;
29
31
  }
30
- }), S = {
31
- install: (o) => {
32
- o.component(u.name, u);
32
+ });
33
+ const j = (n, u) => {
34
+ const t = n.__vccOpts || n;
35
+ for (const [a, l] of u)
36
+ t[a] = l;
37
+ return t;
38
+ }, Fe = {
39
+ __name: "index",
40
+ props: /* @__PURE__ */ se({
41
+ api: {
42
+ type: Function
43
+ },
44
+ showCheckAll: {
45
+ type: Boolean,
46
+ default: !0
47
+ },
48
+ optionClick: {
49
+ type: Function
50
+ },
51
+ maxLimit: {
52
+ type: Number,
53
+ default: void 0
54
+ },
55
+ minLimit: {
56
+ type: Number,
57
+ default: void 0
58
+ },
59
+ data: {
60
+ type: Array
61
+ },
62
+ labelValue: {
63
+ type: Object,
64
+ default: () => ({
65
+ label: "label",
66
+ labelEn: "labelEn",
67
+ value: "value"
68
+ })
69
+ },
70
+ changeLocal: {
71
+ type: Boolean,
72
+ default: !1
73
+ }
74
+ }, {
75
+ modelValue: {},
76
+ modelModifiers: {}
77
+ }),
78
+ emits: /* @__PURE__ */ se(["success", "change"], ["update:modelValue"]),
79
+ setup(n, { emit: u }) {
80
+ const t = n, a = be(), { t: l, locale: c } = ne(), o = Ce(n, "modelValue"), i = P({
81
+ get() {
82
+ if (a.multiple == null || o.value == null)
83
+ return !1;
84
+ let s = t.data ? t.data : b.value, e = $e(
85
+ s.map((y) => a["value-key"] ? y : y[t.labelValue.value]),
86
+ o.value
87
+ ).length == 0;
88
+ return o.value.length == s.length && e;
89
+ },
90
+ set(s) {
91
+ return s;
92
+ }
93
+ }), r = u, b = w([]), h = async () => {
94
+ const { data: s } = await t.api();
95
+ b.value = [...s], r("success", b);
96
+ };
97
+ t.api && h();
98
+ const v = t.labelValue.label.split("-"), $ = (s) => {
99
+ if (v.length == 1) {
100
+ if (t.changeLocal)
101
+ return l(s[t.labelValue.label]);
102
+ let e = c.value == "en_us" ? s[t.labelValue.labelEn || "i18nName"] : s[t.labelValue.label];
103
+ return e = e || s[t.labelValue.label], e;
104
+ } else {
105
+ let e = [];
106
+ return v.forEach((y) => {
107
+ e.push(s[y]);
108
+ }), e.join("-");
109
+ }
110
+ };
111
+ function E(s) {
112
+ let e = t.data ? t.data : b.value;
113
+ o.value = s ? e.map((y) => a["value-key"] ? y : y[t.labelValue.value]) : [], ce(() => {
114
+ r("change", o.value);
115
+ });
116
+ }
117
+ function z(s) {
118
+ t.optionClick && t.optionClick(s), t.optionClick && r("change", a["value-key"] ? s : s[t.labelValue.value]);
119
+ }
120
+ function F(s) {
121
+ r("change", s);
122
+ }
123
+ function N(s) {
124
+ return a.multiple != null && a.multiple != !1 && t.maxLimit > 0 ? o.value.length >= t.maxLimit && !o.value.includes(s[t.labelValue.value]) : a.multiple != null && a.multiple != !1 && t.minLimit > 0 ? o.value.length <= t.minLimit && o.value.includes(s[t.labelValue.value]) : !1;
125
+ }
126
+ return (s, e) => {
127
+ const y = m("el-checkbox"), M = m("el-option"), C = m("el-select");
128
+ return f(), _(C, q({
129
+ modelValue: o.value,
130
+ "onUpdate:modelValue": e[1] || (e[1] = (V) => o.value = V)
131
+ }, A(a), {
132
+ filterable: "",
133
+ "collapse-tags": "",
134
+ "collapse-tags-tooltip": "",
135
+ clearable: "",
136
+ onClear: F,
137
+ onChange: F
138
+ }), {
139
+ default: g(() => [
140
+ A(a).multiple != null && A(a).multiple != !1 && n.showCheckAll ? L(s.$slots, "header", { key: 0 }, () => [
141
+ x(y, {
142
+ class: "mgl20",
143
+ modelValue: i.value,
144
+ "onUpdate:modelValue": e[0] || (e[0] = (V) => i.value = V),
145
+ onChange: E
146
+ }, {
147
+ default: g(() => [
148
+ H(T(s.$t("quan-xuan")), 1)
149
+ ]),
150
+ _: 1
151
+ }, 8, ["modelValue"])
152
+ ], !0) : B("", !0),
153
+ (f(!0), S(Z, null, ie(n.data ? n.data : b.value, (V, K) => (f(), _(M, {
154
+ key: K,
155
+ disabled: N(V),
156
+ label: $(V),
157
+ onClick: ee((G) => z(V), ["stop"]),
158
+ value: A(a)["value-key"] ? V : V[n.labelValue.value]
159
+ }, null, 8, ["disabled", "label", "onClick", "value"]))), 128))
160
+ ]),
161
+ _: 3
162
+ }, 16, ["modelValue"]);
163
+ };
164
+ }
165
+ }, De = /* @__PURE__ */ j(Fe, [["__scopeId", "data-v-02dd2f72"]]), Ge = {
166
+ __name: "index",
167
+ emits: ["ok", "no"],
168
+ setup(n, { emit: u }) {
169
+ const t = u, a = fe(() => {
170
+ t("ok");
171
+ }, 500);
172
+ function l() {
173
+ t("no");
174
+ }
175
+ return (c, o) => {
176
+ const i = m("el-link"), r = m("el-popconfirm");
177
+ return f(), _(r, q(c.$attrs, {
178
+ onConfirm: A(a),
179
+ onCancel: l
180
+ }), {
181
+ reference: g(() => [
182
+ x(i, {
183
+ underline: "never",
184
+ type: c.$attrs.type
185
+ }, {
186
+ default: g(() => [
187
+ L(c.$slots, "default")
188
+ ]),
189
+ _: 3
190
+ }, 8, ["type"])
191
+ ]),
192
+ _: 3
193
+ }, 16, ["onConfirm"]);
194
+ };
33
195
  }
34
196
  };
197
+ const ze = ["accept"], Se = {
198
+ __name: "index",
199
+ props: {
200
+ accept: {
201
+ type: String,
202
+ default: ".xlsx,.xls"
203
+ },
204
+ loading: {
205
+ type: Boolean,
206
+ default: !1
207
+ }
208
+ },
209
+ emits: ["fileChange"],
210
+ setup(n, { emit: u }) {
211
+ const t = u, a = w(null);
212
+ function l(c) {
213
+ let o = c.target.files[0];
214
+ t("fileChange", o), a.value.value = null;
215
+ }
216
+ return (c, o) => {
217
+ const i = m("el-button");
218
+ return f(), S("span", null, [
219
+ x(i, {
220
+ loading: n.loading,
221
+ class: "mgr10",
222
+ onClick: o[0] || (o[0] = (r) => a.value.click())
223
+ }, {
224
+ default: g(() => [
225
+ H(T(c.$t("dao-ru")), 1)
226
+ ]),
227
+ _: 1
228
+ }, 8, ["loading"]),
229
+ Y("input", {
230
+ onChange: l,
231
+ ref_key: "input",
232
+ ref: a,
233
+ accept: n.accept,
234
+ style: { position: "absolute", width: "0px", height: "0px", opacity: "0" },
235
+ type: "file"
236
+ }, null, 40, ze)
237
+ ]);
238
+ };
239
+ }
240
+ }, Je = /* @__PURE__ */ j(Se, [["__scopeId", "data-v-5f1449ad"]]);
241
+ const Ye = re({
242
+ props: {
243
+ name: {
244
+ tyepe: String,
245
+ required: !0
246
+ }
247
+ }
248
+ });
249
+ function Le(n, u, t, a, l, c) {
250
+ const o = m("el-icon");
251
+ return f(), _(o, { class: "cmp-icon" }, {
252
+ default: g(() => [
253
+ (f(), _(de(n.name)))
254
+ ]),
255
+ _: 1
256
+ });
257
+ }
258
+ const pe = /* @__PURE__ */ j(Ye, [["render", Le], ["__scopeId", "data-v-733f9daa"]]);
259
+ const Be = { key: 0 }, Me = { class: "btns" }, Re = { class: "left" }, Ae = { class: "right" }, He = {
260
+ __name: "index",
261
+ props: {
262
+ form: {
263
+ type: Object,
264
+ required: !0
265
+ }
266
+ },
267
+ emits: ["confirm", "reset"],
268
+ setup(n, { emit: u }) {
269
+ const t = u, a = w(!0), l = w(null), { t: c } = ne(), o = P(() => a.value ? c("guan-bi") : c("zhan-kai"));
270
+ function i() {
271
+ t("confirm");
272
+ }
273
+ function r() {
274
+ t("reset");
275
+ }
276
+ function b() {
277
+ t("confirm");
278
+ }
279
+ return (h, v) => {
280
+ const $ = m("el-input"), E = m("el-date-picker"), z = m("el-form-item"), F = m("el-form"), N = m("el-link"), s = m("el-button");
281
+ return f(), S("div", {
282
+ class: "searchBar-container mgt10 mgb10",
283
+ onKeydown: ke(i, ["enter"])
284
+ }, [
285
+ Y("div", {
286
+ class: "searchBar",
287
+ style: xe({ height: a.value ? "auto" : "42px" })
288
+ }, [
289
+ x(F, {
290
+ inline: "",
291
+ model: n.form.data
292
+ }, {
293
+ default: g(() => [
294
+ (f(!0), S(Z, null, ie(n.form.items.filter((e) => !e.hidden), (e) => (f(), S(Z, {
295
+ key: e.key
296
+ }, [
297
+ e.type == "br" ? (f(), S("br", Be)) : (f(), _(z, {
298
+ key: 1,
299
+ label: e.name
300
+ }, {
301
+ default: g(() => {
302
+ var y, M;
303
+ return [
304
+ e.type === "input" ? (f(), _($, {
305
+ key: 0,
306
+ modelValue: e.value,
307
+ "onUpdate:modelValue": (C) => e.value = C,
308
+ class: te(((y = e.option) == null ? void 0 : y.class) || "w150"),
309
+ placeholder: h.$t("qing-shu-ru"),
310
+ clearable: ""
311
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder"])) : e.type === "custom" ? (f(), _(de(e.render), { key: 1 })) : B("", !0),
312
+ e.type === "select" ? (f(), _(De, q({
313
+ key: 2,
314
+ class: ((M = e.option) == null ? void 0 : M.class) || "w150",
315
+ modelValue: e.value,
316
+ "onUpdate:modelValue": (C) => e.value = C
317
+ }, { ref_for: !0 }, e.option, {
318
+ onChange: i,
319
+ onClear: i
320
+ }), null, 16, ["class", "modelValue", "onUpdate:modelValue"])) : B("", !0),
321
+ e.type === "date" ? (f(), _(E, {
322
+ key: 3,
323
+ class: te({ datetimerange: "w300", daterange: "w200" }[e.dateType] || "w100"),
324
+ modelValue: e.value,
325
+ "onUpdate:modelValue": (C) => e.value = C,
326
+ "value-format": { datetimerange: "YYYY-MM-DD HH:mm:ss", daterange: "YYYY-MM-DD" }[e.dateType] || "YYYY-MM-DD",
327
+ type: e.dateType || "date",
328
+ onFocus: (C) => l.value = e,
329
+ onChange: (C) => b(),
330
+ placeholder: h.$t("qing-xuan-ze"),
331
+ "start-placeholder": h.$t("kai-shi-shi-jian"),
332
+ "end-placeholder": h.$t("jie-shu-shi-jian")
333
+ }, null, 8, ["class", "modelValue", "onUpdate:modelValue", "value-format", "type", "onFocus", "onChange", "placeholder", "start-placeholder", "end-placeholder"])) : B("", !0)
334
+ ];
335
+ }),
336
+ _: 2
337
+ }, 1032, ["label"]))
338
+ ], 64))), 128))
339
+ ]),
340
+ _: 1
341
+ }, 8, ["model"])
342
+ ], 4),
343
+ Y("div", Me, [
344
+ Y("div", Re, [
345
+ L(h.$slots, "table-header-left", {}, void 0, !0)
346
+ ]),
347
+ Y("div", Ae, [
348
+ x(N, {
349
+ underline: "never",
350
+ class: "mgr10",
351
+ onClick: v[0] || (v[0] = (e) => a.value = !a.value)
352
+ }, {
353
+ default: g(() => [
354
+ x(pe, {
355
+ name: a.value ? "ArrowUp" : "ArrowDown"
356
+ }, null, 8, ["name"]),
357
+ H(" " + T(o.value), 1)
358
+ ]),
359
+ _: 1
360
+ }),
361
+ x(s, {
362
+ type: "primary",
363
+ onClick: i
364
+ }, {
365
+ default: g(() => [
366
+ H(T(h.$t("shai-xuan")), 1)
367
+ ]),
368
+ _: 1
369
+ }),
370
+ x(s, {
371
+ type: "primary",
372
+ onClick: r
373
+ }, {
374
+ default: g(() => [
375
+ H(T(h.$t("chong-zhi")), 1)
376
+ ]),
377
+ _: 1
378
+ }),
379
+ L(h.$slots, "btn", {}, void 0, !0)
380
+ ])
381
+ ])
382
+ ], 32);
383
+ };
384
+ }
385
+ }, Te = /* @__PURE__ */ j(He, [["__scopeId", "data-v-f3f60f9c"]]);
386
+ function Ee(n) {
387
+ return n ? Array.isArray(n) ? n : n.split(",").map((u) => u.trim()).filter(Boolean) : [];
388
+ }
389
+ function O(n) {
390
+ let u = {};
391
+ return n.forEach((t) => {
392
+ const { key: a, type: l, option: c = {}, value: o, dateType: i, toArr: r } = t;
393
+ if (l == "input" && (c != null && c.multiple))
394
+ u[a] = Ee(o);
395
+ else if (l == "date")
396
+ if (i.includes("range")) {
397
+ const [b, h] = a;
398
+ let [v, $] = o || [];
399
+ v && i == "daterange" && (v = oe(v).format("YYYY-MM-DD 00:00:00"), $ = oe($).format("YYYY-MM-DD 23:59:59")), u[b] = v, u[h] = $;
400
+ } else
401
+ u[a] = o;
402
+ else
403
+ l == "select" ? u[a] = r ? [o] : o : u[a] = o;
404
+ }), u;
405
+ }
406
+ const Ne = { class: "center" }, Ue = {
407
+ __name: "index",
408
+ props: {
409
+ // 表格id 本地存储列设置时使用
410
+ id: {
411
+ type: String,
412
+ required: !0
413
+ },
414
+ loading: {
415
+ type: Boolean,
416
+ default: !1
417
+ },
418
+ // 是否立即请求
419
+ immediate: {
420
+ type: Boolean,
421
+ default: !0
422
+ },
423
+ searchForm: {
424
+ type: Object,
425
+ default: () => ({
426
+ items: [],
427
+ selections: [],
428
+ showSearch: !1,
429
+ showPage: !1,
430
+ showShadow: !1,
431
+ showCheckBox: !1
432
+ })
433
+ },
434
+ api: {
435
+ type: Function
436
+ },
437
+ data: {
438
+ type: Array
439
+ },
440
+ tableConfig: {
441
+ type: Object,
442
+ default: () => ({})
443
+ }
444
+ },
445
+ setup(n, { expose: u }) {
446
+ const { t, locale: a } = ne(), l = n, c = w(!1), o = w([]), i = we(l.searchForm.items), r = X({
447
+ pageNo: 1,
448
+ pageSize: 10,
449
+ total: 0
450
+ }), b = w(null), h = w(450), v = fe(() => {
451
+ ce(() => {
452
+ if (!b.value)
453
+ return;
454
+ const p = b.value.getBoundingClientRect(), k = window.innerHeight, D = p.top, R = 100, J = k - D - R, Q = 200;
455
+ h.value = Math.max(J, Q);
456
+ });
457
+ }, 100), $ = () => {
458
+ v();
459
+ };
460
+ ue(() => {
461
+ v(), window.addEventListener("resize", $);
462
+ }), Ve(() => {
463
+ window.removeEventListener("resize", $);
464
+ });
465
+ const E = P(() => C.value.height || h.value);
466
+ async function z(d) {
467
+ const { dataFormat: p } = l.tableConfig;
468
+ c.value = !0;
469
+ const { code: k, data: D = {} } = await l.api(d).finally(() => {
470
+ c.value = !1, l.searchForm.selections = [];
471
+ });
472
+ if (k == 200) {
473
+ let R = D.rows || [];
474
+ o.value = p ? p(R) : R, r.total = D.totalRows || 0;
475
+ }
476
+ }
477
+ function F(d = {}) {
478
+ z({ ...r, ...O(l.searchForm.items), ...d });
479
+ }
480
+ async function N() {
481
+ const { reset: d } = l.tableConfig;
482
+ l.searchForm.items.forEach((p) => {
483
+ const k = i.find((D) => D.key == p.key);
484
+ k && (p.value = k.value);
485
+ }), d && await d(), F();
486
+ }
487
+ l.api && l.immediate && F();
488
+ function s() {
489
+ return { ...r, ...O(l.searchForm.items) };
490
+ }
491
+ const e = w(null);
492
+ u({ tableRef: e, getList: F, getPrm: s, calculateTableHeight: v });
493
+ const y = X({
494
+ storage: !0
495
+ }), M = X({
496
+ drag: !0,
497
+ resizable: !0,
498
+ maxFixedSize: 0
499
+ }), C = P(() => {
500
+ const {
501
+ customConfig: d,
502
+ columnConfig: p,
503
+ ...k
504
+ } = l.tableConfig;
505
+ return {
506
+ headerAlign: "left",
507
+ align: "center",
508
+ customConfig: { ...y, ...d },
509
+ "column-config": { ...M, ...p },
510
+ // 列过多时 自动宽度 虚拟滚动会闪屏 关闭虚拟滚动
511
+ "virtual-x-config": {
512
+ enabled: !1,
513
+ scrollToLeftOnChange: !0
514
+ },
515
+ // 纵向虚拟滚动 大于100条开启
516
+ "virtual-y-config": { enabled: !0, gt: 100 },
517
+ ...k
518
+ };
519
+ }), V = (d) => {
520
+ r.pageNo = d, z({ ...r, ...O(l.searchForm.items) });
521
+ }, K = (d) => {
522
+ r.pageSize = d, r.pageNo = 1, z({ ...r, ...O(l.searchForm.items) });
523
+ };
524
+ function G() {
525
+ const d = e.value.getCheckboxRecords();
526
+ l.searchForm.selections = d;
527
+ }
528
+ const ae = (d) => {
529
+ const p = e.value;
530
+ if (p) {
531
+ p.toggleCheckboxRow(d);
532
+ const k = e.value.getCheckboxRecords();
533
+ l.searchForm.selections = k;
534
+ }
535
+ };
536
+ return (d, p) => {
537
+ const k = m("el-button"), D = m("el-checkbox"), R = m("el-text"), J = m("vxe-column"), Q = m("VxeTable"), me = m("el-pagination");
538
+ return f(), S("div", {
539
+ class: te({ box: n.searchForm.showShadow })
540
+ }, [
541
+ n.searchForm.showSearch ? (f(), _(Te, {
542
+ key: 0,
543
+ form: n.searchForm,
544
+ onReset: N,
545
+ onConfirm: p[1] || (p[1] = (U) => F())
546
+ }, {
547
+ btn: g(() => [
548
+ L(d.$slots, "search-bar-btn", {}, void 0, !0),
549
+ x(k, {
550
+ round: "",
551
+ onClick: p[0] || (p[0] = (U) => e.value.openCustom())
552
+ }, {
553
+ default: g(() => [
554
+ x(pe, { name: "Tools" })
555
+ ]),
556
+ _: 1
557
+ })
558
+ ]),
559
+ _: 3
560
+ }, 8, ["form"])) : B("", !0),
561
+ L(d.$slots, "table-header-left", {}, void 0, !0),
562
+ Y("div", {
563
+ ref_key: "tableContentRef",
564
+ ref: b
565
+ }, [
566
+ x(Q, q({
567
+ id: n.id,
568
+ ref_key: "tableRef",
569
+ ref: e,
570
+ loading: n.loading || c.value,
571
+ data: n.api ? o.value : n.data
572
+ }, C.value, {
573
+ height: E.value,
574
+ onCheckboxChange: G,
575
+ onCheckboxAll: G,
576
+ border: ""
577
+ }), {
578
+ default: g(() => [
579
+ n.searchForm.showCheckBox ? (f(), _(J, {
580
+ key: 0,
581
+ type: "checkbox",
582
+ width: A(a) == "zh_cn" ? 80 : 150,
583
+ fixed: "left",
584
+ title: d.$t("xu-hao")
585
+ }, {
586
+ checkbox: g(({ rowIndex: U, row: le, checked: ge, disabled: I, indeterminate: je }) => [
587
+ Y("div", Ne, [
588
+ ge ? (f(), _(D, {
589
+ key: 0,
590
+ checked: !0,
591
+ disabled: I,
592
+ size: "default",
593
+ onClick: ee((he) => !I && ae(le), ["stop"])
594
+ }, null, 8, ["disabled", "onClick"])) : (f(), _(D, {
595
+ key: 1,
596
+ disabled: I,
597
+ checked: !1,
598
+ size: "default",
599
+ onClick: ee((he) => !I && ae(le), ["stop"])
600
+ }, null, 8, ["disabled", "onClick"])),
601
+ x(R, {
602
+ type: "info",
603
+ class: "mgl5"
604
+ }, {
605
+ default: g(() => [
606
+ H(T(U + 1), 1)
607
+ ]),
608
+ _: 2
609
+ }, 1024)
610
+ ])
611
+ ]),
612
+ _: 1
613
+ }, 8, ["width", "title"])) : B("", !0),
614
+ L(d.$slots, "default", {}, void 0, !0)
615
+ ]),
616
+ _: 3
617
+ }, 16, ["id", "loading", "data", "height"])
618
+ ], 512),
619
+ n.searchForm.showPage ? (f(), _(me, {
620
+ key: 1,
621
+ "current-page": r.pageNo,
622
+ "onUpdate:currentPage": p[2] || (p[2] = (U) => r.pageNo = U),
623
+ class: "myPagination mgt10",
624
+ background: "",
625
+ layout: "total, sizes, prev, pager, next",
626
+ total: r.total,
627
+ "page-size": r.pageSize,
628
+ "page-sizes": [10, 50, 100, 500],
629
+ onCurrentChange: V,
630
+ onSizeChange: K
631
+ }, null, 8, ["current-page", "total", "page-size"])) : B("", !0)
632
+ ], 2);
633
+ };
634
+ }
635
+ }, Qe = /* @__PURE__ */ j(Ue, [["__scopeId", "data-v-7b74503d"]]);
35
636
  export {
36
- u as JoyForm,
37
- S as default
637
+ De as CmpDictionary,
638
+ Ge as ConfrimButton,
639
+ Je as ImportButton,
640
+ Ke as LayOutForm,
641
+ Qe as ListPage,
642
+ Te as SearchBar
38
643
  };
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("element-plus"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.JoyAdminComponents={},e.ElementPlus,e.Vue))})(this,function(e,t,o){"use strict";const r=o.defineComponent({name:"JoyForm",setup(f,{slots:u,attrs:i,emit:m}){const l=o.ref(null),s=()=>u.default?u.default().filter(n=>n.type!==Symbol.for("v-cmt")).map(n=>n.type===Symbol.for("v-fgt")?n.children:n).flat().map(n=>{var d;return o.h(t.ElCol,{span:((d=n.props)==null?void 0:d.span)||24},{default:()=>n})}):null;o.onMounted(()=>{m("ref",l.value)});function a(){return o.h(t.ElForm,{...i,ref:l},()=>o.h(t.ElRow,{gutter:i.gutter??20},{default:()=>s()}))}return a}}),p={install:f=>{f.component(r.name,r)}};e.JoyForm=r,e.default=p,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(u,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("element-plus"),require("vue"),require("lodash"),require("vue-i18n")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","lodash","vue-i18n"],x):(u=typeof globalThis<"u"?globalThis:u||self,x(u.JoyAdminComponents={},u.ElementPlus,u.Vue,u._,u.VueI18n))})(this,function(u,x,e,T,Y){"use strict";const K=e.defineComponent({name:"LayOutForm",setup(o,{slots:i,attrs:n,emit:l}){const a=e.ref(null),p=()=>i.default?i.default().filter(d=>d.type!==Symbol.for("v-cmt")).map(d=>d.type===Symbol.for("v-fgt")?d.children:d).flat().map(d=>{var s;return e.h(x.ElCol,{span:((s=d.props)==null?void 0:s.span)||24},{default:()=>d})}):null;e.onMounted(()=>{l("ref",a.value)});function r(){return e.h(x.ElForm,{...n,ref:a},()=>e.h(x.ElRow,{gutter:n.gutter??20},{default:()=>p()}))}return r}}),se="",D=(o,i)=>{const n=o.__vccOpts||o;for(const[l,a]of i)n[l]=a;return n},U=D({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},optionClick:{type:Function},maxLimit:{type:Number,default:void 0},minLimit:{type:Number,default:void 0},data:{type:Array},labelValue:{type:Object,default:()=>({label:"label",labelEn:"labelEn",value:"value"})},changeLocal:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["success","change"],["update:modelValue"]),setup(o,{emit:i}){const n=o,l=e.useAttrs(),{t:a,locale:p}=Y.useI18n(),r=e.useModel(o,"modelValue"),d=e.computed({get(){if(l.multiple==null||r.value==null)return!1;let c=n.data?n.data:C.value,t=T.difference(c.map(_=>l["value-key"]?_:_[n.labelValue.value]),r.value).length==0;return r.value.length==c.length&&t},set(c){return c}}),s=i,C=e.ref([]),h=async()=>{const{data:c}=await n.api();C.value=[...c],s("success",C)};n.api&&h();const g=n.labelValue.label.split("-"),V=c=>{if(g.length==1){if(n.changeLocal)return a(c[n.labelValue.label]);let t=p.value=="en_us"?c[n.labelValue.labelEn||"i18nName"]:c[n.labelValue.label];return t=t||c[n.labelValue.label],t}else{let t=[];return g.forEach(_=>{t.push(c[_])}),t.join("-")}};function F(c){let t=n.data?n.data:C.value;r.value=c?t.map(_=>l["value-key"]?_:_[n.labelValue.value]):[],e.nextTick(()=>{s("change",r.value)})}function $(c){n.optionClick&&n.optionClick(c),n.optionClick&&s("change",l["value-key"]?c:c[n.labelValue.value])}function B(c){s("change",c)}function E(c){return l.multiple!=null&&l.multiple!=!1&&n.maxLimit>0?r.value.length>=n.maxLimit&&!r.value.includes(c[n.labelValue.value]):l.multiple!=null&&l.multiple!=!1&&n.minLimit>0?r.value.length<=n.minLimit&&r.value.includes(c[n.labelValue.value]):!1}return(c,t)=>{const _=e.resolveComponent("el-checkbox"),N=e.resolveComponent("el-option"),k=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(k,e.mergeProps({modelValue:r.value,"onUpdate:modelValue":t[1]||(t[1]=b=>r.value=b)},e.unref(l),{filterable:"","collapse-tags":"","collapse-tags-tooltip":"",clearable:"",onClear:B,onChange:B}),{default:e.withCtx(()=>[e.unref(l).multiple!=null&&e.unref(l).multiple!=!1&&o.showCheckAll?e.renderSlot(c.$slots,"header",{key:0},()=>[e.createVNode(_,{class:"mgl20",modelValue:d.value,"onUpdate:modelValue":t[0]||(t[0]=b=>d.value=b),onChange:F},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data?o.data:C.value,(b,A)=>(e.openBlock(),e.createBlock(N,{key:A,disabled:E(b),label:V(b),onClick:e.withModifiers(R=>$(b),["stop"]),value:e.unref(l)["value-key"]?b:b[o.labelValue.value]},null,8,["disabled","label","onClick","value"]))),128))]),_:3},16,["modelValue"])}}},[["__scopeId","data-v-02dd2f72"]]),G={__name:"index",emits:["ok","no"],setup(o,{emit:i}){const n=i,l=T.debounce(()=>{n("ok")},500);function a(){n("no")}return(p,r)=>{const d=e.resolveComponent("el-link"),s=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(s,e.mergeProps(p.$attrs,{onConfirm:e.unref(l),onCancel:a}),{reference:e.withCtx(()=>[e.createVNode(d,{underline:"never",type:p.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},de="",J=["accept"],Q=D({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:i}){const n=i,l=e.ref(null);function a(p){let r=p.target.files[0];n("fileChange",r),l.value.value=null}return(p,r)=>{const d=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(d,{loading:o.loading,class:"mgr10",onClick:r[0]||(r[0]=s=>l.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:a,ref_key:"input",ref:l,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,J)])}}},[["__scopeId","data-v-5f1449ad"]]),me="",W=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function X(o,i,n,l,a,p){const r=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(r,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const q=D(W,[["render",X],["__scopeId","data-v-733f9daa"]]),fe="",Z={key:0},v={class:"btns"},ee={class:"left"},te={class:"right"},I=D({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset"],setup(o,{emit:i}){const n=i,l=e.ref(!0),a=e.ref(null),{t:p}=Y.useI18n(),r=e.computed(()=>l.value?p("guan-bi"):p("zhan-kai"));function d(){n("confirm")}function s(){n("reset")}function C(){n("confirm")}return(h,g)=>{const V=e.resolveComponent("el-input"),F=e.resolveComponent("el-date-picker"),$=e.resolveComponent("el-form-item"),B=e.resolveComponent("el-form"),E=e.resolveComponent("el-link"),c=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(d,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:l.value?"auto":"42px"})},[e.createVNode(B,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(t=>!t.hidden),t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.key},[t.type=="br"?(e.openBlock(),e.createElementBlock("br",Z)):(e.openBlock(),e.createBlock($,{key:1,label:t.name},{default:e.withCtx(()=>{var _,N;return[t.type==="input"?(e.openBlock(),e.createBlock(V,{key:0,modelValue:t.value,"onUpdate:modelValue":k=>t.value=k,class:e.normalizeClass(((_=t.option)==null?void 0:_.class)||"w150"),placeholder:h.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):t.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.render),{key:1})):e.createCommentVNode("",!0),t.type==="select"?(e.openBlock(),e.createBlock(U,e.mergeProps({key:2,class:((N=t.option)==null?void 0:N.class)||"w150",modelValue:t.value,"onUpdate:modelValue":k=>t.value=k},{ref_for:!0},t.option,{onChange:d,onClear:d}),null,16,["class","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="date"?(e.openBlock(),e.createBlock(F,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[t.dateType]||"w100"),modelValue:t.value,"onUpdate:modelValue":k=>t.value=k,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[t.dateType]||"YYYY-MM-DD",type:t.dateType||"date",onFocus:k=>a.value=t,onChange:k=>C(),placeholder:h.$t("qing-xuan-ze"),"start-placeholder":h.$t("kai-shi-shi-jian"),"end-placeholder":h.$t("jie-shu-shi-jian")},null,8,["class","modelValue","onUpdate:modelValue","value-format","type","onFocus","onChange","placeholder","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0)]}),_:2},1032,["label"]))],64))),128))]),_:1},8,["model"])],4),e.createElementVNode("div",v,[e.createElementVNode("div",ee,[e.renderSlot(h.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",te,[e.createVNode(E,{underline:"never",class:"mgr10",onClick:g[0]||(g[0]=t=>l.value=!l.value)},{default:e.withCtx(()=>[e.createVNode(q,{name:l.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)]),_:1}),e.createVNode(c,{type:"primary",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.$t("shai-xuan")),1)]),_:1}),e.createVNode(c,{type:"primary",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.$t("chong-zhi")),1)]),_:1}),e.renderSlot(h.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-f3f60f9c"]]);function ne(o){return o?Array.isArray(o)?o:o.split(",").map(i=>i.trim()).filter(Boolean):[]}function M(o){let i={};return o.forEach(n=>{const{key:l,type:a,option:p={},value:r,dateType:d,toArr:s}=n;if(a=="input"&&(p!=null&&p.multiple))i[l]=ne(r);else if(a=="date")if(d.includes("range")){const[C,h]=l;let[g,V]=r||[];g&&d=="daterange"&&(g=x.dayjs(g).format("YYYY-MM-DD 00:00:00"),V=x.dayjs(V).format("YYYY-MM-DD 23:59:59")),i[C]=g,i[h]=V}else i[l]=r;else a=="select"?i[l]=s?[r]:r:i[l]=r}),i}const he="",oe={class:"center"},le=D({__name:"index",props:{id:{type:String,required:!0},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:i}){const{t:n,locale:l}=Y.useI18n(),a=o,p=e.ref(!1),r=e.ref([]),d=T.cloneDeep(a.searchForm.items),s=e.reactive({pageNo:1,pageSize:10,total:0}),C=e.ref(null),h=e.ref(450),g=T.debounce(()=>{e.nextTick(()=>{if(!C.value)return;const f=C.value.getBoundingClientRect(),y=window.innerHeight,w=f.top,S=100,H=y-w-S,j=200;h.value=Math.max(H,j)})},100),V=()=>{g()};e.onMounted(()=>{g(),window.addEventListener("resize",V)}),e.onUnmounted(()=>{window.removeEventListener("resize",V)});const F=e.computed(()=>k.value.height||h.value);async function $(m){const{dataFormat:f}=a.tableConfig;p.value=!0;const{code:y,data:w={}}=await a.api(m).finally(()=>{p.value=!1,a.searchForm.selections=[]});if(y==200){let S=w.rows||[];r.value=f?f(S):S,s.total=w.totalRows||0}}function B(m={}){$({...s,...M(a.searchForm.items),...m})}async function E(){const{reset:m}=a.tableConfig;a.searchForm.items.forEach(f=>{const y=d.find(w=>w.key==f.key);y&&(f.value=y.value)}),m&&await m(),B()}a.api&&a.immediate&&B();function c(){return{...s,...M(a.searchForm.items)}}const t=e.ref(null);i({tableRef:t,getList:B,getPrm:c,calculateTableHeight:g});const _=e.reactive({storage:!0}),N=e.reactive({drag:!0,resizable:!0,maxFixedSize:0}),k=e.computed(()=>{const{customConfig:m,columnConfig:f,...y}=a.tableConfig;return{headerAlign:"left",align:"center",customConfig:{..._,...m},"column-config":{...N,...f},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!0},"virtual-y-config":{enabled:!0,gt:100},...y}}),b=m=>{s.pageNo=m,$({...s,...M(a.searchForm.items)})},A=m=>{s.pageSize=m,s.pageNo=1,$({...s,...M(a.searchForm.items)})};function R(){const m=t.value.getCheckboxRecords();a.searchForm.selections=m}const O=m=>{const f=t.value;if(f){f.toggleCheckboxRow(m);const y=t.value.getCheckboxRecords();a.searchForm.selections=y}};return(m,f)=>{const y=e.resolveComponent("el-button"),w=e.resolveComponent("el-checkbox"),S=e.resolveComponent("el-text"),H=e.resolveComponent("vxe-column"),j=e.resolveComponent("VxeTable"),ae=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(I,{key:0,form:o.searchForm,onReset:E,onConfirm:f[1]||(f[1]=z=>B())},{btn:e.withCtx(()=>[e.renderSlot(m.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(y,{round:"",onClick:f[0]||(f[0]=z=>t.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(q,{name:"Tools"})]),_:1})]),_:3},8,["form"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:C},[e.createVNode(j,e.mergeProps({id:o.id,ref_key:"tableRef",ref:t,loading:o.loading||p.value,data:o.api?r.value:o.data},k.value,{height:F.value,onCheckboxChange:R,onCheckboxAll:R,border:""}),{default:e.withCtx(()=>[o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(H,{key:0,type:"checkbox",width:e.unref(l)=="zh_cn"?80:150,fixed:"left",title:m.$t("xu-hao")},{checkbox:e.withCtx(({rowIndex:z,row:P,checked:re,disabled:L,indeterminate:_e})=>[e.createElementVNode("div",oe,[re?(e.openBlock(),e.createBlock(w,{key:0,checked:!0,disabled:L,size:"default",onClick:e.withModifiers(ce=>!L&&O(P),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(w,{key:1,disabled:L,checked:!1,size:"default",onClick:e.withModifiers(ce=>!L&&O(P),["stop"])},null,8,["disabled","onClick"])),e.createVNode(S,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(z+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(ae,{key:1,"current-page":s.pageNo,"onUpdate:currentPage":f[2]||(f[2]=z=>s.pageNo=z),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:s.total,"page-size":s.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:b,onSizeChange:A},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-7b74503d"]]);u.CmpDictionary=U,u.ConfrimButton=G,u.ImportButton=Q,u.LayOutForm=K,u.ListPage=le,u.SearchBar=I,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .cmp-icon[data-v-02dd2f72],.cmp-icon[data-v-5f1449ad],.cmp-icon[data-v-733f9daa]{padding:0!important}.searchBar-container .searchBar[data-v-f3f60f9c]{overflow:hidden;transition:all .3s}.searchBar-container .btns[data-v-f3f60f9c]{display:flex;justify-content:space-between;align-items:center}.searchBar-container .btns .left[data-v-f3f60f9c]{display:flex;align-items:center}.searchBar-container .btns .left[data-v-f3f60f9c] .el-tabs__header{margin:0}.searchBar-container .btns .right[data-v-f3f60f9c]{text-align:right}[data-v-7b74503d] .vxe-table-custom-wrapper.placement--top-right.is--active{max-height:400px!important}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joy-admin-components",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "main": "./dist/joy-admin-components.umd.js",
5
5
  "module": "./dist/joy-admin-components.es.js",
6
6
  "types": "./src/index.d.ts",
@@ -13,7 +13,8 @@
13
13
  },
14
14
  "files": [
15
15
  "dist",
16
- "src/index.d.ts"
16
+ "src/index.d.ts",
17
+ "src/components/**/*.d.ts"
17
18
  ],
18
19
  "scripts": {
19
20
  "dev": "vite",
@@ -31,5 +32,12 @@
31
32
  "vite": "^4.4.6",
32
33
  "vue-i18n": "^9.10.1"
33
34
  },
34
- "devDependencies": {}
35
+ "devDependencies": {
36
+ "@vitejs/plugin-vue": "^4.6.2",
37
+ "element-plus": "^2.13.2",
38
+ "sass": "^1.97.3",
39
+ "vite": "^4.5.14",
40
+ "vue": "^3.5.29",
41
+ "vue-i18n": "^9.14.5"
42
+ }
35
43
  }
@@ -0,0 +1,43 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { SelectProps } from 'element-plus';
3
+
4
+ /**
5
+ * 字典选择器组件 - 基于 Element Plus Select 封装
6
+ * 支持 API 请求数据、全选、多语言等功能
7
+ */
8
+ export interface CmpDictionaryProps extends /* @vue-ignore */ Partial<SelectProps> {
9
+ /** 获取下拉数据的 API 函数 */
10
+ api?: () => Promise<{ data: any[] }>;
11
+ /** 是否显示全选复选框(仅多选模式),默认 true */
12
+ showCheckAll?: boolean;
13
+ /** 选项点击回调函数 */
14
+ optionClick?: (item: any) => void;
15
+ /** 多选模式下的最大选择数量 */
16
+ maxLimit?: number;
17
+ /** 多选模式下的最小选择数量 */
18
+ minLimit?: number;
19
+ /** 静态数据源(如果提供则不使用 api) */
20
+ data?: any[];
21
+ /** 字段映射配置 */
22
+ labelValue?: {
23
+ label?: string;
24
+ labelEn?: string;
25
+ value?: string;
26
+ };
27
+ /** 是否使用本地 i18n 翻译 label,默认 false */
28
+ changeLocal?: boolean;
29
+ /** v-model 绑定值 */
30
+ modelValue?: any;
31
+ }
32
+
33
+ export interface CmpDictionaryEmits {
34
+ /** API 请求成功后触发 */
35
+ (e: 'success', data: any[]): void;
36
+ /** 选择值变化时触发 */
37
+ (e: 'change', value: any): void;
38
+ /** v-model 更新事件 */
39
+ (e: 'update:modelValue', value: any): void;
40
+ }
41
+
42
+ declare const CmpDictionary: DefineComponent<CmpDictionaryProps, {}, any, {}, {}, {}, {}, CmpDictionaryEmits>;
43
+ export default CmpDictionary;
@@ -0,0 +1,19 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { PopconfirmProps } from 'element-plus';
3
+
4
+ /**
5
+ * 确认按钮组件 - 基于 Element Plus Popconfirm 封装
6
+ * 点击后弹出确认气泡,确认后执行操作(自动防抖 500ms)
7
+ * 继承 Element Plus ElPopconfirm 所有属性
8
+ */
9
+ export interface ConfrimButtonProps extends /* @vue-ignore */ Partial<PopconfirmProps> {}
10
+
11
+ export interface ConfrimButtonEmits {
12
+ /** 确认操作时触发(已防抖处理) */
13
+ (e: 'ok'): void;
14
+ /** 取消操作时触发 */
15
+ (e: 'no'): void;
16
+ }
17
+
18
+ declare const ConfrimButton: DefineComponent<ConfrimButtonProps, {}, any, {}, {}, {}, {}, ConfrimButtonEmits>;
19
+ export default ConfrimButton;
@@ -0,0 +1,20 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /**
4
+ * 导入按钮组件 - 文件上传按钮
5
+ * 点击按钮选择文件,支持自定义文件类型
6
+ */
7
+ export interface ImportButtonProps {
8
+ /** 接受的文件类型,默认 '.xlsx,.xls' */
9
+ accept?: string;
10
+ /** 按钮加载状态 */
11
+ loading?: boolean;
12
+ }
13
+
14
+ export interface ImportButtonEmits {
15
+ /** 文件选择后触发 */
16
+ (e: 'fileChange', file: File): void;
17
+ }
18
+
19
+ declare const ImportButton: DefineComponent<ImportButtonProps, {}, any, {}, {}, {}, {}, ImportButtonEmits>;
20
+ export default ImportButton;
@@ -0,0 +1,20 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { FormProps } from 'element-plus';
3
+
4
+ /**
5
+ * LayOutForm 组件 - 带栅格布局的表单容器
6
+ * 继承 Element Plus ElForm 所有属性
7
+ * 自动为表单项添加栅格布局,支持多列表单
8
+ */
9
+ export interface LayOutFormProps extends /* @vue-ignore */ FormProps {
10
+ /** 栅格间隔,默认 20 */
11
+ gutter?: number;
12
+ }
13
+
14
+ export interface LayOutFormEmits {
15
+ /** 组件挂载完成后触发,返回表单 ref */
16
+ (e: 'ref', formRef: any): void;
17
+ }
18
+
19
+ declare const LayOutForm: DefineComponent<LayOutFormProps, {}, any, {}, {}, {}, {}, LayOutFormEmits>;
20
+ export default LayOutForm;
@@ -0,0 +1,92 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /** 搜索表单项 */
4
+ export interface SearchFormItem {
5
+ /** 字段 key */
6
+ key: string;
7
+ /** 字段名称 */
8
+ name: string;
9
+ /** 字段值 */
10
+ value: any;
11
+ /** 表单项类型 */
12
+ type?: 'input' | 'select' | 'date' | 'custom' | 'br';
13
+ /** 日期类型 */
14
+ dateType?: 'date' | 'daterange' | 'datetimerange';
15
+ /** 是否隐藏 */
16
+ hidden?: boolean;
17
+ /** 自定义渲染函数(type 为 custom 时使用) */
18
+ render?: () => any;
19
+ /** 额外配置 */
20
+ option?: {
21
+ class?: string;
22
+ [key: string]: any;
23
+ };
24
+ }
25
+
26
+ /** 搜索表单配置 */
27
+ export interface SearchFormConfig {
28
+ /** 表单项列表 */
29
+ items: SearchFormItem[];
30
+ /** 选中的行数据(多选) */
31
+ selections?: any[];
32
+ /** 是否显示搜索栏 */
33
+ showSearch?: boolean;
34
+ /** 是否显示分页 */
35
+ showPage?: boolean;
36
+ /** 是否显示阴影 */
37
+ showShadow?: boolean;
38
+ /** 是否显示复选框 */
39
+ showCheckBox?: boolean;
40
+ }
41
+
42
+ /** 表格配置 */
43
+ export interface TableConfig {
44
+ /** 数据格式化函数 */
45
+ dataFormat?: (data: any[]) => any[];
46
+ /** 重置回调函数 */
47
+ reset?: () => void | Promise<void>;
48
+ /** 自定义配置 */
49
+ customConfig?: Record<string, any>;
50
+ /** 列配置 */
51
+ columnConfig?: Record<string, any>;
52
+ /** 表格高度 */
53
+ height?: number | string;
54
+ [key: string]: any;
55
+ }
56
+
57
+ /**
58
+ * ListPage 组件 - 列表页面容器
59
+ * 集成搜索栏、表格、分页等功能
60
+ * 基于 VxeTable 实现
61
+ */
62
+ export interface ListPageProps {
63
+ /** 表格唯一标识,用于本地存储列设置 */
64
+ id: string;
65
+ /** 加载状态 */
66
+ loading?: boolean;
67
+ /** 是否立即请求数据,默认 true */
68
+ immediate?: boolean;
69
+ /** 搜索表单配置 */
70
+ searchForm?: SearchFormConfig;
71
+ /** 获取列表数据的 API 函数 */
72
+ api?: (params: any) => Promise<{ code: number; data: { rows: any[]; totalRows: number } }>;
73
+ /** 静态数据源(如果提供则不使用 api) */
74
+ data?: any[];
75
+ /** 表格配置 */
76
+ tableConfig?: TableConfig;
77
+ }
78
+
79
+ /** ListPage 暴露的方法 */
80
+ export interface ListPageExpose {
81
+ /** VxeTable 实例 */
82
+ tableRef: any;
83
+ /** 刷新列表数据 */
84
+ getList: (params?: any) => void;
85
+ /** 获取当前搜索参数 */
86
+ getPrm: () => any;
87
+ /** 重新计算表格高度 */
88
+ calculateTableHeight: () => void;
89
+ }
90
+
91
+ declare const ListPage: DefineComponent<ListPageProps, {}, any>;
92
+ export default ListPage;
@@ -0,0 +1,51 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /** 搜索表单项 */
4
+ export interface SearchBarFormItem {
5
+ /** 字段 key */
6
+ key: string;
7
+ /** 字段名称 */
8
+ name: string;
9
+ /** 字段值 */
10
+ value: any;
11
+ /** 表单项类型 */
12
+ type?: 'input' | 'select' | 'date' | 'custom' | 'br';
13
+ /** 日期类型 */
14
+ dateType?: 'date' | 'daterange' | 'datetimerange';
15
+ /** 是否隐藏 */
16
+ hidden?: boolean;
17
+ /** 自定义渲染函数(type 为 custom 时使用) */
18
+ render?: () => any;
19
+ /** 额外配置 */
20
+ option?: {
21
+ class?: string;
22
+ [key: string]: any;
23
+ };
24
+ }
25
+
26
+ /** 搜索表单配置 */
27
+ export interface SearchBarForm {
28
+ /** 表单项列表 */
29
+ items: SearchBarFormItem[];
30
+ /** 表单数据对象 */
31
+ data?: Record<string, any>;
32
+ }
33
+
34
+ /**
35
+ * SearchBar 组件 - 搜索栏
36
+ * 支持多种表单项类型,可折叠展开
37
+ */
38
+ export interface SearchBarProps {
39
+ /** 搜索表单配置 */
40
+ form: SearchBarForm;
41
+ }
42
+
43
+ export interface SearchBarEmits {
44
+ /** 筛选按钮点击时触发 */
45
+ (e: 'confirm'): void;
46
+ /** 重置按钮点击时触发 */
47
+ (e: 'reset'): void;
48
+ }
49
+
50
+ declare const SearchBar: DefineComponent<SearchBarProps, {}, any, {}, {}, {}, {}, SearchBarEmits>;
51
+ export default SearchBar;