@dazhicheng/ui 1.6.0 → 1.6.1

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 (124) 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 +3 -2
  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.js +4 -3
  93. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +2 -6
  94. package/dist/components/tt-table/src/hooks/useRowSelection.js +28 -27
  95. package/dist/components/tt-table/src/hooks/useSideSlot.js +4 -3
  96. package/dist/components/tt-table/src/hooks/useSyncProps.js +4 -3
  97. package/dist/components/tt-table/src/hooks/useTableData.js +6 -5
  98. package/dist/components/tt-table/src/hooks/useTableFooter.js +9 -8
  99. package/dist/components/tt-table/src/hooks/useTableForm.js +4 -3
  100. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +37 -4
  101. package/dist/components/tt-table/src/props.d.ts +12 -6
  102. package/dist/components/tt-table/src/props.js +14 -7
  103. package/dist/components/tt-table/src/table-mutation-events.js +10 -9
  104. package/dist/components/tt-table/src/types/table.d.ts +16 -0
  105. package/dist/components/tt-table/src/utils/action-tab-index.js +15 -14
  106. package/dist/components/tt-table/src/utils/context.js +5 -4
  107. package/dist/components/tt-table/src/utils/table-api.js +4 -2
  108. package/dist/components/tt-table/src/utils/table-form-api.js +22 -20
  109. package/dist/components/tt-text/index.js +4 -3
  110. package/dist/components/tt-upload/index.js +6 -5
  111. package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
  112. package/dist/directives/disabled-tip/index.js +9 -8
  113. package/dist/hooks/useFormSchemasLink.js +4 -3
  114. package/dist/hooks/useFormat.d.ts +35 -71
  115. package/dist/hooks/useFormat.js +28 -39
  116. package/dist/hooks/usePanelSelectSchemas.js +4 -3
  117. package/dist/hooks/useScreenshotOss.js +16 -15
  118. package/dist/packages/hooks/src/useDebounce.js +5 -4
  119. package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
  120. package/dist/packages/hooks/src/usePriorityValue.js +5 -4
  121. package/dist/packages/utils/src/format.js +48 -0
  122. package/dist/plugins/default/renderCellContent.js +4 -3
  123. package/dist/plugins/vxeTable/switchStatus.js +14 -13
  124. package/package.json +3 -3
@@ -1,10 +1,11 @@
1
1
  import { GlobalConfig as M } 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 m } from "../../../../packages/utils/src/is.js";
5
+ import { ref as S, computed as P, unref as t, toValue as V, nextTick as $ } 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,8 +14,8 @@ 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(() => {
17
+ function oe(R, r, i, d) {
18
+ const { getRowKey: h } = d, a = S([]), k = S([]), K = P(() => {
18
19
  const { showCheckbox: e, showRadio: o } = t(R), c = V(a);
19
20
  return e ? c || [] : o ? c ? [c] : [] : [];
20
21
  });
@@ -22,32 +23,32 @@ function ee(R, s, i, d) {
22
23
  return t(a);
23
24
  }
24
25
  function v() {
25
- var n, r, w;
26
+ var n, s, w;
26
27
  const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
27
28
  if (e) {
28
- const C = ((n = t(s)) == null ? void 0 : n.getCheckboxRecords(!0)) || [];
29
+ const C = ((n = t(r)) == null ? void 0 : n.getCheckboxRecords(!0)) || [];
29
30
  if (!c) return C;
30
- const g = ((r = t(s)) == null ? void 0 : r.getCheckboxReserveRecords(!0)) || [], f = /* @__PURE__ */ new Map();
31
+ const g = ((s = t(r)) == null ? void 0 : s.getCheckboxReserveRecords(!0)) || [], f = /* @__PURE__ */ new Map();
31
32
  return C.forEach((l) => f.set(h(l), l)), g.forEach((l) => {
32
33
  const b = h(l);
33
34
  f.has(b) || f.set(b, l);
34
35
  }), [...f.values()];
35
36
  }
36
- return o ? (w = t(s)) == null ? void 0 : w.getRadioRecord(!0) : [];
37
+ return o ? (w = t(r)) == null ? void 0 : w.getRadioRecord(!0) : [];
37
38
  }
38
39
  function A() {
39
40
  var e;
40
- return ((e = t(s)) == null ? void 0 : e.getTableData().fullData) || [];
41
+ return ((e = t(r)) == null ? void 0 : e.getTableData().fullData) || [];
41
42
  }
42
43
  function u(e) {
43
44
  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 });
45
+ k.value = o, a.value = m(o) ? o.map((c) => h(c)) : o ? h(o) : void 0, i("selection-change", { keys: x(), rows: o, data: e });
45
46
  }
46
47
  const B = (e) => {
47
48
  u(e), i("checkbox-change", e);
48
49
  }, E = (e) => {
49
50
  u(e), i("checkbox-all", e);
50
- }, m = (e) => {
51
+ }, y = (e) => {
51
52
  var o;
52
53
  i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && u(e);
53
54
  };
@@ -57,31 +58,31 @@ function ee(R, s, i, d) {
57
58
  async function D(e) {
58
59
  const { rows: o, cols: c } = e;
59
60
  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));
61
+ const n = t(r);
62
+ !n || !c.some((s) => s.type === "checkbox") || (await n.setCheckboxRow(o, !n.isCheckedByCheckboxRow(o[0])), u(e));
62
63
  }
