@datarailsshared/dr_renderer 1.2.108 → 1.2.111
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 +9 -5
- package/src/highcharts_renderer.js +21 -7
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -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
|
}
|
|
@@ -242,7 +242,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
242
242
|
|
|
243
243
|
highchartsRenderer.createFilterObject = function (value) {
|
|
244
244
|
var filtOb = {};
|
|
245
|
-
if ((value.values && value.values.datetype && value.values.datetype != 'list') ||
|
|
245
|
+
if ((value.values && value.values.datetype && value.values.datetype != 'list') ||
|
|
246
|
+
(value.datetypevalues && value.datetypevalues.datetype != 'list') ||
|
|
247
|
+
(value.values && value.values.type === 'advanced')) {
|
|
246
248
|
filtOb.values = value.datetypevalues || value.values;
|
|
247
249
|
filtOb.is_excluded = false;
|
|
248
250
|
} else if (value.excludes) {
|
|
@@ -467,8 +469,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
467
469
|
if (!cols && is_drill_down_pie) {
|
|
468
470
|
cols = this.point.name;
|
|
469
471
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
+
|
|
473
|
+
var drOthersInColumn = lodash.find(pivotData.getColKeys(), keys => keys.length && keys.includes('DR_Others')) || [];
|
|
474
|
+
if (!lodash.isArray(cols) && drOthersInColumn[0] !== 'DR_Others') {
|
|
472
475
|
cols = [cols];
|
|
473
476
|
}
|
|
474
477
|
|
|
@@ -1385,8 +1388,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1385
1388
|
var num_cols = col_n_keys.length;
|
|
1386
1389
|
var num_rows = row_n_keys.length;
|
|
1387
1390
|
|
|
1391
|
+
const isOthersIncludedInRow = num_rows === 1 && row_n_keys[0].includes('DR_Others');
|
|
1392
|
+
const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
|
|
1393
|
+
|
|
1388
1394
|
lodash.forEach(col_n_keys, function (col_n_value) {
|
|
1389
|
-
|
|
1395
|
+
const row_n_value = isOthersIncludedInRow ? row_n_keys[0] : [];
|
|
1396
|
+
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
1390
1397
|
var val = agg.value();
|
|
1391
1398
|
var key = col_n_value;
|
|
1392
1399
|
|
|
@@ -1400,6 +1407,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1400
1407
|
if (lodash.isEmpty(String(ob.name))) {
|
|
1401
1408
|
ob.name = "[blank]";
|
|
1402
1409
|
}
|
|
1410
|
+
|
|
1411
|
+
if (ob.name === 'DR_Others') {
|
|
1412
|
+
ob.name = othersName;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1403
1415
|
ob.y = val;
|
|
1404
1416
|
if (!isNaN(key))
|
|
1405
1417
|
key = Number(key)
|
|
@@ -1424,13 +1436,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1424
1436
|
var num_cols = col_n_keys.length;
|
|
1425
1437
|
var num_rows = row_n_keys.length;
|
|
1426
1438
|
|
|
1439
|
+
const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
|
|
1427
1440
|
|
|
1428
1441
|
lodash.forEach(col_n_keys, function (col_n_value) {
|
|
1429
1442
|
var col_ob = {};
|
|
1430
1443
|
var col_n = col_n_value[0];
|
|
1431
1444
|
if (col_n != undefined) {
|
|
1432
1445
|
col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
|
|
1433
|
-
col_ob.name = col_n;
|
|
1446
|
+
col_ob.name = col_n === 'DR_Others' ? othersName : col_n;
|
|
1434
1447
|
col_ob.data = [];
|
|
1435
1448
|
lodash.forEach(row_n_keys, function (row_n_value) {
|
|
1436
1449
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
@@ -1445,7 +1458,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1445
1458
|
// }
|
|
1446
1459
|
}
|
|
1447
1460
|
|
|
1448
|
-
|
|
1461
|
+
const row_name = row_n_value[0] === 'DR_Others' ? othersName : row_n_value[0];
|
|
1462
|
+
col_ob.data.push([row_name, val]);
|
|
1449
1463
|
}
|
|
1450
1464
|
});
|
|
1451
1465
|
if (col_ob.data.length) {
|
|
@@ -5145,7 +5159,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5145
5159
|
|
|
5146
5160
|
highchartsRenderer.getDefaultValueForSubOptions = function (type, existing_options) {
|
|
5147
5161
|
var valToReturn = {};
|
|
5148
|
-
var option = highchartsRenderer.suboptions[type];
|
|
5162
|
+
var option = highchartsRenderer.suboptions[type] || lodash.find(highchartsRenderer.suboptions, suboption => suboption.category_type === type);
|
|
5149
5163
|
if (option) {
|
|
5150
5164
|
lodash.forEach(option.elements, function (elem) {
|
|
5151
5165
|
if (existing_options && lodash.has(existing_options, type + '.' + elem.value_name)) {
|