@web-utils/form-ui 1.0.0-beta51 → 1.0.0-beta53

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 (119) hide show
  1. package/chunks/{Dt3lfDnL.mjs → 7GmKqdbC.mjs} +48 -33
  2. package/chunks/{6yfBZFOB.mjs → 9MExJqL-.mjs} +4 -3
  3. package/chunks/{BQk3-Ppb2.mjs → B3yVc-P62.mjs} +38 -39
  4. package/chunks/{bFbPPcdq.mjs → B6yWUT6z.mjs} +2 -2
  5. package/chunks/BEvOkSfB.mjs +417 -0
  6. package/chunks/{D_qiRmiE.mjs → BHbMJZPp.mjs} +69 -62
  7. package/chunks/{B9gA65rt2.mjs → BJYlobMz2.mjs} +2 -2
  8. package/chunks/{CJdkjadi.mjs → BNXbI4OG.mjs} +1 -1
  9. package/chunks/{V2p-PCpL.mjs → BV-XUugQ.mjs} +3 -3
  10. package/chunks/B_RAcbs_.mjs +108 -0
  11. package/chunks/{CqVd8D222.mjs → BgTCTXs72.mjs} +4 -3
  12. package/chunks/{BtcjAHE6.mjs → BjGlxyi6.mjs} +2 -2
  13. package/chunks/{pIzhYsBe.mjs → BqC_VU52.mjs} +2 -2
  14. package/chunks/{eae6huQB.mjs → BqzJ6vY6.mjs} +2 -2
  15. package/chunks/ByTyNsWf.mjs +653 -0
  16. package/chunks/{BfxDxIg0.mjs → CB9QUXUX.mjs} +2 -2
  17. package/chunks/CGDnQr1c.mjs +67 -0
  18. package/chunks/{DKwp6AMl.mjs → CGuDBVCB.mjs} +4 -3
  19. package/chunks/{C7G-cAoI.mjs → CPvdsnRN.mjs} +1 -1
  20. package/chunks/{Bwbtu2cp.mjs → CgN7m-1v.mjs} +4 -3
  21. package/chunks/{D_Fs3bkZ.mjs → D5EQJdPL.mjs} +3 -3
  22. package/chunks/D7R9Or2m2.mjs +87 -0
  23. package/chunks/D9IFsT272.mjs +513 -0
  24. package/chunks/{CuAoMR3n.mjs → DFFNxlqD.mjs} +5 -16
  25. package/chunks/{BWh6u1O0.mjs → DWMePN6q.mjs} +1 -1
  26. package/chunks/{CAd1zK9Q.mjs → DawYTjoT.mjs} +2 -2
  27. package/chunks/{BqWvBF14.mjs → DjnHvHXo.mjs} +2 -2
  28. package/chunks/{CabldOLo.mjs → DwkOWXIR.mjs} +6 -5
  29. package/chunks/{BQyL45PF2.mjs → DyCO22Ia2.mjs} +1 -1
  30. package/chunks/{B1IPSTA6.mjs → Dytof5EW.mjs} +2 -2
  31. package/chunks/{wXeqV-_7.mjs → H70Z56YY.mjs} +9 -3
  32. package/chunks/{BBERmTup.mjs → XoImEoke.mjs} +19 -4
  33. package/chunks/{ByHz4mmh.mjs → XwerN1TU.mjs} +2 -2
  34. package/chunks/{DA7oGHSX.mjs → c0Niqotr.mjs} +2 -2
  35. package/chunks/{C2zgFLYO.mjs → oVFbZ6yk.mjs} +30 -30
  36. package/chunks/{BbSPWDDZ.mjs → z5FJgzdc.mjs} +4 -3
  37. package/constants/index.d.ts +1 -0
  38. package/editable-tree/index.mjs +1 -1
  39. package/element-dialog/index.d.ts +2 -2
  40. package/form-cascader/index.d.ts +8 -2
  41. package/form-cascader/index.mjs +1 -1
  42. package/form-checkbox/index.d.ts +10 -4
  43. package/form-checkbox/index.mjs +1 -1
  44. package/form-checkbox-group/index.d.ts +8 -2
  45. package/form-checkbox-group/index.mjs +1 -1
  46. package/form-date-picker/index.d.ts +8 -2
  47. package/form-date-picker/index.mjs +1 -1
  48. package/form-holder/index.mjs +1 -1
  49. package/form-image/index.d.ts +8 -2
  50. package/form-image/index.mjs +1 -1
  51. package/form-input/index.d.ts +8 -2
  52. package/form-input/index.mjs +1 -1
  53. package/form-input-cron-expression/index.d.ts +8 -2
  54. package/form-input-cron-expression/index.mjs +1 -1
  55. package/form-input-email/index.d.ts +8 -2
  56. package/form-input-email/index.mjs +1 -1
  57. package/form-input-id-card/index.d.ts +8 -2
  58. package/form-input-id-card/index.mjs +1 -1
  59. package/form-input-number/index.d.ts +8 -2
  60. package/form-input-number/index.mjs +1 -1
  61. package/form-input-phone-number/index.d.ts +8 -2
  62. package/form-input-phone-number/index.mjs +1 -1
  63. package/form-input-tag/index.d.ts +8 -2
  64. package/form-input-tag/index.mjs +1 -1
  65. package/form-input-time/index.d.ts +8 -2
  66. package/form-input-time/index.mjs +1 -1
  67. package/form-item-group/index.mjs +1 -1
  68. package/form-item-x/index.d.ts +8 -2
  69. package/form-item-x/index.mjs +1 -1
  70. package/form-item-x/style.css +1 -1
  71. package/form-radio-group/index.d.ts +8 -2
  72. package/form-radio-group/index.mjs +1 -1
  73. package/form-rate/index.d.ts +8 -2
  74. package/form-rate/index.mjs +1 -1
  75. package/form-select/index.d.ts +8 -2
  76. package/form-select/index.mjs +1 -1
  77. package/form-slider/index.d.ts +8 -2
  78. package/form-slider/index.mjs +1 -1
  79. package/form-switch/index.d.ts +8 -2
  80. package/form-switch/index.mjs +1 -1
  81. package/form-table/index.d.ts +43 -25
  82. package/form-table/index.mjs +1 -1
  83. package/form-table-plus/index.d.ts +8 -8
  84. package/form-table-plus/index.mjs +1 -1
  85. package/form-text/index.d.ts +8 -2
  86. package/form-text/index.mjs +1 -1
  87. package/form-textarea/index.d.ts +12 -12
  88. package/form-textarea/index.mjs +1 -1
  89. package/form-time-select/index.d.ts +8 -2
  90. package/form-time-select/index.mjs +1 -1
  91. package/helper/sub-table-plus.d.ts +38 -0
  92. package/helper/sub-table-plus.mjs +4 -0
  93. package/index.css +1 -1
  94. package/index.mjs +35 -35
  95. package/package.json +1 -1
  96. package/pageable-table/index.d.ts +11 -11
  97. package/pageable-table/index.mjs +1 -1
  98. package/sub-table/index.d.ts +36 -30
  99. package/sub-table/index.mjs +2 -537
  100. package/sub-table-plus/index.d.ts +11 -2
  101. package/sub-table-plus/index.mjs +1 -1
  102. package/table-column/index.d.ts +8 -5
  103. package/table-column/index.mjs +1 -1
  104. package/table-column-def/index.d.ts +14 -12
  105. package/table-column-def/index.mjs +1 -1
  106. package/table-view/index.d.ts +4 -0
  107. package/table-view/index.mjs +16 -8
  108. package/toolbar/index.mjs +1 -1
  109. package/toolbar-button/index.mjs +1 -1
  110. package/toolbar-button/style.css +1 -0
  111. package/vue-cron/index.mjs +1 -1
  112. package/web-types.json +1 -1
  113. package/x-input-tag/index.mjs +1 -1
  114. package/chunks/BG8z3V9d2.mjs +0 -643
  115. package/chunks/BsZgAJX_2.mjs +0 -81
  116. package/chunks/YFiU0ngn.mjs +0 -622
  117. package/chunks/gCeDFHo1.mjs +0 -32
  118. package/chunks/hlha6Bhc.mjs +0 -107
  119. package/chunks/wDS9KBFw.mjs +0 -67
