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

Tools - Prefer signal & change detection (#16941)

This commit is contained in:
Oscar Hinton
2025-10-21 15:49:22 +02:00
committed by GitHub
parent 6abaaa7b13
commit f23f3f87bd
66 changed files with 329 additions and 11 deletions

View File

@@ -52,6 +52,8 @@ export enum SendItemDialogResult {
/**
* Component for adding or editing a send item.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
templateUrl: "send-add-edit-dialog.component.html",
imports: [

View File

@@ -10,13 +10,19 @@ import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abs
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { ButtonModule, ButtonType, MenuModule } from "@bitwarden/components";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-new-send-dropdown",
templateUrl: "new-send-dropdown.component.html",
imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule, PremiumBadgeComponent],
})
export class NewSendDropdownComponent implements OnInit {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() hideIcon: boolean = false;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() buttonType: ButtonType = "primary";
sendType = SendType;

View File

@@ -33,6 +33,8 @@ import { CredentialGeneratorService, GenerateRequest, Type } from "@bitwarden/ge
import { SendFormConfig } from "../../abstractions/send-form-config.service";
import { SendFormContainer } from "../../send-form-container";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-send-options",
templateUrl: "./send-options.component.html",
@@ -52,8 +54,12 @@ import { SendFormContainer } from "../../send-form-container";
],
})
export class SendOptionsComponent implements OnInit {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
config: SendFormConfig;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
originalSendView: SendView;
disableHideEmail = false;

View File

@@ -47,6 +47,8 @@ export interface DatePresetSelectOption {
value: DatePreset | string;
}
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-send-details",
templateUrl: "./send-details.component.html",
@@ -68,7 +70,11 @@ export interface DatePresetSelectOption {
],
})
export class SendDetailsComponent implements OnInit {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() config: SendFormConfig;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() originalSendView?: SendView;
FileSendType = SendType.File;

View File

@@ -17,6 +17,8 @@ import {
import { SendFormConfig } from "../../abstractions/send-form-config.service";
import { SendFormContainer } from "../../send-form-container";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-send-file-details",
templateUrl: "./send-file-details.component.html",
@@ -32,8 +34,8 @@ import { SendFormContainer } from "../../send-form-container";
],
})
export class SendFileDetailsComponent implements OnInit {
config = input.required<SendFormConfig>();
originalSendView = input<SendView>();
readonly config = input.required<SendFormConfig>();
readonly originalSendView = input<SendView>();
sendFileDetailsForm = this.formBuilder.group({
file: this.formBuilder.control<SendFileView | null>(null, Validators.required),

View File

@@ -10,6 +10,8 @@ import { CheckboxModule, FormFieldModule, SectionComponent } from "@bitwarden/co
import { SendFormConfig } from "../../abstractions/send-form-config.service";
import { SendFormContainer } from "../../send-form-container";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-send-text-details",
templateUrl: "./send-text-details.component.html",
@@ -23,8 +25,8 @@ import { SendFormContainer } from "../../send-form-container";
],
})
export class SendTextDetailsComponent implements OnInit {
config = input.required<SendFormConfig>();
originalSendView = input<SendView>();
readonly config = input.required<SendFormConfig>();
readonly originalSendView = input<SendView>();
sendTextDetailsForm = this.formBuilder.group({
text: new FormControl("", Validators.required),

View File

@@ -38,6 +38,8 @@ import { SendForm, SendFormContainer } from "../send-form-container";
import { SendDetailsComponent } from "./send-details/send-details.component";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-send-form",
templateUrl: "./send-form.component.html",
@@ -59,6 +61,8 @@ import { SendDetailsComponent } from "./send-details/send-details.component";
],
})
export class SendFormComponent implements AfterViewInit, OnInit, OnChanges, SendFormContainer {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@ViewChild(BitSubmitDirective)
private bitSubmit: BitSubmitDirective;
private destroyRef = inject(DestroyRef);
@@ -68,27 +72,37 @@ export class SendFormComponent implements AfterViewInit, OnInit, OnChanges, Send
/**
* The form ID to use for the form. Used to connect it to a submit button.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true }) formId: string;
/**
* The configuration for the add/edit form. Used to determine which controls are shown and what values are available.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true }) config: SendFormConfig;
/**
* Optional submit button that will be disabled or marked as loading when the form is submitting.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
submitBtn?: ButtonComponent;
/**
* Event emitted when the send is created successfully.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() onSendCreated = new EventEmitter<SendView>();
/**
* Event emitted when the send is updated successfully.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() onSendUpdated = new EventEmitter<SendView>();
/**

View File

@@ -10,6 +10,8 @@ import { ChipSelectComponent } from "@bitwarden/components";
import { SendListFiltersService } from "../services/send-list-filters.service";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "app-send-list-filters",
templateUrl: "./send-list-filters.component.html",

View File

@@ -25,6 +25,8 @@ import {
TypographyModule,
} from "@bitwarden/components";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
imports: [
CommonModule,
@@ -46,9 +48,13 @@ export class SendListItemsContainerComponent {
/**
* The list of sends to display.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
sends: SendView[] = [];
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
headerText: string;

View File

@@ -11,6 +11,8 @@ import { SendItemsService } from "../services/send-items.service";
const SearchTextDebounceInterval = 200;
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
imports: [CommonModule, SearchModule, JslibModule, FormsModule],
selector: "tools-send-search",