victory-cursor-container 36.4.1 → 36.5.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/dist/victory-cursor-container.js +6175 -369
- 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 +10 -9
- 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 +10 -9
- package/package.json +4 -4
- 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
|
@@ -37,6 +37,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
37
37
|
|
|
38
38
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
39
|
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
40
42
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
41
43
|
|
|
42
44
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -45,7 +47,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
45
47
|
|
|
46
48
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
47
49
|
|
|
48
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
50
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
49
51
|
|
|
50
52
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
51
53
|
|
|
@@ -55,9 +57,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
55
57
|
|
|
56
58
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
57
59
|
|
|
58
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
59
|
-
|
|
60
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
60
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
61
61
|
|
|
62
62
|
var cursorContainerMixin = function (base) {
|
|
63
63
|
var _class;
|
|
@@ -208,7 +208,7 @@ var cursorContainerMixin = function (base) {
|
|
|
208
208
|
}]);
|
|
209
209
|
|
|
210
210
|
return VictoryCursorContainer;
|
|
211
|
-
}(base),
|
|
211
|
+
}(base), _class.displayName = "VictoryCursorContainer", _class.propTypes = _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.propTypes), {}, {
|
|
212
212
|
cursorDimension: _propTypes.default.oneOf(["x", "y"]),
|
|
213
213
|
cursorLabel: _propTypes.default.func,
|
|
214
214
|
cursorLabelComponent: _propTypes.default.element,
|
|
@@ -222,14 +222,14 @@ var cursorContainerMixin = function (base) {
|
|
|
222
222
|
})]),
|
|
223
223
|
disable: _propTypes.default.bool,
|
|
224
224
|
onCursorChange: _propTypes.default.func
|
|
225
|
-
})
|
|
225
|
+
}), _class.defaultProps = _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.defaultProps), {}, {
|
|
226
226
|
cursorLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
227
227
|
cursorLabelOffset: {
|
|
228
228
|
x: 5,
|
|
229
229
|
y: -10
|
|
230
230
|
},
|
|
231
231
|
cursorComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.LineSegment, null)
|
|
232
|
-
})
|
|
232
|
+
}), _class.defaultEvents = function (props) {
|
|
233
233
|
return [{
|
|
234
234
|
target: "parent",
|
|
235
235
|
eventHandlers: {
|
|
@@ -247,11 +247,12 @@ var cursorContainerMixin = function (base) {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
}];
|
|
250
|
-
}
|
|
250
|
+
}, _class;
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
exports.cursorContainerMixin = cursorContainerMixin;
|
|
254
254
|
|
|
255
255
|
var _default = cursorContainerMixin(_victoryCore.VictoryContainer);
|
|
256
256
|
|
|
257
|
-
exports.default = _default;
|
|
257
|
+
exports.default = _default;
|
|
258
|
+
//# sourceMappingURL=victory-cursor-container.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-cursor-container",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.5.2",
|
|
4
4
|
"description": "Interactive Cursor Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash": "^4.17.19",
|
|
23
23
|
"prop-types": "^15.8.1",
|
|
24
|
-
"victory-core": "^36.
|
|
24
|
+
"victory-core": "^36.5.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": "
|
|
27
|
+
"react": ">=16.6.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"version": "yarn run nps build-libs && nps build-dists"
|
|
31
31
|
},
|
|
32
32
|
"sideEffects": false,
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "def218e9749ecafc159ef458dd03a8b92e227666"
|
|
34
34
|
}
|
package/src/cursor-helpers.js
CHANGED
|
@@ -32,14 +32,14 @@ const CursorHelpers = {
|
|
|
32
32
|
targetProps,
|
|
33
33
|
targetProps.scale,
|
|
34
34
|
cursorSVGPosition.x,
|
|
35
|
-
cursorSVGPosition.y
|
|
35
|
+
cursorSVGPosition.y,
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const inBounds = this.withinBounds(cursorValue, {
|
|
39
39
|
x1: domain.x[0],
|
|
40
40
|
x2: domain.x[1],
|
|
41
41
|
y1: domain.y[0],
|
|
42
|
-
y2: domain.y[1]
|
|
42
|
+
y2: domain.y[1],
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
if (!inBounds) {
|
|
@@ -61,8 +61,8 @@ const CursorHelpers = {
|
|
|
61
61
|
{
|
|
62
62
|
target: "parent",
|
|
63
63
|
eventKey: "parent",
|
|
64
|
-
mutation: () => ({ cursorValue, parentSVG })
|
|
65
|
-
}
|
|
64
|
+
mutation: () => ({ cursorValue, parentSVG }),
|
|
65
|
+
},
|
|
66
66
|
];
|
|
67
67
|
},
|
|
68
68
|
|
|
@@ -77,10 +77,10 @@ const CursorHelpers = {
|
|
|
77
77
|
{
|
|
78
78
|
target: "parent",
|
|
79
79
|
eventKey: "parent",
|
|
80
|
-
mutation: () => ({ cursorValue: null })
|
|
81
|
-
}
|
|
80
|
+
mutation: () => ({ cursorValue: null }),
|
|
81
|
+
},
|
|
82
82
|
];
|
|
83
|
-
}
|
|
83
|
+
},
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
export default {
|
|
@@ -90,9 +90,9 @@ export default {
|
|
|
90
90
|
ON_MOUSE_MOVE_THROTTLE_MS,
|
|
91
91
|
{
|
|
92
92
|
leading: true,
|
|
93
|
-
trailing: false
|
|
94
|
-
}
|
|
93
|
+
trailing: false,
|
|
94
|
+
},
|
|
95
95
|
),
|
|
96
96
|
onMouseLeave: CursorHelpers.onMouseMove.bind(CursorHelpers),
|
|
97
|
-
onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers)
|
|
97
|
+
onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers),
|
|
98
98
|
};
|
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
|
};
|