Element: <oj-stream-list>

Oracle® JavaScript Extension Toolkit (JET)
20.1.0

G60074-01

Since:
  • 9.0.0
Module:
  • ojstreamlist

Note: This component is not supported in the following themes: Alta

QuickNav

Attributes


JET StreamList

Description: The JET StreamList displays data in an activity stream feed.

//StreamList with a DataProvider
<oj-stream-list data="[[dataProvider]]">
</oj-stream-list>

Accessibility

To make your component accessible, the application is required to include contextual information for screen readers using one or more the following methods as appropriate:
  • aria-label
  • aria-labelledby

Progressive Loading

This component supports loading indicators. Loading indicators are only shown after a pre-defined time has elapsed during the data provider fetch.

Touch End User Information

Target Gesture Action
Item Tap Focus on the item.

Keyboard End User Information

Target Key Action
Item UpArrow Move focus to the previous item according to the data order.
DownArrow Move focus to the next item according to the data order.
F2 Enters Actionable mode. This enables keyboard action on elements inside the item, including navigate between focusable elements inside the item. It can also be used to exit actionable mode if already in actionable mode.
Esc Exits Actionable mode.
Tab When in Actionable Mode, navigates to next focusable element within the item. If the last focusable element is reached, shift focus back to the first focusable element. When not in Actionable Mode, navigates to next focusable element on the page (outside of the component).
Shift+Tab When in Actionable Mode, navigates to previous focusable element within the item. If the first focusable element is reached, shift focus back to the last focusable element. When not in Actionable Mode, navigates to previous focusable element on the page (outside of the component).
Group Item LeftArrow Collapse the current item if it is expanded and is collapsible. For non-hierarchical data, do nothing.
RightArrow Expand the current item if it has children and is expandable. For non-hierarchical data, do nothing.


Usage

Signature:

interface StreamListElement<K extends string | number,D>

Generic Parameters
ParameterDescription
KType of key of the dataprovider
DType of data from the dataprovider
Typescript Import Format
//To typecheck the element APIs, import as below.
import { StreamListElement } from "ojs/ojstreamlist";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojstreamlist";

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.

groupTemplate

Note: When the template is executed for each item, it will have access to the binding context containing the following properties: oj.ojStreamList.ItemTemplateContext

The groupTemplate slot is used to specify the template for rendering each non-leaf item in the list. The slot content must be a <template> element.

If a groupTemplate is not specified the itemTemplate will be used as a fallback.

The content inside the template must have a single Element as the root node. It cannot have multiple root nodes, incluidng Text and Comment nodes. The root node also cannot be a JET Binding Element, you must wrap it with an Element node. If the content do contain multiple nodes, StreamList will take the first Element node it encountered and ignore the rest.

When the template is executed for each item, it will have access to the binding context containing the following properties:

Properties of $current:
Name Type Argument Description
data D The data for the current item being rendered
depth number <optional>
The zero-based depth of the current item, null if not a TreeDataProvider
key K The key of the current item being rendered
leaf boolean <optional>
If the current item has children, null if not a TreeDataProvider
parentKey K <optional>
The key of the parent current item being rendered, null if not a TreeDataProvider

itemTemplate

Note: When the template is executed for each item, it will have access to the binding context containing the following properties: oj.ojStreamList.ItemTemplateContext

The itemTemplate slot is used to specify the template for rendering each item in the list. The slot content must be a <template> element.

This slot is required or there will be no default rendering. If a groupTemplate is not specified the itemTemplate will be used as a fallback.

The content inside the template must have a single Element as the root node. It cannot have multiple root nodes, incluidng Text and Comment nodes. The root node also cannot be a JET Binding Element, you must wrap it with an Element node. If the content do contain multiple nodes, StreamList will take the first Element node it encountered and ignore the rest.

When the template is executed for each item, it will have access to the binding context containing the following properties:

Properties of $current:
Name Type Argument Description
data D The data for the current item being rendered
depth number <optional>
The zero-based depth of the current item, null if not a TreeDataProvider
key K The key of the current item being rendered
leaf boolean <optional>
If the current item has children, null if not a TreeDataProvider
parentKey K <optional>
The key of the parent current item being rendered, null if not a TreeDataProvider

Attributes

data :(oj.ojStreamList.DataProvider.<K, D>|null)

The data for StreamList. Must be of type DataProvider or TreeDataProvider
Default Value:
  • null
Names
Item Name
Property data
Property change event dataChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed

expanded :KeySet.<K>

Specifies the key set containing the keys of the items that should be expanded. Use the KeySetImpl class to specify items to expand. Use the AllKeySetImpl class to expand all items.
Default Value:
  • new KeySetImpl()
Supports writeback:
  • true
Names
Item Name
Property expanded
Property change event expandedChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-expanded-changed

scroll-policy :"loadAll"|"loadMoreOnScroll"

Specifies the mechanism used to scroll the data inside the StreamList. Possible values are: "loadMoreOnScroll", and "loadAll". When "loadMoreOnScroll" is specified, additional data is fetched when the user scrolls to the bottom of the StreamList. Note that the component must have a height specified or inside a height constraint element so that the component element is scrollable. When "loadAll" is specified, StreamList will fetch all the data when it is initially rendered.
Supported Values:
Value Description
loadAll Fetch and render all data.
loadMoreOnScroll Additional data is fetched when the user scrolls towards the bottom of the list.
Default Value:
  • 'loadMoreOnScroll'
