@thoughtspot/ts-chart-sdk 0.0.2-alpha.2 → 0.0.2-alpha.21

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 (107) hide show
  1. package/README.md +126 -50
  2. package/dist/ts-chart-sdk.d.ts +940 -0
  3. package/lib/index.d.ts +4 -0
  4. package/lib/index.d.ts.map +1 -1
  5. package/lib/index.js +4 -0
  6. package/lib/index.js.map +1 -1
  7. package/lib/main/custom-chart-context.d.ts +22 -7
  8. package/lib/main/custom-chart-context.d.ts.map +1 -1
  9. package/lib/main/custom-chart-context.js +59 -4
  10. package/lib/main/custom-chart-context.js.map +1 -1
  11. package/lib/main/custom-chart-context.spec.js +402 -5
  12. package/lib/main/custom-chart-context.spec.js.map +1 -1
  13. package/lib/main/post-message-event-bridge.js +2 -2
  14. package/lib/main/post-message-event-bridge.js.map +1 -1
  15. package/lib/main/util.spec.d.ts +2 -0
  16. package/lib/main/util.spec.d.ts.map +1 -0
  17. package/lib/main/util.spec.js +31 -0
  18. package/lib/main/util.spec.js.map +1 -0
  19. package/lib/react/use-custom-chart-context.spec.js +54 -3
  20. package/lib/react/use-custom-chart-context.spec.js.map +1 -1
  21. package/lib/test/test-conditional-formatting-utils.d.ts +5 -0
  22. package/lib/test/test-conditional-formatting-utils.d.ts.map +1 -0
  23. package/lib/test/test-conditional-formatting-utils.js +43 -0
  24. package/lib/test/test-conditional-formatting-utils.js.map +1 -0
  25. package/lib/types/answer-column.types.d.ts +57 -1
  26. package/lib/types/answer-column.types.d.ts.map +1 -1
  27. package/lib/types/answer-column.types.js +47 -0
  28. package/lib/types/answer-column.types.js.map +1 -1
  29. package/lib/types/chart-to-ts-event.types.d.ts +2 -0
  30. package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
  31. package/lib/types/chart-to-ts-event.types.js +1 -0
  32. package/lib/types/chart-to-ts-event.types.js.map +1 -1
  33. package/lib/types/common.types.d.ts +103 -4
  34. package/lib/types/common.types.d.ts.map +1 -1
  35. package/lib/types/common.types.js +15 -1
  36. package/lib/types/common.types.js.map +1 -1
  37. package/lib/types/conditional-formatting.types.d.ts +140 -0
  38. package/lib/types/conditional-formatting.types.d.ts.map +1 -0
  39. package/lib/types/conditional-formatting.types.js +60 -0
  40. package/lib/types/conditional-formatting.types.js.map +1 -0
  41. package/lib/types/configurator.types.d.ts +5 -0
  42. package/lib/types/configurator.types.d.ts.map +1 -1
  43. package/lib/types/number-formatting.types.d.ts +55 -0
  44. package/lib/types/number-formatting.types.d.ts.map +1 -0
  45. package/lib/types/number-formatting.types.js +23 -0
  46. package/lib/types/number-formatting.types.js.map +1 -0
  47. package/lib/types/ts-to-chart-event.types.d.ts +10 -5
  48. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  49. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  50. package/lib/types/visual-prop.types.d.ts +21 -0
  51. package/lib/types/visual-prop.types.d.ts.map +1 -1
  52. package/lib/utils/conditional-formatting/conditional-formatting.d.ts +10 -0
  53. package/lib/utils/conditional-formatting/conditional-formatting.d.ts.map +1 -0
  54. package/lib/utils/conditional-formatting/conditional-formatting.js +103 -0
  55. package/lib/utils/conditional-formatting/conditional-formatting.js.map +1 -0
  56. package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts +2 -0
  57. package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts.map +1 -0
  58. package/lib/utils/conditional-formatting/conditional-formatting.spec.js +142 -0
  59. package/lib/utils/conditional-formatting/conditional-formatting.spec.js.map +1 -0
  60. package/lib/utils/date-formatting.d.ts +103 -0
  61. package/lib/utils/date-formatting.d.ts.map +1 -0
  62. package/lib/utils/date-formatting.js +389 -0
  63. package/lib/utils/date-formatting.js.map +1 -0
  64. package/lib/utils/date-formatting.spec.d.ts +2 -0
  65. package/lib/utils/date-formatting.spec.d.ts.map +1 -0
  66. package/lib/utils/date-formatting.spec.js +394 -0
  67. package/lib/utils/date-formatting.spec.js.map +1 -0
  68. package/lib/utils/date-utils.d.ts +6 -0
  69. package/lib/utils/date-utils.d.ts.map +1 -0
  70. package/lib/utils/date-utils.js +20 -0
  71. package/lib/utils/date-utils.js.map +1 -0
  72. package/lib/utils/date-utils.spec.d.ts +2 -0
  73. package/lib/utils/date-utils.spec.d.ts.map +1 -0
  74. package/lib/utils/date-utils.spec.js +63 -0
  75. package/lib/utils/date-utils.spec.js.map +1 -0
  76. package/lib/utils/formatting-util.d.ts +10 -0
  77. package/lib/utils/formatting-util.d.ts.map +1 -0
  78. package/lib/utils/formatting-util.js +78 -0
  79. package/lib/utils/formatting-util.js.map +1 -0
  80. package/lib/utils/formatting-util.spec.d.ts +2 -0
  81. package/lib/utils/formatting-util.spec.d.ts.map +1 -0
  82. package/lib/utils/formatting-util.spec.js +247 -0
  83. package/lib/utils/formatting-util.spec.js.map +1 -0
  84. package/package.json +6 -4
  85. package/src/index.ts +4 -0
  86. package/src/main/custom-chart-context.spec.ts +474 -9
  87. package/src/main/custom-chart-context.ts +246 -12
  88. package/src/main/post-message-event-bridge.ts +1 -1
  89. package/src/main/util.spec.ts +41 -0
  90. package/src/react/use-custom-chart-context.spec.tsx +65 -3
  91. package/src/test/test-conditional-formatting-utils.ts +95 -0
  92. package/src/types/answer-column.types.ts +102 -1
  93. package/src/types/chart-to-ts-event.types.ts +7 -0
  94. package/src/types/common.types.ts +165 -10
  95. package/src/types/conditional-formatting.types.ts +157 -0
  96. package/src/types/configurator.types.ts +21 -0
  97. package/src/types/number-formatting.types.ts +80 -0
  98. package/src/types/ts-to-chart-event.types.ts +38 -6
  99. package/src/types/visual-prop.types.ts +75 -1
  100. package/src/utils/conditional-formatting/conditional-formatting.spec.ts +469 -0
  101. package/src/utils/conditional-formatting/conditional-formatting.ts +229 -0
  102. package/src/utils/date-formatting.spec.ts +511 -0
  103. package/src/utils/date-formatting.ts +679 -0
  104. package/src/utils/date-utils.spec.ts +93 -0
  105. package/src/utils/date-utils.ts +69 -0
  106. package/src/utils/formatting-util.spec.ts +312 -0
  107. package/src/utils/formatting-util.ts +234 -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,22 +197,123 @@ 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 JSON is defined by the visual prop types. See VisualPropEditorDefinition.
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 = JSON;
210
+ export type VisualProps = unknown;
158
211
 
