victory-cursor-container 36.5.3 → 36.6.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 +34 -0
- package/dist/victory-cursor-container.js +1584 -1434
- package/dist/victory-cursor-container.min.js +1 -1
- package/es/cursor-helpers.d.ts +33 -0
- package/es/cursor-helpers.js +114 -79
- package/es/index.d.ts +3 -37
- package/es/index.js +2 -2
- package/es/victory-cursor-container.d.ts +221 -0
- package/es/victory-cursor-container.js +10 -9
- package/lib/cursor-helpers.d.ts +33 -0
- package/lib/cursor-helpers.js +117 -85
- package/lib/index.d.ts +3 -37
- package/lib/index.js +22 -24
- package/lib/victory-cursor-container.d.ts +221 -0
- package/lib/victory-cursor-container.js +17 -18
- package/package.json +244 -7
- package/src/{cursor-helpers.js → cursor-helpers.tsx} +24 -12
- package/src/index.tsx +2 -0
- package/src/{victory-cursor-container.js → victory-cursor-container.tsx} +33 -7
- package/src/index.d.ts +0 -37
- package/src/index.js +0 -5
package/lib/cursor-helpers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.CursorHelpers = void 0;
|
|
7
7
|
|
|
8
8
|
var _mapValues4 = _interopRequireDefault(require("lodash/mapValues"));
|
|
9
9
|
|
|
@@ -15,106 +15,138 @@ var _victoryCore = require("victory-core");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
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); } }
|
|
21
21
|
|
|
22
|
-
function
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
23
|
|
|
24
24
|
var ON_MOUSE_MOVE_THROTTLE_MS = 16;
|
|
25
|
-
var CursorHelpers = {
|
|
26
|
-
getDimension: function (props) {
|
|
27
|
-
var horizontal = props.horizontal,
|
|
28
|
-
cursorDimension = props.cursorDimension;
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
var CursorHelpersClass = /*#__PURE__*/function () {
|
|
27
|
+
function CursorHelpersClass() {
|
|
28
|
+
var _this = this;
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
withinBounds: function (point, bounds) {
|
|
37
|
-
var _mapValues2 = (0, _mapValues4.default)(bounds, Number),
|
|
38
|
-
x1 = _mapValues2.x1,
|
|
39
|
-
x2 = _mapValues2.x2,
|
|
40
|
-
y1 = _mapValues2.y1,
|
|
41
|
-
y2 = _mapValues2.y2;
|
|
42
|
-
|
|
43
|
-
var _mapValues3 = (0, _mapValues4.default)(point, Number),
|
|
44
|
-
x = _mapValues3.x,
|
|
45
|
-
y = _mapValues3.y;
|
|
46
|
-
|
|
47
|
-
return x >= Math.min(x1, x2) && x <= Math.max(x1, x2) && y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
|
|
48
|
-
},
|
|
49
|
-
onMouseMove: function (evt, targetProps) {
|
|
50
|
-
var onCursorChange = targetProps.onCursorChange,
|
|
51
|
-
domain = targetProps.domain;
|
|
52
|
-
var cursorDimension = this.getDimension(targetProps);
|
|
53
|
-
|
|
54
|
-
var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
|
|
55
|
-
|
|
56
|
-
var cursorSVGPosition = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG);
|
|
57
|
-
|
|
58
|
-
var cursorValue = _victoryCore.Selection.getDataCoordinates(targetProps, targetProps.scale, cursorSVGPosition.x, cursorSVGPosition.y);
|
|
59
|
-
|
|
60
|
-
var inBounds = this.withinBounds(cursorValue, {
|
|
61
|
-
x1: domain.x[0],
|
|
62
|
-
x2: domain.x[1],
|
|
63
|
-
y1: domain.y[0],
|
|
64
|
-
y2: domain.y[1]
|
|
65
|
-
});
|
|
30
|
+
_classCallCheck(this, CursorHelpersClass);
|
|
66
31
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
32
|
+
this.handleMouseMove = function (evt, targetProps) {
|
|
33
|
+
var onCursorChange = targetProps.onCursorChange,
|
|
34
|
+
domain = targetProps.domain;
|
|
35
|
+
|
|
36
|
+
var cursorDimension = _this.getDimension(targetProps);
|
|
37
|
+
|
|
38
|
+
var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
|
|
39
|
+
|
|
40
|
+
var cursorSVGPosition = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG);
|
|
70
41
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
42
|
+
var cursorValue = _victoryCore.Selection.getDataCoordinates(targetProps, targetProps.scale, cursorSVGPosition.x, cursorSVGPosition.y);
|
|
43
|
+
|
|
44
|
+
var inBounds = _this.withinBounds(cursorValue, {
|
|
45
|
+
x1: domain.x[0],
|
|
46
|
+
x2: domain.x[1],
|
|
47
|
+
y1: domain.y[0],
|
|
48
|
+
y2: domain.y[1]
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (!inBounds) {
|
|
52
|
+
cursorValue = null;
|
|
77
53
|
}
|
|
78
|
-
}
|
|
79
54
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
55
|
+
if ((0, _isFunction2.default)(onCursorChange)) {
|
|
56
|
+
if (cursorValue) {
|
|
57
|
+
var value = cursorDimension ? cursorValue[cursorDimension] : cursorValue;
|
|
58
|
+
onCursorChange(value, targetProps);
|
|
59
|
+
} else if (cursorValue !== targetProps.cursorValue) {
|
|
60
|
+
onCursorChange(targetProps.defaultCursorValue || null, targetProps);
|
|
61
|
+
}
|
|
88
62
|
}
|
|
89
|
-
}];
|
|
90
|
-
},
|
|
91
|
-
onTouchEnd: function (evt, targetProps) {
|
|
92
|
-
var onCursorChange = targetProps.onCursorChange;
|
|
93
63
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
64
|
+
return [{
|
|
65
|
+
target: "parent",
|
|
66
|
+
eventKey: "parent",
|
|
67
|
+
mutation: function () {
|
|
68
|
+
return {
|
|
69
|
+
cursorValue: cursorValue,
|
|
70
|
+
parentSVG: parentSVG
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
this.onMouseMove = (0, _throttle2.default)(this.handleMouseMove, ON_MOUSE_MOVE_THROTTLE_MS, {
|
|
77
|
+
leading: true,
|
|
78
|
+
trailing: false
|
|
79
|
+
});
|
|
80
|
+
this.onMouseLeave = this.handleMouseMove;
|
|
81
|
+
|
|
82
|
+
this.onTouchEnd = function (evt, targetProps) {
|
|
83
|
+
var onCursorChange = targetProps.onCursorChange;
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
eventKey: "parent",
|
|
101
|
-
mutation: function () {
|
|
102
|
-
return {
|
|
103
|
-
cursorValue: null
|
|
104
|
-
};
|
|
85
|
+
if ((0, _isFunction2.default)(targetProps.onCursorChange)) {
|
|
86
|
+
onCursorChange(null, targetProps);
|
|
105
87
|
}
|
|
106
|
-
|
|
88
|
+
|
|
89
|
+
return [{
|
|
90
|
+
target: "parent",
|
|
91
|
+
eventKey: "parent",
|
|
92
|
+
mutation: function () {
|
|
93
|
+
return {
|
|
94
|
+
cursorValue: null
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}];
|
|
98
|
+
};
|
|
107
99
|
}
|
|
108
|
-
};
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
_createClass(CursorHelpersClass, [{
|
|
102
|
+
key: "getDimension",
|
|
103
|
+
value: function getDimension(props) {
|
|
104
|
+
var horizontal = props.horizontal,
|
|
105
|
+
cursorDimension = props.cursorDimension;
|
|
106
|
+
|
|
107
|
+
if (!horizontal || !cursorDimension) {
|
|
108
|
+
return cursorDimension;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return cursorDimension === "x" ? "y" : "x";
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "withinBounds",
|
|
115
|
+
value: function withinBounds(point, bounds) {
|
|
116
|
+
var _mapValues2 = (0, _mapValues4.default)(bounds, Number),
|
|
117
|
+
x1 = _mapValues2.x1,
|
|
118
|
+
x2 = _mapValues2.x2,
|
|
119
|
+
y1 = _mapValues2.y1,
|
|
120
|
+
y2 = _mapValues2.y2;
|
|
121
|
+
|
|
122
|
+
var _mapValues3 = (0, _mapValues4.default)(point, Number),
|
|
123
|
+
x = _mapValues3.x,
|
|
124
|
+
y = _mapValues3.y;
|
|
125
|
+
|
|
126
|
+
return x >= Math.min(x1, x2) && x <= Math.max(x1, x2) && y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
|
|
130
|
+
return CursorHelpersClass;
|
|
131
|
+
}();
|
|
132
|
+
|
|
133
|
+
var CursorHelpers = new CursorHelpersClass();
|
|
134
|
+
/* {
|
|
135
|
+
...CursorHelpers,
|
|
136
|
+
onMouseMove: throttle(
|
|
137
|
+
CursorHelpers.onMouseMove.bind(CursorHelpers),
|
|
138
|
+
ON_MOUSE_MOVE_THROTTLE_MS,
|
|
139
|
+
{
|
|
140
|
+
leading: true,
|
|
141
|
+
trailing: false,
|
|
142
|
+
},
|
|
143
|
+
),
|
|
115
144
|
onMouseLeave: CursorHelpers.onMouseMove.bind(CursorHelpers),
|
|
116
|
-
onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers)
|
|
117
|
-
}
|
|
145
|
+
onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
*/
|
|
118
150
|
|
|
119
|
-
exports.
|
|
151
|
+
exports.CursorHelpers = CursorHelpers;
|
|
120
152
|
//# sourceMappingURL=cursor-helpers.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
CoordinatesPropType,
|
|
5
|
-
CallbackArgs,
|
|
6
|
-
} from "victory-core";
|
|
7
|
-
|
|
8
|
-
export type CursorCoordinatesPropType = CoordinatesPropType | number;
|
|
9
|
-
|
|
10
|
-
export interface VictoryCursorContainerProps extends VictoryContainerProps {
|
|
11
|
-
cursorComponent?: React.ReactElement;
|
|
12
|
-
cursorDimension?: "x" | "y";
|
|
13
|
-
cursorLabel?: (point: CoordinatesPropType, args: CallbackArgs) => any | void;
|
|
14
|
-
cursorLabelComponent?: React.ReactElement;
|
|
15
|
-
cursorLabelOffset?: CursorCoordinatesPropType;
|
|
16
|
-
defaultCursorValue?: CursorCoordinatesPropType;
|
|
17
|
-
disable?: boolean;
|
|
18
|
-
onCursorChange?: (
|
|
19
|
-
value: CursorCoordinatesPropType,
|
|
20
|
-
props: VictoryCursorContainerProps,
|
|
21
|
-
) => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class VictoryCursorContainer extends React.Component<
|
|
25
|
-
VictoryCursorContainerProps,
|
|
26
|
-
any
|
|
27
|
-
> {}
|
|
28
|
-
|
|
29
|
-
export const CursorHelpers: {
|
|
30
|
-
getDimension(props): any;
|
|
31
|
-
withinBounds(point, bounds): any;
|
|
32
|
-
onMouseMove(evt, targetProps): any;
|
|
33
|
-
onMouseLeave(evt, targetProps): any;
|
|
34
|
-
onTouchEnd(evt, targetProps): any;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const cursorContainerMixin: (base: Function) => Function;
|
|
1
|
+
export * from "./cursor-helpers";
|
|
2
|
+
export * from "./victory-cursor-container";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -3,32 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "CursorHelpers", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _cursorHelpers.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "VictoryCursorContainer", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _victoryCursorContainer.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "cursorContainerMixin", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _victoryCursorContainer.cursorContainerMixin;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
6
|
|
|
25
|
-
var
|
|
7
|
+
var _cursorHelpers = require("./cursor-helpers");
|
|
26
8
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
Object.keys(_cursorHelpers).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _cursorHelpers[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _cursorHelpers[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
30
19
|
|
|
31
|
-
|
|
20
|
+
var _victoryCursorContainer = require("./victory-cursor-container");
|
|
32
21
|
|
|
33
|
-
|
|
22
|
+
Object.keys(_victoryCursorContainer).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _victoryCursorContainer[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _victoryCursorContainer[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
34
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { VictoryContainer, VictoryContainerProps, CoordinatesPropType, VictoryLabelProps, ValueOrCallback } from "victory-core";
|
|
4
|
+
export declare type CursorCoordinatesPropType = CoordinatesPropType | number;
|
|
5
|
+
export interface VictoryCursorContainerProps extends VictoryContainerProps {
|
|
6
|
+
cursorComponent?: React.ReactElement;
|
|
7
|
+
cursorDimension?: "x" | "y";
|
|
8
|
+
cursorLabel?: ValueOrCallback<VictoryLabelProps["text"]>;
|
|
9
|
+
cursorLabelComponent?: React.ReactElement;
|
|
10
|
+
cursorLabelOffset?: CursorCoordinatesPropType;
|
|
11
|
+
defaultCursorValue?: CursorCoordinatesPropType;
|
|
12
|
+
disable?: boolean;
|
|
13
|
+
onCursorChange?: (value: CursorCoordinatesPropType, props: VictoryCursorContainerProps) => void;
|
|
14
|
+
}
|
|
15
|
+
declare type ComponentClass<TProps> = {
|
|
16
|
+
new (props: TProps): React.Component<TProps>;
|
|
17
|
+
};
|
|
18
|
+
export declare function cursorContainerMixin<TBase extends ComponentClass<TProps>, TProps extends VictoryCursorContainerProps>(Base: TBase): {
|
|
19
|
+
new (props: TProps): {
|
|
20
|
+
getCursorPosition(props: any): any;
|
|
21
|
+
getCursorLabelOffset(props: any): any;
|
|
22
|
+
getPadding(props: any): {
|
|
23
|
+
top: any;
|
|
24
|
+
bottom: any;
|
|
25
|
+
left: any;
|
|
26
|
+
right: any;
|
|
27
|
+
};
|
|
28
|
+
getCursorElements(props: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
29
|
+
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment)[];
|
|
30
|
+
context: unknown;
|
|
31
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
32
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
33
|
+
render(): React.ReactNode;
|
|
34
|
+
readonly props: Readonly<TProps>;
|
|
35
|
+
state: Readonly<{}>;
|
|
36
|
+
refs: {
|
|
37
|
+
[key: string]: React.ReactInstance;
|
|
38
|
+
};
|
|
39
|
+
componentDidMount?(): void;
|
|
40
|
+
shouldComponentUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
41
|
+
componentWillUnmount?(): void;
|
|
42
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
43
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
|
|
44
|
+
componentDidUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
45
|
+
componentWillMount?(): void;
|
|
46
|
+
UNSAFE_componentWillMount?(): void;
|
|
47
|
+
componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
48
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
|
|
49
|
+
componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
50
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
51
|
+
};
|
|
52
|
+
displayName: string;
|
|
53
|
+
propTypes: {
|
|
54
|
+
cursorDimension: PropTypes.Requireable<string>;
|
|
55
|
+
cursorLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
56
|
+
cursorLabelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
57
|
+
cursorLabelOffset: PropTypes.Requireable<number | PropTypes.InferProps<{
|
|
58
|
+
x: PropTypes.Requireable<number>;
|
|
59
|
+
y: PropTypes.Requireable<number>;
|
|
60
|
+
}>>;
|
|
61
|
+
defaultCursorValue: PropTypes.Requireable<number | PropTypes.InferProps<{
|
|
62
|
+
x: PropTypes.Requireable<number>;
|
|
63
|
+
y: PropTypes.Requireable<number>;
|
|
64
|
+
}>>;
|
|
65
|
+
disable: PropTypes.Requireable<boolean>;
|
|
66
|
+
onCursorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
|
+
"aria-describedby": PropTypes.Requireable<string>;
|
|
68
|
+
"aria-labelledby": PropTypes.Requireable<string>;
|
|
69
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
70
|
+
className: PropTypes.Requireable<string>;
|
|
71
|
+
containerId: PropTypes.Requireable<string | number>;
|
|
72
|
+
containerRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
|
+
desc: PropTypes.Requireable<string>;
|
|
74
|
+
events: PropTypes.Requireable<object>;
|
|
75
|
+
height: PropTypes.Requireable<number | undefined>;
|
|
76
|
+
name: PropTypes.Requireable<string>;
|
|
77
|
+
origin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
78
|
+
x: PropTypes.Requireable<number | undefined>;
|
|
79
|
+
y: PropTypes.Requireable<number | undefined>;
|
|
80
|
+
}>>;
|
|
81
|
+
ouiaId: PropTypes.Requireable<string | number>;
|
|
82
|
+
ouiaSafe: PropTypes.Requireable<boolean>;
|
|
83
|
+
ouiaType: PropTypes.Requireable<string>;
|
|
84
|
+
polar: PropTypes.Requireable<boolean>;
|
|
85
|
+
portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
86
|
+
portalZIndex: PropTypes.Requireable<number | undefined>;
|
|
87
|
+
preserveAspectRatio: PropTypes.Requireable<string>;
|
|
88
|
+
responsive: PropTypes.Requireable<boolean>;
|
|
89
|
+
role: PropTypes.Requireable<string>;
|
|
90
|
+
style: PropTypes.Requireable<object>;
|
|
91
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
92
|
+
theme: PropTypes.Requireable<object>;
|
|
93
|
+
title: PropTypes.Requireable<string>;
|
|
94
|
+
width: PropTypes.Requireable<number | undefined>;
|
|
95
|
+
};
|
|
96
|
+
defaultProps: {
|
|
97
|
+
cursorLabelComponent: JSX.Element;
|
|
98
|
+
cursorLabelOffset: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
};
|
|
102
|
+
cursorComponent: JSX.Element;
|
|
103
|
+
className: string;
|
|
104
|
+
portalComponent: JSX.Element;
|
|
105
|
+
portalZIndex: number;
|
|
106
|
+
responsive: boolean;
|
|
107
|
+
role: string;
|
|
108
|
+
};
|
|
109
|
+
defaultEvents: (props: any) => {
|
|
110
|
+
target: string;
|
|
111
|
+
eventHandlers: {
|
|
112
|
+
onMouseLeave: (evt: any, targetProps: any) => {};
|
|
113
|
+
onTouchCancel: () => never[];
|
|
114
|
+
onMouseMove: (evt: any, targetProps: any) => {} | undefined;
|
|
115
|
+
onTouchMove: (evt: any, targetProps: any) => {} | undefined;
|
|
116
|
+
};
|
|
117
|
+
}[];
|
|
118
|
+
} & TBase;
|
|
119
|
+
export declare const VictoryCursorContainer: {
|
|
120
|
+
new (props: VictoryCursorContainerProps): {
|
|
121
|
+
getCursorPosition(props: any): any;
|
|
122
|
+
getCursorLabelOffset(props: any): any;
|
|
123
|
+
getPadding(props: any): {
|
|
124
|
+
top: any;
|
|
125
|
+
bottom: any;
|
|
126
|
+
left: any;
|
|
127
|
+
right: any;
|
|
128
|
+
};
|
|
129
|
+
getCursorElements(props: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
130
|
+
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment)[];
|
|
131
|
+
context: unknown;
|
|
132
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<VictoryCursorContainerProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
133
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
134
|
+
render(): React.ReactNode;
|
|
135
|
+
readonly props: Readonly<VictoryCursorContainerProps>;
|
|
136
|
+
state: Readonly<{}>;
|
|
137
|
+
refs: {
|
|
138
|
+
[key: string]: React.ReactInstance;
|
|
139
|
+
};
|
|
140
|
+
componentDidMount?(): void;
|
|
141
|
+
shouldComponentUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
142
|
+
componentWillUnmount?(): void;
|
|
143
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
144
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<VictoryCursorContainerProps>, prevState: Readonly<{}>): any;
|
|
145
|
+
componentDidUpdate?(prevProps: Readonly<VictoryCursorContainerProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
146
|
+
componentWillMount?(): void;
|
|
147
|
+
UNSAFE_componentWillMount?(): void;
|
|
148
|
+
componentWillReceiveProps?(nextProps: Readonly<VictoryCursorContainerProps>, nextContext: any): void;
|
|
149
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<VictoryCursorContainerProps>, nextContext: any): void;
|
|
150
|
+
componentWillUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
151
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
152
|
+
};
|
|
153
|
+
displayName: string;
|
|
154
|
+
propTypes: {
|
|
155
|
+
cursorDimension: PropTypes.Requireable<string>;
|
|
156
|
+
cursorLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
157
|
+
cursorLabelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
158
|
+
cursorLabelOffset: PropTypes.Requireable<number | PropTypes.InferProps<{
|
|
159
|
+
x: PropTypes.Requireable<number>;
|
|
160
|
+
y: PropTypes.Requireable<number>;
|
|
161
|
+
}>>;
|
|
162
|
+
defaultCursorValue: PropTypes.Requireable<number | PropTypes.InferProps<{
|
|
163
|
+
x: PropTypes.Requireable<number>;
|
|
164
|
+
y: PropTypes.Requireable<number>;
|
|
165
|
+
}>>;
|
|
166
|
+
disable: PropTypes.Requireable<boolean>;
|
|
167
|
+
onCursorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
168
|
+
"aria-describedby": PropTypes.Requireable<string>;
|
|
169
|
+
"aria-labelledby": PropTypes.Requireable<string>;
|
|
170
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
171
|
+
className: PropTypes.Requireable<string>;
|
|
172
|
+
containerId: PropTypes.Requireable<string | number>;
|
|
173
|
+
containerRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
174
|
+
desc: PropTypes.Requireable<string>;
|
|
175
|
+
events: PropTypes.Requireable<object>;
|
|
176
|
+
height: PropTypes.Requireable<number | undefined>;
|
|
177
|
+
name: PropTypes.Requireable<string>;
|
|
178
|
+
origin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
179
|
+
x: PropTypes.Requireable<number | undefined>;
|
|
180
|
+
y: PropTypes.Requireable<number | undefined>;
|
|
181
|
+
}>>;
|
|
182
|
+
ouiaId: PropTypes.Requireable<string | number>;
|
|
183
|
+
ouiaSafe: PropTypes.Requireable<boolean>;
|
|
184
|
+
ouiaType: PropTypes.Requireable<string>;
|
|
185
|
+
polar: PropTypes.Requireable<boolean>;
|
|
186
|
+
portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
187
|
+
portalZIndex: PropTypes.Requireable<number | undefined>;
|
|
188
|
+
preserveAspectRatio: PropTypes.Requireable<string>;
|
|
189
|
+
responsive: PropTypes.Requireable<boolean>;
|
|
190
|
+
role: PropTypes.Requireable<string>;
|
|
191
|
+
style: PropTypes.Requireable<object>;
|
|
192
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
193
|
+
theme: PropTypes.Requireable<object>;
|
|
194
|
+
title: PropTypes.Requireable<string>;
|
|
195
|
+
width: PropTypes.Requireable<number | undefined>;
|
|
196
|
+
};
|
|
197
|
+
defaultProps: {
|
|
198
|
+
cursorLabelComponent: JSX.Element;
|
|
199
|
+
cursorLabelOffset: {
|
|
200
|
+
x: number;
|
|
201
|
+
y: number;
|
|
202
|
+
};
|
|
203
|
+
cursorComponent: JSX.Element;
|
|
204
|
+
className: string;
|
|
205
|
+
portalComponent: JSX.Element;
|
|
206
|
+
portalZIndex: number;
|
|
207
|
+
responsive: boolean;
|
|
208
|
+
role: string;
|
|
209
|
+
};
|
|
210
|
+
defaultEvents: (props: any) => {
|
|
211
|
+
target: string;
|
|
212
|
+
eventHandlers: {
|
|
213
|
+
onMouseLeave: (evt: any, targetProps: any) => {};
|
|
214
|
+
onTouchCancel: () => never[];
|
|
215
|
+
onMouseMove: (evt: any, targetProps: any) => {} | undefined;
|
|
216
|
+
onTouchMove: (evt: any, targetProps: any) => {} | undefined;
|
|
217
|
+
};
|
|
218
|
+
}[];
|
|
219
|
+
} & typeof VictoryContainer;
|
|
220
|
+
export {};
|
|
221
|
+
//# sourceMappingURL=victory-cursor-container.d.ts.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.VictoryCursorContainer = void 0;
|
|
7
|
+
exports.cursorContainerMixin = cursorContainerMixin;
|
|
7
8
|
|
|
8
9
|
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
9
10
|
|
|
@@ -17,7 +18,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
18
|
|
|
18
19
|
var _victoryCore = require("victory-core");
|
|
19
20
|
|
|
20
|
-
var _cursorHelpers =
|
|
21
|
+
var _cursorHelpers = require("./cursor-helpers");
|
|
21
22
|
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
|
|
@@ -59,11 +60,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
59
60
|
|
|
60
61
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
function cursorContainerMixin(Base) {
|
|
63
64
|
var _class;
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
|
|
67
|
+
return _class = /*#__PURE__*/function (_Base) {
|
|
68
|
+
_inherits(VictoryCursorContainer, _Base);
|
|
67
69
|
|
|
68
70
|
var _super = _createSuper(VictoryCursorContainer);
|
|
69
71
|
|
|
@@ -116,9 +118,9 @@ var cursorContainerMixin = function (base) {
|
|
|
116
118
|
return (0, _isObject2.default)(c.props) && c.props.padding !== undefined;
|
|
117
119
|
});
|
|
118
120
|
return _victoryCore.Helpers.getPadding(child.props);
|
|
119
|
-
} else {
|
|
120
|
-
return _victoryCore.Helpers.getPadding(props);
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
return _victoryCore.Helpers.getPadding(props);
|
|
122
124
|
}
|
|
123
125
|
}, {
|
|
124
126
|
key: "getCursorElements",
|
|
@@ -134,7 +136,7 @@ var cursorContainerMixin = function (base) {
|
|
|
134
136
|
horizontal = props.horizontal,
|
|
135
137
|
theme = props.theme;
|
|
136
138
|
|
|
137
|
-
var cursorDimension = _cursorHelpers.
|
|
139
|
+
var cursorDimension = _cursorHelpers.CursorHelpers.getDimension(props);
|
|
138
140
|
|
|
139
141
|
var cursorValue = this.getCursorPosition(props);
|
|
140
142
|
var cursorLabelOffset = this.getCursorLabelOffset(props);
|
|
@@ -208,7 +210,7 @@ var cursorContainerMixin = function (base) {
|
|
|
208
210
|
}]);
|
|
209
211
|
|
|
210
212
|
return VictoryCursorContainer;
|
|
211
|
-
}(
|
|
213
|
+
}(Base), _class.displayName = "VictoryCursorContainer", _class.propTypes = _objectSpread(_objectSpread({}, _victoryCore.VictoryContainer.propTypes), {}, {
|
|
212
214
|
cursorDimension: _propTypes.default.oneOf(["x", "y"]),
|
|
213
215
|
cursorLabel: _propTypes.default.func,
|
|
214
216
|
cursorLabelComponent: _propTypes.default.element,
|
|
@@ -234,25 +236,22 @@ var cursorContainerMixin = function (base) {
|
|
|
234
236
|
target: "parent",
|
|
235
237
|
eventHandlers: {
|
|
236
238
|
onMouseLeave: function (evt, targetProps) {
|
|
237
|
-
return props.disable ? {} : _cursorHelpers.
|
|
239
|
+
return props.disable ? {} : _cursorHelpers.CursorHelpers.onMouseLeave(evt, targetProps);
|
|
238
240
|
},
|
|
239
241
|
onTouchCancel: function () {
|
|
240
242
|
return [];
|
|
241
243
|
},
|
|
242
244
|
onMouseMove: function (evt, targetProps) {
|
|
243
|
-
return props.disable ? {} : _cursorHelpers.
|
|
245
|
+
return props.disable ? {} : _cursorHelpers.CursorHelpers.onMouseMove(evt, targetProps);
|
|
244
246
|
},
|
|
245
247
|
onTouchMove: function (evt, targetProps) {
|
|
246
|
-
return props.disable ? {} : _cursorHelpers.
|
|
248
|
+
return props.disable ? {} : _cursorHelpers.CursorHelpers.onMouseMove(evt, targetProps);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
}];
|
|
250
252
|
}, _class;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
exports.cursorContainerMixin = cursorContainerMixin;
|
|
254
|
-
|
|
255
|
-
var _default = cursorContainerMixin(_victoryCore.VictoryContainer);
|
|
253
|
+
}
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
var VictoryCursorContainer = cursorContainerMixin(_victoryCore.VictoryContainer);
|
|
256
|
+
exports.VictoryCursorContainer = VictoryCursorContainer;
|
|
258
257
|
//# sourceMappingURL=victory-cursor-container.js.map
|