Blame view

node_modules/zrender/lib/graphic/Text.d.ts 4.28 KB
bd028579   易尊强   2/28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  import { TextAlign, TextVerticalAlign, ImageLike, Dictionary, MapToType, FontWeight, FontStyle } from '../core/types';
  import TSpan from './TSpan';
  import ZRImage from './Image';
  import Rect from './shape/Rect';
  import BoundingRect from '../core/BoundingRect';
  import { MatrixArray } from '../core/matrix';
  import Displayable, { DisplayableStatePropNames, DisplayableProps } from './Displayable';
  import { ZRenderType } from '../zrender';
  import Animator from '../animation/Animator';
  import Transformable from '../core/Transformable';
  import { ElementCommonState } from '../Element';
  import { GroupLike } from './Group';
  export interface TextStylePropsPart {
      text?: string;
      fill?: string;
      stroke?: string;
      strokeNoScale?: boolean;
      opacity?: number;
      fillOpacity?: number;
      strokeOpacity?: number;
      lineWidth?: number;
      lineDash?: false | number[];
      lineDashOffset?: number;
      borderDash?: false | number[];
      borderDashOffset?: number;
      font?: string;
      textFont?: string;
      fontStyle?: FontStyle;
      fontWeight?: FontWeight;
      fontFamily?: string;
      fontSize?: number | string;
      align?: TextAlign;
      verticalAlign?: TextVerticalAlign;
      lineHeight?: number;
      width?: number | string;
      height?: number;
      tag?: string;
      textShadowColor?: string;
      textShadowBlur?: number;
      textShadowOffsetX?: number;
      textShadowOffsetY?: number;
      backgroundColor?: string | {
          image: ImageLike | string;
      };
      padding?: number | number[];
      margin?: number;
      borderColor?: string;
      borderWidth?: number;
      borderRadius?: number | number[];
      shadowColor?: string;
      shadowBlur?: number;
      shadowOffsetX?: number;
      shadowOffsetY?: number;
  }
  export interface TextStyleProps extends TextStylePropsPart {
      text?: string;
      x?: number;
      y?: number;
      width?: number;
      rich?: Dictionary<TextStylePropsPart>;
      overflow?: 'break' | 'breakAll' | 'truncate' | 'none';
      lineOverflow?: 'truncate';
      ellipsis?: string;
      placeholder?: string;
      truncateMinChar?: number;
  }
  export interface TextProps extends DisplayableProps {
      style?: TextStyleProps;
      zlevel?: number;
      z?: number;
      z2?: number;
      culling?: boolean;
      cursor?: string;
  }
  export declare type TextState = Pick<TextProps, DisplayableStatePropNames> & ElementCommonState;
  export declare type DefaultTextStyle = Pick<TextStyleProps, 'fill' | 'stroke' | 'align' | 'verticalAlign'> & {
      autoStroke?: boolean;
  };
  export declare const DEFAULT_TEXT_ANIMATION_PROPS: MapToType<TextProps, boolean>;
  interface ZRText {
      animate(key?: '', loop?: boolean): Animator<this>;
      animate(key: 'style', loop?: boolean): Animator<this['style']>;
      getState(stateName: string): TextState;
      ensureState(stateName: string): TextState;
      states: Dictionary<TextState>;
      stateProxy: (stateName: string) => TextState;
  }
  declare class ZRText extends Displayable<TextProps> implements GroupLike {
      type: string;
      style: TextStyleProps;
      overlap: 'hidden' | 'show' | 'blur';
      innerTransformable: Transformable;
      private _children;
      private _childCursor;
      private _defaultStyle;
      constructor(opts?: TextProps);
      childrenRef(): (ZRImage | Rect | TSpan)[];
      update(): void;
      updateTransform(): void;
      getLocalTransform(m?: MatrixArray): MatrixArray;
      getComputedTransform(): MatrixArray;
      private _updateSubTexts;
      addSelfToZr(zr: ZRenderType): void;
      removeSelfFromZr(zr: ZRenderType): void;
      getBoundingRect(): BoundingRect;
      setDefaultTextStyle(defaultTextStyle: DefaultTextStyle): void;
      setTextContent(textContent: never): void;
      protected _mergeStyle(targetStyle: TextStyleProps, sourceStyle: TextStyleProps): TextStyleProps;
      private _mergeRich;
      getAnimationStyleProps(): MapToType<TextProps, boolean>;
      private _getOrCreateChild;
      private _updatePlainTexts;
      private _updateRichTexts;
      private _placeToken;
      private _renderBackground;
      static makeFont(style: TextStylePropsPart): string;
  }
  export declare function parseFontSize(fontSize: number | string): string;
  export declare function hasSeparateFont(style: Pick<TextStylePropsPart, 'fontSize' | 'fontFamily' | 'fontWeight'>): string | number | true;
  export declare function normalizeTextStyle(style: TextStyleProps): TextStyleProps;
  export default ZRText;