Names
Item Name
Property scrollPolicy
Property change event scrollPolicyChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-scroll-policy-changed

scroll-policy-options :{ fetchSize?: number; maxCount?: number; scroller?: Element | QuerySelector | null; }

The following options are supported:
  • fetchSize: The number of items fetched each time when scroll to the end.
  • maxCount: Maximum rows which will be displayed before fetching more rows will be stopped.
  • scroller: The element which StreamList uses to determine the scroll position as well as the maximum scroll position where scroll to the end will trigger a fetch. If not specified then the oj-stream-list element is used.
When scrollPolicy is loadMoreOnScroll, the next block of rows is fetched when the user scrolls to the end of the component. The fetchSize option determines how many rows are fetched in each block.
Names
Item Name
Property scrollPolicyOptions
Property change event scrollPolicyOptionsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-scroll-policy-options-changed

scroll-policy-options.fetch-size :number

The number of items to fetch in each block.
Default Value:
  • 25
Names
Item Name
Property scrollPolicyOptions.fetchSize

scroll-policy-options.max-count :number

The maximum total number of items to fetch.
Default Value:
  • 500
Names
Item Name
Property scrollPolicyOptions.maxCount

scroll-policy-options.scroller :(string|Element|null)

The element or a CSS selector string to an element used to determine the scroll position as well as the maximum scroll position. See the Help documentation for more information.
Default Value:
  • null
Names
Item Name
Property scrollPolicyOptions.scroller

scroll-position :oj.ojStreamList.ScrollPositionType.<K>

The current scroll position of StreamList. The scroll position is updated when the vertical scroll position (or its scroller, as specified in scrollPolicyOptions.scroller) has changed. The value contains the y scroll position, the key of the item closest to the top of the viewport, as well as vertical offset from the position of the item to the actual scroll position.

The default value contains just the scroll position. Once data is fetched the 'key' and 'offsetY' sub-properties will be added. If there is no data then the 'key' sub-properties will not be available.

When setting the scrollPosition property, applications can change any combination of the sub-properties. If both key and y sub-properties are set at once then key will take precedent. If offsetY is specified, it will be used to adjust the scroll position from the position where the key of the item is located.

If a sparse object is set the other sub-properties will be populated and updated once StreamList has scrolled to that position.

Also, if scrollPolicy is set to 'loadMoreOnScroll' and the scrollPosition is set to a value outside of the currently rendered region, then the value of scrollPosition will be ignored.

Lastly, when a re-rendered is triggered by a refresh event from the DataProvider, or if the value for data attribute has changed, then the scrollPosition will by default remain at the top.

Supports writeback:
  • true
Names
Item Name
Property scrollPosition
Property change event scrollPositionChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-scroll-position-changed

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description
property string 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
properties object 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
property string The property name to set. Supports dot notation for subproperty access.
value any 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.

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: ojStreamList.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: ojStreamList.FetchByKeysParameters<K>) => Promise<FetchByKeysResults<K, D>> Fetch rows by keys
fetchByOffset (parameters: ojStreamList.FetchByOffsetParameters<D>) => Promise<FetchByOffsetResults<K, D>> Fetch rows by offset
fetchFirst FetchFunc<K, D> Fetch the first block of data
getCapability oj.ojStreamList.DedupCapability Determines whether this DataProvider defines certain features.
getTotalSize function Returns a Promise which resolves to the total size which is -1 if unknown count.
isEmpty function 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"

FetchAttribute

Properties:
Name Type Argument Description
attributes Array<string | ojStreamList.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
name string The name of the attribute or sub object or related object.

FetchByKeysParameters<K>

The interface for FetchByKeysParameters
Properties:
Name Type Argument Description
attributes Array<string | ojStreamList.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.
keys Set<K>
scope "global" | "local" <optional>
signal AbortSignal <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
attributes Array<string | ojStreamList.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.
clientId symbol <optional>
Optional symbol that can uniquely identify the consumer of the DataProvider.
filterCriterion 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.
offset number
signal AbortSignal <optional>
Optional signal to be assocated with fetchByOffset request so that the request can be aborted this signal later
size number <optional>
# of rows to fetch starting from offset. If fewer than that number of rows exist, the fetch will succeed but be truncated.
sortCriteria Array.<oj.ojStreamList.SortCriterion.<D>> <optional>
sort criteria to apply.

ItemTemplateContext<K,D>

Properties:
Name Type Argument Description
data D The data for the current item being rendered
depth number <optional>
The zero-based depth of the current item, null if not a TreeDataProvider
key K The key of the current item being rendered
leaf boolean <optional>
If the current item has children, null if not a TreeDataProvider
parentKey K <optional>
The key of the parent current item being rendered, null if not a TreeDataProvider

ScrollPositionType<K>

Properties:
Name Type Argument Default Description
key K <optional>
The key of the item. If DataProvider is used for data and the key does not exist in the DataProvider or if the item has not been fetched yet, then the value is ignored.
offsetY number <optional>
The vertical offset in pixels relative to the item identified by key.
parentKey K <optional>
The key of the parent if tree data.
y number <optional>
0 The vertical position in pixels.

SortCriterion<D>

Properties:
Name Type Description
attribute keyof D sort attribute.
direction "ascending" | "descending" sort direction.