Usage
Signature:
interface MessageBannerElement<K extends string | number = string | number,D extends ojMessageBanner.MessageBannerItem = MessageBannerItem>
Generic Parameters
Parameter Description K Type of key of the dataprovider. It can either be a string or a number. D Type of the data from the dataprovider. It must extend the MessageBannerItem type.
Typescript Import Format
//To typecheck the element APIs, import as below.
import { MessageBannerElement } from "ojs/ojmessagebanner";
//For the transpiled javascript to load the element's module, import as below
import "ojs/ojmessagebanner";
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.
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.
-
DynamicSlots.MessageBannerTemplateContext (Dynamic)
-
Note: When the template is executed for each item, it will have access to the binding context containing the following properties: oj.ojMessageBanner.MessageBannerTemplateContext
Structure of template context used for dynamic templatesNote: For additional information see detail-template-value.
Properties of $current:
Name Type Argument Description dataD The data for the current message indexnumber The zero-based index of the current message keyK The key for the current message metadataItemMetadata.<K> <optional>
The metadata for the current message
Attributes
-
data* :oj.ojMessageBanner.DataProvider.<K, D>
-
Data for the Message Banner component. This data is used for rendering each banner message. This is a required attribute. If an application needs to initialize the component with no initial messages, it would need to provide an empty DataProvider. When the application wants to show messages, it can then add new data to the existing DataProvider. See MutableArrayDataProvider for more details.
When specifying a DataProvider for the data attribute, you need to provide the keyAttributes for the DataProvider. The oj-message-banner component expects a single attribute of type string or number as the key of the DataProvider. When the data is updated this key attribute will be used to determine whether a new message is being added or an existing message is being updated. This is required for performing necessary animations. When the application replaces the DataProvider, the component assumes that all the messages are newly added irrespective of their keys and performs animation accordingly.
Names
Item Name Property dataProperty change event dataChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed -
detail-template-value :string|(itemContext: ojcommontypes.ItemContext<K, D>) => string | null
-
Applications can use this property to provide the name of a template or a function that returns the name of a template to use for rendering the detail content. When a template name is provided as a value for this property, the corresponding template will be used for rendering the detail content for all the messages. If applications want to use a different template for different messages, they can provide a function that returns a template name instead. The provided function should accept an ItemContext and return a key to a template for rendering the corresponding message's detail content. The value returned from this function should be a key to one of the dynamic template slots provided. If the returned value is not one of the keys of the provided dynamic template slots, the component will throw an Error. If the function returns null or undefined, the component then will perform default rendering of the detail content using the detail property of the corresponding message. If an application specifies both detail and a valid detail-template-value, the detail-template-value will take precedence and the corresponding template will be used for rendering the detail content.
Note: For additional information see DynamicSlots.MessageBannerTemplateContext.
Names
Item Name Property detailTemplateValueProperty change event detailTemplateValueChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-detail-template-value-changed -
type :"section"|"page"
-
A Banner message can have a different look and feel. For example, when using page-level messaging the messages need to be rendered from edge to edge without any outline. On the other hand, when they are being used in a section of a page or a dialog, they need to be rendered with an outline. This attribute can be used to specify where the component is being used so that it will render the messages accordingly.
- Default Value:
'section'
Names
Item Name Property typeProperty change event typeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-type-changed
Events
-
ojClose
-
Note: The event detail contains the following properties: oj.ojMessageBanner.CloseActionDetail<Key, Data>
Triggered when a user tries to close a message through UI interaction. The application should listen to this event and remove the corresponding message item from the data which would then result in the message being closed. If the application fails to remove the message item from the data, then no change will be done in the UI by the component and the message will stay in the UI opened.See Events and Listeners for additional information.
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesobject An object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Returns:
- Type
- void
Type Definitions
Documentation-only Types
Note: Type definitions in this section have been provided for documentation purposes and cannot be imported into application code.
-
AttributeExprFilter<D>
-
The interface for AttributeExprFilter
Properties:
Name Type attributestring | keyof D filter(item: D, index: number | undefined, array: D[] | undefined) => boolean op"$co" | "$eq" | "$ew" | "$pr" | "$gt" | "$ge" | "$lt" | "$le" | "$ne" | "$regex" | "$sw" valueany -
AttributeExprFilterDef<D>
-
The interface for AttributeExprFilterDefD>
Properties:
Name Type attributestring | keyof D op"$co" | "$eq" | "$ew" | "$pr" | "$gt" | "$ge" | "$lt" | "$le" | "$ne" | "$regex" | "$sw" valueany -
AttributeFilter<D>
-
The interface for AttributeFilter
Properties:
Name Type Argument collationOptions{ sensitivity?: 'base' | 'accent' | 'case' | 'variant'; } <optional>
filter(item: D, index: number | undefined, array: D[] | undefined) => boolean op"$co" | "$eq" | "$ew" | "$pr" | "$gt" | "$ge" | "$lt" | "$le" | "$ne" | "$regex" | "$sw" valueRecursivePartial<D> -
AttributeFilterDef<D>
-
Properties:
Name Type Argument collationOptions{ sensitivity?: 'base' | 'accent' | 'case' | 'variant'; } <optional>
op"$co" | "$eq" | "$ew" | "$pr" | "$gt" | "$ge" | "$lt" | "$le" | "$ne" | "$regex" | "$sw" valueRecursivePartial<D> -
CloseActionDetail<K,D>
-
The event payload for the ojClose event. Note: This has a similar structure to the ItemContext. We define it here because using ItemContext will not generate the docs for this payload.
Properties:
Name Type Argument Description dataD The data that was used to render the message. keyK The key for the message. metadataItemMetadata.<K> <optional>
The metadata of the message. -
CompoundFilter<D>
-
The interface for CompoundFilter
Properties:
Name Type criteriaArray<ojMessageBanner.CompoundFilterDef<D> | oj.ojMessageBanner.AttributeFilterDef.<D> | ojMessageBanner.AttributeExprFilterDef<D>> filter(item: D, index: number | undefined, array: D[] | undefined) => boolean op"$and" | "$or" -
CompoundFilterDef<D>
-
The interface for CompoundFilterDef
Properties:
Name Type criteriaArray<ojMessageBanner.CompoundFilterDef<D> | oj.ojMessageBanner.AttributeFilterDef.<D> | ojMessageBanner.AttributeExprFilterDef<D>> op"$and" | "$or" -
DataProvider<K,D>
-
The interface for DataProvider
Properties:
Name Type Argument Description addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options: boolean | AddEventListenerOptions | undefined) => void The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) containsKeys(parameters: ojMessageBanner.FetchByKeysParameters<K>) => Promise<ContainsKeysResults<K>> Check if rows are contained by keys createOptimizedKeyMap(initialMap: Map<K, D> | undefined) => Map<K, D> <optional>
Returns an empty Map which will efficiently store Keys returned by the DataProvider createOptimizedKeySet(initialSet: Set<K> | undefined) => Set<K> <optional>
Return an empty Set which is optimized to store keys dispatchEvent(event: Event) => boolean The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) fetchByKeys(parameters: ojMessageBanner.FetchByKeysParameters<K>) => Promise<FetchByKeysResults<K, D>> Fetch rows by keys fetchByOffset(parameters: ojMessageBanner.FetchByOffsetParameters<D>) => Promise<FetchByOffsetResults<K, D>> Fetch rows by offset fetchFirstFetchFunc<K, D> Fetch the first block of data getCapabilityoj.ojMessageBanner.DedupCapability Determines whether this DataProvider defines certain features. getTotalSizefunction Returns a Promise which resolves to the total size which is -1 if unknown count. isEmptyfunction Returns a string that indicates if this data provider is empty. Valid values are: "yes": this data provider is empty. "no": this data provider is not empty. "unknown": it is not known if this data provider is empty until a fetch is made. removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options: boolean | EventListenerOptions | undefined) => void The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) -
DedupCapability
-
Properties:
Name Type type"none" | "global" | "iterator" -
ExtendedCompoundFilter<D>
-
The interface for ExtendedCompoundFilter
Properties:
Name Type criteriaArray<ojMessageBanner.TextFilterDef | oj.ojMessageBanner.ExtendedCompoundFilterDef.<D> | oj.ojMessageBanner.AttributeFilterDef.<D> | oj.ojMessageBanner.AttributeExprFilterDef.<D> | ojMessageBanner.NestedFilterDef<D>> filter(item: D, index: number | undefined, array: D[] | undefined) => boolean op"$and" | "$or" -
ExtendedCompoundFilterDef<D>
-
The interface for ExtendedCompoundFilterDef
Properties:
Name Type criteriaArray<ojMessageBanner.ExtendedCompoundFilterDef<D> | oj.ojMessageBanner.TextFilterDef | oj.ojMessageBanner.AttributeFilterDef.<D> | oj.ojMessageBanner.AttributeExprFilterDef.<D> | ojMessageBanner.NestedFilterDef<D>> op"$and" | "$or" -
FetchAttribute
-
Properties:
Name Type Argument Description attributesArray<string | ojMessageBanner.FetchAttribute> <optional>
Optional attributes property which specifies at least which attributes of the value we want to include. If not specified then the default attributes are included. If the value is a primitive then this is ignored. Expressions like "!" and "@default" are also supported. e.g. ['!lastName', '@default'] for everything except 'lastName'. For only 'firstName' and 'lastName' we'd have ['firstName', 'lastName']. Order does not matter when namestring The name of the attribute or sub object or related object. -
FetchByKeysParameters<K>
-
The interface for FetchByKeysParameters
Properties:
Name Type Argument Description attributesArray<string | ojMessageBanner.FetchAttribute> <optional>
attributes to include in the result. If specified, then at least these set of attributes will be included in each row results. If not specified then the default attributes will be included. keysSet<K> scope"global" | "local" <optional>
signalAbortSignal <optional>
Optional signal to be assocated with fetchByKeys request so that the request can be aborted this signal later -
FetchByOffsetParameters<D>
-
The interface for FetchByOffsetParameters
Properties:
Name Type Argument Description attributesArray<string | ojMessageBanner.FetchAttribute> <optional>
attributes to include in the result. If specified, then at least these set of attributes will be included in each row results. If not specified then the default attributes will be included. clientIdsymbol <optional>
Optional symbol that can uniquely identify the consumer of the DataProvider. filterCriterionoj.ojMessageBanner.Filter.<D> <optional>
filter criterion to apply. includeFilteredRowCount"enabled" | "disabled" <optional>
Optional property to request that the total filtered row count be included in the fetch result. offsetnumber signalAbortSignal <optional>
Optional signal to be assocated with fetchByOffset request so that the request can be aborted this signal later sizenumber <optional>
# of rows to fetch starting from offset. If fewer than that number of rows exist, the fetch will succeed but be truncated. sortCriteriaArray.<oj.ojMessageBanner.SortCriterion.<D>> <optional>
sort criteria to apply. -
Filter<D> :(oj.ojMessageBanner.AttributeFilter.<D>|oj.ojMessageBanner.AttributeExprFilter.<D>|oj.ojMessageBanner.CompoundFilter.<D>|oj.ojMessageBanner.ExtendedCompoundFilter.<D>|oj.ojMessageBanner.NestedFilter.<D>|oj.ojMessageBanner.TextFilter.<D>)
-
-
MessageBannerItem
-
An object representing a single message in the Message Banner component.
Properties:
Name Type Argument Description closeAffordance"on" | "off" <optional>
Defines whether or not to include the close icon for the message detailstring <optional>
Defines the detail text of the message severity"none" | "confirmation" | "info" | "warning" | "error" <optional>
Defines the severity of the message soundstring <optional>
Defines the sound to be played when opening the message summarystring <optional>
Defines the primary text of the message timestampstring <optional>
Defines the timestamp for the message in ISO format -
MessageBannerTemplateContext<K,D>
-
Structure of template context used for dynamic templates
Properties:
Name Type Argument Description dataD The data for the current message indexnumber The zero-based index of the current message keyK The key for the current message metadataItemMetadata.<K> <optional>
The metadata for the current message -
NestedFilter<D>
-
The interface for NestedFilter
Properties:
Name Type attributestring | keyof D criterionoj.ojMessageBanner.NestedFilterDef.<D> | oj.ojMessageBanner.AttributeFilterDef.<D> | oj.ojMessageBanner.AttributeExprFilterDef.<D> | oj.ojMessageBanner.ExtendedCompoundFilterDef.<D> filter(item: D, index: number | undefined, array: D[] | undefined) => boolean op"$exists" -
NestedFilterDef<D>
-
The interface for NestedFilterDef
Properties:
Name Type attributestring | keyof D criterionoj.ojMessageBanner.NestedFilterDef.<D> | oj.ojMessageBanner.AttributeFilterDef.<D> | oj.ojMessageBanner.AttributeExprFilterDef.<D> | oj.ojMessageBanner.ExtendedCompoundFilterDef.<D> op"$exists" -
SortCriterion<D>
-
Properties:
Name Type Description attributekeyof D sort attribute. direction"ascending" | "descending" sort direction. -
TextFilter<D>
-
The interface for TextFilter
Properties:
Name Type Argument filter(item: D, index: number | undefined, array: D[] | undefined) => boolean matchBy"phrase" | "startsWith" | "contains" | "fuzzy" | "unknown" <optional>
textstring -
TextFilterDef
-
Properties:
Name Type Argument matchBy"phrase" | "startsWith" | "contains" | "fuzzy" | "unknown" <optional>
textstring