Merge branch 'release/v9.2.0' into fix/bug-78419

This commit is contained in:
Dmitriy Orlov
2025-11-14 15:17:07 +03:00
2 changed files with 49 additions and 9 deletions

View File

@ -2914,7 +2914,7 @@ function (window, undefined) {
} }
const axisData = bHor ? this.data[wsId].horizontal : this.data[wsId].vertical; const axisData = bHor ? this.data[wsId].horizontal : this.data[wsId].vertical;
if (!axisData[rowCol]) { if (!axisData[rowCol]) {
axisData[rowCol] = {start: startIndex, end: endIndex, data: {}}; axisData[rowCol] = {start: startIndex, end: startIndex, data: {}};
const c1 = bHor ? startIndex : rowCol; const c1 = bHor ? startIndex : rowCol;
const r1 = bHor ? rowCol : startIndex; const r1 = bHor ? rowCol : startIndex;
const c2 = bHor ? endIndex : rowCol; const c2 = bHor ? endIndex : rowCol;
@ -2933,15 +2933,15 @@ function (window, undefined) {
const arr = axisData[rowCol].data[value.type].get(value.value); const arr = axisData[rowCol].data[value.type].get(value.value);
arr.push(index); arr.push(index);
}); });
axisData[rowCol].start = startIndex;
axisData[rowCol].end = endIndex; axisData[rowCol].end = endIndex;
} else { } else {
if (startIndex < axisData[rowCol].start) { if (startIndex < axisData[rowCol].start) {
const c1 = bHor ? startIndex : rowCol; const c1 = bHor ? startIndex : rowCol;
const r1 = bHor ? rowCol : startIndex; const r1 = bHor ? rowCol : startIndex;
const c2 = bHor ? axisData[rowCol].start : rowCol; const c2 = bHor ? axisData[rowCol].start - 1: rowCol;
const r2 = bHor ? rowCol : axisData[rowCol].start; const r2 = bHor ? rowCol : axisData[rowCol].start - 1;
const fullRange = ws.getRange3(r1, c1, r2, c2); const fullRange = ws.getRange3(r1, c1, r2, c2);
const unshiftMaps = {};
fullRange._foreachNoEmpty(function (cell, r, c) { fullRange._foreachNoEmpty(function (cell, r, c) {
const value = checkTypeCell(cell, true); const value = checkTypeCell(cell, true);
const index = bHor ? c : r; const index = bHor ? c : r;
@ -2950,16 +2950,32 @@ function (window, undefined) {
} }
const map = axisData[rowCol].data[value.type]; const map = axisData[rowCol].data[value.type];
if (!map.has(value.value)) { if (!map.has(value.value)) {
map.set(value.value, []); map.set(value.value, [index]);
} else {
if (!unshiftMaps[value.type]) {
unshiftMaps[value.type] = new Map();
}
const unshiftMap = unshiftMaps[value.type];
if (!unshiftMap.has(value.value)) {
unshiftMap.set(value.value, []);
}
const arr = unshiftMap.get(value.value);
arr.push(index);
} }
const arr = axisData[rowCol].data[value.type].get(value.value);
arr.unshift(index);
}); });
for (let i in unshiftMaps) {
const unshiftMap = unshiftMaps[i];
unshiftMap.forEach(function (value, key) {
const map = axisData[rowCol].data[i];
const prevArr = map.get(key);
map.set(key, value.concat(prevArr));
})
}
axisData[rowCol].start = startIndex; axisData[rowCol].start = startIndex;
} }
if (endIndex > axisData[rowCol].end) { if (endIndex > axisData[rowCol].end) {
const c1 = bHor ? axisData[rowCol].end : rowCol; const c1 = bHor ? axisData[rowCol].end + 1: rowCol;
const r1 = bHor ? rowCol : axisData[rowCol].end; const r1 = bHor ? rowCol : axisData[rowCol].end + 1;
const c2 = bHor ? endIndex : rowCol; const c2 = bHor ? endIndex : rowCol;
const r2 = bHor ? rowCol : endIndex; const r2 = bHor ? rowCol : endIndex;
const fullRange = ws.getRange3(r1, c1, r2, c2); const fullRange = ws.getRange3(r1, c1, r2, c2);

View File

@ -25139,6 +25139,30 @@ $(function () {
oCalcSettings.asc_setIterativeCalc(false); oCalcSettings.asc_setIterativeCalc(false);
wb.dependencyFormulas.lockRecal(); wb.dependencyFormulas.lockRecal();
//Case #67: Test for TypedMapCache
ws.getRange2("AR901").setValue("a");
ws.getRange2("AR902").setValue("a");
ws.getRange2("AR903").setValue("a");
ws.getRange2("AR904").setValue("a");
ws.getRange2("AR905").setValue("a");
ws.getRange2("AS901").setValue("1");
ws.getRange2("AS902").setValue("2");
ws.getRange2("AS903").setValue("3");
ws.getRange2("AS904").setValue("4");
ws.getRange2("AS905").setValue("5");
wb.dependencyFormulas.unlockRecal();
ws.getRange2("AT902").setValue('=VLOOKUP(AT903,AR901:AS903,2,FALSE');
ws.getRange2("AT901").setValue('=VLOOKUP(AT903,AR903:AS905,2,FALSE');
ws.getRange2("AT903").setValue('a')
wb.dependencyFormulas.lockRecal();
assert.strictEqual(ws.getRange2("AT901").getValue(), "3");
assert.strictEqual(ws.getRange2("AT902").getValue(), "1");
// Negative Cases: // Negative Cases:
// Case #1: Array, Array, Array with wrong data // Case #1: Array, Array, Array with wrong data
oParser = new parserFormula("VLOOKUP({2,3,4},{1,2,3;2,3,4},{4,5,6})", "A2", ws); oParser = new parserFormula("VLOOKUP({2,3,4},{1,2,3;2,3,4},{4,5,6})", "A2", ws);