@aplus-frontend/ui 0.1.26 → 0.1.28

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 (137) hide show
  1. package/es/src/ap-download/ap-download.vue.d.ts +12 -4
  2. package/es/src/ap-download/ap-download.vue.mjs +72 -37
  3. package/es/src/ap-download/interface.d.ts +5 -12
  4. package/es/src/ap-download/style/ap-download.css +6 -0
  5. package/es/src/ap-field/select/index.vue.mjs +65 -63
  6. package/es/src/ap-table/ap-table.vue.mjs +231 -183
  7. package/es/src/ap-table/components/interface.d.ts +33 -1
  8. package/es/src/ap-table/components/setting/images/icon_carst_down.svg.mjs +4 -0
  9. package/es/src/ap-table/components/setting/images/icon_fill_right.svg.mjs +4 -0
  10. package/es/src/ap-table/components/setting/modal/index.vue.d.ts +28 -0
  11. package/es/src/ap-table/components/setting/modal/index.vue.mjs +4 -0
  12. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +152 -0
  13. package/es/src/ap-table/components/setting/select-group/index.vue.d.ts +13 -0
  14. package/es/src/ap-table/components/setting/select-group/index.vue.mjs +4 -0
  15. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +96 -0
  16. package/es/src/ap-table/components/setting/sortable/index.vue.d.ts +13 -0
  17. package/es/src/ap-table/components/setting/sortable/index.vue.mjs +4 -0
  18. package/es/src/ap-table/components/setting/sortable/index.vue2.mjs +51 -0
  19. package/es/src/ap-table/components/setting/sortable/item.vue.d.ts +20 -0
  20. package/es/src/ap-table/components/setting/sortable/item.vue.mjs +4 -0
  21. package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +140 -0
  22. package/es/src/ap-table/components/setting/sorter/context.d.ts +11 -0
  23. package/es/src/ap-table/components/setting/sorter/context.mjs +20 -0
  24. package/es/src/ap-table/components/setting/sorter/index.vue.d.ts +18 -0
  25. package/es/src/ap-table/components/setting/sorter/index.vue.mjs +4 -0
  26. package/es/src/ap-table/components/setting/sorter/index.vue2.mjs +199 -0
  27. package/es/src/ap-table/components/setting/tree-select/index.vue.d.ts +13 -0
  28. package/es/src/ap-table/components/setting/tree-select/index.vue.mjs +4 -0
  29. package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +75 -0
  30. package/es/src/ap-table/components/setting/utils.d.ts +17 -0
  31. package/es/src/ap-table/components/setting/utils.mjs +48 -0
  32. package/es/src/ap-table/components/style/setting/modal.css +39 -0
  33. package/es/src/ap-table/components/style/setting/select-group.css +7 -0
  34. package/es/src/ap-table/components/style/setting/sortable-item-meta.css +50 -0
  35. package/es/src/ap-table/components/style/setting/sortable-item.css +3 -0
  36. package/es/src/ap-table/components/style/setting/sorter.css +26 -0
  37. package/es/src/ap-table/constants.d.ts +31 -8
  38. package/es/src/ap-table/constants.mjs +41 -53
  39. package/es/src/ap-table/context.d.ts +31 -0
  40. package/es/src/ap-table/context.mjs +20 -0
  41. package/es/src/ap-table/hooks/use-table-column-state.d.ts +18 -0
  42. package/es/src/ap-table/hooks/use-table-column-state.mjs +46 -0
  43. package/es/src/ap-table/hooks/use-table-content-height.mjs +19 -19
  44. package/es/src/ap-table/hooks/use-table-paging.d.ts +1 -0
  45. package/es/src/ap-table/hooks/use-table-paging.mjs +87 -82
  46. package/es/src/ap-table/interface.d.ts +51 -1
  47. package/es/src/ap-table/style/ap-table.css +29 -1
  48. package/es/src/ap-table/utils.d.ts +1 -1
  49. package/es/src/ap-table/utils.mjs +82 -82
  50. package/es/src/business/ap-attachment/ApAttachment.d.ts +1 -1
  51. package/es/src/business/ap-attachment/ApAttachment.mjs +89 -66
  52. package/es/src/business/ap-attachment/interface.d.ts +1 -1
  53. package/es/src/business/ap-attachment/style.css +6 -0
  54. package/es/src/business/ap-input-radio/interface.d.ts +1 -1
  55. package/es/src/business/hooks/usePageListApTable.d.ts +2 -2
  56. package/es/src/business/index.d.ts +1 -3
  57. package/es/src/editable-table/interface.d.ts +1 -1
  58. package/es/src/locale/lang/en.mjs +14 -0
  59. package/es/src/locale/lang/zh-cn.mjs +14 -0
  60. package/es/src/theme/ap-attachment/ap-attachment.css +6 -0
  61. package/es/src/theme/ap-download/ap-download.css +6 -0
  62. package/es/src/theme/ap-table/ap-table.css +29 -1
  63. package/es/src/theme/ap-table/setting/modal.css +39 -0
  64. package/es/src/theme/ap-table/setting/select-group.css +7 -0
  65. package/es/src/theme/ap-table/setting/sortable-item-meta.css +50 -0
  66. package/es/src/theme/ap-table/setting/sortable-item.css +3 -0
  67. package/es/src/theme/ap-table/setting/sorter.css +26 -0
  68. package/es/src/theme/css-var/index.mjs +22 -12
  69. package/lib/src/ap-download/ap-download.vue.d.ts +12 -4
  70. package/lib/src/ap-download/ap-download.vue.js +1 -1
  71. package/lib/src/ap-download/interface.d.ts +5 -12
  72. package/lib/src/ap-download/style/ap-download.css +6 -0
  73. package/lib/src/ap-field/select/index.vue.js +1 -1
  74. package/lib/src/ap-table/ap-table.vue.js +1 -1
  75. package/lib/src/ap-table/components/interface.d.ts +33 -1
  76. package/lib/src/ap-table/components/setting/images/icon_carst_down.svg.js +1 -0
  77. package/lib/src/ap-table/components/setting/images/icon_fill_right.svg.js +1 -0
  78. package/lib/src/ap-table/components/setting/modal/index.vue.d.ts +28 -0
  79. package/lib/src/ap-table/components/setting/modal/index.vue.js +1 -0
  80. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -0
  81. package/lib/src/ap-table/components/setting/select-group/index.vue.d.ts +13 -0
  82. package/lib/src/ap-table/components/setting/select-group/index.vue.js +1 -0
  83. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -0
  84. package/lib/src/ap-table/components/setting/sortable/index.vue.d.ts +13 -0
  85. package/lib/src/ap-table/components/setting/sortable/index.vue.js +1 -0
  86. package/lib/src/ap-table/components/setting/sortable/index.vue2.js +1 -0
  87. package/lib/src/ap-table/components/setting/sortable/item.vue.d.ts +20 -0
  88. package/lib/src/ap-table/components/setting/sortable/item.vue.js +1 -0
  89. package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -0
  90. package/lib/src/ap-table/components/setting/sorter/context.d.ts +11 -0
  91. package/lib/src/ap-table/components/setting/sorter/context.js +1 -0
  92. package/lib/src/ap-table/components/setting/sorter/index.vue.d.ts +18 -0
  93. package/lib/src/ap-table/components/setting/sorter/index.vue.js +1 -0
  94. package/lib/src/ap-table/components/setting/sorter/index.vue2.js +1 -0
  95. package/lib/src/ap-table/components/setting/tree-select/index.vue.d.ts +13 -0
  96. package/lib/src/ap-table/components/setting/tree-select/index.vue.js +1 -0
  97. package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -0
  98. package/lib/src/ap-table/components/setting/utils.d.ts +17 -0
  99. package/lib/src/ap-table/components/setting/utils.js +1 -0
  100. package/lib/src/ap-table/components/style/setting/modal.css +39 -0
  101. package/lib/src/ap-table/components/style/setting/select-group.css +7 -0
  102. package/lib/src/ap-table/components/style/setting/sortable-item-meta.css +50 -0
  103. package/lib/src/ap-table/components/style/setting/sortable-item.css +3 -0
  104. package/lib/src/ap-table/components/style/setting/sorter.css +26 -0
  105. package/lib/src/ap-table/constants.d.ts +31 -8
  106. package/lib/src/ap-table/constants.js +1 -1
  107. package/lib/src/ap-table/context.d.ts +31 -0
  108. package/lib/src/ap-table/context.js +1 -0
  109. package/lib/src/ap-table/hooks/use-table-column-state.d.ts +18 -0
  110. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -0
  111. package/lib/src/ap-table/hooks/use-table-content-height.js +1 -1
  112. package/lib/src/ap-table/hooks/use-table-paging.d.ts +1 -0
  113. package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
  114. package/lib/src/ap-table/interface.d.ts +51 -1
  115. package/lib/src/ap-table/style/ap-table.css +29 -1
  116. package/lib/src/ap-table/utils.d.ts +1 -1
  117. package/lib/src/ap-table/utils.js +1 -1
  118. package/lib/src/business/ap-attachment/ApAttachment.d.ts +1 -1
  119. package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
  120. package/lib/src/business/ap-attachment/interface.d.ts +1 -1
  121. package/lib/src/business/ap-attachment/style.css +6 -0
  122. package/lib/src/business/ap-input-radio/interface.d.ts +1 -1
  123. package/lib/src/business/hooks/usePageListApTable.d.ts +2 -2
  124. package/lib/src/business/index.d.ts +1 -3
  125. package/lib/src/editable-table/interface.d.ts +1 -1
  126. package/lib/src/locale/lang/en.js +1 -1
  127. package/lib/src/locale/lang/zh-cn.js +1 -1
  128. package/lib/src/theme/ap-attachment/ap-attachment.css +6 -0
  129. package/lib/src/theme/ap-download/ap-download.css +6 -0
  130. package/lib/src/theme/ap-table/ap-table.css +29 -1
  131. package/lib/src/theme/ap-table/setting/modal.css +39 -0
  132. package/lib/src/theme/ap-table/setting/select-group.css +7 -0
  133. package/lib/src/theme/ap-table/setting/sortable-item-meta.css +50 -0
  134. package/lib/src/theme/ap-table/setting/sortable-item.css +3 -0
  135. package/lib/src/theme/ap-table/setting/sorter.css +26 -0
  136. package/lib/src/theme/css-var/index.js +1 -1
  137. package/package.json +3 -2