@@ -1,81 +0,0 @@
1
- import { i as e, n as t } from "./D_qiRmiE.mjs";
2
- import n from "../sub-table/index.mjs";
3
- import { n as r, t as i } from "./gCeDFHo1.mjs";
4
- import { createVNode as a, mergeProps as o, ref as s, useModel as c } from "vue";
5
- //#endregion
6
- //#region src/components/form/FormTable.vue
7
- var l = {
8
- name: "FormTable",
9
- props: { ...i },
10
- emits: {
11
- ...t,
12
- "add-row": null
13
- },
14
- setup(t, { emit: i, attrs: l, slots: u }) {
15
- let d = c(t, "modelValue"), f = s([]), p = (e) => {
16
- f.value = e;
17
- }, { render: m, placeholder: h, disabled: g, listeners: _, inputProps: v } = e(t, {
18
- emit: i,
19
- slots: u,
20
- attrs: l,
21
- predicate: r
22
- });
23
- return () => {
24
- var e;
25
- let r = {};
26
- for (let n = 0; n < (((e = t.columns) == null ? void 0 : e.length) ?? 0); n++) {
27
- let e = t.columns[n];
28
- r[e.prop] = (t, n, r) => {
29
- var i;
30
- return (i = u[e.prop]) == null ? void 0 : i.call(u, t, n, r);
31
- };
32
- }
33
- return m({ vNodes: a(n, o(_.value, v.value, {
34
- prop: t.prop,
35
- disabled: g.value,
36
- modelValue: d.value,
37
- "onUpdate:modelValue": (e) => d.value = e,
38
- placeholder: h.value,
39
- onSelectionChange: p
40
- }), {
41
- ...r,
42
- columns: ({ columns: e }) => {
43
- var t;
44
- return (t = u.columns) == null ? void 0 : t.call(u, { columns: e });
45
- },
46
- handle: ({ add: e, remove: t }) => {
47
- var n;
48
- return (n = u.handle) == null ? void 0 : n.call(u, {
49
- add: e,
50
- remove: t
51
- });
52
- },
53
- tag: ({ column: e, row: t, $index: n }) => {
54
- var r;
55
- return (r = u.tag) == null ? void 0 : r.call(u, {
56
- column: e,
57
- row: t,
58
- $index: n
59
- });
60
- },
61
- "handle-column-header": ({ column: e, $index: t }) => {
62
- var n;
63
- return (n = u["handle-column-header"]) == null ? void 0 : n.call(u, {
64
- column: e,
65
- index: t
66
- });
67
- },
68
- toolbar: ({ addRow: e, delRow: t, refresh: n }) => {
69
- var r;
70
- return (r = u.toolbar) == null ? void 0 : r.call(u, {
71
- addRow: e,
72
- delRow: t,
73
- refresh: n
74
- });
75
- }
76
- }) });
77
- };
78
- }
79
- };
80
- //#endregion
81
- export { l as t };
@@ -1,622 +0,0 @@
1
- import { d as e, n as t, r as n } from "./DcTVYqeJ.mjs";
2
- import { getDictLabel as r } from "../helper/dictionary.mjs";
3
- import { cellClickHandlerContextKey as i, pageableTableContextKey as a } from "../constants/index.mjs";
4
- import { t as o } from "./Dt3lfDnL.mjs";
5
- import s from "../element-resize-observer/index.mjs";
6
- import { t as c } from "./wDS9KBFw.mjs";
7
- import { useVisibilityChange as l } from "../hook/useVisibilityChange.mjs";
8
- import { Fragment as ee, computed as u, createBlock as d, createTextVNode as f, createVNode as p, inject as m, isVNode as h, mergeModels as g, mergeProps as _, nextTick as v, onUpdated as te, openBlock as y, provide as b, reactive as x, ref as S, toDisplayString as C, useModel as w, useTemplateRef as T, watch as E, withCtx as D } from "vue";
9
- import { ElMessage as ne } from "element-plus";
10
- import { ElCheckbox as O, ElDrawer as k, ElEmpty as A, ElPagination as re, ElRadio as j, ElTable as M, ElTableColumn as N } from "element-plus/es";
11
- import { useEventBus as ie } from "@web-utils/vue/hooks/useEventBus";
12
- //#region src/components/table/components/TableColumnFilter.vue
13
- var ae = /* @__PURE__ */ Object.assign({ name: "TableColumnFilter" }, {
14
- __name: "TableColumnFilter",
15
- props: /* @__PURE__ */ g({ columns: {
16
- type: Array,
17
- default: () => []
18
- } }, {
19
- modelValue: {
20
- type: Boolean,
21
- default: !1
22
- },
23
- modelModifiers: {}
24
- }),
25
- emits: ["update:modelValue"],
26
- setup(e, { expose: t }) {
27
- let n = w(e, "modelValue"), r = x({}), i = x({}), a = x({}), o = x({}), s = (e, t, n) => {
28
- n === "hide" ? r[t.prop] = e : n === "fixed" ? i[t.prop] = e : n === "filterable" ? a[t.prop] = e : n === "sortable" && (o[t.prop] = e);
29
- };
30
- return t({
31
- hideProps: r,
32
- fixedProps: i,
33
- filterableProps: a,
34
- sortableProps: o
35
- }), (t, r) => {
36
- let i = N, a = O, o = M, c = k;
37
- return y(), d(c, {
38
- modelValue: n.value,
39
- "onUpdate:modelValue": r[0] || (r[0] = (e) => n.value = e),
40
- class: "table-column-filter",
41
- title: "表格设置",
42
- "append-to-body": ""
43
- }, {
44
- default: D(() => [p(o, {
45
- data: e.columns,
46
- border: ""
47
- }, {
48
- default: D(() => [
49
- p(i, { label: "列名" }, {
50
- default: D(({ row: e }) => [f(C(e.label), 1)]),
51
- _: 1
52
- }),
53
- p(i, {
54
- label: "隐藏",
55
- align: "center"
56
- }, {
57
- default: D(({ row: e }) => [p(a, { onChange: (t) => s(t, e, "hide") }, null, 8, ["onChange"])]),
58
- _: 1
59
- }),
60
- p(i, {
61
- label: "冻结",
62
- align: "center"
63
- }, {
64
- default: D(({ row: e }) => [p(a, { onChange: (t) => s(t, e, "fixed") }, null, 8, ["onChange"])]),
65
- _: 1
66
- }),
67
- p(i, {
68
- label: "过滤",
69
- align: "center"
70
- }, {
71
- default: D(({ row: e }) => [p(a, { onChange: (t) => s(t, e, "filterable") }, null, 8, ["onChange"])]),
72
- _: 1
73
- }),
74
- p(i, {
75
- label: "排序",
76
- align: "center"
77
- }, {
78
- default: D(({ row: e }) => [p(a, {
79
- title: e.allowSort ? null : "该列不支持排序!",
80
- disabled: !e.allowSort,
81
- onChange: (t) => s(t, e, "sortable")
82
- }, null, 8, [
83
- "title",
84
- "disabled",
85
- "onChange"
86
- ])]),
87
- _: 1
88
- })
89
- ]),
90
- _: 1
91
- }, 8, ["data"])]),
92
- _: 1
93
- }, 8, ["modelValue"]);
94
- };
95
- }
96
- });
97
- //#endregion
98
- //#region src/components/table/components/TableColumnFilterable.vue?vue&type=script&lang.jsx
99
- function P(e) {
100
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
101
- }
102
- //#endregion
103
- //#region src/components/table/components/TableColumnFilterable.vue
104
- var F = {
105
- name: "TableColumnFilterable",
106
- props: {
107
- filterable: Boolean,
108
- prop: String
109
- },
110
- setup(e, { attrs: t, slots: n }) {
111
- let r = m(a, null), i = u(() => {
112
- if (e.filterable && r) return (e, t, n) => t[n.property] === e;
113
- }), o = u(() => {
114
- if (e.filterable && r) return [...new Set(r.records.value.map((t) => t[e.prop]).filter((e) => e))].map((e) => ({
115
- text: e,
116
- value: e
117
- }));
118
- });
119
- return () => p(c, _(t, {
120
- prop: e.prop,
121
- filterable: e.filterable,
122
- filterMethod: i.value,
123
- filters: o.value
124
- }), P(n) ? n : { default: () => [n] });
125
- }
126
- }, I = {
127
- data: {
128
- type: Array,
129
- default: () => []
130
- },
131
- height: [String, Number],
132
- maxHeight: [String, Number],
133
- stripe: {
134
- type: Boolean,
135
- default: !1
136
- },
137
- border: {
138
- type: Boolean,
139
- default: !0
140
- },
141
- size: String,
142
- fit: {
143
- type: Boolean,
144
- default: !0
145
- },
146
- showHeader: {
147
- type: Boolean,
148
- default: !0
149
- },
150
- highlightCurrentRow: {
151
- type: Boolean,
152
- default: !1
153
- },
154
- currentRowKey: [String, Number],
155
- rowClassName: [Function, String],
156
- rowStyle: [Function, Object],
157
- cellClassName: [Function, String],
158
- cellStyle: [Function, Object],
159
- headerRowClassName: [Function, String],
160
- headerRowStyle: [Function, Object],
161
- headerCellClassName: [Function, String],
162
- headerCellStyle: [Function, Object],
163
- rowKey: {
164
- type: [Function, String],
165
- default: "id"
166
- },
167
- emptyText: {
168
- type: String,
169
- default: "No Data"
170
- },
171
- defaultExpandAll: {
172
- type: Boolean,
173
- default: !1
174
- },
175
- expandRowKeys: {
176
- type: Array,
177
- default: () => []
178
- },
179
- defaultSort: Object,
180
- tooltipEffect: {
181
- type: String,
182
- default: "dark"
183
- },
184
- tooltipOptions: {
185
- type: Object,
186
- default: () => ({})
187
- },
188
- appendFilterPanelTo: String,
189
- showSummary: {
190
- type: Boolean,
191
- default: !1
192
- },
193
- sumText: {
194
- type: String,
195
- default: "Sum"
196
- },
197
- summaryMethod: Function,
198
- spanMethod: Function,
199
- selectOnIndeterminate: {
200
- type: Boolean,
201
- default: !0
202
- },
203
- indent: {
204
- type: Number,
205
- default: 16
206
- },
207
- lazy: {
208
- type: Boolean,
209
- default: !1
210
- },
211
- load: Function,
212
- treeProps: {
213
- type: Object,
214
- default: () => ({})
215
- },
216
- tableLayout: {
217
- type: String,
218
- default: "fixed"
219
- },
220
- scrollbarAlwaysOn: {
221
- type: Boolean,
222
- default: !1
223
- },
224
- showOverflowTooltip: [Boolean, Object],
225
- flexible: {
226
- type: Boolean,
227
- default: !1
228
- },
229
- scrollbarTabindex: [String, Number],
230
- allowDragLastColumn: {
231
- type: Boolean,
232
- default: !0
233
- },
234
- tooltipFormatter: Function,
235
- preserveExpandedContent: {
236
- type: Boolean,
237
- default: !1
238
- },
239
- nativeScrollbar: {
240
- type: Boolean,
241
- default: !1
242
- },
243
- rowExpandable: Function,
244
- selectionWidth: {
245
- type: String,
246
- default: "45"
247
- },
248
- viewId: String,
249
- url: String,
250
- hideOnSinglePage: Boolean,
251
- api: Function,
252
- model: Object,
253
- ascs: {
254
- type: Array,
255
- default: () => []
256
- },
257
- descs: {
258
- type: Array,
259
- default: () => []
260
- },
261
- headerBold: Boolean,
262
- autoHeight: Boolean,
263
- immediate: {
264
- type: Boolean,
265
- default: !0
266
- },
267
- index: {
268
- type: Boolean,
269
- default: !0
270
- },
271
- multiple: {
272
- type: Boolean,
273
- default: !0
274
- },
275
- selection: {
276
- type: Boolean,
277
- default: !0
278
- },
279
- reloadOnModelChange: {
280
- type: Boolean,
281
- default: !1
282
- },
283
- columns: Array,
284
- pageSize: {
285
- type: Number,
286
- default: 25
287
- },
288
- dicOptions: {
289
- type: Array,
290
- default: () => []
291
- },
292
- paging: {
293
- type: Boolean,
294
- default: !0
295
- },
296
- clickRowSelect: Boolean,
297
- payloadStyle: String,
298
- disabledRowKeys: Array,
299
- selectExport: Boolean,
300
- useVisibilityChange: Boolean,
301
- rowDbClick: Function
302
- }, L = { data: !0 }, oe = (e) => L[e] !== !0;
303
- //#endregion
304
- //#region src/components/table/PageableTable.vue?vue&type=script&lang.jsx
305
- function se(e) {
306
- let t = "";
307
- for (let n in e) t += `<TableColumnDef prop="${n}" label="${n}"/>\n`;
308
- return t;
309
- }
310
- var R = {
311
- loading: 1,
312
- error: -1,
313
- empty: 2,
314
- success: 0
315
- }, z = {
316
- name: "PageableTable",
317
- emits: { "page-loaded": null },
318
- inheritAttrs: !1,
319
- props: { ...I },
320
- setup(c, { emit: d, attrs: m, slots: h, expose: g }) {
321
- b(i, c.rowDbClick);
322
- let y = T("table"), x = T("settingPanel"), C = S(R.empty), w = S([]), D = S(null), O = S(!1), k = S([]), P = S({
323
- total: 0,
324
- page: 1,
325
- limit: c.pageSize,
326
- ascs: c.ascs,
327
- descs: c.descs
328
- }), I = S(0), L = S(0), z = u(() => c.reloadOnModelChange ? {
329
- asc: P.value.ascs,
330
- desc: P.value.descs,
331
- page: P.value.page,
332
- limit: P.value.limit,
333
- model: c.model
334
- } : {
335
- asc: P.value.ascs,
336
- desc: P.value.descs,
337
- page: P.value.page,
338
- limit: P.value.limit
339
- }), B = u(() => {
340
- var e;
341
- let t = `${(P.value.page - 1) * P.value.limit + (((e = w.value) == null ? void 0 : e.length) ?? 0)}`;
342
- return t.length > 3 ? 60 + (t.length - 3) * 10 : 60;
343
- }), V = () => {
344
- U();
345
- }, H = (e, t, n) => {
346
- if (c.clickRowSelect && $(e)) {
347
- var r;
348
- if (k.value.find((t) => t[c.rowKey] === e[c.rowKey])) {
349
- var i;
350
- (i = y.value) == null || i.toggleRowSelection(e, !1);
351
- return;
352
- }
353
- (r = y.value) == null || r.toggleRowSelection(e);
354
- }
355
- }, U = () => {
356
- var e, t;
357
- let n = (e = y.value) == null || (e = e.$children) == null ? void 0 : e.find((e) => {
358
- var t;
359
- return ((t = e.$options) == null ? void 0 : t.name) === "ElTableBody";
360
- });
361
- n == null || (t = n.$refs) == null || (t = t.tooltip) == null || t.hide();
362
- }, W = ({ scrollLeft: e, scrollTop: t }) => {
363
- I.value = t, L.value = e;
364
- }, G = () => {
365
- pe(I.value, L.value);
366
- }, ce = (e) => t(se(e)), le = ({ prop: e, order: t }) => {
367
- c.payloadStyle === "body" ? (P.value.ascs = t === "ascending" ? [e] : c.ascs, P.value.descs = t === "descending" ? [e] : c.descs) : (P.value.ascs = t === "ascending" ? e : "", P.value.descs = t === "descending" ? e : "");
368
- }, ue = (e) => {
369
- $(e) && (D.value = e);
370
- }, de = (e) => {
371
- k.value = e;
372
- }, K = () => {
373
- var e;
374
- (e = y.value) == null || e.clearSelection();
375
- }, fe = () => {
376
- let e;
377
- return e = c.payloadStyle === "body" ? {
378
- page: {
379
- ...P.value,
380
- current: P.value.page,
381
- size: P.value.limit
382
- },
383
- example: c.model || {}
384
- } : {
385
- ...P.value,
386
- current: P.value.page,
387
- size: P.value.limit,
388
- ...c.model || {}
389
- }, c.selectExport && (c.rowKey ? e.exportKeys = k.value.map((e) => e[c.rowKey]) : e.exportKeys = k.value.map((e) => w.value.indexOf(e))), e;
390
- }, q = async (e = !0) => {
391
- if (!c.api && c.data !== !1) {
392
- var t;
393
- w.value = c.data, P.value.page = 1, P.value.total = (t = w.value) == null ? void 0 : t.length, P.value.limit = P.value.total;
394
- return;
395
- }
396
- e !== !1 && (w.value = []);
397
- let n, r = fe();
398
- if (c.api) {
399
- e !== !1 && (C.value = R.loading);
400
- try {
401
- c.api && (n = await c.api(r));
402
- } catch {
403
- C.value = R.error;
404
- return;
405
- }
406
- } else if (c.data) n = { data: { data: {
407
- total: c.data.length,
408
- records: c.data
409
- } } };
410
- else {
411
- ne.warning({
412
- title: "开发提示!",
413
- message: "PageableTable api(Function) 属性"
414
- });
415
- return;
416
- }
417
- let { data: { data: i } = {} } = n || {}, { total: a, records: o } = i || {};
418
- P.value.total = Number(a), w.value = await me(o), !o || !o.length ? C.value = R.empty : C.value = R.success, J(), d("page-loaded", i);
419
- }, J = () => {
420
- v(() => {
421
- var e;
422
- (e = y.value) == null || e.doLayout();
423
- });
424
- }, Y = async (e) => {
425
- await q(e);
426
- }, X = () => {
427
- P.value = {
428
- total: 0,
429
- page: 1,
430
- limit: c.pageSize,
431
- ascs: c.ascs,
432
- descs: c.descs
433
- };
434
- }, pe = (e, t) => {
435
- y.value.setScrollTop(e), y.value.setScrollLeft(t);
436
- }, Z = (e, t) => {
437
- var n;
438
- (n = y.value) == null || n.toggleRowSelection(e, t);
439
- }, me = async (e) => {
440
- if (!e) return [];
441
- let t = [...e];
442
- for (let e of t) for (let t of c.dicOptions) if (e[`$${t.prop}`] = e[t.prop], t.dicData) {
443
- var n;
444
- e[t.prop] = ((n = t.dicData.find((n) => n.modelValue === e[t.prop])) == null ? void 0 : n.label) || e[t.prop];
445
- } else e[t.prop] = await r(t.dicType, e[t.prop]);
446
- return t;
447
- }, Q = () => {
448
- O.value = !O.value;
449
- }, $ = (e) => {
450
- var t;
451
- return !(e != null && e.disabled) && !((t = c.disabledRowKeys) != null && t.includes(e == null ? void 0 : e[c.rowKey]));
452
- };
453
- c.useVisibilityChange && l({ onPageVisible: () => {
454
- Y(!1);
455
- } }), ie("reloadTableView", (e) => {
456
- e === c.viewId && q();
457
- }), E(() => c.url, X), E(() => c.api, X), E(() => c.data, q), E(() => z.value, q, {
458
- deep: !0,
459
- immediate: c.immediate
460
- }), te(() => {
461
- G();
462
- }), g({
463
- records: w,
464
- getPage: q,
465
- refresh: Y,
466
- reload: X,
467
- doLayout: J,
468
- clearSelection: K,
469
- toggleRowSelection: Z,
470
- toggleSettings: Q
471
- }), b(a, {
472
- records: w,
473
- getPage: q,
474
- refresh: Y,
475
- reload: X,
476
- doLayout: J,
477
- clearSelection: K,
478
- toggleRowSelection: Z,
479
- toggleSettings: Q
480
- });
481
- let { autoBindProps: he, listeners: ge } = e(c, { predicate: oe });
482
- return () => {
483
- var e;
484
- let t = D.value && D.value[m["row-key"] || c.rowKey || "id"] === (D.value && c.rowKey ? D.value[c.rowKey] : (e = D.value) == null ? void 0 : e.id), r = [];
485
- if (h.default) {
486
- var i;
487
- let e = n((i = h.default) == null ? void 0 : i.call(h));
488
- for (let t = 0; t < e.length; t++) {
489
- let { props: n, children: i } = e[t];
490
- if (!n) continue;
491
- let { sortable: a, prop: o, fixed: s, ...c } = n, l = {
492
- ...c,
493
- prop: o,
494
- allowSort: a !== !1
495
- };
496
- i && (l.headerSlot = i.header, l.defaultSlot = i.default, l.expandSlot = i.expand, l.iconSlot = i["filter-icon"]), r.push(l);
497
- }
498
- } else if (c.columns) for (let e = 0; e < c.columns.length; e++) {
499
- let { prop: t, sortable: n, fixed: i, ...a } = c.columns[e], o = {
500
- ...a,
501
- prop: t,
502
- allowSort: n !== !1
503
- };
504
- x.value && (o.hide = x.value.hideProps[t], o.filterable = x.value.filterableProps[t], o.sortable = x.value.sortableProps[t] === !0, o.fixed = i || x.value.fixedProps[t]), r.push(o);
505
- }
506
- return p("div", {
507
- class: [
508
- "pageable-table",
509
- { "auto-height": c.autoHeight },
510
- m.class
511
- ],
512
- style: m.style
513
- }, [p("div", { class: "pageable-table-wrapper" }, [
514
- h.toolbar && h.toolbar({ selectedRows: k.value }),
515
- p(M, _(ge.value, he.value, {
516
- ref: "table",
517
- data: w.value,
518
- class: ["flex-item", { "header-bold": c.headerBold }],
519
- border: c.border,
520
- stripe: !0,
521
- size: "default",
522
- height: c.autoHeight ? null : "auto",
523
- onScroll: W,
524
- onSortChange: le,
525
- onRowDblclick: V,
526
- onRowClick: H,
527
- onCellClick: U,
528
- onCurrentChange: ue,
529
- onSelectionChange: de
530
- }), {
531
- default: () => {
532
- let e = [];
533
- if (c.multiple && c.selection && e.push(p(N, {
534
- key: "selection",
535
- type: "selection",
536
- selectable: $,
537
- width: c.selectionWidth,
538
- align: "center"
539
- }, null)), !c.multiple && c.selection && e.push(p(N, {
540
- key: "single-selection",
541
- type: "single-selection",
542
- "class-name": "single-select-column",
543
- width: c.selectionWidth,
544
- align: "center"
545
- }, {
546
- header: () => p(j, {
547
- modelValue: !!D.value,
548
- label: !0
549
- }, { default: () => [p("span", null, null)] }),
550
- default: ({ row: e }) => p(j, {
551
- label: !0,
552
- disabled: !$(e),
553
- modelValue: t
554
- }, { default: () => [p("span", null, null)] })
555
- })), c.index && e.push(p(N, {
556
- key: "index",
557
- type: "index",
558
- label: "序号",
559
- width: B.value,
560
- align: "center"
561
- }, { default: ({ $index: e }) => (P.value.page - 1) * P.value.limit + e + 1 || e + 1 })), r.length > 0) for (let t = 0; t < r.length; t++) {
562
- let n = r[t];
563
- if (n.hide) continue;
564
- let { prop: i, headerSlot: a, defaultSlot: o, expandSlot: s, iconSlot: c, ...l } = n;
565
- e.push(p(F, _(l, { prop: i }), {
566
- default: h[i] ? ({ row: e }) => h[i]({ row: e }) : o,
567
- header: a,
568
- expand: s,
569
- "filter-icon": c
570
- }));
571
- }
572
- else e.push(p(N, {
573
- key: "default",
574
- label: "点击表格行复制模板"
575
- }, { default: ({ row: e }) => p("pre", {
576
- class: "pointer",
577
- onClick: () => ce(e)
578
- }, [JSON.stringify(e, null, " ")]) }));
579
- return e;
580
- },
581
- empty: () => h.empty ? h.empty() : p(ee, null, [
582
- C.value === R.loading && p("span", { class: "pageable-table-loading" }, [p("i", { class: "table-status-icon el-icon-loading" }, null), f("加载中...")]),
583
- C.value === R.error && p(o, {
584
- class: "pageable-table-error",
585
- onClick: Y
586
- }, { default: () => [p("i", { class: "table-status-icon el-icon-error" }, null), f("加载失败,点击重试!")] }),
587
- C.value !== R.loading && C.value !== R.error && p(A, null, null)
588
- ]),
589
- append: h.append
590
- }),
591
- c.paging && p(re, {
592
- "current-page": P.value.page,
593
- "onUpdate:current-page": (e) => P.value.page = e,
594
- "hide-on-single-page": c.hideOnSinglePage,
595
- "page-size": P.value.limit,
596
- "onUpdate:page-size": (e) => P.value.limit = e,
597
- total: P.value.total,
598
- "page-sizes": [
599
- 10,
600
- 25,
601
- 50,
602
- 100,
603
- 500,
604
- 1e3,
605
- 2e3
606
- ],
607
- class: "flex-not-shrink",
608
- background: !0,
609
- layout: "total, sizes, prev, pager, next, jumper"
610
- }, null),
611
- p(ae, {
612
- ref: "settingPanel",
613
- modelValue: O.value,
614
- "onUpdate:modelValue": (e) => O.value = e,
615
- columns: r
616
- }, null)
617
- ]), p(s, { onNotify: J }, null)]);
618
- };
619
- }
620
- };
621
- //#endregion
622
- export { z as t };