From 67f11ff350e2dbe87b6cf40b11ca62d6ce3f425f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre=20=28lul=29?= Date: Mon, 25 Mar 2024 12:04:50 +0100 Subject: [PATCH] [FIX] spreadsheet: update o_spreadsheet to latest version ### Contains the following commits: https://github.com/odoo/o-spreadsheet/commit/9b128f8c [REL] 17.0.16 https://github.com/odoo/o-spreadsheet/commit/389177f9 [FIX] Composer: weird behavior of autocomplete dropdown https://github.com/odoo/o-spreadsheet/commit/7e7b0692 [FIX] formula assistant: localize argument separator Task: 3789860 https://github.com/odoo/o-spreadsheet/commit/2f96ca07 [FIX] TopBar: Remove hidden functions from the `insert` menu Task: 3810284 https://github.com/odoo/o-spreadsheet/commit/fa60ddf1 [FIX] Composer: force light mode of the formula assitant Task: 3806513 https://github.com/odoo/o-spreadsheet/commit/69ccee4f [FIX] cf_editor: remove broken css rule Task: 3806513 https://github.com/odoo/o-spreadsheet/commit/dd7584ec [FIX] Spreadsheet: split button style to form/color https://github.com/odoo/o-spreadsheet/commit/fe4ffe1d [FIX] export: export non-Excel formulas as value https://github.com/odoo/o-spreadsheet/commit/0be37a0d [FIX] FigureComponent: Undo/Redo broken after pasting figure https://github.com/odoo/o-spreadsheet/commit/d1e41517 [FIX] evaluation: accept 1x1 result array in sub-formula closes odoo/odoo#159066 Signed-off-by: Pierre Rousseau (pro) --- .../static/src/o_spreadsheet/o_spreadsheet.js | 84 ++++++++++++++----- .../src/o_spreadsheet/o_spreadsheet.xml | 52 +++++++----- 2 files changed, 96 insertions(+), 40 deletions(-) diff --git a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js index a9f6e836698..8a34d916dfb 100644 --- a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js +++ b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js @@ -2,9 +2,9 @@ /** * This file is generated by o-spreadsheet build tools. Do not edit it. * @see https://github.com/odoo/o-spreadsheet - * @version 17.0.15 - * @date 2024-03-15T12:12:08.617Z - * @hash e02add99e + * @version 17.0.16 + * @date 2024-03-25T11:04:46.936Z + * @hash 9b128f8c */ (function (exports, owl) { @@ -11056,6 +11056,9 @@ result.default = true; result.defaultValue = defaultValue; } + if (types.some((t) => t.startsWith("RANGE"))) { + result.acceptMatrix = true; + } return result; } /** @@ -19421,11 +19424,27 @@ } const descr = addMetaInfoFromArg(addDescr); validateArguments(descr.args); - this.mapping[name] = createComputeFunctionFromDescription(descr); + this.mapping[name] = addInputHandling(descr, createComputeFunctionFromDescription(descr)); super.add(name, descr); return this; } } + function addInputHandling(descr, computeFunction) { + function computeWithInputHandling(...args) { + for (let i = 0; i < args.length; i++) { + const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1]; + const arg = args[i]; + if (isMatrix(arg) && !argDefinition.acceptMatrix) { + if (arg.length !== 1 || arg[0].length !== 1) { + throw new EvaluationError(CellErrorType.GenericError, _t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be a single value or a single cell reference, not a range.", argDefinition.name)); + } + args[i] = arg[0][0]; + } + } + return computeFunction.apply(this, args); + } + return computeWithInputHandling; + } function createComputeFunctionFromDescription(descr) { const computeValueAndFormat = "computeValueAndFormat" in descr; const computeValue = "compute" in descr; @@ -19676,14 +19695,19 @@ children: [allFunctionListMenuBuilder], }; function allFunctionListMenuBuilder() { - const fnNames = functionRegistry.getKeys(); + const fnNames = functionRegistry.getKeys().filter((key) => !functionRegistry.get(key).hidden); return createFormulaFunctions(fnNames); } const categoriesFunctionListMenuBuilder = () => { const functions = functionRegistry.content; - const categories = [...new Set(functionRegistry.getAll().map((fn) => fn.category))].filter(isDefined$1); + const categories = [ + ...new Set(functionRegistry + .getAll() + .filter((fn) => !fn.hidden) + .map((fn) => fn.category)), + ].filter(isDefined$1); return categories.sort().map((category, i) => { - const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category); + const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category && !functions[key].hidden); return { name: category, children: createFormulaFunctions(functionsInCategory), @@ -23336,11 +23360,9 @@ } .o-cell-is-operator { margin-bottom: 5px; - width: 96%; } .o-cell-is-value { margin-bottom: 5px; - width: 96%; } .o-color-picker-widget .o-color-picker-button { pointer-events: all; @@ -25706,6 +25728,9 @@ el?.focus({ preventScroll: true }); } }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]); + owl.onWillUnmount(() => { + this.props.onFigureDeleted(); + }); } clickAnchor(dirX, dirY, ev) { this.props.onClickAnchor(dirX, dirY, ev); @@ -25724,6 +25749,7 @@ this.props.onFigureDeleted(); ev.stopPropagation(); ev.preventDefault(); + ev.stopPropagation(); break; case "ArrowDown": case "ArrowLeft": @@ -25744,6 +25770,7 @@ }); ev.stopPropagation(); ev.preventDefault(); + ev.stopPropagation(); break; } } @@ -26425,6 +26452,7 @@ // ----------------------------------------------------------------------------- css /* scss */ ` .o-formula-assistant { + background: #ffffff; .o-formula-assistant-head { background-color: #f2f2f2; padding: 10px; @@ -26475,6 +26503,9 @@ this.assistantState.allowCellSelectionBehind = false; }, 2000); } + get formulaArgSeparator() { + return this.env.model.getters.getLocale().formulaArgSeparator + " "; + } } FunctionDescriptionProvider.props = { functionName: String, @@ -26626,6 +26657,12 @@ owl.useEffect(() => { this.processContent(); }); + owl.onPatched(() => { + // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true + if (this.env.model.getters.getEditionMode() === "inactive") { + this.processTokenAtCursor(); + } + }); } // --------------------------------------------------------------------------- // Handlers @@ -41586,7 +41623,7 @@ ? getItemId(newFormat, data.formats) : exportedCellData.format; let content; - if (formulaCell instanceof FormulaCellWithDependencies) { + if (isFormula && formulaCell instanceof FormulaCellWithDependencies) { content = this.getters.getFormulaCellContent(exportedSheetData.id, formulaCell.compiledFormula, formulaCell.compiledFormula.dependencies, true); } else { @@ -49296,6 +49333,7 @@ this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z)); this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone); this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones); + this.selectedFigureId = null; break; } /** Any change to the selection has to be reflected in the selection processor. */ @@ -52873,9 +52911,6 @@ .text-muted { color: grey !important; } - button { - color: #333; - } .o-disabled { opacity: 0.4; pointer: default; @@ -52996,17 +53031,17 @@ } .o-button { - border: 1px solid lightgrey; + border: 1px solid; padding: 0px 20px 0px 20px; border-radius: 4px; font-weight: 500; font-size: 14px; height: 30px; line-height: 16px; - background: white; margin-right: 8px; - &:hover:enabled { - background-color: rgba(0, 0, 0, 0.08); + + &:not(:hover) { + background-color: transparent; } &:enabled { @@ -53020,6 +53055,15 @@ &:last-child { margin-right: 0px; } + + &.o-button-grey { + border-color: lightgrey; + background: #ffffff; + color: #333; + &:hover:enabled { + background-color: rgba(0, 0, 0, 0.08); + } + } } .o-input { @@ -56967,9 +57011,9 @@ exports.tokenize = tokenize; - __info__.version = "17.0.15"; - __info__.date = "2024-03-15T12:12:08.617Z"; - __info__.hash = "e02add99e"; + __info__.version = "17.0.16"; + __info__.date = "2024-03-25T11:04:46.936Z"; + __info__.hash = "9b128f8c"; })(this.o_spreadsheet = this.o_spreadsheet || {}, owl); diff --git a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml index 0fcd6068504..1d5d3040ce1 100644 --- a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml +++ b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml @@ -1,9 +1,9 @@ @@ -508,7 +508,7 @@ }">
@@ -516,7 +516,7 @@ ( - ,  + [ @@ -1015,7 +1015,12 @@ class="o-grid-add-rows mt-2 ms-2 w-100 d-flex position-relative align-items-center" t-att-style="addRowsPosition" t-on-mousedown.stop.prevent=""> - + onClose="() => this.menu.isOpen=false" />
- - +
@@ -3405,8 +3410,12 @@ https://fontawesome.com/license -->
- - +
@@ -3740,7 +3749,7 @@ https://fontawesome.com/license -->
- @@ -3926,10 +3935,10 @@ https://fontawesome.com/license -->
- + @@ -4004,10 +4013,13 @@ https://fontawesome.com/license --> -
@@ -4027,13 +4039,13 @@ https://fontawesome.com/license --> @@ -4094,7 +4106,7 @@ https://fontawesome.com/license -->