@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
|
(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.
|
|
@@ -9654,13 +9657,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9654
9657
|
else if (ds.labelCell) {
|
|
9655
9658
|
label = {
|
|
9656
9659
|
reference: getters.getRangeString(ds.labelCell, "forceSheetReference", {
|
|
9657
|
-
|
|
9660
|
+
useBoundedReference: true,
|
|
9658
9661
|
}),
|
|
9659
9662
|
};
|
|
9660
9663
|
}
|
|
9661
9664
|
return {
|
|
9662
9665
|
label,
|
|
9663
|
-
range: getters.getRangeString(dataRange, "forceSheetReference", {
|
|
9666
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useBoundedReference: true }),
|
|
9664
9667
|
backgroundColor: ds.backgroundColor,
|
|
9665
9668
|
rightYAxis: ds.rightYAxis,
|
|
9666
9669
|
};
|
|
@@ -9675,7 +9678,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9675
9678
|
zone.top = zone.top + 1;
|
|
9676
9679
|
}
|
|
9677
9680
|
const range = labelRange.clone({ zone });
|
|
9678
|
-
return getters.getRangeString(range, "forceSheetReference", {
|
|
9681
|
+
return getters.getRangeString(range, "forceSheetReference", { useBoundedReference: true });
|
|
9679
9682
|
}
|
|
9680
9683
|
/**
|
|
9681
9684
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -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 };
|
|
@@ -53288,7 +53312,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53288
53312
|
/*
|
|
53289
53313
|
* Reconstructs the original formula string based on new dependencies
|
|
53290
53314
|
*/
|
|
53291
|
-
getFormulaString(sheetId, tokens, dependencies,
|
|
53315
|
+
getFormulaString(sheetId, tokens, dependencies, useBoundedReference = false) {
|
|
53292
53316
|
if (!dependencies.length) {
|
|
53293
53317
|
return concat(tokens.map((token) => token.value));
|
|
53294
53318
|
}
|
|
@@ -53296,7 +53320,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53296
53320
|
return concat(tokens.map((token) => {
|
|
53297
53321
|
if (token.type === "REFERENCE") {
|
|
53298
53322
|
const range = dependencies[rangeIndex++];
|
|
53299
|
-
return this.getters.getRangeString(range, sheetId, {
|
|
53323
|
+
return this.getters.getRangeString(range, sheetId, { useBoundedReference });
|
|
53300
53324
|
}
|
|
53301
53325
|
return token.value;
|
|
53302
53326
|
}));
|
|
@@ -53576,7 +53600,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53576
53600
|
if (token.type === "REFERENCE") {
|
|
53577
53601
|
const index = rangeIndex++;
|
|
53578
53602
|
return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
|
|
53579
|
-
|
|
53603
|
+
useBoundedReference: true,
|
|
53580
53604
|
});
|
|
53581
53605
|
}
|
|
53582
53606
|
return token.value;
|
|
@@ -53913,7 +53937,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53913
53937
|
if (data.sheets) {
|
|
53914
53938
|
for (let sheet of data.sheets) {
|
|
53915
53939
|
if (this.cfRules[sheet.id]) {
|
|
53916
|
-
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, {
|
|
53940
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useBoundedReference: true }));
|
|
53917
53941
|
}
|
|
53918
53942
|
}
|
|
53919
53943
|
}
|
|
@@ -53982,9 +54006,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53982
54006
|
// ---------------------------------------------------------------------------
|
|
53983
54007
|
// Private
|
|
53984
54008
|
// ---------------------------------------------------------------------------
|
|
53985
|
-
mapToConditionalFormat(sheetId, cf, {
|
|
54009
|
+
mapToConditionalFormat(sheetId, cf, { useBoundedReference } = { useBoundedReference: false }) {
|
|
53986
54010
|
const ranges = cf.ranges.map((range) => {
|
|
53987
|
-
return this.getters.getRangeString(range, sheetId, {
|
|
54011
|
+
return this.getters.getRangeString(range, sheetId, { useBoundedReference });
|
|
53988
54012
|
});
|
|
53989
54013
|
if (cf.rule.type !== "DataBarRule") {
|
|
53990
54014
|
return {
|
|
@@ -53999,7 +54023,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53999
54023
|
...cf.rule,
|
|
54000
54024
|
rangeValues: cf.rule.rangeValues &&
|
|
54001
54025
|
this.getters.getRangeString(cf.rule.rangeValues, sheetId, {
|
|
54002
|
-
|
|
54026
|
+
useBoundedReference,
|
|
54003
54027
|
}),
|
|
54004
54028
|
},
|
|
54005
54029
|
ranges,
|
|
@@ -54440,10 +54464,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54440
54464
|
for (const sheet of data.sheets) {
|
|
54441
54465
|
sheet.dataValidationRules = [];
|
|
54442
54466
|
for (const rule of this.rules[sheet.id]) {
|
|
54443
|
-
|
|
54444
|
-
...rule,
|
|
54445
|
-
ranges: rule.ranges.map((range) => this.getters.getRangeString(range, sheet.id, {
|
|
54446
|
-
}
|
|
54467
|
+
const excelRule = {
|
|
54468
|
+
...deepCopy(rule),
|
|
54469
|
+
ranges: rule.ranges.map((range) => this.getters.getRangeString(range, sheet.id, { useBoundedReference: true })),
|
|
54470
|
+
};
|
|
54471
|
+
if (rule.criterion.type === "isValueInRange") {
|
|
54472
|
+
excelRule.criterion.values = rule.criterion.values.map((value) => {
|
|
54473
|
+
const range = this.getters.getRangeFromSheetXC(sheet.id, value);
|
|
54474
|
+
return this.getters.getRangeString(range, sheet.id, {
|
|
54475
|
+
useBoundedReference: true,
|
|
54476
|
+
useFixedReference: true,
|
|
54477
|
+
});
|
|
54478
|
+
});
|
|
54479
|
+
}
|
|
54480
|
+
sheet.dataValidationRules.push(excelRule);
|
|
54447
54481
|
}
|
|
54448
54482
|
}
|
|
54449
54483
|
}
|
|
@@ -55864,9 +55898,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55864
55898
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
55865
55899
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
55866
55900
|
* @param options
|
|
55901
|
+
* @param options.useBoundedReference if true, the range will be returned with bounded row and column
|
|
55867
55902
|
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
55868
55903
|
*/
|
|
55869
|
-
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
55904
|
+
getRangeString(range, forSheetId, options = { useBoundedReference: false, useFixedReference: false }) {
|
|
55870
55905
|
if (!range) {
|
|
55871
55906
|
return CellErrorType.InvalidReference;
|
|
55872
55907
|
}
|
|
@@ -55969,13 +56004,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55969
56004
|
/**
|
|
55970
56005
|
* Get a Xc string that represent a part of a range
|
|
55971
56006
|
*/
|
|
55972
|
-
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
55973
|
-
const colFixed = range.parts
|
|
56007
|
+
getRangePartString(range, part, options = { useBoundedReference: false, useFixedReference: false }) {
|
|
56008
|
+
const colFixed = range.parts[part]?.colFixed || options.useFixedReference ? "$" : "";
|
|
55974
56009
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
55975
|
-
const rowFixed = range.parts
|
|
56010
|
+
const rowFixed = range.parts[part]?.rowFixed || options.useFixedReference ? "$" : "";
|
|
55976
56011
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
55977
56012
|
let str = "";
|
|
55978
|
-
if (range.isFullCol && !options.
|
|
56013
|
+
if (range.isFullCol && !options.useBoundedReference) {
|
|
55979
56014
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
55980
56015
|
str = colFixed + col + rowFixed + row;
|
|
55981
56016
|
}
|
|
@@ -55983,7 +56018,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55983
56018
|
str = colFixed + col;
|
|
55984
56019
|
}
|
|
55985
56020
|
}
|
|
55986
|
-
else if (range.isFullRow && !options.
|
|
56021
|
+
else if (range.isFullRow && !options.useBoundedReference) {
|
|
55987
56022
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
55988
56023
|
str = colFixed + col + rowFixed + row;
|
|
55989
56024
|
}
|
|
@@ -63162,6 +63197,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63162
63197
|
waitingUndoRedoAck = false;
|
|
63163
63198
|
isReplayingInitialRevisions = false;
|
|
63164
63199
|
processedRevisions = new Set();
|
|
63200
|
+
lastRevisionMessage = undefined;
|
|
63165
63201
|
uuidGenerator = new UuidGenerator();
|
|
63166
63202
|
lastLocalOperation;
|
|
63167
63203
|
/**
|
|
@@ -63262,7 +63298,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63262
63298
|
* Notify the server that the user client left the collaborative session
|
|
63263
63299
|
*/
|
|
63264
63300
|
async leave(data) {
|
|
63265
|
-
if (data &&
|
|
63301
|
+
if (data &&
|
|
63302
|
+
Object.keys(this.clients).length === 1 &&
|
|
63303
|
+
this.lastRevisionMessage &&
|
|
63304
|
+
this.lastRevisionMessage?.type !== "SNAPSHOT_CREATED") {
|
|
63266
63305
|
await this.snapshot(data());
|
|
63267
63306
|
}
|
|
63268
63307
|
delete this.clients[this.clientId];
|
|
@@ -63483,6 +63522,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63483
63522
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
63484
63523
|
this.serverRevisionId = message.nextRevisionId;
|
|
63485
63524
|
this.processedRevisions.add(message.nextRevisionId);
|
|
63525
|
+
this.lastRevisionMessage = message;
|
|
63486
63526
|
this.sendPendingMessage();
|
|
63487
63527
|
break;
|
|
63488
63528
|
}
|
|
@@ -66722,8 +66762,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66722
66762
|
},
|
|
66723
66763
|
];
|
|
66724
66764
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
66765
|
+
const selection = pasteTarget[0];
|
|
66766
|
+
const col = selection.left;
|
|
66767
|
+
const row = selection.top;
|
|
66768
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
66725
66769
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
66726
|
-
let currentIndex = cmd.base;
|
|
66770
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
66727
66771
|
const resizingGroups = {};
|
|
66728
66772
|
for (const element of toRemove) {
|
|
66729
66773
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
@@ -67014,22 +67058,33 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67014
67058
|
}
|
|
67015
67059
|
/**
|
|
67016
67060
|
*
|
|
67017
|
-
*
|
|
67018
|
-
*
|
|
67061
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
67062
|
+
*
|
|
67019
67063
|
*/
|
|
67020
|
-
|
|
67064
|
+
getVisibleRect(zone) {
|
|
67021
67065
|
const targetZone = intersection(zone, this);
|
|
67022
67066
|
if (targetZone) {
|
|
67023
67067
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
67024
67068
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
67025
67069
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
67026
67070
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
67027
|
-
return {
|
|
67028
|
-
|
|
67029
|
-
|
|
67030
|
-
|
|
67031
|
-
|
|
67032
|
-
|
|
67071
|
+
return { x, y, width, height };
|
|
67072
|
+
}
|
|
67073
|
+
return undefined;
|
|
67074
|
+
}
|
|
67075
|
+
/**
|
|
67076
|
+
*
|
|
67077
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
67078
|
+
*
|
|
67079
|
+
*/
|
|
67080
|
+
getFullRect(zone) {
|
|
67081
|
+
const targetZone = intersection(zone, this);
|
|
67082
|
+
if (targetZone) {
|
|
67083
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
67084
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
67085
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
67086
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
67087
|
+
return { x, y, width, height };
|
|
67033
67088
|
}
|
|
67034
67089
|
return undefined;
|
|
67035
67090
|
}
|
|
@@ -67199,6 +67254,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67199
67254
|
"isPositionVisible",
|
|
67200
67255
|
"getColDimensionsInViewport",
|
|
67201
67256
|
"getRowDimensionsInViewport",
|
|
67257
|
+
"getAllActiveViewportsZones",
|
|
67258
|
+
"getRect",
|
|
67202
67259
|
];
|
|
67203
67260
|
viewports = {};
|
|
67204
67261
|
/**
|
|
@@ -67582,16 +67639,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67582
67639
|
getVisibleRectWithoutHeaders(zone) {
|
|
67583
67640
|
const sheetId = this.getters.getActiveSheetId();
|
|
67584
67641
|
const viewportRects = this.getSubViewports(sheetId)
|
|
67585
|
-
.map((viewport) => viewport.
|
|
67642
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
67586
67643
|
.filter(isDefined);
|
|
67587
67644
|
if (viewportRects.length === 0) {
|
|
67588
67645
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67589
67646
|
}
|
|
67590
|
-
|
|
67591
|
-
|
|
67592
|
-
|
|
67593
|
-
|
|
67594
|
-
|
|
67647
|
+
return this.recomposeRect(viewportRects);
|
|
67648
|
+
}
|
|
67649
|
+
/**
|
|
67650
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
67651
|
+
* regardless of the viewport dimensions.
|
|
67652
|
+
*/
|
|
67653
|
+
getRect(zone) {
|
|
67654
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67655
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
67656
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
67657
|
+
.filter(isDefined);
|
|
67658
|
+
if (viewportRects.length === 0) {
|
|
67659
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
67660
|
+
}
|
|
67661
|
+
const rect = this.recomposeRect(viewportRects);
|
|
67662
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
67595
67663
|
}
|
|
67596
67664
|
/**
|
|
67597
67665
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -67635,6 +67703,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67635
67703
|
end: start + (isRowHidden ? 0 : size),
|
|
67636
67704
|
};
|
|
67637
67705
|
}
|
|
67706
|
+
getAllActiveViewportsZones() {
|
|
67707
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
67708
|
+
return this.getSubViewports(sheetId);
|
|
67709
|
+
}
|
|
67638
67710
|
// ---------------------------------------------------------------------------
|
|
67639
67711
|
// Private
|
|
67640
67712
|
// ---------------------------------------------------------------------------
|
|
@@ -67825,6 +67897,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67825
67897
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
67826
67898
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
67827
67899
|
}
|
|
67900
|
+
recomposeRect(viewportRects) {
|
|
67901
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
67902
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
67903
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
67904
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
67905
|
+
return { x, y, width, height };
|
|
67906
|
+
}
|
|
67828
67907
|
}
|
|
67829
67908
|
|
|
67830
67909
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -74953,9 +75032,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74953
75032
|
exports.tokenize = tokenize;
|
|
74954
75033
|
|
|
74955
75034
|
|
|
74956
|
-
__info__.version = "18.1.
|
|
74957
|
-
__info__.date = "2025-01-
|
|
74958
|
-
__info__.hash = "
|
|
75035
|
+
__info__.version = "18.1.4";
|
|
75036
|
+
__info__.date = "2025-01-29T06:27:32.901Z";
|
|
75037
|
+
__info__.hash = "a11ef27";
|
|
74959
75038
|
|
|
74960
75039
|
|
|
74961
75040
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|