@thoughtspot/ts-chart-sdk 0.0.2-alpha.2 → 0.0.2-alpha.4

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.
Files changed (86) hide show
  1. package/package.json +2 -2
  2. package/src/index.ts +2 -0
  3. package/src/main/custom-chart-context.spec.ts +118 -1
  4. package/src/main/custom-chart-context.ts +113 -8
  5. package/src/main/post-message-event-bridge.ts +1 -1
  6. package/src/test/test-conditional-formatting-utils.ts +95 -0
  7. package/src/types/answer-column.types.ts +63 -0
  8. package/src/types/common.types.ts +8 -0
  9. package/src/types/conditional-formatting.types.ts +172 -0
  10. package/src/types/configurator.types.ts +7 -0
  11. package/src/types/ts-to-chart-event.types.ts +2 -1
  12. package/src/types/visual-prop.types.ts +7 -0
  13. package/src/utils/conditional-formatting/conditional-formatting.spec.ts +415 -0
  14. package/src/utils/conditional-formatting/conditional-formatting.ts +229 -0
  15. package/lib/index.d.ts +0 -9
  16. package/lib/index.d.ts.map +0 -1
  17. package/lib/index.js +0 -9
  18. package/lib/index.js.map +0 -1
  19. package/lib/main/custom-chart-context.d.ts +0 -54
  20. package/lib/main/custom-chart-context.d.ts.map +0 -1
  21. package/lib/main/custom-chart-context.js +0 -292
  22. package/lib/main/custom-chart-context.js.map +0 -1
  23. package/lib/main/custom-chart-context.spec.d.ts +0 -2
  24. package/lib/main/custom-chart-context.spec.d.ts.map +0 -1
  25. package/lib/main/custom-chart-context.spec.js +0 -518
  26. package/lib/main/custom-chart-context.spec.js.map +0 -1
  27. package/lib/main/post-message-event-bridge.d.ts +0 -6
  28. package/lib/main/post-message-event-bridge.d.ts.map +0 -1
  29. package/lib/main/post-message-event-bridge.js +0 -29
  30. package/lib/main/post-message-event-bridge.js.map +0 -1
  31. package/lib/main/post-message-event-bridge.spec.d.ts +0 -2
  32. package/lib/main/post-message-event-bridge.spec.d.ts.map +0 -1
  33. package/lib/main/post-message-event-bridge.spec.js +0 -117
  34. package/lib/main/post-message-event-bridge.spec.js.map +0 -1
  35. package/lib/main/util.d.ts +0 -2
  36. package/lib/main/util.d.ts.map +0 -1
  37. package/lib/main/util.js +0 -9
  38. package/lib/main/util.js.map +0 -1
  39. package/lib/react/mocks/custom-chart-context-mock.d.ts +0 -3
  40. package/lib/react/mocks/custom-chart-context-mock.d.ts.map +0 -1
  41. package/lib/react/mocks/custom-chart-context-mock.js +0 -94
  42. package/lib/react/mocks/custom-chart-context-mock.js.map +0 -1
  43. package/lib/react/use-custom-chart-context.d.ts +0 -4
  44. package/lib/react/use-custom-chart-context.d.ts.map +0 -1
  45. package/lib/react/use-custom-chart-context.js +0 -68
  46. package/lib/react/use-custom-chart-context.js.map +0 -1
  47. package/lib/react/use-custom-chart-context.spec.d.ts +0 -2
  48. package/lib/react/use-custom-chart-context.spec.d.ts.map +0 -1
  49. package/lib/react/use-custom-chart-context.spec.js +0 -318
  50. package/lib/react/use-custom-chart-context.spec.js.map +0 -1
  51. package/lib/react/use-custom-chart-context.util.d.ts +0 -6
  52. package/lib/react/use-custom-chart-context.util.d.ts.map +0 -1
  53. package/lib/react/use-custom-chart-context.util.js +0 -51
  54. package/lib/react/use-custom-chart-context.util.js.map +0 -1
  55. package/lib/react/use-custom-chart-types.d.ts +0 -23
  56. package/lib/react/use-custom-chart-types.d.ts.map +0 -1
  57. package/lib/react/use-custom-chart-types.js +0 -2
  58. package/lib/react/use-custom-chart-types.js.map +0 -1
  59. package/lib/test/test-utils.d.ts +0 -7
  60. package/lib/test/test-utils.d.ts.map +0 -1
  61. package/lib/test/test-utils.js +0 -11
  62. package/lib/test/test-utils.js.map +0 -1
  63. package/lib/types/answer-column.types.d.ts +0 -69
  64. package/lib/types/answer-column.types.d.ts.map +0 -1
  65. package/lib/types/answer-column.types.js +0 -56
  66. package/lib/types/answer-column.types.js.map +0 -1
  67. package/lib/types/chart-to-ts-event.types.d.ts +0 -98
  68. package/lib/types/chart-to-ts-event.types.d.ts.map +0 -1
  69. package/lib/types/chart-to-ts-event.types.js +0 -29
  70. package/lib/types/chart-to-ts-event.types.js.map +0 -1
  71. package/lib/types/common.types.d.ts +0 -52
  72. package/lib/types/common.types.d.ts.map +0 -1
  73. package/lib/types/common.types.js +0 -2
  74. package/lib/types/common.types.js.map +0 -1
  75. package/lib/types/configurator.types.d.ts +0 -15
  76. package/lib/types/configurator.types.d.ts.map +0 -1
  77. package/lib/types/configurator.types.js +0 -2
  78. package/lib/types/configurator.types.js.map +0 -1
  79. package/lib/types/ts-to-chart-event.types.d.ts +0 -94
  80. package/lib/types/ts-to-chart-event.types.d.ts.map +0 -1
  81. package/lib/types/ts-to-chart-event.types.js +0 -15
  82. package/lib/types/ts-to-chart-event.types.js.map +0 -1
  83. package/lib/types/visual-prop.types.d.ts +0 -73
  84. package/lib/types/visual-prop.types.d.ts.map +0 -1
  85. package/lib/types/visual-prop.types.js +0 -2
  86. package/lib/types/visual-prop.types.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ /**
2
+ * @file: Conditional Formatting Utils
3
+ * @fileoverview All CF utils for the Custom Chart implementations
4
+ * @author Yashvardhan Nehra <yashvardhan.nehra@thoughtspot.com>
5
+ *
6
+ * Copyright: ThoughtSpot Inc. 2023
7
+ */
8
+
9
+ import _ from 'lodash';
10
+ import { ChartColumn } from '../../types/answer-column.types';
11
+ import { DataPointsArray } from '../../types/common.types';
12
+ import {
13
+ ConditionalFormatting,
14
+ ConditionalFormattingComparisonTypes,
15
+ ConditionalMetric,
16
+ Operators,
17
+ Parameter,
18
+ } from '../../types/conditional-formatting.types';
19
+
20
+ export const getMinRangeValue = (
21
+ metric: ConditionalMetric,
22
+ ): number | undefined | null => metric?.rangeValues?.min;
23
+
24
+ export const getMaxRangeValue = (
25
+ metric: ConditionalMetric,
26
+ ): number | undefined | null => metric?.rangeValues?.max;
27
+
28
+ /**
29
+ * Performs a value-based comparison between two values based on the specified operator in the
30
+ * metric.
31
+ *
32
+ * @param metric - The conditional formatting metric info
33
+ * @param lhsValue - The left-hand side value to compare.
34
+ * @param rhsValue - The right-hand side value to compare.
35
+ * @returns Boolean indicating the result of the comparison.
36
+ */
37
+ const doValueBasedComparison = (
38
+ metric: ConditionalMetric,
39
+ lhsValue?: string | number | null,
40
+ rhsValue?: string | number | null,
41
+ ): boolean => {
42
+ switch (metric.operator) {
43
+ case Operators.Is:
44
+ case Operators.EqualTo:
45
+ return (
46
+ !_.isNil(lhsValue) &&
47
+ !_.isNil(rhsValue) &&
48
+ (_.isEqual(lhsValue, rhsValue) ||
49
+ _.isEqual(_.toString(lhsValue), _.toString(rhsValue)))
50
+ );
51
+ case Operators.IsNot:
52
+ case Operators.NotEqualTo: {
53
+ if (_.isNil(lhsValue) || _.isNil(rhsValue))
54
+ return lhsValue !== rhsValue;
55
+ return !_.isEqual(_.toString(lhsValue), _.toString(rhsValue));
56
+ }
57
+ case Operators.IsNull:
58
+ case Operators.IsEmpty:
59
+ return _.isNil(lhsValue);
60
+ case Operators.IsNotNull:
61
+ case Operators.IsNotEmpty:
62
+ return !_.isNil(lhsValue);
63
+ case Operators.LessThan:
64
+ return _.toNumber(lhsValue) < _.toNumber(rhsValue);
65
+ case Operators.LessThanEqualTo:
66
+ return _.toNumber(lhsValue) <= _.toNumber(rhsValue);
67
+ case Operators.GreaterThan:
68
+ return _.toNumber(lhsValue) > _.toNumber(rhsValue);
69
+ case Operators.GreaterThanEqualTo:
70
+ return _.toNumber(lhsValue) >= _.toNumber(rhsValue);
71
+ case Operators.IsBetween:
72
+ return (
73
+ lhsValue != null &&
74
+ +lhsValue >= (getMinRangeValue(metric) ?? -Infinity) &&
75
+ +lhsValue <= (getMaxRangeValue(metric) ?? Infinity)
76
+ );
77
+ case Operators.Contains:
78
+ return (
79
+ lhsValue != null &&
80
+ rhsValue != null &&
81
+ _.includes(_.toString(lhsValue), rhsValue.toString())
82
+ );
83
+ case Operators.DoesNotContain:
84
+ return (
85
+ lhsValue != null &&
86
+ rhsValue != null &&
87
+ !_.includes(_.toString(lhsValue), rhsValue.toString())
88
+ );
89
+ case Operators.StartsWith:
90
+ return (
91
+ lhsValue != null &&
92
+ rhsValue != null &&
93
+ _.startsWith(_.toString(lhsValue), rhsValue.toString())
94
+ );
95
+ case Operators.EndsWith:
96
+ return (
97
+ lhsValue != null &&
98
+ rhsValue != null &&
99
+ _.endsWith(_.toString(lhsValue), rhsValue.toString())
100
+ );
101
+ default:
102
+ return false;
103
+ }
104
+ };
105
+
106
+ /**
107
+ * Evaluates whether the condition defined by the metric is satisfied.
108
+ *
109
+ * @param metric - The conditional formatting metric info
110
+ * @param parameters - An array of parameters that may include the parameter needed for ParameterBased comparison.
111
+ * @param lhsColValue - The value of the left-hand side column, used in ColumnBased and some ValueBased comparisons.
112
+ * @param rhsColValue - The value of the right-hand side column, used in ColumnBased comparisons.
113
+ * @returns Boolean indicating whether the condition is satisfied.
114
+ */
115
+ export const isConditionSatisfied = (
116
+ metric: ConditionalMetric,
117
+ parameters?: Parameter[],
118
+ lhsColValue?: string | number | null,
119
+ rhsColValue?: string | number | null,
120
+ ): boolean => {
121
+ let parameter = null;
122
+ let parameterValue = null;
123
+ switch (metric.comparisonType) {
124
+ case ConditionalFormattingComparisonTypes.ValueBased:
125
+ return doValueBasedComparison(metric, lhsColValue, metric.value);
126
+ case ConditionalFormattingComparisonTypes.ParameterBased:
127
+ parameter = parameters?.find(
128
+ (parameter: Parameter) =>
129
+ parameter.id === metric.comparisonParameterId,
130
+ );
131
+ parameterValue =
132
+ parameter?.overrideValue || parameter?.defaultValue;
133
+ return doValueBasedComparison(metric, lhsColValue, parameterValue);
134
+ case ConditionalFormattingComparisonTypes.ColumnBased:
135
+ return doValueBasedComparison(metric, lhsColValue, rhsColValue);
136
+ default:
137
+ return doValueBasedComparison(metric, lhsColValue, metric.value);
138
+ }
139
+ };
140
+
141
+ /**
142
+ * Validates if the conditional rule is applicable or not.
143
+ *
144
+ * @param conditionalMetric - The conditional rule to be validated.
145
+ * @param index - The index of the data point to evaluate.
146
+ * @param columnId - The ID of the column for which to validate the rule.
147
+ * @param dataAttr - The data points array containing the data for the chart.
148
+ * @param inScopeParameters - The list of parameters available for the chart.
149
+ * @returns Boolean indicating if the conditional rule is applicable or not.
150
+ */
151
+ export function validateCfCondition(
152
+ conditionalMetric: ConditionalMetric,
153
+ index: number,
154
+ columnId: string,
155
+ dataAttr?: DataPointsArray,
156
+ inScopeParameters?: Parameter[],
157
+ ): boolean {
158
+ let lhsColumnValue;
159
+ let rhsColumnValue;
160
+ if (dataAttr?.columns) {
161
+ const columnIdx = _.findIndex(
162
+ dataAttr.columns,
163
+ (colId) => colId === columnId,
164
+ );
165
+ lhsColumnValue = dataAttr?.dataValue[index][columnIdx];
166
+ }
167
+ const lhsId = conditionalMetric.lhsColumnId;
168
+ const rhsId = conditionalMetric.rhsColumnId;
169
+ if (lhsId && dataAttr?.columns) {
170
+ const lhsIdx = _.findIndex(
171
+ dataAttr.columns,
172
+ (colId) => colId === lhsId,
173
+ );
174
+ lhsColumnValue = dataAttr?.dataValue[index][lhsIdx];
175
+ }
176
+ if (rhsId && dataAttr?.columns) {
177
+ const rhsIdx = _.findIndex(
178
+ dataAttr.columns,
179
+ (colId) => colId === rhsId,
180
+ );
181
+ rhsColumnValue = dataAttr?.dataValue[index][rhsIdx];
182
+ }
183
+ return isConditionSatisfied(
184
+ conditionalMetric,
185
+ inScopeParameters,
186
+ lhsColumnValue,
187
+ rhsColumnValue,
188
+ );
189
+ }
190
+
191
+ /**
192
+ * Evaluates all conditional formatting rules against a specific data point and returns the first
193
+ * applicable rule.
194
+ *
195
+ * @param idx - The index of the data point to evaluate.
196
+ * @param columnId - The ID of the column for which to validate the rule.
197
+ * @param dataArr - The array of data points against which the conditional formatting rules will be evaluated.
198
+ * @param conditionalFormatting - The conditional formattings applied on a column.
199
+ * @returns The first ConditionalMetric that is applicable to the specified data point, or null if no rules are applicable.
200
+ */
201
+ export const applicableConditionalFormatting = (
202
+ idx: number,
203
+ columnId: string,
204
+ dataArr: DataPointsArray,
205
+ conditionalFormatting?: ConditionalFormatting,
206
+ ): ConditionalMetric | null => {
207
+ return (
208
+ _.find(conditionalFormatting?.rows, (conditionalMetric) => {
209
+ return validateCfCondition(
210
+ conditionalMetric as ConditionalMetric,
211
+ idx,
212
+ columnId,
213
+ dataArr,
214
+ );
215
+ }) || null
216
+ );
217
+ };
218
+
219
+ /**
220
+ * Retrieves all conditional formatting rules applied to a column.
221
+ *
222
+ * @param column - The column for which to retrieve conditional formatting rules.
223
+ * @returns An array of ConditionalFormatting configurations applied to the specified column, or undefined if no configurations are applicable.
224
+ */
225
+ export function getCfForColumn(
226
+ column: ChartColumn,
227
+ ): ConditionalFormatting | undefined {
228
+ return column?.columnProperties?.conditionalFormatting || undefined;
229
+ }
package/lib/index.d.ts DELETED
@@ -1,9 +0,0 @@
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
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
package/lib/index.js DELETED
@@ -1,9 +0,0 @@
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
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","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"}
@@ -1,54 +0,0 @@
1
- import { ChartToTSEventsPayloadMap, OpenAxisMenuEventPayload, OpenContextMenuEventPayload } from '../types/chart-to-ts-event.types';
2
- import { AppConfig, ChartConfig, ChartModel, ValidationResponse, VisualProps } from '../types/common.types';
3
- import { ChartConfigEditorDefinition } from '../types/configurator.types';
4
- import { Query, TSToChartEventsPayloadMap } from '../types/ts-to-chart-event.types';
5
- import { VisualPropEditorDefinition } from '../types/visual-prop.types';
6
- export type AllowedConfigurations = {
7
- allowColumnNumberFormatting: boolean;
8
- allowColumnConditionalFormatting: boolean;
9
- };
10
- export type CustomChartContextProps = {
11
- getDefaultChartConfig: (chartModel: ChartModel) => ChartConfig[];
12
- getQueriesFromChartConfig: (chartConfig: ChartConfig[], chartModel: ChartModel) => Query[];
13
- renderChart: (ctx: CustomChartContext) => Promise<void>;
14
- validateConfig?: (updatedConfig: ChartConfig[], chartModel: ChartModel) => ValidationResponse;
15
- validateVisualProps?: (updatedVisualProps: VisualProps, chartModel: ChartModel) => ValidationResponse;
16
- chartConfigEditorDefinition?: ChartConfigEditorDefinition[];
17
- visualPropEditorDefinition?: VisualPropEditorDefinition;
18
- allowedConfigurations?: AllowedConfigurations;
19
- };
20
- export declare class CustomChartContext {
21
- private componentId;
22
- private removeListener;
23
- private hostUrl;
24
- private chartModel;
25
- private appConfig;
26
- private chartContextProps;
27
- private eventListeners;
28
- private hasInitializedPromise;
29
- private triggerInitResolve;
30
- private contextMenuActionHandler;
31
- private axisMenuActionHandler;
32
- containerEl: HTMLElement | null;
33
- constructor(chartContextProps: CustomChartContextProps);
34
- initialize: () => Promise<void>;
35
- on<T extends keyof TSToChartEventsPayloadMap>(eventType: T, callbackFn: TSToChartEventsPayloadMap[T]): void;
36
- off<T extends keyof TSToChartEventsPayloadMap>(eventType: T): void;
37
- private onInternal;
38
- destroy(): void;
39
- getChartModel: () => ChartModel;
40
- getAppConfig: () => AppConfig;
41
- contextMenuCustomActionPreProcessor(eventPayload: [OpenContextMenuEventPayload]): [OpenContextMenuEventPayload];
42
- axisMenuCustomActionPreProcessor(eventPayload: [OpenAxisMenuEventPayload]): [OpenAxisMenuEventPayload];
43
- private eventPayloadPreProcessor;
44
- emitEvent<T extends keyof ChartToTSEventsPayloadMap>(eventType: T, ...eventPayload: ChartToTSEventsPayloadMap[T]): Promise<any>;
45
- private registerEventProcessor;
46
- private eventProcessor;
47
- private registerEvents;
48
- private initializeContext;
49
- private initializationComplete;
50
- private publishChartContextPropsToHost;
51
- private executeEventListenerCBs;
52
- }
53
- export declare const getChartContext: (customChartConfig: CustomChartContextProps) => Promise<CustomChartContext>;
54
- //# sourceMappingURL=custom-chart-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context.d.ts","sourceRoot":"","sources":["../../src/main/custom-chart-context.ts"],"names":[],"mappings":"AASA,OAAO,EAGH,yBAAyB,EAIzB,wBAAwB,EACxB,2BAA2B,EAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,SAAS,EACT,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,WAAW,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAUH,KAAK,EAEL,yBAAyB,EAI5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAOxE,MAAM,MAAM,qBAAqB,GAAG;IAChC,2BAA2B,EAAE,OAAO,CAAC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AC/C,SAAS,EAAE,CAAC,EACZ,UAAU,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACzC,IAAI;IAeA,GAAG,CAAC,CAAC,SAAS,MAAM,yBAAyB,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI;IAiBzE,OAAO,CAAC,UAAU;IAgBX,OAAO;IAUP,aAAa,QAAO,UAAU,CAAoB;IAOlD,YAAY,QAAO,SAAS,CAAmB;IAQ/C,mCAAmC,CACtC,YAAY,EAAE,CAAC,2BAA2B,CAAC,GAC5C,CAAC,2BAA2B,CAAC;IAiCzB,gCAAgC,CACnC,YAAY,EAAE,CAAC,wBAAwB,CAAC,GACzC,CAAC,wBAAwB,CAAC;IAiC7B,OAAO,CAAC,wBAAwB;IA0BzB,SAAS,CAAC,CAAC,SAAS,MAAM,yBAAyB,EACtD,SAAS,EAAE,CAAC,EACZ,GAAG,YAAY,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,GAAG,CAAC;IAuBf,OAAO,CAAC,sBAAsB,CAU5B;IAOF,OAAO,CAAC,cAAc,CAOpB;IAOF,OAAO,CAAC,cAAc,CAsOpB;IASF,OAAO,CAAC,iBAAiB,CAYvB;IAEF,OAAO,CAAC,sBAAsB,CAM5B;IAEF,OAAO,CAAC,8BAA8B,CA+BhC;IAQN,OAAO,CAAC,uBAAuB,CAyB7B;CACL;AAQD,eAAO,MAAM,eAAe,sBACL,uBAAuB,KAC3C,QAAQ,kBAAkB,CAO5B,CAAC"}
@@ -1,292 +0,0 @@
1
- import _ from 'lodash';
2
- import { ChartToTSEvent, ErrorType, } from '../types/chart-to-ts-event.types';
3
- import { TSToChartEvent, } from '../types/ts-to-chart-event.types';
4
- import { globalThis, initMessageListener, postMessageToHostApp, } from './post-message-event-bridge';
5
- const DEFAULT_CHART_CONTEXT_PROPS = {
6
- validateConfig: () => ({ isValid: true }),
7
- validateVisualProps: () => ({ isValid: true }),
8
- chartConfigEditorDefinition: undefined,
9
- allowedConfigurations: {
10
- allowColumnNumberFormatting: false,
11
- allowColumnConditionalFormatting: false,
12
- },
13
- };
14
- export class CustomChartContext {
15
- constructor(chartContextProps) {
16
- this.componentId = '';
17
- this.removeListener = _.noop;
18
- this.hostUrl = '';
19
- this.chartModel = {};
20
- this.appConfig = {};
21
- this.chartContextProps = DEFAULT_CHART_CONTEXT_PROPS;
22
- this.eventListeners = {};
23
- this.triggerInitResolve = _.noop;
24
- this.contextMenuActionHandler = {};
25
- this.axisMenuActionHandler = {};
26
- this.containerEl = null;
27
- this.initialize = () => {
28
- console.log('Chart Context: initialization start');
29
- return this.hasInitializedPromise;
30
- };
31
- this.getChartModel = () => this.chartModel;
32
- this.getAppConfig = () => this.appConfig;
33
- this.registerEventProcessor = () => {
34
- if (globalThis.isInitialized) {
35
- console.error('The context is already initialized. you cannot have multiple contexts');
36
- throw new Error(ErrorType.MultipleContextsNotSupported);
37
- }
38
- this.removeListener = initMessageListener(this.eventProcessor);
39
- this.registerEvents();
40
- };
41
- this.eventProcessor = (data) => {
42
- console.log('Chart Context: message received:', data.eventType, data);
43
- const messageResponse = this.executeEventListenerCBs(data);
44
- return messageResponse;
45
- };
46
- this.registerEvents = () => {
47
- this.onInternal(TSToChartEvent.Initialize, (payload) => this.initializeContext(payload));
48
- this.onInternal(TSToChartEvent.InitializeComplete, () => this.initializationComplete());
49
- this.onInternal(TSToChartEvent.VisualPropsValidate, (payload) => {
50
- if (this.chartContextProps.validateVisualProps) {
51
- const validationResponse = this.chartContextProps.validateVisualProps(payload.visualProps, this.chartModel);
52
- return validationResponse;
53
- }
54
- return { isValid: false };
55
- });
56
- this.onInternal(TSToChartEvent.ChartConfigValidate, (payload) => {
57
- if (this.chartContextProps.validateConfig) {
58
- const validationResponse = this.chartContextProps.validateConfig(payload.chartConfig, this.chartModel);
59
- return validationResponse;
60
- }
61
- return { isValid: false };
62
- });
63
- this.onInternal(TSToChartEvent.GetDataQuery, (payload) => {
64
- const queries = this.chartContextProps.getQueriesFromChartConfig(payload.config, this.chartModel);
65
- return {
66
- queries,
67
- };
68
- });
69
- this.onInternal(TSToChartEvent.TriggerRenderChart, () => {
70
- this.chartContextProps.renderChart(this);
71
- });
72
- this.onInternal(TSToChartEvent.ContextMenuActionClick, (payload) => {
73
- try {
74
- const { id: customActionCallback, clickedPoint, selectedPoints, event, } = payload.customAction;
75
- const customActionCallbackArgs = {
76
- id: customActionCallback,
77
- clickedPoint,
78
- selectedPoints,
79
- event,
80
- };
81
- this.contextMenuActionHandler[customActionCallback](customActionCallbackArgs);
82
- return {
83
- isValid: true,
84
- };
85
- }
86
- catch (error) {
87
- console.log('ContextMenuCustomAction: payload recieved:', payload, 'CustomActionCallbackStore:', this.axisMenuActionHandler);
88
- return {
89
- isValid: false,
90
- error,
91
- };
92
- }
93
- });
94
- this.onInternal(TSToChartEvent.AxisMenuActionClick, (payload) => {
95
- try {
96
- const { id: customActionCallback, columnIds, event, } = payload.customAction;
97
- const customActionCallbackArgs = {
98
- id: customActionCallback,
99
- columnIds,
100
- event,
101
- };
102
- this.axisMenuActionHandler[customActionCallback](customActionCallbackArgs);
103
- return {
104
- isValid: true,
105
- };
106
- }
107
- catch (error) {
108
- console.log('AxisMenuCustomAction: payload recieved:', payload, 'CustomActionCallbackStore:', this.axisMenuActionHandler);
109
- return {
110
- isValid: false,
111
- error,
112
- };
113
- }
114
- });
115
- this.on(TSToChartEvent.ChartModelUpdate, (payload) => {
116
- this.chartModel = payload.chartModel;
117
- return {
118
- triggerRenderChart: true,
119
- };
120
- });
121
- this.on(TSToChartEvent.DataUpdate, (payload) => {
122
- this.chartModel.data = payload.data;
123
- return {
124
- triggerRenderChart: true,
125
- };
126
- });
127
- this.on(TSToChartEvent.VisualPropsUpdate, (payload) => {
128
- this.chartModel.visualProps = payload.visualProps;
129
- return {
130
- triggerRenderChart: true,
131
- };
132
- });
133
- };
134
- this.initializeContext = (payload) => {
135
- var _a;
136
- this.componentId = payload.componentId;
137
- this.hostUrl = payload.hostUrl;
138
- this.chartModel = payload.chartModel;
139
- this.appConfig = (_a = payload.appConfig) !== null && _a !== void 0 ? _a : {};
140
- this.containerEl = payload.containerElSelector
141
- ? document.querySelector(payload.containerElSelector)
142
- : null;
143
- return this.publishChartContextPropsToHost();
144
- };
145
- this.initializationComplete = () => {
146
- globalThis.isInitialized = true;
147
- this.triggerInitResolve();
148
- };
149
- this.publishChartContextPropsToHost = () => {
150
- var _a;
151
- const hasChartConfig = !_.isEmpty(this.chartModel.config.chartConfig);
152
- const { isValid } = hasChartConfig && this.chartContextProps.validateConfig
153
- ? this.chartContextProps.validateConfig((_a = this.chartModel.config.chartConfig) !== null && _a !== void 0 ? _a : [], this.chartModel)
154
- : { isValid: false };
155
- let defaultChartConfig = [];
156
- if (!isValid) {
157
- defaultChartConfig =
158
- this.chartContextProps.getDefaultChartConfig(this.chartModel);
159
- }
160
- return {
161
- isConfigValid: isValid,
162
- defaultChartConfig,
163
- chartConfigEditorDefinition: this.chartContextProps.chartConfigEditorDefinition,
164
- visualPropEditorDefinition: this.chartContextProps.visualPropEditorDefinition,
165
- allowedConfigurations: this.chartContextProps.allowedConfigurations,
166
- };
167
- };
168
- this.executeEventListenerCBs = (data) => {
169
- var _a;
170
- const payload = data.payload;
171
- let response;
172
- if (_.isArray(this.eventListeners[data.eventType])) {
173
- this.eventListeners[data.eventType].forEach((callback) => {
174
- response = callback(payload);
175
- });
176
- }
177
- else {
178
- response = {
179
- hasError: true,
180
- error: `Event type not recognised or processed: ${data.eventType}`,
181
- };
182
- }
183
- console.log('ChartContext: Response:', data.eventType, response, (_a = this.eventListeners[data.eventType]) === null || _a === void 0 ? void 0 : _a.length);
184
- return response;
185
- };
186
- this.chartContextProps = {
187
- ...DEFAULT_CHART_CONTEXT_PROPS,
188
- ...chartContextProps,
189
- };
190
- this.registerEventProcessor();
191
- this.hasInitializedPromise = new Promise((resolve, reject) => {
192
- this.triggerInitResolve = resolve;
193
- });
194
- }
195
- on(eventType, callbackFn) {
196
- if (_.isNil(this.eventListeners[eventType])) {
197
- this.eventListeners[eventType] = [];
198
- }
199
- this.eventListeners[eventType].push(callbackFn);
200
- }
201
- off(eventType) {
202
- if (_.isNil(this.eventListeners[eventType])) {
203
- console.log('No event listener found to remove');
204
- this.eventListeners[eventType] = [];
205
- return;
206
- }
207
- this.eventListeners[eventType].splice(0, 1);
208
- }
209
- onInternal(eventType, callbackFn) {
210
- if (_.isNil(this.eventListeners[eventType])) {
211
- this.eventListeners[eventType] = [];
212
- }
213
- this.eventListeners[eventType].push(callbackFn);
214
- }
215
- destroy() {
216
- this.removeListener();
217
- globalThis.isInitialized = false;
218
- }
219
- contextMenuCustomActionPreProcessor(eventPayload) {
220
- var _a, _b, _c, _d, _e;
221
- this.contextMenuActionHandler = {};
222
- if (_.isEmpty((_a = eventPayload === null || eventPayload === void 0 ? void 0 : eventPayload[0]) === null || _a === void 0 ? void 0 : _a.customActions)) {
223
- return eventPayload;
224
- }
225
- (_c = (_b = eventPayload === null || eventPayload === void 0 ? void 0 : eventPayload[0]) === null || _b === void 0 ? void 0 : _b.customActions) === null || _c === void 0 ? void 0 : _c.forEach((action) => {
226
- this.contextMenuActionHandler[action.id] = action.onClick;
227
- });
228
- const processedCustomActions = (_e = (_d = eventPayload[0]) === null || _d === void 0 ? void 0 : _d.customActions) === null || _e === void 0 ? void 0 : _e.map((action) => {
229
- return {
230
- id: action.id,
231
- label: action.label,
232
- icon: action.icon,
233
- };
234
- });
235
- const processedPayload = [
236
- {
237
- ...eventPayload[0],
238
- customActions: processedCustomActions,
239
- },
240
- ];
241
- return processedPayload;
242
- }
243
- axisMenuCustomActionPreProcessor(eventPayload) {
244
- var _a, _b, _c;
245
- this.axisMenuActionHandler = {};
246
- if (_.isEmpty((_a = eventPayload === null || eventPayload === void 0 ? void 0 : eventPayload[0]) === null || _a === void 0 ? void 0 : _a.customActions)) {
247
- return eventPayload;
248
- }
249
- (_b = eventPayload[0].customActions) === null || _b === void 0 ? void 0 : _b.forEach((action) => {
250
- this.axisMenuActionHandler[action.id] = action.onClick;
251
- });
252
- const processedCustomActions = (_c = eventPayload === null || eventPayload === void 0 ? void 0 : eventPayload[0].customActions) === null || _c === void 0 ? void 0 : _c.map((action) => {
253
- return {
254
- id: action.id,
255
- label: action.label,
256
- icon: action.icon,
257
- };
258
- });
259
- const processedPayload = [
260
- {
261
- ...eventPayload[0],
262
- customActions: processedCustomActions,
263
- },
264
- ];
265
- return processedPayload;
266
- }
267
- eventPayloadPreProcessor(eventType, eventPayload) {
268
- switch (eventType) {
269
- case ChartToTSEvent.OpenContextMenu:
270
- return this.contextMenuCustomActionPreProcessor(eventPayload);
271
- case ChartToTSEvent.OpenAxisMenu:
272
- return this.axisMenuCustomActionPreProcessor(eventPayload);
273
- default:
274
- return eventPayload;
275
- }
276
- }
277
- emitEvent(eventType, ...eventPayload) {
278
- var _a;
279
- if (!globalThis.isInitialized) {
280
- console.log('Chart Context: not initialized the context, something went wrong');
281
- return Promise.reject(new Error('Context not initialized'));
282
- }
283
- const processedPayload = this.eventPayloadPreProcessor(eventType, eventPayload);
284
- return postMessageToHostApp(this.componentId, this.hostUrl, (_a = processedPayload === null || processedPayload === void 0 ? void 0 : processedPayload[0]) !== null && _a !== void 0 ? _a : null, eventType);
285
- }
286
- }
287
- export const getChartContext = async (customChartConfig) => {
288
- const ctx = new CustomChartContext(customChartConfig);
289
- await ctx.initialize();
290
- return ctx;
291
- };
292
- //# sourceMappingURL=custom-chart-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context.js","sourceRoot":"","sources":["../../src/main/custom-chart-context.ts"],"names":[],"mappings":"AAQA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAEH,cAAc,EAId,SAAS,GAGZ,MAAM,kCAAkC,CAAC;AAS1C,OAAO,EAWH,cAAc,GAKjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACH,UAAU,EACV,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,6BAA6B,CAAC;AAyFrC,MAAM,2BAA2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,GAAG,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAGtD,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC;IAEvB,OAAO,GAAG,CAAC;AACf,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=custom-chart-context.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-chart-context.spec.d.ts","sourceRoot":"","sources":["../../src/main/custom-chart-context.spec.ts"],"names":[],"mappings":""}