@thoughtspot/ts-chart-sdk 1.1.1 → 1.2.1
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/dist/ts-chart-sdk.d.ts +142 -1
- package/lib/main/custom-chart-context.d.ts +2 -1
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +8 -0
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +100 -0
- package/lib/main/custom-chart-context.spec.js.map +1 -1
- package/lib/react/use-custom-chart-context.d.ts.map +1 -1
- package/lib/react/use-custom-chart-context.js +9 -0
- package/lib/react/use-custom-chart-context.js.map +1 -1
- package/lib/react/use-custom-chart-context.spec.js +49 -0
- package/lib/react/use-custom-chart-context.spec.js.map +1 -1
- package/lib/types/actions.types.d.ts +123 -0
- package/lib/types/actions.types.d.ts.map +1 -0
- package/lib/types/actions.types.js +124 -0
- package/lib/types/actions.types.js.map +1 -0
- package/lib/types/common.types.d.ts +7 -0
- package/lib/types/common.types.d.ts.map +1 -1
- package/lib/types/common.types.js.map +1 -1
- package/lib/types/ts-to-chart-event.types.d.ts +13 -2
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.js +1 -0
- package/lib/types/ts-to-chart-event.types.js.map +1 -1
- package/package.json +2 -2
- package/src/main/custom-chart-context.spec.ts +136 -0
- package/src/main/custom-chart-context.ts +26 -0
- package/src/react/use-custom-chart-context.spec.tsx +68 -0
- package/src/react/use-custom-chart-context.tsx +15 -1
- package/src/types/actions.types.ts +1015 -0
- package/src/types/common.types.ts +36 -0
- package/src/types/ts-to-chart-event.types.ts +27 -0
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Copyright: ThoughtSpot Inc. 2023
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { Action } from './actions.types';
|
|
9
10
|
import { ChartColumn } from './answer-column.types';
|
|
10
11
|
import type { ChartConfigEditorDefinition } from './configurator.types';
|
|
11
12
|
import type { VisualPropEditorDefinition } from './visual-prop.types';
|
|
@@ -358,3 +359,38 @@ export interface AppConfig {
|
|
|
358
359
|
*/
|
|
359
360
|
chartAppAccessToken?: string;
|
|
360
361
|
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @description Configuration interface for controlling the visibility and behavior of actions in a custom chart.
|
|
365
|
+
* This interface allows control over which actions are disabled, hidden, or visible
|
|
366
|
+
* in the Answer Actions(3dot menu)/ context menu actions.
|
|
367
|
+
*
|
|
368
|
+
* @export
|
|
369
|
+
* @interface VisualConfig
|
|
370
|
+
*/
|
|
371
|
+
export interface VisualConfig {
|
|
372
|
+
/**
|
|
373
|
+
* Array of actions that should be disabled (grayed out) in the custom chart.
|
|
374
|
+
* These actions will be visible but not interactive.
|
|
375
|
+
*/
|
|
376
|
+
customChartDisabledActions?: Action[];
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Tooltip message for why certain actions are disabled.
|
|
380
|
+
*
|
|
381
|
+
*/
|
|
382
|
+
customChartDisabledActionReason?: string;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Array of actions that should be completely hidden from the custom chart's UI.
|
|
386
|
+
* These actions will not be visible to users. Define either this or visibleActions.
|
|
387
|
+
*/
|
|
388
|
+
customChartHiddenActions?: Action[];
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Array of actions that should be explicitly visible in the custom chart.
|
|
392
|
+
* Use this to specify which actions should be shown in the UI. Define either this or Hidden
|
|
393
|
+
* Actions
|
|
394
|
+
*/
|
|
395
|
+
customChartVisibleActions?: Action[];
|
|
396
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
DataPointsArray,
|
|
13
13
|
QueryData,
|
|
14
14
|
ValidationResponse,
|
|
15
|
+
VisualConfig,
|
|
15
16
|
VisualProps,
|
|
16
17
|
} from './common.types';
|
|
17
18
|
import type { ChartConfigEditorDefinition } from './configurator.types';
|
|
@@ -78,6 +79,19 @@ export enum TSToChartEvent {
|
|
|
78
79
|
* @version SDK: 0.2 | ThoughtSpot:
|
|
79
80
|
*/
|
|
80
81
|
GetColumnData = 'GetColumnData',
|
|
82
|
+
/**
|
|
83
|
+
* @version SDK: 1.2.1 | ThoughtSpot:
|
|
84
|
+
*/
|
|
85
|
+
DownloadExcelTrigger = 'DownloadExcelTrigger',
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface DownloadExcelTriggerPayload {
|
|
89
|
+
answerTitle: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DownloadExcelTriggerResponse {
|
|
92
|
+
fileName: string;
|
|
93
|
+
error: string;
|
|
94
|
+
message: string;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
/**
|
|
@@ -94,6 +108,9 @@ export interface TSToChartEventsPayloadMap {
|
|
|
94
108
|
[TSToChartEvent.VisualPropsUpdate]: (
|
|
95
109
|
payload: VisualPropsUpdateEventPayload,
|
|
96
110
|
) => void;
|
|
111
|
+
[TSToChartEvent.DownloadExcelTrigger]: (
|
|
112
|
+
payload: DownloadExcelTriggerPayload,
|
|
113
|
+
) => DownloadExcelTriggerResponse;
|
|
97
114
|
}
|
|
98
115
|
|
|
99
116
|
/**
|
|
@@ -234,6 +251,16 @@ export interface InitializeEventResponsePayload {
|
|
|
234
251
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
235
252
|
*/
|
|
236
253
|
chartConfigParameters?: ChartConfigParameters;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @description
|
|
257
|
+
* Optional parameter to control certain visual elements on the chart For example visibleAction
|
|
258
|
+
* array if Passed will only show those actions in context menu/Action menu of the chart on
|
|
259
|
+
* answer page. To be passed to TS via this payload
|
|
260
|
+
* @type {VisualConfig}
|
|
261
|
+
* @memberof InitializeEventResponsePayload
|
|
262
|
+
*/
|
|
263
|
+
customChartVisualConfig?: VisualConfig;
|
|
237
264
|
}
|
|
238
265
|
|
|
239
266
|
/**
|