@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.
Files changed (57) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +5 -5
  3. package/lib/CanvasContainer.d.ts +19 -19
  4. package/lib/CanvasContainer.js +27 -27
  5. package/lib/Chart.d.ts +32 -32
  6. package/lib/Chart.js +56 -56
  7. package/lib/Chart.js.map +1 -1
  8. package/lib/ChartCanvas.d.ts +235 -235
  9. package/lib/ChartCanvas.js +770 -770
  10. package/lib/ChartCanvas.js.map +1 -1
  11. package/lib/EventCapture.d.ts +131 -131
  12. package/lib/EventCapture.js +488 -488
  13. package/lib/GenericChartComponent.d.ts +21 -21
  14. package/lib/GenericChartComponent.js +74 -74
  15. package/lib/GenericComponent.d.ts +81 -81
  16. package/lib/GenericComponent.js +354 -354
  17. package/lib/GenericComponent.js.map +1 -1
  18. package/lib/MoreProps.d.ts +16 -16
  19. package/lib/MoreProps.js +1 -1
  20. package/lib/index.d.ts +7 -7
  21. package/lib/index.js +7 -7
  22. package/lib/useEvent.d.ts +1 -1
  23. package/lib/useEvent.js +12 -12
  24. package/lib/utils/ChartDataUtil.d.ts +49 -49
  25. package/lib/utils/ChartDataUtil.js +204 -204
  26. package/lib/utils/PureComponent.d.ts +4 -4
  27. package/lib/utils/PureComponent.js +9 -9
  28. package/lib/utils/accumulatingWindow.d.ts +15 -15
  29. package/lib/utils/accumulatingWindow.js +97 -97
  30. package/lib/utils/barWidth.d.ts +15 -15
  31. package/lib/utils/barWidth.js +26 -26
  32. package/lib/utils/closestItem.d.ts +5 -5
  33. package/lib/utils/closestItem.js +44 -44
  34. package/lib/utils/evaluator.d.ts +7 -7
  35. package/lib/utils/evaluator.js +93 -93
  36. package/lib/utils/identity.d.ts +1 -1
  37. package/lib/utils/identity.js +1 -1
  38. package/lib/utils/index.d.ts +46 -46
  39. package/lib/utils/index.js +125 -125
  40. package/lib/utils/noop.d.ts +1 -1
  41. package/lib/utils/noop.js +2 -2
  42. package/lib/utils/shallowEqual.d.ts +1 -1
  43. package/lib/utils/shallowEqual.js +21 -21
  44. package/lib/utils/slidingWindow.d.ts +19 -19
  45. package/lib/utils/slidingWindow.js +108 -108
  46. package/lib/utils/strokeDasharray.d.ts +3 -3
  47. package/lib/utils/strokeDasharray.js +36 -36
  48. package/lib/utils/zipper.d.ts +7 -7
  49. package/lib/utils/zipper.js +35 -35
  50. package/lib/zoom/index.d.ts +1 -1
  51. package/lib/zoom/index.js +1 -1
  52. package/lib/zoom/zoomBehavior.d.ts +10 -10
  53. package/lib/zoom/zoomBehavior.js +17 -17
  54. package/package.json +2 -2
  55. package/src/Chart.tsx +2 -2
  56. package/src/ChartCanvas.tsx +1 -1
  57. package/src/GenericComponent.tsx +1 -0
