@odoo/o-spreadsheet 17.2.32 → 17.2.34
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 +116 -55
- package/dist/o-spreadsheet.d.ts +17 -4
- package/dist/o-spreadsheet.esm.js +116 -55
- package/dist/o-spreadsheet.iife.js +116 -55
- package/dist/o-spreadsheet.iife.min.js +124 -124
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
5
5
|
* @see https://github.com/odoo/o-spreadsheet
|
|
6
|
-
* @version 17.2.
|
|
7
|
-
* @date 2025-01-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.2.34
|
|
7
|
+
* @date 2025-01-31T07:58:03.953Z
|
|
8
|
+
* @hash 0bffee9
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -1782,11 +1782,11 @@ const getInvaluableSymbolsRegexp = memoize(function getInvaluableSymbolsRegexp(l
|
|
|
1782
1782
|
* number from the point of view of the isNumber function.
|
|
1783
1783
|
*/
|
|
1784
1784
|
function parseNumber(str, locale) {
|
|
1785
|
+
// remove invaluable characters
|
|
1786
|
+
str = str.replace(getInvaluableSymbolsRegexp(locale), "");
|
|
1785
1787
|
if (locale.decimalSeparator !== ".") {
|
|
1786
1788
|
str = str.replace(locale.decimalSeparator, ".");
|
|
1787
1789
|
}
|
|
1788
|
-
// remove invaluable characters
|
|
1789
|
-
str = str.replace(getInvaluableSymbolsRegexp(locale), "");
|
|
1790
1790
|
let n = Number(str);
|
|
1791
1791
|
if (isNaN(n) && str.includes("%")) {
|
|
1792
1792
|
n = Number(str.split("%")[0]);
|
|
@@ -2805,15 +2805,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2805
2805
|
let currentIndex;
|
|
2806
2806
|
let currentVal;
|
|
2807
2807
|
let currentType;
|
|
2808
|
+
const getValue = sortOrder === "desc"
|
|
2809
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
2810
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
2808
2811
|
while (indexRight - indexLeft >= 0) {
|
|
2809
2812
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
2810
2813
|
currentIndex = indexMedian;
|
|
2811
|
-
currentVal =
|
|
2814
|
+
currentVal = getValue(currentIndex);
|
|
2812
2815
|
currentType = typeof currentVal;
|
|
2813
2816
|
// 1 - linear search to find value with the same type
|
|
2814
2817
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
2815
2818
|
currentIndex--;
|
|
2816
|
-
currentVal =
|
|
2819
|
+
currentVal = getValue(currentIndex);
|
|
2817
2820
|
currentType = typeof currentVal;
|
|
2818
2821
|
}
|
|
2819
2822
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -2829,8 +2832,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2829
2832
|
if (matchVal === undefined ||
|
|
2830
2833
|
matchVal === null ||
|
|
2831
2834
|
matchVal < currentVal ||
|
|
2832
|
-
(matchVal === currentVal &&
|
|
2833
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2835
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2834
2836
|
matchVal = currentVal;
|
|
2835
2837
|
matchValIndex = currentIndex;
|
|
2836
2838
|
}
|
|
@@ -2838,15 +2840,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2838
2840
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
2839
2841
|
if (matchVal === undefined ||
|
|
2840
2842
|
matchVal > currentVal ||
|
|
2841
|
-
(matchVal === currentVal &&
|
|
2842
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2843
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2843
2844
|
matchVal = currentVal;
|
|
2844
2845
|
matchValIndex = currentIndex;
|
|
2845
2846
|
}
|
|
2846
2847
|
}
|
|
2847
2848
|
// 3 - give new indexes for the Binary search
|
|
2848
|
-
if ((
|
|
2849
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
2849
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
2850
2850
|
indexRight = currentIndex - 1;
|
|
2851
2851
|
}
|
|
2852
2852
|
else {
|
|
@@ -2854,7 +2854,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2854
2854
|
}
|
|
2855
2855
|
}
|
|
2856
2856
|
// note that valMinIndex could be 0
|
|
2857
|
-
|
|
2857
|
+
if (matchValIndex === undefined) {
|
|
2858
|
+
return -1;
|
|
2859
|
+
}
|
|
2860
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
2858
2861
|
}
|
|
2859
2862
|
/**
|
|
2860
2863
|
* Perform a linear search and return the index of the match.
|
|
@@ -21875,6 +21878,10 @@ class Popover extends Component {
|
|
|
21875
21878
|
this.currentDisplayValue = newDisplay;
|
|
21876
21879
|
if (!anchor)
|
|
21877
21880
|
return;
|
|
21881
|
+
el.style.top = "";
|
|
21882
|
+
el.style.left = "";
|
|
21883
|
+
el.style["max-height"] = "";
|
|
21884
|
+
el.style["max-width"] = "";
|
|
21878
21885
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
21879
21886
|
let elDims = {
|
|
21880
21887
|
width: el.getBoundingClientRect().width,
|
|
@@ -32941,7 +32948,7 @@ class GridComposer extends Component {
|
|
|
32941
32948
|
return;
|
|
32942
32949
|
}
|
|
32943
32950
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
32944
|
-
const zone = this.env.model.getters.
|
|
32951
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
32945
32952
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
32946
32953
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
32947
32954
|
this.isCellReferenceVisible = true;
|
|
@@ -34687,13 +34694,23 @@ class GridRenderer {
|
|
|
34687
34694
|
drawLayer(renderingContext, layer) {
|
|
34688
34695
|
switch (layer) {
|
|
34689
34696
|
case "Background":
|
|
34690
|
-
|
|
34691
|
-
this.
|
|
34692
|
-
|
|
34693
|
-
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34697
|
+
this.drawGlobalBackground(renderingContext);
|
|
34698
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
34699
|
+
const { ctx } = renderingContext;
|
|
34700
|
+
ctx.save();
|
|
34701
|
+
ctx.beginPath();
|
|
34702
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
34703
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
34704
|
+
ctx.clip();
|
|
34705
|
+
const boxes = this.getGridBoxes(zone);
|
|
34706
|
+
this.drawBackground(renderingContext, boxes);
|
|
34707
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
34708
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
34709
|
+
this.drawBorders(renderingContext, boxes);
|
|
34710
|
+
this.drawTexts(renderingContext, boxes);
|
|
34711
|
+
this.drawIcon(renderingContext, boxes);
|
|
34712
|
+
ctx.restore();
|
|
34713
|
+
}
|
|
34697
34714
|
this.drawFrozenPanes(renderingContext);
|
|
34698
34715
|
break;
|
|
34699
34716
|
case "Headers":
|
|
@@ -34704,12 +34721,15 @@ class GridRenderer {
|
|
|
34704
34721
|
break;
|
|
34705
34722
|
}
|
|
34706
34723
|
}
|
|
34707
|
-
|
|
34708
|
-
const { ctx
|
|
34724
|
+
drawGlobalBackground(renderingContext) {
|
|
34725
|
+
const { ctx } = renderingContext;
|
|
34709
34726
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
34710
34727
|
// white background
|
|
34711
34728
|
ctx.fillStyle = "#ffffff";
|
|
34712
34729
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
34730
|
+
}
|
|
34731
|
+
drawBackground(renderingContext, boxes) {
|
|
34732
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
34713
34733
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
34714
34734
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
34715
34735
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -35134,7 +35154,7 @@ class GridRenderer {
|
|
|
35134
35154
|
const position = { sheetId, col, row };
|
|
35135
35155
|
const cell = this.getters.getEvaluatedCell(position);
|
|
35136
35156
|
const showFormula = this.getters.shouldShowFormulas();
|
|
35137
|
-
const { x, y, width, height } = this.getters.
|
|
35157
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
35138
35158
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
35139
35159
|
const box = {
|
|
35140
35160
|
x,
|
|
@@ -35249,12 +35269,16 @@ class GridRenderer {
|
|
|
35249
35269
|
}
|
|
35250
35270
|
return box;
|
|
35251
35271
|
}
|
|
35252
|
-
getGridBoxes() {
|
|
35272
|
+
getGridBoxes(zone) {
|
|
35253
35273
|
const boxes = [];
|
|
35254
|
-
const visibleCols = this.getters
|
|
35274
|
+
const visibleCols = this.getters
|
|
35275
|
+
.getSheetViewVisibleCols()
|
|
35276
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
35255
35277
|
const left = visibleCols[0];
|
|
35256
35278
|
const right = visibleCols[visibleCols.length - 1];
|
|
35257
|
-
const visibleRows = this.getters
|
|
35279
|
+
const visibleRows = this.getters
|
|
35280
|
+
.getSheetViewVisibleRows()
|
|
35281
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
35258
35282
|
const top = visibleRows[0];
|
|
35259
35283
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
35260
35284
|
const viewport = { left, right, top, bottom };
|
|
@@ -51439,14 +51463,12 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
51439
51463
|
}
|
|
51440
51464
|
break;
|
|
51441
51465
|
case "AUTORESIZE_ROWS":
|
|
51442
|
-
|
|
51443
|
-
|
|
51444
|
-
|
|
51445
|
-
|
|
51446
|
-
|
|
51447
|
-
|
|
51448
|
-
});
|
|
51449
|
-
}
|
|
51466
|
+
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
51467
|
+
elements: cmd.rows,
|
|
51468
|
+
dimension: "ROW",
|
|
51469
|
+
size: null,
|
|
51470
|
+
sheetId: cmd.sheetId,
|
|
51471
|
+
});
|
|
51450
51472
|
break;
|
|
51451
51473
|
}
|
|
51452
51474
|
}
|
|
@@ -53645,8 +53667,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
53645
53667
|
},
|
|
53646
53668
|
];
|
|
53647
53669
|
handler.paste({ zones: pasteTarget }, data, { isCutOperation: true });
|
|
53670
|
+
const selection = pasteTarget[0];
|
|
53671
|
+
const col = selection.left;
|
|
53672
|
+
const row = selection.top;
|
|
53673
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
53648
53674
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
53649
|
-
let currentIndex = cmd.base;
|
|
53675
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
53650
53676
|
for (const element of toRemove) {
|
|
53651
53677
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
53652
53678
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -53925,22 +53951,33 @@ class InternalViewport {
|
|
|
53925
53951
|
}
|
|
53926
53952
|
/**
|
|
53927
53953
|
*
|
|
53928
|
-
*
|
|
53929
|
-
*
|
|
53954
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
53955
|
+
*
|
|
53930
53956
|
*/
|
|
53931
|
-
|
|
53957
|
+
getVisibleRect(zone) {
|
|
53932
53958
|
const targetZone = intersection(zone, this);
|
|
53933
53959
|
if (targetZone) {
|
|
53934
53960
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
53935
53961
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
53936
53962
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
53937
53963
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
53938
|
-
return {
|
|
53939
|
-
|
|
53940
|
-
|
|
53941
|
-
|
|
53942
|
-
|
|
53943
|
-
|
|
53964
|
+
return { x, y, width, height };
|
|
53965
|
+
}
|
|
53966
|
+
return undefined;
|
|
53967
|
+
}
|
|
53968
|
+
/**
|
|
53969
|
+
*
|
|
53970
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
53971
|
+
*
|
|
53972
|
+
*/
|
|
53973
|
+
getFullRect(zone) {
|
|
53974
|
+
const targetZone = intersection(zone, this);
|
|
53975
|
+
if (targetZone) {
|
|
53976
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
53977
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
53978
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
53979
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
53980
|
+
return { x, y, width, height };
|
|
53944
53981
|
}
|
|
53945
53982
|
return undefined;
|
|
53946
53983
|
}
|
|
@@ -54110,6 +54147,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54110
54147
|
"isPositionVisible",
|
|
54111
54148
|
"getColDimensionsInViewport",
|
|
54112
54149
|
"getRowDimensionsInViewport",
|
|
54150
|
+
"getAllActiveViewportsZones",
|
|
54151
|
+
"getRect",
|
|
54113
54152
|
];
|
|
54114
54153
|
viewports = {};
|
|
54115
54154
|
/**
|
|
@@ -54497,16 +54536,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54497
54536
|
getVisibleRectWithoutHeaders(zone) {
|
|
54498
54537
|
const sheetId = this.getters.getActiveSheetId();
|
|
54499
54538
|
const viewportRects = this.getSubViewports(sheetId)
|
|
54500
|
-
.map((viewport) => viewport.
|
|
54539
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
54501
54540
|
.filter(isDefined$1);
|
|
54502
54541
|
if (viewportRects.length === 0) {
|
|
54503
54542
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
54504
54543
|
}
|
|
54505
|
-
|
|
54506
|
-
|
|
54507
|
-
|
|
54508
|
-
|
|
54509
|
-
|
|
54544
|
+
return this.recomposeRect(viewportRects);
|
|
54545
|
+
}
|
|
54546
|
+
/**
|
|
54547
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
54548
|
+
* regardless of the viewport dimensions.
|
|
54549
|
+
*/
|
|
54550
|
+
getRect(zone) {
|
|
54551
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
54552
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
54553
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
54554
|
+
.filter(isDefined$1);
|
|
54555
|
+
if (viewportRects.length === 0) {
|
|
54556
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
54557
|
+
}
|
|
54558
|
+
const rect = this.recomposeRect(viewportRects);
|
|
54559
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
54510
54560
|
}
|
|
54511
54561
|
/**
|
|
54512
54562
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -54550,6 +54600,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54550
54600
|
end: start + (isRowHidden ? 0 : size),
|
|
54551
54601
|
};
|
|
54552
54602
|
}
|
|
54603
|
+
getAllActiveViewportsZones() {
|
|
54604
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
54605
|
+
return this.getSubViewports(sheetId);
|
|
54606
|
+
}
|
|
54553
54607
|
// ---------------------------------------------------------------------------
|
|
54554
54608
|
// Private
|
|
54555
54609
|
// ---------------------------------------------------------------------------
|
|
@@ -54734,6 +54788,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54734
54788
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
54735
54789
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
54736
54790
|
}
|
|
54791
|
+
recomposeRect(viewportRects) {
|
|
54792
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
54793
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
54794
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
54795
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
54796
|
+
return { x, y, width, height };
|
|
54797
|
+
}
|
|
54737
54798
|
}
|
|
54738
54799
|
|
|
54739
54800
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -61030,6 +61091,6 @@ const constants = {
|
|
|
61030
61091
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
|
|
61031
61092
|
|
|
61032
61093
|
|
|
61033
|
-
__info__.version = "17.2.
|
|
61034
|
-
__info__.date = "2025-01-
|
|
61035
|
-
__info__.hash = "
|
|
61094
|
+
__info__.version = "17.2.34";
|
|
61095
|
+
__info__.date = "2025-01-31T07:58:03.953Z";
|
|
61096
|
+
__info__.hash = "0bffee9";
|