63
64
  const F = (e) => {
64
65
  var n;
65
66
  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);
67
+ o != null && o.range && c ? y({ records: e.rows }) : (n = M.table) != null && n.isAreaCheckboxSelection && D(e), i("cell-area-selection-end", e);
67
68
  };
68
69
  async function G(e, o = []) {
69
70
  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();
71
+ const { showCheckbox: c, showRadio: n } = t(R), s = m(e) ? e : e ? [e] : [], w = /* @__PURE__ */ new Set([
72
+ ...s.map((b) => h(b)),
73
+ ...m(o) ? o : o == null ? [] : [o]
74
+ ]), C = A().filter((b) => w.has(h(b))), g = C.length ? C : s;
75
+ c && await ((f = t(r)) == null ? void 0 : f.setCheckboxRow(g, !0)), n && await ((l = t(r)) == null ? void 0 : l.setRadioRow(g[0])), await $(), u();
75
76
  }
76
- function S() {
77
- var n, r, w;
77
+ function p() {
78
+ var n, s, w;
78
79
  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() }));
80
+ !e && !o || (e && (a.value = [], k.value = [], (n = t(r)) == null || n.clearCheckboxRow(), c && ((s = t(r)) == null || s.clearCheckboxReserve())), o && (a.value = void 0, k.value = void 0, (w = t(r)) == null || w.clearRadioRow()), i("selection-change", { keys: x(), rows: v() }));
80
81
  }
81
82
  function L() {
82
83
  const { showCheckbox: e, reserveSelection: o } = t(R);
83
84
  if (!e || !o) {
84
- S();
85
+ p();
85
86
  return;
86
87
  }
87
88
  u();
@@ -94,15 +95,15 @@ function ee(R, s, i, d) {
94
95
  getSelectRows: v,
95
96
  syncSelection: u,
96
97
  setSelectedRowKeys: G,
97
- clearSelectedRowKeys: S,
98
+ clearSelectedRowKeys: p,
98
99
  resetSelectionAfterFetch: L,
99
100
  onCheckboxChange: B,
100
101
  onCheckboxAll: E,
101
- onCheckboxRangeChange: m,
102
+ onCheckboxRangeChange: y,
102
103
  onRadioChange: T,
103
104
  onCellAreaSelectionEnd: F
104
105
  };
105
106
  }
106
107
  export {
107
- ee as useRowSelection
108
+ oe as useRowSelection
108
109
  };
@@ -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` 用 `NoInfer` 包裹,`Row` 不再从传入的配置反向推断。业务常见写法是在
38
+ * `form.schemas` 的回调里引用解构出来的 api:
39
+ * `const [FormTable, api] = useTableFormRender({ form: { schemas: [{ onChange: () => f(api) }] } })`,
40
+ * 若 `Row` 从 `options` 推断,则 api 的类型依赖 options、options 又引用 api,TS 判定为循环,
41
+ * 整个变量退化成隐式 any 并报 TS7022/TS7023。代价是需要显式写
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: NoInfer<TtTableFormProps<Row>>): TtUseTableFormRenderReturnType<Row>;
43
65
  /**
44
66
  * 用于渲染表格的 hooks,返回 [TableRender 组件, 表格API]。
45
67
  *
46
68
  * options 只接受表格配置;单向数据使用 data,双向数据绑定到返回的 TableRender 组件。
47
69
  *
70
+ * `options` 用 `NoInfer` 包裹,`Row` 不从配置反向推断。业务常见写法是初始化时给 `data: []`,
71
+ * 若 `Row` 从空数组推断会退化成 `never`,组件的 `data` prop 类型变成 `MaybeRef<never[]>`,
72
+ * 之后传入任何具体行类型都会报 TS2322。代价是需要显式写 `useTableRender<Row>({ ... })`
73
+ * 才能拿到行类型推断,不写则为 `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: NoInfer<TtTableProps<Row>>): TtUseTableRenderReturnType<Row>;
95
+ export {};
@@ -71,10 +71,16 @@ export declare const tableProps: {
71
71
  type: PropType<TtTableProps["beforeFetch"]>;
72
72
  default: null;
73
73
  };
