@nova-design-system/nova-angular-18 3.13.0 → 3.14.0-beta.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/dist/nova-components/esm2022/lib/nova-components.module.mjs +1 -1
- package/dist/nova-components/esm2022/lib/providers/index.mjs +3 -0
- package/dist/nova-components/esm2022/lib/providers/notification-service.component.mjs +183 -0
- package/dist/nova-components/esm2022/lib/providers/notification.service.mjs +134 -0
- package/dist/nova-components/esm2022/lib/stencil-generated/components.mjs +31 -5
- package/dist/nova-components/esm2022/lib/stencil-generated/index.mjs +2 -1
- package/dist/nova-components/esm2022/public-api.mjs +2 -1
- package/dist/nova-components/fesm2022/nova-components.mjs +345 -8
- package/dist/nova-components/fesm2022/nova-components.mjs.map +1 -1
- package/dist/nova-components/lib/nova-components.module.d.ts +1 -1
- package/dist/nova-components/lib/providers/index.d.ts +2 -0
- package/dist/nova-components/lib/providers/notification-service.component.d.ts +56 -0
- package/dist/nova-components/lib/providers/notification.service.d.ts +116 -0
- package/dist/nova-components/lib/stencil-generated/components.d.ts +10 -1
- package/dist/nova-components/lib/stencil-generated/index.d.ts +1 -1
- package/dist/nova-components/public-api.d.ts +1 -0
- package/package.json +4 -3
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
export * from './lib/nova-components.module';
|
|
5
5
|
export * from './lib/stencil-generated/components';
|
|
6
6
|
export * from './lib/stencil-generated/component-value-accessors';
|
|
7
|
+
export * from './lib/providers';
|
|
7
8
|
export * from '@nova-design-system/nova-webcomponents/constants';
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25vdmEtY29tcG9uZW50cy9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyxvQ0FBb0MsQ0FBQztBQUNuRCxjQUFjLG1EQUFtRCxDQUFDO0FBQ2xFLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxrREFBa0QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygbm92YS1jb21wb25lbnRzXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvbm92YS1jb21wb25lbnRzLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9zdGVuY2lsLWdlbmVyYXRlZC9jb21wb25lbnRzJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3N0ZW5jaWwtZ2VuZXJhdGVkL2NvbXBvbmVudC12YWx1ZS1hY2Nlc3NvcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvcHJvdmlkZXJzJztcbmV4cG9ydCAqIGZyb20gJ0Bub3ZhLWRlc2lnbi1zeXN0ZW0vbm92YS13ZWJjb21wb25lbnRzL2NvbnN0YW50cyc7XG4iXX0=
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ChangeDetectionStrategy, Component, HostListener, Directive, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, HostListener, Directive, APP_INITIALIZER, NgModule, Injectable, ElementRef, ViewChildren, Input, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import { defineCustomElements } from '@nova-design-system/nova-webcomponents/loader';
|
|
4
4
|
import { __decorate } from 'tslib';
|
|
5
|
-
import { fromEvent } from 'rxjs';
|
|
5
|
+
import { fromEvent, BehaviorSubject } from 'rxjs';
|
|
6
6
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import * as i2 from '@angular/common';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
7
9
|
export * from '@nova-design-system/nova-webcomponents/constants';
|
|
8
10
|
|
|
9
11
|
/* eslint-disable */
|
|
@@ -1004,12 +1006,12 @@ let NvNotification = class NvNotification {
|
|
|
1004
1006
|
proxyOutputs(this, this.el, ['hiddenChanged']);
|
|
1005
1007
|
}
|
|
1006
1008
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NvNotification, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1007
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: NvNotification, selector: "nv-notification", inputs: { dismissible: "dismissible", emphasis: "emphasis", feedback: "feedback", heading: "heading", hidden: "hidden", icon: "icon", message: "message", uid: "uid" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1009
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: NvNotification, selector: "nv-notification", inputs: { dismissible: "dismissible", emphasis: "emphasis", feedback: "feedback", heading: "heading", hidden: "hidden", icon: "icon", initiallyHidden: "initiallyHidden", message: "message", uid: "uid" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1008
1010
|
};
|
|
1009
1011
|
NvNotification = __decorate([
|
|
1010
1012
|
ProxyCmp({
|
|
1011
|
-
inputs: ['dismissible', 'emphasis', 'feedback', 'heading', 'hidden', 'icon', 'message', 'uid'],
|
|
1012
|
-
methods: ['dismiss']
|
|
1013
|
+
inputs: ['dismissible', 'emphasis', 'feedback', 'heading', 'hidden', 'icon', 'initiallyHidden', 'message', 'uid'],
|
|
1014
|
+
methods: ['dismiss', 'show']
|
|
1013
1015
|
})
|
|
1014
1016
|
], NvNotification);
|
|
1015
1017
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NvNotification, decorators: [{
|
|
@@ -1019,7 +1021,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1019
1021
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1020
1022
|
template: '<ng-content></ng-content>',
|
|
1021
1023
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
1022
|
-
inputs: ['dismissible', 'emphasis', 'feedback', 'heading', 'hidden', 'icon', 'message', 'uid'],
|
|
1024
|
+
inputs: ['dismissible', 'emphasis', 'feedback', 'heading', 'hidden', 'icon', 'initiallyHidden', 'message', 'uid'],
|
|
1025
|
+
standalone: false
|
|
1026
|
+
}]
|
|
1027
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
|
|
1028
|
+
let NvNotificationcontainer = class NvNotificationcontainer {
|
|
1029
|
+
constructor(c, r, z) {
|
|
1030
|
+
this.z = z;
|
|
1031
|
+
c.detach();
|
|
1032
|
+
this.el = r.nativeElement;
|
|
1033
|
+
}
|
|
1034
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NvNotificationcontainer, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1035
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: NvNotificationcontainer, selector: "nv-notificationcontainer", inputs: { position: "position" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1036
|
+
};
|
|
1037
|
+
NvNotificationcontainer = __decorate([
|
|
1038
|
+
ProxyCmp({
|
|
1039
|
+
inputs: ['position']
|
|
1040
|
+
})
|
|
1041
|
+
], NvNotificationcontainer);
|
|
1042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NvNotificationcontainer, decorators: [{
|
|
1043
|
+
type: Component,
|
|
1044
|
+
args: [{
|
|
1045
|
+
selector: 'nv-notificationcontainer',
|
|
1046
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1047
|
+
template: '<ng-content></ng-content>',
|
|
1048
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
1049
|
+
inputs: ['position'],
|
|
1023
1050
|
standalone: false
|
|
1024
1051
|
}]
|
|
1025
1052
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }] });
|
|
@@ -1292,6 +1319,7 @@ const DIRECTIVES = [
|
|
|
1292
1319
|
NvMenu,
|
|
1293
1320
|
NvMenuitem,
|
|
1294
1321
|
NvNotification,
|
|
1322
|
+
NvNotificationcontainer,
|
|
1295
1323
|
NvPopover,
|
|
1296
1324
|
NvRow,
|
|
1297
1325
|
NvStack,
|
|
@@ -2079,7 +2107,7 @@ function provideNovaComponents() {
|
|
|
2079
2107
|
}
|
|
2080
2108
|
class NovaComponentsModule {
|
|
2081
2109
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NovaComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2082
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: NovaComponentsModule, declarations: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip], exports: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip] }); }
|
|
2110
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: NovaComponentsModule, declarations: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip], exports: [NvAccordion, NvAccordionItem, NvAlert, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCol, NvDatagrid, NvDatagridcolumn, NvDialog, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFielddate, NvFielddaterange, NvFielddropdown, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldnumber, NvFieldpassword, NvFieldradio, NvFieldselect, NvFieldslider, NvFieldtext, NvFieldtextarea, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationcontainer, NvPopover, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvTogglebutton, NvTogglebuttongroup, NvTooltip] }); }
|
|
2083
2111
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NovaComponentsModule, providers: [provideNovaComponents()] }); }
|
|
2084
2112
|
}
|
|
2085
2113
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NovaComponentsModule, decorators: [{
|
|
@@ -2103,6 +2131,315 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2103
2131
|
}]
|
|
2104
2132
|
}] });
|
|
2105
2133
|
|
|
2134
|
+
/**
|
|
2135
|
+
* Utility function to generate unique IDs.
|
|
2136
|
+
*
|
|
2137
|
+
* @returns {string} A unique identifier string
|
|
2138
|
+
*/
|
|
2139
|
+
const generateId = () => {
|
|
2140
|
+
return `notification-${Date.now()}-${Math.random()
|
|
2141
|
+
.toString(36)
|
|
2142
|
+
.substr(2, 9)}`;
|
|
2143
|
+
};
|
|
2144
|
+
/**
|
|
2145
|
+
* Angular service for managing notifications.
|
|
2146
|
+
*/
|
|
2147
|
+
class NotificationService {
|
|
2148
|
+
/**
|
|
2149
|
+
* Current array of notifications.
|
|
2150
|
+
*
|
|
2151
|
+
* @returns {Notification[]} Array of active notifications
|
|
2152
|
+
*/
|
|
2153
|
+
get notifications() {
|
|
2154
|
+
return this._notifications.value;
|
|
2155
|
+
}
|
|
2156
|
+
constructor() {
|
|
2157
|
+
this._notifications = new BehaviorSubject([]);
|
|
2158
|
+
/**
|
|
2159
|
+
* Observable stream of active notifications.
|
|
2160
|
+
*/
|
|
2161
|
+
this.notifications$ = this._notifications.asObservable();
|
|
2162
|
+
// keep track of all notification refs
|
|
2163
|
+
this.elRefs = new Map();
|
|
2164
|
+
this._config = {
|
|
2165
|
+
position: 'top-right',
|
|
2166
|
+
maxNotifications: 50,
|
|
2167
|
+
className: '',
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Configure the notification service.
|
|
2172
|
+
*
|
|
2173
|
+
* @param {NotificationServiceConfig} config Configuration options
|
|
2174
|
+
*/
|
|
2175
|
+
configure(config) {
|
|
2176
|
+
Object.assign(this._config, config);
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Get the current configuration.
|
|
2180
|
+
*
|
|
2181
|
+
* @returns {Required<NotificationServiceConfig>} Current configuration
|
|
2182
|
+
*/
|
|
2183
|
+
get config() {
|
|
2184
|
+
return { ...this._config };
|
|
2185
|
+
}
|
|
2186
|
+
registerRef(id, el) {
|
|
2187
|
+
this.elRefs.set(id, el);
|
|
2188
|
+
}
|
|
2189
|
+
unregisterRef(id) {
|
|
2190
|
+
this.elRefs.delete(id);
|
|
2191
|
+
}
|
|
2192
|
+
clearRefs() {
|
|
2193
|
+
this.elRefs.clear();
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Show a new notification.
|
|
2197
|
+
*
|
|
2198
|
+
* @param {NotificationOptions} options The notification options
|
|
2199
|
+
* @returns {string} The notification ID
|
|
2200
|
+
*/
|
|
2201
|
+
show(options) {
|
|
2202
|
+
const id = options.id || generateId();
|
|
2203
|
+
const notification = {
|
|
2204
|
+
id,
|
|
2205
|
+
heading: options.heading,
|
|
2206
|
+
message: options.message,
|
|
2207
|
+
dismissible: options.dismissible ?? true,
|
|
2208
|
+
emphasis: options.emphasis ?? 'medium',
|
|
2209
|
+
feedback: options.feedback ?? 'information',
|
|
2210
|
+
icon: options.icon,
|
|
2211
|
+
actions: options.actions ?? [],
|
|
2212
|
+
actionSlot: options.actionSlot,
|
|
2213
|
+
createdAt: Date.now(),
|
|
2214
|
+
};
|
|
2215
|
+
const currentNotifications = this._notifications.value;
|
|
2216
|
+
// Remove oldest notifications if we exceed max
|
|
2217
|
+
const newNotifications = [notification, ...currentNotifications];
|
|
2218
|
+
if (newNotifications.length > this._config.maxNotifications) {
|
|
2219
|
+
this._notifications.next(newNotifications.slice(0, this._config.maxNotifications));
|
|
2220
|
+
}
|
|
2221
|
+
else {
|
|
2222
|
+
this._notifications.next(newNotifications);
|
|
2223
|
+
}
|
|
2224
|
+
setTimeout(() => {
|
|
2225
|
+
const ref = this.elRefs.get(id);
|
|
2226
|
+
ref?.show();
|
|
2227
|
+
}, 0);
|
|
2228
|
+
return id;
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Dismiss a specific notification by ID. This will remove the notification
|
|
2232
|
+
* after the animation completes.
|
|
2233
|
+
*
|
|
2234
|
+
* @param {string} id The notification ID to dismiss
|
|
2235
|
+
*/
|
|
2236
|
+
dismiss(id) {
|
|
2237
|
+
this.elRefs.get(id)?.dismiss?.();
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Immediately remove a specific notification by ID.
|
|
2241
|
+
*
|
|
2242
|
+
* @param {string} id The notification ID to dismiss
|
|
2243
|
+
*/
|
|
2244
|
+
remove(id) {
|
|
2245
|
+
const currentNotifications = this._notifications.value;
|
|
2246
|
+
const filteredNotifications = currentNotifications.filter((notification) => notification.id !== id);
|
|
2247
|
+
this._notifications.next(filteredNotifications);
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Immediately remove all active notifications.
|
|
2251
|
+
*/
|
|
2252
|
+
removeAll() {
|
|
2253
|
+
this._notifications.next([]);
|
|
2254
|
+
}
|
|
2255
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2256
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NotificationService, providedIn: 'root' }); }
|
|
2257
|
+
}
|
|
2258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NotificationService, decorators: [{
|
|
2259
|
+
type: Injectable,
|
|
2260
|
+
args: [{
|
|
2261
|
+
providedIn: 'root',
|
|
2262
|
+
}]
|
|
2263
|
+
}], ctorParameters: () => [] });
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* Angular component that renders the notification container with active notifications.
|
|
2267
|
+
*/
|
|
2268
|
+
class NotificationServiceComponent {
|
|
2269
|
+
constructor(notificationService) {
|
|
2270
|
+
this.notificationService = notificationService;
|
|
2271
|
+
/**
|
|
2272
|
+
* Array of active notifications.
|
|
2273
|
+
*/
|
|
2274
|
+
this.notifications = [];
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Component initialization.
|
|
2278
|
+
*/
|
|
2279
|
+
ngOnInit() {
|
|
2280
|
+
// Use service config if no input provided
|
|
2281
|
+
this.position ??= this.notificationService.config.position;
|
|
2282
|
+
this.className ??= this.notificationService.config.className;
|
|
2283
|
+
// Subscribe to notification changes
|
|
2284
|
+
this.subscription = this.notificationService.notifications$.subscribe((list) => (this.notifications = list));
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Synchronize notification elements/refs with the service.
|
|
2288
|
+
*/
|
|
2289
|
+
ngAfterViewInit() {
|
|
2290
|
+
const sync = () => {
|
|
2291
|
+
this.notificationService.clearRefs();
|
|
2292
|
+
for (const elRef of this.notificationEls.toArray()) {
|
|
2293
|
+
const el = elRef.nativeElement;
|
|
2294
|
+
const id = el.getAttribute('data-id');
|
|
2295
|
+
if (id)
|
|
2296
|
+
this.notificationService.registerRef(id, el);
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
sync();
|
|
2300
|
+
this.notificationEls.changes.subscribe(sync);
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Component cleanup.
|
|
2304
|
+
*/
|
|
2305
|
+
ngOnDestroy() {
|
|
2306
|
+
this.subscription?.unsubscribe();
|
|
2307
|
+
this.notificationService.clearRefs();
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Track function for ngFor to optimize rendering.
|
|
2311
|
+
*
|
|
2312
|
+
* @param {number} index The index of the item
|
|
2313
|
+
* @param {Notification} notification The notification item
|
|
2314
|
+
* @returns {string} The notification ID
|
|
2315
|
+
*/
|
|
2316
|
+
trackByNotificationId(index, notification) {
|
|
2317
|
+
return notification.id;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Handle notification hidden state change.
|
|
2321
|
+
*
|
|
2322
|
+
* @param {CustomEvent<boolean>} event The hidden changed event
|
|
2323
|
+
* @param {string} id The notification ID
|
|
2324
|
+
*/
|
|
2325
|
+
handleHiddenChanged(event, id) {
|
|
2326
|
+
if (event.detail && id) {
|
|
2327
|
+
this.notificationService.remove(id);
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NotificationServiceComponent, deps: [{ token: NotificationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2331
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: NotificationServiceComponent, isStandalone: true, selector: "nv-notification-service", inputs: { position: "position", className: "className" }, viewQueries: [{ propertyName: "notificationEls", predicate: ["notificationEl"], descendants: true, read: ElementRef }], ngImport: i0, template: `
|
|
2332
|
+
<nv-notificationcontainer
|
|
2333
|
+
[position]="position"
|
|
2334
|
+
[class]="className"
|
|
2335
|
+
data-testid="notification-container"
|
|
2336
|
+
>
|
|
2337
|
+
<nv-notification
|
|
2338
|
+
*ngFor="
|
|
2339
|
+
let notification of notifications;
|
|
2340
|
+
trackBy: trackByNotificationId
|
|
2341
|
+
"
|
|
2342
|
+
#notificationEl
|
|
2343
|
+
[attr.data-id]="notification.id"
|
|
2344
|
+
[heading]="notification.heading"
|
|
2345
|
+
[message]="notification.message"
|
|
2346
|
+
[dismissible]="notification.dismissible"
|
|
2347
|
+
[emphasis]="notification.emphasis"
|
|
2348
|
+
[feedback]="notification.feedback"
|
|
2349
|
+
[icon]="notification.icon"
|
|
2350
|
+
[initiallyHidden]="true"
|
|
2351
|
+
(hiddenChanged)="handleHiddenChanged($event, notification.id)"
|
|
2352
|
+
>
|
|
2353
|
+
<!-- Actions slot content for the custom element -->
|
|
2354
|
+
<div
|
|
2355
|
+
slot="actions"
|
|
2356
|
+
class="flex gap-2"
|
|
2357
|
+
*ngIf="notification.actions?.length || notification.actionSlot"
|
|
2358
|
+
>
|
|
2359
|
+
<!-- Config-driven actions -->
|
|
2360
|
+
<nv-button
|
|
2361
|
+
*ngFor="let action of notification.actions"
|
|
2362
|
+
emphasis="low"
|
|
2363
|
+
size="sm"
|
|
2364
|
+
(click)="action.onClick()"
|
|
2365
|
+
>
|
|
2366
|
+
{{ action.label }}
|
|
2367
|
+
</nv-button>
|
|
2368
|
+
|
|
2369
|
+
<!-- Component-driven actions -->
|
|
2370
|
+
<ng-container
|
|
2371
|
+
*ngIf="notification.actionSlot"
|
|
2372
|
+
[ngComponentOutlet]="notification.actionSlot"
|
|
2373
|
+
></ng-container>
|
|
2374
|
+
</div>
|
|
2375
|
+
</nv-notification>
|
|
2376
|
+
</nv-notificationcontainer>
|
|
2377
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
2378
|
+
}
|
|
2379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NotificationServiceComponent, decorators: [{
|
|
2380
|
+
type: Component,
|
|
2381
|
+
args: [{
|
|
2382
|
+
selector: 'nv-notification-service',
|
|
2383
|
+
standalone: true,
|
|
2384
|
+
imports: [CommonModule],
|
|
2385
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2386
|
+
template: `
|
|
2387
|
+
<nv-notificationcontainer
|
|
2388
|
+
[position]="position"
|
|
2389
|
+
[class]="className"
|
|
2390
|
+
data-testid="notification-container"
|
|
2391
|
+
>
|
|
2392
|
+
<nv-notification
|
|
2393
|
+
*ngFor="
|
|
2394
|
+
let notification of notifications;
|
|
2395
|
+
trackBy: trackByNotificationId
|
|
2396
|
+
"
|
|
2397
|
+
#notificationEl
|
|
2398
|
+
[attr.data-id]="notification.id"
|
|
2399
|
+
[heading]="notification.heading"
|
|
2400
|
+
[message]="notification.message"
|
|
2401
|
+
[dismissible]="notification.dismissible"
|
|
2402
|
+
[emphasis]="notification.emphasis"
|
|
2403
|
+
[feedback]="notification.feedback"
|
|
2404
|
+
[icon]="notification.icon"
|
|
2405
|
+
[initiallyHidden]="true"
|
|
2406
|
+
(hiddenChanged)="handleHiddenChanged($event, notification.id)"
|
|
2407
|
+
>
|
|
2408
|
+
<!-- Actions slot content for the custom element -->
|
|
2409
|
+
<div
|
|
2410
|
+
slot="actions"
|
|
2411
|
+
class="flex gap-2"
|
|
2412
|
+
*ngIf="notification.actions?.length || notification.actionSlot"
|
|
2413
|
+
>
|
|
2414
|
+
<!-- Config-driven actions -->
|
|
2415
|
+
<nv-button
|
|
2416
|
+
*ngFor="let action of notification.actions"
|
|
2417
|
+
emphasis="low"
|
|
2418
|
+
size="sm"
|
|
2419
|
+
(click)="action.onClick()"
|
|
2420
|
+
>
|
|
2421
|
+
{{ action.label }}
|
|
2422
|
+
</nv-button>
|
|
2423
|
+
|
|
2424
|
+
<!-- Component-driven actions -->
|
|
2425
|
+
<ng-container
|
|
2426
|
+
*ngIf="notification.actionSlot"
|
|
2427
|
+
[ngComponentOutlet]="notification.actionSlot"
|
|
2428
|
+
></ng-container>
|
|
2429
|
+
</div>
|
|
2430
|
+
</nv-notification>
|
|
2431
|
+
</nv-notificationcontainer>
|
|
2432
|
+
`,
|
|
2433
|
+
}]
|
|
2434
|
+
}], ctorParameters: () => [{ type: NotificationService }], propDecorators: { position: [{
|
|
2435
|
+
type: Input
|
|
2436
|
+
}], className: [{
|
|
2437
|
+
type: Input
|
|
2438
|
+
}], notificationEls: [{
|
|
2439
|
+
type: ViewChildren,
|
|
2440
|
+
args: ['notificationEl', { read: ElementRef }]
|
|
2441
|
+
}] } });
|
|
2442
|
+
|
|
2106
2443
|
/*
|
|
2107
2444
|
* Public API Surface of nova-components
|
|
2108
2445
|
*/
|
|
@@ -2111,5 +2448,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2111
2448
|
* Generated bundle index. Do not edit.
|
|
2112
2449
|
*/
|
|
2113
2450
|
|
|
2114
|
-
export { NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, NvDialog, NvDialogValueAccessor, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFieldcheckboxValueAccessor, NvFielddate, NvFielddateValueAccessor, NvFielddaterange, NvFielddaterangeValueAccessor, NvFielddropdown, NvFielddropdownValueAccessor, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldmultiselectValueAccessor, NvFieldnumber, NvFieldnumberValueAccessor, NvFieldpassword, NvFieldpasswordValueAccessor, NvFieldradio, NvFieldradioValueAccessor, NvFieldselect, NvFieldselectValueAccessor, NvFieldslider, NvFieldsliderValueAccessor, NvFieldtext, NvFieldtextValueAccessor, NvFieldtextarea, NvFieldtextareaValueAccessor, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationValueAccessor, NvPopover, NvPopoverValueAccessor, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvToggleValueAccessor, NvTogglebutton, NvTogglebuttongroup, NvTogglebuttongroupValueAccessor, NvTooltip, VALUE_ACCESSORS, provideNovaComponents };
|
|
2451
|
+
export { NotificationService, NotificationServiceComponent, NovaComponentsModule, NovaComponentsValueAccessorModule, NvAccordion, NvAccordionItem, NvAlert, NvAlertValueAccessor, NvAvatar, NvBadge, NvBreadcrumb, NvBreadcrumbs, NvButton, NvButtongroup, NvCalendar, NvCalendarValueAccessor, NvCol, NvDatagrid, NvDatagridValueAccessor, NvDatagridcolumn, NvDialog, NvDialogValueAccessor, NvDialogfooter, NvDialogheader, NvFieldcheckbox, NvFieldcheckboxValueAccessor, NvFielddate, NvFielddateValueAccessor, NvFielddaterange, NvFielddaterangeValueAccessor, NvFielddropdown, NvFielddropdownValueAccessor, NvFielddropdownitem, NvFielddropdownitemcheck, NvFieldmultiselect, NvFieldmultiselectValueAccessor, NvFieldnumber, NvFieldnumberValueAccessor, NvFieldpassword, NvFieldpasswordValueAccessor, NvFieldradio, NvFieldradioValueAccessor, NvFieldselect, NvFieldselectValueAccessor, NvFieldslider, NvFieldsliderValueAccessor, NvFieldtext, NvFieldtextValueAccessor, NvFieldtextarea, NvFieldtextareaValueAccessor, NvFieldtime, NvIcon, NvIconbutton, NvLoader, NvMenu, NvMenuitem, NvNotification, NvNotificationValueAccessor, NvNotificationcontainer, NvPopover, NvPopoverValueAccessor, NvRow, NvStack, NvTable, NvTablecolumn, NvToggle, NvToggleValueAccessor, NvTogglebutton, NvTogglebuttongroup, NvTogglebuttongroupValueAccessor, NvTooltip, VALUE_ACCESSORS, provideNovaComponents };
|
|
2115
2452
|
//# sourceMappingURL=nova-components.mjs.map
|