@@ -1,21 +1,21 @@
1
- /// <reference types="react" />
2
- import { GenericComponent } from "./GenericComponent";
3
- export declare class GenericChartComponent extends GenericComponent {
4
- static defaultProps: {
5
- svgDraw: any;
6
- draw: never[];
7
- canvasToDraw: (contexts: import("./CanvasContainer").ICanvasContexts) => CanvasRenderingContext2D | undefined;
8
- clip: boolean;
9
- edgeClip: boolean;
10
- selected: boolean;
11
- disablePan: boolean;
12
- enableDragOnHover: boolean;
13
- };
14
- static contextType: import("react").Context<import("./Chart").ChartContextType>;
15
- constructor(props: any, context: any);
16
- preCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
17
- postCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
18
- updateMoreProps(moreProps: any): void;
19
- preEvaluate(): void;
20
- shouldTypeProceed(type: string, moreProps: any): boolean;
21
- }
1
+ /// <reference types="react" />
2
+ import { GenericComponent } from "./GenericComponent";
3
+ export declare class GenericChartComponent extends GenericComponent {
4
+ static defaultProps: {
5
+ svgDraw: any;
6
+ draw: never[];
7
+ canvasToDraw: (contexts: import("./CanvasContainer").ICanvasContexts) => CanvasRenderingContext2D | undefined;
8
+ clip: boolean;
9
+ edgeClip: boolean;
10
+ selected: boolean;
11
+ disablePan: boolean;
12
+ enableDragOnHover: boolean;
13
+ };
14
+ static contextType: import("react").Context<import("./Chart").ChartContextType>;
15
+ constructor(props: any, context: any);
16
+ preCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
17
+ postCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
18
+ updateMoreProps(moreProps: any): void;
19
+ preEvaluate(): void;
20
+ shouldTypeProceed(type: string, moreProps: any): boolean;
21
+ }
@@ -1,75 +1,75 @@
1
- import { GenericComponent } from "./GenericComponent";
2
- import { isDefined } from "./utils";
3
- import { ChartContext } from "./Chart";
4
- const ALWAYS_TRUE_TYPES = ["drag", "dragend"];
5
- export class GenericChartComponent extends GenericComponent {
6
- constructor(props, context) {
7
- super(props, context);
8
- this.preCanvasDraw = this.preCanvasDraw.bind(this);
9
- this.postCanvasDraw = this.postCanvasDraw.bind(this);
10
- this.shouldTypeProceed = this.shouldTypeProceed.bind(this);
11
- this.preEvaluate = this.preEvaluate.bind(this);
12
- this.updateMoreProps = this.updateMoreProps.bind(this);
13
- }
14
- preCanvasDraw(ctx, moreProps) {
15
- super.preCanvasDraw(ctx, moreProps);
16
- ctx.save();
17
- const { margin, ratio } = this.context;
18
- const { chartConfig: { width, height, origin }, } = moreProps;
19
- const canvasOriginX = 0.5 * ratio + origin[0] + margin.left;
20
- const canvasOriginY = 0.5 * ratio + origin[1] + margin.top;
21
- const { clip, edgeClip } = this.props;
22
- ctx.setTransform(1, 0, 0, 1, 0, 0);
23
- ctx.scale(ratio, ratio);
24
- if (edgeClip) {
25
- ctx.beginPath();
26
- ctx.rect(-1, canvasOriginY - 10, width + margin.left + margin.right + 1, height + 20);
27
- ctx.clip();
28
- }
29
- ctx.translate(canvasOriginX, canvasOriginY);
30
- if (clip) {
31
- ctx.beginPath();
32
- ctx.rect(-1, -1, width + 1, height + 1);
33
- ctx.clip();
34
- }
35
- }
36
- postCanvasDraw(ctx, moreProps) {
37
- super.postCanvasDraw(ctx, moreProps);
38
- ctx.restore();
39
- }
40
- updateMoreProps(moreProps) {
41
- super.updateMoreProps(moreProps);
42
- const { chartConfig: chartConfigList } = moreProps;
43
- if (chartConfigList && Array.isArray(chartConfigList)) {
44
- const { chartId } = this.context;
45
- const chartConfig = chartConfigList.find((each) => each.id === chartId);
46
- this.moreProps.chartConfig = chartConfig;
47
- }
48
- if (isDefined(this.moreProps.chartConfig)) {
49
- const { origin: [ox, oy], } = this.moreProps.chartConfig;
50
- if (isDefined(moreProps.mouseXY)) {
51
- const { mouseXY: [x, y], } = moreProps;
52
- this.moreProps.mouseXY = [x - ox, y - oy];
53
- }
54
- if (isDefined(moreProps.startPos)) {
55
- const { startPos: [x, y], } = moreProps;
56
- this.moreProps.startPos = [x - ox, y - oy];
57
- }
58
- }
59
- }
60
- preEvaluate( /* type, moreProps */) {
61
- ///
62
- }
63
- shouldTypeProceed(type, moreProps) {
64
- if ((type === "mousemove" || type === "click") && this.props.disablePan) {
65
- return true;
66
- }
67
- if (ALWAYS_TRUE_TYPES.indexOf(type) === -1 && isDefined(moreProps) && isDefined(moreProps.currentCharts)) {
68
- return moreProps.currentCharts.indexOf(this.context.chartId) > -1;
69
- }
70
- return true;
71
- }
72
- }
73
- GenericChartComponent.defaultProps = GenericComponent.defaultProps;
74
- GenericChartComponent.contextType = ChartContext;
1
+ import { GenericComponent } from "./GenericComponent";
2
+ import { isDefined } from "./utils";
3
+ import { ChartContext } from "./Chart";
4
+ const ALWAYS_TRUE_TYPES = ["drag", "dragend"];
5
+ export class GenericChartComponent extends GenericComponent {
6
+ constructor(props, context) {
7
+ super(props, context);
8
+ this.preCanvasDraw = this.preCanvasDraw.bind(this);
9
+ this.postCanvasDraw = this.postCanvasDraw.bind(this);
10
+ this.shouldTypeProceed = this.shouldTypeProceed.bind(this);
11
+ this.preEvaluate = this.preEvaluate.bind(this);
12
+ this.updateMoreProps = this.updateMoreProps.bind(this);
13
+ }
14
+ preCanvasDraw(ctx, moreProps) {
15
+ super.preCanvasDraw(ctx, moreProps);
16
+ ctx.save();
17
+ const { margin, ratio } = this.context;
18
+ const { chartConfig: { width, height, origin }, } = moreProps;
19
+ const canvasOriginX = 0.5 * ratio + origin[0] + margin.left;
20
+ const canvasOriginY = 0.5 * ratio + origin[1] + margin.top;
21
+ const { clip, edgeClip } = this.props;
22
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
23
+ ctx.scale(ratio, ratio);
24
+ if (edgeClip) {
25
+ ctx.beginPath();
26
+ ctx.rect(-1, canvasOriginY - 10, width + margin.left + margin.right + 1, height + 20);
27
+ ctx.clip();
28
+ }
29
+ ctx.translate(canvasOriginX, canvasOriginY);
30
+ if (clip) {
31
+ ctx.beginPath();
32
+ ctx.rect(-1, -1, width + 1, height + 1);
33
+ ctx.clip();
34
+ }
35
+ }
36
+ postCanvasDraw(ctx, moreProps) {
37
+ super.postCanvasDraw(ctx, moreProps);
38
+ ctx.restore();
39
+ }
40
+ updateMoreProps(moreProps) {
41
+ super.updateMoreProps(moreProps);
42
+ const { chartConfig: chartConfigList } = moreProps;
43
+ if (chartConfigList && Array.isArray(chartConfigList)) {
44
+ const { chartId } = this.context;
45
+ const chartConfig = chartConfigList.find((each) => each.id === chartId);
46
+ this.moreProps.chartConfig = chartConfig;
47
+ }
48
+ if (isDefined(this.moreProps.chartConfig)) {
49
+ const { origin: [ox, oy], } = this.moreProps.chartConfig;
50
+ if (isDefined(moreProps.mouseXY)) {
51
+ const { mouseXY: [x, y], } = moreProps;
52
+ this.moreProps.mouseXY = [x - ox, y - oy];
53
+ }
54
+ if (isDefined(moreProps.startPos)) {
55
+ const { startPos: [x, y], } = moreProps;
56
+ this.moreProps.startPos = [x - ox, y - oy];
57
+ }
58
+ }
59
+ }
60
+ preEvaluate( /* type, moreProps */) {
61
+ ///
62
+ }
63
+ shouldTypeProceed(type, moreProps) {
64
+ if ((type === "mousemove" || type === "click") && this.props.disablePan) {
65
+ return true;
66
+ }
67
+ if (ALWAYS_TRUE_TYPES.indexOf(type) === -1 && isDefined(moreProps) && isDefined(moreProps.currentCharts)) {
68
+ return moreProps.currentCharts.indexOf(this.context.chartId) > -1;
69
+ }
70
+ return true;
71
+ }
72
+ }
73
+ GenericChartComponent.defaultProps = GenericComponent.defaultProps;
74
+ GenericChartComponent.contextType = ChartContext;
75
75
  //# sourceMappingURL=GenericChartComponent.js.map
