@datarailsshared/dr_renderer 1.2.108 → 1.2.109

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.108",
3
+ "version": "1.2.109",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1313,7 +1313,7 @@ let initDRPivotTable = function($, window, document) {
1313
1313
  if (th.hasAttribute('data_show_more') && th.colSpan > 0 && !hasColLabels) {
1314
1314
  th.colSpan = th.colSpan - 1;
1315
1315
  }
1316
-
1316
+
1317
1317
  tr.appendChild(th);
1318
1318
  if (isRowSubtotal) {
1319
1319
  addClass(tr, classRowExpanded);
@@ -1491,14 +1491,18 @@ let initDRPivotTable = function($, window, document) {
1491
1491
  const value = totalAggregator.value();
1492
1492
  const formattedValue = getFormattedNumber(value, totalAggregator, opts);
1493
1493
 
1494
+ if (!colHeader) {
1495
+ colHeader = {}
1496
+ }
1497
+
1494
1498
  let style = "pvtTotal pvtAddField colTotal";
1495
- style += " col" + colHeader.row + " colcol" + colHeader.col;
1499
+ style += " col" + colHeader.row || "-1" + " colcol" + colHeader.col || "-1";
1496
1500
 
1497
1501
  const td = createElement("td", style, formattedValue, {
1498
1502
  "data-value": value,
1499
- "data-rowcol": "col" + colHeader.col,
1500
- "data-rownode": "" + colHeader.node
1501
- }, getTableEventHandlers(value, [], colHeader.key));
1503
+ "data-rowcol": "col" + colHeader.col || "-1",
1504
+ "data-rownode": "" + colHeader.node || "-1"
1505
+ }, getTableEventHandlers(value, [], colHeader.key || []));
1502
1506
 
1503
1507
  return td;
1504
1508
  }
@@ -467,8 +467,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
467
467
  if (!cols && is_drill_down_pie) {
468
468
  cols = this.point.name;
469
469
  }
470
-
471
- if (!lodash.isArray(cols)) {
470
+
471
+ var drOthersInColumn = lodash.find(pivotData.getColKeys(), keys => keys.length && keys.includes('DR_Others'));
472
+ if (!lodash.isArray(cols) && drOthersInColumn[0] !== 'DR_Others') {
472
473
  cols = [cols];
473
474
  }
474
475
 
@@ -1385,8 +1386,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1385
1386
  var num_cols = col_n_keys.length;
1386
1387
  var num_rows = row_n_keys.length;
1387
1388
 
1389
+ const isOthersIncludedInRow = num_rows === 1 && row_n_keys[0].includes('DR_Others');
1390
+ const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1391
+
1388
1392
  lodash.forEach(col_n_keys, function (col_n_value) {
1389
- var agg = pivotData.getAggregator([], col_n_value);
1393
+ const row_n_value = isOthersIncludedInRow ? row_n_keys[0] : [];
1394
+ var agg = pivotData.getAggregator(row_n_value, col_n_value);
1390
1395
  var val = agg.value();
1391
1396
  var key = col_n_value;
1392
1397
 
@@ -1400,6 +1405,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1400
1405
  if (lodash.isEmpty(String(ob.name))) {
1401
1406
  ob.name = "[blank]";
1402
1407
  }
1408
+
1409
+ if (ob.name === 'DR_Others') {
1410
+ ob.name = othersName;
1411
+ }
1412
+
1403
1413
  ob.y = val;
1404
1414
  if (!isNaN(key))
1405
1415
  key = Number(key)
@@ -1424,13 +1434,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1424
1434
  var num_cols = col_n_keys.length;
1425
1435
  var num_rows = row_n_keys.length;
1426
1436
 
1437
+ const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1427
1438
 
1428
1439
  lodash.forEach(col_n_keys, function (col_n_value) {
1429
1440
  var col_ob = {};
1430
1441
  var col_n = col_n_value[0];
1431
1442
  if (col_n != undefined) {
1432
1443
  col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
1433
- col_ob.name = col_n;
1444
+ col_ob.name = col_n === 'DR_Others' ? othersName : col_n;
1434
1445
  col_ob.data = [];
1435
1446
  lodash.forEach(row_n_keys, function (row_n_value) {
1436
1447
  var agg = pivotData.getAggregator(row_n_value, col_n_value);
@@ -1445,7 +1456,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1445
1456
  // }
1446
1457
  }
1447
1458
 
1448
- col_ob.data.push([row_n_value[0], val]);
1459
+ const row_name = row_n_value[0] === 'DR_Others' ? othersName : row_n_value[0];
1460
+ col_ob.data.push([row_name, val]);
1449
1461
  }
1450
1462
  });
1451
1463
  if (col_ob.data.length) {