@odoo/o-spreadsheet 17.4.28 → 17.4.30

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.4.28
6
- * @date 2025-03-26T12:48:33.387Z
7
- * @hash a81a8f4
5
+ * @version 17.4.30
6
+ * @date 2025-04-14T17:17:01.767Z
7
+ * @hash e4cf37d
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -773,8 +773,7 @@
773
773
  *
774
774
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
775
775
  */
776
- const whiteSpaceSpecialCharacters = [
777
- " ",
776
+ const specialWhiteSpaceSpecialCharacters = [
778
777
  "\t",
779
778
  "\f",
780
779
  "\v",
@@ -789,7 +788,7 @@
789
788
  String.fromCharCode(parseInt("3000", 16)),
790
789
  String.fromCharCode(parseInt("feff", 16)),
791
790
  ];
792
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
791
+ const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
793
792
  const newLineRegexp = /(\r\n|\r)/g;
794
793
  /**
795
794
  * Replace all different newlines characters by \n
@@ -2169,6 +2168,7 @@
2169
2168
  "CLEAR_FORMATTING",
2170
2169
  "SET_BORDER",
2171
2170
  "SET_ZONE_BORDERS",
2171
+ "SET_BORDERS_ON_TARGET",
2172
2172
  /** CHART */
2173
2173
  "CREATE_CHART",
2174
2174
  "UPDATE_CHART",
@@ -5652,6 +5652,7 @@
5652
5652
  }
5653
5653
 
5654
5654
  class BorderClipboardHandler extends AbstractCellClipboardHandler {
5655
+ queuedBordersToAdd = {};
5655
5656
  copy(data) {
5656
5657
  const sheetId = data.sheetId;
5657
5658
  if (data.zones.length === 0) {
@@ -5682,6 +5683,7 @@
5682
5683
  const { left, top } = zones[0];
5683
5684
  this.pasteZone(sheetId, left, top, content.borders);
5684
5685
  }
5686
+ this.executeQueuedChanges(sheetId);
5685
5687
  }
5686
5688
  pasteZone(sheetId, col, row, borders) {
5687
5689
  for (const [r, rowBorders] of borders.entries()) {
@@ -5700,7 +5702,20 @@
5700
5702
  ...targetBorders,
5701
5703
  ...originBorders,
5702
5704
  };
5703
- this.dispatch("SET_BORDER", { ...target, border });
5705
+ const borderKey = JSON.stringify(border);
5706
+ if (!this.queuedBordersToAdd[borderKey]) {
5707
+ this.queuedBordersToAdd[borderKey] = [];
5708
+ }
5709
+ this.queuedBordersToAdd[borderKey].push(positionToZone(target));
5710
+ }
5711
+ executeQueuedChanges(pasteSheetTarget) {
5712
+ for (const borderKey in this.queuedBordersToAdd) {
5713
+ const zones = this.queuedBordersToAdd[borderKey];
5714
+ const border = JSON.parse(borderKey);
5715
+ const target = recomputeZones(zones, []);
5716
+ this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
5717
+ }
5718
+ this.queuedBordersToAdd = {};
5704
5719
  }
5705
5720
  }
5706
5721
 
@@ -5726,8 +5741,12 @@
5726
5741
  str = replaceNewLines(str);
5727
5742
  const chars = new TokenizingChars(str);
5728
5743
  const result = [];
5744
+ const tokenizeSpace = specialWhiteSpaceRegexp.test(str)
5745
+ ? tokenizeSpecialCharacterSpace
5746
+ : tokenizeSimpleSpace;
5729
5747
  while (!chars.isOver()) {
5730
- let token = tokenizeSpace(chars) ||
5748
+ let token = tokenizeNewLine(chars) ||
5749
+ tokenizeSpace(chars) ||
5731
5750
  tokenizeArgsSeparator(chars, locale) ||
5732
5751
  tokenizeParenthesis(chars) ||
5733
5752
  tokenizeOperator(chars) ||
@@ -5861,17 +5880,19 @@
5861
5880
  }
