@odoo/o-spreadsheet 16.2.3 → 16.2.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 +206 -63
- package/dist/o-spreadsheet.d.ts +15 -6
- package/dist/o-spreadsheet.esm.js +206 -63
- package/dist/o-spreadsheet.iife.js +206 -63
- package/dist/o-spreadsheet.iife.min.js +247 -247
- package/package.json +2 -2
|
@@ -1005,6 +1005,10 @@
|
|
|
1005
1005
|
}
|
|
1006
1006
|
return true;
|
|
1007
1007
|
}
|
|
1008
|
+
/** Check if the given array contains all the values of the other array. */
|
|
1009
|
+
function includesAll(arr, values) {
|
|
1010
|
+
return values.every((value) => arr.includes(value));
|
|
1011
|
+
}
|
|
1008
1012
|
/**
|
|
1009
1013
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
1010
1014
|
*/
|
|
@@ -1678,12 +1682,77 @@
|
|
|
1678
1682
|
* - all digit stored in the decimal part of the number
|
|
1679
1683
|
*
|
|
1680
1684
|
* The 'maxDecimal' parameter allows to indicate the number of digits to not
|
|
1681
|
-
* exceed in the decimal part, in which case digits are rounded
|
|
1685
|
+
* exceed in the decimal part, in which case digits are rounded.
|
|
1682
1686
|
*
|
|
1683
|
-
* Intl.Numberformat is used to properly handle all the roundings.
|
|
1684
|
-
* e.g. 1234.7 with format ### (<> maxDecimals=0) should become 1235, not 1234
|
|
1685
1687
|
**/
|
|
1686
1688
|
function splitNumber(value, maxDecimals = MAX_DECIMAL_PLACES) {
|
|
1689
|
+
const asString = value.toString();
|
|
1690
|
+
if (asString.includes("e"))
|
|
1691
|
+
return splitNumberIntl(value, maxDecimals);
|
|
1692
|
+
if (Number.isInteger(value)) {
|
|
1693
|
+
return { integerDigits: asString, decimalDigits: undefined };
|
|
1694
|
+
}
|
|
1695
|
+
const indexOfDot = asString.indexOf(".");
|
|
1696
|
+
let integerDigits = asString.substring(0, indexOfDot);
|
|
1697
|
+
let decimalDigits = asString.substring(indexOfDot + 1);
|
|
1698
|
+
if (maxDecimals === 0) {
|
|
1699
|
+
if (Number(decimalDigits[0]) >= 5) {
|
|
1700
|
+
integerDigits = (Number(integerDigits) + 1).toString();
|
|
1701
|
+
}
|
|
1702
|
+
return { integerDigits, decimalDigits: undefined };
|
|
1703
|
+
}
|
|
1704
|
+
if (decimalDigits.length > maxDecimals) {
|
|
1705
|
+
const { integerDigits: roundedIntegerDigits, decimalDigits: roundedDecimalDigits } = limitDecimalDigits(decimalDigits, maxDecimals);
|
|
1706
|
+
decimalDigits = roundedDecimalDigits;
|
|
1707
|
+
if (roundedIntegerDigits !== "0") {
|
|
1708
|
+
integerDigits = (Number(integerDigits) + Number(roundedIntegerDigits)).toString();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return { integerDigits, decimalDigits: removeTrailingZeroes(decimalDigits || "") };
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Return the given string minus the trailing "0" characters.
|
|
1715
|
+
*
|
|
1716
|
+
* @param numberString : a string of integers
|
|
1717
|
+
* @returns the numberString, minus the eventual zeroes at the end
|
|
1718
|
+
*/
|
|
1719
|
+
function removeTrailingZeroes(numberString) {
|
|
1720
|
+
let i = numberString.length - 1;
|
|
1721
|
+
while (i >= 0 && numberString[i] === "0") {
|
|
1722
|
+
i--;
|
|
1723
|
+
}
|
|
1724
|
+
return numberString.slice(0, i + 1) || undefined;
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Limit the size of the decimal part of a number to the given number of digits.
|
|
1728
|
+
*/
|
|
1729
|
+
function limitDecimalDigits(decimalDigits, maxDecimals) {
|
|
1730
|
+
let integerDigits = "0";
|
|
1731
|
+
let resultDecimalDigits = decimalDigits;
|
|
1732
|
+
// Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
|
|
1733
|
+
// but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
|
|
1734
|
+
let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
|
|
1735
|
+
const i = maxDecimals;
|
|
1736
|
+
if (Number(Number(decimalDigits[i]) < 5)) {
|
|
1737
|
+
return { integerDigits, decimalDigits: slicedDecimalDigits };
|
|
1738
|
+
}
|
|
1739
|
+
// round up
|
|
1740
|
+
const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
|
|
1741
|
+
if (slicedRoundedUp.length > slicedDecimalDigits.length) {
|
|
1742
|
+
integerDigits = (Number(integerDigits) + 1).toString();
|
|
1743
|
+
resultDecimalDigits = undefined;
|
|
1744
|
+
}
|
|
1745
|
+
else {
|
|
1746
|
+
resultDecimalDigits = slicedRoundedUp;
|
|
1747
|
+
}
|
|
1748
|
+
return { integerDigits, decimalDigits: resultDecimalDigits };
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* Split numbers into decimal/integer digits using Intl.NumberFormat.
|
|
1752
|
+
* Supports numbers with a lot of digits that are transformed to scientific notation by
|
|
1753
|
+
* number.toString(), but is slow.
|
|
1754
|
+
*/
|
|
1755
|
+
function splitNumberIntl(value, maxDecimals = MAX_DECIMAL_PLACES) {
|
|
1687
1756
|
let formatter = numberRepresentation[maxDecimals];
|
|
1688
1757
|
if (!formatter) {
|
|
1689
1758
|
formatter = new Intl.NumberFormat("en-US", {
|
|
@@ -4201,6 +4270,8 @@
|
|
|
4201
4270
|
CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
|
|
4202
4271
|
CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
|
|
4203
4272
|
CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
|
|
4273
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
|
|
4274
|
+
CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
|
|
4204
4275
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
4205
4276
|
|
|
4206
4277
|
var DIRECTION;
|
|
@@ -9132,6 +9203,11 @@
|
|
|
9132
9203
|
name: REMOVE_COLUMNS_NAME,
|
|
9133
9204
|
sequence: 90,
|
|
9134
9205
|
action: REMOVE_COLUMNS_ACTION,
|
|
9206
|
+
isVisible: (env) => {
|
|
9207
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
9208
|
+
const selectedCols = env.model.getters.getElementsFromSelection("COL");
|
|
9209
|
+
return env.model.getters.canRemoveHeaders(sheetId, "COL", selectedCols);
|
|
9210
|
+
},
|
|
9135
9211
|
})
|
|
9136
9212
|
.add("clear_column", {
|
|
9137
9213
|
name: DELETE_CONTENT_COLUMNS_NAME,
|
|
@@ -9144,9 +9220,8 @@
|
|
|
9144
9220
|
action: HIDE_COLUMNS_ACTION,
|
|
9145
9221
|
isVisible: (env) => {
|
|
9146
9222
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
9147
|
-
const
|
|
9148
|
-
return
|
|
9149
|
-
hiddenCols.length + env.model.getters.getElementsFromSelection("COL").length);
|
|
9223
|
+
const selectedCols = env.model.getters.getElementsFromSelection("COL");
|
|
9224
|
+
return env.model.getters.canRemoveHeaders(sheetId, "COL", selectedCols);
|
|
9150
9225
|
},
|
|
9151
9226
|
separator: true,
|
|
9152
9227
|
})
|
|
@@ -9220,6 +9295,11 @@
|
|
|
9220
9295
|
name: REMOVE_ROWS_NAME,
|
|
9221
9296
|
sequence: 70,
|
|
9222
9297
|
action: REMOVE_ROWS_ACTION,
|
|
9298
|
+
isVisible: (env) => {
|
|
9299
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
9300
|
+
const selectedRows = env.model.getters.getElementsFromSelection("ROW");
|
|
9301
|
+
return env.model.getters.canRemoveHeaders(sheetId, "ROW", selectedRows);
|
|
9302
|
+
},
|
|
9223
9303
|
})
|
|
9224
9304
|
.add("clear_row", {
|
|
9225
9305
|
name: DELETE_CONTENT_ROWS_NAME,
|
|
@@ -9232,9 +9312,8 @@
|
|
|
9232
9312
|
action: HIDE_ROWS_ACTION,
|
|
9233
9313
|
isVisible: (env) => {
|
|
9234
9314
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
9235
|
-
const
|
|
9236
|
-
return
|
|
9237
|
-
hiddenRows.length + env.model.getters.getElementsFromSelection("ROW").length);
|
|
9315
|
+
const selectedRows = env.model.getters.getElementsFromSelection("ROW");
|
|
9316
|
+
return env.model.getters.canRemoveHeaders(sheetId, "ROW", selectedRows);
|
|
9238
9317
|
},
|
|
9239
9318
|
separator: true,
|
|
9240
9319
|
})
|
|
@@ -21970,8 +22049,8 @@
|
|
|
21970
22049
|
},
|
|
21971
22050
|
"CTRL+END": () => {
|
|
21972
22051
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
21973
|
-
const col = this.env.model.getters.findVisibleHeader(sheetId, "COL",
|
|
21974
|
-
const row = this.env.model.getters.findVisibleHeader(sheetId, "ROW",
|
|
22052
|
+
const col = this.env.model.getters.findVisibleHeader(sheetId, "COL", this.env.model.getters.getNumberCols(sheetId) - 1, 0);
|
|
22053
|
+
const row = this.env.model.getters.findVisibleHeader(sheetId, "ROW", this.env.model.getters.getNumberRows(sheetId) - 1, 0);
|
|
21975
22054
|
this.env.model.selection.selectCell(col, row);
|
|
21976
22055
|
},
|
|
21977
22056
|
"SHIFT+ ": () => {
|
|
@@ -22051,9 +22130,10 @@
|
|
|
22051
22130
|
this.focus();
|
|
22052
22131
|
}
|
|
22053
22132
|
focus() {
|
|
22133
|
+
var _a;
|
|
22054
22134
|
if (!this.env.model.getters.getSelectedFigureId() &&
|
|
22055
22135
|
this.env.model.getters.getEditionMode() === "inactive") {
|
|
22056
|
-
this.hiddenInput.el.focus();
|
|
22136
|
+
(_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
|
|
22057
22137
|
}
|
|
22058
22138
|
}
|
|
22059
22139
|
get gridEl() {
|
|
@@ -25948,7 +26028,7 @@
|
|
|
25948
26028
|
}
|
|
25949
26029
|
}
|
|
25950
26030
|
}
|
|
25951
|
-
data =
|
|
26031
|
+
data = deepCopy(data);
|
|
25952
26032
|
// apply migrations, if needed
|
|
25953
26033
|
if ("version" in data) {
|
|
25954
26034
|
if (data.version < CURRENT_VERSION) {
|
|
@@ -29391,7 +29471,7 @@
|
|
|
29391
29471
|
allowDispatch(cmd) {
|
|
29392
29472
|
switch (cmd.type) {
|
|
29393
29473
|
case "HIDE_COLUMNS_ROWS": {
|
|
29394
|
-
if (!this.
|
|
29474
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
29395
29475
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
29396
29476
|
}
|
|
29397
29477
|
const hiddenGroup = cmd.dimension === "COL"
|
|
@@ -29400,10 +29480,25 @@
|
|
|
29400
29480
|
const elements = cmd.dimension === "COL"
|
|
29401
29481
|
? this.getters.getNumberCols(cmd.sheetId)
|
|
29402
29482
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29483
|
+
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
29484
|
+
if (hiddenElements.size >= elements) {
|
|
29485
|
+
return 66 /* CommandResult.TooManyHiddenElements */;
|
|
29486
|
+
}
|
|
29487
|
+
else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
29488
|
+
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
29489
|
+
}
|
|
29490
|
+
else {
|
|
29491
|
+
return 0 /* CommandResult.Success */;
|
|
29492
|
+
}
|
|
29406
29493
|
}
|
|
29494
|
+
case "REMOVE_COLUMNS_ROWS":
|
|
29495
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
29496
|
+
return 27 /* CommandResult.InvalidSheetId */;
|
|
29497
|
+
}
|
|
29498
|
+
if (!this.canRemoveHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
29499
|
+
return 8 /* CommandResult.NotEnoughElements */;
|
|
29500
|
+
}
|
|
29501
|
+
return 0 /* CommandResult.Success */;
|
|
29407
29502
|
}
|
|
29408
29503
|
return 0 /* CommandResult.Success */;
|
|
29409
29504
|
}
|
|
@@ -29450,6 +29545,10 @@
|
|
|
29450
29545
|
}
|
|
29451
29546
|
return;
|
|
29452
29547
|
}
|
|
29548
|
+
canRemoveHeaders(sheetId, dimension, elements) {
|
|
29549
|
+
const visibleHeaders = this.getAllVisibleHeaders(sheetId, dimension);
|
|
29550
|
+
return !includesAll(elements, visibleHeaders);
|
|
29551
|
+
}
|
|
29453
29552
|
isRowHiddenByUser(sheetId, index) {
|
|
29454
29553
|
return this.hiddenHeaders[sheetId].ROW[index];
|
|
29455
29554
|
}
|
|
@@ -29494,6 +29593,9 @@
|
|
|
29494
29593
|
}
|
|
29495
29594
|
return consecutiveIndexes;
|
|
29496
29595
|
}
|
|
29596
|
+
getAllVisibleHeaders(sheetId, dimension) {
|
|
29597
|
+
return range(0, this.hiddenHeaders[sheetId][dimension].length).filter((i) => !this.hiddenHeaders[sheetId][dimension][i]);
|
|
29598
|
+
}
|
|
29497
29599
|
import(data) {
|
|
29498
29600
|
var _a, _b;
|
|
29499
29601
|
for (let sheet of data.sheets) {
|
|
@@ -29541,6 +29643,7 @@
|
|
|
29541
29643
|
}
|
|
29542
29644
|
}
|
|
29543
29645
|
HeaderVisibilityPlugin.getters = [
|
|
29646
|
+
"canRemoveHeaders",
|
|
29544
29647
|
"getHiddenColsGroups",
|
|
29545
29648
|
"getHiddenRowsGroups",
|
|
29546
29649
|
"isRowHiddenByUser",
|
|
@@ -30559,13 +30662,27 @@
|
|
|
30559
30662
|
return this.orderedSheetIds.length > 1
|
|
30560
30663
|
? 0 /* CommandResult.Success */
|
|
30561
30664
|
: 9 /* CommandResult.NotEnoughSheets */;
|
|
30665
|
+
case "ADD_COLUMNS_ROWS":
|
|
30666
|
+
const elements = cmd.dimension === "COL"
|
|
30667
|
+
? this.getNumberCols(cmd.sheetId)
|
|
30668
|
+
: this.getNumberRows(cmd.sheetId);
|
|
30669
|
+
if (cmd.base < 0 || cmd.base > elements) {
|
|
30670
|
+
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
30671
|
+
}
|
|
30672
|
+
else if (cmd.quantity <= 0) {
|
|
30673
|
+
return 87 /* CommandResult.InvalidQuantity */;
|
|
30674
|
+
}
|
|
30675
|
+
return 0 /* CommandResult.Success */;
|
|
30562
30676
|
case "REMOVE_COLUMNS_ROWS": {
|
|
30563
|
-
const
|
|
30677
|
+
const elements = cmd.dimension === "COL"
|
|
30564
30678
|
? this.getNumberCols(cmd.sheetId)
|
|
30565
30679
|
: this.getNumberRows(cmd.sheetId);
|
|
30566
|
-
|
|
30567
|
-
|
|
30568
|
-
|
|
30680
|
+
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
30681
|
+
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
30682
|
+
}
|
|
30683
|
+
else {
|
|
30684
|
+
return 0 /* CommandResult.Success */;
|
|
30685
|
+
}
|
|
30569
30686
|
}
|
|
30570
30687
|
case "FREEZE_ROWS": {
|
|
30571
30688
|
return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
@@ -31033,7 +31150,7 @@
|
|
|
31033
31150
|
duplicateSheet(fromId, toId) {
|
|
31034
31151
|
const sheet = this.getSheet(fromId);
|
|
31035
31152
|
const toName = this.getDuplicateSheetName(sheet.name);
|
|
31036
|
-
const newSheet =
|
|
31153
|
+
const newSheet = deepCopy(sheet);
|
|
31037
31154
|
newSheet.id = toId;
|
|
31038
31155
|
newSheet.name = toName;
|
|
31039
31156
|
for (let col = 0; col <= newSheet.numberOfCols; col++) {
|
|
@@ -31160,10 +31277,10 @@
|
|
|
31160
31277
|
}
|
|
31161
31278
|
}
|
|
31162
31279
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
31163
|
-
for (let
|
|
31164
|
-
const
|
|
31280
|
+
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
31281
|
+
const row = sheet.rows[rowIndex];
|
|
31165
31282
|
for (let i in row.cells) {
|
|
31166
|
-
const colIndex =
|
|
31283
|
+
const colIndex = Number(i);
|
|
31167
31284
|
const cellId = row.cells[i];
|
|
31168
31285
|
if (cellId) {
|
|
31169
31286
|
if (colIndex === deletedColumn) {
|
|
@@ -31190,11 +31307,11 @@
|
|
|
31190
31307
|
*/
|
|
31191
31308
|
moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
|
|
31192
31309
|
const commands = [];
|
|
31193
|
-
for (
|
|
31194
|
-
const
|
|
31310
|
+
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
31311
|
+
const row = sheet.rows[rowIndex];
|
|
31195
31312
|
if (dimension !== "rows" || rowIndex >= addedElement) {
|
|
31196
31313
|
for (let i in row.cells) {
|
|
31197
|
-
const colIndex =
|
|
31314
|
+
const colIndex = Number(i);
|
|
31198
31315
|
const cellId = row.cells[i];
|
|
31199
31316
|
if (cellId) {
|
|
31200
31317
|
if (dimension === "rows" || colIndex >= addedElement) {
|
|
@@ -31224,11 +31341,11 @@
|
|
|
31224
31341
|
*/
|
|
31225
31342
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
31226
31343
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
31227
|
-
for (let
|
|
31228
|
-
const
|
|
31344
|
+
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
31345
|
+
const row = sheet.rows[rowIndex];
|
|
31229
31346
|
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
31230
31347
|
for (let i in row.cells) {
|
|
31231
|
-
const colIndex =
|
|
31348
|
+
const colIndex = Number(i);
|
|
31232
31349
|
const cellId = row.cells[i];
|
|
31233
31350
|
if (cellId) {
|
|
31234
31351
|
this.dispatch("CLEAR_CELL", {
|
|
@@ -31241,7 +31358,7 @@
|
|
|
31241
31358
|
}
|
|
31242
31359
|
if (rowIndex > deleteToRow) {
|
|
31243
31360
|
for (let i in row.cells) {
|
|
31244
|
-
const colIndex =
|
|
31361
|
+
const colIndex = Number(i);
|
|
31245
31362
|
const cellId = row.cells[i];
|
|
31246
31363
|
if (cellId) {
|
|
31247
31364
|
this.dispatch("UPDATE_CELL_POSITION", {
|
|
@@ -31259,7 +31376,7 @@
|
|
|
31259
31376
|
const rows = [];
|
|
31260
31377
|
const cellsQueue = sheet.rows.map((row) => row.cells);
|
|
31261
31378
|
for (let i in sheet.rows) {
|
|
31262
|
-
if (
|
|
31379
|
+
if (Number(i) === index) {
|
|
31263
31380
|
continue;
|
|
31264
31381
|
}
|
|
31265
31382
|
rows.push({
|
|
@@ -32430,13 +32547,11 @@
|
|
|
32430
32547
|
return Boolean(id && ((_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.length));
|
|
32431
32548
|
}
|
|
32432
32549
|
intersectZoneWithViewport(sheetId, zone) {
|
|
32433
|
-
const colsRange = range(zone.left, zone.right + 1);
|
|
32434
|
-
const rowsRange = range(zone.top, zone.bottom + 1);
|
|
32435
32550
|
return {
|
|
32436
|
-
left: this.getters.findVisibleHeader(sheetId, "COL",
|
|
32437
|
-
right: this.getters.findVisibleHeader(sheetId, "COL",
|
|
32438
|
-
top: this.getters.findVisibleHeader(sheetId, "ROW",
|
|
32439
|
-
bottom: this.getters.findVisibleHeader(sheetId, "ROW",
|
|
32551
|
+
left: this.getters.findVisibleHeader(sheetId, "COL", zone.left, zone.right),
|
|
32552
|
+
right: this.getters.findVisibleHeader(sheetId, "COL", zone.right, zone.left),
|
|
32553
|
+
top: this.getters.findVisibleHeader(sheetId, "ROW", zone.top, zone.bottom),
|
|
32554
|
+
bottom: this.getters.findVisibleHeader(sheetId, "ROW", zone.bottom, zone.top),
|
|
32440
32555
|
};
|
|
32441
32556
|
}
|
|
32442
32557
|
updateFilter({ col, row, values, sheetId }) {
|
|
@@ -34543,13 +34658,33 @@
|
|
|
34543
34658
|
getNextVisibleCellPosition({ sheetId, col, row }) {
|
|
34544
34659
|
return {
|
|
34545
34660
|
sheetId,
|
|
34546
|
-
col: this.findVisibleHeader(sheetId, "COL",
|
|
34547
|
-
row: this.findVisibleHeader(sheetId, "ROW",
|
|
34661
|
+
col: this.findVisibleHeader(sheetId, "COL", col, this.getters.getNumberCols(sheetId) - 1),
|
|
34662
|
+
row: this.findVisibleHeader(sheetId, "ROW", row, this.getters.getNumberRows(sheetId) - 1),
|
|
34548
34663
|
};
|
|
34549
34664
|
}
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
34665
|
+
/**
|
|
34666
|
+
* Find the first visible header in the range [`from` => `to`].
|
|
34667
|
+
*
|
|
34668
|
+
* Both `from` and `to` are inclusive.
|
|
34669
|
+
*/
|
|
34670
|
+
findVisibleHeader(sheetId, dimension, from, to) {
|
|
34671
|
+
if (from <= to) {
|
|
34672
|
+
for (let i = from; i <= to; i++) {
|
|
34673
|
+
if (this.getters.doesHeaderExist(sheetId, dimension, i) &&
|
|
34674
|
+
!this.isHeaderHidden(sheetId, dimension, i)) {
|
|
34675
|
+
return i;
|
|
34676
|
+
}
|
|
34677
|
+
}
|
|
34678
|
+
}
|
|
34679
|
+
if (from > to) {
|
|
34680
|
+
for (let i = from; i >= to; i--) {
|
|
34681
|
+
if (this.getters.doesHeaderExist(sheetId, dimension, i) &&
|
|
34682
|
+
!this.isHeaderHidden(sheetId, dimension, i)) {
|
|
34683
|
+
return i;
|
|
34684
|
+
}
|
|
34685
|
+
}
|
|
34686
|
+
}
|
|
34687
|
+
return undefined;
|
|
34553
34688
|
}
|
|
34554
34689
|
findLastVisibleColRowIndex(sheetId, dimension, { last, first }) {
|
|
34555
34690
|
const lastVisibleIndex = range(last, first, -1).find((index) => !this.isHeaderHidden(sheetId, dimension, index));
|
|
@@ -34557,7 +34692,7 @@
|
|
|
34557
34692
|
}
|
|
34558
34693
|
findFirstVisibleColRowIndex(sheetId, dimension) {
|
|
34559
34694
|
const numberOfHeaders = this.getters.getNumberHeaders(sheetId, dimension);
|
|
34560
|
-
for (let i = 0; i < numberOfHeaders
|
|
34695
|
+
for (let i = 0; i < numberOfHeaders; i++) {
|
|
34561
34696
|
if (dimension === "COL" && !this.isColHidden(sheetId, i)) {
|
|
34562
34697
|
return i;
|
|
34563
34698
|
}
|
|
@@ -42761,8 +42896,8 @@
|
|
|
42761
42896
|
}
|
|
42762
42897
|
const { left, right, top, bottom } = zone;
|
|
42763
42898
|
const sheetId = this.getters.getActiveSheetId();
|
|
42764
|
-
const refCol = this.getters.findVisibleHeader(sheetId, "COL",
|
|
42765
|
-
const refRow = this.getters.findVisibleHeader(sheetId, "ROW",
|
|
42899
|
+
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
42900
|
+
const refRow = this.getters.findVisibleHeader(sheetId, "ROW", top, bottom);
|
|
42766
42901
|
if (refRow === undefined || refCol === undefined) {
|
|
42767
42902
|
return 17 /* CommandResult.SelectionOutOfBound */;
|
|
42768
42903
|
}
|
|
@@ -42837,10 +42972,10 @@
|
|
|
42837
42972
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
42838
42973
|
return {
|
|
42839
42974
|
col: this.getters.isColHidden(sheetId, anchorCol)
|
|
42840
|
-
? this.getters.findVisibleHeader(sheetId, "COL",
|
|
42975
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
42841
42976
|
: anchorCol,
|
|
42842
42977
|
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
42843
|
-
? this.getters.findVisibleHeader(sheetId, "ROW",
|
|
42978
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
42844
42979
|
: anchorRow,
|
|
42845
42980
|
};
|
|
42846
42981
|
}
|
|
@@ -44590,6 +44725,8 @@
|
|
|
44590
44725
|
* Internal status of the model. Important for command handling coordination
|
|
44591
44726
|
*/
|
|
44592
44727
|
this.status = 0 /* Status.Ready */;
|
|
44728
|
+
this.handlers = [];
|
|
44729
|
+
this.coreHandlers = [];
|
|
44593
44730
|
/**
|
|
44594
44731
|
* The dispatch method is the only entry point to manipulate data in the model.
|
|
44595
44732
|
* This is through this method that commands are dispatched most of the time
|
|
@@ -44694,6 +44831,8 @@
|
|
|
44694
44831
|
this.uuidGenerator.setIsFastStrategy(true);
|
|
44695
44832
|
// Initiate stream processor
|
|
44696
44833
|
this.selection = new SelectionStreamProcessorImpl(this.getters);
|
|
44834
|
+
this.coreHandlers.push(this.range);
|
|
44835
|
+
this.handlers.push(this.range);
|
|
44697
44836
|
this.corePluginConfig = this.setupCorePluginConfig();
|
|
44698
44837
|
this.uiPluginConfig = this.setupUiPluginConfig();
|
|
44699
44838
|
// registering plugins
|
|
@@ -44702,15 +44841,23 @@
|
|
|
44702
44841
|
}
|
|
44703
44842
|
Object.assign(this.getters, this.coreGetters);
|
|
44704
44843
|
for (let Plugin of statefulUIPluginRegistry.getAll()) {
|
|
44705
|
-
this.
|
|
44844
|
+
const plugin = this.setupUiPlugin(Plugin);
|
|
44845
|
+
this.statefulUIPlugins.push(plugin);
|
|
44846
|
+
this.handlers.push(plugin);
|
|
44706
44847
|
}
|
|
44707
44848
|
for (let Plugin of coreViewsPluginRegistry.getAll()) {
|
|
44708
|
-
this.
|
|
44849
|
+
const plugin = this.setupUiPlugin(Plugin);
|
|
44850
|
+
this.coreViewsPlugins.push(plugin);
|
|
44851
|
+
this.handlers.push(plugin);
|
|
44852
|
+
this.coreHandlers.push(plugin);
|
|
44709
44853
|
}
|
|
44710
44854
|
for (let Plugin of featurePluginRegistry.getAll()) {
|
|
44711
|
-
this.
|
|
44855
|
+
const plugin = this.setupUiPlugin(Plugin);
|
|
44856
|
+
this.featurePlugins.push(plugin);
|
|
44857
|
+
this.handlers.push(plugin);
|
|
44712
44858
|
}
|
|
44713
44859
|
this.uuidGenerator.setIsFastStrategy(false);
|
|
44860
|
+
this.handlers.push(this.history);
|
|
44714
44861
|
// starting plugins
|
|
44715
44862
|
this.dispatch("START");
|
|
44716
44863
|
// Model should be the last permanent subscriber in the list since he should render
|
|
@@ -44732,12 +44879,6 @@
|
|
|
44732
44879
|
// by owl, since we do not rely on reactivity
|
|
44733
44880
|
owl.markRaw(this);
|
|
44734
44881
|
}
|
|
44735
|
-
get handlers() {
|
|
44736
|
-
return [this.range, ...this.corePlugins, ...this.allUIPlugins, this.history];
|
|
44737
|
-
}
|
|
44738
|
-
get allUIPlugins() {
|
|
44739
|
-
return [...this.statefulUIPlugins, ...this.coreViewsPlugins, ...this.featurePlugins];
|
|
44740
|
-
}
|
|
44741
44882
|
joinSession() {
|
|
44742
44883
|
this.session.join(this.config.client);
|
|
44743
44884
|
}
|
|
@@ -44779,6 +44920,8 @@
|
|
|
44779
44920
|
}
|
|
44780
44921
|
plugin.import(data);
|
|
44781
44922
|
this.corePlugins.push(plugin);
|
|
44923
|
+
this.coreHandlers.push(plugin);
|
|
44924
|
+
this.handlers.push(plugin);
|
|
44782
44925
|
}
|
|
44783
44926
|
onRemoteRevisionReceived({ commands }) {
|
|
44784
44927
|
for (let command of commands) {
|
|
@@ -44921,7 +45064,7 @@
|
|
|
44921
45064
|
}
|
|
44922
45065
|
}
|
|
44923
45066
|
data.revisionId = this.session.getRevisionId() || DEFAULT_REVISION_ID;
|
|
44924
|
-
data =
|
|
45067
|
+
data = deepCopy(data);
|
|
44925
45068
|
return data;
|
|
44926
45069
|
}
|
|
44927
45070
|
updateMode(mode) {
|
|
@@ -44949,7 +45092,7 @@
|
|
|
44949
45092
|
handler.exportForExcel(data);
|
|
44950
45093
|
}
|
|
44951
45094
|
}
|
|
44952
|
-
data =
|
|
45095
|
+
data = deepCopy(data);
|
|
44953
45096
|
return getXLSX(data);
|
|
44954
45097
|
}
|
|
44955
45098
|
garbageCollectExternalResources() {
|
|
@@ -45091,9 +45234,9 @@
|
|
|
45091
45234
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45092
45235
|
|
|
45093
45236
|
|
|
45094
|
-
__info__.version = '16.2.
|
|
45095
|
-
__info__.date = '2023-04-
|
|
45096
|
-
__info__.hash = '
|
|
45237
|
+
__info__.version = '16.2.5';
|
|
45238
|
+
__info__.date = '2023-04-28T12:25:41.422Z';
|
|
45239
|
+
__info__.hash = 'cc60a52';
|
|
45097
45240
|
|
|
45098
45241
|
|
|
45099
45242
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|