@thoughtspot/ts-chart-sdk 0.0.1-alpha.7 → 0.0.1-alpha.9

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 (86) hide show
  1. package/cjs/main/custom-chart-context.d.ts +10 -3
  2. package/cjs/main/custom-chart-context.d.ts.map +1 -1
  3. package/cjs/main/custom-chart-context.js +110 -3
  4. package/cjs/main/custom-chart-context.js.map +1 -1
  5. package/cjs/main/custom-chart-context.spec.js +251 -8
  6. package/cjs/main/custom-chart-context.spec.js.map +1 -1
  7. package/cjs/react/custom-chart-context-service.d.ts +16 -5
  8. package/cjs/react/custom-chart-context-service.d.ts.map +1 -1
  9. package/cjs/react/custom-chart-context-service.js +35 -34
  10. package/cjs/react/custom-chart-context-service.js.map +1 -1
  11. package/cjs/react/custom-chart.spec.js +53 -282
  12. package/cjs/react/custom-chart.spec.js.map +1 -1
  13. package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +1 -1
  14. package/cjs/react/mocks/custom-chart-context-mock.js +30 -32
  15. package/cjs/react/mocks/custom-chart-context-mock.js.map +1 -1
  16. package/cjs/types/chart-to-ts-event.types.d.ts +28 -1
  17. package/cjs/types/chart-to-ts-event.types.d.ts.map +1 -1
  18. package/cjs/types/chart-to-ts-event.types.js +9 -1
  19. package/cjs/types/chart-to-ts-event.types.js.map +1 -1
  20. package/cjs/types/common.types.d.ts +1 -0
  21. package/cjs/types/common.types.d.ts.map +1 -1
  22. package/cjs/types/ts-to-chart-event.types.d.ts +23 -1
  23. package/cjs/types/ts-to-chart-event.types.d.ts.map +1 -1
  24. package/cjs/types/ts-to-chart-event.types.js +2 -0
  25. package/cjs/types/ts-to-chart-event.types.js.map +1 -1
  26. package/cjs/types/visual-prop.types.d.ts +23 -9
  27. package/cjs/types/visual-prop.types.d.ts.map +1 -1
  28. package/dist/ts-chart-sdk.d.ts +312 -0
  29. package/lib/dist/ts-chart-sdk.d.ts +312 -0
  30. package/lib/main/custom-chart-context.d.ts +10 -3
  31. package/lib/main/custom-chart-context.d.ts.map +1 -1
  32. package/lib/main/custom-chart-context.js +111 -3
  33. package/lib/main/custom-chart-context.js.map +1 -1
  34. package/lib/main/custom-chart-context.spec.js +248 -8
  35. package/lib/main/custom-chart-context.spec.js.map +1 -1
  36. package/lib/react/custom-chart-context-service.d.ts +16 -5
  37. package/lib/react/custom-chart-context-service.d.ts.map +1 -1
  38. package/lib/react/custom-chart-context-service.js +35 -34
  39. package/lib/react/custom-chart-context-service.js.map +1 -1
  40. package/lib/react/custom-chart.spec.js +54 -260
  41. package/lib/react/custom-chart.spec.js.map +1 -1
  42. package/lib/react/mocks/custom-chart-context-mock.d.ts.map +1 -1
  43. package/lib/react/mocks/custom-chart-context-mock.js +30 -32
  44. package/lib/react/mocks/custom-chart-context-mock.js.map +1 -1
  45. package/lib/types/chart-to-ts-event.types.d.ts +28 -1
  46. package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
  47. package/lib/types/chart-to-ts-event.types.js +8 -0
  48. package/lib/types/chart-to-ts-event.types.js.map +1 -1
  49. package/lib/types/common.types.d.ts +1 -0
  50. package/lib/types/common.types.d.ts.map +1 -1
  51. package/lib/types/ts-to-chart-event.types.d.ts +23 -1
  52. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  53. package/lib/types/ts-to-chart-event.types.js +2 -0
  54. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  55. package/lib/types/visual-prop.types.d.ts +23 -9
  56. package/lib/types/visual-prop.types.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/src/main/custom-chart-context.spec.ts +310 -0
  59. package/src/main/custom-chart-context.ts +227 -1
  60. package/src/types/chart-to-ts-event.types.ts +125 -6
  61. package/src/types/common.types.ts +14 -0
  62. package/src/types/ts-to-chart-event.types.ts +70 -0
  63. package/cjs/react/custom-chart-context-hook.d.ts +0 -22
  64. package/cjs/react/custom-chart-context-hook.d.ts.map +0 -1
  65. package/cjs/react/custom-chart-context-hook.js +0 -116
  66. package/cjs/react/custom-chart-context-hook.js.map +0 -1
  67. package/cjs/react/custom-chart-context-hook.spec.d.ts +0 -2
  68. package/cjs/react/custom-chart-context-hook.spec.d.ts.map +0 -1
  69. package/cjs/react/custom-chart-context-hook.spec.js +0 -343
  70. package/cjs/react/custom-chart-context-hook.spec.js.map +0 -1
  71. package/cjs/react/mocks/custom-chart-context-hook.d.ts +0 -3
  72. package/cjs/react/mocks/custom-chart-context-hook.d.ts.map +0 -1
  73. package/cjs/react/mocks/custom-chart-context-hook.js +0 -100
  74. package/cjs/react/mocks/custom-chart-context-hook.js.map +0 -1
  75. package/lib/react/custom-chart-context-hook.d.ts +0 -22
  76. package/lib/react/custom-chart-context-hook.d.ts.map +0 -1
  77. package/lib/react/custom-chart-context-hook.js +0 -86
  78. package/lib/react/custom-chart-context-hook.js.map +0 -1
  79. package/lib/react/custom-chart-context-hook.spec.d.ts +0 -2
  80. package/lib/react/custom-chart-context-hook.spec.d.ts.map +0 -1
  81. package/lib/react/custom-chart-context-hook.spec.js +0 -315
  82. package/lib/react/custom-chart-context-hook.spec.js.map +0 -1
  83. package/lib/react/mocks/custom-chart-context-hook.d.ts +0 -3
  84. package/lib/react/mocks/custom-chart-context-hook.d.ts.map +0 -1
  85. package/lib/react/mocks/custom-chart-context-hook.js +0 -94
  86. package/lib/react/mocks/custom-chart-context-hook.js.map +0 -1
