@sinequa/atomic-angular 1.0.13 → 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.
@@ -1631,18 +1631,21 @@ async function withBootstrapApp(applicationService, { createRoutes = true }) {
1631
1631
  return new Promise(resolve => {
1632
1632
  // Check if the user is authenticated
1633
1633
  signIn()
1634
- .then((response) => {
1634
+ .then(async (response) => {
1635
1635
  if (response) {
1636
1636
  info('User authenticated, initializing application...');
1637
- // Initialize the application
1638
- applicationService
1639
- .initialize(createRoutes)
1640
- .then(() => {
1637
+ // Initialize the application.
1638
+ // Awaited so the APP_INITIALIZER does not resolve (and bootstrap does not
1639
+ // complete) until initialization is done. Otherwise routed components render
1640
+ // and set their page title before `initialize()` runs `setGeneralApp()`, which
1641
+ // would then overwrite the page title with the bare application name.
1642
+ try {
1643
+ await applicationService.initialize(createRoutes);
1641
1644
  info(`Application initialized with routes: ${createRoutes} successfully.`);
1642
- })
1643
- .catch(err => {
1645
+ }
1646
+ catch (err) {
1644
1647
  error(`Error initializing application with routes: ${createRoutes}:`, err);
1645
- });
1648
+ }
1646
1649
  }
1647
1650
  else {
1648
1651
  info('User not authenticated, skipping application initialization.');
@@ -3730,10 +3733,10 @@ class ApplicationService {
3730
3733
  // If general is not defined or is an empty object, do nothing
3731
3734
  if (!general || (typeof general === "object" && Object.keys(general).length === 0))
3732
3735
  return;
3733
- if (general.name) {
3734
- info("Setting document title to:", general.name);
3735
- this.titleService.setTitle(general.name);
3736
- }
3736
+ // NB: the document title is intentionally NOT set here. The page-specific title is
3737
+ // owned by the routed components/layouts via `setTitle()`. Setting it here would
3738
+ // overwrite the page title with the bare application name during bootstrap.
3739
+ // The initial title falls back to the static <title> defined in index.html.
3737
3740
  const { light, dark, alt } = general.logo || {};
3738
3741
  document.documentElement.style.setProperty("--logo-alt-text", `'${alt || general.name}'`);
3739
3742
  // light mode logo configuration
@@ -7213,6 +7216,7 @@ class NavbarTabsComponent {
7213
7216
  class = input(...(ngDevMode ? [undefined, { debugName: "class" }] : []));
7214
7217
  router = inject(Router);
7215
7218
  route = inject(ActivatedRoute);
7219
+ appStore = inject(AppStore);
7216
7220
  queryParamsStore = inject(QueryParamsStore);
7217
7221
  // Injecting the QueryService to access last search results
7218
7222
  queryService = inject(QueryService);
@@ -7280,6 +7284,37 @@ class NavbarTabsComponent {
7280
7284
  }, ...(ngDevMode ? [{ debugName: "tabs" }] : []));
7281
7285
  moreTabs = computed(() => this.tabs().slice(this.visibleTabCount()), ...(ngDevMode ? [{ debugName: "moreTabs" }] : []));
7282
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
+ }
7283
7318
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NavbarTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7284
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: `
7285
7320
  <!-- do not display the tabs if there are no tabs -->
@@ -7299,9 +7334,10 @@ class NavbarTabsComponent {
7299
7334
  [attr.disabled]="showCount() && tab.count === 0 ? '' : null"
7300
7335
  [active]="this.currentPath() === tab.path"
7301
7336
  [routerLink]="[tab.routerLink]"
7302
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7337
+ [queryParams]="getQueryParams(tab)"
7338
+ [queryParamsHandling]="getQueryParamsHandling()"
7303
7339
  (click)="changeTab()"
7304
- (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() })"
7305
7341
  >
7306
7342
  <div [class]="cn('flex items-center content-start w-full gap-1', !noTruncate() && 'overflow-hidden min-w-0')">
7307
7343
  @if (tab.icon) {
@@ -7335,7 +7371,8 @@ class NavbarTabsComponent {
7335
7371
  <a
7336
7372
  class="inline-block whitespace-nowrap first-letter:capitalize"
7337
7373
  [routerLink]="[tab.routerLink]"
7338
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7374
+ [queryParams]="getQueryParams(tab)"
7375
+ [queryParamsHandling]="getQueryParamsHandling()"
7339
7376
  [attr.aria-selected]="this.currentPath() === tab.path"
7340
7377
  [attr.aria-label]="tab.display | syslang | transloco"
7341
7378
  (click)="changeTab()">
@@ -7393,9 +7430,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
7393
7430
  [attr.disabled]="showCount() && tab.count === 0 ? '' : null"
7394
7431
  [active]="this.currentPath() === tab.path"
7395
7432
  [routerLink]="[tab.routerLink]"
7396
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7433
+ [queryParams]="getQueryParams(tab)"
7434
+ [queryParamsHandling]="getQueryParamsHandling()"
7397
7435
  (click)="changeTab()"
7398
- (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() })"
7399
7437
  >
7400
7438
  <div [class]="cn('flex items-center content-start w-full gap-1', !noTruncate() && 'overflow-hidden min-w-0')">
7401
7439
  @if (tab.icon) {
@@ -7429,7 +7467,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
7429
7467
  <a
7430
7468
  class="inline-block whitespace-nowrap first-letter:capitalize"
7431
7469
  [routerLink]="[tab.routerLink]"
7432
- [queryParams]="{ n: tab.queryName, q: searchText(), t: tab.wsQueryTab, f: undefined, sort: undefined, id: undefined, page: undefined }"
7470
+ [queryParams]="getQueryParams(tab)"
7471
+ [queryParamsHandling]="getQueryParamsHandling()"
7433
7472
  [attr.aria-selected]="this.currentPath() === tab.path"
7434
7473
  [attr.aria-label]="tab.display | syslang | transloco"
7435
7474
  (click)="changeTab()">