@odoo/o-spreadsheet 15.2.8 → 15.2.10

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.
@@ -2965,6 +2965,36 @@ function lazy(fn) {
2965
2965
  };
2966
2966
  lazyValue.map = (callback) => lazy(() => callback(lazyValue()));
2967
2967
  return lazyValue;
2968
+ }
2969
+ /**
2970
+ * Compares two objects.
2971
+ */
2972
+ function deepEquals(o1, o2) {
2973
+ if (o1 === o2)
2974
+ return true;
2975
+ if ((o1 && !o2) || (o2 && !o1))
2976
+ return false;
2977
+ if (typeof o1 !== typeof o2)
2978
+ return false;
2979
+ if (typeof o1 !== "object")
2980
+ return o1 === o2;
2981
+ // Objects can have different keys if the values are undefined
2982
+ const keys = new Set();
2983
+ Object.keys(o1).forEach((key) => keys.add(key));
2984
+ Object.keys(o2).forEach((key) => keys.add(key));
2985
+ for (let key of keys) {
2986
+ if (typeof o1[key] !== typeof o1[key])
2987
+ return false;
2988
+ if (typeof o1[key] === "object") {
2989
+ if (!deepEquals(o1[key], o2[key]))
2990
+ return false;
2991
+ }
2992
+ else {
2993
+ if (o1[key] !== o2[key])
2994
+ return false;
2995
+ }
2996
+ }
2997
+ return true;
2968
2998
  }
2969
2999
 
2970
3000
  function createDefaultCols(colNumber) {
@@ -19201,6 +19231,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19201
19231
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19202
19232
  this.computedStyles = {};
19203
19233
  this.computedIcons = {};
19234
+ this.uuidGenerator = new UuidGenerator();
19204
19235
  /**
19205
19236
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19206
19237
  */
@@ -19554,13 +19585,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19554
19585
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19555
19586
  }
19556
19587
  else {
19557
- this.adaptRules(target.sheetId, cf, [xc], []);
19558
19588
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19589
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19590
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19559
19591
  }
19560
19592
  }
19561
19593
  }
19562
19594
  }
19563
19595
  }
19596
+ getCFToCopyTo(targetSheetId, originCF) {
19597
+ const cfInTarget = this.getters
19598
+ .getConditionalFormats(targetSheetId)
19599
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19600
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19601
+ }
19564
19602
  }
19565
19603
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19566
19604
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27438,6 +27476,7 @@ class Composer extends owl.Component {
27438
27476
  this.autocompleteAPI.moveDown();
27439
27477
  }
27440
27478
  }
27479
+ this.updateCursorIfNeeded();
27441
27480
  }
27442
27481
  processTabKey(ev) {
27443
27482
  ev.preventDefault();
@@ -27491,9 +27530,12 @@ class Composer extends owl.Component {
27491
27530
  }
27492
27531
  else {
27493
27532
  ev.stopPropagation();
27533
+ this.updateCursorIfNeeded();
27494
27534
  }
27495
- const { start, end } = this.contentHelper.getCurrentSelection();
27535
+ }
27536
+ updateCursorIfNeeded() {
27496
27537
  if (!this.getters.isSelectingForComposer()) {
27538
+ const { start, end } = this.contentHelper.getCurrentSelection();
27497
27539
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27498
27540
  this.isKeyStillDown = true;
27499
27541
  }
@@ -31336,6 +31378,6 @@ exports.registries = registries;
31336
31378
  exports.setTranslationMethod = setTranslationMethod;
31337
31379
 
31338
31380
 
31339
- __info__.version = '15.2.8';
31340
- __info__.date = '2023-06-02T10:11:55.097Z';
31341
- __info__.hash = '3e00f8b';
31381
+ __info__.version = '15.2.10';
31382
+ __info__.date = '2023-09-21T15:55:12.568Z';
31383
+ __info__.hash = '85387c4';
@@ -2988,6 +2988,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
2988
2988
  private isStale;
2989
2989
  private computedStyles;
2990
2990
  private computedIcons;
2991
+ private uuidGenerator;
2991
2992
  handle(cmd: Command): void;
2992
2993
  finalize(): void;
2993
2994
  /**
@@ -3022,6 +3023,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3022
3023
  */
3023
3024
  private adaptRules;
3024
3025
  private pasteCf;
3026
+ private getCFToCopyTo;
3025
3027
  }
