@odoo/o-spreadsheet 18.0.34 → 18.0.36

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 18.0.34
6
- * @date 2025-06-19T18:26:11.726Z
7
- * @hash 5526881
5
+ * @version 18.0.36
6
+ * @date 2025-06-27T09:11:51.920Z
7
+ * @hash b8dc998
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';
@@ -6661,6 +6661,63 @@ function parseOSClipboardContent(content) {
6661
6661
  data: spreadsheetContent,
6662
6662
  };
6663
6663
  }
6664
+ /**
6665
+ * Applies each clipboard handler to paste its corresponding data into the target.
6666
+ */
6667
+ const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
6668
+ handlers.forEach(({ handlerName, handler }) => {
6669
+ const data = copiedData[handlerName];
6670
+ if (data) {
6671
+ handler.paste(target, data, options);
6672
+ }
6673
+ });
6674
+ };
6675
+ /**
6676
+ * Returns the paste target based on clipboard handlers.
6677
+ * Also includes the full affected zone and the list of pasted zones for selection.
6678
+ */
6679
+ function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
6680
+ let zone = undefined;
6681
+ let selectedZones = [];
6682
+ let target = {
6683
+ sheetId,
6684
+ zones,
6685
+ };
6686
+ for (const { handlerName, handler } of handlers) {
6687
+ const handlerData = copiedData[handlerName];
6688
+ if (!handlerData) {
6689
+ continue;
6690
+ }
6691
+ const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
6692
+ if (currentTarget.figureId) {
6693
+ target.figureId = currentTarget.figureId;
6694
+ }
6695
+ for (const targetZone of currentTarget.zones) {
6696
+ selectedZones.push(targetZone);
6697
+ if (zone === undefined) {
6698
+ zone = targetZone;
6699
+ continue;
6700
+ }
6701
+ zone = union(zone, targetZone);
6702
+ }
6703
+ }
6704
+ return {
6705
+ target,
6706
+ zone,
6707
+ selectedZones,
6708
+ };
6709
+ }
6710
+ /**
6711
+ * Updates the selection after a paste operation.
6712
+ */
6713
+ const selectPastedZone = (selection, sourceZones, pastedZones) => {
6714
+ const anchorCell = {
6715
+ col: sourceZones[0].left,
6716
+ row: sourceZones[0].top,
6717
+ };
6718
+ selection.getBackToDefault();
6719
+ selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
6720
+ };
6664
6721
 
