@odoo/o-spreadsheet 18.2.10 → 18.2.11
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 +172 -55
- package/dist/o-spreadsheet.d.ts +9 -4
- package/dist/o-spreadsheet.esm.js +172 -55
- package/dist/o-spreadsheet.iife.js +172 -55
- package/dist/o-spreadsheet.iife.min.js +380 -380
- 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.2.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.11
|
|
6
|
+
* @date 2025-05-12T05:25:59.138Z
|
|
7
|
+
* @hash eb87dca
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -6282,6 +6282,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
6282
6282
|
})
|
|
6283
6283
|
.filter(isDefined);
|
|
6284
6284
|
}
|
|
6285
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6286
|
+
let i = 1;
|
|
6287
|
+
let name = `${baseName}${i}`;
|
|
6288
|
+
while (existingNames.includes(name)) {
|
|
6289
|
+
name = `${baseName}${i}`;
|
|
6290
|
+
i++;
|
|
6291
|
+
}
|
|
6292
|
+
return name;
|
|
6293
|
+
}
|
|
6294
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6295
|
+
let i = 1;
|
|
6296
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6297
|
+
let name = baseName.toString();
|
|
6298
|
+
while (existingNames.includes(name)) {
|
|
6299
|
+
name = `${baseName} (${i})`;
|
|
6300
|
+
i++;
|
|
6301
|
+
}
|
|
6302
|
+
return name;
|
|
6303
|
+
}
|
|
6285
6304
|
|
|
6286
6305
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
6287
6306
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -7980,6 +7999,24 @@ const monthNumberAdapter = {
|
|
|
7980
7999
|
return `${normalizedValue}`;
|
|
7981
8000
|
},
|
|
7982
8001
|
};
|
|
8002
|
+
/**
|
|
8003
|
+
* normalizes month number + year
|
|
8004
|
+
*/
|
|
8005
|
+
const monthAdapter = {
|
|
8006
|
+
normalizeFunctionValue(value) {
|
|
8007
|
+
const date = toNumber(value, DEFAULT_LOCALE);
|
|
8008
|
+
return formatValue(date, { locale: DEFAULT_LOCALE, format: "mm/yyyy" });
|
|
8009
|
+
},
|
|
8010
|
+
toValueAndFormat(normalizedValue) {
|
|
8011
|
+
return {
|
|
8012
|
+
value: toNumber(normalizedValue, DEFAULT_LOCALE),
|
|
8013
|
+
format: "mmmm yyyy",
|
|
8014
|
+
};
|
|
8015
|
+
},
|
|
8016
|
+
toFunctionValue(normalizedValue) {
|
|
8017
|
+
return `"${normalizedValue}"`;
|
|
8018
|
+
},
|
|
8019
|
+
};
|
|
7983
8020
|
/**
|
|
7984
8021
|
* normalizes quarter number
|
|
7985
8022
|
*/
|
|
@@ -8110,6 +8147,7 @@ pivotTimeAdapterRegistry
|
|
|
8110
8147
|
.add("day_of_month", nullHandlerDecorator(dayOfMonthAdapter))
|
|
8111
8148
|
.add("iso_week_number", nullHandlerDecorator(isoWeekNumberAdapter))
|
|
8112
8149
|
.add("month_number", nullHandlerDecorator(monthNumberAdapter))
|
|
8150
|
+
.add("month", nullHandlerDecorator(monthAdapter))
|
|
8113
8151
|
.add("quarter_number", nullHandlerDecorator(quarterNumberAdapter))
|
|
8114
8152
|
.add("day_of_week", nullHandlerDecorator(dayOfWeekAdapter))
|
|
8115
8153
|
.add("hour_number", nullHandlerDecorator(hourNumberAdapter))
|
|
@@ -8290,10 +8328,7 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8290
8328
|
return normalizer(groupValueString, dimension.granularity);
|
|
8291
8329
|
}
|
|
8292
8330
|
function normalizeDateTime(value, granularity) {
|
|
8293
|
-
|
|
8294
|
-
throw new Error("Missing granularity");
|
|
8295
|
-
}
|
|
8296
|
-
return pivotTimeAdapter(granularity).normalizeFunctionValue(value);
|
|
8331
|
+
return pivotTimeAdapter(granularity ?? "month").normalizeFunctionValue(value);
|
|
8297
8332
|
}
|
|
8298
8333
|
function toFunctionPivotValue(value, dimension) {
|
|
8299
8334
|
if (value === null) {
|
|
@@ -8305,10 +8340,7 @@ function toFunctionPivotValue(value, dimension) {
|
|
|
8305
8340
|
return pivotToFunctionValueRegistry.get(dimension.type)(value, dimension.granularity);
|
|
8306
8341
|
}
|
|
8307
8342
|
function toFunctionValueDateTime(value, granularity) {
|
|
8308
|
-
|
|
8309
|
-
throw new Error("Missing granularity");
|
|
8310
|
-
}
|
|
8311
|
-
return pivotTimeAdapter(granularity).toFunctionValue(value);
|
|
8343
|
+
return pivotTimeAdapter(granularity ?? "month").toFunctionValue(value);
|
|
8312
8344
|
}
|
|
8313
8345
|
const pivotNormalizationValueRegistry = new Registry();
|
|
8314
8346
|
pivotNormalizationValueRegistry
|
|
@@ -9767,12 +9799,24 @@ function getElementMargins(el) {
|
|
|
9767
9799
|
}
|
|
9768
9800
|
|
|
9769
9801
|
const chartJsExtensionRegistry = new Registry();
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9802
|
+
function areChartJSExtensionsLoaded() {
|
|
9803
|
+
return !!window.Chart.registry.plugins.get("chartShowValuesPlugin");
|
|
9804
|
+
}
|
|
9805
|
+
function registerChartJSExtensions() {
|
|
9806
|
+
if (!window.Chart || areChartJSExtensionsLoaded()) {
|
|
9807
|
+
return;
|
|
9808
|
+
}
|
|
9809
|
+
for (const registryItem of chartJsExtensionRegistry.getAll()) {
|
|
9810
|
+
registryItem.register(window.Chart);
|
|
9811
|
+
}
|
|
9812
|
+
}
|
|
9813
|
+
function unregisterChartJsExtensions() {
|
|
9814
|
+
if (!window.Chart) {
|
|
9815
|
+
return;
|
|
9816
|
+
}
|
|
9817
|
+
for (const registryItem of chartJsExtensionRegistry.getAll()) {
|
|
9818
|
+
registryItem.unregister(window.Chart);
|
|
9774
9819
|
}
|
|
9775
|
-
return window.Chart;
|
|
9776
9820
|
}
|
|
9777
9821
|
|
|
9778
9822
|
const TREND_LINE_XAXIS_ID = "x1";
|
|
@@ -10332,8 +10376,14 @@ css /* scss */ `
|
|
|
10332
10376
|
}
|
|
10333
10377
|
}
|
|
10334
10378
|
`;
|
|
10335
|
-
chartJsExtensionRegistry.add("chartShowValuesPlugin",
|
|
10336
|
-
|
|
10379
|
+
chartJsExtensionRegistry.add("chartShowValuesPlugin", {
|
|
10380
|
+
register: (Chart) => Chart.register(chartShowValuesPlugin),
|
|
10381
|
+
unregister: (Chart) => Chart.unregister(chartShowValuesPlugin),
|
|
10382
|
+
});
|
|
10383
|
+
chartJsExtensionRegistry.add("waterfallLinesPlugin", {
|
|
10384
|
+
register: (Chart) => Chart.register(waterfallLinesPlugin),
|
|
10385
|
+
unregister: (Chart) => Chart.unregister(waterfallLinesPlugin),
|
|
10386
|
+
});
|
|
10337
10387
|
class ChartJsComponent extends owl.Component {
|
|
10338
10388
|
static template = "o-spreadsheet-ChartJsComponent";
|
|
10339
10389
|
static props = {
|
|
@@ -10385,8 +10435,7 @@ class ChartJsComponent extends owl.Component {
|
|
|
10385
10435
|
createChart(chartData) {
|
|
10386
10436
|
const canvas = this.canvas.el;
|
|
10387
10437
|
const ctx = canvas.getContext("2d");
|
|
10388
|
-
|
|
10389
|
-
this.chart = new Chart(ctx, chartData);
|
|
10438
|
+
this.chart = new window.Chart(ctx, chartData);
|
|
10390
10439
|
}
|
|
10391
10440
|
updateChartJs(chartData) {
|
|
10392
10441
|
if (chartData.data && chartData.data.datasets) {
|
|
@@ -18518,7 +18567,7 @@ const IF = {
|
|
|
18518
18567
|
return { value: "" };
|
|
18519
18568
|
}
|
|
18520
18569
|
if (result.value === null) {
|
|
18521
|
-
result
|
|
18570
|
+
return { ...result, value: "" };
|
|
18522
18571
|
}
|
|
18523
18572
|
return result;
|
|
18524
18573
|
},
|
|
@@ -18539,7 +18588,7 @@ const IFERROR = {
|
|
|
18539
18588
|
return { value: "" };
|
|
18540
18589
|
}
|
|
18541
18590
|
if (result.value === null) {
|
|
18542
|
-
result
|
|
18591
|
+
return { ...result, value: "" };
|
|
18543
18592
|
}
|
|
18544
18593
|
return result;
|
|
18545
18594
|
},
|
|
@@ -18560,7 +18609,7 @@ const IFNA = {
|
|
|
18560
18609
|
return { value: "" };
|
|
18561
18610
|
}
|
|
18562
18611
|
if (result.value === null) {
|
|
18563
|
-
result
|
|
18612
|
+
return { ...result, value: "" };
|
|
18564
18613
|
}
|
|
18565
18614
|
return result;
|
|
18566
18615
|
},
|
|
@@ -18586,7 +18635,7 @@ const IFS = {
|
|
|
18586
18635
|
return { value: "" };
|
|
18587
18636
|
}
|
|
18588
18637
|
if (result.value === null) {
|
|
18589
|
-
result
|
|
18638
|
+
return { ...result, value: "" };
|
|
18590
18639
|
}
|
|
18591
18640
|
return result;
|
|
18592
18641
|
}
|
|
@@ -18704,6 +18753,11 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
18704
18753
|
if (range === undefined || range.invalidXc || range.invalidSheetName) {
|
|
18705
18754
|
throw new InvalidReferenceError();
|
|
18706
18755
|
}
|
|
18756
|
+
if (evalContext.__originCellPosition &&
|
|
18757
|
+
range.sheetId === evalContext.__originSheetId &&
|
|
18758
|
+
isZoneInside(positionToZone(evalContext.__originCellPosition), zone)) {
|
|
18759
|
+
throw new CircularDependencyError();
|
|
18760
|
+
}
|
|
18707
18761
|
dependencies.push(range);
|
|
18708
18762
|
}
|
|
18709
18763
|
for (const measure of forMeasures) {
|
|
@@ -22965,6 +23019,7 @@ const CHART_COMMON_OPTIONS = {
|
|
|
22965
23019
|
},
|
|
22966
23020
|
},
|
|
22967
23021
|
animation: false,
|
|
23022
|
+
events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "mouseup"],
|
|
22968
23023
|
};
|
|
22969
23024
|
function chartToImage(runtime, figure, type) {
|
|
22970
23025
|
// wrap the canvas in a div with a fixed size because chart.js would
|
|
@@ -22981,8 +23036,7 @@ function chartToImage(runtime, figure, type) {
|
|
|
22981
23036
|
if ("chartJsConfig" in runtime) {
|
|
22982
23037
|
const config = deepCopy(runtime.chartJsConfig);
|
|
22983
23038
|
config.plugins = [backgroundColorChartJSPlugin];
|
|
22984
|
-
const
|
|
22985
|
-
const chart = new Chart(canvas, config);
|
|
23039
|
+
const chart = new window.Chart(canvas, config);
|
|
22986
23040
|
const imgContent = chart.toBase64Image();
|
|
22987
23041
|
chart.destroy();
|
|
22988
23042
|
div.remove();
|
|
@@ -27975,6 +28029,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
27975
28029
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
27976
28030
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
27977
28031
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
28032
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
27978
28033
|
return initialMessages;
|
|
27979
28034
|
}
|
|
27980
28035
|
/**
|
|
@@ -28074,6 +28129,40 @@ function fixChartDefinitions(data, initialMessages) {
|
|
|
28074
28129
|
}
|
|
28075
28130
|
return messages;
|
|
28076
28131
|
}
|
|
28132
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
28133
|
+
const sheetNames = {};
|
|
28134
|
+
for (const sheet of data.sheets || []) {
|
|
28135
|
+
sheetNames[sheet.id] = sheet.name;
|
|
28136
|
+
}
|
|
28137
|
+
const messages = [];
|
|
28138
|
+
for (const message of initialMessages) {
|
|
28139
|
+
if (message.type === "REMOTE_REVISION") {
|
|
28140
|
+
const commands = [];
|
|
28141
|
+
for (const cmd of message.commands) {
|
|
28142
|
+
switch (cmd.type) {
|
|
28143
|
+
case "DUPLICATE_SHEET":
|
|
28144
|
+
cmd.sheetNameTo =
|
|
28145
|
+
cmd.sheetNameTo ??
|
|
28146
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
28147
|
+
break;
|
|
28148
|
+
case "CREATE_SHEET":
|
|
28149
|
+
case "RENAME_SHEET":
|
|
28150
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
28151
|
+
break;
|
|
28152
|
+
}
|
|
28153
|
+
commands.push(cmd);
|
|
28154
|
+
}
|
|
28155
|
+
messages.push({
|
|
28156
|
+
...message,
|
|
28157
|
+
commands,
|
|
28158
|
+
});
|
|
28159
|
+
}
|
|
28160
|
+
else {
|
|
28161
|
+
messages.push(message);
|
|
28162
|
+
}
|
|
28163
|
+
}
|
|
28164
|
+
return initialMessages;
|
|
28165
|
+
}
|
|
28077
28166
|
// -----------------------------------------------------------------------------
|
|
28078
28167
|
// Helpers
|
|
28079
28168
|
// -----------------------------------------------------------------------------
|
|
@@ -28870,12 +28959,11 @@ function canBeLinearChart(definition, dataSets, labelRange, getters) {
|
|
|
28870
28959
|
}
|
|
28871
28960
|
let missingTimeAdapterAlreadyWarned = false;
|
|
28872
28961
|
function isLuxonTimeAdapterInstalled() {
|
|
28873
|
-
|
|
28874
|
-
if (!Chart) {
|
|
28962
|
+
if (!window.Chart) {
|
|
28875
28963
|
return false;
|
|
28876
28964
|
}
|
|
28877
28965
|
// @ts-ignore
|
|
28878
|
-
const adapter = new Chart._adapters._date({});
|
|
28966
|
+
const adapter = new window.Chart._adapters._date({});
|
|
28879
28967
|
const isInstalled = adapter._id === "luxon";
|
|
28880
28968
|
if (!isInstalled && !missingTimeAdapterAlreadyWarned) {
|
|
28881
28969
|
missingTimeAdapterAlreadyWarned = true;
|
|
@@ -29513,6 +29601,9 @@ const INTERACTIVE_LEGEND_CONFIG = {
|
|
|
29513
29601
|
target.style.cursor = "default";
|
|
29514
29602
|
},
|
|
29515
29603
|
onClick: (event, legendItem, legend) => {
|
|
29604
|
+
if (event.type !== "click") {
|
|
29605
|
+
return;
|
|
29606
|
+
}
|
|
29516
29607
|
const index = legendItem.datasetIndex;
|
|
29517
29608
|
if (!legend.legendItems || index === undefined) {
|
|
29518
29609
|
return;
|
|
@@ -33412,10 +33503,13 @@ const duplicateSheet = {
|
|
|
33412
33503
|
name: _t("Duplicate"),
|
|
33413
33504
|
execute: (env) => {
|
|
33414
33505
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
33506
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
33415
33507
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
33508
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
33416
33509
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
33417
33510
|
sheetId: sheetIdFrom,
|
|
33418
33511
|
sheetIdTo,
|
|
33512
|
+
sheetNameTo,
|
|
33419
33513
|
});
|
|
33420
33514
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
33421
33515
|
},
|
|
@@ -38618,7 +38712,7 @@ class GenericChartConfigPanel extends owl.Component {
|
|
|
38618
38712
|
const cancelledReasons = [
|
|
38619
38713
|
...(this.state.datasetDispatchResult?.reasons || []),
|
|
38620
38714
|
...(this.state.labelsDispatchResult?.reasons || []),
|
|
38621
|
-
];
|
|
38715
|
+
].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
38622
38716
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
38623
38717
|
}
|
|
38624
38718
|
get isDatasetInvalid() {
|
|
@@ -40840,6 +40934,13 @@ class Composer extends owl.Component {
|
|
|
40840
40934
|
openAssistant() {
|
|
40841
40935
|
this.assistant.forcedClosed = false;
|
|
40842
40936
|
}
|
|
40937
|
+
onWheel(event) {
|
|
40938
|
+
// detect if scrollbar is available
|
|
40939
|
+
if (this.composerRef.el &&
|
|
40940
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
40941
|
+
event.stopPropagation();
|
|
40942
|
+
}
|
|
40943
|
+
}
|
|
40843
40944
|
// ---------------------------------------------------------------------------
|
|
40844
40945
|
// Private
|
|
40845
40946
|
// ---------------------------------------------------------------------------
|
|
@@ -46316,8 +46417,8 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
46316
46417
|
|
|
46317
46418
|
const NULL_SYMBOL = Symbol("NULL");
|
|
46318
46419
|
function createDate(dimension, value, locale) {
|
|
46319
|
-
const granularity = dimension.granularity;
|
|
46320
|
-
if (!
|
|
46420
|
+
const granularity = dimension.granularity || "month";
|
|
46421
|
+
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
46321
46422
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
46322
46423
|
}
|
|
46323
46424
|
const keyInMap = typeof value === "number" || typeof value === "string" ? value : NULL_SYMBOL;
|
|
@@ -46336,6 +46437,9 @@ function createDate(dimension, value, locale) {
|
|
|
46336
46437
|
case "month_number":
|
|
46337
46438
|
number = date.getMonth() + 1;
|
|
46338
46439
|
break;
|
|
46440
|
+
case "month":
|
|
46441
|
+
number = Math.floor(toNumber(value, locale));
|
|
46442
|
+
break;
|
|
46339
46443
|
case "iso_week_number":
|
|
46340
46444
|
number = date.getIsoWeek();
|
|
46341
46445
|
break;
|
|
@@ -46429,6 +46533,10 @@ const MAP_VALUE_DIMENSION_DATE = {
|
|
|
46429
46533
|
set: new Set(),
|
|
46430
46534
|
values: {},
|
|
46431
46535
|
},
|
|
46536
|
+
month: {
|
|
46537
|
+
set: new Set(),
|
|
46538
|
+
values: {},
|
|
46539
|
+
},
|
|
46432
46540
|
iso_week_number: {
|
|
46433
46541
|
set: new Set(),
|
|
46434
46542
|
values: {},
|
|
@@ -46639,7 +46747,7 @@ class SpreadsheetPivot {
|
|
|
46639
46747
|
const cells = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
46640
46748
|
const finalCell = cells[0]?.[dimension.nameWithGranularity];
|
|
46641
46749
|
if (dimension.type === "datetime") {
|
|
46642
|
-
const adapter = pivotTimeAdapter(dimension.granularity);
|
|
46750
|
+
const adapter = pivotTimeAdapter((dimension.granularity || "month"));
|
|
46643
46751
|
return adapter.toValueAndFormat(lastNode.value, this.getters.getLocale());
|
|
46644
46752
|
}
|
|
46645
46753
|
if (!finalCell) {
|
|
@@ -46757,7 +46865,7 @@ class SpreadsheetPivot {
|
|
|
46757
46865
|
if (nonEmptyCells.length === 0) {
|
|
46758
46866
|
return "integer";
|
|
46759
46867
|
}
|
|
46760
|
-
if (nonEmptyCells.every((cell) => cell.format && isDateTimeFormat(cell.format))) {
|
|
46868
|
+
if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) {
|
|
46761
46869
|
return "datetime";
|
|
46762
46870
|
}
|
|
46763
46871
|
if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) {
|
|
@@ -46850,7 +46958,7 @@ class SpreadsheetPivot {
|
|
|
46850
46958
|
for (const entry of dataEntries) {
|
|
46851
46959
|
for (const dimension of dateDimensions) {
|
|
46852
46960
|
const value = createDate(dimension, entry[dimension.fieldName]?.value || null, this.getters.getLocale());
|
|
46853
|
-
const adapter = pivotTimeAdapter(dimension.granularity);
|
|
46961
|
+
const adapter = pivotTimeAdapter((dimension.granularity || "month"));
|
|
46854
46962
|
const { format, value: valueToFormat } = adapter.toValueAndFormat(value, locale);
|
|
46855
46963
|
entry[dimension.nameWithGranularity] = {
|
|
46856
46964
|
value,
|
|
@@ -46870,6 +46978,7 @@ const dateGranularities = [
|
|
|
46870
46978
|
"year",
|
|
46871
46979
|
"quarter_number",
|
|
46872
46980
|
"month_number",
|
|
46981
|
+
"month",
|
|
46873
46982
|
"iso_week_number",
|
|
46874
46983
|
"day_of_month",
|
|
46875
46984
|
"day",
|
|
@@ -47120,7 +47229,7 @@ class PivotSidePanelStore extends SpreadsheetStore {
|
|
|
47120
47229
|
: this.datetimeGranularities);
|
|
47121
47230
|
}
|
|
47122
47231
|
for (const field of dateFields) {
|
|
47123
|
-
granularitiesPerFields[field.fieldName].delete(field.granularity);
|
|
47232
|
+
granularitiesPerFields[field.fieldName].delete(field.granularity || "month");
|
|
47124
47233
|
}
|
|
47125
47234
|
return granularitiesPerFields;
|
|
47126
47235
|
}
|
|
@@ -49290,6 +49399,8 @@ class GridComposer extends owl.Component {
|
|
|
49290
49399
|
}
|
|
49291
49400
|
get composerProps() {
|
|
49292
49401
|
const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
|
|
49402
|
+
// Remove the wrapper border width
|
|
49403
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
49293
49404
|
return {
|
|
49294
49405
|
rect: { ...this.rect },
|
|
49295
49406
|
delimitation: {
|
|
@@ -49307,6 +49418,7 @@ class GridComposer extends owl.Component {
|
|
|
49307
49418
|
}),
|
|
49308
49419
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
49309
49420
|
composerStore: this.composerStore,
|
|
49421
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
49310
49422
|
};
|
|
49311
49423
|
}
|
|
49312
49424
|
get containerStyle() {
|
|
@@ -54569,7 +54681,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
54569
54681
|
case "CREATE_CHART":
|
|
54570
54682
|
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
54571
54683
|
case "UPDATE_CHART":
|
|
54572
|
-
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
54684
|
+
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
54573
54685
|
default:
|
|
54574
54686
|
return "Success" /* CommandResult.Success */;
|
|
54575
54687
|
}
|
|
@@ -54724,9 +54836,12 @@ class ChartPlugin extends CorePlugin {
|
|
|
54724
54836
|
: "Success" /* CommandResult.Success */;
|
|
54725
54837
|
}
|
|
54726
54838
|
checkChartExists(cmd) {
|
|
54727
|
-
return this.
|
|
54728
|
-
|
|
54729
|
-
|
|
54839
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
54840
|
+
}
|
|
54841
|
+
checkChartChanged(cmd) {
|
|
54842
|
+
return deepEquals(this.getChartDefinition(cmd.id), cmd.definition)
|
|
54843
|
+
? "NoChanges" /* CommandResult.NoChanges */
|
|
54844
|
+
: "Success" /* CommandResult.Success */;
|
|
54730
54845
|
}
|
|
54731
54846
|
}
|
|
54732
54847
|
|
|
@@ -57045,6 +57160,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
57045
57160
|
"getCommandZones",
|
|
57046
57161
|
"getUnboundedZone",
|
|
57047
57162
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
57163
|
+
"getDuplicateSheetName",
|
|
57048
57164
|
];
|
|
57049
57165
|
sheetIdsMapName = {};
|
|
57050
57166
|
orderedSheetIds = [];
|
|
@@ -57069,7 +57185,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
57069
57185
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
57070
57186
|
}
|
|
57071
57187
|
case "DUPLICATE_SHEET": {
|
|
57072
|
-
|
|
57188
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
57189
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
57190
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
57191
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
57192
|
+
return "Success" /* CommandResult.Success */;
|
|
57073
57193
|
}
|
|
57074
57194
|
case "MOVE_SHEET":
|
|
57075
57195
|
try {
|
|
@@ -57146,7 +57266,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
57146
57266
|
this.showSheet(cmd.sheetId);
|
|
57147
57267
|
break;
|
|
57148
57268
|
case "DUPLICATE_SHEET":
|
|
57149
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
57269
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
57150
57270
|
break;
|
|
57151
57271
|
case "DELETE_SHEET":
|
|
57152
57272
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -57353,10 +57473,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
57353
57473
|
}
|
|
57354
57474
|
getNextSheetName(baseName = "Sheet") {
|
|
57355
57475
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
57356
|
-
return
|
|
57357
|
-
compute: (name, i) => `${name}${i}`,
|
|
57358
|
-
computeFirstOne: true,
|
|
57359
|
-
});
|
|
57476
|
+
return getNextSheetName(names, baseName);
|
|
57360
57477
|
}
|
|
57361
57478
|
getSheetSize(sheetId) {
|
|
57362
57479
|
return {
|
|
@@ -57602,9 +57719,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
57602
57719
|
showSheet(sheetId) {
|
|
57603
57720
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
57604
57721
|
}
|
|
57605
|
-
duplicateSheet(fromId, toId) {
|
|
57722
|
+
duplicateSheet(fromId, toId, toName) {
|
|
57606
57723
|
const sheet = this.getSheet(fromId);
|
|
57607
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
57608
57724
|
const newSheet = deepCopy(sheet);
|
|
57609
57725
|
newSheet.id = toId;
|
|
57610
57726
|
newSheet.name = toName;
|
|
@@ -57637,8 +57753,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
57637
57753
|
}
|
|
57638
57754
|
getDuplicateSheetName(sheetName) {
|
|
57639
57755
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
57640
|
-
|
|
57641
|
-
return getUniqueText(baseName.toString(), names);
|
|
57756
|
+
return getDuplicateSheetName(sheetName, names);
|
|
57642
57757
|
}
|
|
57643
57758
|
deleteSheet(sheet) {
|
|
57644
57759
|
const name = sheet.name;
|
|
@@ -60433,8 +60548,8 @@ class SpreadingRelation {
|
|
|
60433
60548
|
const EMPTY_ARRAY = [];
|
|
60434
60549
|
|
|
60435
60550
|
const MAX_ITERATION = 30;
|
|
60436
|
-
const ERROR_CYCLE_CELL = createEvaluatedCell(new CircularDependencyError());
|
|
60437
|
-
const EMPTY_CELL = createEvaluatedCell({ value: null });
|
|
60551
|
+
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
60552
|
+
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
60438
60553
|
class Evaluator {
|
|
60439
60554
|
context;
|
|
60440
60555
|
getters;
|
|
@@ -71739,11 +71854,13 @@ class Spreadsheet extends owl.Component {
|
|
|
71739
71854
|
this.checkViewportSize();
|
|
71740
71855
|
stores.on("store-updated", this, render);
|
|
71741
71856
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
71857
|
+
registerChartJSExtensions();
|
|
71742
71858
|
});
|
|
71743
71859
|
owl.onWillUnmount(() => {
|
|
71744
71860
|
this.unbindModelEvents();
|
|
71745
71861
|
stores.off("store-updated", this);
|
|
71746
71862
|
resizeObserver.disconnect();
|
|
71863
|
+
unregisterChartJsExtensions();
|
|
71747
71864
|
});
|
|
71748
71865
|
owl.onPatched(() => {
|
|
71749
71866
|
this.checkViewportSize();
|
|
@@ -76270,6 +76387,6 @@ exports.tokenColors = tokenColors;
|
|
|
76270
76387
|
exports.tokenize = tokenize;
|
|
76271
76388
|
|
|
76272
76389
|
|
|
76273
|
-
__info__.version = "18.2.
|
|
76274
|
-
__info__.date = "2025-05-
|
|
76275
|
-
__info__.hash = "
|
|
76390
|
+
__info__.version = "18.2.11";
|
|
76391
|
+
__info__.date = "2025-05-12T05:25:59.138Z";
|
|
76392
|
+
__info__.hash = "eb87dca";
|
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;
|
|
@@ -2519,6 +2518,7 @@ interface DeleteSheetCommand extends SheetDependentCommand {
|
|
|
2519
2518
|
interface DuplicateSheetCommand extends SheetDependentCommand {
|
|
2520
2519
|
type: "DUPLICATE_SHEET";
|
|
2521
2520
|
sheetIdTo: UID;
|
|
2521
|
+
sheetNameTo: string;
|
|
2522
2522
|
}
|
|
2523
2523
|
interface MoveSheetCommand extends SheetDependentCommand {
|
|
2524
2524
|
type: "MOVE_SHEET";
|
|
@@ -4435,6 +4435,7 @@ declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
|
|
|
4435
4435
|
private addChart;
|
|
4436
4436
|
private checkChartDuplicate;
|
|
4437
4437
|
private checkChartExists;
|
|
4438
|
+
private checkChartChanged;
|
|
4438
4439
|
}
|
|
4439
4440
|
|
|
4440
4441
|
interface ConditionalFormatState {
|
|
@@ -4854,7 +4855,7 @@ interface SheetState {
|
|
|
4854
4855
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
4855
4856
|
}
|
|
4856
4857
|
declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
4857
|
-
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"];
|
|
4858
|
+
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"];
|
|
4858
4859
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
4859
4860
|
readonly orderedSheetIds: UID[];
|
|
4860
4861
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -4931,7 +4932,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4931
4932
|
private hideSheet;
|
|
4932
4933
|
private showSheet;
|
|
4933
4934
|
private duplicateSheet;
|
|
4934
|
-
|
|
4935
|
+
getDuplicateSheetName(sheetName: string): string;
|
|
4935
4936
|
private deleteSheet;
|
|
4936
4937
|
/**
|
|
4937
4938
|
* Delete column. This requires a lot of handling:
|
|
@@ -8286,6 +8287,7 @@ declare class Composer extends Component<CellComposerProps, SpreadsheetChildEnv>
|
|
|
8286
8287
|
onContextMenu(ev: MouseEvent): void;
|
|
8287
8288
|
closeAssistant(): void;
|
|
8288
8289
|
openAssistant(): void;
|
|
8290
|
+
onWheel(event: WheelEvent): void;
|
|
8289
8291
|
private processContent;
|
|
8290
8292
|
/**
|
|
8291
8293
|
* Get the HTML content corresponding to the current composer token, divided by lines.
|
|
@@ -12689,7 +12691,10 @@ declare const registries: {
|
|
|
12689
12691
|
supportedPivotPositionalFormulaRegistry: Registry<boolean>;
|
|
12690
12692
|
pivotToFunctionValueRegistry: Registry<(value: CellValue, granularity?: string | undefined) => string>;
|
|
12691
12693
|
migrationStepRegistry: Registry<MigrationStep>;
|
|
12692
|
-
chartJsExtensionRegistry: Registry<
|
|
12694
|
+
chartJsExtensionRegistry: Registry<{
|
|
12695
|
+
register: (chart: typeof chart_js.Chart) => void;
|
|
12696
|
+
unregister: (chart: typeof chart_js.Chart) => void;
|
|
12697
|
+
}>;
|
|
12693
12698
|
};
|
|
12694
12699
|
declare const helpers: {
|
|
12695
12700
|
arg: typeof arg;
|