@smartsoft001-mobilems/angular 2.18.0 → 2.20.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.
|
@@ -11,7 +11,7 @@ import * as i1 from '@angular/common';
|
|
|
11
11
|
import { isPlatformBrowser, CommonModule, DOCUMENT, NgClass, NgTemplateOutlet } from '@angular/common';
|
|
12
12
|
import { Router, ActivatedRoute, NavigationEnd, RouterOutlet, RouterLink, RouterLinkActive, RouterModule } from '@angular/router';
|
|
13
13
|
import { TranslateService } from '@ngx-translate/core';
|
|
14
|
-
import { CrudService, CrudFacade } from '@smartsoft001/crud-shell-angular';
|
|
14
|
+
import { CrudSearchService, CrudService, CrudFacade } from '@smartsoft001/crud-shell-angular';
|
|
15
15
|
import * as _ from 'lodash';
|
|
16
16
|
import { Debounce } from 'lodash-decorators';
|
|
17
17
|
import { ConfigPageType } from '@smartsoft001-mobilems/models';
|
|
@@ -714,6 +714,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
714
714
|
}]
|
|
715
715
|
}] });
|
|
716
716
|
|
|
717
|
+
class SearchService extends CrudSearchService {
|
|
718
|
+
constructor() {
|
|
719
|
+
super(...arguments);
|
|
720
|
+
this.http = inject(HttpClient);
|
|
721
|
+
this._currentSearchText = '';
|
|
722
|
+
}
|
|
723
|
+
get currentSearchText() {
|
|
724
|
+
return this._currentSearchText;
|
|
725
|
+
}
|
|
726
|
+
setFilter(val) {
|
|
727
|
+
super.setFilter(val);
|
|
728
|
+
}
|
|
729
|
+
setEnabled(val) {
|
|
730
|
+
super.setEnabled(val);
|
|
731
|
+
}
|
|
732
|
+
setCurrentSearchText(txt) {
|
|
733
|
+
this._currentSearchText = txt;
|
|
734
|
+
}
|
|
735
|
+
search(txt, data = {}) {
|
|
736
|
+
this.setFilter({
|
|
737
|
+
searchText: txt,
|
|
738
|
+
});
|
|
739
|
+
this._currentSearchText = txt;
|
|
740
|
+
return combineLatest([
|
|
741
|
+
this.http
|
|
742
|
+
.get(`${environment.apiUrl}search/Object/page/1?maxPerPage=1&${this.getFilterQuery('objects', txt, data)}`)
|
|
743
|
+
.pipe(catchError(() => {
|
|
744
|
+
return of(null);
|
|
745
|
+
})),
|
|
746
|
+
this.http
|
|
747
|
+
.get(`${environment.apiUrl}public-collections/page/1?maxPerPage=1&${this.getFilterQuery('publicCollections', txt, data)}`)
|
|
748
|
+
.pipe(catchError(() => {
|
|
749
|
+
return of(null);
|
|
750
|
+
})),
|
|
751
|
+
this.http
|
|
752
|
+
.get(`${environment.apiUrl}search/Article/page/1?maxPerPage=1&${this.getFilterQuery('articles', txt, data)}`)
|
|
753
|
+
.pipe(catchError(() => {
|
|
754
|
+
return of(null);
|
|
755
|
+
})),
|
|
756
|
+
this.http
|
|
757
|
+
.get(`${environment.apiUrl}dictionary/Creator/search/page/1?maxPerPage=1&${this.getFilterQuery('creators', txt, data)}`)
|
|
758
|
+
.pipe(catchError(() => {
|
|
759
|
+
return of(null);
|
|
760
|
+
})),
|
|
761
|
+
this.http
|
|
762
|
+
.get(`${environment.apiUrl}dictionary/Imprint/search/page/1?maxPerPage=1&${this.getFilterQuery('imprints', txt, data)}`)
|
|
763
|
+
.pipe(catchError(() => {
|
|
764
|
+
return of(null);
|
|
765
|
+
})),
|
|
766
|
+
]).pipe(map(([objectsResult, publicCollectionsResult, articlesResult, creatorsResult, imprintsResult,]) => {
|
|
767
|
+
return {
|
|
768
|
+
objects: objectsResult?.data?.paginatorDetails?.totalItemsCount ?? 0,
|
|
769
|
+
publicCollections: publicCollectionsResult?.data?.paginatorDetails
|
|
770
|
+
?.totalItemsCount ?? 0,
|
|
771
|
+
articles: articlesResult?.data?.paginatorDetails?.totalItemsCount ?? 0,
|
|
772
|
+
creators: creatorsResult?.data?.paginatorDetails?.totalItemsCount ?? 0,
|
|
773
|
+
imprints: imprintsResult?.data?.paginatorDetails?.totalItemsCount ?? 0,
|
|
774
|
+
};
|
|
775
|
+
}));
|
|
776
|
+
}
|
|
777
|
+
getFilterQuery(type, txt, data = {}) {
|
|
778
|
+
const result = [];
|
|
779
|
+
if (txt && type !== 'creators' && type !== 'imprints') {
|
|
780
|
+
result.push(`filter[phrase]=${encodeURIComponent(txt)}`);
|
|
781
|
+
}
|
|
782
|
+
else if (txt) {
|
|
783
|
+
result.push(`q=${encodeURIComponent(txt)}`);
|
|
784
|
+
}
|
|
785
|
+
if (data.keywordId) {
|
|
786
|
+
result.push(`filter[keywords][]=${data.keywordId}`);
|
|
787
|
+
}
|
|
788
|
+
if (data.cycleId) {
|
|
789
|
+
result.push(`filter[cycles][]=${data.cycleId}`);
|
|
790
|
+
}
|
|
791
|
+
if (data.seriesTitleId) {
|
|
792
|
+
result.push(`filter[cycles][]=${data.seriesTitleId}`);
|
|
793
|
+
}
|
|
794
|
+
return result.join('&');
|
|
795
|
+
}
|
|
796
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SearchService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
797
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SearchService, providedIn: 'root' }); }
|
|
798
|
+
}
|
|
799
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SearchService, decorators: [{
|
|
800
|
+
type: Injectable,
|
|
801
|
+
args: [{
|
|
802
|
+
providedIn: 'root',
|
|
803
|
+
}]
|
|
804
|
+
}] });
|
|
805
|
+
|
|
717
806
|
class SeoService {
|
|
718
807
|
constructor() {
|
|
719
808
|
this.title = inject(Title);
|
|
@@ -1052,6 +1141,7 @@ const SERVICES = [
|
|
|
1052
1141
|
SeoService,
|
|
1053
1142
|
StyleService,
|
|
1054
1143
|
ModalService,
|
|
1144
|
+
SearchService,
|
|
1055
1145
|
];
|
|
1056
1146
|
|
|
1057
1147
|
class ConfigsFacade {
|
|
@@ -1929,5 +2019,5 @@ const unauthorizedGuard = () => {
|
|
|
1929
2019
|
* Generated bundle index. Do not edit.
|
|
1930
2020
|
*/
|
|
1931
2021
|
|
|
1932
|
-
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, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, authenticationGuard, environment, setTranslationsAndLang, unauthorizedGuard };
|
|
2022
|
+
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 };
|
|
1933
2023
|
//# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map
|