feat: update pane init function

This commit is contained in:
wanying.jwy 2020-12-22 14:27:16 +08:00
parent 8072de1bf7
commit 74a75c976f
2 changed files with 21 additions and 17 deletions

View File

@ -66,6 +66,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
contentProps: props, contentProps: props,
index: index || props?.index, index: index || props?.index,
}; };
if (type === 'dock') { if (type === 'dock') {
newConfig.type = 'PanelDock'; newConfig.type = 'PanelDock';
newConfig.area = 'left'; newConfig.area = 'left';
@ -98,8 +99,6 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
height, height,
maxHeight, maxHeight,
canSetFixed, canSetFixed,
onInit: init,
onDestroy: destroy,
}; };
if (defaultFixed) { if (defaultFixed) {
@ -121,23 +120,21 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
}); });
} }
} }
} else if (type === 'action') {
newConfig.area = 'top';
newConfig.type = 'Dock';
} else if (type === 'tab') {
newConfig.area = 'right';
newConfig.type = 'Panel';
} else if (type === 'stage') {
newConfig.area = 'stages';
newConfig.type = 'Widget';
} else { } else {
newConfig.props.onInit = init; newConfig.area = 'main';
newConfig.props.onDestroy = destroy; newConfig.type = 'Widget';
if (type === 'action') {
newConfig.area = 'top';
newConfig.type = 'Dock';
} else if (type === 'tab') {
newConfig.area = 'right';
newConfig.type = 'Panel';
} else if (type === 'stage') {
newConfig.area = 'stages';
newConfig.type = 'Widget';
} else {
newConfig.area = 'main';
newConfig.type = 'Widget';
}
} }
newConfig.props.onInit = init;
newConfig.props.onDestroy = destroy;
return newConfig; return newConfig;
} }

View File

@ -141,6 +141,13 @@ export default class PanelDock implements IWidget {
showPanel() { showPanel() {
this.panel?.setActive(true); this.panel?.setActive(true);
} }
/**
* @deprecated
*/
onActiveChange(func: () => any) {
return this.panel?.onActiveChange(func);
}
} }