mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
* initial add of card details section * add card number * update card brand when the card number changes * add year and month fields * add security code field * hide number and security code by default * add `id` for all form fields * update select options to match existing options * make year input numerical * only display card details for card ciphers * use style to set input height * handle numerical values for year * update heading when a brand is available * remove unused ref * use cardview types for the form * fix numerical input type * disable card details when in partial-edit mode * remove hardcoded height * update types for formBuilder
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
|
|
|
import { CardDetailsSectionComponent } from "./components/card-details-section/card-details-section.component";
|
|
import { ItemDetailsSectionComponent } from "./components/item-details/item-details-section.component";
|
|
|
|
/**
|
|
* The complete form for a cipher. Includes all the sub-forms from their respective section components.
|
|
* TODO: Add additional form sections as they are implemented.
|
|
*/
|
|
export type CipherForm = {
|
|
itemDetails?: ItemDetailsSectionComponent["itemDetailsForm"];
|
|
cardDetails?: CardDetailsSectionComponent["cardDetailsForm"];
|
|
};
|
|
|
|
/**
|
|
* A container for the {@link CipherForm} that allows for registration of child form groups and patching of the cipher
|
|
* to be updated/created. Child form components inject this container in order to register themselves with the parent form.
|
|
*
|
|
* This is an alternative to passing the form groups down through the component tree via @Inputs() and form updates via
|
|
* @Outputs(). It allows child forms to define their own structure and validation rules, while still being able to
|
|
* update the parent cipher.
|
|
*/
|
|
export abstract class CipherFormContainer {
|
|
abstract registerChildForm<K extends keyof CipherForm>(
|
|
name: K,
|
|
group: Exclude<CipherForm[K], undefined>,
|
|
): void;
|
|
|
|
abstract patchCipher(cipher: Partial<CipherView>): void;
|
|
}
|