@taocompany/magic-grid 0.6.0 → 0.6.2
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/README.md +33 -10
- package/dist/components/MagicGrid/MagicGrid.vue.d.ts +24 -24
- package/dist/core/event/projectGridEvent.d.ts.map +1 -1
- package/dist/core/grid/cellEditing/lifecycle.d.ts.map +1 -1
- package/dist/core/grid/cellEditing/startEditing.d.ts.map +1 -1
- package/dist/core/grid/cellEditing/validation.d.ts.map +1 -1
- package/dist/core/grid/grid.d.ts.map +1 -1
- package/dist/core/grid/gridInteraction/focusController.d.ts +2 -0
- package/dist/core/grid/gridInteraction/focusController.d.ts.map +1 -1
- package/dist/core/grid/gridInteraction/gridInteraction.d.ts +2 -0
- package/dist/core/grid/gridInteraction/gridInteraction.d.ts.map +1 -1
- package/dist/core/types/events.d.ts +306 -31
- package/dist/core/types/events.d.ts.map +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2799 -2760
- package/dist/index.es.js.map +1 -1
- package/dist/types/core.d.ts +267 -30
- package/package.json +1 -1
package/dist/types/core.d.ts
CHANGED
|
@@ -69,8 +69,11 @@ export declare interface AsyncRowMutationUpdateParams {
|
|
|
69
69
|
|
|
70
70
|
export declare type AutoSizeStrategy = SizeColumnsToFitGridStrategy | SizeColumnsToFitProvidedWidthStrategy | SizeColumnsToContentStrategy;
|
|
71
71
|
|
|
72
|
+
/** 表体滚动时触发。MagicGrid:`@scroll`(payload 为 `GridMetrics`,非本类型);Api:`bodyScroll`。 */
|
|
72
73
|
export declare interface BodyScrollEvent {
|
|
74
|
+
/** 纵向滚动位置(px) */
|
|
73
75
|
scrollTop: number;
|
|
76
|
+
/** 横向滚动位置(px) */
|
|
74
77
|
scrollLeft: number;
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -80,11 +83,25 @@ export declare type BuiltInCellEditor = 'text' | 'number' | 'checkbox' | 'switch
|
|
|
80
83
|
/** 对外 API / 事件 rowId:与用户 data[rowKey] 同型;临时行无业务主键时为 null */
|
|
81
84
|
export declare type BusinessRowId = RowId | null;
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
/**
|
|
87
|
+
* 表体单元格 **mousedown** 时触发(含框选、索引/选择列纵向拖选等交互的起点)。
|
|
88
|
+
* MagicGrid:`@cell-clicked` · Api:`cellClicked`。
|
|
89
|
+
*
|
|
90
|
+
* 与 `rowClicked` 区别:本事件在 **按下** 时触发且覆盖所有表体格;`rowClick` 在 **click** 阶段且仅 leaf 数据行。
|
|
91
|
+
*/
|
|
92
|
+
export declare interface CellClickedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
93
|
+
/** 业务行 id */
|
|
84
94
|
rowId: BusinessRowId;
|
|
95
|
+
/** 被点击列 id */
|
|
85
96
|
colId: string;
|
|
97
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
86
98
|
rowIndex: number;
|
|
99
|
+
/** 内核行节点;大多数场景用 `data` 即可 */
|
|
87
100
|
rowNode: RowNode;
|
|
101
|
+
/** 行数据快照(与 `getData` 导出规则一致) */
|
|
102
|
+
data: TData;
|
|
103
|
+
/** 该格原始值(经 valueGetter,不含 formatter) */
|
|
104
|
+
value: TValue;
|
|
88
105
|
}
|
|
89
106
|
|
|
90
107
|
/** 单元格批注载荷 */
|
|
@@ -130,17 +147,33 @@ export declare type CellCommentSource = 'ui' | 'api';
|
|
|
130
147
|
|
|
131
148
|
export declare type CellCommentTrigger = 'hover' | 'click';
|
|
132
149
|
|
|
150
|
+
/**
|
|
151
|
+
* 单元格 **异步提交** 结束时触发。MagicGrid:`@cell-commit-finished` · Api:`cellCommitFinished`。
|
|
152
|
+
*/
|
|
133
153
|
export declare interface CellCommitFinishedEvent {
|
|
154
|
+
/** 业务行 id */
|
|
134
155
|
rowId: BusinessRowId;
|
|
156
|
+
/** 列 id */
|
|
135
157
|
colId: string;
|
|
158
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
136
159
|
rowIndex: number;
|
|
160
|
+
/** 是否成功提交并写回 */
|
|
137
161
|
committed: boolean;
|
|
162
|
+
/** 是否被 `cancelCommit()` 等中断 */
|
|
138
163
|
aborted?: boolean;
|
|
139
164
|
}
|
|
140
165
|
|
|
166
|
+
/**
|
|
167
|
+
* 单元格 **异步提交** 开始时触发(`asyncRowMutation` 等)。Api:`cellCommitStarted`。
|
|
168
|
+
*
|
|
169
|
+
* 在 `cellValueChanged` 之前,表示 commit 管线已进入 pending。
|
|
170
|
+
*/
|
|
141
171
|
export declare interface CellCommitStartedEvent {
|
|
172
|
+
/** 业务行 id */
|
|
142
173
|
rowId: BusinessRowId;
|
|
174
|
+
/** 列 id */
|
|
143
175
|
colId: string;
|
|
176
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
144
177
|
rowIndex: number;
|
|
145
178
|
}
|
|
146
179
|
|
|
@@ -156,20 +189,46 @@ export declare interface CellDisabledParams<TData = RowData> {
|
|
|
156
189
|
/** 编辑范围:单格编辑 vs 整行编辑 */
|
|
157
190
|
export declare type CellEditBehavior = 'cell' | 'row';
|
|
158
191
|
|
|
159
|
-
|
|
192
|
+
/**
|
|
193
|
+
* 单元格 **进入 overlay 编辑态** 时触发(不含 inline checkbox/switch 等无会话编辑器)。
|
|
194
|
+
* MagicGrid:`@cell-editing-started` · Api:`cellEditingStarted`。
|
|
195
|
+
*
|
|
196
|
+
* 行编辑(`editBehavior: 'row'`)时,一行内每个可编辑列各触发一次。
|
|
197
|
+
*/
|
|
198
|
+
export declare interface CellEditingStartedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
199
|
+
/** 业务行 id */
|
|
160
200
|
rowId: BusinessRowId;
|
|
201
|
+
/** 进入编辑的列 id */
|
|
161
202
|
colId: string;
|
|
203
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
162
204
|
rowIndex: number;
|
|
163
|
-
|
|
205
|
+
/** 进入编辑时的行数据快照 */
|
|
206
|
+
data: TData;
|
|
207
|
+
/** 进入编辑时该格原始值(经 valueGetter,不含 formatter) */
|
|
208
|
+
value: TValue;
|
|
164
209
|
}
|
|
165
210
|
|
|
166
|
-
|
|
211
|
+
/**
|
|
212
|
+
* 单元格 **退出 overlay 编辑态** 时触发(提交或取消)。MagicGrid:`@cell-editing-stopped`。
|
|
213
|
+
*
|
|
214
|
+
* - `committed: true`:用户确认提交(可能因校验失败而未写回,见 {@link CellValidationFailedEvent})
|
|
215
|
+
* - `committed: false`:Esc / `stopEditing(true)` 等取消;`newValue` 通常为 `undefined`
|
|
216
|
+
*/
|
|
217
|
+
export declare interface CellEditingStoppedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
218
|
+
/** 业务行 id */
|
|
167
219
|
rowId: BusinessRowId;
|
|
220
|
+
/** 列 id */
|
|
168
221
|
colId: string;
|
|
222
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
169
223
|
rowIndex: number;
|
|
224
|
+
/** 是否走提交路径结束(非 Esc 取消) */
|
|
170
225
|
committed: boolean;
|
|
171
|
-
|
|
172
|
-
|
|
226
|
+
/** 编辑开始前原始值 */
|
|
227
|
+
oldValue: TValue;
|
|
228
|
+
/** 提交后的新值;取消时多为 `undefined` */
|
|
229
|
+
newValue: TValue;
|
|
230
|
+
/** 结束编辑时的行数据快照(提交成功则为最新值) */
|
|
231
|
+
data: TData;
|
|
173
232
|
}
|
|
174
233
|
|
|
175
234
|
/** 列级 flag:`true` 启用 · `string` 固定 namespace · `false` 全局开启时 opt-out */
|
|
@@ -314,11 +373,24 @@ export declare type CellEditorStrategy = 'input' | 'overlay';
|
|
|
314
373
|
/** 进入编辑态的触发方式(单击 / 双击) */
|
|
315
374
|
export declare type CellEditType = 'singleClick' | 'doubleClick';
|
|
316
375
|
|
|
317
|
-
|
|
376
|
+
/**
|
|
377
|
+
* 键盘/指针导航导致 **焦点格** 变化时触发。Api:`cellFocused`(MagicGrid 未转发)。
|
|
378
|
+
*
|
|
379
|
+
* 表示当前获得输入焦点的单元格,不等同于 checkbox 选中或索引列定位。
|
|
380
|
+
*/
|
|
381
|
+
export declare interface CellFocusedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
382
|
+
/** 业务行 id */
|
|
318
383
|
rowId: BusinessRowId;
|
|
384
|
+
/** 获得焦点的列 id */
|
|
319
385
|
colId: string;
|
|
386
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
320
387
|
rowIndex: number;
|
|
388
|
+
/** 内核行节点 */
|
|
321
389
|
rowNode: RowNode;
|
|
390
|
+
/** 行数据快照(与 `getData` 导出规则一致) */
|
|
391
|
+
data: TData;
|
|
392
|
+
/** 焦点格原始值(经 valueGetter,不含 formatter) */
|
|
393
|
+
value: TValue;
|
|
322
394
|
}
|
|
323
395
|
|
|
324
396
|
/** CellSelectionOptions 层 handle 模式;默认 off */
|
|
@@ -468,11 +540,21 @@ export declare interface CellStyleParams<TData = RowData> {
|
|
|
468
540
|
column: Pick<Column, 'colId' | 'prop'>;
|
|
469
541
|
}
|
|
470
542
|
|
|
543
|
+
/**
|
|
544
|
+
* 单元格编辑 **校验失败** 时触发。MagicGrid:`@cell-validation-failed`。
|
|
545
|
+
*
|
|
546
|
+
* `mode` 对应 Grid `invalidEditValueMode`:`block` 阻止提交 / `revert` 回滚 / `keep` 保留输入并提示。
|
|
547
|
+
*/
|
|
471
548
|
export declare interface CellValidationFailedEvent {
|
|
549
|
+
/** 业务行 id */
|
|
472
550
|
rowId: BusinessRowId;
|
|
551
|
+
/** 列 id */
|
|
473
552
|
colId: string;
|
|
553
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
474
554
|
rowIndex: number;
|
|
555
|
+
/** 校验错误文案列表 */
|
|
475
556
|
errors: string[];
|
|
557
|
+
/** 当前 invalid 处理模式 */
|
|
476
558
|
mode: InvalidEditValueMode;
|
|
477
559
|
}
|
|
478
560
|
|
|
@@ -492,12 +574,25 @@ export declare type CellValidator = (params: CellEditorParams & {
|
|
|
492
574
|
signal: AbortSignal;
|
|
493
575
|
}) => ValidationErrors | Promise<ValidationErrors>;
|
|
494
576
|
|
|
495
|
-
|
|
577
|
+
/**
|
|
578
|
+
* 单元格值 **已成功写回** `row.data` 后触发(编辑提交、inline toggle、粘贴、框选填充/删除等)。
|
|
579
|
+
* MagicGrid:`@cell-value-changed` · Api:`cellValueChanged`。
|
|
580
|
+
*
|
|
581
|
+
* 仅在值实际变更时触发;取消编辑不会触发。行编辑模式下每列变更各触发一次。
|
|
582
|
+
*/
|
|
583
|
+
export declare interface CellValueChangedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
584
|
+
/** 业务行 id */
|
|
496
585
|
rowId: BusinessRowId;
|
|
586
|
+
/** 变更列 id */
|
|
497
587
|
colId: string;
|
|
498
|
-
|
|
499
|
-
|
|
588
|
+
/** 变更前原始值 */
|
|
589
|
+
oldValue: TValue;
|
|
590
|
+
/** 变更后原始值(已写入 `data`) */
|
|
591
|
+
newValue: TValue;
|
|
592
|
+
/** 内核行节点(含最新 `data`) */
|
|
500
593
|
rowNode: RowNode;
|
|
594
|
+
/** 变更后的行数据快照(与 `getData` 导出规则一致) */
|
|
595
|
+
data: TData;
|
|
501
596
|
}
|
|
502
597
|
|
|
503
598
|
/** 内置 checkbox 编辑器:自定义选中 / 未选中写回值 */
|
|
@@ -916,6 +1011,7 @@ export declare interface ColumnHiddenChangedEvent {
|
|
|
916
1011
|
|
|
917
1012
|
export declare type ColumnHiddenChangedSource = ColumnHiddenChangedEvent['source'];
|
|
918
1013
|
|
|
1014
|
+
/** 列拖拽重排时触发(含 drag 过程中的 live move)。MagicGrid:`@column-moved`。 */
|
|
919
1015
|
export declare interface ColumnMovedEvent {
|
|
920
1016
|
/** 移动后的完整 colId 顺序(含系统列) */
|
|
921
1017
|
columnOrder: string[];
|
|
@@ -1023,16 +1119,36 @@ export declare interface DetailRowSlotParams<TData = RowData> {
|
|
|
1023
1119
|
loadError?: unknown;
|
|
1024
1120
|
}
|
|
1025
1121
|
|
|
1122
|
+
/**
|
|
1123
|
+
* 编辑提交被 **主动中断** 时触发(如 `cancelCommit()`)。MagicGrid:`@edit-commit-aborted`。
|
|
1124
|
+
*
|
|
1125
|
+
* 字段均可选:全局中断时可能只有部分位置信息。
|
|
1126
|
+
*/
|
|
1026
1127
|
export declare interface EditCommitAbortedEvent {
|
|
1128
|
+
/** 被中断格的业务行 id */
|
|
1027
1129
|
rowId?: BusinessRowId;
|
|
1130
|
+
/** 被中断列 id */
|
|
1028
1131
|
colId?: string;
|
|
1132
|
+
/** 被中断格行下标 */
|
|
1029
1133
|
rowIndex?: number;
|
|
1030
1134
|
}
|
|
1031
1135
|
|
|
1032
|
-
|
|
1136
|
+
/**
|
|
1137
|
+
* `GridApi.getEditingCells()` 返回值元素类型:当前处于编辑会话中的单元格位置。
|
|
1138
|
+
*
|
|
1139
|
+
* 单格模式 0~1 条;行编辑模式为该行全部可编辑列。含 `data` / `value` 便于无需再查 rowNode。
|
|
1140
|
+
*/
|
|
1141
|
+
export declare interface EditingCellPosition<TData extends RowData = RowData, TValue = unknown> {
|
|
1142
|
+
/** 业务行 id */
|
|
1033
1143
|
rowId: BusinessRowId;
|
|
1144
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
1034
1145
|
rowIndex: number;
|
|
1146
|
+
/** 编辑中的列 id */
|
|
1035
1147
|
colId: string;
|
|
1148
|
+
/** 当前行数据快照 */
|
|
1149
|
+
data: TData;
|
|
1150
|
+
/** 该格当前原始值(经 valueGetter,不含 formatter) */
|
|
1151
|
+
value: TValue;
|
|
1036
1152
|
}
|
|
1037
1153
|
|
|
1038
1154
|
/** 编辑会话阶段 */
|
|
@@ -1065,9 +1181,11 @@ export declare type FillReverseStrategy = 'default' | 'clear';
|
|
|
1065
1181
|
/** Fill 默认策略:数字递增、非数字复制 */
|
|
1066
1182
|
export declare type FillStrategy = 'auto' | 'copy';
|
|
1067
1183
|
|
|
1184
|
+
/** 列筛选或 quick filter 变更后触发。MagicGrid:`@filter-changed`。 */
|
|
1068
1185
|
export declare interface FilterChangedEvent {
|
|
1186
|
+
/** 各列筛选模型 */
|
|
1069
1187
|
filterModel: FilterModel;
|
|
1070
|
-
/**
|
|
1188
|
+
/** Grid 级 quick filter 文本;未启用时为 `''` */
|
|
1071
1189
|
quickFilterText: string;
|
|
1072
1190
|
}
|
|
1073
1191
|
|
|
@@ -1544,8 +1662,15 @@ export declare interface GridDestroyedEvent {
|
|
|
1544
1662
|
reason: 'unmount' | 'reinit';
|
|
1545
1663
|
}
|
|
1546
1664
|
|
|
1665
|
+
/** 类型安全的事件 handler:`GridEventHandler<'cellClicked'>` → `(event: CellClickedEvent) => void` */
|
|
1547
1666
|
export declare type GridEventHandler<T extends GridEventType> = (event: GridEventMap[T]) => void;
|
|
1548
1667
|
|
|
1668
|
+
/**
|
|
1669
|
+
* 事件名 → payload 类型映射表。
|
|
1670
|
+
*
|
|
1671
|
+
* 用法:`api.on<'cellClicked'>('cellClicked', (e) => …)` 或 `GridEventHandler<'cellClicked'>`。
|
|
1672
|
+
* 定义在本文件以外的 payload(列宽、行拖拽、分组等)见各 `export type { … } from './…'`。
|
|
1673
|
+
*/
|
|
1549
1674
|
export declare interface GridEventMap {
|
|
1550
1675
|
gridReady: GridReadyEvent;
|
|
1551
1676
|
gridDestroyed: GridDestroyedEvent;
|
|
@@ -1600,6 +1725,7 @@ export declare interface GridEventMap {
|
|
|
1600
1725
|
overlayHidden: OverlayHiddenEvent;
|
|
1601
1726
|
}
|
|
1602
1727
|
|
|
1728
|
+
/** 全部 Grid 事件名;与 `GridEventMap` key 一一对应。 */
|
|
1603
1729
|
export declare type GridEventType = 'gridReady' | 'gridDestroyed' | 'firstRendered' | 'bodyScroll' | 'sortChanged' | 'filterChanged' | 'columnMoved' | 'columnResized' | 'columnPinned' | 'cellClicked' | 'rowClicked' | 'rowDoubleClicked' | 'cellFocused' | 'selectionChanged' | 'indexFocusChanged' | 'cellValueChanged' | 'cellEditingStarted' | 'cellEditingStopped' | 'rowEditingStarted' | 'rowEditingStopped' | 'rowValueChanged' | 'cellCommitStarted' | 'cellCommitFinished' | 'editCommitAborted' | 'rowCommitStarted' | 'rowCommitFinished' | 'cellValidationFailed' | 'rowValidationFailed' | 'rowsAdded' | 'rowsRemoved' | 'rowIdPromoted' | 'rowMoved' | 'rowDragEnd' | 'rowDragCommitStarted' | 'rowDragCommitFinished' | 'rowHeightChanged' | 'rowExpanded' | 'rowCollapsed' | 'rowGroupOpened' | 'rowGroupChanged' | 'treeNodeOpened' | 'treeChildrenLoading' | 'treeChildrenLoaded' | 'treeChildrenLoadFailed' | 'cellCommentChanged' | 'cellSelectionChanged' | 'cellSelectionDeleteStart' | 'cellSelectionDeleteEnd' | 'columnHiddenChanged' | 'overlayShown' | 'overlayHidden';
|
|
1604
1730
|
|
|
1605
1731
|
/** 水平对齐;默认 center */
|
|
@@ -1805,7 +1931,13 @@ export declare interface IndexColumnOptions {
|
|
|
1805
1931
|
enableRowResizer?: boolean;
|
|
1806
1932
|
}
|
|
1807
1933
|
|
|
1934
|
+
/**
|
|
1935
|
+
* 索引列辅助定位(index focus)变化时触发。MagicGrid:`@index-focus-changed`。
|
|
1936
|
+
*
|
|
1937
|
+
* 用于「当前高亮/定位到哪些行」,与 checkbox {@link SelectionChangedEvent} 独立。
|
|
1938
|
+
*/
|
|
1808
1939
|
export declare interface IndexFocusChangedEvent {
|
|
1940
|
+
/** 当前索引列辅助定位的行 id 列表 */
|
|
1809
1941
|
focusedRowIds: BusinessRowId[];
|
|
1810
1942
|
}
|
|
1811
1943
|
|
|
@@ -2440,37 +2572,72 @@ export declare interface ResolvedStatusBarRangeAggregationPrecision {
|
|
|
2440
2572
|
sum: number;
|
|
2441
2573
|
}
|
|
2442
2574
|
|
|
2443
|
-
/**
|
|
2444
|
-
|
|
2575
|
+
/**
|
|
2576
|
+
* 表体 **leaf 数据行** 单击(click 阶段)时触发;不含分组头、详情行、表尾汇总行。
|
|
2577
|
+
* MagicGrid:`@row-click` · Api:`rowClicked`。
|
|
2578
|
+
*
|
|
2579
|
+
* 典型用途:行级导航、打开侧栏、记录当前操作行。需要单元格值时用 `CellClickedEvent`。
|
|
2580
|
+
*/
|
|
2581
|
+
export declare interface RowClickedEvent<TData extends RowData = RowData> {
|
|
2582
|
+
/** 业务行 id */
|
|
2445
2583
|
rowId: BusinessRowId;
|
|
2584
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2446
2585
|
rowIndex: number;
|
|
2586
|
+
/** 内核行节点 */
|
|
2447
2587
|
rowNode: RowNode;
|
|
2448
|
-
/**
|
|
2588
|
+
/** 行数据快照(与 `getData` 导出规则一致) */
|
|
2589
|
+
data: TData;
|
|
2590
|
+
/** 触发点击的列 id(用户实际点中的列) */
|
|
2449
2591
|
colId: string;
|
|
2450
2592
|
}
|
|
2451
2593
|
|
|
2452
|
-
|
|
2594
|
+
/**
|
|
2595
|
+
* 行编辑 **异步整行提交** 结束时触发。MagicGrid:`@row-commit-finished` · Api:`rowCommitFinished`。
|
|
2596
|
+
*/
|
|
2597
|
+
export declare interface RowCommitFinishedEvent<TData extends RowData = RowData> {
|
|
2598
|
+
/** 业务行 id */
|
|
2453
2599
|
rowId: BusinessRowId;
|
|
2600
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2454
2601
|
rowIndex: number;
|
|
2602
|
+
/** 是否成功提交 */
|
|
2455
2603
|
committed: boolean;
|
|
2604
|
+
/** 是否被中断 */
|
|
2456
2605
|
aborted?: boolean;
|
|
2606
|
+
/** 提交结束时的行数据快照 */
|
|
2607
|
+
data: TData;
|
|
2457
2608
|
}
|
|
2458
2609
|
|
|
2459
|
-
|
|
2610
|
+
/**
|
|
2611
|
+
* 行编辑 **异步整行提交** 开始时触发。MagicGrid:`@row-commit-started` · Api:`rowCommitStarted`。
|
|
2612
|
+
*/
|
|
2613
|
+
export declare interface RowCommitStartedEvent<TData extends RowData = RowData> {
|
|
2614
|
+
/** 业务行 id */
|
|
2460
2615
|
rowId: BusinessRowId;
|
|
2616
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2461
2617
|
rowIndex: number;
|
|
2618
|
+
/** 本次提交涉及的可编辑列 id */
|
|
2462
2619
|
editableColIds: string[];
|
|
2620
|
+
/** 提交开始时的行数据快照 */
|
|
2621
|
+
data: TData;
|
|
2463
2622
|
}
|
|
2464
2623
|
|
|
2465
2624
|
/** 用户行数据:保持普通对象,禁止 reactive 深代理 */
|
|
2466
2625
|
export declare type RowData = Record<string, unknown>;
|
|
2467
2626
|
|
|
2468
|
-
/**
|
|
2469
|
-
|
|
2627
|
+
/**
|
|
2628
|
+
* 表体 **leaf 数据行** 双击时触发;触发范围同 {@link RowClickedEvent}。
|
|
2629
|
+
* MagicGrid:`@row-dblclick` · Api:`rowDoubleClicked`。
|
|
2630
|
+
*/
|
|
2631
|
+
export declare interface RowDoubleClickedEvent<TData extends RowData = RowData> {
|
|
2632
|
+
/** 业务行 id */
|
|
2470
2633
|
rowId: BusinessRowId;
|
|
2634
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2471
2635
|
rowIndex: number;
|
|
2636
|
+
/** 内核行节点 */
|
|
2472
2637
|
rowNode: RowNode;
|
|
2473
|
-
/**
|
|
2638
|
+
/** 行数据快照(与 `getData` 导出规则一致) */
|
|
2639
|
+
data: TData;
|
|
2640
|
+
/** 触发双击的列 id */
|
|
2474
2641
|
colId: string;
|
|
2475
2642
|
}
|
|
2476
2643
|
|
|
@@ -2541,23 +2708,49 @@ export declare interface RowDragEndEvent {
|
|
|
2541
2708
|
treeLevel?: number;
|
|
2542
2709
|
}
|
|
2543
2710
|
|
|
2544
|
-
|
|
2711
|
+
/** 行编辑/整行提交中 **单列** 的值变更摘要,用于 `changes` 数组。 */
|
|
2712
|
+
export declare interface RowEditChange<TValue = unknown> {
|
|
2713
|
+
/** 变更列 id */
|
|
2545
2714
|
colId: string;
|
|
2546
|
-
|
|
2547
|
-
|
|
2715
|
+
/** 变更前原始值 */
|
|
2716
|
+
oldValue: TValue;
|
|
2717
|
+
/** 变更后原始值 */
|
|
2718
|
+
newValue: TValue;
|
|
2548
2719
|
}
|
|
2549
2720
|
|
|
2550
|
-
|
|
2721
|
+
/**
|
|
2722
|
+
* 行编辑模式(`editBehavior: 'row'`)下 **整行进入编辑** 时触发。MagicGrid:`@row-editing-started`。
|
|
2723
|
+
*
|
|
2724
|
+
* 此时同行多列 editor 同时 mount;各列还会各发一次 {@link CellEditingStartedEvent}。
|
|
2725
|
+
*/
|
|
2726
|
+
export declare interface RowEditingStartedEvent<TData extends RowData = RowData> {
|
|
2727
|
+
/** 业务行 id */
|
|
2551
2728
|
rowId: BusinessRowId;
|
|
2729
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2552
2730
|
rowIndex: number;
|
|
2731
|
+
/** 本行本次进入编辑的可编辑列 id 列表 */
|
|
2553
2732
|
editableColIds: string[];
|
|
2733
|
+
/** 进入编辑时的行数据快照 */
|
|
2734
|
+
data: TData;
|
|
2554
2735
|
}
|
|
2555
2736
|
|
|
2556
|
-
|
|
2737
|
+
/**
|
|
2738
|
+
* 行编辑模式 **整行退出编辑** 时触发。MagicGrid:`@row-editing-stopped`。
|
|
2739
|
+
*
|
|
2740
|
+
* `changes` 仅在 `committed: true` 且存在实际值差异的列时出现。
|
|
2741
|
+
* 若需监听写回后的业务数据,优先用 {@link RowValueChangedEvent}(仅成功且有变更时)。
|
|
2742
|
+
*/
|
|
2743
|
+
export declare interface RowEditingStoppedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
2744
|
+
/** 业务行 id */
|
|
2557
2745
|
rowId: BusinessRowId;
|
|
2746
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2558
2747
|
rowIndex: number;
|
|
2748
|
+
/** 是否走提交路径结束 */
|
|
2559
2749
|
committed: boolean;
|
|
2560
|
-
|
|
2750
|
+
/** 结束时的行数据快照 */
|
|
2751
|
+
data: TData;
|
|
2752
|
+
/** 本次提交涉及的列级变更;取消或未变更时为 `undefined` */
|
|
2753
|
+
changes?: RowEditChange<TValue>[];
|
|
2561
2754
|
}
|
|
2562
2755
|
|
|
2563
2756
|
/** 对标 Phase 17 rowExpanded / rowCollapsed 事件 */
|
|
@@ -2607,9 +2800,18 @@ export declare type RowId = string | number;
|
|
|
2607
2800
|
/** 单个 rowId 或 rowId 数组(toggleRowSelection / setIndexFocus 等) */
|
|
2608
2801
|
export declare type RowIdInput = RowId | readonly RowId[];
|
|
2609
2802
|
|
|
2803
|
+
/**
|
|
2804
|
+
* 临时行 **分配正式业务 id** 后触发(`promoteRowId` / 提交时写入 rowKey)。
|
|
2805
|
+
* MagicGrid:`@row-id-promoted` · Api:`rowIdPromoted`。
|
|
2806
|
+
*
|
|
2807
|
+
* `oldRowId` 对临时行恒为 `null`;`newRowId` 为分配后的业务主键。
|
|
2808
|
+
*/
|
|
2610
2809
|
export declare interface RowIdPromotedEvent {
|
|
2810
|
+
/** 晋升前的业务 id;临时行源 id 对外投影为 `null` */
|
|
2611
2811
|
oldRowId: BusinessRowId;
|
|
2812
|
+
/** 晋升后的业务 id */
|
|
2612
2813
|
newRowId: BusinessRowId;
|
|
2814
|
+
/** 晋升后的行数据 */
|
|
2613
2815
|
data: RowData;
|
|
2614
2816
|
}
|
|
2615
2817
|
|
|
@@ -2799,7 +3001,9 @@ export declare interface RowNodeTransaction {
|
|
|
2799
3001
|
update: RowNode[];
|
|
2800
3002
|
}
|
|
2801
3003
|
|
|
3004
|
+
/** `addRows` / `applyTransaction({ add })` 完成后触发。MagicGrid:`@rows-added`。 */
|
|
2802
3005
|
export declare interface RowsAddedEvent {
|
|
3006
|
+
/** 新增行的快照列表(含 rowId、data、rowIndex 等) */
|
|
2803
3007
|
rows: RowMutationRowSnapshot[];
|
|
2804
3008
|
}
|
|
2805
3009
|
|
|
@@ -2828,7 +3032,9 @@ export declare interface RowSpanHeadInfo {
|
|
|
2828
3032
|
covered: boolean;
|
|
2829
3033
|
}
|
|
2830
3034
|
|
|
3035
|
+
/** `removeRows` / `applyTransaction({ remove })` 完成后触发。MagicGrid:`@rows-removed`。 */
|
|
2831
3036
|
export declare interface RowsRemovedEvent {
|
|
3037
|
+
/** 被删行的快照列表(行可能已从模型移除,以快照为准) */
|
|
2832
3038
|
rows: RowMutationRemovedSnapshot[];
|
|
2833
3039
|
}
|
|
2834
3040
|
|
|
@@ -2854,15 +3060,28 @@ export declare interface RowTransaction {
|
|
|
2854
3060
|
|
|
2855
3061
|
export declare type RowTransactionAddItem = RowData | AddRowPayload;
|
|
2856
3062
|
|
|
2857
|
-
|
|
3063
|
+
/**
|
|
3064
|
+
* 行编辑 **整行校验失败** 时触发。MagicGrid:`@row-validation-failed`。
|
|
3065
|
+
*
|
|
3066
|
+
* `cellErrors` 为各列级错误;`rowErrors` 为 `rowValidator` 返回的行级错误。
|
|
3067
|
+
*/
|
|
3068
|
+
export declare interface RowValidationFailedEvent<TData extends RowData = RowData> {
|
|
3069
|
+
/** 业务行 id */
|
|
2858
3070
|
rowId: BusinessRowId;
|
|
3071
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2859
3072
|
rowIndex: number;
|
|
3073
|
+
/** 首个失败列 id(用于定位) */
|
|
2860
3074
|
failedColId: string;
|
|
3075
|
+
/** 校验失败时的行数据快照 */
|
|
3076
|
+
data: TData;
|
|
3077
|
+
/** 各列校验错误(可选) */
|
|
2861
3078
|
cellErrors?: Array<{
|
|
2862
3079
|
colId: string;
|
|
2863
3080
|
errors: string[];
|
|
2864
3081
|
}>;
|
|
3082
|
+
/** 行级校验错误(可选) */
|
|
2865
3083
|
rowErrors?: string[];
|
|
3084
|
+
/** 当前 invalid 处理模式 */
|
|
2866
3085
|
mode: InvalidEditValueMode;
|
|
2867
3086
|
}
|
|
2868
3087
|
|
|
@@ -2882,12 +3101,22 @@ export declare interface RowValidatorParams {
|
|
|
2882
3101
|
signal: AbortSignal;
|
|
2883
3102
|
}
|
|
2884
3103
|
|
|
2885
|
-
|
|
3104
|
+
/**
|
|
3105
|
+
* 行编辑 **整行提交成功且至少一列值发生变化** 时触发。MagicGrid:`@row-value-changed`。
|
|
3106
|
+
*
|
|
3107
|
+
* 比 {@link RowEditingStoppedEvent} 更贴近「业务侧行数据已更新」语义;单格编辑不触发本事件。
|
|
3108
|
+
*/
|
|
3109
|
+
export declare interface RowValueChangedEvent<TData extends RowData = RowData, TValue = unknown> {
|
|
3110
|
+
/** 业务行 id */
|
|
2886
3111
|
rowId: BusinessRowId;
|
|
3112
|
+
/** 在 `rowsToDisplay` 中的行下标 */
|
|
2887
3113
|
rowIndex: number;
|
|
3114
|
+
/** 内核行节点(含提交后最新 data) */
|
|
2888
3115
|
rowNode: RowNode;
|
|
2889
|
-
|
|
2890
|
-
|
|
3116
|
+
/** 提交后的行数据快照 */
|
|
3117
|
+
data: TData;
|
|
3118
|
+
/** 发生变更的列及前后值 */
|
|
3119
|
+
changes: RowEditChange<TValue>[];
|
|
2891
3120
|
}
|
|
2892
3121
|
|
|
2893
3122
|
/** 行选择列行级可选判定;省略时全部可选 */
|
|
@@ -2901,7 +3130,13 @@ export declare interface SelectableParams {
|
|
|
2901
3130
|
rowIndex: number;
|
|
2902
3131
|
}
|
|
2903
3132
|
|
|
3133
|
+
/**
|
|
3134
|
+
* 行选择列 checkbox 选中集变化时触发。MagicGrid:`@selection-changed`。
|
|
3135
|
+
*
|
|
3136
|
+
* 仅反映 **checkbox 勾选** 状态,不含索引列辅助定位(见 {@link IndexFocusChangedEvent})。
|
|
3137
|
+
*/
|
|
2904
3138
|
export declare interface SelectionChangedEvent {
|
|
3139
|
+
/** 当前选中的业务行 id 列表(顺序不保证与显示顺序一致) */
|
|
2905
3140
|
selectedRowIds: BusinessRowId[];
|
|
2906
3141
|
}
|
|
2907
3142
|
|
|
@@ -2998,7 +3233,9 @@ export declare interface SizeColumnsToFitProvidedWidthStrategy {
|
|
|
2998
3233
|
columnLimits?: SizeColumnsToFitColumnLimit[];
|
|
2999
3234
|
}
|
|
3000
3235
|
|
|
3236
|
+
/** 排序模型变更后触发(用户点击表头、API `setSortModel` 等)。MagicGrid:`@sort-changed`。 */
|
|
3001
3237
|
export declare interface SortChangedEvent {
|
|
3238
|
+
/** 当前排序模型;v1 至多 1 项 */
|
|
3002
3239
|
sortModel: SortModelItem[];
|
|
3003
3240
|
}
|
|
3004
3241
|
|