@churchillliving/se-ui-toolkit 6.53.960 → 6.53.962

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.
@@ -10,7 +10,7 @@ import { DialogService } from 'primeng/dynamicdialog';
10
10
  import * as i2$1 from '@angular/common';
11
11
  import { formatDate, CommonModule, DecimalPipe, DatePipe } from '@angular/common';
12
12
  import { Subject, throwError, interval, Subscription } from 'rxjs';
13
- import { map, catchError, take } from 'rxjs/operators';
13
+ import { map, catchError, take, takeUntil } from 'rxjs/operators';
14
14
  import * as i1$1 from '@angular/common/http';
15
15
  import * as i2 from '@angular/router';
16
16
  import * as i3 from 'primeng/button';
@@ -5947,6 +5947,7 @@ class GridComponent {
5947
5947
  this.showFilterbtn = false;
5948
5948
  this.userSetting = {};
5949
5949
  this.rowUpdateChange = false;
5950
+ this.isServerSideEventInitalTriggered = new Subject();
5950
5951
  //apply Add/Delete/Edit prop for the grid permission
5951
5952
  this.addRowPermission = true;
5952
5953
  this.deleteRowPermission = true;
@@ -6094,7 +6095,6 @@ class GridComponent {
6094
6095
  this.onGridRowAdd = new EventEmitter();
6095
6096
  this.gridName = '';
6096
6097
  this.isGridHidden = false;
6097
- this.serverEventsource = interval(this.columns?.length ? 0 : 5000);
6098
6098
  this.rowsPerPageOptions = [5, 10, 15, { showAll: 'All' }];
6099
6099
  }
6100
6100
  consoleLog(message) {
@@ -6709,7 +6709,7 @@ class GridComponent {
6709
6709
  defaultRowClick() {
6710
6710
  //console.log('in defaultrowClick', this.userSearched)
6711
6711
  if (this.columns?.length > 0 && this.rowsData && this.rowsData.length === 1 && this.onRowClick.observers?.length && this.gridService.userSearched) {
6712
- // console.log(this.rowsData, )
6712
+ this.gridService.userSearched = false;
6713
6713
  this.handleRowClick(this.rowsData[0]);
6714
6714
  }
6715
6715
  }
@@ -7044,55 +7044,59 @@ class GridComponent {
7044
7044
  * Triggers everytime a server side filter is trigger
7045
7045
  */
7046
7046
  handleServerSideEvents(event) {
7047
- this.gridfilter = event;
7048
- this.intervalSubscription = this.serverEventsource.subscribe((val) => {
7049
- this.intervalSubscription?.unsubscribe();
7050
- if (this.selectedColumns && this.selectedColumns.length > 0) {
7051
- this.selectedColumns.forEach((x) => {
7052
- if (event.filters[x.field]) {
7053
- event.filters[x.field].value = x.type === EGridColumnType.MULTISELECT ? x.filterValue?.toString() : x.filterValue;
7054
- }
7055
- });
7056
- }
7057
- this.loading = this.autoLoadData;
7058
- this.serverFilters = {
7059
- filters: this.lookupFilters
7060
- ? this.gridService.getGridFilters(event, this.selectedColumns)
7061
- : this.gridService.prepareBasicFilters(event, this.selectedColumns),
7062
- sorts: this.gridService.getGridSorts(event, this.selectedColumns),
7063
- ...(this.pagination && {
7064
- page: this.gridService.getGridPagination(event),
7065
- pageSize: event.rows || 10,
7066
- }),
7067
- };
7068
- if (this.serverFilters?.filters &&
7069
- this.serverFilters?.filters.length > 0 &&
7070
- (this.allowCaching || this.softCaching)) {
7071
- if (!this.softCaching && this.componentTableRef?.id) {
7072
- localStorage.setItem('SetFilters-' + this.componentTableRef?.id + this.currentUrl, JSON.stringify(this.serverFilters));
7073
- }
7074
- else if (this.componentTableRef?.id) {
7075
- this.gridService.softCachingFilters[this.componentTableRef?.id + this.currentUrl] = this.serverFilters;
7047
+ this.ngZone.onStable
7048
+ .pipe(takeUntil(this.isServerSideEventInitalTriggered))
7049
+ .subscribe(() => {
7050
+ if (this.columns?.length) {
7051
+ this.isServerSideEventInitalTriggered.next();
7052
+ this.gridfilter = event;
7053
+ if (this.selectedColumns && this.selectedColumns.length > 0) {
7054
+ this.selectedColumns.forEach((x) => {
7055
+ if (event.filters[x.field]) {
7056
+ event.filters[x.field].value = x.type === EGridColumnType.MULTISELECT ? x.filterValue?.toString() : x.filterValue;
7057
+ }
7058
+ });
7076
7059
  }
7077
- }
7078
- else {
7079
- this.gridService.softCachingFilters[this.componentTableRef?.id + this.currentUrl] = {};
7080
- }
7081
- const serverFilterValues = JSON.parse(JSON.stringify(this.serverFilters));
7082
- serverFilterValues.filters = (this.serverFilters.filters || []).concat(this.globalData);
7083
- this.isCheckBoxChangeEventCalled = false;
7084
- this.gridService.rowUpdate = false;
7085
- let containsEmptyField = true;
7086
- while (containsEmptyField) {
7087
- const index = serverFilterValues.filters.findIndex((filter) => !filter.field);
7088
- if (index > -1) {
7089
- serverFilterValues.filters.splice(index, 1);
7060
+ this.loading = this.autoLoadData;
7061
+ this.serverFilters = {
7062
+ filters: this.lookupFilters
7063
+ ? this.gridService.getGridFilters(event, this.selectedColumns)
7064
+ : this.gridService.prepareBasicFilters(event, this.selectedColumns),
7065
+ sorts: this.gridService.getGridSorts(event, this.selectedColumns),
7066
+ ...(this.pagination && {
7067
+ page: this.gridService.getGridPagination(event),
7068
+ pageSize: event.rows || 10,
7069
+ }),
7070
+ };
7071
+ if (this.serverFilters?.filters &&
7072
+ this.serverFilters?.filters.length > 0 &&
7073
+ (this.allowCaching || this.softCaching)) {
7074
+ if (!this.softCaching && this.componentTableRef?.id) {
7075
+ localStorage.setItem('SetFilters-' + this.componentTableRef?.id + this.currentUrl, JSON.stringify(this.serverFilters));
7076
+ }
7077
+ else if (this.componentTableRef?.id) {
7078
+ this.gridService.softCachingFilters[this.componentTableRef?.id + this.currentUrl] = this.serverFilters;
7079
+ }
7090
7080
  }
7091
7081
  else {
7092
- containsEmptyField = false;
7082
+ this.gridService.softCachingFilters[this.componentTableRef?.id + this.currentUrl] = {};
7083
+ }
7084
+ const serverFilterValues = JSON.parse(JSON.stringify(this.serverFilters));
7085
+ serverFilterValues.filters = (this.serverFilters.filters || []).concat(this.globalData);
7086
+ this.isCheckBoxChangeEventCalled = false;
7087
+ this.gridService.rowUpdate = false;
7088
+ let containsEmptyField = true;
7089
+ while (containsEmptyField) {
7090
+ const index = serverFilterValues.filters.findIndex((filter) => !filter.field);
7091
+ if (index > -1) {
7092
+ serverFilterValues.filters.splice(index, 1);
7093
+ }
7094
+ else {
7095
+ containsEmptyField = false;
7096
+ }
7093
7097
  }
7098
+ this.onServerSideEventChange.emit(serverFilterValues);
7094
7099
  }
7095
- this.onServerSideEventChange.emit(serverFilterValues);
7096
7100
  });
7097
7101
  }
7098
7102
  /**