From 42707c162fc6a040af25c5044cf5ccfbeedb2564 Mon Sep 17 00:00:00 2001 From: William Martin Date: Wed, 2 Jul 2025 11:19:11 -0400 Subject: [PATCH] revert dialog --- .../src/dialog/dialog/dialog.component.html | 14 +++++++------- .../src/dialog/dialog/dialog.component.ts | 18 +++++++----------- .../directives/dialog-close.directive.ts | 6 +++--- .../dialog-title-container.directive.ts | 4 ++-- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/libs/components/src/dialog/dialog/dialog.component.html b/libs/components/src/dialog/dialog/dialog.component.html index a41a78e7113..eaf7fc2beec 100644 --- a/libs/components/src/dialog/dialog/dialog.component.html +++ b/libs/components/src/dialog/dialog/dialog.component.html @@ -22,7 +22,7 @@ noMargin class="tw-text-main tw-mb-0 tw-truncate" > - {{ title() }} + {{ title }} @if (subtitle) { {{ subtitle }} @@ -44,12 +44,12 @@
- @if (loading()) { + @if (loading) {
@@ -59,8 +59,8 @@ [ngClass]="{ 'tw-p-4': !disablePadding && !isDrawer, 'tw-px-6 tw-py-4': !disablePadding && isDrawer, - 'tw-overflow-y-auto': !loading(), - 'tw-invisible tw-overflow-y-hidden': loading(), + 'tw-overflow-y-auto': !loading, + 'tw-invisible tw-overflow-y-hidden': loading, }" > diff --git a/libs/components/src/dialog/dialog/dialog.component.ts b/libs/components/src/dialog/dialog/dialog.component.ts index 2036caa3791..f3daa218cdb 100644 --- a/libs/components/src/dialog/dialog/dialog.component.ts +++ b/libs/components/src/dialog/dialog/dialog.component.ts @@ -4,7 +4,7 @@ import { CdkTrapFocus } from "@angular/cdk/a11y"; import { coerceBooleanProperty } from "@angular/cdk/coercion"; import { CdkScrollable } from "@angular/cdk/scrolling"; import { CommonModule } from "@angular/common"; -import { Component, HostBinding, Input, inject, viewChild, input } from "@angular/core"; +import { Component, HostBinding, Input, inject, viewChild } from "@angular/core"; import { I18nPipe } from "@bitwarden/ui-common"; @@ -40,32 +40,28 @@ export class DialogComponent { protected bodyHasScrolledFrom = hasScrolledFrom(this.scrollableBody); /** Background color */ - readonly background = input<"default" | "alt">("default"); + @Input() + background: "default" | "alt" = "default"; /** * Dialog size, more complex dialogs should use large, otherwise default is fine. */ - readonly dialogSize = input<"small" | "default" | "large">("default"); + @Input() dialogSize: "small" | "default" | "large" = "default"; /** * Title to show in the dialog's header */ - readonly title = input(undefined); + @Input() title: string; /** * Subtitle to show in the dialog's header */ - // TODO: Skipped for migration because: - // This input is used in a control flow expression (e.g. `@if` or `*ngIf`) - // and migrating would break narrowing currently. @Input() subtitle: string; private _disablePadding = false; /** * Disable the built-in padding on the dialog, for use with tabbed dialogs. */ - // TODO: Skipped for migration because: - // Accessor inputs cannot be migrated as they are too complex. @Input() set disablePadding(value: boolean | "") { this._disablePadding = coerceBooleanProperty(value); } @@ -76,7 +72,7 @@ export class DialogComponent { /** * Mark the dialog as loading which replaces the content with a spinner. */ - readonly loading = input(false); + @Input() loading = false; @HostBinding("class") get classes() { // `tw-max-h-[90vh]` is needed to prevent dialogs from overlapping the desktop header @@ -96,7 +92,7 @@ export class DialogComponent { } get width() { - switch (this.dialogSize()) { + switch (this.dialogSize) { case "small": { return "md:tw-max-w-sm"; } diff --git a/libs/components/src/dialog/directives/dialog-close.directive.ts b/libs/components/src/dialog/directives/dialog-close.directive.ts index 66d1a996295..5e44ced7c21 100644 --- a/libs/components/src/dialog/directives/dialog-close.directive.ts +++ b/libs/components/src/dialog/directives/dialog-close.directive.ts @@ -1,11 +1,11 @@ import { DialogRef } from "@angular/cdk/dialog"; -import { Directive, HostBinding, HostListener, Optional, input } from "@angular/core"; +import { Directive, HostBinding, HostListener, Input, Optional } from "@angular/core"; @Directive({ selector: "[bitDialogClose]", }) export class DialogCloseDirective { - readonly dialogResult = input(undefined, { alias: "bitDialogClose" }); + @Input("bitDialogClose") dialogResult: any; constructor(@Optional() public dialogRef: DialogRef) {} @@ -20,6 +20,6 @@ export class DialogCloseDirective { return; } - this.dialogRef.close(this.dialogResult()); + this.dialogRef.close(this.dialogResult); } } diff --git a/libs/components/src/dialog/directives/dialog-title-container.directive.ts b/libs/components/src/dialog/directives/dialog-title-container.directive.ts index 683bda41cad..e17487f2780 100644 --- a/libs/components/src/dialog/directives/dialog-title-container.directive.ts +++ b/libs/components/src/dialog/directives/dialog-title-container.directive.ts @@ -1,5 +1,5 @@ import { CdkDialogContainer, DialogRef } from "@angular/cdk/dialog"; -import { Directive, HostBinding, OnInit, Optional, input } from "@angular/core"; +import { Directive, HostBinding, Input, OnInit, Optional } from "@angular/core"; // Increments for each instance of this component let nextId = 0; @@ -10,7 +10,7 @@ let nextId = 0; export class DialogTitleContainerDirective implements OnInit { @HostBinding("id") id = `bit-dialog-title-${nextId++}`; - readonly simple = input(false); + @Input() simple = false; constructor(@Optional() private dialogRef: DialogRef) {}