@dazhicheng/ui 1.5.266 → 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 (182) 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.vue.js +1 -1
  4. package/dist/components/tt-area/TtArea.vue3.js +8 -7
  5. package/dist/components/tt-button/index.js +5 -4
  6. package/dist/components/tt-button/index.vue2.js +4 -3
  7. package/dist/components/tt-checkbox/index.js +4 -3
  8. package/dist/components/tt-checkbox/index.vue.js +4 -3
  9. package/dist/components/tt-drawer/index.js +4 -3
  10. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
  11. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
  12. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  13. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
  14. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  15. package/dist/components/tt-drawer/src/props.js +3 -2
  16. package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
  17. package/dist/components/tt-empty/index.js +9 -8
  18. package/dist/components/tt-form/index.js +10 -9
  19. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
  20. package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
  21. package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
  22. package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
  23. package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
  24. package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
  25. package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
  26. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
  27. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  28. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +1 -0
  29. package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
  30. package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
  31. package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
  32. package/dist/components/tt-form/src/form-render/helper.js +15 -14
  33. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
  34. package/dist/components/tt-form/src/formApi.js +3 -2
  35. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
  36. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
  37. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
  38. package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
  39. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
  40. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
  41. package/dist/components/tt-form/src/index.vue2.js +3 -2
  42. package/dist/components/tt-form/src/useFormContext.js +11 -10
  43. package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
  44. package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
  45. package/dist/components/tt-icon/index.js +6 -5
  46. package/dist/components/tt-icon/index.vue.js +2 -2
  47. package/dist/components/tt-image/index.js +6 -5
  48. package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
  49. package/dist/components/tt-loading/index.js +4 -3
  50. package/dist/components/tt-loading/src/directive.js +24 -23
  51. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  52. package/dist/components/tt-log/index.js +4 -3
  53. package/dist/components/tt-log/index.vue.js +3 -2
  54. package/dist/components/tt-modal/index.js +3 -2
  55. package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
  56. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
  57. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
  58. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
  59. package/dist/components/tt-modal/src/props.js +3 -2
  60. package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
  61. package/dist/components/tt-modal-form/index.vue.js +4 -3
  62. package/dist/components/tt-nav-anchor/index.js +4 -3
  63. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
  64. package/dist/components/tt-panel-select/index.js +4 -3
  65. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  66. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +95 -87
  67. package/dist/components/tt-panel-select/src/index.vue.js +4 -2
  68. package/dist/components/tt-radio-group/index.js +4 -3
  69. package/dist/components/tt-radio-group/index.vue.js +7 -6
  70. package/dist/components/tt-select/index.js +4 -3
  71. package/dist/components/tt-select/src/Select.vue.d.ts +12 -12
  72. package/dist/components/tt-select/src/Select.vue.js +4 -3
  73. package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
  74. package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
  75. package/dist/components/tt-select/src/components/Table.vue.d.ts +8 -8
  76. package/dist/components/tt-select/src/components/Table.vue.js +3 -2
  77. package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
  78. package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
  79. package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
  80. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
  81. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
  82. package/dist/components/tt-select/src/props.d.ts +2 -2
  83. package/dist/components/tt-table/index.d.ts +526 -361
  84. package/dist/components/tt-table/index.js +7 -5
  85. package/dist/components/tt-table/src/Table.vue.d.ts +308 -218
  86. package/dist/components/tt-table/src/Table.vue.js +406 -618
  87. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  88. package/dist/components/tt-table/src/TableForm.vue.js +219 -229
  89. package/dist/components/tt-table/src/components/TableAction.vue.js +110 -131
  90. package/dist/components/tt-table/src/components/TableButtons.js +30 -29
  91. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -84
  92. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  93. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +34 -35
  94. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  95. package/dist/components/tt-table/src/emits.d.ts +10 -1
  96. package/dist/components/tt-table/src/emits.js +2 -1
  97. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  98. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +64 -0
  99. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  100. package/dist/components/tt-table/src/hooks/useColumns.js +101 -245
  101. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  102. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  103. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  104. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +98 -0
  105. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  106. package/dist/components/tt-table/src/hooks/usePagination.js +30 -33
  107. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  108. package/dist/components/tt-table/src/hooks/useQuery.js +148 -0
  109. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  110. package/dist/components/tt-table/src/hooks/useRowIdentity.js +97 -0
  111. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +24 -12
  112. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -70
  113. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  114. package/dist/components/tt-table/src/hooks/useSideSlot.js +78 -0
  115. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  116. package/dist/components/tt-table/src/hooks/useSyncProps.js +56 -0
  117. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  118. package/dist/components/tt-table/src/hooks/useTableData.js +308 -0
  119. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  120. package/dist/components/tt-table/src/hooks/useTableFooter.js +47 -0
  121. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  122. package/dist/components/tt-table/src/hooks/useTableForm.js +56 -48
  123. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  124. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  125. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +57 -55
  126. package/dist/components/tt-table/src/props.d.ts +326 -153
  127. package/dist/components/tt-table/src/props.js +125 -271
  128. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  129. package/dist/components/tt-table/src/table-defaults.js +71 -0
  130. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  131. package/dist/components/tt-table/src/table-mutation-events.js +71 -0
  132. package/dist/components/tt-table/src/types/table.d.ts +223 -88
  133. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  134. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  135. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  136. package/dist/components/tt-table/src/utils/action-tab-index.js +51 -0
  137. package/dist/components/tt-table/src/utils/context.js +26 -12
  138. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  139. package/dist/components/tt-table/src/utils/table-api.js +200 -165
  140. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  141. package/dist/components/tt-table/src/utils/table-form-api.js +35 -23
  142. package/dist/components/tt-text/index.js +4 -3
  143. package/dist/components/tt-upload/index.js +6 -5
  144. package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
  145. package/dist/components/types.d.ts +0 -20
  146. package/dist/directives/disabled-tip/index.js +9 -8
  147. package/dist/hooks/useFormSchemasLink.js +4 -3
  148. package/dist/hooks/useFormat.d.ts +35 -71
  149. package/dist/hooks/useFormat.js +28 -39
  150. package/dist/hooks/usePanelSelectSchemas.js +4 -3
  151. package/dist/hooks/useScreenshotOss.js +16 -15
  152. package/dist/hooks/useSetup.js +0 -3
  153. package/dist/packages/hooks/src/useDebounce.js +6 -5
  154. package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
  155. package/dist/packages/hooks/src/usePriorityValue.js +5 -4
  156. package/dist/packages/utils/src/format.js +48 -0
  157. package/dist/packages/utils/src/is.js +20 -18
  158. package/dist/packages/utils/src/tool.js +76 -149
  159. package/dist/plugins/default/renderCellContent.js +4 -3
  160. package/dist/plugins/vxeTable/switchStatus.js +14 -13
  161. package/dist/style.css +1 -1
  162. package/package.json +3 -3
  163. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  164. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  165. package/dist/components/tt-table/src/enum.d.ts +0 -2
  166. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  167. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  168. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  169. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  170. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  171. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  172. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  173. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  174. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  175. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  176. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  177. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  178. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  179. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  180. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  181. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  182. package/dist/packages/utils/src/check.js +0 -10
