提交 8b81e8b3 编写于 作者: J Joao Moreno

list widget refactor

上级 5800c933
......@@ -158,17 +158,11 @@ export class List<T> implements IDisposable {
private controller: Controller<T>;
get onFocusChange(): Event<IFocusChangeEvent<T>> {
return mapEvent(this.focus.onChange, e => ({
elements: e.indexes.map(i => this.view.element(i)),
indexes: e.indexes
}));
return mapEvent(this.focus.onChange, e => this.toListEvent(e));
}
get onSelectionChange(): Event<ISelectionChangeEvent<T>> {
return mapEvent(this.selection.onChange, e => ({
elements: e.indexes.map(i => this.view.element(i)),
indexes: e.indexes
}));
return mapEvent(this.selection.onChange, e => this.toListEvent(e));
}
constructor(
......@@ -322,6 +316,10 @@ export class List<T> implements IDisposable {
}
}
private toListEvent<T>({ indexes }: ITraitChangeEvent) {
return { indexes, elements: indexes.map(i => this.view.element(i)) };
}
dispose(): void {
this.view = dispose(this.view);
this.focus = dispose(this.focus);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册