Skip to content

Commit

Permalink
fix(form): collpsed in form-item-gi does not work (#1166)
Browse files Browse the repository at this point in the history
* fix(n-form): collapse does not work in FormItemGi

* fix(n-form): add commit log

Co-authored-by: unknown <[email protected]>
  • Loading branch information
LYErin and unknown authored Sep 15, 2021
1 parent 657d8c9 commit c11edb2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- Fix `n-dynamic-tags` add button is not disabled when it is disabled.
- Fix `n-select` closes menu when enter key is pressed in filterable mode without options data.
- Fix `n-auto-complete`'s `children` prop can't use `AutoCompleteOption` type.
- Fix `n-gi`'s `collapsed` does not work in `n-form-item-gi`, closes [#1160](https://github.com/TuSimple/naive-ui/issues/1160).

## 2.18.1 (2021-09-08)

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- 修复 `n-dynamic-tags` 禁用时 add 按钮未被禁用
- 修复 `n-select` 在 filterable 并且菜单无数据是按下 enter 导致菜单关闭
- 修复 `n-auto-complete``children` 属性不允许使用 `AutoCompleteOption` 类型
- 修复 `n-gi``collapsed``n-form-item-gi` 中切换无法生效问题,关闭 [#1160](https://github.com/TuSimple/naive-ui/issues/1160)

## 2.18.1 (2021-09-08)

Expand Down
9 changes: 6 additions & 3 deletions src/form/src/FormItemGridItem.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { h, ref, defineComponent } from 'vue'
import { h, ref, defineComponent, getCurrentInstance } from 'vue'
import NGridItem, {
gridItemProps,
gridItemPropKeys
GridItemVNodeProps
} from '../../grid/src/GridItem'
import { keep, keysOf } from '../../_utils'
import type { ExtractPublicPropTypes } from '../../_utils'
Expand Down Expand Up @@ -42,7 +42,10 @@ export default defineComponent({
}
},
render () {
return h(NGridItem, keep(this.$props, gridItemPropKeys), {
const self = getCurrentInstance()
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const gridItemProps = self!.vnode.props as GridItemVNodeProps
return h(NGridItem, gridItemProps, {
default: () => {
const itemProps = keep(this.$props, formItemPropKeys)
return h(
Expand Down
6 changes: 2 additions & 4 deletions src/grid/src/GridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ExtractPublicPropTypes } from '../../_utils'

export const defaultSpan = 1

interface GridItemVNodeProps {
export interface GridItemVNodeProps {
privateOffset?: number
privateSpan?: number
privateColStart?: number
Expand Down Expand Up @@ -87,9 +87,7 @@ export default defineComponent({
render () {
return (
<div
style={
([this.itemStyle, this.deriveStyle()] as unknown) as CSSProperties
}
style={[this.itemStyle, this.deriveStyle()] as unknown as CSSProperties}
>
{renderSlot(this.$slots, 'default', { overflow: this.overflow })}
</div>
Expand Down

0 comments on commit c11edb2

Please sign in to comment.