diff --git a/addons/spreadsheet/static/src/currency/formulas.js b/addons/spreadsheet/static/src/currency/formulas.js index 90c6de3d765..2daae5e98fd 100644 --- a/addons/spreadsheet/static/src/currency/formulas.js +++ b/addons/spreadsheet/static/src/currency/formulas.js @@ -2,7 +2,7 @@ import { _t } from "@web/core/l10n/translation"; import spreadsheet from "../o_spreadsheet/o_spreadsheet_extended"; -const { args, toString, toJSDate } = spreadsheet.helpers; +const { arg, toString, toJSDate } = spreadsheet.helpers; const { functionRegistry } = spreadsheet.registries; @@ -15,10 +15,10 @@ functionRegistry const _date = date ? toJSDate(date) : undefined; return this.getters.getCurrencyRate(from, to, _date); }, - args: args(` - currency_from (string) ${_t("First currency code.")} - currency_to (string) ${_t("Second currency code.")} - date (date, optional) ${_t("Date of the rate.")} - `), + args: [ + arg("currency_from (string)", _t("First currency code.")), + arg("currency_to (string)", _t("Second currency code.")), + arg("date (date, optional)", _t("Date of the rate.")), + ], returns: ["NUMBER"], }); diff --git a/addons/spreadsheet/static/src/list/list_functions.js b/addons/spreadsheet/static/src/list/list_functions.js index efced2a1add..64693b6071c 100644 --- a/addons/spreadsheet/static/src/list/list_functions.js +++ b/addons/spreadsheet/static/src/list/list_functions.js @@ -3,7 +3,7 @@ import { _t } from "web.core"; import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended"; -const { args, toString, toNumber } = spreadsheet.helpers; +const { arg, toString, toNumber } = spreadsheet.helpers; const { functionRegistry } = spreadsheet.registries; //-------------------------------------------------------------------------- @@ -18,11 +18,11 @@ function assertListsExists(listId, getters) { functionRegistry.add("ODOO.LIST", { description: _t("Get the value from a list."), - args: args(` - list_id (string) ${_t("ID of the list.")} - index (string) ${_t("Position of the record in the list.")} - field_name (string) ${_t("Name of the field.")} - `), + args: [ + arg("list_id (string)", _t("ID of the list.")), + arg("index (string)", _t("Position of the record in the list.")), + arg("field_name (string)", _t("Name of the field.")), + ], compute: function (listId, index, fieldName) { const id = toString(listId); const position = toNumber(index) - 1; @@ -60,10 +60,10 @@ functionRegistry.add("ODOO.LIST", { functionRegistry.add("ODOO.LIST.HEADER", { description: _t("Get the header of a list."), - args: args(` - list_id (string) ${_t("ID of the list.")} - field_name (string) ${_t("Name of the field.")} - `), + args: [ + arg("list_id (string)", _t("ID of the list.")), + arg("field_name (string)", _t("Name of the field.")), + ], compute: function (listId, fieldName) { const id = toString(listId); const field = toString(fieldName); diff --git a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js index 06627c5a243..c92deeea86f 100644 --- a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js +++ b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js @@ -1,26 +1,6 @@ (function (exports, owl) { 'use strict'; - function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); - } - - var owl__namespace = /*#__PURE__*/_interopNamespace(owl); - /* * usage: every string should be translated either with _lt if they are registered with a registry at * the load of the app or with Spreadsheet._t in the templates. Spreadsheet._t is exposed in the @@ -266,6 +246,7 @@ const DEFAULT_FIGURE_WIDTH = 536; // Chart const MAX_CHAR_LABEL = 20; + const FIGURE_ID_SPLITTER = "??"; const DEFAULT_GAUGE_LOWER_COLOR = "#cc0000"; const DEFAULT_GAUGE_MIDDLE_COLOR = "#f1c232"; const DEFAULT_GAUGE_UPPER_COLOR = "#6aa84f"; @@ -293,7 +274,6 @@ ComponentsImportance[ComponentsImportance["Dropdown"] = 16] = "Dropdown"; ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer"; ComponentsImportance[ComponentsImportance["TopBarComposer"] = 21] = "TopBarComposer"; - ComponentsImportance[ComponentsImportance["ColorPicker"] = 25] = "ColorPicker"; ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker"; ComponentsImportance[ComponentsImportance["Popover"] = 30] = "Popover"; ComponentsImportance[ComponentsImportance["ChartAnchor"] = 1000] = "ChartAnchor"; @@ -3573,6 +3553,8 @@ CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets"; CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId"; CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep"; + CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId"; + CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist"; })(exports.CommandResult || (exports.CommandResult = {})); var DIRECTION; @@ -5430,7 +5412,7 @@ validateChartDefinition: (validator, definition) => BarChart.validateChartDefinition(validator, definition), transformDefinition: (definition, executed) => BarChart.transformDefinition(definition, executed), getChartDefinitionFromContextCreation: (context) => BarChart.getDefinitionFromContextCreation(context), - name: "Bar", + name: _lt("Bar"), sequence: 10, }); chartRegistry.add("line", { @@ -5440,7 +5422,7 @@ validateChartDefinition: (validator, definition) => LineChart.validateChartDefinition(validator, definition), transformDefinition: (definition, executed) => LineChart.transformDefinition(definition, executed), getChartDefinitionFromContextCreation: (context) => LineChart.getDefinitionFromContextCreation(context), - name: "Line", + name: _lt("Line"), sequence: 20, }); chartRegistry.add("pie", { @@ -5450,7 +5432,7 @@ validateChartDefinition: (validator, definition) => PieChart.validateChartDefinition(validator, definition), transformDefinition: (definition, executed) => PieChart.transformDefinition(definition, executed), getChartDefinitionFromContextCreation: (context) => PieChart.getDefinitionFromContextCreation(context), - name: "Pie", + name: _lt("Pie"), sequence: 30, }); chartRegistry.add("scorecard", { @@ -5460,7 +5442,7 @@ validateChartDefinition: (validator, definition) => ScorecardChart.validateChartDefinition(validator, definition), transformDefinition: (definition, executed) => ScorecardChart.transformDefinition(definition, executed), getChartDefinitionFromContextCreation: (context) => ScorecardChart.getDefinitionFromContextCreation(context), - name: "Scorecard", + name: _lt("Scorecard"), sequence: 40, }); chartRegistry.add("gauge", { @@ -5470,7 +5452,7 @@ validateChartDefinition: (validator, definition) => GaugeChart.validateChartDefinition(validator, definition), transformDefinition: (definition, executed) => GaugeChart.transformDefinition(definition, executed), getChartDefinitionFromContextCreation: (context) => GaugeChart.getDefinitionFromContextCreation(context), - name: "Gauge", + name: _lt("Gauge"), sequence: 50, }); const chartComponentRegistry = new Registry(); @@ -5584,28 +5566,28 @@ return position; } /** - * Return the component (or ref's component) top left position (in pixels) relative + * Return the component (or ref's component) BoundingRect, relative * to the upper left corner of the screen (
element). * * Note: when used with a