@odoo/o-spreadsheet 19.0.1 → 19.0.4
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 +103 -28
- package/dist/o-spreadsheet.esm.js +103 -28
- package/dist/o-spreadsheet.iife.js +103 -28
- package/dist/o-spreadsheet.iife.min.js +7 -7
- package/dist/o_spreadsheet.xml +32 -6
- package/package.json +15 -2
|
@@ -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 19.0.
|
|
6
|
-
* @date 2025-09-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.0.4
|
|
6
|
+
* @date 2025-09-23T12:37:28.362Z
|
|
7
|
+
* @hash 87b774d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -889,6 +889,7 @@
|
|
|
889
889
|
ARG_SEPARATOR: functionColor,
|
|
890
890
|
ORPHAN_RIGHT_PAREN: "#ff0000",
|
|
891
891
|
};
|
|
892
|
+
const DRAG_THRESHOLD = 5; // in pixels, to avoid unwanted drag when clicking
|
|
892
893
|
|
|
893
894
|
//------------------------------------------------------------------------------
|
|
894
895
|
// Miscellaneous
|
|
@@ -1367,8 +1368,19 @@
|
|
|
1367
1368
|
},
|
|
1368
1369
|
}[funcName];
|
|
1369
1370
|
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Removes the specified indexes from the array.
|
|
1373
|
+
* Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
|
|
1374
|
+
*/
|
|
1370
1375
|
function removeIndexesFromArray(array, indexes) {
|
|
1371
|
-
|
|
1376
|
+
const toRemove = new Set(indexes);
|
|
1377
|
+
const newArray = [];
|
|
1378
|
+
for (let i = 0; i < array.length; i++) {
|
|
1379
|
+
if (!toRemove.has(i)) {
|
|
1380
|
+
newArray.push(array[i]);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return newArray;
|
|
1372
1384
|
}
|
|
1373
1385
|
function insertItemsAtIndex(array, items, index) {
|
|
1374
1386
|
const newArray = [...array];
|
|
@@ -16083,8 +16095,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
16083
16095
|
}
|
|
16084
16096
|
|
|
16085
16097
|
function sortMatrix(matrix, locale, ...criteria) {
|
|
16086
|
-
for (
|
|
16087
|
-
|
|
16098
|
+
for (let i = 0; i < criteria.length; i++) {
|
|
16099
|
+
const param = i % 2 === 0 ? "sort_column" : "is_ascending";
|
|
16100
|
+
assert(criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
|
|
16088
16101
|
}
|
|
16089
16102
|
const sortingOrders = [];
|
|
16090
16103
|
const sortColumns = [];
|
|
@@ -26759,7 +26772,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26759
26772
|
},
|
|
26760
26773
|
pointLabels: {
|
|
26761
26774
|
color: chartFontColor(definition.background),
|
|
26762
|
-
callback: truncateLabel,
|
|
26775
|
+
callback: (label) => truncateLabel(label),
|
|
26763
26776
|
},
|
|
26764
26777
|
suggestedMin: minValue < 0 ? minValue - 1 : 0,
|
|
26765
26778
|
},
|
|
@@ -32379,7 +32392,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32379
32392
|
onFigureDeleted: Function,
|
|
32380
32393
|
editFigureStyle: { type: Function, optional: true },
|
|
32381
32394
|
};
|
|
32382
|
-
static components = { ChartDashboardMenu };
|
|
32395
|
+
static components = { ChartDashboardMenu, MenuPopover };
|
|
32396
|
+
carouselTabsRef = owl.useRef("carouselTabs");
|
|
32397
|
+
carouselTabsDropdownRef = owl.useRef("carouselTabsDropdown");
|
|
32398
|
+
menuState = owl.useState({ isOpen: false, anchorRect: null, menuItems: [] });
|
|
32399
|
+
hiddenItems = [];
|
|
32383
32400
|
animationStore;
|
|
32384
32401
|
setup() {
|
|
32385
32402
|
this.animationStore = useStore(ChartAnimationStore);
|
|
@@ -32390,6 +32407,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32390
32407
|
else {
|
|
32391
32408
|
this.props.editFigureStyle?.({ "pointer-events": "auto" });
|
|
32392
32409
|
}
|
|
32410
|
+
this.updateTabsVisibility();
|
|
32393
32411
|
});
|
|
32394
32412
|
}
|
|
32395
32413
|
get carousel() {
|
|
@@ -32433,13 +32451,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32433
32451
|
}
|
|
32434
32452
|
get headerStyle() {
|
|
32435
32453
|
const cssProperties = {};
|
|
32436
|
-
if (this.selectedCarouselItem?.type === "
|
|
32437
|
-
cssProperties["background-color"] = "#ffffff";
|
|
32438
|
-
}
|
|
32439
|
-
else if (this.selectedCarouselItem?.type === "chart") {
|
|
32454
|
+
if (this.selectedCarouselItem?.type === "chart") {
|
|
32440
32455
|
const chart = this.env.model.getters.getChartRuntime(this.selectedCarouselItem.chartId);
|
|
32441
32456
|
cssProperties["background-color"] = chart.background;
|
|
32442
32457
|
}
|
|
32458
|
+
else {
|
|
32459
|
+
cssProperties["background-color"] = "#ffffff";
|
|
32460
|
+
}
|
|
32443
32461
|
return cssPropertiesToCss(cssProperties);
|
|
32444
32462
|
}
|
|
32445
32463
|
get title() {
|
|
@@ -32449,6 +32467,49 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32449
32467
|
const style = { ...DEFAULT_CAROUSEL_TITLE_STYLE, ...this.carousel.title };
|
|
32450
32468
|
return cssPropertiesToCss(cellTextStyleToCss(chartStyleToCellStyle(style)));
|
|
32451
32469
|
}
|
|
32470
|
+
updateTabsVisibility() {
|
|
32471
|
+
const tabsContainerEl = this.carouselTabsRef.el;
|
|
32472
|
+
const dropDownEl = this.carouselTabsDropdownRef.el;
|
|
32473
|
+
if (!tabsContainerEl || !dropDownEl) {
|
|
32474
|
+
return;
|
|
32475
|
+
}
|
|
32476
|
+
this.hiddenItems = [];
|
|
32477
|
+
const containerRect = getBoundingRectAsPOJO(tabsContainerEl);
|
|
32478
|
+
const tabs = Array.from(tabsContainerEl.children);
|
|
32479
|
+
for (const tab of tabs) {
|
|
32480
|
+
tab.style.display = "block";
|
|
32481
|
+
}
|
|
32482
|
+
const tabWidths = tabs.map((tab) => getBoundingRectAsPOJO(tab).width);
|
|
32483
|
+
let currentWidth = 0;
|
|
32484
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
32485
|
+
const shouldBeHidden = currentWidth + tabWidths[i] > containerRect.width;
|
|
32486
|
+
currentWidth += tabWidths[i];
|
|
32487
|
+
if (shouldBeHidden) {
|
|
32488
|
+
tabs[i].style.display = "none";
|
|
32489
|
+
this.hiddenItems.push(this.carousel.items[i]);
|
|
32490
|
+
}
|
|
32491
|
+
}
|
|
32492
|
+
dropDownEl.style.display = this.hiddenItems.length ? "block" : "none";
|
|
32493
|
+
}
|
|
32494
|
+
get menuId() {
|
|
32495
|
+
return "carousel-tabs-menu-";
|
|
32496
|
+
}
|
|
32497
|
+
toggleMenu(ev) {
|
|
32498
|
+
if (ev.closedMenuId === this.menuId) {
|
|
32499
|
+
this.menuState.isOpen = false;
|
|
32500
|
+
return;
|
|
32501
|
+
}
|
|
32502
|
+
const rect = getRefBoundingRect(this.carouselTabsDropdownRef);
|
|
32503
|
+
const menuItems = this.hiddenItems.map((item) => ({
|
|
32504
|
+
name: this.getItemTitle(item),
|
|
32505
|
+
execute: () => this.onCarouselTabClick(item),
|
|
32506
|
+
isActive: () => this.isItemSelected(item),
|
|
32507
|
+
isReadonlyAllowed: true,
|
|
32508
|
+
}));
|
|
32509
|
+
this.menuState.isOpen = true;
|
|
32510
|
+
this.menuState.anchorRect = rect;
|
|
32511
|
+
this.menuState.menuItems = createActions(menuItems);
|
|
32512
|
+
}
|
|
32452
32513
|
}
|
|
32453
32514
|
|
|
32454
32515
|
class ChartFigure extends owl.Component {
|
|
@@ -50436,9 +50497,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50436
50497
|
maxX: this.env.model.getters.getColDimensions(sheetId, this.env.model.getters.getNumberCols(sheetId) - 1).end,
|
|
50437
50498
|
maxY: this.env.model.getters.getRowDimensions(sheetId, this.env.model.getters.getNumberRows(sheetId) - 1).end,
|
|
50438
50499
|
};
|
|
50500
|
+
let hasStartedDnd = false;
|
|
50439
50501
|
const onMouseMove = (ev) => {
|
|
50440
50502
|
const getters = this.env.model.getters;
|
|
50441
50503
|
const currentMousePosition = { x: ev.clientX, y: ev.clientY };
|
|
50504
|
+
const offsetX = Math.abs(currentMousePosition.x - initialMousePosition.x);
|
|
50505
|
+
const offsetY = Math.abs(currentMousePosition.y - initialMousePosition.y);
|
|
50506
|
+
if (!hasStartedDnd && offsetX < DRAG_THRESHOLD && offsetY < DRAG_THRESHOLD) {
|
|
50507
|
+
return; // add a small threshold to avoid dnd when just clicking
|
|
50508
|
+
}
|
|
50509
|
+
hasStartedDnd = true;
|
|
50442
50510
|
const draggedFigure = dragFigureForMove(currentMousePosition, initialMousePosition, initialFigure, maxDimensions, initialScrollPosition, getters.getActiveSheetScrollInfo());
|
|
50443
50511
|
const otherFigures = this.getOtherFigures(initialFigure.id);
|
|
50444
50512
|
const overlappingCarousel = this.getCarouselOverlappingChart(draggedFigure, otherFigures);
|
|
@@ -58850,12 +58918,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58850
58918
|
addCalculatedMeasure() {
|
|
58851
58919
|
const { measures } = this.props.definition;
|
|
58852
58920
|
const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
|
|
58921
|
+
const aggregator = "sum";
|
|
58853
58922
|
this.props.onDimensionsUpdated({
|
|
58854
58923
|
measures: measures.concat([
|
|
58855
58924
|
{
|
|
58856
|
-
id: this.getMeasureId(measureName),
|
|
58925
|
+
id: this.getMeasureId(measureName, aggregator),
|
|
58857
58926
|
fieldName: measureName,
|
|
58858
|
-
aggregator
|
|
58927
|
+
aggregator,
|
|
58859
58928
|
computedBy: {
|
|
58860
58929
|
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
58861
58930
|
formula: "=0",
|
|
@@ -71160,7 +71229,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71160
71229
|
return { value: 0 };
|
|
71161
71230
|
}
|
|
71162
71231
|
const { columns, rows } = super.definition;
|
|
71163
|
-
if (columns.length + rows.length !== domain.length) {
|
|
71232
|
+
if (measure.aggregator && columns.length + rows.length !== domain.length) {
|
|
71164
71233
|
const values = this.getValuesToAggregate(measure, domain);
|
|
71165
71234
|
const aggregator = AGGREGATORS_FN[measure.aggregator];
|
|
71166
71235
|
if (!aggregator) {
|
|
@@ -71179,11 +71248,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71179
71248
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
71180
71249
|
const { colDomain } = domainToColRowDomain(this, domain);
|
|
71181
71250
|
const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
|
|
71251
|
+
if (symbolIndex === -1) {
|
|
71252
|
+
return new NotAvailableError();
|
|
71253
|
+
}
|
|
71182
71254
|
return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
|
|
71183
71255
|
}
|
|
71184
71256
|
if (rows.find((row) => row.nameWithGranularity === symbolName)) {
|
|
71185
71257
|
const { rowDomain } = domainToColRowDomain(this, domain);
|
|
71186
71258
|
const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
|
|
71259
|
+
if (symbolIndex === -1) {
|
|
71260
|
+
return new NotAvailableError();
|
|
71261
|
+
}
|
|
71187
71262
|
return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
|
|
71188
71263
|
}
|
|
71189
71264
|
return this.getPivotCellValueAndFormat(symbolName, domain);
|
|
@@ -74849,7 +74924,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74849
74924
|
return "Success" /* CommandResult.Success */;
|
|
74850
74925
|
}
|
|
74851
74926
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
74852
|
-
const arrayFormulaInZone = positions(zone).some(({ col, row }) =>
|
|
74927
|
+
const arrayFormulaInZone = positions(zone).some(({ col, row }) => {
|
|
74928
|
+
const originPosition = this.getters.getArrayFormulaSpreadingOn({ sheetId, col, row });
|
|
74929
|
+
return originPosition && !deepEquals(originPosition, { sheetId, col, row });
|
|
74930
|
+
});
|
|
74853
74931
|
return arrayFormulaInZone ? "SortZoneWithArrayFormulas" /* CommandResult.SortZoneWithArrayFormulas */ : "Success" /* CommandResult.Success */;
|
|
74854
74932
|
}
|
|
74855
74933
|
/**
|
|
@@ -77562,13 +77640,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77562
77640
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
77563
77641
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
77564
77642
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
77565
|
-
const originalSize =
|
|
77566
|
-
|
|
77567
|
-
|
|
77568
|
-
|
|
77569
|
-
const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
|
|
77570
|
-
return [element, isDefaultCol ? undefined : size];
|
|
77571
|
-
}));
|
|
77643
|
+
const originalSize = {};
|
|
77644
|
+
for (const element of toRemove) {
|
|
77645
|
+
originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
77646
|
+
}
|
|
77572
77647
|
const target = [
|
|
77573
77648
|
{
|
|
77574
77649
|
left: isCol ? start + deltaCol : 0,
|
|
@@ -77612,11 +77687,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77612
77687
|
for (const element of toRemove) {
|
|
77613
77688
|
const size = originalSize[element];
|
|
77614
77689
|
const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
|
|
77615
|
-
if (size
|
|
77690
|
+
if (size !== currentSize) {
|
|
77616
77691
|
resizingGroups[size] ??= [];
|
|
77617
77692
|
resizingGroups[size].push(currentIndex);
|
|
77618
|
-
currentIndex += 1;
|
|
77619
77693
|
}
|
|
77694
|
+
currentIndex += 1;
|
|
77620
77695
|
}
|
|
77621
77696
|
for (const size in resizingGroups) {
|
|
77622
77697
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -88456,9 +88531,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
88456
88531
|
exports.tokenize = tokenize;
|
|
88457
88532
|
|
|
88458
88533
|
|
|
88459
|
-
__info__.version = "19.0.
|
|
88460
|
-
__info__.date = "2025-09-
|
|
88461
|
-
__info__.hash = "
|
|
88534
|
+
__info__.version = "19.0.4";
|
|
88535
|
+
__info__.date = "2025-09-23T12:37:28.362Z";
|
|
88536
|
+
__info__.hash = "87b774d";
|
|
88462
88537
|
|
|
88463
88538
|
|
|
88464
88539
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|