import { AnyObject, ArrayAble, AnyFn, Nullable } from '../../../../shared/types'; import { AsyncParallelHook, AsyncSeriesHook, SyncHook, SyncWaterfallHook } from '../../../../shared/utils/tapable'; import { MaybeRef } from '@vueuse/core'; import { Ref, VNode } from 'vue'; import { VxeGlobalCommands, VxeGlobalFormats, VxeGlobalHooks, VxeGlobalMenus, VxeGlobalRenderer, VxeTableInstance, VXETableSetupOptions } from 'vxe-table'; import { VxeTableEvents } from 'vxe-table/types/table'; import { VxePagerEvents } from 'vxe-table/types/pager'; import { VxeGlobalInterceptor } from 'vxe-table/types/v-x-e-table'; import { $VxeTable, IhoTableConfig, IhoTableEmits, IhoTableEventTypes, IhoTableFieldItem, IhoTableHandler, IhoTableProps } from '.'; export type IhoTableInstance = { interceptor: VxeGlobalInterceptor; renderer: VxeGlobalRenderer; commands: VxeGlobalCommands; formats: VxeGlobalFormats; menus: VxeGlobalMenus; hooks: VxeGlobalHooks; setup: (option: VXETableSetupOptions) => void; }; export type TablePlugin = { name: string; vxe?(vxeTable: IhoTableInstance): void; apply?(hooks: TableHooks): void; }; export type IhoTableHandlerContext = { $table: isRef extends true ? Ref> : Nullable; emits: IhoTableEmits; globProps: IhoTableProps; loading: Ref; $xeTable: Ref<$VxeTable | undefined>; }; export type TableHooks = Readonly<{ configHooks: AbstractConfigHooks; fieldHooks: AbstractFieldHooks; eventHooks: AbstractEventHooks; dataHooks: AbstractDataHooks; setupHooks: AbstractSetupHooks; domInsertHooks: AbstractDomInsertHooks; exposeHooks: AbstractExposeHooks; }>; export type WithTableConfig = T extends any[] ? [...T, IhoTableConfig] : [T, IhoTableConfig]; type ConfigHookType = SyncWaterfallHook<[...WithTableConfig<[T]>, IhoTableHandlerContext]>; export declare abstract class AbstractConfigHooks { abstract readonly config: SyncWaterfallHook<[IhoTableConfig, IhoTableHandlerContext]>; abstract readonly rowConfig: ConfigHookType; abstract readonly editConfig: ConfigHookType; abstract readonly columnConfig: ConfigHookType; abstract readonly resizableConfig: ConfigHookType; abstract readonly seqConfig: ConfigHookType; abstract readonly sortConfig: ConfigHookType; abstract readonly filterConfig: ConfigHookType; abstract readonly radioConfig: ConfigHookType; abstract readonly checkboxConfig: ConfigHookType; abstract readonly expandConfig: ConfigHookType; abstract readonly treeConfig: ConfigHookType; abstract readonly mouseConfig: ConfigHookType; abstract readonly menuConfig: ConfigHookType; abstract readonly keyboardConfig: ConfigHookType; abstract readonly scrollY: ConfigHookType; abstract readonly scrollX: ConfigHookType; abstract readonly editRules: ConfigHookType; } export interface FieldHookContext { index: number; remove(): void; insertBefore(field: ArrayAble): void; insertAfter(field: ArrayAble): void; } export type WithFieldHookContext = [...WithTableConfig, IhoTableHandlerContext]; export declare abstract class AbstractFieldHooks { abstract readonly fieldStart: AsyncParallelHook; abstract readonly field: SyncWaterfallHook>; abstract readonly fieldList: SyncWaterfallHook>; abstract readonly fieldEnd: AsyncParallelHook; } export type WithIhoEventContext = [...WithTableConfig, IhoTableHandler & IhoTableHandlerContext]; type EventHookType = AsyncParallelHook>>; type VxeEventTypes = Required<{ readonly [K in keyof IhoTableEventTypes]: EventHookType>; }>; export declare abstract class AbstractEventHooks implements VxeEventTypes { abstract readonly beforeEvent: SyncWaterfallHook<[...WithIhoEventContext<[any]>, string]>; abstract readonly onKeydownStart: EventHookType; abstract readonly onKeydown: EventHookType; abstract readonly onKeydownEnd: EventHookType; abstract readonly onPaste: EventHookType; abstract readonly onCopy: EventHookType; abstract readonly onCut: EventHookType; abstract readonly onCurrentChange: EventHookType; abstract readonly onRadioChange: EventHookType; abstract readonly onCheckboxChange: EventHookType; abstract readonly onCheckboxAll: EventHookType; abstract readonly onCheckboxRangeStart: EventHookType; abstract readonly onCheckboxRangeChange: EventHookType; abstract readonly onCheckboxRangeEnd: EventHookType; abstract readonly onCellClick: EventHookType; abstract readonly onCellDblclick: EventHookType; abstract readonly onCellMenu: EventHookType; abstract readonly onCellMouseenter: EventHookType; abstract readonly onCellMouseleave: EventHookType; abstract readonly onHeaderCellClick: EventHookType; abstract readonly onHeaderCellDblclick: EventHookType; abstract readonly onHeaderCellMenu: EventHookType; abstract readonly onFooterCellClick: EventHookType; abstract readonly onFooterCellDblclick: EventHookType; abstract readonly onFooterCellMenu: EventHookType; abstract readonly onSortChange: EventHookType; abstract readonly onFilterChange: EventHookType; abstract readonly onFilterVisible: EventHookType; abstract readonly onResizableChange: EventHookType; abstract readonly onToggleRowExpand: EventHookType; abstract readonly onToggleTreeExpand: EventHookType; abstract readonly onMenuClick: EventHookType; abstract readonly onEditClosed: EventHookType; abstract readonly onEditActived: EventHookType; abstract readonly onEditDisabled: EventHookType; abstract readonly onValidError: EventHookType; abstract readonly onScroll: EventHookType; abstract readonly onCustom: EventHookType; abstract readonly onOpenFnr: EventHookType; abstract readonly onFnrChange: EventHookType; abstract readonly onFnrFind: EventHookType; abstract readonly onFnrFindAll: EventHookType; abstract readonly onFnrReplace: EventHookType; abstract readonly onFnrReplaceAll: EventHookType; abstract readonly onCellAreaCopy: EventHookType; abstract readonly onCellAreaCut: EventHookType; abstract readonly onCellAreaPaste: EventHookType; abstract readonly onCellAreaMerge: EventHookType; abstract readonly onClearCellAreaMerge: EventHookType; abstract readonly onHeaderCellAreaSelection: EventHookType; abstract readonly onCellAreaSelectionStart: EventHookType; abstract readonly onCellAreaSelectionDrag: EventHookType; abstract readonly onCellAreaSelectionEnd: EventHookType; abstract readonly onCellAreaExtensionStart: EventHookType; abstract readonly onCellAreaExtensionDrag: EventHookType; abstract readonly onCellAreaExtensionEnd: EventHookType; abstract readonly onCellAreaArrowsStart: EventHookType; abstract readonly onCellAreaArrowsEnd: EventHookType; abstract readonly onActiveCellChangeStart: EventHookType; abstract readonly onActiveCellChangeEnd: EventHookType; abstract readonly onCellAreaSelectionAllStart: EventHookType<(payload: any) => void>; abstract readonly onCellAreaSelectionAllEnd: EventHookType<(payload: any) => void>; abstract readonly onPageChange: EventHookType; } type DataHookContext = { remove(): void; $table: MaybeRef>; index: number; insertBefore(data: ArrayAble): void; insertAfter(data: ArrayAble): void; }; export type WithTableDataContext = [...WithTableConfig, DataHookContext]; export declare abstract class AbstractDataHooks { abstract readonly dataStart: AsyncParallelHook>; abstract readonly data: AsyncSeriesHook>; abstract readonly dataEnd: AsyncParallelHook>; abstract readonly dataList: SyncWaterfallHook>; } export declare abstract class AbstractSetupHooks { abstract readonly setup: SyncHook<[Ref, Ref, IhoTableHandlerContext]>; } export declare abstract class AbstractDomInsertHooks { abstract readonly header: SyncWaterfallHook<[VNode[]]>; abstract readonly footer: SyncWaterfallHook<[VNode[]]>; } export type WithExposeHookConfig = [ ...(T extends any[] ? T : [T]), Ref, IhoTableHandler & IhoTableHandlerContext ]; export declare abstract class AbstractExposeHooks { abstract readonly expose: SyncWaterfallHook>>; } export {};