@@ -1,84 +1,109 @@
1
- import { isArray as b } from "lodash-es";
2
- import { ref as f, computed as I, unref as o, toValue as A } from "vue";
3
- function B(u, l, n) {
4
- const s = f([]), h = f([]), k = I(() => {
5
- const { showCheckbox: e, showRadio: c } = o(u), t = A(s);
6
- return e ? t : c ? t ? [t] : [] : [];
1
+ import { GlobalConfig as M } from "../../../../hooks/useSetup.js";
2
+ import "axios";
3
+ import "element-plus";
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";
6
+ import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
9
+ import "dayjs/plugin/utc";
10
+ import "dayjs/plugin/timezone";
11
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
+ import "lodash-es";
17
+ function oe(R, r, i, d) {
18
+ const { getRowKey: h } = d, a = S([]), k = S([]), K = P(() => {
19
+ const { showCheckbox: e, showRadio: o } = t(R), c = V(a);
20
+ return e ? c || [] : o ? c ? [c] : [] : [];
7
21
  });
8
- function i() {
9
- return o(s);
22
+ function x() {
23
+ return t(a);
10
24
  }
11
- function a() {
12
- const { showCheckbox: e, showRadio: c } = o(u);
13
- return e ? o(n).getCheckboxRecords(!0) : c ? o(n).getRadioRecord(!0) : [];
25
+ function v() {
26
+ var n, s, w;
27
+ const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
28
+ if (e) {
29
+ const C = ((n = t(r)) == null ? void 0 : n.getCheckboxRecords(!0)) || [];
30
+ if (!c) return C;
31
+ const g = ((s = t(r)) == null ? void 0 : s.getCheckboxReserveRecords(!0)) || [], f = /* @__PURE__ */ new Map();
32
+ return C.forEach((l) => f.set(h(l), l)), g.forEach((l) => {
33
+ const b = h(l);
34
+ f.has(b) || f.set(b, l);
35
+ }), [...f.values()];
36
+ }
37
+ return o ? (w = t(r)) == null ? void 0 : w.getRadioRecord(!0) : [];
38
+ }
39
+ function A() {
40
+ var e;
41
+ return ((e = t(r)) == null ? void 0 : e.getTableData().fullData) || [];
14
42
  }
15
- function r(e) {
16
- const { tableRowId: c } = o(u);
17
- h.value = a(), s.value = o(h).map((t) => t[c || "id"]), l("selection-change", {
18
- keys: i(),
19
- rows: a(),
20
- data: e
21
- });
43
+ function u(e) {
44
+ const o = v();
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 });
22
46
  }
23
- const C = (e) => {
24
- r(e), l("checkbox-change", e);
25
- }, v = (e) => {
26
- r(e), l("checkbox-all", e);
47
+ const B = (e) => {
48
+ u(e), i("checkbox-change", e);
49
+ }, E = (e) => {
50
+ u(e), i("checkbox-all", e);
27
51
  }, y = (e) => {
28
- l("checkbox-range-change", e);
29
- const { records: c } = e;
30
- c && c.length === 1 || r(e);
31
- }, d = async (e, c = []) => {
32
- const { tableRowId: t, showCheckbox: w, showRadio: R } = o(u);
33
- h.value = e, w && (b(c) && c.length === 0 && b(e) && e.length !== 0 && (c = e.map((g) => g[t || "id"])), s.value = c, o(n) && await o(n).setCheckboxRow(e, !0)), R && (e = e, s.value = e[t || "id"], o(n) && await o(n).setRadioRow(e)), setTimeout(() => {
34
- l("selection-change", {
35
- keys: i(),
36
- rows: a()
37
- });
38
- }, 200);
39
- }, S = () => {
40
- const { showCheckbox: e, showRadio: c } = o(u);
41
- e && (s.value = [], h.value = [], o(n) && o(n).clearCheckboxRow(), l("selection-change", {
42
- keys: i(),
43
- rows: a()
44
- })), c && (s.value = void 0, h.value = void 0, o(n) && o(n).clearRadioRow());
52
+ var o;
53
+ i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && u(e);
45
54
  };
46
- async function x(e) {
47
- const { rows: c, cols: t } = e;
48
- if (c.length !== 1 && o(n) && t.some((w) => w.type === "checkbox")) {
49
- const w = o(n).isCheckedByCheckboxRow(c[0]);
50
- await o(n).setCheckboxRow(c, !w);
51
- const { tableRowId: R } = o(u);
52
- h.value = a(), s.value = o(h).map((g) => g[R || "id"]), l("selection-change", {
53
- keys: i(),
54
- rows: a(),
55
- data: e
56
- });
57
- }
55
+ function T(e) {
56
+ 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 });
57
+ }
58
+ async function D(e) {
59
+ const { rows: o, cols: c } = e;
60
+ if (o.length === 1) return;
61
+ const n = t(r);
62
+ !n || !c.some((s) => s.type === "checkbox") || (await n.setCheckboxRow(o, !n.isCheckedByCheckboxRow(o[0])), u(e));
58
63
  }
59
- function K(e) {
60
- var c, t;
61
- h.value = e.row, s.value = (t = e.row) == null ? void 0 : t[((c = o(u)) == null ? void 0 : c.tableRowId) || "id"], l("radio-change", e), l("selection-change", {
62
- keys: i(),
63
- rows: a(),
64
- data: e
65
- });
64
+ const F = (e) => {
65
+ var n;
66
+ const { checkboxConfig: o, showCheckbox: c } = t(R);
67
+ o != null && o.range && c ? y({ records: e.rows }) : (n = M.table) != null && n.isAreaCheckboxSelection && D(e), i("cell-area-selection-end", e);
68
+ };
69
+ async function G(e, o = []) {
70
+ var f, l;
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();
76
+ }
77
+ function p() {
78
+ var n, s, w;
79
+ const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
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() }));
81
+ }
82
+ function L() {
83
+ const { showCheckbox: e, reserveSelection: o } = t(R);
84
+ if (!e || !o) {
85
+ p();
86
+ return;
87
+ }
88
+ u();
66
89
  }
67
90
  return {
68
- selectedKeys: s,
69
- selectedRows: h,
70
- setSelectedRowKeys: d,
71
- onCellAreaSelectionEndSetCheckbox: x,
72
- clearSelectedRowKeys: S,
73
- onCheckboxChange: C,
74
- onCheckboxAll: v,
75
- getSelectRowKeys: i,
76
- getSelectRows: a,
91
+ selectedKeys: a,
92
+ selectedRows: k,
93
+ selectedKeyList: K,
94
+ getSelectRowKeys: x,
95
+ getSelectRows: v,
96
+ syncSelection: u,
97
+ setSelectedRowKeys: G,
98
+ clearSelectedRowKeys: p,
99
+ resetSelectionAfterFetch: L,
100
+ onCheckboxChange: B,
101
+ onCheckboxAll: E,
77
102
  onCheckboxRangeChange: y,
78
- onRadioChange: K,
79
- getCheckboxSelectedKeys: k
103
+ onRadioChange: T,
104
+ onCellAreaSelectionEnd: F
80
105
  };
81
106
  }
82
107
  export {
83
- B as useRowSelection
108
+ oe as useRowSelection
84
109
  };
@@ -1,11 +1,19 @@
1
+ import { ComputedRef, Ref, nextTick } from 'vue';
1
2
  import { VxeGridInstance } from 'vxe-table';
2
- import { TtTableLeftRightRowNode, TtTableProps } from '../types/table';
3
3
  import { Recordable } from '../../../../../../utils/src';
4
- import { ComputedRef, Ref } from 'vue';
5
- export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xGridRef: Ref<VxeGridInstance<Recordable>>, tableData: Ref<Recordable[]>): {
6
- handleLeftRightSlotScroll: (scrollTop?: number) => Promise<void>;
7
- handleLeftRightSlotInit: (isScrollInit?: boolean) => Promise<void>;
8
- leftRightSlotRows: Ref<{
4
+ import { TtTableLeftRightRowNode, TtTableProps } from '../types/table';
5
+ /**
6
+ * 表格左右两侧自定义插槽
7
+ *
8
+ * 通过读取 vxe 的 body DOM 尺寸,让两侧插槽与表格行保持同高、同步滚动。
9
+ * @param propsRef 表格 props
10
+ * @param grid vxe-grid 实例
11
+ * @param rows 当前表格数据
12
+ */
13
+ export declare function useSideSlot(propsRef: ComputedRef<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, rows: Ref<Recordable[]>): {
14
+ refresh: (resetScroll?: boolean) => Promise<void>;
15
+ syncScroll: (scrollTop?: number) => Promise<void>;
16
+ rowNodes: Ref<{
9
17
  offsetTop?: number | undefined;
10
18
  rowid?: string | undefined;
11
19
  item?: any;
@@ -20,8 +28,12 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
20
28
  index?: number | undefined;
21
29
  parent?: any;
22
30
  }[]>;
23
- tableHeaderHight: import('vue').ShallowRef<number, number>;
24
- leftSlotScrollbarRef: Ref<({
31
+ headerHeight: import('vue').ShallowRef<number, number>;
32
+ bodyHeight: import('vue').ShallowRef<number, number>;
33
+ bodyWrapperHeight: import('vue').ShallowRef<number, number>;
34
+ bodyOffsetTop: import('vue').ShallowRef<number, number>;
35
+ bodyScrollHeight: import('vue').ShallowRef<number, number>;
36
+ leftScrollbarRef: Ref<({
25
37
  $: import('vue').ComponentInternalInstance;
26
38
  $data: {};
27
39
  $props: {
@@ -116,7 +128,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
116
128
  errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
117
129
  };
118
130
  $forceUpdate: () => void;
119
- $nextTick: typeof import('vue').nextTick;
131
+ $nextTick: typeof nextTick;
120
132
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
121
133
  } & Readonly<{
122
134
  tabindex: number | string;
@@ -244,7 +256,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
244
256
  errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
245
257
  };
246
258
  $forceUpdate: () => void;
247
- $nextTick: typeof import('vue').nextTick;
259
+ $nextTick: typeof nextTick;
248
260
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
249
261
  } & Readonly<{
250
262
  tabindex: number | string;
@@ -278,7 +290,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
278
290
  default?: (props: {}) => any;
279
291
  };
280
292
  }) | undefined>;
281
- rightSlotScrollbarRef: Ref<({
293
+ rightScrollbarRef: Ref<({
282
294
  $: import('vue').ComponentInternalInstance;
283
295
  $data: {};
284
296
  $props: {
@@ -373,7 +385,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
373
385
  errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
374
386
  };
375
387
  $forceUpdate: () => void;
376
- $nextTick: typeof import('vue').nextTick;
388
+ $nextTick: typeof nextTick;
377
389
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
378
390
  } & Readonly<{
379
391
  tabindex: number | string;
@@ -501,7 +513,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
501
513
  errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
502
514
  };
503
515
  $forceUpdate: () => void;
504
- $nextTick: typeof import('vue').nextTick;
516
+ $nextTick: typeof nextTick;
505
517
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
506
518
  } & Readonly<{
507
519
  tabindex: number | string;
@@ -535,8 +547,4 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
535
547
  default?: (props: {}) => any;
536
548
  };
537
549
  }) | undefined>;
538
- tableBodyHeight: import('vue').ShallowRef<number, number>;
539
- tableBodyWrapHeight: import('vue').ShallowRef<number, number>;
540
- tableBodyScrollTop: import('vue').ShallowRef<number, number>;
541
- tableBodyScrollHeight: import('vue').ShallowRef<number, number>;
542
550
  };
@@ -0,0 +1,78 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isUndefined as A, isServer as T } from "../../../../packages/utils/src/is.js";
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 "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
8
+ import "dayjs/plugin/utc";
9
+ import "dayjs/plugin/timezone";
10
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
+ import "lodash-es";
16
+ function V(c, s, N) {
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();
18
+ function q() {
19
+ return new Promise((r) => {
20
+ let e = !1, o;
21
+ const n = (l) => {
22
+ e || (e = !0, a.delete(i), r(l));
23
+ }, i = () => {
24
+ e || (e = !0, !A(o) && !T && window.cancelAnimationFrame(o), a.delete(i), r(!1));
25
+ };
26
+ a.add(i), k(() => {
27
+ if (!e) {
28
+ if (T || !window.requestAnimationFrame) {
29
+ n(!0);
30
+ return;
31
+ }
32
+ o = window.requestAnimationFrame(() => n(!0));
33
+ }
34
+ });
35
+ });
36
+ }
37
+ async function x(r) {
38
+ var o, n, i, l;
39
+ if (!t(f) || !await q()) return;
40
+ const e = (n = (o = t(s)) == null ? void 0 : o.$el) == null ? void 0 : n.querySelector(".vxe-table--body");
41
+ e && (m.value = e.clientHeight, y.value = Number.parseFloat(e.style.marginTop) || 0, v.value = Array.from(e.querySelectorAll(".vxe-body--row")).map((H) => {
42
+ var F;
43
+ return {
44
+ ...(F = t(s)) == null ? void 0 : F.getRowNode(H),
45
+ offsetTop: H.offsetTop
46
+ };
47
+ }), !A(r) && ((i = t(w)) == null || i.scrollTo({ top: r }), (l = t(g)) == null || l.scrollTo({ top: r })));
48
+ }
49
+ async function S(r = !0) {
50
+ var o, n, i, l;
51
+ if (!t(f) || !await q()) return;
52
+ const e = (o = t(s)) == null ? void 0 : o.$el;
53
+ d.value = ((n = e == null ? void 0 : e.querySelector(".vxe-table--body-wrapper")) == null ? void 0 : n.clientHeight) || 0, p.value = ((i = e == null ? void 0 : e.querySelector(".vxe-table--header")) == null ? void 0 : i.clientHeight) || 0, h.value = Number.parseFloat((l = e == null ? void 0 : e.querySelector(".vxe-body--y-space")) == null ? void 0 : l.style.height) || 0, x(r ? 0 : void 0);
54
+ }
55
+ return W(N, () => S()), W([() => t(c).leftSlotWidth, () => t(c).rightSlotWidth], () => {
56
+ if (t(f)) {
57
+ S();
58
+ return;
59
+ }
60
+ d.value = 0, m.value = 0, p.value = 0, y.value = 0, h.value = 0, v.value = [];
61
+ }), R(() => {
62
+ a.forEach((r) => r()), a.clear();
63
+ }), {
64
+ refresh: S,
65
+ syncScroll: x,
66
+ rowNodes: v,
67
+ headerHeight: p,
68
+ bodyHeight: m,
69
+ bodyWrapperHeight: d,
70
+ bodyOffsetTop: y,
71
+ bodyScrollHeight: h,
72
+ leftScrollbarRef: w,
73
+ rightScrollbarRef: g
74
+ };
75
+ }
76
+ export {
77
+ V as useSideSlot
78
+ };
@@ -0,0 +1,12 @@
1
+ import { Recordable } from '../../../../../../utils/src';
2
+ /**
3
+ * 将父组件显式传入的 props 同步到内部 store。
4
+ *
5
+ * 配置项按 key 建立独立 watcher,外部变化时直接写入对应 key,不保存快照,也不做
6
+ * 内容快照或其他比较。这样内部 API 对 store 的改动不会被无关的父组件更新覆盖,
7
+ * v-model、data 与 columns 也不会被配置 watcher 深度遍历。
8
+ * @param props 组件 props
9
+ * @param setState store 写入方法
10
+ * @param exclude 不参与同步的 props
11
+ */
12
+ export declare function useSyncProps(props: Recordable, setState: (state: Recordable) => void, exclude?: string[]): void;
@@ -0,0 +1,56 @@
1
+ import { kebabToCamelCase as a } from "../../../../packages/utils/src/string.js";
2
+ import "axios";
3
+ import "element-plus";
4
+ import { isObject as h, isArray as b } from "../../../../packages/utils/src/is.js";
5
+ import { getCurrentInstance as P, watch as p, toValue as g } from "vue";
6
+ import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
9
+ import "dayjs/plugin/utc";
10
+ import "dayjs/plugin/timezone";
11
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
+ import "lodash-es";
17
+ const f = ["data"], j = ["columns"];
18
+ function D(t, m, l = []) {
19
+ var c;
20
+ const i = P();
21
+ function u(o) {
22
+ var s;
23
+ const r = ((s = i == null ? void 0 : i.vnode) == null ? void 0 : s.props) || {};
24
+ return Object.keys(r).some((d) => a(d) === o);
25
+ }
26
+ const e = Array.from(
27
+ new Set(
28
+ Object.keys(((c = i == null ? void 0 : i.vnode) == null ? void 0 : c.props) || {}).map(a).filter((o) => !o.startsWith("on") && o in t).filter((o) => !l.includes(o) && !f.includes(o))
29
+ )
30
+ ), n = {};
31
+ e.forEach((o) => {
32
+ n[o] = t[o];
33
+ }), Object.keys(n).length && m(n), e.forEach((o) => {
34
+ p(
35
+ () => t[o],
36
+ (r) => m({ [o]: r }),
37
+ // 逐 key 写入是「内部改动不被父组件覆盖」的必要条件,不能合并成一个 deep watcher:
38
+ // 合并后任意一个配置变化都会整包回写,把内部通过 setState 改过的其他 key 冲掉。
39
+ { deep: !j.includes(o) && (h(t[o]) || b(t[o])) }
40
+ );
41
+ }), f.forEach((o) => {
42
+ p(
43
+ [() => t[o], () => {
44
+ var r;
45
+ return (r = g(t[o])) == null ? void 0 : r.length;
46
+ }],
47
+ ([r]) => {
48
+ u(o) && m({ [o]: r });
49
+ },
50
+ { immediate: !0 }
51
+ );
52
+ });
53
+ }
54
+ export {
55
+ D as useSyncProps
56
+ };
@@ -0,0 +1,71 @@
1
+ import { MaybeRefOrGetter, ModelRef, Ref } from 'vue';
2
+ import { VxeGridInstance } from 'vxe-table';
3
+ import { Recordable } from '../../../../../../utils/src';
4
+ import { TtTableProps } from '../types/table';
5
+ import { RowsCommitSource } from '../table-mutation-events';
6
+ /** 表格数据相关事件 */
7
+ type DataEmit = {
8
+ (e: "load-data"): void;
9
+ };
10
+ /** 判断当前异步落表任务是否仍可提交。 */
11
+ type RowsCommitGuard = () => boolean;
12
+ /** 表格数据源的独立 store 选择器,避免无关配置变化触发数据监听。 */
13
+ type TableDataSources = {
14
+ api: MaybeRefOrGetter<TtTableProps["api"] | undefined>;
15
+ data: MaybeRefOrGetter<TtTableProps["data"] | undefined>;
16
+ /** 数据进入 VXE 前的行身份预处理。 */
17
+ prepareRows?: (rows: Recordable | Recordable[]) => void;
18
+ /** 通过公开实例调用 VXE 选中方法后,重新读取选中态。 */
19
+ onSelectionMutated?: () => void;
20
+ };
21
+ /** VXE 方法调用的统一类型。 */
22
+ type TableDataOperation<T> = () => Promise<T> | T;
23
+ /**
24
+ * 读取外部传入的表格数据源的当前值。
25
+ *
26
+ * 表格内部的数据源可能来自一个 getter,也可能是 `data: ref(rows)`。
27
+ * 先读取外层 MaybeRefOrGetter,再显式处理 getter 返回的 Ref,避免在业务逻辑中出现
28
+ * 隐晦的嵌套 `toValue`。空数组是有效数据,只有外层数据源不存在时才返回 undefined。
29
+ * @param source 外层数据源
30
+ */
31
+ export declare function getExternalRowsValue(source: MaybeRefOrGetter<TtTableProps["data"] | undefined>): undefined | Recordable[];
32
+ /**
33
+ * 在操作前后保留树形展开状态
34
+ * @param grid vxe-grid 实例
35
+ * @param reserve 是否需要保留(treeConfig.reserve)
36
+ * @param handler 需要执行的操作
37
+ * @param guard 操作完成后是否仍允许恢复展开状态
38
+ */
39
+ export declare function withTreeExpand<T>(grid: undefined | VxeGridInstance<Recordable>, reserve: boolean | undefined, handler: () => Promise<T> | T, guard?: () => boolean): Promise<T>;
40
+ /**
41
+ * 表格数据落表的唯一出口
42
+ *
43
+ * 外部 data / v-model 只经由 loadRows 写入 vxe-grid;请求结果和表格内部操作再通过 emitRows 回写 v-model,
44
+ * 避免把输入和输出混在同一条链路里。
45
+ *
46
+ * 外部数据的变化监听只追踪到「行引用」这一层,不进入行对象内部做字段对比:
47
+ * 表格写回时附加一次内部事件版本,外部原样传回时消费版本并跳过重复落表;
48
+ * 换数组、增删行、整行替换都会重新落表,只改行内字段不会 ——
49
+ * 行对象与外部共享,改字段单元格会自己更新,无需重新落表。
50
+ * @param propsRef 表格 props
51
+ * @param grid vxe-grid 实例
52
+ * @param modelValue v-model 数据
53
+ * @param emit 组件 emit
54
+ * @param sources 从 store 独立选择的数据与接口来源
55
+ */
56
+ export declare function useTableData(propsRef: Ref<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, modelValue: ModelRef<Recordable[] | undefined>, emit: DataEmit, sources: TableDataSources): {
57
+ rows: import('vue').ShallowRef<Recordable[], Recordable[]>;
58
+ loadRows: (nextRows: Recordable[], guard?: RowsCommitGuard) => Promise<boolean>;
59
+ applyRows: (nextRows: Recordable[], guard?: RowsCommitGuard) => Promise<boolean>;
60
+ emitRows: (nextRows: Recordable[]) => void;
61
+ getDataSource: <T = Recordable>() => T[];
62
+ runDataOperation: <T>(operation: TableDataOperation<T>, source?: RowsCommitSource) => Promise<T>;
63
+ scheduleRowsCommit: (source?: RowsCommitSource) => void;
64
+ cancelRowsCommit: () => void;
65
+ onDataChange: () => void;
66
+ commitRows: (source?: RowsCommitSource) => boolean;
67
+ createTableInstanceFacade: (instance: undefined | VxeGridInstance<Recordable>) => VxeGridInstance<Recordable> | undefined;
68
+ /** 判断表格作用域是否仍然有效。 */
69
+ isActive: () => boolean;
70
+ };
71
+ export {};