@thoughtspot/ts-chart-sdk 0.0.2-alpha.1 → 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.
- package/dist/ts-chart-sdk.d.ts +730 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/main/custom-chart-context.d.ts +9 -4
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +45 -2
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +155 -3
- 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/react/use-custom-chart-context.spec.js +54 -2
- 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 +54 -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/common.types.d.ts +50 -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 +155 -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/ts-to-chart-event.types.d.ts.map +1 -1
- package/lib/types/visual-prop.types.d.ts +3 -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 +3 -0
- package/src/main/custom-chart-context.spec.ts +183 -5
- package/src/main/custom-chart-context.ts +115 -8
- package/src/main/post-message-event-bridge.ts +2 -2
- package/src/react/use-custom-chart-context.spec.tsx +65 -2
- package/src/test/test-conditional-formatting-utils.ts +95 -0
- package/src/types/answer-column.types.ts +98 -0
- package/src/types/common.types.ts +81 -9
- package/src/types/conditional-formatting.types.ts +172 -0
- package/src/types/configurator.types.ts +21 -0
- package/src/types/ts-to-chart-event.types.ts +2 -1
- package/src/types/visual-prop.types.ts +7 -0
- 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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file: Test Conditional Formatting Utils
|
|
3
|
+
*
|
|
4
|
+
* @author Yashvardhan Nehra <yashvardhan.nehra@thoughtspot.com>
|
|
5
|
+
*
|
|
6
|
+
* Copyright: ThoughtSpot Inc. 2023
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
BackgroundFormatTypes,
|
|
10
|
+
ConditionalFormattingComparisonTypes,
|
|
11
|
+
ConditionalMetric,
|
|
12
|
+
Operators,
|
|
13
|
+
} from '../types/conditional-formatting.types';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a metric operator for conditional formatting.
|
|
17
|
+
*
|
|
18
|
+
* @param operator - The operator to use for the metric (e.g., LessThan, GreaterThan).
|
|
19
|
+
* @param lhsColumnId - (Optional) The ID of the left-hand side column.
|
|
20
|
+
* @param rhsColumnId - (Optional) The ID of the right-hand side column.
|
|
21
|
+
* @param comparisonParameterId - (Optional) The ID of the comparison parameter.
|
|
22
|
+
* @param comparisonType - The type of comparison to use (default is ValueBased).
|
|
23
|
+
* @returns A ConditionalMetric object configured with the specified parameters.
|
|
24
|
+
*/
|
|
25
|
+
export const createMetricOperator = (
|
|
26
|
+
operator: Operators,
|
|
27
|
+
lhsColumnId?: string,
|
|
28
|
+
rhsColumnId?: string,
|
|
29
|
+
comparisonParameterId?: string,
|
|
30
|
+
comparisonType = ConditionalFormattingComparisonTypes.ValueBased,
|
|
31
|
+
): ConditionalMetric => {
|
|
32
|
+
return {
|
|
33
|
+
solidBackgroundAttrs: {
|
|
34
|
+
color: '#000',
|
|
35
|
+
},
|
|
36
|
+
backgroundFormatType: 'SOLID' as BackgroundFormatTypes,
|
|
37
|
+
operator,
|
|
38
|
+
value: '200',
|
|
39
|
+
plotAsBand: false,
|
|
40
|
+
comparisonParameterId,
|
|
41
|
+
comparisonType,
|
|
42
|
+
lhsColumnId,
|
|
43
|
+
rhsColumnId,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates a between metric operator for conditional formatting.
|
|
49
|
+
*
|
|
50
|
+
* @param operator - The operator to use for the metric (e.g., IsBetween).
|
|
51
|
+
* @param min - The minimum value for the range (default is 100).
|
|
52
|
+
* @param max - The maximum value for the range (default is 200).
|
|
53
|
+
* @returns A ConditionalMetric object configured with the specified parameters.
|
|
54
|
+
*/
|
|
55
|
+
export const createBetweenMetricOperator = (
|
|
56
|
+
operator: Operators,
|
|
57
|
+
min = 100,
|
|
58
|
+
max = 200,
|
|
59
|
+
): ConditionalMetric => {
|
|
60
|
+
return {
|
|
61
|
+
backgroundFormatType: 'SOLID' as BackgroundFormatTypes,
|
|
62
|
+
solidBackgroundAttrs: {
|
|
63
|
+
color: '#000',
|
|
64
|
+
},
|
|
65
|
+
operator,
|
|
66
|
+
rangeValues: {
|
|
67
|
+
min,
|
|
68
|
+
max,
|
|
69
|
+
},
|
|
70
|
+
plotAsBand: false,
|
|
71
|
+
lhsColumnId: undefined,
|
|
72
|
+
rhsColumnId: undefined,
|
|
73
|
+
comparisonParameterId: undefined,
|
|
74
|
+
comparisonType: ConditionalFormattingComparisonTypes.ValueBased,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates an attribute operator for conditional formatting.
|
|
80
|
+
*
|
|
81
|
+
* @param operator - The operator to use for the attribute (e.g., Is, IsNot).
|
|
82
|
+
* @param comparisonType - (Optional) The type of comparison to use.
|
|
83
|
+
* @returns A ConditionalMetric object configured with the specified parameters.
|
|
84
|
+
*/
|
|
85
|
+
export const createAttributeOperator = (
|
|
86
|
+
operator: Operators,
|
|
87
|
+
comparisonType?: ConditionalFormattingComparisonTypes,
|
|
88
|
+
): ConditionalMetric => {
|
|
89
|
+
return {
|
|
90
|
+
backgroundFormatType: 'SOLID' as BackgroundFormatTypes,
|
|
91
|
+
operator,
|
|
92
|
+
value: 'check attribute',
|
|
93
|
+
comparisonType,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { ConditionalFormatting, Maybe } from './conditional-formatting.types';
|
|
2
|
+
|
|
1
3
|
export enum ColumnType {
|
|
2
4
|
UNKNOWN,
|
|
3
5
|
MEASURE,
|
|
4
6
|
ATTRIBUTE,
|
|
7
|
+
// Virtual columns that are measure name/value columns
|
|
8
|
+
VIRTUAL,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* When the column is generated for the chart for creating views,
|
|
13
|
+
* on top of measure columns from the worksheet which are part of answer query.
|
|
14
|
+
*/
|
|
15
|
+
export enum ChartSpecificColumnType {
|
|
16
|
+
UNKNOWN,
|
|
17
|
+
MEASURE_NAMES,
|
|
18
|
+
MEASURE_VALUES,
|
|
5
19
|
}
|
|
6
20
|
|
|
7
21
|
/**
|
|
@@ -71,6 +85,51 @@ export enum CurrencyFormatType {
|
|
|
71
85
|
ISO_CODE,
|
|
72
86
|
}
|
|
73
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Type of aggregations applied on the column data
|
|
90
|
+
*
|
|
91
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
92
|
+
*/
|
|
93
|
+
export enum ColumnAggregationType {
|
|
94
|
+
AGGREGATE,
|
|
95
|
+
AGGREGATE_DISTINCT,
|
|
96
|
+
APPROX_AGGR_DISTINCT,
|
|
97
|
+
APPROX_AGGR_DISTINCT_MERGE,
|
|
98
|
+
APPROX_COUNT_DISTINCT,
|
|
99
|
+
AVERAGE,
|
|
100
|
+
COUNT,
|
|
101
|
+
COUNT_DISTINCT,
|
|
102
|
+
CUMULATIVE_AVERAGE,
|
|
103
|
+
CUMULATIVE_COUNT,
|
|
104
|
+
CUMULATIVE_MAX,
|
|
105
|
+
CUMULATIVE_MIN,
|
|
106
|
+
CUMULATIVE_SUM,
|
|
107
|
+
GROWTH,
|
|
108
|
+
MAX,
|
|
109
|
+
MEDIAN,
|
|
110
|
+
MIN,
|
|
111
|
+
MOVING_AVERAGE,
|
|
112
|
+
MOVING_COUNT,
|
|
113
|
+
MOVING_MAX,
|
|
114
|
+
MOVING_MIN,
|
|
115
|
+
MOVING_SUM,
|
|
116
|
+
NONE,
|
|
117
|
+
PERCENTILE,
|
|
118
|
+
RANK,
|
|
119
|
+
RANK_PERCENTILE,
|
|
120
|
+
SQL_BOOL_AGGREGATE_OP,
|
|
121
|
+
SQL_DATE_AGGREGATE_OP,
|
|
122
|
+
SQL_DATE_TIME_AGGREGATE_OP,
|
|
123
|
+
SQL_DOUBLE_AGGREGATE_OP,
|
|
124
|
+
SQL_INT_AGGREGATE_OP,
|
|
125
|
+
SQL_STRING_AGGREGATE_OP,
|
|
126
|
+
SQL_TIME_AGGREGATE_OP,
|
|
127
|
+
STD_DEVIATION,
|
|
128
|
+
SUM,
|
|
129
|
+
TABLE_AGGR,
|
|
130
|
+
VARIANCE,
|
|
131
|
+
}
|
|
132
|
+
|
|
74
133
|
/**
|
|
75
134
|
* Currency format for the column defined in the worksheet
|
|
76
135
|
*
|
|
@@ -171,4 +230,43 @@ export interface ChartColumn {
|
|
|
171
230
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
172
231
|
*/
|
|
173
232
|
format?: ColumnFormat;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Column Properties of the columns
|
|
236
|
+
*
|
|
237
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
238
|
+
*/
|
|
239
|
+
columnProperties?: {
|
|
240
|
+
conditionalFormatting?: Maybe<ConditionalFormatting>;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Aggregation applied on the column data
|
|
245
|
+
*
|
|
246
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
247
|
+
*/
|
|
248
|
+
aggregationType?: ColumnAggregationType;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Custom sort order defined for the column to sort charts in a specific order
|
|
252
|
+
* Defined in worksheet
|
|
253
|
+
*
|
|
254
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
255
|
+
*/
|
|
256
|
+
customOrder?: Array<string>;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Guid of Custom calender for the column if defined in worksheet else null
|
|
260
|
+
*
|
|
261
|
+
* @version SDK: 0.1 | ThoughtSpot: sdcwdc
|
|
262
|
+
*/
|
|
263
|
+
calenderGuid?: string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Type of arbitrary column, can be measure names or measure values
|
|
267
|
+
* also, unknown if regular column
|
|
268
|
+
*
|
|
269
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
270
|
+
*/
|
|
271
|
+
chartSpecificColumnType: ChartSpecificColumnType;
|
|
174
272
|
}
|
|
@@ -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,21 +179,58 @@ 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
|
|
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 =
|
|
192
|
+
export type VisualProps = unknown;
|
|
158
193
|
|
|
159
|
-
|
|
160
|
-
type
|
|
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
|
+
*/
|
|
218
|
+
|
|
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;
|
|
@@ -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[];
|
|
@@ -200,7 +200,8 @@ export interface InitializeEventResponsePayload {
|
|
|
200
200
|
*/
|
|
201
201
|
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
202
202
|
/**
|
|
203
|
-
* Toggle native configurations supported by TS UI. Ex: column level number and conditional
|
|
203
|
+
* Toggle native configurations supported by TS UI. Ex: column level number and conditional
|
|
204
|
+
* formatting.
|
|
204
205
|
*
|
|
205
206
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
206
207
|
*/
|
|
@@ -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
|