@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
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -3395,6 +3395,7 @@ const coreTypes = new Set([
|
|
|
3395
3395
|
"CLEAR_FORMATTING",
|
|
3396
3396
|
"SET_BORDER",
|
|
3397
3397
|
"SET_ZONE_BORDERS",
|
|
3398
|
+
"SET_BORDERS_ON_TARGET",
|
|
3398
3399
|
/** CHART */
|
|
3399
3400
|
"CREATE_CHART",
|
|
3400
3401
|
"UPDATE_CHART",
|
|
@@ -6558,6 +6559,7 @@ class AbstractCellClipboardHandler extends ClipboardHandler {
|
|
|
6558
6559
|
}
|
|
6559
6560
|
|
|
6560
6561
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6562
|
+
queuedBordersToAdd = {};
|
|
6561
6563
|
copy(data) {
|
|
6562
6564
|
const sheetId = data.sheetId;
|
|
6563
6565
|
if (data.zones.length === 0) {
|
|
@@ -6588,6 +6590,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6588
6590
|
const { left, top } = zones[0];
|
|
6589
6591
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6590
6592
|
}
|
|
6593
|
+
this.executeQueuedChanges(sheetId);
|
|
6591
6594
|
}
|
|
6592
6595
|
pasteZone(sheetId, col, row, borders) {
|
|
6593
6596
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6606,7 +6609,20 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6606
6609
|
...targetBorders,
|
|
6607
6610
|
...originBorders,
|
|
6608
6611
|
};
|
|
6609
|
-
|
|
6612
|
+
const borderKey = JSON.stringify(border);
|
|
6613
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6614
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6615
|
+
}
|
|
6616
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6617
|
+
}
|
|
6618
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6619
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6620
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6621
|
+
const border = JSON.parse(borderKey);
|
|
6622
|
+
const target = recomputeZones(zones, []);
|
|
6623
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6624
|
+
}
|
|
6625
|
+
this.queuedBordersToAdd = {};
|
|
6610
6626
|
}
|
|
6611
6627
|
}
|
|
6612
6628
|
|
|
@@ -6718,6 +6734,12 @@ function tokenizeString(chars) {
|
|
|
6718
6734
|
}
|
|
6719
6735
|
return null;
|
|
6720
6736
|
}
|
|
6737
|
+
/**
|
|
6738
|
+
- \p{L} is for any letter (from any language)
|
|
6739
|
+
- \p{N} is for any number
|
|
6740
|
+
- the u flag at the end is for unicode, which enables the `\p{...}` syntax
|
|
6741
|
+
*/
|
|
6742
|
+
const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
|
|
6721
6743
|
const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
|
|
6722
6744
|
/**
|
|
6723
6745
|
* A "Symbol" is just basically any word-like element that can appear in a
|
|
@@ -6758,7 +6780,8 @@ function tokenizeSymbol(chars) {
|
|
|
6758
6780
|
};
|
|
6759
6781
|
}
|
|
6760
6782
|
}
|
|
6761
|
-
while (chars.current &&
|
|
6783
|
+
while (chars.current &&
|
|
6784
|
+
(SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
|
|
6762
6785
|
result += chars.shift();
|
|
6763
6786
|
}
|
|
6764
6787
|
if (result.length) {
|
|
@@ -8498,12 +8521,13 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8498
8521
|
}
|
|
8499
8522
|
pasteCf(origin, target, isCutOperation) {
|
|
8500
8523
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8524
|
+
const originZone = positionToZone(origin.position);
|
|
8501
8525
|
const zone = positionToZone(target);
|
|
8502
8526
|
for (const rule of origin.rules) {
|
|
8503
8527
|
const toRemoveZones = [];
|
|
8504
8528
|
if (isCutOperation) {
|
|
8505
8529
|
//remove from current rule
|
|
8506
|
-
toRemoveZones.push(
|
|
8530
|
+
toRemoveZones.push(originZone);
|
|
8507
8531
|
}
|
|
8508
8532
|
if (origin.position.sheetId === target.sheetId) {
|
|
8509
8533
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8617,6 +8641,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8617
8641
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8618
8642
|
if (origin) {
|
|
8619
8643
|
const zone = positionToZone(target);
|
|
8644
|
+
const originZone = positionToZone(origin.position);
|
|
8620
8645
|
const rule = origin.rule;
|
|
8621
8646
|
if (!rule) {
|
|
8622
8647
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8628,7 +8653,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8628
8653
|
}
|
|
8629
8654
|
const toRemoveZone = [];
|
|
8630
8655
|
if (isCutOperation) {
|
|
8631
|
-
toRemoveZone.push(
|
|
8656
|
+
toRemoveZone.push(originZone);
|
|
8632
8657
|
}
|
|
8633
8658
|
if (origin.position.sheetId === target.sheetId) {
|
|
8634
8659
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8688,7 +8713,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8688
8713
|
continue;
|
|
8689
8714
|
}
|
|
8690
8715
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8691
|
-
rule: dv,
|
|
8716
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8692
8717
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8693
8718
|
sheetId,
|
|
8694
8719
|
});
|
|
@@ -9019,7 +9044,7 @@ function transformZone(zone, executed) {
|
|
|
9019
9044
|
if (executed.type === "ADD_COLUMNS_ROWS") {
|
|
9020
9045
|
return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
|
|
9021
9046
|
}
|
|
9022
|
-
return
|
|
9047
|
+
return zone;
|
|
9023
9048
|
}
|
|
9024
9049
|
function transformRangeData(range, executed) {
|
|
9025
9050
|
const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
|
|
@@ -47990,39 +48015,6 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
47990
48015
|
}
|
|
47991
48016
|
return hoveredPosition;
|
|
47992
48017
|
}
|
|
47993
|
-
function useTouchMove(gridRef, handler, canMoveUp) {
|
|
47994
|
-
let x = null;
|
|
47995
|
-
let y = null;
|
|
47996
|
-
function onTouchStart(ev) {
|
|
47997
|
-
if (ev.touches.length !== 1)
|
|
47998
|
-
return;
|
|
47999
|
-
x = ev.touches[0].clientX;
|
|
48000
|
-
y = ev.touches[0].clientY;
|
|
48001
|
-
}
|
|
48002
|
-
function onTouchEnd() {
|
|
48003
|
-
x = null;
|
|
48004
|
-
y = null;
|
|
48005
|
-
}
|
|
48006
|
-
function onTouchMove(ev) {
|
|
48007
|
-
if (ev.touches.length !== 1)
|
|
48008
|
-
return;
|
|
48009
|
-
// On mobile browsers, swiping down is often associated with "pull to refresh".
|
|
48010
|
-
// We only want this behavior if the grid is already at the top.
|
|
48011
|
-
// Otherwise we only want to move the canvas up, without triggering any refresh.
|
|
48012
|
-
if (canMoveUp()) {
|
|
48013
|
-
ev.preventDefault();
|
|
48014
|
-
ev.stopPropagation();
|
|
48015
|
-
}
|
|
48016
|
-
const currentX = ev.touches[0].clientX;
|
|
48017
|
-
const currentY = ev.touches[0].clientY;
|
|
48018
|
-
handler(x - currentX, y - currentY);
|
|
48019
|
-
x = currentX;
|
|
48020
|
-
y = currentY;
|
|
48021
|
-
}
|
|
48022
|
-
useRefListener(gridRef, "touchstart", onTouchStart);
|
|
48023
|
-
useRefListener(gridRef, "touchend", onTouchEnd);
|
|
48024
|
-
useRefListener(gridRef, "touchmove", onTouchMove);
|
|
48025
|
-
}
|
|
48026
48018
|
class GridOverlay extends Component {
|
|
48027
48019
|
static template = "o-spreadsheet-GridOverlay";
|
|
48028
48020
|
static props = {
|
|
@@ -48070,10 +48062,6 @@ class GridOverlay extends Component {
|
|
|
48070
48062
|
onWillUnmount(() => {
|
|
48071
48063
|
resizeObserver.disconnect();
|
|
48072
48064
|
});
|
|
48073
|
-
useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
|
|
48074
|
-
const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
48075
|
-
return scrollY > 0;
|
|
48076
|
-
});
|
|
48077
48065
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
48078
48066
|
this.paintFormatStore = useStore(PaintFormatStore);
|
|
48079
48067
|
}
|
|
@@ -49422,6 +49410,73 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
49422
49410
|
}
|
|
49423
49411
|
}
|
|
49424
49412
|
|
|
49413
|
+
const friction = 0.95;
|
|
49414
|
+
const verticalScrollFactor = 1;
|
|
49415
|
+
const horizontalScrollFactor = 1;
|
|
49416
|
+
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
49417
|
+
let lastX = 0;
|
|
49418
|
+
let lastY = 0;
|
|
49419
|
+
let velocityX = 0;
|
|
49420
|
+
let velocityY = 0;
|
|
49421
|
+
let isMouseDown = false;
|
|
49422
|
+
let lastTime = 0;
|
|
49423
|
+
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
49424
|
+
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
49425
|
+
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
49426
|
+
function onTouchStart(event) {
|
|
49427
|
+
isMouseDown = true;
|
|
49428
|
+
({ clientX: lastX, clientY: lastY } = event.touches[0]);
|
|
49429
|
+
velocityX = 0;
|
|
49430
|
+
velocityY = 0;
|
|
49431
|
+
}
|
|
49432
|
+
function onTouchMove(event) {
|
|
49433
|
+
if (!isMouseDown)
|
|
49434
|
+
return;
|
|
49435
|
+
const currentTime = Date.now();
|
|
49436
|
+
const { clientX, clientY } = event.touches[0];
|
|
49437
|
+
let deltaX = lastX - clientX;
|
|
49438
|
+
let deltaY = lastY - clientY;
|
|
49439
|
+
const elapsedTime = currentTime - lastTime;
|
|
49440
|
+
velocityX = deltaX / elapsedTime;
|
|
49441
|
+
velocityY = deltaY / elapsedTime;
|
|
49442
|
+
lastX = clientX;
|
|
49443
|
+
lastY = clientY;
|
|
49444
|
+
lastTime = currentTime;
|
|
49445
|
+
if (canMoveUp()) {
|
|
49446
|
+
if (event.cancelable) {
|
|
49447
|
+
event.preventDefault();
|
|
49448
|
+
}
|
|
49449
|
+
event.stopPropagation();
|
|
49450
|
+
}
|
|
49451
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
49452
|
+
}
|
|
49453
|
+
function onTouchEnd(ev) {
|
|
49454
|
+
isMouseDown = false;
|
|
49455
|
+
lastX = lastY = 0;
|
|
49456
|
+
requestAnimationFrame(scroll);
|
|
49457
|
+
}
|
|
49458
|
+
function scroll() {
|
|
49459
|
+
if (Math.abs(velocityX) < 0.05) {
|
|
49460
|
+
velocityX = 0;
|
|
49461
|
+
}
|
|
49462
|
+
if (Math.abs(velocityY) < 0.05) {
|
|
49463
|
+
velocityY = 0;
|
|
49464
|
+
}
|
|
49465
|
+
if (!velocityX && !velocityY) {
|
|
49466
|
+
return;
|
|
49467
|
+
}
|
|
49468
|
+
const currentTime = Date.now();
|
|
49469
|
+
const elapsedTime = Math.abs(currentTime - lastTime);
|
|
49470
|
+
const deltaX = velocityX * elapsedTime;
|
|
49471
|
+
const deltaY = velocityY * elapsedTime;
|
|
49472
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
49473
|
+
lastTime = currentTime;
|
|
49474
|
+
velocityX *= friction;
|
|
49475
|
+
velocityY *= friction;
|
|
49476
|
+
requestAnimationFrame(scroll);
|
|
49477
|
+
}
|
|
49478
|
+
}
|
|
49479
|
+
|
|
49425
49480
|
function useWheelHandler(handler) {
|
|
49426
49481
|
function normalize(val, deltaMode) {
|
|
49427
49482
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
@@ -50042,6 +50097,10 @@ class Grid extends Component {
|
|
|
50042
50097
|
this.DOMFocusableElementStore.focusableElement?.focus();
|
|
50043
50098
|
}
|
|
50044
50099
|
}, () => [this.sidePanel.isOpen]);
|
|
50100
|
+
useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
|
|
50101
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
50102
|
+
return scrollY > 0;
|
|
50103
|
+
});
|
|
50045
50104
|
}
|
|
50046
50105
|
onCellHovered({ col, row }) {
|
|
50047
50106
|
this.hoveredCell.hover({ col, row });
|
|
@@ -50789,6 +50848,15 @@ class BordersPlugin extends CorePlugin {
|
|
|
50789
50848
|
case "SET_BORDER":
|
|
50790
50849
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
50791
50850
|
break;
|
|
50851
|
+
case "SET_BORDERS_ON_TARGET":
|
|
50852
|
+
for (const zone of cmd.target) {
|
|
50853
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50854
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
50855
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
50856
|
+
}
|
|
50857
|
+
}
|
|
50858
|
+
}
|
|
50859
|
+
break;
|
|
50792
50860
|
case "SET_ZONE_BORDERS":
|
|
50793
50861
|
if (cmd.border) {
|
|
50794
50862
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -60607,25 +60675,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60607
60675
|
case "AUTOFILL_AUTO":
|
|
60608
60676
|
this.autofillAuto();
|
|
60609
60677
|
break;
|
|
60610
|
-
case "AUTOFILL_CELL":
|
|
60611
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60612
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60613
|
-
this.dispatch("UPDATE_CELL", {
|
|
60614
|
-
sheetId,
|
|
60615
|
-
col: cmd.col,
|
|
60616
|
-
row: cmd.row,
|
|
60617
|
-
style: cmd.style || null,
|
|
60618
|
-
content: cmd.content || "",
|
|
60619
|
-
format: cmd.format || "",
|
|
60620
|
-
});
|
|
60621
|
-
this.dispatch("SET_BORDER", {
|
|
60622
|
-
sheetId,
|
|
60623
|
-
col: cmd.col,
|
|
60624
|
-
row: cmd.row,
|
|
60625
|
-
border: cmd.border,
|
|
60626
|
-
});
|
|
60627
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60628
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60629
60678
|
}
|
|
60630
60679
|
}
|
|
60631
60680
|
// ---------------------------------------------------------------------------
|
|
@@ -60649,6 +60698,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60649
60698
|
}
|
|
60650
60699
|
const source = this.getters.getSelectedZone();
|
|
60651
60700
|
const target = this.autofillZone;
|
|
60701
|
+
const autofillCellsData = [];
|
|
60652
60702
|
switch (this.direction) {
|
|
60653
60703
|
case "down" /* DIRECTION.DOWN */:
|
|
60654
60704
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -60658,7 +60708,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60658
60708
|
}
|
|
60659
60709
|
const generator = this.createGenerator(xcs);
|
|
60660
60710
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
60661
|
-
this.computeNewCell(generator, col, row
|
|
60711
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60662
60712
|
}
|
|
60663
60713
|
}
|
|
60664
60714
|
break;
|
|
@@ -60670,7 +60720,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60670
60720
|
}
|
|
60671
60721
|
const generator = this.createGenerator(xcs);
|
|
60672
60722
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
60673
|
-
this.computeNewCell(generator, col, row
|
|
60723
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60674
60724
|
}
|
|
60675
60725
|
}
|
|
60676
60726
|
break;
|
|
@@ -60682,7 +60732,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60682
60732
|
}
|
|
60683
60733
|
const generator = this.createGenerator(xcs);
|
|
60684
60734
|
for (let col = target.right; col >= target.left; col--) {
|
|
60685
|
-
this.computeNewCell(generator, col, row
|
|
60735
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60686
60736
|
}
|
|
60687
60737
|
}
|
|
60688
60738
|
break;
|
|
@@ -60694,12 +60744,26 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60694
60744
|
}
|
|
60695
60745
|
const generator = this.createGenerator(xcs);
|
|
60696
60746
|
for (let col = target.left; col <= target.right; col++) {
|
|
60697
|
-
this.computeNewCell(generator, col, row
|
|
60747
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60698
60748
|
}
|
|
60699
60749
|
}
|
|
60700
60750
|
break;
|
|
60701
60751
|
}
|
|
60702
60752
|
if (apply) {
|
|
60753
|
+
const bordersZones = {};
|
|
60754
|
+
const cfNewRanges = {};
|
|
60755
|
+
const dvNewZones = {};
|
|
60756
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
60757
|
+
for (const data of autofillCellsData) {
|
|
60758
|
+
this.collectBordersData(data, bordersZones);
|
|
60759
|
+
this.autofillMerge(sheetId, data);
|
|
60760
|
+
this.autofillCell(sheetId, data);
|
|
60761
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
60762
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
60763
|
+
}
|
|
60764
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
60765
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
60766
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
60703
60767
|
this.autofillZone = undefined;
|
|
60704
60768
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
60705
60769
|
this.lastCellSelected = {};
|
|
@@ -60708,6 +60772,95 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60708
60772
|
this.tooltip = undefined;
|
|
60709
60773
|
}
|
|
60710
60774
|
}
|
|
60775
|
+
collectBordersData(data, bordersPositions) {
|
|
60776
|
+
const key = JSON.stringify(data.border);
|
|
60777
|
+
if (!(key in bordersPositions)) {
|
|
60778
|
+
bordersPositions[key] = [];
|
|
60779
|
+
}
|
|
60780
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
60781
|
+
}
|
|
60782
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
60783
|
+
const { originCol, originRow, col, row } = data;
|
|
60784
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60785
|
+
const xc = toXC(col, row);
|
|
60786
|
+
for (const cf of cfsAtOrigin) {
|
|
60787
|
+
if (!(cf.id in cfNewRanges)) {
|
|
60788
|
+
cfNewRanges[cf.id] = [];
|
|
60789
|
+
}
|
|
60790
|
+
cfNewRanges[cf.id].push(xc);
|
|
60791
|
+
}
|
|
60792
|
+
}
|
|
60793
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
60794
|
+
const { originCol, originRow, col, row } = data;
|
|
60795
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60796
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60797
|
+
if (!dvsAtOrigin) {
|
|
60798
|
+
return;
|
|
60799
|
+
}
|
|
60800
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
60801
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
60802
|
+
}
|
|
60803
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
60804
|
+
}
|
|
60805
|
+
autofillCell(sheetId, data) {
|
|
60806
|
+
this.dispatch("UPDATE_CELL", {
|
|
60807
|
+
sheetId,
|
|
60808
|
+
col: data.col,
|
|
60809
|
+
row: data.row,
|
|
60810
|
+
content: data.content || "",
|
|
60811
|
+
style: data.style || null,
|
|
60812
|
+
format: data.format || "",
|
|
60813
|
+
});
|
|
60814
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
60815
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
60816
|
+
}
|
|
60817
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
60818
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
60819
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
60820
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
60821
|
+
sheetId,
|
|
60822
|
+
border,
|
|
60823
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
60824
|
+
});
|
|
60825
|
+
}
|
|
60826
|
+
}
|
|
60827
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
60828
|
+
for (const cfId in cfNewRanges) {
|
|
60829
|
+
const changes = cfNewRanges[cfId];
|
|
60830
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
60831
|
+
if (!cf) {
|
|
60832
|
+
continue;
|
|
60833
|
+
}
|
|
60834
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
60835
|
+
if (newCfRanges) {
|
|
60836
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60837
|
+
cf: {
|
|
60838
|
+
id: cf.id,
|
|
60839
|
+
rule: cf.rule,
|
|
60840
|
+
stopIfTrue: cf.stopIfTrue,
|
|
60841
|
+
},
|
|
60842
|
+
ranges: newCfRanges,
|
|
60843
|
+
sheetId,
|
|
60844
|
+
});
|
|
60845
|
+
}
|
|
60846
|
+
}
|
|
60847
|
+
}
|
|
60848
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
60849
|
+
for (const dvId in dvNewZones) {
|
|
60850
|
+
const changes = dvNewZones[dvId];
|
|
60851
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
60852
|
+
if (!dvOrigin) {
|
|
60853
|
+
continue;
|
|
60854
|
+
}
|
|
60855
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
60856
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
60857
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60858
|
+
rule: dvOrigin,
|
|
60859
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60860
|
+
sheetId,
|
|
60861
|
+
});
|
|
60862
|
+
}
|
|
60863
|
+
}
|
|
60711
60864
|
/**
|
|
60712
60865
|
* Select a cell which becomes the last cell of the autofillZone
|
|
60713
60866
|
*/
|
|
@@ -60786,22 +60939,20 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60786
60939
|
/**
|
|
60787
60940
|
* Generate the next cell
|
|
60788
60941
|
*/
|
|
60789
|
-
computeNewCell(generator, col, row
|
|
60942
|
+
computeNewCell(generator, col, row) {
|
|
60790
60943
|
const { cellData, tooltip, origin } = generator.next();
|
|
60791
60944
|
const { content, style, border, format } = cellData;
|
|
60792
60945
|
this.tooltip = tooltip;
|
|
60793
|
-
|
|
60794
|
-
|
|
60795
|
-
|
|
60796
|
-
|
|
60797
|
-
|
|
60798
|
-
|
|
60799
|
-
|
|
60800
|
-
|
|
60801
|
-
|
|
60802
|
-
|
|
60803
|
-
});
|
|
60804
|
-
}
|
|
60946
|
+
return {
|
|
60947
|
+
originCol: origin.col,
|
|
60948
|
+
originRow: origin.row,
|
|
60949
|
+
col,
|
|
60950
|
+
row,
|
|
60951
|
+
content,
|
|
60952
|
+
style,
|
|
60953
|
+
border,
|
|
60954
|
+
format,
|
|
60955
|
+
};
|
|
60805
60956
|
}
|
|
60806
60957
|
/**
|
|
60807
60958
|
* Get the rule associated to the current cell
|
|
@@ -60869,8 +61020,8 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60869
61020
|
? position[first].value
|
|
60870
61021
|
: position[second].value;
|
|
60871
61022
|
}
|
|
60872
|
-
|
|
60873
|
-
const
|
|
61023
|
+
autofillMerge(sheetId, data) {
|
|
61024
|
+
const { originCol, originRow, col, row } = data;
|
|
60874
61025
|
const position = { sheetId, col, row };
|
|
60875
61026
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
60876
61027
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -60897,35 +61048,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60897
61048
|
});
|
|
60898
61049
|
}
|
|
60899
61050
|
}
|
|
60900
|
-
autofillCF(originCol, originRow, col, row) {
|
|
60901
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60902
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60903
|
-
for (const cf of cfOrigin) {
|
|
60904
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
60905
|
-
if (newCfRanges) {
|
|
60906
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60907
|
-
cf: deepCopy(cf),
|
|
60908
|
-
ranges: newCfRanges,
|
|
60909
|
-
sheetId,
|
|
60910
|
-
});
|
|
60911
|
-
}
|
|
60912
|
-
}
|
|
60913
|
-
}
|
|
60914
|
-
autofillDV(originCol, originRow, col, row) {
|
|
60915
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60916
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60917
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60918
|
-
if (!dvOrigin) {
|
|
60919
|
-
return;
|
|
60920
|
-
}
|
|
60921
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
60922
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
60923
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60924
|
-
rule: dvOrigin,
|
|
60925
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60926
|
-
sheetId,
|
|
60927
|
-
});
|
|
60928
|
-
}
|
|
60929
61051
|
// ---------------------------------------------------------------------------
|
|
60930
61052
|
// Grid rendering
|
|
60931
61053
|
// ---------------------------------------------------------------------------
|
|
@@ -61305,10 +61427,8 @@ function mergeTransformation(toTransform, executed) {
|
|
|
61305
61427
|
}
|
|
61306
61428
|
const target = [];
|
|
61307
61429
|
for (const zone1 of toTransform.target) {
|
|
61308
|
-
|
|
61309
|
-
|
|
61310
|
-
target.push({ ...zone1 });
|
|
61311
|
-
}
|
|
61430
|
+
if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
|
|
61431
|
+
target.push(zone1);
|
|
61312
61432
|
}
|
|
61313
61433
|
}
|
|
61314
61434
|
if (target.length) {
|
|
@@ -67536,6 +67656,10 @@ class SpreadsheetDashboard extends Component {
|
|
|
67536
67656
|
this.hoveredCell.clear();
|
|
67537
67657
|
});
|
|
67538
67658
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
67659
|
+
useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
|
|
67660
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
67661
|
+
return scrollY > 0;
|
|
67662
|
+
});
|
|
67539
67663
|
}
|
|
67540
67664
|
onCellHovered({ col, row }) {
|
|
67541
67665
|
this.hoveredCell.hover({ col, row });
|
|
@@ -73588,6 +73712,6 @@ const constants = {
|
|
|
73588
73712
|
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 };
|
|
73589
73713
|
|
|
73590
73714
|
|
|
73591
|
-
__info__.version = "18.0.
|
|
73592
|
-
__info__.date = "2025-04-
|
|
73593
|
-
__info__.hash = "
|
|
73715
|
+
__info__.version = "18.0.24";
|
|
73716
|
+
__info__.date = "2025-04-18T16:23:09.320Z";
|
|
73717
|
+
__info__.hash = "aa18758";
|