@done-coding/admin-core 0.1.1-alpha.0 → 0.1.1-alpha.2

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.
@@ -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 p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a578c778"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-182577bf"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,20 +1,20 @@
1
- import { ElLoadingDirective as te } from "element-plus/es";
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 re, useCssVars as ae, unref as a, useModel as oe, ref as c, shallowRef as O, inject as ne, computed as s, watch as se, withDirectives as ie, openBlock as j, createElementBlock as le, createVNode as k, mergeProps as y, createSlots as F, renderList as b, withCtx as g, renderSlot as d, normalizeProps as T, guardReactiveProps as $, createBlock as ue, createCommentVNode as ce, mergeModels as A } from "vue";
5
- import fe from "../form/FormSearch.vue.mjs";
6
- import { generateFormData as he, stringifyFormData as ge } from "../form/utils.mjs";
7
- import de from "../display/WatchSize.vue.mjs";
8
- import me from "../table/TableMain.vue.mjs";
9
- import pe from "lodash/pick";
10
- import ve from "lodash/cloneDeep";
11
- import { BODY_CONTENT_VIEWPORT_HEIGHT as ye } from "../../inject/key.mjs";
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
- }, ke = /* @__PURE__ */ re({
15
+ }, Fe = /* @__PURE__ */ le({
16
16
  __name: "ListPage",
17
- props: /* @__PURE__ */ A({
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__ */ A(["dataChange", "pageInfoChange"], ["update:isAutoRefresh"]),
37
- setup(n, { expose: x, emit: B }) {
38
- ae((e) => ({
39
- bb4a2a8e: a(q)
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 = B, m = oe(n, "isAutoRefresh"), p = c({}), v = c(
42
+ const o = n, S = N, m = ce(n, "isAutoRefresh"), v = u({}), p = u(
42
43
  {}
43
- ), C = c(!1), i = O(), u = O(), E = ne(
44
- ye,
44
+ ), b = u(!1), i = O(), c = O(), q = he(
45
+ Se,
45
46
  500
46
- ), H = c(0), R = c(0), V = s(() => ({
47
- ...v.value,
47
+ ), w = u(0), R = u(0), I = u(0), L = s(() => ({
48
+ ...p.value,
48
49
  ...o.staticQuery
49
- })), w = c(!1), K = s(() => w.value ? H.value + 10 : 0), N = s(() => o.showOperation ? R.value + 10 : 0), I = s(() => E.value - o.refineReduceHeight), q = s(() => o.refine ? `${I.value}px` : "auto"), L = s(() => o.refine ? Math.max(
50
- I.value - K.value - N.value,
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), M = (e, t = "search") => {
53
- var r, l, h;
54
- let f = e;
55
- if (o.beforeSearch && (f = o.beforeSearch(
56
- ve(e),
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 = u.value) == null ? void 0 : r.getTableInstance()) == null || l.clearFilter()), JSON.stringify(f) === JSON.stringify(v.value))
59
- return ["reset", "search"].includes(t) ? (h = u.value) == null ? void 0 : h.reload() : void 0;
60
- v.value = {
61
- ...f
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
- }, J = (e) => {
64
+ }, W = (e) => {
64
65
  S("dataChange", e);
65
- }, Q = (e) => {
66
+ }, Y = (e) => {
66
67
  S("pageInfoChange", e);
67
- }, z = (e) => {
68
- C.value = e;
69
- }, G = (e) => {
70
- H.value = e;
71
- }, U = (e) => {
68
+ }, X = (e) => {
69
+ b.value = e;
70
+ }, Z = (e) => {
71
+ w.value = e;
72
+ }, _ = (e) => {
72
73
  R.value = e;
73
- }, W = s(() => o.list), Y = s(() => o.rowKey), P = s(() => p.value), D = {
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 = u.value) == null ? void 0 : t.refresh(e);
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 = u.value) == null ? void 0 : t.reload(e);
83
+ return (t = c.value) == null ? void 0 : t.reload(e);
81
84
  },
82
85
  getTableInstance: () => {
83
86
  var e;
84
- return (e = u.value) == null ? void 0 : e.getTableInstance();
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
- p.value[e] = t;
111
+ v.value[e] = t;
109
112
  }
110
- }, X = s(() => {
111
- const e = pe(D, [
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
- }), Z = (e) => e, _ = (e) => e, ee = (e) => {
121
- w.value = e;
123
+ }), oe = (e) => e, ne = (e) => e, se = (e) => {
124
+ M.value = e;
122
125
  };
123
- return x(D), se(
126
+ return K(D), fe(
124
127
  () => o.list,
125
128
  (e) => {
126
- const t = he(e);
127
- p.value = t, M(ge(t, e));
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 f = te;
134
- return ie((j(), le("div", be, [
135
- k(a(fe), y({
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(W),
139
- data: a(P)
151
+ list: a(te),
152
+ data: a(k)
140
153
  }, n.formSearchProps, {
141
- onSearch: M,
142
- onHeightChange: G,
143
- onVisibleChange: ee
144
- }), F({ _: 2 }, [
145
- b(n.list, (r) => ({
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}`, T($(l)), void 0, !0)
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 ? (j(), ue(a(de), {
153
- key: 0,
165
+ n.showOperation ? (y(), $(a(x), {
166
+ key: 1,
154
167
  class: "list-page-operation",
155
- onHeightChange: U
168
+ onHeightChange: _
156
169
  }, {
157
170
  default: g(() => [
158
171
  d(e.$slots, "operation", {}, void 0, !0)
159
172
  ]),
160
173
  _: 3
161
- })) : ce("", !0),
162
- k(a(me), y({
174
+ })) : A("", !0),
175
+ F(a(ye), H({
163
176
  ref_key: "tableMain",
164
- ref: u,
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(V),
170
- maxHeight: a(L),
171
- rowKey: a(Y)
182
+ query: a(L),
183
+ maxHeight: a(U),
184
+ rowKey: a(re)
172
185
  }, n.tableMainProps, {
173
186
  refine: !1,
174
- injectInfo: a(X),
175
- onLoadingChange: z,
176
- onDataChange: J,
177
- onPageInfoChange: Q
178
- }), F({ _: 2 }, [
179
- b(n.columns, (r) => ({
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}`, T($(Z(l))), void 0, !0)
195
+ d(e.$slots, `table-${r.prop}`, B(E(oe(l))), void 0, !0)
183
196
  ])
184
197
  })),
185
- b(n.columns, (r) => ({
198
+ C(n.columns, (r) => ({
186
199
  name: `header-${r.prop}`,
187
200
  fn: g((l) => {
188
- var h;
201
+ var f;
189
202
  return [
190
- d(e.$slots, `table-header-${r.columnKey || r.prop}`, y(_(l), {
191
- searchFormData: a(P),
192
- triggerSearch: (h = a(i)) == null ? void 0 : h.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
- [f, !m.value && a(C)]
212
+ [h, !m.value && a(b)]
200
213
  ]);
201
214
  };
202
215
  }
203
216
  });
204
217
  export {
205
- ke as default
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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b734f05f"]]);
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9d78ca06"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };
@@ -1,57 +1,63 @@
1
- import { ElInputNumber as x, ElSwitch as M } from "element-plus/es";
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 N, useModel as m, watch as n, openBlock as i, createElementBlock as d, Fragment as b, createElementVNode as f, createVNode as p, createCommentVNode as k, mergeModels as w } from "vue";
6
- import { useTimeout as B } from "../../hooks/timeout.mjs";
7
- import { useActivatedExec as T } from "../../hooks/activated.mjs";
8
- const y = { class: "auto-refresh" }, F = /* @__PURE__ */ N({
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: {
11
+ props: /* @__PURE__ */ T({
12
+ refreshFn: {},
13
+ enabled: { type: Boolean, default: !0 }
14
+ }, {
11
15
  modelValue: { type: Boolean, default: !1 },
12
16
  modelModifiers: {},
13
17
  interval: { default: 30 },
14
18
  intervalModifiers: {}
15
- },
16
- emits: /* @__PURE__ */ w(["refresh"], ["update:modelValue", "update:interval"]),
17
- setup(s, { expose: v, emit: c }) {
18
- const r = c, e = m(s, "modelValue"), o = m(s, "interval"), [V, h] = B(), l = () => {
19
- V(() => {
20
- r("refresh"), e.value && l();
21
- }, o.value * 1e3);
19
+ }),
20
+ emits: ["update:modelValue", "update:interval"],
21
+ setup(n) {
22
+ const u = n, t = c(n, "modelValue"), l = c(n, "interval"), r = B(() => t.value && u.enabled), [b, m] = g();
23
+ let o = null;
24
+ const d = () => (o || (o = u.refreshFn().catch(() => {
25
+ }).finally(() => {
26
+ o = null;
27
+ })), o), i = () => {
28
+ b(async () => {
29
+ await d(), r.value && i();
30
+ }, l.value * 1e3);
22
31
  };
23
- return v({ trigger: () => {
24
- r("refresh"), e.value && l();
25
- } }), n(e, (u) => {
26
- u ? l() : h();
27
- }), n(o, () => {
28
- e.value && l();
29
- }), T(() => {
30
- e.value && (r("refresh"), l());
31
- }), (u, t) => {
32
- const E = x, g = M;
33
- return i(), d("div", y, [
34
- e.value ? (i(), d(b, { key: 0 }, [
35
- t[2] || (t[2] = f("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
36
- p(E, {
37
- modelValue: o.value,
38
- "onUpdate:modelValue": t[0] || (t[0] = (a) => o.value = a),
32
+ return k([r, l], ([a]) => {
33
+ a ? i() : m();
34
+ }), A(({ triggerType: a }) => {
35
+ r.value && (a === "activated" && (m(), d()), i());
36
+ }), (a, e) => {
37
+ const y = N, M = R;
38
+ return f(), p("div", C, [
39
+ t.value ? (f(), p(x, { key: 0 }, [
40
+ e[2] || (e[2] = v("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
41
+ V(y, {
42
+ modelValue: l.value,
43
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => l.value = s),
39
44
  min: 1,
40
- step: 5,
45
+ step: 1,
41
46
  size: "small",
42
47
  class: "auto-refresh-interval"
43
48
  }, null, 8, ["modelValue"]),
44
- t[3] || (t[3] = f("span", { class: "auto-refresh-label" }, "秒", -1))
45
- ], 64)) : k("", !0),
46
- p(g, {
47
- modelValue: e.value,
48
- "onUpdate:modelValue": t[1] || (t[1] = (a) => e.value = a),
49
- "active-text": "自动刷新"
50
- }, null, 8, ["modelValue"])
49
+ e[3] || (e[3] = v("span", { class: "auto-refresh-label" }, "秒", -1))
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"])
51
57
  ]);
52
58
  };
53
59
  }
54
60
  });
55
61
  export {
56
- F as default
62
+ D as default
57
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 p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5944984b"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-643017c3"]]);
5
5
  export {
6
6
  p as default
7
7
  };
@@ -4,16 +4,16 @@ 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 me, useAttrs as he, ref as g, shallowRef as ve, inject as ye, computed as d, onMounted as be, onActivated as Ce, watch as c, openBlock as n, createElementBlock as y, unref as l, createBlock as b, withCtx as C, createVNode as I, mergeProps as p, createCommentVNode as Se, Fragment as _, renderList as _e, createSlots as Ee, renderSlot as J, resolveDynamicComponent as V, createTextVNode as R, toDisplayString as $, withDirectives as Te, createElementVNode as we, isRef as Y, vShow as xe, mergeModels as G } from "vue";
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
8
  import U from "lodash/cloneDeep";
9
9
  import q from "lodash/omit";
10
10
  import D from "lodash/set";
11
- import F from "lodash/get";
11
+ import W from "lodash/get";
12
12
  import Ie from "./TableToolbar.vue.mjs";
13
13
  import Re from "../display/WatchSize.vue.mjs";
14
14
  import { BODY_CONTENT_VIEWPORT_HEIGHT as Pe } from "../../inject/key.mjs";
15
- import { APP_API_LIST_MODEL_KEY_CONFIG as E } from "../../config/list-model.mjs";
16
- const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe = /* @__PURE__ */ de({
15
+ 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
17
  __name: "TableMain",
18
18
  props: /* @__PURE__ */ G({
19
19
  showPager: { type: Boolean, default: !0 },
@@ -37,98 +37,98 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
37
37
  isAutoRefreshModifiers: {}
38
38
  }),
39
39
  emits: /* @__PURE__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
40
- setup(i, { expose: W, emit: Z }) {
40
+ setup(u, { expose: Z, emit: Q }) {
41
41
  ce((e) => ({
42
- v7c6ca44f: e.headerColor
42
+ v4c03ff8f: e.headerColor
43
43
  }));
44
- const a = i, m = Z, P = me(i, "isAutoRefresh"), Q = he(), T = g([]), w = g(0), s = g(0), o = g(1), h = g(!1), x = g(!1), O = g(0), X = (e) => {
45
- O.value = e;
46
- }, z = ve(), ee = ye(
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
47
  Pe,
48
48
  500
49
- ), H = d(() => a.showPager ? 35 : 0), N = d(() => {
50
- var t;
49
+ ), N = d(() => a.showPager ? 35 : 0), k = d(() => {
50
+ var n, _;
51
51
  if (a.showToolbar === !1) return !1;
52
- const e = (t = a.toolbar) == null ? void 0 : t.features;
53
- return e === void 0 || e.length > 0;
54
- }), k = d(
55
- () => N.value ? O.value : 0
56
- ), te = d(() => {
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
57
  const { maxHeight: e, refine: t } = a;
58
58
  return e ? Math.max(
59
- e - H.value - k.value,
59
+ e - N.value - A.value,
60
60
  200
61
61
  ) : t ? Math.max(
62
- ee.value - H.value - k.value - a.refineReduceHeight,
62
+ te.value - N.value - A.value - a.refineReduceHeight,
63
63
  200
64
64
  ) : void 0;
65
65
  }), S = d(() => {
66
66
  const e = U(a.query || {});
67
- return D(e, E.PAGE_SIZE_KEY, s.value), D(
67
+ return D(e, T.PAGE_SIZE_KEY, i.value), D(
68
68
  e,
69
- E.CURRENT_PAGE_KEY,
69
+ T.CURRENT_PAGE_KEY,
70
70
  o.value
71
71
  ), e;
72
- }), re = d(() => ({
72
+ }), ae = d(() => ({
73
73
  ...a.tableProps,
74
- ...Q
75
- })), A = (e, t = !0) => {
76
- const u = JSON.stringify(e) === JSON.stringify(S.value);
77
- return !u && t && console.warn(
74
+ ...X
75
+ })), K = (e, t = !0) => {
76
+ const n = JSON.stringify(e) === JSON.stringify(S.value);
77
+ return !n && t && console.warn(
78
78
  `同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
79
79
  e
80
80
  )} => ${JSON.stringify(S.value)}`
81
- ), u;
82
- }, K = (e = !1) => {
83
- if (!s.value) return;
84
- h.value ? console.warn("请求并发") : h.value = !0, e || (x.value = !0);
81
+ ), n;
82
+ }, j = (e = !1) => {
83
+ if (!i.value) return;
84
+ m.value ? console.warn("请求并发") : m.value = !0, e || (I.value = !0);
85
85
  const t = U(S.value);
86
- return a.api(t).then((u) => {
87
- A(t, !1) && (T.value = F(
88
- u,
89
- E.LIST_KEY
90
- ), w.value = F(
91
- u,
92
- E.TOTAL_KEY
93
- ), m("pageInfoChange", {
94
- pageSize: s.value,
86
+ return a.api(t).then((n) => {
87
+ K(t, !1) && (w.value = W(
88
+ n,
89
+ T.LIST_KEY
90
+ ), x.value = W(
91
+ n,
92
+ T.TOTAL_KEY
93
+ ), h("pageInfoChange", {
94
+ pageSize: i.value,
95
95
  currentPage: o.value,
96
- total: w.value
96
+ total: x.value
97
97
  }));
98
98
  }).finally(() => {
99
- A(t) && (h.value = !1, x.value = !1);
99
+ K(t) && (m.value = !1, I.value = !1);
100
100
  });
101
- }, j = async (e = !1) => {
101
+ }, B = async (e = !1) => {
102
102
  var t;
103
- return (t = K(e)) == null ? void 0 : t.catch(() => {
103
+ return (t = j(e)) == null ? void 0 : t.catch(() => {
104
104
  });
105
- }, ae = async (e = !1) => {
105
+ }, oe = async (e = !1) => {
106
106
  if (o.value === 1)
107
- return j(e);
107
+ return B(e);
108
108
  o.value = 1;
109
- }, oe = (e) => e, v = {
110
- refresh: j,
111
- reload: ae,
112
- getTableInstance: () => z.value
113
- }, B = (e, t = []) => ({
109
+ }, ne = (e) => e, v = {
110
+ refresh: B,
111
+ reload: oe,
112
+ getTableInstance: () => H.value
113
+ }, L = (e, t = []) => ({
114
114
  ...q(e, ["render", "headerRender"].concat(t)),
115
115
  injectInfo: a.injectInfo || {},
116
116
  exposeInfo: v
117
- }), L = (e) => ({
117
+ }), M = (e) => ({
118
118
  ...q(e, ["render", "headerRender"]),
119
119
  injectInfo: a.injectInfo || {},
120
120
  exposeInfo: v
121
121
  });
122
- W(v);
123
- const ne = (e) => {
124
- s.value = e, o.value = 1;
125
- }, M = (e) => !e || e === "expand";
122
+ Z(v);
123
+ const le = (e) => {
124
+ i.value = e, o.value = 1;
125
+ }, J = (e) => !e || e === "expand";
126
126
  return be(() => {
127
- s.value = a.pageSizeInit, Ce(() => {
127
+ i.value = a.pageSizeInit, Ce(() => {
128
128
  v.refresh();
129
129
  });
130
- }), c(T, (e) => {
131
- m("dataChange", e);
130
+ }), c(w, (e) => {
131
+ h("dataChange", e);
132
132
  }), c(
133
133
  () => a.query,
134
134
  (e, t) => {
@@ -137,80 +137,80 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
137
137
  ), c(
138
138
  S,
139
139
  (e, t) => {
140
- JSON.stringify(e) !== JSON.stringify(t) && K();
140
+ JSON.stringify(e) !== JSON.stringify(t) && j();
141
141
  },
142
142
  {
143
143
  immediate: !0
144
144
  }
145
- ), c(x, (e) => {
146
- m("loadingChange", e);
147
- }), c(s, (e) => {
148
- m("pageSizeChange", e);
145
+ ), c(I, (e) => {
146
+ h("loadingChange", e);
147
+ }), c(i, (e) => {
148
+ h("pageSizeChange", e);
149
149
  }), c(o, (e) => {
150
- m("pageChange", e);
150
+ h("pageChange", e);
151
151
  }), (e, t) => {
152
- const u = fe, le = ge, se = ue, ie = pe;
153
- return n(), y("div", Oe, [
154
- l(N) ? (n(), b(l(Re), {
152
+ const n = fe, _ = ge, se = ue, ie = pe;
153
+ return l(), y("div", Oe, [
154
+ s(k) ? (l(), b(s(Re), {
155
155
  key: 0,
156
- onHeightChange: X
156
+ onHeightChange: ee
157
157
  }, {
158
158
  default: C(() => [
159
- I(Ie, p({
160
- "is-auto-refresh": P.value,
161
- "onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => P.value = r),
159
+ R(Ie, p({
160
+ "is-auto-refresh": O.value,
161
+ "onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => O.value = r),
162
162
  tableExpose: v,
163
- loading: l(h)
163
+ loading: s(m)
164
164
  }, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
165
165
  ]),
166
166
  _: 1
167
167
  })) : Se("", !0),
168
- I(se, p({
168
+ R(se, p({
169
169
  ref_key: "elTable",
170
- ref: z,
170
+ ref: H,
171
171
  class: "table-main-table",
172
172
  stripe: "",
173
173
  border: "",
174
174
  highlightCurrentRow: ""
175
- }, l(re), {
176
- maxHeight: l(te),
177
- data: l(T),
178
- rowKey: oe(i.rowKey)
175
+ }, s(ae), {
176
+ maxHeight: s(re),
177
+ data: s(w),
178
+ rowKey: ne(u.rowKey)
179
179
  }), {
180
180
  empty: C(() => [
181
- l(h) ? (n(), y(_, { key: 0 }, [
182
- R("加载中...")
183
- ], 64)) : (n(), b(le, { key: 1 }))
181
+ s(m) ? (l(), y(E, { key: 0 }, [
182
+ P("加载中...")
183
+ ], 64)) : (l(), b(_, { key: 1 }))
184
184
  ]),
185
185
  default: C(() => [
186
- (n(!0), y(_, null, _e(i.columns, (r) => (n(), b(u, p({
186
+ (l(!0), y(E, null, _e(u.columns, (r) => (l(), b(n, p({
187
187
  key: r.columnKey || r.prop
188
188
  }, { ref_for: !0 }, r), Ee({ _: 2 }, [
189
- M(r.type) ? {
189
+ J(r.type) ? {
190
190
  name: "default",
191
191
  fn: C((f) => [
192
- J(e.$slots, r.prop, p({ ref_for: !0 }, B(f)), () => [
193
- r.render ? (n(), b(V(r.render), p({
192
+ V(e.$slots, r.prop, p({ ref_for: !0 }, L(f)), () => [
193
+ r.render ? (l(), b($(r.render), p({
194
194
  key: 0,
195
195
  ref_for: !0
196
- }, B(f, ["$index"]), {
196
+ }, L(f, ["$index"]), {
197
197
  _index: f.$index
198
- }), null, 16, ["_index"])) : (n(), y(_, { key: 1 }, [
199
- R($(f.row[r.prop]), 1)
198
+ }), null, 16, ["_index"])) : (l(), y(E, { key: 1 }, [
199
+ P(Y(f.row[r.prop]), 1)
200
200
  ], 64))
201
201
  ], !0)
202
202
  ]),
203
203
  key: "0"
204
204
  } : void 0,
205
- M(r.type) ? {
205
+ J(r.type) ? {
206
206
  name: "header",
207
207
  fn: C((f) => [
208
- J(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, L(f)), () => [
209
- r.headerRender ? (n(), b(V(r.headerRender), p({
208
+ V(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, M(f)), () => [
209
+ r.headerRender ? (l(), b($(r.headerRender), p({
210
210
  key: 0,
211
211
  ref_for: !0
212
- }, L(f)), null, 16)) : (n(), y(_, { key: 1 }, [
213
- R($(r.label), 1)
212
+ }, M(f)), null, 16)) : (l(), y(E, { key: 1 }, [
213
+ P(Y(r.label), 1)
214
214
  ], 64))
215
215
  ], !0)
216
216
  ]),
@@ -221,25 +221,25 @@ const Oe = { class: "table-main" }, ze = { class: "table-main-pagination" }, qe
221
221
  _: 3
222
222
  }, 16, ["maxHeight", "data", "rowKey"]),
223
223
  Te(we("div", ze, [
224
- I(ie, {
225
- "current-page": l(o),
226
- "onUpdate:currentPage": t[1] || (t[1] = (r) => Y(o) ? o.value = r : null),
227
- "page-size": l(s),
228
- "onUpdate:pageSize": t[2] || (t[2] = (r) => Y(s) ? s.value = r : null),
229
- "page-sizes": i.pageSizeOptions,
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),
229
+ "page-sizes": u.pageSizeOptions,
230
230
  size: "small",
231
231
  background: "",
232
- layout: i.pageLayout,
233
- total: l(w),
234
- onSizeChange: ne
232
+ layout: u.pageLayout,
233
+ total: s(x),
234
+ onSizeChange: le
235
235
  }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
236
236
  ], 512), [
237
- [xe, i.showPager]
237
+ [xe, u.showPager]
238
238
  ])
239
239
  ]);
240
240
  };
241
241
  }
242
242
  });
243
243
  export {
244
- qe as default
244
+ Ue as default
245
245
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableToolbar.vue2.mjs";
2
2
  /* empty css */
3
3
  import a from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ a(o, [["__scopeId", "data-v-4a425d38"]]);
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-60e049ad"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,15 +1,20 @@
1
- import { ElButton as g, ElIcon as k } from "element-plus/es";
1
+ import { ElDropdown as k, ElButton as B, ElIcon as D, ElDropdownMenu as I, ElDropdownItem as V } from "element-plus/es";
2
2
  import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/dropdown/style/css";
4
+ import "element-plus/es/components/dropdown-menu/style/css";
5
+ import "element-plus/es/components/dropdown-item/style/css";
3
6
  import "element-plus/es/components/button/style/css";
4
7
  import "element-plus/es/components/icon/style/css";
5
- import { defineComponent as A, useModel as B, computed as f, ref as i, watch as _, openBlock as a, createElementBlock as V, createElementVNode as x, createBlock as d, createCommentVNode as m, withCtx as c, createVNode as h, normalizeClass as y, unref as C, mergeModels as I } from "vue";
6
- import { Refresh as M } from "@element-plus/icons-vue";
7
- import w from "../misc/AutoRefresh.vue.mjs";
8
- const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G = /* @__PURE__ */ A({
8
+ import { defineComponent as C, useModel as M, computed as f, ref as E, watch as N, openBlock as u, createElementBlock as z, createElementVNode as g, createBlock as p, withCtx as o, createVNode as l, createTextVNode as d, unref as w, createCommentVNode as c, normalizeClass as T, mergeModels as U } from "vue";
9
+ import { ArrowDown as $, Refresh as j } from "@element-plus/icons-vue";
10
+ import q from "../misc/AutoRefresh.vue.mjs";
11
+ const G = { class: "table-toolbar" }, H = { class: "table-toolbar-left" }, J = { class: "table-toolbar-right" }, ee = /* @__PURE__ */ C({
9
12
  __name: "TableToolbar",
10
- props: /* @__PURE__ */ I({
11
- features: { default: () => ["refresh", "autoRefresh"] },
13
+ props: /* @__PURE__ */ U({
14
+ leftFeatures: {},
15
+ rightFeatures: {},
12
16
  refreshInterval: { default: 30 },
17
+ exportFn: {},
13
18
  tableExpose: {},
14
19
  loading: { type: Boolean }
15
20
  }, {
@@ -17,59 +22,115 @@ const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G =
17
22
  isAutoRefreshModifiers: {}
18
23
  }),
19
24
  emits: ["update:isAutoRefresh"],
20
- setup(s) {
21
- const e = s, n = B(s, "isAutoRefresh"), p = f(
22
- () => e.features === void 0 || e.features.includes("refresh")
23
- ), v = f(
24
- () => e.features === void 0 || e.features.includes("autoRefresh")
25
- ), l = i(30);
26
- _(
27
- () => e.refreshInterval,
28
- (o) => {
29
- l.value = o;
25
+ setup(n) {
26
+ const t = n, v = M(n, "isAutoRefresh"), x = f(
27
+ () => t.leftFeatures === void 0 || t.leftFeatures.includes("export")
28
+ ), F = f(
29
+ () => t.rightFeatures === void 0 || t.rightFeatures.includes("refresh")
30
+ ), _ = f(
31
+ () => t.rightFeatures === void 0 || t.rightFeatures.includes("autoRefresh")
32
+ ), i = E(30);
33
+ N(
34
+ () => t.refreshInterval,
35
+ (a) => {
36
+ i.value = a;
30
37
  },
31
38
  { immediate: !0 }
32
39
  );
33
- const u = i(), R = () => {
34
- var o;
35
- (o = u.value) == null || o.trigger();
40
+ const r = E(!1), R = (a) => {
41
+ r.value || !t.exportFn || (r.value = !0, t.exportFn(a).catch(() => {
42
+ }).finally(() => {
43
+ r.value = !1;
44
+ }));
36
45
  };
37
- return (o, t) => {
38
- const b = k, E = g;
39
- return a(), V("div", N, [
40
- x("div", T, [
41
- v.value ? (a(), d(w, {
46
+ return (a, e) => {
47
+ const h = D, b = B, m = V, y = I, A = k;
48
+ return u(), z("div", G, [
49
+ g("div", H, [
50
+ x.value ? (u(), p(A, {
42
51
  key: 0,
43
- ref_key: "autoRefreshRef",
44
- ref: u,
45
- modelValue: n.value,
46
- "onUpdate:modelValue": t[0] || (t[0] = (r) => n.value = r),
47
- interval: l.value,
48
- "onUpdate:interval": t[1] || (t[1] = (r) => l.value = r),
49
- onRefresh: t[2] || (t[2] = (r) => e.tableExpose.refresh())
50
- }, null, 8, ["modelValue", "interval"])) : m("", !0),
51
- p.value ? (a(), d(E, {
52
+ disabled: r.value,
53
+ onCommand: R
54
+ }, {
55
+ dropdown: o(() => [
56
+ l(y, null, {
57
+ default: o(() => [
58
+ l(m, { command: "selected" }, {
59
+ default: o(() => [...e[4] || (e[4] = [
60
+ d("导出选择", -1)
61
+ ])]),
62
+ _: 1
63
+ }),
64
+ l(m, { command: "current" }, {
65
+ default: o(() => [...e[5] || (e[5] = [
66
+ d("导出本页", -1)
67
+ ])]),
68
+ _: 1
69
+ }),
70
+ l(m, { command: "all" }, {
71
+ default: o(() => [...e[6] || (e[6] = [
72
+ d("导出全部", -1)
73
+ ])]),
74
+ _: 1
75
+ })
76
+ ]),
77
+ _: 1
78
+ })
79
+ ]),
80
+ default: o(() => [
81
+ l(b, {
82
+ size: "small",
83
+ type: "primary",
84
+ loading: r.value
85
+ }, {
86
+ default: o(() => [
87
+ e[3] || (e[3] = d(" 导出 ", -1)),
88
+ l(h, null, {
89
+ default: o(() => [
90
+ l(w($))
91
+ ]),
92
+ _: 1
93
+ })
94
+ ]),
95
+ _: 1
96
+ }, 8, ["loading"])
97
+ ]),
98
+ _: 1
99
+ }, 8, ["disabled"])) : c("", !0)
100
+ ]),
101
+ g("div", J, [
102
+ _.value ? (u(), p(q, {
103
+ key: 0,
104
+ modelValue: v.value,
105
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => v.value = s),
106
+ interval: i.value,
107
+ "onUpdate:interval": e[1] || (e[1] = (s) => i.value = s),
108
+ refreshFn: t.tableExpose.refresh,
109
+ enabled: !n.loading
110
+ }, null, 8, ["modelValue", "interval", "refreshFn", "enabled"])) : c("", !0),
111
+ F.value ? (u(), p(b, {
52
112
  key: 1,
113
+ size: "small",
53
114
  circle: "",
54
- onClick: R
115
+ onClick: e[2] || (e[2] = (s) => t.tableExpose.refresh())
55
116
  }, {
56
- default: c(() => [
57
- h(b, {
58
- class: y({ "table-toolbar-icon--rotating": s.loading })
117
+ default: o(() => [
118
+ l(h, {
119
+ class: T({ "table-toolbar-icon--rotating": n.loading })
59
120
  }, {
60
- default: c(() => [
61
- h(C(M))
121
+ default: o(() => [
122
+ l(w(j))
62
123
  ]),
63
124
  _: 1
64
125
  }, 8, ["class"])
65
126
  ]),
66
127
  _: 1
67
- })) : m("", !0)
128
+ })) : c("", !0)
68
129
  ])
69
130
  ]);
70
131
  };
71
132
  }
72
133
  });
73
134
  export {
74
- G as default
135
+ ee as default
75
136
  };
@@ -1,34 +1,40 @@
1
- import { watch as i, ref as s, onMounted as n, onActivated as u, onDeactivated as v, onBeforeUnmount as d } from "vue";
2
- const c = () => {
3
- const e = s(!1);
4
- return n(() => {
5
- e.value = !0, u(() => {
6
- e.value = !0;
1
+ import { watch as d, ref as n, computed as c, onMounted as o, onActivated as s, onDeactivated as r, onBeforeUnmount as u } from "vue";
2
+ const v = () => {
3
+ const e = n({
4
+ isActivated: !1,
5
+ triggerType: "mounted"
6
+ }), i = c(() => e.value.isActivated), t = (a) => {
7
+ e.value = a;
8
+ };
9
+ return o(() => {
10
+ t({ isActivated: !0, triggerType: "mounted" }), s(() => {
11
+ t({ isActivated: !0, triggerType: "activated" });
7
12
  });
8
- }), v(() => {
9
- e.value = !1;
10
- }), d(() => {
11
- e.value = !1;
13
+ }), r(() => {
14
+ t({ isActivated: !1, triggerType: "deactivated" });
15
+ }), u(() => {
16
+ t({ isActivated: !1, triggerType: "unmounted" });
12
17
  }), {
13
- isActivated: e
18
+ isActivated: i,
19
+ activatedInfo: c(() => e.value)
14
20
  };
15
- }, f = (e) => {
16
- const { isActivated: t } = c();
17
- i(
18
- t,
19
- (a) => {
20
- a && e();
21
+ }, g = (e) => {
22
+ const { activatedInfo: i } = v();
23
+ d(
24
+ i,
25
+ (t) => {
26
+ t.isActivated && e(t);
21
27
  },
22
28
  {
23
29
  immediate: !0
24
30
  }
25
31
  );
26
- }, l = (e, t) => {
27
- const { isActivated: a } = c();
28
- i(
29
- a,
30
- (o) => {
31
- o ? e() : t();
32
+ }, m = (e, i) => {
33
+ const { activatedInfo: t } = v();
34
+ d(
35
+ t,
36
+ (a) => {
37
+ a.isActivated ? e(a) : i(a);
32
38
  },
33
39
  {
34
40
  immediate: !0
@@ -36,7 +42,7 @@ const c = () => {
36
42
  );
37
43
  };
38
44
  export {
39
- c as useActivated,
40
- l as useActivatedEvent,
41
- f as useActivatedExec
45
+ v as useActivated,
46
+ m as useActivatedEvent,
47
+ g as useActivatedExec
42
48
  };
package/es/style.css CHANGED
@@ -1 +1 @@
1
- .form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-b734f05f]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-b734f05f]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-b734f05f]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-4a425d38]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-4a425d38]{display:flex;align-items:center;gap:8px}.table-toolbar-icon--rotating[data-v-4a425d38]{animation:table-toolbar-rotating-4a425d38 1s linear infinite}@keyframes table-toolbar-rotating-4a425d38{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-5944984b]{--el-table-header-bg-color: var(--v7c6ca44f)}.table-main-pagination[data-v-5944984b]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-a578c778]{min-height:var(--bb4a2a8e)}.list-page-operation[data-v-a578c778]{margin-bottom:10px}.list-page[data-v-a578c778] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
1
+ .form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-9d78ca06]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-9d78ca06]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-9d78ca06]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-60e049ad]{display:flex;justify-content:space-between;align-items:center;padding-bottom:8px;gap:20px}.table-toolbar-left[data-v-60e049ad],.table-toolbar-right[data-v-60e049ad]{display:flex;align-items:center;gap:10px}.table-toolbar-icon--rotating[data-v-60e049ad]{animation:table-toolbar-rotating-60e049ad 1s linear infinite}@keyframes table-toolbar-rotating-60e049ad{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-643017c3]{--el-table-header-bg-color: var(--v4c03ff8f)}.table-main-pagination[data-v-643017c3]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-182577bf]{min-height:var(--ad28a056)}.list-page-header[data-v-182577bf],.list-page-operation[data-v-182577bf]{margin-bottom:10px}.list-page[data-v-182577bf] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/admin-core",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.1-alpha.2",
4
4
  "description": "后台管理核心",
5
5
  "private": false,
6
6
  "main": "lib/index.cjs",
@@ -77,5 +77,5 @@
77
77
  "node": ">=18.0.0",
78
78
  "pnpm": ">=9.0.0"
79
79
  },
80
- "gitHead": "ee98121b978b17eb12a861b97ef26227d2315523"
80
+ "gitHead": "ab2bb3cbded6a375d254e49281d93383534afabe"
81
81
  }
@@ -16,6 +16,7 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
16
16
  tableMainProps?: Partial<Omit<import('../table').TableMainProps<T, import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ, ListPageInnerInjectInfo<PO, F>>, import('./types').TableMainOptionsKey | import('./types').TableMainRewriteKey>> | undefined;
17
17
  } & {
18
18
  showOperation?: boolean;
19
+ showHeader?: boolean;
19
20
  list?: FormItemConfigList<PO, SO> | undefined;
20
21
  api: (params: import('../table').TableApiParams<import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ>) => Promise<import('../table').TableApiResult<T>>;
21
22
  query?: SQ | undefined;
@@ -41,6 +42,7 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
41
42
  injectInfo: ListPageInnerInjectInfo<PO, F>;
42
43
  exposeInfo: TableMainInstance;
43
44
  }) => any>> & {
45
+ header?(_: {}): any;
44
46
  operation?(_: {}): any;
45
47
  }>;
46
48
  emit: {
@@ -26,6 +26,8 @@ F extends Record<string, any>> = Partial<Pick<FormSearchProps<PO, SO, {}>, FormS
26
26
  } & {
27
27
  /** 是否展示操作区 */
28
28
  showOperation?: boolean;
29
+ /** 是否展示头部区 */
30
+ showHeader?: boolean;
29
31
  list?: FormItemConfigList<PO, SO>;
30
32
  /** api */
31
33
  api: (params: TableApiParams<ExtractFormStringifyFromObject<PO, SO> & SQ>) => Promise<TableApiResult<T>>;
@@ -1,14 +1,26 @@
1
1
  declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
2
2
  modelValue: import('vue').PropType<boolean>;
3
3
  interval: import('vue').PropType<number>;
4
- }>, {
5
- trigger: () => void;
6
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
- refresh: () => void;
8
- }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
4
+ refreshFn: {
5
+ type: globalThis.PropType<() => Promise<unknown>>;
6
+ required: true;
7
+ };
8
+ enabled: {
9
+ type: globalThis.PropType<boolean>;
10
+ default: boolean;
11
+ };
12
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
9
13
  modelValue: import('vue').PropType<boolean>;
10
14
  interval: import('vue').PropType<number>;
11
- }>> & Readonly<{
12
- onRefresh?: (() => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
15
+ refreshFn: {
16
+ type: globalThis.PropType<() => Promise<unknown>>;
17
+ required: true;
18
+ };
19
+ enabled: {
20
+ type: globalThis.PropType<boolean>;
21
+ default: boolean;
22
+ };
23
+ }>> & Readonly<{}>, {
24
+ enabled: boolean;
25
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
26
  export default _default;
@@ -1,4 +1,4 @@
1
- import { TableMainInstance } from './types';
1
+ import { ExportType, TableMainInstance } from './types';
2
2
 
3
3
  declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
4
4
  isAutoRefresh: import('vue').PropType<boolean>;
@@ -6,14 +6,19 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
6
6
  type: globalThis.PropType<boolean>;
7
7
  required: true;
8
8
  };
9
- features: {
10
- type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
11
- default: () => string[];
9
+ leftFeatures: {
10
+ type: globalThis.PropType<"export"[]>;
11
+ };
12
+ rightFeatures: {
13
+ type: globalThis.PropType<import('./types').TableToolbarRightFeature[]>;
12
14
  };
13
15
  refreshInterval: {
14
16
  type: globalThis.PropType<number>;
15
17
  default: number;
16
18
  };
19
+ exportFn: {
20
+ type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
21
+ };
17
22
  tableExpose: {
18
23
  type: globalThis.PropType<TableMainInstance>;
19
24
  required: true;
@@ -24,20 +29,24 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
24
29
  type: globalThis.PropType<boolean>;
25
30
  required: true;
26
31
  };
27
- features: {
28
- type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
29
- default: () => string[];
32
+ leftFeatures: {
33
+ type: globalThis.PropType<"export"[]>;
34
+ };
35
+ rightFeatures: {
36
+ type: globalThis.PropType<import('./types').TableToolbarRightFeature[]>;
30
37
  };
31
38
  refreshInterval: {
32
39
  type: globalThis.PropType<number>;
33
40
  default: number;
34
41
  };
42
+ exportFn: {
43
+ type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
44
+ };
35
45
  tableExpose: {
36
46
  type: globalThis.PropType<TableMainInstance>;
37
47
  required: true;
38
48
  };
39
49
  }>> & Readonly<{}>, {
40
- features: import('./types').TableToolbarFeature[];
41
50
  refreshInterval: number;
42
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
43
52
  export default _default;
@@ -24,19 +24,30 @@ export interface TableMainInstance {
24
24
  reload: (slice?: boolean) => Promise<unknown>;
25
25
  getTableInstance: () => TableInstance | undefined;
26
26
  }
27
- /** toolbar 可配置功能列表 */
28
- export type TableToolbarFeature = "refresh" | "autoRefresh";
27
+ /** 导出类型 */
28
+ export type ExportType = "selected" | "current" | "all";
29
+ /** toolbar 左侧功能 */
30
+ export type TableToolbarLeftFeature = "export";
31
+ /** toolbar 右侧功能 */
32
+ export type TableToolbarRightFeature = "refresh" | "autoRefresh";
29
33
  /** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
30
34
  export interface TableToolbarConfig {
31
35
  /**
32
- * 功能列表。
33
- * - undefined(默认):显示所有功能
34
- * - [](空数组):不渲染 toolbar
35
- * - 枚举子集:仅显示指定功能
36
+ * 左侧功能列表。
37
+ * - undefined(默认):显示所有左侧功能
38
+ * - [](空数组):不渲染左侧功能
36
39
  */
37
- features?: TableToolbarFeature[];
40
+ leftFeatures?: TableToolbarLeftFeature[];
41
+ /**
42
+ * 右侧功能列表。
43
+ * - undefined(默认):显示所有右侧功能
44
+ * - [](空数组):不渲染右侧功能
45
+ */
46
+ rightFeatures?: TableToolbarRightFeature[];
38
47
  /** 自动刷新默认间隔(秒),默认 30 */
39
48
  refreshInterval?: number;
49
+ /** 导出方法。传入导出类型,返回 Promise */
50
+ exportFn?: (type: ExportType) => Promise<unknown>;
40
51
  }
41
52
  /** 表格列默认作用域 */
42
53
  export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
@@ -82,7 +93,7 @@ SQ extends Record<string, any>,
82
93
  F extends Record<string, any>> {
83
94
  /** 展示分页器 */
84
95
  showPager?: boolean;
85
- /** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.features) */
96
+ /** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.leftFeatures / rightFeatures) */
86
97
  showToolbar?: boolean;
87
98
  /** toolbar 配置 */
88
99
  toolbar?: TableToolbarConfig;
@@ -1,8 +1,17 @@
1
+ /** 激活信息 */
2
+ export interface ActivatedInfo {
3
+ isActivated: boolean;
4
+ triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
5
+ }
1
6
  /** 是否激活 */
2
7
  export declare const useActivated: () => {
3
- isActivated: globalThis.Ref<boolean, boolean>;
8
+ isActivated: globalThis.ComputedRef<boolean>;
9
+ activatedInfo: globalThis.ComputedRef<{
10
+ isActivated: boolean;
11
+ triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
12
+ }>;
4
13
  };
5
14
  /** 激活时执行时间 */
6
- export declare const useActivatedExec: (callback: () => void) => void;
15
+ export declare const useActivatedExec: (callback: (info: ActivatedInfo) => void) => void;
7
16
  /** 激活时监听事件 */
8
- export declare const useActivatedEvent: (bind: () => void, unbind: () => void) => void;
17
+ export declare const useActivatedEvent: (bind: (info: ActivatedInfo) => void, unbind: (info: ActivatedInfo) => void) => void;