logitude-dashboard-library 3.1.141 → 3.1.142

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.
@@ -26,8 +26,8 @@ export declare const isPivotMeasureValueEmpty: (value: any) => boolean;
26
26
  export declare const logitudeSumAgg: (params: {
27
27
  values: any[];
28
28
  }) => number | null;
29
- export declare const isDevExtremePivotDataCellTotalOrGrandTotal: (cell: any) => boolean;
30
- export declare const isDevExtremeSummaryCellTotalOrGrandTotal: (cell: any) => boolean;
29
+ export declare const isDevExtremePivotDataCellTotalOrGrandTotal: (cell: any, hasRowFields: boolean, hasColumnFields: boolean) => boolean;
30
+ export declare const isDevExtremeSummaryCellTotalOrGrandTotal: (cell: any, hasRowFields: boolean, hasColumnFields: boolean) => boolean;
31
31
  export declare const isAgGridPivotDateMeasureTotalDisplayCell: (params: any) => boolean;
32
32
  export declare const logitudeMinAgg: (params: {
33
33
  values: any[];
package/dist/index.js CHANGED
@@ -2232,14 +2232,22 @@ var isAgGridDateMeasureTotalAggregation = function isAgGridDateMeasureTotalAggre
2232
2232
  return !!(colId && String(colId).indexOf('PivotRowTotal_') === 0);
2233
2233
  };
2234
2234
 
2235
- var isDevExtremePivotDataCellTotalOrGrandTotal = function isDevExtremePivotDataCellTotalOrGrandTotal(cell) {
2235
+ var isDevExtremePivotDataCellTotalOrGrandTotal = function isDevExtremePivotDataCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields) {
2236
2236
  if (!cell) {
2237
2237
  return false;
2238
2238
  }
2239
2239
 
2240
- return cell.rowType === 'T' || cell.rowType === 'GT' || cell.columnType === 'T' || cell.columnType === 'GT';
2240
+ if (hasRowFields && (cell.rowType === 'T' || cell.rowType === 'GT')) {
2241
+ return true;
2242
+ }
2243
+
2244
+ if (hasColumnFields && (cell.columnType === 'T' || cell.columnType === 'GT')) {
2245
+ return true;
2246
+ }
2247
+
2248
+ return false;
2241
2249
  };
2242
- var isDevExtremeSummaryCellTotalOrGrandTotal = function isDevExtremeSummaryCellTotalOrGrandTotal(cell) {
2250
+ var isDevExtremeSummaryCellTotalOrGrandTotal = function isDevExtremeSummaryCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields) {
2243
2251
  if (!cell) {
2244
2252
  return false;
2245
2253
  }
@@ -2248,7 +2256,16 @@ var isDevExtremeSummaryCellTotalOrGrandTotal = function isDevExtremeSummaryCellT
2248
2256
  var columnPath = cell._columnPath;
2249
2257
  var rowType = rowPath && rowPath[0] ? rowPath[0].type : null;
2250
2258
  var columnType = columnPath && columnPath[0] ? columnPath[0].type : null;
2251
- return rowType === 'T' || rowType === 'GT' || columnType === 'T' || columnType === 'GT';
2259
+
2260
+ if (hasRowFields && (rowType === 'T' || rowType === 'GT')) {
2261
+ return true;
2262
+ }
2263
+
2264
+ if (hasColumnFields && (columnType === 'T' || columnType === 'GT')) {
2265
+ return true;
2266
+ }
2267
+
2268
+ return false;
2252
2269
  };
2253
2270
  var isAgGridPivotDateMeasureTotalDisplayCell = function isAgGridPivotDateMeasureTotalDisplayCell(params) {
2254
2271
  var node = params && params.node;
@@ -2809,6 +2826,8 @@ var PivotTable = React.forwardRef(function (props, comRef) {
2809
2826
  var tabledata = React.useRef();
2810
2827
  var pivotGridRef = React.useRef(null);
2811
2828
  var dateMeasureDataFieldsRef = React.useRef(new Set());
2829
+ var pivotHasRowFieldsRef = React.useRef(false);
2830
+ var pivotHasColumnFieldsRef = React.useRef(false);
2812
2831
 
2813
2832
  var _useState3 = React.useState(new PivotGridDataSource({
2814
2833
  store: [],
@@ -2947,7 +2966,7 @@ var PivotTable = React.forwardRef(function (props, comRef) {
2947
2966
 
2948
2967
  e.cellElement.classList.add(PIVOT_DATE_DATA_CELL_CLASS);
2949
2968
 
2950
- if (isDevExtremePivotDataCellTotalOrGrandTotal(e.cell)) {
2969
+ if (isDevExtremePivotDataCellTotalOrGrandTotal(e.cell, pivotHasRowFieldsRef.current, pivotHasColumnFieldsRef.current)) {
2951
2970
  e.cell.text = '';
2952
2971
  var contentSpan = e.cellElement ? e.cellElement.querySelector('span') : null;
2953
2972
 
@@ -3035,6 +3054,14 @@ var PivotTable = React.forwardRef(function (props, comRef) {
3035
3054
  }
3036
3055
  };
3037
3056
  });
3057
+ var hasRowFields = tabledata.current.PivoFields.some(function (field) {
3058
+ return field.PivotCode && field.PivotCode.includes('Row');
3059
+ });
3060
+ var hasColumnFields = tabledata.current.PivoFields.some(function (field) {
3061
+ return field.PivotCode && !field.PivotCode.includes('Row');
3062
+ });
3063
+ pivotHasRowFieldsRef.current = hasRowFields;
3064
+ pivotHasColumnFieldsRef.current = hasColumnFields;
3038
3065
  dateMeasureDataFieldsRef.current = new Set(tabledata.current.PivotMeasures.filter(function (measure) {
3039
3066
  return (measure.MeasureCode === 'Min' || measure.MeasureCode === 'Max') && FieldDataType.isDateOrDateTimeType(measure.MeasureFieldDataType);
3040
3067
  }).map(function (measure) {
@@ -3108,7 +3135,7 @@ var PivotTable = React.forwardRef(function (props, comRef) {
3108
3135
  }
3109
3136
  }, isDateMinMaxMeasure ? {
3110
3137
  calculateSummaryValue: function calculateSummaryValue(cell) {
3111
- if (isDevExtremeSummaryCellTotalOrGrandTotal(cell)) {
3138
+ if (isDevExtremeSummaryCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields)) {
3112
3139
  return null;
3113
3140
  }
3114
3141
 
@@ -3136,17 +3163,7 @@ var PivotTable = React.forwardRef(function (props, comRef) {
3136
3163
  }
3137
3164
  };
3138
3165
 
3139
- var isRowsEmptyAndColumnsNotEmpty = function isRowsEmptyAndColumnsNotEmpty() {
3140
- var pivotRows = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotRows) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotRows) : [];
3141
- var pivotColumns = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotColumns) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotColumns) : [];
3142
- return (pivotRows === null || pivotRows === void 0 ? void 0 : pivotRows.length) === 0 && (pivotColumns === null || pivotColumns === void 0 ? void 0 : pivotColumns.length) > 0;
3143
- };
3144
-
3145
3166
  var canShowRowsGrandTotal = function canShowRowsGrandTotal() {
3146
- if (isRowsEmptyAndColumnsNotEmpty()) {
3147
- return true;
3148
- }
3149
-
3150
3167
  var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
3151
3168
  return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowRowsGrandTotal) ? pivotTotalsSettings.ShowRowsGrandTotal : false;
3152
3169
  };
@@ -3441,12 +3458,6 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
3441
3458
  return colDef;
3442
3459
  };
3443
3460
 
3444
- var isRowsEmptyAndColumnsNotEmpty = function isRowsEmptyAndColumnsNotEmpty() {
3445
- var pivotRows = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotRows);
3446
- var pivotColumns = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotColumns);
3447
- return pivotRows.length === 0 && pivotColumns.length > 0;
3448
- };
3449
-
3450
3461
  var isRowsNotEmptyAndColumnsEmpty = function isRowsNotEmptyAndColumnsEmpty() {
3451
3462
  var pivotRows = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotRows);
3452
3463
  var pivotColumns = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotColumns);
@@ -3454,7 +3465,6 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
3454
3465
  };
3455
3466
 
3456
3467
  var canShowRowsGrandTotal = function canShowRowsGrandTotal() {
3457
- if (isRowsEmptyAndColumnsNotEmpty()) return true;
3458
3468
  var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
3459
3469
  return !isNullOrUndefinedOrEmpty(settings.ShowRowsGrandTotal) ? !!settings.ShowRowsGrandTotal : false;
3460
3470
  };