@smartsoft001-mobilems/angular 2.28.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'
@@ -1160,6 +1168,32 @@ class CrudBaseService extends CrudService {
1160
1168
  }
1161
1169
  }
1162
1170
 
1171
+ class QueryFilterService {
1172
+ static map(filter, queryParams, data) {
1173
+ if (!queryParams[data.id])
1174
+ return filter;
1175
+ const ids = queryParams[data.id].split(',');
1176
+ const texts = queryParams[data.text].split(',');
1177
+ filter.offset = 0;
1178
+ filter.query = [
1179
+ ...(filter?.query ? filter.query : []).filter((q) => q.key !== data.key),
1180
+ {
1181
+ key: data.key,
1182
+ type: '=',
1183
+ value: ids.map((id, i) => {
1184
+ return {
1185
+ id: id,
1186
+ text: texts[i],
1187
+ selected: true,
1188
+ };
1189
+ }),
1190
+ hidden: true,
1191
+ },
1192
+ ];
1193
+ return filter;
1194
+ }
1195
+ }
1196
+
1163
1197
  const SERVICES = [
1164
1198
  DictionaryService,
1165
1199
  ConfigsService,
@@ -2053,5 +2087,5 @@ const unauthorizedGuard = () => {
2053
2087
  * Generated bundle index. Do not edit.
2054
2088
  */
2055
2089
 
2056
- export { AppComponent, AuthStorageService, COMPONENTS, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, FooterComponent, GameType, GlobalService, HeaderComponent, HoverDirective, ImageBox, ListMode, MenuComponent, MetaService, ModalContainerComponent, ModalRef, ModalService, PageComponent, SERVICES, ScrollTopComponent, ScrollableDirective, SearchService, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, authenticationGuard, environment, setTranslationsAndLang, unauthorizedGuard };
2090
+ export { AppComponent, AuthStorageService, COMPONENTS, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, FooterComponent, GameType, GlobalService, HeaderComponent, HoverDirective, ImageBox, ListMode, MenuComponent, MetaService, ModalContainerComponent, ModalRef, ModalService, PageComponent, QueryFilterService, SERVICES, ScrollTopComponent, ScrollableDirective, SearchService, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, authenticationGuard, environment, setTranslationsAndLang, unauthorizedGuard };
2057
2091
  //# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map