@ah-oh/ao-workspaces-design-system 0.0.48 → 0.0.49

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.
@@ -9,7 +9,7 @@ import { ReactiveFormsModule, NG_VALUE_ACCESSOR, FormsModule, FormControl, Valid
9
9
  import * as phosphorIcons from '@ng-icons/phosphor-icons/regular';
10
10
  import { phosphorLockSimple, phosphorWarning, phosphorCaretDown, phosphorSquare, phosphorCheckSquare, phosphorMinusSquare, phosphorCaretLeft, phosphorCaretRight, phosphorCalendarBlank, phosphorDotsThreeVertical, phosphorPlus, phosphorTrash, phosphorDatabase, phosphorMagnifyingGlass, phosphorFunnel, phosphorArrowsDownUp, phosphorCaretUp, phosphorPencilSimple, phosphorEye, phosphorArrowClockwise, phosphorArrowCounterClockwise, phosphorMinus, phosphorLink, phosphorCodeBlock, phosphorQuotes, phosphorListNumbers, phosphorListBullets, phosphorTextHThree, phosphorTextHTwo, phosphorTextHOne, phosphorCode, phosphorTextStrikethrough, phosphorTextItalic, phosphorTextB, phosphorCheck, phosphorX, phosphorSparkle, phosphorMicrophone, phosphorArrowRight, phosphorBell, phosphorBookOpenText, phosphorTestTube, phosphorPaperPlaneRight, phosphorClockCounterClockwise, phosphorSignOut, phosphorRobot, phosphorPuzzlePiece, phosphorGearSix, phosphorPenNib, phosphorTreeStructure, phosphorSquaresFour } from '@ng-icons/phosphor-icons/regular';
11
11
  import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
12
- import { Subject, debounceTime, BehaviorSubject, map as map$1, catchError, of, tap, takeUntil, firstValueFrom, filter as filter$1, distinctUntilChanged, switchMap, timer, fromEvent } from 'rxjs';
12
+ import { Subject, debounceTime, BehaviorSubject, map as map$1, catchError, of, tap, takeUntil, throttleTime, asyncScheduler, switchMap, firstValueFrom, filter as filter$1, distinctUntilChanged, timer, fromEvent } from 'rxjs';
13
13
  import { Editor } from '@tiptap/core';
14
14
  import Link from '@tiptap/extension-link';
15
15
  import Placeholder from '@tiptap/extension-placeholder';
@@ -21,7 +21,7 @@ import { Product, AccessRole } from '@ah-oh/ao-workspaces-types';
21
21
  import * as i1$1 from '@angular/router';
22
22
  import { NavigationEnd, Router } from '@angular/router';
23
23
  import RecordRTC from 'recordrtc';
24
- import { filter, map, throttleTime } from 'rxjs/operators';
24
+ import { filter, map, throttleTime as throttleTime$1 } from 'rxjs/operators';
25
25
  import { ENTER, COMMA } from '@angular/cdk/keycodes';
26
26
  import { MarkdownComponent } from 'ngx-markdown';
27
27
  import { CdkMenu, CdkMenuItem } from '@angular/cdk/menu';
@@ -5972,7 +5972,7 @@ const ROBIN_SEARCH_APP_NAME = new InjectionToken('ROBIN_SEARCH_APP_NAME', {
5972
5972
  providedIn: 'root',
5973
5973
  factory: () => 'unknown',
5974
5974
  });
5975
- const QUICK_DEBOUNCE_MS = 200;
5975
+ const QUICK_THROTTLE_MS = 200;
5976
5976
  class RobinSearchService {
5977
5977
  http = inject(HttpClient);
5978
5978
  baseUrl = inject(ROBIN_API_BASE_URL);
@@ -5984,8 +5984,12 @@ class RobinSearchService {
5984
5984
  resultGroups = signal([], ...(ngDevMode ? [{ debugName: "resultGroups" }] : /* istanbul ignore next */ []));
5985
5985
  pageSuggestion = signal(null, ...(ngDevMode ? [{ debugName: "pageSuggestion" }] : /* istanbul ignore next */ []));
5986
5986
  aiSuggestions = signal([], ...(ngDevMode ? [{ debugName: "aiSuggestions" }] : /* istanbul ignore next */ []));
5987
- debounceHandle = null;
5988
- requestSeq = 0;
5987
+ quickSearchInput$ = new Subject();
5988
+ constructor() {
5989
+ this.quickSearchInput$
5990
+ .pipe(throttleTime(QUICK_THROTTLE_MS, asyncScheduler, { leading: true, trailing: true }), switchMap(({ query, type }) => this.fetchQuickSearch(query, type)))
5991
+ .subscribe((outcome) => this.applyQuickSearchOutcome(outcome));
5992
+ }
5989
5993
  async loadRecommendedFilters() {
5990
5994
  try {
5991
5995
  const params = new HttpParams().set('appName', this.appName);
@@ -5999,9 +6003,6 @@ class RobinSearchService {
5999
6003
  }
6000
6004
  search(query, type) {
6001
6005
  this.query.set(query);
6002
- if (this.debounceHandle !== null) {
6003
- clearTimeout(this.debounceHandle);
6004
- }
6005
6006
  if (!query.trim()) {
6006
6007
  this.resultGroups.set([]);
6007
6008
  this.pageSuggestion.set(null);
@@ -6011,9 +6012,7 @@ class RobinSearchService {
6011
6012
  return;
6012
6013
  }
6013
6014
  this.loading.set(true);
6014
- this.debounceHandle = setTimeout(() => {
6015
- void this.runQuickSearch(query, type);
6016
- }, QUICK_DEBOUNCE_MS);
6015
+ this.quickSearchInput$.next({ query, type });
6017
6016
  }
6018
6017
  async loadFull(query, type, date) {
6019
6018
  let params = new HttpParams().set('q', query).set('appName', this.appName);
@@ -6041,35 +6040,35 @@ class RobinSearchService {
6041
6040
  this.loading.set(false);
6042
6041
  }
6043
6042
  }
6044
- async runQuickSearch(query, type) {
6045
- const seq = ++this.requestSeq;
6043
+ fetchQuickSearch(query, type) {
6046
6044
  let params = new HttpParams().set('q', query).set('appName', this.appName);
6047
6045
  if (type)
6048
6046
  params = params.set('type', type);
6049
- try {
6050
- const payload = await firstValueFrom(this.http.get(this.url('/search/quick'), { params }));
6051
- if (seq !== this.requestSeq)
6052
- return;
6053
- const safe = payload ?? {};
6054
- this.resultGroups.set(safe.groups ?? []);
6055
- this.pageSuggestion.set(safe.pageSuggestion ?? null);
6056
- this.aiSuggestions.set(safe.aiSuggestions ?? []);
6057
- this.error.set(null);
6058
- }
6059
- catch (err) {
6060
- if (seq !== this.requestSeq)
6061
- return;
6047
+ return this.http
6048
+ .get(this.url('/search/quick'), { params })
6049
+ .pipe(map$1((payload) => ({ query, payload, failed: false })), catchError((err) => {
6062
6050
  console.warn('[RobinSearch] quickSearch failed', err);
6051
+ return of({ query, payload: null, failed: true });
6052
+ }));
6053
+ }
6054
+ applyQuickSearchOutcome(outcome) {
6055
+ if (this.query() !== outcome.query) {
6056
+ return;
6057
+ }
6058
+ if (outcome.failed) {
6063
6059
  this.error.set('Suche fehlgeschlagen');
6064
6060
  this.resultGroups.set([]);
6065
6061
  this.pageSuggestion.set(null);
6066
6062
  this.aiSuggestions.set([]);
6067
6063
  }
6068
- finally {
6069
- if (seq === this.requestSeq) {
6070
- this.loading.set(false);
6071
- }
6064
+ else {
6065
+ const safe = outcome.payload ?? {};
6066
+ this.resultGroups.set(safe.groups ?? []);
6067
+ this.pageSuggestion.set(safe.pageSuggestion ?? null);
6068
+ this.aiSuggestions.set(safe.aiSuggestions ?? []);
6069
+ this.error.set(null);
6072
6070
  }
6071
+ this.loading.set(false);
6073
6072
  }
6074
6073
  url(path) {
6075
6074
  return `${this.baseUrl}${path}`;
@@ -6080,7 +6079,7 @@ class RobinSearchService {
6080
6079
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: RobinSearchService, decorators: [{
6081
6080
  type: Injectable,
6082
6081
  args: [{ providedIn: 'root' }]
6083
- }] });
6082
+ }], ctorParameters: () => [] });
6084
6083
 
6085
6084
  class LogoMenuComponent {
6086
6085
  workspaceNavbarService = inject(WorkspaceNavbarService);
@@ -7185,7 +7184,7 @@ class WorkspaceNavbarComponent {
7185
7184
  ngAfterViewInit() {
7186
7185
  if (isPlatformBrowser(this.platformId)) {
7187
7186
  fromEvent(window, 'scroll', { passive: true })
7188
- .pipe(throttleTime(50), takeUntilDestroyed(this.destroyRef))
7187
+ .pipe(throttleTime$1(50), takeUntilDestroyed(this.destroyRef))
7189
7188
  .subscribe(() => {
7190
7189
  const scrollY = window.scrollY ?? window.pageYOffset ?? 0;
7191
7190
  if (scrollY <= this.scrollThreshold) {