@aplus-frontend/ui 0.4.34 → 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 (99) hide show
  1. package/es/index.mjs +14 -12
  2. package/es/src/ap-grid/constants.d.ts +9 -0
  3. package/es/src/ap-grid/constants.mjs +12 -0
  4. package/es/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  5. package/es/src/ap-grid/hooks/use-inner-params.mjs +41 -0
  6. package/es/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  7. package/es/src/ap-grid/hooks/use-render-columns.mjs +29 -0
  8. package/es/src/ap-grid/index.d.ts +3 -0
  9. package/es/src/ap-grid/index.mjs +2 -0
  10. package/es/src/ap-grid/index.vue.mjs +399 -0
  11. package/es/src/ap-grid/index.vue2.mjs +4 -0
  12. package/es/src/ap-grid/interface.d.ts +279 -0
  13. package/es/src/ap-grid/interface.mjs +1 -0
  14. package/es/src/ap-grid/style/css.d.ts +0 -0
  15. package/es/src/ap-grid/style/css.js +1 -0
  16. package/es/src/ap-grid/style/index.d.ts +0 -0
  17. package/es/src/ap-grid/style/index.js +1 -0
  18. package/es/src/ap-grid/utils/col.d.ts +20 -0
  19. package/es/src/ap-grid/utils/col.mjs +106 -0
  20. package/es/src/ap-grid/utils/renderer.d.ts +3 -0
  21. package/es/src/ap-grid/utils/renderer.mjs +21 -0
  22. package/es/src/ap-grid/utils/table.d.ts +13 -0
  23. package/es/src/ap-grid/utils/table.mjs +64 -0
  24. package/es/src/ap-table/ap-table.vue.d.ts +2 -0
  25. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +38 -38
  26. package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +9 -9
  27. package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +21 -21
  28. package/es/src/ap-table/components/setting/utils.d.ts +15 -3
  29. package/es/src/ap-table/components/setting/utils.mjs +49 -38
  30. package/es/src/ap-table/context.d.ts +2 -1
  31. package/es/src/ap-table/context.mjs +8 -7
  32. package/es/src/ap-table/hooks/use-table-column-state.mjs +79 -70
  33. package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  34. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +43 -40
  35. package/es/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  36. package/es/src/ap-table/hooks/use-table-row-selection.mjs +41 -27
  37. package/es/src/ap-table/interface.d.ts +4 -0
  38. package/es/src/ap-table/utils.d.ts +1 -1
  39. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  40. package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  41. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  42. package/es/src/business/ap-table-modal/index.d.ts +8 -0
  43. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  44. package/es/src/business/hooks/usePageListApTable.d.ts +2 -0
  45. package/es/src/index.d.ts +1 -0
  46. package/es/src/index.mjs +244 -241
  47. package/es/src/path-map.mjs +2 -1
  48. package/lib/index.js +1 -1
  49. package/lib/src/ap-grid/constants.d.ts +9 -0
  50. package/lib/src/ap-grid/constants.js +1 -0
  51. package/lib/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
  52. package/lib/src/ap-grid/hooks/use-inner-params.js +1 -0
  53. package/lib/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
  54. package/lib/src/ap-grid/hooks/use-render-columns.js +1 -0
  55. package/lib/src/ap-grid/index.d.ts +3 -0
  56. package/lib/src/ap-grid/index.js +1 -0
  57. package/lib/src/ap-grid/index.vue.js +1 -0
  58. package/lib/src/ap-grid/index.vue2.js +1 -0
  59. package/lib/src/ap-grid/interface.d.ts +279 -0
  60. package/lib/src/ap-grid/interface.js +1 -0
  61. package/lib/src/ap-grid/style/css.cjs +1 -0
  62. package/lib/src/ap-grid/style/css.d.ts +0 -0
  63. package/lib/src/ap-grid/style/index.cjs +1 -0
  64. package/lib/src/ap-grid/style/index.d.ts +0 -0
  65. package/lib/src/ap-grid/utils/col.d.ts +20 -0
  66. package/lib/src/ap-grid/utils/col.js +1 -0
  67. package/lib/src/ap-grid/utils/renderer.d.ts +3 -0
  68. package/lib/src/ap-grid/utils/renderer.js +1 -0
  69. package/lib/src/ap-grid/utils/table.d.ts +13 -0
  70. package/lib/src/ap-grid/utils/table.js +1 -0
  71. package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
  72. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
  73. package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
  74. package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
  75. package/lib/src/ap-table/components/setting/utils.d.ts +15 -3
  76. package/lib/src/ap-table/components/setting/utils.js +1 -1
  77. package/lib/src/ap-table/context.d.ts +2 -1
  78. package/lib/src/ap-table/context.js +1 -1
  79. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  80. package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
  81. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  82. package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
  83. package/lib/src/ap-table/hooks/use-table-row-selection.js +1 -1
  84. package/lib/src/ap-table/interface.d.ts +4 -0
  85. package/lib/src/ap-table/utils.d.ts +1 -1
  86. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
  87. package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
  88. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
  89. package/lib/src/business/ap-table-modal/index.d.ts +8 -0
  90. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
  91. package/lib/src/business/hooks/usePageListApTable.d.ts +2 -0
  92. package/lib/src/index.d.ts +1 -0
  93. package/lib/src/index.js +1 -1
  94. package/lib/src/path-map.js +1 -1
  95. package/package.json +3 -1
  96. package/theme/ap-grid/index.css +302 -0
  97. package/theme/ap-grid/index.less +65 -0
  98. package/theme/index.css +51 -0
  99. package/theme/index.less +1 -0
