Skip to content

Commit

Permalink
feat: add _disableColumnAndRowSizeRound option
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed May 9, 2024
1 parent 3ad4066 commit 27d4eb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
*/
_setRowHeight(row: number, height: number, clearCache?: boolean): void {
// this.rowHeightsMap.put(row, Math.round(height));
this.rowHeightsMap.put(row, Math.round(height));
this.rowHeightsMap.put(row, this.options._disableColumnAndRowSizeRound ? height : Math.round(height));
// 清楚影响缓存
if (clearCache) {
this._clearRowRangeHeightsMap(row);
Expand Down Expand Up @@ -1219,7 +1219,10 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
* @returns
*/
_setColWidth(col: number, width: string | number, clearCache?: boolean, skipCheckFrozen?: boolean): void {
this.colWidthsMap.put(col, typeof width === 'number' ? Math.round(width) : width);
this.colWidthsMap.put(
col,
typeof width === 'number' ? (this.options._disableColumnAndRowSizeRound ? width : Math.round(width)) : width
);
// 清楚影响缓存
if (clearCache) {
this._clearColRangeWidthsMap(col);
Expand Down
2 changes: 2 additions & 0 deletions packages/vtable/src/ts-types/base-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ export interface BaseTableConstructorOptions {
columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';

customConfig?: any; // 部分特殊配置,兼容xTable等作用

_disableColumnAndRowSizeRound?: boolean;
}
export interface BaseTableAPI {
/** 数据总条目数 */
Expand Down

0 comments on commit 27d4eb3

Please sign in to comment.