@odoo/o-spreadsheet 18.1.18 → 18.1.19
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 +165 -62
- package/dist/o-spreadsheet.d.ts +8 -4
- package/dist/o-spreadsheet.esm.js +165 -62
- package/dist/o-spreadsheet.iife.js +165 -62
- package/dist/o-spreadsheet.iife.min.js +379 -379
- package/dist/o_spreadsheet.xml +7 -6
- 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 18.1.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.19
|
|
6
|
+
* @date 2025-05-12T05:26:05.861Z
|
|
7
|
+
* @hash 44cc170
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -6273,6 +6273,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
6273
6273
|
})
|
|
6274
6274
|
.filter(isDefined);
|
|
6275
6275
|
}
|
|
6276
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6277
|
+
let i = 1;
|
|
6278
|
+
let name = `${baseName}${i}`;
|
|
6279
|
+
while (existingNames.includes(name)) {
|
|
6280
|
+
name = `${baseName}${i}`;
|
|
6281
|
+
i++;
|
|
6282
|
+
}
|
|
6283
|
+
return name;
|
|
6284
|
+
}
|
|
6285
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6286
|
+
let i = 1;
|
|
6287
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6288
|
+
let name = baseName.toString();
|
|
6289
|
+
while (existingNames.includes(name)) {
|
|
6290
|
+
name = `${baseName} (${i})`;
|
|
6291
|
+
i++;
|
|
6292
|
+
}
|
|
6293
|
+
return name;
|
|
6294
|
+
}
|
|
6276
6295
|
|
|
6277
6296
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
6278
6297
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -7971,6 +7990,24 @@ const monthNumberAdapter = {
|
|
|
7971
7990
|
return `${normalizedValue}`;
|
|
7972
7991
|
},
|
|
7973
7992
|
};
|
|
7993
|
+
/**
|
|
7994
|
+
* normalizes month number + year
|
|
7995
|
+
*/
|
|
7996
|
+
const monthAdapter = {
|
|
7997
|
+
normalizeFunctionValue(value) {
|
|
7998
|
+
const date = toNumber(value, DEFAULT_LOCALE);
|
|
7999
|
+
return formatValue(date, { locale: DEFAULT_LOCALE, format: "mm/yyyy" });
|
|
8000
|
+
},
|
|
8001
|
+
toValueAndFormat(normalizedValue) {
|
|
8002
|
+
return {
|
|
8003
|
+
value: toNumber(normalizedValue, DEFAULT_LOCALE),
|
|
8004
|
+
format: "mmmm yyyy",
|
|
8005
|
+
};
|
|
8006
|
+
},
|
|
8007
|
+
toFunctionValue(normalizedValue) {
|
|
8008
|
+
return `"${normalizedValue}"`;
|
|
8009
|
+
},
|
|
8010
|
+
};
|
|
7974
8011
|
/**
|
|
7975
8012
|
* normalizes quarter number
|
|
7976
8013
|
*/
|
|
@@ -8101,6 +8138,7 @@ pivotTimeAdapterRegistry
|
|
|
8101
8138
|
.add("day_of_month", nullHandlerDecorator(dayOfMonthAdapter))
|
|
8102
8139
|
.add("iso_week_number", nullHandlerDecorator(isoWeekNumberAdapter))
|
|
8103
8140
|
.add("month_number", nullHandlerDecorator(monthNumberAdapter))
|
|
8141
|
+
.add("month", nullHandlerDecorator(monthAdapter))
|
|
8104
8142
|
.add("quarter_number", nullHandlerDecorator(quarterNumberAdapter))
|
|
8105
8143
|
.add("day_of_week", nullHandlerDecorator(dayOfWeekAdapter))
|
|
8106
8144
|
.add("hour_number", nullHandlerDecorator(hourNumberAdapter))
|
|
@@ -8280,10 +8318,7 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8280
8318
|
return normalizer(groupValueString, dimension.granularity);
|
|
8281
8319
|
}
|
|
8282
8320
|
function normalizeDateTime(value, granularity) {
|
|
8283
|
-
|
|
8284
|
-
throw new Error("Missing granularity");
|
|
8285
|
-
}
|
|
8286
|
-
return pivotTimeAdapter(granularity).normalizeFunctionValue(value);
|
|
8321
|
+
return pivotTimeAdapter(granularity ?? "month").normalizeFunctionValue(value);
|
|
8287
8322
|
}
|
|
8288
8323
|
function toFunctionPivotValue(value, dimension) {
|
|
8289
8324
|
if (value === null) {
|
|
@@ -8295,10 +8330,7 @@ function toFunctionPivotValue(value, dimension) {
|
|
|
8295
8330
|
return pivotToFunctionValueRegistry.get(dimension.type)(value, dimension.granularity);
|
|
8296
8331
|
}
|
|
8297
8332
|
function toFunctionValueDateTime(value, granularity) {
|
|
8298
|
-
|
|
8299
|
-
throw new Error("Missing granularity");
|
|
8300
|
-
}
|
|
8301
|
-
return pivotTimeAdapter(granularity).toFunctionValue(value);
|
|
8333
|
+
return pivotTimeAdapter(granularity ?? "month").toFunctionValue(value);
|
|
8302
8334
|
}
|
|
8303
8335
|
const pivotNormalizationValueRegistry = new Registry();
|
|
8304
8336
|
pivotNormalizationValueRegistry
|
|
@@ -9613,12 +9645,24 @@ class ComposerFocusStore extends SpreadsheetStore {
|
|
|
9613
9645
|
}
|
|
9614
9646
|
|
|
9615
9647
|
const chartJsExtensionRegistry = new Registry();
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9648
|
+
function areChartJSExtensionsLoaded() {
|
|
9649
|
+
return !!window.Chart.registry.plugins.get("chartShowValuesPlugin");
|
|
9650
|
+
}
|
|
9651
|
+
function registerChartJSExtensions() {
|
|
9652
|
+
if (!window.Chart || areChartJSExtensionsLoaded()) {
|
|
9653
|
+
return;
|
|
9654
|
+
}
|
|
9655
|
+
for (const registryItem of chartJsExtensionRegistry.getAll()) {
|
|
9656
|
+
registryItem.register(window.Chart);
|
|
9657
|
+
}
|
|
9658
|
+
}
|
|
9659
|
+
function unregisterChartJsExtensions() {
|
|
9660
|
+
if (!window.Chart) {
|
|
9661
|
+
return;
|
|
9662
|
+
}
|
|
9663
|
+
for (const registryItem of chartJsExtensionRegistry.getAll()) {
|
|
9664
|
+
registryItem.unregister(window.Chart);
|
|
9620
9665
|
}
|
|
9621
|
-
return window.Chart;
|
|
9622
9666
|
}
|
|
9623
9667
|
|
|
9624
9668
|
const TREND_LINE_XAXIS_ID = "x1";
|
|
@@ -10159,8 +10203,14 @@ function getNextNonEmptyBar(bars, startIndex) {
|
|
|
10159
10203
|
return bars.find((bar, i) => i > startIndex && bar.height !== 0);
|
|
10160
10204
|
}
|
|
10161
10205
|
|
|
10162
|
-
chartJsExtensionRegistry.add("chartShowValuesPlugin",
|
|
10163
|
-
|
|
10206
|
+
chartJsExtensionRegistry.add("chartShowValuesPlugin", {
|
|
10207
|
+
register: (Chart) => Chart.register(chartShowValuesPlugin),
|
|
10208
|
+
unregister: (Chart) => Chart.unregister(chartShowValuesPlugin),
|
|
10209
|
+
});
|
|
10210
|
+
chartJsExtensionRegistry.add("waterfallLinesPlugin", {
|
|
10211
|
+
register: (Chart) => Chart.register(waterfallLinesPlugin),
|
|
10212
|
+
unregister: (Chart) => Chart.unregister(waterfallLinesPlugin),
|
|
10213
|
+
});
|
|
10164
10214
|
class ChartJsComponent extends owl.Component {
|
|
10165
10215
|
static template = "o-spreadsheet-ChartJsComponent";
|
|
10166
10216
|
static props = {
|
|
@@ -10212,8 +10262,7 @@ class ChartJsComponent extends owl.Component {
|
|
|
10212
10262
|
createChart(chartData) {
|
|
10213
10263
|
const canvas = this.canvas.el;
|
|
10214
10264
|
const ctx = canvas.getContext("2d");
|
|
10215
|
-
|
|
10216
|
-
this.chart = new Chart(ctx, chartData);
|
|
10265
|
+
this.chart = new window.Chart(ctx, chartData);
|
|
10217
10266
|
}
|
|
10218
10267
|
updateChartJs(chartData) {
|
|
10219
10268
|
if (chartData.data && chartData.data.datasets) {
|
|
@@ -18345,7 +18394,7 @@ const IF = {
|
|
|
18345
18394
|
return { value: "" };
|
|
18346
18395
|
}
|
|
18347
18396
|
if (result.value === null) {
|
|
18348
|
-
result
|
|
18397
|
+
return { ...result, value: "" };
|
|
18349
18398
|
}
|
|
18350
18399
|
return result;
|
|
18351
18400
|
},
|
|
@@ -18366,7 +18415,7 @@ const IFERROR = {
|
|
|
18366
18415
|
return { value: "" };
|
|
18367
18416
|
}
|
|
18368
18417
|
if (result.value === null) {
|
|
18369
|
-
result
|
|
18418
|
+
return { ...result, value: "" };
|
|
18370
18419
|
}
|
|
18371
18420
|
return result;
|
|
18372
18421
|
},
|
|
@@ -18387,7 +18436,7 @@ const IFNA = {
|
|
|
18387
18436
|
return { value: "" };
|
|
18388
18437
|
}
|
|
18389
18438
|
if (result.value === null) {
|
|
18390
|
-
result
|
|
18439
|
+
return { ...result, value: "" };
|
|
18391
18440
|
}
|
|
18392
18441
|
return result;
|
|
18393
18442
|
},
|
|
@@ -18413,7 +18462,7 @@ const IFS = {
|
|
|
18413
18462
|
return { value: "" };
|
|
18414
18463
|
}
|
|
18415
18464
|
if (result.value === null) {
|
|
18416
|
-
result
|
|
18465
|
+
return { ...result, value: "" };
|
|
18417
18466
|
}
|
|
18418
18467
|
return result;
|
|
18419
18468
|
}
|
|
@@ -18531,6 +18580,11 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
18531
18580
|
if (range === undefined || range.invalidXc || range.invalidSheetName) {
|
|
18532
18581
|
throw new InvalidReferenceError();
|
|
18533
18582
|
}
|
|
18583
|
+
if (evalContext.__originCellPosition &&
|
|
18584
|
+
range.sheetId === evalContext.__originSheetId &&
|
|
18585
|
+
isZoneInside(positionToZone(evalContext.__originCellPosition), zone)) {
|
|
18586
|
+
throw new CircularDependencyError();
|
|
18587
|
+
}
|
|
18534
18588
|
dependencies.push(range);
|
|
18535
18589
|
}
|
|
18536
18590
|
for (const measure of forMeasures) {
|
|
@@ -22792,6 +22846,7 @@ const CHART_COMMON_OPTIONS = {
|
|
|
22792
22846
|
},
|
|
22793
22847
|
},
|
|
22794
22848
|
animation: false,
|
|
22849
|
+
events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "mouseup"],
|
|
22795
22850
|
};
|
|
22796
22851
|
function truncateLabel(label) {
|
|
22797
22852
|
if (!label) {
|
|
@@ -22817,8 +22872,7 @@ function chartToImage(runtime, figure, type) {
|
|
|
22817
22872
|
if ("chartJsConfig" in runtime) {
|
|
22818
22873
|
const config = deepCopy(runtime.chartJsConfig);
|
|
22819
22874
|
config.plugins = [backgroundColorChartJSPlugin];
|
|
22820
|
-
const
|
|
22821
|
-
const chart = new Chart(canvas, config);
|
|
22875
|
+
const chart = new window.Chart(canvas, config);
|
|
22822
22876
|
const imgContent = chart.toBase64Image();
|
|
22823
22877
|
chart.destroy();
|
|
22824
22878
|
div.remove();
|
|
@@ -27950,6 +28004,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
27950
28004
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
27951
28005
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
27952
28006
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
28007
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
27953
28008
|
return initialMessages;
|
|
27954
28009
|
}
|
|
27955
28010
|
/**
|
|
@@ -28049,6 +28104,40 @@ function fixChartDefinitions(data, initialMessages) {
|
|
|
28049
28104
|
}
|
|
28050
28105
|
return messages;
|
|
28051
28106
|
}
|
|
28107
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
28108
|
+
const sheetNames = {};
|
|
28109
|
+
for (const sheet of data.sheets || []) {
|
|
28110
|
+
sheetNames[sheet.id] = sheet.name;
|
|
28111
|
+
}
|
|
28112
|
+
const messages = [];
|
|
28113
|
+
for (const message of initialMessages) {
|
|
28114
|
+
if (message.type === "REMOTE_REVISION") {
|
|
28115
|
+
const commands = [];
|
|
28116
|
+
for (const cmd of message.commands) {
|
|
28117
|
+
switch (cmd.type) {
|
|
28118
|
+
case "DUPLICATE_SHEET":
|
|
28119
|
+
cmd.sheetNameTo =
|
|
28120
|
+
cmd.sheetNameTo ??
|
|
28121
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
28122
|
+
break;
|
|
28123
|
+
case "CREATE_SHEET":
|
|
28124
|
+
case "RENAME_SHEET":
|
|
28125
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
28126
|
+
break;
|
|
28127
|
+
}
|
|
28128
|
+
commands.push(cmd);
|
|
28129
|
+
}
|
|
28130
|
+
messages.push({
|
|
28131
|
+
...message,
|
|
28132
|
+
commands,
|
|
28133
|
+
});
|
|
28134
|
+
}
|
|
28135
|
+
else {
|
|
28136
|
+
messages.push(message);
|
|
28137
|
+
}
|
|
28138
|
+
}
|
|
28139
|
+
return initialMessages;
|
|
28140
|
+
}
|
|
28052
28141
|
// -----------------------------------------------------------------------------
|
|
28053
28142
|
// Helpers
|
|
28054
28143
|
// -----------------------------------------------------------------------------
|
|
@@ -28846,12 +28935,11 @@ function canBeLinearChart(definition, dataSets, labelRange, getters) {
|
|
|
28846
28935
|
}
|
|
28847
28936
|
let missingTimeAdapterAlreadyWarned = false;
|
|
28848
28937
|
function isLuxonTimeAdapterInstalled() {
|
|
28849
|
-
|
|
28850
|
-
if (!Chart) {
|
|
28938
|
+
if (!window.Chart) {
|
|
28851
28939
|
return false;
|
|
28852
28940
|
}
|
|
28853
28941
|
// @ts-ignore
|
|
28854
|
-
const adapter = new Chart._adapters._date({});
|
|
28942
|
+
const adapter = new window.Chart._adapters._date({});
|
|
28855
28943
|
const isInstalled = adapter._id === "luxon";
|
|
28856
28944
|
if (!isInstalled && !missingTimeAdapterAlreadyWarned) {
|
|
28857
28945
|
missingTimeAdapterAlreadyWarned = true;
|
|
@@ -29489,6 +29577,9 @@ const INTERACTIVE_LEGEND_CONFIG = {
|
|
|
29489
29577
|
target.style.cursor = "default";
|
|
29490
29578
|
},
|
|
29491
29579
|
onClick: (event, legendItem, legend) => {
|
|
29580
|
+
if (event.type !== "click") {
|
|
29581
|
+
return;
|
|
29582
|
+
}
|
|
29492
29583
|
const index = legendItem.datasetIndex;
|
|
29493
29584
|
if (!legend.legendItems || index === undefined) {
|
|
29494
29585
|
return;
|
|
@@ -33214,10 +33305,13 @@ const duplicateSheet = {
|
|
|
33214
33305
|
name: _t("Duplicate"),
|
|
33215
33306
|
execute: (env) => {
|
|
33216
33307
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
33308
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
33217
33309
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
33310
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
33218
33311
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
33219
33312
|
sheetId: sheetIdFrom,
|
|
33220
33313
|
sheetIdTo,
|
|
33314
|
+
sheetNameTo,
|
|
33221
33315
|
});
|
|
33222
33316
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
33223
33317
|
},
|
|
@@ -41037,6 +41131,13 @@ class Composer extends owl.Component {
|
|
|
41037
41131
|
openAssistant() {
|
|
41038
41132
|
this.assistant.forcedClosed = false;
|
|
41039
41133
|
}
|
|
41134
|
+
onWheel(event) {
|
|
41135
|
+
// detect if scrollbar is available
|
|
41136
|
+
if (this.composerRef.el &&
|
|
41137
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
41138
|
+
event.stopPropagation();
|
|
41139
|
+
}
|
|
41140
|
+
}
|
|
41040
41141
|
// ---------------------------------------------------------------------------
|
|
41041
41142
|
// Private
|
|
41042
41143
|
// ---------------------------------------------------------------------------
|
|
@@ -45974,8 +46075,8 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
45974
46075
|
|
|
45975
46076
|
const NULL_SYMBOL = Symbol("NULL");
|
|
45976
46077
|
function createDate(dimension, value, locale) {
|
|
45977
|
-
const granularity = dimension.granularity;
|
|
45978
|
-
if (!
|
|
46078
|
+
const granularity = dimension.granularity || "month";
|
|
46079
|
+
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
45979
46080
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
45980
46081
|
}
|
|
45981
46082
|
const keyInMap = typeof value === "number" || typeof value === "string" ? value : NULL_SYMBOL;
|
|
@@ -45994,6 +46095,9 @@ function createDate(dimension, value, locale) {
|
|
|
45994
46095
|
case "month_number":
|
|
45995
46096
|
number = date.getMonth() + 1;
|
|
45996
46097
|
break;
|
|
46098
|
+
case "month":
|
|
46099
|
+
number = Math.floor(toNumber(value, locale));
|
|
46100
|
+
break;
|
|
45997
46101
|
case "iso_week_number":
|
|
45998
46102
|
number = date.getIsoWeek();
|
|
45999
46103
|
break;
|
|
@@ -46087,6 +46191,10 @@ const MAP_VALUE_DIMENSION_DATE = {
|
|
|
46087
46191
|
set: new Set(),
|
|
46088
46192
|
values: {},
|
|
46089
46193
|
},
|
|
46194
|
+
month: {
|
|
46195
|
+
set: new Set(),
|
|
46196
|
+
values: {},
|
|
46197
|
+
},
|
|
46090
46198
|
iso_week_number: {
|
|
46091
46199
|
set: new Set(),
|
|
46092
46200
|
values: {},
|
|
@@ -46297,7 +46405,7 @@ class SpreadsheetPivot {
|
|
|
46297
46405
|
const cells = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
46298
46406
|
const finalCell = cells[0]?.[dimension.nameWithGranularity];
|
|
46299
46407
|
if (dimension.type === "datetime") {
|
|
46300
|
-
const adapter = pivotTimeAdapter(dimension.granularity);
|
|
46408
|
+
const adapter = pivotTimeAdapter((dimension.granularity || "month"));
|
|
46301
46409
|
return adapter.toValueAndFormat(lastNode.value, this.getters.getLocale());
|
|
46302
46410
|
}
|
|
46303
46411
|
if (!finalCell) {
|
|
@@ -46415,7 +46523,7 @@ class SpreadsheetPivot {
|
|
|
46415
46523
|
if (nonEmptyCells.length === 0) {
|
|
46416
46524
|
return "integer";
|
|
46417
46525
|
}
|
|
46418
|
-
if (nonEmptyCells.every((cell) => cell.format && isDateTimeFormat(cell.format))) {
|
|
46526
|
+
if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) {
|
|
46419
46527
|
return "datetime";
|
|
46420
46528
|
}
|
|
46421
46529
|
if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) {
|
|
@@ -46510,7 +46618,7 @@ class SpreadsheetPivot {
|
|
|
46510
46618
|
for (const entry of dataEntries) {
|
|
46511
46619
|
for (const dimension of dateDimensions) {
|
|
46512
46620
|
const value = createDate(dimension, entry[dimension.fieldName]?.value || null, this.getters.getLocale());
|
|
46513
|
-
const adapter = pivotTimeAdapter(dimension.granularity);
|
|
46621
|
+
const adapter = pivotTimeAdapter((dimension.granularity || "month"));
|
|
46514
46622
|
const { format, value: valueToFormat } = adapter.toValueAndFormat(value, locale);
|
|
46515
46623
|
entry[dimension.nameWithGranularity] = {
|
|
46516
46624
|
value,
|
|
@@ -46530,6 +46638,7 @@ const dateGranularities = [
|
|
|
46530
46638
|
"year",
|
|
46531
46639
|
"quarter_number",
|
|
46532
46640
|
"month_number",
|
|
46641
|
+
"month",
|
|
46533
46642
|
"iso_week_number",
|
|
46534
46643
|
"day_of_month",
|
|
46535
46644
|
"day",
|
|
@@ -46777,7 +46886,7 @@ class PivotSidePanelStore extends SpreadsheetStore {
|
|
|
46777
46886
|
: this.datetimeGranularities);
|
|
46778
46887
|
}
|
|
46779
46888
|
for (const field of dateFields) {
|
|
46780
|
-
granularitiesPerFields[field.fieldName].delete(field.granularity);
|
|
46889
|
+
granularitiesPerFields[field.fieldName].delete(field.granularity || "month");
|
|
46781
46890
|
}
|
|
46782
46891
|
return granularitiesPerFields;
|
|
46783
46892
|
}
|
|
@@ -48952,6 +49061,8 @@ class GridComposer extends owl.Component {
|
|
|
48952
49061
|
}
|
|
48953
49062
|
get composerProps() {
|
|
48954
49063
|
const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
|
|
49064
|
+
// Remove the wrapper border width
|
|
49065
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
48955
49066
|
return {
|
|
48956
49067
|
rect: { ...this.rect },
|
|
48957
49068
|
delimitation: {
|
|
@@ -48969,6 +49080,7 @@ class GridComposer extends owl.Component {
|
|
|
48969
49080
|
}),
|
|
48970
49081
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
48971
49082
|
composerStore: this.composerStore,
|
|
49083
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
48972
49084
|
};
|
|
48973
49085
|
}
|
|
48974
49086
|
get containerStyle() {
|
|
@@ -54259,9 +54371,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
54259
54371
|
: "Success" /* CommandResult.Success */;
|
|
54260
54372
|
}
|
|
54261
54373
|
checkChartExists(cmd) {
|
|
54262
|
-
return this.
|
|
54263
|
-
? "Success" /* CommandResult.Success */
|
|
54264
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
54374
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
54265
54375
|
}
|
|
54266
54376
|
}
|
|
54267
54377
|
|
|
@@ -56546,6 +56656,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
56546
56656
|
"getCommandZones",
|
|
56547
56657
|
"getUnboundedZone",
|
|
56548
56658
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
56659
|
+
"getDuplicateSheetName",
|
|
56549
56660
|
];
|
|
56550
56661
|
sheetIdsMapName = {};
|
|
56551
56662
|
orderedSheetIds = [];
|
|
@@ -56570,7 +56681,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
56570
56681
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
56571
56682
|
}
|
|
56572
56683
|
case "DUPLICATE_SHEET": {
|
|
56573
|
-
|
|
56684
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
56685
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
56686
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
56687
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
56688
|
+
return "Success" /* CommandResult.Success */;
|
|
56574
56689
|
}
|
|
56575
56690
|
case "MOVE_SHEET":
|
|
56576
56691
|
try {
|
|
@@ -56647,7 +56762,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
56647
56762
|
this.showSheet(cmd.sheetId);
|
|
56648
56763
|
break;
|
|
56649
56764
|
case "DUPLICATE_SHEET":
|
|
56650
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
56765
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
56651
56766
|
break;
|
|
56652
56767
|
case "DELETE_SHEET":
|
|
56653
56768
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -56853,14 +56968,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
56853
56968
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
56854
56969
|
}
|
|
56855
56970
|
getNextSheetName(baseName = "Sheet") {
|
|
56856
|
-
let i = 1;
|
|
56857
56971
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
56858
|
-
|
|
56859
|
-
while (names.includes(name)) {
|
|
56860
|
-
name = `${baseName}${i}`;
|
|
56861
|
-
i++;
|
|
56862
|
-
}
|
|
56863
|
-
return name;
|
|
56972
|
+
return getNextSheetName(names, baseName);
|
|
56864
56973
|
}
|
|
56865
56974
|
getSheetSize(sheetId) {
|
|
56866
56975
|
return {
|
|
@@ -57106,9 +57215,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
57106
57215
|
showSheet(sheetId) {
|
|
57107
57216
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
57108
57217
|
}
|
|
57109
|
-
duplicateSheet(fromId, toId) {
|
|
57218
|
+
duplicateSheet(fromId, toId, toName) {
|
|
57110
57219
|
const sheet = this.getSheet(fromId);
|
|
57111
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
57112
57220
|
const newSheet = deepCopy(sheet);
|
|
57113
57221
|
newSheet.id = toId;
|
|
57114
57222
|
newSheet.name = toName;
|
|
@@ -57140,15 +57248,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
57140
57248
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
57141
57249
|
}
|
|
57142
57250
|
getDuplicateSheetName(sheetName) {
|
|
57143
|
-
let i = 1;
|
|
57144
57251
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
57145
|
-
|
|
57146
|
-
let name = baseName.toString();
|
|
57147
|
-
while (names.includes(name)) {
|
|
57148
|
-
name = `${baseName} (${i})`;
|
|
57149
|
-
i++;
|
|
57150
|
-
}
|
|
57151
|
-
return name;
|
|
57252
|
+
return getDuplicateSheetName(sheetName, names);
|
|
57152
57253
|
}
|
|
57153
57254
|
deleteSheet(sheet) {
|
|
57154
57255
|
const name = sheet.name;
|
|
@@ -59975,8 +60076,8 @@ class SpreadingRelation {
|
|
|
59975
60076
|
const EMPTY_ARRAY = [];
|
|
59976
60077
|
|
|
59977
60078
|
const MAX_ITERATION = 30;
|
|
59978
|
-
const ERROR_CYCLE_CELL = createEvaluatedCell(new CircularDependencyError());
|
|
59979
|
-
const EMPTY_CELL = createEvaluatedCell({ value: null });
|
|
60079
|
+
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
60080
|
+
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
59980
60081
|
class Evaluator {
|
|
59981
60082
|
context;
|
|
59982
60083
|
getters;
|
|
@@ -71308,11 +71409,13 @@ class Spreadsheet extends owl.Component {
|
|
|
71308
71409
|
this.checkViewportSize();
|
|
71309
71410
|
stores.on("store-updated", this, render);
|
|
71310
71411
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
71412
|
+
registerChartJSExtensions();
|
|
71311
71413
|
});
|
|
71312
71414
|
owl.onWillUnmount(() => {
|
|
71313
71415
|
this.unbindModelEvents();
|
|
71314
71416
|
stores.off("store-updated", this);
|
|
71315
71417
|
resizeObserver.disconnect();
|
|
71418
|
+
unregisterChartJsExtensions();
|
|
71316
71419
|
});
|
|
71317
71420
|
owl.onPatched(() => {
|
|
71318
71421
|
this.checkViewportSize();
|
|
@@ -75806,6 +75909,6 @@ exports.tokenColors = tokenColors;
|
|
|
75806
75909
|
exports.tokenize = tokenize;
|
|
75807
75910
|
|
|
75808
75911
|
|
|
75809
|
-
__info__.version = "18.1.
|
|
75810
|
-
__info__.date = "2025-05-
|
|
75811
|
-
__info__.hash = "
|
|
75912
|
+
__info__.version = "18.1.19";
|
|
75913
|
+
__info__.date = "2025-05-12T05:26:05.861Z";
|
|
75914
|
+
__info__.hash = "44cc170";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import * as _odoo_owl from '@odoo/owl';
|
|
|
6
6
|
import { ComponentConstructor, Component } from '@odoo/owl';
|
|
7
7
|
import * as chart_js_dist_types_utils from 'chart.js/dist/types/utils';
|
|
8
8
|
import * as chart_js_dist_types_geometric from 'chart.js/dist/types/geometric';
|
|
9
|
-
import * as chart_js_dist_types_basic from 'chart.js/dist/types/basic';
|
|
10
9
|
|
|
11
10
|
interface Figure {
|
|
12
11
|
id: UID;
|
|
@@ -2514,6 +2513,7 @@ interface DeleteSheetCommand extends SheetDependentCommand {
|
|
|
2514
2513
|
interface DuplicateSheetCommand extends SheetDependentCommand {
|
|
2515
2514
|
type: "DUPLICATE_SHEET";
|
|
2516
2515
|
sheetIdTo: UID;
|
|
2516
|
+
sheetNameTo: string;
|
|
2517
2517
|
}
|
|
2518
2518
|
interface MoveSheetCommand extends SheetDependentCommand {
|
|
2519
2519
|
type: "MOVE_SHEET";
|
|
@@ -4843,7 +4843,7 @@ interface SheetState {
|
|
|
4843
4843
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
4844
4844
|
}
|
|
4845
4845
|
declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
4846
|
-
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders"];
|
|
4846
|
+
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders", "getDuplicateSheetName"];
|
|
4847
4847
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
4848
4848
|
readonly orderedSheetIds: UID[];
|
|
4849
4849
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -4920,7 +4920,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4920
4920
|
private hideSheet;
|
|
4921
4921
|
private showSheet;
|
|
4922
4922
|
private duplicateSheet;
|
|
4923
|
-
|
|
4923
|
+
getDuplicateSheetName(sheetName: string): string;
|
|
4924
4924
|
private deleteSheet;
|
|
4925
4925
|
/**
|
|
4926
4926
|
* Delete column. This requires a lot of handling:
|
|
@@ -8450,6 +8450,7 @@ declare class Composer extends Component<CellComposerProps, SpreadsheetChildEnv>
|
|
|
8450
8450
|
onContextMenu(ev: MouseEvent): void;
|
|
8451
8451
|
closeAssistant(): void;
|
|
8452
8452
|
openAssistant(): void;
|
|
8453
|
+
onWheel(event: WheelEvent): void;
|
|
8453
8454
|
private processContent;
|
|
8454
8455
|
/**
|
|
8455
8456
|
* Get the HTML content corresponding to the current composer token, divided by lines.
|
|
@@ -12535,7 +12536,10 @@ declare const registries: {
|
|
|
12535
12536
|
supportedPivotPositionalFormulaRegistry: Registry<boolean>;
|
|
12536
12537
|
pivotToFunctionValueRegistry: Registry<(value: CellValue, granularity?: string | undefined) => string>;
|
|
12537
12538
|
migrationStepRegistry: Registry<MigrationStep>;
|
|
12538
|
-
chartJsExtensionRegistry: Registry<
|
|
12539
|
+
chartJsExtensionRegistry: Registry<{
|
|
12540
|
+
register: (chart: typeof chart_js.Chart) => void;
|
|
12541
|
+
unregister: (chart: typeof chart_js.Chart) => void;
|
|
12542
|
+
}>;
|
|
12539
12543
|
};
|
|
12540
12544
|
declare const helpers: {
|
|
12541
12545
|
arg: typeof arg;
|