@datarailsshared/dr_renderer 1.2.44-beta → 1.2.46-beta
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 +1 -1
- package/src/dr_pivottable.js +8 -5
- package/src/highcharts_renderer.js +103 -10
- package/src/pivottable.js +49 -4
- package/src/published_items_renderer.js +6 -8
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -161,11 +161,11 @@ let initDRPivotTable = function($, window, document) {
|
|
|
161
161
|
return key;
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
DRPivotData.prototype.processRecord = function(record,
|
|
164
|
+
DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
|
|
165
165
|
var colKey, fColKey, fRowKey, flatColKey, flatRowKey, i, j, k, m, n, ref, results, rowKey;
|
|
166
166
|
rowKey = [];
|
|
167
167
|
colKey = [];
|
|
168
|
-
if (
|
|
168
|
+
if (useTotalsCalculation) {
|
|
169
169
|
rowKey = newProcessKey(record, this.rowTotals, this.rowKeys, this.rowAttrs, (function(_this) {
|
|
170
170
|
return function(key) {
|
|
171
171
|
return _this.aggregator(_this, key, []);
|
|
@@ -439,12 +439,13 @@ let initDRPivotTable = function($, window, document) {
|
|
|
439
439
|
pvtData.colKeys = [];
|
|
440
440
|
tooMuch = true;
|
|
441
441
|
opts.error_has_occurred = true;
|
|
442
|
+
opts.error_params = $.pivotUtilities.errorHandling.placeholders.tooMuchData;
|
|
442
443
|
}
|
|
443
|
-
return SubtotalRenderer(pvtData, opts, charttype, tooMuch);
|
|
444
|
+
return SubtotalRenderer(pvtData, opts, charttype, tooMuch, opts.error_params);
|
|
444
445
|
}
|
|
445
446
|
}
|
|
446
447
|
|
|
447
|
-
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false) {
|
|
448
|
+
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
|
|
448
449
|
var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colAttrs, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, getSubtotalInBrackets, processKeys, encodeHtmlEntities, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, setAttributes, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree, assumptionSubscribe;
|
|
449
450
|
var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
|
|
450
451
|
var edit_assumptions;
|
|
@@ -2187,7 +2188,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2187
2188
|
}
|
|
2188
2189
|
|
|
2189
2190
|
if (tooMuch) {
|
|
2190
|
-
|
|
2191
|
+
const defaultPlaceholder = $('<div class="noData"><i class="fa fa-info"></i> There are too many rows to display in the table.<br>Please filter or change the table type in options.</div>');
|
|
2192
|
+
|
|
2193
|
+
resultsArr.push($.pivotUtilities.errorHandling.getErrorPlaceholder(error_params, useNewUx) || defaultPlaceholder);
|
|
2191
2194
|
} else {
|
|
2192
2195
|
var tableContainer = document.createElement("div");
|
|
2193
2196
|
tableContainer.className = "pivot-div";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
|
|
2
2
|
DataFormatter, lodash, moment_lib) {
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let useNewUx = false;
|
|
5
|
+
let useTotalsCalculation = false;
|
|
6
|
+
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
|
7
|
+
useTotalsCalculation = _.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
|
8
|
+
useNewUx = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
|
|
9
|
+
}
|
|
6
10
|
const textColor = "#151a41";
|
|
7
11
|
const chartLabelColor = "#cfd7dd";
|
|
8
12
|
|
|
@@ -721,9 +725,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
721
725
|
}
|
|
722
726
|
|
|
723
727
|
if (to_match) {
|
|
724
|
-
resultsArr.push(
|
|
728
|
+
resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.tooMuchData));
|
|
725
729
|
} else {
|
|
726
|
-
resultsArr.push(
|
|
730
|
+
resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.nodata));
|
|
727
731
|
}
|
|
728
732
|
|
|
729
733
|
temp_result.html(resultsArr);
|
|
@@ -731,6 +735,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
731
735
|
return temp_result;
|
|
732
736
|
};
|
|
733
737
|
|
|
738
|
+
highchartsRenderer.getWidgetPlaceholder = function(placeholder) {
|
|
739
|
+
const defaultPlaceholder = $('<div class="noData"><i class="' + (useNewUx ? 'noData-image' : 'fa fa-info') + '"></i> no data</div>');
|
|
740
|
+
return $.pivotUtilities.errorHandling.getErrorPlaceholder(placeholder, useNewUx) || defaultPlaceholder;
|
|
741
|
+
}
|
|
742
|
+
|
|
734
743
|
highchartsRenderer.ptCreateElementAndDraw = function (chartOptions, opts) {
|
|
735
744
|
if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
|
|
736
745
|
const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
|
|
@@ -820,9 +829,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
820
829
|
|
|
821
830
|
if (!seriesDataLength && !chartOptions.onlyText) {
|
|
822
831
|
result = highchartsRenderer.getNoDataResult(chartOptions);
|
|
832
|
+
opts.error_has_occurred = true;
|
|
833
|
+
opts.error_params = highchartsRenderer.widgetPlaceholders.nodata;
|
|
823
834
|
} else if (!chartOptions.onlyText && chartOptions.series && toMatch) {
|
|
824
835
|
result = highchartsRenderer.getNoDataResult(chartOptions, toMatch);
|
|
825
836
|
opts.error_has_occurred = true;
|
|
837
|
+
opts.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
|
|
826
838
|
} else {
|
|
827
839
|
chartOptions = highchartsRenderer.updateChartOptions(chartOptions, opts);
|
|
828
840
|
chartOptions = highchartsRenderer.updateChartOptions(chartOptions, {credits: {enabled: false}});
|
|
@@ -2840,6 +2852,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2840
2852
|
has_errors: false,
|
|
2841
2853
|
widget_values_format: widget_values_format,
|
|
2842
2854
|
calculated_formats: calculated_info.formats,
|
|
2855
|
+
isChangeable: false,
|
|
2843
2856
|
push: function (record) {
|
|
2844
2857
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
2845
2858
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -2860,7 +2873,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2860
2873
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
2861
2874
|
this.ignoreValue = true;
|
|
2862
2875
|
}
|
|
2863
|
-
|
|
2876
|
+
|
|
2877
|
+
if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
|
2878
|
+
return this.sum = parseFloat(record[attr]);
|
|
2879
|
+
} else if (!isNaN(parseFloat(record[attr]))) {
|
|
2864
2880
|
return this.sum += parseFloat(record[attr]);
|
|
2865
2881
|
}
|
|
2866
2882
|
},
|
|
@@ -3024,7 +3040,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3024
3040
|
this.ignoreValue = true;
|
|
3025
3041
|
}
|
|
3026
3042
|
|
|
3027
|
-
if (
|
|
3043
|
+
if (useTotalsCalculation) {
|
|
3028
3044
|
return this.sum = val;
|
|
3029
3045
|
} else {
|
|
3030
3046
|
return this.sum += val;
|
|
@@ -3091,6 +3107,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3091
3107
|
has_errors: false,
|
|
3092
3108
|
widget_values_format: widget_values_format,
|
|
3093
3109
|
calculated_formats: calculated_info.formats,
|
|
3110
|
+
isChangeable: false,
|
|
3094
3111
|
push: function (record) {
|
|
3095
3112
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3096
3113
|
if (record['data_types'].length > 0) {
|
|
@@ -3123,7 +3140,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3123
3140
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
3124
3141
|
this.ignoreValue = true;
|
|
3125
3142
|
}
|
|
3126
|
-
|
|
3143
|
+
if (useTotalsCalculation) {
|
|
3144
|
+
return this.val = x;
|
|
3145
|
+
} else {
|
|
3146
|
+
return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
|
|
3147
|
+
}
|
|
3127
3148
|
}
|
|
3128
3149
|
},
|
|
3129
3150
|
value: function () {
|
|
@@ -3184,6 +3205,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3184
3205
|
has_errors: false,
|
|
3185
3206
|
widget_values_format: widget_values_format,
|
|
3186
3207
|
calculated_formats: calculated_info.formats,
|
|
3208
|
+
isChangeable: false,
|
|
3187
3209
|
push: function (record) {
|
|
3188
3210
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3189
3211
|
if (record['data_types'].length > 0) {
|
|
@@ -3216,8 +3238,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3216
3238
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
|
3217
3239
|
this.ignoreValue = true;
|
|
3218
3240
|
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3241
|
+
|
|
3242
|
+
if (useTotalsCalculation) {
|
|
3243
|
+
return this.val = x;
|
|
3244
|
+
} else {
|
|
3245
|
+
return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
|
|
3246
|
+
} }
|
|
3221
3247
|
},
|
|
3222
3248
|
value: function () {
|
|
3223
3249
|
if (this.ignoreValue) {
|
|
@@ -3278,6 +3304,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3278
3304
|
has_errors: false,
|
|
3279
3305
|
widget_values_format: widget_values_format,
|
|
3280
3306
|
calculated_formats: calculated_info.formats,
|
|
3307
|
+
isChangeable: false,
|
|
3281
3308
|
push: function (record) {
|
|
3282
3309
|
if (record.hasOwnProperty('data_types') && record['data_types']) {
|
|
3283
3310
|
if (record['data_types'].length > 0) {
|
|
@@ -3311,7 +3338,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3311
3338
|
this.ignoreValue = true;
|
|
3312
3339
|
}
|
|
3313
3340
|
|
|
3314
|
-
|
|
3341
|
+
|
|
3342
|
+
if (useTotalsCalculation) {
|
|
3343
|
+
this.sum = parseFloat(x);
|
|
3344
|
+
} else {
|
|
3345
|
+
this.sum += parseFloat(x);
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3315
3348
|
return this.len++;
|
|
3316
3349
|
}
|
|
3317
3350
|
},
|
|
@@ -3782,6 +3815,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3782
3815
|
return {};
|
|
3783
3816
|
}
|
|
3784
3817
|
|
|
3818
|
+
options.error_has_occurred = true;
|
|
3819
|
+
options.error_params = highchartsRenderer.widgetPlaceholders.nodata;
|
|
3785
3820
|
return highchartsRenderer.getNoDataResult(options.rendererOptions);
|
|
3786
3821
|
}
|
|
3787
3822
|
|
|
@@ -3790,6 +3825,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3790
3825
|
return {};
|
|
3791
3826
|
}
|
|
3792
3827
|
|
|
3828
|
+
options.error_has_occurred = true;
|
|
3829
|
+
options.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
|
|
3793
3830
|
return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
|
|
3794
3831
|
}
|
|
3795
3832
|
|
|
@@ -4353,6 +4390,60 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4353
4390
|
exTableOptions.pivot.calculatedValues = highchartsRenderer.objectCopyJsonMethod(exTableOptions.calculated_values || []);
|
|
4354
4391
|
};
|
|
4355
4392
|
|
|
4393
|
+
highchartsRenderer.addTemplateDataToDynamicRangeOptions = function (selectedTemplate, dynamicRangeOptions) {
|
|
4394
|
+
highchartsRenderer.setWidgetFieldsToTemplate(selectedTemplate);
|
|
4395
|
+
|
|
4396
|
+
var fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplate.widget_fields);
|
|
4397
|
+
var fieldOb;
|
|
4398
|
+
var filterFields = [];
|
|
4399
|
+
var selectedFields = [];
|
|
4400
|
+
|
|
4401
|
+
lodash.forEach(dynamicRangeOptions.filters, function (filterObj) {
|
|
4402
|
+
fieldOb = lodash.find(fields, {id: filterObj.field});
|
|
4403
|
+
if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype === 'list') {
|
|
4404
|
+
filterObj.values = filterObj.values.val
|
|
4405
|
+
} else if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype !== 'list') {
|
|
4406
|
+
fieldOb.values = filterObj.values;
|
|
4407
|
+
} else if (fieldOb && filterObj.values && filterObj.values.type === 'advanced') {
|
|
4408
|
+
fieldOb.values = filterObj.values;
|
|
4409
|
+
}
|
|
4410
|
+
if (fieldOb && filterObj.values && filterObj.values instanceof Array) {
|
|
4411
|
+
if (filterObj.is_excluded == true) {
|
|
4412
|
+
fieldOb.excludes = filterObj.values;
|
|
4413
|
+
} else {
|
|
4414
|
+
fieldOb.includes = filterObj.values;
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
if (filterObj.allow_nulls && fieldOb) {
|
|
4418
|
+
fieldOb.allow_nulls = filterObj.allow_nulls;
|
|
4419
|
+
}
|
|
4420
|
+
});
|
|
4421
|
+
|
|
4422
|
+
// fill selected fields
|
|
4423
|
+
lodash.forEach(dynamicRangeOptions.fields, function (valObj) {
|
|
4424
|
+
fieldOb = lodash.find(fields, {id: valObj.field});
|
|
4425
|
+
if (fieldOb) {
|
|
4426
|
+
selectedFields.push(fieldOb);
|
|
4427
|
+
lodash.remove(fields, {id: fieldOb.id});
|
|
4428
|
+
}
|
|
4429
|
+
});
|
|
4430
|
+
|
|
4431
|
+
// fill filter fields
|
|
4432
|
+
lodash.forEach(dynamicRangeOptions.filters, function (valObj) {
|
|
4433
|
+
fieldOb = lodash.find(fields, {id: valObj.field});
|
|
4434
|
+
if (fieldOb) {
|
|
4435
|
+
filterFields.push(fieldOb);
|
|
4436
|
+
lodash.remove(fields, {id: fieldOb.id});
|
|
4437
|
+
}
|
|
4438
|
+
});
|
|
4439
|
+
|
|
4440
|
+
dynamicRangeOptions.pivot = {};
|
|
4441
|
+
dynamicRangeOptions.pivot.fieldsArray = fields;
|
|
4442
|
+
dynamicRangeOptions.pivot.selectedFieldsArray = selectedFields;
|
|
4443
|
+
dynamicRangeOptions.pivot.filtersArray = filterFields;
|
|
4444
|
+
dynamicRangeOptions.pivot.calculatedValues = highchartsRenderer.objectCopyJsonMethod(dynamicRangeOptions.calculated_values || []);
|
|
4445
|
+
}
|
|
4446
|
+
|
|
4356
4447
|
highchartsRenderer.addTemplateDataToFunctionOptions = function (selectedTemplate, functionOptions) {
|
|
4357
4448
|
highchartsRenderer.setWidgetFieldsToTemplate(selectedTemplate);
|
|
4358
4449
|
|
|
@@ -4708,6 +4799,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4708
4799
|
return valToReturn;
|
|
4709
4800
|
};
|
|
4710
4801
|
|
|
4802
|
+
highchartsRenderer.widgetPlaceholders = Object.assign({}, $.pivotUtilities.errorHandling.placeholders);
|
|
4803
|
+
|
|
4711
4804
|
highchartsRenderer.suboptions = {
|
|
4712
4805
|
'default_show': {
|
|
4713
4806
|
category_class: 'google-visualization-charteditor-mini-more',
|
package/src/pivottable.js
CHANGED
|
@@ -7,7 +7,7 @@ let initPivotTable = function($, window, document) {
|
|
|
7
7
|
/*
|
|
8
8
|
Utilities
|
|
9
9
|
*/
|
|
10
|
-
var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, getSort, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, rd, renderers, rx, rz, sortAs, usFmt, usFmtInt, usFmtPct, zeroPad;
|
|
10
|
+
var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, getSort, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, rd, renderers, rx, rz, sortAs, usFmt, usFmtInt, usFmtPct, zeroPad, errorHandling;
|
|
11
11
|
addSeparators = function(nStr, thousandsSep, decimalSep) {
|
|
12
12
|
var rgx, x, x1, x2;
|
|
13
13
|
nStr += '';
|
|
@@ -20,6 +20,10 @@ let initPivotTable = function($, window, document) {
|
|
|
20
20
|
}
|
|
21
21
|
return x1 + x2;
|
|
22
22
|
};
|
|
23
|
+
let useTotalsCalculation = false;
|
|
24
|
+
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
|
25
|
+
useTotalsCalculation = _.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
|
26
|
+
}
|
|
23
27
|
numberFormat = function(opts) {
|
|
24
28
|
var defaults;
|
|
25
29
|
defaults = {
|
|
@@ -610,6 +614,47 @@ let initPivotTable = function($, window, document) {
|
|
|
610
614
|
}
|
|
611
615
|
return naturalSort;
|
|
612
616
|
};
|
|
617
|
+
errorHandling = {
|
|
618
|
+
placeholders: {
|
|
619
|
+
nodata: {
|
|
620
|
+
title: 'No Data Available',
|
|
621
|
+
text: 'This might happen because of a global filter or a change in the underlying data',
|
|
622
|
+
btnText: '',
|
|
623
|
+
class: 'nodata',
|
|
624
|
+
},
|
|
625
|
+
noPermission: {
|
|
626
|
+
title: 'No Permission',
|
|
627
|
+
text: 'You do not have permission to view the data',
|
|
628
|
+
btnText: 'Request Permission',
|
|
629
|
+
class: 'no-permission',
|
|
630
|
+
},
|
|
631
|
+
tooMuchData: {
|
|
632
|
+
title: 'There is too much data. Please edit this widget',
|
|
633
|
+
text: '',
|
|
634
|
+
btnText: 'Edit Widget',
|
|
635
|
+
class: 'too-much-data',
|
|
636
|
+
},
|
|
637
|
+
noPublishItem: {
|
|
638
|
+
title: 'We can’t find the published item in the source file',
|
|
639
|
+
text: '',
|
|
640
|
+
btnText: 'Go to filebox',
|
|
641
|
+
class: 'no-publish-item',
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
getErrorPlaceholder: function(placeholder, useNewUx = true) {
|
|
645
|
+
if (placeholder && typeof placeholder === 'object') {
|
|
646
|
+
return $(`
|
|
647
|
+
<div class="noData">
|
|
648
|
+
<div class="noData-title">${placeholder.title}</div>
|
|
649
|
+
<i class="noData-image ${useNewUx ? placeholder.class : 'fa fa-info'}"></i>
|
|
650
|
+
<div class="noData-text">${placeholder.text}</div>
|
|
651
|
+
<div class="noData-error-action"></div>
|
|
652
|
+
</div>
|
|
653
|
+
`);
|
|
654
|
+
}
|
|
655
|
+
return null;
|
|
656
|
+
},
|
|
657
|
+
};
|
|
613
658
|
|
|
614
659
|
/*
|
|
615
660
|
Data Model class
|
|
@@ -626,7 +671,6 @@ let initPivotTable = function($, window, document) {
|
|
|
626
671
|
this.sortKeys = bind(this.sortKeys, this);
|
|
627
672
|
this.arrSort = bind(this.arrSort, this);
|
|
628
673
|
this.input = input;
|
|
629
|
-
this.isUserHasPermission = opts.userHasPermission;
|
|
630
674
|
this.aggregator = (ref = opts.aggregator) != null ? ref : aggregatorTemplates.count()();
|
|
631
675
|
this.aggregatorName = (ref1 = opts.aggregatorName) != null ? ref1 : "Count";
|
|
632
676
|
this.colAttrs = (ref2 = opts.cols) != null ? ref2 : [];
|
|
@@ -649,7 +693,7 @@ let initPivotTable = function($, window, document) {
|
|
|
649
693
|
PivotData.forEachRecord(this.input, this.derivedAttributes, (function(_this) {
|
|
650
694
|
return function(record) {
|
|
651
695
|
if (_this.filter(record)) {
|
|
652
|
-
return _this.processRecord(record,
|
|
696
|
+
return _this.processRecord(record, useTotalsCalculation);
|
|
653
697
|
}
|
|
654
698
|
};
|
|
655
699
|
})(this));
|
|
@@ -891,7 +935,8 @@ let initPivotTable = function($, window, document) {
|
|
|
891
935
|
naturalSort: naturalSort,
|
|
892
936
|
numberFormat: numberFormat,
|
|
893
937
|
sortAs: sortAs,
|
|
894
|
-
PivotData: PivotData
|
|
938
|
+
PivotData: PivotData,
|
|
939
|
+
errorHandling: errorHandling,
|
|
895
940
|
};
|
|
896
941
|
|
|
897
942
|
/*
|
|
@@ -124,8 +124,11 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
124
124
|
const metaData = options.inputValuesData ? options.inputValuesData[name] : null;
|
|
125
125
|
let newValue = inputElement.value;
|
|
126
126
|
if (metaData) {
|
|
127
|
-
if (metaData.type === 'editInput')
|
|
127
|
+
if (metaData.type === 'editInput') {
|
|
128
128
|
newValue = parseFloat(newValue);
|
|
129
|
+
} else if (metaData.type === 'editInputPercent') {
|
|
130
|
+
newValue = parseFloat(newValue) + '%';
|
|
131
|
+
}
|
|
129
132
|
|
|
130
133
|
if (metaData.value !== newValue) {
|
|
131
134
|
metaData.value = newValue;
|
|
@@ -158,19 +161,14 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
158
161
|
}, 1)
|
|
159
162
|
});
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
inEl.setAttribute("type", "text");
|
|
163
|
-
else if (inputMetaData.type === 'editInput')
|
|
164
|
-
inEl.setAttribute("type", "number");
|
|
165
|
-
|
|
164
|
+
inEl.setAttribute("type", "number");
|
|
166
165
|
inEl.setAttribute("name", inputMetaData.name);
|
|
167
166
|
inEl.setAttribute("style", "background: transparent;width: calc(100% - 15px);border: 0;margin: 5px;text-align: inherit;display: none;");
|
|
168
|
-
inEl.value = inputMetaData.value;
|
|
167
|
+
inEl.value = inputMetaData.type === 'editInputPercent' ? parseFloat(inputMetaData.value.replace('%', '')) : inputMetaData.value;
|
|
169
168
|
inEl.addEventListener("focusout", function (event) {
|
|
170
169
|
event.preventDefault();
|
|
171
170
|
publishedItemsRenderer.changedInputElement(event, scope, options);
|
|
172
171
|
inEl.style.display = 'none';
|
|
173
|
-
labelEl.innerText = inEl.value;
|
|
174
172
|
labelEl.innerText = inputMetaData.format ? formatValue('n', inputMetaData.format, inEl.value).value : inputMetaData.value;
|
|
175
173
|
labelEl.style.display = 'block';
|
|
176
174
|
});
|