mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
[se] Fix bug 34976
This commit is contained in:
@ -1237,8 +1237,9 @@
|
||||
}
|
||||
break;
|
||||
case 65:
|
||||
t.handlers.trigger("selectColumnsByRange");
|
||||
t.handlers.trigger("selectRowsByRange");
|
||||
//t.handlers.trigger("selectColumnsByRange");
|
||||
//t.handlers.trigger("selectRowsByRange");
|
||||
t.handlers.trigger("selectAllByRange");
|
||||
action = true;
|
||||
break;
|
||||
case 66:
|
||||
|
||||
@ -472,6 +472,8 @@
|
||||
self._onSelectColumnsByRange.apply(self, arguments);
|
||||
}, "selectRowsByRange": function () {
|
||||
self._onSelectRowsByRange.apply(self, arguments);
|
||||
}, "selectAllByRange": function () {
|
||||
self._onSelectAllByRange.apply(self, arguments);
|
||||
}, "save": function () {
|
||||
self.Api.asc_Save();
|
||||
}, "showCellEditorCursor": function () {
|
||||
@ -2326,6 +2328,10 @@
|
||||
this.getWorksheet()._selectRowsByRange();
|
||||
};
|
||||
|
||||
WorkbookView.prototype._onSelectAllByRange = function() {
|
||||
this.getWorksheet()._selectAllByRange();
|
||||
};
|
||||
|
||||
WorkbookView.prototype._onShowCellEditorCursor = function() {
|
||||
// Показываем курсор
|
||||
if (this.getCellEditMode()) {
|
||||
|
||||
@ -9871,6 +9871,55 @@
|
||||
}
|
||||
};
|
||||
|
||||
WorksheetView.prototype._selectAllByRange = function () {
|
||||
var ar = this.model.selectionRange.getLast();
|
||||
var type = ar.getType();
|
||||
if (this.isMultiSelect() || c_oAscSelectionType.RangeCol === type || c_oAscSelectionType.RangeRow === type) {
|
||||
this._selectColumnsByRange();
|
||||
this._selectRowsByRange();
|
||||
} else if (c_oAscSelectionType.RangeMax !== type) {
|
||||
this.cleanSelection();
|
||||
if (c_oAscSelectionType.RangeCol === type || c_oAscSelectionType.RangeRow === type) {
|
||||
ar.assign(0, 0, gc_nMaxCol0, gc_nMaxRow0);
|
||||
} else {
|
||||
let ar = this.model.selectionRange.getLast();
|
||||
let newRange;
|
||||
let tableParts = this.model.TableParts;
|
||||
if (tableParts && tableParts.length) {
|
||||
for (let i = 0; i < tableParts.length; i++) {
|
||||
if (tableParts[i].Ref.containsRange(ar)) {
|
||||
//into body table
|
||||
let _dataRange = tableParts[i].getTableRangeForFormula({param: AscCommon.FormulaTablePartInfo.data});
|
||||
if (_dataRange && _dataRange.containsRange(ar) && !_dataRange.isEqual(ar)) {
|
||||
newRange = _dataRange;
|
||||
} else if (!tableParts[i].Ref.isEqual(ar)) {
|
||||
newRange = tableParts[i].Ref;
|
||||
} else {
|
||||
newRange = ar;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newRange) {
|
||||
newRange = this.model.autoFilters.expandRange(ar, true);
|
||||
}
|
||||
|
||||
if (newRange) {
|
||||
if (newRange.isEqual(ar)) {
|
||||
ar.assign(0, 0, gc_nMaxCol0, gc_nMaxRow0);
|
||||
} else {
|
||||
ar.assign(newRange.c1, newRange.r1, newRange.c2, newRange.r2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._drawSelection();
|
||||
this._updateSelectionNameAndInfo();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Возвращает true, если диапазон больше видимой области, и операции над ним могут привести к задержкам
|
||||
* @param {Asc.Range} range Диапазон для проверки
|
||||
|
||||
@ -5574,5 +5574,55 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
QUnit.module("Sheet structure");
|
||||
QUnit.test('All selection test', function (assert) {
|
||||
|
||||
ws.getRange2("A1:Z100").cleanAll();
|
||||
|
||||
ws.getRange2("A1").setValue("1");
|
||||
ws.getRange2("A2").setValue("2");
|
||||
ws.getRange2("B1").setValue("3");
|
||||
ws.getRange2("B2").setValue("4");
|
||||
ws.getRange2("C2").setValue("5");
|
||||
|
||||
let fillRange = new Asc.Range(0, 0, 0, 0);
|
||||
wsView.setSelection(fillRange);
|
||||
assert.strictEqual(ws.selectionRange.getLast().getName(), "A1");
|
||||
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getName(), "A1:C2");
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getType(), Asc.c_oAscSelectionType.RangeMax);
|
||||
|
||||
fillRange = new Asc.Range(10, 10, 10, 10);
|
||||
wsView.setSelection(fillRange);
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getType(), Asc.c_oAscSelectionType.RangeMax);
|
||||
|
||||
|
||||
let tableOptions = new AscCommonExcel.AddFormatTableOptions();
|
||||
fillRange = new Asc.Range(0, 0, 2, 1);
|
||||
tableOptions.range = fillRange.getName();
|
||||
ws.autoFilters.addAutoFilter("style", fillRange, tableOptions);
|
||||
assert.strictEqual(ws.TableParts.length, 1);
|
||||
assert.strictEqual(ws.TableParts[0].Ref.getName(), "A1:C3");
|
||||
|
||||
|
||||
fillRange = new Asc.Range(1, 1, 1, 1);
|
||||
wsView.setSelection(fillRange);
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getName(), "A2:C3");
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getName(), "A1:C3");
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getType(), Asc.c_oAscSelectionType.RangeMax);
|
||||
|
||||
fillRange = new Asc.Range(0, 0, 0, 0);
|
||||
wsView.setSelection(fillRange);
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getName(), "A1:C3");
|
||||
api.wb._onSelectAllByRange();
|
||||
assert.strictEqual(ws.selectionRange.getLast().getType(), Asc.c_oAscSelectionType.RangeMax);
|
||||
});
|
||||
|
||||
QUnit.module("Sheet structure");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user