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().
Implementation is installed by @toolbox-web/grid-vue/features/master-detail
via registerDetailRendererBridge. Returns undefined if the
master-detail feature has not been imported, or if no TbwGridDetailPanel
was registered for this grid.
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().
Implementation is installed by @toolbox-web/grid-vue/features/responsive
via registerResponsiveCardRendererBridge. Returns undefined if
the responsive feature has not been imported, or if no TbwGridResponsiveCard
was registered for this grid.
parseResponsiveCardElement(cardElement: Element): (row: TRow, rowIndex: number) => HTMLElement | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cardElement | Element |
createToolPanelRenderer()
Section titled “createToolPanelRenderer()”Framework adapter hook called by the grid core when a <tbw-grid-tool-panel>
needs a renderer. Returns a function that renders Vue tool panel content
into the shell’s accordion container.
Uses a wrapper-detach pattern for the cleanup callback: the cleanup
synchronously removes a wrapper div from the container, so the shell’s
subsequent contentArea.innerHTML = '' (during accordion collapse) sees
an empty container and cannot disturb Vue’s still-attached teleport
children. Vue then unmounts asynchronously on the next microtask
against the orphaned wrapper without throwing NotFoundError.
createToolPanelRenderer(element: HTMLElement): (container: HTMLElement) => void | () => void | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
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, _gridEl: HTMLElement): TypeDefault<TRow> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string | |
_gridEl | HTMLElement |
cleanup()
Section titled “cleanup()”Cleanup all teleport entries.
cleanup(): voidunmount()
Section titled “unmount()”Unmount a specific container (e.g., detail panel, tool panel). Currently a no-op for teleport-based rendering — the TeleportManager’s prune pass handles disconnected containers automatically.
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 teleports whose container is inside the cell.
releaseCell(cellEl: HTMLElement): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cellEl | HTMLElement |