@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
@@ -0,0 +1,2 @@
1
+ /** 在下一帧统一整理所有表格操作列的焦点顺序。 */
2
+ export declare function scheduleNormalizeActionTabIndex(): void;
@@ -0,0 +1,50 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isUndefined as d, isServer as f } from "../../../../packages/utils/src/is.js";
4
+ import "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
+ let a;
16
+ function p() {
17
+ const u = Array.from(document.querySelectorAll('[class*="table-action"]')), r = /* @__PURE__ */ new Map();
18
+ u.forEach((n) => {
19
+ const o = n.closest(".vxe-table");
20
+ if (!o) return;
21
+ const s = n.getBoundingClientRect(), t = Math.round(s.top), e = r.get(o) || /* @__PURE__ */ new Map(), i = e.get(t) || [];
22
+ i.push(n), e.set(t, i), r.set(o, e);
23
+ }), r.forEach((n) => {
24
+ n.forEach((o) => {
25
+ const s = o.sort((t, e) => {
26
+ const i = t.closest(".vxe-table"), c = e.closest(".vxe-table"), l = i != null && i.classList.contains("is--fixed-right") ? 1 : 0, m = c != null && c.classList.contains("is--fixed-right") ? 1 : 0;
27
+ return l !== m ? m - l : e.getBoundingClientRect().left - t.getBoundingClientRect().left;
28
+ })[0];
29
+ o.forEach((t) => {
30
+ t.querySelectorAll("[data-table-action-button]").forEach((e) => {
31
+ e.tabIndex = t === s ? 0 : -1;
32
+ });
33
+ });
34
+ });
35
+ });
36
+ }
37
+ function B() {
38
+ if (d(a)) {
39
+ if (f || !window.requestAnimationFrame) {
40
+ p();
41
+ return;
42
+ }
43
+ a = window.requestAnimationFrame(() => {
44
+ a = void 0, p();
45
+ });
46
+ }
47
+ }
48
+ export {
49
+ B as scheduleNormalizeActionTabIndex
50
+ };
@@ -1,17 +1,30 @@
1
- import { inject as r, provide as c } from "vue";
2
- function s(t, u) {
3
- const i = `${t}Context`, e = Symbol(i);
4
- return [(n) => {
5
- const o = r(e, n);
6
- if (o || o === null) return o;
1
+ import { inject as s, provide as c } from "vue";
2
+ import "axios";
3
+ import "element-plus";
4
+ import { isString as m, isArray as p } from "../../../../packages/utils/src/is.js";
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
+ function f(t, r) {
16
+ const e = m(t) && !r ? `${t}Context` : r, n = Symbol(e);
17
+ return [(o) => {
18
+ const i = s(n, o);
19
+ if (i || i === null) return i;
7
20
  throw new Error(
8
- `Injection \`${e.toString()}\` not found. Component must be used within ${Array.isArray(t) ? `one of the following components: ${t.join(", ")}` : `\`${t}\``}`
21
+ `Injection \`${n.toString()}\` not found. Component must be used within ${p(t) ? `one of the following components: ${t.join(", ")}` : `\`${t}\``}`
9
22
  );
10
- }, (n) => (c(e, n), n)];
23
+ }, (o) => (c(n, o), o)];
11
24
  }
12
- const [d, l] = s("FormActionTestIds");
25
+ const [T, D] = f("FormActionTestIds");
13
26
  export {
14
- s as createContext,
15
- d as injectFormActionTestIds,
16
- l as provideFormActionTestIds
27
+ f as createContext,
28
+ T as injectFormActionTestIds,
29
+ D as provideFormActionTestIds
17
30
  };
@@ -1,52 +1,63 @@
1
- import { VxeGridInstance, VxeGridPropTypes, VxeTableDefines, VxeTablePropTypes } from 'vxe-table';
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ import { VxeGridInstance, VxeGridPropTypes, VxeTableDefines } from 'vxe-table';
3
+ import { Recordable } from '../../../../../../utils/src';
2
4
  import { FetchParams, TtSelectRowKeysType, TtSelectRowsType, TtTableMethods, TtTableProps } from '../types/table';
3
5
  import { Store } from '@tanstack/vue-store';
4
- type ProxyStateType = {
5
- loading?: boolean;
6
- selectedKeys?: TtSelectRowKeysType;
7
- isTableEvent?: boolean;
8
- selectedRows?: TtSelectRowsType;
6
+ /** 组件内交给 api 的响应式状态源 */
7
+ type StateSources = {
8
+ loading: MaybeRefOrGetter<boolean | undefined>;
9
+ selectedKeys: MaybeRefOrGetter<TtSelectRowKeysType>;
10
+ selectedRows: MaybeRefOrGetter<TtSelectRowsType>;
9
11
  };
12
+ /**
13
+ * hook 方式(`useTableRender()` / `useTableFormRender()`)的表格默认配置。
14
+ *
15
+ * 共用部分取自 `createSharedTableDefaults()`(`src/table-defaults.ts`),这里只补 hook 方式独有的字段。
16
+ * 导出名保留不变,`table-form-api.ts` 在引用。
17
+ * @returns 每次调用都是新对象
18
+ */
10
19
  export declare function getDefaultState(): TtTableProps;
11
20
  /**
12
21
  * TableApi 表格组件的 API 封装类
13
22
  *
14
23
  * 用于统一管理表格的实例、状态、方法,便于外部操作。
24
+ * `Row` 是业务行数据类型,由 `useTableRender<Row>()` 传入后 `getDataSource()`、
25
+ * `insert()`、`setRow()` 这些方法的签名会跟着推断;不传时退化为 `any`。
15
26
  *
16
27
  * @example
17
28
  * const api = new TableApi({ ...配置 })
18
29
  * api.reload()
19
30
  * api.setProps({ ... })
20
31
  */
21
- declare class TableApi {
32
+ declare class TableApi<Row = any> {
22
33
  /** vxe-grid 表格实例 */
23
34
  grid: VxeGridInstance;
24
35
  /** 表格操作方法集合(TtTableMethods) */
25
- methods: TtTableMethods;
36
+ methods: TtTableMethods<Row>;
26
37
  /** 当前表格的 props 状态 */
27
- state: null | TtTableProps;
38
+ state: null | TtTableProps<Row>;
28
39
  /** 响应式 store,存储表格的状态 */
29
- store: Store<TtTableProps>;
30
- /** 响应式代理状态(loading、selectedKeys) */
31
- private proxyState;
40
+ store: Store<TtTableProps<Row>>;
41
+ /** 组件内的响应式状态源(loading、行选择),挂载时由组件交进来 */
42
+ private stateSources;
32
43
  private isMounted;
33
44
  private stateHandler;
34
45
  /**
35
46
  * 构造函数,初始化 store、状态等
36
47
  * @param options 表格配置项
37
48
  */
38
- constructor(options?: TtTableProps);
49
+ constructor(options?: TtTableProps<Row>);
39
50
  /**
40
51
  * 组件挂载时调用,注入表格实例和方法
41
52
  * @param instance vxe-grid 实例
42
53
  * @param methods 表格操作方法
43
54
  */
44
- mount(instance: undefined | VxeGridInstance, methods: TtTableMethods): void;
55
+ mount(instance: undefined | VxeGridInstance, methods: TtTableMethods<Row>): void;
45
56
  /**
46
57
  * 更新表格的状态
47
58
  * @param stateOrFn 新状态或返回新状态的函数
48
59
  */
49
- setState(stateOrFn: ((prev: TtTableProps) => Partial<TtTableProps>) | Partial<TtTableProps>): void;
60
+ setState(stateOrFn: ((prev: TtTableProps<Row>) => Partial<TtTableProps<Row>>) | Partial<TtTableProps<Row>>): void;
50
61
  /**
51
62
  * 组件卸载时调用,重置挂载状态
52
63
  */
@@ -61,7 +72,7 @@ declare class TableApi {
61
72
  * @description: 设置表格props
62
73
  * @param {Partial<TtTableProps>} props 表格props
63
74
  */
64
- setProps(props: Partial<TtTableProps>): void;
75
+ setProps(props: Partial<TtTableProps<Row>>): void;
65
76
  /**
66
77
  * @description: 重新计算高度
67
78
  * @return {*}
@@ -72,17 +83,17 @@ declare class TableApi {
72
83
  * @param {VxeGridPropTypes.Columns<DT>} columns columns
73
84
  * @return {*}
74
85
  */
75
- setTableColumns(columns: VxeGridPropTypes.Columns<VxeTablePropTypes.Row>): void;
86
+ setTableColumns(columns: VxeGridPropTypes.Columns<Row>): void;
76
87
  /**
77
88
  * @description: 获取表格columns
78
89
  * @return {VxeGridPropTypes.Columns<DT> | undefined}
79
90
  */
80
- getTableColumns(): VxeGridPropTypes.Columns<VxeTablePropTypes.Row> | undefined;
91
+ getTableColumns(): VxeGridPropTypes.Columns<Row> | undefined;
81
92
  /**
82
93
  * @description: 获取表格数据
83
94
  * @return {DT[]}
84
95
  */
85
- getDataSource(): VxeTablePropTypes.Row[];
96
+ getDataSource(): Row[];
86
97
  /**
87
98
  * @description: 设置表格loading
88
99
  * @param {boolean} loading
@@ -97,7 +108,7 @@ declare class TableApi {
97
108
  * @description: 设置表格pagination
98
109
  * @param {Partial<VxeGridPropTypes.PagerConfig>} props 表格pagination
99
110
  */
100
- setPagination(props: VxeGridPropTypes.PagerConfig): void;
111
+ setPagination(props: Partial<VxeGridPropTypes.PagerConfig>): void;
101
112
  /**
102
113
  * @description: 获取选中数据的keys集合
103
114
  * @return {Array<string>}
@@ -122,9 +133,9 @@ declare class TableApi {
122
133
  * 往表格插入临时数据,从第一行新增一行或多行新数据
123
134
  * @param records 新数据
124
135
  */
125
- insert(records: VxeTablePropTypes.Row): Promise<{
126
- row: VxeTablePropTypes.Row;
127
- rows: VxeTablePropTypes.Row[];
136
+ insert(records: Row): Promise<{
137
+ row: Row;
138
+ rows: Row[];
128
139
  }>;
129
140
  /**
130
141
  * 往表格指定行中插入临时数据
@@ -134,65 +145,103 @@ declare class TableApi {
134
145
  * @param {Object/Array} records 新的数据
135
146
  * @param {Row} row 指定行
136
147
  */
137
- insertAt(records: VxeTablePropTypes.Row, row: VxeTablePropTypes.Row | -1 | null): Promise<{
138
- row: VxeTablePropTypes.Row;
139
- rows: VxeTablePropTypes.Row[];
148
+ insertAt(records: Row, row: Row | -1 | null): Promise<{
149
+ row: Row;
150
+ rows: Row[];
151
+ }>;
152
+ /** 在指定行之后插入临时数据 */
153
+ insertNextAt(records: Row, row: Row | -1 | null): Promise<{
154
+ row: Row;
155
+ rows: Row[];
156
+ }>;
157
+ /** 在树节点下插入临时子数据 */
158
+ insertChild(records: Row, parentRow: Row): Promise<{
159
+ row: Row;
160
+ rows: Row[];
161
+ }>;
162
+ /** 在树节点下的指定位置插入临时子数据 */
163
+ insertChildAt(records: Row, parentRow: Row, row: Row | -1 | null): Promise<{
164
+ row: Row;
165
+ rows: Row[];
166
+ }>;
167
+ /** 在树节点下的指定行之后插入临时子数据 */
168
+ insertChildNextAt(records: Row, parentRow: Row, row: Row | -1 | null): Promise<{
169
+ row: Row;
170
+ rows: Row[];
140
171
  }>;
141
172
  /**
142
173
  * 删除指定行数据,指定 row 或 [row, ...] 删除多条数据,如果为空则删除所有数据
143
174
  * @param rows 指定行
144
175
  */
145
- remove(rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[]): Promise<{
146
- row: VxeTablePropTypes.Row;
147
- rows: VxeTablePropTypes.Row[];
176
+ remove(rows: Row | Row[]): Promise<{
177
+ row: Row;
178
+ rows: Row[];
148
179
  }>;
149
180
  /**
150
181
  * 删除复选框选中的行数据
151
182
  */
152
183
  removeCheckboxRow(): Promise<{
153
- row: VxeTablePropTypes.Row;
154
- rows: VxeTablePropTypes.Row[];
184
+ row: Row;
185
+ rows: Row[];
155
186
  }>;
156
187
  /**
157
188
  * 删除单选框选中的行数据
158
189
  */
159
190
  removeRadioRow(): Promise<{
160
- row: VxeTablePropTypes.Row;
161
- rows: VxeTablePropTypes.Row[];
191
+ row: Row;
192
+ rows: Row[];
162
193
  }>;
163
194
  /**
164
195
  * 删除当前行选中的行数据
165
196
  */
166
197
  removeCurrentRow(): Promise<{
167
- row: VxeTablePropTypes.Row;
168
- rows: VxeTablePropTypes.Row[];
198
+ row: Row;
199
+ rows: Row[];
169
200
  }>;
201
+ /**
202
+ * 删除所有新增的临时数据
203
+ */
204
+ removeInsertRow(): Promise<{
205
+ row: Row;
206
+ rows: Row[];
207
+ }>;
208
+ /** 清除表格的全部数据状态 */
209
+ clearAll(): Promise<void>;
210
+ /**
211
+ * 重新加载 VXE 当前同步数据。
212
+ * @deprecated VXE 已废弃 syncData,请使用 reloadData 或 getDataSource。
213
+ */
214
+ syncData(): Promise<void>;
215
+ /** 重新计算 VXE 的数据视图 */
216
+ updateData(): Promise<void>;
217
+ /** 修改指定行数据 */
218
+ setRow(rows: Row | Row[], record: Row): Promise<void>;
170
219
  /**
171
220
  * 清除编辑状态并重置数据
172
221
  */
173
- clearEditRevertData(records: VxeTablePropTypes.Row): void;
222
+ clearEditRevertData(records: Row): void;
174
223
  /**
175
224
  * 指定行激活编辑
176
- * @param {VxeTablePropTypes.Row} row 行数据
225
+ * @param {Row} row 行数据
177
226
  * @param {string | VxeTableDefines.ColumnInfo} fieldOrColumn 列配置可以时field
178
227
  */
179
- setEditRow(row: VxeTablePropTypes.Row, fieldOrColumn?: boolean | string | VxeTableDefines.ColumnInfo): void;
228
+ setEditRow(row: Row, fieldOrColumn?: boolean | string | VxeTableDefines.ColumnInfo): void;
180
229
  /**
181
230
  * 指定单元格激活编辑
182
- * @param {VxeTablePropTypes.Row} row 当前行数据
231
+ * @param {Row} row 当前行数据
183
232
  * @param {string | VxeTableDefines.ColumnInfo} fieldOrColumn 列配置可以时field
184
233
  */
185
- setEditCell(row: VxeTablePropTypes.Row, fieldOrColumn: string | VxeTableDefines.ColumnInfo): void;
234
+ setEditCell(row: Row, fieldOrColumn: string | VxeTableDefines.ColumnInfo): void;
186
235
  /**
187
236
  * 加载数据
188
237
  * @param data 数据
189
238
  */
190
- loadData(data: VxeTablePropTypes.Row[]): Promise<any>;
239
+ loadData(data: Row[]): Promise<any>;
191
240
  /**
192
241
  * 加载数据并恢复到初始状态
193
242
  * @param data 数据
194
243
  */
195
- reloadData(data: VxeTablePropTypes.Row[]): Promise<void>;
244
+ reloadData(data: Row[]): Promise<void>;
196
245
  /**
197
246
  * 重新加载列
198
247
  * @param columns 列对象
@@ -204,47 +253,76 @@ declare class TableApi {
204
253
  * @param record 新数据
205
254
  * @param field 指定字段名
206
255
  */
207
- reloadRow(rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], record?: VxeTablePropTypes.Row, field?: string): Promise<void>;
256
+ reloadRow(rows: Row | Row[], record?: Row, field?: string): Promise<void>;
257
+ /** 还原 keep-source 保存的行数据 */
258
+ revertData(rows?: Row | Row[], field?: string): Promise<any>;
259
+ /** 加载树节点的子数据 */
260
+ loadTreeChildren(row: Row, children: Row[]): Promise<any[]>;
208
261
  /**
209
262
  * 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
210
263
  * @param data 指定行
211
264
  * @param field 字段名
212
265
  */
213
- clearData(data?: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], field?: string): Promise<any>;
266
+ clearData(data?: Row | Row[], field?: string): Promise<any>;
267
+ /** 移动行到指定行位置 */
268
+ moveRowTo(row: Row | string | number, targetRow: Row | string | number, options?: Recordable): Promise<{
269
+ status: boolean;
270
+ }>;
271
+ /** 撤销最近一次数据操作 */
272
+ undo(): Promise<{
273
+ status: boolean;
274
+ }>;
275
+ /** 重做最近一次数据操作 */
276
+ redo(): Promise<{
277
+ status: boolean;
278
+ }>;
214
279
  /**
215
280
  * 重新懒加载展开行,并展开内容
216
281
  * @param row 指定行
217
282
  */
218
- reloadRowExpand(row: VxeTablePropTypes.Row): void;
283
+ reloadRowExpand(row: Row): Promise<void>;
219
284
  /**
220
285
  * 重新懒加载树节点,并展开该节点
221
286
  * @param row 指定行
222
287
  */
223
- reloadTreeExpand(row: VxeTablePropTypes.Row): void;
288
+ reloadTreeExpand(row: Row): Promise<any>;
224
289
  /** 获取表格实例 */
225
290
  getTableInstance(): VxeGridInstance;
226
291
  /**
227
- * 设置代理状态(loading、selectedKeys)
228
- * @param state 代理状态对象
292
+ * 校验表格编辑数据
293
+ * @param isFull true 时校验全部行并收集所有错误,缺省或 false 时遇到第一个错误即停止
294
+ * @returns 全部通过时为 undefined,否则为 vxe 原生形状的错误映射(以列字段为键)
229
295
  */
230
- setProxyState(state: ProxyStateType): void;
296
+ validate(isFull?: boolean): Promise<VxeTableDefines.ValidatorErrorMapParams<any> | undefined>;
231
297
  /**
232
- * @description: 获取表格选中数据
233
- * @return {DT[]}
298
+ * 校验指定行的指定字段
299
+ * @param row 行数据
300
+ * @param field 列字段名
301
+ */
302
+ validateField(row: Row, field: string): Promise<VxeTableDefines.ValidatorErrorMapParams<any> | undefined>;
303
+ /**
304
+ * 设置空数据提示文字
305
+ * @param text 提示文字
306
+ */
307
+ setEmptyText(text: string): void;
308
+ /**
309
+ * 绑定组件内的响应式状态源
310
+ *
311
+ * 直接持有组件的 ref,读取时才取值,避免用 watch 把状态同步到 api 上。
312
+ * @param sources 状态源
313
+ */
314
+ bindState(sources: StateSources): void;
315
+ /**
316
+ * @description: 获取表格选中数据的keys(响应式)
234
317
  */
235
318
  selectedKeys: import('vue').ComputedRef<any>;
236
319
  /**
237
- * @description: 获取表格选中数据
238
- * @return {DT[]}
320
+ * @description: 获取表格选中数据(响应式)
239
321
  */
240
322
  selectedRows: import('vue').ComputedRef<any>;
241
323
  /**
242
324
  * 获取表格 loading 状态(响应式)
243
325
  */
244
- getLoading: import('vue').ComputedRef<boolean | undefined>;
245
- /**
246
- * 是否使用表格的event
247
- */
248
- getIsTableEvent: import('vue').ComputedRef<boolean | undefined>;
326
+ getLoading: import('vue').ComputedRef<boolean>;
249
327
  }
250
328
  export { TableApi };