mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
Merge from vscode 8b5ebbb1b8f6b2127bbbd551ac10cc080482d5b4 (#5041)
This commit is contained in:
@@ -68,9 +68,11 @@ interface QuickInputUI {
|
||||
visibleCount: CountBadge;
|
||||
count: CountBadge;
|
||||
message: HTMLElement;
|
||||
customButton: Button;
|
||||
progressBar: ProgressBar;
|
||||
list: QuickInputList;
|
||||
onDidAccept: Event<void>;
|
||||
onDidCustom: Event<void>;
|
||||
onDidTriggerButton: Event<IQuickInputButton>;
|
||||
ignoreFocusOut: boolean;
|
||||
keyMods: Writeable<IKeyMods>;
|
||||
@@ -92,6 +94,7 @@ type Visibilities = {
|
||||
message?: boolean;
|
||||
list?: boolean;
|
||||
ok?: boolean;
|
||||
customButton?: boolean;
|
||||
};
|
||||
|
||||
class QuickInput implements IQuickInput {
|
||||
@@ -312,6 +315,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
private _placeholder: string;
|
||||
private onDidChangeValueEmitter = new Emitter<string>();
|
||||
private onDidAcceptEmitter = new Emitter<void>();
|
||||
private onDidCustomEmitter = new Emitter<void>();
|
||||
private _items: Array<T | IQuickPickSeparator> = [];
|
||||
private itemsUpdated = false;
|
||||
private _canSelectMany = false;
|
||||
@@ -331,6 +335,10 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
private _valueSelection: Readonly<[number, number]>;
|
||||
private valueSelectionUpdated = true;
|
||||
private _validationMessage: string;
|
||||
private _ok: boolean;
|
||||
private _customButton: boolean;
|
||||
private _customButtonLabel: string;
|
||||
private _customButtonHover: string;
|
||||
|
||||
quickNavigate: IQuickNavigateConfiguration;
|
||||
|
||||
@@ -339,6 +347,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this.disposables.push(
|
||||
this.onDidChangeValueEmitter,
|
||||
this.onDidAcceptEmitter,
|
||||
this.onDidCustomEmitter,
|
||||
this.onDidChangeActiveEmitter,
|
||||
this.onDidChangeSelectionEmitter,
|
||||
this.onDidTriggerItemButtonEmitter,
|
||||
@@ -367,6 +376,8 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
|
||||
onDidAccept = this.onDidAcceptEmitter.event;
|
||||
|
||||
onDidCustom = this.onDidCustomEmitter.event;
|
||||
|
||||
get items() {
|
||||
return this._items;
|
||||
}
|
||||
@@ -463,6 +474,42 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this.update();
|
||||
}
|
||||
|
||||
get customButton() {
|
||||
return this._customButton;
|
||||
}
|
||||
|
||||
set customButton(showCustomButton: boolean) {
|
||||
this._customButton = showCustomButton;
|
||||
this.update();
|
||||
}
|
||||
|
||||
get customLabel() {
|
||||
return this._customButtonLabel;
|
||||
}
|
||||
|
||||
set customLabel(label: string) {
|
||||
this._customButtonLabel = label;
|
||||
this.update();
|
||||
}
|
||||
|
||||
get customHover() {
|
||||
return this._customButtonHover;
|
||||
}
|
||||
|
||||
set customHover(hover: string) {
|
||||
this._customButtonHover = hover;
|
||||
this.update();
|
||||
}
|
||||
|
||||
get ok() {
|
||||
return this._ok;
|
||||
}
|
||||
|
||||
set ok(showOkButton: boolean) {
|
||||
this._ok = showOkButton;
|
||||
this.update();
|
||||
}
|
||||
|
||||
public inputHasFocus(): boolean {
|
||||
return this.visible ? this.ui.inputBox.hasFocus() : false;
|
||||
}
|
||||
@@ -547,6 +594,9 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
}
|
||||
this.onDidAcceptEmitter.fire(undefined);
|
||||
}),
|
||||
this.ui.onDidCustom(() => {
|
||||
this.onDidCustomEmitter.fire(undefined);
|
||||
}),
|
||||
this.ui.list.onDidChangeFocus(focusedItems => {
|
||||
if (this.activeItemsUpdated) {
|
||||
return; // Expect another event.
|
||||
@@ -697,12 +747,14 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this.ui.message.textContent = null;
|
||||
this.ui.inputBox.showDecoration(Severity.Ignore);
|
||||
}
|
||||
this.ui.customButton.label = this.customLabel;
|
||||
this.ui.customButton.element.title = this.customHover;
|
||||
this.ui.list.matchOnDescription = this.matchOnDescription;
|
||||
this.ui.list.matchOnDetail = this.matchOnDetail;
|
||||
this.ui.list.matchOnLabel = this.matchOnLabel;
|
||||
this.ui.setComboboxAccessibility(true);
|
||||
this.ui.inputBox.setAttribute('aria-label', QuickPick.INPUT_BOX_ARIA_LABEL);
|
||||
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: true, list: true, message: !!this.validationMessage } : { title: !!this.title || !!this.step, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage });
|
||||
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: true, list: true, message: !!this.validationMessage } : { title: !!this.title || !!this.step, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage, customButton: this.customButton, ok: this.ok });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,6 +900,7 @@ export class QuickInputService extends Component implements IQuickInputService {
|
||||
private countContainer: HTMLElement;
|
||||
private okContainer: HTMLElement;
|
||||
private ok: Button;
|
||||
private customButtonContainer: HTMLElement;
|
||||
private ui: QuickInputUI;
|
||||
private comboboxAccessibility = false;
|
||||
private enabled = true;
|
||||
@@ -855,6 +908,7 @@ export class QuickInputService extends Component implements IQuickInputService {
|
||||
private inQuickOpenContext: IContextKey<boolean>;
|
||||
private contexts: { [id: string]: IContextKey<boolean>; } = Object.create(null);
|
||||
private onDidAcceptEmitter = this._register(new Emitter<void>());
|
||||
private onDidCustomEmitter = this._register(new Emitter<void>());
|
||||
private onDidTriggerButtonEmitter = this._register(new Emitter<IQuickInputButton>());
|
||||
private keyMods: Writeable<IKeyMods> = { ctrlCmd: false, alt: false };
|
||||
|
||||
@@ -1013,6 +1067,14 @@ export class QuickInputService extends Component implements IQuickInputService {
|
||||
this.onDidAcceptEmitter.fire();
|
||||
}));
|
||||
|
||||
this.customButtonContainer = dom.append(headerContainer, $('.quick-input-action'));
|
||||
const customButton = new Button(this.customButtonContainer);
|
||||
attachButtonStyler(customButton, this.themeService);
|
||||
customButton.label = localize('custom', "Custom");
|
||||
this._register(customButton.onDidClick(e => {
|
||||
this.onDidCustomEmitter.fire();
|
||||
}));
|
||||
|
||||
const message = dom.append(container, $(`#${this.idPrefix}message.quick-input-message`));
|
||||
|
||||
const progressBar = new ProgressBar(container);
|
||||
@@ -1098,9 +1160,11 @@ export class QuickInputService extends Component implements IQuickInputService {
|
||||
visibleCount,
|
||||
count,
|
||||
message,
|
||||
customButton,
|
||||
progressBar,
|
||||
list,
|
||||
onDidAccept: this.onDidAcceptEmitter.event,
|
||||
onDidCustom: this.onDidCustomEmitter.event,
|
||||
onDidTriggerButton: this.onDidTriggerButtonEmitter.event,
|
||||
ignoreFocusOut: false,
|
||||
keyMods: this.keyMods,
|
||||
@@ -1330,6 +1394,7 @@ export class QuickInputService extends Component implements IQuickInputService {
|
||||
this.visibleCountContainer.style.display = visibilities.visibleCount ? '' : 'none';
|
||||
this.countContainer.style.display = visibilities.count ? '' : 'none';
|
||||
this.okContainer.style.display = visibilities.ok ? '' : 'none';
|
||||
this.customButtonContainer.style.display = visibilities.customButton ? '' : 'none';
|
||||
this.ui.message.style.display = visibilities.message ? '' : 'none';
|
||||
this.ui.list.display(!!visibilities.list);
|
||||
this.ui.container.classList[visibilities.checkAll ? 'add' : 'remove']('show-checkboxes');
|
||||
|
||||
Reference in New Issue
Block a user