From 0bda4587ffec1368546352776630d21043120a76 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 3 Jul 2024 16:09:27 +0800 Subject: [PATCH] * dtable: support for setting extra width to col. --- lib/dtable/src/plugins/resize/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dtable/src/plugins/resize/index.tsx b/lib/dtable/src/plugins/resize/index.tsx index ca00cb68e7..9d2febcead 100644 --- a/lib/dtable/src/plugins/resize/index.tsx +++ b/lib/dtable/src/plugins/resize/index.tsx @@ -14,6 +14,7 @@ export interface DTableResizeTypes { }>, col: { colResize?: boolean | ((this: DTableResize, colName: ColName) => boolean); + extraWidth?: number; }, state: { colResizing?: {colName: ColName, startX: number, startSize: number} @@ -171,7 +172,7 @@ const resizePlugin: DTablePlugin = { return result; }, onAddCol(col) { - const sizeChange = this.state.colsSizes[col.name]; + const sizeChange = this.state.colsSizes[col.name] ?? col.setting.extraWidth; if (typeof sizeChange === 'number') { this.data.colOriginSize.set(col.name, col.width); col.width = clamp(col.width + sizeChange, col.setting.minWidth, col.setting.maxWidth);