@fabwcie/free-drawing / components/Modal/ConfirmModal / ConfirmModal
Class: 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 the dialog belongs to
options?
Partial<ConfirmModalOptions> = {}
Message, button labels and actions, missing ones taken from confirmModalDefaultOpts
Returns
ConfirmModal
Overrides
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:31
Backdrop around the dialog (only with backdrop option), shown and hidden with it
Inherited from
$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
$modal:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:19
Dialog element (role="dialog", aria-modal), holds header, body and footer
Inherited from
$modalBody
$modalBody:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:23
Body of the dialog: content of the dialog
Inherited from
$modalFooter
$modalFooter:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:25
Footer of the dialog: buttons of the dialog
Inherited from
$modalHeader
$modalHeader:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:21
Header of the dialog: title and close button, removed when showHeader option is false
Inherited from
drawer
drawer:
Drawer
Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:16
Drawer the dialog belongs to
Overrides
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
modal
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
modal
ConfirmModal
Returns
void
options
options:
ModalOptions
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:27
Options of the dialog, merged with default ones
Inherited from
Methods
_initEvents()
private_initEvents():void
Defined in: packages/free-drawing/src/components/Modal/ConfirmModal.ts:78
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:218
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
destroy()
destroy():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:288
Hides the dialog and removes it from the page
Returns
void
Inherited from
hide()
hide():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:261
Hides the dialog and gives focus back to the element which opened it, else to the drawer
Returns
void
Inherited from
isVisible()
isVisible():
boolean
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:281
Whether the dialog is shown
Returns
boolean
True while the dialog is shown
Inherited from
setBodyContent()
setBodyContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:210
Replaces the body with an HTML string
Parameters
content
string
HTML markup of the body, empty to clear it
Returns
void
Inherited from
setFooterContent()
setFooterContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:226
Replaces the footer with an HTML string
Parameters
content
string
HTML markup of the footer (buttons), empty to clear it
Returns
void
Inherited from
setHeaderContent()
setHeaderContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:200
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
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:86
Title in header
Parameters
title
string
Text of the title (nothing without header)
Returns
void
Inherited from
show()
show():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:234
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