@seekora-ai/ui-sdk-angular 1.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.
- package/dist/index.d.ts +433 -0
- package/dist/index.esm.js +2526 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2550 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,2526 @@
|
|
|
1
|
+
import { InjectionToken, Injectable, Component, Input, Output, ViewChild, EventEmitter, ContentChild } from '@angular/core';
|
|
2
|
+
import { createTheme as createTheme$1, log, extractField, formatPrice } from '@seekora-ai/ui-sdk-core';
|
|
3
|
+
export { mergeThemes } from '@seekora-ai/ui-sdk-core';
|
|
4
|
+
import { BehaviorSubject, from, Subject, Subscription } from 'rxjs';
|
|
5
|
+
import { map, catchError, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
|
|
6
|
+
|
|
7
|
+
/******************************************************************************
|
|
8
|
+
Copyright (c) Microsoft Corporation.
|
|
9
|
+
|
|
10
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
+
purpose with or without fee is hereby granted.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
+
***************************************************************************** */
|
|
21
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
25
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
26
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
27
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
28
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
29
|
+
var _, done = false;
|
|
30
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
31
|
+
var context = {};
|
|
32
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
33
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
34
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
35
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
36
|
+
if (kind === "accessor") {
|
|
37
|
+
if (result === void 0) continue;
|
|
38
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
39
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
40
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
41
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
42
|
+
}
|
|
43
|
+
else if (_ = accept(result)) {
|
|
44
|
+
if (kind === "field") initializers.unshift(_);
|
|
45
|
+
else descriptor[key] = _;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
49
|
+
done = true;
|
|
50
|
+
}
|
|
51
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
52
|
+
var useValue = arguments.length > 2;
|
|
53
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
54
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
55
|
+
}
|
|
56
|
+
return useValue ? value : void 0;
|
|
57
|
+
}
|
|
58
|
+
function __setFunctionName(f, name, prefix) {
|
|
59
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
60
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
61
|
+
}
|
|
62
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
63
|
+
var e = new Error(message);
|
|
64
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Default Theme
|
|
69
|
+
*/
|
|
70
|
+
const defaultTheme = {
|
|
71
|
+
colors: {
|
|
72
|
+
primary: '#007bff',
|
|
73
|
+
secondary: '#6c757d',
|
|
74
|
+
background: '#ffffff',
|
|
75
|
+
surface: '#f8f9fa',
|
|
76
|
+
text: '#212529',
|
|
77
|
+
textSecondary: '#6c757d',
|
|
78
|
+
border: '#dee2e6',
|
|
79
|
+
hover: '#f8f9fa',
|
|
80
|
+
focus: '#007bff',
|
|
81
|
+
error: '#dc3545',
|
|
82
|
+
success: '#28a745',
|
|
83
|
+
warning: '#ffc107',
|
|
84
|
+
},
|
|
85
|
+
typography: {
|
|
86
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
87
|
+
fontSize: {
|
|
88
|
+
small: '0.875rem',
|
|
89
|
+
medium: '1rem',
|
|
90
|
+
large: '1.25rem',
|
|
91
|
+
},
|
|
92
|
+
fontWeight: {
|
|
93
|
+
normal: 400,
|
|
94
|
+
medium: 500,
|
|
95
|
+
semibold: 600,
|
|
96
|
+
bold: 700,
|
|
97
|
+
},
|
|
98
|
+
lineHeight: {
|
|
99
|
+
tight: 1.25,
|
|
100
|
+
normal: 1.5,
|
|
101
|
+
relaxed: 1.75,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
spacing: {
|
|
105
|
+
small: '0.5rem',
|
|
106
|
+
medium: '1rem',
|
|
107
|
+
large: '1.5rem',
|
|
108
|
+
},
|
|
109
|
+
borderRadius: {
|
|
110
|
+
none: '0',
|
|
111
|
+
small: '0.25rem',
|
|
112
|
+
medium: '0.375rem',
|
|
113
|
+
large: '0.5rem',
|
|
114
|
+
full: '9999px',
|
|
115
|
+
},
|
|
116
|
+
shadows: {
|
|
117
|
+
small: '0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)',
|
|
118
|
+
medium: '0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)',
|
|
119
|
+
large: '0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23)',
|
|
120
|
+
},
|
|
121
|
+
transitions: {
|
|
122
|
+
fast: '150ms ease-in-out',
|
|
123
|
+
normal: '250ms ease-in-out',
|
|
124
|
+
slow: '350ms ease-in-out',
|
|
125
|
+
},
|
|
126
|
+
breakpoints: {
|
|
127
|
+
sm: '640px',
|
|
128
|
+
md: '768px',
|
|
129
|
+
lg: '1024px',
|
|
130
|
+
xl: '1280px',
|
|
131
|
+
},
|
|
132
|
+
zIndex: {
|
|
133
|
+
dropdown: 1000,
|
|
134
|
+
modal: 2000,
|
|
135
|
+
tooltip: 3000,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* createTheme utility
|
|
141
|
+
*
|
|
142
|
+
* Creates a complete theme from a partial theme configuration
|
|
143
|
+
*/
|
|
144
|
+
const createTheme = (config) => {
|
|
145
|
+
return createTheme$1(config, defaultTheme);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* SearchContext Service
|
|
150
|
+
*
|
|
151
|
+
* Provides search context (client, theme, etc.) to Angular components
|
|
152
|
+
*/
|
|
153
|
+
const SEEKORA_CLIENT = new InjectionToken('SEEKORA_CLIENT');
|
|
154
|
+
const SEEKORA_THEME_CONFIG = new InjectionToken('SEEKORA_THEME_CONFIG');
|
|
155
|
+
let SearchContextService = (() => {
|
|
156
|
+
let _classDecorators = [Injectable({
|
|
157
|
+
providedIn: 'root',
|
|
158
|
+
})];
|
|
159
|
+
let _classDescriptor;
|
|
160
|
+
let _classExtraInitializers = [];
|
|
161
|
+
let _classThis;
|
|
162
|
+
_classThis = class {
|
|
163
|
+
constructor(client, themeConfig, enableAnalytics = true, autoTrackSearch = true) {
|
|
164
|
+
log.verbose('SearchContextService: Initializing', {
|
|
165
|
+
hasTheme: !!themeConfig,
|
|
166
|
+
enableAnalytics,
|
|
167
|
+
autoTrackSearch,
|
|
168
|
+
});
|
|
169
|
+
this.client = client;
|
|
170
|
+
this.theme = themeConfig ? createTheme(themeConfig) : defaultTheme;
|
|
171
|
+
this.enableAnalytics = enableAnalytics;
|
|
172
|
+
this.autoTrackSearch = autoTrackSearch;
|
|
173
|
+
log.info('SearchContextService: Initialized successfully');
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
__setFunctionName(_classThis, "SearchContextService");
|
|
177
|
+
(() => {
|
|
178
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
179
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
180
|
+
_classThis = _classDescriptor.value;
|
|
181
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
182
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
183
|
+
})();
|
|
184
|
+
return _classThis;
|
|
185
|
+
})();
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* SeekoraSearch Service
|
|
189
|
+
*
|
|
190
|
+
* Service for performing searches with the Seekora SDK
|
|
191
|
+
*/
|
|
192
|
+
let SeekoraSearchService = (() => {
|
|
193
|
+
let _classDecorators = [Injectable({
|
|
194
|
+
providedIn: 'root',
|
|
195
|
+
})];
|
|
196
|
+
let _classDescriptor;
|
|
197
|
+
let _classExtraInitializers = [];
|
|
198
|
+
let _classThis;
|
|
199
|
+
_classThis = class {
|
|
200
|
+
constructor(searchContext) {
|
|
201
|
+
this.searchContext = searchContext;
|
|
202
|
+
this.searchStateSubject = new BehaviorSubject({
|
|
203
|
+
results: null,
|
|
204
|
+
loading: false,
|
|
205
|
+
error: null,
|
|
206
|
+
context: null,
|
|
207
|
+
});
|
|
208
|
+
this.searchState$ = this.searchStateSubject.asObservable();
|
|
209
|
+
}
|
|
210
|
+
search(options) {
|
|
211
|
+
const query = options.q || '';
|
|
212
|
+
log.verbose('SeekoraSearchService: Starting search', { query, options });
|
|
213
|
+
this.searchStateSubject.next({
|
|
214
|
+
...this.searchStateSubject.value,
|
|
215
|
+
loading: true,
|
|
216
|
+
error: null,
|
|
217
|
+
});
|
|
218
|
+
const { q, ...restOptions } = options;
|
|
219
|
+
const searchPromise = this.searchContext.client.search(q, restOptions);
|
|
220
|
+
return from(searchPromise).pipe(map((response) => {
|
|
221
|
+
log.info('SeekoraSearchService: Search completed', {
|
|
222
|
+
query,
|
|
223
|
+
resultsCount: response?.results?.length || 0,
|
|
224
|
+
hasContext: !!response?.context,
|
|
225
|
+
});
|
|
226
|
+
this.searchStateSubject.next({
|
|
227
|
+
results: response,
|
|
228
|
+
loading: false,
|
|
229
|
+
error: null,
|
|
230
|
+
context: response.context || null,
|
|
231
|
+
});
|
|
232
|
+
return response;
|
|
233
|
+
}), catchError((err) => {
|
|
234
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
235
|
+
log.error('SeekoraSearchService: Search failed', {
|
|
236
|
+
query,
|
|
237
|
+
error: error.message,
|
|
238
|
+
stack: error.stack,
|
|
239
|
+
});
|
|
240
|
+
this.searchStateSubject.next({
|
|
241
|
+
results: null,
|
|
242
|
+
loading: false,
|
|
243
|
+
error,
|
|
244
|
+
context: null,
|
|
245
|
+
});
|
|
246
|
+
throw error;
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
clearResults() {
|
|
250
|
+
this.searchStateSubject.next({
|
|
251
|
+
results: null,
|
|
252
|
+
loading: false,
|
|
253
|
+
error: null,
|
|
254
|
+
context: null,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
getCurrentState() {
|
|
258
|
+
return this.searchStateSubject.value;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
__setFunctionName(_classThis, "SeekoraSearchService");
|
|
262
|
+
(() => {
|
|
263
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
264
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
265
|
+
_classThis = _classDescriptor.value;
|
|
266
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
267
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
268
|
+
})();
|
|
269
|
+
return _classThis;
|
|
270
|
+
})();
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* QuerySuggestions Service
|
|
274
|
+
*
|
|
275
|
+
* Service for fetching query suggestions with debouncing
|
|
276
|
+
*/
|
|
277
|
+
let QuerySuggestionsService = (() => {
|
|
278
|
+
let _classDecorators = [Injectable({
|
|
279
|
+
providedIn: 'root',
|
|
280
|
+
})];
|
|
281
|
+
let _classDescriptor;
|
|
282
|
+
let _classExtraInitializers = [];
|
|
283
|
+
let _classThis;
|
|
284
|
+
_classThis = class {
|
|
285
|
+
constructor(searchContext, debounceMs = 300, maxSuggestions = 10) {
|
|
286
|
+
this.searchContext = searchContext;
|
|
287
|
+
this.debounceMs = debounceMs;
|
|
288
|
+
this.maxSuggestions = maxSuggestions;
|
|
289
|
+
this.querySubject = new BehaviorSubject('');
|
|
290
|
+
this.suggestionsStateSubject = new BehaviorSubject({
|
|
291
|
+
suggestions: [],
|
|
292
|
+
loading: false,
|
|
293
|
+
error: null,
|
|
294
|
+
});
|
|
295
|
+
this.suggestionsState$ = this.suggestionsStateSubject.asObservable();
|
|
296
|
+
this.querySubject.pipe(debounceTime(300), distinctUntilChanged(), switchMap((query) => {
|
|
297
|
+
if (!query.trim()) {
|
|
298
|
+
this.suggestionsStateSubject.next({
|
|
299
|
+
suggestions: [],
|
|
300
|
+
loading: false,
|
|
301
|
+
error: null,
|
|
302
|
+
});
|
|
303
|
+
return from(Promise.resolve([]));
|
|
304
|
+
}
|
|
305
|
+
this.suggestionsStateSubject.next({
|
|
306
|
+
...this.suggestionsStateSubject.value,
|
|
307
|
+
loading: true,
|
|
308
|
+
error: null,
|
|
309
|
+
});
|
|
310
|
+
return from(this.searchContext.client.getSuggestions(query, 10)).pipe(map((response) => {
|
|
311
|
+
const rawSuggestions = Array.isArray(response) ? response : [];
|
|
312
|
+
const suggestionItems = rawSuggestions.map((suggestion) => {
|
|
313
|
+
const suggestionQuery = suggestion.query || suggestion.text || suggestion;
|
|
314
|
+
const count = suggestion.popularity !== undefined
|
|
315
|
+
? suggestion.popularity
|
|
316
|
+
: (suggestion.count !== undefined ? suggestion.count : undefined);
|
|
317
|
+
return {
|
|
318
|
+
query: typeof suggestionQuery === 'string' ? suggestionQuery : String(suggestionQuery),
|
|
319
|
+
count: typeof count === 'number' ? count : undefined,
|
|
320
|
+
metadata: suggestion,
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
this.suggestionsStateSubject.next({
|
|
324
|
+
suggestions: suggestionItems,
|
|
325
|
+
loading: false,
|
|
326
|
+
error: null,
|
|
327
|
+
});
|
|
328
|
+
log.verbose('QuerySuggestionsService: Suggestions fetched', {
|
|
329
|
+
query,
|
|
330
|
+
count: suggestionItems.length,
|
|
331
|
+
});
|
|
332
|
+
return suggestionItems;
|
|
333
|
+
}), catchError((err) => {
|
|
334
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
335
|
+
log.error('QuerySuggestionsService: Failed to fetch suggestions', {
|
|
336
|
+
query,
|
|
337
|
+
error: error.message,
|
|
338
|
+
stack: error.stack,
|
|
339
|
+
});
|
|
340
|
+
this.suggestionsStateSubject.next({
|
|
341
|
+
suggestions: [],
|
|
342
|
+
loading: false,
|
|
343
|
+
error,
|
|
344
|
+
});
|
|
345
|
+
return from(Promise.resolve([]));
|
|
346
|
+
}));
|
|
347
|
+
})).subscribe();
|
|
348
|
+
}
|
|
349
|
+
setQuery(query) {
|
|
350
|
+
this.querySubject.next(query);
|
|
351
|
+
}
|
|
352
|
+
getCurrentState() {
|
|
353
|
+
return this.suggestionsStateSubject.value;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
__setFunctionName(_classThis, "QuerySuggestionsService");
|
|
357
|
+
(() => {
|
|
358
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
359
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
360
|
+
_classThis = _classDescriptor.value;
|
|
361
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
362
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
363
|
+
})();
|
|
364
|
+
return _classThis;
|
|
365
|
+
})();
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* SearchProvider Component
|
|
369
|
+
*
|
|
370
|
+
* Provides Seekora client and context to child components
|
|
371
|
+
*/
|
|
372
|
+
let SearchProviderComponent = (() => {
|
|
373
|
+
let _classDecorators = [Component({
|
|
374
|
+
selector: 'seekora-search-provider',
|
|
375
|
+
template: '<ng-content></ng-content>',
|
|
376
|
+
providers: [
|
|
377
|
+
{
|
|
378
|
+
provide: SEEKORA_CLIENT,
|
|
379
|
+
useFactory: (component) => component.client,
|
|
380
|
+
deps: [SearchProviderComponent],
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
provide: SEEKORA_THEME_CONFIG,
|
|
384
|
+
useFactory: (component) => component.theme,
|
|
385
|
+
deps: [SearchProviderComponent],
|
|
386
|
+
},
|
|
387
|
+
SearchContextService,
|
|
388
|
+
],
|
|
389
|
+
})];
|
|
390
|
+
let _classDescriptor;
|
|
391
|
+
let _classExtraInitializers = [];
|
|
392
|
+
let _classThis;
|
|
393
|
+
let _client_decorators;
|
|
394
|
+
let _client_initializers = [];
|
|
395
|
+
let _client_extraInitializers = [];
|
|
396
|
+
let _theme_decorators;
|
|
397
|
+
let _theme_initializers = [];
|
|
398
|
+
let _theme_extraInitializers = [];
|
|
399
|
+
let _enableAnalytics_decorators;
|
|
400
|
+
let _enableAnalytics_initializers = [];
|
|
401
|
+
let _enableAnalytics_extraInitializers = [];
|
|
402
|
+
let _autoTrackSearch_decorators;
|
|
403
|
+
let _autoTrackSearch_initializers = [];
|
|
404
|
+
let _autoTrackSearch_extraInitializers = [];
|
|
405
|
+
var SearchProviderComponent = _classThis = class {
|
|
406
|
+
constructor(injector) {
|
|
407
|
+
this.injector = injector;
|
|
408
|
+
this.client = __runInitializers(this, _client_initializers, void 0);
|
|
409
|
+
this.theme = (__runInitializers(this, _client_extraInitializers), __runInitializers(this, _theme_initializers, void 0));
|
|
410
|
+
this.enableAnalytics = (__runInitializers(this, _theme_extraInitializers), __runInitializers(this, _enableAnalytics_initializers, true));
|
|
411
|
+
this.autoTrackSearch = (__runInitializers(this, _enableAnalytics_extraInitializers), __runInitializers(this, _autoTrackSearch_initializers, true));
|
|
412
|
+
__runInitializers(this, _autoTrackSearch_extraInitializers);
|
|
413
|
+
this.injector = injector;
|
|
414
|
+
}
|
|
415
|
+
ngOnInit() {
|
|
416
|
+
if (!this.client) {
|
|
417
|
+
throw new Error('SearchProvider: client is required');
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
ngOnDestroy() {
|
|
421
|
+
// Cleanup if needed
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
__setFunctionName(_classThis, "SearchProviderComponent");
|
|
425
|
+
(() => {
|
|
426
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
427
|
+
_client_decorators = [Input()];
|
|
428
|
+
_theme_decorators = [Input()];
|
|
429
|
+
_enableAnalytics_decorators = [Input()];
|
|
430
|
+
_autoTrackSearch_decorators = [Input()];
|
|
431
|
+
__esDecorate(null, null, _client_decorators, { kind: "field", name: "client", static: false, private: false, access: { has: obj => "client" in obj, get: obj => obj.client, set: (obj, value) => { obj.client = value; } }, metadata: _metadata }, _client_initializers, _client_extraInitializers);
|
|
432
|
+
__esDecorate(null, null, _theme_decorators, { kind: "field", name: "theme", static: false, private: false, access: { has: obj => "theme" in obj, get: obj => obj.theme, set: (obj, value) => { obj.theme = value; } }, metadata: _metadata }, _theme_initializers, _theme_extraInitializers);
|
|
433
|
+
__esDecorate(null, null, _enableAnalytics_decorators, { kind: "field", name: "enableAnalytics", static: false, private: false, access: { has: obj => "enableAnalytics" in obj, get: obj => obj.enableAnalytics, set: (obj, value) => { obj.enableAnalytics = value; } }, metadata: _metadata }, _enableAnalytics_initializers, _enableAnalytics_extraInitializers);
|
|
434
|
+
__esDecorate(null, null, _autoTrackSearch_decorators, { kind: "field", name: "autoTrackSearch", static: false, private: false, access: { has: obj => "autoTrackSearch" in obj, get: obj => obj.autoTrackSearch, set: (obj, value) => { obj.autoTrackSearch = value; } }, metadata: _metadata }, _autoTrackSearch_initializers, _autoTrackSearch_extraInitializers);
|
|
435
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
436
|
+
SearchProviderComponent = _classThis = _classDescriptor.value;
|
|
437
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
438
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
439
|
+
})();
|
|
440
|
+
return SearchProviderComponent = _classThis;
|
|
441
|
+
})();
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* SearchBar Component
|
|
445
|
+
*
|
|
446
|
+
* Interactive search input component with query suggestions support
|
|
447
|
+
*/
|
|
448
|
+
let SearchBarComponent = (() => {
|
|
449
|
+
let _classDecorators = [Component({
|
|
450
|
+
selector: 'seekora-search-bar',
|
|
451
|
+
template: `
|
|
452
|
+
<div [style.position]="'relative'">
|
|
453
|
+
<input
|
|
454
|
+
#searchInput
|
|
455
|
+
type="text"
|
|
456
|
+
[value]="query"
|
|
457
|
+
(input)="onInputChange($event)"
|
|
458
|
+
(focus)="onFocus()"
|
|
459
|
+
(blur)="onBlur()"
|
|
460
|
+
(keydown)="onKeyDown($event)"
|
|
461
|
+
[placeholder]="placeholder"
|
|
462
|
+
[style]="getInputStyle()"
|
|
463
|
+
/>
|
|
464
|
+
|
|
465
|
+
<div
|
|
466
|
+
*ngIf="showSuggestionsList"
|
|
467
|
+
[style]="getSuggestionsStyle()"
|
|
468
|
+
>
|
|
469
|
+
<div *ngIf="suggestionsLoading" [style]="loadingStyle">
|
|
470
|
+
Loading suggestions...
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
<div
|
|
474
|
+
*ngFor="let suggestion of displayedSuggestions; let i = index"
|
|
475
|
+
(click)="selectSuggestion(suggestion.query)"
|
|
476
|
+
(mouseenter)="selectedIndex = i"
|
|
477
|
+
[style]="getSuggestionStyle(i)"
|
|
478
|
+
>
|
|
479
|
+
{{ suggestion.query }}
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
<div *ngIf="!suggestionsLoading && displayedSuggestions.length === 0 && query.length >= minQueryLength" [style]="emptyStyle">
|
|
483
|
+
No suggestions found
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
`,
|
|
488
|
+
})];
|
|
489
|
+
let _classDescriptor;
|
|
490
|
+
let _classExtraInitializers = [];
|
|
491
|
+
let _classThis;
|
|
492
|
+
let _placeholder_decorators;
|
|
493
|
+
let _placeholder_initializers = [];
|
|
494
|
+
let _placeholder_extraInitializers = [];
|
|
495
|
+
let _showSuggestions_decorators;
|
|
496
|
+
let _showSuggestions_initializers = [];
|
|
497
|
+
let _showSuggestions_extraInitializers = [];
|
|
498
|
+
let _minQueryLength_decorators;
|
|
499
|
+
let _minQueryLength_initializers = [];
|
|
500
|
+
let _minQueryLength_extraInitializers = [];
|
|
501
|
+
let _maxSuggestions_decorators;
|
|
502
|
+
let _maxSuggestions_initializers = [];
|
|
503
|
+
let _maxSuggestions_extraInitializers = [];
|
|
504
|
+
let _debounceMs_decorators;
|
|
505
|
+
let _debounceMs_initializers = [];
|
|
506
|
+
let _debounceMs_extraInitializers = [];
|
|
507
|
+
let _searchOptions_decorators;
|
|
508
|
+
let _searchOptions_initializers = [];
|
|
509
|
+
let _searchOptions_extraInitializers = [];
|
|
510
|
+
let _search_decorators;
|
|
511
|
+
let _search_initializers = [];
|
|
512
|
+
let _search_extraInitializers = [];
|
|
513
|
+
let _suggestionSelect_decorators;
|
|
514
|
+
let _suggestionSelect_initializers = [];
|
|
515
|
+
let _suggestionSelect_extraInitializers = [];
|
|
516
|
+
let _queryChange_decorators;
|
|
517
|
+
let _queryChange_initializers = [];
|
|
518
|
+
let _queryChange_extraInitializers = [];
|
|
519
|
+
let _searchStateChange_decorators;
|
|
520
|
+
let _searchStateChange_initializers = [];
|
|
521
|
+
let _searchStateChange_extraInitializers = [];
|
|
522
|
+
let _searchInput_decorators;
|
|
523
|
+
let _searchInput_initializers = [];
|
|
524
|
+
let _searchInput_extraInitializers = [];
|
|
525
|
+
_classThis = class {
|
|
526
|
+
constructor(searchContext, searchService, suggestionsService) {
|
|
527
|
+
this.searchContext = searchContext;
|
|
528
|
+
this.searchService = searchService;
|
|
529
|
+
this.suggestionsService = suggestionsService;
|
|
530
|
+
this.placeholder = __runInitializers(this, _placeholder_initializers, 'Search...');
|
|
531
|
+
this.showSuggestions = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _showSuggestions_initializers, true));
|
|
532
|
+
this.minQueryLength = (__runInitializers(this, _showSuggestions_extraInitializers), __runInitializers(this, _minQueryLength_initializers, 1));
|
|
533
|
+
this.maxSuggestions = (__runInitializers(this, _minQueryLength_extraInitializers), __runInitializers(this, _maxSuggestions_initializers, 10));
|
|
534
|
+
this.debounceMs = (__runInitializers(this, _maxSuggestions_extraInitializers), __runInitializers(this, _debounceMs_initializers, 300));
|
|
535
|
+
this.searchOptions = (__runInitializers(this, _debounceMs_extraInitializers), __runInitializers(this, _searchOptions_initializers, void 0));
|
|
536
|
+
this.search = (__runInitializers(this, _searchOptions_extraInitializers), __runInitializers(this, _search_initializers, new EventEmitter()));
|
|
537
|
+
this.suggestionSelect = (__runInitializers(this, _search_extraInitializers), __runInitializers(this, _suggestionSelect_initializers, new EventEmitter()));
|
|
538
|
+
this.queryChange = (__runInitializers(this, _suggestionSelect_extraInitializers), __runInitializers(this, _queryChange_initializers, new EventEmitter()));
|
|
539
|
+
this.searchStateChange = (__runInitializers(this, _queryChange_extraInitializers), __runInitializers(this, _searchStateChange_initializers, new EventEmitter()));
|
|
540
|
+
this.searchInput = (__runInitializers(this, _searchStateChange_extraInitializers), __runInitializers(this, _searchInput_initializers, void 0));
|
|
541
|
+
this.query = (__runInitializers(this, _searchInput_extraInitializers), '');
|
|
542
|
+
this.isFocused = false;
|
|
543
|
+
this.selectedIndex = -1;
|
|
544
|
+
this.suggestions = [];
|
|
545
|
+
this.suggestionsLoading = false;
|
|
546
|
+
this.querySubject = new Subject();
|
|
547
|
+
this.subscriptions = new Subscription();
|
|
548
|
+
}
|
|
549
|
+
ngOnInit() {
|
|
550
|
+
// Subscribe to query changes for suggestions
|
|
551
|
+
const querySub = this.querySubject.pipe(debounceTime(this.debounceMs), distinctUntilChanged()).subscribe(query => {
|
|
552
|
+
if (this.showSuggestions && query.length >= this.minQueryLength) {
|
|
553
|
+
this.suggestionsService.setQuery(query);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
// Subscribe to suggestions state
|
|
557
|
+
const suggestionsSub = this.suggestionsService.suggestionsState$.subscribe(state => {
|
|
558
|
+
this.suggestions = state.suggestions;
|
|
559
|
+
this.suggestionsLoading = state.loading;
|
|
560
|
+
});
|
|
561
|
+
// Subscribe to search state
|
|
562
|
+
const searchSub = this.searchService.searchState$.subscribe(state => {
|
|
563
|
+
this.searchStateChange.emit({
|
|
564
|
+
results: state.results,
|
|
565
|
+
loading: state.loading,
|
|
566
|
+
error: state.error,
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
this.subscriptions.add(querySub);
|
|
570
|
+
this.subscriptions.add(suggestionsSub);
|
|
571
|
+
this.subscriptions.add(searchSub);
|
|
572
|
+
}
|
|
573
|
+
ngOnDestroy() {
|
|
574
|
+
this.subscriptions.unsubscribe();
|
|
575
|
+
}
|
|
576
|
+
get displayedSuggestions() {
|
|
577
|
+
return this.suggestions.slice(0, this.maxSuggestions);
|
|
578
|
+
}
|
|
579
|
+
get showSuggestionsList() {
|
|
580
|
+
return this.isFocused && this.showSuggestions && this.query.length >= this.minQueryLength;
|
|
581
|
+
}
|
|
582
|
+
onInputChange(event) {
|
|
583
|
+
const target = event.target;
|
|
584
|
+
this.query = target.value;
|
|
585
|
+
this.selectedIndex = -1;
|
|
586
|
+
this.querySubject.next(this.query);
|
|
587
|
+
this.queryChange.emit(this.query);
|
|
588
|
+
}
|
|
589
|
+
onFocus() {
|
|
590
|
+
this.isFocused = true;
|
|
591
|
+
}
|
|
592
|
+
onBlur() {
|
|
593
|
+
setTimeout(() => {
|
|
594
|
+
this.isFocused = false;
|
|
595
|
+
this.selectedIndex = -1;
|
|
596
|
+
}, 100);
|
|
597
|
+
}
|
|
598
|
+
onKeyDown(event) {
|
|
599
|
+
switch (event.key) {
|
|
600
|
+
case 'ArrowDown':
|
|
601
|
+
event.preventDefault();
|
|
602
|
+
if (this.showSuggestions && this.displayedSuggestions.length > 0) {
|
|
603
|
+
this.selectedIndex = this.selectedIndex < this.displayedSuggestions.length - 1
|
|
604
|
+
? this.selectedIndex + 1
|
|
605
|
+
: this.selectedIndex;
|
|
606
|
+
}
|
|
607
|
+
break;
|
|
608
|
+
case 'ArrowUp':
|
|
609
|
+
event.preventDefault();
|
|
610
|
+
if (this.showSuggestions && this.displayedSuggestions.length > 0) {
|
|
611
|
+
this.selectedIndex = this.selectedIndex > 0 ? this.selectedIndex - 1 : -1;
|
|
612
|
+
}
|
|
613
|
+
break;
|
|
614
|
+
case 'Enter':
|
|
615
|
+
event.preventDefault();
|
|
616
|
+
if (this.showSuggestions && this.displayedSuggestions.length > 0 &&
|
|
617
|
+
this.selectedIndex >= 0 && this.selectedIndex < this.displayedSuggestions.length) {
|
|
618
|
+
this.selectSuggestion(this.displayedSuggestions[this.selectedIndex].query);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
// Search with "*" if query is empty
|
|
622
|
+
this.performSearch();
|
|
623
|
+
}
|
|
624
|
+
break;
|
|
625
|
+
case 'Escape':
|
|
626
|
+
this.isFocused = false;
|
|
627
|
+
this.selectedIndex = -1;
|
|
628
|
+
this.searchInput?.nativeElement.blur();
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
selectSuggestion(suggestion) {
|
|
633
|
+
log.verbose('SearchBar: Suggestion selected', { suggestion });
|
|
634
|
+
this.query = suggestion;
|
|
635
|
+
this.selectedIndex = -1;
|
|
636
|
+
this.isFocused = false;
|
|
637
|
+
this.searchInput?.nativeElement.blur();
|
|
638
|
+
this.suggestionSelect.emit(suggestion);
|
|
639
|
+
this.performSearch();
|
|
640
|
+
}
|
|
641
|
+
performSearch() {
|
|
642
|
+
const query = this.query.trim() || '';
|
|
643
|
+
if (!query) {
|
|
644
|
+
log.verbose('SearchBar: Empty query, skipping search');
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
log.info('SearchBar: Performing search', { query });
|
|
648
|
+
this.searchService.search({
|
|
649
|
+
q: query,
|
|
650
|
+
...this.searchOptions,
|
|
651
|
+
}).subscribe({
|
|
652
|
+
next: (results) => {
|
|
653
|
+
if (results) {
|
|
654
|
+
this.search.emit({ query, results });
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
error: (err) => {
|
|
658
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
659
|
+
log.error('SearchBar: Search failed', {
|
|
660
|
+
query,
|
|
661
|
+
error: error.message,
|
|
662
|
+
});
|
|
663
|
+
// Error is handled by searchStateChange
|
|
664
|
+
},
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
getInputStyle() {
|
|
668
|
+
const theme = this.searchContext.theme;
|
|
669
|
+
return {
|
|
670
|
+
width: '100%',
|
|
671
|
+
padding: theme.spacing.medium,
|
|
672
|
+
fontSize: theme.typography.fontSize.medium,
|
|
673
|
+
borderWidth: '1px',
|
|
674
|
+
borderStyle: 'solid',
|
|
675
|
+
borderColor: this.isFocused ? theme.colors.focus : theme.colors.border,
|
|
676
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
677
|
+
? theme.borderRadius
|
|
678
|
+
: theme.borderRadius.medium,
|
|
679
|
+
outline: 'none',
|
|
680
|
+
...(this.isFocused && {
|
|
681
|
+
boxShadow: theme.shadows.small,
|
|
682
|
+
}),
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
getSuggestionsStyle() {
|
|
686
|
+
const theme = this.searchContext.theme;
|
|
687
|
+
return {
|
|
688
|
+
position: 'absolute',
|
|
689
|
+
top: '100%',
|
|
690
|
+
left: 0,
|
|
691
|
+
right: 0,
|
|
692
|
+
marginTop: theme.spacing.small,
|
|
693
|
+
backgroundColor: theme.colors.background,
|
|
694
|
+
border: `1px solid ${theme.colors.border}`,
|
|
695
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
696
|
+
? theme.borderRadius
|
|
697
|
+
: theme.borderRadius.medium,
|
|
698
|
+
boxShadow: theme.shadows.medium,
|
|
699
|
+
maxHeight: '400px',
|
|
700
|
+
overflowY: 'auto',
|
|
701
|
+
zIndex: 1000,
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
get loadingStyle() {
|
|
705
|
+
const theme = this.searchContext.theme;
|
|
706
|
+
return {
|
|
707
|
+
padding: theme.spacing.medium,
|
|
708
|
+
textAlign: 'center',
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
get emptyStyle() {
|
|
712
|
+
const theme = this.searchContext.theme;
|
|
713
|
+
return {
|
|
714
|
+
padding: theme.spacing.medium,
|
|
715
|
+
textAlign: 'center',
|
|
716
|
+
color: theme.colors.text,
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
getSuggestionStyle(index) {
|
|
720
|
+
const theme = this.searchContext.theme;
|
|
721
|
+
return {
|
|
722
|
+
padding: theme.spacing.medium,
|
|
723
|
+
cursor: 'pointer',
|
|
724
|
+
backgroundColor: index === this.selectedIndex ? theme.colors.hover : 'transparent',
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
__setFunctionName(_classThis, "SearchBarComponent");
|
|
729
|
+
(() => {
|
|
730
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
731
|
+
_placeholder_decorators = [Input()];
|
|
732
|
+
_showSuggestions_decorators = [Input()];
|
|
733
|
+
_minQueryLength_decorators = [Input()];
|
|
734
|
+
_maxSuggestions_decorators = [Input()];
|
|
735
|
+
_debounceMs_decorators = [Input()];
|
|
736
|
+
_searchOptions_decorators = [Input()];
|
|
737
|
+
_search_decorators = [Output()];
|
|
738
|
+
_suggestionSelect_decorators = [Output()];
|
|
739
|
+
_queryChange_decorators = [Output()];
|
|
740
|
+
_searchStateChange_decorators = [Output()];
|
|
741
|
+
_searchInput_decorators = [ViewChild('searchInput')];
|
|
742
|
+
__esDecorate(null, null, _placeholder_decorators, { kind: "field", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
743
|
+
__esDecorate(null, null, _showSuggestions_decorators, { kind: "field", name: "showSuggestions", static: false, private: false, access: { has: obj => "showSuggestions" in obj, get: obj => obj.showSuggestions, set: (obj, value) => { obj.showSuggestions = value; } }, metadata: _metadata }, _showSuggestions_initializers, _showSuggestions_extraInitializers);
|
|
744
|
+
__esDecorate(null, null, _minQueryLength_decorators, { kind: "field", name: "minQueryLength", static: false, private: false, access: { has: obj => "minQueryLength" in obj, get: obj => obj.minQueryLength, set: (obj, value) => { obj.minQueryLength = value; } }, metadata: _metadata }, _minQueryLength_initializers, _minQueryLength_extraInitializers);
|
|
745
|
+
__esDecorate(null, null, _maxSuggestions_decorators, { kind: "field", name: "maxSuggestions", static: false, private: false, access: { has: obj => "maxSuggestions" in obj, get: obj => obj.maxSuggestions, set: (obj, value) => { obj.maxSuggestions = value; } }, metadata: _metadata }, _maxSuggestions_initializers, _maxSuggestions_extraInitializers);
|
|
746
|
+
__esDecorate(null, null, _debounceMs_decorators, { kind: "field", name: "debounceMs", static: false, private: false, access: { has: obj => "debounceMs" in obj, get: obj => obj.debounceMs, set: (obj, value) => { obj.debounceMs = value; } }, metadata: _metadata }, _debounceMs_initializers, _debounceMs_extraInitializers);
|
|
747
|
+
__esDecorate(null, null, _searchOptions_decorators, { kind: "field", name: "searchOptions", static: false, private: false, access: { has: obj => "searchOptions" in obj, get: obj => obj.searchOptions, set: (obj, value) => { obj.searchOptions = value; } }, metadata: _metadata }, _searchOptions_initializers, _searchOptions_extraInitializers);
|
|
748
|
+
__esDecorate(null, null, _search_decorators, { kind: "field", name: "search", static: false, private: false, access: { has: obj => "search" in obj, get: obj => obj.search, set: (obj, value) => { obj.search = value; } }, metadata: _metadata }, _search_initializers, _search_extraInitializers);
|
|
749
|
+
__esDecorate(null, null, _suggestionSelect_decorators, { kind: "field", name: "suggestionSelect", static: false, private: false, access: { has: obj => "suggestionSelect" in obj, get: obj => obj.suggestionSelect, set: (obj, value) => { obj.suggestionSelect = value; } }, metadata: _metadata }, _suggestionSelect_initializers, _suggestionSelect_extraInitializers);
|
|
750
|
+
__esDecorate(null, null, _queryChange_decorators, { kind: "field", name: "queryChange", static: false, private: false, access: { has: obj => "queryChange" in obj, get: obj => obj.queryChange, set: (obj, value) => { obj.queryChange = value; } }, metadata: _metadata }, _queryChange_initializers, _queryChange_extraInitializers);
|
|
751
|
+
__esDecorate(null, null, _searchStateChange_decorators, { kind: "field", name: "searchStateChange", static: false, private: false, access: { has: obj => "searchStateChange" in obj, get: obj => obj.searchStateChange, set: (obj, value) => { obj.searchStateChange = value; } }, metadata: _metadata }, _searchStateChange_initializers, _searchStateChange_extraInitializers);
|
|
752
|
+
__esDecorate(null, null, _searchInput_decorators, { kind: "field", name: "searchInput", static: false, private: false, access: { has: obj => "searchInput" in obj, get: obj => obj.searchInput, set: (obj, value) => { obj.searchInput = value; } }, metadata: _metadata }, _searchInput_initializers, _searchInput_extraInitializers);
|
|
753
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
754
|
+
_classThis = _classDescriptor.value;
|
|
755
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
756
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
757
|
+
})();
|
|
758
|
+
return _classThis;
|
|
759
|
+
})();
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* SearchResults Component
|
|
763
|
+
*
|
|
764
|
+
* Displays search results with customizable rendering
|
|
765
|
+
*/
|
|
766
|
+
let SearchResultsComponent = (() => {
|
|
767
|
+
let _classDecorators = [Component({
|
|
768
|
+
selector: 'seekora-search-results',
|
|
769
|
+
template: `
|
|
770
|
+
<div *ngIf="loading" [style]="containerStyle">
|
|
771
|
+
<div [style]="loadingStyle">Loading results...</div>
|
|
772
|
+
</div>
|
|
773
|
+
|
|
774
|
+
<div *ngIf="error && !loading" [style]="containerStyle">
|
|
775
|
+
<div [style]="errorStyle">Error: {{ error.message }}</div>
|
|
776
|
+
</div>
|
|
777
|
+
|
|
778
|
+
<div *ngIf="!loading && !error && displayedResults.length === 0" [style]="containerStyle">
|
|
779
|
+
<div [style]="emptyStyle">No results found</div>
|
|
780
|
+
</div>
|
|
781
|
+
|
|
782
|
+
<div *ngIf="!loading && !error && displayedResults.length > 0" [style]="getContainerStyle()">
|
|
783
|
+
<div
|
|
784
|
+
*ngFor="let result of displayedResults; let i = index"
|
|
785
|
+
(click)="onResultClick(result, i)"
|
|
786
|
+
[style]="getResultStyle()"
|
|
787
|
+
>
|
|
788
|
+
<div *ngIf="extractedFields(result).image" [style]="imageStyle">
|
|
789
|
+
<img [src]="extractedFields(result).image" [alt]="extractedFields(result).title" [style]="imageImgStyle" />
|
|
790
|
+
</div>
|
|
791
|
+
<div>
|
|
792
|
+
<h3 [style]="titleStyle">{{ extractedFields(result).title }}</h3>
|
|
793
|
+
<p *ngIf="extractedFields(result).description" [style]="descriptionStyle">
|
|
794
|
+
{{ extractedFields(result).description }}
|
|
795
|
+
</p>
|
|
796
|
+
<div *ngIf="extractedFields(result).price" [style]="priceStyle">
|
|
797
|
+
{{ extractedFields(result).price }}
|
|
798
|
+
</div>
|
|
799
|
+
</div>
|
|
800
|
+
</div>
|
|
801
|
+
</div>
|
|
802
|
+
`,
|
|
803
|
+
})];
|
|
804
|
+
let _classDescriptor;
|
|
805
|
+
let _classExtraInitializers = [];
|
|
806
|
+
let _classThis;
|
|
807
|
+
let _results_decorators;
|
|
808
|
+
let _results_initializers = [];
|
|
809
|
+
let _results_extraInitializers = [];
|
|
810
|
+
let _loading_decorators;
|
|
811
|
+
let _loading_initializers = [];
|
|
812
|
+
let _loading_extraInitializers = [];
|
|
813
|
+
let _error_decorators;
|
|
814
|
+
let _error_initializers = [];
|
|
815
|
+
let _error_extraInitializers = [];
|
|
816
|
+
let _viewMode_decorators;
|
|
817
|
+
let _viewMode_initializers = [];
|
|
818
|
+
let _viewMode_extraInitializers = [];
|
|
819
|
+
let _fieldMapping_decorators;
|
|
820
|
+
let _fieldMapping_initializers = [];
|
|
821
|
+
let _fieldMapping_extraInitializers = [];
|
|
822
|
+
let _itemsPerPage_decorators;
|
|
823
|
+
let _itemsPerPage_initializers = [];
|
|
824
|
+
let _itemsPerPage_extraInitializers = [];
|
|
825
|
+
let _resultClick_decorators;
|
|
826
|
+
let _resultClick_initializers = [];
|
|
827
|
+
let _resultClick_extraInitializers = [];
|
|
828
|
+
_classThis = class {
|
|
829
|
+
constructor(searchContext, searchService) {
|
|
830
|
+
this.searchContext = searchContext;
|
|
831
|
+
this.searchService = searchService;
|
|
832
|
+
this.results = __runInitializers(this, _results_initializers, void 0);
|
|
833
|
+
this.loading = (__runInitializers(this, _results_extraInitializers), __runInitializers(this, _loading_initializers, false));
|
|
834
|
+
this.error = (__runInitializers(this, _loading_extraInitializers), __runInitializers(this, _error_initializers, void 0));
|
|
835
|
+
this.viewMode = (__runInitializers(this, _error_extraInitializers), __runInitializers(this, _viewMode_initializers, 'list'));
|
|
836
|
+
this.fieldMapping = (__runInitializers(this, _viewMode_extraInitializers), __runInitializers(this, _fieldMapping_initializers, void 0));
|
|
837
|
+
this.itemsPerPage = (__runInitializers(this, _fieldMapping_extraInitializers), __runInitializers(this, _itemsPerPage_initializers, 10));
|
|
838
|
+
this.resultClick = (__runInitializers(this, _itemsPerPage_extraInitializers), __runInitializers(this, _resultClick_initializers, new EventEmitter()));
|
|
839
|
+
this.subscriptions = (__runInitializers(this, _resultClick_extraInitializers), new Subscription());
|
|
840
|
+
}
|
|
841
|
+
ngOnInit() {
|
|
842
|
+
const searchSub = this.searchService.searchState$.subscribe(state => {
|
|
843
|
+
// Component can react to search state changes if needed
|
|
844
|
+
});
|
|
845
|
+
this.subscriptions.add(searchSub);
|
|
846
|
+
}
|
|
847
|
+
ngOnDestroy() {
|
|
848
|
+
this.subscriptions.unsubscribe();
|
|
849
|
+
}
|
|
850
|
+
extractResults(results) {
|
|
851
|
+
if (!results)
|
|
852
|
+
return [];
|
|
853
|
+
if (Array.isArray(results))
|
|
854
|
+
return results;
|
|
855
|
+
if (results.results && Array.isArray(results.results))
|
|
856
|
+
return results.results;
|
|
857
|
+
if (results.data) {
|
|
858
|
+
if (Array.isArray(results.data))
|
|
859
|
+
return results.data;
|
|
860
|
+
if (results.data.results && Array.isArray(results.data.results))
|
|
861
|
+
return results.data.results;
|
|
862
|
+
if (results.data.data?.results && Array.isArray(results.data.data.results)) {
|
|
863
|
+
return results.data.data.results;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return [];
|
|
867
|
+
}
|
|
868
|
+
get displayedResults() {
|
|
869
|
+
const allResults = this.extractResults(this.results);
|
|
870
|
+
return this.itemsPerPage > 0 ? allResults.slice(0, this.itemsPerPage) : allResults;
|
|
871
|
+
}
|
|
872
|
+
extractedFields(item) {
|
|
873
|
+
const mapping = this.fieldMapping || {};
|
|
874
|
+
return {
|
|
875
|
+
id: extractField(item, mapping.id) || String(item.id || ''),
|
|
876
|
+
title: extractField(item, mapping.title) || extractField(item, mapping.primaryText) || 'Untitled',
|
|
877
|
+
description: extractField(item, mapping.description) || extractField(item, mapping.secondaryText),
|
|
878
|
+
image: extractField(item, mapping.image) || extractField(item, mapping.imageUrl),
|
|
879
|
+
price: mapping.price ? formatPrice(extractField(item, mapping.price)) : undefined,
|
|
880
|
+
url: extractField(item, mapping.url),
|
|
881
|
+
metadata: item,
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
onResultClick(result, index) {
|
|
885
|
+
this.resultClick.emit({ result, index });
|
|
886
|
+
}
|
|
887
|
+
get containerStyle() {
|
|
888
|
+
return {};
|
|
889
|
+
}
|
|
890
|
+
get loadingStyle() {
|
|
891
|
+
const theme = this.searchContext.theme;
|
|
892
|
+
return {
|
|
893
|
+
padding: theme.spacing.large,
|
|
894
|
+
textAlign: 'center',
|
|
895
|
+
color: theme.colors.text,
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
get errorStyle() {
|
|
899
|
+
const theme = this.searchContext.theme;
|
|
900
|
+
return {
|
|
901
|
+
padding: theme.spacing.large,
|
|
902
|
+
textAlign: 'center',
|
|
903
|
+
color: theme.colors.error,
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
get emptyStyle() {
|
|
907
|
+
const theme = this.searchContext.theme;
|
|
908
|
+
return {
|
|
909
|
+
padding: theme.spacing.large,
|
|
910
|
+
textAlign: 'center',
|
|
911
|
+
color: theme.colors.textSecondary || theme.colors.text,
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
getContainerStyle() {
|
|
915
|
+
return {};
|
|
916
|
+
}
|
|
917
|
+
getResultStyle() {
|
|
918
|
+
const theme = this.searchContext.theme;
|
|
919
|
+
const baseStyle = {
|
|
920
|
+
cursor: 'pointer',
|
|
921
|
+
};
|
|
922
|
+
if (this.viewMode === 'list') {
|
|
923
|
+
return {
|
|
924
|
+
...baseStyle,
|
|
925
|
+
padding: theme.spacing.medium,
|
|
926
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
else if (this.viewMode === 'card') {
|
|
930
|
+
return {
|
|
931
|
+
...baseStyle,
|
|
932
|
+
padding: theme.spacing.medium,
|
|
933
|
+
border: `1px solid ${theme.colors.border}`,
|
|
934
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
935
|
+
? theme.borderRadius
|
|
936
|
+
: theme.borderRadius.medium,
|
|
937
|
+
marginBottom: theme.spacing.medium,
|
|
938
|
+
boxShadow: theme.shadows.small,
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
return baseStyle;
|
|
942
|
+
}
|
|
943
|
+
get imageStyle() {
|
|
944
|
+
return {
|
|
945
|
+
float: 'left',
|
|
946
|
+
marginRight: this.searchContext.theme.spacing.medium,
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
get imageImgStyle() {
|
|
950
|
+
const theme = this.searchContext.theme;
|
|
951
|
+
return {
|
|
952
|
+
width: '100px',
|
|
953
|
+
height: '100px',
|
|
954
|
+
objectFit: 'cover',
|
|
955
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
956
|
+
? theme.borderRadius
|
|
957
|
+
: theme.borderRadius.medium,
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
get titleStyle() {
|
|
961
|
+
const theme = this.searchContext.theme;
|
|
962
|
+
return {
|
|
963
|
+
fontSize: theme.typography.fontSize.large,
|
|
964
|
+
fontWeight: 'bold',
|
|
965
|
+
margin: 0,
|
|
966
|
+
marginBottom: theme.spacing.small,
|
|
967
|
+
color: theme.colors.text,
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
get descriptionStyle() {
|
|
971
|
+
const theme = this.searchContext.theme;
|
|
972
|
+
return {
|
|
973
|
+
fontSize: theme.typography.fontSize.medium,
|
|
974
|
+
color: theme.colors.text,
|
|
975
|
+
margin: 0,
|
|
976
|
+
marginBottom: theme.spacing.small,
|
|
977
|
+
opacity: 0.8,
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
get priceStyle() {
|
|
981
|
+
const theme = this.searchContext.theme;
|
|
982
|
+
return {
|
|
983
|
+
fontSize: theme.typography.fontSize.medium,
|
|
984
|
+
fontWeight: 'bold',
|
|
985
|
+
color: theme.colors.primary,
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
__setFunctionName(_classThis, "SearchResultsComponent");
|
|
990
|
+
(() => {
|
|
991
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
992
|
+
_results_decorators = [Input()];
|
|
993
|
+
_loading_decorators = [Input()];
|
|
994
|
+
_error_decorators = [Input()];
|
|
995
|
+
_viewMode_decorators = [Input()];
|
|
996
|
+
_fieldMapping_decorators = [Input()];
|
|
997
|
+
_itemsPerPage_decorators = [Input()];
|
|
998
|
+
_resultClick_decorators = [Output()];
|
|
999
|
+
__esDecorate(null, null, _results_decorators, { kind: "field", name: "results", static: false, private: false, access: { has: obj => "results" in obj, get: obj => obj.results, set: (obj, value) => { obj.results = value; } }, metadata: _metadata }, _results_initializers, _results_extraInitializers);
|
|
1000
|
+
__esDecorate(null, null, _loading_decorators, { kind: "field", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
|
|
1001
|
+
__esDecorate(null, null, _error_decorators, { kind: "field", name: "error", static: false, private: false, access: { has: obj => "error" in obj, get: obj => obj.error, set: (obj, value) => { obj.error = value; } }, metadata: _metadata }, _error_initializers, _error_extraInitializers);
|
|
1002
|
+
__esDecorate(null, null, _viewMode_decorators, { kind: "field", name: "viewMode", static: false, private: false, access: { has: obj => "viewMode" in obj, get: obj => obj.viewMode, set: (obj, value) => { obj.viewMode = value; } }, metadata: _metadata }, _viewMode_initializers, _viewMode_extraInitializers);
|
|
1003
|
+
__esDecorate(null, null, _fieldMapping_decorators, { kind: "field", name: "fieldMapping", static: false, private: false, access: { has: obj => "fieldMapping" in obj, get: obj => obj.fieldMapping, set: (obj, value) => { obj.fieldMapping = value; } }, metadata: _metadata }, _fieldMapping_initializers, _fieldMapping_extraInitializers);
|
|
1004
|
+
__esDecorate(null, null, _itemsPerPage_decorators, { kind: "field", name: "itemsPerPage", static: false, private: false, access: { has: obj => "itemsPerPage" in obj, get: obj => obj.itemsPerPage, set: (obj, value) => { obj.itemsPerPage = value; } }, metadata: _metadata }, _itemsPerPage_initializers, _itemsPerPage_extraInitializers);
|
|
1005
|
+
__esDecorate(null, null, _resultClick_decorators, { kind: "field", name: "resultClick", static: false, private: false, access: { has: obj => "resultClick" in obj, get: obj => obj.resultClick, set: (obj, value) => { obj.resultClick = value; } }, metadata: _metadata }, _resultClick_initializers, _resultClick_extraInitializers);
|
|
1006
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1007
|
+
_classThis = _classDescriptor.value;
|
|
1008
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1009
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1010
|
+
})();
|
|
1011
|
+
return _classThis;
|
|
1012
|
+
})();
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* QuerySuggestions Component
|
|
1016
|
+
*
|
|
1017
|
+
* Standalone component for displaying query suggestions
|
|
1018
|
+
*/
|
|
1019
|
+
let QuerySuggestionsComponent = (() => {
|
|
1020
|
+
let _classDecorators = [Component({
|
|
1021
|
+
selector: 'seekora-query-suggestions',
|
|
1022
|
+
template: `
|
|
1023
|
+
<div
|
|
1024
|
+
*ngIf="query.length >= minQueryLength"
|
|
1025
|
+
[style]="getContainerStyle()"
|
|
1026
|
+
>
|
|
1027
|
+
<div
|
|
1028
|
+
*ngIf="showTitle"
|
|
1029
|
+
[style]="getTitleStyle()"
|
|
1030
|
+
>
|
|
1031
|
+
{{ title }}
|
|
1032
|
+
</div>
|
|
1033
|
+
|
|
1034
|
+
<div *ngIf="suggestionsLoading">
|
|
1035
|
+
<ng-content select="[loading]">
|
|
1036
|
+
<div [style]="getLoadingStyle()">
|
|
1037
|
+
Loading suggestions...
|
|
1038
|
+
</div>
|
|
1039
|
+
</ng-content>
|
|
1040
|
+
</div>
|
|
1041
|
+
|
|
1042
|
+
<div *ngIf="!suggestionsLoading && (error || displayedSuggestions.length === 0)">
|
|
1043
|
+
<ng-content select="[empty]">
|
|
1044
|
+
<div [style]="getEmptyStyle()">
|
|
1045
|
+
No suggestions available
|
|
1046
|
+
</div>
|
|
1047
|
+
</ng-content>
|
|
1048
|
+
</div>
|
|
1049
|
+
|
|
1050
|
+
<div *ngIf="!suggestionsLoading && !error && displayedSuggestions.length > 0">
|
|
1051
|
+
<div
|
|
1052
|
+
*ngFor="let suggestion of displayedSuggestions; let i = index"
|
|
1053
|
+
[style]="getSuggestionStyle(i)"
|
|
1054
|
+
(click)="onSuggestionClick(suggestion)"
|
|
1055
|
+
(mouseenter)="selectedIndex = i"
|
|
1056
|
+
(mouseleave)="selectedIndex = -1"
|
|
1057
|
+
>
|
|
1058
|
+
<ng-content select="[suggestion]">
|
|
1059
|
+
<span>{{ suggestion.query }}</span>
|
|
1060
|
+
<span *ngIf="suggestion.count !== undefined" [style]="getCountStyle()">
|
|
1061
|
+
({{ suggestion.count }})
|
|
1062
|
+
</span>
|
|
1063
|
+
</ng-content>
|
|
1064
|
+
</div>
|
|
1065
|
+
</div>
|
|
1066
|
+
</div>
|
|
1067
|
+
`,
|
|
1068
|
+
})];
|
|
1069
|
+
let _classDescriptor;
|
|
1070
|
+
let _classExtraInitializers = [];
|
|
1071
|
+
let _classThis;
|
|
1072
|
+
let _query_decorators;
|
|
1073
|
+
let _query_initializers = [];
|
|
1074
|
+
let _query_extraInitializers = [];
|
|
1075
|
+
let _maxSuggestions_decorators;
|
|
1076
|
+
let _maxSuggestions_initializers = [];
|
|
1077
|
+
let _maxSuggestions_extraInitializers = [];
|
|
1078
|
+
let _debounceMs_decorators;
|
|
1079
|
+
let _debounceMs_initializers = [];
|
|
1080
|
+
let _debounceMs_extraInitializers = [];
|
|
1081
|
+
let _minQueryLength_decorators;
|
|
1082
|
+
let _minQueryLength_initializers = [];
|
|
1083
|
+
let _minQueryLength_extraInitializers = [];
|
|
1084
|
+
let _showTitle_decorators;
|
|
1085
|
+
let _showTitle_initializers = [];
|
|
1086
|
+
let _showTitle_extraInitializers = [];
|
|
1087
|
+
let _title_decorators;
|
|
1088
|
+
let _title_initializers = [];
|
|
1089
|
+
let _title_extraInitializers = [];
|
|
1090
|
+
let _className_decorators;
|
|
1091
|
+
let _className_initializers = [];
|
|
1092
|
+
let _className_extraInitializers = [];
|
|
1093
|
+
let _style_decorators;
|
|
1094
|
+
let _style_initializers = [];
|
|
1095
|
+
let _style_extraInitializers = [];
|
|
1096
|
+
let _suggestionClick_decorators;
|
|
1097
|
+
let _suggestionClick_initializers = [];
|
|
1098
|
+
let _suggestionClick_extraInitializers = [];
|
|
1099
|
+
_classThis = class {
|
|
1100
|
+
constructor(searchContext) {
|
|
1101
|
+
this.searchContext = searchContext;
|
|
1102
|
+
this.query = __runInitializers(this, _query_initializers, '');
|
|
1103
|
+
this.maxSuggestions = (__runInitializers(this, _query_extraInitializers), __runInitializers(this, _maxSuggestions_initializers, 10));
|
|
1104
|
+
this.debounceMs = (__runInitializers(this, _maxSuggestions_extraInitializers), __runInitializers(this, _debounceMs_initializers, 300));
|
|
1105
|
+
this.minQueryLength = (__runInitializers(this, _debounceMs_extraInitializers), __runInitializers(this, _minQueryLength_initializers, 2));
|
|
1106
|
+
this.showTitle = (__runInitializers(this, _minQueryLength_extraInitializers), __runInitializers(this, _showTitle_initializers, false));
|
|
1107
|
+
this.title = (__runInitializers(this, _showTitle_extraInitializers), __runInitializers(this, _title_initializers, 'Suggestions'));
|
|
1108
|
+
this.className = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _className_initializers, void 0));
|
|
1109
|
+
this.style = (__runInitializers(this, _className_extraInitializers), __runInitializers(this, _style_initializers, void 0));
|
|
1110
|
+
this.suggestionClick = (__runInitializers(this, _style_extraInitializers), __runInitializers(this, _suggestionClick_initializers, new EventEmitter()));
|
|
1111
|
+
this.displayedSuggestions = (__runInitializers(this, _suggestionClick_extraInitializers), []);
|
|
1112
|
+
this.suggestionsLoading = false;
|
|
1113
|
+
this.error = null;
|
|
1114
|
+
this.selectedIndex = -1;
|
|
1115
|
+
this.querySubject = new Subject();
|
|
1116
|
+
}
|
|
1117
|
+
ngOnInit() {
|
|
1118
|
+
// Debounce query changes
|
|
1119
|
+
this.subscription = this.querySubject
|
|
1120
|
+
.pipe(debounceTime(this.debounceMs), distinctUntilChanged())
|
|
1121
|
+
.subscribe(query => {
|
|
1122
|
+
if (query.length >= this.minQueryLength) {
|
|
1123
|
+
this.loadSuggestions(query);
|
|
1124
|
+
}
|
|
1125
|
+
else {
|
|
1126
|
+
this.displayedSuggestions = [];
|
|
1127
|
+
this.suggestionsLoading = false;
|
|
1128
|
+
this.error = null;
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
// Initial load if query is provided
|
|
1132
|
+
if (this.query.length >= this.minQueryLength) {
|
|
1133
|
+
this.querySubject.next(this.query);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
ngOnDestroy() {
|
|
1137
|
+
this.subscription?.unsubscribe();
|
|
1138
|
+
this.suggestionsSubscription?.unsubscribe();
|
|
1139
|
+
}
|
|
1140
|
+
ngOnChanges() {
|
|
1141
|
+
if (this.query !== undefined) {
|
|
1142
|
+
this.querySubject.next(this.query);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
loadSuggestions(query) {
|
|
1146
|
+
this.suggestionsLoading = true;
|
|
1147
|
+
this.error = null;
|
|
1148
|
+
this.suggestionsSubscription = this.searchContext.client
|
|
1149
|
+
.getSuggestions(query, this.maxSuggestions)
|
|
1150
|
+
.then((response) => {
|
|
1151
|
+
const rawSuggestions = Array.isArray(response) ? response : [];
|
|
1152
|
+
const suggestionItems = rawSuggestions.map((suggestion) => {
|
|
1153
|
+
const suggestionQuery = suggestion.query || suggestion.text || suggestion;
|
|
1154
|
+
const count = suggestion.popularity !== undefined
|
|
1155
|
+
? suggestion.popularity
|
|
1156
|
+
: (suggestion.count !== undefined ? suggestion.count : undefined);
|
|
1157
|
+
return {
|
|
1158
|
+
query: typeof suggestionQuery === 'string' ? suggestionQuery : String(suggestionQuery),
|
|
1159
|
+
count: typeof count === 'number' ? count : undefined,
|
|
1160
|
+
metadata: suggestion,
|
|
1161
|
+
};
|
|
1162
|
+
});
|
|
1163
|
+
this.displayedSuggestions = suggestionItems.slice(0, this.maxSuggestions);
|
|
1164
|
+
this.suggestionsLoading = false;
|
|
1165
|
+
})
|
|
1166
|
+
.catch((err) => {
|
|
1167
|
+
this.error = err instanceof Error ? err : new Error(String(err));
|
|
1168
|
+
this.suggestionsLoading = false;
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
onSuggestionClick(suggestion) {
|
|
1172
|
+
this.suggestionClick.emit(suggestion.query);
|
|
1173
|
+
}
|
|
1174
|
+
get theme() {
|
|
1175
|
+
return this.searchContext.theme;
|
|
1176
|
+
}
|
|
1177
|
+
getContainerStyle() {
|
|
1178
|
+
return {
|
|
1179
|
+
...this.style,
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
getTitleStyle() {
|
|
1183
|
+
return {
|
|
1184
|
+
fontSize: this.theme.typography.fontSize.large,
|
|
1185
|
+
fontWeight: 'bold',
|
|
1186
|
+
marginBottom: this.theme.spacing.medium,
|
|
1187
|
+
color: this.theme.colors.text,
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
getLoadingStyle() {
|
|
1191
|
+
return {
|
|
1192
|
+
padding: this.theme.spacing.medium,
|
|
1193
|
+
textAlign: 'center',
|
|
1194
|
+
color: this.theme.colors.text,
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
getEmptyStyle() {
|
|
1198
|
+
return {
|
|
1199
|
+
padding: this.theme.spacing.medium,
|
|
1200
|
+
textAlign: 'center',
|
|
1201
|
+
color: this.theme.colors.text,
|
|
1202
|
+
opacity: 0.6,
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
getSuggestionStyle(index) {
|
|
1206
|
+
const borderRadius = typeof this.theme.borderRadius === 'string'
|
|
1207
|
+
? this.theme.borderRadius
|
|
1208
|
+
: this.theme.borderRadius.medium;
|
|
1209
|
+
return {
|
|
1210
|
+
padding: this.theme.spacing.medium,
|
|
1211
|
+
cursor: 'pointer',
|
|
1212
|
+
borderRadius,
|
|
1213
|
+
transition: this.theme.transitions?.fast || '150ms ease-in-out',
|
|
1214
|
+
backgroundColor: index === this.selectedIndex ? this.theme.colors.hover : 'transparent',
|
|
1215
|
+
marginBottom: index < this.displayedSuggestions.length - 1 ? this.theme.spacing.small : 0,
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
getCountStyle() {
|
|
1219
|
+
return {
|
|
1220
|
+
opacity: 0.6,
|
|
1221
|
+
marginLeft: this.theme.spacing.small,
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
__setFunctionName(_classThis, "QuerySuggestionsComponent");
|
|
1226
|
+
(() => {
|
|
1227
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1228
|
+
_query_decorators = [Input()];
|
|
1229
|
+
_maxSuggestions_decorators = [Input()];
|
|
1230
|
+
_debounceMs_decorators = [Input()];
|
|
1231
|
+
_minQueryLength_decorators = [Input()];
|
|
1232
|
+
_showTitle_decorators = [Input()];
|
|
1233
|
+
_title_decorators = [Input()];
|
|
1234
|
+
_className_decorators = [Input()];
|
|
1235
|
+
_style_decorators = [Input()];
|
|
1236
|
+
_suggestionClick_decorators = [Output()];
|
|
1237
|
+
__esDecorate(null, null, _query_decorators, { kind: "field", name: "query", static: false, private: false, access: { has: obj => "query" in obj, get: obj => obj.query, set: (obj, value) => { obj.query = value; } }, metadata: _metadata }, _query_initializers, _query_extraInitializers);
|
|
1238
|
+
__esDecorate(null, null, _maxSuggestions_decorators, { kind: "field", name: "maxSuggestions", static: false, private: false, access: { has: obj => "maxSuggestions" in obj, get: obj => obj.maxSuggestions, set: (obj, value) => { obj.maxSuggestions = value; } }, metadata: _metadata }, _maxSuggestions_initializers, _maxSuggestions_extraInitializers);
|
|
1239
|
+
__esDecorate(null, null, _debounceMs_decorators, { kind: "field", name: "debounceMs", static: false, private: false, access: { has: obj => "debounceMs" in obj, get: obj => obj.debounceMs, set: (obj, value) => { obj.debounceMs = value; } }, metadata: _metadata }, _debounceMs_initializers, _debounceMs_extraInitializers);
|
|
1240
|
+
__esDecorate(null, null, _minQueryLength_decorators, { kind: "field", name: "minQueryLength", static: false, private: false, access: { has: obj => "minQueryLength" in obj, get: obj => obj.minQueryLength, set: (obj, value) => { obj.minQueryLength = value; } }, metadata: _metadata }, _minQueryLength_initializers, _minQueryLength_extraInitializers);
|
|
1241
|
+
__esDecorate(null, null, _showTitle_decorators, { kind: "field", name: "showTitle", static: false, private: false, access: { has: obj => "showTitle" in obj, get: obj => obj.showTitle, set: (obj, value) => { obj.showTitle = value; } }, metadata: _metadata }, _showTitle_initializers, _showTitle_extraInitializers);
|
|
1242
|
+
__esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
|
|
1243
|
+
__esDecorate(null, null, _className_decorators, { kind: "field", name: "className", static: false, private: false, access: { has: obj => "className" in obj, get: obj => obj.className, set: (obj, value) => { obj.className = value; } }, metadata: _metadata }, _className_initializers, _className_extraInitializers);
|
|
1244
|
+
__esDecorate(null, null, _style_decorators, { kind: "field", name: "style", static: false, private: false, access: { has: obj => "style" in obj, get: obj => obj.style, set: (obj, value) => { obj.style = value; } }, metadata: _metadata }, _style_initializers, _style_extraInitializers);
|
|
1245
|
+
__esDecorate(null, null, _suggestionClick_decorators, { kind: "field", name: "suggestionClick", static: false, private: false, access: { has: obj => "suggestionClick" in obj, get: obj => obj.suggestionClick, set: (obj, value) => { obj.suggestionClick = value; } }, metadata: _metadata }, _suggestionClick_initializers, _suggestionClick_extraInitializers);
|
|
1246
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1247
|
+
_classThis = _classDescriptor.value;
|
|
1248
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1249
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1250
|
+
})();
|
|
1251
|
+
return _classThis;
|
|
1252
|
+
})();
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Stats Component
|
|
1256
|
+
*
|
|
1257
|
+
* Displays search statistics
|
|
1258
|
+
*/
|
|
1259
|
+
let StatsComponent = (() => {
|
|
1260
|
+
let _classDecorators = [Component({
|
|
1261
|
+
selector: 'seekora-stats',
|
|
1262
|
+
template: `
|
|
1263
|
+
<div *ngIf="loading" [style]="containerStyle">
|
|
1264
|
+
<span [style]="textStyle">Loading...</span>
|
|
1265
|
+
</div>
|
|
1266
|
+
<div *ngIf="!loading && hasResults" [style]="containerStyle">
|
|
1267
|
+
<span [style]="textStyle">
|
|
1268
|
+
{{ resultsText }}
|
|
1269
|
+
<span *ngIf="showProcessingTime && processingTime !== undefined">
|
|
1270
|
+
{{ processingTimeText }}
|
|
1271
|
+
</span>
|
|
1272
|
+
</span>
|
|
1273
|
+
</div>
|
|
1274
|
+
`,
|
|
1275
|
+
})];
|
|
1276
|
+
let _classDescriptor;
|
|
1277
|
+
let _classExtraInitializers = [];
|
|
1278
|
+
let _classThis;
|
|
1279
|
+
let _results_decorators;
|
|
1280
|
+
let _results_initializers = [];
|
|
1281
|
+
let _results_extraInitializers = [];
|
|
1282
|
+
let _loading_decorators;
|
|
1283
|
+
let _loading_initializers = [];
|
|
1284
|
+
let _loading_extraInitializers = [];
|
|
1285
|
+
let _showProcessingTime_decorators;
|
|
1286
|
+
let _showProcessingTime_initializers = [];
|
|
1287
|
+
let _showProcessingTime_extraInitializers = [];
|
|
1288
|
+
let _showQuery_decorators;
|
|
1289
|
+
let _showQuery_initializers = [];
|
|
1290
|
+
let _showQuery_extraInitializers = [];
|
|
1291
|
+
let _labels_decorators;
|
|
1292
|
+
let _labels_initializers = [];
|
|
1293
|
+
let _labels_extraInitializers = [];
|
|
1294
|
+
_classThis = class {
|
|
1295
|
+
constructor(searchContext) {
|
|
1296
|
+
this.searchContext = searchContext;
|
|
1297
|
+
this.results = __runInitializers(this, _results_initializers, void 0);
|
|
1298
|
+
this.loading = (__runInitializers(this, _results_extraInitializers), __runInitializers(this, _loading_initializers, false));
|
|
1299
|
+
this.showProcessingTime = (__runInitializers(this, _loading_extraInitializers), __runInitializers(this, _showProcessingTime_initializers, true));
|
|
1300
|
+
this.showQuery = (__runInitializers(this, _showProcessingTime_extraInitializers), __runInitializers(this, _showQuery_initializers, false));
|
|
1301
|
+
this.labels = (__runInitializers(this, _showQuery_extraInitializers), __runInitializers(this, _labels_initializers, void 0));
|
|
1302
|
+
__runInitializers(this, _labels_extraInitializers);
|
|
1303
|
+
this.searchContext = searchContext;
|
|
1304
|
+
}
|
|
1305
|
+
get totalResults() {
|
|
1306
|
+
if (!this.results)
|
|
1307
|
+
return 0;
|
|
1308
|
+
return this.results.totalResults || this.results.data?.total_results || 0;
|
|
1309
|
+
}
|
|
1310
|
+
get processingTime() {
|
|
1311
|
+
if (!this.results)
|
|
1312
|
+
return undefined;
|
|
1313
|
+
return this.results.processingTimeMs || this.results.data?.processing_time_ms;
|
|
1314
|
+
}
|
|
1315
|
+
get hasResults() {
|
|
1316
|
+
return this.totalResults > 0;
|
|
1317
|
+
}
|
|
1318
|
+
get resultsText() {
|
|
1319
|
+
const defaultLabel = (total) => `${total} results found`;
|
|
1320
|
+
const labelFn = this.labels?.resultsFound || defaultLabel;
|
|
1321
|
+
return labelFn(this.totalResults);
|
|
1322
|
+
}
|
|
1323
|
+
get processingTimeText() {
|
|
1324
|
+
if (this.processingTime === undefined)
|
|
1325
|
+
return '';
|
|
1326
|
+
const defaultLabel = (time) => `in ${time} ms`;
|
|
1327
|
+
const labelFn = this.labels?.processingTime || defaultLabel;
|
|
1328
|
+
return ` ${labelFn(this.processingTime)}`;
|
|
1329
|
+
}
|
|
1330
|
+
get containerStyle() {
|
|
1331
|
+
return {};
|
|
1332
|
+
}
|
|
1333
|
+
get textStyle() {
|
|
1334
|
+
const theme = this.searchContext.theme;
|
|
1335
|
+
return {
|
|
1336
|
+
color: theme.colors.text,
|
|
1337
|
+
fontSize: theme.typography.fontSize.medium,
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
__setFunctionName(_classThis, "StatsComponent");
|
|
1342
|
+
(() => {
|
|
1343
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1344
|
+
_results_decorators = [Input()];
|
|
1345
|
+
_loading_decorators = [Input()];
|
|
1346
|
+
_showProcessingTime_decorators = [Input()];
|
|
1347
|
+
_showQuery_decorators = [Input()];
|
|
1348
|
+
_labels_decorators = [Input()];
|
|
1349
|
+
__esDecorate(null, null, _results_decorators, { kind: "field", name: "results", static: false, private: false, access: { has: obj => "results" in obj, get: obj => obj.results, set: (obj, value) => { obj.results = value; } }, metadata: _metadata }, _results_initializers, _results_extraInitializers);
|
|
1350
|
+
__esDecorate(null, null, _loading_decorators, { kind: "field", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
|
|
1351
|
+
__esDecorate(null, null, _showProcessingTime_decorators, { kind: "field", name: "showProcessingTime", static: false, private: false, access: { has: obj => "showProcessingTime" in obj, get: obj => obj.showProcessingTime, set: (obj, value) => { obj.showProcessingTime = value; } }, metadata: _metadata }, _showProcessingTime_initializers, _showProcessingTime_extraInitializers);
|
|
1352
|
+
__esDecorate(null, null, _showQuery_decorators, { kind: "field", name: "showQuery", static: false, private: false, access: { has: obj => "showQuery" in obj, get: obj => obj.showQuery, set: (obj, value) => { obj.showQuery = value; } }, metadata: _metadata }, _showQuery_initializers, _showQuery_extraInitializers);
|
|
1353
|
+
__esDecorate(null, null, _labels_decorators, { kind: "field", name: "labels", static: false, private: false, access: { has: obj => "labels" in obj, get: obj => obj.labels, set: (obj, value) => { obj.labels = value; } }, metadata: _metadata }, _labels_initializers, _labels_extraInitializers);
|
|
1354
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1355
|
+
_classThis = _classDescriptor.value;
|
|
1356
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1357
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1358
|
+
})();
|
|
1359
|
+
return _classThis;
|
|
1360
|
+
})();
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* Pagination Component
|
|
1364
|
+
*
|
|
1365
|
+
* Displays pagination controls for search results
|
|
1366
|
+
*/
|
|
1367
|
+
let PaginationComponent = (() => {
|
|
1368
|
+
let _classDecorators = [Component({
|
|
1369
|
+
selector: 'seekora-pagination',
|
|
1370
|
+
template: `
|
|
1371
|
+
<div *ngIf="totalPages > 1" [style]="containerStyle">
|
|
1372
|
+
<button
|
|
1373
|
+
*ngIf="showFirstLast"
|
|
1374
|
+
[disabled]="currentPage === 1"
|
|
1375
|
+
(click)="handlePageChange(1)"
|
|
1376
|
+
[style]="getButtonStyle(1)"
|
|
1377
|
+
>
|
|
1378
|
+
First
|
|
1379
|
+
</button>
|
|
1380
|
+
|
|
1381
|
+
<button
|
|
1382
|
+
*ngIf="showPrevNext"
|
|
1383
|
+
[disabled]="currentPage === 1"
|
|
1384
|
+
(click)="handlePageChange(currentPage - 1)"
|
|
1385
|
+
[style]="getButtonStyle(currentPage - 1)"
|
|
1386
|
+
>
|
|
1387
|
+
Previous
|
|
1388
|
+
</button>
|
|
1389
|
+
|
|
1390
|
+
<button
|
|
1391
|
+
*ngFor="let page of visiblePages"
|
|
1392
|
+
[disabled]="page === currentPage"
|
|
1393
|
+
(click)="handlePageChange(page)"
|
|
1394
|
+
[style]="getButtonStyle(page, page === currentPage)"
|
|
1395
|
+
>
|
|
1396
|
+
{{ page }}
|
|
1397
|
+
</button>
|
|
1398
|
+
|
|
1399
|
+
<button
|
|
1400
|
+
*ngIf="showPrevNext"
|
|
1401
|
+
[disabled]="currentPage === totalPages"
|
|
1402
|
+
(click)="handlePageChange(currentPage + 1)"
|
|
1403
|
+
[style]="getButtonStyle(currentPage + 1)"
|
|
1404
|
+
>
|
|
1405
|
+
Next
|
|
1406
|
+
</button>
|
|
1407
|
+
|
|
1408
|
+
<button
|
|
1409
|
+
*ngIf="showFirstLast"
|
|
1410
|
+
[disabled]="currentPage === totalPages"
|
|
1411
|
+
(click)="handlePageChange(totalPages)"
|
|
1412
|
+
[style]="getButtonStyle(totalPages)"
|
|
1413
|
+
>
|
|
1414
|
+
Last
|
|
1415
|
+
</button>
|
|
1416
|
+
</div>
|
|
1417
|
+
`,
|
|
1418
|
+
})];
|
|
1419
|
+
let _classDescriptor;
|
|
1420
|
+
let _classExtraInitializers = [];
|
|
1421
|
+
let _classThis;
|
|
1422
|
+
let _results_decorators;
|
|
1423
|
+
let _results_initializers = [];
|
|
1424
|
+
let _results_extraInitializers = [];
|
|
1425
|
+
let _currentPage_decorators;
|
|
1426
|
+
let _currentPage_initializers = [];
|
|
1427
|
+
let _currentPage_extraInitializers = [];
|
|
1428
|
+
let _itemsPerPage_decorators;
|
|
1429
|
+
let _itemsPerPage_initializers = [];
|
|
1430
|
+
let _itemsPerPage_extraInitializers = [];
|
|
1431
|
+
let _maxVisiblePages_decorators;
|
|
1432
|
+
let _maxVisiblePages_initializers = [];
|
|
1433
|
+
let _maxVisiblePages_extraInitializers = [];
|
|
1434
|
+
let _showFirstLast_decorators;
|
|
1435
|
+
let _showFirstLast_initializers = [];
|
|
1436
|
+
let _showFirstLast_extraInitializers = [];
|
|
1437
|
+
let _showPrevNext_decorators;
|
|
1438
|
+
let _showPrevNext_initializers = [];
|
|
1439
|
+
let _showPrevNext_extraInitializers = [];
|
|
1440
|
+
let _pageChange_decorators;
|
|
1441
|
+
let _pageChange_initializers = [];
|
|
1442
|
+
let _pageChange_extraInitializers = [];
|
|
1443
|
+
_classThis = class {
|
|
1444
|
+
constructor(searchContext) {
|
|
1445
|
+
this.searchContext = searchContext;
|
|
1446
|
+
this.results = __runInitializers(this, _results_initializers, void 0);
|
|
1447
|
+
this.currentPage = (__runInitializers(this, _results_extraInitializers), __runInitializers(this, _currentPage_initializers, 1));
|
|
1448
|
+
this.itemsPerPage = (__runInitializers(this, _currentPage_extraInitializers), __runInitializers(this, _itemsPerPage_initializers, 10));
|
|
1449
|
+
this.maxVisiblePages = (__runInitializers(this, _itemsPerPage_extraInitializers), __runInitializers(this, _maxVisiblePages_initializers, 5));
|
|
1450
|
+
this.showFirstLast = (__runInitializers(this, _maxVisiblePages_extraInitializers), __runInitializers(this, _showFirstLast_initializers, false));
|
|
1451
|
+
this.showPrevNext = (__runInitializers(this, _showFirstLast_extraInitializers), __runInitializers(this, _showPrevNext_initializers, true));
|
|
1452
|
+
this.pageChange = (__runInitializers(this, _showPrevNext_extraInitializers), __runInitializers(this, _pageChange_initializers, new EventEmitter()));
|
|
1453
|
+
__runInitializers(this, _pageChange_extraInitializers);
|
|
1454
|
+
this.searchContext = searchContext;
|
|
1455
|
+
}
|
|
1456
|
+
get totalResults() {
|
|
1457
|
+
if (!this.results)
|
|
1458
|
+
return 0;
|
|
1459
|
+
return this.results.totalResults || this.results.data?.total_results || 0;
|
|
1460
|
+
}
|
|
1461
|
+
get totalPages() {
|
|
1462
|
+
return Math.ceil(this.totalResults / this.itemsPerPage);
|
|
1463
|
+
}
|
|
1464
|
+
get visiblePages() {
|
|
1465
|
+
const pages = [];
|
|
1466
|
+
const maxVisible = this.maxVisiblePages || 5;
|
|
1467
|
+
const half = Math.floor(maxVisible / 2);
|
|
1468
|
+
let start = Math.max(1, this.currentPage - half);
|
|
1469
|
+
let end = Math.min(this.totalPages, start + maxVisible - 1);
|
|
1470
|
+
if (end - start < maxVisible - 1) {
|
|
1471
|
+
start = Math.max(1, end - maxVisible + 1);
|
|
1472
|
+
}
|
|
1473
|
+
for (let i = start; i <= end; i++) {
|
|
1474
|
+
pages.push(i);
|
|
1475
|
+
}
|
|
1476
|
+
return pages;
|
|
1477
|
+
}
|
|
1478
|
+
handlePageChange(page) {
|
|
1479
|
+
if (page < 1 || page > this.totalPages)
|
|
1480
|
+
return;
|
|
1481
|
+
this.pageChange.emit(page);
|
|
1482
|
+
}
|
|
1483
|
+
get containerStyle() {
|
|
1484
|
+
const theme = this.searchContext.theme;
|
|
1485
|
+
return {
|
|
1486
|
+
display: 'flex',
|
|
1487
|
+
gap: theme.spacing.small,
|
|
1488
|
+
justifyContent: 'center',
|
|
1489
|
+
alignItems: 'center',
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
getButtonStyle(page, isActive = false) {
|
|
1493
|
+
const theme = this.searchContext.theme;
|
|
1494
|
+
return {
|
|
1495
|
+
padding: `${theme.spacing.small} ${theme.spacing.medium}`,
|
|
1496
|
+
border: `1px solid ${theme.colors.border}`,
|
|
1497
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
1498
|
+
? theme.borderRadius
|
|
1499
|
+
: theme.borderRadius.medium,
|
|
1500
|
+
backgroundColor: isActive ? theme.colors.primary : theme.colors.background,
|
|
1501
|
+
color: isActive ? '#fff' : theme.colors.text,
|
|
1502
|
+
cursor: 'pointer',
|
|
1503
|
+
fontSize: theme.typography.fontSize.small,
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
__setFunctionName(_classThis, "PaginationComponent");
|
|
1508
|
+
(() => {
|
|
1509
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1510
|
+
_results_decorators = [Input()];
|
|
1511
|
+
_currentPage_decorators = [Input()];
|
|
1512
|
+
_itemsPerPage_decorators = [Input()];
|
|
1513
|
+
_maxVisiblePages_decorators = [Input()];
|
|
1514
|
+
_showFirstLast_decorators = [Input()];
|
|
1515
|
+
_showPrevNext_decorators = [Input()];
|
|
1516
|
+
_pageChange_decorators = [Output()];
|
|
1517
|
+
__esDecorate(null, null, _results_decorators, { kind: "field", name: "results", static: false, private: false, access: { has: obj => "results" in obj, get: obj => obj.results, set: (obj, value) => { obj.results = value; } }, metadata: _metadata }, _results_initializers, _results_extraInitializers);
|
|
1518
|
+
__esDecorate(null, null, _currentPage_decorators, { kind: "field", name: "currentPage", static: false, private: false, access: { has: obj => "currentPage" in obj, get: obj => obj.currentPage, set: (obj, value) => { obj.currentPage = value; } }, metadata: _metadata }, _currentPage_initializers, _currentPage_extraInitializers);
|
|
1519
|
+
__esDecorate(null, null, _itemsPerPage_decorators, { kind: "field", name: "itemsPerPage", static: false, private: false, access: { has: obj => "itemsPerPage" in obj, get: obj => obj.itemsPerPage, set: (obj, value) => { obj.itemsPerPage = value; } }, metadata: _metadata }, _itemsPerPage_initializers, _itemsPerPage_extraInitializers);
|
|
1520
|
+
__esDecorate(null, null, _maxVisiblePages_decorators, { kind: "field", name: "maxVisiblePages", static: false, private: false, access: { has: obj => "maxVisiblePages" in obj, get: obj => obj.maxVisiblePages, set: (obj, value) => { obj.maxVisiblePages = value; } }, metadata: _metadata }, _maxVisiblePages_initializers, _maxVisiblePages_extraInitializers);
|
|
1521
|
+
__esDecorate(null, null, _showFirstLast_decorators, { kind: "field", name: "showFirstLast", static: false, private: false, access: { has: obj => "showFirstLast" in obj, get: obj => obj.showFirstLast, set: (obj, value) => { obj.showFirstLast = value; } }, metadata: _metadata }, _showFirstLast_initializers, _showFirstLast_extraInitializers);
|
|
1522
|
+
__esDecorate(null, null, _showPrevNext_decorators, { kind: "field", name: "showPrevNext", static: false, private: false, access: { has: obj => "showPrevNext" in obj, get: obj => obj.showPrevNext, set: (obj, value) => { obj.showPrevNext = value; } }, metadata: _metadata }, _showPrevNext_initializers, _showPrevNext_extraInitializers);
|
|
1523
|
+
__esDecorate(null, null, _pageChange_decorators, { kind: "field", name: "pageChange", static: false, private: false, access: { has: obj => "pageChange" in obj, get: obj => obj.pageChange, set: (obj, value) => { obj.pageChange = value; } }, metadata: _metadata }, _pageChange_initializers, _pageChange_extraInitializers);
|
|
1524
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1525
|
+
_classThis = _classDescriptor.value;
|
|
1526
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1527
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1528
|
+
})();
|
|
1529
|
+
return _classThis;
|
|
1530
|
+
})();
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* SortBy Component
|
|
1534
|
+
*
|
|
1535
|
+
* Displays sort options for search results
|
|
1536
|
+
*/
|
|
1537
|
+
let SortByComponent = (() => {
|
|
1538
|
+
let _classDecorators = [Component({
|
|
1539
|
+
selector: 'seekora-sort-by',
|
|
1540
|
+
template: `
|
|
1541
|
+
<div [style]="containerStyle">
|
|
1542
|
+
<label *ngIf="label" [style]="labelStyle">{{ label }}</label>
|
|
1543
|
+
<select
|
|
1544
|
+
[value]="value"
|
|
1545
|
+
(change)="handleChange($event)"
|
|
1546
|
+
[style]="selectStyle"
|
|
1547
|
+
>
|
|
1548
|
+
<option
|
|
1549
|
+
*ngFor="let option of options"
|
|
1550
|
+
[value]="option.value"
|
|
1551
|
+
>
|
|
1552
|
+
{{ option.label }}
|
|
1553
|
+
</option>
|
|
1554
|
+
</select>
|
|
1555
|
+
</div>
|
|
1556
|
+
`,
|
|
1557
|
+
})];
|
|
1558
|
+
let _classDescriptor;
|
|
1559
|
+
let _classExtraInitializers = [];
|
|
1560
|
+
let _classThis;
|
|
1561
|
+
let _options_decorators;
|
|
1562
|
+
let _options_initializers = [];
|
|
1563
|
+
let _options_extraInitializers = [];
|
|
1564
|
+
let _value_decorators;
|
|
1565
|
+
let _value_initializers = [];
|
|
1566
|
+
let _value_extraInitializers = [];
|
|
1567
|
+
let _label_decorators;
|
|
1568
|
+
let _label_initializers = [];
|
|
1569
|
+
let _label_extraInitializers = [];
|
|
1570
|
+
let _sortChange_decorators;
|
|
1571
|
+
let _sortChange_initializers = [];
|
|
1572
|
+
let _sortChange_extraInitializers = [];
|
|
1573
|
+
_classThis = class {
|
|
1574
|
+
constructor(searchContext) {
|
|
1575
|
+
this.searchContext = searchContext;
|
|
1576
|
+
this.options = __runInitializers(this, _options_initializers, []);
|
|
1577
|
+
this.value = (__runInitializers(this, _options_extraInitializers), __runInitializers(this, _value_initializers, ''));
|
|
1578
|
+
this.label = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _label_initializers, void 0));
|
|
1579
|
+
this.sortChange = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _sortChange_initializers, new EventEmitter()));
|
|
1580
|
+
__runInitializers(this, _sortChange_extraInitializers);
|
|
1581
|
+
this.searchContext = searchContext;
|
|
1582
|
+
}
|
|
1583
|
+
handleChange(event) {
|
|
1584
|
+
const target = event.target;
|
|
1585
|
+
this.sortChange.emit(target.value);
|
|
1586
|
+
}
|
|
1587
|
+
get containerStyle() {
|
|
1588
|
+
const theme = this.searchContext.theme;
|
|
1589
|
+
return {
|
|
1590
|
+
display: 'flex',
|
|
1591
|
+
alignItems: 'center',
|
|
1592
|
+
gap: theme.spacing.small,
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
get labelStyle() {
|
|
1596
|
+
const theme = this.searchContext.theme;
|
|
1597
|
+
return {
|
|
1598
|
+
fontSize: theme.typography.fontSize.medium,
|
|
1599
|
+
color: theme.colors.text,
|
|
1600
|
+
fontWeight: theme.typography.fontWeight?.medium || 500,
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
get selectStyle() {
|
|
1604
|
+
const theme = this.searchContext.theme;
|
|
1605
|
+
return {
|
|
1606
|
+
padding: theme.spacing.small,
|
|
1607
|
+
fontSize: theme.typography.fontSize.medium,
|
|
1608
|
+
border: `1px solid ${theme.colors.border}`,
|
|
1609
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
1610
|
+
? theme.borderRadius
|
|
1611
|
+
: theme.borderRadius.medium,
|
|
1612
|
+
backgroundColor: theme.colors.background,
|
|
1613
|
+
color: theme.colors.text,
|
|
1614
|
+
cursor: 'pointer',
|
|
1615
|
+
outline: 'none',
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
__setFunctionName(_classThis, "SortByComponent");
|
|
1620
|
+
(() => {
|
|
1621
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1622
|
+
_options_decorators = [Input()];
|
|
1623
|
+
_value_decorators = [Input()];
|
|
1624
|
+
_label_decorators = [Input()];
|
|
1625
|
+
_sortChange_decorators = [Output()];
|
|
1626
|
+
__esDecorate(null, null, _options_decorators, { kind: "field", name: "options", static: false, private: false, access: { has: obj => "options" in obj, get: obj => obj.options, set: (obj, value) => { obj.options = value; } }, metadata: _metadata }, _options_initializers, _options_extraInitializers);
|
|
1627
|
+
__esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
1628
|
+
__esDecorate(null, null, _label_decorators, { kind: "field", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
1629
|
+
__esDecorate(null, null, _sortChange_decorators, { kind: "field", name: "sortChange", static: false, private: false, access: { has: obj => "sortChange" in obj, get: obj => obj.sortChange, set: (obj, value) => { obj.sortChange = value; } }, metadata: _metadata }, _sortChange_initializers, _sortChange_extraInitializers);
|
|
1630
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1631
|
+
_classThis = _classDescriptor.value;
|
|
1632
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1633
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1634
|
+
})();
|
|
1635
|
+
return _classThis;
|
|
1636
|
+
})();
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* Facets Component
|
|
1640
|
+
*
|
|
1641
|
+
* Displays facet filters for search results
|
|
1642
|
+
*/
|
|
1643
|
+
let FacetsComponent = (() => {
|
|
1644
|
+
let _classDecorators = [Component({
|
|
1645
|
+
selector: 'seekora-facets',
|
|
1646
|
+
template: `
|
|
1647
|
+
<div
|
|
1648
|
+
*ngFor="let facet of facets"
|
|
1649
|
+
[style]="containerStyle"
|
|
1650
|
+
>
|
|
1651
|
+
<h3 [style]="titleStyle">{{ facet.field_name }}</h3>
|
|
1652
|
+
<div
|
|
1653
|
+
*ngFor="let count of visibleCounts(facet); let i = index"
|
|
1654
|
+
[style]="getFacetItemStyle(facet.field_name, count.value)"
|
|
1655
|
+
(click)="handleFacetClick(facet.field_name, count.value)"
|
|
1656
|
+
>
|
|
1657
|
+
<input
|
|
1658
|
+
type="checkbox"
|
|
1659
|
+
[checked]="isSelected(facet.field_name, count.value)"
|
|
1660
|
+
(change)="handleFacetChange(facet.field_name, count.value, !isSelected(facet.field_name, count.value))"
|
|
1661
|
+
[style]="checkboxStyle"
|
|
1662
|
+
/>
|
|
1663
|
+
<span [style]="labelStyle">{{ count.value }}</span>
|
|
1664
|
+
<span [style]="countStyle">({{ count.count }})</span>
|
|
1665
|
+
</div>
|
|
1666
|
+
<button
|
|
1667
|
+
*ngIf="facet.counts.length > maxItems"
|
|
1668
|
+
(click)="toggleShowMore(facet.field_name)"
|
|
1669
|
+
[style]="showMoreStyle"
|
|
1670
|
+
>
|
|
1671
|
+
{{ getShowMoreLabel(facet) }}
|
|
1672
|
+
</button>
|
|
1673
|
+
</div>
|
|
1674
|
+
`,
|
|
1675
|
+
})];
|
|
1676
|
+
let _classDescriptor;
|
|
1677
|
+
let _classExtraInitializers = [];
|
|
1678
|
+
let _classThis;
|
|
1679
|
+
let _results_decorators;
|
|
1680
|
+
let _results_initializers = [];
|
|
1681
|
+
let _results_extraInitializers = [];
|
|
1682
|
+
let _maxItems_decorators;
|
|
1683
|
+
let _maxItems_initializers = [];
|
|
1684
|
+
let _maxItems_extraInitializers = [];
|
|
1685
|
+
let _showMore_decorators;
|
|
1686
|
+
let _showMore_initializers = [];
|
|
1687
|
+
let _showMore_extraInitializers = [];
|
|
1688
|
+
let _selectedFacets_decorators;
|
|
1689
|
+
let _selectedFacets_initializers = [];
|
|
1690
|
+
let _selectedFacets_extraInitializers = [];
|
|
1691
|
+
let _facetChange_decorators;
|
|
1692
|
+
let _facetChange_initializers = [];
|
|
1693
|
+
let _facetChange_extraInitializers = [];
|
|
1694
|
+
_classThis = class {
|
|
1695
|
+
constructor(searchContext) {
|
|
1696
|
+
this.searchContext = searchContext;
|
|
1697
|
+
this.results = __runInitializers(this, _results_initializers, void 0);
|
|
1698
|
+
this.maxItems = (__runInitializers(this, _results_extraInitializers), __runInitializers(this, _maxItems_initializers, 5));
|
|
1699
|
+
this.showMore = (__runInitializers(this, _maxItems_extraInitializers), __runInitializers(this, _showMore_initializers, true));
|
|
1700
|
+
this.selectedFacets = (__runInitializers(this, _showMore_extraInitializers), __runInitializers(this, _selectedFacets_initializers, {}));
|
|
1701
|
+
this.facetChange = (__runInitializers(this, _selectedFacets_extraInitializers), __runInitializers(this, _facetChange_initializers, new EventEmitter()));
|
|
1702
|
+
this.expandedFacets = (__runInitializers(this, _facetChange_extraInitializers), {});
|
|
1703
|
+
}
|
|
1704
|
+
get facets() {
|
|
1705
|
+
if (!this.results)
|
|
1706
|
+
return [];
|
|
1707
|
+
const facetsData = this.results.facets || this.results.data?.facets || [];
|
|
1708
|
+
return Array.isArray(facetsData) ? facetsData : [];
|
|
1709
|
+
}
|
|
1710
|
+
visibleCounts(facet) {
|
|
1711
|
+
const isExpanded = this.expandedFacets[facet.field_name];
|
|
1712
|
+
if (isExpanded || !this.showMore) {
|
|
1713
|
+
return facet.counts;
|
|
1714
|
+
}
|
|
1715
|
+
return facet.counts.slice(0, this.maxItems);
|
|
1716
|
+
}
|
|
1717
|
+
isSelected(field, value) {
|
|
1718
|
+
const selected = this.selectedFacets?.[field] || [];
|
|
1719
|
+
return selected.includes(value);
|
|
1720
|
+
}
|
|
1721
|
+
toggleShowMore(field) {
|
|
1722
|
+
this.expandedFacets[field] = !this.expandedFacets[field];
|
|
1723
|
+
}
|
|
1724
|
+
handleFacetClick(field, value) {
|
|
1725
|
+
this.handleFacetChange(field, value, !this.isSelected(field, value));
|
|
1726
|
+
}
|
|
1727
|
+
handleFacetChange(field, value, selected) {
|
|
1728
|
+
this.facetChange.emit({ field, value, selected });
|
|
1729
|
+
}
|
|
1730
|
+
get containerStyle() {
|
|
1731
|
+
const theme = this.searchContext.theme;
|
|
1732
|
+
return {
|
|
1733
|
+
marginBottom: theme.spacing.large,
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
get titleStyle() {
|
|
1737
|
+
const theme = this.searchContext.theme;
|
|
1738
|
+
return {
|
|
1739
|
+
fontSize: theme.typography.fontSize.medium,
|
|
1740
|
+
fontWeight: theme.typography.fontWeight?.bold || 700,
|
|
1741
|
+
marginBottom: theme.spacing.small,
|
|
1742
|
+
color: theme.colors.text,
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
getFacetItemStyle(field, value) {
|
|
1746
|
+
const theme = this.searchContext.theme;
|
|
1747
|
+
return {
|
|
1748
|
+
display: 'flex',
|
|
1749
|
+
alignItems: 'center',
|
|
1750
|
+
gap: theme.spacing.small,
|
|
1751
|
+
padding: theme.spacing.small,
|
|
1752
|
+
cursor: 'pointer',
|
|
1753
|
+
backgroundColor: this.isSelected(field, value) ? theme.colors.hover : 'transparent',
|
|
1754
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
1755
|
+
? theme.borderRadius
|
|
1756
|
+
: theme.borderRadius.small,
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
get checkboxStyle() {
|
|
1760
|
+
return {
|
|
1761
|
+
cursor: 'pointer',
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
get labelStyle() {
|
|
1765
|
+
const theme = this.searchContext.theme;
|
|
1766
|
+
return {
|
|
1767
|
+
flex: 1,
|
|
1768
|
+
fontSize: theme.typography.fontSize.small,
|
|
1769
|
+
color: theme.colors.text,
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
get countStyle() {
|
|
1773
|
+
const theme = this.searchContext.theme;
|
|
1774
|
+
return {
|
|
1775
|
+
fontSize: theme.typography.fontSize.small,
|
|
1776
|
+
color: theme.colors.textSecondary || theme.colors.text,
|
|
1777
|
+
opacity: 0.7,
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
get showMoreStyle() {
|
|
1781
|
+
const theme = this.searchContext.theme;
|
|
1782
|
+
return {
|
|
1783
|
+
marginTop: theme.spacing.small,
|
|
1784
|
+
padding: theme.spacing.small,
|
|
1785
|
+
backgroundColor: 'transparent',
|
|
1786
|
+
border: 'none',
|
|
1787
|
+
color: theme.colors.primary,
|
|
1788
|
+
cursor: 'pointer',
|
|
1789
|
+
fontSize: theme.typography.fontSize.small,
|
|
1790
|
+
textDecoration: 'underline',
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
isExpanded(field) {
|
|
1794
|
+
return this.expandedFacets[field] || false;
|
|
1795
|
+
}
|
|
1796
|
+
getShowMoreLabel(facet) {
|
|
1797
|
+
if (this.isExpanded(facet.field_name)) {
|
|
1798
|
+
return 'Show Less';
|
|
1799
|
+
}
|
|
1800
|
+
return `Show More (${facet.counts.length - this.maxItems})`;
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
__setFunctionName(_classThis, "FacetsComponent");
|
|
1804
|
+
(() => {
|
|
1805
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1806
|
+
_results_decorators = [Input()];
|
|
1807
|
+
_maxItems_decorators = [Input()];
|
|
1808
|
+
_showMore_decorators = [Input()];
|
|
1809
|
+
_selectedFacets_decorators = [Input()];
|
|
1810
|
+
_facetChange_decorators = [Output()];
|
|
1811
|
+
__esDecorate(null, null, _results_decorators, { kind: "field", name: "results", static: false, private: false, access: { has: obj => "results" in obj, get: obj => obj.results, set: (obj, value) => { obj.results = value; } }, metadata: _metadata }, _results_initializers, _results_extraInitializers);
|
|
1812
|
+
__esDecorate(null, null, _maxItems_decorators, { kind: "field", name: "maxItems", static: false, private: false, access: { has: obj => "maxItems" in obj, get: obj => obj.maxItems, set: (obj, value) => { obj.maxItems = value; } }, metadata: _metadata }, _maxItems_initializers, _maxItems_extraInitializers);
|
|
1813
|
+
__esDecorate(null, null, _showMore_decorators, { kind: "field", name: "showMore", static: false, private: false, access: { has: obj => "showMore" in obj, get: obj => obj.showMore, set: (obj, value) => { obj.showMore = value; } }, metadata: _metadata }, _showMore_initializers, _showMore_extraInitializers);
|
|
1814
|
+
__esDecorate(null, null, _selectedFacets_decorators, { kind: "field", name: "selectedFacets", static: false, private: false, access: { has: obj => "selectedFacets" in obj, get: obj => obj.selectedFacets, set: (obj, value) => { obj.selectedFacets = value; } }, metadata: _metadata }, _selectedFacets_initializers, _selectedFacets_extraInitializers);
|
|
1815
|
+
__esDecorate(null, null, _facetChange_decorators, { kind: "field", name: "facetChange", static: false, private: false, access: { has: obj => "facetChange" in obj, get: obj => obj.facetChange, set: (obj, value) => { obj.facetChange = value; } }, metadata: _metadata }, _facetChange_initializers, _facetChange_extraInitializers);
|
|
1816
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1817
|
+
_classThis = _classDescriptor.value;
|
|
1818
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1819
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1820
|
+
})();
|
|
1821
|
+
return _classThis;
|
|
1822
|
+
})();
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* CurrentRefinements Component
|
|
1826
|
+
*
|
|
1827
|
+
* Displays currently active filters/refinements with ability to clear them
|
|
1828
|
+
*/
|
|
1829
|
+
let CurrentRefinementsComponent = (() => {
|
|
1830
|
+
let _classDecorators = [Component({
|
|
1831
|
+
selector: 'seekora-current-refinements',
|
|
1832
|
+
template: `
|
|
1833
|
+
<div *ngIf="refinements.length > 0" [style]="containerStyle">
|
|
1834
|
+
<div *ngIf="showLabel" [style]="labelStyle">{{ label }}</div>
|
|
1835
|
+
<div [style]="refinementsStyle">
|
|
1836
|
+
<div
|
|
1837
|
+
*ngFor="let refinement of refinements; let i = index"
|
|
1838
|
+
[style]="refinementStyle"
|
|
1839
|
+
>
|
|
1840
|
+
<span [style]="refinementTextStyle">
|
|
1841
|
+
{{ getRefinementLabel(refinement) }}
|
|
1842
|
+
</span>
|
|
1843
|
+
<button
|
|
1844
|
+
(click)="handleClear(refinement.field, refinement.value)"
|
|
1845
|
+
[style]="clearButtonStyle"
|
|
1846
|
+
>
|
|
1847
|
+
×
|
|
1848
|
+
</button>
|
|
1849
|
+
</div>
|
|
1850
|
+
<button
|
|
1851
|
+
*ngIf="showClearAll"
|
|
1852
|
+
(click)="handleClearAll()"
|
|
1853
|
+
[style]="clearAllStyle"
|
|
1854
|
+
>
|
|
1855
|
+
Clear All
|
|
1856
|
+
</button>
|
|
1857
|
+
</div>
|
|
1858
|
+
</div>
|
|
1859
|
+
`,
|
|
1860
|
+
})];
|
|
1861
|
+
let _classDescriptor;
|
|
1862
|
+
let _classExtraInitializers = [];
|
|
1863
|
+
let _classThis;
|
|
1864
|
+
let _refinements_decorators;
|
|
1865
|
+
let _refinements_initializers = [];
|
|
1866
|
+
let _refinements_extraInitializers = [];
|
|
1867
|
+
let _showLabel_decorators;
|
|
1868
|
+
let _showLabel_initializers = [];
|
|
1869
|
+
let _showLabel_extraInitializers = [];
|
|
1870
|
+
let _label_decorators;
|
|
1871
|
+
let _label_initializers = [];
|
|
1872
|
+
let _label_extraInitializers = [];
|
|
1873
|
+
let _showClearAll_decorators;
|
|
1874
|
+
let _showClearAll_initializers = [];
|
|
1875
|
+
let _showClearAll_extraInitializers = [];
|
|
1876
|
+
let _refinementClear_decorators;
|
|
1877
|
+
let _refinementClear_initializers = [];
|
|
1878
|
+
let _refinementClear_extraInitializers = [];
|
|
1879
|
+
let _clearAll_decorators;
|
|
1880
|
+
let _clearAll_initializers = [];
|
|
1881
|
+
let _clearAll_extraInitializers = [];
|
|
1882
|
+
_classThis = class {
|
|
1883
|
+
constructor(searchContext) {
|
|
1884
|
+
this.searchContext = searchContext;
|
|
1885
|
+
this.refinements = __runInitializers(this, _refinements_initializers, []);
|
|
1886
|
+
this.showLabel = (__runInitializers(this, _refinements_extraInitializers), __runInitializers(this, _showLabel_initializers, true));
|
|
1887
|
+
this.label = (__runInitializers(this, _showLabel_extraInitializers), __runInitializers(this, _label_initializers, 'Active Filters'));
|
|
1888
|
+
this.showClearAll = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _showClearAll_initializers, true));
|
|
1889
|
+
this.refinementClear = (__runInitializers(this, _showClearAll_extraInitializers), __runInitializers(this, _refinementClear_initializers, new EventEmitter()));
|
|
1890
|
+
this.clearAll = (__runInitializers(this, _refinementClear_extraInitializers), __runInitializers(this, _clearAll_initializers, new EventEmitter()));
|
|
1891
|
+
__runInitializers(this, _clearAll_extraInitializers);
|
|
1892
|
+
this.searchContext = searchContext;
|
|
1893
|
+
}
|
|
1894
|
+
getRefinementLabel(refinement) {
|
|
1895
|
+
if (refinement.label)
|
|
1896
|
+
return refinement.label;
|
|
1897
|
+
return `${refinement.field}: ${refinement.value}`;
|
|
1898
|
+
}
|
|
1899
|
+
handleClear(field, value) {
|
|
1900
|
+
this.refinementClear.emit({ field, value });
|
|
1901
|
+
}
|
|
1902
|
+
handleClearAll() {
|
|
1903
|
+
this.clearAll.emit();
|
|
1904
|
+
}
|
|
1905
|
+
get containerStyle() {
|
|
1906
|
+
const theme = this.searchContext.theme;
|
|
1907
|
+
return {
|
|
1908
|
+
marginBottom: theme.spacing.medium,
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
get labelStyle() {
|
|
1912
|
+
const theme = this.searchContext.theme;
|
|
1913
|
+
return {
|
|
1914
|
+
fontSize: theme.typography.fontSize.medium,
|
|
1915
|
+
fontWeight: theme.typography.fontWeight?.semibold || 600,
|
|
1916
|
+
marginBottom: theme.spacing.small,
|
|
1917
|
+
color: theme.colors.text,
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
get refinementsStyle() {
|
|
1921
|
+
const theme = this.searchContext.theme;
|
|
1922
|
+
return {
|
|
1923
|
+
display: 'flex',
|
|
1924
|
+
flexWrap: 'wrap',
|
|
1925
|
+
gap: theme.spacing.small,
|
|
1926
|
+
alignItems: 'center',
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
get refinementStyle() {
|
|
1930
|
+
const theme = this.searchContext.theme;
|
|
1931
|
+
return {
|
|
1932
|
+
display: 'flex',
|
|
1933
|
+
alignItems: 'center',
|
|
1934
|
+
gap: theme.spacing.small,
|
|
1935
|
+
padding: `${theme.spacing.small} ${theme.spacing.medium}`,
|
|
1936
|
+
backgroundColor: theme.colors.hover,
|
|
1937
|
+
border: `1px solid ${theme.colors.border}`,
|
|
1938
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
1939
|
+
? theme.borderRadius
|
|
1940
|
+
: theme.borderRadius.medium,
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
get refinementTextStyle() {
|
|
1944
|
+
const theme = this.searchContext.theme;
|
|
1945
|
+
return {
|
|
1946
|
+
fontSize: theme.typography.fontSize.small,
|
|
1947
|
+
color: theme.colors.text,
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
get clearButtonStyle() {
|
|
1951
|
+
const theme = this.searchContext.theme;
|
|
1952
|
+
return {
|
|
1953
|
+
backgroundColor: 'transparent',
|
|
1954
|
+
border: 'none',
|
|
1955
|
+
color: theme.colors.text,
|
|
1956
|
+
cursor: 'pointer',
|
|
1957
|
+
fontSize: theme.typography.fontSize.large,
|
|
1958
|
+
lineHeight: 1,
|
|
1959
|
+
padding: 0,
|
|
1960
|
+
marginLeft: theme.spacing.small,
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
get clearAllStyle() {
|
|
1964
|
+
const theme = this.searchContext.theme;
|
|
1965
|
+
return {
|
|
1966
|
+
padding: `${theme.spacing.small} ${theme.spacing.medium}`,
|
|
1967
|
+
backgroundColor: theme.colors.primary,
|
|
1968
|
+
color: '#fff',
|
|
1969
|
+
border: 'none',
|
|
1970
|
+
borderRadius: typeof theme.borderRadius === 'string'
|
|
1971
|
+
? theme.borderRadius
|
|
1972
|
+
: theme.borderRadius.medium,
|
|
1973
|
+
cursor: 'pointer',
|
|
1974
|
+
fontSize: theme.typography.fontSize.small,
|
|
1975
|
+
fontWeight: theme.typography.fontWeight?.medium || 500,
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
__setFunctionName(_classThis, "CurrentRefinementsComponent");
|
|
1980
|
+
(() => {
|
|
1981
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1982
|
+
_refinements_decorators = [Input()];
|
|
1983
|
+
_showLabel_decorators = [Input()];
|
|
1984
|
+
_label_decorators = [Input()];
|
|
1985
|
+
_showClearAll_decorators = [Input()];
|
|
1986
|
+
_refinementClear_decorators = [Output()];
|
|
1987
|
+
_clearAll_decorators = [Output()];
|
|
1988
|
+
__esDecorate(null, null, _refinements_decorators, { kind: "field", name: "refinements", static: false, private: false, access: { has: obj => "refinements" in obj, get: obj => obj.refinements, set: (obj, value) => { obj.refinements = value; } }, metadata: _metadata }, _refinements_initializers, _refinements_extraInitializers);
|
|
1989
|
+
__esDecorate(null, null, _showLabel_decorators, { kind: "field", name: "showLabel", static: false, private: false, access: { has: obj => "showLabel" in obj, get: obj => obj.showLabel, set: (obj, value) => { obj.showLabel = value; } }, metadata: _metadata }, _showLabel_initializers, _showLabel_extraInitializers);
|
|
1990
|
+
__esDecorate(null, null, _label_decorators, { kind: "field", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
1991
|
+
__esDecorate(null, null, _showClearAll_decorators, { kind: "field", name: "showClearAll", static: false, private: false, access: { has: obj => "showClearAll" in obj, get: obj => obj.showClearAll, set: (obj, value) => { obj.showClearAll = value; } }, metadata: _metadata }, _showClearAll_initializers, _showClearAll_extraInitializers);
|
|
1992
|
+
__esDecorate(null, null, _refinementClear_decorators, { kind: "field", name: "refinementClear", static: false, private: false, access: { has: obj => "refinementClear" in obj, get: obj => obj.refinementClear, set: (obj, value) => { obj.refinementClear = value; } }, metadata: _metadata }, _refinementClear_initializers, _refinementClear_extraInitializers);
|
|
1993
|
+
__esDecorate(null, null, _clearAll_decorators, { kind: "field", name: "clearAll", static: false, private: false, access: { has: obj => "clearAll" in obj, get: obj => obj.clearAll, set: (obj, value) => { obj.clearAll = value; } }, metadata: _metadata }, _clearAll_initializers, _clearAll_extraInitializers);
|
|
1994
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1995
|
+
_classThis = _classDescriptor.value;
|
|
1996
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1997
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1998
|
+
})();
|
|
1999
|
+
return _classThis;
|
|
2000
|
+
})();
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* RangeInput Component
|
|
2004
|
+
*
|
|
2005
|
+
* Displays a range input for filtering numeric values (e.g., price range)
|
|
2006
|
+
*/
|
|
2007
|
+
let RangeInputComponent = (() => {
|
|
2008
|
+
let _classDecorators = [Component({
|
|
2009
|
+
selector: 'seekora-range-input',
|
|
2010
|
+
template: `
|
|
2011
|
+
<div [style]="getContainerStyle()">
|
|
2012
|
+
<label *ngIf="label" [style]="getLabelStyle()">
|
|
2013
|
+
{{ label }}
|
|
2014
|
+
</label>
|
|
2015
|
+
<div [style]="getInputGroupStyle()">
|
|
2016
|
+
<input
|
|
2017
|
+
type="number"
|
|
2018
|
+
[min]="min"
|
|
2019
|
+
[max]="max"
|
|
2020
|
+
[step]="step"
|
|
2021
|
+
[value]="currentMin !== undefined ? currentMin : ''"
|
|
2022
|
+
(input)="onMinChange($event)"
|
|
2023
|
+
[placeholder]="placeholder?.min || 'Min'"
|
|
2024
|
+
[style]="getInputStyle()"
|
|
2025
|
+
/>
|
|
2026
|
+
<span [style]="getSeparatorStyle()">to</span>
|
|
2027
|
+
<input
|
|
2028
|
+
type="number"
|
|
2029
|
+
[min]="min"
|
|
2030
|
+
[max]="max"
|
|
2031
|
+
[step]="step"
|
|
2032
|
+
[value]="currentMax !== undefined ? currentMax : ''"
|
|
2033
|
+
(input)="onMaxChange($event)"
|
|
2034
|
+
[placeholder]="placeholder?.max || 'Max'"
|
|
2035
|
+
[style]="getInputStyle()"
|
|
2036
|
+
/>
|
|
2037
|
+
<button
|
|
2038
|
+
*ngIf="showApplyButton"
|
|
2039
|
+
type="button"
|
|
2040
|
+
(click)="onApply()"
|
|
2041
|
+
[style]="getApplyButtonStyle()"
|
|
2042
|
+
>
|
|
2043
|
+
Apply
|
|
2044
|
+
</button>
|
|
2045
|
+
<button
|
|
2046
|
+
*ngIf="hasValue()"
|
|
2047
|
+
type="button"
|
|
2048
|
+
(click)="onReset()"
|
|
2049
|
+
[style]="getResetButtonStyle()"
|
|
2050
|
+
>
|
|
2051
|
+
Reset
|
|
2052
|
+
</button>
|
|
2053
|
+
</div>
|
|
2054
|
+
</div>
|
|
2055
|
+
`,
|
|
2056
|
+
})];
|
|
2057
|
+
let _classDescriptor;
|
|
2058
|
+
let _classExtraInitializers = [];
|
|
2059
|
+
let _classThis;
|
|
2060
|
+
let _field_decorators;
|
|
2061
|
+
let _field_initializers = [];
|
|
2062
|
+
let _field_extraInitializers = [];
|
|
2063
|
+
let _label_decorators;
|
|
2064
|
+
let _label_initializers = [];
|
|
2065
|
+
let _label_extraInitializers = [];
|
|
2066
|
+
let _min_decorators;
|
|
2067
|
+
let _min_initializers = [];
|
|
2068
|
+
let _min_extraInitializers = [];
|
|
2069
|
+
let _max_decorators;
|
|
2070
|
+
let _max_initializers = [];
|
|
2071
|
+
let _max_extraInitializers = [];
|
|
2072
|
+
let _step_decorators;
|
|
2073
|
+
let _step_initializers = [];
|
|
2074
|
+
let _step_extraInitializers = [];
|
|
2075
|
+
let _currentMin_decorators;
|
|
2076
|
+
let _currentMin_initializers = [];
|
|
2077
|
+
let _currentMin_extraInitializers = [];
|
|
2078
|
+
let _currentMax_decorators;
|
|
2079
|
+
let _currentMax_initializers = [];
|
|
2080
|
+
let _currentMax_extraInitializers = [];
|
|
2081
|
+
let _showApplyButton_decorators;
|
|
2082
|
+
let _showApplyButton_initializers = [];
|
|
2083
|
+
let _showApplyButton_extraInitializers = [];
|
|
2084
|
+
let _placeholder_decorators;
|
|
2085
|
+
let _placeholder_initializers = [];
|
|
2086
|
+
let _placeholder_extraInitializers = [];
|
|
2087
|
+
let _className_decorators;
|
|
2088
|
+
let _className_initializers = [];
|
|
2089
|
+
let _className_extraInitializers = [];
|
|
2090
|
+
let _style_decorators;
|
|
2091
|
+
let _style_initializers = [];
|
|
2092
|
+
let _style_extraInitializers = [];
|
|
2093
|
+
let _rangeChange_decorators;
|
|
2094
|
+
let _rangeChange_initializers = [];
|
|
2095
|
+
let _rangeChange_extraInitializers = [];
|
|
2096
|
+
_classThis = class {
|
|
2097
|
+
constructor(searchContext) {
|
|
2098
|
+
this.searchContext = searchContext;
|
|
2099
|
+
this.field = __runInitializers(this, _field_initializers, void 0);
|
|
2100
|
+
this.label = (__runInitializers(this, _field_extraInitializers), __runInitializers(this, _label_initializers, void 0));
|
|
2101
|
+
this.min = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _min_initializers, void 0));
|
|
2102
|
+
this.max = (__runInitializers(this, _min_extraInitializers), __runInitializers(this, _max_initializers, void 0));
|
|
2103
|
+
this.step = (__runInitializers(this, _max_extraInitializers), __runInitializers(this, _step_initializers, 1));
|
|
2104
|
+
this.currentMin = (__runInitializers(this, _step_extraInitializers), __runInitializers(this, _currentMin_initializers, void 0));
|
|
2105
|
+
this.currentMax = (__runInitializers(this, _currentMin_extraInitializers), __runInitializers(this, _currentMax_initializers, void 0));
|
|
2106
|
+
this.showApplyButton = (__runInitializers(this, _currentMax_extraInitializers), __runInitializers(this, _showApplyButton_initializers, true));
|
|
2107
|
+
this.placeholder = (__runInitializers(this, _showApplyButton_extraInitializers), __runInitializers(this, _placeholder_initializers, void 0));
|
|
2108
|
+
this.className = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _className_initializers, void 0));
|
|
2109
|
+
this.style = (__runInitializers(this, _className_extraInitializers), __runInitializers(this, _style_initializers, void 0));
|
|
2110
|
+
this.rangeChange = (__runInitializers(this, _style_extraInitializers), __runInitializers(this, _rangeChange_initializers, new EventEmitter()));
|
|
2111
|
+
this.internalMin = __runInitializers(this, _rangeChange_extraInitializers);
|
|
2112
|
+
}
|
|
2113
|
+
ngOnInit() {
|
|
2114
|
+
this.internalMin = this.currentMin;
|
|
2115
|
+
this.internalMax = this.currentMax;
|
|
2116
|
+
this.appliedMin = this.currentMin;
|
|
2117
|
+
this.appliedMax = this.currentMax;
|
|
2118
|
+
}
|
|
2119
|
+
get theme() {
|
|
2120
|
+
return this.searchContext.theme;
|
|
2121
|
+
}
|
|
2122
|
+
get effectiveMin() {
|
|
2123
|
+
return this.currentMin !== undefined ? this.currentMin : this.internalMin;
|
|
2124
|
+
}
|
|
2125
|
+
get effectiveMax() {
|
|
2126
|
+
return this.currentMax !== undefined ? this.currentMax : this.internalMax;
|
|
2127
|
+
}
|
|
2128
|
+
hasValue() {
|
|
2129
|
+
return this.effectiveMin !== undefined || this.effectiveMax !== undefined;
|
|
2130
|
+
}
|
|
2131
|
+
onMinChange(event) {
|
|
2132
|
+
const target = event.target;
|
|
2133
|
+
const value = target.value === '' ? undefined : parseFloat(target.value);
|
|
2134
|
+
this.internalMin = value;
|
|
2135
|
+
if (!this.showApplyButton) {
|
|
2136
|
+
this.rangeChange.emit({ min: value, max: this.effectiveMax });
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
onMaxChange(event) {
|
|
2140
|
+
const target = event.target;
|
|
2141
|
+
const value = target.value === '' ? undefined : parseFloat(target.value);
|
|
2142
|
+
this.internalMax = value;
|
|
2143
|
+
if (!this.showApplyButton) {
|
|
2144
|
+
this.rangeChange.emit({ min: this.effectiveMin, max: value });
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
onApply() {
|
|
2148
|
+
this.appliedMin = this.internalMin;
|
|
2149
|
+
this.appliedMax = this.internalMax;
|
|
2150
|
+
this.rangeChange.emit({ min: this.internalMin, max: this.internalMax });
|
|
2151
|
+
}
|
|
2152
|
+
onReset() {
|
|
2153
|
+
this.internalMin = undefined;
|
|
2154
|
+
this.internalMax = undefined;
|
|
2155
|
+
this.appliedMin = undefined;
|
|
2156
|
+
this.appliedMax = undefined;
|
|
2157
|
+
this.rangeChange.emit({ min: undefined, max: undefined });
|
|
2158
|
+
}
|
|
2159
|
+
getContainerStyle() {
|
|
2160
|
+
return {
|
|
2161
|
+
...this.style,
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
getLabelStyle() {
|
|
2165
|
+
return {
|
|
2166
|
+
fontSize: this.theme.typography.fontSize.medium,
|
|
2167
|
+
color: this.theme.colors.text,
|
|
2168
|
+
fontWeight: this.theme.typography.fontWeight?.medium || 500,
|
|
2169
|
+
marginBottom: this.theme.spacing.small,
|
|
2170
|
+
display: 'block',
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
getInputGroupStyle() {
|
|
2174
|
+
return {
|
|
2175
|
+
display: 'flex',
|
|
2176
|
+
alignItems: 'center',
|
|
2177
|
+
gap: this.theme.spacing.small,
|
|
2178
|
+
flexWrap: 'wrap',
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
getInputStyle() {
|
|
2182
|
+
const borderRadius = typeof this.theme.borderRadius === 'string'
|
|
2183
|
+
? this.theme.borderRadius
|
|
2184
|
+
: this.theme.borderRadius.medium;
|
|
2185
|
+
return {
|
|
2186
|
+
padding: this.theme.spacing.small,
|
|
2187
|
+
fontSize: this.theme.typography.fontSize.medium,
|
|
2188
|
+
border: `1px solid ${this.theme.colors.border}`,
|
|
2189
|
+
borderRadius,
|
|
2190
|
+
backgroundColor: this.theme.colors.background,
|
|
2191
|
+
color: this.theme.colors.text,
|
|
2192
|
+
outline: 'none',
|
|
2193
|
+
flex: 1,
|
|
2194
|
+
minWidth: '80px',
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
getSeparatorStyle() {
|
|
2198
|
+
return {
|
|
2199
|
+
color: this.theme.colors.textSecondary || this.theme.colors.text,
|
|
2200
|
+
fontSize: this.theme.typography.fontSize.medium,
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
getApplyButtonStyle() {
|
|
2204
|
+
const borderRadius = typeof this.theme.borderRadius === 'string'
|
|
2205
|
+
? this.theme.borderRadius
|
|
2206
|
+
: this.theme.borderRadius.medium;
|
|
2207
|
+
return {
|
|
2208
|
+
padding: `${this.theme.spacing.small} ${this.theme.spacing.medium}`,
|
|
2209
|
+
fontSize: this.theme.typography.fontSize.medium,
|
|
2210
|
+
backgroundColor: this.theme.colors.primary,
|
|
2211
|
+
color: '#ffffff',
|
|
2212
|
+
border: 'none',
|
|
2213
|
+
borderRadius,
|
|
2214
|
+
cursor: 'pointer',
|
|
2215
|
+
transition: this.theme.transitions?.fast || '150ms ease-in-out',
|
|
2216
|
+
};
|
|
2217
|
+
}
|
|
2218
|
+
getResetButtonStyle() {
|
|
2219
|
+
const borderRadius = typeof this.theme.borderRadius === 'string'
|
|
2220
|
+
? this.theme.borderRadius
|
|
2221
|
+
: this.theme.borderRadius.medium;
|
|
2222
|
+
return {
|
|
2223
|
+
padding: `${this.theme.spacing.small} ${this.theme.spacing.medium}`,
|
|
2224
|
+
fontSize: this.theme.typography.fontSize.medium,
|
|
2225
|
+
backgroundColor: 'transparent',
|
|
2226
|
+
color: this.theme.colors.text,
|
|
2227
|
+
border: `1px solid ${this.theme.colors.border}`,
|
|
2228
|
+
borderRadius,
|
|
2229
|
+
cursor: 'pointer',
|
|
2230
|
+
transition: this.theme.transitions?.fast || '150ms ease-in-out',
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
__setFunctionName(_classThis, "RangeInputComponent");
|
|
2235
|
+
(() => {
|
|
2236
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2237
|
+
_field_decorators = [Input()];
|
|
2238
|
+
_label_decorators = [Input()];
|
|
2239
|
+
_min_decorators = [Input()];
|
|
2240
|
+
_max_decorators = [Input()];
|
|
2241
|
+
_step_decorators = [Input()];
|
|
2242
|
+
_currentMin_decorators = [Input()];
|
|
2243
|
+
_currentMax_decorators = [Input()];
|
|
2244
|
+
_showApplyButton_decorators = [Input()];
|
|
2245
|
+
_placeholder_decorators = [Input()];
|
|
2246
|
+
_className_decorators = [Input()];
|
|
2247
|
+
_style_decorators = [Input()];
|
|
2248
|
+
_rangeChange_decorators = [Output()];
|
|
2249
|
+
__esDecorate(null, null, _field_decorators, { kind: "field", name: "field", static: false, private: false, access: { has: obj => "field" in obj, get: obj => obj.field, set: (obj, value) => { obj.field = value; } }, metadata: _metadata }, _field_initializers, _field_extraInitializers);
|
|
2250
|
+
__esDecorate(null, null, _label_decorators, { kind: "field", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
2251
|
+
__esDecorate(null, null, _min_decorators, { kind: "field", name: "min", static: false, private: false, access: { has: obj => "min" in obj, get: obj => obj.min, set: (obj, value) => { obj.min = value; } }, metadata: _metadata }, _min_initializers, _min_extraInitializers);
|
|
2252
|
+
__esDecorate(null, null, _max_decorators, { kind: "field", name: "max", static: false, private: false, access: { has: obj => "max" in obj, get: obj => obj.max, set: (obj, value) => { obj.max = value; } }, metadata: _metadata }, _max_initializers, _max_extraInitializers);
|
|
2253
|
+
__esDecorate(null, null, _step_decorators, { kind: "field", name: "step", static: false, private: false, access: { has: obj => "step" in obj, get: obj => obj.step, set: (obj, value) => { obj.step = value; } }, metadata: _metadata }, _step_initializers, _step_extraInitializers);
|
|
2254
|
+
__esDecorate(null, null, _currentMin_decorators, { kind: "field", name: "currentMin", static: false, private: false, access: { has: obj => "currentMin" in obj, get: obj => obj.currentMin, set: (obj, value) => { obj.currentMin = value; } }, metadata: _metadata }, _currentMin_initializers, _currentMin_extraInitializers);
|
|
2255
|
+
__esDecorate(null, null, _currentMax_decorators, { kind: "field", name: "currentMax", static: false, private: false, access: { has: obj => "currentMax" in obj, get: obj => obj.currentMax, set: (obj, value) => { obj.currentMax = value; } }, metadata: _metadata }, _currentMax_initializers, _currentMax_extraInitializers);
|
|
2256
|
+
__esDecorate(null, null, _showApplyButton_decorators, { kind: "field", name: "showApplyButton", static: false, private: false, access: { has: obj => "showApplyButton" in obj, get: obj => obj.showApplyButton, set: (obj, value) => { obj.showApplyButton = value; } }, metadata: _metadata }, _showApplyButton_initializers, _showApplyButton_extraInitializers);
|
|
2257
|
+
__esDecorate(null, null, _placeholder_decorators, { kind: "field", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
2258
|
+
__esDecorate(null, null, _className_decorators, { kind: "field", name: "className", static: false, private: false, access: { has: obj => "className" in obj, get: obj => obj.className, set: (obj, value) => { obj.className = value; } }, metadata: _metadata }, _className_initializers, _className_extraInitializers);
|
|
2259
|
+
__esDecorate(null, null, _style_decorators, { kind: "field", name: "style", static: false, private: false, access: { has: obj => "style" in obj, get: obj => obj.style, set: (obj, value) => { obj.style = value; } }, metadata: _metadata }, _style_initializers, _style_extraInitializers);
|
|
2260
|
+
__esDecorate(null, null, _rangeChange_decorators, { kind: "field", name: "rangeChange", static: false, private: false, access: { has: obj => "rangeChange" in obj, get: obj => obj.rangeChange, set: (obj, value) => { obj.rangeChange = value; } }, metadata: _metadata }, _rangeChange_initializers, _rangeChange_extraInitializers);
|
|
2261
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2262
|
+
_classThis = _classDescriptor.value;
|
|
2263
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2264
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2265
|
+
})();
|
|
2266
|
+
return _classThis;
|
|
2267
|
+
})();
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* SearchLayout Component
|
|
2271
|
+
*
|
|
2272
|
+
* Provides a layout structure for search interfaces with sidebar and main content
|
|
2273
|
+
*/
|
|
2274
|
+
let SearchLayoutComponent = (() => {
|
|
2275
|
+
let _classDecorators = [Component({
|
|
2276
|
+
selector: 'seekora-search-layout',
|
|
2277
|
+
template: `
|
|
2278
|
+
<div [style]="getContainerStyle()">
|
|
2279
|
+
<header
|
|
2280
|
+
*ngIf="header || headerTemplate"
|
|
2281
|
+
[style]="getHeaderStyle()"
|
|
2282
|
+
>
|
|
2283
|
+
<ng-container *ngTemplateOutlet="headerTemplate || defaultHeaderTemplate"></ng-container>
|
|
2284
|
+
<ng-template #defaultHeaderTemplate>
|
|
2285
|
+
<ng-content select="[header]"></ng-content>
|
|
2286
|
+
</ng-template>
|
|
2287
|
+
</header>
|
|
2288
|
+
|
|
2289
|
+
<div [style]="getContentStyle()">
|
|
2290
|
+
<aside
|
|
2291
|
+
*ngIf="sidebar || sidebarTemplate"
|
|
2292
|
+
[style]="getSidebarStyle()"
|
|
2293
|
+
[class]="getSidebarClass()"
|
|
2294
|
+
>
|
|
2295
|
+
<ng-container *ngTemplateOutlet="sidebarTemplate || defaultSidebarTemplate"></ng-container>
|
|
2296
|
+
<ng-template #defaultSidebarTemplate>
|
|
2297
|
+
<ng-content select="[sidebar]"></ng-content>
|
|
2298
|
+
</ng-template>
|
|
2299
|
+
</aside>
|
|
2300
|
+
|
|
2301
|
+
<main [style]="getMainStyle()">
|
|
2302
|
+
<ng-content></ng-content>
|
|
2303
|
+
</main>
|
|
2304
|
+
</div>
|
|
2305
|
+
|
|
2306
|
+
<footer
|
|
2307
|
+
*ngIf="footer || footerTemplate"
|
|
2308
|
+
[style]="getFooterStyle()"
|
|
2309
|
+
>
|
|
2310
|
+
<ng-container *ngTemplateOutlet="footerTemplate || defaultFooterTemplate"></ng-container>
|
|
2311
|
+
<ng-template #defaultFooterTemplate>
|
|
2312
|
+
<ng-content select="[footer]"></ng-content>
|
|
2313
|
+
</ng-template>
|
|
2314
|
+
</footer>
|
|
2315
|
+
</div>
|
|
2316
|
+
`,
|
|
2317
|
+
styles: [`
|
|
2318
|
+
@media (max-width: 768px) {
|
|
2319
|
+
.search-layout-sidebar-hidden-mobile {
|
|
2320
|
+
display: none;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
`]
|
|
2324
|
+
})];
|
|
2325
|
+
let _classDescriptor;
|
|
2326
|
+
let _classExtraInitializers = [];
|
|
2327
|
+
let _classThis;
|
|
2328
|
+
let _sidebar_decorators;
|
|
2329
|
+
let _sidebar_initializers = [];
|
|
2330
|
+
let _sidebar_extraInitializers = [];
|
|
2331
|
+
let _header_decorators;
|
|
2332
|
+
let _header_initializers = [];
|
|
2333
|
+
let _header_extraInitializers = [];
|
|
2334
|
+
let _footer_decorators;
|
|
2335
|
+
let _footer_initializers = [];
|
|
2336
|
+
let _footer_extraInitializers = [];
|
|
2337
|
+
let _sidebarWidth_decorators;
|
|
2338
|
+
let _sidebarWidth_initializers = [];
|
|
2339
|
+
let _sidebarWidth_extraInitializers = [];
|
|
2340
|
+
let _showSidebarOnMobile_decorators;
|
|
2341
|
+
let _showSidebarOnMobile_initializers = [];
|
|
2342
|
+
let _showSidebarOnMobile_extraInitializers = [];
|
|
2343
|
+
let _className_decorators;
|
|
2344
|
+
let _className_initializers = [];
|
|
2345
|
+
let _className_extraInitializers = [];
|
|
2346
|
+
let _style_decorators;
|
|
2347
|
+
let _style_initializers = [];
|
|
2348
|
+
let _style_extraInitializers = [];
|
|
2349
|
+
let _headerTemplate_decorators;
|
|
2350
|
+
let _headerTemplate_initializers = [];
|
|
2351
|
+
let _headerTemplate_extraInitializers = [];
|
|
2352
|
+
let _sidebarTemplate_decorators;
|
|
2353
|
+
let _sidebarTemplate_initializers = [];
|
|
2354
|
+
let _sidebarTemplate_extraInitializers = [];
|
|
2355
|
+
let _footerTemplate_decorators;
|
|
2356
|
+
let _footerTemplate_initializers = [];
|
|
2357
|
+
let _footerTemplate_extraInitializers = [];
|
|
2358
|
+
_classThis = class {
|
|
2359
|
+
constructor(searchContext) {
|
|
2360
|
+
this.searchContext = searchContext;
|
|
2361
|
+
this.sidebar = __runInitializers(this, _sidebar_initializers, void 0);
|
|
2362
|
+
this.header = (__runInitializers(this, _sidebar_extraInitializers), __runInitializers(this, _header_initializers, void 0));
|
|
2363
|
+
this.footer = (__runInitializers(this, _header_extraInitializers), __runInitializers(this, _footer_initializers, void 0));
|
|
2364
|
+
this.sidebarWidth = (__runInitializers(this, _footer_extraInitializers), __runInitializers(this, _sidebarWidth_initializers, '300px'));
|
|
2365
|
+
this.showSidebarOnMobile = (__runInitializers(this, _sidebarWidth_extraInitializers), __runInitializers(this, _showSidebarOnMobile_initializers, false));
|
|
2366
|
+
this.className = (__runInitializers(this, _showSidebarOnMobile_extraInitializers), __runInitializers(this, _className_initializers, void 0));
|
|
2367
|
+
this.style = (__runInitializers(this, _className_extraInitializers), __runInitializers(this, _style_initializers, void 0));
|
|
2368
|
+
this.headerTemplate = (__runInitializers(this, _style_extraInitializers), __runInitializers(this, _headerTemplate_initializers, void 0));
|
|
2369
|
+
this.sidebarTemplate = (__runInitializers(this, _headerTemplate_extraInitializers), __runInitializers(this, _sidebarTemplate_initializers, void 0));
|
|
2370
|
+
this.footerTemplate = (__runInitializers(this, _sidebarTemplate_extraInitializers), __runInitializers(this, _footerTemplate_initializers, void 0));
|
|
2371
|
+
__runInitializers(this, _footerTemplate_extraInitializers);
|
|
2372
|
+
this.searchContext = searchContext;
|
|
2373
|
+
}
|
|
2374
|
+
get theme() {
|
|
2375
|
+
return this.searchContext.theme;
|
|
2376
|
+
}
|
|
2377
|
+
getContainerStyle() {
|
|
2378
|
+
return {
|
|
2379
|
+
display: 'flex',
|
|
2380
|
+
flexDirection: 'column',
|
|
2381
|
+
minHeight: '100vh',
|
|
2382
|
+
backgroundColor: this.theme.colors.background,
|
|
2383
|
+
...this.style,
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2386
|
+
getHeaderStyle() {
|
|
2387
|
+
return {
|
|
2388
|
+
padding: this.theme.spacing.medium,
|
|
2389
|
+
borderBottom: `1px solid ${this.theme.colors.border}`,
|
|
2390
|
+
backgroundColor: this.theme.colors.background,
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
getContentStyle() {
|
|
2394
|
+
return {
|
|
2395
|
+
display: 'flex',
|
|
2396
|
+
flex: 1,
|
|
2397
|
+
gap: this.theme.spacing.large,
|
|
2398
|
+
padding: this.theme.spacing.medium,
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
getSidebarStyle() {
|
|
2402
|
+
return {
|
|
2403
|
+
width: this.sidebarWidth,
|
|
2404
|
+
minWidth: this.sidebarWidth,
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
getSidebarClass() {
|
|
2408
|
+
return this.showSidebarOnMobile ? '' : 'search-layout-sidebar-hidden-mobile';
|
|
2409
|
+
}
|
|
2410
|
+
getMainStyle() {
|
|
2411
|
+
return {
|
|
2412
|
+
flex: 1,
|
|
2413
|
+
minWidth: 0,
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
getFooterStyle() {
|
|
2417
|
+
return {
|
|
2418
|
+
padding: this.theme.spacing.medium,
|
|
2419
|
+
borderTop: `1px solid ${this.theme.colors.border}`,
|
|
2420
|
+
backgroundColor: this.theme.colors.background,
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
__setFunctionName(_classThis, "SearchLayoutComponent");
|
|
2425
|
+
(() => {
|
|
2426
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2427
|
+
_sidebar_decorators = [Input()];
|
|
2428
|
+
_header_decorators = [Input()];
|
|
2429
|
+
_footer_decorators = [Input()];
|
|
2430
|
+
_sidebarWidth_decorators = [Input()];
|
|
2431
|
+
_showSidebarOnMobile_decorators = [Input()];
|
|
2432
|
+
_className_decorators = [Input()];
|
|
2433
|
+
_style_decorators = [Input()];
|
|
2434
|
+
_headerTemplate_decorators = [ContentChild('headerTemplate')];
|
|
2435
|
+
_sidebarTemplate_decorators = [ContentChild('sidebarTemplate')];
|
|
2436
|
+
_footerTemplate_decorators = [ContentChild('footerTemplate')];
|
|
2437
|
+
__esDecorate(null, null, _sidebar_decorators, { kind: "field", name: "sidebar", static: false, private: false, access: { has: obj => "sidebar" in obj, get: obj => obj.sidebar, set: (obj, value) => { obj.sidebar = value; } }, metadata: _metadata }, _sidebar_initializers, _sidebar_extraInitializers);
|
|
2438
|
+
__esDecorate(null, null, _header_decorators, { kind: "field", name: "header", static: false, private: false, access: { has: obj => "header" in obj, get: obj => obj.header, set: (obj, value) => { obj.header = value; } }, metadata: _metadata }, _header_initializers, _header_extraInitializers);
|
|
2439
|
+
__esDecorate(null, null, _footer_decorators, { kind: "field", name: "footer", static: false, private: false, access: { has: obj => "footer" in obj, get: obj => obj.footer, set: (obj, value) => { obj.footer = value; } }, metadata: _metadata }, _footer_initializers, _footer_extraInitializers);
|
|
2440
|
+
__esDecorate(null, null, _sidebarWidth_decorators, { kind: "field", name: "sidebarWidth", static: false, private: false, access: { has: obj => "sidebarWidth" in obj, get: obj => obj.sidebarWidth, set: (obj, value) => { obj.sidebarWidth = value; } }, metadata: _metadata }, _sidebarWidth_initializers, _sidebarWidth_extraInitializers);
|
|
2441
|
+
__esDecorate(null, null, _showSidebarOnMobile_decorators, { kind: "field", name: "showSidebarOnMobile", static: false, private: false, access: { has: obj => "showSidebarOnMobile" in obj, get: obj => obj.showSidebarOnMobile, set: (obj, value) => { obj.showSidebarOnMobile = value; } }, metadata: _metadata }, _showSidebarOnMobile_initializers, _showSidebarOnMobile_extraInitializers);
|
|
2442
|
+
__esDecorate(null, null, _className_decorators, { kind: "field", name: "className", static: false, private: false, access: { has: obj => "className" in obj, get: obj => obj.className, set: (obj, value) => { obj.className = value; } }, metadata: _metadata }, _className_initializers, _className_extraInitializers);
|
|
2443
|
+
__esDecorate(null, null, _style_decorators, { kind: "field", name: "style", static: false, private: false, access: { has: obj => "style" in obj, get: obj => obj.style, set: (obj, value) => { obj.style = value; } }, metadata: _metadata }, _style_initializers, _style_extraInitializers);
|
|
2444
|
+
__esDecorate(null, null, _headerTemplate_decorators, { kind: "field", name: "headerTemplate", static: false, private: false, access: { has: obj => "headerTemplate" in obj, get: obj => obj.headerTemplate, set: (obj, value) => { obj.headerTemplate = value; } }, metadata: _metadata }, _headerTemplate_initializers, _headerTemplate_extraInitializers);
|
|
2445
|
+
__esDecorate(null, null, _sidebarTemplate_decorators, { kind: "field", name: "sidebarTemplate", static: false, private: false, access: { has: obj => "sidebarTemplate" in obj, get: obj => obj.sidebarTemplate, set: (obj, value) => { obj.sidebarTemplate = value; } }, metadata: _metadata }, _sidebarTemplate_initializers, _sidebarTemplate_extraInitializers);
|
|
2446
|
+
__esDecorate(null, null, _footerTemplate_decorators, { kind: "field", name: "footerTemplate", static: false, private: false, access: { has: obj => "footerTemplate" in obj, get: obj => obj.footerTemplate, set: (obj, value) => { obj.footerTemplate = value; } }, metadata: _metadata }, _footerTemplate_initializers, _footerTemplate_extraInitializers);
|
|
2447
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2448
|
+
_classThis = _classDescriptor.value;
|
|
2449
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2450
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2451
|
+
})();
|
|
2452
|
+
return _classThis;
|
|
2453
|
+
})();
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Dark Theme
|
|
2457
|
+
*/
|
|
2458
|
+
const darkTheme = {
|
|
2459
|
+
colors: {
|
|
2460
|
+
primary: '#0d6efd',
|
|
2461
|
+
secondary: '#6c757d',
|
|
2462
|
+
background: '#1a1a1a',
|
|
2463
|
+
text: '#ffffff',
|
|
2464
|
+
border: '#333333',
|
|
2465
|
+
hover: '#2a2a2a',
|
|
2466
|
+
focus: '#0d6efd',
|
|
2467
|
+
error: '#dc3545',
|
|
2468
|
+
},
|
|
2469
|
+
typography: {
|
|
2470
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
2471
|
+
fontSize: {
|
|
2472
|
+
small: '0.875rem',
|
|
2473
|
+
medium: '1rem',
|
|
2474
|
+
large: '1.25rem',
|
|
2475
|
+
},
|
|
2476
|
+
},
|
|
2477
|
+
spacing: {
|
|
2478
|
+
small: '0.5rem',
|
|
2479
|
+
medium: '1rem',
|
|
2480
|
+
large: '1.5rem',
|
|
2481
|
+
},
|
|
2482
|
+
borderRadius: '0.25rem',
|
|
2483
|
+
shadows: {
|
|
2484
|
+
small: '0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7)',
|
|
2485
|
+
medium: '0 3px 6px rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.8)',
|
|
2486
|
+
large: '0 10px 20px rgba(0, 0, 0, 0.7), 0 6px 6px rgba(0, 0, 0, 0.9)',
|
|
2487
|
+
},
|
|
2488
|
+
};
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* Minimal Theme
|
|
2492
|
+
*/
|
|
2493
|
+
const minimalTheme = {
|
|
2494
|
+
colors: {
|
|
2495
|
+
primary: '#000000',
|
|
2496
|
+
secondary: '#666666',
|
|
2497
|
+
background: '#ffffff',
|
|
2498
|
+
text: '#000000',
|
|
2499
|
+
border: '#e0e0e0',
|
|
2500
|
+
hover: '#f5f5f5',
|
|
2501
|
+
focus: '#000000',
|
|
2502
|
+
error: '#cc0000',
|
|
2503
|
+
},
|
|
2504
|
+
typography: {
|
|
2505
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
2506
|
+
fontSize: {
|
|
2507
|
+
small: '0.875rem',
|
|
2508
|
+
medium: '1rem',
|
|
2509
|
+
large: '1.125rem',
|
|
2510
|
+
},
|
|
2511
|
+
},
|
|
2512
|
+
spacing: {
|
|
2513
|
+
small: '0.5rem',
|
|
2514
|
+
medium: '0.75rem',
|
|
2515
|
+
large: '1rem',
|
|
2516
|
+
},
|
|
2517
|
+
borderRadius: '0',
|
|
2518
|
+
shadows: {
|
|
2519
|
+
small: 'none',
|
|
2520
|
+
medium: 'none',
|
|
2521
|
+
large: 'none',
|
|
2522
|
+
},
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2525
|
+
export { CurrentRefinementsComponent, FacetsComponent, PaginationComponent, QuerySuggestionsComponent, QuerySuggestionsService, RangeInputComponent, SEEKORA_CLIENT, SEEKORA_THEME_CONFIG, SearchBarComponent, SearchContextService, SearchLayoutComponent, SearchProviderComponent, SearchResultsComponent, SeekoraSearchService, SortByComponent, StatsComponent, createTheme, darkTheme, defaultTheme, minimalTheme };
|
|
2526
|
+
//# sourceMappingURL=index.esm.js.map
|