@aplus-frontend/ui 0.4.33 → 0.5.0-beta.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.
Files changed (123) hide show
  1. package/es/index.mjs +121 -117
  2. package/es/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
  3. package/es/src/ap-button/ap-confirm-button.vue.mjs +56 -0
  4. package/es/src/ap-button/ap-confirm-button.vue2.mjs +4 -0
  5. package/es/src/ap-button/index.d.ts +2 -1
  6. package/es/src/ap-button/index.mjs +1 -0
  7. package/es/src/ap-button/interface.d.ts +6 -1
  8. package/es/src/ap-button/utils/index.d.ts +2 -0
  9. package/es/src/ap-button/utils/index.mjs +36 -16
  10. package/es/src/ap-grid/constants.d.ts +9 -0
  11. package/es/src/ap-grid/constants.mjs +12 -0
  12. package/es/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  13. package/es/src/ap-grid/hooks/use-inner-params.mjs +41 -0
  14. package/es/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  15. package/es/src/ap-grid/hooks/use-render-columns.mjs +29 -0
  16. package/es/src/ap-grid/index.d.ts +3 -0
  17. package/es/src/ap-grid/index.mjs +2 -0
  18. package/es/src/ap-grid/index.vue.mjs +399 -0
  19. package/es/src/ap-grid/index.vue2.mjs +4 -0
  20. package/es/src/ap-grid/interface.d.ts +279 -0
  21. package/es/src/ap-grid/interface.mjs +1 -0
  22. package/es/src/ap-grid/style/css.d.ts +0 -0
  23. package/es/src/ap-grid/style/css.js +1 -0
  24. package/es/src/ap-grid/style/index.d.ts +0 -0
  25. package/es/src/ap-grid/style/index.js +1 -0
  26. package/es/src/ap-grid/utils/col.d.ts +20 -0
  27. package/es/src/ap-grid/utils/col.mjs +106 -0
  28. package/es/src/ap-grid/utils/renderer.d.ts +3 -0
  29. package/es/src/ap-grid/utils/renderer.mjs +21 -0
  30. package/es/src/ap-grid/utils/table.d.ts +13 -0
  31. package/es/src/ap-grid/utils/table.mjs +64 -0
  32. package/es/src/ap-modal/utils/createModal.mjs +28 -28
  33. package/es/src/ap-table/ap-table.vue.d.ts +2 -0
  34. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +38 -38
  35. package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +9 -9
  36. package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +21 -21
  37. package/es/src/ap-table/components/setting/utils.d.ts +15 -3
  38. package/es/src/ap-table/components/setting/utils.mjs +49 -38
  39. package/es/src/ap-table/context.d.ts +2 -1
  40. package/es/src/ap-table/context.mjs +8 -7
  41. package/es/src/ap-table/hooks/use-table-column-state.mjs +79 -70
  42. package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  43. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +43 -40
  44. package/es/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  45. package/es/src/ap-table/hooks/use-table-row-selection.mjs +41 -27
  46. package/es/src/ap-table/interface.d.ts +4 -0
  47. package/es/src/ap-table/utils.d.ts +1 -1
  48. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  49. package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  50. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  51. package/es/src/business/ap-table-modal/index.d.ts +8 -0
  52. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  53. package/es/src/business/hooks/usePageListApTable.d.ts +2 -0
  54. package/es/src/index.d.ts +1 -0
  55. package/es/src/index.mjs +242 -237
  56. package/es/src/path-map.mjs +2 -1
  57. package/lib/index.js +1 -1
  58. package/lib/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
  59. package/lib/src/ap-button/ap-confirm-button.vue.js +1 -0
  60. package/lib/src/ap-button/ap-confirm-button.vue2.js +1 -0
  61. package/lib/src/ap-button/index.d.ts +2 -1
  62. package/lib/src/ap-button/index.js +1 -1
  63. package/lib/src/ap-button/interface.d.ts +6 -1
  64. package/lib/src/ap-button/utils/index.d.ts +2 -0
  65. package/lib/src/ap-button/utils/index.js +1 -1
  66. package/lib/src/ap-grid/constants.d.ts +9 -0
  67. package/lib/src/ap-grid/constants.js +1 -0
  68. package/lib/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  69. package/lib/src/ap-grid/hooks/use-inner-params.js +1 -0
  70. package/lib/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  71. package/lib/src/ap-grid/hooks/use-render-columns.js +1 -0
  72. package/lib/src/ap-grid/index.d.ts +3 -0
  73. package/lib/src/ap-grid/index.js +1 -0
  74. package/lib/src/ap-grid/index.vue.js +1 -0
  75. package/lib/src/ap-grid/index.vue2.js +1 -0
  76. package/lib/src/ap-grid/interface.d.ts +279 -0
  77. package/lib/src/ap-grid/interface.js +1 -0
  78. package/lib/src/ap-grid/style/css.cjs +1 -0
  79. package/lib/src/ap-grid/style/css.d.ts +0 -0
  80. package/lib/src/ap-grid/style/index.cjs +1 -0
  81. package/lib/src/ap-grid/style/index.d.ts +0 -0
  82. package/lib/src/ap-grid/utils/col.d.ts +20 -0
  83. package/lib/src/ap-grid/utils/col.js +1 -0
  84. package/lib/src/ap-grid/utils/renderer.d.ts +3 -0
  85. package/lib/src/ap-grid/utils/renderer.js +1 -0
  86. package/lib/src/ap-grid/utils/table.d.ts +13 -0
  87. package/lib/src/ap-grid/utils/table.js +1 -0
  88. package/lib/src/ap-modal/utils/createModal.js +1 -1
  89. package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
  90. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
  91. package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
  92. package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
  93. package/lib/src/ap-table/components/setting/utils.d.ts +15 -3
  94. package/lib/src/ap-table/components/setting/utils.js +1 -1
  95. package/lib/src/ap-table/context.d.ts +2 -1
  96. package/lib/src/ap-table/context.js +1 -1
  97. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  98. package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  99. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  100. package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  101. package/lib/src/ap-table/hooks/use-table-row-selection.js +1 -1
  102. package/lib/src/ap-table/interface.d.ts +4 -0
  103. package/lib/src/ap-table/utils.d.ts +1 -1
  104. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  105. package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  106. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  107. package/lib/src/business/ap-table-modal/index.d.ts +8 -0
  108. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  109. package/lib/src/business/hooks/usePageListApTable.d.ts +2 -0
  110. package/lib/src/index.d.ts +1 -0
  111. package/lib/src/index.js +1 -1
  112. package/lib/src/path-map.js +1 -1
  113. package/package.json +3 -1
  114. package/theme/antd-global-overwrite/admin/index.css +8 -1
  115. package/theme/antd-global-overwrite/admin/modal.css +8 -1
  116. package/theme/antd-global-overwrite/admin/modal.less +10 -1
  117. package/theme/antd-global-overwrite/aplus/index.css +8 -1
  118. package/theme/antd-global-overwrite/aplus/modal.css +8 -1
  119. package/theme/antd-global-overwrite/aplus/modal.less +10 -1
  120. package/theme/ap-grid/index.css +302 -0
  121. package/theme/ap-grid/index.less +65 -0
  122. package/theme/index.css +51 -0
  123. package/theme/index.less +1 -0