3026
3028
 
3027
3029
  /**
@@ -4787,6 +4789,7 @@ declare class Composer extends Component<Props$a, SpreadsheetEnv> {
4787
4789
  onCompositionStart(): void;
4788
4790
  onCompositionEnd(): void;
4789
4791
  onKeydown(ev: KeyboardEvent): void;
4792
+ private updateCursorIfNeeded;
4790
4793
  onInput(): void;
4791
4794
  onKeyup(ev: KeyboardEvent): void;
4792
4795
  onMousedown(ev: MouseEvent): void;
@@ -2942,6 +2942,36 @@ function lazy(fn) {
2942
2942
  };
2943
2943
  lazyValue.map = (callback) => lazy(() => callback(lazyValue()));
2944
2944
  return lazyValue;
2945
+ }
2946
+ /**
2947
+ * Compares two objects.
2948
+ */
2949
+ function deepEquals(o1, o2) {
2950
+ if (o1 === o2)
2951
+ return true;
2952
+ if ((o1 && !o2) || (o2 && !o1))
2953
+ return false;
2954
+ if (typeof o1 !== typeof o2)
2955
+ return false;
2956
+ if (typeof o1 !== "object")
2957
+ return o1 === o2;
2958
+ // Objects can have different keys if the values are undefined
2959
+ const keys = new Set();
2960
+ Object.keys(o1).forEach((key) => keys.add(key));
2961
+ Object.keys(o2).forEach((key) => keys.add(key));
2962
+ for (let key of keys) {
2963
+ if (typeof o1[key] !== typeof o1[key])
2964
+ return false;
2965
+ if (typeof o1[key] === "object") {
2966
+ if (!deepEquals(o1[key], o2[key]))
2967
+ return false;
2968
+ }
2969
+ else {
2970
+ if (o1[key] !== o2[key])
2971
+ return false;
2972
+ }
2973
+ }
2974
+ return true;
2945
2975
  }
2946
2976
 
2947
2977
  function createDefaultCols(colNumber) {
@@ -19178,6 +19208,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19178
19208
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19179
19209
  this.computedStyles = {};
19180
19210
  this.computedIcons = {};
19211
+ this.uuidGenerator = new UuidGenerator();
19181
19212
  /**
19182
19213
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19183
19214
  */
@@ -19531,13 +19562,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19531
19562
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19532
19563
  }
19533
19564
  else {
19534
- this.adaptRules(target.sheetId, cf, [xc], []);
19535
19565
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19566
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19567
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19536
19568
  }
19537
19569
  }
19538
19570
  }
19539
19571
  }
19540
19572
  }
19573
+ getCFToCopyTo(targetSheetId, originCF) {
19574
+ const cfInTarget = this.getters
19575
+ .getConditionalFormats(targetSheetId)
19576
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19577
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19578
+ }
19541
19579
  }
19542
19580
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19543
19581
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27415,6 +27453,7 @@ class Composer extends Component {
27415
27453
  this.autocompleteAPI.moveDown();
27416
27454
  }
27417
27455
  }
27456
+ this.updateCursorIfNeeded();
27418
27457
  }
