@progress/kendo-angular-notification 3.0.4 → 4.0.0-next.202202241714

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.
Files changed (67) hide show
  1. package/bundles/kendo-angular-notification.umd.js +5 -0
  2. package/{dist/es/models/notification-ref.js → esm2015/kendo-angular-notification.js} +4 -0
  3. package/esm2015/localization/localized-messages.directive.js +38 -0
  4. package/{dist/es → esm2015}/main.js +2 -0
  5. package/{dist/es2015 → esm2015}/models/animation.js +1 -0
  6. package/{dist/es2015 → esm2015}/models/notification-ref.js +1 -0
  7. package/{dist/es2015 → esm2015}/models/notification-settings.js +0 -0
  8. package/{dist/es → esm2015}/models/position.js +1 -0
  9. package/{dist/es2015 → esm2015}/models/type.js +1 -0
  10. package/{dist/es2015 → esm2015}/notification.component.js +85 -73
  11. package/{dist/es2015 → esm2015}/notification.container.component.js +25 -27
  12. package/{dist/es → esm2015}/notification.module.js +16 -16
  13. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  14. package/{dist/es2015 → esm2015}/services/notification.service.js +14 -12
  15. package/{dist/es2015 → esm2015}/utils/animations.js +0 -0
  16. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-notification.js} +170 -146
  17. package/{dist/es/models/animation.js → kendo-angular-notification.d.ts} +5 -0
  18. package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
  19. package/{dist/es2015/main.d.ts → main.d.ts} +1 -0
  20. package/{dist/es2015/models → models}/animation.d.ts +0 -0
  21. package/{dist/es2015/models → models}/notification-ref.d.ts +0 -0
  22. package/{dist/es2015/models → models}/notification-settings.d.ts +0 -0
  23. package/{dist/es2015/models → models}/position.d.ts +0 -0
  24. package/{dist/es2015/models → models}/type.d.ts +0 -0
  25. package/{dist/es2015/notification.component.d.ts → notification.component.d.ts} +5 -2
  26. package/{dist/es2015/notification.container.component.d.ts → notification.container.component.d.ts} +3 -1
  27. package/{dist/es2015/notification.module.d.ts → notification.module.d.ts} +8 -0
  28. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  29. package/package.json +32 -95
  30. package/schematics/ngAdd/index.js +5 -2
  31. package/schematics/ngAdd/index.js.map +1 -1
  32. package/{dist/es2015/services → services}/notification.service.d.ts +4 -1
  33. package/{dist/es2015/utils → utils}/animations.d.ts +0 -0
  34. package/dist/cdn/js/kendo-angular-notification.js +0 -20
  35. package/dist/cdn/main.js +0 -5
  36. package/dist/es/index.js +0 -10
  37. package/dist/es/localization/localized-messages.directive.js +0 -38
  38. package/dist/es/models/notification-settings.js +0 -54
  39. package/dist/es/models/type.js +0 -4
  40. package/dist/es/notification.component.js +0 -222
  41. package/dist/es/notification.container.component.js +0 -154
  42. package/dist/es/package-metadata.js +0 -15
  43. package/dist/es/services/notification.service.js +0 -135
  44. package/dist/es/utils/animations.js +0 -41
  45. package/dist/es2015/index.d.ts +0 -10
  46. package/dist/es2015/index.js +0 -10
  47. package/dist/es2015/index.metadata.json +0 -1
  48. package/dist/es2015/localization/localized-messages.directive.js +0 -34
  49. package/dist/es2015/main.js +0 -8
  50. package/dist/es2015/models/position.js +0 -4
  51. package/dist/es2015/notification.module.js +0 -53
  52. package/dist/fesm5/index.js +0 -677
  53. package/dist/npm/index.js +0 -15
  54. package/dist/npm/localization/localized-messages.directive.js +0 -40
  55. package/dist/npm/main.js +0 -15
  56. package/dist/npm/models/animation.js +0 -6
  57. package/dist/npm/models/notification-ref.js +0 -6
  58. package/dist/npm/models/notification-settings.js +0 -56
  59. package/dist/npm/models/position.js +0 -6
  60. package/dist/npm/models/type.js +0 -6
  61. package/dist/npm/notification.component.js +0 -224
  62. package/dist/npm/notification.container.component.js +0 -156
  63. package/dist/npm/notification.module.js +0 -58
  64. package/dist/npm/package-metadata.js +0 -17
  65. package/dist/npm/services/notification.service.js +0 -137
  66. package/dist/npm/utils/animations.js +0 -47
  67. package/dist/systemjs/kendo-angular-notification.js +0 -5
