@odoo/o-spreadsheet 17.0.32 → 17.0.34
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 +96 -86
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +96 -86
- package/dist/o-spreadsheet.iife.js +96 -86
- 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.34
|
|
6
|
+
* @date 2024-08-09T12:20:17.042Z
|
|
7
|
+
* @hash 1573912
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -594,7 +594,7 @@ function debounce(func, wait, immediate) {
|
|
|
594
594
|
let timeout;
|
|
595
595
|
return function () {
|
|
596
596
|
const context = this;
|
|
597
|
-
const args = arguments;
|
|
597
|
+
const args = Array.from(arguments);
|
|
598
598
|
function later() {
|
|
599
599
|
timeout = null;
|
|
600
600
|
if (!immediate) {
|
|
@@ -797,7 +797,7 @@ function isNumberBetween(value, min, max) {
|
|
|
797
797
|
*/
|
|
798
798
|
function largeMax(array) {
|
|
799
799
|
let len = array.length;
|
|
800
|
-
if (len <
|
|
800
|
+
if (len < 100_000)
|
|
801
801
|
return Math.max(...array);
|
|
802
802
|
let max = -Infinity;
|
|
803
803
|
while (len--) {
|
|
@@ -811,7 +811,7 @@ function largeMax(array) {
|
|
|
811
811
|
*/
|
|
812
812
|
function largeMin(array) {
|
|
813
813
|
let len = array.length;
|
|
814
|
-
if (len <
|
|
814
|
+
if (len < 100_000)
|
|
815
815
|
return Math.min(...array);
|
|
816
816
|
let min = +Infinity;
|
|
817
817
|
while (len--) {
|
|
@@ -2566,13 +2566,16 @@ function operandToRegExp(operand) {
|
|
|
2566
2566
|
}
|
|
2567
2567
|
return new RegExp("^" + exp + "$", "i");
|
|
2568
2568
|
}
|
|
2569
|
-
function evaluatePredicate(value = "", criterion) {
|
|
2569
|
+
function evaluatePredicate(value = "", criterion, locale) {
|
|
2570
2570
|
const { operator, operand } = criterion;
|
|
2571
2571
|
if (operand === undefined || value === null || operand === null) {
|
|
2572
2572
|
return false;
|
|
2573
2573
|
}
|
|
2574
2574
|
if (typeof operand === "number" && operator === "=") {
|
|
2575
|
-
|
|
2575
|
+
if (typeof value === "string" && (isNumber(value, locale) || isDateTime(value, locale))) {
|
|
2576
|
+
return toNumber(value, locale) === operand;
|
|
2577
|
+
}
|
|
2578
|
+
return value === operand;
|
|
2576
2579
|
}
|
|
2577
2580
|
if (operator === "<>" || operator === "=") {
|
|
2578
2581
|
let result;
|
|
@@ -2651,7 +2654,7 @@ function visitMatchingRanges(args, cb, locale, isQuery = false) {
|
|
|
2651
2654
|
for (let k = 0; k < countArg - 1; k += 2) {
|
|
2652
2655
|
const criteriaValue = args[k][i][j];
|
|
2653
2656
|
const criterion = predicates[k / 2];
|
|
2654
|
-
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion);
|
|
2657
|
+
validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion, locale);
|
|
2655
2658
|
if (!validatedPredicates) {
|
|
2656
2659
|
break;
|
|
2657
2660
|
}
|
|
@@ -5900,7 +5903,7 @@ function textCell(value, localeFormat) {
|
|
|
5900
5903
|
function numberCell(value, localeFormat) {
|
|
5901
5904
|
return {
|
|
5902
5905
|
type: CellValueType.number,
|
|
5903
|
-
value: value || 0,
|
|
5906
|
+
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
5904
5907
|
format: localeFormat.format,
|
|
5905
5908
|
isAutoSummable: true,
|
|
5906
5909
|
defaultAlign: "right",
|
|
@@ -8433,8 +8436,8 @@ function truncateLabel(label) {
|
|
|
8433
8436
|
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
|
|
8434
8437
|
const options = {
|
|
8435
8438
|
// https://www.chartjs.org/docs/latest/general/responsive.html
|
|
8436
|
-
responsive: true,
|
|
8437
|
-
maintainAspectRatio: false,
|
|
8439
|
+
responsive: true, // will resize when its container is resized
|
|
8440
|
+
maintainAspectRatio: false, // doesn't maintain the aspect ration (width/height =2 by default) so the user has the choice of the exact layout
|
|
8438
8441
|
layout: {
|
|
8439
8442
|
padding: { left: 20, right: 20, top: chart.title ? 10 : 25, bottom: 10 },
|
|
8440
8443
|
},
|
|
@@ -8743,7 +8746,7 @@ function getBarConfiguration(chart, labels, localeFormat) {
|
|
|
8743
8746
|
},
|
|
8744
8747
|
y: {
|
|
8745
8748
|
position: chart.verticalAxisPosition,
|
|
8746
|
-
beginAtZero: true,
|
|
8749
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
8747
8750
|
ticks: {
|
|
8748
8751
|
color: fontColor,
|
|
8749
8752
|
callback: (value) => {
|
|
@@ -9397,7 +9400,7 @@ function getLineConfiguration(chart, labels, options) {
|
|
|
9397
9400
|
},
|
|
9398
9401
|
y: {
|
|
9399
9402
|
position: chart.verticalAxisPosition,
|
|
9400
|
-
beginAtZero: true,
|
|
9403
|
+
beginAtZero: true, // the origin of the y axis is always zero
|
|
9401
9404
|
ticks: {
|
|
9402
9405
|
color: fontColor,
|
|
9403
9406
|
callback: (value) => {
|
|
@@ -9485,7 +9488,7 @@ function createLineChartRuntime(chart, getters) {
|
|
|
9485
9488
|
const dataset = {
|
|
9486
9489
|
label,
|
|
9487
9490
|
data,
|
|
9488
|
-
tension: 0,
|
|
9491
|
+
tension: 0, // 0 -> render straight lines, which is much faster
|
|
9489
9492
|
borderColor: color,
|
|
9490
9493
|
backgroundColor,
|
|
9491
9494
|
pointBackgroundColor: color,
|
|
@@ -9596,7 +9599,7 @@ class PieChart extends AbstractChart {
|
|
|
9596
9599
|
...this.getDefinition(),
|
|
9597
9600
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
9598
9601
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
9599
|
-
verticalAxisPosition: "left",
|
|
9602
|
+
verticalAxisPosition: "left", //TODO ExcelChartDefinition should be adapted, but can be done later
|
|
9600
9603
|
dataSets,
|
|
9601
9604
|
labelRange,
|
|
9602
9605
|
};
|
|
@@ -26700,7 +26703,9 @@ class Composer extends owl.Component {
|
|
|
26700
26703
|
argToFocus: 0,
|
|
26701
26704
|
});
|
|
26702
26705
|
compositionActive = false;
|
|
26706
|
+
spreadsheetRect = useSpreadsheetRect();
|
|
26703
26707
|
get assistantStyle() {
|
|
26708
|
+
const composerRect = this.composerRef.el.getBoundingClientRect();
|
|
26704
26709
|
const assistantStyle = {};
|
|
26705
26710
|
assistantStyle["min-width"] = `${this.props.rect?.width || ASSISTANT_WIDTH}px`;
|
|
26706
26711
|
if (this.autoCompleteState.type === "function") {
|
|
@@ -26723,6 +26728,10 @@ class Composer extends owl.Component {
|
|
|
26723
26728
|
assistantStyle.right = `0px`;
|
|
26724
26729
|
}
|
|
26725
26730
|
}
|
|
26731
|
+
if (this.props.focus === "contentFocus" &&
|
|
26732
|
+
composerRect.left + ASSISTANT_WIDTH > this.spreadsheetRect.width) {
|
|
26733
|
+
assistantStyle.right = "0px";
|
|
26734
|
+
}
|
|
26726
26735
|
return cssPropertiesToCss(assistantStyle);
|
|
26727
26736
|
}
|
|
26728
26737
|
// we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
|
|
@@ -29581,7 +29590,7 @@ class VerticalScrollBar extends owl.Component {
|
|
|
29581
29590
|
onScroll(offset) {
|
|
29582
29591
|
const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
|
|
29583
29592
|
this.env.model.dispatch("SET_VIEWPORT_OFFSET", {
|
|
29584
|
-
offsetX: scrollX,
|
|
29593
|
+
offsetX: scrollX, // offsetX is the same
|
|
29585
29594
|
offsetY: offset,
|
|
29586
29595
|
});
|
|
29587
29596
|
}
|
|
@@ -29792,8 +29801,8 @@ class Grid extends owl.Component {
|
|
|
29792
29801
|
"CTRL+SHIFT+L": () => this.setHorizontalAlign("left"),
|
|
29793
29802
|
"CTRL+SHIFT+R": () => this.setHorizontalAlign("right"),
|
|
29794
29803
|
"CTRL+SHIFT+V": () => PASTE_VALUE_ACTION(this.env),
|
|
29795
|
-
"CTRL+SHIFT+<": () => this.clearFormatting(),
|
|
29796
|
-
"CTRL+<": () => this.clearFormatting(),
|
|
29804
|
+
"CTRL+SHIFT+<": () => this.clearFormatting(), // for qwerty
|
|
29805
|
+
"CTRL+<": () => this.clearFormatting(), // for azerty
|
|
29797
29806
|
"CTRL+SHIFT+ ": () => {
|
|
29798
29807
|
this.env.model.selection.selectAll();
|
|
29799
29808
|
},
|
|
@@ -30607,10 +30616,10 @@ function convertCFCellIsOperator(xlsxCfOperator) {
|
|
|
30607
30616
|
const CF_TYPE_CONVERSION_MAP = {
|
|
30608
30617
|
aboveAverage: undefined,
|
|
30609
30618
|
expression: undefined,
|
|
30610
|
-
cellIs: undefined,
|
|
30611
|
-
colorScale: undefined,
|
|
30619
|
+
cellIs: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30620
|
+
colorScale: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30612
30621
|
dataBar: undefined,
|
|
30613
|
-
iconSet: undefined,
|
|
30622
|
+
iconSet: undefined, // exist but isn't an operator in o_spreadsheet
|
|
30614
30623
|
top10: undefined,
|
|
30615
30624
|
uniqueValues: undefined,
|
|
30616
30625
|
duplicateValues: undefined,
|
|
@@ -30845,7 +30854,7 @@ const XLSX_INDEXED_COLORS = {
|
|
|
30845
30854
|
61: "993366",
|
|
30846
30855
|
62: "333399",
|
|
30847
30856
|
63: "333333",
|
|
30848
|
-
64: "000000",
|
|
30857
|
+
64: "000000", // system foreground
|
|
30849
30858
|
65: "FFFFFF", // system background
|
|
30850
30859
|
};
|
|
30851
30860
|
const IMAGE_MIMETYPE_TO_EXTENSION_MAPPING = {
|
|
@@ -34486,12 +34495,13 @@ class BordersPlugin extends CorePlugin {
|
|
|
34486
34495
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
34487
34496
|
break;
|
|
34488
34497
|
case "REMOVE_COLUMNS_ROWS":
|
|
34489
|
-
|
|
34498
|
+
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
34499
|
+
for (const group of groupConsecutive(elements)) {
|
|
34490
34500
|
if (cmd.dimension === "COL") {
|
|
34491
|
-
this.shiftBordersHorizontally(cmd.sheetId,
|
|
34501
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34492
34502
|
}
|
|
34493
34503
|
else {
|
|
34494
|
-
this.shiftBordersVertically(cmd.sheetId,
|
|
34504
|
+
this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
34495
34505
|
}
|
|
34496
34506
|
}
|
|
34497
34507
|
break;
|
|
@@ -38652,7 +38662,7 @@ class RangeAdapter {
|
|
|
38652
38662
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
38653
38663
|
*/
|
|
38654
38664
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
38655
|
-
if (!rangeReference.test(sheetXC)) {
|
|
38665
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
38656
38666
|
return new RangeImpl({
|
|
38657
38667
|
sheetId: "",
|
|
38658
38668
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -39552,12 +39562,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39552
39562
|
});
|
|
39553
39563
|
}
|
|
39554
39564
|
if (colIndex > deletedColumn) {
|
|
39555
|
-
this.
|
|
39556
|
-
sheetId: sheet.id,
|
|
39557
|
-
cellId: cellId,
|
|
39558
|
-
col: colIndex - 1,
|
|
39559
|
-
row: rowIndex,
|
|
39560
|
-
});
|
|
39565
|
+
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
39561
39566
|
}
|
|
39562
39567
|
}
|
|
39563
39568
|
}
|
|
@@ -39567,7 +39572,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39567
39572
|
* Move the cells after a column or rows insertion
|
|
39568
39573
|
*/
|
|
39569
39574
|
moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
|
|
39570
|
-
const
|
|
39575
|
+
const updates = [];
|
|
39571
39576
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39572
39577
|
const row = sheet.rows[rowIndex];
|
|
39573
39578
|
if (dimension !== "rows" || rowIndex >= addedElement) {
|
|
@@ -39576,20 +39581,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
39576
39581
|
const cellId = row.cells[i];
|
|
39577
39582
|
if (cellId) {
|
|
39578
39583
|
if (dimension === "rows" || colIndex >= addedElement) {
|
|
39579
|
-
|
|
39580
|
-
type: "UPDATE_CELL_POSITION",
|
|
39584
|
+
updates.push({
|
|
39581
39585
|
sheetId: sheet.id,
|
|
39582
39586
|
cellId: cellId,
|
|
39583
39587
|
col: colIndex + (dimension === "columns" ? quantity : 0),
|
|
39584
39588
|
row: rowIndex + (dimension === "rows" ? quantity : 0),
|
|
39589
|
+
type: "UPDATE_CELL_POSITION",
|
|
39585
39590
|
});
|
|
39586
39591
|
}
|
|
39587
39592
|
}
|
|
39588
39593
|
}
|
|
39589
39594
|
}
|
|
39590
39595
|
}
|
|
39591
|
-
for (let
|
|
39592
|
-
this.
|
|
39596
|
+
for (let update of updates.reverse()) {
|
|
39597
|
+
this.updateCellPosition(update);
|
|
39593
39598
|
}
|
|
39594
39599
|
}
|
|
39595
39600
|
/**
|
|
@@ -39622,12 +39627,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39622
39627
|
const colIndex = Number(i);
|
|
39623
39628
|
const cellId = row.cells[i];
|
|
39624
39629
|
if (cellId) {
|
|
39625
|
-
this.
|
|
39626
|
-
sheetId: sheet.id,
|
|
39627
|
-
cellId: cellId,
|
|
39628
|
-
col: colIndex,
|
|
39629
|
-
row: rowIndex - numberRows,
|
|
39630
|
-
});
|
|
39630
|
+
this.setNewPosition(cellId, sheet.id, colIndex, rowIndex - numberRows);
|
|
39631
39631
|
}
|
|
39632
39632
|
}
|
|
39633
39633
|
}
|
|
@@ -41604,15 +41604,16 @@ class Evaluator {
|
|
|
41604
41604
|
this.evaluatedCells = new Map();
|
|
41605
41605
|
this.evaluate(this.getAllCells());
|
|
41606
41606
|
}
|
|
41607
|
-
|
|
41608
|
-
|
|
41609
|
-
|
|
41610
|
-
|
|
41611
|
-
|
|
41612
|
-
|
|
41613
|
-
|
|
41607
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
41608
|
+
try {
|
|
41609
|
+
const compiledFormula = compile(formulaString);
|
|
41610
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
41611
|
+
this.updateCompilationParameters();
|
|
41612
|
+
return compiledFormula.execute(ranges, ...this.compilationParams);
|
|
41613
|
+
}
|
|
41614
|
+
catch (error) {
|
|
41615
|
+
return this.handleError(error);
|
|
41614
41616
|
}
|
|
41615
|
-
return array.value;
|
|
41616
41617
|
}
|
|
41617
41618
|
getAllCells() {
|
|
41618
41619
|
const positionIds = new JetSet();
|
|
@@ -41688,7 +41689,7 @@ class Evaluator {
|
|
|
41688
41689
|
: evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
|
|
41689
41690
|
}
|
|
41690
41691
|
catch (e) {
|
|
41691
|
-
return this.handleError(e
|
|
41692
|
+
return this.handleError(e);
|
|
41692
41693
|
}
|
|
41693
41694
|
finally {
|
|
41694
41695
|
this.cellsBeingComputed.delete(cellId);
|
|
@@ -41703,7 +41704,7 @@ class Evaluator {
|
|
|
41703
41704
|
}
|
|
41704
41705
|
return evaluatedCell;
|
|
41705
41706
|
}
|
|
41706
|
-
handleError(e
|
|
41707
|
+
handleError(e) {
|
|
41707
41708
|
if (!(e instanceof EvaluationError)) {
|
|
41708
41709
|
e = new EvaluationError(CellErrorType.GenericError, e.message);
|
|
41709
41710
|
}
|
|
@@ -42037,6 +42038,7 @@ class PositionBitsEncoder {
|
|
|
42037
42038
|
class EvaluationPlugin extends UIPlugin {
|
|
42038
42039
|
static getters = [
|
|
42039
42040
|
"evaluateFormula",
|
|
42041
|
+
"evaluateFormulaResult",
|
|
42040
42042
|
"getCorrespondingFormulaCell",
|
|
42041
42043
|
"getRangeFormattedValues",
|
|
42042
42044
|
"getRangeValues",
|
|
@@ -42094,12 +42096,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
42094
42096
|
// Getters
|
|
42095
42097
|
// ---------------------------------------------------------------------------
|
|
42096
42098
|
evaluateFormula(sheetId, formulaString) {
|
|
42097
|
-
|
|
42098
|
-
|
|
42099
|
-
|
|
42100
|
-
catch (error) {
|
|
42101
|
-
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
42099
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42100
|
+
if (isMatrix(result)) {
|
|
42101
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42102
42102
|
}
|
|
42103
|
+
return result.value;
|
|
42104
|
+
}
|
|
42105
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42106
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42103
42107
|
}
|
|
42104
42108
|
/**
|
|
42105
42109
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -42240,17 +42244,17 @@ function isBadExpression(tokens) {
|
|
|
42240
42244
|
*/
|
|
42241
42245
|
function sortWithClusters(colorsToSort) {
|
|
42242
42246
|
const clusters = [
|
|
42243
|
-
{ leadColor: rgba(255, 0, 0), colors: [] },
|
|
42244
|
-
{ leadColor: rgba(255, 128, 0), colors: [] },
|
|
42245
|
-
{ leadColor: rgba(128, 128, 0), colors: [] },
|
|
42246
|
-
{ leadColor: rgba(128, 255, 0), colors: [] },
|
|
42247
|
-
{ leadColor: rgba(0, 255, 0), colors: [] },
|
|
42248
|
-
{ leadColor: rgba(0, 255, 128), colors: [] },
|
|
42249
|
-
{ leadColor: rgba(0, 255, 255), colors: [] },
|
|
42250
|
-
{ leadColor: rgba(0, 127, 255), colors: [] },
|
|
42251
|
-
{ leadColor: rgba(0, 0, 255), colors: [] },
|
|
42252
|
-
{ leadColor: rgba(127, 0, 255), colors: [] },
|
|
42253
|
-
{ leadColor: rgba(128, 0, 128), colors: [] },
|
|
42247
|
+
{ leadColor: rgba(255, 0, 0), colors: [] }, // red
|
|
42248
|
+
{ leadColor: rgba(255, 128, 0), colors: [] }, // orange
|
|
42249
|
+
{ leadColor: rgba(128, 128, 0), colors: [] }, // yellow
|
|
42250
|
+
{ leadColor: rgba(128, 255, 0), colors: [] }, // chartreuse
|
|
42251
|
+
{ leadColor: rgba(0, 255, 0), colors: [] }, // green
|
|
42252
|
+
{ leadColor: rgba(0, 255, 128), colors: [] }, // spring green
|
|
42253
|
+
{ leadColor: rgba(0, 255, 255), colors: [] }, // cyan
|
|
42254
|
+
{ leadColor: rgba(0, 127, 255), colors: [] }, // azure
|
|
42255
|
+
{ leadColor: rgba(0, 0, 255), colors: [] }, // blue
|
|
42256
|
+
{ leadColor: rgba(127, 0, 255), colors: [] }, // violet
|
|
42257
|
+
{ leadColor: rgba(128, 0, 128), colors: [] }, // magenta
|
|
42254
42258
|
{ leadColor: rgba(255, 0, 128), colors: [] }, // rose
|
|
42255
42259
|
];
|
|
42256
42260
|
for (const color of colorsToSort.map(colorToRGBA)) {
|
|
@@ -45899,6 +45903,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
45899
45903
|
* evaluated and updated with the number type.
|
|
45900
45904
|
*/
|
|
45901
45905
|
setDecimal(sheetId, zones, step) {
|
|
45906
|
+
const positionsByFormat = {};
|
|
45902
45907
|
// Find the each cell with a number value and get the format
|
|
45903
45908
|
for (const zone of zones) {
|
|
45904
45909
|
for (const position of positions(zone)) {
|
|
@@ -45908,15 +45913,20 @@ class FormatPlugin extends UIPlugin {
|
|
|
45908
45913
|
// of the format
|
|
45909
45914
|
this.getters.getLocale();
|
|
45910
45915
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
45911
|
-
|
|
45912
|
-
|
|
45913
|
-
sheetId,
|
|
45914
|
-
target: [positionToZone(position)],
|
|
45915
|
-
format: newFormat,
|
|
45916
|
-
});
|
|
45916
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
45917
|
+
positionsByFormat[newFormat].push(position);
|
|
45917
45918
|
}
|
|
45918
45919
|
}
|
|
45919
45920
|
}
|
|
45921
|
+
// consolidate all positions with the same format in bigger zones
|
|
45922
|
+
for (const newFormat in positionsByFormat) {
|
|
45923
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
45924
|
+
this.dispatch("SET_FORMATTING", {
|
|
45925
|
+
sheetId,
|
|
45926
|
+
format: newFormat,
|
|
45927
|
+
target: zones,
|
|
45928
|
+
});
|
|
45929
|
+
}
|
|
45920
45930
|
}
|
|
45921
45931
|
/**
|
|
45922
45932
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -52160,7 +52170,7 @@ class BottomBar extends owl.Component {
|
|
|
52160
52170
|
.map((sheetEl) => sheetEl.getBoundingClientRect())
|
|
52161
52171
|
.map((rect) => ({
|
|
52162
52172
|
x: rect.x,
|
|
52163
|
-
width: rect.width - 1,
|
|
52173
|
+
width: rect.width - 1, // -1 to compensate negative margin
|
|
52164
52174
|
y: rect.y,
|
|
52165
52175
|
height: rect.height,
|
|
52166
52176
|
}));
|
|
@@ -52385,7 +52395,7 @@ class RowGroup extends AbstractHeaderGroup {
|
|
|
52385
52395
|
}
|
|
52386
52396
|
return cssPropertiesToCss({
|
|
52387
52397
|
top: `${groupBox.headerRect.height / 2}px`,
|
|
52388
|
-
left: `calc(50% - 1px)`,
|
|
52398
|
+
left: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52389
52399
|
width: `30%`,
|
|
52390
52400
|
height: `calc(100% - ${groupBox.headerRect.height / 2}px)`,
|
|
52391
52401
|
"border-left": `1px solid ${HEADER_GROUPING_BORDER_COLOR}`,
|
|
@@ -52437,7 +52447,7 @@ class ColGroup extends AbstractHeaderGroup {
|
|
|
52437
52447
|
return "";
|
|
52438
52448
|
}
|
|
52439
52449
|
return cssPropertiesToCss({
|
|
52440
|
-
top: `calc(50% - 1px)`,
|
|
52450
|
+
top: `calc(50% - 1px)`, // -1px: we want the border to be on the center
|
|
52441
52451
|
left: `${groupBox.headerRect.width / 2}px`,
|
|
52442
52452
|
width: `calc(100% - ${groupBox.headerRect.width / 2}px)`,
|
|
52443
52453
|
height: `30%`,
|
|
@@ -53838,7 +53848,7 @@ class Spreadsheet extends owl.Component {
|
|
|
53838
53848
|
const gridColSize = GROUP_LAYER_WIDTH * this.rowLayers.length;
|
|
53839
53849
|
const gridRowSize = GROUP_LAYER_WIDTH * this.colLayers.length;
|
|
53840
53850
|
return cssPropertiesToCss({
|
|
53841
|
-
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`,
|
|
53851
|
+
"grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`, // +2: margins
|
|
53842
53852
|
"grid-template-rows": `${gridRowSize ? gridRowSize + 2 : 0}px auto`,
|
|
53843
53853
|
});
|
|
53844
53854
|
}
|
|
@@ -55341,7 +55351,7 @@ class SelectionStreamProcessorImpl {
|
|
|
55341
55351
|
}
|
|
55342
55352
|
|
|
55343
55353
|
class StateObserver {
|
|
55344
|
-
changes
|
|
55354
|
+
changes;
|
|
55345
55355
|
commands = [];
|
|
55346
55356
|
/**
|
|
55347
55357
|
* Record the changes which could happen in the given callback, save them in a
|
|
@@ -55373,7 +55383,7 @@ class StateObserver {
|
|
|
55373
55383
|
if (value[key] === val) {
|
|
55374
55384
|
return;
|
|
55375
55385
|
}
|
|
55376
|
-
this.changes
|
|
55386
|
+
this.changes?.push({
|
|
55377
55387
|
path: args,
|
|
55378
55388
|
before: value[key],
|
|
55379
55389
|
after: val,
|
|
@@ -56504,7 +56514,7 @@ function addTableColumns(table, sheetData) {
|
|
|
56504
56514
|
const colHeaderXc = toXC(tableZone.left + i, tableZone.top);
|
|
56505
56515
|
const colName = sheetData.cells[colHeaderXc]?.content || `col${i}`;
|
|
56506
56516
|
const colAttributes = [
|
|
56507
|
-
["id", i + 1],
|
|
56517
|
+
["id", i + 1], // id cannot be 0
|
|
56508
56518
|
["name", colName],
|
|
56509
56519
|
];
|
|
56510
56520
|
columns.push(escapeXml /*xml*/ `<tableColumn ${formatAttributes(colAttributes)}/>`);
|
|
@@ -57586,6 +57596,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57586
57596
|
exports.tokenize = tokenize;
|
|
57587
57597
|
|
|
57588
57598
|
|
|
57589
|
-
__info__.version = "17.0.
|
|
57590
|
-
__info__.date = "2024-
|
|
57591
|
-
__info__.hash = "
|
|
57599
|
+
__info__.version = "17.0.34";
|
|
57600
|
+
__info__.date = "2024-08-09T12:20:17.042Z";
|
|
57601
|
+
__info__.hash = "1573912";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4134,7 +4134,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4134
4134
|
}
|
|
4135
4135
|
|
|
4136
4136
|
declare class EvaluationPlugin extends UIPlugin {
|
|
4137
|
-
static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
|
|
4137
|
+
static getters: readonly ["evaluateFormula", "evaluateFormulaResult", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
|
|
4138
4138
|
private shouldRebuildDependenciesGraph;
|
|
4139
4139
|
private evaluator;
|
|
4140
4140
|
private positionsToUpdate;
|
|
@@ -4143,6 +4143,7 @@ declare class EvaluationPlugin extends UIPlugin {
|
|
|
4143
4143
|
handle(cmd: CoreViewCommand): void;
|
|
4144
4144
|
finalize(): void;
|
|
4145
4145
|
evaluateFormula(sheetId: UID, formulaString: string): CellValue | Matrix<CellValue>;
|
|
4146
|
+
evaluateFormulaResult(sheetId: UID, formulaString: string): ValueAndFormat | Matrix<ValueAndFormat>;
|
|
4146
4147
|
/**
|
|
4147
4148
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
4148
4149
|
*/
|
|
@@ -7250,6 +7251,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
|
|
|
7250
7251
|
autoCompleteState: AutoCompleteState;
|
|
7251
7252
|
functionDescriptionState: FunctionDescriptionState;
|
|
7252
7253
|
private compositionActive;
|
|
7254
|
+
private spreadsheetRect;
|
|
7253
7255
|
get assistantStyle(): string;
|
|
7254
7256
|
shouldProcessInputEvents: boolean;
|
|
7255
7257
|
tokens: EnrichedToken[];
|
|
@@ -7438,7 +7440,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
|
|
|
7438
7440
|
private keyDownMapping;
|
|
7439
7441
|
private isViewportTooSmall;
|
|
7440
7442
|
get model(): Model;
|
|
7441
|
-
getStyle():
|
|
7443
|
+
getStyle(): "grid-template-rows: auto;" | "grid-template-rows: 63px auto 37px";
|
|
7442
7444
|
setup(): void;
|
|
7443
7445
|
get focusTopBarComposer(): Omit<ComposerFocusType, "cellFocus">;
|
|
7444
7446
|
get focusGridComposer(): ComposerFocusType;
|