@done-coding/admin-core 0.1.1-alpha.2 → 0.1.1-alpha.3
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/es/components/table/TableMain.vue.mjs +2 -2
- package/es/components/table/TableMain.vue2.mjs +148 -130
- package/es/components/table/TableToolbar.vue.mjs +3 -3
- package/es/components/table/TableToolbar.vue2.mjs +118 -67
- package/es/helpers/list-helper.mjs +29 -33
- package/es/index.mjs +79 -74
- package/es/style.css +1 -1
- package/es/utils/export.mjs +23 -0
- package/package.json +2 -2
- package/types/components/table/TableToolbar.vue.d.ts +26 -3
- package/types/components/table/types.d.ts +24 -1
- package/types/utils/export.d.ts +23 -0
- package/types/utils/index.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TableMain.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f0f7753c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { ElTable as
|
|
1
|
+
import { ElTable as pe, ElTableColumn as ge, ElEmpty as ce, ElPagination as de } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/es/components/pagination/style/css";
|
|
4
4
|
import "element-plus/es/components/table/style/css";
|
|
5
5
|
import "element-plus/es/components/empty/style/css";
|
|
6
6
|
import "element-plus/es/components/table-column/style/css";
|
|
7
|
-
import { defineComponent as
|
|
7
|
+
import { defineComponent as me, useCssVars as he, useModel as ve, useAttrs as ye, ref as u, computed as g, shallowRef as be, inject as Ce, onMounted as Se, onActivated as _e, watch as d, openBlock as s, createElementBlock as y, unref as n, createBlock as b, withCtx as C, createVNode as I, mergeProps as c, createCommentVNode as Ee, Fragment as T, renderList as xe, createSlots as Te, renderSlot as $, resolveDynamicComponent as Y, createTextVNode as R, toDisplayString as q, withDirectives as we, createElementVNode as Pe, isRef as F, vShow as Ie, mergeModels as G } from "vue";
|
|
8
8
|
import U from "lodash/cloneDeep";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
9
|
+
import D from "lodash/omit";
|
|
10
|
+
import W from "lodash/set";
|
|
11
|
+
import Z from "lodash/get";
|
|
12
|
+
import Re from "./TableToolbar.vue.mjs";
|
|
13
|
+
import ke from "../display/WatchSize.vue.mjs";
|
|
14
|
+
import { pickExportColumns as ze } from "../../utils/export.mjs";
|
|
15
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as He } from "../../inject/key.mjs";
|
|
16
|
+
import { APP_API_LIST_MODEL_KEY_CONFIG as w } from "../../config/list-model.mjs";
|
|
17
|
+
const Ne = { class: "table-main" }, Oe = { class: "table-main-pagination" }, Ze = /* @__PURE__ */ me({
|
|
17
18
|
__name: "TableMain",
|
|
18
19
|
props: /* @__PURE__ */ G({
|
|
19
20
|
showPager: { type: Boolean, default: !0 },
|
|
@@ -37,180 +38,197 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue
|
|
|
37
38
|
isAutoRefreshModifiers: {}
|
|
38
39
|
}),
|
|
39
40
|
emits: /* @__PURE__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
40
|
-
setup(
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
setup(f, { expose: Q, emit: X }) {
|
|
42
|
+
he((e) => ({
|
|
43
|
+
v16a9ca77: e.headerColor
|
|
43
44
|
}));
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const o = f, m = X, k = ve(f, "isAutoRefresh"), ee = ye(), S = u([]), _ = u(0), i = u(0), l = u(1), h = u(!1), P = u(!1), z = u([]), te = g(() => ({
|
|
46
|
+
columns: ze(o.columns),
|
|
47
|
+
selectedList: z.value,
|
|
48
|
+
currentPageList: S.value,
|
|
49
|
+
api: o.api,
|
|
50
|
+
query: o.query || {},
|
|
51
|
+
total: _.value,
|
|
52
|
+
hasSelection: o.columns.some((e) => e.type === "selection")
|
|
53
|
+
})), H = u(0), oe = (e) => {
|
|
54
|
+
H.value = e;
|
|
55
|
+
}, N = be(), re = Ce(
|
|
56
|
+
He,
|
|
48
57
|
500
|
|
49
|
-
),
|
|
50
|
-
var
|
|
51
|
-
if (
|
|
52
|
-
const e = (
|
|
58
|
+
), O = g(() => o.showPager ? 35 : 0), A = g(() => {
|
|
59
|
+
var a, x;
|
|
60
|
+
if (o.showToolbar === !1) return !1;
|
|
61
|
+
const e = (a = o.toolbar) == null ? void 0 : a.leftFeatures, t = (x = o.toolbar) == null ? void 0 : x.rightFeatures;
|
|
53
62
|
return e === void 0 || e.length > 0 || t === void 0 || t.length > 0;
|
|
54
|
-
}),
|
|
55
|
-
() =>
|
|
56
|
-
),
|
|
57
|
-
const { maxHeight: e, refine: t } =
|
|
63
|
+
}), L = g(
|
|
64
|
+
() => A.value ? H.value : 0
|
|
65
|
+
), ae = g(() => {
|
|
66
|
+
const { maxHeight: e, refine: t } = o;
|
|
58
67
|
return e ? Math.max(
|
|
59
|
-
e -
|
|
68
|
+
e - O.value - L.value,
|
|
60
69
|
200
|
|
61
70
|
) : t ? Math.max(
|
|
62
|
-
|
|
71
|
+
re.value - O.value - L.value - o.refineReduceHeight,
|
|
63
72
|
200
|
|
64
73
|
) : void 0;
|
|
65
|
-
}),
|
|
66
|
-
const e = U(
|
|
67
|
-
return
|
|
74
|
+
}), E = g(() => {
|
|
75
|
+
const e = U(o.query || {});
|
|
76
|
+
return W(e, w.PAGE_SIZE_KEY, i.value), W(
|
|
68
77
|
e,
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
w.CURRENT_PAGE_KEY,
|
|
79
|
+
l.value
|
|
71
80
|
), e;
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
}), ne = g(() => {
|
|
82
|
+
var t;
|
|
83
|
+
const e = (t = o.tableProps) == null ? void 0 : t.onSelectionChange;
|
|
84
|
+
return {
|
|
85
|
+
...o.tableProps,
|
|
86
|
+
...ee,
|
|
87
|
+
/** 合并内部选中存储与外部 onSelectionChange */
|
|
88
|
+
onSelectionChange: (a) => {
|
|
89
|
+
z.value = a, e == null || e(a);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}), K = (e, t = !0) => {
|
|
93
|
+
const a = JSON.stringify(e) === JSON.stringify(E.value);
|
|
94
|
+
return !a && t && console.warn(
|
|
78
95
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
79
96
|
e
|
|
80
|
-
)} => ${JSON.stringify(
|
|
81
|
-
),
|
|
97
|
+
)} => ${JSON.stringify(E.value)}`
|
|
98
|
+
), a;
|
|
82
99
|
}, j = (e = !1) => {
|
|
83
100
|
if (!i.value) return;
|
|
84
|
-
|
|
85
|
-
const t = U(
|
|
86
|
-
return
|
|
87
|
-
K(t, !1) && (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
101
|
+
h.value ? console.warn("请求并发") : h.value = !0, e || (P.value = !0);
|
|
102
|
+
const t = U(E.value);
|
|
103
|
+
return o.api(t).then((a) => {
|
|
104
|
+
K(t, !1) && (S.value = Z(
|
|
105
|
+
a,
|
|
106
|
+
w.LIST_KEY
|
|
107
|
+
), _.value = Z(
|
|
108
|
+
a,
|
|
109
|
+
w.TOTAL_KEY
|
|
110
|
+
), m("pageInfoChange", {
|
|
94
111
|
pageSize: i.value,
|
|
95
|
-
currentPage:
|
|
96
|
-
total:
|
|
112
|
+
currentPage: l.value,
|
|
113
|
+
total: _.value
|
|
97
114
|
}));
|
|
98
115
|
}).finally(() => {
|
|
99
|
-
K(t) && (
|
|
116
|
+
K(t) && (h.value = !1, P.value = !1);
|
|
100
117
|
});
|
|
101
118
|
}, B = async (e = !1) => {
|
|
102
119
|
var t;
|
|
103
120
|
return (t = j(e)) == null ? void 0 : t.catch(() => {
|
|
104
121
|
});
|
|
105
|
-
},
|
|
106
|
-
if (
|
|
122
|
+
}, le = async (e = !1) => {
|
|
123
|
+
if (l.value === 1)
|
|
107
124
|
return B(e);
|
|
108
|
-
|
|
109
|
-
},
|
|
125
|
+
l.value = 1;
|
|
126
|
+
}, se = (e) => e, v = {
|
|
110
127
|
refresh: B,
|
|
111
|
-
reload:
|
|
112
|
-
getTableInstance: () =>
|
|
113
|
-
},
|
|
114
|
-
...
|
|
115
|
-
injectInfo:
|
|
128
|
+
reload: le,
|
|
129
|
+
getTableInstance: () => N.value
|
|
130
|
+
}, M = (e, t = []) => ({
|
|
131
|
+
...D(e, ["render", "headerRender"].concat(t)),
|
|
132
|
+
injectInfo: o.injectInfo || {},
|
|
116
133
|
exposeInfo: v
|
|
117
|
-
}),
|
|
118
|
-
...
|
|
119
|
-
injectInfo:
|
|
134
|
+
}), J = (e) => ({
|
|
135
|
+
...D(e, ["render", "headerRender"]),
|
|
136
|
+
injectInfo: o.injectInfo || {},
|
|
120
137
|
exposeInfo: v
|
|
121
138
|
});
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
i.value = e,
|
|
125
|
-
},
|
|
126
|
-
return
|
|
127
|
-
i.value =
|
|
139
|
+
Q(v);
|
|
140
|
+
const ie = (e) => {
|
|
141
|
+
i.value = e, l.value = 1;
|
|
142
|
+
}, V = (e) => !e || e === "expand";
|
|
143
|
+
return Se(() => {
|
|
144
|
+
i.value = o.pageSizeInit, _e(() => {
|
|
128
145
|
v.refresh();
|
|
129
146
|
});
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
() =>
|
|
147
|
+
}), d(S, (e) => {
|
|
148
|
+
m("dataChange", e);
|
|
149
|
+
}), d(
|
|
150
|
+
() => o.query,
|
|
134
151
|
(e, t) => {
|
|
135
|
-
JSON.stringify(e) !== JSON.stringify(t) && (
|
|
152
|
+
JSON.stringify(e) !== JSON.stringify(t) && (l.value = 1);
|
|
136
153
|
}
|
|
137
|
-
),
|
|
138
|
-
|
|
154
|
+
), d(
|
|
155
|
+
E,
|
|
139
156
|
(e, t) => {
|
|
140
157
|
JSON.stringify(e) !== JSON.stringify(t) && j();
|
|
141
158
|
},
|
|
142
159
|
{
|
|
143
160
|
immediate: !0
|
|
144
161
|
}
|
|
145
|
-
),
|
|
146
|
-
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
}),
|
|
150
|
-
|
|
162
|
+
), d(P, (e) => {
|
|
163
|
+
m("loadingChange", e);
|
|
164
|
+
}), d(i, (e) => {
|
|
165
|
+
m("pageSizeChange", e);
|
|
166
|
+
}), d(l, (e) => {
|
|
167
|
+
m("pageChange", e);
|
|
151
168
|
}), (e, t) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
|
|
169
|
+
const a = ge, x = ce, ue = pe, fe = de;
|
|
170
|
+
return s(), y("div", Ne, [
|
|
171
|
+
n(A) ? (s(), b(n(ke), {
|
|
155
172
|
key: 0,
|
|
156
|
-
onHeightChange:
|
|
173
|
+
onHeightChange: oe
|
|
157
174
|
}, {
|
|
158
175
|
default: C(() => [
|
|
159
|
-
|
|
160
|
-
"is-auto-refresh":
|
|
161
|
-
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) =>
|
|
176
|
+
I(Re, c({
|
|
177
|
+
"is-auto-refresh": k.value,
|
|
178
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => k.value = r),
|
|
162
179
|
tableExpose: v,
|
|
163
|
-
loading:
|
|
164
|
-
|
|
180
|
+
loading: n(h),
|
|
181
|
+
exportContext: n(te)
|
|
182
|
+
}, o.toolbar), null, 16, ["is-auto-refresh", "loading", "exportContext"])
|
|
165
183
|
]),
|
|
166
184
|
_: 1
|
|
167
|
-
})) :
|
|
168
|
-
|
|
185
|
+
})) : Ee("", !0),
|
|
186
|
+
I(ue, c({
|
|
169
187
|
ref_key: "elTable",
|
|
170
|
-
ref:
|
|
188
|
+
ref: N,
|
|
171
189
|
class: "table-main-table",
|
|
172
190
|
stripe: "",
|
|
173
191
|
border: "",
|
|
174
192
|
highlightCurrentRow: ""
|
|
175
|
-
},
|
|
176
|
-
maxHeight:
|
|
177
|
-
data:
|
|
178
|
-
rowKey:
|
|
193
|
+
}, n(ne), {
|
|
194
|
+
maxHeight: n(ae),
|
|
195
|
+
data: n(S),
|
|
196
|
+
rowKey: se(f.rowKey)
|
|
179
197
|
}), {
|
|
180
198
|
empty: C(() => [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
], 64)) : (
|
|
199
|
+
n(h) ? (s(), y(T, { key: 0 }, [
|
|
200
|
+
R("加载中...")
|
|
201
|
+
], 64)) : (s(), b(x, { key: 1 }))
|
|
184
202
|
]),
|
|
185
203
|
default: C(() => [
|
|
186
|
-
(
|
|
204
|
+
(s(!0), y(T, null, xe(f.columns, (r) => (s(), b(a, c({
|
|
187
205
|
key: r.columnKey || r.prop
|
|
188
|
-
}, { ref_for: !0 }, r),
|
|
189
|
-
|
|
206
|
+
}, { ref_for: !0 }, r), Te({ _: 2 }, [
|
|
207
|
+
V(r.type) ? {
|
|
190
208
|
name: "default",
|
|
191
|
-
fn: C((
|
|
192
|
-
|
|
193
|
-
r.render ? (
|
|
209
|
+
fn: C((p) => [
|
|
210
|
+
$(e.$slots, r.prop, c({ ref_for: !0 }, M(p)), () => [
|
|
211
|
+
r.render ? (s(), b(Y(r.render), c({
|
|
194
212
|
key: 0,
|
|
195
213
|
ref_for: !0
|
|
196
|
-
},
|
|
197
|
-
_index:
|
|
198
|
-
}), null, 16, ["_index"])) : (
|
|
199
|
-
|
|
214
|
+
}, M(p, ["$index"]), {
|
|
215
|
+
_index: p.$index
|
|
216
|
+
}), null, 16, ["_index"])) : (s(), y(T, { key: 1 }, [
|
|
217
|
+
R(q(p.row[r.prop]), 1)
|
|
200
218
|
], 64))
|
|
201
219
|
], !0)
|
|
202
220
|
]),
|
|
203
221
|
key: "0"
|
|
204
222
|
} : void 0,
|
|
205
|
-
|
|
223
|
+
V(r.type) ? {
|
|
206
224
|
name: "header",
|
|
207
|
-
fn: C((
|
|
208
|
-
|
|
209
|
-
r.headerRender ? (
|
|
225
|
+
fn: C((p) => [
|
|
226
|
+
$(e.$slots, `header-${r.prop}`, c({ ref_for: !0 }, J(p)), () => [
|
|
227
|
+
r.headerRender ? (s(), b(Y(r.headerRender), c({
|
|
210
228
|
key: 0,
|
|
211
229
|
ref_for: !0
|
|
212
|
-
},
|
|
213
|
-
|
|
230
|
+
}, J(p)), null, 16)) : (s(), y(T, { key: 1 }, [
|
|
231
|
+
R(q(r.label), 1)
|
|
214
232
|
], 64))
|
|
215
233
|
], !0)
|
|
216
234
|
]),
|
|
@@ -220,26 +238,26 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue
|
|
|
220
238
|
]),
|
|
221
239
|
_: 3
|
|
222
240
|
}, 16, ["maxHeight", "data", "rowKey"]),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"current-page":
|
|
226
|
-
"onUpdate:currentPage": t[1] || (t[1] = (r) => F(
|
|
227
|
-
"page-size":
|
|
241
|
+
we(Pe("div", Oe, [
|
|
242
|
+
I(fe, {
|
|
243
|
+
"current-page": n(l),
|
|
244
|
+
"onUpdate:currentPage": t[1] || (t[1] = (r) => F(l) ? l.value = r : null),
|
|
245
|
+
"page-size": n(i),
|
|
228
246
|
"onUpdate:pageSize": t[2] || (t[2] = (r) => F(i) ? i.value = r : null),
|
|
229
|
-
"page-sizes":
|
|
247
|
+
"page-sizes": f.pageSizeOptions,
|
|
230
248
|
size: "small",
|
|
231
249
|
background: "",
|
|
232
|
-
layout:
|
|
233
|
-
total:
|
|
234
|
-
onSizeChange:
|
|
250
|
+
layout: f.pageLayout,
|
|
251
|
+
total: n(_),
|
|
252
|
+
onSizeChange: ie
|
|
235
253
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
236
254
|
], 512), [
|
|
237
|
-
[
|
|
255
|
+
[Ie, f.showPager]
|
|
238
256
|
])
|
|
239
257
|
]);
|
|
240
258
|
};
|
|
241
259
|
}
|
|
242
260
|
});
|
|
243
261
|
export {
|
|
244
|
-
|
|
262
|
+
Ze as default
|
|
245
263
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TableToolbar.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-760501d0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,75 +1,126 @@
|
|
|
1
|
-
import { ElDropdown as
|
|
1
|
+
import { ElDropdown as _, ElButton as D, ElIcon as V, ElDropdownMenu as T, ElDropdownItem as $ } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/es/components/dropdown/style/css";
|
|
4
4
|
import "element-plus/es/components/dropdown-menu/style/css";
|
|
5
5
|
import "element-plus/es/components/dropdown-item/style/css";
|
|
6
6
|
import "element-plus/es/components/button/style/css";
|
|
7
7
|
import "element-plus/es/components/icon/style/css";
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
8
|
+
import { defineComponent as L, useModel as N, computed as b, ref as y, watch as z, openBlock as f, createElementBlock as P, createElementVNode as F, createBlock as h, withCtx as r, createVNode as n, createTextVNode as v, unref as B, createCommentVNode as w, normalizeClass as S, mergeModels as U } from "vue";
|
|
9
|
+
import { ElMessageBox as X, ElMessage as q } from "element-plus";
|
|
10
|
+
import { ArrowDown as O, Refresh as j } from "@element-plus/icons-vue";
|
|
11
|
+
import G from "../misc/AutoRefresh.vue.mjs";
|
|
12
|
+
import { countAll as H, fetchListAll as k } from "../../helpers/list-helper.mjs";
|
|
13
|
+
import { EXPORT_MAX_LIMIT as c, exportCSV as J } from "../../utils/export.mjs";
|
|
14
|
+
const K = { class: "table-toolbar" }, Q = { class: "table-toolbar-left" }, W = { class: "table-toolbar-right" }, me = /* @__PURE__ */ L({
|
|
12
15
|
__name: "TableToolbar",
|
|
13
16
|
props: /* @__PURE__ */ U({
|
|
14
|
-
leftFeatures: {},
|
|
15
|
-
rightFeatures: {},
|
|
17
|
+
leftFeatures: { default: () => ["export"] },
|
|
18
|
+
rightFeatures: { default: () => ["refresh", "autoRefresh"] },
|
|
16
19
|
refreshInterval: { default: 30 },
|
|
20
|
+
exportByFe: { type: Boolean, default: !0 },
|
|
17
21
|
exportFn: {},
|
|
18
22
|
tableExpose: {},
|
|
19
|
-
loading: { type: Boolean }
|
|
23
|
+
loading: { type: Boolean },
|
|
24
|
+
exportContext: {}
|
|
20
25
|
}, {
|
|
21
26
|
isAutoRefresh: { type: Boolean },
|
|
22
27
|
isAutoRefreshModifiers: {}
|
|
23
28
|
}),
|
|
24
29
|
emits: ["update:isAutoRefresh"],
|
|
25
|
-
setup(
|
|
26
|
-
const t =
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
setup(u) {
|
|
31
|
+
const t = u, g = N(u, "isAutoRefresh"), R = b(() => {
|
|
32
|
+
var o;
|
|
33
|
+
return (o = t.leftFeatures) == null ? void 0 : o.includes("export");
|
|
34
|
+
}), A = b(
|
|
29
35
|
() => t.rightFeatures === void 0 || t.rightFeatures.includes("refresh")
|
|
30
|
-
),
|
|
36
|
+
), C = b(
|
|
31
37
|
() => t.rightFeatures === void 0 || t.rightFeatures.includes("autoRefresh")
|
|
32
|
-
),
|
|
33
|
-
|
|
38
|
+
), E = y(30);
|
|
39
|
+
z(
|
|
34
40
|
() => t.refreshInterval,
|
|
35
|
-
(
|
|
36
|
-
|
|
41
|
+
(o) => {
|
|
42
|
+
E.value = o;
|
|
37
43
|
},
|
|
38
44
|
{ immediate: !0 }
|
|
39
45
|
);
|
|
40
|
-
const
|
|
41
|
-
|
|
46
|
+
const p = y(!1), M = async (o) => {
|
|
47
|
+
const { columns: e, selectedList: a, currentPageList: x, api: s, query: m } = t.exportContext;
|
|
48
|
+
let i;
|
|
49
|
+
switch (o) {
|
|
50
|
+
case "selected":
|
|
51
|
+
i = a;
|
|
52
|
+
break;
|
|
53
|
+
case "current":
|
|
54
|
+
i = x;
|
|
55
|
+
break;
|
|
56
|
+
case "all":
|
|
57
|
+
try {
|
|
58
|
+
const l = await H(s, m);
|
|
59
|
+
if (l > c) {
|
|
60
|
+
try {
|
|
61
|
+
await X.confirm(
|
|
62
|
+
`数据量超过 ${c} 条(共 ${l} 条),是否只导出前 ${c} 条?`,
|
|
63
|
+
"提示",
|
|
64
|
+
{
|
|
65
|
+
confirmButtonText: "导出",
|
|
66
|
+
cancelButtonText: "取消",
|
|
67
|
+
type: "warning"
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
} catch {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
i = await k(s, m, { limit: c });
|
|
74
|
+
} else
|
|
75
|
+
i = await k(s, m, { limit: c });
|
|
76
|
+
} catch (l) {
|
|
77
|
+
q.error(`导出失败:${(l == null ? void 0 : l.message) || (l == null ? void 0 : l.toString())}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
const d = `${document.title}-${Date.now()}`;
|
|
83
|
+
J({ columns: e, list: i, filename: d });
|
|
84
|
+
}, I = (o) => {
|
|
85
|
+
var a;
|
|
86
|
+
if (p.value) return;
|
|
87
|
+
p.value = !0;
|
|
88
|
+
const e = t.exportByFe ? M(o) : (a = t.exportFn) == null ? void 0 : a.call(t, o);
|
|
89
|
+
Promise.resolve(e).catch(() => {
|
|
42
90
|
}).finally(() => {
|
|
43
|
-
|
|
44
|
-
})
|
|
91
|
+
p.value = !1;
|
|
92
|
+
});
|
|
45
93
|
};
|
|
46
|
-
return (
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
94
|
+
return (o, e) => {
|
|
95
|
+
const a = V, x = D, s = $, m = T, i = _;
|
|
96
|
+
return f(), P("div", K, [
|
|
97
|
+
F("div", Q, [
|
|
98
|
+
R.value ? (f(), h(i, {
|
|
51
99
|
key: 0,
|
|
52
|
-
disabled:
|
|
53
|
-
onCommand:
|
|
100
|
+
disabled: !u.exportContext.total,
|
|
101
|
+
onCommand: I
|
|
54
102
|
}, {
|
|
55
|
-
dropdown:
|
|
56
|
-
|
|
57
|
-
default:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
103
|
+
dropdown: r(() => [
|
|
104
|
+
n(m, null, {
|
|
105
|
+
default: r(() => [
|
|
106
|
+
u.exportContext.hasSelection ? (f(), h(s, {
|
|
107
|
+
key: 0,
|
|
108
|
+
command: "selected"
|
|
109
|
+
}, {
|
|
110
|
+
default: r(() => [...e[4] || (e[4] = [
|
|
111
|
+
v(" 导出选择 ", -1)
|
|
61
112
|
])]),
|
|
62
113
|
_: 1
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
default:
|
|
66
|
-
|
|
114
|
+
})) : w("", !0),
|
|
115
|
+
n(s, { command: "current" }, {
|
|
116
|
+
default: r(() => [...e[5] || (e[5] = [
|
|
117
|
+
v("导出本页", -1)
|
|
67
118
|
])]),
|
|
68
119
|
_: 1
|
|
69
120
|
}),
|
|
70
|
-
|
|
71
|
-
default:
|
|
72
|
-
|
|
121
|
+
n(s, { command: "all" }, {
|
|
122
|
+
default: r(() => [...e[6] || (e[6] = [
|
|
123
|
+
v("导出全部", -1)
|
|
73
124
|
])]),
|
|
74
125
|
_: 1
|
|
75
126
|
})
|
|
@@ -77,17 +128,17 @@ const G = { class: "table-toolbar" }, H = { class: "table-toolbar-left" }, J = {
|
|
|
77
128
|
_: 1
|
|
78
129
|
})
|
|
79
130
|
]),
|
|
80
|
-
default:
|
|
81
|
-
|
|
131
|
+
default: r(() => [
|
|
132
|
+
n(x, {
|
|
82
133
|
size: "small",
|
|
83
134
|
type: "primary",
|
|
84
|
-
loading:
|
|
135
|
+
loading: p.value
|
|
85
136
|
}, {
|
|
86
|
-
default:
|
|
87
|
-
e[3] || (e[3] =
|
|
88
|
-
|
|
89
|
-
default:
|
|
90
|
-
|
|
137
|
+
default: r(() => [
|
|
138
|
+
e[3] || (e[3] = v(" 导出 ", -1)),
|
|
139
|
+
n(a, null, {
|
|
140
|
+
default: r(() => [
|
|
141
|
+
n(B(O))
|
|
91
142
|
]),
|
|
92
143
|
_: 1
|
|
93
144
|
})
|
|
@@ -96,41 +147,41 @@ const G = { class: "table-toolbar" }, H = { class: "table-toolbar-left" }, J = {
|
|
|
96
147
|
}, 8, ["loading"])
|
|
97
148
|
]),
|
|
98
149
|
_: 1
|
|
99
|
-
}, 8, ["disabled"])) :
|
|
150
|
+
}, 8, ["disabled"])) : w("", !0)
|
|
100
151
|
]),
|
|
101
|
-
|
|
102
|
-
|
|
152
|
+
F("div", W, [
|
|
153
|
+
C.value ? (f(), h(G, {
|
|
103
154
|
key: 0,
|
|
104
|
-
modelValue:
|
|
105
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
106
|
-
interval:
|
|
107
|
-
"onUpdate:interval": e[1] || (e[1] = (
|
|
155
|
+
modelValue: g.value,
|
|
156
|
+
"onUpdate:modelValue": e[0] || (e[0] = (d) => g.value = d),
|
|
157
|
+
interval: E.value,
|
|
158
|
+
"onUpdate:interval": e[1] || (e[1] = (d) => E.value = d),
|
|
108
159
|
refreshFn: t.tableExpose.refresh,
|
|
109
|
-
enabled: !
|
|
110
|
-
}, null, 8, ["modelValue", "interval", "refreshFn", "enabled"])) :
|
|
111
|
-
|
|
160
|
+
enabled: !u.loading
|
|
161
|
+
}, null, 8, ["modelValue", "interval", "refreshFn", "enabled"])) : w("", !0),
|
|
162
|
+
A.value ? (f(), h(x, {
|
|
112
163
|
key: 1,
|
|
113
164
|
size: "small",
|
|
114
165
|
circle: "",
|
|
115
|
-
onClick: e[2] || (e[2] = (
|
|
166
|
+
onClick: e[2] || (e[2] = (d) => t.tableExpose.refresh())
|
|
116
167
|
}, {
|
|
117
|
-
default:
|
|
118
|
-
|
|
119
|
-
class:
|
|
168
|
+
default: r(() => [
|
|
169
|
+
n(a, {
|
|
170
|
+
class: S({ "table-toolbar-icon--rotating": u.loading })
|
|
120
171
|
}, {
|
|
121
|
-
default:
|
|
122
|
-
|
|
172
|
+
default: r(() => [
|
|
173
|
+
n(B(j))
|
|
123
174
|
]),
|
|
124
175
|
_: 1
|
|
125
176
|
}, 8, ["class"])
|
|
126
177
|
]),
|
|
127
178
|
_: 1
|
|
128
|
-
})) :
|
|
179
|
+
})) : w("", !0)
|
|
129
180
|
])
|
|
130
181
|
]);
|
|
131
182
|
};
|
|
132
183
|
}
|
|
133
184
|
});
|
|
134
185
|
export {
|
|
135
|
-
|
|
186
|
+
me as default
|
|
136
187
|
};
|
|
@@ -1,61 +1,57 @@
|
|
|
1
|
-
async function A(
|
|
2
|
-
var
|
|
3
|
-
const i = (e == null ? void 0 : e.pageSize) ?? 200,
|
|
1
|
+
async function A(r, n, e) {
|
|
2
|
+
var o;
|
|
3
|
+
const i = (e == null ? void 0 : e.pageSize) ?? 200, a = (e == null ? void 0 : e.limit) ?? 1e4;
|
|
4
4
|
if (i < 1 || i > 1e3)
|
|
5
5
|
throw new Error(
|
|
6
6
|
`fetchListAll: pageSize 必须在 [1, 1000] 范围内(实际 ${i})`
|
|
7
7
|
);
|
|
8
8
|
const t = [];
|
|
9
|
-
let
|
|
9
|
+
let c = 1;
|
|
10
10
|
for (; ; ) {
|
|
11
|
-
const
|
|
12
|
-
...
|
|
13
|
-
page: { page:
|
|
14
|
-
}, l = await
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
`fetchListAll 超出上限 ${r}(实际 totalRecord=${g}),请手动分页或质疑工具适用性`
|
|
18
|
-
);
|
|
19
|
-
if (t.push(...p), p.length < i || t.length >= g) break;
|
|
20
|
-
n += 1;
|
|
11
|
+
const s = {
|
|
12
|
+
...n,
|
|
13
|
+
page: { page: c, pageSize: i }
|
|
14
|
+
}, l = await r(s), g = l.items, p = ((o = l.page) == null ? void 0 : o.totalRecord) ?? 0;
|
|
15
|
+
if (t.push(...g), t.length >= a || g.length < i || t.length >= p) break;
|
|
16
|
+
c += 1;
|
|
21
17
|
}
|
|
22
|
-
return t;
|
|
18
|
+
return t.slice(0, a);
|
|
23
19
|
}
|
|
24
|
-
function f(
|
|
25
|
-
return async (
|
|
26
|
-
const e =
|
|
20
|
+
function f(r) {
|
|
21
|
+
return async (n) => {
|
|
22
|
+
const e = n.page;
|
|
27
23
|
if (!e)
|
|
28
24
|
throw new Error("createListApi: params.page 必填(含 page / pageSize)");
|
|
29
|
-
const { page: i, pageSize:
|
|
30
|
-
if (!
|
|
25
|
+
const { page: i, pageSize: a } = e;
|
|
26
|
+
if (!a || a <= 0)
|
|
31
27
|
throw new Error("createListApi: pageSize 必须 > 0");
|
|
32
28
|
let t;
|
|
33
|
-
if (Array.isArray(
|
|
34
|
-
t =
|
|
29
|
+
if (Array.isArray(r))
|
|
30
|
+
t = r;
|
|
35
31
|
else {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const l = await
|
|
32
|
+
const s = r();
|
|
33
|
+
if (s instanceof Promise) {
|
|
34
|
+
const l = await s;
|
|
39
35
|
if (!Array.isArray(l))
|
|
40
36
|
throw new Error("createListApi: 异步 source 返回值必须为数组");
|
|
41
37
|
t = l;
|
|
42
38
|
} else
|
|
43
|
-
t =
|
|
39
|
+
t = s;
|
|
44
40
|
}
|
|
45
|
-
const
|
|
41
|
+
const c = (i - 1) * a, o = c + a;
|
|
46
42
|
return {
|
|
47
|
-
items: t.slice(
|
|
43
|
+
items: t.slice(c, o),
|
|
48
44
|
page: {
|
|
49
45
|
totalRecord: t.length,
|
|
50
|
-
pageSize:
|
|
51
|
-
totalPage: Math.ceil(t.length /
|
|
46
|
+
pageSize: a,
|
|
47
|
+
totalPage: Math.ceil(t.length / a)
|
|
52
48
|
}
|
|
53
49
|
};
|
|
54
50
|
};
|
|
55
51
|
}
|
|
56
|
-
function h(
|
|
57
|
-
return
|
|
58
|
-
...
|
|
52
|
+
function h(r, n) {
|
|
53
|
+
return r({
|
|
54
|
+
...n,
|
|
59
55
|
page: { page: 1, pageSize: 1 }
|
|
60
56
|
}).then((e) => e.page.totalRecord);
|
|
61
57
|
}
|
package/es/index.mjs
CHANGED
|
@@ -5,41 +5,42 @@ import { miscInstall as a } from "./components/misc/index.mjs";
|
|
|
5
5
|
import { modalInstall as m } from "./components/modal/index.mjs";
|
|
6
6
|
import { tableInstall as f } from "./components/table/index.mjs";
|
|
7
7
|
import { listPageInstall as s } from "./components/list-page/index.mjs";
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
8
|
+
import { default as T } from "./components/modal/DetailModal.vue.mjs";
|
|
9
|
+
import { default as g } from "./components/form/FormDateTimeRange.vue.mjs";
|
|
10
10
|
import { default as R } from "./components/form/FormMain.vue.mjs";
|
|
11
11
|
import { default as C } from "./components/form/FormRadio.vue.mjs";
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
12
|
+
import { default as L } from "./components/form/FormRadioGroup.vue.mjs";
|
|
13
|
+
import { default as S } from "./components/form/FormSelect.vue.mjs";
|
|
14
|
+
import { default as D } from "./components/form/FormTree.vue.mjs";
|
|
15
15
|
import { default as h } from "./components/form/FormVerifyCode.vue.mjs";
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
16
|
+
import { default as N } from "./components/menu/MenuItemSub.vue.mjs";
|
|
17
|
+
import { default as V } from "./components/menu/MenuTree.vue.mjs";
|
|
18
18
|
import { default as v } from "./components/display/TabsMain.vue.mjs";
|
|
19
19
|
import { default as H } from "./components/misc/TriggerAutoImport.vue.mjs";
|
|
20
20
|
import { default as W } from "./components/display/WatchSize.vue.mjs";
|
|
21
21
|
import { APP_API_LIST_MODEL_KEY_CONFIG as B } from "./config/list-model.mjs";
|
|
22
|
-
import { default as
|
|
23
|
-
import { BODY_CONTENT_VIEWPORT_HEIGHT as
|
|
24
|
-
import { default as
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
22
|
+
import { default as Y } from "./components/misc/AutoRefresh.vue.mjs";
|
|
23
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as Q } from "./inject/key.mjs";
|
|
24
|
+
import { default as q } from "./components/modal/ConfirmModal.vue.mjs";
|
|
25
|
+
import { EXPORT_MAX_LIMIT as Z, OPERATE_COLUMN_PROP as $, exportCSV as ee, pickExportColumns as te } from "./utils/export.mjs";
|
|
26
|
+
import { FORM_CONFIG_SELECT_ALL_VALUE as re, getConfirmPasswordRule as ae, passwordRule as me, setFormComponentType as fe } from "./helpers/form.mjs";
|
|
27
|
+
import { FORM_ITEM_CHANGE_LOADING as le, generateFormData as ue, getBlurSubmit as pe, getChangeSubmit as ie, getEnterSubmit as ne, getPlaceholder as xe, getVModelSugar as de, parseFormData as Ie, setInputComponent as ce, setSelectComponent as Ee, stringifyFormData as Te, swiftFormItemConfig as _e } from "./components/form/utils.mjs";
|
|
28
|
+
import { default as Me } from "./components/form/FormSearch.vue.mjs";
|
|
28
29
|
import { default as Fe } from "./components/form/FormVerifyImage.vue.mjs";
|
|
29
|
-
import { default as
|
|
30
|
-
import { ROUTE_MODULE_LEVEL as
|
|
31
|
-
import { default as
|
|
32
|
-
import { countAll as
|
|
33
|
-
import { createGenerateRouteMetaRawTree as
|
|
34
|
-
import { createStorageWithNamespace as
|
|
35
|
-
import { createUseState as
|
|
36
|
-
import { flatRouteMetaResolveRaw as
|
|
37
|
-
import { getId as
|
|
38
|
-
import { timeCountDown as
|
|
39
|
-
import { useActivated as
|
|
40
|
-
import { useFeelSize as
|
|
41
|
-
import { useMenusDataDispatch as
|
|
42
|
-
import { useTimeout as
|
|
30
|
+
import { default as Ae } from "./components/list-page/ListPage.vue.mjs";
|
|
31
|
+
import { ROUTE_MODULE_LEVEL as Oe, TabsMainReplaceQueryKey as Se } from "./config/route.mjs";
|
|
32
|
+
import { default as De } from "./components/table/TableMain.vue.mjs";
|
|
33
|
+
import { countAll as he, createListApi as ye, fetchListAll as Ne } from "./helpers/list-helper.mjs";
|
|
34
|
+
import { createGenerateRouteMetaRawTree as Ve } from "./helpers/route.mjs";
|
|
35
|
+
import { createStorageWithNamespace as ve } from "./helpers/storage.mjs";
|
|
36
|
+
import { createUseState as He } from "./helpers/state.mjs";
|
|
37
|
+
import { flatRouteMetaResolveRaw as We, getRoutePermissionKey as ze } from "./utils/router.mjs";
|
|
38
|
+
import { getId as Xe } from "./utils/id.mjs";
|
|
39
|
+
import { timeCountDown as ke } from "./utils/time.mjs";
|
|
40
|
+
import { useActivated as je, useActivatedEvent as qe, useActivatedExec as Je } from "./hooks/activated.mjs";
|
|
41
|
+
import { useFeelSize as $e } from "./hooks/feel-size.mjs";
|
|
42
|
+
import { useMenusDataDispatch as tt } from "./hooks/menus-dispatch.mjs";
|
|
43
|
+
import { useTimeout as rt } from "./hooks/timeout.mjs";
|
|
43
44
|
const I = {
|
|
44
45
|
install(e) {
|
|
45
46
|
e.use(t), e.use(o), e.use(r), e.use(a), e.use(m), e.use(f), e.use(s);
|
|
@@ -47,66 +48,70 @@ const I = {
|
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
50
|
B as APP_API_LIST_MODEL_KEY_CONFIG,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Z as
|
|
55
|
-
re as
|
|
56
|
-
|
|
51
|
+
Y as AutoRefresh,
|
|
52
|
+
Q as BODY_CONTENT_VIEWPORT_HEIGHT,
|
|
53
|
+
q as ConfirmModal,
|
|
54
|
+
T as DetailModal,
|
|
55
|
+
Z as EXPORT_MAX_LIMIT,
|
|
56
|
+
re as FORM_CONFIG_SELECT_ALL_VALUE,
|
|
57
|
+
le as FORM_ITEM_CHANGE_LOADING,
|
|
58
|
+
g as FormDateTimeRange,
|
|
57
59
|
R as FormMain,
|
|
58
60
|
C as FormRadio,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
L as FormRadioGroup,
|
|
62
|
+
Me as FormSearch,
|
|
63
|
+
S as FormSelect,
|
|
64
|
+
D as FormTree,
|
|
63
65
|
h as FormVerifyCode,
|
|
64
66
|
Fe as FormVerifyImage,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
Ae as ListPage,
|
|
68
|
+
N as MenuItemSub,
|
|
69
|
+
V as MenuTree,
|
|
70
|
+
$ as OPERATE_COLUMN_PROP,
|
|
71
|
+
Oe as ROUTE_MODULE_LEVEL,
|
|
72
|
+
De as TableMain,
|
|
70
73
|
v as TabsMain,
|
|
71
|
-
|
|
74
|
+
Se as TabsMainReplaceQueryKey,
|
|
72
75
|
H as TriggerAutoImport,
|
|
73
76
|
W as WatchSize,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
he as countAll,
|
|
78
|
+
Ve as createGenerateRouteMetaRawTree,
|
|
79
|
+
ye as createListApi,
|
|
80
|
+
ve as createStorageWithNamespace,
|
|
81
|
+
He as createUseState,
|
|
79
82
|
r as displayInstall,
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
ee as exportCSV,
|
|
84
|
+
Ne as fetchListAll,
|
|
85
|
+
We as flatRouteMetaResolveRaw,
|
|
82
86
|
t as formInstall,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
ue as generateFormData,
|
|
88
|
+
pe as getBlurSubmit,
|
|
89
|
+
ie as getChangeSubmit,
|
|
90
|
+
ae as getConfirmPasswordRule,
|
|
91
|
+
ne as getEnterSubmit,
|
|
92
|
+
Xe as getId,
|
|
93
|
+
xe as getPlaceholder,
|
|
94
|
+
ze as getRoutePermissionKey,
|
|
95
|
+
de as getVModelSugar,
|
|
92
96
|
I as installComponents,
|
|
93
97
|
s as listPageInstall,
|
|
94
98
|
o as menuInstall,
|
|
95
99
|
a as miscInstall,
|
|
96
100
|
m as modalInstall,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
te as
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
Ie as parseFormData,
|
|
102
|
+
me as passwordRule,
|
|
103
|
+
te as pickExportColumns,
|
|
104
|
+
fe as setFormComponentType,
|
|
105
|
+
ce as setInputComponent,
|
|
106
|
+
Ee as setSelectComponent,
|
|
107
|
+
Te as stringifyFormData,
|
|
108
|
+
_e as swiftFormItemConfig,
|
|
104
109
|
f as tableInstall,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
ke as timeCountDown,
|
|
111
|
+
je as useActivated,
|
|
112
|
+
qe as useActivatedEvent,
|
|
113
|
+
Je as useActivatedExec,
|
|
114
|
+
$e as useFeelSize,
|
|
115
|
+
tt as useMenusDataDispatch,
|
|
116
|
+
rt as useTimeout
|
|
112
117
|
};
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-9d78ca06]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-9d78ca06]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-9d78ca06]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-
|
|
1
|
+
.form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-9d78ca06]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-9d78ca06]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-9d78ca06]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-760501d0]{display:flex;justify-content:space-between;align-items:center;padding-bottom:8px;gap:20px}.table-toolbar-left[data-v-760501d0],.table-toolbar-right[data-v-760501d0]{display:flex;align-items:center;gap:10px}.table-toolbar-icon--rotating[data-v-760501d0]{animation:table-toolbar-rotating-760501d0 1s linear infinite}@keyframes table-toolbar-rotating-760501d0{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-f0f7753c]{--el-table-header-bg-color: var(--v16a9ca77)}.table-main-pagination[data-v-f0f7753c]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-182577bf]{min-height:var(--ad28a056)}.list-page-header[data-v-182577bf],.list-page-operation[data-v-182577bf]{margin-bottom:10px}.list-page[data-v-182577bf] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const f = "OPERATE", E = 1e4, O = (t) => t.filter((e) => !(!e.prop || e.prop === f || e.type && e.type !== "default")).map((e) => ({
|
|
2
|
+
prop: e.prop,
|
|
3
|
+
label: e.label
|
|
4
|
+
})), b = "\uFEFF", R = ({
|
|
5
|
+
columns: t,
|
|
6
|
+
list: e,
|
|
7
|
+
filename: p = "导出数据"
|
|
8
|
+
}) => {
|
|
9
|
+
const c = t.map((n) => n.label).join(","), s = e.map(
|
|
10
|
+
(n) => t.map((u) => {
|
|
11
|
+
const i = n[u.prop] ?? "";
|
|
12
|
+
return `"${String(i).replace(/"/g, '""')}"`;
|
|
13
|
+
}).join(",")
|
|
14
|
+
), a = b + [c, ...s].join(`
|
|
15
|
+
`), l = new Blob([a], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(l), r = document.createElement("a");
|
|
16
|
+
r.href = o, r.download = `${p}.csv`, r.click(), URL.revokeObjectURL(o);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
E as EXPORT_MAX_LIMIT,
|
|
20
|
+
f as OPERATE_COLUMN_PROP,
|
|
21
|
+
R as exportCSV,
|
|
22
|
+
O as pickExportColumns
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/admin-core",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.3",
|
|
4
4
|
"description": "后台管理核心",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"node": ">=18.0.0",
|
|
78
78
|
"pnpm": ">=9.0.0"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "53e17b4c1d1e64d8b48e85207fc7680109e75809"
|
|
81
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, TableMainInstance } from './types';
|
|
1
|
+
import { ExportType, TableExportContext, TableMainInstance, TableToolbarLeftFeature, TableToolbarRightFeature } from './types';
|
|
2
2
|
|
|
3
3
|
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
4
4
|
isAutoRefresh: import('vue').PropType<boolean>;
|
|
@@ -8,14 +8,20 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
8
8
|
};
|
|
9
9
|
leftFeatures: {
|
|
10
10
|
type: globalThis.PropType<"export"[]>;
|
|
11
|
+
default: () => TableToolbarLeftFeature[];
|
|
11
12
|
};
|
|
12
13
|
rightFeatures: {
|
|
13
|
-
type: globalThis.PropType<
|
|
14
|
+
type: globalThis.PropType<TableToolbarRightFeature[]>;
|
|
15
|
+
default: () => TableToolbarRightFeature[];
|
|
14
16
|
};
|
|
15
17
|
refreshInterval: {
|
|
16
18
|
type: globalThis.PropType<number>;
|
|
17
19
|
default: number;
|
|
18
20
|
};
|
|
21
|
+
exportByFe: {
|
|
22
|
+
type: globalThis.PropType<boolean>;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
19
25
|
exportFn: {
|
|
20
26
|
type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
|
|
21
27
|
};
|
|
@@ -23,6 +29,10 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
23
29
|
type: globalThis.PropType<TableMainInstance>;
|
|
24
30
|
required: true;
|
|
25
31
|
};
|
|
32
|
+
exportContext: {
|
|
33
|
+
type: globalThis.PropType<TableExportContext>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
26
36
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
27
37
|
isAutoRefresh: import('vue').PropType<boolean>;
|
|
28
38
|
loading: {
|
|
@@ -31,14 +41,20 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
31
41
|
};
|
|
32
42
|
leftFeatures: {
|
|
33
43
|
type: globalThis.PropType<"export"[]>;
|
|
44
|
+
default: () => TableToolbarLeftFeature[];
|
|
34
45
|
};
|
|
35
46
|
rightFeatures: {
|
|
36
|
-
type: globalThis.PropType<
|
|
47
|
+
type: globalThis.PropType<TableToolbarRightFeature[]>;
|
|
48
|
+
default: () => TableToolbarRightFeature[];
|
|
37
49
|
};
|
|
38
50
|
refreshInterval: {
|
|
39
51
|
type: globalThis.PropType<number>;
|
|
40
52
|
default: number;
|
|
41
53
|
};
|
|
54
|
+
exportByFe: {
|
|
55
|
+
type: globalThis.PropType<boolean>;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
42
58
|
exportFn: {
|
|
43
59
|
type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
|
|
44
60
|
};
|
|
@@ -46,7 +62,14 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
46
62
|
type: globalThis.PropType<TableMainInstance>;
|
|
47
63
|
required: true;
|
|
48
64
|
};
|
|
65
|
+
exportContext: {
|
|
66
|
+
type: globalThis.PropType<TableExportContext>;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
49
69
|
}>> & Readonly<{}>, {
|
|
70
|
+
leftFeatures: TableToolbarLeftFeature[];
|
|
71
|
+
rightFeatures: TableToolbarRightFeature[];
|
|
50
72
|
refreshInterval: number;
|
|
73
|
+
exportByFe: boolean;
|
|
51
74
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
52
75
|
export default _default;
|
|
@@ -30,6 +30,23 @@ export type ExportType = "selected" | "current" | "all";
|
|
|
30
30
|
export type TableToolbarLeftFeature = "export";
|
|
31
31
|
/** toolbar 右侧功能 */
|
|
32
32
|
export type TableToolbarRightFeature = "refresh" | "autoRefresh";
|
|
33
|
+
/** TableMain 传给 toolbar 的导出上下文 */
|
|
34
|
+
export interface TableExportContext {
|
|
35
|
+
/** 可导出列 */
|
|
36
|
+
columns: Pick<ElTableColumnProps, "prop" | "label">[];
|
|
37
|
+
/** 选中行数据 */
|
|
38
|
+
selectedList: Record<string, any>[];
|
|
39
|
+
/** 当前页数据 */
|
|
40
|
+
currentPageList: Record<string, any>[];
|
|
41
|
+
/** 分页 API */
|
|
42
|
+
api: TableMainProps<any, any, any>["api"];
|
|
43
|
+
/** 静态查询参数 */
|
|
44
|
+
query: Record<string, any>;
|
|
45
|
+
/** 当前数据总数 */
|
|
46
|
+
total: number;
|
|
47
|
+
/** 是否包含 selection 列 */
|
|
48
|
+
hasSelection: boolean;
|
|
49
|
+
}
|
|
33
50
|
/** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
|
|
34
51
|
export interface TableToolbarConfig {
|
|
35
52
|
/**
|
|
@@ -46,7 +63,13 @@ export interface TableToolbarConfig {
|
|
|
46
63
|
rightFeatures?: TableToolbarRightFeature[];
|
|
47
64
|
/** 自动刷新默认间隔(秒),默认 30 */
|
|
48
65
|
refreshInterval?: number;
|
|
49
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* 是否由前端导出,默认 true。
|
|
68
|
+
* - true:toolbar 内部调 fetchListAll + exportCSV 完成导出
|
|
69
|
+
* - false:走 exportFn 回调
|
|
70
|
+
*/
|
|
71
|
+
exportByFe?: boolean;
|
|
72
|
+
/** 导出方法。传入导出类型,返回 Promise。exportByFe 为 false 时必传 */
|
|
50
73
|
exportFn?: (type: ExportType) => Promise<unknown>;
|
|
51
74
|
}
|
|
52
75
|
/** 表格列默认作用域 */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ElTableColumnProps } from '../components/table/types';
|
|
2
|
+
|
|
3
|
+
/** 操作列标记 prop。消费方以此值标记操作列,导出时自动过滤 */
|
|
4
|
+
export declare const OPERATE_COLUMN_PROP = "OPERATE";
|
|
5
|
+
/** 前端导出最大行数 */
|
|
6
|
+
export declare const EXPORT_MAX_LIMIT = 10000;
|
|
7
|
+
/** 导出列:从 ElTableColumnProps 中提取 prop、label、type */
|
|
8
|
+
export type ExportColumn = Pick<ElTableColumnProps, "prop" | "label" | "type">;
|
|
9
|
+
/** 导出参数 */
|
|
10
|
+
export interface ExportOptions {
|
|
11
|
+
columns: ExportColumn[];
|
|
12
|
+
list: Record<string, any>[];
|
|
13
|
+
filename?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 从表格列配置中提取可导出列
|
|
17
|
+
* ---
|
|
18
|
+
* 过滤规则:排除 type 为 selection / index / expand 的列(除 default 外均排除),
|
|
19
|
+
* 排除 prop 为 OPERATE_COLUMN_PROP 的列,排除无 prop 的列
|
|
20
|
+
*/
|
|
21
|
+
export declare const pickExportColumns: <T extends Record<string, any>>(columns: ElTableColumnProps<T>[]) => ExportColumn[];
|
|
22
|
+
/** 导出 CSV 文件 */
|
|
23
|
+
export declare const exportCSV: ({ columns, list, filename, }: ExportOptions) => void;
|
package/types/utils/index.d.ts
CHANGED