@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.
Files changed (36) 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 +1 -1
  13. package/es/components/table/TableMain.vue2.mjs +148 -133
  14. package/es/components/table/TableToolbar.vue.mjs +3 -3
  15. package/es/components/table/TableToolbar.vue2.mjs +154 -70
  16. package/es/components/table/ToolbarButtons.vue.mjs +49 -0
  17. package/es/components/table/ToolbarButtons.vue2.mjs +4 -0
  18. package/es/helpers/list-helper.mjs +29 -33
  19. package/es/index.mjs +104 -92
  20. package/es/style.css +1 -1
  21. package/es/utils/export.mjs +23 -0
  22. package/package.json +2 -2
  23. package/types/components/form/{FormDateTimeRange.vue.d.ts → FormDatePicker.vue.d.ts} +2 -2
  24. package/types/components/form/index.d.ts +2 -2
  25. package/types/components/form/utils.d.ts +3 -1
  26. package/types/components/misc/ActionButton.vue.d.ts +24 -0
  27. package/types/components/misc/ActionButtonDanger.vue.d.ts +19 -0
  28. package/types/components/misc/ActionButtonWarn.vue.d.ts +19 -0
  29. package/types/components/misc/index.d.ts +4 -1
  30. package/types/components/table/TableToolbar.vue.d.ts +66 -9
  31. package/types/components/table/ToolbarButtons.vue.d.ts +19 -0
  32. package/types/components/table/types.d.ts +64 -17
  33. package/types/utils/export.d.ts +30 -0
  34. package/types/utils/index.d.ts +1 -0
  35. package/es/components/form/FormDateTimeRange.vue.mjs +0 -46
  36. package/es/components/form/FormDateTimeRange.vue2.mjs +0 -4
