@odoo/o-spreadsheet 18.2.7 → 18.2.8
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 +105 -65
- package/dist/o-spreadsheet.esm.js +105 -65
- package/dist/o-spreadsheet.iife.js +105 -65
- package/dist/o-spreadsheet.iife.min.js +378 -377
- 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.2.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.8
|
|
6
|
+
* @date 2025-04-18T16:26:20.673Z
|
|
7
|
+
* @hash 5da9ddc
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -6899,6 +6899,12 @@
|
|
|
6899
6899
|
}
|
|
6900
6900
|
return null;
|
|
6901
6901
|
}
|
|
6902
|
+
/**
|
|
6903
|
+
- \p{L} is for any letter (from any language)
|
|
6904
|
+
- \p{N} is for any number
|
|
6905
|
+
- the u flag at the end is for unicode, which enables the `\p{...}` syntax
|
|
6906
|
+
*/
|
|
6907
|
+
const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
|
|
6902
6908
|
const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
|
|
6903
6909
|
/**
|
|
6904
6910
|
* A "Symbol" is just basically any word-like element that can appear in a
|
|
@@ -6939,7 +6945,8 @@
|
|
|
6939
6945
|
};
|
|
6940
6946
|
}
|
|
6941
6947
|
}
|
|
6942
|
-
while (chars.current &&
|
|
6948
|
+
while (chars.current &&
|
|
6949
|
+
(SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
|
|
6943
6950
|
result += chars.shift();
|
|
6944
6951
|
}
|
|
6945
6952
|
if (result.length) {
|
|
@@ -9246,7 +9253,7 @@
|
|
|
9246
9253
|
if (executed.type === "ADD_COLUMNS_ROWS") {
|
|
9247
9254
|
return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
|
|
9248
9255
|
}
|
|
9249
|
-
return
|
|
9256
|
+
return zone;
|
|
9250
9257
|
}
|
|
9251
9258
|
function transformRangeData(range, executed) {
|
|
9252
9259
|
const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
|
|
@@ -33637,6 +33644,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33637
33644
|
function isCtrlKey(ev) {
|
|
33638
33645
|
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
33639
33646
|
}
|
|
33647
|
+
/**
|
|
33648
|
+
* Detects if the current browser is Firefox
|
|
33649
|
+
*/
|
|
33650
|
+
function isBrowserFirefox() {
|
|
33651
|
+
return /Firefox/i.test(navigator.userAgent);
|
|
33652
|
+
}
|
|
33640
33653
|
|
|
33641
33654
|
/**
|
|
33642
33655
|
* Repeatedly calls a callback function with a time delay between calls.
|
|
@@ -50432,39 +50445,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50432
50445
|
}
|
|
50433
50446
|
return hoveredPosition;
|
|
50434
50447
|
}
|
|
50435
|
-
function useTouchMove(gridRef, handler, canMoveUp) {
|
|
50436
|
-
let x = null;
|
|
50437
|
-
let y = null;
|
|
50438
|
-
function onTouchStart(ev) {
|
|
50439
|
-
if (ev.touches.length !== 1)
|
|
50440
|
-
return;
|
|
50441
|
-
x = ev.touches[0].clientX;
|
|
50442
|
-
y = ev.touches[0].clientY;
|
|
50443
|
-
}
|
|
50444
|
-
function onTouchEnd() {
|
|
50445
|
-
x = null;
|
|
50446
|
-
y = null;
|
|
50447
|
-
}
|
|
50448
|
-
function onTouchMove(ev) {
|
|
50449
|
-
if (ev.touches.length !== 1)
|
|
50450
|
-
return;
|
|
50451
|
-
// On mobile browsers, swiping down is often associated with "pull to refresh".
|
|
50452
|
-
// We only want this behavior if the grid is already at the top.
|
|
50453
|
-
// Otherwise we only want to move the canvas up, without triggering any refresh.
|
|
50454
|
-
if (canMoveUp()) {
|
|
50455
|
-
ev.preventDefault();
|
|
50456
|
-
ev.stopPropagation();
|
|
50457
|
-
}
|
|
50458
|
-
const currentX = ev.touches[0].clientX;
|
|
50459
|
-
const currentY = ev.touches[0].clientY;
|
|
50460
|
-
handler(x - currentX, y - currentY);
|
|
50461
|
-
x = currentX;
|
|
50462
|
-
y = currentY;
|
|
50463
|
-
}
|
|
50464
|
-
useRefListener(gridRef, "touchstart", onTouchStart);
|
|
50465
|
-
useRefListener(gridRef, "touchend", onTouchEnd);
|
|
50466
|
-
useRefListener(gridRef, "touchmove", onTouchMove);
|
|
50467
|
-
}
|
|
50468
50448
|
class GridOverlay extends owl.Component {
|
|
50469
50449
|
static template = "o-spreadsheet-GridOverlay";
|
|
50470
50450
|
static props = {
|
|
@@ -50512,10 +50492,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50512
50492
|
owl.onWillUnmount(() => {
|
|
50513
50493
|
resizeObserver.disconnect();
|
|
50514
50494
|
});
|
|
50515
|
-
useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
|
|
50516
|
-
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
50517
|
-
return scrollY > 0;
|
|
50518
|
-
});
|
|
50519
50495
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
50520
50496
|
this.paintFormatStore = useStore(PaintFormatStore);
|
|
50521
50497
|
}
|
|
@@ -51987,6 +51963,73 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51987
51963
|
}
|
|
51988
51964
|
}
|
|
51989
51965
|
|
|
51966
|
+
const friction = 0.95;
|
|
51967
|
+
const verticalScrollFactor = 1;
|
|
51968
|
+
const horizontalScrollFactor = 1;
|
|
51969
|
+
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
51970
|
+
let lastX = 0;
|
|
51971
|
+
let lastY = 0;
|
|
51972
|
+
let velocityX = 0;
|
|
51973
|
+
let velocityY = 0;
|
|
51974
|
+
let isMouseDown = false;
|
|
51975
|
+
let lastTime = 0;
|
|
51976
|
+
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
51977
|
+
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
51978
|
+
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
51979
|
+
function onTouchStart(event) {
|
|
51980
|
+
isMouseDown = true;
|
|
51981
|
+
({ clientX: lastX, clientY: lastY } = event.touches[0]);
|
|
51982
|
+
velocityX = 0;
|
|
51983
|
+
velocityY = 0;
|
|
51984
|
+
}
|
|
51985
|
+
function onTouchMove(event) {
|
|
51986
|
+
if (!isMouseDown)
|
|
51987
|
+
return;
|
|
51988
|
+
const currentTime = Date.now();
|
|
51989
|
+
const { clientX, clientY } = event.touches[0];
|
|
51990
|
+
let deltaX = lastX - clientX;
|
|
51991
|
+
let deltaY = lastY - clientY;
|
|
51992
|
+
const elapsedTime = currentTime - lastTime;
|
|
51993
|
+
velocityX = deltaX / elapsedTime;
|
|
51994
|
+
velocityY = deltaY / elapsedTime;
|
|
51995
|
+
lastX = clientX;
|
|
51996
|
+
lastY = clientY;
|
|
51997
|
+
lastTime = currentTime;
|
|
51998
|
+
if (canMoveUp()) {
|
|
51999
|
+
if (event.cancelable) {
|
|
52000
|
+
event.preventDefault();
|
|
52001
|
+
}
|
|
52002
|
+
event.stopPropagation();
|
|
52003
|
+
}
|
|
52004
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
52005
|
+
}
|
|
52006
|
+
function onTouchEnd(ev) {
|
|
52007
|
+
isMouseDown = false;
|
|
52008
|
+
lastX = lastY = 0;
|
|
52009
|
+
requestAnimationFrame(scroll);
|
|
52010
|
+
}
|
|
52011
|
+
function scroll() {
|
|
52012
|
+
if (Math.abs(velocityX) < 0.05) {
|
|
52013
|
+
velocityX = 0;
|
|
52014
|
+
}
|
|
52015
|
+
if (Math.abs(velocityY) < 0.05) {
|
|
52016
|
+
velocityY = 0;
|
|
52017
|
+
}
|
|
52018
|
+
if (!velocityX && !velocityY) {
|
|
52019
|
+
return;
|
|
52020
|
+
}
|
|
52021
|
+
const currentTime = Date.now();
|
|
52022
|
+
const elapsedTime = Math.abs(currentTime - lastTime);
|
|
52023
|
+
const deltaX = velocityX * elapsedTime;
|
|
52024
|
+
const deltaY = velocityY * elapsedTime;
|
|
52025
|
+
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
52026
|
+
lastTime = currentTime;
|
|
52027
|
+
velocityX *= friction;
|
|
52028
|
+
velocityY *= friction;
|
|
52029
|
+
requestAnimationFrame(scroll);
|
|
52030
|
+
}
|
|
52031
|
+
}
|
|
52032
|
+
|
|
51990
52033
|
function useWheelHandler(handler) {
|
|
51991
52034
|
function normalize(val, deltaMode) {
|
|
51992
52035
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
@@ -52327,7 +52370,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52327
52370
|
left: `${this.props.leftOffset + x}px`,
|
|
52328
52371
|
bottom: "0px",
|
|
52329
52372
|
height: `${SCROLLBAR_WIDTH}px`,
|
|
52330
|
-
right: `
|
|
52373
|
+
right: isBrowserFirefox() ? `${SCROLLBAR_WIDTH}px` : "0",
|
|
52331
52374
|
};
|
|
52332
52375
|
}
|
|
52333
52376
|
onScroll(offset) {
|
|
@@ -52372,7 +52415,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52372
52415
|
top: `${this.props.topOffset + y}px`,
|
|
52373
52416
|
right: "0px",
|
|
52374
52417
|
width: `${SCROLLBAR_WIDTH}px`,
|
|
52375
|
-
bottom: `
|
|
52418
|
+
bottom: isBrowserFirefox() ? `${SCROLLBAR_WIDTH}px` : "0",
|
|
52376
52419
|
};
|
|
52377
52420
|
}
|
|
52378
52421
|
onScroll(offset) {
|
|
@@ -52608,6 +52651,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52608
52651
|
this.DOMFocusableElementStore.focusableElement?.focus();
|
|
52609
52652
|
}
|
|
52610
52653
|
}, () => [this.sidePanel.isOpen]);
|
|
52654
|
+
useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
|
|
52655
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
52656
|
+
return scrollY > 0;
|
|
52657
|
+
});
|
|
52611
52658
|
}
|
|
52612
52659
|
onCellHovered({ col, row }) {
|
|
52613
52660
|
this.hoveredCell.hover({ col, row });
|
|
@@ -63853,10 +63900,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63853
63900
|
}
|
|
63854
63901
|
const target = [];
|
|
63855
63902
|
for (const zone1 of toTransform.target) {
|
|
63856
|
-
|
|
63857
|
-
|
|
63858
|
-
target.push({ ...zone1 });
|
|
63859
|
-
}
|
|
63903
|
+
if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
|
|
63904
|
+
target.push(zone1);
|
|
63860
63905
|
}
|
|
63861
63906
|
}
|
|
63862
63907
|
if (target.length) {
|
|
@@ -67988,24 +68033,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67988
68033
|
first: this.boundaries.top,
|
|
67989
68034
|
last: this.boundaries.bottom,
|
|
67990
68035
|
});
|
|
67991
|
-
const { end: lastColEnd
|
|
67992
|
-
const { end: lastRowEnd
|
|
67993
|
-
const leftColIndex = this.searchHeaderIndex("COL", lastColEnd - this.viewportWidth, 0);
|
|
67994
|
-
const leftColSize = this.getters.getColSize(this.sheetId, leftColIndex);
|
|
67995
|
-
const leftRowIndex = this.searchHeaderIndex("ROW", lastRowEnd - this.viewportHeight, 0);
|
|
67996
|
-
const topRowSize = this.getters.getRowSize(this.sheetId, leftRowIndex);
|
|
68036
|
+
const { end: lastColEnd } = this.getters.getColDimensions(this.sheetId, lastCol);
|
|
68037
|
+
const { end: lastRowEnd } = this.getters.getRowDimensions(this.sheetId, lastRow);
|
|
67997
68038
|
let width = lastColEnd - this.offsetCorrectionX;
|
|
67998
68039
|
if (this.canScrollHorizontally) {
|
|
67999
|
-
width += Math.max(DEFAULT_CELL_WIDTH, // leave some minimal space to let the user know they scrolled all the way
|
|
68000
|
-
Math.min(leftColSize, this.viewportWidth - lastColSize) // Add pixels that allows the snapping at maximum horizontal scroll
|
|
68001
|
-
);
|
|
68002
68040
|
width = Math.max(width, this.viewportWidth); // if the viewport grid size is smaller than its client width, return client width
|
|
68003
68041
|
}
|
|
68004
68042
|
let height = lastRowEnd - this.offsetCorrectionY;
|
|
68005
68043
|
if (this.canScrollVertically) {
|
|
68006
|
-
height += Math.max(DEFAULT_CELL_HEIGHT + 5, // leave some space to let the user know they scrolled all the way
|
|
68007
|
-
Math.min(topRowSize, this.viewportHeight - lastRowSize) // Add pixels that allows the snapping at maximum vertical scroll
|
|
68008
|
-
);
|
|
68009
68044
|
height = Math.max(height, this.viewportHeight); // if the viewport grid size is smaller than its client height, return client height
|
|
68010
68045
|
if (lastRowEnd + FOOTER_HEIGHT > height && !this.getters.isReadonly()) {
|
|
68011
68046
|
height += FOOTER_HEIGHT;
|
|
@@ -68570,8 +68605,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68570
68605
|
const { width, height } = this.getMainViewportRect();
|
|
68571
68606
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
68572
68607
|
return {
|
|
68573
|
-
maxOffsetX: Math.max(0, width - viewport.viewportWidth
|
|
68574
|
-
maxOffsetY: Math.max(0, height - viewport.viewportHeight
|
|
68608
|
+
maxOffsetX: Math.max(0, width - viewport.viewportWidth),
|
|
68609
|
+
maxOffsetY: Math.max(0, height - viewport.viewportHeight),
|
|
68575
68610
|
};
|
|
68576
68611
|
}
|
|
68577
68612
|
getColRowOffsetInViewport(dimension, referenceHeaderIndex, targetHeaderIndex) {
|
|
@@ -70093,6 +70128,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70093
70128
|
this.hoveredCell.clear();
|
|
70094
70129
|
});
|
|
70095
70130
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
70131
|
+
useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
|
|
70132
|
+
const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
|
|
70133
|
+
return scrollY > 0;
|
|
70134
|
+
});
|
|
70096
70135
|
}
|
|
70097
70136
|
onCellHovered({ col, row }) {
|
|
70098
70137
|
this.hoveredCell.hover({ col, row });
|
|
@@ -71483,6 +71522,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71483
71522
|
> canvas {
|
|
71484
71523
|
box-sizing: content-box;
|
|
71485
71524
|
border-bottom: 1px solid #e2e3e3;
|
|
71525
|
+
border-right: 1px solid #e2e3e3;
|
|
71486
71526
|
}
|
|
71487
71527
|
|
|
71488
71528
|
.o-grid-overlay {
|
|
@@ -76189,9 +76229,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76189
76229
|
exports.tokenize = tokenize;
|
|
76190
76230
|
|
|
76191
76231
|
|
|
76192
|
-
__info__.version = "18.2.
|
|
76193
|
-
__info__.date = "2025-04-
|
|
76194
|
-
__info__.hash = "
|
|
76232
|
+
__info__.version = "18.2.8";
|
|
76233
|
+
__info__.date = "2025-04-18T16:26:20.673Z";
|
|
76234
|
+
__info__.hash = "5da9ddc";
|
|
76195
76235
|
|
|
76196
76236
|
|
|
76197
76237
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|