@@ -3,71 +3,59 @@ import "../ap-field/index.mjs";
3
3
  import "../ap-form/index.mjs";
4
4
  import "./components/index/index.vue.mjs";
5
5
  import "./components/status/index.vue.mjs";
6
- import i from "../ap-form/items/date/index.vue.mjs";
7
- import o from "../ap-form/items/date-range/index.vue.mjs";
8
- import r from "../ap-form/items/number/index.vue.mjs";
6
+ import o from "../ap-form/items/date/index.vue.mjs";
7
+ import r from "../ap-form/items/date-range/index.vue.mjs";
8
+ import i from "../ap-form/items/number/index.vue.mjs";
9
9
  import t from "../ap-form/items/radio/index.vue.mjs";
10
- import e from "../ap-form/items/select/index.vue.mjs";
11
- import a from "../ap-form/items/switch/index.vue.mjs";
10
+ import a from "../ap-form/items/select/index.vue.mjs";
11
+ import f from "../ap-form/items/switch/index.vue.mjs";
12
12
  import { ApFormItemText as m } from "../ap-form/items/text/index.mjs";
13
- import f from "../ap-form/items/text-area/index.vue.mjs";
14
- import s from "../ap-form/items/checkbox/index.vue.mjs";
15
- import n from "../ap-field/date/index.vue.mjs";
13
+ import _ from "../ap-form/items/text-area/index.vue.mjs";
14
+ import e from "../ap-form/items/checkbox/index.vue.mjs";
15
+ import s from "../ap-field/date/index.vue.mjs";
16
16
  import p from "../ap-field/date-range/index.vue.mjs";
