@odoo/o-spreadsheet 17.1.0-alpha.4 → 17.1.0-alpha.5
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 +121 -107
- package/dist/o-spreadsheet.d.ts +16 -26
- package/dist/o-spreadsheet.esm.js +121 -107
- package/dist/o-spreadsheet.iife.js +121 -107
- package/dist/o-spreadsheet.iife.min.js +267 -269
- package/dist/o_spreadsheet.xml +4 -4
- 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 17.1.0-alpha.
|
|
6
|
-
* @date 2023-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.0-alpha.5
|
|
6
|
+
* @date 2023-12-05T09:51:40.034Z
|
|
7
|
+
* @hash c2823eb
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -3387,8 +3387,10 @@
|
|
|
3387
3387
|
const cellReference = new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/, "i");
|
|
3388
3388
|
// Same as above, but matches the exact string (nothing before or after)
|
|
3389
3389
|
const singleCellReference = new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/, "i");
|
|
3390
|
-
/** Reference of a column header (eg. A, AB) */
|
|
3391
|
-
const colHeader = new RegExp(
|
|
3390
|
+
/** Reference of a column header (eg. A, AB, $A) */
|
|
3391
|
+
const colHeader = new RegExp(/^\$?([A-Z]{1,3})+$/, "i");
|
|
3392
|
+
/** Reference of a row header (eg. 1, $1) */
|
|
3393
|
+
const rowHeader = new RegExp(/^\$?([0-9]{1,7})+$/, "i");
|
|
3392
3394
|
/** Reference of a column (eg. A, $CA, Sheet1!B) */
|
|
3393
3395
|
const colReference = new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/, "i");
|
|
3394
3396
|
/** Reference of a row (eg. 1, 59, Sheet1!9) */
|
|
@@ -3418,6 +3420,9 @@
|
|
|
3418
3420
|
function isColHeader(str) {
|
|
3419
3421
|
return colHeader.test(str);
|
|
3420
3422
|
}
|
|
3423
|
+
function isRowHeader(str) {
|
|
3424
|
+
return rowHeader.test(str);
|
|
3425
|
+
}
|
|
3421
3426
|
/**
|
|
3422
3427
|
* Return true if the given xc is the reference of a single cell,
|
|
3423
3428
|
* without any specified sheet (e.g. A1)
|
|
@@ -4108,18 +4113,10 @@
|
|
|
4108
4113
|
if (isFullCol) {
|
|
4109
4114
|
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
4110
4115
|
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
4111
|
-
if (zone.left === zone.right) {
|
|
4112
|
-
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
4113
|
-
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
4114
|
-
}
|
|
4115
4116
|
}
|
|
4116
4117
|
if (isFullRow) {
|
|
4117
4118
|
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
4118
4119
|
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
4119
|
-
if (zone.top === zone.bottom) {
|
|
4120
|
-
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
4121
|
-
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
4122
|
-
}
|
|
4123
4120
|
}
|
|
4124
4121
|
return parts;
|
|
4125
4122
|
}
|
|
@@ -4361,7 +4358,7 @@
|
|
|
4361
4358
|
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4362
4359
|
if (!cell || !cell.content)
|
|
4363
4360
|
return DEFAULT_CELL_HEIGHT;
|
|
4364
|
-
const maxWidth = cell.style?.wrapping ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4361
|
+
const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4365
4362
|
const numberOfLines = cell.isFormula
|
|
4366
4363
|
? 1
|
|
4367
4364
|
: splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
|
|
@@ -6258,10 +6255,6 @@
|
|
|
6258
6255
|
|
|
6259
6256
|
.o-error-tooltip-message {
|
|
6260
6257
|
overflow: hidden;
|
|
6261
|
-
display: -webkit-box; /* Limit to 3 lines */
|
|
6262
|
-
-webkit-line-clamp: 3;
|
|
6263
|
-
line-clamp: 3;
|
|
6264
|
-
-webkit-box-orient: vertical;
|
|
6265
6258
|
}
|
|
6266
6259
|
}
|
|
6267
6260
|
`;
|
|
@@ -6669,6 +6662,9 @@
|
|
|
6669
6662
|
keyDownString += letterRegex.test(key) ? key.toUpperCase() : key;
|
|
6670
6663
|
return keyDownString;
|
|
6671
6664
|
}
|
|
6665
|
+
function isMacOS() {
|
|
6666
|
+
return navigator.userAgent.toUpperCase().indexOf("MAC") >= 0;
|
|
6667
|
+
}
|
|
6672
6668
|
|
|
6673
6669
|
/**
|
|
6674
6670
|
* Return the o-spreadsheet element position relative
|
|
@@ -17948,6 +17944,10 @@
|
|
|
17948
17944
|
return xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
17949
17945
|
case "colrow":
|
|
17950
17946
|
indexOfNumber = xc.search(/[0-9]/);
|
|
17947
|
+
if (indexOfNumber === -1 || indexOfNumber === 0) {
|
|
17948
|
+
// no row number (eg. A) or no column (eg. 1)
|
|
17949
|
+
return "$" + xc;
|
|
17950
|
+
}
|
|
17951
17951
|
xc = xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
17952
17952
|
return "$" + xc;
|
|
17953
17953
|
case "none":
|
|
@@ -28518,6 +28518,7 @@
|
|
|
28518
28518
|
draggerShadowThickness: 0,
|
|
28519
28519
|
delta: 0,
|
|
28520
28520
|
base: 0,
|
|
28521
|
+
position: "before",
|
|
28521
28522
|
});
|
|
28522
28523
|
_computeHandleDisplay(ev) {
|
|
28523
28524
|
const position = this._getEvOffset(ev);
|
|
@@ -28642,11 +28643,13 @@
|
|
|
28642
28643
|
this.state.draggerLinePosition = dimensions.start;
|
|
28643
28644
|
this.state.draggerShadowPosition = dimensions.start;
|
|
28644
28645
|
this.state.base = elementIndex;
|
|
28646
|
+
this.state.position = "before";
|
|
28645
28647
|
}
|
|
28646
28648
|
else if (this._getSelectedZoneEnd() < elementIndex) {
|
|
28647
28649
|
this.state.draggerLinePosition = dimensions.end;
|
|
28648
28650
|
this.state.draggerShadowPosition = dimensions.end - this.state.draggerShadowThickness;
|
|
28649
|
-
this.state.base = elementIndex
|
|
28651
|
+
this.state.base = elementIndex;
|
|
28652
|
+
this.state.position = "after";
|
|
28650
28653
|
}
|
|
28651
28654
|
else {
|
|
28652
28655
|
this.state.draggerLinePosition = startDimensions.start;
|
|
@@ -28821,6 +28824,7 @@
|
|
|
28821
28824
|
dimension: "COL",
|
|
28822
28825
|
base: this.state.base,
|
|
28823
28826
|
elements,
|
|
28827
|
+
position: this.state.position,
|
|
28824
28828
|
});
|
|
28825
28829
|
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
|
|
28826
28830
|
this.env.raiseError(MergeErrorMessage);
|
|
@@ -28985,6 +28989,7 @@
|
|
|
28985
28989
|
dimension: "ROW",
|
|
28986
28990
|
base: this.state.base,
|
|
28987
28991
|
elements,
|
|
28992
|
+
position: this.state.position,
|
|
28988
28993
|
});
|
|
28989
28994
|
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
|
|
28990
28995
|
this.env.raiseError(MergeErrorMessage);
|
|
@@ -29092,8 +29097,8 @@
|
|
|
29092
29097
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
29093
29098
|
}
|
|
29094
29099
|
const onMouseWheel = (ev) => {
|
|
29095
|
-
const deltaX = normalize(ev.shiftKey ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
29096
|
-
const deltaY = normalize(ev.shiftKey ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
29100
|
+
const deltaX = normalize(ev.shiftKey && !isMacOS() ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
29101
|
+
const deltaY = normalize(ev.shiftKey && !isMacOS() ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
29097
29102
|
handler(deltaX, deltaY);
|
|
29098
29103
|
};
|
|
29099
29104
|
return onMouseWheel;
|
|
@@ -33530,7 +33535,7 @@
|
|
|
33530
33535
|
SPACE: goTo(State.RightRef),
|
|
33531
33536
|
NUMBER: goTo(State.Found),
|
|
33532
33537
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
33533
|
-
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
|
|
33538
|
+
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
|
|
33534
33539
|
},
|
|
33535
33540
|
[State.RightColumnRef]: {
|
|
33536
33541
|
SPACE: goTo(State.RightColumnRef),
|
|
@@ -33541,6 +33546,7 @@
|
|
|
33541
33546
|
SPACE: goTo(State.RightRowRef),
|
|
33542
33547
|
NUMBER: goTo(State.Found),
|
|
33543
33548
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
33549
|
+
SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
|
|
33544
33550
|
},
|
|
33545
33551
|
[State.Found]: {},
|
|
33546
33552
|
};
|
|
@@ -37520,7 +37526,16 @@
|
|
|
37520
37526
|
return consecutiveIndexes;
|
|
37521
37527
|
}
|
|
37522
37528
|
getAllVisibleHeaders(sheetId, dimension) {
|
|
37523
|
-
|
|
37529
|
+
const headers = range(0, this.getters.getNumberHeaders(sheetId, dimension));
|
|
37530
|
+
const foldedHeaders = [];
|
|
37531
|
+
this.getters.getHeaderGroups(sheetId, dimension).forEach((group) => {
|
|
37532
|
+
if (group.isFolded) {
|
|
37533
|
+
foldedHeaders.push(...range(group.start, group.end + 1));
|
|
37534
|
+
}
|
|
37535
|
+
});
|
|
37536
|
+
return headers.filter((i) => {
|
|
37537
|
+
return !this.hiddenHeaders[sheetId][dimension][i] && !foldedHeaders.includes(i);
|
|
37538
|
+
});
|
|
37524
37539
|
}
|
|
37525
37540
|
import(data) {
|
|
37526
37541
|
for (let sheet of data.sheets) {
|
|
@@ -39981,10 +39996,13 @@
|
|
|
39981
39996
|
if (evaluatedCell === undefined) {
|
|
39982
39997
|
return { value: null, format: this.getters.getCell(position)?.format };
|
|
39983
39998
|
}
|
|
39999
|
+
if (evaluatedCell.type === CellValueType.error) {
|
|
40000
|
+
throw evaluatedCell.error;
|
|
40001
|
+
}
|
|
39984
40002
|
return evaluatedCell;
|
|
39985
40003
|
}
|
|
39986
40004
|
getEvaluatedCellIfNotEmpty(position) {
|
|
39987
|
-
const evaluatedCell = this.
|
|
40005
|
+
const evaluatedCell = this.computeCell(position);
|
|
39988
40006
|
if (evaluatedCell.type === CellValueType.empty) {
|
|
39989
40007
|
const cell = this.getters.getCell(position);
|
|
39990
40008
|
if (!cell || (!cell.isFormula && cell.content === "")) {
|
|
@@ -39993,13 +40011,6 @@
|
|
|
39993
40011
|
}
|
|
39994
40012
|
return evaluatedCell;
|
|
39995
40013
|
}
|
|
39996
|
-
getEvaluatedCell(position) {
|
|
39997
|
-
const evaluatedCell = this.computeCell(position);
|
|
39998
|
-
if (evaluatedCell.type === CellValueType.error) {
|
|
39999
|
-
throw evaluatedCell.error;
|
|
40000
|
-
}
|
|
40001
|
-
return evaluatedCell;
|
|
40002
|
-
}
|
|
40003
40014
|
/**
|
|
40004
40015
|
* Return the values of the cell(s) used in reference, but always in the format of a range even
|
|
40005
40016
|
* if a single cell is referenced. It is a list of col values. This is useful for the formulas that describe parameters as
|
|
@@ -40022,7 +40033,11 @@
|
|
|
40022
40033
|
const { top, left, bottom, right } = zone;
|
|
40023
40034
|
const cacheKey = `${sheetId}-${top}-${left}-${bottom}-${right}`;
|
|
40024
40035
|
if (cacheKey in this.rangeCache) {
|
|
40025
|
-
|
|
40036
|
+
const result = this.rangeCache[cacheKey];
|
|
40037
|
+
if (result instanceof EvaluationError) {
|
|
40038
|
+
throw result;
|
|
40039
|
+
}
|
|
40040
|
+
return result;
|
|
40026
40041
|
}
|
|
40027
40042
|
const height = _zone.bottom - _zone.top + 1;
|
|
40028
40043
|
const width = _zone.right - _zone.left + 1;
|
|
@@ -40032,6 +40047,11 @@
|
|
|
40032
40047
|
const colIndex = col - _zone.left;
|
|
40033
40048
|
matrix[colIndex] = new Array(height);
|
|
40034
40049
|
for (let row = _zone.top; row <= _zone.bottom; row++) {
|
|
40050
|
+
const evaluatedCell = this.getEvaluatedCellIfNotEmpty({ sheetId, col, row });
|
|
40051
|
+
if (evaluatedCell?.type === CellValueType.error) {
|
|
40052
|
+
this.rangeCache[cacheKey] = evaluatedCell.error;
|
|
40053
|
+
throw evaluatedCell.error;
|
|
40054
|
+
}
|
|
40035
40055
|
const rowIndex = row - _zone.top;
|
|
40036
40056
|
matrix[colIndex][rowIndex] = this.readCell({ sheetId, col, row });
|
|
40037
40057
|
}
|
|
@@ -41133,7 +41153,7 @@
|
|
|
41133
41153
|
// ---------------------------------------------------------------------------
|
|
41134
41154
|
handle(cmd) {
|
|
41135
41155
|
if (invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
41136
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd)) {
|
|
41156
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
|
|
41137
41157
|
this.isStale = true;
|
|
41138
41158
|
}
|
|
41139
41159
|
}
|
|
@@ -41459,7 +41479,7 @@
|
|
|
41459
41479
|
handle(cmd) {
|
|
41460
41480
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
41461
41481
|
cmd.type === "EVALUATE_CELLS" ||
|
|
41462
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd)) {
|
|
41482
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
|
|
41463
41483
|
this.validationResults = {};
|
|
41464
41484
|
return;
|
|
41465
41485
|
}
|
|
@@ -41997,19 +42017,21 @@
|
|
|
41997
42017
|
let col = zone.left;
|
|
41998
42018
|
let row = zone.bottom;
|
|
41999
42019
|
if (col > 0) {
|
|
42000
|
-
let
|
|
42001
|
-
while (
|
|
42020
|
+
let leftPosition = { sheetId, col: col - 1, row };
|
|
42021
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
|
|
42022
|
+
this.getters.getCell(leftPosition)?.content) {
|
|
42002
42023
|
row += 1;
|
|
42003
|
-
|
|
42024
|
+
leftPosition = { sheetId, col: col - 1, row };
|
|
42004
42025
|
}
|
|
42005
42026
|
}
|
|
42006
42027
|
if (row === zone.bottom) {
|
|
42007
42028
|
col = zone.right;
|
|
42008
42029
|
if (col <= this.getters.getNumberCols(sheetId)) {
|
|
42009
|
-
let
|
|
42010
|
-
while (
|
|
42030
|
+
let rightPosition = { sheetId, col: col + 1, row };
|
|
42031
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
|
|
42032
|
+
this.getters.getCell(rightPosition)?.content) {
|
|
42011
42033
|
row += 1;
|
|
42012
|
-
|
|
42034
|
+
rightPosition = { sheetId, col: col + 1, row };
|
|
42013
42035
|
}
|
|
42014
42036
|
}
|
|
42015
42037
|
}
|
|
@@ -43001,6 +43023,7 @@
|
|
|
43001
43023
|
isReplayingInitialRevisions = false;
|
|
43002
43024
|
processedRevisions = new Set();
|
|
43003
43025
|
uuidGenerator = new UuidGenerator();
|
|
43026
|
+
lastLocalOperation;
|
|
43004
43027
|
/**
|
|
43005
43028
|
* Manages the collaboration between multiple users on the same spreadsheet.
|
|
43006
43029
|
* It can forward local state changes to other users to ensure they all eventually
|
|
@@ -43033,6 +43056,11 @@
|
|
|
43033
43056
|
return;
|
|
43034
43057
|
const revision = new Revision(this.uuidGenerator.uuidv4(), this.clientId, commands, rootCommand, changes, Date.now());
|
|
43035
43058
|
this.revisions.append(revision.id, revision);
|
|
43059
|
+
// REQUEST_REDO just repeats the last operation, the
|
|
43060
|
+
// last operation is still the same and should not change.
|
|
43061
|
+
if (rootCommand.type !== "REQUEST_REDO") {
|
|
43062
|
+
this.lastLocalOperation = revision;
|
|
43063
|
+
}
|
|
43036
43064
|
this.trigger("new-local-state-update", { id: revision.id });
|
|
43037
43065
|
this.sendUpdateMessage({
|
|
43038
43066
|
type: "REMOTE_REVISION",
|
|
@@ -43129,19 +43157,10 @@
|
|
|
43129
43157
|
return this.pendingMessages.length === 0;
|
|
43130
43158
|
}
|
|
43131
43159
|
/**
|
|
43132
|
-
* Get the last local revision
|
|
43160
|
+
* Get the last local revision
|
|
43133
43161
|
* */
|
|
43134
|
-
getLastLocalNonEmptyRevision(
|
|
43135
|
-
|
|
43136
|
-
for (const rev of revisions) {
|
|
43137
|
-
if (rev.rootCommand === "SNAPSHOT")
|
|
43138
|
-
return undefined;
|
|
43139
|
-
if (!rev.rootCommand || rev.rootCommand === "REMOTE")
|
|
43140
|
-
continue;
|
|
43141
|
-
if (!ignoredRootCommands.includes(rev.rootCommand?.type) && rev.commands.length)
|
|
43142
|
-
return rev;
|
|
43143
|
-
}
|
|
43144
|
-
return undefined;
|
|
43162
|
+
getLastLocalNonEmptyRevision() {
|
|
43163
|
+
return this.lastLocalOperation;
|
|
43145
43164
|
}
|
|
43146
43165
|
_move(position) {
|
|
43147
43166
|
// this method is debounced and might be called after the client
|
|
@@ -43201,7 +43220,7 @@
|
|
|
43201
43220
|
break;
|
|
43202
43221
|
case "REMOTE_REVISION":
|
|
43203
43222
|
const { clientId, commands, timestamp } = message;
|
|
43204
|
-
const revision = new Revision(message.nextRevisionId, clientId, commands,
|
|
43223
|
+
const revision = new Revision(message.nextRevisionId, clientId, commands, undefined, undefined, timestamp);
|
|
43205
43224
|
if (revision.clientId !== this.clientId) {
|
|
43206
43225
|
this.revisions.insert(revision.id, revision, message.serverRevisionId);
|
|
43207
43226
|
const pendingCommands = this.pendingMessages
|
|
@@ -43214,10 +43233,11 @@
|
|
|
43214
43233
|
}
|
|
43215
43234
|
break;
|
|
43216
43235
|
case "SNAPSHOT_CREATED": {
|
|
43217
|
-
const revision = new Revision(message.nextRevisionId, "server", [],
|
|
43236
|
+
const revision = new Revision(message.nextRevisionId, "server", [], undefined, undefined, Date.now());
|
|
43218
43237
|
this.revisions.insert(revision.id, revision, message.serverRevisionId);
|
|
43219
43238
|
this.dropPendingHistoryMessages();
|
|
43220
43239
|
this.trigger("snapshot");
|
|
43240
|
+
this.lastLocalOperation = undefined;
|
|
43221
43241
|
break;
|
|
43222
43242
|
}
|
|
43223
43243
|
}
|
|
@@ -45862,6 +45882,9 @@
|
|
|
45862
45882
|
// Other
|
|
45863
45883
|
// ---------------------------------------------------------------------------
|
|
45864
45884
|
initInput(id, initialRanges, inputHasSingleRange = false) {
|
|
45885
|
+
if (this.inputs[id]) {
|
|
45886
|
+
this.unfocus();
|
|
45887
|
+
}
|
|
45865
45888
|
this.inputs[id] = new SelectionInputPlugin(this.config, initialRanges, inputHasSingleRange);
|
|
45866
45889
|
if (initialRanges.length === 0) {
|
|
45867
45890
|
const input = this.inputs[id];
|
|
@@ -46570,7 +46593,7 @@
|
|
|
46570
46593
|
* Ignore standard undo/redo revisions (that are empty)
|
|
46571
46594
|
*/
|
|
46572
46595
|
getPossibleRevisionToRepeat() {
|
|
46573
|
-
return this.session.getLastLocalNonEmptyRevision(
|
|
46596
|
+
return this.session.getLastLocalNonEmptyRevision();
|
|
46574
46597
|
}
|
|
46575
46598
|
}
|
|
46576
46599
|
|
|
@@ -48041,6 +48064,12 @@
|
|
|
48041
48064
|
break;
|
|
48042
48065
|
case "HIDE_COLUMNS_ROWS":
|
|
48043
48066
|
case "UNHIDE_COLUMNS_ROWS":
|
|
48067
|
+
case "GROUP_HEADERS":
|
|
48068
|
+
case "UNGROUP_HEADERS":
|
|
48069
|
+
case "FOLD_HEADER_GROUP":
|
|
48070
|
+
case "UNFOLD_HEADER_GROUP":
|
|
48071
|
+
case "FOLD_ALL_HEADER_GROUPS":
|
|
48072
|
+
case "UNFOLD_ALL_HEADER_GROUPS":
|
|
48044
48073
|
this.updateHiddenRows();
|
|
48045
48074
|
break;
|
|
48046
48075
|
case "UPDATE_FILTER":
|
|
@@ -48742,7 +48771,7 @@
|
|
|
48742
48771
|
sheetId: cmd.sheetId,
|
|
48743
48772
|
base: cmd.base,
|
|
48744
48773
|
quantity: thickness,
|
|
48745
|
-
position:
|
|
48774
|
+
position: cmd.position,
|
|
48746
48775
|
});
|
|
48747
48776
|
const isCol = cmd.dimension === "COL";
|
|
48748
48777
|
const start = cmd.elements[0];
|
|
@@ -48759,12 +48788,13 @@
|
|
|
48759
48788
|
},
|
|
48760
48789
|
];
|
|
48761
48790
|
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
48791
|
+
const base = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
48762
48792
|
const pasteTarget = [
|
|
48763
48793
|
{
|
|
48764
|
-
left: isCol ?
|
|
48765
|
-
right: isCol ?
|
|
48766
|
-
top: !isCol ?
|
|
48767
|
-
bottom: !isCol ?
|
|
48794
|
+
left: isCol ? base : 0,
|
|
48795
|
+
right: isCol ? base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
48796
|
+
top: !isCol ? base : 0,
|
|
48797
|
+
bottom: !isCol ? base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
48768
48798
|
},
|
|
48769
48799
|
];
|
|
48770
48800
|
state.paste(pasteTarget, { selectTarget: true });
|
|
@@ -48799,6 +48829,11 @@
|
|
|
48799
48829
|
doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) {
|
|
48800
48830
|
return "WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */;
|
|
48801
48831
|
}
|
|
48832
|
+
const headers = [cmd.base, ...cmd.elements];
|
|
48833
|
+
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
48834
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
48835
|
+
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
48836
|
+
}
|
|
48802
48837
|
return "Success" /* CommandResult.Success */;
|
|
48803
48838
|
}
|
|
48804
48839
|
//-------------------------------------------
|
|
@@ -48976,9 +49011,6 @@
|
|
|
48976
49011
|
*/
|
|
48977
49012
|
adjustPosition(position) {
|
|
48978
49013
|
const sheetId = this.sheetId;
|
|
48979
|
-
if (!position) {
|
|
48980
|
-
position = this.getters.getSheetPosition(sheetId);
|
|
48981
|
-
}
|
|
48982
49014
|
const mainCellPosition = this.getters.getMainCellPosition({ sheetId, ...position });
|
|
48983
49015
|
const { col, row } = this.getters.getNextVisibleCellPosition(mainCellPosition);
|
|
48984
49016
|
if (isInside(col, this.boundaries.top, this.boundaries)) {
|
|
@@ -48991,56 +49023,50 @@
|
|
|
48991
49023
|
adjustPositionX(targetCol) {
|
|
48992
49024
|
const sheetId = this.sheetId;
|
|
48993
49025
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
48994
|
-
const maxCol = this.getters.getNumberCols(sheetId);
|
|
48995
49026
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
49027
|
+
const maxCol = this.getters.getNumberCols(sheetId);
|
|
48996
49028
|
let finalTarget = targetCol;
|
|
48997
|
-
while (this.getters.isColHidden(sheetId, finalTarget) &&
|
|
49029
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && finalTarget < maxCol) {
|
|
48998
49030
|
finalTarget++;
|
|
48999
49031
|
}
|
|
49000
49032
|
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
49001
49033
|
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left);
|
|
49002
|
-
this.
|
|
49034
|
+
this.offsetScrollbarX =
|
|
49003
49035
|
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
49004
|
-
this.offsetScrollbarX = this.offsetX;
|
|
49005
|
-
this.adjustViewportZoneX();
|
|
49006
49036
|
}
|
|
49007
49037
|
else if (this.left > targetCol) {
|
|
49008
49038
|
let finalTarget = targetCol;
|
|
49009
|
-
while (this.getters.isColHidden(sheetId, finalTarget) &&
|
|
49039
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && finalTarget > 0) {
|
|
49010
49040
|
finalTarget--;
|
|
49011
49041
|
}
|
|
49012
|
-
this.
|
|
49042
|
+
this.offsetScrollbarX =
|
|
49013
49043
|
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
49014
|
-
this.offsetScrollbarX = this.offsetX;
|
|
49015
|
-
this.adjustViewportZoneX();
|
|
49016
49044
|
}
|
|
49045
|
+
this.adjustViewportZoneX();
|
|
49017
49046
|
}
|
|
49018
49047
|
adjustPositionY(targetRow) {
|
|
49019
49048
|
const sheetId = this.sheetId;
|
|
49020
49049
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
49021
|
-
const maxRow = this.getters.getNumberRows(sheetId);
|
|
49022
49050
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
49051
|
+
const maxRow = this.getters.getNumberRows(sheetId);
|
|
49023
49052
|
let finalTarget = targetRow;
|
|
49024
|
-
while (this.getters.isRowHidden(sheetId, finalTarget) &&
|
|
49053
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && finalTarget < maxRow) {
|
|
49025
49054
|
finalTarget++;
|
|
49026
49055
|
}
|
|
49027
49056
|
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
49028
49057
|
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top);
|
|
49029
|
-
this.
|
|
49058
|
+
this.offsetScrollbarY =
|
|
49030
49059
|
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
49031
|
-
this.offsetScrollbarY = this.offsetY;
|
|
49032
|
-
this.adjustViewportZoneY();
|
|
49033
49060
|
}
|
|
49034
49061
|
else if (this.top > targetRow) {
|
|
49035
49062
|
let finalTarget = targetRow;
|
|
49036
|
-
while (this.getters.isRowHidden(sheetId, finalTarget) &&
|
|
49063
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && finalTarget > 0) {
|
|
49037
49064
|
finalTarget--;
|
|
49038
49065
|
}
|
|
49039
|
-
this.
|
|
49066
|
+
this.offsetScrollbarY =
|
|
49040
49067
|
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
49041
|
-
this.offsetScrollbarY = this.offsetY;
|
|
49042
|
-
this.adjustViewportZoneY();
|
|
49043
49068
|
}
|
|
49069
|
+
this.adjustViewportZoneY();
|
|
49044
49070
|
}
|
|
49045
49071
|
setViewportOffset(offsetX, offsetY) {
|
|
49046
49072
|
this.setViewportOffsetX(offsetX);
|
|
@@ -49056,11 +49082,10 @@
|
|
|
49056
49082
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
49057
49083
|
*/
|
|
49058
49084
|
getRect(zone) {
|
|
49059
|
-
const targetZone = intersection(zone, this
|
|
49085
|
+
const targetZone = intersection(zone, this);
|
|
49060
49086
|
if (targetZone) {
|
|
49061
|
-
const x = this.getters.getColRowOffset("COL", this.
|
|
49062
|
-
|
|
49063
|
-
const y = this.getters.getColRowOffset("ROW", this.zone.top, targetZone.top) + this.offsetCorrectionY;
|
|
49087
|
+
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
49088
|
+
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
49064
49089
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
49065
49090
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
49066
49091
|
return {
|
|
@@ -49070,9 +49095,7 @@
|
|
|
49070
49095
|
height,
|
|
49071
49096
|
};
|
|
49072
49097
|
}
|
|
49073
|
-
|
|
49074
|
-
return undefined;
|
|
49075
|
-
}
|
|
49098
|
+
return undefined;
|
|
49076
49099
|
}
|
|
49077
49100
|
isVisible(col, row) {
|
|
49078
49101
|
const isInside = row <= this.bottom && row >= this.top && col >= this.left && col <= this.right;
|
|
@@ -49080,7 +49103,6 @@
|
|
|
49080
49103
|
!this.getters.isColHidden(this.sheetId, col) &&
|
|
49081
49104
|
!this.getters.isRowHidden(this.sheetId, row));
|
|
49082
49105
|
}
|
|
49083
|
-
// PRIVATE
|
|
49084
49106
|
searchHeaderIndex(dimension, position, startIndex = 0) {
|
|
49085
49107
|
const sheetId = this.sheetId;
|
|
49086
49108
|
const headers = this.getters.getNumberHeaders(sheetId, dimension);
|
|
@@ -49103,9 +49125,6 @@
|
|
|
49103
49125
|
}
|
|
49104
49126
|
return -1;
|
|
49105
49127
|
}
|
|
49106
|
-
get zone() {
|
|
49107
|
-
return { left: this.left, right: this.right, top: this.top, bottom: this.bottom };
|
|
49108
|
-
}
|
|
49109
49128
|
setViewportOffsetX(offsetX) {
|
|
49110
49129
|
if (!this.canScrollHorizontally) {
|
|
49111
49130
|
return;
|
|
@@ -49130,11 +49149,6 @@
|
|
|
49130
49149
|
this.offsetScrollbarX = Math.max(0, viewportWidth - this.viewportWidth);
|
|
49131
49150
|
}
|
|
49132
49151
|
}
|
|
49133
|
-
this.left = this.getColIndex(this.offsetScrollbarX);
|
|
49134
|
-
this.right = this.getColIndex(this.offsetScrollbarX + this.viewportWidth);
|
|
49135
|
-
if (this.right === -1) {
|
|
49136
|
-
this.right = this.boundaries.right;
|
|
49137
|
-
}
|
|
49138
49152
|
this.adjustViewportZoneX();
|
|
49139
49153
|
}
|
|
49140
49154
|
/** Corrects the viewport's vertical offset based on the current structure
|
|
@@ -49147,11 +49161,6 @@
|
|
|
49147
49161
|
this.offsetScrollbarY = Math.max(0, paneHeight - this.viewportHeight);
|
|
49148
49162
|
}
|
|
49149
49163
|
}
|
|
49150
|
-
this.top = this.getRowIndex(this.offsetScrollbarY);
|
|
49151
|
-
this.bottom = this.getRowIndex(this.offsetScrollbarY + this.viewportHeight);
|
|
49152
|
-
if (this.bottom === -1) {
|
|
49153
|
-
this.bottom = this.boundaries.bottom;
|
|
49154
|
-
}
|
|
49155
49164
|
this.adjustViewportZoneY();
|
|
49156
49165
|
}
|
|
49157
49166
|
/** Updates the pane zone and snapped offset based on its horizontal
|
|
@@ -49529,7 +49538,7 @@
|
|
|
49529
49538
|
isVisibleInViewport({ sheetId, col, row }) {
|
|
49530
49539
|
return this.getSubViewports(sheetId).some((pane) => pane.isVisible(col, row));
|
|
49531
49540
|
}
|
|
49532
|
-
// =>
|
|
49541
|
+
// => returns the new offset
|
|
49533
49542
|
getEdgeScrollCol(x, previousX, startingX) {
|
|
49534
49543
|
let canEdgeScroll = false;
|
|
49535
49544
|
let direction = 0;
|
|
@@ -49844,10 +49853,13 @@
|
|
|
49844
49853
|
}
|
|
49845
49854
|
break;
|
|
49846
49855
|
case "UPDATE_CELL":
|
|
49847
|
-
if ("content" in cmd || "format" in cmd
|
|
49856
|
+
if ("content" in cmd || "format" in cmd) {
|
|
49848
49857
|
this.headerPositions = {};
|
|
49849
49858
|
this.isDirty = true;
|
|
49850
49859
|
}
|
|
49860
|
+
else {
|
|
49861
|
+
this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
|
|
49862
|
+
}
|
|
49851
49863
|
break;
|
|
49852
49864
|
case "UPDATE_FILTER":
|
|
49853
49865
|
case "REMOVE_FILTER_TABLE":
|
|
@@ -52004,6 +52016,8 @@
|
|
|
52004
52016
|
*:before,
|
|
52005
52017
|
*:after {
|
|
52006
52018
|
box-sizing: content-box;
|
|
52019
|
+
/** rtl not supported ATM */
|
|
52020
|
+
direction: ltr;
|
|
52007
52021
|
}
|
|
52008
52022
|
.o-separator {
|
|
52009
52023
|
border-bottom: ${MENU_SEPARATOR_BORDER_WIDTH}px solid ${SEPARATOR_COLOR};
|
|
@@ -56044,9 +56058,9 @@
|
|
|
56044
56058
|
exports.tokenize = tokenize;
|
|
56045
56059
|
|
|
56046
56060
|
|
|
56047
|
-
__info__.version = "17.1.0-alpha.
|
|
56048
|
-
__info__.date = "2023-
|
|
56049
|
-
__info__.hash = "
|
|
56061
|
+
__info__.version = "17.1.0-alpha.5";
|
|
56062
|
+
__info__.date = "2023-12-05T09:51:40.034Z";
|
|
56063
|
+
__info__.hash = "c2823eb";
|
|
56050
56064
|
|
|
56051
56065
|
|
|
56052
56066
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|