@sourceloop/search-client 6.0.1 → 7.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.
@@ -1,549 +0,0 @@
1
- import * as i2 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, Injectable, EventEmitter, PLATFORM_ID, Component, Inject, Optional, Input, Output, ViewChild, NgModule } from '@angular/core';
6
- import { FlexLayoutModule } from '@angular/flex-layout';
7
- import * as i3 from '@angular/forms';
8
- import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
9
- import * as i4 from '@angular/material/form-field';
10
- import { MatFormFieldModule } from '@angular/material/form-field';
11
- import * as i7 from '@angular/material/icon';
12
- import { MatIconModule } from '@angular/material/icon';
13
- import * as i8 from '@angular/material/input';
14
- import { MatInputModule } from '@angular/material/input';
15
- import * as i5 from '@angular/material/select';
16
- import { MatSelectModule } from '@angular/material/select';
17
- import { from, Subject } from 'rxjs';
18
- import { tap, debounceTime } from 'rxjs/operators';
19
- import * as i6 from '@angular/material/core';
20
- import * as i9 from '@angular/flex-layout/flex';
21
-
22
- // Copyright (c) 2023 Sourcefuse Technologies
23
- function isApiServiceWithPromise(service) {
24
- return !!service
25
- .searchApiRequestWithPromise;
26
- }
27
- // cant use T extends IReturnType here
28
- const SEARCH_SERVICE_TOKEN = new InjectionToken('Search_Service_Token');
29
- // IRequestParameters default values
30
- const DEFAULT_LIMIT = 20;
31
- const DEFAULT_LIMIT_TYPE = false;
32
- const DEFAULT_ORDER = [];
33
- const DEBOUNCE_TIME = 1000;
34
- const DEFAULT_OFFSET = 0;
35
- const DEFAULT_SAVE_IN_RECENTS = true;
36
-
37
- class PromiseApiAdapterService {
38
- adapt(instance) {
39
- // this is a workaround for the fact that the recentSearchApiRequestWithPromise
40
- // method is optional in the ISearchServiceWithPromises interface
41
- // and type system is not able maintain the type information of a property
42
- const recentSearchMethod = instance.recentSearchApiRequestWithPromise;
43
- return Object.assign({ searchApiRequest: (requestParameters, saveInRecents) => from(instance.searchApiRequestWithPromise(requestParameters, saveInRecents)) }, (recentSearchMethod && {
44
- recentSearchApiRequest: () => from(recentSearchMethod()),
45
- }));
46
- }
47
- }
48
- PromiseApiAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PromiseApiAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
49
- PromiseApiAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PromiseApiAdapterService, providedIn: 'root' });
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PromiseApiAdapterService, decorators: [{
51
- type: Injectable,
52
- args: [{
53
- providedIn: 'root',
54
- }]
55
- }] });
56
-
57
- // Copyright (c) 2023 Sourcefuse Technologies
58
- const ALL_LABEL = 'All';
59
- class SearchComponent {
60
- constructor(searchService,
61
- // tslint:disable-next-line:ban-types
62
- platformId, cdr, promiseAdapter) {
63
- this.searchService = searchService;
64
- this.platformId = platformId;
65
- this.cdr = cdr;
66
- this.promiseAdapter = promiseAdapter;
67
- this.searchBoxInput = '';
68
- this.suggestionsDisplay = false;
69
- this.categoryDisplay = false;
70
- this.searching = false;
71
- this.suggestions = [];
72
- this.recentSearches = [];
73
- this.category = ALL_LABEL;
74
- this.searchRequest$ = new Subject();
75
- /**
76
- * configure when application has own search input and use different all label
77
- */
78
- this.customAllLabel = ALL_LABEL;
79
- /**
80
- * configure to true when to show only search result overlay without search bar
81
- */
82
- this.showOnlySearchResultOverlay = false;
83
- /**
84
- * provide custom search event when showOnlySearchResultOverlay configure to true
85
- */
86
- this.customSearchEvent = {
87
- searchValue: '',
88
- modelName: this.customAllLabel,
89
- };
90
- // emitted when user clicks one of the suggested results (including recent search sugestions)
91
- this.clicked = new EventEmitter();
92
- this.searched = new EventEmitter();
93
- /* emitted when user makes search request (including recent search requests
94
- & requests made on change in category from dropdown)
95
- In case of recent search Array of recent Search request result is emitted */
96
- this.onChange = () => { };
97
- this.onTouched = () => { };
98
- this.disabled = false;
99
- }
100
- get config() {
101
- return this._config;
102
- }
103
- set config(value) {
104
- this._config = value;
105
- if (value && value.models) {
106
- value.models.unshift({
107
- name: ALL_LABEL,
108
- displayName: ALL_LABEL,
109
- });
110
- }
111
- else if (value && !value.models) {
112
- value.models = [
113
- {
114
- name: ALL_LABEL,
115
- displayName: ALL_LABEL,
116
- },
117
- ];
118
- }
119
- else {
120
- // do nothing
121
- }
122
- }
123
- set searchProvider(value) {
124
- if (isApiServiceWithPromise(value)) {
125
- value = this.promiseAdapter.adapt(value);
126
- }
127
- this.searchService = value;
128
- }
129
- get searchProvider() {
130
- return this.searchService;
131
- }
132
- ngOnInit() {
133
- this.searchRequest$
134
- .pipe(tap(v => (this.suggestions = [])), debounceTime(DEBOUNCE_TIME))
135
- .subscribe((value) => {
136
- this.searched.emit({
137
- event: value.event,
138
- keyword: value.input,
139
- category: this.category,
140
- });
141
- this.getSuggestions(value);
142
- this.cdr.markForCheck();
143
- });
144
- }
145
- // ControlValueAccessor Implementation
146
- writeValue(value) {
147
- this.searchBoxInput = value;
148
- }
149
- // When the value in the UI is changed, this method will invoke a callback function
150
- registerOnChange(fn) {
151
- this.onChange = fn;
152
- }
153
- registerOnTouched(fn) {
154
- this.onTouched = fn;
155
- }
156
- setDisabledState(isDisabled) {
157
- this.disabled = isDisabled;
158
- }
159
- getSuggestions(eventValue) {
160
- var _a, _b, _c, _d, _e;
161
- eventValue.input = eventValue.input.trim();
162
- if (!eventValue.input.length) {
163
- return;
164
- }
165
- const order = (_a = this.config.order) !== null && _a !== void 0 ? _a : DEFAULT_ORDER;
166
- let orderString = '';
167
- order.forEach(preference => (orderString = `${orderString}${preference} `));
168
- let saveInRecents = (_b = this.config.saveInRecents) !== null && _b !== void 0 ? _b : DEFAULT_SAVE_IN_RECENTS;
169
- if (this.config.saveInRecents && this.config.saveInRecentsOnlyOnEnter) {
170
- if (!eventValue.event ||
171
- (eventValue.event instanceof KeyboardEvent &&
172
- eventValue.event.key === 'Enter')) {
173
- saveInRecents = true; // save in recents only on enter or change in category
174
- }
175
- else {
176
- // do not save in recent search on typing
177
- saveInRecents = false;
178
- }
179
- }
180
- /* need to put default value here and not in contructor
181
- because sonar was giving code smell with definite assertion as all these
182
- parameters are optional */
183
- const requestParameters = {
184
- match: eventValue.input,
185
- sources: this._categoryToSourceName(this.category),
186
- limit: (_c = this.config.limit) !== null && _c !== void 0 ? _c : DEFAULT_LIMIT,
187
- limitByType: (_d = this.config.limitByType) !== null && _d !== void 0 ? _d : DEFAULT_LIMIT_TYPE,
188
- order: orderString,
189
- offset: (_e = this.config.offset) !== null && _e !== void 0 ? _e : DEFAULT_OFFSET,
190
- };
191
- this.searching = true;
192
- this.cdr.markForCheck();
193
- this.searchService
194
- .searchApiRequest(requestParameters, saveInRecents)
195
- .subscribe((value) => {
196
- this.suggestions = value;
197
- this.searching = false;
198
- this.cdr.markForCheck();
199
- }, (_error) => {
200
- this.suggestions = [];
201
- this.searching = false;
202
- this.cdr.markForCheck();
203
- });
204
- }
205
- getRecentSearches() {
206
- if (!this.config.hideRecentSearch &&
207
- this.searchService.recentSearchApiRequest) {
208
- this.searchService.recentSearchApiRequest().subscribe((value) => {
209
- this.recentSearches = value;
210
- this.cdr.markForCheck();
211
- }, (_error) => {
212
- this.recentSearches = [];
213
- this.cdr.markForCheck();
214
- });
215
- }
216
- }
217
- //event can be KeyBoardEvent or Event of type 'change'
218
- // fired on change in value of drop down for category
219
- hitSearchApi(event) {
220
- // this will happen only in case user searches something and
221
- // then erases it, we need to update recent search
222
- if (!this.searchBoxInput) {
223
- this.suggestions = [];
224
- this.getRecentSearches();
225
- return;
226
- }
227
- // no debounce time needed in case of searchOnlyOnEnter
228
- if (this.config.searchOnlyOnEnter) {
229
- if (!event || (event instanceof KeyboardEvent && event.key === 'Enter')) {
230
- this.getSuggestions({ input: this.searchBoxInput, event });
231
- }
232
- return;
233
- }
234
- // no debounce time needed in case of change in category
235
- if (!event) {
236
- this.getSuggestions({ input: this.searchBoxInput, event });
237
- return;
238
- }
239
- this.searchRequest$.next({
240
- input: this.searchBoxInput,
241
- event,
242
- });
243
- }
244
- populateValue(suggestion, event) {
245
- const value = suggestion[this.config.displayPropertyName];
246
- // converted to string to assign value to searchBoxInput
247
- this.searchBoxInput = value;
248
- this.suggestionsDisplay = false;
249
- // ngModelChange doesn't detect change in value
250
- // when populated from outside, hence calling manually
251
- this.onChange(this.searchBoxInput);
252
- // need to do this to show more search options for selected
253
- //suggestion - just in case user reopens search input
254
- this.getSuggestions({ input: this.searchBoxInput, event });
255
- this.clicked.emit({ item: suggestion, event });
256
- }
257
- populateValueRecentSearch(recentSearch, event) {
258
- event.stopPropagation();
259
- event.preventDefault();
260
- const value = recentSearch['match'];
261
- this.searchBoxInput = value;
262
- this.suggestionsDisplay = false;
263
- this.onChange(this.searchBoxInput);
264
- // need to do this to show more search options for selected
265
- // suggestion - just in case user reopens search input
266
- this.getSuggestions({ input: this.searchBoxInput, event });
267
- this.focusInput();
268
- this.showSuggestions();
269
- }
270
- fetchModelImageUrlFromSuggestion(suggestion) {
271
- const modelName = suggestion['source'];
272
- let url;
273
- this.config.models.forEach(model => {
274
- if (model.name === modelName && model.imageUrl) {
275
- url = model.imageUrl;
276
- }
277
- });
278
- return url;
279
- }
280
- boldString(str, substr) {
281
- const strRegExp = new RegExp(`(${substr})`, 'gi');
282
- const stringToMakeBold = str;
283
- return stringToMakeBold.replace(strRegExp, `<b>$1</b>`);
284
- }
285
- hideSuggestions() {
286
- this.suggestionsDisplay = false;
287
- this.onTouched();
288
- }
289
- showSuggestions() {
290
- this.suggestionsDisplay = true;
291
- this.getRecentSearches();
292
- }
293
- focusInput() {
294
- if (isPlatformBrowser(this.platformId) &&
295
- !this.showOnlySearchResultOverlay) {
296
- this.searchInputElement.nativeElement.focus();
297
- }
298
- }
299
- setCategory(category) {
300
- this.category = category;
301
- this.categoryDisplay = false;
302
- if (this.searchBoxInput) {
303
- this.hitSearchApi();
304
- this.focusInput();
305
- this.showSuggestions();
306
- }
307
- }
308
- showCategory() {
309
- this.categoryDisplay = !this.categoryDisplay;
310
- }
311
- hideCategory() {
312
- this.categoryDisplay = false;
313
- }
314
- resetInput() {
315
- this.searchBoxInput = '';
316
- this.suggestions = [];
317
- this.suggestionsDisplay = true;
318
- this.focusInput();
319
- // ngModelChange doesn't detect change in value
320
- // when populated from outside, hence calling manually
321
- this.onChange(this.searchBoxInput);
322
- this.getRecentSearches();
323
- }
324
- ngOnDestroy() {
325
- this.searchRequest$.unsubscribe();
326
- }
327
- _categoryToSourceName(category) {
328
- if ([ALL_LABEL, this.customAllLabel].includes(category)) {
329
- return [];
330
- }
331
- else {
332
- return [category];
333
- }
334
- }
335
- getModelFromModelName(name) {
336
- return this.config.models.find(item => item.name === name);
337
- }
338
- getModelsWithSuggestions() {
339
- const modelsWithSuggestions = [];
340
- const sources = [];
341
- this.suggestions.forEach(suggestion => {
342
- if (sources.indexOf(suggestion['source']) >= 0) {
343
- modelsWithSuggestions.every(modelWithSuggestions => {
344
- if (modelWithSuggestions.model.name === suggestion['source']) {
345
- modelWithSuggestions.items.push(suggestion);
346
- return false;
347
- }
348
- return true;
349
- });
350
- }
351
- else {
352
- const model = this.getModelFromModelName(suggestion['source']);
353
- modelsWithSuggestions.push({ model, items: [suggestion] });
354
- sources.push(suggestion['source']);
355
- }
356
- });
357
- return modelsWithSuggestions;
358
- }
359
- ngOnChanges(changes) {
360
- var _a, _b, _c, _d;
361
- if (changes.customSearchEvent) {
362
- if (this._isCustomSearchEventChange(changes, 'searchValue')) {
363
- this.searchBoxInput = (_b = (_a = this.customSearchEvent) === null || _a === void 0 ? void 0 : _a.searchValue) !== null && _b !== void 0 ? _b : '';
364
- this.searchOnCustomEventValueChange(this.searchBoxInput);
365
- }
366
- if (this._isCustomSearchEventChange(changes, 'modelName') &&
367
- ((_c = this.customSearchEvent) === null || _c === void 0 ? void 0 : _c.modelName)) {
368
- this.setCategory((_d = this.customSearchEvent) === null || _d === void 0 ? void 0 : _d.modelName);
369
- }
370
- }
371
- }
372
- searchOnCustomEventValueChange(value) {
373
- if (value === null || value === void 0 ? void 0 : value.length) {
374
- this.showSuggestions();
375
- this.hitSearchApi();
376
- }
377
- else {
378
- this.hideSuggestions();
379
- }
380
- }
381
- _isCustomSearchEventChange(changes, propertyName) {
382
- var _a, _b, _c;
383
- return (!((_a = changes.customSearchEvent) === null || _a === void 0 ? void 0 : _a.previousValue) ||
384
- ((_b = changes.customSearchEvent) === null || _b === void 0 ? void 0 : _b.previousValue[propertyName]) !==
385
- ((_c = changes.customSearchEvent) === null || _c === void 0 ? void 0 : _c.currentValue[propertyName]));
386
- }
387
- }
388
- SearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SearchComponent, deps: [{ token: SEARCH_SERVICE_TOKEN, optional: true }, { token: PLATFORM_ID }, { token: i0.ChangeDetectorRef }, { token: PromiseApiAdapterService }], target: i0.ɵɵFactoryTarget.Component });
389
- SearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SearchComponent, selector: "sourceloop-search", inputs: { config: "config", searchProvider: "searchProvider", titleTemplate: "titleTemplate", subtitleTemplate: "subtitleTemplate", customAllLabel: "customAllLabel", showOnlySearchResultOverlay: "showOnlySearchResultOverlay", customSearchEvent: "customSearchEvent" }, outputs: { clicked: "clicked", searched: "searched" }, providers: [
390
- {
391
- provide: NG_VALUE_ACCESSOR,
392
- useExisting: SearchComponent,
393
- multi: true,
394
- },
395
- ], viewQueries: [{ propertyName: "searchInputElement", first: true, predicate: ["searchInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"!showOnlySearchResultOverlay\">\n <div fxLayout fxLayoutAlign=\"start center\" class=\"toolbar-search\" *ngIf=\"config\">\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</ng-container>\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}.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}.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}.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:0;right:0;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}::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;border-color:#a53159}::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;border-left-style:none;border-right-style:none;border-top-right-radius:0;border-bottom-right-radius:0}::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;background-color:#a53159}::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;border-color:#a53159;background-color:#a53159}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff}::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;border-color:#90003b}::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;border-left-style:none;border-right-style:none;border-top-right-radius:0;border-bottom-right-radius:0}::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;background-color:#90003b}::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;border-color:#90003b;background-color:#90003b}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff}::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"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.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"] }, { kind: "directive", type: i9.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"] }, { kind: "directive", type: i9.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"] }] });
396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SearchComponent, decorators: [{
397
- type: Component,
398
- args: [{ selector: 'sourceloop-search', providers: [
399
- {
400
- provide: NG_VALUE_ACCESSOR,
401
- useExisting: SearchComponent,
402
- multi: true,
403
- },
404
- ], template: "<ng-container *ngIf=\"!showOnlySearchResultOverlay\">\n <div fxLayout fxLayoutAlign=\"start center\" class=\"toolbar-search\" *ngIf=\"config\">\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</ng-container>\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}.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}.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}.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:0;right:0;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}::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;border-color:#a53159}::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;border-left-style:none;border-right-style:none;border-top-right-radius:0;border-bottom-right-radius:0}::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;background-color:#a53159}::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;border-color:#a53159;background-color:#a53159}::ng-deep .toolbar-search:hover .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff}::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;border-color:#90003b}::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;border-left-style:none;border-right-style:none;border-top-right-radius:0;border-bottom-right-radius:0}::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;background-color:#90003b}::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;border-color:#90003b;background-color:#90003b}::ng-deep .toolbar-search:focus-within .toolbar-search-select.mat-form-field:not(.mat-form-field-disabled) .mat-select{color:#fff}::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"] }]
405
- }], ctorParameters: function () {
406
- return [{ type: undefined, decorators: [{
407
- type: Inject,
408
- args: [SEARCH_SERVICE_TOKEN]
409
- }, {
410
- type: Optional
411
- }] }, { type: Object, decorators: [{
412
- type: Inject,
413
- args: [PLATFORM_ID]
414
- }] }, { type: i0.ChangeDetectorRef }, { type: PromiseApiAdapterService }];
415
- }, propDecorators: { config: [{
416
- type: Input
417
- }], searchProvider: [{
418
- type: Input
419
- }], titleTemplate: [{
420
- type: Input
421
- }], subtitleTemplate: [{
422
- type: Input
423
- }], customAllLabel: [{
424
- type: Input
425
- }], showOnlySearchResultOverlay: [{
426
- type: Input
427
- }], customSearchEvent: [{
428
- type: Input
429
- }], clicked: [{
430
- type: Output
431
- }], searched: [{
432
- type: Output
433
- }], searchInputElement: [{
434
- type: ViewChild,
435
- args: ['searchInput']
436
- }] } });
437
-
438
- // Copyright (c) 2023 Sourcefuse Technologies
439
- class SearchLibModule {
440
- }
441
- SearchLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SearchLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
442
- SearchLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SearchLibModule, declarations: [SearchComponent], imports: [CommonModule,
443
- FormsModule,
444
- HttpClientModule,
445
- MatSelectModule,
446
- MatFormFieldModule,
447
- MatIconModule,
448
- MatInputModule,
449
- FlexLayoutModule], exports: [SearchComponent] });
450
- SearchLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SearchLibModule, imports: [CommonModule,
451
- FormsModule,
452
- HttpClientModule,
453
- MatSelectModule,
454
- MatFormFieldModule,
455
- MatIconModule,
456
- MatInputModule,
457
- FlexLayoutModule] });
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SearchLibModule, decorators: [{
459
- type: NgModule,
460
- args: [{
461
- declarations: [SearchComponent],
462
- imports: [
463
- CommonModule,
464
- FormsModule,
465
- HttpClientModule,
466
- MatSelectModule,
467
- MatFormFieldModule,
468
- MatIconModule,
469
- MatInputModule,
470
- FlexLayoutModule,
471
- ],
472
- exports: [SearchComponent],
473
- }]
474
- }] });
475
-
476
- class Configuration {
477
- constructor(d) {
478
- checkForError(d);
479
- this.displayPropertyName = d.displayPropertyName;
480
- this.models = d.models;
481
- /* IRequestParameters - will be given default values before call is made in case undefined/null,
482
- otherwise there ! is used on which sonar gives code smell */
483
- this.limit = d.limit;
484
- this.limitByType = d.limitByType;
485
- this.order = d.order;
486
- this.offset = d.offset;
487
- this.saveInRecents = d.saveInRecents;
488
- const displayTexts = setDisplayText(d);
489
- this.noResultMessage = displayTexts.noResultMessage;
490
- this.placeholder = displayTexts.placeholder;
491
- this.placeholderFunction = displayTexts.placeholderFunction;
492
- const searchConfig = setSearchConfig(d);
493
- this.categorizeResults = searchConfig.categorizeResults;
494
- this.hideRecentSearch = searchConfig.hideRecentSearch;
495
- this.hideCategorizeButton = searchConfig.hideCategorizeButton;
496
- this.saveInRecentsOnlyOnEnter = searchConfig.saveInRecentsOnlyOnEnter;
497
- this.searchOnlyOnEnter = searchConfig.searchOnlyOnEnter;
498
- const classes = setIconClasses(d);
499
- this.searchIconClass = classes.searchIconClass;
500
- this.crossIconClass = classes.crossIconClass;
501
- this.dropDownButtonIconClass = classes.dropDownButtonIconClass;
502
- this.recentSearchIconClass = classes.recentSearchIconClass;
503
- }
504
- }
505
- function checkForError(d) {
506
- if (d.categorizeResults === false &&
507
- (d.hideCategorizeButton === false || d.hideCategorizeButton === undefined)) {
508
- throw new Error('You must provide hideCategorizeButton:true as categorizeResults is false');
509
- }
510
- if (d.saveInRecents === false && d.saveInRecentsOnlyOnEnter === true) {
511
- throw new Error('You must provide saveInRecents:true for saveInRecentsOnlyOnEnter:true');
512
- }
513
- }
514
- function setDisplayText(d) {
515
- var _a, _b;
516
- return {
517
- placeholder: (_a = d.placeholder) !== null && _a !== void 0 ? _a : 'Search',
518
- noResultMessage: (_b = d.noResultMessage) !== null && _b !== void 0 ? _b : 'No result found',
519
- placeholderFunction: d.placeholderFunction,
520
- };
521
- }
522
- function setSearchConfig(d) {
523
- var _a, _b, _c, _d, _e;
524
- return {
525
- categorizeResults: (_a = d.categorizeResults) !== null && _a !== void 0 ? _a : true,
526
- hideRecentSearch: (_b = d.hideRecentSearch) !== null && _b !== void 0 ? _b : false,
527
- hideCategorizeButton: (_c = d.hideCategorizeButton) !== null && _c !== void 0 ? _c : false,
528
- saveInRecentsOnlyOnEnter: (_d = d.saveInRecentsOnlyOnEnter) !== null && _d !== void 0 ? _d : false,
529
- searchOnlyOnEnter: (_e = d.searchOnlyOnEnter) !== null && _e !== void 0 ? _e : false,
530
- };
531
- }
532
- function setIconClasses(d) {
533
- var _a, _b, _c, _d;
534
- return {
535
- searchIconClass: (_a = d.searchIconClass) !== null && _a !== void 0 ? _a : 'icomoon Search',
536
- crossIconClass: (_b = d.crossIconClass) !== null && _b !== void 0 ? _b : 'icomoon close',
537
- dropDownButtonIconClass: (_c = d.dropDownButtonIconClass) !== null && _c !== void 0 ? _c : 'icomoon arrow_down',
538
- recentSearchIconClass: (_d = d.recentSearchIconClass) !== null && _d !== void 0 ? _d : 'icomoon Search',
539
- };
540
- }
541
-
542
- // Copyright (c) 2023 Sourcefuse Technologies
543
-
544
- /**
545
- * Generated bundle index. Do not edit.
546
- */
547
-
548
- export { Configuration, DEBOUNCE_TIME, DEFAULT_LIMIT, DEFAULT_LIMIT_TYPE, DEFAULT_OFFSET, DEFAULT_ORDER, DEFAULT_SAVE_IN_RECENTS, SEARCH_SERVICE_TOKEN, SearchComponent, SearchLibModule, isApiServiceWithPromise };
549
- //# sourceMappingURL=sourceloop-search-client.mjs.map