@thoughtspot/ts-chart-sdk 0.0.1-alpha.0 → 0.0.1-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 (134) hide show
  1. package/README.md +782 -0
  2. package/cjs/index.d.ts +9 -0
  3. package/cjs/index.d.ts.map +1 -0
  4. package/cjs/index.js +25 -0
  5. package/cjs/index.js.map +1 -0
  6. package/cjs/main/custom-chart-context.d.ts +47 -0
  7. package/cjs/main/custom-chart-context.d.ts.map +1 -0
  8. package/cjs/main/custom-chart-context.js +326 -0
  9. package/cjs/main/custom-chart-context.js.map +1 -0
  10. package/cjs/main/custom-chart-context.spec.d.ts +2 -0
  11. package/cjs/main/custom-chart-context.spec.d.ts.map +1 -0
  12. package/cjs/main/custom-chart-context.spec.js +699 -0
  13. package/cjs/main/custom-chart-context.spec.js.map +1 -0
  14. package/cjs/main/post-message-event-bridge.d.ts +6 -0
  15. package/cjs/main/post-message-event-bridge.d.ts.map +1 -0
  16. package/cjs/main/post-message-event-bridge.js +46 -0
  17. package/cjs/main/post-message-event-bridge.js.map +1 -0
  18. package/cjs/main/post-message-event-bridge.spec.d.ts +2 -0
  19. package/cjs/main/post-message-event-bridge.spec.d.ts.map +1 -0
  20. package/cjs/main/post-message-event-bridge.spec.js +124 -0
  21. package/cjs/main/post-message-event-bridge.spec.js.map +1 -0
  22. package/cjs/react/mocks/custom-chart-context-mock.d.ts +3 -0
  23. package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +1 -0
  24. package/cjs/react/mocks/custom-chart-context-mock.js +100 -0
  25. package/cjs/react/mocks/custom-chart-context-mock.js.map +1 -0
  26. package/cjs/react/use-custom-chart-context.d.ts +4 -0
  27. package/cjs/react/use-custom-chart-context.d.ts.map +1 -0
  28. package/cjs/react/use-custom-chart-context.js +95 -0
  29. package/cjs/react/use-custom-chart-context.js.map +1 -0
  30. package/cjs/react/use-custom-chart-context.spec.d.ts +2 -0
  31. package/cjs/react/use-custom-chart-context.spec.d.ts.map +1 -0
  32. package/cjs/react/use-custom-chart-context.spec.js +391 -0
  33. package/cjs/react/use-custom-chart-context.spec.js.map +1 -0
  34. package/cjs/react/use-custom-chart-context.util.d.ts +6 -0
  35. package/cjs/react/use-custom-chart-context.util.d.ts.map +1 -0
  36. package/cjs/react/use-custom-chart-context.util.js +60 -0
  37. package/cjs/react/use-custom-chart-context.util.js.map +1 -0
  38. package/cjs/react/use-custom-chart-types.d.ts +23 -0
  39. package/cjs/react/use-custom-chart-types.d.ts.map +1 -0
  40. package/cjs/react/use-custom-chart-types.js +3 -0
  41. package/cjs/react/use-custom-chart-types.js.map +1 -0
  42. package/cjs/test/test-utils.d.ts +7 -0
  43. package/cjs/test/test-utils.d.ts.map +1 -0
  44. package/cjs/test/test-utils.js +14 -0
  45. package/cjs/test/test-utils.js.map +1 -0
  46. package/cjs/types/answer-column.types.d.ts +69 -0
  47. package/cjs/types/answer-column.types.d.ts.map +1 -0
  48. package/cjs/types/answer-column.types.js +59 -0
  49. package/cjs/types/answer-column.types.js.map +1 -0
  50. package/cjs/types/chart-to-ts-event.types.d.ts +98 -0
  51. package/cjs/types/chart-to-ts-event.types.d.ts.map +1 -0
  52. package/cjs/types/chart-to-ts-event.types.js +32 -0
  53. package/cjs/types/chart-to-ts-event.types.js.map +1 -0
  54. package/cjs/types/common.types.d.ts +52 -0
  55. package/cjs/types/common.types.d.ts.map +1 -0
  56. package/cjs/types/common.types.js +3 -0
  57. package/cjs/types/common.types.js.map +1 -0
  58. package/cjs/types/configurator.types.d.ts +15 -0
  59. package/cjs/types/configurator.types.d.ts.map +1 -0
  60. package/cjs/types/configurator.types.js +3 -0
  61. package/cjs/types/configurator.types.js.map +1 -0
  62. package/cjs/types/ts-to-chart-event.types.d.ts +91 -0
  63. package/cjs/types/ts-to-chart-event.types.d.ts.map +1 -0
  64. package/cjs/types/ts-to-chart-event.types.js +18 -0
  65. package/cjs/types/ts-to-chart-event.types.js.map +1 -0
  66. package/cjs/types/visual-prop.types.d.ts +73 -0
  67. package/cjs/types/visual-prop.types.d.ts.map +1 -0
  68. package/cjs/types/visual-prop.types.js +3 -0
  69. package/cjs/types/visual-prop.types.js.map +1 -0
  70. package/dist/ts-chart-sdk.d.ts +151 -23
  71. package/lib/index.d.ts +1 -0
  72. package/lib/index.d.ts.map +1 -1
  73. package/lib/index.js +1 -0
  74. package/lib/index.js.map +1 -1
  75. package/lib/main/custom-chart-context.d.ts +12 -3
  76. package/lib/main/custom-chart-context.d.ts.map +1 -1
  77. package/lib/main/custom-chart-context.js +128 -9
  78. package/lib/main/custom-chart-context.js.map +1 -1
  79. package/lib/main/custom-chart-context.spec.js +381 -25
  80. package/lib/main/custom-chart-context.spec.js.map +1 -1
  81. package/lib/main/post-message-event-bridge.js +1 -1
  82. package/lib/main/post-message-event-bridge.js.map +1 -1
  83. package/lib/main/post-message-event-bridge.spec.js +5 -3
  84. package/lib/main/post-message-event-bridge.spec.js.map +1 -1
  85. package/lib/react/mocks/custom-chart-context-mock.d.ts +3 -0
  86. package/lib/react/mocks/custom-chart-context-mock.d.ts.map +1 -0
  87. package/lib/react/mocks/custom-chart-context-mock.js +94 -0
  88. package/lib/react/mocks/custom-chart-context-mock.js.map +1 -0
  89. package/lib/react/use-custom-chart-context.d.ts +4 -0
  90. package/lib/react/use-custom-chart-context.d.ts.map +1 -0
  91. package/lib/react/use-custom-chart-context.js +68 -0
  92. package/lib/react/use-custom-chart-context.js.map +1 -0
  93. package/lib/react/use-custom-chart-context.spec.d.ts +2 -0
  94. package/lib/react/use-custom-chart-context.spec.d.ts.map +1 -0
  95. package/lib/react/use-custom-chart-context.spec.js +363 -0
  96. package/lib/react/use-custom-chart-context.spec.js.map +1 -0
  97. package/lib/react/use-custom-chart-context.util.d.ts +6 -0
  98. package/lib/react/use-custom-chart-context.util.d.ts.map +1 -0
  99. package/lib/react/use-custom-chart-context.util.js +51 -0
  100. package/lib/react/use-custom-chart-context.util.js.map +1 -0
  101. package/lib/react/use-custom-chart-types.d.ts +23 -0
  102. package/lib/react/use-custom-chart-types.d.ts.map +1 -0
  103. package/lib/react/use-custom-chart-types.js +2 -0
  104. package/lib/react/use-custom-chart-types.js.map +1 -0
  105. package/lib/types/chart-to-ts-event.types.d.ts +63 -13
  106. package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
  107. package/lib/types/chart-to-ts-event.types.js +13 -0
  108. package/lib/types/chart-to-ts-event.types.js.map +1 -1
  109. package/lib/types/common.types.d.ts +9 -8
  110. package/lib/types/common.types.d.ts.map +1 -1
  111. package/lib/types/ts-to-chart-event.types.d.ts +25 -1
  112. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  113. package/lib/types/ts-to-chart-event.types.js +3 -0
  114. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  115. package/lib/types/visual-prop.types.d.ts +27 -1
  116. package/lib/types/visual-prop.types.d.ts.map +1 -1
  117. package/package.json +9 -3
  118. package/src/index.ts +1 -0
  119. package/src/main/custom-chart-context.spec.ts +513 -26
  120. package/src/main/custom-chart-context.ts +269 -18
  121. package/src/main/post-message-event-bridge.spec.ts +5 -3
  122. package/src/main/post-message-event-bridge.ts +3 -3
  123. package/src/react/mocks/custom-chart-context-mock.ts +114 -0
  124. package/src/react/use-custom-chart-context.spec.tsx +464 -0
  125. package/src/react/use-custom-chart-context.tsx +180 -0
  126. package/src/react/use-custom-chart-context.util.ts +101 -0
  127. package/src/react/use-custom-chart-types.ts +70 -0
  128. package/src/types/answer-column.types.ts +5 -5
  129. package/src/types/chart-to-ts-event.types.ts +233 -31
  130. package/src/types/common.types.ts +37 -26
  131. package/src/types/configurator.types.ts +8 -8
  132. package/src/types/ts-to-chart-event.types.ts +80 -4
  133. package/src/types/visual-prop.types.ts +148 -11
  134. package/lib/dist/ts-chart-sdk.d.ts +0 -312
