@datarailsshared/dr_renderer 1.2.52 → 1.2.53

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.52",
3
+ "version": "1.2.53",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -3,7 +3,7 @@ let initDRPivotTable = function($, window, document) {
3
3
  var slice = [].slice;
4
4
  var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
5
 
6
- var DRPivotData, sortDateStrings, getSort, processKey, SubtotalRenderer, getFormattedNumber, largeToSmallSort, NovixRenderer;
6
+ var DRPivotData, sortDateStrings, getSort, processKey, SubtotalRenderer, getFormattedNumber, largeToSmallSort, largeToSmallSortByAbsolute, NovixRenderer;
7
7
 
8
8
  var delim = " , ";
9
9
  const newTableColors = ['rgb(127, 196, 255)', 'rgb(200, 243,243)', 'rgb(247, 161, 173)', 'rgb(255, 237, 178)', 'rgb(221, 239, 255)',
@@ -155,7 +155,7 @@ let initDRPivotTable = function($, window, document) {
155
155
  totals[flatKey].push(record);
156
156
  }
157
157
  }
158
- if (addKey) {
158
+ if (addKey && key.length === attrs.length) {
159
159
  keys.push(key);
160
160
  }
161
161
  return key;
@@ -180,13 +180,13 @@ let initDRPivotTable = function($, window, document) {
180
180
  if (!colKey.length && !rowKey.length) {
181
181
  this.allTotal.push(record);
182
182
  }
183
- if (!colKey.length && rowKey.length === 1) {
184
- this.rowTotals[rowKey[0]].push(record);
185
- this.rowTotals[rowKey[0]].isChangeable = true;
183
+ if (!colKey.length && rowKey.length) {
184
+ this.rowTotals[rowKey.join(delim)].push(record);
185
+ this.rowTotals[rowKey.join(delim)].isChangeable = true;
186
186
  }
187
- if (!rowKey.length && colKey.length === 1) {
188
- this.colTotals[colKey[0]].push(record);
189
- this.colTotals[colKey[0]].isChangeable = true;
187
+ if (!rowKey.length && colKey.length) {
188
+ this.colTotals[colKey.join(delim)].push(record);
189
+ this.colTotals[colKey.join(delim)].isChangeable = true;
190
190
  }
191
191
  } else {
192
192
  this.allTotal.push(record);
@@ -340,7 +340,11 @@ let initDRPivotTable = function($, window, document) {
340
340
  };
341
341
  };
342
342
 
343
- largeToSmallSort = function(as, bs) {
343
+ largeToSmallSortByAbsolute = function (as, bs) {
344
+ return largeToSmallSort(as , bs, true);
345
+ }
346
+
347
+ largeToSmallSort = function(as, bs, is_abs = false) {
344
348
  var a, a1, b, b1, rd, rx, rz;
345
349
  rx = /(\d+)|(\D+)/g;
346
350
  rd = /\d/;
@@ -352,6 +356,11 @@ let initDRPivotTable = function($, window, document) {
352
356
  if (isNaN(bs)) {
353
357
  return 1;
354
358
  }
359
+
360
+ if (is_abs) {
361
+ return Math.abs(bs) - Math.abs(as);
362
+ }
363
+
355
364
  return bs - as;
356
365
  }
357
366
  a = String(as).toLowerCase();
@@ -2217,6 +2226,7 @@ let initDRPivotTable = function($, window, document) {
2217
2226
  $.pivotUtilities.getFormattedNumber = getFormattedNumber;
2218
2227
  $.pivotUtilities.sortDateStrings = sortDateStrings;
2219
2228
  $.pivotUtilities.largeToSmallSort = largeToSmallSort;
2229
+ $.pivotUtilities.largeToSmallSortByAbsolute = largeToSmallSortByAbsolute;
2220
2230
  $.pivotUtilities.getPivotDataModel = function(input, opts){ return new DRPivotData(input, opts); }
2221
2231
  $.pivotUtilities.getPivotTableFormula = function(rowData, opts, func, colFields, rowFields, aggregationDefaults, utils) {
2222
2232
  let totalStr = 'Grand Totals';
@@ -3879,11 +3879,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3879
3879
  pivotData.sorters = new_sorting_function;
3880
3880
  }
3881
3881
 
3882
- if (totalFilters && totalFilters.filter_options) {
3883
- result = highchartsRenderer.generateFilteredResult(totalFilters, optsFiltered, rowData, opts, pivotData);
3884
- } else {
3885
- result = opts.renderer(pivotData, opts.rendererOptions);
3886
- }
3882
+ result = opts.renderer(pivotData, opts.rendererOptions);
3887
3883
  } catch (_error) {
3888
3884
  e = _error;
3889
3885
  if (typeof console !== "undefined" && console !== null) {
@@ -4834,6 +4830,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4834
4830
  value_name: 'remove_underscores',
4835
4831
  default_value: true
4836
4832
  },
4833
+ {
4834
+ element_type: 'checkbox',
4835
+ element_label: 'Use big data table',
4836
+ value_name: 'use_handsOnTable',
4837
+ default_value: false
4838
+ },
4837
4839
  {
4838
4840
  element_type: 'checkbox',
4839
4841
  element_label: 'Use new table design',
@@ -5385,12 +5387,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5385
5387
  element_type: 'checkbox',
5386
5388
  element_label: 'Sort by variance',
5387
5389
  value_name: 'sort_by_variance',
5388
- default_value: false
5390
+ default_value: false,
5391
+ hidden: true
5389
5392
  }, {
5390
5393
  element_type: 'checkbox',
5391
5394
  element_label: 'Sort by absolute variance',
5392
5395
  value_name: 'sort_by_absolute_variance',
5393
- default_value: false
5396
+ default_value: false,
5397
+ hidden: true
5394
5398
  }]
5395
5399
  },
5396
5400
  'delta_column_for_drill_down': {
@@ -5456,12 +5460,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5456
5460
  element_type: 'checkbox',
5457
5461
  element_label: 'Sort by variance',
5458
5462
  value_name: 'sort_by_variance',
5459
- default_value: false
5463
+ default_value: false,
5464
+ hidden: true
5460
5465
  }, {
5461
5466
  element_type: 'checkbox',
5462
5467
  element_label: 'Sort by absolute variance',
5463
5468
  value_name: 'sort_by_absolute_variance',
5464
- default_value: false
5469
+ default_value: false,
5470
+ hidden: true
5465
5471
  }, {
5466
5472
  element_type: 'checkbox',
5467
5473
  element_label: 'Filter zero values',
@@ -6661,6 +6667,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6661
6667
  };
6662
6668
 
6663
6669
  highchartsRenderer.setNewFieldNames = function (res) {
6670
+ if (useTotalsCalculation) {
6671
+ return res;
6672
+ }
6673
+
6664
6674
  if (res && res[0] && res[0]['DR_Values']) {
6665
6675
  lodash.forEach(res, function (item) {
6666
6676
  item['DR_Values'] = highchartsRenderer.getFieldName(item['DR_Values']);
@@ -6742,7 +6752,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6742
6752
  "name": field.name,
6743
6753
  "type": field.type,
6744
6754
  "values": [],
6745
- "sorting": field.sorting
6755
+ "sorting": field.sorting,
6746
6756
  });
6747
6757
  }
6748
6758
  } else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
@@ -6827,6 +6837,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6827
6837
  if (field.sorting && field.sorting.type == "DateString") {
6828
6838
  return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
6829
6839
  } else if (field.sorting && field.sorting.type == "largestToSmallest") {
6840
+ if (field.sorting.is_absolute)
6841
+ return $.pivotUtilities.largeToSmallSortByAbsolute;
6842
+
6830
6843
  return $.pivotUtilities.largeToSmallSort;
6831
6844
  } else {
6832
6845
  return $.pivotUtilities.sortAs(field.values);