@datarailsshared/dr_renderer 1.2.364 → 1.2.365
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/.circleci/config.yml +2 -2
- package/package.json +1 -1
- package/src/dr_pivottable.js +14 -63
- package/src/highcharts_renderer.js +1094 -1385
- package/src/novix_renderer.js +11 -13
- package/src/pivottable.js +4 -28
- package/tests/highcharts_renderer.test.js +14 -5386
- package/src/dr-renderer-helpers.js +0 -7
- package/tests/dr-renderer-helpers.test.js +0 -34
- package/tests/mock/add-in-dynamic-ranges.json +0 -133
- package/tests/mock/add-in-functions.json +0 -412
- package/tests/mock/add-in-tables.json +0 -347
- package/tests/mock/tables.json +0 -2258
- package/tests/mock/widgets.json +0 -411
package/.circleci/config.yml
CHANGED
@@ -20,7 +20,7 @@ jobs:
|
|
20
20
|
name: Prepare publish version
|
21
21
|
command: |
|
22
22
|
postfix=""
|
23
|
-
if [[ "${CIRCLE_BRANCH}" !=
|
23
|
+
if [[ "${CIRCLE_BRANCH}" != prod ]] ; then
|
24
24
|
postfix="-$CIRCLE_BRANCH"
|
25
25
|
fi
|
26
26
|
|
@@ -70,7 +70,7 @@ workflows:
|
|
70
70
|
filters:
|
71
71
|
branches:
|
72
72
|
only:
|
73
|
-
- /
|
73
|
+
- /prod.*/
|
74
74
|
- /tigers/
|
75
75
|
- /bratans/
|
76
76
|
- /dragons/
|
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
@@ -12,10 +12,6 @@ let initDRPivotTable = function($, window, document) {
|
|
12
12
|
document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
|
13
13
|
// const numberOfRows = 500; // change to activate the handsontable when num of rows bigger then this.
|
14
14
|
|
15
|
-
const isFlatKeyInPivotKeys = function(keys, flatKey) {
|
16
|
-
return keys.some(key => key.join(delim) === flatKey);
|
17
|
-
};
|
18
|
-
|
19
15
|
DRPivotData = (function(superClass) {
|
20
16
|
extend(DRPivotData, superClass);
|
21
17
|
|
@@ -95,7 +91,6 @@ let initDRPivotTable = function($, window, document) {
|
|
95
91
|
|
96
92
|
DRPivotData.prototype.arrSort = function(attrs) {
|
97
93
|
var a, sortersArr;
|
98
|
-
const sortByValueAttrs = this.sortByValueAttrs;
|
99
94
|
sortersArr = (function() {
|
100
95
|
var l, len1, results;
|
101
96
|
results = [];
|
@@ -105,21 +100,11 @@ let initDRPivotTable = function($, window, document) {
|
|
105
100
|
}
|
106
101
|
return results;
|
107
102
|
}).call(this);
|
108
|
-
|
109
103
|
return function(a, b) {
|
110
104
|
var comparison, i, sorter;
|
111
105
|
for (i in sortersArr) {
|
112
|
-
|
113
|
-
|
114
|
-
if (sortByValueAttrs.indexOf(attrs[index]) !== -1) {
|
115
|
-
|
116
|
-
// For case current Field attrs[index] is sorted by value we are concatenating values passed to sorter function
|
117
|
-
// Concatenation is done from first field in a block (first axis or first series) until current field index.
|
118
|
-
// Cause for this case sorting will be as list of these concatenated strings (which is prepared in getSortingByValueOrderList)
|
119
|
-
comparison = sorter(a.slice(0, index + 1).join(','), b.slice(0, index + 1).join(','));
|
120
|
-
} else {
|
121
|
-
comparison = sorter(a[index], b[index]);
|
122
|
-
}
|
106
|
+
sorter = sortersArr[i];
|
107
|
+
comparison = sorter(a[i], b[i]);
|
123
108
|
if (comparison !== 0) {
|
124
109
|
return comparison;
|
125
110
|
}
|
@@ -158,15 +143,7 @@ let initDRPivotTable = function($, window, document) {
|
|
158
143
|
return key;
|
159
144
|
};
|
160
145
|
|
161
|
-
DRPivotData.prototype.getInsight = function(colKey, rowKey) {
|
162
|
-
const insightInfo = _.find(this.insights, insight => insight.colKey === colKey && insight.rowKey === rowKey);
|
163
|
-
return _.get(insightInfo, 'insight', null);
|
164
|
-
}
|
165
|
-
|
166
146
|
DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
|
167
|
-
const insight = record.insight;
|
168
|
-
delete record.insight;
|
169
|
-
|
170
147
|
if (useTotalsCalculation) {
|
171
148
|
if (!this.notFirst) {
|
172
149
|
this.keysLength = _.filter(_.keys(record), key => !_.includes(['data_types', 'formats', 'values_formats'], key)).length - 1;
|
@@ -203,10 +180,10 @@ let initDRPivotTable = function($, window, document) {
|
|
203
180
|
let flatColKey = colKey.join(delim);
|
204
181
|
|
205
182
|
if (this.keysLength === rowKey.length + colKey.length) {
|
206
|
-
if (!this.
|
183
|
+
if (!this.rowKeys.some(rKey => rKey.join(delim) === flatRowKey)) {
|
207
184
|
this.rowKeys.push(rowKey);
|
208
185
|
}
|
209
|
-
if (!this.
|
186
|
+
if (!this.colKeys.some(cKey => cKey.join(delim) === flatColKey)) {
|
210
187
|
this.colKeys.push(colKey);
|
211
188
|
}
|
212
189
|
}
|
@@ -230,14 +207,6 @@ let initDRPivotTable = function($, window, document) {
|
|
230
207
|
this.tree[flatRowKey][flatColKey] = this.aggregator(this, rowKey, colKey);
|
231
208
|
this.tree[flatRowKey][flatColKey].push(record);
|
232
209
|
}
|
233
|
-
|
234
|
-
if (insight && (flatRowKey || flatColKey)) {
|
235
|
-
this.insights.push({
|
236
|
-
colKey: flatColKey,
|
237
|
-
rowKey: flatRowKey,
|
238
|
-
insight: insight,
|
239
|
-
});
|
240
|
-
}
|
241
210
|
return;
|
242
211
|
}
|
243
212
|
|
@@ -261,19 +230,6 @@ let initDRPivotTable = function($, window, document) {
|
|
261
230
|
};
|
262
231
|
})(this));
|
263
232
|
|
264
|
-
if (insight) {
|
265
|
-
const flatRowKeyForInsight = rowKey.join(delim);
|
266
|
-
const flatColKeyForInsight = colKey.join(delim);
|
267
|
-
|
268
|
-
if (flatRowKeyForInsight || flatColKeyForInsight) {
|
269
|
-
this.insights.push({
|
270
|
-
colKey: flatColKeyForInsight,
|
271
|
-
rowKey: flatRowKeyForInsight,
|
272
|
-
insight: insight,
|
273
|
-
});
|
274
|
-
}
|
275
|
-
}
|
276
|
-
|
277
233
|
m = rowKey.length - 1;
|
278
234
|
n = colKey.length - 1;
|
279
235
|
if (m < 0 || n < 0) {
|
@@ -515,11 +471,8 @@ let initDRPivotTable = function($, window, document) {
|
|
515
471
|
return resultsArr;
|
516
472
|
} else {
|
517
473
|
let tooMuch = false;
|
518
|
-
|
519
|
-
|
520
|
-
(pvtData.rowKeys.length > 1000 || pvtData.colKeys.length > 500) &&
|
521
|
-
(!opts.show_more_function_cols || !opts.show_more_function_cols) &&
|
522
|
-
!show_more_than_thousand_rows) {
|
474
|
+
if (pvtData && (pvtData.rowKeys.length > 1000 || pvtData.colKeys.length > 500) &&
|
475
|
+
(!opts.show_more_function_cols || !opts.show_more_function_cols)) {
|
523
476
|
pvtData.rowKeys = [];
|
524
477
|
pvtData.colKeys = [];
|
525
478
|
tooMuch = true;
|
@@ -923,7 +876,7 @@ let initDRPivotTable = function($, window, document) {
|
|
923
876
|
return string_val;
|
924
877
|
};
|
925
878
|
|
926
|
-
processKeys = function(keysArr, className, dimention, attrs
|
879
|
+
processKeys = function(keysArr, className, dimention, attrs) {
|
927
880
|
for (let i = 0; i < keysArr.length; i++) {
|
928
881
|
const additionalField = _.find(additionalFieldsList, {key: keysArr[i][0]})
|
929
882
|
|
@@ -944,7 +897,7 @@ let initDRPivotTable = function($, window, document) {
|
|
944
897
|
lastCol = 0;
|
945
898
|
}
|
946
899
|
rMark = [];
|
947
|
-
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(
|
900
|
+
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(keysArr[0][0]) + getSubtotalInBrackets(keysArr, className, lastCol, lastRow, 0, 0)));
|
948
901
|
key = [];
|
949
902
|
key.push(keysArr[0][0]);
|
950
903
|
nodePos = 0;
|
@@ -964,7 +917,7 @@ let initDRPivotTable = function($, window, document) {
|
|
964
917
|
rMark[0] = node;
|
965
918
|
c = 1;
|
966
919
|
while (c <= lastCol) {
|
967
|
-
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(
|
920
|
+
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(keysArr[0][c]) + getSubtotalInBrackets(keysArr, className, lastCol, lastRow, 0, c)));
|
968
921
|
key = key.slice();
|
969
922
|
key.push(keysArr[0][c]);
|
970
923
|
++nodePos;
|
@@ -1030,7 +983,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1030
983
|
}
|
1031
984
|
|
1032
985
|
|
1033
|
-
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(
|
986
|
+
th = createElement("th", className, valueNoDashes(encodeHtmlEntities(keysArr[r][c]) + getSubtotalInBrackets(keysArr, className, lastCol, lastRow, r, c)));
|
1034
987
|
++nodePos;
|
1035
988
|
node = {
|
1036
989
|
node: nodePos,
|
@@ -2454,7 +2407,7 @@ let initDRPivotTable = function($, window, document) {
|
|
2454
2407
|
return Array.from(wrapper.querySelectorAll(selectString));
|
2455
2408
|
}
|
2456
2409
|
|
2457
|
-
main = function(rowAttrs, rowKeys, colAttrs, colKeys
|
2410
|
+
main = function(rowAttrs, rowKeys, colAttrs, colKeys) {
|
2458
2411
|
var c,rowspan, colHeaderCols, colHeaderHeaders, colHeaders, h, k, l, len, len1, result, rowHeaderHeaders, rowHeaderRows, rowHeaders, tbody, thead, tr;
|
2459
2412
|
rowHeaders = [];
|
2460
2413
|
colHeaders = [];
|
@@ -2463,12 +2416,10 @@ let initDRPivotTable = function($, window, document) {
|
|
2463
2416
|
colHeaderHeaders = [];
|
2464
2417
|
colHeaderCols = [];
|
2465
2418
|
if (rowAttrs.length > 0 && rowKeys.length > 0) {
|
2466
|
-
|
2467
|
-
rowHeaders = processKeys(rowKeys, "pvtRowLabel", 'rows', rowAttrs, formattedKeys);
|
2419
|
+
rowHeaders = processKeys(rowKeys, "pvtRowLabel", 'rows', rowAttrs);
|
2468
2420
|
}
|
2469
2421
|
if (colAttrs.length > 0 && colKeys.length > 0) {
|
2470
|
-
|
2471
|
-
colHeaders = processKeys(colKeys, "pvtColLabel", 'cols', colAttrs, formattedKeys);
|
2422
|
+
colHeaders = processKeys(colKeys, "pvtColLabel", 'cols', colAttrs);
|
2472
2423
|
}
|
2473
2424
|
var tableClasses = ['pvtTable'];
|
2474
2425
|
if (opts.chartOptions.table_options.use_new_table_design) {
|
@@ -2613,7 +2564,7 @@ let initDRPivotTable = function($, window, document) {
|
|
2613
2564
|
|
2614
2565
|
return wrapper;
|
2615
2566
|
};
|
2616
|
-
return main(rowAttrs, rowKeys, colAttrs, colKeys
|
2567
|
+
return main(rowAttrs, rowKeys, colAttrs, colKeys);
|
2617
2568
|
};
|
2618
2569
|
// $.pivotUtilities.subtotal_renderers = SubtotalRenderer;
|
2619
2570
|
$.pivotUtilities.subtotal_renderers = NovixRenderer;
|