@odoo/o-spreadsheet 16.3.31 → 16.3.33
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 +82 -84
- package/dist/o-spreadsheet.d.ts +3 -6
- package/dist/o-spreadsheet.esm.js +82 -84
- package/dist/o-spreadsheet.iife.js +82 -84
- package/dist/o-spreadsheet.iife.min.js +177 -177
- package/dist/o_spreadsheet.xml +6 -5
- package/package.json +1 -1
|
@@ -1124,7 +1124,7 @@
|
|
|
1124
1124
|
if (typeof o1 !== typeof o2)
|
|
1125
1125
|
return false;
|
|
1126
1126
|
if (typeof o1 !== "object")
|
|
1127
|
-
return
|
|
1127
|
+
return false;
|
|
1128
1128
|
// Objects can have different keys if the values are undefined
|
|
1129
1129
|
const keys = new Set();
|
|
1130
1130
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -6283,6 +6283,7 @@
|
|
|
6283
6283
|
this.save();
|
|
6284
6284
|
}
|
|
6285
6285
|
ev.stopPropagation();
|
|
6286
|
+
ev.preventDefault();
|
|
6286
6287
|
break;
|
|
6287
6288
|
case "Escape":
|
|
6288
6289
|
this.cancel();
|
|
@@ -9471,9 +9472,12 @@
|
|
|
9471
9472
|
// Filters action
|
|
9472
9473
|
//------------------------------------------------------------------------------
|
|
9473
9474
|
const FILTERS_CREATE_FILTER_TABLE = (env) => {
|
|
9475
|
+
const zones = env.model.getters.getSelectedZones();
|
|
9476
|
+
if (zones.length === 1 && getZoneArea(zones[0]) === 1) {
|
|
9477
|
+
env.model.selection.selectTableAroundSelection();
|
|
9478
|
+
}
|
|
9474
9479
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
9475
|
-
|
|
9476
|
-
interactiveAddFilter(env, sheetId, selection);
|
|
9480
|
+
interactiveAddFilter(env, sheetId, env.model.getters.getSelectedZones());
|
|
9477
9481
|
};
|
|
9478
9482
|
const FILTERS_REMOVE_FILTER_TABLE = (env) => {
|
|
9479
9483
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
@@ -21337,6 +21341,11 @@
|
|
|
21337
21341
|
onBlur() {
|
|
21338
21342
|
this.isKeyStillDown = false;
|
|
21339
21343
|
}
|
|
21344
|
+
onContextMenu(ev) {
|
|
21345
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
21346
|
+
this.props.onInputContextMenu?.(ev);
|
|
21347
|
+
}
|
|
21348
|
+
}
|
|
21340
21349
|
// ---------------------------------------------------------------------------
|
|
21341
21350
|
// Private
|
|
21342
21351
|
// ---------------------------------------------------------------------------
|
|
@@ -21558,6 +21567,7 @@
|
|
|
21558
21567
|
onComposerCellFocused: { type: Function, optional: true },
|
|
21559
21568
|
onComposerContentFocused: Function,
|
|
21560
21569
|
isDefaultFocus: { type: Boolean, optional: true },
|
|
21570
|
+
onInputContextMenu: { type: Function, optional: true },
|
|
21561
21571
|
};
|
|
21562
21572
|
|
|
21563
21573
|
const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
|
|
@@ -21634,6 +21644,7 @@
|
|
|
21634
21644
|
isDefaultFocus: true,
|
|
21635
21645
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
21636
21646
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
21647
|
+
onInputContextMenu: this.props.onInputContextMenu,
|
|
21637
21648
|
};
|
|
21638
21649
|
}
|
|
21639
21650
|
get containerStyle() {
|
|
@@ -21722,6 +21733,7 @@
|
|
|
21722
21733
|
onComposerContentFocused: Function,
|
|
21723
21734
|
gridDims: Object,
|
|
21724
21735
|
onComposerCellFocused: Function,
|
|
21736
|
+
onInputContextMenu: Function,
|
|
21725
21737
|
};
|
|
21726
21738
|
|
|
21727
21739
|
const CSS$1 = css /* scss */ `
|
|
@@ -24057,8 +24069,8 @@
|
|
|
24057
24069
|
else if (this.env.model.getters.getActiveRows().has(row)) {
|
|
24058
24070
|
type = "ROW";
|
|
24059
24071
|
}
|
|
24060
|
-
const { x, y, width
|
|
24061
|
-
this.toggleContextMenu(type, x + width, y +
|
|
24072
|
+
const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
|
|
24073
|
+
this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
|
|
24062
24074
|
}
|
|
24063
24075
|
onCellRightClicked(col, row, { x, y }) {
|
|
24064
24076
|
const zones = this.env.model.getters.getSelectedZones();
|
|
@@ -26385,29 +26397,12 @@
|
|
|
26385
26397
|
return width;
|
|
26386
26398
|
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
|
26387
26399
|
}
|
|
26388
|
-
function convertBorderDescr(descr) {
|
|
26389
|
-
if (!descr) {
|
|
26390
|
-
return undefined;
|
|
26391
|
-
}
|
|
26392
|
-
return {
|
|
26393
|
-
style: descr.style,
|
|
26394
|
-
color: { rgb: descr.color },
|
|
26395
|
-
};
|
|
26396
|
-
}
|
|
26397
26400
|
function extractStyle(cell, data) {
|
|
26398
26401
|
let style = {};
|
|
26399
26402
|
if (cell.style) {
|
|
26400
26403
|
style = data.styles[cell.style];
|
|
26401
26404
|
}
|
|
26402
26405
|
const format = extractFormat(cell, data);
|
|
26403
|
-
const exportedBorder = {};
|
|
26404
|
-
if (cell.border) {
|
|
26405
|
-
const border = data.borders[cell.border];
|
|
26406
|
-
exportedBorder.left = convertBorderDescr(border.left);
|
|
26407
|
-
exportedBorder.right = convertBorderDescr(border.right);
|
|
26408
|
-
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
|
26409
|
-
exportedBorder.top = convertBorderDescr(border.top);
|
|
26410
|
-
}
|
|
26411
26406
|
const styles = {
|
|
26412
26407
|
font: {
|
|
26413
26408
|
size: style?.fontSize || DEFAULT_FONT_SIZE,
|
|
@@ -26421,7 +26416,7 @@
|
|
|
26421
26416
|
}
|
|
26422
26417
|
: { reservedAttribute: "none" },
|
|
26423
26418
|
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
|
26424
|
-
border:
|
|
26419
|
+
border: cell.border || 0,
|
|
26425
26420
|
alignment: {
|
|
26426
26421
|
horizontal: style.align,
|
|
26427
26422
|
vertical: style.verticalAlign
|
|
@@ -26453,15 +26448,12 @@
|
|
|
26453
26448
|
return undefined;
|
|
26454
26449
|
}
|
|
26455
26450
|
function normalizeStyle(construct, styles) {
|
|
26456
|
-
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
|
26457
|
-
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
|
26458
|
-
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
|
26459
26451
|
// Normalize this
|
|
26460
26452
|
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
|
26461
26453
|
const style = {
|
|
26462
|
-
fontId,
|
|
26463
|
-
fillId,
|
|
26464
|
-
borderId,
|
|
26454
|
+
fontId: pushElement(styles.font, construct.fonts),
|
|
26455
|
+
fillId: pushElement(styles.fill, construct.fills),
|
|
26456
|
+
borderId: styles.border,
|
|
26465
26457
|
numFmtId,
|
|
26466
26458
|
alignment: {
|
|
26467
26459
|
vertical: styles.alignment.vertical,
|
|
@@ -26469,8 +26461,7 @@
|
|
|
26469
26461
|
wrapText: styles.alignment.wrapText,
|
|
26470
26462
|
},
|
|
26471
26463
|
};
|
|
26472
|
-
|
|
26473
|
-
return id;
|
|
26464
|
+
return pushElement(style, construct.styles);
|
|
26474
26465
|
}
|
|
26475
26466
|
function convertFormat(format, numFmtStructure) {
|
|
26476
26467
|
if (!format) {
|
|
@@ -26478,8 +26469,7 @@
|
|
|
26478
26469
|
}
|
|
26479
26470
|
let formatId = XLSX_FORMAT_MAP[format.format];
|
|
26480
26471
|
if (!formatId) {
|
|
26481
|
-
|
|
26482
|
-
formatId = id + FIRST_NUMFMT_ID;
|
|
26472
|
+
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
|
26483
26473
|
}
|
|
26484
26474
|
return formatId;
|
|
26485
26475
|
}
|
|
@@ -26504,20 +26494,15 @@
|
|
|
26504
26494
|
return id;
|
|
26505
26495
|
}
|
|
26506
26496
|
function pushElement(property, propertyList) {
|
|
26507
|
-
|
|
26508
|
-
|
|
26509
|
-
|
|
26497
|
+
let len = propertyList.length;
|
|
26498
|
+
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
|
26499
|
+
for (let i = 0; i < len; i++) {
|
|
26500
|
+
if (operator(property, propertyList[i])) {
|
|
26501
|
+
return i;
|
|
26510
26502
|
}
|
|
26511
26503
|
}
|
|
26512
|
-
|
|
26513
|
-
|
|
26514
|
-
propertyList.push(property);
|
|
26515
|
-
elemId = propertyList.length - 1;
|
|
26516
|
-
}
|
|
26517
|
-
return {
|
|
26518
|
-
id: elemId,
|
|
26519
|
-
list: propertyList,
|
|
26520
|
-
};
|
|
26504
|
+
propertyList[propertyList.length] = property;
|
|
26505
|
+
return propertyList.length - 1;
|
|
26521
26506
|
}
|
|
26522
26507
|
const chartIds = [];
|
|
26523
26508
|
/**
|
|
@@ -27223,7 +27208,25 @@
|
|
|
27223
27208
|
}
|
|
27224
27209
|
return document;
|
|
27225
27210
|
}
|
|
27226
|
-
function
|
|
27211
|
+
function convertBorderDescr(descr) {
|
|
27212
|
+
if (!descr) {
|
|
27213
|
+
return undefined;
|
|
27214
|
+
}
|
|
27215
|
+
return {
|
|
27216
|
+
style: descr.style,
|
|
27217
|
+
color: { rgb: descr.color },
|
|
27218
|
+
};
|
|
27219
|
+
}
|
|
27220
|
+
function getDefaultXLSXStructure(data) {
|
|
27221
|
+
const xlsxBorders = Object.values(data.borders).map((border) => {
|
|
27222
|
+
return {
|
|
27223
|
+
left: convertBorderDescr(border.left),
|
|
27224
|
+
right: convertBorderDescr(border.right),
|
|
27225
|
+
bottom: convertBorderDescr(border.bottom),
|
|
27226
|
+
top: convertBorderDescr(border.top),
|
|
27227
|
+
};
|
|
27228
|
+
});
|
|
27229
|
+
const borders = [{}, ...xlsxBorders];
|
|
27227
27230
|
return {
|
|
27228
27231
|
relsFiles: [],
|
|
27229
27232
|
sharedStrings: [],
|
|
@@ -27246,7 +27249,7 @@
|
|
|
27246
27249
|
},
|
|
27247
27250
|
],
|
|
27248
27251
|
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
|
27249
|
-
borders
|
|
27252
|
+
borders,
|
|
27250
27253
|
numFmts: [],
|
|
27251
27254
|
dxfs: [],
|
|
27252
27255
|
};
|
|
@@ -31197,7 +31200,17 @@
|
|
|
31197
31200
|
}
|
|
31198
31201
|
}
|
|
31199
31202
|
exportForExcel(data) {
|
|
31200
|
-
|
|
31203
|
+
for (const sheet of data.sheets) {
|
|
31204
|
+
for (const filterTable of this.getFilterTables(sheet.id)) {
|
|
31205
|
+
if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
|
|
31206
|
+
continue;
|
|
31207
|
+
}
|
|
31208
|
+
sheet.filterTables.push({
|
|
31209
|
+
range: zoneToXc(filterTable.zone),
|
|
31210
|
+
filters: [],
|
|
31211
|
+
});
|
|
31212
|
+
}
|
|
31213
|
+
}
|
|
31201
31214
|
}
|
|
31202
31215
|
}
|
|
31203
31216
|
|
|
@@ -35065,12 +35078,13 @@
|
|
|
35065
35078
|
case "AlterZone":
|
|
35066
35079
|
break;
|
|
35067
35080
|
case "ZonesSelected":
|
|
35081
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
35068
35082
|
let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
|
|
35069
35083
|
if (event.mode === "updateAnchor") {
|
|
35070
35084
|
const oldZone = event.previousAnchor.zone;
|
|
35071
35085
|
const newZone = event.anchor.zone;
|
|
35072
35086
|
// altering a zone should not move the viewport in a dimension that wasn't changed
|
|
35073
|
-
const { top, bottom, left, right } = this.
|
|
35087
|
+
const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
|
|
35074
35088
|
if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
|
|
35075
35089
|
col = left > col || col > right ? left : col;
|
|
35076
35090
|
}
|
|
@@ -35078,10 +35092,9 @@
|
|
|
35078
35092
|
row = top > row || row > bottom ? top : row;
|
|
35079
35093
|
}
|
|
35080
35094
|
}
|
|
35081
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
35082
35095
|
col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
|
|
35083
35096
|
row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
|
|
35084
|
-
this.refreshViewport(
|
|
35097
|
+
this.refreshViewport(sheetId, { col, row });
|
|
35085
35098
|
break;
|
|
35086
35099
|
}
|
|
35087
35100
|
}
|
|
@@ -35105,16 +35118,16 @@
|
|
|
35105
35118
|
this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
|
|
35106
35119
|
break;
|
|
35107
35120
|
case "SHIFT_VIEWPORT_DOWN":
|
|
35108
|
-
const { top } = this.getActiveMainViewport();
|
|
35109
35121
|
const sheetId = this.getters.getActiveSheetId();
|
|
35110
|
-
const
|
|
35111
|
-
this.
|
|
35122
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
35123
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
35124
|
+
this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
|
|
35112
35125
|
break;
|
|
35113
35126
|
case "SHIFT_VIEWPORT_UP": {
|
|
35114
|
-
const { top } = this.getActiveMainViewport();
|
|
35115
35127
|
const sheetId = this.getters.getActiveSheetId();
|
|
35116
|
-
const
|
|
35117
|
-
this.
|
|
35128
|
+
const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
|
|
35129
|
+
const topRowDims = this.getters.getRowDimensions(sheetId, top);
|
|
35130
|
+
this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
|
|
35118
35131
|
break;
|
|
35119
35132
|
}
|
|
35120
35133
|
case "REMOVE_COLUMNS_ROWS":
|
|
@@ -35476,17 +35489,6 @@
|
|
|
35476
35489
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
35477
35490
|
Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
35478
35491
|
}
|
|
35479
|
-
/**
|
|
35480
|
-
* Clip the vertical offset within the allowed range.
|
|
35481
|
-
* Not above the sheet, nor below the sheet.
|
|
35482
|
-
*/
|
|
35483
|
-
clipOffsetY(offsetY) {
|
|
35484
|
-
const { height } = this.getMainViewportRect();
|
|
35485
|
-
const maxOffset = height - this.sheetViewHeight;
|
|
35486
|
-
offsetY = Math.min(offsetY, maxOffset);
|
|
35487
|
-
offsetY = Math.max(offsetY, 0);
|
|
35488
|
-
return offsetY;
|
|
35489
|
-
}
|
|
35490
35492
|
getViewportOffset(sheetId) {
|
|
35491
35493
|
return {
|
|
35492
35494
|
x: this.viewports[sheetId]?.bottomRight.offsetScrollbarX || 0,
|
|
@@ -35542,12 +35544,15 @@
|
|
|
35542
35544
|
* viewport top.
|
|
35543
35545
|
*/
|
|
35544
35546
|
shiftVertically(offset) {
|
|
35545
|
-
const
|
|
35547
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
35548
|
+
const { top } = this.getMainInternalViewport(sheetId);
|
|
35546
35549
|
const { scrollX } = this.getActiveSheetScrollInfo();
|
|
35547
35550
|
this.setSheetViewOffset(scrollX, offset);
|
|
35548
35551
|
const { anchor } = this.getters.getSelection();
|
|
35549
|
-
|
|
35550
|
-
|
|
35552
|
+
if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
|
|
35553
|
+
const deltaRow = this.getMainInternalViewport(sheetId).top - top;
|
|
35554
|
+
this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
|
|
35555
|
+
}
|
|
35551
35556
|
}
|
|
35552
35557
|
getVisibleFigures() {
|
|
35553
35558
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -43097,7 +43102,6 @@
|
|
|
43097
43102
|
cursor: pointer;
|
|
43098
43103
|
}
|
|
43099
43104
|
`;
|
|
43100
|
-
let tKey = 1;
|
|
43101
43105
|
class SpreadsheetDashboard extends owl.Component {
|
|
43102
43106
|
static template = "o-spreadsheet-SpreadsheetDashboard";
|
|
43103
43107
|
static components = {
|
|
@@ -43175,13 +43179,9 @@
|
|
|
43175
43179
|
coordinates: rect,
|
|
43176
43180
|
position: { col, row },
|
|
43177
43181
|
action,
|
|
43178
|
-
// we can't rely on position only because a row or a column could
|
|
43179
|
-
// be inserted at any time.
|
|
43180
|
-
tKey: `${tKey}-${col}-${row}`,
|
|
43181
43182
|
});
|
|
43182
43183
|
}
|
|
43183
43184
|
}
|
|
43184
|
-
tKey++;
|
|
43185
43185
|
return cells;
|
|
43186
43186
|
}
|
|
43187
43187
|
getClickableAction(position) {
|
|
@@ -46319,8 +46319,7 @@
|
|
|
46319
46319
|
attrs.push(["t", "b"]);
|
|
46320
46320
|
}
|
|
46321
46321
|
else if (forceString || !isNumber(value)) {
|
|
46322
|
-
|
|
46323
|
-
value = id.toString();
|
|
46322
|
+
value = pushElement(content, sharedStrings);
|
|
46324
46323
|
attrs.push(["t", "s"]);
|
|
46325
46324
|
}
|
|
46326
46325
|
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
|
@@ -46445,8 +46444,7 @@
|
|
|
46445
46444
|
if (rule.style.fillColor) {
|
|
46446
46445
|
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
|
46447
46446
|
}
|
|
46448
|
-
|
|
46449
|
-
ruleAttributes.push(["dxfId", id]);
|
|
46447
|
+
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
|
46450
46448
|
return escapeXml /*xml*/ `
|
|
46451
46449
|
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
|
46452
46450
|
<cfRule ${formatAttributes(ruleAttributes)}>
|
|
@@ -47250,7 +47248,7 @@
|
|
|
47250
47248
|
*/
|
|
47251
47249
|
function getXLSX(data) {
|
|
47252
47250
|
const files = [];
|
|
47253
|
-
const construct = getDefaultXLSXStructure();
|
|
47251
|
+
const construct = getDefaultXLSXStructure(data);
|
|
47254
47252
|
files.push(createWorkbook(data, construct));
|
|
47255
47253
|
files.push(...createWorksheets(data, construct));
|
|
47256
47254
|
files.push(createStylesSheet(construct));
|
|
@@ -48093,9 +48091,9 @@
|
|
|
48093
48091
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
48094
48092
|
|
|
48095
48093
|
|
|
48096
|
-
__info__.version = '16.3.
|
|
48097
|
-
__info__.date = '2024-04-
|
|
48098
|
-
__info__.hash = '
|
|
48094
|
+
__info__.version = '16.3.33';
|
|
48095
|
+
__info__.date = '2024-04-18T16:36:40.811Z';
|
|
48096
|
+
__info__.hash = '89f04ea';
|
|
48099
48097
|
|
|
48100
48098
|
|
|
48101
48099
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|