@sourceloop/search-client 4.3.2 → 5.0.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.
Files changed (35) hide show
  1. package/README.md +17 -16
  2. package/esm2020/lib/lib-configuration.mjs +63 -0
  3. package/esm2020/lib/search/search.component.mjs +315 -0
  4. package/esm2020/lib/search-lib.module.mjs +50 -0
  5. package/{esm2015/lib/types.js → esm2020/lib/types.mjs} +0 -0
  6. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  7. package/{esm2015/sourceloop-search-client.js → esm2020/sourceloop-search-client.mjs} +0 -0
  8. package/fesm2015/sourceloop-search-client.mjs +449 -0
  9. package/fesm2015/sourceloop-search-client.mjs.map +1 -0
  10. package/fesm2020/sourceloop-search-client.mjs +443 -0
  11. package/fesm2020/sourceloop-search-client.mjs.map +1 -0
  12. package/lib/search/search.component.d.ts +3 -0
  13. package/lib/search-lib.module.d.ts +13 -0
  14. package/package.json +33 -21
  15. package/sourceloop-search-client.d.ts +1 -0
  16. package/bundles/sourceloop-search-client.umd.js +0 -428
  17. package/bundles/sourceloop-search-client.umd.js.map +0 -1
  18. package/esm2015/lib/lib-configuration.js +0 -66
  19. package/esm2015/lib/lib-configuration.ngsummary.json +0 -1
  20. package/esm2015/lib/search/search.component.js +0 -297
  21. package/esm2015/lib/search/search.component.ngfactory.js +0 -129
  22. package/esm2015/lib/search/search.component.ngsummary.json +0 -1
  23. package/esm2015/lib/search/search.component.scss.shim.ngstyle.js +0 -9
  24. package/esm2015/lib/search-lib.module.js +0 -29
  25. package/esm2015/lib/search-lib.module.ngfactory.js +0 -32
  26. package/esm2015/lib/search-lib.module.ngsummary.json +0 -1
  27. package/esm2015/lib/types.ngsummary.json +0 -1
  28. package/esm2015/public-api.ngsummary.json +0 -1
  29. package/esm2015/sourceloop-search-client.ngsummary.json +0 -1
  30. package/fesm2015/sourceloop-search-client.js +0 -408
  31. package/fesm2015/sourceloop-search-client.js.map +0 -1
  32. package/lib/search/search.component.ngfactory.d.ts +0 -1
  33. package/lib/search/search.component.scss.shim.ngstyle.d.ts +0 -1
  34. package/lib/search-lib.module.ngfactory.d.ts +0 -3
  35. package/sourceloop-search-client.metadata.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceloop-search-client.mjs","sources":["../../src/lib/types.ts","../../src/lib/search/search.component.ts","../../src/lib/search/search.component.html","../../src/lib/search-lib.module.ts","../../src/lib/lib-configuration.ts","../../src/public-api.ts","../../src/sourceloop-search-client.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {Observable} from 'rxjs';\n\nexport interface ISearchQuery {\n match: string;\n limit: number | null;\n order: string | null;\n limitByType: boolean | null;\n offset: number | null;\n sources: string[] | null;\n}\nexport interface IModel {\n name: string;\n displayName: string;\n imageUrl?: string;\n icon?: string;\n}\nexport interface IReturnType {\n rank: number;\n source: string;\n}\nexport interface IDefaultReturnType extends IReturnType {\n name: string;\n description: string;\n}\n\nexport interface ISearchService<T extends IReturnType> {\n searchApiRequest(\n requestParameters: ISearchQuery,\n saveInRecents: boolean,\n ): Observable<T[]>;\n recentSearchApiRequest?(): Observable<ISearchQuery[]>;\n}\n\n// cant use T extends IReturnType here\nexport const SEARCH_SERVICE_TOKEN: InjectionToken<ISearchService<IReturnType>> =\n new InjectionToken<ISearchService<IReturnType>>('Search_Service_Token');\n\nexport type RecentSearchEvent = {\n event?: Event;\n keyword: string;\n category: string;\n};\n\nexport type ItemClickedEvent<T> = {\n event: MouseEvent;\n item: T;\n};\n\nexport type TypeEvent = {\n event?: Event;\n input: string;\n};\n// IRequestParameters default values\nexport const DEFAULT_LIMIT = 20;\nexport const DEFAULT_LIMIT_TYPE = false;\nexport const DEFAULT_ORDER = [];\nexport const DEBOUNCE_TIME = 1000;\nexport const DEFAULT_OFFSET = 0;\nexport const DEFAULT_SAVE_IN_RECENTS = true;\n","import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Output,\n PLATFORM_ID,\n TemplateRef,\n ViewChild,\n} from '@angular/core';\nimport {Configuration} from '../lib-configuration';\nimport {Subject} from 'rxjs';\nimport {debounceTime, tap} from 'rxjs/operators';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {\n ISearchService,\n ISearchQuery,\n SEARCH_SERVICE_TOKEN,\n DEBOUNCE_TIME,\n DEFAULT_LIMIT,\n DEFAULT_LIMIT_TYPE,\n DEFAULT_OFFSET,\n DEFAULT_SAVE_IN_RECENTS,\n DEFAULT_ORDER,\n IReturnType,\n RecentSearchEvent,\n TypeEvent,\n ItemClickedEvent,\n IModel,\n} from '../types';\nimport {isPlatformBrowser} from '@angular/common';\n\nconst ALL_LABEL = 'All';\n@Component({\n selector: 'sourceloop-search',\n templateUrl: './search.component.html',\n styleUrls: ['./search.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: SearchComponent,\n multi: true,\n },\n ],\n})\nexport class SearchComponent<T extends IReturnType>\n implements OnInit, OnDestroy, ControlValueAccessor\n{\n searchBoxInput = '';\n suggestionsDisplay = false;\n categoryDisplay = false;\n searching = false;\n suggestions: T[] = [];\n recentSearches: ISearchQuery[] = [];\n category: string = ALL_LABEL;\n searchRequest$ = new Subject<{input: string; event: Event}>();\n\n private _config!: Configuration<T>;\n public get config(): Configuration<T> {\n return this._config;\n }\n @Input()\n public set config(value: Configuration<T>) {\n this._config = value;\n\n if (value && value.models) {\n value.models.unshift({\n name: ALL_LABEL,\n displayName: ALL_LABEL,\n });\n } else if (value && !value.models) {\n value.models = [\n {\n name: ALL_LABEL,\n displayName: ALL_LABEL,\n },\n ];\n } else {\n // do nothing\n }\n }\n\n @Input() titleTemplate?: TemplateRef<any>;\n @Input() subtitleTemplate?: TemplateRef<any>;\n // emitted when user clicks one of the suggested results (including recent search sugestions)\n @Output() clicked = new EventEmitter<ItemClickedEvent<T>>();\n @Output() searched = new EventEmitter<RecentSearchEvent>();\n /* emitted when user makes search request (including recent search requests & requests made on change in category from dropdown)\n In case of recent search Array of recent Search request result is emitted */\n\n onChange!: (value: string | undefined) => void;\n onTouched!: () => void;\n disabled = false;\n\n @ViewChild('searchInput') public searchInputElement!: ElementRef;\n\n constructor(\n @Inject(SEARCH_SERVICE_TOKEN)\n private readonly searchService: ISearchService<T>,\n // tslint:disable-next-line:ban-types\n @Inject(PLATFORM_ID) private readonly platformId: Object,\n private readonly cdr: ChangeDetectorRef,\n ) {}\n\n ngOnInit(): void {\n this.searchRequest$\n .pipe(\n tap(v => (this.suggestions = [])),\n debounceTime(DEBOUNCE_TIME),\n )\n .subscribe((value: TypeEvent) => {\n this.searched.emit({\n event: value.event,\n keyword: value.input,\n category: this.category,\n });\n this.getSuggestions(value);\n this.cdr.markForCheck();\n });\n }\n\n // ControlValueAccessor Implementation\n writeValue(value: string): void {\n this.searchBoxInput = value;\n }\n // When the value in the UI is changed, this method will invoke a callback function\n registerOnChange(fn: (value: string | undefined) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState?(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n getSuggestions(eventValue: TypeEvent) {\n eventValue.input = eventValue.input.trim();\n if (!eventValue.input.length) {\n return;\n }\n const order = this.config.order ?? DEFAULT_ORDER;\n let orderString = '';\n order.forEach(preference => (orderString = `${orderString}${preference} `));\n\n let saveInRecents = this.config.saveInRecents ?? DEFAULT_SAVE_IN_RECENTS;\n if (this.config.saveInRecents && this.config.saveInRecentsOnlyOnEnter) {\n if (\n !eventValue.event ||\n (eventValue.event instanceof KeyboardEvent &&\n eventValue.event.key === 'Enter')\n ) {\n saveInRecents = true; // save in recents only on enter or change in category\n } else {\n // do not save in recent search on typing\n saveInRecents = false;\n }\n }\n /* need to put default value here and not in contructor\n because sonar was giving code smell with definite assertion as all these parameters are optional */\n const requestParameters: ISearchQuery = {\n match: eventValue.input,\n sources: this._categoryToSourceName(this.category),\n limit: this.config.limit ?? DEFAULT_LIMIT,\n limitByType: this.config.limitByType ?? DEFAULT_LIMIT_TYPE,\n order: orderString,\n offset: this.config.offset ?? DEFAULT_OFFSET,\n };\n\n this.searching = true;\n this.cdr.markForCheck();\n this.searchService\n .searchApiRequest(requestParameters, saveInRecents)\n .subscribe(\n (value: T[]) => {\n this.suggestions = value;\n this.searching = false;\n this.cdr.markForCheck();\n },\n (_error: Error) => {\n this.suggestions = [];\n this.searching = false;\n this.cdr.markForCheck();\n },\n );\n }\n getRecentSearches() {\n if (\n !this.config.hideRecentSearch &&\n this.searchService.recentSearchApiRequest\n ) {\n this.searchService.recentSearchApiRequest().subscribe(\n (value: ISearchQuery[]) => {\n this.recentSearches = value;\n this.cdr.markForCheck();\n },\n (_error: Error) => {\n this.recentSearches = [];\n this.cdr.markForCheck();\n },\n );\n }\n }\n\n // event can be KeyBoardEvent or Event of type 'change' fired on change in value of drop down for category\n hitSearchApi(event?: Event) {\n // this will happen only in case user searches something and then erases it, we need to update recent search\n if (!this.searchBoxInput) {\n this.suggestions = [];\n this.getRecentSearches();\n return;\n }\n\n // no debounce time needed in case of searchOnlyOnEnter\n if (this.config.searchOnlyOnEnter) {\n if (!event || (event instanceof KeyboardEvent && event.key === 'Enter')) {\n this.getSuggestions({input: this.searchBoxInput, event});\n }\n return;\n }\n\n // no debounce time needed in case of change in category\n if (!event) {\n this.getSuggestions({input: this.searchBoxInput, event});\n return;\n }\n\n this.searchRequest$.next({\n input: this.searchBoxInput,\n event,\n });\n }\n\n populateValue(suggestion: T, event: MouseEvent) {\n const value = suggestion[\n this.config.displayPropertyName\n ] as unknown as string; // converted to string to assign value to searchBoxInput\n this.searchBoxInput = value;\n this.suggestionsDisplay = false;\n // ngModelChange doesn't detect change in value when populated from outside, hence calling manually\n this.onChange(this.searchBoxInput);\n // need to do this to show more search options for selected suggestion - just in case user reopens search input\n this.getSuggestions({input: this.searchBoxInput, event});\n this.clicked.emit({item: suggestion, event});\n }\n populateValueRecentSearch(recentSearch: ISearchQuery, event: MouseEvent) {\n event.stopPropagation();\n event.preventDefault();\n const value = recentSearch['match'];\n this.searchBoxInput = value;\n this.suggestionsDisplay = false;\n this.onChange(this.searchBoxInput);\n // need to do this to show more search options for selected suggestion - just in case user reopens search input\n this.getSuggestions({input: this.searchBoxInput, event});\n this.focusInput();\n this.showSuggestions();\n }\n\n fetchModelImageUrlFromSuggestion(suggestion: T) {\n const modelName = suggestion[\n 'source' as unknown as keyof T\n ] as unknown as string;\n let url: string | undefined;\n this.config.models.forEach(model => {\n if (model.name === modelName && model.imageUrl) {\n url = model.imageUrl;\n }\n });\n return url;\n }\n\n boldString(str: T[keyof T] | string, substr: string) {\n const strRegExp = new RegExp(`(${substr})`, 'gi');\n const stringToMakeBold: string = str as unknown as string;\n return stringToMakeBold.replace(strRegExp, `<b>$1</b>`);\n }\n\n hideSuggestions() {\n this.suggestionsDisplay = false;\n this.onTouched();\n }\n\n showSuggestions() {\n this.suggestionsDisplay = true;\n this.getRecentSearches();\n }\n\n focusInput() {\n if (isPlatformBrowser(this.platformId)) {\n this.searchInputElement.nativeElement.focus();\n }\n }\n\n setCategory(category: string) {\n this.category = category;\n this.categoryDisplay = false;\n if (this.searchBoxInput) {\n this.hitSearchApi();\n this.focusInput();\n this.showSuggestions();\n }\n }\n\n showCategory() {\n this.categoryDisplay = !this.categoryDisplay;\n }\n\n hideCategory() {\n this.categoryDisplay = false;\n }\n\n resetInput() {\n this.searchBoxInput = '';\n this.suggestions = [];\n this.suggestionsDisplay = true;\n this.focusInput();\n // ngModelChange doesn't detect change in value when populated from outside, hence calling manually\n this.onChange(this.searchBoxInput);\n this.getRecentSearches();\n }\n ngOnDestroy() {\n this.searchRequest$.unsubscribe();\n }\n\n _categoryToSourceName(category: string) {\n if (category === ALL_LABEL) {\n return [];\n } else {\n return [category];\n }\n }\n getModelFromModelName(name: string) {\n return this.config.models.find(item => item.name === name) as IModel;\n }\n getModelsWithSuggestions() {\n const modelsWithSuggestions: {model: IModel; items: T[]}[] = [];\n const sources: string[] = [];\n this.suggestions.forEach(suggestion => {\n if (sources.indexOf(suggestion['source']) >= 0) {\n modelsWithSuggestions.every(modelWithSuggestions => {\n if (modelWithSuggestions.model.name === suggestion['source']) {\n modelWithSuggestions.items.push(suggestion);\n return false;\n }\n return true;\n });\n } else {\n const model = this.getModelFromModelName(suggestion['source']);\n modelsWithSuggestions.push({model, items: [suggestion]});\n sources.push(suggestion['source']);\n }\n });\n return modelsWithSuggestions;\n }\n}\n","<div fxLayout fxLayoutAlign=\"start center\" class=\"toolbar-search\">\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-input\">\n <input\n matInput\n autocomplete=\"off\"\n type=\"text\"\n [placeholder]=\"\n config.placeholderFunction\n ? config.placeholderFunction(searchInput.value, category)\n : config.placeholder || 'Search'\n \"\n #searchInput\n name=\"searchInput\"\n (focus)=\"showSuggestions()\"\n (blur)=\"hideSuggestions()\"\n [(ngModel)]=\"searchBoxInput\"\n (keyup)=\"hitSearchApi($event)\"\n placeholder=\"Search\"\n (ngModelChange)=\"onChange(this.searchBoxInput)\"\n [disabled]=\"disabled\"\n />\n <mat-icon matPrefix [className]=\"config.searchIconClass\"></mat-icon>\n <mat-icon\n *ngIf=\"searchBoxInput\"\n matSuffix\n [className]=\"config.crossIconClass\"\n (click)=\"resetInput()\"\n ></mat-icon>\n </mat-form-field>\n\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-select\">\n <mat-icon matSuffix [className]=\"config.dropDownButtonIconClass\"></mat-icon>\n <mat-select\n [value]=\"category\"\n (selectionChange)=\"setCategory($event.value)\"\n panelClass=\"search-select\"\n >\n <mat-option [value]=\"model.name\" *ngFor=\"let model of config.models\">\n {{ model.displayName }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n</div>\n\n<div class=\"search-container\">\n <div\n *ngIf=\"suggestionsDisplay && (recentSearches.length || suggestions.length)\"\n class=\"search-popup\"\n >\n <ng-container *ngIf=\"searchBoxInput\">\n <span *ngIf=\"suggestions.length === 0\" class=\"search-message\">\n <ng-container *ngIf=\"searching\"> searching... </ng-container>\n <ng-container *ngIf=\"!searching\">\n {{ config.noResultMessage }}\n </ng-container>\n </span>\n <ng-container *ngIf=\"config.categorizeResults && suggestions.length\">\n <div\n class=\"search-result\"\n *ngFor=\"let modelWithSuggestions of getModelsWithSuggestions()\"\n >\n <h3 class=\"suggestions-heading\">\n <img\n *ngIf=\"modelWithSuggestions.model.imageUrl\"\n [src]=\"modelWithSuggestions.model.imageUrl\"\n [alt]=\"modelWithSuggestions.model.displayName\"\n />\n {{ modelWithSuggestions.model.displayName }} ({{\n modelWithSuggestions.items.length\n }})\n </h3>\n <ul>\n <li\n *ngFor=\"let suggestion of modelWithSuggestions.items\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n class=\"suggestions\"\n >\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!config.categorizeResults\">\n <div class=\"search-result\">\n <ul>\n <li\n *ngFor=\"let suggestion of suggestions\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n >\n <!--Need to call fetchModelImageUrlFromSuggestion as each suggestion can come from different model-->\n <img\n *ngIf=\"\n !titleTemplate && fetchModelImageUrlFromSuggestion(suggestion)\n \"\n class=\"suggestions-categorize-false\"\n [src]=\"fetchModelImageUrlFromSuggestion(suggestion)\"\n style=\"margin-right: 5px\"\n alt=\"Img\"\n />\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"!config.hideRecentSearch && recentSearches.length > 0\">\n <div class=\"recent-searches\">\n <h3 class=\"suggestions-heading\">Recent Searches</h3>\n <ul>\n <li\n *ngFor=\"let recentSearch of recentSearches\"\n class=\"suggestions\"\n (mousedown)=\"populateValueRecentSearch(recentSearch, $event)\"\n >\n <mat-icon\n matPrefix\n [className]=\"config.recentSearchIconClass\"\n ></mat-icon>\n\n <span>&nbsp;{{ recentSearch.match }}</span>\n </li>\n </ul>\n </div>\n </ng-container>\n </div>\n</div>\n","import {CommonModule} from '@angular/common';\nimport {HttpClientModule} from '@angular/common/http';\nimport {NgModule} from '@angular/core';\nimport {FlexLayoutModule} from '@angular/flex-layout';\nimport {FormsModule} from '@angular/forms';\nimport {MatFormFieldModule} from '@angular/material/form-field';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatInputModule} from '@angular/material/input';\nimport {MatSelectModule} from '@angular/material/select';\n\nimport {SearchComponent} from './search/search.component';\n\n@NgModule({\n declarations: [SearchComponent],\n imports: [\n CommonModule,\n FormsModule,\n HttpClientModule,\n MatSelectModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n FlexLayoutModule,\n ],\n exports: [SearchComponent],\n})\nexport class SearchLibModule {}\n","import {IDefaultReturnType, IModel} from './types';\nexport class Configuration<T = IDefaultReturnType> {\n /** property to be displayed in the results */\n displayPropertyName: keyof T;\n /** list of model configuration to be render and categorize search results */\n models: IModel[];\n /** max number of results (based on limitByType option) */\n limit?: number;\n /** apply limit on individual models, or on overall results */\n limitByType?: boolean;\n /** apply a particular ordering on results */\n order?: string[];\n /** offset for results in case limit is used */\n offset?: number;\n /** save the search query in recent history */\n saveInRecents?: boolean;\n /** a placeholder to display in the search box */\n placeholder?: string;\n /** a function to generate placeholder, overrides the placeholder property */\n placeholderFunction?: (input: string, category: string) => string;\n /** categorize results on the basis of models provided */\n categorizeResults?: boolean;\n /** hides the recent search list */\n hideRecentSearch?: boolean;\n /** hide the category selection button */\n hideCategorizeButton?: boolean;\n /** save value in recent search only on enter or change in category, if false, also saved on typing */\n saveInRecentsOnlyOnEnter?: boolean;\n /** search only on enter key or when category is changed */\n searchOnlyOnEnter?: boolean;\n noResultMessage?: string;\n searchIconClass?: string;\n crossIconClass?: string;\n dropDownButtonIconClass?: string;\n recentSearchIconClass?: string;\n\n constructor(d: Configuration<T>) {\n checkForError(d);\n this.displayPropertyName = d.displayPropertyName;\n this.models = d.models;\n\n /* IRequestParameters - will be given default values before call is made in case undefined/null,\n otherwise there ! is used on which sonar gives code smell */\n this.limit = d.limit;\n this.limitByType = d.limitByType;\n this.order = d.order;\n this.offset = d.offset;\n this.saveInRecents = d.saveInRecents;\n\n const displayTexts = setDisplayText(d);\n this.noResultMessage = displayTexts.noResultMessage;\n this.placeholder = displayTexts.placeholder;\n this.placeholderFunction = displayTexts.placeholderFunction;\n\n const searchConfig = setSearchConfig(d);\n this.categorizeResults = searchConfig.categorizeResults;\n this.hideRecentSearch = searchConfig.hideRecentSearch;\n this.hideCategorizeButton = searchConfig.hideCategorizeButton;\n this.saveInRecentsOnlyOnEnter = searchConfig.saveInRecentsOnlyOnEnter;\n this.searchOnlyOnEnter = searchConfig.searchOnlyOnEnter;\n\n const classes = setIconClasses(d);\n this.searchIconClass = classes.searchIconClass;\n this.crossIconClass = classes.crossIconClass;\n this.dropDownButtonIconClass = classes.dropDownButtonIconClass;\n this.recentSearchIconClass = classes.recentSearchIconClass;\n }\n}\nfunction checkForError<T>(d: Configuration<T>) {\n if (\n d.categorizeResults === false &&\n (d.hideCategorizeButton === false || d.hideCategorizeButton === undefined)\n ) {\n throw new Error(\n 'You must provide hideCategorizeButton:true as categorizeResults is false',\n );\n }\n if (d.saveInRecents === false && d.saveInRecentsOnlyOnEnter === true) {\n throw new Error(\n 'You must provide saveInRecents:true for saveInRecentsOnlyOnEnter:true',\n );\n }\n}\nfunction setDisplayText<T>(d: Configuration<T>) {\n return {\n placeholder: d.placeholder ?? 'Search',\n noResultMessage: d.noResultMessage ?? 'No result found',\n placeholderFunction: d.placeholderFunction,\n };\n}\nfunction setSearchConfig<T>(d: Configuration<T>) {\n return {\n categorizeResults: d.categorizeResults ?? true,\n hideRecentSearch: d.hideRecentSearch ?? false,\n hideCategorizeButton: d.hideCategorizeButton ?? false,\n saveInRecentsOnlyOnEnter: d.saveInRecentsOnlyOnEnter ?? false,\n searchOnlyOnEnter: d.searchOnlyOnEnter ?? false,\n };\n}\nfunction setIconClasses<T>(d: Configuration<T>) {\n return {\n searchIconClass: d.searchIconClass ?? 'icomoon Search',\n crossIconClass: d.crossIconClass ?? 'icomoon close',\n dropDownButtonIconClass: d.dropDownButtonIconClass ?? 'icomoon arrow_down',\n recentSearchIconClass: d.recentSearchIconClass ?? 'icomoon Search',\n };\n}\n","/*\n * Public API Surface of my-lib\n */\n\nexport * from './lib/search-lib.module';\nexport * from './lib/search/search.component';\nexport * from './lib/lib-configuration';\nexport * from './lib/types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA;MACa,oBAAoB,GAC/B,IAAI,cAAc,CAA8B,sBAAsB,EAAE;AAiB1E;AACO,MAAM,aAAa,GAAG,GAAG;AACzB,MAAM,kBAAkB,GAAG,MAAM;AACjC,MAAM,aAAa,GAAG,GAAG;AACzB,MAAM,aAAa,GAAG,KAAK;AAC3B,MAAM,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CAAA,EAAA,GAAA,CAAC,CAAC,gBAAgB,mCAAI,KAAK;AAC7C,QAAA,oBAAoB,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,oBAAoB,mCAAI,KAAK;AACrD,QAAA,wBAAwB,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,wBAAwB,mCAAI,KAAK;AAC7D,QAAA,iBAAiB,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,iBAAiB,mCAAI,KAAK;KAChD,CAAC;AACJ,CAAC;AACD,SAAS,cAAc,CAAI,CAAmB,EAAA;;IAC5C,OAAO;AACL,QAAA,eAAe,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,eAAe,mCAAI,gBAAgB;AACtD,QAAA,cAAc,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,cAAc,mCAAI,eAAe;AACnD,QAAA,uBAAuB,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,uBAAuB,mCAAI,oBAAoB;AAC1E,QAAA,qBAAqB,EAAE,CAAA,EAAA,GAAA,CAAC,CAAC,qBAAqB,mCAAI,gBAAgB;KACnE,CAAC;AACJ;;AC1GA;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,443 @@
