Skip to content

Commit

Permalink
* dtable: support for setting extra width to col.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jul 3, 2024
1 parent c6919e7 commit 0bda458
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/dtable/src/plugins/resize/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -171,7 +172,7 @@ const resizePlugin: DTablePlugin<DTableResizeTypes, [DTableMousemoveTypes]> = {
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);
Expand Down

0 comments on commit 0bda458

Please sign in to comment.