@odoo/o-spreadsheet 17.4.32 → 17.4.34
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 +212 -86
- package/dist/o-spreadsheet.d.ts +32 -18
- package/dist/o-spreadsheet.esm.js +212 -86
- package/dist/o-spreadsheet.iife.js +212 -86
- package/dist/o-spreadsheet.iife.min.js +349 -350
- package/dist/o_spreadsheet.xml +65 -56
- 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.4.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.34
|
|
6
|
+
* @date 2025-05-12T05:23:37.387Z
|
|
7
|
+
* @hash e3ac48a
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -2360,6 +2360,7 @@ var CommandResult;
|
|
|
2360
2360
|
CommandResult["InvalidTableResize"] = "InvalidTableResize";
|
|
2361
2361
|
CommandResult["PivotIdNotFound"] = "PivotIdNotFound";
|
|
2362
2362
|
CommandResult["EmptyName"] = "EmptyName";
|
|
2363
|
+
CommandResult["InvalidPivotDataSet"] = "InvalidPivotDataSet";
|
|
2363
2364
|
})(CommandResult || (CommandResult = {}));
|
|
2364
2365
|
|
|
2365
2366
|
const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
|
|
@@ -5189,6 +5190,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
5189
5190
|
})
|
|
5190
5191
|
.filter(isDefined);
|
|
5191
5192
|
}
|
|
5193
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
5194
|
+
let i = 1;
|
|
5195
|
+
let name = `${baseName}${i}`;
|
|
5196
|
+
while (existingNames.includes(name)) {
|
|
5197
|
+
name = `${baseName}${i}`;
|
|
5198
|
+
i++;
|
|
5199
|
+
}
|
|
5200
|
+
return name;
|
|
5201
|
+
}
|
|
5202
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
5203
|
+
let i = 1;
|
|
5204
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
5205
|
+
let name = baseName.toString();
|
|
5206
|
+
while (existingNames.includes(name)) {
|
|
5207
|
+
name = `${baseName} (${i})`;
|
|
5208
|
+
i++;
|
|
5209
|
+
}
|
|
5210
|
+
return name;
|
|
5211
|
+
}
|
|
5192
5212
|
|
|
5193
5213
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
5194
5214
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -6392,6 +6412,24 @@ const monthNumberAdapter = {
|
|
|
6392
6412
|
return `${normalizedValue}`;
|
|
6393
6413
|
},
|
|
6394
6414
|
};
|
|
6415
|
+
/**
|
|
6416
|
+
* normalizes month number + year
|
|
6417
|
+
*/
|
|
6418
|
+
const monthAdapter = {
|
|
6419
|
+
normalizeFunctionValue(value) {
|
|
6420
|
+
const date = toNumber(value, DEFAULT_LOCALE);
|
|
6421
|
+
return formatValue(date, { locale: DEFAULT_LOCALE, format: "mm/yyyy" });
|
|
6422
|
+
},
|
|
6423
|
+
toValueAndFormat(normalizedValue) {
|
|
6424
|
+
return {
|
|
6425
|
+
value: toNumber(normalizedValue, DEFAULT_LOCALE),
|
|
6426
|
+
format: "mmmm yyyy",
|
|
6427
|
+
};
|
|
6428
|
+
},
|
|
6429
|
+
toFunctionValue(normalizedValue) {
|
|
6430
|
+
return `"${normalizedValue}"`;
|
|
6431
|
+
},
|
|
6432
|
+
};
|
|
6395
6433
|
/**
|
|
6396
6434
|
* normalizes quarter number
|
|
6397
6435
|
*/
|
|
@@ -6459,6 +6497,7 @@ pivotTimeAdapterRegistry
|
|
|
6459
6497
|
.add("day_of_month", nullHandlerDecorator(dayOfMonthAdapter))
|
|
6460
6498
|
.add("iso_week_number", nullHandlerDecorator(isoWeekNumberAdapter))
|
|
6461
6499
|
.add("month_number", nullHandlerDecorator(monthNumberAdapter))
|
|
6500
|
+
.add("month", nullHandlerDecorator(monthAdapter))
|
|
6462
6501
|
.add("quarter_number", nullHandlerDecorator(quarterNumberAdapter));
|
|
6463
6502
|
|
|
6464
6503
|
const AGGREGATOR_NAMES = {
|
|
@@ -6639,10 +6678,7 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
6639
6678
|
return normalizer(groupValueString, dimension.granularity);
|
|
6640
6679
|
}
|
|
6641
6680
|
function normalizeDateTime(value, granularity) {
|
|
6642
|
-
|
|
6643
|
-
throw new Error("Missing granularity");
|
|
6644
|
-
}
|
|
6645
|
-
return pivotTimeAdapter(granularity).normalizeFunctionValue(value);
|
|
6681
|
+
return pivotTimeAdapter(granularity ?? "month").normalizeFunctionValue(value);
|
|
6646
6682
|
}
|
|
6647
6683
|
function toFunctionPivotValue(value, dimension) {
|
|
6648
6684
|
if (value === null) {
|
|
@@ -6654,10 +6690,7 @@ function toFunctionPivotValue(value, dimension) {
|
|
|
6654
6690
|
return pivotToFunctionValueRegistry.get(dimension.type)(value, dimension.granularity);
|
|
6655
6691
|
}
|
|
6656
6692
|
function toFunctionValueDateTime(value, granularity) {
|
|
6657
|
-
|
|
6658
|
-
throw new Error("Missing granularity");
|
|
6659
|
-
}
|
|
6660
|
-
return pivotTimeAdapter(granularity).toFunctionValue(value);
|
|
6693
|
+
return pivotTimeAdapter(granularity ?? "month").toFunctionValue(value);
|
|
6661
6694
|
}
|
|
6662
6695
|
const pivotNormalizationValueRegistry = new Registry();
|
|
6663
6696
|
pivotNormalizationValueRegistry
|
|
@@ -12241,6 +12274,7 @@ class ChartJsComponent extends Component {
|
|
|
12241
12274
|
canvas = useRef("graphContainer");
|
|
12242
12275
|
chart;
|
|
12243
12276
|
currentRuntime;
|
|
12277
|
+
currentDevicePixelRatio = window.devicePixelRatio;
|
|
12244
12278
|
get background() {
|
|
12245
12279
|
return this.chartRuntime.background;
|
|
12246
12280
|
}
|
|
@@ -12274,11 +12308,11 @@ class ChartJsComponent extends Component {
|
|
|
12274
12308
|
}
|
|
12275
12309
|
this.currentRuntime = runtime;
|
|
12276
12310
|
}
|
|
12311
|
+
else if (this.currentDevicePixelRatio !== window.devicePixelRatio) {
|
|
12312
|
+
this.currentDevicePixelRatio = window.devicePixelRatio;
|
|
12313
|
+
this.updateChartJs(deepCopy(this.currentRuntime));
|
|
12314
|
+
}
|
|
12277
12315
|
});
|
|
12278
|
-
useEffect(() => {
|
|
12279
|
-
this.currentRuntime = this.chartRuntime;
|
|
12280
|
-
this.updateChartJs(deepCopy(this.currentRuntime));
|
|
12281
|
-
}, () => [window.devicePixelRatio]);
|
|
12282
12316
|
}
|
|
12283
12317
|
createChart(chartData) {
|
|
12284
12318
|
const canvas = this.canvas.el;
|
|
@@ -19380,7 +19414,7 @@ const IF = {
|
|
|
19380
19414
|
return { value: "" };
|
|
19381
19415
|
}
|
|
19382
19416
|
if (result.value === null) {
|
|
19383
|
-
result
|
|
19417
|
+
return { ...result, value: "" };
|
|
19384
19418
|
}
|
|
19385
19419
|
return result;
|
|
19386
19420
|
},
|
|
@@ -19401,7 +19435,7 @@ const IFERROR = {
|
|
|
19401
19435
|
return { value: "" };
|
|
19402
19436
|
}
|
|
19403
19437
|
if (result.value === null) {
|
|
19404
|
-
result
|
|
19438
|
+
return { ...result, value: "" };
|
|
19405
19439
|
}
|
|
19406
19440
|
return result;
|
|
19407
19441
|
},
|
|
@@ -19422,7 +19456,7 @@ const IFNA = {
|
|
|
19422
19456
|
return { value: "" };
|
|
19423
19457
|
}
|
|
19424
19458
|
if (result.value === null) {
|
|
19425
|
-
result
|
|
19459
|
+
return { ...result, value: "" };
|
|
19426
19460
|
}
|
|
19427
19461
|
return result;
|
|
19428
19462
|
},
|
|
@@ -19448,7 +19482,7 @@ const IFS = {
|
|
|
19448
19482
|
return { value: "" };
|
|
19449
19483
|
}
|
|
19450
19484
|
if (result.value === null) {
|
|
19451
|
-
result
|
|
19485
|
+
return { ...result, value: "" };
|
|
19452
19486
|
}
|
|
19453
19487
|
return result;
|
|
19454
19488
|
}
|
|
@@ -22619,10 +22653,13 @@ const duplicateSheet = {
|
|
|
22619
22653
|
name: _t("Duplicate"),
|
|
22620
22654
|
execute: (env) => {
|
|
22621
22655
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
22656
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
22622
22657
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
22658
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
22623
22659
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
22624
22660
|
sheetId: sheetIdFrom,
|
|
22625
22661
|
sheetIdTo,
|
|
22662
|
+
sheetNameTo,
|
|
22626
22663
|
});
|
|
22627
22664
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
22628
22665
|
},
|
|
@@ -22740,18 +22777,28 @@ linkMenuRegistry.add("sheet", {
|
|
|
22740
22777
|
function useInterval(callback, delay) {
|
|
22741
22778
|
let intervalId;
|
|
22742
22779
|
const { setInterval, clearInterval } = window;
|
|
22780
|
+
const pause = () => {
|
|
22781
|
+
clearInterval(intervalId);
|
|
22782
|
+
intervalId = undefined;
|
|
22783
|
+
};
|
|
22784
|
+
const safeCallback = () => {
|
|
22785
|
+
try {
|
|
22786
|
+
callback();
|
|
22787
|
+
}
|
|
22788
|
+
catch (e) {
|
|
22789
|
+
pause();
|
|
22790
|
+
throw e;
|
|
22791
|
+
}
|
|
22792
|
+
};
|
|
22743
22793
|
useEffect(() => {
|
|
22744
|
-
intervalId = setInterval(
|
|
22794
|
+
intervalId = setInterval(safeCallback, delay);
|
|
22745
22795
|
return () => clearInterval(intervalId);
|
|
22746
22796
|
}, () => [delay]);
|
|
22747
22797
|
return {
|
|
22748
|
-
pause
|
|
22749
|
-
clearInterval(intervalId);
|
|
22750
|
-
intervalId = undefined;
|
|
22751
|
-
},
|
|
22798
|
+
pause,
|
|
22752
22799
|
resume: () => {
|
|
22753
22800
|
if (intervalId === undefined) {
|
|
22754
|
-
intervalId = setInterval(
|
|
22801
|
+
intervalId = setInterval(safeCallback, delay);
|
|
22755
22802
|
}
|
|
22756
22803
|
},
|
|
22757
22804
|
};
|
|
@@ -24057,6 +24104,13 @@ class Composer extends Component {
|
|
|
24057
24104
|
this.props.onInputContextMenu?.(ev);
|
|
24058
24105
|
}
|
|
24059
24106
|
}
|
|
24107
|
+
onWheel(event) {
|
|
24108
|
+
// detect if scrollbar is available
|
|
24109
|
+
if (this.composerRef.el &&
|
|
24110
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
24111
|
+
event.stopPropagation();
|
|
24112
|
+
}
|
|
24113
|
+
}
|
|
24060
24114
|
// ---------------------------------------------------------------------------
|
|
24061
24115
|
// Private
|
|
24062
24116
|
// ---------------------------------------------------------------------------
|
|
@@ -25334,9 +25388,6 @@ class BarChart extends AbstractChart {
|
|
|
25334
25388
|
};
|
|
25335
25389
|
}
|
|
25336
25390
|
getDefinitionForExcel() {
|
|
25337
|
-
// Excel does not support aggregating labels
|
|
25338
|
-
if (this.aggregated)
|
|
25339
|
-
return undefined;
|
|
25340
25391
|
const dataSets = this.dataSets
|
|
25341
25392
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
25342
25393
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -26413,9 +26464,6 @@ class LineChart extends AbstractChart {
|
|
|
26413
26464
|
return new LineChart(definition, this.sheetId, this.getters);
|
|
26414
26465
|
}
|
|
26415
26466
|
getDefinitionForExcel() {
|
|
26416
|
-
// Excel does not support aggregating labels
|
|
26417
|
-
if (this.aggregated)
|
|
26418
|
-
return undefined;
|
|
26419
26467
|
const dataSets = this.dataSets
|
|
26420
26468
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
26421
26469
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -26526,9 +26574,6 @@ class PieChart extends AbstractChart {
|
|
|
26526
26574
|
return new PieChart(definition, sheetId, this.getters);
|
|
26527
26575
|
}
|
|
26528
26576
|
getDefinitionForExcel() {
|
|
26529
|
-
// Excel does not support aggregating labels
|
|
26530
|
-
if (this.aggregated)
|
|
26531
|
-
return undefined;
|
|
26532
26577
|
const dataSets = this.dataSets
|
|
26533
26578
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
26534
26579
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -29354,7 +29399,7 @@ const FIX_FORMULAS = {
|
|
|
29354
29399
|
if (!pivot.isValid()) {
|
|
29355
29400
|
return;
|
|
29356
29401
|
}
|
|
29357
|
-
env.model.dispatch("
|
|
29402
|
+
env.model.dispatch("SPLIT_PIVOT_FORMULA", {
|
|
29358
29403
|
sheetId,
|
|
29359
29404
|
col,
|
|
29360
29405
|
row,
|
|
@@ -36988,8 +37033,8 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
36988
37033
|
|
|
36989
37034
|
const NULL_SYMBOL = Symbol("NULL");
|
|
36990
37035
|
function createDate(dimension, value, locale) {
|
|
36991
|
-
const granularity = dimension.granularity;
|
|
36992
|
-
if (!
|
|
37036
|
+
const granularity = dimension.granularity || "month";
|
|
37037
|
+
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
36993
37038
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
36994
37039
|
}
|
|
36995
37040
|
const keyInMap = typeof value === "number" || typeof value === "string" ? value : NULL_SYMBOL;
|
|
@@ -37008,6 +37053,9 @@ function createDate(dimension, value, locale) {
|
|
|
37008
37053
|
case "month_number":
|
|
37009
37054
|
number = date.getMonth() + 1;
|
|
37010
37055
|
break;
|
|
37056
|
+
case "month":
|
|
37057
|
+
number = Math.floor(toNumber(value, locale));
|
|
37058
|
+
break;
|
|
37011
37059
|
case "iso_week_number":
|
|
37012
37060
|
number = date.getIsoWeek();
|
|
37013
37061
|
break;
|
|
@@ -37066,6 +37114,10 @@ const MAP_VALUE_DIMENSION_DATE = {
|
|
|
37066
37114
|
set: new Set(),
|
|
37067
37115
|
values: {},
|
|
37068
37116
|
},
|
|
37117
|
+
month: {
|
|
37118
|
+
set: new Set(),
|
|
37119
|
+
values: {},
|
|
37120
|
+
},
|
|
37069
37121
|
iso_week_number: {
|
|
37070
37122
|
set: new Set(),
|
|
37071
37123
|
values: {},
|
|
@@ -37242,7 +37294,7 @@ class SpreadsheetPivot {
|
|
|
37242
37294
|
const cells = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
37243
37295
|
const finalCell = cells[0]?.[dimension.nameWithGranularity];
|
|
37244
37296
|
if (dimension.type === "date") {
|
|
37245
|
-
const adapter = pivotTimeAdapter(dimension.granularity);
|
|
37297
|
+
const adapter = pivotTimeAdapter((dimension.granularity || "month"));
|
|
37246
37298
|
return adapter.toValueAndFormat(lastNode.value, this.getters.getLocale());
|
|
37247
37299
|
}
|
|
37248
37300
|
if (!finalCell) {
|
|
@@ -37327,7 +37379,7 @@ class SpreadsheetPivot {
|
|
|
37327
37379
|
if (nonEmptyCells.length === 0) {
|
|
37328
37380
|
return "integer";
|
|
37329
37381
|
}
|
|
37330
|
-
if (nonEmptyCells.every((cell) => cell.format && isDateTimeFormat(cell.format))) {
|
|
37382
|
+
if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) {
|
|
37331
37383
|
return "date";
|
|
37332
37384
|
}
|
|
37333
37385
|
if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) {
|
|
@@ -37442,6 +37494,7 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
37442
37494
|
"year",
|
|
37443
37495
|
"quarter_number",
|
|
37444
37496
|
"month_number",
|
|
37497
|
+
"month",
|
|
37445
37498
|
"iso_week_number",
|
|
37446
37499
|
"day_of_month",
|
|
37447
37500
|
"day",
|
|
@@ -37651,7 +37704,7 @@ class PivotSidePanelStore extends SpreadsheetStore {
|
|
|
37651
37704
|
granularitiesPerFields[field.name] = new Set(granularities);
|
|
37652
37705
|
}
|
|
37653
37706
|
for (const field of dateFields) {
|
|
37654
|
-
granularitiesPerFields[field.name].delete(field.granularity);
|
|
37707
|
+
granularitiesPerFields[field.name].delete(field.granularity || "month");
|
|
37655
37708
|
}
|
|
37656
37709
|
return granularitiesPerFields;
|
|
37657
37710
|
}
|
|
@@ -39538,12 +39591,15 @@ class GridComposer extends Component {
|
|
|
39538
39591
|
});
|
|
39539
39592
|
}
|
|
39540
39593
|
get composerProps() {
|
|
39594
|
+
// Remove the wrapper border width
|
|
39595
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
39541
39596
|
return {
|
|
39542
39597
|
focus: this.composerFocusStore.gridComposerFocus,
|
|
39543
39598
|
isDefaultFocus: true,
|
|
39544
39599
|
onComposerContentFocused: () => this.composerFocusStore.focusGridComposerContent(),
|
|
39545
39600
|
onComposerCellFocused: (content) => this.composerFocusStore.focusGridComposerCell(content),
|
|
39546
39601
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
39602
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
39547
39603
|
};
|
|
39548
39604
|
}
|
|
39549
39605
|
get containerStyle() {
|
|
@@ -40998,7 +41054,7 @@ css /* scss */ `
|
|
|
40998
41054
|
position: absolute;
|
|
40999
41055
|
top: 0;
|
|
41000
41056
|
left: ${HEADER_WIDTH}px;
|
|
41001
|
-
right:
|
|
41057
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
41002
41058
|
height: ${HEADER_HEIGHT}px;
|
|
41003
41059
|
&.o-dragging {
|
|
41004
41060
|
cursor: grabbing;
|
|
@@ -41164,9 +41220,8 @@ css /* scss */ `
|
|
|
41164
41220
|
position: absolute;
|
|
41165
41221
|
top: ${HEADER_HEIGHT}px;
|
|
41166
41222
|
left: 0;
|
|
41167
|
-
|
|
41223
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
41168
41224
|
width: ${HEADER_WIDTH}px;
|
|
41169
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
41170
41225
|
&.o-dragging {
|
|
41171
41226
|
cursor: grabbing;
|
|
41172
41227
|
}
|
|
@@ -47301,6 +47356,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
47301
47356
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
47302
47357
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
47303
47358
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
47359
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
47304
47360
|
return initialMessages;
|
|
47305
47361
|
}
|
|
47306
47362
|
/**
|
|
@@ -47420,6 +47476,40 @@ function fixOverlappingFilters(data) {
|
|
|
47420
47476
|
}
|
|
47421
47477
|
return data;
|
|
47422
47478
|
}
|
|
47479
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
47480
|
+
const sheetNames = {};
|
|
47481
|
+
for (const sheet of data.sheets || []) {
|
|
47482
|
+
sheetNames[sheet.id] = sheet.name;
|
|
47483
|
+
}
|
|
47484
|
+
const messages = [];
|
|
47485
|
+
for (const message of initialMessages) {
|
|
47486
|
+
if (message.type === "REMOTE_REVISION") {
|
|
47487
|
+
const commands = [];
|
|
47488
|
+
for (const cmd of message.commands) {
|
|
47489
|
+
switch (cmd.type) {
|
|
47490
|
+
case "DUPLICATE_SHEET":
|
|
47491
|
+
cmd.sheetNameTo =
|
|
47492
|
+
cmd.sheetNameTo ??
|
|
47493
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
47494
|
+
break;
|
|
47495
|
+
case "CREATE_SHEET":
|
|
47496
|
+
case "RENAME_SHEET":
|
|
47497
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
47498
|
+
break;
|
|
47499
|
+
}
|
|
47500
|
+
commands.push(cmd);
|
|
47501
|
+
}
|
|
47502
|
+
messages.push({
|
|
47503
|
+
...message,
|
|
47504
|
+
commands,
|
|
47505
|
+
});
|
|
47506
|
+
}
|
|
47507
|
+
else {
|
|
47508
|
+
messages.push(message);
|
|
47509
|
+
}
|
|
47510
|
+
}
|
|
47511
|
+
return initialMessages;
|
|
47512
|
+
}
|
|
47423
47513
|
// -----------------------------------------------------------------------------
|
|
47424
47514
|
// Helpers
|
|
47425
47515
|
// -----------------------------------------------------------------------------
|
|
@@ -48955,9 +49045,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
48955
49045
|
: "Success" /* CommandResult.Success */;
|
|
48956
49046
|
}
|
|
48957
49047
|
checkChartExists(cmd) {
|
|
48958
|
-
return this.
|
|
48959
|
-
? "Success" /* CommandResult.Success */
|
|
48960
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
49048
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
48961
49049
|
}
|
|
48962
49050
|
}
|
|
48963
49051
|
|
|
@@ -51134,6 +51222,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
51134
51222
|
"getCommandZones",
|
|
51135
51223
|
"getUnboundedZone",
|
|
51136
51224
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
51225
|
+
"getDuplicateSheetName",
|
|
51137
51226
|
];
|
|
51138
51227
|
sheetIdsMapName = {};
|
|
51139
51228
|
orderedSheetIds = [];
|
|
@@ -51158,7 +51247,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
51158
51247
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
51159
51248
|
}
|
|
51160
51249
|
case "DUPLICATE_SHEET": {
|
|
51161
|
-
|
|
51250
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
51251
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
51252
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
51253
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
51254
|
+
return "Success" /* CommandResult.Success */;
|
|
51162
51255
|
}
|
|
51163
51256
|
case "MOVE_SHEET":
|
|
51164
51257
|
try {
|
|
@@ -51228,7 +51321,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
51228
51321
|
this.showSheet(cmd.sheetId);
|
|
51229
51322
|
break;
|
|
51230
51323
|
case "DUPLICATE_SHEET":
|
|
51231
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
51324
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
51232
51325
|
break;
|
|
51233
51326
|
case "DELETE_SHEET":
|
|
51234
51327
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -51428,14 +51521,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
51428
51521
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
51429
51522
|
}
|
|
51430
51523
|
getNextSheetName(baseName = "Sheet") {
|
|
51431
|
-
let i = 1;
|
|
51432
51524
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
51433
|
-
|
|
51434
|
-
while (names.includes(name)) {
|
|
51435
|
-
name = `${baseName}${i}`;
|
|
51436
|
-
i++;
|
|
51437
|
-
}
|
|
51438
|
-
return name;
|
|
51525
|
+
return getNextSheetName(names, baseName);
|
|
51439
51526
|
}
|
|
51440
51527
|
getSheetSize(sheetId) {
|
|
51441
51528
|
return {
|
|
@@ -51681,9 +51768,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
51681
51768
|
showSheet(sheetId) {
|
|
51682
51769
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
51683
51770
|
}
|
|
51684
|
-
duplicateSheet(fromId, toId) {
|
|
51771
|
+
duplicateSheet(fromId, toId, toName) {
|
|
51685
51772
|
const sheet = this.getSheet(fromId);
|
|
51686
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
51687
51773
|
const newSheet = deepCopy(sheet);
|
|
51688
51774
|
newSheet.id = toId;
|
|
51689
51775
|
newSheet.name = toName;
|
|
@@ -51715,15 +51801,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
51715
51801
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
51716
51802
|
}
|
|
51717
51803
|
getDuplicateSheetName(sheetName) {
|
|
51718
|
-
let i = 1;
|
|
51719
51804
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
51720
|
-
|
|
51721
|
-
let name = baseName.toString();
|
|
51722
|
-
while (names.includes(name)) {
|
|
51723
|
-
name = `${baseName} (${i})`;
|
|
51724
|
-
i++;
|
|
51725
|
-
}
|
|
51726
|
-
return name;
|
|
51805
|
+
return getDuplicateSheetName(sheetName, names);
|
|
51727
51806
|
}
|
|
51728
51807
|
deleteSheet(sheet) {
|
|
51729
51808
|
const name = sheet.name;
|
|
@@ -53131,6 +53210,15 @@ function adaptPivotRange(range, applyChange) {
|
|
|
53131
53210
|
}
|
|
53132
53211
|
}
|
|
53133
53212
|
class SpreadsheetPivotCorePlugin extends CorePlugin {
|
|
53213
|
+
allowDispatch(cmd) {
|
|
53214
|
+
switch (cmd.type) {
|
|
53215
|
+
case "ADD_PIVOT":
|
|
53216
|
+
case "UPDATE_PIVOT":
|
|
53217
|
+
const definition = cmd.pivot;
|
|
53218
|
+
return this.checkDataSetValidity(definition);
|
|
53219
|
+
}
|
|
53220
|
+
return "Success" /* CommandResult.Success */;
|
|
53221
|
+
}
|
|
53134
53222
|
adaptRanges(applyChange) {
|
|
53135
53223
|
for (const pivotId of this.getters.getPivotIds()) {
|
|
53136
53224
|
const definition = this.getters.getPivotCoreDefinition(pivotId);
|
|
@@ -53149,6 +53237,16 @@ class SpreadsheetPivotCorePlugin extends CorePlugin {
|
|
|
53149
53237
|
}
|
|
53150
53238
|
}
|
|
53151
53239
|
}
|
|
53240
|
+
checkDataSetValidity(definition) {
|
|
53241
|
+
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53242
|
+
const { zone, sheetId } = definition.dataSet;
|
|
53243
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) {
|
|
53244
|
+
return "InvalidDataSet" /* CommandResult.InvalidDataSet */;
|
|
53245
|
+
}
|
|
53246
|
+
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53247
|
+
}
|
|
53248
|
+
return "Success" /* CommandResult.Success */;
|
|
53249
|
+
}
|
|
53152
53250
|
}
|
|
53153
53251
|
|
|
53154
53252
|
class TableStylePlugin extends CorePlugin {
|
|
@@ -54503,8 +54601,8 @@ class SpreadingRelation {
|
|
|
54503
54601
|
const EMPTY_ARRAY = [];
|
|
54504
54602
|
|
|
54505
54603
|
const MAX_ITERATION = 30;
|
|
54506
|
-
const ERROR_CYCLE_CELL = createEvaluatedCell(new CircularDependencyError());
|
|
54507
|
-
const EMPTY_CELL = createEvaluatedCell({ value: null });
|
|
54604
|
+
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
54605
|
+
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
54508
54606
|
class Evaluator {
|
|
54509
54607
|
context;
|
|
54510
54608
|
getters;
|
|
@@ -55984,7 +56082,7 @@ class DynamicTablesPlugin extends UIPlugin {
|
|
|
55984
56082
|
tables = {};
|
|
55985
56083
|
handle(cmd) {
|
|
55986
56084
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
55987
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd) ||
|
|
56085
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
|
|
55988
56086
|
cmd.type === "EVALUATE_CELLS") {
|
|
55989
56087
|
this.tables = {};
|
|
55990
56088
|
return;
|
|
@@ -58566,6 +58664,8 @@ class InsertPivotPlugin extends UIPlugin {
|
|
|
58566
58664
|
case "INSERT_PIVOT_WITH_TABLE":
|
|
58567
58665
|
this.insertPivotWithTable(cmd.sheetId, cmd.col, cmd.row, cmd.pivotId, cmd.table, cmd.pivotMode);
|
|
58568
58666
|
break;
|
|
58667
|
+
case "SPLIT_PIVOT_FORMULA":
|
|
58668
|
+
this.splitPivotFormula(cmd.sheetId, cmd.col, cmd.row, cmd.pivotId, cmd.table);
|
|
58569
58669
|
}
|
|
58570
58670
|
}
|
|
58571
58671
|
insertNewPivot(pivotId, sheetId) {
|
|
@@ -58713,6 +58813,36 @@ class InsertPivotPlugin extends UIPlugin {
|
|
|
58713
58813
|
});
|
|
58714
58814
|
}
|
|
58715
58815
|
}
|
|
58816
|
+
splitPivotFormula(sheetId, col, row, pivotId, pivotTableData) {
|
|
58817
|
+
this.dispatch("INSERT_PIVOT", {
|
|
58818
|
+
sheetId,
|
|
58819
|
+
col,
|
|
58820
|
+
row,
|
|
58821
|
+
pivotId,
|
|
58822
|
+
table: pivotTableData,
|
|
58823
|
+
});
|
|
58824
|
+
const table = this.getters.getCoreTable({ sheetId, col, row });
|
|
58825
|
+
if (table?.type === "dynamic") {
|
|
58826
|
+
const zone = positionToZone({ col, row });
|
|
58827
|
+
const { cols, rows, measures, fieldsType } = pivotTableData;
|
|
58828
|
+
const pivotTable = new SpreadsheetPivotTable(cols, rows, measures, fieldsType || {});
|
|
58829
|
+
const colNumber = pivotTable.getNumberOfDataColumns() + 1;
|
|
58830
|
+
const rowNumber = pivotTable.columns.length + pivotTable.rows.length;
|
|
58831
|
+
const tableZone = {
|
|
58832
|
+
left: col,
|
|
58833
|
+
top: row,
|
|
58834
|
+
right: col + colNumber - 1,
|
|
58835
|
+
bottom: row + rowNumber - 1,
|
|
58836
|
+
};
|
|
58837
|
+
const rangeData = this.getters.getRangeDataFromZone(sheetId, tableZone);
|
|
58838
|
+
this.dispatch("UPDATE_TABLE", {
|
|
58839
|
+
sheetId,
|
|
58840
|
+
zone,
|
|
58841
|
+
newTableRange: rangeData,
|
|
58842
|
+
tableType: "static",
|
|
58843
|
+
});
|
|
58844
|
+
}
|
|
58845
|
+
}
|
|
58716
58846
|
}
|
|
58717
58847
|
|
|
58718
58848
|
class SortPlugin extends UIPlugin {
|
|
@@ -59121,7 +59251,7 @@ class TableComputedStylePlugin extends UIPlugin {
|
|
|
59121
59251
|
tableStyles = {};
|
|
59122
59252
|
handle(cmd) {
|
|
59123
59253
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
59124
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd) ||
|
|
59254
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
|
|
59125
59255
|
cmd.type === "EVALUATE_CELLS") {
|
|
59126
59256
|
this.tableStyles = {};
|
|
59127
59257
|
return;
|
|
@@ -61092,6 +61222,8 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
61092
61222
|
});
|
|
61093
61223
|
this.selectCell(col, row);
|
|
61094
61224
|
}
|
|
61225
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
61226
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
61095
61227
|
}
|
|
61096
61228
|
/**
|
|
61097
61229
|
* Ensure selections are not outside sheet boundaries.
|
|
@@ -61824,8 +61956,11 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61824
61956
|
case "REMOVE_TABLE":
|
|
61825
61957
|
case "UPDATE_TABLE":
|
|
61826
61958
|
case "UPDATE_FILTER":
|
|
61827
|
-
|
|
61828
|
-
|
|
61959
|
+
case "UNFREEZE_ROWS":
|
|
61960
|
+
case "UNFREEZE_COLUMNS":
|
|
61961
|
+
case "FREEZE_COLUMNS":
|
|
61962
|
+
case "FREEZE_ROWS":
|
|
61963
|
+
case "UNFREEZE_COLUMNS_ROWS":
|
|
61829
61964
|
case "REMOVE_COLUMNS_ROWS":
|
|
61830
61965
|
case "RESIZE_COLUMNS_ROWS":
|
|
61831
61966
|
case "HIDE_COLUMNS_ROWS":
|
|
@@ -61838,11 +61973,9 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61838
61973
|
case "FOLD_HEADER_GROUPS_IN_ZONE":
|
|
61839
61974
|
case "UNFOLD_HEADER_GROUPS_IN_ZONE":
|
|
61840
61975
|
case "UNFOLD_ALL_HEADER_GROUPS":
|
|
61841
|
-
case "FOLD_ALL_HEADER_GROUPS":
|
|
61842
|
-
|
|
61843
|
-
this.sheetsWithDirtyViewports.add(sheetId);
|
|
61976
|
+
case "FOLD_ALL_HEADER_GROUPS":
|
|
61977
|
+
this.sheetsWithDirtyViewports.add(cmd.sheetId);
|
|
61844
61978
|
break;
|
|
61845
|
-
}
|
|
61846
61979
|
case "UPDATE_CELL":
|
|
61847
61980
|
// update cell content or format can change hidden rows because of data filters
|
|
61848
61981
|
if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
|
|
@@ -61858,13 +61991,6 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61858
61991
|
case "ACTIVATE_SHEET":
|
|
61859
61992
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
61860
61993
|
break;
|
|
61861
|
-
case "UNFREEZE_ROWS":
|
|
61862
|
-
case "UNFREEZE_COLUMNS":
|
|
61863
|
-
case "FREEZE_COLUMNS":
|
|
61864
|
-
case "FREEZE_ROWS":
|
|
61865
|
-
case "UNFREEZE_COLUMNS_ROWS":
|
|
61866
|
-
this.resetViewports(this.getters.getActiveSheetId());
|
|
61867
|
-
break;
|
|
61868
61994
|
case "DELETE_SHEET":
|
|
61869
61995
|
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
61870
61996
|
break;
|
|
@@ -63020,7 +63146,7 @@ class AggregateStatisticsStore extends SpreadsheetStore {
|
|
|
63020
63146
|
}
|
|
63021
63147
|
handle(cmd) {
|
|
63022
63148
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
63023
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd)) {
|
|
63149
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
|
|
63024
63150
|
this.isDirty = true;
|
|
63025
63151
|
}
|
|
63026
63152
|
switch (cmd.type) {
|
|
@@ -69344,6 +69470,6 @@ const constants = {
|
|
|
69344
69470
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
|
|
69345
69471
|
|
|
69346
69472
|
|
|
69347
|
-
__info__.version = "17.4.
|
|
69348
|
-
__info__.date = "2025-
|
|
69349
|
-
__info__.hash = "
|
|
69473
|
+
__info__.version = "17.4.34";
|
|
69474
|
+
__info__.date = "2025-05-12T05:23:37.387Z";
|
|
69475
|
+
__info__.hash = "e3ac48a";
|