@datarailsshared/dr_renderer 1.2.277 → 1.2.278

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.277",
3
+ "version": "1.2.278",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -149,6 +149,9 @@ let initDRPivotTable = function($, window, document) {
149
149
  }
150
150
 
151
151
  DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
152
+ const insight = record.insight;
153
+ delete record.insight;
154
+
152
155
  if (useTotalsCalculation) {
153
156
  if (!this.notFirst) {
154
157
  this.keysLength = _.filter(_.keys(record), key => !_.includes(['data_types', 'formats', 'values_formats'], key)).length - 1;
@@ -213,13 +216,12 @@ let initDRPivotTable = function($, window, document) {
213
216
  this.tree[flatRowKey][flatColKey].push(record);
214
217
  }
215
218
 
216
- if (flatRowKey || flatColKey) {
219
+ if (insight && (flatRowKey || flatColKey)) {
217
220
  this.insights.push({
218
221
  colKey: flatColKey,
219
222
  rowKey: flatRowKey,
220
- insight: record.insight || null,
223
+ insight: insight,
221
224
  });
222
- delete record.insight;
223
225
  }
224
226
 
225
227
  return;
@@ -245,6 +247,19 @@ let initDRPivotTable = function($, window, document) {
245
247
  };
246
248
  })(this));
247
249
 
250
+ if (insight) {
251
+ const flatRowKeyForInsight = rowKey.join(delim);
252
+ const flatColKeyForInsight = colKey.join(delim);
253
+
254
+ if (flatRowKeyForInsight || flatColKeyForInsight) {
255
+ this.insights.push({
256
+ colKey: flatColKeyForInsight,
257
+ rowKey: flatRowKeyForInsight,
258
+ insight: insight,
259
+ });
260
+ }
261
+ }
262
+
248
263
  m = rowKey.length - 1;
249
264
  n = colKey.length - 1;
250
265
  if (m < 0 || n < 0) {