@fundamental-ngx/core 0.62.0-rc.55 → 0.62.0-rc.57

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, computed, signal, input, booleanAttribute, Optional, ChangeDetectionStrategy, ViewEncapsulation, Component, contentChildren, inject, Injector, effect, Directive, DestroyRef, ElementRef, afterNextRender, isDevMode, ContentChild, ViewChild, Input, ComponentRef, EmbeddedViewRef, Type, TemplateRef, HostListener, HostBinding, PLATFORM_ID, Inject, NgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, computed, signal, input, booleanAttribute, Optional, ChangeDetectionStrategy, ViewEncapsulation, Component, contentChildren, inject, Injector, effect, Directive, DestroyRef, ElementRef, afterNextRender, isDevMode, ContentChild, ViewChild, Input, ComponentRef, EmbeddedViewRef, Type, TemplateRef, PLATFORM_ID, Inject, NgModule } from '@angular/core';
3
3
  import * as i3$2 from '@angular/cdk/portal';
4
4
  import { PortalModule, CdkPortalOutlet, ComponentPortal } from '@angular/cdk/portal';
5
5
  import { AsyncPipe, NgTemplateOutlet, isPlatformBrowser } from '@angular/common';
@@ -23,7 +23,6 @@ import { CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
23
23
  import { ESCAPE } from '@angular/cdk/keycodes';
24
24
  import { Router, NavigationStart } from '@angular/router';
25
25
  import { filter } from 'rxjs/operators';
26
- import { trigger, state, style, transition, animate } from '@angular/animations';
27
26
 
28
27
  const FD_DIALOG_BODY_COMPONENT = new InjectionToken('FdDialogBodyComponent');
29
28
  const FD_DIALOG_FOCUS_TRAP_ERROR = new InjectionToken('FdDialogFocusTrapError');
@@ -1129,25 +1128,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
1129
1128
  ], template: "<fd-dialog>\n <fd-dialog-header>\n <div\n role=\"heading\"\n [attr.aria-level]=\"_defaultDialogContent?.titleHeadingLevel || 1\"\n fd-title\n [id]=\"_defaultDialogContent?.titleId || dialogTitleId\"\n >\n {{ _defaultDialogContent?.title }}\n </div>\n @if (_defaultDialogContent?.allowFullScreen) {\n <button\n fd-dialog-full-screen-toggler-button\n #fullScreenTogglerButton\n [title]=\"\n (fullScreenTogglerButton._fullscreen$()\n ? _defaultDialogContent?.fullScreenMinifyButtonText\n : _defaultDialogContent?.fullScreenExpandButtonText) || ''\n \"\n (click)=\"_fullScreenButtonClicked()\"\n ></button>\n }\n @if (_defaultDialogContent?.closeButtonCallback) {\n <button\n fd-dialog-close-button\n [title]=\"_defaultDialogContent?.closeButtonTitle || ''\"\n [ariaLabel]=\"_defaultDialogContent?.closeButtonAriaLabel || ''\"\n (click)=\"_closeButtonClicked()\"\n ></button>\n }\n @if (_defaultDialogContent?.subHeader) {\n <ng-template fdkTemplate=\"subheader\">\n <ng-template [ngTemplateOutlet]=\"_defaultDialogContent!.subHeader!\"></ng-template>\n </ng-template>\n }\n </fd-dialog-header>\n @if (_defaultDialogContent?.content) {\n <fd-dialog-body [id]=\"_defaultDialogContent?.contentId || dialogContentId\">\n <ng-template [ngTemplateOutlet]=\"_defaultDialogContent?.content!\"></ng-template>\n </fd-dialog-body>\n }\n @if (_showFooter()) {\n <fd-dialog-footer>\n @if (_defaultDialogContent?.approveButton) {\n <fd-button-bar\n fdType=\"emphasized\"\n fdkInitialFocus\n [label]=\"_defaultDialogContent?.approveButton || ''\"\n [fdCozy]=\"_defaultDialogConfiguration.mobile\"\n (click)=\"_approveButtonClicked()\"\n [ariaLabel]=\"_defaultDialogContent?.approveButtonAriaLabel\"\n [id]=\"_defaultDialogContent?.approveButtonId || ''\"\n >\n </fd-button-bar>\n }\n @if (_defaultDialogContent?.cancelButton) {\n <fd-button-bar\n [label]=\"_defaultDialogContent?.cancelButton || ''\"\n [fdCozy]=\"_defaultDialogConfiguration.mobile\"\n (click)=\"_cancelButtonClicked()\"\n [ariaLabel]=\"_defaultDialogContent?.closeButtonAriaLabel\"\n [id]=\"_defaultDialogContent?.cancelButtonId || ''\"\n >\n </fd-button-bar>\n }\n </fd-dialog-footer>\n }\n</fd-dialog>\n" }]
