@odoo/o-spreadsheet 16.4.20 → 16.4.21
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 +39 -38
- package/dist/o-spreadsheet.d.ts +3 -2
- package/dist/o-spreadsheet.esm.js +39 -38
- package/dist/o-spreadsheet.iife.js +39 -38
- package/dist/o-spreadsheet.iife.min.js +7 -14
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -15975,14 +15975,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
|
|
|
15975
15975
|
: undefined));
|
|
15976
15976
|
}
|
|
15977
15977
|
}
|
|
15978
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
15979
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
15980
|
-
if (!dataSetsHaveTitle) {
|
|
15981
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
15982
|
-
}
|
|
15983
|
-
}
|
|
15984
15978
|
else {
|
|
15985
|
-
/* 1 row or 1 column */
|
|
15979
|
+
/* 1 cell, 1 row or 1 column */
|
|
15986
15980
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
15987
15981
|
? {
|
|
15988
15982
|
top: zone.top,
|
|
@@ -16031,8 +16025,10 @@ function toExcelDataset(getters, ds) {
|
|
|
16031
16025
|
}
|
|
16032
16026
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
16033
16027
|
return {
|
|
16034
|
-
label: ds.labelCell
|
|
16035
|
-
|
|
16028
|
+
label: ds.labelCell
|
|
16029
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
16030
|
+
: undefined,
|
|
16031
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
16036
16032
|
};
|
|
16037
16033
|
}
|
|
16038
16034
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -16045,7 +16041,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
16045
16041
|
zone.top = zone.top + 1;
|
|
16046
16042
|
}
|
|
16047
16043
|
const range = labelRange.clone({ zone });
|
|
16048
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
16044
|
+
return getters.getRangeString(range, "forceSheetReference", true);
|
|
16049
16045
|
}
|
|
16050
16046
|
/**
|
|
16051
16047
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -16582,7 +16578,7 @@ class BarChart extends AbstractChart {
|
|
|
16582
16578
|
return undefined;
|
|
16583
16579
|
const dataSets = this.dataSets
|
|
16584
16580
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
16585
|
-
.filter((ds) => ds.range !== ""
|
|
16581
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
16586
16582
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
16587
16583
|
return {
|
|
16588
16584
|
...this.getDefinition(),
|
|
@@ -17170,7 +17166,7 @@ class LineChart extends AbstractChart {
|
|
|
17170
17166
|
return undefined;
|
|
17171
17167
|
const dataSets = this.dataSets
|
|
17172
17168
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17173
|
-
.filter((ds) => ds.range !== ""
|
|
17169
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17174
17170
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17175
17171
|
return {
|
|
17176
17172
|
...this.getDefinition(),
|
|
@@ -17457,7 +17453,7 @@ class PieChart extends AbstractChart {
|
|
|
17457
17453
|
return undefined;
|
|
17458
17454
|
const dataSets = this.dataSets
|
|
17459
17455
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17460
|
-
.filter((ds) => ds.range !== ""
|
|
17456
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17461
17457
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17462
17458
|
return {
|
|
17463
17459
|
...this.getDefinition(),
|
|
@@ -31934,6 +31930,10 @@ class CellPlugin extends CorePlugin {
|
|
|
31934
31930
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
31935
31931
|
content: cell.content || undefined,
|
|
31936
31932
|
};
|
|
31933
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
31934
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
31935
|
+
cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
|
|
31936
|
+
}
|
|
31937
31937
|
}
|
|
31938
31938
|
_sheet.cells = cells;
|
|
31939
31939
|
}
|
|
@@ -31968,13 +31968,13 @@ class CellPlugin extends CorePlugin {
|
|
|
31968
31968
|
/*
|
|
31969
31969
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
31970
31970
|
*/
|
|
31971
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
31971
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
31972
31972
|
const ranges = dependencies || cell.dependencies;
|
|
31973
31973
|
let rangeIndex = 0;
|
|
31974
31974
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
31975
31975
|
if (token.type === "REFERENCE") {
|
|
31976
31976
|
const range = ranges[rangeIndex++];
|
|
31977
|
-
return this.getters.getRangeString(range, sheetId);
|
|
31977
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
31978
31978
|
}
|
|
31979
31979
|
return token.value;
|
|
31980
31980
|
}));
|
|
@@ -32543,7 +32543,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
32543
32543
|
}
|
|
32544
32544
|
}
|
|
32545
32545
|
exportForExcel(data) {
|
|
32546
|
-
|
|
32546
|
+
if (data.sheets) {
|
|
32547
|
+
for (let sheet of data.sheets) {
|
|
32548
|
+
if (this.cfRules[sheet.id]) {
|
|
32549
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
32550
|
+
}
|
|
32551
|
+
}
|
|
32552
|
+
}
|
|
32547
32553
|
}
|
|
32548
32554
|
// ---------------------------------------------------------------------------
|
|
32549
32555
|
// Getters
|
|
@@ -32608,11 +32614,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
32608
32614
|
// ---------------------------------------------------------------------------
|
|
32609
32615
|
// Private
|
|
32610
32616
|
// ---------------------------------------------------------------------------
|
|
32611
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
32617
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
32612
32618
|
return {
|
|
32613
32619
|
...cf,
|
|
32614
32620
|
ranges: cf.ranges.map((range) => {
|
|
32615
|
-
return this.getters.getRangeString(range, sheetId);
|
|
32621
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
32616
32622
|
}),
|
|
32617
32623
|
};
|
|
32618
32624
|
}
|
|
@@ -34449,8 +34455,9 @@ class RangeAdapter {
|
|
|
34449
34455
|
*
|
|
34450
34456
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
34451
34457
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
34458
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
34452
34459
|
*/
|
|
34453
|
-
getRangeString(range, forSheetId) {
|
|
34460
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
34454
34461
|
if (!range) {
|
|
34455
34462
|
return INCORRECT_RANGE_STRING;
|
|
34456
34463
|
}
|
|
@@ -34477,7 +34484,7 @@ class RangeAdapter {
|
|
|
34477
34484
|
if (prefixSheet && !sheetName) {
|
|
34478
34485
|
return INCORRECT_RANGE_STRING;
|
|
34479
34486
|
}
|
|
34480
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
34487
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
34481
34488
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
34482
34489
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
34483
34490
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -34487,7 +34494,7 @@ class RangeAdapter {
|
|
|
34487
34494
|
rangeImpl.parts[1].rowFixed ||
|
|
34488
34495
|
rangeImpl.parts[1].colFixed) {
|
|
34489
34496
|
rangeString += ":";
|
|
34490
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
34497
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
34491
34498
|
}
|
|
34492
34499
|
}
|
|
34493
34500
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -34528,13 +34535,13 @@ class RangeAdapter {
|
|
|
34528
34535
|
/**
|
|
34529
34536
|
* Get a Xc string that represent a part of a range
|
|
34530
34537
|
*/
|
|
34531
|
-
getRangePartString(range, part) {
|
|
34538
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
34532
34539
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
34533
34540
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
34534
34541
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
34535
34542
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
34536
34543
|
let str = "";
|
|
34537
|
-
if (range.isFullCol) {
|
|
34544
|
+
if (range.isFullCol && !useFixedZone) {
|
|
34538
34545
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34539
34546
|
str = colFixed + col + rowFixed + row;
|
|
34540
34547
|
}
|
|
@@ -34542,7 +34549,7 @@ class RangeAdapter {
|
|
|
34542
34549
|
str = colFixed + col;
|
|
34543
34550
|
}
|
|
34544
34551
|
}
|
|
34545
|
-
else if (range.isFullRow) {
|
|
34552
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
34546
34553
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34547
34554
|
str = colFixed + col + rowFixed + row;
|
|
34548
34555
|
}
|
|
@@ -49803,12 +49810,7 @@ function addFormula(cell) {
|
|
|
49803
49810
|
attrs.push(["t", "str"]);
|
|
49804
49811
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
49805
49812
|
}
|
|
49806
|
-
node = escapeXml /*xml*/ `
|
|
49807
|
-
<f>
|
|
49808
|
-
${XlsxFormula}
|
|
49809
|
-
</f>
|
|
49810
|
-
${cycle}
|
|
49811
|
-
`;
|
|
49813
|
+
node = escapeXml /*xml*/ ` <f> ${XlsxFormula} </f> ${cycle} `;
|
|
49812
49814
|
return { attrs, node };
|
|
49813
49815
|
}
|
|
49814
49816
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -50627,11 +50629,10 @@ function addRows(construct, data, sheet) {
|
|
|
50627
50629
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
50628
50630
|
}
|
|
50629
50631
|
attributes.push(...additionalAttrs);
|
|
50630
|
-
|
|
50631
|
-
|
|
50632
|
-
|
|
50633
|
-
|
|
50634
|
-
`);
|
|
50632
|
+
// prettier-ignore
|
|
50633
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
50634
|
+
${cellNode}
|
|
50635
|
+
</c>`);
|
|
50635
50636
|
}
|
|
50636
50637
|
}
|
|
50637
50638
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -51612,6 +51613,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
51612
51613
|
exports.tokenize = tokenize;
|
|
51613
51614
|
|
|
51614
51615
|
|
|
51615
|
-
__info__.version = '16.4.
|
|
51616
|
-
__info__.date = '2024-
|
|
51617
|
-
__info__.hash = '
|
|
51616
|
+
__info__.version = '16.4.21';
|
|
51617
|
+
__info__.date = '2024-02-02T13:45:48.276Z';
|
|
51618
|
+
__info__.hash = '73662b1';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -2979,8 +2979,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
|
|
|
2979
2979
|
*
|
|
2980
2980
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
2981
2981
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
2982
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
2982
2983
|
*/
|
|
2983
|
-
getRangeString(range: Range, forSheetId: UID): string;
|
|
2984
|
+
getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
|
|
2984
2985
|
getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
|
|
2985
2986
|
getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
|
|
2986
2987
|
getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
|
|
@@ -3199,7 +3200,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
|
|
|
3199
3200
|
* starting an async evaluation even if it has been moved or re-allocated
|
|
3200
3201
|
*/
|
|
3201
3202
|
getCellById(cellId: UID): Cell | undefined;
|
|
3202
|
-
buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
|
|
3203
|
+
buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
|
|
3203
3204
|
getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
|
|
3204
3205
|
getCellStyle(position: CellPosition): Style;
|
|
3205
3206
|
/**
|
|
@@ -15971,14 +15971,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
|
|
|
15971
15971
|
: undefined));
|
|
15972
15972
|
}
|
|
15973
15973
|
}
|
|
15974
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
15975
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
15976
|
-
if (!dataSetsHaveTitle) {
|
|
15977
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
15978
|
-
}
|
|
15979
|
-
}
|
|
15980
15974
|
else {
|
|
15981
|
-
/* 1 row or 1 column */
|
|
15975
|
+
/* 1 cell, 1 row or 1 column */
|
|
15982
15976
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
15983
15977
|
? {
|
|
15984
15978
|
top: zone.top,
|
|
@@ -16027,8 +16021,10 @@ function toExcelDataset(getters, ds) {
|
|
|
16027
16021
|
}
|
|
16028
16022
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
16029
16023
|
return {
|
|
16030
|
-
label: ds.labelCell
|
|
16031
|
-
|
|
16024
|
+
label: ds.labelCell
|
|
16025
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
16026
|
+
: undefined,
|
|
16027
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
16032
16028
|
};
|
|
16033
16029
|
}
|
|
16034
16030
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -16041,7 +16037,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
16041
16037
|
zone.top = zone.top + 1;
|
|
16042
16038
|
}
|
|
16043
16039
|
const range = labelRange.clone({ zone });
|
|
16044
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
16040
|
+
return getters.getRangeString(range, "forceSheetReference", true);
|
|
16045
16041
|
}
|
|
16046
16042
|
/**
|
|
16047
16043
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -16578,7 +16574,7 @@ class BarChart extends AbstractChart {
|
|
|
16578
16574
|
return undefined;
|
|
16579
16575
|
const dataSets = this.dataSets
|
|
16580
16576
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
16581
|
-
.filter((ds) => ds.range !== ""
|
|
16577
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
16582
16578
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
16583
16579
|
return {
|
|
16584
16580
|
...this.getDefinition(),
|
|
@@ -17166,7 +17162,7 @@ class LineChart extends AbstractChart {
|
|
|
17166
17162
|
return undefined;
|
|
17167
17163
|
const dataSets = this.dataSets
|
|
17168
17164
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17169
|
-
.filter((ds) => ds.range !== ""
|
|
17165
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17170
17166
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17171
17167
|
return {
|
|
17172
17168
|
...this.getDefinition(),
|
|
@@ -17453,7 +17449,7 @@ class PieChart extends AbstractChart {
|
|
|
17453
17449
|
return undefined;
|
|
17454
17450
|
const dataSets = this.dataSets
|
|
17455
17451
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17456
|
-
.filter((ds) => ds.range !== ""
|
|
17452
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17457
17453
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17458
17454
|
return {
|
|
17459
17455
|
...this.getDefinition(),
|
|
@@ -31930,6 +31926,10 @@ class CellPlugin extends CorePlugin {
|
|
|
31930
31926
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
31931
31927
|
content: cell.content || undefined,
|
|
31932
31928
|
};
|
|
31929
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
31930
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
31931
|
+
cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
|
|
31932
|
+
}
|
|
31933
31933
|
}
|
|
31934
31934
|
_sheet.cells = cells;
|
|
31935
31935
|
}
|
|
@@ -31964,13 +31964,13 @@ class CellPlugin extends CorePlugin {
|
|
|
31964
31964
|
/*
|
|
31965
31965
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
31966
31966
|
*/
|
|
31967
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
31967
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
31968
31968
|
const ranges = dependencies || cell.dependencies;
|
|
31969
31969
|
let rangeIndex = 0;
|
|
31970
31970
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
31971
31971
|
if (token.type === "REFERENCE") {
|
|
31972
31972
|
const range = ranges[rangeIndex++];
|
|
31973
|
-
return this.getters.getRangeString(range, sheetId);
|
|
31973
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
31974
31974
|
}
|
|
31975
31975
|
return token.value;
|
|
31976
31976
|
}));
|
|
@@ -32539,7 +32539,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
32539
32539
|
}
|
|
32540
32540
|
}
|
|
32541
32541
|
exportForExcel(data) {
|
|
32542
|
-
|
|
32542
|
+
if (data.sheets) {
|
|
32543
|
+
for (let sheet of data.sheets) {
|
|
32544
|
+
if (this.cfRules[sheet.id]) {
|
|
32545
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
32546
|
+
}
|
|
32547
|
+
}
|
|
32548
|
+
}
|
|
32543
32549
|
}
|
|
32544
32550
|
// ---------------------------------------------------------------------------
|
|
32545
32551
|
// Getters
|
|
@@ -32604,11 +32610,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
32604
32610
|
// ---------------------------------------------------------------------------
|
|
32605
32611
|
// Private
|
|
32606
32612
|
// ---------------------------------------------------------------------------
|
|
32607
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
32613
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
32608
32614
|
return {
|
|
32609
32615
|
...cf,
|
|
32610
32616
|
ranges: cf.ranges.map((range) => {
|
|
32611
|
-
return this.getters.getRangeString(range, sheetId);
|
|
32617
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
32612
32618
|
}),
|
|
32613
32619
|
};
|
|
32614
32620
|
}
|
|
@@ -34445,8 +34451,9 @@ class RangeAdapter {
|
|
|
34445
34451
|
*
|
|
34446
34452
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
34447
34453
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
34454
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
34448
34455
|
*/
|
|
34449
|
-
getRangeString(range, forSheetId) {
|
|
34456
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
34450
34457
|
if (!range) {
|
|
34451
34458
|
return INCORRECT_RANGE_STRING;
|
|
34452
34459
|
}
|
|
@@ -34473,7 +34480,7 @@ class RangeAdapter {
|
|
|
34473
34480
|
if (prefixSheet && !sheetName) {
|
|
34474
34481
|
return INCORRECT_RANGE_STRING;
|
|
34475
34482
|
}
|
|
34476
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
34483
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
34477
34484
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
34478
34485
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
34479
34486
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -34483,7 +34490,7 @@ class RangeAdapter {
|
|
|
34483
34490
|
rangeImpl.parts[1].rowFixed ||
|
|
34484
34491
|
rangeImpl.parts[1].colFixed) {
|
|
34485
34492
|
rangeString += ":";
|
|
34486
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
34493
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
34487
34494
|
}
|
|
34488
34495
|
}
|
|
34489
34496
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -34524,13 +34531,13 @@ class RangeAdapter {
|
|
|
34524
34531
|
/**
|
|
34525
34532
|
* Get a Xc string that represent a part of a range
|
|
34526
34533
|
*/
|
|
34527
|
-
getRangePartString(range, part) {
|
|
34534
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
34528
34535
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
34529
34536
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
34530
34537
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
34531
34538
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
34532
34539
|
let str = "";
|
|
34533
|
-
if (range.isFullCol) {
|
|
34540
|
+
if (range.isFullCol && !useFixedZone) {
|
|
34534
34541
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34535
34542
|
str = colFixed + col + rowFixed + row;
|
|
34536
34543
|
}
|
|
@@ -34538,7 +34545,7 @@ class RangeAdapter {
|
|
|
34538
34545
|
str = colFixed + col;
|
|
34539
34546
|
}
|
|
34540
34547
|
}
|
|
34541
|
-
else if (range.isFullRow) {
|
|
34548
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
34542
34549
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34543
34550
|
str = colFixed + col + rowFixed + row;
|
|
34544
34551
|
}
|
|
@@ -49799,12 +49806,7 @@ function addFormula(cell) {
|
|
|
49799
49806
|
attrs.push(["t", "str"]);
|
|
49800
49807
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
49801
49808
|
}
|
|
49802
|
-
node = escapeXml /*xml*/ `
|
|
49803
|
-
<f>
|
|
49804
|
-
${XlsxFormula}
|
|
49805
|
-
</f>
|
|
49806
|
-
${cycle}
|
|
49807
|
-
`;
|
|
49809
|
+
node = escapeXml /*xml*/ ` <f> ${XlsxFormula} </f> ${cycle} `;
|
|
49808
49810
|
return { attrs, node };
|
|
49809
49811
|
}
|
|
49810
49812
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -50623,11 +50625,10 @@ function addRows(construct, data, sheet) {
|
|
|
50623
50625
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
50624
50626
|
}
|
|
50625
50627
|
attributes.push(...additionalAttrs);
|
|
50626
|
-
|
|
50627
|
-
|
|
50628
|
-
|
|
50629
|
-
|
|
50630
|
-
`);
|
|
50628
|
+
// prettier-ignore
|
|
50629
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
50630
|
+
${cellNode}
|
|
50631
|
+
</c>`);
|
|
50631
50632
|
}
|
|
50632
50633
|
}
|
|
50633
50634
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -51576,6 +51577,6 @@ const constants = {
|
|
|
51576
51577
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
51577
51578
|
|
|
51578
51579
|
|
|
51579
|
-
__info__.version = '16.4.
|
|
51580
|
-
__info__.date = '2024-
|
|
51581
|
-
__info__.hash = '
|
|
51580
|
+
__info__.version = '16.4.21';
|
|
51581
|
+
__info__.date = '2024-02-02T13:45:48.276Z';
|
|
51582
|
+
__info__.hash = '73662b1';
|
|
@@ -15972,14 +15972,8 @@
|
|
|
15972
15972
|
: undefined));
|
|
15973
15973
|
}
|
|
15974
15974
|
}
|
|
15975
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
15976
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
15977
|
-
if (!dataSetsHaveTitle) {
|
|
15978
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
15979
|
-
}
|
|
15980
|
-
}
|
|
15981
15975
|
else {
|
|
15982
|
-
/* 1 row or 1 column */
|
|
15976
|
+
/* 1 cell, 1 row or 1 column */
|
|
15983
15977
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
15984
15978
|
? {
|
|
15985
15979
|
top: zone.top,
|
|
@@ -16028,8 +16022,10 @@
|
|
|
16028
16022
|
}
|
|
16029
16023
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
16030
16024
|
return {
|
|
16031
|
-
label: ds.labelCell
|
|
16032
|
-
|
|
16025
|
+
label: ds.labelCell
|
|
16026
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
16027
|
+
: undefined,
|
|
16028
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
16033
16029
|
};
|
|
16034
16030
|
}
|
|
16035
16031
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -16042,7 +16038,7 @@
|
|
|
16042
16038
|
zone.top = zone.top + 1;
|
|
16043
16039
|
}
|
|
16044
16040
|
const range = labelRange.clone({ zone });
|
|
16045
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
16041
|
+
return getters.getRangeString(range, "forceSheetReference", true);
|
|
16046
16042
|
}
|
|
16047
16043
|
/**
|
|
16048
16044
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -16579,7 +16575,7 @@
|
|
|
16579
16575
|
return undefined;
|
|
16580
16576
|
const dataSets = this.dataSets
|
|
16581
16577
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
16582
|
-
.filter((ds) => ds.range !== ""
|
|
16578
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
16583
16579
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
16584
16580
|
return {
|
|
16585
16581
|
...this.getDefinition(),
|
|
@@ -17167,7 +17163,7 @@
|
|
|
17167
17163
|
return undefined;
|
|
17168
17164
|
const dataSets = this.dataSets
|
|
17169
17165
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17170
|
-
.filter((ds) => ds.range !== ""
|
|
17166
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17171
17167
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17172
17168
|
return {
|
|
17173
17169
|
...this.getDefinition(),
|
|
@@ -17454,7 +17450,7 @@
|
|
|
17454
17450
|
return undefined;
|
|
17455
17451
|
const dataSets = this.dataSets
|
|
17456
17452
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
17457
|
-
.filter((ds) => ds.range !== ""
|
|
17453
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
17458
17454
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
17459
17455
|
return {
|
|
17460
17456
|
...this.getDefinition(),
|
|
@@ -31931,6 +31927,10 @@
|
|
|
31931
31927
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
31932
31928
|
content: cell.content || undefined,
|
|
31933
31929
|
};
|
|
31930
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
31931
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
31932
|
+
cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
|
|
31933
|
+
}
|
|
31934
31934
|
}
|
|
31935
31935
|
_sheet.cells = cells;
|
|
31936
31936
|
}
|
|
@@ -31965,13 +31965,13 @@
|
|
|
31965
31965
|
/*
|
|
31966
31966
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
31967
31967
|
*/
|
|
31968
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
31968
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
31969
31969
|
const ranges = dependencies || cell.dependencies;
|
|
31970
31970
|
let rangeIndex = 0;
|
|
31971
31971
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
31972
31972
|
if (token.type === "REFERENCE") {
|
|
31973
31973
|
const range = ranges[rangeIndex++];
|
|
31974
|
-
return this.getters.getRangeString(range, sheetId);
|
|
31974
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
31975
31975
|
}
|
|
31976
31976
|
return token.value;
|
|
31977
31977
|
}));
|
|
@@ -32540,7 +32540,13 @@
|
|
|
32540
32540
|
}
|
|
32541
32541
|
}
|
|
32542
32542
|
exportForExcel(data) {
|
|
32543
|
-
|
|
32543
|
+
if (data.sheets) {
|
|
32544
|
+
for (let sheet of data.sheets) {
|
|
32545
|
+
if (this.cfRules[sheet.id]) {
|
|
32546
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
32547
|
+
}
|
|
32548
|
+
}
|
|
32549
|
+
}
|
|
32544
32550
|
}
|
|
32545
32551
|
// ---------------------------------------------------------------------------
|
|
32546
32552
|
// Getters
|
|
@@ -32605,11 +32611,11 @@
|
|
|
32605
32611
|
// ---------------------------------------------------------------------------
|
|
32606
32612
|
// Private
|
|
32607
32613
|
// ---------------------------------------------------------------------------
|
|
32608
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
32614
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
32609
32615
|
return {
|
|
32610
32616
|
...cf,
|
|
32611
32617
|
ranges: cf.ranges.map((range) => {
|
|
32612
|
-
return this.getters.getRangeString(range, sheetId);
|
|
32618
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
32613
32619
|
}),
|
|
32614
32620
|
};
|
|
32615
32621
|
}
|
|
@@ -34446,8 +34452,9 @@
|
|
|
34446
34452
|
*
|
|
34447
34453
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
34448
34454
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
34455
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
34449
34456
|
*/
|
|
34450
|
-
getRangeString(range, forSheetId) {
|
|
34457
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
34451
34458
|
if (!range) {
|
|
34452
34459
|
return INCORRECT_RANGE_STRING;
|
|
34453
34460
|
}
|
|
@@ -34474,7 +34481,7 @@
|
|
|
34474
34481
|
if (prefixSheet && !sheetName) {
|
|
34475
34482
|
return INCORRECT_RANGE_STRING;
|
|
34476
34483
|
}
|
|
34477
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
34484
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
34478
34485
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
34479
34486
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
34480
34487
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -34484,7 +34491,7 @@
|
|
|
34484
34491
|
rangeImpl.parts[1].rowFixed ||
|
|
34485
34492
|
rangeImpl.parts[1].colFixed) {
|
|
34486
34493
|
rangeString += ":";
|
|
34487
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
34494
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
34488
34495
|
}
|
|
34489
34496
|
}
|
|
34490
34497
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -34525,13 +34532,13 @@
|
|
|
34525
34532
|
/**
|
|
34526
34533
|
* Get a Xc string that represent a part of a range
|
|
34527
34534
|
*/
|
|
34528
|
-
getRangePartString(range, part) {
|
|
34535
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
34529
34536
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
34530
34537
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
34531
34538
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
34532
34539
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
34533
34540
|
let str = "";
|
|
34534
|
-
if (range.isFullCol) {
|
|
34541
|
+
if (range.isFullCol && !useFixedZone) {
|
|
34535
34542
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34536
34543
|
str = colFixed + col + rowFixed + row;
|
|
34537
34544
|
}
|
|
@@ -34539,7 +34546,7 @@
|
|
|
34539
34546
|
str = colFixed + col;
|
|
34540
34547
|
}
|
|
34541
34548
|
}
|
|
34542
|
-
else if (range.isFullRow) {
|
|
34549
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
34543
34550
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
34544
34551
|
str = colFixed + col + rowFixed + row;
|
|
34545
34552
|
}
|
|
@@ -49800,12 +49807,7 @@
|
|
|
49800
49807
|
attrs.push(["t", "str"]);
|
|
49801
49808
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
49802
49809
|
}
|
|
49803
|
-
node = escapeXml /*xml*/ `
|
|
49804
|
-
<f>
|
|
49805
|
-
${XlsxFormula}
|
|
49806
|
-
</f>
|
|
49807
|
-
${cycle}
|
|
49808
|
-
`;
|
|
49810
|
+
node = escapeXml /*xml*/ ` <f> ${XlsxFormula} </f> ${cycle} `;
|
|
49809
49811
|
return { attrs, node };
|
|
49810
49812
|
}
|
|
49811
49813
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -50624,11 +50626,10 @@
|
|
|
50624
50626
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
50625
50627
|
}
|
|
50626
50628
|
attributes.push(...additionalAttrs);
|
|
50627
|
-
|
|
50628
|
-
|
|
50629
|
-
|
|
50630
|
-
|
|
50631
|
-
`);
|
|
50629
|
+
// prettier-ignore
|
|
50630
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
50631
|
+
${cellNode}
|
|
50632
|
+
</c>`);
|
|
50632
50633
|
}
|
|
50633
50634
|
}
|
|
50634
50635
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -51611,9 +51612,9 @@
|
|
|
51611
51612
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51612
51613
|
|
|
51613
51614
|
|
|
51614
|
-
__info__.version = '16.4.
|
|
51615
|
-
__info__.date = '2024-
|
|
51616
|
-
__info__.hash = '
|
|
51615
|
+
__info__.version = '16.4.21';
|
|
51616
|
+
__info__.date = '2024-02-02T13:45:48.276Z';
|
|
51617
|
+
__info__.hash = '73662b1';
|
|
51617
51618
|
|
|
51618
51619
|
|
|
51619
51620
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|