victory-core 36.3.2 → 36.5.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/dist/victory-core.js +15084 -15018
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +35 -45
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +3 -2
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +92 -102
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +75 -82
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +97 -107
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +43 -31
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +44 -50
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +38 -47
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +9 -9
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +12 -12
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +9 -9
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +17 -10
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +9 -9
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +17 -10
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +15 -8
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +15 -23
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +17 -10
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +13 -8
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +12 -12
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +38 -44
- package/es/victory-util/add-events.js +328 -319
- package/es/victory-util/axis.js +12 -6
- package/es/victory-util/collection.js +7 -5
- package/es/victory-util/common-props.js +2 -2
- package/es/victory-util/data.js +8 -6
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +7 -5
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -3
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +16 -13
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/es/victory-util/user-props.js +44 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +38 -941
- package/lib/index.js +201 -189
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +37 -45
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +4 -3
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +97 -102
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +81 -82
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +102 -107
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +49 -32
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +4 -5
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +49 -50
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +43 -47
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +13 -10
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +16 -13
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +13 -10
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +17 -8
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +13 -10
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +17 -8
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +15 -6
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +21 -25
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +17 -8
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +14 -7
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +16 -13
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +43 -45
- package/lib/victory-util/add-events.js +326 -316
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +10 -8
- package/lib/victory-util/common-props.js +6 -4
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -16
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -5
- package/lib/victory-util/label-helpers.js +6 -6
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +5 -5
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +16 -13
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/lib/victory-util/user-props.js +53 -6
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +6 -13
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +5 -4
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +90 -13
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +32 -6
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +80 -19
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +7 -5
- package/src/victory-util/axis.js +3 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/common-props.js +2 -2
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +18 -10
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +20 -5
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/user-props.js +31 -1
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
|
@@ -1,12 +1,89 @@
|
|
|
1
1
|
/*global setTimeout:false */
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import * as d3Ease from "d3-ease";
|
|
4
|
+
import * as d3Ease from "victory-vendor/d3-ease";
|
|
5
5
|
import { victoryInterpolator } from "./util";
|
|
6
6
|
import TimerContext from "../victory-util/timer-context";
|
|
7
7
|
import isEqual from "react-fast-compare";
|
|
8
|
+
import type Timer from "../victory-util/timer";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Single animation object to interpolate
|
|
12
|
+
*/
|
|
13
|
+
export type AnimationStyle = { [key: string]: string | number };
|
|
14
|
+
/**
|
|
15
|
+
* Animation styles to interpolate
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type AnimationData = AnimationStyle | AnimationStyle[];
|
|
19
|
+
export type AnimationEasing =
|
|
20
|
+
| "back"
|
|
21
|
+
| "backIn"
|
|
22
|
+
| "backOut"
|
|
23
|
+
| "backInOut"
|
|
24
|
+
| "bounce"
|
|
25
|
+
| "bounceIn"
|
|
26
|
+
| "bounceOut"
|
|
27
|
+
| "bounceInOut"
|
|
28
|
+
| "circle"
|
|
29
|
+
| "circleIn"
|
|
30
|
+
| "circleOut"
|
|
31
|
+
| "circleInOut"
|
|
32
|
+
| "linear"
|
|
33
|
+
| "linearIn"
|
|
34
|
+
| "linearOut"
|
|
35
|
+
| "linearInOut"
|
|
36
|
+
| "cubic"
|
|
37
|
+
| "cubicIn"
|
|
38
|
+
| "cubicOut"
|
|
39
|
+
| "cubicInOut"
|
|
40
|
+
| "elastic"
|
|
41
|
+
| "elasticIn"
|
|
42
|
+
| "elasticOut"
|
|
43
|
+
| "elasticInOut"
|
|
44
|
+
| "exp"
|
|
45
|
+
| "expIn"
|
|
46
|
+
| "expOut"
|
|
47
|
+
| "expInOut"
|
|
48
|
+
| "poly"
|
|
49
|
+
| "polyIn"
|
|
50
|
+
| "polyOut"
|
|
51
|
+
| "polyInOut"
|
|
52
|
+
| "quad"
|
|
53
|
+
| "quadIn"
|
|
54
|
+
| "quadOut"
|
|
55
|
+
| "quadInOut"
|
|
56
|
+
| "sin"
|
|
57
|
+
| "sinIn"
|
|
58
|
+
| "sinOut"
|
|
59
|
+
| "sinInOut";
|
|
60
|
+
|
|
61
|
+
export interface VictoryAnimationProps {
|
|
62
|
+
children: (style: AnimationStyle, info: AnimationInfo) => React.ReactNode;
|
|
63
|
+
duration?: number;
|
|
64
|
+
easing?: AnimationEasing;
|
|
65
|
+
delay?: number;
|
|
66
|
+
onEnd?: () => void;
|
|
67
|
+
data: AnimationData;
|
|
68
|
+
}
|
|
69
|
+
export interface VictoryAnimationState {
|
|
70
|
+
data: AnimationStyle;
|
|
71
|
+
animationInfo: AnimationInfo;
|
|
72
|
+
}
|
|
73
|
+
export interface AnimationInfo {
|
|
74
|
+
progress: number;
|
|
75
|
+
animating: boolean;
|
|
76
|
+
terminating?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface VictoryAnimation {
|
|
80
|
+
context: React.ContextType<typeof TimerContext>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export class VictoryAnimation extends React.Component<
|
|
84
|
+
VictoryAnimationProps,
|
|
85
|
+
VictoryAnimationState
|
|
86
|
+
> {
|
|
10
87
|
static displayName = "VictoryAnimation";
|
|
11
88
|
|
|
12
89
|
static propTypes = {
|
|
@@ -67,6 +144,11 @@ export default class VictoryAnimation extends React.Component {
|
|
|
67
144
|
};
|
|
68
145
|
|
|
69
146
|
static contextType = TimerContext;
|
|
147
|
+
private interpolator: null | ((value: number) => AnimationStyle);
|
|
148
|
+
private queue: AnimationStyle[];
|
|
149
|
+
private ease: any;
|
|
150
|
+
private timer: Timer;
|
|
151
|
+
private loopID?: number;
|
|
70
152
|
|
|
71
153
|
constructor(props, context) {
|
|
72
154
|
super(props, context);
|
|
@@ -84,11 +166,6 @@ export default class VictoryAnimation extends React.Component {
|
|
|
84
166
|
this.queue = Array.isArray(this.props.data) ? this.props.data.slice(1) : [];
|
|
85
167
|
/* build easing function */
|
|
86
168
|
this.ease = d3Ease[this.toNewName(this.props.easing)];
|
|
87
|
-
/*
|
|
88
|
-
There is no autobinding of this in ES6 classes
|
|
89
|
-
so we bind functionToBeRunEachFrame to current instance of victory animation class
|
|
90
|
-
*/
|
|
91
|
-
this.functionToBeRunEachFrame = this.functionToBeRunEachFrame.bind(this);
|
|
92
169
|
this.timer = this.context.animationTimer;
|
|
93
170
|
}
|
|
94
171
|
|
|
@@ -163,13 +240,13 @@ export default class VictoryAnimation extends React.Component {
|
|
|
163
240
|
setTimeout(() => {
|
|
164
241
|
this.loopID = this.timer.subscribe(
|
|
165
242
|
this.functionToBeRunEachFrame,
|
|
166
|
-
this.props.duration
|
|
243
|
+
this.props.duration!
|
|
167
244
|
);
|
|
168
245
|
}, this.props.delay);
|
|
169
246
|
} else {
|
|
170
247
|
this.loopID = this.timer.subscribe(
|
|
171
248
|
this.functionToBeRunEachFrame,
|
|
172
|
-
this.props.duration
|
|
249
|
+
this.props.duration!
|
|
173
250
|
);
|
|
174
251
|
}
|
|
175
252
|
} else if (this.props.onEnd) {
|
|
@@ -177,7 +254,7 @@ export default class VictoryAnimation extends React.Component {
|
|
|
177
254
|
}
|
|
178
255
|
}
|
|
179
256
|
/* every frame we... */
|
|
180
|
-
functionToBeRunEachFrame(elapsed, duration) {
|
|
257
|
+
functionToBeRunEachFrame = (elapsed, duration) => {
|
|
181
258
|
/*
|
|
182
259
|
step can generate imprecise values, sometimes greater than 1
|
|
183
260
|
if this happens set the state to 1 and return, cancelling the timer
|
|
@@ -186,7 +263,7 @@ export default class VictoryAnimation extends React.Component {
|
|
|
186
263
|
const step = duration ? elapsed / duration : 1;
|
|
187
264
|
if (step >= 1) {
|
|
188
265
|
this.setState({
|
|
189
|
-
data: this.interpolator(1),
|
|
266
|
+
data: this.interpolator!(1),
|
|
190
267
|
animationInfo: {
|
|
191
268
|
progress: 1,
|
|
192
269
|
animating: false,
|
|
@@ -206,13 +283,13 @@ export default class VictoryAnimation extends React.Component {
|
|
|
206
283
|
interpolator, which is cached for performance whenever props are received
|
|
207
284
|
*/
|
|
208
285
|
this.setState({
|
|
209
|
-
data: this.interpolator(this.ease(step)),
|
|
286
|
+
data: this.interpolator!(this.ease(step)),
|
|
210
287
|
animationInfo: {
|
|
211
288
|
progress: step,
|
|
212
289
|
animating: step < 1
|
|
213
290
|
}
|
|
214
291
|
});
|
|
215
|
-
}
|
|
292
|
+
};
|
|
216
293
|
|
|
217
294
|
render() {
|
|
218
295
|
return this.props.children(this.state.data, this.state.animationInfo);
|
|
@@ -2,12 +2,36 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
|
+
import * as UserProps from "../victory-util/user-props";
|
|
5
6
|
import { assign, defaults, isObject, uniqueId } from "lodash";
|
|
6
|
-
import ClipPath from "../victory-primitives/clip-path";
|
|
7
|
-
import Circle from "../victory-primitives/circle";
|
|
8
|
-
import Rect from "../victory-primitives/rect";
|
|
7
|
+
import { ClipPath } from "../victory-primitives/clip-path";
|
|
8
|
+
import { Circle } from "../victory-primitives/circle";
|
|
9
|
+
import { Rect } from "../victory-primitives/rect";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
import { BlockProps } from "../victory-theme/victory-theme";
|
|
12
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
13
|
+
|
|
14
|
+
export interface VictoryClipContainerProps {
|
|
15
|
+
"aria-label"?: string;
|
|
16
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
17
|
+
circleComponent?: React.ReactElement;
|
|
18
|
+
className?: string;
|
|
19
|
+
clipHeight?: number;
|
|
20
|
+
clipId?: number | string;
|
|
21
|
+
clipPadding?: BlockProps;
|
|
22
|
+
clipPathComponent?: React.ReactElement;
|
|
23
|
+
clipWidth?: number;
|
|
24
|
+
events?: React.DOMAttributes<any>;
|
|
25
|
+
groupComponent?: React.ReactElement;
|
|
26
|
+
origin?: OriginType;
|
|
27
|
+
polar?: boolean;
|
|
28
|
+
radius?: number;
|
|
29
|
+
rectComponent?: React.ReactElement;
|
|
30
|
+
translateX?: number;
|
|
31
|
+
translateY?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
|
|
11
35
|
static displayName = "VictoryClipContainer";
|
|
12
36
|
static role = "container";
|
|
13
37
|
static propTypes = {
|
|
@@ -49,8 +73,9 @@ export default class VictoryClipContainer extends React.Component {
|
|
|
49
73
|
clipPathComponent: <ClipPath />,
|
|
50
74
|
groupComponent: <g />
|
|
51
75
|
};
|
|
76
|
+
private clipId: VictoryClipContainerProps["clipId"];
|
|
52
77
|
|
|
53
|
-
constructor(props) {
|
|
78
|
+
constructor(props: VictoryClipContainerProps) {
|
|
54
79
|
super(props);
|
|
55
80
|
this.clipId =
|
|
56
81
|
!isObject(props) || props.clipId === undefined
|
|
@@ -84,6 +109,7 @@ export default class VictoryClipContainer extends React.Component {
|
|
|
84
109
|
}
|
|
85
110
|
|
|
86
111
|
renderClippedGroup(props, clipId) {
|
|
112
|
+
const userProps = UserProps.getSafeUserProps(props);
|
|
87
113
|
const {
|
|
88
114
|
style,
|
|
89
115
|
events,
|
|
@@ -106,7 +132,7 @@ export default class VictoryClipContainer extends React.Component {
|
|
|
106
132
|
);
|
|
107
133
|
return React.cloneElement(
|
|
108
134
|
groupComponent,
|
|
109
|
-
{ ...groupProps,
|
|
135
|
+
{ ...groupProps, tabIndex, ...userProps },
|
|
110
136
|
[clipComponent, ...React.Children.toArray(children)]
|
|
111
137
|
);
|
|
112
138
|
}
|
|
@@ -2,13 +2,48 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
4
4
|
import { assign, defaults, uniqueId, isObject, isFunction } from "lodash";
|
|
5
|
-
import Portal from "../victory-portal/portal";
|
|
6
|
-
import PortalContext from "../victory-portal/portal-context";
|
|
5
|
+
import { Portal } from "../victory-portal/portal";
|
|
6
|
+
import { PortalContext } from "../victory-portal/portal-context";
|
|
7
7
|
import TimerContext from "../victory-util/timer-context";
|
|
8
8
|
import * as Helpers from "../victory-util/helpers";
|
|
9
9
|
import * as UserProps from "../victory-util/user-props";
|
|
10
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
11
|
+
import { D3Scale } from "../victory-util/types";
|
|
12
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme-definition";
|
|
10
13
|
|
|
11
|
-
export
|
|
14
|
+
export interface VictoryContainerProps {
|
|
15
|
+
"aria-describedby"?: string;
|
|
16
|
+
"aria-labelledby"?: string;
|
|
17
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
18
|
+
className?: string;
|
|
19
|
+
containerId?: number | string;
|
|
20
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
21
|
+
desc?: string;
|
|
22
|
+
events?: React.DOMAttributes<any>;
|
|
23
|
+
height?: number;
|
|
24
|
+
name?: string;
|
|
25
|
+
origin?: OriginType;
|
|
26
|
+
ouiaId?: number | string;
|
|
27
|
+
ouiaSafe?: boolean;
|
|
28
|
+
ouiaType?: string;
|
|
29
|
+
polar?: boolean;
|
|
30
|
+
portalComponent?: React.ReactElement;
|
|
31
|
+
portalZIndex?: number;
|
|
32
|
+
preserveAspectRatio?: string;
|
|
33
|
+
responsive?: boolean;
|
|
34
|
+
role?: string;
|
|
35
|
+
scale?: {
|
|
36
|
+
x?: D3Scale;
|
|
37
|
+
y?: D3Scale;
|
|
38
|
+
};
|
|
39
|
+
style?: React.CSSProperties;
|
|
40
|
+
tabIndex?: number;
|
|
41
|
+
theme?: VictoryThemeDefinition;
|
|
42
|
+
title?: string;
|
|
43
|
+
width?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class VictoryContainer extends React.Component<VictoryContainerProps> {
|
|
12
47
|
static displayName = "VictoryContainer";
|
|
13
48
|
static role = "container";
|
|
14
49
|
static propTypes = {
|
|
@@ -54,34 +89,39 @@ export default class VictoryContainer extends React.Component {
|
|
|
54
89
|
};
|
|
55
90
|
|
|
56
91
|
static contextType = TimerContext;
|
|
92
|
+
private containerId: VictoryContainerProps["containerId"];
|
|
93
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
94
|
+
private portalRef: Portal;
|
|
95
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
96
|
+
private containerRef: HTMLElement;
|
|
97
|
+
private shouldHandleWheel: boolean;
|
|
57
98
|
|
|
58
|
-
constructor(props) {
|
|
99
|
+
constructor(props: VictoryContainerProps) {
|
|
59
100
|
super(props);
|
|
60
101
|
this.containerId =
|
|
61
102
|
!isObject(props) || props.containerId === undefined
|
|
62
103
|
? uniqueId("victory-container-")
|
|
63
104
|
: props.containerId;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return portal;
|
|
67
|
-
};
|
|
68
|
-
this.portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
69
|
-
this.portalRegister = () => this.portalRef.portalRegister();
|
|
70
|
-
this.portalDeregister = (key) => this.portalRef.portalDeregister(key);
|
|
71
|
-
|
|
72
|
-
this.saveContainerRef =
|
|
73
|
-
props && isFunction(props.containerRef)
|
|
74
|
-
? props.containerRef
|
|
75
|
-
: (container) => {
|
|
76
|
-
this.containerRef = container;
|
|
77
|
-
return container;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
this.shouldHandleWheel = props && props.events && props.events.onWheel;
|
|
81
|
-
if (this.shouldHandleWheel) {
|
|
82
|
-
this.handleWheel = (e) => e.preventDefault();
|
|
83
|
-
}
|
|
105
|
+
|
|
106
|
+
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
84
107
|
}
|
|
108
|
+
savePortalRef = (portal) => {
|
|
109
|
+
this.portalRef = portal;
|
|
110
|
+
return portal;
|
|
111
|
+
};
|
|
112
|
+
portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
113
|
+
portalRegister = () => this.portalRef.portalRegister();
|
|
114
|
+
portalDeregister = (key) => this.portalRef.portalDeregister(key);
|
|
115
|
+
|
|
116
|
+
saveContainerRef = (container: HTMLElement) => {
|
|
117
|
+
if (isFunction(this.props.containerRef)) {
|
|
118
|
+
this.props.containerRef(container);
|
|
119
|
+
}
|
|
120
|
+
this.containerRef = container;
|
|
121
|
+
return container;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
handleWheel = (e) => e.preventDefault();
|
|
85
125
|
|
|
86
126
|
componentDidMount() {
|
|
87
127
|
if (this.shouldHandleWheel && this.containerRef) {
|
|
@@ -131,11 +171,15 @@ export default class VictoryContainer extends React.Component {
|
|
|
131
171
|
? { width: "100%", height: "100%" }
|
|
132
172
|
: { width, height };
|
|
133
173
|
const divStyle = assign(
|
|
134
|
-
{
|
|
174
|
+
{
|
|
175
|
+
pointerEvents: "none",
|
|
176
|
+
touchAction: "none",
|
|
177
|
+
position: "relative"
|
|
178
|
+
} as const,
|
|
135
179
|
dimensions
|
|
136
180
|
);
|
|
137
181
|
const portalDivStyle = assign(
|
|
138
|
-
{ zIndex: portalZIndex, position: "absolute", top: 0, left: 0 },
|
|
182
|
+
{ zIndex: portalZIndex, position: "absolute", top: 0, left: 0 } as const,
|
|
139
183
|
dimensions
|
|
140
184
|
);
|
|
141
185
|
const svgStyle = assign({ pointerEvents: "all" }, dimensions);
|
|
@@ -1,17 +1,67 @@
|
|
|
1
1
|
/*eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
2
|
-
import
|
|
2
|
+
import { assign, defaults, isEmpty } from "lodash";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { VictoryPortal } from "../victory-portal/victory-portal";
|
|
6
|
+
import { Rect } from "../victory-primitives/rect";
|
|
7
|
+
import { Text } from "../victory-primitives/text";
|
|
8
|
+
import { TSpan } from "../victory-primitives/tspan";
|
|
7
9
|
import * as Helpers from "../victory-util/helpers";
|
|
8
10
|
import * as LabelHelpers from "../victory-util/label-helpers";
|
|
9
|
-
import * as Style from "../victory-util/style";
|
|
10
11
|
import * as Log from "../victory-util/log";
|
|
12
|
+
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
13
|
+
import * as Style from "../victory-util/style";
|
|
11
14
|
import * as TextSize from "../victory-util/textsize";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
+
import * as UserProps from "../victory-util/user-props";
|
|
16
|
+
import { StringOrCallback, StringOrNumberOrCallback } from "../types";
|
|
17
|
+
import {
|
|
18
|
+
NumberOrCallback,
|
|
19
|
+
PaddingProps,
|
|
20
|
+
VerticalAnchorType,
|
|
21
|
+
VictoryLabelStyleObject
|
|
22
|
+
} from "../victory-theme/victory-theme";
|
|
23
|
+
|
|
24
|
+
export type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
25
|
+
export type OriginType = { x: number; y: number };
|
|
26
|
+
export type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
27
|
+
|
|
28
|
+
export interface VictoryLabelProps {
|
|
29
|
+
angle?: StringOrNumberOrCallback;
|
|
30
|
+
ariaLabel?: StringOrCallback;
|
|
31
|
+
backgroundComponent?: React.ReactElement;
|
|
32
|
+
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
33
|
+
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
34
|
+
capHeight?: StringOrNumberOrCallback;
|
|
35
|
+
children?: StringOrNumberOrCallback;
|
|
36
|
+
className?: string;
|
|
37
|
+
datum?: object;
|
|
38
|
+
data?: any[];
|
|
39
|
+
desc?: string;
|
|
40
|
+
direction?: string;
|
|
41
|
+
disableInlineStyles?: boolean;
|
|
42
|
+
events?: React.DOMAttributes<any>;
|
|
43
|
+
groupComponent?: React.ReactElement;
|
|
44
|
+
id?: StringOrNumberOrCallback;
|
|
45
|
+
inline?: boolean;
|
|
46
|
+
labelPlacement?: LabelOrientationType;
|
|
47
|
+
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
48
|
+
origin?: OriginType;
|
|
49
|
+
polar?: boolean;
|
|
50
|
+
renderInPortal?: boolean;
|
|
51
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
52
|
+
tabIndex?: NumberOrCallback;
|
|
53
|
+
text?: string[] | StringOrNumberOrCallback;
|
|
54
|
+
textComponent?: React.ReactElement;
|
|
55
|
+
textAnchor?: TextAnchorType | { (): TextAnchorType };
|
|
56
|
+
title?: string;
|
|
57
|
+
transform?: string | object | (() => string | object);
|
|
58
|
+
tspanComponent?: React.ReactElement;
|
|
59
|
+
verticalAnchor?: VerticalAnchorType | { (): VerticalAnchorType };
|
|
60
|
+
x?: number;
|
|
61
|
+
y?: number;
|
|
62
|
+
dx?: StringOrNumberOrCallback;
|
|
63
|
+
dy?: StringOrNumberOrCallback;
|
|
64
|
+
}
|
|
15
65
|
|
|
16
66
|
const defaultStyles = {
|
|
17
67
|
fill: "#252525",
|
|
@@ -47,7 +97,7 @@ const getFontSize = (style) => {
|
|
|
47
97
|
return defaultStyles.fontSize;
|
|
48
98
|
};
|
|
49
99
|
|
|
50
|
-
const getSingleValue = (prop, index = 0) => {
|
|
100
|
+
const getSingleValue = <T,>(prop: T | T[], index = 0): T => {
|
|
51
101
|
return Array.isArray(prop) ? prop[index] || prop[0] : prop;
|
|
52
102
|
};
|
|
53
103
|
|
|
@@ -432,9 +482,9 @@ const evaluateProps = (props) => {
|
|
|
432
482
|
});
|
|
433
483
|
};
|
|
434
484
|
|
|
435
|
-
const getCalculatedProps = (props) => {
|
|
485
|
+
const getCalculatedProps = <T extends VictoryLabelProps>(props: T) => {
|
|
436
486
|
const ariaLabel = Helpers.evaluateProp(props.ariaLabel, props);
|
|
437
|
-
const style = getSingleValue(props.style);
|
|
487
|
+
const style = getSingleValue(props.style!);
|
|
438
488
|
const lineHeight = getLineHeight(props);
|
|
439
489
|
const direction = props.direction
|
|
440
490
|
? Helpers.evaluateProp(props.direction, props)
|
|
@@ -487,6 +537,7 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
487
537
|
tspanComponent,
|
|
488
538
|
textComponent
|
|
489
539
|
} = calculatedProps;
|
|
540
|
+
const userProps = UserProps.getSafeUserProps(calculatedProps);
|
|
490
541
|
|
|
491
542
|
const textProps = {
|
|
492
543
|
"aria-label": ariaLabel,
|
|
@@ -501,7 +552,8 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
501
552
|
title,
|
|
502
553
|
desc: Helpers.evaluateProp(desc, calculatedProps),
|
|
503
554
|
tabIndex: Helpers.evaluateProp(tabIndex, calculatedProps),
|
|
504
|
-
id
|
|
555
|
+
id,
|
|
556
|
+
...userProps
|
|
505
557
|
};
|
|
506
558
|
|
|
507
559
|
const tspans = text.map((line, i) => {
|
|
@@ -521,21 +573,25 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
521
573
|
return React.cloneElement(textComponent, textProps, tspans);
|
|
522
574
|
};
|
|
523
575
|
|
|
524
|
-
const VictoryLabel
|
|
576
|
+
export const VictoryLabel: {
|
|
577
|
+
role: string;
|
|
578
|
+
defaultStyles: typeof defaultStyles;
|
|
579
|
+
} & React.FC<VictoryLabelProps> = (props) => {
|
|
525
580
|
props = evaluateProps(props);
|
|
526
581
|
|
|
527
582
|
if (props.text === null || props.text === undefined) {
|
|
528
583
|
return null;
|
|
529
584
|
}
|
|
530
585
|
const calculatedProps = getCalculatedProps(props);
|
|
586
|
+
|
|
531
587
|
const { text, style, capHeight, backgroundPadding, lineHeight } =
|
|
532
588
|
calculatedProps;
|
|
533
589
|
|
|
534
|
-
const tspanValues = text.map((line, i) => {
|
|
535
|
-
const currentStyle = getSingleValue(style
|
|
590
|
+
const tspanValues = (text as string[]).map((line, i) => {
|
|
591
|
+
const currentStyle = getSingleValue(style!, i);
|
|
536
592
|
const capHeightPx = TextSize.convertLengthToPixels(
|
|
537
593
|
`${capHeight}em`,
|
|
538
|
-
currentStyle.fontSize
|
|
594
|
+
currentStyle.fontSize as number
|
|
539
595
|
);
|
|
540
596
|
const currentLineHeight = getSingleValue(lineHeight, i);
|
|
541
597
|
return {
|
|
@@ -543,6 +599,7 @@ const VictoryLabel = (props) => {
|
|
|
543
599
|
fontSize: currentStyle.fontSize || defaultStyles.fontSize,
|
|
544
600
|
capHeight: capHeightPx,
|
|
545
601
|
text: line,
|
|
602
|
+
// @ts-expect-error TODO: This looks like a bug:
|
|
546
603
|
textSize: TextSize.approximateTextSize(line, currentStyle),
|
|
547
604
|
lineHeight: currentLineHeight,
|
|
548
605
|
backgroundPadding: getSingleValue(backgroundPadding, i)
|
|
@@ -558,7 +615,7 @@ const VictoryLabel = (props) => {
|
|
|
558
615
|
);
|
|
559
616
|
const children = [backgroundElement, label];
|
|
560
617
|
const backgroundWithLabel = React.cloneElement(
|
|
561
|
-
props.groupComponent
|
|
618
|
+
props.groupComponent!,
|
|
562
619
|
{},
|
|
563
620
|
children
|
|
564
621
|
);
|
|
@@ -599,6 +656,7 @@ VictoryLabel.propTypes = {
|
|
|
599
656
|
className: PropTypes.string,
|
|
600
657
|
data: PropTypes.array,
|
|
601
658
|
datum: PropTypes.any,
|
|
659
|
+
// @ts-expect-error "Function is not assignable to string"
|
|
602
660
|
desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
603
661
|
direction: PropTypes.oneOf(["rtl", "ltr", "inherit"]),
|
|
604
662
|
dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
@@ -615,6 +673,7 @@ VictoryLabel.propTypes = {
|
|
|
615
673
|
PropTypes.func,
|
|
616
674
|
PropTypes.array
|
|
617
675
|
]),
|
|
676
|
+
// @ts-expect-error "x is required in origin"
|
|
618
677
|
origin: PropTypes.shape({
|
|
619
678
|
x: CustomPropTypes.nonNegative,
|
|
620
679
|
y: CustomPropTypes.nonNegative
|
|
@@ -633,6 +692,7 @@ VictoryLabel.propTypes = {
|
|
|
633
692
|
PropTypes.func,
|
|
634
693
|
PropTypes.array
|
|
635
694
|
]),
|
|
695
|
+
// @ts-expect-error Function is not assignable to string"
|
|
636
696
|
textAnchor: PropTypes.oneOfType([
|
|
637
697
|
PropTypes.oneOf(["start", "middle", "end", "inherit"]),
|
|
638
698
|
PropTypes.func
|
|
@@ -645,11 +705,14 @@ VictoryLabel.propTypes = {
|
|
|
645
705
|
PropTypes.func
|
|
646
706
|
]),
|
|
647
707
|
tspanComponent: PropTypes.element,
|
|
708
|
+
// @ts-expect-error Function is not assignable to string"
|
|
648
709
|
verticalAnchor: PropTypes.oneOfType([
|
|
649
710
|
PropTypes.oneOf(["start", "middle", "end"]),
|
|
650
711
|
PropTypes.func
|
|
651
712
|
]),
|
|
713
|
+
// @ts-expect-error Number is not assignable to string
|
|
652
714
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
715
|
+
// @ts-expect-error Number is not assignable to string
|
|
653
716
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
654
717
|
};
|
|
655
718
|
|
|
@@ -662,5 +725,3 @@ VictoryLabel.defaultProps = {
|
|
|
662
725
|
capHeight: 0.71, // Magic number from d3.
|
|
663
726
|
lineHeight: 1
|
|
664
727
|
};
|
|
665
|
-
|
|
666
|
-
export default VictoryLabel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface PortalContextValue {
|
|
4
|
+
portalRegister(): number;
|
|
5
|
+
portalUpdate(key: number, element: React.ReactElement): void;
|
|
6
|
+
portalDeregister(key: number): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The React context object consumers may use to access the context of the
|
|
11
|
+
* portal.
|
|
12
|
+
*/
|
|
13
|
+
export const PortalContext = React.createContext({} as PortalContextValue);
|
|
14
|
+
PortalContext.displayName = "PortalContext";
|
|
@@ -2,8 +2,20 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
4
4
|
import { keys } from "lodash";
|
|
5
|
+
import { PortalContextValue } from "./portal-context";
|
|
6
|
+
|
|
7
|
+
export interface PortalProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
height?: number;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
viewBox?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
}
|
|
5
14
|
|
|
6
|
-
export
|
|
15
|
+
export class Portal
|
|
16
|
+
extends React.Component<PortalProps>
|
|
17
|
+
implements PortalContextValue
|
|
18
|
+
{
|
|
7
19
|
static displayName = "Portal";
|
|
8
20
|
|
|
9
21
|
static propTypes = {
|
|
@@ -13,31 +25,30 @@ export default class Portal extends React.Component {
|
|
|
13
25
|
viewBox: PropTypes.string,
|
|
14
26
|
width: CustomPropTypes.nonNegative
|
|
15
27
|
};
|
|
28
|
+
private readonly map: Record<string, React.ReactElement>;
|
|
29
|
+
private index: number;
|
|
16
30
|
|
|
17
|
-
constructor(props) {
|
|
31
|
+
constructor(props: PortalProps) {
|
|
18
32
|
super(props);
|
|
19
33
|
this.map = {};
|
|
20
34
|
this.index = 1;
|
|
21
|
-
this.portalUpdate = this.portalUpdate.bind(this);
|
|
22
|
-
this.portalRegister = this.portalRegister.bind(this);
|
|
23
|
-
this.portalDeregister = this.portalDeregister.bind(this);
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
portalRegister() {
|
|
37
|
+
public portalRegister = (): number => {
|
|
27
38
|
return ++this.index;
|
|
28
|
-
}
|
|
39
|
+
};
|
|
29
40
|
|
|
30
|
-
portalUpdate(key, element) {
|
|
41
|
+
public portalUpdate = (key: number, element: React.ReactElement) => {
|
|
31
42
|
this.map[key] = element;
|
|
32
43
|
this.forceUpdate();
|
|
33
|
-
}
|
|
44
|
+
};
|
|
34
45
|
|
|
35
|
-
portalDeregister(key) {
|
|
46
|
+
public portalDeregister = (key: number) => {
|
|
36
47
|
delete this.map[key];
|
|
37
48
|
this.forceUpdate();
|
|
38
|
-
}
|
|
49
|
+
};
|
|
39
50
|
|
|
40
|
-
getChildren() {
|
|
51
|
+
private getChildren() {
|
|
41
52
|
return keys(this.map).map((key) => {
|
|
42
53
|
const el = this.map[key];
|
|
43
54
|
return el ? React.cloneElement(el, { key }) : el;
|