mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
fix(dashboard): fix nested tab (#15134)
This commit is contained in:
parent
cb10427b1e
commit
e5187a479a
@ -156,7 +156,11 @@ class Tabs extends React.PureComponent {
|
|||||||
const lastTabId = nextTabsIds[nextTabsIds.length - 1];
|
const lastTabId = nextTabsIds[nextTabsIds.length - 1];
|
||||||
// if a new tab is added focus on it immediately
|
// if a new tab is added focus on it immediately
|
||||||
if (nextTabsIds.length > currTabsIds.length) {
|
if (nextTabsIds.length > currTabsIds.length) {
|
||||||
this.setState(() => ({ activeKey: lastTabId }));
|
// a new tab's path may be empty, here also need to set tabIndex
|
||||||
|
this.setState(() => ({
|
||||||
|
activeKey: lastTabId,
|
||||||
|
tabIndex: maxIndex,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
// if a tab is removed focus on the first
|
// if a tab is removed focus on the first
|
||||||
if (nextTabsIds.length < currTabsIds.length) {
|
if (nextTabsIds.length < currTabsIds.length) {
|
||||||
@ -200,7 +204,7 @@ class Tabs extends React.PureComponent {
|
|||||||
onOk: () => {
|
onOk: () => {
|
||||||
deleteComponent(key, component.id);
|
deleteComponent(key, component.id);
|
||||||
const tabIndex = component.children.indexOf(key);
|
const tabIndex = component.children.indexOf(key);
|
||||||
this.handleClickTab(Math.max(0, tabIndex - 1));
|
this.handleDeleteTab(tabIndex);
|
||||||
},
|
},
|
||||||
okType: 'danger',
|
okType: 'danger',
|
||||||
okText: 'DELETE',
|
okText: 'DELETE',
|
||||||
|
Loading…
Reference in New Issue
Block a user