@datarailsshared/dr_renderer 1.5.133 → 1.5.147
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/.github/workflows/release.yml +12 -36
- package/package.json +1 -1
- package/src/charts/dr_gauge_chart.js +1 -1
- package/src/dr-renderer-helpers.js +0 -7
- package/src/highcharts_renderer.js +16 -54
- package/src/index.d.ts +6 -0
- package/src/options/builders.js +26 -27
- package/src/options/index.js +21 -25
- package/src/options/presets.js +22 -23
- package/src/types/options/builders.d.ts +3 -8
- package/src/types/options/index.d.ts +3 -8
- package/src/types/options/presets.d.ts +3 -8
- package/tests/__snapshots__/suboptions.test.js.snap +6 -6
- package/tests/dr_gauge_chart.test.js +9 -11
- package/tests/highcharts_renderer.test.js +34 -90
- package/tests/options-builder.test.js +77 -89
package/src/options/presets.js
CHANGED
|
@@ -13,29 +13,29 @@ const {
|
|
|
13
13
|
withLabelGauge,
|
|
14
14
|
withLabelWithPercentage,
|
|
15
15
|
withLabelWithPercentagePercentStacked,
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
// Tooltip builders
|
|
18
18
|
withTooltip,
|
|
19
19
|
withTooltipPie,
|
|
20
20
|
withTooltipGauge,
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
// Axis builders
|
|
23
23
|
withAxisY,
|
|
24
24
|
withAxisYPercentStacked,
|
|
25
25
|
withAxisX,
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
// Table builders
|
|
28
28
|
withTableOptions,
|
|
29
29
|
withTableOptionsTranspose,
|
|
30
30
|
withTableOptionsGauge,
|
|
31
31
|
withTableDesignOptions,
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// Chart config builders
|
|
34
34
|
withChart,
|
|
35
35
|
withChartGrid,
|
|
36
36
|
withChartForecast,
|
|
37
37
|
withChartPosition,
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
// Other builders
|
|
40
40
|
withWidgetLibrary,
|
|
41
41
|
withSubtitle,
|
|
@@ -131,7 +131,7 @@ const CHART_PRESETS = {
|
|
|
131
131
|
withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
132
132
|
withChartForecast, withNegativeNumberFormat, withDeltaColumn, withAdvanced, withLegends,
|
|
133
133
|
],
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
// Area charts
|
|
136
136
|
[CHART_TYPES.AREA_CHART]: [
|
|
137
137
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
@@ -143,14 +143,14 @@ const CHART_PRESETS = {
|
|
|
143
143
|
withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
144
144
|
withNegativeNumberFormat, withDeltaColumn, withAdvanced, withLegends,
|
|
145
145
|
],
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
// Polygon chart
|
|
148
148
|
[CHART_TYPES.POLYGON_CHART]: [
|
|
149
149
|
withTooltip, withLabel, withSubtitle,
|
|
150
150
|
withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
151
151
|
withNegativeNumberFormat, withDeltaColumn, withAdvanced, withLegends,
|
|
152
152
|
],
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
// Column charts
|
|
155
155
|
[CHART_TYPES.COLUMN_CHART]: [
|
|
156
156
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
@@ -167,7 +167,7 @@ const CHART_PRESETS = {
|
|
|
167
167
|
withWidgetLibrary, withTableOptions, withTableDesignOptions,
|
|
168
168
|
withChartGrid, withAdvanced, withLegends,
|
|
169
169
|
],
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
// Combo charts
|
|
172
172
|
[CHART_TYPES.COMBO_CHART]: [
|
|
173
173
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
@@ -184,7 +184,7 @@ const CHART_PRESETS = {
|
|
|
184
184
|
withWidgetLibrary, withTableOptions, withTableDesignOptions,
|
|
185
185
|
withChartGrid, withDeltaColumn, withAdvanced, withLegends,
|
|
186
186
|
],
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
// Bar charts
|
|
189
189
|
[CHART_TYPES.BAR_CHART]: [
|
|
190
190
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
@@ -201,14 +201,14 @@ const CHART_PRESETS = {
|
|
|
201
201
|
withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
202
202
|
withChartGrid, withAdvanced, withLegends,
|
|
203
203
|
],
|
|
204
|
-
|
|
204
|
+
|
|
205
205
|
// Scatter chart
|
|
206
206
|
[CHART_TYPES.SCATTER_CHART]: [
|
|
207
207
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
208
208
|
withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
209
209
|
withChartGrid, withNegativeNumberFormat, withDeltaColumn, withAdvanced, withLegends,
|
|
210
210
|
],
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
// Pie charts
|
|
213
213
|
[CHART_TYPES.PIE_CHART]: [
|
|
214
214
|
withTooltipPie, withLabelPie, withSubtitle,
|
|
@@ -226,7 +226,7 @@ const CHART_PRESETS = {
|
|
|
226
226
|
withChart, withNegativeNumberFormat, withAdvanced, withLegends,
|
|
227
227
|
withChartPosition, withTotalValueLabelDonut,
|
|
228
228
|
],
|
|
229
|
-
|
|
229
|
+
|
|
230
230
|
// Gauge charts
|
|
231
231
|
[CHART_TYPES.GAUGE_CHART_ENHANCED]: [
|
|
232
232
|
withLabelGauge, withTooltipGauge, withSubtitle,
|
|
@@ -241,7 +241,7 @@ const CHART_PRESETS = {
|
|
|
241
241
|
[CHART_TYPES.GAUGE_CHART_CATEGORIES_SUMMARY]: [
|
|
242
242
|
withLabelGauge, withTooltipGauge, withSubtitle,
|
|
243
243
|
],
|
|
244
|
-
|
|
244
|
+
|
|
245
245
|
// KPI widgets
|
|
246
246
|
[CHART_TYPES.KPI_WIDGET]: [
|
|
247
247
|
withValue, withRange, withWidgetLibrary, withName,
|
|
@@ -253,19 +253,19 @@ const CHART_PRESETS = {
|
|
|
253
253
|
withTableOptionsTranspose, withTableDesignOptions,
|
|
254
254
|
withNegativeNumberFormat, withLegends,
|
|
255
255
|
],
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
// Text widget
|
|
258
258
|
[CHART_TYPES.TEXT_WIDGET]: [
|
|
259
259
|
withName, withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
260
260
|
withNegativeNumberFormat, withLegends,
|
|
261
261
|
],
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
// Table only
|
|
264
264
|
[CHART_TYPES.TABLE_ONLY]: [
|
|
265
265
|
withSubtitle, withWidgetLibrary, withTableOptionsTranspose, withTableDesignOptions,
|
|
266
266
|
withNegativeNumberFormat, withDeltaColumn, withAdvanced,
|
|
267
267
|
],
|
|
268
|
-
|
|
268
|
+
|
|
269
269
|
// Waterfall charts
|
|
270
270
|
[CHART_TYPES.WATERFALL_BREAKDOWN]: [
|
|
271
271
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
@@ -275,11 +275,11 @@ const CHART_PRESETS = {
|
|
|
275
275
|
withAxisY, withAxisX, withTooltip, withLabel, withSubtitle,
|
|
276
276
|
withWidgetLibrary, withChart, withNegativeNumberFormat, withAdvanced, withLegends,
|
|
277
277
|
],
|
|
278
|
-
|
|
278
|
+
|
|
279
279
|
// Legacy gauge charts (kept for backwards compatibility)
|
|
280
280
|
[CHART_TYPES.GAUGE_SOLID_CHART]: [],
|
|
281
281
|
[CHART_TYPES.GAUGE_CHART]: [],
|
|
282
|
-
|
|
282
|
+
|
|
283
283
|
// Non-chart types (kept for type completeness)
|
|
284
284
|
[CHART_TYPES.PUBLISHED_ITEM]: [],
|
|
285
285
|
[CHART_TYPES.RICH_TEXT]: [],
|
|
@@ -308,8 +308,7 @@ const getPresetForChart = (chartType) => CHART_PRESETS[chartType];
|
|
|
308
308
|
* Builder configuration options passed to builder functions.
|
|
309
309
|
* @typedef {Object} BuilderConfig
|
|
310
310
|
* @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum
|
|
311
|
-
* @property {
|
|
312
|
-
* @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name
|
|
311
|
+
* @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
|
|
313
312
|
* @property {import('./builders').GaugeSegment[]} [defaultSegments] - Default gauge segments
|
|
314
313
|
*/
|
|
315
314
|
|
|
@@ -331,7 +330,7 @@ const buildSuboptionsForChart = (chartType, config = {}) => {
|
|
|
331
330
|
if (!preset) {
|
|
332
331
|
return {};
|
|
333
332
|
}
|
|
334
|
-
|
|
333
|
+
|
|
335
334
|
/** @type {Record<string, import('./builders').SuboptionDefinition>} */
|
|
336
335
|
const suboptions = {};
|
|
337
336
|
preset.forEach((builder) => {
|
|
@@ -340,7 +339,7 @@ const buildSuboptionsForChart = (chartType, config = {}) => {
|
|
|
340
339
|
suboptions[key] = builder(config);
|
|
341
340
|
}
|
|
342
341
|
});
|
|
343
|
-
|
|
342
|
+
|
|
344
343
|
return suboptions;
|
|
345
344
|
};
|
|
346
345
|
|
|
@@ -205,13 +205,9 @@ export type FeatureChecker = (featureName: string) => boolean;
|
|
|
205
205
|
*/
|
|
206
206
|
export type LabelGaugeConfig = {
|
|
207
207
|
/**
|
|
208
|
-
* -
|
|
208
|
+
* - Allow specifying custom gauge goal title
|
|
209
209
|
*/
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* - Feature flag name
|
|
213
|
-
*/
|
|
214
|
-
ENABLE_GAUGE_DYNAMIC_GOAL?: string | undefined;
|
|
210
|
+
enableGaugeDynamicGoal?: boolean | undefined;
|
|
215
211
|
};
|
|
216
212
|
/**
|
|
217
213
|
* Table options configuration.
|
|
@@ -409,8 +405,7 @@ export function withLabelPie(): SuboptionDefinition;
|
|
|
409
405
|
/**
|
|
410
406
|
* Label gauge configuration options.
|
|
411
407
|
* @typedef {Object} LabelGaugeConfig
|
|
412
|
-
* @property {
|
|
413
|
-
* @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name
|
|
408
|
+
* @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
|
|
414
409
|
*/
|
|
415
410
|
/**
|
|
416
411
|
* Creates a label suboption for gauge charts.
|
|
@@ -139,13 +139,9 @@ type CreateDefaultSuboptionsConfig = {
|
|
|
139
139
|
*/
|
|
140
140
|
CHART_TYPES?: constants.ChartTypesMap | undefined;
|
|
141
141
|
/**
|
|
142
|
-
* -
|
|
142
|
+
* - Allow specifying custom gauge goal title
|
|
143
143
|
*/
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* - Feature flag name for gauge dynamic goal
|
|
147
|
-
*/
|
|
148
|
-
ENABLE_GAUGE_DYNAMIC_GOAL?: string | undefined;
|
|
144
|
+
enableGaugeDynamicGoal?: boolean | undefined;
|
|
149
145
|
/**
|
|
150
146
|
* - Default gauge segments array
|
|
151
147
|
*/
|
|
@@ -165,8 +161,7 @@ import presets = require("./presets");
|
|
|
165
161
|
* Configuration for createDefaultSuboptions.
|
|
166
162
|
* @typedef {Object} CreateDefaultSuboptionsConfig
|
|
167
163
|
* @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum (for table options)
|
|
168
|
-
* @property {
|
|
169
|
-
* @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name for gauge dynamic goal
|
|
164
|
+
* @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
|
|
170
165
|
* @property {import('./builders').GaugeSegment[]} [defaultGaugeSegments] - Default gauge segments array
|
|
171
166
|
*/
|
|
172
167
|
/**
|
|
@@ -11,13 +11,9 @@ export type BuilderConfig = {
|
|
|
11
11
|
*/
|
|
12
12
|
CHART_TYPES?: import("./constants").ChartTypesMap | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* -
|
|
14
|
+
* - Allow specifying custom gauge goal title
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* - Feature flag name
|
|
19
|
-
*/
|
|
20
|
-
ENABLE_GAUGE_DYNAMIC_GOAL?: string | undefined;
|
|
16
|
+
enableGaugeDynamicGoal?: boolean | undefined;
|
|
21
17
|
/**
|
|
22
18
|
* - Default gauge segments
|
|
23
19
|
*/
|
|
@@ -60,8 +56,7 @@ export function getPresetForChart(chartType: import("./constants").ChartTypeValu
|
|
|
60
56
|
* Builder configuration options passed to builder functions.
|
|
61
57
|
* @typedef {Object} BuilderConfig
|
|
62
58
|
* @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum
|
|
63
|
-
* @property {
|
|
64
|
-
* @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name
|
|
59
|
+
* @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
|
|
65
60
|
* @property {import('./builders').GaugeSegment[]} [defaultSegments] - Default gauge segments
|
|
66
61
|
*/
|
|
67
62
|
/**
|
|
@@ -469,8 +469,8 @@ Object {
|
|
|
469
469
|
"shadow": false,
|
|
470
470
|
"show": true,
|
|
471
471
|
"show_out_of_data_series": false,
|
|
472
|
-
"show_out_of_x_axis":
|
|
473
|
-
"show_value":
|
|
472
|
+
"show_out_of_x_axis": true,
|
|
473
|
+
"show_value": false,
|
|
474
474
|
"vertical": false,
|
|
475
475
|
},
|
|
476
476
|
"legends_position": Object {
|
|
@@ -784,8 +784,8 @@ Object {
|
|
|
784
784
|
"shadow": false,
|
|
785
785
|
"show": true,
|
|
786
786
|
"show_out_of_data_series": false,
|
|
787
|
-
"show_out_of_x_axis":
|
|
788
|
-
"show_value":
|
|
787
|
+
"show_out_of_x_axis": true,
|
|
788
|
+
"show_value": false,
|
|
789
789
|
"vertical": false,
|
|
790
790
|
},
|
|
791
791
|
"legends_position": Object {
|
|
@@ -3515,14 +3515,14 @@ Object {
|
|
|
3515
3515
|
},
|
|
3516
3516
|
Object {
|
|
3517
3517
|
"clickFn": "[Function]",
|
|
3518
|
-
"default_value":
|
|
3518
|
+
"default_value": false,
|
|
3519
3519
|
"element_label": "Value",
|
|
3520
3520
|
"element_type": "checkbox",
|
|
3521
3521
|
"value_name": "show_value",
|
|
3522
3522
|
},
|
|
3523
3523
|
Object {
|
|
3524
3524
|
"clickFn": "[Function]",
|
|
3525
|
-
"default_value":
|
|
3525
|
+
"default_value": true,
|
|
3526
3526
|
"element_label": "% Out of [X Axis]",
|
|
3527
3527
|
"element_type": "checkbox",
|
|
3528
3528
|
"value_name": "show_out_of_x_axis",
|
|
@@ -21,9 +21,11 @@ DrGaugeChart.highchartsRenderer = {
|
|
|
21
21
|
formatValue: jest.fn().mockReturnValue({
|
|
22
22
|
value: mockFormattedValue,
|
|
23
23
|
}),
|
|
24
|
+
environment: {
|
|
25
|
+
enableGaugeDynamicGoal: false,
|
|
26
|
+
},
|
|
24
27
|
disableChartAnimations: jest.fn((value) => disableChartAnimation = value),
|
|
25
28
|
chartAnimationsDisabled: jest.fn(() => disableChartAnimation),
|
|
26
|
-
hasFeature: jest.fn().mockReturnValue(false),
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
const mockAggregationValue = 1000;
|
|
@@ -143,6 +145,10 @@ describe("DrGaugeChart", () => {
|
|
|
143
145
|
});
|
|
144
146
|
|
|
145
147
|
describe("createPlotBands", () => {
|
|
148
|
+
afterEach(() => {
|
|
149
|
+
DrGaugeChart.highchartsRenderer.environment.enableGaugeDynamicGoal = false;
|
|
150
|
+
})
|
|
151
|
+
|
|
146
152
|
it("should create plots for absolute values", () => {
|
|
147
153
|
expect(
|
|
148
154
|
chart.createPlotBands({
|
|
@@ -330,9 +336,7 @@ describe("DrGaugeChart", () => {
|
|
|
330
336
|
});
|
|
331
337
|
|
|
332
338
|
it("scales by absolute needle magnitude when goal is not a number", () => {
|
|
333
|
-
|
|
334
|
-
.spyOn(DrGaugeChart.highchartsRenderer, "hasFeature")
|
|
335
|
-
.mockReturnValue(true);
|
|
339
|
+
DrGaugeChart.highchartsRenderer.environment.enableGaugeDynamicGoal = true;
|
|
336
340
|
|
|
337
341
|
chart.value = -300;
|
|
338
342
|
const res = chart.createPlotBands({
|
|
@@ -349,8 +353,6 @@ describe("DrGaugeChart", () => {
|
|
|
349
353
|
{ from: 0, to: 150, color: "#1", thickness: 8, title: "A" },
|
|
350
354
|
{ from: 150, to: 300, color: "#2", thickness: 8, title: "B" },
|
|
351
355
|
]);
|
|
352
|
-
|
|
353
|
-
featureSpy.mockRestore();
|
|
354
356
|
});
|
|
355
357
|
|
|
356
358
|
it("normalizes bands when goal is negative in percentage mode", () => {
|
|
@@ -374,9 +376,7 @@ describe("DrGaugeChart", () => {
|
|
|
374
376
|
});
|
|
375
377
|
|
|
376
378
|
it("does not clamp last segment when dynamic goal feature is enabled", () => {
|
|
377
|
-
|
|
378
|
-
.spyOn(DrGaugeChart.highchartsRenderer, "hasFeature")
|
|
379
|
-
.mockReturnValue(true);
|
|
379
|
+
DrGaugeChart.highchartsRenderer.environment.enableGaugeDynamicGoal = true;
|
|
380
380
|
|
|
381
381
|
const res = chart.createPlotBands({
|
|
382
382
|
isAbsoluteValue: true,
|
|
@@ -394,8 +394,6 @@ describe("DrGaugeChart", () => {
|
|
|
394
394
|
{ from: 200, to: 400, color: "blue", thickness: 10, title: "Title 2" },
|
|
395
395
|
{ from: 400, to: 800, color: "green", thickness: 10, title: "Title 3" },
|
|
396
396
|
]);
|
|
397
|
-
|
|
398
|
-
featureSpy.mockRestore();
|
|
399
397
|
});
|
|
400
398
|
});
|
|
401
399
|
|
|
@@ -440,7 +440,9 @@ describe('highcharts_renderer', () => {
|
|
|
440
440
|
let opts;
|
|
441
441
|
|
|
442
442
|
beforeEach(() => {
|
|
443
|
-
highchartsRenderer.
|
|
443
|
+
highchartsRenderer.environment = {
|
|
444
|
+
enabledNewWidgetValueFormatting: false,
|
|
445
|
+
};
|
|
444
446
|
highchartsRenderer.delimer = ' , ';
|
|
445
447
|
|
|
446
448
|
funcContext = {
|
|
@@ -1557,7 +1559,6 @@ describe('highcharts_renderer', () => {
|
|
|
1557
1559
|
expect(result).toHaveProperty('is_calculated', false);
|
|
1558
1560
|
expect(result).toHaveProperty('values', []);
|
|
1559
1561
|
expect(result).toHaveProperty('new_name', 'field');
|
|
1560
|
-
expect(result).toHaveProperty('name_class', 'blue_filed');
|
|
1561
1562
|
expect(result).toHaveProperty('date_field_before_split', null);
|
|
1562
1563
|
expect(result).toHaveProperty('mandatory', false);
|
|
1563
1564
|
expect(result).toHaveProperty('category', 'cat1');
|
|
@@ -1615,74 +1616,6 @@ describe('highcharts_renderer', () => {
|
|
|
1615
1616
|
});
|
|
1616
1617
|
});
|
|
1617
1618
|
|
|
1618
|
-
describe('function isSystemField', () => {
|
|
1619
|
-
it('system name', () => {
|
|
1620
|
-
const field = {
|
|
1621
|
-
name: 'Doc_ID'
|
|
1622
|
-
};
|
|
1623
|
-
expect(highchartsRenderer.isSystemField(field)).toBe(true);
|
|
1624
|
-
});
|
|
1625
|
-
|
|
1626
|
-
it('not system name', () => {
|
|
1627
|
-
const field = {
|
|
1628
|
-
name: 'field name'
|
|
1629
|
-
};
|
|
1630
|
-
expect(highchartsRenderer.isSystemField(field)).toBe(false);
|
|
1631
|
-
});
|
|
1632
|
-
|
|
1633
|
-
describe('dynamic system fields', () => {
|
|
1634
|
-
it('should count Scenario & Budget Cycle as system field', () => {
|
|
1635
|
-
highchartsRenderer.setFeatures(['multiple_dimension_tags', 'use_new_scenario_tag']);
|
|
1636
|
-
|
|
1637
|
-
const fieldWithScenario = { name: 'Scenario' };
|
|
1638
|
-
expect(highchartsRenderer.isSystemField(fieldWithScenario)).toBe(true);
|
|
1639
|
-
|
|
1640
|
-
const fieldWithBudgetCycle = { name: 'Budget Cycle' };
|
|
1641
|
-
expect(highchartsRenderer.isSystemField(fieldWithBudgetCycle)).toBe(true);
|
|
1642
|
-
});
|
|
1643
|
-
});
|
|
1644
|
-
});
|
|
1645
|
-
|
|
1646
|
-
describe('function getFieldColorClass', () => {
|
|
1647
|
-
it('should return "green_field" if field is not a system field and not mandatory', () => {
|
|
1648
|
-
const field = {
|
|
1649
|
-
name: 'field1',
|
|
1650
|
-
mandatory: false
|
|
1651
|
-
};
|
|
1652
|
-
const result = highchartsRenderer.getFieldColorClass(field);
|
|
1653
|
-
expect(result).toBe('green_field');
|
|
1654
|
-
});
|
|
1655
|
-
|
|
1656
|
-
it('should return "blue_filed" if field is a system field and not mandatory', () => {
|
|
1657
|
-
const field = {
|
|
1658
|
-
name: 'System_Field',
|
|
1659
|
-
mandatory: false,
|
|
1660
|
-
isSystem: true
|
|
1661
|
-
};
|
|
1662
|
-
const result = highchartsRenderer.getFieldColorClass(field);
|
|
1663
|
-
expect(result).toBe('blue_filed');
|
|
1664
|
-
});
|
|
1665
|
-
|
|
1666
|
-
it('should return "green_field mandatoryfieldborder" if field is not a system field and is mandatory', () => {
|
|
1667
|
-
const field = {
|
|
1668
|
-
name: 'field2',
|
|
1669
|
-
mandatory: true
|
|
1670
|
-
};
|
|
1671
|
-
const result = highchartsRenderer.getFieldColorClass(field);
|
|
1672
|
-
expect(result).toBe('green_field mandatoryfieldborder ');
|
|
1673
|
-
});
|
|
1674
|
-
|
|
1675
|
-
it('should return "blue_filed mandatoryfieldborder" if field is a system field and is mandatory', () => {
|
|
1676
|
-
const field = {
|
|
1677
|
-
name: 'System_Field',
|
|
1678
|
-
mandatory: true,
|
|
1679
|
-
isSystem: true
|
|
1680
|
-
};
|
|
1681
|
-
const result = highchartsRenderer.getFieldColorClass(field);
|
|
1682
|
-
expect(result).toBe('blue_filed mandatoryfieldborder ');
|
|
1683
|
-
});
|
|
1684
|
-
});
|
|
1685
|
-
|
|
1686
1619
|
describe('function getMiniTemplateObj', () => {
|
|
1687
1620
|
it('returns an object with only the id property', () => {
|
|
1688
1621
|
const template = {
|
|
@@ -2369,7 +2302,7 @@ describe('highcharts_renderer', () => {
|
|
|
2369
2302
|
});
|
|
2370
2303
|
|
|
2371
2304
|
it('Formats must be filled and uniq', () => {
|
|
2372
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
2305
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
2373
2306
|
aggregatorObject.push({Profit: 123, formats: ['####', '####', '#,###']});
|
|
2374
2307
|
expect(aggregatorObject.formats).toEqual(['####', '#,###']);
|
|
2375
2308
|
});
|
|
@@ -2410,7 +2343,7 @@ describe('highcharts_renderer', () => {
|
|
|
2410
2343
|
});
|
|
2411
2344
|
|
|
2412
2345
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions', () => {
|
|
2413
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2346
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
2414
2347
|
const options = {
|
|
2415
2348
|
comboOptions: {
|
|
2416
2349
|
seriesOptions: [
|
|
@@ -2478,7 +2411,7 @@ describe('highcharts_renderer', () => {
|
|
|
2478
2411
|
});
|
|
2479
2412
|
|
|
2480
2413
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions and widget_value_format to equal first seriesOptions format', () => {
|
|
2481
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2414
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
2482
2415
|
widget_values_format = '\"$\"#,###.###';
|
|
2483
2416
|
const options = {
|
|
2484
2417
|
comboOptions: {
|
|
@@ -2578,7 +2511,7 @@ describe('highcharts_renderer', () => {
|
|
|
2578
2511
|
});
|
|
2579
2512
|
|
|
2580
2513
|
it('Formats must be filled and uniq', () => {
|
|
2581
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
2514
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
2582
2515
|
aggregatorObject.push({Profit: 123, formats: ['####', '####', '#,###']});
|
|
2583
2516
|
expect(aggregatorObject.formats).toEqual(['####', '#,###']);
|
|
2584
2517
|
});
|
|
@@ -2619,7 +2552,7 @@ describe('highcharts_renderer', () => {
|
|
|
2619
2552
|
});
|
|
2620
2553
|
|
|
2621
2554
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions', () => {
|
|
2622
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2555
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
2623
2556
|
const options = {
|
|
2624
2557
|
comboOptions: {
|
|
2625
2558
|
seriesOptions: [
|
|
@@ -2687,7 +2620,7 @@ describe('highcharts_renderer', () => {
|
|
|
2687
2620
|
});
|
|
2688
2621
|
|
|
2689
2622
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions and widget_value_format to equal first seriesOptions format', () => {
|
|
2690
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2623
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
2691
2624
|
widget_values_format = '\"$\"#,###.###';
|
|
2692
2625
|
const options = {
|
|
2693
2626
|
comboOptions: {
|
|
@@ -2941,7 +2874,7 @@ describe('highcharts_renderer', () => {
|
|
|
2941
2874
|
});
|
|
2942
2875
|
|
|
2943
2876
|
it('Formats must be filled and uniq', () => {
|
|
2944
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
2877
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
2945
2878
|
aggregatorObject.push({Profit: 123, formats: ['####', '####', '#,###']});
|
|
2946
2879
|
expect(aggregatorObject.formats).toEqual(['####', '#,###']);
|
|
2947
2880
|
});
|
|
@@ -2983,7 +2916,7 @@ describe('highcharts_renderer', () => {
|
|
|
2983
2916
|
});
|
|
2984
2917
|
|
|
2985
2918
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions', () => {
|
|
2986
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2919
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
2987
2920
|
const options = {
|
|
2988
2921
|
comboOptions: {
|
|
2989
2922
|
seriesOptions: [
|
|
@@ -3053,7 +2986,7 @@ describe('highcharts_renderer', () => {
|
|
|
3053
2986
|
});
|
|
3054
2987
|
|
|
3055
2988
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions and widget_value_format to equal first seriesOptions format', () => {
|
|
3056
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
2989
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
3057
2990
|
widget_values_format = '\"$\"#,###.###';
|
|
3058
2991
|
const options = {
|
|
3059
2992
|
comboOptions: {
|
|
@@ -3153,7 +3086,7 @@ describe('highcharts_renderer', () => {
|
|
|
3153
3086
|
});
|
|
3154
3087
|
|
|
3155
3088
|
it('Formats must be filled and uniq', () => {
|
|
3156
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
3089
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
3157
3090
|
aggregatorObject.push({Profit: 123, formats: ['####', '####', '#,###']});
|
|
3158
3091
|
expect(aggregatorObject.formats).toEqual(['####', '#,###']);
|
|
3159
3092
|
});
|
|
@@ -3194,7 +3127,7 @@ describe('highcharts_renderer', () => {
|
|
|
3194
3127
|
});
|
|
3195
3128
|
|
|
3196
3129
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions', () => {
|
|
3197
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
3130
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
3198
3131
|
const options = {
|
|
3199
3132
|
comboOptions: {
|
|
3200
3133
|
seriesOptions: [
|
|
@@ -3263,7 +3196,7 @@ describe('highcharts_renderer', () => {
|
|
|
3263
3196
|
});
|
|
3264
3197
|
|
|
3265
3198
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions and widget_value_format to equal first seriesOptions format', () => {
|
|
3266
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
3199
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
3267
3200
|
widget_values_format = '\"$\"#,###.###';
|
|
3268
3201
|
const options = {
|
|
3269
3202
|
comboOptions: {
|
|
@@ -3363,7 +3296,7 @@ describe('highcharts_renderer', () => {
|
|
|
3363
3296
|
});
|
|
3364
3297
|
|
|
3365
3298
|
it('Formats must be filled and uniq', () => {
|
|
3366
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
3299
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
3367
3300
|
aggregatorObject.push({Profit: 123, formats: ['####', '####', '#,###']});
|
|
3368
3301
|
expect(aggregatorObject.formats).toEqual(['####', '#,###']);
|
|
3369
3302
|
});
|
|
@@ -3404,7 +3337,7 @@ describe('highcharts_renderer', () => {
|
|
|
3404
3337
|
});
|
|
3405
3338
|
|
|
3406
3339
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions', () => {
|
|
3407
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
3340
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
3408
3341
|
const options = {
|
|
3409
3342
|
comboOptions: {
|
|
3410
3343
|
seriesOptions: [
|
|
@@ -3473,7 +3406,7 @@ describe('highcharts_renderer', () => {
|
|
|
3473
3406
|
});
|
|
3474
3407
|
|
|
3475
3408
|
it('if FF enabledNewWidgetValueFormatting is and some of secondaryAxis is true widget values format must be from seriesOptions and widget_value_format to equal first seriesOptions format', () => {
|
|
3476
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
3409
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
3477
3410
|
widget_values_format = '\"$\"#,###.###';
|
|
3478
3411
|
const options = {
|
|
3479
3412
|
comboOptions: {
|
|
@@ -4905,7 +4838,7 @@ describe('highcharts_renderer', () => {
|
|
|
4905
4838
|
it('should return true (enable_new_widget_value_formatting !== true, format is not custom, secondary axis present, >1 value fields)', () => {
|
|
4906
4839
|
const widgetValuesFormat = '#,###';
|
|
4907
4840
|
const pivotData = { rowAttrs: ['DR_Values'] };
|
|
4908
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
|
4841
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = false;
|
|
4909
4842
|
|
|
4910
4843
|
const result = highchartsRenderer.isUsingWidgetValuesFormat(pivotData, renderOptions, widgetValuesFormat);
|
|
4911
4844
|
expect(result).toEqual(true);
|
|
@@ -4914,7 +4847,7 @@ describe('highcharts_renderer', () => {
|
|
|
4914
4847
|
it('should return true (enable_new_widget_value_formatting === true, format is custom, secondary axis present, >1 value fields)', () => {
|
|
4915
4848
|
const widgetValuesFormat = '$#,###';
|
|
4916
4849
|
const pivotData = { rowAttrs: ['DR_Values'] };
|
|
4917
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
4850
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
4918
4851
|
|
|
4919
4852
|
const result = highchartsRenderer.isUsingWidgetValuesFormat(pivotData, renderOptions, widgetValuesFormat);
|
|
4920
4853
|
expect(result).toEqual(true);
|
|
@@ -4923,7 +4856,7 @@ describe('highcharts_renderer', () => {
|
|
|
4923
4856
|
it('should return true (enable_new_widget_value_formatting === true, format is not custom, secondary axis not present, >1 value fields)', () => {
|
|
4924
4857
|
const widgetValuesFormat = '#,###';
|
|
4925
4858
|
const pivotData = { rowAttrs: ['DR_Values'] };
|
|
4926
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
4859
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
4927
4860
|
const renderOptionsNoSecondary = lodash.cloneDeep(renderOptions);
|
|
4928
4861
|
renderOptionsNoSecondary.comboOptions.seriesOptions[1].secondaryAxis = false;
|
|
4929
4862
|
|
|
@@ -4934,7 +4867,7 @@ describe('highcharts_renderer', () => {
|
|
|
4934
4867
|
it('should return true (enable_new_widget_value_formatting === true, format is not custom, secondary axis present, 1 value fields)', () => {
|
|
4935
4868
|
const widgetValuesFormat = '#,###';
|
|
4936
4869
|
const pivotData = { rowAttrs: ['Profit'] };
|
|
4937
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
4870
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
4938
4871
|
|
|
4939
4872
|
const result = highchartsRenderer.isUsingWidgetValuesFormat(pivotData, renderOptions, widgetValuesFormat);
|
|
4940
4873
|
expect(result).toEqual(true);
|
|
@@ -4943,7 +4876,7 @@ describe('highcharts_renderer', () => {
|
|
|
4943
4876
|
it('should return false (enable_new_widget_value_formatting === true, format is not custom, secondary axis present, >1 value fields)', () => {
|
|
4944
4877
|
const widgetValuesFormat = '#,###';
|
|
4945
4878
|
const pivotData = { rowAttrs: ['DR_Values'] };
|
|
4946
|
-
highchartsRenderer.enabledNewWidgetValueFormatting = true;
|
|
4879
|
+
highchartsRenderer.environment.enabledNewWidgetValueFormatting = true;
|
|
4947
4880
|
|
|
4948
4881
|
const result = highchartsRenderer.isUsingWidgetValuesFormat(pivotData, renderOptions, widgetValuesFormat);
|
|
4949
4882
|
expect(result).toEqual(false);
|
|
@@ -5120,6 +5053,17 @@ describe('highcharts_renderer', () => {
|
|
|
5120
5053
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
|
5121
5054
|
expect(formattedKey).toEqual(initialKey);
|
|
5122
5055
|
});
|
|
5056
|
+
|
|
5057
|
+
// some e2e tests exist that expects this behavior
|
|
5058
|
+
it('should format blank value with [blank] text', () => {
|
|
5059
|
+
const initialKey = ['DR_Others', ''];
|
|
5060
|
+
const pivotData = {
|
|
5061
|
+
colFormats: [{ type: "Text", name: "Month" }, { type: 'Date', name: "Date" }],
|
|
5062
|
+
};
|
|
5063
|
+
const type = 'colFormats';
|
|
5064
|
+
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
|
5065
|
+
expect(formattedKey).toEqual(['DR_Others', '[blank]']);
|
|
5066
|
+
});
|
|
5123
5067
|
});
|
|
5124
5068
|
});
|
|
5125
5069
|
|