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