@odoo/o-spreadsheet 15.0.8 → 15.0.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.
@@ -2912,7 +2912,37 @@ function parseSheetLink(sheetLink) {
2912
2912
  function isDefined(argument) {
2913
2913
  return argument !== undefined;
2914
2914
  }
2915
- const DEBUG = {};
2915
+ const DEBUG = {};
2916
+ /**
2917
+ * Compares two objects.
2918
+ */
2919
+ function deepEquals(o1, o2) {
2920
+ if (o1 === o2)
2921
+ return true;
2922
+ if ((o1 && !o2) || (o2 && !o1))
2923
+ return false;
2924
+ if (typeof o1 !== typeof o2)
2925
+ return false;
2926
+ if (typeof o1 !== "object")
2927
+ return o1 === o2;
2928
+ // Objects can have different keys if the values are undefined
2929
+ const keys = new Set();
2930
+ Object.keys(o1).forEach((key) => keys.add(key));
2931
+ Object.keys(o2).forEach((key) => keys.add(key));
2932
+ for (let key of keys) {
2933
+ if (typeof o1[key] !== typeof o1[key])
2934
+ return false;
2935
+ if (typeof o1[key] === "object") {
2936
+ if (!deepEquals(o1[key], o2[key]))
2937
+ return false;
2938
+ }
2939
+ else {
2940
+ if (o1[key] !== o2[key])
2941
+ return false;
2942
+ }
2943
+ }
2944
+ return true;
2945
+ }
2916
2946
 
2917
2947
  /**
2918
2948
  * Convert from a cartesian reference to a Zone
@@ -19149,6 +19179,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19149
19179
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19150
19180
  this.computedStyles = {};
19151
19181
  this.computedIcons = {};
19182
+ this.uuidGenerator = new UuidGenerator();
19152
19183
  /**
19153
19184
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19154
19185
  */
@@ -19502,13 +19533,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19502
19533
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19503
19534
  }
19504
19535
  else {
19505
- this.adaptRules(target.sheetId, cf, [xc], []);
19506
19536
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19537
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19538
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19507
19539
  }
19508
19540
  }
19509
19541
  }
19510
19542
  }
19511
19543
  }
19544
+ getCFToCopyTo(targetSheetId, originCF) {
19545
+ const cfInTarget = this.getters
19546
+ .getConditionalFormats(targetSheetId)
19547
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19548
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19549
+ }
19512
19550
  }
19513
19551
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19514
19552
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27490,6 +27528,7 @@ class Composer extends owl.Component {
27490
27528
  autoCompleteComp.moveDown();
27491
27529
  }
27492
27530
  }
27531
+ this.updateCursorIfNeeded();
27493
27532
  }
27494
27533
  processTabKey(ev) {
27495
27534
  ev.preventDefault();
@@ -27545,9 +27584,12 @@ class Composer extends owl.Component {
27545
27584
  }
27546
27585
  else {
27547
27586
  ev.stopPropagation();
27587
+ this.updateCursorIfNeeded();
27548
27588
  }
27549
- const { start, end } = this.contentHelper.getCurrentSelection();
27589
+ }
27590
+ updateCursorIfNeeded() {
27550
27591
  if (!this.getters.isSelectingForComposer()) {
27592
+ const { start, end } = this.contentHelper.getCurrentSelection();
27551
27593
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27552
27594
  this.isKeyStillDown = true;
27553
27595
  }
@@ -31403,6 +31445,6 @@ exports.registries = registries;
31403
31445
  exports.setTranslationMethod = setTranslationMethod;
31404
31446
 
31405
31447
 
31406
- __info__.version = '15.0.8';
31407
- __info__.date = '2023-06-02T10:10:54.035Z';
31408
- __info__.hash = 'c3c5470';
31448
+ __info__.version = '15.0.10';
31449
+ __info__.date = '2023-09-21T15:55:03.676Z';
31450
+ __info__.hash = '23bff2d';
@@ -3052,6 +3052,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3052
3052
  private isStale;
3053
3053
  private computedStyles;
3054
3054
  private computedIcons;
3055
+ private uuidGenerator;
3055
3056
  handle(cmd: Command): void;
3056
3057
  finalize(): void;
3057
3058
  /**
@@ -3086,6 +3087,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3086
3087
  */
3087
3088
  private adaptRules;
3088
3089
  private pasteCf;
3090
+ private getCFToCopyTo;
3089
3091
  }
