Skip to content

Latest commit

 

History

History
471 lines (242 loc) · 9.16 KB

Dialog.md

File metadata and controls

471 lines (242 loc) · 9.16 KB

@serenity-is/corelib / Dialog

Class: Dialog

Wrapper for different types of dialogs, including jQuery UI, Bootstrap modals, and Panels.

Constructors

new Dialog()

new Dialog(opt?): Dialog

Creates a new dialog. The type of the dialog will be determined based on the availability of jQuery UI, Bootstrap, and the options provided.

Parameters

opt?

DialogOptions

Optional configuration for the dialog

Returns

Dialog

Defined in

src/base/dialogs.tsx:91

Properties

defaults

static defaults: DialogOptions

Default set of dialog options

Defined in

src/base/dialogs.tsx:141


messageDefaults

static messageDefaults: MessageDialogOptions

Default set of message dialog options

Defined in

src/base/dialogs.tsx:155

Accessors

result

Get Signature

get result(): string

The result code of the button that is clicked. Also attached to the dialog element as data-dialog-result

Returns

string

Defined in

src/base/dialogs.tsx:184


type

Get Signature

get type(): DialogProviderType

Returns the type of the dialog, or null if no dialog on the current element or if the element is null, e.g. dialog was disposed

Returns

DialogProviderType

Defined in

src/base/dialogs.tsx:365

Methods

close()

Call Signature

close(): this

Closes dialog setting the result to null

Returns

this

Defined in

src/base/dialogs.tsx:189

Call Signature

close(result): this

Closes dialog with the result set to value

Parameters
result

string

Returns

this

Defined in

src/base/dialogs.tsx:191


dispose()

dispose(): void

Disposes the dialog, removing it from the DOM and unbinding all event handlers.

Returns

void

Defined in

src/base/dialogs.tsx:551


getContentNode()

getContentNode(): HTMLElement

Gets the body/content element of the dialog

Returns

HTMLElement

Defined in

src/base/dialogs.tsx:379


getDialogNode()

getDialogNode(): HTMLElement

Gets the dialog element of the dialog

Returns

HTMLElement

Defined in

src/base/dialogs.tsx:384


getEventsNode()

getEventsNode(): HTMLElement

Gets the node that receives events for the dialog. It's .ui-dialog-content, .modal, or .panel-body

Returns

HTMLElement

Defined in

src/base/dialogs.tsx:389


getFooterNode()

getFooterNode(): HTMLElement

Gets the footer element of the dialog

Returns

HTMLElement

Defined in

src/base/dialogs.tsx:394


getHeaderNode()

getHeaderNode(): HTMLElement

Gets the header element of the dialog

Returns

HTMLElement

Defined in

src/base/dialogs.tsx:399


onClose()

onClose(handler, opt?): this

Adds an event handler that is called when the dialog is closed. If the opt.before is true, the handler is called before the dialog is closed and the closing can be cancelled by calling preventDefault on the event object.

Parameters

handler

(result?, e?) => void

The event handler function

opt?

Options to determine whether the handler should be called before the dialog is closed, and whether the handler should be called only once. The default for oneOff is true unless opt.before is true.

opt.before

boolean

opt.oneOff

boolean

Returns

this

The dialog instance

Defined in

src/base/dialogs.tsx:226


onOpen()

onOpen(handler, opt?): this

Adds an event handler that is called when the dialog is opened. If the second parameter is true, the handler is called before the dialog is opened and the opening can be cancelled by calling preventDefault on the event object. Note that if the dialog is not yet initialized, the first argument must be the body element of the dialog.

Parameters

handler

(e?) => void

The event handler function

opt?

Options to determine whether the handler should be called before the dialog is opened, and whether the handler should be called only once. The default for oneOff is true unless opt.before is true.

opt.before

boolean

opt.oneOff

boolean

Returns

this

The dialog instance

Defined in

src/base/dialogs.tsx:282


open()

open(): Dialog

Opens the dialog

Returns

Dialog

Defined in

src/base/dialogs.tsx:330


title()

Call Signature

title(): string

Gets the title text of the dialog

Returns

string

Defined in

src/base/dialogs.tsx:352

Call Signature

title(value): this

Sets the title text of the dialog.

Parameters
value

string

Returns

this

Defined in

src/base/dialogs.tsx:354


getInstance()

static getInstance(el): Dialog

Gets the dialog instance for the specified element.

Parameters

el

HTMLElement | ArrayLike<HTMLElement>

Returns

Dialog

The dialog instance, or null if the element is not a dialog.

Defined in

src/base/dialogs.tsx:176


onClose()

static onClose(el, handler, opt?): void

Adds an event handler that is called when the dialog is closed. If the opt.before is true, the handler is called before the dialog is closed and the closing can be cancelled by calling preventDefault on the event object. Note that if the dialog is not yet initialized, the first argument must be the body element of the dialog.

Parameters

el

HTMLElement | ArrayLike<HTMLElement>

handler

(result?, e?) => void

The event handler function

opt?

Options to determine whether the handler should be called before the dialog is closed, and whether the handler should be called only once. The default for oneOff is true unless opt.before is true.

opt.before

boolean

opt.oneOff

boolean

Returns

void

Defined in

src/base/dialogs.tsx:251


onOpen()

static onOpen(el, handler, opt?): void

Adds an event handler that is called when the dialog is opened. If the second parameter is true, the handler is called before the dialog is opened and the opening can be cancelled by calling preventDefault on the event object. Note that if the dialog is not yet initialized, the first argument must be the body element of the dialog.

Parameters

el

HTMLElement | ArrayLike<HTMLElement>

handler

(e?) => void

The event handler function

opt?

Options to determine whether the handler should be called before the dialog is opened, and whether the handler should be called only once. The default for oneOff is true unless opt.before is true.

opt.before

boolean

opt.oneOff

boolean

Returns

void

The dialog instance

Defined in

src/base/dialogs.tsx:307