@@ -1,5 +1,9 @@
1
1
  import { VisualProps } from './common.types';
2
- import { Query } from './ts-to-chart-event.types';
2
+ import {
3
+ CustomAxisMenuAction,
4
+ CustomContextMenuAction,
5
+ Query,
6
+ } from './ts-to-chart-event.types';
3
7
 
4
8
  /**
5
9
  *
@@ -42,13 +46,9 @@ export enum ChartToTSEvent {
42
46
  GetDataForQuery = 'GetDataForQuery',
43
47
 
44
48
  /**
45
- * Show Tooltip events
49
+ * Tooltip events
46
50
  */
47
51
  ShowToolTip = 'ShowToolTip',
48
-
49
- /**
50
- * Hide Tooltip events
51
- */
52
52
  HideToolTip = 'HideToolTip',
53
53
  }
54
54
 
@@ -126,6 +126,18 @@ export interface ChartToTSEventsPayloadMap {
126
126
  * @version SDK: 0.0.1-alpha.4 | ThoughtSpot:
127
127
  */
128
128
  [ChartToTSEvent.HideToolTip]: [];
129
+ /**
130
+ * Trigger to open Axis Menu
131
+ *
132
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
133
+ */
134
+ [ChartToTSEvent.OpenAxisMenu]: [OpenAxisMenuEventPayload];
135
+ /**
136
+ * Trigger to close Axis Menu
137
+ *
138
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
139
+ */
140
+ [ChartToTSEvent.CloseAxisMenu]: [];
129
141
  }
130
142
 
