@dazhicheng/ui 1.5.265 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/components/tt-area/TtArea.vue.js +1 -1
  2. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  3. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  4. package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
  5. package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  7. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
  8. package/dist/components/tt-icon/index.vue.js +2 -2
  9. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  10. package/dist/components/tt-modal-form/index.vue.js +13 -12
  11. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  12. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
  13. package/dist/components/tt-panel-select/src/index.vue.js +1 -0
  14. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  15. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  16. package/dist/components/tt-table/index.d.ts +523 -358
  17. package/dist/components/tt-table/index.js +7 -4
  18. package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
  19. package/dist/components/tt-table/src/Table.vue.js +405 -618
  20. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  21. package/dist/components/tt-table/src/TableForm.vue.js +219 -228
  22. package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
  23. package/dist/components/tt-table/src/components/TableButtons.js +25 -25
  24. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
  25. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  26. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
  27. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  28. package/dist/components/tt-table/src/emits.js +2 -1
  29. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  30. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
  31. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  32. package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
  33. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  34. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  35. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  36. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
  37. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  38. package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
  39. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  40. package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
  41. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  42. package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
  43. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
  44. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
  45. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  46. package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
  47. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  48. package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
  49. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  50. package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
  51. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  52. package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
  53. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  54. package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
  55. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  56. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  57. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
  58. package/dist/components/tt-table/src/props.d.ts +318 -151
  59. package/dist/components/tt-table/src/props.js +117 -270
  60. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  61. package/dist/components/tt-table/src/table-defaults.js +71 -0
  62. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  63. package/dist/components/tt-table/src/table-mutation-events.js +70 -0
  64. package/dist/components/tt-table/src/types/table.d.ts +207 -88
  65. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  66. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  67. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  68. package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
  69. package/dist/components/tt-table/src/utils/context.js +25 -12
  70. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  71. package/dist/components/tt-table/src/utils/table-api.js +198 -165
  72. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  73. package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
  74. package/dist/components/types.d.ts +0 -20
  75. package/dist/hooks/useSetup.js +0 -3
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +105 -101
  78. package/dist/packages/hooks/src/useDebounce.js +6 -6
  79. package/dist/packages/utils/src/is.js +20 -18
  80. package/dist/packages/utils/src/tool.js +76 -149
  81. package/dist/style.css +1 -1
  82. package/dist/utils/uppercaseInput.d.ts +29 -0
  83. package/dist/utils/uppercaseInput.js +16 -0
  84. package/package.json +3 -3
  85. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  86. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  87. package/dist/components/tt-table/src/enum.d.ts +0 -2
  88. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  89. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  90. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  91. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  92. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  93. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  94. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  95. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  96. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  97. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  98. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  99. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  100. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  101. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  102. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  103. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  104. package/dist/packages/utils/src/check.js +0 -10
@@ -1,282 +1,137 @@
1
+ import { GlobalConfig as W } from "../../../../hooks/useSetup.js";
1
2
  import "axios";
2
- import { ElMessage as G } from "element-plus";
3
+ import "element-plus";
4
+ import { isBoolean as _, isFunction as j, isArray as q, isString as G } from "../../../../packages/utils/src/is.js";
5
+ import { ref as K, shallowRef as U, computed as d, unref as o, watch as I, toValue as X, nextTick as O, onScopeDispose as H } from "vue";
6
+ import J from "xe-utils";
3
7
  import "dayjs";
