@odoo/o-spreadsheet 18.1.14 → 18.1.16
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 +370 -370
- package/dist/o_spreadsheet.xml +38 -36
- 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.1.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.16
|
|
6
|
+
* @date 2025-04-18T16:24:16.854Z
|
|
7
|
+
* @hash 19f6de2
|
|
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';
|
|
@@ -3562,6 +3562,7 @@ const coreTypes = new Set([
|
|
|
3562
3562
|
"CLEAR_FORMATTING",
|
|
3563
3563
|
"SET_BORDER",
|
|
3564
3564
|
"SET_ZONE_BORDERS",
|
|
3565
|
+
"SET_BORDERS_ON_TARGET",
|
|
3565
3566
|
/** CHART */
|
|
3566
3567
|
"CREATE_CHART",
|
|
3567
3568
|
"UPDATE_CHART",
|
|
@@ -6713,6 +6714,7 @@ class AbstractCellClipboardHandler extends ClipboardHandler {
|
|
|
6713
6714
|
}
|
|
6714
6715
|
|
|
6715
6716
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6717
|
+
queuedBordersToAdd = {};
|
|
6716
6718
|
copy(data) {
|
|
6717
6719
|
const sheetId = data.sheetId;
|
|
6718
6720
|
if (data.zones.length === 0) {
|
|
@@ -6743,6 +6745,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6743
6745
|
const { left, top } = zones[0];
|
|
6744
6746
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6745
6747
|
}
|
|
6748
|
+
this.executeQueuedChanges(sheetId);
|
|
6746
6749
|
}
|
|
6747
6750
|
pasteZone(sheetId, col, row, borders) {
|
|
6748
6751
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6761,7 +6764,20 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6761
6764
|
...targetBorders,
|
|
6762
6765
|
...originBorders,
|
|
6763
6766
|
};
|
|
6764
|
-
|
|
6767
|
+
const borderKey = JSON.stringify(border);
|
|
6768
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6769
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6770
|
+
}
|
|
6771
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6772
|
+
}
|
|
6773
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6774
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6775
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6776
|
+
const border = JSON.parse(borderKey);
|
|
6777
|
+
const target = recomputeZones(zones, []);
|
|
6778
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6779
|
+
}
|
|
6780
|
+
this.queuedBordersToAdd = {};
|
|
6765
6781
|
}
|
|
6766
6782
|
}
|
|
6767
6783
|
|
|
@@ -6873,6 +6889,12 @@ function tokenizeString(chars) {
|
|
|
6873
6889
|
}
|
|
6874
6890
|
return null;
|
|
6875
6891
|
}
|
|
6892
|
+
/**
|
|
6893
|
+
- \p{L} is for any letter (from any language)
|
|
6894
|
+
- \p{N} is for any number
|
|
6895
|
+
- the u flag at the end is for unicode, which enables the `\p{...}` syntax
|
|
6896
|
+
*/
|
|
6897
|
+
const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
|
|
6876
6898
|
const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
|
|
6877
6899
|
/**
|
|
6878
6900
|
* A "Symbol" is just basically any word-like element that can appear in a
|
|
@@ -6913,7 +6935,8 @@ function tokenizeSymbol(chars) {
|
|
|
6913
6935
|
};
|
|
6914
6936
|
}
|
|
6915
6937
|
}
|
|
6916
|
-
while (chars.current &&
|
|
6938
|
+
while (chars.current &&
|
|
6939
|
+
(SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
|
|
6917
6940
|
result += chars.shift();
|
|
6918
6941
|
}
|
|
6919
6942
|
if (result.length) {
|
|
@@ -8700,12 +8723,13 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8700
8723
|
}
|
|
8701
8724
|
pasteCf(origin, target, isCutOperation) {
|
|
8702
8725
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8726
|
+
const originZone = positionToZone(origin.position);
|
|
8703
8727
|
const zone = positionToZone(target);
|
|
8704
8728
|
for (const rule of origin.rules) {
|
|
8705
8729
|
const toRemoveZones = [];
|
|
8706
8730
|
if (isCutOperation) {
|
|
8707
8731
|
//remove from current rule
|
|
8708
|
-
toRemoveZones.push(
|
|
8732
|
+
toRemoveZones.push(originZone);
|
|
8709
8733
|
}
|
|
8710
8734
|
if (origin.position.sheetId === target.sheetId) {
|
|
8711
8735
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8819,6 +8843,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8819
8843
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8820
8844
|
if (origin) {
|
|
8821
8845
|
const zone = positionToZone(target);
|
|
8846
|
+
const originZone = positionToZone(origin.position);
|
|
8822
8847
|
const rule = origin.rule;
|
|
8823
8848
|
if (!rule) {
|
|
8824
8849
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8830,7 +8855,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8830
8855
|
}
|
|
8831
8856
|
const toRemoveZone = [];
|
|
8832
8857
|
if (isCutOperation) {
|
|
8833
|
-
toRemoveZone.push(
|
|
8858
|
+
toRemoveZone.push(originZone);
|
|
8834
8859
|
}
|
|
8835
8860
|
if (origin.position.sheetId === target.sheetId) {
|
|
8836
8861
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8890,7 +8915,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8890
8915
|
continue;
|
|
8891
8916
|
}
|
|
8892
8917
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8893
|
-
rule: dv,
|
|
8918
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8894
8919
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8895
8920
|
sheetId,
|
|
8896
8921
|
});
|
|
@@ -9217,7 +9242,7 @@ function transformZone(zone, executed) {
|
|
|
9217
9242
|
if (executed.type === "ADD_COLUMNS_ROWS") {
|
|
9218
9243
|
return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
|
|
9219
9244
|
}
|
|
9220
|
-
return
|
|
9245
|
+
return zone;
|
|
9221
9246
|
}
|
|
9222
9247
|
function transformRangeData(range, executed) {
|
|
9223
9248
|
const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
|
|
@@ -50087,39 +50112,6 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
50087
50112
|
}
|
|
50088
50113
|
return hoveredPosition;
|
|
50089
50114
|
}
|
|
50090
|
-
function useTouchMove(gridRef, handler, canMoveUp) {
|
|
50091
|
-
let x = null;
|
|
50092
|
-
let y = null;
|
|
50093
|
-
function onTouchStart(ev) {
|
|
50094
|
-
if (ev.touches.length !== 1)
|
|
50095
|
-
return;
|
|
50096
|
-
x = ev.touches[0].clientX;
|
|
50097
|
-
y = ev.touches[0].clientY;
|
|
50098
|
-
}
|
|
50099
|
-
function onTouchEnd() {
|
|
50100
|
-
x = null;
|
|
50101
|
-
y = null;
|
|
50102
|
-
}
|
|
50103
|
-
function onTouchMove(ev) {
|
|
50104
|
-
if (ev.touches.length !== 1)
|
|
50105
|
-
return;
|
|
50106
|
-
// On mobile browsers, swiping down is often associated with "pull to refresh".
|
|
50107
|
-
// We only want this behavior if the grid is already at the top.
|
|
50108
|
-
// Otherwise we only want to move the canvas up, without triggering any refresh.
|
|
50109
|
-
if (canMoveUp()) {
|
|
50110
|
-
ev.preventDefault();
|
|
50111
|
-
ev.stopPropagation();
|
|
50112
|
-
}
|
|
50113
|
-
const currentX = ev.touches[0].clientX;
|
|
50114
|
-
const currentY = ev.touches[0].clientY;
|
|
50115
|
-
handler(x - currentX, y - currentY);
|
|
50116
|
-
x = currentX;
|
|
50117
|
-
y = currentY;
|
|
50118
|
-
}
|
|
50119
|
-
useRefListener(gridRef, "touchstart", onTouchStart);
|
|
50120
|
-
useRefListener(gridRef, "touchend", onTouchEnd);
|
|
50121
|
-
useRefListener(gridRef, "touchmove", onTouchMove);
|
|
50122
|
-
}
|
|
50123
50115
|
class GridOverlay extends Component {
|
|
50124
50116
|
static template = "o-spreadsheet-GridOverlay";
|
|
50125
50117
|
static props = {
|
|
@@ -50167,10 +50159,6 @@ class GridOverlay extends Component {
|
|
|
50167
50159
|
onWillUnmount(() => {
|
|
50168
50160
|
resizeObserver.disconnect();
|
|
50169
50161
|
});
|
|
50170
|
-
useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
|
|
50171
|
-
const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
50172
|
-
return scrollY > 0;
|
|
50173
|
-
});
|
|
50174
50162
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
50175
50163
|
this.paintFormatStore = useStore(PaintFormatStore);
|
|
50176
50164
|
}
|
|
@@ -51528,6 +51516,73 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
51528
51516
|
}
|
|
51529
51517
|
}
|
|
51530
51518
|
|
|
51519
|
+
const friction = 0.95;
|
|
51520
|
+
const verticalScrollFactor = 1;
|
|
51521
|
+
const horizontalScrollFactor = 1;
|
|
51522
|
+
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
51523
|
+
let lastX = 0;
|
|
51524
|
+
let lastY = 0;
|
|
51525
|
+
let velocityX = 0;
|
|
51526
|
+
let velocityY = 0;
|
|
51527
|
+
let isMouseDown = false;
|
|
51528
|
+
let lastTime = 0;
|
|
51529
|
+
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
51530
|
+
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
51531
|
+
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
51532
|
+
function onTouchStart(event) {
|
|
51533
|
+
isMouseDown = true;
|
|
51534
|
+
({ clientX: lastX, clientY: lastY } = event.touches[0]);
|
|
51535
|
+
velocityX = 0;
|
|
51536
|
+
velocityY = 0;
|
|
51537
|
+
}
|
|
51538
|
+
function onTouchMove(event) {
|
|
51539
|
+
if (!isMouseDown)
|
|
51540
|
+
return;
|
|
51541
|
+
const currentTime = Date.now();
|
|
51542
|
+
const { clientX, clientY } = event.touches[0];
|
|
51543
|
+
let deltaX = lastX - clientX;
|
|
51544
|
+
let deltaY = lastY - clientY;
|
|
51545
|
+
const elapsedTime = currentTime - lastTime;
|
|
51546
|
+
velocityX = deltaX / elapsedTime;
|
|
51547
|
+
velocityY = deltaY / elapsedTime;
|
|
51548
|
+
lastX = clientX;
|
|
51549
|
+
lastY = clientY;
|
|
51550
|
+
lastTime = currentTime;
|
|
51551
|
+
if (canMoveUp()) {
|
|
51552
|
+
if (event.cancelable) {
|
|
51553
|
+
event.preventDefault();
|
|
51554
|
+
}
|
|
51555
|
+
event.stopPropagation();
|
|
51556
|
+
}
|
|
51557
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
51558
|
+
}
|
|
51559
|
+
function onTouchEnd(ev) {
|
|
51560
|
+
isMouseDown = false;
|
|
51561
|
+
lastX = lastY = 0;
|
|
51562
|
+
requestAnimationFrame(scroll);
|
|
51563
|
+
}
|
|
51564
|
+
function scroll() {
|
|
51565
|
+
if (Math.abs(velocityX) < 0.05) {
|
|
51566
|
+
velocityX = 0;
|
|
51567
|
+
}
|
|
51568
|
+
if (Math.abs(velocityY) < 0.05) {
|
|
51569
|
+
velocityY = 0;
|
|
51570
|
+
}
|
|
51571
|
+
if (!velocityX && !velocityY) {
|
|
51572
|
+
return;
|
|
51573
|
+
}
|
|
51574
|
+
const currentTime = Date.now();
|
|
51575
|
+
const elapsedTime = Math.abs(currentTime - lastTime);
|
|
51576
|
+
const deltaX = velocityX * elapsedTime;
|
|
51577
|
+
const deltaY = velocityY * elapsedTime;
|
|
51578
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
51579
|
+
lastTime = currentTime;
|
|
51580
|
+
velocityX *= friction;
|
|
51581
|
+
velocityY *= friction;
|
|
51582
|
+
requestAnimationFrame(scroll);
|
|
51583
|
+
}
|
|
51584
|
+
}
|
|
51585
|
+
|
|
51531
51586
|
function useWheelHandler(handler) {
|
|
51532
51587
|
function normalize(val, deltaMode) {
|
|
51533
51588
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
@@ -52148,6 +52203,10 @@ class Grid extends Component {
|
|
|
52148
52203
|
this.DOMFocusableElementStore.focusableElement?.focus();
|
|
52149
52204
|
}
|
|
52150
52205
|
}, () => [this.sidePanel.isOpen]);
|
|
52206
|
+
useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
|
|
52207
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
52208
|
+
return scrollY > 0;
|
|
52209
|
+
});
|
|
52151
52210
|
}
|
|
52152
52211
|
onCellHovered({ col, row }) {
|
|
52153
52212
|
this.hoveredCell.hover({ col, row });
|
|
@@ -52870,6 +52929,15 @@ class BordersPlugin extends CorePlugin {
|
|
|
52870
52929
|
case "SET_BORDER":
|
|
52871
52930
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
52872
52931
|
break;
|
|
52932
|
+
case "SET_BORDERS_ON_TARGET":
|
|
52933
|
+
for (const zone of cmd.target) {
|
|
52934
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
52935
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
52936
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
52937
|
+
}
|
|
52938
|
+
}
|
|
52939
|
+
}
|
|
52940
|
+
break;
|
|
52873
52941
|
case "SET_ZONE_BORDERS":
|
|
52874
52942
|
if (cmd.border) {
|
|
52875
52943
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -62596,25 +62664,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62596
62664
|
case "AUTOFILL_AUTO":
|
|
62597
62665
|
this.autofillAuto();
|
|
62598
62666
|
break;
|
|
62599
|
-
case "AUTOFILL_CELL":
|
|
62600
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62601
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62602
|
-
this.dispatch("UPDATE_CELL", {
|
|
62603
|
-
sheetId,
|
|
62604
|
-
col: cmd.col,
|
|
62605
|
-
row: cmd.row,
|
|
62606
|
-
style: cmd.style || null,
|
|
62607
|
-
content: cmd.content || "",
|
|
62608
|
-
format: cmd.format || "",
|
|
62609
|
-
});
|
|
62610
|
-
this.dispatch("SET_BORDER", {
|
|
62611
|
-
sheetId,
|
|
62612
|
-
col: cmd.col,
|
|
62613
|
-
row: cmd.row,
|
|
62614
|
-
border: cmd.border,
|
|
62615
|
-
});
|
|
62616
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62617
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62618
62667
|
}
|
|
62619
62668
|
}
|
|
62620
62669
|
// ---------------------------------------------------------------------------
|
|
@@ -62638,6 +62687,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62638
62687
|
}
|
|
62639
62688
|
const source = this.getters.getSelectedZone();
|
|
62640
62689
|
const target = this.autofillZone;
|
|
62690
|
+
const autofillCellsData = [];
|
|
62641
62691
|
switch (this.direction) {
|
|
62642
62692
|
case "down" /* DIRECTION.DOWN */:
|
|
62643
62693
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -62647,7 +62697,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62647
62697
|
}
|
|
62648
62698
|
const generator = this.createGenerator(xcs);
|
|
62649
62699
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
62650
|
-
this.computeNewCell(generator, col, row
|
|
62700
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62651
62701
|
}
|
|
62652
62702
|
}
|
|
62653
62703
|
break;
|
|
@@ -62659,7 +62709,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62659
62709
|
}
|
|
62660
62710
|
const generator = this.createGenerator(xcs);
|
|
62661
62711
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
62662
|
-
this.computeNewCell(generator, col, row
|
|
62712
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62663
62713
|
}
|
|
62664
62714
|
}
|
|
62665
62715
|
break;
|
|
@@ -62671,7 +62721,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62671
62721
|
}
|
|
62672
62722
|
const generator = this.createGenerator(xcs);
|
|
62673
62723
|
for (let col = target.right; col >= target.left; col--) {
|
|
62674
|
-
this.computeNewCell(generator, col, row
|
|
62724
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62675
62725
|
}
|
|
62676
62726
|
}
|
|
62677
62727
|
break;
|
|
@@ -62683,12 +62733,26 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62683
62733
|
}
|
|
62684
62734
|
const generator = this.createGenerator(xcs);
|
|
62685
62735
|
for (let col = target.left; col <= target.right; col++) {
|
|
62686
|
-
this.computeNewCell(generator, col, row
|
|
62736
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62687
62737
|
}
|
|
62688
62738
|
}
|
|
62689
62739
|
break;
|
|
62690
62740
|
}
|
|
62691
62741
|
if (apply) {
|
|
62742
|
+
const bordersZones = {};
|
|
62743
|
+
const cfNewRanges = {};
|
|
62744
|
+
const dvNewZones = {};
|
|
62745
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
62746
|
+
for (const data of autofillCellsData) {
|
|
62747
|
+
this.collectBordersData(data, bordersZones);
|
|
62748
|
+
this.autofillMerge(sheetId, data);
|
|
62749
|
+
this.autofillCell(sheetId, data);
|
|
62750
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
62751
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
62752
|
+
}
|
|
62753
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
62754
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
62755
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
62692
62756
|
this.autofillZone = undefined;
|
|
62693
62757
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
62694
62758
|
this.lastCellSelected = {};
|
|
@@ -62697,6 +62761,95 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62697
62761
|
this.tooltip = undefined;
|
|
62698
62762
|
}
|
|
62699
62763
|
}
|
|
62764
|
+
collectBordersData(data, bordersPositions) {
|
|
62765
|
+
const key = JSON.stringify(data.border);
|
|
62766
|
+
if (!(key in bordersPositions)) {
|
|
62767
|
+
bordersPositions[key] = [];
|
|
62768
|
+
}
|
|
62769
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
62770
|
+
}
|
|
62771
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
62772
|
+
const { originCol, originRow, col, row } = data;
|
|
62773
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
62774
|
+
const xc = toXC(col, row);
|
|
62775
|
+
for (const cf of cfsAtOrigin) {
|
|
62776
|
+
if (!(cf.id in cfNewRanges)) {
|
|
62777
|
+
cfNewRanges[cf.id] = [];
|
|
62778
|
+
}
|
|
62779
|
+
cfNewRanges[cf.id].push(xc);
|
|
62780
|
+
}
|
|
62781
|
+
}
|
|
62782
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
62783
|
+
const { originCol, originRow, col, row } = data;
|
|
62784
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
62785
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
62786
|
+
if (!dvsAtOrigin) {
|
|
62787
|
+
return;
|
|
62788
|
+
}
|
|
62789
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
62790
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
62791
|
+
}
|
|
62792
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
62793
|
+
}
|
|
62794
|
+
autofillCell(sheetId, data) {
|
|
62795
|
+
this.dispatch("UPDATE_CELL", {
|
|
62796
|
+
sheetId,
|
|
62797
|
+
col: data.col,
|
|
62798
|
+
row: data.row,
|
|
62799
|
+
content: data.content || "",
|
|
62800
|
+
style: data.style || null,
|
|
62801
|
+
format: data.format || "",
|
|
62802
|
+
});
|
|
62803
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
62804
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
62805
|
+
}
|
|
62806
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
62807
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
62808
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
62809
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
62810
|
+
sheetId,
|
|
62811
|
+
border,
|
|
62812
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
62813
|
+
});
|
|
62814
|
+
}
|
|
62815
|
+
}
|
|
62816
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
62817
|
+
for (const cfId in cfNewRanges) {
|
|
62818
|
+
const changes = cfNewRanges[cfId];
|
|
62819
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
62820
|
+
if (!cf) {
|
|
62821
|
+
continue;
|
|
62822
|
+
}
|
|
62823
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
62824
|
+
if (newCfRanges) {
|
|
62825
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
62826
|
+
cf: {
|
|
62827
|
+
id: cf.id,
|
|
62828
|
+
rule: cf.rule,
|
|
62829
|
+
stopIfTrue: cf.stopIfTrue,
|
|
62830
|
+
},
|
|
62831
|
+
ranges: newCfRanges,
|
|
62832
|
+
sheetId,
|
|
62833
|
+
});
|
|
62834
|
+
}
|
|
62835
|
+
}
|
|
62836
|
+
}
|
|
62837
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
62838
|
+
for (const dvId in dvNewZones) {
|
|
62839
|
+
const changes = dvNewZones[dvId];
|
|
62840
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
62841
|
+
if (!dvOrigin) {
|
|
62842
|
+
continue;
|
|
62843
|
+
}
|
|
62844
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
62845
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
62846
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
62847
|
+
rule: dvOrigin,
|
|
62848
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
62849
|
+
sheetId,
|
|
62850
|
+
});
|
|
62851
|
+
}
|
|
62852
|
+
}
|
|
62700
62853
|
/**
|
|
62701
62854
|
* Select a cell which becomes the last cell of the autofillZone
|
|
62702
62855
|
*/
|
|
@@ -62775,22 +62928,20 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62775
62928
|
/**
|
|
62776
62929
|
* Generate the next cell
|
|
62777
62930
|
*/
|
|
62778
|
-
computeNewCell(generator, col, row
|
|
62931
|
+
computeNewCell(generator, col, row) {
|
|
62779
62932
|
const { cellData, tooltip, origin } = generator.next();
|
|
62780
62933
|
const { content, style, border, format } = cellData;
|
|
62781
62934
|
this.tooltip = tooltip;
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62787
|
-
|
|
62788
|
-
|
|
62789
|
-
|
|
62790
|
-
|
|
62791
|
-
|
|
62792
|
-
});
|
|
62793
|
-
}
|
|
62935
|
+
return {
|
|
62936
|
+
originCol: origin.col,
|
|
62937
|
+
originRow: origin.row,
|
|
62938
|
+
col,
|
|
62939
|
+
row,
|
|
62940
|
+
content,
|
|
62941
|
+
style,
|
|
62942
|
+
border,
|
|
62943
|
+
format,
|
|
62944
|
+
};
|
|
62794
62945
|
}
|
|
62795
62946
|
/**
|
|
62796
62947
|
* Get the rule associated to the current cell
|
|
@@ -62858,8 +63009,8 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62858
63009
|
? position[first].value
|
|
62859
63010
|
: position[second].value;
|
|
62860
63011
|
}
|
|
62861
|
-
|
|
62862
|
-
const
|
|
63012
|
+
autofillMerge(sheetId, data) {
|
|
63013
|
+
const { originCol, originRow, col, row } = data;
|
|
62863
63014
|
const position = { sheetId, col, row };
|
|
62864
63015
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
62865
63016
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -62886,35 +63037,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
62886
63037
|
});
|
|
62887
63038
|
}
|
|
62888
63039
|
}
|
|
62889
|
-
autofillCF(originCol, originRow, col, row) {
|
|
62890
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62891
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
62892
|
-
for (const cf of cfOrigin) {
|
|
62893
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
62894
|
-
if (newCfRanges) {
|
|
62895
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
62896
|
-
cf: deepCopy(cf),
|
|
62897
|
-
ranges: newCfRanges,
|
|
62898
|
-
sheetId,
|
|
62899
|
-
});
|
|
62900
|
-
}
|
|
62901
|
-
}
|
|
62902
|
-
}
|
|
62903
|
-
autofillDV(originCol, originRow, col, row) {
|
|
62904
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62905
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
62906
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
62907
|
-
if (!dvOrigin) {
|
|
62908
|
-
return;
|
|
62909
|
-
}
|
|
62910
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
62911
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
62912
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
62913
|
-
rule: dvOrigin,
|
|
62914
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
62915
|
-
sheetId,
|
|
62916
|
-
});
|
|
62917
|
-
}
|
|
62918
63040
|
// ---------------------------------------------------------------------------
|
|
62919
63041
|
// Grid rendering
|
|
62920
63042
|
// ---------------------------------------------------------------------------
|
|
@@ -63294,10 +63416,8 @@ function mergeTransformation(toTransform, executed) {
|
|
|
63294
63416
|
}
|
|
63295
63417
|
const target = [];
|
|
63296
63418
|
for (const zone1 of toTransform.target) {
|
|
63297
|
-
|
|
63298
|
-
|
|
63299
|
-
target.push({ ...zone1 });
|
|
63300
|
-
}
|
|
63419
|
+
if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
|
|
63420
|
+
target.push(zone1);
|
|
63301
63421
|
}
|
|
63302
63422
|
}
|
|
63303
63423
|
if (target.length) {
|
|
@@ -69569,6 +69689,10 @@ class SpreadsheetDashboard extends Component {
|
|
|
69569
69689
|
this.hoveredCell.clear();
|
|
69570
69690
|
});
|
|
69571
69691
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
69692
|
+
useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
|
|
69693
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
69694
|
+
return scrollY > 0;
|
|
69695
|
+
});
|
|
69572
69696
|
}
|
|
69573
69697
|
onCellHovered({ col, row }) {
|
|
69574
69698
|
this.hoveredCell.hover({ col, row });
|
|
@@ -75599,6 +75723,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
75599
75723
|
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 };
|
|
75600
75724
|
|
|
75601
75725
|
|
|
75602
|
-
__info__.version = "18.1.
|
|
75603
|
-
__info__.date = "2025-04-
|
|
75604
|
-
__info__.hash = "
|
|
75726
|
+
__info__.version = "18.1.16";
|
|
75727
|
+
__info__.date = "2025-04-18T16:24:16.854Z";
|
|
75728
|
+
__info__.hash = "19f6de2";
|