@odoo/o-spreadsheet 17.0.32 → 17.0.33
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 +64 -64
- package/dist/o-spreadsheet.d.ts +2 -1
- package/dist/o-spreadsheet.esm.js +64 -64
- package/dist/o-spreadsheet.iife.js +64 -64
- package/dist/o-spreadsheet.iife.min.js +224 -224
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +8 -11
|
@@ -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.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.33
|
|
6
|
+
* @date 2024-08-02T08:18:55.061Z
|
|
7
|
+
* @hash 4ad4049
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -593,7 +593,7 @@
|
|
|
593
593
|
let timeout;
|
|
594
594
|
return function () {
|
|
595
595
|
const context = this;
|
|
596
|
-
const args = arguments;
|
|
596
|
+
const args = Array.from(arguments);
|
|
597
597
|
function later() {
|
|
598
598
|
timeout = null;
|
|
599
599
|
if (!immediate) {
|
|
@@ -796,7 +796,7 @@
|
|
|
796
796
|
*/
|
|
797
797
|
function largeMax(array) {
|
|
798
798
|
let len = array.length;
|
|
799
|
-
if (len <
|
|
799
|
+
if (len < 100_000)
|
|
800
800
|
return Math.max(...array);
|
|
801
801
|
let max = -Infinity;
|
|
802
802
|
while (len--) {
|
|
@@ -810,7 +810,7 @@
|
|
|
810
810
|
*/
|
|
811
811
|
function largeMin(array) {
|
|
812
812
|
let len = array.length;
|
|
813
|
-
if (len <
|
|
813
|
+
if (len < 100_000)
|
|
814
814
|
return Math.min(...array);
|
|
815
815
|
let min = +Infinity;
|
|
816
816
|
while (len--) {
|
|
@@ -2565,13 +2565,16 @@
|
|
|
2565
2565
|
}
|
|
2566
2566
|
return new RegExp("^" + exp + "$", "i");
|
|
2567
2567
|
}
|
|
2568
|
-
function evaluatePredicate(value = "", criterion) {
|
|
2568
|
+
function evaluatePredicate(value = "", criterion, locale) {
|
|
2569
2569
|
const { operator, operand } = criterion;
|
|
2570
2570
|
if (operand === undefined || value === null || operand === null) {
|
|
2571
2571
|
return false;
|
|
2572
2572
|
}
|
|
2573
2573
|
if (typeof operand === "number" && operator === "=") {
|
|
2574
|
-
|
|
2574
|
+
if (typeof value === "string" && (isNumber(value, locale) || isDateTime(value, locale))) {
|
|
2575
|
+
return toNumber(value, locale) === operand;
|
|
2576
|
+
}
|
|
2577
|
+
return value === operand;
|
|
2575
2578
|
}
|
|
2576
2579
|
if (operator === "<>" || operator === "=") {
|
|
2577
2580
|
let result;
|
|
@@ -2650,7 +2653,7 @@
|
|
|
2650
2653
|
for (let k = 0; k < countArg - 1; k += 2) {
|
|
2651
2654
|
const criteriaValue = args[k][i][j];
|
|
2652
2655
|
const criterion = predicates[k / 2];
|
|
2653
|
-
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion);
|
|
2656
|
+
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion, locale);
|
|
2654
2657
|
if (!validatedPredicates) {
|
|
2655
2658
|
break;
|
|
2656
2659
|
}
|
|
@@ -5899,7 +5902,7 @@
|
|
|
5899
5902
|
function numberCell(value, localeFormat) {
|
|
5900
5903
|
return {
|
|
5901
5904
|
type: CellValueType.number,
|
|
5902
|
-
value: value || 0,
|
|
5905
|
+
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
5903
5906
|
format: localeFormat.format,
|
|
5904
5907
|
isAutoSummable: true,
|
|
5905
5908
|
defaultAlign: "right",
|
|
@@ -8432,8 +8435,8 @@
|
|
|
8432
8435
|
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
|
|
8433
8436
|
const options = {
|
|
8434
8437
|
// https://www.chartjs.org/docs/latest/general/responsive.html
|
|
8435
|
-
responsive: true,
|
|
8436
|
-
maintainAspectRatio: false,
|
|
8438
|
+
responsive: true, // will resize when its container is resized
|
|
8439
|
+
maintainAspectRatio: false, // doesn't maintain the aspect ration (width/height =2 by default) so the user has the choice of the exact layout
|
|
8437
8440
|
layout: {
|
|
8438
8441
|
padding: { left: 20, right: 20, top: chart.title ? 10 : 25, bottom: 10 },
|
|
8439
8442
|
},
|
|
@@ -8742,7 +8745,7 @@
|
|
|
8742
8745
|
},
|
|
8743
8746
|
y: {
|
|
8744
8747
|
position: chart.verticalAxisPosition,
|
|
8745
|
-
beginAtZero: true,
|
|
8748
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
8746
8749
|
ticks: {
|
|
8747
8750
|
color: fontColor,
|
|
8748
8751
|
callback: (value) => {
|
|
@@ -9396,7 +9399,7 @@
|
|
|
9396
9399
|
},
|
|
9397
9400
|
y: {
|
|
9398
9401
|
position: chart.verticalAxisPosition,
|
|
9399
|
-
beginAtZero: true,
|
|
9402
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
9400
9403
|
ticks: {
|
|
9401
9404
|
color: fontColor,
|
|
9402
9405
|
callback: (value) => {
|
|
@@ -9484,7 +9487,7 @@
|
|
|
9484
9487
|
const dataset = {
|
|
9485
9488
|
label,
|
|
9486
9489
|
data,
|
|
9487
|
-
tension: 0,
|
|
9490
|
+
tension: 0, // 0 -> render straight lines, which is much faster
|
|
9488
9491
|
borderColor: color,
|
|
9489
9492
|
backgroundColor,
|
|
9490
9493
|
pointBackgroundColor: color,
|
|
@@ -9595,7 +9598,7 @@
|
|
|
9595
9598
|
...this.getDefinition(),
|
|
9596
9599
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
9597
9600
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
9598
|
-
verticalAxisPosition: "left",
|
|
9601
|
+
verticalAxisPosition: "left", //TODO ExcelChartDefinition should be adapted, but can be done later
|
|
9599
9602
|
dataSets,
|
|
9600
9603
|
labelRange,
|
|
9601
9604
|
};
|
|
@@ -26699,7 +26702,9 @@
|
|
|
26699
26702
|
argToFocus: 0,
|
|
26700
26703
|
});
|
|
26701
26704
|
compositionActive = false;
|
|
26705
|
+
spreadsheetRect = useSpreadsheetRect();
|
|
26702
26706
|
get assistantStyle() {
|
|
26707
|
+
const composerRect = this.composerRef.el.getBoundingClientRect();
|
|
26703
26708
|
const assistantStyle = {};
|
|
26704
26709
|
assistantStyle["min-width"] = `${this.props.rect?.width || ASSISTANT_WIDTH}px`;
|
|
26705
26710
|
if (this.autoCompleteState.type === "function") {
|
|
@@ -26722,6 +26727,10 @@
|
|
|
26722
26727
|
assistantStyle.right = `0px`;
|
|
26723
26728
|
}
|
|
26724
26729
|
}
|
|
26730
|
+
if (this.props.focus === "contentFocus" &&
|
|
26731
|
+
composerRect.left + ASSISTANT_WIDTH > this.spreadsheetRect.width) {
|
|
26732
|
+
assistantStyle.right = "0px";
|
|
26733
|
+
}
|
|
26725
26734
|
return cssPropertiesToCss(assistantStyle);
|
|
26726
26735
|
}
|
|
26727
26736
|
// we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
|
|
@@ -29580,7 +29589,7 @@
|
|
|
29580
29589
|
onScroll(offset) {
|
|
29581
29590
|
const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
29582
29591
|
this.env.model.dispatch("SET_VIEWPORT_OFFSET", {
|
|
29583
|
-
offsetX: scrollX,
|
|
29592
|
+
offsetX: scrollX, // offsetX is the same
|
|
29584
29593
|
offsetY: offset,
|
|
29585
29594
|
});
|
|
29586
29595
|
}
|
|
@@ -29791,8 +29800,8 @@
|
|
|
29791
29800
|
"CTRL+SHIFT+L": () => this.setHorizontalAlign("left"),
|
|
29792
29801
|
"CTRL+SHIFT+R": () => this.setHorizontalAlign("right"),
|
|
29793
29802
|
"CTRL+SHIFT+V": () => PASTE_VALUE_ACTION(this.env),
|
|
29794
|
-
"CTRL+SHIFT+<": () => this.clearFormatting(),
|
|
29795
|
-
"CTRL+<": () => this.clearFormatting(),
|
|
29803
|
+
"CTRL+SHIFT+<": () => this.clearFormatting(), // for qwerty
|
|
29804
|
+
"CTRL+<": () => this.clearFormatting(), // for azerty
|
|
29796
29805
|
"CTRL+SHIFT+ ": () => {
|
|
29797
29806
|
this.env.model.selection.selectAll();
|
|
29798
29807
|
},
|
|
@@ -30606,10 +30615,10 @@
|
|
|
30606
30615
|
const CF_TYPE_CONVERSION_MAP = {
|
|
30607
30616
|
aboveAverage: undefined,
|
|
30608
30617
|
expression: undefined,
|
|
30609
|
-
cellIs: undefined,
|
|
30610
|
-
colorScale: undefined,
|
|
30618
|
+
cellIs: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30619
|
+
colorScale: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30611
30620
|
dataBar: undefined,
|
|
30612
|
-
iconSet: undefined,
|
|
30621
|
+
iconSet: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30613
30622
|
top10: undefined,
|
|
30614
30623
|
uniqueValues: undefined,
|
|
30615
30624
|
duplicateValues: undefined,
|
|
@@ -30844,7 +30853,7 @@
|
|
|
30844
30853
|
61: "993366",
|
|
30845
30854
|
62: "333399",
|
|
30846
30855
|
63: "333333",
|
|
30847
|
-
64: "000000",
|
|
30856
|
+
64: "000000", // system foreground
|
|
30848
30857
|
65: "FFFFFF", // system background
|
|
30849
30858
|
};
|
|
30850
30859
|
const IMAGE_MIMETYPE_TO_EXTENSION_MAPPING = {
|
|
@@ -34485,12 +34494,13 @@
|
|
|
34485
34494
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
34486
34495
|
break;
|
|
34487
34496
|
case "REMOVE_COLUMNS_ROWS":
|
|
34488
|
-
|
|
34497
|
+
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
34498
|
+
for (const group of groupConsecutive(elements)) {
|
|
34489
34499
|
if (cmd.dimension === "COL") {
|
|
34490
|
-
this.shiftBordersHorizontally(cmd.sheetId,
|
|
34500
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34491
34501
|
}
|
|
34492
34502
|
else {
|
|
34493
|
-
this.shiftBordersVertically(cmd.sheetId,
|
|
34503
|
+
this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34494
34504
|
}
|
|
34495
34505
|
}
|
|
34496
34506
|
break;
|
|
@@ -39551,12 +39561,7 @@
|
|
|
39551
39561
|
});
|
|
39552
39562
|
}
|
|
39553
39563
|
if (colIndex > deletedColumn) {
|
|
39554
|
-
this.
|
|
39555
|
-
sheetId: sheet.id,
|
|
39556
|
-
cellId: cellId,
|
|
39557
|
-
col: colIndex - 1,
|
|
39558
|
-
row: rowIndex,
|
|
39559
|
-
});
|
|
39564
|
+
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
39560
39565
|
}
|
|
39561
39566
|
}
|
|
39562
39567
|
}
|
|
@@ -39566,7 +39571,7 @@
|
|
|
39566
39571
|
* Move the cells after a column or rows insertion
|
|
39567
39572
|
*/
|
|
39568
39573
|
moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
|
|
39569
|
-
const
|
|
39574
|
+
const updates = [];
|
|
39570
39575
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39571
39576
|
const row = sheet.rows[rowIndex];
|
|
39572
39577
|
if (dimension !== "rows" || rowIndex >= addedElement) {
|
|
@@ -39575,20 +39580,20 @@
|
|
|
39575
39580
|
const cellId = row.cells[i];
|
|
39576
39581
|
if (cellId) {
|
|
39577
39582
|
if (dimension === "rows" || colIndex >= addedElement) {
|
|
39578
|
-
|
|
39579
|
-
type: "UPDATE_CELL_POSITION",
|
|
39583
|
+
updates.push({
|
|
39580
39584
|
sheetId: sheet.id,
|
|
39581
39585
|
cellId: cellId,
|
|
39582
39586
|
col: colIndex + (dimension === "columns" ? quantity : 0),
|
|
39583
39587
|
row: rowIndex + (dimension === "rows" ? quantity : 0),
|
|
39588
|
+
type: "UPDATE_CELL_POSITION",
|
|
39584
39589
|
});
|
|
39585
39590
|
}
|
|
39586
39591
|
}
|
|
39587
39592
|
}
|
|
39588
39593
|
}
|
|
39589
39594
|
}
|
|
39590
|
-
for (let
|
|
39591
|
-
this.
|
|
39595
|
+
for (let update of updates.reverse()) {
|
|
39596
|
+
this.updateCellPosition(update);
|
|
39592
39597
|
}
|
|
39593
39598
|
}
|
|
39594
39599
|
/**
|
|
@@ -39621,12 +39626,7 @@
|
|
|
39621
39626
|
const colIndex = Number(i);
|
|
39622
39627
|
const cellId = row.cells[i];
|
|
39623
39628
|
if (cellId) {
|
|
39624
|
-
this.
|
|
39625
|
-
sheetId: sheet.id,
|
|
39626
|
-
cellId: cellId,
|
|
39627
|
-
col: colIndex,
|
|
39628
|
-
row: rowIndex - numberRows,
|
|
39629
|
-
});
|
|
39629
|
+
this.setNewPosition(cellId, sheet.id, colIndex, rowIndex - numberRows);
|
|
39630
39630
|
}
|
|
39631
39631
|
}
|
|
39632
39632
|
}
|
|
@@ -42239,17 +42239,17 @@
|
|
|
42239
42239
|
*/
|
|
42240
42240
|
function sortWithClusters(colorsToSort) {
|
|
42241
42241
|
const clusters = [
|
|
42242
|
-
{ leadColor: rgba(255, 0, 0), colors: [] },
|
|
42243
|
-
{ leadColor: rgba(255, 128, 0), colors: [] },
|
|
42244
|
-
{ leadColor: rgba(128, 128, 0), colors: [] },
|
|
42245
|
-
{ leadColor: rgba(128, 255, 0), colors: [] },
|
|
42246
|
-
{ leadColor: rgba(0, 255, 0), colors: [] },
|
|
42247
|
-
{ leadColor: rgba(0, 255, 128), colors: [] },
|
|
42248
|
-
{ leadColor: rgba(0, 255, 255), colors: [] },
|
|
42249
|
-
{ leadColor: rgba(0, 127, 255), colors: [] },
|
|
42250
|
-
{ leadColor: rgba(0, 0, 255), colors: [] },
|
|
42251
|
-
{ leadColor: rgba(127, 0, 255), colors: [] },
|
|
42252
|
-
{ leadColor: rgba(128, 0, 128), colors: [] },
|
|
42242
|
+
{ leadColor: rgba(255, 0, 0), colors: [] }, // red
|
|
42243
|
+
{ leadColor: rgba(255, 128, 0), colors: [] }, // orange
|
|
42244
|
+
{ leadColor: rgba(128, 128, 0), colors: [] }, // yellow
|
|
42245
|
+
{ leadColor: rgba(128, 255, 0), colors: [] }, // chartreuse
|
|
42246
|
+
{ leadColor: rgba(0, 255, 0), colors: [] }, // green
|
|
42247
|
+
{ leadColor: rgba(0, 255, 128), colors: [] }, // spring green
|
|
42248
|
+
{ leadColor: rgba(0, 255, 255), colors: [] }, // cyan
|
|
42249
|
+
{ leadColor: rgba(0, 127, 255), colors: [] }, // azure
|
|
42250
|
+
{ leadColor: rgba(0, 0, 255), colors: [] }, // blue
|
|
42251
|
+
{ leadColor: rgba(127, 0, 255), colors: [] }, // violet
|
|
42252
|
+
{ leadColor: rgba(128, 0, 128), colors: [] }, // magenta
|
|
42253
42253
|
{ leadColor: rgba(255, 0, 128), colors: [] }, // rose
|
|
42254
42254
|
];
|
|
42255
42255
|
for (const color of colorsToSort.map(colorToRGBA)) {
|
|
@@ -52159,7 +52159,7 @@
|
|
|
52159
52159
|
.map((sheetEl) => sheetEl.getBoundingClientRect())
|
|
52160
52160
|
.map((rect) => ({
|
|
52161
52161
|
x: rect.x,
|
|
52162
|
-
width: rect.width - 1,
|
|
52162
|
+
width: rect.width - 1, // -1 to compensate negative margin
|
|
52163
52163
|
y: rect.y,
|
|
52164
52164
|
height: rect.height,
|
|
52165
52165
|
}));
|
|
@@ -52384,7 +52384,7 @@
|
|
|
52384
52384
|
}
|
|
52385
52385
|
return cssPropertiesToCss({
|
|
52386
52386
|
top: `${groupBox.headerRect.height / 2}px`,
|
|
52387
|
-
left: `calc(50% - 1px)`,
|
|
52387
|
+
left: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52388
52388
|
width: `30%`,
|
|
52389
52389
|
height: `calc(100% - ${groupBox.headerRect.height / 2}px)`,
|
|
52390
52390
|
"border-left": `1px solid ${HEADER_GROUPING_BORDER_COLOR}`,
|
|
@@ -52436,7 +52436,7 @@
|
|
|
52436
52436
|
return "";
|
|
52437
52437
|
}
|
|
52438
52438
|
return cssPropertiesToCss({
|
|
52439
|
-
top: `calc(50% - 1px)`,
|
|
52439
|
+
top: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52440
52440
|
left: `${groupBox.headerRect.width / 2}px`,
|
|
52441
52441
|
width: `calc(100% - ${groupBox.headerRect.width / 2}px)`,
|
|
52442
52442
|
height: `30%`,
|
|
@@ -53837,7 +53837,7 @@
|
|
|
53837
53837
|
const gridColSize = GROUP_LAYER_WIDTH * this.rowLayers.length;
|
|
53838
53838
|
const gridRowSize = GROUP_LAYER_WIDTH * this.colLayers.length;
|
|
53839
53839
|
return cssPropertiesToCss({
|
|
53840
|
-
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`,
|
|
53840
|
+
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`, // +2: margins
|
|
53841
53841
|
"grid-template-rows": `${gridRowSize ? gridRowSize + 2 : 0}px auto`,
|
|
53842
53842
|
});
|
|
53843
53843
|
}
|
|
@@ -55340,7 +55340,7 @@
|
|
|
55340
55340
|
}
|
|
55341
55341
|
|
|
55342
55342
|
class StateObserver {
|
|
55343
|
-
changes
|
|
55343
|
+
changes;
|
|
55344
55344
|
commands = [];
|
|
55345
55345
|
/**
|
|
55346
55346
|
* Record the changes which could happen in the given callback, save them in a
|
|
@@ -55372,7 +55372,7 @@
|
|
|
55372
55372
|
if (value[key] === val) {
|
|
55373
55373
|
return;
|
|
55374
55374
|
}
|
|
55375
|
-
this.changes
|
|
55375
|
+
this.changes?.push({
|
|
55376
55376
|
path: args,
|
|
55377
55377
|
before: value[key],
|
|
55378
55378
|
after: val,
|
|
@@ -56503,7 +56503,7 @@
|
|
|
56503
56503
|
const colHeaderXc = toXC(tableZone.left + i, tableZone.top);
|
|
56504
56504
|
const colName = sheetData.cells[colHeaderXc]?.content || `col${i}`;
|
|
56505
56505
|
const colAttributes = [
|
|
56506
|
-
["id", i + 1],
|
|
56506
|
+
["id", i + 1], // id cannot be 0
|
|
56507
56507
|
["name", colName],
|
|
56508
56508
|
];
|
|
56509
56509
|
columns.push(escapeXml /*xml*/ `<tableColumn ${formatAttributes(colAttributes)}/>`);
|
|
@@ -57585,9 +57585,9 @@
|
|
|
57585
57585
|
exports.tokenize = tokenize;
|
|
57586
57586
|
|
|
57587
57587
|
|
|
57588
|
-
__info__.version = "17.0.
|
|
57589
|
-
__info__.date = "2024-
|
|
57590
|
-
__info__.hash = "
|
|
57588
|
+
__info__.version = "17.0.33";
|
|
57589
|
+
__info__.date = "2024-08-02T08:18:55.061Z";
|
|
57590
|
+
__info__.hash = "4ad4049";
|
|
57591
57591
|
|
|
57592
57592
|
|
|
57593
57593
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|