@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,65 +0,0 @@
1
- import { GlobalConfig as f } from "../../../../hooks/useSetup.js";
2
- import "axios";
3
- import "element-plus";
4
- import { isFunction as d } from "../../../../packages/utils/src/is.js";
5
- import { ref as j, toValue as p, unref as S } from "vue";
6
- import "xe-utils";
7
- import "dayjs";
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 W({
17
- getTableProps: c,
18
- tableMethods: v,
19
- getProps: I
20
- }) {
21
- const u = j(), w = (e) => d(e) ? e() : e ?? "";
22
- return {
23
- initCustomSetting: async () => {
24
- var y, A, K, m, O, h;
25
- const e = v.getTableColumns(), { columns: o, columnsKey: i, defaultDisplayFields: n } = S(c), r = w(i), t = (y = p(o)) != null && y.length ? p(o) : e;
26
- if (!((K = (A = p(I)) == null ? void 0 : A.table) != null && K.useHttpCache) || !r || !f.userId)
27
- return;
28
- const s = (h = (await ((O = (m = c.value) == null ? void 0 : m.getColumnsApi) == null ? void 0 : O.call(m, {
29
- permissionOnlyCode: r,
30
- userId: f.userId
31
- }))).records) == null ? void 0 : h[0];
32
- let C = [];
33
- if (!(s != null && s.json))
34
- C = n != null && n.length ? t == null ? void 0 : t.filter((a) => n.includes(a.field)) : t;
35
- else {
36
- const a = JSON.parse(s == null ? void 0 : s.json), g = new Map((t == null ? void 0 : t.map((l) => [l.field, l])) ?? []);
37
- C = a.map((l) => g.get(l)).filter(Boolean);
38
- }
39
- u.value = s == null ? void 0 : s.id, v.setTableColumns(C);
40
- },
41
- saveColumns: async (e) => {
42
- var n, r;
43
- const o = (n = p(I)) == null ? void 0 : n.table, i = {
44
- userId: f.userId,
45
- permissionOnlyCode: w((r = S(c)) == null ? void 0 : r.columnsKey)
46
- };
47
- if (u.value && d(o == null ? void 0 : o.updateColumnsApi))
48
- return await o.updateColumnsApi({
49
- id: u.value,
50
- json: e,
51
- ...i
52
- });
53
- if (d(o == null ? void 0 : o.setColumnsApi)) {
54
- const t = await o.setColumnsApi({
55
- ...i,
56
- json: e
57
- });
58
- return u.value = t, t;
59
- }
60
- }
61
- };
62
- }
63
- export {
64
- W as useCustomColumns
65
- };
@@ -1,29 +0,0 @@
1
- import { Recordable } from '../../../../../../utils/src';
2
- import { ComputedRef, Ref } from 'vue';
3
- import { VxeGridInstance, VxeGridPropTypes } from 'vxe-table';
4
- import { FetchParams, TtTableProps } from '../types/table';
5
- type ActionType = {
6
- setLoading: (loading: boolean) => void;
7
- setPagination: (info: Partial<VxeGridPropTypes.PagerConfig>) => void;
8
- getPaginationInfo: ComputedRef<undefined | VxeGridPropTypes.PagerConfig>;
9
- paginationRef: Ref<VxeGridPropTypes.PagerConfig>;
10
- clearSelectedRowKeys: () => void;
11
- tableData: Ref<Recordable[]>;
12
- xGrid?: Ref<VxeGridInstance<Recordable>>;
13
- getIsTableEvent: ComputedRef<boolean>;
14
- };
15
- type EmitType = {
16
- (e: "fetch-success", data?: Recordable): void;
17
- (e: "fetch-error", error?: Recordable): void;
18
- (e: "update:modelValue", data?: Recordable): void;
19
- (e: "load-data"): void;
20
- };
21
- export declare function useDataSource(propsRef: ComputedRef<TtTableProps>, { xGrid, setLoading, paginationRef, tableData, getPaginationInfo, setPagination, clearSelectedRowKeys, getIsTableEvent, }: ActionType, emit: EmitType): {
22
- dataSource: import('vue').ShallowRef<Recordable[], Recordable[]>;
23
- fetch: (opt?: FetchParams) => Promise<void>;
24
- reload: (opt?: FetchParams) => Promise<void>;
25
- reloadFilter: (type?: "sort" | "filter" | "page") => Promise<void>;
26
- getDataSource: <T = Recordable>() => T[];
27
- isloaded: import('vue').ShallowRef<boolean, boolean>;
28
- };
29
- export {};
@@ -1,232 +0,0 @@
1
- import { GlobalConfig as E } from "../../../../hooks/useSetup.js";
2
- import "axios";
3
- import "element-plus";
4
- import { isFunction as I } from "../../../../packages/utils/src/is.js";
5
- import { shallowRef as M, ref as $, computed as j, unref as e, onMounted as ie, watch as y, toValue as oe } from "vue";
6
- import { compareObjects as L } from "../../../../packages/utils/src/tool.js";
7
- import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
8
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
9
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
10
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
11
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
12
- import { cloneDeep as A, set as p, get as O, isUndefined as ue } from "lodash-es";
13
- import { useDebounceFn as fe, useTimeoutFn as ge } from "@vueuse/core";
14
- function Ae(r, {
15
- xGrid: c,
16
- setLoading: N,
17
- paginationRef: F,
18
- tableData: x,
19
- getPaginationInfo: V,
20
- setPagination: R,
21
- clearSelectedRowKeys: G,
22
- getIsTableEvent: ee
23
- }, S) {
24
- const h = M([]), B = $({}), w = $({}), z = M(!0), U = M(!1), _ = j(() => {
25
- const { showPager: t, isScrollFetch: a } = e(r);
26
- return t || a;
27
- });
28
- function te(t, a, l) {
29
- const n = Array.isArray(t), i = n ? t : O(t, "code"), s = n ? t : O(t, a), o = n ? 0 : O(t, l);
30
- return {
31
- resultCode: i,
32
- resultData: s,
33
- resultTotal: ue(o) ? 0 : Number(o)
34
- };
35
- }
36
- async function ae(t = ((l) => (l = E.table) == null ? void 0 : l.beforeFetch)(), a) {
37
- return t && I(t) && (a = await t(a) || a), a;
38
- }
39
- async function le(t = ((n) => (n = E.table) == null ? void 0 : n.afterFetch)(), a, l) {
40
- const { isScrollFetch: i, currentPageField: s = "" } = e(r);
41
- return t && I(t) && (a = await t(a, e(B)) || a), i && O(l, s, 1) !== 1 && (a = [...e(h), ...a]), a;
42
- }
43
- async function d(t) {
44
- var W, X;
45
- const {
46
- api: a,
47
- filterApi: l,
48
- searchInfo: n,
49
- dataField: i,
50
- beforeFetch: s,
51
- afterFetch: o,
52
- currentPageField: u,
53
- pageSizeField: g,
54
- totalField: v,
55
- useSearchForm: T
56
- } = e(r);
57
- if (!a || !I(a)) return;
58
- const { tablePage: f } = t;
59
- let K = {}, b = f.currentPage || 1;
60
- const Q = e(r).formApi;
61
- Q && T && (K = await Q.getValues());
62
- const D = {};
63
- p(D, u, b || 1), p(D, g, f.pageSize);
64
- try {
65
- N(!0);
66
- let m = null;
67
- if (t != null && t.serverFilterParams && l)
68
- m = await l({
69
- ...t == null ? void 0 : t.serverFilterParams,
70
- ...e(_) ? D : {}
71
- });
72
- else {
73
- l && ((W = e(c)) == null || W.clearSort(), (X = e(c)) == null || X.clearFilter());
74
- let k = {
75
- ...K,
76
- ...n,
77
- ...t == null ? void 0 : t.searchInfo,
78
- ...e(_) ? D : {}
79
- };
80
- k = await ae(s, k), m = await a(k);
81
- }
82
- B.value = m;
83
- const { resultData: ce, resultTotal: Y } = te(m, i, v);
84
- let P = ce || [];
85
- P = await le(o, P, D), C(P);
86
- const Z = Y || P.length || 0, se = Math.max(1, Math.ceil(Z / f.pageSize));
87
- b > se && (b = 1, q({
88
- tablePage: {
89
- currentPage: b,
90
- pageSize: f.pageSize
91
- }
92
- })), R({
93
- total: Z,
94
- currentPage: b
95
- }), w.value = A(e(V)), S("fetch-success", {
96
- items: P,
97
- total: Y,
98
- rawDataSource: m
99
- }), G(), U.value = !0;
100
- } catch (m) {
101
- S("fetch-error", m), C([]);
102
- } finally {
103
- setTimeout(() => {
104
- N(!1);
105
- }, 50);
106
- }
107
- }
108
- async function q(t) {
109
- var l;
110
- const a = {
111
- ...e(F)
112
- };
113
- (l = E.table) != null && l.isReloadResetToFirstPage && (a.currentPage = 1), t ? await d({
114
- tablePage: Object.hasOwn(t, "tablePage") ? t.tablePage : a,
115
- searchInfo: Object.hasOwn(t, "searchInfo") ? t.searchInfo : t
116
- }) : await d({
117
- tablePage: a
118
- }), e(r).immediate || (z.value = !1);
119
- }
120
- async function H(t) {
121
- var u, g, v, T;
122
- if (!!!((g = (u = e(r)) == null ? void 0 : u.filterConfig) != null && g.remote)) return;
123
- const l = {
124
- ...e(F)
125
- };
126
- t !== "page" && (l.currentPage = 1);
127
- const n = ((v = e(c)) == null ? void 0 : v.getSortColumns()) || [], s = (((T = e(c)) == null ? void 0 : T.getCheckedFilters()) || []).map((f) => ({
128
- fieldName: f.field,
129
- checkAll: !1,
130
- includeValues: f.datas[0],
131
- excludeValues: []
132
- })), o = n.map((f) => ({
133
- fieldName: f.field,
134
- isAscending: f.order === "asc"
135
- }));
136
- await d({
137
- serverFilterParams: {
138
- filterConditions: s,
139
- sortConditions: o
140
- },
141
- tablePage: l
142
- });
143
- }
144
- function ne() {
145
- var a;
146
- const { tableData: t } = ((a = e(c)) == null ? void 0 : a.getTableData()) || {};
147
- return t;
148
- }
149
- function re(t) {
150
- h.value = t, S("update:modelValue", t);
151
- }
152
- const C = fe((t) => {
153
- var n, i, s, o, u;
154
- const a = e(c).getTreeExpandRecords(), l = (i = (n = e(r)) == null ? void 0 : n.treeConfig) == null ? void 0 : i.reserve;
155
- e(c) && ((s = e(c)) == null || s.loadData(t)), e(r).mergeCells && e(c) && ((o = e(c)) == null || o.setMergeCells(e(r).mergeCells)), e(r).clearTreeExpand ? e(c) && ((u = e(c)) == null || u.clearTreeExpand()) : a.length > 0 && l && e(c).setTreeExpand(a, !0), re(t), S("load-data");
156
- }, 30);
157
- function J(t, a) {
158
- return (t.currentPage || 1) !== a.currentPage || t.pageSize !== a.pageSize;
159
- }
160
- return ie(() => {
161
- w.value = A(e(V)), ge(() => {
162
- const t = J(e(r).pagerConfig, e(w));
163
- e(r).immediate && !t && d({
164
- tablePage: e(V)
165
- });
166
- }, 16);
167
- }), y(
168
- () => e(F),
169
- (t) => {
170
- var l, n, i, s;
171
- if (J(t, e(w))) {
172
- if (e(z) && !e(r).immediate) {
173
- z.value = !1;
174
- return;
175
- }
176
- const o = !!((n = (l = e(r)) == null ? void 0 : l.filterConfig) != null && n.remote), u = ((i = e(c)) == null ? void 0 : i.getSortColumns()) || [], g = ((s = e(c)) == null ? void 0 : s.getCheckedFilters()) || [];
177
- o && (u.length > 0 || g.length > 0) ? H("page") : d({
178
- tablePage: e(F)
179
- });
180
- }
181
- },
182
- { deep: !0 }
183
- ), y(
184
- j(() => oe(e(r).data) || []),
185
- (t) => {
186
- var n;
187
- const { fullData: a } = e(c) ? ((n = e(c)) == null ? void 0 : n.getTableData()) || {} : { fullData: [] };
188
- if (Object.keys(L({ data: t }, { data: a })).length) {
189
- const { data: i, api: s, modelValue: o } = e(r);
190
- if ((o ? o.length : 0) === 0 && !s && i) {
191
- const g = e(r).isDataCloneDeep ? A(e(i)) : e(i);
192
- C(g);
193
- }
194
- }
195
- },
196
- {
197
- immediate: !0,
198
- deep: !0
199
- }
200
- ), y(
201
- j(() => e(r).modelValue || []),
202
- (t) => {
203
- var n;
204
- if (e(ee)) return;
205
- const { fullData: a } = e(c) ? ((n = e(c)) == null ? void 0 : n.getTableData()) || {} : { fullData: [] };
206
- if (Object.keys(L({ data: t }, { data: a })).length) {
207
- const { api: i, modelValue: s } = e(r);
208
- if (!i && s) {
209
- const o = e(r).isDataCloneDeep ? A(s) : e(s);
210
- C(o);
211
- }
212
- }
213
- },
214
- { immediate: !0, deep: !0 }
215
- ), y(
216
- () => h.value,
217
- () => {
218
- x.value = e(h);
219
- },
220
- { deep: !0, immediate: !0 }
221
- ), {
222
- dataSource: h,
223
- fetch: d,
224
- reload: q,
225
- reloadFilter: H,
226
- getDataSource: ne,
227
- isloaded: U
228
- };
229
- }
230
- export {
231
- Ae as useDataSource
232
- };
@@ -1,64 +0,0 @@
1
- import { computed as L, ref as H, shallowRef as s, watch as O, unref as x } from "vue";
2
- function P(v, r, A) {
3
- const p = L(() => {
4
- var t, e;
5
- return ((t = v.value) == null ? void 0 : t.leftSlotWidth) || ((e = v.value) == null ? void 0 : e.rightSlotWidth);
6
- }), T = H(), q = H(), h = s(0), y = s(0), f = s(0), g = s(0), b = s(0), d = H([]);
7
- async function w(t = !0) {
8
- var a, n, c, i, u, S;
9
- if (!x(p)) return;
10
- await new Promise((m) => setTimeout(m, 50));
11
- const e = (n = (a = r.value) == null ? void 0 : a.$el) == null ? void 0 : n.querySelector(".vxe-table--body-wrapper"), l = (i = (c = r.value) == null ? void 0 : c.$el) == null ? void 0 : i.querySelector(".vxe-table--header"), o = (S = (u = r.value) == null ? void 0 : u.$el) == null ? void 0 : S.querySelector(".vxe-body--y-space");
12
- h.value = (e == null ? void 0 : e.clientHeight) || 0, b.value = o.style.height, f.value = (l == null ? void 0 : l.clientHeight) || 0, B(t ? 0 : void 0);
13
- }
14
- async function B(t) {
15
- var o, a, n, c, i;
16
- if (!x(p)) return;
17
- await new Promise((u) => setTimeout(u, 10));
18
- const e = (a = (o = r.value) == null ? void 0 : o.$el) == null ? void 0 : a.querySelector(".vxe-table--body");
19
- y.value = e.clientHeight, g.value = e.style.marginTop || 0;
20
- const l = e.querySelectorAll(".vxe-body--row");
21
- d.value = (n = Array.from(l)) == null ? void 0 : n.map((u) => {
22
- var $;
23
- const S = ($ = r.value) == null ? void 0 : $.getRowNode(u), m = u.offsetTop;
24
- return {
25
- ...S,
26
- offsetTop: m
27
- };
28
- }), t !== void 0 && ((c = T.value) == null || c.scrollTo({ top: t }), (i = q.value) == null || i.scrollTo({ top: t }));
29
- }
30
- return O(
31
- () => A.value,
32
- () => {
33
- w();
34
- },
35
- { deep: !0 }
36
- ), O(
37
- () => {
38
- var t, e;
39
- return [(t = v.value) == null ? void 0 : t.leftSlotWidth, (e = v.value) == null ? void 0 : e.rightSlotWidth];
40
- },
41
- ([t, e], [l, o]) => {
42
- const a = !!(t || e), n = !!(l || o);
43
- if (!a) {
44
- h.value = 0, y.value = 0, f.value = 0, g.value = 0, b.value = 0, d.value = [];
45
- return;
46
- }
47
- (!n || t !== l || e !== o) && w();
48
- }
49
- ), {
50
- handleLeftRightSlotScroll: B,
51
- handleLeftRightSlotInit: w,
52
- leftRightSlotRows: d,
53
- tableHeaderHight: f,
54
- leftSlotScrollbarRef: T,
55
- rightSlotScrollbarRef: q,
56
- tableBodyHeight: y,
57
- tableBodyWrapHeight: h,
58
- tableBodyScrollTop: g,
59
- tableBodyScrollHeight: b
60
- };
61
- }
62
- export {
63
- P as useLeftRightSlot
64
- };
@@ -1,7 +0,0 @@
1
- import { VxeTablePropTypes } from 'vxe-table';
2
- import { TtTableMethods, TtTableProps } from '../types/table';
3
- import { TtTableFormProps, UseTtTableFormReturnType } from '../types/tableForm';
4
- type Props = Partial<DynamicProps<TtTableProps>>;
5
- export declare function useTtTable<K extends VxeTablePropTypes.Row>(tableProps?: Props): [(instance: TtTableMethods<K>, uuid: string) => void, TtTableMethods<K>];
6
- export declare function useTtTableForm(tableFormProps?: Partial<TtTableFormProps>): UseTtTableFormReturnType;
7
- export {};
@@ -1,101 +0,0 @@
1
- import { ComputedRef, Ref } from 'vue';
2
- import { VxeGridInstance, VxeTableDefines, VxeTablePropTypes } from 'vxe-table';
3
- import { InsertReturnData, RowSelectionHandlers, TtTableExtendedTableApi, TtTableProps } from '../types/table';
4
- export declare function useTableEvents(xGrid: Ref<VxeGridInstance | undefined>, tableState: Record<string, unknown>, emit: {
5
- (e: "update:modelValue", data?: any): void;
6
- }, tableApi: TtTableExtendedTableApi, propsRef: ComputedRef<TtTableProps>, rowSelection?: RowSelectionHandlers): {
7
- /**
8
- * 设置空数据展示的text
9
- */
10
- setEmptyText: (text: string) => void;
11
- /**
12
- * 加载数据
13
- * @param data 数据
14
- */
15
- loadData: (data: VxeTablePropTypes.Row[]) => Promise<any>;
16
- /**
17
- * 加载数据并恢复到初始状态
18
- * @param data 数据
19
- */
20
- reloadData: (data: VxeTablePropTypes.Row[]) => Promise<void>;
21
- /**
22
- * 重新加载列
23
- * @param columns 列对象
24
- */
25
- reloadColumn: (columns: (VxeTableDefines.ColumnOptions<any> | VxeTableDefines.ColumnInfo<any>)[]) => Promise<any>;
26
- /**
27
- * 局部加载行数据并恢复到初始状态
28
- * @param rows 行对象
29
- * @param record 新数据
30
- * @param field 指定字段名
31
- */
32
- reloadRow: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], record?: VxeTablePropTypes.Row, field?: string) => Promise<void>;
33
- /**
34
- * 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
35
- * @param rows 指定行
36
- * @param field 字段名
37
- */
38
- clearData: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], field?: string) => Promise<any>;
39
- /**
40
- * 重新懒加载展开行,并展开内容
41
- * @param rows 指定行
42
- */
43
- reloadRowExpand: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[]) => Promise<void>;
44
- /**
45
- * 重新懒加载树节点,并展开该节点
46
- * @param rows 指定行
47
- */
48
- reloadTreeExpand: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[]) => Promise<any>;
49
- /**
50
- * @description: 插入行
51
- * @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
52
- * @return {Promise<InsertReturnData>}
53
- */
54
- insert: (records: VxeTablePropTypes.Row | VxeTablePropTypes.Row[]) => Promise<InsertReturnData>;
55
- /**
56
- * @description: 插入指定行
57
- * @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
58
- * @param {*} row
59
- * @return {Promise<InsertReturnData>}
60
- */
61
- insertAt: (records: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], row: any) => Promise<InsertReturnData>;
62
- /**
63
- * @description: 退出编辑并还原数据
64
- * @param {VxeTablePropTypes.Row} row
65
- */
66
- clearEditRevertData: (row: VxeTablePropTypes.Row) => Promise<void>;
67
- /**
68
- * @description: 指定行激活编辑
69
- * @param row 指定行
70
- * @param fieldOrColumn 指定列
71
- */
72
- setEditRow: (row: VxeTablePropTypes.Row, fieldOrColumn?: boolean | string | VxeTableDefines.ColumnInfo) => Promise<void>;
73
- /**
74
- * @description: 指定单元格激活编辑
75
- * @param row 指定行
76
- * @param fieldOrColumn 指定列
77
- */
78
- setEditCell: (row: VxeTablePropTypes.Row, fieldOrColumn: string | VxeTableDefines.ColumnInfo) => Promise<void>;
79
- /**
80
- * @description: 删除行
81
- * @param {any} row
82
- * @return {*}
83
- */
84
- remove: (row: VxeTablePropTypes.Row) => Promise<InsertReturnData>;
85
- /**
86
- * 删除复选框选中的行数据
87
- */
88
- removeCheckboxRow: () => Promise<InsertReturnData>;
89
- /**
90
- * 删除单选框选中的行数据
91
- */
92
- removeRadioRow: () => Promise<InsertReturnData>;
93
- /**
94
- * 删除当前行选中的行数据
95
- */
96
- removeCurrentRow: () => Promise<InsertReturnData>;
97
- /**
98
- * 删除所有新增的临时数据
99
- */
100
- removeInsertRow: () => Promise<InsertReturnData>;
101
- };
@@ -1,197 +0,0 @@
1
- import { delay as w } from "lodash-es";
2
- import { unref as a, nextTick as i } from "vue";
3
- function b(n, R, f, E, m, u) {
4
- const r = () => {
5
- i(() => {
6
- const o = a(n), { tableData: t } = o.getTableData();
7
- E.setState({
8
- modelValue: t
9
- }), E.setProxyState({ isTableEvent: !1 }), f("update:modelValue", t);
10
- });
11
- }, c = () => {
12
- E.setProxyState({ isTableEvent: !0 });
13
- };
14
- return {
15
- ...{
16
- /**
17
- * @description: 插入行
18
- * @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
19
- * @return {Promise<InsertReturnData>}
20
- */
21
- insert: async function(t) {
22
- c();
23
- const s = await a(n).insert(t);
24
- return r(), s;
25
- },
26
- /**
27
- * @description: 插入指定行
28
- * @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
29
- * @param {*} row
30
- * @return {Promise<InsertReturnData>}
31
- */
32
- insertAt: async function(t, e) {
33
- c();
34
- const d = await a(n).insertAt(t, e);
35
- return r(), d;
36
- },
37
- /**
38
- * @description: 退出编辑并还原数据
39
- * @param {VxeTablePropTypes.Row} row
40
- */
41
- clearEditRevertData: async function(t) {
42
- var e, s;
43
- c(), await ((e = a(n)) == null ? void 0 : e.clearEdit()), (s = a(n)) == null || s.revertData(t), r();
44
- },
45
- /**
46
- * @description: 指定行激活编辑
47
- * @param row 指定行
48
- * @param fieldOrColumn 指定列
49
- */
50
- setEditRow: async function(t, e) {
51
- var s;
52
- await ((s = a(n)) == null ? void 0 : s.setEditRow(t, e));
53
- },
54
- /**
55
- * @description: 指定单元格激活编辑
56
- * @param row 指定行
57
- * @param fieldOrColumn 指定列
58
- */
59
- setEditCell: async function(t, e) {
60
- var s;
61
- await ((s = a(n)) == null ? void 0 : s.setEditCell(t, e));
62
- },
63
- /**
64
- * @description: 删除行
65
- * @param {any} row
66
- * @return {*}
67
- */
68
- remove: async function(t) {
69
- c();
70
- const e = await a(n).remove(t);
71
- return r(), e;
72
- },
73
- /**
74
- * 删除复选框选中的行数据
75
- */
76
- removeCheckboxRow: async function() {
77
- var e;
78
- c();
79
- const t = await a(n).removeCheckboxRow();
80
- return (e = u == null ? void 0 : u.clearSelectedRowKeys) == null || e.call(u), r(), t;
81
- },
82
- /**
83
- * 删除单选框选中的行数据
84
- */
85
- removeRadioRow: async function() {
86
- var e;
87
- c();
88
- const t = await a(n).removeRadioRow();
89
- return (e = u == null ? void 0 : u.clearSelectedRowKeys) == null || e.call(u), r(), t;
90
- },
91
- /**
92
- * 删除当前行选中的行数据
93
- */
94
- removeCurrentRow: async function() {
95
- c();
96
- const t = await a(n).removeCurrentRow();
97
- return r(), t;
98
- },
99
- /**
100
- * 删除所有新增的临时数据
101
- */
102
- removeInsertRow: async function() {
103
- c();
104
- const t = await a(n).removeInsertRow();
105
- return r(), t;
106
- }
107
- },
108
- ...{
109
- /**
110
- * 加载数据
111
- * @param data 数据
112
- */
113
- loadData: async function(t) {
114
- var l, v;
115
- const e = a(n).getTreeExpandRecords();
116
- c();
117
- const s = await a(n).loadData(t), d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
118
- return e.length > 0 && d && a(n).setTreeExpand(e, !0), r(), s;
119
- },
120
- /**
121
- * 加载数据并恢复到初始状态
122
- * @param data 数据
123
- */
124
- reloadData: async function(t) {
125
- var l, v;
126
- const e = a(n).getTreeExpandRecords();
127
- c();
128
- const s = await a(n).reloadData(t), d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
129
- return e.length > 0 && d && a(n).setTreeExpand(e, !0), r(), s;
130
- },
131
- /**
132
- * 重新加载列
133
- * @param columns 列对象
134
- */
135
- reloadColumn: async function(t) {
136
- const e = a(n).getTreeExpandRecords();
137
- return c(), await E.setTableColumns(t), w(() => {
138
- var l, v;
139
- const d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
140
- e.length > 0 && d && a(n).setTreeExpand(e, !0);
141
- }, 50), r(), E.getTableColumns();
142
- },
143
- /**
144
- * 局部加载行数据并恢复到初始状态
145
- * @param rows 行对象
146
- * @param record 新数据
147
- * @param field 指定字段名
148
- */
149
- reloadRow: async function(t, e, s) {
150
- c();
151
- const d = await a(n).reloadRow(t, e, s);
152
- return r(), d;
153
- },
154
- /**
155
- * 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
156
- * @param rows 指定行
157
- * @param field 字段名
158
- */
159
- clearData: async function(t, e) {
160
- c();
161
- const s = await a(n).clearData(t, e);
162
- return r(), s;
163
- },
164
- /**
165
- * 重新懒加载展开行,并展开内容
166
- * @param rows 指定行
167
- */
168
- reloadRowExpand: async function(t) {
169
- c();
170
- const e = await a(n).reloadRowExpand(t);
171
- return r(), e;
172
- },
173
- /**
174
- * 重新懒加载树节点,并展开该节点
175
- * @param rows 指定行
176
- */
177
- reloadTreeExpand: async function(t) {
178
- c();
179
- const e = await a(n).reloadTreeExpand(t);
180
- return r(), e;
181
- }
182
- },
183
- ...{
184
- /**
185
- * 设置空数据展示的text
186
- */
187
- setEmptyText: (o) => {
188
- R.emptyText = o, E.setState({
189
- emptyText: o
190
- });
191
- }
192
- }
193
- };
194
- }
195
- export {
196
- b as useTableEvents
197
- };