6665
6722
  class ClipboardHandler {
6666
6723
  getters;
@@ -44614,7 +44671,7 @@ class SpreadsheetPivot {
44614
44671
  }
44615
44672
  getTypeFromZone(sheetId, zone) {
44616
44673
  const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
44617
- const nonEmptyCells = cells.filter((cell) => cell.type !== CellValueType.empty);
44674
+ const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
44618
44675
  if (nonEmptyCells.length === 0) {
44619
44676
  return "integer";
44620
44677
  }
@@ -48147,15 +48204,16 @@ class GridAddRowsFooter extends Component {
48147
48204
  }
48148
48205
  }
48149
48206
 
48207
+ const PAINT_FORMAT_HANDLER_KEYS = [
48208
+ "cell",
48209
+ "border",
48210
+ "table",
48211
+ "conditionalFormat",
48212
+ "merge",
48213
+ ];
48150
48214
  class PaintFormatStore extends SpreadsheetStore {
48151
48215
  mutators = ["activate", "cancel", "pasteFormat"];
48152
48216
  highlightStore = this.get(HighlightStore);
48153
- clipboardHandlers = [
48154
- new CellClipboardHandler(this.getters, this.model.dispatch),
48155
- new BorderClipboardHandler(this.getters, this.model.dispatch),
48156
- new TableClipboardHandler(this.getters, this.model.dispatch),
48157
- new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
48158
- ];
48159
48217
  status = "inactive";
48160
48218
  copiedData;
48161
48219
  constructor(get) {
@@ -48186,24 +48244,38 @@ class PaintFormatStore extends SpreadsheetStore {
48186
48244
  get isActive() {
48187
48245
  return this.status !== "inactive";
48188
48246
  }
48247
+ get clipboardHandlers() {
48248
+ return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
48249
+ const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
48250
+ return {
48251
+ handlerName,
48252
+ handler: new HandlerClass(this.getters, this.model.dispatch),
48253
+ };
48254
+ });
48255
+ }
48189
48256
  copyFormats() {
48190
48257
  const sheetId = this.getters.getActiveSheetId();
48191
48258
  const zones = this.getters.getSelectedZones();
48192
- const copiedData = {};
48193
- for (const handler of this.clipboardHandlers) {
48194
- Object.assign(copiedData, handler.copy(getClipboardDataPositions(sheetId, zones)));
48259
+ const copiedData = { zones, sheetId };
48260
+ for (const { handlerName, handler } of this.clipboardHandlers) {
48261
+ const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
48262
+ if (handlerResult !== undefined) {
48263
+ copiedData[handlerName] = handlerResult;
48264
+ }
48195
48265
  }
48196
48266
  return copiedData;
48197
48267
  }
48198
48268
  paintFormat(sheetId, target) {
48199
- if (this.copiedData) {
48200
- for (const handler of this.clipboardHandlers) {
48201
- handler.paste({ zones: target, sheetId }, this.copiedData, {
48202
- isCutOperation: false,
48203
- pasteOption: "onlyFormat",
48204
- });
48205
- }
48269
+ if (!this.copiedData) {
48270
+ return;
48206
48271
  }
48272
+ const options = {
48273
+ isCutOperation: false,
48274
+ pasteOption: "onlyFormat",
48275
+ };
48276
+ const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
48277
+ applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
48278
+ selectPastedZone(this.model.selection, target, selectedZones);
48207
48279
  if (this.status === "oneOff") {
48208
48280
  this.cancel();
48209
48281
  }
@@ -53461,7 +53533,7 @@ class DataValidationPlugin extends CorePlugin {
53461
53533
  else if (newRule.criterion.type === "isValueInList") {
53462
53534
  newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
53463
53535
  }
53464
- const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
53536
+ const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
53465
53537
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
53466
53538
  if (ruleIndex !== -1) {
53467
53539
  adaptedRules[ruleIndex] = newRule;
@@ -53471,9 +53543,12 @@ class DataValidationPlugin extends CorePlugin {
53471
53543
  this.history.update("rules", sheetId, [...adaptedRules, newRule]);
53472
53544
  }
53473
53545
  }
53474
- removeRangesFromRules(sheetId, ranges, rules) {
53546
+ removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
53475
53547
  rules = deepCopy(rules);
53476
53548
  for (const rule of rules) {
53549
+ if (rule.id === editingRuleId) {
53550
+ continue; // Skip the rule being edited to preserve its place in the list
53551
+ }
53477
53552
  rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
53478
53553
  }
53479
53554
  return rules.filter((rule) => rule.ranges.length > 0);
@@ -65158,49 +65233,17 @@ class ClipboardPlugin extends UIPlugin {
65158
65233
  if (!copiedData) {
65159
65234
  return;
65160
65235
  }
65161
- let zone = undefined;
65162
- let selectedZones = [];
65163
65236
  const sheetId = this.getters.getActiveSheetId();
65164
- let target = {
65165
- sheetId,
65166
- zones,
65167
- };
65168
65237
  const handlers = this.selectClipboardHandlers(copiedData);
65169
- for (const { handlerName, handler } of handlers) {
65170
- const handlerData = copiedData[handlerName];
65171
- if (!handlerData) {
65172
- continue;
65173
- }
65174
- const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
65175
- if (currentTarget.figureId) {
65176
- target.figureId = currentTarget.figureId;
65177
- }
65178
- for (const targetZone of currentTarget.zones) {
65179
- selectedZones.push(targetZone);
65180
- if (zone === undefined) {
65181
- zone = targetZone;
65182
- continue;
65183
- }
65184
- zone = union(zone, targetZone);
65185
- }
65186
- }
65238
+ const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
65187
65239
  if (zone !== undefined) {
65188
- this.addMissingDimensions(this.getters.getActiveSheetId(), zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
65240
+ this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
65189
65241
  }
65190
- handlers.forEach(({ handlerName, handler }) => {
65191
- const handlerData = copiedData[handlerName];
65192
- if (handlerData) {
65193
- handler.paste(target, handlerData, options);
65194
- }
65195
- });
65242
+ applyClipboardHandlersPaste(handlers, copiedData, target, options);
65196
65243
  if (!options?.selectTarget) {
65197
65244
  return;
65198
65245
  }
65199
- const selection = zones[0];
65200
- const col = selection.left;
65201
- const row = selection.top;
65202
- this.selection.getBackToDefault();
65203
- this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
65246
+ selectPastedZone(this.selection, zones, selectedZones);
65204
65247
  }
65205
65248
  /**
65206
65249
  * Add columns and/or rows to ensure that col + width and row + height are still
@@ -71151,26 +71194,28 @@ class SelectionStreamProcessorImpl {
71151
71194
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
71152
71195
  };
71153
71196
  };
71154
- const { col: refCol, row: refRow } = this.getReferencePosition();
71197
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
71198
+ const { col: refCol, row: refRow } = refCell;
71155
71199
  // check if we can shrink selection
71156
71200
  let n = 0;
71157
71201
  while (result !== null) {
71158
71202
  n++;
71159
71203
  if (deltaCol < 0) {
71160
71204
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
71161
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
71205
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
71162
71206
  }
71163
71207
  if (deltaCol > 0) {
71164
71208
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
71165
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
71209
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
71166
71210
  }
71167
71211
  if (deltaRow < 0) {
71168
71212
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
71169
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
71213
+ result =
71214
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
71170
71215
  }
71171
71216
  if (deltaRow > 0) {
71172
71217
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
71173
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
71218
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
71174
71219
  }
71175
71220
  result = result ? reorderZone(result) : result;
71176
71221
  if (result && !isEqual(result, anchor.zone)) {
@@ -71400,18 +71445,26 @@ class SelectionStreamProcessorImpl {
71400
71445
  * If the anchor is hidden, browses from left to right and top to bottom to
71401
71446
  * find a visible cell.
71402
71447
  */
71403
- getReferencePosition() {
71448
+ getReferenceAnchor() {
71404
71449
  const sheetId = this.getters.getActiveSheetId();
71405
71450
  const anchor = this.anchor;
71406
71451
  const { left, right, top, bottom } = anchor.zone;
71407
71452
  const { col: anchorCol, row: anchorRow } = anchor.cell;
71453
+ const col = this.getters.isColHidden(sheetId, anchorCol)
71454
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
71455
+ : anchorCol;
71456
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
71457
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
71458
+ : anchorRow;
71459
+ const zone = this.getters.expandZone(sheetId, {
71460
+ left: col,
71461
+ right: col,
71462
+ top: row,
71463
+ bottom: row,
71464
+ });
71408
71465
  return {
71409
- col: this.getters.isColHidden(sheetId, anchorCol)
71410
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
71411
- : anchorCol,
71412
- row: this.getters.isRowHidden(sheetId, anchorRow)
71413
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
71414
- : anchorRow,
71466
+ cell: { col, row },
71467
+ zone,
71415
71468
  };
71416
71469
  }
71417
71470
  deltaToTarget(position, direction, step) {
@@ -74416,6 +74469,6 @@ const constants = {
74416
74469
  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 };
74417
74470
 
74418
74471
 
74419
- __info__.version = "18.0.34";
74420
- __info__.date = "2025-06-19T18:26:11.726Z";
74421
- __info__.hash = "5526881";
74472
+ __info__.version = "18.0.36";
74473
+ __info__.date = "2025-06-27T09:11:51.920Z";
74474
+ __info__.hash = "b8dc998";
@@ -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 18.0.34
6
- * @date 2025-06-19T18:26:11.726Z
7
- * @hash 5526881
5
+ * @version 18.0.36
6
+ * @date 2025-06-27T09:11:51.920Z
7
+ * @hash b8dc998
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6662,6 +6662,63 @@
6662
6662
  data: spreadsheetContent,
6663
6663
  };
6664
6664
  }
6665
+ /**
6666
+ * Applies each clipboard handler to paste its corresponding data into the target.
6667
+ */
6668
+ const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
6669
+ handlers.forEach(({ handlerName, handler }) => {
6670
+ const data = copiedData[handlerName];
6671
+ if (data) {
6672
+ handler.paste(target, data, options);
6673
+ }
6674
+ });
6675
+ };
6676
+ /**
6677
+ * Returns the paste target based on clipboard handlers.
6678
+ * Also includes the full affected zone and the list of pasted zones for selection.
6679
+ */
6680
+ function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
6681
+ let zone = undefined;
6682
+ let selectedZones = [];
6683
+ let target = {
6684
+ sheetId,
6685
+ zones,
6686
+ };
6687
+ for (const { handlerName, handler } of handlers) {
6688
+ const handlerData = copiedData[handlerName];
6689
+ if (!handlerData) {
6690
+ continue;
6691
+ }
6692
+ const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
6693
+ if (currentTarget.figureId) {
6694
+ target.figureId = currentTarget.figureId;
6695
+ }
6696
+ for (const targetZone of currentTarget.zones) {
6697
+ selectedZones.push(targetZone);
6698
+ if (zone === undefined) {
6699
+ zone = targetZone;
6700
+ continue;
6701
+ }
6702
+ zone = union(zone, targetZone);
6703
+ }
6704
+ }
6705
+ return {
6706
+ target,
6707
+ zone,
6708
+ selectedZones,
6709
+ };
6710
+ }
6711
+ /**
6712
+ * Updates the selection after a paste operation.
6713
+ */
6714
+ const selectPastedZone = (selection, sourceZones, pastedZones) => {
6715
+ const anchorCell = {
6716
+ col: sourceZones[0].left,
6717
+ row: sourceZones[0].top,
6718
+ };
6719
+ selection.getBackToDefault();
6720
+ selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
6721
+ };
6665
6722
 
6666
6723
  class ClipboardHandler {
6667
6724
  getters;
@@ -44615,7 +44672,7 @@ stores.inject(MyMetaStore, storeInstance);
44615
44672
  }
44616
44673
  getTypeFromZone(sheetId, zone) {
44617
44674
  const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
44618
- const nonEmptyCells = cells.filter((cell) => cell.type !== CellValueType.empty);
44675
+ const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
44619
44676
  if (nonEmptyCells.length === 0) {
44620
44677
  return "integer";
44621
44678
  }
@@ -48148,15 +48205,16 @@ stores.inject(MyMetaStore, storeInstance);
48148
48205
  }
48149
48206
  }
48150
48207
 
48208
+ const PAINT_FORMAT_HANDLER_KEYS = [
48209
+ "cell",
48210
+ "border",
48211
+ "table",
48212
+ "conditionalFormat",
48213
+ "merge",
48214
+ ];
48151
48215
  class PaintFormatStore extends SpreadsheetStore {
48152
48216
  mutators = ["activate", "cancel", "pasteFormat"];
48153
48217
  highlightStore = this.get(HighlightStore);
48154
- clipboardHandlers = [
48155
- new CellClipboardHandler(this.getters, this.model.dispatch),
48156
- new BorderClipboardHandler(this.getters, this.model.dispatch),
48157
- new TableClipboardHandler(this.getters, this.model.dispatch),
48158
- new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
48159
- ];
48160
48218
  status = "inactive";
48161
48219
  copiedData;
48162
48220
  constructor(get) {
@@ -48187,24 +48245,38 @@ stores.inject(MyMetaStore, storeInstance);
48187
48245
  get isActive() {
48188
48246
  return this.status !== "inactive";
48189
48247
  }
48248
+ get clipboardHandlers() {
48249
+ return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
48250
+ const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
48251
+ return {
48252
+ handlerName,
48253
+ handler: new HandlerClass(this.getters, this.model.dispatch),
48254
+ };
48255
+ });
48256
+ }
48190
48257
  copyFormats() {
48191
48258
  const sheetId = this.getters.getActiveSheetId();
48192
48259
  const zones = this.getters.getSelectedZones();
48193
- const copiedData = {};
48194
- for (const handler of this.clipboardHandlers) {
48195
- Object.assign(copiedData, handler.copy(getClipboardDataPositions(sheetId, zones)));
48260
+ const copiedData = { zones, sheetId };
48261
+ for (const { handlerName, handler } of this.clipboardHandlers) {
48262
+ const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
48263
+ if (handlerResult !== undefined) {
48264
+ copiedData[handlerName] = handlerResult;
48265
+ }
48196
48266
  }
48197
48267
  return copiedData;
48198
48268
  }
48199
48269
  paintFormat(sheetId, target) {
48200
- if (this.copiedData) {
48201
- for (const handler of this.clipboardHandlers) {
48202
- handler.paste({ zones: target, sheetId }, this.copiedData, {
48203
- isCutOperation: false,
48204
- pasteOption: "onlyFormat",
48205
- });
48206
- }
48270
+ if (!this.copiedData) {
48271
+ return;
48207
48272
  }
48273
+ const options = {
48274
+ isCutOperation: false,
48275
+ pasteOption: "onlyFormat",
48276
+ };
48277
+ const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
48278
+ applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
48279
+ selectPastedZone(this.model.selection, target, selectedZones);
48208
48280
  if (this.status === "oneOff") {
48209
48281
  this.cancel();
48210
48282
  }
@@ -53462,7 +53534,7 @@ stores.inject(MyMetaStore, storeInstance);
53462
53534
  else if (newRule.criterion.type === "isValueInList") {
53463
53535
  newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
53464
53536
  }
53465
- const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
53537
+ const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
53466
53538
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
53467
53539
  if (ruleIndex !== -1) {
53468
53540
  adaptedRules[ruleIndex] = newRule;
@@ -53472,9 +53544,12 @@ stores.inject(MyMetaStore, storeInstance);
53472
53544
  this.history.update("rules", sheetId, [...adaptedRules, newRule]);
53473
53545
  }
53474
53546
  }
53475
- removeRangesFromRules(sheetId, ranges, rules) {
53547
+ removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
53476
53548
  rules = deepCopy(rules);
53477
53549
  for (const rule of rules) {
53550
+ if (rule.id === editingRuleId) {
53551
+ continue; // Skip the rule being edited to preserve its place in the list
53552
+ }
53478
53553
  rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
53479
53554
  }
53480
53555
  return rules.filter((rule) => rule.ranges.length > 0);
@@ -65159,49 +65234,17 @@ stores.inject(MyMetaStore, storeInstance);
65159
65234
  if (!copiedData) {
65160
65235
  return;
65161
65236
  }
65162
- let zone = undefined;
65163
- let selectedZones = [];
65164
65237
  const sheetId = this.getters.getActiveSheetId();
65165
- let target = {
65166
- sheetId,
65167
- zones,
65168
- };
65169
65238
  const handlers = this.selectClipboardHandlers(copiedData);
65170
- for (const { handlerName, handler } of handlers) {
65171
- const handlerData = copiedData[handlerName];
65172
- if (!handlerData) {
65173
- continue;
65174
- }
65175
- const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
65176
- if (currentTarget.figureId) {
65177
- target.figureId = currentTarget.figureId;
65178
- }
65179
- for (const targetZone of currentTarget.zones) {
65180
- selectedZones.push(targetZone);
65181
- if (zone === undefined) {
65182
- zone = targetZone;
65183
- continue;
65184
- }
65185
- zone = union(zone, targetZone);
65186
- }
65187
- }
65239
+ const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
65188
65240
  if (zone !== undefined) {
65189
- this.addMissingDimensions(this.getters.getActiveSheetId(), zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
65241
+ this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
65190
65242
  }
65191
- handlers.forEach(({ handlerName, handler }) => {
65192
- const handlerData = copiedData[handlerName];
65193
- if (handlerData) {
65194
- handler.paste(target, handlerData, options);
65195
- }
65196
- });
65243
+ applyClipboardHandlersPaste(handlers, copiedData, target, options);
65197
65244
  if (!options?.selectTarget) {
65198
65245
  return;
65199
65246
  }
65200
- const selection = zones[0];
65201
- const col = selection.left;
65202
- const row = selection.top;
65203
- this.selection.getBackToDefault();
65204
- this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
65247
+ selectPastedZone(this.selection, zones, selectedZones);
65205
65248
  }
65206
65249
  /**
65207
65250
  * Add columns and/or rows to ensure that col + width and row + height are still
@@ -71152,26 +71195,28 @@ stores.inject(MyMetaStore, storeInstance);
71152
71195
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
71153
71196
  };
71154
71197
  };
71155
- const { col: refCol, row: refRow } = this.getReferencePosition();
71198
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
71199
+ const { col: refCol, row: refRow } = refCell;
71156
71200
  // check if we can shrink selection
71157
71201
  let n = 0;
71158
71202
  while (result !== null) {
71159
71203
  n++;
71160
71204
  if (deltaCol < 0) {
71161
71205
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
71162
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
71206
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
71163
71207
  }
71164
71208
  if (deltaCol > 0) {
71165
71209
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
71166
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
71210
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
71167
71211
  }
71168
71212
  if (deltaRow < 0) {
71169
71213
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
71170
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
71214
+ result =
71215
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
71171
71216
  }
71172
71217
  if (deltaRow > 0) {
71173
71218
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
71174
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
71219
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
71175
71220
  }
71176
71221
  result = result ? reorderZone(result) : result;
71177
71222
  if (result && !isEqual(result, anchor.zone)) {
@@ -71401,18 +71446,26 @@ stores.inject(MyMetaStore, storeInstance);
71401
71446
  * If the anchor is hidden, browses from left to right and top to bottom to
71402
71447
  * find a visible cell.
71403
71448
  */
71404
- getReferencePosition() {
71449
+ getReferenceAnchor() {
71405
71450
  const sheetId = this.getters.getActiveSheetId();
71406
71451
  const anchor = this.anchor;
71407
71452
  const { left, right, top, bottom } = anchor.zone;
71408
71453
  const { col: anchorCol, row: anchorRow } = anchor.cell;
71454
+ const col = this.getters.isColHidden(sheetId, anchorCol)
71455
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
71456
+ : anchorCol;
71457
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
71458
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
71459
+ : anchorRow;
71460
+ const zone = this.getters.expandZone(sheetId, {
71461
+ left: col,
71462
+ right: col,
71463
+ top: row,
71464
+ bottom: row,
71465
+ });
71409
71466
  return {
71410
- col: this.getters.isColHidden(sheetId, anchorCol)
71411
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
71412
- : anchorCol,
71413
- row: this.getters.isRowHidden(sheetId, anchorRow)
71414
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
71415
- : anchorRow,
71467
+ cell: { col, row },
71468
+ zone,
71416
71469
  };
71417
71470
  }
71418
71471
  deltaToTarget(position, direction, step) {
@@ -74460,9 +74513,9 @@ stores.inject(MyMetaStore, storeInstance);
74460
74513
  exports.tokenize = tokenize;
74461
74514
 
74462
74515
 
74463
- __info__.version = "18.0.34";
74464
- __info__.date = "2025-06-19T18:26:11.726Z";
74465
- __info__.hash = "5526881";
74516
+ __info__.version = "18.0.36";
74517
+ __info__.date = "2025-06-27T09:11:51.920Z";
74518
+ __info__.hash = "b8dc998";
74466
74519
 
74467
74520
 
74468
74521
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);