Skip to content

Commit

Permalink
feat: #1808
Browse files Browse the repository at this point in the history
  • Loading branch information
wugaoliang committed Jun 26, 2021
1 parent 4a0ec34 commit 53ce978
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- 优化 `Select` onChang 回调方法中,获取全部选项详细内容 [#1726](https://github.com/XiaoMi/hiui/issues/1726)
- 优化 `Form` 组件允许 FormItem 中的表单类组件设置 value [#1741](https://github.com/XiaoMi/hiui/issues/1741)
- 优化 `Table` 组件 showColHighlight 属性,修改内部触发逻辑 [#1759](https://github.com/XiaoMi/hiui/issues/1759)
- 优化 `Table` 组件 render 自定义渲染函数,可以获取列的位置 [#1808](https://github.com/XiaoMi/hiui/issues/1808)
- 优化 `Tree` 组件文字较多折行时,遮盖问题 [#1768](https://github.com/XiaoMi/hiui/issues/1768)
- 修复 `Table` 组件表头吸顶问题 [#1789](https://github.com/XiaoMi/hiui/issues/1789)
- 修复 `Tree` 编辑形态,不能输入空格问题 [#1768](https://github.com/XiaoMi/hiui/issues/1768)
Expand Down
3 changes: 3 additions & 0 deletions components/form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ interface ItemProps {
labelWidth?: string
required?: boolean
showColon?: boolean
style?: CSSProperties
className?: string | object
}
interface SchemaItem extends ItemProps {
component?: string | JSX.Element
Expand Down Expand Up @@ -70,6 +72,7 @@ declare class SchemaForm extends React.Component<SchemaProps, any> {
declare class Form extends React.Component<FormProps, any> {
static Item = Item
static SchemaForm = SchemaForm
static List = FormList
static Reset = FormReset
static Submit = FormSubmit
}
Expand Down
2 changes: 1 addition & 1 deletion components/table/Cell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Cell = ({
const [loading, setLoading] = useState(false)
// 处理自定义 render 或者合并单元格情况
const cellContent = column.render
? column.render(allRowData[column.dataKey], allRowData, rowIndex)
? column.render(allRowData[column.dataKey], allRowData, rowIndex, column.dataKey)
: allRowData[column.dataKey]
const isMergeCell = cellContent && typeof cellContent === 'object' && !cellContent.$$typeof
if (isMergeCell && (cellContent.props.colSpan === 0 || cellContent.props.rowSpan === 0)) {
Expand Down
2 changes: 1 addition & 1 deletion components/table/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type ColumnItem = {
total?: boolean
width?: number
children?: ColumnItem[]
render?: (text: string, record: object, index: number) => JSX.Element
render?: (text: string, record: object, index: number, dataKey: string) => JSX.Element
}

type Origin = {
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/components/table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ import DemoAsync from '../../demo/table/section-async.jsx'
| total | 该列是否支持合计 | boolean | - | false |
| width | 该列宽度 | number | - | - |
| children | 多级表头 | ColumnItem[] | - | - |
| render | 控制单元格自定义渲染 | (text: DataItem[ColumnItem[dataKey]], row: DataItem, index: number) => ReactNode | - | - |
| render | 控制单元格自定义渲染 | (text: DataItem[ColumnItem[dataKey]], row: DataItem, index: number, dataKey: string) => ReactNode | - | - |

### DataSource

Expand Down

0 comments on commit 53ce978

Please sign in to comment.