Skip to content

Commit 2a4db1c

Browse files
committed
feat: rowSeriesNumber复选框支持在records设置选中和禁用状态
1 parent ca2769f commit 2a4db1c

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

packages/vtable/examples/list/list-tree-checkbox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export function createTable() {
122122

123123
const data = [
124124
{
125+
// _vtable_rowSeries_number:{text: 'checked', checked: true, disable: true },
125126
类别: '办公用品',
126127
销售额: '129.696',
127128
数量: '2',

packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { getCellBorderStrokeWidth } from '../../utils/cell-border-stroke-width';
2020
import { dealWithIcon, dealWithIconLayout } from '../../utils/text-icon-layout';
2121
import { CheckboxContent } from '../../component/checkbox-content';
2222
import { CUSTOM_CONTAINER_NAME } from '../../component/custom';
23+
import type { ListTable } from '../../..';
2324

2425
export function createCheckboxCellGroup(
2526
cellGroup: Group | null,
@@ -325,6 +326,15 @@ function createCheckbox(
325326
isChecked = value;
326327
text = '';
327328
}
329+
// 处理 rowSeriesNumbe 在record设置checkbox是否勾选与是否禁用的场景
330+
if (table.internalProps.layoutMap.isSeriesNumber(col, row)) {
331+
const checkboxSeriesNumberStyle = (table as ListTable).getFieldData('_vtable_rowSeries_number', col, row);
332+
if (checkboxSeriesNumberStyle) {
333+
isChecked = checkboxSeriesNumberStyle.checked;
334+
isDisabled = checkboxSeriesNumberStyle.disable;
335+
text = checkboxSeriesNumberStyle.text ?? '';
336+
}
337+
}
328338
isChecked = table.stateManager.syncCheckedState(col, row, define.field as string | number, isChecked);
329339
const hierarchyOffset = getHierarchyOffset(col, row, table);
330340
const cellStyle = table._getCellStyle(col, row) as CheckboxStyleOption; // to be fixed

0 commit comments

Comments
 (0)