@odoo/o-spreadsheet 18.1.2 → 18.1.4
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 +145 -66
- package/dist/o-spreadsheet.d.ts +25 -8
- package/dist/o-spreadsheet.esm.js +145 -66
- package/dist/o-spreadsheet.iife.js +145 -66
- package/dist/o-spreadsheet.iife.min.js +6 -6
- 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.4
|
|
6
|
+
* @date 2025-01-29T06:27:32.901Z
|
|
7
|
+
* @hash a11ef27
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -4380,15 +4380,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
4380
4380
|
let currentIndex;
|
|
4381
4381
|
let currentVal;
|
|
4382
4382
|
let currentType;
|
|
4383
|
+
const getValue = sortOrder === "desc"
|
|
4384
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
4385
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
4383
4386
|
while (indexRight - indexLeft >= 0) {
|
|
4384
4387
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
4385
4388
|
currentIndex = indexMedian;
|
|
4386
|
-
currentVal =
|
|
4389
|
+
currentVal = getValue(currentIndex);
|
|
4387
4390
|
currentType = typeof currentVal;
|
|
4388
4391
|
// 1 - linear search to find value with the same type
|
|
4389
4392
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
4390
4393
|
currentIndex--;
|
|
4391
|
-
currentVal =
|
|
4394
|
+
currentVal = getValue(currentIndex);
|
|
4392
4395
|
currentType = typeof currentVal;
|
|
4393
4396
|
}
|
|
4394
4397
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -4404,8 +4407,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
4404
4407
|
if (matchVal === undefined ||
|
|
4405
4408
|
matchVal === null ||
|
|
4406
4409
|
matchVal < currentVal ||
|
|
4407
|
-
(matchVal === currentVal &&
|
|
4408
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
4410
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
4409
4411
|
matchVal = currentVal;
|
|
4410
4412
|
matchValIndex = currentIndex;
|
|
4411
4413
|
}
|
|
@@ -4413,15 +4415,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
4413
4415
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
4414
4416
|
if (matchVal === undefined ||
|
|
4415
4417
|
matchVal > currentVal ||
|
|
4416
|
-
(matchVal === currentVal &&
|
|
4417
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
4418
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
4418
4419
|
matchVal = currentVal;
|
|
4419
4420
|
matchValIndex = currentIndex;
|
|
4420
4421
|
}
|
|
4421
4422
|
}
|
|
4422
4423
|
// 3 - give new indexes for the Binary search
|
|
4423
|
-
if ((
|
|
4424
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
4424
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
4425
4425
|
indexRight = currentIndex - 1;
|
|
4426
4426
|
}
|
|
4427
4427
|
else {
|
|
@@ -4429,7 +4429,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
4429
4429
|
}
|
|
4430
4430
|
}
|
|
4431
4431
|
// note that valMinIndex could be 0
|
|
4432
|
-
|
|
4432
|
+
if (matchValIndex === undefined) {
|
|
4433
|
+
return -1;
|
|
4434
|
+
}
|
|
4435
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
4433
4436
|
}
|
|
4434
4437
|
/**
|
|
4435
4438
|
* Perform a linear search and return the index of the match.
|
|
@@ -9655,13 +9658,13 @@ function toExcelDataset(getters, ds) {
|
|
|
9655
9658
|
else if (ds.labelCell) {
|
|
9656
9659
|
label = {
|
|
9657
9660
|
reference: getters.getRangeString(ds.labelCell, "forceSheetReference", {
|
|
9658
|
-
|
|
9661
|
+
useBoundedReference: true,
|
|
9659
9662
|
}),
|
|
9660
9663
|
};
|
|
9661
9664
|
}
|
|
9662
9665
|
return {
|
|
9663
9666
|
label,
|
|
9664
|
-
range: getters.getRangeString(dataRange, "forceSheetReference", {
|
|
9667
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useBoundedReference: true }),
|
|
9665
9668
|
backgroundColor: ds.backgroundColor,
|
|
9666
9669
|
rightYAxis: ds.rightYAxis,
|
|
9667
9670
|
};
|
|
@@ -9676,7 +9679,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
9676
9679
|
zone.top = zone.top + 1;
|
|
9677
9680
|
}
|
|
9678
9681
|
const range = labelRange.clone({ zone });
|
|
9679
|
-
return getters.getRangeString(range, "forceSheetReference", {
|
|
9682
|
+
return getters.getRangeString(range, "forceSheetReference", { useBoundedReference: true });
|
|
9680
9683
|
}
|
|
9681
9684
|
/**
|
|
9682
9685
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -32203,6 +32206,10 @@ class Popover extends owl.Component {
|
|
|
32203
32206
|
this.currentDisplayValue = newDisplay;
|
|
32204
32207
|
if (!anchor)
|
|
32205
32208
|
return;
|
|
32209
|
+
el.style.top = "";
|
|
32210
|
+
el.style.left = "";
|
|
32211
|
+
el.style["max-height"] = "";
|
|
32212
|
+
el.style["max-width"] = "";
|
|
32206
32213
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
32207
32214
|
let elDims = {
|
|
32208
32215
|
width: el.getBoundingClientRect().width,
|
|
@@ -48638,7 +48645,7 @@ class GridComposer extends owl.Component {
|
|
|
48638
48645
|
return;
|
|
48639
48646
|
}
|
|
48640
48647
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
48641
|
-
const zone = this.env.model.getters.
|
|
48648
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
48642
48649
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
48643
48650
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
48644
48651
|
this.isCellReferenceVisible = true;
|
|
@@ -50474,13 +50481,23 @@ class GridRenderer {
|
|
|
50474
50481
|
drawLayer(renderingContext, layer) {
|
|
50475
50482
|
switch (layer) {
|
|
50476
50483
|
case "Background":
|
|
50477
|
-
|
|
50478
|
-
this.
|
|
50479
|
-
|
|
50480
|
-
|
|
50481
|
-
|
|
50482
|
-
|
|
50483
|
-
|
|
50484
|
+
this.drawGlobalBackground(renderingContext);
|
|
50485
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
50486
|
+
const { ctx } = renderingContext;
|
|
50487
|
+
ctx.save();
|
|
50488
|
+
ctx.beginPath();
|
|
50489
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
50490
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
50491
|
+
ctx.clip();
|
|
50492
|
+
const boxes = this.getGridBoxes(zone);
|
|
50493
|
+
this.drawBackground(renderingContext, boxes);
|
|
50494
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
50495
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
50496
|
+
this.drawBorders(renderingContext, boxes);
|
|
50497
|
+
this.drawTexts(renderingContext, boxes);
|
|
50498
|
+
this.drawIcon(renderingContext, boxes);
|
|
50499
|
+
ctx.restore();
|
|
50500
|
+
}
|
|
50484
50501
|
this.drawFrozenPanes(renderingContext);
|
|
50485
50502
|
break;
|
|
50486
50503
|
case "Headers":
|
|
@@ -50491,12 +50508,15 @@ class GridRenderer {
|
|
|
50491
50508
|
break;
|
|
50492
50509
|
}
|
|
50493
50510
|
}
|
|
50494
|
-
|
|
50495
|
-
const { ctx
|
|
50511
|
+
drawGlobalBackground(renderingContext) {
|
|
50512
|
+
const { ctx } = renderingContext;
|
|
50496
50513
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
50497
50514
|
// white background
|
|
50498
50515
|
ctx.fillStyle = "#ffffff";
|
|
50499
50516
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
50517
|
+
}
|
|
50518
|
+
drawBackground(renderingContext, boxes) {
|
|
50519
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
50500
50520
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
50501
50521
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
50502
50522
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -50927,7 +50947,7 @@ class GridRenderer {
|
|
|
50927
50947
|
const position = { sheetId, col, row };
|
|
50928
50948
|
const cell = this.getters.getEvaluatedCell(position);
|
|
50929
50949
|
const showFormula = this.getters.shouldShowFormulas();
|
|
50930
|
-
const { x, y, width, height } = this.getters.
|
|
50950
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
50931
50951
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
50932
50952
|
let style = this.getters.getCellComputedStyle(position);
|
|
50933
50953
|
if (this.fingerprints.isEnabled) {
|
|
@@ -51052,12 +51072,16 @@ class GridRenderer {
|
|
|
51052
51072
|
}
|
|
51053
51073
|
return box;
|
|
51054
51074
|
}
|
|
51055
|
-
getGridBoxes() {
|
|
51075
|
+
getGridBoxes(zone) {
|
|
51056
51076
|
const boxes = [];
|
|
51057
|
-
const visibleCols = this.getters
|
|
51077
|
+
const visibleCols = this.getters
|
|
51078
|
+
.getSheetViewVisibleCols()
|
|
51079
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
51058
51080
|
const left = visibleCols[0];
|
|
51059
51081
|
const right = visibleCols[visibleCols.length - 1];
|
|
51060
|
-
const visibleRows = this.getters
|
|
51082
|
+
const visibleRows = this.getters
|
|
51083
|
+
.getSheetViewVisibleRows()
|
|
51084
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
51061
51085
|
const top = visibleRows[0];
|
|
51062
51086
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
51063
51087
|
const viewport = { left, right, top, bottom };
|
|
@@ -53289,7 +53313,7 @@ class CellPlugin extends CorePlugin {
|
|
|
53289
53313
|
/*
|
|
53290
53314
|
* Reconstructs the original formula string based on new dependencies
|
|
53291
53315
|
*/
|
|
53292
|
-
getFormulaString(sheetId, tokens, dependencies,
|
|
53316
|
+
getFormulaString(sheetId, tokens, dependencies, useBoundedReference = false) {
|
|
53293
53317
|
if (!dependencies.length) {
|
|
53294
53318
|
return concat(tokens.map((token) => token.value));
|
|
53295
53319
|
}
|
|
@@ -53297,7 +53321,7 @@ class CellPlugin extends CorePlugin {
|
|
|
53297
53321
|
return concat(tokens.map((token) => {
|
|
53298
53322
|
if (token.type === "REFERENCE") {
|
|
53299
53323
|
const range = dependencies[rangeIndex++];
|
|
53300
|
-
return this.getters.getRangeString(range, sheetId, {
|
|
53324
|
+
return this.getters.getRangeString(range, sheetId, { useBoundedReference });
|
|
53301
53325
|
}
|
|
53302
53326
|
return token.value;
|
|
53303
53327
|
}));
|
|
@@ -53577,7 +53601,7 @@ class FormulaCellWithDependencies {
|
|
|
53577
53601
|
if (token.type === "REFERENCE") {
|
|
53578
53602
|
const index = rangeIndex++;
|
|
53579
53603
|
return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
|
|
53580
|
-
|
|
53604
|
+
useBoundedReference: true,
|
|
53581
53605
|
});
|
|
53582
53606
|
}
|
|
53583
53607
|
return token.value;
|
|
@@ -53914,7 +53938,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
53914
53938
|
if (data.sheets) {
|
|
53915
53939
|
for (let sheet of data.sheets) {
|
|
53916
53940
|
if (this.cfRules[sheet.id]) {
|
|
53917
|
-
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, {
|
|
53941
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useBoundedReference: true }));
|
|
53918
53942
|
}
|
|
53919
53943
|
}
|
|
53920
53944
|
}
|
|
@@ -53983,9 +54007,9 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
53983
54007
|
// ---------------------------------------------------------------------------
|
|
53984
54008
|
// Private
|
|
53985
54009
|
// ---------------------------------------------------------------------------
|
|
53986
|
-
mapToConditionalFormat(sheetId, cf, {
|
|
54010
|
+
mapToConditionalFormat(sheetId, cf, { useBoundedReference } = { useBoundedReference: false }) {
|
|
53987
54011
|
const ranges = cf.ranges.map((range) => {
|
|
53988
|
-
return this.getters.getRangeString(range, sheetId, {
|
|
54012
|
+
return this.getters.getRangeString(range, sheetId, { useBoundedReference });
|
|
53989
54013
|
});
|
|
53990
54014
|
if (cf.rule.type !== "DataBarRule") {
|
|
53991
54015
|
return {
|
|
@@ -54000,7 +54024,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
54000
54024
|
...cf.rule,
|
|
54001
54025
|
rangeValues: cf.rule.rangeValues &&
|
|
54002
54026
|
this.getters.getRangeString(cf.rule.rangeValues, sheetId, {
|
|
54003
|
-
|
|
54027
|
+
useBoundedReference,
|
|
54004
54028
|
}),
|
|
54005
54029
|
},
|
|
54006
54030
|
ranges,
|
|
@@ -54441,10 +54465,20 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
54441
54465
|
for (const sheet of data.sheets) {
|
|
54442
54466
|
sheet.dataValidationRules = [];
|
|
54443
54467
|
for (const rule of this.rules[sheet.id]) {
|
|
54444
|
-
|
|
54445
|
-
...rule,
|
|
54446
|
-
ranges: rule.ranges.map((range) => this.getters.getRangeString(range, sheet.id, {
|
|
54447
|
-
}
|
|
54468
|
+
const excelRule = {
|
|
54469
|
+
...deepCopy(rule),
|
|
54470
|
+
ranges: rule.ranges.map((range) => this.getters.getRangeString(range, sheet.id, { useBoundedReference: true })),
|
|
54471
|
+
};
|
|
54472
|
+
if (rule.criterion.type === "isValueInRange") {
|
|
54473
|
+
excelRule.criterion.values = rule.criterion.values.map((value) => {
|
|
54474
|
+
const range = this.getters.getRangeFromSheetXC(sheet.id, value);
|
|
54475
|
+
return this.getters.getRangeString(range, sheet.id, {
|
|
54476
|
+
useBoundedReference: true,
|
|
54477
|
+
useFixedReference: true,
|
|
54478
|
+
});
|
|
54479
|
+
});
|
|
54480
|
+
}
|
|
54481
|
+
sheet.dataValidationRules.push(excelRule);
|
|
54448
54482
|
}
|
|
54449
54483
|
}
|
|
54450
54484
|
}
|
|
@@ -55865,9 +55899,10 @@ class RangeAdapter {
|
|
|
55865
55899
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
55866
55900
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
55867
55901
|
* @param options
|
|
55902
|
+
* @param options.useBoundedReference if true, the range will be returned with bounded row and column
|
|
55868
55903
|
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
55869
55904
|
*/
|
|
55870
|
-
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
55905
|
+
getRangeString(range, forSheetId, options = { useBoundedReference: false, useFixedReference: false }) {
|
|
55871
55906
|
if (!range) {
|
|
55872
55907
|
return CellErrorType.InvalidReference;
|
|
55873
55908
|
}
|
|
@@ -55970,13 +56005,13 @@ class RangeAdapter {
|
|
|
55970
56005
|
/**
|
|
55971
56006
|
* Get a Xc string that represent a part of a range
|
|
55972
56007
|
*/
|
|
55973
|
-
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
55974
|
-
const colFixed = range.parts
|
|
56008
|
+
getRangePartString(range, part, options = { useBoundedReference: false, useFixedReference: false }) {
|
|
56009
|
+
const colFixed = range.parts[part]?.colFixed || options.useFixedReference ? "$" : "";
|
|
55975
56010
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
55976
|
-
const rowFixed = range.parts
|
|
56011
|
+
const rowFixed = range.parts[part]?.rowFixed || options.useFixedReference ? "$" : "";
|
|
55977
56012
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
55978
56013
|
let str = "";
|
|
55979
|
-
if (range.isFullCol && !options.
|
|
56014
|
+
if (range.isFullCol && !options.useBoundedReference) {
|
|
55980
56015
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
55981
56016
|
str = colFixed + col + rowFixed + row;
|
|
55982
56017
|
}
|
|
@@ -55984,7 +56019,7 @@ class RangeAdapter {
|
|
|
55984
56019
|
str = colFixed + col;
|
|
55985
56020
|
}
|
|
55986
56021
|
}
|
|
55987
|
-
else if (range.isFullRow && !options.
|
|
56022
|
+
else if (range.isFullRow && !options.useBoundedReference) {
|
|
55988
56023
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
55989
56024
|
str = colFixed + col + rowFixed + row;
|
|
55990
56025
|
}
|
|
@@ -63163,6 +63198,7 @@ class Session extends EventBus {
|
|
|
63163
63198
|
waitingUndoRedoAck = false;
|
|
63164
63199
|
isReplayingInitialRevisions = false;
|
|
63165
63200
|
processedRevisions = new Set();
|
|
63201
|
+
lastRevisionMessage = undefined;
|
|
63166
63202
|
uuidGenerator = new UuidGenerator();
|
|
63167
63203
|
lastLocalOperation;
|
|
63168
63204
|
/**
|
|
@@ -63263,7 +63299,10 @@ class Session extends EventBus {
|
|
|
63263
63299
|
* Notify the server that the user client left the collaborative session
|
|
63264
63300
|
*/
|
|
63265
63301
|
async leave(data) {
|
|
63266
|
-
if (data &&
|
|
63302
|
+
if (data &&
|
|
63303
|
+
Object.keys(this.clients).length === 1 &&
|
|
63304
|
+
this.lastRevisionMessage &&
|
|
63305
|
+
this.lastRevisionMessage?.type !== "SNAPSHOT_CREATED") {
|
|
63267
63306
|
await this.snapshot(data());
|
|
63268
63307
|
}
|
|
63269
63308
|
delete this.clients[this.clientId];
|
|
@@ -63484,6 +63523,7 @@ class Session extends EventBus {
|
|
|
63484
63523
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
63485
63524
|
this.serverRevisionId = message.nextRevisionId;
|
|
63486
63525
|
this.processedRevisions.add(message.nextRevisionId);
|
|
63526
|
+
this.lastRevisionMessage = message;
|
|
63487
63527
|
this.sendPendingMessage();
|
|
63488
63528
|
break;
|
|
63489
63529
|
}
|
|
@@ -66723,8 +66763,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
66723
66763
|
},
|
|
66724
66764
|
];
|
|
66725
66765
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
66766
|
+
const selection = pasteTarget[0];
|
|
66767
|
+
const col = selection.left;
|
|
66768
|
+
const row = selection.top;
|
|
66769
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
66726
66770
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
66727
|
-
let currentIndex = cmd.base;
|
|
66771
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
66728
66772
|
const resizingGroups = {};
|
|
66729
66773
|
for (const element of toRemove) {
|
|
66730
66774
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
@@ -67015,22 +67059,33 @@ class InternalViewport {
|
|
|
67015
67059
|
}
|
|
67016
67060
|
/**
|
|
67017
67061
|
*
|
|
67018
|
-
*
|
|
67019
|
-
*
|
|
67062
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
67063
|
+
*
|
|
67020
67064
|
*/
|
|
67021
|
-
|
|
67065
|
+
getVisibleRect(zone) {
|
|
67022
67066
|
const targetZone = intersection(zone, this);
|
|
67023
67067
|
if (targetZone) {
|
|
67024
67068
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
67025
67069
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
67026
67070
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
67027
67071
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
67028
|
-
return {
|
|
67029
|
-
|
|
67030
|
-
|
|
67031
|
-
|
|
67032
|
-
|
|
67033
|
-
|
|
67072
|
+
return { x, y, width, height };
|
|
67073
|
+
}
|
|
67074
|
+
return undefined;
|
|
67075
|
+
}
|
|
67076
|
+
/**
|
|
67077
|
+
*
|
|
67078
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
67079
|
+
*
|
|
67080
|
+
*/
|
|
67081
|
+
getFullRect(zone) {
|
|
67082
|
+
const targetZone = intersection(zone, this);
|
|
67083
|
+
if (targetZone) {
|
|
67084
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
67085
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
67086
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
67087
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
67088
|
+
return { x, y, width, height };
|
|
67034
67089
|
}
|
|
67035
67090
|
return undefined;
|
|
67036
67091
|
}
|
|
@@ -67200,6 +67255,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
67200
67255
|
"isPositionVisible",
|
|
67201
67256
|
"getColDimensionsInViewport",
|
|
67202
67257
|
"getRowDimensionsInViewport",
|
|
67258
|
+
"getAllActiveViewportsZones",
|
|
67259
|
+
"getRect",
|
|
67203
67260
|
];
|
|
67204
67261
|
viewports = {};
|
|
67205
67262
|
/**
|
|
@@ -67583,16 +67640,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
67583
67640
|
getVisibleRectWithoutHeaders(zone) {
|
|
67584
67641
|
const sheetId = this.getters.getActiveSheetId();
|
|
67585
67642
|
const viewportRects = this.getSubViewports(sheetId)
|
|
67586
|
-
.map((viewport) => viewport.
|
|
67643
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
67587
67644
|
.filter(isDefined);
|
|
67588
67645
|
if (viewportRects.length === 0) {
|
|
67589
67646
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67590
67647
|
}
|
|
67591
|
-
|
|
67592
|
-
|
|
67593
|
-
|
|
67594
|
-
|
|
67595
|
-
|
|
67648
|
+
return this.recomposeRect(viewportRects);
|
|
67649
|
+
}
|
|
67650
|
+
/**
|
|
67651
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
67652
|
+
* regardless of the viewport dimensions.
|
|
67653
|
+
*/
|
|
67654
|
+
getRect(zone) {
|
|
67655
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67656
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
67657
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
67658
|
+
.filter(isDefined);
|
|
67659
|
+
if (viewportRects.length === 0) {
|
|
67660
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67661
|
+
}
|
|
67662
|
+
const rect = this.recomposeRect(viewportRects);
|
|
67663
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
67596
67664
|
}
|
|
67597
67665
|
/**
|
|
67598
67666
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -67636,6 +67704,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
67636
67704
|
end: start + (isRowHidden ? 0 : size),
|
|
67637
67705
|
};
|
|
67638
67706
|
}
|
|
67707
|
+
getAllActiveViewportsZones() {
|
|
67708
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67709
|
+
return this.getSubViewports(sheetId);
|
|
67710
|
+
}
|
|
67639
67711
|
// ---------------------------------------------------------------------------
|
|
67640
67712
|
// Private
|
|
67641
67713
|
// ---------------------------------------------------------------------------
|
|
@@ -67826,6 +67898,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
67826
67898
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
67827
67899
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
67828
67900
|
}
|
|
67901
|
+
recomposeRect(viewportRects) {
|
|
67902
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
67903
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
67904
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
67905
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
67906
|
+
return { x, y, width, height };
|
|
67907
|
+
}
|
|
67829
67908
|
}
|
|
67830
67909
|
|
|
67831
67910
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -74954,6 +75033,6 @@ exports.tokenColors = tokenColors;
|
|
|
74954
75033
|
exports.tokenize = tokenize;
|
|
74955
75034
|
|
|
74956
75035
|
|
|
74957
|
-
__info__.version = "18.1.
|
|
74958
|
-
__info__.date = "2025-01-
|
|
74959
|
-
__info__.hash = "
|
|
75036
|
+
__info__.version = "18.1.4";
|
|
75037
|
+
__info__.date = "2025-01-29T06:27:32.901Z";
|
|
75038
|
+
__info__.hash = "a11ef27";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1186,6 +1186,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
|
|
|
1186
1186
|
private waitingUndoRedoAck;
|
|
1187
1187
|
private isReplayingInitialRevisions;
|
|
1188
1188
|
private processedRevisions;
|
|
1189
|
+
private lastRevisionMessage;
|
|
1189
1190
|
private uuidGenerator;
|
|
1190
1191
|
private lastLocalOperation;
|
|
1191
1192
|
/**
|
|
@@ -2103,10 +2104,16 @@ declare class InternalViewport {
|
|
|
2103
2104
|
adjustViewportZone(): void;
|
|
2104
2105
|
/**
|
|
2105
2106
|
*
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2107
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
2108
|
+
*
|
|
2109
|
+
*/
|
|
2110
|
+
getVisibleRect(zone: Zone): Rect | undefined;
|
|
2111
|
+
/**
|
|
2112
|
+
*
|
|
2113
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
2114
|
+
*
|
|
2108
2115
|
*/
|
|
2109
|
-
|
|
2116
|
+
getFullRect(zone: Zone): Rect | undefined;
|
|
2110
2117
|
isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
|
|
2111
2118
|
private searchHeaderIndex;
|
|
2112
2119
|
private setViewportOffsetX;
|
|
@@ -2175,7 +2182,7 @@ type SheetViewports = {
|
|
|
2175
2182
|
*
|
|
2176
2183
|
*/
|
|
2177
2184
|
declare class SheetViewPlugin extends UIPlugin {
|
|
2178
|
-
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport"];
|
|
2185
|
+
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport", "getAllActiveViewportsZones", "getRect"];
|
|
2179
2186
|
readonly viewports: Record<UID, SheetViewports | undefined>;
|
|
2180
2187
|
/**
|
|
2181
2188
|
* The viewport dimensions are usually set by one of the components
|
|
@@ -2246,6 +2253,11 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
2246
2253
|
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
2247
2254
|
*/
|
|
2248
2255
|
getVisibleRectWithoutHeaders(zone: Zone): Rect;
|
|
2256
|
+
/**
|
|
2257
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
2258
|
+
* regardless of the viewport dimensions.
|
|
2259
|
+
*/
|
|
2260
|
+
getRect(zone: Zone): Rect;
|
|
2249
2261
|
/**
|
|
2250
2262
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
2251
2263
|
* It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
|
|
@@ -2262,6 +2274,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
2262
2274
|
* of the current viewport
|
|
2263
2275
|
*/
|
|
2264
2276
|
getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
|
|
2277
|
+
getAllActiveViewportsZones(): Zone[];
|
|
2265
2278
|
private ensureMainViewportExist;
|
|
2266
2279
|
private getSubViewports;
|
|
2267
2280
|
private checkPositiveDimension;
|
|
@@ -2293,6 +2306,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
2293
2306
|
xRatio: number;
|
|
2294
2307
|
yRatio: number;
|
|
2295
2308
|
};
|
|
2309
|
+
private recomposeRect;
|
|
2296
2310
|
}
|
|
2297
2311
|
|
|
2298
2312
|
declare enum ClipboardMIMEType {
|
|
@@ -3964,6 +3978,10 @@ interface SpreadsheetChildEnv extends NotificationStoreMethods {
|
|
|
3964
3978
|
getStore: Get;
|
|
3965
3979
|
}
|
|
3966
3980
|
|
|
3981
|
+
interface RangeStringOptions {
|
|
3982
|
+
useBoundedReference?: boolean;
|
|
3983
|
+
useFixedReference?: boolean;
|
|
3984
|
+
}
|
|
3967
3985
|
declare class RangeAdapter implements CommandHandler<CoreCommand> {
|
|
3968
3986
|
private getters;
|
|
3969
3987
|
private providers;
|
|
@@ -4011,11 +4029,10 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
|
|
|
4011
4029
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
4012
4030
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
4013
4031
|
* @param options
|
|
4032
|
+
* @param options.useBoundedReference if true, the range will be returned with bounded row and column
|
|
4014
4033
|
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
4015
4034
|
*/
|
|
4016
|
-
getRangeString(range: Range, forSheetId: UID, options?:
|
|
4017
|
-
useFixedReference: boolean;
|
|
4018
|
-
}): string;
|
|
4035
|
+
getRangeString(range: Range, forSheetId: UID, options?: RangeStringOptions): string;
|
|
4019
4036
|
getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
|
|
4020
4037
|
getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
|
|
4021
4038
|
getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
|
|
@@ -4249,7 +4266,7 @@ declare class CellPlugin extends CorePlugin<CoreState$1> implements CoreState$1
|
|
|
4249
4266
|
* starting an async evaluation even if it has been moved or re-allocated
|
|
4250
4267
|
*/
|
|
4251
4268
|
getCellById(cellId: UID): Cell | undefined;
|
|
4252
|
-
getFormulaString(sheetId: UID, tokens: Token[], dependencies: Range[],
|
|
4269
|
+
getFormulaString(sheetId: UID, tokens: Token[], dependencies: Range[], useBoundedReference?: boolean): string;
|
|
4253
4270
|
getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, tokens: Token[]): string;
|
|
4254
4271
|
getFormulaMovedInSheet(originSheetId: UID, targetSheetId: UID, tokens: Token[]): string;
|
|
4255
4272
|
getCellStyle(position: CellPosition): Style;
|