1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.QuickPickServiceImpl = void 0;
|
19 | const tslib_1 = require("tslib");
|
20 | const inversify_1 = require("inversify");
|
21 | const event_1 = require("../../common/event");
|
22 | const quick_input_service_1 = require("./quick-input-service");
|
23 | let QuickPickServiceImpl = class QuickPickServiceImpl {
|
24 | constructor() {
|
25 | this.onDidHideEmitter = new event_1.Emitter();
|
26 | this.onDidHide = this.onDidHideEmitter.event;
|
27 | this.onDidChangeValueEmitter = new event_1.Emitter();
|
28 | this.onDidChangeValue = this.onDidChangeValueEmitter.event;
|
29 | this.onDidAcceptEmitter = new event_1.Emitter();
|
30 | this.onDidAccept = this.onDidAcceptEmitter.event;
|
31 | this.onDidChangeActiveEmitter = new event_1.Emitter();
|
32 | this.onDidChangeActive = this.onDidChangeActiveEmitter.event;
|
33 | this.onDidChangeSelectionEmitter = new event_1.Emitter();
|
34 | this.onDidChangeSelection = this.onDidChangeSelectionEmitter.event;
|
35 | this.onDidTriggerButtonEmitter = new event_1.Emitter();
|
36 | this.onDidTriggerButton = this.onDidTriggerButtonEmitter.event;
|
37 |
|
38 | this.items = [];
|
39 | }
|
40 | async show(items, options) {
|
41 | var _a;
|
42 | this.items = items;
|
43 | const opts = Object.assign({}, options, {
|
44 | onDidAccept: () => this.onDidAcceptEmitter.fire(),
|
45 | onDidChangeActive: (quickPick, activeItems) => this.onDidChangeActiveEmitter.fire({ quickPick, activeItems }),
|
46 | onDidChangeSelection: (quickPick, selectedItems) => this.onDidChangeSelectionEmitter.fire({ quickPick, selectedItems }),
|
47 | onDidChangeValue: (quickPick, filter) => this.onDidChangeValueEmitter.fire({ quickPick, filter }),
|
48 | onDidHide: () => this.onDidHideEmitter.fire(),
|
49 | onDidTriggerButton: (btn) => this.onDidTriggerButtonEmitter.fire(btn),
|
50 | });
|
51 | return (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.showQuickPick(this.items, opts);
|
52 | }
|
53 | hide() {
|
54 | var _a;
|
55 | (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.hide();
|
56 | }
|
57 | setItems(items) {
|
58 | this.items = items;
|
59 | }
|
60 | };
|
61 | (0, tslib_1.__decorate)([
|
62 | (0, inversify_1.inject)(quick_input_service_1.QuickInputService),
|
63 | (0, inversify_1.optional)(),
|
64 | (0, tslib_1.__metadata)("design:type", Object)
|
65 | ], QuickPickServiceImpl.prototype, "quickInputService", void 0);
|
66 | QuickPickServiceImpl = (0, tslib_1.__decorate)([
|
67 | (0, inversify_1.injectable)()
|
68 | ], QuickPickServiceImpl);
|
69 | exports.QuickPickServiceImpl = QuickPickServiceImpl;
|
70 |
|
\ | No newline at end of file |