Usage
Signature:
interface DialogElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { DialogElement } from "ojs/ojdialog";
//For the transpiled javascript to load the element's module, import as below
import "ojs/ojdialog";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Styling Classes
-
.oj-dialog-footer-separator
-
Class that works with the
oj-dialog-footer
class to specify a separator between the dialog body and the dialog footer. This class should be applied to the div that specifiesslot="footer"
for the dialog.
Note that for themes that have a built-in footer separator (specifically the iOS theme), this class has no effect.
-
.oj-dialog-title
-
Class used to format the dialog title. Automatically created headers use oj-dialog-title to format the title.
For user-defined headers, you may want to use the oj-dialog-title class so that the title in your user-defined header is stylistically similar to a default title.
-
.oj-focus-highlight
-
Under normal circumstances this class is applied automatically. It is documented here for the rare cases that an app developer needs per-instance control.
The oj-focus-highlight class applies focus styling that may not be desirable when the focus results from pointer interaction (touch or mouse), but which is needed for accessibility when the focus occurs by a non-pointer mechanism, for example keyboard or initial page load.
The application-level behavior for this component is controlled in the theme by the$focusHighlightPolicy
SASS variable; however, note that this same variable controls the focus highlight policy of many components and patterns. The values for the variable are:
nonPointer:
oj-focus-highlight is applied only when focus is not the result of pointer interaction. Most themes default to this value.
all:
oj-focus-highlight is applied regardless of the focus mechanism.
none:
oj-focus-highlight is never applied. This behavior is not accessible, and is intended for use when the application wishes to use its own event listener to precisely control when the class is applied (see below). The application must ensure the accessibility of the result.
To change the behavior on a per-instance basis, the application can set the SASS variable as desired and then use event listeners to toggle this class as needed.
-
.oj-progress-bar-embedded
-
Optional class used to format a progress bar when embedded in the dialog.
-
CSS Variables
-
Title
-
Cancel icon
Name | Type | Description |
---|---|---|
--oj-dialog-border-radius |
<length> | <percentage> | Dialog border radius |
--oj-dialog-bg-color |
<color> | Dialog background color |
--oj-dialog-border-color |
<color> | Dialog border color |
--oj-dialog-box-shadow |
Dialog box shadow | |
--oj-dialog-header-bg-color |
<color> | Dialog header background color |
--oj-dialog-header-border-color |
<color> | Border color between the dialog header and body |
--oj-dialog-header-padding |
<length> | Dialog header padding |
--oj-dialog-body-padding |
<length> | Dialog body padding |
--oj-dialog-footer-padding |
<length> | Dialog footer padding |
Name | Type | Description |
---|---|---|
--oj-dialog-title-font-size |
<length> | Dialog title font size |
--oj-dialog-title-line-height |
<number> | Dialog title line height |
--oj-dialog-title-font-weight |
<font_weight> | Dialog title font weight |
--oj-dialog-title-text-color |
<color> | Dialog title text color |
Name | Type | Description |
---|---|---|
--oj-dialog-cancel-icon-margin-top |
<length> | Dialog cancel icon margin top |
--oj-dialog-cancel-icon-margin-end |
<length> | Dialog cancel icon margin end |
Slots
JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.
-
Default
-
The default slot is the dialog's body. The
<oj-dialog>
element accepts DOM nodes as children for the default slot. The default slot can also be named with "body". For styling, the default body slot will be rendered with theoj-dialog-body
class.- Since:
- 4.0.0
-
body
-
The
body
slot is for the dialog's body area. The<oj-dialog>
element accepts DOM nodes as children with the body slot. For styling, the body slot will be rendered with theoj-dialog-body
class. Note that "body" is the default slot.- Since:
- 4.0.0
-
contextMenu
-
The contextMenu slot is set on the
oj-menu
within this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.
To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc of the individual components for details.
Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.
- Deprecated:
-
Since Description 13.0.0
This web component no longer supports launching a context menu.
-
footer
-
The
footer
slot is for the dialog's footer area. The<oj-dialog>
element accepts DOM nodes as children with the footer slot. For styling, the footer slot will be rendered with theoj-dialog-footer
class.- Since:
- 4.0.0
-
header
-
The
If a header slot is not specified by the user, a header will automatically be created. The automatically generated header will contain a close button, and the header title will be set to the dialog title.header
slot is for the dialog's header area. The<oj-dialog>
element accepts DOM nodes as children with the header slot. For styling, the header slot will be rendered with theoj-dialog-header
class.- Since:
- 4.0.0
Attributes
-
cancel-behavior :"icon"|"escape"|"none"
-
Specifies the cancel behavior of the dialog. The default value depends on the theme. In the Redwood theme, the default is
"none"
. In the deprecated Alta web theme, the default is"icon"
. In the deprecated Alta mobile themes (Android, iOS, Windows), the default is"none"
.Note that the cancelBehavior applies to both automatic and user-defined headers. So, a user-defined header will use the cancelBehavior setting or a theme-specific default.
Supported Values:
Value Description escape
The dialog will close when it has focus and user presses the escape (ESC) key. A close icon will not be created. icon
A close icon will automatically be created. The dialog will close when it has focus and user presses the escape (ESC) key. none
A close icon will not be created. No actions will be associated with the escape key. Names
Item Name Property cancelBehavior
Property change event cancelBehaviorChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-cancel-behavior-changed
-
dialog-title :string|null
-
Specify the title of the dialog. null is the default.
Names
Item Name Property dialogTitle
Property change event dialogTitleChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-dialog-title-changed
-
drag-affordance :"title-bar"|"none"
-
Specifies the drag affordance. The default value depends on the theme. In the Redwood theme, the default is
"none"
. In the deprecated Alta web theme, the default is"title-bar"
. In the deprecated Alta mobile themes (Android, iOS, Windows), the default is"none"
.Supported Values:
Value Description none
The dialog will not be draggable. title-bar
The dialog will be draggable by the title bar. Names
Item Name Property dragAffordance
Property change event dragAffordanceChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-drag-affordance-changed
-
initial-visibility :"hide"|"show"
-
Set the initial visibility of the dialog.
- Default Value:
"hide"
Supported Values:
Value Description hide
The dialog will stay hidden until the open()
method is called.show
The dialog will automatically open upon initialization. Names
Item Name Property initialVisibility
Property change event initialVisibilityChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-initial-visibility-changed
-
modality :"modal"|"modeless"
-
Defines the modality of the dialog.
- Default Value:
"modal"
Supported Values:
Value Description modal
The dialog is modal. Interactions with other page elements are disabled. Modal dialogs overlay other page elements. modeless
Defines a modeless dialog. Names
Item Name Property modality
Property change event modalityChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-modality-changed
-
position :oj.ojDialog.Position
-
Position object is used to establish the location the dialog will appear relative to another element. oj.ojDialog.Position defines "my" alignment "at" the alignment "of" some other thing which can be "offset" by so many pixels.
The "my" and "at" properties define alignment points relative to the dialog and other element. The "my" property represents the dialog's alignment where the "at" property represents the other element that can be identified by "of". The values of these properties describe horizontal and vertical alignments.
If none of the
Deprecated v3.0.0 jQuery UI position syntax; Use of a percent unit with "my" or "at" is not supported.position
properties are specified, the default dialog position is "center" on desktop and "bottom" on phone.Names
Item Name Property position
Property change event positionChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-position-changed
-
position.at :Object
-
Defines which position on the target element ("of") to align the positioned element against.
Names
Item Name Property position.at
-
position.at.horizontal :"start"|"end"|"left"|"center"|"right"
-
- Default Value:
"center"
Supported Values:
Value Description center
end
evaluates to "right" in LTR mode and "left" in RTL mode. left
right
start
evaluates to "left" in LTR mode and "right" in RTL mode. Names
Item Name Property position.at.horizontal
-
position.at.vertical :"top"|"center"|"bottom"
-
- Default Value:
"center"
Supported Values:
Value bottom
center
top
Names
Item Name Property position.at.vertical
-
position.collision :"flip"|"fit"|"flipfit"|"none"
-
Rule for alternate alignment.
- Default Value:
"fit"
Supported Values:
Value Description fit
Shift the element away from the edge of the window. flip
Flip the element to the opposite side of the target and the collision detection is run again to see if it will fit. Whichever side allows more of the element to be visible will be used. flipfit
First applies the flip logic, placing the element on whichever side allows more of the element to be visible. Then the fit logic is applied to ensure as much of the element is visible as possible. none
No collision detection. Names
Item Name Property position.collision
-
position.my :Object
-
Defines which edge on the dialog to align with the target ("of") element.
Names
Item Name Property position.my
-
position.my.horizontal :"start"|"end"|"left"|"center"|"right"
-
- Default Value:
"center"
Supported Values:
Value Description center
end
evaluates to "right" in LTR mode and "left" in RTL mode. left
right
start
evaluates to "left" in LTR mode and "right" in RTL mode. Names
Item Name Property position.my.horizontal
-
position.my.vertical :"top"|"center"|"bottom"
-
- Default Value:
"center"
Supported Values:
Value bottom
center
top
Names
Item Name Property position.my.vertical
-
position.of :string|Object
-
Which element to position the dialog against. If the value is a string, it should be a selector or the literal string value of
window
. Otherwise, a point of x,y. When a point is used, the values are relative to the whole document. Page horizontal and vertical scroll offsets need to be factored into this point - see UIEvent pageX, pageY.- Default Value:
"window"
Names
Item Name Property position.of
-
position.offset :Object
-
Defines a point offset in pixels from the ("my") alignment.
Names
Item Name Property position.offset
-
position.offset.x :number
-
Horizontal alignment offset.
- Default Value:
0
Names
Item Name Property position.offset.x
-
position.offset.y :number
-
Vertical alignment offset.
- Default Value:
0
Names
Item Name Property position.offset.y
-
resize-behavior :"resizable"|"none"
-
Specifies the resizeBehavior of the dialog. The default value depends on the theme. In the Redwood theme, the default is
"none"
. In the deprecated Alta web theme, the default is"resizable"
. In the deprecated Alta mobile themes (Android, iOS, Windows), the default is"none"
.Supported Values:
Value Description none
The dialog will not be interactively resizable. resizable
The dialog will be interactively resizable. Names
Item Name Property resizeBehavior
Property change event resizeBehaviorChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-resize-behavior-changed
-
translations :object|null
-
A collection of translated resources from the translation bundle, or
null
if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.If the component does not contain any translatable resource, the default value of this attribute will be
null
. If not, an object containing all resources relevant to the component.If this component has translations, their documentation immediately follows this doc entry.
Names
Item Name Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-translations-changed
-
(nullable) translations.label-close-icon :string
-
Label for the dialog close button.
See the translations attribute for usage examples.
- Default Value:
"Close"
- Since:
- 3.0
Names
Item Name Property translations.labelCloseIcon
Events
-
ojAnimateEnd
-
Triggered when a default animation has ended, such as when the component is being opened/closed or a child item is being added/removed. This event is not triggered if the application has called preventDefault on the animateStart event.
- Deprecated:
-
Since Description 12.1.0
This web component no longer supports this event.
- "open" - when a dialog component is opened
- "close" - when a dialog component is closed
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Argument Description action
"open" | "close" The action that triggered the animation.
The number of actions can vary from component to component. Suggested values are:element
Element <not nullable>
target of animation -
ojAnimateStart
-
Triggered when a default animation is about to start, such as when the component is being opened/closed or a child item is being added/removed. The default animation can be cancelled by calling
event.preventDefault
.- Deprecated:
-
Since Description 12.1.0
This web component no longer supports this event.
- "open" - when a dialog component is opened
- "close" - when a dialog component is closed
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Argument Description action
"open" | "close" The action that triggers the animation.
The number of actions can vary from component to component. Suggested values are:element
Element <not nullable>
target of animation endCallback
function():void <not nullable>
If the event listener calls event.preventDefault to cancel the default animation, It must call the endCallback function when it finishes its own animation handling and any custom animation has ended. -
ojBeforeClose
-
Triggered before the dialog is dismissed via the
close()
method. The close can be cancelled by callingevent.preventDefault()
.Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description event
Event a custom event -
ojBeforeOpen
-
Triggered before the dialog is launched via the
open()
method. The open can be cancelled by callingevent.preventDefault()
.Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description event
Event a custom event -
ojClose
-
Triggered after the dialog is dismissed via the
close()
method.Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description event
Event a custom event -
ojFocus
-
Triggered after focus has been transferred to the dialog.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description event
Event a custom event -
ojOpen
-
Triggered after the dialog is launched via the
open()
method.Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description event
Event a custom event -
ojResize
-
Triggered when the dialog is being resized.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description originalEvent
Object the underlying UI Event object originalPosition
Object the original CSS position of the dialog originalSize
Object the original size of the dialog position
Object the current CSS position of the dialog size
Object the current size of the dialog -
ojResizeStart
-
Triggered when the user starts resizing the dialog.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description originalEvent
Object the underlying UI Event object originalPosition
Object the original CSS position of the dialog originalSize
Object the original size of the dialog position
Object the current CSS position of the dialog size
Object the current size of the dialog -
ojResizeStop
-
Triggered when the user stops resizing the dialog.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description originalEvent
Object the underlying UI Event object originalPosition
Object the original CSS position of the dialog originalSize
Object the original size of the dialog position
Object the current CSS position of the dialog size
Object the current size of the dialog
Methods
-
close : {void}
-
Closes the dialog.
Fires:
Returns:
- Type
- void
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description property
string The property name to get. Supports dot notation for subproperty access. - Since:
- 4.0.0
Returns:
- Type
- any
Example
let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');
-
isOpen : {boolean}
-
Returns true if the dialog is currently open. This method does not accept any arguments.
The "open" state reflects the period of time the dialog is visible, including open and close animations.Returns:
true
if the dialog is open.- Type
- boolean
-
open : {void}
-
Opens the dialog.
Fires:
Returns:
- Type
- void
-
refresh : {void}
-
Refresh the dialog. Typically used after dynamic content is added to a dialog.
Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description properties
Object An object containing the property and value pairs to set. - Since:
- 4.0.0
Returns:
- Type
- void
Example
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});
-
setProperty(property, value) : {void}
-
Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description property
string The property name to set. Supports dot notation for subproperty access. value
any The new value to set the property to. - Since:
- 4.0.0
Returns:
- Type
- void
Example
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");
Type Definitions
-
Position
-
- "flip" the element to the opposite side of the target and the collision detection is run again to see if it will fit. Whichever side allows more of the element to be visible will be used.
- "fit" shift the element away from the edge of the window.
- "flipfit" first applies the flip logic, placing the element on whichever side allows more of the element to be visible. Then the fit logic is applied to ensure as much of the element is visible as possible.
- "none" no collision detection.
Properties:
Name Type Argument Description at
oj.ojDialog.PositionAlign <optional>
Defines which position on the target element ("of") to align the positioned element against. collision
"flip" | "fit" | "flipfit" | "none" <optional>
Rule for alternate alignment. my
oj.ojDialog.PositionAlign <optional>
Defines which edge on the popup to align with the target ("of") element. of
string | oj.ojDialog.PositionPoint <optional>
Which element to position the popup against. If the value is a string, it should be a selector or the literal string value of window
. Otherwise, a point of x,y. When a point is used, the values are relative to the whole document. Page horizontal and vertical scroll offsets need to be factored into this point - see UIEvent pageX, pageY.offset
oj.ojDialog.PositionPoint <optional>
Defines a point offset in pixels from the ("my") alignment. -
PositionAlign
-
- "start" evaluates to "left" in LTR mode and "right" in RTL mode.
- "end" evaluates to "right" in LTR mode and "left" in RTL mode.
Properties:
Name Type Argument Description horizontal
"start" | "end" | "left" | "center" | "right" <optional>
Horizontal alignment. vertical
"top" | "bottom" | "center" <optional>
Vertical alignment. -
PositionPoint
-
Properties:
Name Type Argument Description x
number <optional>
Horizontal alignment offset. y
number <optional>
Vertical alignment offset.