mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-7896] Cipher Form - Additional Options section (#9928)
* [PM-7896] Adjust cipher form container to expose config and original cipher view for children * [PM-7896] Add initial additional options section * [PM-7896] Add tests * [PM-7896] Add TODO comments for Custom Fields * [PM-7896] Hide password reprompt checkbox when unavailable * [PM-7896] Fix storybook
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { CipherFormConfig } from "@bitwarden/vault";
|
||||
|
||||
import { AdditionalOptionsSectionComponent } from "./components/additional-options/additional-options-section.component";
|
||||
import { CardDetailsSectionComponent } from "./components/card-details-section/card-details-section.component";
|
||||
import { IdentitySectionComponent } from "./components/identity/identity.component";
|
||||
import { ItemDetailsSectionComponent } from "./components/item-details/item-details-section.component";
|
||||
@@ -10,19 +12,31 @@ import { ItemDetailsSectionComponent } from "./components/item-details/item-deta
|
||||
*/
|
||||
export type CipherForm = {
|
||||
itemDetails?: ItemDetailsSectionComponent["itemDetailsForm"];
|
||||
additionalOptions?: AdditionalOptionsSectionComponent["additionalOptionsForm"];
|
||||
cardDetails?: CardDetailsSectionComponent["cardDetailsForm"];
|
||||
identityDetails?: IdentitySectionComponent["identityForm"];
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* to be updated/created. Child form components inject this container in order to register themselves with the parent form
|
||||
* and access configuration options.
|
||||
*
|
||||
* 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 {
|
||||
/**
|
||||
* The configuration for the cipher form.
|
||||
*/
|
||||
readonly config: CipherFormConfig;
|
||||
|
||||
/**
|
||||
* The original cipher that is being edited/cloned. Used to pre-populate the form and compare changes.
|
||||
*/
|
||||
readonly originalCipherView: CipherView | null;
|
||||
|
||||
abstract registerChildForm<K extends keyof CipherForm>(
|
||||
name: K,
|
||||
group: Exclude<CipherForm[K], undefined>,
|
||||
|
||||
Reference in New Issue
Block a user