@odoo/o-spreadsheet 16.3.3 → 16.3.4
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 +77 -50
- package/dist/o-spreadsheet.d.ts +168 -165
- package/dist/o-spreadsheet.esm.js +77 -50
- package/dist/o-spreadsheet.iife.js +77 -50
- package/dist/o-spreadsheet.iife.min.js +263 -262
- package/package.json +4 -4
|
@@ -754,12 +754,20 @@ function getDefaultCellHeight(cell) {
|
|
|
754
754
|
return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
|
|
755
755
|
}
|
|
756
756
|
function computeTextWidth(context, text, style) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
757
|
+
const font = computeTextFont(style);
|
|
758
|
+
if (!textWidthCache[font]) {
|
|
759
|
+
textWidthCache[font] = {};
|
|
760
|
+
}
|
|
761
|
+
if (textWidthCache[font][text] === undefined) {
|
|
762
|
+
context.save();
|
|
763
|
+
context.font = font;
|
|
764
|
+
const textWidth = context.measureText(text).width;
|
|
765
|
+
context.restore();
|
|
766
|
+
textWidthCache[font][text] = textWidth;
|
|
767
|
+
}
|
|
768
|
+
return textWidthCache[font][text];
|
|
762
769
|
}
|
|
770
|
+
const textWidthCache = {};
|
|
763
771
|
function fontSizeInPixels(fontSize) {
|
|
764
772
|
return Math.round((fontSize * 96) / 72);
|
|
765
773
|
}
|
|
@@ -9519,9 +9527,9 @@ const ARG_TYPES = [
|
|
|
9519
9527
|
"META",
|
|
9520
9528
|
];
|
|
9521
9529
|
function arg(definition, description = "") {
|
|
9522
|
-
return makeArg(
|
|
9530
|
+
return makeArg(definition, description);
|
|
9523
9531
|
}
|
|
9524
|
-
function makeArg(str) {
|
|
9532
|
+
function makeArg(str, description) {
|
|
9525
9533
|
let parts = str.match(ARG_REGEXP);
|
|
9526
9534
|
let name = parts[1].trim();
|
|
9527
9535
|
let types = [];
|
|
@@ -9551,7 +9559,6 @@ function makeArg(str) {
|
|
|
9551
9559
|
defaultValue = param.trim().slice(8);
|
|
9552
9560
|
}
|
|
9553
9561
|
}
|
|
9554
|
-
let description = parts[3].trim();
|
|
9555
9562
|
const result = {
|
|
9556
9563
|
name,
|
|
9557
9564
|
description,
|
|
@@ -20932,6 +20939,7 @@ class Composer extends owl.Component {
|
|
|
20932
20939
|
(this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
|
|
20933
20940
|
}
|
|
20934
20941
|
}
|
|
20942
|
+
this.updateCursorIfNeeded();
|
|
20935
20943
|
}
|
|
20936
20944
|
processTabKey(ev) {
|
|
20937
20945
|
ev.preventDefault();
|
|
@@ -21000,10 +21008,12 @@ class Composer extends owl.Component {
|
|
|
21000
21008
|
}
|
|
21001
21009
|
else {
|
|
21002
21010
|
ev.stopPropagation();
|
|
21011
|
+
this.updateCursorIfNeeded();
|
|
21003
21012
|
}
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21013
|
+
}
|
|
21014
|
+
updateCursorIfNeeded() {
|
|
21015
|
+
if (!this.env.model.getters.isSelectingForComposer()) {
|
|
21016
|
+
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
21007
21017
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
21008
21018
|
this.isKeyStillDown = true;
|
|
21009
21019
|
}
|
|
@@ -21061,7 +21071,12 @@ class Composer extends owl.Component {
|
|
|
21061
21071
|
};
|
|
21062
21072
|
});
|
|
21063
21073
|
if (searchTerm) {
|
|
21064
|
-
|
|
21074
|
+
if (searchTerm.toLowerCase() === "true" || searchTerm.toLowerCase() === "false") {
|
|
21075
|
+
values = [];
|
|
21076
|
+
}
|
|
21077
|
+
else {
|
|
21078
|
+
values = fuzzyLookup(searchTerm, values, (t) => t.text);
|
|
21079
|
+
}
|
|
21065
21080
|
}
|
|
21066
21081
|
else {
|
|
21067
21082
|
// alphabetical order
|
|
@@ -30644,7 +30659,14 @@ class FiltersPlugin extends CorePlugin {
|
|
|
30644
30659
|
this.history.update("tables", filterTables);
|
|
30645
30660
|
break;
|
|
30646
30661
|
case "DUPLICATE_SHEET":
|
|
30647
|
-
|
|
30662
|
+
const tables = {};
|
|
30663
|
+
for (const filterTable of Object.values(this.tables[cmd.sheetId] || {})) {
|
|
30664
|
+
if (filterTable) {
|
|
30665
|
+
const newFilterTable = deepCopy(filterTable);
|
|
30666
|
+
tables[newFilterTable.id] = newFilterTable;
|
|
30667
|
+
}
|
|
30668
|
+
}
|
|
30669
|
+
this.history.update("tables", cmd.sheetIdTo, tables);
|
|
30648
30670
|
break;
|
|
30649
30671
|
case "ADD_COLUMNS_ROWS":
|
|
30650
30672
|
this.onAddColumnsRows(cmd);
|
|
@@ -34193,6 +34215,7 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
34193
34215
|
}
|
|
34194
34216
|
exportForExcel(data) {
|
|
34195
34217
|
for (const sheetData of data.sheets) {
|
|
34218
|
+
const sheetId = sheetData.id;
|
|
34196
34219
|
for (const tableData of sheetData.filterTables) {
|
|
34197
34220
|
const tableZone = toZone(tableData.range);
|
|
34198
34221
|
const filters = [];
|
|
@@ -34208,20 +34231,20 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
34208
34231
|
if (!filter)
|
|
34209
34232
|
continue;
|
|
34210
34233
|
const valuesInFilterZone = filter.filteredZone
|
|
34211
|
-
? positions(filter.filteredZone)
|
|
34212
|
-
.map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId: sheetData.id, col, row }))
|
|
34213
|
-
.filter((cell) => cell.type !== CellValueType.empty)
|
|
34214
|
-
.map((cell) => cell.formattedValue)
|
|
34234
|
+
? positions(filter.filteredZone).map((position) => this.getters.getEvaluatedCell({ sheetId, ...position }).formattedValue)
|
|
34215
34235
|
: [];
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
|
|
34236
|
+
if (filteredValues.length) {
|
|
34237
|
+
const xlsxDisplayedValues = valuesInFilterZone
|
|
34238
|
+
.filter((val) => val)
|
|
34239
|
+
.filter((val) => !filteredValues.includes(val));
|
|
34240
|
+
filters.push({
|
|
34241
|
+
colId: i,
|
|
34242
|
+
displayedValues: [...new Set(xlsxDisplayedValues)],
|
|
34243
|
+
displayBlanks: !filteredValues.includes("") && valuesInFilterZone.some((val) => !val),
|
|
34244
|
+
});
|
|
34245
|
+
}
|
|
34246
|
+
// In xlsx, filter header should ALWAYS be a string and should be unique in the table
|
|
34247
|
+
const headerPosition = { col: filter.col, row: filter.zoneWithHeaders.top, sheetId };
|
|
34225
34248
|
const headerString = this.getters.getEvaluatedCell(headerPosition).formattedValue;
|
|
34226
34249
|
const headerName = this.getUniqueColNameForExcel(i, headerString, headerNames);
|
|
34227
34250
|
headerNames.push(headerName);
|
|
@@ -43293,11 +43316,9 @@ TopBarComposer.props = {
|
|
|
43293
43316
|
onComposerContentFocused: Function,
|
|
43294
43317
|
};
|
|
43295
43318
|
|
|
43296
|
-
// -----------------------------------------------------------------------------
|
|
43297
|
-
// TopBar
|
|
43298
|
-
// -----------------------------------------------------------------------------
|
|
43299
43319
|
css /* scss */ `
|
|
43300
43320
|
.o-font-size-editor {
|
|
43321
|
+
height: calc(100% - 4px);
|
|
43301
43322
|
input.o-font-size {
|
|
43302
43323
|
outline-color: ${SELECTION_BORDER_COLOR};
|
|
43303
43324
|
height: 20px;
|
|
@@ -43310,13 +43331,13 @@ css /* scss */ `
|
|
|
43310
43331
|
input::-webkit-inner-spin-button {
|
|
43311
43332
|
-webkit-appearance: none;
|
|
43312
43333
|
}
|
|
43313
|
-
|
|
43314
|
-
|
|
43315
|
-
|
|
43316
|
-
|
|
43317
|
-
|
|
43318
|
-
|
|
43319
|
-
|
|
43334
|
+
}
|
|
43335
|
+
.o-text-options > div {
|
|
43336
|
+
cursor: pointer;
|
|
43337
|
+
line-height: 26px;
|
|
43338
|
+
padding: 3px 12px;
|
|
43339
|
+
&:hover {
|
|
43340
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
43320
43341
|
}
|
|
43321
43342
|
}
|
|
43322
43343
|
`;
|
|
@@ -43381,6 +43402,7 @@ class FontSizeEditor extends owl.Component {
|
|
|
43381
43402
|
FontSizeEditor.props = {
|
|
43382
43403
|
onToggle: Function,
|
|
43383
43404
|
dropdownStyle: String,
|
|
43405
|
+
class: String,
|
|
43384
43406
|
};
|
|
43385
43407
|
|
|
43386
43408
|
// -----------------------------------------------------------------------------
|
|
@@ -46549,15 +46571,10 @@ function addAutoFilter(table) {
|
|
|
46549
46571
|
`;
|
|
46550
46572
|
}
|
|
46551
46573
|
function addFilterColumns(table) {
|
|
46552
|
-
const tableZone = toZone(table.range);
|
|
46553
46574
|
const columns = [];
|
|
46554
|
-
for (const
|
|
46555
|
-
const filter = table.filters[i];
|
|
46556
|
-
if (!filter || !filter.filteredValues.length) {
|
|
46557
|
-
continue;
|
|
46558
|
-
}
|
|
46575
|
+
for (const filter of table.filters) {
|
|
46559
46576
|
const colXml = escapeXml /*xml*/ `
|
|
46560
|
-
<filterColumn ${formatAttributes([["colId",
|
|
46577
|
+
<filterColumn ${formatAttributes([["colId", filter.colId]])}>
|
|
46561
46578
|
${addFilter(filter)}
|
|
46562
46579
|
</filterColumn>
|
|
46563
46580
|
`;
|
|
@@ -46566,9 +46583,10 @@ function addFilterColumns(table) {
|
|
|
46566
46583
|
return columns;
|
|
46567
46584
|
}
|
|
46568
46585
|
function addFilter(filter) {
|
|
46569
|
-
const filterValues = filter.
|
|
46586
|
+
const filterValues = filter.displayedValues.map((val) => escapeXml /*xml*/ `<filter ${formatAttributes([["val", val]])}/>`);
|
|
46587
|
+
const filterAttributes = filter.displayBlanks ? [["blank", 1]] : [];
|
|
46570
46588
|
return escapeXml /*xml*/ `
|
|
46571
|
-
<filters>
|
|
46589
|
+
<filters ${formatAttributes(filterAttributes)}>
|
|
46572
46590
|
${joinXmlNodes(filterValues)}
|
|
46573
46591
|
</filters>
|
|
46574
46592
|
`;
|
|
@@ -46687,8 +46705,13 @@ function addHyperlinks(construct, data, sheetIndex) {
|
|
|
46687
46705
|
const sheetId = parseSheetUrl(url);
|
|
46688
46706
|
const sheet = data.sheets.find((sheet) => sheet.id === sheetId);
|
|
46689
46707
|
const location = sheet ? `${sheet.name}!A1` : INCORRECT_RANGE_STRING;
|
|
46708
|
+
const hyperlinkAttributes = [
|
|
46709
|
+
["display", label],
|
|
46710
|
+
["location", location],
|
|
46711
|
+
["ref", xc],
|
|
46712
|
+
];
|
|
46690
46713
|
linkNodes.push(escapeXml /*xml*/ `
|
|
46691
|
-
<hyperlink
|
|
46714
|
+
<hyperlink ${formatAttributes(hyperlinkAttributes)}/>
|
|
46692
46715
|
`);
|
|
46693
46716
|
}
|
|
46694
46717
|
else {
|
|
@@ -46697,8 +46720,12 @@ function addHyperlinks(construct, data, sheetIndex) {
|
|
|
46697
46720
|
type: XLSX_RELATION_TYPE.hyperlink,
|
|
46698
46721
|
targetMode: "External",
|
|
46699
46722
|
});
|
|
46723
|
+
const hyperlinkAttributes = [
|
|
46724
|
+
["r:id", linkRelId],
|
|
46725
|
+
["ref", xc],
|
|
46726
|
+
];
|
|
46700
46727
|
linkNodes.push(escapeXml /*xml*/ `
|
|
46701
|
-
<hyperlink
|
|
46728
|
+
<hyperlink ${formatAttributes(hyperlinkAttributes)}/>
|
|
46702
46729
|
`);
|
|
46703
46730
|
}
|
|
46704
46731
|
}
|
|
@@ -47606,6 +47633,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
47606
47633
|
exports.tokenize = tokenize;
|
|
47607
47634
|
|
|
47608
47635
|
|
|
47609
|
-
__info__.version = '16.3.
|
|
47610
|
-
__info__.date = '2023-06-
|
|
47611
|
-
__info__.hash = '
|
|
47636
|
+
__info__.version = '16.3.4';
|
|
47637
|
+
__info__.date = '2023-06-26T14:34:27.019Z';
|
|
47638
|
+
__info__.hash = '94f9dcd';
|