@odoo/o-spreadsheet 16.3.10 → 16.3.12

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.
@@ -1034,13 +1034,17 @@ function getAddHeaderStartIndex(position, base) {
1034
1034
  return position === "after" ? base + 1 : base;
1035
1035
  }
1036
1036
  /**
1037
- * Compare two objects.
1037
+ * Compares two objects.
1038
1038
  */
1039
1039
  function deepEquals(o1, o2) {
1040
1040
  if (o1 === o2)
1041
1041
  return true;
1042
1042
  if ((o1 && !o2) || (o2 && !o1))
1043
1043
  return false;
1044
+ if (typeof o1 !== typeof o2)
1045
+ return false;
1046
+ if (typeof o1 !== "object")
1047
+ return o1 === o2;
1044
1048
  // Objects can have different keys if the values are undefined
1045
1049
  const keys = new Set();
1046
1050
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -4806,6 +4810,7 @@ css /* scss */ `
4806
4810
  padding: 10px;
4807
4811
  width: ${ERROR_TOOLTIP_WIDTH}px;
4808
4812
  box-sizing: border-box !important;
4813
+ overflow-wrap: break-word;
4809
4814
  }
4810
4815
  `;
4811
4816
  class ErrorToolTip extends owl.Component {
@@ -4985,6 +4990,9 @@ class FilterMenu extends owl.Component {
4985
4990
  });
4986
4991
  this.state.values = this.getFilterValues(this.props.filterPosition);
4987
4992
  }
4993
+ get isReadonly() {
4994
+ return this.env.model.getters.isReadonly();
4995
+ }
4988
4996
  getFilterValues(position) {
4989
4997
  const sheetId = this.env.model.getters.getActiveSheetId();
4990
4998
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -19673,7 +19681,6 @@ class FindAndReplacePanel extends owl.Component {
19673
19681
  state = owl.useState(this.initialState());
19674
19682
  debounceTimeoutId;
19675
19683
  showFormulaState = false;
19676
- debouncedUpdateSearch;
19677
19684
  findAndReplaceRef = owl.useRef("findAndReplace");
19678
19685
  get hasSearchResult() {
19679
19686
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -19683,9 +19690,9 @@ class FindAndReplacePanel extends owl.Component {
19683
19690
  }
19684
19691
  setup() {
19685
19692
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
19686
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
19687
19693
  owl.onMounted(() => this.focusInput());
19688
19694
  owl.onWillUnmount(() => {
19695
+ clearTimeout(this.debounceTimeoutId);
19689
19696
  this.env.model.dispatch("CLEAR_SEARCH");
19690
19697
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
19691
19698
  });
@@ -19730,6 +19737,13 @@ class FindAndReplacePanel extends owl.Component {
19730
19737
  searchOptions: this.state.searchOptions,
19731
19738
  });
19732
19739
  }
19740
+ debouncedUpdateSearch() {
19741
+ clearTimeout(this.debounceTimeoutId);
19742
+ this.debounceTimeoutId = setTimeout(() => {
19743
+ this.updateSearch();
19744
+ this.debounceTimeoutId = undefined;
19745
+ }, 200);
19746
+ }
19733
19747
  replace() {
19734
19748
  this.env.model.dispatch("REPLACE_SEARCH", {
19735
19749
  replaceWith: this.state.replaceWith,
@@ -22221,9 +22235,11 @@ function useCellHovered(env, gridRef, callback) {
22221
22235
  }
22222
22236
  }
22223
22237
  function updateMousePosition(e) {
22224
- x = e.offsetX;
22225
- y = e.offsetY;
22226
- lastMoved = Date.now();
22238
+ if (gridRef.el === e.target) {
22239
+ x = e.offsetX;
22240
+ y = e.offsetY;
22241
+ lastMoved = Date.now();
22242
+ }
22227
22243
  }
22228
22244
  function recompute() {
22229
22245
  const { col, row } = getPosition();
@@ -30934,7 +30950,11 @@ class HeaderSizePlugin extends CorePlugin {
30934
30950
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
30935
30951
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
30936
30952
  const baseSize = sizes[cmd.base];
30937
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
30953
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
30954
+ manualSize: baseSize.manualSize,
30955
+ computedSize: lazy(baseSize.computedSize()),
30956
+ }));
30957
+ sizes.splice(addIndex, 0, ...sizesToInsert);
30938
30958
  sizes = sizes.map((size, row) => {
30939
30959
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
30940
30960
  // invalidate sizes
@@ -33723,6 +33743,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
33723
33743
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
33724
33744
  computedStyles = {};
33725
33745
  computedIcons = {};
33746
+ uuidGenerator = new UuidGenerator();
33726
33747
  // ---------------------------------------------------------------------------
33727
33748
  // Command Handling
33728
33749
  // ---------------------------------------------------------------------------
@@ -34070,13 +34091,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
34070
34091
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
34071
34092
  }
34072
34093
  else {
34073
- this.adaptRules(target.sheetId, cf, [xc], []);
34074
34094
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
34095
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
34096
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
34075
34097
  }
34076
34098
  }
34077
34099
  }
34078
34100
  }
34079
34101
  }
