@odoo/o-spreadsheet 17.0.15 → 17.0.17
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 +148 -64
- package/dist/o-spreadsheet.d.ts +3 -1
- package/dist/o-spreadsheet.esm.js +148 -64
- package/dist/o-spreadsheet.iife.js +148 -64
- package/dist/o-spreadsheet.iife.min.js +280 -275
- package/dist/o_spreadsheet.xml +34 -22
- package/package.json +2 -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 17.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.17
|
|
6
|
+
* @date 2024-04-05T13:59:37.139Z
|
|
7
|
+
* @hash 33f09d7
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -559,7 +559,7 @@ function getItemId(item, itemsDic) {
|
|
|
559
559
|
}
|
|
560
560
|
// Generate new Id if the item didn't exist in the dictionary
|
|
561
561
|
const ids = Object.keys(itemsDic);
|
|
562
|
-
const maxId = ids.length === 0 ? 0 :
|
|
562
|
+
const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
|
|
563
563
|
itemsDic[maxId + 1] = item;
|
|
564
564
|
return maxId + 1;
|
|
565
565
|
}
|
|
@@ -776,6 +776,34 @@ function isNumberBetween(value, min, max) {
|
|
|
776
776
|
}
|
|
777
777
|
return value >= min && value <= max;
|
|
778
778
|
}
|
|
779
|
+
/**
|
|
780
|
+
* Alternative to Math.max that works with large arrays.
|
|
781
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
782
|
+
*/
|
|
783
|
+
function largeMax(array) {
|
|
784
|
+
let len = array.length;
|
|
785
|
+
if (len < 100000)
|
|
786
|
+
return Math.max(...array);
|
|
787
|
+
let max = -Infinity;
|
|
788
|
+
while (len--) {
|
|
789
|
+
max = array[len] > max ? array[len] : max;
|
|
790
|
+
}
|
|
791
|
+
return max;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Alternative to Math.min that works with large arrays.
|
|
795
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
796
|
+
*/
|
|
797
|
+
function largeMin(array) {
|
|
798
|
+
let len = array.length;
|
|
799
|
+
if (len < 100000)
|
|
800
|
+
return Math.min(...array);
|
|
801
|
+
let min = +Infinity;
|
|
802
|
+
while (len--) {
|
|
803
|
+
min = array[len] < min ? array[len] : min;
|
|
804
|
+
}
|
|
805
|
+
return min;
|
|
806
|
+
}
|
|
779
807
|
|
|
780
808
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
781
809
|
const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
|
|
@@ -4422,8 +4450,9 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
|
4422
4450
|
* Get the default height of the cell given its style.
|
|
4423
4451
|
*/
|
|
4424
4452
|
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4425
|
-
if (!cell || !cell.content)
|
|
4453
|
+
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4426
4454
|
return DEFAULT_CELL_HEIGHT;
|
|
4455
|
+
}
|
|
4427
4456
|
const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4428
4457
|
const numberOfLines = cell.isFormula
|
|
4429
4458
|
? 1
|
|
@@ -8326,10 +8355,10 @@ function aggregateDataForLabels(labels, datasets) {
|
|
|
8326
8355
|
}
|
|
8327
8356
|
}
|
|
8328
8357
|
return {
|
|
8329
|
-
labels:
|
|
8358
|
+
labels: Array.from(labelSet),
|
|
8330
8359
|
dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
|
|
8331
8360
|
...dataset,
|
|
8332
|
-
data:
|
|
8361
|
+
data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
|
|
8333
8362
|
})),
|
|
8334
8363
|
};
|
|
8335
8364
|
}
|
|
@@ -8380,7 +8409,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale })
|
|
|
8380
8409
|
const xLabel = tooltipItem.dataset?.label || tooltipItem.label;
|
|
8381
8410
|
// tooltipItem.parsed.y can be an object or a number for pie charts
|
|
8382
8411
|
const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
|
|
8383
|
-
const toolTipFormat = !format && yLabel
|
|
8412
|
+
const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
|
|
8384
8413
|
const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
|
|
8385
8414
|
return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
|
|
8386
8415
|
},
|
|
@@ -8666,7 +8695,10 @@ function getBarConfiguration(chart, labels, localeFormat) {
|
|
|
8666
8695
|
if (isNaN(value))
|
|
8667
8696
|
return value;
|
|
8668
8697
|
const { locale, format } = localeFormat;
|
|
8669
|
-
return formatValue(value, {
|
|
8698
|
+
return formatValue(value, {
|
|
8699
|
+
locale,
|
|
8700
|
+
format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
|
|
8701
|
+
});
|
|
8670
8702
|
},
|
|
8671
8703
|
},
|
|
8672
8704
|
},
|
|
@@ -9080,7 +9112,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
|
|
|
9080
9112
|
return undefined;
|
|
9081
9113
|
}
|
|
9082
9114
|
const labelsTimestamps = labelDates.map((date) => date.getTime());
|
|
9083
|
-
const period =
|
|
9115
|
+
const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
|
|
9084
9116
|
const minUnit = getFormatMinDisplayUnit(format);
|
|
9085
9117
|
if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
|
|
9086
9118
|
return "second";
|
|
@@ -9317,7 +9349,10 @@ function getLineConfiguration(chart, labels, localeFormat) {
|
|
|
9317
9349
|
if (isNaN(value))
|
|
9318
9350
|
return value;
|
|
9319
9351
|
const { locale, format } = localeFormat;
|
|
9320
|
-
return formatValue(value, {
|
|
9352
|
+
return formatValue(value, {
|
|
9353
|
+
locale,
|
|
9354
|
+
format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
|
|
9355
|
+
});
|
|
9321
9356
|
},
|
|
9322
9357
|
},
|
|
9323
9358
|
},
|
|
@@ -9544,7 +9579,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
|
|
|
9544
9579
|
const percentage = calculatePercentage(data, dataIndex);
|
|
9545
9580
|
const xLabel = tooltipItem.label || tooltipItem.dataset.label;
|
|
9546
9581
|
const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
|
|
9547
|
-
const toolTipFormat = !format && yLabel
|
|
9582
|
+
const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
|
|
9548
9583
|
const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
|
|
9549
9584
|
return xLabel ? `${xLabel}: ${yLabelStr} (${percentage}%)` : `${yLabelStr} (${percentage}%)`;
|
|
9550
9585
|
};
|
|
@@ -9552,7 +9587,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
|
|
|
9552
9587
|
}
|
|
9553
9588
|
function getPieColors(colors, dataSetsValues) {
|
|
9554
9589
|
const pieColors = [];
|
|
9555
|
-
const maxLength =
|
|
9590
|
+
const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
|
|
9556
9591
|
for (let i = 0; i <= maxLength; i++) {
|
|
9557
9592
|
pieColors.push(colors.next());
|
|
9558
9593
|
}
|
|
@@ -10454,8 +10489,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
|
|
|
10454
10489
|
let last;
|
|
10455
10490
|
const activesRows = env.model.getters.getActiveRows();
|
|
10456
10491
|
if (activesRows.size !== 0) {
|
|
10457
|
-
first =
|
|
10458
|
-
last =
|
|
10492
|
+
first = largeMin([...activesRows]);
|
|
10493
|
+
last = largeMax([...activesRows]);
|
|
10459
10494
|
}
|
|
10460
10495
|
else {
|
|
10461
10496
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10483,8 +10518,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
|
|
|
10483
10518
|
let last;
|
|
10484
10519
|
const activeCols = env.model.getters.getActiveCols();
|
|
10485
10520
|
if (activeCols.size !== 0) {
|
|
10486
|
-
first =
|
|
10487
|
-
last =
|
|
10521
|
+
first = largeMin([...activeCols]);
|
|
10522
|
+
last = largeMax([...activeCols]);
|
|
10488
10523
|
}
|
|
10489
10524
|
else {
|
|
10490
10525
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10512,8 +10547,8 @@ const REMOVE_ROWS_NAME = (env) => {
|
|
|
10512
10547
|
let last;
|
|
10513
10548
|
const activesRows = env.model.getters.getActiveRows();
|
|
10514
10549
|
if (activesRows.size !== 0) {
|
|
10515
|
-
first =
|
|
10516
|
-
last =
|
|
10550
|
+
first = largeMin([...activesRows]);
|
|
10551
|
+
last = largeMax([...activesRows]);
|
|
10517
10552
|
}
|
|
10518
10553
|
else {
|
|
10519
10554
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10554,8 +10589,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
|
|
|
10554
10589
|
let last;
|
|
10555
10590
|
const activeCols = env.model.getters.getActiveCols();
|
|
10556
10591
|
if (activeCols.size !== 0) {
|
|
10557
|
-
first =
|
|
10558
|
-
last =
|
|
10592
|
+
first = largeMin([...activeCols]);
|
|
10593
|
+
last = largeMax([...activeCols]);
|
|
10559
10594
|
}
|
|
10560
10595
|
else {
|
|
10561
10596
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10596,7 +10631,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
|
10596
10631
|
let row;
|
|
10597
10632
|
let quantity;
|
|
10598
10633
|
if (activeRows.size) {
|
|
10599
|
-
row =
|
|
10634
|
+
row = largeMin([...activeRows]);
|
|
10600
10635
|
quantity = activeRows.size;
|
|
10601
10636
|
}
|
|
10602
10637
|
else {
|
|
@@ -10617,7 +10652,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
|
|
|
10617
10652
|
let row;
|
|
10618
10653
|
let quantity;
|
|
10619
10654
|
if (activeRows.size) {
|
|
10620
|
-
row =
|
|
10655
|
+
row = largeMax([...activeRows]);
|
|
10621
10656
|
quantity = activeRows.size;
|
|
10622
10657
|
}
|
|
10623
10658
|
else {
|
|
@@ -10638,7 +10673,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
|
|
|
10638
10673
|
let column;
|
|
10639
10674
|
let quantity;
|
|
10640
10675
|
if (activeCols.size) {
|
|
10641
|
-
column =
|
|
10676
|
+
column = largeMin([...activeCols]);
|
|
10642
10677
|
quantity = activeCols.size;
|
|
10643
10678
|
}
|
|
10644
10679
|
else {
|
|
@@ -10659,7 +10694,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
|
|
|
10659
10694
|
let column;
|
|
10660
10695
|
let quantity;
|
|
10661
10696
|
if (activeCols.size) {
|
|
10662
|
-
column =
|
|
10697
|
+
column = largeMax([...activeCols]);
|
|
10663
10698
|
quantity = activeCols.size;
|
|
10664
10699
|
}
|
|
10665
10700
|
else {
|
|
@@ -11057,6 +11092,9 @@ function makeArg(str, description) {
|
|
|
11057
11092
|
result.default = true;
|
|
11058
11093
|
result.defaultValue = defaultValue;
|
|
11059
11094
|
}
|
|
11095
|
+
if (types.some((t) => t.startsWith("RANGE"))) {
|
|
11096
|
+
result.acceptMatrix = true;
|
|
11097
|
+
}
|
|
11060
11098
|
return result;
|
|
11061
11099
|
}
|
|
11062
11100
|
/**
|
|
@@ -19422,11 +19460,27 @@ class FunctionRegistry extends Registry {
|
|
|
19422
19460
|
}
|
|
19423
19461
|
const descr = addMetaInfoFromArg(addDescr);
|
|
19424
19462
|
validateArguments(descr.args);
|
|
19425
|
-
this.mapping[name] = createComputeFunctionFromDescription(descr);
|
|
19463
|
+
this.mapping[name] = addInputHandling(descr, createComputeFunctionFromDescription(descr));
|
|
19426
19464
|
super.add(name, descr);
|
|
19427
19465
|
return this;
|
|
19428
19466
|
}
|
|
19429
19467
|
}
|
|
19468
|
+
function addInputHandling(descr, computeFunction) {
|
|
19469
|
+
function computeWithInputHandling(...args) {
|
|
19470
|
+
for (let i = 0; i < args.length; i++) {
|
|
19471
|
+
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
19472
|
+
const arg = args[i];
|
|
19473
|
+
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
19474
|
+
if (arg.length !== 1 || arg[0].length !== 1) {
|
|
19475
|
+
throw new EvaluationError(CellErrorType.GenericError, _t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be a single value or a single cell reference, not a range.", argDefinition.name));
|
|
19476
|
+
}
|
|
19477
|
+
args[i] = arg[0][0];
|
|
19478
|
+
}
|
|
19479
|
+
}
|
|
19480
|
+
return computeFunction.apply(this, args);
|
|
19481
|
+
}
|
|
19482
|
+
return computeWithInputHandling;
|
|
19483
|
+
}
|
|
19430
19484
|
function createComputeFunctionFromDescription(descr) {
|
|
19431
19485
|
const computeValueAndFormat = "computeValueAndFormat" in descr;
|
|
19432
19486
|
const computeValue = "compute" in descr;
|
|
@@ -19677,14 +19731,19 @@ const categorieFunctionAll = {
|
|
|
19677
19731
|
children: [allFunctionListMenuBuilder],
|
|
19678
19732
|
};
|
|
19679
19733
|
function allFunctionListMenuBuilder() {
|
|
19680
|
-
const fnNames = functionRegistry.getKeys();
|
|
19734
|
+
const fnNames = functionRegistry.getKeys().filter((key) => !functionRegistry.get(key).hidden);
|
|
19681
19735
|
return createFormulaFunctions(fnNames);
|
|
19682
19736
|
}
|
|
19683
19737
|
const categoriesFunctionListMenuBuilder = () => {
|
|
19684
19738
|
const functions = functionRegistry.content;
|
|
19685
|
-
const categories = [
|
|
19739
|
+
const categories = [
|
|
19740
|
+
...new Set(functionRegistry
|
|
19741
|
+
.getAll()
|
|
19742
|
+
.filter((fn) => !fn.hidden)
|
|
19743
|
+
.map((fn) => fn.category)),
|
|
19744
|
+
].filter(isDefined$1);
|
|
19686
19745
|
return categories.sort().map((category, i) => {
|
|
19687
|
-
const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category);
|
|
19746
|
+
const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category && !functions[key].hidden);
|
|
19688
19747
|
return {
|
|
19689
19748
|
name: category,
|
|
19690
19749
|
children: createFormulaFunctions(functionsInCategory),
|
|
@@ -23337,11 +23396,9 @@ css /* scss */ `
|
|
|
23337
23396
|
}
|
|
23338
23397
|
.o-cell-is-operator {
|
|
23339
23398
|
margin-bottom: 5px;
|
|
23340
|
-
width: 96%;
|
|
23341
23399
|
}
|
|
23342
23400
|
.o-cell-is-value {
|
|
23343
23401
|
margin-bottom: 5px;
|
|
23344
|
-
width: 96%;
|
|
23345
23402
|
}
|
|
23346
23403
|
.o-color-picker-widget .o-color-picker-button {
|
|
23347
23404
|
pointer-events: all;
|
|
@@ -25707,6 +25764,9 @@ class FigureComponent extends owl.Component {
|
|
|
25707
25764
|
el?.focus({ preventScroll: true });
|
|
25708
25765
|
}
|
|
25709
25766
|
}, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
|
|
25767
|
+
owl.onWillUnmount(() => {
|
|
25768
|
+
this.props.onFigureDeleted();
|
|
25769
|
+
});
|
|
25710
25770
|
}
|
|
25711
25771
|
clickAnchor(dirX, dirY, ev) {
|
|
25712
25772
|
this.props.onClickAnchor(dirX, dirY, ev);
|
|
@@ -25725,6 +25785,7 @@ class FigureComponent extends owl.Component {
|
|
|
25725
25785
|
this.props.onFigureDeleted();
|
|
25726
25786
|
ev.stopPropagation();
|
|
25727
25787
|
ev.preventDefault();
|
|
25788
|
+
ev.stopPropagation();
|
|
25728
25789
|
break;
|
|
25729
25790
|
case "ArrowDown":
|
|
25730
25791
|
case "ArrowLeft":
|
|
@@ -25745,6 +25806,7 @@ class FigureComponent extends owl.Component {
|
|
|
25745
25806
|
});
|
|
25746
25807
|
ev.stopPropagation();
|
|
25747
25808
|
ev.preventDefault();
|
|
25809
|
+
ev.stopPropagation();
|
|
25748
25810
|
break;
|
|
25749
25811
|
}
|
|
25750
25812
|
}
|
|
@@ -26426,6 +26488,7 @@ function compareContentToSpanElement(content, node) {
|
|
|
26426
26488
|
// -----------------------------------------------------------------------------
|
|
26427
26489
|
css /* scss */ `
|
|
26428
26490
|
.o-formula-assistant {
|
|
26491
|
+
background: #ffffff;
|
|
26429
26492
|
.o-formula-assistant-head {
|
|
26430
26493
|
background-color: #f2f2f2;
|
|
26431
26494
|
padding: 10px;
|
|
@@ -26476,6 +26539,9 @@ class FunctionDescriptionProvider extends owl.Component {
|
|
|
26476
26539
|
this.assistantState.allowCellSelectionBehind = false;
|
|
26477
26540
|
}, 2000);
|
|
26478
26541
|
}
|
|
26542
|
+
get formulaArgSeparator() {
|
|
26543
|
+
return this.env.model.getters.getLocale().formulaArgSeparator + " ";
|
|
26544
|
+
}
|
|
26479
26545
|
}
|
|
26480
26546
|
FunctionDescriptionProvider.props = {
|
|
26481
26547
|
functionName: String,
|
|
@@ -26627,6 +26693,12 @@ class Composer extends owl.Component {
|
|
|
26627
26693
|
owl.useEffect(() => {
|
|
26628
26694
|
this.processContent();
|
|
26629
26695
|
});
|
|
26696
|
+
owl.onPatched(() => {
|
|
26697
|
+
// Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
|
|
26698
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
26699
|
+
this.processTokenAtCursor();
|
|
26700
|
+
}
|
|
26701
|
+
});
|
|
26630
26702
|
}
|
|
26631
26703
|
// ---------------------------------------------------------------------------
|
|
26632
26704
|
// Handlers
|
|
@@ -31819,7 +31891,7 @@ function convertHyperlink(link, cellValue, warningManager) {
|
|
|
31819
31891
|
function getSheetDims(sheet) {
|
|
31820
31892
|
const dims = [0, 0];
|
|
31821
31893
|
for (let row of sheet.rows) {
|
|
31822
|
-
dims[0] = Math.max(dims[0],
|
|
31894
|
+
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
31823
31895
|
dims[1] = Math.max(dims[1], row.index);
|
|
31824
31896
|
}
|
|
31825
31897
|
dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
@@ -36709,6 +36781,9 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
36709
36781
|
if (newRule.criterion.type === "isBoolean") {
|
|
36710
36782
|
this.setCenterStyleToBooleanCells(newRule);
|
|
36711
36783
|
}
|
|
36784
|
+
else if (newRule.criterion.type === "isValueInList") {
|
|
36785
|
+
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
36786
|
+
}
|
|
36712
36787
|
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
36713
36788
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
36714
36789
|
if (ruleIndex !== -1) {
|
|
@@ -37435,7 +37510,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
37435
37510
|
if (hiddenElements.size >= elements) {
|
|
37436
37511
|
return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
|
|
37437
37512
|
}
|
|
37438
|
-
else if (
|
|
37513
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
37439
37514
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
37440
37515
|
}
|
|
37441
37516
|
else {
|
|
@@ -38250,8 +38325,8 @@ class RangeAdapter {
|
|
|
38250
38325
|
let newRange = range;
|
|
38251
38326
|
let changeType = "NONE";
|
|
38252
38327
|
for (let group of groups) {
|
|
38253
|
-
const min =
|
|
38254
|
-
const max =
|
|
38328
|
+
const min = largeMin(group);
|
|
38329
|
+
const max = largeMax(group);
|
|
38255
38330
|
if (range.zone[start] <= min && min <= range.zone[end]) {
|
|
38256
38331
|
const toRemove = Math.min(range.zone[end], max) - min + 1;
|
|
38257
38332
|
changeType = "RESIZE";
|
|
@@ -38674,8 +38749,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
38674
38749
|
}
|
|
38675
38750
|
return "Success" /* CommandResult.Success */;
|
|
38676
38751
|
case "REMOVE_COLUMNS_ROWS": {
|
|
38677
|
-
const min =
|
|
38678
|
-
const max =
|
|
38752
|
+
const min = largeMin(cmd.elements);
|
|
38753
|
+
const max = largeMax(cmd.elements);
|
|
38679
38754
|
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
|
|
38680
38755
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
38681
38756
|
}
|
|
@@ -41587,7 +41662,7 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
41587
41662
|
? getItemId(newFormat, data.formats)
|
|
41588
41663
|
: exportedCellData.format;
|
|
41589
41664
|
let content;
|
|
41590
|
-
if (formulaCell instanceof FormulaCellWithDependencies) {
|
|
41665
|
+
if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
|
|
41591
41666
|
content = this.getters.getFormulaCellContent(exportedSheetData.id, formulaCell.compiledFormula, formulaCell.compiledFormula.dependencies, true);
|
|
41592
41667
|
}
|
|
41593
41668
|
else {
|
|
@@ -42007,13 +42082,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
42007
42082
|
.map((cell) => cell.value);
|
|
42008
42083
|
switch (threshold.type) {
|
|
42009
42084
|
case "value":
|
|
42010
|
-
const result = functionName === "max" ?
|
|
42085
|
+
const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
42011
42086
|
return result;
|
|
42012
42087
|
case "number":
|
|
42013
42088
|
return Number(threshold.value);
|
|
42014
42089
|
case "percentage":
|
|
42015
|
-
const min =
|
|
42016
|
-
const max =
|
|
42090
|
+
const min = largeMin(rangeValues);
|
|
42091
|
+
const max = largeMax(rangeValues);
|
|
42017
42092
|
const delta = max - min;
|
|
42018
42093
|
return min + (delta * Number(threshold.value)) / 100;
|
|
42019
42094
|
case "percentile":
|
|
@@ -43065,13 +43140,13 @@ class AutomaticSumPlugin extends UIPlugin {
|
|
|
43065
43140
|
const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
|
|
43066
43141
|
const cellPositions = range(end, -1, -1);
|
|
43067
43142
|
const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
|
|
43068
|
-
const maxValidPosition =
|
|
43143
|
+
const maxValidPosition = largeMax(invalidCells);
|
|
43069
43144
|
const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
|
|
43070
43145
|
const firstSequence = numberSequences[0] || [];
|
|
43071
|
-
if (
|
|
43146
|
+
if (largeMax(firstSequence) < maxValidPosition) {
|
|
43072
43147
|
return Infinity;
|
|
43073
43148
|
}
|
|
43074
|
-
return
|
|
43149
|
+
return largeMin(firstSequence);
|
|
43075
43150
|
}
|
|
43076
43151
|
shouldFindData(sheetId, zone) {
|
|
43077
43152
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
@@ -45475,7 +45550,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
45475
45550
|
* column of the current viewport
|
|
45476
45551
|
*/
|
|
45477
45552
|
getColDimensionsInViewport(sheetId, col) {
|
|
45478
|
-
const left =
|
|
45553
|
+
const left = largeMin(this.getters.getSheetViewVisibleCols());
|
|
45479
45554
|
const start = this.getters.getColRowOffsetInViewport("COL", left, col);
|
|
45480
45555
|
const size = this.getters.getColSize(sheetId, col);
|
|
45481
45556
|
const isColHidden = this.getters.isColHidden(sheetId, col);
|
|
@@ -45490,7 +45565,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
45490
45565
|
* of the current viewport
|
|
45491
45566
|
*/
|
|
45492
45567
|
getRowDimensionsInViewport(sheetId, row) {
|
|
45493
|
-
const top =
|
|
45568
|
+
const top = largeMin(this.getters.getSheetViewVisibleRows());
|
|
45494
45569
|
const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
|
|
45495
45570
|
const size = this.getters.getRowSize(sheetId, row);
|
|
45496
45571
|
const isRowHidden = this.getters.isRowHidden(sheetId, row);
|
|
@@ -46954,7 +47029,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
46954
47029
|
getColMaxWidth(sheetId, index) {
|
|
46955
47030
|
const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
|
|
46956
47031
|
const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
|
|
46957
|
-
return Math.max(0,
|
|
47032
|
+
return Math.max(0, largeMax(sizes));
|
|
46958
47033
|
}
|
|
46959
47034
|
/**
|
|
46960
47035
|
* Check that any "sheetId" in the command matches an existing
|
|
@@ -47719,7 +47794,7 @@ class ClipboardOsState extends ClipboardCellsAbstractState {
|
|
|
47719
47794
|
}
|
|
47720
47795
|
getPasteZone(target) {
|
|
47721
47796
|
const height = this.values.length;
|
|
47722
|
-
const width =
|
|
47797
|
+
const width = largeMax(this.values.map((a) => a.length));
|
|
47723
47798
|
const { left: activeCol, top: activeRow } = target[0];
|
|
47724
47799
|
return {
|
|
47725
47800
|
top: activeRow,
|
|
@@ -48756,11 +48831,11 @@ class EditionPlugin extends UIPlugin {
|
|
|
48756
48831
|
}
|
|
48757
48832
|
else {
|
|
48758
48833
|
const range = this.getters.getRangeFromSheetXC(this.sheetId, rule.criterion.values[0]);
|
|
48759
|
-
values = this.getters
|
|
48834
|
+
values = Array.from(new Set(this.getters
|
|
48760
48835
|
.getRangeValues(range)
|
|
48761
48836
|
.filter(isNotNull)
|
|
48762
48837
|
.map((value) => value.toString())
|
|
48763
|
-
.filter((val) => val !== "");
|
|
48838
|
+
.filter((val) => val !== "")));
|
|
48764
48839
|
}
|
|
48765
48840
|
const composerContent = this.getCurrentContent();
|
|
48766
48841
|
if (composerContent && composerContent !== this.getInitialComposerContent()) {
|
|
@@ -49297,6 +49372,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
49297
49372
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
49298
49373
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
49299
49374
|
this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
|
|
49375
|
+
this.selectedFigureId = null;
|
|
49300
49376
|
break;
|
|
49301
49377
|
}
|
|
49302
49378
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
@@ -51216,12 +51292,14 @@ class BottomBarSheet extends owl.Component {
|
|
|
51216
51292
|
this.editionState = "initializing";
|
|
51217
51293
|
}
|
|
51218
51294
|
stopEdition() {
|
|
51219
|
-
|
|
51295
|
+
const input = this.sheetNameRef.el;
|
|
51296
|
+
if (!this.state.isEditing || !input)
|
|
51220
51297
|
return;
|
|
51221
51298
|
this.state.isEditing = false;
|
|
51222
51299
|
this.editionState = "initializing";
|
|
51223
|
-
|
|
51300
|
+
input.blur();
|
|
51224
51301
|
const inputValue = this.getInputContent() || "";
|
|
51302
|
+
input.innerText = inputValue;
|
|
51225
51303
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
51226
51304
|
}
|
|
51227
51305
|
cancelEdition() {
|
|
@@ -51515,7 +51593,7 @@ class BottomBar extends owl.Component {
|
|
|
51515
51593
|
this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
|
|
51516
51594
|
}
|
|
51517
51595
|
onSheetMouseDown(sheetId, event) {
|
|
51518
|
-
if (event.button !== 0)
|
|
51596
|
+
if (event.button !== 0 || this.env.model.getters.isReadonly())
|
|
51519
51597
|
return;
|
|
51520
51598
|
this.closeMenu();
|
|
51521
51599
|
const visibleSheets = this.getVisibleSheets();
|
|
@@ -52874,9 +52952,6 @@ css /* scss */ `
|
|
|
52874
52952
|
.text-muted {
|
|
52875
52953
|
color: grey !important;
|
|
52876
52954
|
}
|
|
52877
|
-
button {
|
|
52878
|
-
color: #333;
|
|
52879
|
-
}
|
|
52880
52955
|
.o-disabled {
|
|
52881
52956
|
opacity: 0.4;
|
|
52882
52957
|
pointer: default;
|
|
@@ -52997,17 +53072,17 @@ css /* scss */ `
|
|
|
52997
53072
|
}
|
|
52998
53073
|
|
|
52999
53074
|
.o-button {
|
|
53000
|
-
border: 1px solid
|
|
53075
|
+
border: 1px solid;
|
|
53001
53076
|
padding: 0px 20px 0px 20px;
|
|
53002
53077
|
border-radius: 4px;
|
|
53003
53078
|
font-weight: 500;
|
|
53004
53079
|
font-size: 14px;
|
|
53005
53080
|
height: 30px;
|
|
53006
53081
|
line-height: 16px;
|
|
53007
|
-
background: white;
|
|
53008
53082
|
margin-right: 8px;
|
|
53009
|
-
|
|
53010
|
-
|
|
53083
|
+
|
|
53084
|
+
&:not(:hover) {
|
|
53085
|
+
background-color: transparent;
|
|
53011
53086
|
}
|
|
53012
53087
|
|
|
53013
53088
|
&:enabled {
|
|
@@ -53021,6 +53096,15 @@ css /* scss */ `
|
|
|
53021
53096
|
&:last-child {
|
|
53022
53097
|
margin-right: 0px;
|
|
53023
53098
|
}
|
|
53099
|
+
|
|
53100
|
+
&.o-button-grey {
|
|
53101
|
+
border-color: lightgrey;
|
|
53102
|
+
background: #ffffff;
|
|
53103
|
+
color: #333;
|
|
53104
|
+
&:hover:enabled {
|
|
53105
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
53106
|
+
}
|
|
53107
|
+
}
|
|
53024
53108
|
}
|
|
53025
53109
|
|
|
53026
53110
|
.o-input {
|
|
@@ -55014,7 +55098,7 @@ function addLineChart(chart) {
|
|
|
55014
55098
|
}
|
|
55015
55099
|
function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
|
|
55016
55100
|
const colors = new ChartColors();
|
|
55017
|
-
const maxLength =
|
|
55101
|
+
const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
|
|
55018
55102
|
const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
|
|
55019
55103
|
const dataSetsNodes = [];
|
|
55020
55104
|
for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
|
|
@@ -56968,6 +57052,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
56968
57052
|
exports.tokenize = tokenize;
|
|
56969
57053
|
|
|
56970
57054
|
|
|
56971
|
-
__info__.version = "17.0.
|
|
56972
|
-
__info__.date = "2024-
|
|
56973
|
-
__info__.hash = "
|
|
57055
|
+
__info__.version = "17.0.17";
|
|
57056
|
+
__info__.date = "2024-04-05T13:59:37.139Z";
|
|
57057
|
+
__info__.hash = "33f09d7";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -3122,6 +3122,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
|
|
|
3122
3122
|
|
|
3123
3123
|
type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
|
|
3124
3124
|
interface ArgDefinition {
|
|
3125
|
+
acceptMatrix?: boolean;
|
|
3125
3126
|
repeating?: boolean;
|
|
3126
3127
|
optional?: boolean;
|
|
3127
3128
|
lazy?: boolean;
|
|
@@ -7180,13 +7181,14 @@ interface Props$a {
|
|
|
7180
7181
|
interface AssistantState {
|
|
7181
7182
|
allowCellSelectionBehind: boolean;
|
|
7182
7183
|
}
|
|
7183
|
-
declare class FunctionDescriptionProvider extends Component<Props$a> {
|
|
7184
|
+
declare class FunctionDescriptionProvider extends Component<Props$a, SpreadsheetChildEnv> {
|
|
7184
7185
|
static template: string;
|
|
7185
7186
|
assistantState: AssistantState;
|
|
7186
7187
|
private timeOutId;
|
|
7187
7188
|
setup(): void;
|
|
7188
7189
|
getContext(): Props$a;
|
|
7189
7190
|
onMouseMove(): void;
|
|
7191
|
+
get formulaArgSeparator(): string;
|
|
7190
7192
|
}
|
|
7191
7193
|
|
|
7192
7194
|
type HtmlContent = {
|