@@ -1,81 +1,81 @@
1
- import * as React from "react";
2
- import { ICanvasContexts } from "./CanvasContainer";
3
- import { ChartCanvasContext } from "./ChartCanvas";
4
- interface GenericComponentProps {
5
- readonly svgDraw?: (moreProps: any) => React.ReactNode;
6
- readonly canvasDraw?: (ctx: CanvasRenderingContext2D, moreProps: any) => void;
7
- readonly canvasToDraw?: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
8
- readonly clip?: boolean;
9
- readonly disablePan?: boolean;
10
- readonly drawOn: string[];
11
- readonly edgeClip?: boolean;
12
- readonly enableDragOnHover?: boolean;
13
- readonly interactiveCursorClass?: string;
14
- readonly isHover?: (moreProps: any, e: React.MouseEvent) => boolean;
15
- readonly onClick?: (e: React.MouseEvent, moreProps: any) => void;
16
- readonly onClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
17
- readonly onClickOutside?: (e: React.MouseEvent, moreProps: any) => void;
18
- readonly onPan?: (e: React.MouseEvent, moreProps: any) => void;
19
- readonly onPanEnd?: (e: React.MouseEvent, moreProps: any) => void;
20
- readonly onDragStart?: (e: React.MouseEvent, moreProps: any) => void;
21
- readonly onDrag?: (e: React.MouseEvent, moreProps: any) => void;
22
- readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
23
- readonly onDoubleClick?: (e: React.MouseEvent, moreProps: any) => void;
24
- readonly onDoubleClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
25
- readonly onContextMenu?: (e: React.MouseEvent, moreProps: any) => void;
26
- readonly onContextMenuWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
27
- readonly onMouseMove?: (e: React.MouseEvent, moreProps: any) => void;
28
- readonly onMouseDown?: (e: React.MouseEvent, moreProps: any) => void;
29
- readonly onHover?: (e: React.MouseEvent, moreProps: any) => void;
30
- readonly onUnHover?: (e: React.MouseEvent, moreProps: any) => void;
31
- readonly selected?: boolean;
32
- }
33
- interface GenericComponentState {
34
- updateCount: number;
35
- }
36
- export declare class GenericComponent extends React.Component<GenericComponentProps, GenericComponentState> {
37
- static defaultProps: {
38
- svgDraw: any;
39
- draw: never[];
40
- canvasToDraw: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
41
- clip: boolean;
42
- edgeClip: boolean;
43
- selected: boolean;
44
- disablePan: boolean;
45
- enableDragOnHover: boolean;
46
- };
47
- context: React.ContextType<typeof ChartCanvasContext>;
48
- moreProps: any;
49
- private dragInProgress;
50
- private evaluationInProgress;
51
- private iSetTheCursorClass;
52
- private readonly subscriberId;
53
- constructor(props: GenericComponentProps, context: any);
54
- updateMoreProps(moreProps: any): void;
55
- shouldTypeProceed(type: string, moreProps: any): boolean;
56
- preEvaluate(type: string, moreProps: any, e: any): void;
57
- listener: (type: string, moreProps: any, state: any, e: any) => void;
58
- evaluateType(type: string, e: any): void;
59
- isHover(e: React.MouseEvent): boolean;
60
- getPanConditions(): {
61
- draggable: any;
62
- panEnabled: boolean;
63
- };
64
- draw({ trigger, force }: {
65
- force: boolean;
66
- trigger: string;
67
- }): void;
68
- UNSAFE_componentWillMount(): void;
69
- componentWillUnmount(): void;
70
- componentDidMount(): void;
71
- componentDidUpdate(prevProps: GenericComponentProps): void;
72
- UNSAFE_componentWillReceiveProps(nextProps: GenericComponentProps, nextContext: any): void;
73
- getMoreProps(): any;
74
- preCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
75
- postCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
76
- drawOnCanvas(): void;
77
- render(): JSX.Element | null;
78
- }
79
- export declare const getAxisCanvas: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
80
- export declare const getMouseCanvas: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
81
- export {};
1
+ import * as React from "react";
2
+ import { ICanvasContexts } from "./CanvasContainer";
3
+ import { ChartCanvasContext } from "./ChartCanvas";
4
+ interface GenericComponentProps {
5
+ readonly svgDraw?: (moreProps: any) => React.ReactNode;
6
+ readonly canvasDraw?: (ctx: CanvasRenderingContext2D, moreProps: any) => void;
7
+ readonly canvasToDraw?: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
8
+ readonly clip?: boolean;
9
+ readonly disablePan?: boolean;
10
+ readonly drawOn: string[];
11
+ readonly edgeClip?: boolean;
12
+ readonly enableDragOnHover?: boolean;
13
+ readonly interactiveCursorClass?: string;
14
+ readonly isHover?: (moreProps: any, e: React.MouseEvent) => boolean;
15
+ readonly onClick?: (e: React.MouseEvent, moreProps: any) => void;
16
+ readonly onClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
17
+ readonly onClickOutside?: (e: React.MouseEvent, moreProps: any) => void;
18
+ readonly onPan?: (e: React.MouseEvent, moreProps: any) => void;
19
+ readonly onPanEnd?: (e: React.MouseEvent, moreProps: any) => void;
20
+ readonly onDragStart?: (e: React.MouseEvent, moreProps: any) => void;
21
+ readonly onDrag?: (e: React.MouseEvent, moreProps: any) => void;
22
+ readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void;
23
+ readonly onDoubleClick?: (e: React.MouseEvent, moreProps: any) => void;
24
+ readonly onDoubleClickWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
25
+ readonly onContextMenu?: (e: React.MouseEvent, moreProps: any) => void;
26
+ readonly onContextMenuWhenHover?: (e: React.MouseEvent, moreProps: any) => void;
27
+ readonly onMouseMove?: (e: React.MouseEvent, moreProps: any) => void;
28
+ readonly onMouseDown?: (e: React.MouseEvent, moreProps: any) => void;
29
+ readonly onHover?: (e: React.MouseEvent, moreProps: any) => void;
30
+ readonly onUnHover?: (e: React.MouseEvent, moreProps: any) => void;
31
+ readonly selected?: boolean;
32
+ }
33
+ interface GenericComponentState {
34
+ updateCount: number;
35
+ }
36
+ export declare class GenericComponent extends React.Component<GenericComponentProps, GenericComponentState> {
37
+ static defaultProps: {
38
+ svgDraw: any;
39
+ draw: never[];
40
+ canvasToDraw: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
41
+ clip: boolean;
42
+ edgeClip: boolean;
43
+ selected: boolean;
44
+ disablePan: boolean;
45
+ enableDragOnHover: boolean;
46
+ };
47
+ context: React.ContextType<typeof ChartCanvasContext>;
48
+ moreProps: any;
49
+ private dragInProgress;
50
+ private evaluationInProgress;
51
+ private iSetTheCursorClass;
52
+ private readonly subscriberId;
53
+ constructor(props: GenericComponentProps, context: any);
54
+ updateMoreProps(moreProps: any): void;
55
+ shouldTypeProceed(type: string, moreProps: any): boolean;
56
+ preEvaluate(type: string, moreProps: any, e: any): void;
57
+ listener: (type: string, moreProps: any, state: any, e: any) => void;
58
+ evaluateType(type: string, e: any): void;
59
+ isHover(e: React.MouseEvent): boolean;
60
+ getPanConditions(): {
61
+ draggable: any;
62
+ panEnabled: boolean;
63
+ };
64
+ draw({ trigger, force }: {
65
+ force: boolean;
66
+ trigger: string;
67
+ }): void;
68
+ UNSAFE_componentWillMount(): void;
69
+ componentWillUnmount(): void;
70
+ componentDidMount(): void;
71
+ componentDidUpdate(prevProps: GenericComponentProps): void;
72
+ UNSAFE_componentWillReceiveProps(nextProps: GenericComponentProps, nextContext: any): void;
73
+ getMoreProps(): any;
74
+ preCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
75
+ postCanvasDraw(ctx: CanvasRenderingContext2D, moreProps: any): void;
76
+ drawOnCanvas(): void;
77
+ render(): JSX.Element | null;
78
+ }
79
+ export declare const getAxisCanvas: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
80
+ export declare const getMouseCanvas: (contexts: ICanvasContexts) => CanvasRenderingContext2D | undefined;
81
+ export {};