@churchillliving/se-ui-toolkit 6.53.496 → 6.53.498

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.
@@ -3898,6 +3898,8 @@
3898
3898
  this.pagination = false;
3899
3899
  // Optional prop to handle show CurrentPage Report
3900
3900
  this.showCurrentPageReport = false;
3901
+ // Displays aggregate that fetch from records
3902
+ this.aggregatedResult = [];
3901
3903
  this.showconfirmDialog = true;
3902
3904
  this.saveAllData = false;
3903
3905
  this.columnActions = [];
@@ -4195,7 +4197,7 @@
4195
4197
  };
4196
4198
  GridComponent.prototype.ngOnChanges = function (change) {
4197
4199
  var _this = this;
4198
- var _a, _b, _c, _d, _e, _f, _g;
4200
+ var _a, _b, _c, _d, _e, _f;
4199
4201
  if (!this.isCheckBoxChangeEventCalled) {
4200
4202
  if (this.allowCaching !== false && this.pagination) {
4201
4203
  this.allowCaching = this.pagination;
@@ -4209,14 +4211,15 @@
4209
4211
  }
4210
4212
  var hasColumns = this.columns && this.columns.length > 0;
4211
4213
  if (hasColumns) {
4212
- this.columns = this.gridService.setColumnFields((_c = this.columns) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return (!x.hidden || x.allowToggle); }));
4214
+ this.columns = this.gridService.setColumnFields(this.columns);
4215
+ // this.columns = this.gridService.setColumnFields(this.columns?.filter((x) => (!x.hidden || x.allowToggle)));
4213
4216
  }
4214
4217
  this.roles = this.authService.getUserRoles();
4215
4218
  // apply user role permissions on grid columns
4216
4219
  this.applyColumnsPermissions();
4217
4220
  // apply global permissions on entire grid
4218
4221
  this.applyGridPermissions();
4219
- this._selectedColumns = (_d = this.columns) === null || _d === void 0 ? void 0 : _d.filter(function (x) { return !x.hidden || x.allowToggle; });
4222
+ this._selectedColumns = (_c = this.columns) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return !x.hidden; }); // || x.allowToggle);
4220
4223
  this.cd.detectChanges();
4221
4224
  if (hasColumns) {
4222
4225
  this.columns = this.gridService.setColumnFields(this.columns);
@@ -4340,7 +4343,7 @@
4340
4343
  }
4341
4344
  });
4342
4345
  // Searching scenario
4343
- if (((_e = change.rows) === null || _e === void 0 ? void 0 : _e.currentValue) && ((_f = change.columns) === null || _f === void 0 ? void 0 : _f.currentValue)) {
4346
+ if (((_d = change.rows) === null || _d === void 0 ? void 0 : _d.currentValue) && ((_e = change.columns) === null || _e === void 0 ? void 0 : _e.currentValue)) {
4344
4347
  // Checks either column value is changes (i.e., column hidden scenario)
4345
4348
  if (JSON.stringify(change.columns.currentValue).toLowerCase() !==
4346
4349
  JSON.stringify(this.columns).toLowerCase()) {
@@ -4382,7 +4385,7 @@
4382
4385
  if (globalSearchbtn) {
4383
4386
  this.searchGridFilter = false;
4384
4387
  }
4385
- if (((_g = this.rowsData) === null || _g === void 0 ? void 0 : _g.length) > 0 && this.generateRowsDataCopy) {
4388
+ if (((_f = this.rowsData) === null || _f === void 0 ? void 0 : _f.length) > 0 && this.generateRowsDataCopy) {
4386
4389
  this.rowsDataCopy = JSON.parse(JSON.stringify(this.rowsData));
4387
4390
  }
4388
4391
  }
@@ -5429,6 +5432,7 @@
5429
5432
  var columnType = col.type;
5430
5433
  if (columnType === exports.EGridAggregate.COUNT) {
5431
5434
  var count = _this.rowsData.length;
5435
+ count = _this.setFetchAggregatedValue(column, count, 1);
5432
5436
  col.aggrValue = _this.setAggregateFooterText(col, count, 'Count');
5433
5437
  }
5434
5438
  if (columnType === exports.EGridAggregate.SUM ||
@@ -5437,10 +5441,12 @@
5437
5441
  if (colValues && colValues.length > 0) {
5438
5442
  var sum = colValues.reduce(function (acc, cur) { return acc + cur; }, 0);
5439
5443
  if (columnType === exports.EGridAggregate.SUM) {
5444
+ sum = _this.setFetchAggregatedValue(column, sum, 2);
5440
5445
  col.aggrValue = _this.setAggregateFooterText(col, sum, 'Sum');
5441
5446
  }
5442
5447
  if (columnType === exports.EGridAggregate.AVERAGE) {
5443
5448
  var average = sum / colValues.length || 0;
5449
+ average = _this.setFetchAggregatedValue(column, sum, 3);
5444
5450
  col.aggrValue = _this.setAggregateFooterText(col, average, 'Avg');
5445
5451
  }
5446
5452
  }
@@ -5452,6 +5458,17 @@
5452
5458
  });
5453
5459
  }
5454
5460
  };
5461
+ // set the aggregataion value that coming from fetch
5462
+ GridComponent.prototype.setFetchAggregatedValue = function (column, aggregateValue, aggregateAction) {
5463
+ var _a;
5464
+ if (((_a = this.aggregatedResult) === null || _a === void 0 ? void 0 : _a.length) > 0) {
5465
+ var aggregatedColumn = this.aggregatedResult.find(function (aggregate) { var _a, _b; return ((_a = aggregate.field) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = column.field) === null || _b === void 0 ? void 0 : _b.toLowerCase()) && aggregate.aggregationOperation === aggregateAction; });
5466
+ if (aggregatedColumn) {
5467
+ aggregateValue = aggregatedColumn === null || aggregatedColumn === void 0 ? void 0 : aggregatedColumn.value;
5468
+ }
5469
+ }
5470
+ return aggregateValue;
5471
+ };
5455
5472
  /**
5456
5473
  * set grid Aggregate values
5457
5474
  */
@@ -6411,6 +6428,7 @@
6411
6428
  pagination: [{ type: i0.Input }],
6412
6429
  showCurrentPageReport: [{ type: i0.Input }],
6413
6430
  totalRecords: [{ type: i0.Input }],
6431
+ aggregatedResult: [{ type: i0.Input }],
6414
6432
  showconfirmDialog: [{ type: i0.Input }],
6415
6433
  saveAllData: [{ type: i0.Input }],
6416
6434
  defaultRows: [{ type: i0.Input }],