@odoo/o-spreadsheet 16.0.13 → 16.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -719,12 +719,20 @@ function getDefaultCellHeight(style, numberOfLines) {
719
719
  2 * PADDING_AUTORESIZE_VERTICAL);
720
720
  }
721
721
  function computeTextWidth(context, text, style) {
722
- context.save();
723
- context.font = computeTextFont(style);
724
- const textWidth = context.measureText(text).width;
725
- context.restore();
726
- return textWidth;
722
+ const font = computeTextFont(style);
723
+ if (!textWidthCache[font]) {
724
+ textWidthCache[font] = {};
725
+ }
726
+ if (textWidthCache[font][text] === undefined) {
727
+ context.save();
728
+ context.font = font;
729
+ const textWidth = context.measureText(text).width;
730
+ context.restore();
731
+ textWidthCache[font][text] = textWidth;
732
+ }
733
+ return textWidthCache[font][text];
727
734
  }
735
+ const textWidthCache = {};
728
736
  function computeTextFont(style) {
729
737
  const italic = style.italic ? "italic " : "";
730
738
  const weight = style.bold ? "bold" : DEFAULT_FONT_WEIGHT;
@@ -28643,7 +28651,14 @@ class FiltersPlugin extends CorePlugin {
28643
28651
  this.history.update("tables", filterTables);
28644
28652
  break;
28645
28653
  case "DUPLICATE_SHEET":
28646
- this.history.update("tables", cmd.sheetIdTo, deepCopy(this.tables[cmd.sheetId]));
28654
+ const tables = {};
28655
+ for (const filterTable of Object.values(this.tables[cmd.sheetId] || {})) {
28656
+ if (filterTable) {
28657
+ const newFilterTable = deepCopy(filterTable);
28658
+ tables[newFilterTable.id] = newFilterTable;
28659
+ }
28660
+ }
28661
+ this.history.update("tables", cmd.sheetIdTo, tables);
28647
28662
  break;
28648
28663
  case "ADD_COLUMNS_ROWS":
28649
28664
  this.onAddColumnsRows(cmd);
@@ -35147,6 +35162,9 @@ SelectionInputPlugin.getters = [];
35147
35162
  * This plugin handles this internal state.
35148
35163
  */
35149
35164
  class SelectionInputsManagerPlugin extends UIPlugin {
35165
+ get currentInput() {
35166
+ return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
35167
+ }
35150
35168
  constructor(getters, state, dispatch, config, selection) {
35151
35169
  super(getters, state, dispatch, config, selection);
35152
35170
  this.state = state;
@@ -35154,9 +35172,6 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35154
35172
  this.inputs = {};
35155
35173
  this.focusedInputId = null;
35156
35174
  }
35157
- get currentInput() {
35158
- return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
35159
- }
35160
35175
  // ---------------------------------------------------------------------------
35161
35176
  // Command Handling
35162
35177
  // ---------------------------------------------------------------------------
@@ -42785,6 +42800,6 @@ function addFunction(functionName, functionDescription) {
42785
42800
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
42786
42801
 
42787
42802
 
42788
- __info__.version = '16.0.13';
42789
- __info__.date = '2023-06-12T13:44:11.940Z';
42790
- __info__.hash = '3c9ec1e';
42803
+ __info__.version = '16.0.14';
42804
+ __info__.date = '2023-06-26T14:33:01.959Z';
42805
+ __info__.hash = '1e37a94';
@@ -720,12 +720,20 @@
720
720
  2 * PADDING_AUTORESIZE_VERTICAL);
721
721
  }
722
722
  function computeTextWidth(context, text, style) {
723
- context.save();
724
- context.font = computeTextFont(style);
725
- const textWidth = context.measureText(text).width;
726
- context.restore();
727
- return textWidth;
723
+ const font = computeTextFont(style);
724
+ if (!textWidthCache[font]) {
725
+ textWidthCache[font] = {};
726
+ }
727
+ if (textWidthCache[font][text] === undefined) {
728
+ context.save();
729
+ context.font = font;
730
+ const textWidth = context.measureText(text).width;
731
+ context.restore();
732
+ textWidthCache[font][text] = textWidth;
733
+ }
734
+ return textWidthCache[font][text];
728
735
  }
736
+ const textWidthCache = {};
729
737
  function computeTextFont(style) {
730
738
  const italic = style.italic ? "italic " : "";
731
739
  const weight = style.bold ? "bold" : DEFAULT_FONT_WEIGHT;
@@ -28644,7 +28652,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28644
28652
  this.history.update("tables", filterTables);
28645
28653
  break;
28646
28654
  case "DUPLICATE_SHEET":
28647
- this.history.update("tables", cmd.sheetIdTo, deepCopy(this.tables[cmd.sheetId]));
28655
+ const tables = {};
28656
+ for (const filterTable of Object.values(this.tables[cmd.sheetId] || {})) {
28657
+ if (filterTable) {
28658
+ const newFilterTable = deepCopy(filterTable);
28659
+ tables[newFilterTable.id] = newFilterTable;
28660
+ }
28661
+ }
28662
+ this.history.update("tables", cmd.sheetIdTo, tables);
28648
28663
  break;
28649
28664
  case "ADD_COLUMNS_ROWS":
28650
28665
  this.onAddColumnsRows(cmd);
@@ -35148,6 +35163,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35148
35163
  * This plugin handles this internal state.
35149
35164
  */
35150
35165
  class SelectionInputsManagerPlugin extends UIPlugin {
35166
+ get currentInput() {
35167
+ return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
35168
+ }
35151
35169
  constructor(getters, state, dispatch, config, selection) {
35152
35170
  super(getters, state, dispatch, config, selection);
35153
35171
  this.state = state;
@@ -35155,9 +35173,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35155
35173
  this.inputs = {};
35156
35174
  this.focusedInputId = null;
35157
35175
  }
35158
- get currentInput() {
35159
- return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
35160
- }
35161
35176
  // ---------------------------------------------------------------------------
35162
35177
  // Command Handling
35163
35178
  // ---------------------------------------------------------------------------
@@ -42816,9 +42831,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42816
42831
  Object.defineProperty(exports, '__esModule', { value: true });
42817
42832
 
42818
42833
 
42819
- __info__.version = '16.0.13';
42820
- __info__.date = '2023-06-12T13:44:11.940Z';
42821
- __info__.hash = '3c9ec1e';
42834
+ __info__.version = '16.0.14';
42835
+ __info__.date = '2023-06-26T14:33:01.959Z';
42836
+ __info__.hash = '1e37a94';
42822
42837
 
42823
42838
 
42824
42839
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);