UNPKG

fusion-tabulator

Version:

The Awesome table build with tabulator-tables

142 lines (135 loc) 5 kB
import { FC } from 'react'; import { RulesProps, ColProps } from '@arco-design/web-react'; import { ColumnDefinition, Options, EventCallBackMethods, OptionsColumns } from 'tabulator-tables'; export { ColumnDefinition, EventCallBackMethods, Options as FusionTabulatorOptions, TabulatorFull } from 'tabulator-tables'; import Dexie from 'dexie'; import * as react_jsx_runtime from 'react/jsx-runtime'; type S2ReactProps = { widgetId?: string; }; interface TabulatorTableData { tuid?: string | number; [key: string]: any; } type TableMode = 'normal' | 'editable'; interface ReactTabulatorProps { columns?: ColumnDefinition[]; options?: Options; eventMaps?: Record<keyof EventCallBackMethods, <K extends keyof EventCallBackMethods>(event: K, callback?: EventCallBackMethods[K]) => void>; onRef?: (ref: any) => void; classNames?: string; widgetId?: string; tableMode?: TableMode; data?: TabulatorTableData[]; layout?: OptionsColumns['layout']; appMode?: PlatformAppMode; configs?: { generalConfigs?: Record<string, any>; loadedConfigs?: Record<string, any>; columnConfigs?: Record<string, any>; rowConfigs?: Record<string, any>; cellConfigs?: Record<string, any>; keyBindingConfigs?: Record<string, any>; eventConfigs?: Record<string, any>; styleConfigs?: Record<string, any>; advancedConfigs?: Record<string, any>; }; onUpdateWidgetMetaProperty?: (params: Record<string, any>) => void; onUpdateWidgetProperty?: (params: Record<string, any>) => void; onCustomSelectDropdownItem?: (record?: Record<string, any>) => void; onExtraInputValueChanged?: (value: string) => void; actionId?: string; uniqueKey?: string; indexField: string; enableRemote?: boolean; quickAddDropdownDefinitions?: { data: any[]; columns: any[]; }; uniformProps?: Record<string, any>; onEvents?: (eventName: string, data?: Record<string, any>) => void; tableHeight: number; } type TabulatorTableType = 'tabulator' | 's2'; type PlatformAppMode = 'EDIT' | 'PUBLISHED' | 'INSTALL'; type RenderCompByTypeProps = { appMode: PlatformAppMode; s2Options?: S2ReactProps; tabulatorOptions?: ReactTabulatorProps; actionId?: string; enableRemote?: boolean; widgetId?: string; onUpdateWidgetMetaProperty?: (params: Record<string, unknown>) => void; onCustomSelectDropdownItem?: VoidFunction; onExtraInputValueChanged?: (value: string) => void; onEvents?: (eventName: string, data?: Record<string, any>) => void; eventMaps?: { tabulator?: Record<string, any>; }; quickAddDropdownDefinitions?: { data: any[]; columns: any[]; }; uniformProps?: Record<string, any>; tableMode?: TableMode; tableHeight: number; }; type FilterConfigurationItem = { label: string; field: string; type: 'input' | 'button' | 'select' | 'date' | 'checkbox' | 'radio'; rules?: RulesProps[]; labelCol?: ColProps; labelAlign?: 'left' | 'right'; wGrid?: number; hGrid?: number; eventName?: string; extraProps?: Record<string, unknown>; }; interface FilterDefinitions { initialValues?: Record<string, unknown>; items?: FilterConfigurationItem[]; rowHeight?: number; cols?: number; } interface TabulatorProps { widgetId: string; tableType: TabulatorTableType; appMode: PlatformAppMode; filterDefinitions?: FilterDefinitions; dexie?: Dexie; configs?: { tabulator?: { generalConfigs?: Record<string, unknown>; loadedConfigs?: Record<string, unknown>; columnConfigs?: Record<string, unknown>; rowConfigs?: Record<string, unknown>; cellConfigs?: Record<string, unknown>; keyBindingConfigs?: Record<string, unknown>; eventConfigs?: Record<string, unknown>; styleConfigs?: Record<string, unknown>; advancedConfigs?: Record<string, unknown>; }; }; quickAddDropdownDefinitions?: { data: any[]; columns: any[]; }; uniformProps?: Record<string, any>; eventMaps?: { tabulator?: Record<string, unknown>; }; onUpdateWidgetMetaProperty?: (params: Record<string, unknown>) => void; onUpdateWidgetProperty?: (params: Record<string, unknown>) => void; onCustomSelectDropdownItem?: VoidFunction; onExtraInputValueChanged?: (value: string) => void; actionId?: string; enableRemote?: boolean; tableMode?: TableMode; onEvents?: (eventName: string, data?: Record<string, any>) => void; tableHeight: number; } type FusionTabulatorProps = RenderCompByTypeProps & TabulatorProps; declare const Tabulator: FC<FusionTabulatorProps>; declare const TabulatorReact: (props: ReactTabulatorProps) => react_jsx_runtime.JSX.Element; export { type FusionTabulatorProps, TabulatorReact, type TabulatorTableData, Tabulator as default };