import { TypeDefault as BaseTypeDefault, CellRenderContext, ColumnEditorContext } from '@toolbox-web/grid'; import { FilterPanelParams } from '@toolbox-web/grid/plugins/filtering'; import { InjectionKey, PropType, VNode } from 'vue'; /** * Type default configuration for Vue applications. * * Inherits every core {@link BaseTypeDefault} property (which is itself a * partial `ColumnConfig` — `format`, `width`, `sortable`, `cellClass`, * `filterable`, …) and widens the renderer/editor slots to accept Vue render * functions. * * @example * ```ts * import type { TypeDefault } from '@toolbox-web/grid-vue'; * import CountryFlag from './CountryFlag.vue'; * import CountrySelect from './CountrySelect.vue'; * * const countryDefault: TypeDefault = { * width: 140, * renderer: (ctx) => h(CountryFlag, { code: ctx.value }), * editor: (ctx) => h(CountrySelect, { * modelValue: ctx.value, * 'onUpdate:modelValue': ctx.commit, * }), * }; * ``` * @since 0.3.0 */ export interface TypeDefault extends Omit, 'renderer' | 'editor' | 'editorParams' | 'filterPanelRenderer'> { /** Vue render function for rendering cells of this type */ renderer?: (ctx: CellRenderContext) => VNode; /** Vue render function for editing cells of this type */ editor?: (ctx: ColumnEditorContext) => VNode; /** Default editorParams for this type */ editorParams?: Record; /** * Vue render function for custom filter panels for this type. * * Unlike the core imperative API `(container, params) => void`, this accepts * a Vue render function that receives only the params and returns a VNode. * The bridge handles mounting and appending to the container automatically. * * @example * ```ts * import { h } from 'vue'; * import CustomFilter from './CustomFilter.vue'; * * const typeDefault: TypeDefault = { * filterPanelRenderer: (params) => h(CustomFilter, { * field: params.field, * uniqueValues: params.uniqueValues, * onApply: (values: Set) => params.applySetFilter(values), * }), * }; * ``` */ filterPanelRenderer?: (params: FilterPanelParams) => VNode; } /** * Type defaults registry - a map of type names to their defaults. * @since 0.1.0 */ export type TypeDefaultsMap = Record; /** * Injection key for type defaults. * @since 0.1.0 */ export declare const GRID_TYPE_DEFAULTS: InjectionKey; /** * Composable to get the current type defaults from the nearest provider. * * @example * ```vue * * ``` * @since 0.1.0 */ export declare function useGridTypeDefaults(): TypeDefaultsMap | undefined; /** * Composable to get a specific type's default configuration. * * @param typeName - The type name to look up * * @example * ```vue * * ``` * @since 0.1.0 */ export declare function useTypeDefault(typeName: string): TypeDefault | undefined; /** * Provides application-wide type defaults for all descendant grids. * * Wrap your application (or part of it) with this provider to make * type-level renderers and editors available to all TbwGrid components. * * @example * ```vue * * * * ``` * @since 0.1.0 */ export declare const GridTypeProvider: import('vue').DefineComponent; required: true; }; }>, () => VNode[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly; required: true; }; }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>; /** @since 0.1.0 */ export type GridTypeProviderProps = InstanceType['$props']; //# sourceMappingURL=grid-type-registry.d.ts.map