3090
3092
 
3091
3093
  /**
@@ -4805,6 +4807,7 @@ declare class Composer extends Component<Props$8, SpreadsheetEnv> {
4805
4807
  onCompositionStart(): void;
4806
4808
  onCompositionEnd(): void;
4807
4809
  onKeydown(ev: KeyboardEvent): void;
4810
+ private updateCursorIfNeeded;
4808
4811
  onInput(): void;
4809
4812
  onKeyup(ev: KeyboardEvent): void;
4810
4813
  onMousedown(ev: MouseEvent): void;
@@ -2889,7 +2889,37 @@ function parseSheetLink(sheetLink) {
2889
2889
  function isDefined(argument) {
2890
2890
  return argument !== undefined;
2891
2891
  }
2892
- const DEBUG = {};
2892
+ const DEBUG = {};
2893
+ /**
2894
+ * Compares two objects.
2895
+ */
2896
+ function deepEquals(o1, o2) {
2897
+ if (o1 === o2)
2898
+ return true;
2899
+ if ((o1 && !o2) || (o2 && !o1))
2900
+ return false;
2901
+ if (typeof o1 !== typeof o2)
2902
+ return false;
2903
+ if (typeof o1 !== "object")
2904
+ return o1 === o2;
2905
+ // Objects can have different keys if the values are undefined
2906
+ const keys = new Set();
2907
+ Object.keys(o1).forEach((key) => keys.add(key));
2908
+ Object.keys(o2).forEach((key) => keys.add(key));
2909
+ for (let key of keys) {
2910
+ if (typeof o1[key] !== typeof o1[key])
2911
+ return false;
2912
+ if (typeof o1[key] === "object") {
2913
+ if (!deepEquals(o1[key], o2[key]))
2914
+ return false;
2915
+ }
2916
+ else {
2917
+ if (o1[key] !== o2[key])
2918
+ return false;
2919
+ }
2920
+ }
2921
+ return true;
2922
+ }
2893
2923
 
2894
2924
  /**
2895
2925
  * Convert from a cartesian reference to a Zone
@@ -19126,6 +19156,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19126
19156
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19127
19157
  this.computedStyles = {};
19128
19158
  this.computedIcons = {};
19159
+ this.uuidGenerator = new UuidGenerator();
19129
19160
  /**
19130
19161
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19131
19162
  */
@@ -19479,13 +19510,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
19479
19510
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19480
19511
  }
19481
19512
  else {
19482
- this.adaptRules(target.sheetId, cf, [xc], []);
19483
19513
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19514
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19515
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19484
19516
  }
19485
19517
  }
19486
19518
  }
19487
19519
  }
19488
19520
  }
19521
+ getCFToCopyTo(targetSheetId, originCF) {
19522
+ const cfInTarget = this.getters
19523
+ .getConditionalFormats(targetSheetId)
19524
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19525
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19526
+ }
19489
19527
  }
19490
19528
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19491
19529
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27467,6 +27505,7 @@ class Composer extends Component {
27467
27505
  autoCompleteComp.moveDown();
27468
27506
  }
27469
27507
  }
27508
+ this.updateCursorIfNeeded();
27470
27509
  }
