@odoo/o-spreadsheet 16.4.28 → 16.4.29
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 +79 -77
- package/dist/o-spreadsheet.d.ts +3 -5
- package/dist/o-spreadsheet.esm.js +79 -77
- package/dist/o-spreadsheet.iife.js +79 -77
- package/dist/o-spreadsheet.iife.min.js +63 -63
- package/dist/o_spreadsheet.xml +5 -4
- package/package.json +1 -1
|
@@ -614,7 +614,7 @@
|
|
|
614
614
|
if (typeof o1 !== typeof o2)
|
|
615
615
|
return false;
|
|
616
616
|
if (typeof o1 !== "object")
|
|
617
|
-
return
|
|
617
|
+
return false;
|
|
618
618
|
// Objects can have different keys if the values are undefined
|
|
619
619
|
const keys = new Set();
|
|
620
620
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -15798,6 +15798,7 @@
|
|
|
15798
15798
|
this.save();
|
|
15799
15799
|
}
|
|
15800
15800
|
ev.stopPropagation();
|
|
15801
|
+
ev.preventDefault();
|
|
15801
15802
|
break;
|
|
15802
15803
|
case "Escape":
|
|
15803
15804
|
this.cancel();
|
|
@@ -24463,6 +24464,11 @@
|
|
|
24463
24464
|
}
|
|
24464
24465
|
}
|
|
24465
24466
|
}
|
|
24467
|
+
onContextMenu(ev) {
|
|
24468
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
24469
|
+
this.props.onInputContextMenu?.(ev);
|
|
24470
|
+
}
|
|
24471
|
+
}
|
|
24466
24472
|
// ---------------------------------------------------------------------------
|
|
24467
24473
|
// Private
|
|
24468
24474
|
// ---------------------------------------------------------------------------
|
|
@@ -24687,6 +24693,7 @@
|
|
|
24687
24693
|
onComposerCellFocused: { type: Function, optional: true },
|
|
24688
24694
|
onComposerContentFocused: Function,
|
|
24689
24695
|
isDefaultFocus: { type: Boolean, optional: true },
|
|
24696
|
+
onInputContextMenu: { type: Function, optional: true },
|
|
24690
24697
|
};
|
|
24691
24698
|
|
|
24692
24699
|
const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
|
|
@@ -24763,6 +24770,7 @@
|
|
|
24763
24770
|
isDefaultFocus: true,
|
|
24764
24771
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
24765
24772
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
24773
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
24766
24774
|
};
|
|
24767
24775
|
}
|
|
24768
24776
|
get containerStyle() {
|
|
@@ -24851,6 +24859,7 @@
|
|
|
24851
24859
|
onComposerContentFocused: Function,
|
|
24852
24860
|
gridDims: Object,
|
|
24853
24861
|
onComposerCellFocused: Function,
|
|
24862
|
+
onInputContextMenu: Function,
|
|
24854
24863
|
};
|
|
24855
24864
|
|
|
24856
24865
|
const CSS$1 = css /* scss */ `
|
|
@@ -27200,8 +27209,8 @@
|
|
|
27200
27209
|
else if (this.env.model.getters.getActiveRows().has(row)) {
|
|
27201
27210
|
type = "ROW";
|
|
27202
27211
|
}
|
|
27203
|
-
const { x, y, width
|
|
27204
|
-
this.toggleContextMenu(type, x + width, y +
|
|
27212
|
+
const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
|
|
27213
|
+
this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
|
|
27205
27214
|
}
|
|
27206
27215
|
onCellRightClicked(col, row, { x, y }) {
|
|
27207
27216
|
const zones = this.env.model.getters.getSelectedZones();
|
|
@@ -28491,29 +28500,12 @@
|
|
|
28491
28500
|
return width;
|
|
28492
28501
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
28493
28502
|
}
|
|
28494
|
-
function convertBorderDescr(descr) {
|
|
28495
|
-
if (!descr) {
|
|
28496
|
-
return undefined;
|
|
28497
|
-
}
|
|
28498
|
-
return {
|
|
28499
|
-
style: descr.style,
|
|
28500
|
-
color: { rgb: descr.color },
|
|
28501
|
-
};
|
|
28502
|
-
}
|
|
28503
28503
|
function extractStyle(cell, data) {
|
|
28504
28504
|
let style = {};
|
|
28505
28505
|
if (cell.style) {
|
|
28506
28506
|
style = data.styles[cell.style];
|
|
28507
28507
|
}
|
|
28508
28508
|
const format = extractFormat(cell, data);
|
|
28509
|
-
const exportedBorder = {};
|
|
28510
|
-
if (cell.border) {
|
|
28511
|
-
const border = data.borders[cell.border];
|
|
28512
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
28513
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
28514
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
28515
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
28516
|
-
}
|
|
28517
28509
|
const styles = {
|
|
28518
28510
|
font: {
|
|
28519
28511
|
size: style?.fontSize || DEFAULT_FONT_SIZE,
|
|
@@ -28527,7 +28519,7 @@
|
|
|
28527
28519
|
}
|
|
28528
28520
|
: { reservedAttribute: "none" },
|
|
28529
28521
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
28530
|
-
border:
|
|
28522
|
+
border: cell.border || 0,
|
|
28531
28523
|
alignment: {
|
|
28532
28524
|
horizontal: style.align,
|
|
28533
28525
|
vertical: style.verticalAlign
|
|
@@ -28549,15 +28541,12 @@
|
|
|
28549
28541
|
return undefined;
|
|
28550
28542
|
}
|
|
28551
28543
|
function normalizeStyle(construct, styles) {
|
|
28552
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
28553
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
28554
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
28555
28544
|
// Normalize this
|
|
28556
28545
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
28557
28546
|
const style = {
|
|
28558
|
-
fontId,
|
|
28559
|
-
fillId,
|
|
28560
|
-
borderId,
|
|
28547
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
28548
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
28549
|
+
borderId: styles.border,
|
|
28561
28550
|
numFmtId,
|
|
28562
28551
|
alignment: {
|
|
28563
28552
|
vertical: styles.alignment.vertical,
|
|
@@ -28565,8 +28554,7 @@
|
|
|
28565
28554
|
wrapText: styles.alignment.wrapText,
|
|
28566
28555
|
},
|
|
28567
28556
|
};
|
|
28568
|
-
|
|
28569
|
-
return id;
|
|
28557
|
+
return pushElement(style, construct.styles);
|
|
28570
28558
|
}
|
|
28571
28559
|
function convertFormat(format, numFmtStructure) {
|
|
28572
28560
|
if (!format) {
|
|
@@ -28574,8 +28562,7 @@
|
|
|
28574
28562
|
}
|
|
28575
28563
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
28576
28564
|
if (!formatId) {
|
|
28577
|
-
|
|
28578
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
28565
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
28579
28566
|
}
|
|
28580
28567
|
return formatId;
|
|
28581
28568
|
}
|
|
@@ -28600,20 +28587,15 @@
|
|
|
28600
28587
|
return id;
|
|
28601
28588
|
}
|
|
28602
28589
|
function pushElement(property, propertyList) {
|
|
28603
|
-
|
|
28604
|
-
|
|
28605
|
-
|
|
28590
|
+
let len = propertyList.length;
|
|
28591
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
28592
|
+
for (let i = 0; i < len; i++) {
|
|
28593
|
+
if (operator(property, propertyList[i])) {
|
|
28594
|
+
return i;
|
|
28606
28595
|
}
|
|
28607
28596
|
}
|
|
28608
|
-
|
|
28609
|
-
|
|
28610
|
-
propertyList.push(property);
|
|
28611
|
-
elemId = propertyList.length - 1;
|
|
28612
|
-
}
|
|
28613
|
-
return {
|
|
28614
|
-
id: elemId,
|
|
28615
|
-
list: propertyList,
|
|
28616
|
-
};
|
|
28597
|
+
propertyList[propertyList.length] = property;
|
|
28598
|
+
return propertyList.length - 1;
|
|
28617
28599
|
}
|
|
28618
28600
|
const chartIds = [];
|
|
28619
28601
|
/**
|
|
@@ -29334,7 +29316,25 @@
|
|
|
29334
29316
|
}
|
|
29335
29317
|
return document;
|
|
29336
29318
|
}
|
|
29337
|
-
function
|
|
29319
|
+
function convertBorderDescr(descr) {
|
|
29320
|
+
if (!descr) {
|
|
29321
|
+
return undefined;
|
|
29322
|
+
}
|
|
29323
|
+
return {
|
|
29324
|
+
style: descr.style,
|
|
29325
|
+
color: { rgb: descr.color },
|
|
29326
|
+
};
|
|
29327
|
+
}
|
|
29328
|
+
function getDefaultXLSXStructure(data) {
|
|
29329
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
29330
|
+
return {
|
|
29331
|
+
left: convertBorderDescr(border.left),
|
|
29332
|
+
right: convertBorderDescr(border.right),
|
|
29333
|
+
bottom: convertBorderDescr(border.bottom),
|
|
29334
|
+
top: convertBorderDescr(border.top),
|
|
29335
|
+
};
|
|
29336
|
+
});
|
|
29337
|
+
const borders = [{}, ...xlsxBorders];
|
|
29338
29338
|
return {
|
|
29339
29339
|
relsFiles: [],
|
|
29340
29340
|
sharedStrings: [],
|
|
@@ -29357,7 +29357,7 @@
|
|
|
29357
29357
|
},
|
|
29358
29358
|
],
|
|
29359
29359
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
29360
|
-
borders
|
|
29360
|
+
borders,
|
|
29361
29361
|
numFmts: [],
|
|
29362
29362
|
dxfs: [],
|
|
29363
29363
|
};
|
|
@@ -33422,7 +33422,17 @@
|
|
|
33422
33422
|
}
|
|
33423
33423
|
}
|
|
33424
33424
|
exportForExcel(data) {
|
|
33425
|
-
|
|
33425
|
+
for (const sheet of data.sheets) {
|
|
33426
|
+
for (const filterTable of this.getFilterTables(sheet.id)) {
|
|
33427
|
+
if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
|
|
33428
|
+
continue;
|
|
33429
|
+
}
|
|
33430
|
+
sheet.filterTables.push({
|
|
33431
|
+
range: zoneToXc(filterTable.zone),
|
|
33432
|
+
filters: [],
|
|
33433
|
+
});
|
|
33434
|
+
}
|
|
33435
|
+
}
|
|
33426
33436
|
}
|
|
33427
33437
|
}
|
|
33428
33438
|
|
|
@@ -36716,7 +36726,9 @@
|
|
|
36716
36726
|
this.blockedArrayFormulas = new Set();
|
|
36717
36727
|
this.spreadingRelations = new SpreadingRelation();
|
|
36718
36728
|
this.formulaDependencies = lazy(() => {
|
|
36719
|
-
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
|
|
36729
|
+
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
|
|
36730
|
+
.filter((range) => !range.invalidSheetName && !range.invalidXc)
|
|
36731
|
+
.map((range) => ({
|
|
36720
36732
|
data: positionId,
|
|
36721
36733
|
boundingBox: {
|
|
36722
36734
|
zone: range.zone,
|
|
@@ -45251,13 +45263,14 @@
|
|
|
45251
45263
|
}
|
|
45252
45264
|
}
|
|
45253
45265
|
handleEvent(event) {
|
|
45266
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
45254
45267
|
if (event.options.scrollIntoView) {
|
|
45255
45268
|
let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
|
|
45256
45269
|
if (event.mode === "updateAnchor") {
|
|
45257
45270
|
const oldZone = event.previousAnchor.zone;
|
|
45258
45271
|
const newZone = event.anchor.zone;
|
|
45259
45272
|
// altering a zone should not move the viewport in a dimension that wasn't changed
|
|
45260
|
-
const { top, bottom, left, right } = this.
|
|
45273
|
+
const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
|
|
45261
45274
|
if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
|
|
45262
45275
|
col = left > col || col > right ? left : col;
|
|
45263
45276
|
}
|
|
@@ -45265,7 +45278,6 @@
|
|
|
45265
45278
|
row = top > row || row > bottom ? top : row;
|
|
45266
45279
|
}
|
|
45267
45280
|
}
|
|
45268
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
45269
45281
|
col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
|
|
45270
45282
|
row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
|
|
45271
45283
|
this.refreshViewport(this.getters.getActiveSheetId(), { col, row });
|
|
@@ -45291,16 +45303,16 @@
|
|
|
45291
45303
|
this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
|
|
45292
45304
|
break;
|
|
45293
45305
|
case "SHIFT_VIEWPORT_DOWN":
|
|
45294
|
-
const { top } = this.getActiveMainViewport();
|
|
45295
45306
|
const sheetId = this.getters.getActiveSheetId();
|
|
45296
|
-
const
|
|
45297
|
-
this.
|
|
45307
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
45308
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
45309
|
+
this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
|
|
45298
45310
|
break;
|
|
45299
45311
|
case "SHIFT_VIEWPORT_UP": {
|
|
45300
|
-
const { top } = this.getActiveMainViewport();
|
|
45301
45312
|
const sheetId = this.getters.getActiveSheetId();
|
|
45302
|
-
const
|
|
45303
|
-
this.
|
|
45313
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
45314
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
45315
|
+
this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
|
|
45304
45316
|
break;
|
|
45305
45317
|
}
|
|
45306
45318
|
case "REMOVE_COLUMNS_ROWS":
|
|
@@ -45662,17 +45674,6 @@
|
|
|
45662
45674
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
45663
45675
|
Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
45664
45676
|
}
|
|
45665
|
-
/**
|
|
45666
|
-
* Clip the vertical offset within the allowed range.
|
|
45667
|
-
* Not above the sheet, nor below the sheet.
|
|
45668
|
-
*/
|
|
45669
|
-
clipOffsetY(offsetY) {
|
|
45670
|
-
const { height } = this.getMainViewportRect();
|
|
45671
|
-
const maxOffset = height - this.sheetViewHeight;
|
|
45672
|
-
offsetY = Math.min(offsetY, maxOffset);
|
|
45673
|
-
offsetY = Math.max(offsetY, 0);
|
|
45674
|
-
return offsetY;
|
|
45675
|
-
}
|
|
45676
45677
|
getViewportOffset(sheetId) {
|
|
45677
45678
|
return {
|
|
45678
45679
|
x: this.viewports[sheetId]?.bottomRight.offsetScrollbarX || 0,
|
|
@@ -45728,12 +45729,15 @@
|
|
|
45728
45729
|
* viewport top.
|
|
45729
45730
|
*/
|
|
45730
45731
|
shiftVertically(offset) {
|
|
45731
|
-
const
|
|
45732
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
45733
|
+
const { top } = this.getMainInternalViewport(sheetId);
|
|
45732
45734
|
const { scrollX } = this.getActiveSheetScrollInfo();
|
|
45733
45735
|
this.setSheetViewOffset(scrollX, offset);
|
|
45734
45736
|
const { anchor } = this.getters.getSelection();
|
|
45735
|
-
|
|
45736
|
-
|
|
45737
|
+
if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
|
|
45738
|
+
const deltaRow = this.getMainInternalViewport(sheetId).top - top;
|
|
45739
|
+
this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
|
|
45740
|
+
}
|
|
45737
45741
|
}
|
|
45738
45742
|
getVisibleFigures() {
|
|
45739
45743
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -49990,8 +49994,7 @@
|
|
|
49990
49994
|
attrs.push(["t", "b"]);
|
|
49991
49995
|
}
|
|
49992
49996
|
else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
|
|
49993
|
-
|
|
49994
|
-
value = id.toString();
|
|
49997
|
+
value = pushElement(content, sharedStrings);
|
|
49995
49998
|
attrs.push(["t", "s"]);
|
|
49996
49999
|
}
|
|
49997
50000
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -50116,8 +50119,7 @@
|
|
|
50116
50119
|
if (rule.style.fillColor) {
|
|
50117
50120
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
50118
50121
|
}
|
|
50119
|
-
|
|
50120
|
-
ruleAttributes.push(["dxfId", id]);
|
|
50122
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
50121
50123
|
return escapeXml /*xml*/ `
|
|
50122
50124
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
50123
50125
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -50926,7 +50928,7 @@
|
|
|
50926
50928
|
*/
|
|
50927
50929
|
function getXLSX(data) {
|
|
50928
50930
|
const files = [];
|
|
50929
|
-
const construct = getDefaultXLSXStructure();
|
|
50931
|
+
const construct = getDefaultXLSXStructure(data);
|
|
50930
50932
|
files.push(createWorkbook(data, construct));
|
|
50931
50933
|
files.push(...createWorksheets(data, construct));
|
|
50932
50934
|
files.push(createStylesSheet(construct));
|
|
@@ -51783,9 +51785,9 @@
|
|
|
51783
51785
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51784
51786
|
|
|
51785
51787
|
|
|
51786
|
-
__info__.version = '16.4.
|
|
51787
|
-
__info__.date = '2024-04-
|
|
51788
|
-
__info__.hash = '
|
|
51788
|
+
__info__.version = '16.4.29';
|
|
51789
|
+
__info__.date = '2024-04-10T12:19:13.935Z';
|
|
51790
|
+
__info__.hash = 'c022445';
|
|
51789
51791
|
|
|
51790
51792
|
|
|
51791
51793
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|