@progress/kendo-angular-dialog 7.0.1-dev.202205211501 → 7.1.0-dev.202206011433

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.
@@ -0,0 +1,5 @@
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
+ export {};
@@ -0,0 +1,5 @@
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
+ export {};
@@ -0,0 +1,19 @@
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 { animations } from "./animations";
6
+ import { createPlayer } from "./create-animation-player";
7
+ /**
8
+ * @hidden
9
+ */
10
+ export const animateContent = (animation, defAnimationConfig, animatedElement, builder) => {
11
+ let animationConfig = defAnimationConfig;
12
+ if (typeof animation !== 'boolean') {
13
+ animationConfig = animation;
14
+ animationConfig.duration = animationConfig.duration ? animationConfig.duration : defAnimationConfig.duration;
15
+ }
16
+ const animationSpecs = animations(animationConfig.duration, animationConfig.direction, animationConfig.type);
17
+ const player = createPlayer(builder, animationSpecs, animatedElement);
18
+ player.play();
19
+ };
@@ -0,0 +1,69 @@
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 { animate, keyframes, style } from '@angular/animations';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export function animations(duration, direction, animationType) {
10
+ switch (animationType) {
11
+ case 'slide':
12
+ const translate = direction === 'left' || direction === 'right' ? 'translateX' : 'translateY';
13
+ const start = direction === 'right' || direction === 'down' ? -100 : 100;
14
+ const end = 0;
15
+ return [
16
+ style({ transform: `${translate}(${start}%)` }),
17
+ animate(`${duration}ms ease-in`, style({ transform: `${translate}(${end}%)` }))
18
+ ];
19
+ case 'expand':
20
+ const scale = direction === 'up' || direction === 'down' ? 'scaleY' : 'scaleX';
21
+ const startScale = 0;
22
+ const endScale = 1;
23
+ let origin;
24
+ if (direction === 'down') {
25
+ origin = 'top';
26
+ }
27
+ else if (direction === 'left') {
28
+ origin = 'right';
29
+ }
30
+ else if (direction === 'right') {
31
+ origin = 'left';
32
+ }
33
+ else {
34
+ origin = 'bottom';
35
+ }
36
+ return [
37
+ style({ transform: `${scale}(${startScale})`, transformOrigin: origin }),
38
+ animate(`${duration}ms ease-in`, style({ transform: `${scale}(${endScale})` }))
39
+ ];
40
+ case 'zoom':
41
+ const startZoom = 0;
42
+ const endZoom = 1;
43
+ return [
44
+ animate(duration, keyframes([
45
+ style({ transform: `scale(${startZoom})` }),
46
+ style({ transform: `scale(${endZoom})` })
47
+ ]))
48
+ ];
49
+ case 'fade':
50
+ const startFade = 0;
51
+ const endFade = 1;
52
+ return [
53
+ animate(duration, keyframes([
54
+ style({ opacity: `${startFade}` }),
55
+ style({ opacity: `${endFade}` })
56
+ ]))
57
+ ];
58
+ case 'translate':
59
+ return [
60
+ style({ transform: 'translate(0, -10%)' }),
61
+ animate(`${duration}ms cubic-bezier(.2, 1, .2, 1)`)
62
+ ];
63
+ default:
64
+ return [
65
+ style({ transform: 'translate(0, -10%)' }),
66
+ animate(`${duration}ms cubic-bezier(.2, 1, .2, 1)`)
67
+ ];
68
+ }
69
+ }
@@ -0,0 +1,18 @@
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 const createPlayer = (builder, animation, animatedElement) => {
9
+ const factory = builder.build(animation);
10
+ let player = factory.create(animatedElement);
11
+ player.onDone(() => {
12
+ if (player) {
13
+ player.destroy();
14
+ player = null;
15
+ }
16
+ });
17
+ return player;
18
+ };
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { DialogActionsComponent } from './dialog-actions.component';
6
6
  import { DialogTitleBarComponent } from './dialog-titlebar.component';
7
- import { Component, ViewChild } from '@angular/core';
7
+ import { Directive, ViewChild } from '@angular/core';
8
8
  import { filter } from 'rxjs/operators';
9
9
  import * as i0 from "@angular/core";
10
10
  import * as i1 from "./models/dialog-ref";
