tdesign-react
Version:
TDesign Component for React
30 lines (29 loc) • 1.17 kB
TypeScript
export declare function omit(obj: object, fields: string[]): object;
export declare function removeEmptyAttrs<T>(obj: T): Partial<T>;
export declare function getTabElementByValue(tabs: [], value: string): object;
export declare function firstUpperCase(str: string): string;
export type Gradients = {
[percent: string]: string;
};
export type FromTo = {
from: string;
to: string;
};
export type LinearGradient = {
direction?: string;
} & (Gradients | FromTo);
export declare function getBackgroundColor(color: string | string[] | LinearGradient): string;
export declare function getPropsApiByEvent(eventName: string): string;
/**
* 兼容样式中支持 number/string 类型的传值 得出最后的结果。
* @param param number 或 string 类型的可用于样式上的值
* @returns 可使用的样式值。
*/
export declare function pxCompat(param: string | number): string;
/**
* 获取元素相对于容器(祖先)的偏移量
* @param element 目标元素
* @param container 容器元素
* @returns 相对于容器的偏移量
*/
export declare function getOffsetTopToContainer(element: HTMLElement, container: HTMLElement): number;