16.0 vanilla version

This commit is contained in:
Ernad Husremovic 2025-10-08 10:46:05 +02:00
parent 2e65bf056a
commit 8c653da57a
5 changed files with 2045 additions and 4742 deletions

View file

@ -4542,7 +4542,7 @@
const isNewBlock = !block || forceNewBlock;
let codeIdx = this.target.code.length;
if (isNewBlock) {
const n = ast.content.filter((c) => c.type !== 6 /* TSet */).length;
const n = ast.content.filter((c) => !c.hasNoRepresentation).length;
let result = null;
if (n <= 1) {
for (let child of ast.content) {
@ -4556,15 +4556,15 @@
let index = 0;
for (let i = 0, l = ast.content.length; i < l; i++) {
const child = ast.content[i];
const isTSet = child.type === 6 /* TSet */;
const forceNewBlock = !child.hasNoRepresentation;
const subCtx = createContext(ctx, {
block,
index,
forceNewBlock: !isTSet,
forceNewBlock,
isLast: ctx.isLast && i === l - 1,
});
this.compileAST(child, subCtx);
if (!isTSet) {
if (forceNewBlock) {
index++;
}
}
@ -4982,9 +4982,9 @@
parseTCallBlock(node) ||
parseTTranslation(node, ctx) ||
parseTTranslationContext(node, ctx) ||
parseTKey(node, ctx) ||
parseTEscNode(node, ctx) ||
parseTOutNode(node, ctx) ||
parseTKey(node, ctx) ||
parseTSlot(node, ctx) ||
parseComponent(node, ctx) ||
parseDOMNode(node, ctx) ||
@ -5052,19 +5052,29 @@
function parseTDebugLog(node, ctx) {
if (node.hasAttribute("t-debug")) {
node.removeAttribute("t-debug");
return {
const content = parseNode(node, ctx);
const ast = {
type: 12 /* TDebug */,
content: parseNode(node, ctx),
content,
};
if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
ast.hasNoRepresentation = true;
}
return ast;
}
if (node.hasAttribute("t-log")) {
const expr = node.getAttribute("t-log");
node.removeAttribute("t-log");
return {
const content = parseNode(node, ctx);
const ast = {
type: 13 /* TLog */,
expr,
content: parseNode(node, ctx),
content,
};
if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
ast.hasNoRepresentation = true;
}
return ast;
}
return null;
}
@ -5294,11 +5304,19 @@
}
const key = node.getAttribute("t-key");
node.removeAttribute("t-key");
const body = parseNode(node, ctx);
if (!body) {
const content = parseNode(node, ctx);
if (!content) {
return null;
}
return { type: 10 /* TKey */, expr: key, content: body };
const ast = {
type: 10 /* TKey */,
expr: key,
content,
};
if (content.hasNoRepresentation) {
ast.hasNoRepresentation = true;
}
return ast;
}
// -----------------------------------------------------------------------------
// t-call
@ -5407,7 +5425,7 @@
if (node.textContent !== node.innerHTML) {
body = parseChildren(node, ctx);
}
return { type: 6 /* TSet */, name, value, defaultValue, body };
return { type: 6 /* TSet */, name, value, defaultValue, body, hasNoRepresentation: true };
}
// -----------------------------------------------------------------------------
// Components
@ -5586,30 +5604,51 @@
// -----------------------------------------------------------------------------
// Translation
// -----------------------------------------------------------------------------
function wrapInTTranslationAST(r) {
const ast = { type: 16 /* TTranslation */, content: r };
if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
ast.hasNoRepresentation = true;
}
return ast;
}
function parseTTranslation(node, ctx) {
if (node.getAttribute("t-translation") !== "off") {
return null;
}
node.removeAttribute("t-translation");
return {
type: 16 /* TTranslation */,
content: parseNode(node, ctx),
};
const result = parseNode(node, ctx);
if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
const children = result.content.map(wrapInTTranslationAST);
return makeASTMulti(children);
}
return wrapInTTranslationAST(result);
}
// -----------------------------------------------------------------------------
// Translation Context
// -----------------------------------------------------------------------------
function wrapInTTranslationContextAST(r, translationCtx) {
const ast = {
type: 17 /* TTranslationContext */,
content: r,
translationCtx,
};
if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
ast.hasNoRepresentation = true;
}
return ast;
}
function parseTTranslationContext(node, ctx) {
const translationCtx = node.getAttribute("t-translation-context");
if (!translationCtx) {
return null;
}
node.removeAttribute("t-translation-context");
return {
type: 17 /* TTranslationContext */,
content: parseNode(node, ctx),
translationCtx,
};
const result = parseNode(node, ctx);
if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
const children = result.content.map((c) => wrapInTTranslationContextAST(c, translationCtx));
return makeASTMulti(children);
}
return wrapInTTranslationContextAST(result, translationCtx);
}
// -----------------------------------------------------------------------------
// Portal
@ -5654,6 +5693,13 @@
}
return children;
}
function makeASTMulti(children) {
const ast = { type: 3 /* Multi */, content: children };
if (children.every((c) => c.hasNoRepresentation)) {
ast.hasNoRepresentation = true;
}
return ast;
}
/**
* Parse all the child nodes of a given node and return an ast if possible.
* In the case there are multiple children, they are wrapped in a astmulti.
@ -5666,7 +5712,7 @@
case 1:
return children[0];
default:
return { type: 3 /* Multi */, content: children };
return makeASTMulti(children);
}
}
/**
@ -5770,7 +5816,7 @@
}
// do not modify manually. This file is generated by the release script.
const version = "2.8.0";
const version = "2.8.1";
// -----------------------------------------------------------------------------
// Scheduler
@ -6279,8 +6325,8 @@
Object.defineProperty(exports, '__esModule', { value: true });
__info__.date = '2025-06-30T12:46:06.424Z';
__info__.hash = 'b620502';
__info__.date = '2025-09-23T07:17:45.055Z';
__info__.hash = '5211116';
__info__.url = 'https://github.com/odoo/owl';

View file

@ -5090,7 +5090,7 @@ QUnit.module("Views", (hooks) => {
assert.containsOnce(target, ".o_notification_manager .o_notification");
});
QUnit.test("keynav: switching to another record from an invalid one", async function (assert) {
QUnit.skip("keynav: switching to another record from an invalid one", async function (assert) {
await makeView({
type: "form",
resModel: "partner",
@ -5159,7 +5159,7 @@ QUnit.module("Views", (hooks) => {
assert.strictEqual(target.querySelector(".o_pager_value").textContent, "1");
});
QUnit.test("keynav: switching to another record from a dirty one", async function (assert) {
QUnit.skip("keynav: switching to another record from a dirty one", async function (assert) {
let nbWrite = 0;
await makeView({
type: "form",