27471
27510
  processTabKey(ev) {
27472
27511
  ev.preventDefault();
@@ -27522,9 +27561,12 @@ class Composer extends Component {
27522
27561
  }
27523
27562
  else {
27524
27563
  ev.stopPropagation();
27564
+ this.updateCursorIfNeeded();
27525
27565
  }
27526
- const { start, end } = this.contentHelper.getCurrentSelection();
27566
+ }
27567
+ updateCursorIfNeeded() {
27527
27568
  if (!this.getters.isSelectingForComposer()) {
27569
+ const { start, end } = this.contentHelper.getCurrentSelection();
27528
27570
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27529
27571
  this.isKeyStillDown = true;
27530
27572
  }
@@ -31358,6 +31400,6 @@ const helpers = {
31358
31400
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31359
31401
 
31360
31402
 
31361
- __info__.version = '15.0.8';
31362
- __info__.date = '2023-06-02T10:10:54.035Z';
31363
- __info__.hash = 'c3c5470';
31403
+ __info__.version = '15.0.10';
31404
+ __info__.date = '2023-09-21T15:55:03.676Z';
31405
+ __info__.hash = '23bff2d';
@@ -2909,7 +2909,37 @@
2909
2909
  function isDefined(argument) {
2910
2910
  return argument !== undefined;
2911
2911
  }
2912
- const DEBUG = {};
2912
+ const DEBUG = {};
2913
+ /**
2914
+ * Compares two objects.
2915
+ */
2916
+ function deepEquals(o1, o2) {
2917
+ if (o1 === o2)
2918
+ return true;
2919
+ if ((o1 && !o2) || (o2 && !o1))
2920
+ return false;
2921
+ if (typeof o1 !== typeof o2)
2922
+ return false;
2923
+ if (typeof o1 !== "object")
2924
+ return o1 === o2;
2925
+ // Objects can have different keys if the values are undefined
2926
+ const keys = new Set();
2927
+ Object.keys(o1).forEach((key) => keys.add(key));
2928
+ Object.keys(o2).forEach((key) => keys.add(key));
2929
+ for (let key of keys) {
2930
+ if (typeof o1[key] !== typeof o1[key])
2931
+ return false;
2932
+ if (typeof o1[key] === "object") {
2933
+ if (!deepEquals(o1[key], o2[key]))
2934
+ return false;
2935
+ }
2936
+ else {
2937
+ if (o1[key] !== o2[key])
2938
+ return false;
2939
+ }
2940
+ }
2941
+ return true;
2942
+ }
2913
2943
 
2914
2944
  /**
2915
2945
  * Convert from a cartesian reference to a Zone
@@ -19146,6 +19176,7 @@
19146
19176
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
19147
19177
  this.computedStyles = {};
19148
19178
  this.computedIcons = {};
19179
+ this.uuidGenerator = new UuidGenerator();
19149
19180
  /**
19150
19181
  * Execute the predicate to know if a conditional formatting rule should be applied to a cell
19151
19182
  */
@@ -19499,13 +19530,20 @@
19499
19530
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
19500
19531
  }
19501
19532
  else {
19502
- this.adaptRules(target.sheetId, cf, [xc], []);
19503
19533
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
19534
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
19535
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
19504
19536
  }
19505
19537
  }
19506
19538
  }
19507
19539
  }
19508
19540
  }
19541
+ getCFToCopyTo(targetSheetId, originCF) {
19542
+ const cfInTarget = this.getters
19543
+ .getConditionalFormats(targetSheetId)
19544
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
19545
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
19546
+ }
19509
19547
  }
19510
19548
  EvaluationConditionalFormatPlugin.getters = ["getConditionalStyle", "getConditionalIcon"];
19511
19549
  EvaluationConditionalFormatPlugin.modes = ["normal"];
@@ -27487,6 +27525,7 @@
27487
27525
  autoCompleteComp.moveDown();
27488
27526
  }
27489
27527
  }
27528
+ this.updateCursorIfNeeded();
27490
27529
  }
27491
27530
  processTabKey(ev) {
27492
27531
  ev.preventDefault();
@@ -27542,9 +27581,12 @@
27542
27581
  }
27543
27582
  else {
27544
27583
  ev.stopPropagation();
27584
+ this.updateCursorIfNeeded();
27545
27585
  }
27546
- const { start, end } = this.contentHelper.getCurrentSelection();
27586
+ }
27587
+ updateCursorIfNeeded() {
27547
27588
  if (!this.getters.isSelectingForComposer()) {
27589
+ const { start, end } = this.contentHelper.getCurrentSelection();
27548
27590
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27549
27591
  this.isKeyStillDown = true;
27550
27592
  }
@@ -31402,9 +31444,9 @@
31402
31444
  Object.defineProperty(exports, '__esModule', { value: true });
31403
31445
 
31404
31446
 
31405
- __info__.version = '15.0.8';
31406
- __info__.date = '2023-06-02T10:10:54.035Z';
31407
- __info__.hash = 'c3c5470';
31447
+ __info__.version = '15.0.10';
31448
+ __info__.date = '2023-09-21T15:55:03.676Z';
31449
+ __info__.hash = '23bff2d';
31408
31450
 
31409
31451
 
31410
31452
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);