@odoo/o-spreadsheet 16.2.9 → 16.2.10
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 +48 -37
- package/dist/o-spreadsheet.d.ts +163 -161
- package/dist/o-spreadsheet.esm.js +48 -37
- package/dist/o-spreadsheet.iife.js +48 -37
- package/dist/o-spreadsheet.iife.min.js +243 -242
- package/package.json +4 -4
|
@@ -711,12 +711,20 @@ function getDefaultCellHeight(cell) {
|
|
|
711
711
|
return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
|
|
712
712
|
}
|
|
713
713
|
function computeTextWidth(context, text, style) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
714
|
+
const font = computeTextFont(style);
|
|
715
|
+
if (!textWidthCache[font]) {
|
|
716
|
+
textWidthCache[font] = {};
|
|
717
|
+
}
|
|
718
|
+
if (textWidthCache[font][text] === undefined) {
|
|
719
|
+
context.save();
|
|
720
|
+
context.font = font;
|
|
721
|
+
const textWidth = context.measureText(text).width;
|
|
722
|
+
context.restore();
|
|
723
|
+
textWidthCache[font][text] = textWidth;
|
|
724
|
+
}
|
|
725
|
+
return textWidthCache[font][text];
|
|
719
726
|
}
|
|
727
|
+
const textWidthCache = {};
|
|
720
728
|
function fontSizeInPixels(fontSize) {
|
|
721
729
|
return Math.round((fontSize * 96) / 72);
|
|
722
730
|
}
|
|
@@ -29131,7 +29139,14 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29131
29139
|
this.history.update("tables", filterTables);
|
|
29132
29140
|
break;
|
|
29133
29141
|
case "DUPLICATE_SHEET":
|
|
29134
|
-
|
|
29142
|
+
const tables = {};
|
|
29143
|
+
for (const filterTable of Object.values(this.tables[cmd.sheetId] || {})) {
|
|
29144
|
+
if (filterTable) {
|
|
29145
|
+
const newFilterTable = deepCopy(filterTable);
|
|
29146
|
+
tables[newFilterTable.id] = newFilterTable;
|
|
29147
|
+
}
|
|
29148
|
+
}
|
|
29149
|
+
this.history.update("tables", cmd.sheetIdTo, tables);
|
|
29135
29150
|
break;
|
|
29136
29151
|
case "ADD_COLUMNS_ROWS":
|
|
29137
29152
|
this.onAddColumnsRows(cmd);
|
|
@@ -32708,6 +32723,7 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
32708
32723
|
}
|
|
32709
32724
|
exportForExcel(data) {
|
|
32710
32725
|
for (const sheetData of data.sheets) {
|
|
32726
|
+
const sheetId = sheetData.id;
|
|
32711
32727
|
for (const tableData of sheetData.filterTables) {
|
|
32712
32728
|
const tableZone = toZone(tableData.range);
|
|
32713
32729
|
const filters = [];
|
|
@@ -32723,20 +32739,20 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
32723
32739
|
if (!filter)
|
|
32724
32740
|
continue;
|
|
32725
32741
|
const valuesInFilterZone = filter.filteredZone
|
|
32726
|
-
? positions(filter.filteredZone)
|
|
32727
|
-
.map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId: sheetData.id, col, row }))
|
|
32728
|
-
.filter((cell) => cell.type !== CellValueType.empty)
|
|
32729
|
-
.map((cell) => cell.formattedValue)
|
|
32742
|
+
? positions(filter.filteredZone).map((position) => this.getters.getEvaluatedCell({ sheetId, ...position }).formattedValue)
|
|
32730
32743
|
: [];
|
|
32731
|
-
|
|
32732
|
-
|
|
32733
|
-
|
|
32734
|
-
|
|
32735
|
-
|
|
32736
|
-
|
|
32737
|
-
|
|
32738
|
-
|
|
32739
|
-
|
|
32744
|
+
if (filteredValues.length) {
|
|
32745
|
+
const xlsxDisplayedValues = valuesInFilterZone
|
|
32746
|
+
.filter((val) => val)
|
|
32747
|
+
.filter((val) => !filteredValues.includes(val));
|
|
32748
|
+
filters.push({
|
|
32749
|
+
colId: i,
|
|
32750
|
+
displayedValues: [...new Set(xlsxDisplayedValues)],
|
|
32751
|
+
displayBlanks: !filteredValues.includes("") && valuesInFilterZone.some((val) => !val),
|
|
32752
|
+
});
|
|
32753
|
+
}
|
|
32754
|
+
// In xlsx, filter header should ALWAYS be a string and should be unique in the table
|
|
32755
|
+
const headerPosition = { col: filter.col, row: filter.zoneWithHeaders.top, sheetId };
|
|
32740
32756
|
const headerString = this.getters.getEvaluatedCell(headerPosition).formattedValue;
|
|
32741
32757
|
const headerName = this.getUniqueColNameForExcel(i, headerString, headerNames);
|
|
32742
32758
|
headerNames.push(headerName);
|
|
@@ -35765,15 +35781,15 @@ SelectionInputPlugin.getters = [];
|
|
|
35765
35781
|
* This plugin handles this internal state.
|
|
35766
35782
|
*/
|
|
35767
35783
|
class SelectionInputsManagerPlugin extends UIPlugin {
|
|
35784
|
+
get currentInput() {
|
|
35785
|
+
return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
|
|
35786
|
+
}
|
|
35768
35787
|
constructor(config) {
|
|
35769
35788
|
super(config);
|
|
35770
35789
|
this.config = config;
|
|
35771
35790
|
this.inputs = {};
|
|
35772
35791
|
this.focusedInputId = null;
|
|
35773
35792
|
}
|
|
35774
|
-
get currentInput() {
|
|
35775
|
-
return this.focusedInputId ? this.inputs[this.focusedInputId] : null;
|
|
35776
|
-
}
|
|
35777
35793
|
// ---------------------------------------------------------------------------
|
|
35778
35794
|
// Command Handling
|
|
35779
35795
|
// ---------------------------------------------------------------------------
|
|
@@ -40849,11 +40865,9 @@ TopBarComposer.props = {
|
|
|
40849
40865
|
onComposerContentFocused: Function,
|
|
40850
40866
|
};
|
|
40851
40867
|
|
|
40852
|
-
// -----------------------------------------------------------------------------
|
|
40853
|
-
// TopBar
|
|
40854
|
-
// -----------------------------------------------------------------------------
|
|
40855
40868
|
css /* scss */ `
|
|
40856
40869
|
.o-font-size-editor {
|
|
40870
|
+
height: calc(100% - 4px);
|
|
40857
40871
|
input.o-font-size {
|
|
40858
40872
|
height: 20px;
|
|
40859
40873
|
width: 23px;
|
|
@@ -40931,6 +40945,7 @@ FontSizeEditor.components = {};
|
|
|
40931
40945
|
FontSizeEditor.props = {
|
|
40932
40946
|
onToggle: Function,
|
|
40933
40947
|
dropdownStyle: String,
|
|
40948
|
+
class: String,
|
|
40934
40949
|
};
|
|
40935
40950
|
|
|
40936
40951
|
const FORMATS = [
|
|
@@ -44374,15 +44389,10 @@ function addAutoFilter(table) {
|
|
|
44374
44389
|
`;
|
|
44375
44390
|
}
|
|
44376
44391
|
function addFilterColumns(table) {
|
|
44377
|
-
const tableZone = toZone(table.range);
|
|
44378
44392
|
const columns = [];
|
|
44379
|
-
for (const
|
|
44380
|
-
const filter = table.filters[i];
|
|
44381
|
-
if (!filter || !filter.filteredValues.length) {
|
|
44382
|
-
continue;
|
|
44383
|
-
}
|
|
44393
|
+
for (const filter of table.filters) {
|
|
44384
44394
|
const colXml = escapeXml /*xml*/ `
|
|
44385
|
-
<filterColumn ${formatAttributes([["colId",
|
|
44395
|
+
<filterColumn ${formatAttributes([["colId", filter.colId]])}>
|
|
44386
44396
|
${addFilter(filter)}
|
|
44387
44397
|
</filterColumn>
|
|
44388
44398
|
`;
|
|
@@ -44391,9 +44401,10 @@ function addFilterColumns(table) {
|
|
|
44391
44401
|
return columns;
|
|
44392
44402
|
}
|
|
44393
44403
|
function addFilter(filter) {
|
|
44394
|
-
const filterValues = filter.
|
|
44404
|
+
const filterValues = filter.displayedValues.map((val) => escapeXml /*xml*/ `<filter ${formatAttributes([["val", val]])}/>`);
|
|
44405
|
+
const filterAttributes = filter.displayBlanks ? [["blank", 1]] : [];
|
|
44395
44406
|
return escapeXml /*xml*/ `
|
|
44396
|
-
<filters>
|
|
44407
|
+
<filters ${formatAttributes(filterAttributes)}>
|
|
44397
44408
|
${joinXmlNodes(filterValues)}
|
|
44398
44409
|
</filters>
|
|
44399
44410
|
`;
|
|
@@ -45368,6 +45379,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
45368
45379
|
exports.tokenize = tokenize;
|
|
45369
45380
|
|
|
45370
45381
|
|
|
45371
|
-
__info__.version = '16.2.
|
|
45372
|
-
__info__.date = '2023-06-
|
|
45373
|
-
__info__.hash = '
|
|
45382
|
+
__info__.version = '16.2.10';
|
|
45383
|
+
__info__.date = '2023-06-26T14:33:27.213Z';
|
|
45384
|
+
__info__.hash = '1d3f47c';
|