@thoughtspot/ts-chart-sdk 0.0.2-alpha.2 → 0.0.2-alpha.20
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/README.md +126 -50
- package/dist/ts-chart-sdk.d.ts +820 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/main/custom-chart-context.d.ts +22 -7
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +59 -4
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +402 -5
- package/lib/main/custom-chart-context.spec.js.map +1 -1
- package/lib/main/post-message-event-bridge.js +2 -2
- package/lib/main/post-message-event-bridge.js.map +1 -1
- package/lib/main/util.spec.d.ts +2 -0
- package/lib/main/util.spec.d.ts.map +1 -0
- package/lib/main/util.spec.js +31 -0
- package/lib/main/util.spec.js.map +1 -0
- package/lib/react/use-custom-chart-context.spec.js +54 -3
- package/lib/react/use-custom-chart-context.spec.js.map +1 -1
- package/lib/test/test-conditional-formatting-utils.d.ts +5 -0
- package/lib/test/test-conditional-formatting-utils.d.ts.map +1 -0
- package/lib/test/test-conditional-formatting-utils.js +43 -0
- package/lib/test/test-conditional-formatting-utils.js.map +1 -0
- package/lib/types/answer-column.types.d.ts +57 -1
- package/lib/types/answer-column.types.d.ts.map +1 -1
- package/lib/types/answer-column.types.js +47 -0
- package/lib/types/answer-column.types.js.map +1 -1
- package/lib/types/chart-to-ts-event.types.d.ts +2 -0
- package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
- package/lib/types/chart-to-ts-event.types.js +1 -0
- package/lib/types/chart-to-ts-event.types.js.map +1 -1
- package/lib/types/common.types.d.ts +67 -4
- package/lib/types/common.types.d.ts.map +1 -1
- package/lib/types/common.types.js +15 -1
- package/lib/types/common.types.js.map +1 -1
- package/lib/types/conditional-formatting.types.d.ts +140 -0
- package/lib/types/conditional-formatting.types.d.ts.map +1 -0
- package/lib/types/conditional-formatting.types.js +60 -0
- package/lib/types/conditional-formatting.types.js.map +1 -0
- package/lib/types/configurator.types.d.ts +5 -0
- package/lib/types/configurator.types.d.ts.map +1 -1
- package/lib/types/number-formatting.types.d.ts +55 -0
- package/lib/types/number-formatting.types.d.ts.map +1 -0
- package/lib/types/number-formatting.types.js +23 -0
- package/lib/types/number-formatting.types.js.map +1 -0
- package/lib/types/ts-to-chart-event.types.d.ts +10 -5
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.js.map +1 -1
- package/lib/types/visual-prop.types.d.ts +21 -0
- package/lib/types/visual-prop.types.d.ts.map +1 -1
- package/lib/utils/conditional-formatting/conditional-formatting.d.ts +10 -0
- package/lib/utils/conditional-formatting/conditional-formatting.d.ts.map +1 -0
- package/lib/utils/conditional-formatting/conditional-formatting.js +103 -0
- package/lib/utils/conditional-formatting/conditional-formatting.js.map +1 -0
- package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts +2 -0
- package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts.map +1 -0
- package/lib/utils/conditional-formatting/conditional-formatting.spec.js +142 -0
- package/lib/utils/conditional-formatting/conditional-formatting.spec.js.map +1 -0
- package/lib/utils/date-formatting.d.ts +19 -0
- package/lib/utils/date-formatting.d.ts.map +1 -0
- package/lib/utils/date-formatting.js +56 -0
- package/lib/utils/date-formatting.js.map +1 -0
- package/lib/utils/date-formatting.spec.d.ts +2 -0
- package/lib/utils/date-formatting.spec.d.ts.map +1 -0
- package/lib/utils/date-formatting.spec.js +124 -0
- package/lib/utils/date-formatting.spec.js.map +1 -0
- package/package.json +6 -4
- package/src/index.ts +4 -0
- package/src/main/custom-chart-context.spec.ts +474 -9
- package/src/main/custom-chart-context.ts +246 -12
- package/src/main/post-message-event-bridge.ts +1 -1
- package/src/main/util.spec.ts +41 -0
- package/src/react/use-custom-chart-context.spec.tsx +65 -3
- package/src/test/test-conditional-formatting-utils.ts +95 -0
- package/src/types/answer-column.types.ts +102 -1
- package/src/types/chart-to-ts-event.types.ts +7 -0
- package/src/types/common.types.ts +103 -9
- package/src/types/conditional-formatting.types.ts +157 -0
- package/src/types/configurator.types.ts +21 -0
- package/src/types/number-formatting.types.ts +80 -0
- package/src/types/ts-to-chart-event.types.ts +38 -6
- package/src/types/visual-prop.types.ts +75 -1
- package/src/utils/conditional-formatting/conditional-formatting.spec.ts +469 -0
- package/src/utils/conditional-formatting/conditional-formatting.ts +229 -0
- package/src/utils/date-formatting.spec.ts +168 -0
- package/src/utils/date-formatting.ts +109 -0
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import type { Maybe } from './common.types';
|
|
2
|
+
import { ConditionalFormatting } from './conditional-formatting.types';
|
|
3
|
+
import { FormatConfig } from './number-formatting.types';
|
|
4
|
+
|
|
1
5
|
export enum ColumnType {
|
|
2
6
|
UNKNOWN,
|
|
3
7
|
MEASURE,
|
|
4
8
|
ATTRIBUTE,
|
|
9
|
+
// Virtual columns that are measure name/value columns
|
|
10
|
+
VIRTUAL,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* When the column is generated for the chart for creating views,
|
|
15
|
+
* on top of measure columns from the worksheet which are part of answer query.
|
|
16
|
+
*/
|
|
17
|
+
export enum ChartSpecificColumnType {
|
|
18
|
+
UNKNOWN,
|
|
19
|
+
MEASURE_NAMES,
|
|
20
|
+
MEASURE_VALUES,
|
|
5
21
|
}
|
|
6
22
|
|
|
7
23
|
/**
|
|
@@ -71,6 +87,51 @@ export enum CurrencyFormatType {
|
|
|
71
87
|
ISO_CODE,
|
|
72
88
|
}
|
|
73
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Type of aggregations applied on the column data
|
|
92
|
+
*
|
|
93
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
94
|
+
*/
|
|
95
|
+
export enum ColumnAggregationType {
|
|
96
|
+
AGGREGATE,
|
|
97
|
+
AGGREGATE_DISTINCT,
|
|
98
|
+
APPROX_AGGR_DISTINCT,
|
|
99
|
+
APPROX_AGGR_DISTINCT_MERGE,
|
|
100
|
+
APPROX_COUNT_DISTINCT,
|
|
101
|
+
AVERAGE,
|
|
102
|
+
COUNT,
|
|
103
|
+
COUNT_DISTINCT,
|
|
104
|
+
CUMULATIVE_AVERAGE,
|
|
105
|
+
CUMULATIVE_COUNT,
|
|
106
|
+
CUMULATIVE_MAX,
|
|
107
|
+
CUMULATIVE_MIN,
|
|
108
|
+
CUMULATIVE_SUM,
|
|
109
|
+
GROWTH,
|
|
110
|
+
MAX,
|
|
111
|
+
MEDIAN,
|
|
112
|
+
MIN,
|
|
113
|
+
MOVING_AVERAGE,
|
|
114
|
+
MOVING_COUNT,
|
|
115
|
+
MOVING_MAX,
|
|
116
|
+
MOVING_MIN,
|
|
117
|
+
MOVING_SUM,
|
|
118
|
+
NONE,
|
|
119
|
+
PERCENTILE,
|
|
120
|
+
RANK,
|
|
121
|
+
RANK_PERCENTILE,
|
|
122
|
+
SQL_BOOL_AGGREGATE_OP,
|
|
123
|
+
SQL_DATE_AGGREGATE_OP,
|
|
124
|
+
SQL_DATE_TIME_AGGREGATE_OP,
|
|
125
|
+
SQL_DOUBLE_AGGREGATE_OP,
|
|
126
|
+
SQL_INT_AGGREGATE_OP,
|
|
127
|
+
SQL_STRING_AGGREGATE_OP,
|
|
128
|
+
SQL_TIME_AGGREGATE_OP,
|
|
129
|
+
STD_DEVIATION,
|
|
130
|
+
SUM,
|
|
131
|
+
TABLE_AGGR,
|
|
132
|
+
VARIANCE,
|
|
133
|
+
}
|
|
134
|
+
|
|
74
135
|
/**
|
|
75
136
|
* Currency format for the column defined in the worksheet
|
|
76
137
|
*
|
|
@@ -124,7 +185,7 @@ export interface ChartColumn {
|
|
|
124
185
|
*/
|
|
125
186
|
id: string;
|
|
126
187
|
/**
|
|
127
|
-
* Column name
|
|
188
|
+
* Column name property
|
|
128
189
|
*
|
|
129
190
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
130
191
|
*/
|
|
@@ -171,4 +232,44 @@ export interface ChartColumn {
|
|
|
171
232
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
172
233
|
*/
|
|
173
234
|
format?: ColumnFormat;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Column Properties of the columns
|
|
238
|
+
*
|
|
239
|
+
* @version SDK: 0.0.2-alpha.15 | ThoughtSpot:
|
|
240
|
+
*/
|
|
241
|
+
columnProperties?: {
|
|
242
|
+
conditionalFormatting?: Maybe<ConditionalFormatting>;
|
|
243
|
+
numberFormatting?: Maybe<FormatConfig>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Aggregation applied on the column data
|
|
248
|
+
*
|
|
249
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
250
|
+
*/
|
|
251
|
+
aggregationType?: ColumnAggregationType;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Custom sort order defined for the column to sort charts in a specific order
|
|
255
|
+
* Defined in worksheet
|
|
256
|
+
*
|
|
257
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
258
|
+
*/
|
|
259
|
+
customOrder?: Array<string>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Guid of Custom calender for the column if defined in worksheet else null
|
|
263
|
+
*
|
|
264
|
+
* @version SDK: 0.1 | ThoughtSpot: sdcwdc
|
|
265
|
+
*/
|
|
266
|
+
calenderGuid?: string;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Type of arbitrary column, can be measure names or measure values
|
|
270
|
+
* also, unknown if regular column
|
|
271
|
+
*
|
|
272
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
273
|
+
*/
|
|
274
|
+
chartSpecificColumnType: ChartSpecificColumnType;
|
|
174
275
|
}
|
|
@@ -25,6 +25,7 @@ export enum ChartToTSEvent {
|
|
|
25
25
|
/**
|
|
26
26
|
* Render life cycle events
|
|
27
27
|
*/
|
|
28
|
+
InitStart = 'InitStart',
|
|
28
29
|
RenderStart = 'RenderStart',
|
|
29
30
|
RenderError = 'RenderError',
|
|
30
31
|
RenderComplete = 'RenderComplete',
|
|
@@ -72,6 +73,12 @@ export interface ChartToTSEventsPayloadMap {
|
|
|
72
73
|
*/
|
|
73
74
|
[ChartToTSEvent.CloseContextMenu]: [];
|
|
74
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Trigger to notify the Initialization start
|
|
78
|
+
*
|
|
79
|
+
* @version SDK: 0.2 | ThoughtSpot:
|
|
80
|
+
*/
|
|
81
|
+
[ChartToTSEvent.InitStart]: [];
|
|
75
82
|
/**
|
|
76
83
|
* Trigger to notify the render start
|
|
77
84
|
*
|
|
@@ -7,6 +7,48 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ChartColumn } from './answer-column.types';
|
|
10
|
+
import type { ChartConfigEditorDefinition } from './configurator.types';
|
|
11
|
+
import type { VisualPropEditorDefinition } from './visual-prop.types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Defines types of features for which font can be customised with Custom style config used in TS.
|
|
15
|
+
* @remarks
|
|
16
|
+
* Use chartFeatureToFontGuid to get the guid for the feature and get the font face from guid
|
|
17
|
+
* from customFontFaces
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type Maybe<T> = T | null;
|
|
21
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
22
|
+
|
|
23
|
+
export type Scalars = {
|
|
24
|
+
ID: string;
|
|
25
|
+
String: string;
|
|
26
|
+
Boolean: boolean;
|
|
27
|
+
Int: number;
|
|
28
|
+
Float: number;
|
|
29
|
+
FileUpload: unknown;
|
|
30
|
+
GUID: string;
|
|
31
|
+
JSON: {
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
JSONObject: unknown;
|
|
35
|
+
Long: unknown;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export enum CustomizableChartFeature {
|
|
39
|
+
X_AXIS_LABEL,
|
|
40
|
+
X_AXIS_TITLE,
|
|
41
|
+
Y_AXIS_LABEL,
|
|
42
|
+
Y_AXIS_TITLE,
|
|
43
|
+
TOOLTIP,
|
|
44
|
+
SCATTER_CHART,
|
|
45
|
+
PIE_CHART,
|
|
46
|
+
LINE_CHART,
|
|
47
|
+
COLUMN_CHART,
|
|
48
|
+
BAR_CHART,
|
|
49
|
+
AREA_CHART,
|
|
50
|
+
TAIL_FEATURE,
|
|
51
|
+
}
|
|
10
52
|
|
|
11
53
|
/**
|
|
12
54
|
* List of Columns for a dimension in the Custom Chart Config.
|
|
@@ -140,6 +182,12 @@ export interface ChartModel {
|
|
|
140
182
|
};
|
|
141
183
|
}
|
|
142
184
|
|
|
185
|
+
// Validation Response for valid config or visual props
|
|
186
|
+
export type SuccessValidationResponse = {
|
|
187
|
+
chartConfigEditorDefinition: ChartConfigEditorDefinition[];
|
|
188
|
+
visualPropEditorDefinition: VisualPropEditorDefinition;
|
|
189
|
+
};
|
|
190
|
+
|
|
143
191
|
// Generic Validation Response
|
|
144
192
|
export type ValidationResponse = {
|
|
145
193
|
isValid: boolean;
|
|
@@ -149,21 +197,61 @@ export type ValidationResponse = {
|
|
|
149
197
|
/**
|
|
150
198
|
* Custom Visual props is the stored metadata for the visual props definition
|
|
151
199
|
* configured by the user in the visual prop editor
|
|
152
|
-
* The
|
|
153
|
-
*
|
|
200
|
+
* The object is defined by the visual prop types. See VisualPropEditorDefinition.
|
|
201
|
+
* If there is any local state specific to charts needs to be maintained on save answer, store it
|
|
202
|
+
* in VisualProps, with visualProps.clientState variable. The clientState variable should be a
|
|
203
|
+
* string, preferrably a result of JSON.stringify(<yourlocalClientState>).
|
|
204
|
+
* @remark
|
|
205
|
+
* only values stored in clientSate variable will be preserved on changing the
|
|
206
|
+
* visualPropeditorDefinition, any other variable store would not be preserved
|
|
154
207
|
* @group Chart Model
|
|
155
208
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
156
209
|
*/
|
|
157
|
-
export type VisualProps =
|
|
210
|
+
export type VisualProps = unknown;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Font Faces type from TS.
|
|
214
|
+
* guid will be null in case of default Font types
|
|
215
|
+
* If a custom Font is added in Dev section on TS this guid can be used to Match
|
|
216
|
+
* the Font Face That needs to be applied to @link CustomizableChartFeature
|
|
217
|
+
*/
|
|
158
218
|
|
|
159
|
-
|
|
160
|
-
|
|
219
|
+
export type TSFontFace = {
|
|
220
|
+
guid: string | null;
|
|
221
|
+
family?: string;
|
|
222
|
+
format?: string;
|
|
223
|
+
url?: string;
|
|
224
|
+
weight?: string;
|
|
225
|
+
style?: string;
|
|
226
|
+
size?: string;
|
|
227
|
+
unicodeRange?: string;
|
|
228
|
+
variant?: string;
|
|
229
|
+
stretch?: string;
|
|
230
|
+
color?: string;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Used for Custom color pallete and Custom font for charts defined in Style customisations
|
|
235
|
+
* inside thoughtspot admin or developer section
|
|
236
|
+
*
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
export type ChartSdkCustomStylingConfig = {
|
|
240
|
+
appBackground?: {
|
|
241
|
+
color?: string;
|
|
242
|
+
};
|
|
243
|
+
appPanelColor?: {
|
|
244
|
+
color?: string;
|
|
245
|
+
};
|
|
246
|
+
chartColorPalettes?: Array<{ colors: Array<string> }>;
|
|
247
|
+
numColorPalettes?: number;
|
|
248
|
+
disableColorRotation?: boolean;
|
|
249
|
+
chartFeatureToFontGuid?: Record<CustomizableChartFeature, string>;
|
|
250
|
+
fontFaces?: Array<TSFontFace>;
|
|
251
|
+
};
|
|
161
252
|
|
|
162
253
|
export interface AppConfig {
|
|
163
|
-
|
|
164
|
-
* @hidden
|
|
165
|
-
*/
|
|
166
|
-
styleConfig?: CustomStylingConfig;
|
|
254
|
+
styleConfig?: ChartSdkCustomStylingConfig;
|
|
167
255
|
|
|
168
256
|
appOptions?: {
|
|
169
257
|
isMobile?: boolean;
|
|
@@ -195,4 +283,10 @@ export interface AppConfig {
|
|
|
195
283
|
* @hidden
|
|
196
284
|
*/
|
|
197
285
|
customCalendarConfig?: any; // this is to initialize custom calendar service
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Unique identifier for the customer. This can be used as a way to maintain licensing by the
|
|
289
|
+
* third party developer
|
|
290
|
+
*/
|
|
291
|
+
chartAppAccessToken?: string;
|
|
198
292
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file: Conditional Formatting Types
|
|
3
|
+
* @fileoverview All CF types for the Custom Chart implementations
|
|
4
|
+
* @author Yashvardhan Nehra <yashvardhan.nehra@thoughtspot.com>
|
|
5
|
+
*
|
|
6
|
+
* Copyright: ThoughtSpot Inc. 2024
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { InputMaybe, Maybe, Scalars } from './common.types';
|
|
10
|
+
|
|
11
|
+
export type ConditionalFormatting = {
|
|
12
|
+
__typename?: 'ConditionalFormatting';
|
|
13
|
+
rows?: Maybe<Array<Maybe<ConditionalMetric>>>;
|
|
14
|
+
};
|
|
15
|
+
export declare enum BackgroundFormatTypes {
|
|
16
|
+
Gradient = 'GRADIENT',
|
|
17
|
+
Solid = 'SOLID',
|
|
18
|
+
}
|
|
19
|
+
export enum ConditionalFormattingComparisonTypes {
|
|
20
|
+
ColumnBased = 'COLUMN_BASED',
|
|
21
|
+
ParameterBased = 'PARAMETER_BASED',
|
|
22
|
+
ValueBased = 'VALUE_BASED',
|
|
23
|
+
}
|
|
24
|
+
export type FontAttrs = {
|
|
25
|
+
__typename?: 'FontAttrs';
|
|
26
|
+
bold?: Maybe<Scalars['Boolean']>;
|
|
27
|
+
color?: Maybe<Scalars['String']>;
|
|
28
|
+
italic?: Maybe<Scalars['Boolean']>;
|
|
29
|
+
strikeThrough?: Maybe<Scalars['Boolean']>;
|
|
30
|
+
underline?: Maybe<Scalars['Boolean']>;
|
|
31
|
+
};
|
|
32
|
+
export type GradientBackgroundAttrs = {
|
|
33
|
+
__typename?: 'GradientBackgroundAttrs';
|
|
34
|
+
backgroundFormatMidpoint?: Maybe<Scalars['Float']>;
|
|
35
|
+
backgroundFormatRange?: Maybe<Array<Maybe<Scalars['Float']>>>;
|
|
36
|
+
colors?: Maybe<Array<Maybe<Scalars['String']>>>;
|
|
37
|
+
};
|
|
38
|
+
export enum Operators {
|
|
39
|
+
Contains = 'CONTAINS',
|
|
40
|
+
DoesNotContain = 'DOES_NOT_CONTAIN',
|
|
41
|
+
EndsWith = 'ENDS_WITH',
|
|
42
|
+
EqualTo = 'EQUAL_TO',
|
|
43
|
+
GreaterThan = 'GREATER_THAN',
|
|
44
|
+
GreaterThanEqualTo = 'GREATER_THAN_EQUAL_TO',
|
|
45
|
+
Is = 'IS',
|
|
46
|
+
IsBetween = 'IS_BETWEEN',
|
|
47
|
+
IsEmpty = 'IS_EMPTY',
|
|
48
|
+
IsNot = 'IS_NOT',
|
|
49
|
+
IsNotEmpty = 'IS_NOT_EMPTY',
|
|
50
|
+
IsNotNull = 'IS_NOT_NULL',
|
|
51
|
+
IsNull = 'IS_NULL',
|
|
52
|
+
LessThan = 'LESS_THAN',
|
|
53
|
+
LessThanEqualTo = 'LESS_THAN_EQUAL_TO',
|
|
54
|
+
NotEqualTo = 'NOT_EQUAL_TO',
|
|
55
|
+
StartsWith = 'STARTS_WITH',
|
|
56
|
+
}
|
|
57
|
+
export type SolidBackgroundAttrs = {
|
|
58
|
+
__typename?: 'SolidBackgroundAttrs';
|
|
59
|
+
color?: Maybe<Scalars['String']>;
|
|
60
|
+
};
|
|
61
|
+
export type Range = {
|
|
62
|
+
__typename?: 'Range';
|
|
63
|
+
max?: Maybe<Scalars['Float']>;
|
|
64
|
+
min?: Maybe<Scalars['Float']>;
|
|
65
|
+
};
|
|
66
|
+
export type ConditionalMetric = {
|
|
67
|
+
__typename?: 'ConditionalMetric';
|
|
68
|
+
backgroundFormatType?: Maybe<BackgroundFormatTypes>;
|
|
69
|
+
comparisonParameterId?: Maybe<Scalars['String']>;
|
|
70
|
+
comparisonType?: Maybe<ConditionalFormattingComparisonTypes>;
|
|
71
|
+
fontProperties?: Maybe<FontAttrs>;
|
|
72
|
+
gradientBackgroundAttrs?: Maybe<GradientBackgroundAttrs>;
|
|
73
|
+
isHighlightRow?: Maybe<Scalars['Boolean']>;
|
|
74
|
+
lhsColumnId?: Maybe<Scalars['String']>;
|
|
75
|
+
operator?: Maybe<Operators>;
|
|
76
|
+
plotAsBand?: Maybe<Scalars['Boolean']>;
|
|
77
|
+
rangeValues?: Maybe<Range>;
|
|
78
|
+
rhsColumnId?: Maybe<Scalars['String']>;
|
|
79
|
+
solidBackgroundAttrs?: Maybe<SolidBackgroundAttrs>;
|
|
80
|
+
value?: Maybe<Scalars['String']>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type Parameter = {
|
|
84
|
+
__typename?: 'Parameter';
|
|
85
|
+
dataType: FalconDataType;
|
|
86
|
+
defaultValue: Scalars['String'];
|
|
87
|
+
description: Scalars['String'];
|
|
88
|
+
id: Scalars['GUID'];
|
|
89
|
+
name: Scalars['String'];
|
|
90
|
+
/** If not present, the parameter has not been overridden */
|
|
91
|
+
overrideValue?: Maybe<Scalars['String']>;
|
|
92
|
+
owner: ParameterOwnerInfo;
|
|
93
|
+
valueList?: Maybe<Array<ParameterValueListItem>>;
|
|
94
|
+
valueRange?: Maybe<ParameterValueRange>;
|
|
95
|
+
valueType: ParameterValueType;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export enum FalconDataType {
|
|
99
|
+
Bool = 'BOOL',
|
|
100
|
+
Char = 'CHAR',
|
|
101
|
+
Date = 'DATE',
|
|
102
|
+
DateTime = 'DATE_TIME',
|
|
103
|
+
Double = 'DOUBLE',
|
|
104
|
+
Float = 'FLOAT',
|
|
105
|
+
Int32 = 'INT32',
|
|
106
|
+
Int64 = 'INT64',
|
|
107
|
+
List = 'LIST',
|
|
108
|
+
ListBool = 'LIST_BOOL',
|
|
109
|
+
ListDate = 'LIST_DATE',
|
|
110
|
+
ListDateTime = 'LIST_DATE_TIME',
|
|
111
|
+
ListDouble = 'LIST_DOUBLE',
|
|
112
|
+
ListInt = 'LIST_INT',
|
|
113
|
+
ListString = 'LIST_STRING',
|
|
114
|
+
ListTime = 'LIST_TIME',
|
|
115
|
+
MaxType = 'MAX_TYPE',
|
|
116
|
+
Time = 'TIME',
|
|
117
|
+
Unknown = 'UNKNOWN',
|
|
118
|
+
}
|
|
119
|
+
export type ParameterOwnerInfo = {
|
|
120
|
+
__typename?: 'ParameterOwnerInfo';
|
|
121
|
+
id: Scalars['GUID'];
|
|
122
|
+
name: Scalars['String'];
|
|
123
|
+
type: ParameterOwnerType;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export enum ParameterOwnerType {
|
|
127
|
+
Answer = 'ANSWER',
|
|
128
|
+
Worksheet = 'WORKSHEET',
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type ParameterValueListItem = {
|
|
132
|
+
__typename?: 'ParameterValueListItem';
|
|
133
|
+
displayAs?: Maybe<Scalars['String']>;
|
|
134
|
+
value: Scalars['String'];
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type ParameterValueListItemInput = {
|
|
138
|
+
displayAs?: InputMaybe<Scalars['String']>;
|
|
139
|
+
value: Scalars['String'];
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type ParameterValueRange = {
|
|
143
|
+
__typename?: 'ParameterValueRange';
|
|
144
|
+
max?: Maybe<Scalars['Float']>;
|
|
145
|
+
min?: Maybe<Scalars['Float']>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type ParameterValueRangeInput = {
|
|
149
|
+
max?: InputMaybe<Scalars['Float']>;
|
|
150
|
+
min?: InputMaybe<Scalars['Float']>;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export enum ParameterValueType {
|
|
154
|
+
Any = 'ANY',
|
|
155
|
+
List = 'LIST',
|
|
156
|
+
Range = 'RANGE',
|
|
157
|
+
}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* Copyright: ThoughtSpot Inc. 2023
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import type { CustomChartContext } from '../main/custom-chart-context';
|
|
18
|
+
import { ChartModel } from './common.types';
|
|
17
19
|
/**
|
|
18
20
|
*
|
|
19
21
|
* @group Chart Configuration Editor
|
|
@@ -68,6 +70,20 @@ export interface ChartConfigSection {
|
|
|
68
70
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
69
71
|
*/
|
|
70
72
|
allowTimeSeriesColumns?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Allow measure name Column on the Section
|
|
75
|
+
*
|
|
76
|
+
* @default true
|
|
77
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
78
|
+
*/
|
|
79
|
+
allowMeasureNameColumn?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Allow measure value Column on the Section
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
85
|
+
*/
|
|
86
|
+
allowMeasureValueColumn?: boolean;
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
/**
|
|
@@ -100,3 +116,8 @@ export interface ChartConfigEditorDefinition {
|
|
|
100
116
|
*/
|
|
101
117
|
columnSections: ChartConfigSection[];
|
|
102
118
|
}
|
|
119
|
+
|
|
120
|
+
export type ConfigEditorDefinitionSetter = (
|
|
121
|
+
currentState: ChartModel,
|
|
122
|
+
ctx: CustomChartContext,
|
|
123
|
+
) => ChartConfigEditorDefinition[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file: Number Formatting Types
|
|
3
|
+
* @author Yashvardhan Nehra <yashvardhan.nehra@thoughtspot.com>
|
|
4
|
+
*
|
|
5
|
+
* Copyright: ThoughtSpot Inc. 2024
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Maybe, Scalars } from './common.types';
|
|
9
|
+
|
|
10
|
+
export enum CategoryType {
|
|
11
|
+
Currency = 'CURRENCY',
|
|
12
|
+
Custom = 'CUSTOM',
|
|
13
|
+
Number = 'NUMBER',
|
|
14
|
+
Percentage = 'PERCENTAGE',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum Unit {
|
|
18
|
+
Auto = 'AUTO',
|
|
19
|
+
Billion = 'BILLION',
|
|
20
|
+
Million = 'MILLION',
|
|
21
|
+
None = 'NONE',
|
|
22
|
+
Thousands = 'THOUSANDS',
|
|
23
|
+
Trillion = 'TRILLION',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum NegativeValueFormat {
|
|
27
|
+
BracesNodash = 'BRACES_NODASH',
|
|
28
|
+
PrefixDash = 'PREFIX_DASH',
|
|
29
|
+
SuffixDash = 'SUFFIX_DASH',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type CurrencyFormatConfig = {
|
|
33
|
+
__typename?: 'CurrencyFormatConfig';
|
|
34
|
+
/** default to 2 */
|
|
35
|
+
decimals?: Maybe<Scalars['Float']>;
|
|
36
|
+
locale?: Maybe<Scalars['String']>;
|
|
37
|
+
/** default to false */
|
|
38
|
+
removeTrailingZeroes?: Maybe<Scalars['Boolean']>;
|
|
39
|
+
/** default to true */
|
|
40
|
+
toSeparateThousands?: Maybe<Scalars['Boolean']>;
|
|
41
|
+
/** default is MILLION */
|
|
42
|
+
unit?: Maybe<Unit>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type CustomFormatConfig = {
|
|
46
|
+
__typename?: 'CustomFormatConfig';
|
|
47
|
+
format?: Maybe<Scalars['String']>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type NumberFormatConfig = {
|
|
51
|
+
__typename?: 'NumberFormatConfig';
|
|
52
|
+
/** default to 2 */
|
|
53
|
+
decimals?: Maybe<Scalars['Float']>;
|
|
54
|
+
/** default to PREFIX_DASH */
|
|
55
|
+
negativeValueFormat?: Maybe<NegativeValueFormat>;
|
|
56
|
+
/** default to false */
|
|
57
|
+
removeTrailingZeroes?: Maybe<Scalars['Boolean']>;
|
|
58
|
+
/** default to true */
|
|
59
|
+
toSeparateThousands?: Maybe<Scalars['Boolean']>;
|
|
60
|
+
/** default is Auto */
|
|
61
|
+
unit?: Maybe<Unit>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type PercentageFormatConfig = {
|
|
65
|
+
__typename?: 'PercentageFormatConfig';
|
|
66
|
+
/** default to 2 */
|
|
67
|
+
decimals?: Maybe<Scalars['Float']>;
|
|
68
|
+
/** default to false */
|
|
69
|
+
removeTrailingZeroes?: Maybe<Scalars['Boolean']>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type FormatConfig = {
|
|
73
|
+
__typename?: 'FormatConfig';
|
|
74
|
+
category?: Maybe<CategoryType>;
|
|
75
|
+
currencyFormatConfig?: Maybe<CurrencyFormatConfig>;
|
|
76
|
+
customFormatConfig?: Maybe<CustomFormatConfig>;
|
|
77
|
+
isCategoryEditable?: Maybe<Scalars['Boolean']>;
|
|
78
|
+
numberFormatConfig?: Maybe<NumberFormatConfig>;
|
|
79
|
+
percentageFormatConfig?: Maybe<PercentageFormatConfig>;
|
|
80
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
AllowedConfigurations,
|
|
3
|
+
ChartConfigParameters,
|
|
4
|
+
} from '../main/custom-chart-context';
|
|
2
5
|
import { ChartColumn } from './answer-column.types';
|
|
3
|
-
import { Point } from './chart-to-ts-event.types';
|
|
6
|
+
import type { Point } from './chart-to-ts-event.types';
|
|
4
7
|
import {
|
|
5
8
|
AppConfig,
|
|
6
9
|
ChartConfig,
|
|
@@ -9,8 +12,8 @@ import {
|
|
|
9
12
|
ValidationResponse,
|
|
10
13
|
VisualProps,
|
|
11
14
|
} from './common.types';
|
|
12
|
-
import { ChartConfigEditorDefinition } from './configurator.types';
|
|
13
|
-
import { VisualPropEditorDefinition } from './visual-prop.types';
|
|
15
|
+
import type { ChartConfigEditorDefinition } from './configurator.types';
|
|
16
|
+
import type { VisualPropEditorDefinition } from './visual-prop.types';
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* All the events sent from the ThoughtSpot application to Custom Chart App
|
|
@@ -200,11 +203,19 @@ export interface InitializeEventResponsePayload {
|
|
|
200
203
|
*/
|
|
201
204
|
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
202
205
|
/**
|
|
203
|
-
* Toggle native configurations supported by TS UI. Ex: column level number and conditional
|
|
206
|
+
* Toggle native configurations supported by TS UI. Ex: column level number and conditional
|
|
207
|
+
* formatting.
|
|
204
208
|
*
|
|
205
209
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
206
210
|
*/
|
|
207
211
|
allowedConfigurations?: AllowedConfigurations;
|
|
212
|
+
/**
|
|
213
|
+
* Additional chart configuration parameters supported by TS UI. Ex: show/hide Measure Name/
|
|
214
|
+
* Value columns.
|
|
215
|
+
*
|
|
216
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
217
|
+
*/
|
|
218
|
+
chartConfigParameters?: ChartConfigParameters;
|
|
208
219
|
}
|
|
209
220
|
|
|
210
221
|
/**
|
|
@@ -215,12 +226,26 @@ export interface GetDataQueryPayload {
|
|
|
215
226
|
config: ChartConfig[];
|
|
216
227
|
}
|
|
217
228
|
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
* @group ThoughtSpot to Chart Events
|
|
232
|
+
*/
|
|
233
|
+
export interface QueryColumn extends ChartColumn {
|
|
234
|
+
/**
|
|
235
|
+
* Flag to identify if the column is a measure value,
|
|
236
|
+
* to be used along with MEASURE_NAME/MEASUE_VALUE column in the query
|
|
237
|
+
*
|
|
238
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
239
|
+
*/
|
|
240
|
+
isMeasureValue?: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
218
243
|
/**
|
|
219
244
|
*
|
|
220
245
|
* @group ThoughtSpot to Chart Events
|
|
221
246
|
*/
|
|
222
247
|
export interface Query {
|
|
223
|
-
queryColumns:
|
|
248
|
+
queryColumns: QueryColumn[];
|
|
224
249
|
queryParams?: {
|
|
225
250
|
offset?: number;
|
|
226
251
|
size?: number;
|
|
@@ -280,6 +305,13 @@ export interface VisualPropsValidateEventPayload {
|
|
|
280
305
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
281
306
|
*/
|
|
282
307
|
visualProps: VisualProps;
|
|
308
|
+
/**
|
|
309
|
+
* used to identify active column for column level settings, empty string in case of overall
|
|
310
|
+
* chart settings
|
|
311
|
+
*
|
|
312
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
313
|
+
*/
|
|
314
|
+
activeColumnId?: string;
|
|
283
315
|
}
|
|
284
316
|
|
|
285
317
|
/**
|