victory-core 36.9.2-next.3 → 36.9.2
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/CHANGELOG.md +22 -10
- package/README.md +1 -1
- package/dist/victory-core.js +124 -493
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +17 -17
- package/es/types/callbacks.d.ts +36 -36
- package/es/types/prop-types.d.ts +129 -129
- package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/es/victory-animation/util.d.ts +66 -66
- package/es/victory-animation/victory-animation.d.ts +34 -34
- package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/es/victory-container/victory-container.d.ts +68 -68
- package/es/victory-label/victory-label.d.ts +58 -58
- package/es/victory-portal/portal-context.d.ts +11 -11
- package/es/victory-portal/portal.d.ts +20 -20
- package/es/victory-portal/victory-portal.d.ts +26 -26
- package/es/victory-primitives/arc.d.ts +14 -14
- package/es/victory-primitives/background.d.ts +13 -13
- package/es/victory-primitives/border.d.ts +10 -10
- package/es/victory-primitives/circle.d.ts +3 -3
- package/es/victory-primitives/clip-path.d.ts +7 -7
- package/es/victory-primitives/index.d.ts +14 -14
- package/es/victory-primitives/line-segment.d.ts +11 -11
- package/es/victory-primitives/line.d.ts +3 -3
- package/es/victory-primitives/path.d.ts +3 -3
- package/es/victory-primitives/point.d.ts +13 -13
- package/es/victory-primitives/rect.d.ts +3 -3
- package/es/victory-primitives/text.d.ts +8 -8
- package/es/victory-primitives/tspan.d.ts +3 -3
- package/es/victory-primitives/types.d.ts +7 -7
- package/es/victory-primitives/whisker.d.ts +15 -15
- package/es/victory-theme/grayscale.d.ts +2 -2
- package/es/victory-theme/material.d.ts +2 -2
- package/es/victory-theme/types.d.ts +238 -238
- package/es/victory-theme/victory-theme.d.ts +5 -5
- package/es/victory-transition/victory-transition.d.ts +53 -53
- package/es/victory-util/add-events.d.ts +126 -126
- package/es/victory-util/add-events.js +4 -8
- package/es/victory-util/axis.d.ts +50 -50
- package/es/victory-util/axis.js +13 -6
- package/es/victory-util/collection.d.ts +15 -8
- package/es/victory-util/collection.js +16 -0
- package/es/victory-util/common-props.d.ts +79 -79
- package/es/victory-util/data.d.ts +74 -74
- package/es/victory-util/default-transitions.d.ts +4 -4
- package/es/victory-util/domain.d.ts +90 -90
- package/es/victory-util/events.d.ts +64 -64
- package/es/victory-util/helpers.d.ts +96 -91
- package/es/victory-util/helpers.js +12 -1
- package/es/victory-util/hooks/index.d.ts +2 -2
- package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/es/victory-util/immutable.d.ts +11 -11
- package/es/victory-util/index.d.ts +26 -26
- package/es/victory-util/label-helpers.d.ts +26 -26
- package/es/victory-util/line-helpers.d.ts +4 -4
- package/es/victory-util/log.d.ts +1 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -9
- package/es/victory-util/scale.d.ts +9 -9
- package/es/victory-util/selection.d.ts +28 -28
- package/es/victory-util/style.d.ts +18 -18
- package/es/victory-util/textsize.d.ts +35 -35
- package/es/victory-util/timer-context.d.ts +11 -11
- package/es/victory-util/timer.d.ts +16 -16
- package/es/victory-util/transitions.d.ts +48 -48
- package/es/victory-util/type-helpers.d.ts +9 -9
- package/es/victory-util/user-props.d.ts +26 -26
- package/es/victory-util/wrapper.d.ts +33 -37
- package/es/victory-util/wrapper.js +2 -2
- package/lib/index.d.ts +17 -17
- package/lib/types/callbacks.d.ts +36 -36
- package/lib/types/prop-types.d.ts +129 -129
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/lib/victory-animation/util.d.ts +66 -66
- package/lib/victory-animation/victory-animation.d.ts +34 -34
- package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/lib/victory-container/victory-container.d.ts +68 -68
- package/lib/victory-label/victory-label.d.ts +58 -58
- package/lib/victory-portal/portal-context.d.ts +11 -11
- package/lib/victory-portal/portal.d.ts +20 -20
- package/lib/victory-portal/victory-portal.d.ts +26 -26
- package/lib/victory-primitives/arc.d.ts +14 -14
- package/lib/victory-primitives/background.d.ts +13 -13
- package/lib/victory-primitives/border.d.ts +10 -10
- package/lib/victory-primitives/circle.d.ts +3 -3
- package/lib/victory-primitives/clip-path.d.ts +7 -7
- package/lib/victory-primitives/index.d.ts +14 -14
- package/lib/victory-primitives/line-segment.d.ts +11 -11
- package/lib/victory-primitives/line.d.ts +3 -3
- package/lib/victory-primitives/path.d.ts +3 -3
- package/lib/victory-primitives/point.d.ts +13 -13
- package/lib/victory-primitives/rect.d.ts +3 -3
- package/lib/victory-primitives/text.d.ts +8 -8
- package/lib/victory-primitives/tspan.d.ts +3 -3
- package/lib/victory-primitives/types.d.ts +7 -7
- package/lib/victory-primitives/whisker.d.ts +15 -15
- package/lib/victory-theme/grayscale.d.ts +2 -2
- package/lib/victory-theme/material.d.ts +2 -2
- package/lib/victory-theme/types.d.ts +238 -238
- package/lib/victory-theme/victory-theme.d.ts +5 -5
- package/lib/victory-transition/victory-transition.d.ts +53 -53
- package/lib/victory-util/add-events.d.ts +126 -126
- package/lib/victory-util/add-events.js +6 -6
- package/lib/victory-util/axis.d.ts +50 -50
- package/lib/victory-util/axis.js +13 -7
- package/lib/victory-util/collection.d.ts +15 -8
- package/lib/victory-util/collection.js +18 -0
- package/lib/victory-util/common-props.d.ts +79 -79
- package/lib/victory-util/data.d.ts +74 -74
- package/lib/victory-util/default-transitions.d.ts +4 -4
- package/lib/victory-util/domain.d.ts +90 -90
- package/lib/victory-util/events.d.ts +64 -64
- package/lib/victory-util/helpers.d.ts +96 -91
- package/lib/victory-util/helpers.js +13 -0
- package/lib/victory-util/hooks/index.d.ts +2 -2
- package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/lib/victory-util/immutable.d.ts +11 -11
- package/lib/victory-util/index.d.ts +26 -26
- package/lib/victory-util/label-helpers.d.ts +26 -26
- package/lib/victory-util/line-helpers.d.ts +4 -4
- package/lib/victory-util/log.d.ts +1 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -9
- package/lib/victory-util/scale.d.ts +9 -9
- package/lib/victory-util/selection.d.ts +28 -28
- package/lib/victory-util/style.d.ts +18 -18
- package/lib/victory-util/textsize.d.ts +35 -35
- package/lib/victory-util/timer-context.d.ts +11 -11
- package/lib/victory-util/timer.d.ts +16 -16
- package/lib/victory-util/transitions.d.ts +48 -48
- package/lib/victory-util/type-helpers.d.ts +9 -9
- package/lib/victory-util/user-props.d.ts +26 -26
- package/lib/victory-util/wrapper.d.ts +33 -37
- package/lib/victory-util/wrapper.js +2 -2
- package/package.json +6 -3
- package/src/types/prop-types.ts +0 -7
- package/src/victory-container/victory-container.tsx +195 -171
- package/src/victory-portal/portal-context.ts +4 -5
- package/src/victory-portal/portal.tsx +42 -5
- package/src/victory-portal/victory-portal.tsx +71 -34
- package/src/victory-util/add-events.tsx +6 -4
- package/src/victory-util/axis.tsx +12 -3
- package/src/victory-util/collection.tsx +13 -0
- package/src/victory-util/helpers.ts +11 -0
- package/src/victory-util/index.ts +0 -1
- package/src/victory-util/wrapper.tsx +1 -0
- package/src/victory-util/merge-refs.ts +0 -13
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import TimerContext from "../victory-util/timer-context";
|
|
3
|
-
import Timer from "../victory-util/timer";
|
|
4
|
-
declare type VictoryTransitionChild = React.ReactElement<{
|
|
5
|
-
polar?: boolean;
|
|
6
|
-
domain?: number[] | {
|
|
7
|
-
x: number[];
|
|
8
|
-
y: number[];
|
|
9
|
-
};
|
|
10
|
-
groupComponent?: React.ReactElement;
|
|
11
|
-
}, {
|
|
12
|
-
new (props: any): React.Component<any, any>;
|
|
13
|
-
continuous?: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
interface VictoryTransitionProps {
|
|
16
|
-
animate?: boolean | any;
|
|
17
|
-
animationWhitelist?: string[];
|
|
18
|
-
children: VictoryTransitionChild;
|
|
19
|
-
}
|
|
20
|
-
interface VictoryTransitionState {
|
|
21
|
-
oldProps?: VictoryTransitionProps | null;
|
|
22
|
-
nextProps?: VictoryTransitionProps;
|
|
23
|
-
nodesShouldLoad?: boolean;
|
|
24
|
-
nodesDoneLoad?: boolean;
|
|
25
|
-
nodesWillExit?: boolean;
|
|
26
|
-
nodesWillEnter?: boolean;
|
|
27
|
-
nodesShouldEnter?: boolean;
|
|
28
|
-
childrenTransitions?: unknown;
|
|
29
|
-
}
|
|
30
|
-
export interface VictoryTransition {
|
|
31
|
-
context: React.ContextType<typeof TimerContext>;
|
|
32
|
-
}
|
|
33
|
-
export declare class VictoryTransition extends React.Component<VictoryTransitionProps, VictoryTransitionState> {
|
|
34
|
-
static displayName: string;
|
|
35
|
-
static contextType: React.Context<{
|
|
36
|
-
transitionTimer: Timer;
|
|
37
|
-
animationTimer: Timer;
|
|
38
|
-
}>;
|
|
39
|
-
private continuous;
|
|
40
|
-
private timer;
|
|
41
|
-
private transitionProps;
|
|
42
|
-
constructor(props: any, context: any);
|
|
43
|
-
componentDidMount(): void;
|
|
44
|
-
shouldComponentUpdate(nextProps: VictoryTransitionProps): boolean;
|
|
45
|
-
componentWillUnmount(): void;
|
|
46
|
-
private getTransitionState;
|
|
47
|
-
private getDomainFromChildren;
|
|
48
|
-
pickProps(): Readonly<VictoryTransitionProps>;
|
|
49
|
-
private pickDomainProps;
|
|
50
|
-
getClipWidth(props: any, child: any): any;
|
|
51
|
-
render(): JSX.Element;
|
|
52
|
-
}
|
|
53
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TimerContext from "../victory-util/timer-context";
|
|
3
|
+
import Timer from "../victory-util/timer";
|
|
4
|
+
declare type VictoryTransitionChild = React.ReactElement<{
|
|
5
|
+
polar?: boolean;
|
|
6
|
+
domain?: number[] | {
|
|
7
|
+
x: number[];
|
|
8
|
+
y: number[];
|
|
9
|
+
};
|
|
10
|
+
groupComponent?: React.ReactElement;
|
|
11
|
+
}, {
|
|
12
|
+
new (props: any): React.Component<any, any>;
|
|
13
|
+
continuous?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
interface VictoryTransitionProps {
|
|
16
|
+
animate?: boolean | any;
|
|
17
|
+
animationWhitelist?: string[];
|
|
18
|
+
children: VictoryTransitionChild;
|
|
19
|
+
}
|
|
20
|
+
interface VictoryTransitionState {
|
|
21
|
+
oldProps?: VictoryTransitionProps | null;
|
|
22
|
+
nextProps?: VictoryTransitionProps;
|
|
23
|
+
nodesShouldLoad?: boolean;
|
|
24
|
+
nodesDoneLoad?: boolean;
|
|
25
|
+
nodesWillExit?: boolean;
|
|
26
|
+
nodesWillEnter?: boolean;
|
|
27
|
+
nodesShouldEnter?: boolean;
|
|
28
|
+
childrenTransitions?: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface VictoryTransition {
|
|
31
|
+
context: React.ContextType<typeof TimerContext>;
|
|
32
|
+
}
|
|
33
|
+
export declare class VictoryTransition extends React.Component<VictoryTransitionProps, VictoryTransitionState> {
|
|
34
|
+
static displayName: string;
|
|
35
|
+
static contextType: React.Context<{
|
|
36
|
+
transitionTimer: Timer;
|
|
37
|
+
animationTimer: Timer;
|
|
38
|
+
}>;
|
|
39
|
+
private continuous;
|
|
40
|
+
private timer;
|
|
41
|
+
private transitionProps;
|
|
42
|
+
constructor(props: any, context: any);
|
|
43
|
+
componentDidMount(): void;
|
|
44
|
+
shouldComponentUpdate(nextProps: VictoryTransitionProps): boolean;
|
|
45
|
+
componentWillUnmount(): void;
|
|
46
|
+
private getTransitionState;
|
|
47
|
+
private getDomainFromChildren;
|
|
48
|
+
pickProps(): Readonly<VictoryTransitionProps>;
|
|
49
|
+
private pickDomainProps;
|
|
50
|
+
getClipWidth(props: any, child: any): any;
|
|
51
|
+
render(): JSX.Element;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
54
|
//# sourceMappingURL=victory-transition.d.ts.map
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
export declare type MixinOptions = {
|
|
7
|
-
components?: Array<{
|
|
8
|
-
name: string;
|
|
9
|
-
index?: string | number;
|
|
10
|
-
}>;
|
|
11
|
-
};
|
|
12
|
-
export interface EventMixinCommonProps extends VictoryCommonProps, VictoryDatableProps, VictoryLabelableProps {
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* These methods will be implemented by the Mixin,
|
|
16
|
-
* and are accessible to the Wrapped Component.
|
|
17
|
-
*
|
|
18
|
-
* To make your Wrapped Component type-safe, use "interface merging" like so:
|
|
19
|
-
* @example
|
|
20
|
-
* interface MyComponent extends EventsMixinClass<MyProps> {}
|
|
21
|
-
* class MyComponent extends React.Component<MyProps> { ... }
|
|
22
|
-
*/
|
|
23
|
-
export interface EventsMixinClass<TProps> {
|
|
24
|
-
renderContainer(component: React.ReactElement, children: React.ReactElement | React.ReactElement[]): React.ReactElement;
|
|
25
|
-
cacheValues<TThis>(this: TThis, obj: Partial<TThis>): void;
|
|
26
|
-
getEventState: typeof Events.getEventState;
|
|
27
|
-
renderData(props: TProps): any;
|
|
28
|
-
renderContinuousData(props: TProps): any;
|
|
29
|
-
animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
|
|
30
|
-
getComponentProps(component: React.ReactNode, type: string, index: string | number): TProps;
|
|
31
|
-
dataKeys: string[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* These fields are calculated by the Mixin
|
|
35
|
-
*/
|
|
36
|
-
export interface EventMixinCalculatedValues {
|
|
37
|
-
componentEvents: Array<ComponentEvent>;
|
|
38
|
-
getSharedEventState: (key: string, value: string) => unknown;
|
|
39
|
-
baseProps: Record<string, object>;
|
|
40
|
-
dataKeys: string[];
|
|
41
|
-
hasEvents: unknown;
|
|
42
|
-
events: unknown;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* These are the common roles that we care about internally.
|
|
46
|
-
*/
|
|
47
|
-
export declare type VictoryComponentCommonRole = "container" | "group" | "histogram" | "label" | "line" | "portal" | "stack" | "tooltip" | "voronoi";
|
|
48
|
-
/**
|
|
49
|
-
* A component can have any "role",
|
|
50
|
-
* but there are certain ones that we actually care about internally
|
|
51
|
-
*/
|
|
52
|
-
export declare type VictoryComponentRole = VictoryComponentCommonRole | string;
|
|
53
|
-
/**
|
|
54
|
-
* Static component fields used by Victory for common behavior
|
|
55
|
-
*/
|
|
56
|
-
export interface VictoryComponentConfiguration<TProps> {
|
|
57
|
-
getBaseProps?(props: TProps): EventMixinCalculatedValues["baseProps"];
|
|
58
|
-
role?: VictoryComponentRole;
|
|
59
|
-
expectedComponents?: Array<keyof TProps | string>;
|
|
60
|
-
getChildren?: (props: TProps, childComponents?: Array<React.ReactNode>, calculatedProps?: TProps) => void;
|
|
61
|
-
animationWhitelist?: Array<keyof TProps | string>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* This represents the class itself, including static fields
|
|
65
|
-
*/
|
|
66
|
-
export interface WrappedComponentClass<TProps> extends VictoryComponentConfiguration<TProps> {
|
|
67
|
-
new (props: TProps): React.Component<TProps>;
|
|
68
|
-
}
|
|
69
|
-
export declare function addEvents<TBase extends WrappedComponentClass<TProps>, TProps extends EventMixinCommonProps>(WrappedComponent: TBase, options?: MixinOptions): {
|
|
70
|
-
new (props: TProps): {
|
|
71
|
-
state: {};
|
|
72
|
-
getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
|
|
73
|
-
getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
|
|
74
|
-
getEvents: (p: any, target: any, eventKey: any) => any;
|
|
75
|
-
externalMutations: {} | undefined;
|
|
76
|
-
calculatedState: {};
|
|
77
|
-
globalEvents: {};
|
|
78
|
-
prevGlobalEventKeys: string[];
|
|
79
|
-
boundGlobalEvents: {};
|
|
80
|
-
shouldComponentUpdate(nextProps: TProps): boolean;
|
|
81
|
-
componentDidMount(): void;
|
|
82
|
-
componentDidUpdate(prevProps: any): void;
|
|
83
|
-
componentWillUnmount(): void;
|
|
84
|
-
addGlobalListener(key: any): void;
|
|
85
|
-
removeGlobalListener(key: any): void;
|
|
86
|
-
getStateChanges(props: any): {};
|
|
87
|
-
applyExternalMutations(props: any, externalMutations: any): void;
|
|
88
|
-
getCalculatedValues(props: any): EventMixinCalculatedValues;
|
|
89
|
-
getExternalMutations(props: TProps): {} | undefined;
|
|
90
|
-
cacheValues(obj: any): void;
|
|
91
|
-
getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
|
|
92
|
-
getAllEvents(props: any): any;
|
|
93
|
-
getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
|
|
94
|
-
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
95
|
-
animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
|
|
96
|
-
renderContinuousData(props: TProps): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
97
|
-
renderData(props: any, shouldRenderDatum?: (datum: any) => boolean): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
98
|
-
context: unknown;
|
|
99
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
100
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
101
|
-
render(): React.ReactNode;
|
|
102
|
-
readonly props: Readonly<TProps>;
|
|
103
|
-
refs: {
|
|
104
|
-
[key: string]: React.ReactInstance;
|
|
105
|
-
};
|
|
106
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
107
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
|
|
108
|
-
componentWillMount?(): void;
|
|
109
|
-
UNSAFE_componentWillMount?(): void;
|
|
110
|
-
componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
111
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
112
|
-
componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
113
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
114
|
-
componentEvents: ComponentEvent[];
|
|
115
|
-
getSharedEventState: (key: string, value: string) => unknown;
|
|
116
|
-
baseProps: Record<string, object>;
|
|
117
|
-
dataKeys: string[];
|
|
118
|
-
hasEvents: unknown;
|
|
119
|
-
events: unknown;
|
|
120
|
-
};
|
|
121
|
-
getBaseProps?(props: TProps): Record<string, object>;
|
|
122
|
-
role?: string | undefined;
|
|
123
|
-
expectedComponents?: (string | keyof TProps)[] | undefined;
|
|
124
|
-
getChildren?: ((props: TProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: TProps | undefined) => void) | undefined;
|
|
125
|
-
animationWhitelist?: (string | keyof TProps)[] | undefined;
|
|
126
|
-
} & TBase;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VictoryLabelableProps } from "../types/prop-types";
|
|
3
|
+
import { VictoryCommonProps, VictoryDatableProps } from "./common-props";
|
|
4
|
+
import type { ComponentEvent } from "./events";
|
|
5
|
+
import * as Events from "./events";
|
|
6
|
+
export declare type MixinOptions = {
|
|
7
|
+
components?: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
index?: string | number;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export interface EventMixinCommonProps extends VictoryCommonProps, VictoryDatableProps, VictoryLabelableProps {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* These methods will be implemented by the Mixin,
|
|
16
|
+
* and are accessible to the Wrapped Component.
|
|
17
|
+
*
|
|
18
|
+
* To make your Wrapped Component type-safe, use "interface merging" like so:
|
|
19
|
+
* @example
|
|
20
|
+
* interface MyComponent extends EventsMixinClass<MyProps> {}
|
|
21
|
+
* class MyComponent extends React.Component<MyProps> { ... }
|
|
22
|
+
*/
|
|
23
|
+
export interface EventsMixinClass<TProps> {
|
|
24
|
+
renderContainer(component: React.ReactElement, children: React.ReactElement | React.ReactElement[]): React.ReactElement;
|
|
25
|
+
cacheValues<TThis>(this: TThis, obj: Partial<TThis>): void;
|
|
26
|
+
getEventState: typeof Events.getEventState;
|
|
27
|
+
renderData(props: TProps): any;
|
|
28
|
+
renderContinuousData(props: TProps): any;
|
|
29
|
+
animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
|
|
30
|
+
getComponentProps(component: React.ReactNode, type: string, index: string | number): TProps;
|
|
31
|
+
dataKeys: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* These fields are calculated by the Mixin
|
|
35
|
+
*/
|
|
36
|
+
export interface EventMixinCalculatedValues {
|
|
37
|
+
componentEvents: Array<ComponentEvent>;
|
|
38
|
+
getSharedEventState: (key: string, value: string) => unknown;
|
|
39
|
+
baseProps: Record<string, object>;
|
|
40
|
+
dataKeys: string[];
|
|
41
|
+
hasEvents: unknown;
|
|
42
|
+
events: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* These are the common roles that we care about internally.
|
|
46
|
+
*/
|
|
47
|
+
export declare type VictoryComponentCommonRole = "container" | "group" | "histogram" | "label" | "line" | "portal" | "stack" | "tooltip" | "voronoi";
|
|
48
|
+
/**
|
|
49
|
+
* A component can have any "role",
|
|
50
|
+
* but there are certain ones that we actually care about internally
|
|
51
|
+
*/
|
|
52
|
+
export declare type VictoryComponentRole = VictoryComponentCommonRole | string;
|
|
53
|
+
/**
|
|
54
|
+
* Static component fields used by Victory for common behavior
|
|
55
|
+
*/
|
|
56
|
+
export interface VictoryComponentConfiguration<TProps> {
|
|
57
|
+
getBaseProps?(props: TProps): EventMixinCalculatedValues["baseProps"];
|
|
58
|
+
role?: VictoryComponentRole;
|
|
59
|
+
expectedComponents?: Array<keyof TProps | string>;
|
|
60
|
+
getChildren?: (props: TProps, childComponents?: Array<React.ReactNode>, calculatedProps?: TProps) => void;
|
|
61
|
+
animationWhitelist?: Array<keyof TProps | string>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This represents the class itself, including static fields
|
|
65
|
+
*/
|
|
66
|
+
export interface WrappedComponentClass<TProps> extends VictoryComponentConfiguration<TProps> {
|
|
67
|
+
new (props: TProps): React.Component<TProps>;
|
|
68
|
+
}
|
|
69
|
+
export declare function addEvents<TBase extends WrappedComponentClass<TProps>, TProps extends EventMixinCommonProps>(WrappedComponent: TBase, options?: MixinOptions): {
|
|
70
|
+
new (props: TProps): {
|
|
71
|
+
state: {};
|
|
72
|
+
getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
|
|
73
|
+
getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
|
|
74
|
+
getEvents: (p: any, target: any, eventKey: any) => any;
|
|
75
|
+
externalMutations: {} | undefined;
|
|
76
|
+
calculatedState: {};
|
|
77
|
+
globalEvents: {};
|
|
78
|
+
prevGlobalEventKeys: string[];
|
|
79
|
+
boundGlobalEvents: {};
|
|
80
|
+
shouldComponentUpdate(nextProps: TProps): boolean;
|
|
81
|
+
componentDidMount(): void;
|
|
82
|
+
componentDidUpdate(prevProps: any): void;
|
|
83
|
+
componentWillUnmount(): void;
|
|
84
|
+
addGlobalListener(key: any): void;
|
|
85
|
+
removeGlobalListener(key: any): void;
|
|
86
|
+
getStateChanges(props: any): {};
|
|
87
|
+
applyExternalMutations(props: any, externalMutations: any): void;
|
|
88
|
+
getCalculatedValues(props: any): EventMixinCalculatedValues;
|
|
89
|
+
getExternalMutations(props: TProps): {} | undefined;
|
|
90
|
+
cacheValues(obj: any): void;
|
|
91
|
+
getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
|
|
92
|
+
getAllEvents(props: any): any;
|
|
93
|
+
getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
|
|
94
|
+
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
95
|
+
animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
|
|
96
|
+
renderContinuousData(props: TProps): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
97
|
+
renderData(props: any, shouldRenderDatum?: (datum: any) => boolean): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
98
|
+
context: unknown;
|
|
99
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
100
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
101
|
+
render(): React.ReactNode;
|
|
102
|
+
readonly props: Readonly<TProps>;
|
|
103
|
+
refs: {
|
|
104
|
+
[key: string]: React.ReactInstance;
|
|
105
|
+
};
|
|
106
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
107
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
|
|
108
|
+
componentWillMount?(): void;
|
|
109
|
+
UNSAFE_componentWillMount?(): void;
|
|
110
|
+
componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
111
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
112
|
+
componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
113
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
114
|
+
componentEvents: ComponentEvent[];
|
|
115
|
+
getSharedEventState: (key: string, value: string) => unknown;
|
|
116
|
+
baseProps: Record<string, object>;
|
|
117
|
+
dataKeys: string[];
|
|
118
|
+
hasEvents: unknown;
|
|
119
|
+
events: unknown;
|
|
120
|
+
};
|
|
121
|
+
getBaseProps?(props: TProps): Record<string, object>;
|
|
122
|
+
role?: string | undefined;
|
|
123
|
+
expectedComponents?: (string | keyof TProps)[] | undefined;
|
|
124
|
+
getChildren?: ((props: TProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: TProps | undefined) => void) | undefined;
|
|
125
|
+
animationWhitelist?: (string | keyof TProps)[] | undefined;
|
|
126
|
+
} & TBase;
|
|
127
127
|
//# sourceMappingURL=add-events.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _pick from "lodash/pick";
|
|
2
2
|
import _isEmpty from "lodash/isEmpty";
|
|
3
|
-
import _difference from "lodash/difference";
|
|
4
3
|
import _defaults from "lodash/defaults";
|
|
5
4
|
|
|
6
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -36,9 +35,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
36
35
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
36
|
|
|
38
37
|
import React from "react";
|
|
39
|
-
import * as Events from "./events";
|
|
40
38
|
import isEqual from "react-fast-compare";
|
|
41
39
|
import { VictoryTransition } from "../victory-transition/victory-transition";
|
|
40
|
+
import { difference } from "./collection";
|
|
41
|
+
import * as Events from "./events";
|
|
42
42
|
import { isFunction, isNil } from "./helpers"; // DISCLAIMER:
|
|
43
43
|
// This file is not currently tested, and it is first on the list of files
|
|
44
44
|
// to refactor in our current refactoring effort. Please do not make changes
|
|
@@ -139,15 +139,11 @@ export function addEvents(WrappedComponent) {
|
|
|
139
139
|
var calculatedState = this.getStateChanges(prevProps);
|
|
140
140
|
this.calculatedState = calculatedState;
|
|
141
141
|
var globalEventKeys = Object.keys(this.globalEvents);
|
|
142
|
-
|
|
143
|
-
var removedGlobalEventKeys = _difference(this.prevGlobalEventKeys, globalEventKeys);
|
|
144
|
-
|
|
142
|
+
var removedGlobalEventKeys = difference(this.prevGlobalEventKeys, globalEventKeys);
|
|
145
143
|
removedGlobalEventKeys.forEach(function (key) {
|
|
146
144
|
return _this3.removeGlobalListener(key);
|
|
147
145
|
});
|
|
148
|
-
|
|
149
|
-
var addedGlobalEventKeys = _difference(globalEventKeys, this.prevGlobalEventKeys);
|
|
150
|
-
|
|
146
|
+
var addedGlobalEventKeys = difference(globalEventKeys, this.prevGlobalEventKeys);
|
|
151
147
|
addedGlobalEventKeys.forEach(function (key) {
|
|
152
148
|
return _this3.addGlobalListener(key);
|
|
153
149
|
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { D3Scale } from "../types/prop-types";
|
|
2
|
-
/**
|
|
3
|
-
* Returns the axis (x or y) of a particular axis component
|
|
4
|
-
* @param {Object} props: the props object.
|
|
5
|
-
* @param {Boolean} horizontal: true for horizontal charts
|
|
6
|
-
* @returns {String} the dimension appropriate for the axis given its props
|
|
7
|
-
*/
|
|
8
|
-
export declare function getAxis(props: any): "x" | "y";
|
|
9
|
-
/**
|
|
10
|
-
* Returns all axis components that pass a given predicate
|
|
11
|
-
* @param {Array} childComponents: an array of children
|
|
12
|
-
* @param {Function} predicate: a predicate function that will be called with each
|
|
13
|
-
* @returns {Array} all axis components that pass the given predicate or []
|
|
14
|
-
*/
|
|
15
|
-
export declare function findAxisComponents(childComponents: any, predicate?: any): any;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a single axis component of the desired axis type (x or y)
|
|
18
|
-
* @param {Array} childComponents: an array of children
|
|
19
|
-
* @param {String} axis: desired axis either "x" or "y".
|
|
20
|
-
* @returns {ReactComponent} an axis component of the desired axis or undefined
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAxisComponent(childComponents: any, axis: any): any;
|
|
23
|
-
/**
|
|
24
|
-
* Returns all axis components of the desired axis type (x or y) along with any
|
|
25
|
-
* parent components excluding VictoryChart
|
|
26
|
-
* @param {Array} childComponents: an optional array of children.
|
|
27
|
-
* @param {String} type: desired axis either "dependent" or "independent".
|
|
28
|
-
* @returns {ReactComponent} an axis component of the desired type or undefined
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAxisComponentsWithParent(childComponents: any, type: any): any;
|
|
31
|
-
export declare function getOrigin(domain: any): {
|
|
32
|
-
x: number | Date;
|
|
33
|
-
y: number | Date;
|
|
34
|
-
};
|
|
35
|
-
export declare function getOriginSign(origin: any, domain: any): "positive" | "negative";
|
|
36
|
-
/**
|
|
37
|
-
* @param {Object} props: axis component props
|
|
38
|
-
* @returns {Boolean} true when the axis is vertical
|
|
39
|
-
*/
|
|
40
|
-
export declare function isVertical(props: any): any;
|
|
41
|
-
/**
|
|
42
|
-
* @param {Object} props: axis component props
|
|
43
|
-
* @returns {Boolean} true when tickValues contain strings
|
|
44
|
-
*/
|
|
45
|
-
export declare function stringTicks(props: any): boolean;
|
|
46
|
-
export declare function getTickFormat(props: any, scale: any): any;
|
|
47
|
-
export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[] | string[];
|
|
48
|
-
export declare function getDomain(props: any, axis?: any): any;
|
|
49
|
-
export declare function getAxisValue(props: any, axis: any): any;
|
|
50
|
-
export declare function modifyProps(props: any, fallbackProps: any): any;
|
|
1
|
+
import { D3Scale } from "../types/prop-types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the axis (x or y) of a particular axis component
|
|
4
|
+
* @param {Object} props: the props object.
|
|
5
|
+
* @param {Boolean} horizontal: true for horizontal charts
|
|
6
|
+
* @returns {String} the dimension appropriate for the axis given its props
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAxis(props: any): "x" | "y";
|
|
9
|
+
/**
|
|
10
|
+
* Returns all axis components that pass a given predicate
|
|
11
|
+
* @param {Array} childComponents: an array of children
|
|
12
|
+
* @param {Function} predicate: a predicate function that will be called with each
|
|
13
|
+
* @returns {Array} all axis components that pass the given predicate or []
|
|
14
|
+
*/
|
|
15
|
+
export declare function findAxisComponents(childComponents: any, predicate?: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a single axis component of the desired axis type (x or y)
|
|
18
|
+
* @param {Array} childComponents: an array of children
|
|
19
|
+
* @param {String} axis: desired axis either "x" or "y".
|
|
20
|
+
* @returns {ReactComponent} an axis component of the desired axis or undefined
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAxisComponent(childComponents: any, axis: any): any;
|
|
23
|
+
/**
|
|
24
|
+
* Returns all axis components of the desired axis type (x or y) along with any
|
|
25
|
+
* parent components excluding VictoryChart
|
|
26
|
+
* @param {Array} childComponents: an optional array of children.
|
|
27
|
+
* @param {String} type: desired axis either "dependent" or "independent".
|
|
28
|
+
* @returns {ReactComponent} an axis component of the desired type or undefined
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAxisComponentsWithParent(childComponents: any, type: any): any;
|
|
31
|
+
export declare function getOrigin(domain: any): {
|
|
32
|
+
x: number | Date;
|
|
33
|
+
y: number | Date;
|
|
34
|
+
};
|
|
35
|
+
export declare function getOriginSign(origin: any, domain: any): "positive" | "negative";
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} props: axis component props
|
|
38
|
+
* @returns {Boolean} true when the axis is vertical
|
|
39
|
+
*/
|
|
40
|
+
export declare function isVertical(props: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* @param {Object} props: axis component props
|
|
43
|
+
* @returns {Boolean} true when tickValues contain strings
|
|
44
|
+
*/
|
|
45
|
+
export declare function stringTicks(props: any): boolean;
|
|
46
|
+
export declare function getTickFormat(props: any, scale: any): any;
|
|
47
|
+
export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[] | string[];
|
|
48
|
+
export declare function getDomain(props: any, axis?: any): any;
|
|
49
|
+
export declare function getAxisValue(props: any, axis: any): any;
|
|
50
|
+
export declare function modifyProps(props: any, fallbackProps: any): any;
|
|
51
51
|
//# sourceMappingURL=axis.d.ts.map
|
package/es/victory-util/axis.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _orderBy from "lodash/orderBy";
|
|
2
2
|
import _uniq from "lodash/uniq";
|
|
3
|
-
import _invert from "lodash/invert";
|
|
4
3
|
import _isObject from "lodash/isObject";
|
|
5
|
-
import _identity from "lodash/identity";
|
|
6
4
|
import _defaults from "lodash/defaults";
|
|
7
5
|
|
|
8
6
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -22,12 +20,22 @@ import * as Collection from "./collection";
|
|
|
22
20
|
import * as Domain from "./domain";
|
|
23
21
|
import * as Helpers from "./helpers";
|
|
24
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Returns the first argument it receives
|
|
25
|
+
* @param value The value to return
|
|
26
|
+
* @returns The value given
|
|
27
|
+
*/
|
|
28
|
+
function identity(value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
25
31
|
/**
|
|
26
32
|
* Returns the axis (x or y) of a particular axis component
|
|
27
33
|
* @param {Object} props: the props object.
|
|
28
34
|
* @param {Boolean} horizontal: true for horizontal charts
|
|
29
35
|
* @returns {String} the dimension appropriate for the axis given its props
|
|
30
36
|
*/
|
|
37
|
+
|
|
38
|
+
|
|
31
39
|
export function getAxis(props) {
|
|
32
40
|
var dependentAxis = props.dependentAxis;
|
|
33
41
|
return dependentAxis ? "y" : "x";
|
|
@@ -40,7 +48,7 @@ export function getAxis(props) {
|
|
|
40
48
|
*/
|
|
41
49
|
|
|
42
50
|
export function findAxisComponents(childComponents, predicate) {
|
|
43
|
-
var predicateFunction = predicate ||
|
|
51
|
+
var predicateFunction = predicate || identity;
|
|
44
52
|
|
|
45
53
|
var findAxes = function (children) {
|
|
46
54
|
return children.reduce(function (memo, child) {
|
|
@@ -156,7 +164,7 @@ function getDefaultTickFormat(props) {
|
|
|
156
164
|
} : fallbackFormat;
|
|
157
165
|
}
|
|
158
166
|
|
|
159
|
-
var invertedStringMap = stringMap &&
|
|
167
|
+
var invertedStringMap = stringMap && Helpers.invert(stringMap);
|
|
160
168
|
|
|
161
169
|
var tickValueArray = _orderBy(Object.values(stringMap), function (n) {
|
|
162
170
|
return n;
|
|
@@ -274,8 +282,7 @@ export function getTickFormat(props, scale) {
|
|
|
274
282
|
};
|
|
275
283
|
} else if (tickFormat && Helpers.isFunction(tickFormat)) {
|
|
276
284
|
var applyStringTicks = function (tick, index, ticks) {
|
|
277
|
-
var invertedStringMap =
|
|
278
|
-
|
|
285
|
+
var invertedStringMap = Helpers.invert(stringMap);
|
|
279
286
|
var stringTickArray = ticks.map(function (t) {
|
|
280
287
|
return invertedStringMap[t];
|
|
281
288
|
});
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
export declare function containsStrings<T>(collection: Array<T>): boolean;
|
|
2
|
-
export declare function containsDates(collection: Array<number | Date>): boolean;
|
|
3
|
-
export declare function containsNumbers(collection: any): boolean;
|
|
4
|
-
export declare function containsOnlyStrings(collection: Array<string> | unknown): collection is Array<string>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
export declare function containsStrings<T>(collection: Array<T>): boolean;
|
|
2
|
+
export declare function containsDates(collection: Array<number | Date>): boolean;
|
|
3
|
+
export declare function containsNumbers(collection: any): boolean;
|
|
4
|
+
export declare function containsOnlyStrings(collection: Array<string> | unknown): collection is Array<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an array of array values not included in the other given arrays
|
|
7
|
+
* @param a The array to inspect
|
|
8
|
+
* @param b The values to exclude
|
|
9
|
+
* @returns The new array of filtered values
|
|
10
|
+
*/
|
|
11
|
+
export declare function difference<T>(a: Array<T>, b: Array<T>): Array<T>;
|
|
12
|
+
export declare function isArrayOfArrays<T>(collection: Array<T> | Array<Array<T>> | unknown): collection is Array<Array<T>>;
|
|
13
|
+
export declare function removeUndefined(arr: any): any;
|
|
14
|
+
export declare function getMaxValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
|
|
15
|
+
export declare function getMinValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
|
|
9
16
|
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -34,6 +34,22 @@ export function containsOnlyStrings(collection) {
|
|
|
34
34
|
return typeof value === "string";
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates an array of array values not included in the other given arrays
|
|
39
|
+
* @param a The array to inspect
|
|
40
|
+
* @param b The values to exclude
|
|
41
|
+
* @returns The new array of filtered values
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export function difference(a, b) {
|
|
45
|
+
if (a && b) {
|
|
46
|
+
return a.filter(function (value) {
|
|
47
|
+
return !b.includes(value);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
37
53
|
export function isArrayOfArrays(collection) {
|
|
38
54
|
return isNonEmptyArray(collection) && collection.every(Array.isArray);
|
|
39
55
|
}
|