@odoo/o-spreadsheet 18.0.22 → 18.0.24
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.
- package/dist/o-spreadsheet.cjs.js +244 -120
- package/dist/o-spreadsheet.d.ts +33 -16
- package/dist/o-spreadsheet.esm.js +244 -120
- package/dist/o-spreadsheet.iife.js +244 -120
- package/dist/o-spreadsheet.iife.min.js +351 -351
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -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.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.24
|
|
6
|
+
* @date 2025-04-18T16:23:09.320Z
|
|
7
|
+
* @hash aa18758
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -3397,6 +3397,7 @@ const coreTypes = new Set([
|
|
|
3397
3397
|
"CLEAR_FORMATTING",
|
|
3398
3398
|
"SET_BORDER",
|
|
3399
3399
|
"SET_ZONE_BORDERS",
|
|
3400
|
+
"SET_BORDERS_ON_TARGET",
|
|
3400
3401
|
/** CHART */
|
|
3401
3402
|
"CREATE_CHART",
|
|
3402
3403
|
"UPDATE_CHART",
|
|
@@ -6560,6 +6561,7 @@ class AbstractCellClipboardHandler extends ClipboardHandler {
|
|
|
6560
6561
|
}
|
|
6561
6562
|
|
|
6562
6563
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6564
|
+
queuedBordersToAdd = {};
|
|
6563
6565
|
copy(data) {
|
|
6564
6566
|
const sheetId = data.sheetId;
|
|
6565
6567
|
if (data.zones.length === 0) {
|
|
@@ -6590,6 +6592,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6590
6592
|
const { left, top } = zones[0];
|
|
6591
6593
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6592
6594
|
}
|
|
6595
|
+
this.executeQueuedChanges(sheetId);
|
|
6593
6596
|
}
|
|
6594
6597
|
pasteZone(sheetId, col, row, borders) {
|
|
6595
6598
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6608,7 +6611,20 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6608
6611
|
...targetBorders,
|
|
6609
6612
|
...originBorders,
|
|
6610
6613
|
};
|
|
6611
|
-
|
|
6614
|
+
const borderKey = JSON.stringify(border);
|
|
6615
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6616
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6617
|
+
}
|
|
6618
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6619
|
+
}
|
|
6620
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6621
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6622
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6623
|
+
const border = JSON.parse(borderKey);
|
|
6624
|
+
const target = recomputeZones(zones, []);
|
|
6625
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6626
|
+
}
|
|
6627
|
+
this.queuedBordersToAdd = {};
|
|
6612
6628
|
}
|
|
6613
6629
|
}
|
|
6614
6630
|
|
|
@@ -6720,6 +6736,12 @@ function tokenizeString(chars) {
|
|
|
6720
6736
|
}
|
|
6721
6737
|
return null;
|
|
6722
6738
|
}
|
|
6739
|
+
/**
|
|
6740
|
+
- \p{L} is for any letter (from any language)
|
|
6741
|
+
- \p{N} is for any number
|
|
6742
|
+
- the u flag at the end is for unicode, which enables the `\p{...}` syntax
|
|
6743
|
+
*/
|
|
6744
|
+
const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
|
|
6723
6745
|
const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
|
|
6724
6746
|
/**
|
|
6725
6747
|
* A "Symbol" is just basically any word-like element that can appear in a
|
|
@@ -6760,7 +6782,8 @@ function tokenizeSymbol(chars) {
|
|
|
6760
6782
|
};
|
|
6761
6783
|
}
|
|
6762
6784
|
}
|
|
6763
|
-
while (chars.current &&
|
|
6785
|
+
while (chars.current &&
|
|
6786
|
+
(SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
|
|
6764
6787
|
result += chars.shift();
|
|
6765
6788
|
}
|
|
6766
6789
|
if (result.length) {
|
|
@@ -8500,12 +8523,13 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8500
8523
|
}
|
|
8501
8524
|
pasteCf(origin, target, isCutOperation) {
|
|
8502
8525
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8526
|
+
const originZone = positionToZone(origin.position);
|
|
8503
8527
|
const zone = positionToZone(target);
|
|
8504
8528
|
for (const rule of origin.rules) {
|
|
8505
8529
|
const toRemoveZones = [];
|
|
8506
8530
|
if (isCutOperation) {
|
|
8507
8531
|
//remove from current rule
|
|
8508
|
-
toRemoveZones.push(
|
|
8532
|
+
toRemoveZones.push(originZone);
|
|
8509
8533
|
}
|
|
8510
8534
|
if (origin.position.sheetId === target.sheetId) {
|
|
8511
8535
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8619,6 +8643,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8619
8643
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8620
8644
|
if (origin) {
|
|
8621
8645
|
const zone = positionToZone(target);
|
|
8646
|
+
const originZone = positionToZone(origin.position);
|
|
8622
8647
|
const rule = origin.rule;
|
|
8623
8648
|
if (!rule) {
|
|
8624
8649
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8630,7 +8655,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8630
8655
|
}
|
|
8631
8656
|
const toRemoveZone = [];
|
|
8632
8657
|
if (isCutOperation) {
|
|
8633
|
-
toRemoveZone.push(
|
|
8658
|
+
toRemoveZone.push(originZone);
|
|
8634
8659
|
}
|
|
8635
8660
|
if (origin.position.sheetId === target.sheetId) {
|
|
8636
8661
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8690,7 +8715,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8690
8715
|
continue;
|
|
8691
8716
|
}
|
|
8692
8717
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8693
|
-
rule: dv,
|
|
8718
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8694
8719
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8695
8720
|
sheetId,
|
|
8696
8721
|
});
|
|
@@ -9021,7 +9046,7 @@ function transformZone(zone, executed) {
|
|
|
9021
9046
|
if (executed.type === "ADD_COLUMNS_ROWS") {
|
|
9022
9047
|
return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
|
|
9023
9048
|
}
|
|
9024
|
-
return
|
|
9049
|
+
return zone;
|
|
9025
9050
|
}
|
|
9026
9051
|
function transformRangeData(range, executed) {
|
|
9027
9052
|
const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
|
|
@@ -47992,39 +48017,6 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
47992
48017
|
}
|
|
47993
48018
|
return hoveredPosition;
|
|
47994
48019
|
}
|
|
47995
|
-
function useTouchMove(gridRef, handler, canMoveUp) {
|
|
47996
|
-
let x = null;
|
|
47997
|
-
let y = null;
|
|
47998
|
-
function onTouchStart(ev) {
|
|
47999
|
-
if (ev.touches.length !== 1)
|
|
48000
|
-
return;
|
|
48001
|
-
x = ev.touches[0].clientX;
|
|
48002
|
-
y = ev.touches[0].clientY;
|
|
48003
|
-
}
|
|
48004
|
-
function onTouchEnd() {
|
|
48005
|
-
x = null;
|
|
48006
|
-
y = null;
|
|
48007
|
-
}
|
|
48008
|
-
function onTouchMove(ev) {
|
|
48009
|
-
if (ev.touches.length !== 1)
|
|
48010
|
-
return;
|
|
48011
|
-
// On mobile browsers, swiping down is often associated with "pull to refresh".
|
|
48012
|
-
// We only want this behavior if the grid is already at the top.
|
|
48013
|
-
// Otherwise we only want to move the canvas up, without triggering any refresh.
|
|
48014
|
-
if (canMoveUp()) {
|
|
48015
|
-
ev.preventDefault();
|
|
48016
|
-
ev.stopPropagation();
|
|
48017
|
-
}
|
|
48018
|
-
const currentX = ev.touches[0].clientX;
|
|
48019
|
-
const currentY = ev.touches[0].clientY;
|
|
48020
|
-
handler(x - currentX, y - currentY);
|
|
48021
|
-
x = currentX;
|
|
48022
|
-
y = currentY;
|
|
48023
|
-
}
|
|
48024
|
-
useRefListener(gridRef, "touchstart", onTouchStart);
|
|
48025
|
-
useRefListener(gridRef, "touchend", onTouchEnd);
|
|
48026
|
-
useRefListener(gridRef, "touchmove", onTouchMove);
|
|
48027
|
-
}
|
|
48028
48020
|
class GridOverlay extends owl.Component {
|
|
48029
48021
|
static template = "o-spreadsheet-GridOverlay";
|
|
48030
48022
|
static props = {
|
|
@@ -48072,10 +48064,6 @@ class GridOverlay extends owl.Component {
|
|
|
48072
48064
|
owl.onWillUnmount(() => {
|
|
48073
48065
|
resizeObserver.disconnect();
|
|
48074
48066
|
});
|
|
48075
|
-
useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
|
|
48076
|
-
const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
48077
|
-
return scrollY > 0;
|
|
48078
|
-
});
|
|
48079
48067
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
48080
48068
|
this.paintFormatStore = useStore(PaintFormatStore);
|
|
48081
48069
|
}
|
|
@@ -49424,6 +49412,73 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
49424
49412
|
}
|
|
49425
49413
|
}
|
|
49426
49414
|
|
|
49415
|
+
const friction = 0.95;
|
|
49416
|
+
const verticalScrollFactor = 1;
|
|
49417
|
+
const horizontalScrollFactor = 1;
|
|
49418
|
+
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
49419
|
+
let lastX = 0;
|
|
49420
|
+
let lastY = 0;
|
|
49421
|
+
let velocityX = 0;
|
|
49422
|
+
let velocityY = 0;
|
|
49423
|
+
let isMouseDown = false;
|
|
49424
|
+
let lastTime = 0;
|
|
49425
|
+
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
49426
|
+
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
49427
|
+
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
49428
|
+
function onTouchStart(event) {
|
|
49429
|
+
isMouseDown = true;
|
|
49430
|
+
({ clientX: lastX, clientY: lastY } = event.touches[0]);
|
|
49431
|
+
velocityX = 0;
|
|
49432
|
+
velocityY = 0;
|
|
49433
|
+
}
|
|
49434
|
+
function onTouchMove(event) {
|
|
49435
|
+
if (!isMouseDown)
|
|
49436
|
+
return;
|
|
49437
|
+
const currentTime = Date.now();
|
|
49438
|
+
const { clientX, clientY } = event.touches[0];
|
|
49439
|
+
let deltaX = lastX - clientX;
|
|
49440
|
+
let deltaY = lastY - clientY;
|
|
49441
|
+
const elapsedTime = currentTime - lastTime;
|
|
49442
|
+
velocityX = deltaX / elapsedTime;
|
|
49443
|
+
velocityY = deltaY / elapsedTime;
|
|
49444
|
+
lastX = clientX;
|
|
49445
|
+
lastY = clientY;
|
|
49446
|
+
lastTime = currentTime;
|
|
49447
|
+
if (canMoveUp()) {
|
|
49448
|
+
if (event.cancelable) {
|
|
49449
|
+
event.preventDefault();
|
|
49450
|
+
}
|
|
49451
|
+
event.stopPropagation();
|
|
49452
|
+
}
|
|
49453
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
49454
|
+
}
|
|
49455
|
+
function onTouchEnd(ev) {
|
|
49456
|
+
isMouseDown = false;
|
|
49457
|
+
lastX = lastY = 0;
|
|
49458
|
+
requestAnimationFrame(scroll);
|
|
49459
|
+
}
|
|
49460
|
+
function scroll() {
|
|
49461
|
+
if (Math.abs(velocityX) < 0.05) {
|
|
49462
|
+
velocityX = 0;
|
|
49463
|
+
}
|
|
49464
|
+
if (Math.abs(velocityY) < 0.05) {
|
|
49465
|
+
velocityY = 0;
|
|
49466
|
+
}
|
|
49467
|
+
if (!velocityX && !velocityY) {
|
|
49468
|
+
return;
|
|
49469
|
+
}
|
|
49470
|
+
const currentTime = Date.now();
|
|
49471
|
+
const elapsedTime = Math.abs(currentTime - lastTime);
|
|
49472
|
+
const deltaX = velocityX * elapsedTime;
|
|
49473
|
+
const deltaY = velocityY * elapsedTime;
|
|
49474
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
49475
|
+
lastTime = currentTime;
|
|
49476
|
+
velocityX *= friction;
|
|
49477
|
+
velocityY *= friction;
|
|
49478
|
+
requestAnimationFrame(scroll);
|
|
49479
|
+
}
|
|
49480
|
+
}
|
|
49481
|
+
|
|
49427
49482
|
function useWheelHandler(handler) {
|
|
49428
49483
|
function normalize(val, deltaMode) {
|
|
49429
49484
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
@@ -50044,6 +50099,10 @@ class Grid extends owl.Component {
|
|
|
50044
50099
|
this.DOMFocusableElementStore.focusableElement?.focus();
|
|
50045
50100
|
}
|
|
50046
50101
|
}, () => [this.sidePanel.isOpen]);
|
|
50102
|
+
useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
|
|
50103
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
50104
|
+
return scrollY > 0;
|
|
50105
|
+
});
|
|
50047
50106
|
}
|
|
50048
50107
|
onCellHovered({ col, row }) {
|
|
50049
50108
|
this.hoveredCell.hover({ col, row });
|
|
@@ -50791,6 +50850,15 @@ class BordersPlugin extends CorePlugin {
|
|
|
50791
50850
|
case "SET_BORDER":
|
|
50792
50851
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
50793
50852
|
break;
|
|
50853
|
+
case "SET_BORDERS_ON_TARGET":
|
|
50854
|
+
for (const zone of cmd.target) {
|
|
50855
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50856
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
50857
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
50858
|
+
}
|
|
50859
|
+
}
|
|
50860
|
+
}
|
|
50861
|
+
break;
|
|
50794
50862
|
case "SET_ZONE_BORDERS":
|
|
50795
50863
|
if (cmd.border) {
|
|
50796
50864
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -60609,25 +60677,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60609
60677
|
case "AUTOFILL_AUTO":
|
|
60610
60678
|
this.autofillAuto();
|
|
60611
60679
|
break;
|
|
60612
|
-
case "AUTOFILL_CELL":
|
|
60613
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60614
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60615
|
-
this.dispatch("UPDATE_CELL", {
|
|
60616
|
-
sheetId,
|
|
60617
|
-
col: cmd.col,
|
|
60618
|
-
row: cmd.row,
|
|
60619
|
-
style: cmd.style || null,
|
|
60620
|
-
content: cmd.content || "",
|
|
60621
|
-
format: cmd.format || "",
|
|
60622
|
-
});
|
|
60623
|
-
this.dispatch("SET_BORDER", {
|
|
60624
|
-
sheetId,
|
|
60625
|
-
col: cmd.col,
|
|
60626
|
-
row: cmd.row,
|
|
60627
|
-
border: cmd.border,
|
|
60628
|
-
});
|
|
60629
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60630
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60631
60680
|
}
|
|
60632
60681
|
}
|
|
60633
60682
|
// ---------------------------------------------------------------------------
|
|
@@ -60651,6 +60700,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60651
60700
|
}
|
|
60652
60701
|
const source = this.getters.getSelectedZone();
|
|
60653
60702
|
const target = this.autofillZone;
|
|
60703
|
+
const autofillCellsData = [];
|
|
60654
60704
|
switch (this.direction) {
|
|
60655
60705
|
case "down" /* DIRECTION.DOWN */:
|
|
60656
60706
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -60660,7 +60710,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60660
60710
|
}
|
|
60661
60711
|
const generator = this.createGenerator(xcs);
|
|
60662
60712
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
60663
|
-
this.computeNewCell(generator, col, row
|
|
60713
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60664
60714
|
}
|
|
60665
60715
|
}
|
|
60666
60716
|
break;
|
|
@@ -60672,7 +60722,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60672
60722
|
}
|
|
60673
60723
|
const generator = this.createGenerator(xcs);
|
|
60674
60724
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
60675
|
-
this.computeNewCell(generator, col, row
|
|
60725
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60676
60726
|
}
|
|
60677
60727
|
}
|
|
60678
60728
|
break;
|
|
@@ -60684,7 +60734,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60684
60734
|
}
|
|
60685
60735
|
const generator = this.createGenerator(xcs);
|
|
60686
60736
|
for (let col = target.right; col >= target.left; col--) {
|
|
60687
|
-
this.computeNewCell(generator, col, row
|
|
60737
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60688
60738
|
}
|
|
60689
60739
|
}
|
|
60690
60740
|
break;
|
|
@@ -60696,12 +60746,26 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60696
60746
|
}
|
|
60697
60747
|
const generator = this.createGenerator(xcs);
|
|
60698
60748
|
for (let col = target.left; col <= target.right; col++) {
|
|
60699
|
-
this.computeNewCell(generator, col, row
|
|
60749
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60700
60750
|
}
|
|
60701
60751
|
}
|
|
60702
60752
|
break;
|
|
60703
60753
|
}
|
|
60704
60754
|
if (apply) {
|
|
60755
|
+
const bordersZones = {};
|
|
60756
|
+
const cfNewRanges = {};
|
|
60757
|
+
const dvNewZones = {};
|
|
60758
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
60759
|
+
for (const data of autofillCellsData) {
|
|
60760
|
+
this.collectBordersData(data, bordersZones);
|
|
60761
|
+
this.autofillMerge(sheetId, data);
|
|
60762
|
+
this.autofillCell(sheetId, data);
|
|
60763
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
60764
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
60765
|
+
}
|
|
60766
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
60767
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
60768
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
60705
60769
|
this.autofillZone = undefined;
|
|
60706
60770
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
60707
60771
|
this.lastCellSelected = {};
|
|
@@ -60710,6 +60774,95 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60710
60774
|
this.tooltip = undefined;
|
|
60711
60775
|
}
|
|
60712
60776
|
}
|
|
60777
|
+
collectBordersData(data, bordersPositions) {
|
|
60778
|
+
const key = JSON.stringify(data.border);
|
|
60779
|
+
if (!(key in bordersPositions)) {
|
|
60780
|
+
bordersPositions[key] = [];
|
|
60781
|
+
}
|
|
60782
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
60783
|
+
}
|
|
60784
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
60785
|
+
const { originCol, originRow, col, row } = data;
|
|
60786
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60787
|
+
const xc = toXC(col, row);
|
|
60788
|
+
for (const cf of cfsAtOrigin) {
|
|
60789
|
+
if (!(cf.id in cfNewRanges)) {
|
|
60790
|
+
cfNewRanges[cf.id] = [];
|
|
60791
|
+
}
|
|
60792
|
+
cfNewRanges[cf.id].push(xc);
|
|
60793
|
+
}
|
|
60794
|
+
}
|
|
60795
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
60796
|
+
const { originCol, originRow, col, row } = data;
|
|
60797
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60798
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60799
|
+
if (!dvsAtOrigin) {
|
|
60800
|
+
return;
|
|
60801
|
+
}
|
|
60802
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
60803
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
60804
|
+
}
|
|
60805
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
60806
|
+
}
|
|
60807
|
+
autofillCell(sheetId, data) {
|
|
60808
|
+
this.dispatch("UPDATE_CELL", {
|
|
60809
|
+
sheetId,
|
|
60810
|
+
col: data.col,
|
|
60811
|
+
row: data.row,
|
|
60812
|
+
content: data.content || "",
|
|
60813
|
+
style: data.style || null,
|
|
60814
|
+
format: data.format || "",
|
|
60815
|
+
});
|
|
60816
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
60817
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
60818
|
+
}
|
|
60819
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
60820
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
60821
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
60822
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
60823
|
+
sheetId,
|
|
60824
|
+
border,
|
|
60825
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
60826
|
+
});
|
|
60827
|
+
}
|
|
60828
|
+
}
|
|
60829
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
60830
|
+
for (const cfId in cfNewRanges) {
|
|
60831
|
+
const changes = cfNewRanges[cfId];
|
|
60832
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
60833
|
+
if (!cf) {
|
|
60834
|
+
continue;
|
|
60835
|
+
}
|
|
60836
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
60837
|
+
if (newCfRanges) {
|
|
60838
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60839
|
+
cf: {
|
|
60840
|
+
id: cf.id,
|
|
60841
|
+
rule: cf.rule,
|
|
60842
|
+
stopIfTrue: cf.stopIfTrue,
|
|
60843
|
+
},
|
|
60844
|
+
ranges: newCfRanges,
|
|
60845
|
+
sheetId,
|
|
60846
|
+
});
|
|
60847
|
+
}
|
|
60848
|
+
}
|
|
60849
|
+
}
|
|
60850
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
60851
|
+
for (const dvId in dvNewZones) {
|
|
60852
|
+
const changes = dvNewZones[dvId];
|
|
60853
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
60854
|
+
if (!dvOrigin) {
|
|
60855
|
+
continue;
|
|
60856
|
+
}
|
|
60857
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
60858
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
60859
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60860
|
+
rule: dvOrigin,
|
|
60861
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60862
|
+
sheetId,
|
|
60863
|
+
});
|
|
60864
|
+
}
|
|
60865
|
+
}
|
|
60713
60866
|
/**
|
|
60714
60867
|
* Select a cell which becomes the last cell of the autofillZone
|
|
60715
60868
|
*/
|
|
@@ -60788,22 +60941,20 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60788
60941
|
/**
|
|
60789
60942
|
* Generate the next cell
|
|
60790
60943
|
*/
|
|
60791
|
-
computeNewCell(generator, col, row
|
|
60944
|
+
computeNewCell(generator, col, row) {
|
|
60792
60945
|
const { cellData, tooltip, origin } = generator.next();
|
|
60793
60946
|
const { content, style, border, format } = cellData;
|
|
60794
60947
|
this.tooltip = tooltip;
|
|
60795
|
-
|
|
60796
|
-
|
|
60797
|
-
|
|
60798
|
-
|
|
60799
|
-
|
|
60800
|
-
|
|
60801
|
-
|
|
60802
|
-
|
|
60803
|
-
|
|
60804
|
-
|
|
60805
|
-
});
|
|
60806
|
-
}
|
|
60948
|
+
return {
|
|
60949
|
+
originCol: origin.col,
|
|
60950
|
+
originRow: origin.row,
|
|
60951
|
+
col,
|
|
60952
|
+
row,
|
|
60953
|
+
content,
|
|
60954
|
+
style,
|
|
60955
|
+
border,
|
|
60956
|
+
format,
|
|
60957
|
+
};
|
|
60807
60958
|
}
|
|
60808
60959
|
/**
|
|
60809
60960
|
* Get the rule associated to the current cell
|
|
@@ -60871,8 +61022,8 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60871
61022
|
? position[first].value
|
|
60872
61023
|
: position[second].value;
|
|
60873
61024
|
}
|
|
60874
|
-
|
|
60875
|
-
const
|
|
61025
|
+
autofillMerge(sheetId, data) {
|
|
61026
|
+
const { originCol, originRow, col, row } = data;
|
|
60876
61027
|
const position = { sheetId, col, row };
|
|
60877
61028
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
60878
61029
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -60899,35 +61050,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60899
61050
|
});
|
|
60900
61051
|
}
|
|
60901
61052
|
}
|
|
60902
|
-
autofillCF(originCol, originRow, col, row) {
|
|
60903
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60904
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60905
|
-
for (const cf of cfOrigin) {
|
|
60906
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
60907
|
-
if (newCfRanges) {
|
|
60908
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60909
|
-
cf: deepCopy(cf),
|
|
60910
|
-
ranges: newCfRanges,
|
|
60911
|
-
sheetId,
|
|
60912
|
-
});
|
|
60913
|
-
}
|
|
60914
|
-
}
|
|
60915
|
-
}
|
|
60916
|
-
autofillDV(originCol, originRow, col, row) {
|
|
60917
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60918
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60919
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60920
|
-
if (!dvOrigin) {
|
|
60921
|
-
return;
|
|
60922
|
-
}
|
|
60923
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
60924
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
60925
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60926
|
-
rule: dvOrigin,
|
|
60927
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60928
|
-
sheetId,
|
|
60929
|
-
});
|
|
60930
|
-
}
|
|
60931
61053
|
// ---------------------------------------------------------------------------
|
|
60932
61054
|
// Grid rendering
|
|
60933
61055
|
// ---------------------------------------------------------------------------
|
|
@@ -61307,10 +61429,8 @@ function mergeTransformation(toTransform, executed) {
|
|
|
61307
61429
|
}
|
|
61308
61430
|
const target = [];
|
|
61309
61431
|
for (const zone1 of toTransform.target) {
|
|
61310
|
-
|
|
61311
|
-
|
|
61312
|
-
target.push({ ...zone1 });
|
|
61313
|
-
}
|
|
61432
|
+
if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
|
|
61433
|
+
target.push(zone1);
|
|
61314
61434
|
}
|
|
61315
61435
|
}
|
|
61316
61436
|
if (target.length) {
|
|
@@ -67538,6 +67658,10 @@ class SpreadsheetDashboard extends owl.Component {
|
|
|
67538
67658
|
this.hoveredCell.clear();
|
|
67539
67659
|
});
|
|
67540
67660
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
67661
|
+
useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
|
|
67662
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
67663
|
+
return scrollY > 0;
|
|
67664
|
+
});
|
|
67541
67665
|
}
|
|
67542
67666
|
onCellHovered({ col, row }) {
|
|
67543
67667
|
this.hoveredCell.hover({ col, row });
|
|
@@ -73633,6 +73757,6 @@ exports.tokenColors = tokenColors;
|
|
|
73633
73757
|
exports.tokenize = tokenize;
|
|
73634
73758
|
|
|
73635
73759
|
|
|
73636
|
-
__info__.version = "18.0.
|
|
73637
|
-
__info__.date = "2025-04-
|
|
73638
|
-
__info__.hash = "
|
|
73760
|
+
__info__.version = "18.0.24";
|
|
73761
|
+
__info__.date = "2025-04-18T16:23:09.320Z";
|
|
73762
|
+
__info__.hash = "aa18758";
|