@@ -6,7 +6,7 @@
6
6
  * Copyright: ThoughtSpot Inc. 2023
7
7
  */
8
8
 
9
- import { ChartColumn, DataType } from './answer-column.types';
9
+ import { ChartColumn } from './answer-column.types';
10
10
 
11
11
  /**
12
12
  * List of Columns for a dimension in the Custom Chart Config.
@@ -18,13 +18,13 @@ import { ChartColumn, DataType } from './answer-column.types';
18
18
  */
19
19
  export interface ChartConfigDimension {
20
20
  /**
21
- * key fo the dimension in the chart config
21
+ * Key for the dimension in the chart config
22
22
  *
23
23
  * @version SDK: 0.1 | ThoughtSpot:
24
24
  */
25
25
  key: string;
26
26
  /**
27
- * list of columns added for the dimension
27
+ * List of columns added for the dimension
28
28
  *
29
29
  * @version SDK: 0.1 | ThoughtSpot:
30
30
  */
@@ -40,8 +40,8 @@ export interface ChartConfigDimension {
40
40
  */
41
41
  export interface ChartConfig {
42
42
  /**
43
- * key of the custom chart config defined in the chart config editor definition
44
- * this is used to differentiate between different custom chart configurations
43
+ * Key of the custom chart config defined in the chart config editor definition
44
+ * This is used to differentiate between different custom chart configurations
45
45
  * within the same chart
46
46
  *
47
47
  * @version SDK: 0.1 | ThoughtSpot:
@@ -56,35 +56,32 @@ export interface ChartConfig {
56
56
  }
57
57
 
58
58
  /**
59
- * Data Array inteface to define each column data
59
+ * Data Points Array interface to define data for each row and column.
60
+ * Data is ordered as per the columns in the query and the rows are sorted
61
+ * as per the search query.
60
62
  *
61
63
  * @version SDK: 0.1 | ThoughtSpot:
62
64
  * @group Chart Model
63
65
  */
64
- export type DataArray = {
66
+ export type DataPointsArray = {
65
67
  /**
66
- * column id associated with the data array
68
+ * Array of column IDs ordered as per the data query
67
69
  *
68
70
  * @version SDK: 0.1 | ThoughtSpot:
69
71
  */
70
- columnId: string;
71
- /**
72
- * type of data
73
- *
74
- * @version SDK: 0.1 | ThoughtSpot:
75
- */
76
- columnDataType: DataType;
72
+ columns: string[];
73
+
77
74
  /**
78
- * The array of data values associated with the column
75
+ * Array of rows of data ordered by the columns
79
76
  *
80
77
  * @version SDK: 0.1 | ThoughtSpot:
81
78
  */
82
- dataValue: any[];
79
+ dataValue: any[][];
83
80
  };
84
81
 
85
82
  /**
86
83
  * For each query defined by the user, a query data object is sent
87
- * in the following format
84
+ * in this format.
88
85
  *
89
86
  * @version SDK: 0.1 | ThoughtSpot:
90
87
  * @group Chart Model
@@ -95,21 +92,21 @@ export type QueryData = {
95
92
  *
96
93
  * @version SDK: 0.1 | ThoughtSpot:
97
94
  */
98
- data: DataArray[];
95
+ data: DataPointsArray;
99
96
 
100
97
  /**
101
98
  * @hidden
102
99
  * @version SDK: 0.1 | ThoughtSpot:
103
100
  */
104
- completionRatio: number;
101
+ completionRatio?: number;
105
102
  /**
106
103
  * @hidden
107
104
  * @version SDK: 0.1 | ThoughtSpot:
108
105
  */
109
- samplingRatio: number;
106
+ samplingRatio?: number;
110
107
 
111
108
  /**
112
- * number of rows of data fetched for the query
109
+ * Number of rows of data fetched for the query
113
110
  *
114
111
  * @version SDK: 0.1 | ThoughtSpot:
115
112
  */
@@ -130,7 +127,7 @@ export interface ChartModel {
130
127
  */
131
128
  columns: ChartColumn[];
132
129
  /**
133
- * Array of Datasets for each query
130
+ * Array of datasets for each query
134
131
  *
135
132
  * @version SDK: 0.1 | ThoughtSpot:
136
133
  */
@@ -152,23 +149,26 @@ export type ValidationResponse = {
152
149
  /**
153
150
  * Custom Visual props is the stored metadata for the visual props definition
154
151
  * configured by the user in the visual prop editor
155
- * The JSON is defined by the visual prop types. See VisualPropEditorDefinition
152
+ * The JSON is defined by the visual prop types. See VisualPropEditorDefinition.
156
153
  *
157
154
  * @group Chart Model
158
155
  * @version SDK: 0.1 | ThoughtSpot:
159
156
  */
160
157
  export type VisualProps = JSON;
161
158
 
162
- // Todo: this should be imported from custom style config package.
159
+ // Todo: this should be imported from the custom style config package.
163
160
  type CustomStylingConfig = any;
164
161
 
165
162
  export interface AppConfig {
163
+ /**
164
+ * @hidden
165
+ */
166
166
  styleConfig?: CustomStylingConfig;
167
167
 
168
168
  appOptions?: {
169
169
  isMobile?: boolean;
170
170
  isPrintMode?: boolean; // export mode on/off
171
-
171
+ isLiveboardContext?: boolean; // if chart renders in liveboard context
172
172
  // runtime configurations
173
173
  isDebugMode?: boolean; // enables debug mode for logging
174
174
  };
@@ -180,8 +180,19 @@ export interface AppConfig {
180
180
  sessionTimezone: string;
181
181
  };
182
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
+
183
191
  // Idea: we might be able to map this to data and ask user to read data in a
184
192
  // certain way the transformations for point during context menu operations
185
193
  // need to be explored
194
+ /**
195
+ * @hidden
196
+ */
186
197
  customCalendarConfig?: any; // this is to initialize custom calendar service
187
198
  }
@@ -2,12 +2,12 @@
2
2
  * @file Column Configuration Definition
3
3
  * @fileoverview
4
4
  * Developers will use this to define the axis configuration that any
5
- * creator of the chart can use the define the expected chart configuration.
5
+ * creator of the chart can use it to define the expected chart configuration.
6
6
  *
7
7
  * This will also be validated with the overall expectation
8
8
  * of the chart developer using validate flow.
9
9
  *
10
- * Developer is expected to use this to be able to define the data queries
10
+ * Developers are expected to use this to define the data queries
11
11
  * required for the chart.
12
12
  * @author Chetan Agrawal <chetan.agrawal@thoughtspot.com>
13
13
  *
@@ -20,7 +20,7 @@
20
20
  */
21
21
  export interface ChartConfigSection {
22
22
  /**
23
- * key to persist the columns
23
+ * Key to persist the columns
24
24
  *
25
25
  * @version SDK: 0.1 | ThoughtSpot:
26
26
  */
@@ -33,9 +33,9 @@ export interface ChartConfigSection {
33
33
  label: string;
34
34
 
35
35
  /**
36
- * In the UI, the following values will only prevent from dropping unnecessary
37
- * columns on the section config or prevent from opening a drop down in case of
38
- * multiple queries. Validation is still expected to be done by developer.
36
+ * In the UI, the following values will only prevent dropping unnecessary
37
+ * columns on the section config or prevent users from opening a drop-down in case of
38
+ * multiple queries. Developers must validate this flow.
39
39
  */
40
40
 
41
41
  /**
@@ -76,7 +76,7 @@ export interface ChartConfigSection {
76
76
  */
77
77
  export interface ChartConfigEditorDefinition {
78
78
  /**
79
- * key to store the chart config
79
+ * Key to store the chart config
80
80
  *
81
81
  * @version SDK: 0.1 | ThoughtSpot:
82
82
  */
@@ -94,7 +94,7 @@ export interface ChartConfigEditorDefinition {
94
94
  */
95
95
  descriptionText?: string;
96
96
  /**
97
- * Following will define all the column sections for the chart config
97
+ * Defines all the column sections for the chart config
98
98
  *
99
99
  * @version SDK: 0.1 | ThoughtSpot:
100
100
  */
@@ -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,
@@ -11,7 +12,7 @@ import { ChartConfigEditorDefinition } from './configurator.types';
11
12
  import { VisualPropEditorDefinition } from './visual-prop.types';
12
13
 
13
14
  /**
14
- * All the events sent from TS application to Custom Chart App
15
+ * All the events sent from the ThoughtSpot application to Custom Chart App
15
16
  *
16
17
  * @version SDK: 0.1 | ThoughtSpot:
17
18
  * @group ThoughtSpot to Chart Events
@@ -21,6 +22,10 @@ export enum TSToChartEvent {
21
22
  * @version SDK: 0.1 | ThoughtSpot:
22
23
  */
23
24
  Initialize = 'Initialize',
25
+ /**
26
+ * @version SDK: 0.1 | ThoughtSpot:
27
+ */
28
+ InitializeComplete = 'InitializeComplete',
24
29
 
25
30
  /**
26
31
  * @version SDK: 0.1 | ThoughtSpot:
@@ -53,6 +58,16 @@ export enum TSToChartEvent {
53
58
  * @version SDK: 0.1 | ThoughtSpot:
54
59
  */
55
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',
56
71
  }
57
72
 
58
73
  /**
@@ -85,6 +100,8 @@ export interface TSToChartInternalEventsPayloadMap {
85
100
  payload: InitializeEventPayload,
86
101
  ) => InitializeEventResponsePayload;
87
102
 
103
+ [TSToChartEvent.InitializeComplete]: () => void;
104
+
88
105
  [TSToChartEvent.GetDataQuery]: (
89
106
  payload: GetDataQueryPayload,
90
107
  ) => GetDataQueryResponsePayload;
@@ -98,6 +115,14 @@ export interface TSToChartInternalEventsPayloadMap {
98
115
  ) => ValidationResponse;
99
116
 
100
117
  [TSToChartEvent.TriggerRenderChart]: () => void;
118
+
119
+ [TSToChartEvent.ContextMenuActionClick]: (
120
+ payload: ContextMenuCustomActionPayload,
121
+ ) => void;
122
+
123
+ [TSToChartEvent.AxisMenuActionClick]: (
124
+ payload: AxisMenuCustomActionPayload,
125
+ ) => void;
101
126
  }
102
127
 
103
128
  /**
@@ -113,7 +138,7 @@ export interface InitializeEventPayload {
113
138
  chartModel: ChartModel;
114
139
 
115
140
  /**
116
- * Additional App Configuration
141
+ * Additional app configuration
117
142
  *
118
143
  * @version SDK: 0.1 | ThoughtSpot:
119
144
  */
@@ -121,13 +146,13 @@ export interface InitializeEventPayload {
121
146
 
122
147
  /**
123
148
  * This is a unique component id that the context should send in every
124
- * post message payload. This helps in identifying between multiple app components.
149
+ * post message payload. This helps in identifying multiple app components.
125
150
  *
126
151
  * @version SDK: 0.1 | ThoughtSpot:
127
152
  */
128
153
  componentId: string;
129
154
  /**
130
- * The host url of the parent to send the post message requests to.
155
+ * The host URL of the parent to send the post message requests to.
131
156
  * We cannot use the window.parent object details to fetch this.
132
157
  * Hence sending in init flow.
133
158
  *
@@ -255,3 +280,54 @@ export interface ChartConfigValidateEventPayload {
255
280
  */
256
281
  chartConfig: ChartConfig[];
257
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
+ }
@@ -8,6 +8,60 @@
8
8
  * Copyright: ThoughtSpot Inc. 2023
9
9
  */
10
10
 
11
+ /**
12
+ * Configuration for input validation rules
13
+ */
14
+ export interface InputValidation {
15
+ /**
16
+ * Determines if the input is required.
17
+ *
18
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
19
+ */
20
+ required?: boolean;
21
+ /**
22
+ * Error message to display when input is required but not provided.
23
+ *
24
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
25
+ */
26
+ requiredError?: string;
27
+ /**
28
+ * Regular expression pattern to validate the input against.
29
+ *
30
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
31
+ */
32
+ regex?: string;
33
+ /**
34
+ * Error message to display when input doesn't match the regex pattern.
35
+ *
36
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
37
+ */
38
+ regexError?: string;
39
+ /**
40
+ * Minimum length required for the input.
41
+ *
42
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
43
+ */
44
+ minLength?: number;
45
+ /**
46
+ * Error message to display when input length is less than the required minimum.
47
+ *
48
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
49
+ */
50
+ minLengthError?: string;
51
+ /**
52
+ * Range of values allowed for the input.
53
+ *
54
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
55
+ */
56
+ range?: string;
57
+ /**
58
+ * Error message to display when input value is outside the allowed range.
59
+ *
60
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
61
+ */
62
+ rangeError?: string;
63
+ }
64
+
11
65
  /**
12
66
  * Text Form Element for the visual props editor
13
67
  *
@@ -16,7 +70,7 @@
16
70
  export interface TextInputFormDetail {
17
71
  type: 'text';
18
72
  /**
19
- * key to store the value
73
+ * Key to store the value
20
74
  *
21
75
  * @version SDK: 0.1 | ThoughtSpot:
22
76
  */
@@ -35,7 +89,7 @@ export interface TextInputFormDetail {
35
89
  */
36
90
  password?: boolean;
37
91
  /**
38
- * Allow multiline text
92
+ * Allows multiline text
39
93
  *
40
94
  * @default false
41
95
  * @version SDK: 0.1 | ThoughtSpot:
@@ -53,6 +107,79 @@ export interface TextInputFormDetail {
53
107
  * @version SDK: 0.1 | ThoughtSpot:
54
108
  */
55
109
  defaultValue?: string;
110
+ /**
111
+ * inputValidation config for input field
112
+ *
113
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
114
+ */
115
+ inputValidation?: InputValidation;
116
+ }
117
+
118
+ /**
119
+ * Number Form Element for the visual props editor
120
+ *
121
+ * @group Visual Properties Editor
122
+ */
123
+ export interface NumberInputFormDetail {
124
+ type: 'number';
125
+ /**
126
+ * Key to store the value
127
+ *
128
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
129
+ */
130
+ key: string;
131
+ /**
132
+ * I18n'ed string to show on the form label
133
+ *
134
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
135
+ */
136
+ label?: string;
137
+ /**
138
+ * Default value
139
+ *
140
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
141
+ */
142
+ defaultValue?: number;
143
+ /**
144
+ * inputValidation config for input field
145
+ *
146
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
147
+ */
148
+ inputValidation?: InputValidation;
149
+ }
150
+
151
+ /**
152
+ * Color Picker Form Element for the visual props editor
153
+ *
154
+ * @group Visual Properties Editor
155
+ */
156
+ export interface ColorPickerFormDetail {
157
+ type: 'colorpicker';
158
+ /**
159
+ * Key to store the value
160
+ *
161
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
162
+ */
163
+ key: string;
164
+ /**
165
+ * I18n'ed string to show on the form label
166
+ *
167
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
168
+ */
169
+ label?: string;
170
+ /**
171
+ * Display selected color with font or with color only
172
+ *
173
+ * @default COLOR
174
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
175
+ */
176
+ selectorType?: 'FONT' | 'COLOR';
177
+ /**
178
+ * Default value
179
+ *
180
+ * @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
181
+ */
182
+ defaultValue?: string;
56
183
  }
57
184
 
58
185
  /**
@@ -63,7 +190,7 @@ export interface TextInputFormDetail {
63
190
  export interface ToggleFormDetail {
64
191
  type: 'toggle';
65
192
  /**
66
- * key to store the value
193
+ * Key to store the value
67
194
  *
68
195
  * @version SDK: 0.1 | ThoughtSpot:
69
196
  */
@@ -90,7 +217,7 @@ export interface ToggleFormDetail {
90
217
  export interface CheckboxFormDetail {
91
218
  type: 'checkbox';
92
219
  /**
93
- * key to store the value
220
+ * Key to store the value
94
221
  *
95
222
  * @version SDK: 0.1 | ThoughtSpot:
96
223
  */
@@ -117,7 +244,7 @@ export interface CheckboxFormDetail {
117
244
  export interface RadioButtonFormDetail {
118
245
  type: 'radio';
119
246
  /**
120
- * key to store the value
247
+ * Key to store the value
121
248
  *
122
249
  * @version SDK: 0.1 | ThoughtSpot:
123
250
  */
@@ -135,7 +262,7 @@ export interface RadioButtonFormDetail {
135
262
  */
136
263
  defaultValue?: string;
137
264
  /**
138
- * list fo values to select from
265
+ * List of values to select from
139
266
  *
140
267
  * @version SDK: 0.1 | ThoughtSpot:
141
268
  */
@@ -150,7 +277,7 @@ export interface RadioButtonFormDetail {
150
277
  export interface DropDownFormDetail {
151
278
  type: 'dropdown';
152
279
  /**
153
- * key to store the value
280
+ * Key to store the value
154
281
  *
155
282
  * @version SDK: 0.1 | ThoughtSpot:
156
283
  */
@@ -168,7 +295,7 @@ export interface DropDownFormDetail {
168
295
  */
169
296
  defaultValue?: string;
170
297
  /**
171
- * list fo values to select from
298
+ * List of values to select from
172
299
  *
173
300
  * @version SDK: 0.1 | ThoughtSpot:
174
301
  */
@@ -176,14 +303,14 @@ export interface DropDownFormDetail {
176
303
  }
177
304
 
178
305
  /**
179
- * Element to define sections of form for the visual props editor
306
+ * Element to define sections of the form for the visual props editor
180
307
  *
181
308
  * @group Visual Properties Editor
182
309
  */
183
310
  export interface Section {
184
311
  type: 'section';
185
312
  /**
186
- * key to define & store the children's parent
313
+ * Key to define & store the children's parent
187
314
  *
188
315
  * @version SDK: 0.1 | ThoughtSpot:
189
316
  */
@@ -201,11 +328,19 @@ export interface Section {
201
328
  */
202
329
  children?: PropElement[];
203
330
  /**
204
- * defines form alignment in the view for the section
331
+ * Defines form alignment in the view for the section
205
332
  *
206
333
  * @version SDK: 0.1 | ThoughtSpot:
207
334
  */
208
335
  alignment?: 'row' | 'column';
336
+ /**
337
+ * Defines form layout in the view for the section.
338
+ * default will be 'accordion' for first section if nothing specified
339
+ * and will be 'none' for all nested section.
340
+ *
341
+ * @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
342
+ */
343
+ layoutType?: 'accordion' | 'tab' | 'none';
209
344
  }
210
345
 
211
346
  /**
@@ -216,6 +351,8 @@ export interface Section {
216
351
  export type PropElement =
217
352
  | Section
218
353
  | TextInputFormDetail
354
+ | NumberInputFormDetail
355
+ | ColorPickerFormDetail
219
356
  | ToggleFormDetail
220
357
  | CheckboxFormDetail
221
358
  | RadioButtonFormDetail