5862
5881
  return null;
5863
5882
  }
5864
- function tokenizeSpace(chars) {
5865
- let length = 0;
5866
- while (chars.current === NEWLINE) {
5867
- length++;
5868
- chars.shift();
5883
+ function tokenizeSpecialCharacterSpace(chars) {
5884
+ let spaces = "";
5885
+ while (chars.current === " " || (chars.current && chars.current.match(specialWhiteSpaceRegexp))) {
5886
+ spaces += chars.shift();
5869
5887
  }
5870
- if (length) {
5871
- return { type: "SPACE", value: NEWLINE.repeat(length) };
5888
+ if (spaces) {
5889
+ return { type: "SPACE", value: spaces };
5872
5890
  }
5891
+ return null;
5892
+ }
5893
+ function tokenizeSimpleSpace(chars) {
5873
5894
  let spaces = "";
5874
- while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5895
+ while (chars.current === " ") {
5875
5896
  spaces += chars.shift();
5876
5897
  }
5877
5898
  if (spaces) {
@@ -5879,6 +5900,17 @@
5879
5900
  }
5880
5901
  return null;
5881
5902
  }
5903
+ function tokenizeNewLine(chars) {
5904
+ let length = 0;
5905
+ while (chars.current === NEWLINE) {
5906
+ length++;
5907
+ chars.shift();
5908
+ }
5909
+ if (length) {
5910
+ return { type: "SPACE", value: NEWLINE.repeat(length) };
5911
+ }
5912
+ return null;
5913
+ }
5882
5914
  function tokenizeInvalidRange(chars) {
5883
5915
  if (chars.currentStartsWith(CellErrorType.InvalidReference)) {
5884
5916
  chars.advanceBy(CellErrorType.InvalidReference.length);
@@ -6947,6 +6979,7 @@
6947
6979
 
6948
6980
  class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
6949
6981
  uuidGenerator = new UuidGenerator();
6982
+ queuedChanges = {};
6950
6983
  copy(data) {
6951
6984
  if (!data.zones.length) {
6952
6985
  return;
@@ -6968,6 +7001,7 @@
6968
7001
  return { cfRules };
6969
7002
  }
6970
7003
  paste(target, clippedContent, options) {
7004
+ this.queuedChanges = {};
6971
7005
  if (options.pasteOption === "asValue") {
6972
7006
  return;
6973
7007
  }
@@ -6979,6 +7013,7 @@
6979
7013
  else {
6980
7014
  this.pasteFromCut(sheetId, zones, clippedContent);
6981
7015
  }
7016
+ this.executeQueuedChanges();
6982
7017
  }
6983
7018
  pasteFromCut(sheetId, target, content) {
6984
7019
  const selection = target[0];
@@ -6996,12 +7031,13 @@
6996
7031
  }
6997
7032
  pasteCf(origin, target, isCutOperation) {
6998
7033
  if (origin?.rules && origin.rules.length > 0) {
7034
+ const originZone = positionToZone(origin.position);
6999
7035
  const zone = positionToZone(target);
7000
7036
  for (const rule of origin.rules) {
7001
7037
  const toRemoveZones = [];
7002
7038
  if (isCutOperation) {
7003
7039
  //remove from current rule
7004
- toRemoveZones.push(positionToZone(origin.position));
7040
+ toRemoveZones.push(originZone);
7005
7041
  }
7006
7042
  if (origin.position.sheetId === target.sheetId) {
7007
7043
  this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
@@ -7018,36 +7054,56 @@
7018
7054
  * Add or remove cells to a given conditional formatting rule.
7019
7055
  */
7020
7056
  adaptCFRules(sheetId, cf, toAdd, toRemove) {
7021
- const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
7022
- if (!newRangesXc) {
7023
- return;
7057
+ if (!this.queuedChanges[sheetId]) {
7058
+ this.queuedChanges[sheetId] = [];
7024
7059
  }
7025
- if (newRangesXc.length === 0) {
7026
- this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
7027
- return;
7060
+ const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.cf.id === cf.id);
7061
+ if (!queuedChange) {
7062
+ this.queuedChanges[sheetId].push({ toAdd, toRemove, cf });
7063
+ }
7064
+ else {
7065
+ queuedChange.toAdd.push(...toAdd);
7066
+ queuedChange.toRemove.push(...toRemove);
7067
+ }
7068
+ }
7069
+ executeQueuedChanges() {
7070
+ for (const sheetId in this.queuedChanges) {
7071
+ for (const { toAdd, toRemove, cf } of this.queuedChanges[sheetId]) {
7072
+ const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
7073
+ if (!newRangesXc) {
7074
+ continue;
7075
+ }
7076
+ if (newRangesXc.length === 0) {
7077
+ this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
7078
+ continue;
7079
+ }
7080
+ this.dispatch("ADD_CONDITIONAL_FORMAT", {
7081
+ cf: {
7082
+ id: cf.id,
7083
+ rule: cf.rule,
7084
+ stopIfTrue: cf.stopIfTrue,
7085
+ },
7086
+ ranges: newRangesXc,
7087
+ sheetId,
7088
+ });
7089
+ }
7028
7090
  }
7029
- this.dispatch("ADD_CONDITIONAL_FORMAT", {
7030
- cf: {
7031
- id: cf.id,
7032
- rule: cf.rule,
7033
- stopIfTrue: cf.stopIfTrue,
7034
- },
7035
- ranges: newRangesXc,
7036
- sheetId,
7037
- });
7038
7091
  }
7039
7092
  getCFToCopyTo(targetSheetId, originCF) {
7040
- const cfInTarget = this.getters
7093
+ let targetCF = this.getters
7041
7094
  .getConditionalFormats(targetSheetId)
7042
7095
  .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
7043
- return cfInTarget
7044
- ? cfInTarget
7045
- : { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
7096
+ const queuedCfs = this.queuedChanges[targetSheetId];
7097
+ if (!targetCF && queuedCfs) {
7098
+ targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
7099
+ }
7100
+ return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
7046
7101
  }
7047
7102
  }
7048
7103
 
7049
7104
  class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7050
7105
  uuidGenerator = new UuidGenerator();
7106
+ queuedChanges = {};
7051
7107
  copy(data) {
7052
7108
  const { rowsIndexes, columnsIndexes } = data;
7053
7109
  const sheetId = data.sheetId;
@@ -7064,6 +7120,7 @@
7064
7120
  return { dvRules };
7065
7121
  }
7066
7122
  paste(target, clippedContent, options) {
7123
+ this.queuedChanges = {};
7067
7124
  if (options.pasteOption) {
7068
7125
  return;
7069
7126
  }
@@ -7075,6 +7132,7 @@
7075
7132
  else {
7076
7133
  this.pasteFromCut(sheetId, zones, clippedContent);
7077
7134
  }
7135
+ this.executeQueuedChanges();
7078
7136
  }
7079
7137
  pasteFromCut(sheetId, target, content) {
7080
7138
  const selection = target[0];
@@ -7093,6 +7151,7 @@
7093
7151
  pasteDataValidation(origin, target, isCutOperation) {
7094
7152
  if (origin) {
7095
7153
  const zone = positionToZone(target);
7154
+ const originZone = positionToZone(origin.position);
7096
7155
  const rule = origin.rule;
7097
7156
  if (!rule) {
7098
7157
  const targetRule = this.getters.getValidationRuleForCell(target);
@@ -7104,7 +7163,7 @@
7104
7163
  }
7105
7164
  const toRemoveZone = [];
7106
7165
  if (isCutOperation) {
7107
- toRemoveZone.push(positionToZone(origin.position));
7166
+ toRemoveZone.push(originZone);
7108
7167
  }
7109
7168
  if (origin.position.sheetId === target.sheetId) {
7110
7169
  const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
@@ -7121,29 +7180,55 @@
7121
7180
  }
7122
7181
  }
7123
7182
  getDataValidationRuleToCopyTo(targetSheetId, originRule, newId = true) {
7124
- const ruleInTargetSheet = this.getters
7183
+ let targetRule = this.getters
7125
7184
  .getDataValidationRules(targetSheetId)
7126
7185
  .find((rule) => deepEquals(originRule.criterion, rule.criterion) &&
7127
7186
  originRule.isBlocking === rule.isBlocking);
7128
- return ruleInTargetSheet
7129
- ? ruleInTargetSheet
7130
- : { ...originRule, id: newId ? this.uuidGenerator.smallUuid() : originRule.id, ranges: [] };
7187
+ const queuedRules = this.queuedChanges[targetSheetId];
7188
+ if (!targetRule && queuedRules) {
7189
+ targetRule = queuedRules.find((queued) => deepEquals(originRule.criterion, queued.rule.criterion) &&
7190
+ originRule.isBlocking === queued.rule.isBlocking)?.rule;
7191
+ }
7192
+ return (targetRule || {
7193
+ ...originRule,
7194
+ id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
7195
+ ranges: [],
7196
+ });
7131
7197
  }
7132
7198
  /**
7133
7199
  * Add or remove XCs to a given data validation rule.
7134
7200
  */
7135
7201
  adaptDataValidationRule(sheetId, rule, toAdd, toRemove) {
7136
- const dvZones = rule.ranges.map((range) => range.zone);
7137
- const newDvZones = recomputeZones([...dvZones, ...toAdd], toRemove);
7138
- if (newDvZones.length === 0) {
7139
- this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: rule.id });
7140
- return;
7202
+ if (!this.queuedChanges[sheetId]) {
7203
+ this.queuedChanges[sheetId] = [];
7204
+ }
7205
+ const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.rule.id === rule.id);
7206
+ if (!queuedChange) {
7207
+ this.queuedChanges[sheetId].push({ toAdd, toRemove, rule });
7208
+ }
7209
+ else {
7210
+ queuedChange.toAdd.push(...toAdd);
7211
+ queuedChange.toRemove.push(...toRemove);
7212
+ }
7213
+ }
7214
+ executeQueuedChanges() {
7215
+ for (const sheetId in this.queuedChanges) {
7216
+ for (const { toAdd, toRemove, rule: dv } of this.queuedChanges[sheetId]) {
7217
+ // Remove the zones first in case the same position is in toAdd and toRemove
7218
+ const dvZones = dv.ranges.map((range) => range.zone);
7219
+ const withRemovedZones = recomputeZones(dvZones, toRemove);
7220
+ const newDvZones = recomputeZones([...withRemovedZones, ...toAdd], []);
7221
+ if (newDvZones.length === 0) {
7222
+ this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: dv.id });
7223
+ continue;
7224
+ }
7225
+ this.dispatch("ADD_DATA_VALIDATION_RULE", {
7226
+ rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
7227
+ ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
7228
+ sheetId,
7229
+ });
7230
+ }
7141
7231
  }
7142
- this.dispatch("ADD_DATA_VALIDATION_RULE", {
7143
- rule,
7144
- ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
7145
- sheetId,
7146
- });
7147
7232
  }
7148
7233
  }
7149
7234
 
@@ -47546,6 +47631,15 @@ stores.inject(MyMetaStore, storeInstance);
47546
47631
  case "SET_BORDER":
47547
47632
  this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
47548
47633
  break;
47634
+ case "SET_BORDERS_ON_TARGET":
47635
+ for (const zone of cmd.target) {
47636
+ for (let row = zone.top; row <= zone.bottom; row++) {
47637
+ for (let col = zone.left; col <= zone.right; col++) {
47638
+ this.setBorder(cmd.sheetId, col, row, cmd.border);
47639
+ }
47640
+ }
47641
+ }
47642
+ break;
47549
47643
  case "SET_ZONE_BORDERS":
47550
47644
  if (cmd.border) {
47551
47645
  const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
@@ -49024,8 +49118,9 @@ stores.inject(MyMetaStore, storeInstance);
49024
49118
  if (replaceIndex > -1) {
49025
49119
  currentRanges = rules[replaceIndex].ranges.map(toUnboundedZone);
49026
49120
  }
49027
- currentRanges = currentRanges.concat(toAdd);
49028
- return recomputeZones(currentRanges, toRemove).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
49121
+ // Remove the zones first in case the same position is in toAdd and toRemove
49122
+ const withRemovedZones = recomputeZones(currentRanges, toRemove);
49123
+ return recomputeZones([...toAdd, ...withRemovedZones], []).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
49029
49124
  }
49030
49125
  // ---------------------------------------------------------------------------
49031
49126
  // Private
@@ -56536,25 +56631,6 @@ stores.inject(MyMetaStore, storeInstance);
56536
56631
  case "AUTOFILL_AUTO":
56537
56632
  this.autofillAuto();
56538
56633
  break;
56539
- case "AUTOFILL_CELL":
56540
- this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56541
- const sheetId = this.getters.getActiveSheetId();
56542
- this.dispatch("UPDATE_CELL", {
56543
- sheetId,
56544
- col: cmd.col,
56545
- row: cmd.row,
56546
- style: cmd.style || null,
56547
- content: cmd.content || "",
56548
- format: cmd.format || "",
56549
- });
56550
- this.dispatch("SET_BORDER", {
56551
- sheetId,
56552
- col: cmd.col,
56553
- row: cmd.row,
56554
- border: cmd.border,
56555
- });
56556
- this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56557
- this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56558
56634
  }
56559
56635
  }
56560
56636
  // ---------------------------------------------------------------------------
@@ -56578,6 +56654,7 @@ stores.inject(MyMetaStore, storeInstance);
56578
56654
  }
56579
56655
  const source = this.getters.getSelectedZone();
56580
56656
  const target = this.autofillZone;
56657
+ const autofillCellsData = [];
56581
56658
  switch (this.direction) {
56582
56659
  case "down" /* DIRECTION.DOWN */:
56583
56660
  for (let col = source.left; col <= source.right; col++) {
@@ -56587,7 +56664,7 @@ stores.inject(MyMetaStore, storeInstance);
56587
56664
  }
56588
56665
  const generator = this.createGenerator(xcs);
56589
56666
  for (let row = target.top; row <= target.bottom; row++) {
56590
- this.computeNewCell(generator, col, row, apply);
56667
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56591
56668
  }
56592
56669
  }
56593
56670
  break;
@@ -56599,7 +56676,7 @@ stores.inject(MyMetaStore, storeInstance);
56599
56676
  }
56600
56677
  const generator = this.createGenerator(xcs);
56601
56678
  for (let row = target.bottom; row >= target.top; row--) {
56602
- this.computeNewCell(generator, col, row, apply);
56679
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56603
56680
  }
56604
56681
  }
56605
56682
  break;
@@ -56611,7 +56688,7 @@ stores.inject(MyMetaStore, storeInstance);
56611
56688
  }
56612
56689
  const generator = this.createGenerator(xcs);
56613
56690
  for (let col = target.right; col >= target.left; col--) {
56614
- this.computeNewCell(generator, col, row, apply);
56691
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56615
56692
  }
56616
56693
  }
56617
56694
  break;
@@ -56623,12 +56700,26 @@ stores.inject(MyMetaStore, storeInstance);
56623
56700
  }
