fix: fix the modal action disappear
1. Fix the modal disappeared when changing the window size 2. Optimized obtaining the table height Change-Id: I629858f7c0174183345526bb46909df33ac9b4a2
This commit is contained in:
parent
76488b082c
commit
f73f128bac
@ -799,7 +799,7 @@ export class BaseTable extends React.Component {
|
|||||||
|
|
||||||
renderNormalTitle() {
|
renderNormalTitle() {
|
||||||
return (
|
return (
|
||||||
<div className={styles['table-header']}>
|
<div className={styles['table-header']} id="sl-table-header-search">
|
||||||
<div
|
<div
|
||||||
className={classnames(
|
className={classnames(
|
||||||
styles['table-header-btns'],
|
styles['table-header-btns'],
|
||||||
|
@ -36,10 +36,14 @@ import NotFound from 'components/Cards/NotFound';
|
|||||||
import { getPath, getLinkRender } from 'utils/route-map';
|
import { getPath, getLinkRender } from 'utils/route-map';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
const tabOtherHeight = 326;
|
|
||||||
const otherHeight = 272;
|
|
||||||
const hintHeight = 50;
|
const hintHeight = 50;
|
||||||
const subTabHeight = 50;
|
const navHeight = 40;
|
||||||
|
const breadcrumbHeight = 50;
|
||||||
|
const padding = 16;
|
||||||
|
const tabHeight = 44;
|
||||||
|
const footerHeight = 50;
|
||||||
|
const defaultTableSearchHeight = 50;
|
||||||
|
const defaultTableHeaderHeight = 51;
|
||||||
|
|
||||||
export default class BaseList extends React.Component {
|
export default class BaseList extends React.Component {
|
||||||
constructor(props, options = {}) {
|
constructor(props, options = {}) {
|
||||||
@ -274,22 +278,36 @@ export default class BaseList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get tableTopHeight() {
|
get tableTopHeight() {
|
||||||
|
const tableSearchHeader = document.getElementById('sl-table-header-search');
|
||||||
|
const tableSearchHeight = tableSearchHeader
|
||||||
|
? tableSearchHeader.scrollHeight
|
||||||
|
: defaultTableSearchHeight;
|
||||||
|
const topTotal = navHeight + breadcrumbHeight + tableSearchHeight + padding;
|
||||||
if (this.hasSubTab) {
|
if (this.hasSubTab) {
|
||||||
return tabOtherHeight + subTabHeight;
|
return topTotal + tabHeight * 2;
|
||||||
}
|
}
|
||||||
if (this.hasTab) {
|
if (this.hasTab) {
|
||||||
return tabOtherHeight;
|
return topTotal + tabHeight;
|
||||||
}
|
}
|
||||||
return otherHeight;
|
return topTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTableHeight() {
|
getTableHeight() {
|
||||||
const height = window.innerHeight;
|
const height = window.innerHeight;
|
||||||
const id = this.params && this.params.id;
|
if (this.inDetailPage) {
|
||||||
if (id) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return height - this.tableTopHeight - this.hintHeight;
|
const tableHeader = document.getElementsByClassName('ant-table-header')[0];
|
||||||
|
const tableHeaderHeight = tableHeader
|
||||||
|
? tableHeader.offsetHeight
|
||||||
|
: defaultTableHeaderHeight;
|
||||||
|
const newHeight =
|
||||||
|
height -
|
||||||
|
this.tableTopHeight -
|
||||||
|
this.hintHeight -
|
||||||
|
footerHeight -
|
||||||
|
tableHeaderHeight;
|
||||||
|
return newHeight > 0 ? newHeight : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get tableWidth() {
|
get tableWidth() {
|
||||||
@ -655,6 +673,9 @@ export default class BaseList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTableHeight() {
|
setTableHeight() {
|
||||||
|
if (this.inAction) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const currentTableHeight = this.getTableHeight();
|
const currentTableHeight = this.getTableHeight();
|
||||||
const { tableHeight } = this.state;
|
const { tableHeight } = this.state;
|
||||||
if (currentTableHeight !== tableHeight) {
|
if (currentTableHeight !== tableHeight) {
|
||||||
|
Loading…
Reference in New Issue
Block a user