From 84d2950dd82865bd074d486c3ae49a1c0d3f5346 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Tue, 5 Oct 2021 02:11:22 +0800 Subject: [PATCH] fix(data-table): selection column's width is collapsed when it is set to fixed, closes #1283 --- CHANGELOG.en-US.md | 1 + CHANGELOG.zh-CN.md | 1 + src/data-table/src/utils.ts | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index d9bce2f44..4d6e76071 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -28,6 +28,7 @@ - Fix `n-upload`'s `show-preview-button` prop not working,closes [#1238](https://github.com/TuSimple/naive-ui/issues/1238). - Fix `n-date-picker`'s `date` type of `action` validate error. - Fix `n-data-table` throws error when using `selection` and `summary` together, closes [#1276](https://github.com/TuSimple/naive-ui/issues/1276). +- Fix `n-data-table` selection column's width is collapsed when it is set to fixed, closes [#1283](https://github.com/TuSimple/naive-ui/issues/1283). ## 2.19.3 (2021-09-28) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index d1090bc15..11da9b04c 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -28,6 +28,7 @@ - 修复 `n-upload` 的 `show-preview-button` 属性失效,关闭 [#1238](https://github.com/TuSimple/naive-ui/issues/1238) - 修复 `n-date-picker` 的 `date` 类型的 `action` 验证错误 - 修复 `n-data-table` 在 `selection` 和 `summary` 一起使用时报错,关闭 [#1276](https://github.com/TuSimple/naive-ui/issues/1276) +- 修复 `n-data-table` 勾选列的宽度在设为 fixed 时候塌陷,关闭 [#1283](https://github.com/TuSimple/naive-ui/issues/1283) ## 2.19.3 (2021-09-28) diff --git a/src/data-table/src/utils.ts b/src/data-table/src/utils.ts index 0710fbb2d..15957bf32 100644 --- a/src/data-table/src/utils.ts +++ b/src/data-table/src/utils.ts @@ -45,8 +45,10 @@ export function getFlagOfOrder (order: SortOrder): SortOrderFlag { export function createCustomWidthStyle ( column: TableBaseColumn | TableSelectionColumn | TableExpandColumn ): CSSProperties { + const width = pxfy(getColWidth(column)) return { - width: pxfy(getColWidth(column)) + width, + minWidth: width } }