131
143
  /**
@@ -240,3 +252,110 @@ export interface GetDataForQueryEventPayload {
240
252
  export enum ErrorType {
241
253
  MultipleContextsNotSupported = 'MultipleContextsNotSupported',
242
254
  }
255
+
256
+ /**
257
+ * List of supported actions for the menu items in the axis menu
258
+ * @group Chart to ThoughtSpot Events
259
+ */
260
+ export enum AxisMenuActions {
261
+ /**
262
+ * Change the aggregation of the column from the possible options.
263
+ * Only supported for numeric columns.
264
+ */
265
+ AGGREGATE = 'AGGREGATE',
266
+ /**
267
+ * Change the bucketing of the date or date time column from the possible options.
268
+ * Only supported for date or date time columns.
269
+ * */
270
+ TIME_BUCKET = 'TIME_BUCKET',
271
+ /**
272
+ * Add or update the filter for the column.
273
+ * */
274
+ FILTER = 'FILTER',
275
+ /**
276
+ * Sort the column in ascending or descending order.
277
+ * */
278
+ SORT = 'SORT',
279
+
280
+ /**
281
+ * These 2 methods are disabled currently as they are not supported by the backend.
282
+ * Following are the reasons for the same:
283
+ * 1. Remove is ambiguous as it can mean remove from the answer scope or remove from the chart.
284
+ * 2. Rename columns is not supported by the menu for now. If need be, this can be implemented.
285
+ */
286
+ // /**
287
+ // * Rename the column.
288
+ // * */
289
+ // RENAME = 'RENAME',
290
+ // /**
291
+ // * Remove the column from the answer scope.
292
+ // * */
293
+ // REMOVE = 'REMOVE',
294
+ /**
295
+ * Defines a separator element between the actions.
296
+ * Can be added multiple times.
297
+ * */
298
+ SEPARATOR = 'SEPARATOR',
299
+ }
300
+
301
+ export interface AxisMenuCustomAction {
302
+ /**
303
+ * ID of the custom action.
304
+ * */
305
+ id: string;
306
+ /**
307
+ * Label of the custom action.
308
+ * */
309
+ label: string;
310
+ /**
311
+ * Icon of the custom action.
312
+ * */
313
+ icon?: string;
314
+ /**
315
+ * Callback function that will be triggered when the custom action is clicked.
316
+ * */
317
+ onClick: (...args: any[]) => void;
318
+ }
319
+
320
+ export interface OpenAxisMenuEventPayload {
321
+ /**
322
+ * The pointer event that triggered the event to position the axis menu.
323
+ */
324
+ event: Pick<PointerEvent, 'clientX' | 'clientY'>;
325
+ /**
326
+ * The column IDs of the columns that can be modified via the axis menu.
327
+ * This maps to the columns in chart model.
328
+ * The order of the column IDs is the same as the order of the columns in the axis menu.
329
+ * Atleast one column id is required.
330
+ * */
331
+ columnIds: string[];
332
+ /**
333
+ * The list of actions that are supported for the axis menu for each column.
334
+ * The order of the actions is the same as the order of the columns in the axis menu.
335
+ * If empty, all the supported actions in default order will be available.
336
+ * */
337
+ selectedActions?: AxisMenuActions[];
338
+ /**
339
+ * Custom action defined by the developer of the chart.
340
+ * This action will trigger the callback defined in the custom action payload.
341
+ * can be added multiple times.
342
+ * @hidden
343
+ * */
344
+ customActions?: AxisMenuCustomAction[];
345
+ }
346
+
347
+ /**
348
+ *
349
+ * @group Custom action callback mapping with action id/ Context Menu
350
+ */
351
+ export interface ContextMenuActionHandler {
352
+ [key: string]: (args: CustomContextMenuAction) => void;
353
+ }
354
+
355
+ /**
356
+ *
357
+ * @group Custom action callback mapping with action id/ Axis Menu
358
+ */
359
+ export interface AxisMenuActionHandler {
360
+ [key: string]: (args: CustomAxisMenuAction) => void;
361
+ }
@@ -160,6 +160,9 @@ export type VisualProps = JSON;
160
160
  type CustomStylingConfig = any;
161
161
 
