chore: crud & servie 独立scoped, 弹框委托子节点处理调整

This commit is contained in:
2betop 2021-07-02 16:51:07 +08:00
parent 56c00cb308
commit c9f1caa03e
4 changed files with 22 additions and 26 deletions

View File

@ -2118,7 +2118,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
@Renderer({
type: 'crud',
storeType: CRUDStore.name
storeType: CRUDStore.name,
isolateScope: true
})
export class CRUDRenderer extends CRUD {
static contextType = ScopedContext;

View File

@ -652,19 +652,16 @@ export class DialogRenderer extends Dialog {
components.push(...page.context.getComponents());
}
const form = findLast(
components,
component => component.props.type === 'form'
);
for (let i = components.length - 1; i >= 0; i--) {
const component = components[i];
if (form) {
targets.push(form);
} else {
const crud = findLast(
components,
component => component.props.type === 'crud'
);
crud && targets.push(crud);
if (component.props.type === 'form') {
targets.push(component);
break;
} else if (component.props.type === 'crud') {
targets.push(component);
break;
}
}
}

View File

@ -704,19 +704,16 @@ export class DrawerRenderer extends Drawer {
components.push(...page.context.getComponents());
}
const form = findLast(
components,
component => component.props.type === 'form'
);
for (let i = components.length - 1; i >= 0; i--) {
const component = components[i];
if (form) {
targets.push(form);
} else {
const crud = findLast(
components,
component => component.props.type === 'crud'
);
crud && targets.push(crud);
if (component.props.type === 'form') {
targets.push(component);
break;
} else if (component.props.type === 'crud') {
targets.push(component);
break;
}
}
}

View File

@ -432,7 +432,8 @@ export default class Service extends React.Component<ServiceProps> {
@Renderer({
type: 'service',
storeType: ServiceStore.name
storeType: ServiceStore.name,
isolateScope: true
})
export class ServiceRenderer extends Service {
static contextType = ScopedContext;