@done-coding/admin-core 0.0.1-alpha.1 → 0.0.1-alpha.2
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/display/TabsMain.vue.mjs +61 -0
- package/es/components/display/TabsMain.vue2.mjs +4 -0
- package/es/components/display/index.mjs +9 -7
- package/es/components/form/FormDateTimeRange.vue.mjs +46 -0
- package/es/components/form/FormDateTimeRange.vue2.mjs +4 -0
- package/es/components/form/FormRadio.vue.mjs +69 -0
- package/es/components/form/FormRadio.vue2.mjs +4 -0
- package/es/components/form/index.mjs +29 -23
- package/es/components/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +102 -97
- package/es/components/misc/AutoRefresh.vue.mjs +7 -0
- package/es/components/misc/AutoRefresh.vue2.mjs +57 -0
- package/es/components/misc/index.mjs +7 -5
- package/es/components/table/TableMain.vue.mjs +3 -3
- package/es/components/table/TableMain.vue2.mjs +158 -121
- package/es/components/table/TableToolbar.vue.mjs +7 -0
- package/es/components/table/TableToolbar.vue2.mjs +75 -0
- package/es/config/route.mjs +3 -2
- package/es/helpers/list-helper.mjs +66 -0
- package/es/hooks/timeout.mjs +21 -0
- package/es/index.mjs +88 -73
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/components/display/TabsMain.vue.d.ts +52 -0
- package/types/components/display/index.d.ts +2 -1
- package/types/components/form/FormDateTimeRange.vue.d.ts +18 -0
- package/types/components/form/FormRadio.vue.d.ts +35 -0
- package/types/components/form/FormSearch.vue.d.ts +1 -1
- package/types/components/form/FormSelect.vue.d.ts +2 -6
- package/types/components/form/index.d.ts +3 -1
- package/types/components/form/types.d.ts +12 -0
- package/types/components/list-page/ListPage.vue.d.ts +2 -0
- package/types/components/misc/AutoRefresh.vue.d.ts +14 -0
- package/types/components/misc/index.d.ts +2 -1
- package/types/components/modal/ConfirmModal.vue.d.ts +1 -1
- package/types/components/table/TableMain.vue.d.ts +3 -1
- package/types/components/table/TableToolbar.vue.d.ts +43 -0
- package/types/components/table/types.d.ts +22 -2
- package/types/config/route.d.ts +2 -0
- package/types/helpers/index.d.ts +2 -0
- package/types/helpers/list-helper.d.ts +36 -0
- package/types/helpers/types.d.ts +15 -0
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/timeout.d.ts +7 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TableMain.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5944984b"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { ElTable as
|
|
1
|
+
import { ElTable as ue, ElTableColumn as fe, ElEmpty as ge, ElPagination as pe } 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
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
7
|
+
import { defineComponent as de, useCssVars as ce, useModel as me, useAttrs as he, ref as g, shallowRef as ve, inject as ye, computed as d, onMounted as be, onActivated as Ce, watch as c, openBlock as n, createElementBlock as y, unref as l, createBlock as b, withCtx as C, createVNode as I, mergeProps as p, createCommentVNode as Se, Fragment as _, renderList as _e, createSlots as Ee, renderSlot as J, resolveDynamicComponent as V, createTextVNode as R, toDisplayString as $, withDirectives as Te, createElementVNode as we, isRef as Y, vShow as xe, mergeModels as G } from "vue";
|
|
8
|
+
import U from "lodash/cloneDeep";
|
|
9
|
+
import q from "lodash/omit";
|
|
10
|
+
import D from "lodash/set";
|
|
11
|
+
import F from "lodash/get";
|
|
12
|
+
import Ie from "./TableToolbar.vue.mjs";
|
|
13
|
+
import Re from "../display/WatchSize.vue.mjs";
|
|
14
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as Pe } from "../../inject/key.mjs";
|
|
15
|
+
import { APP_API_LIST_MODEL_KEY_CONFIG as E } from "../../config/list-model.mjs";
|
|
16
|
+
const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe = /* @__PURE__ */ de({
|
|
15
17
|
__name: "TableMain",
|
|
16
|
-
props: {
|
|
18
|
+
props: /* @__PURE__ */ G({
|
|
17
19
|
showPager: { type: Boolean, default: !0 },
|
|
20
|
+
showToolbar: { type: Boolean, default: !0 },
|
|
21
|
+
toolbar: {},
|
|
18
22
|
query: {},
|
|
19
23
|
pageSizeInit: { default: 20 },
|
|
20
24
|
pageSizeOptions: { default: () => [10, 20, 30, 40] },
|
|
@@ -28,152 +32,185 @@ const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke
|
|
|
28
32
|
refine: { type: Boolean, default: !0 },
|
|
29
33
|
refineReduceHeight: { default: 0 },
|
|
30
34
|
injectInfo: {}
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
}, {
|
|
36
|
+
isAutoRefresh: { type: Boolean },
|
|
37
|
+
isAutoRefreshModifiers: {}
|
|
38
|
+
}),
|
|
39
|
+
emits: /* @__PURE__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
40
|
+
setup(i, { expose: W, emit: Z }) {
|
|
41
|
+
ce((e) => ({
|
|
42
|
+
v7c6ca44f: e.headerColor
|
|
36
43
|
}));
|
|
37
|
-
const a =
|
|
38
|
-
|
|
44
|
+
const a = i, m = Z, P = me(i, "isAutoRefresh"), Q = he(), T = g([]), w = g(0), s = g(0), o = g(1), h = g(!1), x = g(!1), O = g(0), X = (e) => {
|
|
45
|
+
O.value = e;
|
|
46
|
+
}, z = ve(), ee = ye(
|
|
47
|
+
Pe,
|
|
39
48
|
500
|
|
40
|
-
),
|
|
49
|
+
), H = d(() => a.showPager ? 35 : 0), N = d(() => {
|
|
50
|
+
var t;
|
|
51
|
+
if (a.showToolbar === !1) return !1;
|
|
52
|
+
const e = (t = a.toolbar) == null ? void 0 : t.features;
|
|
53
|
+
return e === void 0 || e.length > 0;
|
|
54
|
+
}), k = d(
|
|
55
|
+
() => N.value ? O.value : 0
|
|
56
|
+
), te = d(() => {
|
|
41
57
|
const { maxHeight: e, refine: t } = a;
|
|
42
|
-
return e ? Math.max(
|
|
43
|
-
|
|
58
|
+
return e ? Math.max(
|
|
59
|
+
e - H.value - k.value,
|
|
60
|
+
200
|
|
61
|
+
) : t ? Math.max(
|
|
62
|
+
ee.value - H.value - k.value - a.refineReduceHeight,
|
|
44
63
|
200
|
|
45
64
|
) : void 0;
|
|
46
|
-
}),
|
|
47
|
-
const e =
|
|
48
|
-
return
|
|
65
|
+
}), S = d(() => {
|
|
66
|
+
const e = U(a.query || {});
|
|
67
|
+
return D(e, E.PAGE_SIZE_KEY, s.value), D(
|
|
49
68
|
e,
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
E.CURRENT_PAGE_KEY,
|
|
70
|
+
o.value
|
|
52
71
|
), e;
|
|
53
|
-
}),
|
|
72
|
+
}), re = d(() => ({
|
|
54
73
|
...a.tableProps,
|
|
55
|
-
...
|
|
56
|
-
})),
|
|
57
|
-
const
|
|
58
|
-
return !
|
|
74
|
+
...Q
|
|
75
|
+
})), A = (e, t = !0) => {
|
|
76
|
+
const u = JSON.stringify(e) === JSON.stringify(S.value);
|
|
77
|
+
return !u && t && console.warn(
|
|
59
78
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
60
79
|
e
|
|
61
|
-
)} => ${JSON.stringify(
|
|
62
|
-
),
|
|
63
|
-
},
|
|
64
|
-
if (!
|
|
65
|
-
h.value ? console.warn("请求并发") : h.value = !0, e || (
|
|
66
|
-
const t =
|
|
67
|
-
a.api(t).then((
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
),
|
|
75
|
-
pageSize:
|
|
76
|
-
currentPage:
|
|
77
|
-
total:
|
|
80
|
+
)} => ${JSON.stringify(S.value)}`
|
|
81
|
+
), u;
|
|
82
|
+
}, K = (e = !1) => {
|
|
83
|
+
if (!s.value) return;
|
|
84
|
+
h.value ? console.warn("请求并发") : h.value = !0, e || (x.value = !0);
|
|
85
|
+
const t = U(S.value);
|
|
86
|
+
return a.api(t).then((u) => {
|
|
87
|
+
A(t, !1) && (T.value = F(
|
|
88
|
+
u,
|
|
89
|
+
E.LIST_KEY
|
|
90
|
+
), w.value = F(
|
|
91
|
+
u,
|
|
92
|
+
E.TOTAL_KEY
|
|
93
|
+
), m("pageInfoChange", {
|
|
94
|
+
pageSize: s.value,
|
|
95
|
+
currentPage: o.value,
|
|
96
|
+
total: w.value
|
|
78
97
|
}));
|
|
79
98
|
}).finally(() => {
|
|
80
|
-
|
|
99
|
+
A(t) && (h.value = !1, x.value = !1);
|
|
100
|
+
});
|
|
101
|
+
}, j = async (e = !1) => {
|
|
102
|
+
var t;
|
|
103
|
+
return (t = K(e)) == null ? void 0 : t.catch(() => {
|
|
81
104
|
});
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
refresh:
|
|
88
|
-
reload:
|
|
89
|
-
getTableInstance: () =>
|
|
90
|
-
},
|
|
91
|
-
...
|
|
105
|
+
}, ae = async (e = !1) => {
|
|
106
|
+
if (o.value === 1)
|
|
107
|
+
return j(e);
|
|
108
|
+
o.value = 1;
|
|
109
|
+
}, oe = (e) => e, v = {
|
|
110
|
+
refresh: j,
|
|
111
|
+
reload: ae,
|
|
112
|
+
getTableInstance: () => z.value
|
|
113
|
+
}, B = (e, t = []) => ({
|
|
114
|
+
...q(e, ["render", "headerRender"].concat(t)),
|
|
92
115
|
injectInfo: a.injectInfo || {},
|
|
93
116
|
exposeInfo: v
|
|
94
|
-
}),
|
|
95
|
-
...
|
|
117
|
+
}), L = (e) => ({
|
|
118
|
+
...q(e, ["render", "headerRender"]),
|
|
96
119
|
injectInfo: a.injectInfo || {},
|
|
97
120
|
exposeInfo: v
|
|
98
121
|
});
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
return
|
|
104
|
-
|
|
122
|
+
W(v);
|
|
123
|
+
const ne = (e) => {
|
|
124
|
+
s.value = e, o.value = 1;
|
|
125
|
+
}, M = (e) => !e || e === "expand";
|
|
126
|
+
return be(() => {
|
|
127
|
+
s.value = a.pageSizeInit, Ce(() => {
|
|
105
128
|
v.refresh();
|
|
106
129
|
});
|
|
107
|
-
}),
|
|
108
|
-
|
|
109
|
-
}),
|
|
130
|
+
}), c(T, (e) => {
|
|
131
|
+
m("dataChange", e);
|
|
132
|
+
}), c(
|
|
110
133
|
() => a.query,
|
|
111
134
|
(e, t) => {
|
|
112
|
-
JSON.stringify(e) !== JSON.stringify(t) && (
|
|
135
|
+
JSON.stringify(e) !== JSON.stringify(t) && (o.value = 1);
|
|
113
136
|
}
|
|
114
|
-
),
|
|
115
|
-
|
|
137
|
+
), c(
|
|
138
|
+
S,
|
|
116
139
|
(e, t) => {
|
|
117
|
-
JSON.stringify(e) !== JSON.stringify(t) &&
|
|
140
|
+
JSON.stringify(e) !== JSON.stringify(t) && K();
|
|
118
141
|
},
|
|
119
142
|
{
|
|
120
143
|
immediate: !0
|
|
121
144
|
}
|
|
122
|
-
),
|
|
123
|
-
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
|
|
145
|
+
), c(x, (e) => {
|
|
146
|
+
m("loadingChange", e);
|
|
147
|
+
}), c(s, (e) => {
|
|
148
|
+
m("pageSizeChange", e);
|
|
149
|
+
}), c(o, (e) => {
|
|
150
|
+
m("pageChange", e);
|
|
128
151
|
}), (e, t) => {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
|
|
152
|
+
const u = fe, le = ge, se = ue, ie = pe;
|
|
153
|
+
return n(), y("div", Oe, [
|
|
154
|
+
l(N) ? (n(), b(l(Re), {
|
|
155
|
+
key: 0,
|
|
156
|
+
onHeightChange: X
|
|
157
|
+
}, {
|
|
158
|
+
default: C(() => [
|
|
159
|
+
I(Ie, p({
|
|
160
|
+
"is-auto-refresh": P.value,
|
|
161
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => P.value = r),
|
|
162
|
+
tableExpose: v,
|
|
163
|
+
loading: l(h)
|
|
164
|
+
}, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
|
|
165
|
+
]),
|
|
166
|
+
_: 1
|
|
167
|
+
})) : Se("", !0),
|
|
168
|
+
I(se, p({
|
|
132
169
|
ref_key: "elTable",
|
|
133
|
-
ref:
|
|
170
|
+
ref: z,
|
|
134
171
|
class: "table-main-table",
|
|
135
172
|
stripe: "",
|
|
136
173
|
border: "",
|
|
137
174
|
highlightCurrentRow: ""
|
|
138
|
-
},
|
|
139
|
-
maxHeight:
|
|
140
|
-
data:
|
|
141
|
-
rowKey:
|
|
175
|
+
}, l(re), {
|
|
176
|
+
maxHeight: l(te),
|
|
177
|
+
data: l(T),
|
|
178
|
+
rowKey: oe(i.rowKey)
|
|
142
179
|
}), {
|
|
143
|
-
empty:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
], 64)) : (
|
|
180
|
+
empty: C(() => [
|
|
181
|
+
l(h) ? (n(), y(_, { key: 0 }, [
|
|
182
|
+
R("加载中...")
|
|
183
|
+
], 64)) : (n(), b(le, { key: 1 }))
|
|
147
184
|
]),
|
|
148
|
-
default:
|
|
149
|
-
(
|
|
185
|
+
default: C(() => [
|
|
186
|
+
(n(!0), y(_, null, _e(i.columns, (r) => (n(), b(u, p({
|
|
150
187
|
key: r.columnKey || r.prop
|
|
151
|
-
}, { ref_for: !0 }, r),
|
|
152
|
-
|
|
188
|
+
}, { ref_for: !0 }, r), Ee({ _: 2 }, [
|
|
189
|
+
M(r.type) ? {
|
|
153
190
|
name: "default",
|
|
154
|
-
fn:
|
|
155
|
-
|
|
156
|
-
r.render ? (
|
|
191
|
+
fn: C((f) => [
|
|
192
|
+
J(e.$slots, r.prop, p({ ref_for: !0 }, B(f)), () => [
|
|
193
|
+
r.render ? (n(), b(V(r.render), p({
|
|
157
194
|
key: 0,
|
|
158
195
|
ref_for: !0
|
|
159
|
-
},
|
|
160
|
-
_index:
|
|
161
|
-
}), null, 16, ["_index"])) : (
|
|
162
|
-
|
|
196
|
+
}, B(f, ["$index"]), {
|
|
197
|
+
_index: f.$index
|
|
198
|
+
}), null, 16, ["_index"])) : (n(), y(_, { key: 1 }, [
|
|
199
|
+
R($(f.row[r.prop]), 1)
|
|
163
200
|
], 64))
|
|
164
201
|
], !0)
|
|
165
202
|
]),
|
|
166
203
|
key: "0"
|
|
167
204
|
} : void 0,
|
|
168
|
-
|
|
205
|
+
M(r.type) ? {
|
|
169
206
|
name: "header",
|
|
170
|
-
fn:
|
|
171
|
-
|
|
172
|
-
r.headerRender ? (
|
|
207
|
+
fn: C((f) => [
|
|
208
|
+
J(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, L(f)), () => [
|
|
209
|
+
r.headerRender ? (n(), b(V(r.headerRender), p({
|
|
173
210
|
key: 0,
|
|
174
211
|
ref_for: !0
|
|
175
|
-
},
|
|
176
|
-
|
|
212
|
+
}, L(f)), null, 16)) : (n(), y(_, { key: 1 }, [
|
|
213
|
+
R($(r.label), 1)
|
|
177
214
|
], 64))
|
|
178
215
|
], !0)
|
|
179
216
|
]),
|
|
@@ -183,26 +220,26 @@ const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke
|
|
|
183
220
|
]),
|
|
184
221
|
_: 3
|
|
185
222
|
}, 16, ["maxHeight", "data", "rowKey"]),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
"current-page":
|
|
189
|
-
"onUpdate:currentPage": t[
|
|
190
|
-
"page-size":
|
|
191
|
-
"onUpdate:pageSize": t[
|
|
192
|
-
"page-sizes":
|
|
193
|
-
|
|
223
|
+
Te(we("div", ze, [
|
|
224
|
+
I(ie, {
|
|
225
|
+
"current-page": l(o),
|
|
226
|
+
"onUpdate:currentPage": t[1] || (t[1] = (r) => Y(o) ? o.value = r : null),
|
|
227
|
+
"page-size": l(s),
|
|
228
|
+
"onUpdate:pageSize": t[2] || (t[2] = (r) => Y(s) ? s.value = r : null),
|
|
229
|
+
"page-sizes": i.pageSizeOptions,
|
|
230
|
+
size: "small",
|
|
194
231
|
background: "",
|
|
195
|
-
layout:
|
|
196
|
-
total:
|
|
197
|
-
onSizeChange:
|
|
232
|
+
layout: i.pageLayout,
|
|
233
|
+
total: l(w),
|
|
234
|
+
onSizeChange: ne
|
|
198
235
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
199
236
|
], 512), [
|
|
200
|
-
[
|
|
237
|
+
[xe, i.showPager]
|
|
201
238
|
])
|
|
202
239
|
]);
|
|
203
240
|
};
|
|
204
241
|
}
|
|
205
242
|
});
|
|
206
243
|
export {
|
|
207
|
-
|
|
244
|
+
qe as default
|
|
208
245
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ElButton as g, ElIcon as k } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/button/style/css";
|
|
4
|
+
import "element-plus/es/components/icon/style/css";
|
|
5
|
+
import { defineComponent as A, useModel as B, computed as f, ref as i, watch as _, openBlock as a, createElementBlock as V, createElementVNode as x, createBlock as d, createCommentVNode as m, withCtx as c, createVNode as h, normalizeClass as y, unref as C, mergeModels as I } from "vue";
|
|
6
|
+
import { Refresh as M } from "@element-plus/icons-vue";
|
|
7
|
+
import w from "../misc/AutoRefresh.vue.mjs";
|
|
8
|
+
const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G = /* @__PURE__ */ A({
|
|
9
|
+
__name: "TableToolbar",
|
|
10
|
+
props: /* @__PURE__ */ I({
|
|
11
|
+
features: { default: () => ["refresh", "autoRefresh"] },
|
|
12
|
+
refreshInterval: { default: 30 },
|
|
13
|
+
tableExpose: {},
|
|
14
|
+
loading: { type: Boolean }
|
|
15
|
+
}, {
|
|
16
|
+
isAutoRefresh: { type: Boolean },
|
|
17
|
+
isAutoRefreshModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:isAutoRefresh"],
|
|
20
|
+
setup(s) {
|
|
21
|
+
const e = s, n = B(s, "isAutoRefresh"), p = f(
|
|
22
|
+
() => e.features === void 0 || e.features.includes("refresh")
|
|
23
|
+
), v = f(
|
|
24
|
+
() => e.features === void 0 || e.features.includes("autoRefresh")
|
|
25
|
+
), l = i(30);
|
|
26
|
+
_(
|
|
27
|
+
() => e.refreshInterval,
|
|
28
|
+
(o) => {
|
|
29
|
+
l.value = o;
|
|
30
|
+
},
|
|
31
|
+
{ immediate: !0 }
|
|
32
|
+
);
|
|
33
|
+
const u = i(), R = () => {
|
|
34
|
+
var o;
|
|
35
|
+
(o = u.value) == null || o.trigger();
|
|
36
|
+
};
|
|
37
|
+
return (o, t) => {
|
|
38
|
+
const b = k, E = g;
|
|
39
|
+
return a(), V("div", N, [
|
|
40
|
+
x("div", T, [
|
|
41
|
+
v.value ? (a(), d(w, {
|
|
42
|
+
key: 0,
|
|
43
|
+
ref_key: "autoRefreshRef",
|
|
44
|
+
ref: u,
|
|
45
|
+
modelValue: n.value,
|
|
46
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => n.value = r),
|
|
47
|
+
interval: l.value,
|
|
48
|
+
"onUpdate:interval": t[1] || (t[1] = (r) => l.value = r),
|
|
49
|
+
onRefresh: t[2] || (t[2] = (r) => e.tableExpose.refresh())
|
|
50
|
+
}, null, 8, ["modelValue", "interval"])) : m("", !0),
|
|
51
|
+
p.value ? (a(), d(E, {
|
|
52
|
+
key: 1,
|
|
53
|
+
circle: "",
|
|
54
|
+
onClick: R
|
|
55
|
+
}, {
|
|
56
|
+
default: c(() => [
|
|
57
|
+
h(b, {
|
|
58
|
+
class: y({ "table-toolbar-icon--rotating": s.loading })
|
|
59
|
+
}, {
|
|
60
|
+
default: c(() => [
|
|
61
|
+
h(C(M))
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}, 8, ["class"])
|
|
65
|
+
]),
|
|
66
|
+
_: 1
|
|
67
|
+
})) : m("", !0)
|
|
68
|
+
])
|
|
69
|
+
]);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
G as default
|
|
75
|
+
};
|
package/es/config/route.mjs
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
async function A(a, c, e) {
|
|
2
|
+
var s;
|
|
3
|
+
const i = (e == null ? void 0 : e.pageSize) ?? 200, r = (e == null ? void 0 : e.limit) ?? 1e4;
|
|
4
|
+
if (i < 1 || i > 1e3)
|
|
5
|
+
throw new Error(
|
|
6
|
+
`fetchListAll: pageSize 必须在 [1, 1000] 范围内(实际 ${i})`
|
|
7
|
+
);
|
|
8
|
+
const t = [];
|
|
9
|
+
let n = 1;
|
|
10
|
+
for (; ; ) {
|
|
11
|
+
const o = {
|
|
12
|
+
...c,
|
|
13
|
+
page: { page: n, pageSize: i }
|
|
14
|
+
}, l = await a(o), p = l.items, g = ((s = l.page) == null ? void 0 : s.totalRecord) ?? 0;
|
|
15
|
+
if (n === 1 && g > r)
|
|
16
|
+
throw new Error(
|
|
17
|
+
`fetchListAll 超出上限 ${r}(实际 totalRecord=${g}),请手动分页或质疑工具适用性`
|
|
18
|
+
);
|
|
19
|
+
if (t.push(...p), p.length < i || t.length >= g) break;
|
|
20
|
+
n += 1;
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
function f(a) {
|
|
25
|
+
return async (c) => {
|
|
26
|
+
const e = c.page;
|
|
27
|
+
if (!e)
|
|
28
|
+
throw new Error("createListApi: params.page 必填(含 page / pageSize)");
|
|
29
|
+
const { page: i, pageSize: r } = e;
|
|
30
|
+
if (!r || r <= 0)
|
|
31
|
+
throw new Error("createListApi: pageSize 必须 > 0");
|
|
32
|
+
let t;
|
|
33
|
+
if (Array.isArray(a))
|
|
34
|
+
t = a;
|
|
35
|
+
else {
|
|
36
|
+
const o = a();
|
|
37
|
+
if (o instanceof Promise) {
|
|
38
|
+
const l = await o;
|
|
39
|
+
if (!Array.isArray(l))
|
|
40
|
+
throw new Error("createListApi: 异步 source 返回值必须为数组");
|
|
41
|
+
t = l;
|
|
42
|
+
} else
|
|
43
|
+
t = o;
|
|
44
|
+
}
|
|
45
|
+
const n = (i - 1) * r, s = n + r;
|
|
46
|
+
return {
|
|
47
|
+
items: t.slice(n, s),
|
|
48
|
+
page: {
|
|
49
|
+
totalRecord: t.length,
|
|
50
|
+
pageSize: r,
|
|
51
|
+
totalPage: Math.ceil(t.length / r)
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function h(a, c) {
|
|
57
|
+
return a({
|
|
58
|
+
...c,
|
|
59
|
+
page: { page: 1, pageSize: 1 }
|
|
60
|
+
}).then((e) => e.page.totalRecord);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
h as countAll,
|
|
64
|
+
f as createListApi,
|
|
65
|
+
A as fetchListAll
|
|
66
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ref as c, onBeforeUnmount as n, watch as s } from "vue";
|
|
2
|
+
import { useActivated as v } from "./activated.mjs";
|
|
3
|
+
const l = (o = !0) => {
|
|
4
|
+
const { isActivated: r } = v(), e = c(void 0), t = () => {
|
|
5
|
+
e.value !== null && e.value !== void 0 && (clearTimeout(e.value), e.value = void 0);
|
|
6
|
+
}, u = (i, m) => {
|
|
7
|
+
t(), e.value = setTimeout(i, m);
|
|
8
|
+
};
|
|
9
|
+
return o && n(t), s(
|
|
10
|
+
r,
|
|
11
|
+
(i) => {
|
|
12
|
+
i || o && t();
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
immediate: !0
|
|
16
|
+
}
|
|
17
|
+
), [u, t];
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
l as useTimeout
|
|
21
|
+
};
|