@@ -33,14 +33,10 @@ export class DialogContentBase {
33
33
  }
34
34
  }
35
35
  }
36
- DialogContentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogContentBase, deps: [{ token: i1.DialogRef }], target: i0.ɵɵFactoryTarget.Component });
37
- DialogContentBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DialogContentBase, selector: "kendo-dialog-content-base", viewQueries: [{ propertyName: "dialogTitleBar", first: true, predicate: DialogTitleBarComponent, descendants: true }, { propertyName: "dialogActions", first: true, predicate: DialogActionsComponent, descendants: true }], ngImport: i0, template: ``, isInline: true });
36
+ DialogContentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogContentBase, deps: [{ token: i1.DialogRef }], target: i0.ɵɵFactoryTarget.Directive });
37
+ DialogContentBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DialogContentBase, viewQueries: [{ propertyName: "dialogTitleBar", first: true, predicate: DialogTitleBarComponent, descendants: true }, { propertyName: "dialogActions", first: true, predicate: DialogActionsComponent, descendants: true }], ngImport: i0 });
38
38
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogContentBase, decorators: [{
39
- type: Component,
40
- args: [{
41
- template: ``,
42
- selector: 'kendo-dialog-content-base'
43
- }]
39
+ type: Directive
44
40
  }], ctorParameters: function () { return [{ type: i1.DialogRef }]; }, propDecorators: { dialogTitleBar: [{
45
41
  type: ViewChild,
46
42
  args: [DialogTitleBarComponent, { static: false }]
@@ -14,21 +14,25 @@ import { DialogCloseResult } from './models/dialog-close-result';
14
14
  import { DIALOG_LOCALIZATION_SERVICE } from './../localization/dialog-localization.service';
15
15
  import { take } from 'rxjs/operators';
16
16
  import { Subscription } from 'rxjs';
17
+ import { animateContent } from './dialog-animations/animate-content';
17
18
  import * as i0 from "@angular/core";
18
19
  import * as i1 from "@progress/kendo-angular-l10n";
19
- import * as i2 from "./dialog-titlebar.component";
20
- import * as i3 from "./dialog-actions.component";
21
- import * as i4 from "../localization/localized-messages.directive";
22
- import * as i5 from "@angular/common";
20
+ import * as i2 from "@angular/animations";
21
+ import * as i3 from "./dialog-titlebar.component";
22
+ import * as i4 from "./dialog-actions.component";
23
+ import * as i5 from "../localization/localized-messages.directive";
24
+ import * as i6 from "@angular/common";
25
+ const DEFAULT_ANIMATION_CONFIG = { duration: 300, type: 'translate' };
23
26
  /**
24
27
  * Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
25
28
  */
26
29
  export class DialogComponent {
27
- constructor(wrapper, renderer, localization, cdr, ngZone) {
30
+ constructor(wrapper, renderer, localization, cdr, ngZone, builder) {
28
31
  this.wrapper = wrapper;
29
32
  this.renderer = renderer;
30
33
  this.cdr = cdr;
31
34
  this.ngZone = ngZone;
35
+ this.builder = builder;
32
36
  /**
33
37
  * Specifies the layout of the action buttons in the Dialog.
34
38
  * This option is only applicable if the action buttons are specified through the `actions` options.
@@ -36,6 +40,13 @@ export class DialogComponent {
36
40
  * @default 'stretched'
37
41
  */
38
42
  this.actionsLayout = 'stretched';
43
+ /**
44
+ * Configures the Dialog opening animation ([see example]({% slug animations_dialog %})).
45
+ * By default the animation type is set to `translate` and its duration is `300ms`.
46
+ *
47
+ * @default true
48
+ */
49
+ this.animation = true;
39
50
  /**
40
51
  * @hidden
41
52
  */
@@ -134,6 +145,9 @@ export class DialogComponent {
134
145
  this.initDomEvents();
135
146
  }
136
147
  ngOnInit() {
148
+ if (this.animation) {
149
+ animateContent(this.animation, DEFAULT_ANIMATION_CONFIG, this.dialog.nativeElement, this.builder);
150
+ }
137
151
  this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
138
152
  this.cdr.detectChanges();
139
153
  }
@@ -326,8 +340,8 @@ export class DialogComponent {
326
340
  }
327
341
  }
328
342
  }
329
- DialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
330
- DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DialogComponent, selector: "kendo-dialog", inputs: { actions: "actions", actionsLayout: "actionsLayout", autoFocusedElement: "autoFocusedElement", title: "title", width: "width", minWidth: "minWidth", maxWidth: "maxWidth", height: "height", minHeight: "minHeight", maxHeight: "maxHeight" }, outputs: { action: "action", close: "close" }, host: { properties: { "attr.dir": "this.dir", "attr.tabIndex": "this.tabIndex", "class.k-dialog-wrapper": "this.wrapperClass" } }, providers: [
343
+ DialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i2.AnimationBuilder }], target: i0.ɵɵFactoryTarget.Component });
344
+ DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DialogComponent, selector: "kendo-dialog", inputs: { actions: "actions", actionsLayout: "actionsLayout", autoFocusedElement: "autoFocusedElement", title: "title", width: "width", minWidth: "minWidth", maxWidth: "maxWidth", height: "height", minHeight: "minHeight", maxHeight: "maxHeight", animation: "animation" }, outputs: { action: "action", close: "close" }, host: { properties: { "attr.dir": "this.dir", "attr.tabIndex": "this.tabIndex", "class.k-dialog-wrapper": "this.wrapperClass" } }, providers: [
331
345
  LocalizationService,
332
346
  {
333
347
  provide: DIALOG_LOCALIZATION_SERVICE,
@@ -337,7 +351,7 @@ DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
337
351
  provide: L10N_PREFIX,
338
352
  useValue: 'kendo.dialog'
339
353
  }
340
- ], queries: [{ propertyName: "titlebarContent", predicate: DialogTitleBarComponent }], viewQueries: [{ propertyName: "actionsView", first: true, predicate: DialogActionsComponent, descendants: true }, { propertyName: "titlebarView", predicate: DialogTitleBarComponent, descendants: true }], exportAs: ["kendoDialog"], ngImport: i0, template: `
354
+ ], queries: [{ propertyName: "titlebarContent", predicate: DialogTitleBarComponent }], viewQueries: [{ propertyName: "actionsView", first: true, predicate: DialogActionsComponent, descendants: true }, { propertyName: "dialog", first: true, predicate: ["dialog"], descendants: true, static: true }, { propertyName: "titlebarView", predicate: DialogTitleBarComponent, descendants: true }], exportAs: ["kendoDialog"], ngImport: i0, template: `
341
355
  <ng-container
342
356
  kendoDialogLocalizedMessages
343
357
  i18n-closeTitle="kendo.dialog.closeTitle|The title of the close button"
@@ -345,7 +359,7 @@ DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
345
359
  >
346
360
  <div class="k-overlay" @overlayAppear></div>
347
361
 
348
- <div class="k-window k-dialog" role="dialog" aria-modal="true" [ngStyle]="styles" @dialogSlideInAppear>
362
+ <div #dialog class="k-window k-dialog" role="dialog" aria-modal="true" [ngStyle]="styles">
349
363
  <kendo-dialog-titlebar *ngIf="title" [closeTitle]="closeTitle" [id]="titleId">{{ title }}</kendo-dialog-titlebar>
350
364
  <ng-content select="kendo-dialog-titlebar" *ngIf="!title"></ng-content>
351
365
 
@@ -358,14 +372,10 @@ DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
358
372
  <kendo-dialog-actions *ngIf="actions" [actions]="actions" [layout]="actionsLayout"> </kendo-dialog-actions>
359
373
  </div>
360
374
  </ng-container>
361
- `, isInline: true, components: [{ type: i2.DialogTitleBarComponent, selector: "kendo-dialog-titlebar", inputs: ["id", "closeTitle"], outputs: ["close"] }, { type: i3.DialogActionsComponent, selector: "kendo-dialog-actions", inputs: ["actions", "layout"], outputs: ["action"] }], directives: [{ type: i4.LocalizedMessagesDirective, selector: "\n [kendoDialogLocalizedMessages],\n [kendoWindowLocalizedMessages],\n [kendoDialogTitleBarLocalizedMessages]\n " }, { type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
375
+ `, isInline: true, components: [{ type: i3.DialogTitleBarComponent, selector: "kendo-dialog-titlebar", inputs: ["id", "closeTitle"], outputs: ["close"] }, { type: i4.DialogActionsComponent, selector: "kendo-dialog-actions", inputs: ["actions", "layout"], outputs: ["action"] }], directives: [{ type: i5.LocalizedMessagesDirective, selector: "\n [kendoDialogLocalizedMessages],\n [kendoWindowLocalizedMessages],\n [kendoDialogTitleBarLocalizedMessages]\n " }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
362
376
  trigger('overlayAppear', [
363
377
  state('in', style({ opacity: 1 })),
364
378
  transition('void => *', [style({ opacity: 0.1 }), animate('.3s cubic-bezier(.2, .6, .4, 1)')])
365
- ]),
366
- trigger('dialogSlideInAppear', [
367
- state('in', style({ transform: 'translate(0, 0)' })),
368
- transition('void => *', [style({ transform: 'translate(0, -10%)' }), animate('.3s cubic-bezier(.2, 1, .2, 1)')])
369
379
  ])
370
380
  ] });
