mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
fix: Add missing typescript define (#19251)
* fix: Add missing typescript define * remove withStore * fix lint
This commit is contained in:
parent
5676ea22d2
commit
7d32f99283
@ -1361,45 +1361,42 @@ class Table<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
function withStore(
|
||||
WrappedComponent: typeof Table,
|
||||
): React.ComponentClass<Omit<TableProps<any>, keyof WithStore>> {
|
||||
class Component<T> extends React.Component<TableProps<T>> {
|
||||
static Column = Column;
|
||||
|
||||
static ColumnGroup = ColumnGroup;
|
||||
|
||||
store: Store;
|
||||
|
||||
CheckboxPropsCache: CheckboxPropsCache;
|
||||
|
||||
constructor(props: TableProps<T>) {
|
||||
super(props);
|
||||
|
||||
this.CheckboxPropsCache = {};
|
||||
|
||||
this.store = createStore({
|
||||
selectedRowKeys: getRowSelection(props).selectedRowKeys || [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
}
|
||||
|
||||
setCheckboxPropsCache = (cache: CheckboxPropsCache) => (this.CheckboxPropsCache = cache);
|
||||
|
||||
render() {
|
||||
return (
|
||||
<WrappedComponent<T>
|
||||
{...this.props}
|
||||
store={this.store}
|
||||
checkboxPropsCache={this.CheckboxPropsCache}
|
||||
setCheckboxPropsCache={this.setCheckboxPropsCache}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
return Component;
|
||||
}
|
||||
|
||||
polyfill(Table);
|
||||
|
||||
export default withStore(Table);
|
||||
class StoreTable<T> extends React.Component<Omit<TableProps<T>, keyof WithStore>> {
|
||||
static displayName = 'withStore(Table)';
|
||||
|
||||
static Column = Column;
|
||||
|
||||
static ColumnGroup = ColumnGroup;
|
||||
|
||||
store: Store;
|
||||
|
||||
CheckboxPropsCache: CheckboxPropsCache;
|
||||
|
||||
constructor(props: TableProps<T>) {
|
||||
super(props);
|
||||
|
||||
this.CheckboxPropsCache = {};
|
||||
|
||||
this.store = createStore({
|
||||
selectedRowKeys: getRowSelection(props).selectedRowKeys || [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
}
|
||||
|
||||
setCheckboxPropsCache = (cache: CheckboxPropsCache) => (this.CheckboxPropsCache = cache);
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Table<T>
|
||||
{...this.props}
|
||||
store={this.store}
|
||||
checkboxPropsCache={this.CheckboxPropsCache}
|
||||
setCheckboxPropsCache={this.setCheckboxPropsCache}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default StoreTable;
|
||||
|
Loading…
Reference in New Issue
Block a user