@@ -1,5 +1,8 @@
1
1
  import { ColumnsType } from '@aplus-frontend/antdv/es/table';
2
- import { ApColumnState, ApTableSettingDefaultValueType } from '../../interface';
2
+ import { ApColumnState, ApTableContextRenderConfig, ApTableSettingDefaultValueType } from '../../interface';
3
+ import { VNode, RendererNode, RendererElement, VNodeArrayChildren } from 'vue';
4
+ import { ColumnTitleProps } from '@aplus-frontend/antdv/es/table/interface';
5
+ import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
3
6
  /**
4
7
  * 根据列状态重新生成表格列配置
5
8
  * @param columns 表格列数组
@@ -9,12 +12,21 @@ import { ApColumnState, ApTableSettingDefaultValueType } from '../../interface';
9
12
  export default function generateColumnsByColumnState(columns: ColumnsType, columnStateList: ApColumnState[]): ColumnsType;
10
13
  export declare function customCloneColumnStates<T extends ApColumnState | ApColumnState[]>(columnStates: T): T;
11
14
  /**
12
- * 克隆列设置用的label
15
+ * 获取基于title设置的label节点
13
16
  * @param node
14
17
  * @param overrideProps
15
18
  * @returns
16
19
  */
17
- export declare function cloneLabelNode(node: any): any;
20
+ export declare function getLabelNode(column: any, renderConfig?: ApTableContextRenderConfig): number | boolean | void | VNode<RendererNode, RendererElement, {
21
+ [key: string]: any;
22
+ }> | VNodeArrayChildren | ((props: ColumnTitleProps<any>) => VNodeArrayChildren | VueNode) | null;
23
+ /**
24
+ * 获取最终用于渲染的节点
25
+ * @param node
26
+ * @param overrideProps
27
+ * @returns
28
+ */
29
+ export declare function getLabelRenderNode(node: any): any;
18
30
  /**
19
31
  * 生成可用于缓存的列状态对象
20
32
  * @param columnStates
@@ -1,54 +1,65 @@
1
- import { cloneDeepWith as f, isArray as c, omit as u } from "lodash-unified";
2
- import { isVNode as s } from "vue";
3
- function h(e, i) {
4
- var o;
5
- const n = [];
6
- for (const t of i) {
7
- const l = e.find((r) => r.key === t.key);
8
- if ((o = t.children) != null && o.length) {
9
- const r = h(
10
- l.children,
11
- t.children
1
+ import { cloneDeepWith as s, isArray as c, omit as a } from "lodash-unified";
2
+ import { isVNode as u } from "vue";
3
+ import { getTableTitle as f } from "../../utils.mjs";
4
+ function h(t, e) {
5
+ var l;
6
+ const i = [];
7
+ for (const r of e) {
8
+ const o = t.find((n) => n.key === r.key);
9
+ if ((l = r.children) != null && l.length) {
10
+ const n = h(
11
+ o.children,
12
+ r.children
12
13
  );
13
- r.length && n.push({
14
- ...l,
15
- fixed: t.fixed,
16
- children: r
14
+ n.length && i.push({
15
+ ...o,
16
+ fixed: r.fixed,
17
+ children: n
17
18
  });
18
19
  } else {
19
- if (!t.show)
20
+ if (!r.show)
20
21
  continue;
21
- n.push({ ...l, fixed: t.fixed });
22
+ i.push({ ...o, fixed: r.fixed });
22
23
  }
23
24
  }
24
- return n;
25
+ return i;
25
26
  }
26
- function m(e) {
27
- return f(e, (i, n) => {
28
- if (n === "label")
29
- return i;
27
+ function y(t) {
28
+ return s(t, (e, i) => {
29
+ if (i === "label")
30
+ return e;
30
31
  });
31
32
  }
32
- function p(e) {
33
- return s(e) ? e : c(e) ? e[0] : e;
33
+ function b(t, e) {
34
+ const i = t.title, l = c(i) ? i[0] : i;
35
+ return u(l) ? l : f(
36
+ t,
37
+ (e == null ? void 0 : e.className) || "",
38
+ void 0,
39
+ e == null ? void 0 : e.color
40
+ );
34
41
  }
35
- function g(e) {
36
- function i(n) {
37
- const o = {};
38
- return n.forEach((t, l) => {
39
- var r;
40
- o[t.key] = {
41
- ...u(t, ["label", "key", "children"]),
42
- order: l,
43
- children: (r = t.children) != null && r.length ? i(t.children) : void 0
42
+ function x(t) {
43
+ return u(t) ? t : c(t) ? t[0] : t;
44
+ }
45
+ function S(t) {
46
+ function e(i) {
47
+ const l = {};
48
+ return i.forEach((r, o) => {
49
+ var n;
50
+ l[r.key] = {
51
+ ...a(r, ["label", "key", "children"]),
52
+ order: o,
53
+ children: (n = r.children) != null && n.length ? e(r.children) : void 0
44
54
  };
45
- }), o;
55
+ }), l;
46
56
  }
47
- return i(e);
57
+ return e(t);
48
58
  }
49
59
  export {
50
- p as cloneLabelNode,
51
- m as customCloneColumnStates,
60
+ y as customCloneColumnStates,
52
61
  h as default,
53
- g as getColumnStateString
62
+ S as getColumnStateString,
63
+ b as getLabelNode,
64
+ x as getLabelRenderNode
54
65
  };
@@ -1,6 +1,6 @@
1
1
  import { ColumnType } from '@aplus-frontend/antdv/es/table';
2
2
  import { ComputedRef, InjectionKey } from 'vue';
3
- import { ApTableProps } from './interface';
3
+ import { ApTableContextRenderConfig, ApTableProps } from './interface';
4
4
  type TableSize = ApTableProps['size'];
5
5
  type ApTableContextProps<RecordType> = {
6
6
  /**
@@ -25,6 +25,7 @@ type ApTableContextProps<RecordType> = {
25
25
  size?: ComputedRef<TableSize>;
26
26
  updateSize?: (nextSize: TableSize) => void;
27
27
  dataSource?: ComputedRef<RecordType[]>;
28
+ renderConfig?: ComputedRef<ApTableContextRenderConfig>;
28
29
  };
29
30
  export declare const ApTableContextKey: InjectionKey<ApTableContextProps<any>>;
30
31
  export declare function useProvideApTable<ModelType>(state: ApTableContextProps<ModelType>): void;
@@ -1,21 +1,22 @@
1
- import { provide as n, inject as u, computed as e } from "vue";
1
+ import { provide as n, inject as i, computed as e } from "vue";
2
2
  const o = Symbol("apTableContextKey");
3
- function p(t) {
3
+ function u(t) {
4
4
  n(o, t);
5
5
  }
6
- function a() {
7
- return u(o, {
6
+ function p() {
7
+ return i(o, {
8
8
  columns: e(() => []),
9
9
  updateColumns: () => {
10
10
  },
11
11
  size: e(() => "middle"),
12
12
  updateSize: () => {
13
13
  },
14
- dataSource: void 0
14
+ dataSource: void 0,
15
+ renderConfig: void 0
15
16
  });
16
17
  }
17
18
  export {
18
19
  o as ApTableContextKey,
19
- a as useInjectApTable,
20
- p as useProvideApTable
20
+ p as useInjectApTable,
21
+ u as useProvideApTable
21
22
  };
@@ -1,15 +1,19 @@
1
- import { ref as D, shallowRef as G, unref as f, computed as W, watchEffect as X } from "vue";
2
- import { isDef as q } from "../../utils/index.mjs";
3
- import H, { customCloneColumnStates as B, getColumnStateString as L } from "../components/setting/utils.mjs";
4
- import { useInjectApTable as P } from "../context.mjs";
5
- import { isObject as N, mergeWith as F, isBoolean as Q, omit as U, isNumber as b } from "lodash-unified";
1
+ import { ref as P, shallowRef as W, unref as i, computed as X, watchEffect as q } from "vue";
2
+ import { isDef as H } from "../../utils/index.mjs";
3
+ import L, { customCloneColumnStates as T, getColumnStateString as Q } from "../components/setting/utils.mjs";
4
+ import { useInjectApTable as U } from "../context.mjs";
5
+ import { isObject as N, mergeWith as F, isBoolean as V, omit as Y, isString as Z, isNumber as B } from "lodash-unified";
6
+ import "../../config-provider/index.mjs";
7
+ import { useToken as $ } from "@aplus-frontend/antdv/es/theme/internal";
8
+ import { getTableTitle as K } from "../utils.mjs";
9
+ import { useNamespace as ee } from "../../config-provider/hooks/use-namespace.mjs";
6
10
  function u(r, o) {
7
11
  r.forEach((n) => {
8
- var i;
9
- o(n), (i = n.children) != null && i.length && u(n.children, o);
12
+ var a;
13
+ o(n), (a = n.children) != null && a.length && u(n.children, o);
10
14
  });
11
15
  }
12
- function V(r, o) {
16
+ function te(r, o) {
13
17
  if (!o)
14
18
  return {};
15
19
  const n = r.getItem(o);
@@ -20,108 +24,113 @@ function I(r, o) {
20
24
  return F({}, r, o, I);
21
25
  }
22
26
  const E = Number.MAX_SAFE_INTEGER;
23
- function Y(r, o, n, i) {
24
- return i ? i.fixed : o ? o.fixed : n && "fixed" in n ? n.fixed : Q(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
27
+ function re(r, o, n, a) {
28
+ return a ? a.fixed : o ? o.fixed : n && "fixed" in n ? n.fixed : V(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
25
29
  }
26
- const re = (r, o, n) => {
27
- const i = D(n), c = G(
28
- B(n)
29
- ), { columnsBackup: x, updateColumns: a } = P(), T = r.persistenceType || "localStorage", S = window[T];
30
- function O() {
31
- const e = V(
30
+ const he = (r, o, n) => {
31
+ const { be: a } = ee("ap-table"), [oe, O] = $(), l = P(n), c = W(
32
+ T(n)
33
+ ), { columnsBackup: p, updateColumns: h } = U(), _ = r.persistenceType || "localStorage", S = window[_];
34
+ function J() {
35
+ const e = te(
32
36
  S,
33
- f(o)
37
+ i(o)
34
38
  ), t = F(
35
39
  {},
36
40
  r.defaultValue || {},
37
41
  e,
38
42
  I
39
- ), s = f(x);
40
- function l(j, h, z) {
41
- return j.map((d) => {
43
+ ), s = i(p);
44
+ function d(D, m, G) {
45
+ return D.map((f) => {
42
46
  var y, A;
43
- const v = (h == null ? void 0 : h[d.key]) || {}, g = {
44
- key: d.key,
45
- label: d.title,
47
+ const b = (m == null ? void 0 : m[f.key]) || {}, g = {
48
+ key: f.key,
49
+ label: Z(f.title) ? K(
50
+ f,
51
+ a("table-header", "title"),
52
+ void 0,
53
+ O.value.colorPrimary
54
+ ) : f.title,
46
55
  show: !0,
47
- fixed: Y(
48
- d,
49
- e[d.key],
50
- (y = r.defaultValue) == null ? void 0 : y[d.key],
51
- z
56
+ fixed: re(
57
+ f,
58
+ e[f.key],
59
+ (y = r.defaultValue) == null ? void 0 : y[f.key],
60
+ G
52
61
  ),
53
62
  disabled: !1,
54
- ...U(v, ["children", "fixed"])
63
+ ...Y(b, ["children", "fixed"])
55
64
  };
56
- return g.children = (A = d.children) != null && A.length ? l(
57
- d.children,
58
- v.children,
65
+ return g.children = (A = f.children) != null && A.length ? d(
66
+ f.children,
67
+ b.children,
59
68
  g
60
69
  ) : void 0, g;
61
- }).sort(J);
70
+ }).sort(M);
62
71
  }
63
- return l(s || [], t);
72
+ return d(s || [], t);
64
73
  }
65
- function J(e, t) {
66
- const s = b(e.order) ? e.order : E;
67
- let l = b(t.order) ? t.order : E;
68
- return e.fixed === "right" && t.fixed !== "right" && (l = s - 1), t.fixed === "left" && e.fixed !== "left" && (l = s - 1), s - l;
74
+ function M(e, t) {
75
+ const s = B(e.order) ? e.order : E;
76
+ let d = B(t.order) ? t.order : E;
77
+ return e.fixed === "right" && t.fixed !== "right" && (d = s - 1), t.fixed === "left" && e.fixed !== "left" && (d = s - 1), s - d;
69
78
  }
70
- const m = W(() => f(i).every((e) => e.show));
79
+ const x = X(() => i(l).every((e) => e.show));
71
80
  function C() {
72
- const e = f(i);
81
+ const e = i(l);
73
82
  u(e, (t) => {
74
83
  !t.disabled && (t.show = !0);
75
84
  });
76
85
  }
77
- function p() {
78
- const e = f(i);
86
+ function w() {
87
+ const e = i(l);
79
88
  u(e, (t) => {
80
89
  !t.disabled && (t.show = !1);
81
90
  });
82
91
  }
83
- function M() {
84
- f(m) ? p() : C();
92
+ function R() {
93
+ i(x) ? w() : C();
85
94
  }
86
- function R(e, t) {
87
- u(f(i), (s) => {
88
- s.key === e && (s.show = q(t) ? t : !s.show);
95
+ function j(e, t) {
96
+ u(i(l), (s) => {
97
+ s.key === e && (s.show = H(t) ? t : !s.show);
89
98
  });
90
99
  }
91
- function w(e) {
92
- i.value = e;
100
+ function k(e) {
101
+ l.value = e;
93
102
  }
94
- function _(e) {
103
+ function z(e) {
95
104
  c.value = e;
96
105
  }
97
- function k(e) {
98
- if (f(o)) {
99
- const t = L(e);
100
- S.setItem(f(o), JSON.stringify(t));
106
+ function v(e) {
107
+ if (i(o)) {
108
+ const t = Q(e);
109
+ S.setItem(i(o), JSON.stringify(t));
101
110
  }
102
111
  }
103
- return X(() => {
112
+ return q(() => {
104
113
  var t;
105
- const e = O();
106
- w(e), (t = r.onChange) == null || t.call(r, e), a == null || a(
107
- H(
108
- f(x),
109
- f(e)
114
+ const e = J();
115
+ k(e), (t = r.onChange) == null || t.call(r, e), h == null || h(
116
+ L(
117
+ i(p),
118
+ i(e)
110
119
  )
111
- ), c.value = B(e), k(e);
120
+ ), c.value = T(e), v(e);
112
121
  }), {
113
- columnState: i,
122
+ columnState: l,
114
123
  selectAll: C,
115
- unSelectAll: p,
116
- toggleSelect: R,
117
- setColumnState: w,
118
- isAllSelected: m,
119
- toggleSelectAll: M,
124
+ unSelectAll: w,
125
+ toggleSelect: j,
126
+ setColumnState: k,
127
+ isAllSelected: x,
128
+ toggleSelectAll: R,
120
129
  columnStateBackup: c,
121
- setColumnStateBackup: _,
122
- cacheColumnStateIfNeeded: k
130
+ setColumnStateBackup: z,
131
+ cacheColumnStateIfNeeded: v
123
132
  };
124
133
  };
125
134
  export {
126
- re as useTableColumnState
135
+ he as useTableColumnState
127
136
  };
@@ -49,13 +49,19 @@ export type UseTablePagingParams<DataType, ParamsType> = {
49
49
  * 分页相关
50
50
  */
