fix some issues

This commit is contained in:
2024-01-29 12:44:03 +08:00
parent 56262d6766
commit 0696ecaff0
3 changed files with 11 additions and 7 deletions

View File

@ -208,7 +208,8 @@ export class Grid {
throw new Error('no source');
}
if (!Array.isArray(array) || array.length <= 0) {
throw new Error(`invalid items array: ${array}`);
// throw new Error(`invalid items array: ${array}`);
return;
}
const it = index >= 0 ? this._var.currentSource[index] : null;
if (it != null) {
@ -260,10 +261,11 @@ export class Grid {
if (this._var.currentSource == null) {
throw new Error('no source');
}
if (!Array.isArray(indexes) || indexes.length <= 0) {
throw new Error(`invalid selected indexes: ${indexes}`);
if (Array.isArray(indexes) && indexes.length > 0) {
indexes = indexes.slice().sort();
} else {
indexes = this._var.currentSource.map(a => a.__index);
}
indexes = indexes.slice().sort();
const array = [];
let first = 0;
for (let i = indexes.length - 1; i >= 0; --i) {