Usage
Signature:
interface CCardViewElement<K extends string | number,D>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CCardViewElement } from "oj-c/card-view";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/card-view";
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.
-
itemTemplate
-
The
itemTemplate
slot is used to specify the template for rendering each item in the CardView. The slot content must be a <template> element.When the template is executed for each item, it will have access to the binding context containing the following properties:
- $current - an object that contains information for the current item.
Properties of $current:
Name Type Argument Description data
D The data of the item. Note this is made available primarily to ease migration. Applications should get the data from the item property instead. isTabbable
boolean <optional>
A boolean indicating whether the item is in tabbable mode or not. Template elements should not be tab-stops when the item is not in tabbable mode, this context can be used to implement conditional behavior for all tabbable child elements. item
Item.<K, D> Contains the data and metadata of the item. -
noData
-
The
noData
slot is used to specify the content to display when the CardView is empty. The slot content must be a <template> element. If not specified then a default no data message will be displayed.
Attributes
-
columns :"auto"
-
Specifies the exact number of columns to render. By default, CardView will determine the number of columns based on width of the CardView and the width of the cards.
- Default Value:
auto
Supported Values:
Value Description auto
CardView will determine the number of columns based on width of the CardView and the width of the cards Names
Item Name Property columns
Property change event columnsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-columns-changed
-
(readonly) current-item :K
-
The item that currently has keyboard focus
- Supports writeback:
true
Names
Item Name Property currentItem
Property change event currentItemChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-current-item-changed
-
data :(DataProvider.<K, D>|null)
-
The data source for CardView. Must be of type DataProvider.
- 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
-
focus-behavior :"content"|"card"
-
Specifies which focus behavior CardView should use for an item that has single focusable element during keyboard navigation. When the focusBehavior is 'card', the focus will be on the root of CardView and it will do logical focus on the card. When the focusBehavior is 'content', the first focusable element within the card will get focus. Note that when set to 'content', there should only be one focusable element within the card. If that's not the case, a warning will be logged and the focus behavior will be reset to 'card'.
- Default Value:
"card"
Names
Item Name Property focusBehavior
Property change event focusBehaviorChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-focus-behavior-changed
-
gutter-size :"xs"|"sm"|"md"|"lg"|"xl"
-
Specifies size of the gutter between columns and rows. Possible values are: 'xs', 'sm', 'md', 'lg' and 'xl'. The default value is 'sm'.
- Default Value:
"sm"
Names
Item Name Property gutterSize
Property change event gutterSizeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-gutter-size-changed
-
initial-animation :"slideUp"|"slideDown"
-
Specify animation when cards are initially rendered. Possible values are: 'slideUp' and 'slideDown
- Default Value:
"slideUp"
Names
Item Name Property initialAnimation
Property change event initialAnimationChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-initial-animation-changed
-
reorderable :{ items?: 'enabled' | 'disabled' }
-
The reorder option contains a subset of options for reordering items.
The following options are supported:
- items: Enable or disable reordering the items within the same CardView using drag and drop or keyboard. Specify 'enabled' to enable reordering. Setting the value to
"disabled"
or setting the"reorderable"
property tonull
(or omitting it), disables reordering support.
Names
Item Name Property reorderable
Property change event reorderableChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-reorderable-changed
- items: Enable or disable reordering the items within the same CardView using drag and drop or keyboard. Specify 'enabled' to enable reordering. Setting the value to
-
reorderable.items :"disabled"|"enabled"
-
- Default Value:
"disabled"
Names
Item Name Property reorderable.items
-
scroll-policy-options :{ fetchSize?: number; scroller?: string }
-
scrollPolicy options.
The following options are supported:
- fetchSize: The number of items fetched each time when scroll to the end.
- scroller: The css selector that locates the element in which CardView 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-c-card-view element is used.
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
-
- Default Value:
25
Names
Item Name Property scrollPolicyOptions.fetchSize
-
scroll-policy-options.scroller :string
-
Names
Item Name Property scrollPolicyOptions.scroller
-
selected :ImmutableKeySet.<K>
-
The current selected items in the CardView. An empty KeySet indicates nothing is selected. In addition, AllKeySetImpl set can be used to represent select all state.
- Supports writeback:
true
Names
Item Name Property selected
Property change event selectedChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selected-changed
-
selection-mode :"multiple"|"none"|"single"
-
The type of selection behavior that is enabled on the CardView. This attribute controls the number of selections that can be made via selection gestures at any given time.
If
single
ormultiple
is specified, selection gestures will be enabled, and the CardView's selection styling will be applied to all items specified by the selection and selected attributes. Ifnone
is specified, selection gestures will be disabled, and the CardView's selection styling will not be applied to any items specified by the selection and selected attributes.Changing the value of this attribute will not affect the value of the selection or selected attributes.
- Default Value:
"none"
Supported Values:
Value Description multiple
Multiple items can be selected at the same time. none
Selection is disabled. single
Only a single item can be selected at a time. Names
Item Name Property selectionMode
Property change event selectionModeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-mode-changed
Events
-
ojReorder
-
Triggered after items are reordered within CardView via drag and drop or keyboard.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description itemKeys
Array<K> An array of keys of the items that are moved referenceKey
K | null The key of the item where the moved items will be dropped after. If the moved items were dropped at the very beginning, the referenceKey will be null. reorderedKeys
Array<K> An array of keys matching the new order of items
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description property
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
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
The property name to set. Supports dot notation for subproperty access. value
The new value to set the property to. Returns:
- Type
- void