56624
56701
  const generator = this.createGenerator(xcs);
56625
56702
  for (let col = target.left; col <= target.right; col++) {
56626
- this.computeNewCell(generator, col, row, apply);
56703
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56627
56704
  }
56628
56705
  }
56629
56706
  break;
56630
56707
  }
56631
56708
  if (apply) {
56709
+ const bordersZones = {};
56710
+ const cfNewRanges = {};
56711
+ const dvNewZones = {};
56712
+ const sheetId = this.getters.getActiveSheetId();
56713
+ for (const data of autofillCellsData) {
56714
+ this.collectBordersData(data, bordersZones);
56715
+ this.autofillMerge(sheetId, data);
56716
+ this.autofillCell(sheetId, data);
56717
+ this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
56718
+ this.collectDataValidationsData(sheetId, data, dvNewZones);
56719
+ }
56720
+ this.autofillBorders(sheetId, bordersZones);
56721
+ this.autofillConditionalFormats(sheetId, cfNewRanges);
56722
+ this.autofillDataValidations(sheetId, dvNewZones);
56632
56723
  this.autofillZone = undefined;
56633
56724
  this.selection.resizeAnchorZone(this.direction, this.steps);
56634
56725
  this.lastCellSelected = {};
@@ -56637,6 +56728,95 @@ stores.inject(MyMetaStore, storeInstance);
56637
56728
  this.tooltip = undefined;
56638
56729
  }