371
381
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DialogComponent, decorators: [{
@@ -375,10 +385,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
375
385
  trigger('overlayAppear', [
376
386
  state('in', style({ opacity: 1 })),
377
387
  transition('void => *', [style({ opacity: 0.1 }), animate('.3s cubic-bezier(.2, .6, .4, 1)')])
378
- ]),
379
- trigger('dialogSlideInAppear', [
380
- state('in', style({ transform: 'translate(0, 0)' })),
381
- transition('void => *', [style({ transform: 'translate(0, -10%)' }), animate('.3s cubic-bezier(.2, 1, .2, 1)')])
382
388
  ])
383
389
  ],
384
390
  exportAs: 'kendoDialog',
@@ -402,7 +408,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
402
408
  >
403
409
  <div class="k-overlay" @overlayAppear></div>
404
410
 
405
- <div class="k-window k-dialog" role="dialog" aria-modal="true" [ngStyle]="styles" @dialogSlideInAppear>
411
+ <div #dialog class="k-window k-dialog" role="dialog" aria-modal="true" [ngStyle]="styles">
406
412
  <kendo-dialog-titlebar *ngIf="title" [closeTitle]="closeTitle" [id]="titleId">{{ title }}</kendo-dialog-titlebar>
407
413
  <ng-content select="kendo-dialog-titlebar" *ngIf="!title"></ng-content>
408
414
 
@@ -417,7 +423,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
417
423
  </ng-container>
418
424
  `
419
425
  }]
420
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { actions: [{
426
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i2.AnimationBuilder }]; }, propDecorators: { actions: [{
421
427
  type: Input
422
428
  }], actionsLayout: [{
423
429
  type: Input
@@ -437,6 +443,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
437
443
  type: Input
438
444
  }], maxHeight: [{
439
445
  type: Input
446
+ }], animation: [{
447
+ type: Input
440
448
  }], action: [{
441
449
  type: Output
442
450
  }], close: [{
@@ -456,6 +464,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
456
464
  }], actionsView: [{
457
465
  type: ViewChild,
458
466
  args: [DialogActionsComponent, { static: false }]
467
+ }], dialog: [{
468
+ type: ViewChild,
469
+ args: ['dialog', { static: true }]
459
470
  }], wrapperClass: [{
460
471
  type: HostBinding,
461
472
  args: ['class.k-dialog-wrapper']
@@ -181,6 +181,7 @@ See https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/.
181
181
  instance.closeTitle = options.closeTitle;
182
182
  instance.cssClass = options.cssClass;
183
183
  instance.htmlAttributes = options.htmlAttributes;
184
+ instance.animation = options.animation !== undefined ? options.animation : true;
184
185
  if (options.content instanceof TemplateRef) {
185
186
  instance.contentTemplate = options.content;
186
187
  }
@@ -0,0 +1,5 @@
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
+ export {};
@@ -7,3 +7,4 @@ export * from './dialog-close-result';
7
7
  export * from './dialog-ref';
8
8
  export * from './dialog-result';
9
9
  export * from './dialog-settings';
10
+ export * from './dialog-animation';
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-dialog',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1653145288,
12
+ publishDate: 1654093973,
13
13
  version: '',
14
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
15
  };