@@ -1,222 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, EventEmitter, HostBinding, Input, TemplateRef, ChangeDetectorRef, ViewChild, ViewContainerRef, ElementRef, Renderer2 } from '@angular/core';
7
- import { AnimationBuilder } from '@angular/animations';
8
- import { take } from 'rxjs/operators';
9
- import { validatePackage } from '@progress/kendo-licensing';
10
- import { packageMetadata } from './package-metadata';
11
- import { fadeAnimation, fadeCloseAnimation, slideAnimation, slideCloseAnimation } from './utils/animations';
12
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
13
- /**
14
- * @hidden
15
- *
16
- */
17
- var NotificationComponent = /** @class */ (function () {
18
- function NotificationComponent(cdr, element, renderer, builder, localizationService) {
19
- var _this = this;
20
- this.cdr = cdr;
21
- this.element = element;
22
- this.renderer = renderer;
23
- this.builder = builder;
24
- this.localizationService = localizationService;
25
- this.close = new EventEmitter();
26
- this.width = null;
27
- this.height = null;
28
- this.defaultHideAfter = 5000;
29
- this.animationEnd = new EventEmitter();
30
- this.rtl = false;
31
- validatePackage(packageMetadata);
32
- this.dynamicRTLSubscription = localizationService.changes.subscribe(function (_a) {
33
- var rtl = _a.rtl;
34
- _this.rtl = rtl;
35
- _this.direction = _this.rtl ? 'rtl' : 'ltr';
36
- });
37
- }
38
- Object.defineProperty(NotificationComponent.prototype, "containerClass", {
39
- get: function () {
40
- return true;
41
- },
42
- enumerable: true,
43
- configurable: true
44
- });
45
- Object.defineProperty(NotificationComponent.prototype, "closeButtonTitle", {
46
- get: function () {
47
- return this.closeTitle || this.localizationService.get('closeTitle');
48
- },
49
- enumerable: true,
50
- configurable: true
51
- });
52
- NotificationComponent.prototype.notificationClasses = function () {
53
- return (this.type ? this.typeClass() : '') + "\n " + (this.closable ? 'k-notification-closable' : '');
54
- };
55
- NotificationComponent.prototype.ngOnInit = function () {
56
- clearTimeout(this.hideTimeout);
57
- };
58
- NotificationComponent.prototype.ngOnDestroy = function () {
59
- clearTimeout(this.hideTimeout);
60
- if (this.dynamicRTLSubscription) {
61
- this.dynamicRTLSubscription.unsubscribe();
62
- }
63
- };
64
- NotificationComponent.prototype.ngAfterViewInit = function () {
65
- var _this = this;
66
- if (!this.closable && !this.animation) {
67
- this.setHideTimeout();
68
- }
69
- if (!this.closable && this.animation) {
70
- this.animationEnd.pipe(take(1))
71
- .subscribe(function () { return _this.setHideTimeout(); });
72
- }
73
- if (this.animation) {
74
- this.animate(this.animation);
75
- }
76
- };
77
- NotificationComponent.prototype.typeClass = function () {
78
- return {
79
- 'none': '',
80
- 'success': 'k-notification-success',
81
- 'warning': 'k-notification-warning',
82
- 'error': 'k-notification-error',
83
- 'info': 'k-notification-info'
84
- }[this.type.style];
85
- };
86
- NotificationComponent.prototype.typeIconClass = function () {
87
- return {
88
- 'none': '',
89
- 'success': 'k-i-success',
90
- 'warning': 'k-i-warning',
91
- 'error': 'k-i-error',
92
- 'info': 'k-i-info'
93
- }[this.type.style];
94
- };
95
- NotificationComponent.prototype.onCloseClick = function () {
96
- clearTimeout(this.hideTimeout);
97
- this.hide();
98
- };
99
- NotificationComponent.prototype.hide = function (customComponent) {
100
- var _this = this;
101
- var elementHeight = getComputedStyle(this.element.nativeElement).height;
102
- if (this.animation && elementHeight) {
103
- this.animate(this.animation, true);
104
- this.animationEnd.subscribe(function () {
105
- _this.emitClose(customComponent);
106
- });
107
- return;
108
- }
109
- this.emitClose(customComponent);
110
- };
111
- NotificationComponent.prototype.setHideTimeout = function () {
112
- var _this = this;
113
- var hideAfter = this.hideAfter || this.defaultHideAfter;
114
- this.hideTimeout = window.setTimeout(function () { return _this.onCloseClick(); }, hideAfter);
115
- };
116
- NotificationComponent.prototype.emitClose = function (customComponent) {
117
- if (customComponent) {
118
- customComponent.destroy();
119
- }
120
- this.close.emit();
121
- };
122
- NotificationComponent.prototype.play = function (animation, animatedElement) {
123
- var _this = this;
124
- var factory = this.builder.build(animation);
125
- var element = this.element.nativeElement;
126
- this.renderer.addClass(element, 'k-notification-container-animating');
127
- var player = factory.create(animatedElement);
128
- player.onDone(function () {
129
- _this.renderer.removeClass(element, 'k-notification-container-animating');
130
- _this.animationEnd.emit();
131
- if (player) {
132
- player.destroy();
133
- player = null;
134
- }
135
- });
136
- player.play();
137
- };
138
- NotificationComponent.prototype.animate = function (animation, onclose) {
139
- var element = this.element.nativeElement;
140
- var duration = animation.duration;
141
- var height = element.offsetHeight;
142
- var generatedAnimation = animation.type === 'slide' ?
143
- this.slideAnimation(height, duration, onclose) :
144
- this.fadeAnimation(duration, onclose);
145
- this.play(generatedAnimation, element);
146
- };
147
- NotificationComponent.prototype.slideAnimation = function (height, duration, onclose) {
148
- return onclose ? slideCloseAnimation(height, duration) : slideAnimation(height, duration);
149
- };
150
- NotificationComponent.prototype.fadeAnimation = function (duration, onclose) {
151
- return onclose ? fadeCloseAnimation(duration) : fadeAnimation(duration);
152
- };
153
- tslib_1.__decorate([
154
- ViewChild('container', { read: ViewContainerRef, static: true }),
155
- tslib_1.__metadata("design:type", ViewContainerRef)
156
- ], NotificationComponent.prototype, "container", void 0);
157
- tslib_1.__decorate([
158
- Input(),
159
- tslib_1.__metadata("design:type", TemplateRef)
160
- ], NotificationComponent.prototype, "templateRef", void 0);
161
- tslib_1.__decorate([
162
- Input(),
163
- tslib_1.__metadata("design:type", String)
164
- ], NotificationComponent.prototype, "templateString", void 0);
165
- tslib_1.__decorate([
166
- Input(),
167
- tslib_1.__metadata("design:type", Number)
168
- ], NotificationComponent.prototype, "width", void 0);
169
- tslib_1.__decorate([
170
- Input(),
171
- tslib_1.__metadata("design:type", Number)
172
- ], NotificationComponent.prototype, "height", void 0);
173
- tslib_1.__decorate([
174
- Input(),
175
- tslib_1.__metadata("design:type", Object)
176
- ], NotificationComponent.prototype, "cssClass", void 0);
177
- tslib_1.__decorate([
178
- Input(),
179
- tslib_1.__metadata("design:type", Number)
180
- ], NotificationComponent.prototype, "hideAfter", void 0);
181
- tslib_1.__decorate([
182
- Input(),
183
- tslib_1.__metadata("design:type", Boolean)
184
- ], NotificationComponent.prototype, "closable", void 0);
185
- tslib_1.__decorate([
186
- Input(),
187
- tslib_1.__metadata("design:type", Object)
188
- ], NotificationComponent.prototype, "type", void 0);
189
- tslib_1.__decorate([
190
- Input(),
191
- tslib_1.__metadata("design:type", Object)
192
- ], NotificationComponent.prototype, "animation", void 0);
193
- tslib_1.__decorate([
194
- HostBinding('attr.dir'),
195
- tslib_1.__metadata("design:type", String)
196
- ], NotificationComponent.prototype, "direction", void 0);
197
- tslib_1.__decorate([
198
- HostBinding('class.k-notification-container'),
199
- tslib_1.__metadata("design:type", Boolean),
200
- tslib_1.__metadata("design:paramtypes", [])
201
- ], NotificationComponent.prototype, "containerClass", null);
202
- NotificationComponent = tslib_1.__decorate([
203
- Component({
204
- selector: 'kendo-notification',
205
- template: "\n <ng-container kendoNotificationLocalizedMessages\n i18n-closeTitle=\"kendo.notification.closeTitle|The title of the close button\"\n closeTitle=\"Close\"\n >\n </ng-container>\n <div class=\"k-widget k-notification {{ notificationClasses() }}\"\n [ngClass]=\"cssClass\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\">\n <div class=\"k-notification-wrap k-hstack\">\n <span *ngIf=\"type && type.icon && type.style !== 'none'\" class=\"k-icon\" [ngClass]=\"typeIconClass()\"></span>\n\n <div class=\"k-notification-content\">\n <ng-template\n [ngIf]=\"templateRef\"\n [ngTemplateOutlet]=\"templateRef\">\n </ng-template>\n <ng-template\n [ngIf]=\"templateString\">\n {{ templateString }}\n </ng-template>\n <ng-container #container></ng-container>\n </div>\n\n <a *ngIf=\"closable\" class=\"k-icon k-i-close\" [attr.title]=\"closeButtonTitle\" (click)=\"onCloseClick()\"></a>\n </div>\n </div>\n ",
206
- providers: [
207
- LocalizationService,
208
- {
209
- provide: L10N_PREFIX,
210
- useValue: 'kendo.notification'
211
- }
212
- ]
213
- }),
214
- tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef,
215
- ElementRef,
216
- Renderer2,
217
- AnimationBuilder,
218
- LocalizationService])
219
- ], NotificationComponent);
220
- return NotificationComponent;
221
- }());
222
- export { NotificationComponent };
@@ -1,154 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, Input, ElementRef, ComponentFactoryResolver, ViewContainerRef, Renderer2, ViewChild, TemplateRef } from '@angular/core';
7
- import { NotificationComponent } from './notification.component';
8
- /**
9
- * @hidden
10
- *
11
- */
12
- var NotificationContainerComponent = /** @class */ (function () {
13
- function NotificationContainerComponent(element, renderer, resolver) {
14
- this.element = element;
15
- this.renderer = renderer;
16
- this.resolver = resolver;
17
- this.id = '';
18
- this.notifications = [];
19
- }
20
- NotificationContainerComponent.prototype.ngOnDestroy = function () {
21
- this.notifications.forEach(function (notification) {
22
- if (notification.closeClickSubscription) {
23
- notification.closeClickSubscription.unsubscribe();
24
- }
25
- });
26
- this.notifications = [];
27
- };
28
- NotificationContainerComponent.prototype.addNotification = function (settings) {
29
- this.position = settings.position;
30
- this.id = this.position.horizontal + " " + this.position.vertical;
31
- var factory = this.resolver.resolveComponentFactory(NotificationComponent);
32
- var notificationRef = this.container.createComponent(factory);
33
- this.applySettings(notificationRef, settings);
34
- var customComponent = null;
35
- if (typeof settings.content === 'function') {
36
- var customFactory = this.resolver.resolveComponentFactory(settings.content);
37
- customComponent = notificationRef.instance.container.createComponent(customFactory);
38
- }
39
- notificationRef.changeDetectorRef.detectChanges();
40
- this.notifications.push(notificationRef.instance);
41
- if (settings.appendTo) {
42
- this.applyAbsolutePosition(settings.appendTo);
43
- }
44
- this.applyPosition();
45
- this.applyContainerWrap();
46
- return {
47
- afterHide: notificationRef.instance.close,
48
- hide: function () { return notificationRef.instance.hide(customComponent); },
49
- notification: notificationRef,
50
- content: customComponent || null
51
- };
52
- };
53
- NotificationContainerComponent.prototype.hide = function (notificationRef) {
54
- var instance = notificationRef.instance;
55
- var index = this.notifications.indexOf(instance);
56
- this.notifications.splice(index, 1);
57
- if (instance.closeClickSubscription) {
58
- instance.closeClickSubscription.unsubscribe();
59
- }
60
- instance.templateRef = null;
61
- instance.templateString = null;
62
- notificationRef.destroy();
63
- };
64
- NotificationContainerComponent.prototype.applyContainerWrap = function () {
65
- var value = this.position.horizontal === 'right' ? 'wrap-reverse' : 'wrap';
66
- this.renderer.setStyle(this.group.nativeElement, 'flex-wrap', value);
67
- };
68
- NotificationContainerComponent.prototype.applySettings = function (notificationRef, settings) {
69
- var _this = this;
70
- var notification = notificationRef.instance;
71
- var content = settings.content;
72
- var animation = settings.animation || null;
73
- notification.closeClickSubscription = notification.close
74
- .subscribe(function () { return _this.hide(notificationRef); });
75
- if (typeof content === 'string') {
76
- notification.templateString = content;
77
- }
78
- if (content instanceof TemplateRef) {
79
- notification.templateRef = content;
80
- }
81
- notification.animation = animation;
82
- var type = settings.type;
83
- if (type && type.style === undefined) {
84
- type.style = 'none';
85
- }
86
- if (type && type.icon === undefined) {
87
- type.icon = true;
88
- }
89
- notification.type = type;
90
- notification.closeTitle = settings.closeTitle;
91
- if (settings.cssClass) {
92
- notification.cssClass = settings.cssClass;
93
- }
94
- notification.closable = settings.closable;
95
- notification.hideAfter = settings.hideAfter;
96
- notification.width = settings.width;
97
- notification.height = settings.height;
98
- };
99
- NotificationContainerComponent.prototype.applyAbsolutePosition = function (appendToContainer) {
100
- var appendTo = appendToContainer.element.nativeElement;
101
- var el = this.element.nativeElement.children[0];
102
- if (window.getComputedStyle(appendTo).position === 'static') {
103
- this.renderer.setStyle(appendTo, 'position', 'relative');
104
- }
105
- this.renderer.setStyle(el, 'position', 'absolute');
106
- };
107
- NotificationContainerComponent.prototype.applyPosition = function () {
108
- var element = this.element.nativeElement.children[0];
109
- var elementHalfWidth = element.getBoundingClientRect().width / 2;
110
- var positionStyles = this.setContainerPosition(this.position, elementHalfWidth);
111
- Object.keys(positionStyles).forEach(function (cssStyle) {
112
- element.style[cssStyle] = positionStyles[cssStyle];
113
- });
114
- };
115
- NotificationContainerComponent.prototype.setContainerPosition = function (position, offsetMargin) {
116
- var positionLayout = {
117
- horizontal: {
118
- left: { left: 0, alignItems: 'flex-start' },
119
- right: { right: 0, alignItems: 'flex-start' },
120
- center: { left: '50%', marginLeft: -offsetMargin + "px", alignItems: 'center' }
121
- },
122
- vertical: {
123
- top: { top: 0 },
124
- bottom: { bottom: 0 }
125
- }
126
- };
127
- var horizontal = positionLayout.horizontal[position.horizontal];
128
- var vertical = positionLayout.vertical[position.vertical];
129
- return Object.assign({}, horizontal, vertical);
130
- };
131
- tslib_1.__decorate([
132
- ViewChild('container', { read: ViewContainerRef, static: true }),
133
- tslib_1.__metadata("design:type", ViewContainerRef)
134
- ], NotificationContainerComponent.prototype, "container", void 0);
135
- tslib_1.__decorate([
136
- ViewChild('group', { static: true }),
137
- tslib_1.__metadata("design:type", ElementRef)
138
- ], NotificationContainerComponent.prototype, "group", void 0);
139
- tslib_1.__decorate([
140
- Input(),
141
- tslib_1.__metadata("design:type", String)
142
- ], NotificationContainerComponent.prototype, "id", void 0);
143
- NotificationContainerComponent = tslib_1.__decorate([
144
- Component({
145
- selector: 'kendo-notification-container',
146
- template: "\n <div #group class=\"k-notification-group\">\n <ng-container #container></ng-container>\n </div>\n "
147
- }),
148
- tslib_1.__metadata("design:paramtypes", [ElementRef,
149
- Renderer2,
150
- ComponentFactoryResolver])
151
- ], NotificationContainerComponent);
152
- return NotificationContainerComponent;
153
- }());
154
- export { NotificationContainerComponent };
@@ -1,15 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export var packageMetadata = {
9
- name: '@progress/kendo-angular-notification',
10
- productName: 'Kendo UI for Angular',
11
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1642587164,
13
- version: '',
14
- licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
- };
@@ -1,135 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Injectable, ComponentFactoryResolver, ApplicationRef, Injector, InjectionToken, ElementRef, Inject, Optional } from '@angular/core';
7
- import { NotificationContainerComponent } from '../notification.container.component';
8
- /**
9
- * Used to inject the Notification container. If not provided, the first root component of
10
- * the application is used.
11
- *
12
- * > The `NOTIFICATION_CONTAINER` can be used only with the [`NotificationService`]({% slug api_notification_notificationservice %}) class.
13
- *
14
- * @example
15
- *
16
- * ```ts-no-run
17
- * // Import the Notification module
18
- * import { NotificationModule, NOTIFICATION_CONTAINER } from '@progress/kendo-angular-notification';
19
- *
20
- * // The browser platform with a compiler
21
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
22
- *
23
- * import { ElementRef, NgModule } from '@angular/core';
24
- *
25
- * // Import the app component
26
- * import { AppComponent } from './app.component';
27
- *
28
- * // Define the app module
29
- * _@NgModule({
30
- * declarations: [AppComponent], // declare app component
31
- * imports: [BrowserModule, NotificationModule], // import Notification module
32
- * bootstrap: [AppComponent],
33
- * providers: [{
34
- * provide: NOTIFICATION_CONTAINER,
35
- * useFactory: () => {
36
- * //return the container ElementRef, where the notification will be injected
37
- * return { nativeElement: document.body } as ElementRef;
38
- * }
39
- * }]
40
- * })
41
- * export class AppModule {}
42
- *
43
- * // Compile and launch the module
44
- * platformBrowserDynamic().bootstrapModule(AppModule);
45
- * ```
46
- */
47
- export var NOTIFICATION_CONTAINER = new InjectionToken('Notification Container');
48
- /**
49
- * A service for opening Notification components dynamically
50
- * ([see example]({% slug overview_notification %})).
51
- *
52
- * @export
53
- * @class NotificationService
54
- */
55
- var NotificationService = /** @class */ (function () {
56
- /**
57
- * @hidden
58
- */
59
- function NotificationService(resolver, injector, container) {
60
- this.resolver = resolver;
61
- this.injector = injector;
62
- this.container = container;
63
- this.notificationContainers = [];
64
- this.position = { horizontal: 'right', vertical: 'top' };
65
- }
66
- /**
67
- * Opens a Notification component. Created Notification are mounted
68
- * in the DOM directly in the root application component.
69
- *
70
- * @param {NotificationSettings} settings - The settings which define the Notification.
71
- *
72
- * @returns {NotificationRef} - A reference to the Notification object and the convenience properties.
73
- */
74
- NotificationService.prototype.show = function (settings) {
75
- if (!settings) {
76
- throw new Error('NotificationSettings settings are required');
77
- }
78
- var target = this.findGroupContainer(settings);
79
- var position = settings.position || this.position;
80
- var currentId = position.horizontal + " " + position.vertical;
81
- var container;
82
- var notificationRef;
83
- var notificationContainer = this.notificationContainers.find(function (c) { return target.nativeElement.contains(c.element.nativeElement) && c.id === currentId; });
84
- if (!notificationContainer) {
85
- container = this.resolver
86
- .resolveComponentFactory(NotificationContainerComponent)
87
- .create(this.injector);
88
- notificationContainer = container.instance;
89
- this.appRef.attachView(container.hostView);
90
- var hostViewElement = container.location.nativeElement;
91
- var groupContainer = this.findGroupContainer(settings);
92
- if (!groupContainer) {
93
- throw new Error("\n View Container not found! Inject the NOTIFICATION_CONTAINER or define a specific ViewContainerRef via\n the appendTo option. See http://www.telerik.com/kendo-angular-ui/components/notification/api/NOTIFICATION_CONTAINER/\n for more details.\n ");
94
- }
95
- groupContainer.nativeElement.appendChild(hostViewElement);
96
- this.notificationContainers.push(notificationContainer);
97
- }
98
- settings.position = position;
99
- notificationRef = notificationContainer.addNotification(settings);
100
- return notificationRef;
101
- };
102
- Object.defineProperty(NotificationService.prototype, "appRef", {
103
- get: function () {
104
- if (!this.applicationRef) {
105
- this.applicationRef = this.injector.get(ApplicationRef);
106
- }
107
- return this.applicationRef;
108
- },
109
- enumerable: true,
110
- configurable: true
111
- });
112
- NotificationService.prototype.findGroupContainer = function (settings) {
113
- var container;
114
- if (settings.appendTo) {
115
- container = settings.appendTo.element;
116
- }
117
- else if (this.container) {
118
- container = this.container;
119
- }
120
- else {
121
- var appRoot = this.appRef.components && this.appRef.components[0];
122
- container = appRoot ? appRoot.location : null;
123
- }
124
- return container;
125
- };
126
- NotificationService = tslib_1.__decorate([
127
- Injectable(),
128
- tslib_1.__param(2, Inject(NOTIFICATION_CONTAINER)), tslib_1.__param(2, Optional()),
129
- tslib_1.__metadata("design:paramtypes", [ComponentFactoryResolver,
130
- Injector,
131
- ElementRef])
132
- ], NotificationService);
133
- return NotificationService;
134
- }());
135
- export { NotificationService };
@@ -1,41 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { style, animate } from '@angular/animations';
6
- /**
7
- * @hidden
8
- */
9
- export function slideAnimation(height, duration) {
10
- return [
11
- style({ overflow: 'hidden', height: 0 }),
12
- animate(duration + "ms ease-in", style({ height: height + "px" }))
13
- ];
14
- }
15
- /**
16
- * @hidden
17
- */
18
- export function slideCloseAnimation(height, duration) {
19
- return [
20
- style({ height: height + "px" }),
21
- animate(duration + "ms ease-in", style({ overflow: 'hidden', height: 0 }))
22
- ];
23
- }
24
- /**
25
- * @hidden
26
- */
27
- export function fadeAnimation(duration) {
28
- return [
29
- style({ opacity: 0 }),
30
- animate(duration + "ms ease-in", style({ opacity: 1 }))
31
- ];
32
- }
33
- /**
34
- * @hidden
35
- */
36
- export function fadeCloseAnimation(duration) {
37
- return [
38
- style({ opacity: 1 }),
39
- animate(duration + "ms ease-in", style({ opacity: 0 }))
40
- ];
41
- }
@@ -1,10 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Generated bundle index. Do not edit.
7
- */
8
- export * from './main';
9
- export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
10
- export { NotificationContainerComponent } from './notification.container.component';
@@ -1,10 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Generated bundle index. Do not edit.
7
- */
8
- export * from './main';
9
- export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
10
- export { NotificationContainerComponent } from './notification.container.component';
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"Position":{"__symbolic":"interface"},"Animation":{"__symbolic":"interface"},"NotificationRef":{"__symbolic":"interface"},"Type":{"__symbolic":"interface"},"NotificationSettings":{"__symbolic":"class","members":{}},"NotificationComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":37,"character":1},"arguments":[{"selector":"kendo-notification","template":"\n <ng-container kendoNotificationLocalizedMessages\n i18n-closeTitle=\"kendo.notification.closeTitle|The title of the close button\"\n closeTitle=\"Close\"\n >\n </ng-container>\n <div class=\"k-widget k-notification {{ notificationClasses() }}\"\n [ngClass]=\"cssClass\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\">\n <div class=\"k-notification-wrap k-hstack\">\n <span *ngIf=\"type && type.icon && type.style !== 'none'\" class=\"k-icon\" [ngClass]=\"typeIconClass()\"></span>\n\n <div class=\"k-notification-content\">\n <ng-template\n [ngIf]=\"templateRef\"\n [ngTemplateOutlet]=\"templateRef\">\n </ng-template>\n <ng-template\n [ngIf]=\"templateString\">\n {{ templateString }}\n </ng-template>\n <ng-container #container></ng-container>\n </div>\n\n <a *ngIf=\"closable\" class=\"k-icon k-i-close\" [attr.title]=\"closeButtonTitle\" (click)=\"onCloseClick()\"></a>\n </div>\n </div>\n ","providers":[{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"LocalizationService","line":69,"character":4},{"provide":{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"L10N_PREFIX","line":71,"character":17},"useValue":"kendo.notification"}]}]}],"members":{"container":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":77,"character":5},"arguments":["container",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":77,"character":36},"static":true}]}]}],"templateRef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":84,"character":5}}]}],"templateString":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":85,"character":5}}]}],"width":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":87,"character":5}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":88,"character":5}}]}],"cssClass":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":90,"character":5}}]}],"hideAfter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":92,"character":5}}]}],"closable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":93,"character":5}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":94,"character":5}}]}],"animation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":96,"character":5}}]}],"direction":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":103,"character":5},"arguments":["attr.dir"]}]}],"containerClass":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":105,"character":5},"arguments":["class.k-notification-container"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":121,"character":20},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":122,"character":25},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":123,"character":26},{"__symbolic":"reference","module":"@angular/animations","name":"AnimationBuilder","line":124,"character":25},{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"LocalizationService","line":125,"character":37}]}],"notificationClasses":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"typeClass":[{"__symbolic":"method"}],"typeIconClass":[{"__symbolic":"method"}],"onCloseClick":[{"__symbolic":"method"}],"hide":[{"__symbolic":"method"}],"setHideTimeout":[{"__symbolic":"method"}],"emitClose":[{"__symbolic":"method"}],"play":[{"__symbolic":"method"}],"animate":[{"__symbolic":"method"}],"slideAnimation":[{"__symbolic":"method"}],"fadeAnimation":[{"__symbolic":"method"}]}},"NotificationService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":64,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":76,"character":9},"arguments":[{"__symbolic":"reference","name":"NOTIFICATION_CONTAINER"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":76,"character":41}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":74,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":75,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":76,"character":71}]}],"show":[{"__symbolic":"method"}],"findGroupContainer":[{"__symbolic":"method"}]}},"NOTIFICATION_CONTAINER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":55,"character":42},"arguments":["Notification Container"]},"NotificationModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":40,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"NotificationComponent"},{"__symbolic":"reference","name":"NotificationContainerComponent"},{"__symbolic":"reference","name":"LocalizedMessagesDirective"}],"entryComponents":[{"__symbolic":"reference","name":"NotificationComponent"},{"__symbolic":"reference","name":"NotificationContainerComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":43,"character":14}],"exports":[{"__symbolic":"reference","name":"NotificationComponent"},{"__symbolic":"reference","name":"NotificationContainerComponent"}],"providers":[{"__symbolic":"reference","name":"NotificationService"}]}]}],"members":{}},"NotificationContainerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":23,"character":1},"arguments":[{"selector":"kendo-notification-container","template":"\n <div #group class=\"k-notification-group\">\n <ng-container #container></ng-container>\n </div>\n "}]}],"members":{"container":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":32,"character":5},"arguments":["container",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":32,"character":36},"static":true}]}]}],"group":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":35,"character":5},"arguments":["group",{"static":true}]}]}],"id":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":44,"character":24},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":45,"character":25},{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":46,"character":26}]}],"ngOnDestroy":[{"__symbolic":"method"}],"addNotification":[{"__symbolic":"method"}],"hide":[{"__symbolic":"method"}],"applyContainerWrap":[{"__symbolic":"method"}],"applySettings":[{"__symbolic":"method"}],"applyAbsolutePosition":[{"__symbolic":"method"}],"applyPosition":[{"__symbolic":"method"}],"setContainerPosition":[{"__symbolic":"method"}]}},"LocalizedMessagesDirective":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"ComponentMessages","line":15,"character":48},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"providers":[{"provide":{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"ComponentMessages","line":9,"character":21},"useExisting":{"__symbolic":"reference","name":"LocalizedMessagesDirective"}}],"selector":"[kendoNotificationLocalizedMessages]"}]}],"members":{"closeTitle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"LocalizationService","line":21,"character":35}]}]}}},"origins":{"Position":"./models/position","Animation":"./models/animation","NotificationRef":"./models/notification-ref","Type":"./models/type","NotificationSettings":"./models/notification-settings","NotificationComponent":"./notification.component","NotificationService":"./services/notification.service","NOTIFICATION_CONTAINER":"./services/notification.service","NotificationModule":"./notification.module","NotificationContainerComponent":"./notification.container.component","LocalizedMessagesDirective":"./localization/localized-messages.directive"},"importAs":"@progress/kendo-angular-notification"}