1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[CL-553] Migrate CL to Control Flow syntax (#12390)

This commit is contained in:
Oscar Hinton
2025-02-03 20:11:59 +01:00
committed by GitHub
parent 444e928895
commit e5ffc162b8
47 changed files with 480 additions and 428 deletions

View File

@@ -9,11 +9,17 @@
>
<span bitTypography="body2">
<ng-content select="bit-label"></ng-content>
<span *ngIf="required" class="tw-text-xs tw-font-normal"> ({{ "required" | i18n }})</span>
@if (required) {
<span class="tw-text-xs tw-font-normal"> ({{ "required" | i18n }})</span>
}
</span>
<ng-content select="bit-hint" *ngIf="!hasError"></ng-content>
@if (!hasError) {
<ng-content select="bit-hint"></ng-content>
}
</span>
</label>
<div *ngIf="hasError" class="tw-mt-1 tw-text-danger tw-text-xs tw-ml-0.5">
<i class="bwi bwi-error"></i> {{ displayError }}
</div>
@if (hasError) {
<div class="tw-mt-1 tw-text-danger tw-text-xs tw-ml-0.5">
<i class="bwi bwi-error"></i> {{ displayError }}
</div>
}

View File

@@ -1,7 +1,7 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { NgClass, NgIf } from "@angular/common";
import { NgClass } from "@angular/common";
import { Component, ContentChild, HostBinding, Input } from "@angular/core";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -15,7 +15,7 @@ import { BitFormControlAbstraction } from "./form-control.abstraction";
selector: "bit-form-control",
templateUrl: "form-control.component.html",
standalone: true,
imports: [NgClass, TypographyDirective, NgIf, I18nPipe],
imports: [NgClass, TypographyDirective, I18nPipe],
})
export class FormControlComponent {
@Input() label: string;

View File

@@ -5,10 +5,10 @@
<!-- labels inside a form control (checkbox, radio button) should not truncate -->
<span [ngClass]="{ 'tw-truncate': !isInsideFormControl }">
<ng-content></ng-content>
<ng-container *ngIf="isInsideFormControl">
@if (isInsideFormControl) {
<ng-container *ngTemplateOutlet="endSlotContent"></ng-container>
</ng-container>
}
</span>
<ng-container *ngIf="!isInsideFormControl">
@if (!isInsideFormControl) {
<ng-container *ngTemplateOutlet="endSlotContent"></ng-container>
</ng-container>
}