@odoo/o-spreadsheet 18.1.2 → 18.1.3
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 +113 -113
- package/dist/o_spreadsheet.xml +11 -5
- 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-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.3
|
|
6
|
+
* @date 2025-01-27T10:50:23.000Z
|
|
7
|
+
* @hash 7ffac1e
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -4379,15 +4379,18 @@
|
|
|
4379
4379
|
let currentIndex;
|
|
4380
4380
|
let currentVal;
|
|
4381
4381
|
let currentType;
|
|
4382
|
+
const getValue = sortOrder === "desc"
|
|
4383
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
4384
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
4382
4385
|
while (indexRight - indexLeft >= 0) {
|
|
4383
4386
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
4384
4387
|
currentIndex = indexMedian;
|
|
4385
|
-
currentVal =
|
|
4388
|
+
currentVal = getValue(currentIndex);
|
|
4386
4389
|
currentType = typeof currentVal;
|
|
4387
4390
|
// 1 - linear search to find value with the same type
|
|
4388
4391
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
4389
4392
|
currentIndex--;
|
|
4390
|
-
currentVal =
|
|
4393
|
+
currentVal = getValue(currentIndex);
|
|
4391
4394
|
currentType = typeof currentVal;
|
|
4392
4395
|
}
|
|
4393
4396
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -4403,8 +4406,7 @@
|
|
|
4403
4406
|
if (matchVal === undefined ||
|
|
4404
4407
|
matchVal === null ||
|
|
4405
4408
|
matchVal < currentVal ||
|
|
4406
|
-
(matchVal === currentVal &&
|
|
4407
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
4409
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
4408
4410
|
matchVal = currentVal;
|
|
4409
4411
|
matchValIndex = currentIndex;
|
|
4410
4412
|
}
|
|
@@ -4412,15 +4414,13 @@
|
|
|
4412
4414
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
4413
4415
|
if (matchVal === undefined ||
|
|
4414
4416
|
matchVal > currentVal ||
|
|
4415
|
-
(matchVal === currentVal &&
|
|
4416
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
4417
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
4417
4418
|
matchVal = currentVal;
|
|
4418
4419
|
matchValIndex = currentIndex;
|
|
4419
4420
|
}
|
|
4420
4421
|
}
|
|
4421
4422
|
// 3 - give new indexes for the Binary search
|
|
4422
|
-
if ((
|
|
4423
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
4423
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
4424
4424
|
indexRight = currentIndex - 1;
|
|
4425
4425
|
}
|
|
4426
4426
|
else {
|
|
@@ -4428,7 +4428,10 @@
|
|
|
4428
4428
|
}
|
|
4429
4429
|
}
|
|
4430
4430
|
// note that valMinIndex could be 0
|
|
4431
|
-
|
|
4431
|
+
if (matchValIndex === undefined) {
|
|
4432
|
+
return -1;
|
|
4433
|
+
}
|
|
4434
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
4432
4435
|
}
|
|
4433
4436
|
/**
|
|
4434
4437
|
* Perform a linear search and return the index of the match.
|
|
@@ -32202,6 +32205,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32202
32205
|
this.currentDisplayValue = newDisplay;
|
|
32203
32206
|
if (!anchor)
|
|
32204
32207
|
return;
|
|
32208
|
+
el.style.top = "";
|
|
32209
|
+
el.style.left = "";
|
|
32210
|
+
el.style["max-height"] = "";
|
|
32211
|
+
el.style["max-width"] = "";
|
|
32205
32212
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
32206
32213
|
let elDims = {
|
|
32207
32214
|
width: el.getBoundingClientRect().width,
|
|
@@ -48637,7 +48644,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48637
48644
|
return;
|
|
48638
48645
|
}
|
|
48639
48646
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
48640
|
-
const zone = this.env.model.getters.
|
|
48647
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
48641
48648
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
48642
48649
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
48643
48650
|
this.isCellReferenceVisible = true;
|
|
@@ -50473,13 +50480,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50473
50480
|
drawLayer(renderingContext, layer) {
|
|
50474
50481
|
switch (layer) {
|
|
50475
50482
|
case "Background":
|
|
50476
|
-
|
|
50477
|
-
this.
|
|
50478
|
-
|
|
50479
|
-
|
|
50480
|
-
|
|
50481
|
-
|
|
50482
|
-
|
|
50483
|
+
this.drawGlobalBackground(renderingContext);
|
|
50484
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
50485
|
+
const { ctx } = renderingContext;
|
|
50486
|
+
ctx.save();
|
|
50487
|
+
ctx.beginPath();
|
|
50488
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
50489
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
50490
|
+
ctx.clip();
|
|
50491
|
+
const boxes = this.getGridBoxes(zone);
|
|
50492
|
+
this.drawBackground(renderingContext, boxes);
|
|
50493
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
50494
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
50495
|
+
this.drawBorders(renderingContext, boxes);
|
|
50496
|
+
this.drawTexts(renderingContext, boxes);
|
|
50497
|
+
this.drawIcon(renderingContext, boxes);
|
|
50498
|
+
ctx.restore();
|
|
50499
|
+
}
|
|
50483
50500
|
this.drawFrozenPanes(renderingContext);
|
|
50484
50501
|
break;
|
|
50485
50502
|
case "Headers":
|
|
@@ -50490,12 +50507,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50490
50507
|
break;
|
|
50491
50508
|
}
|
|
50492
50509
|
}
|
|
50493
|
-
|
|
50494
|
-
const { ctx
|
|
50510
|
+
drawGlobalBackground(renderingContext) {
|
|
50511
|
+
const { ctx } = renderingContext;
|
|
50495
50512
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
50496
50513
|
// white background
|
|
50497
50514
|
ctx.fillStyle = "#ffffff";
|
|
50498
50515
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
50516
|
+
}
|
|
50517
|
+
drawBackground(renderingContext, boxes) {
|
|
50518
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
50499
50519
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
50500
50520
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
50501
50521
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -50926,7 +50946,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50926
50946
|
const position = { sheetId, col, row };
|
|
50927
50947
|
const cell = this.getters.getEvaluatedCell(position);
|
|
50928
50948
|
const showFormula = this.getters.shouldShowFormulas();
|
|
50929
|
-
const { x, y, width, height } = this.getters.
|
|
50949
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
50930
50950
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
50931
50951
|
let style = this.getters.getCellComputedStyle(position);
|
|
50932
50952
|
if (this.fingerprints.isEnabled) {
|
|
@@ -51051,12 +51071,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51051
51071
|
}
|
|
51052
51072
|
return box;
|
|
51053
51073
|
}
|
|
51054
|
-
getGridBoxes() {
|
|
51074
|
+
getGridBoxes(zone) {
|
|
51055
51075
|
const boxes = [];
|
|
51056
|
-
const visibleCols = this.getters
|
|
51076
|
+
const visibleCols = this.getters
|
|
51077
|
+
.getSheetViewVisibleCols()
|
|
51078
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
51057
51079
|
const left = visibleCols[0];
|
|
51058
51080
|
const right = visibleCols[visibleCols.length - 1];
|
|
51059
|
-
const visibleRows = this.getters
|
|
51081
|
+
const visibleRows = this.getters
|
|
51082
|
+
.getSheetViewVisibleRows()
|
|
51083
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
51060
51084
|
const top = visibleRows[0];
|
|
51061
51085
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
51062
51086
|
const viewport = { left, right, top, bottom };
|
|
@@ -66722,8 +66746,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66722
66746
|
},
|
|
66723
66747
|
];
|
|
66724
66748
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
66749
|
+
const selection = pasteTarget[0];
|
|
66750
|
+
const col = selection.left;
|
|
66751
|
+
const row = selection.top;
|
|
66752
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
66725
66753
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
66726
|
-
let currentIndex = cmd.base;
|
|
66754
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
66727
66755
|
const resizingGroups = {};
|
|
66728
66756
|
for (const element of toRemove) {
|
|
66729
66757
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
@@ -67014,22 +67042,33 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67014
67042
|
}
|
|
67015
67043
|
/**
|
|
67016
67044
|
*
|
|
67017
|
-
*
|
|
67018
|
-
*
|
|
67045
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
67046
|
+
*
|
|
67019
67047
|
*/
|
|
67020
|
-
|
|
67048
|
+
getVisibleRect(zone) {
|
|
67021
67049
|
const targetZone = intersection(zone, this);
|
|
67022
67050
|
if (targetZone) {
|
|
67023
67051
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
67024
67052
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
67025
67053
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
67026
67054
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
67027
|
-
return {
|
|
67028
|
-
|
|
67029
|
-
|
|
67030
|
-
|
|
67031
|
-
|
|
67032
|
-
|
|
67055
|
+
return { x, y, width, height };
|
|
67056
|
+
}
|
|
67057
|
+
return undefined;
|
|
67058
|
+
}
|
|
67059
|
+
/**
|
|
67060
|
+
*
|
|
67061
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
67062
|
+
*
|
|
67063
|
+
*/
|
|
67064
|
+
getFullRect(zone) {
|
|
67065
|
+
const targetZone = intersection(zone, this);
|
|
67066
|
+
if (targetZone) {
|
|
67067
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
67068
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
67069
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
67070
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
67071
|
+
return { x, y, width, height };
|
|
67033
67072
|
}
|
|
67034
67073
|
return undefined;
|
|
67035
67074
|
}
|
|
@@ -67199,6 +67238,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67199
67238
|
"isPositionVisible",
|
|
67200
67239
|
"getColDimensionsInViewport",
|
|
67201
67240
|
"getRowDimensionsInViewport",
|
|
67241
|
+
"getAllActiveViewportsZones",
|
|
67242
|
+
"getRect",
|
|
67202
67243
|
];
|
|
67203
67244
|
viewports = {};
|
|
67204
67245
|
/**
|
|
@@ -67582,16 +67623,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67582
67623
|
getVisibleRectWithoutHeaders(zone) {
|
|
67583
67624
|
const sheetId = this.getters.getActiveSheetId();
|
|
67584
67625
|
const viewportRects = this.getSubViewports(sheetId)
|
|
67585
|
-
.map((viewport) => viewport.
|
|
67626
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
67586
67627
|
.filter(isDefined);
|
|
67587
67628
|
if (viewportRects.length === 0) {
|
|
67588
67629
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67589
67630
|
}
|
|
67590
|
-
|
|
67591
|
-
|
|
67592
|
-
|
|
67593
|
-
|
|
67594
|
-
|
|
67631
|
+
return this.recomposeRect(viewportRects);
|
|
67632
|
+
}
|
|
67633
|
+
/**
|
|
67634
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
67635
|
+
* regardless of the viewport dimensions.
|
|
67636
|
+
*/
|
|
67637
|
+
getRect(zone) {
|
|
67638
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67639
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
67640
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
67641
|
+
.filter(isDefined);
|
|
67642
|
+
if (viewportRects.length === 0) {
|
|
67643
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67644
|
+
}
|
|
67645
|
+
const rect = this.recomposeRect(viewportRects);
|
|
67646
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
67595
67647
|
}
|
|
67596
67648
|
/**
|
|
67597
67649
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -67635,6 +67687,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67635
67687
|
end: start + (isRowHidden ? 0 : size),
|
|
67636
67688
|
};
|
|
67637
67689
|
}
|
|
67690
|
+
getAllActiveViewportsZones() {
|
|
67691
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67692
|
+
return this.getSubViewports(sheetId);
|
|
67693
|
+
}
|
|
67638
67694
|
// ---------------------------------------------------------------------------
|
|
67639
67695
|
// Private
|
|
67640
67696
|
// ---------------------------------------------------------------------------
|
|
@@ -67825,6 +67881,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67825
67881
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
67826
67882
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
67827
67883
|
}
|
|
67884
|
+
recomposeRect(viewportRects) {
|
|
67885
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
67886
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
67887
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
67888
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
67889
|
+
return { x, y, width, height };
|
|
67890
|
+
}
|
|
67828
67891
|
}
|
|
67829
67892
|
|
|
67830
67893
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -74953,9 +75016,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74953
75016
|
exports.tokenize = tokenize;
|
|
74954
75017
|
|
|
74955
75018
|
|
|
74956
|
-
__info__.version = "18.1.
|
|
74957
|
-
__info__.date = "2025-01-
|
|
74958
|
-
__info__.hash = "
|
|
75019
|
+
__info__.version = "18.1.3";
|
|
75020
|
+
__info__.date = "2025-01-27T10:50:23.000Z";
|
|
75021
|
+
__info__.hash = "7ffac1e";
|
|
74959
75022
|
|
|
74960
75023
|
|
|
74961
75024
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|