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