@datarailsshared/dr_renderer 1.2.60 → 1.2.64
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 +5 -5
- package/src/highcharts_renderer.js +26 -19
- package/src/novix_renderer.js +1 -1
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -146,7 +146,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
146
146
|
DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
|
|
147
147
|
if (useTotalsCalculation) {
|
|
148
148
|
if (!this.notFirst) {
|
|
149
|
-
this.keysLength =
|
|
149
|
+
this.keysLength = _.keys(record).length - 1;
|
|
150
150
|
this.notFirst = true;
|
|
151
151
|
}
|
|
152
152
|
let getRowAggregator = (function(_this) {
|
|
@@ -213,9 +213,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
213
213
|
var colKey, fColKey, fRowKey, flatColKey, flatRowKey, i, j, k, m, n, ref, results, rowKey;
|
|
214
214
|
rowKey = [];
|
|
215
215
|
colKey = [];
|
|
216
|
-
const recordValues =
|
|
217
|
-
const containsAverage =
|
|
218
|
-
const containsOthers =
|
|
216
|
+
const recordValues = _.values(record);
|
|
217
|
+
const containsAverage = _.includes(recordValues, 'DR_Average');
|
|
218
|
+
const containsOthers = _.includes(recordValues, 'DR_Others');
|
|
219
219
|
if (!containsAverage && !containsOthers) {
|
|
220
220
|
this.allTotal.push(record);
|
|
221
221
|
}
|
|
@@ -2115,7 +2115,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2115
2115
|
};
|
|
2116
2116
|
|
|
2117
2117
|
selectFreezableElements = function(wrapper) {
|
|
2118
|
-
const selectString =_.map(
|
|
2118
|
+
const selectString =_.map(_.values(elementToTransform), function (item) {
|
|
2119
2119
|
return `.${item.replace(' ', '')}`;
|
|
2120
2120
|
}).join(',');
|
|
2121
2121
|
return Array.from(wrapper.querySelectorAll(selectString));
|
|
@@ -4,7 +4,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4
4
|
let useNewUx = false;
|
|
5
5
|
let useTotalsCalculation = false;
|
|
6
6
|
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
|
7
|
-
useTotalsCalculation =
|
|
7
|
+
useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
|
8
8
|
useNewUx = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
|
|
9
9
|
}
|
|
10
10
|
const textColor = "#151a41";
|
|
@@ -1020,13 +1020,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1020
1020
|
if (lodash.isArray(columnKey)) {
|
|
1021
1021
|
totalKey = totalKey.join(' , ');
|
|
1022
1022
|
}
|
|
1023
|
-
|
|
1023
|
+
const value = pivotData.colTotals[totalKey] ? pivotData.colTotals[totalKey].value() : 0;
|
|
1024
|
+
newSeries.data.push(value);
|
|
1024
1025
|
})
|
|
1025
1026
|
|
|
1026
1027
|
chart_series.push(newSeries);
|
|
1027
1028
|
}
|
|
1028
1029
|
|
|
1029
|
-
chart_series =
|
|
1030
|
+
chart_series = chart_series.concat(trendSerieses);
|
|
1030
1031
|
|
|
1031
1032
|
highchartsRenderer.moveSeriesToSecondYAxisIfNeeded(chart_series, pivotData, chartOptions, additionOptions, opts, opts.total && opts.totalSeriesSettings && opts.totalSeriesSettings.secondaryAxis);
|
|
1032
1033
|
|
|
@@ -1153,7 +1154,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1153
1154
|
|
|
1154
1155
|
let weights = { line: 2,spline: 3 ,area:-2, areaspline: -1, scatter:4, column: 1 };
|
|
1155
1156
|
|
|
1156
|
-
if (opts.comboOptions &&
|
|
1157
|
+
if (opts.comboOptions && lodash.includes(chartType,'combo') && !lodash.isEqual(row_n_keys, [[]])) {
|
|
1157
1158
|
chart_series.forEach((series, seriesIndex) => {
|
|
1158
1159
|
const savedSeriesOption = lodash.find(opts.comboOptions.seriesOptions, {series: series.name});
|
|
1159
1160
|
if (savedSeriesOption) {
|
|
@@ -1175,14 +1176,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1175
1176
|
if (opts.total) {
|
|
1176
1177
|
const totalSeries = lodash.clone(ethalonSeries);
|
|
1177
1178
|
if (opts.totalSeriesSettings) {
|
|
1178
|
-
if (
|
|
1179
|
+
if (lodash.includes(chartType, 'combo')) {
|
|
1179
1180
|
highchartsRenderer.setChartTypeBySeriesType(opts.totalSeriesSettings.chartType, totalSeries);
|
|
1180
1181
|
}
|
|
1181
1182
|
|
|
1182
1183
|
totalSeries.yAxis = opts.totalSeriesSettings.secondaryAxis ? 1 : undefined;
|
|
1183
|
-
} else if (chartType
|
|
1184
|
-
|
|
1184
|
+
} else if (lodash.includes(chartType,'combo')) {
|
|
1185
|
+
if (has_delta) {
|
|
1186
|
+
totalSeries.type = 'column';
|
|
1187
|
+
} else {
|
|
1188
|
+
totalSeries.type = 'line';
|
|
1189
|
+
}
|
|
1185
1190
|
}
|
|
1191
|
+
|
|
1186
1192
|
totalSeries.name = 'Total';
|
|
1187
1193
|
totalSeries.data = [];
|
|
1188
1194
|
col_n_keys.forEach(columnKey => {
|
|
@@ -1192,13 +1198,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1192
1198
|
key = columnKey[0];
|
|
1193
1199
|
totalKey = totalKey.join(' , ');
|
|
1194
1200
|
}
|
|
1195
|
-
|
|
1201
|
+
const value = pivotData.colTotals[totalKey] ? pivotData.colTotals[totalKey].value() : 0;
|
|
1202
|
+
totalSeries.data.push({name: lodash.unescape(key), y: value});
|
|
1196
1203
|
});
|
|
1197
1204
|
|
|
1198
1205
|
chart_series.push(totalSeries);
|
|
1199
1206
|
}
|
|
1200
1207
|
|
|
1201
|
-
chart_series =
|
|
1208
|
+
chart_series = chart_series.concat(trendSerieses);
|
|
1202
1209
|
|
|
1203
1210
|
highchartsRenderer.moveSeriesToSecondYAxisIfNeeded(chart_series, pivotData, chartOptions, additionOptions, opts, opts.total && opts.totalSeriesSettings && opts.totalSeriesSettings.secondaryAxis);
|
|
1204
1211
|
|
|
@@ -3021,13 +3028,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3021
3028
|
|
|
3022
3029
|
highchartsRenderer.ignoreIfCalculatedValue = function(data, rowKey, colKey, record, associatedFields, renderOptions, isGraph) {
|
|
3023
3030
|
var eliminate = renderOptions && renderOptions.chartOptions && renderOptions.chartOptions.table_options &&
|
|
3024
|
-
renderOptions.chartOptions.table_options.eliminate_calc_totals && !
|
|
3031
|
+
renderOptions.chartOptions.table_options.eliminate_calc_totals && !lodash.isEmpty(associatedFields) && !isGraph;
|
|
3025
3032
|
let ignore = false;
|
|
3026
3033
|
|
|
3027
3034
|
if (eliminate && !(data.colAttrs.length === colKey.length && data.rowAttrs.length === rowKey.length)) {
|
|
3028
|
-
const keys =
|
|
3029
|
-
|
|
3030
|
-
if (~
|
|
3035
|
+
const keys = lodash.keys(associatedFields);
|
|
3036
|
+
lodash.forEach(keys, key => {
|
|
3037
|
+
if (~lodash.indexOf(associatedFields[key], record[key]) || ~lodash.indexOf(associatedFields[key], record['DR_Values'])) {
|
|
3031
3038
|
ignore = true;
|
|
3032
3039
|
}
|
|
3033
3040
|
});
|
|
@@ -4124,14 +4131,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4124
4131
|
formats: {},
|
|
4125
4132
|
associated_fields: {},
|
|
4126
4133
|
};
|
|
4127
|
-
|
|
4134
|
+
lodash.forEach(widget.calculated_values, item => {
|
|
4128
4135
|
calculated_values_info.formats[item.name] = item.format
|
|
4129
4136
|
|
|
4130
4137
|
let fieldName = item.field_name;
|
|
4131
4138
|
|
|
4132
4139
|
if (!fieldName) {
|
|
4133
|
-
const sourceArr =
|
|
4134
|
-
const filed =
|
|
4140
|
+
const sourceArr = lodash.concat(widget.cols, widget.rows);
|
|
4141
|
+
const filed = lodash.find(sourceArr, {id: item.field})
|
|
4135
4142
|
fieldName = filed ? filed.name : '';
|
|
4136
4143
|
}
|
|
4137
4144
|
|
|
@@ -4421,7 +4428,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4421
4428
|
};
|
|
4422
4429
|
|
|
4423
4430
|
highchartsRenderer.updateBackwardCompatibleWidgetOptions = function(options, type) {
|
|
4424
|
-
if (
|
|
4431
|
+
if (lodash.get(options, 'chartOptions.chart.hideLegends', false)) {
|
|
4425
4432
|
options.chartOptions.legends_position = { value: 'none' };
|
|
4426
4433
|
delete options.chartOptions.chart.hideLegends;
|
|
4427
4434
|
}
|
|
@@ -5003,7 +5010,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5003
5010
|
return valToReturn;
|
|
5004
5011
|
};
|
|
5005
5012
|
|
|
5006
|
-
highchartsRenderer.widgetPlaceholders =
|
|
5013
|
+
highchartsRenderer.widgetPlaceholders = lodash.assign({}, $.pivotUtilities.errorHandling.placeholders);
|
|
5007
5014
|
|
|
5008
5015
|
highchartsRenderer.suboptions = {
|
|
5009
5016
|
'default_show': {
|
|
@@ -7147,7 +7154,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7147
7154
|
return data_row[field_with_variant.name] == variance_config.name && data_row[field_for_sorting.name] != undefined;
|
|
7148
7155
|
});
|
|
7149
7156
|
|
|
7150
|
-
const sorting_variance = widget.options.total_value_options.sorting_variance === '' ? 'asc' : 'desc';
|
|
7157
|
+
const sorting_variance = widget.options.total_value_options && widget.options.total_value_options.sorting_variance === '' ? 'asc' : 'desc';
|
|
7151
7158
|
|
|
7152
7159
|
if (widget.options.chartOptions.delta_column.sort_by_absolute_variance) {
|
|
7153
7160
|
data_sorted = lodash.sortBy(data_sorted, function (o) {
|
package/src/novix_renderer.js
CHANGED
|
@@ -108,7 +108,7 @@ let initNovixRenderer = function($, window, document, Handsontable){
|
|
|
108
108
|
visibility: 'hidden',
|
|
109
109
|
};
|
|
110
110
|
let td = document.createElement('td');
|
|
111
|
-
for (let [key, value] of
|
|
111
|
+
for (let [key, value] of _.entries(tdStyles)) {
|
|
112
112
|
td.style[key] = value;
|
|
113
113
|
};
|
|
114
114
|
td.innerHTML = item.str;
|