17
- import _ from "../ap-field/number/index.vue.mjs";
18
- import c from "../ap-field/radio/index.vue.mjs";
19
- import l from "../ap-field/select/index.vue.mjs";
17
+ import c from "../ap-field/number/index.vue.mjs";
18
+ import n from "../ap-field/radio/index.vue.mjs";
19
+ import $ from "../ap-field/select/index.vue.mjs";
20
20
  import d from "../ap-field/switch/index.vue.mjs";
21
- import { ApFieldText as $ } from "../ap-field/text/index.mjs";
22
- import x from "../ap-field/text-area/index.vue.mjs";
23
- import b from "../ap-field/checkbox/index.vue.mjs";
24
- import w from "../ap-action/group/index.vue.mjs";
25
- import h from "./components/index/index.vue2.mjs";
26
- import k from "./components/status/index.vue2.mjs";
27
- import A from "../ap-field/text/password.vue.mjs";
28
- const Q = {
29
- date: i,
30
- dateRange: o,
31
- number: r,
21
+ import { ApFieldText as x } from "../ap-field/text/index.mjs";
22
+ import b from "../ap-field/text-area/index.vue.mjs";
23
+ import l from "../ap-field/checkbox/index.vue.mjs";
24
+ import h from "../ap-action/group/index.vue.mjs";
25
+ import w from "./components/index/index.vue2.mjs";
26
+ import A from "./components/status/index.vue2.mjs";
27
+ import u from "../ap-field/text/password.vue.mjs";
28
+ const U = {
29
+ date: o,
30
+ dateRange: r,
31
+ number: i,
32
32
  radio: t,
33
- select: e,
34
- switch: a,
33
+ select: a,
34
+ switch: f,
35
35
  text: m,
36
- textArea: f,
37
- checkbox: s,
36
+ textArea: _,
37
+ checkbox: e,
38
38
  password: m.Password
39
- }, U = {
40
- date: n,
39
+ }, W = {
40
+ date: s,
41
41
  dateRange: p,
42
- number: _,
43
- radio: c,
44
- select: l,
42
+ number: c,
43
+ radio: n,
44
+ select: $,
45
45
  switch: d,
46
- text: $,
47
- textArea: x,
48
- checkbox: b,
49
- action: w,
50
- index: h,
51
- status: k,
52
- password: A
46
+ text: x,
47
+ textArea: b,
48
+ checkbox: l,
49
+ action: h,
50
+ index: w,
51
+ status: A,
52
+ password: u
53
53
  }, X = [
54
54
  "action",
55
55
  "index"
56
- ], Y = {
57
- display: "-webkit-inline-box",
58
- "-webkit-line-clamp": 2,
59
- "-webkit-box-orient": "vertical",
60
- overflow: "hidden",
61
- textOverflow: "ellipsis",
62
- whiteSpace: "normal",
63
- maxWidth: "100%",
64
- verticalAlign: "middle",
65
- wordBreak: "break-all",
66
- flex: 1
67
- };
56
+ ];
68
57
  export {
69
- Q as apTableFormItemMap,
70
- U as apTableRenderItemMap,
71
- Y as ellipsisTitleStyle,
58
+ U as apTableFormItemMap,
59
+ W as apTableRenderItemMap,
72
60
  X as noRenderAsFormItemValueList
73
61
  };
