mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] components: capture context in prop expressions
This commit is contained in:
committed by
Géry Debongnie
parent
c23637e6d8
commit
58b8572f0a
@@ -9,8 +9,7 @@ exports[`t-on can bind event handler 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -116,10 +115,8 @@ exports[`t-on can bind two event handlers 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\" block-handler-1=\\"dblclick\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['handleClick'];
|
||||
let d1 = [v1, ctx];
|
||||
const v2 = ctx['handleDblClick'];
|
||||
let d2 = [v2, ctx];
|
||||
let d1 = [ctx['handleClick'], ctx];
|
||||
let d2 = [ctx['handleDblClick'], ctx];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
@@ -134,8 +131,7 @@ exports[`t-on handler is bound to proper owner 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -155,8 +151,7 @@ exports[`t-on handler is bound to proper owner, part 2 1`] = `
|
||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||
ctx[\`value\`] = v_block1[i1];
|
||||
let key1 = ctx['value'];
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
c_block1[i1] = withKey(block2([d1]), key1);
|
||||
}
|
||||
return list(c_block1);
|
||||
@@ -173,8 +168,7 @@ exports[`t-on handler is bound to proper owner, part 3 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -202,8 +196,7 @@ exports[`t-on handler is bound to proper owner, part 4 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -242,8 +235,7 @@ exports[`t-on receive event in first argument 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['add'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['add'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -258,10 +250,8 @@ exports[`t-on t-on modifiers (native listener) basic support for native listener
|
||||
let block1 = createBlock(\`<div class=\\"myClass\\" block-handler-0=\\"click\\"><button block-handler-1=\\"click\\">Button</button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['divClicked'];
|
||||
let d1 = [v1, ctx];
|
||||
const v2 = ctx['btnClicked'];
|
||||
let d2 = [v2, ctx];
|
||||
let d1 = [ctx['divClicked'], ctx];
|
||||
let d2 = [ctx['btnClicked'], ctx];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
@@ -276,8 +266,7 @@ exports[`t-on t-on modifiers (native listener) t-on combined with t-esc 1`] = `
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click\\"><block-text-1/></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClick'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['onClick'], ctx];
|
||||
let d2 = ctx['text'];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
@@ -293,8 +282,7 @@ exports[`t-on t-on modifiers (native listener) t-on combined with t-out 1`] = `
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click\\"><block-child-0/></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClick'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['onClick'], ctx];
|
||||
let b2 = safeOutput(ctx['html']);
|
||||
return block1([d1], [b2]);
|
||||
}
|
||||
@@ -310,10 +298,8 @@ exports[`t-on t-on modifiers (native listener) t-on with .capture modifier 1`] =
|
||||
let block1 = createBlock(\`<div block-handler-0=\\"click.capture\\"><button block-handler-1=\\"click\\">Button</button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onCapture'];
|
||||
let d1 = [\\"capture\\", v1, ctx];
|
||||
const v2 = ctx['doSomething'];
|
||||
let d2 = [v2, ctx];
|
||||
let d1 = [\\"capture\\", ctx['onCapture'], ctx];
|
||||
let d2 = [ctx['doSomething'], ctx];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
@@ -343,8 +329,7 @@ exports[`t-on t-on modifiers (native listener) t-on with prevent and self modifi
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click.prevent.self\\"><span>Button</span></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClick'];
|
||||
let d1 = [\\"prevent\\",\\"self\\", v1, ctx];
|
||||
let d1 = [\\"prevent\\",\\"self\\", ctx['onClick'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -359,12 +344,9 @@ exports[`t-on t-on modifiers (native listener) t-on with prevent and/or stop mod
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click.prevent\\">Button 1</button><button block-handler-1=\\"click.stop\\">Button 2</button><button block-handler-2=\\"click.prevent.stop\\">Button 3</button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClickPrevented'];
|
||||
let d1 = [\\"prevent\\", v1, ctx];
|
||||
const v2 = ctx['onClickStopped'];
|
||||
let d2 = [\\"stop\\", v2, ctx];
|
||||
const v3 = ctx['onClickPreventedAndStopped'];
|
||||
let d3 = [\\"prevent\\",\\"stop\\", v3, ctx];
|
||||
let d1 = [\\"prevent\\", ctx['onClickPrevented'], ctx];
|
||||
let d2 = [\\"stop\\", ctx['onClickStopped'], ctx];
|
||||
let d3 = [\\"prevent\\",\\"stop\\", ctx['onClickPreventedAndStopped'], ctx];
|
||||
return block1([d1, d2, d3]);
|
||||
}
|
||||
}"
|
||||
@@ -406,8 +388,7 @@ exports[`t-on t-on modifiers (native listener) t-on with self and prevent modifi
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click.self.prevent\\"><span>Button</span></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClick'];
|
||||
let d1 = [\\"self\\",\\"prevent\\", v1, ctx];
|
||||
let d1 = [\\"self\\",\\"prevent\\", ctx['onClick'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
@@ -422,10 +403,8 @@ exports[`t-on t-on modifiers (native listener) t-on with self modifier 1`] = `
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click\\"><span>Button</span></button><button block-handler-1=\\"click.self\\"><span>Button</span></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['onClick'];
|
||||
let d1 = [v1, ctx];
|
||||
const v2 = ctx['onClickSelf'];
|
||||
let d2 = [\\"self\\", v2, ctx];
|
||||
let d1 = [ctx['onClick'], ctx];
|
||||
let d2 = [\\"self\\", ctx['onClickSelf'], ctx];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
@@ -440,10 +419,8 @@ exports[`t-on t-on modifiers (synthetic listener) basic support for synthetic 1`
|
||||
let block1 = createBlock(\`<div block-handler-0=\\"click.synthetic\\"><button block-handler-1=\\"click.synthetic\\">Button</button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['divClicked'];
|
||||
let d1 = [\\"synthetic\\", v1, ctx];
|
||||
const v2 = ctx['btnClicked'];
|
||||
let d2 = [\\"synthetic\\", v2, ctx];
|
||||
let d1 = [\\"synthetic\\", ctx['divClicked'], ctx];
|
||||
let d2 = [\\"synthetic\\", ctx['btnClicked'], ctx];
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
@@ -523,8 +500,7 @@ exports[`t-on t-on with t-call 1`] = `
|
||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['update'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['update'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
}"
|
||||
|
||||
@@ -182,7 +182,7 @@ exports[`misc other complex template 1`] = `
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
||||
const callTemplate_14 = getTemplate(\`LOAD_INFOS_TEMPLATE\`);
|
||||
const callTemplate_2 = getTemplate(\`LOAD_INFOS_TEMPLATE\`);
|
||||
|
||||
let block1 = createBlock(\`<div><header><nav class=\\"navbar navbar-expand-md navbar-light bg-light\\"><a block-attribute-0=\\"href\\"><b style=\\"color:#777;\\"><block-text-1/></b></a><button type=\\"button\\" class=\\"navbar-toggler\\" data-toggle=\\"collapse\\" data-target=\\"#top_menu_collapse\\"><span class=\\"navbar-toggler-icon\\"/></button><div class=\\"collapse navbar-collapse\\" id=\\"top_menu_collapse\\" aria-expanded=\\"false\\"><ul class=\\"nav navbar-nav ml-auto text-right\\" id=\\"top_menu\\"><block-child-0/><li class=\\"nav-item divider\\"/><block-child-1/></ul><div><div class=\\"input-group input-group-sm\\"><div class=\\"input-group-prepend input-group-sm\\"><button class=\\"btn btn-default fa fa-cog\\" title=\\"Settings\\" block-handler-2=\\"click\\"/><button class=\\"btn btn-default\\" block-handler-3=\\"click\\"> More </button><block-child-2/></div><input class=\\"form-control\\" type=\\"text\\" placeholder=\\"Search\\" aria-label=\\"Search\\" name=\\"search\\" block-attribute-4=\\"value\\" block-handler-5=\\"keyup\\" block-handler-6=\\"change\\" block-ref=\\"7\\"/><div class=\\"input-group-append\\"><button class=\\"btn btn-default fa fa-eraser\\" block-handler-8=\\"click\\"/></div></div></div></div></nav></header><div class=\\"container-fluid\\" block-ref=\\"9\\"><div class=\\"row\\"><!--div class=\\"form-group col-md-6\\">
|
||||
<h5>Search options</h5>
|
||||
@@ -223,9 +223,7 @@ exports[`misc other complex template 1`] = `
|
||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||
ctx[\`project\`] = v_block2[i1];
|
||||
let key1 = ctx['project'].id;
|
||||
const v1 = ctx['selectProject'];
|
||||
const v2 = ctx['project'];
|
||||
let d3 = [v1(v2), ctx];
|
||||
let d3 = [ctx['selectProject'](ctx['project']), ctx];
|
||||
let d4 = ctx['project'].name;
|
||||
c_block2[i1] = withKey(block3([d3, d4]), key1);
|
||||
}
|
||||
@@ -257,10 +255,8 @@ exports[`misc other complex template 1`] = `
|
||||
}
|
||||
b4 = multi([b5, b6]);
|
||||
}
|
||||
const v3 = ctx['toggleSettingsMenu'];
|
||||
let d11 = [v3, ctx];
|
||||
const v4 = ctx['toggleMore'];
|
||||
let d12 = [v4, ctx];
|
||||
let d11 = [ctx['toggleSettingsMenu'], ctx];
|
||||
let d12 = [ctx['toggleMore'], ctx];
|
||||
if (ctx['categories']&&ctx['categories'].length>1) {
|
||||
ctx = Object.create(ctx);
|
||||
const [k_block15, v_block15, l_block15, c_block15] = prepareList(ctx['categories']);
|
||||
@@ -277,13 +273,10 @@ exports[`misc other complex template 1`] = `
|
||||
b14 = block14([], [b15]);
|
||||
}
|
||||
let d16 = ctx['search'].value;
|
||||
const v5 = ctx['updateFilter'];
|
||||
let d17 = [v5, ctx];
|
||||
const v6 = ctx['updateFilter'];
|
||||
let d18 = [v6, ctx];
|
||||
let d17 = [ctx['updateFilter'], ctx];
|
||||
let d18 = [ctx['updateFilter'], ctx];
|
||||
let d19 = (el) => refs[\`search_input\`] = el;
|
||||
const v7 = ctx['clearSearch'];
|
||||
let d20 = [v7, ctx];
|
||||
let d20 = [ctx['clearSearch'], ctx];
|
||||
let d21 = (el) => refs[\`settings_menu\`] = el;
|
||||
if (ctx['triggers']) {
|
||||
ctx = Object.create(ctx);
|
||||
@@ -297,8 +290,7 @@ exports[`misc other complex template 1`] = `
|
||||
let d23 = \`trigger_\${ctx['trigger'].id}\`;
|
||||
let d24 = ctx['options'].trigger_display[ctx['trigger'].id];
|
||||
let d25 = ctx['trigger'].id;
|
||||
const v8 = ctx['updateTriggerDisplay'];
|
||||
let d26 = [v8, ctx];
|
||||
let d26 = [ctx['updateTriggerDisplay'], ctx];
|
||||
let d27 = \`trigger_\${ctx['trigger'].id}\`;
|
||||
let d28 = ctx['trigger'].name;
|
||||
b20 = block20([d22, d23, d24, d25, d26, d27, d28]);
|
||||
@@ -307,19 +299,15 @@ exports[`misc other complex template 1`] = `
|
||||
}
|
||||
ctx = ctx.__proto__;
|
||||
let b18 = list(c_block18);
|
||||
const v9 = ctx['triggerAll'];
|
||||
let d29 = [v9, ctx];
|
||||
const v10 = ctx['triggerNone'];
|
||||
let d30 = [v10, ctx];
|
||||
const v11 = ctx['triggerDefault'];
|
||||
let d31 = [v11, ctx];
|
||||
const v12 = ctx['toggleSettingsMenu'];
|
||||
let d32 = [v12, ctx];
|
||||
let d29 = [ctx['triggerAll'], ctx];
|
||||
let d30 = [ctx['triggerNone'], ctx];
|
||||
let d31 = [ctx['triggerDefault'], ctx];
|
||||
let d32 = [ctx['toggleSettingsMenu'], ctx];
|
||||
let b21 = block21([d29, d30, d31, d32]);
|
||||
b17 = multi([b18, b21]);
|
||||
}
|
||||
if (ctx['load_infos']) {
|
||||
b22 = callTemplate_14.call(this, ctx, node, key + \`__13\`);
|
||||
b22 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
if (ctx['message']) {
|
||||
let d33 = ctx['message'];
|
||||
@@ -328,8 +316,8 @@ exports[`misc other complex template 1`] = `
|
||||
if (!ctx['project']) {
|
||||
b24 = block24();
|
||||
} else {
|
||||
let b26 = component(\`BundlesList\`, {bundles: ctx['bundles'].sticky,category_custom_views: ctx['category_custom_views'],search: ctx['search']}, key + \`__15\`, node, ctx);
|
||||
let b27 = component(\`BundlesList\`, {bundles: ctx['bundles'].dev,search: ctx['search']}, key + \`__16\`, node, ctx);
|
||||
let b26 = component(\`BundlesList\`, {bundles: ctx['bundles'].sticky,category_custom_views: ctx['category_custom_views'],search: ctx['search']}, key + \`__3\`, node, ctx);
|
||||
let b27 = component(\`BundlesList\`, {bundles: ctx['bundles'].dev,search: ctx['search']}, key + \`__4\`, node, ctx);
|
||||
b25 = block25([], [b26, b27]);
|
||||
}
|
||||
return block1([d1, d2, d11, d12, d16, d17, d18, d19, d20, d21], [b2, b4, b14, b17, b22, b23, b24, b25]);
|
||||
|
||||
Reference in New Issue
Block a user