mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-02-10 18:15:19 +08:00
Merge branch 'release/v9.2.0' into fix/bug-78419
This commit is contained in:
@ -2914,7 +2914,7 @@ function (window, undefined) {
|
||||
}
|
||||
const axisData = bHor ? this.data[wsId].horizontal : this.data[wsId].vertical;
|
||||
if (!axisData[rowCol]) {
|
||||
axisData[rowCol] = {start: startIndex, end: endIndex, data: {}};
|
||||
axisData[rowCol] = {start: startIndex, end: startIndex, data: {}};
|
||||
const c1 = bHor ? startIndex : rowCol;
|
||||
const r1 = bHor ? rowCol : startIndex;
|
||||
const c2 = bHor ? endIndex : rowCol;
|
||||
@ -2933,15 +2933,15 @@ function (window, undefined) {
|
||||
const arr = axisData[rowCol].data[value.type].get(value.value);
|
||||
arr.push(index);
|
||||
});
|
||||
axisData[rowCol].start = startIndex;
|
||||
axisData[rowCol].end = endIndex;
|
||||
} else {
|
||||
if (startIndex < axisData[rowCol].start) {
|
||||
const c1 = bHor ? startIndex : rowCol;
|
||||
const r1 = bHor ? rowCol : startIndex;
|
||||
const c2 = bHor ? axisData[rowCol].start : rowCol;
|
||||
const r2 = bHor ? rowCol : axisData[rowCol].start;
|
||||
const c2 = bHor ? axisData[rowCol].start - 1: rowCol;
|
||||
const r2 = bHor ? rowCol : axisData[rowCol].start - 1;
|
||||
const fullRange = ws.getRange3(r1, c1, r2, c2);
|
||||
const unshiftMaps = {};
|
||||
fullRange._foreachNoEmpty(function (cell, r, c) {
|
||||
const value = checkTypeCell(cell, true);
|
||||
const index = bHor ? c : r;
|
||||
@ -2950,16 +2950,32 @@ function (window, undefined) {
|
||||
}
|
||||
const map = axisData[rowCol].data[value.type];
|
||||
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;
|
||||
}
|
||||
if (endIndex > axisData[rowCol].end) {
|
||||
const c1 = bHor ? axisData[rowCol].end : rowCol;
|
||||
const r1 = bHor ? rowCol : axisData[rowCol].end;
|
||||
const c1 = bHor ? axisData[rowCol].end + 1: rowCol;
|
||||
const r1 = bHor ? rowCol : axisData[rowCol].end + 1;
|
||||
const c2 = bHor ? endIndex : rowCol;
|
||||
const r2 = bHor ? rowCol : endIndex;
|
||||
const fullRange = ws.getRange3(r1, c1, r2, c2);
|
||||
|
||||
@ -25139,6 +25139,30 @@ $(function () {
|
||||
oCalcSettings.asc_setIterativeCalc(false);
|
||||
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:
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user