159
- // Todo: this should be imported from the custom style config package.
160
- type CustomStylingConfig = any;
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
+ */
161
218
 
162
- export interface AppConfig {
163
- /**
164
- * @hidden
165
- */
166
- styleConfig?: CustomStylingConfig;
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
+ };
167
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
+ };
252
+
253
+ /**
254
+ * Defines a set of standardized date and datetime format strings used for
255
+ * displaying dates and times in various formats. Each format string represents
256
+ * a specific date or time pattern that can be used for localized display purposes.
257
+ */
258
+
259
+ export interface DateFormats {
260
+ DATE_SHORT: string;
261
+ DATE_SHORT_2_DIGIT_YEAR: string;
262
+ DATE_SHORT_WITH_HOUR: string;
263
+ DATE_SHORT_WITH_HOUR_WITHOUT_YEAR: string;
264
+ DATE_SHORT_WITH_HOUR_24: string;
265
+ DATE_SHORT_WITH_HOUR_24_WITHOUT_YEAR: string;
266
+ DATETIME_SHORT: string;
267
+ DATETIME_SHORT_WITHOUT_YEAR: string;
268
+ DATETIME_24_SHORT: string;
269
+ DATETIME_24_SHORT_WITH_MILLIS: string;
270
+ DATETIME_24_SHORT_WITH_MILLIS_WITHOUT_YEAR: string;
271
+ DATETIME_SHORT_WITH_SECONDS: string;
272
+ DATETIME_SHORT_WITH_SECONDS_WITHOUT_YEAR: string;
273
+ DATETIME_SHORT_WITH_MILLIS: string;
274
+ DATETIME_SHORT_WITH_MILLIS_WITHOUT_YEAR: string;
275
+ QUARTER_WITH_YEAR: string;
276
+ QUARTER_WITH_2_DIGIT_YEAR: string;
277
+ DEFAULT_TIME_FORMAT: string;
278
+ MONTH_WITH_YEAR: string;
279
+ MONTH_WITH_DAY_AND_YEAR: string;
280
+ MONTH_WITH_2_DIGIT_YEAR: string;
281
+ DAY_WITH_MONTH: string;
282
+ DAY_WITH_MONTH_NUM: string;
283
+ QUARTER: string;
284
+ MONTH_ONLY: string;
285
+ DATETIME_WITH_SHORT_OFFSET: string;
286
+ }
287
+
288
+ /**
289
+ * Configuration object for date formats and settings in the Chart SDK.
290
+ * Provides locale-specific date and string formats, constants, and custom calendars.
291
+ *
292
+ * @type ChartSdkDateFormatsConfig
293
+ *
294
+ * @property tsLocaleBasedDateFormats - Optional. A record mapping locale identifiers to date format settings,
295
+ * each represented by a `DateFormats` object.
296
+ * @property tsLocaleBasedStringsFormats - Optional. A record mapping locale identifiers to localized string
297
+ * formats, where each format is represented by a string.
298
+ * @property tsDateConstants - Optional. A record mapping string keys to date-related constants, often used
299
+ * for standard date patterns or other fixed date-related values(mostly used to identify the case
300
+ * for backend proccessed date in case of MONTH_OF_YEAR,DAY_OF_WEEK).
301
+ * @property tsDefinedCustomCalenders - Optional. Custom calendar configurations, which have GUID of TS defined Custom calenders.
302
+ * @property defaultDataSourceId - Optional. The data source identifier for the date formats, used
303
+ * to specify the primary data source for TS defined custom calenders.
304
+ */
305
+
306
+ export type ChartSdkDateFormatsConfig = {
307
+ tsLocaleBasedDateFormats?: Record<string, DateFormats>;
308
+ tsLocaleBasedStringsFormats?: Record<string, string>;
309
+ tsDateConstants?: Record<string, string>;
310
+ tsDefinedCustomCalenders?: any;
311
+ defaultDataSourceId?: string;
312
+ };
313
+
314
+ export interface AppConfig {
315
+ styleConfig?: ChartSdkCustomStylingConfig;
316
+ dateFormatsConfig?: ChartSdkDateFormatsConfig;
168
317
  appOptions?: {
169
318
  isMobile?: boolean;
170
319
  isPrintMode?: boolean; // export mode on/off
@@ -195,4 +344,10 @@ export interface AppConfig {
195
344
  * @hidden
196
345
  */
197
346
  customCalendarConfig?: any; // this is to initialize custom calendar service
347
+
348
+ /**
349
+ * Unique identifier for the customer. This can be used as a way to maintain licensing by the
350
+ * third party developer
351
+ */
352
+ chartAppAccessToken?: string;
198
353
  }
@@ -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
+ };