UNPKG

vxe-pc-ui

Version:
1,885 lines (1,822 loc) 181 kB
import { RenderFunction, SetupContext, Ref, ComputedRef, ComponentPublicInstance, VNode } from 'vue' import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentBaseOptions, VxeComponentEventParams, VxeComponentSizeType, ValueOf, VxeGlobalConfig, VxeComponentStyleType, VxeComponentSlotType, VxeComponentAlignType } from '@vxe-ui/core' import { VxeColumnPropTypes, VxeColumnProps, VxeColumnSlotTypes } from './column' import { VxeTableExtendCellAreaDefines, VxeTableExtendCellAreaEmits } from './table-plugins' import { VxeGridConstructor } from './grid' import { VxeTooltipInstance, VxeTooltipPropTypes } from './tooltip' import { VxeModalPropTypes } from './modal' import { VxeDrawerPropTypes } from './drawer' import { VxeToolbarConstructor, VxeToolbarInstance } from './toolbar' /* eslint-disable no-use-before-define,@typescript-eslint/ban-types */ export declare const VxeTable: DefineVxeComponentApp<VxeTableProps, VxeTableEventProps, VxeTableSlots> export type VxeTableComponent = DefineVxeComponentOptions<VxeTableProps, VxeTableEventProps> export type VxeTableInstance<D = any> = DefineVxeComponentInstance<VxeTableProps<D>, VxeTableConstructor> export interface VxeTableConstructor<D = any> extends VxeComponentBaseOptions, VxeTableMethods { props: VxeTableProps context: SetupContext<VxeTableEmits> reactData: TableReactData internalData: TableInternalData<D> getRefMaps(): TablePrivateRef getComputeMaps(): TablePrivateComputed renderVN: RenderFunction xeGrid: VxeGridConstructor<D> | null /** * @deprecated */ xegrid: VxeGridConstructor<D> | null | undefined } export interface TablePrivateRef { refElem: Ref<HTMLDivElement> refTooltip: Ref<VxeTooltipInstance> refValidTooltip: Ref<VxeTooltipInstance> refTableFilter: Ref<any> refTableCustom: Ref<ComponentPublicInstance> refTableMenu: Ref<any> refTableHeader: Ref<ComponentPublicInstance> refTableBody: Ref<ComponentPublicInstance> refTableFooter: Ref<ComponentPublicInstance> refTableLeftHeader: Ref<ComponentPublicInstance> refTableLeftBody: Ref<ComponentPublicInstance> refTableLeftFooter: Ref<ComponentPublicInstance> refTableRightHeader: Ref<ComponentPublicInstance> refTableRightBody: Ref<ComponentPublicInstance> refTableRightFooter: Ref<ComponentPublicInstance> refLeftContainer: Ref<HTMLDivElement> refRightContainer: Ref<HTMLDivElement> refColResizeBar: Ref<HTMLDivElement> refRowResizeBar: Ref<HTMLDivElement> refScrollXVirtualElem: Ref<HTMLDivElement | undefined> refScrollYVirtualElem: Ref<HTMLDivElement | undefined> refScrollXHandleElem: Ref<HTMLDivElement | undefined> refScrollYHandleElem: Ref<HTMLDivElement | undefined> refScrollXSpaceElem: Ref<HTMLDivElement | undefined> refScrollYSpaceElem: Ref<HTMLDivElement | undefined> } export interface VxeTablePrivateRef extends TablePrivateRef { } /** * 已废弃,被 VxeTablePropTypes.Row 替换 * @deprecated */ export type VxeTableDataRow = VxeTablePropTypes.Row export namespace VxeTablePropTypes { export type Size = VxeComponentSizeType export type ID<D = any> = string | ((params: { $table: VxeTableConstructor<D> $grid: VxeGridConstructor<D> | null | undefined }) => string | number | null) export interface Row { [key: string]: any } export type Data<T = Row> = T[] export type Height = number | string export type MinHeight = number | string export type MaxHeight = number | string export type Resizable = boolean export type Stripe = boolean export type Round = boolean export type Padding = boolean export type Border = boolean | 'default' | 'full' | 'outer' | 'inner' | 'none' | '' export type Loading = boolean export type Align = VxeComponentAlignType export type HeaderAlign = Align export type FooterAlign = Align export type ShowHeader = boolean export type HighlightCurrentRow = boolean export type HighlightHoverRow = boolean export type HighlightCurrentColumn = boolean export type HighlightHoverColumn = boolean export type HighlightCell = boolean export type ShowFooter = boolean export type FooterData = Record<string, any>[] export type FooterMethod<D = any> = (params: { $table: VxeTableConstructor<D> $grid: VxeGridConstructor<D> | null | undefined columns: VxeTableDefines.ColumnInfo<D>[] data: D[] }) => Array<string | number | null>[] | any[] export type RowClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> row: D rowIndex: number $rowIndex: number _rowIndex: number }) => void | null | string | { [key: string]: boolean | null | undefined }) export type CellClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> row: D rowIndex: number $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number }) => void | null | string | { [key: string]: boolean | null | undefined }) export type HeaderRowClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> $rowIndex: number fixed: VxeColumnPropTypes.Fixed type: string }) => void | null | string | { [key: string]: boolean | null | undefined }) export type HeaderCellClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> $rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number fixed: VxeColumnPropTypes.Fixed type: string }) => void | null | string | { [key: string]: boolean | null | undefined }) export type FooterRowClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> row: D $rowIndex: number _rowIndex: number fixed: VxeColumnPropTypes.Fixed type: string }) => void | null | string | { [key: string]: boolean | null | undefined }) export type FooterCellClassName<D = VxeTablePropTypes.Row> = string | ((params: { $table: VxeTableConstructor<D> row: D $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number }) => void | null | string | { [key: string]: boolean | null | undefined }) export type CellStyle<D = VxeTablePropTypes.Row> = VxeComponentStyleType | ((params: { row: D rowIndex: number $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number }) => void | null | VxeComponentStyleType) export type HeaderCellStyle<D = VxeTablePropTypes.Row> = VxeComponentStyleType | ((params: { $table: VxeTableConstructor<D> $rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number _columnIndex: number }) => void | null | VxeComponentStyleType) export type FooterCellStyle<D = any> = VxeComponentStyleType | ((params: { $table: VxeTableConstructor<D> row: D $rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number }) => void | null | VxeComponentStyleType) export type RowStyle<D = VxeTablePropTypes.Row> = VxeComponentStyleType | ((params: { $table: VxeTableConstructor<D> row: D rowIndex: number $rowIndex: number _rowIndex: number }) => void | null | VxeComponentStyleType) export type HeaderRowStyle<D = VxeTablePropTypes.Row> = VxeComponentStyleType | ((params: { $table: VxeTableConstructor<D> $rowIndex: number fixed: VxeColumnPropTypes.Fixed type: string }) => void | null | VxeComponentStyleType) export type FooterRowStyle<D = any> = VxeComponentStyleType | ((params: { $table: VxeTableConstructor<D> row: D $rowIndex: number _rowIndex: number fixed: VxeColumnPropTypes.Fixed type: string }) => void | null | VxeComponentStyleType) export type MergeCell<D = VxeTablePropTypes.Row> = VxeTableDefines.MergeOptions<D> export type MergeCells<D = VxeTablePropTypes.Row> = MergeCell<D>[] export type MergeFooterItem<D = any> = VxeTableDefines.MergeOptions<D> export type MergeFooterItems<D = any> = MergeFooterItem<D>[] export type SpanMethod<D = VxeTablePropTypes.Row> = (params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number row: D rowIndex: number $rowIndex: number _rowIndex: number isHidden: boolean fixed: VxeColumnPropTypes.Fixed type: string visibleData: D[] }) => void | { rowspan: number, colspan: number } export type FooterSpanMethod<D = any> = (params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number _columnIndex: number $columnIndex: number row: D $rowIndex: number _rowIndex: number items: any[] data: D[][] }) => void | { rowspan: number, colspan: number } export type ShowOverflow = boolean | 'ellipsis' | 'title' | 'tooltip' | '' | null export type ShowHeaderOverflow = ShowOverflow export type ShowFooterOverflow = ShowOverflow export type ColumnKey = boolean export type RowKey = boolean export type RowId = string export type KeepSource = boolean export type AutoResize = boolean export type SyncResize = boolean | string | number /** * 响应式布局配置项 */ export interface ResizeConfig { refreshDelay?: number } export interface ResizeOpts extends ResizeConfig { } /** * 列配置信息 */ export interface ColumnConfig<D = any> { /** * 是否需要为每一列的 VNode 设置 key 属性 */ useKey?: boolean /** * 当鼠标点击列头时,是否要高亮当前列 */ isCurrent?: boolean /** * 当鼠标移到列头时,是否要高亮当前头 */ isHover?: boolean /** * 已废弃,请使用 current-column-config.beforeSelectMethod * @deprecated */ currentMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 每一列是否启用列宽调整 */ resizable?: VxeColumnPropTypes.Resizable /** * 每一列的宽度 */ width?: VxeColumnPropTypes.Width /** * 每一列的最小宽度 */ minWidth?: VxeColumnPropTypes.MinWidth /** * 每一列的最大宽度 */ maxWidth?: VxeColumnPropTypes.MaxWidth /** * 固定列允许设置的最大数量(如果是分组,则一个分组算一个) */ maxFixedSize?: number /** * 是否启用列拖拽排序 */ drag?: boolean /** * 每一列的自定义表头单元格数据导出方法,返回自定义的标题 */ headerExportMethod?: VxeColumnPropTypes.HeaderExportMethod<any> /** * 每一列的自定义单元格数据导出方法,返回自定义的值 */ exportMethod?: VxeColumnPropTypes.ExportMethod<any> /** * 每一列的自定义表尾单元格数据导出方法,返回自定义的值 */ footerExportMethod?: VxeColumnPropTypes.FooterExportMethod<any> } export interface ColumnOpts<D = any> extends ColumnConfig<D> { } /** * 行配置信息 */ export interface RowConfig<D = any> { /** * 是否需要为每一行的 VNode 设置 key 属性 */ useKey?: boolean /** * 自定义行数据唯一主键的字段名(默认自动生成) */ keyField?: string /** * 当鼠标点击行时,是否要高亮当前行 */ isCurrent?: boolean /** * 已废弃,请使用 current-row-config.beforeSelectMethod * @deprecated */ currentMethod?(params: { row: D }): boolean /** * 当鼠标移到行时,是否要高亮当前行 */ isHover?: boolean /** * 每一行开启调整行高度 */ resizable?: boolean /** * 已废弃,被 cell-config.height 替换 * @deprecated */ height?: number /** * 是否启用行拖拽排序 */ drag?: boolean } export interface RowOpts<D = any> extends RowConfig<D> { } /** * 当前行配置项 */ export interface CurrentRowConfig<D = any> { /** * 触发方式 */ trigger?: 'default' | 'row' | 'manual' | '' | null /** * 只对 mouse-config.selected 启用有效,是否跟随单元格选中而移动高亮行 */ isFollowSelected?: boolean /** * 用于选中当前行执行之前的方法,返回 false 可以阻止默认行为 */ beforeSelectMethod?(params: { row: D $table: VxeTableConstructor<D> }): boolean } /** * 当前列配置项 */ export interface CurrentColumnConfig<D = any> { /** * 触发方式 */ trigger?: 'default' | 'header' | 'cell' | 'manual' | '' | null /** * 只对 mouse-config.selected 启用有效,是否跟随单元格选中而移动高亮列 */ isFollowSelected?: boolean /** * 用于选中当前列执行之前的方法,返回 false 可以阻止默认行为 */ beforeSelectMethod?(params: { column: VxeTableDefines.ColumnInfo<D> $table: VxeTableConstructor<D> }): boolean } /** * 单元格配置项 */ export interface CellConfig<D = any>{ /** * 单元格默认高度 */ height?: number /** * 是否显示间距 */ padding?: VxeColumnPropTypes.Padding /** * 垂直对齐方式 */ verticalAlign?: VxeColumnPropTypes.VerticalAlign } /** * 表头单元格配置项 */ export interface HeaderCellConfig<D = any>{ /** * 单元格默认高度 */ height?: number | 'unset' /** * 是否显示间距 */ padding?: boolean } /** * 表尾单元格配置项 */ export interface FooterCellConfig<D = any>{ /** * 单元格默认高度 */ height?: number | 'unset' /** * 是否显示间距 */ padding?: boolean } /** * 已废弃,被 RowDragConfig 替换 * @deprecated */ export interface DragConfig<D = any>{ /** * 自定义图标 * @deprecated */ rowIcon?: string /** * 是否显示拖拽按钮图标 * @deprecated */ showRowIcon?: boolean /** * 是否禁用拖拽按钮 * @deprecated */ rowDisabledMethod?(params: { row: D column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 是否显示拖拽按钮 * @deprecated */ rowVisibleMethod?(params: { row: D column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 自定义提示内容 * @deprecated */ rowTooltipMethod?(params: { row: D }): string | number | null /** * 拖拽开始时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽 * @deprecated */ dragStartMethod?(params: VxeTableDefines.RowDragstartEventParams<D>): boolean /** * 拖拽结束时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽调整顺序 * @deprecated */ dragEndMethod?(params: Omit<VxeTableDefines.RowDragendEventParams<D>, '_index'>): Promise<boolean> | boolean /** * 自定义插槽模板 * @deprecated */ slots?: { rowTip?: string | ((params: VxeTableDefines.RowDragSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) } } /** * 行拖拽排序配置项 */ export interface RowDragConfig<D = any>{ /** * 自定义图标 */ icon?: string /** * 是否显示拖拽按钮图标 */ showIcon?: boolean /** * 显示拖拽提示,拖拽过程中显示信息 */ showDragTip?: boolean /** * 触发拖拽方式 */ trigger?: 'default' | 'cell' | 'row' | '' | null /** * 只对 tree-config 启用有效,是否允许同级行拖拽,用于树结构,启用后允许同层级之间进行拖拽 */ isPeerDrag?: boolean /** * 只对 tree-config 启用有效,是否允许同级/跨层行拖拽,用于树结构,启用后允许跨层级拖拽(除了上级拖到子级) */ isCrossDrag?: boolean /** * 需要 isCrossDrag,只对 tree-config 启用有效,是否允许拖拽成目标行的子级 */ isToChildDrag?: boolean /** * 需要 isCrossDrag,只对 tree-config 启用有效,是否允许将自己拖拽到子级行中 */ isSelfToChildDrag?: boolean /** * 是否显示拖拽辅助状态显示 */ showGuidesStatus?: boolean /** * 是否显示拖拽动画,启用后由数据量的大小来影响渲染性能 */ animation?: boolean /** * 是否禁用拖拽按钮 */ disabledMethod?(params: { row: D column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 是否显示拖拽按钮 */ visibleMethod?(params: { row: D column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 自定义提示内容 */ tooltipMethod?(params: { row: D }): string | number | null /** * 拖拽开始时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽 */ dragStartMethod?(params: VxeTableDefines.RowDragstartEventParams<D>): boolean /** * 拖拽结束时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽调整顺序 */ dragEndMethod?(params: Omit<VxeTableDefines.RowDragendEventParams<D>, '_index'>): Promise<boolean> | boolean /** * 用于 isToChildDrag,在拖拽完成后,该方法的返回值用于决定是否拖拽成子级 */ dragToChildMethod?(params: Omit<VxeTableDefines.RowDragToChildMethod<D>, '_index'>): boolean /** * 自定义插槽模板 */ slots?: { tip?: string | ((params: VxeTableDefines.RowDragSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) } } /** * 列拖拽排序配置项 */ export interface ColumnDragConfig<D = any>{ /** * 自定义图标 */ icon?: string /** * 是否显示拖拽按钮图标 */ showIcon?: boolean /** * 显示拖拽提示,拖拽过程中显示信息 */ showDragTip?: boolean /** * 触发拖拽方式 */ trigger?: 'default' | 'cell' | '' | null /** * 用于分组表头,是否允许同级列拖拽,启用后允许同层级列之间进行拖拽 */ isPeerDrag?: boolean /** * 需要 isCrossDrag,用于分组表头,是否同级/跨层列拖拽,启用后允许跨拖拽列拖拽(除了上级拖到子级) */ isCrossDrag?: boolean /** * 需要 isCrossDrag,是否允许拖拽成目标列的子级 */ isToChildDrag?: boolean /** * 用于分组表头,是否允许将自己拖拽到子孙列中 */ isSelfToChildDrag?: boolean /** * 是否显示拖拽辅助状态显示 */ showGuidesStatus?: boolean /** * 是否显示拖拽动画,启用后由数据量的大小来影响渲染性能 */ animation?: boolean /** * 是否禁用拖拽按钮 */ disabledMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 是否显示拖拽按钮 */ visibleMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 自定义提示内容 */ tooltipMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): string | number | null /** * 拖拽开始时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽 */ dragStartMethod?(params: VxeTableDefines.ColumnDragstartEventParams<D>): boolean /** * 拖拽结束时是否允许行拖拽调整顺序的方法,该方法的返回值用来决定是否允许被拖拽调整顺序 */ dragEndMethod?(params: Omit<VxeTableDefines.ColumnDragendEventParams<D>, '_index'>): Promise<boolean> | boolean /** * 用于 isToChildDrag,在拖拽完成后,该方法的返回值用于决定是否拖拽成子级 */ dragToChildMethod?(params: Omit<VxeTableDefines.ColumnDragToChildMethod<D>, '_index'>): boolean /** * 自定义插槽模板 */ slots?: { tip?: string | ((params: VxeTableDefines.ColumnDragSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) } } /** * 自定义列配置项 */ export interface CustomConfig<D = VxeTablePropTypes.Row> { /** * 是否启用,支持局部/全局启用 */ enabled?: boolean /** * 是否启用 localStorage 本地保存,会将列操作状态保留在本地(需要有 id) */ storage?: boolean | VxeTableDefines.VxeTableCustomStorageObj restoreStore?(params: { id: string type: 'restore' storeData: VxeTableDefines.CustomStoreData }): VxeTableDefines.CustomStoreData | Promise<VxeTableDefines.CustomStoreData> updateStore?(params: { id: string type: 'reset' | 'confirm' | 'update:width' | 'update:fixed' | 'update:sort' | 'update:visible' storeData: VxeTableDefines.CustomStoreData }): Promise<any> mode?: 'default' | 'modal' | 'drawer' | 'simple' | 'popup' | '' | null modalOptions?: { title?: VxeModalPropTypes.Title width?: VxeModalPropTypes.Width minWidth?: VxeModalPropTypes.MinWidth height?: VxeModalPropTypes.Height minHeight?: VxeModalPropTypes.MinHeight className?: VxeModalPropTypes.ClassName showZoom?: VxeModalPropTypes.ShowZoom showMaximize?: VxeModalPropTypes.ShowMaximize showMinimize?: VxeModalPropTypes.ShowMinimize mask?: VxeModalPropTypes.Mask lockView?: VxeModalPropTypes.LockView resize?: VxeModalPropTypes.Resize escClosable?: VxeModalPropTypes.EscClosable maskClosable?: VxeModalPropTypes.MaskClosable } drawerOptions?: { title?: VxeDrawerPropTypes.Title width?: VxeDrawerPropTypes.Width className?: VxeDrawerPropTypes.ClassName position?: VxeDrawerPropTypes.Position mask?: VxeDrawerPropTypes.Mask lockView?: VxeDrawerPropTypes.LockView resize?: VxeDrawerPropTypes.Resize escClosable?: VxeDrawerPropTypes.EscClosable maskClosable?: VxeDrawerPropTypes.MaskClosable } trigger?: 'manual' | 'hover' | 'click' | '' | null immediate?: boolean placement?: 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' /** * 自定义列是否允许列选中的方法,该方法的返回值用来决定这一列的 checkbox 是否可以选中 */ checkMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 自定义列是否的方法,该方法的返回值用来决定这一列是否显示 */ visibleMethod?(params: { column: VxeTableDefines.ColumnInfo<D> }): boolean allowVisible?: boolean allowFixed?: boolean allowSort?: boolean allowResizable?: boolean showFooter?: boolean icon?: string resetButtonText?: string closeButtonText?: string cancelButtonText?: string confirmButtonText?: string /** * 自定义列的插槽模板 */ slots?: { header?: string | ((params: VxeTableDefines.CustomSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) top?: string | ((params: VxeTableDefines.CustomSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) bottom?: string | ((params: VxeTableDefines.CustomSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) default?: string | ((params: VxeTableDefines.CustomSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) footer?: string | ((params: VxeTableDefines.CustomSlotParams) => VxeComponentSlotType | VxeComponentSlotType[]) } } export interface CustomOpts<D = VxeTablePropTypes.Row> extends CustomConfig<D> { } /** * 列调整配置项 */ export interface ResizableConfig<D = VxeTablePropTypes.Row> { /** * 拖拽模式,如果是列拖拽,则支持自适应和固定模式 */ dragMode?: 'auto' | 'fixed' | '' /** * 所有单元格默认允许拖拽调整行高 */ isAllRowDrag?: boolean /** * 所有单元格默认允许拖拽调整列宽 */ isAllColumnDrag?: boolean /** * 显示列宽拖拽提示,拖拽过程中实时显示列宽 */ showDragTip?: boolean /** * 双击自适应列宽,启用后双击拖拽线,自动根据整列的内容自适应调整列宽 */ isDblclickAutoWidth?: boolean /** * 双击自适应行高,启用后双击拖拽线,自动根据整列的内容自适应调整行高 */ isDblclickAutoHeight?: boolean /** * 当拖拽调整列宽时,是否自动同步更新所选区域的所有列宽 */ isSyncAutoWidth?: boolean /** * 当拖拽调整行高时,是否自动同步更新所选区域的所有行高 */ isSyncAutoHeight?: boolean /** * 行高拖动的最小高度 */ minHeight?: number | string | ((params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number $rowIndex: number rowIndex: number row: any }) => number | string) /** * 行高拖动的最大高度 */ maxHeight?: number | string | ((params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number $rowIndex: number rowIndex: number row: any }) => number | string) /** * 列宽拖动的最小宽度 */ minWidth?: number | string | ((params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number $rowIndex: number cell?: HTMLElement }) => number | string) /** * 列宽拖动的最大宽度 */ maxWidth?: number | string | ((params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number $rowIndex: number cell?: HTMLElement }) => number | string) } export interface ResizableOpts<D = VxeTablePropTypes.Row> extends ResizableConfig<D> { } /** * 序号配置项 */ export interface SeqConfig<D = VxeTablePropTypes.Row> { startIndex?: number seqMethod?(params: { column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number row: D rowIndex: number $rowIndex: number }): number | string } export interface SeqOpts<D = VxeTablePropTypes.Row> extends SeqConfig<D> { } interface SortConfigDefaultSort { field: string order: SortOrder } /** * 排序配置项 */ export interface SortConfig<D = VxeTablePropTypes.Row> { defaultSort?: SortConfigDefaultSort | SortConfigDefaultSort[] orders?: SortOrder[] sortMethod?(params: { $table: VxeTableConstructor<D> data: D[] sortList: VxeTableDefines.SortCheckedParams[] }): any[] remote?: boolean multiple?: boolean /** * 只对 multiple 有效,是否按照先后触发顺序进行排序 */ chronological?: boolean /** * 只对 allowBtn 有效,是否启用当点击排序图标时,如果与当前一致,则取消排序 */ allowClear?: boolean /** * 是否允许点击排序图标进行操作 */ allowBtn?: boolean trigger?: 'default' | 'cell' /** * 是否显示排序按钮图标 */ showIcon?: boolean /** * 排序按钮图标的显示方法,该方法的返回值用于决定该列是否显示排序按钮图标 * @param params */ iconVisibleMethod?(params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> }): boolean /** * 自定义列头升级按钮的 title 提示语 */ ascTitle?: string | number /** * 自定义列头倒序按钮的 title 提示语 */ descTitle?: string | number iconLayout?: 'horizontal' | 'vertical' iconAsc?: string iconDesc?: string } export type SortOrder = 'asc' | 'desc' | '' | null export interface SortOpts<D = VxeTablePropTypes.Row> extends SortConfig<D> { orders: SortOrder[] } /** * 筛选配置项 */ export interface FilterConfig<D = VxeTablePropTypes.Row> { filterMethod?:(params: { options: VxeTableDefines.FilterOption[] values: any[] cellValue: any row: D column: VxeTableDefines.ColumnInfo<D> }) => any /** * 是否精确筛选到每一行,默认情况下是父级被匹配到则所有子级也被匹配;如果传 true 则会对每一行进行筛选 */ isEvery?: boolean /** * 是否启用远程筛选 */ remote?: boolean /** * 是否显示筛选按钮图标 */ showIcon?: boolean /** * 筛选按钮图标的显示方法,该方法的返回值用于决定该列是否显示筛选按钮图标 * @param params */ iconVisibleMethod?(params: { $table: VxeTableConstructor<D> column: VxeTableDefines.ColumnInfo<D> }): boolean transfer?: boolean iconNone?: string iconMatch?: string destroyOnClose?: boolean confirmButtonText?: string resetButtonText?: string } export interface FilterOpts<D = VxeTablePropTypes.Row> extends FilterConfig<D> { } /** * 单选框配置 */ export interface RadioConfig<D = VxeTablePropTypes.Row> { reserve?: boolean labelField?: string checkRowKey?: string | number checkMethod?(params: { row: D }): boolean visibleMethod?(params: { row: D }): boolean trigger?: 'default' | 'cell' | 'row' | 'manual' | '' | null highlight?: boolean strict?: boolean } export interface RadioOpts<D = VxeTablePropTypes.Row> extends RadioConfig<D> { } /** * 复选框配置项 */ export interface CheckboxConfig<D = VxeTablePropTypes.Row> { /** * 自定义列头复选框的 title 提示语 */ headerTitle?: string | number /** * 是否保留勾选状态,对于某些场景可能会用到,比如数据被刷新之后还保留之前选中的状态 */ reserve?: boolean /** * 是否显示保留勾选状态,启用后如果存在保留记录,则未勾选当前页数据也会显示未半选状态 */ showReserveStatus?: boolean /** * 复选框显示的字段名,可以直接显示在复选框中 */ labelField?: string /** * 绑定选中属性,行数据中必须存在该字段,否则无效 */ checkField?: string indeterminateField?: string /** * 是否显示全选按钮,如果 checkStrictly=true 则默认为 false */ showHeader?: boolean /** * 默认勾选所有,只会在初始化时被触发一次 */ checkAll?: boolean /** * 默认勾选指定行,只会在初始化时被触发一次,需要有 row-config.keyField */ checkRowKeys?: string[] | number[] /** * 是否严格的遵循父子不互相关联的做法 */ checkStrictly?: boolean /** * 严格模式,当数据为空或全部禁用时,列头的复选框为禁用状态 */ strict?: boolean /** * 开启复选框指定行选择功能,启用后通过鼠标点击和 shift 键选取指定范围的行 */ isShiftKey?: boolean /** * 是否允许勾选的方法,该方法,的返回值用来决定这一行的 checkbox 是否可以勾选 */ checkMethod?(params: { row: D }): boolean /** * 是否允许勾选的方法,该方法,的返回值用来决定这一行的 checkbox 是否显示 */ visibleMethod?(params: { row: D }): boolean /** * 触发方式 */ trigger?: 'default' | 'cell' | 'row' | 'manual' | '' | null /** * 是否高亮勾选行 */ highlight?: boolean /** * 开启复选框范围选择功能,启用后通过鼠标在复选框的列内滑动选中或取消指定行 */ range?: boolean /** * 请使用 indeterminateField * @deprecated */ halfField?: string } export interface CheckboxOpts<D = VxeTablePropTypes.Row> extends CheckboxConfig<D> { } /** * 透视表配置项 */ // export interface PivotConfig<D = any> { // } /** * 提示信息配置项 */ export interface TooltipConfig<D = VxeTablePropTypes.Row> { showAll?: boolean theme?: 'dark' | 'light' | '' | null enterable?: boolean enterDelay?: number leaveDelay?: number contentMethod?(params: { items: any[] row: D rowIndex: number $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number type: 'header' | 'body' | 'footer' | '' | null cell: HTMLElement $event: any }): string | null | void } export interface TooltipOpts<D = any> extends TooltipConfig<D> { } /** * 展开行配置项 */ export interface ExpandConfig<D = any> { labelField?: string expandAll?: boolean expandRowKeys?: string[] | number[] accordion?: boolean trigger?: 'default' | 'cell' | 'row' | 'manual' |'' | null lazy?: boolean reserve?: boolean height?: number padding?: boolean /** * 展开内容的显示模式 */ mode?: 'inside' | 'fixed' | '' | null loadMethod?(params: { $table: VxeTableConstructor<D> row: D rowIndex: number $rowIndex: number }): Promise<void> toggleMethod?(params: { $table: VxeTableConstructor<D> expanded: boolean row: D rowIndex: number $rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number }): boolean visibleMethod?(params: VxeTableDefines.CellRenderBodyParams<D>): boolean showIcon?: boolean iconOpen?: string iconClose?: string iconLoaded?: string } export interface ExpandOpts<D = any> extends ExpandConfig<D> { } /** * 树形结构配置项 */ export interface TreeConfig<D = any> { /** * 自动将列表转为树结构 */ transform?: boolean /** * 用于 tree-config.transform,树节点的字段名 */ rowField?: string /** * 用于 tree-config.transform,树父节点的字段名 */ parentField?: string /** * 树子节点的字段名 */ childrenField?: string /** * 用于 tree-config.transform,树子节点映射的字段名 */ mapChildrenField?: string /** * 树节点的缩进 */ indent?: number /** * 树节点的连接线(启用连接线会降低渲染性能) */ showLine?: boolean /** * 树结构序号显示模式,支持层级序号和自增序号(仅支持 transform) */ seqMode?: 'default' | 'increasing' | '' /** * 默认展开所有子孙树节点(只会在初始化时被触发一次) */ expandAll?: boolean /** * 默认展开指定树节点(只会在初始化时被触发一次,需要有 row-config.keyField) */ expandRowKeys?: string[] | number[] /** * 对于同一级的节点,每次只能展开一个 */ accordion?: boolean /** * 触发方式(注:当多种功能重叠时,会同时触发) */ trigger?: 'default' | 'cell' | 'row' | 'manual' |'' | null /** * 是否使用懒加载(启用后只有指定 hasChildField 字段的节点才允许被点击) */ lazy?: boolean /** * 只对 lazy 启用后有效,标识是否存在子节点,从而控制是否允许被点击 */ hasChildField?: string /** * 是否保留展开状态,对于某些场景可能会用到,比如数据被刷新之后还保留之前展开的状态(需要有 row-config.keyField) */ reserve?: boolean /** * 该方法用于异步加载子节点 */ loadMethod?(params: { $table: VxeTableConstructor<D> row: D }): Promise<any[]> /** * 该方法在展开或关闭触发之前调用,可以通过返回值来决定是否允许继续执行 */ toggleMethod?(params: { $table: VxeTableConstructor<D> expanded: boolean row: D column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number }): boolean /** * 是否显示图标按钮 */ showIcon?: boolean /** * 自定义展开后显示的图标 */ iconOpen?: string /** * 自定义收起后显示的图标 */ iconClose?: string /** * 自定义懒加载中显示的图标 */ iconLoaded?: string /** * 已废弃,请使用 showLine * @deprecated */ line?: boolean /** * 已废弃,请使用 hasChildField * @deprecated */ hasChild?: string /** * 已废弃,请使用 childrenField * @deprecated */ children?: string } export type TreeOpts<D = any> = Required<TreeConfig<D>> /** * 快捷菜单配置项 */ export interface MenuConfig<D = any> { /** * 是否启用 */ enabled?: boolean /** * 表头的右键菜单 */ header?: VxeTableDefines.MenuOptions /** * 内容的右键菜单 */ body?: VxeTableDefines.MenuOptions /** * 表尾的右键菜单 */ footer?: VxeTableDefines.MenuOptions /** * 触发方式 * default(默认右键表格触发), cell(右键单元格触发) */ trigger?: 'default' | 'cell' | '' | null /** * 菜单面板的 className */ className?: string /** * 该函数的返回值用来决定是否允许显示右键菜单(对于需要对菜单进行权限控制时可能会用到) */ visibleMethod?(params: { type: string options: VxeTableDefines.MenuFirstOption[][] columns: VxeTableDefines.ColumnInfo<D>[] row?: D rowIndex?: number column?: VxeTableDefines.ColumnInfo<D> columnIndex?: number }): boolean } export type MenuOpts<D = any> = Required<MenuConfig<D>> /** * 鼠标配置项 */ export interface MouseConfig { /** * 开启单元格选中功能(只对 edit-config.mode=cell 有效) */ selected?: boolean /** * 如果功能被支持,则开启单元格区域选取功能,非连续的区域,按住 Ctrl 键,用鼠标逐一选取 */ area?: boolean /** * 只对 area 启用后有效,是否开启区域扩展选取功能,开启后可以通过鼠标左键按住区域内右下角扩展按钮,将区域横向或纵向扩大(支持扩大区域并复制值) */ extension?: boolean } export interface MouseOpts extends MouseConfig { } /** * 区域配置项 */ export interface AreaConfig<D = any> { /** * 只对 mouse-config.area 启用后有效,启用多区域选取功能 */ multiple?: boolean /** * 用于指定哪些列允许被选取 */ includeFields?: string[] /** * 用于排除指定列允许不允许被选取 */ excludeFields?: string[] /** * 单元格选取的方法,返回是否允许被选取 */ selectedMethod?(params: { row: D column: VxeTableDefines.ColumnInfo<D> $table: VxeTableConstructor<D> $grid: VxeGridConstructor<D> | null | undefined }): boolean /** * 只对 mouse-config.area 启用后有效,表格头部选取功能 */ selectCellByHeader?: boolean /** * 只对 mouse-config.area 启用后有效,表格单元格选取功能 */ selectCellByBody?: boolean /** * 只对 mouse-config.area 启用后有效, * 如果为 true,则选中第一列单元格自动选取一整行, * 如果为指定字段,则选中指定单元格自动选取一整行 */ selectCellToRow?: boolean | string /** * 只对 mouse-config.area 启用后有效,选择单元格后显示列状态 */ showColumnStatus?: boolean /** * 只对 mouse-config.area 启用后有效,选择单元格后显示行状态 */ showRowStatus?: boolean /** * 只对 mouse-config.extension 启用后有效,将被选取区域的值复制到扩展区域中 */ extendByCopy?: boolean /** * 只对 mouse-config.extension 启用后有效,扩展区域时将自动识别数字规则进行计算 */ extendByCalc?: boolean /** * 只对 mouse-config.extension 启用后有效,扩展区域的方向控制 */ extendDirection?: boolean | { /** * 是否允许向上扩展 */ top?: boolean /** * 是否允许向下扩展 */ bottom?: boolean /** * 是否允许向左扩展 */ left?: boolean /** * 是否允许向右扩展 */ right?: boolean } /** * 只对 mouse-config.extension 启用后有效,扩展区域之前的方法,可以通过返回 false 阻止扩展行为 * @param params */ beforeExtendMethod?(params: VxeTableExtendCellAreaDefines.CellAreaExtensionStartParams<D>): boolean /** * 只对 mouse-config.extension 启用后有效,扩展区域之后的方法 * @param params */ afterExtendMethod?(params: VxeTableExtendCellAreaDefines.CellAreaExtensionEndParams<D>): void /** * 当点击表格之外,是否自动清除单元格的选取状态 */ autoClear?: boolean /** * 只对 extendByCalc 启用后有效,重写单元格扩展区域计算值的方法 * @param params */ extendCalcMethod?(params: VxeTableExtendCellAreaDefines.ExtendCellAreaCalcBaseParams<D>): any[][] /** * 只对 extendByCopy | extendByCalc 启用后有效,重写单元格扩展区域赋值的方法 * @param params */ extendSetMethod?(params: { cellValue: any row: D column: VxeTableDefines.ColumnInfo<D> } & VxeTableExtendCellAreaDefines.ExtendCellAreaCalcBaseParams<D>): void /** * 只对 extendByCopy | extendByCalc 启用后有效,自定义单元格扩展区域赋值之前的方法,可以通过返回 false 阻止扩展赋值行为 * @param params */ beforeExtendSetMethod?(params: VxeTableExtendCellAreaDefines.ExtendCellAreaCalcBaseParams<D>): boolean /** * 只对 extendByCopy | extendByCalc 启用后有效,自定义单元格扩展区域赋值之后的方法 * @param params */ afterExtendSetMethod?(params: { extendValues: any[][] } & VxeTableExtendCellAreaDefines.ExtendCellAreaCalcBaseParams<D>): void } export interface AreaOpts<D = any> extends AreaConfig<D> { } /** * 按键配置项 */ export interface KeyboardConfig<D = any> { /** * 是否开启非编辑状态下,上下左右移动功能 */ isArrow?: boolean /** * 是否开启Esc键退出编辑功能 */ isEsc?: boolean /** * 是否开启删除键功能 */ isDel?: boolean /** * 是否开启回退键功能 */ isBack?: boolean /** * 是否开启回车移动上下行移动 */ isEnter?: boolean /** * 如果功能被支持,用于 mouse-config.area,开启同时按住方向键以活动区域为起始,向指定方向延伸单元格区域 */ isShift?: boolean /** * 是否开启TAB键左右移动功能 */ isTab?: boolean /** * 是否开启单元格选择编辑 */ isEdit?: boolean /** * 用于 mouse-config.area,开启合并和取消合并功能 */ isMerge?: boolean /** * 用于 mouse-config.area,开启复制/剪贴/粘贴功能 */ isClip?: boolean /** * 如果功能被支持,用于 mouse-config.area,开启查找和替换功能 */ isFNR?: boolean /** * 用于 mouse-config.area & column.type=checkbox|radio,开启空格键切换复选框或单选框状态功能 */ isChecked?: boolean /** * 用于 mouse-config.area,方向键光标锁,开启后将支持两种状态 * 非聚焦式输入状态:默认情况下,可以按方向键移动单元格。 * 聚焦式输入状态:如果需要移动光标,可以按 F2 键或者鼠标左键点击输入框,切换为聚焦输入状态,就可以用方向键左右移动光标 */ arrowCursorLock?: boolean /** * 用于 mouse-config.area,是否将回车键行为改成 Tab 键行为 */ enterToTab?: boolean /** * 只有 isEdit 有效,编辑模式,支持覆盖式和末端插入式编辑 */ editMode?: 'coverage' | 'insert' | '' | null /** * 当在最后一行按下回车键时,自动插入新行 */ isLastEnterAppendRow?: boolean /** * 只对 isEnter=true 有效,用于回车键执行之前的方法,返回 false 可以阻止默认行为 */ beforeEnterMethod?(params: { row: D rowIndex: number $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number $table: VxeTableConstructor<D> }): boolean /** * 只对 isEnter=true 有效,用于重写回车键的方法 */ enterMethod?(params: { row: D rowIndex: number $rowIndex: number _rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $columnIndex: number _columnIndex: number $table: VxeTableConstructor<D> }): void /** * 只对 isDel=true 有效,用于重写删除键的方法 */ delMethod?(params: { row: D rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $table: VxeTableConstructor<D> }): void /** * 只对 isDel=true 有效,用于重写回退键清空单元格内容并激活为编辑状态方法 */ backMethod?(params: { row: D rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $table: VxeTableConstructor<D> }): void /** * 只对 isEdit=true 有效,用于重写编辑单元格方法 */ editMethod?(params: { row: D rowIndex: number column: VxeTableDefines.ColumnInfo<D> columnIndex: number $table: VxeTableConstructor<D> $grid: VxeGridConstructor<D> | null | undefined }): void } export interface KeyboardOpts<D = any> extends KeyboardConfig<D> { } /** * 复制/粘贴配置项 */ export interface ClipConfig<DT = any> { /** * 是否启用复制功能 */ isCopy?: boolean /** * 是否启用剪贴功能 */ isCut?: boolean /** * 是否启用粘贴功能 */ isPaste?: boolean /** * 只对 tree-config 启用有效,是否深层粘贴,用于树结构,启用后粘贴时会覆盖到子级数据进行粘贴 */ isDeepPaste?: boolean /** * 是否填充粘贴,如果启用了,当被选取的粘贴单元格与粘贴单元格的行与列数量不匹配时,会将内容强制粘贴所选的单元格 */ isFillPaste?: boolean /** * 是否启用行自增,当粘贴的行数超出表格时自动插入新行 */ isRowIncrement?: boolean /** * 是否启用列自增,当粘贴的列数超出表格时自动插入新列(需要注意自增的列自字段是否定义,否则将无法响应) */ isColumnIncrement?: boolean /** * 用于指定哪些列允许被复制粘贴 */ includeFields?: string[] /** * 用于排除指定列允许不允许被复制粘贴 */ excludeFields?: string[] /** * 重写单元格复制取值的方法,将单元格复制到剪贴板 */ copyMethod?(params: { isCut: boolean row: DT column: VxeTableDefines.ColumnInfo<DT> cellValue: any $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): string /** * 自定义单元格复制取值之前的方法,可以通过返回 false 阻止复制行为 */ beforeCopyMethod?(params: { isCut: boolean activeArea: VxeTableExtendCellAreaDefines.MouseActiveCellArea targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): boolean /** * 自定义单元格复制到剪贴板之后的方法 */ afterCopyMethod?(params: { isCut: boolean targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): boolean /** * 重写单元格剪贴值清除的方法,将剪贴单元格的值清除 */ cutMethod?:(params: { row: DT, column: VxeTableDefines.ColumnInfo<DT> cellValue: any clipData: { text?: string html?: string } $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }) => void /** * 自定义单元格剪贴值清除之前的方法,可以通过返回 false 阻止清除行为 */ beforeCutMethod?:(params: { activeArea: VxeTableExtendCellAreaDefines.MouseActiveCellArea cutAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] clipData: { text?: string html?: string } $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }) => boolean /** * 自定义单元格剪贴值清除之后的方法 */ afterCutMethod?:(params: { cutAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }) => void /** * 重写单元格粘贴赋值的方法,从剪贴板赋值到单元格 */ pasteMethod?(params: { isCut: boolean row: DT, column: VxeTableDefines.ColumnInfo<DT> cellValue: any clipData: { text?: string html?: string } $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): void /** * 自定义单元格粘贴赋值之前的方法,可以通过返回 false 阻止复制行为 */ beforePasteMethod?(params: { isCut: boolean activeArea: VxeTableExtendCellAreaDefines.MouseActiveCellArea cutAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] cellValues: string[][] pasteCells: string[][] clipData: { text?: string html?: string } $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): boolean /** * 自定义单元格粘贴赋值之后的方法 */ afterPasteMethod?(params: { isCut: boolean currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] cutAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] cellValues: any[][] pasteCells: string[][] insertRows: DT[] insertColumns: VxeTableDefines.ColumnInfo<DT>[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): boolean /** * 只对 isRowIncrement 有效,自定义创建自增行数据的方法 */ createRowsMethod?(params: { currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] cellValues: any[][] pasteCells: string[][] insertRows: DT[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): DT[] /** * 只对 isColumnIncrement 有效,自定义创建自增列配置的方法 */ createColumnsMethod?(params: { currentAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] targetAreas: VxeTableExtendCellAreaDefines.CellAreaParams<DT>[] cellValues: any[][] pasteCells: string[][] insertColumns: VxeTableDefines.ColumnOptions[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): VxeTableDefines.ColumnOptions<DT>[] } export interface ClipOpts<D = any> extends ClipConfig<D> { } /** * 查找/替换配置项 */ export interface FNRConfig<DT = any> { /** * 是否启用查找功能 */ isFind?: boolean /** * 自定义单元格查找方法 */ findMethod?(params: { cellValue: any row: DT column: VxeTableDefines.ColumnInfo<DT> isWhole: boolean isRE: boolean isSensitive: boolean findValue: string | null findRE: RegExp | null }): boolean /** * 自定义单元格查找之前的方法,可以通过返回 false 阻止查找行为 */ beforeFindMethod?(params: { isAll: boolean findValue: string | null $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): boolean /** * 自定义单元格查找之后的方法 */ afterFindMethod?(params: { isAll: boolean findValue: string | null result: VxeTableExtendCellAreaDefines.FindAndReplaceResult[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }): void /** * 是否启用替换功能 */ isReplace?: boolean /** * 自定义单元格替换方法 */ replaceMethod?:(params: { row: DT column: VxeTableDefines.ColumnInfo<DT> cellValue: any findValue: string replaceValue: string }) => void /** * 自定义单元格替换之前的方法,可以通过返回 false 阻止替换行为 */ beforeReplaceMethod?:(params: { isAll: boolean findValue: string replaceValue: string $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }) => boolean /** * 自定义单元格替换之后的方法 */ afterReplaceMethod?:(params: { isAll: boolean findValue: string replaceValue: string result: VxeTableExtendCellAreaDefines.FindAndReplaceResult[] $table: VxeTableConstructor<DT> & VxeTablePrivateMethods<DT> $grid: VxeGridConstructor<DT> | null | undefined }) => void } export interface FNROpts<D = any> extends FNRConfig<D> { } /** * 编辑配置项 */ export interface EditConfig<DT = any> { /** * 触发方式 * - manual(手动触发方式,只能用于 mode=row) * - click(点击触发编辑) * - dblclick(双击触发编辑) */ trigger?: 'manual' | 'click' | 'dblclick' | '' | null /** * 是否启用 */ enabled?: boolean /** * 编辑模式 * - cell(单元格编辑模式) * - row(行编辑模式) */ mode?: 'cell' | 'row' | '' | null /** * 自定义可编辑列的状态图标 */ icon?: string /** * 是否显示列头编辑图标 */ showIcon?: boolean /** * 只对 keep-source 开启有效,是否显示单元格新增与修改状态 */ showStatus?: boolean /** * 只对 keep-source 开启有效,是否显示单元格修改状态 */ showUpdateStatus?: boolean /** * 只对 keep-source 开启有效,是否显示单元格新增状态 */ showInsertStatus?: boolean /** * 是否显示必填字段的红色星号 */ showAsterisk?: boole