UNPKG

3.88 kBTypeScriptView Raw
1import { AxisTypes } from './components/axis/types';
2import type { Types } from '@antv/f2-graphic';
3type PX_FIELD_NAME = 'lineWidth' | 'lineDash' | 'x' | 'y' | 'r' | 'r0' | 'x1' | 'y1' | 'x2' | 'y2' | 'radius' | 'width' | 'height' | 'fontSize' | 'sx' | 'sy' | 'swidth' | 'sheight' | 'points' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY';
4type pxstr = `${number}px`;
5export type px = number | pxstr | string;
6export type Point = Types.Point;
7export interface PxPoint {
8 x: px;
9 y: px;
10}
11export interface DataRecord {
12 origin: any;
13 [k: string]: any;
14}
15export * from '@antv/scale';
16export type { AxisTypes };
17type SupportPx<T> = {
18 [k in keyof T]: k extends PX_FIELD_NAME ? NonNullable<T[k]> extends number ? number | pxstr : NonNullable<T[k]> extends number[] ? number[] | pxstr[] : NonNullable<T[k]> extends Types.Point[] ? PxPoint[] : T[k] : T[k];
19};
20export interface Style {
21 width?: px;
22 height?: px;
23 minWidth?: px;
24 minHeight?: px;
25 maxWidth?: px;
26 maxHeight?: px;
27 left?: px;
28 right?: px;
29 top?: px;
30 bottom?: px;
31 margin?: px | px[];
32 marginTop?: px;
33 marginRight?: px;
34 marginBottom?: px;
35 marginLeft?: px;
36 padding?: px | px[];
37 paddingTop?: px;
38 paddingRight?: px;
39 paddingBottom?: px;
40 paddingLeft?: px;
41 flexDirection?: 'column' | 'row';
42 justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around';
43 alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
44 alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
45 display?: 'flex';
46 flex?: number;
47 flexWrap?: 'wrap' | 'nowrap';
48 position?: 'relative' | 'absolute';
49 backgroundColor?: string;
50}
51interface IntrinsicElementsProps {
52 style?: Style;
53 [k: string]: any;
54}
55export interface Ref {
56 current?: any;
57}
58export interface Props {
59 children?: any;
60 [propName: string]: any;
61}
62export type ElementType = string | ((props: Props, context?: any) => any) | (new (props: Props, context?: any) => any);
63export interface ShapeAttrs extends Partial<SupportPx<Types.ShapeAttrs>> {
64 [k: string]: any;
65}
66export interface GroupProps extends IntrinsicElementsProps {
67 attrs?: RectAttrs;
68}
69export type CircleAttrs = Partial<SupportPx<Types.CircleAttrs>>;
70export interface CircleProps extends IntrinsicElementsProps {
71 attrs?: CircleAttrs;
72}
73export type RectAttrs = Partial<SupportPx<Types.RectAttrs>>;
74export interface RectProps extends IntrinsicElementsProps {
75 attrs?: RectAttrs;
76}
77export type LineAttrs = Partial<SupportPx<Types.LineAttrs>>;
78export interface LineProps extends IntrinsicElementsProps {
79 attrs?: LineAttrs;
80}
81export type PolygonAttrs = Partial<SupportPx<Types.PolygonAttrs>>;
82export interface PolygonProps extends IntrinsicElementsProps {
83 attrs?: PolygonAttrs;
84}
85export type PolylineAttrs = Partial<SupportPx<Types.PolylineAttrs>>;
86export interface PolylineProps extends IntrinsicElementsProps {
87 attrs?: PolylineAttrs;
88}
89export type ArcAttrs = Partial<SupportPx<Types.ArcAttrs>>;
90export interface ArcProps extends IntrinsicElementsProps {
91 attrs?: ArcAttrs;
92}
93export type SectorAttrs = Partial<SupportPx<Types.SectorAttrs>>;
94export interface SectorProps extends IntrinsicElementsProps {
95 attrs?: SectorAttrs;
96}
97export type TextAttrs = Partial<SupportPx<Types.TextAttrs>>;
98export interface TextProps extends IntrinsicElementsProps {
99 attrs?: TextAttrs;
100}
101export type CustomAttrs = Partial<SupportPx<Types.CustomAttrs>>;
102export interface CustomProps extends IntrinsicElementsProps {
103 attrs?: CustomAttrs;
104}
105export type MarkerAttrs = Partial<SupportPx<Types.MarkerAttrs>>;
106export interface MarkerProps extends IntrinsicElementsProps {
107 attrs?: MarkerAttrs;
108}
109export type ImageAttrs = Partial<SupportPx<Types.ImageAttrs>>;
110export interface ImageProps extends IntrinsicElementsProps {
111 attrs?: ImageAttrs;
112}
113
\No newline at end of file