51
51
  pagination?: boolean | ApTablePaginationConfig;
52
+ /**
53
+ * 样式命名空间
54
+ */
55
+ namespace?: 'ap-table' | 'ap-grid';
52
56
  };
53
57
  type InternalDataType<DataType = Recordable> = {
54
58
  total: number;
55
59
  records: DataType[];
56
60
  loading: boolean;
57
61
  };
58
- export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
62
+ export declare const DEFAULT_CURRENT = 1;
63
+ export declare const DEFAULT_PAGE_SIZE = 10;
64
+ export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, namespace, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
59
65
  formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
60
66
  submit: () => void;
61
67
  reset: () => void;
@@ -74,7 +80,7 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
74
80
  showSizeChanger: boolean;
75
81
  showQuickJumper: boolean;
76
82
  showLessItems: boolean | undefined;
77
- size: string;
83
+ size: "default" | "small";
78
84
  showTotal: ((total: number) => import("vue/jsx-runtime").JSX.Element) | undefined;
79
85
  };
80
86
  onChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
@@ -1,16 +1,16 @@
1
- import { ref as ee, reactive as I, unref as h, nextTick as te, onMounted as re, watch as oe, computed as A, createVNode as C } from "vue";
2
- import { useTableSortedAndFiltered as ne } from "./use-sorted-filtered.mjs";
1
+ import { ref as te, reactive as I, unref as h, nextTick as re, onMounted as oe, watch as ne, computed as A, createVNode as C } from "vue";
2
+ import { useTableSortedAndFiltered as ae } from "./use-sorted-filtered.mjs";
3
3
  import "../../config-provider/index.mjs";
