@churchillliving/se-ui-toolkit 6.53.508 → 6.53.510

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.
@@ -3779,6 +3779,7 @@
3779
3779
  this.ref = ref;
3780
3780
  this.inlineRowCancel = new i0.EventEmitter();
3781
3781
  this.serverFilters = {};
3782
+ this.rowsData = [];
3782
3783
  this.rowsDataCopy = [];
3783
3784
  this.roles = [];
3784
3785
  this.isColumnHidden = false;
@@ -3820,6 +3821,7 @@
3820
3821
  this.editRowsRecords = {};
3821
3822
  // Maintains record of rows being edited
3822
3823
  this.editingRowKeys = {};
3824
+ this.currentUrl = currentUrl();
3823
3825
  // Selects items in the grid based on passed on data
3824
3826
  this.selectedRows = [];
3825
3827
  this.setGridRefreshTime = 0;
@@ -3882,8 +3884,6 @@
3882
3884
  this.reportButtons = [];
3883
3885
  this.rowHover = false;
3884
3886
  this.hideFilterOptions = false;
3885
- // Sets pagenation for the table Data.
3886
- this.setPaginationLength = [5, 10, 15, { showAll: 'All' }];
3887
3887
  // set the change in the rowData
3888
3888
  this.rowsChange = new i0.EventEmitter();
3889
3889
  // Input decorator to receive columns to be displayed in header
@@ -3899,6 +3899,8 @@
3899
3899
  this.pagination = false;
3900
3900
  // Optional prop to handle show CurrentPage Report
3901
3901
  this.showCurrentPageReport = false;
3902
+ // Displays total number of records
3903
+ this.totalRecords = 0;
3902
3904
  // Displays aggregate that fetch from records
3903
3905
  this.aggregatedResult = [];
3904
3906
  this.showconfirmDialog = true;
@@ -3944,6 +3946,7 @@
3944
3946
  // set the row When adding the new Row on Grid
3945
3947
  this.onGridRowAdd = new i0.EventEmitter();
3946
3948
  this.isGridHidden = false;
3949
+ this.rowsPerPageOptions = [5, 10, 15, { showAll: 'All' }];
3947
3950
  }
