@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.
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
- package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-modal-form/index.vue.js +13 -12
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
- package/dist/components/tt-panel-select/src/index.vue.js +1 -0
- package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
- package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
- package/dist/components/tt-table/index.d.ts +523 -358
- package/dist/components/tt-table/index.js +7 -4
- package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
- package/dist/components/tt-table/src/Table.vue.js +405 -618
- package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
- package/dist/components/tt-table/src/TableForm.vue.js +219 -228
- package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
- package/dist/components/tt-table/src/components/TableButtons.js +25 -25
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
- package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
- package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.js +2 -1
- package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
- package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
- package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
- package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
- package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
- package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
- package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
- package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
- package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
- package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
- package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
- package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
- package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
- package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
- package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
- package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
- package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
- package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
- package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
- package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
- package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
- package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
- package/dist/components/tt-table/src/props.d.ts +318 -151
- package/dist/components/tt-table/src/props.js +117 -270
- package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
- package/dist/components/tt-table/src/table-defaults.js +71 -0
- package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
- package/dist/components/tt-table/src/table-mutation-events.js +70 -0
- package/dist/components/tt-table/src/types/table.d.ts +207 -88
- package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
- package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
- package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
- package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
- package/dist/components/tt-table/src/utils/context.js +25 -12
- package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
- package/dist/components/tt-table/src/utils/table-api.js +198 -165
- package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
- package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
- package/dist/components/types.d.ts +0 -20
- package/dist/hooks/useSetup.js +0 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +105 -101
- package/dist/packages/hooks/src/useDebounce.js +6 -6
- package/dist/packages/utils/src/is.js +20 -18
- package/dist/packages/utils/src/tool.js +76 -149
- package/dist/style.css +1 -1
- package/dist/utils/uppercaseInput.d.ts +29 -0
- package/dist/utils/uppercaseInput.js +16 -0
- package/package.json +3 -3
- package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
- package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
- package/dist/components/tt-table/src/enum.d.ts +0 -2
- package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
- package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
- package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
- package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
- package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
- package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
- package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
- package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
- package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
- package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
- package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
- package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
- package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
- package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
- package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
- package/dist/packages/utils/src/check.js +0 -10
|
@@ -1,179 +1,126 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var c = (r, t, e) => t in r ? u(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var a = (r, t, e) => c(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import "axios";
|
|
5
5
|
import "element-plus";
|
|
6
|
-
import { isFunction as
|
|
7
|
-
import { reactive as
|
|
8
|
-
import { bindMethods as
|
|
9
|
-
import { mergeWithArrayOverride as
|
|
6
|
+
import { isFunction as w } from "../../../../packages/utils/src/is.js";
|
|
7
|
+
import { reactive as m, shallowRef as y, computed as n, toValue as d } from "vue";
|
|
8
|
+
import { bindMethods as p } from "../../../../packages/utils/src/tool.js";
|
|
9
|
+
import { mergeWithArrayOverride as h } from "../../../../packages/utils/src/merge.js";
|
|
10
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
-
import { StateHandler as
|
|
11
|
+
import { StateHandler as g } from "../../../../packages/utils/src/stateHandler.js";
|
|
12
12
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
13
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
14
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
15
15
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
16
16
|
import "lodash-es";
|
|
17
17
|
import { GlobalConfig as o } from "../../../../hooks/useSetup.js";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import { createSharedTableDefaults as R } from "../table-defaults.js";
|
|
19
|
+
import { Store as b } from "@tanstack/vue-store";
|
|
20
|
+
function C() {
|
|
21
|
+
var r, t, e, s, i, l;
|
|
21
22
|
return {
|
|
22
|
-
|
|
23
|
-
total: 0,
|
|
24
|
-
showCheckbox: !1,
|
|
25
|
-
showExpand: !1,
|
|
26
|
-
showRadio: !1,
|
|
27
|
-
showIndex: !1,
|
|
28
|
-
isCellResize: !1,
|
|
29
|
-
isColumnsDrag: !1,
|
|
30
|
-
isCellSort: !1,
|
|
31
|
-
showAction: !1,
|
|
32
|
-
actionWidth: 0,
|
|
33
|
-
actionTitle: "",
|
|
34
|
-
actionProps: {},
|
|
35
|
-
indexColumnProps: {},
|
|
36
|
-
checkboxColumnProps: {},
|
|
37
|
-
expandColumnProps: {},
|
|
38
|
-
radioColumnProps: {},
|
|
39
|
-
searchInfo: {},
|
|
40
|
-
immediate: !0,
|
|
23
|
+
...R(),
|
|
41
24
|
loading: !1,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
filterNoVisibleField: [],
|
|
47
|
-
showTableAlert: !1,
|
|
48
|
-
modelValue: [],
|
|
49
|
-
title: "",
|
|
50
|
-
showTitle: !1,
|
|
25
|
+
/**
|
|
26
|
+
* hook 方式默认不铺满,与 `props.ts` 的组件方式默认 `true` 有意不同,不要统一:
|
|
27
|
+
* 改任一边都会改变现有页面的表格高度。
|
|
28
|
+
*/
|
|
51
29
|
autoHeight: !1,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
showHeaderOverflow: !0,
|
|
63
|
-
isScrollFetch: !1,
|
|
64
|
-
showScrollFetchLoading: !0,
|
|
65
|
-
toolbarConfig: void 0,
|
|
66
|
-
zoomConfig: void 0,
|
|
67
|
-
formApi: void 0,
|
|
68
|
-
useHttpCache: (a = o.table) == null ? void 0 : a.useHttpCache,
|
|
69
|
-
defaultDisplayFields: (e = o.table) == null ? void 0 : e.defaultDisplayFields,
|
|
70
|
-
loadingText: (t = o.table) == null ? void 0 : t.loadingText,
|
|
71
|
-
emptyText: (i = o.table) == null ? void 0 : i.emptyText,
|
|
72
|
-
emptyImageStatus: "no-data",
|
|
73
|
-
noSearchText: (d = o.table) == null ? void 0 : d.noSearchText,
|
|
74
|
-
showSetColumn: (h = o.table) == null ? void 0 : h.showSetColumn,
|
|
75
|
-
showSetting: (m = o.table) == null ? void 0 : m.showSetting,
|
|
76
|
-
showRefresh: (u = o.table) == null ? void 0 : u.showRefresh,
|
|
77
|
-
tableRowId: (c = o.table) == null ? void 0 : c.tableRowId,
|
|
78
|
-
currentPageField: (p = o.table) == null ? void 0 : p.currentPageField,
|
|
79
|
-
pageSizeField: (g = o.table) == null ? void 0 : g.pageSizeField,
|
|
80
|
-
totalField: (w = o.table) == null ? void 0 : w.totalField,
|
|
81
|
-
dataField: (f = o.table) == null ? void 0 : f.dataField,
|
|
82
|
-
pagerConfig: (b = o.table) == null ? void 0 : b.pagerConfig,
|
|
83
|
-
size: (y = o.table) == null ? void 0 : y.size,
|
|
84
|
-
keyboardConfig: (S = o.table) == null ? void 0 : S.keyboardConfig,
|
|
85
|
-
menuConfig: {},
|
|
86
|
-
mouseConfig: (C = o.table) == null ? void 0 : C.mouseConfig,
|
|
87
|
-
checkboxConfig: (x = o.table) == null ? void 0 : x.checkboxConfig,
|
|
88
|
-
radioConfig: (R = o.table) == null ? void 0 : R.radioConfig,
|
|
89
|
-
stripe: (T = o.table) == null ? void 0 : T.stripe,
|
|
90
|
-
border: (v = o.table) == null ? void 0 : v.border,
|
|
91
|
-
updateColumnsApi: (E = o.table) == null ? void 0 : E.updateColumnsApi,
|
|
92
|
-
getColumnsApi: (P = o.table) == null ? void 0 : P.getColumnsApi,
|
|
93
|
-
setColumnsApi: (D = o.table) == null ? void 0 : D.setColumnsApi,
|
|
94
|
-
columnsKey: (F = o.table) == null ? void 0 : F.columnsKey
|
|
30
|
+
stripe: (r = o.table) == null ? void 0 : r.stripe,
|
|
31
|
+
border: (t = o.table) == null ? void 0 : t.border,
|
|
32
|
+
updateColumnsApi: (e = o.table) == null ? void 0 : e.updateColumnsApi,
|
|
33
|
+
getColumnsApi: (s = o.table) == null ? void 0 : s.getColumnsApi,
|
|
34
|
+
setColumnsApi: (i = o.table) == null ? void 0 : i.setColumnsApi,
|
|
35
|
+
/**
|
|
36
|
+
* hook 方式取全局配置,与 `props.ts` 的组件方式固定取 `""` 有意不同,不要统一:
|
|
37
|
+
* 统一会改变组件方式下的列配置缓存 key,已存的服务端列配置会读不到。
|
|
38
|
+
*/
|
|
39
|
+
columnsKey: (l = o.table) == null ? void 0 : l.columnsKey
|
|
95
40
|
};
|
|
96
41
|
}
|
|
97
|
-
class
|
|
42
|
+
class k {
|
|
98
43
|
/**
|
|
99
44
|
* 构造函数,初始化 store、状态等
|
|
100
45
|
* @param options 表格配置项
|
|
101
46
|
*/
|
|
102
|
-
constructor(
|
|
47
|
+
constructor(t = {}) {
|
|
103
48
|
/** vxe-grid 表格实例 */
|
|
104
|
-
|
|
49
|
+
a(this, "grid", m({}));
|
|
105
50
|
/** 表格操作方法集合(TtTableMethods) */
|
|
106
|
-
|
|
51
|
+
a(this, "methods", m({}));
|
|
107
52
|
/** 当前表格的 props 状态 */
|
|
108
|
-
|
|
53
|
+
a(this, "state", null);
|
|
109
54
|
/** 响应式 store,存储表格的状态 */
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
isTableEvent: !1,
|
|
116
|
-
selectedRows: []
|
|
117
|
-
}));
|
|
118
|
-
s(this, "isMounted", !1);
|
|
119
|
-
s(this, "stateHandler");
|
|
55
|
+
a(this, "store");
|
|
56
|
+
/** 组件内的响应式状态源(loading、行选择),挂载时由组件交进来 */
|
|
57
|
+
a(this, "stateSources", y(null));
|
|
58
|
+
a(this, "isMounted", !1);
|
|
59
|
+
a(this, "stateHandler");
|
|
120
60
|
/**
|
|
121
|
-
* @description:
|
|
122
|
-
* @return {DT[]}
|
|
61
|
+
* @description: 获取表格选中数据的keys(响应式)
|
|
123
62
|
*/
|
|
124
|
-
|
|
63
|
+
a(this, "selectedKeys", n(() => {
|
|
64
|
+
var t;
|
|
65
|
+
return d((t = this.stateSources.value) == null ? void 0 : t.selectedKeys) ?? [];
|
|
66
|
+
}));
|
|
125
67
|
/**
|
|
126
|
-
* @description:
|
|
127
|
-
* @return {DT[]}
|
|
68
|
+
* @description: 获取表格选中数据(响应式)
|
|
128
69
|
*/
|
|
129
|
-
|
|
70
|
+
a(this, "selectedRows", n(() => {
|
|
71
|
+
var t;
|
|
72
|
+
return d((t = this.stateSources.value) == null ? void 0 : t.selectedRows) ?? [];
|
|
73
|
+
}));
|
|
130
74
|
/**
|
|
131
75
|
* 获取表格 loading 状态(响应式)
|
|
132
76
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.store = new z(n(t, i), {
|
|
77
|
+
a(this, "getLoading", n(() => {
|
|
78
|
+
var t;
|
|
79
|
+
return d((t = this.stateSources.value) == null ? void 0 : t.loading) ?? !1;
|
|
80
|
+
}));
|
|
81
|
+
const e = { ...t }, s = C();
|
|
82
|
+
this.store = new b(h(e, s), {
|
|
140
83
|
onUpdate: () => {
|
|
141
84
|
this.state = this.store.state;
|
|
142
85
|
}
|
|
143
|
-
}), this.state = this.store.state, this.stateHandler = new
|
|
86
|
+
}), this.state = this.store.state, this.stateHandler = new g(), p(this);
|
|
144
87
|
}
|
|
145
88
|
/**
|
|
146
89
|
* 组件挂载时调用,注入表格实例和方法
|
|
147
90
|
* @param instance vxe-grid 实例
|
|
148
91
|
* @param methods 表格操作方法
|
|
149
92
|
*/
|
|
150
|
-
mount(
|
|
151
|
-
|
|
93
|
+
mount(t, e) {
|
|
94
|
+
var s;
|
|
95
|
+
if (!this.isMounted && t) {
|
|
96
|
+
const i = ((s = e.getTableInstance) == null ? void 0 : s.call(e)) || t;
|
|
97
|
+
Object.setPrototypeOf(this.grid, i), Object.setPrototypeOf(this.methods, e), this.stateHandler.setConditionTrue(), this.isMounted = !0;
|
|
98
|
+
}
|
|
152
99
|
}
|
|
153
100
|
/**
|
|
154
101
|
* 更新表格的状态
|
|
155
102
|
* @param stateOrFn 新状态或返回新状态的函数
|
|
156
103
|
*/
|
|
157
|
-
setState(
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
}) : this.store.setState((
|
|
104
|
+
setState(t) {
|
|
105
|
+
w(t) ? this.store.setState((e) => {
|
|
106
|
+
const s = t(e);
|
|
107
|
+
return h(s, e, ["searchInfo"]);
|
|
108
|
+
}) : this.store.setState((e) => h(t, e, ["searchInfo"]));
|
|
162
109
|
}
|
|
163
110
|
/**
|
|
164
111
|
* 组件卸载时调用,重置挂载状态
|
|
165
112
|
*/
|
|
166
113
|
unmount() {
|
|
167
|
-
this.isMounted = !1, this.stateHandler.reset();
|
|
114
|
+
this.isMounted = !1, this.stateSources.value = null, Object.setPrototypeOf(this.grid, Object.prototype), Object.setPrototypeOf(this.methods, Object.prototype), this.stateHandler.reset();
|
|
168
115
|
}
|
|
169
116
|
/**
|
|
170
117
|
* @description: 表格重载数据
|
|
171
118
|
* @param {FetchParams | undefined} data 加载的params
|
|
172
119
|
* @return {*}
|
|
173
120
|
*/
|
|
174
|
-
async reload(
|
|
121
|
+
async reload(t) {
|
|
175
122
|
try {
|
|
176
|
-
this.methods.reload(
|
|
123
|
+
await this.methods.reload(t);
|
|
177
124
|
} catch {
|
|
178
125
|
}
|
|
179
126
|
}
|
|
@@ -181,8 +128,8 @@ class $ {
|
|
|
181
128
|
* @description: 设置表格props
|
|
182
129
|
* @param {Partial<TtTableProps>} props 表格props
|
|
183
130
|
*/
|
|
184
|
-
setProps(
|
|
185
|
-
this.methods.setProps(
|
|
131
|
+
setProps(t) {
|
|
132
|
+
this.methods.setProps(t);
|
|
186
133
|
}
|
|
187
134
|
/**
|
|
188
135
|
* @description: 重新计算高度
|
|
@@ -196,8 +143,8 @@ class $ {
|
|
|
196
143
|
* @param {VxeGridPropTypes.Columns<DT>} columns columns
|
|
197
144
|
* @return {*}
|
|
198
145
|
*/
|
|
199
|
-
setTableColumns(
|
|
200
|
-
this.methods.setTableColumns(
|
|
146
|
+
setTableColumns(t) {
|
|
147
|
+
this.methods.setTableColumns(t);
|
|
201
148
|
}
|
|
202
149
|
/**
|
|
203
150
|
* @description: 获取表格columns
|
|
@@ -217,8 +164,8 @@ class $ {
|
|
|
217
164
|
* @description: 设置表格loading
|
|
218
165
|
* @param {boolean} loading
|
|
219
166
|
*/
|
|
220
|
-
setLoading(
|
|
221
|
-
this.methods.setLoading(
|
|
167
|
+
setLoading(t) {
|
|
168
|
+
this.methods.setLoading(t);
|
|
222
169
|
}
|
|
223
170
|
/**
|
|
224
171
|
* @description: 获取表格pagination
|
|
@@ -231,8 +178,8 @@ class $ {
|
|
|
231
178
|
* @description: 设置表格pagination
|
|
232
179
|
* @param {Partial<VxeGridPropTypes.PagerConfig>} props 表格pagination
|
|
233
180
|
*/
|
|
234
|
-
setPagination(
|
|
235
|
-
this.methods.setPagination(
|
|
181
|
+
setPagination(t) {
|
|
182
|
+
this.methods.setPagination(t);
|
|
236
183
|
}
|
|
237
184
|
/**
|
|
238
185
|
* @description: 获取选中数据的keys集合
|
|
@@ -253,8 +200,8 @@ class $ {
|
|
|
253
200
|
* @param {TtSelectRowsType[]} rows 选中的数据
|
|
254
201
|
* @param {TtSelectRowKeysType[]} keys 选中的数据keys
|
|
255
202
|
*/
|
|
256
|
-
setSelectedRowKeys(
|
|
257
|
-
this.methods.setSelectedRowKeys(
|
|
203
|
+
setSelectedRowKeys(t, e) {
|
|
204
|
+
this.methods.setSelectedRowKeys(t, e);
|
|
258
205
|
}
|
|
259
206
|
/**
|
|
260
207
|
* @description: 清除全部行选择
|
|
@@ -266,8 +213,8 @@ class $ {
|
|
|
266
213
|
* 往表格插入临时数据,从第一行新增一行或多行新数据
|
|
267
214
|
* @param records 新数据
|
|
268
215
|
*/
|
|
269
|
-
async insert(
|
|
270
|
-
return await this.methods.insert(
|
|
216
|
+
async insert(t) {
|
|
217
|
+
return await this.methods.insert(t);
|
|
271
218
|
}
|
|
272
219
|
/**
|
|
273
220
|
* 往表格指定行中插入临时数据
|
|
@@ -277,15 +224,31 @@ class $ {
|
|
|
277
224
|
* @param {Object/Array} records 新的数据
|
|
278
225
|
* @param {Row} row 指定行
|
|
279
226
|
*/
|
|
280
|
-
async insertAt(
|
|
281
|
-
return await this.methods.insertAt(
|
|
227
|
+
async insertAt(t, e) {
|
|
228
|
+
return await this.methods.insertAt(t, e);
|
|
229
|
+
}
|
|
230
|
+
/** 在指定行之后插入临时数据 */
|
|
231
|
+
async insertNextAt(t, e) {
|
|
232
|
+
return await this.methods.insertNextAt(t, e);
|
|
233
|
+
}
|
|
234
|
+
/** 在树节点下插入临时子数据 */
|
|
235
|
+
async insertChild(t, e) {
|
|
236
|
+
return await this.methods.insertChild(t, e);
|
|
237
|
+
}
|
|
238
|
+
/** 在树节点下的指定位置插入临时子数据 */
|
|
239
|
+
async insertChildAt(t, e, s) {
|
|
240
|
+
return await this.methods.insertChildAt(t, e, s);
|
|
241
|
+
}
|
|
242
|
+
/** 在树节点下的指定行之后插入临时子数据 */
|
|
243
|
+
async insertChildNextAt(t, e, s) {
|
|
244
|
+
return await this.methods.insertChildNextAt(t, e, s);
|
|
282
245
|
}
|
|
283
246
|
/**
|
|
284
247
|
* 删除指定行数据,指定 row 或 [row, ...] 删除多条数据,如果为空则删除所有数据
|
|
285
248
|
* @param rows 指定行
|
|
286
249
|
*/
|
|
287
|
-
async remove(
|
|
288
|
-
return await this.methods.remove(
|
|
250
|
+
async remove(t) {
|
|
251
|
+
return await this.methods.remove(t);
|
|
289
252
|
}
|
|
290
253
|
/**
|
|
291
254
|
* 删除复选框选中的行数据
|
|
@@ -305,48 +268,73 @@ class $ {
|
|
|
305
268
|
async removeCurrentRow() {
|
|
306
269
|
return await this.methods.removeCurrentRow();
|
|
307
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* 删除所有新增的临时数据
|
|
273
|
+
*/
|
|
274
|
+
async removeInsertRow() {
|
|
275
|
+
return await this.methods.removeInsertRow();
|
|
276
|
+
}
|
|
277
|
+
/** 清除表格的全部数据状态 */
|
|
278
|
+
async clearAll() {
|
|
279
|
+
return await this.methods.clearAll();
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 重新加载 VXE 当前同步数据。
|
|
283
|
+
* @deprecated VXE 已废弃 syncData,请使用 reloadData 或 getDataSource。
|
|
284
|
+
*/
|
|
285
|
+
async syncData() {
|
|
286
|
+
return await this.methods.syncData();
|
|
287
|
+
}
|
|
288
|
+
/** 重新计算 VXE 的数据视图 */
|
|
289
|
+
async updateData() {
|
|
290
|
+
return await this.methods.updateData();
|
|
291
|
+
}
|
|
292
|
+
/** 修改指定行数据 */
|
|
293
|
+
async setRow(t, e) {
|
|
294
|
+
return await this.methods.setRow(t, e);
|
|
295
|
+
}
|
|
308
296
|
/**
|
|
309
297
|
* 清除编辑状态并重置数据
|
|
310
298
|
*/
|
|
311
|
-
clearEditRevertData(
|
|
312
|
-
this.methods.clearEditRevertData(
|
|
299
|
+
clearEditRevertData(t) {
|
|
300
|
+
this.methods.clearEditRevertData(t);
|
|
313
301
|
}
|
|
314
302
|
/**
|
|
315
303
|
* 指定行激活编辑
|
|
316
|
-
* @param {
|
|
304
|
+
* @param {Row} row 行数据
|
|
317
305
|
* @param {string | VxeTableDefines.ColumnInfo} fieldOrColumn 列配置可以时field
|
|
318
306
|
*/
|
|
319
|
-
setEditRow(
|
|
320
|
-
this.methods.setEditRow(
|
|
307
|
+
setEditRow(t, e) {
|
|
308
|
+
this.methods.setEditRow(t, e);
|
|
321
309
|
}
|
|
322
310
|
/**
|
|
323
311
|
* 指定单元格激活编辑
|
|
324
|
-
* @param {
|
|
312
|
+
* @param {Row} row 当前行数据
|
|
325
313
|
* @param {string | VxeTableDefines.ColumnInfo} fieldOrColumn 列配置可以时field
|
|
326
314
|
*/
|
|
327
|
-
setEditCell(
|
|
328
|
-
this.methods.setEditCell(
|
|
315
|
+
setEditCell(t, e) {
|
|
316
|
+
this.methods.setEditCell(t, e);
|
|
329
317
|
}
|
|
330
318
|
/**
|
|
331
319
|
* 加载数据
|
|
332
320
|
* @param data 数据
|
|
333
321
|
*/
|
|
334
|
-
async loadData(
|
|
335
|
-
return await this.methods.loadData(
|
|
322
|
+
async loadData(t) {
|
|
323
|
+
return await this.methods.loadData(t);
|
|
336
324
|
}
|
|
337
325
|
/**
|
|
338
326
|
* 加载数据并恢复到初始状态
|
|
339
327
|
* @param data 数据
|
|
340
328
|
*/
|
|
341
|
-
async reloadData(
|
|
342
|
-
return await this.methods.reloadData(
|
|
329
|
+
async reloadData(t) {
|
|
330
|
+
return await this.methods.reloadData(t);
|
|
343
331
|
}
|
|
344
332
|
/**
|
|
345
333
|
* 重新加载列
|
|
346
334
|
* @param columns 列对象
|
|
347
335
|
*/
|
|
348
|
-
async reloadColumn(
|
|
349
|
-
return await this.methods.reloadColumn(
|
|
336
|
+
async reloadColumn(t) {
|
|
337
|
+
return await this.methods.reloadColumn(t);
|
|
350
338
|
}
|
|
351
339
|
/**
|
|
352
340
|
* 局部加载行数据并恢复到初始状态
|
|
@@ -354,44 +342,89 @@ class $ {
|
|
|
354
342
|
* @param record 新数据
|
|
355
343
|
* @param field 指定字段名
|
|
356
344
|
*/
|
|
357
|
-
async reloadRow(
|
|
358
|
-
return await this.methods.reloadRow(
|
|
345
|
+
async reloadRow(t, e, s) {
|
|
346
|
+
return await this.methods.reloadRow(t, e, s);
|
|
347
|
+
}
|
|
348
|
+
/** 还原 keep-source 保存的行数据 */
|
|
349
|
+
async revertData(t, e) {
|
|
350
|
+
return await this.methods.revertData(t, e);
|
|
351
|
+
}
|
|
352
|
+
/** 加载树节点的子数据 */
|
|
353
|
+
async loadTreeChildren(t, e) {
|
|
354
|
+
return await this.methods.loadTreeChildren(t, e);
|
|
359
355
|
}
|
|
360
356
|
/**
|
|
361
357
|
* 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
|
|
362
358
|
* @param data 指定行
|
|
363
359
|
* @param field 字段名
|
|
364
360
|
*/
|
|
365
|
-
async clearData(
|
|
366
|
-
return await this.methods.clearData(
|
|
361
|
+
async clearData(t, e) {
|
|
362
|
+
return await this.methods.clearData(t, e);
|
|
363
|
+
}
|
|
364
|
+
/** 移动行到指定行位置 */
|
|
365
|
+
async moveRowTo(t, e, s) {
|
|
366
|
+
return await this.methods.moveRowTo(t, e, s);
|
|
367
|
+
}
|
|
368
|
+
/** 撤销最近一次数据操作 */
|
|
369
|
+
async undo() {
|
|
370
|
+
return await this.methods.undo();
|
|
371
|
+
}
|
|
372
|
+
/** 重做最近一次数据操作 */
|
|
373
|
+
async redo() {
|
|
374
|
+
return await this.methods.redo();
|
|
367
375
|
}
|
|
368
376
|
/**
|
|
369
377
|
* 重新懒加载展开行,并展开内容
|
|
370
378
|
* @param row 指定行
|
|
371
379
|
*/
|
|
372
|
-
reloadRowExpand(
|
|
373
|
-
this.methods.reloadRowExpand(
|
|
380
|
+
async reloadRowExpand(t) {
|
|
381
|
+
return await this.methods.reloadRowExpand(t);
|
|
374
382
|
}
|
|
375
383
|
/**
|
|
376
384
|
* 重新懒加载树节点,并展开该节点
|
|
377
385
|
* @param row 指定行
|
|
378
386
|
*/
|
|
379
|
-
reloadTreeExpand(
|
|
380
|
-
this.methods.
|
|
387
|
+
async reloadTreeExpand(t) {
|
|
388
|
+
return await this.methods.reloadTreeExpand(t);
|
|
381
389
|
}
|
|
382
390
|
/** 获取表格实例 */
|
|
383
391
|
getTableInstance() {
|
|
384
392
|
return this.grid;
|
|
385
393
|
}
|
|
386
394
|
/**
|
|
387
|
-
*
|
|
388
|
-
* @param
|
|
395
|
+
* 校验表格编辑数据
|
|
396
|
+
* @param isFull true 时校验全部行并收集所有错误,缺省或 false 时遇到第一个错误即停止
|
|
397
|
+
* @returns 全部通过时为 undefined,否则为 vxe 原生形状的错误映射(以列字段为键)
|
|
398
|
+
*/
|
|
399
|
+
async validate(t) {
|
|
400
|
+
return await this.methods.validate(t);
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* 校验指定行的指定字段
|
|
404
|
+
* @param row 行数据
|
|
405
|
+
* @param field 列字段名
|
|
406
|
+
*/
|
|
407
|
+
async validateField(t, e) {
|
|
408
|
+
return await this.methods.validateField(t, e);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* 设置空数据提示文字
|
|
412
|
+
* @param text 提示文字
|
|
413
|
+
*/
|
|
414
|
+
setEmptyText(t) {
|
|
415
|
+
this.methods.setEmptyText(t);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* 绑定组件内的响应式状态源
|
|
419
|
+
*
|
|
420
|
+
* 直接持有组件的 ref,读取时才取值,避免用 watch 把状态同步到 api 上。
|
|
421
|
+
* @param sources 状态源
|
|
389
422
|
*/
|
|
390
|
-
|
|
391
|
-
this.
|
|
423
|
+
bindState(t) {
|
|
424
|
+
this.stateSources.value = t;
|
|
392
425
|
}
|
|
393
426
|
}
|
|
394
427
|
export {
|
|
395
|
-
|
|
396
|
-
|
|
428
|
+
k as TableApi,
|
|
429
|
+
C as getDefaultState
|
|
397
430
|
};
|
|
@@ -13,37 +13,37 @@ import { Store } from '@tanstack/vue-store';
|
|
|
13
13
|
* api.reload()
|
|
14
14
|
* api.setFormProps({ ... })
|
|
15
15
|
*/
|
|
16
|
-
declare class TableFormApi {
|
|
16
|
+
declare class TableFormApi<Row = any> {
|
|
17
17
|
/** form 表单实例(FormApi) */
|
|
18
18
|
formApi: TtExtendedFormApi;
|
|
19
19
|
/** 表格 API 实例(TableApi) */
|
|
20
|
-
tableApi: TtTableExtendedTableApi
|
|
20
|
+
tableApi: TtTableExtendedTableApi<Row>;
|
|
21
21
|
/** vxe-grid 表格实例 */
|
|
22
22
|
grid: VxeGridInstance;
|
|
23
23
|
/** 当前表单+表格的 props 状态 */
|
|
24
|
-
state: null | TtTableFormProps
|
|
24
|
+
state: null | TtTableFormProps<Row>;
|
|
25
25
|
/** 表单操作方法集合(TableFormActionType) */
|
|
26
|
-
tableForm: TtTableFormActionType
|
|
26
|
+
tableForm: TtTableFormActionType<Row>;
|
|
27
27
|
/** 响应式 store,存储表单+表格的状态 */
|
|
28
|
-
store: Store<TtTableFormProps
|
|
28
|
+
store: Store<TtTableFormProps<Row>>;
|
|
29
29
|
private isMounted;
|
|
30
30
|
private stateHandler;
|
|
31
31
|
/**
|
|
32
32
|
* 构造函数,初始化 store、tableApi、状态等
|
|
33
33
|
* @param options 表单+表格配置项
|
|
34
34
|
*/
|
|
35
|
-
constructor(options?: TtTableFormProps);
|
|
35
|
+
constructor(options?: TtTableFormProps<Row>);
|
|
36
36
|
/**
|
|
37
37
|
* 组件挂载时调用,注入表单和表格实例
|
|
38
38
|
* @param instance 表单操作方法实例
|
|
39
39
|
* @param formApi 表单实例
|
|
40
40
|
*/
|
|
41
|
-
mount(instance: null | TtTableFormActionType
|
|
41
|
+
mount(instance: null | TtTableFormActionType<Row>, formApi: TtExtendedFormApi): void;
|
|
42
42
|
/**
|
|
43
43
|
* 更新表单+表格的数据
|
|
44
44
|
* @param stateOrFn 新状态或返回新状态的函数
|
|
45
45
|
*/
|
|
46
|
-
setState(stateOrFn: ((prev: TtTableFormProps) => Partial<TtTableFormProps
|
|
46
|
+
setState(stateOrFn: ((prev: TtTableFormProps<Row>) => Partial<TtTableFormProps<Row>>) | Partial<TtTableFormProps<Row>>): void;
|
|
47
47
|
/**
|
|
48
48
|
* 重新加载表格数据
|
|
49
49
|
* @param data 可选的查询参数
|
|
@@ -64,12 +64,12 @@ declare class TableFormApi {
|
|
|
64
64
|
/**
|
|
65
65
|
* 获取表格 API 实例
|
|
66
66
|
*/
|
|
67
|
-
tableInstance(): TtTableExtendedTableApi
|
|
67
|
+
tableInstance(): TtTableExtendedTableApi<Row>;
|
|
68
68
|
/**
|
|
69
69
|
* 设置表格属性
|
|
70
70
|
* @param props 表格属性
|
|
71
71
|
*/
|
|
72
|
-
setTableProps(props: Partial<TtTableProps
|
|
72
|
+
setTableProps(props: Partial<TtTableProps<Row>>): void;
|
|
73
73
|
/**
|
|
74
74
|
* 设置表单属性
|
|
75
75
|
* @param props 表单属性
|
|
@@ -79,7 +79,7 @@ declare class TableFormApi {
|
|
|
79
79
|
* 设置表单+表格属性
|
|
80
80
|
* @param props 属性
|
|
81
81
|
*/
|
|
82
|
-
setProps(props: Partial<TtTableFormProps
|
|
82
|
+
setProps(props: Partial<TtTableFormProps<Row>>): void;
|
|
83
83
|
/**
|
|
84
84
|
* 组件卸载时调用,重置挂载状态
|
|
85
85
|
*/
|