@smartsoft001-mobilems/angular 2.29.0 → 2.30.0

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.
@@ -1077,6 +1077,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
1077
1077
  }], ctorParameters: () => [] });
1078
1078
 
1079
1079
  class CrudBaseService extends CrudService {
1080
+ constructor() {
1081
+ super(...arguments);
1082
+ this.sortSeed = Math.floor(Math.random() * 100000);
1083
+ }
1080
1084
  downloadPdf(name, id) {
1081
1085
  return fetch(this.config.apiUrl + this.getUrlNameForDetails() + '/' + id + '/pdf')
1082
1086
  .then((resp) => resp.arrayBuffer())
@@ -1100,6 +1104,19 @@ class CrudBaseService extends CrudService {
1100
1104
  page = filter.offset / filter.limit;
1101
1105
  }
1102
1106
  let url = this.getBaseListUrl(page, filter);
1107
+ url = this.initFilters(filter, url);
1108
+ return firstValueFrom(this.http
1109
+ .get(url)
1110
+ .pipe(map((r) => {
1111
+ const response = r;
1112
+ return {
1113
+ data: response.data?.items ?? [],
1114
+ totalCount: response.data?.paginatorDetails?.totalItemsCount ?? 0,
1115
+ links: {},
1116
+ };
1117
+ }), catchError(this.handleError)));
1118
+ }
1119
+ initFilters(filter, url) {
1103
1120
  if (filter?.searchText) {
1104
1121
  url += `&filter[phrase]=${filter.searchText}`;
1105
1122
  }
@@ -1107,7 +1124,7 @@ class CrudBaseService extends CrudService {
1107
1124
  url += `&sort=${filter.sortBy}-${filter.sortDesc ? 'desc' : 'asc'}`;
1108
1125
  }
1109
1126
  else {
1110
- url += `&sort=random`;
1127
+ url += `&sort=random&sortSeed=${this.sortSeed}`;
1111
1128
  }
1112
1129
  filter?.query?.forEach((q) => {
1113
1130
  const isArray = Array.isArray(q.value);
@@ -1120,16 +1137,7 @@ class CrudBaseService extends CrudService {
1120
1137
  url += `&filter[${q.key}]${this.getQueryType(q.type, false)}=${q.value}`;
1121
1138
  }
1122
1139
  });
1123
- return firstValueFrom(this.http
1124
- .get(url)
1125
- .pipe(map((r) => {
1126
- const response = r;
1127
- return {
1128
- data: response.data?.items ?? [],
1129
- totalCount: response.data?.paginatorDetails?.totalItemsCount ?? 0,
1130
- links: {},
1131
- };
1132
- }), catchError(this.handleError)));
1140
+ return url;
1133
1141
  }
1134
1142
  getBaseListUrl(page, filter) {
1135
1143
  return `${this.config.apiUrl}${this.getUrlNameForList() !== 'public-collections'