@thoughtspot/ts-chart-sdk 0.0.2-alpha.4 → 0.0.2-alpha.6
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 +700 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/main/custom-chart-context.d.ts +58 -0
- package/lib/main/custom-chart-context.d.ts.map +1 -0
- package/lib/main/custom-chart-context.js +334 -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 +618 -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 +29 -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/main/util.d.ts +2 -0
- package/lib/main/util.d.ts.map +1 -0
- package/lib/main/util.js +9 -0
- package/lib/main/util.js.map +1 -0
- package/lib/react/mocks/custom-chart-context-mock.d.ts +3 -0
- package/lib/react/mocks/custom-chart-context-mock.d.ts.map +1 -0
- package/lib/react/mocks/custom-chart-context-mock.js +94 -0
- package/lib/react/mocks/custom-chart-context-mock.js.map +1 -0
- package/lib/react/use-custom-chart-context.d.ts +4 -0
- package/lib/react/use-custom-chart-context.d.ts.map +1 -0
- package/lib/react/use-custom-chart-context.js +68 -0
- package/lib/react/use-custom-chart-context.js.map +1 -0
- package/lib/react/use-custom-chart-context.spec.d.ts +2 -0
- package/lib/react/use-custom-chart-context.spec.d.ts.map +1 -0
- package/lib/react/use-custom-chart-context.spec.js +318 -0
- package/lib/react/use-custom-chart-context.spec.js.map +1 -0
- package/lib/react/use-custom-chart-context.util.d.ts +6 -0
- package/lib/react/use-custom-chart-context.util.d.ts.map +1 -0
- package/lib/react/use-custom-chart-context.util.js +51 -0
- package/lib/react/use-custom-chart-context.util.js.map +1 -0
- package/lib/react/use-custom-chart-types.d.ts +23 -0
- package/lib/react/use-custom-chart-types.d.ts.map +1 -0
- package/lib/react/use-custom-chart-types.js +2 -0
- package/lib/react/use-custom-chart-types.js.map +1 -0
- 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/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 +114 -0
- package/lib/types/answer-column.types.d.ts.map +1 -0
- package/lib/types/answer-column.types.js +96 -0
- package/lib/types/answer-column.types.js.map +1 -0
- package/lib/types/chart-to-ts-event.types.d.ts +98 -0
- package/lib/types/chart-to-ts-event.types.d.ts.map +1 -0
- package/lib/types/chart-to-ts-event.types.js +29 -0
- package/lib/types/chart-to-ts-event.types.js.map +1 -0
- package/lib/types/common.types.d.ts +97 -0
- package/lib/types/common.types.d.ts.map +1 -0
- package/lib/types/common.types.js +16 -0
- package/lib/types/common.types.js.map +1 -0
- 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 +18 -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 +94 -0
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -0
- package/lib/types/ts-to-chart-event.types.js +15 -0
- package/lib/types/ts-to-chart-event.types.js.map +1 -0
- package/lib/types/visual-prop.types.d.ts +76 -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/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 +122 -0
- package/lib/utils/conditional-formatting/conditional-formatting.spec.js.map +1 -0
- package/package.json +2 -2
- package/src/types/answer-column.types.ts +9 -1
- package/src/types/common.types.ts +59 -6
|
@@ -0,0 +1,700 @@
|
|
|
1
|
+
// Generated by dts-bundle v0.7.3
|
|
2
|
+
// Dependencies for this module:
|
|
3
|
+
// ../react
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
export enum CustomizableChartFeature {
|
|
8
|
+
X_AXIS_LABEL = 0,
|
|
9
|
+
X_AXIS_TITLE = 1,
|
|
10
|
+
Y_AXIS_LABEL = 2,
|
|
11
|
+
Y_AXIS_TITLE = 3,
|
|
12
|
+
TOOLTIP = 4,
|
|
13
|
+
SCATTER_CHART = 5,
|
|
14
|
+
PIE_CHART = 6,
|
|
15
|
+
LINE_CHART = 7,
|
|
16
|
+
COLUMN_CHART = 8,
|
|
17
|
+
BAR_CHART = 9,
|
|
18
|
+
AREA_CHART = 10,
|
|
19
|
+
TAIL_FEATURE = 11
|
|
20
|
+
}
|
|
21
|
+
export interface ChartConfigDimension {
|
|
22
|
+
key: string;
|
|
23
|
+
columns: ChartColumn[];
|
|
24
|
+
}
|
|
25
|
+
export interface ChartConfig {
|
|
26
|
+
key: string;
|
|
27
|
+
dimensions: ChartConfigDimension[];
|
|
28
|
+
}
|
|
29
|
+
export type DataPointsArray = {
|
|
30
|
+
columns: string[];
|
|
31
|
+
dataValue: any[][];
|
|
32
|
+
};
|
|
33
|
+
export type QueryData = {
|
|
34
|
+
data: DataPointsArray;
|
|
35
|
+
completionRatio?: number;
|
|
36
|
+
samplingRatio?: number;
|
|
37
|
+
totalRowCount: number;
|
|
38
|
+
};
|
|
39
|
+
export interface ChartModel {
|
|
40
|
+
columns: ChartColumn[];
|
|
41
|
+
data?: QueryData[];
|
|
42
|
+
sortInfo?: any;
|
|
43
|
+
visualProps?: VisualProps;
|
|
44
|
+
config: {
|
|
45
|
+
chartConfig?: ChartConfig[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export type SuccessValidationResponse = {
|
|
49
|
+
chartConfigEditorDefinition: ChartConfigEditorDefinition[];
|
|
50
|
+
visualPropEditorDefinition: VisualPropEditorDefinition;
|
|
51
|
+
};
|
|
52
|
+
export type ValidationResponse = {
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
validationErrorMessage?: string[];
|
|
55
|
+
};
|
|
56
|
+
export type VisualProps = JSON;
|
|
57
|
+
export type CustomFontFaces = {
|
|
58
|
+
guid: string;
|
|
59
|
+
family?: string;
|
|
60
|
+
format?: string;
|
|
61
|
+
url?: string;
|
|
62
|
+
weight?: string;
|
|
63
|
+
style?: string;
|
|
64
|
+
size?: string;
|
|
65
|
+
unicodeRange?: string;
|
|
66
|
+
variant?: string;
|
|
67
|
+
stretch?: string;
|
|
68
|
+
color?: string;
|
|
69
|
+
};
|
|
70
|
+
export type ChartSdkCustomStylingConfig = {
|
|
71
|
+
appBackground?: {
|
|
72
|
+
color?: string;
|
|
73
|
+
};
|
|
74
|
+
appPanelColor?: {
|
|
75
|
+
color?: string;
|
|
76
|
+
};
|
|
77
|
+
chartColorPalettes?: Array<{
|
|
78
|
+
colors: Array<string>;
|
|
79
|
+
}>;
|
|
80
|
+
disableColorRotation?: boolean;
|
|
81
|
+
chartFeatureToFontGuid?: Record<CustomizableChartFeature, string>;
|
|
82
|
+
customFontFaces?: Array<CustomFontFaces>;
|
|
83
|
+
};
|
|
84
|
+
export interface AppConfig {
|
|
85
|
+
styleConfig?: ChartSdkCustomStylingConfig;
|
|
86
|
+
appOptions?: {
|
|
87
|
+
isMobile?: boolean;
|
|
88
|
+
isPrintMode?: boolean;
|
|
89
|
+
isLiveboardContext?: boolean;
|
|
90
|
+
isDebugMode?: boolean;
|
|
91
|
+
};
|
|
92
|
+
localeOptions?: {
|
|
93
|
+
locale: string;
|
|
94
|
+
quarterStartMonth: string;
|
|
95
|
+
sessionTimezone: string;
|
|
96
|
+
};
|
|
97
|
+
appUrl?: string;
|
|
98
|
+
customCalendarConfig?: any;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ChartConfigSection {
|
|
102
|
+
key: string;
|
|
103
|
+
label: string;
|
|
104
|
+
maxColumnCount?: number;
|
|
105
|
+
allowMeasureColumns?: boolean;
|
|
106
|
+
allowAttributeColumns?: boolean;
|
|
107
|
+
allowTimeSeriesColumns?: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface ChartConfigEditorDefinition {
|
|
110
|
+
key: string;
|
|
111
|
+
label?: string;
|
|
112
|
+
descriptionText?: string;
|
|
113
|
+
columnSections: ChartConfigSection[];
|
|
114
|
+
}
|
|
115
|
+
export type ConfigEditorDefinitionSetter = (currentState: ChartModel, ctx: CustomChartContext) => ChartConfigEditorDefinition[];
|
|
116
|
+
|
|
117
|
+
export interface InputValidation {
|
|
118
|
+
required?: boolean;
|
|
119
|
+
requiredError?: string;
|
|
120
|
+
regex?: string;
|
|
121
|
+
regexError?: string;
|
|
122
|
+
minLength?: number;
|
|
123
|
+
minLengthError?: string;
|
|
124
|
+
range?: string;
|
|
125
|
+
rangeError?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface TextInputFormDetail {
|
|
128
|
+
type: 'text';
|
|
129
|
+
key: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
password?: boolean;
|
|
132
|
+
multiline?: boolean;
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
defaultValue?: string;
|
|
135
|
+
inputValidation?: InputValidation;
|
|
136
|
+
}
|
|
137
|
+
export interface NumberInputFormDetail {
|
|
138
|
+
type: 'number';
|
|
139
|
+
key: string;
|
|
140
|
+
label?: string;
|
|
141
|
+
defaultValue?: number;
|
|
142
|
+
inputValidation?: InputValidation;
|
|
143
|
+
}
|
|
144
|
+
export interface ColorPickerFormDetail {
|
|
145
|
+
type: 'colorpicker';
|
|
146
|
+
key: string;
|
|
147
|
+
label?: string;
|
|
148
|
+
selectorType?: 'FONT' | 'COLOR';
|
|
149
|
+
defaultValue?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface ToggleFormDetail {
|
|
152
|
+
type: 'toggle';
|
|
153
|
+
key: string;
|
|
154
|
+
label?: string;
|
|
155
|
+
defaultValue?: boolean;
|
|
156
|
+
}
|
|
157
|
+
export interface CheckboxFormDetail {
|
|
158
|
+
type: 'checkbox';
|
|
159
|
+
key: string;
|
|
160
|
+
label?: string;
|
|
161
|
+
defaultValue?: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface RadioButtonFormDetail {
|
|
164
|
+
type: 'radio';
|
|
165
|
+
key: string;
|
|
166
|
+
label?: string;
|
|
167
|
+
defaultValue?: string;
|
|
168
|
+
values: string[];
|
|
169
|
+
}
|
|
170
|
+
export interface DropDownFormDetail {
|
|
171
|
+
type: 'dropdown';
|
|
172
|
+
key: string;
|
|
173
|
+
label?: string;
|
|
174
|
+
defaultValue?: string;
|
|
175
|
+
values: string[];
|
|
176
|
+
}
|
|
177
|
+
export interface Section {
|
|
178
|
+
type: 'section';
|
|
179
|
+
key: string;
|
|
180
|
+
label?: string;
|
|
181
|
+
children?: PropElement[];
|
|
182
|
+
alignment?: 'row' | 'column';
|
|
183
|
+
layoutType?: 'accordion' | 'tab' | 'none';
|
|
184
|
+
}
|
|
185
|
+
export type PropElement = Section | TextInputFormDetail | NumberInputFormDetail | ColorPickerFormDetail | ToggleFormDetail | CheckboxFormDetail | RadioButtonFormDetail | DropDownFormDetail;
|
|
186
|
+
export interface VisualPropEditorDefinition {
|
|
187
|
+
elements: PropElement[];
|
|
188
|
+
}
|
|
189
|
+
export type VisualEditorDefinitionSetter = (currentState: ChartModel, ctx: CustomChartContext) => VisualPropEditorDefinition;
|
|
190
|
+
|
|
191
|
+
export enum ColumnType {
|
|
192
|
+
UNKNOWN = 0,
|
|
193
|
+
MEASURE = 1,
|
|
194
|
+
ATTRIBUTE = 2
|
|
195
|
+
}
|
|
196
|
+
export enum DataType {
|
|
197
|
+
UNKNOWN = 0,
|
|
198
|
+
BOOL = 1,
|
|
199
|
+
CHAR = 2,
|
|
200
|
+
INT32 = 3,
|
|
201
|
+
INT64 = 4,
|
|
202
|
+
FLOAT = 5,
|
|
203
|
+
DOUBLE = 6,
|
|
204
|
+
DATE = 7,
|
|
205
|
+
DATE_TIME = 8,
|
|
206
|
+
TIME = 9,
|
|
207
|
+
MAX_TYPE = 10
|
|
208
|
+
}
|
|
209
|
+
export enum ColumnTimeBucket {
|
|
210
|
+
NO_BUCKET = 0,
|
|
211
|
+
DAILY = 1,
|
|
212
|
+
WEEKLY = 2,
|
|
213
|
+
MONTHLY = 3,
|
|
214
|
+
QUARTERLY = 4,
|
|
215
|
+
YEARLY = 5,
|
|
216
|
+
HOURLY = 6,
|
|
217
|
+
AUTO = 7,
|
|
218
|
+
HOUR_OF_DAY = 8,
|
|
219
|
+
DAY_OF_WEEK = 9,
|
|
220
|
+
DAY_OF_MONTH = 10,
|
|
221
|
+
DAY_OF_QUARTER = 11,
|
|
222
|
+
DAY_OF_YEAR = 12,
|
|
223
|
+
WEEK_OF_MONTH = 13,
|
|
224
|
+
WEEK_OF_QUARTER = 14,
|
|
225
|
+
WEEK_OF_YEAR = 15,
|
|
226
|
+
MONTH_OF_QUARTER = 16,
|
|
227
|
+
MONTH_OF_YEAR = 17,
|
|
228
|
+
QUARTER_OF_YEAR = 18
|
|
229
|
+
}
|
|
230
|
+
export enum FormatType {
|
|
231
|
+
NONE = 0,
|
|
232
|
+
PATTERN = 1,
|
|
233
|
+
PERCENTAGE = 2,
|
|
234
|
+
CURRENCY = 3
|
|
235
|
+
}
|
|
236
|
+
export enum CurrencyFormatType {
|
|
237
|
+
USER_LOCALE = 0,
|
|
238
|
+
COLUMN = 1,
|
|
239
|
+
ISO_CODE = 2
|
|
240
|
+
}
|
|
241
|
+
export enum ColumnAggregationType {
|
|
242
|
+
AGGREGATE = 0,
|
|
243
|
+
AGGREGATE_DISTINCT = 1,
|
|
244
|
+
APPROX_AGGR_DISTINCT = 2,
|
|
245
|
+
APPROX_AGGR_DISTINCT_MERGE = 3,
|
|
246
|
+
APPROX_COUNT_DISTINCT = 4,
|
|
247
|
+
AVERAGE = 5,
|
|
248
|
+
COUNT = 6,
|
|
249
|
+
COUNT_DISTINCT = 7,
|
|
250
|
+
CUMULATIVE_AVERAGE = 8,
|
|
251
|
+
CUMULATIVE_COUNT = 9,
|
|
252
|
+
CUMULATIVE_MAX = 10,
|
|
253
|
+
CUMULATIVE_MIN = 11,
|
|
254
|
+
CUMULATIVE_SUM = 12,
|
|
255
|
+
GROWTH = 13,
|
|
256
|
+
MAX = 14,
|
|
257
|
+
MEDIAN = 15,
|
|
258
|
+
MIN = 16,
|
|
259
|
+
MOVING_AVERAGE = 17,
|
|
260
|
+
MOVING_COUNT = 18,
|
|
261
|
+
MOVING_MAX = 19,
|
|
262
|
+
MOVING_MIN = 20,
|
|
263
|
+
MOVING_SUM = 21,
|
|
264
|
+
NONE = 22,
|
|
265
|
+
PERCENTILE = 23,
|
|
266
|
+
RANK = 24,
|
|
267
|
+
RANK_PERCENTILE = 25,
|
|
268
|
+
SQL_BOOL_AGGREGATE_OP = 26,
|
|
269
|
+
SQL_DATE_AGGREGATE_OP = 27,
|
|
270
|
+
SQL_DATE_TIME_AGGREGATE_OP = 28,
|
|
271
|
+
SQL_DOUBLE_AGGREGATE_OP = 29,
|
|
272
|
+
SQL_INT_AGGREGATE_OP = 30,
|
|
273
|
+
SQL_STRING_AGGREGATE_OP = 31,
|
|
274
|
+
SQL_TIME_AGGREGATE_OP = 32,
|
|
275
|
+
STD_DEVIATION = 33,
|
|
276
|
+
SUM = 34,
|
|
277
|
+
TABLE_AGGR = 35,
|
|
278
|
+
VARIANCE = 36
|
|
279
|
+
}
|
|
280
|
+
export interface CurrencyFormat {
|
|
281
|
+
type: CurrencyFormatType;
|
|
282
|
+
column: string;
|
|
283
|
+
isoCode: string;
|
|
284
|
+
}
|
|
285
|
+
export interface ColumnFormat {
|
|
286
|
+
type: FormatType;
|
|
287
|
+
pattern?: string;
|
|
288
|
+
currencyFormat?: CurrencyFormat;
|
|
289
|
+
}
|
|
290
|
+
export interface ChartColumn {
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
type: ColumnType;
|
|
294
|
+
timeBucket: ColumnTimeBucket;
|
|
295
|
+
dataType: DataType;
|
|
296
|
+
format?: ColumnFormat;
|
|
297
|
+
columnProperties?: {
|
|
298
|
+
conditionalFormatting?: Maybe<ConditionalFormatting>;
|
|
299
|
+
};
|
|
300
|
+
aggregationType?: ColumnAggregationType;
|
|
301
|
+
customOrder?: Array<string>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export enum ChartToTSEvent {
|
|
305
|
+
OpenContextMenu = "OpenContextMenu",
|
|
306
|
+
CloseContextMenu = "CloseContextMenu",
|
|
307
|
+
OpenAxisMenu = "OpenAxisMenu",
|
|
308
|
+
CloseAxisMenu = "CloseAxisMenu",
|
|
309
|
+
RenderStart = "RenderStart",
|
|
310
|
+
RenderError = "RenderError",
|
|
311
|
+
RenderComplete = "RenderComplete",
|
|
312
|
+
UpdateVisualProps = "UpdateVisualProps",
|
|
313
|
+
GetTMLString = "GetTMLString",
|
|
314
|
+
SetTMLString = "SetTMLString",
|
|
315
|
+
GetDataForQuery = "GetDataForQuery",
|
|
316
|
+
ShowToolTip = "ShowToolTip",
|
|
317
|
+
HideToolTip = "HideToolTip"
|
|
318
|
+
}
|
|
319
|
+
export interface ChartToTSEventsPayloadMap {
|
|
320
|
+
[ChartToTSEvent.OpenContextMenu]: [OpenContextMenuEventPayload];
|
|
321
|
+
[ChartToTSEvent.CloseContextMenu]: [];
|
|
322
|
+
[ChartToTSEvent.RenderStart]: [];
|
|
323
|
+
[ChartToTSEvent.RenderComplete]: [];
|
|
324
|
+
[ChartToTSEvent.RenderError]: [RenderErrorEventPayload];
|
|
325
|
+
[ChartToTSEvent.UpdateVisualProps]: [UpdateVisualPropsEventPayload];
|
|
326
|
+
[ChartToTSEvent.GetTMLString]: [];
|
|
327
|
+
[ChartToTSEvent.SetTMLString]: [SetTMLStringEventPayload];
|
|
328
|
+
[ChartToTSEvent.GetDataForQuery]: [GetDataForQueryEventPayload];
|
|
329
|
+
[ChartToTSEvent.ShowToolTip]: [ShowToolTipEventPayload];
|
|
330
|
+
[ChartToTSEvent.HideToolTip]: [];
|
|
331
|
+
[ChartToTSEvent.OpenAxisMenu]: [OpenAxisMenuEventPayload];
|
|
332
|
+
[ChartToTSEvent.CloseAxisMenu]: [];
|
|
333
|
+
}
|
|
334
|
+
export interface UpdateVisualPropsEventPayload {
|
|
335
|
+
visualProps: VisualProps;
|
|
336
|
+
}
|
|
337
|
+
export interface SetTMLStringEventPayload {
|
|
338
|
+
tmlString: string;
|
|
339
|
+
}
|
|
340
|
+
export interface PointVal {
|
|
341
|
+
columnId: string;
|
|
342
|
+
value: any;
|
|
343
|
+
}
|
|
344
|
+
export interface Point {
|
|
345
|
+
tuple: PointVal[];
|
|
346
|
+
}
|
|
347
|
+
export interface CustomAction {
|
|
348
|
+
id: string;
|
|
349
|
+
label: string;
|
|
350
|
+
icon?: string;
|
|
351
|
+
onClick: (...args: any[]) => void;
|
|
352
|
+
}
|
|
353
|
+
export interface OpenContextMenuEventPayload {
|
|
354
|
+
event: Pick<PointerEvent, 'clientX' | 'clientY'>;
|
|
355
|
+
clickedPoint: Point;
|
|
356
|
+
selectedPoints?: Point[];
|
|
357
|
+
customActions?: CustomAction[];
|
|
358
|
+
}
|
|
359
|
+
export interface ShowToolTipEventPayload {
|
|
360
|
+
event: Pick<PointerEvent, 'clientX' | 'clientY'>;
|
|
361
|
+
customTooltipContent?: string[];
|
|
362
|
+
point?: Point;
|
|
363
|
+
}
|
|
364
|
+
export interface RenderErrorEventPayload {
|
|
365
|
+
hasError: boolean;
|
|
366
|
+
error: any;
|
|
367
|
+
}
|
|
368
|
+
export interface GetDataForQueryEventPayload {
|
|
369
|
+
queries: Query[];
|
|
370
|
+
}
|
|
371
|
+
export enum ErrorType {
|
|
372
|
+
MultipleContextsNotSupported = "MultipleContextsNotSupported"
|
|
373
|
+
}
|
|
374
|
+
export enum AxisMenuActions {
|
|
375
|
+
AGGREGATE = "AGGREGATE",
|
|
376
|
+
TIME_BUCKET = "TIME_BUCKET",
|
|
377
|
+
FILTER = "FILTER",
|
|
378
|
+
SORT = "SORT",
|
|
379
|
+
SEPARATOR = "SEPARATOR"
|
|
380
|
+
}
|
|
381
|
+
export interface AxisMenuCustomAction {
|
|
382
|
+
id: string;
|
|
383
|
+
label: string;
|
|
384
|
+
icon?: string;
|
|
385
|
+
onClick: (...args: any[]) => void;
|
|
386
|
+
}
|
|
387
|
+
export interface OpenAxisMenuEventPayload {
|
|
388
|
+
event: Pick<PointerEvent, 'clientX' | 'clientY'>;
|
|
389
|
+
columnIds: string[];
|
|
390
|
+
selectedActions?: AxisMenuActions[];
|
|
391
|
+
customActions?: AxisMenuCustomAction[];
|
|
392
|
+
}
|
|
393
|
+
export interface ContextMenuActionHandler {
|
|
394
|
+
[key: string]: (args: CustomContextMenuAction) => void;
|
|
395
|
+
}
|
|
396
|
+
export interface AxisMenuActionHandler {
|
|
397
|
+
[key: string]: (args: CustomAxisMenuAction) => void;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export enum TSToChartEvent {
|
|
401
|
+
Initialize = "Initialize",
|
|
402
|
+
InitializeComplete = "InitializeComplete",
|
|
403
|
+
GetDataQuery = "GetDataQuery",
|
|
404
|
+
ChartConfigValidate = "ChartConfigValidate",
|
|
405
|
+
ChartModelUpdate = "ChartModelUpdate",
|
|
406
|
+
DataUpdate = "DataUpdate",
|
|
407
|
+
TriggerRenderChart = "TriggerRenderChart",
|
|
408
|
+
VisualPropsValidate = "VisualPropsValidate",
|
|
409
|
+
VisualPropsUpdate = "VisualPropsUpdate",
|
|
410
|
+
ContextMenuActionClick = "ContextMenuActionClick",
|
|
411
|
+
AxisMenuActionClick = "AxisMenuActionClick"
|
|
412
|
+
}
|
|
413
|
+
export interface TSToChartEventsPayloadMap {
|
|
414
|
+
[TSToChartEvent.ChartModelUpdate]: (payload: ChartModelUpdateEventPayload) => void;
|
|
415
|
+
[TSToChartEvent.DataUpdate]: (payload: DataUpdateEventPayload) => void;
|
|
416
|
+
[TSToChartEvent.VisualPropsUpdate]: (payload: VisualPropsUpdateEventPayload) => void;
|
|
417
|
+
}
|
|
418
|
+
export interface TSToChartInternalEventsPayloadMap {
|
|
419
|
+
[TSToChartEvent.Initialize]: (payload: InitializeEventPayload) => InitializeEventResponsePayload;
|
|
420
|
+
[TSToChartEvent.InitializeComplete]: () => void;
|
|
421
|
+
[TSToChartEvent.GetDataQuery]: (payload: GetDataQueryPayload) => GetDataQueryResponsePayload;
|
|
422
|
+
[TSToChartEvent.ChartConfigValidate]: (payload: ChartConfigValidateEventPayload) => ValidationResponse;
|
|
423
|
+
[TSToChartEvent.VisualPropsValidate]: (payload: VisualPropsValidateEventPayload) => ValidationResponse;
|
|
424
|
+
[TSToChartEvent.TriggerRenderChart]: () => void;
|
|
425
|
+
[TSToChartEvent.ContextMenuActionClick]: (payload: ContextMenuCustomActionPayload) => void;
|
|
426
|
+
[TSToChartEvent.AxisMenuActionClick]: (payload: AxisMenuCustomActionPayload) => void;
|
|
427
|
+
}
|
|
428
|
+
export interface InitializeEventPayload {
|
|
429
|
+
chartModel: ChartModel;
|
|
430
|
+
appConfig?: AppConfig;
|
|
431
|
+
componentId: string;
|
|
432
|
+
hostUrl: string;
|
|
433
|
+
containerElSelector: string;
|
|
434
|
+
}
|
|
435
|
+
export interface InitializeEventResponsePayload {
|
|
436
|
+
isConfigValid: boolean;
|
|
437
|
+
defaultChartConfig: ChartConfig[];
|
|
438
|
+
chartConfigEditorDefinition?: ChartConfigEditorDefinition[];
|
|
439
|
+
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
440
|
+
allowedConfigurations?: AllowedConfigurations;
|
|
441
|
+
}
|
|
442
|
+
export interface GetDataQueryPayload {
|
|
443
|
+
config: ChartConfig[];
|
|
444
|
+
}
|
|
445
|
+
export interface Query {
|
|
446
|
+
queryColumns: ChartColumn[];
|
|
447
|
+
queryParams?: {
|
|
448
|
+
offset?: number;
|
|
449
|
+
size?: number;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
export interface GetDataQueryResponsePayload {
|
|
453
|
+
queries: Query[];
|
|
454
|
+
}
|
|
455
|
+
export interface ChartModelUpdateEventPayload {
|
|
456
|
+
chartModel: ChartModel;
|
|
457
|
+
}
|
|
458
|
+
export interface DataUpdateEventPayload {
|
|
459
|
+
data: QueryData[];
|
|
460
|
+
}
|
|
461
|
+
export interface VisualPropsUpdateEventPayload {
|
|
462
|
+
visualProps: VisualProps;
|
|
463
|
+
}
|
|
464
|
+
export interface VisualPropsValidateEventPayload {
|
|
465
|
+
visualProps: VisualProps;
|
|
466
|
+
}
|
|
467
|
+
export interface ChartConfigValidateEventPayload {
|
|
468
|
+
chartConfig: ChartConfig[];
|
|
469
|
+
}
|
|
470
|
+
export interface CustomContextMenuAction {
|
|
471
|
+
id: string;
|
|
472
|
+
clickedPoint: Point;
|
|
473
|
+
selectedPoints?: Point[];
|
|
474
|
+
event: Pick<PointerEvent, 'clientX' | 'clientY'>;
|
|
475
|
+
}
|
|
476
|
+
export interface ContextMenuCustomActionPayload {
|
|
477
|
+
customAction: CustomContextMenuAction;
|
|
478
|
+
}
|
|
479
|
+
export interface CustomAxisMenuAction {
|
|
480
|
+
id: string;
|
|
481
|
+
columnIds: string[];
|
|
482
|
+
event: Pick<PointerEvent, 'clientX' | 'clientY'>;
|
|
483
|
+
}
|
|
484
|
+
export interface AxisMenuCustomActionPayload {
|
|
485
|
+
customAction: CustomAxisMenuAction;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export type AllowedConfigurations = {
|
|
489
|
+
allowColumnNumberFormatting: boolean;
|
|
490
|
+
allowColumnConditionalFormatting: boolean;
|
|
491
|
+
};
|
|
492
|
+
export type CustomChartContextProps = {
|
|
493
|
+
getDefaultChartConfig: (chartModel: ChartModel) => ChartConfig[];
|
|
494
|
+
getQueriesFromChartConfig: (chartConfig: ChartConfig[], chartModel: ChartModel) => Query[];
|
|
495
|
+
renderChart: (ctx: CustomChartContext) => Promise<void>;
|
|
496
|
+
validateConfig?: (updatedConfig: ChartConfig[], chartModel: ChartModel) => ValidationResponse;
|
|
497
|
+
validateVisualProps?: (updatedVisualProps: VisualProps, chartModel: ChartModel) => ValidationResponse;
|
|
498
|
+
chartConfigEditorDefinition?: ConfigEditorDefinitionSetter | ChartConfigEditorDefinition[];
|
|
499
|
+
visualPropEditorDefinition?: VisualEditorDefinitionSetter | VisualPropEditorDefinition;
|
|
500
|
+
allowedConfigurations?: AllowedConfigurations;
|
|
501
|
+
};
|
|
502
|
+
export type ValidationFunctions = CustomChartContextProps['validateVisualProps'] | CustomChartContextProps['validateConfig'];
|
|
503
|
+
export class CustomChartContext {
|
|
504
|
+
containerEl: HTMLElement | null;
|
|
505
|
+
constructor(chartContextProps: CustomChartContextProps);
|
|
506
|
+
initialize: () => Promise<void>;
|
|
507
|
+
on<T extends keyof TSToChartEventsPayloadMap>(eventType: T, callbackFn: TSToChartEventsPayloadMap[T]): void;
|
|
508
|
+
off<T extends keyof TSToChartEventsPayloadMap>(eventType: T): void;
|
|
509
|
+
destroy(): void;
|
|
510
|
+
getChartModel: () => ChartModel;
|
|
511
|
+
getAppConfig: () => AppConfig;
|
|
512
|
+
contextMenuCustomActionPreProcessor(eventPayload: [OpenContextMenuEventPayload]): [OpenContextMenuEventPayload];
|
|
513
|
+
axisMenuCustomActionPreProcessor(eventPayload: [OpenAxisMenuEventPayload]): [OpenAxisMenuEventPayload];
|
|
514
|
+
emitEvent<T extends keyof ChartToTSEventsPayloadMap>(eventType: T, ...eventPayload: ChartToTSEventsPayloadMap[T]): Promise<any>;
|
|
515
|
+
}
|
|
516
|
+
export const getChartContext: (customChartConfig: CustomChartContextProps) => Promise<CustomChartContext>;
|
|
517
|
+
|
|
518
|
+
export const useChartContext: (props: Omit<CustomChartContextProps, 'renderChart'>) => ChartContextProps;
|
|
519
|
+
|
|
520
|
+
export type Maybe<T> = T | null;
|
|
521
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
522
|
+
export type ConditionalFormatting = {
|
|
523
|
+
__typename?: 'ConditionalFormatting';
|
|
524
|
+
rows?: Maybe<Array<Maybe<ConditionalMetric>>>;
|
|
525
|
+
};
|
|
526
|
+
export type Scalars = {
|
|
527
|
+
ID: string;
|
|
528
|
+
String: string;
|
|
529
|
+
Boolean: boolean;
|
|
530
|
+
Int: number;
|
|
531
|
+
Float: number;
|
|
532
|
+
FileUpload: any;
|
|
533
|
+
GUID: string;
|
|
534
|
+
JSON: {
|
|
535
|
+
[key: string]: any;
|
|
536
|
+
};
|
|
537
|
+
JSONObject: any;
|
|
538
|
+
Long: any;
|
|
539
|
+
};
|
|
540
|
+
export enum BackgroundFormatTypes {
|
|
541
|
+
Gradient = "GRADIENT",
|
|
542
|
+
Solid = "SOLID"
|
|
543
|
+
}
|
|
544
|
+
export enum ConditionalFormattingComparisonTypes {
|
|
545
|
+
ColumnBased = "COLUMN_BASED",
|
|
546
|
+
ParameterBased = "PARAMETER_BASED",
|
|
547
|
+
ValueBased = "VALUE_BASED"
|
|
548
|
+
}
|
|
549
|
+
export type FontAttrs = {
|
|
550
|
+
__typename?: 'FontAttrs';
|
|
551
|
+
bold?: Maybe<Scalars['Boolean']>;
|
|
552
|
+
color?: Maybe<Scalars['String']>;
|
|
553
|
+
italic?: Maybe<Scalars['Boolean']>;
|
|
554
|
+
strikeThrough?: Maybe<Scalars['Boolean']>;
|
|
555
|
+
underline?: Maybe<Scalars['Boolean']>;
|
|
556
|
+
};
|
|
557
|
+
export type GradientBackgroundAttrs = {
|
|
558
|
+
__typename?: 'GradientBackgroundAttrs';
|
|
559
|
+
backgroundFormatMidpoint?: Maybe<Scalars['Float']>;
|
|
560
|
+
backgroundFormatRange?: Maybe<Array<Maybe<Scalars['Float']>>>;
|
|
561
|
+
colors?: Maybe<Array<Maybe<Scalars['String']>>>;
|
|
562
|
+
};
|
|
563
|
+
export enum Operators {
|
|
564
|
+
Contains = "CONTAINS",
|
|
565
|
+
DoesNotContain = "DOES_NOT_CONTAIN",
|
|
566
|
+
EndsWith = "ENDS_WITH",
|
|
567
|
+
EqualTo = "EQUAL_TO",
|
|
568
|
+
GreaterThan = "GREATER_THAN",
|
|
569
|
+
GreaterThanEqualTo = "GREATER_THAN_EQUAL_TO",
|
|
570
|
+
Is = "IS",
|
|
571
|
+
IsBetween = "IS_BETWEEN",
|
|
572
|
+
IsEmpty = "IS_EMPTY",
|
|
573
|
+
IsNot = "IS_NOT",
|
|
574
|
+
IsNotEmpty = "IS_NOT_EMPTY",
|
|
575
|
+
IsNotNull = "IS_NOT_NULL",
|
|
576
|
+
IsNull = "IS_NULL",
|
|
577
|
+
LessThan = "LESS_THAN",
|
|
578
|
+
LessThanEqualTo = "LESS_THAN_EQUAL_TO",
|
|
579
|
+
NotEqualTo = "NOT_EQUAL_TO",
|
|
580
|
+
StartsWith = "STARTS_WITH"
|
|
581
|
+
}
|
|
582
|
+
export type SolidBackgroundAttrs = {
|
|
583
|
+
__typename?: 'SolidBackgroundAttrs';
|
|
584
|
+
color?: Maybe<Scalars['String']>;
|
|
585
|
+
};
|
|
586
|
+
export type Range = {
|
|
587
|
+
__typename?: 'Range';
|
|
588
|
+
max?: Maybe<Scalars['Float']>;
|
|
589
|
+
min?: Maybe<Scalars['Float']>;
|
|
590
|
+
};
|
|
591
|
+
export type ConditionalMetric = {
|
|
592
|
+
__typename?: 'ConditionalMetric';
|
|
593
|
+
backgroundFormatType?: Maybe<BackgroundFormatTypes>;
|
|
594
|
+
comparisonParameterId?: Maybe<Scalars['String']>;
|
|
595
|
+
comparisonType?: Maybe<ConditionalFormattingComparisonTypes>;
|
|
596
|
+
fontProperties?: Maybe<FontAttrs>;
|
|
597
|
+
gradientBackgroundAttrs?: Maybe<GradientBackgroundAttrs>;
|
|
598
|
+
isHighlightRow?: Maybe<Scalars['Boolean']>;
|
|
599
|
+
lhsColumnId?: Maybe<Scalars['String']>;
|
|
600
|
+
operator?: Maybe<Operators>;
|
|
601
|
+
plotAsBand?: Maybe<Scalars['Boolean']>;
|
|
602
|
+
rangeValues?: Maybe<Range>;
|
|
603
|
+
rhsColumnId?: Maybe<Scalars['String']>;
|
|
604
|
+
solidBackgroundAttrs?: Maybe<SolidBackgroundAttrs>;
|
|
605
|
+
value?: Maybe<Scalars['String']>;
|
|
606
|
+
};
|
|
607
|
+
export type Parameter = {
|
|
608
|
+
__typename?: 'Parameter';
|
|
609
|
+
dataType: FalconDataType;
|
|
610
|
+
defaultValue: Scalars['String'];
|
|
611
|
+
description: Scalars['String'];
|
|
612
|
+
id: Scalars['GUID'];
|
|
613
|
+
name: Scalars['String'];
|
|
614
|
+
overrideValue?: Maybe<Scalars['String']>;
|
|
615
|
+
owner: ParameterOwnerInfo;
|
|
616
|
+
valueList?: Maybe<Array<ParameterValueListItem>>;
|
|
617
|
+
valueRange?: Maybe<ParameterValueRange>;
|
|
618
|
+
valueType: ParameterValueType;
|
|
619
|
+
};
|
|
620
|
+
export enum FalconDataType {
|
|
621
|
+
Bool = "BOOL",
|
|
622
|
+
Char = "CHAR",
|
|
623
|
+
Date = "DATE",
|
|
624
|
+
DateTime = "DATE_TIME",
|
|
625
|
+
Double = "DOUBLE",
|
|
626
|
+
Float = "FLOAT",
|
|
627
|
+
Int32 = "INT32",
|
|
628
|
+
Int64 = "INT64",
|
|
629
|
+
List = "LIST",
|
|
630
|
+
ListBool = "LIST_BOOL",
|
|
631
|
+
ListDate = "LIST_DATE",
|
|
632
|
+
ListDateTime = "LIST_DATE_TIME",
|
|
633
|
+
ListDouble = "LIST_DOUBLE",
|
|
634
|
+
ListInt = "LIST_INT",
|
|
635
|
+
ListString = "LIST_STRING",
|
|
636
|
+
ListTime = "LIST_TIME",
|
|
637
|
+
MaxType = "MAX_TYPE",
|
|
638
|
+
Time = "TIME",
|
|
639
|
+
Unknown = "UNKNOWN"
|
|
640
|
+
}
|
|
641
|
+
export type ParameterOwnerInfo = {
|
|
642
|
+
__typename?: 'ParameterOwnerInfo';
|
|
643
|
+
id: Scalars['GUID'];
|
|
644
|
+
name: Scalars['String'];
|
|
645
|
+
type: ParameterOwnerType;
|
|
646
|
+
};
|
|
647
|
+
export enum ParameterOwnerType {
|
|
648
|
+
Answer = "ANSWER",
|
|
649
|
+
Worksheet = "WORKSHEET"
|
|
650
|
+
}
|
|
651
|
+
export type ParameterValueListItem = {
|
|
652
|
+
__typename?: 'ParameterValueListItem';
|
|
653
|
+
displayAs?: Maybe<Scalars['String']>;
|
|
654
|
+
value: Scalars['String'];
|
|
655
|
+
};
|
|
656
|
+
export type ParameterValueListItemInput = {
|
|
657
|
+
displayAs?: InputMaybe<Scalars['String']>;
|
|
658
|
+
value: Scalars['String'];
|
|
659
|
+
};
|
|
660
|
+
export type ParameterValueRange = {
|
|
661
|
+
__typename?: 'ParameterValueRange';
|
|
662
|
+
max?: Maybe<Scalars['Float']>;
|
|
663
|
+
min?: Maybe<Scalars['Float']>;
|
|
664
|
+
};
|
|
665
|
+
export type ParameterValueRangeInput = {
|
|
666
|
+
max?: InputMaybe<Scalars['Float']>;
|
|
667
|
+
min?: InputMaybe<Scalars['Float']>;
|
|
668
|
+
};
|
|
669
|
+
export enum ParameterValueType {
|
|
670
|
+
Any = "ANY",
|
|
671
|
+
List = "LIST",
|
|
672
|
+
Range = "RANGE"
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export const getMinRangeValue: (metric: ConditionalMetric) => number | undefined | null;
|
|
676
|
+
export const getMaxRangeValue: (metric: ConditionalMetric) => number | undefined | null;
|
|
677
|
+
export const isConditionSatisfied: (metric: ConditionalMetric, parameters?: Parameter[], lhsColValue?: string | number | null, rhsColValue?: string | number | null) => boolean;
|
|
678
|
+
export function validateCfCondition(conditionalMetric: ConditionalMetric, index: number, columnId: string, dataAttr?: DataPointsArray, inScopeParameters?: Parameter[]): boolean;
|
|
679
|
+
export const applicableConditionalFormatting: (idx: number, columnId: string, dataArr: DataPointsArray, conditionalFormatting?: ConditionalFormatting) => ConditionalMetric | null;
|
|
680
|
+
export function getCfForColumn(column: ChartColumn): ConditionalFormatting | undefined;
|
|
681
|
+
|
|
682
|
+
export type ChartToTSEventEmitters = {
|
|
683
|
+
[key in keyof ChartToTSEventsPayloadMap as `emit${Capitalize<key>}`]: (...args: ChartToTSEventsPayloadMap[key]) => Promise<void>;
|
|
684
|
+
};
|
|
685
|
+
export type TSToChartEventListener = {
|
|
686
|
+
[key in keyof TSToChartEventsPayloadMap as `setOn${Capitalize<key>}`]: (args: TSToChartEventsPayloadMap[key]) => Promise<void>;
|
|
687
|
+
};
|
|
688
|
+
export type TSToChartEventOffListener = {
|
|
689
|
+
[key in keyof TSToChartEventsPayloadMap as `setOff${Capitalize<key>}`]: () => Promise<void>;
|
|
690
|
+
};
|
|
691
|
+
export interface TSChartContextProps {
|
|
692
|
+
children: React.ReactNode;
|
|
693
|
+
}
|
|
694
|
+
export interface ChartContextProps extends ChartToTSEventEmitters, TSToChartEventListener, TSToChartEventOffListener {
|
|
695
|
+
hasInitialized: boolean;
|
|
696
|
+
chartModel: ChartModel | undefined;
|
|
697
|
+
destroy: () => void;
|
|
698
|
+
TSChartContext: ({ children }: TSChartContextProps) => React.JSX.Element;
|
|
699
|
+
}
|
|
700
|
+
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types/common.types';
|
|
2
|
+
export * from './types/configurator.types';
|
|
3
|
+
export * from './types/visual-prop.types';
|
|
4
|
+
export * from './types/answer-column.types';
|
|
5
|
+
export * from './types/chart-to-ts-event.types';
|
|
6
|
+
export * from './types/ts-to-chart-event.types';
|
|
7
|
+
export * from './main/custom-chart-context';
|
|
8
|
+
export * from './react/use-custom-chart-context';
|
|
9
|
+
export * from './types/conditional-formatting.types';
|
|
10
|
+
export * from './utils/conditional-formatting/conditional-formatting';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC"}
|