@done-coding/admin-core 0.0.1-alpha.1 → 0.1.0

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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c9564dc7"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-767c1592"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,20 +1,20 @@
1
- import { ElLoadingDirective as Z } from "element-plus/es";
1
+ import { ElLoadingDirective as te } 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 ee, useCssVars as te, unref as r, ref as u, shallowRef as R, inject as re, computed as o, watch as ae, withDirectives as ne, openBlock as j, createElementBlock as oe, createVNode as k, mergeProps as v, createSlots as F, renderList as y, withCtx as h, renderSlot as m, normalizeProps as T, guardReactiveProps as $, createBlock as se, createCommentVNode as ie } from "vue";
5
- import le from "../form/FormSearch.vue.mjs";
6
- import { generateFormData as ce, stringifyFormData as ue } from "../form/utils.mjs";
7
- import fe from "../display/WatchSize.vue.mjs";
8
- import ge from "../table/TableMain.vue.mjs";
9
- import he from "lodash/pick";
10
- import me from "lodash/cloneDeep";
11
- import { BODY_CONTENT_VIEWPORT_HEIGHT as de } from "../../inject/key.mjs";
12
- const pe = {
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 S, 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";
12
+ const Se = {
13
13
  "element-loading-background": "rgba(122, 122, 122, 0.5)",
14
14
  class: "list-page"
15
- }, Re = /* @__PURE__ */ ee({
15
+ }, ke = /* @__PURE__ */ re({
16
16
  __name: "ListPage",
17
- props: {
17
+ props: /* @__PURE__ */ A({
18
18
  staticQuery: { default: () => ({}) },
19
19
  formSearchProps: {},
20
20
  columns: {},
@@ -29,56 +29,59 @@ const pe = {
29
29
  injectInfo: {},
30
30
  beforeSearch: {},
31
31
  clearTableFilterOnReset: { type: Boolean }
32
- },
33
- emits: ["dataChange", "pageInfoChange"],
34
- setup(s, { expose: M, emit: x }) {
35
- te((e) => ({
36
- f49642f0: r(N)
32
+ }, {
33
+ isAutoRefresh: { type: Boolean },
34
+ isAutoRefreshModifiers: {}
35
+ }),
36
+ emits: /* @__PURE__ */ A(["dataChange", "pageInfoChange"], ["update:isAutoRefresh"]),
37
+ setup(n, { expose: x, emit: B }) {
38
+ ae((e) => ({
39
+ v036568fb: a(q)
37
40
  }));
38
- const a = s, S = x, d = u({}), p = u(
41
+ const o = n, b = B, m = oe(n, "isAutoRefresh"), p = c({}), v = c(
39
42
  {}
40
- ), b = u(!1), i = R(), c = R(), E = re(
41
- de,
43
+ ), C = c(!1), i = O(), u = O(), E = ne(
44
+ ye,
42
45
  500
43
- ), C = u(0), H = u(0), V = o(() => ({
44
- ...p.value,
45
- ...a.staticQuery
46
- })), w = u(!1), B = o(() => w.value ? C.value + 10 : 0), K = o(() => a.showOperation ? H.value + 10 : 0), I = o(() => E.value - a.refineReduceHeight), N = o(() => a.refine ? `${I.value}px` : "auto"), q = o(() => a.refine ? Math.max(
47
- I.value - B.value - K.value,
46
+ ), H = c(0), R = c(0), V = s(() => ({
47
+ ...v.value,
48
+ ...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,
48
51
  200
49
- ) : void 0), P = (e, t = "search") => {
50
- var n, l, g;
52
+ ) : void 0), M = (e, t = "search") => {
53
+ var r, l, h;
51
54
  let f = e;
52
- if (a.beforeSearch && (f = a.beforeSearch(
53
- me(e),
55
+ if (o.beforeSearch && (f = o.beforeSearch(
56
+ ve(e),
54
57
  t
55
- )), t === "reset" && a.clearTableFilterOnReset && ((l = (n = c.value) == null ? void 0 : n.getTableInstance()) == null || l.clearFilter()), JSON.stringify(f) === JSON.stringify(p.value))
56
- return ["reset", "search"].includes(t) ? (g = c.value) == null ? void 0 : g.reload() : void 0;
57
- p.value = {
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 = {
58
61
  ...f
59
62
  };
60
- }, L = (e) => {
61
- S("dataChange", e);
62
- }, A = (e) => {
63
- S("pageInfoChange", e);
64
- }, _ = (e) => {
65
- b.value = e;
66
63
  }, J = (e) => {
67
- C.value = e;
64
+ b("dataChange", e);
68
65
  }, Q = (e) => {
66
+ b("pageInfoChange", e);
67
+ }, z = (e) => {
68
+ C.value = e;
69
+ }, G = (e) => {
69
70
  H.value = e;
70
- }, z = o(() => a.list), G = o(() => a.rowKey), D = o(() => d.value), O = {
71
+ }, U = (e) => {
72
+ R.value = e;
73
+ }, W = s(() => o.list), Y = s(() => o.rowKey), P = s(() => p.value), D = {
71
74
  refresh: (e = !1) => {
72
75
  var t;
73
- return (t = c.value) == null ? void 0 : t.refresh(e);
76
+ return (t = u.value) == null ? void 0 : t.refresh(e);
74
77
  },
75
78
  reload: (e = !1) => {
76
79
  var t;
77
- return (t = c.value) == null ? void 0 : t.reload(e);
80
+ return (t = u.value) == null ? void 0 : t.reload(e);
78
81
  },
79
82
  getTableInstance: () => {
80
83
  var e;
81
- return (e = c.value) == null ? void 0 : e.getTableInstance();
84
+ return (e = u.value) == null ? void 0 : e.getTableInstance();
82
85
  },
83
86
  validate: () => {
84
87
  if (i.value)
@@ -102,100 +105,102 @@ const pe = {
102
105
  return (e = i.value) == null ? void 0 : e.triggerSearch();
103
106
  },
104
107
  update: (e, t) => {
105
- d.value[e] = t;
108
+ p.value[e] = t;
106
109
  }
107
- }, W = o(() => {
108
- const e = he(O, [
110
+ }, X = s(() => {
111
+ const e = pe(D, [
109
112
  "triggerReset",
110
113
  "triggerSearch",
111
114
  "update"
112
115
  ]);
113
116
  return {
114
- ...a.injectInfo || {},
117
+ ...o.injectInfo || {},
115
118
  ...e
116
119
  };
117
- }), Y = (e) => e, U = (e) => e, X = (e) => {
120
+ }), Z = (e) => e, _ = (e) => e, ee = (e) => {
118
121
  w.value = e;
119
122
  };
120
- return M(O), ae(
121
- () => a.list,
123
+ return x(D), se(
124
+ () => o.list,
122
125
  (e) => {
123
- const t = ce(e);
124
- d.value = t, P(ue(t, e));
126
+ const t = he(e);
127
+ p.value = t, M(ge(t, e));
125
128
  },
126
129
  {
127
130
  immediate: !0
128
131
  }
129
132
  ), (e, t) => {
130
- const f = Z;
131
- return ne((j(), oe("div", pe, [
132
- k(r(le), v({
133
+ const f = te;
134
+ return ie((j(), le("div", Se, [
135
+ k(a(fe), y({
133
136
  ref_key: "formSearch",
134
137
  ref: i,
135
- list: r(z),
136
- data: r(D)
137
- }, s.formSearchProps, {
138
- onSearch: P,
139
- onHeightChange: J,
140
- onVisibleChange: X
138
+ list: a(W),
139
+ data: a(P)
140
+ }, n.formSearchProps, {
141
+ onSearch: M,
142
+ onHeightChange: G,
143
+ onVisibleChange: ee
141
144
  }), F({ _: 2 }, [
142
- y(s.list, (n) => ({
143
- name: n.key,
144
- fn: h((l) => [
145
- m(e.$slots, `form-${n.key}`, T($(l)), void 0, !0)
145
+ S(n.list, (r) => ({
146
+ name: r.key,
147
+ fn: g((l) => [
148
+ d(e.$slots, `form-${r.key}`, T($(l)), void 0, !0)
146
149
  ])
147
150
  }))
148
151
  ]), 1040, ["list", "data"]),
149
- s.showOperation ? (j(), se(r(fe), {
152
+ n.showOperation ? (j(), ue(a(de), {
150
153
  key: 0,
151
154
  class: "list-page-operation",
152
- onHeightChange: Q
155
+ onHeightChange: U
153
156
  }, {
154
- default: h(() => [
155
- m(e.$slots, "operation", {}, void 0, !0)
157
+ default: g(() => [
158
+ d(e.$slots, "operation", {}, void 0, !0)
156
159
  ]),
157
160
  _: 3
158
- })) : ie("", !0),
159
- k(r(ge), v({
161
+ })) : ce("", !0),
162
+ k(a(me), y({
160
163
  ref_key: "tableMain",
161
- ref: c,
162
- api: s.api,
163
- columns: s.columns,
164
- query: r(V),
165
- maxHeight: r(q),
166
- rowKey: r(G)
167
- }, s.tableMainProps, {
164
+ ref: u,
165
+ "is-auto-refresh": m.value,
166
+ "onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => m.value = r),
167
+ api: n.api,
168
+ columns: n.columns,
169
+ query: a(V),
170
+ maxHeight: a(L),
171
+ rowKey: a(Y)
172
+ }, n.tableMainProps, {
168
173
  refine: !1,
169
- injectInfo: r(W),
170
- onLoadingChange: _,
171
- onDataChange: L,
172
- onPageInfoChange: A
174
+ injectInfo: a(X),
175
+ onLoadingChange: z,
176
+ onDataChange: J,
177
+ onPageInfoChange: Q
173
178
  }), F({ _: 2 }, [
174
- y(s.columns, (n) => ({
175
- name: n.prop,
176
- fn: h((l) => [
177
- m(e.$slots, `table-${n.prop}`, T($(Y(l))), void 0, !0)
179
+ S(n.columns, (r) => ({
180
+ name: r.prop,
181
+ fn: g((l) => [
182
+ d(e.$slots, `table-${r.prop}`, T($(Z(l))), void 0, !0)
178
183
  ])
179
184
  })),
180
- y(s.columns, (n) => ({
181
- name: `header-${n.prop}`,
182
- fn: h((l) => {
183
- var g;
185
+ S(n.columns, (r) => ({
186
+ name: `header-${r.prop}`,
187
+ fn: g((l) => {
188
+ var h;
184
189
  return [
185
- m(e.$slots, `table-header-${n.columnKey || n.prop}`, v(U(l), {
186
- searchFormData: r(D),
187
- triggerSearch: (g = r(i)) == null ? void 0 : g.triggerSearch
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
188
193
  }), void 0, !0)
189
194
  ];
190
195
  })
191
196
  }))
192
- ]), 1040, ["api", "columns", "query", "maxHeight", "rowKey", "injectInfo"])
197
+ ]), 1040, ["is-auto-refresh", "api", "columns", "query", "maxHeight", "rowKey", "injectInfo"])
193
198
  ])), [
194
- [f, r(b)]
199
+ [f, !m.value && a(C)]
195
200
  ]);
196
201
  };
197
202
  }
198
203
  });
199
204
  export {
200
- Re as default
205
+ ke as default
201
206
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableMain.vue2.mjs";
2
2
  /* empty css */
3
- import f from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const m = /* @__PURE__ */ f(o, [["__scopeId", "data-v-c7f10ff2"]]);
3
+ import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-08dc9d04"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,20 +1,24 @@
1
- import { ElTable as ae, ElTableColumn as ne, ElEmpty as oe, ElPagination as ie } from "element-plus/es";
1
+ import { ElTable as ue, ElTableColumn as fe, ElEmpty as ge, ElPagination as pe } 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 le, useCssVars as se, useAttrs as ue, ref as p, shallowRef as fe, inject as pe, computed as _, onMounted as ge, onActivated as de, watch as g, openBlock as i, createElementBlock as m, createVNode as L, mergeProps as d, unref as u, withCtx as S, Fragment as C, renderList as ce, createBlock as E, createSlots as me, renderSlot as j, resolveDynamicComponent as A, createTextVNode as P, toDisplayString as J, withDirectives as he, createElementVNode as ye, isRef as B, vShow as ve } from "vue";
8
- import $ from "lodash/cloneDeep";
9
- import M from "lodash/omit";
10
- import V from "lodash/set";
11
- import Y from "lodash/get";
12
- import { BODY_CONTENT_VIEWPORT_HEIGHT as _e } from "../../inject/key.mjs";
13
- import { APP_API_LIST_MODEL_KEY_CONFIG as b } from "../../config/list-model.mjs";
14
- const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke = /* @__PURE__ */ le({
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";
8
+ import U from "lodash/cloneDeep";
9
+ import q 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
+ 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
17
  __name: "TableMain",
16
- props: {
18
+ props: /* @__PURE__ */ G({
17
19
  showPager: { type: Boolean, default: !0 },
20
+ showToolbar: { type: Boolean, default: !0 },
21
+ toolbar: {},
18
22
  query: {},
19
23
  pageSizeInit: { default: 20 },
20
24
  pageSizeOptions: { default: () => [10, 20, 30, 40] },
@@ -28,152 +32,181 @@ const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke
28
32
  refine: { type: Boolean, default: !0 },
29
33
  refineReduceHeight: { default: 0 },
30
34
  injectInfo: {}
31
- },
32
- emits: ["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"],
33
- setup(f, { expose: G, emit: q }) {
34
- se((e) => ({
35
- d46c1602: e.headerColor
35
+ }, {
36
+ isAutoRefresh: { type: Boolean },
37
+ isAutoRefreshModifiers: {}
38
+ }),
39
+ emits: /* @__PURE__ */ G(["pageChange", "pageSizeChange", "dataChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh"]),
40
+ setup(s, { expose: W, emit: Z }) {
41
+ ce((e) => ({
42
+ v1961e86c: e.headerColor
36
43
  }));
37
- const a = f, c = q, D = ue(), w = p([]), x = p(0), o = p(0), n = p(1), h = p(!1), I = p(!1), T = fe(), F = pe(
38
- _e,
44
+ const a = s, m = Z, P = me(s, "isAutoRefresh"), Q = he(), T = g([]), w = g(0), i = 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(
47
+ Pe,
39
48
  500
40
- ), O = _(() => a.showPager ? 35 : 0), U = _(() => {
49
+ ), H = d(() => a.showPager ? 35 : 0), N = d(() => {
50
+ var t;
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(() => {
41
57
  const { maxHeight: e, refine: t } = a;
42
- return e ? Math.max(e - O.value, 200) : t ? Math.max(
43
- F.value - O.value - a.refineReduceHeight,
58
+ return e ? Math.max(
59
+ e - H.value - k.value,
60
+ 200
61
+ ) : t ? Math.max(
62
+ ee.value - H.value - k.value - a.refineReduceHeight,
44
63
  200
45
64
  ) : void 0;
46
- }), y = _(() => {
47
- const e = $(a.query || {});
48
- return V(e, b.PAGE_SIZE_KEY, o.value), V(
65
+ }), S = d(() => {
66
+ const e = U(a.query || {});
67
+ return D(e, E.PAGE_SIZE_KEY, i.value), D(
49
68
  e,
50
- b.CURRENT_PAGE_KEY,
51
- n.value
69
+ E.CURRENT_PAGE_KEY,
70
+ o.value
52
71
  ), e;
53
- }), W = _(() => ({
72
+ }), re = d(() => ({
54
73
  ...a.tableProps,
55
- ...D
56
- })), z = (e, t = !0) => {
57
- const l = JSON.stringify(e) === JSON.stringify(y.value);
58
- return !l && t && console.warn(
74
+ ...Q
75
+ })), A = (e, t = !0) => {
76
+ const u = JSON.stringify(e) === JSON.stringify(S.value);
77
+ return !u && t && console.warn(
59
78
  `同一地方 并发请求 参数冰花 当前不是最新的参数 丢弃结果 ${JSON.stringify(
60
79
  e
61
- )} => ${JSON.stringify(y.value)}`
62
- ), l;
63
- }, N = (e = !1) => {
64
- if (!o.value) return;
65
- h.value ? console.warn("请求并发") : h.value = !0, e || (I.value = !0);
66
- const t = $(y.value);
67
- a.api(t).then((l) => {
68
- z(t, !1) && (w.value = Y(
69
- l,
70
- b.LIST_KEY
71
- ), x.value = Y(
72
- l,
73
- b.TOTAL_KEY
74
- ), c("pageInfoChange", {
75
- pageSize: o.value,
76
- currentPage: n.value,
77
- total: x.value
80
+ )} => ${JSON.stringify(S.value)}`
81
+ ), u;
82
+ }, K = (e = !1) => {
83
+ if (!i.value) return;
84
+ h.value ? console.warn("请求并发") : h.value = !0, e || (x.value = !0);
85
+ const t = U(S.value);
86
+ 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: i.value,
95
+ currentPage: o.value,
96
+ total: w.value
78
97
  }));
79
98
  }).finally(() => {
80
- z(t) && (h.value = !1, I.value = !1);
99
+ A(t) && (h.value = !1, x.value = !1);
81
100
  });
82
- }, k = (e = !1) => {
83
- N(e);
84
- }, Z = (e = !1) => {
85
- n.value === 1 ? k(e) : n.value = 1;
86
- }, Q = (e) => e, v = {
87
- refresh: k,
88
- reload: Z,
89
- getTableInstance: () => T.value
90
- }, R = (e, t = []) => ({
91
- ...M(e, ["render", "headerRender"].concat(t)),
101
+ }, j = (e = !1) => {
102
+ K(e);
103
+ }, ae = (e = !1) => {
104
+ o.value === 1 ? j(e) : o.value = 1;
105
+ }, oe = (e) => e, v = {
106
+ refresh: j,
107
+ reload: ae,
108
+ getTableInstance: () => z.value
109
+ }, B = (e, t = []) => ({
110
+ ...q(e, ["render", "headerRender"].concat(t)),
92
111
  injectInfo: a.injectInfo || {},
93
112
  exposeInfo: v
94
- }), H = (e) => ({
95
- ...M(e, ["render", "headerRender"]),
113
+ }), L = (e) => ({
114
+ ...q(e, ["render", "headerRender"]),
96
115
  injectInfo: a.injectInfo || {},
97
116
  exposeInfo: v
98
117
  });
99
- G(v);
100
- const X = (e) => {
101
- o.value = e, n.value = 1;
102
- }, K = (e) => !e || e === "expand";
103
- return ge(() => {
104
- o.value = a.pageSizeInit, de(() => {
118
+ W(v);
119
+ const ne = (e) => {
120
+ i.value = e, o.value = 1;
121
+ }, M = (e) => !e || e === "expand";
122
+ return be(() => {
123
+ i.value = a.pageSizeInit, Ce(() => {
105
124
  v.refresh();
106
125
  });
107
- }), g(w, (e) => {
108
- c("dataChange", e);
109
- }), g(
126
+ }), c(T, (e) => {
127
+ m("dataChange", e);
128
+ }), c(
110
129
  () => a.query,
111
130
  (e, t) => {
112
- JSON.stringify(e) !== JSON.stringify(t) && (n.value = 1);
131
+ JSON.stringify(e) !== JSON.stringify(t) && (o.value = 1);
113
132
  }
114
- ), g(
115
- y,
133
+ ), c(
134
+ S,
116
135
  (e, t) => {
117
- JSON.stringify(e) !== JSON.stringify(t) && N();
136
+ JSON.stringify(e) !== JSON.stringify(t) && K();
118
137
  },
119
138
  {
120
139
  immediate: !0
121
140
  }
122
- ), g(I, (e) => {
123
- c("loadingChange", e);
124
- }), g(o, (e) => {
125
- c("pageSizeChange", e);
126
- }), g(n, (e) => {
127
- c("pageChange", e);
141
+ ), c(x, (e) => {
142
+ m("loadingChange", e);
143
+ }), c(i, (e) => {
144
+ m("pageSizeChange", e);
145
+ }), c(o, (e) => {
146
+ m("pageChange", e);
128
147
  }), (e, t) => {
129
- const l = ne, ee = oe, te = ae, re = ie;
130
- return i(), m("div", Se, [
131
- L(te, d({
148
+ const u = fe, le = ge, ie = ue, se = pe;
149
+ return n(), y("div", Oe, [
150
+ l(N) ? (n(), b(l(Re), {
151
+ key: 0,
152
+ onHeightChange: X
153
+ }, {
154
+ default: C(() => [
155
+ I(Ie, p({
156
+ "is-auto-refresh": P.value,
157
+ "onUpdate:isAutoRefresh": t[0] || (t[0] = (r) => P.value = r),
158
+ tableExpose: v,
159
+ loading: l(h)
160
+ }, a.toolbar), null, 16, ["is-auto-refresh", "loading"])
161
+ ]),
162
+ _: 1
163
+ })) : Se("", !0),
164
+ I(ie, p({
132
165
  ref_key: "elTable",
133
- ref: T,
166
+ ref: z,
134
167
  class: "table-main-table",
135
168
  stripe: "",
136
169
  border: "",
137
170
  highlightCurrentRow: ""
138
- }, u(W), {
139
- maxHeight: u(U),
140
- data: u(w),
141
- rowKey: Q(f.rowKey)
171
+ }, l(re), {
172
+ maxHeight: l(te),
173
+ data: l(T),
174
+ rowKey: oe(s.rowKey)
142
175
  }), {
143
- empty: S(() => [
144
- u(h) ? (i(), m(C, { key: 0 }, [
145
- P("加载中...")
146
- ], 64)) : (i(), E(ee, { key: 1 }))
176
+ empty: C(() => [
177
+ l(h) ? (n(), y(_, { key: 0 }, [
178
+ R("加载中...")
179
+ ], 64)) : (n(), b(le, { key: 1 }))
147
180
  ]),
148
- default: S(() => [
149
- (i(!0), m(C, null, ce(f.columns, (r) => (i(), E(l, d({
181
+ default: C(() => [
182
+ (n(!0), y(_, null, _e(s.columns, (r) => (n(), b(u, p({
150
183
  key: r.columnKey || r.prop
151
- }, { ref_for: !0 }, r), me({ _: 2 }, [
152
- K(r.type) ? {
184
+ }, { ref_for: !0 }, r), Ee({ _: 2 }, [
185
+ M(r.type) ? {
153
186
  name: "default",
154
- fn: S((s) => [
155
- j(e.$slots, r.prop, d({ ref_for: !0 }, R(s)), () => [
156
- r.render ? (i(), E(A(r.render), d({
187
+ fn: C((f) => [
188
+ J(e.$slots, r.prop, p({ ref_for: !0 }, B(f)), () => [
189
+ r.render ? (n(), b(V(r.render), p({
157
190
  key: 0,
158
191
  ref_for: !0
159
- }, R(s, ["$index"]), {
160
- _index: s.$index
161
- }), null, 16, ["_index"])) : (i(), m(C, { key: 1 }, [
162
- P(J(s.row[r.prop]), 1)
192
+ }, B(f, ["$index"]), {
193
+ _index: f.$index
194
+ }), null, 16, ["_index"])) : (n(), y(_, { key: 1 }, [
195
+ R($(f.row[r.prop]), 1)
163
196
  ], 64))
164
197
  ], !0)
165
198
  ]),
166
199
  key: "0"
167
200
  } : void 0,
168
- K(r.type) ? {
201
+ M(r.type) ? {
169
202
  name: "header",
170
- fn: S((s) => [
171
- j(e.$slots, `header-${r.prop}`, d({ ref_for: !0 }, H(s)), () => [
172
- r.headerRender ? (i(), E(A(r.headerRender), d({
203
+ fn: C((f) => [
204
+ J(e.$slots, `header-${r.prop}`, p({ ref_for: !0 }, L(f)), () => [
205
+ r.headerRender ? (n(), b(V(r.headerRender), p({
173
206
  key: 0,
174
207
  ref_for: !0
175
- }, H(s)), null, 16)) : (i(), m(C, { key: 1 }, [
176
- P(J(r.label), 1)
208
+ }, L(f)), null, 16)) : (n(), y(_, { key: 1 }, [
209
+ R($(r.label), 1)
177
210
  ], 64))
178
211
  ], !0)
179
212
  ]),
@@ -183,26 +216,26 @@ const Se = { class: "table-main" }, Ce = { class: "table-main-pagination" }, Ke
183
216
  ]),
184
217
  _: 3
185
218
  }, 16, ["maxHeight", "data", "rowKey"]),
186
- he(ye("div", Ce, [
187
- L(re, {
188
- "current-page": u(n),
189
- "onUpdate:currentPage": t[0] || (t[0] = (r) => B(n) ? n.value = r : null),
190
- "page-size": u(o),
191
- "onUpdate:pageSize": t[1] || (t[1] = (r) => B(o) ? o.value = r : null),
192
- "page-sizes": f.pageSizeOptions,
193
- small: "",
219
+ Te(we("div", ze, [
220
+ I(se, {
221
+ "current-page": l(o),
222
+ "onUpdate:currentPage": t[1] || (t[1] = (r) => Y(o) ? o.value = r : null),
223
+ "page-size": l(i),
224
+ "onUpdate:pageSize": t[2] || (t[2] = (r) => Y(i) ? i.value = r : null),
225
+ "page-sizes": s.pageSizeOptions,
226
+ size: "small",
194
227
  background: "",
195
- layout: f.pageLayout,
196
- total: u(x),
197
- onSizeChange: X
228
+ layout: s.pageLayout,
229
+ total: l(w),
230
+ onSizeChange: ne
198
231
  }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])
199
232
  ], 512), [
200
- [ve, f.showPager]
233
+ [xe, s.showPager]
201
234
  ])
202
235
  ]);
203
236
  };
204
237
  }
205
238
  });
206
239
  export {
207
- Ke as default
240
+ qe as default
208
241
  };
@@ -0,0 +1,7 @@
1
+ import o from "./TableToolbar.vue2.mjs";
2
+ /* empty css */
3
+ import a from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-d2a1aea9"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,95 @@
1
+ import { ElInputNumber as g, ElSwitch as w, ElButton as y, ElIcon as C } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/button/style/css";
4
+ import "element-plus/es/components/icon/style/css";
5
+ import "element-plus/es/components/switch/style/css";
6
+ import "element-plus/es/components/input-number/style/css";
7
+ import { defineComponent as M, useModel as N, computed as p, ref as T, watch as i, openBlock as a, createElementBlock as h, createElementVNode as m, Fragment as z, createVNode as f, isRef as S, unref as v, createCommentVNode as c, createBlock as b, withCtx as E, normalizeClass as U, mergeModels as F } from "vue";
8
+ import { Refresh as j } from "@element-plus/icons-vue";
9
+ import { useTimeout as q } from "../../hooks/timeout.mjs";
10
+ import { useActivatedExec as D } from "../../hooks/activated.mjs";
11
+ const G = { class: "table-toolbar" }, H = { class: "table-toolbar-right" }, $ = /* @__PURE__ */ M({
12
+ __name: "TableToolbar",
13
+ props: /* @__PURE__ */ F({
14
+ features: { default: () => ["refresh", "autoRefresh"] },
15
+ refreshInterval: { default: 30 },
16
+ tableExpose: {},
17
+ loading: { type: Boolean }
18
+ }, {
19
+ isAutoRefresh: { type: Boolean },
20
+ isAutoRefreshModifiers: {}
21
+ }),
22
+ emits: ["update:isAutoRefresh"],
23
+ setup(n) {
24
+ const e = n, t = N(n, "isAutoRefresh"), R = p(
25
+ () => e.features === void 0 || e.features.includes("refresh")
26
+ ), d = p(
27
+ () => e.features === void 0 || e.features.includes("autoRefresh")
28
+ ), l = T(30);
29
+ i(
30
+ () => e.refreshInterval,
31
+ (r) => {
32
+ l.value = r;
33
+ },
34
+ { immediate: !0 }
35
+ );
36
+ const [x, V] = q(), s = () => {
37
+ x(() => {
38
+ e.tableExpose.refresh(), t.value && s();
39
+ }, l.value * 1e3);
40
+ }, _ = () => {
41
+ e.tableExpose.refresh(), t.value && s();
42
+ };
43
+ return i(t, (r) => {
44
+ r ? s() : V();
45
+ }), i(l, () => {
46
+ t.value && s();
47
+ }), D(() => {
48
+ t.value && (e.tableExpose.refresh(), s());
49
+ }), (r, o) => {
50
+ const k = g, A = w, B = C, I = y;
51
+ return a(), h("div", G, [
52
+ m("div", H, [
53
+ d.value && t.value ? (a(), h(z, { key: 0 }, [
54
+ o[2] || (o[2] = m("span", { class: "table-toolbar-label" }, "刷新间隔", -1)),
55
+ f(k, {
56
+ modelValue: v(l),
57
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => S(l) ? l.value = u : null),
58
+ min: 1,
59
+ step: 5,
60
+ size: "small",
61
+ class: "table-toolbar-interval"
62
+ }, null, 8, ["modelValue"]),
63
+ o[3] || (o[3] = m("span", { class: "table-toolbar-label" }, "秒", -1))
64
+ ], 64)) : c("", !0),
65
+ d.value ? (a(), b(A, {
66
+ key: 1,
67
+ modelValue: t.value,
68
+ "onUpdate:modelValue": o[1] || (o[1] = (u) => t.value = u),
69
+ "active-text": "自动刷新"
70
+ }, null, 8, ["modelValue"])) : c("", !0),
71
+ R.value ? (a(), b(I, {
72
+ key: 2,
73
+ circle: "",
74
+ onClick: _
75
+ }, {
76
+ default: E(() => [
77
+ f(B, {
78
+ class: U({ "table-toolbar-icon--rotating": n.loading })
79
+ }, {
80
+ default: E(() => [
81
+ f(v(j))
82
+ ]),
83
+ _: 1
84
+ }, 8, ["class"])
85
+ ]),
86
+ _: 1
87
+ })) : c("", !0)
88
+ ])
89
+ ]);
90
+ };
91
+ }
92
+ });
93
+ export {
94
+ $ as default
95
+ };
@@ -0,0 +1,66 @@
1
+ async function A(a, c, e) {
2
+ var s;
3
+ const i = (e == null ? void 0 : e.pageSize) ?? 200, r = (e == null ? void 0 : e.limit) ?? 1e4;
4
+ if (i < 1 || i > 1e3)
5
+ throw new Error(
6
+ `fetchListAll: pageSize 必须在 [1, 1000] 范围内(实际 ${i})`
7
+ );
8
+ const t = [];
9
+ let n = 1;
10
+ for (; ; ) {
11
+ const o = {
12
+ ...c,
13
+ page: { page: n, pageSize: i }
14
+ }, l = await a(o), p = l.items, g = ((s = l.page) == null ? void 0 : s.totalRecord) ?? 0;
15
+ if (n === 1 && g > r)
16
+ throw new Error(
17
+ `fetchListAll 超出上限 ${r}(实际 totalRecord=${g}),请手动分页或质疑工具适用性`
18
+ );
19
+ if (t.push(...p), p.length < i || t.length >= g) break;
20
+ n += 1;
21
+ }
22
+ return t;
23
+ }
24
+ function f(a) {
25
+ return async (c) => {
26
+ const e = c.page;
27
+ if (!e)
28
+ throw new Error("createListApi: params.page 必填(含 page / pageSize)");
29
+ const { page: i, pageSize: r } = e;
30
+ if (!r || r <= 0)
31
+ throw new Error("createListApi: pageSize 必须 > 0");
32
+ let t;
33
+ if (Array.isArray(a))
34
+ t = a;
35
+ else {
36
+ const o = a();
37
+ if (o instanceof Promise) {
38
+ const l = await o;
39
+ if (!Array.isArray(l))
40
+ throw new Error("createListApi: 异步 source 返回值必须为数组");
41
+ t = l;
42
+ } else
43
+ t = o;
44
+ }
45
+ const n = (i - 1) * r, s = n + r;
46
+ return {
47
+ items: t.slice(n, s),
48
+ page: {
49
+ totalRecord: t.length,
50
+ pageSize: r,
51
+ totalPage: Math.ceil(t.length / r)
52
+ }
53
+ };
54
+ };
55
+ }
56
+ function h(a, c) {
57
+ return a({
58
+ ...c,
59
+ page: { page: 1, pageSize: 1 }
60
+ }).then((e) => e.page.totalRecord);
61
+ }
62
+ export {
63
+ h as countAll,
64
+ f as createListApi,
65
+ A as fetchListAll
66
+ };
@@ -0,0 +1,21 @@
1
+ import { ref as c, onBeforeUnmount as n, watch as s } from "vue";
2
+ import { useActivated as v } from "./activated.mjs";
3
+ const l = (o = !0) => {
4
+ const { isActivated: r } = v(), e = c(void 0), t = () => {
5
+ e.value !== null && e.value !== void 0 && (clearTimeout(e.value), e.value = void 0);
6
+ }, u = (i, m) => {
7
+ t(), e.value = setTimeout(i, m);
8
+ };
9
+ return o && n(t), s(
10
+ r,
11
+ (i) => {
12
+ i || o && t();
13
+ },
14
+ {
15
+ immediate: !0
16
+ }
17
+ ), [u, t];
18
+ };
19
+ export {
20
+ l as useTimeout
21
+ };
package/es/index.mjs CHANGED
@@ -5,15 +5,15 @@ import { miscInstall as a } from "./components/misc/index.mjs";
5
5
  import { modalInstall as m } from "./components/modal/index.mjs";
6
6
  import { tableInstall as f } from "./components/table/index.mjs";
7
7
  import { listPageInstall as s } from "./components/list-page/index.mjs";
8
- import { default as F } from "./components/modal/DetailModal.vue.mjs";
9
- import { default as c } from "./components/form/FormMain.vue.mjs";
8
+ import { default as E } from "./components/modal/DetailModal.vue.mjs";
9
+ import { default as _ } from "./components/form/FormMain.vue.mjs";
10
10
  import { default as M } from "./components/form/FormRadioGroup.vue.mjs";
11
- import { default as T } from "./components/form/FormSelect.vue.mjs";
12
- import { default as D } from "./components/form/FormTree.vue.mjs";
13
- import { default as O } from "./components/form/FormVerifyCode.vue.mjs";
11
+ import { default as S } from "./components/form/FormSelect.vue.mjs";
12
+ import { default as L } from "./components/form/FormTree.vue.mjs";
13
+ import { default as D } from "./components/form/FormVerifyCode.vue.mjs";
14
14
  import { default as P } from "./components/menu/MenuItemSub.vue.mjs";
15
- import { default as N } from "./components/menu/MenuTree.vue.mjs";
16
- import { default as h } from "./components/misc/TriggerAutoImport.vue.mjs";
15
+ import { default as G } from "./components/menu/MenuTree.vue.mjs";
16
+ import { default as b } from "./components/misc/TriggerAutoImport.vue.mjs";
17
17
  import { default as y } from "./components/display/WatchSize.vue.mjs";
18
18
  import { APP_API_LIST_MODEL_KEY_CONFIG as v } from "./config/list-model.mjs";
19
19
  import { BODY_CONTENT_VIEWPORT_HEIGHT as H } from "./inject/key.mjs";
@@ -24,16 +24,18 @@ import { default as le } from "./components/form/FormSearch.vue.mjs";
24
24
  import { default as ie } from "./components/form/FormVerifyImage.vue.mjs";
25
25
  import { default as ne } from "./components/list-page/ListPage.vue.mjs";
26
26
  import { ROUTE_MODULE_LEVEL as de } from "./config/route.mjs";
27
- import { default as ge } from "./components/table/TableMain.vue.mjs";
28
- import { createGenerateRouteMetaRawTree as Fe } from "./helpers/route.mjs";
29
- import { createStorageWithNamespace as ce } from "./helpers/storage.mjs";
30
- import { createUseState as Me } from "./helpers/state.mjs";
31
- import { flatRouteMetaResolveRaw as Te, getRoutePermissionKey as Re } from "./utils/router.mjs";
32
- import { getId as Le } from "./utils/id.mjs";
33
- import { timeCountDown as Ae } from "./utils/time.mjs";
34
- import { useActivated as Ge, useActivatedEvent as Ne, useActivatedExec as be } from "./hooks/activated.mjs";
35
- import { useFeelSize as we } from "./hooks/feel-size.mjs";
36
- import { useMenusDataDispatch as Ve } from "./hooks/menus-dispatch.mjs";
27
+ import { default as ce } from "./components/table/TableMain.vue.mjs";
28
+ import { countAll as Ee, createListApi as Fe, fetchListAll as _e } from "./helpers/list-helper.mjs";
29
+ import { createGenerateRouteMetaRawTree as Me } from "./helpers/route.mjs";
30
+ import { createStorageWithNamespace as Se } from "./helpers/storage.mjs";
31
+ import { createUseState as Le } from "./helpers/state.mjs";
32
+ import { flatRouteMetaResolveRaw as De, getRoutePermissionKey as Oe } from "./utils/router.mjs";
33
+ import { getId as he } from "./utils/id.mjs";
34
+ import { timeCountDown as Ne } from "./utils/time.mjs";
35
+ import { useActivated as we, useActivatedEvent as ye, useActivatedExec as Ve } from "./hooks/activated.mjs";
36
+ import { useFeelSize as Ue } from "./hooks/feel-size.mjs";
37
+ import { useMenusDataDispatch as We } from "./hooks/menus-dispatch.mjs";
38
+ import { useTimeout as Be } from "./hooks/timeout.mjs";
37
39
  const I = {
38
40
  install(e) {
39
41
  e.use(t), e.use(o), e.use(r), e.use(a), e.use(m), e.use(f), e.use(s);
@@ -43,37 +45,40 @@ export {
43
45
  v as APP_API_LIST_MODEL_KEY_CONFIG,
44
46
  H as BODY_CONTENT_VIEWPORT_HEIGHT,
45
47
  z as ConfirmModal,
46
- F as DetailModal,
48
+ E as DetailModal,
47
49
  K as FORM_CONFIG_SELECT_ALL_VALUE,
48
50
  J as FORM_ITEM_CHANGE_LOADING,
49
- c as FormMain,
51
+ _ as FormMain,
50
52
  M as FormRadioGroup,
51
53
  le as FormSearch,
52
- T as FormSelect,
53
- D as FormTree,
54
- O as FormVerifyCode,
54
+ S as FormSelect,
55
+ L as FormTree,
56
+ D as FormVerifyCode,
55
57
  ie as FormVerifyImage,
56
58
  ne as ListPage,
57
59
  P as MenuItemSub,
58
- N as MenuTree,
60
+ G as MenuTree,
59
61
  de as ROUTE_MODULE_LEVEL,
60
- ge as TableMain,
61
- h as TriggerAutoImport,
62
+ ce as TableMain,
63
+ b as TriggerAutoImport,
62
64
  y as WatchSize,
63
- Fe as createGenerateRouteMetaRawTree,
64
- ce as createStorageWithNamespace,
65
- Me as createUseState,
65
+ Ee as countAll,
66
+ Me as createGenerateRouteMetaRawTree,
67
+ Fe as createListApi,
68
+ Se as createStorageWithNamespace,
69
+ Le as createUseState,
66
70
  r as displayInstall,
67
- Te as flatRouteMetaResolveRaw,
71
+ _e as fetchListAll,
72
+ De as flatRouteMetaResolveRaw,
68
73
  t as formInstall,
69
74
  Q as generateFormData,
70
75
  X as getBlurSubmit,
71
76
  Z as getChangeSubmit,
72
77
  Y as getConfirmPasswordRule,
73
78
  $ as getEnterSubmit,
74
- Le as getId,
79
+ he as getId,
75
80
  ee as getPlaceholder,
76
- Re as getRoutePermissionKey,
81
+ Oe as getRoutePermissionKey,
77
82
  te as getVModelSugar,
78
83
  I as installComponents,
79
84
  s as listPageInstall,
@@ -88,10 +93,11 @@ export {
88
93
  me as stringifyFormData,
89
94
  fe as swiftFormItemConfig,
90
95
  f as tableInstall,
91
- Ae as timeCountDown,
92
- Ge as useActivated,
93
- Ne as useActivatedEvent,
94
- be as useActivatedExec,
95
- we as useFeelSize,
96
- Ve as useMenusDataDispatch
96
+ Ne as timeCountDown,
97
+ we as useActivated,
98
+ ye as useActivatedEvent,
99
+ Ve as useActivatedExec,
100
+ Ue as useFeelSize,
101
+ We as useMenusDataDispatch,
102
+ Be as useTimeout
97
103
  };
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}.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-main-table[data-v-c7f10ff2]{--el-table-header-bg-color: var(--d46c1602)}.table-main-pagination[data-v-c7f10ff2]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-c9564dc7]{min-height:var(--f49642f0)}.list-page-operation[data-v-c9564dc7]{margin-bottom:10px}.list-page[data-v-c9564dc7] .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}.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-d2a1aea9]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-d2a1aea9]{display:flex;align-items:center;gap:8px}.table-toolbar-label[data-v-d2a1aea9]{font-size:13px;color:var(--el-text-color-regular)}.table-toolbar-interval[data-v-d2a1aea9]{width:80px}.table-toolbar-icon--rotating[data-v-d2a1aea9]{animation:table-toolbar-rotating-d2a1aea9 1s linear infinite}@keyframes table-toolbar-rotating-d2a1aea9{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-08dc9d04]{--el-table-header-bg-color: var(--v1961e86c)}.table-main-pagination[data-v-08dc9d04]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-767c1592]{min-height:var(--v036568fb)}.list-page-operation[data-v-767c1592]{margin-bottom:10px}.list-page[data-v-767c1592] .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.0.1-alpha.1",
3
+ "version": "0.1.0",
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": "66c74dcd8e8bb283b06a1a2515f98406fe9b0f13"
80
+ "gitHead": "c36a32fd56c54e6450e2abd2124bdc1642c8bb80"
81
81
  }
@@ -22,6 +22,8 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
22
22
  injectInfo?: F | undefined;
23
23
  beforeSearch?: ((data: import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>, type: FormSearchSearchType) => import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>) | undefined;
24
24
  clearTableFilterOnReset?: boolean;
25
+ } & {
26
+ isAutoRefresh?: boolean;
25
27
  }), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
26
28
  expose(exposed: import('vue').ShallowUnwrapRef<ListPageInstance<PO>>): void;
27
29
  attrs: any;
@@ -11,7 +11,9 @@ declare const _default: <T extends Record<string, any>, SQ extends Record<string
11
11
  currentPage: number;
12
12
  total: number;
13
13
  }) => any) | undefined;
14
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & TableMainProps<T, SQ, F>, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
14
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & (TableMainProps<T, SQ, F> & {
15
+ isAutoRefresh?: boolean;
16
+ }), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
15
17
  expose(exposed: import('vue').ShallowUnwrapRef<TableMainInstance>): void;
16
18
  attrs: any;
17
19
  slots: ReturnType<() => Partial<Record<NonNullable<Uppercase<string> | Extract<keyof T, string> | undefined>, (_: {
@@ -0,0 +1,43 @@
1
+ import { TableMainInstance } from './types';
2
+
3
+ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
4
+ isAutoRefresh: import('vue').PropType<boolean>;
5
+ loading: {
6
+ type: globalThis.PropType<boolean>;
7
+ required: true;
8
+ };
9
+ features: {
10
+ type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
11
+ default: () => string[];
12
+ };
13
+ refreshInterval: {
14
+ type: globalThis.PropType<number>;
15
+ default: number;
16
+ };
17
+ tableExpose: {
18
+ type: globalThis.PropType<TableMainInstance>;
19
+ required: true;
20
+ };
21
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
22
+ isAutoRefresh: import('vue').PropType<boolean>;
23
+ loading: {
24
+ type: globalThis.PropType<boolean>;
25
+ required: true;
26
+ };
27
+ features: {
28
+ type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
29
+ default: () => string[];
30
+ };
31
+ refreshInterval: {
32
+ type: globalThis.PropType<number>;
33
+ default: number;
34
+ };
35
+ tableExpose: {
36
+ type: globalThis.PropType<TableMainInstance>;
37
+ required: true;
38
+ };
39
+ }>> & Readonly<{}>, {
40
+ features: import('./types').TableToolbarFeature[];
41
+ refreshInterval: number;
42
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
43
+ export default _default;
@@ -22,6 +22,20 @@ export interface TableMainInstance {
22
22
  reload: (slice?: boolean) => void;
23
23
  getTableInstance: () => TableInstance | undefined;
24
24
  }
25
+ /** toolbar 可配置功能列表 */
26
+ export type TableToolbarFeature = "refresh" | "autoRefresh";
27
+ /** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
28
+ export interface TableToolbarConfig {
29
+ /**
30
+ * 功能列表。
31
+ * - undefined(默认):显示所有功能
32
+ * - [](空数组):不渲染 toolbar
33
+ * - 枚举子集:仅显示指定功能
34
+ */
35
+ features?: TableToolbarFeature[];
36
+ /** 自动刷新默认间隔(秒),默认 30 */
37
+ refreshInterval?: number;
38
+ }
25
39
  /** 表格列默认作用域 */
26
40
  export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
27
41
  row: T;
@@ -66,6 +80,10 @@ SQ extends Record<string, any>,
66
80
  F extends Record<string, any>> {
67
81
  /** 展示分页器 */
68
82
  showPager?: boolean;
83
+ /** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.features) */
84
+ showToolbar?: boolean;
85
+ /** toolbar 配置 */
86
+ toolbar?: TableToolbarConfig;
69
87
  /** 参数 */
70
88
  query?: SQ;
71
89
  /** 每页条数 */
@@ -2,3 +2,5 @@ export * from './form';
2
2
  export * from './storage';
3
3
  export * from './state';
4
4
  export * from './route';
5
+ export * from './types';
6
+ export * from './list-helper';
@@ -0,0 +1,36 @@
1
+ import { TableApiParams, TableApiResult } from '../components/table/types';
2
+
3
+ export interface FetchListAllOptions {
4
+ /** 单页大小,默认 200,范围 [1, 1000] */
5
+ pageSize?: number;
6
+ /** 累计抓取上限,默认 10000;totalRecord > limit 则 throw */
7
+ limit?: number;
8
+ }
9
+ /**
10
+ * 全量翻页拉取(串行,提前终止)
11
+ * ---
12
+ * @param api 原始分页 api 函数(签名同 TableMain :api prop)
13
+ * @param baseParams 业务侧固定参数,会透传到每页 api 调用(不被改写)
14
+ * @param opts pageSize / limit 覆盖
15
+ * @returns 全量 items 数组
16
+ *
17
+ * 行为:
18
+ * - totalRecord = 0 → 直接 [] 返回(仅调 1 次)
19
+ * - 单页 items.length < pageSize → 视为末页提前终止
20
+ * - 任一页 reject → 整体 reject 透传原错误
21
+ * - totalRecord > limit → throw 兜底
22
+ */
23
+ export declare function fetchListAll<T extends Record<string, any>, P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<T>>, baseParams?: P, opts?: FetchListAllOptions): Promise<T[]>;
24
+ export type ListApiSource<T> = T[] | (() => T[]) | (() => Promise<T[]>);
25
+ /**
26
+ * 用本地数组 / 同步函数 / 异步函数生成符合 TableMain :api prop 签名的 api
27
+ * ---
28
+ * 内部识别 source 类型 + 分页切片;无缓存,每次调用 source 重新求值
29
+ */
30
+ export declare function createListApi<T extends Record<string, any>>(source: ListApiSource<T>): (params: TableApiParams<{}>) => Promise<TableApiResult<T>>;
31
+ /**
32
+ * countAll: 仅探测列表总记录数,不拉数据。
33
+ * 1 次 api 调用 page=1/pageSize=1,返回 totalRecord。
34
+ * 用于"探测是否有数据 / 数据计数 / 存在性判断"等场景,替代手工 pageSize: 9999 hack。
35
+ */
36
+ export declare function countAll<P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<any>>, baseParams?: P): Promise<number>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 深度递归 Partial(函数类型保持不变,object 类型字段递归可选)
3
+ * ---
4
+ * 应用场景:SDK 请求参数嵌套结构的可选化(如 PagingInput)
5
+ */
6
+ export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends object ? {
7
+ [K in keyof T]?: DeepPartial<T[K]>;
8
+ } : T;
9
+ /**
10
+ * 分页请求参数的可选包装
11
+ * ---
12
+ * 与 SDK 1.1.40 嵌套契约耦合:业务侧手包 list api wrapper 时
13
+ * 常以 PagingInput<RawApiParams> 作为入参类型,兜底字段缺失
14
+ */
15
+ export type PagingInput<T> = DeepPartial<T>;
@@ -1,3 +1,4 @@
1
1
  export * from './activated';
2
2
  export * from './feel-size';
3
3
  export * from './menus-dispatch';
4
+ export * from './timeout';
@@ -0,0 +1,7 @@
1
+ export type ClearTimer = () => void;
2
+ export type SetTimer = (handler: () => void, timeout: number) => void;
3
+ /**
4
+ * 使用定时器
5
+ * @param autoClear 是否在生命周期结束前自动清除定时器
6
+ */
7
+ export declare const useTimeout: (autoClear?: boolean) => [SetTimer, ClearTimer];