@datarailsshared/dr_renderer 1.2.63 → 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 +16 -14
- 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,7 +1020,8 @@ 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);
|
|
@@ -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,12 +1176,12 @@ 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 (
|
|
1184
|
+
} else if (lodash.includes(chartType,'combo')) {
|
|
1184
1185
|
if (has_delta) {
|
|
1185
1186
|
totalSeries.type = 'column';
|
|
1186
1187
|
} else {
|
|
@@ -1197,7 +1198,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1197
1198
|
key = columnKey[0];
|
|
1198
1199
|
totalKey = totalKey.join(' , ');
|
|
1199
1200
|
}
|
|
1200
|
-
|
|
1201
|
+
const value = pivotData.colTotals[totalKey] ? pivotData.colTotals[totalKey].value() : 0;
|
|
1202
|
+
totalSeries.data.push({name: lodash.unescape(key), y: value});
|
|
1201
1203
|
});
|
|
1202
1204
|
|
|
1203
1205
|
chart_series.push(totalSeries);
|
|
@@ -3026,13 +3028,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3026
3028
|
|
|
3027
3029
|
highchartsRenderer.ignoreIfCalculatedValue = function(data, rowKey, colKey, record, associatedFields, renderOptions, isGraph) {
|
|
3028
3030
|
var eliminate = renderOptions && renderOptions.chartOptions && renderOptions.chartOptions.table_options &&
|
|
3029
|
-
renderOptions.chartOptions.table_options.eliminate_calc_totals && !
|
|
3031
|
+
renderOptions.chartOptions.table_options.eliminate_calc_totals && !lodash.isEmpty(associatedFields) && !isGraph;
|
|
3030
3032
|
let ignore = false;
|
|
3031
3033
|
|
|
3032
3034
|
if (eliminate && !(data.colAttrs.length === colKey.length && data.rowAttrs.length === rowKey.length)) {
|
|
3033
|
-
const keys =
|
|
3034
|
-
|
|
3035
|
-
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'])) {
|
|
3036
3038
|
ignore = true;
|
|
3037
3039
|
}
|
|
3038
3040
|
});
|
|
@@ -4129,14 +4131,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4129
4131
|
formats: {},
|
|
4130
4132
|
associated_fields: {},
|
|
4131
4133
|
};
|
|
4132
|
-
|
|
4134
|
+
lodash.forEach(widget.calculated_values, item => {
|
|
4133
4135
|
calculated_values_info.formats[item.name] = item.format
|
|
4134
4136
|
|
|
4135
4137
|
let fieldName = item.field_name;
|
|
4136
4138
|
|
|
4137
4139
|
if (!fieldName) {
|
|
4138
|
-
const sourceArr =
|
|
4139
|
-
const filed =
|
|
4140
|
+
const sourceArr = lodash.concat(widget.cols, widget.rows);
|
|
4141
|
+
const filed = lodash.find(sourceArr, {id: item.field})
|
|
4140
4142
|
fieldName = filed ? filed.name : '';
|
|
4141
4143
|
}
|
|
4142
4144
|
|
|
@@ -4426,7 +4428,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4426
4428
|
};
|
|
4427
4429
|
|
|
4428
4430
|
highchartsRenderer.updateBackwardCompatibleWidgetOptions = function(options, type) {
|
|
4429
|
-
if (
|
|
4431
|
+
if (lodash.get(options, 'chartOptions.chart.hideLegends', false)) {
|
|
4430
4432
|
options.chartOptions.legends_position = { value: 'none' };
|
|
4431
4433
|
delete options.chartOptions.chart.hideLegends;
|
|
4432
4434
|
}
|
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;
|