mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] portal: portal as a Directive
Before this commit, portal was a Component, now is a directive. This commit also clean some unused code, and fix an issue on the clean optimization when a portal is found in a condition or a loop.
This commit is contained in:
committed by
Aaron Bohy
parent
c221721d7f
commit
90167c5436
@@ -2,6 +2,7 @@ import { BDom, multi, text, toggler } from "../blockdom";
|
||||
import { validateProps } from "../component/props_validation";
|
||||
import { Markup } from "../utils";
|
||||
import { html } from "../blockdom/index";
|
||||
import { VPortal } from "../portal";
|
||||
|
||||
/**
|
||||
* This file contains utility functions that will be injected in each template,
|
||||
@@ -12,6 +13,16 @@ function withDefault(value: any, defaultValue: any): any {
|
||||
return value === undefined || value === null || value === false ? defaultValue : value;
|
||||
}
|
||||
|
||||
function callPortal(
|
||||
ctx: any,
|
||||
parent: any,
|
||||
key: string,
|
||||
target: string,
|
||||
content: (ctx: any, node: any, key: string) => BDom
|
||||
): BDom {
|
||||
return new VPortal(target, content(ctx, parent, key)) as any;
|
||||
}
|
||||
|
||||
function callSlot(
|
||||
ctx: any,
|
||||
parent: any,
|
||||
@@ -186,6 +197,7 @@ export const UTILS = {
|
||||
zero: Symbol("zero"),
|
||||
isBoundary,
|
||||
callSlot,
|
||||
callPortal,
|
||||
capture,
|
||||
withKey,
|
||||
prepareList,
|
||||
|
||||
Reference in New Issue
Block a user