34102
+ getCFToCopyTo(targetSheetId, originCF) {
34103
+ const cfInTarget = this.getters
34104
+ .getConditionalFormats(targetSheetId)
34105
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
34106
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
34107
+ }
34080
34108
  }
34081
34109
 
34082
34110
  class FilterEvaluationPlugin extends UIPlugin {
@@ -34435,30 +34463,26 @@ class InternalViewport {
34435
34463
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
34436
34464
  const maxCol = this.getters.getNumberCols(sheetId);
34437
34465
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
34438
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
34439
- if (col > maxCol) {
34440
- break;
34441
- }
34442
- if (this.getters.isColHidden(sheetId, col)) {
34443
- continue;
34444
- }
34445
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
34446
- this.offsetScrollbarX = this.offsetX;
34447
- this.adjustViewportZoneX();
34466
+ let finalTarget = targetCol;
34467
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
34468
+ finalTarget++;
34448
34469
  }
34470
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
34471
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
34472
+ this.offsetX =
34473
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
34474
+ this.offsetScrollbarX = this.offsetX;
34475
+ this.adjustViewportZoneX();
34449
34476
  }
34450
34477
  else if (this.left > targetCol) {
34451
- for (let col = this.left; col >= targetCol; col--) {
34452
- if (col < 0) {
34453
- break;
34454
- }
34455
- if (this.getters.isColHidden(sheetId, col)) {
34456
- continue;
34457
- }
34458
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
34459
- this.offsetScrollbarX = this.offsetX;
34460
- this.adjustViewportZoneX();
34478
+ let finalTarget = targetCol;
34479
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
34480
+ finalTarget--;
34461
34481
  }
34482
+ this.offsetX =
34483
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
34484
+ this.offsetScrollbarX = this.offsetX;
34485
+ this.adjustViewportZoneX();
34462
34486
  }
34463
34487
  }
34464
34488
  adjustPositionY(targetRow) {
@@ -34466,30 +34490,26 @@ class InternalViewport {
34466
34490
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
34467
34491
  const maxRow = this.getters.getNumberRows(sheetId);
34468
34492
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
34469
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
34470
- if (row > maxRow) {
34471
- break;
34472
- }
34473
- if (this.getters.isRowHidden(sheetId, row)) {
34474
- continue;
34475
- }
34476
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
34477
- this.offsetScrollbarY = this.offsetY;
34478
- this.adjustViewportZoneY();
34493
+ let finalTarget = targetRow;
34494
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
34495
+ finalTarget++;
34479
34496
  }
34497
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
34498
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
34499
+ this.offsetY =
34500
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
34501
+ this.offsetScrollbarY = this.offsetY;
34502
+ this.adjustViewportZoneY();
34480
34503
  }
34481
34504
  else if (this.top > targetRow) {
34482
- for (let row = this.top; row >= targetRow; row--) {
34483
- if (row < 0) {
34484
- break;
34485
- }
34486
- if (this.getters.isRowHidden(sheetId, row)) {
34487
- continue;
34488
- }
34489
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
34490
- this.offsetScrollbarY = this.offsetY;
34491
- this.adjustViewportZoneY();
34505
+ let finalTarget = targetRow;
34506
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
34507
+ finalTarget--;
34492
34508
  }
34509
+ this.offsetY =
34510
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
34511
+ this.offsetScrollbarY = this.offsetY;
34512
+ this.adjustViewportZoneY();
34493
34513
  }
34494
34514
  }
