UNPKG

@aplus-frontend/utils

Version:

Utils for Aplus frontend team.

140 lines (139 loc) 4.13 kB
import { OpUnitType } from 'dayjs'; import { ZoneAlias } from '../date/index'; import { CSSProperties, Component, VNode } from 'vue'; import { LiteralUnion } from '../vue/types'; export declare const LOS_ANGELES_TIMEZONE = -7; export declare const DEFAULT_TIMEZONE = 8; export declare const DEFAULT_START_Date_KEY = "startDate"; export declare const DEFAULT_END_Date_KEY = "endDate"; /** * params 数据对象 */ export interface ValuesType { [key: string]: any; } /** * 时间转换配置对象 */ export interface ArrayTimeTransformObj { /** * 字段key */ key: string; /** * 时间要转为 开始时间的key, 默认为 startDate */ startKey?: string; /** * 时间要转为 结束时间的key, 默认为 endDate */ endKey?: string; /** * 时间以 天为单位,但是以秒为单位,计算时间的开始时间和结束时间 */ timeOf?: OpUnitType; /** * 要转换的目标时区 */ targetUtc?: number | LiteralUnion<ZoneAlias, string>; /** * 当前时区 */ currentUtc?: number | LiteralUnion<ZoneAlias, string>; } /** * 对时区进行操作 * @param time 时间戳 * @param val 偏移量 * @returns */ export declare function computeTimezone(time: number, val: number): number; /** * 正对 vben3 表格参数进行格式方法, * 对于时间的请求参数内置对于时区的转化,默认为 转换目标时区为 洛杉矶时区(-7),当前时区默认为 东八区 * @param values 请求参数 * @param timeConfigArr 时间 * @returns */ export declare function transformTableParams(values: ValuesType, timeConfigArr?: ArrayTimeTransformObj[]): any; interface ArrayTimeTransformNoTimezoneObj { /** * 字段key */ key: string; /** * 时间要转为 开始时间的key, 默认为 startDate */ startKey?: string; /** * 时间要转为 结束时间的key, 默认为 endDate */ endKey?: string; } /** * 对 表格参数进行格式方法, * 不处理时区问题 * @param values 请求参数 * @param timeConfigArr 时间 * @returns */ export declare function transformTableParamsNoTimezone(values: ValuesType, timeConfigArr?: ArrayTimeTransformNoTimezoneObj[]): any; /** * 表格供应商展示 * @deprecated 已废弃,请使用相关UI组件替换 * @param tenantName 供应商名称 * @param tenantCode 供应商编码 * @param Tooltip ant提示组件 * @returns */ export declare function setCellTenant(tenantName: string, tenantCode: string, Tooltip: Component): VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any; }>; /** * 单行多字段展示样式配置 */ export type CellLinesStyleConfig = { /** * label样式 */ labelStyle?: CSSProperties; /** * value样式 */ valueStyle?: CSSProperties; /** * cellLine item样式 */ linesItemStyle?: CSSProperties; /** * cellLines Wrapper样式 */ linesWrapperStyle?: CSSProperties; }; /** * Admin端表格单元格多字段展示+延迟显示Tooltip * @deprecated 已废弃,请使用相关UI组件替换 * @param data 展示的数据对象 * @param Tooltip ant提示组件 * @param styleConfig 单行多字段展示样式配置 * @returns */ export declare const setCellLinesToB: (data: { [key: string]: any; }, Tooltip?: VNode | Component | boolean, styleConfig?: CellLinesStyleConfig) => VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any; }>; /** * Aplus端表格单元格多字段展示+延迟显示Tooltip * @deprecated 已废弃,请使用相关UI组件替换 * @param { [key: string]: any } data 展示的数据对象 * @param Tooltip ant提示组件 * @param styleConfig 单行多字段展示样式配置 * @returns */ export declare const setCellLinesToC: (data: { [key: string]: any; }, Tooltip?: VNode | Component | boolean, styleConfig?: CellLinesStyleConfig) => VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any; }>; export {};