@done-coding/admin-core 0.1.1-alpha.2 → 0.1.1-alpha.4
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/form/FormDatePicker.vue.mjs +7 -0
- package/es/components/form/FormDatePicker.vue2.mjs +50 -0
- package/es/components/form/index.mjs +19 -19
- package/es/components/form/utils.mjs +82 -61
- package/es/components/misc/ActionButton.vue.mjs +52 -0
- package/es/components/misc/ActionButton.vue2.mjs +4 -0
- package/es/components/misc/ActionButtonDanger.vue.mjs +32 -0
- package/es/components/misc/ActionButtonDanger.vue2.mjs +4 -0
- package/es/components/misc/ActionButtonWarn.vue.mjs +32 -0
- package/es/components/misc/ActionButtonWarn.vue2.mjs +4 -0
- package/es/components/misc/index.mjs +21 -9
- package/es/components/table/TableMain.vue.mjs +1 -1
- package/es/components/table/TableMain.vue2.mjs +148 -133
- package/es/components/table/TableToolbar.vue.mjs +3 -3
- package/es/components/table/TableToolbar.vue2.mjs +154 -70
- package/es/components/table/ToolbarButtons.vue.mjs +49 -0
- package/es/components/table/ToolbarButtons.vue2.mjs +4 -0
- package/es/helpers/list-helper.mjs +29 -33
- package/es/index.mjs +104 -92
- package/es/style.css +1 -1
- package/es/utils/export.mjs +23 -0
- package/package.json +2 -2
- package/types/components/form/{FormDateTimeRange.vue.d.ts → FormDatePicker.vue.d.ts} +2 -2
- package/types/components/form/index.d.ts +2 -2
- package/types/components/form/utils.d.ts +3 -1
- package/types/components/misc/ActionButton.vue.d.ts +24 -0
- package/types/components/misc/ActionButtonDanger.vue.d.ts +19 -0
- package/types/components/misc/ActionButtonWarn.vue.d.ts +19 -0
- package/types/components/misc/index.d.ts +4 -1
- package/types/components/table/TableToolbar.vue.d.ts +66 -9
- package/types/components/table/ToolbarButtons.vue.d.ts +19 -0
- package/types/components/table/types.d.ts +64 -17
- package/types/utils/export.d.ts +30 -0
- package/types/utils/index.d.ts +1 -0
- package/es/components/form/FormDateTimeRange.vue.mjs +0 -46
- package/es/components/form/FormDateTimeRange.vue2.mjs +0 -4
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { ElTable as
|
|
1
|
+
import { ElTable as fe, ElTableColumn as ge, ElEmpty as pe, ElPagination as ce } 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 de, useCssVars as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import { defineComponent as de, useCssVars as me, useModel as he, useAttrs as ye, ref as f, computed as c, shallowRef as ve, inject as be, onMounted as Ce, onActivated as Se, watch as d, openBlock as i, createElementBlock as v, createBlock as b, unref as a, withCtx as C, createVNode as P, mergeProps as p, createCommentVNode as Ee, Fragment as _, renderList as xe, createSlots as _e, renderSlot as J, resolveDynamicComponent as $, createTextVNode as I, toDisplayString as V, withDirectives as Te, createElementVNode as we, isRef as Y, vShow as Pe, mergeModels as q } from "vue";
|
|
8
|
+
import G from "lodash/cloneDeep";
|
|
9
|
+
import U from "lodash/omit";
|
|
10
10
|
import D from "lodash/set";
|
|
11
|
-
import
|
|
11
|
+
import F from "lodash/get";
|
|
12
12
|
import Ie from "./TableToolbar.vue.mjs";
|
|
13
13
|
import Re from "../display/WatchSize.vue.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { pickExportColumns as ze } from "../../utils/export.mjs";
|
|
15
|
+
import { BODY_CONTENT_VIEWPORT_HEIGHT as ke } from "../../inject/key.mjs";
|
|
15
16
|
import { APP_API_LIST_MODEL_KEY_CONFIG as T } from "../../config/list-model.mjs";
|
|
16
|
-
const
|
|
17
|
+
const He = { class: "table-main" }, Ne = { class: "table-main-pagination" }, We = /* @__PURE__ */ de({
|
|
17
18
|
__name: "TableMain",
|
|
18
|
-
props: /* @__PURE__ */
|
|
19
|
+
props: /* @__PURE__ */ q({
|
|
19
20
|
showPager: { type: Boolean, default: !0 },
|
|
20
21
|
showToolbar: { type: Boolean, default: !0 },
|
|
21
22
|
toolbar: {},
|
|
@@ -36,181 +37,195 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue
|
|
|
36
37
|
isAutoRefresh: { type: Boolean },
|
|
37
38
|
isAutoRefreshModifiers: {}
|
|
38
39
|
}),
|
|
39
|
-
emits: /* @__PURE__ */
|
|
40
|
-
setup(u, { expose:
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
emits: /* @__PURE__ */ q(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
|
|
41
|
+
setup(u, { expose: W, emit: Z }) {
|
|
42
|
+
me((e) => ({
|
|
43
|
+
v131e457a: e.headerColor
|
|
43
44
|
}));
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const r = u, m = Z, R = he(u, "isAutoRefresh"), Q = ye(), S = f([]), E = f(0), l = f(0), n = f(1), h = f(!1), w = f(!1), z = f([]), X = c(() => ({
|
|
46
|
+
columns: ze(r.columns),
|
|
47
|
+
selectedList: z.value,
|
|
48
|
+
currentPageList: S.value,
|
|
49
|
+
api: r.api,
|
|
50
|
+
query: r.query || {},
|
|
51
|
+
total: E.value,
|
|
52
|
+
hasSelection: r.columns.some((e) => e.type === "selection")
|
|
53
|
+
})), k = f(0), ee = (e) => {
|
|
54
|
+
k.value = e;
|
|
55
|
+
}, H = ve(), te = be(
|
|
56
|
+
ke,
|
|
48
57
|
500
|
|
49
|
-
), N =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
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
|
-
const { maxHeight: e, refine: t } = a;
|
|
58
|
+
), N = c(() => r.showPager ? 35 : 0), O = c(
|
|
59
|
+
() => r.showToolbar ? k.value : 0
|
|
60
|
+
), oe = c(() => {
|
|
61
|
+
const { maxHeight: e, refine: t } = r;
|
|
58
62
|
return e ? Math.max(
|
|
59
|
-
e - N.value -
|
|
63
|
+
e - N.value - O.value,
|
|
60
64
|
200
|
|
61
65
|
) : t ? Math.max(
|
|
62
|
-
te.value - N.value -
|
|
66
|
+
te.value - N.value - O.value - r.refineReduceHeight,
|
|
63
67
|
200
|
|
64
68
|
) : void 0;
|
|
65
|
-
}),
|
|
66
|
-
const e =
|
|
67
|
-
return D(e, T.PAGE_SIZE_KEY,
|
|
69
|
+
}), x = c(() => {
|
|
70
|
+
const e = G(r.query || {});
|
|
71
|
+
return D(e, T.PAGE_SIZE_KEY, l.value), D(
|
|
68
72
|
e,
|
|
69
73
|
T.CURRENT_PAGE_KEY,
|
|
70
|
-
|
|
74
|
+
n.value
|
|
71
75
|
), e;
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
}), re = c(() => {
|
|
77
|
+
var t;
|
|
78
|
+
const e = (t = r.tableProps) == null ? void 0 : t.onSelectionChange;
|
|
79
|
+
return {
|
|
80
|
+
...r.tableProps,
|
|
81
|
+
...Q,
|
|
82
|
+
/** 合并内部选中存储与外部 onSelectionChange */
|
|
83
|
+
onSelectionChange: (s) => {
|
|
84
|
+
z.value = s, e == null || e(s);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}), A = (e, t = !0) => {
|
|
88
|
+
const s = JSON.stringify(e) === JSON.stringify(x.value);
|
|
89
|
+
return !s && t && console.warn(
|
|
78
90
|
`同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
|
|
79
91
|
e
|
|
80
|
-
)} => ${JSON.stringify(
|
|
81
|
-
),
|
|
82
|
-
},
|
|
83
|
-
if (!
|
|
84
|
-
|
|
85
|
-
const t =
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
)} => ${JSON.stringify(x.value)}`
|
|
93
|
+
), s;
|
|
94
|
+
}, L = (e = !1) => {
|
|
95
|
+
if (!l.value) return;
|
|
96
|
+
h.value ? console.warn("请求并发") : h.value = !0, e || (w.value = !0);
|
|
97
|
+
const t = G(x.value);
|
|
98
|
+
return r.api(t).then((s) => {
|
|
99
|
+
A(t, !1) && (S.value = F(
|
|
100
|
+
s,
|
|
89
101
|
T.LIST_KEY
|
|
90
|
-
),
|
|
91
|
-
|
|
102
|
+
), E.value = F(
|
|
103
|
+
s,
|
|
92
104
|
T.TOTAL_KEY
|
|
93
|
-
),
|
|
94
|
-
pageSize:
|
|
95
|
-
currentPage:
|
|
96
|
-
total:
|
|
105
|
+
), m("pageInfoChange", {
|
|
106
|
+
pageSize: l.value,
|
|
107
|
+
currentPage: n.value,
|
|
108
|
+
total: E.value
|
|
97
109
|
}));
|
|
98
110
|
}).finally(() => {
|
|
99
|
-
|
|
111
|
+
A(t) && (h.value = !1, w.value = !1);
|
|
100
112
|
});
|
|
101
|
-
},
|
|
113
|
+
}, K = async (e = !1) => {
|
|
102
114
|
var t;
|
|
103
|
-
return (t =
|
|
115
|
+
return (t = L(e)) == null ? void 0 : t.catch(() => {
|
|
104
116
|
});
|
|
105
|
-
},
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
}, ne = (e) => e,
|
|
110
|
-
refresh:
|
|
111
|
-
reload:
|
|
117
|
+
}, ae = async (e = !1) => {
|
|
118
|
+
if (n.value === 1)
|
|
119
|
+
return K(e);
|
|
120
|
+
n.value = 1;
|
|
121
|
+
}, ne = (e) => e, y = {
|
|
122
|
+
refresh: K,
|
|
123
|
+
reload: ae,
|
|
112
124
|
getTableInstance: () => H.value
|
|
113
|
-
},
|
|
114
|
-
...
|
|
115
|
-
injectInfo:
|
|
116
|
-
exposeInfo:
|
|
117
|
-
}),
|
|
118
|
-
...
|
|
119
|
-
injectInfo:
|
|
120
|
-
exposeInfo:
|
|
125
|
+
}, j = (e, t = []) => ({
|
|
126
|
+
...U(e, ["render", "headerRender"].concat(t)),
|
|
127
|
+
injectInfo: r.injectInfo || {},
|
|
128
|
+
exposeInfo: y
|
|
129
|
+
}), B = (e) => ({
|
|
130
|
+
...U(e, ["render", "headerRender"]),
|
|
131
|
+
injectInfo: r.injectInfo || {},
|
|
132
|
+
exposeInfo: y
|
|
121
133
|
});
|
|
122
|
-
|
|
134
|
+
W(y);
|
|
123
135
|
const le = (e) => {
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
l.value = e, n.value = 1;
|
|
137
|
+
}, M = (e) => !e || e === "expand";
|
|
138
|
+
return Ce(() => {
|
|
139
|
+
l.value = r.pageSizeInit, Se(() => {
|
|
140
|
+
y.refresh();
|
|
129
141
|
});
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
() =>
|
|
142
|
+
}), d(S, (e) => {
|
|
143
|
+
m("dataChange", e);
|
|
144
|
+
}), d(
|
|
145
|
+
() => r.query,
|
|
134
146
|
(e, t) => {
|
|
135
|
-
JSON.stringify(e) !== JSON.stringify(t) && (
|
|
147
|
+
JSON.stringify(e) !== JSON.stringify(t) && (n.value = 1);
|
|
136
148
|
}
|
|
137
|
-
),
|
|
138
|
-
|
|
149
|
+
), d(
|
|
150
|
+
x,
|
|
139
151
|
(e, t) => {
|
|
140
|
-
JSON.stringify(e) !== JSON.stringify(t) &&
|
|
152
|
+
JSON.stringify(e) !== JSON.stringify(t) && L();
|
|
141
153
|
},
|
|
142
154
|
{
|
|
143
155
|
immediate: !0
|
|
144
156
|
}
|
|
145
|
-
),
|
|
146
|
-
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
}),
|
|
150
|
-
|
|
157
|
+
), d(w, (e) => {
|
|
158
|
+
m("loadingChange", e);
|
|
159
|
+
}), d(l, (e) => {
|
|
160
|
+
m("pageSizeChange", e);
|
|
161
|
+
}), d(n, (e) => {
|
|
162
|
+
m("pageChange", e);
|
|
151
163
|
}), (e, t) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
|
|
164
|
+
const s = ge, se = pe, ie = fe, ue = ce;
|
|
165
|
+
return i(), v("div", He, [
|
|
166
|
+
u.showToolbar ? (i(), b(a(Re), {
|
|
155
167
|
key: 0,
|
|
156
168
|
onHeightChange: ee
|
|
157
169
|
}, {
|
|
158
170
|
default: C(() => [
|
|
159
|
-
|
|
160
|
-
"is-auto-refresh":
|
|
161
|
-
"onUpdate:isAutoRefresh": t[0] || (t[0] = (
|
|
162
|
-
tableExpose:
|
|
163
|
-
loading:
|
|
164
|
-
|
|
171
|
+
P(Ie, p({
|
|
172
|
+
"is-auto-refresh": R.value,
|
|
173
|
+
"onUpdate:isAutoRefresh": t[0] || (t[0] = (o) => R.value = o),
|
|
174
|
+
tableExpose: y,
|
|
175
|
+
loading: a(h),
|
|
176
|
+
exportContext: a(X),
|
|
177
|
+
currentPage: a(n),
|
|
178
|
+
pageSize: a(l)
|
|
179
|
+
}, u.toolbar), null, 16, ["is-auto-refresh", "loading", "exportContext", "currentPage", "pageSize"])
|
|
165
180
|
]),
|
|
166
181
|
_: 1
|
|
167
|
-
})) :
|
|
168
|
-
|
|
182
|
+
})) : Ee("", !0),
|
|
183
|
+
P(ie, p({
|
|
169
184
|
ref_key: "elTable",
|
|
170
185
|
ref: H,
|
|
171
186
|
class: "table-main-table",
|
|
172
187
|
stripe: "",
|
|
173
188
|
border: "",
|
|
174
189
|
highlightCurrentRow: ""
|
|
175
|
-
},
|
|
176
|
-
maxHeight:
|
|
177
|
-
data:
|
|
190
|
+
}, a(re), {
|
|
191
|
+
maxHeight: a(oe),
|
|
192
|
+
data: a(S),
|
|
178
193
|
rowKey: ne(u.rowKey)
|
|
179
194
|
}), {
|
|
180
195
|
empty: C(() => [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
], 64)) : (
|
|
196
|
+
a(h) ? (i(), v(_, { key: 0 }, [
|
|
197
|
+
I("加载中...")
|
|
198
|
+
], 64)) : (i(), b(se, { key: 1 }))
|
|
184
199
|
]),
|
|
185
200
|
default: C(() => [
|
|
186
|
-
(
|
|
187
|
-
key:
|
|
188
|
-
}, { ref_for: !0 },
|
|
189
|
-
|
|
201
|
+
(i(!0), v(_, null, xe(u.columns, (o) => (i(), b(s, p({
|
|
202
|
+
key: o.columnKey || o.prop
|
|
203
|
+
}, { ref_for: !0 }, o), _e({ _: 2 }, [
|
|
204
|
+
M(o.type) ? {
|
|
190
205
|
name: "default",
|
|
191
|
-
fn: C((
|
|
192
|
-
|
|
193
|
-
|
|
206
|
+
fn: C((g) => [
|
|
207
|
+
J(e.$slots, o.prop, p({ ref_for: !0 }, j(g)), () => [
|
|
208
|
+
o.render ? (i(), b($(o.render), p({
|
|
194
209
|
key: 0,
|
|
195
210
|
ref_for: !0
|
|
196
|
-
},
|
|
197
|
-
_index:
|
|
198
|
-
}), null, 16, ["_index"])) : (
|
|
199
|
-
|
|
211
|
+
}, j(g, ["$index"]), {
|
|
212
|
+
_index: g.$index
|
|
213
|
+
}), null, 16, ["_index"])) : (i(), v(_, { key: 1 }, [
|
|
214
|
+
I(V(g.row[o.prop]), 1)
|
|
200
215
|
], 64))
|
|
201
216
|
], !0)
|
|
202
217
|
]),
|
|
203
218
|
key: "0"
|
|
204
219
|
} : void 0,
|
|
205
|
-
|
|
220
|
+
M(o.type) ? {
|
|
206
221
|
name: "header",
|
|
207
|
-
fn: C((
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
fn: C((g) => [
|
|
223
|
+
J(e.$slots, `header-${o.prop}`, p({ ref_for: !0 }, B(g)), () => [
|
|
224
|
+
o.headerRender ? (i(), b($(o.headerRender), p({
|
|
210
225
|
key: 0,
|
|
211
226
|
ref_for: !0
|
|
212
|
-
},
|
|
213
|
-
|
|
227
|
+
}, B(g)), null, 16)) : (i(), v(_, { key: 1 }, [
|
|
228
|
+
I(V(o.label), 1)
|
|
214
229
|
], 64))
|
|
215
230
|
], !0)
|
|
216
231
|
]),
|
|
@@ -220,26 +235,26 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue
|
|
|
220
235
|
]),
|
|
221
236
|
_: 3
|
|
222
237
|
}, 16, ["maxHeight", "data", "rowKey"]),
|
|
223
|
-
Te(we("div",
|
|
224
|
-
|
|
225
|
-
"current-page":
|
|
226
|
-
"onUpdate:currentPage": t[1] || (t[1] = (
|
|
227
|
-
"page-size":
|
|
228
|
-
"onUpdate:pageSize": t[2] || (t[2] = (
|
|
238
|
+
Te(we("div", Ne, [
|
|
239
|
+
P(ue, {
|
|
240
|
+
"current-page": a(n),
|
|
241
|
+
"onUpdate:currentPage": t[1] || (t[1] = (o) => Y(n) ? n.value = o : null),
|
|
242
|
+
"page-size": a(l),
|
|
243
|
+
"onUpdate:pageSize": t[2] || (t[2] = (o) => Y(l) ? l.value = o : null),
|
|
229
244
|
"page-sizes": u.pageSizeOptions,
|
|
230
245
|
size: "small",
|
|
231
246
|
background: "",
|
|
232
247
|
layout: u.pageLayout,
|
|
233
|
-
total:
|
|
248
|
+
total: a(E),
|
|
234
249
|
onSizeChange: le
|
|
235
250
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
|
|
236
251
|
], 512), [
|
|
237
|
-
[
|
|
252
|
+
[Pe, u.showPager]
|
|
238
253
|
])
|
|
239
254
|
]);
|
|
240
255
|
};
|
|
241
256
|
}
|
|
242
257
|
});
|
|
243
258
|
export {
|
|
244
|
-
|
|
259
|
+
We as default
|
|
245
260
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TableToolbar.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-66ef498f"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|