@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
|
@@ -992,7 +992,7 @@ function getItemId(item, itemsDic) {
|
|
|
992
992
|
}
|
|
993
993
|
// Generate new Id if the item didn't exist in the dictionary
|
|
994
994
|
const ids = Object.keys(itemsDic);
|
|
995
|
-
const maxId = ids.length === 0 ? 0 :
|
|
995
|
+
const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
|
|
996
996
|
itemsDic[maxId + 1] = item;
|
|
997
997
|
return maxId + 1;
|
|
998
998
|
}
|
|
@@ -1083,7 +1083,7 @@ function deepEquals(o1, o2) {
|
|
|
1083
1083
|
if (typeof o1 !== typeof o2)
|
|
1084
1084
|
return false;
|
|
1085
1085
|
if (typeof o1 !== "object")
|
|
1086
|
-
return
|
|
1086
|
+
return false;
|
|
1087
1087
|
// Objects can have different keys if the values are undefined
|
|
1088
1088
|
const keys = new Set();
|
|
1089
1089
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -1138,6 +1138,34 @@ function memoize(func) {
|
|
|
1138
1138
|
return cache.get(args[0]);
|
|
1139
1139
|
},
|
|
1140
1140
|
}[funcName];
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Alternative to Math.max that works with large arrays.
|
|
1144
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
1145
|
+
*/
|
|
1146
|
+
function largeMax(array) {
|
|
1147
|
+
let len = array.length;
|
|
1148
|
+
if (len < 100000)
|
|
1149
|
+
return Math.max(...array);
|
|
1150
|
+
let max = -Infinity;
|
|
1151
|
+
while (len--) {
|
|
1152
|
+
max = array[len] > max ? array[len] : max;
|
|
1153
|
+
}
|
|
1154
|
+
return max;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Alternative to Math.min that works with large arrays.
|
|
1158
|
+
* Typically useful for arrays bigger than 100k elements.
|
|
1159
|
+
*/
|
|
1160
|
+
function largeMin(array) {
|
|
1161
|
+
let len = array.length;
|
|
1162
|
+
if (len < 100000)
|
|
1163
|
+
return Math.min(...array);
|
|
1164
|
+
let min = +Infinity;
|
|
1165
|
+
while (len--) {
|
|
1166
|
+
min = array[len] < min ? array[len] : min;
|
|
1167
|
+
}
|
|
1168
|
+
return min;
|
|
1141
1169
|
}
|
|
1142
1170
|
|
|
1143
1171
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
@@ -4685,6 +4713,7 @@ class LinkEditor extends owl.Component {
|
|
|
4685
4713
|
if (this.state.link.url) {
|
|
4686
4714
|
this.save();
|
|
4687
4715
|
}
|
|
4716
|
+
ev.preventDefault();
|
|
4688
4717
|
break;
|
|
4689
4718
|
case "Escape":
|
|
4690
4719
|
this.cancel();
|
|
@@ -5100,8 +5129,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
|
|
|
5100
5129
|
let last;
|
|
5101
5130
|
const activesRows = env.model.getters.getActiveRows();
|
|
5102
5131
|
if (activesRows.size !== 0) {
|
|
5103
|
-
first =
|
|
5104
|
-
last =
|
|
5132
|
+
first = largeMin([...activesRows]);
|
|
5133
|
+
last = largeMax([...activesRows]);
|
|
5105
5134
|
}
|
|
5106
5135
|
else {
|
|
5107
5136
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5129,8 +5158,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
|
|
|
5129
5158
|
let last;
|
|
5130
5159
|
const activeCols = env.model.getters.getActiveCols();
|
|
5131
5160
|
if (activeCols.size !== 0) {
|
|
5132
|
-
first =
|
|
5133
|
-
last =
|
|
5161
|
+
first = largeMin([...activeCols]);
|
|
5162
|
+
last = largeMax([...activeCols]);
|
|
5134
5163
|
}
|
|
5135
5164
|
else {
|
|
5136
5165
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5158,8 +5187,8 @@ const REMOVE_ROWS_NAME = (env) => {
|
|
|
5158
5187
|
let last;
|
|
5159
5188
|
const activesRows = env.model.getters.getActiveRows();
|
|
5160
5189
|
if (activesRows.size !== 0) {
|
|
5161
|
-
first =
|
|
5162
|
-
last =
|
|
5190
|
+
first = largeMin([...activesRows]);
|
|
5191
|
+
last = largeMax([...activesRows]);
|
|
5163
5192
|
}
|
|
5164
5193
|
else {
|
|
5165
5194
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5200,8 +5229,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
|
|
|
5200
5229
|
let last;
|
|
5201
5230
|
const activeCols = env.model.getters.getActiveCols();
|
|
5202
5231
|
if (activeCols.size !== 0) {
|
|
5203
|
-
first =
|
|
5204
|
-
last =
|
|
5232
|
+
first = largeMin([...activeCols]);
|
|
5233
|
+
last = largeMax([...activeCols]);
|
|
5205
5234
|
}
|
|
5206
5235
|
else {
|
|
5207
5236
|
const zone = env.model.getters.getSelectedZones()[0];
|
|
@@ -5270,7 +5299,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
|
5270
5299
|
let row;
|
|
5271
5300
|
let quantity;
|
|
5272
5301
|
if (activeRows.size) {
|
|
5273
|
-
row =
|
|
5302
|
+
row = largeMin([...activeRows]);
|
|
5274
5303
|
quantity = activeRows.size;
|
|
5275
5304
|
}
|
|
5276
5305
|
else {
|
|
@@ -5302,7 +5331,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
|
|
|
5302
5331
|
let row;
|
|
5303
5332
|
let quantity;
|
|
5304
5333
|
if (activeRows.size) {
|
|
5305
|
-
row =
|
|
5334
|
+
row = largeMax([...activeRows]);
|
|
5306
5335
|
quantity = activeRows.size;
|
|
5307
5336
|
}
|
|
5308
5337
|
else {
|
|
@@ -5343,7 +5372,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
|
|
|
5343
5372
|
let column;
|
|
5344
5373
|
let quantity;
|
|
5345
5374
|
if (activeCols.size) {
|
|
5346
|
-
column =
|
|
5375
|
+
column = largeMin([...activeCols]);
|
|
5347
5376
|
quantity = activeCols.size;
|
|
5348
5377
|
}
|
|
5349
5378
|
else {
|
|
@@ -5377,7 +5406,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
|
|
|
5377
5406
|
let column;
|
|
5378
5407
|
let quantity;
|
|
5379
5408
|
if (activeCols.size) {
|
|
5380
|
-
column =
|
|
5409
|
+
column = largeMax([...activeCols]);
|
|
5381
5410
|
quantity = activeCols.size;
|
|
5382
5411
|
}
|
|
5383
5412
|
else {
|
|
@@ -7933,7 +7962,7 @@ function getBestTimeUnitForScale(labels, format) {
|
|
|
7933
7962
|
return undefined;
|
|
7934
7963
|
}
|
|
7935
7964
|
const labelsTimestamps = labelDates.map((date) => date.getTime());
|
|
7936
|
-
const period =
|
|
7965
|
+
const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
|
|
7937
7966
|
const minUnit = getFormatMinDisplayUnit(format);
|
|
7938
7967
|
if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
|
|
7939
7968
|
return "second";
|
|
@@ -8349,7 +8378,7 @@ function getPieConfiguration(chart, labels) {
|
|
|
8349
8378
|
}
|
|
8350
8379
|
function getPieColors(colors, dataSetsValues) {
|
|
8351
8380
|
const pieColors = [];
|
|
8352
|
-
const maxLength =
|
|
8381
|
+
const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
|
|
8353
8382
|
for (let i = 0; i <= maxLength; i++) {
|
|
8354
8383
|
pieColors.push(colors.next());
|
|
8355
8384
|
}
|
|
@@ -20639,6 +20668,12 @@ class Composer extends owl.Component {
|
|
|
20639
20668
|
onCompleted(text) {
|
|
20640
20669
|
text && this.autoComplete(text);
|
|
20641
20670
|
}
|
|
20671
|
+
onContextMenu(ev) {
|
|
20672
|
+
var _a, _b;
|
|
20673
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
20674
|
+
(_b = (_a = this.props).onInputContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, ev);
|
|
20675
|
+
}
|
|
20676
|
+
}
|
|
20642
20677
|
// ---------------------------------------------------------------------------
|
|
20643
20678
|
// Private
|
|
20644
20679
|
// ---------------------------------------------------------------------------
|
|
@@ -20872,6 +20907,7 @@ class GridComposer extends owl.Component {
|
|
|
20872
20907
|
isDefaultFocus: true,
|
|
20873
20908
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
20874
20909
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
20910
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
20875
20911
|
};
|
|
20876
20912
|
}
|
|
20877
20913
|
get containerStyle() {
|
|
@@ -23022,8 +23058,8 @@ class Grid extends owl.Component {
|
|
|
23022
23058
|
else if (this.env.model.getters.getActiveRows().has(row)) {
|
|
23023
23059
|
type = "ROW";
|
|
23024
23060
|
}
|
|
23025
|
-
const { x, y, width
|
|
23026
|
-
this.toggleContextMenu(type, x + width, y +
|
|
23061
|
+
const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
|
|
23062
|
+
this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
|
|
23027
23063
|
}
|
|
23028
23064
|
onCellRightClicked(col, row, { x, y }) {
|
|
23029
23065
|
const zones = this.env.model.getters.getSelectedZones();
|
|
@@ -24657,29 +24693,12 @@ function convertWidthFromExcel(width) {
|
|
|
24657
24693
|
return width;
|
|
24658
24694
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
24659
24695
|
}
|
|
24660
|
-
function convertBorderDescr(descr) {
|
|
24661
|
-
if (!descr) {
|
|
24662
|
-
return undefined;
|
|
24663
|
-
}
|
|
24664
|
-
return {
|
|
24665
|
-
style: descr[0],
|
|
24666
|
-
color: { rgb: descr[1] },
|
|
24667
|
-
};
|
|
24668
|
-
}
|
|
24669
24696
|
function extractStyle(cell, data) {
|
|
24670
24697
|
let style = {};
|
|
24671
24698
|
if (cell.style) {
|
|
24672
24699
|
style = data.styles[cell.style];
|
|
24673
24700
|
}
|
|
24674
24701
|
const format = extractFormat(cell, data);
|
|
24675
|
-
const exportedBorder = {};
|
|
24676
|
-
if (cell.border) {
|
|
24677
|
-
const border = data.borders[cell.border];
|
|
24678
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
24679
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
24680
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
24681
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
24682
|
-
}
|
|
24683
24702
|
const styles = {
|
|
24684
24703
|
font: {
|
|
24685
24704
|
size: (style === null || style === void 0 ? void 0 : style.fontSize) || DEFAULT_FONT_SIZE,
|
|
@@ -24693,7 +24712,7 @@ function extractStyle(cell, data) {
|
|
|
24693
24712
|
}
|
|
24694
24713
|
: { reservedAttribute: "none" },
|
|
24695
24714
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
24696
|
-
border:
|
|
24715
|
+
border: cell.border || 0,
|
|
24697
24716
|
alignment: {
|
|
24698
24717
|
vertical: "center",
|
|
24699
24718
|
horizontal: style.align,
|
|
@@ -24722,23 +24741,19 @@ function extractFormat(cell, data) {
|
|
|
24722
24741
|
return undefined;
|
|
24723
24742
|
}
|
|
24724
24743
|
function normalizeStyle(construct, styles) {
|
|
24725
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
24726
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
24727
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
24728
24744
|
// Normalize this
|
|
24729
24745
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
24730
24746
|
const style = {
|
|
24731
|
-
fontId,
|
|
24732
|
-
fillId,
|
|
24733
|
-
borderId,
|
|
24747
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
24748
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
24749
|
+
borderId: styles.border,
|
|
24734
24750
|
numFmtId,
|
|
24735
24751
|
alignment: {
|
|
24736
24752
|
vertical: styles.alignment.vertical,
|
|
24737
24753
|
horizontal: styles.alignment.horizontal,
|
|
24738
24754
|
},
|
|
24739
24755
|
};
|
|
24740
|
-
|
|
24741
|
-
return id;
|
|
24756
|
+
return pushElement(style, construct.styles);
|
|
24742
24757
|
}
|
|
24743
24758
|
function convertFormat(format, numFmtStructure) {
|
|
24744
24759
|
if (!format) {
|
|
@@ -24746,8 +24761,7 @@ function convertFormat(format, numFmtStructure) {
|
|
|
24746
24761
|
}
|
|
24747
24762
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
24748
24763
|
if (!formatId) {
|
|
24749
|
-
|
|
24750
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
24764
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
24751
24765
|
}
|
|
24752
24766
|
return formatId;
|
|
24753
24767
|
}
|
|
@@ -24772,20 +24786,15 @@ function addRelsToFile(relsFiles, path, rel) {
|
|
|
24772
24786
|
return id;
|
|
24773
24787
|
}
|
|
24774
24788
|
function pushElement(property, propertyList) {
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24789
|
+
let len = propertyList.length;
|
|
24790
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
24791
|
+
for (let i = 0; i < len; i++) {
|
|
24792
|
+
if (operator(property, propertyList[i])) {
|
|
24793
|
+
return i;
|
|
24778
24794
|
}
|
|
24779
24795
|
}
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
propertyList.push(property);
|
|
24783
|
-
elemId = propertyList.length - 1;
|
|
24784
|
-
}
|
|
24785
|
-
return {
|
|
24786
|
-
id: elemId,
|
|
24787
|
-
list: propertyList,
|
|
24788
|
-
};
|
|
24796
|
+
propertyList[propertyList.length] = property;
|
|
24797
|
+
return propertyList.length - 1;
|
|
24789
24798
|
}
|
|
24790
24799
|
const chartIds = [];
|
|
24791
24800
|
/**
|
|
@@ -25189,7 +25198,7 @@ function convertHyperlink(link, cellValue, warningManager) {
|
|
|
25189
25198
|
function getSheetDims(sheet) {
|
|
25190
25199
|
const dims = [0, 0];
|
|
25191
25200
|
for (let row of sheet.rows) {
|
|
25192
|
-
dims[0] = Math.max(dims[0],
|
|
25201
|
+
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
25193
25202
|
dims[1] = Math.max(dims[1], row.index);
|
|
25194
25203
|
}
|
|
25195
25204
|
dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
@@ -25459,7 +25468,25 @@ function parseXML(xmlString) {
|
|
|
25459
25468
|
}
|
|
25460
25469
|
return document;
|
|
25461
25470
|
}
|
|
25462
|
-
function
|
|
25471
|
+
function convertBorderDescr(descr) {
|
|
25472
|
+
if (!descr) {
|
|
25473
|
+
return undefined;
|
|
25474
|
+
}
|
|
25475
|
+
return {
|
|
25476
|
+
style: descr[0],
|
|
25477
|
+
color: { rgb: descr[1] },
|
|
25478
|
+
};
|
|
25479
|
+
}
|
|
25480
|
+
function getDefaultXLSXStructure(data) {
|
|
25481
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
25482
|
+
return {
|
|
25483
|
+
left: convertBorderDescr(border.left),
|
|
25484
|
+
right: convertBorderDescr(border.right),
|
|
25485
|
+
bottom: convertBorderDescr(border.bottom),
|
|
25486
|
+
top: convertBorderDescr(border.top),
|
|
25487
|
+
};
|
|
25488
|
+
});
|
|
25489
|
+
const borders = [{}, ...xlsxBorders];
|
|
25463
25490
|
return {
|
|
25464
25491
|
relsFiles: [],
|
|
25465
25492
|
sharedStrings: [],
|
|
@@ -25482,7 +25509,7 @@ function getDefaultXLSXStructure() {
|
|
|
25482
25509
|
},
|
|
25483
25510
|
],
|
|
25484
25511
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
25485
|
-
borders
|
|
25512
|
+
borders,
|
|
25486
25513
|
numFmts: [],
|
|
25487
25514
|
dxfs: [],
|
|
25488
25515
|
};
|
|
@@ -29226,7 +29253,17 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29226
29253
|
}
|
|
29227
29254
|
}
|
|
29228
29255
|
exportForExcel(data) {
|
|
29229
|
-
|
|
29256
|
+
for (const sheet of data.sheets) {
|
|
29257
|
+
for (const filterTable of this.getFilterTables(sheet.id)) {
|
|
29258
|
+
if (zoneToDimension(filterTable.zone).height === 1) {
|
|
29259
|
+
continue;
|
|
29260
|
+
}
|
|
29261
|
+
sheet.filterTables.push({
|
|
29262
|
+
range: zoneToXc(filterTable.zone),
|
|
29263
|
+
filters: [],
|
|
29264
|
+
});
|
|
29265
|
+
}
|
|
29266
|
+
}
|
|
29230
29267
|
}
|
|
29231
29268
|
}
|
|
29232
29269
|
FiltersPlugin.getters = [
|
|
@@ -29282,7 +29319,7 @@ class HeaderSizePlugin extends CorePlugin {
|
|
|
29282
29319
|
for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
|
|
29283
29320
|
sizes.splice(headerIndex, 1);
|
|
29284
29321
|
}
|
|
29285
|
-
const min =
|
|
29322
|
+
const min = largeMin(cmd.elements);
|
|
29286
29323
|
sizes = sizes.map((size, row) => {
|
|
29287
29324
|
if (cmd.dimension === "ROW" && row >= min) {
|
|
29288
29325
|
// invalidate sizes
|
|
@@ -29510,7 +29547,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29510
29547
|
if (hiddenElements.size >= elements) {
|
|
29511
29548
|
return 66 /* CommandResult.TooManyHiddenElements */;
|
|
29512
29549
|
}
|
|
29513
|
-
else if (
|
|
29550
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
29514
29551
|
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
29515
29552
|
}
|
|
29516
29553
|
else {
|
|
@@ -30185,7 +30222,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30185
30222
|
const elements = cmd.dimension === "COL"
|
|
30186
30223
|
? this.getNumberCols(cmd.sheetId)
|
|
30187
30224
|
: this.getNumberRows(cmd.sheetId);
|
|
30188
|
-
if (
|
|
30225
|
+
if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
30189
30226
|
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
30190
30227
|
}
|
|
30191
30228
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
@@ -31558,13 +31595,13 @@ class AutomaticSumPlugin extends UIPlugin {
|
|
|
31558
31595
|
const cells = this.getters.getCellsInZone(sheet.id, zone);
|
|
31559
31596
|
const cellPositions = range(end, -1, -1);
|
|
31560
31597
|
const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
|
|
31561
|
-
const maxValidPosition =
|
|
31598
|
+
const maxValidPosition = largeMax(invalidCells);
|
|
31562
31599
|
const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
|
|
31563
31600
|
const firstSequence = numberSequences[0] || [];
|
|
31564
|
-
if (
|
|
31601
|
+
if (largeMax(firstSequence) < maxValidPosition) {
|
|
31565
31602
|
return Infinity;
|
|
31566
31603
|
}
|
|
31567
|
-
return
|
|
31604
|
+
return largeMin(firstSequence);
|
|
31568
31605
|
}
|
|
31569
31606
|
shouldFindData(sheetId, zone) {
|
|
31570
31607
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
@@ -33247,13 +33284,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33247
33284
|
.filter(this.isCellValueNumber);
|
|
33248
33285
|
switch (threshold.type) {
|
|
33249
33286
|
case "value":
|
|
33250
|
-
const result = functionName === "max" ?
|
|
33287
|
+
const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
33251
33288
|
return result;
|
|
33252
33289
|
case "number":
|
|
33253
33290
|
return Number(threshold.value);
|
|
33254
33291
|
case "percentage":
|
|
33255
|
-
const min =
|
|
33256
|
-
const max =
|
|
33292
|
+
const min = largeMin(rangeValues);
|
|
33293
|
+
const max = largeMax(rangeValues);
|
|
33257
33294
|
const delta = max - min;
|
|
33258
33295
|
return min + (delta * Number(threshold.value)) / 100;
|
|
33259
33296
|
case "percentile":
|
|
@@ -36951,12 +36988,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36951
36988
|
case "AlterZoneCorner":
|
|
36952
36989
|
break;
|
|
36953
36990
|
case "ZonesSelected":
|
|
36991
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
36954
36992
|
let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
|
|
36955
36993
|
if (event.mode === "updateAnchor") {
|
|
36956
36994
|
const oldZone = event.previousAnchor.zone;
|
|
36957
36995
|
const newZone = event.anchor.zone;
|
|
36958
36996
|
// altering a zone should not move the viewport in a dimension that wasn't changed
|
|
36959
|
-
const { top, bottom, left, right } = this.
|
|
36997
|
+
const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
|
|
36960
36998
|
if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
|
|
36961
36999
|
col = left > col || col > right ? left : col;
|
|
36962
37000
|
}
|
|
@@ -36964,10 +37002,9 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36964
37002
|
row = top > row || row > bottom ? top : row;
|
|
36965
37003
|
}
|
|
36966
37004
|
}
|
|
36967
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
36968
37005
|
col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
|
|
36969
37006
|
row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
|
|
36970
|
-
this.refreshViewport(
|
|
37007
|
+
this.refreshViewport(sheetId, { col, row });
|
|
36971
37008
|
break;
|
|
36972
37009
|
}
|
|
36973
37010
|
}
|
|
@@ -36992,16 +37029,16 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
36992
37029
|
this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
|
|
36993
37030
|
break;
|
|
36994
37031
|
case "SHIFT_VIEWPORT_DOWN":
|
|
36995
|
-
const { top } = this.getActiveMainViewport();
|
|
36996
37032
|
const sheetId = this.getters.getActiveSheetId();
|
|
36997
|
-
const
|
|
36998
|
-
this.
|
|
37033
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
37034
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
37035
|
+
this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
|
|
36999
37036
|
break;
|
|
37000
37037
|
case "SHIFT_VIEWPORT_UP": {
|
|
37001
|
-
const { top } = this.getActiveMainViewport();
|
|
37002
37038
|
const sheetId = this.getters.getActiveSheetId();
|
|
37003
|
-
const
|
|
37004
|
-
this.
|
|
37039
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
37040
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
37041
|
+
this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
|
|
37005
37042
|
break;
|
|
37006
37043
|
}
|
|
37007
37044
|
case "REMOVE_COLUMNS_ROWS":
|
|
@@ -37360,17 +37397,6 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37360
37397
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
37361
37398
|
Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
37362
37399
|
}
|
|
37363
|
-
/**
|
|
37364
|
-
* Clip the vertical offset within the allowed range.
|
|
37365
|
-
* Not above the sheet, nor below the sheet.
|
|
37366
|
-
*/
|
|
37367
|
-
clipOffsetY(offsetY) {
|
|
37368
|
-
const { height } = this.getMainViewportRect();
|
|
37369
|
-
const maxOffset = height - this.sheetViewHeight;
|
|
37370
|
-
offsetY = Math.min(offsetY, maxOffset);
|
|
37371
|
-
offsetY = Math.max(offsetY, 0);
|
|
37372
|
-
return offsetY;
|
|
37373
|
-
}
|
|
37374
37400
|
getViewportOffset(sheetId) {
|
|
37375
37401
|
var _a, _b;
|
|
37376
37402
|
return {
|
|
@@ -37424,12 +37450,15 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37424
37450
|
* viewport top.
|
|
37425
37451
|
*/
|
|
37426
37452
|
shiftVertically(offset) {
|
|
37427
|
-
const
|
|
37453
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37454
|
+
const { top } = this.getMainInternalViewport(sheetId);
|
|
37428
37455
|
const { scrollX } = this.getActiveSheetScrollInfo();
|
|
37429
37456
|
this.setSheetViewOffset(scrollX, offset);
|
|
37430
37457
|
const { anchor } = this.getters.getSelection();
|
|
37431
|
-
|
|
37432
|
-
|
|
37458
|
+
if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
|
|
37459
|
+
const deltaRow = this.getMainInternalViewport(sheetId).top - top;
|
|
37460
|
+
this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
|
|
37461
|
+
}
|
|
37433
37462
|
}
|
|
37434
37463
|
getVisibleFigures() {
|
|
37435
37464
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -37990,7 +38019,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
37990
38019
|
getColMaxWidth(sheetId, index) {
|
|
37991
38020
|
const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
|
|
37992
38021
|
const sizes = cellsPositions.map((position) => this.getCellWidth(sheetId, position));
|
|
37993
|
-
return Math.max(0,
|
|
38022
|
+
return Math.max(0, largeMax(sizes));
|
|
37994
38023
|
}
|
|
37995
38024
|
splitWordToSpecificWidth(ctx, word, width, style) {
|
|
37996
38025
|
const wordWidth = computeTextWidth(ctx, word, style);
|
|
@@ -40341,8 +40370,8 @@ class RangeAdapter {
|
|
|
40341
40370
|
let newRange = range;
|
|
40342
40371
|
let changeType = "NONE";
|
|
40343
40372
|
for (let group of groups) {
|
|
40344
|
-
const min =
|
|
40345
|
-
const max =
|
|
40373
|
+
const min = largeMin(group);
|
|
40374
|
+
const max = largeMax(group);
|
|
40346
40375
|
if (range.zone[start] <= min && min <= range.zone[end]) {
|
|
40347
40376
|
const toRemove = Math.min(range.zone[end], max) - min + 1;
|
|
40348
40377
|
changeType = "RESIZE";
|
|
@@ -41600,7 +41629,7 @@ function addLineChart(chart) {
|
|
|
41600
41629
|
}
|
|
41601
41630
|
function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
|
|
41602
41631
|
const colors = new ChartColors();
|
|
41603
|
-
const maxLength =
|
|
41632
|
+
const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
|
|
41604
41633
|
const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
|
|
41605
41634
|
const dataSetsNodes = [];
|
|
41606
41635
|
for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
|
|
@@ -41749,8 +41778,7 @@ function addContent(content, sharedStrings, forceString = false) {
|
|
|
41749
41778
|
attrs.push(["t", "b"]);
|
|
41750
41779
|
}
|
|
41751
41780
|
else if (forceString || !isNumber(value)) {
|
|
41752
|
-
|
|
41753
|
-
value = id.toString();
|
|
41781
|
+
value = pushElement(content, sharedStrings);
|
|
41754
41782
|
attrs.push(["t", "s"]);
|
|
41755
41783
|
}
|
|
41756
41784
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -41875,8 +41903,7 @@ function addCellIsRule(cf, rule, dxfs) {
|
|
|
41875
41903
|
if (rule.style.fillColor) {
|
|
41876
41904
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
41877
41905
|
}
|
|
41878
|
-
|
|
41879
|
-
ruleAttributes.push(["dxfId", id]);
|
|
41906
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
41880
41907
|
return escapeXml /*xml*/ `
|
|
41881
41908
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
41882
41909
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -42587,7 +42614,7 @@ function addSheetViews(sheet) {
|
|
|
42587
42614
|
*/
|
|
42588
42615
|
function getXLSX(data) {
|
|
42589
42616
|
const files = [];
|
|
42590
|
-
const construct = getDefaultXLSXStructure();
|
|
42617
|
+
const construct = getDefaultXLSXStructure(data);
|
|
42591
42618
|
files.push(createWorkbook(data, construct));
|
|
42592
42619
|
files.push(...createWorksheets(data, construct));
|
|
42593
42620
|
files.push(createStylesSheet(construct));
|
|
@@ -43295,6 +43322,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
43295
43322
|
exports.tokenize = tokenize;
|
|
43296
43323
|
|
|
43297
43324
|
|
|
43298
|
-
__info__.version = '16.0.
|
|
43299
|
-
__info__.date = '2024-
|
|
43300
|
-
__info__.hash = '
|
|
43325
|
+
__info__.version = '16.0.38';
|
|
43326
|
+
__info__.date = '2024-04-10T12:16:41.911Z';
|
|
43327
|
+
__info__.hash = '6c7d510';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4483,11 +4483,6 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4483
4483
|
private resizeSheetView;
|
|
4484
4484
|
private recomputeViewports;
|
|
4485
4485
|
private setSheetViewOffset;
|
|
4486
|
-
/**
|
|
4487
|
-
* Clip the vertical offset within the allowed range.
|
|
4488
|
-
* Not above the sheet, nor below the sheet.
|
|
4489
|
-
*/
|
|
4490
|
-
private clipOffsetY;
|
|
4491
4486
|
private getViewportOffset;
|
|
4492
4487
|
private resetViewports;
|
|
4493
4488
|
/**
|
|
@@ -5538,6 +5533,7 @@ interface ComposerProps {
|
|
|
5538
5533
|
focus: "inactive" | "cellFocus" | "contentFocus";
|
|
5539
5534
|
onComposerContentFocused: () => void;
|
|
5540
5535
|
onComposerCellFocused?: (content: String) => void;
|
|
5536
|
+
onInputContextMenu?: (event: MouseEvent) => void;
|
|
5541
5537
|
isDefaultFocus?: boolean;
|
|
5542
5538
|
}
|
|
5543
5539
|
interface ComposerState$1 {
|
|
@@ -5600,6 +5596,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
|
|
|
5600
5596
|
onClick(): void;
|
|
5601
5597
|
onBlur(): void;
|
|
5602
5598
|
onCompleted(text: string | undefined): void;
|
|
5599
|
+
onContextMenu(ev: MouseEvent): void;
|
|
5603
5600
|
private processContent;
|
|
5604
5601
|
private getContent;
|
|
5605
5602
|
private getColoredTokens;
|
|
@@ -5618,6 +5615,7 @@ interface Props$i {
|
|
|
5618
5615
|
content: string;
|
|
5619
5616
|
onComposerContentFocused: () => void;
|
|
5620
5617
|
onComposerCellFocused: () => void;
|
|
5618
|
+
onInputContextMenu: (event: MouseEvent) => void;
|
|
5621
5619
|
}
|
|
5622
5620
|
/**
|
|
5623
5621
|
* This component is a composer which positions itself on the grid at the anchor cell.
|