56639
56730
  }
56731
+ collectBordersData(data, bordersPositions) {
56732
+ const key = JSON.stringify(data.border);
56733
+ if (!(key in bordersPositions)) {
56734
+ bordersPositions[key] = [];
56735
+ }
56736
+ bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
56737
+ }
56738
+ collectConditionalFormatsData(sheetId, data, cfNewRanges) {
56739
+ const { originCol, originRow, col, row } = data;
56740
+ const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
56741
+ const xc = toXC(col, row);
56742
+ for (const cf of cfsAtOrigin) {
56743
+ if (!(cf.id in cfNewRanges)) {
56744
+ cfNewRanges[cf.id] = [];
56745
+ }
56746
+ cfNewRanges[cf.id].push(xc);
56747
+ }
56748
+ }
56749
+ collectDataValidationsData(sheetId, data, dvNewZones) {
56750
+ const { originCol, originRow, col, row } = data;
56751
+ const cellPosition = { sheetId, col: originCol, row: originRow };
56752
+ const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
56753
+ if (!dvsAtOrigin) {
56754
+ return;
56755
+ }
56756
+ if (!(dvsAtOrigin.id in dvNewZones)) {
56757
+ dvNewZones[dvsAtOrigin.id] = [];
56758
+ }
56759
+ dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
56760
+ }
56761
+ autofillCell(sheetId, data) {
56762
+ this.dispatch("UPDATE_CELL", {
56763
+ sheetId,
56764
+ col: data.col,
56765
+ row: data.row,
56766
+ content: data.content || "",
56767
+ style: data.style || null,
56768
+ format: data.format || "",
56769
+ });
56770
+ // Still usefull in odoo ATM to autofill field sync
56771
+ this.dispatch("AUTOFILL_CELL", data);
56772
+ }
56773
+ autofillBorders(sheetId, bordersPositions) {
56774
+ for (const stringifiedBorder in bordersPositions) {
56775
+ const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
56776
+ this.dispatch("SET_BORDERS_ON_TARGET", {
56777
+ sheetId,
56778
+ border,
56779
+ target: recomputeZones(bordersPositions[stringifiedBorder]),
56780
+ });
56781
+ }
56782
+ }
56783
+ autofillConditionalFormats(sheetId, cfNewRanges) {
56784
+ for (const cfId in cfNewRanges) {
56785
+ const changes = cfNewRanges[cfId];
56786
+ const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
56787
+ if (!cf) {
56788
+ continue;
56789
+ }
56790
+ const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
56791
+ if (newCfRanges) {
56792
+ this.dispatch("ADD_CONDITIONAL_FORMAT", {
56793
+ cf: {
56794
+ id: cf.id,
56795
+ rule: cf.rule,
56796
+ stopIfTrue: cf.stopIfTrue,
56797
+ },
56798
+ ranges: newCfRanges,
56799
+ sheetId,
56800
+ });
56801
+ }
56802
+ }
56803
+ }
56804
+ autofillDataValidations(sheetId, dvNewZones) {
56805
+ for (const dvId in dvNewZones) {
56806
+ const changes = dvNewZones[dvId];
56807
+ const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
56808
+ if (!dvOrigin) {
56809
+ continue;
56810
+ }
56811
+ const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
56812
+ const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
56813
+ this.dispatch("ADD_DATA_VALIDATION_RULE", {
56814
+ rule: dvOrigin,
56815
+ ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
56816
+ sheetId,
56817
+ });
56818
+ }
56819
+ }
56640
56820
  /**
56641
56821
  * Select a cell which becomes the last cell of the autofillZone
56642
56822
  */
