@thoughtspot/ts-chart-sdk 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ts-chart-sdk.d.ts +312 -0
- package/lib/dist/ts-chart-sdk.d.ts +312 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/main/custom-chart-context.d.ts +38 -0
- package/lib/main/custom-chart-context.d.ts.map +1 -0
- package/lib/main/custom-chart-context.js +176 -0
- package/lib/main/custom-chart-context.js.map +1 -0
- package/lib/main/custom-chart-context.spec.d.ts +2 -0
- package/lib/main/custom-chart-context.spec.d.ts.map +1 -0
- package/lib/main/custom-chart-context.spec.js +315 -0
- package/lib/main/custom-chart-context.spec.js.map +1 -0
- package/lib/main/post-message-event-bridge.d.ts +6 -0
- package/lib/main/post-message-event-bridge.d.ts.map +1 -0
- package/lib/main/post-message-event-bridge.js +41 -0
- package/lib/main/post-message-event-bridge.js.map +1 -0
- package/lib/main/post-message-event-bridge.spec.d.ts +2 -0
- package/lib/main/post-message-event-bridge.spec.d.ts.map +1 -0
- package/lib/main/post-message-event-bridge.spec.js +117 -0
- package/lib/main/post-message-event-bridge.spec.js.map +1 -0
- package/lib/test/test-utils.d.ts +7 -0
- package/lib/test/test-utils.d.ts.map +1 -0
- package/lib/test/test-utils.js +11 -0
- package/lib/test/test-utils.js.map +1 -0
- package/lib/types/answer-column.types.d.ts +69 -0
- package/lib/types/answer-column.types.d.ts.map +1 -0
- package/lib/types/answer-column.types.js +56 -0
- package/lib/types/answer-column.types.js.map +1 -0
- package/lib/types/chart-to-ts-event.types.d.ts +48 -0
- package/lib/types/chart-to-ts-event.types.d.ts.map +1 -0
- package/lib/types/chart-to-ts-event.types.js +16 -0
- package/lib/types/chart-to-ts-event.types.js.map +1 -0
- package/lib/types/common.types.d.ts +51 -0
- package/lib/types/common.types.d.ts.map +1 -0
- package/lib/types/common.types.js +2 -0
- package/lib/types/common.types.js.map +1 -0
- package/lib/types/configurator.types.d.ts +15 -0
- package/lib/types/configurator.types.d.ts.map +1 -0
- package/lib/types/configurator.types.js +2 -0
- package/lib/types/configurator.types.js.map +1 -0
- package/lib/types/ts-to-chart-event.types.d.ts +67 -0
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -0
- package/lib/types/ts-to-chart-event.types.js +12 -0
- package/lib/types/ts-to-chart-event.types.js.map +1 -0
- package/lib/types/visual-prop.types.d.ts +47 -0
- package/lib/types/visual-prop.types.d.ts.map +1 -0
- package/lib/types/visual-prop.types.js +2 -0
- package/lib/types/visual-prop.types.js.map +1 -0
- package/package.json +88 -0
- package/src/index.ts +7 -0
- package/src/main/custom-chart-context.spec.ts +432 -0
- package/src/main/custom-chart-context.ts +587 -0
- package/src/main/post-message-event-bridge.spec.ts +215 -0
- package/src/main/post-message-event-bridge.ts +88 -0
- package/src/test/test-utils.ts +13 -0
- package/src/types/answer-column.types.ts +174 -0
- package/src/types/chart-to-ts-event.types.ts +159 -0
- package/src/types/common.types.ts +187 -0
- package/src/types/configurator.types.ts +102 -0
- package/src/types/ts-to-chart-event.types.ts +257 -0
- package/src/types/visual-prop.types.ts +271 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Custom Visual Props Types Definition
|
|
3
|
+
* @fileoverview
|
|
4
|
+
* Following types define the configuration that
|
|
5
|
+
* would be rendered to configure custom visual props
|
|
6
|
+
* @author Chetan Agrawal <chetan.agrawal@thoughtspot.com>
|
|
7
|
+
*
|
|
8
|
+
* Copyright: ThoughtSpot Inc. 2023
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Text Form Element for the visual props editor
|
|
13
|
+
*
|
|
14
|
+
* @group Visual Properties Editor
|
|
15
|
+
*/
|
|
16
|
+
export interface TextInputFormDetail {
|
|
17
|
+
type: 'text';
|
|
18
|
+
/**
|
|
19
|
+
* key to store the value
|
|
20
|
+
*
|
|
21
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
22
|
+
*/
|
|
23
|
+
key: string;
|
|
24
|
+
/**
|
|
25
|
+
* I18n'ed string to show on the form label
|
|
26
|
+
*
|
|
27
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Use text as password
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
35
|
+
*/
|
|
36
|
+
password?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Allow multiline text
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
42
|
+
*/
|
|
43
|
+
multiline?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Placeholder text
|
|
46
|
+
*
|
|
47
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
48
|
+
*/
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Default value
|
|
52
|
+
*
|
|
53
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
54
|
+
*/
|
|
55
|
+
defaultValue?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Toggle Form Element for the visual props editor
|
|
60
|
+
*
|
|
61
|
+
* @group Visual Properties Editor
|
|
62
|
+
*/
|
|
63
|
+
export interface ToggleFormDetail {
|
|
64
|
+
type: 'toggle';
|
|
65
|
+
/**
|
|
66
|
+
* key to store the value
|
|
67
|
+
*
|
|
68
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
69
|
+
*/
|
|
70
|
+
key: string;
|
|
71
|
+
/**
|
|
72
|
+
* I18n'ed string to show on the form label
|
|
73
|
+
*
|
|
74
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
75
|
+
*/
|
|
76
|
+
label?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Default value
|
|
79
|
+
*
|
|
80
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
81
|
+
*/
|
|
82
|
+
defaultValue?: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Checkbox Form Element for the visual props editor
|
|
87
|
+
*
|
|
88
|
+
* @group Visual Properties Editor
|
|
89
|
+
*/
|
|
90
|
+
export interface CheckboxFormDetail {
|
|
91
|
+
type: 'checkbox';
|
|
92
|
+
/**
|
|
93
|
+
* key to store the value
|
|
94
|
+
*
|
|
95
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
96
|
+
*/
|
|
97
|
+
key: string;
|
|
98
|
+
/**
|
|
99
|
+
* I18n'ed string to show on the form label
|
|
100
|
+
*
|
|
101
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
102
|
+
*/
|
|
103
|
+
label?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Default value
|
|
106
|
+
*
|
|
107
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
108
|
+
*/
|
|
109
|
+
defaultValue?: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Radio Form Element for the visual props editor
|
|
114
|
+
*
|
|
115
|
+
* @group Visual Properties Editor
|
|
116
|
+
*/
|
|
117
|
+
export interface RadioButtonFormDetail {
|
|
118
|
+
type: 'radio';
|
|
119
|
+
/**
|
|
120
|
+
* key to store the value
|
|
121
|
+
*
|
|
122
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
123
|
+
*/
|
|
124
|
+
key: string;
|
|
125
|
+
/**
|
|
126
|
+
* I18n'ed string to show on the form label
|
|
127
|
+
*
|
|
128
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
129
|
+
*/
|
|
130
|
+
label?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Default value
|
|
133
|
+
*
|
|
134
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
135
|
+
*/
|
|
136
|
+
defaultValue?: string;
|
|
137
|
+
/**
|
|
138
|
+
* list fo values to select from
|
|
139
|
+
*
|
|
140
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
141
|
+
*/
|
|
142
|
+
values: string[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Dropdown Form Element for the visual props editor
|
|
147
|
+
*
|
|
148
|
+
* @group Visual Properties Editor
|
|
149
|
+
*/
|
|
150
|
+
export interface DropDownFormDetail {
|
|
151
|
+
type: 'dropdown';
|
|
152
|
+
/**
|
|
153
|
+
* key to store the value
|
|
154
|
+
*
|
|
155
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
156
|
+
*/
|
|
157
|
+
key: string;
|
|
158
|
+
/**
|
|
159
|
+
* I18n'ed string to show on the form label
|
|
160
|
+
*
|
|
161
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
162
|
+
*/
|
|
163
|
+
label?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Default value
|
|
166
|
+
*
|
|
167
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
168
|
+
*/
|
|
169
|
+
defaultValue?: string;
|
|
170
|
+
/**
|
|
171
|
+
* list fo values to select from
|
|
172
|
+
*
|
|
173
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
174
|
+
*/
|
|
175
|
+
values: string[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Element to define sections of form for the visual props editor
|
|
180
|
+
*
|
|
181
|
+
* @group Visual Properties Editor
|
|
182
|
+
*/
|
|
183
|
+
export interface Section {
|
|
184
|
+
type: 'section';
|
|
185
|
+
/**
|
|
186
|
+
* key to define & store the children's parent
|
|
187
|
+
*
|
|
188
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
189
|
+
*/
|
|
190
|
+
key: string;
|
|
191
|
+
/**
|
|
192
|
+
* I18n'ed string to show the section name label
|
|
193
|
+
*
|
|
194
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
195
|
+
*/
|
|
196
|
+
label?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Can include either form elements or nested sections
|
|
199
|
+
*
|
|
200
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
201
|
+
*/
|
|
202
|
+
children?: PropElement[];
|
|
203
|
+
/**
|
|
204
|
+
* defines form alignment in the view for the section
|
|
205
|
+
*
|
|
206
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
207
|
+
*/
|
|
208
|
+
alignment?: 'row' | 'column';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Common type placeholder for all the input element types
|
|
213
|
+
*
|
|
214
|
+
* @group Visual Properties Editor
|
|
215
|
+
*/
|
|
216
|
+
export type PropElement =
|
|
217
|
+
| Section
|
|
218
|
+
| TextInputFormDetail
|
|
219
|
+
| ToggleFormDetail
|
|
220
|
+
| CheckboxFormDetail
|
|
221
|
+
| RadioButtonFormDetail
|
|
222
|
+
| DropDownFormDetail;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Visual property editor definition object
|
|
226
|
+
*
|
|
227
|
+
* @group Visual Properties Editor
|
|
228
|
+
*/
|
|
229
|
+
export interface VisualPropEditorDefinition {
|
|
230
|
+
/**
|
|
231
|
+
* Define all the form elements or sections that are required
|
|
232
|
+
* to be configured in the visual prop editor
|
|
233
|
+
*
|
|
234
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
235
|
+
*/
|
|
236
|
+
elements: PropElement[];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Example config to be able to store config in the following keys
|
|
241
|
+
* 1. range.xaxis.min
|
|
242
|
+
* 2. range.xaxis.max
|
|
243
|
+
* 3. range.yaxis.min
|
|
244
|
+
* 4. range.yaxis.max
|
|
245
|
+
const visualPropEditorDefinition = [
|
|
246
|
+
{
|
|
247
|
+
key: 'range',
|
|
248
|
+
type: 'section',
|
|
249
|
+
children: [
|
|
250
|
+
{
|
|
251
|
+
key: 'xaxis',
|
|
252
|
+
label: 'X-Axis'
|
|
253
|
+
type: 'section',
|
|
254
|
+
children: [
|
|
255
|
+
{ key: 'minValue', type: 'TextInput' },
|
|
256
|
+
{ key: 'maxValue', type: 'TextInput' }
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: 'yaxis',
|
|
261
|
+
type: 'section',
|
|
262
|
+
label: 'Y-Axis'
|
|
263
|
+
children: [
|
|
264
|
+
{ key: 'minValue', type: 'TextInput' },
|
|
265
|
+
{ key: 'maxValue', type: 'TextInput' },
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
];
|
|
271
|
+
*/
|