@dazhicheng/ui 1.6.0 → 1.6.2

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 (125) hide show
  1. package/dist/components/tt-api-component/index.js +4 -3
  2. package/dist/components/tt-api-component/index.vue2.js +4 -3
  3. package/dist/components/tt-area/TtArea.vue3.js +8 -7
  4. package/dist/components/tt-button/index.js +5 -4
  5. package/dist/components/tt-button/index.vue2.js +4 -3
  6. package/dist/components/tt-checkbox/index.js +4 -3
  7. package/dist/components/tt-checkbox/index.vue.js +4 -3
  8. package/dist/components/tt-drawer/index.js +4 -3
  9. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
  10. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
  11. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
  12. package/dist/components/tt-drawer/src/props.js +3 -2
  13. package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
  14. package/dist/components/tt-empty/index.js +9 -8
  15. package/dist/components/tt-form/index.js +10 -9
  16. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
  17. package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
  18. package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
  19. package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
  20. package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
  21. package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
  22. package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
  23. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
  24. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +1 -0
  25. package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
  26. package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
  27. package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
  28. package/dist/components/tt-form/src/form-render/helper.js +15 -14
  29. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
  30. package/dist/components/tt-form/src/formApi.js +3 -2
  31. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
  32. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
  33. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
  34. package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
  35. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
  36. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
  37. package/dist/components/tt-form/src/index.vue2.js +3 -2
  38. package/dist/components/tt-form/src/useFormContext.js +11 -10
  39. package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
  40. package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
  41. package/dist/components/tt-icon/index.js +6 -5
  42. package/dist/components/tt-image/index.js +6 -5
  43. package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
  44. package/dist/components/tt-loading/index.js +4 -3
  45. package/dist/components/tt-loading/src/directive.js +24 -23
  46. package/dist/components/tt-log/index.js +4 -3
  47. package/dist/components/tt-log/index.vue.js +3 -2
  48. package/dist/components/tt-modal/index.js +3 -2
  49. package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
  50. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
  51. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
  52. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
  53. package/dist/components/tt-modal/src/props.js +3 -2
  54. package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
  55. package/dist/components/tt-modal-form/index.vue.js +4 -3
  56. package/dist/components/tt-nav-anchor/index.js +4 -3
  57. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
  58. package/dist/components/tt-panel-select/index.js +4 -3
  59. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +4 -3
  60. package/dist/components/tt-panel-select/src/index.vue.js +3 -2
  61. package/dist/components/tt-radio-group/index.js +4 -3
  62. package/dist/components/tt-radio-group/index.vue.js +7 -6
  63. package/dist/components/tt-select/index.js +4 -3
  64. package/dist/components/tt-select/src/Select.vue.d.ts +8 -8
  65. package/dist/components/tt-select/src/Select.vue.js +4 -3
  66. package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
  67. package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
  68. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  69. package/dist/components/tt-select/src/components/Table.vue.js +3 -2
  70. package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
  71. package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
  72. package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
  73. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
  74. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
  75. package/dist/components/tt-select/src/props.d.ts +2 -2
  76. package/dist/components/tt-table/index.d.ts +6 -6
  77. package/dist/components/tt-table/index.js +1 -1
  78. package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
  79. package/dist/components/tt-table/src/Table.vue.js +178 -175
  80. package/dist/components/tt-table/src/TableForm.vue.d.ts +6 -6
  81. package/dist/components/tt-table/src/TableForm.vue.js +2 -2
  82. package/dist/components/tt-table/src/components/TableAction.vue.js +19 -17
  83. package/dist/components/tt-table/src/components/TableButtons.js +10 -9
  84. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +4 -3
  85. package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +18 -17
  86. package/dist/components/tt-table/src/emits.d.ts +10 -1
  87. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +17 -16
  88. package/dist/components/tt-table/src/hooks/useColumns.js +4 -3
  89. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +34 -33
  90. package/dist/components/tt-table/src/hooks/usePagination.js +12 -11
  91. package/dist/components/tt-table/src/hooks/useQuery.js +6 -5
  92. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +1 -0
  93. package/dist/components/tt-table/src/hooks/useRowIdentity.js +68 -54
  94. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +5 -7
  95. package/dist/components/tt-table/src/hooks/useRowSelection.js +70 -68
  96. package/dist/components/tt-table/src/hooks/useSideSlot.js +4 -3
  97. package/dist/components/tt-table/src/hooks/useSyncProps.js +4 -3
  98. package/dist/components/tt-table/src/hooks/useTableData.js +6 -5
  99. package/dist/components/tt-table/src/hooks/useTableFooter.js +9 -8
  100. package/dist/components/tt-table/src/hooks/useTableForm.js +4 -3
  101. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +37 -4
  102. package/dist/components/tt-table/src/props.d.ts +12 -6
  103. package/dist/components/tt-table/src/props.js +14 -7
  104. package/dist/components/tt-table/src/table-mutation-events.js +10 -9
  105. package/dist/components/tt-table/src/types/table.d.ts +16 -0
  106. package/dist/components/tt-table/src/utils/action-tab-index.js +15 -14
  107. package/dist/components/tt-table/src/utils/context.js +5 -4
  108. package/dist/components/tt-table/src/utils/table-api.js +4 -2
  109. package/dist/components/tt-table/src/utils/table-form-api.js +22 -20
  110. package/dist/components/tt-text/index.js +4 -3
  111. package/dist/components/tt-upload/index.js +6 -5
  112. package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
  113. package/dist/directives/disabled-tip/index.js +9 -8
  114. package/dist/hooks/useFormSchemasLink.js +4 -3
  115. package/dist/hooks/useFormat.d.ts +35 -71
  116. package/dist/hooks/useFormat.js +28 -39
  117. package/dist/hooks/usePanelSelectSchemas.js +4 -3
  118. package/dist/hooks/useScreenshotOss.js +16 -15
  119. package/dist/packages/hooks/src/useDebounce.js +5 -4
  120. package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
  121. package/dist/packages/hooks/src/usePriorityValue.js +5 -4
  122. package/dist/packages/utils/src/format.js +48 -0
  123. package/dist/plugins/default/renderCellContent.js +4 -3
  124. package/dist/plugins/vxeTable/switchStatus.js +14 -13
  125. package/package.json +3 -3
