@odoo/o-spreadsheet 17.0.16 → 17.0.18
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 +149 -100
- package/dist/o-spreadsheet.d.ts +3 -0
- package/dist/o-spreadsheet.esm.js +149 -100
- package/dist/o-spreadsheet.iife.js +149 -100
- package/dist/o-spreadsheet.iife.min.js +260 -260
- package/dist/o_spreadsheet.xml +7 -6
- 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.18
|
|
6
|
+
* @date 2024-04-10T13:28:23.664Z
|
|
7
|
+
* @hash 6294758
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -557,7 +557,7 @@ function getItemId(item, itemsDic) {
|
|
|
557
557
|
}
|
|
558
558
|
// Generate new Id if the item didn't exist in the dictionary
|
|
559
559
|
const ids = Object.keys(itemsDic);
|
|
560
|
-
const maxId = ids.length === 0 ? 0 :
|
|
560
|
+
const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
|
|
561
561
|
itemsDic[maxId + 1] = item;
|
|
562
562
|
return maxId + 1;
|
|
563
563
|
}
|
|
@@ -648,7 +648,7 @@ function deepEquals(o1, o2) {
|
|
|
648
648
|
if (typeof o1 !== typeof o2)
|
|
649
649
|
return false;
|
|
650
650
|
if (typeof o1 !== "object")
|
|
651
|
-
return
|
|
651
|
+
return false;
|
|
652
652
|
// Objects can have different keys if the values are undefined
|
|
653
653
|
for (const key in o2) {
|
|
654
654
|
if (!(key in o1) && o2[key] !== undefined) {
|
|
@@ -774,6 +774,34 @@ function isNumberBetween(value, min, max) {
|
|
|
774
774
|
}
|
|
775
775
|
return value >= min && value <= max;
|
|
776
776
|
}
|
|
777
|
+
/**
|
|
778
|
+
* Alternative to Math.max that works with large arrays.
|
|
779
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
780
|
+
*/
|
|
781
|
+
function largeMax(array) {
|
|
782
|
+
let len = array.length;
|
|
783
|
+
if (len < 100000)
|
|
784
|
+
return Math.max(...array);
|
|
785
|
+
let max = -Infinity;
|
|
786
|
+
while (len--) {
|
|
787
|
+
max = array[len] > max ? array[len] : max;
|
|
788
|
+
}
|
|
789
|
+
return max;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Alternative to Math.min that works with large arrays.
|
|
793
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
794
|
+
*/
|
|
795
|
+
function largeMin(array) {
|
|
796
|
+
let len = array.length;
|
|
797
|
+
if (len < 100000)
|
|
798
|
+
return Math.min(...array);
|
|
799
|
+
let min = +Infinity;
|
|
800
|
+
while (len--) {
|
|
801
|
+
min = array[len] < min ? array[len] : min;
|
|
802
|
+
}
|
|
803
|
+
return min;
|
|
804
|
+
}
|
|
777
805
|
|
|
778
806
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
779
807
|
const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
|
|
@@ -4420,8 +4448,9 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
|
4420
4448
|
* Get the default height of the cell given its style.
|
|
4421
4449
|
*/
|
|
4422
4450
|
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4423
|
-
if (!cell || !cell.content)
|
|
4451
|
+
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4424
4452
|
return DEFAULT_CELL_HEIGHT;
|
|
4453
|
+
}
|
|
4425
4454
|
const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4426
4455
|
const numberOfLines = cell.isFormula
|
|
4427
4456
|
? 1
|
|
@@ -8324,10 +8353,10 @@ function aggregateDataForLabels(labels, datasets) {
|
|
|
8324
8353
|
}
|
|
8325
8354
|
}
|
|
8326
8355
|
return {
|
|
8327
|
-
labels:
|
|
8356
|
+
labels: Array.from(labelSet),
|
|
8328
8357
|
dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
|
|
8329
8358
|
...dataset,
|
|
8330
|
-
data:
|
|
8359
|
+
data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
|
|
8331
8360
|
})),
|
|
8332
8361
|
};
|
|
8333
8362
|
}
|
|
@@ -8378,7 +8407,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale })
|
|
|
8378
8407
|
const xLabel = tooltipItem.dataset?.label || tooltipItem.label;
|
|
8379
8408
|
// tooltipItem.parsed.y can be an object or a number for pie charts
|
|
8380
8409
|
const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
|
|
8381
|
-
const toolTipFormat = !format && yLabel
|
|
8410
|
+
const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
|
|
8382
8411
|
const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
|
|
8383
8412
|
return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
|
|
8384
8413
|
},
|
|
@@ -8664,7 +8693,10 @@ function getBarConfiguration(chart, labels, localeFormat) {
|
|
|
8664
8693
|
if (isNaN(value))
|
|
8665
8694
|
return value;
|
|
8666
8695
|
const { locale, format } = localeFormat;
|
|
8667
|
-
return formatValue(value, {
|
|
8696
|
+
return formatValue(value, {
|
|
8697
|
+
locale,
|
|
8698
|
+
format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
|
|
8699
|
+
});
|
|
8668
8700
|
},
|
|
8669
8701
|
},
|
|
8670
8702
|
},
|
|
@@ -9078,7 +9110,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
|
|
|
9078
9110
|
return undefined;
|
|
9079
9111
|
}
|
|
9080
9112
|
const labelsTimestamps = labelDates.map((date) => date.getTime());
|
|
9081
|
-
const period =
|
|
9113
|
+
const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
|
|
9082
9114
|
const minUnit = getFormatMinDisplayUnit(format);
|
|
9083
9115
|
if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
|
|
9084
9116
|
return "second";
|
|
@@ -9315,7 +9347,10 @@ function getLineConfiguration(chart, labels, localeFormat) {
|
|
|
9315
9347
|
if (isNaN(value))
|
|
9316
9348
|
return value;
|
|
9317
9349
|
const { locale, format } = localeFormat;
|
|
9318
|
-
return formatValue(value, {
|
|
9350
|
+
return formatValue(value, {
|
|
9351
|
+
locale,
|
|
9352
|
+
format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
|
|
9353
|
+
});
|
|
9319
9354
|
},
|
|
9320
9355
|
},
|
|
9321
9356
|
},
|
|
@@ -9542,7 +9577,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
|
|
|
9542
9577
|
const percentage = calculatePercentage(data, dataIndex);
|
|
9543
9578
|
const xLabel = tooltipItem.label || tooltipItem.dataset.label;
|
|
9544
9579
|
const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
|
|
9545
|
-
const toolTipFormat = !format && yLabel
|
|
9580
|
+
const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
|
|
9546
9581
|
const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
|
|
9547
9582
|
return xLabel ? `${xLabel}: ${yLabelStr} (${percentage}%)` : `${yLabelStr} (${percentage}%)`;
|
|
9548
9583
|
};
|
|
@@ -9550,7 +9585,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
|
|
|
9550
9585
|
}
|
|
9551
9586
|
function getPieColors(colors, dataSetsValues) {
|
|
9552
9587
|
const pieColors = [];
|
|
9553
|
-
const maxLength =
|
|
9588
|
+
const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
|
|
9554
9589
|
for (let i = 0; i <= maxLength; i++) {
|
|
9555
9590
|
pieColors.push(colors.next());
|
|
9556
9591
|
}
|
|
@@ -10452,8 +10487,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
|
|
|
10452
10487
|
let last;
|
|
10453
10488
|
const activesRows = env.model.getters.getActiveRows();
|
|
10454
10489
|
if (activesRows.size !== 0) {
|
|
10455
|
-
first =
|
|
10456
|
-
last =
|
|
10490
|
+
first = largeMin([...activesRows]);
|
|
10491
|
+
last = largeMax([...activesRows]);
|
|
10457
10492
|
}
|
|
10458
10493
|
else {
|
|
10459
10494
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10481,8 +10516,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
|
|
|
10481
10516
|
let last;
|
|
10482
10517
|
const activeCols = env.model.getters.getActiveCols();
|
|
10483
10518
|
if (activeCols.size !== 0) {
|
|
10484
|
-
first =
|
|
10485
|
-
last =
|
|
10519
|
+
first = largeMin([...activeCols]);
|
|
10520
|
+
last = largeMax([...activeCols]);
|
|
10486
10521
|
}
|
|
10487
10522
|
else {
|
|
10488
10523
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10510,8 +10545,8 @@ const REMOVE_ROWS_NAME = (env) => {
|
|
|
10510
10545
|
let last;
|
|
10511
10546
|
const activesRows = env.model.getters.getActiveRows();
|
|
10512
10547
|
if (activesRows.size !== 0) {
|
|
10513
|
-
first =
|
|
10514
|
-
last =
|
|
10548
|
+
first = largeMin([...activesRows]);
|
|
10549
|
+
last = largeMax([...activesRows]);
|
|
10515
10550
|
}
|
|
10516
10551
|
else {
|
|
10517
10552
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10552,8 +10587,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
|
|
|
10552
10587
|
let last;
|
|
10553
10588
|
const activeCols = env.model.getters.getActiveCols();
|
|
10554
10589
|
if (activeCols.size !== 0) {
|
|
10555
|
-
first =
|
|
10556
|
-
last =
|
|
10590
|
+
first = largeMin([...activeCols]);
|
|
10591
|
+
last = largeMax([...activeCols]);
|
|
10557
10592
|
}
|
|
10558
10593
|
else {
|
|
10559
10594
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -10594,7 +10629,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
|
10594
10629
|
let row;
|
|
10595
10630
|
let quantity;
|
|
10596
10631
|
if (activeRows.size) {
|
|
10597
|
-
row =
|
|
10632
|
+
row = largeMin([...activeRows]);
|
|
10598
10633
|
quantity = activeRows.size;
|
|
10599
10634
|
}
|
|
10600
10635
|
else {
|
|
@@ -10615,7 +10650,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
|
|
|
10615
10650
|
let row;
|
|
10616
10651
|
let quantity;
|
|
10617
10652
|
if (activeRows.size) {
|
|
10618
|
-
row =
|
|
10653
|
+
row = largeMax([...activeRows]);
|
|
10619
10654
|
quantity = activeRows.size;
|
|
10620
10655
|
}
|
|
10621
10656
|
else {
|
|
@@ -10636,7 +10671,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
|
|
|
10636
10671
|
let column;
|
|
10637
10672
|
let quantity;
|
|
10638
10673
|
if (activeCols.size) {
|
|
10639
|
-
column =
|
|
10674
|
+
column = largeMin([...activeCols]);
|
|
10640
10675
|
quantity = activeCols.size;
|
|
10641
10676
|
}
|
|
10642
10677
|
else {
|
|
@@ -10657,7 +10692,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
|
|
|
10657
10692
|
let column;
|
|
10658
10693
|
let quantity;
|
|
10659
10694
|
if (activeCols.size) {
|
|
10660
|
-
column =
|
|
10695
|
+
column = largeMax([...activeCols]);
|
|
10661
10696
|
quantity = activeCols.size;
|
|
10662
10697
|
}
|
|
10663
10698
|
else {
|
|
@@ -26927,6 +26962,11 @@ class Composer extends Component {
|
|
|
26927
26962
|
}
|
|
26928
26963
|
}
|
|
26929
26964
|
}
|
|
26965
|
+
onContextMenu(ev) {
|
|
26966
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
26967
|
+
this.props.onInputContextMenu?.(ev);
|
|
26968
|
+
}
|
|
26969
|
+
}
|
|
26930
26970
|
// ---------------------------------------------------------------------------
|
|
26931
26971
|
// Private
|
|
26932
26972
|
// ---------------------------------------------------------------------------
|
|
@@ -27164,6 +27204,7 @@ Composer.props = {
|
|
|
27164
27204
|
onComposerCellFocused: { type: Function, optional: true },
|
|
27165
27205
|
onComposerContentFocused: Function,
|
|
27166
27206
|
isDefaultFocus: { type: Boolean, optional: true },
|
|
27207
|
+
onInputContextMenu: { type: Function, optional: true },
|
|
27167
27208
|
};
|
|
27168
27209
|
|
|
27169
27210
|
const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
|
|
@@ -27239,6 +27280,7 @@ class GridComposer extends Component {
|
|
|
27239
27280
|
isDefaultFocus: true,
|
|
27240
27281
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
27241
27282
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
27283
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
27242
27284
|
};
|
|
27243
27285
|
}
|
|
27244
27286
|
get containerStyle() {
|
|
@@ -27327,6 +27369,7 @@ GridComposer.props = {
|
|
|
27327
27369
|
onComposerContentFocused: Function,
|
|
27328
27370
|
gridDims: Object,
|
|
27329
27371
|
onComposerCellFocused: Function,
|
|
27372
|
+
onInputContextMenu: Function,
|
|
27330
27373
|
};
|
|
27331
27374
|
|
|
27332
27375
|
const CSS$1 = css /* scss */ `
|
|
@@ -31280,29 +31323,12 @@ function convertWidthFromExcel(width) {
|
|
|
31280
31323
|
return width;
|
|
31281
31324
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
31282
31325
|
}
|
|
31283
|
-
function convertBorderDescr(descr) {
|
|
31284
|
-
if (!descr) {
|
|
31285
|
-
return undefined;
|
|
31286
|
-
}
|
|
31287
|
-
return {
|
|
31288
|
-
style: descr.style,
|
|
31289
|
-
color: { rgb: descr.color },
|
|
31290
|
-
};
|
|
31291
|
-
}
|
|
31292
31326
|
function extractStyle(cell, data) {
|
|
31293
31327
|
let style = {};
|
|
31294
31328
|
if (cell.style) {
|
|
31295
31329
|
style = data.styles[cell.style];
|
|
31296
31330
|
}
|
|
31297
31331
|
const format = extractFormat(cell, data);
|
|
31298
|
-
const exportedBorder = {};
|
|
31299
|
-
if (cell.border) {
|
|
31300
|
-
const border = data.borders[cell.border];
|
|
31301
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
31302
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
31303
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
31304
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
31305
|
-
}
|
|
31306
31332
|
const styles = {
|
|
31307
31333
|
font: {
|
|
31308
31334
|
size: style?.fontSize || DEFAULT_FONT_SIZE,
|
|
@@ -31316,7 +31342,7 @@ function extractStyle(cell, data) {
|
|
|
31316
31342
|
}
|
|
31317
31343
|
: { reservedAttribute: "none" },
|
|
31318
31344
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
31319
|
-
border:
|
|
31345
|
+
border: cell.border || 0,
|
|
31320
31346
|
alignment: {
|
|
31321
31347
|
horizontal: style.align,
|
|
31322
31348
|
vertical: style.verticalAlign
|
|
@@ -31338,15 +31364,12 @@ function extractFormat(cell, data) {
|
|
|
31338
31364
|
return undefined;
|
|
31339
31365
|
}
|
|
31340
31366
|
function normalizeStyle(construct, styles) {
|
|
31341
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
31342
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
31343
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
31344
31367
|
// Normalize this
|
|
31345
31368
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
31346
31369
|
const style = {
|
|
31347
|
-
fontId,
|
|
31348
|
-
fillId,
|
|
31349
|
-
borderId,
|
|
31370
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
31371
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
31372
|
+
borderId: styles.border,
|
|
31350
31373
|
numFmtId,
|
|
31351
31374
|
alignment: {
|
|
31352
31375
|
vertical: styles.alignment.vertical,
|
|
@@ -31354,8 +31377,7 @@ function normalizeStyle(construct, styles) {
|
|
|
31354
31377
|
wrapText: styles.alignment.wrapText,
|
|
31355
31378
|
},
|
|
31356
31379
|
};
|
|
31357
|
-
|
|
31358
|
-
return id;
|
|
31380
|
+
return pushElement(style, construct.styles);
|
|
31359
31381
|
}
|
|
31360
31382
|
function convertFormat(format, numFmtStructure) {
|
|
31361
31383
|
if (!format) {
|
|
@@ -31363,8 +31385,7 @@ function convertFormat(format, numFmtStructure) {
|
|
|
31363
31385
|
}
|
|
31364
31386
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
31365
31387
|
if (!formatId) {
|
|
31366
|
-
|
|
31367
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
31388
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
31368
31389
|
}
|
|
31369
31390
|
return formatId;
|
|
31370
31391
|
}
|
|
@@ -31389,20 +31410,15 @@ function addRelsToFile(relsFiles, path, rel) {
|
|
|
31389
31410
|
return id;
|
|
31390
31411
|
}
|
|
31391
31412
|
function pushElement(property, propertyList) {
|
|
31392
|
-
|
|
31393
|
-
|
|
31394
|
-
|
|
31413
|
+
let len = propertyList.length;
|
|
31414
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
31415
|
+
for (let i = 0; i < len; i++) {
|
|
31416
|
+
if (operator(property, propertyList[i])) {
|
|
31417
|
+
return i;
|
|
31395
31418
|
}
|
|
31396
31419
|
}
|
|
31397
|
-
|
|
31398
|
-
|
|
31399
|
-
propertyList.push(property);
|
|
31400
|
-
elemId = propertyList.length - 1;
|
|
31401
|
-
}
|
|
31402
|
-
return {
|
|
31403
|
-
id: elemId,
|
|
31404
|
-
list: propertyList,
|
|
31405
|
-
};
|
|
31420
|
+
propertyList[propertyList.length] = property;
|
|
31421
|
+
return propertyList.length - 1;
|
|
31406
31422
|
}
|
|
31407
31423
|
const chartIds = [];
|
|
31408
31424
|
/**
|
|
@@ -31854,7 +31870,7 @@ function convertHyperlink(link, cellValue, warningManager) {
|
|
|
31854
31870
|
function getSheetDims(sheet) {
|
|
31855
31871
|
const dims = [0, 0];
|
|
31856
31872
|
for (let row of sheet.rows) {
|
|
31857
|
-
dims[0] = Math.max(dims[0],
|
|
31873
|
+
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
31858
31874
|
dims[1] = Math.max(dims[1], row.index);
|
|
31859
31875
|
}
|
|
31860
31876
|
dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
@@ -32123,7 +32139,25 @@ function parseXML(xmlString, mimeType = "text/xml") {
|
|
|
32123
32139
|
}
|
|
32124
32140
|
return document;
|
|
32125
32141
|
}
|
|
32126
|
-
function
|
|
32142
|
+
function convertBorderDescr(descr) {
|
|
32143
|
+
if (!descr) {
|
|
32144
|
+
return undefined;
|
|
32145
|
+
}
|
|
32146
|
+
return {
|
|
32147
|
+
style: descr.style,
|
|
32148
|
+
color: { rgb: descr.color },
|
|
32149
|
+
};
|
|
32150
|
+
}
|
|
32151
|
+
function getDefaultXLSXStructure(data) {
|
|
32152
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
32153
|
+
return {
|
|
32154
|
+
left: convertBorderDescr(border.left),
|
|
32155
|
+
right: convertBorderDescr(border.right),
|
|
32156
|
+
bottom: convertBorderDescr(border.bottom),
|
|
32157
|
+
top: convertBorderDescr(border.top),
|
|
32158
|
+
};
|
|
32159
|
+
});
|
|
32160
|
+
const borders = [{}, ...xlsxBorders];
|
|
32127
32161
|
return {
|
|
32128
32162
|
relsFiles: [],
|
|
32129
32163
|
sharedStrings: [],
|
|
@@ -32146,7 +32180,7 @@ function getDefaultXLSXStructure() {
|
|
|
32146
32180
|
},
|
|
32147
32181
|
],
|
|
32148
32182
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
32149
|
-
borders
|
|
32183
|
+
borders,
|
|
32150
32184
|
numFmts: [],
|
|
32151
32185
|
dxfs: [],
|
|
32152
32186
|
};
|
|
@@ -36744,6 +36778,9 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
36744
36778
|
if (newRule.criterion.type === "isBoolean") {
|
|
36745
36779
|
this.setCenterStyleToBooleanCells(newRule);
|
|
36746
36780
|
}
|
|
36781
|
+
else if (newRule.criterion.type === "isValueInList") {
|
|
36782
|
+
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
36783
|
+
}
|
|
36747
36784
|
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
36748
36785
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
36749
36786
|
if (ruleIndex !== -1) {
|
|
@@ -37329,7 +37366,17 @@ class FiltersPlugin extends CorePlugin {
|
|
|
37329
37366
|
}
|
|
37330
37367
|
}
|
|
37331
37368
|
exportForExcel(data) {
|
|
37332
|
-
|
|
37369
|
+
for (const sheet of data.sheets) {
|
|
37370
|
+
for (const filterTable of this.getFilterTables(sheet.id)) {
|
|
37371
|
+
if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
|
|
37372
|
+
continue;
|
|
37373
|
+
}
|
|
37374
|
+
sheet.filterTables.push({
|
|
37375
|
+
range: zoneToXc(filterTable.zone),
|
|
37376
|
+
filters: [],
|
|
37377
|
+
});
|
|
37378
|
+
}
|
|
37379
|
+
}
|
|
37333
37380
|
}
|
|
37334
37381
|
}
|
|
37335
37382
|
|
|
@@ -37470,7 +37517,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
37470
37517
|
if (hiddenElements.size >= elements) {
|
|
37471
37518
|
return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
|
|
37472
37519
|
}
|
|
37473
|
-
else if (
|
|
37520
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
37474
37521
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
37475
37522
|
}
|
|
37476
37523
|
else {
|
|
@@ -38285,8 +38332,8 @@ class RangeAdapter {
|
|
|
38285
38332
|
let newRange = range;
|
|
38286
38333
|
let changeType = "NONE";
|
|
38287
38334
|
for (let group of groups) {
|
|
38288
|
-
const min =
|
|
38289
|
-
const max =
|
|
38335
|
+
const min = largeMin(group);
|
|
38336
|
+
const max = largeMax(group);
|
|
38290
38337
|
if (range.zone[start] <= min && min <= range.zone[end]) {
|
|
38291
38338
|
const toRemove = Math.min(range.zone[end], max) - min + 1;
|
|
38292
38339
|
changeType = "RESIZE";
|
|
@@ -38709,8 +38756,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
38709
38756
|
}
|
|
38710
38757
|
return "Success" /* CommandResult.Success */;
|
|
38711
38758
|
case "REMOVE_COLUMNS_ROWS": {
|
|
38712
|
-
const min =
|
|
38713
|
-
const max =
|
|
38759
|
+
const min = largeMin(cmd.elements);
|
|
38760
|
+
const max = largeMax(cmd.elements);
|
|
38714
38761
|
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
|
|
38715
38762
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
38716
38763
|
}
|
|
@@ -41058,7 +41105,9 @@ class Evaluator {
|
|
|
41058
41105
|
this.blockedArrayFormulas = new Set();
|
|
41059
41106
|
this.spreadingRelations = new SpreadingRelation();
|
|
41060
41107
|
this.formulaDependencies = lazy(() => {
|
|
41061
|
-
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
|
|
41108
|
+
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
|
|
41109
|
+
.filter((range) => !range.invalidSheetName && !range.invalidXc)
|
|
41110
|
+
.map((range) => ({
|
|
41062
41111
|
data: positionId,
|
|
41063
41112
|
boundingBox: {
|
|
41064
41113
|
zone: range.zone,
|
|
@@ -42042,13 +42091,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
42042
42091
|
.map((cell) => cell.value);
|
|
42043
42092
|
switch (threshold.type) {
|
|
42044
42093
|
case "value":
|
|
42045
|
-
const result = functionName === "max" ?
|
|
42094
|
+
const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
42046
42095
|
return result;
|
|
42047
42096
|
case "number":
|
|
42048
42097
|
return Number(threshold.value);
|
|
42049
42098
|
case "percentage":
|
|
42050
|
-
const min =
|
|
42051
|
-
const max =
|
|
42099
|
+
const min = largeMin(rangeValues);
|
|
42100
|
+
const max = largeMax(rangeValues);
|
|
42052
42101
|
const delta = max - min;
|
|
42053
42102
|
return min + (delta * Number(threshold.value)) / 100;
|
|
42054
42103
|
case "percentile":
|
|
@@ -43100,13 +43149,13 @@ class AutomaticSumPlugin extends UIPlugin {
|
|
|
43100
43149
|
const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
|
|
43101
43150
|
const cellPositions = range(end, -1, -1);
|
|
43102
43151
|
const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
|
|
43103
|
-
const maxValidPosition =
|
|
43152
|
+
const maxValidPosition = largeMax(invalidCells);
|
|
43104
43153
|
const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
|
|
43105
43154
|
const firstSequence = numberSequences[0] || [];
|
|
43106
|
-
if (
|
|
43155
|
+
if (largeMax(firstSequence) < maxValidPosition) {
|
|
43107
43156
|
return Infinity;
|
|
43108
43157
|
}
|
|
43109
|
-
return
|
|
43158
|
+
return largeMin(firstSequence);
|
|
43110
43159
|
}
|
|
43111
43160
|
shouldFindData(sheetId, zone) {
|
|
43112
43161
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
@@ -45510,7 +45559,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
45510
45559
|
* column of the current viewport
|
|
45511
45560
|
*/
|
|
45512
45561
|
getColDimensionsInViewport(sheetId, col) {
|
|
45513
|
-
const left =
|
|
45562
|
+
const left = largeMin(this.getters.getSheetViewVisibleCols());
|
|
45514
45563
|
const start = this.getters.getColRowOffsetInViewport("COL", left, col);
|
|
45515
45564
|
const size = this.getters.getColSize(sheetId, col);
|
|
45516
45565
|
const isColHidden = this.getters.isColHidden(sheetId, col);
|
|
@@ -45525,7 +45574,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
45525
45574
|
* of the current viewport
|
|
45526
45575
|
*/
|
|
45527
45576
|
getRowDimensionsInViewport(sheetId, row) {
|
|
45528
|
-
const top =
|
|
45577
|
+
const top = largeMin(this.getters.getSheetViewVisibleRows());
|
|
45529
45578
|
const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
|
|
45530
45579
|
const size = this.getters.getRowSize(sheetId, row);
|
|
45531
45580
|
const isRowHidden = this.getters.isRowHidden(sheetId, row);
|
|
@@ -46989,7 +47038,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
46989
47038
|
getColMaxWidth(sheetId, index) {
|
|
46990
47039
|
const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
|
|
46991
47040
|
const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
|
|
46992
|
-
return Math.max(0,
|
|
47041
|
+
return Math.max(0, largeMax(sizes));
|
|
46993
47042
|
}
|
|
46994
47043
|
/**
|
|
46995
47044
|
* Check that any "sheetId" in the command matches an existing
|
|
@@ -47754,7 +47803,7 @@ class ClipboardOsState extends ClipboardCellsAbstractState {
|
|
|
47754
47803
|
}
|
|
47755
47804
|
getPasteZone(target) {
|
|
47756
47805
|
const height = this.values.length;
|
|
47757
|
-
const width =
|
|
47806
|
+
const width = largeMax(this.values.map((a) => a.length));
|
|
47758
47807
|
const { left: activeCol, top: activeRow } = target[0];
|
|
47759
47808
|
return {
|
|
47760
47809
|
top: activeRow,
|
|
@@ -48791,11 +48840,11 @@ class EditionPlugin extends UIPlugin {
|
|
|
48791
48840
|
}
|
|
48792
48841
|
else {
|
|
48793
48842
|
const range = this.getters.getRangeFromSheetXC(this.sheetId, rule.criterion.values[0]);
|
|
48794
|
-
values = this.getters
|
|
48843
|
+
values = Array.from(new Set(this.getters
|
|
48795
48844
|
.getRangeValues(range)
|
|
48796
48845
|
.filter(isNotNull)
|
|
48797
48846
|
.map((value) => value.toString())
|
|
48798
|
-
.filter((val) => val !== "");
|
|
48847
|
+
.filter((val) => val !== "")));
|
|
48799
48848
|
}
|
|
48800
48849
|
const composerContent = this.getCurrentContent();
|
|
48801
48850
|
if (composerContent && composerContent !== this.getInitialComposerContent()) {
|
|
@@ -51252,12 +51301,14 @@ class BottomBarSheet extends Component {
|
|
|
51252
51301
|
this.editionState = "initializing";
|
|
51253
51302
|
}
|
|
51254
51303
|
stopEdition() {
|
|
51255
|
-
|
|
51304
|
+
const input = this.sheetNameRef.el;
|
|
51305
|
+
if (!this.state.isEditing || !input)
|
|
51256
51306
|
return;
|
|
51257
51307
|
this.state.isEditing = false;
|
|
51258
51308
|
this.editionState = "initializing";
|
|
51259
|
-
|
|
51309
|
+
input.blur();
|
|
51260
51310
|
const inputValue = this.getInputContent() || "";
|
|
51311
|
+
input.innerText = inputValue;
|
|
51261
51312
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
51262
51313
|
}
|
|
51263
51314
|
cancelEdition() {
|
|
@@ -51551,7 +51602,7 @@ class BottomBar extends Component {
|
|
|
51551
51602
|
this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
|
|
51552
51603
|
}
|
|
51553
51604
|
onSheetMouseDown(sheetId, event) {
|
|
51554
|
-
if (event.button !== 0)
|
|
51605
|
+
if (event.button !== 0 || this.env.model.getters.isReadonly())
|
|
51555
51606
|
return;
|
|
51556
51607
|
this.closeMenu();
|
|
51557
51608
|
const visibleSheets = this.getVisibleSheets();
|
|
@@ -55056,7 +55107,7 @@ function addLineChart(chart) {
|
|
|
55056
55107
|
}
|
|
55057
55108
|
function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
|
|
55058
55109
|
const colors = new ChartColors();
|
|
55059
|
-
const maxLength =
|
|
55110
|
+
const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
|
|
55060
55111
|
const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
|
|
55061
55112
|
const dataSetsNodes = [];
|
|
55062
55113
|
for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
|
|
@@ -55194,8 +55245,7 @@ function addContent(content, sharedStrings, forceString = false) {
|
|
|
55194
55245
|
attrs.push(["t", "b"]);
|
|
55195
55246
|
}
|
|
55196
55247
|
else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
|
|
55197
|
-
|
|
55198
|
-
value = id.toString();
|
|
55248
|
+
value = pushElement(content, sharedStrings);
|
|
55199
55249
|
attrs.push(["t", "s"]);
|
|
55200
55250
|
}
|
|
55201
55251
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -55320,8 +55370,7 @@ function addCellIsRule(cf, rule, dxfs) {
|
|
|
55320
55370
|
if (rule.style.fillColor) {
|
|
55321
55371
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
55322
55372
|
}
|
|
55323
|
-
|
|
55324
|
-
ruleAttributes.push(["dxfId", id]);
|
|
55373
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
55325
55374
|
return escapeXml /*xml*/ `
|
|
55326
55375
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
55327
55376
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -56130,7 +56179,7 @@ function addSheetViews(sheet) {
|
|
|
56130
56179
|
*/
|
|
56131
56180
|
function getXLSX(data) {
|
|
56132
56181
|
const files = [];
|
|
56133
|
-
const construct = getDefaultXLSXStructure();
|
|
56182
|
+
const construct = getDefaultXLSXStructure(data);
|
|
56134
56183
|
files.push(createWorkbook(data, construct));
|
|
56135
56184
|
files.push(...createWorksheets(data, construct));
|
|
56136
56185
|
files.push(createStylesSheet(construct));
|
|
@@ -56975,6 +57024,6 @@ const constants = {
|
|
|
56975
57024
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
56976
57025
|
|
|
56977
57026
|
|
|
56978
|
-
__info__.version = "17.0.
|
|
56979
|
-
__info__.date = "2024-
|
|
56980
|
-
__info__.hash = "
|
|
57027
|
+
__info__.version = "17.0.18";
|
|
57028
|
+
__info__.date = "2024-04-10T13:28:23.664Z";
|
|
57029
|
+
__info__.hash = "6294758";
|