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