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