@visactor/vchart-types 1.13.7-alpha.0 → 2.0.0-alpha.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.
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/types/animation/animate-manager.d.ts +2 -4
- package/types/animation/interface.d.ts +86 -2
- package/types/animation/spec.d.ts +27 -3
- package/types/animation/utils.d.ts +3 -4
- package/types/chart/base/base-chart.d.ts +10 -7
- package/types/chart/funnel/util.d.ts +2 -0
- package/types/chart/interface/chart.d.ts +3 -4
- package/types/chart/interface/common.d.ts +2 -9
- package/types/chart/sankey/sankey.d.ts +1 -1
- package/types/compile/compilable-base.d.ts +1 -1
- package/types/compile/compiler.d.ts +35 -25
- package/types/compile/data/compilable-data.d.ts +7 -7
- package/types/compile/data/interface.d.ts +4 -1
- package/types/compile/grammar-item.d.ts +7 -13
- package/types/compile/interface/compilable-item.d.ts +22 -28
- package/types/compile/interface/compiler.d.ts +13 -4
- package/types/compile/mark/index.d.ts +0 -1
- package/types/compile/mark/interface.d.ts +42 -33
- package/types/compile/mark/mark-state-manager.d.ts +11 -13
- package/types/compile/mark/util.d.ts +1 -1
- package/types/compile/state-manager.d.ts +11 -0
- package/types/compile/util.d.ts +14 -0
- package/types/component/axis/base-axis.d.ts +5 -3
- package/types/component/axis/cartesian/axis.d.ts +1 -1
- package/types/component/axis/cartesian/time-axis.d.ts +1 -0
- package/types/component/axis/interface/common.d.ts +8 -0
- package/types/component/base/base-component.d.ts +1 -2
- package/types/component/brush/brush.d.ts +12 -10
- package/types/component/crosshair/base.d.ts +2 -2
- package/types/component/custom-mark/custom-mark.d.ts +0 -1
- package/types/component/data-zoom/data-filter-base-component.d.ts +2 -2
- package/types/component/data-zoom/data-zoom/data-zoom.d.ts +1 -1
- package/types/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -1
- package/types/component/geo/geo-coordinate.d.ts +2 -2
- package/types/component/geo/interface.d.ts +1 -1
- package/types/component/label/base-label.d.ts +5 -0
- package/types/component/label/interface.d.ts +2 -3
- package/types/component/label/label.d.ts +3 -3
- package/types/component/label/util.d.ts +9 -10
- package/types/component/legend/util.d.ts +3 -3
- package/types/component/marker/base-marker.d.ts +1 -1
- package/types/component/tooltip/processor/interface.d.ts +1 -1
- package/types/component/tooltip/processor/util.d.ts +1 -1
- package/types/component/tooltip/tooltip.d.ts +2 -3
- package/types/constant/data.d.ts +1 -0
- package/types/constant/event.d.ts +53 -2
- package/types/core/factory.d.ts +28 -3
- package/types/core/index.d.ts +1 -0
- package/types/core/interface.d.ts +13 -4
- package/types/core/vchart.d.ts +6 -6
- package/types/data/transforms/treemap.d.ts +5 -6
- package/types/data/transforms/venn.d.ts +10 -0
- package/types/event/events/base.d.ts +1 -2
- package/types/event/interface.d.ts +6 -9
- package/types/index-harmony-simple.d.ts +2 -1
- package/types/index.d.ts +0 -3
- package/types/interaction/config.d.ts +13 -0
- package/types/interaction/index.d.ts +9 -1
- package/types/interaction/interaction.d.ts +17 -25
- package/types/interaction/interface/common.d.ts +22 -0
- package/types/interaction/interface/spec.d.ts +53 -0
- package/types/interaction/interface/trigger.d.ts +87 -0
- package/types/interaction/triggers/base.d.ts +28 -0
- package/types/interaction/triggers/dimension-hover.d.ts +22 -0
- package/types/interaction/triggers/element-active-by-legend.d.ts +21 -0
- package/types/interaction/triggers/element-active.d.ts +20 -0
- package/types/interaction/triggers/element-highlight-by-graphic-name.d.ts +13 -0
- package/types/interaction/triggers/element-highlight-by-group.d.ts +23 -0
- package/types/interaction/triggers/element-highlight-by-key.d.ts +9 -0
- package/types/interaction/triggers/element-highlight-by-legend.d.ts +22 -0
- package/types/interaction/triggers/element-highlight-by-name.d.ts +24 -0
- package/types/interaction/triggers/element-highlight.d.ts +25 -0
- package/types/interaction/triggers/element-select-by-graphic-name.d.ts +8 -0
- package/types/interaction/triggers/element-select.d.ts +24 -0
- package/types/interaction/triggers/enum.d.ts +8 -0
- package/types/interaction/triggers/util.d.ts +12 -0
- package/types/layout/interface.d.ts +2 -2
- package/types/layout/layout-item.d.ts +2 -3
- package/types/mark/arc.d.ts +2 -2
- package/types/mark/area.d.ts +2 -0
- package/types/mark/base/base-line.d.ts +16 -2
- package/types/mark/base/base-mark.d.ts +131 -13
- package/types/mark/box-plot.d.ts +11 -5
- package/types/mark/cell.d.ts +5 -2
- package/types/mark/component.d.ts +11 -3
- package/types/mark/glyph.d.ts +29 -0
- package/types/mark/group.d.ts +10 -6
- package/types/mark/index.d.ts +3 -1
- package/types/mark/interface/common.d.ts +61 -9
- package/types/mark/interface/enum.d.ts +6 -0
- package/types/mark/interface/index.d.ts +1 -0
- package/types/mark/interface/mark.d.ts +18 -1
- package/types/mark/interface/type.d.ts +1 -0
- package/types/mark/label.d.ts +4 -3
- package/types/mark/link-path.d.ts +35 -5
- package/types/mark/liquid.d.ts +47 -5
- package/types/mark/ripple.d.ts +39 -4
- package/types/mark/rule.d.ts +3 -0
- package/types/mark/symbol.d.ts +4 -4
- package/types/mark/text.d.ts +4 -2
- package/types/mark/transform/data-sampling.d.ts +10 -0
- package/types/mark/transform/filter.d.ts +1 -0
- package/types/mark/transform/map.d.ts +1 -0
- package/types/mark/transform/symbol-overlap.d.ts +14 -0
- package/types/mark/utils/common.d.ts +4 -0
- package/types/mark/utils/glyph.d.ts +2 -0
- package/types/mark/utils/index.d.ts +2 -0
- package/types/mark/utils/line.d.ts +3 -0
- package/types/model/base-model.d.ts +8 -8
- package/types/model/interface.d.ts +4 -8
- package/types/model/layout-model.d.ts +2 -2
- package/types/plugin/components/tooltip-handler/base.d.ts +2 -2
- package/types/plugin/other.d.ts +3 -3
- package/types/region/interface.d.ts +0 -2
- package/types/region/region.d.ts +3 -9
- package/types/series/area/animation.d.ts +1 -1
- package/types/series/area/area.d.ts +1 -1
- package/types/series/bar/animation.d.ts +1 -1
- package/types/series/bar/bar.d.ts +3 -3
- package/types/series/base/base-series.d.ts +26 -42
- package/types/series/base/tooltip-helper.d.ts +1 -2
- package/types/series/box-plot/box-plot.d.ts +3 -3
- package/types/series/cartesian/cartesian.d.ts +1 -1
- package/types/series/circle-packing/animation.d.ts +1 -1
- package/types/series/circle-packing/circle-packing.d.ts +1 -1
- package/types/series/correlation/animation.d.ts +1 -1
- package/types/series/correlation/correlation.d.ts +3 -4
- package/types/series/dot/dot.d.ts +2 -2
- package/types/series/funnel/funnel.d.ts +3 -2
- package/types/series/funnel/interface.d.ts +0 -1
- package/types/series/funnel/tooltip-helper.d.ts +2 -4
- package/types/series/gauge/animation.d.ts +1 -1
- package/types/series/gauge/gauge-pointer.d.ts +4 -1
- package/types/series/gauge/gauge.d.ts +2 -2
- package/types/series/geo/geo.d.ts +2 -2
- package/types/series/heatmap/animation.d.ts +1 -1
- package/types/series/heatmap/heatmap.d.ts +4 -1
- package/types/series/interface/common.d.ts +1 -4
- package/types/series/interface/series.d.ts +6 -1
- package/types/series/line/animation.d.ts +1 -1
- package/types/series/line/line.d.ts +1 -1
- package/types/series/link/link.d.ts +5 -2
- package/types/series/liquid/animation.d.ts +1 -1
- package/types/series/liquid/liquid.d.ts +4 -1
- package/types/series/map/interface.d.ts +10 -0
- package/types/series/mixin/line-mixin.d.ts +5 -5
- package/types/series/pictogram/pictogram.d.ts +13 -19
- package/types/series/pie/animation/animation.d.ts +4 -3
- package/types/series/pie/animation/centerOffset.d.ts +1 -1
- package/types/series/pie/interface.d.ts +2 -2
- package/types/series/pie/pie.d.ts +8 -6
- package/types/series/polar/progress-like/animation.d.ts +1 -1
- package/types/series/polar/progress-like/progress-like.d.ts +1 -2
- package/types/series/progress/circular/circular.d.ts +4 -1
- package/types/series/progress/linear/animation.d.ts +1 -1
- package/types/series/progress/linear/linear.d.ts +4 -1
- package/types/series/radar/animation.d.ts +11 -9
- package/types/series/radar/radar.d.ts +2 -2
- package/types/series/range-column/animation.d.ts +1 -1
- package/types/series/rose/animation.d.ts +1 -1
- package/types/series/sankey/animation.d.ts +1 -1
- package/types/series/sankey/sankey.d.ts +11 -12
- package/types/series/sankey/tooltip-helper.d.ts +1 -1
- package/types/series/scatter/animation.d.ts +1 -1
- package/types/series/sunburst/animation/enter.d.ts +1 -1
- package/types/series/sunburst/animation/exit.d.ts +1 -1
- package/types/series/sunburst/animation/preset.d.ts +1 -1
- package/types/series/sunburst/animation/utils.d.ts +2 -2
- package/types/series/sunburst/sunburst.d.ts +1 -1
- package/types/series/treemap/animation.d.ts +1 -1
- package/types/series/treemap/treemap.d.ts +1 -2
- package/types/series/venn/animation.d.ts +1 -1
- package/types/series/venn/venn.d.ts +2 -1
- package/types/series/waterfall/animation.d.ts +1 -1
- package/types/series/waterfall/waterfall.d.ts +2 -3
- package/types/series/word-cloud/animation.d.ts +1 -1
- package/types/series/word-cloud/base.d.ts +1 -1
- package/types/series/word-cloud/interface.d.ts +1 -1
- package/types/typings/common.d.ts +13 -0
- package/types/typings/spec/common.d.ts +37 -36
- package/types/typings/visual.d.ts +2 -2
- package/types/util/array.d.ts +1 -0
- package/types/util/index.d.ts +1 -0
- package/types/util/mark.d.ts +5 -0
- package/types/util/math.d.ts +1 -1
- package/types/util/scale.d.ts +0 -1
- package/types/vrender-tools.d.ts +0 -1
|
@@ -1,4 +1,54 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare enum HOOK_EVENT {
|
|
2
|
+
BEFORE_EVALUATE_DATA = "beforeEvaluateData",
|
|
3
|
+
AFTER_EVALUATE_DATA = "afterEvaluateData",
|
|
4
|
+
BEFORE_EVALUATE_SCALE = "beforeEvaluateScale",
|
|
5
|
+
AFTER_EVALUATE_SCALE = "afterEvaluateScale",
|
|
6
|
+
BEFORE_PARSE_VIEW = "beforeParseView",
|
|
7
|
+
AFTER_PARSE_VIEW = "afterParseView",
|
|
8
|
+
BEFORE_TRANSFORM = "beforeTransform",
|
|
9
|
+
AFTER_TRANSFORM = "afterTransform",
|
|
10
|
+
BEFORE_CREATE_VRENDER_STAGE = "beforeCreateVRenderStage",
|
|
11
|
+
AFTER_CREATE_VRENDER_STAGE = "afterCreateVRenderStage",
|
|
12
|
+
BEFORE_CREATE_VRENDER_LAYER = "beforeCreateVRenderLayer",
|
|
13
|
+
AFTER_CREATE_VRENDER_LAYER = "afterCreateVRenderLayer",
|
|
14
|
+
BEFORE_STAGE_RESIZE = "beforeStageResize",
|
|
15
|
+
AFTER_STAGE_RESIZE = "afterStageResize",
|
|
16
|
+
BEFORE_VRENDER_DRAW = "beforeVRenderDraw",
|
|
17
|
+
AFTER_VRENDER_DRAW = "afterVRenderDraw",
|
|
18
|
+
BEFORE_MARK_JOIN = "beforeMarkJoin",
|
|
19
|
+
AFTER_MARK_JOIN = "afterMarkJoin",
|
|
20
|
+
BEFORE_MARK_UPDATE = "beforeMarkUpdate",
|
|
21
|
+
AFTER_MARK_UPDATE = "afterMarkUpdate",
|
|
22
|
+
BEFORE_MARK_STATE = "beforeMarkState",
|
|
23
|
+
AFTER_MARK_STATE = "afterMarkState",
|
|
24
|
+
BEFORE_MARK_ENCODE = "beforeMarkEncode",
|
|
25
|
+
AFTER_MARK_ENCODE = "afterMarkEncode",
|
|
26
|
+
BEFORE_DO_LAYOUT = "beforeDoLayout",
|
|
27
|
+
AFTER_DO_LAYOUT = "afterDoLayout",
|
|
28
|
+
BEFORE_MARK_LAYOUT_END = "beforeMarkLayoutEnd",
|
|
29
|
+
AFTER_MARK_LAYOUT_END = "afterMarkLayoutEnd",
|
|
30
|
+
BEFORE_DO_RENDER = "beforeDoRender",
|
|
31
|
+
AFTER_DO_RENDER = "afterDoRender",
|
|
32
|
+
BEFORE_MARK_RENDER_END = "beforeMarkRenderEnd",
|
|
33
|
+
AFTER_MARK_RENDER_END = "afterMarkRenderEnd",
|
|
34
|
+
BEFORE_CREATE_VRENDER_MARK = "beforeCreateVRenderMark",
|
|
35
|
+
AFTER_CREATE_VRENDER_MARK = "afterCreateVRenderMark",
|
|
36
|
+
BEFORE_ADD_VRENDER_MARK = "beforeAddVRenderMark",
|
|
37
|
+
AFTER_ADD_VRENDER_MARK = "afterAddVRenderMark",
|
|
38
|
+
AFTER_VRENDER_NEXT_RENDER = "afterVRenderNextRender",
|
|
39
|
+
BEFORE_ELEMENT_UPDATE_DATA = "beforeElementUpdateData",
|
|
40
|
+
AFTER_ELEMENT_UPDATE_DATA = "afterElementUpdateData",
|
|
41
|
+
BEFORE_ELEMENT_STATE = "beforeElementState",
|
|
42
|
+
AFTER_ELEMENT_STATE = "afterElementState",
|
|
43
|
+
BEFORE_ELEMENT_ENCODE = "beforeElementEncode",
|
|
44
|
+
AFTER_ELEMENT_ENCODE = "afterElementEncode",
|
|
45
|
+
ANIMATION_START = "animationStart",
|
|
46
|
+
ANIMATION_END = "animationEnd",
|
|
47
|
+
ELEMENT_ANIMATION_START = "elementAnimationStart",
|
|
48
|
+
ELEMENT_ANIMATION_END = "elementAnimationEnd",
|
|
49
|
+
ALL_ANIMATION_START = "allAnimationStart",
|
|
50
|
+
ALL_ANIMATION_END = "allAnimationEnd"
|
|
51
|
+
}
|
|
2
52
|
export declare const BASE_EVENTS: string[];
|
|
3
53
|
export declare enum ChartEvent {
|
|
4
54
|
initialized = "initialized",
|
|
@@ -43,7 +93,8 @@ export declare enum ChartEvent {
|
|
|
43
93
|
tooltipRelease = "tooltipRelease",
|
|
44
94
|
afterResize = "afterResize",
|
|
45
95
|
afterRender = "afterRender",
|
|
46
|
-
afterLayout = "afterLayout"
|
|
96
|
+
afterLayout = "afterLayout",
|
|
97
|
+
afterMarkLayoutEnd = "afterMarkLayoutEnd"
|
|
47
98
|
}
|
|
48
99
|
export declare enum Event_Source_Type {
|
|
49
100
|
chart = "chart",
|
package/types/core/factory.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { IChartConstructor, IChartOption, IChart, IChartSpecTransformerOption, IChartSpecTransformer } from '../chart/interface';
|
|
2
2
|
import type { ISeriesConstructor, ISeriesMarkInfo, ISeriesOption, SeriesMarkNameEnum } from '../series/interface';
|
|
3
3
|
import type { IComponentConstructor } from '../component/interface';
|
|
4
|
-
import type { IMarkOption, MarkConstructor } from '../mark/interface';
|
|
4
|
+
import type { IMarkDataTransform, IMarkOption, MarkConstructor } from '../mark/interface';
|
|
5
5
|
import type { IRegion, IRegionConstructor } from '../region/interface';
|
|
6
6
|
import type { IBaseModelSpecTransformer, IBaseModelSpecTransformerOption, IModelOption } from '../model/interface';
|
|
7
7
|
import type { Transform, Parser } from '@visactor/vdataset';
|
|
8
8
|
import type { ILayoutConstructor } from '../layout/interface';
|
|
9
|
-
import type { MarkAnimationSpec } from '@visactor/vgrammar-core';
|
|
10
9
|
import type { IChartPluginConstructor } from '../plugin/chart/interface';
|
|
11
10
|
import type { IComponentPluginConstructor } from '../plugin/components/interface';
|
|
11
|
+
import type { IGraphic } from '@visactor/vrender-core';
|
|
12
|
+
import type { IStageEventPlugin, VRenderComponentOptions } from './interface';
|
|
13
|
+
import type { MarkAnimationSpec } from '../animation/interface';
|
|
14
|
+
import type { IBaseTriggerOptions, ITriggerConstructor } from '../interaction/interface/trigger';
|
|
12
15
|
export declare class Factory {
|
|
13
16
|
private static _charts;
|
|
14
17
|
private static _series;
|
|
15
18
|
private static _components;
|
|
19
|
+
private static _graphicComponents;
|
|
16
20
|
private static _marks;
|
|
17
21
|
private static _regions;
|
|
18
22
|
private static _animations;
|
|
@@ -31,10 +35,23 @@ export declare class Factory {
|
|
|
31
35
|
};
|
|
32
36
|
static registerChart(key: string, chart: IChartConstructor): void;
|
|
33
37
|
static registerSeries(key: string, series: ISeriesConstructor): void;
|
|
34
|
-
static registerComponent(key: string, cmp: IComponentConstructor, alwaysCheck?: boolean): void;
|
|
38
|
+
static registerComponent(key: string, cmp: IComponentConstructor, alwaysCheck?: boolean, createOrder?: number): void;
|
|
39
|
+
static registerGraphicComponent(key: string, creator: (attrs: any, options?: VRenderComponentOptions) => IGraphic): void;
|
|
40
|
+
static createGraphicComponent(componentType: string, attrs: any, options?: VRenderComponentOptions): IGraphic<Partial<import("@visactor/vrender-core").IGraphicAttribute>>;
|
|
35
41
|
static registerMark(key: string, mark: MarkConstructor): void;
|
|
36
42
|
static registerRegion(key: string, region: IRegionConstructor): void;
|
|
37
43
|
static registerTransform(key: string, transform: Transform): void;
|
|
44
|
+
private static _grammarTransforms;
|
|
45
|
+
static registerGrammarTransform(type: string, transform: {
|
|
46
|
+
canProgressive?: boolean;
|
|
47
|
+
transform: IMarkDataTransform;
|
|
48
|
+
isGraphic?: boolean;
|
|
49
|
+
}): void;
|
|
50
|
+
static getGrammarTransform(type: string): {
|
|
51
|
+
canProgressive?: boolean;
|
|
52
|
+
transform: IMarkDataTransform<any, any, any>;
|
|
53
|
+
isGraphic?: boolean;
|
|
54
|
+
};
|
|
38
55
|
static registerLayout(key: string, layout: ILayoutConstructor): void;
|
|
39
56
|
static registerAnimation(key: string, animation: (params?: any, preset?: any) => MarkAnimationSpec): void;
|
|
40
57
|
static registerImplement(key: string, implement: (...args: any) => void): void;
|
|
@@ -50,6 +67,7 @@ export declare class Factory {
|
|
|
50
67
|
static getComponents(): {
|
|
51
68
|
cmp: IComponentConstructor;
|
|
52
69
|
alwaysCheck?: boolean;
|
|
70
|
+
createOrder: number;
|
|
53
71
|
}[];
|
|
54
72
|
static getComponentInKey(name: string): IComponentConstructor;
|
|
55
73
|
static getLayout(): ILayoutConstructor[];
|
|
@@ -65,4 +83,11 @@ export declare class Factory {
|
|
|
65
83
|
static getComponentPluginInType(type: string): IComponentPluginConstructor;
|
|
66
84
|
static registerFormatter(func: typeof Factory['_formatter']): void;
|
|
67
85
|
static getFormatter(): (text: string | number | string[] | number[], datum: any, formatter: string | string[]) => any;
|
|
86
|
+
private static _stageEventPlugins;
|
|
87
|
+
static registerStageEventPlugin: (type: string, Plugin: IStageEventPlugin<any>) => void;
|
|
88
|
+
static getStageEventPlugin: (type: string) => IStageEventPlugin<any>;
|
|
89
|
+
private static _interactionTriggers;
|
|
90
|
+
static registerInteractionTrigger: (interactionType: string, interaction: ITriggerConstructor) => void;
|
|
91
|
+
static createInteractionTrigger(interactionType: string, options?: IBaseTriggerOptions): import("../interaction/interface/trigger").ITrigger<IBaseTriggerOptions>;
|
|
92
|
+
static hasInteractionTrigger(interactionType: string): boolean;
|
|
68
93
|
}
|
package/types/core/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from '../typings/spec/common';
|
|
|
9
9
|
export * from '../event/interface';
|
|
10
10
|
export * from '../theme/interface';
|
|
11
11
|
export * from './interface';
|
|
12
|
+
export type { IMarkGraphic, IGraphicContext } from '../mark/interface/';
|
|
12
13
|
export * from '../constant/base';
|
|
13
14
|
export * from '../constant/data';
|
|
14
15
|
export * from '../typings/spec/index';
|
|
@@ -2,14 +2,14 @@ import type { DataSet, IParserOptions } from '@visactor/vdataset';
|
|
|
2
2
|
import type { Datum, IDataValues, IInitOption, IMarkStateSpec, IPoint, IRegionQuerier, IShowTooltipOption, ISpec, ITooltipHandler, Maybe, MaybeArray, StringOrNumber } from '../typings';
|
|
3
3
|
import type { IMorphConfig } from '../animation/spec';
|
|
4
4
|
import type { IBoundsLike } from '@visactor/vutils';
|
|
5
|
-
import type { EventCallback,
|
|
5
|
+
import type { EventCallback, EventQuery, EventType, ExtendEventParam } from '../event/interface';
|
|
6
6
|
import type { IMark } from '../mark/interface';
|
|
7
7
|
import type { ISeries } from '../series/interface/series';
|
|
8
8
|
import type { ITheme } from '../theme/interface';
|
|
9
9
|
import type { IComponent } from '../component/interface';
|
|
10
10
|
import type { LayoutCallBack } from '../layout/interface';
|
|
11
11
|
import type { DimensionIndexOption, IChart, IChartSpecInfo } from '../chart/interface';
|
|
12
|
-
import type { IStage } from '@visactor/vrender-core';
|
|
12
|
+
import type { IEventTarget, IStage } from '@visactor/vrender-core';
|
|
13
13
|
import type { IContainerSize } from '@visactor/vrender-components';
|
|
14
14
|
import type { IBaseScale } from '@visactor/vscale';
|
|
15
15
|
import type { IUpdateSpecResult } from '../model/interface';
|
|
@@ -53,8 +53,8 @@ export interface IVChart {
|
|
|
53
53
|
updateViewBox: (viewBox: IBoundsLike, reRender?: boolean) => IVChart;
|
|
54
54
|
resize: (width: number, height: number) => Promise<IVChart>;
|
|
55
55
|
release: () => void;
|
|
56
|
-
on: ((eType: EventType, handler: EventCallback<
|
|
57
|
-
off: (eType: EventType, handler?: EventCallback<
|
|
56
|
+
on: ((eType: EventType, handler: EventCallback<ExtendEventParam>) => void) & ((eType: EventType, query: EventQuery, handler: EventCallback<ExtendEventParam>) => void);
|
|
57
|
+
off: (eType: EventType, handler?: EventCallback<ExtendEventParam>) => void;
|
|
58
58
|
updateState: (state: Record<string, Omit<IMarkStateSpec<unknown>, 'style'>>, filter?: (series: ISeries, mark: IMark, stateKey: string) => boolean) => void;
|
|
59
59
|
setSelected: (datum: MaybeArray<any> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier) => void;
|
|
60
60
|
setHovered: (datum: MaybeArray<Datum> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier) => void;
|
|
@@ -123,3 +123,12 @@ export interface IVChartRenderOption {
|
|
|
123
123
|
actionSource?: VChartRenderActionSource;
|
|
124
124
|
}
|
|
125
125
|
export type VChartRenderActionSource = 'render' | 'updateSpec' | 'updateModelSpec' | 'setCurrentTheme' | 'updateSpecAndRecompile';
|
|
126
|
+
export interface VRenderComponentOptions {
|
|
127
|
+
skipDefault?: boolean;
|
|
128
|
+
mode?: '2d' | '3d';
|
|
129
|
+
}
|
|
130
|
+
export interface IStageEventPlugin<T> {
|
|
131
|
+
new (taget: IEventTarget, cfg?: T): {
|
|
132
|
+
release: () => void;
|
|
133
|
+
};
|
|
134
|
+
}
|
package/types/core/vchart.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RenderModeEnum } from '../typings/spec/common';
|
|
|
5
5
|
import type { ISeriesConstructor } from '../series/interface';
|
|
6
6
|
import { type DimensionIndexOption, type IChart, type IChartConstructor, type IChartOption, type IChartSpecInfo } from '../chart/interface';
|
|
7
7
|
import type { IComponentConstructor } from '../component/interface';
|
|
8
|
-
import type { EventCallback,
|
|
8
|
+
import type { EventCallback, EventQuery, EventType, ExtendEventParam } from '../event/interface';
|
|
9
9
|
import type { IParserOptions, Transform } from '@visactor/vdataset';
|
|
10
10
|
import { DataSet, DataView } from '@visactor/vdataset';
|
|
11
11
|
import type { IStage } from '@visactor/vrender-core';
|
|
@@ -85,7 +85,7 @@ export declare class VChart implements IVChart {
|
|
|
85
85
|
private _updateSpecInfo;
|
|
86
86
|
private _initChart;
|
|
87
87
|
private _releaseData;
|
|
88
|
-
private
|
|
88
|
+
private _bindViewEvent;
|
|
89
89
|
private _bindResizeEvent;
|
|
90
90
|
private _unBindResizeEvent;
|
|
91
91
|
getCurrentSize(): {
|
|
@@ -133,9 +133,9 @@ export declare class VChart implements IVChart {
|
|
|
133
133
|
protected _beforeResize(width: number, height: number): boolean;
|
|
134
134
|
protected _afterResize(): IVChart;
|
|
135
135
|
updateViewBox(viewBox: IBoundsLike, reRender?: boolean, reLayout?: boolean): IVChart;
|
|
136
|
-
on(eType: EventType, handler: EventCallback<
|
|
137
|
-
on(eType: EventType, query: EventQuery, handler: EventCallback<
|
|
138
|
-
off(eType: EventType, handler?: EventCallback<
|
|
136
|
+
on(eType: EventType, handler: EventCallback<ExtendEventParam>): void;
|
|
137
|
+
on(eType: EventType, query: EventQuery, handler: EventCallback<ExtendEventParam>): void;
|
|
138
|
+
off(eType: EventType, handler?: EventCallback<ExtendEventParam>): void;
|
|
139
139
|
updateState(state: Record<string, Omit<IMarkStateSpec<unknown>, 'style'>>, filter?: (series: ISeries, mark: IMark, stateKey: string) => boolean): void;
|
|
140
140
|
setSelected(datum: MaybeArray<any> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void;
|
|
141
141
|
setHovered(datum: MaybeArray<Datum> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void;
|
|
@@ -205,7 +205,7 @@ export declare class VChart implements IVChart {
|
|
|
205
205
|
}): void;
|
|
206
206
|
private _initChartPlugin;
|
|
207
207
|
private _chartPluginApply;
|
|
208
|
-
protected _getMode():
|
|
208
|
+
protected _getMode(): (typeof RenderModeEnum)["desktop-browser"] | "desktop-browser" | "mobile-browser" | "node" | "worker" | "miniApp" | "wx" | "tt" | "harmony" | "desktop-miniApp" | "lynx";
|
|
209
209
|
protected _getChartOption(type: string): IChartOption;
|
|
210
210
|
}
|
|
211
211
|
export declare const registerVChartCore: () => void;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { TreemapOptions } from '@visactor/vgrammar-hierarchy';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
range: () => {
|
|
1
|
+
import type { TreemapNodeElement, TreemapOptions } from '@visactor/vgrammar-hierarchy';
|
|
2
|
+
export declare const treemapLayout: (data: Array<any>, op: TreemapOptions & {
|
|
3
|
+
getViewBox: () => {
|
|
5
4
|
x0: number;
|
|
6
5
|
x1: number;
|
|
7
6
|
y0: number;
|
|
8
7
|
y1: number;
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
nameField: string;
|
|
10
|
+
}) => TreemapNodeElement[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const vennLayout: (data: Array<any>, op: {
|
|
2
|
+
setField: string;
|
|
3
|
+
valueField: string;
|
|
4
|
+
getViewBox: () => {
|
|
5
|
+
x0: number;
|
|
6
|
+
x1: number;
|
|
7
|
+
y0: number;
|
|
8
|
+
y1: number;
|
|
9
|
+
};
|
|
10
|
+
}) => (import("@visactor/vgrammar-venn").IVennCircleDatum<any> | import("@visactor/vgrammar-venn").IVennOverlapDatum<any>)[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ValueOf } from '@visactor/vgrammar-core';
|
|
2
1
|
import type { EventHandler, EventParamsDefinition, EventType, IComposedEvent, IEventDispatcher } from '../interface';
|
|
3
|
-
import type { Maybe, RenderMode } from '../../typings';
|
|
2
|
+
import type { Maybe, RenderMode, ValueOf } from '../../typings';
|
|
4
3
|
import type { IChart } from '../../chart/interface';
|
|
5
4
|
export declare abstract class ComposedEvent implements IComposedEvent {
|
|
6
5
|
protected _eventMap: Map<string, EventHandler<ValueOf<EventParamsDefinition>>>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
-
import type { IElement } from '@visactor/vgrammar-core';
|
|
3
2
|
import type { IChart } from '../chart/interface';
|
|
4
3
|
import type { IModel } from '../model/interface';
|
|
5
|
-
import type { IMark, MarkType } from '../mark/interface';
|
|
4
|
+
import type { IMark, IMarkGraphic, MarkType } from '../mark/interface';
|
|
6
5
|
import type { DimensionEventParams } from './events/dimension/interface';
|
|
7
6
|
import type { Datum, IPoint, StringOrNumber } from '../typings';
|
|
8
|
-
import type { ChartEvent, Event_Bubble_Level, Event_Source_Type,
|
|
7
|
+
import type { ChartEvent, Event_Bubble_Level, Event_Source_Type, HOOK_EVENT } from '../constant/event';
|
|
9
8
|
import type { SeriesType } from '../series/interface';
|
|
10
9
|
import type { TooltipEventParams } from '../component/tooltip/interface/event';
|
|
11
10
|
import type { ILayoutItem } from '../layout/interface';
|
|
12
11
|
import type { IVChart } from '../core/interface';
|
|
13
|
-
export type EventType = 'pointerdown' | 'pointerup' | 'pointerupoutside' | 'pointertap' | 'pointerover' | 'pointermove' | 'pointerenter' | 'pointerleave' | 'pointerout' | 'mousedown' | 'mouseup' | 'mouseupoutside' | 'rightdown' | 'rightup' | 'rightupoutside' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseout' | 'mouseenter' | 'mouseleave' | 'wheel' | 'touchstart' | 'touchend' | 'touchendoutside' | 'touchmove' | 'touchcancel' | 'tap' | 'dragstart' | 'drag' | 'dragenter' | 'dragleave' | 'dragover' | 'dragend' | 'drop' | 'pan' | 'panstart' | 'panend' | 'press' | 'pressup' | 'pressend' | 'pinch' | 'pinchstart' | 'pinchend' | 'swipe' | keyof typeof ChartEvent | keyof typeof
|
|
12
|
+
export type EventType = 'pointerdown' | 'pointerup' | 'pointerupoutside' | 'pointertap' | 'pointerover' | 'pointermove' | 'pointerenter' | 'pointerleave' | 'pointerout' | 'mousedown' | 'mouseup' | 'mouseupoutside' | 'rightdown' | 'rightup' | 'rightupoutside' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseout' | 'mouseenter' | 'mouseleave' | 'wheel' | 'touchstart' | 'touchend' | 'touchendoutside' | 'touchmove' | 'touchcancel' | 'tap' | 'dragstart' | 'drag' | 'dragenter' | 'dragleave' | 'dragover' | 'dragend' | 'drop' | 'pan' | 'panstart' | 'panend' | 'press' | 'pressup' | 'pressend' | 'pinch' | 'pinchstart' | 'pinchend' | 'swipe' | keyof typeof ChartEvent | keyof typeof HOOK_EVENT | string;
|
|
14
13
|
export type EventBubbleLevel = keyof typeof Event_Bubble_Level;
|
|
15
14
|
export type ComponentType = 'axis' | 'dataZoom' | 'indicator' | 'legend' | 'mapLabel' | 'markLine' | 'markArea' | 'markPoint' | 'tooltip' | 'title' | 'label' | 'totalLabel' | 'customMark';
|
|
16
15
|
export type EventTargetType = MarkType | ComponentType | SeriesType;
|
|
@@ -42,10 +41,9 @@ type SuperEvent = Event & {
|
|
|
42
41
|
};
|
|
43
42
|
export type BaseEventParams = EventParams & {
|
|
44
43
|
event: SuperEvent;
|
|
45
|
-
item:
|
|
44
|
+
item: IMarkGraphic;
|
|
46
45
|
datum: Datum;
|
|
47
46
|
source: EventSourceType;
|
|
48
|
-
itemMap: Map<string, any>;
|
|
49
47
|
};
|
|
50
48
|
export type EventCallback<Params extends EventParams> = (params: Params) => boolean | void;
|
|
51
49
|
export type EventFilter = {
|
|
@@ -66,10 +64,9 @@ export type EventHandler<Params extends EventParams> = {
|
|
|
66
64
|
};
|
|
67
65
|
export type ExtendEventParam = EventParams & {
|
|
68
66
|
event?: Event;
|
|
69
|
-
item?:
|
|
67
|
+
item?: IMarkGraphic;
|
|
70
68
|
datum?: Datum;
|
|
71
69
|
source?: EventSourceType;
|
|
72
|
-
itemMap?: Map<string, any>;
|
|
73
70
|
};
|
|
74
71
|
export type LayoutEventParam = {
|
|
75
72
|
elements: (ILayoutItem & {
|
|
@@ -84,7 +81,7 @@ export type ZoomEventParam = ExtendEventParam & {
|
|
|
84
81
|
scaleCenter: IPoint;
|
|
85
82
|
};
|
|
86
83
|
export type InteractionEventParam = {
|
|
87
|
-
|
|
84
|
+
graphics?: IMarkGraphic[];
|
|
88
85
|
datums?: Datum[];
|
|
89
86
|
} & Partial<BaseEventParams>;
|
|
90
87
|
export type EventParamsDefinition = {
|
|
@@ -37,9 +37,10 @@ import { registerCustomMark } from './component/custom-mark';
|
|
|
37
37
|
import { registerMapLabel } from './component/map-label';
|
|
38
38
|
import { registerGridLayout } from './layout/grid-layout/grid-layout';
|
|
39
39
|
import { registerPoptip } from './component/poptip';
|
|
40
|
-
import { registerElementHighlight, registerElementSelect } from '@visactor/vgrammar-core';
|
|
41
40
|
import { DefaultTicker } from '@visactor/vrender-core';
|
|
42
41
|
import { registerAnimate } from './plugin/other';
|
|
42
|
+
import { registerElementSelect } from './interaction/triggers/element-select';
|
|
43
|
+
import { registerElementHighlight } from './interaction/triggers/element-highlight';
|
|
43
44
|
export { VChart, DefaultTicker, registerAnimate };
|
|
44
45
|
export { registerScatterChart, registerRoseChart, registerRadarChart, registerHistogramChart, registerMapChart, registerGaugeChart, registerWordCloudChart, registerFunnelChart, registerWaterfallChart, registerBoxplotChart, registerCircularProgressChart, registerLinearProgressChart, registerRangeColumnChart, registerRangeAreaChart, registerSunburstChart, registerCirclePackingChart, registerTreemapChart, registerSankeyChart, registerHeatmapChart, registerCorrelationChart, registerCartesianTimeAxis, registerCartesianLogAxis, registerCartesianSymlogAxis, registerPolarBandAxis, registerPolarLinearAxis, registerContinuousLegend, registerPolarCrossHair, registerDataZoom, registerScrollBar, registerIndicator, registerGeoCoordinate, registerMarkLine, registerMarkArea, registerMarkPoint, registerPolarMarkLine, registerPolarMarkArea, registerPolarMarkPoint, registerGeoMarkPoint, registerTitle, registerPlayer, registerTotalLabel, registerBrush, registerCustomMark, registerMapLabel, registerPoptip, registerGridLayout, registerElementHighlight, registerElementSelect };
|
|
45
46
|
export default VChart;
|
package/types/index.d.ts
CHANGED
|
@@ -13,6 +13,3 @@ export * from './plugin/chart';
|
|
|
13
13
|
export * from './plugin/components/tooltip-handler';
|
|
14
14
|
export * from './plugin/components/axis-sync';
|
|
15
15
|
export * from './plugin/other';
|
|
16
|
-
export * from './vrender-tools';
|
|
17
|
-
export * from './util/data';
|
|
18
|
-
export * from './util/spec/transform';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RenderMode } from '../typings/spec/common';
|
|
2
|
+
import type { IHoverSpec, ISelectSpec } from './interface/spec';
|
|
2
3
|
export declare function getDefaultInteractionConfigByMode(mode: RenderMode): {
|
|
3
4
|
hover: {
|
|
4
5
|
enable: boolean;
|
|
@@ -20,3 +21,15 @@ export declare function getDefaultInteractionConfigByMode(mode: RenderMode): {
|
|
|
20
21
|
trigger: string;
|
|
21
22
|
};
|
|
22
23
|
};
|
|
24
|
+
export declare const parseHoverSelect: (mode: RenderMode, hoverSpec: IHoverSpec, selectSpec: ISelectSpec) => {
|
|
25
|
+
select: ISelectSpec;
|
|
26
|
+
hover: {
|
|
27
|
+
enable: boolean;
|
|
28
|
+
trigger: string;
|
|
29
|
+
triggerOff: string;
|
|
30
|
+
} | {
|
|
31
|
+
enable: boolean;
|
|
32
|
+
trigger: string[];
|
|
33
|
+
triggerOff: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { registerElementHighlight } from './triggers/element-highlight';
|
|
2
|
+
export { registerElementSelect } from './triggers/element-select';
|
|
3
|
+
export { registerDimensionHover } from './triggers/dimension-hover';
|
|
4
|
+
export { registerElementActive } from './triggers/element-active';
|
|
5
|
+
export { registerElementActiveByLegend } from './triggers/element-active-by-legend';
|
|
6
|
+
export { registerElementHighlightByGroup } from './triggers/element-highlight-by-group';
|
|
7
|
+
export { registerElementHighlightByKey } from './triggers/element-highlight-by-key';
|
|
8
|
+
export { registerElementHighlightByLegend } from './triggers/element-highlight-by-legend';
|
|
9
|
+
export { registerElementHighlightByName } from './triggers/element-highlight-by-name';
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { IMark } from '../mark/interface';
|
|
5
|
-
import type { IInteraction } from './interface';
|
|
6
|
-
import type { IInteraction as IVGrammarInteraction } from '@visactor/vgrammar-core';
|
|
1
|
+
import type { IMarkGraphic } from '../mark/interface';
|
|
2
|
+
import type { IInteraction } from './interface/common';
|
|
3
|
+
import type { ITrigger } from './interface/trigger';
|
|
7
4
|
export declare class Interaction implements IInteraction {
|
|
8
|
-
private
|
|
9
|
-
private _stateElements;
|
|
10
|
-
private _vgrammarInteractions;
|
|
11
|
-
addVgrammarInteraction(state: StateValue, i: IVGrammarInteraction): void;
|
|
12
|
-
static markStateEnable(mark: IMark, state: string): boolean;
|
|
5
|
+
private _stateGraphicsByTrigger;
|
|
13
6
|
private _disableTriggerEvent;
|
|
14
7
|
setDisableActiveEffect(disable: boolean): void;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
resetAllInteraction(): void;
|
|
8
|
+
private _triggerMapByState;
|
|
9
|
+
addTrigger(trigger: ITrigger): void;
|
|
10
|
+
setStatedGraphics(trigger: ITrigger, graphics: IMarkGraphic[]): void;
|
|
11
|
+
getStatedGraphics(trigger: ITrigger): IMarkGraphic[];
|
|
12
|
+
updateStates(trigger: ITrigger, newStatedGraphics: IMarkGraphic[], prevStatedGraphics?: IMarkGraphic[], state?: string, reverseState?: string): IMarkGraphic[];
|
|
13
|
+
protected toggleReverseStateOfGraphics(trigger: ITrigger, newStatedGraphics: IMarkGraphic[], prevStatedGraphics: IMarkGraphic[], reverseState: string): void;
|
|
14
|
+
protected toggleStateOfGraphics(trigger: ITrigger, newStatedGraphics: IMarkGraphic[], prevStatedGraphics: IMarkGraphic[], state: string): void;
|
|
15
|
+
protected addBothStateOfGraphics(trigger: ITrigger, statedGraphics: IMarkGraphic[], state: string, reverseState: string): void;
|
|
16
|
+
protected addStateOfGraphics(trigger: ITrigger, statedGraphics: IMarkGraphic[], state: string): void;
|
|
17
|
+
clearAllStatesOfTrigger(trigger: ITrigger, state?: string, reverseState?: string): void;
|
|
18
|
+
clearAllStates(): void;
|
|
19
|
+
clearByState(stateValue: string): void;
|
|
20
|
+
updateStateOfGraphics(stateValue: string, markGraphics: IMarkGraphic[]): void;
|
|
29
21
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IMarkGraphic } from '../../mark/interface';
|
|
2
|
+
import type { RenderMode } from '../../typings/spec/common';
|
|
3
|
+
import type { IEventDispatcher } from '../../event/interface';
|
|
4
|
+
import type { IModel } from '../../model/interface';
|
|
5
|
+
import type { ITrigger } from './trigger';
|
|
6
|
+
export interface IInteraction {
|
|
7
|
+
setDisableActiveEffect: (disable: boolean) => void;
|
|
8
|
+
addTrigger: (trigger: ITrigger) => void;
|
|
9
|
+
setStatedGraphics: (trigger: ITrigger, graphics: IMarkGraphic[]) => void;
|
|
10
|
+
getStatedGraphics: (trigger: ITrigger) => IMarkGraphic[];
|
|
11
|
+
updateStates: (trigger: ITrigger, newStatedGraphics: IMarkGraphic[], prevStatedGraphics?: IMarkGraphic[], state?: string, reverseState?: string) => IMarkGraphic[];
|
|
12
|
+
clearAllStates: () => void;
|
|
13
|
+
clearAllStatesOfTrigger: (trigger: ITrigger, state?: string, reverseState?: string) => void;
|
|
14
|
+
clearByState: (stateValue: string) => any;
|
|
15
|
+
updateStateOfGraphics: (stateValue: string, markGraphics: IMarkGraphic[]) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface ITriggerOption {
|
|
18
|
+
mode: RenderMode;
|
|
19
|
+
interaction: IInteraction;
|
|
20
|
+
eventDispatcher: IEventDispatcher;
|
|
21
|
+
model: IModel;
|
|
22
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { EventType } from '../../event/interface';
|
|
2
|
+
import type { StringOrNumber } from '../../typings/common';
|
|
3
|
+
import type { IElementActiveByLegendOptions, IElementActiveOptions, IElementHighlightByLegendOptions, IElementHighlightByNameOptions, IElementHighlightOptions, IElementSelectOptions } from './trigger';
|
|
4
|
+
export interface IBaseInteractionSpec {
|
|
5
|
+
markIds?: StringOrNumber[];
|
|
6
|
+
markNames?: StringOrNumber[];
|
|
7
|
+
}
|
|
8
|
+
type Trigger = EventType | EventType[];
|
|
9
|
+
export interface IHoverSpec extends IBaseInteractionSpec {
|
|
10
|
+
enable?: boolean;
|
|
11
|
+
trigger?: Trigger;
|
|
12
|
+
triggerOff?: Trigger;
|
|
13
|
+
}
|
|
14
|
+
export interface ISelectSpec extends IBaseInteractionSpec {
|
|
15
|
+
enable?: boolean;
|
|
16
|
+
mode?: 'single' | 'multiple';
|
|
17
|
+
trigger?: Trigger;
|
|
18
|
+
triggerOff?: Trigger | number;
|
|
19
|
+
}
|
|
20
|
+
export type IElementActiveSpec = IBaseInteractionSpec & Pick<IElementActiveOptions, 'trigger' | 'triggerOff' | 'state'> & {
|
|
21
|
+
type: 'element-active';
|
|
22
|
+
};
|
|
23
|
+
export type IElementSelectSpec = IBaseInteractionSpec & Pick<IElementSelectOptions, 'trigger' | 'triggerOff' | 'state' | 'isMultiple' | 'reverseState'> & {
|
|
24
|
+
type: 'element-select';
|
|
25
|
+
};
|
|
26
|
+
export type IElementHighlightSpec = IBaseInteractionSpec & Pick<IElementHighlightOptions, 'blurState' | 'highlightState' | 'triggerOff' | 'trigger'> & {
|
|
27
|
+
type: 'element-highlight';
|
|
28
|
+
};
|
|
29
|
+
export type IElementHighlightByKeySpec = IBaseInteractionSpec & Pick<IElementHighlightOptions, 'blurState' | 'highlightState' | 'triggerOff' | 'trigger'> & {
|
|
30
|
+
type: 'element-highlight-by-key';
|
|
31
|
+
};
|
|
32
|
+
export type IElementHighlightByGroup = IBaseInteractionSpec & Pick<IElementHighlightOptions, 'blurState' | 'highlightState' | 'triggerOff' | 'trigger'> & {
|
|
33
|
+
type: 'element-highlight-by-group';
|
|
34
|
+
};
|
|
35
|
+
export type IElementActiveByLegend = IBaseInteractionSpec & Pick<IElementActiveByLegendOptions, 'filterType' | 'state'> & {
|
|
36
|
+
type: 'element-active-by-legend';
|
|
37
|
+
};
|
|
38
|
+
export type IElementHighlightByLegend = IBaseInteractionSpec & Pick<IElementHighlightByLegendOptions, 'filterType' | 'blurState' | 'highlightState'> & {
|
|
39
|
+
type: 'element-highlight-by-legend';
|
|
40
|
+
};
|
|
41
|
+
export type IElementHighlightByName = IBaseInteractionSpec & Pick<IElementHighlightByNameOptions, 'blurState' | 'highlightState' | 'graphicName' | 'parseData'> & {
|
|
42
|
+
type: 'element-highlight-by-name';
|
|
43
|
+
};
|
|
44
|
+
export interface ICustomInteraction extends IBaseInteractionSpec {
|
|
45
|
+
type: string;
|
|
46
|
+
}
|
|
47
|
+
export type IInteractionItemSpec = IElementActiveSpec | IElementSelectSpec | IElementHighlightSpec | IElementHighlightByKeySpec | IElementHighlightByGroup | IElementActiveByLegend | IElementHighlightByLegend | IElementHighlightByName | ICustomInteraction;
|
|
48
|
+
export interface IInteractionSpec {
|
|
49
|
+
hover?: IHoverSpec | boolean;
|
|
50
|
+
select?: ISelectSpec | boolean;
|
|
51
|
+
interactions?: IInteractionItemSpec[];
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { GraphicEventType } from '@visactor/vrender-core';
|
|
2
|
+
import type { IMark, IMarkGraphic } from '../../mark/interface/common';
|
|
3
|
+
import type { RenderMode } from '../../typings/spec/common';
|
|
4
|
+
import type { IInteraction } from './common';
|
|
5
|
+
import type { BaseEventParams } from '../../event/interface';
|
|
6
|
+
export type ITriggerEventHandler = (e: any, markGraphic?: IMarkGraphic) => void;
|
|
7
|
+
export interface ITrigger<TriggerOptions extends IBaseTriggerOptions = any> {
|
|
8
|
+
readonly options: TriggerOptions;
|
|
9
|
+
readonly type: string;
|
|
10
|
+
registerMark: (mark: IMark | IMark[]) => void;
|
|
11
|
+
release: () => void;
|
|
12
|
+
init: () => void;
|
|
13
|
+
start: (g: any) => void;
|
|
14
|
+
reset: (g?: IMarkGraphic) => void;
|
|
15
|
+
getStartState: () => string;
|
|
16
|
+
getResetState: () => string;
|
|
17
|
+
updateMarkIdByState: (states: string[]) => void;
|
|
18
|
+
getMarkIdByState: () => Record<string, number[]>;
|
|
19
|
+
getMarks: () => IMark[];
|
|
20
|
+
getMarksByState: (state: string) => IMark[];
|
|
21
|
+
}
|
|
22
|
+
export interface IBaseTriggerOptions {
|
|
23
|
+
type?: string;
|
|
24
|
+
marks?: IMark[];
|
|
25
|
+
mode?: RenderMode;
|
|
26
|
+
event: {
|
|
27
|
+
on: (eType: string, callback: ITriggerEventHandler) => void;
|
|
28
|
+
off: (eType: string, callback?: ITriggerEventHandler) => void;
|
|
29
|
+
emit: (eType: string, params: any) => void;
|
|
30
|
+
};
|
|
31
|
+
interaction: IInteraction;
|
|
32
|
+
id?: string;
|
|
33
|
+
shouldStart?: (e: any) => boolean;
|
|
34
|
+
shouldUpdate?: (e: any) => boolean;
|
|
35
|
+
shouldEnd?: (e: any) => boolean;
|
|
36
|
+
shouldReset?: (e: any) => boolean;
|
|
37
|
+
onStart?: (e: any) => boolean;
|
|
38
|
+
onUpdate?: (e: any) => boolean;
|
|
39
|
+
onEnd?: (e: any) => boolean;
|
|
40
|
+
onReset?: (e: any) => boolean;
|
|
41
|
+
}
|
|
42
|
+
export type IElementSelectTriggerOff = GraphicEventType | string | 'empty' | 'none' | number;
|
|
43
|
+
export interface IElementSelectOptions extends IBaseTriggerOptions {
|
|
44
|
+
trigger?: GraphicEventType | GraphicEventType[];
|
|
45
|
+
state?: string;
|
|
46
|
+
reverseState?: string;
|
|
47
|
+
triggerOff?: IElementSelectTriggerOff | IElementSelectTriggerOff[];
|
|
48
|
+
isMultiple?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface IDimensionHoverOptions extends IBaseTriggerOptions {
|
|
51
|
+
state?: string;
|
|
52
|
+
reverseState?: string;
|
|
53
|
+
trigger?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface IElementActiveOptions extends IBaseTriggerOptions {
|
|
56
|
+
trigger?: GraphicEventType | GraphicEventType[];
|
|
57
|
+
triggerOff?: GraphicEventType | GraphicEventType[] | 'none';
|
|
58
|
+
state?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IElementHighlightOptions extends IBaseTriggerOptions {
|
|
61
|
+
trigger?: GraphicEventType;
|
|
62
|
+
triggerOff?: GraphicEventType | 'none';
|
|
63
|
+
highlightState?: string;
|
|
64
|
+
blurState?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface IElementFilterOptions {
|
|
67
|
+
filterType?: 'key' | 'groupKey';
|
|
68
|
+
filterField?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface IElementActiveByLegendOptions extends IBaseTriggerOptions, IElementFilterOptions {
|
|
71
|
+
state?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface IElementHighlightByLegendOptions extends IBaseTriggerOptions, IElementFilterOptions {
|
|
74
|
+
highlightState?: string;
|
|
75
|
+
blurState?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface IElementHighlightByNameOptions extends IElementHighlightByLegendOptions {
|
|
78
|
+
graphicName?: string | string[];
|
|
79
|
+
trigger?: GraphicEventType;
|
|
80
|
+
triggerOff?: GraphicEventType | 'none';
|
|
81
|
+
parseData?: (e: BaseEventParams) => any;
|
|
82
|
+
}
|
|
83
|
+
export type IElementHighlightByGraphicNameOptions = IElementHighlightOptions;
|
|
84
|
+
export interface ITriggerConstructor<T extends IBaseTriggerOptions = IBaseTriggerOptions> {
|
|
85
|
+
readonly type: string;
|
|
86
|
+
new (options?: T): ITrigger<T>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IBaseTriggerOptions, ITrigger, ITriggerEventHandler } from '../interface/trigger';
|
|
2
|
+
import type { IMark, IMarkGraphic } from '../../mark/interface/common';
|
|
3
|
+
import { MarkSet } from '../../mark/mark-set';
|
|
4
|
+
export declare abstract class BaseTrigger<T extends IBaseTriggerOptions> implements ITrigger<T> {
|
|
5
|
+
options: T;
|
|
6
|
+
type: string;
|
|
7
|
+
protected _markSet: MarkSet;
|
|
8
|
+
protected _markIdByState: Record<string, number[]>;
|
|
9
|
+
constructor(options: T);
|
|
10
|
+
getMarks(): IMark[];
|
|
11
|
+
getMarksByState(state: string): IMark[];
|
|
12
|
+
registerMark(mark: IMark | IMark[]): void;
|
|
13
|
+
updateMarkIdByState(states: string[]): void;
|
|
14
|
+
getMarkIdByState(): Record<string, number[]>;
|
|
15
|
+
isGraphicInStateMark(g: IMarkGraphic, state: string): boolean;
|
|
16
|
+
isGraphicInMark(g: IMarkGraphic): boolean;
|
|
17
|
+
protected abstract getEvents(): Array<{
|
|
18
|
+
type: string | string[];
|
|
19
|
+
handler: ITriggerEventHandler;
|
|
20
|
+
}>;
|
|
21
|
+
getStartState(): string;
|
|
22
|
+
getResetState(): string;
|
|
23
|
+
init(): void;
|
|
24
|
+
release(): void;
|
|
25
|
+
start(g: IMarkGraphic | string): void;
|
|
26
|
+
reset(g?: IMarkGraphic): void;
|
|
27
|
+
protected dispatchEvent(type: 'start' | 'reset' | 'update' | 'end', params: any): void;
|
|
28
|
+
}
|