You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The composable provides the basic API for implementing table features.
This is done by taking the provided user table data and transform and extend it.
Every feature can perform some transformations and wrap rendered slots.
In the first step, we implement the basic useTableFeature composable.
It should be enough to implement a Sort feature.
Implementation details
The basic useTableFeature composable API should look like this:
// we need to intersect the empty array, so the array entry types are inferredexportconstuseTableFeatures=<TextendsTableFeature<any,any,any,any,any,any>[]|[],TFeatureNameextendssymbol=ExtractTFeatureName<T>,>(features: T,)=>{return{/** Takes the column definition and maps all, calls mutation func and maps at the end to RendererCell */
enrichTableData,/** Takes the column definition and creates a RenderHeader for each, adds actions from features */
enrichHeaders,// the combined `watch` for all features
watcheSources,};}exporttypeTableEntry={id: string|number;[key: PropertyKey]: unknown;};exporttypeTableFeature<TEntryextendsTableEntry,TFeatureNameextendssymbol,>={/** * Unique name and identifier of the table feature */name: TFeatureName;/** * An array of reactive states that should trigger a table re-calcualtion */watch: WatchSource[];/** * Allows modifying the table state as a whole. */mutation?: {func: (state: EntryState<TEntry>[])=>EntryState<TEntry>[];};/** * Allows the modification of the header columns before render. */header?: {/** actions are shown after the header label, later `listComponent` can be added */actions?: {iconComponent: Component,onTrigger?: (event: MouseEvent)=>void}[];};};
Relates to #1852
Implemented basic `useTableFeature` API based on a simple sorting
feature.
The API and the feature set will be extended in future tickets.
---------
Co-authored-by: Lars Rickert <lars.rickert@mail.schwarz>
Relates to #1852
- Added `features` prop, which exposes the `useDataGridFeature` API to
allow devs to use custom and pre-defined features
- Expose onyx provided data-grid features via a re-export called
`DataGridFeatures`
- Added `DataGridFeatures.useSorting` feature, with support for custom
configuration
- Fixed issue where `OnyxDataGrid` didn't update on sort change: A deep
watcher is necessary, even when a non-shallow ref is used
Depends on
Description
The composable provides the basic API for implementing table features.
This is done by taking the provided user table data and transform and extend it.
Every feature can perform some transformations and wrap rendered slots.
In the first step, we implement the basic
useTableFeature
composable.It should be enough to implement a
Sort
feature.Implementation details
The basic
useTableFeature
composable API should look like this:Reference implementation
Design
https://www.figma.com/design/YfEUBOHk4J4nYrk04geswG/Onyx-Component-Library?node-id=4435-44768&node-type=text&m=dev
Acceptance criteria
useTableFeature
composable is used to create input for the rendererwithSorting
Feature is implemented using the APIDefinition of Done
apps/demo-app/src/views/HomeView.vue
Approval
The text was updated successfully, but these errors were encountered: