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

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 (174) hide show
  1. package/dist/ts-chart-sdk.d.ts +449 -31
  2. package/lib/index.d.ts +3 -0
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +3 -0
  5. package/lib/index.js.map +1 -1
  6. package/lib/main/custom-chart-context.d.ts +17 -5
  7. package/lib/main/custom-chart-context.d.ts.map +1 -1
  8. package/lib/main/custom-chart-context.js +74 -34
  9. package/lib/main/custom-chart-context.js.map +1 -1
  10. package/lib/main/custom-chart-context.spec.js +256 -257
  11. package/lib/main/custom-chart-context.spec.js.map +1 -1
  12. package/lib/main/post-message-event-bridge.d.ts +3 -3
  13. package/lib/main/post-message-event-bridge.d.ts.map +1 -1
  14. package/lib/main/post-message-event-bridge.js +24 -36
  15. package/lib/main/post-message-event-bridge.js.map +1 -1
  16. package/lib/main/post-message-event-bridge.spec.js +0 -2
  17. package/lib/main/post-message-event-bridge.spec.js.map +1 -1
  18. package/lib/main/util.d.ts +2 -0
  19. package/lib/main/util.d.ts.map +1 -0
  20. package/lib/main/util.js +9 -0
  21. package/lib/main/util.js.map +1 -0
  22. package/lib/react/use-custom-chart-context.spec.js +128 -121
  23. package/lib/react/use-custom-chart-context.spec.js.map +1 -1
  24. package/lib/test/test-conditional-formatting-utils.d.ts +5 -0
  25. package/lib/test/test-conditional-formatting-utils.d.ts.map +1 -0
  26. package/lib/test/test-conditional-formatting-utils.js +43 -0
  27. package/lib/test/test-conditional-formatting-utils.js.map +1 -0
  28. package/lib/types/answer-column.types.d.ts +54 -1
  29. package/lib/types/answer-column.types.d.ts.map +1 -1
  30. package/lib/types/answer-column.types.js +47 -0
  31. package/lib/types/answer-column.types.js.map +1 -1
  32. package/lib/types/common.types.d.ts +51 -4
  33. package/lib/types/common.types.d.ts.map +1 -1
  34. package/lib/types/common.types.js +15 -1
  35. package/lib/types/common.types.js.map +1 -1
  36. package/lib/types/conditional-formatting.types.d.ts +155 -0
  37. package/lib/types/conditional-formatting.types.d.ts.map +1 -0
  38. package/lib/types/conditional-formatting.types.js +60 -0
  39. package/lib/types/conditional-formatting.types.js.map +1 -0
  40. package/lib/types/configurator.types.d.ts +5 -0
  41. package/lib/types/configurator.types.d.ts.map +1 -1
  42. package/lib/types/ts-to-chart-event.types.d.ts +3 -0
  43. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  44. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  45. package/lib/types/visual-prop.types.d.ts +3 -0
  46. package/lib/types/visual-prop.types.d.ts.map +1 -1
  47. package/lib/utils/conditional-formatting/conditional-formatting.d.ts +10 -0
  48. package/lib/utils/conditional-formatting/conditional-formatting.d.ts.map +1 -0
  49. package/lib/utils/conditional-formatting/conditional-formatting.js +103 -0
  50. package/lib/utils/conditional-formatting/conditional-formatting.js.map +1 -0
  51. package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts +2 -0
  52. package/lib/utils/conditional-formatting/conditional-formatting.spec.d.ts.map +1 -0
  53. package/lib/utils/conditional-formatting/conditional-formatting.spec.js +142 -0
  54. package/lib/utils/conditional-formatting/conditional-formatting.spec.js.map +1 -0
  55. package/lib/utils/date-formatting.d.ts +19 -0
  56. package/lib/utils/date-formatting.d.ts.map +1 -0
  57. package/lib/utils/date-formatting.js +56 -0
  58. package/lib/utils/date-formatting.js.map +1 -0
  59. package/lib/utils/date-formatting.spec.d.ts +2 -0
  60. package/lib/utils/date-formatting.spec.d.ts.map +1 -0
  61. package/lib/utils/date-formatting.spec.js +124 -0
  62. package/lib/utils/date-formatting.spec.js.map +1 -0
  63. package/package.json +10 -7
  64. package/src/index.ts +3 -0
  65. package/src/main/custom-chart-context.spec.ts +291 -266
  66. package/src/main/custom-chart-context.ts +164 -46
  67. package/src/main/post-message-event-bridge.spec.ts +0 -3
  68. package/src/main/post-message-event-bridge.ts +36 -62
  69. package/src/main/util.ts +11 -0
  70. package/src/react/use-custom-chart-context.spec.tsx +149 -122
  71. package/src/test/test-conditional-formatting-utils.ts +95 -0
  72. package/src/types/answer-column.types.ts +98 -0
  73. package/src/types/common.types.ts +82 -10
  74. package/src/types/conditional-formatting.types.ts +172 -0
  75. package/src/types/configurator.types.ts +21 -0
  76. package/src/types/ts-to-chart-event.types.ts +15 -0
  77. package/src/types/visual-prop.types.ts +7 -0
  78. package/src/utils/conditional-formatting/conditional-formatting.spec.ts +469 -0
  79. package/src/utils/conditional-formatting/conditional-formatting.ts +229 -0
  80. package/src/utils/date-formatting.spec.ts +168 -0
  81. package/src/utils/date-formatting.ts +109 -0
  82. package/cjs/index.d.ts +0 -9
  83. package/cjs/index.d.ts.map +0 -1
  84. package/cjs/index.js +0 -25
  85. package/cjs/index.js.map +0 -1
  86. package/cjs/main/custom-chart-context.d.ts +0 -47
  87. package/cjs/main/custom-chart-context.d.ts.map +0 -1
  88. package/cjs/main/custom-chart-context.js +0 -326
  89. package/cjs/main/custom-chart-context.js.map +0 -1
  90. package/cjs/main/custom-chart-context.spec.d.ts +0 -2
  91. package/cjs/main/custom-chart-context.spec.d.ts.map +0 -1
  92. package/cjs/main/custom-chart-context.spec.js +0 -699
  93. package/cjs/main/custom-chart-context.spec.js.map +0 -1
  94. package/cjs/main/post-message-event-bridge.d.ts +0 -6
  95. package/cjs/main/post-message-event-bridge.d.ts.map +0 -1
  96. package/cjs/main/post-message-event-bridge.js +0 -46
  97. package/cjs/main/post-message-event-bridge.js.map +0 -1
  98. package/cjs/main/post-message-event-bridge.spec.d.ts +0 -2
  99. package/cjs/main/post-message-event-bridge.spec.d.ts.map +0 -1
  100. package/cjs/main/post-message-event-bridge.spec.js +0 -124
  101. package/cjs/main/post-message-event-bridge.spec.js.map +0 -1
  102. package/cjs/react/custom-chart-context-service.d.ts +0 -33
  103. package/cjs/react/custom-chart-context-service.d.ts.map +0 -1
  104. package/cjs/react/custom-chart-context-service.js +0 -118
  105. package/cjs/react/custom-chart-context-service.js.map +0 -1
  106. package/cjs/react/custom-chart.context.d.ts +0 -26
  107. package/cjs/react/custom-chart.context.d.ts.map +0 -1
  108. package/cjs/react/custom-chart.context.js +0 -105
  109. package/cjs/react/custom-chart.context.js.map +0 -1
  110. package/cjs/react/custom-chart.spec.d.ts +0 -2
  111. package/cjs/react/custom-chart.spec.d.ts.map +0 -1
  112. package/cjs/react/custom-chart.spec.js +0 -72
  113. package/cjs/react/custom-chart.spec.js.map +0 -1
  114. package/cjs/react/mocks/custom-chart-context-mock.d.ts +0 -3
  115. package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +0 -1
  116. package/cjs/react/mocks/custom-chart-context-mock.js +0 -100
  117. package/cjs/react/mocks/custom-chart-context-mock.js.map +0 -1
  118. package/cjs/react/use-custom-chart-context.d.ts +0 -4
  119. package/cjs/react/use-custom-chart-context.d.ts.map +0 -1
  120. package/cjs/react/use-custom-chart-context.js +0 -95
  121. package/cjs/react/use-custom-chart-context.js.map +0 -1
  122. package/cjs/react/use-custom-chart-context.spec.d.ts +0 -2
  123. package/cjs/react/use-custom-chart-context.spec.d.ts.map +0 -1
  124. package/cjs/react/use-custom-chart-context.spec.js +0 -391
  125. package/cjs/react/use-custom-chart-context.spec.js.map +0 -1
  126. package/cjs/react/use-custom-chart-context.util.d.ts +0 -6
  127. package/cjs/react/use-custom-chart-context.util.d.ts.map +0 -1
  128. package/cjs/react/use-custom-chart-context.util.js +0 -60
  129. package/cjs/react/use-custom-chart-context.util.js.map +0 -1
  130. package/cjs/react/use-custom-chart-types.d.ts +0 -23
  131. package/cjs/react/use-custom-chart-types.d.ts.map +0 -1
  132. package/cjs/react/use-custom-chart-types.js +0 -3
  133. package/cjs/react/use-custom-chart-types.js.map +0 -1
  134. package/cjs/test/test-utils.d.ts +0 -7
  135. package/cjs/test/test-utils.d.ts.map +0 -1
  136. package/cjs/test/test-utils.js +0 -14
  137. package/cjs/test/test-utils.js.map +0 -1
  138. package/cjs/types/answer-column.types.d.ts +0 -69
  139. package/cjs/types/answer-column.types.d.ts.map +0 -1
  140. package/cjs/types/answer-column.types.js +0 -59
  141. package/cjs/types/answer-column.types.js.map +0 -1
  142. package/cjs/types/chart-to-ts-event.types.d.ts +0 -98
  143. package/cjs/types/chart-to-ts-event.types.d.ts.map +0 -1
  144. package/cjs/types/chart-to-ts-event.types.js +0 -32
  145. package/cjs/types/chart-to-ts-event.types.js.map +0 -1
  146. package/cjs/types/common.types.d.ts +0 -51
  147. package/cjs/types/common.types.d.ts.map +0 -1
  148. package/cjs/types/common.types.js +0 -3
  149. package/cjs/types/common.types.js.map +0 -1
  150. package/cjs/types/configurator.types.d.ts +0 -15
  151. package/cjs/types/configurator.types.d.ts.map +0 -1
  152. package/cjs/types/configurator.types.js +0 -3
  153. package/cjs/types/configurator.types.js.map +0 -1
  154. package/cjs/types/ts-to-chart-event.types.d.ts +0 -91
  155. package/cjs/types/ts-to-chart-event.types.d.ts.map +0 -1
  156. package/cjs/types/ts-to-chart-event.types.js +0 -18
  157. package/cjs/types/ts-to-chart-event.types.js.map +0 -1
  158. package/cjs/types/visual-prop.types.d.ts +0 -73
  159. package/cjs/types/visual-prop.types.d.ts.map +0 -1
  160. package/cjs/types/visual-prop.types.js +0 -3
  161. package/cjs/types/visual-prop.types.js.map +0 -1
  162. package/lib/dist/ts-chart-sdk.d.ts +0 -312
  163. package/lib/react/custom-chart-context-service.d.ts +0 -33
  164. package/lib/react/custom-chart-context-service.d.ts.map +0 -1
  165. package/lib/react/custom-chart-context-service.js +0 -91
  166. package/lib/react/custom-chart-context-service.js.map +0 -1
  167. package/lib/react/custom-chart.context.d.ts +0 -26
  168. package/lib/react/custom-chart.context.d.ts.map +0 -1
  169. package/lib/react/custom-chart.context.js +0 -78
  170. package/lib/react/custom-chart.context.js.map +0 -1
  171. package/lib/react/custom-chart.spec.d.ts +0 -2
  172. package/lib/react/custom-chart.spec.d.ts.map +0 -1
  173. package/lib/react/custom-chart.spec.js +0 -67
  174. package/lib/react/custom-chart.spec.js.map +0 -1