4
- import { ref as x, shallowRef as Y, computed as T, unref as n, watch as E, toValue as R, watchEffect as ee, onUnmounted as ne, nextTick as te } from "vue";
5
- import { calcWordsWidth as oe } from "../../../../packages/utils/src/tool.js";
8
+ import "dayjs/plugin/utc";
9
+ import "dayjs/plugin/timezone";
6
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
7
11
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
8
12
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
9
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
10
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
11
- import { isEqual as U, debounce as B, cloneDeep as L, flattenDeep as le, isArray as ie, isFunction as se } from "lodash-es";
12
- import { GlobalConfig as ue } from "../../../../hooks/useSetup.js";
13
- function S(e) {
14
- var u;
15
- const s = L(e || []);
16
- for (let t = 0; t < (e || []).length; t++) {
17
- const i = e[t];
18
- i != null && i.slots && (s[t].slots = { ...i.slots }), i != null && i.children && ((u = s[t]) != null && u.children) && (s[t].children = S(i.children));
19
- }
20
- return s;
21
- }
22
- function ce(e) {
23
- const {
24
- showCheckbox: s,
25
- showIndex: u,
26
- showExpand: t,
27
- showRadio: i,
28
- indexColumnProps: h,
29
- checkboxColumnProps: b,
30
- expandColumnProps: W,
31
- radioColumnProps: C
32
- } = n(e), a = [];
33
- return u && a.unshift({
34
- type: "seq",
35
- title: "序号",
36
- width: 48,
37
- resizable: !1,
38
- align: "center",
39
- fixed: "left",
40
- ...h
41
- }), i && a.unshift({
42
- type: "radio",
43
- width: 48,
44
- resizable: !1,
45
- align: "center",
46
- fixed: "left",
47
- ...C
48
- }), s && a.unshift({
49
- type: "checkbox",
50
- width: 48,
51
- resizable: !1,
52
- align: "center",
53
- fixed: "left",
54
- ...b
55
- }), t && a.push({
15
+ import "lodash-es";
16
+ const v = { resizable: !1, align: "center", fixed: "left" };
17
+ function L(e) {
18
+ const i = [], { showCheckbox: s, showIndex: r, showExpand: u, showRadio: m } = e;
19
+ return r && i.unshift({ type: "seq", title: "序号", width: 48, ...v, ...e.indexColumnProps }), m && i.unshift({ type: "radio", width: 48, ...v, ...e.radioColumnProps }), s && i.unshift({ type: "checkbox", width: 48, ...v, ...e.checkboxColumnProps }), u && i.push({
56
20
  type: "expand",
57
21
  width: 20,
58
- resizable: !1,
59
- align: "center",
60
- fixed: "left",
22
+ ...v,
61
23
  padding: !1,
62
24
  slots: { content: "expand-content" },
63
- ...W
64
- }), a;
25
+ ...e.expandColumnProps
26
+ }), i;
65
27
  }
66
- function re(e) {
67
- const { showAction: s, actionProps: u, actionWidth: t, actionTitle: i } = n(e);
68
- return s ? [
28
+ function M(e) {
29
+ const { showAction: i, actionProps: s, actionWidth: r, actionTitle: u } = e;
30
+ return i ? [
69
31
  {
70
32
  field: "action",
71
- title: i || "操作",
72
- width: t,
33
+ title: u || "操作",
34
+ width: r,
73
35
  resizable: !1,
74
36
  fixed: "right",
75
37
  showOverflow: !1,
76
38
  slots: { default: "action" },
77
- ...u
39
+ ...s
78
40
  }
79
41
  ] : [];
80
42
  }
81
- function de(e, s) {
82
- const u = (t, i) => {
83
- if (t.sortable && i) {
84
- const h = `${t.field}_header`;
85
- return s.value.push(h), Object.assign(t, {
86
- slots: {
87
- ...t.slots,
88
- header: h
89
- }
90
- });
91
- }
92
- return t;
43
+ function P(e, i) {
44
+ const s = /* @__PURE__ */ new Set(), r = (u) => {
45
+ u.forEach((m) => {
46
+ var w, f;
47
+ const x = (w = m.slots) == null ? void 0 : w[i];
48
+ G(x) && s.add(x), (f = m.children) != null && f.length && r(m.children);
49
+ });
93
50
  };
94
- return e.children && (e.children = e.children.map((t) => u(t, !1))), u(e, e.field !== "action");
95
- }
96
- function ae(e, s, u) {
97
- if (u.value.length) {
98
- const i = e.editRender && u.value.includes(e.field || "") ? `${e.field}_Valid` : void 0;
99
- return i ? (s.value.push(i), Object.assign(e, {
100
- slots: {
101
- ...e.slots,
102
- valid: i
103
- }
104
- })) : e;
105
- }
106
- return e;
51
+ return r(e), [...s];
107
52
  }
108
- function he(e) {
109
- const u = document.getElementsByTagName("body")[0], t = window.getComputedStyle(u).fontFamily;
110
- return e.minWidth = e.minWidth === "auto" ? (oe(e.title, "12px", t) + 60).toFixed(0) : e.minWidth, e;
111
- }
112
- function fe({
113
- propsRef: e,
114
- item: s,
115
- validSolts: u,
116
- titleSolts: t,
117
- validRulesKeys: i
118
- // httpFieldSolts,
119
- // httpFieldEditSolts,
120
- }) {
121
- var g;
122
- const { columnsFieldSort: h, columnsFieldNoSort: b, isCellSort: W, isCellResize: C, customizeColumn: a } = n(e);
123
- let p = W;
124
- h.length > 0 && (p = h.includes(s.field)), b.length > 0 && (p = !b.includes(s.field));
125
- let d = {
126
- minWidth: 80,
127
- sortable: p,
128
- resizable: C,
129
- ...s
130
- };
131
- const m = a || ((g = ue.table) == null ? void 0 : g.customizeColumn);
132
- return m && se(m) && (d = m(d)), d = de(d, t), d = ae(d, u, i), d = he(d), d;
53
+ function T(e) {
54
+ return e.some(
55
+ (i) => {
56
+ var s;
57
+ return i.type === "expand" || !!((s = i.children) != null && s.length) && T(i.children);
58
+ }
59
+ );
133
60
  }
134
- function Pe(e, {
135
- xGrid: s,
136
- tableWidth: u
137
- }, t) {
138
- const i = x([]), h = x([]), b = x([]), W = x([]), C = x([]), a = x([]), p = Y(!0), d = x(!1);
139
- let m = null, g = [];
140
- function j(l) {
141
- var c;
142
- const o = { ...l };
143
- return (c = o.children) != null && c.length && (o.children = o.children.map((v) => j(v))), fe({
144
- propsRef: e,
145
- item: o,
146
- titleSolts: h,
147
- validSolts: b,
148
- validRulesKeys: W
149
- // httpFieldSolts,
150
- // httpFieldEditSolts,
151
- });
152
- }
153
- const q = T(() => {
154
- const l = S(n(i));
155
- return l ? l.map((c) => j(c)) : [];
156
- }), H = () => ({
157
- leftColumn: n(C),
158
- actionColumn: n(a)
61
+ function at(e, i, s) {
62
+ const r = K([]), u = U(!1), m = d(() => {
63
+ const { customizeColumn: t, editRules: l } = o(e);
64
+ return {
65
+ customizeColumn: t,
66
+ /** 需要展示校验插槽的字段 */
67
+ validFields: Object.keys(l || {})
68
+ };
69
+ }), x = d(() => {
70
+ const { columnsFieldSort: t = [], columnsFieldNoSort: l = [], isCellSort: a } = o(e);
71
+ return { columnsFieldSort: t, columnsFieldNoSort: l, isCellSort: a };
159
72
  });
160
- function D(l) {
161
- const o = S(l);
162
- if (ie(o)) {
163
- if (o.length <= 0) {
164
- i.value = [];
165
- return;
166
- }
167
- i.value = g = o;
168
- }
73
+ function w(t) {
74
+ const { columnsFieldSort: l, columnsFieldNoSort: a, isCellSort: p } = o(x);
75
+ return a.length ? !a.includes(t) : l.length ? l.includes(t) : !!p;
169
76
  }
170
- function $() {
171
- return g;
77
+ function f(t, l = !1) {
78
+ var y, C;
79
+ const { customizeColumn: a, validFields: p } = o(m), S = _(t.sortable) ? t.sortable : w(t.field);
80
+ let n = { minWidth: 80, ...t, sortable: S };
81
+ (y = n.children) != null && y.length && (n.children = n.children.map((g) => f(g, !0)));
82
+ const c = a || ((C = W.table) == null ? void 0 : C.customizeColumn);
83
+ return j(c) && (n = c(n)), !l && n.sortable && n.field !== "action" && (n.slots = { ...n.slots, sort: `${n.field}_sort` }), n.editRender && p.includes(n.field || "") && (n.slots = { ...n.slots, valid: `${n.field}_Valid` }), n;
172
84
  }
173
- function N(l) {
174
- te(() => {
175
- const o = n(s);
176
- o && o.reloadColumn(le(l));
177
- });
85
+ const F = d(() => L(o(e))), k = d(() => M(o(e))), N = d(() => o(r).map((t) => f(t))), h = d(() => [...o(F), ...o(N), ...o(k)]), A = d(() => T(o(h))), D = d(() => P(o(h), "sort")), $ = d(() => P(o(h), "valid"));
86
+ function z(t) {
87
+ q(t) && (r.value = t.length ? J.clone(t, !0) : []);
178
88
  }
179
- function V(l) {
180
- m || (m = n(s).$el.querySelector(".vxe-table--scroll-y-virtual"));
181
- const o = [...n(C), ...n(a)], { column: c } = l, { tableColumn: v } = n(s).getTableColumn(), w = L(
182
- v.filter((r) => !o.map((f) => (f == null ? void 0 : f.type) || f.field).includes((r == null ? void 0 : r.type) || r.field))
183
- ), F = o.reduce((r, f) => r + (f.width || 0), 0), I = (n(u) || 0) - F, A = w.filter((r) => r.field !== c.field).reduce((r, f) => r + Number(f.renderWidth), 0), y = I - A;
184
- if (c.resizeWidth < y) {
185
- const r = (m == null ? void 0 : m.offsetWidth) || 0;
186
- c.resizeWidth = y - r, c.renderWidth = c.resizeWidth, n(s).setColumnWidth(w, c.resizeWidth), G.warning("不能小于拖动的最小宽度,会导致表格右侧空白");
187
- }
188
- const k = w == null ? void 0 : w.find((r) => r.field === c.field);
189
- k && (k.width = c.resizeWidth);
190
- }
191
- function J(l) {
192
- V(l), t("resizable-change", l);
89
+ function E() {
90
+ return o(r);
193
91
  }
194
- function K(l) {
195
- V(l), t("column-resizable-change", l);
196
- }
197
- function Q(l) {
198
- var _;
199
- d.value = !0;
200
- const o = [], { showAction: c, showCheckbox: v, showIndex: w, showRadio: F, showExpand: I } = n(e);
201
- c && o.push("action"), v && o.push("checkbox"), w && o.push("seq"), F && o.push("radio"), I && o.push("expand");
202
- const { collectColumn: A } = ((_ = l.$grid) == null ? void 0 : _.getTableColumn()) || { collectColumn: [] }, y = A.filter((P) => !o.includes(P.field) && !o.includes(P.type)), k = $();
203
- function r(P, X) {
204
- const M = [];
205
- return P.forEach((O) => {
206
- const z = X.find((Z) => Z.field === O.field);
207
- z && (O.children && z.children && (z.children = r(O.children, z.children)), M.push(z));
208
- }), M;
92
+ function B(t) {
93
+ var n;
94
+ u.value = !0;
95
+ const l = [
96
+ ...o(F).map((c) => c.type),
97
+ ...o(k).map((c) => c.field)
98
+ ], { collectColumn: a = [] } = ((n = t.$grid) == null ? void 0 : n.getTableColumn()) || {}, p = a.filter(
99
+ (c) => !l.includes(c.field) && !l.includes(c.type)
100
+ );
101
+ function S(c, y) {
102
+ const C = [];
103
+ return c.forEach((g) => {
104
+ const b = y.find((V) => V.field === g.field);
105
+ b && (g.children && b.children && (b.children = S(g.children, b.children)), C.push(b));
106
+ }), C;
209
107
  }
210
- const f = r(y, k);
211
- D(f), t("column-dragend", l);
108
+ z(S(p, E())), s("column-dragend", t), O(() => u.value = !1);
212
109
  }
213
- return E(
214
- T(() => R(n(e).columns)),
215
- (l, o) => {
216
- if (!U(l, o)) {
217
- const c = S(l || []);
218
- i.value = g = c || [];
219
- }
220
- },
221
- {
222
- deep: !0,
223
- immediate: !0
224
- }
225
- ), E(
226
- () => [C.value, q.value, a.value],
227
- (l, o) => {
228
- if (n(d))
229
- return d.value = !1, !1;
230
- p.value && (N(l), p.value = !1), U(l, o) || N(l);
231
- },
232
- { deep: !0 }
233
- ), ee(() => {
234
- n(e).editRules && (W.value = Object.keys(n(e).editRules));
235
- }), E(
236
- T(() => [
237
- n(e).showCheckbox,
238
- n(e).showRadio,
239
- n(e).showIndex,
240
- n(e).showExpand,
241
- n(e).indexColumnProps,
242
- n(e).checkboxColumnProps,
243
- n(e).radioColumnProps,
244
- n(e).expandColumnProps,
245
- n(e).isI18n
246
- ]),
247
- () => {
248
- C.value = ce(e);
249
- },
250
- {
251
- immediate: !0
252
- }
253
- ), E(
254
- T(() => [
255
- n(e).showAction,
256
- n(e).actionProps,
257
- n(e).actionWidth,
258
- n(e).isI18n
259
- ]),
260
- () => {
261
- a.value = re(e);
110
+ return I(
111
+ () => X(o(e).columns),
112
+ (t) => z(t || []),
113
+ { deep: !0, immediate: !0 }
114
+ ), I(
115
+ h,
116
+ (t) => {
117
+ o(u) || O(() => {
118
+ var l;
119
+ return (l = o(i)) == null ? void 0 : l.reloadColumn(t);
120
+ });
262
121
  },
263
- {
264
- immediate: !0
265
- }
266
- ), ne(() => {
267
- g = [];
122
+ { immediate: !0 }
123
+ ), H(() => {
124
+ r.value = [];
268
125
  }), {
269
- getColumnsRef: q,
270
- getFixedColums: H,
271
- titleSolts: h,
272
- validSolts: b,
273
- setTableColumns: D,
274
- getTableColumns: $,
275
- onResizableChange: B(J, 100),
276
- onColumnResizableChange: B(K, 100),
277
- onColumnDragend: Q
126
+ gridColumns: h,
127
+ hasExpandColumn: A,
128
+ sortIconSlots: D,
129
+ validSlots: $,
130
+ setTableColumns: z,
131
+ getTableColumns: E,
132
+ onColumnDragend: B
278
133
  };
279
134
  }
280
135
  export {
281
- Pe as useColumns
136
+ at as useColumns
282
137
  };
@@ -0,0 +1,36 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { VxeGridProps, VxeTablePropTypes } from 'vxe-table';
3
+ import { Recordable } from '../../../../../../utils/src';
4
+ import { TtTableProps } from '../types/table';
5
+ /** 表格数据桥接回调。 */
6
+ type GridPropsCallbacks = {
7
+ /** 当前最终列配置中是否存在展开列。 */
8
+ hasExpandColumn?: ComputedRef<boolean>;
9
+ /** 由列上 `summary` 声明生成的表尾合计方法,无声明时为 `undefined`。 */
10
+ footerSummaryMethod?: ComputedRef<undefined | VxeTablePropTypes.FooterMethod>;
11
+ /** 数据进入 VXE 前的行身份预处理。 */
12
+ prepareRows?: (rows: Recordable | Recordable[]) => void;
13
+ /** 将业务行配置转换为 VXE 使用的私有行身份配置。 */
14
+ toVxeRowConfig?: (rowConfig?: VxeTablePropTypes.RowConfig<Recordable>) => VxeTablePropTypes.RowConfig<Recordable>;
15
+ /** 树懒加载完成后的数据提交回调。 */
16
+ onTreeLoadResolved?: () => void;
17
+ };
18
+ /**
19
+ * vxe-grid 的绑定属性
20
+ *
21
+ * bindValues 是 tt-table 的完整配置(含自有 props),供模板与上下文读取;
22
+ * gridProps 是剔除自有 props 后真正透传给 vxe-grid 的属性,只依赖实际读取的响应式配置。
23
+ * @param propsRef 表格 props
24
+ * @param ctx 组件上下文
25
+ * @param ctx.attrs 组件 attrs
26
+ * @param ctx.slots 组件 slots
27
+ * @param callbacks 数据桥接回调
28
+ */
29
+ export declare function useGridProps(propsRef: ComputedRef<TtTableProps>, { attrs, slots }: {
30
+ attrs: Recordable;
31
+ slots: Recordable;
32
+ }, callbacks?: GridPropsCallbacks): {
33
+ bindValues: ComputedRef<TtTableProps>;
34
+ gridProps: ComputedRef<VxeGridProps<Recordable>>;
35
+ };
36
+ export {};
@@ -0,0 +1,121 @@
1
+ import { useTimeoutFn as H } from "@vueuse/core";
2
+ import { omit as y } from "lodash-es";
3
+ import { computed as b, unref as f } from "vue";
4
+ import { tableProps as L } from "../props.js";
5
+ const K = [...Object.keys(L), "modelValue", "data", "columns"], j = {
6
+ orders: ["desc", "asc", null],
7
+ trigger: "cell",
8
+ allowClear: !0,
9
+ showIcon: !0
10
+ };
11
+ function D(e) {
12
+ const { expandConfig: i, hasExpandColumn: t, treeConfig: o } = e;
13
+ return !(o && !o.transform || t && (i == null ? void 0 : i.mode) !== "fixed");
14
+ }
15
+ function F({
16
+ $table: e,
17
+ column: i
18
+ }) {
19
+ var d, h;
20
+ const t = (d = e == null ? void 0 : e.getEl) == null ? void 0 : d.call(e);
21
+ if (!t) return "auto";
22
+ const { visibleColumn: o = [] } = e.getTableColumn() || {}, a = o.reduce(
23
+ (r, n) => r + (n.id === i.id ? 0 : Number(n.renderWidth) || 0),
24
+ 0
25
+ ), c = ((h = t.querySelector(".vxe-table--scroll-y-virtual")) == null ? void 0 : h.offsetWidth) || 0, l = t.clientWidth - a - c;
26
+ return l > 0 ? l : "auto";
27
+ }
28
+ function B(e, { attrs: i, slots: t }, o = {}) {
29
+ const a = /* @__PURE__ */ new WeakMap(), { start: c } = H(() => {
30
+ var r;
31
+ return (r = o.onTreeLoadResolved) == null ? void 0 : r.call(o);
32
+ }, 0, {
33
+ immediate: !1
34
+ });
35
+ function l(r) {
36
+ const n = a.get(r);
37
+ if (n) return n;
38
+ const g = async (p) => {
39
+ var C;
40
+ const m = await r(p);
41
+ return (C = o.prepareRows) == null || C.call(o, m), c(), m;
42
+ };
43
+ return a.set(r, g), g;
44
+ }
45
+ const d = b(() => {
46
+ var M;
47
+ const {
48
+ checkboxConfig: r,
49
+ rowConfig: n,
50
+ columnConfig: g,
51
+ resizableConfig: p,
52
+ isCellResize: m,
53
+ showToolbar: C,
54
+ toolbarConfig: T = {},
55
+ showPager: W,
56
+ autoHeight: E,
57
+ virtualYConfig: w = {},
58
+ expandConfig: v = {},
59
+ treeConfig: s,
60
+ sortConfig: R,
61
+ showHeaderTooltip: z,
62
+ showCellTooltip: O,
63
+ showOverflow: V,
64
+ reserveSelection: Y,
65
+ footerMethod: _
66
+ } = f(e), u = {}, P = Object.hasOwn(w, "enabled") ? w.enabled : D({
67
+ expandConfig: v,
68
+ hasExpandColumn: f(o.hasExpandColumn),
69
+ treeConfig: s
70
+ }), S = ((M = o.toVxeRowConfig) == null ? void 0 : M.call(o, n)) || n, x = _ ? void 0 : f(o.footerSummaryMethod);
71
+ return C && (u.toolbarConfig = {
72
+ slots: t.toolbar_tools || t.toolbar_buttons ? {
73
+ tools: t.toolbar_tools ? "toolbar_tools" : void 0,
74
+ buttons: t.toolbar_buttons ? "toolbar_buttons" : void 0
75
+ } : void 0,
76
+ ...T
77
+ }), W || (u.pagerConfig = void 0), E && (u.height = "auto", u.autoResize = !0, u.syncResize = !0), {
78
+ // 去除 data 与 columns,避免与内部数据、列管理冲突
79
+ ...y(f(e), ["data", "columns"]),
80
+ ...u,
81
+ virtualYConfig: { enabled: P, mode: "wheel", ...w },
82
+ // 表头 tooltip 由 vxe 负责:开启时翻译成 showHeaderOverflow: "tooltip",
83
+ // 由它自己做溢出检测(scrollWidth > clientWidth)并弹层,样式走原生 headerTooltipConfig。
84
+ // 关闭时固定 false —— 一旦命中任意溢出值,vxe 会给表头单元格加 col--ellipsis 并把
85
+ // 内层 .vxe-cell 的高度从 minHeight 改成固定 height,表头高度算法就变了。
86
+ // 固定 false 也意味着调用方传入的 showHeaderOverflow 不参与判定,与改动前一致。
87
+ showHeaderOverflow: z ? "tooltip" : !1,
88
+ // 单元格 tooltip 同样交给 vxe,但与表头侧不对称:表头侧改动前无条件写死 false,
89
+ // 所以关闭时也固定 false;单元格侧改动前是原样透传,所以关闭时必须沿用原值,
90
+ // 否则会覆盖调用方传入的 showOverflow 与 GlobalConfig.table 的默认值。
91
+ showOverflow: O ? "tooltip" : V,
92
+ // 列宽调整由 column-config.resizable 统一控制,列上单独设置的 resizable 优先
93
+ // 排序交由 vxe 负责,组件只预置与改动前等价的交互口径
94
+ sortConfig: { ...j, ...R },
95
+ columnConfig: { useKey: !0, resizable: m, ...g },
96
+ rowConfig: { useKey: !0, isHover: !0, isCurrent: !1, ...S },
97
+ resizableConfig: { showDragTip: !0, minWidth: F, ...p },
98
+ // reserveSelection 开启时同时打开 vxe 的跨页保留存储,调用方显式配的 reserve 优先。
99
+ // 只有存储打开,useRowSelection 才能从 getCheckboxReserveRecords 读到跨页那部分。
100
+ // 关闭时不写 reserve 键,保持与改动前完全相同的配置对象(不覆盖 vxe 全局默认)。
101
+ checkboxConfig: { highlight: !1, ...Y ? { reserve: !0 } : {}, ...r },
102
+ expandConfig: {
103
+ padding: !0,
104
+ iconClose: "vxe-icon-caret-down",
105
+ iconOpen: "vxe-icon-caret-up",
106
+ ...v
107
+ },
108
+ treeConfig: s != null && s.loadMethod ? { ...s, loadMethod: l(s.loadMethod) } : s,
109
+ round: !0,
110
+ // 列上声明 summary 时自动开启表尾;没有任何列声明时不写这两个键,
111
+ // 表尾相关配置与改动前完全一致(vxe 的 showFooter 默认 false,表尾不渲染)。
112
+ ...x ? { showFooter: !0, footerMethod: x } : {},
113
+ // loading 由外层容器接管
114
+ loading: !1
115
+ };
116
+ }), h = b(() => y({ ...i, ...f(d) }, K));
117
+ return { bindValues: d, gridProps: h };
118
+ }
119
+ export {
120
+ B as useGridProps
121
+ };
@@ -0,0 +1,11 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * 表格键盘导航
4
+ *
5
+ * vxe 的固定列会被拆分到不同的 DOM 容器中,浏览器默认的 Tab 顺序会在固定列与
6
+ * 主体列之间来回跳;这里按视觉位置重排 Tab 顺序,并处理与表格外控件、相邻表格的衔接。
7
+ * @param wrapRef 表格容器
8
+ */
9
+ export declare function useKeyboardNav(wrapRef: Ref<null | HTMLElement>): {
10
+ onTableKeydown: (event: KeyboardEvent) => void;
11
+ };
@@ -0,0 +1,97 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isElement as O } from "../../../../packages/utils/src/is.js";
4
+ import { onMounted as C, onScopeDispose as N, nextTick as S } from "vue";
5
+ import "xe-utils";
6
+ import "dayjs";
7
+ import "dayjs/plugin/utc";
8
+ import "dayjs/plugin/timezone";
9
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
10
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
11
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
+ import "lodash-es";
15
+ const f = 'button:not([disabled]):not([tabindex="-1"]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])';
16
+ function b(i) {
17
+ const d = window.getComputedStyle(i);
18
+ return d.display !== "none" && d.visibility !== "hidden" && !!i.offsetParent;
19
+ }
20
+ function k(i) {
21
+ function d(t = i.value) {
22
+ const e = t == null ? void 0 : t.querySelector(".vxe-table");
23
+ return e ? Array.from(e.querySelectorAll(f)).filter(b).filter((n, r, o) => {
24
+ const s = n.closest('[class*="table-action"]');
25
+ if (!s) return !0;
26
+ const c = s.getBoundingClientRect();
27
+ return !o.some((l) => {
28
+ const u = l.closest('[class*="table-action"]');
29
+ if (!u || u === s) return !1;
30
+ const a = u.getBoundingClientRect();
31
+ return Math.abs(a.top - c.top) <= 2 && a.left > c.left;
32
+ });
33
+ }).sort((n, r) => {
34
+ const o = (n.closest(".vxe-body--column") || n).getBoundingClientRect(), s = (r.closest(".vxe-body--column") || r).getBoundingClientRect();
35
+ return Math.abs(o.top - s.top) > 2 ? o.top - s.top : Math.abs(o.left - s.left) > 2 ? o.left - s.left : n.getBoundingClientRect().top - r.getBoundingClientRect().top;
36
+ }) : [];
37
+ }
38
+ function x(t) {
39
+ const e = i.value;
40
+ if (!e) return;
41
+ const n = Array.from(document.querySelectorAll(f)).filter((r) => {
42
+ if (!b(r) || e.contains(r) || r.closest(".tt-table")) return !1;
43
+ const o = e.compareDocumentPosition(r);
44
+ return t ? !!(o & Node.DOCUMENT_POSITION_FOLLOWING) : !!(o & Node.DOCUMENT_POSITION_PRECEDING);
45
+ });
46
+ return t ? n[0] : n[n.length - 1];
47
+ }
48
+ function E(t) {
49
+ const e = i.value;
50
+ if (!e) return;
51
+ const n = Array.from(document.querySelectorAll(".tt-table")), r = n[n.indexOf(e) + (t ? 1 : -1)], o = r ? m(r) : [];
52
+ if (o.length)
53
+ return t ? o[0] : o[o.length - 1];
54
+ }
55
+ function T(t = i.value) {
56
+ return t ? Array.from(t.querySelectorAll(f)).filter(
57
+ (e) => !e.closest(".vxe-table") && b(e)
58
+ ) : [];
59
+ }
60
+ function m(t = i.value) {
61
+ return [...T(t), ...d(t)];
62
+ }
63
+ function y(t) {
64
+ if (t.key !== "Tab") return;
65
+ const e = t.target;
66
+ if (!O(e)) return;
67
+ const n = m(), r = e.closest(f), o = r ? n.indexOf(r) : -1;
68
+ if (o < 0) return;
69
+ const s = !t.shiftKey, c = x(s), l = E(s), u = c && l ? !!(c.compareDocumentPosition(l) & Node.DOCUMENT_POSITION_FOLLOWING) === s ? c : l : c || l, a = n[o + (s ? 1 : -1)] || u;
70
+ a && (t.preventDefault(), t.stopPropagation(), S(() => a.focus()));
71
+ }
72
+ function g(t) {
73
+ if (t.key !== "Tab") return;
74
+ const e = t.target, n = i.value;
75
+ if (!O(e) || !n) return;
76
+ const r = e.closest(".tt-table");
77
+ if (r && r !== n) return;
78
+ if (n.contains(e)) {
79
+ y(t);
80
+ return;
81
+ }
82
+ const o = e.closest(f);
83
+ if (!o) return;
84
+ const s = m(), c = t.shiftKey ? s[s.length - 1] : s[0];
85
+ if (!c) return;
86
+ const l = Array.from(document.querySelectorAll(f)).filter(
87
+ (p) => !p.closest('[class*="table-action"]') && b(p)
88
+ ), u = l.indexOf(o);
89
+ if (u < 0) return;
90
+ const a = l[u + (t.shiftKey ? -1 : 1)];
91
+ !a || !n.contains(a) || (t.preventDefault(), t.stopPropagation(), c.focus());
92
+ }
93
+ return C(() => document.addEventListener("keydown", g, !0)), N(() => document.removeEventListener("keydown", g, !0)), { onTableKeydown: y };
94
+ }
95
+ export {
96
+ k as useKeyboardNav
97
+ };