27419
27458
  processTabKey(ev) {
27420
27459
  ev.preventDefault();
@@ -27468,9 +27507,12 @@ class Composer extends Component {
27468
27507
  }
27469
27508
  else {
27470
27509
  ev.stopPropagation();
27510
+ this.updateCursorIfNeeded();
27471
27511
  }
27472
- const { start, end } = this.contentHelper.getCurrentSelection();
27512
+ }
27513
+ updateCursorIfNeeded() {
27473
27514
  if (!this.getters.isSelectingForComposer()) {
27515
+ const { start, end } = this.contentHelper.getCurrentSelection();
27474
27516
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27475
27517
  this.isKeyStillDown = true;
27476
27518
  }
@@ -31290,6 +31332,6 @@ const helpers = {
31290
31332
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31291
31333
 
31292
31334
 
31293
- __info__.version = '15.2.8';
31294
- __info__.date = '2023-06-02T10:11:55.097Z';
31295
- __info__.hash = '3e00f8b';
31335
+ __info__.version = '15.2.10';
31336
+ __info__.date = '2023-09-21T15:55:12.568Z';
31337
+ __info__.hash = '85387c4';
@@ -2962,6 +2962,36 @@
2962
2962
  };
2963
2963
  lazyValue.map = (callback) => lazy(() => callback(lazyValue()));
2964
2964
  return lazyValue;
2965
+ }
2966
+ /**
2967
+ * Compares two objects.
2968
+ */
2969
+ function deepEquals(o1, o2) {
2970
+ if (o1 === o2)
2971
+ return true;
2972
+ if ((o1 && !o2) || (o2 && !o1))
2973
+ return false;
2974
+ if (typeof o1 !== typeof o2)
2975
+ return false;
2976
+ if (typeof o1 !== "object")
2977
+ return o1 === o2;
2978
+ // Objects can have different keys if the values are undefined
2979
+ const keys = new Set();
2980
+ Object.keys(o1).forEach((key) => keys.add(key));
2981
+ Object.keys(o2).forEach((key) => keys.add(key));
2982
+ for (let key of keys) {
2983
+ if (typeof o1[key] !== typeof o1[key])
2984
+ return false;
2985
+ if (typeof o1[key] === "object") {
2986
+ if (!deepEquals(o1[key], o2[key]))
2987
+ return false;
2988
+ }
2989
+ else {
2990
+ if (o1[key] !== o2[key])
2991
+ return false;
2992
+ }
2993
+ }
2994
+ return true;
2965
2995
  }
2966
2996
 
2967
2997
  function createDefaultCols(colNumber) {
@@ -19198,6 +19228,7 @@
19198
19228
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19199
19229
  this.computedStyles = {};
19200
19230
  this.computedIcons = {};
19231
+ this.uuidGenerator = new UuidGenerator();
19201
19232
  /**
19202
19233
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19203
19234
  */
@@ -19551,13 +19582,20 @@
19551
19582
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19552
19583
  }
19553
19584
  else {
19554
- this.adaptRules(target.sheetId, cf, [xc], []);
19555
19585
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19586
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19587
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19556
19588
  }
19557
19589
  }
19558
19590
  }
19559
19591
  }
19560
19592
  }
19593
+ getCFToCopyTo(targetSheetId, originCF) {
19594
+ const cfInTarget = this.getters
19595
+ .getConditionalFormats(targetSheetId)
19596
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19597
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19598
+ }
19561
19599
  }
19562
19600
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19563
19601
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27435,6 +27473,7 @@
27435
27473
  this.autocompleteAPI.moveDown();
27436
27474
  }
27437
27475
  }
27476
+ this.updateCursorIfNeeded();
27438
27477
  }
27439
27478
  processTabKey(ev) {
27440
27479
  ev.preventDefault();
@@ -27488,9 +27527,12 @@
27488
27527
  }
27489
27528
  else {
27490
27529
  ev.stopPropagation();
27530
+ this.updateCursorIfNeeded();
27491
27531
  }
27492
- const { start, end } = this.contentHelper.getCurrentSelection();
27532
+ }
27533
+ updateCursorIfNeeded() {
27493
27534
  if (!this.getters.isSelectingForComposer()) {
27535
+ const { start, end } = this.contentHelper.getCurrentSelection();
27494
27536
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27495
27537
  this.isKeyStillDown = true;
27496
27538
  }
@@ -31335,9 +31377,9 @@
31335
31377
  Object.defineProperty(exports, '__esModule', { value: true });
31336
31378
 
31337
31379
 
31338
- __info__.version = '15.2.8';
31339
- __info__.date = '2023-06-02T10:11:55.097Z';
31340
- __info__.hash = '3e00f8b';
31380
+ __info__.version = '15.2.10';
31381
+ __info__.date = '2023-09-21T15:55:12.568Z';
31382
+ __info__.hash = '85387c4';
31341
31383
 
31342
31384
 
31343
31385
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);