auto-vue-manual 0.0.5 → 0.0.7
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.
package/dist/auto-vue-page.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive as oe, ref as
|
|
1
|
+
import { reactive as oe, ref as g, watch as le, onMounted as se, computed as H, toRefs as ge, nextTick as ae, unref as y, defineComponent as ue, resolveComponent as R, createBlock as k, openBlock as v, normalizeStyle as he, normalizeClass as me, provide as pe, resolveDirective as fe, createElementBlock as K, withDirectives as ye, renderSlot as D, createCommentVNode as ee, withCtx as _, Fragment as te, renderList as ie, mergeProps as A, resolveDynamicComponent as ve, createElementVNode as ze, createSlots as Se, createVNode as re, createTextVNode as Ce, toDisplayString as be } from "vue";
|
|
2
2
|
import { ElTable as we } from "element-plus";
|
|
3
3
|
let ne;
|
|
4
4
|
const Pe = (s) => {
|
|
@@ -37,17 +37,17 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
37
37
|
searchInitParam: {},
|
|
38
38
|
// 总参数(包含分页和查询参数)
|
|
39
39
|
totalParam: {}
|
|
40
|
-
}), p =
|
|
40
|
+
}), p = g(null), $ = g(0), B = g(0), M = g(null), W = g(0), m = g(5), T = g(0), F = g(0), L = () => {
|
|
41
41
|
ae(() => {
|
|
42
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((
|
|
44
|
-
const
|
|
45
|
-
return [
|
|
46
|
-
}, [0, 0]), [
|
|
47
|
-
p.value.style.height = f ? `${f}px` : "100%", p.value.style.width = P ? `${P}px` : "100%",
|
|
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((q) => q !== p.value).reduce((q, Z) => {
|
|
44
|
+
const V = getComputedStyle(Z), ce = parseFloat(V.marginTop) + parseFloat(V.marginBottom), de = parseFloat(V.marginLeft) + parseFloat(V.marginRight);
|
|
45
|
+
return [q[0] + Z.clientHeight + ce, q[1] + Z.clientWidth + de];
|
|
46
|
+
}, [0, 0]), [C, d] = b, f = e - C - c - h, P = l - d - c - h;
|
|
47
|
+
p.value.style.height = f ? `${f}px` : "100%", p.value.style.width = P ? `${P}px` : "100%", $.value = f, B.value = P;
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
le(
|
|
50
|
+
le($, (t) => {
|
|
51
51
|
const e = {
|
|
52
52
|
small: 32,
|
|
53
53
|
default: 40,
|
|
@@ -58,9 +58,9 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
58
58
|
large: 57
|
|
59
59
|
};
|
|
60
60
|
let { rowH: r, extH: c, size: h } = o;
|
|
61
|
-
const b = l[h || "small"] || 41,
|
|
62
|
-
r = r || b, c = (c || 0) +
|
|
63
|
-
}, { deep: !0, immediate: !0 }), le(
|
|
61
|
+
const b = l[h || "small"] || 41, C = e[h || "small"] || 32, d = n ? 44 : 0;
|
|
62
|
+
r = r || b, c = (c || 0) + C + d, W.value = t - d, T.value = r, F.value = C, 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(B, (t) => {
|
|
64
64
|
if (!n || !t) return;
|
|
65
65
|
let { size: e = "small" } = o;
|
|
66
66
|
const r = {
|
|
@@ -107,21 +107,21 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
107
107
|
(a.searchParam[e] || a.searchParam[e] === !1 || a.searchParam[e] === 0) && (t[e] = a.searchParam[e]);
|
|
108
108
|
Object.assign(a.totalParam, t);
|
|
109
109
|
}, G = () => {
|
|
110
|
-
a.pagination.page = 1, x(), w(), o != null && o.sumUrl &&
|
|
110
|
+
a.pagination.page = 1, x(), w(), o != null && o.sumUrl && O();
|
|
111
111
|
}, E = () => {
|
|
112
|
-
a.pagination.page = 1, a.searchParam = { ...a.searchInitParam }, x(), w(), o != null && o.sumUrl &&
|
|
112
|
+
a.pagination.page = 1, a.searchParam = { ...a.searchInitParam }, x(), w(), o != null && o.sumUrl && O();
|
|
113
113
|
}, N = (t) => {
|
|
114
114
|
a.pagination.page = 1, a.pagination.size = t, w();
|
|
115
115
|
}, J = (t) => {
|
|
116
116
|
a.pagination.page = t, w();
|
|
117
|
-
}, U =
|
|
117
|
+
}, U = g([]);
|
|
118
118
|
function Q() {
|
|
119
119
|
const t = [];
|
|
120
120
|
for (const e of U.value)
|
|
121
121
|
t[e.index] = e.text;
|
|
122
122
|
return t;
|
|
123
123
|
}
|
|
124
|
-
async function
|
|
124
|
+
async function O() {
|
|
125
125
|
await ne(o.sumUrl, {
|
|
126
126
|
...a.searchInitParam,
|
|
127
127
|
...a.totalParam,
|
|
@@ -131,16 +131,16 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
131
131
|
U.value = (t == null ? void 0 : t.data) || [];
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const j = (t) => {
|
|
135
135
|
a.pagination.size = t;
|
|
136
|
-
},
|
|
137
|
-
if (!e ||
|
|
136
|
+
}, S = g(/* @__PURE__ */ new Map()), X = async ({ prop: t, enum: e }) => {
|
|
137
|
+
if (!e || S.value.has(t) && (typeof e == "function" || S.value.get(t) === e))
|
|
138
138
|
return;
|
|
139
139
|
if (typeof e != "function")
|
|
140
|
-
return
|
|
141
|
-
|
|
140
|
+
return S.value.set(t, y(e));
|
|
141
|
+
S.value.set(t, []);
|
|
142
142
|
const { data: l } = await e();
|
|
143
|
-
|
|
143
|
+
S.value.set(t, l);
|
|
144
144
|
}, Y = (t, e = []) => (t.forEach(async (l) => {
|
|
145
145
|
var r;
|
|
146
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);
|
|
@@ -149,8 +149,8 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
149
149
|
return !((r = l._children) != null && r.length);
|
|
150
150
|
}));
|
|
151
151
|
return {
|
|
152
|
-
...
|
|
153
|
-
enumMap:
|
|
152
|
+
...ge(a),
|
|
153
|
+
enumMap: S,
|
|
154
154
|
getTableList: w,
|
|
155
155
|
getSummaries: Q,
|
|
156
156
|
search: G,
|
|
@@ -160,14 +160,14 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
160
160
|
updatedTotalParam: x,
|
|
161
161
|
flatColumnsFunc: Y,
|
|
162
162
|
containerRef: p,
|
|
163
|
-
calculateHeight:
|
|
163
|
+
calculateHeight: W,
|
|
164
164
|
calculateRowH: T,
|
|
165
165
|
calculateTitleH: F,
|
|
166
166
|
pagerCount: m,
|
|
167
|
-
updatePageSize:
|
|
167
|
+
updatePageSize: j
|
|
168
168
|
};
|
|
169
169
|
}, Me = (s = "id", i) => {
|
|
170
|
-
const n =
|
|
170
|
+
const n = g(!1), u = g([]), z = H(() => {
|
|
171
171
|
let a = [];
|
|
172
172
|
return u.value.forEach((p) => a.push(p[s])), a;
|
|
173
173
|
});
|
|
@@ -195,7 +195,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
195
195
|
const i = s, n = H(() => i.pageSize > 0 ? [i.pageSize, i.pageSize * 2, i.pageSize * 3, i.pageSize * 4, i.pageSize * 5] : []);
|
|
196
196
|
return (u, z) => {
|
|
197
197
|
const o = R("el-pagination");
|
|
198
|
-
return
|
|
198
|
+
return v(), k(o, {
|
|
199
199
|
class: me(u.className),
|
|
200
200
|
style: he(u.styles),
|
|
201
201
|
background: !0,
|
|
@@ -248,14 +248,14 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
248
248
|
},
|
|
249
249
|
setup(s, { expose: i }) {
|
|
250
250
|
var t;
|
|
251
|
-
const n = s, u =
|
|
251
|
+
const n = s, u = g(), z = g("id-" + ke()), o = [
|
|
252
252
|
"selection",
|
|
253
253
|
"radio",
|
|
254
254
|
"index",
|
|
255
255
|
"expand"
|
|
256
256
|
// "sort",
|
|
257
|
-
], a =
|
|
258
|
-
tableData:
|
|
257
|
+
], a = g(""), { selectionChange: p, selectedList: $, selectedListIds: B, isSelected: M } = Me(n.rowKey), {
|
|
258
|
+
tableData: W,
|
|
259
259
|
pagination: m,
|
|
260
260
|
searchParam: T,
|
|
261
261
|
searchInitParam: F,
|
|
@@ -276,16 +276,16 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
276
276
|
n.dataCallback,
|
|
277
277
|
n.requestError,
|
|
278
278
|
n
|
|
279
|
-
),
|
|
279
|
+
), O = () => u.value.clearSelection();
|
|
280
280
|
se(() => {
|
|
281
281
|
ae(() => {
|
|
282
282
|
n.autoSearch && I(), n.data && (m.value.total = n.data.length);
|
|
283
283
|
});
|
|
284
284
|
});
|
|
285
|
-
const
|
|
285
|
+
const j = H(() => n.data ? n.data.slice(
|
|
286
286
|
(m.value.page - 1) * m.value.size,
|
|
287
287
|
m.value.size * m.value.page
|
|
288
|
-
) :
|
|
288
|
+
) : W.value), S = oe(n.columns), X = H(() => G(S));
|
|
289
289
|
return pe("enumMap", L), (t = H(() => {
|
|
290
290
|
var e;
|
|
291
291
|
return (e = X.value) == null ? void 0 : e.filter((l) => {
|
|
@@ -293,49 +293,49 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
293
293
|
return ((r = l.search) == null ? void 0 : r.el) || ((c = l.search) == null ? void 0 : c.render);
|
|
294
294
|
}).sort((l, r) => l.search.order - r.search.order);
|
|
295
295
|
}).value) == null || t.forEach((e, l) => {
|
|
296
|
-
var h, b,
|
|
296
|
+
var h, b, C;
|
|
297
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 = (
|
|
298
|
+
const r = ((b = e.search) == null ? void 0 : b.key) ?? _e(e.prop), c = (C = e.search) == null ? void 0 : C.defaultValue;
|
|
299
299
|
c != null && (T.value[r] = c, F.value[r] = c);
|
|
300
300
|
}), i({
|
|
301
301
|
element: u,
|
|
302
|
-
tableData:
|
|
302
|
+
tableData: j,
|
|
303
303
|
radio: a,
|
|
304
304
|
enumMap: L,
|
|
305
305
|
pagination: m,
|
|
306
306
|
searchParam: T,
|
|
307
307
|
searchInitParam: F,
|
|
308
308
|
isSelected: M,
|
|
309
|
-
selectedList:
|
|
310
|
-
selectedListIds:
|
|
309
|
+
selectedList: $,
|
|
310
|
+
selectedListIds: B,
|
|
311
311
|
// 下面为 function
|
|
312
312
|
getTableList: I,
|
|
313
313
|
search: w,
|
|
314
314
|
reset: x,
|
|
315
315
|
handleSizeChange: E,
|
|
316
316
|
handleCurrentChange: N,
|
|
317
|
-
clearSelection:
|
|
317
|
+
clearSelection: O
|
|
318
318
|
}), (e, l) => {
|
|
319
|
-
const r = R("el-radio"), c = R("el-table-column"), h = R("TableColumn"), b = R("el-empty"),
|
|
320
|
-
return
|
|
319
|
+
const r = R("el-radio"), c = R("el-table-column"), h = R("TableColumn"), b = R("el-empty"), C = fe("loading");
|
|
320
|
+
return v(), K("div", {
|
|
321
321
|
ref_key: "containerRef",
|
|
322
322
|
ref: J
|
|
323
323
|
}, [
|
|
324
|
-
|
|
324
|
+
ye((v(), k(y(we), {
|
|
325
325
|
ref_key: "tableRef",
|
|
326
326
|
ref: u,
|
|
327
327
|
size: e.size,
|
|
328
328
|
id: z.value,
|
|
329
|
-
height:
|
|
329
|
+
height: y(U) || void 0,
|
|
330
330
|
"cell-style": () => ({ padding: 0, height: e.rowH ? e.rowH + "px" : void 0 }),
|
|
331
331
|
"element-loading-text": "Loading...",
|
|
332
|
-
"element-loading-spinner":
|
|
332
|
+
"element-loading-spinner": y(Fe)(),
|
|
333
333
|
"element-loading-svg-view-box": "-10, -10, 50, 50",
|
|
334
|
-
data:
|
|
334
|
+
data: j.value,
|
|
335
335
|
border: e.border,
|
|
336
336
|
"row-key": e.rowKey,
|
|
337
337
|
"table-layout": "auto",
|
|
338
|
-
onSelectionChange:
|
|
338
|
+
onSelectionChange: y(p)
|
|
339
339
|
}, {
|
|
340
340
|
append: _(() => [
|
|
341
341
|
D(e.$slots, "append", {}, void 0, !0)
|
|
@@ -343,32 +343,32 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
343
343
|
empty: _(() => [
|
|
344
344
|
re(b, null, {
|
|
345
345
|
description: _(() => l[2] || (l[2] = [
|
|
346
|
-
|
|
346
|
+
Ce(be("No Data"))
|
|
347
347
|
])),
|
|
348
348
|
_: 1
|
|
349
349
|
})
|
|
350
350
|
]),
|
|
351
351
|
default: _(() => [
|
|
352
352
|
D(e.$slots, "default", {}, void 0, !0),
|
|
353
|
-
(
|
|
354
|
-
|
|
353
|
+
(v(!0), K(te, null, ie(S, (d) => (v(), K(te, { key: d }, [
|
|
354
|
+
d.type && o.includes(d.type) ? (v(), k(c, A({
|
|
355
355
|
key: 0,
|
|
356
356
|
ref_for: !0
|
|
357
|
-
},
|
|
358
|
-
align:
|
|
359
|
-
"reserve-selection":
|
|
357
|
+
}, d, {
|
|
358
|
+
align: d.align ?? "center",
|
|
359
|
+
"reserve-selection": d.type == "selection"
|
|
360
360
|
}), {
|
|
361
361
|
default: _((f) => [
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
d.type == "expand" ? (v(), K(te, { key: 0 }, [
|
|
363
|
+
d.render ? (v(), k(ve(d.render), A({
|
|
364
364
|
key: 0,
|
|
365
365
|
ref_for: !0
|
|
366
|
-
}, f), null, 16)) : D(e.$slots,
|
|
366
|
+
}, f), null, 16)) : D(e.$slots, d.type, A({
|
|
367
367
|
key: 1,
|
|
368
368
|
ref_for: !0
|
|
369
369
|
}, f), void 0, !0)
|
|
370
370
|
], 64)) : ee("", !0),
|
|
371
|
-
|
|
371
|
+
d.type == "radio" ? (v(), k(r, {
|
|
372
372
|
key: 1,
|
|
373
373
|
modelValue: a.value,
|
|
374
374
|
"onUpdate:modelValue": l[0] || (l[0] = (P) => a.value = P),
|
|
@@ -381,10 +381,10 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
381
381
|
}, 1032, ["modelValue", "label"])) : ee("", !0)
|
|
382
382
|
]),
|
|
383
383
|
_: 2
|
|
384
|
-
}, 1040, ["align", "reserve-selection"])) : (
|
|
384
|
+
}, 1040, ["align", "reserve-selection"])) : (v(), k(h, {
|
|
385
385
|
key: 1,
|
|
386
|
-
column:
|
|
387
|
-
},
|
|
386
|
+
column: d
|
|
387
|
+
}, Se({ _: 2 }, [
|
|
388
388
|
ie(Object.keys(e.$slots), (f) => ({
|
|
389
389
|
name: f,
|
|
390
390
|
fn: _((P) => [
|
|
@@ -396,18 +396,18 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
396
396
|
]),
|
|
397
397
|
_: 3
|
|
398
398
|
}, 8, ["size", "id", "height", "cell-style", "element-loading-spinner", "data", "border", "row-key", "onSelectionChange"])), [
|
|
399
|
-
[
|
|
399
|
+
[C, e.loading]
|
|
400
400
|
]),
|
|
401
|
-
|
|
401
|
+
y(m) ? D(e.$slots, "pagination", { key: 0 }, () => [
|
|
402
402
|
re(Te, {
|
|
403
403
|
className: "basic-table-pagination",
|
|
404
404
|
styles: "margin-top: 12px; margin-right: 20px; display: flex; justify-content: flex-end;",
|
|
405
405
|
size: e.size,
|
|
406
406
|
"page-size": e.pageSize,
|
|
407
|
-
"pager-count":
|
|
408
|
-
pagination:
|
|
409
|
-
handleSizeChange:
|
|
410
|
-
handleCurrentChange:
|
|
407
|
+
"pager-count": y(Q),
|
|
408
|
+
pagination: y(m),
|
|
409
|
+
handleSizeChange: y(E),
|
|
410
|
+
handleCurrentChange: y(N)
|
|
411
411
|
}, null, 8, ["size", "page-size", "pager-count", "pagination", "handleSizeChange", "handleCurrentChange"])
|
|
412
412
|
], !0) : ee("", !0)
|
|
413
413
|
], 512);
|
|
@@ -418,13 +418,16 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
418
418
|
for (const [u, z] of i)
|
|
419
419
|
n[u] = z;
|
|
420
420
|
return n;
|
|
421
|
-
},
|
|
421
|
+
}, De = /* @__PURE__ */ xe(Le, [["__scopeId", "data-v-4a4bf617"]]), Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
422
|
+
__proto__: null,
|
|
423
|
+
ProTable: De
|
|
424
|
+
}, Symbol.toStringTag, { value: "Module" })), We = {
|
|
422
425
|
install: (s, i) => {
|
|
423
426
|
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);
|
|
424
427
|
},
|
|
425
428
|
version: "__VERSION__"
|
|
426
429
|
};
|
|
427
430
|
export {
|
|
428
|
-
Be as
|
|
431
|
+
Be as components,
|
|
429
432
|
We as default
|
|
430
433
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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),
|
|
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),x=e.ref(0),H=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(V=>V!==h.value).reduce((V,K)=>{const W=getComputedStyle(K),ne=parseFloat(W.marginTop)+parseFloat(W.marginBottom),le=parseFloat(W.marginLeft)+parseFloat(W.marginRight);return[V[0]+K.clientHeight+ne,V[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%",x.value=p,H.value=w})};e.watch(x,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(H,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)},j=()=>{n.pagination.page=1,M(),k(),s!=null&&s.sumUrl&&N()},E=()=>{n.pagination.page=1,n.searchParam={...n.searchInitParam},M(),k(),s!=null&&s.sumUrl&&N()},$=a=>{n.pagination.page=1,n.pagination.size=a,k()},O=a=>{n.pagination.page=a,k()},D=e.ref([]);function U(){const a=[];for(const t of D.value)a[t.index]=t.text;return a}async function N(){await I(s.sumUrl,{...n.searchInitParam,...n.totalParam,page:1,size:1}).then(a=>{D.value=(a==null?void 0:a.data)||[]})}const R=a=>{n.pagination.size=a},S=e.ref(new Map),q=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 q(o)}),t.filter(o=>{var i;return!((i=o._children)!=null&&i.length)}));return{...e.toRefs(n),enumMap:S,getTableList:k,getSummaries:U,search:j,reset:E,handleSizeChange:$,handleCurrentChange:O,updatedTotalParam:M,flatColumnsFunc:A,containerRef:h,calculateHeight:F,calculateRowH:_,calculateTitleH:B,pagerCount:f,updatePageSize:R}},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
2
|
<path class="path" d="
|
|
3
3
|
M 30 15
|
|
4
4
|
L 28 17
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
A 15 15, 0, 1, 1, 27.99 7.5
|
|
8
8
|
L 15 15
|
|
9
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:
|
|
10
|
+
`,te=Object.freeze(Object.defineProperty({__proto__:null,ProTable:((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:x,selectedListIds:H,isSelected:P}=Z(l.rowKey),{tableData:F,pagination:f,searchParam:_,searchInitParam:B,enumMap:T,getTableList:L,search:k,reset:M,flatColumnsFunc:j,handleSizeChange:E,handleCurrentChange:$,containerRef:O,calculateHeight:D,pagerCount:U}=Y(l.url,l.initParam,l.pagination,l.dataCallback,l.requestError,l),N=()=>d.value.clearSelection();e.onMounted(()=>{e.nextTick(()=>{l.autoSearch&&L(),l.data&&(f.value.total=l.data.length)})});const R=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),q=e.computed(()=>j(S));return e.provide("enumMap",T),(a=e.computed(()=>{var t;return(t=q.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:R,radio:n,enumMap:T,pagination:f,searchParam:_,searchInitParam:B,isSelected:P,selectedList:x,selectedListIds:H,getTableList:L,search:k,reset:M,handleSizeChange:E,handleCurrentChange:$,clearSelection:N}),(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:O},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(G.ElTable),{ref_key:"tableRef",ref:d,size:t.size,id:C.value,height:e.unref(D)||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:R.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(U),pagination:e.unref(f),handleSizeChange:e.unref(E),handleCurrentChange:e.unref($)},null,8,["size","page-size","pager-count","pagination","handleSizeChange","handleCurrentChange"])],!0):e.createCommentVNode("",!0)],512)}}}),[["__scopeId","data-v-4a4bf617"]])},Symbol.toStringTag,{value:"Module"})),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.components=te,y.default=ae,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as ProTable } from './table/index.vue';
|
package/dist/types/index.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __VERSION__ = "0.0.
|
|
1
|
+
export const __VERSION__ = "0.0.6'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-vue-manual",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/auto-vue-manual.umd.js",
|
|
6
6
|
"module": "./dist/auto-vue-manual.es.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@element-plus/icons-vue": "^2.3.1",
|
|
20
20
|
"@types/react": "^19.0.10",
|
|
21
|
-
"auto-vue-manual": "^0.0.
|
|
21
|
+
"auto-vue-manual": "^0.0.5",
|
|
22
22
|
"axios": "^1.7.9",
|
|
23
23
|
"element-plus": "^2.9.3",
|
|
24
24
|
"mitt": "^3.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ProTable } from './index.vue';
|