@datarailsshared/dr_renderer 1.2.424 → 1.2.426
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/package.json +1 -1
- package/src/dr_pivottable.js +7 -44
- package/src/highcharts_renderer.js +0 -67
- package/tests/highcharts_renderer.test.js +0 -141
- package/tests/mock/add-in-dynamic-ranges.json +0 -6
- package/tests/mock/add-in-functions.json +0 -2
- package/tests/mock/add-in-tables.json +0 -1
- package/tests/mock/widgets.json +0 -7
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
@@ -454,11 +454,11 @@ let initDRPivotTable = function($, window, document) {
|
|
454
454
|
}
|
455
455
|
|
456
456
|
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
|
457
|
-
var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colAttrs, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, applyInlineStyles, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, getSubtotalInBrackets, processKeys, encodeHtmlEntities, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, setAttributes, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree,
|
457
|
+
var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colAttrs, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, applyInlineStyles, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, getSubtotalInBrackets, processKeys, encodeHtmlEntities, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, setAttributes, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree, subscribeToClick;
|
458
458
|
var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
|
459
459
|
var getAdditionalAggregation, buildAdditionalHeaderCols, buildAdditionalHeaderRows, buildAdditionalColValues, buildAdditionalRowValues, buildAdditionalRowTotals, buildAdditionalColTotals;
|
460
460
|
var additionalFieldsCol, additionalFieldsRow, additionalFieldsList;
|
461
|
-
var
|
461
|
+
var getExistingAggregator;
|
462
462
|
|
463
463
|
var horizontalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' horizontal-freeze-pane' : '';
|
464
464
|
var verticalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' vertical-freeze-pane' : '';
|
@@ -509,7 +509,6 @@ let initDRPivotTable = function($, window, document) {
|
|
509
509
|
if(opts.chartOptions.table_options.start_collapsed_columns) {
|
510
510
|
opts.collapseColsAt = 0;
|
511
511
|
}
|
512
|
-
edit_assumptions = opts.chartOptions.edit_assumptions;
|
513
512
|
isRowDisable = (ref = opts.rowSubtotalDisplay) != null ? ref.disableSubtotal : void 0;
|
514
513
|
isRowHideOnExpand = (ref1 = opts.rowSubtotalDisplay) != null ? ref1.hideOnExpand : !opts.chartOptions.table_options.show_subtotals_for_rows;
|
515
514
|
isRowDisableExpandCollapse = (ref2 = opts.rowSubtotalDisplay) != null ? ref2.disableExpandCollapse : void 0;
|
@@ -1540,7 +1539,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1540
1539
|
if ((isRowSubtotal && (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter)) || (isColSubtotal && (isColHideOnExpand || isColDisable || colHeader.col > colDisableAfter))) {
|
1541
1540
|
td.style.display = "none";
|
1542
1541
|
}
|
1543
|
-
|
1542
|
+
subscribeToClick(td, rowHeader, rowAttrs, colHeader, colAttrs, val);
|
1544
1543
|
|
1545
1544
|
tr.appendChild(td);
|
1546
1545
|
}
|
@@ -1578,7 +1577,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1578
1577
|
td.style.display = "none";
|
1579
1578
|
}
|
1580
1579
|
|
1581
|
-
|
1580
|
+
subscribeToClick(td, rowHeader, rowAttrs, {key:[], flatKey:''}, colAttrs, val);
|
1582
1581
|
|
1583
1582
|
if(opts.chartOptions.table_options.show_row_total)
|
1584
1583
|
tr.appendChild(td);
|
@@ -1588,43 +1587,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1588
1587
|
return results;
|
1589
1588
|
};
|
1590
1589
|
|
1591
|
-
|
1592
|
-
if(edit_assumptions){
|
1593
|
-
var filters = [];
|
1594
|
-
var i=0;
|
1595
|
-
var temp;
|
1596
|
-
for(i=0; i<rowHeader.key.length; i++){
|
1597
|
-
temp = {
|
1598
|
-
name: rowAttrs[i],
|
1599
|
-
values: [rowHeader.key[i]],
|
1600
|
-
is_excluded:false
|
1601
|
-
}
|
1602
|
-
filters.push(temp);
|
1603
|
-
}
|
1604
|
-
for(i=0; i<colHeader.key.length; i++){
|
1605
|
-
temp = {
|
1606
|
-
name: colAttrs[i],
|
1607
|
-
values: [colHeader.key[i]],
|
1608
|
-
is_excluded:false
|
1609
|
-
}
|
1610
|
-
filters.push(temp);
|
1611
|
-
}
|
1612
|
-
var obj_to_send = {
|
1613
|
-
"flatColKey": colHeader.flatKey,
|
1614
|
-
"flatRowKey": rowHeader.flatKey,
|
1615
|
-
"val": val,
|
1616
|
-
"filters": filters
|
1617
|
-
};
|
1618
|
-
|
1619
|
-
// td.addEventListener('dblclick', function(){
|
1620
|
-
// edit_assumptions.fn(obj_to_send, this);
|
1621
|
-
// });
|
1622
|
-
|
1623
|
-
td.addEventListener('click', function(){
|
1624
|
-
edit_assumptions.fn(obj_to_send, this);
|
1625
|
-
});
|
1626
|
-
}
|
1627
|
-
|
1590
|
+
subscribeToClick = function(td, rowHeader, rowAttrs, colHeader, colAttrs, val){
|
1628
1591
|
if(opts.value_drill_down_fn){
|
1629
1592
|
td.classList.add('clickable');
|
1630
1593
|
td.addEventListener('click', function(rowKey, colKey, rowAttrs, colAttrs){
|
@@ -1685,7 +1648,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1685
1648
|
td.style.display = "none";
|
1686
1649
|
}
|
1687
1650
|
|
1688
|
-
|
1651
|
+
subscribeToClick(td, {key:[], flatKey:''}, rowAttrs, h, colAttrs, val);
|
1689
1652
|
|
1690
1653
|
results.push(tr.appendChild(td));
|
1691
1654
|
}
|
@@ -1711,7 +1674,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1711
1674
|
"data-value": val
|
1712
1675
|
}, getTableEventHandlers(val, [], []));
|
1713
1676
|
createTotalValsBolder(td);
|
1714
|
-
|
1677
|
+
subscribeToClick(td, {key:[], flatKey:''}, rowAttrs, {key:[], flatKey:''}, colAttrs, val);
|
1715
1678
|
|
1716
1679
|
tr.appendChild(td);
|
1717
1680
|
return result.appendChild(tr);
|
@@ -449,7 +449,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
449
449
|
}
|
450
450
|
filtOb.show_in_graph = value.show_in_graph || false;
|
451
451
|
filtOb.override_global_filter = value.override_global_filter || false;
|
452
|
-
filtOb.allow_nulls = value.allow_nulls || false;
|
453
452
|
filtOb.field = value.id;
|
454
453
|
filtOb.name = highchartsRenderer.decodeFunc(value.name);
|
455
454
|
return filtOb;
|
@@ -492,7 +491,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
492
491
|
filtOb.id = value.id;
|
493
492
|
filtOb.type = value.type;
|
494
493
|
filtOb.name = value.name;
|
495
|
-
filtOb.allow_nulls = value.allow_nulls;
|
496
494
|
return filtOb;
|
497
495
|
};
|
498
496
|
|
@@ -5508,9 +5506,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5508
5506
|
fieldOb.includes = filterObj.values;
|
5509
5507
|
}
|
5510
5508
|
}
|
5511
|
-
if (filterObj.allow_nulls && fieldOb) {
|
5512
|
-
fieldOb.allow_nulls = filterObj.allow_nulls;
|
5513
|
-
}
|
5514
5509
|
});
|
5515
5510
|
|
5516
5511
|
// // fill selected fields
|
@@ -5562,9 +5557,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5562
5557
|
fieldOb.includes = filterObj.values;
|
5563
5558
|
}
|
5564
5559
|
}
|
5565
|
-
if (filterObj.allow_nulls && fieldOb) {
|
5566
|
-
fieldOb.allow_nulls = filterObj.allow_nulls;
|
5567
|
-
}
|
5568
5560
|
});
|
5569
5561
|
|
5570
5562
|
// fill selected fields
|
@@ -5762,10 +5754,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5762
5754
|
if (filterObj.override_global_filter && fieldOb) {
|
5763
5755
|
fieldOb.override_global_filter = filterObj.override_global_filter;
|
5764
5756
|
}
|
5765
|
-
|
5766
|
-
if (filterObj.allow_nulls && fieldOb) {
|
5767
|
-
fieldOb.allow_nulls = filterObj.allow_nulls;
|
5768
|
-
}
|
5769
5757
|
});
|
5770
5758
|
|
5771
5759
|
// // fill calculated values
|
@@ -5820,9 +5808,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5820
5808
|
var otherFields = [];
|
5821
5809
|
var includes = {};
|
5822
5810
|
var date_aggregation_configs = lodash.get(options, "date_aggregation_configs");
|
5823
|
-
var fields_allow_null_in_filters = lodash.get(options, "fields_allow_null_in_filters");
|
5824
|
-
//var tempIncludeExcludeOb;
|
5825
|
-
//var needSort = [];
|
5826
5811
|
var sorters = function () {
|
5827
5812
|
};
|
5828
5813
|
|
@@ -5863,7 +5848,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5863
5848
|
if (temp_date_aggregation_config) {
|
5864
5849
|
fieldOb.date_aggregation_config = temp_date_aggregation_config;
|
5865
5850
|
}
|
5866
|
-
fieldOb.allow_nulls = lodash.includes(fields_allow_null_in_filters, fieldOb.id);
|
5867
5851
|
lodash.remove(fields, {id: fieldOb.id});
|
5868
5852
|
}
|
5869
5853
|
});
|
@@ -5877,7 +5861,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5877
5861
|
if (temp_date_aggregation_config) {
|
5878
5862
|
fieldOb.date_aggregation_config = temp_date_aggregation_config;
|
5879
5863
|
}
|
5880
|
-
fieldOb.allow_nulls = lodash.includes(fields_allow_null_in_filters, fieldOb.id);
|
5881
5864
|
lodash.remove(fields, {id: fieldOb.id});
|
5882
5865
|
}
|
5883
5866
|
});
|
@@ -5891,7 +5874,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5891
5874
|
if (temp_date_aggregation_config) {
|
5892
5875
|
fieldOb.date_aggregation_config = temp_date_aggregation_config;
|
5893
5876
|
}
|
5894
|
-
fieldOb.allow_nulls = lodash.includes(fields_allow_null_in_filters, fieldOb.id);
|
5895
5877
|
if (!doNotRemoveFilters)
|
5896
5878
|
lodash.remove(fields, {id: fieldOb.id});
|
5897
5879
|
}
|
@@ -5950,10 +5932,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5950
5932
|
if (filterObj.override_global_filter && fieldOb) {
|
5951
5933
|
fieldOb.override_global_filter = filterObj.override_global_filter;
|
5952
5934
|
}
|
5953
|
-
|
5954
|
-
if (filterObj.allow_nulls && fieldOb) {
|
5955
|
-
fieldOb.allow_nulls = filterObj.allow_nulls;
|
5956
|
-
}
|
5957
5935
|
}
|
5958
5936
|
|
5959
5937
|
highchartsRenderer.getChartOptionsBySubType = function (subTypeChart) {
|
@@ -8158,9 +8136,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8158
8136
|
all_vals = lodash.clone(fieldFilter.includes);
|
8159
8137
|
}
|
8160
8138
|
if (all_vals) {
|
8161
|
-
if (fieldFilter.allow_nulls && all_vals.length > 1) {
|
8162
|
-
all_vals = all_vals.filter(x => x !== '[null]')
|
8163
|
-
}
|
8164
8139
|
all_vals = all_vals.join(', ');
|
8165
8140
|
tooltip = ' (' + all_vals + ')';
|
8166
8141
|
if (all_vals.split(',').length > highchartsRenderer.MAX_SELECTED_ITEMS_BEFORE_COLLAPSING && isGlobalFilter
|
@@ -8202,9 +8177,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8202
8177
|
}
|
8203
8178
|
|
8204
8179
|
if (all_vals) {
|
8205
|
-
if (fieldFilter.allow_nulls && all_vals.length > 1) {
|
8206
|
-
all_vals = all_vals.filter(x => x !== '[null]')
|
8207
|
-
}
|
8208
8180
|
all_vals = all_vals.join(', ');
|
8209
8181
|
tooltip = ' (Exclusions: ' + all_vals + ')';
|
8210
8182
|
if (all_vals.split(',').length > highchartsRenderer.MAX_SELECTED_ITEMS_BEFORE_COLLAPSING && isGlobalFilter
|
@@ -8354,7 +8326,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8354
8326
|
}) : ret['values'];
|
8355
8327
|
}
|
8356
8328
|
ret['is_excluded'] = element.hasOwnProperty('excludes') && element.excludes != null;
|
8357
|
-
ret['allow_nulls'] = element.hasOwnProperty('allow_nulls') ? element.allow_nulls : false;
|
8358
8329
|
ret['inject_only'] = element.hasOwnProperty('inject_only') ? element.inject_only : false;
|
8359
8330
|
return ret;
|
8360
8331
|
});
|
@@ -8424,16 +8395,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8424
8395
|
dashboardsFilters = dashboardsFilters.concat(highchartsRenderer.getRelevantFilters(local_current_dashboard.filters));
|
8425
8396
|
}
|
8426
8397
|
|
8427
|
-
lodash.forEach(dashboardsFilters, function (filter) {
|
8428
|
-
if (filter.allow_nulls) {
|
8429
|
-
if (filter.values && Array.isArray(filter.values)) {
|
8430
|
-
if (!lodash.includes(filter.values, "[null]")) {
|
8431
|
-
filter.values.push("[null]");
|
8432
|
-
}
|
8433
|
-
}
|
8434
|
-
}
|
8435
|
-
});
|
8436
|
-
|
8437
8398
|
if (remove_filters_from_global) {
|
8438
8399
|
dashboardsFilters = highchartsRenderer.objectCopyJsonMethod(dashboardsFilters);
|
8439
8400
|
lodash.forEach(remove_filters_from_global, function (field) {
|
@@ -8482,32 +8443,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8482
8443
|
return presentation_data_tag;
|
8483
8444
|
};
|
8484
8445
|
|
8485
|
-
highchartsRenderer.getDashboardApplyScenarios = function (data_model, graph, local_current_dashboard) {
|
8486
|
-
if (local_current_dashboard == undefined) {
|
8487
|
-
local_current_dashboard = data_model.current_dashboard;
|
8488
|
-
}
|
8489
|
-
|
8490
|
-
let applyScenarios = [];
|
8491
|
-
if (data_model.ebmedded_apply_scenario_ids && data_model.ebmedded_apply_scenario_ids.length > 0) {
|
8492
|
-
return data_model.ebmedded_apply_scenario_ids;
|
8493
|
-
}
|
8494
|
-
|
8495
|
-
if (local_current_dashboard && graph && graph.vals && graph.vals.length == 1) {
|
8496
|
-
// Check Scenarios
|
8497
|
-
lodash.forEach(local_current_dashboard.scenario_models, function (dashboard_scenario_model) {
|
8498
|
-
if (dashboard_scenario_model && dashboard_scenario_model.value && dashboard_scenario_model.scenario_model && dashboard_scenario_model.scenario_model.source_fields) {
|
8499
|
-
if (lodash.includes(dashboard_scenario_model.scenario_model.source_fields, graph.vals[0].field)) {
|
8500
|
-
let selected_scenario = lodash.find(dashboard_scenario_model.scenario_model.scenarios, {id: dashboard_scenario_model.value});
|
8501
|
-
if (selected_scenario) {
|
8502
|
-
applyScenarios.push(selected_scenario);
|
8503
|
-
}
|
8504
|
-
}
|
8505
|
-
}
|
8506
|
-
});
|
8507
|
-
}
|
8508
|
-
return lodash.map(applyScenarios, 'id');
|
8509
|
-
};
|
8510
|
-
|
8511
8446
|
highchartsRenderer.isDate = function (date) {
|
8512
8447
|
return new Date(date) !== "Invalid Date" && !isNaN(new Date(date));
|
8513
8448
|
};
|
@@ -8734,7 +8669,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8734
8669
|
"includes": null,
|
8735
8670
|
"show_in_graph": false,
|
8736
8671
|
"override_global_filter": false,
|
8737
|
-
"allow_nulls": false,
|
8738
8672
|
});
|
8739
8673
|
temp.values = [row_value];
|
8740
8674
|
temp.values.label = row_value;
|
@@ -8858,7 +8792,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8858
8792
|
filtOb.is_excluded = false;
|
8859
8793
|
filtOb.values = [value] || null;
|
8860
8794
|
filtOb.show_in_graph = field.show_in_graph || false;
|
8861
|
-
filtOb.allow_nulls = field.allow_nulls || false;
|
8862
8795
|
filtOb.override_global_filter = false;
|
8863
8796
|
filtOb.field = field.id;
|
8864
8797
|
filtOb.name = highchartsRenderer.decodeFunc(field.name);
|
@@ -106,14 +106,12 @@ describe('highcharts_renderer', () => {
|
|
106
106
|
includes: ['test'],
|
107
107
|
show_in_graph: true,
|
108
108
|
override_global_filter: true,
|
109
|
-
allow_nulls: true,
|
110
109
|
};
|
111
110
|
expect(highchartsRenderer.createFilterObject(field)).toEqual({
|
112
111
|
is_excluded: false,
|
113
112
|
values: ['test'],
|
114
113
|
show_in_graph: true,
|
115
114
|
override_global_filter: true,
|
116
|
-
allow_nulls: true,
|
117
115
|
field: 1,
|
118
116
|
name: 'name',
|
119
117
|
});
|
@@ -130,7 +128,6 @@ describe('highcharts_renderer', () => {
|
|
130
128
|
values: null,
|
131
129
|
show_in_graph: false,
|
132
130
|
override_global_filter: false,
|
133
|
-
allow_nulls: false,
|
134
131
|
field: 1,
|
135
132
|
name: 'name',
|
136
133
|
});
|
@@ -147,7 +144,6 @@ describe('highcharts_renderer', () => {
|
|
147
144
|
values: ['test'],
|
148
145
|
show_in_graph: false,
|
149
146
|
override_global_filter: false,
|
150
|
-
allow_nulls: false,
|
151
147
|
field: 1,
|
152
148
|
name: 'name',
|
153
149
|
});
|
@@ -166,7 +162,6 @@ describe('highcharts_renderer', () => {
|
|
166
162
|
values: field.values,
|
167
163
|
show_in_graph: false,
|
168
164
|
override_global_filter: false,
|
169
|
-
allow_nulls: false,
|
170
165
|
field: 1,
|
171
166
|
name: 'name',
|
172
167
|
});
|
@@ -185,7 +180,6 @@ describe('highcharts_renderer', () => {
|
|
185
180
|
values: field.datetypevalues,
|
186
181
|
show_in_graph: false,
|
187
182
|
override_global_filter: false,
|
188
|
-
allow_nulls: false,
|
189
183
|
field: 1,
|
190
184
|
name: 'name',
|
191
185
|
});
|
@@ -204,7 +198,6 @@ describe('highcharts_renderer', () => {
|
|
204
198
|
values: field.values,
|
205
199
|
show_in_graph: false,
|
206
200
|
override_global_filter: false,
|
207
|
-
allow_nulls: false,
|
208
201
|
field: 1,
|
209
202
|
name: 'name',
|
210
203
|
});
|
@@ -273,7 +266,6 @@ describe('highcharts_renderer', () => {
|
|
273
266
|
type: 'Float',
|
274
267
|
name: 'name',
|
275
268
|
fields: [1,3,4],
|
276
|
-
allow_nulls: true,
|
277
269
|
}
|
278
270
|
});
|
279
271
|
|
@@ -1662,7 +1654,6 @@ describe('highcharts_renderer', () => {
|
|
1662
1654
|
is_excluded: false,
|
1663
1655
|
show_in_graph: true,
|
1664
1656
|
override_global_filter: true,
|
1665
|
-
allow_nulls: true
|
1666
1657
|
};
|
1667
1658
|
fieldOb = {
|
1668
1659
|
name: 'fieldName',
|
@@ -1681,7 +1672,6 @@ describe('highcharts_renderer', () => {
|
|
1681
1672
|
});
|
1682
1673
|
expect(fieldOb.show_in_graph).toBe(true);
|
1683
1674
|
expect(fieldOb.override_global_filter).toBe(true);
|
1684
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1685
1675
|
});
|
1686
1676
|
|
1687
1677
|
it('should set excludes array for field when filter is excluded', () => {
|
@@ -1696,7 +1686,6 @@ describe('highcharts_renderer', () => {
|
|
1696
1686
|
});
|
1697
1687
|
expect(fieldOb.show_in_graph).toBe(true);
|
1698
1688
|
expect(fieldOb.override_global_filter).toBe(true);
|
1699
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1700
1689
|
});
|
1701
1690
|
|
1702
1691
|
it('should set values on field when datetype is not list', () => {
|
@@ -1713,7 +1702,6 @@ describe('highcharts_renderer', () => {
|
|
1713
1702
|
expect(fieldOb.values).toEqual(filterObj.values);
|
1714
1703
|
expect(fieldOb.show_in_graph).toBe(true);
|
1715
1704
|
expect(fieldOb.override_global_filter).toBe(true);
|
1716
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1717
1705
|
});
|
1718
1706
|
|
1719
1707
|
it('should set values.val on filterObj when datetype is list', () => {
|
@@ -1730,7 +1718,6 @@ describe('highcharts_renderer', () => {
|
|
1730
1718
|
expect(filterObj.values).toEqual(values);
|
1731
1719
|
expect(fieldOb.show_in_graph).toBe(true);
|
1732
1720
|
expect(fieldOb.override_global_filter).toBe(true);
|
1733
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1734
1721
|
});
|
1735
1722
|
|
1736
1723
|
it('should set values on field when type is advanced', () => {
|
@@ -1746,7 +1733,6 @@ describe('highcharts_renderer', () => {
|
|
1746
1733
|
expect(fieldOb.values).toEqual(filterObj.values);
|
1747
1734
|
expect(fieldOb.show_in_graph).toBe(true);
|
1748
1735
|
expect(fieldOb.override_global_filter).toBe(true);
|
1749
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1750
1736
|
});
|
1751
1737
|
|
1752
1738
|
it('should set show_in_graph to false on field when filterObj.show_in_graph is false', () => {
|
@@ -1755,7 +1741,6 @@ describe('highcharts_renderer', () => {
|
|
1755
1741
|
|
1756
1742
|
expect(fieldOb.show_in_graph).toBeUndefined();
|
1757
1743
|
expect(fieldOb.override_global_filter).toBe(true);
|
1758
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1759
1744
|
});
|
1760
1745
|
|
1761
1746
|
it('should set override_global_filter to false on field when filterObj.override_global_filter is false', () => {
|
@@ -1765,17 +1750,6 @@ describe('highcharts_renderer', () => {
|
|
1765
1750
|
|
1766
1751
|
expect(fieldOb.show_in_graph).toBe(true);
|
1767
1752
|
expect(fieldOb.override_global_filter).toBeUndefined();
|
1768
|
-
expect(fieldOb.allow_nulls).toBe(true);
|
1769
|
-
});
|
1770
|
-
|
1771
|
-
|
1772
|
-
it('should set allow_nulls to false on field when filterObj.allow_nulls is false', () => {
|
1773
|
-
filterObj.allow_nulls = false;
|
1774
|
-
highchartsRenderer.addFilterDataToField(filterObj, fieldOb, includes);
|
1775
|
-
|
1776
|
-
expect(fieldOb.show_in_graph).toBe(true);
|
1777
|
-
expect(fieldOb.override_global_filter).toBe(true);
|
1778
|
-
expect(fieldOb.allow_nulls).toBeUndefined();
|
1779
1753
|
});
|
1780
1754
|
});
|
1781
1755
|
|
@@ -3607,22 +3581,6 @@ describe('highcharts_renderer', () => {
|
|
3607
3581
|
expect(res.tooltip).toEqual('test: (Exclusions: ' + fieldFilter.excludes.join(', ') + ')');
|
3608
3582
|
});
|
3609
3583
|
|
3610
|
-
it('Should exclude "[null]" from includes if allow_nulls enabled', () => {
|
3611
|
-
fieldFilter.allow_nulls = true;
|
3612
|
-
fieldFilter.includes = ['value 1', '[null]'];
|
3613
|
-
let res = highchartsRenderer.getFilterLabel(fieldFilter, false);
|
3614
|
-
expect(res.label).toEqual('test (value 1)');
|
3615
|
-
expect(res.tooltip).toEqual('test (' + fieldFilter.includes[0] + ')');
|
3616
|
-
});
|
3617
|
-
|
3618
|
-
it('Should exclude "[null]" from excludes if allow_nulls enabled', () => {
|
3619
|
-
fieldFilter.allow_nulls = true;
|
3620
|
-
fieldFilter.excludes = ['value 1', '[null]'];
|
3621
|
-
let res = highchartsRenderer.getFilterLabel(fieldFilter, false);
|
3622
|
-
expect(res.label).toEqual('test (Exclusions: value 1)');
|
3623
|
-
expect(res.tooltip).toEqual('test (Exclusions: ' + fieldFilter.excludes[0] + ')');
|
3624
|
-
});
|
3625
|
-
|
3626
3584
|
it('Should present formatted dates in includes. Get formatted value from invertValueFormatMap object if exist ', () => {
|
3627
3585
|
fieldFilter.includes = [1682063884, 1682060884, 1682013884];
|
3628
3586
|
fieldFilter.type = 'Date';
|
@@ -3787,21 +3745,18 @@ describe('highcharts_renderer', () => {
|
|
3787
3745
|
fields: ['field2'],
|
3788
3746
|
values: [1, 2, 3],
|
3789
3747
|
is_excluded: false,
|
3790
|
-
allow_nulls: false,
|
3791
3748
|
inject_only: false
|
3792
3749
|
});
|
3793
3750
|
expect(relevantFilters).toContainEqual({
|
3794
3751
|
fields: ['field3'],
|
3795
3752
|
values: ['abc'],
|
3796
3753
|
is_excluded: true,
|
3797
|
-
allow_nulls: false,
|
3798
3754
|
inject_only: false
|
3799
3755
|
});
|
3800
3756
|
expect(relevantFilters).toContainEqual({
|
3801
3757
|
fields: ['field4'],
|
3802
3758
|
values: {datetype: 'date', start: '2022-01-01', end: '2022-01-31'},
|
3803
3759
|
is_excluded: false,
|
3804
|
-
allow_nulls: false,
|
3805
3760
|
inject_only: false
|
3806
3761
|
});
|
3807
3762
|
});
|
@@ -3853,7 +3808,6 @@ describe('highcharts_renderer', () => {
|
|
3853
3808
|
to: null
|
3854
3809
|
},
|
3855
3810
|
is_excluded: false,
|
3856
|
-
allow_nulls: false,
|
3857
3811
|
inject_only: false
|
3858
3812
|
}
|
3859
3813
|
];
|
@@ -4033,36 +3987,6 @@ describe('highcharts_renderer', () => {
|
|
4033
3987
|
const result = highchartsRenderer.getDashboardFilters(data_model, remove_filters_from_global, data_model.current_dashboard);
|
4034
3988
|
expect(result.length).toEqual(1);
|
4035
3989
|
});
|
4036
|
-
|
4037
|
-
it('should add "[null]" to values array for filters with "allow_nulls" flag', () => {
|
4038
|
-
const currentDashboardWithNull = {
|
4039
|
-
filters: [
|
4040
|
-
{
|
4041
|
-
fields: [{ id: 'field1', name: 'Field 1' }],
|
4042
|
-
includes: ['value1', 'value2'],
|
4043
|
-
allow_nulls: false,
|
4044
|
-
},
|
4045
|
-
],
|
4046
|
-
};
|
4047
|
-
const dataModelWithNull = { current_dashboard: currentDashboardWithNull };
|
4048
|
-
const result = highchartsRenderer.getDashboardFilters(dataModelWithNull);
|
4049
|
-
expect(result[0].values).toEqual(['value1', 'value2']);
|
4050
|
-
});
|
4051
|
-
|
4052
|
-
it('should not add "[null]" to values array if it is already present', () => {
|
4053
|
-
const currentDashboardWithNull = {
|
4054
|
-
filters: [
|
4055
|
-
{
|
4056
|
-
fields: [{ id: 'field1', name: 'Field 1' }],
|
4057
|
-
includes: ['value1'],
|
4058
|
-
allow_nulls: true,
|
4059
|
-
},
|
4060
|
-
],
|
4061
|
-
};
|
4062
|
-
const dataModelWithNull = { current_dashboard: currentDashboardWithNull };
|
4063
|
-
const result = highchartsRenderer.getDashboardFilters(dataModelWithNull);
|
4064
|
-
expect(result[0].values).toEqual(['value1', '[null]']);
|
4065
|
-
});
|
4066
3990
|
});
|
4067
3991
|
|
4068
3992
|
describe('function getPresentationTagType', () => {
|
@@ -4155,64 +4079,6 @@ describe('highcharts_renderer', () => {
|
|
4155
4079
|
});
|
4156
4080
|
});
|
4157
4081
|
|
4158
|
-
describe('function getDashboardApplyScenarios', () => {
|
4159
|
-
let data_model;
|
4160
|
-
let graph;
|
4161
|
-
|
4162
|
-
beforeEach(() => {
|
4163
|
-
graph = { vals: [{ field: 'field1' }] };
|
4164
|
-
data_model = {
|
4165
|
-
current_dashboard: {
|
4166
|
-
scenario_models: [
|
4167
|
-
{
|
4168
|
-
value: 1,
|
4169
|
-
scenario_model: { source_fields: ['field1'], scenarios: [{ id: 1 }, { id: 2 }] },
|
4170
|
-
},
|
4171
|
-
{
|
4172
|
-
value: 2,
|
4173
|
-
scenario_model: { source_fields: ['field2'], scenarios: [{ id: 3 }, { id: 4 }] },
|
4174
|
-
},
|
4175
|
-
],
|
4176
|
-
},
|
4177
|
-
ebmedded_apply_scenario_ids: [],
|
4178
|
-
};
|
4179
|
-
});
|
4180
|
-
|
4181
|
-
it('returns ebmedded_apply_scenario_ids if data_model has it', () => {
|
4182
|
-
data_model.ebmedded_apply_scenario_ids = [5, 6];
|
4183
|
-
const local_current_dashboard = { foo: 'bar' };
|
4184
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, graph, local_current_dashboard);
|
4185
|
-
expect(result).toEqual([5, 6]);
|
4186
|
-
});
|
4187
|
-
|
4188
|
-
it('returns empty array if scenario_models in local_current_dashboard are not provided', () => {
|
4189
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, {vals: [null]}, {});
|
4190
|
-
expect(result).toEqual([]);
|
4191
|
-
});
|
4192
|
-
|
4193
|
-
it('returns empty array if graph has no vals', () => {
|
4194
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, {});
|
4195
|
-
expect(result).toEqual([]);
|
4196
|
-
});
|
4197
|
-
|
4198
|
-
it('returns empty array if graph has more than one val', () => {
|
4199
|
-
const graph = { vals: [{ field: 'field1' }, { field: 'field2' }] };
|
4200
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, graph, {});
|
4201
|
-
expect(result).toEqual([]);
|
4202
|
-
});
|
4203
|
-
|
4204
|
-
it('returns array of selected scenario ids', () => {
|
4205
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, graph, data_model.current_dashboard);
|
4206
|
-
expect(result).toEqual([1]);
|
4207
|
-
});
|
4208
|
-
|
4209
|
-
it('returns empty array if no matching scenario is found', () => {
|
4210
|
-
const graph = { vals: [{ field: 'field3' }] };
|
4211
|
-
const result = highchartsRenderer.getDashboardApplyScenarios(data_model, graph, data_model.current_dashboard);
|
4212
|
-
expect(result).toEqual([]);
|
4213
|
-
});
|
4214
|
-
});
|
4215
|
-
|
4216
4082
|
describe('function isDate', () => {
|
4217
4083
|
it('returns true for valid date string', () => {
|
4218
4084
|
expect(highchartsRenderer.isDate('2022-01-01')).toBe(true);
|
@@ -5887,7 +5753,6 @@ describe('highcharts_renderer', () => {
|
|
5887
5753
|
name: "Month",
|
5888
5754
|
values: [1682812800, 1680220800, "[null]"],
|
5889
5755
|
is_excluded: false,
|
5890
|
-
allow_nulls: false,
|
5891
5756
|
show_in_graph: true,
|
5892
5757
|
type: "Date",
|
5893
5758
|
override_global_filter: false,
|
@@ -5897,7 +5762,6 @@ describe('highcharts_renderer', () => {
|
|
5897
5762
|
name: "AccountCode",
|
5898
5763
|
values: null,
|
5899
5764
|
is_excluded: false,
|
5900
|
-
allow_nulls: false,
|
5901
5765
|
show_in_graph: true,
|
5902
5766
|
type: "Text",
|
5903
5767
|
override_global_filter: false,
|
@@ -5916,7 +5780,6 @@ describe('highcharts_renderer', () => {
|
|
5916
5780
|
name: "Data Type",
|
5917
5781
|
values: ["Activity"],
|
5918
5782
|
is_excluded: false,
|
5919
|
-
allow_nulls: false,
|
5920
5783
|
show_in_graph: false,
|
5921
5784
|
type: "Text",
|
5922
5785
|
override_global_filter: false,
|
@@ -5933,7 +5796,6 @@ describe('highcharts_renderer', () => {
|
|
5933
5796
|
}, ],
|
5934
5797
|
},
|
5935
5798
|
is_excluded: false,
|
5936
|
-
allow_nulls: false,
|
5937
5799
|
show_in_graph: false,
|
5938
5800
|
type: "Text",
|
5939
5801
|
override_global_filter: false,
|
@@ -6200,7 +6062,6 @@ describe('highcharts_renderer', () => {
|
|
6200
6062
|
name: "Month",
|
6201
6063
|
values: [1682812800, 1680220800, "[null]", null, 0, "", 1680220800],
|
6202
6064
|
is_excluded: false,
|
6203
|
-
allow_nulls: false,
|
6204
6065
|
show_in_graph: true,
|
6205
6066
|
type: "Date",
|
6206
6067
|
override_global_filter: false,
|
@@ -6216,7 +6077,6 @@ describe('highcharts_renderer', () => {
|
|
6216
6077
|
name: "VT_Month",
|
6217
6078
|
values: [1682812800, 1680220800, "[null]", null, 0, "", 1680220800],
|
6218
6079
|
is_excluded: false,
|
6219
|
-
allow_nulls: false,
|
6220
6080
|
show_in_graph: true,
|
6221
6081
|
type: "Date",
|
6222
6082
|
override_global_filter: false,
|
@@ -6232,7 +6092,6 @@ describe('highcharts_renderer', () => {
|
|
6232
6092
|
name: "Month",
|
6233
6093
|
values: [100, 200, "[null]", null, "Text", 0],
|
6234
6094
|
is_excluded: false,
|
6235
|
-
allow_nulls: false,
|
6236
6095
|
show_in_graph: true,
|
6237
6096
|
type: "Number",
|
6238
6097
|
override_global_filter: false,
|
@@ -54,7 +54,6 @@
|
|
54
54
|
"Income"
|
55
55
|
],
|
56
56
|
"is_excluded": false,
|
57
|
-
"allow_nulls": true,
|
58
57
|
"type": "Text",
|
59
58
|
"override_global_filter": false
|
60
59
|
},
|
@@ -65,7 +64,6 @@
|
|
65
64
|
"Auto"
|
66
65
|
],
|
67
66
|
"is_excluded": true,
|
68
|
-
"allow_nulls": false,
|
69
67
|
"type": "Text",
|
70
68
|
"override_global_filter": false
|
71
69
|
},
|
@@ -83,7 +81,6 @@
|
|
83
81
|
]
|
84
82
|
},
|
85
83
|
"is_excluded": false,
|
86
|
-
"allow_nulls": false,
|
87
84
|
"type": "Text",
|
88
85
|
"override_global_filter": false
|
89
86
|
},
|
@@ -95,7 +92,6 @@
|
|
95
92
|
1643587200
|
96
93
|
],
|
97
94
|
"is_excluded": false,
|
98
|
-
"allow_nulls": false,
|
99
95
|
"type": "Date",
|
100
96
|
"override_global_filter": false
|
101
97
|
},
|
@@ -109,7 +105,6 @@
|
|
109
105
|
]
|
110
106
|
},
|
111
107
|
"is_excluded": true,
|
112
|
-
"allow_nulls": false,
|
113
108
|
"type": "Date",
|
114
109
|
"override_global_filter": false
|
115
110
|
},
|
@@ -124,7 +119,6 @@
|
|
124
119
|
}
|
125
120
|
},
|
126
121
|
"is_excluded": false,
|
127
|
-
"allow_nulls": false,
|
128
122
|
"type": "Date",
|
129
123
|
"override_global_filter": false
|
130
124
|
}
|
@@ -15,7 +15,6 @@
|
|
15
15
|
],
|
16
16
|
"is_excluded": false,
|
17
17
|
"show_in_graph": true,
|
18
|
-
"allow_nulls ": true,
|
19
18
|
"type": "Text",
|
20
19
|
"override_global_filter": true
|
21
20
|
},
|
@@ -86,7 +85,6 @@
|
|
86
85
|
]
|
87
86
|
},
|
88
87
|
"is_excluded": true,
|
89
|
-
"allow_nulls": true,
|
90
88
|
"type": "Date",
|
91
89
|
"override_global_filter": false
|
92
90
|
}
|
package/tests/mock/widgets.json
CHANGED
@@ -166,7 +166,6 @@
|
|
166
166
|
"Other Income"
|
167
167
|
],
|
168
168
|
"is_excluded": false,
|
169
|
-
"allow_nulls": true,
|
170
169
|
"show_in_graph": true,
|
171
170
|
"type": "Text",
|
172
171
|
"override_global_filter": true
|
@@ -182,7 +181,6 @@
|
|
182
181
|
}
|
183
182
|
},
|
184
183
|
"is_excluded": false,
|
185
|
-
"allow_nulls": false,
|
186
184
|
"show_in_graph": false,
|
187
185
|
"type": "Date",
|
188
186
|
"override_global_filter": false
|
@@ -195,7 +193,6 @@
|
|
195
193
|
1643587200
|
196
194
|
],
|
197
195
|
"is_excluded": false,
|
198
|
-
"allow_nulls": true,
|
199
196
|
"show_in_graph": true,
|
200
197
|
"type": "Date",
|
201
198
|
"override_global_filter": true
|
@@ -375,10 +372,6 @@
|
|
375
372
|
"is_formatting_by_aggregation_method": true
|
376
373
|
}
|
377
374
|
],
|
378
|
-
"fields_allow_null_in_filters": [
|
379
|
-
161918,
|
380
|
-
161924
|
381
|
-
],
|
382
375
|
"error_has_occurred": false
|
383
376
|
},
|
384
377
|
"vals": [
|