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