@tradingaction/core 2.0.12 → 2.0.15
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 -24
- package/README.md +5 -5
- package/lib/CanvasContainer.d.ts +19 -19
- package/lib/CanvasContainer.js +27 -27
- package/lib/Chart.d.ts +32 -32
- package/lib/Chart.js +56 -56
- package/lib/Chart.js.map +1 -1
- package/lib/ChartCanvas.d.ts +235 -235
- package/lib/ChartCanvas.js +770 -770
- package/lib/ChartCanvas.js.map +1 -1
- package/lib/EventCapture.d.ts +131 -131
- package/lib/EventCapture.js +488 -488
- package/lib/GenericChartComponent.d.ts +21 -21
- package/lib/GenericChartComponent.js +74 -74
- package/lib/GenericComponent.d.ts +81 -81
- package/lib/GenericComponent.js +354 -354
- package/lib/GenericComponent.js.map +1 -1
- package/lib/MoreProps.d.ts +16 -16
- package/lib/MoreProps.js +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -7
- package/lib/useEvent.d.ts +1 -1
- package/lib/useEvent.js +12 -12
- package/lib/utils/ChartDataUtil.d.ts +49 -49
- package/lib/utils/ChartDataUtil.js +204 -204
- package/lib/utils/PureComponent.d.ts +4 -4
- package/lib/utils/PureComponent.js +9 -9
- package/lib/utils/accumulatingWindow.d.ts +15 -15
- package/lib/utils/accumulatingWindow.js +97 -97
- package/lib/utils/barWidth.d.ts +15 -15
- package/lib/utils/barWidth.js +26 -26
- package/lib/utils/closestItem.d.ts +5 -5
- package/lib/utils/closestItem.js +44 -44
- package/lib/utils/evaluator.d.ts +7 -7
- package/lib/utils/evaluator.js +93 -93
- package/lib/utils/identity.d.ts +1 -1
- package/lib/utils/identity.js +1 -1
- package/lib/utils/index.d.ts +46 -46
- package/lib/utils/index.js +125 -125
- package/lib/utils/noop.d.ts +1 -1
- package/lib/utils/noop.js +2 -2
- package/lib/utils/shallowEqual.d.ts +1 -1
- package/lib/utils/shallowEqual.js +21 -21
- package/lib/utils/slidingWindow.d.ts +19 -19
- package/lib/utils/slidingWindow.js +108 -108
- package/lib/utils/strokeDasharray.d.ts +3 -3
- package/lib/utils/strokeDasharray.js +36 -36
- package/lib/utils/zipper.d.ts +7 -7
- package/lib/utils/zipper.js +35 -35
- package/lib/zoom/index.d.ts +1 -1
- package/lib/zoom/index.js +1 -1
- package/lib/zoom/zoomBehavior.d.ts +10 -10
- package/lib/zoom/zoomBehavior.js +17 -17
- package/package.json +2 -2
- package/src/Chart.tsx +2 -2
- package/src/ChartCanvas.tsx +1 -1
- package/src/GenericComponent.tsx +1 -0
package/lib/utils/zipper.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/* an extension to d3.zip so we call a function instead of an array */
|
|
2
|
-
import { min } from "d3-array";
|
|
3
|
-
import { identity } from "./identity";
|
|
4
|
-
export default function zipper() {
|
|
5
|
-
let combine = identity;
|
|
6
|
-
function zip() {
|
|
7
|
-
var _a;
|
|
8
|
-
const n = arguments.length;
|
|
9
|
-
if (n === 0) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const m = (_a = min(arguments, d3_zipLength)) !== null && _a !== void 0 ? _a : 0;
|
|
13
|
-
const zips = new Array(m);
|
|
14
|
-
for (let i = -1; ++i < m;) {
|
|
15
|
-
// tslint:disable-next-line: no-shadowed-variable
|
|
16
|
-
for (let j = -1, zip = (zips[i] = new Array(n)); ++j < n;) {
|
|
17
|
-
zip[j] = arguments[j][i];
|
|
18
|
-
}
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
zips[i] = combine.apply(this, zips[i]);
|
|
21
|
-
}
|
|
22
|
-
return zips;
|
|
23
|
-
}
|
|
24
|
-
function d3_zipLength(d) {
|
|
25
|
-
return d.length;
|
|
26
|
-
}
|
|
27
|
-
zip.combine = function (x) {
|
|
28
|
-
if (!arguments.length) {
|
|
29
|
-
return combine;
|
|
30
|
-
}
|
|
31
|
-
combine = x;
|
|
32
|
-
return zip;
|
|
33
|
-
};
|
|
34
|
-
return zip;
|
|
35
|
-
}
|
|
1
|
+
/* an extension to d3.zip so we call a function instead of an array */
|
|
2
|
+
import { min } from "d3-array";
|
|
3
|
+
import { identity } from "./identity";
|
|
4
|
+
export default function zipper() {
|
|
5
|
+
let combine = identity;
|
|
6
|
+
function zip() {
|
|
7
|
+
var _a;
|
|
8
|
+
const n = arguments.length;
|
|
9
|
+
if (n === 0) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const m = (_a = min(arguments, d3_zipLength)) !== null && _a !== void 0 ? _a : 0;
|
|
13
|
+
const zips = new Array(m);
|
|
14
|
+
for (let i = -1; ++i < m;) {
|
|
15
|
+
// tslint:disable-next-line: no-shadowed-variable
|
|
16
|
+
for (let j = -1, zip = (zips[i] = new Array(n)); ++j < n;) {
|
|
17
|
+
zip[j] = arguments[j][i];
|
|
18
|
+
}
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
zips[i] = combine.apply(this, zips[i]);
|
|
21
|
+
}
|
|
22
|
+
return zips;
|
|
23
|
+
}
|
|
24
|
+
function d3_zipLength(d) {
|
|
25
|
+
return d.length;
|
|
26
|
+
}
|
|
27
|
+
zip.combine = function (x) {
|
|
28
|
+
if (!arguments.length) {
|
|
29
|
+
return combine;
|
|
30
|
+
}
|
|
31
|
+
combine = x;
|
|
32
|
+
return zip;
|
|
33
|
+
};
|
|
34
|
+
return zip;
|
|
35
|
+
}
|
|
36
36
|
//# sourceMappingURL=zipper.js.map
|
package/lib/zoom/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./zoomBehavior";
|
|
1
|
+
export * from "./zoomBehavior";
|
package/lib/zoom/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./zoomBehavior";
|
|
1
|
+
export * from "./zoomBehavior";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ScaleContinuousNumeric, ScaleTime } from "d3-scale";
|
|
2
|
-
export interface IZoomAnchorOptions<TData, TXAxis extends number | Date> {
|
|
3
|
-
readonly plotData: TData[];
|
|
4
|
-
readonly mouseXY: number[];
|
|
5
|
-
readonly xAccessor: (data: TData) => TXAxis;
|
|
6
|
-
readonly xScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number>;
|
|
7
|
-
}
|
|
8
|
-
export declare const mouseBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
|
|
9
|
-
export declare const lastVisibleItemBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
|
|
10
|
-
export declare const rightDomainBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => number | Date;
|
|
1
|
+
import { ScaleContinuousNumeric, ScaleTime } from "d3-scale";
|
|
2
|
+
export interface IZoomAnchorOptions<TData, TXAxis extends number | Date> {
|
|
3
|
+
readonly plotData: TData[];
|
|
4
|
+
readonly mouseXY: number[];
|
|
5
|
+
readonly xAccessor: (data: TData) => TXAxis;
|
|
6
|
+
readonly xScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number>;
|
|
7
|
+
}
|
|
8
|
+
export declare const mouseBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
|
|
9
|
+
export declare const lastVisibleItemBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
|
|
10
|
+
export declare const rightDomainBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => number | Date;
|
package/lib/zoom/zoomBehavior.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getCurrentItem } from "../utils/ChartDataUtil";
|
|
2
|
-
import { last } from "../utils/index";
|
|
3
|
-
export const mouseBasedZoomAnchor = (options) => {
|
|
4
|
-
const { xScale, xAccessor, mouseXY, plotData } = options;
|
|
5
|
-
const currentItem = getCurrentItem(xScale, xAccessor, mouseXY, plotData);
|
|
6
|
-
return xAccessor(currentItem);
|
|
7
|
-
};
|
|
8
|
-
export const lastVisibleItemBasedZoomAnchor = (options) => {
|
|
9
|
-
const { xAccessor, plotData } = options;
|
|
10
|
-
const lastItem = last(plotData);
|
|
11
|
-
return xAccessor(lastItem);
|
|
12
|
-
};
|
|
13
|
-
export const rightDomainBasedZoomAnchor = (options) => {
|
|
14
|
-
const { xScale } = options;
|
|
15
|
-
const [, end] = xScale.domain();
|
|
16
|
-
return end;
|
|
17
|
-
};
|
|
1
|
+
import { getCurrentItem } from "../utils/ChartDataUtil";
|
|
2
|
+
import { last } from "../utils/index";
|
|
3
|
+
export const mouseBasedZoomAnchor = (options) => {
|
|
4
|
+
const { xScale, xAccessor, mouseXY, plotData } = options;
|
|
5
|
+
const currentItem = getCurrentItem(xScale, xAccessor, mouseXY, plotData);
|
|
6
|
+
return xAccessor(currentItem);
|
|
7
|
+
};
|
|
8
|
+
export const lastVisibleItemBasedZoomAnchor = (options) => {
|
|
9
|
+
const { xAccessor, plotData } = options;
|
|
10
|
+
const lastItem = last(plotData);
|
|
11
|
+
return xAccessor(lastItem);
|
|
12
|
+
};
|
|
13
|
+
export const rightDomainBasedZoomAnchor = (options) => {
|
|
14
|
+
const { xScale } = options;
|
|
15
|
+
const [, end] = xScale.domain();
|
|
16
|
+
return end;
|
|
17
|
+
};
|
|
18
18
|
//# sourceMappingURL=zoomBehavior.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradingaction/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Core code for react-financial-charts",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
49
49
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e12c129340de3cfc35167df7f195a8b316c879a6"
|
|
52
52
|
}
|
package/src/Chart.tsx
CHANGED
|
@@ -59,7 +59,7 @@ export const Chart = React.memo((props: React.PropsWithChildren<ChartProps>) =>
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const { currentCharts } = moreProps;
|
|
62
|
-
if (currentCharts
|
|
62
|
+
if (currentCharts?.indexOf(id) > -1) {
|
|
63
63
|
onContextMenu(e, moreProps);
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -71,7 +71,7 @@ export const Chart = React.memo((props: React.PropsWithChildren<ChartProps>) =>
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const { currentCharts } = moreProps;
|
|
74
|
-
if (currentCharts
|
|
74
|
+
if (currentCharts?.indexOf(id) > -1) {
|
|
75
75
|
onDoubleClick(e, moreProps);
|
|
76
76
|
}
|
|
77
77
|
|
package/src/ChartCanvas.tsx
CHANGED
|
@@ -427,7 +427,7 @@ export class ChartCanvas<TXAxis extends number | Date> extends React.Component<
|
|
|
427
427
|
> {
|
|
428
428
|
public static defaultProps = {
|
|
429
429
|
clamp: false,
|
|
430
|
-
className: "react-financial-charts",
|
|
430
|
+
className: "ta-react-financial-charts",
|
|
431
431
|
defaultFocus: true,
|
|
432
432
|
disablePan: false,
|
|
433
433
|
disableInteraction: false,
|
package/src/GenericComponent.tsx
CHANGED
|
@@ -46,6 +46,7 @@ interface GenericComponentProps {
|
|
|
46
46
|
readonly onHover?: (e: React.MouseEvent, moreProps: any) => void;
|
|
47
47
|
readonly onUnHover?: (e: React.MouseEvent, moreProps: any) => void;
|
|
48
48
|
readonly selected?: boolean;
|
|
49
|
+
// readonly key?: string;//debug
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
interface GenericComponentState {
|