@churchillliving/se-ui-toolkit 6.53.190 → 6.53.192

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.
@@ -3467,6 +3467,7 @@
3467
3467
  this.inEditMode = false;
3468
3468
  this.saveRecordArray = [];
3469
3469
  this.disabledSaveBtn = false;
3470
+ this.isFilterApplied = false;
3470
3471
  this.editModeChecked = true;
3471
3472
  this.editModeunCkecked = false;
3472
3473
  this.calendarFormat = 'mm/dd/y';
@@ -3625,35 +3626,41 @@
3625
3626
  */
3626
3627
  set: function (data) {
3627
3628
  var _this = this;
3629
+ var _a;
3628
3630
  this.loading = false;
3629
- if (data && data.length > 0) {
3630
- if (!this.dataKey) {
3631
- this.dataKey = 'id';
3631
+ if (!((_a = this.rowsData) === null || _a === void 0 ? void 0 : _a.length) || this.isFilterApplied) {
3632
+ if (this.isFilterApplied) {
3633
+ this.isFilterApplied = false;
3632
3634
  }
3633
- this.rowsData = this.gridService.setDataFields(data, this.dataKey);
3634
- }
3635
- else {
3636
- this.rowsData = [];
3637
- }
3638
- // Cleaning the editing stack
3639
- // this.editingRowKeys = {};
3640
- this.editRowsRecords = {};
3641
- setTimeout(function () {
3642
- if (data && data.length > 0 && _this.selectedRows) {
3643
- var selectedElementRef = _this.gridRow.find(function (x) { return x.nativeElement.id === _this.selectedRows[_this.dataKey]; });
3644
- selectedElementRef &&
3645
- selectedElementRef.nativeElement.scrollIntoView({ behavior: 'smooth' });
3635
+ if (data && data.length > 0) {
3636
+ if (!this.dataKey) {
3637
+ this.dataKey = 'id';
3638
+ }
3639
+ this.rowsData = this.gridService.setDataFields(data, this.dataKey);
3646
3640
  }
3647
- }, 0);
3648
- if (this.columns && this.columns.length > 0) {
3649
- this.columns.forEach(function (column) {
3650
- if (column.type === exports.EGridColumnType.DROPDOWN && _this.setDropdowndataValue) {
3651
- _this.setDropdownValue(column, {}, false);
3641
+ else {
3642
+ this.rowsData = [];
3643
+ }
3644
+ // Cleaning the editing stack
3645
+ // this.editingRowKeys = {};
3646
+ this.editRowsRecords = {};
3647
+ setTimeout(function () {
3648
+ if (data && data.length > 0 && _this.selectedRows) {
3649
+ var selectedElementRef = _this.gridRow.find(function (x) { return x.nativeElement.id === _this.selectedRows[_this.dataKey]; });
3650
+ selectedElementRef &&
3651
+ selectedElementRef.nativeElement.scrollIntoView({ behavior: 'smooth' });
3652
3652
  }
3653
- });
3653
+ }, 0);
3654
+ if (this.columns && this.columns.length > 0) {
3655
+ this.columns.forEach(function (column) {
3656
+ if (column.type === exports.EGridColumnType.DROPDOWN && _this.setDropdowndataValue) {
3657
+ _this.setDropdownValue(column, {}, false);
3658
+ }
3659
+ });
3660
+ }
3661
+ //manipulate checkbox string value to true and false.
3662
+ this.changeCheckboxStringValue();
3654
3663
  }
3655
- //manipulate checkbox string value to true and false.
3656
- this.changeCheckboxStringValue();
3657
3664
  },
3658
3665
  enumerable: false,
3659
3666
  configurable: true
@@ -3710,6 +3717,7 @@
3710
3717
  serverFilterValues.pageSize = _this.defaultRows;
3711
3718
  }
3712
3719
  if (_this.gridService.applyFilterEvent) {
3720
+ _this.isFilterApplied = true;
3713
3721
  _this.onServerSideEventChange.emit(serverFilterValues);
3714
3722
  }
3715
3723
  localStorage.removeItem('applyFilter');
@@ -3862,152 +3870,165 @@
3862
3870
  };
3863
3871
  GridComponent.prototype.ngOnChanges = function (change) {
3864
3872
  var _this = this;
3865
- var _a, _b, _c, _d, _e, _f;
3866
- if (this.allowCaching !== false && this.pagination) {
3867
- this.allowCaching = this.pagination;
3868
- }
3869
- else if ((_a = this.componentTableRef) === null || _a === void 0 ? void 0 : _a.id) {
3870
- localStorage.removeItem('SetFilters-' + ((_b = this.componentTableRef) === null || _b === void 0 ? void 0 : _b.id) + currentUrl());
3871
- }
3872
- // add defaultRow in pagination array
3873
- if (!this.setPaginationLength.includes(this.defaultRows)) {
3874
- this.setPaginationLength.unshift(this.defaultRows);
3875
- }
3876
- var hasColumns = this.columns && this.columns.length > 0;
3877
- if (hasColumns) {
3878
- this.columns = this.gridService.setColumnFields(this.columns);
3879
- }
3880
- this.roles = this.authService.getUserRoles();
3881
- // apply user role permissions on grid columns
3882
- this.applyColumnsPermissions();
3883
- // apply global permissions on entire grid
3884
- this.applyGridPermissions();
3885
- this._selectedColumns = (_c = this.columns) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return !x.hidden; });
3886
- this.cd.detectChanges();
3887
- if (hasColumns) {
3888
- this.columns = this.gridService.setColumnFields(this.columns);
3889
- // checking filter exist or not
3890
- var filter = this._selectedColumns.some(function (column) { return column.filtering === undefined || column.filtering === true; });
3891
- if (filter === false) {
3892
- this.hideFilter = true;
3873
+ var _a, _b, _c, _d, _e, _f, _g;
3874
+ if (!((_a = this.rowsData) === null || _a === void 0 ? void 0 : _a.length) || change.columns) {
3875
+ if (this.allowCaching !== false && this.pagination) {
3876
+ this.allowCaching = this.pagination;
3893
3877
  }
3894
- this.columns.forEach(function (column) {
3895
- var _a, _b, _c, _d, _e, _f;
3896
- // set isRequired true for required column to show astric in column header
3897
- if ((_a = column.validations) === null || _a === void 0 ? void 0 : _a.find(function (validation) { return validation.type == exports.EGridValidator.REQUIRED; })) {
3898
- column.isRequired = true;
3899
- }
3900
- // set numeric null or undefine data default value
3901
- if (column.type === exports.EGridColumnType.NUMERIC && column.value && ((_b = _this.rowsData) === null || _b === void 0 ? void 0 : _b.length) > 0) {
3902
- _this.rowsData.forEach(function (row) {
3903
- if (column.value && (row[column.field] === null || row[column.field] === undefined)) {
3904
- row[column.field] = column.value;
3905
- }
3906
- });
3878
+ else if ((_b = this.componentTableRef) === null || _b === void 0 ? void 0 : _b.id) {
3879
+ localStorage.removeItem('SetFilters-' + ((_c = this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id) + currentUrl());
3880
+ }
3881
+ // add defaultRow in pagination array
3882
+ if (!this.setPaginationLength.includes(this.defaultRows)) {
3883
+ this.setPaginationLength.unshift(this.defaultRows);
3884
+ }
3885
+ var hasColumns = this.columns && this.columns.length > 0;
3886
+ if (hasColumns) {
3887
+ this.columns = this.gridService.setColumnFields(this.columns);
3888
+ }
3889
+ this.roles = this.authService.getUserRoles();
3890
+ // apply user role permissions on grid columns
3891
+ this.applyColumnsPermissions();
3892
+ // apply global permissions on entire grid
3893
+ this.applyGridPermissions();
3894
+ this._selectedColumns = (_d = this.columns) === null || _d === void 0 ? void 0 : _d.filter(function (x) { return !x.hidden; });
3895
+ this.cd.detectChanges();
3896
+ if (hasColumns) {
3897
+ this.columns = this.gridService.setColumnFields(this.columns);
3898
+ // checking filter exist or not
3899
+ var filter = this._selectedColumns.some(function (column) { return column.filtering === undefined || column.filtering === true; });
3900
+ if (filter === false) {
3901
+ this.hideFilter = true;
3907
3902
  }
3908
- // convert string time into the date
3909
- if (column.type === exports.EGridColumnType.DATE) {
3910
- if (column.timeOnly === true) {
3903
+ this.columns.forEach(function (column) {
3904
+ var _a, _b, _c, _d, _e, _f;
3905
+ // set isRequired true for required column to show astric in column header
3906
+ if ((_a = column.validations) === null || _a === void 0 ? void 0 : _a.find(function (validation) { return validation.type == exports.EGridValidator.REQUIRED; })) {
3907
+ column.isRequired = true;
3908
+ }
3909
+ // set numeric null or undefine data default value
3910
+ if (column.type === exports.EGridColumnType.NUMERIC && column.value && ((_b = _this.rowsData) === null || _b === void 0 ? void 0 : _b.length) > 0) {
3911
3911
  _this.rowsData.forEach(function (row) {
3912
- if (row[column.field] &&
3913
- (row[column.field].toString().includes('PM') ||
3914
- row[column.field].toString().includes('AM'))) {
3915
- row[column.field] = setTimeInDate(row[column.field]);
3912
+ if (column.value && (row[column.field] === null || row[column.field] === undefined)) {
3913
+ row[column.field] = column.value;
3916
3914
  }
3917
3915
  });
3918
3916
  }
3919
- else if (!column.minutesInterval) {
3920
- _this.rowsData.forEach(function (row) {
3917
+ // convert string time into the date
3918
+ if (column.type === exports.EGridColumnType.DATE) {
3919
+ if (column.timeOnly === true) {
3920
+ _this.rowsData.forEach(function (row) {
3921
+ if (row[column.field] &&
3922
+ (row[column.field].toString().includes('PM') ||
3923
+ row[column.field].toString().includes('AM'))) {
3924
+ row[column.field] = setTimeInDate(row[column.field]);
3925
+ }
3926
+ });
3927
+ }
3928
+ else if (!column.minutesInterval) {
3929
+ _this.rowsData.forEach(function (row) {
3930
+ var _a;
3931
+ if (row[column.field] && row[column.field].action) {
3932
+ row[column.field] = new Date((_a = row[column.field]) === null || _a === void 0 ? void 0 : _a.text);
3933
+ }
3934
+ else if (row[column.field]) {
3935
+ row[column.field] = new Date(row[column.field]);
3936
+ }
3937
+ });
3938
+ }
3939
+ }
3940
+ // set filter value
3941
+ if (column.filter && column.value && column.filtering !== false) {
3942
+ _this.setFilterFocusOut(column);
3943
+ }
3944
+ // add "flex-shrink: 0" for flex-basis Style
3945
+ if (column.style && column.style.includes('flex-basis')) {
3946
+ var style = column.style + ' !important; flex-shrink: 0 !important';
3947
+ column.style = style.includes(';;')
3948
+ ? style.replace(';;', ';')
3949
+ : style;
3950
+ }
3951
+ // set DisplayText when value is in curly brackets.
3952
+ _this.setDisplayTextValue(column);
3953
+ //Aggregate scenario
3954
+ if (column.aggregate && column.aggregate.length > 0) {
3955
+ _this.aggregateFooter = true;
3956
+ _this.setAggregateText(column);
3957
+ }
3958
+ var searchFilters;
3959
+ if (!_this.softCaching && ((_c = _this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id)) {
3960
+ searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + currentUrl()));
3961
+ }
3962
+ else if ((_e = _this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) {
3963
+ searchFilters = _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + currentUrl()];
3964
+ }
3965
+ if (!_this.hideFilter &&
3966
+ searchFilters &&
3967
+ searchFilters.filters &&
3968
+ searchFilters.filters.length > 0) {
3969
+ searchFilters.filters.forEach(function (x) {
3921
3970
  var _a;
3922
- if (row[column.field] && row[column.field].action) {
3923
- row[column.field] = new Date((_a = row[column.field]) === null || _a === void 0 ? void 0 : _a.text);
3924
- }
3925
- else if (row[column.field]) {
3926
- row[column.field] = new Date(row[column.field]);
3971
+ if (x.value && x.field === column.field) {
3972
+ if (((_a = column === null || column === void 0 ? void 0 : column.filter) === null || _a === void 0 ? void 0 : _a.type) === 'calendar') {
3973
+ column.value = new Date(_this.datePipe.transform(x.value, 'MM-dd-YY'));
3974
+ }
3975
+ else {
3976
+ column.value = x.value;
3977
+ }
3927
3978
  }
3928
3979
  });
3929
3980
  }
3930
- }
3931
- // set filter value
3932
- if (column.filter && column.value && column.filtering !== false) {
3933
- _this.setFilterFocusOut(column);
3934
- }
3935
- // add "flex-shrink: 0" for flex-basis Style
3936
- if (column.style && column.style.includes('flex-basis')) {
3937
- var style = column.style + ' !important; flex-shrink: 0 !important';
3938
- column.style = style.includes(';;')
3939
- ? style.replace(';;', ';')
3940
- : style;
3941
- }
3942
- // set DisplayText when value is in curly brackets.
3943
- _this.setDisplayTextValue(column);
3944
- //Aggregate scenario
3945
- if (column.aggregate && column.aggregate.length > 0) {
3946
- _this.aggregateFooter = true;
3947
- _this.setAggregateText(column);
3948
- }
3949
- var searchFilters;
3950
- if (!_this.softCaching && ((_c = _this.componentTableRef) === null || _c === void 0 ? void 0 : _c.id)) {
3951
- searchFilters = JSON.parse(localStorage.getItem('SetFilters-' + ((_d = _this.componentTableRef) === null || _d === void 0 ? void 0 : _d.id) + currentUrl()));
3952
- }
3953
- else if ((_e = _this.componentTableRef) === null || _e === void 0 ? void 0 : _e.id) {
3954
- searchFilters = _this.gridService.softCachingFilters[((_f = _this.componentTableRef) === null || _f === void 0 ? void 0 : _f.id) + currentUrl()];
3955
- }
3956
- if (!_this.hideFilter &&
3957
- searchFilters &&
3958
- searchFilters.filters &&
3959
- searchFilters.filters.length > 0) {
3960
- searchFilters.filters.forEach(function (x) {
3961
- var _a;
3962
- if (x.value && x.field === column.field) {
3963
- if (((_a = column === null || column === void 0 ? void 0 : column.filter) === null || _a === void 0 ? void 0 : _a.type) === 'calendar') {
3964
- column.value = new Date(_this.datePipe.transform(x.value, 'MM-dd-YY'));
3981
+ // converting displayField toLowercase
3982
+ if (column.displayField) {
3983
+ column.displayField = column.displayField.toLowerCase();
3984
+ }
3985
+ // set AutoComplete Data
3986
+ if (column.type === exports.EGridColumnType.AUTOCOMPLETE &&
3987
+ _this.rowsData &&
3988
+ _this.rowsData.length > 0) {
3989
+ _this.rowsData.forEach(function (row) {
3990
+ var _3;
3991
+ var _a, _b, _c;
3992
+ // convert string that contains comma into arrays
3993
+ if (row[column.field] &&
3994
+ ((_a = row[column.field]) === null || _a === void 0 ? void 0 : _a.toString().includes(','))) {
3995
+ row[column.field] = (_c = (_b = row[column.field]) === null || _b === void 0 ? void 0 : _b.toString().split(',')) === null || _c === void 0 ? void 0 : _c.map(function (value) {
3996
+ var _3;
3997
+ return (_3 = {}, _3[column.displayField] = value, _3);
3998
+ });
3965
3999
  }
3966
- else {
3967
- column.value = x.value;
4000
+ var key = Object.keys(row).find(function (x) { return x === column.field.toLowerCase(); });
4001
+ // convert simple string into array
4002
+ if (!Array.isArray(row[key]) && row[key]) {
4003
+ row[key] = [(_3 = {}, _3[column.displayField] = row[key], _3)];
3968
4004
  }
4005
+ });
4006
+ }
4007
+ //when we add a new row, it set the default value
4008
+ if (column.value && Object.keys(_this.newGridRow).length > 0) {
4009
+ var key = Object.keys(_this.newGridRow).find(function (x) { return x === column.field; });
4010
+ if (key && key.toLowerCase() === column.field.toLowerCase()) {
4011
+ _this.newGridRow[key] = column.value;
3969
4012
  }
3970
- });
3971
- }
3972
- // converting displayField toLowercase
3973
- if (column.displayField) {
3974
- column.displayField = column.displayField.toLowerCase();
3975
- }
3976
- // set AutoComplete Data
3977
- if (column.type === exports.EGridColumnType.AUTOCOMPLETE &&
3978
- _this.rowsData &&
3979
- _this.rowsData.length > 0) {
3980
- _this.rowsData.forEach(function (row) {
3981
- var _3;
3982
- var _a, _b, _c;
3983
- // convert string that contains comma into arrays
3984
- if (row[column.field] &&
3985
- ((_a = row[column.field]) === null || _a === void 0 ? void 0 : _a.toString().includes(','))) {
3986
- row[column.field] = (_c = (_b = row[column.field]) === null || _b === void 0 ? void 0 : _b.toString().split(',')) === null || _c === void 0 ? void 0 : _c.map(function (value) {
3987
- var _3;
3988
- return (_3 = {}, _3[column.displayField] = value, _3);
3989
- });
3990
- }
3991
- var key = Object.keys(row).find(function (x) { return x === column.field.toLowerCase(); });
3992
- // convert simple string into array
3993
- if (!Array.isArray(row[key]) && row[key]) {
3994
- row[key] = [(_3 = {}, _3[column.displayField] = row[key], _3)];
3995
- }
3996
- });
3997
- }
3998
- //when we add a new row, it set the default value
3999
- if (column.value && Object.keys(_this.newGridRow).length > 0) {
4000
- var key = Object.keys(_this.newGridRow).find(function (x) { return x === column.field; });
4001
- if (key && key.toLowerCase() === column.field.toLowerCase()) {
4002
- _this.newGridRow[key] = column.value;
4013
+ }
4014
+ });
4015
+ // Searching scenario
4016
+ if (((_e = change.rows) === null || _e === void 0 ? void 0 : _e.currentValue) && ((_f = change.columns) === null || _f === void 0 ? void 0 : _f.currentValue)) {
4017
+ // Checks either column value is changes (i.e., column hidden scenario)
4018
+ if (JSON.stringify(change.columns.currentValue).toLowerCase() !==
4019
+ JSON.stringify(this.columns).toLowerCase()) {
4020
+ this._selectedColumns = [];
4021
+ this.columns.forEach(function (x, i) {
4022
+ if (!x.hidden) {
4023
+ if (_this.selectedColumns[i]) {
4024
+ x.value = _this.selectedColumns[i].value;
4025
+ }
4026
+ _this._selectedColumns.push(x);
4027
+ }
4028
+ });
4003
4029
  }
4004
4030
  }
4005
- });
4006
- // Searching scenario
4007
- if (((_d = change.rows) === null || _d === void 0 ? void 0 : _d.currentValue) && ((_e = change.columns) === null || _e === void 0 ? void 0 : _e.currentValue)) {
4008
- // Checks either column value is changes (i.e., column hidden scenario)
4009
- if (JSON.stringify(change.columns.currentValue).toLowerCase() !==
4010
- JSON.stringify(this.columns).toLowerCase()) {
4031
+ else {
4011
4032
  this._selectedColumns = [];
4012
4033
  this.columns.forEach(function (x, i) {
4013
4034
  if (!x.hidden) {
@@ -4018,36 +4039,25 @@
4018
4039
  }
4019
4040
  });
4020
4041
  }
4021
- }
4022
- else {
4023
- this._selectedColumns = [];
4024
- this.columns.forEach(function (x, i) {
4025
- if (!x.hidden) {
4026
- if (_this.selectedColumns[i]) {
4027
- x.value = _this.selectedColumns[i].value;
4028
- }
4029
- _this._selectedColumns.push(x);
4042
+ setTimeout(function () {
4043
+ var _a, _b;
4044
+ var classElement = document.getElementsByClassName('highlighted-row');
4045
+ if (classElement.length > 0) {
4046
+ classElement[0].scrollIntoView();
4030
4047
  }
4031
- });
4048
+ if (_this.editAllRows && ((_a = _this.rowsData) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = _this.columns) === null || _b === void 0 ? void 0 : _b.length) > 0) {
4049
+ _this.editAllRowsAtOnce();
4050
+ }
4051
+ }, 500);
4052
+ }
4053
+ this.setDropdowndataValue = true;
4054
+ var globalSearchbtn = document.getElementById('globalSearchbtn');
4055
+ if (globalSearchbtn) {
4056
+ this.searchGridFilter = false;
4057
+ }
4058
+ if (((_g = this.rowsData) === null || _g === void 0 ? void 0 : _g.length) > 0) {
4059
+ this.rowsDataCopy = JSON.parse(JSON.stringify(this.rowsData));
4032
4060
  }
4033
- setTimeout(function () {
4034
- var _a, _b;
4035
- var classElement = document.getElementsByClassName('highlighted-row');
4036
- if (classElement.length > 0) {
4037
- classElement[0].scrollIntoView();
4038
- }
4039
- if (_this.editAllRows && ((_a = _this.rowsData) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = _this.columns) === null || _b === void 0 ? void 0 : _b.length) > 0) {
4040
- _this.editAllRowsAtOnce();
4041
- }
4042
- }, 500);
4043
- }
4044
- this.setDropdowndataValue = true;
4045
- var globalSearchbtn = document.getElementById('globalSearchbtn');
4046
- if (globalSearchbtn) {
4047
- this.searchGridFilter = false;
4048
- }
4049
- if (((_f = this.rowsData) === null || _f === void 0 ? void 0 : _f.length) > 0) {
4050
- this.rowsDataCopy = JSON.parse(JSON.stringify(this.rowsData));
4051
4061
  }
4052
4062
  };
4053
4063
  // set DisplayText when value is in curly brackets.
@@ -4504,6 +4514,7 @@
4504
4514
  }
4505
4515
  var serverFilterValues = JSON.parse(JSON.stringify(_this.serverFilters));
4506
4516
  serverFilterValues.filters = (_this.serverFilters.filters || []).concat(_this.globalData);
4517
+ _this.isFilterApplied = true;
4507
4518
  _this.onServerSideEventChange.emit(serverFilterValues);
4508
4519
  }, 950);
4509
4520
  };