@datarailsshared/dr_renderer 1.2.48 → 1.2.49
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 +6 -3
- package/src/highcharts_renderer.js +16 -2
- package/src/pivottable.js +44 -2
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -385,12 +385,13 @@ let initDRPivotTable = function($, window, document) {
|
|
|
385
385
|
pvtData.colKeys = [];
|
|
386
386
|
tooMuch = true;
|
|
387
387
|
opts.error_has_occurred = true;
|
|
388
|
+
opts.error_params = $.pivotUtilities.errorHandling.placeholders.tooMuchData;
|
|
388
389
|
}
|
|
389
|
-
return SubtotalRenderer(pvtData, opts, charttype, tooMuch);
|
|
390
|
+
return SubtotalRenderer(pvtData, opts, charttype, tooMuch, opts.error_params);
|
|
390
391
|
}
|
|
391
392
|
}
|
|
392
393
|
|
|
393
|
-
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false) {
|
|
394
|
+
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
|
|
394
395
|
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;
|
|
395
396
|
var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
|
|
396
397
|
var edit_assumptions;
|
|
@@ -2133,7 +2134,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2133
2134
|
}
|
|
2134
2135
|
|
|
2135
2136
|
if (tooMuch) {
|
|
2136
|
-
|
|
2137
|
+
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>');
|
|
2138
|
+
|
|
2139
|
+
resultsArr.push($.pivotUtilities.errorHandling.getErrorPlaceholder(error_params, useNewUx) || defaultPlaceholder);
|
|
2137
2140
|
} else {
|
|
2138
2141
|
var tableContainer = document.createElement("div");
|
|
2139
2142
|
tableContainer.className = "pivot-div";
|
|
@@ -721,9 +721,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
if (to_match) {
|
|
724
|
-
resultsArr.push(
|
|
724
|
+
resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.tooMuchData));
|
|
725
725
|
} else {
|
|
726
|
-
resultsArr.push(
|
|
726
|
+
resultsArr.push(highchartsRenderer.getWidgetPlaceholder(highchartsRenderer.widgetPlaceholders.nodata));
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
temp_result.html(resultsArr);
|
|
@@ -731,6 +731,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
731
731
|
return temp_result;
|
|
732
732
|
};
|
|
733
733
|
|
|
734
|
+
highchartsRenderer.getWidgetPlaceholder = function(placeholder) {
|
|
735
|
+
const defaultPlaceholder = $('<div class="noData"><i class="' + (useNewUx ? 'noData-image' : 'fa fa-info') + '"></i> no data</div>');
|
|
736
|
+
return $.pivotUtilities.errorHandling.getErrorPlaceholder(placeholder, useNewUx) || defaultPlaceholder;
|
|
737
|
+
}
|
|
738
|
+
|
|
734
739
|
highchartsRenderer.ptCreateElementAndDraw = function (chartOptions, opts) {
|
|
735
740
|
if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
|
|
736
741
|
const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
|
|
@@ -820,9 +825,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
820
825
|
|
|
821
826
|
if (!seriesDataLength && !chartOptions.onlyText) {
|
|
822
827
|
result = highchartsRenderer.getNoDataResult(chartOptions);
|
|
828
|
+
opts.error_has_occurred = true;
|
|
829
|
+
opts.error_params = highchartsRenderer.widgetPlaceholders.nodata;
|
|
823
830
|
} else if (!chartOptions.onlyText && chartOptions.series && toMatch) {
|
|
824
831
|
result = highchartsRenderer.getNoDataResult(chartOptions, toMatch);
|
|
825
832
|
opts.error_has_occurred = true;
|
|
833
|
+
opts.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
|
|
826
834
|
} else {
|
|
827
835
|
chartOptions = highchartsRenderer.updateChartOptions(chartOptions, opts);
|
|
828
836
|
chartOptions = highchartsRenderer.updateChartOptions(chartOptions, {credits: {enabled: false}});
|
|
@@ -3777,6 +3785,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3777
3785
|
return {};
|
|
3778
3786
|
}
|
|
3779
3787
|
|
|
3788
|
+
options.error_has_occurred = true;
|
|
3789
|
+
options.error_params = highchartsRenderer.widgetPlaceholders.nodata;
|
|
3780
3790
|
return highchartsRenderer.getNoDataResult(options.rendererOptions);
|
|
3781
3791
|
}
|
|
3782
3792
|
|
|
@@ -3785,6 +3795,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3785
3795
|
return {};
|
|
3786
3796
|
}
|
|
3787
3797
|
|
|
3798
|
+
options.error_has_occurred = true;
|
|
3799
|
+
options.error_params = highchartsRenderer.widgetPlaceholders.tooMuchData;
|
|
3788
3800
|
return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
|
|
3789
3801
|
}
|
|
3790
3802
|
|
|
@@ -4703,6 +4715,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4703
4715
|
return valToReturn;
|
|
4704
4716
|
};
|
|
4705
4717
|
|
|
4718
|
+
highchartsRenderer.widgetPlaceholders = Object.assign({}, $.pivotUtilities.errorHandling.placeholders);
|
|
4719
|
+
|
|
4706
4720
|
highchartsRenderer.suboptions = {
|
|
4707
4721
|
'default_show': {
|
|
4708
4722
|
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 += '';
|
|
@@ -610,6 +610,47 @@ let initPivotTable = function($, window, document) {
|
|
|
610
610
|
}
|
|
611
611
|
return naturalSort;
|
|
612
612
|
};
|
|
613
|
+
errorHandling = {
|
|
614
|
+
placeholders: {
|
|
615
|
+
nodata: {
|
|
616
|
+
title: 'No Data Available',
|
|
617
|
+
text: 'This might happen because of a global filter or a change in the underlying data',
|
|
618
|
+
btnText: '',
|
|
619
|
+
class: 'nodata',
|
|
620
|
+
},
|
|
621
|
+
noPermission: {
|
|
622
|
+
title: 'No Permission',
|
|
623
|
+
text: 'You do not have permission to view the data',
|
|
624
|
+
btnText: 'Request Permission',
|
|
625
|
+
class: 'no-permission',
|
|
626
|
+
},
|
|
627
|
+
tooMuchData: {
|
|
628
|
+
title: 'There is too much data. Please edit this widget',
|
|
629
|
+
text: '',
|
|
630
|
+
btnText: 'Edit Widget',
|
|
631
|
+
class: 'too-much-data',
|
|
632
|
+
},
|
|
633
|
+
noPublishItem: {
|
|
634
|
+
title: 'We can’t find the published item in the source file',
|
|
635
|
+
text: '',
|
|
636
|
+
btnText: 'Go to filebox',
|
|
637
|
+
class: 'no-publish-item',
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
getErrorPlaceholder: function(placeholder, useNewUx = true) {
|
|
641
|
+
if (placeholder && typeof placeholder === 'object') {
|
|
642
|
+
return $(`
|
|
643
|
+
<div class="noData">
|
|
644
|
+
<div class="noData-title">${placeholder.title}</div>
|
|
645
|
+
<i class="noData-image ${useNewUx ? placeholder.class : 'fa fa-info'}"></i>
|
|
646
|
+
<div class="noData-text">${placeholder.text}</div>
|
|
647
|
+
<div class="noData-error-action"></div>
|
|
648
|
+
</div>
|
|
649
|
+
`);
|
|
650
|
+
}
|
|
651
|
+
return null;
|
|
652
|
+
},
|
|
653
|
+
};
|
|
613
654
|
|
|
614
655
|
/*
|
|
615
656
|
Data Model class
|
|
@@ -890,7 +931,8 @@ let initPivotTable = function($, window, document) {
|
|
|
890
931
|
naturalSort: naturalSort,
|
|
891
932
|
numberFormat: numberFormat,
|
|
892
933
|
sortAs: sortAs,
|
|
893
|
-
PivotData: PivotData
|
|
934
|
+
PivotData: PivotData,
|
|
935
|
+
errorHandling: errorHandling,
|
|
894
936
|
};
|
|
895
937
|
|
|
896
938
|
/*
|