UNPKG

es-grid-template

Version:

es-grid-template

120 lines (119 loc) 4.49 kB
import type { Dispatch, SetStateAction } from 'react'; import type { ExpandableConfig, IFormat, IWrapSettings, RangeState, RecordDoubleClickEventArgs, SelectionSettings } from "./type"; import type { SubmitHandler } from "react-hook-form"; export type IPositionCell = { rowId: string; colId: string; } | undefined; export interface IContext<T> { prefix: string; id: string; rowKey: string; originData: any[]; dataSource: any[]; format?: IFormat; expandable?: ExpandableConfig<T>; wrapSettings?: IWrapSettings; recordDoubleClick?: (args: RecordDoubleClickEventArgs<T>) => void; selectionSettings?: SelectionSettings; setIsSelectionChange: Dispatch<SetStateAction<{ isChange: boolean; type: string; rowData: T; }>>; setSorterChange: Dispatch<SetStateAction<boolean>>; setFilterChange: Dispatch<SetStateAction<boolean>>; onContextMenu?: (data: T) => (event: any) => void; control?: any; errors?: any; handleSubmit?: any; onSubmit?: SubmitHandler<any>; getValues?: any; reset?: any; setValue?: any; handleCellChange?: (args: ContextCellChange) => void; editingKey?: string; setEditingKey?: Dispatch<SetStateAction<string>>; rangeState?: RangeState; setRangeState?: Dispatch<SetStateAction<RangeState | undefined>>; rangePasteState?: RangeState; setRangePasteState?: Dispatch<SetStateAction<RangeState | undefined>>; startCell?: IPositionCell; setStartCell?: Dispatch<SetStateAction<IPositionCell | undefined>>; endCell?: IPositionCell; setEndCell?: Dispatch<SetStateAction<IPositionCell | undefined>>; startPasteCell?: IPositionCell; setStartPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>; endPasteCell?: IPositionCell; setEndPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>; isSelecting?: boolean; setIsSelecting?: Dispatch<SetStateAction<boolean>>; isPasting?: boolean; setIsPasting?: Dispatch<SetStateAction<boolean>>; focusedCell?: IPositionCell; setFocusedCell?: Dispatch<SetStateAction<IPositionCell | undefined>>; triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void; handleDeleteContent?: () => void; handleAddMulti?: (item: any, n: number, id?: string) => void; } export interface IContextEdit<T> { prefix: string; searchValue?: any; setSearchValue?: any; open?: boolean; setOpen?: any; rowKey: string; onSave?: any; format?: IFormat; control?: any; errors?: any; trigger?: any; handleSubmit?: any; onSubmit?: SubmitHandler<any>; getValues?: any; reset?: any; setValue?: any; handleCellChange?: (args: ContextCellChange) => void; id: string; startCell: IPositionCell; setStartCell: Dispatch<SetStateAction<IPositionCell>>; endCell: IPositionCell; setEndCell: Dispatch<SetStateAction<IPositionCell>>; startPasteCell: IPositionCell; setStartPasteCell: Dispatch<SetStateAction<IPositionCell>>; endPasteCell: IPositionCell; setEndPasteCell: Dispatch<SetStateAction<IPositionCell>>; isSelecting: boolean; setIsSelecting: Dispatch<SetStateAction<boolean>>; isPasting: boolean; setIsPasting: Dispatch<SetStateAction<boolean>>; editingKey: string; setEditingKey: Dispatch<SetStateAction<string>>; focusedCell: IPositionCell; setFocusedCell: Dispatch<SetStateAction<IPositionCell>>; rangeState: RangeState; setRangeState: Dispatch<SetStateAction<RangeState>>; rangePasteState: RangeState; setRangePasteState: Dispatch<SetStateAction<RangeState>>; originData: any[]; dataSource: any[]; triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void; expandable?: ExpandableConfig<T>; handleDeleteContent: () => void; wrapSettings?: IWrapSettings; handleAddMulti: (item: any, n: number, id?: string) => void; recordDoubleClick?: (args: RecordDoubleClickEventArgs<T>) => void; } export declare const TableContext: import("react").Context<IContext<any>>; export declare const TableContextEdit: import("react").Context<IContextEdit<any>>; export type ContextCellChange = { key: string; record: any; field: string | undefined; option: any; indexRow: number; indexCol: number; newState?: any; prevState?: any; type: 'enter' | 'blur' | 'outClick'; };