34495
34515
  setViewportOffset(offsetX, offsetY) {
@@ -36965,14 +36985,10 @@ class FindAndReplacePlugin extends UIPlugin {
36965
36985
  case "REPLACE_ALL_SEARCH":
36966
36986
  this.replaceAll(cmd.replaceWith);
36967
36987
  break;
36968
- case "EVALUATE_CELLS":
36969
- case "UPDATE_CELL":
36970
- case "REMOVE_FILTER_TABLE":
36971
- case "UPDATE_FILTER":
36972
- this.isSearchDirty = true;
36973
- break;
36974
36988
  case "UNDO":
36975
36989
  case "REDO":
36990
+ case "REMOVE_FILTER_TABLE":
36991
+ case "UPDATE_FILTER":
36976
36992
  case "REMOVE_COLUMNS_ROWS":
36977
36993
  case "HIDE_COLUMNS_ROWS":
36978
36994
  case "UNHIDE_COLUMNS_ROWS":
@@ -39691,7 +39707,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
39691
39707
  });
39692
39708
  for (const filterTable of this.copiedTables) {
39693
39709
  this.dispatch("REMOVE_FILTER_TABLE", {
39694
- sheetId: this.getters.getActiveSheetId(),
39710
+ sheetId: this.sheetId,
39695
39711
  target: [filterTable.zone],
39696
39712
  });
39697
39713
  }