@@ -0,0 +1,31 @@
1
+ import { ColumnType } from 'ant-design-vue/es/table';
2
+ import { ComputedRef, InjectionKey } from 'vue';
3
+ import { ApTableProps } from './interface';
4
+ type TableSize = ApTableProps['size'];
5
+ type ApTableContextProps<RecordType> = {
6
+ /**
7
+ * 表格列配置
8
+ */
9
+ columns?: ComputedRef<ColumnType<RecordType>[]>;
10
+ /**
11
+ * 表格列配置备份(只有在props变更后才会变更)
12
+ */
13
+ columnsBackup?: ComputedRef<ColumnType<RecordType>[]>;
14
+ /**
15
+ * 更新数据源的方法
16
+ * @param name
17
+ * @param value
18
+ * @param triggerChange 是否触发外部的`onValuesChange`函数
19
+ * @returns
20
+ */
21
+ updateColumns?: (nextColumns: ColumnType<RecordType>[]) => void;
22
+ /**
23
+ * ApForm内部实例
24
+ */
25
+ size?: ComputedRef<TableSize>;
26
+ updateSize?: (nextSize: TableSize) => void;
27
+ };
28
+ export declare const ApTableContextKey: InjectionKey<ApTableContextProps<any>>;
29
+ export declare function useProvideApTable<ModelType>(state: ApTableContextProps<ModelType>): void;
30
+ export declare function useInjectApTable(): ApTableContextProps<any>;
31
+ export {};
@@ -0,0 +1,20 @@
1
+ import { provide as n, inject as p, computed as e } from "vue";
2
+ const t = Symbol("apTableContextKey");
3
+ function i(o) {
4
+ n(t, o);
5
+ }
6
+ function l() {
7
+ return p(t, {
8
+ columns: e(() => []),
9
+ updateColumns: () => {
10
+ },
11
+ size: e(() => "middle"),
12
+ updateSize: () => {
13
+ }
14
+ });
15
+ }
16
+ export {
17
+ t as ApTableContextKey,
18
+ l as useInjectApTable,
19
+ i as useProvideApTable
20
+ };
@@ -0,0 +1,18 @@
1
+ import { ApColumnState } from '../interface';
2
+ import { Ref, ComputedRef } from 'vue';
3
+ export declare const useTableColumnState: (initialColumnState: ApColumnState[]) => {
4
+ columnState: Ref<{
5
+ key: string | number;
6
+ show?: boolean | undefined;
7
+ fixed?: ("left" | "right") | undefined;
8
+ disabled?: boolean | undefined;
9
+ label?: any;
10
+ children?: any[] | undefined;
11
+ }[]>;
12
+ selectAll: () => void;
13
+ unSelectAll: () => void;
14
+ toggleSelect: (key: string, show?: boolean) => void;
15
+ setColumnState: (nextColumnState: ApColumnState[]) => void;
16
+ isAllSelected: ComputedRef<boolean>;
17
+ toggleSelectAll: () => void;
18
+ };
@@ -0,0 +1,46 @@
1
+ import { ref as d, computed as h, unref as r } from "vue";
2
+ import { isDef as w } from "../../utils/index.mjs";
3
+ function s(c, e) {
4
+ c.forEach((n) => {
5
+ var o;
6
+ e(n), (o = n.children) != null && o.length && s(n.children, e);
7
+ });
8
+ }
9
+ const p = (c) => {
10
+ const e = d(c), n = h(() => r(e).every((t) => t.show));
11
+ function o() {
12
+ const t = r(e);
13
+ s(t, (l) => {
14
+ !l.disabled && (l.show = !0);
15
+ });
16
+ }
17
+ function u() {
18
+ const t = r(e);
19
+ s(t, (l) => {
20
+ !l.disabled && (l.show = !1);
21
+ });
22
+ }
23
+ function i() {
24
+ r(n) ? u() : o();
25
+ }
26
+ function a(t, l) {
27
+ s(r(e), (f) => {
28
+ f.key === t && (f.show = w(l) ? l : !f.show);
29
+ });
30
+ }
31
+ function S(t) {
32
+ e.value = t;
33
+ }
34
+ return {
35
+ columnState: e,
36
+ selectAll: o,
37
+ unSelectAll: u,
38
+ toggleSelect: a,
39
+ setColumnState: S,
40
+ isAllSelected: n,
41
+ toggleSelectAll: i
42
+ };
43
+ };
44
+ export {
45
+ p as useTableColumnState
46
+ };
@@ -1,39 +1,39 @@
1
- import { useElementSize as d } from "@vueuse/core";
2
- import { ref as g, computed as H, unref as l, onUpdated as S } from "vue";
3
- function f(t) {
1
+ import { useElementSize as b } from "@vueuse/core";
2
+ import { ref as s, computed as y, unref as f, onUpdated as v } from "vue";
3
+ function p(t) {
4
4
  if (!t)
5
5
  return 0;
6
6
  const e = parseFloat(t);
7
7
  return Number.isNaN(e) ? 0 : e;
8
8
  }
9
- function h(t) {
9
+ function m(t) {
10
10
  if (!t)
11
11
  return 0;
12
12
  const e = getComputedStyle(t);
13
- return t.clientHeight + f(e.marginTop) + f(e.marginBottom);
13
+ return t.clientHeight + p(e.marginTop) + p(e.marginBottom);
14
14
  }
15
- const v = (t) => {
16
- const e = g(), { height: s } = d(e), a = g();
15
+ const T = (t) => {
16
+ const e = s(), { height: d } = b(e), a = s();
17
17
  let i = !1;
18
- const m = H(() => {
19
- var o, u, c;
20
- const r = ((u = (o = e.value) == null ? void 0 : o.querySelector(".ant-table-header")) == null ? void 0 : u.clientHeight) || 47, n = (c = e.value) == null ? void 0 : c.querySelector(".ant-pagination"), p = n ? h(n) : l(a);
21
- return n && (i = !0), Math.ceil(
22
- l(s) - r - (p || 0) - ((t == null ? void 0 : t.offset) || 0)
18
+ const H = y(() => {
19
+ var u, c, l, g, h;
20
+ const n = ((c = (u = e.value) == null ? void 0 : u.querySelector(".aplus-ap-table-header-wrapper")) == null ? void 0 : c.clientHeight) || 0, r = ((g = (l = e.value) == null ? void 0 : l.querySelector(".ant-table-header")) == null ? void 0 : g.clientHeight) || 47, o = (h = e.value) == null ? void 0 : h.querySelector(".ant-pagination"), S = o ? m(o) : f(a);
21
+ return o && (i = !0), Math.ceil(
22
+ f(d) - r - n - (S || 0) - ((t == null ? void 0 : t.offset) || 0)
23
23
  );
24
24
  });
25
- return S(() => {
26
- var n;
25
+ return v(() => {
26
+ var r;
27
27
  if (i)
28
28
  return;
29
- const r = (n = e.value) == null ? void 0 : n.querySelector(".ant-pagination");
30
- if (!r) {
29
+ const n = (r = e.value) == null ? void 0 : r.querySelector(".ant-pagination");
30
+ if (!n) {
31
31
  a.value = 0;
32
32
  return;
33
33
  }
34
- a.value = h(r), i = !0;
35
- }), { contentRef: e, height: m };
34
+ a.value = m(n), i = !0;
35
+ }), { contentRef: e, height: H };
36
36
  };
37
37
  export {
38
- v as default
38
+ T as default
39
39
  };
@@ -91,4 +91,5 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
91
91
  dataSource: DataType[];
92
92
  }>;
93
93
  dataSource: ComputedRef<DataType[]>;
94
+ setDataSource: (dataSource: DataType[]) => void;
94
95
  };
@@ -1,10 +1,10 @@
1
- import { ref as x, nextTick as Z, unref as o, onMounted as _, computed as V, createVNode as P } from "vue";
2
- import { parseFieldValue as I, dataIndexToStr as k } from "../utils.mjs";
3
- import { isArray as ee } from "lodash-unified";
1
+ import { ref as P, nextTick as _, unref as n, onMounted as I, computed as V, createVNode as b } from "vue";
2
+ import { parseFieldValue as k, dataIndexToStr as ee } from "../utils.mjs";
3
+ import { isArray as te } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
- import { useLocale as te } from "../../config-provider/hooks/use-locale.mjs";
6
- import { useNamespace as ae } from "../../config-provider/hooks/use-namespace.mjs";
7
- const le = ({
5
+ import { useLocale as ae } from "../../config-provider/hooks/use-locale.mjs";
6
+ import { useNamespace as ne } from "../../config-provider/hooks/use-namespace.mjs";
7
+ const ue = ({
8
8
  manual: B = !1,
9
9
  defaultCurrent: E = 1,
10
10
  defaultPageSize: w = 10,
@@ -13,145 +13,150 @@ const le = ({
13
13
  defaultData: $ = [],
14
14
  formatParams: C,
15
15
  paramsValueTypeMap: y,
16
- resetFieldsIgnores: O,
16
+ resetFieldsIgnores: D,
17
17
  filterFields: q,
18
18
  sortFields: J,
19
- showLessItems: b = !1,
19
+ showLessItems: z = !1,
20
20
  showTotal: L = !0
21
21
  }) => {
22
- let z = 0, p = {};
23
- const Q = (e) => C ? C(e) : e, l = x(), c = x(E), f = x(w), {
24
- t: S
25
- } = te(), {
26
- b: F
27
- } = ae("ap-table"), r = x({
22
+ let S = 0, f = {};
23
+ const Q = (e) => C ? C(e) : e, c = P(), l = P(E), p = P(w), {
24
+ t: F
25
+ } = ae(), {
26
+ b: T
27
+ } = ne("ap-table"), o = P({
28
28
  total: 0,
29
29
  records: $,
30
30
  loading: !1
31
- }), R = async (e) => {
32
- var n;
31
+ }), O = async (e) => {
32
+ var r;
33
33
  const a = Q(e), t = Date.now();
34
- z = t, r.value.loading = !0;
34
+ S = t, o.value.loading = !0;
35
35
  try {
36
36
  const s = await M({
37
37
  ...N,
38
38
  ...a
39
39
  });
40
- z === t && (r.value.total = s.total || ((n = s.data) == null ? void 0 : n.length) || 0, r.value.records = [...s.data || []]);
40
+ S === t && (o.value.total = s.total || ((r = s.data) == null ? void 0 : r.length) || 0, o.value.records = [...s.data || []]);
41
41
  } catch {
42
- z === t && (r.value.records = [], r.value.total = 0);
42
+ S === t && (o.value.records = [], o.value.total = 0);
43
43
  } finally {
44
- r.value.loading = !1;
44
+ o.value.loading = !1;
45
45
  }
46
- }, j = (e) => {
46
+ }, R = (e) => {
47
47
  const a = {};
48
- return Object.entries(e).forEach(([t, n]) => {
49
- if (a[t] = n, y && n) {
48
+ return Object.entries(e).forEach(([t, r]) => {
49
+ if (a[t] = r, y && r) {
50
50
  const s = y[t];
51
- s && (a[t] = I(s, n));
51
+ s && (a[t] = k(s, r));
52
52
  }
53
53
  }), a;
54
54
  }, G = async (e) => {
55
- var n, s, g, d, m, u, h;
56
- const a = ((s = (n = l.value) == null ? void 0 : n.apForm) == null ? void 0 : s.getFieldsValue()) || {}, t = {};
55
+ var r, s, g, d, m, u, h;
56
+ const a = ((s = (r = c.value) == null ? void 0 : r.apForm) == null ? void 0 : s.getFieldsValue()) || {}, t = {};
57
57
  Object.entries(a).forEach(([v, i]) => {
58
- O && O.indexOf(v) > -1 && (t[v] = i);
59
- }), await ((d = (g = l.value) == null ? void 0 : g.apForm) == null ? void 0 : d.resetFields()), (h = (u = (m = l.value) == null ? void 0 : m.apForm) == null ? void 0 : u.setFieldsValue) == null || h.call(u, t), Z(() => {
58
+ D && D.indexOf(v) > -1 && (t[v] = i);
59
+ }), await ((d = (g = c.value) == null ? void 0 : g.apForm) == null ? void 0 : d.resetFields()), (h = (u = (m = c.value) == null ? void 0 : m.apForm) == null ? void 0 : u.setFieldsValue) == null || h.call(u, t), _(() => {
60
60
  e == null || e();
61
61
  });
62
- }, T = (e) => {
63
- p = e;
64
- const a = j(e);
65
- R(a);
62
+ }, x = (e) => {
63
+ f = e;
64
+ const a = R(e);
65
+ O(a);
66
66
  }, H = (e) => {
67
- T({
68
- ...p,
67
+ x({
68
+ ...f,
69
69
  ...e
70
70
  });
71
- }, D = () => {
71
+ }, j = () => {
72
72
  var a, t;
73
- const e = ((t = (a = l.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValue(!0)) || {};
74
- c.value = 1, T({
73
+ const e = ((t = (a = c.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValue(!0)) || {};
74
+ l.value = 1, x({
75
75
  ...e,
76
76
  current: 1,
77
- pageSize: p.pageSize || w
77
+ pageSize: f.pageSize || w
78
78
  });
79
79
  }, K = () => {
80
- G(D);
80
+ G(j);
81
81
  }, U = () => {
82
- T(p);
82
+ x(f);
83
83
  }, W = (e) => {
84
- const a = o(r).total - e, t = Math.ceil(a / o(f)), n = o(c) > t ? t : o(c);
84
+ const a = n(o).total - e, t = Math.ceil(a / n(p)), r = n(l) > t ? t : n(l);
85
85
  H({
86
- current: n > 0 ? n : 1
86
+ current: r > 0 ? r : 1
87
87
  });
88
88
  }, A = (e, a, t) => {
89
89
  var m, u, h, v;
90
- const n = ((u = (m = l.value) == null ? void 0 : m.apForm) == null ? void 0 : u.getFieldsValue(!0)) || {};
91
- c.value = e.current, f.value = e.pageSize;
92
- const s = ee(t) ? [...t] : [t], g = {};
90
+ const r = ((u = (m = c.value) == null ? void 0 : m.apForm) == null ? void 0 : u.getFieldsValue(!0)) || {};
91
+ l.value = e.current, p.value = e.pageSize;
92
+ const s = te(t) ? [...t] : [t], g = {};
93
93
  for (const i of s)
94
- (h = o(J)) != null && h.includes(i.field) && (g[k(i.field)] = i.order);
94
+ (h = n(J)) != null && h.includes(i.field) && (g[ee(i.field)] = i.order);
95
95
  const d = {};
96
96
  for (const i of Object.keys(a))
97
- (v = o(q)) != null && v.includes(i) && (d[i] = a[i]);
98
- T({
99
- ...n,
97
+ (v = n(q)) != null && v.includes(i) && (d[i] = a[i]);
98
+ x({
99
+ ...r,
100
100
  filter: d,
101
101
  sort: g,
102
102
  current: e.current,
103
103
  pageSize: e.pageSize
104
104
  });
105
105
  };
106
- _(() => {
106
+ I(() => {
107
107
  var a, t;
108
- const e = ((t = (a = l.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValue(!0)) || {};
109
- if (p = {
110
- current: o(c),
111
- pageSize: o(f),
108
+ const e = ((t = (a = c.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValue(!0)) || {};
109
+ if (f = {
110
+ current: n(l),
111
+ pageSize: n(p),
112
112
  ...e
113
113
  }, !B) {
114
- const n = j(p);
115
- R(n);
114
+ const r = R(f);
115
+ O(r);
116
116
  }
117
117
  });
118
- const X = V(() => o(r).total === 0 ? "-" : `${o(c.value)}/${Math.ceil(o(r).total / o(f))}`), Y = V(() => ({
119
- loading: o(r).loading,
118
+ const X = V(() => n(o).total === 0 ? "-" : `${n(l.value)}/${Math.ceil(n(o).total / n(p))}`);
119
+ function Y(e) {
120
+ e != null && e.length && (o.value.records = e, o.value.total = e.length);
121
+ }
122
+ const Z = V(() => ({
123
+ loading: n(o).loading,
120
124
  pagination: {
121
- current: o(c),
122
- pageSize: o(f),
123
- total: o(r).total,
124
- showSizeChanger: !b,
125
- showQuickJumper: !b,
126
- showLessItems: b,
125
+ current: n(l),
126
+ pageSize: n(p),
127
+ total: n(o).total,
128
+ showSizeChanger: !z,
129
+ showQuickJumper: !z,
130
+ showLessItems: z,
127
131
  size: "default",
128
- showTotal: L ? (e) => P("span", {
129
- class: F("pagination-total-wrapper")
130
- }, [S("ap.apTable.pagination.totalLeftPrefix"), " ", P("span", {
131
- class: F("pagination-count-text")
132
- }, [e]), " ", S("ap.apTable.pagination.totalLeftSuffix"), P("span", {
133
- class: F("pagination--total-right")
134
- }, [S("ap.apTable.pagination.totalRightPrefix"), " ", P("span", {
135
- class: F("pagination-count-text")
136
- }, [o(X)]), " ", S("ap.apTable.pagination.totalRightSuffix")])]) : void 0
132
+ showTotal: L ? (e) => b("span", {
133
+ class: T("pagination-total-wrapper")
134
+ }, [F("ap.apTable.pagination.totalLeftPrefix"), " ", b("span", {
135
+ class: T("pagination-count-text")
136
+ }, [e]), " ", F("ap.apTable.pagination.totalLeftSuffix"), b("span", {
137
+ class: T("pagination--total-right")
138
+ }, [F("ap.apTable.pagination.totalRightPrefix"), " ", b("span", {
139
+ class: T("pagination-count-text")
140
+ }, [n(X)]), " ", F("ap.apTable.pagination.totalRightSuffix")])]) : void 0
137
141
  },
138
142
  onChange: A,
139
- dataSource: o(r).records
143
+ dataSource: n(o).records
140
144
  }));
141
145
  return {
142
- formRef: l,
143
- submit: D,
146
+ formRef: c,
147
+ submit: j,
144
148
  reset: K,
145
149
  refresh: U,
146
150
  refreshByDelete: W,
147
- data: r,
148
- current: c,
149
- pageSize: f,
151
+ data: o,
152
+ current: l,
153
+ pageSize: p,
150
154
  handleTableChange: A,
151
- tableProps: Y,
152
- dataSource: V(() => o(r).records)
155
+ tableProps: Z,
156
+ dataSource: V(() => n(o).records),
157
+ setDataSource: Y
153
158
  };
154
159
  };
155
160
  export {
156
- le as useTablePaging
161
+ ue as useTablePaging
157
162
  };
@@ -72,6 +72,52 @@ export type CommonFieldReturnType = ApFormItemProps & {
72
72
  placeholder?: string;
73
73
  disabled?: boolean;
74
74
  };
75
+ export type ApTableSettingType = {
76
+ /**
77
+ * 用于持久化缓存的key
78
+ */
79
+ persistenceKey?: string;
80
+ /**
81
+ * 持久化类型
82
+ */
83
+ persistenceType?: 'localStorage' | 'sessionStorage';
84
+ /**
85
+ * 列的默认状态
86
+ */
87
+ defaultValue?: Recordable<Omit<ApColumnState, 'children' | 'key'>>;
88
+ /**
89
+ * 列状态变更时的回调(注意,返回的是全量状态)
90
+ * @param val
91
+ * @returns
92
+ */
93
+ onChange?: (val: ApColumnState[]) => void;
94
+ };
95
+ export type ApColumnState = {
96
+ /**
97
+ * 列的唯一标识
98
+ */
99
+ key: string | number;
100
+ /**
101
+ * 列是否显示
102
+ */
103
+ show?: boolean;
104
+ /**
105
+ * 列的固定状态
106
+ */
107
+ fixed?: 'left' | 'right';
108
+ /**
109
+ * 是否可以修改列状态
110
+ */
111
+ disabled?: boolean;
112
+ /**
113
+ * 列对应显示的文本
114
+ */
115
+ label?: any;
116
+ /**
117
+ * 子节点状态
118
+ */
119
+ children?: ApColumnState[];
120
+ };
75
121
  export type FieldPropsType<ReturnType, RecordType, ExtraValueType, ValueType extends ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType> = ReturnType | ((opt: Partial<{
76
122
  value: any;
77
123
  text: any;
@@ -81,7 +127,7 @@ export type FieldPropsType<ReturnType, RecordType, ExtraValueType, ValueType ext
81
127
  column: ApColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>;
82
128
  }>) => ReturnType);
83
129
  export type ApColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? ExtraProColumnType<RecordType> & {
84
- children?: ApColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
130
+ children?: Omit<ApColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>, 'fixed'>[];
85
131
  /**
86
132
  * 表单项所占据的格子数(1-24格)
87
133
  */
@@ -267,6 +313,10 @@ export type ApTableProps<RecordType = any, ParamsType = any> = Omit<TableProps<R
267
313
  * 设置表格列是否可以resize
268
314
  */
269
315
  columnResizable?: ColumnType['resizable'];
316
+ /**
317
+ * 是否开启表格设置
318
+ */
319
+ settings?: true | ApTableSettingType;
270
320
  };
271
321
  export type ApTableExpose<SearchParamsType = Recordable, RecordType = any> = {
272
322
  /**
@@ -7,7 +7,9 @@
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
  }
10
- .aplus-ap-table-adaptive .ant-table-wrapper,
10
+ .aplus-ap-table-adaptive .ant-table-wrapper {
11
+ flex: 1;
12
+ }
11
13
  .aplus-ap-table-adaptive .ant-spin-nested-loading,
12
14
  .aplus-ap-table-adaptive .ant-spin-container {
13
15
  height: 100%;
@@ -35,6 +37,8 @@
35
37
  .aplus-ap-table__table-wrapper {
36
38
  flex: 1;
37
39
  max-height: 100%;
40
+ display: flex;
41
+ flex-direction: column;
38
42
  }
39
43
  .aplus-ap-table__table-wrapper-card {
40
44
  padding: 16px;
@@ -98,3 +102,27 @@
98
102
  .aplus-ap-table-pagination-total-wrapper {
99
103
  color: var(--ap-table-pagination-total-color, #526A90);
100
104
  }
105
+ .aplus-ap-table-header {
106
+ padding-bottom: 16px;
107
+ display: flex;
108
+ justify-content: space-between;
109
+ align-items: center;
110
+ flex-wrap: nowrap;
111
+ }
112
+ .aplus-ap-table-header__title {
113
+ flex: 1;
114
+ flex-shrink: 1;
115
+ min-width: 0;
116
+ }
117
+ .aplus-ap-table-table-header__title {
118
+ display: -webkit-inline-box;
119
+ -webkit-line-clamp: 2;
120
+ -webkit-box-orient: vertical;
121
+ overflow: hidden;
122
+ text-overflow: ellipsis;
123
+ white-space: normal;
124
+ max-width: 100%;
125
+ vertical-align: middle;
126
+ word-break: break-all;
127
+ flex: 1;
128
+ }