UNPKG

@arco-vue-pro-components/pro-components

Version:
98 lines (97 loc) 3.89 kB
import { Ref } from 'vue'; import { PaginationProps } from '@arco-design/web-vue'; import type { ActionType, ColumnEmptyText, ProColumns, ProTableTypes, ValueEnumMap, ValueEnumObj, RequestData, UseFetchDataAction } from '../interface'; /** * 获取用户的 action 信息 * * @param actionRef * @param action * @param onCleanSelected */ export declare function useActionType<T>(actionRef: Ref<ActionType | undefined>, action: UseFetchDataAction<T>, props: { getSelected: () => { selectedKeys: any[]; selectedRows: any[]; }; fullScreen: () => void; onCleanSelected: () => void; resetAll: () => void; }): void; /** * 根据 key 和 dataIndex 生成唯一 id * * @param key 用户设置的 key * @param dataIndex 在对象中的数据 * @param index 序列号,理论上唯一 */ export declare const genColumnKey: (key?: string | number | undefined, index?: string | number | undefined) => string; /** * 减少 width,支持 string 和 number */ export declare const reduceWidth: (width?: string | number | undefined) => string | number | undefined; /** * 转化 columns 到 pro 的格式 主要是 render 方法的自行实现 * * @param columns * @param map * @param columnEmptyText */ export declare function genProColumnToColumn<T>(props: { columns: ProColumns[]; type: ProTableTypes; columnEmptyText: ColumnEmptyText; action: any; slots: any; parentColumnKey?: any; }): any[]; export declare const ObjToMap: (value: ValueEnumObj | ValueEnumMap | undefined) => ValueEnumMap | undefined; /** * 转化 text 和 valueEnum * 通过 type 来添加 Status * @param text * @param valueEnum * @param prue 纯净模式,不增加 status */ export declare const parsingText: (text: string | number, valueEnum?: ValueEnumMap | undefined, pure?: boolean | undefined) => any; /** * 检查值是否存在 * 为了 避开 0 和 false * @param value */ export declare const checkUndefinedOrNull: (value: any) => boolean; export declare function mergePagination<T>(pagination: PaginationProps | boolean | undefined, pageInfo: UseFetchDataAction<T>['pageInfo'], setPageInfo: UseFetchDataAction<RequestData<T>>['setPageInfo'], emit: any): (PaginationProps & { onChange: (page: number) => void; onPageSizeChange: (size: number) => void; }) | false | undefined; export declare const columnFixedSort: (a: any, b: any) => 0 | 2 | -2; export declare const columnSortOrderSort: (a: any, b: any) => number; export declare function loopFilter(column: any[], parentFixed?: any, columnsMap?: any, isTable?: boolean): any[]; export declare function formatFormFields(data: { [propName: string]: any; }): { [propName: string]: any; }; export declare const setFields: (defaultFormData: any, form: any) => void; /** * 把 value 的枚举转化为数组 * @param valueEnum */ export declare const parsingValueEnumToArray: (valueEnum?: ValueEnumMap | undefined) => { value: string | number; text: string; label: string; }[]; /** 如果是个方法执行一下它 */ export declare function runFunction(valueEnum: any, ...rest: any): any; export declare function flattenChildren(arr: any[] | undefined, rowKey: string): any; /** * 用于判断当前是否在浏览器环境中。 * 首先会判断当前是否处于测试环境中(通过 process.env.NODE_ENV === 'TEST' 判断), * 如果是,则返回 true。否则,会进一步判断是否存在 window 对象、document 对象以及 matchMedia 方法 * 同时通过 !isNode 判断当前不是在服务器(Node.js)环境下执行, * 如果都符合,则返回 true 表示当前处于浏览器环境中。 * @returns boolean */ export declare const isBrowser: () => boolean; export declare function getArrDiff(distArr: any[], ...rest: any[]): any[]; export declare function deepClone(obj: any, map?: WeakMap<object, any>): any;