@visactor/vchart-types 1.7.0-alpha.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,31 +99,7 @@ export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<s
99
99
  style: any;
100
100
  state: {};
101
101
  };
102
- title: {
103
- visible: any;
104
- position: any;
105
- space: any;
106
- autoRotate: boolean;
107
- angle: number;
108
- textStyle: any;
109
- padding: any;
110
- shape: {
111
- visible: any;
112
- space: any;
113
- style: any;
114
- };
115
- background: {
116
- visible: any;
117
- style: any;
118
- };
119
- state: {
120
- text: {};
121
- shape: {};
122
- background: {};
123
- };
124
- pickable: boolean;
125
- childrenPickable: boolean;
126
- };
102
+ title: any;
127
103
  panel: {
128
104
  visible: any;
129
105
  style: any;
@@ -3,6 +3,7 @@ import type { IAnimationSpec } from '../../../animation/spec';
3
3
  import type { Datum, IPadding, IRectMarkSpec, IRuleMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../../typings';
4
4
  import type { IComponentSpec } from '../../base/interface';
5
5
  import type { AxisType, IAxisItem, ITickCallbackOption, StyleCallback } from './common';
6
+ import type { IRichTextCharacter } from '@visactor/vrender-core';
6
7
  export interface ICommonAxisSpec extends Omit<IComponentSpec, 'orient' | 'center'>, IAnimationSpec<string, string> {
7
8
  type?: AxisType;
8
9
  visible?: boolean;
@@ -64,7 +65,8 @@ export interface ISubTick extends IAxisItem<IRuleMarkSpec> {
64
65
  state?: AxisItemStateStyle<IRuleMarkSpec>;
65
66
  }
66
67
  export interface ILabel extends IAxisItem<ITextMarkSpec> {
67
- formatMethod?: (text: string | string[], datum?: Datum) => string | string[];
68
+ type?: 'text' | 'rich' | 'html';
69
+ formatMethod?: (text: string | string[], datum?: Datum) => string | string[] | IRichTextCharacter[];
68
70
  space?: number;
69
71
  inside?: boolean;
70
72
  minGap?: number;
@@ -86,7 +88,8 @@ export interface ITitle extends IAxisItem<ITextMarkSpec> {
86
88
  space?: number;
87
89
  state?: AxisItemStateStyle<Partial<ISymbolMarkSpec>>;
88
90
  };
89
- text?: string | string[];
91
+ type?: 'text' | 'rich' | 'html';
92
+ text?: string | string[] | IRichTextCharacter[];
90
93
  angle?: number;
91
94
  state?: AxisItemStateStyle<Partial<ITextMarkSpec>>;
92
95
  }
@@ -2,6 +2,7 @@ import type { IPercent } from '../../typings/layout';
2
2
  import type { ConvertToMarkStyleSpec, ITextMarkSpec } from '../../typings/visual';
3
3
  import type { IComponentSpec } from '../base/interface';
4
4
  import type { IComponent } from '../interface';
5
+ import type { IRichTextCharacter } from '@visactor/vrender-core';
5
6
  export interface IIndicatorItemSpec {
6
7
  visible?: boolean;
7
8
  field?: string;
@@ -9,7 +10,10 @@ export interface IIndicatorItemSpec {
9
10
  autoLimit?: boolean;
10
11
  autoFit?: boolean;
11
12
  fitPercent?: number;
12
- style?: Omit<ConvertToMarkStyleSpec<ITextMarkSpec>, 'visible'>;
13
+ style?: Omit<ConvertToMarkStyleSpec<ITextMarkSpec>, 'visible' | 'text'> & {
14
+ type?: 'text' | 'rich' | 'html';
15
+ text?: string | string[] | number | number[] | IRichTextCharacter[];
16
+ };
13
17
  }
14
18
  export type IIndicator = IComponent;
15
19
  export interface IIndicatorSpec extends IComponentSpec {
@@ -2,6 +2,7 @@ import type { BaseLabelAttrs } from '@visactor/vrender-components';
2
2
  import type { ConvertToMarkStyleSpec, Datum, ITextMarkSpec } from '../../typings';
3
3
  import type { IComponentSpec } from '../base/interface';
4
4
  import type { ISeries } from '../..';
5
+ import type { IRichTextCharacter } from '@visactor/vrender-core';
5
6
  import type { ILabelMark } from '../../mark/label';
6
7
  export interface ILabelFormatMethodContext {
7
8
  series?: ISeries;
@@ -9,7 +10,8 @@ export interface ILabelFormatMethodContext {
9
10
  export interface ILabelSpec extends IComponentSpec {
10
11
  visible?: boolean;
11
12
  interactive?: boolean;
12
- formatMethod?: (text: string | string[], datum?: Datum, ctx?: ILabelFormatMethodContext) => string | string[];
13
+ textType?: string;
14
+ formatMethod?: (text: string | string[], datum?: Datum, ctx?: ILabelFormatMethodContext) => string | string[] | IRichTextCharacter[];
13
15
  formatter?: string;
14
16
  offset?: number;
15
17
  position?: string;
@@ -1,5 +1,5 @@
1
1
  import type { IPadding } from '@visactor/vutils';
2
- import type { SymbolType } from '@visactor/vrender-core';
2
+ import type { SymbolType, IRichTextCharacter } from '@visactor/vrender-core';
3
3
  import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../typings';
4
4
  import type { IComponentSpec } from '../base/interface';
5
5
  import type { Datum } from '@visactor/vrender-components';
@@ -33,8 +33,9 @@ export type IMarkerLabelWithoutRefSpec = {
33
33
  padding?: IPadding | number[] | number;
34
34
  style?: Omit<IRectMarkSpec, 'visible'>;
35
35
  };
36
- text?: string | string[] | number | number[];
37
- formatMethod?: (markData: Datum[], seriesData: Datum[]) => string | string[] | number | number[];
36
+ type?: 'text' | 'rich' | 'html';
37
+ text?: string | string[] | number | number[] | IRichTextCharacter[];
38
+ formatMethod?: (markData: Datum[], seriesData: Datum[]) => string | string[] | number | number[] | IRichTextCharacter[];
38
39
  style?: Omit<ITextMarkSpec, 'visible'>;
39
40
  shape?: {
40
41
  visible?: boolean;
@@ -5,8 +5,10 @@ import type { IComponentSpec } from '../../base/interface';
5
5
  export interface ITitleSpec extends Omit<IComponentSpec, 'orient'> {
6
6
  visible?: boolean;
7
7
  orient?: IOrientType;
8
- text: Text | Text[];
9
- subtext?: Text | Text[];
8
+ text?: string | number | string[] | number[] | IRichTextCharacter[];
9
+ textType?: string;
10
+ subtext?: string | number | string[] | number[] | IRichTextCharacter[];
11
+ subtextType?: string;
10
12
  x?: number;
11
13
  y?: number;
12
14
  width?: number;
@@ -1,10 +1,10 @@
1
+ import type { IRegion } from '../../region/interface';
2
+ import type { IPoint, IOrientType, ILayoutType, ILayoutRect } from '../../typings';
1
3
  import { BaseComponent } from '../base/base-component';
2
- import { ComponentTypeEnum } from '../interface/type';
3
4
  import type { IComponentOption } from '../interface';
5
+ import { ComponentTypeEnum } from '../interface/type';
4
6
  import type { ITitle, ITitleSpec, ITitleTheme } from './interface';
5
- import type { IRegion } from '../../region/interface';
6
7
  import type { IGraphic } from '@visactor/vrender-core';
7
- import type { IPoint, IOrientType, ILayoutType, ILayoutRect } from '../../typings';
8
8
  export declare class Title extends BaseComponent<ITitleSpec> implements ITitle {
9
9
  static type: ComponentTypeEnum;
10
10
  type: ComponentTypeEnum;
@@ -43,7 +43,7 @@ export declare abstract class BaseTooltipHandler implements ITooltipHandler {
43
43
  protected _getActualTooltipPosition: (actualTooltip: IToolTipActual, params: TooltipHandlerParams, tooltipBoxSize: IContainerSize | undefined) => ITooltipPositionActual;
44
44
  protected _getTooltipBoxSize(actualTooltip: IToolTipActual, changePositionOnly: boolean): IContainerSize | undefined;
45
45
  protected _getParentElement(spec: ITooltipSpec): HTMLElement;
46
- getTooltipContainer(): HTMLElement | IGroup;
46
+ getTooltipContainer(): IGroup | HTMLElement;
47
47
  protected _initFromSpec(): void;
48
48
  reInit(): void;
49
49
  }
@@ -2,6 +2,7 @@ import type { Datum } from '@visactor/vgrammar-core';
2
2
  import type { MaybeArray, TooltipContentProperty, TooltipData, TooltipPatternProperty } from '../../../../typings';
3
3
  import type { TooltipHandlerParams } from '../../interface';
4
4
  import type { ITooltipTextStyle } from '../interface/style';
5
+ import type { TooltipRichTextAttrs } from '@visactor/vrender-components';
5
6
  export declare function escapeHTML(value: any): string;
6
7
  export declare const getTooltipContentValue: <T>(field?: TooltipContentProperty<T>, datum?: any, params?: TooltipHandlerParams) => T;
7
8
  export declare const getTooltipPatternValue: <T>(field?: MaybeArray<TooltipPatternProperty<T>>, data?: TooltipData, params?: TooltipHandlerParams) => MaybeArray<TooltipPatternProperty<T>> extends TooltipPatternProperty<T>[] ? MaybeArray<T> : T;
@@ -12,7 +13,7 @@ export declare const getScale: (element: HTMLElement, boundingClientRect?: DOMRe
12
13
  interface ITooltipTextInfo {
13
14
  width: number;
14
15
  height: number;
15
- text: MaybeArray<number> | MaybeArray<string>;
16
+ text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;
16
17
  }
17
- export declare const measureTooltipText: (text: string, style: ITooltipTextStyle) => ITooltipTextInfo;
18
+ export declare const measureTooltipText: (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle) => ITooltipTextInfo;
18
19
  export {};
@@ -1,10 +1,12 @@
1
1
  import type { ITextMarkSpec } from '../typings/visual';
2
2
  import { BaseMark } from './base/base-mark';
3
3
  import type { IMarkRaw, IMarkStyle } from './interface';
4
- import { MarkTypeEnum } from './interface/type';
4
+ import { MarkTypeEnum } from './interface';
5
+ import type { IGroupMark } from '@visactor/vgrammar-core';
5
6
  export type ITextMark = IMarkRaw<ITextMarkSpec>;
6
7
  export declare class TextMark extends BaseMark<ITextMarkSpec> implements ITextMark {
7
8
  static readonly type = MarkTypeEnum.text;
8
9
  readonly type = MarkTypeEnum.text;
9
10
  protected _getDefaultStyle(): IMarkStyle<ITextMarkSpec>;
11
+ protected _initProduct(group?: string | IGroupMark): void;
10
12
  }
@@ -1,16 +1,17 @@
1
1
  import type { TooltipContentProperty } from './common';
2
2
  import type { ITooltipLabelActual, ITooltipLabelPattern } from './label';
3
3
  import type { ITooltipShapeActual, ITooltipShapePattern } from './shape';
4
+ import type { TooltipRichTextAttrs } from '@visactor/vrender-components';
4
5
  export interface IToolTipLinePattern extends ITooltipShapePattern, ITooltipLabelPattern {
5
6
  key?: TooltipContentProperty<string>;
6
- value?: TooltipContentProperty<string>;
7
+ value?: TooltipContentProperty<string | TooltipRichTextAttrs>;
7
8
  visible?: TooltipContentProperty<boolean>;
8
9
  isKeyAdaptive?: TooltipContentProperty<boolean>;
9
10
  spaceRow?: TooltipContentProperty<number>;
10
11
  }
11
12
  export interface IToolTipLineActual extends ITooltipShapeActual, ITooltipLabelActual {
12
13
  key?: string;
13
- value?: string;
14
+ value?: string | TooltipRichTextAttrs;
14
15
  visible?: boolean;
15
16
  isKeyAdaptive?: boolean;
16
17
  spaceRow?: number;
@@ -10,6 +10,7 @@ import type { Datum, StringOrNumber } from './common';
10
10
  import type { IPadding } from '@visactor/vutils';
11
11
  import type { IColorKey } from '../theme/color-scheme/interface';
12
12
  import type { IRepeatType, TextAlignType, TextBaselineType } from '@visactor/vrender-core';
13
+ import type { IRichTextCharacter } from '@visactor/vrender-core';
13
14
  export interface IVisualSpecBase<D, T> {
14
15
  type: ScaleType;
15
16
  domain: D[];
@@ -115,7 +116,8 @@ export interface IRuleMarkSpec extends ILineMarkSpec {
115
116
  y1?: number;
116
117
  }
117
118
  export interface ITextMarkSpec extends IFillMarkSpec {
118
- text?: StringOrNumber | string[];
119
+ type?: 'html' | 'rich' | 'text';
120
+ text?: StringOrNumber | string[] | IRichTextCharacter[] | Function;
119
121
  dx?: number;
120
122
  dy?: number;
121
123
  fontSize?: number;