victory-cursor-container 36.5.0 → 36.5.1
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-cursor-container.js +5918 -109
- package/dist/victory-cursor-container.min.js +1 -1
- package/es/cursor-helpers.js +2 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -1
- package/es/victory-cursor-container.js +2 -1
- package/lib/cursor-helpers.js +2 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/victory-cursor-container.js +2 -1
- package/package.json +3 -3
- package/src/cursor-helpers.js +10 -10
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -1
- package/src/victory-cursor-container.js +26 -26
package/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
VictoryContainerProps,
|
|
4
4
|
CoordinatesPropType,
|
|
5
|
-
CallbackArgs
|
|
5
|
+
CallbackArgs,
|
|
6
6
|
} from "victory-core";
|
|
7
7
|
|
|
8
8
|
export type CursorCoordinatesPropType = CoordinatesPropType | number;
|
|
@@ -17,7 +17,7 @@ export interface VictoryCursorContainerProps extends VictoryContainerProps {
|
|
|
17
17
|
disable?: boolean;
|
|
18
18
|
onCursorChange?: (
|
|
19
19
|
value: CursorCoordinatesPropType,
|
|
20
|
-
props: VictoryCursorContainerProps
|
|
20
|
+
props: VictoryCursorContainerProps,
|
|
21
21
|
) => void;
|
|
22
22
|
}
|
|
23
23
|
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
VictoryContainer,
|
|
5
5
|
VictoryLabel,
|
|
6
6
|
LineSegment,
|
|
7
|
-
Helpers
|
|
7
|
+
Helpers,
|
|
8
8
|
} from "victory-core";
|
|
9
9
|
import { defaults, assign, isObject } from "lodash";
|
|
10
10
|
import CursorHelpers from "./cursor-helpers";
|
|
@@ -21,27 +21,27 @@ export const cursorContainerMixin = (base) =>
|
|
|
21
21
|
PropTypes.number,
|
|
22
22
|
PropTypes.shape({
|
|
23
23
|
x: PropTypes.number,
|
|
24
|
-
y: PropTypes.number
|
|
25
|
-
})
|
|
24
|
+
y: PropTypes.number,
|
|
25
|
+
}),
|
|
26
26
|
]),
|
|
27
27
|
defaultCursorValue: PropTypes.oneOfType([
|
|
28
28
|
PropTypes.number,
|
|
29
29
|
PropTypes.shape({
|
|
30
30
|
x: PropTypes.number,
|
|
31
|
-
y: PropTypes.number
|
|
32
|
-
})
|
|
31
|
+
y: PropTypes.number,
|
|
32
|
+
}),
|
|
33
33
|
]),
|
|
34
34
|
disable: PropTypes.bool,
|
|
35
|
-
onCursorChange: PropTypes.func
|
|
35
|
+
onCursorChange: PropTypes.func,
|
|
36
36
|
};
|
|
37
37
|
static defaultProps = {
|
|
38
38
|
...VictoryContainer.defaultProps,
|
|
39
39
|
cursorLabelComponent: <VictoryLabel />,
|
|
40
40
|
cursorLabelOffset: {
|
|
41
41
|
x: 5,
|
|
42
|
-
y: -10
|
|
42
|
+
y: -10,
|
|
43
43
|
},
|
|
44
|
-
cursorComponent: <LineSegment
|
|
44
|
+
cursorComponent: <LineSegment />,
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
static defaultEvents = (props) => {
|
|
@@ -66,9 +66,9 @@ export const cursorContainerMixin = (base) =>
|
|
|
66
66
|
return props.disable
|
|
67
67
|
? {}
|
|
68
68
|
: CursorHelpers.onMouseMove(evt, targetProps);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
72
|
];
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -83,7 +83,7 @@ export const cursorContainerMixin = (base) =>
|
|
|
83
83
|
return {
|
|
84
84
|
x: (domain.x[0] + domain.x[1]) / 2,
|
|
85
85
|
y: (domain.y[0] + domain.y[1]) / 2,
|
|
86
|
-
[cursorDimension]: defaultCursorValue
|
|
86
|
+
[cursorDimension]: defaultCursorValue,
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -96,7 +96,7 @@ export const cursorContainerMixin = (base) =>
|
|
|
96
96
|
if (typeof cursorLabelOffset === "number") {
|
|
97
97
|
return {
|
|
98
98
|
x: cursorLabelOffset,
|
|
99
|
-
y: cursorLabelOffset
|
|
99
|
+
y: cursorLabelOffset,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -125,7 +125,7 @@ export const cursorContainerMixin = (base) =>
|
|
|
125
125
|
height,
|
|
126
126
|
name,
|
|
127
127
|
horizontal,
|
|
128
|
-
theme
|
|
128
|
+
theme,
|
|
129
129
|
} = props;
|
|
130
130
|
const cursorDimension = CursorHelpers.getDimension(props);
|
|
131
131
|
const cursorValue = this.getCursorPosition(props);
|
|
@@ -139,7 +139,7 @@ export const cursorContainerMixin = (base) =>
|
|
|
139
139
|
const padding = this.getPadding(props);
|
|
140
140
|
const cursorCoordinates = {
|
|
141
141
|
x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
|
|
142
|
-
y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
|
|
142
|
+
y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y),
|
|
143
143
|
};
|
|
144
144
|
if (cursorLabel) {
|
|
145
145
|
let labelProps = defaults(
|
|
@@ -150,8 +150,8 @@ export const cursorContainerMixin = (base) =>
|
|
|
150
150
|
y: cursorCoordinates.y + cursorLabelOffset.y,
|
|
151
151
|
datum: cursorValue,
|
|
152
152
|
active: true,
|
|
153
|
-
key: `${name}-cursor-label
|
|
154
|
-
}
|
|
153
|
+
key: `${name}-cursor-label`,
|
|
154
|
+
},
|
|
155
155
|
);
|
|
156
156
|
if (Helpers.isTooltip(cursorLabelComponent)) {
|
|
157
157
|
const tooltipTheme = (theme && theme.tooltip) || {};
|
|
@@ -161,15 +161,15 @@ export const cursorContainerMixin = (base) =>
|
|
|
161
161
|
React.cloneElement(
|
|
162
162
|
cursorLabelComponent,
|
|
163
163
|
defaults({}, labelProps, {
|
|
164
|
-
text: Helpers.evaluateProp(cursorLabel, labelProps)
|
|
165
|
-
})
|
|
166
|
-
)
|
|
164
|
+
text: Helpers.evaluateProp(cursorLabel, labelProps),
|
|
165
|
+
}),
|
|
166
|
+
),
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
const cursorStyle = assign(
|
|
171
171
|
{ stroke: "black" },
|
|
172
|
-
cursorComponent.props.style
|
|
172
|
+
cursorComponent.props.style,
|
|
173
173
|
);
|
|
174
174
|
if (cursorDimension === "x" || cursorDimension === undefined) {
|
|
175
175
|
newElements.push(
|
|
@@ -179,8 +179,8 @@ export const cursorContainerMixin = (base) =>
|
|
|
179
179
|
x2: cursorCoordinates.x,
|
|
180
180
|
y1: padding.top,
|
|
181
181
|
y2: height - padding.bottom,
|
|
182
|
-
style: cursorStyle
|
|
183
|
-
})
|
|
182
|
+
style: cursorStyle,
|
|
183
|
+
}),
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
if (cursorDimension === "y" || cursorDimension === undefined) {
|
|
@@ -191,8 +191,8 @@ export const cursorContainerMixin = (base) =>
|
|
|
191
191
|
x2: width - padding.right,
|
|
192
192
|
y1: cursorCoordinates.y,
|
|
193
193
|
y2: cursorCoordinates.y,
|
|
194
|
-
style: cursorStyle
|
|
195
|
-
})
|
|
194
|
+
style: cursorStyle,
|
|
195
|
+
}),
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
return newElements;
|
|
@@ -202,7 +202,7 @@ export const cursorContainerMixin = (base) =>
|
|
|
202
202
|
getChildren(props) {
|
|
203
203
|
return [
|
|
204
204
|
...React.Children.toArray(props.children),
|
|
205
|
-
...this.getCursorElements(props)
|
|
205
|
+
...this.getCursorElements(props),
|
|
206
206
|
];
|
|
207
207
|
}
|
|
208
208
|
};
|