@datarailsshared/dr_renderer 1.2.67 → 1.2.68
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 +49 -25
- package/src/highcharts_renderer.js +1 -1
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -127,10 +127,10 @@ let initDRPivotTable = function($, window, document) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (containsAverage || containsOthers) {
|
|
130
|
-
if (containsAverage && key[0] === 'DR_Average') {
|
|
130
|
+
if (containsAverage && !containsOthers && key[0] === 'DR_Average') {
|
|
131
131
|
totals[flatKey].push(record);
|
|
132
132
|
}
|
|
133
|
-
if (containsOthers && key[0] === 'DR_Others') {
|
|
133
|
+
if (containsOthers && !containsAverage && key[0] === 'DR_Others') {
|
|
134
134
|
totals[flatKey].push(record);
|
|
135
135
|
}
|
|
136
136
|
} else {
|
|
@@ -487,7 +487,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
487
487
|
var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
|
|
488
488
|
var getAdditionalAggregation, buildAdditionalHeaderCols, buildAdditionalHeaderRows, buildAdditionalColValues, buildAdditionalRowValues, buildAdditionalRowTotals, buildAdditionalColTotals;
|
|
489
489
|
var additionalFieldsCol, additionalFieldsRow, additionalFieldsList;
|
|
490
|
-
var edit_assumptions;
|
|
490
|
+
var edit_assumptions, getExistingAggregator;
|
|
491
491
|
|
|
492
492
|
var horizontalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' horizontal-freeze-pane' : '';
|
|
493
493
|
var verticalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' vertical-freeze-pane' : '';
|
|
@@ -1355,14 +1355,11 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
|
|
1357
1357
|
buildAdditionalRowValues = function (tr, colHeaderCols, rowKey) {
|
|
1358
|
-
let totalRowValue = 0;
|
|
1359
|
-
|
|
1360
1358
|
for (let i = 0; i < colHeaderCols.length; i++) {
|
|
1361
1359
|
const colKey = colHeaderCols[i].flatKey;
|
|
1362
1360
|
const totalAggregator = getAdditionalAggregation(rowKey, colKey);
|
|
1363
1361
|
const val = totalAggregator.value();
|
|
1364
1362
|
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
1365
|
-
totalRowValue += +formattedValue;
|
|
1366
1363
|
|
|
1367
1364
|
let className = " col" + i + " colcol" + 0;
|
|
1368
1365
|
const td = createElement("td", className, formattedValue, {
|
|
@@ -1374,46 +1371,73 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1374
1371
|
tr.appendChild(td);
|
|
1375
1372
|
}
|
|
1376
1373
|
|
|
1374
|
+
if (additionalFieldsCol.length) {
|
|
1375
|
+
for (let i = 0; i < additionalFieldsCol.length; i++) {
|
|
1376
|
+
const totalAggregator = getAdditionalAggregation(rowKey, additionalFieldsCol[i].key);
|
|
1377
|
+
const val = totalAggregator.value();
|
|
1378
|
+
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
1379
|
+
|
|
1380
|
+
let className = " col" + i + " colcol" + 0;
|
|
1381
|
+
const td = createElement("td", className, formattedValue, {
|
|
1382
|
+
"data-value": val,
|
|
1383
|
+
"data-for": "col" + 0,
|
|
1384
|
+
"data-colnode": "" + i
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
tr.appendChild(td);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1377
1391
|
if(opts.chartOptions.table_options.show_row_total) {
|
|
1378
|
-
buildAdditionalRowTotals(tr,
|
|
1392
|
+
buildAdditionalRowTotals(tr, rowKey)
|
|
1379
1393
|
}
|
|
1380
1394
|
}
|
|
1381
1395
|
|
|
1382
|
-
buildAdditionalRowTotals = function (tr,
|
|
1383
|
-
|
|
1396
|
+
buildAdditionalRowTotals = function (tr, rowKey) {
|
|
1397
|
+
const totalAggregator = getExistingAggregator(rowTotals, rowKey);
|
|
1398
|
+
const value = totalAggregator.value();
|
|
1399
|
+
const formattedValue = getFormattedNumber(value, totalAggregator, opts)
|
|
1384
1400
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1401
|
+
let style = "pvtTotal pvtAddFiled rowTotal";
|
|
1402
|
+
const td = createElement("td", style, formattedValue, {
|
|
1403
|
+
"data-value": value
|
|
1387
1404
|
});
|
|
1388
1405
|
|
|
1389
1406
|
tr.appendChild(td);
|
|
1390
1407
|
}
|
|
1391
1408
|
|
|
1392
1409
|
buildAdditionalColTotals = function (tr, rowHeaderRows, colKey, colHeader) {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
for (let i = 0; i < rowHeaderRows.length; i++) {
|
|
1397
|
-
const rowKey = rowHeaderRows[i].flatKey;
|
|
1398
|
-
const totalAggregator = getAdditionalAggregation(rowKey, colKey);
|
|
1399
|
-
val = totalAggregator.value();
|
|
1400
|
-
|
|
1401
|
-
othersVal += +getFormattedNumber(val, totalAggregator, opts);
|
|
1402
|
-
}
|
|
1410
|
+
const totalAggregator = getExistingAggregator(colTotals, colKey)
|
|
1411
|
+
const value = totalAggregator.value();
|
|
1412
|
+
const formattedValue = getFormattedNumber(value, totalAggregator, opts);
|
|
1403
1413
|
|
|
1404
1414
|
let style = "pvtTotal pvtAddField colTotal";
|
|
1405
1415
|
style += " col" + colHeader.row + " colcol" + colHeader.col;
|
|
1406
1416
|
|
|
1407
|
-
const td = createElement("td", style,
|
|
1408
|
-
"data-value":
|
|
1417
|
+
const td = createElement("td", style, formattedValue, {
|
|
1418
|
+
"data-value": value,
|
|
1409
1419
|
"data-rowcol": "col" + colHeader.col,
|
|
1410
1420
|
"data-rownode": "" + colHeader.node
|
|
1411
|
-
}, getTableEventHandlers(
|
|
1412
|
-
|
|
1421
|
+
}, getTableEventHandlers(value, [], colHeader.key));
|
|
1413
1422
|
|
|
1414
1423
|
return td;
|
|
1415
1424
|
}
|
|
1416
1425
|
|
|
1426
|
+
getExistingAggregator = function (aggregator, key) {
|
|
1427
|
+
if (!aggregator[key]) {
|
|
1428
|
+
return {
|
|
1429
|
+
value: (function () {
|
|
1430
|
+
return null;
|
|
1431
|
+
}),
|
|
1432
|
+
format: function () {
|
|
1433
|
+
return "";
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
return aggregator[key];
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1417
1441
|
buildValues = function(rowHeaderRows, colHeaderCols, rowAttrs, colAttrs) {
|
|
1418
1442
|
var aggregator, colHeader, eventHandlers, flatColKey, flatRowKey, isColSubtotal, isRowSubtotal, k, l, len, len1, ref8, results, rowHeader, style, td, totalAggregator, tr, val;
|
|
1419
1443
|
|
|
@@ -2007,7 +2007,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2007
2007
|
};
|
|
2008
2008
|
|
|
2009
2009
|
highchartsRenderer.setTitleAndSubTitle = function (chartOptions, opts, additionOptions) {
|
|
2010
|
-
chartOptions.title = opts.chartOptions.hideChartHeader ?
|
|
2010
|
+
chartOptions.title = opts.chartOptions.hideChartHeader ? null : {
|
|
2011
2011
|
align: 'center',
|
|
2012
2012
|
text: opts && opts.chart_title ? opts.chart_title : "",
|
|
2013
2013
|
style: {
|