afc163
5 years ago
No known key found for this signature in database
GPG Key ID: 5F00908D72002306
5 changed files with
10 additions and
9 deletions
-
components/table/Table.tsx
-
components/table/filterDropdown.tsx
-
components/table/index.en-US.md
-
components/table/index.zh-CN.md
-
components/table/interface.tsx
|
|
@ -85,6 +85,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState< |
|
|
|
locale: PropTypes.object, |
|
|
|
dropdownPrefixCls: PropTypes.string, |
|
|
|
sortDirections: PropTypes.array, |
|
|
|
getPopupContainer: PropTypes.func, |
|
|
|
}; |
|
|
|
|
|
|
|
static defaultProps = { |
|
|
@ -762,15 +763,13 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState< |
|
|
|
return recordKey === undefined ? index : recordKey; |
|
|
|
}; |
|
|
|
|
|
|
|
getPopupContainer = () => { |
|
|
|
return ReactDOM.findDOMNode(this) as HTMLElement; |
|
|
|
}; |
|
|
|
|
|
|
|
generatePopupContainerFunc = () => { |
|
|
|
const { scroll } = this.props; |
|
|
|
|
|
|
|
const { scroll, getPopupContainer } = this.props; |
|
|
|
if (getPopupContainer) { |
|
|
|
return getPopupContainer; |
|
|
|
} |
|
|
|
// Use undefined to let rc component use default logic.
|
|
|
|
return scroll ? this.getPopupContainer : undefined; |
|
|
|
return scroll ? () => ReactDOM.findDOMNode(this) as HTMLElement : undefined; |
|
|
|
}; |
|
|
|
|
|
|
|
renderRowSelection(prefixCls: string, locale: TableLocale) { |
|
|
|
|
|
@ -263,7 +263,6 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState< |
|
|
|
confirm: this.handleConfirm, |
|
|
|
clearFilters: this.handleClearFilters, |
|
|
|
filters: column.filters, |
|
|
|
getPopupContainer: (triggerNode: HTMLElement) => triggerNode.parentNode as HTMLElement, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -281,7 +280,7 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState< |
|
|
|
onSelect={this.setSelectedKeys} |
|
|
|
onDeselect={this.setSelectedKeys} |
|
|
|
selectedKeys={originSelectedKeys && originSelectedKeys.map(val => val.toString())} |
|
|
|
getPopupContainer={(triggerNode: HTMLElement) => triggerNode.parentNode} |
|
|
|
getPopupContainer={getPopupContainer} |
|
|
|
> |
|
|
|
{this.renderMenus(column.filters!)} |
|
|
|
</Menu> |
|
|
|
|
|
@ -87,6 +87,7 @@ const columns = [ |
|
|
|
| onExpandedRowsChange | Callback executed when the expanded rows change | Function(expandedRows) | | | |
|
|
|
| onHeaderRow | Set props on per header row | Function(column, index) | - | | |
|
|
|
| onRow | Set props on per row | Function(record, index) | - | | |
|
|
|
| getPopupContainer | the render container of dropdowns in table | (triggerNode) => HTMLElement | `() => TableHtmlElement` | 3.21.0 | |
|
|
|
|
|
|
|
#### onRow usage |
|
|
|
|
|
|
|
|
|
@ -92,6 +92,7 @@ const columns = [ |
|
|
|
| onExpandedRowsChange | 展开的行变化时触发 | Function(expandedRows) | | | |
|
|
|
| onHeaderRow | 设置头部行属性 | Function(column, index) | - | | |
|
|
|
| onRow | 设置行属性 | Function(record, index) | - | | |
|
|
|
| getPopupContainer | 设置表格内各类浮层的渲染节点,如筛选菜单 | (triggerNode) => HTMLElement | `() => TableHtmlElement` | 3.21.0 | |
|
|
|
|
|
|
|
#### onRow 用法 |
|
|
|
|
|
|
|
|
|
@ -190,6 +190,7 @@ export interface TableProps<T> { |
|
|
|
style?: React.CSSProperties; |
|
|
|
children?: React.ReactNode; |
|
|
|
sortDirections?: SortOrder[]; |
|
|
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; |
|
|
|
} |
|
|
|
|
|
|
|
export interface TableStateFilters { |
|
|
|