@datarailsshared/dr_renderer 1.2.90 → 1.2.93

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.90",
3
+ "version": "1.2.93",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -4,6 +4,8 @@ let initDRPivotTable = function($, window, document) {
4
4
  var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
5
 
6
6
  var DRPivotData, sortDateStrings, getSort, processKey, SubtotalRenderer, getFormattedNumber, largeToSmallSort, largeToSmallSortByAbsolute, NovixRenderer;
7
+ const newTableColors = ['rgb(127, 196, 255)', 'rgb(200, 243,243)', 'rgb(247, 161, 173)', 'rgb(255, 237, 178)', 'rgb(221, 239, 255)',
8
+ 'rgb(171, 216, 255)', 'rgb(174, 231, 220)', 'rgb(227, 255, 236)', 'rgb(162, 215, 227)', 'rgb(223, 239, 236)'];
7
9
 
8
10
  var delim = " , ";
9
11
  const useNewUx = document.ReportHippo && document.ReportHippo && document.ReportHippo.user &&
@@ -482,7 +484,7 @@ let initDRPivotTable = function($, window, document) {
482
484
  }
483
485
 
484
486
  SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
485
- 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;
487
+ 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, applyInlineStyles, 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;
486
488
  var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
487
489
  var getAdditionalAggregation, buildAdditionalHeaderCols, buildAdditionalHeaderRows, buildAdditionalColValues, buildAdditionalRowValues, buildAdditionalRowTotals, buildAdditionalColTotals;
488
490
  var additionalFieldsCol, additionalFieldsRow, additionalFieldsList;
@@ -647,8 +649,10 @@ let initDRPivotTable = function($, window, document) {
647
649
  if (opts.paletteOptions.widgetPalette) {
648
650
  const mc_palette = _.find(_.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
649
651
  colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
650
- } else if (opts.paletteOptions.dashboardPalette.colors) {
652
+ } else if (opts.paletteOptions.dashboardPalette && opts.paletteOptions.dashboardPalette.colors) {
651
653
  colors = opts.paletteOptions.dashboardPalette.colors;
654
+ } else {
655
+ colors = newTableColors;
652
656
  }
653
657
 
654
658
  var isNewDesign = useNewUx && opts.chartOptions.table_options.use_new_table_design;
@@ -776,24 +780,30 @@ let initDRPivotTable = function($, window, document) {
776
780
  applyInlineStyles = function(element, className) {
777
781
  const tableDesignOptions = opts.chartOptions.table_design_options;
778
782
  let optionName;
779
- if (!className || !tableDesignOptions) return element;
780
-
781
- if (element.className.includes('pvtAxisLabel') ||
782
- element.className.includes('pvtColLabel')) {
783
- optionName = 'columns';
784
- } else if (element.className.includes('pvtRowLabel')) {
785
- optionName = 'rows';
786
- } else if (element.className.includes('pvtVal') &&
787
- !element.className.includes('pvtTotal')) {
788
- optionName = 'values';
789
- } else if (element.className.includes('colTotal') ||
790
- element.className.includes('rowTotal') ||
791
- element.className.includes('pvtGrandTotal')) {
792
- optionName = 'totals';
793
- }
794
- element.style.fontSize = tableDesignOptions[optionName + '_font_size'] + 'px';
795
- element.style.textAlign = tableDesignOptions[optionName + '_align_text'];
796
- element.style.fontFamily = tableDesignOptions[optionName + '_font_style'];
783
+ if (!className) return element;
784
+
785
+ if(element.className){
786
+ if (_.includes(element.className, 'pvtAxisLabel') ||
787
+ _.includes(element.className, 'pvtColLabel')) {
788
+ optionName = 'columns';
789
+ }else if (_.includes(element.className,'pvtRowLabel')) {
790
+ optionName = 'rows';
791
+ } else if (_.includes(element.className,'pvtVal') &&
792
+ !_.includes(element.className,'pvtTotal')) {
793
+ optionName = 'values';
794
+ } else if (_.includes(element.className,'colTotal') ||
795
+ _.includes(element.className,'rowTotal') ||
796
+ _.includes(element.className,'pvtGrandTotal')) {
797
+ optionName = 'totals';
798
+ }
799
+ }
800
+
801
+ if(optionName && tableDesignOptions){
802
+ element.style.fontSize = tableDesignOptions[optionName + '_font_size'] + 'px';
803
+ element.style.textAlign = tableDesignOptions[optionName + '_align_text'];
804
+ element.style.fontFamily = tableDesignOptions[optionName + '_font_style'];
805
+ }
806
+
797
807
  return element;
798
808
  }
799
809
  createElement = function(elementType, className, textContent, attributes, eventHandlers) {
@@ -323,8 +323,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
323
323
  }
324
324
 
325
325
  highchartsRenderer.downloadFile = function (title, graph_id, type) {
326
- var chart = $('#' + graph_id).find('div.chart').highcharts();
327
- var png_name = title;
326
+ let chart = null;
327
+
328
+ const chartElement = $('#' + graph_id).find('div.chart');
329
+ if (chartElement.highcharts) {
330
+ chart = chartElement.highcharts();
331
+ } else {
332
+ const graphId = Number(graph_id.split('_')[1]);
333
+ chart = lodash.find(window.Highcharts.charts, function(value) {
334
+ return value.options.widgetId === graphId;
335
+ });
336
+ }
337
+
338
+ if (!chart) return;
339
+
328
340
  /*if(chart.title && chart.title.textStr){
329
341
  png_name = chart.title.textStr
330
342
  }else{
@@ -334,7 +346,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
334
346
  if (type === 'png') {
335
347
  chart.exportChartLocal({
336
348
  //type: 'application/png',
337
- filename: png_name
349
+ filename: title
338
350
  });
339
351
  }
340
352
  if (type === 'XLS') {
@@ -7188,7 +7200,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7188
7200
  return filters;
7189
7201
  };
7190
7202
 
7191
- highchartsRenderer.prepareDrillDownGraphFilters = function (rowKey, colKey, widget) {
7203
+ highchartsRenderer.prepareDrillDownGraphFilters = function (r_key, c_key, widget) {
7204
+ let rowKey = r_key;
7205
+ let colKey = c_key;
7206
+ let widgetOptions = typeof widget.options === 'string' ? JSON.parse(widget.options) : widget.options;
7207
+ if (lodash.get(widgetOptions, 'chartOptions.table_options.transpose_table', false)) {
7208
+ rowKey = c_key;
7209
+ colKey = r_key;
7210
+ }
7211
+
7192
7212
  let filters = lodash.cloneDeep(widget.filters);
7193
7213
  for (let i = 0; i < rowKey.length; i++) {
7194
7214
  let filter = lodash.find(filters, {name: widget.rows[i].name});
package/src/index.js CHANGED
@@ -20,8 +20,8 @@ dr_render_factory.getInitHighchartsRenderer = function($, document, Highcharts,
20
20
  return getHighchartsRenderer($, document, Highcharts, default_colors, highchartsRenderer, DataFormatter, lodash, moment_lib);
21
21
  }
22
22
 
23
- dr_render_factory.getInitPublishedItemsRenderer = function (publishedItemsRenderer) {
24
- return getPublishedItemsRenderer(publishedItemsRenderer);
23
+ dr_render_factory.getInitPublishedItemsRenderer = function (publishedItemsRenderer, bind = {}) {
24
+ return getPublishedItemsRenderer.bind(bind)(publishedItemsRenderer);
25
25
  }
26
26
 
27
27
  //const $ = require( "jquery" )( window );
package/src/pivottable.js CHANGED
@@ -926,7 +926,7 @@ let initPivotTable = function($, window, document) {
926
926
  return PivotData;
927
927
 
928
928
  })();
929
- $.pivotUtilities = {
929
+ window.$.pivotUtilities = $.pivotUtilities = {
930
930
  aggregatorTemplates: aggregatorTemplates,
931
931
  aggregators: aggregators,
932
932
  renderers: renderers,