@done-coding/admin-core 0.1.1-alpha.1 → 0.1.1-alpha.3

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,61 +1,57 @@
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;
1
+ async function A(r, n, e) {
2
+ var o;
3
+ const i = (e == null ? void 0 : e.pageSize) ?? 200, a = (e == null ? void 0 : e.limit) ?? 1e4;
4
4
  if (i < 1 || i > 1e3)
5
5
  throw new Error(
6
6
  `fetchListAll: pageSize 必须在 [1, 1000] 范围内(实际 ${i})`
7
7
  );
8
8
  const t = [];
9
- let n = 1;
9
+ let c = 1;
10
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;
11
+ const s = {
12
+ ...n,
13
+ page: { page: c, pageSize: i }
14
+ }, l = await r(s), g = l.items, p = ((o = l.page) == null ? void 0 : o.totalRecord) ?? 0;
15
+ if (t.push(...g), t.length >= a || g.length < i || t.length >= p) break;
16
+ c += 1;
21
17
  }
22
- return t;
18
+ return t.slice(0, a);
23
19
  }
24
- function f(a) {
25
- return async (c) => {
26
- const e = c.page;
20
+ function f(r) {
21
+ return async (n) => {
22
+ const e = n.page;
27
23
  if (!e)
28
24
  throw new Error("createListApi: params.page 必填(含 page / pageSize)");
29
- const { page: i, pageSize: r } = e;
30
- if (!r || r <= 0)
25
+ const { page: i, pageSize: a } = e;
26
+ if (!a || a <= 0)
31
27
  throw new Error("createListApi: pageSize 必须 > 0");
32
28
  let t;
33
- if (Array.isArray(a))
34
- t = a;
29
+ if (Array.isArray(r))
30
+ t = r;
35
31
  else {
36
- const o = a();
37
- if (o instanceof Promise) {
38
- const l = await o;
32
+ const s = r();
33
+ if (s instanceof Promise) {
34
+ const l = await s;
39
35
  if (!Array.isArray(l))
40
36
  throw new Error("createListApi: 异步 source 返回值必须为数组");
41
37
  t = l;
42
38
  } else
43
- t = o;
39
+ t = s;
44
40
  }
45
- const n = (i - 1) * r, s = n + r;
41
+ const c = (i - 1) * a, o = c + a;
46
42
  return {
47
- items: t.slice(n, s),
43
+ items: t.slice(c, o),
48
44
  page: {
49
45
  totalRecord: t.length,
50
- pageSize: r,
51
- totalPage: Math.ceil(t.length / r)
46
+ pageSize: a,
47
+ totalPage: Math.ceil(t.length / a)
52
48
  }
53
49
  };
54
50
  };
55
51
  }
56
- function h(a, c) {
57
- return a({
58
- ...c,
52
+ function h(r, n) {
53
+ return r({
54
+ ...n,
59
55
  page: { page: 1, pageSize: 1 }
60
56
  }).then((e) => e.page.totalRecord);
61
57
  }
package/es/index.mjs CHANGED
@@ -5,41 +5,42 @@ 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 E } from "./components/form/FormDateTimeRange.vue.mjs";
8
+ import { default as T } from "./components/modal/DetailModal.vue.mjs";
9
+ import { default as g } from "./components/form/FormDateTimeRange.vue.mjs";
10
10
  import { default as R } from "./components/form/FormMain.vue.mjs";
11
11
  import { default as C } from "./components/form/FormRadio.vue.mjs";
12
- import { default as S } from "./components/form/FormRadioGroup.vue.mjs";
13
- import { default as D } from "./components/form/FormSelect.vue.mjs";
14
- import { default as P } from "./components/form/FormTree.vue.mjs";
12
+ import { default as L } from "./components/form/FormRadioGroup.vue.mjs";
13
+ import { default as S } from "./components/form/FormSelect.vue.mjs";
14
+ import { default as D } from "./components/form/FormTree.vue.mjs";
15
15
  import { default as h } from "./components/form/FormVerifyCode.vue.mjs";
16
- import { default as G } from "./components/menu/MenuItemSub.vue.mjs";
17
- import { default as w } from "./components/menu/MenuTree.vue.mjs";
16
+ import { default as N } from "./components/menu/MenuItemSub.vue.mjs";
17
+ import { default as V } from "./components/menu/MenuTree.vue.mjs";
18
18
  import { default as v } from "./components/display/TabsMain.vue.mjs";
19
19
  import { default as H } from "./components/misc/TriggerAutoImport.vue.mjs";
20
20
  import { default as W } from "./components/display/WatchSize.vue.mjs";
21
21
  import { APP_API_LIST_MODEL_KEY_CONFIG as B } from "./config/list-model.mjs";
22
- import { default as Q } from "./components/misc/AutoRefresh.vue.mjs";
23
- import { BODY_CONTENT_VIEWPORT_HEIGHT as k } from "./inject/key.mjs";
24
- import { default as J } from "./components/modal/ConfirmModal.vue.mjs";
25
- import { FORM_CONFIG_SELECT_ALL_VALUE as Z, getConfirmPasswordRule as $, passwordRule as ee, setFormComponentType as te } from "./helpers/form.mjs";
26
- import { FORM_ITEM_CHANGE_LOADING as re, generateFormData as ae, getBlurSubmit as me, getChangeSubmit as fe, getEnterSubmit as se, getPlaceholder as le, getVModelSugar as ue, parseFormData as ie, setInputComponent as pe, setSelectComponent as ne, stringifyFormData as xe, swiftFormItemConfig as de } from "./components/form/utils.mjs";
27
- import { default as ce } from "./components/form/FormSearch.vue.mjs";
22
+ import { default as Y } from "./components/misc/AutoRefresh.vue.mjs";
23
+ import { BODY_CONTENT_VIEWPORT_HEIGHT as Q } from "./inject/key.mjs";
24
+ import { default as q } from "./components/modal/ConfirmModal.vue.mjs";
25
+ import { EXPORT_MAX_LIMIT as Z, OPERATE_COLUMN_PROP as $, exportCSV as ee, pickExportColumns as te } from "./utils/export.mjs";
26
+ import { FORM_CONFIG_SELECT_ALL_VALUE as re, getConfirmPasswordRule as ae, passwordRule as me, setFormComponentType as fe } from "./helpers/form.mjs";
27
+ import { FORM_ITEM_CHANGE_LOADING as le, generateFormData as ue, getBlurSubmit as pe, getChangeSubmit as ie, getEnterSubmit as ne, getPlaceholder as xe, getVModelSugar as de, parseFormData as Ie, setInputComponent as ce, setSelectComponent as Ee, stringifyFormData as Te, swiftFormItemConfig as _e } from "./components/form/utils.mjs";
28
+ import { default as Me } from "./components/form/FormSearch.vue.mjs";
28
29
  import { default as Fe } from "./components/form/FormVerifyImage.vue.mjs";
29
- import { default as Ee } from "./components/list-page/ListPage.vue.mjs";
30
- import { ROUTE_MODULE_LEVEL as Re, TabsMainReplaceQueryKey as _e } from "./config/route.mjs";
31
- import { default as Ae } from "./components/table/TableMain.vue.mjs";
32
- import { countAll as Le, createListApi as De, fetchListAll as Oe } from "./helpers/list-helper.mjs";
33
- import { createGenerateRouteMetaRawTree as be } from "./helpers/route.mjs";
34
- import { createStorageWithNamespace as ye } from "./helpers/storage.mjs";
35
- import { createUseState as Ne } from "./helpers/state.mjs";
36
- import { flatRouteMetaResolveRaw as Ve, getRoutePermissionKey as ve } from "./utils/router.mjs";
37
- import { getId as He } from "./utils/id.mjs";
38
- import { timeCountDown as We } from "./utils/time.mjs";
39
- import { useActivated as Be, useActivatedEvent as Ye, useActivatedExec as Qe } from "./hooks/activated.mjs";
40
- import { useFeelSize as ke } from "./hooks/feel-size.mjs";
41
- import { useMenusDataDispatch as Je } from "./hooks/menus-dispatch.mjs";
42
- import { useTimeout as Ze } from "./hooks/timeout.mjs";
30
+ import { default as Ae } from "./components/list-page/ListPage.vue.mjs";
31
+ import { ROUTE_MODULE_LEVEL as Oe, TabsMainReplaceQueryKey as Se } from "./config/route.mjs";
32
+ import { default as De } from "./components/table/TableMain.vue.mjs";
33
+ import { countAll as he, createListApi as ye, fetchListAll as Ne } from "./helpers/list-helper.mjs";
34
+ import { createGenerateRouteMetaRawTree as Ve } from "./helpers/route.mjs";
35
+ import { createStorageWithNamespace as ve } from "./helpers/storage.mjs";
36
+ import { createUseState as He } from "./helpers/state.mjs";
37
+ import { flatRouteMetaResolveRaw as We, getRoutePermissionKey as ze } from "./utils/router.mjs";
38
+ import { getId as Xe } from "./utils/id.mjs";
39
+ import { timeCountDown as ke } from "./utils/time.mjs";
40
+ import { useActivated as je, useActivatedEvent as qe, useActivatedExec as Je } from "./hooks/activated.mjs";
41
+ import { useFeelSize as $e } from "./hooks/feel-size.mjs";
42
+ import { useMenusDataDispatch as tt } from "./hooks/menus-dispatch.mjs";
43
+ import { useTimeout as rt } from "./hooks/timeout.mjs";
43
44
  const I = {
44
45
  install(e) {
45
46
  e.use(t), e.use(o), e.use(r), e.use(a), e.use(m), e.use(f), e.use(s);
@@ -47,66 +48,70 @@ const I = {
47
48
  };
48
49
  export {
49
50
  B as APP_API_LIST_MODEL_KEY_CONFIG,
50
- Q as AutoRefresh,
51
- k as BODY_CONTENT_VIEWPORT_HEIGHT,
52
- J as ConfirmModal,
53
- F as DetailModal,
54
- Z as FORM_CONFIG_SELECT_ALL_VALUE,
55
- re as FORM_ITEM_CHANGE_LOADING,
56
- E as FormDateTimeRange,
51
+ Y as AutoRefresh,
52
+ Q as BODY_CONTENT_VIEWPORT_HEIGHT,
53
+ q as ConfirmModal,
54
+ T as DetailModal,
55
+ Z as EXPORT_MAX_LIMIT,
56
+ re as FORM_CONFIG_SELECT_ALL_VALUE,
57
+ le as FORM_ITEM_CHANGE_LOADING,
58
+ g as FormDateTimeRange,
57
59
  R as FormMain,
58
60
  C as FormRadio,
59
- S as FormRadioGroup,
60
- ce as FormSearch,
61
- D as FormSelect,
62
- P as FormTree,
61
+ L as FormRadioGroup,
62
+ Me as FormSearch,
63
+ S as FormSelect,
64
+ D as FormTree,
63
65
  h as FormVerifyCode,
64
66
  Fe as FormVerifyImage,
65
- Ee as ListPage,
66
- G as MenuItemSub,
67
- w as MenuTree,
68
- Re as ROUTE_MODULE_LEVEL,
69
- Ae as TableMain,
67
+ Ae as ListPage,
68
+ N as MenuItemSub,
69
+ V as MenuTree,
70
+ $ as OPERATE_COLUMN_PROP,
71
+ Oe as ROUTE_MODULE_LEVEL,
72
+ De as TableMain,
70
73
  v as TabsMain,
71
- _e as TabsMainReplaceQueryKey,
74
+ Se as TabsMainReplaceQueryKey,
72
75
  H as TriggerAutoImport,
73
76
  W as WatchSize,
74
- Le as countAll,
75
- be as createGenerateRouteMetaRawTree,
76
- De as createListApi,
77
- ye as createStorageWithNamespace,
78
- Ne as createUseState,
77
+ he as countAll,
78
+ Ve as createGenerateRouteMetaRawTree,
79
+ ye as createListApi,
80
+ ve as createStorageWithNamespace,
81
+ He as createUseState,
79
82
  r as displayInstall,
80
- Oe as fetchListAll,
81
- Ve as flatRouteMetaResolveRaw,
83
+ ee as exportCSV,
84
+ Ne as fetchListAll,
85
+ We as flatRouteMetaResolveRaw,
82
86
  t as formInstall,
83
- ae as generateFormData,
84
- me as getBlurSubmit,
85
- fe as getChangeSubmit,
86
- $ as getConfirmPasswordRule,
87
- se as getEnterSubmit,
88
- He as getId,
89
- le as getPlaceholder,
90
- ve as getRoutePermissionKey,
91
- ue as getVModelSugar,
87
+ ue as generateFormData,
88
+ pe as getBlurSubmit,
89
+ ie as getChangeSubmit,
90
+ ae as getConfirmPasswordRule,
91
+ ne as getEnterSubmit,
92
+ Xe as getId,
93
+ xe as getPlaceholder,
94
+ ze as getRoutePermissionKey,
95
+ de as getVModelSugar,
92
96
  I as installComponents,
93
97
  s as listPageInstall,
94
98
  o as menuInstall,
95
99
  a as miscInstall,
96
100
  m as modalInstall,
97
- ie as parseFormData,
98
- ee as passwordRule,
99
- te as setFormComponentType,
100
- pe as setInputComponent,
101
- ne as setSelectComponent,
102
- xe as stringifyFormData,
103
- de as swiftFormItemConfig,
101
+ Ie as parseFormData,
102
+ me as passwordRule,
103
+ te as pickExportColumns,
104
+ fe as setFormComponentType,
105
+ ce as setInputComponent,
106
+ Ee as setSelectComponent,
107
+ Te as stringifyFormData,
108
+ _e as swiftFormItemConfig,
104
109
  f as tableInstall,
105
- We as timeCountDown,
106
- Be as useActivated,
107
- Ye as useActivatedEvent,
108
- Qe as useActivatedExec,
109
- ke as useFeelSize,
110
- Je as useMenusDataDispatch,
111
- Ze as useTimeout
110
+ ke as timeCountDown,
111
+ je as useActivated,
112
+ qe as useActivatedEvent,
113
+ Je as useActivatedExec,
114
+ $e as useFeelSize,
115
+ tt as useMenusDataDispatch,
116
+ rt as useTimeout
112
117
  };
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-4446ddf0]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-4446ddf0]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-4446ddf0]{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-efbd16f8]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-efbd16f8]{display:flex;align-items:center;gap:8px}.table-toolbar-icon--rotating[data-v-efbd16f8]{animation:table-toolbar-rotating-efbd16f8 1s linear infinite}@keyframes table-toolbar-rotating-efbd16f8{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-760501d0]{display:flex;justify-content:space-between;align-items:center;padding-bottom:8px;gap:20px}.table-toolbar-left[data-v-760501d0],.table-toolbar-right[data-v-760501d0]{display:flex;align-items:center;gap:10px}.table-toolbar-icon--rotating[data-v-760501d0]{animation:table-toolbar-rotating-760501d0 1s linear infinite}@keyframes table-toolbar-rotating-760501d0{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-f0f7753c]{--el-table-header-bg-color: var(--v16a9ca77)}.table-main-pagination[data-v-f0f7753c]{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}
@@ -0,0 +1,23 @@
1
+ const f = "OPERATE", E = 1e4, O = (t) => t.filter((e) => !(!e.prop || e.prop === f || e.type && e.type !== "default")).map((e) => ({
2
+ prop: e.prop,
3
+ label: e.label
4
+ })), b = "\uFEFF", R = ({
5
+ columns: t,
6
+ list: e,
7
+ filename: p = "导出数据"
8
+ }) => {
9
+ const c = t.map((n) => n.label).join(","), s = e.map(
10
+ (n) => t.map((u) => {
11
+ const i = n[u.prop] ?? "";
12
+ return `"${String(i).replace(/"/g, '""')}"`;
13
+ }).join(",")
14
+ ), a = b + [c, ...s].join(`
15
+ `), l = new Blob([a], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(l), r = document.createElement("a");
16
+ r.href = o, r.download = `${p}.csv`, r.click(), URL.revokeObjectURL(o);
17
+ };
18
+ export {
19
+ E as EXPORT_MAX_LIMIT,
20
+ f as OPERATE_COLUMN_PROP,
21
+ R as exportCSV,
22
+ O as pickExportColumns
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/admin-core",
3
- "version": "0.1.1-alpha.1",
3
+ "version": "0.1.1-alpha.3",
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": "702df9158b5cfa3bf2f7c667fb10cbe5168b9a7a"
80
+ "gitHead": "53e17b4c1d1e64d8b48e85207fc7680109e75809"
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,4 +1,4 @@
1
- import { TableMainInstance } from './types';
1
+ import { ExportType, TableExportContext, TableMainInstance, TableToolbarLeftFeature, TableToolbarRightFeature } from './types';
2
2
 
3
3
  declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
4
4
  isAutoRefresh: import('vue').PropType<boolean>;
@@ -6,38 +6,70 @@ 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
+ default: () => TableToolbarLeftFeature[];
12
+ };
13
+ rightFeatures: {
14
+ type: globalThis.PropType<TableToolbarRightFeature[]>;
15
+ default: () => TableToolbarRightFeature[];
12
16
  };
13
17
  refreshInterval: {
14
18
  type: globalThis.PropType<number>;
15
19
  default: number;
16
20
  };
21
+ exportByFe: {
22
+ type: globalThis.PropType<boolean>;
23
+ default: boolean;
24
+ };
25
+ exportFn: {
26
+ type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
27
+ };
17
28
  tableExpose: {
18
29
  type: globalThis.PropType<TableMainInstance>;
19
30
  required: true;
20
31
  };
32
+ exportContext: {
33
+ type: globalThis.PropType<TableExportContext>;
34
+ required: true;
35
+ };
21
36
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
22
37
  isAutoRefresh: import('vue').PropType<boolean>;
23
38
  loading: {
24
39
  type: globalThis.PropType<boolean>;
25
40
  required: true;
26
41
  };
27
- features: {
28
- type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
29
- default: () => string[];
42
+ leftFeatures: {
43
+ type: globalThis.PropType<"export"[]>;
44
+ default: () => TableToolbarLeftFeature[];
45
+ };
46
+ rightFeatures: {
47
+ type: globalThis.PropType<TableToolbarRightFeature[]>;
48
+ default: () => TableToolbarRightFeature[];
30
49
  };
31
50
  refreshInterval: {
32
51
  type: globalThis.PropType<number>;
33
52
  default: number;
34
53
  };
54
+ exportByFe: {
55
+ type: globalThis.PropType<boolean>;
56
+ default: boolean;
57
+ };
58
+ exportFn: {
59
+ type: globalThis.PropType<(type: ExportType) => Promise<unknown>>;
60
+ };
35
61
  tableExpose: {
36
62
  type: globalThis.PropType<TableMainInstance>;
37
63
  required: true;
38
64
  };
65
+ exportContext: {
66
+ type: globalThis.PropType<TableExportContext>;
67
+ required: true;
68
+ };
39
69
  }>> & Readonly<{}>, {
40
- features: import('./types').TableToolbarFeature[];
70
+ leftFeatures: TableToolbarLeftFeature[];
71
+ rightFeatures: TableToolbarRightFeature[];
41
72
  refreshInterval: number;
73
+ exportByFe: boolean;
42
74
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
43
75
  export default _default;
@@ -24,19 +24,53 @@ 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";
33
+ /** TableMain 传给 toolbar 的导出上下文 */
34
+ export interface TableExportContext {
35
+ /** 可导出列 */
36
+ columns: Pick<ElTableColumnProps, "prop" | "label">[];
37
+ /** 选中行数据 */
38
+ selectedList: Record<string, any>[];
39
+ /** 当前页数据 */
40
+ currentPageList: Record<string, any>[];
41
+ /** 分页 API */
42
+ api: TableMainProps<any, any, any>["api"];
43
+ /** 静态查询参数 */
44
+ query: Record<string, any>;
45
+ /** 当前数据总数 */
46
+ total: number;
47
+ /** 是否包含 selection 列 */
48
+ hasSelection: boolean;
49
+ }
29
50
  /** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
30
51
  export interface TableToolbarConfig {
31
52
  /**
32
- * 功能列表。
33
- * - undefined(默认):显示所有功能
34
- * - [](空数组):不渲染 toolbar
35
- * - 枚举子集:仅显示指定功能
53
+ * 左侧功能列表。
54
+ * - undefined(默认):显示所有左侧功能
55
+ * - [](空数组):不渲染左侧功能
56
+ */
57
+ leftFeatures?: TableToolbarLeftFeature[];
58
+ /**
59
+ * 右侧功能列表。
60
+ * - undefined(默认):显示所有右侧功能
61
+ * - [](空数组):不渲染右侧功能
36
62
  */
37
- features?: TableToolbarFeature[];
63
+ rightFeatures?: TableToolbarRightFeature[];
38
64
  /** 自动刷新默认间隔(秒),默认 30 */
39
65
  refreshInterval?: number;
66
+ /**
67
+ * 是否由前端导出,默认 true。
68
+ * - true:toolbar 内部调 fetchListAll + exportCSV 完成导出
69
+ * - false:走 exportFn 回调
70
+ */
71
+ exportByFe?: boolean;
72
+ /** 导出方法。传入导出类型,返回 Promise。exportByFe 为 false 时必传 */
73
+ exportFn?: (type: ExportType) => Promise<unknown>;
40
74
  }
41
75
  /** 表格列默认作用域 */
42
76
  export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
@@ -82,7 +116,7 @@ SQ extends Record<string, any>,
82
116
  F extends Record<string, any>> {
83
117
  /** 展示分页器 */
84
118
  showPager?: boolean;
85
- /** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.features) */
119
+ /** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.leftFeatures / rightFeatures) */
86
120
  showToolbar?: boolean;
87
121
  /** toolbar 配置 */
88
122
  toolbar?: TableToolbarConfig;
@@ -0,0 +1,23 @@
1
+ import { ElTableColumnProps } from '../components/table/types';
2
+
3
+ /** 操作列标记 prop。消费方以此值标记操作列,导出时自动过滤 */
4
+ export declare const OPERATE_COLUMN_PROP = "OPERATE";
5
+ /** 前端导出最大行数 */
6
+ export declare const EXPORT_MAX_LIMIT = 10000;
7
+ /** 导出列:从 ElTableColumnProps 中提取 prop、label、type */
8
+ export type ExportColumn = Pick<ElTableColumnProps, "prop" | "label" | "type">;
9
+ /** 导出参数 */
10
+ export interface ExportOptions {
11
+ columns: ExportColumn[];
12
+ list: Record<string, any>[];
13
+ filename?: string;
14
+ }
15
+ /**
16
+ * 从表格列配置中提取可导出列
17
+ * ---
18
+ * 过滤规则:排除 type 为 selection / index / expand 的列(除 default 外均排除),
19
+ * 排除 prop 为 OPERATE_COLUMN_PROP 的列,排除无 prop 的列
20
+ */
21
+ export declare const pickExportColumns: <T extends Record<string, any>>(columns: ElTableColumnProps<T>[]) => ExportColumn[];
22
+ /** 导出 CSV 文件 */
23
+ export declare const exportCSV: ({ columns, list, filename, }: ExportOptions) => void;
@@ -1,3 +1,4 @@
1
1
  export * from './time';
2
2
  export * from './id';
3
3
  export * from './router';
4
+ export * from './export';