@odoo/o-spreadsheet 17.4.18 → 17.4.19
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 +108 -45
- package/dist/o-spreadsheet.d.ts +17 -4
- package/dist/o-spreadsheet.esm.js +108 -45
- package/dist/o-spreadsheet.iife.js +108 -45
- package/dist/o-spreadsheet.iife.min.js +6 -6
- 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 17.4.
|
|
6
|
-
* @date 2025-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.19
|
|
6
|
+
* @date 2025-01-27T10:04:10.249Z
|
|
7
|
+
* @hash f2a7840
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -3014,15 +3014,18 @@
|
|
|
3014
3014
|
let currentIndex;
|
|
3015
3015
|
let currentVal;
|
|
3016
3016
|
let currentType;
|
|
3017
|
+
const getValue = sortOrder === "desc"
|
|
3018
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
3019
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
3017
3020
|
while (indexRight - indexLeft >= 0) {
|
|
3018
3021
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
3019
3022
|
currentIndex = indexMedian;
|
|
3020
|
-
currentVal =
|
|
3023
|
+
currentVal = getValue(currentIndex);
|
|
3021
3024
|
currentType = typeof currentVal;
|
|
3022
3025
|
// 1 - linear search to find value with the same type
|
|
3023
3026
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
3024
3027
|
currentIndex--;
|
|
3025
|
-
currentVal =
|
|
3028
|
+
currentVal = getValue(currentIndex);
|
|
3026
3029
|
currentType = typeof currentVal;
|
|
3027
3030
|
}
|
|
3028
3031
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -3038,8 +3041,7 @@
|
|
|
3038
3041
|
if (matchVal === undefined ||
|
|
3039
3042
|
matchVal === null ||
|
|
3040
3043
|
matchVal < currentVal ||
|
|
3041
|
-
(matchVal === currentVal &&
|
|
3042
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3044
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3043
3045
|
matchVal = currentVal;
|
|
3044
3046
|
matchValIndex = currentIndex;
|
|
3045
3047
|
}
|
|
@@ -3047,15 +3049,13 @@
|
|
|
3047
3049
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
3048
3050
|
if (matchVal === undefined ||
|
|
3049
3051
|
matchVal > currentVal ||
|
|
3050
|
-
(matchVal === currentVal &&
|
|
3051
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3052
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3052
3053
|
matchVal = currentVal;
|
|
3053
3054
|
matchValIndex = currentIndex;
|
|
3054
3055
|
}
|
|
3055
3056
|
}
|
|
3056
3057
|
// 3 - give new indexes for the Binary search
|
|
3057
|
-
if ((
|
|
3058
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
3058
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
3059
3059
|
indexRight = currentIndex - 1;
|
|
3060
3060
|
}
|
|
3061
3061
|
else {
|
|
@@ -3063,7 +3063,10 @@
|
|
|
3063
3063
|
}
|
|
3064
3064
|
}
|
|
3065
3065
|
// note that valMinIndex could be 0
|
|
3066
|
-
|
|
3066
|
+
if (matchValIndex === undefined) {
|
|
3067
|
+
return -1;
|
|
3068
|
+
}
|
|
3069
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
3067
3070
|
}
|
|
3068
3071
|
/**
|
|
3069
3072
|
* Perform a linear search and return the index of the match.
|
|
@@ -26458,6 +26461,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26458
26461
|
this.currentDisplayValue = newDisplay;
|
|
26459
26462
|
if (!anchor)
|
|
26460
26463
|
return;
|
|
26464
|
+
el.style.top = "";
|
|
26465
|
+
el.style.left = "";
|
|
26466
|
+
el.style["max-height"] = "";
|
|
26467
|
+
el.style["max-width"] = "";
|
|
26461
26468
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
26462
26469
|
let elDims = {
|
|
26463
26470
|
width: el.getBoundingClientRect().width,
|
|
@@ -39450,7 +39457,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39450
39457
|
return;
|
|
39451
39458
|
}
|
|
39452
39459
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
39453
|
-
const zone = this.env.model.getters.
|
|
39460
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
39454
39461
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
39455
39462
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
39456
39463
|
this.isCellReferenceVisible = true;
|
|
@@ -41205,13 +41212,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41205
41212
|
drawLayer(renderingContext, layer) {
|
|
41206
41213
|
switch (layer) {
|
|
41207
41214
|
case "Background":
|
|
41208
|
-
|
|
41209
|
-
this.
|
|
41210
|
-
|
|
41211
|
-
|
|
41212
|
-
|
|
41213
|
-
|
|
41214
|
-
|
|
41215
|
+
this.drawGlobalBackground(renderingContext);
|
|
41216
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
41217
|
+
const { ctx } = renderingContext;
|
|
41218
|
+
ctx.save();
|
|
41219
|
+
ctx.beginPath();
|
|
41220
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
41221
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
41222
|
+
ctx.clip();
|
|
41223
|
+
const boxes = this.getGridBoxes(zone);
|
|
41224
|
+
this.drawBackground(renderingContext, boxes);
|
|
41225
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
41226
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
41227
|
+
this.drawBorders(renderingContext, boxes);
|
|
41228
|
+
this.drawTexts(renderingContext, boxes);
|
|
41229
|
+
this.drawIcon(renderingContext, boxes);
|
|
41230
|
+
ctx.restore();
|
|
41231
|
+
}
|
|
41215
41232
|
this.drawFrozenPanes(renderingContext);
|
|
41216
41233
|
break;
|
|
41217
41234
|
case "Headers":
|
|
@@ -41222,12 +41239,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41222
41239
|
break;
|
|
41223
41240
|
}
|
|
41224
41241
|
}
|
|
41225
|
-
|
|
41226
|
-
const { ctx
|
|
41242
|
+
drawGlobalBackground(renderingContext) {
|
|
41243
|
+
const { ctx } = renderingContext;
|
|
41227
41244
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
41228
41245
|
// white background
|
|
41229
41246
|
ctx.fillStyle = "#ffffff";
|
|
41230
41247
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
41248
|
+
}
|
|
41249
|
+
drawBackground(renderingContext, boxes) {
|
|
41250
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
41231
41251
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
41232
41252
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
41233
41253
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -41652,7 +41672,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41652
41672
|
const position = { sheetId, col, row };
|
|
41653
41673
|
const cell = this.getters.getEvaluatedCell(position);
|
|
41654
41674
|
const showFormula = this.getters.shouldShowFormulas();
|
|
41655
|
-
const { x, y, width, height } = this.getters.
|
|
41675
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
41656
41676
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
41657
41677
|
const box = {
|
|
41658
41678
|
x,
|
|
@@ -41768,12 +41788,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41768
41788
|
}
|
|
41769
41789
|
return box;
|
|
41770
41790
|
}
|
|
41771
|
-
getGridBoxes() {
|
|
41791
|
+
getGridBoxes(zone) {
|
|
41772
41792
|
const boxes = [];
|
|
41773
|
-
const visibleCols = this.getters
|
|
41793
|
+
const visibleCols = this.getters
|
|
41794
|
+
.getSheetViewVisibleCols()
|
|
41795
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
41774
41796
|
const left = visibleCols[0];
|
|
41775
41797
|
const right = visibleCols[visibleCols.length - 1];
|
|
41776
|
-
const visibleRows = this.getters
|
|
41798
|
+
const visibleRows = this.getters
|
|
41799
|
+
.getSheetViewVisibleRows()
|
|
41800
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
41777
41801
|
const top = visibleRows[0];
|
|
41778
41802
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
41779
41803
|
const viewport = { left, right, top, bottom };
|
|
@@ -60776,8 +60800,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60776
60800
|
},
|
|
60777
60801
|
];
|
|
60778
60802
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
60803
|
+
const selection = pasteTarget[0];
|
|
60804
|
+
const col = selection.left;
|
|
60805
|
+
const row = selection.top;
|
|
60806
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
60779
60807
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
60780
|
-
let currentIndex = cmd.base;
|
|
60808
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
60781
60809
|
for (const element of toRemove) {
|
|
60782
60810
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
60783
60811
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -61060,22 +61088,33 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61060
61088
|
}
|
|
61061
61089
|
/**
|
|
61062
61090
|
*
|
|
61063
|
-
*
|
|
61064
|
-
*
|
|
61091
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
61092
|
+
*
|
|
61065
61093
|
*/
|
|
61066
|
-
|
|
61094
|
+
getVisibleRect(zone) {
|
|
61067
61095
|
const targetZone = intersection(zone, this);
|
|
61068
61096
|
if (targetZone) {
|
|
61069
61097
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
61070
61098
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
61071
61099
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
61072
61100
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
61073
|
-
return {
|
|
61074
|
-
|
|
61075
|
-
|
|
61076
|
-
|
|
61077
|
-
|
|
61078
|
-
|
|
61101
|
+
return { x, y, width, height };
|
|
61102
|
+
}
|
|
61103
|
+
return undefined;
|
|
61104
|
+
}
|
|
61105
|
+
/**
|
|
61106
|
+
*
|
|
61107
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
61108
|
+
*
|
|
61109
|
+
*/
|
|
61110
|
+
getFullRect(zone) {
|
|
61111
|
+
const targetZone = intersection(zone, this);
|
|
61112
|
+
if (targetZone) {
|
|
61113
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
61114
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
61115
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
61116
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
61117
|
+
return { x, y, width, height };
|
|
61079
61118
|
}
|
|
61080
61119
|
return undefined;
|
|
61081
61120
|
}
|
|
@@ -61245,6 +61284,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61245
61284
|
"isPositionVisible",
|
|
61246
61285
|
"getColDimensionsInViewport",
|
|
61247
61286
|
"getRowDimensionsInViewport",
|
|
61287
|
+
"getAllActiveViewportsZones",
|
|
61288
|
+
"getRect",
|
|
61248
61289
|
];
|
|
61249
61290
|
viewports = {};
|
|
61250
61291
|
/**
|
|
@@ -61631,16 +61672,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61631
61672
|
getVisibleRectWithoutHeaders(zone) {
|
|
61632
61673
|
const sheetId = this.getters.getActiveSheetId();
|
|
61633
61674
|
const viewportRects = this.getSubViewports(sheetId)
|
|
61634
|
-
.map((viewport) => viewport.
|
|
61675
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
61635
61676
|
.filter(isDefined);
|
|
61636
61677
|
if (viewportRects.length === 0) {
|
|
61637
61678
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61638
61679
|
}
|
|
61639
|
-
|
|
61640
|
-
|
|
61641
|
-
|
|
61642
|
-
|
|
61643
|
-
|
|
61680
|
+
return this.recomposeRect(viewportRects);
|
|
61681
|
+
}
|
|
61682
|
+
/**
|
|
61683
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
61684
|
+
* regardless of the viewport dimensions.
|
|
61685
|
+
*/
|
|
61686
|
+
getRect(zone) {
|
|
61687
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61688
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
61689
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
61690
|
+
.filter(isDefined);
|
|
61691
|
+
if (viewportRects.length === 0) {
|
|
61692
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61693
|
+
}
|
|
61694
|
+
const rect = this.recomposeRect(viewportRects);
|
|
61695
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
61644
61696
|
}
|
|
61645
61697
|
/**
|
|
61646
61698
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -61684,6 +61736,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61684
61736
|
end: start + (isRowHidden ? 0 : size),
|
|
61685
61737
|
};
|
|
61686
61738
|
}
|
|
61739
|
+
getAllActiveViewportsZones() {
|
|
61740
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61741
|
+
return this.getSubViewports(sheetId);
|
|
61742
|
+
}
|
|
61687
61743
|
// ---------------------------------------------------------------------------
|
|
61688
61744
|
// Private
|
|
61689
61745
|
// ---------------------------------------------------------------------------
|
|
@@ -61874,6 +61930,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61874
61930
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
61875
61931
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
61876
61932
|
}
|
|
61933
|
+
recomposeRect(viewportRects) {
|
|
61934
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
61935
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
61936
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
61937
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
61938
|
+
return { x, y, width, height };
|
|
61939
|
+
}
|
|
61877
61940
|
}
|
|
61878
61941
|
|
|
61879
61942
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -68799,9 +68862,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68799
68862
|
exports.tokenize = tokenize;
|
|
68800
68863
|
|
|
68801
68864
|
|
|
68802
|
-
__info__.version = "17.4.
|
|
68803
|
-
__info__.date = "2025-01-
|
|
68804
|
-
__info__.hash = "
|
|
68865
|
+
__info__.version = "17.4.19";
|
|
68866
|
+
__info__.date = "2025-01-27T10:04:10.249Z";
|
|
68867
|
+
__info__.hash = "f2a7840";
|
|
68805
68868
|
|
|
68806
68869
|
|
|
68807
68870
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|