UNPKG

@revolist/svelte-datagrid

Version:

Svelte DataGrid Spreadsheet component with native cell render support

23 lines (22 loc) 1.23 kB
import { CellTemplateProp, ColumnDataSchemaModel, ColumnTemplateProp, HyperFunc, VNode } from '@revolist/revogrid'; import { Component } from 'svelte'; import { ReactiveProps } from './reactive-props.svelte'; export type SvelteCellProps = CellTemplateProp & { addition?: any; [key: string]: any; }; export interface SvelteElement extends HTMLElement { _svelteTemplate?: RenderedComponent<any>; } export interface RenderedComponent<T extends Record<string, any>> { component: Component<T>; instance: Record<string, any>; props: ReactiveProps<T>; update: (newProps: T) => void; destroy: () => void; } export declare function SvelteTemplateConstructor<T extends Record<string, any>>(el: SvelteElement | null, SvelteComponent: Component<T>, initialProps: T, lastEl?: RenderedComponent<T> | null, context?: Map<any, any> | undefined): RenderedComponent<T> | null; /** * Render a Svelte component in a RevoGrid column cell template. */ export declare const Template: <TProps extends Record<string, any> = SvelteCellProps>(SvelteComponent: Component<TProps>, customProps?: Partial<TProps>) => (h: HyperFunc<VNode>, p: ColumnDataSchemaModel | ColumnTemplateProp | CellTemplateProp, addition?: any) => VNode;