@thoughtspot/ts-chart-sdk 0.0.1-alpha.5 → 0.0.1-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/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 +2 -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.spec.ts +8 -0
- package/src/main/custom-chart-context.ts +9 -4
- package/src/react/mocks/custom-chart-context-mock.ts +32 -30
- package/dist/ts-chart-sdk.d.ts +0 -312
- package/lib/dist/ts-chart-sdk.d.ts +0 -312
|
@@ -56,36 +56,38 @@ export const contextChartProps = {
|
|
|
56
56
|
],
|
|
57
57
|
},
|
|
58
58
|
],
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
59
|
+
getVisualPropEditorDefinition: (chartModel) => {
|
|
60
|
+
return {
|
|
61
|
+
elements: [
|
|
62
|
+
{
|
|
63
|
+
key: 'color',
|
|
64
|
+
type: 'radio',
|
|
65
|
+
defaultValue: 'red',
|
|
66
|
+
values: ['red', 'green', 'yellow'],
|
|
67
|
+
label: 'Colors',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: 'section',
|
|
71
|
+
key: 'accordion',
|
|
72
|
+
label: 'Accordion',
|
|
73
|
+
children: [
|
|
74
|
+
{
|
|
75
|
+
key: 'Color2',
|
|
76
|
+
type: 'radio',
|
|
77
|
+
defaultValue: 'blue',
|
|
78
|
+
values: ['blue', 'white', 'red'],
|
|
79
|
+
label: 'Color2',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: 'datalabels',
|
|
83
|
+
type: 'toggle',
|
|
84
|
+
defaultValue: false,
|
|
85
|
+
label: 'Data Labels',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
89
91
|
},
|
|
90
92
|
renderChart: (cx) => {
|
|
91
93
|
return Promise.resolve();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-chart-context-mock.js","sourceRoot":"","sources":["../../../src/react/mocks/custom-chart-context-mock.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,MAAM,CAAC,MAAM,iBAAiB,GAA4B;IACtD,qBAAqB,EAAE,CAAC,UAAsB,EAAiB,EAAE;Q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EAAE,GAAG;oBACR,KAAK,EAAE,eAAe;oBACtB,qBAAqB,EAAE,IAAI;oBAC3B,mBAAmB,EAAE,KAAK;oBAC1B,sBAAsB,EAAE,IAAI;oBAC5B,cAAc,EAAE,CAAC;iBACpB;gBACD;oBACI,GAAG,EAAE,GAAG;oBACR,KAAK,EAAE,eAAe;oBACtB,qBAAqB,EAAE,KAAK;oBAC5B,mBAAmB,EAAE,IAAI;oBACzB,sBAAsB,EAAE,KAAK;iBAChC;aACJ;SACJ;KACJ;IACD,
|
|
1
|
+
{"version":3,"file":"custom-chart-context-mock.js","sourceRoot":"","sources":["../../../src/react/mocks/custom-chart-context-mock.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,MAAM,CAAC,MAAM,iBAAiB,GAA4B;IACtD,qBAAqB,EAAE,CAAC,UAAsB,EAAiB,EAAE;QAC7D,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;QAEhC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAC3B,IAAI,EACJ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,CAC3C,CAAC;QAEF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAC7B,IAAI,EACJ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,SAAS,CAC7C,CAAC;QAEF,MAAM,UAAU,GAAgB;YAC5B,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE;gBACR;oBACI,GAAG,EAAE,GAAG;oBACR,OAAO,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;iBACjC;gBACD;oBACI,GAAG,EAAE,GAAG;oBACR,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;iBACtC;aACJ;SACJ,CAAC;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,KAAK,EAAE,WAAW;oBAClB,QAAQ,EAAE;wBACN;4BACI,GAAG,EAAE,QAAQ;4BACb,IAAI,EAAE,OAAO;4BACb,YAAY,EAAE,MAAM;4BACpB,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;4BAChC,KAAK,EAAE,QAAQ;yBAClB;wBACD;4BACI,GAAG,EAAE,YAAY;4BACjB,IAAI,EAAE,QAAQ;4BACd,YAAY,EAAE,KAAK;4BACnB,KAAK,EAAE,aAAa;yBACvB;qBACJ;iBACJ;aACJ;SACJ,CAAC;IACN,CAAC;IACD,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE;QAChB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ describe('CustomChartContext', () => {
|
|
|
20
20
|
let eventProcessor: any;
|
|
21
21
|
|
|
22
22
|
let getDefaultChartConfig = jest.fn();
|
|
23
|
+
let getVisualPropEditorDefinition = jest.fn();
|
|
23
24
|
let getQueriesFromChartConfig = jest.fn();
|
|
24
25
|
let renderChart = jest.fn();
|
|
25
26
|
const mockInitMessage = jest.spyOn(
|
|
@@ -33,6 +34,7 @@ describe('CustomChartContext', () => {
|
|
|
33
34
|
|
|
34
35
|
beforeEach(() => {
|
|
35
36
|
getDefaultChartConfig = jest.fn();
|
|
37
|
+
getVisualPropEditorDefinition = jest.fn();
|
|
36
38
|
getQueriesFromChartConfig = jest.fn();
|
|
37
39
|
renderChart = jest.fn();
|
|
38
40
|
|
|
@@ -52,6 +54,7 @@ describe('CustomChartContext', () => {
|
|
|
52
54
|
getDefaultChartConfig,
|
|
53
55
|
getQueriesFromChartConfig,
|
|
54
56
|
renderChart,
|
|
57
|
+
getVisualPropEditorDefinition,
|
|
55
58
|
});
|
|
56
59
|
});
|
|
57
60
|
|
|
@@ -147,6 +150,7 @@ describe('CustomChartContext', () => {
|
|
|
147
150
|
customChartContext = new CustomChartContext({
|
|
148
151
|
getDefaultChartConfig,
|
|
149
152
|
getQueriesFromChartConfig,
|
|
153
|
+
getVisualPropEditorDefinition,
|
|
150
154
|
renderChart,
|
|
151
155
|
});
|
|
152
156
|
} catch (err: any) {
|
|
@@ -158,6 +162,7 @@ describe('CustomChartContext', () => {
|
|
|
158
162
|
await getChartContext({
|
|
159
163
|
getDefaultChartConfig,
|
|
160
164
|
getQueriesFromChartConfig,
|
|
165
|
+
getVisualPropEditorDefinition,
|
|
161
166
|
renderChart,
|
|
162
167
|
});
|
|
163
168
|
} catch (err: any) {
|
|
@@ -173,6 +178,7 @@ describe('CustomChartContext', () => {
|
|
|
173
178
|
customChartContext = new CustomChartContext({
|
|
174
179
|
getDefaultChartConfig,
|
|
175
180
|
getQueriesFromChartConfig,
|
|
181
|
+
getVisualPropEditorDefinition,
|
|
176
182
|
renderChart,
|
|
177
183
|
});
|
|
178
184
|
});
|
|
@@ -387,6 +393,7 @@ describe('CustomChartContext', () => {
|
|
|
387
393
|
customChartContext = new CustomChartContext({
|
|
388
394
|
getDefaultChartConfig,
|
|
389
395
|
getQueriesFromChartConfig,
|
|
396
|
+
getVisualPropEditorDefinition,
|
|
390
397
|
renderChart,
|
|
391
398
|
});
|
|
392
399
|
});
|
|
@@ -503,6 +510,7 @@ describe('CustomChartContext', () => {
|
|
|
503
510
|
customChartContext = new CustomChartContext({
|
|
504
511
|
getDefaultChartConfig,
|
|
505
512
|
getQueriesFromChartConfig,
|
|
513
|
+
getVisualPropEditorDefinition,
|
|
506
514
|
renderChart,
|
|
507
515
|
});
|
|
508
516
|
});
|
|
@@ -104,9 +104,13 @@ export type CustomChartContextProps = {
|
|
|
104
104
|
* on the TS app. If not provided, visual properties will not be configurable in
|
|
105
105
|
* editor
|
|
106
106
|
*
|
|
107
|
-
* @
|
|
107
|
+
* @param chartModel
|
|
108
|
+
* @returns {@link VisualPropEditorDefinition}
|
|
109
|
+
* @version SDK: 0.0.1-alpha.6 | ThoughtSpot:
|
|
108
110
|
*/
|
|
109
|
-
|
|
111
|
+
getVisualPropEditorDefinition: (
|
|
112
|
+
chartModel: ChartModel,
|
|
113
|
+
) => VisualPropEditorDefinition;
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
/**
|
|
@@ -116,7 +120,6 @@ const DEFAULT_CHART_CONTEXT_PROPS: Partial<CustomChartContextProps> = {
|
|
|
116
120
|
validateConfig: () => ({ isValid: true }),
|
|
117
121
|
validateVisualProps: () => ({ isValid: true }),
|
|
118
122
|
chartConfigEditorDefinition: undefined,
|
|
119
|
-
visualPropEditorDefinition: undefined,
|
|
120
123
|
};
|
|
121
124
|
|
|
122
125
|
export class CustomChartContext {
|
|
@@ -556,7 +559,9 @@ export class CustomChartContext {
|
|
|
556
559
|
chartConfigEditorDefinition:
|
|
557
560
|
this.chartContextProps.chartConfigEditorDefinition,
|
|
558
561
|
visualPropEditorDefinition:
|
|
559
|
-
this.chartContextProps.
|
|
562
|
+
this.chartContextProps.getVisualPropEditorDefinition(
|
|
563
|
+
this.chartModel,
|
|
564
|
+
),
|
|
560
565
|
};
|
|
561
566
|
};
|
|
562
567
|
|
|
@@ -77,36 +77,38 @@ export const contextChartProps: CustomChartContextProps = {
|
|
|
77
77
|
],
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
80
|
+
getVisualPropEditorDefinition: (chartModel: ChartModel) => {
|
|
81
|
+
return {
|
|
82
|
+
elements: [
|
|
83
|
+
{
|
|
84
|
+
key: 'color',
|
|
85
|
+
type: 'radio',
|
|
86
|
+
defaultValue: 'red',
|
|
87
|
+
values: ['red', 'green', 'yellow'],
|
|
88
|
+
label: 'Colors',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'section',
|
|
92
|
+
key: 'accordion',
|
|
93
|
+
label: 'Accordion',
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
key: 'Color2',
|
|
97
|
+
type: 'radio',
|
|
98
|
+
defaultValue: 'blue',
|
|
99
|
+
values: ['blue', 'white', 'red'],
|
|
100
|
+
label: 'Color2',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: 'datalabels',
|
|
104
|
+
type: 'toggle',
|
|
105
|
+
defaultValue: false,
|
|
106
|
+
label: 'Data Labels',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
110
112
|
},
|
|
111
113
|
renderChart: (cx) => {
|
|
112
114
|
return Promise.resolve();
|
package/dist/ts-chart-sdk.d.ts
DELETED
|
@@ -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
|
-
|