sync
This commit is contained in:
@ -71,13 +71,13 @@ let r = lang;
|
||||
/**
|
||||
* 键值字典
|
||||
* @template T
|
||||
* @typedef {{[key: string]: T}} KeyMap
|
||||
* @typedef {Map<string, T>} KeyMap
|
||||
*/
|
||||
|
||||
/**
|
||||
* 索引字典
|
||||
* @template T
|
||||
* @typedef {{[index: number]: T}} IndexMap
|
||||
* @typedef {Map<number, T>} IndexMap
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -1077,7 +1077,7 @@ export class Grid {
|
||||
/**
|
||||
* 行发生变化时触发的事件
|
||||
* @event
|
||||
* @param {("update" | "add" | "remove")} action - 变动类型
|
||||
* @param {("update" | "add" | "remove" | "drag")} action - 变动类型
|
||||
* @param {GridRowItem[]} items - 发生变动的行对象
|
||||
* @param {(number | number[])} indexes - 变动的索引集合
|
||||
* @this Grid
|
||||
@ -1244,7 +1244,7 @@ export class Grid {
|
||||
* 获取已过滤的数据数组,或者设置数据并刷新列表
|
||||
* @type {GridRowItem[]}
|
||||
*/
|
||||
get source() { return this._var.currentSource?.map(s => s.values) }
|
||||
get source() { return this._var.currentSource?.map(s => s.values) ?? [] }
|
||||
set source(list) {
|
||||
if (!Array.isArray(list)) {
|
||||
throw new Error('source is not an Array.')
|
||||
@ -1463,6 +1463,9 @@ export class Grid {
|
||||
this.removeItem(src);
|
||||
this.addItem(row, target);
|
||||
this.selectedIndexes = [e.ctrlKey ? target : target - 1];
|
||||
if (typeof this.onRowChanged === 'function') {
|
||||
this.onRowChanged('drag', [row], target);
|
||||
}
|
||||
});
|
||||
}
|
||||
container.replaceChildren(grid);
|
||||
@ -2862,6 +2865,9 @@ export class Grid {
|
||||
this.removeItem(src);
|
||||
this.addItem(row, target);
|
||||
this.selectedIndexes = [target];
|
||||
if (typeof this.onRowChanged === 'function') {
|
||||
this.onRowChanged('drag', [row], target);
|
||||
}
|
||||
});
|
||||
}
|
||||
const virtualRow = { cells: {} };
|
||||
@ -3648,6 +3654,8 @@ export class Grid {
|
||||
}
|
||||
]).then(result => {
|
||||
if (result?.key === 'yes') {
|
||||
const sortCol = this.sortArray.find(c => c.column === col.key);
|
||||
this.sortDirection = sortCol?.order === 'asc' ? -1 : 1;
|
||||
this._onDoHeaderSort(col);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user