@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
|
@@ -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;QAC7D,MAAM,IAAI,GAAG,UAAU,CAAC,OAA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tB,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;QACF,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB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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
|
@@ -104,6 +104,8 @@ 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
|
+
* @param chartModel
|
|
108
|
+
* @returns {@link VisualPropEditorDefinition}
|
|
107
109
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
108
110
|
*/
|
|
109
111
|
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
@@ -116,7 +118,6 @@ const DEFAULT_CHART_CONTEXT_PROPS: Partial<CustomChartContextProps> = {
|
|
|
116
118
|
validateConfig: () => ({ isValid: true }),
|
|
117
119
|
validateVisualProps: () => ({ isValid: true }),
|
|
118
120
|
chartConfigEditorDefinition: undefined,
|
|
119
|
-
visualPropEditorDefinition: undefined,
|
|
120
121
|
};
|
|
121
122
|
|
|
122
123
|
export class CustomChartContext {
|
|
@@ -549,7 +550,6 @@ export class CustomChartContext {
|
|
|
549
550
|
this.chartModel,
|
|
550
551
|
);
|
|
551
552
|
}
|
|
552
|
-
|
|
553
553
|
return {
|
|
554
554
|
isConfigValid: isValid,
|
|
555
555
|
defaultChartConfig,
|
|
@@ -17,49 +17,49 @@ export interface InputValidation {
|
|
|
17
17
|
*
|
|
18
18
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
19
19
|
*/
|
|
20
|
-
required
|
|
20
|
+
required?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Error message to display when input is required but not provided.
|
|
23
23
|
*
|
|
24
24
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
25
25
|
*/
|
|
26
|
-
requiredError
|
|
26
|
+
requiredError?: string;
|
|
27
27
|
/**
|
|
28
28
|
* Regular expression pattern to validate the input against.
|
|
29
29
|
*
|
|
30
30
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
31
31
|
*/
|
|
32
|
-
regex
|
|
32
|
+
regex?: string;
|
|
33
33
|
/**
|
|
34
34
|
* Error message to display when input doesn't match the regex pattern.
|
|
35
35
|
*
|
|
36
36
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
37
37
|
*/
|
|
38
|
-
regexError
|
|
38
|
+
regexError?: string;
|
|
39
39
|
/**
|
|
40
40
|
* Minimum length required for the input.
|
|
41
41
|
*
|
|
42
42
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
43
43
|
*/
|
|
44
|
-
minLength
|
|
44
|
+
minLength?: number;
|
|
45
45
|
/**
|
|
46
46
|
* Error message to display when input length is less than the required minimum.
|
|
47
47
|
*
|
|
48
48
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
49
49
|
*/
|
|
50
|
-
minLengthError
|
|
50
|
+
minLengthError?: string;
|
|
51
51
|
/**
|
|
52
52
|
* Range of values allowed for the input.
|
|
53
53
|
*
|
|
54
54
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
55
55
|
*/
|
|
56
|
-
range
|
|
56
|
+
range?: string;
|
|
57
57
|
/**
|
|
58
58
|
* Error message to display when input value is outside the allowed range.
|
|
59
59
|
*
|
|
60
60
|
* @version SDK: 0.0.1-alpha.3 | ThoughtSpot:
|
|
61
61
|
*/
|
|
62
|
-
rangeError
|
|
62
|
+
rangeError?: string;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -115,6 +115,73 @@ export interface TextInputFormDetail {
|
|
|
115
115
|
inputValidation?: InputValidation;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Number Form Element for the visual props editor
|
|
120
|
+
*
|
|
121
|
+
* @group Visual Properties Editor
|
|
122
|
+
*/
|
|
123
|
+
export interface NumberInputFormDetail {
|
|
124
|
+
type: 'number';
|
|
125
|
+
/**
|
|
126
|
+
* Key to store the value
|
|
127
|
+
*
|
|
128
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
129
|
+
*/
|
|
130
|
+
key: string;
|
|
131
|
+
/**
|
|
132
|
+
* I18n'ed string to show on the form label
|
|
133
|
+
*
|
|
134
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
135
|
+
*/
|
|
136
|
+
label?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Default value
|
|
139
|
+
*
|
|
140
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
141
|
+
*/
|
|
142
|
+
defaultValue?: number;
|
|
143
|
+
/**
|
|
144
|
+
* inputValidation config for input field
|
|
145
|
+
*
|
|
146
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
147
|
+
*/
|
|
148
|
+
inputValidation?: InputValidation;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Color Picker Form Element for the visual props editor
|
|
153
|
+
*
|
|
154
|
+
* @group Visual Properties Editor
|
|
155
|
+
*/
|
|
156
|
+
export interface ColorPickerFormDetail {
|
|
157
|
+
type: 'colorpicker';
|
|
158
|
+
/**
|
|
159
|
+
* Key to store the value
|
|
160
|
+
*
|
|
161
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
162
|
+
*/
|
|
163
|
+
key: string;
|
|
164
|
+
/**
|
|
165
|
+
* I18n'ed string to show on the form label
|
|
166
|
+
*
|
|
167
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
168
|
+
*/
|
|
169
|
+
label?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Display selected color with font or with color only
|
|
172
|
+
*
|
|
173
|
+
* @default COLOR
|
|
174
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
175
|
+
*/
|
|
176
|
+
selectorType?: 'FONT' | 'COLOR';
|
|
177
|
+
/**
|
|
178
|
+
* Default value
|
|
179
|
+
*
|
|
180
|
+
* @version SDK: 0.0.1-alpha.7 | ThoughtSpot:
|
|
181
|
+
*/
|
|
182
|
+
defaultValue?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
118
185
|
/**
|
|
119
186
|
* Toggle Form Element for the visual props editor
|
|
120
187
|
*
|
|
@@ -284,6 +351,8 @@ export interface Section {
|
|
|
284
351
|
export type PropElement =
|
|
285
352
|
| Section
|
|
286
353
|
| TextInputFormDetail
|
|
354
|
+
| NumberInputFormDetail
|
|
355
|
+
| ColorPickerFormDetail
|
|
287
356
|
| ToggleFormDetail
|
|
288
357
|
| CheckboxFormDetail
|
|
289
358
|
| RadioButtonFormDetail
|
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
|
-
|