@odoo/o-spreadsheet 16.0.51 → 16.0.53

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.
@@ -33954,11 +33954,7 @@ class FindAndReplacePlugin extends UIPlugin {
33954
33954
  }
33955
33955
  if (cell &&
33956
33956
  this.currentSearchRegex &&
33957
- this.currentSearchRegex.test(this.searchOptions.searchFormulas
33958
- ? cell.isFormula()
33959
- ? cell.content
33960
- : String(cell.evaluated.value)
33961
- : String(cell.evaluated.value))) {
33957
+ this.currentSearchRegex.test(this.searchOptions.searchFormulas ? cell.content : String(cell.evaluated.value))) {
33962
33958
  const position = this.getters.getCellPosition(cell.id);
33963
33959
  const match = { col: position.col, row: position.row, selected: false };
33964
33960
  matches.push(match);
@@ -35112,6 +35108,8 @@ class GridSelectionPlugin extends UIPlugin {
35112
35108
  this.selectedFigureId = null;
35113
35109
  break;
35114
35110
  }
35111
+ }
35112
+ finalize() {
35115
35113
  /** Any change to the selection has to be reflected in the selection processor. */
35116
35114
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
35117
35115
  }
@@ -36594,6 +36592,7 @@ class Session extends EventBus {
36594
36592
  case "REMOTE_REVISION":
36595
36593
  case "REVISION_REDONE":
36596
36594
  case "REVISION_UNDONE":
36595
+ case "SNAPSHOT_CREATED":
36597
36596
  return this.processedRevisions.has(message.nextRevisionId);
36598
36597
  default:
36599
36598
  return false;
@@ -37111,7 +37110,6 @@ class SheetViewPlugin extends UIPlugin {
37111
37110
  }
37112
37111
  handle(cmd) {
37113
37112
  var _a;
37114
- this.cleanViewports();
37115
37113
  switch (cmd.type) {
37116
37114
  case "START":
37117
37115
  this.selection.observe(this, {
@@ -37156,6 +37154,9 @@ class SheetViewPlugin extends UIPlugin {
37156
37154
  this.sheetsWithDirtyViewports.add(cmd.sheetId);
37157
37155
  }
37158
37156
  break;
37157
+ case "DELETE_SHEET":
37158
+ this.cleanViewports();
37159
+ break;
37159
37160
  case "ACTIVATE_SHEET":
37160
37161
  this.setViewports();
37161
37162
  this.refreshViewport(cmd.sheetIdTo);
@@ -37472,6 +37473,7 @@ class SheetViewPlugin extends UIPlugin {
37472
37473
  }
37473
37474
  }
37474
37475
  resetSheetViews() {
37476
+ this.cleanViewports();
37475
37477
  for (let sheetId of Object.keys(this.viewports)) {
37476
37478
  const position = this.getters.getSheetPosition(sheetId);
37477
37479
  this.resetViewports(sheetId);
@@ -41857,30 +41859,27 @@ function addFormula(cell) {
41857
41859
  const isExported = tokens
41858
41860
  .filter((tk) => tk.type === "FUNCTION")
41859
41861
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41862
+ const type = getCellType(cell.value);
41860
41863
  if (isExported) {
41861
- let cycle = escapeXml ``;
41862
41864
  const XlsxFormula = adaptFormulaToExcel(formula);
41863
- // hack for cycles : if we don't set a value (be it 0 or #VALUE!), it will appear as invisible on excel,
41864
- // Making it very hard for the client to find where the recursion is.
41865
- if (cell.value === CellErrorType.CircularDependency) {
41866
- attrs.push(["t", "str"]);
41867
- cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41868
- }
41869
- node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41865
+ node = escapeXml /*xml*/ `
41866
+ <f>
41867
+ ${XlsxFormula}
41868
+ </f>
41869
+ ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41870
+ `;
41871
+ attrs.push(["t", type]);
41870
41872
  return { attrs, node };
41871
41873
  }
41872
41874
  else {
41873
- // Shouldn't we always output the value then ?
41874
- const value = cell.value;
41875
41875
  // If the cell contains a non-exported formula and that is evaluates to
41876
41876
  // nothing* ,we don't export it.
41877
41877
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41878
41878
  // the empty string.
41879
- if (value === "")
41879
+ if (cell.value === "")
41880
41880
  return undefined;
41881
- const type = getCellType(value);
41882
41881
  attrs.push(["t", type]);
41883
- node = escapeXml /*xml*/ `<v>${value}</v>`;
41882
+ node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41884
41883
  return { attrs, node };
41885
41884
  }
41886
41885
  }
@@ -43104,6 +43103,9 @@ class Model extends EventBus {
43104
43103
  this.selection.observe(this, {
43105
43104
  handleEvent: () => this.trigger("update"),
43106
43105
  });
43106
+ // move in "Loading" mode where we ignore redundant calls to finalize triggered by the
43107
+ // replay of stateUpdateMessages in the session
43108
+ this.isLoading = true;
43107
43109
  // This should be done after construction of LocalHistory due to order of
43108
43110
  // events
43109
43111
  this.setupSessionEvents();
@@ -43116,6 +43118,9 @@ class Model extends EventBus {
43116
43118
  // mark all models as "raw", so they will not be turned into reactive objects
43117
43119
  // by owl, since we do not rely on reactivity
43118
43120
  owl.markRaw(this);
43121
+ this.isLoading = false;
43122
+ // ensure propre recomputation of plugin states after the message replays
43123
+ this.finalize();
43119
43124
  }
43120
43125
  joinSession() {
43121
43126
  this.session.join(this.config.client);
@@ -43225,6 +43230,9 @@ class Model extends EventBus {
43225
43230
  return DispatchResult.Success;
43226
43231
  }
43227
43232
  finalize() {
43233
+ if (this.isLoading) {
43234
+ return;
43235
+ }
43228
43236
  this.status = 3 /* Status.Finalizing */;
43229
43237
  for (const h of this.handlers) {
43230
43238
  h.finalize();
@@ -43441,6 +43449,6 @@ exports.setTranslationMethod = setTranslationMethod;
43441
43449
  exports.tokenize = tokenize;
43442
43450
 
43443
43451
 
43444
- __info__.version = '16.0.51';
43445
- __info__.date = '2024-08-19T08:08:50.605Z';
43446
- __info__.hash = '2b60022';
43452
+ __info__.version = '16.0.53';
43453
+ __info__.date = '2024-10-14T07:50:02.583Z';
43454
+ __info__.hash = 'a9ad6d8';
@@ -1078,6 +1078,7 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1078
1078
  * can just iterate on it
1079
1079
  */
1080
1080
  private renderers;
1081
+ private isLoading;
1081
1082
  /**
1082
1083
  * Internal status of the model. Important for command handling coordination
1083
1084
  */
@@ -4105,6 +4106,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4105
4106
  allowDispatch(cmd: Command): CommandResult;
4106
4107
  private handleEvent;
4107
4108
  handle(cmd: Command): void;
4109
+ finalize(): void;
4108
4110
  isGridSelectionActive(): boolean;
4109
4111
  getActiveSheet(): Readonly<Sheet>;
4110
4112
  getActiveSheetId(): UID;
@@ -33950,11 +33950,7 @@ class FindAndReplacePlugin extends UIPlugin {
33950
33950
  }
33951
33951
  if (cell &&
33952
33952
  this.currentSearchRegex &&
33953
- this.currentSearchRegex.test(this.searchOptions.searchFormulas
33954
- ? cell.isFormula()
33955
- ? cell.content
33956
- : String(cell.evaluated.value)
33957
- : String(cell.evaluated.value))) {
33953
+ this.currentSearchRegex.test(this.searchOptions.searchFormulas ? cell.content : String(cell.evaluated.value))) {
33958
33954
  const position = this.getters.getCellPosition(cell.id);
33959
33955
  const match = { col: position.col, row: position.row, selected: false };
33960
33956
  matches.push(match);
@@ -35108,6 +35104,8 @@ class GridSelectionPlugin extends UIPlugin {
35108
35104
  this.selectedFigureId = null;
35109
35105
  break;
35110
35106
  }
35107
+ }
35108
+ finalize() {
35111
35109
  /** Any change to the selection has to be reflected in the selection processor. */
35112
35110
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
35113
35111
  }
@@ -36590,6 +36588,7 @@ class Session extends EventBus {
36590
36588
  case "REMOTE_REVISION":
36591
36589
  case "REVISION_REDONE":
36592
36590
  case "REVISION_UNDONE":
36591
+ case "SNAPSHOT_CREATED":
36593
36592
  return this.processedRevisions.has(message.nextRevisionId);
36594
36593
  default:
36595
36594
  return false;
@@ -37107,7 +37106,6 @@ class SheetViewPlugin extends UIPlugin {
37107
37106
  }
37108
37107
  handle(cmd) {
37109
37108
  var _a;
37110
- this.cleanViewports();
37111
37109
  switch (cmd.type) {
37112
37110
  case "START":
37113
37111
  this.selection.observe(this, {
@@ -37152,6 +37150,9 @@ class SheetViewPlugin extends UIPlugin {
37152
37150
  this.sheetsWithDirtyViewports.add(cmd.sheetId);
37153
37151
  }
37154
37152
  break;
37153
+ case "DELETE_SHEET":
37154
+ this.cleanViewports();
37155
+ break;
37155
37156
  case "ACTIVATE_SHEET":
37156
37157
  this.setViewports();
37157
37158
  this.refreshViewport(cmd.sheetIdTo);
@@ -37468,6 +37469,7 @@ class SheetViewPlugin extends UIPlugin {
37468
37469
  }
37469
37470
  }
37470
37471
  resetSheetViews() {
37472
+ this.cleanViewports();
37471
37473
  for (let sheetId of Object.keys(this.viewports)) {
37472
37474
  const position = this.getters.getSheetPosition(sheetId);
37473
37475
  this.resetViewports(sheetId);
@@ -41853,30 +41855,27 @@ function addFormula(cell) {
41853
41855
  const isExported = tokens
41854
41856
  .filter((tk) => tk.type === "FUNCTION")
41855
41857
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41858
+ const type = getCellType(cell.value);
41856
41859
  if (isExported) {
41857
- let cycle = escapeXml ``;
41858
41860
  const XlsxFormula = adaptFormulaToExcel(formula);
41859
- // hack for cycles : if we don't set a value (be it 0 or #VALUE!), it will appear as invisible on excel,
41860
- // Making it very hard for the client to find where the recursion is.
41861
- if (cell.value === CellErrorType.CircularDependency) {
41862
- attrs.push(["t", "str"]);
41863
- cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41864
- }
41865
- node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41861
+ node = escapeXml /*xml*/ `
41862
+ <f>
41863
+ ${XlsxFormula}
41864
+ </f>
41865
+ ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41866
+ `;
41867
+ attrs.push(["t", type]);
41866
41868
  return { attrs, node };
41867
41869
  }
41868
41870
  else {
41869
- // Shouldn't we always output the value then ?
41870
- const value = cell.value;
41871
41871
  // If the cell contains a non-exported formula and that is evaluates to
41872
41872
  // nothing* ,we don't export it.
41873
41873
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41874
41874
  // the empty string.
41875
- if (value === "")
41875
+ if (cell.value === "")
41876
41876
  return undefined;
41877
- const type = getCellType(value);
41878
41877
  attrs.push(["t", type]);
41879
- node = escapeXml /*xml*/ `<v>${value}</v>`;
41878
+ node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41880
41879
  return { attrs, node };
41881
41880
  }
41882
41881
  }
@@ -43100,6 +43099,9 @@ class Model extends EventBus {
43100
43099
  this.selection.observe(this, {
43101
43100
  handleEvent: () => this.trigger("update"),
43102
43101
  });
43102
+ // move in "Loading" mode where we ignore redundant calls to finalize triggered by the
43103
+ // replay of stateUpdateMessages in the session
43104
+ this.isLoading = true;
43103
43105
  // This should be done after construction of LocalHistory due to order of
43104
43106
  // events
43105
43107
  this.setupSessionEvents();
@@ -43112,6 +43114,9 @@ class Model extends EventBus {
43112
43114
  // mark all models as "raw", so they will not be turned into reactive objects
43113
43115
  // by owl, since we do not rely on reactivity
43114
43116
  markRaw(this);
43117
+ this.isLoading = false;
43118
+ // ensure propre recomputation of plugin states after the message replays
43119
+ this.finalize();
43115
43120
  }
43116
43121
  joinSession() {
43117
43122
  this.session.join(this.config.client);
@@ -43221,6 +43226,9 @@ class Model extends EventBus {
43221
43226
  return DispatchResult.Success;
43222
43227
  }
43223
43228
  finalize() {
43229
+ if (this.isLoading) {
43230
+ return;
43231
+ }
43224
43232
  this.status = 3 /* Status.Finalizing */;
43225
43233
  for (const h of this.handlers) {
43226
43234
  h.finalize();
@@ -43409,6 +43417,6 @@ function addFunction(functionName, functionDescription) {
43409
43417
  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 };
43410
43418
 
43411
43419
 
43412
- __info__.version = '16.0.51';
43413
- __info__.date = '2024-08-19T08:08:50.605Z';
43414
- __info__.hash = '2b60022';
43420
+ __info__.version = '16.0.53';
43421
+ __info__.date = '2024-10-14T07:50:02.583Z';
43422
+ __info__.hash = 'a9ad6d8';
@@ -33951,11 +33951,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
33951
33951
  }
33952
33952
  if (cell &&
33953
33953
  this.currentSearchRegex &&
33954
- this.currentSearchRegex.test(this.searchOptions.searchFormulas
33955
- ? cell.isFormula()
33956
- ? cell.content
33957
- : String(cell.evaluated.value)
33958
- : String(cell.evaluated.value))) {
33954
+ this.currentSearchRegex.test(this.searchOptions.searchFormulas ? cell.content : String(cell.evaluated.value))) {
33959
33955
  const position = this.getters.getCellPosition(cell.id);
33960
33956
  const match = { col: position.col, row: position.row, selected: false };
33961
33957
  matches.push(match);
@@ -35109,6 +35105,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35109
35105
  this.selectedFigureId = null;
35110
35106
  break;
35111
35107
  }
35108
+ }
35109
+ finalize() {
35112
35110
  /** Any change to the selection has to be reflected in the selection processor. */
35113
35111
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
35114
35112
  }
@@ -36591,6 +36589,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36591
36589
  case "REMOTE_REVISION":
36592
36590
  case "REVISION_REDONE":
36593
36591
  case "REVISION_UNDONE":
36592
+ case "SNAPSHOT_CREATED":
36594
36593
  return this.processedRevisions.has(message.nextRevisionId);
36595
36594
  default:
36596
36595
  return false;
@@ -37108,7 +37107,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37108
37107
  }
37109
37108
  handle(cmd) {
37110
37109
  var _a;
37111
- this.cleanViewports();
37112
37110
  switch (cmd.type) {
37113
37111
  case "START":
37114
37112
  this.selection.observe(this, {
@@ -37153,6 +37151,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37153
37151
  this.sheetsWithDirtyViewports.add(cmd.sheetId);
37154
37152
  }
37155
37153
  break;
37154
+ case "DELETE_SHEET":
37155
+ this.cleanViewports();
37156
+ break;
37156
37157
  case "ACTIVATE_SHEET":
37157
37158
  this.setViewports();
37158
37159
  this.refreshViewport(cmd.sheetIdTo);
@@ -37469,6 +37470,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37469
37470
  }
37470
37471
  }
37471
37472
  resetSheetViews() {
37473
+ this.cleanViewports();
37472
37474
  for (let sheetId of Object.keys(this.viewports)) {
37473
37475
  const position = this.getters.getSheetPosition(sheetId);
37474
37476
  this.resetViewports(sheetId);
@@ -41854,30 +41856,27 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41854
41856
  const isExported = tokens
41855
41857
  .filter((tk) => tk.type === "FUNCTION")
41856
41858
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41859
+ const type = getCellType(cell.value);
41857
41860
  if (isExported) {
41858
- let cycle = escapeXml ``;
41859
41861
  const XlsxFormula = adaptFormulaToExcel(formula);
41860
- // hack for cycles : if we don't set a value (be it 0 or #VALUE!), it will appear as invisible on excel,
41861
- // Making it very hard for the client to find where the recursion is.
41862
- if (cell.value === CellErrorType.CircularDependency) {
41863
- attrs.push(["t", "str"]);
41864
- cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41865
- }
41866
- node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41862
+ node = escapeXml /*xml*/ `
41863
+ <f>
41864
+ ${XlsxFormula}
41865
+ </f>
41866
+ ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41867
+ `;
41868
+ attrs.push(["t", type]);
41867
41869
  return { attrs, node };
41868
41870
  }
41869
41871
  else {
41870
- // Shouldn't we always output the value then ?
41871
- const value = cell.value;
41872
41872
  // If the cell contains a non-exported formula and that is evaluates to
41873
41873
  // nothing* ,we don't export it.
41874
41874
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41875
41875
  // the empty string.
41876
- if (value === "")
41876
+ if (cell.value === "")
41877
41877
  return undefined;
41878
- const type = getCellType(value);
41879
41878
  attrs.push(["t", type]);
41880
- node = escapeXml /*xml*/ `<v>${value}</v>`;
41879
+ node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41881
41880
  return { attrs, node };
41882
41881
  }
41883
41882
  }
@@ -43101,6 +43100,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43101
43100
  this.selection.observe(this, {
43102
43101
  handleEvent: () => this.trigger("update"),
43103
43102
  });
43103
+ // move in "Loading" mode where we ignore redundant calls to finalize triggered by the
43104
+ // replay of stateUpdateMessages in the session
43105
+ this.isLoading = true;
43104
43106
  // This should be done after construction of LocalHistory due to order of
43105
43107
  // events
43106
43108
  this.setupSessionEvents();
@@ -43113,6 +43115,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43113
43115
  // mark all models as "raw", so they will not be turned into reactive objects
43114
43116
  // by owl, since we do not rely on reactivity
43115
43117
  owl.markRaw(this);
43118
+ this.isLoading = false;
43119
+ // ensure propre recomputation of plugin states after the message replays
43120
+ this.finalize();
43116
43121
  }
43117
43122
  joinSession() {
43118
43123
  this.session.join(this.config.client);
@@ -43222,6 +43227,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43222
43227
  return DispatchResult.Success;
43223
43228
  }
43224
43229
  finalize() {
43230
+ if (this.isLoading) {
43231
+ return;
43232
+ }
43225
43233
  this.status = 3 /* Status.Finalizing */;
43226
43234
  for (const h of this.handlers) {
43227
43235
  h.finalize();
@@ -43440,9 +43448,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43440
43448
  Object.defineProperty(exports, '__esModule', { value: true });
43441
43449
 
43442
43450
 
43443
- __info__.version = '16.0.51';
43444
- __info__.date = '2024-08-19T08:08:50.605Z';
43445
- __info__.hash = '2b60022';
43451
+ __info__.version = '16.0.53';
43452
+ __info__.date = '2024-10-14T07:50:02.583Z';
43453
+ __info__.hash = 'a9ad6d8';
43446
43454
 
43447
43455
 
43448
43456
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);