auto-vue-manual 0.0.4 → 0.0.5

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,15 +1,430 @@
1
- import "vue";
2
- import "element-plus";
3
- const r = (e) => {
4
- if (!e.request)
1
+ import { reactive as oe, ref as d, watch as le, onMounted as se, computed as H, toRefs as de, nextTick as ae, unref as v, defineComponent as ue, resolveComponent as R, createBlock as k, openBlock as y, normalizeStyle as he, normalizeClass as me, provide as pe, resolveDirective as fe, createElementBlock as K, withDirectives as ve, renderSlot as D, createCommentVNode as ee, withCtx as _, Fragment as te, renderList as ie, mergeProps as A, resolveDynamicComponent as ye, createElementVNode as ze, createSlots as Ce, createVNode as re, createTextVNode as Se, toDisplayString as be } from "vue";
2
+ import { ElTable as we } from "element-plus";
3
+ let ne;
4
+ const Pe = (s) => {
5
+ if (!s.request)
5
6
  throw new Error("request function is required");
6
- e.request, e.mittBus;
7
- }, o = {
8
- install: (e, i) => {
9
- Reflect.ownKeys(e._context.provides).some((t) => String(t) === "Symbol(pinia)") || console.warn("Pinia is not provided. Please install and provide Pinia in your app."), r(i);
7
+ ne = s.request, s.mittBus;
8
+ };
9
+ function _e(s) {
10
+ const i = s.split(".");
11
+ return i.length == 1 ? s : i[i.length - 1];
12
+ }
13
+ function ke() {
14
+ let s = "";
15
+ for (let i = 0; i < 32; i++) {
16
+ let n = Math.random() * 16 | 0;
17
+ (i === 8 || i === 12 || i === 16 || i === 20) && (s += "-"), s += (i === 12 ? 4 : i === 16 ? n & 3 | 8 : n).toString(16);
18
+ }
19
+ return s;
20
+ }
21
+ const He = (s, i = {}, n = !0, u, z, o) => {
22
+ const a = oe({
23
+ // 表格数据
24
+ tableData: [],
25
+ // 分页数据
26
+ pagination: {
27
+ // 当前页数
28
+ page: 1,
29
+ // 每页显示条数
30
+ size: 10,
31
+ // 总条数
32
+ total: 0
33
+ },
34
+ // 查询参数(只包括查询)
35
+ searchParam: {},
36
+ // 初始化默认的查询参数
37
+ searchInitParam: {},
38
+ // 总参数(包含分页和查询参数)
39
+ totalParam: {}
40
+ }), p = d(null), B = d(0), W = d(0), M = d(null), $ = d(0), m = d(5), T = d(0), F = d(0), L = () => {
41
+ ae(() => {
42
+ if (!p.value) return;
43
+ const t = p.value.parentElement, e = (t == null ? void 0 : t.clientHeight) || 0, l = (t == null ? void 0 : t.clientWidth) || 0, r = t ? getComputedStyle(t) : null, c = r ? parseFloat(r.paddingTop) + parseFloat(r.paddingBottom) : 0, h = r ? parseFloat(r.marginTop) + parseFloat(r.marginBottom) : 0, b = Array.from((t == null ? void 0 : t.children) || []).filter((V) => V !== p.value).reduce((V, Z) => {
44
+ const j = getComputedStyle(Z), ce = parseFloat(j.marginTop) + parseFloat(j.marginBottom), ge = parseFloat(j.marginLeft) + parseFloat(j.marginRight);
45
+ return [V[0] + Z.clientHeight + ce, V[1] + Z.clientWidth + ge];
46
+ }, [0, 0]), [S, g] = b, f = e - S - c - h, P = l - g - c - h;
47
+ p.value.style.height = f ? `${f}px` : "100%", p.value.style.width = P ? `${P}px` : "100%", B.value = f, W.value = P;
48
+ });
49
+ };
50
+ le(B, (t) => {
51
+ const e = {
52
+ small: 32,
53
+ default: 40,
54
+ large: 48
55
+ }, l = {
56
+ small: 41,
57
+ default: 49,
58
+ large: 57
59
+ };
60
+ let { rowH: r, extH: c, size: h } = o;
61
+ const b = l[h || "small"] || 41, S = e[h || "small"] || 32, g = n ? 44 : 0;
62
+ r = r || b, c = (c || 0) + S + g, $.value = t - g, T.value = r, F.value = S, o != null && o.pageSize && (o == null ? void 0 : o.pageSize) > 0 ? a.pagination.size = o == null ? void 0 : o.pageSize : t > 0 && (a.pagination.size = Math.floor((t - c) / r) - (o != null && o.sumUrl ? 1 : 0));
63
+ }, { deep: !0, immediate: !0 }), le(W, (t) => {
64
+ if (!n || !t) return;
65
+ let { size: e = "small" } = o;
66
+ const r = {
67
+ "": 32,
68
+ default: 32,
69
+ small: 24,
70
+ large: 40
71
+ }[e], c = t - 80 - 16 - (r + 8) * 2 - 16 - (e === "small" ? 108 : 114), h = Math.floor(c / (r + 8)) - 1;
72
+ m.value = Math.min(Math.max(h, 2), 7);
73
+ }, { deep: !0, immediate: !0 }), se(() => {
74
+ L(), window.addEventListener("resize", () => {
75
+ M.value && clearTimeout(M.value), M.value = setTimeout(() => {
76
+ L();
77
+ }, 300);
78
+ });
79
+ });
80
+ const I = H({
81
+ get: () => ({
82
+ page: a.pagination.page,
83
+ size: a.pagination.size
84
+ }),
85
+ set: (t) => {
86
+ console.log("我是分页更新之后的值", t);
87
+ }
88
+ }), w = () => {
89
+ ae(async () => {
90
+ let t = s;
91
+ if (!(t == "" && !(o != null && o.api)))
92
+ try {
93
+ Object.assign(a.totalParam, i, n ? I.value : {});
94
+ let { data: e } = await ne(t, {
95
+ ...a.searchInitParam,
96
+ ...a.totalParam
97
+ });
98
+ u && (e = u(e)), a.tableData = n ? e.list : e, n && (a.pagination.total = e.total);
99
+ } catch (e) {
100
+ z && z(e);
101
+ }
102
+ });
103
+ }, x = () => {
104
+ a.totalParam = {};
105
+ let t = {};
106
+ for (let e in a.searchParam)
107
+ (a.searchParam[e] || a.searchParam[e] === !1 || a.searchParam[e] === 0) && (t[e] = a.searchParam[e]);
108
+ Object.assign(a.totalParam, t);
109
+ }, G = () => {
110
+ a.pagination.page = 1, x(), w(), o != null && o.sumUrl && q();
111
+ }, E = () => {
112
+ a.pagination.page = 1, a.searchParam = { ...a.searchInitParam }, x(), w(), o != null && o.sumUrl && q();
113
+ }, N = (t) => {
114
+ a.pagination.page = 1, a.pagination.size = t, w();
115
+ }, J = (t) => {
116
+ a.pagination.page = t, w();
117
+ }, U = d([]);
118
+ function Q() {
119
+ const t = [];
120
+ for (const e of U.value)
121
+ t[e.index] = e.text;
122
+ return t;
123
+ }
124
+ async function q() {
125
+ await ne(o.sumUrl, {
126
+ ...a.searchInitParam,
127
+ ...a.totalParam,
128
+ page: 1,
129
+ size: 1
130
+ }).then((t) => {
131
+ U.value = (t == null ? void 0 : t.data) || [];
132
+ });
133
+ }
134
+ const O = (t) => {
135
+ a.pagination.size = t;
136
+ }, C = d(/* @__PURE__ */ new Map()), X = async ({ prop: t, enum: e }) => {
137
+ if (!e || C.value.has(t) && (typeof e == "function" || C.value.get(t) === e))
138
+ return;
139
+ if (typeof e != "function")
140
+ return C.value.set(t, v(e));
141
+ C.value.set(t, []);
142
+ const { data: l } = await e();
143
+ C.value.set(t, l);
144
+ }, Y = (t, e = []) => (t.forEach(async (l) => {
145
+ var r;
146
+ (r = l._children) != null && r.length && e.push(...Y(l._children)), e.push(l), l.isShow = l.isShow ?? !0, l.isSetting = l.isSetting ?? !0, l.isFilterEnum = l.isFilterEnum ?? !0, await X(l);
147
+ }), e.filter((l) => {
148
+ var r;
149
+ return !((r = l._children) != null && r.length);
150
+ }));
151
+ return {
152
+ ...de(a),
153
+ enumMap: C,
154
+ getTableList: w,
155
+ getSummaries: Q,
156
+ search: G,
157
+ reset: E,
158
+ handleSizeChange: N,
159
+ handleCurrentChange: J,
160
+ updatedTotalParam: x,
161
+ flatColumnsFunc: Y,
162
+ containerRef: p,
163
+ calculateHeight: $,
164
+ calculateRowH: T,
165
+ calculateTitleH: F,
166
+ pagerCount: m,
167
+ updatePageSize: O
168
+ };
169
+ }, Me = (s = "id", i) => {
170
+ const n = d(!1), u = d([]), z = H(() => {
171
+ let a = [];
172
+ return u.value.forEach((p) => a.push(p[s])), a;
173
+ });
174
+ return {
175
+ isSelected: n,
176
+ selectedList: u,
177
+ selectedListIds: z,
178
+ selectionChange: (a) => {
179
+ a.length ? n.value = !0 : n.value = !1, u.value = a;
180
+ }
181
+ };
182
+ }, Te = /* @__PURE__ */ ue({
183
+ __name: "Pagination",
184
+ props: {
185
+ className: {},
186
+ styles: {},
187
+ size: {},
188
+ pagination: {},
189
+ pageSize: {},
190
+ pagerCount: {},
191
+ handleSizeChange: { type: Function },
192
+ handleCurrentChange: { type: Function }
193
+ },
194
+ setup(s) {
195
+ const i = s, n = H(() => i.pageSize > 0 ? [i.pageSize, i.pageSize * 2, i.pageSize * 3, i.pageSize * 4, i.pageSize * 5] : []);
196
+ return (u, z) => {
197
+ const o = R("el-pagination");
198
+ return y(), k(o, {
199
+ class: me(u.className),
200
+ style: he(u.styles),
201
+ background: !0,
202
+ "current-page": u.pagination.page,
203
+ "page-size": u.pagination.size,
204
+ "page-sizes": n.value,
205
+ total: u.pagination.total,
206
+ "pager-count": i.pagerCount || 7,
207
+ size: u.size,
208
+ layout: `total, ${n.value.length > 0 ? "sizes," : ""} prev, pager, next, jumper`,
209
+ onSizeChange: u.handleSizeChange,
210
+ onCurrentChange: u.handleCurrentChange
211
+ }, null, 8, ["class", "style", "current-page", "page-size", "page-sizes", "total", "pager-count", "size", "layout", "onSizeChange", "onCurrentChange"]);
212
+ };
213
+ }
214
+ }), Fe = (s = "stroke-width: 4px; fill: rgba(0, 0, 0, 0)") => `
215
+ <path class="path" d="
216
+ M 30 15
217
+ L 28 17
218
+ M 25.61 25.61
219
+ A 15 15, 0, 0, 1, 15 30
220
+ A 15 15, 0, 1, 1, 27.99 7.5
221
+ L 15 15
222
+ " style="${s}"/>
223
+ `, Le = /* @__PURE__ */ ue({
224
+ __name: "index",
225
+ props: {
226
+ columns: { default: () => [] },
227
+ data: {},
228
+ api: {},
229
+ url: {},
230
+ sumUrl: {},
231
+ autoSearch: { type: Boolean, default: !0 },
232
+ requestError: {},
233
+ dataCallback: {},
234
+ title: {},
235
+ pagination: { type: Boolean, default: !0 },
236
+ initParam: { default: {} },
237
+ border: { type: Boolean, default: !1 },
238
+ toolButton: { type: [Array, Boolean] },
239
+ rowKey: { default: "id" },
240
+ searchCol: {},
241
+ loading: {},
242
+ size: { default: "" },
243
+ pageSize: { default: 0 },
244
+ rowH: { default: 0 },
245
+ extH: { default: 0 },
246
+ sumText: {},
247
+ sumTextFormat: {}
248
+ },
249
+ setup(s, { expose: i }) {
250
+ var t;
251
+ const n = s, u = d(), z = d("id-" + ke()), o = [
252
+ "selection",
253
+ "radio",
254
+ "index",
255
+ "expand"
256
+ // "sort",
257
+ ], a = d(""), { selectionChange: p, selectedList: B, selectedListIds: W, isSelected: M } = Me(n.rowKey), {
258
+ tableData: $,
259
+ pagination: m,
260
+ searchParam: T,
261
+ searchInitParam: F,
262
+ enumMap: L,
263
+ getTableList: I,
264
+ search: w,
265
+ reset: x,
266
+ flatColumnsFunc: G,
267
+ handleSizeChange: E,
268
+ handleCurrentChange: N,
269
+ containerRef: J,
270
+ calculateHeight: U,
271
+ pagerCount: Q
272
+ } = He(
273
+ n.url,
274
+ n.initParam,
275
+ n.pagination,
276
+ n.dataCallback,
277
+ n.requestError,
278
+ n
279
+ ), q = () => u.value.clearSelection();
280
+ se(() => {
281
+ ae(() => {
282
+ n.autoSearch && I(), n.data && (m.value.total = n.data.length);
283
+ });
284
+ });
285
+ const O = H(() => n.data ? n.data.slice(
286
+ (m.value.page - 1) * m.value.size,
287
+ m.value.size * m.value.page
288
+ ) : $.value), C = oe(n.columns), X = H(() => G(C));
289
+ return pe("enumMap", L), (t = H(() => {
290
+ var e;
291
+ return (e = X.value) == null ? void 0 : e.filter((l) => {
292
+ var r, c;
293
+ return ((r = l.search) == null ? void 0 : r.el) || ((c = l.search) == null ? void 0 : c.render);
294
+ }).sort((l, r) => l.search.order - r.search.order);
295
+ }).value) == null || t.forEach((e, l) => {
296
+ var h, b, S;
297
+ e.search.order = ((h = e.search) == null ? void 0 : h.order) ?? l + 2;
298
+ const r = ((b = e.search) == null ? void 0 : b.key) ?? _e(e.prop), c = (S = e.search) == null ? void 0 : S.defaultValue;
299
+ c != null && (T.value[r] = c, F.value[r] = c);
300
+ }), i({
301
+ element: u,
302
+ tableData: O,
303
+ radio: a,
304
+ enumMap: L,
305
+ pagination: m,
306
+ searchParam: T,
307
+ searchInitParam: F,
308
+ isSelected: M,
309
+ selectedList: B,
310
+ selectedListIds: W,
311
+ // 下面为 function
312
+ getTableList: I,
313
+ search: w,
314
+ reset: x,
315
+ handleSizeChange: E,
316
+ handleCurrentChange: N,
317
+ clearSelection: q
318
+ }), (e, l) => {
319
+ const r = R("el-radio"), c = R("el-table-column"), h = R("TableColumn"), b = R("el-empty"), S = fe("loading");
320
+ return y(), K("div", {
321
+ ref_key: "containerRef",
322
+ ref: J
323
+ }, [
324
+ ve((y(), k(v(we), {
325
+ ref_key: "tableRef",
326
+ ref: u,
327
+ size: e.size,
328
+ id: z.value,
329
+ height: v(U) || void 0,
330
+ "cell-style": () => ({ padding: 0, height: e.rowH ? e.rowH + "px" : void 0 }),
331
+ "element-loading-text": "Loading...",
332
+ "element-loading-spinner": v(Fe)(),
333
+ "element-loading-svg-view-box": "-10, -10, 50, 50",
334
+ data: O.value,
335
+ border: e.border,
336
+ "row-key": e.rowKey,
337
+ "table-layout": "auto",
338
+ onSelectionChange: v(p)
339
+ }, {
340
+ append: _(() => [
341
+ D(e.$slots, "append", {}, void 0, !0)
342
+ ]),
343
+ empty: _(() => [
344
+ re(b, null, {
345
+ description: _(() => l[2] || (l[2] = [
346
+ Se(be("No Data"))
347
+ ])),
348
+ _: 1
349
+ })
350
+ ]),
351
+ default: _(() => [
352
+ D(e.$slots, "default", {}, void 0, !0),
353
+ (y(!0), K(te, null, ie(C, (g) => (y(), K(te, { key: g }, [
354
+ g.type && o.includes(g.type) ? (y(), k(c, A({
355
+ key: 0,
356
+ ref_for: !0
357
+ }, g, {
358
+ align: g.align ?? "center",
359
+ "reserve-selection": g.type == "selection"
360
+ }), {
361
+ default: _((f) => [
362
+ g.type == "expand" ? (y(), K(te, { key: 0 }, [
363
+ g.render ? (y(), k(ye(g.render), A({
364
+ key: 0,
365
+ ref_for: !0
366
+ }, f), null, 16)) : D(e.$slots, g.type, A({
367
+ key: 1,
368
+ ref_for: !0
369
+ }, f), void 0, !0)
370
+ ], 64)) : ee("", !0),
371
+ g.type == "radio" ? (y(), k(r, {
372
+ key: 1,
373
+ modelValue: a.value,
374
+ "onUpdate:modelValue": l[0] || (l[0] = (P) => a.value = P),
375
+ label: f.row[e.rowKey]
376
+ }, {
377
+ default: _(() => l[1] || (l[1] = [
378
+ ze("i", null, null, -1)
379
+ ])),
380
+ _: 2
381
+ }, 1032, ["modelValue", "label"])) : ee("", !0)
382
+ ]),
383
+ _: 2
384
+ }, 1040, ["align", "reserve-selection"])) : (y(), k(h, {
385
+ key: 1,
386
+ column: g
387
+ }, Ce({ _: 2 }, [
388
+ ie(Object.keys(e.$slots), (f) => ({
389
+ name: f,
390
+ fn: _((P) => [
391
+ D(e.$slots, f, A({ ref_for: !0 }, P), void 0, !0)
392
+ ])
393
+ }))
394
+ ]), 1032, ["column"]))
395
+ ], 64))), 128))
396
+ ]),
397
+ _: 3
398
+ }, 8, ["size", "id", "height", "cell-style", "element-loading-spinner", "data", "border", "row-key", "onSelectionChange"])), [
399
+ [S, e.loading]
400
+ ]),
401
+ v(m) ? D(e.$slots, "pagination", { key: 0 }, () => [
402
+ re(Te, {
403
+ className: "basic-table-pagination",
404
+ styles: "margin-top: 12px; margin-right: 20px; display: flex; justify-content: flex-end;",
405
+ size: e.size,
406
+ "page-size": e.pageSize,
407
+ "pager-count": v(Q),
408
+ pagination: v(m),
409
+ handleSizeChange: v(E),
410
+ handleCurrentChange: v(N)
411
+ }, null, 8, ["size", "page-size", "pager-count", "pagination", "handleSizeChange", "handleCurrentChange"])
412
+ ], !0) : ee("", !0)
413
+ ], 512);
414
+ };
415
+ }
416
+ }), xe = (s, i) => {
417
+ const n = s.__vccOpts || s;
418
+ for (const [u, z] of i)
419
+ n[u] = z;
420
+ return n;
421
+ }, Be = /* @__PURE__ */ xe(Le, [["__scopeId", "data-v-4a4bf617"]]), We = {
422
+ install: (s, i) => {
423
+ Reflect.ownKeys(s._context.provides).some((n) => String(n) === "Symbol(pinia)") || console.warn("Pinia is not provided. Please install and provide Pinia in your app."), Pe(i);
10
424
  },
11
425
  version: "__VERSION__"
12
426
  };
13
427
  export {
14
- o as default
428
+ Be as ProTable,
429
+ We as default
15
430
  };
@@ -1 +1,10 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["vue","element-plus"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.AutoVuePage=n())})(this,function(){"use strict";const e=i=>{if(!i.request)throw new Error("request function is required");i.request,i.mittBus};return{install:(i,t)=>{Reflect.ownKeys(i._context.provides).some(s=>String(s)==="Symbol(pinia)")||console.warn("Pinia is not provided. Please install and provide Pinia in your app."),e(t)},version:"__VERSION__"}});
1
+ (function(y,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(y=typeof globalThis<"u"?globalThis:y||self,e(y.AutoVuePage={},y.Vue,y.ElementPlus))})(this,function(y,e,G){"use strict";let I;const J=c=>{if(!c.request)throw new Error("request function is required");I=c.request,c.mittBus};function Q(c){const r=c.split(".");return r.length==1?c:r[r.length-1]}function X(){let c="";for(let r=0;r<32;r++){let l=Math.random()*16|0;(r===8||r===12||r===16||r===20)&&(c+="-"),c+=(r===12?4:r===16?l&3|8:l).toString(16)}return c}const Y=(c,r={},l=!0,d,C,s)=>{const n=e.reactive({tableData:[],pagination:{page:1,size:10,total:0},searchParam:{},searchInitParam:{},totalParam:{}}),h=e.ref(null),H=e.ref(0),x=e.ref(0),P=e.ref(null),F=e.ref(0),f=e.ref(5),_=e.ref(0),B=e.ref(0),T=()=>{e.nextTick(()=>{if(!h.value)return;const a=h.value.parentElement,t=(a==null?void 0:a.clientHeight)||0,o=(a==null?void 0:a.clientWidth)||0,i=a?getComputedStyle(a):null,g=i?parseFloat(i.paddingTop)+parseFloat(i.paddingBottom):0,m=i?parseFloat(i.marginTop)+parseFloat(i.marginBottom):0,b=Array.from((a==null?void 0:a.children)||[]).filter(W=>W!==h.value).reduce((W,K)=>{const $=getComputedStyle(K),ne=parseFloat($.marginTop)+parseFloat($.marginBottom),le=parseFloat($.marginLeft)+parseFloat($.marginRight);return[W[0]+K.clientHeight+ne,W[1]+K.clientWidth+le]},[0,0]),[z,u]=b,p=t-z-g-m,w=o-u-g-m;h.value.style.height=p?`${p}px`:"100%",h.value.style.width=w?`${w}px`:"100%",H.value=p,x.value=w})};e.watch(H,a=>{const t={small:32,default:40,large:48},o={small:41,default:49,large:57};let{rowH:i,extH:g,size:m}=s;const b=o[m||"small"]||41,z=t[m||"small"]||32,u=l?44:0;i=i||b,g=(g||0)+z+u,F.value=a-u,_.value=i,B.value=z,s!=null&&s.pageSize&&(s==null?void 0:s.pageSize)>0?n.pagination.size=s==null?void 0:s.pageSize:a>0&&(n.pagination.size=Math.floor((a-g)/i)-(s!=null&&s.sumUrl?1:0))},{deep:!0,immediate:!0}),e.watch(x,a=>{if(!l||!a)return;let{size:t="small"}=s;const i={"":32,default:32,small:24,large:40}[t],g=a-80-16-(i+8)*2-16-(t==="small"?108:114),m=Math.floor(g/(i+8))-1;f.value=Math.min(Math.max(m,2),7)},{deep:!0,immediate:!0}),e.onMounted(()=>{T(),window.addEventListener("resize",()=>{P.value&&clearTimeout(P.value),P.value=setTimeout(()=>{T()},300)})});const L=e.computed({get:()=>({page:n.pagination.page,size:n.pagination.size}),set:a=>{console.log("我是分页更新之后的值",a)}}),k=()=>{e.nextTick(async()=>{let a=c;if(!(a==""&&!(s!=null&&s.api)))try{Object.assign(n.totalParam,r,l?L.value:{});let{data:t}=await I(a,{...n.searchInitParam,...n.totalParam});d&&(t=d(t)),n.tableData=l?t.list:t,l&&(n.pagination.total=t.total)}catch(t){C&&C(t)}})},M=()=>{n.totalParam={};let a={};for(let t in n.searchParam)(n.searchParam[t]||n.searchParam[t]===!1||n.searchParam[t]===0)&&(a[t]=n.searchParam[t]);Object.assign(n.totalParam,a)},U=()=>{n.pagination.page=1,M(),k(),s!=null&&s.sumUrl&&R()},E=()=>{n.pagination.page=1,n.searchParam={...n.searchInitParam},M(),k(),s!=null&&s.sumUrl&&R()},D=a=>{n.pagination.page=1,n.pagination.size=a,k()},q=a=>{n.pagination.page=a,k()},N=e.ref([]);function j(){const a=[];for(const t of N.value)a[t.index]=t.text;return a}async function R(){await I(s.sumUrl,{...n.searchInitParam,...n.totalParam,page:1,size:1}).then(a=>{N.value=(a==null?void 0:a.data)||[]})}const V=a=>{n.pagination.size=a},S=e.ref(new Map),O=async({prop:a,enum:t})=>{if(!t||S.value.has(a)&&(typeof t=="function"||S.value.get(a)===t))return;if(typeof t!="function")return S.value.set(a,e.unref(t));S.value.set(a,[]);const{data:o}=await t();S.value.set(a,o)},A=(a,t=[])=>(a.forEach(async o=>{var i;(i=o._children)!=null&&i.length&&t.push(...A(o._children)),t.push(o),o.isShow=o.isShow??!0,o.isSetting=o.isSetting??!0,o.isFilterEnum=o.isFilterEnum??!0,await O(o)}),t.filter(o=>{var i;return!((i=o._children)!=null&&i.length)}));return{...e.toRefs(n),enumMap:S,getTableList:k,getSummaries:j,search:U,reset:E,handleSizeChange:D,handleCurrentChange:q,updatedTotalParam:M,flatColumnsFunc:A,containerRef:h,calculateHeight:F,calculateRowH:_,calculateTitleH:B,pagerCount:f,updatePageSize:V}},Z=(c="id",r)=>{const l=e.ref(!1),d=e.ref([]),C=e.computed(()=>{let n=[];return d.value.forEach(h=>n.push(h[c])),n});return{isSelected:l,selectedList:d,selectedListIds:C,selectionChange:n=>{n.length?l.value=!0:l.value=!1,d.value=n}}},v=e.defineComponent({__name:"Pagination",props:{className:{},styles:{},size:{},pagination:{},pageSize:{},pagerCount:{},handleSizeChange:{type:Function},handleCurrentChange:{type:Function}},setup(c){const r=c,l=e.computed(()=>r.pageSize>0?[r.pageSize,r.pageSize*2,r.pageSize*3,r.pageSize*4,r.pageSize*5]:[]);return(d,C)=>{const s=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(s,{class:e.normalizeClass(d.className),style:e.normalizeStyle(d.styles),background:!0,"current-page":d.pagination.page,"page-size":d.pagination.size,"page-sizes":l.value,total:d.pagination.total,"pager-count":r.pagerCount||7,size:d.size,layout:`total, ${l.value.length>0?"sizes,":""} prev, pager, next, jumper`,onSizeChange:d.handleSizeChange,onCurrentChange:d.handleCurrentChange},null,8,["class","style","current-page","page-size","page-sizes","total","pager-count","size","layout","onSizeChange","onCurrentChange"])}}}),ee=(c="stroke-width: 4px; fill: rgba(0, 0, 0, 0)")=>`
2
+ <path class="path" d="
3
+ M 30 15
4
+ L 28 17
5
+ M 25.61 25.61
6
+ A 15 15, 0, 0, 1, 15 30
7
+ A 15 15, 0, 1, 1, 27.99 7.5
8
+ L 15 15
9
+ " style="${c}"/>
10
+ `,te=((c,r)=>{const l=c.__vccOpts||c;for(const[d,C]of r)l[d]=C;return l})(e.defineComponent({__name:"index",props:{columns:{default:()=>[]},data:{},api:{},url:{},sumUrl:{},autoSearch:{type:Boolean,default:!0},requestError:{},dataCallback:{},title:{},pagination:{type:Boolean,default:!0},initParam:{default:{}},border:{type:Boolean,default:!1},toolButton:{type:[Array,Boolean]},rowKey:{default:"id"},searchCol:{},loading:{},size:{default:""},pageSize:{default:0},rowH:{default:0},extH:{default:0},sumText:{},sumTextFormat:{}},setup(c,{expose:r}){var a;const l=c,d=e.ref(),C=e.ref("id-"+X()),s=["selection","radio","index","expand"],n=e.ref(""),{selectionChange:h,selectedList:H,selectedListIds:x,isSelected:P}=Z(l.rowKey),{tableData:F,pagination:f,searchParam:_,searchInitParam:B,enumMap:T,getTableList:L,search:k,reset:M,flatColumnsFunc:U,handleSizeChange:E,handleCurrentChange:D,containerRef:q,calculateHeight:N,pagerCount:j}=Y(l.url,l.initParam,l.pagination,l.dataCallback,l.requestError,l),R=()=>d.value.clearSelection();e.onMounted(()=>{e.nextTick(()=>{l.autoSearch&&L(),l.data&&(f.value.total=l.data.length)})});const V=e.computed(()=>l.data?l.data.slice((f.value.page-1)*f.value.size,f.value.size*f.value.page):F.value),S=e.reactive(l.columns),O=e.computed(()=>U(S));return e.provide("enumMap",T),(a=e.computed(()=>{var t;return(t=O.value)==null?void 0:t.filter(o=>{var i,g;return((i=o.search)==null?void 0:i.el)||((g=o.search)==null?void 0:g.render)}).sort((o,i)=>o.search.order-i.search.order)}).value)==null||a.forEach((t,o)=>{var m,b,z;t.search.order=((m=t.search)==null?void 0:m.order)??o+2;const i=((b=t.search)==null?void 0:b.key)??Q(t.prop),g=(z=t.search)==null?void 0:z.defaultValue;g!=null&&(_.value[i]=g,B.value[i]=g)}),r({element:d,tableData:V,radio:n,enumMap:T,pagination:f,searchParam:_,searchInitParam:B,isSelected:P,selectedList:H,selectedListIds:x,getTableList:L,search:k,reset:M,handleSizeChange:E,handleCurrentChange:D,clearSelection:R}),(t,o)=>{const i=e.resolveComponent("el-radio"),g=e.resolveComponent("el-table-column"),m=e.resolveComponent("TableColumn"),b=e.resolveComponent("el-empty"),z=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:q},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(G.ElTable),{ref_key:"tableRef",ref:d,size:t.size,id:C.value,height:e.unref(N)||void 0,"cell-style":()=>({padding:0,height:t.rowH?t.rowH+"px":void 0}),"element-loading-text":"Loading...","element-loading-spinner":e.unref(ee)(),"element-loading-svg-view-box":"-10, -10, 50, 50",data:V.value,border:t.border,"row-key":t.rowKey,"table-layout":"auto",onSelectionChange:e.unref(h)},{append:e.withCtx(()=>[e.renderSlot(t.$slots,"append",{},void 0,!0)]),empty:e.withCtx(()=>[e.createVNode(b,null,{description:e.withCtx(()=>o[2]||(o[2]=[e.createTextVNode(e.toDisplayString("No Data"))])),_:1})]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S,u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[u.type&&s.includes(u.type)?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0,ref_for:!0},u,{align:u.align??"center","reserve-selection":u.type=="selection"}),{default:e.withCtx(p=>[u.type=="expand"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[u.render?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.render),e.mergeProps({key:0,ref_for:!0},p),null,16)):e.renderSlot(t.$slots,u.type,e.mergeProps({key:1,ref_for:!0},p),void 0,!0)],64)):e.createCommentVNode("",!0),u.type=="radio"?(e.openBlock(),e.createBlock(i,{key:1,modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=w=>n.value=w),label:p.row[t.rowKey]},{default:e.withCtx(()=>o[1]||(o[1]=[e.createElementVNode("i",null,null,-1)])),_:2},1032,["modelValue","label"])):e.createCommentVNode("",!0)]),_:2},1040,["align","reserve-selection"])):(e.openBlock(),e.createBlock(m,{key:1,column:u},e.createSlots({_:2},[e.renderList(Object.keys(t.$slots),p=>({name:p,fn:e.withCtx(w=>[e.renderSlot(t.$slots,p,e.mergeProps({ref_for:!0},w),void 0,!0)])}))]),1032,["column"]))],64))),128))]),_:3},8,["size","id","height","cell-style","element-loading-spinner","data","border","row-key","onSelectionChange"])),[[z,t.loading]]),e.unref(f)?e.renderSlot(t.$slots,"pagination",{key:0},()=>[e.createVNode(v,{className:"basic-table-pagination",styles:"margin-top: 12px; margin-right: 20px; display: flex; justify-content: flex-end;",size:t.size,"page-size":t.pageSize,"pager-count":e.unref(j),pagination:e.unref(f),handleSizeChange:e.unref(E),handleCurrentChange:e.unref(D)},null,8,["size","page-size","pager-count","pagination","handleSizeChange","handleCurrentChange"])],!0):e.createCommentVNode("",!0)],512)}}}),[["__scopeId","data-v-4a4bf617"]]),ae={install:(c,r)=>{Reflect.ownKeys(c._context.provides).some(l=>String(l)==="Symbol(pinia)")||console.warn("Pinia is not provided. Please install and provide Pinia in your app."),J(r)},version:"__VERSION__"};y.ProTable=te,y.default=ae,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});