tav-ui
Version:
64 lines (63 loc) • 2.33 kB
TypeScript
import type { Handler } from './main';
import type { FileItemType, LabelValueOptions, Recordable } from './types';
/**
* ***begin***
* ```javascript
* <TaUpload @register="register" />
*
* const { register, getHandler } = useHandlerInOuter();
*
* getHandler().backfill()
*
* return {
* register
* }
* ```
* ***end***
* @returns hooks
*/
export declare const useHandlerInOuter: () => {
register: (handler: Handler) => void;
backfill: () => Promise<void>;
getHandler: () => Handler;
clearResponse: () => void;
};
export declare const useFileTypeCode: (fileTypeCode: Recordable<LabelValueOptions<string, any>>) => {
mergeOptions: (moduleCode?: string | string[] | undefined, typeCodeArray?: string[] | undefined, moduleCodePrefix?: string | string[] | undefined) => LabelValueOptions<string, any>;
getOptionsByTypeCodes: (typeCodeArray: string[]) => import("vue").ComputedRef<LabelValueOptions<string, any>>;
getOptionsByModuleCode: (moduleCode: string | string[]) => LabelValueOptions<string, any>;
getOptionsByModuleCodePrefix: (prefix: string | string[]) => LabelValueOptions<string, any>;
};
/**
* 操作列按钮所需要的最大列宽度
* @param arr ${string[]}
* @param param1 config { margin=40, fontSize=12, appendWidth=10 }
* @returns maxWidth ${number}
*/
export declare function getActionColumnMaxWidth(arr: string[], { margin, fontSize, appendWidth, }?: {
margin?: number;
fontSize?: number;
appendWidth?: number;
}): number;
export declare type UseFileFormatterParamsType = {
/**
* 更新时保存多少文件历史版本
*
* `"newest"` 仅保留最后一次更新
*
* `"all"` 保留当前版本往后所有更新
* @default "newest"
*/
fileVersionCount?: 'newest' | 'all';
};
export declare function useFileFormatter({ fileVersionCount }?: UseFileFormatterParamsType): {
formatToApi: (files: FileItemType[]) => {
actualId: string;
moduleCode: string | undefined;
versionList: FileItemType[];
}[];
upadteVersion: (file: FileItemType) => void;
getFilesByActualId: (actualId: string) => FileItemType[] | undefined;
getBasicFileByActualId: (actualId: string) => FileItemType | undefined;
getNewestFileByActualId: (actualId: string) => FileItemType | undefined;
};