1130
1129
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: DialogConfig }] });
1131
1130
 
1132
- const dialogFade = trigger('state', [
1133
- state('void, hidden', style({
1134
- opacity: 0,
1135
- position: 'relative',
1136
- zIndex: 999
1137
- })),
1138
- state('visible', style({
1139
- opacity: 1,
1140
- position: 'relative',
1141
- zIndex: 999
1142
- })),
1143
- transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
1144
- transition('* => void, * => hidden', animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', style({
1145
- opacity: 0,
1146
- position: 'relative',
1147
- zIndex: 999
1148
- })))
1149
- ]);
1150
-
1151
1131
  /** Dialog container where the dialog content is embedded. */
1152
1132
  class DialogContainerComponent extends DynamicComponentContainer {
1153
1133
  /** Custom classes */
@@ -1155,10 +1135,6 @@ class DialogContainerComponent extends DynamicComponentContainer {
1155
1135
  this._class = userClass;
1156
1136
  this.buildComponentCssClass();
1157
1137
  }
1158
- /** The state of the Dialog animations. */
1159
- get _animationState() {
1160
- return this._animationStateSignal();
1161
- }
1162
1138
  /** @hidden */
1163
1139
  constructor(dialogConfig, ref, _destroyRef, elementRef, _cdr, injector) {
1164
1140
  super(elementRef, injector);
@@ -1168,21 +1144,19 @@ class DialogContainerComponent extends DynamicComponentContainer {
1168
1144
  this._cdr = _cdr;
1169
1145
  /** @hidden */
1170
1146
  this._class = '';
1171
- /** @hidden */
1147
+ /** @hidden Tracks the current animation phase for lifecycle management. */
1172
1148
  this._animationStateSignal = signal('void', ...(ngDevMode ? [{ debugName: "_animationStateSignal" }] : []));
1149
+ /** @hidden Reference to the current Web Animation for cleanup. */
1150
+ this._currentAnimation = null;
1151
+ this._destroyRef.onDestroy(() => {
1152
+ this._currentAnimation?.cancel();
1153
+ this._currentAnimation = null;
1154
+ });
1173
1155
  }
1174
1156
  /** @hidden */
1175
1157
  buildComponentCssClass() {
1176
1158
  return [this.dialogConfig.containerClass ? this.dialogConfig.containerClass : '', this._class];
1177
1159
  }
1178
- /** Handle end of animations, updating the state of the Message Toast. */
1179
- onAnimationEnd(event) {
1180
- const { toState } = event;
1181
- if (toState === 'hidden') {
1182
- this.ref._endClose$.next();
1183
- this.ref._endClose$.complete();
1184
- }
1185
- }
1186
1160
  /** @hidden */
1187
1161
  ngAfterViewInit() {
1188
1162
  setTimeout(() => {
@@ -1213,7 +1187,7 @@ class DialogContainerComponent extends DynamicComponentContainer {
1213
1187
  else {
1214
1188
  this._createFromDefaultDialog(this.childContent);
1215
1189
  }
1216
- this._animationStateSignal.set('visible');
1190
+ this._enter();
1217
1191
  }
1218
1192
  /** @hidden Returns context for embedded template */
1219
1193
  _templateContext() {
@@ -1226,21 +1200,64 @@ class DialogContainerComponent extends DynamicComponentContainer {
1226
1200
  instance._defaultDialogContent = config;
1227
1201
  instance._defaultDialogConfiguration = this.dialogConfig;
1228
1202
  }
1203
+ /** @hidden Animate the dialog container entrance (opacity 0 → 1). */
1204
+ _enter() {
1205
+ const el = this.elementRef.nativeElement;
1206
+ if (typeof el.animate !== 'function') {
1207
+ el.style.opacity = '1';
1208
+ this._animationStateSignal.set('visible');
1209
+ return;
1210
+ }
1211
+ this._currentAnimation = el.animate([{ opacity: 0 }, { opacity: 1 }], {
1212
+ duration: 150,
1213
+ easing: 'cubic-bezier(0, 0, 0.2, 1)',
1214
+ fill: 'forwards'
1215
+ });
1216
+ this._currentAnimation.finished
1217
+ .then(() => {
1218
+ el.style.opacity = '1';
1219
+ this._currentAnimation?.cancel();
1220
+ this._currentAnimation = null;
1221
+ this._animationStateSignal.set('visible');
1222
+ })
1223
+ .catch(() => {
1224
+ this._currentAnimation = null;
1225
+ });
1226
+ }
1227
+ /** @hidden Animate the dialog container exit (opacity 1 → 0). */
1228
+ _exit() {
1229
+ const el = this.elementRef.nativeElement;
1230
+ this._animationStateSignal.set('hidden');
1231
+ this._cdr.detectChanges();
1232
+ if (typeof el.animate !== 'function') {
1233
+ return;
1234
+ }
1235
+ this._currentAnimation?.cancel();
1236
+ this._currentAnimation = el.animate([{ opacity: 1 }, { opacity: 0 }], {
1237
+ duration: 75,
1238
+ easing: 'cubic-bezier(0.4, 0, 1, 1)',
1239
+ fill: 'forwards'
1240
+ });
1241
+ this._currentAnimation.finished
1242
+ .then(() => {
1243
+ this._currentAnimation = null;
1244
+ })
1245
+ .catch(() => {
1246
+ this._currentAnimation = null;
1247
+ });
1248
+ }
1229
1249
  /**
1230
1250
  * @hidden
1231
- * We need to wait until animation plays, and then send signal to the service to destroy the component.
1251
+ * Listen for dialog close/dismiss and trigger exit animation.
1232
1252
  */
1233
1253
  _listenOnClose() {
1234
- const callback = () => {
1235
- this._animationStateSignal.set('hidden');
1236
- };
1237
1254
  this.ref.afterClosed.pipe(takeUntilDestroyed(this._destroyRef)).subscribe({
1238
- next: () => callback(),
1239
- error: () => callback()
1255
+ next: () => this._exit(),
1256
+ error: () => this._exit()
1240
1257
  });
1241
1258
  }
1242
1259
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: DialogContainerComponent, deps: [{ token: DialogConfig }, { token: DialogRef }, { token: i0.DestroyRef }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
1243
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: DialogContainerComponent, isStandalone: true, selector: "fd-dialog-container", inputs: { class: "class" }, host: { listeners: { "@state.done": "onAnimationEnd($event)" }, properties: { "@state": "this._animationState" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], usesInheritance: true, ngImport: i0, template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>', isInline: true, styles: [":host:not(:first-of-type) ::ng-deep .fd-dialog:before{opacity:0}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i3$2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [dialogFade], encapsulation: i0.ViewEncapsulation.None }); }
1260
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: DialogContainerComponent, isStandalone: true, selector: "fd-dialog-container", inputs: { class: "class" }, host: { styleAttribute: "opacity: 0; position: relative; z-index: 999" }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], usesInheritance: true, ngImport: i0, template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>', isInline: true, styles: [":host:not(:first-of-type) ::ng-deep .fd-dialog:before{opacity:0}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i3$2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], encapsulation: i0.ViewEncapsulation.None }); }
1244
1261
  }
1245
1262
  __decorate([
1246
1263
  applyCssClass,
@@ -1250,19 +1267,15 @@ __decorate([
1250
1267
  ], DialogContainerComponent.prototype, "buildComponentCssClass", null);
1251
1268
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: DialogContainerComponent, decorators: [{
1252
1269
  type: Component,
1253
- args: [{ selector: 'fd-dialog-container', template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>', animations: [dialogFade], encapsulation: ViewEncapsulation.None, standalone: true, imports: [PortalModule], styles: [":host:not(:first-of-type) ::ng-deep .fd-dialog:before{opacity:0}\n"] }]
1270
+ args: [{ selector: 'fd-dialog-container', template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>', encapsulation: ViewEncapsulation.None, imports: [PortalModule], host: {
1271
+ style: 'opacity: 0; position: relative; z-index: 999'
1272
+ }, styles: [":host:not(:first-of-type) ::ng-deep .fd-dialog:before{opacity:0}\n"] }]
1254
1273
  }], ctorParameters: () => [{ type: DialogConfig }, { type: DialogRef }, { type: i0.DestroyRef }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }], propDecorators: { class: [{
1255
1274
  type: Input
1256
1275
  }], portalOutlet: [{
1257
1276
  type: ViewChild,
1258
1277
  args: [CdkPortalOutlet]
1259
- }], _animationState: [{
1260
- type: HostBinding,
1261
- args: ['@state']
1262
- }], buildComponentCssClass: [], onAnimationEnd: [{
1263
- type: HostListener,
1264
- args: ['@state.done', ['$event']]
1265
- }] } });
1278
+ }], buildComponentCssClass: [] } });
1266
1279
 
1267
1280
  /** Service used to create a dialog. */
1268
1281
  class DialogService extends DialogBaseService {
@@ -1527,5 +1540,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
1527
1540
  * Generated bundle index. Do not edit.
1528
1541
  */
1529
1542
 
1530
- export { DIALOG_DEFAULT_CONFIG, DialogBase, DialogBaseService, DialogBodyComponent, DialogButtonClass, DialogCloseButtonComponent, DialogComponent, DialogConfig, DialogConfigBase, DialogContainerComponent, DialogContentBase, DialogDefaultComponent, DialogDefaultContent, DialogFooterBase, DialogFooterComponent, DialogFullScreenTogglerButtonComponent, DialogHeaderBase, DialogHeaderComponent, DialogModule, DialogOverlayContainer, DialogPosition, DialogRef, DialogRefBase, DialogService, DialogTemplateDirective, DialogTitleDirective, FD_DIALOG_BODY_COMPONENT, FD_DIALOG_DISMISS_REASON, FD_DIALOG_FOCUS_TRAP_ERROR, dialogFade, provideDialogService };
1543
+ export { DIALOG_DEFAULT_CONFIG, DialogBase, DialogBaseService, DialogBodyComponent, DialogButtonClass, DialogCloseButtonComponent, DialogComponent, DialogConfig, DialogConfigBase, DialogContainerComponent, DialogContentBase, DialogDefaultComponent, DialogDefaultContent, DialogFooterBase, DialogFooterComponent, DialogFullScreenTogglerButtonComponent, DialogHeaderBase, DialogHeaderComponent, DialogModule, DialogOverlayContainer, DialogPosition, DialogRef, DialogRefBase, DialogService, DialogTemplateDirective, DialogTitleDirective, FD_DIALOG_BODY_COMPONENT, FD_DIALOG_DISMISS_REASON, FD_DIALOG_FOCUS_TRAP_ERROR, provideDialogService };
1531
1544
  //# sourceMappingURL=fundamental-ngx-core-dialog.mjs.map