@thoughtspot/ts-chart-sdk 0.0.1-alpha.5 → 0.0.1-alpha.7
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/cjs/main/custom-chart-context.d.ts +1 -1
- package/cjs/main/custom-chart-context.d.ts.map +1 -1
- package/cjs/main/custom-chart-context.js +2 -2
- package/cjs/main/custom-chart-context.js.map +1 -1
- package/cjs/main/custom-chart-context.spec.js +8 -0
- package/cjs/main/custom-chart-context.spec.js.map +1 -1
- package/cjs/react/custom-chart-context-hook.d.ts +22 -0
- package/cjs/react/custom-chart-context-hook.d.ts.map +1 -0
- package/cjs/react/custom-chart-context-hook.js +116 -0
- package/cjs/react/custom-chart-context-hook.js.map +1 -0
- package/cjs/react/custom-chart-context-hook.spec.d.ts +2 -0
- package/cjs/react/custom-chart-context-hook.spec.d.ts.map +1 -0
- package/cjs/react/custom-chart-context-hook.spec.js +343 -0
- package/cjs/react/custom-chart-context-hook.spec.js.map +1 -0
- package/cjs/react/custom-chart-context-service.d.ts +5 -16
- package/cjs/react/custom-chart-context-service.d.ts.map +1 -1
- package/cjs/react/custom-chart-context-service.js +34 -35
- package/cjs/react/custom-chart-context-service.js.map +1 -1
- package/cjs/react/custom-chart.spec.js +282 -53
- package/cjs/react/custom-chart.spec.js.map +1 -1
- package/cjs/react/mocks/custom-chart-context-hook.d.ts +3 -0
- package/cjs/react/mocks/custom-chart-context-hook.d.ts.map +1 -0
- package/cjs/react/mocks/custom-chart-context-hook.js +100 -0
- package/cjs/react/mocks/custom-chart-context-hook.js.map +1 -0
- package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +1 -1
- package/cjs/react/mocks/custom-chart-context-mock.js +32 -30
- package/cjs/react/mocks/custom-chart-context-mock.js.map +1 -1
- package/lib/main/custom-chart-context.d.ts +1 -1
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +1 -2
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +8 -0
- package/lib/main/custom-chart-context.spec.js.map +1 -1
- package/lib/react/custom-chart-context-hook.d.ts +22 -0
- package/lib/react/custom-chart-context-hook.d.ts.map +1 -0
- package/lib/react/custom-chart-context-hook.js +86 -0
- package/lib/react/custom-chart-context-hook.js.map +1 -0
- package/lib/react/custom-chart-context-hook.spec.d.ts +2 -0
- package/lib/react/custom-chart-context-hook.spec.d.ts.map +1 -0
- package/lib/react/custom-chart-context-hook.spec.js +315 -0
- package/lib/react/custom-chart-context-hook.spec.js.map +1 -0
- package/lib/react/custom-chart-context-service.d.ts +5 -16
- package/lib/react/custom-chart-context-service.d.ts.map +1 -1
- package/lib/react/custom-chart-context-service.js +34 -35
- package/lib/react/custom-chart-context-service.js.map +1 -1
- package/lib/react/custom-chart.spec.js +260 -54
- package/lib/react/custom-chart.spec.js.map +1 -1
- package/lib/react/mocks/custom-chart-context-hook.d.ts +3 -0
- package/lib/react/mocks/custom-chart-context-hook.d.ts.map +1 -0
- package/lib/react/mocks/custom-chart-context-hook.js +94 -0
- package/lib/react/mocks/custom-chart-context-hook.js.map +1 -0
- package/lib/react/mocks/custom-chart-context-mock.d.ts.map +1 -1
- package/lib/react/mocks/custom-chart-context-mock.js +32 -30
- package/lib/react/mocks/custom-chart-context-mock.js.map +1 -1
- package/package.json +1 -1
- package/src/main/custom-chart-context.ts +2 -2
- package/src/types/visual-prop.types.ts +77 -8
- package/dist/ts-chart-sdk.d.ts +0 -312
- package/lib/dist/ts-chart-sdk.d.ts +0 -312
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle v0.7.3
|
|
2
|
-
|
|
3
|
-
export interface ChartConfigDimension {
|
|
4
|
-
key: string;
|
|
5
|
-
columns: ChartColumn[];
|
|
6
|
-
}
|
|
7
|
-
export interface ChartConfig {
|
|
8
|
-
key: string;
|
|
9
|
-
dimensions: ChartConfigDimension[];
|
|
10
|
-
}
|
|
11
|
-
export type DataArray = {
|
|
12
|
-
columnId: string;
|
|
13
|
-
columnDataType: DataType;
|
|
14
|
-
dataValue: any[];
|
|
15
|
-
};
|
|
16
|
-
export type QueryData = {
|
|
17
|
-
data: DataArray[];
|
|
18
|
-
completionRatio: number;
|
|
19
|
-
samplingRatio: number;
|
|
20
|
-
totalRowCount: number;
|
|
21
|
-
};
|
|
22
|
-
export interface ChartModel {
|
|
23
|
-
columns: ChartColumn[];
|
|
24
|
-
data?: QueryData[];
|
|
25
|
-
sortInfo?: any;
|
|
26
|
-
visualProps?: VisualProps;
|
|
27
|
-
config: {
|
|
28
|
-
chartConfig?: ChartConfig[];
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export type ValidationResponse = {
|
|
32
|
-
isValid: boolean;
|
|
33
|
-
validationErrorMessage?: string[];
|
|
34
|
-
};
|
|
35
|
-
export type VisualProps = JSON;
|
|
36
|
-
type CustomStylingConfig = any;
|
|
37
|
-
export interface AppConfig {
|
|
38
|
-
styleConfig?: CustomStylingConfig;
|
|
39
|
-
appOptions?: {
|
|
40
|
-
isMobile?: boolean;
|
|
41
|
-
isPrintMode?: boolean;
|
|
42
|
-
isDebugMode?: boolean;
|
|
43
|
-
};
|
|
44
|
-
localeOptions?: {
|
|
45
|
-
locale: string;
|
|
46
|
-
quarterStartMonth: string;
|
|
47
|
-
sessionTimezone: string;
|
|
48
|
-
};
|
|
49
|
-
customCalendarConfig?: any;
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
52
|
-
|
|
53
|
-
export interface ChartConfigSection {
|
|
54
|
-
key: string;
|
|
55
|
-
label: string;
|
|
56
|
-
maxColumnCount?: number;
|
|
57
|
-
allowMeasureColumns?: boolean;
|
|
58
|
-
allowAttributeColumns?: boolean;
|
|
59
|
-
allowTimeSeriesColumns?: boolean;
|
|
60
|
-
}
|
|
61
|
-
export interface ChartConfigEditorDefinition {
|
|
62
|
-
key: string;
|
|
63
|
-
label?: string;
|
|
64
|
-
descriptionText?: string;
|
|
65
|
-
columnSections: ChartConfigSection[];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface TextInputFormDetail {
|
|
69
|
-
type: 'text';
|
|
70
|
-
key: string;
|
|
71
|
-
label?: string;
|
|
72
|
-
password?: boolean;
|
|
73
|
-
multiline?: boolean;
|
|
74
|
-
placeholder?: string;
|
|
75
|
-
defaultValue?: string;
|
|
76
|
-
}
|
|
77
|
-
export interface ToggleFormDetail {
|
|
78
|
-
type: 'toggle';
|
|
79
|
-
key: string;
|
|
80
|
-
label?: string;
|
|
81
|
-
defaultValue?: boolean;
|
|
82
|
-
}
|
|
83
|
-
export interface CheckboxFormDetail {
|
|
84
|
-
type: 'checkbox';
|
|
85
|
-
key: string;
|
|
86
|
-
label?: string;
|
|
87
|
-
defaultValue?: boolean;
|
|
88
|
-
}
|
|
89
|
-
export interface RadioButtonFormDetail {
|
|
90
|
-
type: 'radio';
|
|
91
|
-
key: string;
|
|
92
|
-
label?: string;
|
|
93
|
-
defaultValue?: string;
|
|
94
|
-
values: string[];
|
|
95
|
-
}
|
|
96
|
-
export interface DropDownFormDetail {
|
|
97
|
-
type: 'dropdown';
|
|
98
|
-
key: string;
|
|
99
|
-
label?: string;
|
|
100
|
-
defaultValue?: string;
|
|
101
|
-
values: string[];
|
|
102
|
-
}
|
|
103
|
-
export interface Section {
|
|
104
|
-
type: 'section';
|
|
105
|
-
key: string;
|
|
106
|
-
label?: string;
|
|
107
|
-
children?: PropElement[];
|
|
108
|
-
alignment?: 'row' | 'column';
|
|
109
|
-
}
|
|
110
|
-
export type PropElement = Section | TextInputFormDetail | ToggleFormDetail | CheckboxFormDetail | RadioButtonFormDetail | DropDownFormDetail;
|
|
111
|
-
export interface VisualPropEditorDefinition {
|
|
112
|
-
elements: PropElement[];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export enum ColumnType {
|
|
116
|
-
UNKNOWN = 0,
|
|
117
|
-
MEASURE = 1,
|
|
118
|
-
ATTRIBUTE = 2
|
|
119
|
-
}
|
|
120
|
-
export enum DataType {
|
|
121
|
-
UNKNOWN = 0,
|
|
122
|
-
BOOL = 1,
|
|
123
|
-
CHAR = 2,
|
|
124
|
-
INT32 = 3,
|
|
125
|
-
INT64 = 4,
|
|
126
|
-
FLOAT = 5,
|
|
127
|
-
DOUBLE = 6,
|
|
128
|
-
DATE = 7,
|
|
129
|
-
DATE_TIME = 8,
|
|
130
|
-
TIME = 9,
|
|
131
|
-
MAX_TYPE = 10
|
|
132
|
-
}
|
|
133
|
-
export enum ColumnTimeBucket {
|
|
134
|
-
NO_BUCKET = 0,
|
|
135
|
-
DAILY = 1,
|
|
136
|
-
WEEKLY = 2,
|
|
137
|
-
MONTHLY = 3,
|
|
138
|
-
QUARTERLY = 4,
|
|
139
|
-
YEARLY = 5,
|
|
140
|
-
HOURLY = 6,
|
|
141
|
-
AUTO = 7,
|
|
142
|
-
HOUR_OF_DAY = 8,
|
|
143
|
-
DAY_OF_WEEK = 9,
|
|
144
|
-
DAY_OF_MONTH = 10,
|
|
145
|
-
DAY_OF_QUARTER = 11,
|
|
146
|
-
DAY_OF_YEAR = 12,
|
|
147
|
-
WEEK_OF_MONTH = 13,
|
|
148
|
-
WEEK_OF_QUARTER = 14,
|
|
149
|
-
WEEK_OF_YEAR = 15,
|
|
150
|
-
MONTH_OF_QUARTER = 16,
|
|
151
|
-
MONTH_OF_YEAR = 17,
|
|
152
|
-
QUARTER_OF_YEAR = 18
|
|
153
|
-
}
|
|
154
|
-
export enum FormatType {
|
|
155
|
-
NONE = 0,
|
|
156
|
-
PATTERN = 1,
|
|
157
|
-
PERCENTAGE = 2,
|
|
158
|
-
CURRENCY = 3
|
|
159
|
-
}
|
|
160
|
-
export enum CurrencyFormatType {
|
|
161
|
-
USER_LOCALE = 0,
|
|
162
|
-
COLUMN = 1,
|
|
163
|
-
ISO_CODE = 2
|
|
164
|
-
}
|
|
165
|
-
export interface CurrencyFormat {
|
|
166
|
-
type: CurrencyFormatType;
|
|
167
|
-
column: string;
|
|
168
|
-
isoCode: string;
|
|
169
|
-
}
|
|
170
|
-
export interface ColumnFormat {
|
|
171
|
-
type: FormatType;
|
|
172
|
-
pattern?: string;
|
|
173
|
-
currencyFormat?: CurrencyFormat;
|
|
174
|
-
}
|
|
175
|
-
export interface ChartColumn {
|
|
176
|
-
id: string;
|
|
177
|
-
name: string;
|
|
178
|
-
type: ColumnType;
|
|
179
|
-
timeBucket: ColumnTimeBucket;
|
|
180
|
-
dataType: DataType;
|
|
181
|
-
format?: ColumnFormat;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export enum ChartToTSEvent {
|
|
185
|
-
OpenContextMenu = "OpenContextMenu",
|
|
186
|
-
CloseContextMenu = "CloseContextMenu",
|
|
187
|
-
OpenAxisMenu = "OpenAxisMenu",
|
|
188
|
-
CloseAxisMenu = "CloseAxisMenu",
|
|
189
|
-
RenderStart = "RenderStart",
|
|
190
|
-
RenderError = "RenderError",
|
|
191
|
-
RenderComplete = "RenderComplete",
|
|
192
|
-
UpdateVisualProps = "UpdateVisualProps"
|
|
193
|
-
}
|
|
194
|
-
export interface ChartToTSEventsPayloadMap {
|
|
195
|
-
[ChartToTSEvent.OpenContextMenu]: OpenContextMenuEventPayload;
|
|
196
|
-
[ChartToTSEvent.CloseContextMenu]: null;
|
|
197
|
-
[ChartToTSEvent.RenderStart]: null;
|
|
198
|
-
[ChartToTSEvent.RenderComplete]: null;
|
|
199
|
-
[ChartToTSEvent.RenderError]: RenderErrorEventPayload;
|
|
200
|
-
[ChartToTSEvent.UpdateVisualProps]: UpdateVisualPropsEventPayload;
|
|
201
|
-
}
|
|
202
|
-
type UpdateVisualPropsEventPayload = VisualProps;
|
|
203
|
-
export interface PointVal {
|
|
204
|
-
columnId: string;
|
|
205
|
-
value: any;
|
|
206
|
-
}
|
|
207
|
-
export interface Point {
|
|
208
|
-
tuple: PointVal[];
|
|
209
|
-
}
|
|
210
|
-
export interface CustomAction {
|
|
211
|
-
id: string;
|
|
212
|
-
label: string;
|
|
213
|
-
icon: string;
|
|
214
|
-
onClick: (...args: any[]) => void;
|
|
215
|
-
}
|
|
216
|
-
export interface OpenContextMenuEventPayload {
|
|
217
|
-
event: Pick<PointerEvent, 'x' | 'y' | 'clientX' | 'clientY' | 'pageX' | 'pageY' | 'screenX' | 'screenY'>;
|
|
218
|
-
clickedPoint: Point;
|
|
219
|
-
selectedPoints?: Point[];
|
|
220
|
-
customActions?: CustomAction[];
|
|
221
|
-
}
|
|
222
|
-
interface RenderErrorEventPayload {
|
|
223
|
-
hasError: boolean;
|
|
224
|
-
error: any;
|
|
225
|
-
}
|
|
226
|
-
export enum ErrorType {
|
|
227
|
-
MultipleContextsNotSupported = "MultipleContextsNotSupported"
|
|
228
|
-
}
|
|
229
|
-
export {};
|
|
230
|
-
|
|
231
|
-
export enum TSToChartEvent {
|
|
232
|
-
Initialize = "Initialize",
|
|
233
|
-
GetDataQuery = "GetDataQuery",
|
|
234
|
-
ChartConfigValidate = "ChartConfigValidate",
|
|
235
|
-
ChartModelUpdate = "ChartModelUpdate",
|
|
236
|
-
DataUpdate = "DataUpdate",
|
|
237
|
-
TriggerRenderChart = "TriggerRenderChart",
|
|
238
|
-
VisualPropsValidate = "VisualPropsValidate",
|
|
239
|
-
VisualPropsUpdate = "VisualPropsUpdate"
|
|
240
|
-
}
|
|
241
|
-
export interface TSToChartEventsPayloadMap {
|
|
242
|
-
[TSToChartEvent.ChartModelUpdate]: (payload: ChartModelUpdateEventPayload) => void;
|
|
243
|
-
[TSToChartEvent.DataUpdate]: (payload: DataUpdateEventPayload) => void;
|
|
244
|
-
[TSToChartEvent.VisualPropsUpdate]: (payload: VisualPropsUpdateEventPayload) => void;
|
|
245
|
-
}
|
|
246
|
-
export interface TSToChartInternalEventsPayloadMap {
|
|
247
|
-
[TSToChartEvent.Initialize]: (payload: InitializeEventPayload) => InitializeEventResponsePayload;
|
|
248
|
-
[TSToChartEvent.GetDataQuery]: (payload: GetDataQueryPayload) => GetDataQueryResponsePayload;
|
|
249
|
-
[TSToChartEvent.ChartConfigValidate]: (payload: ChartConfigValidateEventPayload) => ValidationResponse;
|
|
250
|
-
[TSToChartEvent.VisualPropsValidate]: (payload: VisualPropsValidateEventPayload) => ValidationResponse;
|
|
251
|
-
[TSToChartEvent.TriggerRenderChart]: () => void;
|
|
252
|
-
}
|
|
253
|
-
export interface InitializeEventPayload {
|
|
254
|
-
chartModel: ChartModel;
|
|
255
|
-
appConfig?: AppConfig;
|
|
256
|
-
componentId: string;
|
|
257
|
-
hostUrl: string;
|
|
258
|
-
}
|
|
259
|
-
export interface InitializeEventResponsePayload {
|
|
260
|
-
isConfigValid: boolean;
|
|
261
|
-
defaultChartConfig: ChartConfig[];
|
|
262
|
-
chartConfigEditorDefinition?: ChartConfigEditorDefinition[];
|
|
263
|
-
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
264
|
-
}
|
|
265
|
-
export interface GetDataQueryPayload {
|
|
266
|
-
config: ChartConfig[];
|
|
267
|
-
}
|
|
268
|
-
export interface Query {
|
|
269
|
-
queryColumns: ChartColumn[];
|
|
270
|
-
queryParams?: {
|
|
271
|
-
offset?: number;
|
|
272
|
-
size?: number;
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
export interface GetDataQueryResponsePayload {
|
|
276
|
-
queries: Query[];
|
|
277
|
-
}
|
|
278
|
-
export interface ChartModelUpdateEventPayload {
|
|
279
|
-
chartModel: ChartModel;
|
|
280
|
-
}
|
|
281
|
-
export interface DataUpdateEventPayload {
|
|
282
|
-
data: QueryData[];
|
|
283
|
-
}
|
|
284
|
-
export interface VisualPropsUpdateEventPayload {
|
|
285
|
-
visualProps: VisualProps;
|
|
286
|
-
}
|
|
287
|
-
export interface VisualPropsValidateEventPayload {
|
|
288
|
-
visualProps: VisualProps;
|
|
289
|
-
}
|
|
290
|
-
export interface ChartConfigValidateEventPayload {
|
|
291
|
-
chartConfig: ChartConfig[];
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export type CustomChartContextProps = {
|
|
295
|
-
getDefaultChartConfig: (chartModel: ChartModel) => ChartConfig[];
|
|
296
|
-
getQueriesFromChartConfig: (chartConfig: ChartConfig[]) => Query[];
|
|
297
|
-
renderChart: (ctx: CustomChartContext) => Promise<void>;
|
|
298
|
-
validateConfig?: (updatedConfig: ChartConfig[], chartModel: ChartModel) => ValidationResponse;
|
|
299
|
-
validateVisualProps?: (updatedVisualProps: VisualProps, chartModel: ChartModel) => ValidationResponse;
|
|
300
|
-
chartConfigEditorDefinition?: ChartConfigEditorDefinition[];
|
|
301
|
-
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
302
|
-
};
|
|
303
|
-
export class CustomChartContext {
|
|
304
|
-
constructor(chartContextProps: CustomChartContextProps);
|
|
305
|
-
initialize: () => Promise<void>;
|
|
306
|
-
on<T extends keyof TSToChartEventsPayloadMap>(eventType: T, callbackFn: TSToChartEventsPayloadMap[T]): void;
|
|
307
|
-
destroy(): void;
|
|
308
|
-
getChartModel: () => ChartModel;
|
|
309
|
-
emitEvent<T extends keyof ChartToTSEventsPayloadMap>(eventType: T, eventPayload: ChartToTSEventsPayloadMap[T]): Promise<any>;
|
|
310
|
-
}
|
|
311
|
-
export const getChartContext: (customChartConfig: CustomChartContextProps) => Promise<CustomChartContext>;
|
|
312
|
-
|