@odoo/o-spreadsheet 18.1.26 → 18.1.28

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.1.26
6
- * @date 2025-06-19T18:21:37.648Z
7
- * @hash 06479d4
5
+ * @version 18.1.28
6
+ * @date 2025-06-27T09:12:45.644Z
7
+ * @hash 25dd087
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';
@@ -6816,6 +6816,63 @@ function parseOSClipboardContent(content) {
6816
6816
  data: spreadsheetContent,
6817
6817
  };
6818
6818
  }
6819
+ /**
6820
+ * Applies each clipboard handler to paste its corresponding data into the target.
6821
+ */
6822
+ const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
6823
+ handlers.forEach(({ handlerName, handler }) => {
6824
+ const data = copiedData[handlerName];
6825
+ if (data) {
6826
+ handler.paste(target, data, options);
6827
+ }
6828
+ });
6829
+ };
6830
+ /**
6831
+ * Returns the paste target based on clipboard handlers.
6832
+ * Also includes the full affected zone and the list of pasted zones for selection.
6833
+ */
6834
+ function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
6835
+ let zone = undefined;
6836
+ let selectedZones = [];
6837
+ let target = {
6838
+ sheetId,
6839
+ zones,
6840
+ };
6841
+ for (const { handlerName, handler } of handlers) {
6842
+ const handlerData = copiedData[handlerName];
6843
+ if (!handlerData) {
6844
+ continue;
6845
+ }
6846
+ const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
6847
+ if (currentTarget.figureId) {
6848
+ target.figureId = currentTarget.figureId;
6849
+ }
6850
+ for (const targetZone of currentTarget.zones) {
6851
+ selectedZones.push(targetZone);
6852
+ if (zone === undefined) {
6853
+ zone = targetZone;
6854
+ continue;
6855
+ }
6856
+ zone = union(zone, targetZone);
6857
+ }
6858
+ }
6859
+ return {
6860
+ target,
6861
+ zone,
6862
+ selectedZones,
6863
+ };
6864
+ }
6865
+ /**
6866
+ * Updates the selection after a paste operation.
6867
+ */
6868
+ const selectPastedZone = (selection, sourceZones, pastedZones) => {
6869
+ const anchorCell = {
6870
+ col: sourceZones[0].left,
6871
+ row: sourceZones[0].top,
6872
+ };
6873
+ selection.getBackToDefault();
6874
+ selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
6875
+ };
6819
6876
 
6820
6877
  class ClipboardHandler {
6821
6878
  getters;
@@ -20968,7 +21025,7 @@ class AbstractComposerStore extends SpreadsheetStore {
20968
21025
  }
20969
21026
  captureSelection(zone, col, row) {
20970
21027
  this.model.selection.capture(this, {
20971
- cell: { col: col || zone.left, row: row || zone.right },
21028
+ cell: { col: col ?? zone.left, row: row ?? zone.right },
20972
21029
  zone,
20973
21030
  }, {
20974
21031
  handleEvent: this.handleEvent.bind(this),
@@ -42740,6 +42797,9 @@ class ConditionalFormattingPanel extends Component {
42740
42797
  this.switchToList();
42741
42798
  }
42742
42799
  }
42800
+ else if (!this.editedCF) {
42801
+ this.switchToList();
42802
+ }
42743
42803
  });
42744
42804
  }