1
+ import * as i8 from '@angular/common';
2
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
3
+ import { HttpClientModule } from '@angular/common/http';
4
+ import * as i0 from '@angular/core';
5
+ import { InjectionToken, EventEmitter, PLATFORM_ID, Component, Inject, Input, Output, ViewChild, NgModule } from '@angular/core';
6
+ import { FlexLayoutModule } from '@angular/flex-layout';
7
+ import * as i7 from '@angular/forms';
8
+ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
9
+ import * as i1 from '@angular/material/form-field';
10
+ import { MatFormFieldModule } from '@angular/material/form-field';
11
+ import * as i2 from '@angular/material/icon';
12
+ import { MatIconModule } from '@angular/material/icon';
13
+ import * as i6 from '@angular/material/input';
14
+ import { MatInputModule } from '@angular/material/input';
15
+ import * as i3 from '@angular/material/select';
16
+ import { MatSelectModule } from '@angular/material/select';
17
+ import { Subject } from 'rxjs';
18
+ import { tap, debounceTime } from 'rxjs/operators';
19
+ import * as i4 from '@angular/material/core';
20
+ import * as i5 from '@angular/flex-layout/flex';
21
+
22
+ // cant use T extends IReturnType here
23
+ const SEARCH_SERVICE_TOKEN = new InjectionToken('Search_Service_Token');
24
+ // IRequestParameters default values
25
+ const DEFAULT_LIMIT = 20;
26
+ const DEFAULT_LIMIT_TYPE = false;
27
+ const DEFAULT_ORDER = [];
28
+ const DEBOUNCE_TIME = 1000;
29
+ const DEFAULT_OFFSET = 0;
30
+ const DEFAULT_SAVE_IN_RECENTS = true;
31
+
32
+ const ALL_LABEL = 'All';
33
+ class SearchComponent {
34
+ constructor(searchService,
35
+ // tslint:disable-next-line:ban-types
36
+ platformId, cdr) {
37
+ this.searchService = searchService;
38
+ this.platformId = platformId;
39
+ this.cdr = cdr;
40
+ this.searchBoxInput = '';
41
+ this.suggestionsDisplay = false;
42
+ this.categoryDisplay = false;
43
+ this.searching = false;
44
+ this.suggestions = [];
45
+ this.recentSearches = [];
46
+ this.category = ALL_LABEL;
47
+ this.searchRequest$ = new Subject();
48
+ // emitted when user clicks one of the suggested results (including recent search sugestions)
49
+ this.clicked = new EventEmitter();
50
+ this.searched = new EventEmitter();
51
+ this.disabled = false;
52
+ }
53
+ get config() {
54
+ return this._config;
55
+ }
56
+ set config(value) {
57
+ this._config = value;
58
+ if (value && value.models) {
59
+ value.models.unshift({
60
+ name: ALL_LABEL,
61
+ displayName: ALL_LABEL,
62
+ });
63
+ }
64
+ else if (value && !value.models) {
65
+ value.models = [
66
+ {
67
+ name: ALL_LABEL,
68
+ displayName: ALL_LABEL,
69
+ },
70
+ ];
71
+ }
72
+ else {
73
+ // do nothing
74
+ }
75
+ }
76
+ ngOnInit() {
77
+ this.searchRequest$
78
+ .pipe(tap(v => (this.suggestions = [])), debounceTime(DEBOUNCE_TIME))
79
+ .subscribe((value) => {
80
+ this.searched.emit({
81
+ event: value.event,
82
+ keyword: value.input,
83
+ category: this.category,
84
+ });
85
+ this.getSuggestions(value);
86
+ this.cdr.markForCheck();
87
+ });
88
+ }
89
+ // ControlValueAccessor Implementation
90
+ writeValue(value) {
91
+ this.searchBoxInput = value;
92
+ }
93
+ // When the value in the UI is changed, this method will invoke a callback function
94
+ registerOnChange(fn) {
95
+ this.onChange = fn;
96
+ }
97
+ registerOnTouched(fn) {
98
+ this.onTouched = fn;
99
+ }
100
+ setDisabledState(isDisabled) {
101
+ this.disabled = isDisabled;
102
+ }
103
+ getSuggestions(eventValue) {
104
+ eventValue.input = eventValue.input.trim();
105
+ if (!eventValue.input.length) {
106
+ return;
107
+ }
108
+ const order = this.config.order ?? DEFAULT_ORDER;
109
+ let orderString = '';
110
+ order.forEach(preference => (orderString = `${orderString}${preference} `));
111
+ let saveInRecents = this.config.saveInRecents ?? DEFAULT_SAVE_IN_RECENTS;
112
+ if (this.config.saveInRecents && this.config.saveInRecentsOnlyOnEnter) {
113
+ if (!eventValue.event ||
114
+ (eventValue.event instanceof KeyboardEvent &&
115
+ eventValue.event.key === 'Enter')) {
116
+ saveInRecents = true; // save in recents only on enter or change in category
117
+ }
118
+ else {
119
+ // do not save in recent search on typing
120
+ saveInRecents = false;
121
+ }
122
+ }
123
+ /* need to put default value here and not in contructor
124
+ because sonar was giving code smell with definite assertion as all these parameters are optional */
125
+ const requestParameters = {
126
+ match: eventValue.input,
127
+ sources: this._categoryToSourceName(this.category),
128
+ limit: this.config.limit ?? DEFAULT_LIMIT,
129
+ limitByType: this.config.limitByType ?? DEFAULT_LIMIT_TYPE,
130
+ order: orderString,
131
+ offset: this.config.offset ?? DEFAULT_OFFSET,
132
+ };
133
+ this.searching = true;
134
+ this.cdr.markForCheck();
135
+ this.searchService
136
+ .searchApiRequest(requestParameters, saveInRecents)
137
+ .subscribe((value) => {
138
+ this.suggestions = value;
139
+ this.searching = false;
140
+ this.cdr.markForCheck();
141
+ }, (_error) => {
142
+ this.suggestions = [];
143
+ this.searching = false;
144
+ this.cdr.markForCheck();
145
+ });
146
+ }
147
+ getRecentSearches() {
148
+ if (!this.config.hideRecentSearch &&
149
+ this.searchService.recentSearchApiRequest) {
150
+ this.searchService.recentSearchApiRequest().subscribe((value) => {
151
+ this.recentSearches = value;
152
+ this.cdr.markForCheck();
153
+ }, (_error) => {
154
+ this.recentSearches = [];
155
+ this.cdr.markForCheck();
156
+ });
157
+ }
158
+ }
159
+ // event can be KeyBoardEvent or Event of type 'change' fired on change in value of drop down for category
160
+ hitSearchApi(event) {
161
+ // this will happen only in case user searches something and then erases it, we need to update recent search
162
+ if (!this.searchBoxInput) {
163
+ this.suggestions = [];
164
+ this.getRecentSearches();
165
+ return;
166
+ }
167
+ // no debounce time needed in case of searchOnlyOnEnter
168
+ if (this.config.searchOnlyOnEnter) {
169
+ if (!event || (event instanceof KeyboardEvent && event.key === 'Enter')) {
170
+ this.getSuggestions({ input: this.searchBoxInput, event });
171
+ }
172
+ return;
173
+ }
174
+ // no debounce time needed in case of change in category
175
+ if (!event) {
176
+ this.getSuggestions({ input: this.searchBoxInput, event });
177
+ return;
178
+ }
179
+ this.searchRequest$.next({
180
+ input: this.searchBoxInput,
181
+ event,
182
+ });
183
+ }
184
+ populateValue(suggestion, event) {
185
+ const value = suggestion[this.config.displayPropertyName]; // converted to string to assign value to searchBoxInput
186
+ this.searchBoxInput = value;
187
+ this.suggestionsDisplay = false;
188
+ // ngModelChange doesn't detect change in value when populated from outside, hence calling manually
189
+ this.onChange(this.searchBoxInput);
190
+ // need to do this to show more search options for selected suggestion - just in case user reopens search input
191
+ this.getSuggestions({ input: this.searchBoxInput, event });
192
+ this.clicked.emit({ item: suggestion, event });
193
+ }
194
+ populateValueRecentSearch(recentSearch, event) {
195
+ event.stopPropagation();
196
+ event.preventDefault();
197
+ const value = recentSearch['match'];
198
+ this.searchBoxInput = value;
199
+ this.suggestionsDisplay = false;
200
+ this.onChange(this.searchBoxInput);
201
+ // need to do this to show more search options for selected suggestion - just in case user reopens search input
202
+ this.getSuggestions({ input: this.searchBoxInput, event });
203
+ this.focusInput();
204
+ this.showSuggestions();
205
+ }
206
+ fetchModelImageUrlFromSuggestion(suggestion) {
207
+ const modelName = suggestion['source'];
208
+ let url;
209
+ this.config.models.forEach(model => {
210
+ if (model.name === modelName && model.imageUrl) {
211
+ url = model.imageUrl;
212
+ }
213
+ });
214
+ return url;
215
+ }
216
+ boldString(str, substr) {
217
+ const strRegExp = new RegExp(`(${substr})`, 'gi');
218
+ const stringToMakeBold = str;
219
+ return stringToMakeBold.replace(strRegExp, `<b>$1</b>`);
220
+ }
221
+ hideSuggestions() {
222
+ this.suggestionsDisplay = false;
223
+ this.onTouched();
224
+ }
225
+ showSuggestions() {
226
+ this.suggestionsDisplay = true;
227
+ this.getRecentSearches();
228
+ }
229
+ focusInput() {
230
+ if (isPlatformBrowser(this.platformId)) {
231
+ this.searchInputElement.nativeElement.focus();
232
+ }
233
+ }
234
+ setCategory(category) {
235
+ this.category = category;
236
+ this.categoryDisplay = false;
237
+ if (this.searchBoxInput) {
238
+ this.hitSearchApi();
239
+ this.focusInput();
240
+ this.showSuggestions();
241
+ }
242
+ }
243
+ showCategory() {
244
+ this.categoryDisplay = !this.categoryDisplay;
245
+ }
246
+ hideCategory() {
247
+ this.categoryDisplay = false;
248
+ }
249
+ resetInput() {
250
+ this.searchBoxInput = '';
251
+ this.suggestions = [];
252
+ this.suggestionsDisplay = true;
253
+ this.focusInput();
254
+ // ngModelChange doesn't detect change in value when populated from outside, hence calling manually
255
+ this.onChange(this.searchBoxInput);
256
+ this.getRecentSearches();
257
+ }
258
+ ngOnDestroy() {
259
+ this.searchRequest$.unsubscribe();
260
+ }
261
+ _categoryToSourceName(category) {
262
+ if (category === ALL_LABEL) {
263
+ return [];
264
+ }
265
+ else {
266
+ return [category];
267
+ }
268
+ }
269
+ getModelFromModelName(name) {
270
+ return this.config.models.find(item => item.name === name);
271
+ }
272
+ getModelsWithSuggestions() {
273
+ const modelsWithSuggestions = [];
274
+ const sources = [];
275
+ this.suggestions.forEach(suggestion => {
276
+ if (sources.indexOf(suggestion['source']) >= 0) {
277
+ modelsWithSuggestions.every(modelWithSuggestions => {
278
+ if (modelWithSuggestions.model.name === suggestion['source']) {
279
+ modelWithSuggestions.items.push(suggestion);
280
+ return false;
281
+ }
282
+ return true;
283
+ });
284
+ }
285
+ else {
286
+ const model = this.getModelFromModelName(suggestion['source']);
287
+ modelsWithSuggestions.push({ model, items: [suggestion] });
288
+ sources.push(suggestion['source']);
289
+ }
290
+ });
291
+ return modelsWithSuggestions;
292
+ }
293
+ }
294
+ SearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchComponent, deps: [{ token: SEARCH_SERVICE_TOKEN }, { token: PLATFORM_ID }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
295
+ SearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: SearchComponent, selector: "sourceloop-search", inputs: { config: "config", titleTemplate: "titleTemplate", subtitleTemplate: "subtitleTemplate" }, outputs: { clicked: "clicked", searched: "searched" }, providers: [
296
+ {
297
+ provide: NG_VALUE_ACCESSOR,
298
+ useExisting: SearchComponent,
299
+ multi: true,
300
+ },
301
+ ], viewQueries: [{ propertyName: "searchInputElement", first: true, predicate: ["searchInput"], descendants: true }], ngImport: i0, template: "<div fxLayout fxLayoutAlign=\"start center\" class=\"toolbar-search\">\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-input\">\n <input\n matInput\n autocomplete=\"off\"\n type=\"text\"\n [placeholder]=\"\n config.placeholderFunction\n ? config.placeholderFunction(searchInput.value, category)\n : config.placeholder || 'Search'\n \"\n #searchInput\n name=\"searchInput\"\n (focus)=\"showSuggestions()\"\n (blur)=\"hideSuggestions()\"\n [(ngModel)]=\"searchBoxInput\"\n (keyup)=\"hitSearchApi($event)\"\n placeholder=\"Search\"\n (ngModelChange)=\"onChange(this.searchBoxInput)\"\n [disabled]=\"disabled\"\n />\n <mat-icon matPrefix [className]=\"config.searchIconClass\"></mat-icon>\n <mat-icon\n *ngIf=\"searchBoxInput\"\n matSuffix\n [className]=\"config.crossIconClass\"\n (click)=\"resetInput()\"\n ></mat-icon>\n </mat-form-field>\n\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-select\">\n <mat-icon matSuffix [className]=\"config.dropDownButtonIconClass\"></mat-icon>\n <mat-select\n [value]=\"category\"\n (selectionChange)=\"setCategory($event.value)\"\n panelClass=\"search-select\"\n >\n <mat-option [value]=\"model.name\" *ngFor=\"let model of config.models\">\n {{ model.displayName }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n</div>\n\n<div class=\"search-container\">\n <div\n *ngIf=\"suggestionsDisplay && (recentSearches.length || suggestions.length)\"\n class=\"search-popup\"\n >\n <ng-container *ngIf=\"searchBoxInput\">\n <span *ngIf=\"suggestions.length === 0\" class=\"search-message\">\n <ng-container *ngIf=\"searching\"> searching... </ng-container>\n <ng-container *ngIf=\"!searching\">\n {{ config.noResultMessage }}\n </ng-container>\n </span>\n <ng-container *ngIf=\"config.categorizeResults && suggestions.length\">\n <div\n class=\"search-result\"\n *ngFor=\"let modelWithSuggestions of getModelsWithSuggestions()\"\n >\n <h3 class=\"suggestions-heading\">\n <img\n *ngIf=\"modelWithSuggestions.model.imageUrl\"\n [src]=\"modelWithSuggestions.model.imageUrl\"\n [alt]=\"modelWithSuggestions.model.displayName\"\n />\n {{ modelWithSuggestions.model.displayName }} ({{\n modelWithSuggestions.items.length\n }})\n </h3>\n <ul>\n <li\n *ngFor=\"let suggestion of modelWithSuggestions.items\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n class=\"suggestions\"\n >\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!config.categorizeResults\">\n <div class=\"search-result\">\n <ul>\n <li\n *ngFor=\"let suggestion of suggestions\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n >\n <!--Need to call fetchModelImageUrlFromSuggestion as each suggestion can come from different model-->\n <img\n *ngIf=\"\n !titleTemplate && fetchModelImageUrlFromSuggestion(suggestion)\n \"\n class=\"suggestions-categorize-false\"\n [src]=\"fetchModelImageUrlFromSuggestion(suggestion)\"\n style=\"margin-right: 5px\"\n alt=\"Img\"\n />\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"!config.hideRecentSearch && recentSearches.length > 0\">\n <div class=\"recent-searches\">\n <h3 class=\"suggestions-heading\">Recent Searches</h3>\n <ul>\n <li\n *ngFor=\"let recentSearch of recentSearches\"\n class=\"suggestions\"\n (mousedown)=\"populateValueRecentSearch(recentSearch, $event)\"\n >\n <mat-icon\n matPrefix\n [className]=\"config.recentSearchIconClass\"\n ></mat-icon>\n\n <span>&nbsp;{{ recentSearch.match }}</span>\n </li>\n </ul>\n </div>\n </ng-container>\n </div>\n</div>\n", styles: [":host ::ng-deep .mat-form-field-wrapper{padding:0}:host ::ng-deep .mat-form-field-wrapper .mat-form-field-prefix{margin-right:12px}.toolbar-search-input{width:86%}.toolbar-search-input ::ng-deep input{margin:0}.toolbar-search-input ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-start{border-color:transparent}.toolbar-search-input ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-end{border:none;border-radius:0}.icomoon.Search,.icomoon.close{height:1rem;width:1rem;font-size:1rem;color:#33333380;padding-bottom:4px}.icomoon.close{cursor:pointer}.toolbar-search-select{width:14%}.toolbar-search-select ::ng-deep .mat-select-arrow{opacity:0}.toolbar-search-select ::ng-deep .mat-select-arrow-wrapper{display:inline-block;width:1px}.toolbar-search-select ::ng-deep .mat-select-value-text{font-size:9px}.toolbar-search-select ::ng-deep .mat-form-field-suffix .mat-icon{width:12px;font-size:14px}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-start{border-color:transparent;border-radius:0}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-end{border:none}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-infix{-webkit-padding-before:.7em!important}.toolbar-search{width:515px;background-color:#f7f7f7;border-radius:0 0 4px 4px}.toolbar-search ::ng-deep .mat-form-field-appearance-outline .mat-form-field-flex{height:39px;align-items:center!important}.toolbar-search ::ng-deep .mat-form-field-appearance-outline .mat-form-field-wrapper{margin:0}.toolbar-search ::ng-deep .mat-form-field-infix{height:auto!important}.search-container{position:relative;width:515px}.search-container .search-popup{padding:0 15px 15px;margin:0;max-height:80vh;overflow-x:hidden;overflow-y:auto;position:absolute;top:100%;left:0px;right:0px;z-index:9999;background-color:#fff;box-shadow:0 5px 4px #0003;border-radius:0 0 4px 4px}.search-container .search-popup hr{border:0;border-top:1px solid #ebebeb;margin:0;position:sticky;top:0;padding:0 0 15px;z-index:1}.search-container .search-popup .search-message{display:inline-block;width:100%;text-align:center;font-size:16px;padding-top:12px}.search-container .search-popup .search-item-info{color:#91263b;text-align:center;font-size:12px;margin-bottom:15px;padding-top:12px}.search-container .search-popup ul{padding:0;margin:0}.search-container .search-popup ul li{list-style:none;font-size:1rem;font-weight:400;line-height:1.5;color:#333}.search-container .search-popup ul li.suggestions{font-size:15px;line-height:36px;padding:0 15px 0 44px;align-items:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.search-container .search-popup ul li.suggestions:hover{background-color:#fee8e8}.search-container .search-popup ul li.suggestions svg{margin-right:5px}.search-container .search-popup ul li.suggestions-categorize-false:hover{background-color:#fee8e8}.search-container .search-popup .search-result{padding:10px 0 0;margin:0 -15px}.search-container .search-popup .search-result.no-categorize-result ul{width:100%;padding:0;margin:0 0 10px}.search-container .search-popup .search-result.no-categorize-result ul li{font-size:15px;line-height:36px;padding:0 15px 0 31px;display:flex;align-items:center;cursor:pointer}.search-container .search-popup .search-result.no-categorize-result ul li:hover{background-color:#fee8e8}.search-container .search-popup .search-result.no-categorize-result ul li img{width:18px;margin-right:9px}.search-container .search-popup .suggestions-heading{color:#9c9c9c;font-size:14px;font-weight:400;margin:0 0 10px 17px;display:flex;align-items:center;position:relative}.search-container .search-popup .suggestions-heading .show-more{position:absolute;right:20px;color:#d1d1d1;font-size:12px;cursor:pointer;text-decoration:none}.search-container .search-popup .suggestions-heading .show-more :hover{text-decoration:underline}.search-container .search-popup .suggestions-heading img{width:18px;margin-right:9px}.search-container .search-popup .recent-searches{padding:10px 0 0;margin:0 -15px}.search-container .search-popup .recent-searches ul{display:inline-block;width:100%}.search-container .search-popup .recent-searches ul li.suggestions{display:flex}.search-container .search-popup .recent-searches ul li.suggestions span{width:100%;overflow:hidden;text-overflow:ellipsis}.search-container .search-popup .recent-searches .suggestions{display:flex}.search-container .search-popup .recent-searches .suggestions-heading{margin-left:30px}.search-container .search-popup .recent-searches li.suggestions{padding-left:31px}::ng-deep .search-select.mat-select-panel{margin-top:30px;margin-left:10px}::ng-deep .search-select .mat-option-text{display:contents!important}::ng-deep .toolbar-search .mat-form-field-infix{font-size:14px}::ng-deep .toolbar-search input{line-height:14px}::ng-deep .toolbar-search .mat-form-field-outline:first-child .mat-form-field-outline-start,::ng-deep .toolbar-search .mat-form-field-outline:first-child .mat-form-field-outline-end{background-color:#f1f3f4}::ng-deep .toolbar-search:hover .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-width:1px!important;border-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border:1px solid #a53159!important;border-left-style:none!important;border-right-style:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-radius:0;border-color:transparent!important;background-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border-width:1px!important;border-color:#a53159!important;background-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .icomoon.arrow_down{color:#fff}::ng-deep .toolbar-search:focus-within .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-width:2px!important;border-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border:2px solid #90003b!important;border-left-style:none!important;border-right-style:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-radius:0;border-color:transparent!important;background-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border-width:2px!important;border-color:#90003b!important;background-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .icomoon.arrow_down{color:#fff}::ng-deep .toolbar-search .mat-select-arrow{opacity:0}\n"], components: [{ type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i5.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1.MatPrefix, selector: "[matPrefix]" }, { type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatSuffix, selector: "[matSuffix]" }, { type: i8.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchComponent, decorators: [{
303
+ type: Component,
304
+ args: [{ selector: 'sourceloop-search', providers: [
305
+ {
306
+ provide: NG_VALUE_ACCESSOR,
307
+ useExisting: SearchComponent,
308
+ multi: true,
309
+ },
310
+ ], template: "<div fxLayout fxLayoutAlign=\"start center\" class=\"toolbar-search\">\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-input\">\n <input\n matInput\n autocomplete=\"off\"\n type=\"text\"\n [placeholder]=\"\n config.placeholderFunction\n ? config.placeholderFunction(searchInput.value, category)\n : config.placeholder || 'Search'\n \"\n #searchInput\n name=\"searchInput\"\n (focus)=\"showSuggestions()\"\n (blur)=\"hideSuggestions()\"\n [(ngModel)]=\"searchBoxInput\"\n (keyup)=\"hitSearchApi($event)\"\n placeholder=\"Search\"\n (ngModelChange)=\"onChange(this.searchBoxInput)\"\n [disabled]=\"disabled\"\n />\n <mat-icon matPrefix [className]=\"config.searchIconClass\"></mat-icon>\n <mat-icon\n *ngIf=\"searchBoxInput\"\n matSuffix\n [className]=\"config.crossIconClass\"\n (click)=\"resetInput()\"\n ></mat-icon>\n </mat-form-field>\n\n <mat-form-field appearance=\"outline\" class=\"toolbar-search-select\">\n <mat-icon matSuffix [className]=\"config.dropDownButtonIconClass\"></mat-icon>\n <mat-select\n [value]=\"category\"\n (selectionChange)=\"setCategory($event.value)\"\n panelClass=\"search-select\"\n >\n <mat-option [value]=\"model.name\" *ngFor=\"let model of config.models\">\n {{ model.displayName }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n</div>\n\n<div class=\"search-container\">\n <div\n *ngIf=\"suggestionsDisplay && (recentSearches.length || suggestions.length)\"\n class=\"search-popup\"\n >\n <ng-container *ngIf=\"searchBoxInput\">\n <span *ngIf=\"suggestions.length === 0\" class=\"search-message\">\n <ng-container *ngIf=\"searching\"> searching... </ng-container>\n <ng-container *ngIf=\"!searching\">\n {{ config.noResultMessage }}\n </ng-container>\n </span>\n <ng-container *ngIf=\"config.categorizeResults && suggestions.length\">\n <div\n class=\"search-result\"\n *ngFor=\"let modelWithSuggestions of getModelsWithSuggestions()\"\n >\n <h3 class=\"suggestions-heading\">\n <img\n *ngIf=\"modelWithSuggestions.model.imageUrl\"\n [src]=\"modelWithSuggestions.model.imageUrl\"\n [alt]=\"modelWithSuggestions.model.displayName\"\n />\n {{ modelWithSuggestions.model.displayName }} ({{\n modelWithSuggestions.items.length\n }})\n </h3>\n <ul>\n <li\n *ngFor=\"let suggestion of modelWithSuggestions.items\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n class=\"suggestions\"\n >\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!config.categorizeResults\">\n <div class=\"search-result\">\n <ul>\n <li\n *ngFor=\"let suggestion of suggestions\"\n (mousedown)=\"populateValue(suggestion, $event)\"\n >\n <!--Need to call fetchModelImageUrlFromSuggestion as each suggestion can come from different model-->\n <img\n *ngIf=\"\n !titleTemplate && fetchModelImageUrlFromSuggestion(suggestion)\n \"\n class=\"suggestions-categorize-false\"\n [src]=\"fetchModelImageUrlFromSuggestion(suggestion)\"\n style=\"margin-right: 5px\"\n alt=\"Img\"\n />\n <ng-container *ngIf=\"subtitleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n subtitleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n <p\n *ngIf=\"!titleTemplate\"\n [innerHTML]=\"\n boldString(\n suggestion[config.displayPropertyName],\n searchBoxInput\n )\n \"\n style=\"display: inline\"\n ></p>\n <ng-container *ngIf=\"titleTemplate\">\n <ng-container\n *ngTemplateOutlet=\"\n titleTemplate;\n context: {$implicit: suggestion}\n \"\n >\n </ng-container>\n </ng-container>\n </li>\n </ul>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"!config.hideRecentSearch && recentSearches.length > 0\">\n <div class=\"recent-searches\">\n <h3 class=\"suggestions-heading\">Recent Searches</h3>\n <ul>\n <li\n *ngFor=\"let recentSearch of recentSearches\"\n class=\"suggestions\"\n (mousedown)=\"populateValueRecentSearch(recentSearch, $event)\"\n >\n <mat-icon\n matPrefix\n [className]=\"config.recentSearchIconClass\"\n ></mat-icon>\n\n <span>&nbsp;{{ recentSearch.match }}</span>\n </li>\n </ul>\n </div>\n </ng-container>\n </div>\n</div>\n", styles: [":host ::ng-deep .mat-form-field-wrapper{padding:0}:host ::ng-deep .mat-form-field-wrapper .mat-form-field-prefix{margin-right:12px}.toolbar-search-input{width:86%}.toolbar-search-input ::ng-deep input{margin:0}.toolbar-search-input ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-start{border-color:transparent}.toolbar-search-input ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-end{border:none;border-radius:0}.icomoon.Search,.icomoon.close{height:1rem;width:1rem;font-size:1rem;color:#33333380;padding-bottom:4px}.icomoon.close{cursor:pointer}.toolbar-search-select{width:14%}.toolbar-search-select ::ng-deep .mat-select-arrow{opacity:0}.toolbar-search-select ::ng-deep .mat-select-arrow-wrapper{display:inline-block;width:1px}.toolbar-search-select ::ng-deep .mat-select-value-text{font-size:9px}.toolbar-search-select ::ng-deep .mat-form-field-suffix .mat-icon{width:12px;font-size:14px}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-start{border-color:transparent;border-radius:0}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-outline:first-child .mat-form-field-outline-end{border:none}.toolbar-search-select ::ng-deep .mat-form-field-flex .mat-form-field-infix{-webkit-padding-before:.7em!important}.toolbar-search{width:515px;background-color:#f7f7f7;border-radius:0 0 4px 4px}.toolbar-search ::ng-deep .mat-form-field-appearance-outline .mat-form-field-flex{height:39px;align-items:center!important}.toolbar-search ::ng-deep .mat-form-field-appearance-outline .mat-form-field-wrapper{margin:0}.toolbar-search ::ng-deep .mat-form-field-infix{height:auto!important}.search-container{position:relative;width:515px}.search-container .search-popup{padding:0 15px 15px;margin:0;max-height:80vh;overflow-x:hidden;overflow-y:auto;position:absolute;top:100%;left:0px;right:0px;z-index:9999;background-color:#fff;box-shadow:0 5px 4px #0003;border-radius:0 0 4px 4px}.search-container .search-popup hr{border:0;border-top:1px solid #ebebeb;margin:0;position:sticky;top:0;padding:0 0 15px;z-index:1}.search-container .search-popup .search-message{display:inline-block;width:100%;text-align:center;font-size:16px;padding-top:12px}.search-container .search-popup .search-item-info{color:#91263b;text-align:center;font-size:12px;margin-bottom:15px;padding-top:12px}.search-container .search-popup ul{padding:0;margin:0}.search-container .search-popup ul li{list-style:none;font-size:1rem;font-weight:400;line-height:1.5;color:#333}.search-container .search-popup ul li.suggestions{font-size:15px;line-height:36px;padding:0 15px 0 44px;align-items:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.search-container .search-popup ul li.suggestions:hover{background-color:#fee8e8}.search-container .search-popup ul li.suggestions svg{margin-right:5px}.search-container .search-popup ul li.suggestions-categorize-false:hover{background-color:#fee8e8}.search-container .search-popup .search-result{padding:10px 0 0;margin:0 -15px}.search-container .search-popup .search-result.no-categorize-result ul{width:100%;padding:0;margin:0 0 10px}.search-container .search-popup .search-result.no-categorize-result ul li{font-size:15px;line-height:36px;padding:0 15px 0 31px;display:flex;align-items:center;cursor:pointer}.search-container .search-popup .search-result.no-categorize-result ul li:hover{background-color:#fee8e8}.search-container .search-popup .search-result.no-categorize-result ul li img{width:18px;margin-right:9px}.search-container .search-popup .suggestions-heading{color:#9c9c9c;font-size:14px;font-weight:400;margin:0 0 10px 17px;display:flex;align-items:center;position:relative}.search-container .search-popup .suggestions-heading .show-more{position:absolute;right:20px;color:#d1d1d1;font-size:12px;cursor:pointer;text-decoration:none}.search-container .search-popup .suggestions-heading .show-more :hover{text-decoration:underline}.search-container .search-popup .suggestions-heading img{width:18px;margin-right:9px}.search-container .search-popup .recent-searches{padding:10px 0 0;margin:0 -15px}.search-container .search-popup .recent-searches ul{display:inline-block;width:100%}.search-container .search-popup .recent-searches ul li.suggestions{display:flex}.search-container .search-popup .recent-searches ul li.suggestions span{width:100%;overflow:hidden;text-overflow:ellipsis}.search-container .search-popup .recent-searches .suggestions{display:flex}.search-container .search-popup .recent-searches .suggestions-heading{margin-left:30px}.search-container .search-popup .recent-searches li.suggestions{padding-left:31px}::ng-deep .search-select.mat-select-panel{margin-top:30px;margin-left:10px}::ng-deep .search-select .mat-option-text{display:contents!important}::ng-deep .toolbar-search .mat-form-field-infix{font-size:14px}::ng-deep .toolbar-search input{line-height:14px}::ng-deep .toolbar-search .mat-form-field-outline:first-child .mat-form-field-outline-start,::ng-deep .toolbar-search .mat-form-field-outline:first-child .mat-form-field-outline-end{background-color:#f1f3f4}::ng-deep .toolbar-search:hover .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-width:1px!important;border-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border:1px solid #a53159!important;border-left-style:none!important;border-right-style:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-radius:0;border-color:transparent!important;background-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border-width:1px!important;border-color:#a53159!important;background-color:#a53159!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff!important}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .icomoon.arrow_down{color:#fff}::ng-deep .toolbar-search:focus-within .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-width:2px!important;border-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-input.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border:2px solid #90003b!important;border-left-style:none!important;border-right-style:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-start{border-radius:0;border-color:transparent!important;background-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-form-field-outline .mat-form-field-outline-end{border-width:2px!important;border-color:#90003b!important;background-color:#90003b!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff!important}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .icomoon.arrow_down{color:#fff}::ng-deep .toolbar-search .mat-select-arrow{opacity:0}\n"] }]
311
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
312
+ type: Inject,
313
+ args: [SEARCH_SERVICE_TOKEN]
314
+ }] }, { type: Object, decorators: [{
315
+ type: Inject,
316
+ args: [PLATFORM_ID]
317
+ }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
318
+ type: Input
319
+ }], titleTemplate: [{
320
+ type: Input
321
+ }], subtitleTemplate: [{
322
+ type: Input
323
+ }], clicked: [{
324
+ type: Output
325
+ }], searched: [{
326
+ type: Output
327
+ }], searchInputElement: [{
328
+ type: ViewChild,
329
+ args: ['searchInput']
330
+ }] } });
331
+
332
+ class SearchLibModule {
333
+ }
334
+ SearchLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
335
+ SearchLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchLibModule, declarations: [SearchComponent], imports: [CommonModule,
336
+ FormsModule,
337
+ HttpClientModule,
338
+ MatSelectModule,
339
+ MatFormFieldModule,
340
+ MatIconModule,
341
+ MatInputModule,
342
+ FlexLayoutModule], exports: [SearchComponent] });
343
+ SearchLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchLibModule, imports: [[
344
+ CommonModule,
345
+ FormsModule,
346
+ HttpClientModule,
347
+ MatSelectModule,
348
+ MatFormFieldModule,
349
+ MatIconModule,
350
+ MatInputModule,
351
+ FlexLayoutModule,
352
+ ]] });
353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SearchLibModule, decorators: [{
354
+ type: NgModule,
355
+ args: [{
356
+ declarations: [SearchComponent],
357
+ imports: [
358
+ CommonModule,
359
+ FormsModule,
360
+ HttpClientModule,
361
+ MatSelectModule,
362
+ MatFormFieldModule,
363
+ MatIconModule,
364
+ MatInputModule,
365
+ FlexLayoutModule,
366
+ ],
367
+ exports: [SearchComponent],
368
+ }]
369
+ }] });
370
+
371
+ class Configuration {
372
+ constructor(d) {
373
+ checkForError(d);
374
+ this.displayPropertyName = d.displayPropertyName;
375
+ this.models = d.models;
376
+ /* IRequestParameters - will be given default values before call is made in case undefined/null,
377
+ otherwise there ! is used on which sonar gives code smell */
378
+ this.limit = d.limit;
379
+ this.limitByType = d.limitByType;
380
+ this.order = d.order;
381
+ this.offset = d.offset;
382
+ this.saveInRecents = d.saveInRecents;
383
+ const displayTexts = setDisplayText(d);
384
+ this.noResultMessage = displayTexts.noResultMessage;
385
+ this.placeholder = displayTexts.placeholder;
386
+ this.placeholderFunction = displayTexts.placeholderFunction;
387
+ const searchConfig = setSearchConfig(d);
388
+ this.categorizeResults = searchConfig.categorizeResults;
389
+ this.hideRecentSearch = searchConfig.hideRecentSearch;
390
+ this.hideCategorizeButton = searchConfig.hideCategorizeButton;
391
+ this.saveInRecentsOnlyOnEnter = searchConfig.saveInRecentsOnlyOnEnter;
392
+ this.searchOnlyOnEnter = searchConfig.searchOnlyOnEnter;
393
+ const classes = setIconClasses(d);
394
+ this.searchIconClass = classes.searchIconClass;
395
+ this.crossIconClass = classes.crossIconClass;
396
+ this.dropDownButtonIconClass = classes.dropDownButtonIconClass;
397
+ this.recentSearchIconClass = classes.recentSearchIconClass;
398
+ }
399
+ }
400
+ function checkForError(d) {
401
+ if (d.categorizeResults === false &&
402
+ (d.hideCategorizeButton === false || d.hideCategorizeButton === undefined)) {
403
+ throw new Error('You must provide hideCategorizeButton:true as categorizeResults is false');
404
+ }
405
+ if (d.saveInRecents === false && d.saveInRecentsOnlyOnEnter === true) {
406
+ throw new Error('You must provide saveInRecents:true for saveInRecentsOnlyOnEnter:true');
407
+ }
408
+ }
409
+ function setDisplayText(d) {
410
+ return {
411
+ placeholder: d.placeholder ?? 'Search',
412
+ noResultMessage: d.noResultMessage ?? 'No result found',
413
+ placeholderFunction: d.placeholderFunction,
414
+ };
415
+ }
416
+ function setSearchConfig(d) {
417
+ return {
418
+ categorizeResults: d.categorizeResults ?? true,
419
+ hideRecentSearch: d.hideRecentSearch ?? false,
420
+ hideCategorizeButton: d.hideCategorizeButton ?? false,
421
+ saveInRecentsOnlyOnEnter: d.saveInRecentsOnlyOnEnter ?? false,
422
+ searchOnlyOnEnter: d.searchOnlyOnEnter ?? false,
423
+ };
424
+ }
425
+ function setIconClasses(d) {
426
+ return {
427
+ searchIconClass: d.searchIconClass ?? 'icomoon Search',
428
+ crossIconClass: d.crossIconClass ?? 'icomoon close',
429
+ dropDownButtonIconClass: d.dropDownButtonIconClass ?? 'icomoon arrow_down',
430
+ recentSearchIconClass: d.recentSearchIconClass ?? 'icomoon Search',
431
+ };
432
+ }
433
+
434
+ /*
435
+ * Public API Surface of my-lib
436
+ */
437
+
438
+ /**
439
+ * Generated bundle index. Do not edit.
440
+ */
441
+
442
+ export { Configuration, DEBOUNCE_TIME, DEFAULT_LIMIT, DEFAULT_LIMIT_TYPE, DEFAULT_OFFSET, DEFAULT_ORDER, DEFAULT_SAVE_IN_RECENTS, SEARCH_SERVICE_TOKEN, SearchComponent, SearchLibModule };
443
+ //# sourceMappingURL=sourceloop-search-client.mjs.map