@@ -56715,22 +56895,20 @@ stores.inject(MyMetaStore, storeInstance);
56715
56895
  /**
56716
56896
  * Generate the next cell
56717
56897
  */
56718
- computeNewCell(generator, col, row, apply) {
56898
+ computeNewCell(generator, col, row) {
56719
56899
  const { cellData, tooltip, origin } = generator.next();
56720
56900
  const { content, style, border, format } = cellData;
56721
56901
  this.tooltip = tooltip;
56722
- if (apply) {
56723
- this.dispatch("AUTOFILL_CELL", {
56724
- originCol: origin.col,
56725
- originRow: origin.row,
56726
- col,
56727
- row,
56728
- content,
56729
- style,
56730
- border,
56731
- format,
56732
- });
56733
- }
56902
+ return {
56903
+ originCol: origin.col,
56904
+ originRow: origin.row,
56905
+ col,
56906
+ row,
56907
+ content,
56908
+ style,
56909
+ border,
56910
+ format,
56911
+ };
56734
56912
  }
56735
56913
  /**
56736
56914
  * Get the rule associated to the current cell
@@ -56798,8 +56976,8 @@ stores.inject(MyMetaStore, storeInstance);
56798
56976
  ? position[first].value
56799
56977
  : position[second].value;
56800
56978
  }
56801
- autoFillMerge(originCol, originRow, col, row) {
56802
- const sheetId = this.getters.getActiveSheetId();
56979
+ autofillMerge(sheetId, data) {
56980
+ const { originCol, originRow, col, row } = data;
56803
56981
  const position = { sheetId, col, row };
56804
56982
  const originPosition = { sheetId, col: originCol, row: originRow };
56805
56983
  if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
@@ -56826,35 +57004,6 @@ stores.inject(MyMetaStore, storeInstance);
56826
57004
  });
56827
57005
  }
56828
57006
  }
56829
- autofillCF(originCol, originRow, col, row) {
56830
- const sheetId = this.getters.getActiveSheetId();
56831
- const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
56832
- for (const cf of cfOrigin) {
56833
- const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
56834
- if (newCfRanges) {
56835
- this.dispatch("ADD_CONDITIONAL_FORMAT", {
56836
- cf: deepCopy(cf),
56837
- ranges: newCfRanges,
56838
- sheetId,
56839
- });
56840
- }
56841
- }
56842
- }
56843
- autofillDV(originCol, originRow, col, row) {
56844
- const sheetId = this.getters.getActiveSheetId();
56845
- const cellPosition = { sheetId, col: originCol, row: originRow };
56846
- const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
56847
- if (!dvOrigin) {
56848
- return;
56849
- }
56850
- const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
56851
- const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
56852
- this.dispatch("ADD_DATA_VALIDATION_RULE", {
56853
- rule: dvOrigin,
56854
- ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
56855
- sheetId,
56856
- });
56857
- }
56858
57007
  // ---------------------------------------------------------------------------
56859
57008
  // Grid rendering
56860
57009
  // ---------------------------------------------------------------------------
@@ -69226,9 +69375,9 @@ stores.inject(MyMetaStore, storeInstance);
69226
69375
  exports.tokenize = tokenize;
69227
69376
 
69228
69377
 
69229
- __info__.version = "17.4.28";
69230
- __info__.date = "2025-03-26T12:48:33.387Z";
69231
- __info__.hash = "a81a8f4";
69378
+ __info__.version = "17.4.30";
69379
+ __info__.date = "2025-04-14T17:17:01.767Z";
69380
+ __info__.hash = "e4cf37d";
69232
69381
 
69233
69382
 
69234
69383
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);