@odx/angular 5.3.4 → 5.5.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/CHANGELOG.md +18 -0
- package/components/footer/README.md +3 -0
- package/components/footer/index.d.ts +3 -0
- package/components/footer/lib/footer.component.d.ts +23 -0
- package/components/footer/lib/footer.config.d.ts +30 -0
- package/components/footer/lib/footer.i18n.d.ts +3 -0
- package/components/footer/lib/helpers/create-footer-links.d.ts +12 -0
- package/components/footer/lib/helpers/index.d.ts +1 -0
- package/components/footer/lib/models/footer-link.d.ts +4 -0
- package/components/footer/lib/models/footer-variant.d.ts +5 -0
- package/components/footer/lib/models/index.d.ts +2 -0
- package/components/header/lib/header.component.d.ts +1 -1
- package/components/header-navigation/README.md +3 -0
- package/components/header-navigation/index.d.ts +3 -0
- package/components/header-navigation/lib/directives/header-navigation-link.directive.d.ts +11 -0
- package/components/header-navigation/lib/directives/index.d.ts +1 -0
- package/components/header-navigation/lib/header-navigation.component.d.ts +8 -0
- package/components/header-navigation/lib/header-navigation.module.d.ts +9 -0
- package/components/main-menu/lib/helpers/create-main-menu-links.d.ts +2 -1
- package/components/main-menu/lib/main-menu.component.d.ts +5 -5
- package/components/main-menu/lib/main-menu.config.d.ts +1 -0
- package/components/notification/README.md +3 -0
- package/components/notification/index.d.ts +7 -0
- package/components/notification/lib/components/index.d.ts +2 -0
- package/components/notification/lib/components/notification-center/notification-center.component.d.ts +19 -0
- package/components/notification/lib/components/notification-item/notification-item.component.d.ts +37 -0
- package/components/notification/lib/directives/index.d.ts +1 -0
- package/components/notification/lib/directives/notification-center.directive.d.ts +69 -0
- package/components/notification/lib/features/index.d.ts +5 -0
- package/components/notification/lib/features/with-browser-notifications.d.ts +17 -0
- package/components/notification/lib/features/with-load-notifications.d.ts +18 -0
- package/components/notification/lib/features/with-notification-transformer.d.ts +26 -0
- package/components/notification/lib/features/with-peristent-notifications.d.ts +63 -0
- package/components/notification/lib/features/with-save-notifications.d.ts +11 -0
- package/components/notification/lib/helpers/get-notifications-by-tag.d.ts +2 -0
- package/components/notification/lib/helpers/index.d.ts +3 -0
- package/components/notification/lib/helpers/sort-notifications.d.ts +3 -0
- package/components/notification/lib/helpers/to-notification-collection.d.ts +3 -0
- package/components/notification/lib/models/index.d.ts +8 -0
- package/components/notification/lib/models/notification-action.d.ts +2 -0
- package/components/notification/lib/models/notification-collection.d.ts +6 -0
- package/components/notification/lib/models/notification-feature.d.ts +5 -0
- package/components/notification/lib/models/notification-options.d.ts +7 -0
- package/components/notification/lib/models/notification-query.d.ts +2 -0
- package/components/notification/lib/models/notification-sort-fn.d.ts +2 -0
- package/components/notification/lib/models/notification.d.ts +6 -0
- package/components/notification/lib/models/notification.ref.d.ts +9 -0
- package/components/notification/lib/notification.config.d.ts +11 -0
- package/components/notification/lib/notification.i18n.d.ts +3 -0
- package/components/notification/lib/notification.logger.d.ts +3 -0
- package/components/notification/lib/notification.service.d.ts +110 -0
- package/components/notification/lib/notification.tokens.d.ts +4 -0
- package/components/notification/lib/services/index.d.ts +1 -0
- package/components/notification/lib/services/notification-center.service.d.ts +69 -0
- package/components/notification/testing/README.md +3 -0
- package/components/notification/testing/index.d.ts +1 -0
- package/components/notification/testing/lib/test-helpers.d.ts +5 -0
- package/components/toast/lib/toast.service.d.ts +30 -2
- package/esm2022/breakpoints/lib/directives/match-breakpoints.directive.mjs +3 -2
- package/esm2022/components/footer/index.mjs +4 -0
- package/esm2022/components/footer/lib/footer.component.mjs +51 -0
- package/esm2022/components/footer/lib/footer.config.mjs +29 -0
- package/esm2022/components/footer/lib/footer.i18n.mjs +19 -0
- package/esm2022/components/footer/lib/helpers/create-footer-links.mjs +25 -0
- package/esm2022/components/footer/lib/helpers/index.mjs +2 -0
- package/esm2022/components/footer/lib/models/footer-link.mjs +2 -0
- package/esm2022/components/footer/lib/models/footer-variant.mjs +5 -0
- package/esm2022/components/footer/lib/models/index.mjs +3 -0
- package/esm2022/components/footer/odx-angular-components-footer.mjs +5 -0
- package/esm2022/components/header/lib/header.component.mjs +3 -3
- package/esm2022/components/header-navigation/index.mjs +4 -0
- package/esm2022/components/header-navigation/lib/directives/header-navigation-link.directive.mjs +37 -0
- package/esm2022/components/header-navigation/lib/directives/index.mjs +2 -0
- package/esm2022/components/header-navigation/lib/header-navigation.component.mjs +28 -0
- package/esm2022/components/header-navigation/lib/header-navigation.module.mjs +19 -0
- package/esm2022/components/header-navigation/odx-angular-components-header-navigation.mjs +5 -0
- package/esm2022/components/main-menu/lib/helpers/create-main-menu-links.mjs +7 -4
- package/esm2022/components/main-menu/lib/main-menu.component.mjs +9 -11
- package/esm2022/components/main-menu/lib/main-menu.config.mjs +1 -1
- package/esm2022/components/notification/index.mjs +8 -0
- package/esm2022/components/notification/lib/components/index.mjs +3 -0
- package/esm2022/components/notification/lib/components/notification-center/notification-center.component.mjs +65 -0
- package/esm2022/components/notification/lib/components/notification-item/notification-item.component.mjs +65 -0
- package/esm2022/components/notification/lib/directives/index.mjs +2 -0
- package/esm2022/components/notification/lib/directives/notification-center.directive.mjs +142 -0
- package/esm2022/components/notification/lib/features/index.mjs +6 -0
- package/esm2022/components/notification/lib/features/with-browser-notifications.mjs +75 -0
- package/esm2022/components/notification/lib/features/with-load-notifications.mjs +45 -0
- package/esm2022/components/notification/lib/features/with-notification-transformer.mjs +34 -0
- package/esm2022/components/notification/lib/features/with-peristent-notifications.mjs +94 -0
- package/esm2022/components/notification/lib/features/with-save-notifications.mjs +45 -0
- package/esm2022/components/notification/lib/helpers/get-notifications-by-tag.mjs +7 -0
- package/esm2022/components/notification/lib/helpers/index.mjs +4 -0
- package/esm2022/components/notification/lib/helpers/sort-notifications.mjs +10 -0
- package/esm2022/components/notification/lib/helpers/to-notification-collection.mjs +9 -0
- package/esm2022/components/notification/lib/models/index.mjs +9 -0
- package/esm2022/components/notification/lib/models/notification-action.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification-collection.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification-feature.mjs +4 -0
- package/esm2022/components/notification/lib/models/notification-options.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification-query.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification-sort-fn.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification.mjs +2 -0
- package/esm2022/components/notification/lib/models/notification.ref.mjs +2 -0
- package/esm2022/components/notification/lib/notification.config.mjs +11 -0
- package/esm2022/components/notification/lib/notification.i18n.mjs +11 -0
- package/esm2022/components/notification/lib/notification.logger.mjs +3 -0
- package/esm2022/components/notification/lib/notification.service.mjs +168 -0
- package/esm2022/components/notification/lib/notification.tokens.mjs +7 -0
- package/esm2022/components/notification/lib/services/index.mjs +2 -0
- package/esm2022/components/notification/lib/services/notification-center.service.mjs +96 -0
- package/esm2022/components/notification/odx-angular-components-notification.mjs +5 -0
- package/esm2022/components/notification/testing/index.mjs +2 -0
- package/esm2022/components/notification/testing/lib/test-helpers.mjs +33 -0
- package/esm2022/components/notification/testing/odx-angular-components-notification-testing.mjs +5 -0
- package/esm2022/components/toast/lib/components/toast-container/toast-container.component.mjs +6 -6
- package/esm2022/components/toast/lib/toast.service.mjs +38 -8
- package/esm2022/utils/lib/helpers/array.mjs +24 -1
- package/esm2022/utils/lib/helpers/build-website-url.mjs +24 -1
- package/fesm2022/odx-angular-breakpoints.mjs +2 -1
- package/fesm2022/odx-angular-breakpoints.mjs.map +1 -1
- package/fesm2022/odx-angular-components-footer.mjs +131 -0
- package/fesm2022/odx-angular-components-footer.mjs.map +1 -0
- package/fesm2022/odx-angular-components-header-navigation.mjs +84 -0
- package/fesm2022/odx-angular-components-header-navigation.mjs.map +1 -0
- package/fesm2022/odx-angular-components-header.mjs +2 -2
- package/fesm2022/odx-angular-components-header.mjs.map +1 -1
- package/fesm2022/odx-angular-components-main-menu.mjs +11 -9
- package/fesm2022/odx-angular-components-main-menu.mjs.map +1 -1
- package/fesm2022/odx-angular-components-notification-testing.mjs +39 -0
- package/fesm2022/odx-angular-components-notification-testing.mjs.map +1 -0
- package/fesm2022/odx-angular-components-notification.mjs +832 -0
- package/fesm2022/odx-angular-components-notification.mjs.map +1 -0
- package/fesm2022/odx-angular-components-toast.mjs +42 -11
- package/fesm2022/odx-angular-components-toast.mjs.map +1 -1
- package/fesm2022/odx-angular-utils.mjs +46 -0
- package/fesm2022/odx-angular-utils.mjs.map +1 -1
- package/package.json +25 -1
- package/utils/lib/helpers/array.d.ts +23 -0
- package/utils/lib/helpers/build-website-url.d.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @odx/angular
|
|
2
2
|
|
|
3
|
+
## 5.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 40bef6d: Added header navigation component
|
|
8
|
+
- b18ae5a: Allow any content in header. The content is projected into it's own area inside the header
|
|
9
|
+
- 49f971d: Add footer component
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6699568: Allow dynamic text content for main menu title, subtitle and copyright
|
|
14
|
+
|
|
15
|
+
## 5.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 4375380: Add notification component and service
|
|
20
|
+
|
|
3
21
|
## 5.3.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DynamicTextContent } from '@odx/angular/cdk/dynamic-view';
|
|
2
|
+
import { trackByIndex } from '@odx/angular/utils';
|
|
3
|
+
import { FooterVariant } from './models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Represents the footer component of an application, dynamically generating links and supporting various styles.
|
|
7
|
+
* This component integrates dynamic and static content for the footer, including a logo, navigational links, and a customizable description.
|
|
8
|
+
*
|
|
9
|
+
* @usage `<odx-footer [description]="dynamicOrStaticContent" [variant]="'light'|'dark'"></odx-footer>`
|
|
10
|
+
*
|
|
11
|
+
* @input
|
|
12
|
+
* - `description` - Accepts dynamic content (observable or static string) for displaying a custom description in the footer.
|
|
13
|
+
* - `variant` - Sets the footer's appearance theme, supporting `light` and `dark` variants as defined by `FooterVariant`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class FooterComponent {
|
|
16
|
+
protected readonly footerLinks$: import("rxjs").Observable<import("./models").FooterLink[]>;
|
|
17
|
+
protected readonly trackByIndex: typeof trackByIndex;
|
|
18
|
+
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
19
|
+
description?: DynamicTextContent | null;
|
|
20
|
+
variant: FooterVariant;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FooterComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "odx-footer", never, { "description": { "alias": "description"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; }, {}, never, ["*", "[odxLink]"], true, never>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MainMenuLinksConfig } from '@odx/angular/components/main-menu';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { FooterLink } from './models';
|
|
4
|
+
export interface FooterLinksConfig extends MainMenuLinksConfig {
|
|
5
|
+
dynamicLinks?: Observable<FooterLink[]>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates configuration tokens for the footer links, providing a structured way to inject and manage footer link configurations.
|
|
9
|
+
* This utility function encapsulates the configuration for footer links, including defaults and the ability to inject custom configurations.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Object} An object containing configuration tokens for footer links:
|
|
12
|
+
* - `FooterLinksConfig`: A token for injecting the footer links configuration.
|
|
13
|
+
* - `FooterLinksDefaultConfig`: A token representing the default configuration values.
|
|
14
|
+
* - `injectFooterLinksConfig`: A function to inject the current footer links configuration.
|
|
15
|
+
* - `provideFooterLinksConfig`: A function to provide a custom configuration for footer links.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // In your module or component
|
|
19
|
+
* @NgModule({
|
|
20
|
+
* providers: [
|
|
21
|
+
* provideFooterLinksConfig({
|
|
22
|
+
* legalNoticeUrl: 'https://www.custom-url/legal-notice',
|
|
23
|
+
* providerIdentificationUrl: 'https://www.custom-url/provider-identification',
|
|
24
|
+
* dynamicLinks: myDynamicLinksObservable
|
|
25
|
+
* })
|
|
26
|
+
* ]
|
|
27
|
+
* })
|
|
28
|
+
* export class MyModule {}
|
|
29
|
+
*/
|
|
30
|
+
export declare const FooterLinksConfig: import("@angular/core").InjectionToken<Partial<FooterLinksConfig>>, FooterLinksDefaultConfig: FooterLinksConfig, injectFooterLinksConfig: () => FooterLinksConfig, provideFooterLinksConfig: <D extends import("@odx/angular/utils").ConfigDependencies<unknown> = import("@odx/angular/utils").ConfigDependencies<Partial<FooterLinksConfig>>>(config: import("@odx/angular/utils").ConfigProvider<Partial<FooterLinksConfig>, D>) => import("@angular/core").FactoryProvider | import("@angular/core").ValueProvider;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { FooterLink } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an observable stream of footer links, combining statically configured links with dynamically provided ones.
|
|
5
|
+
* It leverages the footer links configuration injected from `injectFooterLinksConfig` and optionally includes
|
|
6
|
+
* dynamic links if provided. All links are filtered to include only those with a non-empty URL.
|
|
7
|
+
*
|
|
8
|
+
* @function createFooterLinks$
|
|
9
|
+
* @returns {Observable<FooterLink[]>} An Observable that emits an array of `FooterLink` objects. Each `FooterLink`
|
|
10
|
+
* contains a `name` and a `url`. The observable emits updates if the set of dynamic links changes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createFooterLinks$(): Observable<FooterLink[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-footer-links';
|
|
@@ -2,5 +2,5 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
export declare class HeaderComponent {
|
|
3
3
|
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
4
4
|
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderComponent, never>;
|
|
5
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<HeaderComponent, "odx-header", never, {}, {}, never, ["button[odxMainMenuButton]", "odx-header-title", "odx-action-group, odx-auth", "[odxHeaderAvatar]"], true, never>;
|
|
5
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HeaderComponent, "odx-header", never, {}, {}, never, ["button[odxMainMenuButton]", "odx-header-title", "*", "odx-action-group, odx-auth", "[odxHeaderAvatar]"], true, never>;
|
|
6
6
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "@angular/router";
|
|
3
|
+
export declare class HeaderNavigationRouterLinkDirective {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderNavigationRouterLinkDirective, never>;
|
|
5
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HeaderNavigationRouterLinkDirective, "[routerLink][odxHeaderNavigationLink]", never, {}, {}, never, never, true, [{ directive: typeof i1.RouterLinkActive; inputs: { "routerLinkActiveOptions": "routerLinkActiveOptions"; }; outputs: {}; }]>;
|
|
6
|
+
}
|
|
7
|
+
export declare class HeaderNavigationLinkDirective {
|
|
8
|
+
constructor();
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderNavigationLinkDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HeaderNavigationLinkDirective, "[odxHeaderNavigationLink]", never, {}, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './header-navigation-link.directive';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class HeaderNavigationComponent {
|
|
3
|
+
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
4
|
+
centered: boolean;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderNavigationComponent, never>;
|
|
6
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HeaderNavigationComponent, "odx-header-navigation", never, { "centered": { "alias": "centered"; "required": false; }; }, {}, never, ["ng-template, [odxHeaderNavigationLink]"], true, never>;
|
|
7
|
+
static ngAcceptInputType_centered: unknown;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./header-navigation.component";
|
|
3
|
+
import * as i2 from "./directives/header-navigation-link.directive";
|
|
4
|
+
import * as i3 from "@odx/angular";
|
|
5
|
+
export declare class HeaderNavigationModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderNavigationModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<HeaderNavigationModule, never, [typeof i1.HeaderNavigationComponent, typeof i2.HeaderNavigationLinkDirective, typeof i2.HeaderNavigationRouterLinkDirective], [typeof i3.CoreModule, typeof i1.HeaderNavigationComponent, typeof i2.HeaderNavigationLinkDirective, typeof i2.HeaderNavigationRouterLinkDirective]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<HeaderNavigationModule>;
|
|
9
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { DynamicTextContent } from '@odx/angular/cdk/dynamic-view';
|
|
1
2
|
import { trackByIndex } from '@odx/angular/utils';
|
|
2
3
|
import { MainMenuService } from './main-menu.service';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class MainMenuComponent {
|
|
5
|
-
protected dynamicLinks: import("rxjs").Observable<import("./models").MainMenuLink[]>;
|
|
6
6
|
protected readonly mainMenuService: MainMenuService;
|
|
7
|
-
protected readonly mainMenuLinks
|
|
7
|
+
protected readonly mainMenuLinks$: import("rxjs").Observable<import("./models").MainMenuLink[]>;
|
|
8
8
|
protected readonly trackByIndex: typeof trackByIndex;
|
|
9
9
|
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
10
|
-
title:
|
|
11
|
-
subtitle
|
|
12
|
-
copyright
|
|
10
|
+
title: DynamicTextContent;
|
|
11
|
+
subtitle?: DynamicTextContent | null;
|
|
12
|
+
copyright?: DynamicTextContent | null;
|
|
13
13
|
set isOpen(value: boolean);
|
|
14
14
|
get isOpen(): boolean;
|
|
15
15
|
menuOpen: import("rxjs").Observable<boolean>;
|
|
@@ -6,6 +6,7 @@ export interface MainMenuLinksConfig {
|
|
|
6
6
|
providerIdentificationUrl: string | null;
|
|
7
7
|
termsAndConditionsUrl?: string | null;
|
|
8
8
|
openSourceUrl?: string | null;
|
|
9
|
+
statusUrl?: string | null;
|
|
9
10
|
dynamicLinks?: Observable<MainMenuLink[]>;
|
|
10
11
|
}
|
|
11
12
|
export declare const MainMenuLinksConfig: import("@angular/core").InjectionToken<Partial<MainMenuLinksConfig>>, MainMenuLinksDefaultConfig: MainMenuLinksConfig, injectMainMenuLinksConfig: () => MainMenuLinksConfig, provideMainMenuLinksConfig: <D extends import("@odx/angular/utils").ConfigDependencies<unknown> = import("@odx/angular/utils").ConfigDependencies<Partial<MainMenuLinksConfig>>>(config: import("@odx/angular/utils").ConfigProvider<Partial<MainMenuLinksConfig>, D>) => import("@angular/core").FactoryProvider | import("@angular/core").ValueProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './lib/components';
|
|
2
|
+
export * from './lib/directives';
|
|
3
|
+
export * from './lib/features';
|
|
4
|
+
export * from './lib/models';
|
|
5
|
+
export * from './lib/notification.config';
|
|
6
|
+
export * from './lib/notification.service';
|
|
7
|
+
export * from './lib/notification.tokens';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { trackById } from '@odx/angular/utils';
|
|
3
|
+
import { NotificationRef } from '../../models';
|
|
4
|
+
import { NotificationCenterService } from '../../services';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* A component for displaying and managing a list of notifications. It integrates various sub-components and directives to provide a rich user interface for notification interaction. Supports animations for notification transitions and leverages Angular's change detection strategies for performance.
|
|
8
|
+
*
|
|
9
|
+
* @CSSComponent 'notification-center' - Specifies the CSS class for styling the notification center component.
|
|
10
|
+
*/
|
|
11
|
+
export declare class NotificationCenterComponent implements OnDestroy {
|
|
12
|
+
protected readonly notificationCenterService: NotificationCenterService;
|
|
13
|
+
protected readonly trackById: typeof trackById;
|
|
14
|
+
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
protected isMuted({ options, hasBeenSeen }: NotificationRef): boolean;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationCenterComponent, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NotificationCenterComponent, "odx-notification-center", never, {}, {}, never, never, true, never>;
|
|
19
|
+
}
|
package/components/notification/lib/components/notification-item/notification-item.component.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { NotificationRef } from '../../models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* A component for displaying notifications.
|
|
7
|
+
* Supports customization through dynamic transformation of notification data.
|
|
8
|
+
* Utilizes the OnPush change detection strategy for better performance in large applications.
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
*/
|
|
12
|
+
export declare class NotificationItemComponent {
|
|
13
|
+
private readonly transformNotification;
|
|
14
|
+
private _notificationRef;
|
|
15
|
+
protected transformedNotification: Observable<NotificationRef>;
|
|
16
|
+
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
17
|
+
/**
|
|
18
|
+
* Input property to set the notification. On setting, it transforms the notification for display.
|
|
19
|
+
* This transformation can be a custom logic provided through dependency injection.
|
|
20
|
+
*
|
|
21
|
+
* @param value NotificationRef - The notification object to be displayed.
|
|
22
|
+
*/
|
|
23
|
+
set notification(value: NotificationRef);
|
|
24
|
+
/**
|
|
25
|
+
* Getter for the notification property.
|
|
26
|
+
*
|
|
27
|
+
* @returns NotificationRef - The current notification reference stored in the component.
|
|
28
|
+
*/
|
|
29
|
+
get notification(): NotificationRef;
|
|
30
|
+
/**
|
|
31
|
+
* An event emitter for dismissing the notification.
|
|
32
|
+
* It emits the notification reference that was dismissed.
|
|
33
|
+
*/
|
|
34
|
+
dismiss: EventEmitter<NotificationRef>;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationItemComponent, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NotificationItemComponent, "odx-notification-item", never, { "notification": { "alias": "notification"; "required": true; }; }, { "dismiss": "dismiss"; }, never, never, true, never>;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './notification-center.directive';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AfterViewInit, OnInit } from '@angular/core';
|
|
2
|
+
import { DynamicTextContent } from '@odx/angular/cdk/dynamic-view';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { NotificationSortFn } from '../models';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "@odx/angular/components/badge";
|
|
7
|
+
import * as i2 from "@odx/angular/components/dropdown";
|
|
8
|
+
/**
|
|
9
|
+
* A directive that provides an interface for managing notifications.
|
|
10
|
+
* It allows configuring a notification center with dynamic content, sorting, and badge display functionalities.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NotificationCenterDirective implements OnInit, AfterViewInit {
|
|
13
|
+
private readonly badgeDirective;
|
|
14
|
+
private readonly destroyRef;
|
|
15
|
+
private readonly disabledController;
|
|
16
|
+
private readonly dropdownDirective;
|
|
17
|
+
private readonly notificationCenterService;
|
|
18
|
+
private readonly dropdownStateChange$;
|
|
19
|
+
private readonly badgeValue$;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the tag for filtering notifications. Only notifications with this tag will be shown in the notification center.
|
|
22
|
+
* @param value The tag value to filter notifications. If null, all notifications are shown.
|
|
23
|
+
*/
|
|
24
|
+
set tag(value: string | null);
|
|
25
|
+
/**
|
|
26
|
+
* Sets the title of the notification center. The title can be dynamic and change based on the application state.
|
|
27
|
+
* @param value The title content, which can be a string or an Observable returning a string. Allows for dynamic titles.
|
|
28
|
+
*/
|
|
29
|
+
set title(value: DynamicTextContent | null);
|
|
30
|
+
/**
|
|
31
|
+
* Sets the sorting function used to order notifications within the notification center.
|
|
32
|
+
* @param value A function that compares two notifications and returns the sort order.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* sortFfn = (a: NotificationRef, b: NotificationRef) => {
|
|
36
|
+
if (a.createdAt < b.createdAt) return -1;
|
|
37
|
+
if (a.createdAt > b.createdAt) return 1;
|
|
38
|
+
return 0;
|
|
39
|
+
};
|
|
40
|
+
*/
|
|
41
|
+
set sortFn(value: NotificationSortFn);
|
|
42
|
+
/**
|
|
43
|
+
* An event that is emitted when a new notification is added.
|
|
44
|
+
* Listeners can use this event to react to new notifications being added to the notification center.
|
|
45
|
+
*/
|
|
46
|
+
notificationAdd: Observable<import("../models").NotificationRef>;
|
|
47
|
+
/**
|
|
48
|
+
* An event that is emitted when a notification is updated.
|
|
49
|
+
* This can be used to react to changes in notifications, such as their read status or content updates.
|
|
50
|
+
*/
|
|
51
|
+
notificationUpdate: Observable<import("../models").NotificationRef>;
|
|
52
|
+
/**
|
|
53
|
+
* An event that is emitted when a notification is removed from the notification center.
|
|
54
|
+
* Use this event to handle the removal of notifications, such as cleaning up resources or updating UI elements.
|
|
55
|
+
*/
|
|
56
|
+
notificationRemove: Observable<import("../models").NotificationRef>;
|
|
57
|
+
/**
|
|
58
|
+
* An event that is emitted when a notification is marked as seen.
|
|
59
|
+
* This event can be used to perform actions when the user acknowledges a notification.
|
|
60
|
+
*/
|
|
61
|
+
notificationSeen: Observable<import("../models").NotificationRef>;
|
|
62
|
+
ngOnInit(): void;
|
|
63
|
+
ngAfterViewInit(): void;
|
|
64
|
+
private formatBadgeValue;
|
|
65
|
+
private handleBadgeUpdates;
|
|
66
|
+
private handleDropdownUpdates;
|
|
67
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationCenterDirective, never>;
|
|
68
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NotificationCenterDirective, "[odxNotificationCenter]", never, { "tag": { "alias": "odxNotificationCenter"; "required": false; }; "title": { "alias": "odxNotificationCenterTitle"; "required": false; }; "sortFn": { "alias": "odxNotificationCenterSortFn"; "required": false; }; }, { "notificationAdd": "odxNotificationCenterAdd"; "notificationUpdate": "odxNotificationCenterUpdate"; "notificationRemove": "odxNotificationCenterRemove"; "notificationSeen": "odxNotificationCenterSeen"; }, never, never, true, [{ directive: typeof i1.BadgeDirective; inputs: { "odxBadgeVariant": "odxNotificationCenterBadgeVariant"; }; outputs: {}; }, { directive: typeof i2.DropdownDirective; inputs: {}; outputs: {}; }]>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NotificationFeature, NotificationRef } from '../models';
|
|
2
|
+
export type BrowserNotificationExtras = Omit<NotificationOptions, 'body' | 'timestamp'>;
|
|
3
|
+
export type BrowserNotification = Notification;
|
|
4
|
+
export type BrowserNotificationFactory = (notificationRef: NotificationRef) => BrowserNotification;
|
|
5
|
+
export type SendBrowserNotificationFn = (notificationRef: NotificationRef) => unknown;
|
|
6
|
+
export interface WithBrowserNotificationsOptions {
|
|
7
|
+
sendFn?: SendBrowserNotificationFn;
|
|
8
|
+
extras?: BrowserNotificationExtras;
|
|
9
|
+
isEnabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Configures the application to send browser notifications, using Angular's `ENVIRONMENT_INITIALIZER` for setup.
|
|
13
|
+
* @function withBrowserNotifications
|
|
14
|
+
* @param {WithBrowserNotificationsOptions} [options] - Optional configuration for browser notifications.
|
|
15
|
+
* @returns {NotificationFeature} A notification feature for integration into the application environment.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withBrowserNotifications(options?: WithBrowserNotificationsOptions): NotificationFeature;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { NotificationFeature, NotificationRef } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Type definition for a function that loads notifications.
|
|
5
|
+
* Can return notifications directly as an array, as a Promise, or as an Observable.
|
|
6
|
+
* @typedef {Function} LoadNotificationsFn
|
|
7
|
+
* @returns {Observable<NotificationRef[]> | Promise<NotificationRef[]> | NotificationRef[]} The loaded notifications.
|
|
8
|
+
*/
|
|
9
|
+
export type LoadNotificationsFn = () => Observable<NotificationRef[]> | Promise<NotificationRef[]> | NotificationRef[];
|
|
10
|
+
/**
|
|
11
|
+
* Integrates notification loading into the application environment. This function uses the Angular
|
|
12
|
+
* `ENVIRONMENT_INITIALIZER` to ensure that notifications are loaded as part of the application's
|
|
13
|
+
* initialization process.
|
|
14
|
+
* @function withLoadNotifications
|
|
15
|
+
* @param {LoadNotificationsFn} loadFn - The function to load notifications.
|
|
16
|
+
* @returns {NotificationFeature} A notification feature configured to load notifications at startup.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withLoadNotifications(loadFn: LoadNotificationsFn): NotificationFeature;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { NotificationFeature, NotificationRef } from '../models';
|
|
4
|
+
export type NotificationTransformFn = (ref: NotificationRef) => Observable<NotificationRef>;
|
|
5
|
+
/**
|
|
6
|
+
* An InjectionToken for the NotificationTransformFn. This token can be used to inject
|
|
7
|
+
* a custom notification transformation function into the Angular DI system.
|
|
8
|
+
* @type {InjectionToken<NotificationTransformFn>}
|
|
9
|
+
*/
|
|
10
|
+
export declare const ODX_NOTIFICATION_TRANSFORMER: InjectionToken<NotificationTransformFn>;
|
|
11
|
+
/**
|
|
12
|
+
* Attempts to inject a NotificationTransformFn from the Angular DI system.
|
|
13
|
+
* If no provider is found, it returns null.
|
|
14
|
+
* @function injectNotificationTransform
|
|
15
|
+
* @returns {NotificationTransformFn | null} The injected NotificationTransformFn, or null if not provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare function injectNotificationTransform(): NotificationTransformFn | null;
|
|
18
|
+
/**
|
|
19
|
+
* Configures a notification transformation function to be used within the application.
|
|
20
|
+
* This function provides a mechanism to globally apply transformations to notifications
|
|
21
|
+
* before they are processed or displayed.
|
|
22
|
+
* @function withNotificationTransform
|
|
23
|
+
* @param {NotificationTransformFn} transformFn - The function to transform notifications.
|
|
24
|
+
* @returns {NotificationFeature} A NotificationFeature configured with the provided transformation function.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withNotificationTransform(transformFn: NotificationTransformFn): NotificationFeature;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { NotificationFeature, NotificationRef } from '../models';
|
|
2
|
+
import { LoadNotificationsFn } from './with-load-notifications';
|
|
3
|
+
import { SaveNotificationsFn } from './with-save-notifications';
|
|
4
|
+
export interface NotificationSerializer {
|
|
5
|
+
serialize(value: NotificationRef[]): Promise<string>;
|
|
6
|
+
deserialize(value: string): Promise<NotificationRef[]>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Implementation of NotificationSerializer for persistent storage.
|
|
10
|
+
* @class PersistentNotificationSerializer
|
|
11
|
+
* @implements {NotificationSerializer}
|
|
12
|
+
*/
|
|
13
|
+
export declare class PersistentNotificationSerializer implements NotificationSerializer {
|
|
14
|
+
/**
|
|
15
|
+
* Serializes an array of NotificationRef objects into a string.
|
|
16
|
+
* @function serialize
|
|
17
|
+
* @memberof NotificationSerializer
|
|
18
|
+
* @param {NotificationRef[]} value - The notification references to serialize.
|
|
19
|
+
* @returns {Promise<string>} A promise that resolves to the serialized string representation of notification references.
|
|
20
|
+
*/
|
|
21
|
+
serialize(value: NotificationRef[]): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Deserializes a string into an array of NotificationRef objects.
|
|
24
|
+
* @function deserialize
|
|
25
|
+
* @memberof NotificationSerializer
|
|
26
|
+
* @param {string} value - The string representation of notification references to deserialize.
|
|
27
|
+
* @returns {Promise<NotificationRef[]>} A promise that resolves to the deserialized notification references.
|
|
28
|
+
*/
|
|
29
|
+
deserialize(value: string): Promise<NotificationRef[]>;
|
|
30
|
+
private serializeDynamicTextContent;
|
|
31
|
+
}
|
|
32
|
+
export interface WithPersistentNotificationsStorageOptions {
|
|
33
|
+
storageKey: string;
|
|
34
|
+
storage: Storage;
|
|
35
|
+
serializer: NotificationSerializer;
|
|
36
|
+
idTransformer?: (notificationRef: NotificationRef) => string;
|
|
37
|
+
}
|
|
38
|
+
export interface WithPersistentNotificationsOptions {
|
|
39
|
+
initFn: LoadNotificationsFn;
|
|
40
|
+
saveFn: SaveNotificationsFn;
|
|
41
|
+
storageOptions: WithPersistentNotificationsStorageOptions;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Initializes and returns a function for loading persistent notifications.
|
|
45
|
+
* @function initPersistentNotifications
|
|
46
|
+
* @param {WithPersistentNotificationsStorageOptions} options - The storage options including serializer and storage key.
|
|
47
|
+
* @returns {LoadNotificationsFn} A function to load notifications from storage.
|
|
48
|
+
*/
|
|
49
|
+
export declare function initPersistentNotifications({ storage, storageKey, serializer, idTransformer, }: WithPersistentNotificationsStorageOptions): LoadNotificationsFn;
|
|
50
|
+
/**
|
|
51
|
+
* Returns a function for persisting notifications.
|
|
52
|
+
* @function persistNotifications
|
|
53
|
+
* @param {WithPersistentNotificationsStorageOptions} options - The storage options including serializer and storage key.
|
|
54
|
+
* @returns {SaveNotificationsFn} A function to save notifications to storage.
|
|
55
|
+
*/
|
|
56
|
+
export declare function persistNotifications({ storage, storageKey, serializer }: WithPersistentNotificationsStorageOptions): SaveNotificationsFn;
|
|
57
|
+
/**
|
|
58
|
+
* Configures the application to use persistent notifications, automatically loading from and saving to the configured storage.
|
|
59
|
+
* @function withPersistentNotifications
|
|
60
|
+
* @param {Partial<WithPersistentNotificationsOptions>} [options] - Optional configuration for persistent notifications.
|
|
61
|
+
* @returns {NotificationFeature} A notification feature configured for persistence.
|
|
62
|
+
*/
|
|
63
|
+
export declare function withPersistentNotifications(options?: Partial<WithPersistentNotificationsOptions>): NotificationFeature;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { NotificationFeature, NotificationRef } from '../models';
|
|
3
|
+
export type SaveNotificationsFn = (notificationRefs: NotificationRef[]) => Observable<void> | Promise<void> | void;
|
|
4
|
+
/**
|
|
5
|
+
* Configures the application to automatically save notifications using a specified save function.
|
|
6
|
+
* This setup integrates with Angular's environment initialization process to ensure notifications are saved as needed.
|
|
7
|
+
* @function withSaveNotifications
|
|
8
|
+
* @param {SaveNotificationsFn} saveFn - The function to save notifications.
|
|
9
|
+
* @returns {NotificationFeature} A notification feature configured to automatically save notifications.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withSaveNotifications(saveFn: SaveNotificationsFn): NotificationFeature;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './notification';
|
|
2
|
+
export * from './notification-action';
|
|
3
|
+
export * from './notification-collection';
|
|
4
|
+
export * from './notification-feature';
|
|
5
|
+
export * from './notification-options';
|
|
6
|
+
export * from './notification-query';
|
|
7
|
+
export * from './notification-sort-fn';
|
|
8
|
+
export * from './notification.ref';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EnvironmentProviders, Provider } from '@angular/core';
|
|
2
|
+
export type NotificationFeature = EnvironmentProviders & {
|
|
3
|
+
ɵodxBrand: '@odx/angular/components/notification::NotificationFeature';
|
|
4
|
+
};
|
|
5
|
+
export declare function makeNotificationFeature(provider: (Provider | NotificationFeature)[] | EnvironmentProviders): NotificationFeature;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Notification } from './notification';
|
|
2
|
+
import { NotificationOptions } from './notification-options';
|
|
3
|
+
export interface NotificationRef {
|
|
4
|
+
id: NonNullable<Notification['id']>;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
item: Notification;
|
|
7
|
+
options: NotificationOptions;
|
|
8
|
+
hasBeenSeen: boolean;
|
|
9
|
+
}
|