74
- /** data */
74
+ /**
75
+ * data
76
+ *
77
+ * `default` 显式标注返回类型:不标注时 `[]` 会被推断为 `never[]`,
78
+ * Vue 的 `ExtractPropTypes` 让 default 的返回类型参与推导,把 `PropType` 声明的类型收窄成
79
+ * `never[]`,业务传具体行类型的数组会直接报 TS2322。
80
+ */
75
81
  data: {
76
82
  type: PropType<TtTableProps["data"]>;
77
- default: () => never[];
83
+ default: () => TtTableProps["data"];
78
84
  };
79
85
  /** 是否滚动加载数据 */
80
86
  isScrollFetch: {
@@ -414,9 +420,9 @@ export declare const tableFormProps: {
414
420
  headerTooltipConfig?: VxeTablePropTypes.HeaderTooltipConfig<any> | undefined;
415
421
  tooltipConfig?: VxeTablePropTypes.TooltipConfig<any> | undefined;
416
422
  footerTooltipConfig?: VxeTablePropTypes.FooterTooltipConfig<any> | undefined;
417
- exportConfig?: VxeTablePropTypes.ExportConfig | undefined;
418
- importConfig?: VxeTablePropTypes.ImportConfig | undefined;
419
- printConfig?: VxeTablePropTypes.PrintConfig | undefined;
423
+ exportConfig?: VxeTablePropTypes.ExportConfig<any> | undefined;
424
+ importConfig?: VxeTablePropTypes.ImportConfig<any> | undefined;
425
+ printConfig?: VxeTablePropTypes.PrintConfig<any> | undefined;
420
426
  expandConfig?: VxeTablePropTypes.ExpandConfig<any> | undefined;
421
427
  treeConfig?: VxeTablePropTypes.TreeConfig<any> | undefined;
422
428
  mouseConfig?: VxeTablePropTypes.MouseConfig | undefined;
@@ -543,7 +549,7 @@ export declare const tableOtherProps: {
543
549
  /** 列配置 */
544
550
  columns: {
545
551
  type: PropType<TtTableProps["columns"]>;
546
- default: () => never[];
552
+ default: () => TtTableProps["columns"];
547
553
  };
548
554
  /**
549
555
  * 表格的高度;支持铺满父容器或者固定高度,如果设置 auto 为铺满父容器(如果设置为 auto,则必须确保存在父节点且不允许存在相邻元素)
@@ -3,6 +3,7 @@ import "axios";
3
3
  import "element-plus";
4
4
  import "dayjs";
5
5
  import "vue";
6
+ import "numeral";
6
7
  import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
@@ -102,7 +103,13 @@ const r = {
102
103
  type: Function,
103
104
  default: null
104
105
  },
105
- /** data */
106
+ /**
107
+ * data
108
+ *
109
+ * `default` 显式标注返回类型:不标注时 `[]` 会被推断为 `never[]`,
110
+ * Vue 的 `ExtractPropTypes` 让 default 的返回类型参与推导,把 `PropType` 声明的类型收窄成
111
+ * `never[]`,业务传具体行类型的数组会直接报 TS2322。
112
+ */
106
113
  data: {
107
114
  type: Array,
108
115
  default: () => []
@@ -135,7 +142,7 @@ const r = {
135
142
  },
136
143
  /** 是否显示表格上方 alert */
137
144
  showTableAlert: { type: Boolean, default: () => e("showTableAlert") }
138
- }, T = {
145
+ }, j = {
139
146
  /**
140
147
  * 是否自适应高度
141
148
  *
@@ -224,7 +231,7 @@ const r = {
224
231
  type: Object,
225
232
  default: () => e("radioConfig")
226
233
  }
227
- }, j = {
234
+ }, I = {
228
235
  /**
229
236
  * table参数
230
237
  *
@@ -277,7 +284,7 @@ const r = {
277
284
  tableFormApi: {
278
285
  type: Object
279
286
  }
280
- }, I = {
287
+ }, A = {
281
288
  /** 列配置 */
282
289
  columns: {
283
290
  type: Array,
@@ -337,7 +344,7 @@ const r = {
337
344
  ...d
338
345
  };
339
346
  export {
340
- j as tableFormProps,
341
- I as tableOtherProps,
342
- T as tableProps
347
+ I as tableFormProps,
348
+ A as tableOtherProps,
349
+ j as tableProps
343
350
  };
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isString as s, isArray as c } from "../../../packages/utils/src/is.js";
4
4
  import "vue";
5
- import u from "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import u from "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";
@@ -39,7 +40,7 @@ const p = /* @__PURE__ */ new Set([
39
40
  "filter-change",
40
41
  "clear-filter",
41
42
  "clear-all-filter"
42
- ]), m = /* @__PURE__ */ new Set(["insert", "insert_edit", "insert_actived", "remove"]), w = /* @__PURE__ */ new Set(["undo", "redo"]), _ = d.map((t) => [t, u.camelCase(t)]);
43
+ ]), m = /* @__PURE__ */ new Set(["insert", "insert_edit", "insert_actived", "remove"]), w = /* @__PURE__ */ new Set(["undo", "redo"]), $ = d.map((t) => [t, u.camelCase(t)]);
43
44
  function b(t) {
44
45
  var r, o;
45
46
  const e = t[0];
@@ -53,18 +54,18 @@ function g(t, e) {
53
54
  const a = e();
54
55
  return (c(a) ? !a.length : !a) ? !1 : !((l = (n = (i = r == null ? void 0 : r.$grid) == null ? void 0 : i.getCheckboxRecords) == null ? void 0 : n.call(i)) != null && l.length);
55
56
  }
56
- function $(t, e, r) {
57
+ function B(t, e, r) {
57
58
  return p.has(t) ? !0 : t === "edit-activated" ? b(e) : t === "toolbar-button-click" ? g(e, r) : !1;
58
59
  }
59
- function B(t) {
60
+ function U(t) {
60
61
  return f.has(t);
61
62
  }
62
- function U(t) {
63
+ function X(t) {
63
64
  return w.has(t) ? "visible" : "full";
64
65
  }
65
66
  export {
66
- _ as forwardedEventEntries,
67
- U as getMutationCommitSource,
68
- B as isDisplayOnlyEvent,
69
- $ as isRowDataMutationEvent
67
+ $ as forwardedEventEntries,
68
+ X as getMutationCommitSource,
69
+ U as isDisplayOnlyEvent,
70
+ B as isRowDataMutationEvent
70
71
  };
@@ -413,6 +413,22 @@ export type VxeTableMethods<DT> = {
413
413
  };
414
414
  export type TtSelectRowKeysType = Array<string | number> | string | number | undefined | any;
415
415
  export type TtSelectRowsType = VxeTablePropTypes.Row | Array<VxeTablePropTypes.Row> | any;
416
+ /**
417
+ * 选中行变化事件(`selection-change`)的载荷。
418
+ *
419
+ * 由 `useRowSelection` 发出,同时作为 `onSelectionChange` prop 的参数类型:
420
+ * 声明成具名 prop 后,业务的回调匹配的是这个具体签名,而不是 emits 数组生成的
421
+ * `on${Capitalize<string>}` 索引签名 —— 后者的值类型是 `defineModel` 与数组 emits
422
+ * 交叉出的函数,在参数逆变位置上和任何具名参数的回调都不兼容。
423
+ */
424
+ export type TtTableSelectionPayload = {
425
+ /** 选中行的 key 集合 */
426
+ keys: TtSelectRowKeysType;
427
+ /** 选中的行数据 */
428
+ rows: TtSelectRowsType;
429
+ /** 触发本次变化的行,全选与清空时为空 */
430
+ data?: Recordable;
431
+ };
416
432
  /**
417
433
  * `useTableRender` 返回组件的插槽类型。
418
434
  *
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isUndefined as d, isServer as f } from "../../../../packages/utils/src/is.js";
4
4
  import "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";
@@ -16,25 +17,25 @@ let a;
16
17
  function p() {
17
18
  const u = Array.from(document.querySelectorAll('[class*="table-action"]')), r = /* @__PURE__ */ new Map();
18
19
  u.forEach((n) => {
19
- const o = n.closest(".vxe-table");
20
- if (!o) return;
21
- const s = n.getBoundingClientRect(), t = Math.round(s.top), e = r.get(o) || /* @__PURE__ */ new Map(), i = e.get(t) || [];
22
- i.push(n), e.set(t, i), r.set(o, e);
20
+ const e = n.closest(".vxe-table");
21
+ if (!e) return;
22
+ const s = n.getBoundingClientRect(), t = Math.round(s.top), o = r.get(e) || /* @__PURE__ */ new Map(), i = o.get(t) || [];
23
+ i.push(n), o.set(t, i), r.set(e, o);
23
24
  }), r.forEach((n) => {
24
- n.forEach((o) => {
25
- const s = o.sort((t, e) => {
26
- const i = t.closest(".vxe-table"), c = e.closest(".vxe-table"), l = i != null && i.classList.contains("is--fixed-right") ? 1 : 0, m = c != null && c.classList.contains("is--fixed-right") ? 1 : 0;
27
- return l !== m ? m - l : e.getBoundingClientRect().left - t.getBoundingClientRect().left;
25
+ n.forEach((e) => {
26
+ const s = e.sort((t, o) => {
27
+ const i = t.closest(".vxe-table"), c = o.closest(".vxe-table"), l = i != null && i.classList.contains("is--fixed-right") ? 1 : 0, m = c != null && c.classList.contains("is--fixed-right") ? 1 : 0;
28
+ return l !== m ? m - l : o.getBoundingClientRect().left - t.getBoundingClientRect().left;
28
29
  })[0];
29
- o.forEach((t) => {
30
- t.querySelectorAll("[data-table-action-button]").forEach((e) => {
31
- e.tabIndex = t === s ? 0 : -1;
30
+ e.forEach((t) => {
31
+ t.querySelectorAll("[data-table-action-button]").forEach((o) => {
32
+ o.tabIndex = t === s ? 0 : -1;
32
33
  });
33
34
  });
34
35
  });
35
36
  });
36
37
  }
37
- function B() {
38
+ function I() {
38
39
  if (d(a)) {
39
40
  if (f || !window.requestAnimationFrame) {
40
41
  p();
@@ -46,5 +47,5 @@ function B() {
46
47
  }
47
48
  }
48
49
  export {
49
- B as scheduleNormalizeActionTabIndex
50
+ I as scheduleNormalizeActionTabIndex
50
51
  };
@@ -2,8 +2,9 @@ import { inject as s, provide as c } from "vue";
2
2
  import "axios";
3
3
  import "element-plus";
4
4
  import { isString as m, isArray as p } from "../../../../packages/utils/src/is.js";
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";
@@ -22,9 +23,9 @@ function f(t, r) {
22
23
  );
23
24
  }, (o) => (c(n, o), o)];
24
25
  }
25
- const [T, D] = f("FormActionTestIds");
26
+ const [D, E] = f("FormActionTestIds");
26
27
  export {
27
28
  f as createContext,
28
- T as injectFormActionTestIds,
29
- D as provideFormActionTestIds
29
+ D as injectFormActionTestIds,
30
+ E as provideFormActionTestIds
30
31
  };
@@ -5,6 +5,8 @@ import "axios";
5
5
  import "element-plus";
6
6
  import { isFunction as w } from "../../../../packages/utils/src/is.js";
7
7
  import { reactive as m, shallowRef as y, computed as n, toValue as d } from "vue";
8
+ import "dayjs";
9
+ import "numeral";
8
10
  import { bindMethods as p } from "../../../../packages/utils/src/tool.js";
9
11
  import { mergeWithArrayOverride as h } from "../../../../packages/utils/src/merge.js";
10
12
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -39,7 +41,7 @@ function C() {
39
41
  columnsKey: (l = o.table) == null ? void 0 : l.columnsKey
40
42
  };
41
43
  }
42
- class k {
44
+ class F {
43
45
  /**
44
46
  * 构造函数,初始化 store、状态等
45
47
  * @param options 表格配置项
@@ -425,6 +427,6 @@ class k {
425
427
  }
426
428
  }
427
429
  export {
428
- k as TableApi,
430
+ F as TableApi,
429
431
  C as getDefaultState
430
432
  };