mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
Use Signal inputs and make files ts-strict compliant (#16778)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
da8a0104ea
commit
0df7215d6e
@@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
|
||||
@@ -15,10 +13,10 @@ import { FilePopoutUtilsService } from "../services/file-popout-utils.service";
|
||||
imports: [CommonModule, JslibModule, CalloutModule],
|
||||
})
|
||||
export class FilePopoutCalloutComponent implements OnInit {
|
||||
protected showFilePopoutMessage: boolean;
|
||||
protected showFirefoxFileWarning: boolean;
|
||||
protected showSafariFileWarning: boolean;
|
||||
protected showChromiumFileWarning: boolean;
|
||||
protected showFilePopoutMessage: boolean = false;
|
||||
protected showFirefoxFileWarning: boolean = false;
|
||||
protected showSafariFileWarning: boolean = false;
|
||||
protected showChromiumFileWarning: boolean = false;
|
||||
|
||||
constructor(private filePopoutUtilsService: FilePopoutUtilsService) {}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Component, input, OnInit } from "@angular/core";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
@@ -18,7 +16,7 @@ import { SendFilePopoutDialogComponent } from "./send-file-popout-dialog.compone
|
||||
imports: [JslibModule, CommonModule],
|
||||
})
|
||||
export class SendFilePopoutDialogContainerComponent implements OnInit {
|
||||
@Input() config: SendFormConfig;
|
||||
config = input.required<SendFormConfig>();
|
||||
|
||||
constructor(
|
||||
private dialogService: DialogService,
|
||||
@@ -27,8 +25,8 @@ export class SendFilePopoutDialogContainerComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
if (
|
||||
this.config?.sendType === SendType.File &&
|
||||
this.config?.mode === "add" &&
|
||||
this.config().sendType === SendType.File &&
|
||||
this.config().mode === "add" &&
|
||||
this.filePopoutUtilsService.showFilePopoutMessage(window)
|
||||
) {
|
||||
this.dialogService.open(SendFilePopoutDialogComponent);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<bit-section [formGroup]="sendFileDetailsForm">
|
||||
<div *ngIf="config.mode === 'edit'">
|
||||
<div *ngIf="config().mode === 'edit'">
|
||||
<div bitTypography="body2" class="tw-text-muted">{{ "file" | i18n }}</div>
|
||||
<div data-testid="file-name">{{ originalSendView.file.fileName }}</div>
|
||||
<div data-testid="file-size" class="tw-text-muted">{{ originalSendView.file.sizeName }}</div>
|
||||
<div data-testid="file-name">{{ originalSendView().file.fileName }}</div>
|
||||
<div data-testid="file-size" class="tw-text-muted">{{ originalSendView().file.sizeName }}</div>
|
||||
</div>
|
||||
<bit-form-field *ngIf="config.mode !== 'edit'">
|
||||
<bit-form-field *ngIf="config().mode !== 'edit'">
|
||||
<bit-label for="file">{{ "fileToShare" | i18n }}</bit-label>
|
||||
<div class="tw-flex tw-mt-2 tw-mb-1">
|
||||
<button bitButton type="button" buttonType="secondary" (click)="fileSelector.click()">
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Component, input, OnInit } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { FormBuilder, Validators, ReactiveFormsModule, FormsModule } from "@angular/forms";
|
||||
|
||||
@@ -34,8 +32,8 @@ import { SendFormContainer } from "../../send-form-container";
|
||||
],
|
||||
})
|
||||
export class SendFileDetailsComponent implements OnInit {
|
||||
@Input() config: SendFormConfig;
|
||||
@Input() originalSendView?: SendView;
|
||||
config = input.required<SendFormConfig>();
|
||||
originalSendView = input<SendView>();
|
||||
|
||||
sendFileDetailsForm = this.formBuilder.group({
|
||||
file: this.formBuilder.control<SendFileView | null>(null, Validators.required),
|
||||
@@ -69,13 +67,13 @@ export class SendFileDetailsComponent implements OnInit {
|
||||
};
|
||||
|
||||
ngOnInit() {
|
||||
if (this.originalSendView) {
|
||||
if (this.originalSendView()) {
|
||||
this.sendFileDetailsForm.patchValue({
|
||||
file: this.originalSendView.file,
|
||||
file: this.originalSendView()?.file,
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.config.areSendsAllowed) {
|
||||
if (!this.config().areSendsAllowed) {
|
||||
this.sendFileDetailsForm.disable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Component, input, OnInit } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { FormBuilder, FormControl, Validators, ReactiveFormsModule } from "@angular/forms";
|
||||
|
||||
@@ -25,8 +23,8 @@ import { SendFormContainer } from "../../send-form-container";
|
||||
],
|
||||
})
|
||||
export class SendTextDetailsComponent implements OnInit {
|
||||
@Input() config: SendFormConfig;
|
||||
@Input() originalSendView?: SendView;
|
||||
config = input.required<SendFormConfig>();
|
||||
originalSendView = input<SendView>();
|
||||
|
||||
sendTextDetailsForm = this.formBuilder.group({
|
||||
text: new FormControl("", Validators.required),
|
||||
@@ -51,15 +49,13 @@ export class SendTextDetailsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.originalSendView) {
|
||||
async ngOnInit(): Promise<void> {
|
||||
this.sendTextDetailsForm.patchValue({
|
||||
text: this.originalSendView.text?.text || "",
|
||||
hidden: this.originalSendView.text?.hidden || false,
|
||||
text: this.originalSendView()?.text?.text || "",
|
||||
hidden: this.originalSendView()?.text?.hidden || false,
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.config.areSendsAllowed) {
|
||||
if (!this.config().areSendsAllowed) {
|
||||
this.sendTextDetailsForm.disable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user