@datarailsshared/dr_renderer 1.2.71 → 1.2.75

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.71",
3
+ "version": "1.2.75",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -497,6 +497,13 @@ var DataFormatterImpl = function () {
497
497
  var minutes = n.getMinutes();
498
498
  var seconds = n.getSeconds();
499
499
 
500
+ var adjustMinutesValue = function(minutes) {
501
+ if (minutes < 10) {
502
+ return '0' + minutes;
503
+ }
504
+ return minutes;
505
+ }
506
+
500
507
  // Build res
501
508
  var res = pattern.replace(/((?:am\/pm)|(?:a\/p))|(?:(h[^ydsap]*?)mm)|(?:mm([^ydh]*?s))|(?:(h[^ydsap]*?)m)|(?:m([^ydh]*?s))/gi, function (a, ampm, fmin, fmin2, mmin, mmin2) {
502
509
 
@@ -506,11 +513,11 @@ var DataFormatterImpl = function () {
506
513
  }
507
514
 
508
515
  if (fmin) {
509
- return fmin + _this3.applyNumberPattern(minutes, '00');
516
+ return fmin + _this3.applyNumberPattern(adjustMinutesValue(minutes), '00');
510
517
  }
511
518
 
512
519
  if (fmin2) {
513
- return _this3.applyNumberPattern(minutes, '00') + fmin2;
520
+ return _this3.applyNumberPattern(adjustMinutesValue(minutes), '00') + fmin2;
514
521
  }
515
522
 
516
523
  if (mmin) {
@@ -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 = _.keys(record).length - 1;
149
+ this.keysLength = _.filter(_.keys(record), key => !['data_types', 'formats', 'values_formats'].includes(key)).length - 1;
150
150
  this.notFirst = true;
151
151
  }
152
152
  let getRowAggregator = (function(_this) {
@@ -465,7 +465,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
465
465
  rows = temp;
466
466
  }
467
467
 
468
- if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.show_percentage) {
468
+ if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.percentage) {
469
+ return (Math.round((this.y / this.total) * 10000) / 100) + '%';
470
+ } else if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.show_percentage) {
469
471
  let aggrPercentages = pivotData.getAggregator(rows, [])
470
472
  let total = aggrPercentages.value()
471
473
  percentages = total ? ' (' + Math.round(value/total * 100) + '%)' : '';
@@ -88,9 +88,7 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
88
88
  }
89
89
  }
90
90
 
91
- publishedItemsRenderer.changedAutoResize = function (new_auto_resize, options, window, document) {
92
- if (options.autoResize !== new_auto_resize) {
93
- options.autoResize = new_auto_resize;
91
+ publishedItemsRenderer.changedAutoResize = function (options, window, document) {
94
92
  if (!options.autoResize) {
95
93
  publishedItemsRenderer.resetTableZoom(document);
96
94
  } else {
@@ -100,7 +98,6 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
100
98
  }, 100);
101
99
  }
102
100
  }
103
- }
104
101
  }
105
102
 
106
103
  publishedItemsRenderer.changedInputValue = function (firstTime, scope, options) {