@zambon-dev/library 1.3.2 → 1.4.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.
@@ -12,12 +12,15 @@ export declare class SidebarItemComponent extends BaseComponent implements OnIni
12
12
  protected isSelected: boolean;
13
13
  private _childHeight;
14
14
  private changeDetectorRef;
15
+ private sidebarConfigs;
15
16
  private sidebarService;
16
17
  get childHeight(): number;
17
18
  protected get areChildrenLoaded(): boolean;
19
+ protected get externalLinkText(): string;
18
20
  protected get isActive(): boolean;
19
21
  protected get isCollapsed(): boolean;
20
22
  protected get isParent(): boolean;
23
+ protected get opensInNewBrowserTab(): boolean;
21
24
  protected get hasIcon(): boolean;
22
25
  constructor();
23
26
  ngAfterViewInit(): void;
@@ -1,4 +1,5 @@
1
1
  export * from './sidebar-configs';
2
2
  export * from './sidebar-menu';
3
+ export * from './sidebar-menu-open-mode';
3
4
  export * from './sidebar-profile';
4
5
  export * from './sidebar-region';
@@ -2,6 +2,8 @@ import { InjectionToken } from '@angular/core';
2
2
  export declare const SIDEBAR_CONFIGS: InjectionToken<SidebarConfigs>;
3
3
  export declare class SidebarConfigs {
4
4
  errorText: string;
5
+ /** Tooltip for items that open in a new browser tab. Rendered as-is, like {@link errorText}. */
6
+ externalLinkText: string;
5
7
  loadingText: string;
6
8
  logoCollapsedPath?: string;
7
9
  logoExpandedPath?: string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * How a {@link SidebarMenu}'s `url` is opened when the item is clicked.
3
+ *
4
+ * Read the value off a menu through {@link toSidebarMenuOpenMode} rather than comparing the
5
+ * field directly: it crosses HTTP, so it can arrive as a string, as a number, as `null`, or not
6
+ * at all.
7
+ */
8
+ export declare enum SidebarMenuOpenMode {
9
+ /** `url` is an internal Angular route and opens an application tab. The default. */
10
+ Internal = "internal",
11
+ /** `url` is an absolute http(s) address and opens in a new browser tab. */
12
+ ExternalNewTab = "externalNewTab",
13
+ /** `url` is an absolute http(s) address and opens embedded in an application tab. */
14
+ ExternalEmbedded = "externalEmbedded"
15
+ }
16
+ /**
17
+ * Parses the wire value of `SidebarMenu.openMode`.
18
+ *
19
+ * Deliberately a parser rather than a `?? Internal` fallback, because the field is deserialized
20
+ * straight from each application's menu endpoint and its shape is not guaranteed:
21
+ *
22
+ * - a **number** is read as the backend's enum ordinal, which is what an ASP.NET Core enum
23
+ * property serializes to unless that backend registers a string converter;
24
+ * - a **string** is matched case-insensitively, so `'externalNewTab'` and `'ExternalNewTab'`
25
+ * both work;
26
+ * - anything else — an omitted field from a backend that predates this feature, `null`, or a
27
+ * mode introduced by a newer one — degrades to {@link SidebarMenuOpenMode.Internal}.
28
+ *
29
+ * Degrading to `Internal` keeps an unrecognized mode behaving the way menus behaved before
30
+ * external destinations existed, instead of producing an item that does nothing when clicked.
31
+ */
32
+ export declare function toSidebarMenuOpenMode(value: unknown): SidebarMenuOpenMode;
@@ -1,3 +1,4 @@
1
+ import { SidebarMenuOpenMode } from './sidebar-menu-open-mode';
1
2
  export declare class SidebarMenu {
2
3
  childCount: number;
3
4
  children: SidebarMenu[];
@@ -6,6 +7,14 @@ export declare class SidebarMenu {
6
7
  id: number;
7
8
  label: string;
8
9
  isSelected: boolean;
10
+ /**
11
+ * How {@link url} is opened. An absent value means {@link SidebarMenuOpenMode.Internal}.
12
+ *
13
+ * Left optional and without an initializer on purpose: the constructor is an `Object.assign`,
14
+ * which would overwrite a default with the `null` a nullable backend column serializes to.
15
+ * Read it through `toSidebarMenuOpenMode(menu.openMode)` instead of comparing it directly.
16
+ */
17
+ openMode?: SidebarMenuOpenMode;
9
18
  parent: SidebarMenu | null;
10
19
  region?: string;
11
20
  url?: string;
@@ -6,6 +6,7 @@ export declare abstract class SidebarService {
6
6
  childrenFailed: EventEmitter<SidebarMenu>;
7
7
  childrenLoading: EventEmitter<SidebarMenu>;
8
8
  childrenInitialized: EventEmitter<SidebarMenu>;
9
+ menuExternalUrlSelected: EventEmitter<SidebarMenu>;
9
10
  menuUrlSelected: EventEmitter<SidebarMenu>;
10
11
  selectionChanged: EventEmitter<SidebarMenu>;
11
12
  isActive: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zambon-dev/library",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Angular UI components and shared presentation utilities for Zambon applications.",
5
5
  "keywords": [
6
6
  "angular",