import { default as VTable, ColumnsDefine } from '@visactor/vtable'; import { TableEventHandlersEventArgumentMap } from '@visactor/vtable/es/ts-types/events'; import { IGraphic, IStage, IArc3dGraphicAttribute, IArcGraphicAttribute, IAreaGraphicAttribute, ICircleGraphicAttribute, IGlyphGraphicAttribute, IGroupGraphicAttribute, IImageGraphicAttribute, ILineGraphicAttribute, IPathGraphicAttribute, IPolygonGraphicAttribute, IPyramid3dGraphicAttribute, IRect3dGraphicAttribute, IRectGraphicAttribute, IRichTextGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute, REACT_TO_CANOPUS_EVENTS, IGraphicAttribute } from '@visactor/vtable/es/vrender'; import { ListTable } from './ListTable'; import { CellInfo, ITextStyleOption } from '@visactor/vtable/es/ts-types'; import { HistoryEditOptions, VTableTooltipOptions, WholeRow } from './feature/types'; import { BaseComponentProps } from '../../typings'; import { CustomMergeRender } from './feature/customMergeCell'; import { ConfigProviderProps } from 'antd'; export type VTableColumn = { field: string | number; render?: ( vTable: Omit< typeof VTable, | 'VArc' | 'VArc3d' | 'VArea' | 'VCircle' | 'VGroup' | 'VGlyph' | 'VImage' | 'VLine' | 'VPath' | 'VPolygon' | 'VPyramid3d' | 'VRect' | 'VRect3d' | 'VSymbol' | 'VText' | 'VRichText' > & HasEventComponent, cellInfo: VTable.TYPES.CustomRenderFunctionArg, ) => VTable.TYPES.ICustomLayoutObj; } & Omit; export interface OnChainVTableProps extends Omit< VTable.TYPES.ListTableConstructorOptions, 'columns' | 'menu' | 'tooltip' | 'records' | 'customMergeCell' >, BaseComponentProps { rowKey: string | (() => string); columns: VTableColumn[]; menu?: Menu; records?: Row[]; namespace?: string | (() => string); tooltip?: VTableTooltipOptions; customMergeRender?: ( vTable: HasEventComponent, ...params: Parameters> ) => ReturnType>; cellStyles?: ITextStyleOption; extra?: { group?: { dimension: string; }; historyEditOptions?: HistoryEditOptions; onCreated?: (param: { tableInstance: ListTable }) => void; }; configProviderProps?: ConfigProviderProps; } type CustomEventName = keyof TableEventHandlersEventArgumentMap; type CustomEvent = { [P in K]?: (this: ListTable, params: Parameters>[0]) => void | false; }; type CustomAttribute = { event?: CustomEvent; cellInfo?: VTable.TYPES.CustomRenderFunctionArg }; type IDefaultGraphicParamsType = Partial> = { attribute?: T; stateProxy?: (stateName: string, targetStates?: string[]) => Partial; children?: any; name?: string; id?: string; } & IEventParamsType; type Coordinate = { x: number; y: number }; type IEventParamsType = Partial> = { [t in keyof typeof REACT_TO_CANOPUS_EVENTS]?: ( this: IGraphic, event: { currentTarget: IGraphic; target: IStage; canvas: Coordinate; client: Coordinate; global: Coordinate; layer: Coordinate; movement: Coordinate; offset: Coordinate; page: Coordinate; screen: Coordinate; viewprot: Coordinate; }, ) => void; }; interface HasEventComponent { VArc(params: IDefaultGraphicParamsType>): any; VArc3d(params: IDefaultGraphicParamsType>): any; VArea(params: IDefaultGraphicParamsType>): any; VCircle(params: IDefaultGraphicParamsType>): any; VGroup(params: IDefaultGraphicParamsType>): any; VGlyph(params: IDefaultGraphicParamsType>): any; VImage(params: IDefaultGraphicParamsType>): any; VLine(params: IDefaultGraphicParamsType>): any; VPath(params: IDefaultGraphicParamsType>): any; VPolygon(params: IDefaultGraphicParamsType>): any; VPyramid3d(params: IDefaultGraphicParamsType>): any; VRect(params: IDefaultGraphicParamsType>): any; VRect3d(params: IDefaultGraphicParamsType>): any; VSymbol(params: IDefaultGraphicParamsType>): any; VText(params: IDefaultGraphicParamsType>): any; VRichText(params: IDefaultGraphicParamsType>): any; } type BasisMenu = Required['menu']; type CanHideTypeMenu = VTable.TYPES.MenuListItem & { show?: false }; interface Menu extends BasisMenu { contextMenuItems?: CanHideTypeMenu[] | ((field: string, row: number, col: number) => CanHideTypeMenu[]); } export interface TableStore { tableInstance: VTable.ListTable | null; }