mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] update owl to v1.4.9
This commit is contained in:
@@ -359,6 +359,7 @@
|
|||||||
* the list of variables so it does not get replaced by a lookup in the context
|
* the list of variables so it does not get replaced by a lookup in the context
|
||||||
*/
|
*/
|
||||||
function compileExprToArray(expr, scope) {
|
function compileExprToArray(expr, scope) {
|
||||||
|
const localVars = new Set();
|
||||||
scope = Object.create(scope);
|
scope = Object.create(scope);
|
||||||
const tokens = tokenize(expr);
|
const tokens = tokenize(expr);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
@@ -407,12 +408,14 @@
|
|||||||
if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
|
if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
|
||||||
tokens[j].value = tokens[j].originalValue;
|
tokens[j].value = tokens[j].originalValue;
|
||||||
scope[tokens[j].value] = { id: tokens[j].value, expr: tokens[j].value };
|
scope[tokens[j].value] = { id: tokens[j].value, expr: tokens[j].value };
|
||||||
|
localVars.add(tokens[j].value);
|
||||||
}
|
}
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope[token.value] = { id: token.value, expr: token.value };
|
scope[token.value] = { id: token.value, expr: token.value };
|
||||||
|
localVars.add(token.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isVar) {
|
if (isVar) {
|
||||||
@@ -427,6 +430,13 @@
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
// Mark all variables that have been used locally.
|
||||||
|
// This assumes the expression has only one scope (incorrect but "good enough for now")
|
||||||
|
for (const token of tokens) {
|
||||||
|
if (token.type === "SYMBOL" && localVars.has(token.value)) {
|
||||||
|
token.isLocal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
function compileExpr(expr, scope) {
|
function compileExpr(expr, scope) {
|
||||||
@@ -578,7 +588,18 @@
|
|||||||
const done = new Set();
|
const done = new Set();
|
||||||
return tokens
|
return tokens
|
||||||
.map((tok) => {
|
.map((tok) => {
|
||||||
if (tok.varName) {
|
// "this" in captured expressions should be the current component
|
||||||
|
if (tok.value === "this") {
|
||||||
|
if (!done.has("this")) {
|
||||||
|
done.add("this");
|
||||||
|
this.addLine(`const this_${argId} = utils.getComponent(context);`);
|
||||||
|
}
|
||||||
|
tok.value = `this_${argId}`;
|
||||||
|
}
|
||||||
|
// Variables that should be looked up in the scope. isLocal is for arrow
|
||||||
|
// function arguments that should stay untouched (eg "ev => ev" should
|
||||||
|
// not become "const ev_1 = scope['ev']; ev_1 => ev_1")
|
||||||
|
if (tok.varName && !tok.isLocal) {
|
||||||
if (!done.has(tok.varName)) {
|
if (!done.has(tok.varName)) {
|
||||||
done.add(tok.varName);
|
done.add(tok.varName);
|
||||||
this.addLine(`const ${tok.varName}_${argId} = ${tok.value};`);
|
this.addLine(`const ${tok.varName}_${argId} = ${tok.value};`);
|
||||||
@@ -3176,10 +3197,15 @@ See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for mor
|
|||||||
else if (!name.startsWith("t-")) {
|
else if (!name.startsWith("t-")) {
|
||||||
if (name !== "class" && name !== "style") {
|
if (name !== "class" && name !== "style") {
|
||||||
// this is a prop!
|
// this is a prop!
|
||||||
|
if (value.includes("=>")) {
|
||||||
|
props[name] = ctx.captureExpression(value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
props[name] = ctx.formatExpression(value) || "undefined";
|
props[name] = ctx.formatExpression(value) || "undefined";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// computing the props string representing the props object
|
// computing the props string representing the props object
|
||||||
let propStr = Object.keys(props)
|
let propStr = Object.keys(props)
|
||||||
.map((k) => k + ":" + props[k])
|
.map((k) => k + ":" + props[k])
|
||||||
@@ -5546,9 +5572,9 @@ See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for mor
|
|||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
|
||||||
__info__.version = '1.4.8';
|
__info__.version = '1.4.9';
|
||||||
__info__.date = '2021-11-03T12:45:06.330Z';
|
__info__.date = '2021-12-07T09:22:06.573Z';
|
||||||
__info__.hash = '307b936';
|
__info__.hash = '73f94fb';
|
||||||
__info__.url = 'https://github.com/odoo/owl';
|
__info__.url = 'https://github.com/odoo/owl';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user