@aplus-frontend/ui
Version:
84 lines (83 loc) • 2.91 kB
TypeScript
import { ZoneAlias } from '@aplus-frontend/utils';
import { FieldPath, FormatOptions } from '../interface';
import { StyleValue } from 'vue';
import { ParagraphProps } from '@aplus-frontend/antdv/es/typography/Paragraph';
/** 处理文本类型 */
export declare function text({ value }: FormatOptions, extraProps?: Omit<ParagraphProps, 'content'>): any;
interface ArrayExtraProps {
/** 默认值空格链接 */
joinSymbol?: string;
}
/** 处理数组类型 */
export declare function array({ value }: FormatOptions, extraProps?: ArrayExtraProps): any;
interface DateExtraProps {
/** 时区默认为LA */
zoneAlias?: ZoneAlias;
/** 格式化日期格式默认 YYYY-MM-DD HH:mm:ss*/
format?: string;
}
/** 处理日期 */
export declare function date({ value }: FormatOptions, extraProps?: DateExtraProps): string;
interface TemplateExtraProps {
/** 字段列表,有顺序要求 */
fieldList?: FieldPath[];
/** 模版字符串: 格式为 ‘{0}-{0}-{1}’ */
templateString?: string;
/** 获取值后的处理函数 */
formatter?: (value: any, index: number) => any;
}
/** 处理字符串模版 */
export declare function template({ value, record }: FormatOptions, extraProps: TemplateExtraProps): string;
interface DateRangeExtraProps {
/** 字段列表,有顺序要求 */
fieldList: [FieldPath, FieldPath];
/** 日期格式化
* @default 'YYYY-MM-DD HH:mm:ss''
*/
format?: string | [string, string];
/** 链接符号
* @default '~'
*/
joinSymbol?: string;
/** 时区别名
* @default 'LA' */
zoneAlias?: ZoneAlias;
}
/** 处理日期范围 */
export declare function dateRange({ value, record }: FormatOptions, extraProps: DateRangeExtraProps): string;
export interface AttachmentExtraProps {
/** url字段路径 */
urlPath?: string | string[];
/** 资源名称字段路径 */
namePath?: string | string[];
/** 字段样式 */
style?: StyleValue;
/** 类名称 */
className?: string;
/** 配置downloadCenterTriggerConfig优先级最高,次配置失效 */
downloadFile?: (url: string, name: string) => void;
}
/** 处理附件类型 */
export declare function attachment({ record }: FormatOptions, opt: AttachmentExtraProps): import("vue/jsx-runtime").JSX.Element;
interface NumberExtraProps {
style?: StyleValue;
/** 限制小数点位数 */
precision?: number;
/**
* 是否固定位数
* @default true
*/
isFixed?: boolean;
}
/** 处理数字型数据 */
export declare function number({ value }: FormatOptions, opt: NumberExtraProps): import("vue/jsx-runtime").JSX.Element;
export declare const formatterMap: {
text: typeof text;
array: typeof array;
date: typeof date;
dateRange: typeof dateRange;
template: typeof template;
number: typeof number;
attachment: typeof attachment;
};
export {};