@done-coding/admin-core 0.1.1-alpha.0 → 0.1.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/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +97 -84
- package/es/components/misc/AutoRefresh.vue.mjs +2 -2
- package/es/components/misc/AutoRefresh.vue2.mjs +44 -38
- package/es/components/table/TableMain.vue.mjs +1 -1
- package/es/components/table/TableMain.vue2.mjs +103 -103
- package/es/components/table/TableToolbar.vue.mjs +2 -2
- package/es/components/table/TableToolbar.vue2.mjs +103 -42
- package/es/hooks/activated.mjs +32 -26
- 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/list-page/types.d.ts +2 -0
- package/types/components/misc/AutoRefresh.vue.d.ts +20 -8
- package/types/components/table/TableToolbar.vue.d.ts +17 -8
- package/types/components/table/types.d.ts +19 -8
- package/types/hooks/activated.d.ts +12 -3
|
@@ -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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-182577bf"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ElLoadingDirective as
|
|
1
|
+
import { ElLoadingDirective as ie } 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
|
|
4
|
+
import { defineComponent as le, useCssVars as ue, unref as a, useModel as ce, ref as u, shallowRef as O, inject as he, computed as s, watch as fe, withDirectives as ge, openBlock as y, createElementBlock as de, createBlock as $, withCtx as g, renderSlot as d, createCommentVNode as A, createVNode as F, mergeProps as H, createSlots as T, renderList as C, normalizeProps as B, guardReactiveProps as E, mergeModels as V } from "vue";
|
|
5
|
+
import me from "../form/FormSearch.vue.mjs";
|
|
6
|
+
import { generateFormData as ve, stringifyFormData as pe } from "../form/utils.mjs";
|
|
7
|
+
import x from "../display/WatchSize.vue.mjs";
|
|
8
|
+
import ye from "../table/TableMain.vue.mjs";
|
|
9
|
+
import He from "lodash/pick";
|
|
10
|
+
import Ce from "lodash/cloneDeep";
|
|
11
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as Se } from "../../inject/key.mjs";
|
|
12
12
|
const be = {
|
|
13
13
|
"element-loading-background": "rgba(122, 122, 122, 0.5)",
|
|
14
14
|
class: "list-page"
|
|
15
|
-
},
|
|
15
|
+
}, Fe = /* @__PURE__ */ le({
|
|
16
16
|
__name: "ListPage",
|
|
17
|
-
props: /* @__PURE__ */
|
|
17
|
+
props: /* @__PURE__ */ V({
|
|
18
18
|
staticQuery: { default: () => ({}) },
|
|
19
19
|
formSearchProps: {},
|
|
20
20
|
columns: {},
|
|
@@ -23,6 +23,7 @@ const be = {
|
|
|
23
23
|
refineReduceHeight: { default: 0 },
|
|
24
24
|
tableMainProps: {},
|
|
25
25
|
showOperation: { type: Boolean, default: !1 },
|
|
26
|
+
showHeader: { type: Boolean, default: !1 },
|
|
26
27
|
list: { default: () => [] },
|
|
27
28
|
api: {},
|
|
28
29
|
query: {},
|
|
@@ -33,55 +34,57 @@ const be = {
|
|
|
33
34
|
isAutoRefresh: { type: Boolean },
|
|
34
35
|
isAutoRefreshModifiers: {}
|
|
35
36
|
}),
|
|
36
|
-
emits: /* @__PURE__ */
|
|
37
|
-
setup(n, { expose:
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
emits: /* @__PURE__ */ V(["dataChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
38
|
+
setup(n, { expose: K, emit: N }) {
|
|
39
|
+
ue((e) => ({
|
|
40
|
+
ad28a056: a(G)
|
|
40
41
|
}));
|
|
41
|
-
const o = n, S =
|
|
42
|
+
const o = n, S = N, m = ce(n, "isAutoRefresh"), v = u({}), p = u(
|
|
42
43
|
{}
|
|
43
|
-
),
|
|
44
|
-
|
|
44
|
+
), b = u(!1), i = O(), c = O(), q = he(
|
|
45
|
+
Se,
|
|
45
46
|
500
|
|
46
|
-
),
|
|
47
|
-
...
|
|
47
|
+
), w = u(0), R = u(0), I = u(0), L = s(() => ({
|
|
48
|
+
...p.value,
|
|
48
49
|
...o.staticQuery
|
|
49
|
-
})),
|
|
50
|
-
|
|
50
|
+
})), M = u(!1), J = s(() => M.value ? w.value + 10 : 0), Q = s(() => o.showOperation ? R.value + 10 : 0), z = s(() => o.showHeader ? I.value + 10 : 0), P = s(() => q.value - o.refineReduceHeight), G = s(() => o.refine ? `${P.value}px` : "auto"), U = s(() => o.refine ? Math.max(
|
|
51
|
+
P.value - J.value - Q.value - z.value,
|
|
51
52
|
200
|
|
52
|
-
) : void 0),
|
|
53
|
-
var r, l,
|
|
54
|
-
let
|
|
55
|
-
if (o.beforeSearch && (
|
|
56
|
-
|
|
53
|
+
) : void 0), j = (e, t = "search") => {
|
|
54
|
+
var r, l, f;
|
|
55
|
+
let h = e;
|
|
56
|
+
if (o.beforeSearch && (h = o.beforeSearch(
|
|
57
|
+
Ce(e),
|
|
57
58
|
t
|
|
58
|
-
)), t === "reset" && o.clearTableFilterOnReset && ((l = (r =
|
|
59
|
-
return ["reset", "search"].includes(t) ? (
|
|
60
|
-
|
|
61
|
-
...
|
|
59
|
+
)), t === "reset" && o.clearTableFilterOnReset && ((l = (r = c.value) == null ? void 0 : r.getTableInstance()) == null || l.clearFilter()), JSON.stringify(h) === JSON.stringify(p.value))
|
|
60
|
+
return ["reset", "search"].includes(t) ? (f = c.value) == null ? void 0 : f.reload() : void 0;
|
|
61
|
+
p.value = {
|
|
62
|
+
...h
|
|
62
63
|
};
|
|
63
|
-
},
|
|
64
|
+
}, W = (e) => {
|
|
64
65
|
S("dataChange", e);
|
|
65
|
-
},
|
|
66
|
+
}, Y = (e) => {
|
|
66
67
|
S("pageInfoChange", e);
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
},
|
|
68
|
+
}, X = (e) => {
|
|
69
|
+
b.value = e;
|
|
70
|
+
}, Z = (e) => {
|
|
71
|
+
w.value = e;
|
|
72
|
+
}, _ = (e) => {
|
|
72
73
|
R.value = e;
|
|
73
|
-
},
|
|
74
|
+
}, ee = (e) => {
|
|
75
|
+
I.value = e;
|
|
76
|
+
}, te = s(() => o.list), re = s(() => o.rowKey), k = s(() => v.value), D = {
|
|
74
77
|
refresh: async (e = !1) => {
|
|
75
78
|
var t;
|
|
76
|
-
return (t =
|
|
79
|
+
return (t = c.value) == null ? void 0 : t.refresh(e);
|
|
77
80
|
},
|
|
78
81
|
reload: async (e = !1) => {
|
|
79
82
|
var t;
|
|
80
|
-
return (t =
|
|
83
|
+
return (t = c.value) == null ? void 0 : t.reload(e);
|
|
81
84
|
},
|
|
82
85
|
getTableInstance: () => {
|
|
83
86
|
var e;
|
|
84
|
-
return (e =
|
|
87
|
+
return (e = c.value) == null ? void 0 : e.getTableInstance();
|
|
85
88
|
},
|
|
86
89
|
validate: () => {
|
|
87
90
|
if (i.value)
|
|
@@ -105,10 +108,10 @@ const be = {
|
|
|
105
108
|
return (e = i.value) == null ? void 0 : e.triggerSearch();
|
|
106
109
|
},
|
|
107
110
|
update: (e, t) => {
|
|
108
|
-
|
|
111
|
+
v.value[e] = t;
|
|
109
112
|
}
|
|
110
|
-
},
|
|
111
|
-
const e =
|
|
113
|
+
}, ae = s(() => {
|
|
114
|
+
const e = He(D, [
|
|
112
115
|
"triggerReset",
|
|
113
116
|
"triggerSearch",
|
|
114
117
|
"update"
|
|
@@ -117,90 +120,100 @@ const be = {
|
|
|
117
120
|
...o.injectInfo || {},
|
|
118
121
|
...e
|
|
119
122
|
};
|
|
120
|
-
}),
|
|
121
|
-
|
|
123
|
+
}), oe = (e) => e, ne = (e) => e, se = (e) => {
|
|
124
|
+
M.value = e;
|
|
122
125
|
};
|
|
123
|
-
return
|
|
126
|
+
return K(D), fe(
|
|
124
127
|
() => o.list,
|
|
125
128
|
(e) => {
|
|
126
|
-
const t =
|
|
127
|
-
|
|
129
|
+
const t = ve(e);
|
|
130
|
+
v.value = t, j(pe(t, e));
|
|
128
131
|
},
|
|
129
132
|
{
|
|
130
133
|
immediate: !0
|
|
131
134
|
}
|
|
132
135
|
), (e, t) => {
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
+
const h = ie;
|
|
137
|
+
return ge((y(), de("div", be, [
|
|
138
|
+
n.showHeader ? (y(), $(a(x), {
|
|
139
|
+
key: 0,
|
|
140
|
+
class: "list-page-header",
|
|
141
|
+
onHeightChange: ee
|
|
142
|
+
}, {
|
|
143
|
+
default: g(() => [
|
|
144
|
+
d(e.$slots, "header", {}, void 0, !0)
|
|
145
|
+
]),
|
|
146
|
+
_: 3
|
|
147
|
+
})) : A("", !0),
|
|
148
|
+
F(a(me), H({
|
|
136
149
|
ref_key: "formSearch",
|
|
137
150
|
ref: i,
|
|
138
|
-
list: a(
|
|
139
|
-
data: a(
|
|
151
|
+
list: a(te),
|
|
152
|
+
data: a(k)
|
|
140
153
|
}, n.formSearchProps, {
|
|
141
|
-
onSearch:
|
|
142
|
-
onHeightChange:
|
|
143
|
-
onVisibleChange:
|
|
144
|
-
}),
|
|
145
|
-
|
|
154
|
+
onSearch: j,
|
|
155
|
+
onHeightChange: Z,
|
|
156
|
+
onVisibleChange: se
|
|
157
|
+
}), T({ _: 2 }, [
|
|
158
|
+
C(n.list, (r) => ({
|
|
146
159
|
name: r.key,
|
|
147
160
|
fn: g((l) => [
|
|
148
|
-
d(e.$slots, `form-${r.key}`,
|
|
161
|
+
d(e.$slots, `form-${r.key}`, B(E(l)), void 0, !0)
|
|
149
162
|
])
|
|
150
163
|
}))
|
|
151
164
|
]), 1040, ["list", "data"]),
|
|
152
|
-
n.showOperation ? (
|
|
153
|
-
key:
|
|
165
|
+
n.showOperation ? (y(), $(a(x), {
|
|
166
|
+
key: 1,
|
|
154
167
|
class: "list-page-operation",
|
|
155
|
-
onHeightChange:
|
|
168
|
+
onHeightChange: _
|
|
156
169
|
}, {
|
|
157
170
|
default: g(() => [
|
|
158
171
|
d(e.$slots, "operation", {}, void 0, !0)
|
|
159
172
|
]),
|
|
160
173
|
_: 3
|
|
161
|
-
})) :
|
|
162
|
-
|
|
174
|
+
})) : A("", !0),
|
|
175
|
+
F(a(ye), H({
|
|
163
176
|
ref_key: "tableMain",
|
|
164
|
-
ref:
|
|
177
|
+
ref: c,
|
|
165
178
|
"is-auto-refresh": m.value,
|
|
166
179
|
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => m.value = r),
|
|
167
180
|
api: n.api,
|
|
168
181
|
columns: n.columns,
|
|
169
|
-
query: a(
|
|
170
|
-
maxHeight: a(
|
|
171
|
-
rowKey: a(
|
|
182
|
+
query: a(L),
|
|
183
|
+
maxHeight: a(U),
|
|
184
|
+
rowKey: a(re)
|
|
172
185
|
}, n.tableMainProps, {
|
|
173
186
|
refine: !1,
|
|
174
|
-
injectInfo: a(
|
|
175
|
-
onLoadingChange:
|
|
176
|
-
onDataChange:
|
|
177
|
-
onPageInfoChange:
|
|
178
|
-
}),
|
|
179
|
-
|
|
187
|
+
injectInfo: a(ae),
|
|
188
|
+
onLoadingChange: X,
|
|
189
|
+
onDataChange: W,
|
|
190
|
+
onPageInfoChange: Y
|
|
191
|
+
}), T({ _: 2 }, [
|
|
192
|
+
C(n.columns, (r) => ({
|
|
180
193
|
name: r.prop,
|
|
181
194
|
fn: g((l) => [
|
|
182
|
-
d(e.$slots, `table-${r.prop}`,
|
|
195
|
+
d(e.$slots, `table-${r.prop}`, B(E(oe(l))), void 0, !0)
|
|
183
196
|
])
|
|
184
197
|
})),
|
|
185
|
-
|
|
198
|
+
C(n.columns, (r) => ({
|
|
186
199
|
name: `header-${r.prop}`,
|
|
187
200
|
fn: g((l) => {
|
|
188
|
-
var
|
|
201
|
+
var f;
|
|
189
202
|
return [
|
|
190
|
-
d(e.$slots, `table-header-${r.columnKey || r.prop}`,
|
|
191
|
-
searchFormData: a(
|
|
192
|
-
triggerSearch: (
|
|
203
|
+
d(e.$slots, `table-header-${r.columnKey || r.prop}`, H(ne(l), {
|
|
204
|
+
searchFormData: a(k),
|
|
205
|
+
triggerSearch: (f = a(i)) == null ? void 0 : f.triggerSearch
|
|
193
206
|
}), void 0, !0)
|
|
194
207
|
];
|
|
195
208
|
})
|
|
196
209
|
}))
|
|
197
210
|
]), 1040, ["is-auto-refresh", "api", "columns", "query", "maxHeight", "rowKey", "injectInfo"])
|
|
198
211
|
])), [
|
|
199
|
-
[
|
|
212
|
+
[h, !m.value && a(b)]
|
|
200
213
|
]);
|
|
201
214
|
};
|
|
202
215
|
}
|
|
203
216
|
});
|
|
204
217
|
export {
|
|
205
|
-
|
|
218
|
+
Fe as default
|
|
206
219
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AutoRefresh.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9d78ca06"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1,57 +1,63 @@
|
|
|
1
|
-
import { ElInputNumber as
|
|
1
|
+
import { ElInputNumber as N, ElSwitch as R } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/es/components/switch/style/css";
|
|
4
4
|
import "element-plus/es/components/input-number/style/css";
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import { defineComponent as w, useModel as c, computed as B, watch as k, openBlock as f, createElementBlock as p, Fragment as x, createElementVNode as v, createVNode as V, createCommentVNode as F, unref as h, mergeModels as T } from "vue";
|
|
6
|
+
import { Refresh as E } from "@element-plus/icons-vue";
|
|
7
|
+
import { useTimeout as g } from "../../hooks/timeout.mjs";
|
|
8
|
+
import { useActivatedExec as A } from "../../hooks/activated.mjs";
|
|
9
|
+
const C = { class: "auto-refresh" }, D = /* @__PURE__ */ w({
|
|
9
10
|
__name: "AutoRefresh",
|
|
10
|
-
props: {
|
|
11
|
+
props: /* @__PURE__ */ T({
|
|
12
|
+
refreshFn: {},
|
|
13
|
+
enabled: { type: Boolean, default: !0 }
|
|
14
|
+
}, {
|
|
11
15
|
modelValue: { type: Boolean, default: !1 },
|
|
12
16
|
modelModifiers: {},
|
|
13
17
|
interval: { default: 30 },
|
|
14
18
|
intervalModifiers: {}
|
|
15
|
-
},
|
|
16
|
-
emits:
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}),
|
|
20
|
+
emits: ["update:modelValue", "update:interval"],
|
|
21
|
+
setup(n) {
|
|
22
|
+
const u = n, t = c(n, "modelValue"), l = c(n, "interval"), r = B(() => t.value && u.enabled), [b, m] = g();
|
|
23
|
+
let o = null;
|
|
24
|
+
const d = () => (o || (o = u.refreshFn().catch(() => {
|
|
25
|
+
}).finally(() => {
|
|
26
|
+
o = null;
|
|
27
|
+
})), o), i = () => {
|
|
28
|
+
b(async () => {
|
|
29
|
+
await d(), r.value && i();
|
|
30
|
+
}, l.value * 1e3);
|
|
22
31
|
};
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
t[2] || (t[2] = f("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
|
|
36
|
-
p(E, {
|
|
37
|
-
modelValue: o.value,
|
|
38
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) => o.value = a),
|
|
32
|
+
return k([r, l], ([a]) => {
|
|
33
|
+
a ? i() : m();
|
|
34
|
+
}), A(({ triggerType: a }) => {
|
|
35
|
+
r.value && (a === "activated" && (m(), d()), i());
|
|
36
|
+
}), (a, e) => {
|
|
37
|
+
const y = N, M = R;
|
|
38
|
+
return f(), p("div", C, [
|
|
39
|
+
t.value ? (f(), p(x, { key: 0 }, [
|
|
40
|
+
e[2] || (e[2] = v("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
|
|
41
|
+
V(y, {
|
|
42
|
+
modelValue: l.value,
|
|
43
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => l.value = s),
|
|
39
44
|
min: 1,
|
|
40
|
-
step:
|
|
45
|
+
step: 1,
|
|
41
46
|
size: "small",
|
|
42
47
|
class: "auto-refresh-interval"
|
|
43
48
|
}, null, 8, ["modelValue"]),
|
|
44
|
-
|
|
45
|
-
], 64)) :
|
|
46
|
-
|
|
47
|
-
modelValue:
|
|
48
|
-
"onUpdate:modelValue":
|
|
49
|
-
"active-
|
|
50
|
-
|
|
49
|
+
e[3] || (e[3] = v("span", { class: "auto-refresh-label" }, "秒", -1))
|
|
50
|
+
], 64)) : F("", !0),
|
|
51
|
+
V(M, {
|
|
52
|
+
modelValue: t.value,
|
|
53
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => t.value = s),
|
|
54
|
+
"active-action-icon": h(E),
|
|
55
|
+
"inactive-action-icon": h(E)
|
|
56
|
+
}, null, 8, ["modelValue", "active-action-icon", "inactive-action-icon"])
|
|
51
57
|
]);
|
|
52
58
|
};
|
|
53
59
|
}
|
|
54
60
|
});
|
|
55
61
|
export {
|
|
56
|
-
|
|
62
|
+
D as default
|
|
57
63
|
};
|
|
@@ -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 p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-643017c3"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -4,16 +4,16 @@ 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 de, useCssVars as ce, useModel as
|
|
7
|
+
import { defineComponent as de, useCssVars as ce, useModel as he, useAttrs as me, ref as g, shallowRef as ve, inject as ye, computed as d, onMounted as be, onActivated as Ce, watch as c, openBlock as l, createElementBlock as y, unref as s, createBlock as b, withCtx as C, createVNode as R, mergeProps as p, createCommentVNode as Se, Fragment as E, renderList as _e, createSlots as Ee, renderSlot as V, resolveDynamicComponent as $, createTextVNode as P, toDisplayString as Y, withDirectives as Te, createElementVNode as we, isRef as F, vShow as xe, mergeModels as G } from "vue";
|
|
8
8
|
import U from "lodash/cloneDeep";
|
|
9
9
|
import q from "lodash/omit";
|
|
10
10
|
import D from "lodash/set";
|
|
11
|
-
import
|
|
11
|
+
import W from "lodash/get";
|
|
12
12
|
import Ie from "./TableToolbar.vue.mjs";
|
|
13
13
|
import Re from "../display/WatchSize.vue.mjs";
|
|
14
14
|
import { BODY_CONTENT_VIEWPORT_HEIGHT as Pe } from "../../inject/key.mjs";
|
|
15
|
-
import { APP_API_LIST_MODEL_KEY_CONFIG as
|
|
16
|
-
const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" },
|
|
15
|
+
import { APP_API_LIST_MODEL_KEY_CONFIG as T } from "../../config/list-model.mjs";
|
|
16
|
+
const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue = /* @__PURE__ */ de({
|
|
17
17
|
__name: "TableMain",
|
|
18
18
|
props: /* @__PURE__ */ G({
|
|
19
19
|
showPager: { type: Boolean, default: !0 },
|
|
@@ -37,98 +37,98 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
|
|
|
37
37
|
isAutoRefreshModifiers: {}
|
|
38
38
|
}),
|
|
39
39
|
emits: /* @__PURE__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
40
|
-
setup(
|
|
40
|
+
setup(u, { expose: Z, emit: Q }) {
|
|
41
41
|
ce((e) => ({
|
|
42
|
-
|
|
42
|
+
v4c03ff8f: e.headerColor
|
|
43
43
|
}));
|
|
44
|
-
const a =
|
|
45
|
-
|
|
46
|
-
},
|
|
44
|
+
const a = u, h = Q, O = he(u, "isAutoRefresh"), X = me(), w = g([]), x = g(0), i = g(0), o = g(1), m = g(!1), I = g(!1), z = g(0), ee = (e) => {
|
|
45
|
+
z.value = e;
|
|
46
|
+
}, H = ve(), te = ye(
|
|
47
47
|
Pe,
|
|
48
48
|
500
|
|
49
|
-
),
|
|
50
|
-
var
|
|
49
|
+
), N = d(() => a.showPager ? 35 : 0), k = d(() => {
|
|
50
|
+
var n, _;
|
|
51
51
|
if (a.showToolbar === !1) return !1;
|
|
52
|
-
const e = (
|
|
53
|
-
return e === void 0 || e.length > 0;
|
|
54
|
-
}),
|
|
55
|
-
() =>
|
|
56
|
-
),
|
|
52
|
+
const e = (n = a.toolbar) == null ? void 0 : n.leftFeatures, t = (_ = a.toolbar) == null ? void 0 : _.rightFeatures;
|
|
53
|
+
return e === void 0 || e.length > 0 || t === void 0 || t.length > 0;
|
|
54
|
+
}), A = d(
|
|
55
|
+
() => k.value ? z.value : 0
|
|
56
|
+
), re = d(() => {
|
|
57
57
|
const { maxHeight: e, refine: t } = a;
|
|
58
58
|
return e ? Math.max(
|
|
59
|
-
e -
|
|
59
|
+
e - N.value - A.value,
|
|
60
60
|
200
|
|
61
61
|
) : t ? Math.max(
|
|
62
|
-
|
|
62
|
+
te.value - N.value - A.value - a.refineReduceHeight,
|
|
63
63
|
200
|
|
64
64
|
) : void 0;
|
|
65
65
|
}), S = d(() => {
|
|
66
66
|
const e = U(a.query || {});
|
|
67
|
-
return D(e,
|
|
67
|
+
return D(e, T.PAGE_SIZE_KEY, i.value), D(
|
|
68
68
|
e,
|
|
69
|
-
|
|
69
|
+
T.CURRENT_PAGE_KEY,
|
|
70
70
|
o.value
|
|
71
71
|
), e;
|
|
72
|
-
}),
|
|
72
|
+
}), ae = d(() => ({
|
|
73
73
|
...a.tableProps,
|
|
74
|
-
...
|
|
75
|
-
})),
|
|
76
|
-
const
|
|
77
|
-
return !
|
|
74
|
+
...X
|
|
75
|
+
})), K = (e, t = !0) => {
|
|
76
|
+
const n = JSON.stringify(e) === JSON.stringify(S.value);
|
|
77
|
+
return !n && t && console.warn(
|
|
78
78
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
79
79
|
e
|
|
80
80
|
)} => ${JSON.stringify(S.value)}`
|
|
81
|
-
),
|
|
82
|
-
},
|
|
83
|
-
if (!
|
|
84
|
-
|
|
81
|
+
), n;
|
|
82
|
+
}, j = (e = !1) => {
|
|
83
|
+
if (!i.value) return;
|
|
84
|
+
m.value ? console.warn("请求并发") : m.value = !0, e || (I.value = !0);
|
|
85
85
|
const t = U(S.value);
|
|
86
|
-
return a.api(t).then((
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
94
|
-
pageSize:
|
|
86
|
+
return a.api(t).then((n) => {
|
|
87
|
+
K(t, !1) && (w.value = W(
|
|
88
|
+
n,
|
|
89
|
+
T.LIST_KEY
|
|
90
|
+
), x.value = W(
|
|
91
|
+
n,
|
|
92
|
+
T.TOTAL_KEY
|
|
93
|
+
), h("pageInfoChange", {
|
|
94
|
+
pageSize: i.value,
|
|
95
95
|
currentPage: o.value,
|
|
96
|
-
total:
|
|
96
|
+
total: x.value
|
|
97
97
|
}));
|
|
98
98
|
}).finally(() => {
|
|
99
|
-
|
|
99
|
+
K(t) && (m.value = !1, I.value = !1);
|
|
100
100
|
});
|
|
101
|
-
},
|
|
101
|
+
}, B = async (e = !1) => {
|
|
102
102
|
var t;
|
|
103
|
-
return (t =
|
|
103
|
+
return (t = j(e)) == null ? void 0 : t.catch(() => {
|
|
104
104
|
});
|
|
105
|
-
},
|
|
105
|
+
}, oe = async (e = !1) => {
|
|
106
106
|
if (o.value === 1)
|
|
107
|
-
return
|
|
107
|
+
return B(e);
|
|
108
108
|
o.value = 1;
|
|
109
|
-
},
|
|
110
|
-
refresh:
|
|
111
|
-
reload:
|
|
112
|
-
getTableInstance: () =>
|
|
113
|
-
},
|
|
109
|
+
}, ne = (e) => e, v = {
|
|
110
|
+
refresh: B,
|
|
111
|
+
reload: oe,
|
|
112
|
+
getTableInstance: () => H.value
|
|
113
|
+
}, L = (e, t = []) => ({
|
|
114
114
|
...q(e, ["render", "headerRender"].concat(t)),
|
|
115
115
|
injectInfo: a.injectInfo || {},
|
|
116
116
|
exposeInfo: v
|
|
117
|
-
}),
|
|
117
|
+
}), M = (e) => ({
|
|
118
118
|
...q(e, ["render", "headerRender"]),
|
|
119
119
|
injectInfo: a.injectInfo || {},
|
|
120
120
|
exposeInfo: v
|
|
121
121
|
});
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
},
|
|
122
|
+
Z(v);
|
|
123
|
+
const le = (e) => {
|
|
124
|
+
i.value = e, o.value = 1;
|
|
125
|
+
}, J = (e) => !e || e === "expand";
|
|
126
126
|
return be(() => {
|
|
127
|
-
|
|
127
|
+
i.value = a.pageSizeInit, Ce(() => {
|
|
128
128
|
v.refresh();
|
|
129
129
|
});
|
|
130
|
-
}), c(
|
|
131
|
-
|
|
130
|
+
}), c(w, (e) => {
|
|
131
|
+
h("dataChange", e);
|
|
132
132
|
}), c(
|
|
133
133
|
() => a.query,
|
|
134
134
|
(e, t) => {
|
|
@@ -137,80 +137,80 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
|
|
|
137
137
|
), c(
|
|
138
138
|
S,
|
|
139
139
|
(e, t) => {
|
|
140
|
-
JSON.stringify(e) !== JSON.stringify(t) &&
|
|
140
|
+
JSON.stringify(e) !== JSON.stringify(t) && j();
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
immediate: !0
|
|
144
144
|
}
|
|
145
|
-
), c(
|
|
146
|
-
|
|
147
|
-
}), c(
|
|
148
|
-
|
|
145
|
+
), c(I, (e) => {
|
|
146
|
+
h("loadingChange", e);
|
|
147
|
+
}), c(i, (e) => {
|
|
148
|
+
h("pageSizeChange", e);
|
|
149
149
|
}), c(o, (e) => {
|
|
150
|
-
|
|
150
|
+
h("pageChange", e);
|
|
151
151
|
}), (e, t) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
|
|
152
|
+
const n = fe, _ = ge, se = ue, ie = pe;
|
|
153
|
+
return l(), y("div", Oe, [
|
|
154
|
+
s(k) ? (l(), b(s(Re), {
|
|
155
155
|
key: 0,
|
|
156
|
-
onHeightChange:
|
|
156
|
+
onHeightChange: ee
|
|
157
157
|
}, {
|
|
158
158
|
default: C(() => [
|
|
159
|
-
|
|
160
|
-
"is-auto-refresh":
|
|
161
|
-
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) =>
|
|
159
|
+
R(Ie, p({
|
|
160
|
+
"is-auto-refresh": O.value,
|
|
161
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => O.value = r),
|
|
162
162
|
tableExpose: v,
|
|
163
|
-
loading:
|
|
163
|
+
loading: s(m)
|
|
164
164
|
}, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
|
|
165
165
|
]),
|
|
166
166
|
_: 1
|
|
167
167
|
})) : Se("", !0),
|
|
168
|
-
|
|
168
|
+
R(se, p({
|
|
169
169
|
ref_key: "elTable",
|
|
170
|
-
ref:
|
|
170
|
+
ref: H,
|
|
171
171
|
class: "table-main-table",
|
|
172
172
|
stripe: "",
|
|
173
173
|
border: "",
|
|
174
174
|
highlightCurrentRow: ""
|
|
175
|
-
},
|
|
176
|
-
maxHeight:
|
|
177
|
-
data:
|
|
178
|
-
rowKey:
|
|
175
|
+
}, s(ae), {
|
|
176
|
+
maxHeight: s(re),
|
|
177
|
+
data: s(w),
|
|
178
|
+
rowKey: ne(u.rowKey)
|
|
179
179
|
}), {
|
|
180
180
|
empty: C(() => [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
], 64)) : (
|
|
181
|
+
s(m) ? (l(), y(E, { key: 0 }, [
|
|
182
|
+
P("加载中...")
|
|
183
|
+
], 64)) : (l(), b(_, { key: 1 }))
|
|
184
184
|
]),
|
|
185
185
|
default: C(() => [
|
|
186
|
-
(
|
|
186
|
+
(l(!0), y(E, null, _e(u.columns, (r) => (l(), b(n, p({
|
|
187
187
|
key: r.columnKey || r.prop
|
|
188
188
|
}, { ref_for: !0 }, r), Ee({ _: 2 }, [
|
|
189
|
-
|
|
189
|
+
J(r.type) ? {
|
|
190
190
|
name: "default",
|
|
191
191
|
fn: C((f) => [
|
|
192
|
-
|
|
193
|
-
r.render ? (
|
|
192
|
+
V(e.$slots, r.prop, p({ ref_for: !0 }, L(f)), () => [
|
|
193
|
+
r.render ? (l(), b($(r.render), p({
|
|
194
194
|
key: 0,
|
|
195
195
|
ref_for: !0
|
|
196
|
-
},
|
|
196
|
+
}, L(f, ["$index"]), {
|
|
197
197
|
_index: f.$index
|
|
198
|
-
}), null, 16, ["_index"])) : (
|
|
199
|
-
|
|
198
|
+
}), null, 16, ["_index"])) : (l(), y(E, { key: 1 }, [
|
|
199
|
+
P(Y(f.row[r.prop]), 1)
|
|
200
200
|
], 64))
|
|
201
201
|
], !0)
|
|
202
202
|
]),
|
|
203
203
|
key: "0"
|
|
204
204
|
} : void 0,
|
|
205
|
-
|
|
205
|
+
J(r.type) ? {
|
|
206
206
|
name: "header",
|
|
207
207
|
fn: C((f) => [
|
|
208
|
-
|
|
209
|
-
r.headerRender ? (
|
|
208
|
+
V(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, M(f)), () => [
|
|
209
|
+
r.headerRender ? (l(), b($(r.headerRender), p({
|
|
210
210
|
key: 0,
|
|
211
211
|
ref_for: !0
|
|
212
|
-
},
|
|
213
|
-
|
|
212
|
+
}, M(f)), null, 16)) : (l(), y(E, { key: 1 }, [
|
|
213
|
+
P(Y(r.label), 1)
|
|
214
214
|
], 64))
|
|
215
215
|
], !0)
|
|
216
216
|
]),
|
|
@@ -221,25 +221,25 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
|
|
|
221
221
|
_: 3
|
|
222
222
|
}, 16, ["maxHeight", "data", "rowKey"]),
|
|
223
223
|
Te(we("div", ze, [
|
|
224
|
-
|
|
225
|
-
"current-page":
|
|
226
|
-
"onUpdate:currentPage": t[1] || (t[1] = (r) =>
|
|
227
|
-
"page-size":
|
|
228
|
-
"onUpdate:pageSize": t[2] || (t[2] = (r) =>
|
|
229
|
-
"page-sizes":
|
|
224
|
+
R(ie, {
|
|
225
|
+
"current-page": s(o),
|
|
226
|
+
"onUpdate:currentPage": t[1] || (t[1] = (r) => F(o) ? o.value = r : null),
|
|
227
|
+
"page-size": s(i),
|
|
228
|
+
"onUpdate:pageSize": t[2] || (t[2] = (r) => F(i) ? i.value = r : null),
|
|
229
|
+
"page-sizes": u.pageSizeOptions,
|
|
230
230
|
size: "small",
|
|
231
231
|
background: "",
|
|
232
|
-
layout:
|
|
233
|
-
total:
|
|
234
|
-
onSizeChange:
|
|
232
|
+
layout: u.pageLayout,
|
|
233
|
+
total: s(x),
|
|
234
|
+
onSizeChange: le
|
|
235
235
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
236
236
|
], 512), [
|
|
237
|
-
[xe,
|
|
237
|
+
[xe, u.showPager]
|
|
238
238
|
])
|
|
239
239
|
]);
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
export {
|
|
244
|
-
|
|
244
|
+
Ue as default
|
|
245
245
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TableToolbar.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import a from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-60e049ad"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { ElButton as
|
|
1
|
+
import { ElDropdown as k, ElButton as B, ElIcon as D, ElDropdownMenu as I, ElDropdownItem as V } from "element-plus/es";
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/dropdown/style/css";
|
|
4
|
+
import "element-plus/es/components/dropdown-menu/style/css";
|
|
5
|
+
import "element-plus/es/components/dropdown-item/style/css";
|
|
3
6
|
import "element-plus/es/components/button/style/css";
|
|
4
7
|
import "element-plus/es/components/icon/style/css";
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { Refresh as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
8
|
+
import { defineComponent as C, useModel as M, computed as f, ref as E, watch as N, openBlock as u, createElementBlock as z, createElementVNode as g, createBlock as p, withCtx as o, createVNode as l, createTextVNode as d, unref as w, createCommentVNode as c, normalizeClass as T, mergeModels as U } from "vue";
|
|
9
|
+
import { ArrowDown as $, Refresh as j } from "@element-plus/icons-vue";
|
|
10
|
+
import q from "../misc/AutoRefresh.vue.mjs";
|
|
11
|
+
const G = { class: "table-toolbar" }, H = { class: "table-toolbar-left" }, J = { class: "table-toolbar-right" }, ee = /* @__PURE__ */ C({
|
|
9
12
|
__name: "TableToolbar",
|
|
10
|
-
props: /* @__PURE__ */
|
|
11
|
-
|
|
13
|
+
props: /* @__PURE__ */ U({
|
|
14
|
+
leftFeatures: {},
|
|
15
|
+
rightFeatures: {},
|
|
12
16
|
refreshInterval: { default: 30 },
|
|
17
|
+
exportFn: {},
|
|
13
18
|
tableExpose: {},
|
|
14
19
|
loading: { type: Boolean }
|
|
15
20
|
}, {
|
|
@@ -17,59 +22,115 @@ const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G =
|
|
|
17
22
|
isAutoRefreshModifiers: {}
|
|
18
23
|
}),
|
|
19
24
|
emits: ["update:isAutoRefresh"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
() =>
|
|
23
|
-
),
|
|
24
|
-
() =>
|
|
25
|
-
),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
setup(n) {
|
|
26
|
+
const t = n, v = M(n, "isAutoRefresh"), x = f(
|
|
27
|
+
() => t.leftFeatures === void 0 || t.leftFeatures.includes("export")
|
|
28
|
+
), F = f(
|
|
29
|
+
() => t.rightFeatures === void 0 || t.rightFeatures.includes("refresh")
|
|
30
|
+
), _ = f(
|
|
31
|
+
() => t.rightFeatures === void 0 || t.rightFeatures.includes("autoRefresh")
|
|
32
|
+
), i = E(30);
|
|
33
|
+
N(
|
|
34
|
+
() => t.refreshInterval,
|
|
35
|
+
(a) => {
|
|
36
|
+
i.value = a;
|
|
30
37
|
},
|
|
31
38
|
{ immediate: !0 }
|
|
32
39
|
);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
(
|
|
40
|
+
const r = E(!1), R = (a) => {
|
|
41
|
+
r.value || !t.exportFn || (r.value = !0, t.exportFn(a).catch(() => {
|
|
42
|
+
}).finally(() => {
|
|
43
|
+
r.value = !1;
|
|
44
|
+
}));
|
|
36
45
|
};
|
|
37
|
-
return (
|
|
38
|
-
const b =
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
return (a, e) => {
|
|
47
|
+
const h = D, b = B, m = V, y = I, A = k;
|
|
48
|
+
return u(), z("div", G, [
|
|
49
|
+
g("div", H, [
|
|
50
|
+
x.value ? (u(), p(A, {
|
|
42
51
|
key: 0,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
disabled: r.value,
|
|
53
|
+
onCommand: R
|
|
54
|
+
}, {
|
|
55
|
+
dropdown: o(() => [
|
|
56
|
+
l(y, null, {
|
|
57
|
+
default: o(() => [
|
|
58
|
+
l(m, { command: "selected" }, {
|
|
59
|
+
default: o(() => [...e[4] || (e[4] = [
|
|
60
|
+
d("导出选择", -1)
|
|
61
|
+
])]),
|
|
62
|
+
_: 1
|
|
63
|
+
}),
|
|
64
|
+
l(m, { command: "current" }, {
|
|
65
|
+
default: o(() => [...e[5] || (e[5] = [
|
|
66
|
+
d("导出本页", -1)
|
|
67
|
+
])]),
|
|
68
|
+
_: 1
|
|
69
|
+
}),
|
|
70
|
+
l(m, { command: "all" }, {
|
|
71
|
+
default: o(() => [...e[6] || (e[6] = [
|
|
72
|
+
d("导出全部", -1)
|
|
73
|
+
])]),
|
|
74
|
+
_: 1
|
|
75
|
+
})
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
default: o(() => [
|
|
81
|
+
l(b, {
|
|
82
|
+
size: "small",
|
|
83
|
+
type: "primary",
|
|
84
|
+
loading: r.value
|
|
85
|
+
}, {
|
|
86
|
+
default: o(() => [
|
|
87
|
+
e[3] || (e[3] = d(" 导出 ", -1)),
|
|
88
|
+
l(h, null, {
|
|
89
|
+
default: o(() => [
|
|
90
|
+
l(w($))
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
})
|
|
94
|
+
]),
|
|
95
|
+
_: 1
|
|
96
|
+
}, 8, ["loading"])
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["disabled"])) : c("", !0)
|
|
100
|
+
]),
|
|
101
|
+
g("div", J, [
|
|
102
|
+
_.value ? (u(), p(q, {
|
|
103
|
+
key: 0,
|
|
104
|
+
modelValue: v.value,
|
|
105
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => v.value = s),
|
|
106
|
+
interval: i.value,
|
|
107
|
+
"onUpdate:interval": e[1] || (e[1] = (s) => i.value = s),
|
|
108
|
+
refreshFn: t.tableExpose.refresh,
|
|
109
|
+
enabled: !n.loading
|
|
110
|
+
}, null, 8, ["modelValue", "interval", "refreshFn", "enabled"])) : c("", !0),
|
|
111
|
+
F.value ? (u(), p(b, {
|
|
52
112
|
key: 1,
|
|
113
|
+
size: "small",
|
|
53
114
|
circle: "",
|
|
54
|
-
onClick:
|
|
115
|
+
onClick: e[2] || (e[2] = (s) => t.tableExpose.refresh())
|
|
55
116
|
}, {
|
|
56
|
-
default:
|
|
57
|
-
h
|
|
58
|
-
class:
|
|
117
|
+
default: o(() => [
|
|
118
|
+
l(h, {
|
|
119
|
+
class: T({ "table-toolbar-icon--rotating": n.loading })
|
|
59
120
|
}, {
|
|
60
|
-
default:
|
|
61
|
-
|
|
121
|
+
default: o(() => [
|
|
122
|
+
l(w(j))
|
|
62
123
|
]),
|
|
63
124
|
_: 1
|
|
64
125
|
}, 8, ["class"])
|
|
65
126
|
]),
|
|
66
127
|
_: 1
|
|
67
|
-
})) :
|
|
128
|
+
})) : c("", !0)
|
|
68
129
|
])
|
|
69
130
|
]);
|
|
70
131
|
};
|
|
71
132
|
}
|
|
72
133
|
});
|
|
73
134
|
export {
|
|
74
|
-
|
|
135
|
+
ee as default
|
|
75
136
|
};
|
package/es/hooks/activated.mjs
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
const
|
|
3
|
-
const e =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { watch as d, ref as n, computed as c, onMounted as o, onActivated as s, onDeactivated as r, onBeforeUnmount as u } from "vue";
|
|
2
|
+
const v = () => {
|
|
3
|
+
const e = n({
|
|
4
|
+
isActivated: !1,
|
|
5
|
+
triggerType: "mounted"
|
|
6
|
+
}), i = c(() => e.value.isActivated), t = (a) => {
|
|
7
|
+
e.value = a;
|
|
8
|
+
};
|
|
9
|
+
return o(() => {
|
|
10
|
+
t({ isActivated: !0, triggerType: "mounted" }), s(() => {
|
|
11
|
+
t({ isActivated: !0, triggerType: "activated" });
|
|
7
12
|
});
|
|
8
|
-
}),
|
|
9
|
-
|
|
10
|
-
}),
|
|
11
|
-
|
|
13
|
+
}), r(() => {
|
|
14
|
+
t({ isActivated: !1, triggerType: "deactivated" });
|
|
15
|
+
}), u(() => {
|
|
16
|
+
t({ isActivated: !1, triggerType: "unmounted" });
|
|
12
17
|
}), {
|
|
13
|
-
isActivated:
|
|
18
|
+
isActivated: i,
|
|
19
|
+
activatedInfo: c(() => e.value)
|
|
14
20
|
};
|
|
15
|
-
},
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
+
}, g = (e) => {
|
|
22
|
+
const { activatedInfo: i } = v();
|
|
23
|
+
d(
|
|
24
|
+
i,
|
|
25
|
+
(t) => {
|
|
26
|
+
t.isActivated && e(t);
|
|
21
27
|
},
|
|
22
28
|
{
|
|
23
29
|
immediate: !0
|
|
24
30
|
}
|
|
25
31
|
);
|
|
26
|
-
},
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
+
}, m = (e, i) => {
|
|
33
|
+
const { activatedInfo: t } = v();
|
|
34
|
+
d(
|
|
35
|
+
t,
|
|
36
|
+
(a) => {
|
|
37
|
+
a.isActivated ? e(a) : i(a);
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
immediate: !0
|
|
@@ -36,7 +42,7 @@ const c = () => {
|
|
|
36
42
|
);
|
|
37
43
|
};
|
|
38
44
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
v as useActivated,
|
|
46
|
+
m as useActivatedEvent,
|
|
47
|
+
g as useActivatedExec
|
|
42
48
|
};
|
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-
|
|
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-60e049ad]{display:flex;justify-content:space-between;align-items:center;padding-bottom:8px;gap:20px}.table-toolbar-left[data-v-60e049ad],.table-toolbar-right[data-v-60e049ad]{display:flex;align-items:center;gap:10px}.table-toolbar-icon--rotating[data-v-60e049ad]{animation:table-toolbar-rotating-60e049ad 1s linear infinite}@keyframes table-toolbar-rotating-60e049ad{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-643017c3]{--el-table-header-bg-color: var(--v4c03ff8f)}.table-main-pagination[data-v-643017c3]{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}
|
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.2",
|
|
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": "ab2bb3cbded6a375d254e49281d93383534afabe"
|
|
81
81
|
}
|
|
@@ -16,6 +16,7 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
16
16
|
tableMainProps?: Partial<Omit<import('../table').TableMainProps<T, import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ, ListPageInnerInjectInfo<PO, F>>, import('./types').TableMainOptionsKey | import('./types').TableMainRewriteKey>> | undefined;
|
|
17
17
|
} & {
|
|
18
18
|
showOperation?: boolean;
|
|
19
|
+
showHeader?: boolean;
|
|
19
20
|
list?: FormItemConfigList<PO, SO> | undefined;
|
|
20
21
|
api: (params: import('../table').TableApiParams<import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ>) => Promise<import('../table').TableApiResult<T>>;
|
|
21
22
|
query?: SQ | undefined;
|
|
@@ -41,6 +42,7 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
41
42
|
injectInfo: ListPageInnerInjectInfo<PO, F>;
|
|
42
43
|
exposeInfo: TableMainInstance;
|
|
43
44
|
}) => any>> & {
|
|
45
|
+
header?(_: {}): any;
|
|
44
46
|
operation?(_: {}): any;
|
|
45
47
|
}>;
|
|
46
48
|
emit: {
|
|
@@ -26,6 +26,8 @@ F extends Record<string, any>> = Partial<Pick<FormSearchProps<PO, SO, {}>, FormS
|
|
|
26
26
|
} & {
|
|
27
27
|
/** 是否展示操作区 */
|
|
28
28
|
showOperation?: boolean;
|
|
29
|
+
/** 是否展示头部区 */
|
|
30
|
+
showHeader?: boolean;
|
|
29
31
|
list?: FormItemConfigList<PO, SO>;
|
|
30
32
|
/** api */
|
|
31
33
|
api: (params: TableApiParams<ExtractFormStringifyFromObject<PO, SO> & SQ>) => Promise<TableApiResult<T>>;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
2
2
|
modelValue: import('vue').PropType<boolean>;
|
|
3
3
|
interval: import('vue').PropType<number>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
refreshFn: {
|
|
5
|
+
type: globalThis.PropType<() => Promise<unknown>>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
enabled: {
|
|
9
|
+
type: globalThis.PropType<boolean>;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
9
13
|
modelValue: import('vue').PropType<boolean>;
|
|
10
14
|
interval: import('vue').PropType<number>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
refreshFn: {
|
|
16
|
+
type: globalThis.PropType<() => Promise<unknown>>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
enabled: {
|
|
20
|
+
type: globalThis.PropType<boolean>;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
}>> & Readonly<{}>, {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
14
26
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableMainInstance } from './types';
|
|
1
|
+
import { ExportType, TableMainInstance } from './types';
|
|
2
2
|
|
|
3
3
|
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
4
4
|
isAutoRefresh: import('vue').PropType<boolean>;
|
|
@@ -6,14 +6,19 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
6
6
|
type: globalThis.PropType<boolean>;
|
|
7
7
|
required: true;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
type: globalThis.PropType<
|
|
11
|
-
|
|
9
|
+
leftFeatures: {
|
|
10
|
+
type: globalThis.PropType<"export"[]>;
|
|
11
|
+
};
|
|
12
|
+
rightFeatures: {
|
|
13
|
+
type: globalThis.PropType<import('./types').TableToolbarRightFeature[]>;
|
|
12
14
|
};
|
|
13
15
|
refreshInterval: {
|
|
14
16
|
type: globalThis.PropType<number>;
|
|
15
17
|
default: number;
|
|
16
18
|
};
|
|
19
|
+
exportFn: {
|
|
20
|
+
type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
|
|
21
|
+
};
|
|
17
22
|
tableExpose: {
|
|
18
23
|
type: globalThis.PropType<TableMainInstance>;
|
|
19
24
|
required: true;
|
|
@@ -24,20 +29,24 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
|
|
|
24
29
|
type: globalThis.PropType<boolean>;
|
|
25
30
|
required: true;
|
|
26
31
|
};
|
|
27
|
-
|
|
28
|
-
type: globalThis.PropType<
|
|
29
|
-
|
|
32
|
+
leftFeatures: {
|
|
33
|
+
type: globalThis.PropType<"export"[]>;
|
|
34
|
+
};
|
|
35
|
+
rightFeatures: {
|
|
36
|
+
type: globalThis.PropType<import('./types').TableToolbarRightFeature[]>;
|
|
30
37
|
};
|
|
31
38
|
refreshInterval: {
|
|
32
39
|
type: globalThis.PropType<number>;
|
|
33
40
|
default: number;
|
|
34
41
|
};
|
|
42
|
+
exportFn: {
|
|
43
|
+
type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
|
|
44
|
+
};
|
|
35
45
|
tableExpose: {
|
|
36
46
|
type: globalThis.PropType<TableMainInstance>;
|
|
37
47
|
required: true;
|
|
38
48
|
};
|
|
39
49
|
}>> & Readonly<{}>, {
|
|
40
|
-
features: import('./types').TableToolbarFeature[];
|
|
41
50
|
refreshInterval: number;
|
|
42
51
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
43
52
|
export default _default;
|
|
@@ -24,19 +24,30 @@ export interface TableMainInstance {
|
|
|
24
24
|
reload: (slice?: boolean) => Promise<unknown>;
|
|
25
25
|
getTableInstance: () => TableInstance | undefined;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
export type
|
|
27
|
+
/** 导出类型 */
|
|
28
|
+
export type ExportType = "selected" | "current" | "all";
|
|
29
|
+
/** toolbar 左侧功能 */
|
|
30
|
+
export type TableToolbarLeftFeature = "export";
|
|
31
|
+
/** toolbar 右侧功能 */
|
|
32
|
+
export type TableToolbarRightFeature = "refresh" | "autoRefresh";
|
|
29
33
|
/** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
|
|
30
34
|
export interface TableToolbarConfig {
|
|
31
35
|
/**
|
|
32
|
-
*
|
|
33
|
-
* - undefined
|
|
34
|
-
* - []
|
|
35
|
-
* - 枚举子集:仅显示指定功能
|
|
36
|
+
* 左侧功能列表。
|
|
37
|
+
* - undefined(默认):显示所有左侧功能
|
|
38
|
+
* - [](空数组):不渲染左侧功能
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
leftFeatures?: TableToolbarLeftFeature[];
|
|
41
|
+
/**
|
|
42
|
+
* 右侧功能列表。
|
|
43
|
+
* - undefined(默认):显示所有右侧功能
|
|
44
|
+
* - [](空数组):不渲染右侧功能
|
|
45
|
+
*/
|
|
46
|
+
rightFeatures?: TableToolbarRightFeature[];
|
|
38
47
|
/** 自动刷新默认间隔(秒),默认 30 */
|
|
39
48
|
refreshInterval?: number;
|
|
49
|
+
/** 导出方法。传入导出类型,返回 Promise */
|
|
50
|
+
exportFn?: (type: ExportType) => Promise<unknown>;
|
|
40
51
|
}
|
|
41
52
|
/** 表格列默认作用域 */
|
|
42
53
|
export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
|
|
@@ -82,7 +93,7 @@ SQ extends Record<string, any>,
|
|
|
82
93
|
F extends Record<string, any>> {
|
|
83
94
|
/** 展示分页器 */
|
|
84
95
|
showPager?: boolean;
|
|
85
|
-
/** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.
|
|
96
|
+
/** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.leftFeatures / rightFeatures) */
|
|
86
97
|
showToolbar?: boolean;
|
|
87
98
|
/** toolbar 配置 */
|
|
88
99
|
toolbar?: TableToolbarConfig;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
/** 激活信息 */
|
|
2
|
+
export interface ActivatedInfo {
|
|
3
|
+
isActivated: boolean;
|
|
4
|
+
triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
|
|
5
|
+
}
|
|
1
6
|
/** 是否激活 */
|
|
2
7
|
export declare const useActivated: () => {
|
|
3
|
-
isActivated: globalThis.
|
|
8
|
+
isActivated: globalThis.ComputedRef<boolean>;
|
|
9
|
+
activatedInfo: globalThis.ComputedRef<{
|
|
10
|
+
isActivated: boolean;
|
|
11
|
+
triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
|
|
12
|
+
}>;
|
|
4
13
|
};
|
|
5
14
|
/** 激活时执行时间 */
|
|
6
|
-
export declare const useActivatedExec: (callback: () => void) => void;
|
|
15
|
+
export declare const useActivatedExec: (callback: (info: ActivatedInfo) => void) => void;
|
|
7
16
|
/** 激活时监听事件 */
|
|
8
|
-
export declare const useActivatedEvent: (bind: () => void, unbind: () => void) => void;
|
|
17
|
+
export declare const useActivatedEvent: (bind: (info: ActivatedInfo) => void, unbind: (info: ActivatedInfo) => void) => void;
|