@odoo/o-spreadsheet 17.0.12 → 17.0.14
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 +147 -107
- package/dist/o-spreadsheet.d.ts +16 -10
- package/dist/o-spreadsheet.esm.js +147 -107
- package/dist/o-spreadsheet.iife.js +147 -107
- package/dist/o-spreadsheet.iife.min.js +252 -250
- package/dist/o_spreadsheet.xml +3 -3
- 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.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.14
|
|
6
|
+
* @date 2024-03-12T07:56:15.364Z
|
|
7
|
+
* @hash 6f6e1b9
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -6059,8 +6059,10 @@ function getGroup(cell, cells, filter) {
|
|
|
6059
6059
|
if (x === cell) {
|
|
6060
6060
|
found = true;
|
|
6061
6061
|
}
|
|
6062
|
-
const cellValue =
|
|
6063
|
-
|
|
6062
|
+
const cellValue = x?.isFormula
|
|
6063
|
+
? undefined
|
|
6064
|
+
: evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
|
|
6065
|
+
if (cellValue && filter(cellValue)) {
|
|
6064
6066
|
group.push(cellValue);
|
|
6065
6067
|
}
|
|
6066
6068
|
else {
|
|
@@ -6284,11 +6286,14 @@ function cellTextStyleToCss(style) {
|
|
|
6284
6286
|
* Transform CSS properties into a CSS string.
|
|
6285
6287
|
*/
|
|
6286
6288
|
function cssPropertiesToCss(attributes) {
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6289
|
+
let styleStr = "";
|
|
6290
|
+
for (const attName in attributes) {
|
|
6291
|
+
if (!attributes[attName]) {
|
|
6292
|
+
continue;
|
|
6293
|
+
}
|
|
6294
|
+
styleStr += `${attName}:${attributes[attName]}; `;
|
|
6295
|
+
}
|
|
6296
|
+
return styleStr;
|
|
6292
6297
|
}
|
|
6293
6298
|
function getElementMargins(el) {
|
|
6294
6299
|
const style = window.getComputedStyle(el);
|
|
@@ -12925,6 +12930,18 @@ const TRUNC = {
|
|
|
12925
12930
|
},
|
|
12926
12931
|
isExported: true,
|
|
12927
12932
|
};
|
|
12933
|
+
// -----------------------------------------------------------------------------
|
|
12934
|
+
// INT
|
|
12935
|
+
// -----------------------------------------------------------------------------
|
|
12936
|
+
const INT = {
|
|
12937
|
+
description: _t("Rounds a number down to the nearest integer that is less than or equal to it."),
|
|
12938
|
+
args: [arg("value (number)", _t("The number to round down to the nearest integer."))],
|
|
12939
|
+
returns: ["NUMBER"],
|
|
12940
|
+
compute: function (value) {
|
|
12941
|
+
return Math.floor(toNumber(value, this.locale));
|
|
12942
|
+
},
|
|
12943
|
+
isExported: true,
|
|
12944
|
+
};
|
|
12928
12945
|
|
|
12929
12946
|
var math = /*#__PURE__*/Object.freeze({
|
|
12930
12947
|
__proto__: null,
|
|
@@ -12958,6 +12975,7 @@ var math = /*#__PURE__*/Object.freeze({
|
|
|
12958
12975
|
FLOOR: FLOOR,
|
|
12959
12976
|
FLOOR_MATH: FLOOR_MATH,
|
|
12960
12977
|
FLOOR_PRECISE: FLOOR_PRECISE,
|
|
12978
|
+
INT: INT,
|
|
12961
12979
|
ISEVEN: ISEVEN,
|
|
12962
12980
|
ISODD: ISODD,
|
|
12963
12981
|
ISO_CEILING: ISO_CEILING,
|
|
@@ -19427,10 +19445,8 @@ function createComputeFunctionFromDescription(descr) {
|
|
|
19427
19445
|
}
|
|
19428
19446
|
function buildComputeFunctionFromDescription(descr) {
|
|
19429
19447
|
return function (...args) {
|
|
19430
|
-
const
|
|
19431
|
-
const
|
|
19432
|
-
const value = computeValue(...extractArgValuesFromArgs(args));
|
|
19433
|
-
const format = computeFormat(...args);
|
|
19448
|
+
const value = descr.compute.apply(this, extractArgValuesFromArgs(args));
|
|
19449
|
+
const format = descr.computeFormat?.apply(this, args);
|
|
19434
19450
|
if (isMatrix(value)) {
|
|
19435
19451
|
if (format === undefined || isMatrix(format)) {
|
|
19436
19452
|
return value.map((col, i) => col.map((row, j) => ({ value: row, format: format?.[i]?.[j] })));
|
|
@@ -21396,7 +21412,7 @@ class SelectionInput extends owl.Component {
|
|
|
21396
21412
|
? existingSelectionRanges
|
|
21397
21413
|
: this.props.ranges().map((xc, id) => ({
|
|
21398
21414
|
xc,
|
|
21399
|
-
id,
|
|
21415
|
+
id: id + 1,
|
|
21400
21416
|
isFocused: false,
|
|
21401
21417
|
}));
|
|
21402
21418
|
return ranges.map((range) => ({
|
|
@@ -27255,7 +27271,11 @@ class GridComposer extends owl.Component {
|
|
|
27255
27271
|
}
|
|
27256
27272
|
}
|
|
27257
27273
|
updateCellReferenceVisibility() {
|
|
27258
|
-
if (this.
|
|
27274
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
27275
|
+
this.isCellReferenceVisible = false;
|
|
27276
|
+
return;
|
|
27277
|
+
}
|
|
27278
|
+
if (this.isCellReferenceVisible) {
|
|
27259
27279
|
return;
|
|
27260
27280
|
}
|
|
27261
27281
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -27284,19 +27304,21 @@ class GridCellIcon extends owl.Component {
|
|
|
27284
27304
|
static style = CSS$1;
|
|
27285
27305
|
static template = "o-spreadsheet-GridCellIcon";
|
|
27286
27306
|
get iconStyle() {
|
|
27287
|
-
const
|
|
27288
|
-
const
|
|
27307
|
+
const cellPosition = this.props.cellPosition;
|
|
27308
|
+
const merge = this.env.model.getters.getMerge(cellPosition);
|
|
27309
|
+
const zone = merge || positionToZone(cellPosition);
|
|
27310
|
+
const rect = this.env.model.getters.getVisibleRectWithoutHeaders(zone);
|
|
27311
|
+
const x = this.getIconHorizontalPosition(rect, cellPosition);
|
|
27312
|
+
const y = this.getIconVerticalPosition(rect, cellPosition);
|
|
27289
27313
|
return cssPropertiesToCss({
|
|
27290
27314
|
top: `${y + (this.props.offset?.y || 0)}px`,
|
|
27291
27315
|
left: `${x + (this.props.offset?.x || 0)}px`,
|
|
27292
27316
|
});
|
|
27293
27317
|
}
|
|
27294
|
-
getIconVerticalPosition() {
|
|
27295
|
-
const
|
|
27296
|
-
const
|
|
27297
|
-
const
|
|
27298
|
-
const end = this.env.model.getters.getRowDimensionsInViewport(sheetId, merge ? merge.bottom : row).end;
|
|
27299
|
-
const cell = this.env.model.getters.getCell(this.props.cellPosition);
|
|
27318
|
+
getIconVerticalPosition(rect, cellPosition) {
|
|
27319
|
+
const start = rect.y;
|
|
27320
|
+
const end = rect.y + rect.height;
|
|
27321
|
+
const cell = this.env.model.getters.getCell(cellPosition);
|
|
27300
27322
|
const align = this.props.verticalAlign || cell?.style?.verticalAlign || DEFAULT_VERTICAL_ALIGN;
|
|
27301
27323
|
switch (align) {
|
|
27302
27324
|
case "bottom":
|
|
@@ -27308,13 +27330,11 @@ class GridCellIcon extends owl.Component {
|
|
|
27308
27330
|
return end - GRID_ICON_EDGE_LENGTH - centeringOffset;
|
|
27309
27331
|
}
|
|
27310
27332
|
}
|
|
27311
|
-
getIconHorizontalPosition() {
|
|
27312
|
-
const
|
|
27313
|
-
const
|
|
27314
|
-
const
|
|
27315
|
-
const
|
|
27316
|
-
const cell = this.env.model.getters.getCell(this.props.cellPosition);
|
|
27317
|
-
const evaluatedCell = this.env.model.getters.getEvaluatedCell(this.props.cellPosition);
|
|
27333
|
+
getIconHorizontalPosition(rect, cellPosition) {
|
|
27334
|
+
const start = rect.x;
|
|
27335
|
+
const end = rect.x + rect.width;
|
|
27336
|
+
const cell = this.env.model.getters.getCell(cellPosition);
|
|
27337
|
+
const evaluatedCell = this.env.model.getters.getEvaluatedCell(cellPosition);
|
|
27318
27338
|
const align = this.props.horizontalAlign || cell?.style?.align || evaluatedCell.defaultAlign;
|
|
27319
27339
|
switch (align) {
|
|
27320
27340
|
case "right":
|
|
@@ -27406,6 +27426,8 @@ css /* scss */ `
|
|
|
27406
27426
|
height: ${CHECKBOX_WIDTH}px;
|
|
27407
27427
|
accent-color: #808080;
|
|
27408
27428
|
margin: ${MARGIN}px;
|
|
27429
|
+
/** required to prevent the checkbox position to be sensible to the font-size (affects Firefox) */
|
|
27430
|
+
position: absolute;
|
|
27409
27431
|
}
|
|
27410
27432
|
`;
|
|
27411
27433
|
class DataValidationCheckbox extends owl.Component {
|
|
@@ -27421,7 +27443,7 @@ class DataValidationCheckbox extends owl.Component {
|
|
|
27421
27443
|
}
|
|
27422
27444
|
get isDisabled() {
|
|
27423
27445
|
const cell = this.env.model.getters.getCell(this.props.cellPosition);
|
|
27424
|
-
return !!cell?.isFormula;
|
|
27446
|
+
return this.env.model.getters.isReadonly() || !!cell?.isFormula;
|
|
27425
27447
|
}
|
|
27426
27448
|
}
|
|
27427
27449
|
DataValidationCheckbox.props = {
|
|
@@ -27463,12 +27485,17 @@ class DataValidationOverlay extends owl.Component {
|
|
|
27463
27485
|
static template = "o-spreadsheet-DataValidationOverlay";
|
|
27464
27486
|
static components = { GridCellIcon, DataValidationCheckbox, DataValidationListIcon };
|
|
27465
27487
|
get checkBoxCellPositions() {
|
|
27466
|
-
return this.env.model.getters
|
|
27488
|
+
return this.env.model.getters
|
|
27489
|
+
.getVisibleCellPositions()
|
|
27490
|
+
.filter(this.env.model.getters.isCellValidCheckbox);
|
|
27467
27491
|
}
|
|
27468
27492
|
get listIconsCellPositions() {
|
|
27469
|
-
|
|
27470
|
-
|
|
27471
|
-
|
|
27493
|
+
if (this.env.model.getters.isReadonly()) {
|
|
27494
|
+
return [];
|
|
27495
|
+
}
|
|
27496
|
+
return this.env.model.getters
|
|
27497
|
+
.getVisibleCellPositions()
|
|
27498
|
+
.filter(this.env.model.getters.cellHasListDataValidationIcon);
|
|
27472
27499
|
}
|
|
27473
27500
|
}
|
|
27474
27501
|
DataValidationOverlay.props = {};
|
|
@@ -33829,29 +33856,12 @@ const MIGRATIONS = [
|
|
|
33829
33856
|
from: 12,
|
|
33830
33857
|
to: 12.5,
|
|
33831
33858
|
applyMigration(data) {
|
|
33832
|
-
|
|
33833
|
-
let knownDataFilterZones = [];
|
|
33834
|
-
for (let filterTable of sheet.filterTables || []) {
|
|
33835
|
-
const zone = toZone(filterTable.range);
|
|
33836
|
-
// See commit message for the details
|
|
33837
|
-
const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
|
|
33838
|
-
if (intersectZoneIndex !== -1) {
|
|
33839
|
-
knownDataFilterZones[intersectZoneIndex] = zone;
|
|
33840
|
-
}
|
|
33841
|
-
else {
|
|
33842
|
-
knownDataFilterZones.push(zone);
|
|
33843
|
-
}
|
|
33844
|
-
}
|
|
33845
|
-
sheet.filterTables = knownDataFilterZones.map((zone) => ({
|
|
33846
|
-
range: zoneToXc(zone),
|
|
33847
|
-
}));
|
|
33848
|
-
}
|
|
33849
|
-
return data;
|
|
33859
|
+
return fixOverlappingFilters(data);
|
|
33850
33860
|
},
|
|
33851
33861
|
},
|
|
33852
33862
|
{
|
|
33853
33863
|
description: "Change Border description structure",
|
|
33854
|
-
from: 12,
|
|
33864
|
+
from: 12.5,
|
|
33855
33865
|
to: 13,
|
|
33856
33866
|
applyMigration(data) {
|
|
33857
33867
|
for (const borderId in data.borders) {
|
|
@@ -33882,6 +33892,14 @@ const MIGRATIONS = [
|
|
|
33882
33892
|
return data;
|
|
33883
33893
|
},
|
|
33884
33894
|
},
|
|
33895
|
+
{
|
|
33896
|
+
description: "Fix datafilter duplication (post saas-16.4)",
|
|
33897
|
+
from: 14,
|
|
33898
|
+
to: 14.5,
|
|
33899
|
+
applyMigration(data) {
|
|
33900
|
+
return fixOverlappingFilters(data);
|
|
33901
|
+
},
|
|
33902
|
+
},
|
|
33885
33903
|
];
|
|
33886
33904
|
/**
|
|
33887
33905
|
* This function is used to repair faulty data independently of the migration.
|
|
@@ -34039,6 +34057,26 @@ function fixChartDefinitions(data, initialMessages) {
|
|
|
34039
34057
|
}
|
|
34040
34058
|
return messages;
|
|
34041
34059
|
}
|
|
34060
|
+
function fixOverlappingFilters(data) {
|
|
34061
|
+
for (let sheet of data.sheets || []) {
|
|
34062
|
+
let knownDataFilterZones = [];
|
|
34063
|
+
for (let filterTable of sheet.filterTables || []) {
|
|
34064
|
+
const zone = toZone(filterTable.range);
|
|
34065
|
+
// See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
|
|
34066
|
+
const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
|
|
34067
|
+
if (intersectZoneIndex !== -1) {
|
|
34068
|
+
knownDataFilterZones[intersectZoneIndex] = zone;
|
|
34069
|
+
}
|
|
34070
|
+
else {
|
|
34071
|
+
knownDataFilterZones.push(zone);
|
|
34072
|
+
}
|
|
34073
|
+
}
|
|
34074
|
+
sheet.filterTables = knownDataFilterZones.map((zone) => ({
|
|
34075
|
+
range: zoneToXc(zone),
|
|
34076
|
+
}));
|
|
34077
|
+
}
|
|
34078
|
+
return data;
|
|
34079
|
+
}
|
|
34042
34080
|
// -----------------------------------------------------------------------------
|
|
34043
34081
|
// Helpers
|
|
34044
34082
|
// -----------------------------------------------------------------------------
|
|
@@ -38573,7 +38611,6 @@ class SheetPlugin extends CorePlugin {
|
|
|
38573
38611
|
"getNumberHeaders",
|
|
38574
38612
|
"getGridLinesVisibility",
|
|
38575
38613
|
"getNextSheetName",
|
|
38576
|
-
"isEmpty",
|
|
38577
38614
|
"getSheetSize",
|
|
38578
38615
|
"getSheetZone",
|
|
38579
38616
|
"getPaneDivisions",
|
|
@@ -38948,14 +38985,6 @@ class SheetPlugin extends CorePlugin {
|
|
|
38948
38985
|
// ---------------------------------------------------------------------------
|
|
38949
38986
|
// Row/Col manipulation
|
|
38950
38987
|
// ---------------------------------------------------------------------------
|
|
38951
|
-
/**
|
|
38952
|
-
* Check if a zone only contains empty cells
|
|
38953
|
-
*/
|
|
38954
|
-
isEmpty(sheetId, zone) {
|
|
38955
|
-
return positions(zone)
|
|
38956
|
-
.map(({ col, row }) => this.getCell({ sheetId, col, row }))
|
|
38957
|
-
.every((cell) => !cell || cell.content === "");
|
|
38958
|
-
}
|
|
38959
38988
|
getCommandZones(cmd) {
|
|
38960
38989
|
const zones = [];
|
|
38961
38990
|
if ("zone" in cmd) {
|
|
@@ -41409,6 +41438,7 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
41409
41438
|
"getEvaluatedCellsInZone",
|
|
41410
41439
|
"getSpreadPositionsOf",
|
|
41411
41440
|
"getArrayFormulaSpreadingOn",
|
|
41441
|
+
"isEmpty",
|
|
41412
41442
|
];
|
|
41413
41443
|
shouldRebuildDependenciesGraph = true;
|
|
41414
41444
|
evaluator;
|
|
@@ -41513,6 +41543,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
41513
41543
|
getArrayFormulaSpreadingOn(position) {
|
|
41514
41544
|
return this.evaluator.getArrayFormulaSpreadingOn(position);
|
|
41515
41545
|
}
|
|
41546
|
+
/**
|
|
41547
|
+
* Check if a zone only contains empty cells
|
|
41548
|
+
*/
|
|
41549
|
+
isEmpty(sheetId, zone) {
|
|
41550
|
+
return positions(zone)
|
|
41551
|
+
.map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
|
|
41552
|
+
.every((cell) => cell.type === CellValueType.empty);
|
|
41553
|
+
}
|
|
41516
41554
|
// ---------------------------------------------------------------------------
|
|
41517
41555
|
// Export
|
|
41518
41556
|
// ---------------------------------------------------------------------------
|
|
@@ -42159,8 +42197,6 @@ const VALID_RESULT = { isValid: true };
|
|
|
42159
42197
|
class EvaluationDataValidationPlugin extends UIPlugin {
|
|
42160
42198
|
static getters = [
|
|
42161
42199
|
"getDataValidationInvalidCriterionValueMessage",
|
|
42162
|
-
"getDataValidationCheckBoxCellPositions",
|
|
42163
|
-
"getDataValidationListCellsPositions",
|
|
42164
42200
|
"getInvalidDataValidationMessage",
|
|
42165
42201
|
"getValidationResultForCellValue",
|
|
42166
42202
|
"isCellValidCheckbox",
|
|
@@ -42224,19 +42260,6 @@ class EvaluationDataValidationPlugin extends UIPlugin {
|
|
|
42224
42260
|
const error = this.getRuleErrorForCellValue(cellValue, cellPosition, rule);
|
|
42225
42261
|
return error ? { error, rule, isValid: false } : VALID_RESULT;
|
|
42226
42262
|
}
|
|
42227
|
-
getDataValidationCheckBoxCellPositions() {
|
|
42228
|
-
const rules = this.getters
|
|
42229
|
-
.getDataValidationRules(this.getters.getActiveSheetId())
|
|
42230
|
-
.filter((rule) => rule.criterion.type === "isBoolean");
|
|
42231
|
-
return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat()).filter((position) => this.isCellValidCheckbox(position));
|
|
42232
|
-
}
|
|
42233
|
-
getDataValidationListCellsPositions() {
|
|
42234
|
-
const rules = this.getters
|
|
42235
|
-
.getDataValidationRules(this.getters.getActiveSheetId())
|
|
42236
|
-
.filter((rule) => (rule.criterion.type === "isValueInList" || rule.criterion.type === "isValueInRange") &&
|
|
42237
|
-
rule.criterion.displayStyle === "arrow");
|
|
42238
|
-
return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat());
|
|
42239
|
-
}
|
|
42240
42263
|
getValidationResultForCell(cellPosition) {
|
|
42241
42264
|
const { col, row, sheetId } = cellPosition;
|
|
42242
42265
|
if (!this.validationResults[sheetId]) {
|
|
@@ -46429,19 +46452,17 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46429
46452
|
break;
|
|
46430
46453
|
case "FOCUS_RANGE":
|
|
46431
46454
|
case "CHANGE_RANGE":
|
|
46432
|
-
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46437
|
-
|
|
46438
|
-
|
|
46439
|
-
|
|
46440
|
-
|
|
46441
|
-
});
|
|
46442
|
-
}
|
|
46443
|
-
this.focusedInputId = cmd.id;
|
|
46455
|
+
const input = this.inputs[cmd.id];
|
|
46456
|
+
const range = input.ranges.find((range) => range.id === cmd.rangeId);
|
|
46457
|
+
if (range) {
|
|
46458
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
46459
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
|
|
46460
|
+
this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, {
|
|
46461
|
+
handleEvent: input.handleEvent.bind(input),
|
|
46462
|
+
release: () => (this.focusedInputId = null),
|
|
46463
|
+
});
|
|
46444
46464
|
}
|
|
46465
|
+
this.focusedInputId = cmd.id;
|
|
46445
46466
|
break;
|
|
46446
46467
|
}
|
|
46447
46468
|
this.currentInput?.handle(cmd);
|
|
@@ -50061,6 +50082,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50061
50082
|
"getEdgeScrollRow",
|
|
50062
50083
|
"getVisibleFigures",
|
|
50063
50084
|
"getVisibleRect",
|
|
50085
|
+
"getVisibleRectWithoutHeaders",
|
|
50086
|
+
"getVisibleCellPositions",
|
|
50064
50087
|
"getColRowOffsetInViewport",
|
|
50065
50088
|
"getMainViewportCoordinates",
|
|
50066
50089
|
"getActiveSheetScrollInfo",
|
|
@@ -50304,6 +50327,26 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50304
50327
|
const viewports = this.getSubViewports(sheetId);
|
|
50305
50328
|
return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => !this.getters.isHeaderHidden(sheetId, "ROW", row));
|
|
50306
50329
|
}
|
|
50330
|
+
/**
|
|
50331
|
+
* Get the positions of all the cells that are visible in the viewport, taking merges into account.
|
|
50332
|
+
*/
|
|
50333
|
+
getVisibleCellPositions() {
|
|
50334
|
+
const visibleCols = this.getSheetViewVisibleCols();
|
|
50335
|
+
const visibleRows = this.getSheetViewVisibleRows();
|
|
50336
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
50337
|
+
const positions = [];
|
|
50338
|
+
for (const col of visibleCols) {
|
|
50339
|
+
for (const row of visibleRows) {
|
|
50340
|
+
const position = { sheetId, col, row };
|
|
50341
|
+
const mainPosition = this.getters.getMainCellPosition(position);
|
|
50342
|
+
if (mainPosition.row !== row || mainPosition.col !== col) {
|
|
50343
|
+
continue;
|
|
50344
|
+
}
|
|
50345
|
+
positions.push(position);
|
|
50346
|
+
}
|
|
50347
|
+
}
|
|
50348
|
+
return positions;
|
|
50349
|
+
}
|
|
50307
50350
|
/**
|
|
50308
50351
|
* Return the main viewport maximum size relative to the client size.
|
|
50309
50352
|
*/
|
|
@@ -50423,6 +50466,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50423
50466
|
* Computes the coordinates and size to draw the zone on the canvas
|
|
50424
50467
|
*/
|
|
50425
50468
|
getVisibleRect(zone) {
|
|
50469
|
+
const rect = this.getVisibleRectWithoutHeaders(zone);
|
|
50470
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
50471
|
+
}
|
|
50472
|
+
/**
|
|
50473
|
+
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
50474
|
+
*/
|
|
50475
|
+
getVisibleRectWithoutHeaders(zone) {
|
|
50426
50476
|
const sheetId = this.getters.getActiveSheetId();
|
|
50427
50477
|
const viewportRects = this.getSubViewports(sheetId)
|
|
50428
50478
|
.map((viewport) => viewport.getRect(zone))
|
|
@@ -50434,12 +50484,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50434
50484
|
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
50435
50485
|
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
50436
50486
|
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
50437
|
-
return {
|
|
50438
|
-
x: x + this.gridOffsetX,
|
|
50439
|
-
y: y + this.gridOffsetY,
|
|
50440
|
-
width,
|
|
50441
|
-
height,
|
|
50442
|
-
};
|
|
50487
|
+
return { x, y, width, height };
|
|
50443
50488
|
}
|
|
50444
50489
|
/**
|
|
50445
50490
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -50663,13 +50708,8 @@ class HeaderPositionsUIPlugin extends UIPlugin {
|
|
|
50663
50708
|
}
|
|
50664
50709
|
break;
|
|
50665
50710
|
case "UPDATE_CELL":
|
|
50666
|
-
|
|
50667
|
-
|
|
50668
|
-
this.isDirty = true;
|
|
50669
|
-
}
|
|
50670
|
-
else {
|
|
50671
|
-
this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
|
|
50672
|
-
}
|
|
50711
|
+
this.headerPositions = {};
|
|
50712
|
+
this.isDirty = true;
|
|
50673
50713
|
break;
|
|
50674
50714
|
case "UPDATE_FILTER":
|
|
50675
50715
|
case "REMOVE_FILTER_TABLE":
|
|
@@ -56916,6 +56956,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
56916
56956
|
exports.tokenize = tokenize;
|
|
56917
56957
|
|
|
56918
56958
|
|
|
56919
|
-
__info__.version = "17.0.
|
|
56920
|
-
__info__.date = "2024-
|
|
56921
|
-
__info__.hash = "
|
|
56959
|
+
__info__.version = "17.0.14";
|
|
56960
|
+
__info__.date = "2024-03-12T07:56:15.364Z";
|
|
56961
|
+
__info__.hash = "6f6e1b9";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -3981,7 +3981,7 @@ interface SheetState {
|
|
|
3981
3981
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
3982
3982
|
}
|
|
3983
3983
|
declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
3984
|
-
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "
|
|
3984
|
+
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders"];
|
|
3985
3985
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
3986
3986
|
readonly orderedSheetIds: UID[];
|
|
3987
3987
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -4030,10 +4030,6 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4030
4030
|
* This validation ensures that all rows or columns cannot be deleted when frozen panes exist.
|
|
4031
4031
|
*/
|
|
4032
4032
|
checkElementsIncludeAllNonFrozenHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
|
|
4033
|
-
/**
|
|
4034
|
-
* Check if a zone only contains empty cells
|
|
4035
|
-
*/
|
|
4036
|
-
isEmpty(sheetId: UID, zone: Zone): boolean;
|
|
4037
4033
|
getCommandZones(cmd: Command): Zone[];
|
|
4038
4034
|
/**
|
|
4039
4035
|
* Check if zones in the command are well formed and
|
|
@@ -4128,7 +4124,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4128
4124
|
}
|
|
4129
4125
|
|
|
4130
4126
|
declare class EvaluationPlugin extends UIPlugin {
|
|
4131
|
-
static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn"];
|
|
4127
|
+
static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
|
|
4132
4128
|
private shouldRebuildDependenciesGraph;
|
|
4133
4129
|
private evaluator;
|
|
4134
4130
|
private positionsToUpdate;
|
|
@@ -4154,6 +4150,10 @@ declare class EvaluationPlugin extends UIPlugin {
|
|
|
4154
4150
|
getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
|
|
4155
4151
|
getSpreadPositionsOf(position: CellPosition): CellPosition[];
|
|
4156
4152
|
getArrayFormulaSpreadingOn(position: CellPosition): CellPosition | undefined;
|
|
4153
|
+
/**
|
|
4154
|
+
* Check if a zone only contains empty cells
|
|
4155
|
+
*/
|
|
4156
|
+
isEmpty(sheetId: UID, zone: Zone): boolean;
|
|
4157
4157
|
exportForExcel(data: ExcelWorkbookData): void;
|
|
4158
4158
|
/**
|
|
4159
4159
|
* Returns the corresponding formula cell of a given cell
|
|
@@ -4253,7 +4253,7 @@ type SheetValidationResult = {
|
|
|
4253
4253
|
[col: HeaderIndex]: Array<Lazy<ValidationResult>>;
|
|
4254
4254
|
};
|
|
4255
4255
|
declare class EvaluationDataValidationPlugin extends UIPlugin {
|
|
4256
|
-
static getters: readonly ["getDataValidationInvalidCriterionValueMessage", "
|
|
4256
|
+
static getters: readonly ["getDataValidationInvalidCriterionValueMessage", "getInvalidDataValidationMessage", "getValidationResultForCellValue", "isCellValidCheckbox", "isDataValidationInvalid"];
|
|
4257
4257
|
validationResults: Record<UID, SheetValidationResult>;
|
|
4258
4258
|
handle(cmd: CoreViewCommand): void;
|
|
4259
4259
|
isDataValidationInvalid(cellPosition: CellPosition): boolean;
|
|
@@ -4267,8 +4267,6 @@ declare class EvaluationDataValidationPlugin extends UIPlugin {
|
|
|
4267
4267
|
isCellValidCheckbox(cellPosition: CellPosition): boolean;
|
|
4268
4268
|
/** Get the validation result if the cell on the given position had the given value */
|
|
4269
4269
|
getValidationResultForCellValue(cellValue: CellValue, cellPosition: CellPosition): ValidationResult;
|
|
4270
|
-
getDataValidationCheckBoxCellPositions(): CellPosition[];
|
|
4271
|
-
getDataValidationListCellsPositions(): CellPosition[];
|
|
4272
4270
|
private getValidationResultForCell;
|
|
4273
4271
|
private computeSheetValidationResults;
|
|
4274
4272
|
private getRuleErrorForCellValue;
|
|
@@ -5123,7 +5121,7 @@ type SheetViewports = {
|
|
|
5123
5121
|
*
|
|
5124
5122
|
*/
|
|
5125
5123
|
declare class SheetViewPlugin extends UIPlugin {
|
|
5126
|
-
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible"];
|
|
5124
|
+
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible"];
|
|
5127
5125
|
readonly viewports: Record<UID, SheetViewports | undefined>;
|
|
5128
5126
|
/**
|
|
5129
5127
|
* The viewport dimensions are usually set by one of the components
|
|
@@ -5170,6 +5168,10 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5170
5168
|
getActiveSheetDOMScrollInfo(): SheetDOMScrollInfo;
|
|
5171
5169
|
getSheetViewVisibleCols(): HeaderIndex[];
|
|
5172
5170
|
getSheetViewVisibleRows(): HeaderIndex[];
|
|
5171
|
+
/**
|
|
5172
|
+
* Get the positions of all the cells that are visible in the viewport, taking merges into account.
|
|
5173
|
+
*/
|
|
5174
|
+
getVisibleCellPositions(): CellPosition[];
|
|
5173
5175
|
/**
|
|
5174
5176
|
* Return the main viewport maximum size relative to the client size.
|
|
5175
5177
|
*/
|
|
@@ -5186,6 +5188,10 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5186
5188
|
* Computes the coordinates and size to draw the zone on the canvas
|
|
5187
5189
|
*/
|
|
5188
5190
|
getVisibleRect(zone: Zone): Rect;
|
|
5191
|
+
/**
|
|
5192
|
+
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
5193
|
+
*/
|
|
5194
|
+
getVisibleRectWithoutHeaders(zone: Zone): Rect;
|
|
5189
5195
|
/**
|
|
5190
5196
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
5191
5197
|
* It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
|