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