162
162
  export interface AppConfig {
163
+ /**
164
+ * @hidden
165
+ */
163
166
  styleConfig?: CustomStylingConfig;
164
167
 
165
168
  appOptions?: {
@@ -177,8 +180,19 @@ export interface AppConfig {
177
180
  sessionTimezone: string;
178
181
  };
179
182
 
183
+ /**
184
+ * App url for the custom chart application where the chart app is hosted.
185
+ * This helps the chart developer to access app artifacts relative to this url.
186
+ * There can be different build systems that developers may have used and different ways
187
+ * to host the same. This helps in resolving the same.
188
+ */
189
+ appUrl?: string;
190
+
180
191
  // Idea: we might be able to map this to data and ask user to read data in a
181
192
  // certain way the transformations for point during context menu operations
182
193
  // need to be explored
194
+ /**
195
+ * @hidden
196
+ */
183
197
  customCalendarConfig?: any; // this is to initialize custom calendar service
184
198
  }
@@ -1,4 +1,5 @@
1
1
  import { ChartColumn } from './answer-column.types';
2
+ import { Point } from './chart-to-ts-event.types';
2
3
  import {
3
4
  AppConfig,
4
5
  ChartConfig,
@@ -57,6 +58,16 @@ export enum TSToChartEvent {
57
58
  * @version SDK: 0.1 | ThoughtSpot:
58
59
  */
59
60
  VisualPropsUpdate = 'VisualPropsUpdate',
61
+ /**
62
+ * @version SDK: 0.1 | ThoughtSpot:
63
+ */
64
+
65
+ ContextMenuActionClick = 'ContextMenuActionClick',
66
+
67
+ /**
68
+ * @version SDK: 0.1 | ThoughtSpot:
69
+ */
70
+ AxisMenuActionClick = 'AxisMenuActionClick',
60
71
  }
61
72
 
62
73
  /**
@@ -104,6 +115,14 @@ export interface TSToChartInternalEventsPayloadMap {
104
115
  ) => ValidationResponse;
105
116
 
106
117
  [TSToChartEvent.TriggerRenderChart]: () => void;
118
+
119
+ [TSToChartEvent.ContextMenuActionClick]: (
120
+ payload: ContextMenuCustomActionPayload,
121
+ ) => void;
122
+
123
+ [TSToChartEvent.AxisMenuActionClick]: (
124
+ payload: AxisMenuCustomActionPayload,
125
+ ) => void;
107
126
  }
108
127
 
109
128
  /**
@@ -261,3 +280,54 @@ export interface ChartConfigValidateEventPayload {
261
280
  */
262
281
  chartConfig: ChartConfig[];
263
282
  }
283
+
284
+ /**
285
+ * Custom action dispatched by context menu of the chart
286
+ *
287
+ * @group ThoughtSpot to Chart Events
288
+ * @version SDK: 0.1 | ThoughtSpot:
289
+ */
290
+ export interface CustomContextMenuAction {
291
+ id: string;
292
+ clickedPoint: Point;
293
+ selectedPoints?: Point[];
294
+ event: Pick<PointerEvent, 'clientX' | 'clientY'>;
295
+ }
296
+
297
+ /**
298
+ *
299
+ * @group ThoughtSpot to Chart Events
300
+ */
301
+ export interface ContextMenuCustomActionPayload {
302
+ /**
303
+ * Dispatched custom action from context menu
304
+ *
305
+ * @version SDK: 0.1 | ThoughtSpot:
306
+ */
307
+ customAction: CustomContextMenuAction;
308
+ }
309
+
310
+ /**
311
+ * Custom action dispatched by axis menu of the chart
312
+ *
313
+ * @group ThoughtSpot to Chart Events
314
+ * @version SDK: 0.1 | ThoughtSpot:
315
+ */
316
+ export interface CustomAxisMenuAction {
317
+ id: string;
318
+ columnIds: string[];
319
+ event: Pick<PointerEvent, 'clientX' | 'clientY'>;
320
+ }
321
+
322
+ /**
323
+ *
324
+ * @group ThoughtSpot to Chart Events
325
+ */
326
+ export interface AxisMenuCustomActionPayload {
327
+ /**
328
+ * Dispatched custom action from context menu
329
+ *
330
+ * @version SDK: 0.1 | ThoughtSpot:
331
+ */
332
+ customAction: CustomAxisMenuAction;
333
+ }
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { CustomChartContextProps } from '../main/custom-chart-context';
3
- import { ChartToTSEventsPayloadMap } from '../types/chart-to-ts-event.types';
4
- import { ChartModel } from '../types/common.types';
5
- import { TSToChartEventsPayloadMap } from '../types/ts-to-chart-event.types';
6
- export type ChartToTSEventEmitters = {
7
- [key in keyof ChartToTSEventsPayloadMap as `emit${Capitalize<key>}`]: (args: ChartToTSEventsPayloadMap[key]) => Promise<void>;
8
- };
9
- export type TSToChartEventListener = {
10
- [key in keyof TSToChartEventsPayloadMap as `on${Capitalize<key>}`]: (args: TSToChartEventsPayloadMap[key]) => Promise<void>;
11
- };
12
- interface WrapperComponentProps {
13
- children: React.ReactNode;
14
- }
15
- interface ChartContextProps extends ChartToTSEventEmitters, TSToChartEventListener {
16
- hasInitialized: boolean;
17
- chartModel: ChartModel | undefined;
18
- WrapperComponent: ({ children, }: WrapperComponentProps) => React.JSX.Element;
19
- }
20
- export declare const useChartContext: (props: Omit<CustomChartContextProps, 'renderChart'>) => ChartContextProps;
21
- export {};
22
- //# sourceMappingURL=custom-chart-context-hook.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context-hook.d.ts","sourceRoot":"","sources":["../../src/react/custom-chart-context-hook.tsx"],"names":[],"mappings":"AASA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAEH,uBAAuB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEH,yBAAyB,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAIH,yBAAyB,EAE5B,MAAM,kCAAkC,CAAC;AAO1C,MAAM,MAAM,sBAAsB,GAAG;KAChC,GAAG,IAAI,MAAM,yBAAyB,IAAI,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,CAClE,IAAI,EAAE,yBAAyB,CAAC,GAAG,CAAC,KACnC,OAAO,CAAC,IAAI,CAAC;CACrB,CAAC;AAOF,MAAM,MAAM,sBAAsB,GAAG;KAChC,GAAG,IAAI,MAAM,yBAAyB,IAAI,KAAK,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,CAChE,IAAI,EAAE,yBAAyB,CAAC,GAAG,CAAC,KACnC,OAAO,CAAC,IAAI,CAAC;CACrB,CAAC;AAEF,UAAU,qBAAqB;IAK3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,UAAU,iBACN,SAAQ,sBAAsB,EAC1B,sBAAsB;IAI1B,cAAc,EAAE,OAAO,CAAC;IAKxB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IAOnC,gBAAgB,EAAE,CAAC,EACf,QAAQ,GACX,EAAE,qBAAqB,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;CAClD;AA2DD,eAAO,MAAM,eAAe,UACjB,KAAK,uBAAuB,EAAE,aAAa,CAAC,KACpD,iBAkHF,CAAC"}
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.useChartContext = void 0;
30
- const lodash_1 = __importDefault(require("lodash"));
31
- const react_1 = __importStar(require("react"));
32
- const custom_chart_context_1 = require("../main/custom-chart-context");
33
- const chart_to_ts_event_types_1 = require("../types/chart-to-ts-event.types");
34
- const ts_to_chart_event_types_1 = require("../types/ts-to-chart-event.types");
35
- const emitter = (ctx) => {
36
- const validEvents = Object.keys(chart_to_ts_event_types_1.ChartToTSEvent);
37
- return validEvents.reduce((acc, eventKey) => {
38
- const eventName = eventKey;
39
- const emitterKey = `emit${eventKey}`;
40
- acc[emitterKey] = (args) => {
41
- if (!ctx || lodash_1.default.isEmpty(ctx)) {
42
- return Promise.resolve();
43
- }
44
- return ctx.emitEvent(eventName, ...args);
45
- };
46
- return acc;
47
- }, {});
48
- };
49
- const eventListener = (ctx) => {
50
- const validEvents = Object.keys(ts_to_chart_event_types_1.TSToChartEvent);
51
- return validEvents.reduce((acc, eventKey) => {
52
- const eventName = eventKey;
53
- const emitterKey = `on${eventKey}`;
54
- acc[emitterKey] = (callbackFn) => {
55
- ctx.on(eventName, callbackFn);
56
- return Promise.resolve();
57
- };
58
- return acc;
59
- }, {});
60
- };
61
- const useChartContext = (props) => {
62
- const [hasInitialized, setHasInitialized] = (0, react_1.useState)(false);
63
- const [key, setKey] = (0, react_1.useState)(0);
64
- const [ctx, setContextState] = (0, react_1.useState)({});
65
- const [chartModel, setChartModel] = (0, react_1.useState)();
66
- const initializeProvider = async (context) => {
67
- return context
68
- .initialize()
69
- .then(() => {
70
- setHasInitialized(true);
71
- setContextState(context);
72
- setChartModel(context.getChartModel());
73
- return true;
74
- })
75
- .catch((e) => {
76
- console.log('Error in context initialization', e);
77
- });
78
- };
79
- const getChartContextValues = (0, react_1.useCallback)((ctx) => {
80
- return {
81
- hasInitialized,
82
- chartModel,
83
- ...emitter(ctx),
84
- ...eventListener(ctx),
85
- WrapperComponent: ({ children }) => {
86
- return (react_1.default.createElement(react_1.default.Fragment, { key: key }, children));
87
- },
88
- };
89
- }, [chartModel, key, hasInitialized]);
90
- const renderChart = (0, react_1.useCallback)((ctx) => {
91
- setKey((prevKey) => prevKey + 1);
92
- return Promise.resolve();
93
- }, [key]);
94
- const setupEventListeners = (0, react_1.useCallback)((context) => {
95
- const commonUpdateHandler = (payload) => {
96
- setChartModel(context.getChartModel());
97
- return {
98
- triggerRenderChart: true,
99
- };
100
- };
101
- getChartContextValues(context).onChartModelUpdate(commonUpdateHandler);
102
- getChartContextValues(context).onVisualPropsUpdate(commonUpdateHandler);
103
- getChartContextValues(context).onDataUpdate(commonUpdateHandler);
104
- }, []);
105
- (0, react_1.useEffect)(() => {
106
- const context = new custom_chart_context_1.CustomChartContext({
107
- ...props,
108
- renderChart,
109
- });
110
- initializeProvider(context);
111
- setupEventListeners(context);
112
- }, []);
113
- return getChartContextValues(ctx);
114
- };
115
- exports.useChartContext = useChartContext;
116
- //# sourceMappingURL=custom-chart-context-hook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context-hook.js","sourceRoot":"","sources":["../../src/react/custom-chart-context-hook.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,oDAAuB;AACvB,+CAAgE;AAChE,uEAGsC;AACtC,8EAG0C;AAE1C,8EAM0C;AA4D1C,MAAM,OAAO,GAAG,CAAC,GAAuB,EAA0B,EAAE;IAChE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAC3B,wCAAc,CACsB,CAAC;IACzC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QACxC,MAAM,SAAS,GAAG,QAA2C,CAAC;QAC9D,MAAM,UAAU,GAAG,OAAO,QAAQ,EAAkC,CAAC;QAErE,GAAG,CAAC,UAAU,CAAC,GAAG,CACd,IAAgE,EACnD,EAAE;YACf,IAAI,CAAC,GAAG,IAAI,gBAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACxB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;aAC5B;YACD,OAAO,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7C,CAAC,CAAC;QAEF,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAA4B,CAAC,CAAC;AACrC,CAAC,CAAC;AAOF,MAAM,aAAa,GAAG,CAAC,GAAuB,EAA0B,EAAE;IACtE,MAAM,WAAW,GAAG,MAAM,CAAC,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iBAAS,EAAC,GAAG,EAAE;QAGX,MAAM,OAAO,GAAG,IAAI,yCAAkB,CAAC;YACnC,GAAG,KAAK;YACR,WAAW;SACd,CAAC,CAAC;QAEH,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE5B,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC,CAAC;AApHW,QAAA,eAAe,mBAoH1B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=custom-chart-context-hook.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context-hook.spec.d.ts","sourceRoot":"","sources":["../../src/react/custom-chart-context-hook.spec.tsx"],"names":[],"mappings":""}