mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
add custom width support for dialogs (#10641)
* add custom width support for dialogs * comments * fix test
This commit is contained in:
@@ -56,9 +56,11 @@ export interface IModalDialogStyles {
|
||||
footerBorderTopColor?: Color;
|
||||
}
|
||||
|
||||
export type DialogWidth = 'narrow' | 'medium' | 'wide' | number;
|
||||
|
||||
export interface IModalOptions {
|
||||
isFlyout?: boolean;
|
||||
isWide?: boolean;
|
||||
width?: DialogWidth;
|
||||
isAngular?: boolean;
|
||||
hasBackButton?: boolean;
|
||||
hasTitleIcon?: boolean;
|
||||
@@ -69,7 +71,7 @@ export interface IModalOptions {
|
||||
|
||||
const defaultOptions: IModalOptions = {
|
||||
isFlyout: true,
|
||||
isWide: false,
|
||||
width: 'narrow',
|
||||
isAngular: false,
|
||||
hasBackButton: false,
|
||||
hasTitleIcon: false,
|
||||
@@ -175,16 +177,18 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
builderClass += ' flyout-dialog';
|
||||
}
|
||||
|
||||
if (this._modalOptions.isWide) {
|
||||
builderClass += ' wide';
|
||||
}
|
||||
|
||||
this._bodyContainer = DOM.$(`.${builderClass}`, { role: 'dialog', 'aria-label': this._title });
|
||||
const top = this.layoutService.offset?.top ?? 0;
|
||||
this._bodyContainer.style.top = `${top}px`;
|
||||
this._modalDialog = DOM.append(this._bodyContainer, DOM.$('.modal-dialog'));
|
||||
this._modalContent = DOM.append(this._modalDialog, DOM.$('.modal-content'));
|
||||
|
||||
if (typeof this._modalOptions.width === 'number') {
|
||||
this._modalDialog.style.width = `${this._modalOptions.width}px`;
|
||||
} else {
|
||||
this._modalDialog.classList.add(`${this._modalOptions.width}-dialog`);
|
||||
}
|
||||
|
||||
if (!isUndefinedOrNull(this._title)) {
|
||||
this._modalHeaderSection = DOM.append(this._modalContent, DOM.$('.modal-header'));
|
||||
if (this._modalOptions.hasBackButton) {
|
||||
|
||||
Reference in New Issue
Block a user