import { NumberOptions } from '../../utils/formatNumber'; import { ButtonProps } from '../Button/Button.type'; import { TableV2Column } from './TableV2.type'; export declare function dateFormat(date: Date | number | string): string; export declare function rowFn(fn: T | ((...a: any[]) => T), ...arg: any[]): any; type RowFn = R | ((row: T) => R); type BaseAction = { name: RowFn; /** * 回影响按钮的显影 */ activity?: RowFn; /** * 禁用 */ disabled?: RowFn; type?: 'primary' | 'danger' | 'info'; }; type ButtonAction = { mode?: 'button'; onClick: (row: T) => void; } & BaseAction; type AsyncAction = { mode: 'async'; onClick: (row: T) => Promise; onSucceed?: (res: any) => void; onError?: (error: any) => void; } & BaseAction; type ConfirmAction = { mode: 'confirm'; confirmContent: string | ((row: T) => string); onClick: (row: T) => Promise; } & BaseAction; type ModelAction = { mode: 'model'; modelTitle: string | ((row: T) => string); modelIcon?: 'success' | 'warning' | 'info' | 'error'; modelDesc?: string | ((row: T) => string); onClick: (row: T) => Promise; } & BaseAction; type Action = ButtonAction | AsyncAction | ConfirmAction | ModelAction; type Value = string | number | undefined; type State = { label: string; value: Value; status?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | string; [key: string]: any; }; type Prop = keyof T | string | ((row: T) => Value); export declare const createColumnHelper: >() => { /** * 单行字符串 */ text(label: string, prop: Prop, columnConfig?: Omit, "label" | "prop">): TableV2Column; /** * 多行字符串 */ multipleText(label: string, prop: keyof T | string | ((row: T) => Value | (Value)[]), lineClamp?: number, columnConfig?: TableV2Column): TableV2Column; textField(label: string, ops: [string, Prop][], columnConfig?: TableV2Column): TableV2Column; /** * 数字 */ number(label: string, prop: Prop, numberConfig?: NumberOptions & { unit?: string; prefix?: string; }, columnConfig?: TableV2Column): TableV2Column; /** * 数字 */ numberRange(label: string, prop: [Prop, Prop], numberConfig?: NumberOptions & { unit?: string; prefix?: string; }, columnConfig?: TableV2Column): TableV2Column; /** * 货币 */ currency(): void; /** * 日期时间 */ time(label: string, prop: Prop, format?: string, columnConfig?: TableV2Column): TableV2Column; /** * 时间字段 */ timeField(label: string, ops: [string, (Prop)][], format?: string, columnConfig?: TableV2Column): TableV2Column; /** * 时间范围 */ timeRange(label: string, ops: [(Prop), Prop], format?: string, columnConfig?: TableV2Column): TableV2Column; /** * 状态枚举 */ stateEnum(label: string, prop: Prop, states: State[], columnConfig?: TableV2Column): TableV2Column; /** * 操作列 */ action(actions: Action[], buttonConfig?: Omit, columnConfig?: Omit, "label" | "renderCell">): TableV2Column; }; export {};