20260727225141
This commit is contained in:
1 parent
9dbaef7787
commit
63588bd217
97 files changed
+1309
-145
No files matched your search
@@ -200,6 +200,7 @@ const selectionColumn = createSelectionColumn({
|
||||
getDataSource: () => props.dataSource,
|
||||
getRowKey,
|
||||
getSelectedRowKeys: () => props.rowSelection?.selectedRowKeys ?? [],
|
||||
isRowDisabled: (row) => Boolean(props.rowSelection?.getCheckboxProps?.(row)?.disabled),
|
||||
onChange: (keys, rows) => props.rowSelection?.onChange?.(keys, rows),
|
||||
});
|
||||
|
||||
@@ -213,6 +214,17 @@ async function scrollToRow(rowKey) {
|
||||
table.scrollTo(idx * rowHeight, null);
|
||||
}
|
||||
|
||||
// 新增行等程序化场景使用:滚动到目标行,并让该行立即进入编辑状态。
|
||||
// activeRowKey 仅控制当前行高亮,不应隐式触发编辑,因此单独暴露此方法。
|
||||
async function editRow(rowKey, focusCol = null) {
|
||||
await scrollToRow(rowKey);
|
||||
await nextTick();
|
||||
const row = props.dataSource.find((item) => String(getRowKey(item)) === String(rowKey));
|
||||
if (!row) return;
|
||||
tableRef.value?.setCurrentRow?.(row, { silent: true });
|
||||
activateEditing(row, focusCol);
|
||||
}
|
||||
|
||||
function getSelectedArea() {
|
||||
return tableRef.value?.getSelectedArea?.();
|
||||
}
|
||||
@@ -388,6 +400,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
defineExpose({
|
||||
scrollToRow,
|
||||
editRow,
|
||||
getSelectedArea,
|
||||
clearSelectedArea,
|
||||
setRowExpand,
|
||||
@@ -455,6 +468,11 @@ defineExpose({
|
||||
line-height: 1;
|
||||
margin: 0;
|
||||
|
||||
&.disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
|
||||
Reference in new issue
Block a user