@odoo/o-spreadsheet 18.2.0-alpha.8 → 18.3.0-alpha.0
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 +151 -73
- package/dist/o-spreadsheet.d.ts +16 -16
- package/dist/o-spreadsheet.esm.js +151 -73
- package/dist/o-spreadsheet.iife.js +151 -73
- package/dist/o-spreadsheet.iife.min.js +289 -285
- package/dist/o_spreadsheet.xml +17 -14
- package/package.json +2 -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.
|
|
6
|
-
* @date 2025-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.0-alpha.0
|
|
6
|
+
* @date 2025-02-18T09:02:28.625Z
|
|
7
|
+
* @hash 9b88da0
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -2229,17 +2229,7 @@ function toZoneWithoutBoundaryChanges(xc) {
|
|
|
2229
2229
|
*/
|
|
2230
2230
|
function toUnboundedZone(xc) {
|
|
2231
2231
|
const zone = toZoneWithoutBoundaryChanges(xc);
|
|
2232
|
-
|
|
2233
|
-
const tmp = zone.left;
|
|
2234
|
-
zone.left = zone.right;
|
|
2235
|
-
zone.right = tmp;
|
|
2236
|
-
}
|
|
2237
|
-
if (zone.bottom !== undefined && zone.bottom < zone.top) {
|
|
2238
|
-
const tmp = zone.top;
|
|
2239
|
-
zone.top = zone.bottom;
|
|
2240
|
-
zone.bottom = tmp;
|
|
2241
|
-
}
|
|
2242
|
-
return zone;
|
|
2232
|
+
return reorderZone(zone);
|
|
2243
2233
|
}
|
|
2244
2234
|
/**
|
|
2245
2235
|
* Convert from a cartesian reference to a Zone.
|
|
@@ -2513,11 +2503,11 @@ function positions(zone) {
|
|
|
2513
2503
|
return positions;
|
|
2514
2504
|
}
|
|
2515
2505
|
function reorderZone(zone) {
|
|
2516
|
-
if (zone.left > zone.right) {
|
|
2517
|
-
zone = { left: zone.right, right: zone.left
|
|
2506
|
+
if (zone.right !== undefined && zone.left > zone.right) {
|
|
2507
|
+
zone = { ...zone, left: zone.right, right: zone.left };
|
|
2518
2508
|
}
|
|
2519
|
-
if (zone.top > zone.bottom) {
|
|
2520
|
-
zone = {
|
|
2509
|
+
if (zone.bottom !== undefined && zone.top > zone.bottom) {
|
|
2510
|
+
zone = { ...zone, top: zone.bottom, bottom: zone.top };
|
|
2521
2511
|
}
|
|
2522
2512
|
return zone;
|
|
2523
2513
|
}
|
|
@@ -3422,12 +3412,12 @@ function isTargetDependent(cmd) {
|
|
|
3422
3412
|
function isRangeDependant(cmd) {
|
|
3423
3413
|
return "ranges" in cmd;
|
|
3424
3414
|
}
|
|
3425
|
-
function isZoneDependent(cmd) {
|
|
3426
|
-
return "zone" in cmd;
|
|
3427
|
-
}
|
|
3428
3415
|
function isPositionDependent(cmd) {
|
|
3429
3416
|
return "col" in cmd && "row" in cmd && "sheetId" in cmd;
|
|
3430
3417
|
}
|
|
3418
|
+
function isZoneDependent(cmd) {
|
|
3419
|
+
return "sheetId" in cmd && "zone" in cmd;
|
|
3420
|
+
}
|
|
3431
3421
|
const invalidateEvaluationCommands = new Set([
|
|
3432
3422
|
"RENAME_SHEET",
|
|
3433
3423
|
"DELETE_SHEET",
|
|
@@ -3439,6 +3429,7 @@ const invalidateEvaluationCommands = new Set([
|
|
|
3439
3429
|
"REDO",
|
|
3440
3430
|
"ADD_MERGE",
|
|
3441
3431
|
"REMOVE_MERGE",
|
|
3432
|
+
"DUPLICATE_SHEET",
|
|
3442
3433
|
"UPDATE_LOCALE",
|
|
3443
3434
|
"ADD_PIVOT",
|
|
3444
3435
|
"UPDATE_PIVOT",
|
|
@@ -3468,7 +3459,6 @@ const invalidateChartEvaluationCommands = new Set([
|
|
|
3468
3459
|
]);
|
|
3469
3460
|
const invalidateDependenciesCommands = new Set(["MOVE_RANGES"]);
|
|
3470
3461
|
const invalidateCFEvaluationCommands = new Set([
|
|
3471
|
-
"DUPLICATE_SHEET",
|
|
3472
3462
|
"EVALUATE_CELLS",
|
|
3473
3463
|
"ADD_CONDITIONAL_FORMAT",
|
|
3474
3464
|
"REMOVE_CONDITIONAL_FORMAT",
|
|
@@ -3638,6 +3628,7 @@ var CommandResult;
|
|
|
3638
3628
|
CommandResult["InvalidRange"] = "InvalidRange";
|
|
3639
3629
|
CommandResult["InvalidZones"] = "InvalidZones";
|
|
3640
3630
|
CommandResult["InvalidSheetId"] = "InvalidSheetId";
|
|
3631
|
+
CommandResult["InvalidCellId"] = "InvalidCellId";
|
|
3641
3632
|
CommandResult["InvalidFigureId"] = "InvalidFigureId";
|
|
3642
3633
|
CommandResult["InputAlreadyFocused"] = "InputAlreadyFocused";
|
|
3643
3634
|
CommandResult["MaximumRangesReached"] = "MaximumRangesReached";
|
|
@@ -12236,6 +12227,25 @@ const LN = {
|
|
|
12236
12227
|
isExported: true,
|
|
12237
12228
|
};
|
|
12238
12229
|
// -----------------------------------------------------------------------------
|
|
12230
|
+
// LOG
|
|
12231
|
+
// -----------------------------------------------------------------------------
|
|
12232
|
+
const LOG = {
|
|
12233
|
+
description: _t("The logarithm of a number, for a given base."),
|
|
12234
|
+
args: [
|
|
12235
|
+
arg("value (number)", _t("The value for which to calculate the logarithm.")),
|
|
12236
|
+
arg("base (number, default=10)", _t("The base of the logarithm.")),
|
|
12237
|
+
],
|
|
12238
|
+
compute: function (value, base = { value: 10 }) {
|
|
12239
|
+
const _value = toNumber(value, this.locale);
|
|
12240
|
+
const _base = toNumber(base, this.locale);
|
|
12241
|
+
assert(() => _value > 0, _t("The value (%s) must be strictly positive.", _value.toString()));
|
|
12242
|
+
assert(() => _base > 0, _t("The base (%s) must be strictly positive.", _base.toString()));
|
|
12243
|
+
assert(() => _base !== 1, _t("The base must be different from 1."));
|
|
12244
|
+
return Math.log10(_value) / Math.log10(_base);
|
|
12245
|
+
},
|
|
12246
|
+
isExported: true,
|
|
12247
|
+
};
|
|
12248
|
+
// -----------------------------------------------------------------------------
|
|
12239
12249
|
// MOD
|
|
12240
12250
|
// -----------------------------------------------------------------------------
|
|
12241
12251
|
function mod(dividend, divisor) {
|
|
@@ -12775,6 +12785,7 @@ var math = /*#__PURE__*/Object.freeze({
|
|
|
12775
12785
|
ISODD: ISODD,
|
|
12776
12786
|
ISO_CEILING: ISO_CEILING,
|
|
12777
12787
|
LN: LN,
|
|
12788
|
+
LOG: LOG,
|
|
12778
12789
|
MOD: MOD,
|
|
12779
12790
|
MUNIT: MUNIT,
|
|
12780
12791
|
ODD: ODD,
|
|
@@ -28930,7 +28941,7 @@ function getPieChartDatasets(definition, args) {
|
|
|
28930
28941
|
const dataset = {
|
|
28931
28942
|
label,
|
|
28932
28943
|
data,
|
|
28933
|
-
borderColor:
|
|
28944
|
+
borderColor: definition.background || "#FFFFFF",
|
|
28934
28945
|
backgroundColor,
|
|
28935
28946
|
hoverOffset: 30,
|
|
28936
28947
|
};
|
|
@@ -38918,7 +38929,7 @@ css /* scss */ `
|
|
|
38918
38929
|
.o-font-size-editor {
|
|
38919
38930
|
height: calc(100% - 4px);
|
|
38920
38931
|
input.o-font-size {
|
|
38921
|
-
outline
|
|
38932
|
+
outline: none;
|
|
38922
38933
|
height: 20px;
|
|
38923
38934
|
width: 23px;
|
|
38924
38935
|
}
|
|
@@ -53464,6 +53475,10 @@ class CellPlugin extends CorePlugin {
|
|
|
53464
53475
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
53465
53476
|
case "CLEAR_CELL":
|
|
53466
53477
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
53478
|
+
case "UPDATE_CELL_POSITION":
|
|
53479
|
+
return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId]
|
|
53480
|
+
? "Success" /* CommandResult.Success */
|
|
53481
|
+
: "InvalidCellId" /* CommandResult.InvalidCellId */;
|
|
53467
53482
|
default:
|
|
53468
53483
|
return "Success" /* CommandResult.Success */;
|
|
53469
53484
|
}
|
|
@@ -53508,6 +53523,9 @@ class CellPlugin extends CorePlugin {
|
|
|
53508
53523
|
case "DELETE_CONTENT":
|
|
53509
53524
|
this.clearZones(cmd.sheetId, cmd.target);
|
|
53510
53525
|
break;
|
|
53526
|
+
case "DELETE_SHEET": {
|
|
53527
|
+
this.history.update("cells", cmd.sheetId, undefined);
|
|
53528
|
+
}
|
|
53511
53529
|
}
|
|
53512
53530
|
}
|
|
53513
53531
|
clearZones(sheetId, zones) {
|
|
@@ -54298,6 +54316,9 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
54298
54316
|
allowDispatch(cmd) {
|
|
54299
54317
|
switch (cmd.type) {
|
|
54300
54318
|
case "ADD_CONDITIONAL_FORMAT":
|
|
54319
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
54320
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
54321
|
+
}
|
|
54301
54322
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
54302
54323
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY":
|
|
54303
54324
|
return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
@@ -54714,8 +54735,17 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
54714
54735
|
allowDispatch(cmd) {
|
|
54715
54736
|
switch (cmd.type) {
|
|
54716
54737
|
case "ADD_DATA_VALIDATION_RULE":
|
|
54738
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
54739
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
54740
|
+
}
|
|
54741
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
54742
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
54743
|
+
}
|
|
54717
54744
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
54718
54745
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
54746
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
54747
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
54748
|
+
}
|
|
54719
54749
|
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) {
|
|
54720
54750
|
return "UnknownDataValidationRule" /* CommandResult.UnknownDataValidationRule */;
|
|
54721
54751
|
}
|
|
@@ -54942,6 +54972,7 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
54942
54972
|
class FigurePlugin extends CorePlugin {
|
|
54943
54973
|
static getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
54944
54974
|
figures = {};
|
|
54975
|
+
insertionOrders = []; // TODO use a list in master
|
|
54945
54976
|
// ---------------------------------------------------------------------------
|
|
54946
54977
|
// Command Handling
|
|
54947
54978
|
// ---------------------------------------------------------------------------
|
|
@@ -55044,11 +55075,14 @@ class FigurePlugin extends CorePlugin {
|
|
|
55044
55075
|
}
|
|
55045
55076
|
addFigure(figure, sheetId) {
|
|
55046
55077
|
this.history.update("figures", sheetId, figure.id, figure);
|
|
55078
|
+
this.history.update("insertionOrders", this.insertionOrders.length, figure.id);
|
|
55047
55079
|
}
|
|
55048
55080
|
deleteSheet(sheetId) {
|
|
55081
|
+
this.history.update("insertionOrders", this.insertionOrders.filter((id) => !this.figures[sheetId]?.[id]));
|
|
55049
55082
|
this.history.update("figures", sheetId, undefined);
|
|
55050
55083
|
}
|
|
55051
55084
|
removeFigure(id, sheetId) {
|
|
55085
|
+
this.history.update("insertionOrders", this.insertionOrders.filter((figureId) => figureId !== id));
|
|
55052
55086
|
this.history.update("figures", sheetId, id, undefined);
|
|
55053
55087
|
}
|
|
55054
55088
|
checkFigureExists(sheetId, figureId) {
|
|
@@ -55067,7 +55101,14 @@ class FigurePlugin extends CorePlugin {
|
|
|
55067
55101
|
// Getters
|
|
55068
55102
|
// ---------------------------------------------------------------------------
|
|
55069
55103
|
getFigures(sheetId) {
|
|
55070
|
-
|
|
55104
|
+
const figures = [];
|
|
55105
|
+
for (const figureId of this.insertionOrders) {
|
|
55106
|
+
const figure = this.figures[sheetId]?.[figureId];
|
|
55107
|
+
if (figure) {
|
|
55108
|
+
figures.push(figure);
|
|
55109
|
+
}
|
|
55110
|
+
}
|
|
55111
|
+
return figures;
|
|
55071
55112
|
}
|
|
55072
55113
|
getFigure(sheetId, figureId) {
|
|
55073
55114
|
return this.figures[sheetId]?.[figureId];
|
|
@@ -55080,11 +55121,9 @@ class FigurePlugin extends CorePlugin {
|
|
|
55080
55121
|
// ---------------------------------------------------------------------------
|
|
55081
55122
|
import(data) {
|
|
55082
55123
|
for (let sheet of data.sheets) {
|
|
55083
|
-
const figures
|
|
55084
|
-
|
|
55085
|
-
|
|
55086
|
-
});
|
|
55087
|
-
this.figures[sheet.id] = figures;
|
|
55124
|
+
for (const figure of sheet.figures) {
|
|
55125
|
+
this.addFigure(figure, sheet.id);
|
|
55126
|
+
}
|
|
55088
55127
|
}
|
|
55089
55128
|
}
|
|
55090
55129
|
export(data) {
|
|
@@ -56544,6 +56583,9 @@ class SheetPlugin extends CorePlugin {
|
|
|
56544
56583
|
case "CREATE_SHEET": {
|
|
56545
56584
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
56546
56585
|
}
|
|
56586
|
+
case "DUPLICATE_SHEET": {
|
|
56587
|
+
return this.sheets[cmd.sheetIdTo] ? "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */ : "Success" /* CommandResult.Success */;
|
|
56588
|
+
}
|
|
56547
56589
|
case "MOVE_SHEET":
|
|
56548
56590
|
try {
|
|
56549
56591
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
@@ -57346,14 +57388,18 @@ class SheetPlugin extends CorePlugin {
|
|
|
57346
57388
|
checkZonesAreInSheet(cmd) {
|
|
57347
57389
|
if (!("sheetId" in cmd))
|
|
57348
57390
|
return "Success" /* CommandResult.Success */;
|
|
57391
|
+
if ("ranges" in cmd &&
|
|
57392
|
+
cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
57393
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
57394
|
+
}
|
|
57349
57395
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
57350
57396
|
}
|
|
57351
57397
|
}
|
|
57352
57398
|
|
|
57353
|
-
let nextTableId = 1;
|
|
57354
57399
|
class TablePlugin extends CorePlugin {
|
|
57355
57400
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
57356
57401
|
tables = {};
|
|
57402
|
+
nextTableId = 1;
|
|
57357
57403
|
adaptRanges(applyChange, sheetId) {
|
|
57358
57404
|
const sheetIds = sheetId ? [sheetId] : this.getters.getSheetIds();
|
|
57359
57405
|
for (const sheetId of sheetIds) {
|
|
@@ -57365,6 +57411,9 @@ class TablePlugin extends CorePlugin {
|
|
|
57365
57411
|
allowDispatch(cmd) {
|
|
57366
57412
|
switch (cmd.type) {
|
|
57367
57413
|
case "CREATE_TABLE":
|
|
57414
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) {
|
|
57415
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
57416
|
+
}
|
|
57368
57417
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
57369
57418
|
if (!areZonesContinuous(zones)) {
|
|
57370
57419
|
return "NonContinuousTargets" /* CommandResult.NonContinuousTargets */;
|
|
@@ -57418,7 +57467,7 @@ class TablePlugin extends CorePlugin {
|
|
|
57418
57467
|
const union = this.getters.getRangesUnion(ranges);
|
|
57419
57468
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
|
|
57420
57469
|
this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
|
|
57421
|
-
const id =
|
|
57470
|
+
const id = this.consumeNextId();
|
|
57422
57471
|
const config = cmd.config || DEFAULT_TABLE_CONFIG;
|
|
57423
57472
|
const newTable = cmd.tableType === "dynamic"
|
|
57424
57473
|
? this.createDynamicTable(id, union, config)
|
|
@@ -57571,7 +57620,7 @@ class TablePlugin extends CorePlugin {
|
|
|
57571
57620
|
filters = [];
|
|
57572
57621
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
57573
57622
|
const filterZone = { ...zone, left: i, right: i };
|
|
57574
|
-
const uid =
|
|
57623
|
+
const uid = this.consumeNextId();
|
|
57575
57624
|
filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
|
|
57576
57625
|
}
|
|
57577
57626
|
}
|
|
@@ -57636,7 +57685,7 @@ class TablePlugin extends CorePlugin {
|
|
|
57636
57685
|
? table.filters.find((f) => f.col === i)
|
|
57637
57686
|
: undefined;
|
|
57638
57687
|
const filterZone = { ...tableZone, left: i, right: i };
|
|
57639
|
-
const filterId = oldFilter?.id ||
|
|
57688
|
+
const filterId = oldFilter?.id || this.consumeNextId();
|
|
57640
57689
|
filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
|
|
57641
57690
|
}
|
|
57642
57691
|
}
|
|
@@ -57737,7 +57786,7 @@ class TablePlugin extends CorePlugin {
|
|
|
57737
57786
|
if (filters.length < zoneToDimension(tableZone).numberOfCols) {
|
|
57738
57787
|
for (let col = tableZone.left; col <= tableZone.right; col++) {
|
|
57739
57788
|
if (!filters.find((filter) => filter.col === col)) {
|
|
57740
|
-
const uid =
|
|
57789
|
+
const uid = this.consumeNextId();
|
|
57741
57790
|
const filterZone = { ...tableZone, left: col, right: col };
|
|
57742
57791
|
filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
|
|
57743
57792
|
}
|
|
@@ -57747,13 +57796,18 @@ class TablePlugin extends CorePlugin {
|
|
|
57747
57796
|
const newTable = this.createStaticTable(table.id, table.type, newTableRange, table.config, filters);
|
|
57748
57797
|
this.history.update("tables", sheetId, table.id, newTable);
|
|
57749
57798
|
}
|
|
57799
|
+
consumeNextId() {
|
|
57800
|
+
const id = `${this.nextTableId}`;
|
|
57801
|
+
this.history.update("nextTableId", this.nextTableId + 1);
|
|
57802
|
+
return id;
|
|
57803
|
+
}
|
|
57750
57804
|
// ---------------------------------------------------------------------------
|
|
57751
57805
|
// Import/Export
|
|
57752
57806
|
// ---------------------------------------------------------------------------
|
|
57753
57807
|
import(data) {
|
|
57754
57808
|
for (const sheet of data.sheets) {
|
|
57755
57809
|
for (const tableData of sheet.tables || []) {
|
|
57756
|
-
const uuid =
|
|
57810
|
+
const uuid = this.consumeNextId();
|
|
57757
57811
|
const tableConfig = tableData.config || DEFAULT_TABLE_CONFIG;
|
|
57758
57812
|
const range = this.getters.getRangeFromSheetXC(sheet.id, tableData.range);
|
|
57759
57813
|
const tableType = tableData.type || "static";
|
|
@@ -57801,7 +57855,10 @@ class HeaderGroupingPlugin extends CorePlugin {
|
|
|
57801
57855
|
allowDispatch(cmd) {
|
|
57802
57856
|
switch (cmd.type) {
|
|
57803
57857
|
case "GROUP_HEADERS": {
|
|
57804
|
-
const { start, end } = cmd;
|
|
57858
|
+
const { start, end, sheetId } = cmd;
|
|
57859
|
+
if (!this.getters.tryGetSheet(sheetId)) {
|
|
57860
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
57861
|
+
}
|
|
57805
57862
|
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) {
|
|
57806
57863
|
return "InvalidHeaderGroupStartEnd" /* CommandResult.InvalidHeaderGroupStartEnd */;
|
|
57807
57864
|
}
|
|
@@ -57814,7 +57871,10 @@ class HeaderGroupingPlugin extends CorePlugin {
|
|
|
57814
57871
|
break;
|
|
57815
57872
|
}
|
|
57816
57873
|
case "UNGROUP_HEADERS": {
|
|
57817
|
-
const { start, end } = cmd;
|
|
57874
|
+
const { start, end, sheetId } = cmd;
|
|
57875
|
+
if (!this.getters.tryGetSheet(sheetId)) {
|
|
57876
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
57877
|
+
}
|
|
57818
57878
|
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) {
|
|
57819
57879
|
return "InvalidHeaderGroupStartEnd" /* CommandResult.InvalidHeaderGroupStartEnd */;
|
|
57820
57880
|
}
|
|
@@ -57825,6 +57885,9 @@ class HeaderGroupingPlugin extends CorePlugin {
|
|
|
57825
57885
|
}
|
|
57826
57886
|
case "UNFOLD_HEADER_GROUP":
|
|
57827
57887
|
case "FOLD_HEADER_GROUP":
|
|
57888
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
57889
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
57890
|
+
}
|
|
57828
57891
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
57829
57892
|
if (!group) {
|
|
57830
57893
|
return "UnknownHeaderGroup" /* CommandResult.UnknownHeaderGroup */;
|
|
@@ -58225,6 +58288,9 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
58225
58288
|
return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
58226
58289
|
}
|
|
58227
58290
|
case "UPDATE_PIVOT": {
|
|
58291
|
+
if (!(cmd.pivotId in this.pivots)) {
|
|
58292
|
+
return "PivotIdNotFound" /* CommandResult.PivotIdNotFound */;
|
|
58293
|
+
}
|
|
58228
58294
|
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) {
|
|
58229
58295
|
return "NoChanges" /* CommandResult.NoChanges */;
|
|
58230
58296
|
}
|
|
@@ -58241,6 +58307,8 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
58241
58307
|
return "EmptyName" /* CommandResult.EmptyName */;
|
|
58242
58308
|
}
|
|
58243
58309
|
break;
|
|
58310
|
+
case "REMOVE_PIVOT":
|
|
58311
|
+
case "DUPLICATE_PIVOT":
|
|
58244
58312
|
case "INSERT_PIVOT": {
|
|
58245
58313
|
if (!(cmd.pivotId in this.pivots)) {
|
|
58246
58314
|
return "PivotIdNotFound" /* CommandResult.PivotIdNotFound */;
|
|
@@ -58290,7 +58358,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
58290
58358
|
break;
|
|
58291
58359
|
}
|
|
58292
58360
|
case "UPDATE_PIVOT": {
|
|
58293
|
-
this.history.update("pivots", cmd.pivotId, "definition", cmd.pivot);
|
|
58361
|
+
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
58294
58362
|
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
58295
58363
|
break;
|
|
58296
58364
|
}
|
|
@@ -58361,7 +58429,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
58361
58429
|
// Private
|
|
58362
58430
|
// -------------------------------------------------------------------------
|
|
58363
58431
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
58364
|
-
this.history.update("pivots", pivotId, { definition: pivot, formulaId });
|
|
58432
|
+
this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
|
|
58365
58433
|
this.compileCalculatedMeasures(pivot.measures);
|
|
58366
58434
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
58367
58435
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
@@ -63279,6 +63347,9 @@ function updateChartRangesTransformation(toTransform, executed) {
|
|
|
63279
63347
|
};
|
|
63280
63348
|
}
|
|
63281
63349
|
function createSheetTransformation(toTransform, executed) {
|
|
63350
|
+
if (toTransform.sheetId === executed.sheetId) {
|
|
63351
|
+
toTransform = { ...toTransform, sheetId: `${toTransform.sheetId}~` };
|
|
63352
|
+
}
|
|
63282
63353
|
if (toTransform.name === executed.name) {
|
|
63283
63354
|
return {
|
|
63284
63355
|
...toTransform,
|
|
@@ -63922,15 +63993,6 @@ class Session extends EventBus {
|
|
|
63922
63993
|
}
|
|
63923
63994
|
this.sendPendingMessage();
|
|
63924
63995
|
}
|
|
63925
|
-
dropPendingRevision(revisionId) {
|
|
63926
|
-
this.revisions.drop(revisionId);
|
|
63927
|
-
const revisionIds = this.pendingMessages
|
|
63928
|
-
.filter((message) => message.type === "REMOTE_REVISION")
|
|
63929
|
-
.map((message) => message.nextRevisionId);
|
|
63930
|
-
this.trigger("pending-revisions-dropped", { revisionIds });
|
|
63931
|
-
this.waitingAck = false;
|
|
63932
|
-
this.waitingUndoRedoAck = false;
|
|
63933
|
-
}
|
|
63934
63996
|
/**
|
|
63935
63997
|
* Send the next pending message
|
|
63936
63998
|
*/
|
|
@@ -63939,15 +64001,14 @@ class Session extends EventBus {
|
|
|
63939
64001
|
if (!message)
|
|
63940
64002
|
return;
|
|
63941
64003
|
if (message.type === "REMOTE_REVISION") {
|
|
63942
|
-
|
|
64004
|
+
let revision = this.revisions.get(message.nextRevisionId);
|
|
63943
64005
|
if (revision.commands.length === 0) {
|
|
63944
64006
|
/**
|
|
63945
|
-
* The command is empty, we have to
|
|
64007
|
+
* The command is empty, we have to rebase all the next local revisions
|
|
63946
64008
|
* to avoid issues with undo/redo
|
|
63947
64009
|
*/
|
|
63948
|
-
this.
|
|
63949
|
-
|
|
63950
|
-
return;
|
|
64010
|
+
this.revisions.rebase(revision.id);
|
|
64011
|
+
revision = this.revisions.get(message.nextRevisionId);
|
|
63951
64012
|
}
|
|
63952
64013
|
message = {
|
|
63953
64014
|
...message,
|
|
@@ -63983,18 +64044,16 @@ class Session extends EventBus {
|
|
|
63983
64044
|
case "REVISION_UNDONE": {
|
|
63984
64045
|
this.waitingAck = false;
|
|
63985
64046
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
63986
|
-
const
|
|
63987
|
-
|
|
63988
|
-
if (firstTransformedRevisionIndex !== -1) {
|
|
64047
|
+
const firstPendingRevisionId = this.pendingMessages.findIndex((message) => message.type === "REMOTE_REVISION");
|
|
64048
|
+
if (firstPendingRevisionId !== -1) {
|
|
63989
64049
|
/**
|
|
63990
64050
|
* Some revisions undergo transformations that may cause issues with
|
|
63991
64051
|
* undo/redo if the transformation is destructive (we don't get back
|
|
63992
64052
|
* the original command by transforming it with the inverse).
|
|
63993
|
-
* To prevent these problems, we must
|
|
64053
|
+
* To prevent these problems, we must rebase all subsequent local
|
|
63994
64054
|
* revisions.
|
|
63995
64055
|
*/
|
|
63996
|
-
this.
|
|
63997
|
-
this.pendingMessages = this.pendingMessages.slice(0, firstTransformedRevisionIndex);
|
|
64056
|
+
this.revisions.rebase(this.pendingMessages[firstPendingRevisionId].nextRevisionId);
|
|
63998
64057
|
}
|
|
63999
64058
|
this.serverRevisionId = message.nextRevisionId;
|
|
64000
64059
|
this.processedRevisions.add(message.nextRevisionId);
|
|
@@ -65116,6 +65175,10 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
65116
65175
|
*/
|
|
65117
65176
|
checkZonesAreInSheet(cmd) {
|
|
65118
65177
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
65178
|
+
if ("ranges" in cmd &&
|
|
65179
|
+
cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
65180
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
65181
|
+
}
|
|
65119
65182
|
const zones = this.getters.getCommandZones(cmd);
|
|
65120
65183
|
if (!sheetId && zones.length > 0) {
|
|
65121
65184
|
return "NoActiveSheet" /* CommandResult.NoActiveSheet */;
|
|
@@ -65670,7 +65733,6 @@ class HistoryPlugin extends UIPlugin {
|
|
|
65670
65733
|
super(config);
|
|
65671
65734
|
this.session = config.session;
|
|
65672
65735
|
this.session.on("new-local-state-update", this, this.onNewLocalStateUpdate);
|
|
65673
|
-
this.session.on("pending-revisions-dropped", this, ({ revisionIds }) => this.drop(revisionIds));
|
|
65674
65736
|
this.session.on("snapshot", this, () => {
|
|
65675
65737
|
this.undoStack = [];
|
|
65676
65738
|
this.redoStack = [];
|
|
@@ -65740,10 +65802,6 @@ class HistoryPlugin extends UIPlugin {
|
|
|
65740
65802
|
const lastNonRedoRevision = this.getPossibleRevisionToRepeat();
|
|
65741
65803
|
return canRepeatRevision(lastNonRedoRevision);
|
|
65742
65804
|
}
|
|
65743
|
-
drop(revisionIds) {
|
|
65744
|
-
this.undoStack = this.undoStack.filter((id) => !revisionIds.includes(id));
|
|
65745
|
-
this.redoStack = [];
|
|
65746
|
-
}
|
|
65747
65805
|
onNewLocalStateUpdate({ id }) {
|
|
65748
65806
|
this.undoStack.push(id);
|
|
65749
65807
|
this.redoStack = [];
|
|
@@ -68418,7 +68476,9 @@ class HeaderPositionsUIPlugin extends UIPlugin {
|
|
|
68418
68476
|
case "UNGROUP_HEADERS":
|
|
68419
68477
|
case "GROUP_HEADERS":
|
|
68420
68478
|
case "CREATE_SHEET":
|
|
68421
|
-
this.
|
|
68479
|
+
if (this.getters.tryGetSheet(cmd.sheetId)) {
|
|
68480
|
+
this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
|
|
68481
|
+
}
|
|
68422
68482
|
break;
|
|
68423
68483
|
case "DUPLICATE_SHEET":
|
|
68424
68484
|
this.headerPositions[cmd.sheetIdTo] = deepCopy(this.headerPositions[cmd.sheetId]);
|
|
@@ -68426,12 +68486,14 @@ class HeaderPositionsUIPlugin extends UIPlugin {
|
|
|
68426
68486
|
}
|
|
68427
68487
|
}
|
|
68428
68488
|
finalize() {
|
|
68429
|
-
|
|
68430
|
-
|
|
68489
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
68490
|
+
// sheets can be created without this plugin being aware of it
|
|
68491
|
+
// in concurrent situations.
|
|
68492
|
+
if (this.isDirty || !this.headerPositions[sheetId]) {
|
|
68431
68493
|
this.headerPositions[sheetId] = this.computeHeaderPositionsOfSheet(sheetId);
|
|
68432
68494
|
}
|
|
68433
|
-
this.isDirty = false;
|
|
68434
68495
|
}
|
|
68496
|
+
this.isDirty = false;
|
|
68435
68497
|
}
|
|
68436
68498
|
/**
|
|
68437
68499
|
* Returns the size, start and end coordinates of a column on an unfolded sheet
|
|
@@ -70272,6 +70334,10 @@ const FX_SVG = /*xml*/ `
|
|
|
70272
70334
|
</svg>
|
|
70273
70335
|
`;
|
|
70274
70336
|
css /* scss */ `
|
|
70337
|
+
.o-topbar-composer-container {
|
|
70338
|
+
height: ${TOPBAR_TOOLBAR_HEIGHT}px;
|
|
70339
|
+
}
|
|
70340
|
+
|
|
70275
70341
|
.o-topbar-composer {
|
|
70276
70342
|
height: fit-content;
|
|
70277
70343
|
margin-top: -1px;
|
|
@@ -71835,9 +71901,16 @@ class SelectiveHistory {
|
|
|
71835
71901
|
this.fastForward();
|
|
71836
71902
|
this.insert(redoId, this.buildEmpty(redoId), insertAfter);
|
|
71837
71903
|
}
|
|
71838
|
-
|
|
71904
|
+
rebase(operationId) {
|
|
71905
|
+
const operation = this.get(operationId);
|
|
71906
|
+
const execution = [...this.tree.execution(this.HEAD_BRANCH).startAfter(operationId)];
|
|
71839
71907
|
this.revertBefore(operationId);
|
|
71908
|
+
const baseId = this.HEAD_OPERATION.id;
|
|
71840
71909
|
this.tree.drop(operationId);
|
|
71910
|
+
this.insert(operationId, operation, baseId);
|
|
71911
|
+
for (const { operation } of execution) {
|
|
71912
|
+
this.insert(operation.id, operation.data, this.HEAD_OPERATION.id);
|
|
71913
|
+
}
|
|
71841
71914
|
}
|
|
71842
71915
|
/**
|
|
71843
71916
|
* Revert the state as it was *before* the given operation was executed.
|
|
@@ -74965,6 +75038,11 @@ class Model extends EventBus {
|
|
|
74965
75038
|
dispatch: (command) => {
|
|
74966
75039
|
const result = this.checkDispatchAllowed(command);
|
|
74967
75040
|
if (!result.isSuccessful) {
|
|
75041
|
+
// core views plugins need to be invalidated
|
|
75042
|
+
this.dispatchToHandlers(this.coreHandlers, {
|
|
75043
|
+
type: "UNDO",
|
|
75044
|
+
commands: [command],
|
|
75045
|
+
});
|
|
74968
75046
|
return;
|
|
74969
75047
|
}
|
|
74970
75048
|
this.isReplayingCommand = true;
|
|
@@ -75486,6 +75564,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
75486
75564
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
75487
75565
|
|
|
75488
75566
|
|
|
75489
|
-
__info__.version = "18.
|
|
75490
|
-
__info__.date = "2025-02-
|
|
75491
|
-
__info__.hash = "
|
|
75567
|
+
__info__.version = "18.3.0-alpha.0";
|
|
75568
|
+
__info__.date = "2025-02-18T09:02:28.625Z";
|
|
75569
|
+
__info__.hash = "9b88da0";
|