@odoo/o-spreadsheet 16.0.36 → 16.0.38
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 +133 -106
- package/dist/o-spreadsheet.d.ts +3 -5
- package/dist/o-spreadsheet.esm.js +133 -106
- package/dist/o-spreadsheet.iife.js +133 -106
- package/dist/o-spreadsheet.iife.min.js +235 -235
- package/dist/o_spreadsheet.xml +5 -4
- package/package.json +2 -2
|
@@ -988,7 +988,7 @@ function getItemId(item, itemsDic) {
|
|
|
988
988
|
}
|
|
989
989
|
// Generate new Id if the item didn't exist in the dictionary
|
|
990
990
|
const ids = Object.keys(itemsDic);
|
|
991
|
-
const maxId = ids.length === 0 ? 0 :
|
|
991
|
+
const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
|
|
992
992
|
itemsDic[maxId + 1] = item;
|
|
993
993
|
return maxId + 1;
|
|
994
994
|
}
|
|
@@ -1079,7 +1079,7 @@ function deepEquals(o1, o2) {
|
|
|
1079
1079
|
if (typeof o1 !== typeof o2)
|
|
1080
1080
|
return false;
|
|
1081
1081
|
if (typeof o1 !== "object")
|
|
1082
|
-
return
|
|
1082
|
+
return false;
|
|
1083
1083
|
// Objects can have different keys if the values are undefined
|
|
1084
1084
|
const keys = new Set();
|
|
1085
1085
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -1134,6 +1134,34 @@ function memoize(func) {
|
|
|
1134
1134
|
return cache.get(args[0]);
|
|
1135
1135
|
},
|
|
1136
1136
|
}[funcName];
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Alternative to Math.max that works with large arrays.
|
|
1140
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
1141
|
+
*/
|
|
1142
|
+
function largeMax(array) {
|
|
1143
|
+
let len = array.length;
|
|
1144
|
+
if (len < 100000)
|
|
1145
|
+
return Math.max(...array);
|
|
1146
|
+
let max = -Infinity;
|
|
1147
|
+
while (len--) {
|
|
1148
|
+
max = array[len] > max ? array[len] : max;
|
|
1149
|
+
}
|
|
1150
|
+
return max;
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Alternative to Math.min that works with large arrays.
|
|
1154
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
1155
|
+
*/
|
|
1156
|
+
function largeMin(array) {
|
|
1157
|
+
let len = array.length;
|
|
1158
|
+
if (len < 100000)
|
|
1159
|
+
return Math.min(...array);
|
|
1160
|
+
let min = +Infinity;
|
|
1161
|
+
while (len--) {
|
|
1162
|
+
min = array[len] < min ? array[len] : min;
|
|
1163
|
+
}
|
|
1164
|
+
return min;
|
|
1137
1165
|
}
|
|
1138
1166
|
|
|
1139
1167
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
@@ -4681,6 +4709,7 @@ class LinkEditor extends Component {
|
|
|
4681
4709
|
if (this.state.link.url) {
|
|
4682
4710
|
this.save();
|
|
4683
4711
|
}
|
|
4712
|
+
ev.preventDefault();
|
|
4684
4713
|
break;
|
|
4685
4714
|
case "Escape":
|
|
4686
4715
|
this.cancel();
|
|
@@ -5096,8 +5125,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
|
|
|
5096
5125
|
let last;
|
|
5097
5126
|
const activesRows = env.model.getters.getActiveRows();
|
|
5098
5127
|
if (activesRows.size !== 0) {
|
|
5099
|
-
first =
|
|
5100
|
-
last =
|
|
5128
|
+
first = largeMin([...activesRows]);
|
|
5129
|
+
last = largeMax([...activesRows]);
|
|
5101
5130
|
}
|
|
5102
5131
|
else {
|
|
5103
5132
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5125,8 +5154,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
|
|
|
5125
5154
|
let last;
|
|
5126
5155
|
const activeCols = env.model.getters.getActiveCols();
|
|
5127
5156
|
if (activeCols.size !== 0) {
|
|
5128
|
-
first =
|
|
5129
|
-
last =
|
|
5157
|
+
first = largeMin([...activeCols]);
|
|
5158
|
+
last = largeMax([...activeCols]);
|
|
5130
5159
|
}
|
|
5131
5160
|
else {
|
|
5132
5161
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5154,8 +5183,8 @@ const REMOVE_ROWS_NAME = (env) => {
|
|
|
5154
5183
|
let last;
|
|
5155
5184
|
const activesRows = env.model.getters.getActiveRows();
|
|
5156
5185
|
if (activesRows.size !== 0) {
|
|
5157
|
-
first =
|
|
5158
|
-
last =
|
|
5186
|
+
first = largeMin([...activesRows]);
|
|
5187
|
+
last = largeMax([...activesRows]);
|
|
5159
5188
|
}
|
|
5160
5189
|
else {
|
|
5161
5190
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5196,8 +5225,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
|
|
|
5196
5225
|
let last;
|
|
5197
5226
|
const activeCols = env.model.getters.getActiveCols();
|
|
5198
5227
|
if (activeCols.size !== 0) {
|
|
5199
|
-
first =
|
|
5200
|
-
last =
|
|
5228
|
+
first = largeMin([...activeCols]);
|
|
5229
|
+
last = largeMax([...activeCols]);
|
|
5201
5230
|
}
|
|
5202
5231
|
else {
|
|
5203
5232
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5266,7 +5295,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
|
5266
5295
|
let row;
|
|
5267
5296
|
let quantity;
|
|
5268
5297
|
if (activeRows.size) {
|
|
5269
|
-
row =
|
|
5298
|
+
row = largeMin([...activeRows]);
|
|
5270
5299
|
quantity = activeRows.size;
|
|
5271
5300
|
}
|
|
5272
5301
|
else {
|
|
@@ -5298,7 +5327,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
|
|
|
5298
5327
|
let row;
|
|
5299
5328
|
let quantity;
|
|
5300
5329
|
if (activeRows.size) {
|
|
5301
|
-
row =
|
|
5330
|
+
row = largeMax([...activeRows]);
|
|
5302
5331
|
quantity = activeRows.size;
|
|
5303
5332
|
}
|
|
5304
5333
|
else {
|
|
@@ -5339,7 +5368,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
|
|
|
5339
5368
|
let column;
|
|
5340
5369
|
let quantity;
|
|
5341
5370
|
if (activeCols.size) {
|
|
5342
|
-
column =
|
|
5371
|
+
column = largeMin([...activeCols]);
|
|
5343
5372
|
quantity = activeCols.size;
|
|
5344
5373
|
}
|
|
5345
5374
|
else {
|
|
@@ -5373,7 +5402,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
|
|
|
5373
5402
|
let column;
|
|
5374
5403
|
let quantity;
|
|
5375
5404
|
if (activeCols.size) {
|
|
5376
|
-
column =
|
|
5405
|
+
column = largeMax([...activeCols]);
|
|
5377
5406
|
quantity = activeCols.size;
|
|
5378
5407
|
}
|
|
5379
5408
|
else {
|
|
@@ -7929,7 +7958,7 @@ function getBestTimeUnitForScale(labels, format) {
|
|
|
7929
7958
|
return undefined;
|
|
7930
7959
|
}
|
|
7931
7960
|
const labelsTimestamps = labelDates.map((date) => date.getTime());
|
|
7932
|
-
const period =
|
|
7961
|
+
const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
|
|
7933
7962
|
const minUnit = getFormatMinDisplayUnit(format);
|
|
7934
7963
|
if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
|
|
7935
7964
|
return "second";
|
|
@@ -8345,7 +8374,7 @@ function getPieConfiguration(chart, labels) {
|
|
|
8345
8374
|
}
|
|
8346
8375
|
function getPieColors(colors, dataSetsValues) {
|
|
8347
8376
|
const pieColors = [];
|
|
8348
|
-
const maxLength =
|
|
8377
|
+
const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
|
|
8349
8378
|
for (let i = 0; i <= maxLength; i++) {
|
|
8350
8379
|
pieColors.push(colors.next());
|
|
8351
8380
|
}
|
|
@@ -20635,6 +20664,12 @@ class Composer extends Component {
|
|
|
20635
20664
|
onCompleted(text) {
|
|
20636
20665
|
text && this.autoComplete(text);
|
|
20637
20666
|
}
|
|
20667
|
+
onContextMenu(ev) {
|
|
20668
|
+
var _a, _b;
|
|
20669
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
20670
|
+
(_b = (_a = this.props).onInputContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, ev);
|
|
20671
|
+
}
|
|
20672
|
+
}
|
|
20638
20673
|
// ---------------------------------------------------------------------------
|
|
20639
20674
|
// Private
|
|
20640
20675
|
// ---------------------------------------------------------------------------
|
|
@@ -20868,6 +20903,7 @@ class GridComposer extends Component {
|
|
|
20868
20903
|
isDefaultFocus: true,
|
|
20869
20904
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
20870
20905
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
20906
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
20871
20907
|
};
|
|
20872
20908
|
}
|
|
20873
20909
|
get containerStyle() {
|
|
@@ -23018,8 +23054,8 @@ class Grid extends Component {
|
|
|
23018
23054
|
else if (this.env.model.getters.getActiveRows().has(row)) {
|
|
23019
23055
|
type = "ROW";
|
|
23020
23056
|
}
|
|
23021
|
-
const { x, y, width
|
|
23022
|
-
this.toggleContextMenu(type, x + width, y +
|
|
23057
|
+
const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
|
|
23058
|
+
this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
|
|
23023
23059
|
}
|
|
23024
23060
|
onCellRightClicked(col, row, { x, y }) {
|
|
23025
23061
|
const zones = this.env.model.getters.getSelectedZones();
|
|
@@ -24653,29 +24689,12 @@ function convertWidthFromExcel(width) {
|
|
|
24653
24689
|
return width;
|
|
24654
24690
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
24655
24691
|
}
|
|
24656
|
-
function convertBorderDescr(descr) {
|
|
24657
|
-
if (!descr) {
|
|
24658
|
-
return undefined;
|
|
24659
|
-
}
|
|
24660
|
-
return {
|
|
24661
|
-
style: descr[0],
|
|
24662
|
-
color: { rgb: descr[1] },
|
|
24663
|
-
};
|
|
24664
|
-
}
|
|
24665
24692
|
function extractStyle(cell, data) {
|
|
24666
24693
|
let style = {};
|
|
24667
24694
|
if (cell.style) {
|
|
24668
24695
|
style = data.styles[cell.style];
|
|
24669
24696
|
}
|
|
24670
24697
|
const format = extractFormat(cell, data);
|
|
24671
|
-
const exportedBorder = {};
|
|
24672
|
-
if (cell.border) {
|
|
24673
|
-
const border = data.borders[cell.border];
|
|
24674
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
24675
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
24676
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
24677
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
24678
|
-
}
|
|
24679
24698
|
const styles = {
|
|
24680
24699
|
font: {
|
|
24681
24700
|
size: (style === null || style === void 0 ? void 0 : style.fontSize) || DEFAULT_FONT_SIZE,
|
|
@@ -24689,7 +24708,7 @@ function extractStyle(cell, data) {
|
|
|
24689
24708
|
}
|
|
24690
24709
|
: { reservedAttribute: "none" },
|
|
24691
24710
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
24692
|
-
border:
|
|
24711
|
+
border: cell.border || 0,
|
|
24693
24712
|
alignment: {
|
|
24694
24713
|
vertical: "center",
|
|
24695
24714
|
horizontal: style.align,
|
|
@@ -24718,23 +24737,19 @@ function extractFormat(cell, data) {
|
|
|
24718
24737
|
return undefined;
|
|
24719
24738
|
}
|
|
24720
24739
|
function normalizeStyle(construct, styles) {
|
|
24721
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
24722
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
24723
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
24724
24740
|
// Normalize this
|
|
24725
24741
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
24726
24742
|
const style = {
|
|
24727
|
-
fontId,
|
|
24728
|
-
fillId,
|
|
24729
|
-
borderId,
|
|
24743
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
24744
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
24745
|
+
borderId: styles.border,
|
|
24730
24746
|
numFmtId,
|
|
24731
24747
|
alignment: {
|
|
24732
24748
|
vertical: styles.alignment.vertical,
|
|
24733
24749
|
horizontal: styles.alignment.horizontal,
|
|
24734
24750
|
},
|
|
24735
24751
|
};
|
|
24736
|
-
|
|
24737
|
-
return id;
|
|
24752
|
+
return pushElement(style, construct.styles);
|
|
24738
24753
|
}
|
|
24739
24754
|
function convertFormat(format, numFmtStructure) {
|
|
24740
24755
|
if (!format) {
|
|
@@ -24742,8 +24757,7 @@ function convertFormat(format, numFmtStructure) {
|
|
|
24742
24757
|
}
|
|
24743
24758
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
24744
24759
|
if (!formatId) {
|
|
24745
|
-
|
|
24746
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
24760
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
24747
24761
|
}
|
|
24748
24762
|
return formatId;
|
|
24749
24763
|
}
|
|
@@ -24768,20 +24782,15 @@ function addRelsToFile(relsFiles, path, rel) {
|
|
|
24768
24782
|
return id;
|
|
24769
24783
|
}
|
|
24770
24784
|
function pushElement(property, propertyList) {
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24785
|
+
let len = propertyList.length;
|
|
24786
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
24787
|
+
for (let i = 0; i < len; i++) {
|
|
24788
|
+
if (operator(property, propertyList[i])) {
|
|
24789
|
+
return i;
|
|
24774
24790
|
}
|
|
24775
24791
|
}
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
propertyList.push(property);
|
|
24779
|
-
elemId = propertyList.length - 1;
|
|
24780
|
-
}
|
|
24781
|
-
return {
|
|
24782
|
-
id: elemId,
|
|
24783
|
-
list: propertyList,
|
|
24784
|
-
};
|
|
24792
|
+
propertyList[propertyList.length] = property;
|
|
24793
|
+
return propertyList.length - 1;
|
|
24785
24794
|
}
|
|
24786
24795
|
const chartIds = [];
|
|
24787
24796
|
/**
|
|
@@ -25185,7 +25194,7 @@ function convertHyperlink(link, cellValue, warningManager) {
|
|
|
25185
25194
|
function getSheetDims(sheet) {
|
|
25186
25195
|
const dims = [0, 0];
|
|
25187
25196
|
for (let row of sheet.rows) {
|
|
25188
|
-
dims[0] = Math.max(dims[0],
|
|
25197
|
+
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
25189
25198
|
dims[1] = Math.max(dims[1], row.index);
|
|
25190
25199
|
}
|
|
25191
25200
|
dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
@@ -25455,7 +25464,25 @@ function parseXML(xmlString) {
|
|
|
25455
25464
|
}
|
|
25456
25465
|
return document;
|
|
25457
25466
|
}
|
|
25458
|
-
function
|
|
25467
|
+
function convertBorderDescr(descr) {
|
|
25468
|
+
if (!descr) {
|
|
25469
|
+
return undefined;
|
|
25470
|
+
}
|
|
25471
|
+
return {
|
|
25472
|
+
style: descr[0],
|
|
25473
|
+
color: { rgb: descr[1] },
|
|
25474
|
+
};
|
|
25475
|
+
}
|
|
25476
|
+
function getDefaultXLSXStructure(data) {
|
|
25477
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
25478
|
+
return {
|
|
25479
|
+
left: convertBorderDescr(border.left),
|
|
25480
|
+
right: convertBorderDescr(border.right),
|
|
25481
|
+
bottom: convertBorderDescr(border.bottom),
|
|
25482
|
+
top: convertBorderDescr(border.top),
|
|
25483
|
+
};
|
|
25484
|
+
});
|
|
25485
|
+
const borders = [{}, ...xlsxBorders];
|
|
25459
25486
|
return {
|
|
25460
25487
|
relsFiles: [],
|
|
25461
25488
|
sharedStrings: [],
|
|
@@ -25478,7 +25505,7 @@ function getDefaultXLSXStructure() {
|
|
|
25478
25505
|
},
|
|
25479
25506
|
],
|
|
25480
25507
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
25481
|
-
borders
|
|
25508
|
+
borders,
|
|
25482
25509
|
numFmts: [],
|
|
25483
25510
|
dxfs: [],
|
|
25484
25511
|
};
|
|
@@ -29222,7 +29249,17 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29222
29249
|
}
|
|
29223
29250
|
}
|
|
29224
29251
|
exportForExcel(data) {
|
|
29225
|
-
|
|
29252
|
+
for (const sheet of data.sheets) {
|
|
29253
|
+
for (const filterTable of this.getFilterTables(sheet.id)) {
|
|
29254
|
+
if (zoneToDimension(filterTable.zone).height === 1) {
|
|
29255
|
+
continue;
|
|
29256
|
+
}
|
|
29257
|
+
sheet.filterTables.push({
|
|
29258
|
+
range: zoneToXc(filterTable.zone),
|
|
29259
|
+
filters: [],
|
|
29260
|
+
});
|
|
29261
|
+
}
|
|
29262
|
+
}
|
|
29226
29263
|
}
|
|
29227
29264
|
}
|
|
29228
29265
|
FiltersPlugin.getters = [
|
|
@@ -29278,7 +29315,7 @@ class HeaderSizePlugin extends CorePlugin {
|
|
|
29278
29315
|
for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
|
|
29279
29316
|
sizes.splice(headerIndex, 1);
|
|
29280
29317
|
}
|
|
29281
|
-
const min =
|
|
29318
|
+
const min = largeMin(cmd.elements);
|
|
29282
29319
|
sizes = sizes.map((size, row) => {
|
|
29283
29320
|
if (cmd.dimension === "ROW" && row >= min) {
|
|
29284
29321
|
// invalidate sizes
|
|
@@ -29506,7 +29543,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29506
29543
|
if (hiddenElements.size >= elements) {
|
|
29507
29544
|
return 66 /* CommandResult.TooManyHiddenElements */;
|
|
29508
29545
|
}
|
|
29509
|
-
else if (
|
|
29546
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
29510
29547
|
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
29511
29548
|
}
|
|
29512
29549
|
else {
|
|
@@ -30181,7 +30218,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30181
30218
|
const elements = cmd.dimension === "COL"
|
|
30182
30219
|
? this.getNumberCols(cmd.sheetId)
|
|
30183
30220
|
: this.getNumberRows(cmd.sheetId);
|
|
30184
|
-
if (
|
|
30221
|
+
if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
30185
30222
|
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
30186
30223
|
}
|
|
30187
30224
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
@@ -31554,13 +31591,13 @@ class AutomaticSumPlugin extends UIPlugin {
|
|
|
31554
31591
|
const cells = this.getters.getCellsInZone(sheet.id, zone);
|
|
31555
31592
|
const cellPositions = range(end, -1, -1);
|
|
31556
31593
|
const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
|
|
31557
|
-
const maxValidPosition =
|
|
31594
|
+
const maxValidPosition = largeMax(invalidCells);
|
|
31558
31595
|
const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
|
|
31559
31596
|
const firstSequence = numberSequences[0] || [];
|
|
31560
|
-
if (
|
|
31597
|
+
if (largeMax(firstSequence) < maxValidPosition) {
|
|
31561
31598
|
return Infinity;
|
|
31562
31599
|
}
|
|
31563
|
-
return
|
|
31600
|
+
return largeMin(firstSequence);
|
|
31564
31601
|
}
|
|
31565
31602
|
shouldFindData(sheetId, zone) {
|
|
31566
31603
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
@@ -33243,13 +33280,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33243
33280
|
.filter(this.isCellValueNumber);
|
|
33244
33281
|
switch (threshold.type) {
|
|
33245
33282
|
case "value":
|
|
33246
|
-
const result = functionName === "max" ?
|
|
33283
|
+
const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
33247
33284
|
return result;
|
|
33248
33285
|
case "number":
|
|
33249
33286
|
return Number(threshold.value);
|
|
33250
33287
|
case "percentage":
|
|
33251
|
-
const min =
|
|
33252
|
-
const max =
|
|
33288
|
+
const min = largeMin(rangeValues);
|
|
33289
|
+
const max = largeMax(rangeValues);
|
|
33253
33290
|
const delta = max - min;
|
|
33254
33291
|
return min + (delta * Number(threshold.value)) / 100;
|
|
33255
33292
|
case "percentile":
|
|
@@ -36947,12 +36984,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36947
36984
|
case "AlterZoneCorner":
|
|
36948
36985
|
break;
|
|
36949
36986
|
case "ZonesSelected":
|
|
36987
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
36950
36988
|
let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
|
|
36951
36989
|
if (event.mode === "updateAnchor") {
|
|
36952
36990
|
const oldZone = event.previousAnchor.zone;
|
|
36953
36991
|
const newZone = event.anchor.zone;
|
|
36954
36992
|
// altering a zone should not move the viewport in a dimension that wasn't changed
|
|
36955
|
-
const { top, bottom, left, right } = this.
|
|
36993
|
+
const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
|
|
36956
36994
|
if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
|
|
36957
36995
|
col = left > col || col > right ? left : col;
|
|
36958
36996
|
}
|
|
@@ -36960,10 +36998,9 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36960
36998
|
row = top > row || row > bottom ? top : row;
|
|
36961
36999
|
}
|
|
36962
37000
|
}
|
|
36963
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
36964
37001
|
col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
|
|
36965
37002
|
row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
|
|
36966
|
-
this.refreshViewport(
|
|
37003
|
+
this.refreshViewport(sheetId, { col, row });
|
|
36967
37004
|
break;
|
|
36968
37005
|
}
|
|
36969
37006
|
}
|
|
@@ -36988,16 +37025,16 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36988
37025
|
this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
|
|
36989
37026
|
break;
|
|
36990
37027
|
case "SHIFT_VIEWPORT_DOWN":
|
|
36991
|
-
const { top } = this.getActiveMainViewport();
|
|
36992
37028
|
const sheetId = this.getters.getActiveSheetId();
|
|
36993
|
-
const
|
|
36994
|
-
this.
|
|
37029
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
37030
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
37031
|
+
this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
|
|
36995
37032
|
break;
|
|
36996
37033
|
case "SHIFT_VIEWPORT_UP": {
|
|
36997
|
-
const { top } = this.getActiveMainViewport();
|
|
36998
37034
|
const sheetId = this.getters.getActiveSheetId();
|
|
36999
|
-
const
|
|
37000
|
-
this.
|
|
37035
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
37036
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
37037
|
+
this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
|
|
37001
37038
|
break;
|
|
37002
37039
|
}
|
|
37003
37040
|
case "REMOVE_COLUMNS_ROWS":
|
|
@@ -37356,17 +37393,6 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37356
37393
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
37357
37394
|
Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
37358
37395
|
}
|
|
37359
|
-
/**
|
|
37360
|
-
* Clip the vertical offset within the allowed range.
|
|
37361
|
-
* Not above the sheet, nor below the sheet.
|
|
37362
|
-
*/
|
|
37363
|
-
clipOffsetY(offsetY) {
|
|
37364
|
-
const { height } = this.getMainViewportRect();
|
|
37365
|
-
const maxOffset = height - this.sheetViewHeight;
|
|
37366
|
-
offsetY = Math.min(offsetY, maxOffset);
|
|
37367
|
-
offsetY = Math.max(offsetY, 0);
|
|
37368
|
-
return offsetY;
|
|
37369
|
-
}
|
|
37370
37396
|
getViewportOffset(sheetId) {
|
|
37371
37397
|
var _a, _b;
|
|
37372
37398
|
return {
|
|
@@ -37420,12 +37446,15 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37420
37446
|
* viewport top.
|
|
37421
37447
|
*/
|
|
37422
37448
|
shiftVertically(offset) {
|
|
37423
|
-
const
|
|
37449
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37450
|
+
const { top } = this.getMainInternalViewport(sheetId);
|
|
37424
37451
|
const { scrollX } = this.getActiveSheetScrollInfo();
|
|
37425
37452
|
this.setSheetViewOffset(scrollX, offset);
|
|
37426
37453
|
const { anchor } = this.getters.getSelection();
|
|
37427
|
-
|
|
37428
|
-
|
|
37454
|
+
if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
|
|
37455
|
+
const deltaRow = this.getMainInternalViewport(sheetId).top - top;
|
|
37456
|
+
this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
|
|
37457
|
+
}
|
|
37429
37458
|
}
|
|
37430
37459
|
getVisibleFigures() {
|
|
37431
37460
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -37986,7 +38015,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
37986
38015
|
getColMaxWidth(sheetId, index) {
|
|
37987
38016
|
const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
|
|
37988
38017
|
const sizes = cellsPositions.map((position) => this.getCellWidth(sheetId, position));
|
|
37989
|
-
return Math.max(0,
|
|
38018
|
+
return Math.max(0, largeMax(sizes));
|
|
37990
38019
|
}
|
|
37991
38020
|
splitWordToSpecificWidth(ctx, word, width, style) {
|
|
37992
38021
|
const wordWidth = computeTextWidth(ctx, word, style);
|
|
@@ -40337,8 +40366,8 @@ class RangeAdapter {
|
|
|
40337
40366
|
let newRange = range;
|
|
40338
40367
|
let changeType = "NONE";
|
|
40339
40368
|
for (let group of groups) {
|
|
40340
|
-
const min =
|
|
40341
|
-
const max =
|
|
40369
|
+
const min = largeMin(group);
|
|
40370
|
+
const max = largeMax(group);
|
|
40342
40371
|
if (range.zone[start] <= min && min <= range.zone[end]) {
|
|
40343
40372
|
const toRemove = Math.min(range.zone[end], max) - min + 1;
|
|
40344
40373
|
changeType = "RESIZE";
|
|
@@ -41596,7 +41625,7 @@ function addLineChart(chart) {
|
|
|
41596
41625
|
}
|
|
41597
41626
|
function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
|
|
41598
41627
|
const colors = new ChartColors();
|
|
41599
|
-
const maxLength =
|
|
41628
|
+
const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
|
|
41600
41629
|
const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
|
|
41601
41630
|
const dataSetsNodes = [];
|
|
41602
41631
|
for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
|
|
@@ -41745,8 +41774,7 @@ function addContent(content, sharedStrings, forceString = false) {
|
|
|
41745
41774
|
attrs.push(["t", "b"]);
|
|
41746
41775
|
}
|
|
41747
41776
|
else if (forceString || !isNumber(value)) {
|
|
41748
|
-
|
|
41749
|
-
value = id.toString();
|
|
41777
|
+
value = pushElement(content, sharedStrings);
|
|
41750
41778
|
attrs.push(["t", "s"]);
|
|
41751
41779
|
}
|
|
41752
41780
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -41871,8 +41899,7 @@ function addCellIsRule(cf, rule, dxfs) {
|
|
|
41871
41899
|
if (rule.style.fillColor) {
|
|
41872
41900
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
41873
41901
|
}
|
|
41874
|
-
|
|
41875
|
-
ruleAttributes.push(["dxfId", id]);
|
|
41902
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
41876
41903
|
return escapeXml /*xml*/ `
|
|
41877
41904
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
41878
41905
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -42583,7 +42610,7 @@ function addSheetViews(sheet) {
|
|
|
42583
42610
|
*/
|
|
42584
42611
|
function getXLSX(data) {
|
|
42585
42612
|
const files = [];
|
|
42586
|
-
const construct = getDefaultXLSXStructure();
|
|
42613
|
+
const construct = getDefaultXLSXStructure(data);
|
|
42587
42614
|
files.push(createWorkbook(data, construct));
|
|
42588
42615
|
files.push(...createWorksheets(data, construct));
|
|
42589
42616
|
files.push(createStylesSheet(construct));
|
|
@@ -43263,6 +43290,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43263
43290
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43264
43291
|
|
|
43265
43292
|
|
|
43266
|
-
__info__.version = '16.0.
|
|
43267
|
-
__info__.date = '2024-
|
|
43268
|
-
__info__.hash = '
|
|
43293
|
+
__info__.version = '16.0.38';
|
|
43294
|
+
__info__.date = '2024-04-10T12:16:41.911Z';
|
|
43295
|
+
__info__.hash = '6c7d510';
|