@@ -7,6 +7,30 @@
7
7
  */
8
8
 
9
9
  import { ChartColumn } from './answer-column.types';
10
+ import { ChartConfigEditorDefinition } from './configurator.types';
11
+ import { 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 enum CustomizableChartFeature {
21
+ X_AXIS_LABEL,
22
+ X_AXIS_TITLE,
23
+ Y_AXIS_LABEL,
24
+ Y_AXIS_TITLE,
25
+ TOOLTIP,
26
+ SCATTER_CHART,
27
+ PIE_CHART,
28
+ LINE_CHART,
29
+ COLUMN_CHART,
30
+ BAR_CHART,
31
+ AREA_CHART,
32
+ TAIL_FEATURE,
33
+ }
10
34
 
11
35
  /**
12
36
  * List of Columns for a dimension in the Custom Chart Config.
@@ -140,6 +164,12 @@ export interface ChartModel {
140
164
  };
141
165
  }
142
166
 
167
+ // Validation Response for valid config or visual props
168
+ export type SuccessValidationResponse = {
169
+ chartConfigEditorDefinition: ChartConfigEditorDefinition[];
170
+ visualPropEditorDefinition: VisualPropEditorDefinition;
171
+ };
172
+
143
173
  // Generic Validation Response
144
174
  export type ValidationResponse = {
145
175
  isValid: boolean;
@@ -149,26 +179,63 @@ export type ValidationResponse = {
149
179
  /**
150
180
  * Custom Visual props is the stored metadata for the visual props definition
151
181
  * configured by the user in the visual prop editor
152
- * The JSON is defined by the visual prop types. See VisualPropEditorDefinition.
153
- *
182
+ * The object is defined by the visual prop types. See VisualPropEditorDefinition.
183
+ * If there is any local state specific to charts needs to be maintained on save answer, store it
184
+ * in VisualProps, with visualProps.clientState variable. The clientState variable should be a
185
+ * string, preferrably a result of JSON.stringify(<yourlocalClientState>).
186
+ * @remark
187
+ * only values stored in clientSate variable will be preserved on changing the
188
+ * visualPropeditorDefinition, any other variable store would not be preserved
154
189
  * @group Chart Model
155
190
  * @version SDK: 0.1 | ThoughtSpot:
156
191
  */
157
- export type VisualProps = JSON;
192
+ export type VisualProps = unknown;
193
+
194
+ /**
195
+ * Custom Font Faces type from TS.
196
+ *
197
+ */
198
+
199
+ export type CustomFontFaces = {
200
+ guid: string;
201
+ family?: string;
202
+ format?: string;
203
+ url?: string;
204
+ weight?: string;
205
+ style?: string;
206
+ size?: string;
207
+ unicodeRange?: string;
208
+ variant?: string;
209
+ stretch?: string;
210
+ color?: string;
211
+ };
212
+
213
+ /**
214
+ * Used for Custom color pallete and Custom font for charts defined in Style customisations
215
+ * inside thoughtspot admin or developer section
216
+ *
217
+ */
158
218
 
159
- // Todo: this should be imported from the custom style config package.
160
- type CustomStylingConfig = any;
219
+ export type ChartSdkCustomStylingConfig = {
220
+ appBackground?: {
221
+ color?: string;
222
+ };
223
+ appPanelColor?: {
224
+ color?: string;
225
+ };
226
+ chartColorPalettes?: Array<{ colors: Array<string> }>;
227
+ disableColorRotation?: boolean;
228
+ chartFeatureToFontGuid?: Record<CustomizableChartFeature, string>;
229
+ customFontFaces?: Array<CustomFontFaces>;
230
+ };
161
231
 
162
232
  export interface AppConfig {
163
- /**
164
- * @hidden
165
- */
166
- styleConfig?: CustomStylingConfig;
233
+ styleConfig?: ChartSdkCustomStylingConfig;
167
234
 
168
235
  appOptions?: {
169
236
  isMobile?: boolean;
170
237
  isPrintMode?: boolean; // export mode on/off
171
-
238
+ isLiveboardContext?: boolean; // if chart renders in liveboard context
172
239
  // runtime configurations
173
240
  isDebugMode?: boolean; // enables debug mode for logging
174
241
  };
@@ -195,4 +262,9 @@ export interface AppConfig {
195
262
  * @hidden
196
263
  */
197
264
  customCalendarConfig?: any; // this is to initialize custom calendar service
265
+
266
+ /**
267
+ * Unique identifier for the customer. This is used to identify the customer
268
+ */
269
+ customerId?: string;
198
270
  }
@@ -0,0 +1,172 @@
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. 2023
7
+ */
8
+
9
+ export type Maybe<T> = T | null;
10
+ export type InputMaybe<T> = Maybe<T>;
11
+
12
+ export type ConditionalFormatting = {
13
+ __typename?: 'ConditionalFormatting';
14
+ rows?: Maybe<Array<Maybe<ConditionalMetric>>>;
15
+ };
16
+ export type Scalars = {
17
+ ID: string;
18
+ String: string;
19
+ Boolean: boolean;
20
+ Int: number;
21
+ Float: number;
22
+ FileUpload: any;
23
+ GUID: string;
24
+ JSON: {
25
+ [key: string]: any;
26
+ };
27
+ JSONObject: any;
28
+ Long: any;
29
+ };
30
+ export declare enum BackgroundFormatTypes {
31
+ Gradient = 'GRADIENT',
32
+ Solid = 'SOLID',
33
+ }
34
+ export enum ConditionalFormattingComparisonTypes {
35
+ ColumnBased = 'COLUMN_BASED',
36
+ ParameterBased = 'PARAMETER_BASED',
37
+ ValueBased = 'VALUE_BASED',
38
+ }
39
+ export type FontAttrs = {
40
+ __typename?: 'FontAttrs';
41
+ bold?: Maybe<Scalars['Boolean']>;
42
+ color?: Maybe<Scalars['String']>;
43
+ italic?: Maybe<Scalars['Boolean']>;
44
+ strikeThrough?: Maybe<Scalars['Boolean']>;
45
+ underline?: Maybe<Scalars['Boolean']>;
46
+ };
47
+ export type GradientBackgroundAttrs = {
48
+ __typename?: 'GradientBackgroundAttrs';
49
+ backgroundFormatMidpoint?: Maybe<Scalars['Float']>;
50
+ backgroundFormatRange?: Maybe<Array<Maybe<Scalars['Float']>>>;
51
+ colors?: Maybe<Array<Maybe<Scalars['String']>>>;
52
+ };
53
+ export enum Operators {
54
+ Contains = 'CONTAINS',
55
+ DoesNotContain = 'DOES_NOT_CONTAIN',
56
+ EndsWith = 'ENDS_WITH',
57
+ EqualTo = 'EQUAL_TO',
58
+ GreaterThan = 'GREATER_THAN',
59
+ GreaterThanEqualTo = 'GREATER_THAN_EQUAL_TO',
60
+ Is = 'IS',
61
+ IsBetween = 'IS_BETWEEN',
62
+ IsEmpty = 'IS_EMPTY',
63
+ IsNot = 'IS_NOT',
64
+ IsNotEmpty = 'IS_NOT_EMPTY',
65
+ IsNotNull = 'IS_NOT_NULL',
66
+ IsNull = 'IS_NULL',
67
+ LessThan = 'LESS_THAN',
68
+ LessThanEqualTo = 'LESS_THAN_EQUAL_TO',
69
+ NotEqualTo = 'NOT_EQUAL_TO',
70
+ StartsWith = 'STARTS_WITH',
71
+ }
72
+ export type SolidBackgroundAttrs = {
73
+ __typename?: 'SolidBackgroundAttrs';
74
+ color?: Maybe<Scalars['String']>;
75
+ };
76
+ export type Range = {
77
+ __typename?: 'Range';
78
+ max?: Maybe<Scalars['Float']>;
79
+ min?: Maybe<Scalars['Float']>;
80
+ };
81
+ export type ConditionalMetric = {
82
+ __typename?: 'ConditionalMetric';
83
+ backgroundFormatType?: Maybe<BackgroundFormatTypes>;
84
+ comparisonParameterId?: Maybe<Scalars['String']>;
85
+ comparisonType?: Maybe<ConditionalFormattingComparisonTypes>;
86
+ fontProperties?: Maybe<FontAttrs>;
87
+ gradientBackgroundAttrs?: Maybe<GradientBackgroundAttrs>;
88
+ isHighlightRow?: Maybe<Scalars['Boolean']>;
89
+ lhsColumnId?: Maybe<Scalars['String']>;
90
+ operator?: Maybe<Operators>;
91
+ plotAsBand?: Maybe<Scalars['Boolean']>;
92
+ rangeValues?: Maybe<Range>;
93
+ rhsColumnId?: Maybe<Scalars['String']>;
94
+ solidBackgroundAttrs?: Maybe<SolidBackgroundAttrs>;
95
+ value?: Maybe<Scalars['String']>;
96
+ };
97
+
98
+ export type Parameter = {
99
+ __typename?: 'Parameter';
100
+ dataType: FalconDataType;
101
+ defaultValue: Scalars['String'];
102
+ description: Scalars['String'];
103
+ id: Scalars['GUID'];
104
+ name: Scalars['String'];
105
+ /** If not present, the parameter has not been overridden */
106
+ overrideValue?: Maybe<Scalars['String']>;
107
+ owner: ParameterOwnerInfo;
108
+ valueList?: Maybe<Array<ParameterValueListItem>>;
109
+ valueRange?: Maybe<ParameterValueRange>;
110
+ valueType: ParameterValueType;
111
+ };
112
+
113
+ export enum FalconDataType {
114
+ Bool = 'BOOL',
115
+ Char = 'CHAR',
116
+ Date = 'DATE',
117
+ DateTime = 'DATE_TIME',
118
+ Double = 'DOUBLE',
119
+ Float = 'FLOAT',
120
+ Int32 = 'INT32',
121
+ Int64 = 'INT64',
122
+ List = 'LIST',
123
+ ListBool = 'LIST_BOOL',
124
+ ListDate = 'LIST_DATE',
125
+ ListDateTime = 'LIST_DATE_TIME',
126
+ ListDouble = 'LIST_DOUBLE',
127
+ ListInt = 'LIST_INT',
128
+ ListString = 'LIST_STRING',
129
+ ListTime = 'LIST_TIME',
130
+ MaxType = 'MAX_TYPE',
131
+ Time = 'TIME',
132
+ Unknown = 'UNKNOWN',
133
+ }
134
+ export type ParameterOwnerInfo = {
135
+ __typename?: 'ParameterOwnerInfo';
136
+ id: Scalars['GUID'];
137
+ name: Scalars['String'];
138
+ type: ParameterOwnerType;
139
+ };
140
+
141
+ export enum ParameterOwnerType {
142
+ Answer = 'ANSWER',
143
+ Worksheet = 'WORKSHEET',
144
+ }
145
+
146
+ export type ParameterValueListItem = {
147
+ __typename?: 'ParameterValueListItem';
148
+ displayAs?: Maybe<Scalars['String']>;
149
+ value: Scalars['String'];
150
+ };
151
+
152
+ export type ParameterValueListItemInput = {
153
+ displayAs?: InputMaybe<Scalars['String']>;
154
+ value: Scalars['String'];
155
+ };
156
+
157
+ export type ParameterValueRange = {
158
+ __typename?: 'ParameterValueRange';
159
+ max?: Maybe<Scalars['Float']>;
160
+ min?: Maybe<Scalars['Float']>;
161
+ };
162
+
163
+ export type ParameterValueRangeInput = {
164
+ max?: InputMaybe<Scalars['Float']>;
165
+ min?: InputMaybe<Scalars['Float']>;
166
+ };
167
+
168
+ export enum ParameterValueType {
169
+ Any = 'ANY',
170
+ List = 'LIST',
171
+ Range = 'RANGE',
172
+ }
@@ -14,6 +14,8 @@
14
14
  * Copyright: ThoughtSpot Inc. 2023
15
15
  */
16
16
 
17
+ import { 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[];
@@ -1,3 +1,4 @@
1
+ import { AllowedConfigurations } from '../main/custom-chart-context';
1
2
  import { ChartColumn } from './answer-column.types';
2
3
  import { Point } from './chart-to-ts-event.types';
3
4
  import {
@@ -159,6 +160,13 @@ export interface InitializeEventPayload {
159
160
  * @version SDK: 0.1 | ThoughtSpot:
160
161
  */
161
162
  hostUrl: string;
163
+ /**
164
+ * The selector of the container element where the chart will be rendered. Used for internal
165
+ * charts, external custom charts mostly have their own DOM.
166
+ *
167
+ * @version SDK: 0.2 | ThoughtSpot:
168
+ */
169
+ containerElSelector: string;
162
170
  }
163
171
 
164
172
  /**
@@ -191,6 +199,13 @@ export interface InitializeEventResponsePayload {
191
199
  * @version SDK: 0.1 | ThoughtSpot:
192
200
  */
193
201
  visualPropEditorDefinition?: VisualPropEditorDefinition;
202
+ /**
203
+ * Toggle native configurations supported by TS UI. Ex: column level number and conditional
204
+ * formatting.
205
+ *
206
+ * @version SDK: 0.1 | ThoughtSpot:
207
+ */
208
+ allowedConfigurations?: AllowedConfigurations;
194
209
  }
195
210
 
196
211
  /**
@@ -8,6 +8,8 @@
8
8
  * Copyright: ThoughtSpot Inc. 2023
9
9
  */
10
10
 
11
+ import { CustomChartContext } from '../main/custom-chart-context';
12
+ import { ChartModel } from './common.types';
11
13
  /**
12
14
  * Configuration for input validation rules
13
15
  */
@@ -373,6 +375,11 @@ export interface VisualPropEditorDefinition {
373
375
  elements: PropElement[];
374
376
  }
375
377
 
378
+ export type VisualEditorDefinitionSetter = (
379
+ currentState: ChartModel,
380
+ ctx: CustomChartContext,
381
+ ) => VisualPropEditorDefinition;
382
+
376
383
  /**
377
384
  * Example config to be able to store config in the following keys
378
385
  * 1. range.xaxis.min