@sinequa/atomic-angular 1.0.14 → 1.0.15

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.
@@ -7216,6 +7216,7 @@ class NavbarTabsComponent {
7216
7216
  class = input(...(ngDevMode ? [undefined, { debugName: "class" }] : []));
7217
7217
  router = inject(Router);
7218
7218
  route = inject(ActivatedRoute);
7219
+ appStore = inject(AppStore);
7219
7220
  queryParamsStore = inject(QueryParamsStore);
7220
7221
  // Injecting the QueryService to access last search results
7221
7222
  queryService = inject(QueryService);
@@ -7283,6 +7284,37 @@ class NavbarTabsComponent {
7283
7284
  }, ...(ngDevMode ? [{ debugName: "tabs" }] : []));
7284
7285
  moreTabs = computed(() => this.tabs().slice(this.visibleTabCount()), ...(ngDevMode ? [{ debugName: "moreTabs" }] : []));
7285
7286
  changeTab() { }
7287
+ // Computed signal to get the persistFiltersAcrossTabs value from AppStore
7288
+ persistFiltersAcrossTabs = computed(() => !!this.appStore.general()?.features?.persistFiltersAcrossTabs, ...(ngDevMode ? [{ debugName: "persistFiltersAcrossTabs" }] : []));
7289
+ // Determine how query params are applied on tab change.
7290
+ // - persist: 'merge' so the tab identity params (n/t/q) are updated while
7291
+ // the filter params (f/sort/id/page) already in the URL are kept.
7292
+ // - default: 'replace' so everything is rewritten from scratch.
7293
+ getQueryParamsHandling() {
7294
+ return this.persistFiltersAcrossTabs() ? 'merge' : 'replace';
7295
+ }
7296
+ // Get query params conditionally
7297
+ getQueryParams(tab) {
7298
+ if (this.persistFiltersAcrossTabs()) {
7299
+ // When preserving filters, still update the tab identity params so the
7300
+ // store rebuilds the query for the new tab. 'merge' keeps f/sort/id/page.
7301
+ return {
7302
+ n: tab.queryName,
7303
+ q: this.searchText(),
7304
+ t: tab.wsQueryTab
7305
+ };
7306
+ }
7307
+ // When replacing, explicitly set the filters to undefined to clear them
7308
+ return {
7309
+ n: tab.queryName,
7310
+ q: this.searchText(),
7311
+ t: tab.wsQueryTab,
7312
+ f: undefined,
7313
+ sort: undefined,
7314
+ id: undefined,
7315
+ page: undefined
7316
+ };
7317
+ }
7286
7318
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NavbarTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7287
7319
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: NavbarTabsComponent, isStandalone: true, selector: "navbar-tabs", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, showCount: { classPropertyName: "showCount", publicName: "showCount", isSignal: true, isRequired: false, transformFunction: null }, noTruncate: { classPropertyName: "noTruncate", publicName: "noTruncate", isSignal: true, isRequired: false, transformFunction: null }, minTabWidth: { classPropertyName: "minTabWidth", publicName: "minTabWidth", isSignal: true, isRequired: false, transformFunction: null }, path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "cn('block', class())" } }, ngImport: i0, template: `
7288
7320
  <!-- do not display the tabs if there are no tabs -->
@@ -7302,9 +7334,10 @@ class NavbarTabsComponent {
7302
7334
  [attr.disabled]="showCount() && tab.count === 0 ? '' : null"
7303
7335
  [active]="this.currentPath() === tab.path"
7304
7336
  [routerLink]="[tab.routerLink]"
7305
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7337
+ [queryParams]="getQueryParams(tab)"
7338
+ [queryParamsHandling]="getQueryParamsHandling()"
7306
7339
  (click)="changeTab()"
7307
- (keydown.enter)="router.navigate([tab.routerLink], { queryParams: { n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined } })"
7340
+ (keydown.enter)="router.navigate([tab.routerLink], { queryParams: getQueryParams(tab), queryParamsHandling: getQueryParamsHandling() })"
7308
7341
  >
7309
7342
  <div [class]="cn('flex items-center content-start w-full gap-1', !noTruncate() && 'overflow-hidden min-w-0')">
7310
7343
  @if (tab.icon) {
@@ -7338,7 +7371,8 @@ class NavbarTabsComponent {
7338
7371
  <a
7339
7372
  class="inline-block whitespace-nowrap first-letter:capitalize"
7340
7373
  [routerLink]="[tab.routerLink]"
7341
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7374
+ [queryParams]="getQueryParams(tab)"
7375
+ [queryParamsHandling]="getQueryParamsHandling()"
7342
7376
  [attr.aria-selected]="this.currentPath() === tab.path"
7343
7377
  [attr.aria-label]="tab.display | syslang | transloco"
7344
7378
  (click)="changeTab()">
@@ -7396,9 +7430,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
7396
7430
  [attr.disabled]="showCount() && tab.count === 0 ? '' : null"
7397
7431
  [active]="this.currentPath() === tab.path"
7398
7432
  [routerLink]="[tab.routerLink]"
7399
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7433
+ [queryParams]="getQueryParams(tab)"
7434
+ [queryParamsHandling]="getQueryParamsHandling()"
7400
7435
  (click)="changeTab()"
7401
- (keydown.enter)="router.navigate([tab.routerLink], { queryParams: { n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined } })"
7436
+ (keydown.enter)="router.navigate([tab.routerLink], { queryParams: getQueryParams(tab), queryParamsHandling: getQueryParamsHandling() })"
7402
7437
  >
7403
7438
  <div [class]="cn('flex items-center content-start w-full gap-1', !noTruncate() && 'overflow-hidden min-w-0')">
7404
7439
  @if (tab.icon) {
@@ -7432,7 +7467,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
7432
7467
  <a
7433
7468
  class="inline-block whitespace-nowrap first-letter:capitalize"
7434
7469
  [routerLink]="[tab.routerLink]"
7435
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7470
+ [queryParams]="getQueryParams(tab)"
7471
+ [queryParamsHandling]="getQueryParamsHandling()"
7436
7472
  [attr.aria-selected]="this.currentPath() === tab.path"
7437
7473
  [attr.aria-label]="tab.display | syslang | transloco"
7438
7474
  (click)="changeTab()">