@odoo/o-spreadsheet 17.2.1 → 17.2.3
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 +158 -106
- package/dist/o-spreadsheet.d.ts +9 -0
- package/dist/o-spreadsheet.esm.js +158 -106
- package/dist/o-spreadsheet.iife.js +158 -106
- package/dist/o-spreadsheet.iife.min.js +264 -273
- package/dist/o_spreadsheet.xml +48 -45
- package/package.json +2 -2
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
5
5
|
* @see https://github.com/odoo/o-spreadsheet
|
|
6
|
-
* @version 17.2.
|
|
7
|
-
* @date 2024-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.2.3
|
|
7
|
+
* @date 2024-04-10T12:28:36.552Z
|
|
8
|
+
* @hash ab5e22d
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -466,7 +466,7 @@ function getItemId(item, itemsDic) {
|
|
|
466
466
|
}
|
|
467
467
|
// Generate new Id if the item didn't exist in the dictionary
|
|
468
468
|
const ids = Object.keys(itemsDic);
|
|
469
|
-
const maxId = ids.length === 0 ? 0 :
|
|
469
|
+
const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
|
|
470
470
|
itemsDic[maxId + 1] = item;
|
|
471
471
|
return maxId + 1;
|
|
472
472
|
}
|
|
@@ -562,7 +562,7 @@ function deepEquals(o1, o2) {
|
|
|
562
562
|
if (typeof o1 !== typeof o2)
|
|
563
563
|
return false;
|
|
564
564
|
if (typeof o1 !== "object")
|
|
565
|
-
return
|
|
565
|
+
return false;
|
|
566
566
|
// Objects can have different keys if the values are undefined
|
|
567
567
|
for (const key in o2) {
|
|
568
568
|
if (!(key in o1) && o2[key] !== undefined) {
|
|
@@ -686,6 +686,34 @@ function getSearchRegex(searchStr, searchOptions) {
|
|
|
686
686
|
}
|
|
687
687
|
return RegExp(searchValue, flags);
|
|
688
688
|
}
|
|
689
|
+
/**
|
|
690
|
+
* Alternative to Math.max that works with large arrays.
|
|
691
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
692
|
+
*/
|
|
693
|
+
function largeMax(array) {
|
|
694
|
+
let len = array.length;
|
|
695
|
+
if (len < 100000)
|
|
696
|
+
return Math.max(...array);
|
|
697
|
+
let max = -Infinity;
|
|
698
|
+
while (len--) {
|
|
699
|
+
max = array[len] > max ? array[len] : max;
|
|
700
|
+
}
|
|
701
|
+
return max;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Alternative to Math.min that works with large arrays.
|
|
705
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
706
|
+
*/
|
|
707
|
+
function largeMin(array) {
|
|
708
|
+
let len = array.length;
|
|
709
|
+
if (len < 100000)
|
|
710
|
+
return Math.min(...array);
|
|
711
|
+
let min = +Infinity;
|
|
712
|
+
while (len--) {
|
|
713
|
+
min = array[len] < min ? array[len] : min;
|
|
714
|
+
}
|
|
715
|
+
return min;
|
|
716
|
+
}
|
|
689
717
|
|
|
690
718
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
691
719
|
const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
|
|
@@ -4545,8 +4573,9 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
|
4545
4573
|
* Get the default height of the cell given its style.
|
|
4546
4574
|
*/
|
|
4547
4575
|
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4548
|
-
if (!cell || !cell.content)
|
|
4576
|
+
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4549
4577
|
return DEFAULT_CELL_HEIGHT;
|
|
4578
|
+
}
|
|
4550
4579
|
const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4551
4580
|
const numberOfLines = cell.isFormula
|
|
4552
4581
|
? 1
|
|
@@ -9940,11 +9969,11 @@ autoCompleteProviders.add("dataValidation", {
|
|
|
9940
9969
|
}
|
|
9941
9970
|
else {
|
|
9942
9971
|
const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
|
|
9943
|
-
values = this.getters
|
|
9972
|
+
values = Array.from(new Set(this.getters
|
|
9944
9973
|
.getRangeValues(range)
|
|
9945
9974
|
.filter(isNotNull)
|
|
9946
9975
|
.map((value) => value.toString())
|
|
9947
|
-
.filter((val) => val !== "");
|
|
9976
|
+
.filter((val) => val !== "")));
|
|
9948
9977
|
}
|
|
9949
9978
|
return values.map((value) => ({ text: value }));
|
|
9950
9979
|
},
|
|
@@ -19391,10 +19420,10 @@ function aggregateDataForLabels(labels, datasets) {
|
|
|
19391
19420
|
}
|
|
19392
19421
|
}
|
|
19393
19422
|
return {
|
|
19394
|
-
labels:
|
|
19423
|
+
labels: Array.from(labelSet),
|
|
19395
19424
|
dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
|
|
19396
19425
|
...dataset,
|
|
19397
|
-
data:
|
|
19426
|
+
data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
|
|
19398
19427
|
})),
|
|
19399
19428
|
};
|
|
19400
19429
|
}
|
|
@@ -20126,7 +20155,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
|
|
|
20126
20155
|
return undefined;
|
|
20127
20156
|
}
|
|
20128
20157
|
const labelsTimestamps = labelDates.map((date) => date.getTime());
|
|
20129
|
-
const period =
|
|
20158
|
+
const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
|
|
20130
20159
|
const minUnit = getFormatMinDisplayUnit(format);
|
|
20131
20160
|
if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
|
|
20132
20161
|
return "second";
|
|
@@ -20614,7 +20643,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
|
|
|
20614
20643
|
}
|
|
20615
20644
|
function getPieColors(colors, dataSetsValues) {
|
|
20616
20645
|
const pieColors = [];
|
|
20617
|
-
const maxLength =
|
|
20646
|
+
const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
|
|
20618
20647
|
for (let i = 0; i <= maxLength; i++) {
|
|
20619
20648
|
pieColors.push(colors.next());
|
|
20620
20649
|
}
|
|
@@ -23419,8 +23448,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
|
|
|
23419
23448
|
let last;
|
|
23420
23449
|
const activesRows = env.model.getters.getActiveRows();
|
|
23421
23450
|
if (activesRows.size !== 0) {
|
|
23422
|
-
first =
|
|
23423
|
-
last =
|
|
23451
|
+
first = largeMin([...activesRows]);
|
|
23452
|
+
last = largeMax([...activesRows]);
|
|
23424
23453
|
}
|
|
23425
23454
|
else {
|
|
23426
23455
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -23448,8 +23477,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
|
|
|
23448
23477
|
let last;
|
|
23449
23478
|
const activeCols = env.model.getters.getActiveCols();
|
|
23450
23479
|
if (activeCols.size !== 0) {
|
|
23451
|
-
first =
|
|
23452
|
-
last =
|
|
23480
|
+
first = largeMin([...activeCols]);
|
|
23481
|
+
last = largeMax([...activeCols]);
|
|
23453
23482
|
}
|
|
23454
23483
|
else {
|
|
23455
23484
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -23477,8 +23506,8 @@ const REMOVE_ROWS_NAME = (env) => {
|
|
|
23477
23506
|
let last;
|
|
23478
23507
|
const activesRows = env.model.getters.getActiveRows();
|
|
23479
23508
|
if (activesRows.size !== 0) {
|
|
23480
|
-
first =
|
|
23481
|
-
last =
|
|
23509
|
+
first = largeMin([...activesRows]);
|
|
23510
|
+
last = largeMax([...activesRows]);
|
|
23482
23511
|
}
|
|
23483
23512
|
else {
|
|
23484
23513
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -23519,8 +23548,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
|
|
|
23519
23548
|
let last;
|
|
23520
23549
|
const activeCols = env.model.getters.getActiveCols();
|
|
23521
23550
|
if (activeCols.size !== 0) {
|
|
23522
|
-
first =
|
|
23523
|
-
last =
|
|
23551
|
+
first = largeMin([...activeCols]);
|
|
23552
|
+
last = largeMax([...activeCols]);
|
|
23524
23553
|
}
|
|
23525
23554
|
else {
|
|
23526
23555
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -23561,7 +23590,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
|
23561
23590
|
let row;
|
|
23562
23591
|
let quantity;
|
|
23563
23592
|
if (activeRows.size) {
|
|
23564
|
-
row =
|
|
23593
|
+
row = largeMin([...activeRows]);
|
|
23565
23594
|
quantity = activeRows.size;
|
|
23566
23595
|
}
|
|
23567
23596
|
else {
|
|
@@ -23582,7 +23611,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
|
|
|
23582
23611
|
let row;
|
|
23583
23612
|
let quantity;
|
|
23584
23613
|
if (activeRows.size) {
|
|
23585
|
-
row =
|
|
23614
|
+
row = largeMax([...activeRows]);
|
|
23586
23615
|
quantity = activeRows.size;
|
|
23587
23616
|
}
|
|
23588
23617
|
else {
|
|
@@ -23603,7 +23632,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
|
|
|
23603
23632
|
let column;
|
|
23604
23633
|
let quantity;
|
|
23605
23634
|
if (activeCols.size) {
|
|
23606
|
-
column =
|
|
23635
|
+
column = largeMin([...activeCols]);
|
|
23607
23636
|
quantity = activeCols.size;
|
|
23608
23637
|
}
|
|
23609
23638
|
else {
|
|
@@ -23624,7 +23653,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
|
|
|
23624
23653
|
let column;
|
|
23625
23654
|
let quantity;
|
|
23626
23655
|
if (activeCols.size) {
|
|
23627
|
-
column =
|
|
23656
|
+
column = largeMax([...activeCols]);
|
|
23628
23657
|
quantity = activeCols.size;
|
|
23629
23658
|
}
|
|
23630
23659
|
else {
|
|
@@ -30223,7 +30252,11 @@ class SplitIntoColumnsPanel extends owl.Component {
|
|
|
30223
30252
|
const composerStore = useStore(ComposerStore);
|
|
30224
30253
|
// The feature makes no sense if we are editing a cell, because then the selection isn't active
|
|
30225
30254
|
// Stop the edition when the panel is mounted, and close the panel if the user start editing a cell
|
|
30226
|
-
owl.useEffect(
|
|
30255
|
+
owl.useEffect((editionMode) => {
|
|
30256
|
+
if (editionMode !== "inactive") {
|
|
30257
|
+
this.props.onCloseSidePanel();
|
|
30258
|
+
}
|
|
30259
|
+
}, () => [composerStore.editionMode]);
|
|
30227
30260
|
owl.onMounted(() => {
|
|
30228
30261
|
composerStore.stopEdition();
|
|
30229
30262
|
});
|
|
@@ -31936,6 +31969,7 @@ class Composer extends owl.Component {
|
|
|
31936
31969
|
onComposerCellFocused: { type: Function, optional: true },
|
|
31937
31970
|
onComposerContentFocused: Function,
|
|
31938
31971
|
isDefaultFocus: { type: Boolean, optional: true },
|
|
31972
|
+
onInputContextMenu: { type: Function, optional: true },
|
|
31939
31973
|
};
|
|
31940
31974
|
static components = { TextValueProvider, FunctionDescriptionProvider };
|
|
31941
31975
|
static defaultProps = {
|
|
@@ -31986,6 +32020,9 @@ class Composer extends owl.Component {
|
|
|
31986
32020
|
assistantStyle.right = `0px`;
|
|
31987
32021
|
}
|
|
31988
32022
|
}
|
|
32023
|
+
else if (this.props.delimitation) {
|
|
32024
|
+
assistantStyle["max-height"] = `${this.props.delimitation.height}px`;
|
|
32025
|
+
}
|
|
31989
32026
|
return cssPropertiesToCss(assistantStyle);
|
|
31990
32027
|
}
|
|
31991
32028
|
// we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
|
|
@@ -32019,6 +32056,12 @@ class Composer extends owl.Component {
|
|
|
32019
32056
|
owl.useEffect(() => {
|
|
32020
32057
|
this.processContent();
|
|
32021
32058
|
});
|
|
32059
|
+
owl.onPatched(() => {
|
|
32060
|
+
// Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
|
|
32061
|
+
if (this.composerStore.editionMode === "inactive") {
|
|
32062
|
+
this.processTokenAtCursor();
|
|
32063
|
+
}
|
|
32064
|
+
});
|
|
32022
32065
|
}
|
|
32023
32066
|
// ---------------------------------------------------------------------------
|
|
32024
32067
|
// Handlers
|
|
@@ -32266,6 +32309,11 @@ class Composer extends owl.Component {
|
|
|
32266
32309
|
}
|
|
32267
32310
|
}
|
|
32268
32311
|
}
|
|
32312
|
+
onContextMenu(ev) {
|
|
32313
|
+
if (this.composerStore.editionMode === "inactive") {
|
|
32314
|
+
this.props.onInputContextMenu?.(ev);
|
|
32315
|
+
}
|
|
32316
|
+
}
|
|
32269
32317
|
// ---------------------------------------------------------------------------
|
|
32270
32318
|
// Private
|
|
32271
32319
|
// ---------------------------------------------------------------------------
|
|
@@ -32487,6 +32535,7 @@ class GridComposer extends owl.Component {
|
|
|
32487
32535
|
static template = "o-spreadsheet-GridComposer";
|
|
32488
32536
|
static props = {
|
|
32489
32537
|
gridDims: Object,
|
|
32538
|
+
onInputContextMenu: Function,
|
|
32490
32539
|
};
|
|
32491
32540
|
static components = { Composer };
|
|
32492
32541
|
rect = this.defaultRect;
|
|
@@ -32534,6 +32583,7 @@ class GridComposer extends owl.Component {
|
|
|
32534
32583
|
isDefaultFocus: true,
|
|
32535
32584
|
onComposerContentFocused: () => this.composerFocusStore.focusGridComposerContent(),
|
|
32536
32585
|
onComposerCellFocused: (content) => this.composerFocusStore.focusGridComposerCell(content),
|
|
32586
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
32537
32587
|
};
|
|
32538
32588
|
}
|
|
32539
32589
|
get containerStyle() {
|
|
@@ -33999,11 +34049,6 @@ css /* scss */ `
|
|
|
33999
34049
|
height: 10000px;
|
|
34000
34050
|
background-color: ${SELECTION_BORDER_COLOR};
|
|
34001
34051
|
}
|
|
34002
|
-
.o-unhide-buttons {
|
|
34003
|
-
width: fit-content;
|
|
34004
|
-
gap: 5px;
|
|
34005
|
-
transform: translate(-50%, 0);
|
|
34006
|
-
}
|
|
34007
34052
|
.o-unhide:hover {
|
|
34008
34053
|
z-index: ${ComponentsImportance.Grid + 1};
|
|
34009
34054
|
background-color: lightgrey;
|
|
@@ -34165,10 +34210,6 @@ css /* scss */ `
|
|
|
34165
34210
|
height: 1px;
|
|
34166
34211
|
background-color: ${SELECTION_BORDER_COLOR};
|
|
34167
34212
|
}
|
|
34168
|
-
.o-unhide-buttons {
|
|
34169
|
-
height: fit-content;
|
|
34170
|
-
transform: translate(0, -50%);
|
|
34171
|
-
}
|
|
34172
34213
|
.o-unhide:hover {
|
|
34173
34214
|
z-index: ${ComponentsImportance.Grid + 1};
|
|
34174
34215
|
background-color: lightgrey;
|
|
@@ -37265,29 +37306,12 @@ function convertWidthFromExcel(width) {
|
|
|
37265
37306
|
return width;
|
|
37266
37307
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
37267
37308
|
}
|
|
37268
|
-
function convertBorderDescr(descr) {
|
|
37269
|
-
if (!descr) {
|
|
37270
|
-
return undefined;
|
|
37271
|
-
}
|
|
37272
|
-
return {
|
|
37273
|
-
style: descr.style,
|
|
37274
|
-
color: { rgb: descr.color },
|
|
37275
|
-
};
|
|
37276
|
-
}
|
|
37277
37309
|
function extractStyle(cell, data) {
|
|
37278
37310
|
let style = {};
|
|
37279
37311
|
if (cell.style) {
|
|
37280
37312
|
style = data.styles[cell.style];
|
|
37281
37313
|
}
|
|
37282
37314
|
const format = extractFormat(cell, data);
|
|
37283
|
-
const exportedBorder = {};
|
|
37284
|
-
if (cell.border) {
|
|
37285
|
-
const border = data.borders[cell.border];
|
|
37286
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
37287
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
37288
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
37289
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
37290
|
-
}
|
|
37291
37315
|
const styles = {
|
|
37292
37316
|
font: {
|
|
37293
37317
|
size: style?.fontSize || DEFAULT_FONT_SIZE,
|
|
@@ -37301,7 +37325,7 @@ function extractStyle(cell, data) {
|
|
|
37301
37325
|
}
|
|
37302
37326
|
: { reservedAttribute: "none" },
|
|
37303
37327
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
37304
|
-
border:
|
|
37328
|
+
border: cell.border || 0,
|
|
37305
37329
|
alignment: {
|
|
37306
37330
|
horizontal: style.align,
|
|
37307
37331
|
vertical: style.verticalAlign
|
|
@@ -37323,15 +37347,12 @@ function extractFormat(cell, data) {
|
|
|
37323
37347
|
return undefined;
|
|
37324
37348
|
}
|
|
37325
37349
|
function normalizeStyle(construct, styles) {
|
|
37326
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
37327
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
37328
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
37329
37350
|
// Normalize this
|
|
37330
37351
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
37331
37352
|
const style = {
|
|
37332
|
-
fontId,
|
|
37333
|
-
fillId,
|
|
37334
|
-
borderId,
|
|
37353
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
37354
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
37355
|
+
borderId: styles.border,
|
|
37335
37356
|
numFmtId,
|
|
37336
37357
|
alignment: {
|
|
37337
37358
|
vertical: styles.alignment.vertical,
|
|
@@ -37339,8 +37360,7 @@ function normalizeStyle(construct, styles) {
|
|
|
37339
37360
|
wrapText: styles.alignment.wrapText,
|
|
37340
37361
|
},
|
|
37341
37362
|
};
|
|
37342
|
-
|
|
37343
|
-
return id;
|
|
37363
|
+
return pushElement(style, construct.styles);
|
|
37344
37364
|
}
|
|
37345
37365
|
function convertFormat(format, numFmtStructure) {
|
|
37346
37366
|
if (!format) {
|
|
@@ -37348,8 +37368,7 @@ function convertFormat(format, numFmtStructure) {
|
|
|
37348
37368
|
}
|
|
37349
37369
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
37350
37370
|
if (!formatId) {
|
|
37351
|
-
|
|
37352
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
37371
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
37353
37372
|
}
|
|
37354
37373
|
return formatId;
|
|
37355
37374
|
}
|
|
@@ -37374,20 +37393,15 @@ function addRelsToFile(relsFiles, path, rel) {
|
|
|
37374
37393
|
return id;
|
|
37375
37394
|
}
|
|
37376
37395
|
function pushElement(property, propertyList) {
|
|
37377
|
-
|
|
37378
|
-
|
|
37379
|
-
|
|
37396
|
+
let len = propertyList.length;
|
|
37397
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
37398
|
+
for (let i = 0; i < len; i++) {
|
|
37399
|
+
if (operator(property, propertyList[i])) {
|
|
37400
|
+
return i;
|
|
37380
37401
|
}
|
|
37381
37402
|
}
|
|
37382
|
-
|
|
37383
|
-
|
|
37384
|
-
propertyList.push(property);
|
|
37385
|
-
elemId = propertyList.length - 1;
|
|
37386
|
-
}
|
|
37387
|
-
return {
|
|
37388
|
-
id: elemId,
|
|
37389
|
-
list: propertyList,
|
|
37390
|
-
};
|
|
37403
|
+
propertyList[propertyList.length] = property;
|
|
37404
|
+
return propertyList.length - 1;
|
|
37391
37405
|
}
|
|
37392
37406
|
const chartIds = [];
|
|
37393
37407
|
/**
|
|
@@ -37862,7 +37876,7 @@ function convertHyperlink(link, cellValue, warningManager) {
|
|
|
37862
37876
|
function getSheetDims(sheet) {
|
|
37863
37877
|
const dims = [0, 0];
|
|
37864
37878
|
for (let row of sheet.rows) {
|
|
37865
|
-
dims[0] = Math.max(dims[0],
|
|
37879
|
+
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
37866
37880
|
dims[1] = Math.max(dims[1], row.index);
|
|
37867
37881
|
}
|
|
37868
37882
|
dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
@@ -38182,7 +38196,25 @@ function parseXML(xmlString, mimeType = "text/xml") {
|
|
|
38182
38196
|
}
|
|
38183
38197
|
return document;
|
|
38184
38198
|
}
|
|
38185
|
-
function
|
|
38199
|
+
function convertBorderDescr(descr) {
|
|
38200
|
+
if (!descr) {
|
|
38201
|
+
return undefined;
|
|
38202
|
+
}
|
|
38203
|
+
return {
|
|
38204
|
+
style: descr.style,
|
|
38205
|
+
color: { rgb: descr.color },
|
|
38206
|
+
};
|
|
38207
|
+
}
|
|
38208
|
+
function getDefaultXLSXStructure(data) {
|
|
38209
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
38210
|
+
return {
|
|
38211
|
+
left: convertBorderDescr(border.left),
|
|
38212
|
+
right: convertBorderDescr(border.right),
|
|
38213
|
+
bottom: convertBorderDescr(border.bottom),
|
|
38214
|
+
top: convertBorderDescr(border.top),
|
|
38215
|
+
};
|
|
38216
|
+
});
|
|
38217
|
+
const borders = [{}, ...xlsxBorders];
|
|
38186
38218
|
return {
|
|
38187
38219
|
relsFiles: [],
|
|
38188
38220
|
sharedStrings: [],
|
|
@@ -38205,7 +38237,7 @@ function getDefaultXLSXStructure() {
|
|
|
38205
38237
|
},
|
|
38206
38238
|
],
|
|
38207
38239
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
38208
|
-
borders
|
|
38240
|
+
borders,
|
|
38209
38241
|
numFmts: [],
|
|
38210
38242
|
dxfs: [],
|
|
38211
38243
|
};
|
|
@@ -42369,6 +42401,9 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
42369
42401
|
if (newRule.criterion.type === "isBoolean") {
|
|
42370
42402
|
this.setCenterStyleToBooleanCells(newRule);
|
|
42371
42403
|
}
|
|
42404
|
+
else if (newRule.criterion.type === "isValueInList") {
|
|
42405
|
+
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
42406
|
+
}
|
|
42372
42407
|
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
42373
42408
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
42374
42409
|
if (ruleIndex !== -1) {
|
|
@@ -42765,7 +42800,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
42765
42800
|
if (hiddenElements.size >= elements) {
|
|
42766
42801
|
return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
|
|
42767
42802
|
}
|
|
42768
|
-
else if (
|
|
42803
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
42769
42804
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
42770
42805
|
}
|
|
42771
42806
|
else {
|
|
@@ -43583,8 +43618,8 @@ class RangeAdapter {
|
|
|
43583
43618
|
let newRange = range;
|
|
43584
43619
|
let changeType = "NONE";
|
|
43585
43620
|
for (let group of groups) {
|
|
43586
|
-
const min =
|
|
43587
|
-
const max =
|
|
43621
|
+
const min = largeMin(group);
|
|
43622
|
+
const max = largeMax(group);
|
|
43588
43623
|
if (range.zone[start] <= min && min <= range.zone[end]) {
|
|
43589
43624
|
const toRemove = Math.min(range.zone[end], max) - min + 1;
|
|
43590
43625
|
changeType = "RESIZE";
|
|
@@ -44033,8 +44068,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
44033
44068
|
}
|
|
44034
44069
|
return "Success" /* CommandResult.Success */;
|
|
44035
44070
|
case "REMOVE_COLUMNS_ROWS": {
|
|
44036
|
-
const min =
|
|
44037
|
-
const max =
|
|
44071
|
+
const min = largeMin(cmd.elements);
|
|
44072
|
+
const max = largeMax(cmd.elements);
|
|
44038
44073
|
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
|
|
44039
44074
|
return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
|
|
44040
44075
|
}
|
|
@@ -45239,7 +45274,15 @@ class TablePlugin extends CorePlugin {
|
|
|
45239
45274
|
}
|
|
45240
45275
|
}
|
|
45241
45276
|
exportForExcel(data) {
|
|
45242
|
-
|
|
45277
|
+
for (const sheet of data.sheets) {
|
|
45278
|
+
for (const table of this.getTables(sheet.id)) {
|
|
45279
|
+
if (zoneToDimension(table.range.zone).numberOfRows === 1) {
|
|
45280
|
+
continue;
|
|
45281
|
+
}
|
|
45282
|
+
const tableData = { range: zoneToXc(table.range.zone), filters: [] };
|
|
45283
|
+
sheet.tables.push(tableData);
|
|
45284
|
+
}
|
|
45285
|
+
}
|
|
45243
45286
|
}
|
|
45244
45287
|
}
|
|
45245
45288
|
|
|
@@ -47011,7 +47054,9 @@ class Evaluator {
|
|
|
47011
47054
|
this.blockedArrayFormulas = this.createEmptyPositionSet();
|
|
47012
47055
|
this.spreadingRelations = new SpreadingRelation(this.createEmptyPositionSet.bind(this));
|
|
47013
47056
|
this.formulaDependencies = lazy(() => {
|
|
47014
|
-
const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position)
|
|
47057
|
+
const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position)
|
|
47058
|
+
.filter((range) => !range.invalidSheetName && !range.invalidXc)
|
|
47059
|
+
.map((range) => ({
|
|
47015
47060
|
data: position,
|
|
47016
47061
|
boundingBox: {
|
|
47017
47062
|
zone: range.zone,
|
|
@@ -47498,7 +47543,7 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
47498
47543
|
? getItemId(newFormat, data.formats)
|
|
47499
47544
|
: exportedCellData.format;
|
|
47500
47545
|
let content;
|
|
47501
|
-
if (formulaCell instanceof FormulaCellWithDependencies) {
|
|
47546
|
+
if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
|
|
47502
47547
|
content = formulaCell.contentWithFixedReferences;
|
|
47503
47548
|
}
|
|
47504
47549
|
else {
|
|
@@ -47947,13 +47992,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
47947
47992
|
.map((cell) => cell.value);
|
|
47948
47993
|
switch (threshold.type) {
|
|
47949
47994
|
case "value":
|
|
47950
|
-
const result = functionName === "max" ?
|
|
47995
|
+
const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
47951
47996
|
return result;
|
|
47952
47997
|
case "number":
|
|
47953
47998
|
return Number(threshold.value);
|
|
47954
47999
|
case "percentage":
|
|
47955
|
-
const min =
|
|
47956
|
-
const max =
|
|
48000
|
+
const min = largeMin(rangeValues);
|
|
48001
|
+
const max = largeMax(rangeValues);
|
|
47957
48002
|
const delta = max - min;
|
|
47958
48003
|
return min + (delta * Number(threshold.value)) / 100;
|
|
47959
48004
|
case "percentile":
|
|
@@ -49026,13 +49071,13 @@ class AutomaticSumPlugin extends UIPlugin {
|
|
|
49026
49071
|
const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
|
|
49027
49072
|
const cellPositions = range(end, -1, -1);
|
|
49028
49073
|
const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
|
|
49029
|
-
const maxValidPosition =
|
|
49074
|
+
const maxValidPosition = largeMax(invalidCells);
|
|
49030
49075
|
const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
|
|
49031
49076
|
const firstSequence = numberSequences[0] || [];
|
|
49032
|
-
if (
|
|
49077
|
+
if (largeMax(firstSequence) < maxValidPosition) {
|
|
49033
49078
|
return Infinity;
|
|
49034
49079
|
}
|
|
49035
|
-
return
|
|
49080
|
+
return largeMin(firstSequence);
|
|
49036
49081
|
}
|
|
49037
49082
|
shouldFindData(sheetId, zone) {
|
|
49038
49083
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
@@ -50773,7 +50818,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
50773
50818
|
getColMaxWidth(sheetId, index) {
|
|
50774
50819
|
const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
|
|
50775
50820
|
const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
|
|
50776
|
-
return Math.max(0,
|
|
50821
|
+
return Math.max(0, largeMax(sizes));
|
|
50777
50822
|
}
|
|
50778
50823
|
/**
|
|
50779
50824
|
* Check that any "sheetId" in the command matches an existing
|
|
@@ -53669,7 +53714,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
53669
53714
|
* column of the current viewport
|
|
53670
53715
|
*/
|
|
53671
53716
|
getColDimensionsInViewport(sheetId, col) {
|
|
53672
|
-
const left =
|
|
53717
|
+
const left = largeMin(this.getters.getSheetViewVisibleCols());
|
|
53673
53718
|
const start = this.getters.getColRowOffsetInViewport("COL", left, col);
|
|
53674
53719
|
const size = this.getters.getColSize(sheetId, col);
|
|
53675
53720
|
const isColHidden = this.getters.isColHidden(sheetId, col);
|
|
@@ -53684,7 +53729,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
53684
53729
|
* of the current viewport
|
|
53685
53730
|
*/
|
|
53686
53731
|
getRowDimensionsInViewport(sheetId, row) {
|
|
53687
|
-
const top =
|
|
53732
|
+
const top = largeMin(this.getters.getSheetViewVisibleRows());
|
|
53688
53733
|
const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
|
|
53689
53734
|
const size = this.getters.getRowSize(sheetId, row);
|
|
53690
53735
|
const isRowHidden = this.getters.isRowHidden(sheetId, row);
|
|
@@ -54397,12 +54442,14 @@ class BottomBarSheet extends owl.Component {
|
|
|
54397
54442
|
this.editionState = "initializing";
|
|
54398
54443
|
}
|
|
54399
54444
|
stopEdition() {
|
|
54400
|
-
|
|
54445
|
+
const input = this.sheetNameRef.el;
|
|
54446
|
+
if (!this.state.isEditing || !input)
|
|
54401
54447
|
return;
|
|
54402
54448
|
this.state.isEditing = false;
|
|
54403
54449
|
this.editionState = "initializing";
|
|
54404
|
-
|
|
54450
|
+
input.blur();
|
|
54405
54451
|
const inputValue = this.getInputContent() || "";
|
|
54452
|
+
input.innerText = inputValue;
|
|
54406
54453
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
54407
54454
|
}
|
|
54408
54455
|
cancelEdition() {
|
|
@@ -54693,7 +54740,7 @@ class BottomBar extends owl.Component {
|
|
|
54693
54740
|
this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
|
|
54694
54741
|
}
|
|
54695
54742
|
onSheetMouseDown(sheetId, event) {
|
|
54696
|
-
if (event.button !== 0)
|
|
54743
|
+
if (event.button !== 0 || this.env.model.getters.isReadonly())
|
|
54697
54744
|
return;
|
|
54698
54745
|
this.closeMenu();
|
|
54699
54746
|
const visibleSheets = this.getVisibleSheets();
|
|
@@ -55654,6 +55701,13 @@ class TopBarComposer extends owl.Component {
|
|
|
55654
55701
|
"border-color": SELECTION_BORDER_COLOR,
|
|
55655
55702
|
});
|
|
55656
55703
|
}
|
|
55704
|
+
get delimitation() {
|
|
55705
|
+
const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
|
|
55706
|
+
return {
|
|
55707
|
+
width,
|
|
55708
|
+
height,
|
|
55709
|
+
};
|
|
55710
|
+
}
|
|
55657
55711
|
onFocus(selection) {
|
|
55658
55712
|
this.composerFocusStore.focusTopBarComposer(selection);
|
|
55659
55713
|
}
|
|
@@ -58147,7 +58201,7 @@ function addLineChart(chart) {
|
|
|
58147
58201
|
}
|
|
58148
58202
|
function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
|
|
58149
58203
|
const colors = new ChartColors();
|
|
58150
|
-
const maxLength =
|
|
58204
|
+
const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
|
|
58151
58205
|
const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
|
|
58152
58206
|
const dataSetsNodes = [];
|
|
58153
58207
|
for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
|
|
@@ -58285,8 +58339,7 @@ function addContent(content, sharedStrings, forceString = false) {
|
|
|
58285
58339
|
attrs.push(["t", "b"]);
|
|
58286
58340
|
}
|
|
58287
58341
|
else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
|
|
58288
|
-
|
|
58289
|
-
value = id.toString();
|
|
58342
|
+
value = pushElement(content, sharedStrings);
|
|
58290
58343
|
attrs.push(["t", "s"]);
|
|
58291
58344
|
}
|
|
58292
58345
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -58411,8 +58464,7 @@ function addCellIsRule(cf, rule, dxfs) {
|
|
|
58411
58464
|
if (rule.style.fillColor) {
|
|
58412
58465
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
58413
58466
|
}
|
|
58414
|
-
|
|
58415
|
-
ruleAttributes.push(["dxfId", id]);
|
|
58467
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
58416
58468
|
return escapeXml /*xml*/ `
|
|
58417
58469
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
58418
58470
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -59242,7 +59294,7 @@ function addSheetViews(sheet) {
|
|
|
59242
59294
|
*/
|
|
59243
59295
|
function getXLSX(data) {
|
|
59244
59296
|
const files = [];
|
|
59245
|
-
const construct = getDefaultXLSXStructure();
|
|
59297
|
+
const construct = getDefaultXLSXStructure(data);
|
|
59246
59298
|
files.push(createWorkbook(data, construct));
|
|
59247
59299
|
files.push(...createWorksheets(data, construct));
|
|
59248
59300
|
files.push(createStylesSheet(construct));
|
|
@@ -60177,6 +60229,6 @@ exports.tokenColors = tokenColors;
|
|
|
60177
60229
|
exports.tokenize = tokenize;
|
|
60178
60230
|
|
|
60179
60231
|
|
|
60180
|
-
__info__.version = "17.2.
|
|
60181
|
-
__info__.date = "2024-
|
|
60182
|
-
__info__.hash = "
|
|
60232
|
+
__info__.version = "17.2.3";
|
|
60233
|
+
__info__.date = "2024-04-10T12:28:36.552Z";
|
|
60234
|
+
__info__.hash = "ab5e22d";
|