@@ -5,7 +5,7 @@ import "../../../../config-provider/index.mjs";
5
5
  import { useInjectSorterMethods as M } from "../sorter/context.mjs";
6
6
  import S from "../images/icon_carst_down.svg.mjs";
7
7
  import U from "../images/icon_fill_right.svg.mjs";
8
- import { cloneLabelNode as j } from "../utils.mjs";
8
+ import { getLabelRenderNode as j } from "../utils.mjs";
9
9
  import { useNamespace as H } from "../../../../config-provider/hooks/use-namespace.mjs";
10
10
  import { useLocale as q } from "../../../../config-provider/hooks/use-locale.mjs";
11
11
  const G = ["src"], le = /* @__PURE__ */ E({
@@ -28,18 +28,18 @@ const G = ["src"], le = /* @__PURE__ */ E({
28
28
  const l = v("left");
29
29
  w(l);
30
30
  }
31
- function F() {
31
+ function R() {
32
32
  const l = v("right");
33
33
  V(l);
34
34
  }
35
- function L() {
35
+ function F() {
36
36
  const l = v(void 0);
37
37
  y(l);
38
38
  }
39
- function N() {
39
+ function L() {
40
40
  C("update:open", !o.open);
41
41
  }
42
- function R() {
42
+ function N() {
43
43
  var n;
44
44
  const l = o.value;
45
45
  l.show = !1, (n = l.children) == null || n.forEach((i) => i.show = !1);
@@ -58,7 +58,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
58
58
  }, null, 8, ["class"]),
59
59
  p("span", {
60
60
  class: t(e(h)("left", "indicator")),
61
- onClick: N
61
+ onClick: L
62
62
  }, [
63
63
  (i = l.value.children) != null && i.length ? (s(), g("img", {
64
64
  key: 0,
@@ -96,7 +96,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
96
96
  default: d(() => [
97
97
  c(e(z), {
98
98
  class: t(e(a)("action-icon")),
99
- onClick: L
99
+ onClick: F
100
100
  }, null, 8, ["class"])
101
101
  ]),
102
102
  _: 1
@@ -109,7 +109,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
109
109
  c(e(k), {
110
110
  rotate: 90,
111
111
  class: t(e(a)("action-icon")),
112
- onClick: F
112
+ onClick: R
113
113
  }, null, 8, ["class"])
114
114
  ]),
115
115
  _: 1
@@ -121,7 +121,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
121
121
  default: d(() => [
122
122
  c(e(A), {
123
123
  class: t(e(a)("action-icon")),
124
- onClick: R
124
+ onClick: N
125
125
  }, null, 8, ["class"])
126
126
  ]),
127
127
  _: 1
@@ -1,64 +1,64 @@
1
- import { defineComponent as b, computed as x, unref as l, createElementBlock as i, openBlock as c, createVNode as s, withCtx as d, Fragment as m, renderList as w, createBlock as u, mergeProps as B, resolveDynamicComponent as I } from "vue";
2
- import { Row as L, Col as k, Checkbox as N } from "@aplus-frontend/antdv";
1
+ import { defineComponent as x, computed as w, unref as o, createElementBlock as i, openBlock as c, createVNode as s, withCtx as d, Fragment as m, renderList as B, createBlock as u, mergeProps as I, resolveDynamicComponent as L } from "vue";
2
+ import { Row as N, Col as k, Checkbox as P } from "@aplus-frontend/antdv";
3
3
  import "../select-group/index.vue.mjs";
4
- import { useInjectApTable as P } from "../../../context.mjs";
5
- import { cloneLabelNode as U } from "../utils.mjs";
6
- import j from "../select-group/index.vue2.mjs";
7
- const $ = /* @__PURE__ */ b({
4
+ import { useInjectApTable as U } from "../../../context.mjs";
5
+ import { getLabelNode as j } from "../utils.mjs";
6
+ import A from "../select-group/index.vue2.mjs";
7
+ const q = /* @__PURE__ */ x({
8
8
  __name: "index",
9
9
  props: {
10
10
  value: {}
11
11
  },
12
12
  setup(_) {
13
- const a = _, { columnsBackup: g } = P(), y = x(() => [...l(g) || []].sort((e, n) => {
14
- var t, o, p, h;
15
- return (t = e.children) != null && t.length && !((o = n.children) != null && o.length) ? 1 : !((p = e.children) != null && p.length) && ((h = n.children) != null && h.length) ? -1 : 0;
13
+ const a = _, { columnsBackup: g, renderConfig: y } = U(), C = w(() => [...o(g) || []].sort((e, n) => {
14
+ var t, l, p, h;
15
+ return (t = e.children) != null && t.length && !((l = n.children) != null && l.length) ? 1 : !((p = e.children) != null && p.length) && ((h = n.children) != null && h.length) ? -1 : 0;
16
16
  }));
17
17
  function f(r) {
18
18
  return a.value.find((e) => e.key === r.key);
19
19
  }
20
- function C(r) {
20
+ function v(r) {
21
21
  const e = f(r);
22
22
  return {
23
23
  checked: e == null ? void 0 : e.show,
24
24
  disabled: e == null ? void 0 : e.disabled
25
25
  };
26
26
  }
27
- function v(r, e) {
28
- const n = a.value, t = n == null ? void 0 : n.find((o) => o.key === r);
27
+ function b(r, e) {
28
+ const n = a.value, t = n == null ? void 0 : n.find((l) => l.key === r);
29
29
  t && (t.show = e);
30
30
  }
31
31
  return (r, e) => (c(), i("div", null, [
32
- s(l(L), {
32
+ s(o(N), {
33
33
  gutter: [24, 16],
34
34
  align: "middle"
35
35
  }, {
36
36
  default: d(() => [
37
- (c(!0), i(m, null, w(y.value, (n) => {
37
+ (c(!0), i(m, null, B(C.value, (n) => {
38
38
  var t;
39
39
  return c(), i(m, {
40
40
  key: n.key
41
41
  }, [
42
- (t = n.children) != null && t.length ? (c(), u(l(k), {
42
+ (t = n.children) != null && t.length ? (c(), u(o(k), {
43
43
  key: 1,
44
44
  span: 24
45
45
  }, {
46
46
  default: d(() => [
47
- s(j, {
47
+ s(A, {
48
48
  value: f(n)
49
49
  }, null, 8, ["value"])
50
50
  ]),
51
51
  _: 2
52
- }, 1024)) : (c(), u(l(k), {
52
+ }, 1024)) : (c(), u(o(k), {
53
53
  key: 0,
54
54
  span: 8
55
55
  }, {
56
56
  default: d(() => [
57
- s(l(N), B({ ref_for: !0 }, C(n), {
58
- "onUpdate:checked": (o) => v(n.key, o)
57
+ s(o(P), I({ ref_for: !0 }, v(n), {
58
+ "onUpdate:checked": (l) => b(n.key, l)
59
59
  }), {
60
60
  default: d(() => [
61
- (c(), u(I(l(U)(n.title))))
61
+ (c(), u(L(o(j)(n, o(y)))))
62
62
  ]),
63
63
  _: 2
64
64
  }, 1040, ["onUpdate:checked"])
@@ -74,5 +74,5 @@ const $ = /* @__PURE__ */ b({
74
74
  }
75
75
  });
76
76
  export {
77
- $ as default
77
+ q as default
78
78
  };
@@ -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;