Skip to content

Commit

Permalink
fix(data-table): ellipsis prop in column doesn't support all `n-ell…
Browse files Browse the repository at this point in the history
…ipsis`'s props, closes #1891
  • Loading branch information
07akioni committed Dec 19, 2021
1 parent 4072d94 commit 5f1fc4a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Fix `n-transfer` list doesn't follow container height when style.height is set, closes [#1879](https://github.com/TuSimple/naive-ui/issues/1879).
- Fix `n-skeleton` & `n-gradient-text` cause runtime error in some old browsers, closes [#1867](https://github.com/TuSimple/naive-ui/issues/1867).
- Fix `n-data-table` `ellipsis` prop in column doesn't support all `n-ellipsis`'s props, closes [#1891](https://github.com/TuSimple/naive-ui/issues/1891).

### Feats

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- 修复 `n-transfer` 在自定义高度后内部列表和容器高度不一致,关闭 [#1879](https://github.com/TuSimple/naive-ui/issues/1879)
- 修复 `n-skeleton``n-gradient-text` 在某些较老的浏览器导致运行错误,关闭 [#1867](https://github.com/TuSimple/naive-ui/issues/1867)
- 修复 `n-data-table` 中列的 ellipsis 属性对于 `n-ellipsis` 的属性支持不全,关闭 [#1891](https://github.com/TuSimple/naive-ui/issues/1891)

### Feats

Expand Down
5 changes: 2 additions & 3 deletions src/data-table/src/TableParts/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ export default defineComponent({
cell = get(row, key) as any
}
}
const tooltip = typeof ellipsis === 'object' ? ellipsis.tooltip : undefined
if (tooltip) {
if (ellipsis && typeof ellipsis === 'object') {
const { mergedTheme } = this
return (
<NEllipsis
tooltip={tooltip}
{...ellipsis}
theme={mergedTheme.peers.Ellipsis}
themeOverrides={mergedTheme.peerOverrides.Ellipsis}
>
Expand Down
4 changes: 2 additions & 2 deletions src/data-table/src/TableParts/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export default defineComponent({
{renderTitle(column)}
</div>
) // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
: ellipsis && ellipsis.tooltip ? (
: ellipsis && typeof ellipsis === 'object' ? (
<NEllipsis
tooltip={ellipsis.tooltip}
{...ellipsis}
theme={mergedTheme.peers.Ellipsis}
themeOverrides={mergedTheme.peerOverrides.Ellipsis}
>
Expand Down

0 comments on commit 5f1fc4a

Please sign in to comment.