fix: do not init meta data when switch tab
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { DownOutlined, RightOutlined } from '@ant-design/icons';
|
||||
import IconFont from '@/components/icon-font';
|
||||
import { RightOutlined } from '@ant-design/icons';
|
||||
import { Button, Checkbox } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
@@ -39,7 +40,17 @@ const HeaderPrefix: React.FC<HeaderPrefixProps> = (props) => {
|
||||
<span style={{ marginRight: 5 }}>
|
||||
{_.isBoolean(expandable) ? (
|
||||
<Button type="text" size="small" onClick={handleToggleExpand}>
|
||||
{expandAll ? <DownOutlined /> : <RightOutlined />}
|
||||
{expandAll ? (
|
||||
<IconFont
|
||||
type="icon-collapse_all"
|
||||
className="font-size-16"
|
||||
></IconFont>
|
||||
) : (
|
||||
<IconFont
|
||||
type="icon-uncollapse_all"
|
||||
className="font-size-16"
|
||||
></IconFont>
|
||||
)}
|
||||
</Button>
|
||||
) : (
|
||||
expandable
|
||||
|
||||
@@ -53,6 +53,9 @@ const SealTable: React.FC<SealTableProps & { pagination: PaginationProps }> = (
|
||||
}, [columns, children]);
|
||||
|
||||
const expandAll = useMemo(() => {
|
||||
if (expandedRowKeys?.length === 0) {
|
||||
return false;
|
||||
}
|
||||
const allKeys = new Set(expandedRowKeys);
|
||||
const currentDataKeys = props.dataSource.map((record) => record[rowKey]);
|
||||
return currentDataKeys.every((key) => allKeys.has(key));
|
||||
|
||||
Reference in New Issue
Block a user