@done-coding/admin-core 0.0.1-alpha.1 → 0.1.0
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/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +101 -96
- package/es/components/table/TableMain.vue.mjs +3 -3
- package/es/components/table/TableMain.vue2.mjs +154 -121
- package/es/components/table/TableToolbar.vue.mjs +7 -0
- package/es/components/table/TableToolbar.vue2.mjs +95 -0
- package/es/helpers/list-helper.mjs +66 -0
- package/es/hooks/timeout.mjs +21 -0
- package/es/index.mjs +43 -37
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/components/list-page/ListPage.vue.d.ts +2 -0
- 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 +18 -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 "./ListPage.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-767c1592"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ElLoadingDirective as
|
|
1
|
+
import { ElLoadingDirective as te } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/es/components/loading/style/css";
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import
|
|
6
|
-
import { generateFormData as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { BODY_CONTENT_VIEWPORT_HEIGHT as
|
|
12
|
-
const
|
|
4
|
+
import { defineComponent as re, useCssVars as ae, unref as a, useModel as oe, ref as c, shallowRef as O, inject as ne, computed as s, watch as se, withDirectives as ie, openBlock as j, createElementBlock as le, createVNode as k, mergeProps as y, createSlots as F, renderList as S, withCtx as g, renderSlot as d, normalizeProps as T, guardReactiveProps as $, createBlock as ue, createCommentVNode as ce, mergeModels as A } from "vue";
|
|
5
|
+
import fe from "../form/FormSearch.vue.mjs";
|
|
6
|
+
import { generateFormData as he, stringifyFormData as ge } from "../form/utils.mjs";
|
|
7
|
+
import de from "../display/WatchSize.vue.mjs";
|
|
8
|
+
import me from "../table/TableMain.vue.mjs";
|
|
9
|
+
import pe from "lodash/pick";
|
|
10
|
+
import ve from "lodash/cloneDeep";
|
|
11
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as ye } from "../../inject/key.mjs";
|
|
12
|
+
const Se = {
|
|
13
13
|
"element-loading-background": "rgba(122, 122, 122, 0.5)",
|
|
14
14
|
class: "list-page"
|
|
15
|
-
},
|
|
15
|
+
}, ke = /* @__PURE__ */ re({
|
|
16
16
|
__name: "ListPage",
|
|
17
|
-
props: {
|
|
17
|
+
props: /* @__PURE__ */ A({
|
|
18
18
|
staticQuery: { default: () => ({}) },
|
|
19
19
|
formSearchProps: {},
|
|
20
20
|
columns: {},
|
|
@@ -29,56 +29,59 @@ const pe = {
|
|
|
29
29
|
injectInfo: {},
|
|
30
30
|
beforeSearch: {},
|
|
31
31
|
clearTableFilterOnReset: { type: Boolean }
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
}, {
|
|
33
|
+
isAutoRefresh: { type: Boolean },
|
|
34
|
+
isAutoRefreshModifiers: {}
|
|
35
|
+
}),
|
|
36
|
+
emits: /* @__PURE__ */ A(["dataChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
37
|
+
setup(n, { expose: x, emit: B }) {
|
|
38
|
+
ae((e) => ({
|
|
39
|
+
v036568fb: a(q)
|
|
37
40
|
}));
|
|
38
|
-
const
|
|
41
|
+
const o = n, b = B, m = oe(n, "isAutoRefresh"), p = c({}), v = c(
|
|
39
42
|
{}
|
|
40
|
-
),
|
|
41
|
-
|
|
43
|
+
), C = c(!1), i = O(), u = O(), E = ne(
|
|
44
|
+
ye,
|
|
42
45
|
500
|
|
43
|
-
),
|
|
44
|
-
...
|
|
45
|
-
...
|
|
46
|
-
})), w =
|
|
47
|
-
I.value -
|
|
46
|
+
), H = c(0), R = c(0), V = s(() => ({
|
|
47
|
+
...v.value,
|
|
48
|
+
...o.staticQuery
|
|
49
|
+
})), w = c(!1), K = s(() => w.value ? H.value + 10 : 0), N = s(() => o.showOperation ? R.value + 10 : 0), I = s(() => E.value - o.refineReduceHeight), q = s(() => o.refine ? `${I.value}px` : "auto"), L = s(() => o.refine ? Math.max(
|
|
50
|
+
I.value - K.value - N.value,
|
|
48
51
|
200
|
|
49
|
-
) : void 0),
|
|
50
|
-
var
|
|
52
|
+
) : void 0), M = (e, t = "search") => {
|
|
53
|
+
var r, l, h;
|
|
51
54
|
let f = e;
|
|
52
|
-
if (
|
|
53
|
-
|
|
55
|
+
if (o.beforeSearch && (f = o.beforeSearch(
|
|
56
|
+
ve(e),
|
|
54
57
|
t
|
|
55
|
-
)), t === "reset" &&
|
|
56
|
-
return ["reset", "search"].includes(t) ? (
|
|
57
|
-
|
|
58
|
+
)), t === "reset" && o.clearTableFilterOnReset && ((l = (r = u.value) == null ? void 0 : r.getTableInstance()) == null || l.clearFilter()), JSON.stringify(f) === JSON.stringify(v.value))
|
|
59
|
+
return ["reset", "search"].includes(t) ? (h = u.value) == null ? void 0 : h.reload() : void 0;
|
|
60
|
+
v.value = {
|
|
58
61
|
...f
|
|
59
62
|
};
|
|
60
|
-
}, L = (e) => {
|
|
61
|
-
S("dataChange", e);
|
|
62
|
-
}, A = (e) => {
|
|
63
|
-
S("pageInfoChange", e);
|
|
64
|
-
}, _ = (e) => {
|
|
65
|
-
b.value = e;
|
|
66
63
|
}, J = (e) => {
|
|
67
|
-
|
|
64
|
+
b("dataChange", e);
|
|
68
65
|
}, Q = (e) => {
|
|
66
|
+
b("pageInfoChange", e);
|
|
67
|
+
}, z = (e) => {
|
|
68
|
+
C.value = e;
|
|
69
|
+
}, G = (e) => {
|
|
69
70
|
H.value = e;
|
|
70
|
-
},
|
|
71
|
+
}, U = (e) => {
|
|
72
|
+
R.value = e;
|
|
73
|
+
}, W = s(() => o.list), Y = s(() => o.rowKey), P = s(() => p.value), D = {
|
|
71
74
|
refresh: (e = !1) => {
|
|
72
75
|
var t;
|
|
73
|
-
return (t =
|
|
76
|
+
return (t = u.value) == null ? void 0 : t.refresh(e);
|
|
74
77
|
},
|
|
75
78
|
reload: (e = !1) => {
|
|
76
79
|
var t;
|
|
77
|
-
return (t =
|
|
80
|
+
return (t = u.value) == null ? void 0 : t.reload(e);
|
|
78
81
|
},
|
|
79
82
|
getTableInstance: () => {
|
|
80
83
|
var e;
|
|
81
|
-
return (e =
|
|
84
|
+
return (e = u.value) == null ? void 0 : e.getTableInstance();
|
|
82
85
|
},
|
|
83
86
|
validate: () => {
|
|
84
87
|
if (i.value)
|
|
@@ -102,100 +105,102 @@ const pe = {
|
|
|
102
105
|
return (e = i.value) == null ? void 0 : e.triggerSearch();
|
|
103
106
|
},
|
|
104
107
|
update: (e, t) => {
|
|
105
|
-
|
|
108
|
+
p.value[e] = t;
|
|
106
109
|
}
|
|
107
|
-
},
|
|
108
|
-
const e =
|
|
110
|
+
}, X = s(() => {
|
|
111
|
+
const e = pe(D, [
|
|
109
112
|
"triggerReset",
|
|
110
113
|
"triggerSearch",
|
|
111
114
|
"update"
|
|
112
115
|
]);
|
|
113
116
|
return {
|
|
114
|
-
...
|
|
117
|
+
...o.injectInfo || {},
|
|
115
118
|
...e
|
|
116
119
|
};
|
|
117
|
-
}),
|
|
120
|
+
}), Z = (e) => e, _ = (e) => e, ee = (e) => {
|
|
118
121
|
w.value = e;
|
|
119
122
|
};
|
|
120
|
-
return
|
|
121
|
-
() =>
|
|
123
|
+
return x(D), se(
|
|
124
|
+
() => o.list,
|
|
122
125
|
(e) => {
|
|
123
|
-
const t =
|
|
124
|
-
|
|
126
|
+
const t = he(e);
|
|
127
|
+
p.value = t, M(ge(t, e));
|
|
125
128
|
},
|
|
126
129
|
{
|
|
127
130
|
immediate: !0
|
|
128
131
|
}
|
|
129
132
|
), (e, t) => {
|
|
130
|
-
const f =
|
|
131
|
-
return
|
|
132
|
-
k(
|
|
133
|
+
const f = te;
|
|
134
|
+
return ie((j(), le("div", Se, [
|
|
135
|
+
k(a(fe), y({
|
|
133
136
|
ref_key: "formSearch",
|
|
134
137
|
ref: i,
|
|
135
|
-
list:
|
|
136
|
-
data:
|
|
137
|
-
},
|
|
138
|
-
onSearch:
|
|
139
|
-
onHeightChange:
|
|
140
|
-
onVisibleChange:
|
|
138
|
+
list: a(W),
|
|
139
|
+
data: a(P)
|
|
140
|
+
}, n.formSearchProps, {
|
|
141
|
+
onSearch: M,
|
|
142
|
+
onHeightChange: G,
|
|
143
|
+
onVisibleChange: ee
|
|
141
144
|
}), F({ _: 2 }, [
|
|
142
|
-
|
|
143
|
-
name:
|
|
144
|
-
fn:
|
|
145
|
-
|
|
145
|
+
S(n.list, (r) => ({
|
|
146
|
+
name: r.key,
|
|
147
|
+
fn: g((l) => [
|
|
148
|
+
d(e.$slots, `form-${r.key}`, T($(l)), void 0, !0)
|
|
146
149
|
])
|
|
147
150
|
}))
|
|
148
151
|
]), 1040, ["list", "data"]),
|
|
149
|
-
|
|
152
|
+
n.showOperation ? (j(), ue(a(de), {
|
|
150
153
|
key: 0,
|
|
151
154
|
class: "list-page-operation",
|
|
152
|
-
onHeightChange:
|
|
155
|
+
onHeightChange: U
|
|
153
156
|
}, {
|
|
154
|
-
default:
|
|
155
|
-
|
|
157
|
+
default: g(() => [
|
|
158
|
+
d(e.$slots, "operation", {}, void 0, !0)
|
|
156
159
|
]),
|
|
157
160
|
_: 3
|
|
158
|
-
})) :
|
|
159
|
-
k(
|
|
161
|
+
})) : ce("", !0),
|
|
162
|
+
k(a(me), y({
|
|
160
163
|
ref_key: "tableMain",
|
|
161
|
-
ref:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
ref: u,
|
|
165
|
+
"is-auto-refresh": m.value,
|
|
166
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => m.value = r),
|
|
167
|
+
api: n.api,
|
|
168
|
+
columns: n.columns,
|
|
169
|
+
query: a(V),
|
|
170
|
+
maxHeight: a(L),
|
|
171
|
+
rowKey: a(Y)
|
|
172
|
+
}, n.tableMainProps, {
|
|
168
173
|
refine: !1,
|
|
169
|
-
injectInfo:
|
|
170
|
-
onLoadingChange:
|
|
171
|
-
onDataChange:
|
|
172
|
-
onPageInfoChange:
|
|
174
|
+
injectInfo: a(X),
|
|
175
|
+
onLoadingChange: z,
|
|
176
|
+
onDataChange: J,
|
|
177
|
+
onPageInfoChange: Q
|
|
173
178
|
}), F({ _: 2 }, [
|
|
174
|
-
|
|
175
|
-
name:
|
|
176
|
-
fn:
|
|
177
|
-
|
|
179
|
+
S(n.columns, (r) => ({
|
|
180
|
+
name: r.prop,
|
|
181
|
+
fn: g((l) => [
|
|
182
|
+
d(e.$slots, `table-${r.prop}`, T($(Z(l))), void 0, !0)
|
|
178
183
|
])
|
|
179
184
|
})),
|
|
180
|
-
|
|
181
|
-
name: `header-${
|
|
182
|
-
fn:
|
|
183
|
-
var
|
|
185
|
+
S(n.columns, (r) => ({
|
|
186
|
+
name: `header-${r.prop}`,
|
|
187
|
+
fn: g((l) => {
|
|
188
|
+
var h;
|
|
184
189
|
return [
|
|
185
|
-
|
|
186
|
-
searchFormData:
|
|
187
|
-
triggerSearch: (
|
|
190
|
+
d(e.$slots, `table-header-${r.columnKey || r.prop}`, y(_(l), {
|
|
191
|
+
searchFormData: a(P),
|
|
192
|
+
triggerSearch: (h = a(i)) == null ? void 0 : h.triggerSearch
|
|
188
193
|
}), void 0, !0)
|
|
189
194
|
];
|
|
190
195
|
})
|
|
191
196
|
}))
|
|
192
|
-
]), 1040, ["api", "columns", "query", "maxHeight", "rowKey", "injectInfo"])
|
|
197
|
+
]), 1040, ["is-auto-refresh", "api", "columns", "query", "maxHeight", "rowKey", "injectInfo"])
|
|
193
198
|
])), [
|
|
194
|
-
[f,
|
|
199
|
+
[f, !m.value && a(C)]
|
|
195
200
|
]);
|
|
196
201
|
};
|
|
197
202
|
}
|
|
198
203
|
});
|
|
199
204
|
export {
|
|
200
|
-
|
|
205
|
+
ke as default
|
|
201
206
|
};
|
|
@@ -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-08dc9d04"]]);
|
|
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,181 @@ 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(s, { expose: W, emit: Z }) {
|
|
41
|
+
ce((e) => ({
|
|
42
|
+
v1961e86c: e.headerColor
|
|
36
43
|
}));
|
|
37
|
-
const a =
|
|
38
|
-
|
|
44
|
+
const a = s, m = Z, P = me(s, "isAutoRefresh"), Q = he(), T = g([]), w = g(0), i = 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, i.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 (!i.value) return;
|
|
84
|
+
h.value ? console.warn("请求并发") : h.value = !0, e || (x.value = !0);
|
|
85
|
+
const t = U(S.value);
|
|
86
|
+
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: i.value,
|
|
95
|
+
currentPage: o.value,
|
|
96
|
+
total: w.value
|
|
78
97
|
}));
|
|
79
98
|
}).finally(() => {
|
|
80
|
-
|
|
99
|
+
A(t) && (h.value = !1, x.value = !1);
|
|
81
100
|
});
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
refresh:
|
|
88
|
-
reload:
|
|
89
|
-
getTableInstance: () =>
|
|
90
|
-
},
|
|
91
|
-
...
|
|
101
|
+
}, j = (e = !1) => {
|
|
102
|
+
K(e);
|
|
103
|
+
}, ae = (e = !1) => {
|
|
104
|
+
o.value === 1 ? j(e) : o.value = 1;
|
|
105
|
+
}, oe = (e) => e, v = {
|
|
106
|
+
refresh: j,
|
|
107
|
+
reload: ae,
|
|
108
|
+
getTableInstance: () => z.value
|
|
109
|
+
}, B = (e, t = []) => ({
|
|
110
|
+
...q(e, ["render", "headerRender"].concat(t)),
|
|
92
111
|
injectInfo: a.injectInfo || {},
|
|
93
112
|
exposeInfo: v
|
|
94
|
-
}),
|
|
95
|
-
...
|
|
113
|
+
}), L = (e) => ({
|
|
114
|
+
...q(e, ["render", "headerRender"]),
|
|
96
115
|
injectInfo: a.injectInfo || {},
|
|
97
116
|
exposeInfo: v
|
|
98
117
|
});
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
return
|
|
104
|
-
|
|
118
|
+
W(v);
|
|
119
|
+
const ne = (e) => {
|
|
120
|
+
i.value = e, o.value = 1;
|
|
121
|
+
}, M = (e) => !e || e === "expand";
|
|
122
|
+
return be(() => {
|
|
123
|
+
i.value = a.pageSizeInit, Ce(() => {
|
|
105
124
|
v.refresh();
|
|
106
125
|
});
|
|
107
|
-
}),
|
|
108
|
-
|
|
109
|
-
}),
|
|
126
|
+
}), c(T, (e) => {
|
|
127
|
+
m("dataChange", e);
|
|
128
|
+
}), c(
|
|
110
129
|
() => a.query,
|
|
111
130
|
(e, t) => {
|
|
112
|
-
JSON.stringify(e) !== JSON.stringify(t) && (
|
|
131
|
+
JSON.stringify(e) !== JSON.stringify(t) && (o.value = 1);
|
|
113
132
|
}
|
|
114
|
-
),
|
|
115
|
-
|
|
133
|
+
), c(
|
|
134
|
+
S,
|
|
116
135
|
(e, t) => {
|
|
117
|
-
JSON.stringify(e) !== JSON.stringify(t) &&
|
|
136
|
+
JSON.stringify(e) !== JSON.stringify(t) && K();
|
|
118
137
|
},
|
|
119
138
|
{
|
|
120
139
|
immediate: !0
|
|
121
140
|
}
|
|
122
|
-
),
|
|
123
|
-
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
|
|
141
|
+
), c(x, (e) => {
|
|
142
|
+
m("loadingChange", e);
|
|
143
|
+
}), c(i, (e) => {
|
|
144
|
+
m("pageSizeChange", e);
|
|
145
|
+
}), c(o, (e) => {
|
|
146
|
+
m("pageChange", e);
|
|
128
147
|
}), (e, t) => {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
|
|
148
|
+
const u = fe, le = ge, ie = ue, se = pe;
|
|
149
|
+
return n(), y("div", Oe, [
|
|
150
|
+
l(N) ? (n(), b(l(Re), {
|
|
151
|
+
key: 0,
|
|
152
|
+
onHeightChange: X
|
|
153
|
+
}, {
|
|
154
|
+
default: C(() => [
|
|
155
|
+
I(Ie, p({
|
|
156
|
+
"is-auto-refresh": P.value,
|
|
157
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => P.value = r),
|
|
158
|
+
tableExpose: v,
|
|
159
|
+
loading: l(h)
|
|
160
|
+
}, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
|
|
161
|
+
]),
|
|
162
|
+
_: 1
|
|
163
|
+
})) : Se("", !0),
|
|
164
|
+
I(ie, p({
|
|
132
165
|
ref_key: "elTable",
|
|
133
|
-
ref:
|
|
166
|
+
ref: z,
|
|
134
167
|
class: "table-main-table",
|
|
135
168
|
stripe: "",
|
|
136
169
|
border: "",
|
|
137
170
|
highlightCurrentRow: ""
|
|
138
|
-
},
|
|
139
|
-
maxHeight:
|
|
140
|
-
data:
|
|
141
|
-
rowKey:
|
|
171
|
+
}, l(re), {
|
|
172
|
+
maxHeight: l(te),
|
|
173
|
+
data: l(T),
|
|
174
|
+
rowKey: oe(s.rowKey)
|
|
142
175
|
}), {
|
|
143
|
-
empty:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
], 64)) : (
|
|
176
|
+
empty: C(() => [
|
|
177
|
+
l(h) ? (n(), y(_, { key: 0 }, [
|
|
178
|
+
R("加载中...")
|
|
179
|
+
], 64)) : (n(), b(le, { key: 1 }))
|
|
147
180
|
]),
|
|
148
|
-
default:
|
|
149
|
-
(
|
|
181
|
+
default: C(() => [
|
|
182
|
+
(n(!0), y(_, null, _e(s.columns, (r) => (n(), b(u, p({
|
|
150
183
|
key: r.columnKey || r.prop
|
|
151
|
-
}, { ref_for: !0 }, r),
|
|
152
|
-
|
|
184
|
+
}, { ref_for: !0 }, r), Ee({ _: 2 }, [
|
|
185
|
+
M(r.type) ? {
|
|
153
186
|
name: "default",
|
|
154
|
-
fn:
|
|
155
|
-
|
|
156
|
-
r.render ? (
|
|
187
|
+
fn: C((f) => [
|
|
188
|
+
J(e.$slots, r.prop, p({ ref_for: !0 }, B(f)), () => [
|
|
189
|
+
r.render ? (n(), b(V(r.render), p({
|
|
157
190
|
key: 0,
|
|
158
191
|
ref_for: !0
|
|
159
|
-
},
|
|
160
|
-
_index:
|
|
161
|
-
}), null, 16, ["_index"])) : (
|
|
162
|
-
|
|
192
|
+
}, B(f, ["$index"]), {
|
|
193
|
+
_index: f.$index
|
|
194
|
+
}), null, 16, ["_index"])) : (n(), y(_, { key: 1 }, [
|
|
195
|
+
R($(f.row[r.prop]), 1)
|
|
163
196
|
], 64))
|
|
164
197
|
], !0)
|
|
165
198
|
]),
|
|
166
199
|
key: "0"
|
|
167
200
|
} : void 0,
|
|
168
|
-
|
|
201
|
+
M(r.type) ? {
|
|
169
202
|
name: "header",
|
|
170
|
-
fn:
|
|
171
|
-
|
|
172
|
-
r.headerRender ? (
|
|
203
|
+
fn: C((f) => [
|
|
204
|
+
J(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, L(f)), () => [
|
|
205
|
+
r.headerRender ? (n(), b(V(r.headerRender), p({
|
|
173
206
|
key: 0,
|
|
174
207
|
ref_for: !0
|
|
175
|
-
},
|
|
176
|
-
|
|
208
|
+
}, L(f)), null, 16)) : (n(), y(_, { key: 1 }, [
|
|
209
|
+
R($(r.label), 1)
|
|
177
210
|
], 64))
|
|
178
211
|
], !0)
|
|
179
212
|
]),
|
|
@@ -183,26 +216,26 @@ const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke
|
|
|
183
216
|
]),
|
|
184
217
|
_: 3
|
|
185
218
|
}, 16, ["maxHeight", "data", "rowKey"]),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
"current-page":
|
|
189
|
-
"onUpdate:currentPage": t[
|
|
190
|
-
"page-size":
|
|
191
|
-
"onUpdate:pageSize": t[
|
|
192
|
-
"page-sizes":
|
|
193
|
-
|
|
219
|
+
Te(we("div", ze, [
|
|
220
|
+
I(se, {
|
|
221
|
+
"current-page": l(o),
|
|
222
|
+
"onUpdate:currentPage": t[1] || (t[1] = (r) => Y(o) ? o.value = r : null),
|
|
223
|
+
"page-size": l(i),
|
|
224
|
+
"onUpdate:pageSize": t[2] || (t[2] = (r) => Y(i) ? i.value = r : null),
|
|
225
|
+
"page-sizes": s.pageSizeOptions,
|
|
226
|
+
size: "small",
|
|
194
227
|
background: "",
|
|
195
|
-
layout:
|
|
196
|
-
total:
|
|
197
|
-
onSizeChange:
|
|
228
|
+
layout: s.pageLayout,
|
|
229
|
+
total: l(w),
|
|
230
|
+
onSizeChange: ne
|
|
198
231
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
199
232
|
], 512), [
|
|
200
|
-
[
|
|
233
|
+
[xe, s.showPager]
|
|
201
234
|
])
|
|
202
235
|
]);
|
|
203
236
|
};
|
|
204
237
|
}
|
|
205
238
|
});
|
|
206
239
|
export {
|
|
207
|
-
|
|
240
|
+
qe as default
|
|
208
241
|
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ElInputNumber as g, ElSwitch as w, ElButton as y, ElIcon as C } 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 "element-plus/es/components/switch/style/css";
|
|
6
|
+
import "element-plus/es/components/input-number/style/css";
|
|
7
|
+
import { defineComponent as M, useModel as N, computed as p, ref as T, watch as i, openBlock as a, createElementBlock as h, createElementVNode as m, Fragment as z, createVNode as f, isRef as S, unref as v, createCommentVNode as c, createBlock as b, withCtx as E, normalizeClass as U, mergeModels as F } from "vue";
|
|
8
|
+
import { Refresh as j } from "@element-plus/icons-vue";
|
|
9
|
+
import { useTimeout as q } from "../../hooks/timeout.mjs";
|
|
10
|
+
import { useActivatedExec as D } from "../../hooks/activated.mjs";
|
|
11
|
+
const G = { class: "table-toolbar" }, H = { class: "table-toolbar-right" }, $ = /* @__PURE__ */ M({
|
|
12
|
+
__name: "TableToolbar",
|
|
13
|
+
props: /* @__PURE__ */ F({
|
|
14
|
+
features: { default: () => ["refresh", "autoRefresh"] },
|
|
15
|
+
refreshInterval: { default: 30 },
|
|
16
|
+
tableExpose: {},
|
|
17
|
+
loading: { type: Boolean }
|
|
18
|
+
}, {
|
|
19
|
+
isAutoRefresh: { type: Boolean },
|
|
20
|
+
isAutoRefreshModifiers: {}
|
|
21
|
+
}),
|
|
22
|
+
emits: ["update:isAutoRefresh"],
|
|
23
|
+
setup(n) {
|
|
24
|
+
const e = n, t = N(n, "isAutoRefresh"), R = p(
|
|
25
|
+
() => e.features === void 0 || e.features.includes("refresh")
|
|
26
|
+
), d = p(
|
|
27
|
+
() => e.features === void 0 || e.features.includes("autoRefresh")
|
|
28
|
+
), l = T(30);
|
|
29
|
+
i(
|
|
30
|
+
() => e.refreshInterval,
|
|
31
|
+
(r) => {
|
|
32
|
+
l.value = r;
|
|
33
|
+
},
|
|
34
|
+
{ immediate: !0 }
|
|
35
|
+
);
|
|
36
|
+
const [x, V] = q(), s = () => {
|
|
37
|
+
x(() => {
|
|
38
|
+
e.tableExpose.refresh(), t.value && s();
|
|
39
|
+
}, l.value * 1e3);
|
|
40
|
+
}, _ = () => {
|
|
41
|
+
e.tableExpose.refresh(), t.value && s();
|
|
42
|
+
};
|
|
43
|
+
return i(t, (r) => {
|
|
44
|
+
r ? s() : V();
|
|
45
|
+
}), i(l, () => {
|
|
46
|
+
t.value && s();
|
|
47
|
+
}), D(() => {
|
|
48
|
+
t.value && (e.tableExpose.refresh(), s());
|
|
49
|
+
}), (r, o) => {
|
|
50
|
+
const k = g, A = w, B = C, I = y;
|
|
51
|
+
return a(), h("div", G, [
|
|
52
|
+
m("div", H, [
|
|
53
|
+
d.value && t.value ? (a(), h(z, { key: 0 }, [
|
|
54
|
+
o[2] || (o[2] = m("span", { class: "table-toolbar-label" }, "刷新间隔", -1)),
|
|
55
|
+
f(k, {
|
|
56
|
+
modelValue: v(l),
|
|
57
|
+
"onUpdate:modelValue": o[0] || (o[0] = (u) => S(l) ? l.value = u : null),
|
|
58
|
+
min: 1,
|
|
59
|
+
step: 5,
|
|
60
|
+
size: "small",
|
|
61
|
+
class: "table-toolbar-interval"
|
|
62
|
+
}, null, 8, ["modelValue"]),
|
|
63
|
+
o[3] || (o[3] = m("span", { class: "table-toolbar-label" }, "秒", -1))
|
|
64
|
+
], 64)) : c("", !0),
|
|
65
|
+
d.value ? (a(), b(A, {
|
|
66
|
+
key: 1,
|
|
67
|
+
modelValue: t.value,
|
|
68
|
+
"onUpdate:modelValue": o[1] || (o[1] = (u) => t.value = u),
|
|
69
|
+
"active-text": "自动刷新"
|
|
70
|
+
}, null, 8, ["modelValue"])) : c("", !0),
|
|
71
|
+
R.value ? (a(), b(I, {
|
|
72
|
+
key: 2,
|
|
73
|
+
circle: "",
|
|
74
|
+
onClick: _
|
|
75
|
+
}, {
|
|
76
|
+
default: E(() => [
|
|
77
|
+
f(B, {
|
|
78
|
+
class: U({ "table-toolbar-icon--rotating": n.loading })
|
|
79
|
+
}, {
|
|
80
|
+
default: E(() => [
|
|
81
|
+
f(v(j))
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}, 8, ["class"])
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
})) : c("", !0)
|
|
88
|
+
])
|
|
89
|
+
]);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
export {
|
|
94
|
+
$ as default
|
|
95
|
+
};
|
|
@@ -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
|
+
};
|
package/es/index.mjs
CHANGED
|
@@ -5,15 +5,15 @@ 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 E } from "./components/modal/DetailModal.vue.mjs";
|
|
9
|
+
import { default as _ } from "./components/form/FormMain.vue.mjs";
|
|
10
10
|
import { default as M } from "./components/form/FormRadioGroup.vue.mjs";
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
11
|
+
import { default as S } from "./components/form/FormSelect.vue.mjs";
|
|
12
|
+
import { default as L } from "./components/form/FormTree.vue.mjs";
|
|
13
|
+
import { default as D } from "./components/form/FormVerifyCode.vue.mjs";
|
|
14
14
|
import { default as P } from "./components/menu/MenuItemSub.vue.mjs";
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
15
|
+
import { default as G } from "./components/menu/MenuTree.vue.mjs";
|
|
16
|
+
import { default as b } from "./components/misc/TriggerAutoImport.vue.mjs";
|
|
17
17
|
import { default as y } from "./components/display/WatchSize.vue.mjs";
|
|
18
18
|
import { APP_API_LIST_MODEL_KEY_CONFIG as v } from "./config/list-model.mjs";
|
|
19
19
|
import { BODY_CONTENT_VIEWPORT_HEIGHT as H } from "./inject/key.mjs";
|
|
@@ -24,16 +24,18 @@ import { default as le } from "./components/form/FormSearch.vue.mjs";
|
|
|
24
24
|
import { default as ie } from "./components/form/FormVerifyImage.vue.mjs";
|
|
25
25
|
import { default as ne } from "./components/list-page/ListPage.vue.mjs";
|
|
26
26
|
import { ROUTE_MODULE_LEVEL as de } from "./config/route.mjs";
|
|
27
|
-
import { default as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
27
|
+
import { default as ce } from "./components/table/TableMain.vue.mjs";
|
|
28
|
+
import { countAll as Ee, createListApi as Fe, fetchListAll as _e } from "./helpers/list-helper.mjs";
|
|
29
|
+
import { createGenerateRouteMetaRawTree as Me } from "./helpers/route.mjs";
|
|
30
|
+
import { createStorageWithNamespace as Se } from "./helpers/storage.mjs";
|
|
31
|
+
import { createUseState as Le } from "./helpers/state.mjs";
|
|
32
|
+
import { flatRouteMetaResolveRaw as De, getRoutePermissionKey as Oe } from "./utils/router.mjs";
|
|
33
|
+
import { getId as he } from "./utils/id.mjs";
|
|
34
|
+
import { timeCountDown as Ne } from "./utils/time.mjs";
|
|
35
|
+
import { useActivated as we, useActivatedEvent as ye, useActivatedExec as Ve } from "./hooks/activated.mjs";
|
|
36
|
+
import { useFeelSize as Ue } from "./hooks/feel-size.mjs";
|
|
37
|
+
import { useMenusDataDispatch as We } from "./hooks/menus-dispatch.mjs";
|
|
38
|
+
import { useTimeout as Be } from "./hooks/timeout.mjs";
|
|
37
39
|
const I = {
|
|
38
40
|
install(e) {
|
|
39
41
|
e.use(t), e.use(o), e.use(r), e.use(a), e.use(m), e.use(f), e.use(s);
|
|
@@ -43,37 +45,40 @@ export {
|
|
|
43
45
|
v as APP_API_LIST_MODEL_KEY_CONFIG,
|
|
44
46
|
H as BODY_CONTENT_VIEWPORT_HEIGHT,
|
|
45
47
|
z as ConfirmModal,
|
|
46
|
-
|
|
48
|
+
E as DetailModal,
|
|
47
49
|
K as FORM_CONFIG_SELECT_ALL_VALUE,
|
|
48
50
|
J as FORM_ITEM_CHANGE_LOADING,
|
|
49
|
-
|
|
51
|
+
_ as FormMain,
|
|
50
52
|
M as FormRadioGroup,
|
|
51
53
|
le as FormSearch,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
S as FormSelect,
|
|
55
|
+
L as FormTree,
|
|
56
|
+
D as FormVerifyCode,
|
|
55
57
|
ie as FormVerifyImage,
|
|
56
58
|
ne as ListPage,
|
|
57
59
|
P as MenuItemSub,
|
|
58
|
-
|
|
60
|
+
G as MenuTree,
|
|
59
61
|
de as ROUTE_MODULE_LEVEL,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
ce as TableMain,
|
|
63
|
+
b as TriggerAutoImport,
|
|
62
64
|
y as WatchSize,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
Ee as countAll,
|
|
66
|
+
Me as createGenerateRouteMetaRawTree,
|
|
67
|
+
Fe as createListApi,
|
|
68
|
+
Se as createStorageWithNamespace,
|
|
69
|
+
Le as createUseState,
|
|
66
70
|
r as displayInstall,
|
|
67
|
-
|
|
71
|
+
_e as fetchListAll,
|
|
72
|
+
De as flatRouteMetaResolveRaw,
|
|
68
73
|
t as formInstall,
|
|
69
74
|
Q as generateFormData,
|
|
70
75
|
X as getBlurSubmit,
|
|
71
76
|
Z as getChangeSubmit,
|
|
72
77
|
Y as getConfirmPasswordRule,
|
|
73
78
|
$ as getEnterSubmit,
|
|
74
|
-
|
|
79
|
+
he as getId,
|
|
75
80
|
ee as getPlaceholder,
|
|
76
|
-
|
|
81
|
+
Oe as getRoutePermissionKey,
|
|
77
82
|
te as getVModelSugar,
|
|
78
83
|
I as installComponents,
|
|
79
84
|
s as listPageInstall,
|
|
@@ -88,10 +93,11 @@ export {
|
|
|
88
93
|
me as stringifyFormData,
|
|
89
94
|
fe as swiftFormItemConfig,
|
|
90
95
|
f as tableInstall,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
Ne as timeCountDown,
|
|
97
|
+
we as useActivated,
|
|
98
|
+
ye as useActivatedEvent,
|
|
99
|
+
Ve as useActivatedExec,
|
|
100
|
+
Ue as useFeelSize,
|
|
101
|
+
We as useMenusDataDispatch,
|
|
102
|
+
Be as useTimeout
|
|
97
103
|
};
|
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}.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-main-table[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}.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-d2a1aea9]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-d2a1aea9]{display:flex;align-items:center;gap:8px}.table-toolbar-label[data-v-d2a1aea9]{font-size:13px;color:var(--el-text-color-regular)}.table-toolbar-interval[data-v-d2a1aea9]{width:80px}.table-toolbar-icon--rotating[data-v-d2a1aea9]{animation:table-toolbar-rotating-d2a1aea9 1s linear infinite}@keyframes table-toolbar-rotating-d2a1aea9{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-08dc9d04]{--el-table-header-bg-color: var(--v1961e86c)}.table-main-pagination[data-v-08dc9d04]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-767c1592]{min-height:var(--v036568fb)}.list-page-operation[data-v-767c1592]{margin-bottom:10px}.list-page[data-v-767c1592] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/admin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
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": "c36a32fd56c54e6450e2abd2124bdc1642c8bb80"
|
|
81
81
|
}
|
|
@@ -22,6 +22,8 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
22
22
|
injectInfo?: F | undefined;
|
|
23
23
|
beforeSearch?: ((data: import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>, type: FormSearchSearchType) => import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>) | undefined;
|
|
24
24
|
clearTableFilterOnReset?: boolean;
|
|
25
|
+
} & {
|
|
26
|
+
isAutoRefresh?: boolean;
|
|
25
27
|
}), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
26
28
|
expose(exposed: import('vue').ShallowUnwrapRef<ListPageInstance<PO>>): void;
|
|
27
29
|
attrs: any;
|
|
@@ -11,7 +11,9 @@ declare const _default: <T extends Record<string, any>, SQ extends Record<string
|
|
|
11
11
|
currentPage: number;
|
|
12
12
|
total: number;
|
|
13
13
|
}) => any) | undefined;
|
|
14
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & TableMainProps<T, SQ, F
|
|
14
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & (TableMainProps<T, SQ, F> & {
|
|
15
|
+
isAutoRefresh?: boolean;
|
|
16
|
+
}), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
15
17
|
expose(exposed: import('vue').ShallowUnwrapRef<TableMainInstance>): void;
|
|
16
18
|
attrs: any;
|
|
17
19
|
slots: ReturnType<() => Partial<Record<NonNullable<Uppercase<string> | Extract<keyof T, string> | undefined>, (_: {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TableMainInstance } from './types';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
4
|
+
isAutoRefresh: import('vue').PropType<boolean>;
|
|
5
|
+
loading: {
|
|
6
|
+
type: globalThis.PropType<boolean>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
features: {
|
|
10
|
+
type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
|
|
11
|
+
default: () => string[];
|
|
12
|
+
};
|
|
13
|
+
refreshInterval: {
|
|
14
|
+
type: globalThis.PropType<number>;
|
|
15
|
+
default: number;
|
|
16
|
+
};
|
|
17
|
+
tableExpose: {
|
|
18
|
+
type: globalThis.PropType<TableMainInstance>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
22
|
+
isAutoRefresh: import('vue').PropType<boolean>;
|
|
23
|
+
loading: {
|
|
24
|
+
type: globalThis.PropType<boolean>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
features: {
|
|
28
|
+
type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
|
|
29
|
+
default: () => string[];
|
|
30
|
+
};
|
|
31
|
+
refreshInterval: {
|
|
32
|
+
type: globalThis.PropType<number>;
|
|
33
|
+
default: number;
|
|
34
|
+
};
|
|
35
|
+
tableExpose: {
|
|
36
|
+
type: globalThis.PropType<TableMainInstance>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {
|
|
40
|
+
features: import('./types').TableToolbarFeature[];
|
|
41
|
+
refreshInterval: number;
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
43
|
+
export default _default;
|
|
@@ -22,6 +22,20 @@ export interface TableMainInstance {
|
|
|
22
22
|
reload: (slice?: boolean) => void;
|
|
23
23
|
getTableInstance: () => TableInstance | undefined;
|
|
24
24
|
}
|
|
25
|
+
/** toolbar 可配置功能列表 */
|
|
26
|
+
export type TableToolbarFeature = "refresh" | "autoRefresh";
|
|
27
|
+
/** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
|
|
28
|
+
export interface TableToolbarConfig {
|
|
29
|
+
/**
|
|
30
|
+
* 功能列表。
|
|
31
|
+
* - undefined(默认):显示所有功能
|
|
32
|
+
* - [](空数组):不渲染 toolbar
|
|
33
|
+
* - 枚举子集:仅显示指定功能
|
|
34
|
+
*/
|
|
35
|
+
features?: TableToolbarFeature[];
|
|
36
|
+
/** 自动刷新默认间隔(秒),默认 30 */
|
|
37
|
+
refreshInterval?: number;
|
|
38
|
+
}
|
|
25
39
|
/** 表格列默认作用域 */
|
|
26
40
|
export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
|
|
27
41
|
row: T;
|
|
@@ -66,6 +80,10 @@ SQ extends Record<string, any>,
|
|
|
66
80
|
F extends Record<string, any>> {
|
|
67
81
|
/** 展示分页器 */
|
|
68
82
|
showPager?: boolean;
|
|
83
|
+
/** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.features) */
|
|
84
|
+
showToolbar?: boolean;
|
|
85
|
+
/** toolbar 配置 */
|
|
86
|
+
toolbar?: TableToolbarConfig;
|
|
69
87
|
/** 参数 */
|
|
70
88
|
query?: SQ;
|
|
71
89
|
/** 每页条数 */
|
package/types/helpers/index.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TableApiParams, TableApiResult } from '../components/table/types';
|
|
2
|
+
|
|
3
|
+
export interface FetchListAllOptions {
|
|
4
|
+
/** 单页大小,默认 200,范围 [1, 1000] */
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
/** 累计抓取上限,默认 10000;totalRecord > limit 则 throw */
|
|
7
|
+
limit?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 全量翻页拉取(串行,提前终止)
|
|
11
|
+
* ---
|
|
12
|
+
* @param api 原始分页 api 函数(签名同 TableMain :api prop)
|
|
13
|
+
* @param baseParams 业务侧固定参数,会透传到每页 api 调用(不被改写)
|
|
14
|
+
* @param opts pageSize / limit 覆盖
|
|
15
|
+
* @returns 全量 items 数组
|
|
16
|
+
*
|
|
17
|
+
* 行为:
|
|
18
|
+
* - totalRecord = 0 → 直接 [] 返回(仅调 1 次)
|
|
19
|
+
* - 单页 items.length < pageSize → 视为末页提前终止
|
|
20
|
+
* - 任一页 reject → 整体 reject 透传原错误
|
|
21
|
+
* - totalRecord > limit → throw 兜底
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchListAll<T extends Record<string, any>, P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<T>>, baseParams?: P, opts?: FetchListAllOptions): Promise<T[]>;
|
|
24
|
+
export type ListApiSource<T> = T[] | (() => T[]) | (() => Promise<T[]>);
|
|
25
|
+
/**
|
|
26
|
+
* 用本地数组 / 同步函数 / 异步函数生成符合 TableMain :api prop 签名的 api
|
|
27
|
+
* ---
|
|
28
|
+
* 内部识别 source 类型 + 分页切片;无缓存,每次调用 source 重新求值
|
|
29
|
+
*/
|
|
30
|
+
export declare function createListApi<T extends Record<string, any>>(source: ListApiSource<T>): (params: TableApiParams<{}>) => Promise<TableApiResult<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* countAll: 仅探测列表总记录数,不拉数据。
|
|
33
|
+
* 1 次 api 调用 page=1/pageSize=1,返回 totalRecord。
|
|
34
|
+
* 用于"探测是否有数据 / 数据计数 / 存在性判断"等场景,替代手工 pageSize: 9999 hack。
|
|
35
|
+
*/
|
|
36
|
+
export declare function countAll<P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<any>>, baseParams?: P): Promise<number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 深度递归 Partial(函数类型保持不变,object 类型字段递归可选)
|
|
3
|
+
* ---
|
|
4
|
+
* 应用场景:SDK 请求参数嵌套结构的可选化(如 PagingInput)
|
|
5
|
+
*/
|
|
6
|
+
export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends object ? {
|
|
7
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
8
|
+
} : T;
|
|
9
|
+
/**
|
|
10
|
+
* 分页请求参数的可选包装
|
|
11
|
+
* ---
|
|
12
|
+
* 与 SDK 1.1.40 嵌套契约耦合:业务侧手包 list api wrapper 时
|
|
13
|
+
* 常以 PagingInput<RawApiParams> 作为入参类型,兜底字段缺失
|
|
14
|
+
*/
|
|
15
|
+
export type PagingInput<T> = DeepPartial<T>;
|
package/types/hooks/index.d.ts
CHANGED