4
- import { parseFieldValue as ae, dataIndexToStr as se, isEqualCustom as ce } from "../utils.mjs";
5
- import { isArray as N, isEqualWith as ie } from "lodash-unified";
6
- import { useLocale as le } from "../../config-provider/hooks/use-locale.mjs";
7
- import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
4
+ import { parseFieldValue as se, dataIndexToStr as ce, isEqualCustom as ie } from "../utils.mjs";
5
+ import { isArray as N, isEqualWith as le } from "lodash-unified";
6
+ import { useLocale as ue } from "../../config-provider/hooks/use-locale.mjs";
7
+ import { useNamespace as fe } from "../../config-provider/hooks/use-namespace.mjs";
8
8
  const S = 1, L = 10;
9
- function fe(g) {
9
+ function ge(g) {
10
10
  const l = {};
11
11
  return g && (g === !0 ? (l.current = S, l.pageSize = L) : (l.current = g.defaultCurrent || S, l.pageSize = g.defaultPageSize || L)), l;
12
12
  }
13
- const Te = ({
13
+ const Pe = ({
14
14
  manual: g = !1,
15
15
  request: l,
16
16
  defaultParams: v = {},
@@ -20,6 +20,7 @@ const Te = ({
20
20
  resetFieldsIgnores: V,
21
21
  filterFields: U,
22
22
  sortFields: B,
23
+ namespace: K = "ap-table",
23
24
  pagination: p = {
24
25
  defaultCurrent: S,
25
26
  defaultPageSize: L,
@@ -28,15 +29,15 @@ const Te = ({
28
29
  }
29
30
  }) => {
30
31
  let b = 0, s = {};
31
- const K = p ?? {}, M = (e) => D ? D(e) : e, z = ee(), c = I(fe(p)), {
32
- getColumnSFConfig: $,
33
- setSF: G,
34
- clearAll: J
35
- } = ne(), {
32
+ const M = p ?? {}, $ = (e) => D ? D(e) : e, z = te(), c = I(ge(p)), {
33
+ getColumnSFConfig: G,
34
+ setSF: J,
35
+ clearAll: Q
36
+ } = ae(), {
36
37
  t: T
37
- } = le(), {
38
+ } = ue(), {
38
39
  b: P
39
- } = ue("ap-table"), o = I({
40
+ } = fe(K), o = I({
40
41
  total: y.length,
41
42
  records: y,
42
43
  loading: !1
@@ -45,7 +46,7 @@ const Te = ({
45
46
  return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
46
47
  }, O = async (e) => {
47
48
  var n;
48
- const t = M(e), r = Date.now();
49
+ const t = $(e), r = Date.now();
49
50
  b = r, o.loading = !0;
50
51
  try {
51
52
  const a = await l({
@@ -63,22 +64,22 @@ const Te = ({
63
64
  return Object.entries(e).forEach(([r, n]) => {
64
65
  if (t[r] = n, R && n) {
65
66
  const a = R[r];
66
- a && (t[r] = ae(a, n));
67
+ a && (t[r] = se(a, n));
67
68
  }
68
69
  }), t;
69
- }, Q = async (e) => {
70
+ }, W = async (e) => {
70
71
  var n, a, u, f, d;
71
72
  const t = F(), r = {};
72
73
  Object.entries(t).forEach(([m, x]) => {
73
74
  V && V.indexOf(m) > -1 && (r[m] = x);
74
- }), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), te(() => {
75
+ }), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), re(() => {
75
76
  e == null || e();
76
77
  });
77
78
  }, w = (e) => {
78
79
  s = e;
79
80
  const t = _(e);
80
81
  O(t);
81
- }, W = (e) => {
82
+ }, Z = (e) => {
82
83
  w({
83
84
  ...s,
84
85
  ...e
@@ -92,11 +93,11 @@ const Te = ({
92
93
  current: p ? S : void 0,
93
94
  pageSize: p ? s.pageSize || c.pageSize : void 0
94
95
  });
95
- }, Z = () => {
96
- J(), s.sort = {}, s.filter = {}, Q(E);
96
+ }, H = () => {
97
+ Q(), s.sort = {}, s.filter = {}, W(E);
97
98
  }, j = () => {
98
99
  w(s);
99
- }, H = (e) => {
100
+ }, X = (e) => {
100
101
  if (!p)
101
102
  j();
102
103
  else {
@@ -104,17 +105,17 @@ const Te = ({
104
105
  current: t,
105
106
  pageSize: r
106
107
  } = c, n = o.total - e, a = Math.ceil(n / r), u = t > a ? a : t;
107
- W({
108
+ Z({
108
109
  current: u > 0 ? u : 1
109
110
  });
110
111
  }
111
112
  }, q = (e, t, r) => {
112
113
  var m, x;
113
114
  const n = F();
114
- c.current = e.current, c.pageSize = e.pageSize, G(t, r);
115
+ c.current = e.current, c.pageSize = e.pageSize, J(t, r);
115
116
  const a = N(r) ? [...r] : [r], u = {};
116
117
  for (const i of a)
117
- (m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[se(i.columnKey || i.field)] = i.order);
118
+ (m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[ce(i.columnKey || i.field)] = i.order);
118
119
  const f = {};
119
120
  for (const i of Object.keys(t))
120
121
  (x = h(U)) != null && x.includes(i) && t[i] && (f[i] = t[i]);
@@ -125,9 +126,9 @@ const Te = ({
125
126
  current: e.current,
126
127
  pageSize: e.pageSize
127
128
  };
128
- ie(s, d, ce) || w(d);
129
+ le(s, d, ie) || w(d);
129
130
  };
130
- re(() => {
131
+ oe(() => {
131
132
  const e = F(), {
132
133
  current: t,
133
134
  pageSize: r
@@ -142,12 +143,12 @@ const Te = ({
142
143
  const n = _(s);
143
144
  O(n);
144
145
  }
145
- }), oe(() => h(v), () => {
146
+ }), ne(() => h(v), () => {
146
147
  E();
147
148
  }, {
148
149
  deep: !0
149
150
  });
150
- const X = A(() => {
151
+ const Y = A(() => {
151
152
  if (o.total === 0)
152
153
  return "-";
153
154
  const {
@@ -156,14 +157,14 @@ const Te = ({
156
157
  } = c;
157
158
  return `${e}/${Math.ceil(o.total / t)}`;
158
159
  });
159
- function Y(e) {
160
+ function k(e) {
160
161
  N(e) && (o.records = e, o.total = e.length);
161
162
  }
162
- const k = A(() => {
163
+ const ee = A(() => {
163
164
  const {
164
165
  showLessItems: e,
165
166
  showTotal: t
166
- } = K;
167
+ } = M;
167
168
  return {
168
169
  loading: o.loading,
169
170
  pagination: {
@@ -182,7 +183,7 @@ const Te = ({
182
183
  class: P("pagination--total-right")
183
184
  }, [T("ap.apTable.pagination.totalRightPrefix"), " ", C("span", {
184
185
  class: P("pagination-count-text")
185
- }, [h(X)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
186
+ }, [h(Y)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
186
187
  },
187
188
  onChange: q,
188
189
  dataSource: o.records
@@ -191,19 +192,21 @@ const Te = ({
191
192
  return {
192
193
  formRef: z,
193
194
  submit: E,
194
- reset: Z,
195
+ reset: H,
195
196
  refresh: j,
196
- refreshByDelete: H,
197
+ refreshByDelete: X,
197
198
  data: o,
198
199
  current: c.current,
199
200
  pageSize: c.pageSize,
200
201
  handleTableChange: q,
201
- tableProps: k,
202
+ tableProps: ee,
202
203
  dataSource: A(() => o.records),
203
- setDataSource: Y,
204
- getColumnSFConfig: $
204
+ setDataSource: k,
205
+ getColumnSFConfig: G
205
206
  };
206
207
  };
207
208
  export {
208
- Te as useTablePaging
209
+ S as DEFAULT_CURRENT,
210
+ L as DEFAULT_PAGE_SIZE,
211
+ Pe as useTablePaging
209
212
  };
@@ -44,6 +44,18 @@ export interface RowSelectionReturnType<RecordType = any> {
44
44
  * @returns
45
45
  */
46
46
  toggleSelect: (item: RecordType) => void;
47
+ /**
48
+ * 多项选中
49
+ * @param items
50
+ * @returns
51
+ */
52
+ selectMulti: (items: RecordType[]) => void;
53
+ /**
54
+ * 多项反选
55
+ * @param items
56
+ * @returns
57
+ */
58
+ unSelectMulti: (items: RecordType[]) => void;
47
59
  }
48
60
  type RowSelectionParams<T> = Omit<ApTableRowSelection<T>, 'mode'> & {
49
61
  /**