@@ -1,9 +1,10 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
- import { isObject as F, isFunction as x, isArray as _, isNumber as B, isString as E } from "../../../../packages/utils/src/is.js";
4
- import { getCurrentInstance as W, unref as a, toRaw as C } from "vue";
5
- import "xe-utils";
3
+ import { isObject as _, isFunction as E, isArray as C, isNumber as W, isString as $ } from "../../../../packages/utils/src/is.js";
4
+ import { getCurrentInstance as q, unref as s, toRaw as P } from "vue";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -11,86 +12,99 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
11
12
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
12
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
- import { get as l } from "lodash-es";
15
- const y = "__tt_table_internal_row_key__";
16
- function c(o) {
17
- return B(o) ? !0 : E(o) && !!o;
15
+ import { get as S } from "lodash-es";
16
+ const l = "__tt_table_internal_row_key__";
17
+ function c(r) {
18
+ return W(r) ? !0 : $(r) && !!r;
19
+ }
20
+ function A(r) {
21
+ return r.includes(".") || r.includes("[");
18
22
  }
19
- function X(o) {
23
+ function O(r, d) {
24
+ return A(d) ? S(r, d) : r[d];
25
+ }
26
+ function ne(r) {
20
27
  var v;
21
- const P = ((v = W()) == null ? void 0 : v.uid) || 0;
22
- let m = 0;
28
+ const d = ((v = q()) == null ? void 0 : v.uid) || 0;
29
+ let w = 0;
23
30
  const K = /* @__PURE__ */ new WeakSet();
24
- function w() {
25
- return a(o).tableRowId || "id";
31
+ function f() {
32
+ return s(r).tableRowId || "id";
26
33
  }
27
- function p(e) {
28
- const t = l(e, w());
29
- return c(t) ? t : void 0;
34
+ function p(e, t = f()) {
35
+ const n = O(e, t);
36
+ return c(n) ? n : void 0;
30
37
  }
31
38
  function g(e) {
32
- const t = Reflect.get(e, y);
39
+ const t = Reflect.get(e, l);
33
40
  return c(t) ? t : void 0;
34
41
  }
35
- function O() {
36
- return m += 1, `tt_row_${P}_${m}`;
42
+ function j() {
43
+ return w += 1, `tt_row_${d}_${w}`;
37
44
  }
38
- function S(e, t) {
39
- const r = C(e), n = Object.getOwnPropertyDescriptor(r, y), i = n && c(n.value) ? n.value : t;
40
- if (n && !n.enumerable && c(n.value)) return i;
45
+ function I(e, t) {
46
+ const n = P(e), i = Object.getOwnPropertyDescriptor(n, l), o = i && c(i.value) ? i.value : t;
47
+ if (i && !i.enumerable && c(i.value)) return o;
41
48
  try {
42
- Object.defineProperty(r, y, {
49
+ Object.defineProperty(n, l, {
43
50
  configurable: !0,
44
51
  enumerable: !1,
45
- value: i,
52
+ value: o,
46
53
  writable: !0
47
54
  });
48
55
  } catch {
49
- K.has(r) || K.add(r);
56
+ K.has(n) || K.add(n);
50
57
  }
51
- return i;
58
+ return o;
52
59
  }
53
- function f({ row: e }) {
54
- var d;
60
+ function m({ row: e }) {
61
+ var y;
55
62
  const t = g(e);
56
63
  if (c(t)) return t;
57
- const r = (d = a(o).rowConfig) == null ? void 0 : d.createKeyMethod, n = x(r) ? r({ row: e, keyField: w() }) : void 0, i = p(e), u = c(n) ? n : c(i) ? i : O();
58
- return S(e, u);
64
+ const n = (y = s(r).rowConfig) == null ? void 0 : y.createKeyMethod, i = E(n) ? n({ row: e, keyField: f() }) : void 0, o = p(e), u = c(i) ? i : c(o) ? o : j();
65
+ return I(e, u);
59
66
  }
60
- function j(e = {}) {
67
+ function M(e = {}) {
61
68
  return e.keyField ? e : {
62
69
  ...e,
63
- keyField: y,
64
- createKeyMethod: f
70
+ keyField: l,
71
+ createKeyMethod: m
65
72
  };
66
73
  }
67
- function I(e) {
68
- var i;
69
- const t = p(e);
70
- if (c(t)) return t;
71
- const r = (i = a(o).rowConfig) == null ? void 0 : i.keyField;
72
- if (r) {
73
- const u = l(e, r);
74
+ function R(e, t, n) {
75
+ const i = p(e, t);
76
+ if (c(i)) return i;
77
+ if (n) {
78
+ const u = O(e, n);
74
79
  return c(u) ? u : void 0;
75
80
  }
76
- const n = g(e);
77
- return c(n) ? n : f({ row: e });
81
+ const o = g(e);
82
+ return c(o) ? o : m({ row: e });
83
+ }
84
+ function x(e) {
85
+ var t;
86
+ return R(e, f(), (t = s(r).rowConfig) == null ? void 0 : t.keyField);
87
+ }
88
+ function B(e) {
89
+ var i;
90
+ const t = f(), n = (i = s(r).rowConfig) == null ? void 0 : i.keyField;
91
+ return e.map((o) => R(o, t, n));
78
92
  }
79
- function M(e) {
80
- var u, d, R;
81
- if ((u = a(o).rowConfig) != null && u.keyField) return;
82
- const t = _(e) ? e : [e], r = /* @__PURE__ */ new WeakSet(), n = ((d = a(o).treeConfig) == null ? void 0 : d.childrenField) || ((R = a(o).treeConfig) == null ? void 0 : R.children) || "children";
83
- function i(s) {
84
- const b = C(s);
85
- if (r.has(b)) return;
86
- r.add(b), f({ row: s });
87
- const h = l(s, n);
88
- _(h) && h.forEach((k) => F(k) && i(k));
93
+ function D(e) {
94
+ var u, y, F;
95
+ if ((u = s(r).rowConfig) != null && u.keyField) return;
96
+ const t = C(e) ? e : [e], n = /* @__PURE__ */ new WeakSet(), i = ((y = s(r).treeConfig) == null ? void 0 : y.childrenField) || ((F = s(r).treeConfig) == null ? void 0 : F.children) || "children";
97
+ function o(a) {
98
+ const k = P(a);
99
+ if (n.has(k)) return;
100
+ n.add(k), m({ row: a });
101
+ const b = S(a, i);
102
+ C(b) && b.forEach((h) => _(h) && o(h));
89
103
  }
90
- t.forEach((s) => F(s) && i(s));
104
+ t.forEach((a) => _(a) && o(a));
91
105
  }
92
- return { getRowKey: I, prepareRows: M, toVxeRowConfig: j };
106
+ return { getRowKey: x, getRowKeys: B, prepareRows: D, toVxeRowConfig: M };
93
107
  }
94
108
  export {
95
- X as useRowIdentity
109
+ ne as useRowIdentity
96
110
  };
@@ -1,14 +1,10 @@
1
1
  import { ComputedRef, Ref } from 'vue';
2
2
  import { VxeGridDefines, VxeGridEvents, VxeGridInstance, VxeTableExtendCellAreaDefines } from 'vxe-table';
3
3
  import { Recordable } from '../../../../../../utils/src';
4
- import { TtSelectRowKeysType, TtSelectRowsType, TtTableProps } from '../types/table';
4
+ import { TtSelectRowKeysType, TtSelectRowsType, TtTableProps, TtTableSelectionPayload } from '../types/table';
5
5
  /** 行选择相关事件 */
6
6
  type SelectionEmit = {
7
- (e: "selection-change", data?: {
8
- keys: TtSelectRowKeysType;
9
- rows: TtSelectRowsType;
10
- data?: Recordable;
11
- }): void;
7
+ (e: "selection-change", data?: TtTableSelectionPayload): void;
12
8
  (e: "checkbox-change", data?: VxeGridDefines.CheckboxChangeEventParams): void;
13
9
  (e: "checkbox-all", data?: VxeGridDefines.CheckboxAllEventParams): void;
14
10
  (e: "checkbox-range-change", data?: VxeGridDefines.CheckboxRangeChangeEventParams): void;
@@ -19,6 +15,8 @@ type SelectionEmit = {
19
15
  type RowSelectionIdentity = {
20
16
  /** 获取业务兼容的行主键。 */
21
17
  getRowKey: (row: Recordable) => number | string | undefined;
18
+ /** 批量获取行主键,配置只解析一次。 */
19
+ getRowKeys: (rows: Recordable[]) => Array<number | string | undefined>;
22
20
  };
23
21
  /**
24
22
  * 行选择状态(复选框、单选框、区域选择)
@@ -29,7 +27,7 @@ type RowSelectionIdentity = {
29
27
  */
30
28
  export declare function useRowSelection(propsRef: ComputedRef<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, emit: SelectionEmit, identity: RowSelectionIdentity): {
31
29
  selectedKeys: Ref<any, any>;
32
- selectedRows: Ref<any, any>;
30
+ selectedRows: import('vue').ShallowRef<any, any>;
33
31
  selectedKeyList: ComputedRef<(string | number)[]>;
34
32
  getSelectRowKeys: () => any;
35
33
  getSelectRows: () => TtSelectRowsType;
@@ -1,10 +1,11 @@
1
- import { GlobalConfig as M } from "../../../../hooks/useSetup.js";
1
+ import { GlobalConfig as _ } from "../../../../hooks/useSetup.js";
2
2
  import "axios";
3
3
  import "element-plus";
4
- import { isArray as y } from "../../../../packages/utils/src/is.js";
5
- import { ref as p, computed as P, unref as t, toValue as V, nextTick as $ } from "vue";
6
- import "xe-utils";
4
+ import { isArray as S } from "../../../../packages/utils/src/is.js";
5
+ import { ref as $, shallowRef as j, computed as q, unref as t, toValue as z, nextTick as H } from "vue";
7
6
  import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
8
9
  import "dayjs/plugin/utc";
9
10
  import "dayjs/plugin/timezone";
10
11
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -13,96 +14,97 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
13
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
15
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
16
  import "lodash-es";
16
- function ee(R, s, i, d) {
17
- const { getRowKey: h } = d, a = p([]), k = p([]), K = P(() => {
18
- const { showCheckbox: e, showRadio: o } = t(R), c = V(a);
19
- return e ? c || [] : o ? c ? [c] : [] : [];
17
+ function re(f, s, i, A) {
18
+ const { getRowKey: K, getRowKeys: b } = A, l = $([]), k = j([]), B = q(() => {
19
+ const { showCheckbox: e, showRadio: o } = t(f), n = z(l);
20
+ return e ? n || [] : o ? n ? [n] : [] : [];
20
21
  });
21
22
  function x() {
22
- return t(a);
23
+ return t(l);
23
24
  }
24
- function v() {
25
- var n, r, w;
26
- const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
25
+ function y() {
26
+ var c, r, a;
27
+ const { showCheckbox: e, showRadio: o, reserveSelection: n } = t(f);
27
28
  if (e) {
28
- const C = ((n = t(s)) == null ? void 0 : n.getCheckboxRecords(!0)) || [];
29
- if (!c) return C;
30
- const g = ((r = t(s)) == null ? void 0 : r.getCheckboxReserveRecords(!0)) || [], f = /* @__PURE__ */ new Map();
31
- return C.forEach((l) => f.set(h(l), l)), g.forEach((l) => {
32
- const b = h(l);
33
- f.has(b) || f.set(b, l);
34
- }), [...f.values()];
29
+ const u = ((c = t(s)) == null ? void 0 : c.getCheckboxRecords(!0)) || [];
30
+ if (!n) return u;
31
+ const C = ((r = t(s)) == null ? void 0 : r.getCheckboxReserveRecords(!0)) || [];
32
+ if (!C.length) return u;
33
+ const w = /* @__PURE__ */ new Map(), m = b(u), g = b(C);
34
+ return u.forEach((R, v) => w.set(m[v], R)), C.forEach((R, v) => {
35
+ w.has(g[v]) || w.set(g[v], R);
36
+ }), [...w.values()];
35
37
  }
36
- return o ? (w = t(s)) == null ? void 0 : w.getRadioRecord(!0) : [];
38
+ return o ? (a = t(s)) == null ? void 0 : a.getRadioRecord(!0) : [];
37
39
  }
38
- function A() {
40
+ function E() {
39
41
  var e;
40
42
  return ((e = t(s)) == null ? void 0 : e.getTableData().fullData) || [];
41
43
  }
42
- function u(e) {
43
- const o = v();
44
- k.value = o, a.value = y(o) ? o.map((c) => h(c)) : o ? h(o) : void 0, i("selection-change", { keys: x(), rows: o, data: e });
44
+ function h(e) {
45
+ const o = y();
46
+ k.value = o, l.value = S(o) ? b(o) : o ? K(o) : void 0, i("selection-change", { keys: x(), rows: o, data: e });
45
47
  }
46
- const B = (e) => {
47
- u(e), i("checkbox-change", e);
48
- }, E = (e) => {
49
- u(e), i("checkbox-all", e);
50
- }, m = (e) => {
48
+ const T = (e) => {
49
+ h(e), i("checkbox-change", e);
50
+ }, D = (e) => {
51
+ h(e), i("checkbox-all", e);
52
+ }, d = (e) => {
51
53
  var o;
52
- i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && u(e);
54
+ i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && h(e);
53
55
  };
54
- function T(e) {
55
- k.value = e.row, a.value = e.row ? h(e.row) : void 0, i("radio-change", e), i("selection-change", { keys: x(), rows: v(), data: e });
56
+ function P(e) {
57
+ k.value = e.row, l.value = e.row ? K(e.row) : void 0, i("radio-change", e), i("selection-change", { keys: x(), rows: y(), data: e });
56
58
  }
57
- async function D(e) {
58
- const { rows: o, cols: c } = e;
59
+ async function F(e) {
60
+ const { rows: o, cols: n } = e;
59
61
  if (o.length === 1) return;
60
- const n = t(s);
61
- !n || !c.some((r) => r.type === "checkbox") || (await n.setCheckboxRow(o, !n.isCheckedByCheckboxRow(o[0])), u(e));
62
+ const c = t(s);
63
+ !c || !n.some((r) => r.type === "checkbox") || (await c.setCheckboxRow(o, !c.isCheckedByCheckboxRow(o[0])), h(e));
62
64
  }
63
- const F = (e) => {
64
- var n;
65
- const { checkboxConfig: o, showCheckbox: c } = t(R);
66
- o != null && o.range && c ? m({ records: e.rows }) : (n = M.table) != null && n.isAreaCheckboxSelection && D(e), i("cell-area-selection-end", e);
65
+ const G = (e) => {
66
+ var c;
67
+ const { checkboxConfig: o, showCheckbox: n } = t(f);
68
+ o != null && o.range && n ? d({ records: e.rows }) : (c = _.table) != null && c.isAreaCheckboxSelection && F(e), i("cell-area-selection-end", e);
67
69
  };
68
- async function G(e, o = []) {
69
- var f, l;
70
- const { showCheckbox: c, showRadio: n } = t(R), r = y(e) ? e : e ? [e] : [], w = /* @__PURE__ */ new Set([
71
- ...r.map((b) => h(b)),
72
- ...y(o) ? o : o == null ? [] : [o]
73
- ]), C = A().filter((b) => w.has(h(b))), g = C.length ? C : r;
74
- c && await ((f = t(s)) == null ? void 0 : f.setCheckboxRow(g, !0)), n && await ((l = t(s)) == null ? void 0 : l.setRadioRow(g[0])), await $(), u();
70
+ async function L(e, o = []) {
71
+ var g, R;
72
+ const { showCheckbox: n, showRadio: c } = t(f), r = S(e) ? e : e ? [e] : [], a = /* @__PURE__ */ new Set([
73
+ ...b(r),
74
+ ...S(o) ? o : o == null ? [] : [o]
75
+ ]), u = E(), C = b(u), w = u.filter((v, V) => a.has(C[V])), m = w.length ? w : r;
76
+ n && await ((g = t(s)) == null ? void 0 : g.setCheckboxRow(m, !0)), c && await ((R = t(s)) == null ? void 0 : R.setRadioRow(m[0])), await H(), h();
75
77
  }
76
- function S() {
77
- var n, r, w;
78
- const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
79
- !e && !o || (e && (a.value = [], k.value = [], (n = t(s)) == null || n.clearCheckboxRow(), c && ((r = t(s)) == null || r.clearCheckboxReserve())), o && (a.value = void 0, k.value = void 0, (w = t(s)) == null || w.clearRadioRow()), i("selection-change", { keys: x(), rows: v() }));
78
+ function p() {
79
+ var c, r, a;
80
+ const { showCheckbox: e, showRadio: o, reserveSelection: n } = t(f);
81
+ !e && !o || (e && (l.value = [], k.value = [], (c = t(s)) == null || c.clearCheckboxRow(), n && ((r = t(s)) == null || r.clearCheckboxReserve())), o && (l.value = void 0, k.value = void 0, (a = t(s)) == null || a.clearRadioRow()), i("selection-change", { keys: x(), rows: y() }));
80
82
  }
81
- function L() {
82
- const { showCheckbox: e, reserveSelection: o } = t(R);
83
+ function M() {
84
+ const { showCheckbox: e, reserveSelection: o } = t(f);
83
85
  if (!e || !o) {
84
- S();
86
+ p();
85
87
  return;
86
88
  }
87
- u();
89
+ h();
88
90
  }
89
91
  return {
90
- selectedKeys: a,
92
+ selectedKeys: l,
91
93
  selectedRows: k,
92
- selectedKeyList: K,
94
+ selectedKeyList: B,
93
95
  getSelectRowKeys: x,
94
- getSelectRows: v,
95
- syncSelection: u,
96
- setSelectedRowKeys: G,
97
- clearSelectedRowKeys: S,
98
- resetSelectionAfterFetch: L,
99
- onCheckboxChange: B,
100
- onCheckboxAll: E,
101
- onCheckboxRangeChange: m,
102
- onRadioChange: T,
103
- onCellAreaSelectionEnd: F
96
+ getSelectRows: y,
97
+ syncSelection: h,
98
+ setSelectedRowKeys: L,
99
+ clearSelectedRowKeys: p,
100
+ resetSelectionAfterFetch: M,
101
+ onCheckboxChange: T,
102
+ onCheckboxAll: D,
103
+ onCheckboxRangeChange: d,
104
+ onRadioChange: P,
105
+ onCellAreaSelectionEnd: G
104
106
  };
105
107
  }
106
108
  export {
107
- ee as useRowSelection
109
+ re as useRowSelection
108
110
  };
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isUndefined as A, isServer as T } from "../../../../packages/utils/src/is.js";
4
4
  import { computed as E, unref as t, ref as b, shallowRef as u, watch as W, onScopeDispose as R, nextTick as k } from "vue";
5
- import "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -12,7 +13,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
12
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
15
  import "lodash-es";
15
- function Q(c, s, N) {
16
+ function V(c, s, N) {
16
17
  const f = E(() => !!(t(c).leftSlotWidth || t(c).rightSlotWidth)), w = b(), g = b(), d = u(0), m = u(0), p = u(0), h = u(0), y = u(0), v = b([]), a = /* @__PURE__ */ new Set();
17
18
  function q() {
18
19
  return new Promise((r) => {
@@ -73,5 +74,5 @@ function Q(c, s, N) {
73
74
  };
74
75
  }
75
76
  export {
76
- Q as useSideSlot
77
+ V as useSideSlot
77
78
  };
@@ -3,8 +3,9 @@ import "axios";
3
3
  import "element-plus";
4
4
  import { isObject as h, isArray as b } from "../../../../packages/utils/src/is.js";
5
5
  import { getCurrentInstance as P, watch as p, toValue as g } from "vue";
6
- import "xe-utils";
7
6
  import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
8
9
  import "dayjs/plugin/utc";
9
10
  import "dayjs/plugin/timezone";
10
11
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -14,7 +15,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
14
15
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
16
  import "lodash-es";
16
17
  const f = ["data"], j = ["columns"];
17
- function B(t, m, l = []) {
18
+ function D(t, m, l = []) {
18
19
  var c;
19
20
  const i = P();
20
21
  function u(o) {
@@ -51,5 +52,5 @@ function B(t, m, l = []) {
51
52
  });
52
53
  }
53
54
  export {
54
- B as useSyncProps
55
+ D as useSyncProps
55
56
  };
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isString as L, isFunction as N, isObject as Re } from "../../../../packages/utils/src/is.js";
4
4
  import { getCurrentInstance as he, shallowRef as J, watch as Q, unref as d, onBeforeUpdate as ve, getCurrentScope as Ce, onScopeDispose as Me, toValue as S, nextTick as P, isRef as be } from "vue";
5
- import "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -59,11 +60,11 @@ function X(l) {
59
60
  function x(l) {
60
61
  return !l || l();
61
62
  }
62
- async function _e(l, f, C, g = () => !0) {
63
+ async function ke(l, f, C, g = () => !0) {
63
64
  const i = (l == null ? void 0 : l.getTreeExpandRecords()) || [], R = await C();
64
65
  return f && i.length && g() && await (l == null ? void 0 : l.setTreeExpand(i, !0)), R;
65
66
  }
66
- function ke(l, f, C, g, i) {
67
+ function je(l, f, C, g, i) {
67
68
  const R = he(), b = J([]), D = J();
68
69
  let A = !1, s = !1, M = 0, h;
69
70
  const q = Symbol("tt-table-emitted-rows-event");
@@ -302,6 +303,6 @@ function ke(l, f, C, g, i) {
302
303
  }
303
304
  export {
304
305
  X as getExternalRowsValue,
305
- ke as useTableData,
306
- _e as withTreeExpand
306
+ je as useTableData,
307
+ ke as withTreeExpand
307
308
  };
@@ -1,9 +1,10 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
3
  import { isFunction as s, isNumber as d } from "../../../../packages/utils/src/is.js";
4
- import { computed as p, unref as a } from "vue";
5
- import "xe-utils";
4
+ import { computed as u, unref as a } from "vue";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -20,8 +21,8 @@ function h(i, m, f) {
20
21
  const e = r.filter(d), o = e.reduce((t, n) => t + n, 0);
21
22
  return i === "avg" ? e.length ? o / e.length : 0 : o;
22
23
  }
23
- function x(i) {
24
- const m = p(() => {
24
+ function z(i) {
25
+ const m = u(() => {
25
26
  const r = /* @__PURE__ */ new Map(), e = (o) => {
26
27
  o.forEach((t) => {
27
28
  var n;
@@ -30,17 +31,17 @@ function x(i) {
30
31
  };
31
32
  return e(a(i)), r;
32
33
  });
33
- return { footerSummaryMethod: p(() => {
34
+ return { footerSummaryMethod: u(() => {
34
35
  const r = a(m);
35
36
  if (r.size)
36
37
  return ({ columns: e, data: o }) => [
37
38
  e.map((t, n) => {
38
- const u = t.field ? r.get(t.field) : void 0;
39
- return u ? h(u, t, o) : n === 0 ? c : "";
39
+ const p = t.field ? r.get(t.field) : void 0;
40
+ return p ? h(p, t, o) : n === 0 ? c : "";
40
41
  })
41
42
  ];
42
43
  }) };
43
44
  }
44
45
  export {
45
- x as useTableFooter
46
+ z as useTableFooter
46
47
  };
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isFunction as m } from "../../../../packages/utils/src/is.js";
4
4
  import { computed as c, unref as i, toValue as u } from "vue";
5
- import "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -12,7 +13,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
12
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
15
  import { omit as p } from "lodash-es";
15
- function V(n, h, l, d) {
16
+ function j(n, h, l, d) {
16
17
  const f = c(() => {
17
18
  const { form: t } = i(n), o = {
18
19
  ...t == null ? void 0 : t.submitButtonOptions,
@@ -63,5 +64,5 @@ function V(n, h, l, d) {
63
64
  };
64
65
  }
65
66
  export {
66
- V as useTableForm
67
+ j as useTableForm
67
68
  };
@@ -1,13 +1,23 @@
1
1
  import { DefineSetupFnComponent, SlotsType } from 'vue';
2
2
  import { TtTableExtendedTableApi, TtTableProps, TtTableRenderProps, TtTableSlots } from '../types/table';
3
3
  import { TtTableExtendedTableFormApi, TtTableFormProps } from '../types/tableForm';
4
+ /**
5
+ * 表格渲染组件的事件声明。
6
+ *
7
+ * 不能写成 `Record<string, any>`:Vue 的 `EmitsToProps` 走对象分支时会算
8
+ * `T[K] extends (...args: infer P) => any ? P : ...`,而 `T[K]` 为 `any` 时 `P` 被推断成
9
+ * `unknown[]`,生成的 `on${Capitalize<string>}` 索引签名参数变成 `unknown[]`。
10
+ * 该类型处于参数逆变位置,会让业务侧任何具名参数的回调(`@selection-change="({ rows }) => ..."`)
11
+ * 都无法赋值。值声明为宽松函数签名后,`P` 推断为 `any[]`,与任意回调双向兼容。
12
+ */
13
+ type TtTableRenderEmits = Record<string, (...args: any[]) => any>;
4
14
  /**
5
15
  * useTableFormRender 的返回值
6
16
  *
7
17
  * `Row` 是业务行数据类型,传入后表格插槽作用域与 `tableFormApi.tableApi` 的方法签名跟着推断。
8
18
  */
9
19
  export type TtUseTableFormRenderReturnType<Row = any> = [
10
- DefineSetupFnComponent<TtTableFormProps<Row>, Record<string, any>, SlotsType<TtTableSlots<Row>>>,
20
+ DefineSetupFnComponent<TtTableFormProps<Row>, TtTableRenderEmits, SlotsType<TtTableSlots<Row>>>,
11
21
  TtTableExtendedTableFormApi<Row>
12
22
  ];
13
23
  /**
@@ -16,7 +26,7 @@ export type TtUseTableFormRenderReturnType<Row = any> = [
16
26
  * `Row` 是业务行数据类型,传入后组件的 `modelValue`、插槽作用域与 `tableApi` 的方法签名跟着推断。
17
27
  */
18
28
  export type TtUseTableRenderReturnType<Row = any> = [
19
- DefineSetupFnComponent<TtTableRenderProps<Row>, Record<string, any>, SlotsType<TtTableSlots<Row>>>,
29
+ DefineSetupFnComponent<TtTableRenderProps<Row>, TtTableRenderEmits, SlotsType<TtTableSlots<Row>>>,
20
30
  TtTableExtendedTableApi<Row>
21
31
  ];
22
32
  /**
@@ -24,6 +34,13 @@ export type TtUseTableRenderReturnType<Row = any> = [
24
34
  *
25
35
  * 返回 [FormTable 组件, TableFormApi API]。
26
36
  *
37
+ * `options` 的类型不含 `Row`,`Row` 只出现在返回类型上。这是为了打断业务常见写法里的循环推断:
38
+ * `const [FormTable, api] = useTableFormRender({ form: { schemas: [{ onChange: () => f(api) }] } })`
39
+ * 中 `api` 的类型来自返回值,而实参字面量里的回调又引用 `api`。只要参数类型带 `Row`,
40
+ * TS 就必须先检查实参才能定下返回类型,于是判定为循环并把 `api` 退化成隐式 any(TS7022/TS7023)。
41
+ * `NoInfer` 只能阻止推断、阻止不了这次实参检查,所以这里直接让参数与 `Row` 解耦。
42
+ * 需要行类型时显式写 `useTableFormRender<Row>({ ... })`,不写则为 `any`。
43
+ *
27
44
  * @param options 表格渲染配置项
28
45
  * @returns [FormTable组件, TableFormApi API]
29
46
  *
@@ -36,15 +53,25 @@ export type TtUseTableRenderReturnType<Row = any> = [
36
53
  * ...配置
37
54
  * })
38
55
  *
56
+ * // 需要行类型推断时显式传入
57
+ * const [FormTable, tableApi] = useTableFormRender<OrderRow>({
58
+ * ...配置
59
+ * })
60
+ *
39
61
  * // 在模板中使用
40
62
  * <FormTable />
41
63
  */
42
- export declare function useTableFormRender<Row = any>(options: TtTableFormProps<Row>): TtUseTableFormRenderReturnType<Row>;
64
+ export declare function useTableFormRender<Row = any>(options: TtTableFormProps<any>): TtUseTableFormRenderReturnType<Row>;
43
65
  /**
44
66
  * 用于渲染表格的 hooks,返回 [TableRender 组件, 表格API]。
45
67
  *
46
68
  * options 只接受表格配置;单向数据使用 data,双向数据绑定到返回的 TableRender 组件。
47
69
  *
70
+ * `options` 的类型不含 `Row`,与 `useTableFormRender` 保持一致:`Row` 参与参数类型时,
71
+ * 业务写 `useTableRender({ data: [], columns: [...] })` 会让 `Row` 从空数组推断成 `never`,
72
+ * 组件的 `data` prop 类型退化为 `MaybeRef<never[]>`,之后传入任何具体行类型都报 TS2322。
73
+ * 需要行类型时显式写 `useTableRender<Row>({ ... })`,不写则为 `any`。
74
+ *
48
75
  * @param options 表格渲染配置项
49
76
  * @returns [TableRender组件, 表格API]
50
77
  *
@@ -56,7 +83,13 @@ export declare function useTableFormRender<Row = any>(options: TtTableFormProps<
56
83
  * ...其它配置
57
84
  * })
58
85
  *
86
+ * // 需要行类型推断时显式传入
87
+ * const [TableRender, tableApi] = useTableRender<OrderRow>({
88
+ * columns: [...],
89
+ * })
90
+ *
59
91
  * // 在模板中使用
60
92
  * <TableRender />
61
93
  */
62
- export declare function useTableRender<Row = any>(options: TtTableProps<Row>): TtUseTableRenderReturnType<Row>;
94
+ export declare function useTableRender<Row = any>(options: TtTableProps<any>): TtUseTableRenderReturnType<Row>;
95
+ export {};