MessageDialog
Singleton
A singleton class which shows common dialogs, similar to the native browser APIs (though these methods do not block the UI thread):
- confirm shows a confirmation dialog with Ok / Cancel buttons
- alert shows a dialog with a message
- prompt shows a dialog with a text input field
targetElement.classList.add('widgetRow'); new Button({ appendTo : targetElement, text : 'confirm()', onClick : async() => { const result = await MessageDialog.confirm({ title : 'The big question', message : 'Do one legged ducks swim in circles?', okButton : 'Yes', cancelButton : 'No', rootElement : targetElement // Not needed outside of docs }); Toast.show(`You answered ${result === MessageDialog.okButton ? 'Yes' : 'No'}`); } }); new Button({ appendTo : targetElement, text : 'prompt()', onClick : async() => { const result = await MessageDialog.prompt({ title : 'Information required!', message : 'Enter your name', rootElement : targetElement // Not needed outside of docs }); if (result.button === MessageDialog.okButton) { Toast.show(`You wrote ${result.text}`); } } }); new Button({ appendTo : targetElement, text : 'alert()', onClick : () => { MessageDialog.alert({ title : 'Upgrade required!', message : 'Internet Explorer is not supported!', rootElement : targetElement // Not needed outside of docs }); } }); Note: Class is a singleton and all members listed below can be accessed as static ones.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Delayable class, or subclass thereof.
-
Identifies an object as an instance of Events class, or subclass thereof.
-
Identifies an object as an instance of KeyMap class, or subclass thereof.
-
Identifies an object as an instance of Localizable class, or subclass thereof.
-
Identifies an object as an instance of RTL class, or subclass thereof.
-
Identifies an object as an instance of Resizable class, or subclass thereof.
-
Identifies an object as an instance of State class, or subclass thereof.
-
Identifies an object as an instance of Toolable class, or subclass thereof.
-
A class property getter for the default values of internal properties for this class.
-
Returns an array containing all existing Widgets. The returned array is generated by this call and is not an internal structure.
-
This property yields
trueif the currently focused element has been reached through other means than mouse click. If theactiveElementmatches:focus-visible. -
Get/set the recomposeAsync config for all widgets. Setting this value will set the config for all existing widgets and will be the default value for newly created widgets. Set this value to
nullto disable the default setting for new widgets while leaving existing widgets unaffected.
-
The enum value for the Cancel button
-
The enum value for the OK button
-
An empty array that can be used as a default value.
-
An empty object that can be used as a default value.
-
Identifies an object as an instance of Container class, or subclass thereof.
-
Identifies an object as an instance of Panel class, or subclass thereof.
-
Identifies an object as an instance of Popup class, or subclass thereof.
-
Identifies an object as an instance of Widget class, or subclass thereof.
-
Returns the first widget in this Container.
-
Number of columns to use in a grid layout. Applied as
grid-template-columns: repeat(n, auto). Also applies theb-columnsCSS class to the container. -
This property is
trueuntil the container's initialitemsconfig has been processed. This property is set tofalseby theupdateItemsmethod. -
Returns
trueif currently setting values. Allow fields to change highlighting to distinguishing between initially setting values and later on changing values. -
Returns
trueif all contained fields are valid, otherwisefalse -
Returns the last widget in this Container.
-
Get toolbar Toolbar docked to the bottom of the panel
-
Get toolbar Toolbar docked to the top of the panel
-
Element (or the id of an element) to append this widget's element to. Can be configured, or set once at runtime. To access the element of a rendered widget, see element.
-
Set HTML content safely, without disturbing sibling elements which may have been added to the contentElement by plugins and features. When specifying html, this widget's element will also have the htmlCls added to its classList, to allow targeted styling.
-
Get widgets elements dataset or assign to it
-
Get this widget's encapsulating HTMLElement, which is created along with the widget but added to DOM at render time.
-
Get this widget's primary focus holding element if this widget is itself focusable, or contains focusable widgets.
-
Returns an object describing the focus and keyboard navigation aspects of this widget's focusElement.
-
Returns this widget's focusElement if that element can currently be given focus (e.g., this widget is not disabled, or hidden).
-
This property is set to
trueafter processing the initial paint for the widget. It remainsfalseduring the initial paint. The intended use for this flag is to avoid processing that will be handled by the first paint (similar to not firing events during the widget's initial configuration). If this field istrue, the initial paint has already taken place, otherwise, it has yet to run. This field differs fromisPaintedwhich checks that the widget's element is attached to the DOM. -
Get/set widgets id
-
Element (or element id) to insert this widget before. If provided, appendTo config is ignored.
-
Element (or element id) to append this widget element to, as a first child. If provided, appendTo config is ignored.
-
The child element which scrolls if any. This means the element used by the scrollable.
-
Returns the
DomClassListfor this widget's class. This object should not be mutated. -
Get/set widgets elements style. The setter accepts a cssText string or a style config object, the getter always returns a CSSStyleDeclaration
-
Set to
trueto make this widget take all available space in the visible viewport. -
Override to attach the keyMap keydown event listener to something else than this.element
-
Override to make keyMap resolve subcomponent actions to something else than this.features.
-
Get/set this widget's
align-selfflexbox setting. This may be set to modify how this widget is aligned within the cross axis of a flexbox layout container. -
Controls whether the panel is collapsed (the body of the panel is hidden while only the header is visible). Only valid if the panel is collapsible.
-
This property is
trueif the panel is currently collapsing. -
This property is
trueif the panel is currently either collapsing or expanding. -
This property is
trueif the panel is currently expanding. -
Get element's
offsetHeightor sets itsstyle.height, or specified height if element no created yet. -
Get element's margin property. This may be configured as a single number or a
TRBLformat string. numeric-only values are interpreted as pixels. -
Get/set element's
maxHeight. Getter returns max-height from elements style, which is always a string. Setter accepts either aStringor aNumber(which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels. -
Get/set elements maxWidth. Getter returns max-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.
-
Get/set element's
minHeight. Getter returns min-height from elements style, which is always a string. Setter accepts either aStringor aNumber(which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels. -
Get/set elements minWidth. Getter returns min-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.
-
Accessor to the Scroller which can be used to both set and read scroll information.
-
Get elements
offsetWidthor sets itsstyle.width, or specified width if element not created yet. -
Returns a copy of the full configuration which was used to configure this object.
-
This property is set to
truebefore theconstructorreturns. -
This property is set to
trueon entry to the destroy method. It remains on the objects after returning fromdestroy(). If isDestroyed istrue, this property will also betrue, so there is no need to test for both (for example,comp.isDestroying || comp.isDestroyed). -
Get id assigned by user (not generated id)
-
Get/set element's disabled state. Set to
'inert'to also set theinertDOM attribute. -
true if no id was set, will use generated id instead (widget1, ...). Toggle automatically on creation
-
Get the global LocaleHelper
-
Get the global LocaleManager
-
Returns the modal mask element for this Popup correctly positioned just below this Popup.
-
Specify
trueto match fields by theirnameproperty only when assigning a record, without falling back toref. -
Returns
trueif this instance implements the State interface. -
Returns
trueif this instance is ready to participate in state activities. -
Gets or sets a component's state
-
Returns an object whose truthy keys are the config properties to include in this object's state.
-
Determines visibility by checking if the Widget is hidden, or any ancestor is hidden and that it has an element which is visible in the DOM
-
Programmatic control over which column to start in when used in a grid layout.
-
Returns
trueif this class usescompose()to render itself. -
This widget's twin that is placed in an overflow menu when this widget has been hidden by its owner, typically a Toolbar due to overflow. The
overflowTwinis created lazily by ensureOverflowTwin. -
Programmatic control over how many columns to span when used in a grid layout.
-
Get this Widget's next sibling in the parent Container, or, if not in a Container, the next sibling widget in the same parentElement.
-
Get this Widget's parent when used as a child in a Container,
-
Get this Widget's previous sibling in the parent Container, or, if not in a Container, the previous sibling widget in the same parentElement.
-
The number of visible child items shown in this Container.
-
An object which contains a map of descendant widgets keyed by their ref. All descendant widgets will be available in the
widgetMap.
Functions
Functions are methods available for calling on the class-
This optional class method is called when a class is mixed in using the mixin() method.
-
Clear caches, forces all calls to fromCache to requery dom. Called on render/rerender.
-
Internal function used to hook destroy() calls when using thisObj
-
Internal function used restore hooked destroy() calls when using thisObj
-
Auto detaches listeners registered from start, if set as detachable
-
Internal function used to run a callback function after an event is triggered
-
Removes all listeners registered to this object by the application.
-
Only valid for floating Widgets. Moves to the front of the visual stacking order.
-
Called on keyMapElement keyDown
-
Called by the Base constructor after all configs have been applied.
-
Collapse the panel.
-
Expand the panel.
-
Performs the configured closeAction upon this popup. By default, the popup hides. The closeAction may be configured as
'destroy'.
Triggers: beforeClose
-
This method is called following an update to the widget's rendered DOM.
-
Disable the widget
-
Enable the widget
-
Unmask the widget
Events
Events are triggered for certain actions in this class and can be listened for to react to those actions in your code-
This event is fired after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.
Event handlers
Event handlers are callbacks called as a result of certain actions in this class-
This event is called after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.
CSS variables
CSS variables that can be set to adjust appearance| Name | Description |
|---|---|
| --b-message-dialog-button-min-width | MessageDialog button min-width |
| --b-message-dialog-min-width | MessageDialog min-width |