42745
42805
  get conditionalFormats() {
@@ -46763,7 +46823,7 @@ class SpreadsheetPivot {
46763
46823
  }
46764
46824
  getTypeFromZone(sheetId, zone) {
46765
46825
  const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
46766
- const nonEmptyCells = cells.filter((cell) => cell.type !== CellValueType.empty);
46826
+ const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
46767
46827
  if (nonEmptyCells.length === 0) {
46768
46828
  return "integer";
46769
46829
  }
@@ -50320,15 +50380,16 @@ class GridAddRowsFooter extends Component {
50320
50380
  }
50321
50381
  }
50322
50382
 
50383
+ const PAINT_FORMAT_HANDLER_KEYS = [
50384
+ "cell",
50385
+ "border",
50386
+ "table",
50387
+ "conditionalFormat",
50388
+ "merge",
50389
+ ];
50323
50390
  class PaintFormatStore extends SpreadsheetStore {
50324
50391
  mutators = ["activate", "cancel", "pasteFormat"];
50325
50392
  highlightStore = this.get(HighlightStore);
50326
- clipboardHandlers = [
50327
- new CellClipboardHandler(this.getters, this.model.dispatch),
50328
- new BorderClipboardHandler(this.getters, this.model.dispatch),
50329
- new TableClipboardHandler(this.getters, this.model.dispatch),
50330
- new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
50331
- ];
50332
50393
  status = "inactive";
50333
50394
  copiedData;
50334
50395
  constructor(get) {
@@ -50359,24 +50420,38 @@ class PaintFormatStore extends SpreadsheetStore {
50359
50420
  get isActive() {
50360
50421
  return this.status !== "inactive";
50361
50422
  }
50423
+ get clipboardHandlers() {
50424
+ return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
50425
+ const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
50426
+ return {
50427
+ handlerName,
50428
+ handler: new HandlerClass(this.getters, this.model.dispatch),
50429
+ };
50430
+ });
50431
+ }
50362
50432
  copyFormats() {
50363
50433
  const sheetId = this.getters.getActiveSheetId();
50364
50434
  const zones = this.getters.getSelectedZones();
50365
- const copiedData = {};
50366
- for (const handler of this.clipboardHandlers) {
50367
- Object.assign(copiedData, handler.copy(getClipboardDataPositions(sheetId, zones)));
50435
+ const copiedData = { zones, sheetId };
50436
+ for (const { handlerName, handler } of this.clipboardHandlers) {
50437
+ const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
50438
+ if (handlerResult !== undefined) {
50439
+ copiedData[handlerName] = handlerResult;
50440
+ }
50368
50441
  }
50369
50442
  return copiedData;
50370
50443
  }
50371
50444
  paintFormat(sheetId, target) {
50372
- if (this.copiedData) {
50373
- for (const handler of this.clipboardHandlers) {
50374
- handler.paste({ zones: target, sheetId }, this.copiedData, {
50375
- isCutOperation: false,
50376
- pasteOption: "onlyFormat",
50377
- });
50378
- }
50445
+ if (!this.copiedData) {
50446
+ return;
50379
50447
  }
50448
+ const options = {
50449
+ isCutOperation: false,
50450
+ pasteOption: "onlyFormat",
50451
+ };
50452
+ const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
50453
+ applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
50454
+ selectPastedZone(this.model.selection, target, selectedZones);
50380
50455
  if (this.status === "oneOff") {
50381
50456
  this.cancel();
50382
50457
  }
@@ -55542,7 +55617,7 @@ class DataValidationPlugin extends CorePlugin {
55542
55617
  else if (newRule.criterion.type === "isValueInList") {
55543
55618
  newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
55544
55619
  }
55545
- const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
55620
+ const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
55546
55621
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
55547
55622
  if (ruleIndex !== -1) {
55548
55623
  adaptedRules[ruleIndex] = newRule;
@@ -55552,9 +55627,12 @@ class DataValidationPlugin extends CorePlugin {
55552
55627
  this.history.update("rules", sheetId, [...adaptedRules, newRule]);
55553
55628
  }
55554
55629
  }
55555
- removeRangesFromRules(sheetId, ranges, rules) {
55630
+ removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
55556
55631
  rules = deepCopy(rules);
55557
55632
  for (const rule of rules) {
55633
+ if (rule.id === editingRuleId) {
55634
+ continue; // Skip the rule being edited to preserve its place in the list
55635
+ }
55558
55636
  rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
55559
55637
  }
55560
55638
  return rules.filter((rule) => rule.ranges.length > 0);
@@ -67288,49 +67366,17 @@ class ClipboardPlugin extends UIPlugin {
67288
67366
  if (!copiedData) {
67289
67367
  return;
67290
67368
  }
67291
- let zone = undefined;
67292
- let selectedZones = [];
67293
67369
  const sheetId = this.getters.getActiveSheetId();
67294
- let target = {
67295
- sheetId,
67296
- zones,
67297
- };
67298
67370
  const handlers = this.selectClipboardHandlers(copiedData);
67299
- for (const { handlerName, handler } of handlers) {
67300
- const handlerData = copiedData[handlerName];
67301
- if (!handlerData) {
67302
- continue;
67303
- }
67304
- const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
67305
- if (currentTarget.figureId) {
67306
- target.figureId = currentTarget.figureId;
67307
- }
67308
- for (const targetZone of currentTarget.zones) {
67309
- selectedZones.push(targetZone);
67310
- if (zone === undefined) {
67311
- zone = targetZone;
67312
- continue;
67313
- }
67314
- zone = union(zone, targetZone);
67315
- }
67316
- }
67371
+ const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
67317
67372
  if (zone !== undefined) {
67318
- this.addMissingDimensions(this.getters.getActiveSheetId(), zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
67373
+ this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
67319
67374
  }
67320
- handlers.forEach(({ handlerName, handler }) => {
67321
- const handlerData = copiedData[handlerName];
67322
- if (handlerData) {
67323
- handler.paste(target, handlerData, options);
67324
- }
67325
- });
67375
+ applyClipboardHandlersPaste(handlers, copiedData, target, options);
67326
67376
  if (!options?.selectTarget) {
67327
67377
  return;
67328
67378
  }
67329
- const selection = zones[0];
67330
- const col = selection.left;
67331
- const row = selection.top;
67332
- this.selection.getBackToDefault();
67333
- this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
67379
+ selectPastedZone(this.selection, zones, selectedZones);
67334
67380
  }
67335
67381
  /**
67336
67382
  * Add columns and/or rows to ensure that col + width and row + height are still
@@ -73202,26 +73248,28 @@ class SelectionStreamProcessorImpl {
73202
73248
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
73203
73249
  };
73204
73250
  };
73205
- const { col: refCol, row: refRow } = this.getReferencePosition();
73251
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
73252
+ const { col: refCol, row: refRow } = refCell;
73206
73253
  // check if we can shrink selection
73207
73254
  let n = 0;
73208
73255
  while (result !== null) {
73209
73256
  n++;
73210
73257
  if (deltaCol < 0) {
73211
73258
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
73212
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
73259
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
73213
73260
  }
73214
73261
  if (deltaCol > 0) {
73215
73262
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
73216
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
73263
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
73217
73264
  }
73218
73265
  if (deltaRow < 0) {
73219
73266
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
73220
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
73267
+ result =
73268
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
73221
73269
  }
73222
73270
  if (deltaRow > 0) {
73223
73271
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
73224
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
73272
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
73225
73273
  }
73226
73274
  result = result ? reorderZone(result) : result;
73227
73275
  if (result && !isEqual(result, anchor.zone)) {
@@ -73451,18 +73499,26 @@ class SelectionStreamProcessorImpl {
73451
73499
  * If the anchor is hidden, browses from left to right and top to bottom to
73452
73500
  * find a visible cell.
73453
73501
  */
73454
- getReferencePosition() {
73502
+ getReferenceAnchor() {
73455
73503
  const sheetId = this.getters.getActiveSheetId();
73456
73504
  const anchor = this.anchor;
73457
73505
  const { left, right, top, bottom } = anchor.zone;
73458
73506
  const { col: anchorCol, row: anchorRow } = anchor.cell;
73507
+ const col = this.getters.isColHidden(sheetId, anchorCol)
73508
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
73509
+ : anchorCol;
73510
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
73511
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
73512
+ : anchorRow;
73513
+ const zone = this.getters.expandZone(sheetId, {
73514
+ left: col,
73515
+ right: col,
73516
+ top: row,
73517
+ bottom: row,
73518
+ });
73459
73519
  return {
73460
- col: this.getters.isColHidden(sheetId, anchorCol)
73461
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
73462
- : anchorCol,
73463
- row: this.getters.isRowHidden(sheetId, anchorRow)
73464
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
73465
- : anchorRow,
73520
+ cell: { col, row },
73521
+ zone,
73466
73522
  };
73467
73523
  }
73468
73524
  deltaToTarget(position, direction, step) {
@@ -76528,6 +76584,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
76528
76584
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, 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 };
76529
76585
 
76530
76586
 
76531
- __info__.version = "18.1.26";
76532
- __info__.date = "2025-06-19T18:21:37.648Z";
76533
- __info__.hash = "06479d4";
76587
+ __info__.version = "18.1.28";
76588
+ __info__.date = "2025-06-27T09:12:45.644Z";
76589
+ __info__.hash = "25dd087";
@@ -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.1.26
6
- * @date 2025-06-19T18:21:37.648Z
7
- * @hash 06479d4
5
+ * @version 18.1.28
6
+ * @date 2025-06-27T09:12:45.644Z
7
+ * @hash 25dd087
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6817,6 +6817,63 @@
6817
6817
  data: spreadsheetContent,
6818
6818
  };
6819
6819
  }
6820
+ /**
6821
+ * Applies each clipboard handler to paste its corresponding data into the target.
6822
+ */
6823
+ const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
6824
+ handlers.forEach(({ handlerName, handler }) => {
6825
+ const data = copiedData[handlerName];
6826
+ if (data) {
6827
+ handler.paste(target, data, options);
6828
+ }
6829
+ });
6830
+ };
6831
+ /**
6832
+ * Returns the paste target based on clipboard handlers.
6833
+ * Also includes the full affected zone and the list of pasted zones for selection.
6834
+ */
6835
+ function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
6836
+ let zone = undefined;
6837
+ let selectedZones = [];
6838
+ let target = {
6839
+ sheetId,
6840
+ zones,
6841
+ };
6842
+ for (const { handlerName, handler } of handlers) {
6843
+ const handlerData = copiedData[handlerName];
6844
+ if (!handlerData) {
6845
+ continue;
6846
+ }
6847
+ const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
6848
+ if (currentTarget.figureId) {
6849
+ target.figureId = currentTarget.figureId;
6850
+ }
6851
+ for (const targetZone of currentTarget.zones) {
6852
+ selectedZones.push(targetZone);
6853
+ if (zone === undefined) {
6854
+ zone = targetZone;
6855
+ continue;
6856
+ }
6857
+ zone = union(zone, targetZone);
6858
+ }
6859
+ }
6860
+ return {
6861
+ target,
6862
+ zone,
6863
+ selectedZones,
6864
+ };
6865
+ }
6866
+ /**
6867
+ * Updates the selection after a paste operation.
6868
+ */
6869
+ const selectPastedZone = (selection, sourceZones, pastedZones) => {
6870
+ const anchorCell = {
6871
+ col: sourceZones[0].left,
6872
+ row: sourceZones[0].top,
6873
+ };
6874
+ selection.getBackToDefault();
6875
+ selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
6876
+ };
6820
6877
 
6821
6878
  class ClipboardHandler {
6822
6879
  getters;
@@ -20969,7 +21026,7 @@ stores.inject(MyMetaStore, storeInstance);
20969
21026
  }
20970
21027
  captureSelection(zone, col, row) {
20971
21028
  this.model.selection.capture(this, {
20972
- cell: { col: col || zone.left, row: row || zone.right },
21029
+ cell: { col: col ?? zone.left, row: row ?? zone.right },
20973
21030
  zone,
20974
21031
  }, {
20975
21032
  handleEvent: this.handleEvent.bind(this),
@@ -42741,6 +42798,9 @@ stores.inject(MyMetaStore, storeInstance);
42741
42798
  this.switchToList();
42742
42799
  }
42743
42800
  }
42801
+ else if (!this.editedCF) {
42802
+ this.switchToList();
42803
+ }
42744
42804
  });
42745
42805
  }
42746
42806
  get conditionalFormats() {
@@ -46764,7 +46824,7 @@ stores.inject(MyMetaStore, storeInstance);
46764
46824
  }
46765
46825
  getTypeFromZone(sheetId, zone) {
46766
46826
  const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
46767
- const nonEmptyCells = cells.filter((cell) => cell.type !== CellValueType.empty);
46827
+ const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
46768
46828
  if (nonEmptyCells.length === 0) {
46769
46829
  return "integer";
46770
46830
  }
@@ -50321,15 +50381,16 @@ stores.inject(MyMetaStore, storeInstance);
50321
50381
  }
50322
50382
  }
50323
50383
 
50384
+ const PAINT_FORMAT_HANDLER_KEYS = [
50385
+ "cell",
50386
+ "border",
50387
+ "table",
50388
+ "conditionalFormat",
50389
+ "merge",
50390
+ ];
50324
50391
  class PaintFormatStore extends SpreadsheetStore {
50325
50392
  mutators = ["activate", "cancel", "pasteFormat"];
50326
50393
  highlightStore = this.get(HighlightStore);
50327
- clipboardHandlers = [
50328
- new CellClipboardHandler(this.getters, this.model.dispatch),
50329
- new BorderClipboardHandler(this.getters, this.model.dispatch),
50330
- new TableClipboardHandler(this.getters, this.model.dispatch),
50331
- new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
50332
- ];
50333
50394
  status = "inactive";
50334
50395
  copiedData;
50335
50396
  constructor(get) {
@@ -50360,24 +50421,38 @@ stores.inject(MyMetaStore, storeInstance);
50360
50421
  get isActive() {
50361
50422
  return this.status !== "inactive";
50362
50423
  }
50424
+ get clipboardHandlers() {
50425
+ return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
50426
+ const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
50427
+ return {
50428
+ handlerName,
50429
+ handler: new HandlerClass(this.getters, this.model.dispatch),
50430
+ };
50431
+ });
50432
+ }
50363
50433
  copyFormats() {
50364
50434
  const sheetId = this.getters.getActiveSheetId();
50365
50435
  const zones = this.getters.getSelectedZones();
50366
- const copiedData = {};
50367
- for (const handler of this.clipboardHandlers) {
50368
- Object.assign(copiedData, handler.copy(getClipboardDataPositions(sheetId, zones)));
50436
+ const copiedData = { zones, sheetId };
50437
+ for (const { handlerName, handler } of this.clipboardHandlers) {
50438
+ const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
50439
+ if (handlerResult !== undefined) {
50440
+ copiedData[handlerName] = handlerResult;
50441
+ }
50369
50442
  }
50370
50443
  return copiedData;
50371
50444
  }
50372
50445
  paintFormat(sheetId, target) {
50373
- if (this.copiedData) {
50374
- for (const handler of this.clipboardHandlers) {
50375
- handler.paste({ zones: target, sheetId }, this.copiedData, {
50376
- isCutOperation: false,
50377
- pasteOption: "onlyFormat",
50378
- });
50379
- }
50446
+ if (!this.copiedData) {
50447
+ return;
50380
50448
  }
50449
+ const options = {
50450
+ isCutOperation: false,
50451
+ pasteOption: "onlyFormat",
50452
+ };
50453
+ const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
50454
+ applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
50455
+ selectPastedZone(this.model.selection, target, selectedZones);
50381
50456
  if (this.status === "oneOff") {
50382
50457
  this.cancel();
50383
50458
  }
@@ -55543,7 +55618,7 @@ stores.inject(MyMetaStore, storeInstance);
55543
55618
  else if (newRule.criterion.type === "isValueInList") {
55544
55619
  newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
55545
55620
  }
55546
- const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
55621
+ const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
55547
55622
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
55548
55623
  if (ruleIndex !== -1) {
55549
55624
  adaptedRules[ruleIndex] = newRule;
@@ -55553,9 +55628,12 @@ stores.inject(MyMetaStore, storeInstance);
55553
55628
  this.history.update("rules", sheetId, [...adaptedRules, newRule]);
55554
55629
  }
55555
55630
  }
55556
- removeRangesFromRules(sheetId, ranges, rules) {
55631
+ removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
55557
55632
  rules = deepCopy(rules);
55558
55633
  for (const rule of rules) {
55634
+ if (rule.id === editingRuleId) {
55635
+ continue; // Skip the rule being edited to preserve its place in the list
55636
+ }
55559
55637
  rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
55560
55638
  }
55561
55639
  return rules.filter((rule) => rule.ranges.length > 0);
@@ -67289,49 +67367,17 @@ stores.inject(MyMetaStore, storeInstance);
67289
67367
  if (!copiedData) {
67290
67368
  return;
67291
67369
  }
67292
- let zone = undefined;
67293
- let selectedZones = [];
67294
67370
  const sheetId = this.getters.getActiveSheetId();
67295
- let target = {
67296
- sheetId,
67297
- zones,
67298
- };
67299
67371
  const handlers = this.selectClipboardHandlers(copiedData);
67300
- for (const { handlerName, handler } of handlers) {
67301
- const handlerData = copiedData[handlerName];
67302
- if (!handlerData) {
67303
- continue;
67304
- }
67305
- const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
67306
- if (currentTarget.figureId) {
67307
- target.figureId = currentTarget.figureId;
67308
- }
67309
- for (const targetZone of currentTarget.zones) {
67310
- selectedZones.push(targetZone);
67311
- if (zone === undefined) {
67312
- zone = targetZone;
67313
- continue;
67314
- }
67315
- zone = union(zone, targetZone);
67316
- }
67317
- }
67372
+ const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
67318
67373
  if (zone !== undefined) {
67319
- this.addMissingDimensions(this.getters.getActiveSheetId(), zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
67374
+ this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
67320
67375
  }
67321
- handlers.forEach(({ handlerName, handler }) => {
67322
- const handlerData = copiedData[handlerName];
67323
- if (handlerData) {
67324
- handler.paste(target, handlerData, options);
67325
- }
67326
- });
67376
+ applyClipboardHandlersPaste(handlers, copiedData, target, options);
67327
67377
  if (!options?.selectTarget) {
67328
67378
  return;
67329
67379
  }
67330
- const selection = zones[0];
67331
- const col = selection.left;
67332
- const row = selection.top;
67333
- this.selection.getBackToDefault();
67334
- this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
67380
+ selectPastedZone(this.selection, zones, selectedZones);
67335
67381
  }
67336
67382
  /**
67337
67383
  * Add columns and/or rows to ensure that col + width and row + height are still
@@ -73203,26 +73249,28 @@ stores.inject(MyMetaStore, storeInstance);
73203
73249
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
73204
73250
  };
73205
73251
  };
73206
- const { col: refCol, row: refRow } = this.getReferencePosition();
73252
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
73253
+ const { col: refCol, row: refRow } = refCell;
73207
73254
  // check if we can shrink selection
73208
73255
  let n = 0;
73209
73256
  while (result !== null) {
73210
73257
  n++;
73211
73258
  if (deltaCol < 0) {
73212
73259
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
73213
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
73260
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
73214
73261
  }
73215
73262
  if (deltaCol > 0) {
73216
73263
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
73217
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
73264
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
73218
73265
  }
73219
73266
  if (deltaRow < 0) {
73220
73267
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
73221
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
73268
+ result =
73269
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
73222
73270
  }
73223
73271
  if (deltaRow > 0) {
73224
73272
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
73225
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
73273
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
73226
73274
  }
73227
73275
  result = result ? reorderZone(result) : result;
73228
73276
  if (result && !isEqual(result, anchor.zone)) {
@@ -73452,18 +73500,26 @@ stores.inject(MyMetaStore, storeInstance);
73452
73500
  * If the anchor is hidden, browses from left to right and top to bottom to
73453
73501
  * find a visible cell.
73454
73502
  */
73455
- getReferencePosition() {
73503
+ getReferenceAnchor() {
73456
73504
  const sheetId = this.getters.getActiveSheetId();
73457
73505
  const anchor = this.anchor;
73458
73506
  const { left, right, top, bottom } = anchor.zone;
73459
73507
  const { col: anchorCol, row: anchorRow } = anchor.cell;
73508
+ const col = this.getters.isColHidden(sheetId, anchorCol)
73509
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
73510
+ : anchorCol;
73511
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
73512
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
73513
+ : anchorRow;
73514
+ const zone = this.getters.expandZone(sheetId, {
73515
+ left: col,
73516
+ right: col,
73517
+ top: row,
73518
+ bottom: row,
73519
+ });
73460
73520
  return {
73461
- col: this.getters.isColHidden(sheetId, anchorCol)
73462
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
73463
- : anchorCol,
73464
- row: this.getters.isRowHidden(sheetId, anchorRow)
73465
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
73466
- : anchorRow,
73521
+ cell: { col, row },
73522
+ zone,
73467
73523
  };
73468
73524
  }
73469
73525
  deltaToTarget(position, direction, step) {
@@ -76573,9 +76629,9 @@ stores.inject(MyMetaStore, storeInstance);
76573
76629
  exports.tokenize = tokenize;
76574
76630
 
76575
76631
 
76576
- __info__.version = "18.1.26";
76577
- __info__.date = "2025-06-19T18:21:37.648Z";
76578
- __info__.hash = "06479d4";
76632
+ __info__.version = "18.1.28";
76633
+ __info__.date = "2025-06-27T09:12:45.644Z";
76634
+ __info__.hash = "25dd087";
76579
76635
 
76580
76636
 
76581
76637
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);