@odoo/o-spreadsheet 16.0.56 → 16.0.58
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 +128 -42
- package/dist/o-spreadsheet.d.ts +14 -2
- package/dist/o-spreadsheet.esm.js +128 -42
- package/dist/o-spreadsheet.iife.js +128 -42
- package/dist/o-spreadsheet.iife.min.js +120 -120
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -2
|
@@ -11564,15 +11564,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
11564
11564
|
let currentIndex;
|
|
11565
11565
|
let currentVal;
|
|
11566
11566
|
let currentType;
|
|
11567
|
+
const getValue = sortOrder === "desc"
|
|
11568
|
+
? (i) => getValueInData(data, rangeLength - i - 1)
|
|
11569
|
+
: (i) => getValueInData(data, i);
|
|
11567
11570
|
while (indexRight - indexLeft >= 0) {
|
|
11568
11571
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
11569
11572
|
currentIndex = indexMedian;
|
|
11570
|
-
currentVal =
|
|
11573
|
+
currentVal = getValue(currentIndex);
|
|
11571
11574
|
currentType = typeof currentVal;
|
|
11572
11575
|
// 1 - linear search to find value with the same type
|
|
11573
11576
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
11574
11577
|
currentIndex--;
|
|
11575
|
-
currentVal =
|
|
11578
|
+
currentVal = getValue(currentIndex);
|
|
11576
11579
|
currentType = typeof currentVal;
|
|
11577
11580
|
}
|
|
11578
11581
|
if (currentType !== targetType || currentVal === undefined) {
|
|
@@ -11587,8 +11590,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
11587
11590
|
else if (mode === "nextSmaller" && currentVal <= target) {
|
|
11588
11591
|
if (matchVal === undefined ||
|
|
11589
11592
|
matchVal < currentVal ||
|
|
11590
|
-
(matchVal === currentVal &&
|
|
11591
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
11593
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
11592
11594
|
matchVal = currentVal;
|
|
11593
11595
|
matchValIndex = currentIndex;
|
|
11594
11596
|
}
|
|
@@ -11596,15 +11598,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
11596
11598
|
else if (mode === "nextGreater" && currentVal >= target) {
|
|
11597
11599
|
if (matchVal === undefined ||
|
|
11598
11600
|
matchVal > currentVal ||
|
|
11599
|
-
(matchVal === currentVal &&
|
|
11600
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
11601
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
11601
11602
|
matchVal = currentVal;
|
|
11602
11603
|
matchValIndex = currentIndex;
|
|
11603
11604
|
}
|
|
11604
11605
|
}
|
|
11605
11606
|
// 3 - give new indexes for the Binary search
|
|
11606
|
-
if ((
|
|
11607
|
-
(sortOrder === "desc" && currentVal <= target)) {
|
|
11607
|
+
if (currentVal > target || (mode === "strict" && currentVal === target)) {
|
|
11608
11608
|
indexRight = currentIndex - 1;
|
|
11609
11609
|
}
|
|
11610
11610
|
else {
|
|
@@ -11612,7 +11612,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
11612
11612
|
}
|
|
11613
11613
|
}
|
|
11614
11614
|
// note that valMinIndex could be 0
|
|
11615
|
-
|
|
11615
|
+
if (matchValIndex === undefined) {
|
|
11616
|
+
return -1;
|
|
11617
|
+
}
|
|
11618
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
11616
11619
|
}
|
|
11617
11620
|
/**
|
|
11618
11621
|
* Perform a linear search and return the index of the match.
|
|
@@ -25035,6 +25038,9 @@ function convertFigure(figure, id, sheetData) {
|
|
|
25035
25038
|
}
|
|
25036
25039
|
function convertChartData(chartData) {
|
|
25037
25040
|
var _a;
|
|
25041
|
+
if (chartData.dataSets.length === 0) {
|
|
25042
|
+
return undefined;
|
|
25043
|
+
}
|
|
25038
25044
|
const labelRange = (_a = chartData.dataSets[0].label) === null || _a === void 0 ? void 0 : _a.replace(/\$/g, "");
|
|
25039
25045
|
let dataSets = chartData.dataSets.map((data) => data.range.replace(/\$/g, ""));
|
|
25040
25046
|
// For doughnut charts, in chartJS first dataset = outer dataset, in excel first dataset = inner dataset
|
|
@@ -27506,10 +27512,34 @@ class BordersPlugin extends CorePlugin {
|
|
|
27506
27512
|
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
27507
27513
|
for (const group of groupConsecutive(elements)) {
|
|
27508
27514
|
if (cmd.dimension === "COL") {
|
|
27509
|
-
|
|
27515
|
+
if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
|
|
27516
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
27517
|
+
this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
|
|
27518
|
+
}
|
|
27519
|
+
}
|
|
27520
|
+
if (group[group.length - 1] === 0) {
|
|
27521
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
27522
|
+
this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
|
|
27523
|
+
}
|
|
27524
|
+
}
|
|
27525
|
+
const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
27526
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
27527
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
|
|
27510
27528
|
}
|
|
27511
27529
|
else {
|
|
27512
|
-
|
|
27530
|
+
if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
|
|
27531
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
27532
|
+
this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
|
|
27533
|
+
}
|
|
27534
|
+
}
|
|
27535
|
+
if (group[group.length - 1] === 0) {
|
|
27536
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
27537
|
+
this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
|
|
27538
|
+
}
|
|
27539
|
+
}
|
|
27540
|
+
const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
27541
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
27542
|
+
this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
|
|
27513
27543
|
}
|
|
27514
27544
|
}
|
|
27515
27545
|
break;
|
|
@@ -27804,6 +27834,18 @@ class BordersPlugin extends CorePlugin {
|
|
|
27804
27834
|
}
|
|
27805
27835
|
}
|
|
27806
27836
|
}
|
|
27837
|
+
/**
|
|
27838
|
+
* Remove the borders inside of a zone
|
|
27839
|
+
*/
|
|
27840
|
+
clearInsideBorders(sheetId, zones) {
|
|
27841
|
+
for (let zone of zones) {
|
|
27842
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
27843
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
27844
|
+
this.history.update("borders", sheetId, col, row, undefined);
|
|
27845
|
+
}
|
|
27846
|
+
}
|
|
27847
|
+
}
|
|
27848
|
+
}
|
|
27807
27849
|
/**
|
|
27808
27850
|
* Add a border to the existing one to a cell
|
|
27809
27851
|
*/
|
|
@@ -34376,12 +34418,21 @@ class RendererPlugin extends UIPlugin {
|
|
|
34376
34418
|
drawGrid(renderingContext, layer) {
|
|
34377
34419
|
switch (layer) {
|
|
34378
34420
|
case 0 /* LAYERS.Background */:
|
|
34379
|
-
this.boxes = this.getGridBoxes();
|
|
34380
34421
|
this.drawBackground(renderingContext);
|
|
34381
|
-
this.
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34422
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
34423
|
+
const { ctx } = renderingContext;
|
|
34424
|
+
ctx.save();
|
|
34425
|
+
ctx.beginPath();
|
|
34426
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
34427
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
34428
|
+
ctx.clip();
|
|
34429
|
+
this.boxes = this.getGridBoxes(zone);
|
|
34430
|
+
this.drawCellBackground(renderingContext);
|
|
34431
|
+
this.drawBorders(renderingContext);
|
|
34432
|
+
this.drawTexts(renderingContext);
|
|
34433
|
+
this.drawIcon(renderingContext);
|
|
34434
|
+
ctx.restore();
|
|
34435
|
+
}
|
|
34385
34436
|
this.drawFrozenPanes(renderingContext);
|
|
34386
34437
|
break;
|
|
34387
34438
|
case 7 /* LAYERS.Headers */:
|
|
@@ -34746,7 +34797,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
34746
34797
|
const row = zone.top;
|
|
34747
34798
|
const cell = this.getters.getCell(sheetId, col, row);
|
|
34748
34799
|
const showFormula = this.getters.shouldShowFormulas();
|
|
34749
|
-
const { x, y, width, height } = this.getters.
|
|
34800
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
34750
34801
|
const box = {
|
|
34751
34802
|
x,
|
|
34752
34803
|
y,
|
|
@@ -34858,12 +34909,16 @@ class RendererPlugin extends UIPlugin {
|
|
|
34858
34909
|
}
|
|
34859
34910
|
return box;
|
|
34860
34911
|
}
|
|
34861
|
-
getGridBoxes() {
|
|
34912
|
+
getGridBoxes(zone) {
|
|
34862
34913
|
const boxes = [];
|
|
34863
|
-
const visibleCols = this.getters
|
|
34914
|
+
const visibleCols = this.getters
|
|
34915
|
+
.getSheetViewVisibleCols()
|
|
34916
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
34864
34917
|
const left = visibleCols[0];
|
|
34865
34918
|
const right = visibleCols[visibleCols.length - 1];
|
|
34866
|
-
const visibleRows = this.getters
|
|
34919
|
+
const visibleRows = this.getters
|
|
34920
|
+
.getSheetViewVisibleRows()
|
|
34921
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
34867
34922
|
const top = visibleRows[0];
|
|
34868
34923
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
34869
34924
|
const viewport = { left, right, top, bottom };
|
|
@@ -35393,7 +35448,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35393
35448
|
];
|
|
35394
35449
|
state.paste(pasteTarget, { selectTarget: true });
|
|
35395
35450
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
35396
|
-
let currentIndex = cmd.base;
|
|
35451
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
35397
35452
|
for (const element of toRemove) {
|
|
35398
35453
|
const size = cmd.dimension === "COL"
|
|
35399
35454
|
? this.getters.getColSize(cmd.sheetId, element)
|
|
@@ -36900,7 +36955,7 @@ class InternalViewport {
|
|
|
36900
36955
|
* @param zone
|
|
36901
36956
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
36902
36957
|
*/
|
|
36903
|
-
|
|
36958
|
+
getVisibleRect(zone) {
|
|
36904
36959
|
const targetZone = intersection(zone, this.zone);
|
|
36905
36960
|
if (targetZone) {
|
|
36906
36961
|
const x = this.getters.getColRowOffset("COL", this.zone.left, targetZone.left) +
|
|
@@ -36908,12 +36963,20 @@ class InternalViewport {
|
|
|
36908
36963
|
const y = this.getters.getColRowOffset("ROW", this.zone.top, targetZone.top) + this.offsetCorrectionY;
|
|
36909
36964
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
36910
36965
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
36911
|
-
return {
|
|
36912
|
-
|
|
36913
|
-
|
|
36914
|
-
|
|
36915
|
-
|
|
36916
|
-
|
|
36966
|
+
return { x, y, width, height };
|
|
36967
|
+
}
|
|
36968
|
+
else {
|
|
36969
|
+
return undefined;
|
|
36970
|
+
}
|
|
36971
|
+
}
|
|
36972
|
+
getFullRect(zone) {
|
|
36973
|
+
const targetZone = intersection(zone, this.zone);
|
|
36974
|
+
if (targetZone) {
|
|
36975
|
+
const x = this.getters.getColRowOffset("COL", this.zone.left, zone.left) + this.offsetCorrectionX;
|
|
36976
|
+
const y = this.getters.getColRowOffset("ROW", this.zone.top, zone.top) + this.offsetCorrectionY;
|
|
36977
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
36978
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
36979
|
+
return { x, y, width, height };
|
|
36917
36980
|
}
|
|
36918
36981
|
else {
|
|
36919
36982
|
return undefined;
|
|
@@ -37407,21 +37470,26 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37407
37470
|
getVisibleRect(zone) {
|
|
37408
37471
|
const sheetId = this.getters.getActiveSheetId();
|
|
37409
37472
|
const viewportRects = this.getSubViewports(sheetId)
|
|
37410
|
-
.map((viewport) => viewport.
|
|
37473
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
37411
37474
|
.filter(isDefined$1);
|
|
37412
37475
|
if (viewportRects.length === 0) {
|
|
37413
37476
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37414
37477
|
}
|
|
37415
|
-
|
|
37416
|
-
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
|
|
37424
|
-
|
|
37478
|
+
return this.recomposeRect(viewportRects);
|
|
37479
|
+
}
|
|
37480
|
+
/**
|
|
37481
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
37482
|
+
* regardless of the viewport dimensions.
|
|
37483
|
+
*/
|
|
37484
|
+
getRect(zone) {
|
|
37485
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37486
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
37487
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
37488
|
+
.filter(isDefined$1);
|
|
37489
|
+
if (viewportRects.length === 0) {
|
|
37490
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37491
|
+
}
|
|
37492
|
+
return this.recomposeRect(viewportRects);
|
|
37425
37493
|
}
|
|
37426
37494
|
/**
|
|
37427
37495
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -37435,6 +37503,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37435
37503
|
const y = this.getters.getRowDimensions(sheetId, ySplit).start;
|
|
37436
37504
|
return { x, y };
|
|
37437
37505
|
}
|
|
37506
|
+
getAllActiveViewportsZones() {
|
|
37507
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37508
|
+
return this.getSubViewports(sheetId);
|
|
37509
|
+
}
|
|
37438
37510
|
// ---------------------------------------------------------------------------
|
|
37439
37511
|
// Private
|
|
37440
37512
|
// ---------------------------------------------------------------------------
|
|
@@ -37617,6 +37689,18 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37617
37689
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
37618
37690
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
37619
37691
|
}
|
|
37692
|
+
recomposeRect(viewportRects) {
|
|
37693
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
37694
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
37695
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
37696
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
37697
|
+
return {
|
|
37698
|
+
x: x + this.gridOffsetX,
|
|
37699
|
+
y: y + this.gridOffsetY,
|
|
37700
|
+
width,
|
|
37701
|
+
height,
|
|
37702
|
+
};
|
|
37703
|
+
}
|
|
37620
37704
|
}
|
|
37621
37705
|
SheetViewPlugin.getters = [
|
|
37622
37706
|
"getColIndex",
|
|
@@ -37637,6 +37721,8 @@ SheetViewPlugin.getters = [
|
|
|
37637
37721
|
"getSheetViewVisibleCols",
|
|
37638
37722
|
"getSheetViewVisibleRows",
|
|
37639
37723
|
"getFrozenSheetViewRatio",
|
|
37724
|
+
"getAllActiveViewportsZones",
|
|
37725
|
+
"getRect",
|
|
37640
37726
|
];
|
|
37641
37727
|
|
|
37642
37728
|
class SortPlugin extends UIPlugin {
|
|
@@ -43452,6 +43538,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43452
43538
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43453
43539
|
|
|
43454
43540
|
|
|
43455
|
-
__info__.version = '16.0.
|
|
43456
|
-
__info__.date = '
|
|
43457
|
-
__info__.hash = '
|
|
43541
|
+
__info__.version = '16.0.58';
|
|
43542
|
+
__info__.date = '2025-01-27T10:00:05.196Z';
|
|
43543
|
+
__info__.hash = '4886b0b';
|
|
@@ -11565,15 +11565,18 @@
|
|
|
11565
11565
|
let currentIndex;
|
|
11566
11566
|
let currentVal;
|
|
11567
11567
|
let currentType;
|
|
11568
|
+
const getValue = sortOrder === "desc"
|
|
11569
|
+
? (i) => getValueInData(data, rangeLength - i - 1)
|
|
11570
|
+
: (i) => getValueInData(data, i);
|
|
11568
11571
|
while (indexRight - indexLeft >= 0) {
|
|
11569
11572
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
11570
11573
|
currentIndex = indexMedian;
|
|
11571
|
-
currentVal =
|
|
11574
|
+
currentVal = getValue(currentIndex);
|
|
11572
11575
|
currentType = typeof currentVal;
|
|
11573
11576
|
// 1 - linear search to find value with the same type
|
|
11574
11577
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
11575
11578
|
currentIndex--;
|
|
11576
|
-
currentVal =
|
|
11579
|
+
currentVal = getValue(currentIndex);
|
|
11577
11580
|
currentType = typeof currentVal;
|
|
11578
11581
|
}
|
|
11579
11582
|
if (currentType !== targetType || currentVal === undefined) {
|
|
@@ -11588,8 +11591,7 @@
|
|
|
11588
11591
|
else if (mode === "nextSmaller" && currentVal <= target) {
|
|
11589
11592
|
if (matchVal === undefined ||
|
|
11590
11593
|
matchVal < currentVal ||
|
|
11591
|
-
(matchVal === currentVal &&
|
|
11592
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
11594
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
11593
11595
|
matchVal = currentVal;
|
|
11594
11596
|
matchValIndex = currentIndex;
|
|
11595
11597
|
}
|
|
@@ -11597,15 +11599,13 @@
|
|
|
11597
11599
|
else if (mode === "nextGreater" && currentVal >= target) {
|
|
11598
11600
|
if (matchVal === undefined ||
|
|
11599
11601
|
matchVal > currentVal ||
|
|
11600
|
-
(matchVal === currentVal &&
|
|
11601
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
11602
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
11602
11603
|
matchVal = currentVal;
|
|
11603
11604
|
matchValIndex = currentIndex;
|
|
11604
11605
|
}
|
|
11605
11606
|
}
|
|
11606
11607
|
// 3 - give new indexes for the Binary search
|
|
11607
|
-
if ((
|
|
11608
|
-
(sortOrder === "desc" && currentVal <= target)) {
|
|
11608
|
+
if (currentVal > target || (mode === "strict" && currentVal === target)) {
|
|
11609
11609
|
indexRight = currentIndex - 1;
|
|
11610
11610
|
}
|
|
11611
11611
|
else {
|
|
@@ -11613,7 +11613,10 @@
|
|
|
11613
11613
|
}
|
|
11614
11614
|
}
|
|
11615
11615
|
// note that valMinIndex could be 0
|
|
11616
|
-
|
|
11616
|
+
if (matchValIndex === undefined) {
|
|
11617
|
+
return -1;
|
|
11618
|
+
}
|
|
11619
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
11617
11620
|
}
|
|
11618
11621
|
/**
|
|
11619
11622
|
* Perform a linear search and return the index of the match.
|
|
@@ -25036,6 +25039,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
25036
25039
|
}
|
|
25037
25040
|
function convertChartData(chartData) {
|
|
25038
25041
|
var _a;
|
|
25042
|
+
if (chartData.dataSets.length === 0) {
|
|
25043
|
+
return undefined;
|
|
25044
|
+
}
|
|
25039
25045
|
const labelRange = (_a = chartData.dataSets[0].label) === null || _a === void 0 ? void 0 : _a.replace(/\$/g, "");
|
|
25040
25046
|
let dataSets = chartData.dataSets.map((data) => data.range.replace(/\$/g, ""));
|
|
25041
25047
|
// For doughnut charts, in chartJS first dataset = outer dataset, in excel first dataset = inner dataset
|
|
@@ -27507,10 +27513,34 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27507
27513
|
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
27508
27514
|
for (const group of groupConsecutive(elements)) {
|
|
27509
27515
|
if (cmd.dimension === "COL") {
|
|
27510
|
-
|
|
27516
|
+
if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
|
|
27517
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
27518
|
+
this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
|
|
27519
|
+
}
|
|
27520
|
+
}
|
|
27521
|
+
if (group[group.length - 1] === 0) {
|
|
27522
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
27523
|
+
this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
|
|
27524
|
+
}
|
|
27525
|
+
}
|
|
27526
|
+
const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
27527
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
27528
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
|
|
27511
27529
|
}
|
|
27512
27530
|
else {
|
|
27513
|
-
|
|
27531
|
+
if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
|
|
27532
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
27533
|
+
this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
|
|
27534
|
+
}
|
|
27535
|
+
}
|
|
27536
|
+
if (group[group.length - 1] === 0) {
|
|
27537
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
27538
|
+
this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
|
|
27539
|
+
}
|
|
27540
|
+
}
|
|
27541
|
+
const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
27542
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
27543
|
+
this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
|
|
27514
27544
|
}
|
|
27515
27545
|
}
|
|
27516
27546
|
break;
|
|
@@ -27805,6 +27835,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27805
27835
|
}
|
|
27806
27836
|
}
|
|
27807
27837
|
}
|
|
27838
|
+
/**
|
|
27839
|
+
* Remove the borders inside of a zone
|
|
27840
|
+
*/
|
|
27841
|
+
clearInsideBorders(sheetId, zones) {
|
|
27842
|
+
for (let zone of zones) {
|
|
27843
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
27844
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
27845
|
+
this.history.update("borders", sheetId, col, row, undefined);
|
|
27846
|
+
}
|
|
27847
|
+
}
|
|
27848
|
+
}
|
|
27849
|
+
}
|
|
27808
27850
|
/**
|
|
27809
27851
|
* Add a border to the existing one to a cell
|
|
27810
27852
|
*/
|
|
@@ -34377,12 +34419,21 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34377
34419
|
drawGrid(renderingContext, layer) {
|
|
34378
34420
|
switch (layer) {
|
|
34379
34421
|
case 0 /* LAYERS.Background */:
|
|
34380
|
-
this.boxes = this.getGridBoxes();
|
|
34381
34422
|
this.drawBackground(renderingContext);
|
|
34382
|
-
this.
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34423
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
34424
|
+
const { ctx } = renderingContext;
|
|
34425
|
+
ctx.save();
|
|
34426
|
+
ctx.beginPath();
|
|
34427
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
34428
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
34429
|
+
ctx.clip();
|
|
34430
|
+
this.boxes = this.getGridBoxes(zone);
|
|
34431
|
+
this.drawCellBackground(renderingContext);
|
|
34432
|
+
this.drawBorders(renderingContext);
|
|
34433
|
+
this.drawTexts(renderingContext);
|
|
34434
|
+
this.drawIcon(renderingContext);
|
|
34435
|
+
ctx.restore();
|
|
34436
|
+
}
|
|
34386
34437
|
this.drawFrozenPanes(renderingContext);
|
|
34387
34438
|
break;
|
|
34388
34439
|
case 7 /* LAYERS.Headers */:
|
|
@@ -34747,7 +34798,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34747
34798
|
const row = zone.top;
|
|
34748
34799
|
const cell = this.getters.getCell(sheetId, col, row);
|
|
34749
34800
|
const showFormula = this.getters.shouldShowFormulas();
|
|
34750
|
-
const { x, y, width, height } = this.getters.
|
|
34801
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
34751
34802
|
const box = {
|
|
34752
34803
|
x,
|
|
34753
34804
|
y,
|
|
@@ -34859,12 +34910,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34859
34910
|
}
|
|
34860
34911
|
return box;
|
|
34861
34912
|
}
|
|
34862
|
-
getGridBoxes() {
|
|
34913
|
+
getGridBoxes(zone) {
|
|
34863
34914
|
const boxes = [];
|
|
34864
|
-
const visibleCols = this.getters
|
|
34915
|
+
const visibleCols = this.getters
|
|
34916
|
+
.getSheetViewVisibleCols()
|
|
34917
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
34865
34918
|
const left = visibleCols[0];
|
|
34866
34919
|
const right = visibleCols[visibleCols.length - 1];
|
|
34867
|
-
const visibleRows = this.getters
|
|
34920
|
+
const visibleRows = this.getters
|
|
34921
|
+
.getSheetViewVisibleRows()
|
|
34922
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
34868
34923
|
const top = visibleRows[0];
|
|
34869
34924
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
34870
34925
|
const viewport = { left, right, top, bottom };
|
|
@@ -35394,7 +35449,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35394
35449
|
];
|
|
35395
35450
|
state.paste(pasteTarget, { selectTarget: true });
|
|
35396
35451
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
35397
|
-
let currentIndex = cmd.base;
|
|
35452
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
35398
35453
|
for (const element of toRemove) {
|
|
35399
35454
|
const size = cmd.dimension === "COL"
|
|
35400
35455
|
? this.getters.getColSize(cmd.sheetId, element)
|
|
@@ -36901,7 +36956,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36901
36956
|
* @param zone
|
|
36902
36957
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
36903
36958
|
*/
|
|
36904
|
-
|
|
36959
|
+
getVisibleRect(zone) {
|
|
36905
36960
|
const targetZone = intersection(zone, this.zone);
|
|
36906
36961
|
if (targetZone) {
|
|
36907
36962
|
const x = this.getters.getColRowOffset("COL", this.zone.left, targetZone.left) +
|
|
@@ -36909,12 +36964,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36909
36964
|
const y = this.getters.getColRowOffset("ROW", this.zone.top, targetZone.top) + this.offsetCorrectionY;
|
|
36910
36965
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
36911
36966
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
36912
|
-
return {
|
|
36913
|
-
|
|
36914
|
-
|
|
36915
|
-
|
|
36916
|
-
|
|
36917
|
-
|
|
36967
|
+
return { x, y, width, height };
|
|
36968
|
+
}
|
|
36969
|
+
else {
|
|
36970
|
+
return undefined;
|
|
36971
|
+
}
|
|
36972
|
+
}
|
|
36973
|
+
getFullRect(zone) {
|
|
36974
|
+
const targetZone = intersection(zone, this.zone);
|
|
36975
|
+
if (targetZone) {
|
|
36976
|
+
const x = this.getters.getColRowOffset("COL", this.zone.left, zone.left) + this.offsetCorrectionX;
|
|
36977
|
+
const y = this.getters.getColRowOffset("ROW", this.zone.top, zone.top) + this.offsetCorrectionY;
|
|
36978
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
36979
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
36980
|
+
return { x, y, width, height };
|
|
36918
36981
|
}
|
|
36919
36982
|
else {
|
|
36920
36983
|
return undefined;
|
|
@@ -37408,21 +37471,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37408
37471
|
getVisibleRect(zone) {
|
|
37409
37472
|
const sheetId = this.getters.getActiveSheetId();
|
|
37410
37473
|
const viewportRects = this.getSubViewports(sheetId)
|
|
37411
|
-
.map((viewport) => viewport.
|
|
37474
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
37412
37475
|
.filter(isDefined$1);
|
|
37413
37476
|
if (viewportRects.length === 0) {
|
|
37414
37477
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37415
37478
|
}
|
|
37416
|
-
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
|
|
37424
|
-
|
|
37425
|
-
|
|
37479
|
+
return this.recomposeRect(viewportRects);
|
|
37480
|
+
}
|
|
37481
|
+
/**
|
|
37482
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
37483
|
+
* regardless of the viewport dimensions.
|
|
37484
|
+
*/
|
|
37485
|
+
getRect(zone) {
|
|
37486
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37487
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
37488
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
37489
|
+
.filter(isDefined$1);
|
|
37490
|
+
if (viewportRects.length === 0) {
|
|
37491
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37492
|
+
}
|
|
37493
|
+
return this.recomposeRect(viewportRects);
|
|
37426
37494
|
}
|
|
37427
37495
|
/**
|
|
37428
37496
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -37436,6 +37504,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37436
37504
|
const y = this.getters.getRowDimensions(sheetId, ySplit).start;
|
|
37437
37505
|
return { x, y };
|
|
37438
37506
|
}
|
|
37507
|
+
getAllActiveViewportsZones() {
|
|
37508
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37509
|
+
return this.getSubViewports(sheetId);
|
|
37510
|
+
}
|
|
37439
37511
|
// ---------------------------------------------------------------------------
|
|
37440
37512
|
// Private
|
|
37441
37513
|
// ---------------------------------------------------------------------------
|
|
@@ -37618,6 +37690,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37618
37690
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
37619
37691
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
37620
37692
|
}
|
|
37693
|
+
recomposeRect(viewportRects) {
|
|
37694
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
37695
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
37696
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
37697
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
37698
|
+
return {
|
|
37699
|
+
x: x + this.gridOffsetX,
|
|
37700
|
+
y: y + this.gridOffsetY,
|
|
37701
|
+
width,
|
|
37702
|
+
height,
|
|
37703
|
+
};
|
|
37704
|
+
}
|
|
37621
37705
|
}
|
|
37622
37706
|
SheetViewPlugin.getters = [
|
|
37623
37707
|
"getColIndex",
|
|
@@ -37638,6 +37722,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37638
37722
|
"getSheetViewVisibleCols",
|
|
37639
37723
|
"getSheetViewVisibleRows",
|
|
37640
37724
|
"getFrozenSheetViewRatio",
|
|
37725
|
+
"getAllActiveViewportsZones",
|
|
37726
|
+
"getRect",
|
|
37641
37727
|
];
|
|
37642
37728
|
|
|
37643
37729
|
class SortPlugin extends UIPlugin {
|
|
@@ -43483,9 +43569,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43483
43569
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43484
43570
|
|
|
43485
43571
|
|
|
43486
|
-
__info__.version = '16.0.
|
|
43487
|
-
__info__.date = '
|
|
43488
|
-
__info__.hash = '
|
|
43572
|
+
__info__.version = '16.0.58';
|
|
43573
|
+
__info__.date = '2025-01-27T10:00:05.196Z';
|
|
43574
|
+
__info__.hash = '4886b0b';
|
|
43489
43575
|
|
|
43490
43576
|
|
|
43491
43577
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|