mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Clean up dialog event hide reasons (#14566)
* Clean up dialog event hide reasons * Remove done
This commit is contained in:
@@ -104,6 +104,8 @@ const defaultOptions: IModalOptions = {
|
||||
|
||||
const tabbableElementsQuerySelector = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]';
|
||||
|
||||
export type HideReason = 'close' | 'cancel' | 'ok';
|
||||
|
||||
export abstract class Modal extends Disposable implements IThemable {
|
||||
protected _useDefaultMessageBoxLocation: boolean = true;
|
||||
protected _messageElement?: HTMLElement;
|
||||
@@ -317,7 +319,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* Overridable to change behavior of escape key
|
||||
*/
|
||||
protected onClose(e?: StandardKeyboardEvent) {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,7 +332,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
if (target.closest('.modal-content')) {
|
||||
return;
|
||||
} else {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +340,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* Overridable to change behavior of enter key
|
||||
*/
|
||||
protected onAccept(e?: StandardKeyboardEvent) {
|
||||
this.hide();
|
||||
this.hide('ok');
|
||||
}
|
||||
|
||||
private handleBackwardTab(e: KeyboardEvent) {
|
||||
@@ -499,7 +501,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
/**
|
||||
* Hides the modal and removes key listeners
|
||||
*/
|
||||
protected hide(reason?: string, currentPageName?: string): void {
|
||||
protected hide(reason?: HideReason, currentPageName?: string): void {
|
||||
this._modalShowingContext.get()!.pop();
|
||||
this._bodyContainer!.remove();
|
||||
this.disposableStore.clear();
|
||||
|
||||
Reference in New Issue
Block a user