3948
3951
  Object.defineProperty(GridComponent.prototype, "activeTestMode", {
3949
3952
  set: function (val) {
@@ -3954,6 +3957,20 @@
3954
3957
  enumerable: false,
3955
3958
  configurable: true
3956
3959
  });
3960
+ Object.defineProperty(GridComponent.prototype, "setPaginationLength", {
3961
+ // Sets pagenation for the table Data.
3962
+ set: function (value) {
3963
+ if (value === null || value === void 0 ? void 0 : value.length) {
3964
+ this.rowsPerPageOptions = value;
3965
+ if (this.defaultRowNumber && !this.rowsPerPageOptions.includes(this.defaultRowNumber)) {
3966
+ this.rowsPerPageOptions.unshift(this.defaultRowNumber);
3967
+ }
3968
+ }
3969
+ },
3970
+ enumerable: false,
3971
+ configurable: true
3972
+ });
3973
+ ;
3957
3974
  Object.defineProperty(GridComponent.prototype, "rows", {
3958
3975
  /**
3959
3976
  * Stops the loader and sets the data to grid
@@ -3968,30 +3985,31 @@
3968
3985
  if (!this.dataKey) {
3969
3986
  this.dataKey = 'id';
3970
3987
  }
3971
- this.rowsData = this.gridService.setDataFields(data, this.dataKey);
3988
+ if ((data === null || data === void 0 ? void 0 : data.length) > 50 && !this.pagination) {
3989
+ var rowsData_1 = this.gridService.setDataFields(data, this.dataKey);
3990
+ var initializeData = __spreadArray([], __read(rowsData_1));
3991
+ this.rowsData = initializeData.splice(1, 40);
3992
+ setTimeout(function () {
3993
+ _this.rowsData = rowsData_1;
3994
+ }, 100);
3995
+ }
3996
+ else {
3997
+ this.rowsData = this.gridService.setDataFields(data, this.dataKey);
3998
+ }
3999
+ this.editRowsRecords = {};
4000
+ if (this.selectedRows) {
4001
+ setTimeout(function () {
4002
+ var selectedElementRef = _this.gridRow.find(function (x) { return x.nativeElement.id === _this.selectedRows[_this.dataKey]; });
4003
+ selectedElementRef &&
4004
+ selectedElementRef.nativeElement.scrollIntoView({ behavior: 'smooth' });
4005
+ }, 0);
4006
+ }
4007
+ //manipulate checkbox string value to true and false.
4008
+ this.changeCheckboxStringValue();
3972
4009
  }
3973
4010
  else {
3974
4011
  this.rowsData = [];
3975
4012
  }
3976
- // Cleaning the editing stack
3977
- // this.editingRowKeys = {};
3978
- this.editRowsRecords = {};
3979
- setTimeout(function () {
3980
- if (data && data.length > 0 && _this.selectedRows) {
3981
- var selectedElementRef = _this.gridRow.find(function (x) { return x.nativeElement.id === _this.selectedRows[_this.dataKey]; });
3982
- selectedElementRef &&
3983
- selectedElementRef.nativeElement.scrollIntoView({ behavior: 'smooth' });
3984
- }
3985
- }, 0);
3986
- if (this.columns && this.columns.length > 0) {
3987
- this.columns.forEach(function (column) {
3988
- if (column.type === exports.EGridColumnType.DROPDOWN && _this.setDropdowndataValue) {
3989
- _this.setDropdownValue(column, {}, false);
3990
- }
3991
- });
3992
- }
3993
- //manipulate checkbox string value to true and false.
3994
- this.changeCheckboxStringValue();
3995
4013
  }
3996
4014
  },
3997
4015
  enumerable: false,
@@ -4041,13 +4059,13 @@
4041
4059
  return serverFilterValues.filters.find(function (x) { return x.field === field; });
4042
4060
  });
4043
4061
  serverFilterValues.filters = serverFilterValues.filters.filter(function (obj) { var _a, _b; return (obj === null || obj === void 0 ? void 0 : obj.value) && ((_b = (_a = obj.value) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.length) > 0 && obj.field; });
4044
- this.gridService.softCachingFilters[((_c = this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id) + currentUrl()] = serverFilterValues;
4062
+ this.gridService.softCachingFilters[((_c = this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id) + this.currentUrl] = serverFilterValues;
4045
4063
  if (this.gridService.applyFilterEvent || this.autoLoadData === true) {
4046
4064
  // setting pagination page as first
4047
4065
  serverFilterValues.page = 1;
4048
4066
  this.autoLoadData = true;
4049
- if (this.defaultRows && this.pagination) {
4050
- serverFilterValues.pageSize = this.defaultRows;
4067
+ if (this.defaultRowNumber && this.pagination) {
4068
+ serverFilterValues.pageSize = this.defaultRowNumber;
4051
4069
  }
4052
4070
  if (this.gridService.applyFilterEvent) {
4053
4071
  this.isCheckBoxChangeEventCalled = false;
@@ -4063,6 +4081,20 @@
4063
4081
  enumerable: false,
4064
4082
  configurable: true
4065
4083
  });
4084
+ Object.defineProperty(GridComponent.prototype, "defaultRows", {
4085
+ // Sets number of rows to be shown the grid
4086
+ set: function (value) {
4087
+ if (value) {
4088
+ this.defaultRowNumber = value;
4089
+ if (!this.rowsPerPageOptions.includes(this.defaultRowNumber)) {
4090
+ this.rowsPerPageOptions.unshift(this.defaultRowNumber);
4091
+ }
4092
+ }
4093
+ },
4094
+ enumerable: false,
4095
+ configurable: true
4096
+ });
4097
+ ;
4066
4098
  Object.defineProperty(GridComponent.prototype, "selectedColumns", {
4067
4099
  get: function () {
4068
4100
  return this._selectedColumns;
@@ -4204,11 +4236,7 @@
4204
4236
  this.allowCaching = this.pagination;
4205
4237
  }
4206
4238
  else if ((_a = this.componentTableRef) === null || _a === void 0 ? void 0 : _a.id) {
4207
- localStorage.removeItem('SetFilters-' + ((_b = this.componentTableRef) === null || _b === void 0 ? void 0 : _b.id) + currentUrl());
4208
- }
4209
- // add defaultRow in pagination array
4210
- if (!this.setPaginationLength.includes(this.defaultRows)) {
4211
- this.setPaginationLength.unshift(this.defaultRows);
4239
+ localStorage.removeItem('SetFilters-' + ((_b = this.componentTableRef) === null || _b === void 0 ? void 0 : _b.id) + this.currentUrl);
4212
4240
  }
4213
4241
  var hasColumns = this.columns && this.columns.length > 0;
4214
4242
  if (hasColumns) {
@@ -4275,10 +4303,10 @@
4275
4303
  }
4276
4304
  var searchFilters;
4277
4305
  if (!_this.softCaching && ((_c = _this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id)) {
4278
- searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + currentUrl()));
4306
+ searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + _this.currentUrl));
4279
4307
  }
4280
4308
  else if ((_e = _this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) {
4281
- searchFilters = _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + currentUrl()];
4309
+ searchFilters = _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + _this.currentUrl];
4282
4310
  }
4283
4311
  if (!_this.hideFilter &&
4284
4312
  searchFilters &&
@@ -4445,7 +4473,7 @@
4445
4473
  };
4446
4474
  // set the format of currency && number && decimal && percent
4447
4475
  GridComponent.prototype.setNumericFormat = function (column, row) {
4448
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
4476
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
4449
4477
  row = objConvertToLower(row);
4450
4478
  var value = ((_a = row[column.field + '_obj']) === null || _a === void 0 ? void 0 : _a.displayText)
4451
4479
  ? (_b = row[column.field + '_obj']) === null || _b === void 0 ? void 0 : _b.displayText
@@ -4454,20 +4482,20 @@
4454
4482
  : row[(_g = column.displayField) === null || _g === void 0 ? void 0 : _g.toLowerCase()]
4455
4483
  ? row[column.displayField.toLowerCase()]
4456
4484
  : (((_j = row[((_h = column.field) === null || _h === void 0 ? void 0 : _h.toLowerCase()) + '_obj']) === null || _j === void 0 ? void 0 : _j.text) || ((_l = row[((_k = column.field) === null || _k === void 0 ? void 0 : _k.toLowerCase()) + '_obj']) === null || _l === void 0 ? void 0 : _l.text) === 0 || ((_o = row[((_m = column.field) === null || _m === void 0 ? void 0 : _m.toLowerCase()) + '_obj']) === null || _o === void 0 ? void 0 : _o.text) === null)
4457
- ? (_p = row[column.field.toLowerCase() + '_obj']) === null || _p === void 0 ? void 0 : _p.text : row[column.field.toLowerCase()];
4485
+ ? (_q = row[((_p = column.field) === null || _p === void 0 ? void 0 : _p.toLowerCase()) + '_obj']) === null || _q === void 0 ? void 0 : _q.text : row[(_r = column.field) === null || _r === void 0 ? void 0 : _r.toLowerCase()];
4458
4486
  if (this.typeOf(value) === 'number' && value === 0) {
4459
4487
  value = value.toString();
4460
4488
  }
4461
- var formatParams = (_q = column.format) === null || _q === void 0 ? void 0 : _q.formatParams;
4489
+ var formatParams = (_s = column.format) === null || _s === void 0 ? void 0 : _s.formatParams;
4462
4490
  var digitsInfo = formatParams === null || formatParams === void 0 ? void 0 : formatParams.digitsInfo;
4463
4491
  if (column.format && value) {
4464
- switch ((_r = column.format) === null || _r === void 0 ? void 0 : _r.type) {
4492
+ switch ((_t = column.format) === null || _t === void 0 ? void 0 : _t.type) {
4465
4493
  case exports.EGridFormatType.CURRENCY:
4466
- value = (_s = new Intl.NumberFormat((formatParams === null || formatParams === void 0 ? void 0 : formatParams.locale) ? formatParams.locale : 'en-US', {
4494
+ value = (_u = new Intl.NumberFormat((formatParams === null || formatParams === void 0 ? void 0 : formatParams.locale) ? formatParams.locale : 'en-US', {
4467
4495
  style: 'currency',
4468
4496
  currency: (formatParams === null || formatParams === void 0 ? void 0 : formatParams.currency) ? formatParams.currency : 'USD',
4469
4497
  minimumFractionDigits: digitsInfo ? digitsInfo : '2',
4470
- })) === null || _s === void 0 ? void 0 : _s.format(value);
4498
+ })) === null || _u === void 0 ? void 0 : _u.format(value);
4471
4499
  break;
4472
4500
  case exports.EGridFormatType.DECIMAL:
4473
4501
  value = parseFloat(value).toFixed(digitsInfo ? digitsInfo : '2');
@@ -4517,8 +4545,11 @@
4517
4545
  this.rowsData &&
4518
4546
  this.rowsData.length > 0 &&
4519
4547
  this.columns.length > 0) {
4520
- this.rowsData.forEach(function (row) {
4521
- _this.columns.forEach(function (column) {
4548
+ this.columns.forEach(function (column) {
4549
+ if (column.type === exports.EGridColumnType.DROPDOWN && _this.setDropdowndataValue) {
4550
+ _this.setDropdownValue(column, {}, false);
4551
+ }
4552
+ _this.rowsData.forEach(function (row) {
4522
4553
  if (column.type === exports.EGridColumnType.BOOLEAN) {
4523
4554
  if ((typeof (row[column.field] === 'string') &&
4524
4555
  (row[column.field] === '1' || row[column.field] === '0')) ||
@@ -4873,14 +4904,14 @@
4873
4904
  ((_b = _this.serverFilters) === null || _b === void 0 ? void 0 : _b.filters.length) > 0 &&
4874
4905
  (_this.allowCaching || _this.softCaching)) {
4875
4906
  if (!_this.softCaching && ((_c = _this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id)) {
4876
- localStorage.setItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + currentUrl(), JSON.stringify(_this.serverFilters));
4907
+ localStorage.setItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + _this.currentUrl, JSON.stringify(_this.serverFilters));
4877
4908
  }
4878
4909
  else if ((_e = _this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) {
4879
- _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + currentUrl()] = _this.serverFilters;
4910
+ _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + _this.currentUrl] = _this.serverFilters;
4880
4911
  }
4881
4912
  }
4882
4913
  else {
4883
- _this.gridService.softCachingFilters[((_g = _this.componentTableRef) === null || _g === void 0 ? void 0 : _g.id) + currentUrl()] = {};
4914
+ _this.gridService.softCachingFilters[((_g = _this.componentTableRef) === null || _g === void 0 ? void 0 : _g.id) + _this.currentUrl] = {};
4884
4915
  }
4885
4916
  var serverFilterValues = JSON.parse(JSON.stringify(_this.serverFilters));
4886
4917
  serverFilterValues.filters = (_this.serverFilters.filters || []).concat(_this.globalData);
@@ -5960,26 +5991,26 @@
5960
5991
  ((_a = column.filterValue) === null || _a === void 0 ? void 0 : _a.toString().length) === 0) {
5961
5992
  var searchFilters = void 0;
5962
5993
  if (!this.softCaching && ((_b = this.componentTableRef) === null || _b === void 0 ? void 0 : _b.id)) {
5963
- searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_c = this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id) + currentUrl()));
5994
+ searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_c = this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id) + this.currentUrl));
5964
5995
  }
5965
5996
  else if ((_d = this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) {
5966
- searchFilters = this.gridService.softCachingFilters[((_e = this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) + currentUrl()];
5997
+ searchFilters = this.gridService.softCachingFilters[((_e = this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) + this.currentUrl];
5967
5998
  }
5968
5999
  if (searchFilters && searchFilters.filters) {
5969
6000
  if (searchFilters.filters.length > 0) {
5970
6001
  var index = searchFilters.filters.findIndex(function (x) { return x.field === column.field; });
5971
6002
  if (index > -1) {
5972
6003
  if (searchFilters.filters.length === 1 && ((_f = this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id)) {
5973
- this.gridService.softCachingFilters[((_g = this.componentTableRef) === null || _g === void 0 ? void 0 : _g.id) + currentUrl()] = [];
5974
- localStorage.removeItem('SetFilters-' + ((_h = this.componentTableRef) === null || _h === void 0 ? void 0 : _h.id) + currentUrl());
6004
+ this.gridService.softCachingFilters[((_g = this.componentTableRef) === null || _g === void 0 ? void 0 : _g.id) + this.currentUrl] = [];
6005
+ localStorage.removeItem('SetFilters-' + ((_h = this.componentTableRef) === null || _h === void 0 ? void 0 : _h.id) + this.currentUrl);
5975
6006
  }
5976
6007
  else {
5977
6008
  searchFilters.filters.splice(index, 1);
5978
6009
  if (!this.softCaching && ((_j = this.componentTableRef) === null || _j === void 0 ? void 0 : _j.id)) {
5979
- localStorage.setItem('SetFilters-' + ((_k = this.componentTableRef) === null || _k === void 0 ? void 0 : _k.id) + currentUrl(), JSON.stringify(searchFilters));
6010
+ localStorage.setItem('SetFilters-' + ((_k = this.componentTableRef) === null || _k === void 0 ? void 0 : _k.id) + this.currentUrl, JSON.stringify(searchFilters));
5980
6011
  }
5981
6012
  else if ((_l = this.componentTableRef) === null || _l === void 0 ? void 0 : _l.id) {
5982
- this.gridService.softCachingFilters[((_m = this.componentTableRef) === null || _m === void 0 ? void 0 : _m.id) + currentUrl()] = searchFilters;
6013
+ this.gridService.softCachingFilters[((_m = this.componentTableRef) === null || _m === void 0 ? void 0 : _m.id) + this.currentUrl] = searchFilters;
5983
6014
  }
5984
6015
  }
5985
6016
  }
@@ -9771,14 +9802,37 @@
9771
9802
  this.selectDate(dateRange, false);
9772
9803
  }
9773
9804
  };
9805
+ SeGlobalFilterComponent.prototype.containsWhitespace = function (str) {
9806
+ return str.includes(' ');
9807
+ };
9808
+ SeGlobalFilterComponent.prototype.addSpacesatfirst = function (x) {
9809
+ return " " + x;
9810
+ };
9811
+ SeGlobalFilterComponent.prototype.addSpacesatlast = function (x) {
9812
+ return x + " ";
9813
+ };
9774
9814
  // change calendar format on run time if user type date on the calendar field.
9775
9815
  SeGlobalFilterComponent.prototype.calendarFocusEvent = function (globalFilter, event) {
9776
9816
  var _this = this;
9777
9817
  var _a, _b, _c, _d, _e;
9778
9818
  (_a = document.getElementsByClassName(globalFilter.displayText)[0]) === null || _a === void 0 ? void 0 : _a.addEventListener('keyup', function (a) {
9779
- var _a, _b, _c;
9819
+ var _a, _b, _c, _d, _e, _f, _g;
9780
9820
  var year = (_c = (_b = (_a = a === null || a === void 0 ? void 0 : a.target) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) === null || _c === void 0 ? void 0 : _c.split('/')[2];
9781
9821
  year = year === null || year === void 0 ? void 0 : year.toString().split(" ")[0];
9822
+ var dateRangeValue = ((_e = (_d = a === null || a === void 0 ? void 0 : a.target) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.includes('-')) ? (_g = (_f = a === null || a === void 0 ? void 0 : a.target) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.split('-') : '';
9823
+ // adding space between from and to date in date range filter
9824
+ if (dateRangeValue.length == 2 && dateRangeValue[1].split('/').length == 3 && (!_this.containsWhitespace(dateRangeValue[0]) || !_this.containsWhitespace(dateRangeValue[1]))) {
9825
+ if (!_this.containsWhitespace(dateRangeValue[0])) {
9826
+ var fromDate = _this.addSpacesatlast(dateRangeValue[0]);
9827
+ dateRangeValue[0] = fromDate;
9828
+ }
9829
+ if (!_this.containsWhitespace(dateRangeValue[1])) {
9830
+ var toDate = _this.addSpacesatfirst(dateRangeValue[1]);
9831
+ dateRangeValue[1] = toDate;
9832
+ }
9833
+ var alue = dateRangeValue[0] + '-' + dateRangeValue[1];
9834
+ a.target.value = alue;
9835
+ }
9782
9836
  if ((year === null || year === void 0 ? void 0 : year.length) === 4) {
9783
9837
  _this.calendarFormat = 'mm/dd/yy';
9784
9838
  if (globalFilter.type === exports.GridFilterControlType.CALENDAR) {