@done-coding/admin-core 0.1.1-alpha.1 → 0.1.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/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 +32 -30
- package/es/components/table/TableMain.vue.mjs +2 -2
- package/es/components/table/TableMain.vue2.mjs +152 -134
- package/es/components/table/TableToolbar.vue.mjs +2 -2
- package/es/components/table/TableToolbar.vue2.mjs +157 -39
- package/es/helpers/list-helper.mjs +29 -33
- package/es/index.mjs +79 -74
- package/es/style.css +1 -1
- package/es/utils/export.mjs +23 -0
- package/package.json +2 -2
- package/types/components/list-page/ListPage.vue.d.ts +2 -0
- package/types/components/list-page/types.d.ts +2 -0
- package/types/components/table/TableToolbar.vue.d.ts +40 -8
- package/types/components/table/types.d.ts +42 -8
- package/types/utils/export.d.ts +23 -0
- package/types/utils/index.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./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,13 +1,14 @@
|
|
|
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: /* @__PURE__ */
|
|
11
|
+
props: /* @__PURE__ */ T({
|
|
11
12
|
refreshFn: {},
|
|
12
13
|
enabled: { type: Boolean, default: !0 }
|
|
13
14
|
}, {
|
|
@@ -17,45 +18,46 @@ const g = { class: "auto-refresh" }, _ = /* @__PURE__ */ N({
|
|
|
17
18
|
intervalModifiers: {}
|
|
18
19
|
}),
|
|
19
20
|
emits: ["update:modelValue", "update:interval"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
21
|
+
setup(n) {
|
|
22
|
+
const u = n, t = c(n, "modelValue"), l = c(n, "interval"), r = B(() => t.value && u.enabled), [b, m] = g();
|
|
22
23
|
let o = null;
|
|
23
|
-
const d = () => (o || (o =
|
|
24
|
+
const d = () => (o || (o = u.refreshFn().catch(() => {
|
|
24
25
|
}).finally(() => {
|
|
25
26
|
o = null;
|
|
26
|
-
})), o),
|
|
27
|
-
|
|
28
|
-
await d(),
|
|
29
|
-
},
|
|
27
|
+
})), o), i = () => {
|
|
28
|
+
b(async () => {
|
|
29
|
+
await d(), r.value && i();
|
|
30
|
+
}, l.value * 1e3);
|
|
30
31
|
};
|
|
31
|
-
return
|
|
32
|
-
a ?
|
|
33
|
-
}),
|
|
34
|
-
|
|
32
|
+
return k([r, l], ([a]) => {
|
|
33
|
+
a ? i() : m();
|
|
34
|
+
}), A(({ triggerType: a }) => {
|
|
35
|
+
r.value && (a === "activated" && (m(), d()), i());
|
|
35
36
|
}), (a, e) => {
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
|
|
37
|
+
const y = N, M = R;
|
|
38
|
+
return f(), p("div", C, [
|
|
39
|
+
t.value ? (f(), p(x, { key: 0 }, [
|
|
39
40
|
e[2] || (e[2] = v("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
|
|
40
|
-
V(
|
|
41
|
-
modelValue:
|
|
42
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
41
|
+
V(y, {
|
|
42
|
+
modelValue: l.value,
|
|
43
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => l.value = s),
|
|
43
44
|
min: 1,
|
|
44
45
|
step: 1,
|
|
45
46
|
size: "small",
|
|
46
47
|
class: "auto-refresh-interval"
|
|
47
48
|
}, null, 8, ["modelValue"]),
|
|
48
49
|
e[3] || (e[3] = v("span", { class: "auto-refresh-label" }, "秒", -1))
|
|
49
|
-
], 64)) :
|
|
50
|
-
V(
|
|
51
|
-
modelValue:
|
|
52
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
53
|
-
"active-
|
|
54
|
-
|
|
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"])
|
|
55
57
|
]);
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
});
|
|
59
61
|
export {
|
|
60
|
-
|
|
62
|
+
D as default
|
|
61
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
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f0f7753c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|