@datarailsshared/dr_renderer 1.2.294 → 1.2.296

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.294",
3
+ "version": "1.2.296",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -171,10 +171,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
171
171
  }
172
172
  lodash.assign(highchartsRenderer, HIGHCHARTS_CONSTANTS);
173
173
 
174
- let useTotalsCalculation = false;
174
+ highchartsRenderer.useTotalsCalculation = false;
175
175
  let disableAnimation = false;
176
176
  if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
177
- useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
177
+ highchartsRenderer.useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
178
178
  disableAnimation = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.disable_animation
179
179
  }
180
180
 
@@ -687,8 +687,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
687
687
  stickOnContact: true,
688
688
  hideDelay: 1500,
689
689
  formatter: function () {
690
- const rowKey = pivotData.rowAttrs.length ? _.get(this.point, 'series.name') || "" : "";
691
- const colKey = _.get(this.point, 'name') || this.x.name[0] || "";
690
+ const rowKey = pivotData.rowAttrs.length ? lodash.get(this.point, 'series.name') || "" : "";
691
+ const colKey = lodash.get(this.point, 'name') || this.x.name[0] || "";
692
692
  const insight = pivotData.getInsight(colKey, rowKey) || {};
693
693
  setTimeout(() => {
694
694
  var aggr = highchartsRenderer.defaultFormatterToTooltip(pivotData, opts);
@@ -1598,7 +1598,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1598
1598
  if (value.trend === 'total') {
1599
1599
  keys = value.key;
1600
1600
  } else {
1601
- _.forEach(value.key, (item) => {
1601
+ lodash.forEach(value.key, (item) => {
1602
1602
  const findKeyByValue = lodash.find(
1603
1603
  Object.keys(pivotData.dateValuesDictionary || {}),
1604
1604
  key => pivotData.dateValuesDictionary[key] === item
@@ -3579,7 +3579,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3579
3579
  chartOptions.legend.useHTML = true;
3580
3580
  chartOptions.legend.labelFormatter = function() {
3581
3581
  const name = this.name;
3582
- const findTotal = _.find(this.options.data, {isTotal: true});
3582
+ const findTotal = lodash.find(this.options.data, {isTotal: true});
3583
3583
  const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3584
3584
  return `<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: ${color};
3585
3585
  width: 12px; height: 12px; border-radius: 50%"></span>
@@ -3699,7 +3699,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3699
3699
  chartOptions.legend.useHTML = true;
3700
3700
  chartOptions.legend.labelFormatter = function() {
3701
3701
  const name = this.options.className ? 'Total': this.name;
3702
- const findTotal = _.find(this.options.data, {isTotal: true});
3702
+ const findTotal = lodash.find(this.options.data, {isTotal: true});
3703
3703
  const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3704
3704
  return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
3705
3705
  }
@@ -3883,7 +3883,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3883
3883
  this.ignoreValue = true;
3884
3884
  }
3885
3885
 
3886
- if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
3886
+ if (highchartsRenderer.useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
3887
3887
  return this.sum = parseFloat(record[attr]);
3888
3888
  } else if (!isNaN(parseFloat(record[attr]))) {
3889
3889
  return this.sum += parseFloat(record[attr]);
@@ -4037,7 +4037,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4037
4037
  this.ignoreValue = true;
4038
4038
  }
4039
4039
 
4040
- if (useTotalsCalculation) {
4040
+ if (highchartsRenderer.useTotalsCalculation) {
4041
4041
  return this.sum = val;
4042
4042
  } else {
4043
4043
  return this.sum += val;
@@ -4125,7 +4125,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4125
4125
  if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
4126
4126
  this.ignoreValue = true;
4127
4127
  }
4128
- if (useTotalsCalculation) {
4128
+ if (highchartsRenderer.useTotalsCalculation) {
4129
4129
  return this.val = x;
4130
4130
  } else {
4131
4131
  return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
@@ -4212,11 +4212,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4212
4212
  this.ignoreValue = true;
4213
4213
  }
4214
4214
 
4215
- if (useTotalsCalculation) {
4215
+ if (highchartsRenderer.useTotalsCalculation) {
4216
4216
  return this.val = x;
4217
4217
  } else {
4218
- return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
4219
- } }
4218
+ return this.val = Math.max(x, (ref = this.val) != null ? ref : x);
4219
+ }
4220
+ }
4220
4221
  },
4221
4222
  value: function () {
4222
4223
  if (this.ignoreValue) {
@@ -4300,7 +4301,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4300
4301
  }
4301
4302
 
4302
4303
 
4303
- if (useTotalsCalculation) {
4304
+ if (highchartsRenderer.useTotalsCalculation) {
4304
4305
  this.sum = parseFloat(x);
4305
4306
  } else {
4306
4307
  this.sum += parseFloat(x);
@@ -4313,7 +4314,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4313
4314
  if (this.ignoreValue) {
4314
4315
  return null;
4315
4316
  }
4316
- if (useTotalsCalculation) {
4317
+ if (highchartsRenderer.useTotalsCalculation) {
4317
4318
  return this.sum;
4318
4319
  }
4319
4320
  return this.sum / this.len;
@@ -4935,7 +4936,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4935
4936
  }
4936
4937
 
4937
4938
  if (typeof (value) != 'number') {
4938
- const drAdditionalField = _.find($.pivotUtilities.additionalFieldsList, {key: value});
4939
+ const drAdditionalField = lodash.find($.pivotUtilities.additionalFieldsList, {key: value});
4939
4940
  if (drAdditionalField && drAdditionalField.key)
4940
4941
  return drAdditionalField.key;
4941
4942
 
@@ -8044,8 +8045,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8044
8045
  };
8045
8046
  }
8046
8047
  } else {
8047
- if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date'
8048
- && fieldFilter.datetypevalues && fieldFilter.datetypevalues) {
8048
+ if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date' && fieldFilter.datetypevalues) {
8049
8049
  if (fieldFilter.datetypevalues.datetype === "frame") {
8050
8050
  displayname += ` (${fieldFilter.datetypevalues.val.timeframe})`;
8051
8051
  } else if (fieldFilter.datetypevalues.datetype === "range") {
@@ -8057,7 +8057,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8057
8057
  // range timestamps currently are set presupposing that user selects UTC dates,
8058
8058
  // that is why for consistency we also should show in filters values which user selected
8059
8059
  // and not local dates, that can differ
8060
- _.forEach(Object.keys(dates), key => {
8060
+ lodash.forEach(Object.keys(dates), key => {
8061
8061
  const dateConfiguration = dates[key];
8062
8062
  const timestamp = dateConfiguration.timestamp;
8063
8063
  if (timestamp) {
@@ -8123,7 +8123,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8123
8123
  highchartsRenderer.getDashboardOverrideValues = function (data_model, graph, local_current_dashboard) {
8124
8124
  let overrideValues = [];
8125
8125
 
8126
- if (!local_current_dashboard == undefined) {
8126
+ if (!local_current_dashboard) {
8127
8127
  local_current_dashboard = data_model.current_dashboard;
8128
8128
  }
8129
8129
 
@@ -8199,11 +8199,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8199
8199
  local_current_dashboard = data_model.current_dashboard;
8200
8200
  }
8201
8201
 
8202
- if (local_current_dashboard.date_tags.length > 0) {
8202
+ if (local_current_dashboard.date_tags && local_current_dashboard.date_tags.length > 0) {
8203
8203
  return 'date_tags';
8204
8204
  }
8205
8205
 
8206
- if (local_current_dashboard.plan_tags.length > 0) {
8206
+ if (local_current_dashboard.plan_tags && local_current_dashboard.plan_tags.length > 0) {
8207
8207
  return 'plan_tags';
8208
8208
  }
8209
8209
  };
@@ -8229,7 +8229,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8229
8229
  };
8230
8230
 
8231
8231
  highchartsRenderer.getDashboardApplyScenarios = function (data_model, graph, local_current_dashboard) {
8232
- if (!local_current_dashboard == undefined) {
8232
+ if (local_current_dashboard == undefined) {
8233
8233
  local_current_dashboard = data_model.current_dashboard;
8234
8234
  }
8235
8235
 
@@ -8255,7 +8255,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8255
8255
  };
8256
8256
 
8257
8257
  highchartsRenderer.isDate = function (date) {
8258
- return ((new Date(date) !== "Invalid Date" && !isNaN(new Date(date))));
8258
+ return new Date(date) !== "Invalid Date" && !isNaN(new Date(date));
8259
8259
  };
8260
8260
 
8261
8261
  highchartsRenderer.isDateFormat = function (datestr, format) {
@@ -8263,7 +8263,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8263
8263
  };
8264
8264
 
8265
8265
  highchartsRenderer.containsIgnoreCase = function (str, it) {
8266
- return str.toLowerCase().indexOf(it) != -1;
8266
+ return str.toLowerCase().indexOf(it.toLowerCase()) != -1;
8267
8267
  };
8268
8268
 
8269
8269
  highchartsRenderer.createDateTypeFromValue = function (fieldnametoFilter, format, colName) {
@@ -8630,7 +8630,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8630
8630
  };
8631
8631
 
8632
8632
  highchartsRenderer.setNewFieldNames = function (res) {
8633
- if (useTotalsCalculation) {
8633
+ if (highchartsRenderer.useTotalsCalculation) {
8634
8634
  return res;
8635
8635
  }
8636
8636
 
@@ -9099,7 +9099,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9099
9099
 
9100
9100
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
9101
9101
  const aggregationConfig = widget.options && widget.options.date_aggregation_configs
9102
- ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
9102
+ ? lodash.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
9103
9103
  : null;
9104
9104
 
9105
9105
  if (aggregationConfig && aggregationConfig.aggregate_by && aggregationConfig.is_formatting_by_aggregation_method) {
@@ -9173,7 +9173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9173
9173
  rowData.splice(rowIndex, 1);
9174
9174
  } else {
9175
9175
  const totalRow = {};
9176
- _.forEach(categoryFields, (field, fieldKey) => {
9176
+ lodash.forEach(categoryFields, (field, fieldKey) => {
9177
9177
  totalRow[field.name] = value.key[fieldKey];
9178
9178
  });
9179
9179
  totalRow[valueField.name] = sum;
@@ -9231,7 +9231,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9231
9231
  });
9232
9232
  }
9233
9233
 
9234
-
9235
9234
  highchartsRenderer.getFiscalYearMonthModifier = function() {
9236
9235
  return lodash.get(document, 'ReportHippo.user.organization.fiscal_year_starts_from', 1) - 1;
9237
9236
  }