@odoo/o-spreadsheet 17.4.29 → 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.29
6
- * @date 2025-04-04T08:40:34.590Z
7
- * @hash 2937d99
5
+ * @version 17.4.30
6
+ * @date 2025-04-14T17:17:01.767Z
7
+ * @hash e4cf37d
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2169,6 +2169,7 @@ const coreTypes = new Set([
2169
2169
  "CLEAR_FORMATTING",
2170
2170
  "SET_BORDER",
2171
2171
  "SET_ZONE_BORDERS",
2172
+ "SET_BORDERS_ON_TARGET",
2172
2173
  /** CHART */
2173
2174
  "CREATE_CHART",
2174
2175
  "UPDATE_CHART",
@@ -5652,6 +5653,7 @@ class AbstractCellClipboardHandler extends ClipboardHandler {
5652
5653
  }
5653
5654
 
5654
5655
  class BorderClipboardHandler extends AbstractCellClipboardHandler {
5656
+ queuedBordersToAdd = {};
5655
5657
  copy(data) {
5656
5658
  const sheetId = data.sheetId;
5657
5659
  if (data.zones.length === 0) {
@@ -5682,6 +5684,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5682
5684
  const { left, top } = zones[0];
5683
5685
  this.pasteZone(sheetId, left, top, content.borders);
5684
5686
  }
5687
+ this.executeQueuedChanges(sheetId);
5685
5688
  }
5686
5689
  pasteZone(sheetId, col, row, borders) {
5687
5690
  for (const [r, rowBorders] of borders.entries()) {
@@ -5700,7 +5703,20 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5700
5703
  ...targetBorders,
5701
5704
  ...originBorders,
5702
5705
  };
5703
- this.dispatch("SET_BORDER", { ...target, border });
5706
+ const borderKey = JSON.stringify(border);
5707
+ if (!this.queuedBordersToAdd[borderKey]) {
5708
+ this.queuedBordersToAdd[borderKey] = [];
5709
+ }
5710
+ this.queuedBordersToAdd[borderKey].push(positionToZone(target));
5711
+ }
5712
+ executeQueuedChanges(pasteSheetTarget) {
5713
+ for (const borderKey in this.queuedBordersToAdd) {
5714
+ const zones = this.queuedBordersToAdd[borderKey];
5715
+ const border = JSON.parse(borderKey);
5716
+ const target = recomputeZones(zones, []);
5717
+ this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
5718
+ }
5719
+ this.queuedBordersToAdd = {};
5704
5720
  }
5705
5721
  }
5706
5722
 
@@ -6964,6 +6980,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
6964
6980
 
6965
6981
  class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
6966
6982
  uuidGenerator = new UuidGenerator();
6983
+ queuedChanges = {};
6967
6984
  copy(data) {
6968
6985
  if (!data.zones.length) {
6969
6986
  return;
@@ -6985,6 +7002,7 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
6985
7002
  return { cfRules };
6986
7003
  }
6987
7004
  paste(target, clippedContent, options) {
7005
+ this.queuedChanges = {};
6988
7006
  if (options.pasteOption === "asValue") {
6989
7007
  return;
6990
7008
  }
@@ -6996,6 +7014,7 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
6996
7014
  else {
6997
7015
  this.pasteFromCut(sheetId, zones, clippedContent);
6998
7016
  }
7017
+ this.executeQueuedChanges();
6999
7018
  }
7000
7019
  pasteFromCut(sheetId, target, content) {
7001
7020
  const selection = target[0];
@@ -7013,12 +7032,13 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
7013
7032
  }
7014
7033
  pasteCf(origin, target, isCutOperation) {
7015
7034
  if (origin?.rules && origin.rules.length > 0) {
7035
+ const originZone = positionToZone(origin.position);
7016
7036
  const zone = positionToZone(target);
7017
7037
  for (const rule of origin.rules) {
7018
7038
  const toRemoveZones = [];
7019
7039
  if (isCutOperation) {
7020
7040
  //remove from current rule
7021
- toRemoveZones.push(positionToZone(origin.position));
7041
+ toRemoveZones.push(originZone);
7022
7042
  }
7023
7043
  if (origin.position.sheetId === target.sheetId) {
7024
7044
  this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
@@ -7035,36 +7055,56 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
7035
7055
  * Add or remove cells to a given conditional formatting rule.
7036
7056
  */
7037
7057
  adaptCFRules(sheetId, cf, toAdd, toRemove) {
7038
- const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
7039
- if (!newRangesXc) {
7040
- return;
7058
+ if (!this.queuedChanges[sheetId]) {
7059
+ this.queuedChanges[sheetId] = [];
7041
7060
  }
7042
- if (newRangesXc.length === 0) {
7043
- this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
7044
- return;
7061
+ const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.cf.id === cf.id);
7062
+ if (!queuedChange) {
7063
+ this.queuedChanges[sheetId].push({ toAdd, toRemove, cf });
7064
+ }
7065
+ else {
7066
+ queuedChange.toAdd.push(...toAdd);
7067
+ queuedChange.toRemove.push(...toRemove);
7068
+ }
7069
+ }
7070
+ executeQueuedChanges() {
7071
+ for (const sheetId in this.queuedChanges) {
7072
+ for (const { toAdd, toRemove, cf } of this.queuedChanges[sheetId]) {
7073
+ const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
7074
+ if (!newRangesXc) {
7075
+ continue;
7076
+ }
7077
+ if (newRangesXc.length === 0) {
7078
+ this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
7079
+ continue;
7080
+ }
7081
+ this.dispatch("ADD_CONDITIONAL_FORMAT", {
7082
+ cf: {
7083
+ id: cf.id,
7084
+ rule: cf.rule,
7085
+ stopIfTrue: cf.stopIfTrue,
7086
+ },
7087
+ ranges: newRangesXc,
7088
+ sheetId,
7089
+ });
7090
+ }
7045
7091
  }
7046
- this.dispatch("ADD_CONDITIONAL_FORMAT", {
7047
- cf: {
7048
- id: cf.id,
7049
- rule: cf.rule,
7050
- stopIfTrue: cf.stopIfTrue,
7051
- },
7052
- ranges: newRangesXc,
7053
- sheetId,
7054
- });
7055
7092
  }
7056
7093
  getCFToCopyTo(targetSheetId, originCF) {
7057
- const cfInTarget = this.getters
7094
+ let targetCF = this.getters
7058
7095
  .getConditionalFormats(targetSheetId)
7059
7096
  .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
7060
- return cfInTarget
7061
- ? cfInTarget
7062
- : { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
7097
+ const queuedCfs = this.queuedChanges[targetSheetId];
7098
+ if (!targetCF && queuedCfs) {
7099
+ targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
7100
+ }
7101
+ return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
7063
7102
  }
7064
7103
  }
7065
7104
 
7066
7105
  class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7067
7106
  uuidGenerator = new UuidGenerator();
7107
+ queuedChanges = {};
7068
7108
  copy(data) {
7069
7109
  const { rowsIndexes, columnsIndexes } = data;
7070
7110
  const sheetId = data.sheetId;
@@ -7081,6 +7121,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7081
7121
  return { dvRules };
7082
7122
  }
7083
7123
  paste(target, clippedContent, options) {
7124
+ this.queuedChanges = {};
7084
7125
  if (options.pasteOption) {
7085
7126
  return;
7086
7127
  }
@@ -7092,6 +7133,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7092
7133
  else {
7093
7134
  this.pasteFromCut(sheetId, zones, clippedContent);
7094
7135
  }
7136
+ this.executeQueuedChanges();
7095
7137
  }
7096
7138
  pasteFromCut(sheetId, target, content) {
7097
7139
  const selection = target[0];
@@ -7110,6 +7152,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7110
7152
  pasteDataValidation(origin, target, isCutOperation) {
7111
7153
  if (origin) {
7112
7154
  const zone = positionToZone(target);
7155
+ const originZone = positionToZone(origin.position);
7113
7156
  const rule = origin.rule;
7114
7157
  if (!rule) {
7115
7158
  const targetRule = this.getters.getValidationRuleForCell(target);
@@ -7121,7 +7164,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7121
7164
  }
7122
7165
  const toRemoveZone = [];
7123
7166
  if (isCutOperation) {
7124
- toRemoveZone.push(positionToZone(origin.position));
7167
+ toRemoveZone.push(originZone);
7125
7168
  }
7126
7169
  if (origin.position.sheetId === target.sheetId) {
7127
7170
  const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
@@ -7138,29 +7181,55 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7138
7181
  }
7139
7182
  }
7140
7183
  getDataValidationRuleToCopyTo(targetSheetId, originRule, newId = true) {
7141
- const ruleInTargetSheet = this.getters
7184
+ let targetRule = this.getters
7142
7185
  .getDataValidationRules(targetSheetId)
7143
7186
  .find((rule) => deepEquals(originRule.criterion, rule.criterion) &&
7144
7187
  originRule.isBlocking === rule.isBlocking);
7145
- return ruleInTargetSheet
7146
- ? ruleInTargetSheet
7147
- : { ...originRule, id: newId ? this.uuidGenerator.smallUuid() : originRule.id, ranges: [] };
7188
+ const queuedRules = this.queuedChanges[targetSheetId];
7189
+ if (!targetRule && queuedRules) {
7190
+ targetRule = queuedRules.find((queued) => deepEquals(originRule.criterion, queued.rule.criterion) &&
7191
+ originRule.isBlocking === queued.rule.isBlocking)?.rule;
7192
+ }
7193
+ return (targetRule || {
7194
+ ...originRule,
7195
+ id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
7196
+ ranges: [],
7197
+ });
7148
7198
  }
7149
7199
  /**
7150
7200
  * Add or remove XCs to a given data validation rule.
7151
7201
  */
7152
7202
  adaptDataValidationRule(sheetId, rule, toAdd, toRemove) {
7153
- const dvZones = rule.ranges.map((range) => range.zone);
7154
- const newDvZones = recomputeZones([...dvZones, ...toAdd], toRemove);
7155
- if (newDvZones.length === 0) {
7156
- this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: rule.id });
7157
- return;
7203
+ if (!this.queuedChanges[sheetId]) {
7204
+ this.queuedChanges[sheetId] = [];
7205
+ }
7206
+ const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.rule.id === rule.id);
7207
+ if (!queuedChange) {
7208
+ this.queuedChanges[sheetId].push({ toAdd, toRemove, rule });
7209
+ }
7210
+ else {
7211
+ queuedChange.toAdd.push(...toAdd);
7212
+ queuedChange.toRemove.push(...toRemove);
7213
+ }
7214
+ }
7215
+ executeQueuedChanges() {
7216
+ for (const sheetId in this.queuedChanges) {
7217
+ for (const { toAdd, toRemove, rule: dv } of this.queuedChanges[sheetId]) {
7218
+ // Remove the zones first in case the same position is in toAdd and toRemove
7219
+ const dvZones = dv.ranges.map((range) => range.zone);
7220
+ const withRemovedZones = recomputeZones(dvZones, toRemove);
7221
+ const newDvZones = recomputeZones([...withRemovedZones, ...toAdd], []);
7222
+ if (newDvZones.length === 0) {
7223
+ this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: dv.id });
7224
+ continue;
7225
+ }
7226
+ this.dispatch("ADD_DATA_VALIDATION_RULE", {
7227
+ rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
7228
+ ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
7229
+ sheetId,
7230
+ });
7231
+ }
7158
7232
  }
7159
- this.dispatch("ADD_DATA_VALIDATION_RULE", {
7160
- rule,
7161
- ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
7162
- sheetId,
7163
- });
7164
7233
  }
7165
7234
  }
7166
7235
 
@@ -47563,6 +47632,15 @@ class BordersPlugin extends CorePlugin {
47563
47632
  case "SET_BORDER":
47564
47633
  this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
47565
47634
  break;
47635
+ case "SET_BORDERS_ON_TARGET":
47636
+ for (const zone of cmd.target) {
47637
+ for (let row = zone.top; row <= zone.bottom; row++) {
47638
+ for (let col = zone.left; col <= zone.right; col++) {
47639
+ this.setBorder(cmd.sheetId, col, row, cmd.border);
47640
+ }
47641
+ }
47642
+ }
47643
+ break;
47566
47644
  case "SET_ZONE_BORDERS":
47567
47645
  if (cmd.border) {
47568
47646
  const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
@@ -49041,8 +49119,9 @@ class ConditionalFormatPlugin extends CorePlugin {
49041
49119
  if (replaceIndex > -1) {
49042
49120
  currentRanges = rules[replaceIndex].ranges.map(toUnboundedZone);
49043
49121
  }
49044
- currentRanges = currentRanges.concat(toAdd);
49045
- return recomputeZones(currentRanges, toRemove).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
49122
+ // Remove the zones first in case the same position is in toAdd and toRemove
49123
+ const withRemovedZones = recomputeZones(currentRanges, toRemove);
49124
+ return recomputeZones([...toAdd, ...withRemovedZones], []).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
49046
49125
  }
49047
49126
  // ---------------------------------------------------------------------------
49048
49127
  // Private
@@ -56553,25 +56632,6 @@ class AutofillPlugin extends UIPlugin {
56553
56632
  case "AUTOFILL_AUTO":
56554
56633
  this.autofillAuto();
56555
56634
  break;
56556
- case "AUTOFILL_CELL":
56557
- this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56558
- const sheetId = this.getters.getActiveSheetId();
56559
- this.dispatch("UPDATE_CELL", {
56560
- sheetId,
56561
- col: cmd.col,
56562
- row: cmd.row,
56563
- style: cmd.style || null,
56564
- content: cmd.content || "",
56565
- format: cmd.format || "",
56566
- });
56567
- this.dispatch("SET_BORDER", {
56568
- sheetId,
56569
- col: cmd.col,
56570
- row: cmd.row,
56571
- border: cmd.border,
56572
- });
56573
- this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56574
- this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
56575
56635
  }
56576
56636
  }
56577
56637
  // ---------------------------------------------------------------------------
@@ -56595,6 +56655,7 @@ class AutofillPlugin extends UIPlugin {
56595
56655
  }
56596
56656
  const source = this.getters.getSelectedZone();
56597
56657
  const target = this.autofillZone;
56658
+ const autofillCellsData = [];
56598
56659
  switch (this.direction) {
56599
56660
  case "down" /* DIRECTION.DOWN */:
56600
56661
  for (let col = source.left; col <= source.right; col++) {
@@ -56604,7 +56665,7 @@ class AutofillPlugin extends UIPlugin {
56604
56665
  }
56605
56666
  const generator = this.createGenerator(xcs);
56606
56667
  for (let row = target.top; row <= target.bottom; row++) {
56607
- this.computeNewCell(generator, col, row, apply);
56668
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56608
56669
  }
56609
56670
  }
56610
56671
  break;
@@ -56616,7 +56677,7 @@ class AutofillPlugin extends UIPlugin {
56616
56677
  }
56617
56678
  const generator = this.createGenerator(xcs);
56618
56679
  for (let row = target.bottom; row >= target.top; row--) {
56619
- this.computeNewCell(generator, col, row, apply);
56680
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56620
56681
  }
56621
56682
  }
56622
56683
  break;
@@ -56628,7 +56689,7 @@ class AutofillPlugin extends UIPlugin {
56628
56689
  }
56629
56690
  const generator = this.createGenerator(xcs);
56630
56691
  for (let col = target.right; col >= target.left; col--) {
56631
- this.computeNewCell(generator, col, row, apply);
56692
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56632
56693
  }
56633
56694
  }
56634
56695
  break;
@@ -56640,12 +56701,26 @@ class AutofillPlugin extends UIPlugin {
56640
56701
  }
56641
56702
  const generator = this.createGenerator(xcs);
56642
56703
  for (let col = target.left; col <= target.right; col++) {
56643
- this.computeNewCell(generator, col, row, apply);
56704
+ autofillCellsData.push(this.computeNewCell(generator, col, row));
56644
56705
  }
56645
56706
  }
56646
56707
  break;
56647
56708
  }
56648
56709
  if (apply) {
56710
+ const bordersZones = {};
56711
+ const cfNewRanges = {};
56712
+ const dvNewZones = {};
56713
+ const sheetId = this.getters.getActiveSheetId();
56714
+ for (const data of autofillCellsData) {
56715
+ this.collectBordersData(data, bordersZones);
56716
+ this.autofillMerge(sheetId, data);
56717
+ this.autofillCell(sheetId, data);
56718
+ this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
56719
+ this.collectDataValidationsData(sheetId, data, dvNewZones);
56720
+ }
56721
+ this.autofillBorders(sheetId, bordersZones);
56722
+ this.autofillConditionalFormats(sheetId, cfNewRanges);
56723
+ this.autofillDataValidations(sheetId, dvNewZones);
56649
56724
  this.autofillZone = undefined;
56650
56725
  this.selection.resizeAnchorZone(this.direction, this.steps);
56651
56726
  this.lastCellSelected = {};
@@ -56654,6 +56729,95 @@ class AutofillPlugin extends UIPlugin {
56654
56729
  this.tooltip = undefined;
56655
56730
  }
56656
56731
  }
56732
+ collectBordersData(data, bordersPositions) {
56733
+ const key = JSON.stringify(data.border);
56734
+ if (!(key in bordersPositions)) {
56735
+ bordersPositions[key] = [];
56736
+ }
56737
+ bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
56738
+ }
56739
+ collectConditionalFormatsData(sheetId, data, cfNewRanges) {
56740
+ const { originCol, originRow, col, row } = data;
56741
+ const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
56742
+ const xc = toXC(col, row);
56743
+ for (const cf of cfsAtOrigin) {
56744
+ if (!(cf.id in cfNewRanges)) {
56745
+ cfNewRanges[cf.id] = [];
56746
+ }
56747
+ cfNewRanges[cf.id].push(xc);
56748
+ }
56749
+ }
56750
+ collectDataValidationsData(sheetId, data, dvNewZones) {
56751
+ const { originCol, originRow, col, row } = data;
56752
+ const cellPosition = { sheetId, col: originCol, row: originRow };
56753
+ const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
56754
+ if (!dvsAtOrigin) {
56755
+ return;
56756
+ }
56757
+ if (!(dvsAtOrigin.id in dvNewZones)) {
56758
+ dvNewZones[dvsAtOrigin.id] = [];
56759
+ }
56760
+ dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
56761
+ }
56762
+ autofillCell(sheetId, data) {
56763
+ this.dispatch("UPDATE_CELL", {
56764
+ sheetId,
56765
+ col: data.col,
56766
+ row: data.row,
56767
+ content: data.content || "",
56768
+ style: data.style || null,
56769
+ format: data.format || "",
56770
+ });
56771
+ // Still usefull in odoo ATM to autofill field sync
56772
+ this.dispatch("AUTOFILL_CELL", data);
56773
+ }
56774
+ autofillBorders(sheetId, bordersPositions) {
56775
+ for (const stringifiedBorder in bordersPositions) {
56776
+ const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
56777
+ this.dispatch("SET_BORDERS_ON_TARGET", {
56778
+ sheetId,
56779
+ border,
56780
+ target: recomputeZones(bordersPositions[stringifiedBorder]),
56781
+ });
56782
+ }
56783
+ }
56784
+ autofillConditionalFormats(sheetId, cfNewRanges) {
56785
+ for (const cfId in cfNewRanges) {
56786
+ const changes = cfNewRanges[cfId];
56787
+ const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
56788
+ if (!cf) {
56789
+ continue;
56790
+ }
56791
+ const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
56792
+ if (newCfRanges) {
56793
+ this.dispatch("ADD_CONDITIONAL_FORMAT", {
56794
+ cf: {
56795
+ id: cf.id,
56796
+ rule: cf.rule,
56797
+ stopIfTrue: cf.stopIfTrue,
56798
+ },
56799
+ ranges: newCfRanges,
56800
+ sheetId,
56801
+ });
56802
+ }
56803
+ }
56804
+ }
56805
+ autofillDataValidations(sheetId, dvNewZones) {
56806
+ for (const dvId in dvNewZones) {
56807
+ const changes = dvNewZones[dvId];
56808
+ const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
56809
+ if (!dvOrigin) {
56810
+ continue;
56811
+ }
56812
+ const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
56813
+ const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
56814
+ this.dispatch("ADD_DATA_VALIDATION_RULE", {
56815
+ rule: dvOrigin,
56816
+ ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
56817
+ sheetId,
56818
+ });
56819
+ }
56820
+ }
56657
56821
  /**
56658
56822
  * Select a cell which becomes the last cell of the autofillZone
56659
56823
  */
@@ -56732,22 +56896,20 @@ class AutofillPlugin extends UIPlugin {
56732
56896
  /**
56733
56897
  * Generate the next cell
56734
56898
  */
56735
- computeNewCell(generator, col, row, apply) {
56899
+ computeNewCell(generator, col, row) {
56736
56900
  const { cellData, tooltip, origin } = generator.next();
56737
56901
  const { content, style, border, format } = cellData;
56738
56902
  this.tooltip = tooltip;
56739
- if (apply) {
56740
- this.dispatch("AUTOFILL_CELL", {
56741
- originCol: origin.col,
56742
- originRow: origin.row,
56743
- col,
56744
- row,
56745
- content,
56746
- style,
56747
- border,
56748
- format,
56749
- });
56750
- }
56903
+ return {
56904
+ originCol: origin.col,
56905
+ originRow: origin.row,
56906
+ col,
56907
+ row,
56908
+ content,
56909
+ style,
56910
+ border,
56911
+ format,
56912
+ };
56751
56913
  }
56752
56914
  /**
56753
56915
  * Get the rule associated to the current cell
@@ -56815,8 +56977,8 @@ class AutofillPlugin extends UIPlugin {
56815
56977
  ? position[first].value
56816
56978
  : position[second].value;
56817
56979
  }
56818
- autoFillMerge(originCol, originRow, col, row) {
56819
- const sheetId = this.getters.getActiveSheetId();
56980
+ autofillMerge(sheetId, data) {
56981
+ const { originCol, originRow, col, row } = data;
56820
56982
  const position = { sheetId, col, row };
56821
56983
  const originPosition = { sheetId, col: originCol, row: originRow };
56822
56984
  if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
@@ -56843,35 +57005,6 @@ class AutofillPlugin extends UIPlugin {
56843
57005
  });
56844
57006
  }
56845
57007
  }
56846
- autofillCF(originCol, originRow, col, row) {
56847
- const sheetId = this.getters.getActiveSheetId();
56848
- const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
56849
- for (const cf of cfOrigin) {
56850
- const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
56851
- if (newCfRanges) {
56852
- this.dispatch("ADD_CONDITIONAL_FORMAT", {
56853
- cf: deepCopy(cf),
56854
- ranges: newCfRanges,
56855
- sheetId,
56856
- });
56857
- }
56858
- }
56859
- }
56860
- autofillDV(originCol, originRow, col, row) {
56861
- const sheetId = this.getters.getActiveSheetId();
56862
- const cellPosition = { sheetId, col: originCol, row: originRow };
56863
- const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
56864
- if (!dvOrigin) {
56865
- return;
56866
- }
56867
- const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
56868
- const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
56869
- this.dispatch("ADD_DATA_VALIDATION_RULE", {
56870
- rule: dvOrigin,
56871
- ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
56872
- sheetId,
56873
- });
56874
- }
56875
57008
  // ---------------------------------------------------------------------------
56876
57009
  // Grid rendering
56877
57010
  // ---------------------------------------------------------------------------
@@ -69243,6 +69376,6 @@ exports.tokenColors = tokenColors;
69243
69376
  exports.tokenize = tokenize;
69244
69377
 
69245
69378
 
69246
- __info__.version = "17.4.29";
69247
- __info__.date = "2025-04-04T08:40:34.590Z";
69248
- __info__.hash = "2937d99";
69379
+ __info__.version = "17.4.30";
69380
+ __info__.date = "2025-04-14T17:17:01.767Z";
69381
+ __info__.hash = "e4cf37d";