@@ -40194,7 +40210,7 @@ class ClipboardPlugin extends UIPlugin {
40194
40210
  allowDispatch(cmd) {
40195
40211
  switch (cmd.type) {
40196
40212
  case "CUT":
40197
- const zones = cmd.cutTarget || this.getters.getSelectedZones();
40213
+ const zones = this.getters.getSelectedZones();
40198
40214
  const state = this.getClipboardState(zones, cmd.type);
40199
40215
  return state.isCutAllowed(zones);
40200
40216
  case "PASTE":
@@ -40224,7 +40240,7 @@ class ClipboardPlugin extends UIPlugin {
40224
40240
  switch (cmd.type) {
40225
40241
  case "COPY":
40226
40242
  case "CUT":
40227
- const zones = ("cutTarget" in cmd && cmd.cutTarget) || this.getters.getSelectedZones();
40243
+ const zones = this.getters.getSelectedZones();
40228
40244
  this.state = this.getClipboardState(zones, cmd.type);
40229
40245
  this.status = "visible";
40230
40246
  break;
@@ -41644,26 +41660,24 @@ class GridSelectionPlugin extends UIPlugin {
41644
41660
  const isBasedBefore = cmd.base < start;
41645
41661
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
41646
41662
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
41647
- this.dispatch("CUT", {
41648
- cutTarget: [
41649
- {
41650
- left: isCol ? start + deltaCol : 0,
41651
- right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
41652
- top: !isCol ? start + deltaRow : 0,
41653
- bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
41654
- },
41655
- ],
41656
- });
41657
- this.dispatch("PASTE", {
41658
- target: [
41659
- {
41660
- left: isCol ? cmd.base : 0,
41661
- right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
41662
- top: !isCol ? cmd.base : 0,
41663
- bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
41664
- },
41665
- ],
41666
- });
41663
+ const target = [
41664
+ {
41665
+ left: isCol ? start + deltaCol : 0,
41666
+ right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
41667
+ top: !isCol ? start + deltaRow : 0,
41668
+ bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
41669
+ },
41670
+ ];
41671
+ const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
41672
+ const pasteTarget = [
41673
+ {
41674
+ left: isCol ? cmd.base : 0,
41675
+ right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
41676
+ top: !isCol ? cmd.base : 0,
41677
+ bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
41678
+ },
41679
+ ];
41680
+ state.paste(pasteTarget, { selectTarget: true });
41667
41681
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
41668
41682
  let currentIndex = cmd.base;
41669
41683
  for (const element of toRemove) {
@@ -47707,6 +47721,6 @@ exports.setTranslationMethod = setTranslationMethod;
47707
47721
  exports.tokenize = tokenize;
47708
47722
 
47709
47723
 
47710
- __info__.version = '16.3.10';
47711
- __info__.date = '2023-09-12T11:41:57.775Z';
47712
- __info__.hash = '3a95562';
47724
+ __info__.version = '16.3.12';
47725
+ __info__.date = '2023-10-03T12:43:02.230Z';
47726
+ __info__.hash = '70a91d9';
@@ -1887,8 +1887,6 @@ interface CopyCommand {
1887
1887
  }
1888
1888
  interface CutCommand {
1889
1889
  type: "CUT";
1890
- /** Zones to cut. If none were given, will copy the zones in the selection*/
1891
- cutTarget?: Zone[];
1892
1890
  }
1893
1891
  interface PasteCommand {
1894
1892
  type: "PASTE";
@@ -3786,6 +3784,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3786
3784
  private isStale;
3787
3785
  private computedStyles;
3788
3786
  private computedIcons;
3787
+ private uuidGenerator;
3789
3788
  handle(cmd: Command): void;
3790
3789
  finalize(): void;
3791
3790
  getCellComputedStyle(position: CellPosition): Style;
@@ -3816,6 +3815,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3816
3815
  */
3817
3816
  private adaptRules;
3818
3817
  private pasteCf;
3818
+ private getCFToCopyTo;
3819
3819
  }
3820
3820
 
3821
3821
  declare class FilterEvaluationPlugin extends UIPlugin {
@@ -1030,13 +1030,17 @@ function getAddHeaderStartIndex(position, base) {
1030
1030
  return position === "after" ? base + 1 : base;
1031
1031
  }
1032
1032
  /**
1033
- * Compare two objects.
1033
+ * Compares two objects.
1034
1034
  */
1035
1035
  function deepEquals(o1, o2) {
1036
1036
  if (o1 === o2)
1037
1037
  return true;
1038
1038
  if ((o1 && !o2) || (o2 && !o1))
1039
1039
  return false;
1040
+ if (typeof o1 !== typeof o2)
1041
+ return false;
1042
+ if (typeof o1 !== "object")
1043
+ return o1 === o2;
1040
1044
  // Objects can have different keys if the values are undefined
1041
1045
  const keys = new Set();
1042
1046
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -4802,6 +4806,7 @@ css /* scss */ `
4802
4806
  padding: 10px;
4803
4807
  width: ${ERROR_TOOLTIP_WIDTH}px;
4804
4808
  box-sizing: border-box !important;
4809
+ overflow-wrap: break-word;
4805
4810
  }
4806
4811
  `;
4807
4812
  class ErrorToolTip extends Component {
@@ -4981,6 +4986,9 @@ class FilterMenu extends Component {
4981
4986
  });
4982
4987
  this.state.values = this.getFilterValues(this.props.filterPosition);
4983
4988
  }
4989
+ get isReadonly() {
4990
+ return this.env.model.getters.isReadonly();
4991
+ }
4984
4992
  getFilterValues(position) {
4985
4993
  const sheetId = this.env.model.getters.getActiveSheetId();
4986
4994
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -19669,7 +19677,6 @@ class FindAndReplacePanel extends Component {
19669
19677
  state = useState(this.initialState());
19670
19678
  debounceTimeoutId;
19671
19679
  showFormulaState = false;
19672
- debouncedUpdateSearch;
19673
19680
  findAndReplaceRef = useRef("findAndReplace");
19674
19681
  get hasSearchResult() {
19675
19682
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -19679,9 +19686,9 @@ class FindAndReplacePanel extends Component {
19679
19686
  }
19680
19687
  setup() {
19681
19688
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
19682
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
19683
19689
  onMounted(() => this.focusInput());
19684
19690
  onWillUnmount(() => {
19691
+ clearTimeout(this.debounceTimeoutId);
19685
19692
  this.env.model.dispatch("CLEAR_SEARCH");
19686
19693
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
19687
19694
  });
@@ -19726,6 +19733,13 @@ class FindAndReplacePanel extends Component {
19726
19733
  searchOptions: this.state.searchOptions,
19727
19734
  });
19728
19735
  }
19736
+ debouncedUpdateSearch() {
19737
+ clearTimeout(this.debounceTimeoutId);
19738
+ this.debounceTimeoutId = setTimeout(() => {
19739
+ this.updateSearch();
19740
+ this.debounceTimeoutId = undefined;
19741
+ }, 200);
19742
+ }
19729
19743
  replace() {
19730
19744
  this.env.model.dispatch("REPLACE_SEARCH", {
19731
19745
  replaceWith: this.state.replaceWith,
@@ -22217,9 +22231,11 @@ function useCellHovered(env, gridRef, callback) {
22217
22231
  }
22218
22232
  }
22219
22233
  function updateMousePosition(e) {
22220
- x = e.offsetX;
22221
- y = e.offsetY;
22222
- lastMoved = Date.now();
22234
+ if (gridRef.el === e.target) {
22235
+ x = e.offsetX;
22236
+ y = e.offsetY;
22237
+ lastMoved = Date.now();
22238
+ }
22223
22239
  }
22224
22240
  function recompute() {
22225
22241
  const { col, row } = getPosition();
@@ -30930,7 +30946,11 @@ class HeaderSizePlugin extends CorePlugin {
30930
30946
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
30931
30947
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
30932
30948
  const baseSize = sizes[cmd.base];
30933
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
30949
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
30950
+ manualSize: baseSize.manualSize,
30951
+ computedSize: lazy(baseSize.computedSize()),
30952
+ }));
30953
+ sizes.splice(addIndex, 0, ...sizesToInsert);
30934
30954
  sizes = sizes.map((size, row) => {
30935
30955
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
30936
30956
  // invalidate sizes
@@ -33719,6 +33739,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
33719
33739
  // stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
33720
33740
  computedStyles = {};
33721
33741
  computedIcons = {};
33742
+ uuidGenerator = new UuidGenerator();
33722
33743
  // ---------------------------------------------------------------------------
33723
33744
  // Command Handling
33724
33745
  // ---------------------------------------------------------------------------
@@ -34066,13 +34087,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
34066
34087
  this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
34067
34088
  }
34068
34089
  else {
34069
- this.adaptRules(target.sheetId, cf, [xc], []);
34070
34090
  this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
34091
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
34092
+ this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
34071
34093
  }
34072
34094
  }
34073
34095
  }
34074
34096
  }
34075
34097
  }
34098
+ getCFToCopyTo(targetSheetId, originCF) {
34099
+ const cfInTarget = this.getters
34100
+ .getConditionalFormats(targetSheetId)
34101
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
34102
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
34103
+ }
34076
34104
  }
34077
34105
 
34078
34106
  class FilterEvaluationPlugin extends UIPlugin {
@@ -34431,30 +34459,26 @@ class InternalViewport {
34431
34459
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
34432
34460
  const maxCol = this.getters.getNumberCols(sheetId);
34433
34461
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
34434
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
34435
- if (col > maxCol) {
34436
- break;
34437
- }
34438
- if (this.getters.isColHidden(sheetId, col)) {
34439
- continue;
34440
- }
34441
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
34442
- this.offsetScrollbarX = this.offsetX;
34443
- this.adjustViewportZoneX();
34462
+ let finalTarget = targetCol;
34463
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
34464
+ finalTarget++;
34444
34465
  }
34466
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
34467
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
34468
+ this.offsetX =
34469
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
34470
+ this.offsetScrollbarX = this.offsetX;
34471
+ this.adjustViewportZoneX();
34445
34472
  }
34446
34473
  else if (this.left > targetCol) {
34447
- for (let col = this.left; col >= targetCol; col--) {
34448
- if (col < 0) {
34449
- break;
34450
- }
34451
- if (this.getters.isColHidden(sheetId, col)) {
34452
- continue;
34453
- }
34454
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
34455
- this.offsetScrollbarX = this.offsetX;
34456
- this.adjustViewportZoneX();
34474
+ let finalTarget = targetCol;
34475
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
34476
+ finalTarget--;
34457
34477
  }
34478
+ this.offsetX =
34479
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
34480
+ this.offsetScrollbarX = this.offsetX;
34481
+ this.adjustViewportZoneX();
34458
34482
  }
34459
34483
  }
34460
34484
  adjustPositionY(targetRow) {
@@ -34462,30 +34486,26 @@ class InternalViewport {
34462
34486
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
34463
34487
  const maxRow = this.getters.getNumberRows(sheetId);
34464
34488
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
34465
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
34466
- if (row > maxRow) {
34467
- break;
34468
- }
34469
- if (this.getters.isRowHidden(sheetId, row)) {
34470
- continue;
34471
- }
34472
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
34473
- this.offsetScrollbarY = this.offsetY;
34474
- this.adjustViewportZoneY();
34489
+ let finalTarget = targetRow;
34490
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
34491
+ finalTarget++;
34475
34492
  }
34493
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
34494
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
34495
+ this.offsetY =
34496
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
34497
+ this.offsetScrollbarY = this.offsetY;
34498
+ this.adjustViewportZoneY();
34476
34499
  }
34477
34500
  else if (this.top > targetRow) {
34478
- for (let row = this.top; row >= targetRow; row--) {
34479
- if (row < 0) {
34480
- break;
34481
- }
34482
- if (this.getters.isRowHidden(sheetId, row)) {
34483
- continue;
34484
- }
34485
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
34486
- this.offsetScrollbarY = this.offsetY;
34487
- this.adjustViewportZoneY();
34501
+ let finalTarget = targetRow;
34502
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
34503
+ finalTarget--;
34488
34504
  }
34505
+ this.offsetY =
34506
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
34507
+ this.offsetScrollbarY = this.offsetY;
34508
+ this.adjustViewportZoneY();
34489
34509
  }
34490
34510
  }
34491
34511
  setViewportOffset(offsetX, offsetY) {
@@ -36961,14 +36981,10 @@ class FindAndReplacePlugin extends UIPlugin {
36961
36981
  case "REPLACE_ALL_SEARCH":
36962
36982
  this.replaceAll(cmd.replaceWith);
36963
36983
  break;
36964
- case "EVALUATE_CELLS":
36965
- case "UPDATE_CELL":
36966
- case "REMOVE_FILTER_TABLE":
36967
- case "UPDATE_FILTER":
36968
- this.isSearchDirty = true;
36969
- break;
36970
36984
  case "UNDO":
36971
36985
  case "REDO":
36986
+ case "REMOVE_FILTER_TABLE":
36987
+ case "UPDATE_FILTER":
36972
36988
  case "REMOVE_COLUMNS_ROWS":
36973
36989
  case "HIDE_COLUMNS_ROWS":
36974
36990
  case "UNHIDE_COLUMNS_ROWS":
@@ -39687,7 +39703,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
39687
39703
  });
39688
39704
  for (const filterTable of this.copiedTables) {
39689
39705
  this.dispatch("REMOVE_FILTER_TABLE", {
39690
- sheetId: this.getters.getActiveSheetId(),
39706
+ sheetId: this.sheetId,
39691
39707
  target: [filterTable.zone],
39692
39708
  });
39693
39709
  }
@@ -40190,7 +40206,7 @@ class ClipboardPlugin extends UIPlugin {
40190
40206
  allowDispatch(cmd) {
40191
40207
  switch (cmd.type) {
40192
40208
  case "CUT":
40193
- const zones = cmd.cutTarget || this.getters.getSelectedZones();
40209
+ const zones = this.getters.getSelectedZones();
40194
40210
  const state = this.getClipboardState(zones, cmd.type);
40195
40211
  return state.isCutAllowed(zones);
40196
40212
  case "PASTE":
@@ -40220,7 +40236,7 @@ class ClipboardPlugin extends UIPlugin {
40220
40236
  switch (cmd.type) {
40221
40237
  case "COPY":
40222
40238
  case "CUT":
40223
- const zones = ("cutTarget" in cmd && cmd.cutTarget) || this.getters.getSelectedZones();
40239
+ const zones = this.getters.getSelectedZones();
40224
40240
  this.state = this.getClipboardState(zones, cmd.type);
40225
40241
  this.status = "visible";
40226
40242
  break;
@@ -41640,26 +41656,24 @@ class GridSelectionPlugin extends UIPlugin {
41640
41656
  const isBasedBefore = cmd.base < start;
41641
41657
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
41642
41658
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
41643
- this.dispatch("CUT", {
41644
- cutTarget: [
41645
- {
41646
- left: isCol ? start + deltaCol : 0,
41647
- right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
41648
- top: !isCol ? start + deltaRow : 0,
41649
- bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
41650
- },
41651
- ],
41652
- });
41653
- this.dispatch("PASTE", {
41654
- target: [
41655
- {
41656
- left: isCol ? cmd.base : 0,
41657
- right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
41658
- top: !isCol ? cmd.base : 0,
41659
- bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
41660
- },
41661
- ],
41662
- });
41659
+ const target = [
41660
+ {
41661
+ left: isCol ? start + deltaCol : 0,
41662
+ right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
41663
+ top: !isCol ? start + deltaRow : 0,
41664
+ bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
41665
+ },
41666
+ ];
41667
+ const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
41668
+ const pasteTarget = [
41669
+ {
41670
+ left: isCol ? cmd.base : 0,
41671
+ right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
41672
+ top: !isCol ? cmd.base : 0,
41673
+ bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
41674
+ },
41675
+ ];
41676
+ state.paste(pasteTarget, { selectTarget: true });
41663
41677
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
41664
41678
  let currentIndex = cmd.base;
41665
41679
  for (const element of toRemove) {
@@ -47675,6 +47689,6 @@ function addFunction(functionName, functionDescription) {
47675
47689
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
47676
47690
 
47677
47691
 
47678
- __info__.version = '16.3.10';
47679
- __info__.date = '2023-09-12T11:41:57.775Z';
47680
- __info__.hash = '3a95562';
47692
+ __info__.version = '16.3.12';
47693
+ __info__.date = '2023-10-03T12:43:02.230Z';
47694
+ __info__.hash = '70a91d9';