mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
dfec7a4789
commit
4b95443bff
|
@ -365,6 +365,7 @@ export interface IChainableEvent<T> {
|
|||
map<O>(fn: (i: T) => O): IChainableEvent<O>;
|
||||
forEach(fn: (i: T) => void): IChainableEvent<T>;
|
||||
filter(fn: (e: T) => boolean): IChainableEvent<T>;
|
||||
latch(): IChainableEvent<T>;
|
||||
on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
|
||||
}
|
||||
|
||||
|
@ -398,6 +399,10 @@ class ChainableEvent<T> implements IChainableEvent<T> {
|
|||
return new ChainableEvent(filterEvent(this._event, fn));
|
||||
}
|
||||
|
||||
latch(): IChainableEvent<T> {
|
||||
return new ChainableEvent(latch(this._event));
|
||||
}
|
||||
|
||||
on(listener: (e: T) => any, thisArgs: any, disposables: IDisposable[]) {
|
||||
return this._event(listener, thisArgs, disposables);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
|||
import { attachBadgeStyler, attachProgressBarStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
|
||||
import { chain } from 'vs/base/common/event';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
@ -127,11 +128,13 @@ export class QuickInputService extends Component implements IQuickInputService {
|
|||
this.inputBox.setFocus();
|
||||
}, 0);
|
||||
}));
|
||||
this.toUnbind.push(this.checkboxList.onFocusChange(e => {
|
||||
if (this.progress && e.length) {
|
||||
this.progress(e[0]);
|
||||
}
|
||||
}));
|
||||
this.toUnbind.push(
|
||||
chain(this.checkboxList.onFocusChange)
|
||||
.map(e => e[0])
|
||||
.filter(e => !!e)
|
||||
.latch()
|
||||
.on(e => this.progress && this.progress(e))
|
||||
);
|
||||
|
||||
this.toUnbind.push(dom.addDisposableListener(this.container, 'focusout', (e: FocusEvent) => {
|
||||
for (let element = <Element>e.relatedTarget; element; element = element.parentElement) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
|||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
|
||||
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
@ -181,6 +182,7 @@ export class QuickInputCheckboxList {
|
|||
}));
|
||||
}
|
||||
|
||||
@memoize
|
||||
get onFocusChange() {
|
||||
return mapEvent(this.list.onFocusChange, e => e.elements.map(e => e.item));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue