@odoo/o-spreadsheet 17.1.25 → 17.1.27
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 +105 -84
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +105 -84
- package/dist/o-spreadsheet.iife.js +105 -84
- package/dist/o-spreadsheet.iife.min.js +250 -250
- 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.1.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.27
|
|
6
|
+
* @date 2024-08-09T12:20:52.051Z
|
|
7
|
+
* @hash c626332
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -481,7 +481,7 @@ function debounce(func, wait, immediate) {
|
|
|
481
481
|
let timeout;
|
|
482
482
|
return function () {
|
|
483
483
|
const context = this;
|
|
484
|
-
const args = arguments;
|
|
484
|
+
const args = Array.from(arguments);
|
|
485
485
|
function later() {
|
|
486
486
|
timeout = null;
|
|
487
487
|
if (!immediate) {
|
|
@@ -684,7 +684,7 @@ function isNumberBetween(value, min, max) {
|
|
|
684
684
|
*/
|
|
685
685
|
function largeMax(array) {
|
|
686
686
|
let len = array.length;
|
|
687
|
-
if (len <
|
|
687
|
+
if (len < 100_000)
|
|
688
688
|
return Math.max(...array);
|
|
689
689
|
let max = -Infinity;
|
|
690
690
|
while (len--) {
|
|
@@ -698,7 +698,7 @@ function largeMax(array) {
|
|
|
698
698
|
*/
|
|
699
699
|
function largeMin(array) {
|
|
700
700
|
let len = array.length;
|
|
701
|
-
if (len <
|
|
701
|
+
if (len < 100_000)
|
|
702
702
|
return Math.min(...array);
|
|
703
703
|
let min = +Infinity;
|
|
704
704
|
while (len--) {
|
|
@@ -2615,13 +2615,16 @@ function operandToRegExp(operand) {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
return new RegExp("^" + exp + "$", "i");
|
|
2617
2617
|
}
|
|
2618
|
-
function evaluatePredicate(value = "", criterion) {
|
|
2618
|
+
function evaluatePredicate(value = "", criterion, locale) {
|
|
2619
2619
|
const { operator, operand } = criterion;
|
|
2620
2620
|
if (operand === undefined || value === null || operand === null) {
|
|
2621
2621
|
return false;
|
|
2622
2622
|
}
|
|
2623
2623
|
if (typeof operand === "number" && operator === "=") {
|
|
2624
|
-
|
|
2624
|
+
if (typeof value === "string" && (isNumber(value, locale) || isDateTime(value, locale))) {
|
|
2625
|
+
return toNumber(value, locale) === operand;
|
|
2626
|
+
}
|
|
2627
|
+
return value === operand;
|
|
2625
2628
|
}
|
|
2626
2629
|
if (operator === "<>" || operator === "=") {
|
|
2627
2630
|
let result;
|
|
@@ -2699,7 +2702,7 @@ function visitMatchingRanges(args, cb, locale, isQuery = false) {
|
|
|
2699
2702
|
for (let k = 0; k < countArg - 1; k += 2) {
|
|
2700
2703
|
const criteriaValue = toMatrix(args[k])[i][j].value;
|
|
2701
2704
|
const criterion = predicates[k / 2];
|
|
2702
|
-
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion);
|
|
2705
|
+
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion, locale);
|
|
2703
2706
|
if (!validatedPredicates) {
|
|
2704
2707
|
break;
|
|
2705
2708
|
}
|
|
@@ -5981,7 +5984,7 @@ function textCell(value, localeFormat) {
|
|
|
5981
5984
|
function numberCell(value, localeFormat) {
|
|
5982
5985
|
return {
|
|
5983
5986
|
type: CellValueType.number,
|
|
5984
|
-
value: value || 0,
|
|
5987
|
+
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
5985
5988
|
format: localeFormat.format,
|
|
5986
5989
|
isAutoSummable: true,
|
|
5987
5990
|
defaultAlign: "right",
|
|
@@ -8472,8 +8475,8 @@ function truncateLabel(label) {
|
|
|
8472
8475
|
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
|
|
8473
8476
|
const options = {
|
|
8474
8477
|
// https://www.chartjs.org/docs/latest/general/responsive.html
|
|
8475
|
-
responsive: true,
|
|
8476
|
-
maintainAspectRatio: false,
|
|
8478
|
+
responsive: true, // will resize when its container is resized
|
|
8479
|
+
maintainAspectRatio: false, // doesn't maintain the aspect ration (width/height =2 by default) so the user has the choice of the exact layout
|
|
8477
8480
|
layout: {
|
|
8478
8481
|
padding: { left: 20, right: 20, top: chart.title ? 10 : 25, bottom: 10 },
|
|
8479
8482
|
},
|
|
@@ -8519,7 +8522,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
|
|
|
8519
8522
|
labels: truncateLabels ? labels.map(truncateLabel) : labels,
|
|
8520
8523
|
datasets: [],
|
|
8521
8524
|
},
|
|
8522
|
-
platform: undefined,
|
|
8525
|
+
platform: undefined, // This key is optional and will be set by chart.js
|
|
8523
8526
|
plugins: [],
|
|
8524
8527
|
};
|
|
8525
8528
|
}
|
|
@@ -8783,7 +8786,7 @@ function getBarConfiguration(chart, labels, localeFormat) {
|
|
|
8783
8786
|
},
|
|
8784
8787
|
y: {
|
|
8785
8788
|
position: chart.verticalAxisPosition,
|
|
8786
|
-
beginAtZero: true,
|
|
8789
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
8787
8790
|
ticks: {
|
|
8788
8791
|
color: fontColor,
|
|
8789
8792
|
callback: (value) => {
|
|
@@ -9437,7 +9440,7 @@ function getLineConfiguration(chart, labels, options) {
|
|
|
9437
9440
|
},
|
|
9438
9441
|
y: {
|
|
9439
9442
|
position: chart.verticalAxisPosition,
|
|
9440
|
-
beginAtZero: true,
|
|
9443
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
9441
9444
|
ticks: {
|
|
9442
9445
|
color: fontColor,
|
|
9443
9446
|
callback: (value) => {
|
|
@@ -9525,7 +9528,7 @@ function createLineChartRuntime(chart, getters) {
|
|
|
9525
9528
|
const dataset = {
|
|
9526
9529
|
label,
|
|
9527
9530
|
data,
|
|
9528
|
-
tension: 0,
|
|
9531
|
+
tension: 0, // 0 -> render straight lines, which is much faster
|
|
9529
9532
|
borderColor: color,
|
|
9530
9533
|
backgroundColor,
|
|
9531
9534
|
pointBackgroundColor: color,
|
|
@@ -9636,7 +9639,7 @@ class PieChart extends AbstractChart {
|
|
|
9636
9639
|
...this.getDefinition(),
|
|
9637
9640
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
9638
9641
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
9639
|
-
verticalAxisPosition: "left",
|
|
9642
|
+
verticalAxisPosition: "left", //TODO ExcelChartDefinition should be adapted, but can be done later
|
|
9640
9643
|
dataSets,
|
|
9641
9644
|
labelRange,
|
|
9642
9645
|
};
|
|
@@ -27203,7 +27206,9 @@ class Composer extends owl.Component {
|
|
|
27203
27206
|
argToFocus: 0,
|
|
27204
27207
|
});
|
|
27205
27208
|
compositionActive = false;
|
|
27209
|
+
spreadsheetRect = useSpreadsheetRect();
|
|
27206
27210
|
get assistantStyle() {
|
|
27211
|
+
const composerRect = this.composerRef.el.getBoundingClientRect();
|
|
27207
27212
|
const assistantStyle = {};
|
|
27208
27213
|
assistantStyle["min-width"] = `${this.props.rect?.width || ASSISTANT_WIDTH}px`;
|
|
27209
27214
|
if (this.autoCompleteState.type === "function") {
|
|
@@ -27226,6 +27231,10 @@ class Composer extends owl.Component {
|
|
|
27226
27231
|
assistantStyle.right = `0px`;
|
|
27227
27232
|
}
|
|
27228
27233
|
}
|
|
27234
|
+
if (this.props.focus === "contentFocus" &&
|
|
27235
|
+
composerRect.left + ASSISTANT_WIDTH > this.spreadsheetRect.width) {
|
|
27236
|
+
assistantStyle.right = "0px";
|
|
27237
|
+
}
|
|
27229
27238
|
return cssPropertiesToCss(assistantStyle);
|
|
27230
27239
|
}
|
|
27231
27240
|
// we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
|
|
@@ -30059,7 +30068,7 @@ class VerticalScrollBar extends owl.Component {
|
|
|
30059
30068
|
onScroll(offset) {
|
|
30060
30069
|
const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
30061
30070
|
this.env.model.dispatch("SET_VIEWPORT_OFFSET", {
|
|
30062
|
-
offsetX: scrollX,
|
|
30071
|
+
offsetX: scrollX, // offsetX is the same
|
|
30063
30072
|
offsetY: offset,
|
|
30064
30073
|
});
|
|
30065
30074
|
}
|
|
@@ -30272,8 +30281,8 @@ class Grid extends owl.Component {
|
|
|
30272
30281
|
"Ctrl+Shift+L": () => this.setHorizontalAlign("left"),
|
|
30273
30282
|
"Ctrl+Shift+R": () => this.setHorizontalAlign("right"),
|
|
30274
30283
|
"Ctrl+Shift+V": () => PASTE_AS_VALUE_ACTION(this.env),
|
|
30275
|
-
"Ctrl+Shift+<": () => this.clearFormatting(),
|
|
30276
|
-
"Ctrl+<": () => this.clearFormatting(),
|
|
30284
|
+
"Ctrl+Shift+<": () => this.clearFormatting(), // for qwerty
|
|
30285
|
+
"Ctrl+<": () => this.clearFormatting(), // for azerty
|
|
30277
30286
|
"Ctrl+Shift+ ": () => {
|
|
30278
30287
|
this.env.model.selection.selectAll();
|
|
30279
30288
|
},
|
|
@@ -31071,10 +31080,10 @@ function convertCFCellIsOperator(xlsxCfOperator) {
|
|
|
31071
31080
|
const CF_TYPE_CONVERSION_MAP = {
|
|
31072
31081
|
aboveAverage: undefined,
|
|
31073
31082
|
expression: undefined,
|
|
31074
|
-
cellIs: undefined,
|
|
31075
|
-
colorScale: undefined,
|
|
31083
|
+
cellIs: undefined, // exist but isn't an operator in o_spreadsheet
|
|
31084
|
+
colorScale: undefined, // exist but isn't an operator in o_spreadsheet
|
|
31076
31085
|
dataBar: undefined,
|
|
31077
|
-
iconSet: undefined,
|
|
31086
|
+
iconSet: undefined, // exist but isn't an operator in o_spreadsheet
|
|
31078
31087
|
top10: undefined,
|
|
31079
31088
|
uniqueValues: undefined,
|
|
31080
31089
|
duplicateValues: undefined,
|
|
@@ -31309,7 +31318,7 @@ const XLSX_INDEXED_COLORS = {
|
|
|
31309
31318
|
61: "993366",
|
|
31310
31319
|
62: "333399",
|
|
31311
31320
|
63: "333333",
|
|
31312
|
-
64: "000000",
|
|
31321
|
+
64: "000000", // system foreground
|
|
31313
31322
|
65: "FFFFFF", // system background
|
|
31314
31323
|
};
|
|
31315
31324
|
const IMAGE_MIMETYPE_TO_EXTENSION_MAPPING = {
|
|
@@ -34979,12 +34988,13 @@ class BordersPlugin extends CorePlugin {
|
|
|
34979
34988
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
34980
34989
|
break;
|
|
34981
34990
|
case "REMOVE_COLUMNS_ROWS":
|
|
34982
|
-
|
|
34991
|
+
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
34992
|
+
for (const group of groupConsecutive(elements)) {
|
|
34983
34993
|
if (cmd.dimension === "COL") {
|
|
34984
|
-
this.shiftBordersHorizontally(cmd.sheetId,
|
|
34994
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34985
34995
|
}
|
|
34986
34996
|
else {
|
|
34987
|
-
this.shiftBordersVertically(cmd.sheetId,
|
|
34997
|
+
this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34988
34998
|
}
|
|
34989
34999
|
}
|
|
34990
35000
|
break;
|
|
@@ -39116,7 +39126,7 @@ class RangeAdapter {
|
|
|
39116
39126
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
39117
39127
|
*/
|
|
39118
39128
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
39119
|
-
if (!rangeReference.test(sheetXC)) {
|
|
39129
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
39120
39130
|
return new RangeImpl({
|
|
39121
39131
|
sheetId: "",
|
|
39122
39132
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -40016,12 +40026,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
40016
40026
|
});
|
|
40017
40027
|
}
|
|
40018
40028
|
if (colIndex > deletedColumn) {
|
|
40019
|
-
this.
|
|
40020
|
-
sheetId: sheet.id,
|
|
40021
|
-
cellId: cellId,
|
|
40022
|
-
col: colIndex - 1,
|
|
40023
|
-
row: rowIndex,
|
|
40024
|
-
});
|
|
40029
|
+
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
40025
40030
|
}
|
|
40026
40031
|
}
|
|
40027
40032
|
}
|
|
@@ -40031,7 +40036,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
40031
40036
|
* Move the cells after a column or rows insertion
|
|
40032
40037
|
*/
|
|
40033
40038
|
moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
|
|
40034
|
-
const
|
|
40039
|
+
const updates = [];
|
|
40035
40040
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
40036
40041
|
const row = sheet.rows[rowIndex];
|
|
40037
40042
|
if (dimension !== "rows" || rowIndex >= addedElement) {
|
|
@@ -40040,20 +40045,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
40040
40045
|
const cellId = row.cells[i];
|
|
40041
40046
|
if (cellId) {
|
|
40042
40047
|
if (dimension === "rows" || colIndex >= addedElement) {
|
|
40043
|
-
|
|
40044
|
-
type: "UPDATE_CELL_POSITION",
|
|
40048
|
+
updates.push({
|
|
40045
40049
|
sheetId: sheet.id,
|
|
40046
40050
|
cellId: cellId,
|
|
40047
40051
|
col: colIndex + (dimension === "columns" ? quantity : 0),
|
|
40048
40052
|
row: rowIndex + (dimension === "rows" ? quantity : 0),
|
|
40053
|
+
type: "UPDATE_CELL_POSITION",
|
|
40049
40054
|
});
|
|
40050
40055
|
}
|
|
40051
40056
|
}
|
|
40052
40057
|
}
|
|
40053
40058
|
}
|
|
40054
40059
|
}
|
|
40055
|
-
for (let
|
|
40056
|
-
this.
|
|
40060
|
+
for (let update of updates.reverse()) {
|
|
40061
|
+
this.updateCellPosition(update);
|
|
40057
40062
|
}
|
|
40058
40063
|
}
|
|
40059
40064
|
/**
|
|
@@ -40086,12 +40091,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
40086
40091
|
const colIndex = Number(i);
|
|
40087
40092
|
const cellId = row.cells[i];
|
|
40088
40093
|
if (cellId) {
|
|
40089
|
-
this.
|
|
40090
|
-
sheetId: sheet.id,
|
|
40091
|
-
cellId: cellId,
|
|
40092
|
-
col: colIndex,
|
|
40093
|
-
row: rowIndex - numberRows,
|
|
40094
|
-
});
|
|
40094
|
+
this.setNewPosition(cellId, sheet.id, colIndex, rowIndex - numberRows);
|
|
40095
40095
|
}
|
|
40096
40096
|
}
|
|
40097
40097
|
}
|
|
@@ -42060,18 +42060,30 @@ class Evaluator {
|
|
|
42060
42060
|
this.evaluate(this.getAllCells());
|
|
42061
42061
|
}
|
|
42062
42062
|
evaluateFormula(sheetId, formulaString) {
|
|
42063
|
-
const
|
|
42064
|
-
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42065
|
-
this.updateCompilationParameters();
|
|
42066
|
-
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42063
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42067
42064
|
if (isMatrix(result)) {
|
|
42068
42065
|
return matrixMap(result, (cell) => cell.value);
|
|
42069
42066
|
}
|
|
42070
|
-
if (result.value === null) {
|
|
42071
|
-
return 0;
|
|
42072
|
-
}
|
|
42073
42067
|
return result.value;
|
|
42074
42068
|
}
|
|
42069
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42070
|
+
try {
|
|
42071
|
+
const compiledFormula = compile(formulaString);
|
|
42072
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42073
|
+
this.updateCompilationParameters();
|
|
42074
|
+
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42075
|
+
if (isMatrix(result)) {
|
|
42076
|
+
return result;
|
|
42077
|
+
}
|
|
42078
|
+
if (result.value === null) {
|
|
42079
|
+
return { value: 0, format: result.format };
|
|
42080
|
+
}
|
|
42081
|
+
return result;
|
|
42082
|
+
}
|
|
42083
|
+
catch (error) {
|
|
42084
|
+
return handleError(error, "");
|
|
42085
|
+
}
|
|
42086
|
+
}
|
|
42075
42087
|
getAllCells() {
|
|
42076
42088
|
const positionIds = new JetSet();
|
|
42077
42089
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
@@ -42496,6 +42508,7 @@ function updateEvalContextAndExecute(compiledFormula, compilationParams, sheetId
|
|
|
42496
42508
|
class EvaluationPlugin extends UIPlugin {
|
|
42497
42509
|
static getters = [
|
|
42498
42510
|
"evaluateFormula",
|
|
42511
|
+
"evaluateFormulaResult",
|
|
42499
42512
|
"getCorrespondingFormulaCell",
|
|
42500
42513
|
"getRangeFormattedValues",
|
|
42501
42514
|
"getRangeValues",
|
|
@@ -42554,12 +42567,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
42554
42567
|
// Getters
|
|
42555
42568
|
// ---------------------------------------------------------------------------
|
|
42556
42569
|
evaluateFormula(sheetId, formulaString) {
|
|
42557
|
-
|
|
42558
|
-
|
|
42559
|
-
|
|
42560
|
-
catch (error) {
|
|
42561
|
-
return error.value || CellErrorType.GenericError;
|
|
42570
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42571
|
+
if (isMatrix(result)) {
|
|
42572
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42562
42573
|
}
|
|
42574
|
+
return result.value;
|
|
42575
|
+
}
|
|
42576
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42577
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42563
42578
|
}
|
|
42564
42579
|
/**
|
|
42565
42580
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -42700,17 +42715,17 @@ function isBadExpression(tokens) {
|
|
|
42700
42715
|
*/
|
|
42701
42716
|
function sortWithClusters(colorsToSort) {
|
|
42702
42717
|
const clusters = [
|
|
42703
|
-
{ leadColor: rgba(255, 0, 0), colors: [] },
|
|
42704
|
-
{ leadColor: rgba(255, 128, 0), colors: [] },
|
|
42705
|
-
{ leadColor: rgba(128, 128, 0), colors: [] },
|
|
42706
|
-
{ leadColor: rgba(128, 255, 0), colors: [] },
|
|
42707
|
-
{ leadColor: rgba(0, 255, 0), colors: [] },
|
|
42708
|
-
{ leadColor: rgba(0, 255, 128), colors: [] },
|
|
42709
|
-
{ leadColor: rgba(0, 255, 255), colors: [] },
|
|
42710
|
-
{ leadColor: rgba(0, 127, 255), colors: [] },
|
|
42711
|
-
{ leadColor: rgba(0, 0, 255), colors: [] },
|
|
42712
|
-
{ leadColor: rgba(127, 0, 255), colors: [] },
|
|
42713
|
-
{ leadColor: rgba(128, 0, 128), colors: [] },
|
|
42718
|
+
{ leadColor: rgba(255, 0, 0), colors: [] }, // red
|
|
42719
|
+
{ leadColor: rgba(255, 128, 0), colors: [] }, // orange
|
|
42720
|
+
{ leadColor: rgba(128, 128, 0), colors: [] }, // yellow
|
|
42721
|
+
{ leadColor: rgba(128, 255, 0), colors: [] }, // chartreuse
|
|
42722
|
+
{ leadColor: rgba(0, 255, 0), colors: [] }, // green
|
|
42723
|
+
{ leadColor: rgba(0, 255, 128), colors: [] }, // spring green
|
|
42724
|
+
{ leadColor: rgba(0, 255, 255), colors: [] }, // cyan
|
|
42725
|
+
{ leadColor: rgba(0, 127, 255), colors: [] }, // azure
|
|
42726
|
+
{ leadColor: rgba(0, 0, 255), colors: [] }, // blue
|
|
42727
|
+
{ leadColor: rgba(127, 0, 255), colors: [] }, // violet
|
|
42728
|
+
{ leadColor: rgba(128, 0, 128), colors: [] }, // magenta
|
|
42714
42729
|
{ leadColor: rgba(255, 0, 128), colors: [] }, // rose
|
|
42715
42730
|
];
|
|
42716
42731
|
for (const color of colorsToSort.map(colorToRGBA)) {
|
|
@@ -46434,6 +46449,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
46434
46449
|
* evaluated and updated with the number type.
|
|
46435
46450
|
*/
|
|
46436
46451
|
setDecimal(sheetId, zones, step) {
|
|
46452
|
+
const positionsByFormat = {};
|
|
46437
46453
|
// Find the each cell with a number value and get the format
|
|
46438
46454
|
for (const zone of zones) {
|
|
46439
46455
|
for (const position of positions(zone)) {
|
|
@@ -46443,15 +46459,20 @@ class FormatPlugin extends UIPlugin {
|
|
|
46443
46459
|
// of the format
|
|
46444
46460
|
this.getters.getLocale();
|
|
46445
46461
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
46446
|
-
|
|
46447
|
-
|
|
46448
|
-
sheetId,
|
|
46449
|
-
target: [positionToZone(position)],
|
|
46450
|
-
format: newFormat,
|
|
46451
|
-
});
|
|
46462
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
46463
|
+
positionsByFormat[newFormat].push(position);
|
|
46452
46464
|
}
|
|
46453
46465
|
}
|
|
46454
46466
|
}
|
|
46467
|
+
// consolidate all positions with the same format in bigger zones
|
|
46468
|
+
for (const newFormat in positionsByFormat) {
|
|
46469
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
46470
|
+
this.dispatch("SET_FORMATTING", {
|
|
46471
|
+
sheetId,
|
|
46472
|
+
format: newFormat,
|
|
46473
|
+
target: zones,
|
|
46474
|
+
});
|
|
46475
|
+
}
|
|
46455
46476
|
}
|
|
46456
46477
|
/**
|
|
46457
46478
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -52497,7 +52518,7 @@ class BottomBar extends owl.Component {
|
|
|
52497
52518
|
.map((sheetEl) => sheetEl.getBoundingClientRect())
|
|
52498
52519
|
.map((rect) => ({
|
|
52499
52520
|
x: rect.x,
|
|
52500
|
-
width: rect.width - 1,
|
|
52521
|
+
width: rect.width - 1, // -1 to compensate negative margin
|
|
52501
52522
|
y: rect.y,
|
|
52502
52523
|
height: rect.height,
|
|
52503
52524
|
}));
|
|
@@ -52719,7 +52740,7 @@ class RowGroup extends AbstractHeaderGroup {
|
|
|
52719
52740
|
}
|
|
52720
52741
|
return cssPropertiesToCss({
|
|
52721
52742
|
top: `${groupBox.headerRect.height / 2}px`,
|
|
52722
|
-
left: `calc(50% - 1px)`,
|
|
52743
|
+
left: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52723
52744
|
width: `30%`,
|
|
52724
52745
|
height: `calc(100% - ${groupBox.headerRect.height / 2}px)`,
|
|
52725
52746
|
"border-left": `1px solid ${HEADER_GROUPING_BORDER_COLOR}`,
|
|
@@ -52771,7 +52792,7 @@ class ColGroup extends AbstractHeaderGroup {
|
|
|
52771
52792
|
return "";
|
|
52772
52793
|
}
|
|
52773
52794
|
return cssPropertiesToCss({
|
|
52774
|
-
top: `calc(50% - 1px)`,
|
|
52795
|
+
top: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52775
52796
|
left: `${groupBox.headerRect.width / 2}px`,
|
|
52776
52797
|
width: `calc(100% - ${groupBox.headerRect.width / 2}px)`,
|
|
52777
52798
|
height: `30%`,
|
|
@@ -54182,7 +54203,7 @@ class Spreadsheet extends owl.Component {
|
|
|
54182
54203
|
const gridColSize = GROUP_LAYER_WIDTH * this.rowLayers.length;
|
|
54183
54204
|
const gridRowSize = GROUP_LAYER_WIDTH * this.colLayers.length;
|
|
54184
54205
|
return cssPropertiesToCss({
|
|
54185
|
-
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`,
|
|
54206
|
+
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`, // +2: margins
|
|
54186
54207
|
"grid-template-rows": `${gridRowSize ? gridRowSize + 2 : 0}px auto`,
|
|
54187
54208
|
});
|
|
54188
54209
|
}
|
|
@@ -55627,7 +55648,7 @@ class SelectionStreamProcessorImpl {
|
|
|
55627
55648
|
}
|
|
55628
55649
|
|
|
55629
55650
|
class StateObserver {
|
|
55630
|
-
changes
|
|
55651
|
+
changes;
|
|
55631
55652
|
commands = [];
|
|
55632
55653
|
/**
|
|
55633
55654
|
* Record the changes which could happen in the given callback, save them in a
|
|
@@ -55659,7 +55680,7 @@ class StateObserver {
|
|
|
55659
55680
|
if (value[key] === val) {
|
|
55660
55681
|
return;
|
|
55661
55682
|
}
|
|
55662
|
-
this.changes
|
|
55683
|
+
this.changes?.push({
|
|
55663
55684
|
path: args,
|
|
55664
55685
|
before: value[key],
|
|
55665
55686
|
after: val,
|
|
@@ -56790,7 +56811,7 @@ function addTableColumns(table, sheetData) {
|
|
|
56790
56811
|
const colHeaderXc = toXC(tableZone.left + i, tableZone.top);
|
|
56791
56812
|
const colName = sheetData.cells[colHeaderXc]?.content || `col${i}`;
|
|
56792
56813
|
const colAttributes = [
|
|
56793
|
-
["id", i + 1],
|
|
56814
|
+
["id", i + 1], // id cannot be 0
|
|
56794
56815
|
["name", colName],
|
|
56795
56816
|
];
|
|
56796
56817
|
columns.push(escapeXml /*xml*/ `<tableColumn ${formatAttributes(colAttributes)}/>`);
|
|
@@ -57882,6 +57903,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57882
57903
|
exports.tokenize = tokenize;
|
|
57883
57904
|
|
|
57884
57905
|
|
|
57885
|
-
__info__.version = "17.1.
|
|
57886
|
-
__info__.date = "2024-
|
|
57887
|
-
__info__.hash = "
|
|
57906
|
+
__info__.version = "17.1.27";
|
|
57907
|
+
__info__.date = "2024-08-09T12:20:52.051Z";
|
|
57908
|
+
__info__.hash = "c626332";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4006,7 +4006,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4006
4006
|
}
|
|
4007
4007
|
|
|
4008
4008
|
declare class EvaluationPlugin extends UIPlugin {
|
|
4009
|
-
static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
|
|
4009
|
+
static getters: readonly ["evaluateFormula", "evaluateFormulaResult", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
|
|
4010
4010
|
private shouldRebuildDependenciesGraph;
|
|
4011
4011
|
private evaluator;
|
|
4012
4012
|
private positionsToUpdate;
|
|
@@ -4015,6 +4015,7 @@ declare class EvaluationPlugin extends UIPlugin {
|
|
|
4015
4015
|
handle(cmd: CoreViewCommand): void;
|
|
4016
4016
|
finalize(): void;
|
|
4017
4017
|
evaluateFormula(sheetId: UID, formulaString: string): CellValue | Matrix<CellValue>;
|
|
4018
|
+
evaluateFormulaResult(sheetId: UID, formulaString: string): Matrix<FPayload> | FPayload;
|
|
4018
4019
|
/**
|
|
4019
4020
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
4020
4021
|
*/
|
|
@@ -7912,6 +7913,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
|
|
|
7912
7913
|
autoCompleteState: AutoCompleteState;
|
|
7913
7914
|
functionDescriptionState: FunctionDescriptionState;
|
|
7914
7915
|
private compositionActive;
|
|
7916
|
+
private spreadsheetRect;
|
|
7915
7917
|
get assistantStyle(): string;
|
|
7916
7918
|
shouldProcessInputEvents: boolean;
|
|
7917
7919
|
tokens: EnrichedToken[];
|
|
@@ -8130,7 +8132,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
|
|
|
8130
8132
|
private keyDownMapping;
|
|
8131
8133
|
private isViewportTooSmall;
|
|
8132
8134
|
get model(): Model;
|
|
8133
|
-
getStyle():
|
|
8135
|
+
getStyle(): "grid-template-rows: auto;" | "grid-template-rows: 63px auto 37px";
|
|
8134
8136
|
setup(): void;
|
|
8135
8137
|
get focusTopBarComposer(): Omit<ComposerFocusType, "cellFocus">;
|
|
8136
8138
|
get focusGridComposer(): ComposerFocusType;
|