@@ -1,21 +1,22 @@
1
- import { ElTable as ue, ElTableColumn as fe, ElEmpty as ge, ElPagination as pe } 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 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
- import U from "lodash/cloneDeep";
9
- import q from "lodash/omit";
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 W from "lodash/get";
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 { BODY_CONTENT_VIEWPORT_HEIGHT as Pe } from "../../inject/key.mjs";
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 Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, Ue = /* @__PURE__ */ de({
17
+ const He = { class: "table-main" }, Ne = { class: "table-main-pagination" }, We = /* @__PURE__ */ de({
17
18
  __name: "TableMain",
18
- props: /* @__PURE__ */ G({
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__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
40
- setup(u, { expose: Z, emit: Q }) {
41
- ce((e) => ({
42
- v4c03ff8f: 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
43
44
  }));
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
- Pe,
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 = d(() => a.showPager ? 35 : 0), k = d(() => {
50
- var n, _;
51
- if (a.showToolbar === !1) return !1;
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
- 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 - A.value,
63
+ e - N.value - O.value,
60
64
  200
61
65
  ) : t ? Math.max(
62
- te.value - N.value - A.value - a.refineReduceHeight,
66
+ te.value - N.value - O.value - r.refineReduceHeight,
63
67
  200
64
68
  ) : void 0;
65
- }), S = d(() => {
66
- const e = U(a.query || {});
67
- return D(e, T.PAGE_SIZE_KEY, i.value), D(
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
- o.value
74
+ n.value
71
75
  ), e;
72
- }), ae = d(() => ({
73
- ...a.tableProps,
74
- ...X
75
- })), K = (e, t = !0) => {
76
- const n = JSON.stringify(e) === JSON.stringify(S.value);
77
- return !n && t && console.warn(
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(S.value)}`
81
- ), n;
82
- }, j = (e = !1) => {
83
- if (!i.value) return;
84
- m.value ? console.warn("请求并发") : m.value = !0, e || (I.value = !0);
85
- const t = U(S.value);
86
- return a.api(t).then((n) => {
87
- K(t, !1) && (w.value = W(
88
- n,
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
- ), x.value = W(
91
- n,
102
+ ), E.value = F(
103
+ s,
92
104
  T.TOTAL_KEY
93
- ), h("pageInfoChange", {
94
- pageSize: i.value,
95
- currentPage: o.value,
96
- total: x.value
105
+ ), m("pageInfoChange", {
106
+ pageSize: l.value,
107
+ currentPage: n.value,
108
+ total: E.value
97
109
  }));
98
110
  }).finally(() => {
99
- K(t) && (m.value = !1, I.value = !1);
111
+ A(t) && (h.value = !1, w.value = !1);
100
112
  });
101
- }, B = async (e = !1) => {
113
+ }, K = async (e = !1) => {
102
114
  var t;
103
- return (t = j(e)) == null ? void 0 : t.catch(() => {
115
+ return (t = L(e)) == null ? void 0 : t.catch(() => {
104
116
  });
105
- }, oe = async (e = !1) => {
106
- if (o.value === 1)
107
- return B(e);
108
- o.value = 1;
109
- }, ne = (e) => e, v = {
110
- refresh: B,
111
- reload: oe,
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
- }, L = (e, t = []) => ({
114
- ...q(e, ["render", "headerRender"].concat(t)),
115
- injectInfo: a.injectInfo || {},
116
- exposeInfo: v
117
- }), M = (e) => ({
118
- ...q(e, ["render", "headerRender"]),
119
- injectInfo: a.injectInfo || {},
120
- exposeInfo: v
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
- Z(v);
134
+ W(y);
123
135
  const le = (e) => {
124
- i.value = e, o.value = 1;
125
- }, J = (e) => !e || e === "expand";
126
- return be(() => {
127
- i.value = a.pageSizeInit, Ce(() => {
128
- v.refresh();
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
- }), c(w, (e) => {
131
- h("dataChange", e);
132
- }), c(
133
- () => a.query,
142
+ }), d(S, (e) => {
143
+ m("dataChange", e);
144
+ }), d(
145
+ () => r.query,
134
146
  (e, t) => {
135
- JSON.stringify(e) !== JSON.stringify(t) && (o.value = 1);
147
+ JSON.stringify(e) !== JSON.stringify(t) && (n.value = 1);
136
148
  }
137
- ), c(
138
- S,
149
+ ), d(
150
+ x,
139
151
  (e, t) => {
140
- JSON.stringify(e) !== JSON.stringify(t) && j();
152
+ JSON.stringify(e) !== JSON.stringify(t) && L();
141
153
  },
142
154
  {
143
155
  immediate: !0
144
156
  }
145
- ), c(I, (e) => {
146
- h("loadingChange", e);
147
- }), c(i, (e) => {
148
- h("pageSizeChange", e);
149
- }), c(o, (e) => {
150
- h("pageChange", e);
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 n = fe, _ = ge, se = ue, ie = pe;
153
- return l(), y("div", Oe, [
154
- s(k) ? (l(), b(s(Re), {
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
- R(Ie, p({
160
- "is-auto-refresh": O.value,
161
- "onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => O.value = r),
162
- tableExpose: v,
163
- loading: s(m)
164
- }, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
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
- })) : Se("", !0),
168
- R(se, p({
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
- }, s(ae), {
176
- maxHeight: s(re),
177
- data: s(w),
190
+ }, a(re), {
191
+ maxHeight: a(oe),
192
+ data: a(S),
178
193
  rowKey: ne(u.rowKey)
179
194
  }), {
180
195
  empty: C(() => [
181
- s(m) ? (l(), y(E, { key: 0 }, [
182
- P("加载中...")
183
- ], 64)) : (l(), b(_, { key: 1 }))
196
+ a(h) ? (i(), v(_, { key: 0 }, [
197
+ I("加载中...")
198
+ ], 64)) : (i(), b(se, { key: 1 }))
184
199
  ]),
185
200
  default: C(() => [
186
- (l(!0), y(E, null, _e(u.columns, (r) => (l(), b(n, p({
187
- key: r.columnKey || r.prop
188
- }, { ref_for: !0 }, r), Ee({ _: 2 }, [
189
- J(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) ? {
190
205
  name: "default",
191
- fn: C((f) => [
192
- V(e.$slots, r.prop, p({ ref_for: !0 }, L(f)), () => [
193
- r.render ? (l(), b($(r.render), p({
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
- }, L(f, ["$index"]), {
197
- _index: f.$index
198
- }), null, 16, ["_index"])) : (l(), y(E, { key: 1 }, [
199
- P(Y(f.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)
200
215
  ], 64))
201
216
  ], !0)
202
217
  ]),
203
218
  key: "0"
204
219
  } : void 0,
205
- J(r.type) ? {
220
+ M(o.type) ? {
206
221
  name: "header",
207
- fn: C((f) => [
208
- V(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, M(f)), () => [
209
- r.headerRender ? (l(), b($(r.headerRender), p({
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
- }, M(f)), null, 16)) : (l(), y(E, { key: 1 }, [
213
- P(Y(r.label), 1)
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", ze, [
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),
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: s(x),
248
+ total: a(E),
234
249
  onSizeChange: le
235
250
  }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
236
251
  ], 512), [
237
- [xe, u.showPager]
252
+ [Pe, u.showPager]
238
253
  ])
239
254
  ]);
240
255
  };
241
256
  }
242
257
  });
243
258
  export {
244
- Ue as default
259
+ We as default
245
260
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableToolbar.vue2.mjs";
2
2
  /* empty css */
3
- import a from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-60e049ad"]]);
3
+ import r from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-66ef498f"]]);
5
5
  export {
6
- m as default
6
+ e as default
7
7
  };