UNPKG

tav-ui

Version:
167 lines (166 loc) 6.01 kB
import type { FormSchema } from 'tav-ui/es/components/form/src/types/form'; import type { ButtonProps } from 'tav-ui/es/components/button/src/types'; import type { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip'; import type { CSSProperties, ComputedRef, Ref } from 'vue'; import type { VxeGridPropTypes } from 'vxe-table'; import type { TableProColumn } from './types'; export interface PagerConfig extends VxeGridPropTypes.PagerConfig { controller?: 'backend' | 'frontend'; } export interface TableProFilterForm { inputForm?: Omit<FormSchema, 'label' | 'component'> | FormSchema; pannelForm?: FormSchema[]; getPopupContainer?: () => HTMLElement; } export interface TableProFilterFormConfig extends TableProFilterForm { enabled?: boolean; } interface CustomAction { permission?: string; permissionCode?: number; usePermission?: { code: string; ref: any; row?: any; }; handleBeforeAction?: (e: Event) => void; handleAction?: (e: Event) => void; handleAfterAction?: (e: Event) => void; } declare type defaultValueKey = 'fileName' | 'fileSeq' | 'fileType' | 'fileContainFields'; export interface TableProCustomActionConfig { enabled?: boolean; add?: CustomAction | boolean; delete?: CustomAction | boolean; import?: CustomAction | boolean; export?: (CustomAction & { fileName?: string; /** 对导出的数据进行格式化等操作,数据的导出与数据的展示列配置是分开管理的,只能是扁平数组 */ columns?: (...args: any[]) => { field: string; title?: string; minWidth?: number; visible?: boolean; cellContent?: (...args: any[]) => any; cellFormat?: (...args: any[]) => any; }[]; defaultValue: Partial<Record<defaultValueKey, any>>; fileDataTypeOptionsConfig?: (...args: [Record<string, string>[]]) => Record<string, string>[]; /** color 相关的格式必须为 argb,即 #212121 => 212121 */ styles?: { headerHeight?: number; headerBackgroundColor?: string; headerFontSize?: number; cellHeight?: number; cellFontColor?: string; cellFontSize?: number; cellBorderStyle?: string; cellBorderColor?: string; footerHeight?: number; footerBackgroundColor?: string; footerFontSize?: number; descriptionHeight?: number; descriptionBackgroundColor?: string; descriptionFontSize?: number; descriptionAlign?: string; }; handleDescription?: (...args: any[]) => any; /** 是否在导出表格中显示隐藏列,默认 false(不显示) */ useUnvisibleColumn?: boolean; /** 针对页面上有 tab 页签的情况,将 tab 对应的字段名传进来 */ keepedApiParamKeys?: string[]; /** 使用默认接口进行前端导出后对数据做处理,类似 tablepro 的 afterapi */ afterApi?: (...args: any[]) => any; /** 使用后端导出,传入后端导出接口,类似 tablepro 的 api */ useBackendApi?: (...args: any[]) => any; }) | boolean; refresh?: CustomAction | boolean; column?: CustomAction | boolean; statistical?: CustomAction | boolean; checkboxCache?: (CustomAction & { fieldNames?: Record<'label', any>; }) | boolean; } export declare type VxeQueryParams = VxeGridPropTypes.ProxyAjaxQueryParams; export declare type TableProApiParams = { filter?: Record<string, any>; model?: Record<string, any>; clearSelect?: boolean; page?: number; }; export interface TableProApi<T> { (option: TableProApiParams): T; } export interface TableProInnerInfo { userInfo?: Record<string, any>; columnsInfoGet?: (...arg: any[]) => Promise<any>; columnsInfoSet?: (...arg: any[]) => Promise<any>; } export interface TableProTagsConfig { /** label 对应的字段 */ label?: string; /** value 对应的字段 */ value?: string; /** tag 颜色 */ color?: string; round?: boolean | string; /** tag 自定义样式 */ style?: CSSProperties; } export interface TableProPopConfirm { title: string; okText?: string; cancelText?: string; confirm: (...arg: any[]) => any; cancel?: (...arg: any[]) => any; icon?: string; placement?: 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom' | 'bottomLeft' | 'bottomRight'; } export interface TableProActionItem extends ButtonProps { onClick?: (...arg: any[]) => any; label?: string; blankLabel?: string; color?: 'success' | 'error' | 'warning'; icon?: string; popConfirm?: TableProPopConfirm; disabled?: boolean; divider?: boolean; limit?: number; enabled?: boolean | ((action: TableProActionItem) => boolean); tooltip?: string | TooltipProps; permission?: string; permissionCode?: number; } export interface TreeDataItem { value: string; key: string; title?: string; disabled?: boolean; children?: TreeDataItem[]; } /** 把tree需要的数据融合进column */ export declare type CustomActionSettingColumnOption = TableProColumn & { key?: string; value?: any; disabled?: boolean; }; export interface CustomActionSettingColumn { coverColumnsSetting: (columns: CustomActionSettingColumnOption[], checkedList: string[]) => void; handleColumnClick: () => void; } export interface CustomActionSetting { refreshRef: null; columnRef: Ref<CustomActionSettingColumn>; showColumnsModa: () => void; } export interface CustomActionRef { addRef: null; deleteRef: null; importRef: null; exportRef: null; showExportModal: () => void; showColumnsModa: () => void; settingsRef: Ref<CustomActionSetting>; actionRef: Ref<ComputedRef>; } export {};