GridAdapter
Framework adapter that enables Vue 3 component integration with the grid’s light DOM configuration API.
The adapter is automatically registered when using the TbwGrid component. For advanced use cases, you can manually register:
import { GridElement } from '@toolbox-web/grid';import { GridAdapter } from '@toolbox-web/grid-vue';
// One-time registrationGridElement.registerAdapter(new GridAdapter());Declarative usage with TbwGrid:
Section titled “Declarative usage with TbwGrid:”<TbwGrid :rows="data" :grid-config="config"> <TbwGridColumn field="status"> <template #cell="{ value, row }"> <StatusBadge :value="value" /> </template> </TbwGridColumn></TbwGrid>Methods
Section titled “Methods”processGridConfig()
Section titled “processGridConfig()”Processes a Vue grid configuration, converting Vue component references and VNode-returning render functions to DOM-returning functions.
This is idempotent — already-processed configs pass through safely.
processGridConfig(config: GridConfig<TRow>): GridConfig<TRow>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GridConfig<TRow> | Vue grid config with possible component/VNode references |
Returns
Section titled “Returns”GridConfig<TRow> - Processed config with DOM-returning functions
processConfig()
Section titled “processConfig()”FrameworkAdapter.processConfig implementation.
Called automatically by the grid’s set gridConfig setter.
processConfig(config: GridConfig<TRow>): GridConfig<TRow>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GridConfig<TRow> |
processTypeDefaults()
Section titled “processTypeDefaults()”Processes typeDefaults, converting Vue component/VNode references to DOM-returning functions.
processTypeDefaults(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, BaseTypeDefault<TRow>>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
typeDefaults | Record<string, TypeDefault<TRow>> | Vue type defaults with possible component references |
Returns
Section titled “Returns”Record<string, BaseTypeDefault<TRow>> - Processed TypeDefault record
processColumn()
Section titled “processColumn()”Processes a single column configuration, converting Vue component references and VNode-returning render functions to DOM-returning functions.
processColumn(column: ColumnConfig<TRow>): ColumnConfig<TRow>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
column | ColumnConfig<TRow> | Vue column config |
Returns
Section titled “Returns”ColumnConfig<TRow> - Processed ColumnConfig with DOM-returning functions
setTypeDefaults()
Section titled “setTypeDefaults()”Sets the type defaults map for this adapter. Called by TbwGrid when it receives type defaults from context.
setTypeDefaults(defaults: TypeDefaultsMap | null): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
defaults | TypeDefaultsMap | unknown |
canHandle()
Section titled “canHandle()”Determines if this adapter can handle the given element. Checks if a renderer or editor is registered for this element.
canHandle(element: HTMLElement): booleanParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
createRenderer()
Section titled “createRenderer()”Creates a view renderer function that renders a Vue component and returns its container DOM element.
createRenderer(element: HTMLElement): ColumnViewRenderer<TRow, TValue> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
createEditor()
Section titled “createEditor()”Creates an editor spec that renders a Vue component for cell editing. Returns a function that creates the editor DOM element.
createEditor(element: HTMLElement): ColumnEditorSpec<TRow, TValue> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
parseDetailElement()
Section titled “parseDetailElement()”Framework adapter hook called by MasterDetailPlugin during attach(). Parses the <tbw-grid-detail> element and returns a Vue-based renderer.
parseDetailElement(detailElement: Element): (row: TRow, rowIndex: number) => HTMLElement | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
detailElement | Element |
parseResponsiveCardElement()
Section titled “parseResponsiveCardElement()”Framework adapter hook called by ResponsivePlugin during attach(). Parses the <tbw-grid-responsive-card> element and returns a Vue-based renderer.
parseResponsiveCardElement(cardElement: Element): (row: TRow, rowIndex: number) => HTMLElement | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cardElement | Element |
getTypeDefault()
Section titled “getTypeDefault()”Gets type-level defaults from the type defaults map.
This enables application-wide type defaults configured via GridTypeProvider. The returned TypeDefault contains renderer/editor functions that render Vue components into the grid’s cells.
getTypeDefault(type: string): TypeDefault<TRow> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
cleanup()
Section titled “cleanup()”Cleanup all mounted Vue apps.
cleanup(): voidunmount()
Section titled “unmount()”Unmount a specific container (e.g., detail panel, tool panel). Finds the matching entry in mountedViews by container reference and properly destroys the Vue app to prevent memory leaks.
unmount(container: HTMLElement): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
container | HTMLElement |
releaseCell()
Section titled “releaseCell()”Called when a cell’s content is about to be wiped. Destroys editor Vue apps whose container is inside the cell.
releaseCell(cellEl: HTMLElement): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cellEl | HTMLElement |