Skip to content

@fabwcie/free-drawing / components/Modal/ConfirmModal

components/Modal/ConfirmModal ​

Classes ​

ConfirmModal ​

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:14

Confirmation dialog (alertdialog without header): a message, Cancel (focused first) and Confirm buttons. By default Cancel hides it and Confirm clears the drawing (see confirmModalDefaultOpts).

Extends

Constructors ​

Constructor ​

new ConfirmModal(drawer, options?): ConfirmModal

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:36

Create the dialog (hidden, without header) with its message and buttons

Parameters
drawer ​

Drawer

Drawer the dialog belongs to

options? ​

Partial<ConfirmModalOptions> = {}

Message, button labels and actions, missing ones taken from confirmModalDefaultOpts

Returns

ConfirmModal

Overrides

Modal.constructor

Properties ​

_options ​

_options: ConfirmModalOptions

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:28

Options of the confirmation (message, button labels, actions), merged with default ones

$backdrop ​

$backdrop: HTMLDivElement

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:53

Backdrop around the dialog (only with backdrop option), shown and hidden with it

Inherited from

Modal.$backdrop

$cancelBtn ​

$cancelBtn: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:20

Cancel button, runs ConfirmModal.onCancel

$confirmBtn ​

$confirmBtn: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:22

Confirm button (danger style), runs ConfirmModal.onConfirm

$message ​

$message: HTMLParagraphElement

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:18

Message asking confirmation, names the dialog

$modal: HTMLDivElement

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:41

Dialog element (role="dialog", aria-modal), holds header, body and footer

Inherited from

Modal.$modal

$modalBody ​

$modalBody: HTMLDivElement

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:45

Body of the dialog: content of the dialog

Inherited from

Modal.$modalBody

$modalFooter ​

$modalFooter: HTMLDivElement

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:47

Footer of the dialog: buttons of the dialog

Inherited from

Modal.$modalFooter

$modalHeader ​

$modalHeader: HTMLDivElement

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:43

Header of the dialog: title and close button, removed when showHeader option is false

Inherited from

Modal.$modalHeader

drawer ​

drawer: Drawer

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:16

Drawer the dialog belongs to

Overrides

Modal.drawer

onCancel ​

onCancel: (modal) => void

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:24

Action of the Cancel button, from options (default: hides the dialog)

Parameters

ConfirmModal

Returns

void

onConfirm ​

onConfirm: (modal) => void

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:26

Action of the Confirm button, from options (default: clears the drawing and hides the dialog)

Parameters

ConfirmModal

Returns

void

options ​

options: ModalOptions

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:49

Options of the dialog, merged with default ones

Inherited from

Modal.options

Methods ​

_initEvents() ​

private _initEvents(): void

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:87

Buttons run their action with the dialog (actions read at click: they can be replaced after creation)

Returns

void

appendBodyContent() ​

appendBodyContent(content): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:272

Adds text at the end of the body (as text, not parsed as HTML)

Parameters
content ​

string

Text added after the body content

Returns

void

Inherited from

Modal.appendBodyContent

destroy() ​

destroy(): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:346

Hides the dialog and removes it from the page

Returns

void

Inherited from

Modal.destroy

hide() ​

hide(): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:318

Hides the dialog and gives focus back to the element which opened it, else to the drawer, unless an element out of the drawer took it (field of the page or another drawer clicked)

Returns

void

Inherited from

Modal.hide

isVisible() ​

isVisible(): boolean

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:339

Whether the dialog is shown

Returns

boolean

True while the dialog is shown

Inherited from

Modal.isVisible

keepFocus() ​

protected keepFocus(...$preferred): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:195

Focus kept in the dialog when an update hid or disabled its focused element (its own button: start, stop...): on the first reachable of the given elements, else on the first element of the dialog, never on the page behind it

Parameters
$preferred ​

...HTMLElement[]

Elements to focus, in order of preference

Returns

void

Inherited from

Modal.keepFocus

setBodyContent() ​

setBodyContent(content): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:264

Replaces the body with an HTML string

Parameters
content ​

string

HTML markup of the body, empty to clear it

Returns

void

Inherited from

Modal.setBodyContent

setConfirmLabel() ​

setConfirmLabel(label): void

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:79

Label of the confirm button, naming the action (e.g. "Stop session")

Parameters
label ​

string

Text of the button, kept when the language changes

Returns

void

setFooterContent() ​

setFooterContent(content): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:280

Replaces the footer with an HTML string

Parameters
content ​

string

HTML markup of the footer (buttons), empty to clear it

Returns

void

Inherited from

Modal.setFooterContent

setHeaderContent() ​

setHeaderContent(content): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:254

Replaces the header with an HTML string (an empty string keeps the current header)

Parameters
content ​

string

HTML markup of the header

Returns

void

Inherited from

Modal.setHeaderContent

setMessage() ​

setMessage(message): void

Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:70

Message asking confirmation

Parameters
message ​

string

Text of the message, kept when the language changes

Returns

void

setTitle() ​

setTitle(title): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:108

Title in header

Parameters
title ​

string

Text of the title (nothing without header)

Returns

void

Inherited from

Modal.setTitle

show() ​

show(): void

Defined in: packages/free-drawing/src/components/Modal/Modal.ts:288

Shows the dialog and focuses its first focusable element. The element focused before is focused again on hide. While shown, Escape (closeOnEsc) and a click outside (closeOnClickOutside) hide it, Tab cycles in it.

Returns

void

Inherited from

Modal.show