[IMP] update owl to v2.0.0-beta-18

This commit is contained in:
Géry Debongnie
2022-09-02 14:57:44 +02:00
parent 3f1c1ea6a4
commit 2796ea0341
+15 -6
View File
@@ -3597,6 +3597,7 @@
this.target = new CodeTarget("template"); this.target = new CodeTarget("template");
this.translatableAttributes = TRANSLATABLE_ATTRS; this.translatableAttributes = TRANSLATABLE_ATTRS;
this.staticDefs = []; this.staticDefs = [];
this.slotNames = new Set();
this.helpers = new Set(); this.helpers = new Set();
this.translateFn = options.translateFn || ((s) => s); this.translateFn = options.translateFn || ((s) => s);
if (options.translatableAttributes) { if (options.translatableAttributes) {
@@ -4542,31 +4543,39 @@
let blockString; let blockString;
let slotName; let slotName;
let dynamic = false; let dynamic = false;
let isMultiple = false;
if (ast.name.match(INTERP_REGEXP)) { if (ast.name.match(INTERP_REGEXP)) {
dynamic = true; dynamic = true;
isMultiple = true;
slotName = interpolate(ast.name); slotName = interpolate(ast.name);
} }
else { else {
slotName = "'" + ast.name + "'"; slotName = "'" + ast.name + "'";
isMultiple = isMultiple || this.slotNames.has(ast.name);
this.slotNames.add(ast.name);
} }
const dynProps = ast.attrs ? ast.attrs["t-props"] : null; const dynProps = ast.attrs ? ast.attrs["t-props"] : null;
if (ast.attrs) { if (ast.attrs) {
delete ast.attrs["t-props"]; delete ast.attrs["t-props"];
} }
let key = this.target.loopLevel ? `key${this.target.loopLevel}` : "key";
if (isMultiple) {
key = `${key} + \`${this.generateComponentKey()}\``;
}
const props = ast.attrs ? this.formatPropObject(ast.attrs) : []; const props = ast.attrs ? this.formatPropObject(ast.attrs) : [];
const scope = this.getPropString(props, dynProps); const scope = this.getPropString(props, dynProps);
if (ast.defaultContent) { if (ast.defaultContent) {
const name = this.compileInNewTarget("defaultContent", ast.defaultContent, ctx); const name = this.compileInNewTarget("defaultContent", ast.defaultContent, ctx);
blockString = `callSlot(ctx, node, key, ${slotName}, ${dynamic}, ${scope}, ${name})`; blockString = `callSlot(ctx, node, ${key}, ${slotName}, ${dynamic}, ${scope}, ${name})`;
} }
else { else {
if (dynamic) { if (dynamic) {
let name = generateId("slot"); let name = generateId("slot");
this.define(name, slotName); this.define(name, slotName);
blockString = `toggler(${name}, callSlot(ctx, node, key, ${name}, ${dynamic}, ${scope}))`; blockString = `toggler(${name}, callSlot(ctx, node, ${key}, ${name}, ${dynamic}, ${scope}))`;
} }
else { else {
blockString = `callSlot(ctx, node, key, ${slotName}, ${dynamic}, ${scope})`; blockString = `callSlot(ctx, node, ${key}, ${slotName}, ${dynamic}, ${scope})`;
} }
} }
// event handling // event handling
@@ -5778,9 +5787,9 @@ See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
__info__.version = '2.0.0-beta-17'; __info__.version = '2.0.0-beta-18';
__info__.date = '2022-09-01T13:41:52.209Z'; __info__.date = '2022-09-02T12:57:38.022Z';
__info__.hash = '9cb74d6'; __info__.hash = 'c1afaeb';
__info__.url = 'https://github.com/odoo/owl'; __info__.url = 'https://github.com/odoo/owl';