mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
[all] Fix bug 79936 (#1925)
[all] Fix bug 79936 Co-authored-by: Angsar <ansar.aydarbek@onlyoffice.com> Co-committed-by: Angsar <ansar.aydarbek@onlyoffice.com>
This commit is contained in:
@ -20132,7 +20132,7 @@
|
||||
let formula1 = validation.getFormula1();
|
||||
let worksheet = this.range && this.range.range && this.range.range.worksheet;
|
||||
if (formula1 && worksheet) {
|
||||
formula1 = formula1.clone();
|
||||
formula1 = formula1.clone(true);
|
||||
formula1.correctToInterface(worksheet, validation);
|
||||
}
|
||||
return formula1 ? formula1.asc_getValue() : "";
|
||||
@ -20153,7 +20153,7 @@
|
||||
let formula2 = validation.getFormula2();
|
||||
let worksheet = this.range && this.range.range && this.range.range.worksheet;
|
||||
if (formula2 && worksheet) {
|
||||
formula2 = formula2.clone();
|
||||
formula2 = formula2.clone(true);
|
||||
formula2.correctToInterface(worksheet, validation);
|
||||
}
|
||||
return formula2 ? formula2.asc_getValue() : "";
|
||||
|
||||
@ -75,10 +75,13 @@
|
||||
this._formula.buildDependencies();
|
||||
}
|
||||
};
|
||||
CDataFormula.prototype.clone = function () {
|
||||
CDataFormula.prototype.clone = function (fullClone) {
|
||||
var res = new CDataFormula();
|
||||
res.text = this.text;
|
||||
//this._formula = null;
|
||||
if (fullClone && this._formula) {
|
||||
res._formula = this._formula.clone();
|
||||
}
|
||||
return res;
|
||||
};
|
||||
CDataFormula.prototype.onFormulaEvent = function (type, eventData) {
|
||||
@ -126,10 +129,13 @@
|
||||
isNum: isNum(this.text),
|
||||
}
|
||||
|
||||
const normalizeText = function (data) {
|
||||
const isQuote = typeof data.val === "string" && data.val.length >=2 && data.val[0] === '"';
|
||||
const isQuoted = function (data) {
|
||||
return typeof data.val === "string" && data.val.length >=2 && data.val[0] === '"';
|
||||
}
|
||||
|
||||
if (isQuote) {
|
||||
const normalizeText = function (data, wasQuoted) {
|
||||
|
||||
if (wasQuoted) {
|
||||
let _val = data.val;
|
||||
|
||||
_val = _val.slice(1, -1);
|
||||
@ -181,13 +187,14 @@
|
||||
}
|
||||
|
||||
// fix the text from quotes
|
||||
data = normalizeText(data)
|
||||
const wasQuoted = isQuoted(data);
|
||||
data = normalizeText(data, wasQuoted);
|
||||
if (data.isNum) {
|
||||
fromNumberToString(data);
|
||||
} else if (oValidation.type === Asc.EDataValidationType.List) {
|
||||
toListPreview(data);
|
||||
} else {
|
||||
if (this && this._formula) {
|
||||
if (wasQuoted && oValidation.type === Asc.EDataValidationType.List) {
|
||||
toListPreview(data);
|
||||
} else if (this && this._formula) {
|
||||
//если формула содержит ссылки на диапазоны, то в зависимости от активной области нужно их сдвинуть
|
||||
var offset = oValidation.calculateOffset(ws);
|
||||
if (offset) {
|
||||
|
||||
@ -129,7 +129,7 @@ $(function () {
|
||||
const src = ws.GetRange("F1:F2"); src.SetValue('x');
|
||||
const r3 = ws.GetRange("G1:G2");
|
||||
r3.GetValidation().Add('xlValidateList', 'xlValidAlertWarning', undefined, ws.GetRange('F1:F2'));
|
||||
assert.strictEqual(r3.GetValidation().GetFormula1(), 'F1:F2', "Formula1 from ApiRange address");
|
||||
assert.strictEqual(r3.GetValidation().GetFormula1(), '=F1:F2', "Formula1 from ApiRange address");
|
||||
});
|
||||
|
||||
QUnit.test("Add fails when type is invalid", function (assert) {
|
||||
@ -410,7 +410,7 @@ $(function () {
|
||||
|
||||
const v = r.GetValidation();
|
||||
assert.strictEqual(v.GetType(), "xlValidateList", "Type");
|
||||
assert.strictEqual(v.GetFormula1(), "M1:M2", "Formula1 returns range address (no quotes, no '=')");
|
||||
assert.strictEqual(v.GetFormula1(), "=M1:M2", "Formula1 returns range address (no quotes, no '=')");
|
||||
});
|
||||
|
||||
QUnit.test("xlValidateDate: Greater than 01/31/2027 => stored numerically (no '=' drift)", function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user