@tradingaction/interactive 2.0.13
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/LICENSE +24 -0
- package/README.md +5 -0
- package/lib/Brush.d.ts +35 -0
- package/lib/Brush.js +103 -0
- package/lib/Brush.js.map +1 -0
- package/lib/ClickCallback.d.ts +18 -0
- package/lib/ClickCallback.js +12 -0
- package/lib/ClickCallback.js.map +1 -0
- package/lib/DrawingObjectSelector.d.ts +18 -0
- package/lib/DrawingObjectSelector.js +73 -0
- package/lib/DrawingObjectSelector.js.map +1 -0
- package/lib/EquidistantChannel.d.ts +74 -0
- package/lib/EquidistantChannel.js +149 -0
- package/lib/EquidistantChannel.js.map +1 -0
- package/lib/FibonacciRetracement.d.ts +89 -0
- package/lib/FibonacciRetracement.js +184 -0
- package/lib/FibonacciRetracement.js.map +1 -0
- package/lib/GannFan.d.ts +78 -0
- package/lib/GannFan.js +128 -0
- package/lib/GannFan.js.map +1 -0
- package/lib/InteractiveText.d.ts +65 -0
- package/lib/InteractiveText.js +83 -0
- package/lib/InteractiveText.js.map +1 -0
- package/lib/InteractiveYCoordinate.d.ts +122 -0
- package/lib/InteractiveYCoordinate.js +100 -0
- package/lib/InteractiveYCoordinate.js.map +1 -0
- package/lib/StandardDeviationChannel.d.ts +74 -0
- package/lib/StandardDeviationChannel.js +125 -0
- package/lib/StandardDeviationChannel.js.map +1 -0
- package/lib/TrendLine.d.ts +84 -0
- package/lib/TrendLine.js +128 -0
- package/lib/TrendLine.js.map +1 -0
- package/lib/ZoomButtons.d.ts +30 -0
- package/lib/ZoomButtons.js +78 -0
- package/lib/ZoomButtons.js.map +1 -0
- package/lib/components/ChannelWithArea.d.ts +30 -0
- package/lib/components/ChannelWithArea.js +126 -0
- package/lib/components/ChannelWithArea.js.map +1 -0
- package/lib/components/ClickableCircle.d.ts +26 -0
- package/lib/components/ClickableCircle.js +48 -0
- package/lib/components/ClickableCircle.js.map +1 -0
- package/lib/components/ClickableShape.d.ts +33 -0
- package/lib/components/ClickableShape.js +64 -0
- package/lib/components/ClickableShape.js.map +1 -0
- package/lib/components/GannFan.d.ts +32 -0
- package/lib/components/GannFan.js +134 -0
- package/lib/components/GannFan.js.map +1 -0
- package/lib/components/HoverTextNearMouse.d.ts +35 -0
- package/lib/components/HoverTextNearMouse.js +113 -0
- package/lib/components/HoverTextNearMouse.js.map +1 -0
- package/lib/components/InteractiveStraightLine.d.ts +61 -0
- package/lib/components/InteractiveStraightLine.js +220 -0
- package/lib/components/InteractiveStraightLine.js.map +1 -0
- package/lib/components/InteractiveText.d.ts +38 -0
- package/lib/components/InteractiveText.js +84 -0
- package/lib/components/InteractiveText.js.map +1 -0
- package/lib/components/InteractiveYCoordinate.d.ts +46 -0
- package/lib/components/InteractiveYCoordinate.js +109 -0
- package/lib/components/InteractiveYCoordinate.js.map +1 -0
- package/lib/components/LinearRegressionChannelWithArea.d.ts +31 -0
- package/lib/components/LinearRegressionChannelWithArea.js +104 -0
- package/lib/components/LinearRegressionChannelWithArea.js.map +1 -0
- package/lib/components/MouseLocationIndicator.d.ts +34 -0
- package/lib/components/MouseLocationIndicator.js +79 -0
- package/lib/components/MouseLocationIndicator.js.map +1 -0
- package/lib/components/Text.d.ts +17 -0
- package/lib/components/Text.js +26 -0
- package/lib/components/Text.js.map +1 -0
- package/lib/components/index.d.ts +11 -0
- package/lib/components/index.js +12 -0
- package/lib/components/index.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +84 -0
- package/lib/utils.js.map +1 -0
- package/lib/wrapper/EachEquidistantChannel.d.ts +59 -0
- package/lib/wrapper/EachEquidistantChannel.js +172 -0
- package/lib/wrapper/EachEquidistantChannel.js.map +1 -0
- package/lib/wrapper/EachFibRetracement.d.ts +81 -0
- package/lib/wrapper/EachFibRetracement.js +202 -0
- package/lib/wrapper/EachFibRetracement.js.map +1 -0
- package/lib/wrapper/EachGannFan.d.ts +81 -0
- package/lib/wrapper/EachGannFan.js +161 -0
- package/lib/wrapper/EachGannFan.js.map +1 -0
- package/lib/wrapper/EachInteractiveYCoordinate.d.ts +50 -0
- package/lib/wrapper/EachInteractiveYCoordinate.js +80 -0
- package/lib/wrapper/EachInteractiveYCoordinate.js.map +1 -0
- package/lib/wrapper/EachLinearRegressionChannel.d.ts +75 -0
- package/lib/wrapper/EachLinearRegressionChannel.js +89 -0
- package/lib/wrapper/EachLinearRegressionChannel.js.map +1 -0
- package/lib/wrapper/EachText.d.ts +59 -0
- package/lib/wrapper/EachText.js +83 -0
- package/lib/wrapper/EachText.js.map +1 -0
- package/lib/wrapper/EachTrendLine.d.ts +85 -0
- package/lib/wrapper/EachTrendLine.js +165 -0
- package/lib/wrapper/EachTrendLine.js.map +1 -0
- package/lib/wrapper/index.d.ts +7 -0
- package/lib/wrapper/index.js +8 -0
- package/lib/wrapper/index.js.map +1 -0
- package/package.json +53 -0
- package/src/Brush.tsx +172 -0
- package/src/ClickCallback.tsx +37 -0
- package/src/DrawingObjectSelector.tsx +97 -0
- package/src/EquidistantChannel.tsx +268 -0
- package/src/FibonacciRetracement.tsx +328 -0
- package/src/GannFan.tsx +233 -0
- package/src/InteractiveText.tsx +182 -0
- package/src/InteractiveYCoordinate.tsx +199 -0
- package/src/StandardDeviationChannel.tsx +269 -0
- package/src/TrendLine.tsx +294 -0
- package/src/ZoomButtons.tsx +165 -0
- package/src/components/ChannelWithArea.tsx +199 -0
- package/src/components/ClickableCircle.tsx +91 -0
- package/src/components/ClickableShape.tsx +114 -0
- package/src/components/GannFan.tsx +189 -0
- package/src/components/HoverTextNearMouse.tsx +174 -0
- package/src/components/InteractiveStraightLine.tsx +335 -0
- package/src/components/InteractiveText.tsx +146 -0
- package/src/components/InteractiveYCoordinate.tsx +200 -0
- package/src/components/LinearRegressionChannelWithArea.tsx +169 -0
- package/src/components/MouseLocationIndicator.tsx +128 -0
- package/src/components/Text.tsx +47 -0
- package/src/components/index.ts +11 -0
- package/src/index.ts +12 -0
- package/src/utils.ts +101 -0
- package/src/wrapper/EachEquidistantChannel.tsx +302 -0
- package/src/wrapper/EachFibRetracement.tsx +359 -0
- package/src/wrapper/EachGannFan.tsx +289 -0
- package/src/wrapper/EachInteractiveYCoordinate.tsx +198 -0
- package/src/wrapper/EachLinearRegressionChannel.tsx +202 -0
- package/src/wrapper/EachText.tsx +190 -0
- package/src/wrapper/EachTrendLine.tsx +331 -0
- package/src/wrapper/index.ts +7 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface EachGannFanProps {
|
|
3
|
+
readonly startXY: number[];
|
|
4
|
+
readonly endXY: number[];
|
|
5
|
+
readonly dy?: number;
|
|
6
|
+
readonly interactive: boolean;
|
|
7
|
+
readonly selected: boolean;
|
|
8
|
+
readonly appearance: {
|
|
9
|
+
readonly stroke: string;
|
|
10
|
+
readonly strokeWidth: number;
|
|
11
|
+
readonly edgeStroke: string;
|
|
12
|
+
readonly edgeFill: string;
|
|
13
|
+
readonly edgeStrokeWidth: number;
|
|
14
|
+
readonly r: number;
|
|
15
|
+
readonly fill: Array<string>;
|
|
16
|
+
readonly fontFamily: string;
|
|
17
|
+
readonly fontSize: number;
|
|
18
|
+
readonly fontFill: string;
|
|
19
|
+
};
|
|
20
|
+
readonly hoverText: {
|
|
21
|
+
readonly enable: boolean;
|
|
22
|
+
readonly fontFamily: string;
|
|
23
|
+
readonly fontSize: number;
|
|
24
|
+
readonly fill: string;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
readonly bgFill: string;
|
|
27
|
+
readonly bgOpacity: number;
|
|
28
|
+
readonly bgWidth: number | string;
|
|
29
|
+
readonly bgHeight: number | string;
|
|
30
|
+
readonly selectedText: string;
|
|
31
|
+
};
|
|
32
|
+
readonly index?: number;
|
|
33
|
+
readonly onDrag: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void;
|
|
34
|
+
readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
|
|
35
|
+
}
|
|
36
|
+
interface EachGannFanState {
|
|
37
|
+
hover: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class EachGannFan extends React.Component<EachGannFanProps, EachGannFanState> {
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
yDisplayFormat: (d: number) => string;
|
|
42
|
+
interactive: boolean;
|
|
43
|
+
selected: boolean;
|
|
44
|
+
appearance: {
|
|
45
|
+
stroke: string;
|
|
46
|
+
strokeWidth: number;
|
|
47
|
+
edgeStroke: string;
|
|
48
|
+
edgeFill: string;
|
|
49
|
+
edgeStrokeWidth: number;
|
|
50
|
+
r: number;
|
|
51
|
+
fill: string[];
|
|
52
|
+
fontFamily: string;
|
|
53
|
+
fontSize: number;
|
|
54
|
+
fontFill: string;
|
|
55
|
+
};
|
|
56
|
+
onDrag: () => void;
|
|
57
|
+
hoverText: {
|
|
58
|
+
enable: boolean;
|
|
59
|
+
bgHeight: number;
|
|
60
|
+
bgWidth: number;
|
|
61
|
+
text: string;
|
|
62
|
+
fontFamily: string;
|
|
63
|
+
fontSize: number;
|
|
64
|
+
fill: string;
|
|
65
|
+
bgFill: string;
|
|
66
|
+
bgOpacity: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
private isHover;
|
|
70
|
+
private dragStart;
|
|
71
|
+
private saveNodeType;
|
|
72
|
+
constructor(props: EachGannFanProps);
|
|
73
|
+
render(): JSX.Element;
|
|
74
|
+
private readonly getEdgeCircle;
|
|
75
|
+
private readonly handleLine1Edge2Drag;
|
|
76
|
+
private readonly handleLine1Edge1Drag;
|
|
77
|
+
private readonly handleFanDrag;
|
|
78
|
+
private readonly handleDragStart;
|
|
79
|
+
private readonly handleHover;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { isDefined, noop } from "@tradingaction/core";
|
|
14
|
+
import { getXValue } from "@tradingaction/core/lib/utils/ChartDataUtil";
|
|
15
|
+
import { isHover, saveNodeType } from "../utils";
|
|
16
|
+
import { ClickableCircle, GannFan, HoverTextNearMouse } from "../components";
|
|
17
|
+
export class EachGannFan extends React.Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.getEdgeCircle = ({ xy, dragHandler, cursor, fill, edge }) => {
|
|
21
|
+
const { hover } = this.state;
|
|
22
|
+
const { selected, appearance } = this.props;
|
|
23
|
+
const { edgeStroke, edgeStrokeWidth, r } = appearance;
|
|
24
|
+
const { onDragComplete } = this.props;
|
|
25
|
+
return (React.createElement(ClickableCircle, { ref: this.saveNodeType(edge), show: selected || hover, cx: xy[0], cy: xy[1], r: r, fillStyle: fill, strokeStyle: edgeStroke, strokeWidth: edgeStrokeWidth, interactiveCursorClass: cursor, onDragStart: this.handleDragStart, onDrag: dragHandler, onDragComplete: onDragComplete }));
|
|
26
|
+
};
|
|
27
|
+
this.handleLine1Edge2Drag = (e, moreProps) => {
|
|
28
|
+
const { index, onDrag } = this.props;
|
|
29
|
+
const { endXY } = this.dragStart;
|
|
30
|
+
const { startPos, mouseXY, xAccessor, xScale, fullData, chartConfig: { yScale }, } = moreProps;
|
|
31
|
+
const dx = startPos[0] - mouseXY[0];
|
|
32
|
+
const dy = startPos[1] - mouseXY[1];
|
|
33
|
+
const x1 = xScale(endXY[0]);
|
|
34
|
+
const y1 = yScale(endXY[1]);
|
|
35
|
+
const newX1Value = getXValue(xScale, xAccessor, [x1 - dx, y1 - dy], fullData);
|
|
36
|
+
const newY1Value = yScale.invert(y1 - dy);
|
|
37
|
+
onDrag(e, index, {
|
|
38
|
+
startXY: this.dragStart.startXY,
|
|
39
|
+
endXY: [newX1Value, newY1Value],
|
|
40
|
+
dy: this.dragStart.dy,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.handleLine1Edge1Drag = (e, moreProps) => {
|
|
44
|
+
const { index, onDrag } = this.props;
|
|
45
|
+
const { startXY } = this.dragStart;
|
|
46
|
+
const { startPos, mouseXY, xAccessor, xScale, fullData, chartConfig: { yScale }, } = moreProps;
|
|
47
|
+
const dx = startPos[0] - mouseXY[0];
|
|
48
|
+
const dy = startPos[1] - mouseXY[1];
|
|
49
|
+
const x1 = xScale(startXY[0]);
|
|
50
|
+
const y1 = yScale(startXY[1]);
|
|
51
|
+
const newX1Value = getXValue(xScale, xAccessor, [x1 - dx, y1 - dy], fullData);
|
|
52
|
+
const newY1Value = yScale.invert(y1 - dy);
|
|
53
|
+
onDrag(e, index, {
|
|
54
|
+
startXY: [newX1Value, newY1Value],
|
|
55
|
+
endXY: this.dragStart.endXY,
|
|
56
|
+
dy: this.dragStart.dy,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
this.handleFanDrag = (e, moreProps) => {
|
|
60
|
+
const { index, onDrag } = this.props;
|
|
61
|
+
const { startXY, endXY } = this.dragStart;
|
|
62
|
+
const { xScale, chartConfig: { yScale }, xAccessor, fullData, } = moreProps;
|
|
63
|
+
const { startPos, mouseXY } = moreProps;
|
|
64
|
+
const x1 = xScale(startXY[0]);
|
|
65
|
+
const y1 = yScale(startXY[1]);
|
|
66
|
+
const x2 = xScale(endXY[0]);
|
|
67
|
+
const y2 = yScale(endXY[1]);
|
|
68
|
+
const dx = startPos[0] - mouseXY[0];
|
|
69
|
+
const dy = startPos[1] - mouseXY[1];
|
|
70
|
+
const newX1Value = getXValue(xScale, xAccessor, [x1 - dx, y1 - dy], fullData);
|
|
71
|
+
const newY1Value = yScale.invert(y1 - dy);
|
|
72
|
+
const newX2Value = getXValue(xScale, xAccessor, [x2 - dx, y2 - dy], fullData);
|
|
73
|
+
const newY2Value = yScale.invert(y2 - dy);
|
|
74
|
+
// const newDy = newY2Value - endXY[1] + this.dragStart.dy;
|
|
75
|
+
onDrag(e, index, {
|
|
76
|
+
startXY: [newX1Value, newY1Value],
|
|
77
|
+
endXY: [newX2Value, newY2Value],
|
|
78
|
+
dy: this.dragStart.dy,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
this.handleDragStart = () => {
|
|
82
|
+
const { startXY, endXY, dy } = this.props;
|
|
83
|
+
this.dragStart = {
|
|
84
|
+
startXY,
|
|
85
|
+
endXY,
|
|
86
|
+
dy,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
this.handleHover = (moreProps) => {
|
|
90
|
+
if (this.state.hover !== moreProps.hovering) {
|
|
91
|
+
this.setState({
|
|
92
|
+
hover: moreProps.hovering,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
this.isHover = isHover.bind(this);
|
|
97
|
+
this.saveNodeType = saveNodeType.bind(this);
|
|
98
|
+
this.state = {
|
|
99
|
+
hover: false,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
const { startXY, endXY } = this.props;
|
|
104
|
+
const { interactive, appearance } = this.props;
|
|
105
|
+
const { edgeFill, stroke, strokeWidth, fill } = appearance;
|
|
106
|
+
const { fontFamily, fontSize, fontFill } = appearance;
|
|
107
|
+
const { hoverText, selected } = this.props;
|
|
108
|
+
const { onDragComplete } = this.props;
|
|
109
|
+
const { hover } = this.state;
|
|
110
|
+
const { enable: hoverTextEnabled } = hoverText, restHoverTextProps = __rest(hoverText, ["enable"]);
|
|
111
|
+
const hoverHandler = interactive ? { onHover: this.handleHover, onUnHover: this.handleHover } : {};
|
|
112
|
+
const line1Edge = isDefined(startXY) && isDefined(endXY) ? (React.createElement("g", null,
|
|
113
|
+
this.getEdgeCircle({
|
|
114
|
+
xy: startXY,
|
|
115
|
+
dragHandler: this.handleLine1Edge1Drag,
|
|
116
|
+
cursor: "react-financial-charts-move-cursor",
|
|
117
|
+
fill: edgeFill,
|
|
118
|
+
edge: "edge1",
|
|
119
|
+
}),
|
|
120
|
+
this.getEdgeCircle({
|
|
121
|
+
xy: endXY,
|
|
122
|
+
dragHandler: this.handleLine1Edge2Drag,
|
|
123
|
+
cursor: "react-financial-charts-move-cursor",
|
|
124
|
+
fill: edgeFill,
|
|
125
|
+
edge: "edge2",
|
|
126
|
+
}))) : null;
|
|
127
|
+
return (React.createElement("g", null,
|
|
128
|
+
React.createElement(GannFan, Object.assign({ ref: this.saveNodeType("fan"), selected: hover || selected }, hoverHandler, { startXY: startXY, endXY: endXY, strokeStyle: stroke, strokeWidth: hover || selected ? strokeWidth + 1 : strokeWidth, fillStyle: fill, fontFamily: fontFamily, fontSize: fontSize, fontFill: fontFill, interactiveCursorClass: "react-financial-charts-move-cursor", onDragStart: this.handleDragStart, onDrag: this.handleFanDrag, onDragComplete: onDragComplete })),
|
|
129
|
+
line1Edge,
|
|
130
|
+
React.createElement(HoverTextNearMouse, Object.assign({ show: hoverTextEnabled && hover && !selected }, restHoverTextProps))));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
EachGannFan.defaultProps = {
|
|
134
|
+
yDisplayFormat: (d) => d.toFixed(2),
|
|
135
|
+
interactive: true,
|
|
136
|
+
selected: false,
|
|
137
|
+
appearance: {
|
|
138
|
+
stroke: "#000000",
|
|
139
|
+
strokeWidth: 1,
|
|
140
|
+
edgeStroke: "#000000",
|
|
141
|
+
edgeFill: "#FFFFFF",
|
|
142
|
+
edgeStrokeWidth: 1,
|
|
143
|
+
r: 5,
|
|
144
|
+
fill: [
|
|
145
|
+
"rgba(31, 119, 180, 0.2)",
|
|
146
|
+
"rgba(255, 126, 14, 0.2)",
|
|
147
|
+
"rgba(44, 160, 44, 0.2)",
|
|
148
|
+
"rgba(214, 39, 39, 0.2)",
|
|
149
|
+
"rgba(148, 103, 189, 0.2)",
|
|
150
|
+
"rgba(140, 86, 75, 0.2)",
|
|
151
|
+
"rgba(227, 119, 194, 0.2)",
|
|
152
|
+
"rgba(127, 127, 127, 0.2)",
|
|
153
|
+
],
|
|
154
|
+
fontFamily: "-apple-system, system-ui, Roboto, 'Helvetica Neue', Ubuntu, sans-serif",
|
|
155
|
+
fontSize: 10,
|
|
156
|
+
fontFill: "#000000",
|
|
157
|
+
},
|
|
158
|
+
onDrag: noop,
|
|
159
|
+
hoverText: Object.assign(Object.assign({}, HoverTextNearMouse.defaultProps), { enable: true, bgHeight: 18, bgWidth: 120, text: "Click to select object" }),
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=EachGannFan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EachGannFan.js","sourceRoot":"","sources":["../../src/wrapper/EachGannFan.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAyC7E,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA6C;IAyChF,YAAmB,KAAuB;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QAmEA,kBAAa,GAAG,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAO,EAAE,EAAE;YA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AyB;YACzB,wBAAwB;YACxB,wBAAwB;YACxB,0BAA0B;YAC1B,wBAAwB;YACxB,0BAA0B;YAC1B,0BAA0B;SAC7B;QACD,UAAU,EAAE,wEAAwE;QACpF,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,SAAS;KACtB;IACD,MAAM,EAAE,IAAI;IACZ,SAAS,kCACF,kBAAkB,CAAC,YAAY,KAClC,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,wBAAwB,GACjC;CACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { strokeDashTypes } from "@tradingaction/core";
|
|
3
|
+
export interface EachInteractiveYCoordinateProps {
|
|
4
|
+
readonly index?: number;
|
|
5
|
+
readonly draggable: boolean;
|
|
6
|
+
readonly yValue: number;
|
|
7
|
+
readonly bgFill: string;
|
|
8
|
+
readonly stroke: string;
|
|
9
|
+
readonly strokeWidth: number;
|
|
10
|
+
readonly strokeDasharray: strokeDashTypes;
|
|
11
|
+
readonly textFill: string;
|
|
12
|
+
readonly fontWeight: string;
|
|
13
|
+
readonly fontFamily: string;
|
|
14
|
+
readonly fontStyle: string;
|
|
15
|
+
readonly fontSize: number;
|
|
16
|
+
readonly text: string;
|
|
17
|
+
readonly selected: boolean;
|
|
18
|
+
readonly edge: object;
|
|
19
|
+
readonly textBox: {
|
|
20
|
+
readonly closeIcon: any;
|
|
21
|
+
readonly left: number;
|
|
22
|
+
readonly height: number;
|
|
23
|
+
readonly padding: any;
|
|
24
|
+
};
|
|
25
|
+
readonly onDrag?: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void;
|
|
26
|
+
readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
|
|
27
|
+
readonly onDelete?: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void;
|
|
28
|
+
}
|
|
29
|
+
interface EachInteractiveYCoordinateState {
|
|
30
|
+
closeIconHover: boolean;
|
|
31
|
+
hover: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class EachInteractiveYCoordinate extends React.Component<EachInteractiveYCoordinateProps, EachInteractiveYCoordinateState> {
|
|
34
|
+
static defaultProps: {
|
|
35
|
+
strokeWidth: number;
|
|
36
|
+
selected: boolean;
|
|
37
|
+
draggable: boolean;
|
|
38
|
+
};
|
|
39
|
+
private dragStartPosition;
|
|
40
|
+
private isHover;
|
|
41
|
+
private saveNodeType;
|
|
42
|
+
constructor(props: EachInteractiveYCoordinateProps);
|
|
43
|
+
render(): JSX.Element;
|
|
44
|
+
private readonly handleCloseIconHover;
|
|
45
|
+
private readonly handleHover;
|
|
46
|
+
private readonly handleDelete;
|
|
47
|
+
private readonly handleDrag;
|
|
48
|
+
private readonly handleDragStart;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { isHover, saveNodeType } from "../utils";
|
|
3
|
+
import { ClickableShape, InteractiveYCoordinate } from "../components";
|
|
4
|
+
export class EachInteractiveYCoordinate extends React.Component {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super(props);
|
|
7
|
+
this.handleCloseIconHover = (_, moreProps) => {
|
|
8
|
+
if (this.state.closeIconHover !== moreProps.hovering) {
|
|
9
|
+
this.setState({
|
|
10
|
+
closeIconHover: moreProps.hovering,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.handleHover = (e, moreProps) => {
|
|
15
|
+
if (this.state.hover !== moreProps.hovering) {
|
|
16
|
+
this.setState({
|
|
17
|
+
hover: moreProps.hovering,
|
|
18
|
+
closeIconHover: moreProps.hovering ? this.state.closeIconHover : false,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.handleDelete = (e, moreProps) => {
|
|
23
|
+
const { index, onDelete } = this.props;
|
|
24
|
+
if (onDelete !== undefined) {
|
|
25
|
+
onDelete(e, index, moreProps);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
this.handleDrag = (e, moreProps) => {
|
|
29
|
+
const { index, onDrag } = this.props;
|
|
30
|
+
if (onDrag === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { mouseXY: [, mouseY], chartConfig: { yScale }, } = moreProps;
|
|
34
|
+
const { dy } = this.dragStartPosition;
|
|
35
|
+
const newYValue = yScale.invert(mouseY - dy);
|
|
36
|
+
onDrag(e, index, newYValue);
|
|
37
|
+
};
|
|
38
|
+
this.handleDragStart = (_, moreProps) => {
|
|
39
|
+
const { yValue } = this.props;
|
|
40
|
+
const { mouseXY } = moreProps;
|
|
41
|
+
const { chartConfig: { yScale }, } = moreProps;
|
|
42
|
+
const [, mouseY] = mouseXY;
|
|
43
|
+
const dy = mouseY - yScale(yValue);
|
|
44
|
+
this.dragStartPosition = {
|
|
45
|
+
yValue,
|
|
46
|
+
dy,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
this.isHover = isHover.bind(this);
|
|
50
|
+
this.saveNodeType = saveNodeType.bind(this);
|
|
51
|
+
this.state = {
|
|
52
|
+
hover: false,
|
|
53
|
+
closeIconHover: false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
const { yValue, bgFill, textFill, fontFamily, fontSize, fontWeight, fontStyle, text, selected, onDragComplete, stroke, strokeDasharray, strokeWidth, edge, textBox, draggable, } = this.props;
|
|
58
|
+
const { hover, closeIconHover } = this.state;
|
|
59
|
+
const hoverHandler = {
|
|
60
|
+
onHover: this.handleHover,
|
|
61
|
+
onUnHover: this.handleHover,
|
|
62
|
+
};
|
|
63
|
+
const dragProps = draggable
|
|
64
|
+
? {
|
|
65
|
+
onDragStart: this.handleDragStart,
|
|
66
|
+
onDrag: this.handleDrag,
|
|
67
|
+
onDragComplete,
|
|
68
|
+
}
|
|
69
|
+
: {};
|
|
70
|
+
return (React.createElement("g", null,
|
|
71
|
+
React.createElement(InteractiveYCoordinate, Object.assign({ ref: this.saveNodeType("priceCoordinate"), selected: selected && !closeIconHover, hovering: hover || closeIconHover, interactiveCursorClass: "react-financial-charts-move-cursor" }, hoverHandler, dragProps, { yValue: yValue, bgFillStyle: bgFill, textFill: textFill, fontFamily: fontFamily, fontStyle: fontStyle, fontWeight: fontWeight, fontSize: fontSize, strokeStyle: stroke, strokeDasharray: strokeDasharray, strokeWidth: strokeWidth, text: text, textBox: textBox, edge: edge })),
|
|
72
|
+
React.createElement(ClickableShape, { show: true, hovering: closeIconHover, text: text, yValue: yValue, fontFamily: fontFamily, fontStyle: fontStyle, fontWeight: fontWeight, fontSize: fontSize, textBox: textBox, strokeStyle: stroke, onHover: this.handleCloseIconHover, onUnHover: this.handleCloseIconHover, onClick: this.handleDelete })));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
EachInteractiveYCoordinate.defaultProps = {
|
|
76
|
+
strokeWidth: 1,
|
|
77
|
+
selected: false,
|
|
78
|
+
draggable: false,
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=EachInteractiveYCoordinate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EachInteractiveYCoordinate.js","sourceRoot":"","sources":["../../src/wrapper/EachInteractiveYCoordinate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAkCvE,MAAM,OAAO,0BAA2B,SAAQ,KAAK,CAAC,SAGrD;IAYG,YAAmB,KAAsC;QACrD,KAAK,CAAC,KAAK,CAAC,CAAC;QAuFA,yBAAoB,GAAG,CAAC,CAAmB,EAAE,SAAc,EAAE,EAAE;YAC5E,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,SAAS,C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E,IAAI,CAAC,UAAU;gBACvB,cAAc;aACjB;YACH,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,CACH;YACI,oBAAC,sBAAsB,kBACnB,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,EACzC,QAAQ,EAAE,QAAQ,IAAI,CAAC,cAAc,EACrC,QAAQ,EAAE,KAAK,IAAI,cAAc,EACjC,sBAAsB,EAAC,oCAAoC,IACvD,YAAY,EACZ,SAAS,IACb,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,IACZ;YACF,oBAAC,cAAc,IACX,IAAI,QACJ,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAClC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EACpC,OAAO,EAAE,IAAI,CAAC,YAAY,GAC5B,CACF,CACP,CAAC;IACN,CAAC;;AAjGa,uCAAY,GAAG;IACzB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,KAAK;CACnB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface EachLinearRegressionChannelProps {
|
|
3
|
+
readonly defaultClassName?: string;
|
|
4
|
+
readonly x1Value: any;
|
|
5
|
+
readonly x2Value: any;
|
|
6
|
+
readonly index?: number;
|
|
7
|
+
readonly appearance: {
|
|
8
|
+
readonly stroke: string;
|
|
9
|
+
readonly strokeWidth: number;
|
|
10
|
+
readonly fill: string;
|
|
11
|
+
readonly edgeStrokeWidth: number;
|
|
12
|
+
readonly edgeStroke: string;
|
|
13
|
+
readonly edgeFill: string;
|
|
14
|
+
readonly r: number;
|
|
15
|
+
};
|
|
16
|
+
readonly edgeInteractiveCursor?: string;
|
|
17
|
+
readonly onDrag?: (e: React.MouseEvent, index: number | undefined, x1y1: {
|
|
18
|
+
x1Value: any;
|
|
19
|
+
x2Value: any;
|
|
20
|
+
}) => void;
|
|
21
|
+
readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
|
|
22
|
+
readonly snapTo?: (datum: any) => number;
|
|
23
|
+
readonly interactive: boolean;
|
|
24
|
+
readonly selected: boolean;
|
|
25
|
+
readonly hoverText: {
|
|
26
|
+
readonly enable: boolean;
|
|
27
|
+
readonly fontFamily: string;
|
|
28
|
+
readonly fontSize: number;
|
|
29
|
+
readonly fill: string;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly bgFill: string;
|
|
32
|
+
readonly bgOpacity: number;
|
|
33
|
+
readonly bgWidth: number | string;
|
|
34
|
+
readonly bgHeight: number | string;
|
|
35
|
+
readonly selectedText: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface EachLinearRegressionChannelState {
|
|
39
|
+
hover: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare class EachLinearRegressionChannel extends React.Component<EachLinearRegressionChannelProps, EachLinearRegressionChannelState> {
|
|
42
|
+
static defaultProps: {
|
|
43
|
+
appearance: {
|
|
44
|
+
stroke: string;
|
|
45
|
+
strokeWidth: number;
|
|
46
|
+
fill: string;
|
|
47
|
+
edgeStrokeWidth: number;
|
|
48
|
+
edgeStroke: string;
|
|
49
|
+
edgeFill: string;
|
|
50
|
+
r: number;
|
|
51
|
+
};
|
|
52
|
+
interactive: boolean;
|
|
53
|
+
selected: boolean;
|
|
54
|
+
hoverText: {
|
|
55
|
+
enable: boolean;
|
|
56
|
+
bgHeight: number;
|
|
57
|
+
bgWidth: number;
|
|
58
|
+
text: string;
|
|
59
|
+
fontFamily: string;
|
|
60
|
+
fontSize: number;
|
|
61
|
+
fill: string;
|
|
62
|
+
bgFill: string;
|
|
63
|
+
bgOpacity: number;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
private isHover;
|
|
67
|
+
private saveNodeType;
|
|
68
|
+
constructor(props: EachLinearRegressionChannelProps);
|
|
69
|
+
render(): JSX.Element;
|
|
70
|
+
private readonly handleHover;
|
|
71
|
+
private readonly handleEdge2Drag;
|
|
72
|
+
private readonly handleEdge1Drag;
|
|
73
|
+
}
|
|
74
|
+
export declare function getNewXY(moreProps: any, snapTo: any): any[];
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { getCurrentItem } from "@tradingaction/core/lib/utils/ChartDataUtil";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { isHover, saveNodeType } from "../utils";
|
|
15
|
+
import { HoverTextNearMouse, ClickableCircle } from "../components";
|
|
16
|
+
import { edge1Provider, edge2Provider, LinearRegressionChannelWithArea, } from "../components/LinearRegressionChannelWithArea";
|
|
17
|
+
export class EachLinearRegressionChannel extends React.Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.handleHover = (_, moreProps) => {
|
|
21
|
+
if (this.state.hover !== moreProps.hovering) {
|
|
22
|
+
this.setState({
|
|
23
|
+
hover: moreProps.hovering,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.handleEdge2Drag = (e, moreProps) => {
|
|
28
|
+
const { index, onDrag, snapTo, x1Value } = this.props;
|
|
29
|
+
if (onDrag === undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const [x2Value] = getNewXY(moreProps, snapTo);
|
|
33
|
+
onDrag(e, index, {
|
|
34
|
+
x1Value,
|
|
35
|
+
x2Value,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
this.handleEdge1Drag = (e, moreProps) => {
|
|
39
|
+
const { index, onDrag, snapTo, x2Value } = this.props;
|
|
40
|
+
if (onDrag === undefined) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const [x1Value] = getNewXY(moreProps, snapTo);
|
|
44
|
+
onDrag(e, index, {
|
|
45
|
+
x1Value,
|
|
46
|
+
x2Value,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this.isHover = isHover.bind(this);
|
|
50
|
+
this.saveNodeType = saveNodeType.bind(this);
|
|
51
|
+
this.state = {
|
|
52
|
+
hover: false,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
const { x1Value, x2Value, appearance, edgeInteractiveCursor, hoverText, interactive, selected, onDragComplete, } = this.props;
|
|
57
|
+
const { stroke, strokeWidth, fill, r, edgeStrokeWidth, edgeFill, edgeStroke } = appearance;
|
|
58
|
+
const { hover } = this.state;
|
|
59
|
+
const hoverHandler = interactive ? { onHover: this.handleHover, onUnHover: this.handleHover } : {};
|
|
60
|
+
const { enable: hoverTextEnabled, selectedText: hoverTextSelected, text: hoverTextUnselected } = hoverText, restHoverTextProps = __rest(hoverText, ["enable", "selectedText", "text"]);
|
|
61
|
+
return (React.createElement("g", null,
|
|
62
|
+
React.createElement(LinearRegressionChannelWithArea, Object.assign({ ref: this.saveNodeType("area"), selected: selected || hover }, hoverHandler, { x1Value: x1Value, x2Value: x2Value, fillStyle: fill, strokeStyle: stroke, strokeWidth: hover || selected ? strokeWidth + 1 : strokeWidth })),
|
|
63
|
+
React.createElement(ClickableCircle, { ref: this.saveNodeType("edge1"), show: selected || hover, xyProvider: edge1Provider(this.props), r: r, fillStyle: edgeFill, strokeStyle: edgeStroke, strokeWidth: edgeStrokeWidth, interactiveCursorClass: edgeInteractiveCursor, onDrag: this.handleEdge1Drag, onDragComplete: onDragComplete }),
|
|
64
|
+
React.createElement(ClickableCircle, { ref: this.saveNodeType("edge2"), show: selected || hover, xyProvider: edge2Provider(this.props), r: r, fillStyle: edgeFill, strokeStyle: edgeStroke, strokeWidth: edgeStrokeWidth, interactiveCursorClass: edgeInteractiveCursor, onDrag: this.handleEdge2Drag, onDragComplete: onDragComplete }),
|
|
65
|
+
React.createElement(HoverTextNearMouse, Object.assign({ show: hoverTextEnabled && hover }, restHoverTextProps, { text: selected ? hoverTextSelected : hoverTextUnselected }))));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
EachLinearRegressionChannel.defaultProps = {
|
|
69
|
+
appearance: {
|
|
70
|
+
stroke: "#000000",
|
|
71
|
+
strokeWidth: 1,
|
|
72
|
+
fill: "rgba(138, 175, 226, 0.7)",
|
|
73
|
+
edgeStrokeWidth: 2,
|
|
74
|
+
edgeStroke: "#000000",
|
|
75
|
+
edgeFill: "#FFFFFF",
|
|
76
|
+
r: 5,
|
|
77
|
+
},
|
|
78
|
+
interactive: true,
|
|
79
|
+
selected: false,
|
|
80
|
+
hoverText: Object.assign(Object.assign({}, HoverTextNearMouse.defaultProps), { enable: true, bgHeight: 18, bgWidth: 175, text: "Click and drag the edge circles" }),
|
|
81
|
+
};
|
|
82
|
+
export function getNewXY(moreProps, snapTo) {
|
|
83
|
+
const { xScale, xAccessor, plotData, mouseXY } = moreProps;
|
|
84
|
+
const currentItem = getCurrentItem(xScale, xAccessor, mouseXY, plotData);
|
|
85
|
+
const x = xAccessor(currentItem);
|
|
86
|
+
const y = snapTo(currentItem);
|
|
87
|
+
return [x, y];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=EachLinearRegressionChannel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EachLinearRegressionChannel.js","sourceRoot":"","sources":["../../src/wrapper/EachLinearRegressionChannel.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EACH,aAAa,EACb,aAAa,EACb,+BAA+B,GAClC,MAAM,+CAA+C,CAAC;AAwCvD,MAAM,OAAO,2BAA4B,SAAQ,KAAK,CAAC,SAGtD;IA0BG,YAAmB,KAAuC;QACtD,KAAK,CAAC,KAAK,CAAC,CAAC;QA8EA,gBAAW,GAAG,CAAC,CAAmB,EAAE,SAAc,EAAE,EAAE;YACnE,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,QAAQ,EAAE;gBACzC,IAAI,CAAC,QAAQ,CAAC;oBACV,KAAK,EAAE,SAAS,CAAC,QAAQ;iBAC5B,CAAC,CAAC;aACN;QACL,CAAC,CAAC;QAEe,oBAAe,GAAG,CAAC,CAAmB,EAAE,SAAc,EAAE,EAAE;YACvE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACtD,IAAI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qBAAqB,EAC7C,MAAM,EAAE,IAAI,CAAC,eAAe,EAC5B,cAAc,EAAE,cAAc,GAChC;YACF,oBAAC,kBAAkB,kBACf,IAAI,EAAE,gBAAgB,IAAI,KAAK,IAC3B,kBAAkB,IACtB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,mBAAmB,IAC1D,CACF,CACP,CAAC;IACN,CAAC;;AAtGa,wCAAY,GAAG;IACzB,UAAU,EAAE;QACR,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,CAAC;QACd,IAAI,EAAE,0BAA0B;QAChC,eAAe,EAAE,CAAC;QAClB,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,SAAS;QACnB,CAAC,EAAE,CAAC;KACP;IACD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,SAAS,kCACF,kBAAkB,CAAC,YAAY,KAClC,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,iCAAiC,GAC1C;CACJ,CAAC;AA0HN,MAAM,UAAU,QAAQ,CAAC,SAAc,EAAE,MAAW;IAChD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IAE3D,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAE9B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface EachTextProps {
|
|
3
|
+
readonly index?: number;
|
|
4
|
+
readonly position?: any;
|
|
5
|
+
readonly bgFill: string;
|
|
6
|
+
readonly bgStrokeWidth: number;
|
|
7
|
+
readonly bgStroke?: string;
|
|
8
|
+
readonly textFill: string;
|
|
9
|
+
readonly fontWeight: string;
|
|
10
|
+
readonly fontFamily: string;
|
|
11
|
+
readonly fontStyle: string;
|
|
12
|
+
readonly fontSize: number;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly selected: boolean;
|
|
15
|
+
readonly onDrag?: (e: React.MouseEvent, index: number | undefined, xyValue: number[]) => void;
|
|
16
|
+
readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
|
|
17
|
+
readonly onDoubleClick?: (e: React.MouseEvent, moreProps: any, index?: number) => void;
|
|
18
|
+
readonly hoverText: {
|
|
19
|
+
readonly enable: boolean;
|
|
20
|
+
readonly fontFamily: string;
|
|
21
|
+
readonly fontSize: number;
|
|
22
|
+
readonly fill: string;
|
|
23
|
+
readonly text: string;
|
|
24
|
+
readonly selectedText: string;
|
|
25
|
+
readonly bgFill: string;
|
|
26
|
+
readonly bgOpacity: number;
|
|
27
|
+
readonly bgWidth: number | string;
|
|
28
|
+
readonly bgHeight: number | string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface EachTextState {
|
|
32
|
+
hover: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class EachText extends React.Component<EachTextProps, EachTextState> {
|
|
35
|
+
static defaultProps: {
|
|
36
|
+
bgStrokeWidth: number;
|
|
37
|
+
selected: boolean;
|
|
38
|
+
hoverText: {
|
|
39
|
+
enable: boolean;
|
|
40
|
+
bgHeight: string;
|
|
41
|
+
bgWidth: string;
|
|
42
|
+
text: string;
|
|
43
|
+
fontFamily: string;
|
|
44
|
+
fontSize: number;
|
|
45
|
+
fill: string;
|
|
46
|
+
bgFill: string;
|
|
47
|
+
bgOpacity: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
private dragStartPosition;
|
|
51
|
+
private isHover;
|
|
52
|
+
private saveNodeType;
|
|
53
|
+
constructor(props: EachTextProps);
|
|
54
|
+
render(): JSX.Element;
|
|
55
|
+
private readonly handleHover;
|
|
56
|
+
private readonly handleDrag;
|
|
57
|
+
private readonly handleDragStart;
|
|
58
|
+
}
|
|
59
|
+
export {};
|