[ACS-7570] [ADF] Create generic dialog component (#9724)

This commit is contained in:
Darya Blavanovich
2024-06-03 14:34:57 +02:00
committed by GitHub
parent 0ea35b1f12
commit f1167b1bc5
17 changed files with 232 additions and 94 deletions

View File

@@ -1,11 +1,11 @@
---
Title: Dialog component
Added: v6.9.0
Added: v6.10.0
Status: Active
Last reviewed: 2024-05-17
Last reviewed: 2024-05-24
---
# [Dialog component](../../../lib/content-services/src/lib/dialogs/dialog/ "Defined in dialog.component.ts")
# [Dialog component](../../../lib/core/src/lib/dialogs/dialog/dialog.component.ts "Defined in dialog.component.ts")
Dialog wrapper styled according to a consistent design system.
@@ -64,15 +64,24 @@ function openDialog() {
const data: DialogData = {
title: 'Dialog title',
dialogSize: DialogSize.Alert,
isConfirmButtonDisabled$: of(true),
contentTemplate: this.contentDialogTemplate,
actionsTemplate: this.actionsDialogTemplate
isConfirmButtonDisabled$: of(false),
contentTemplate: this.contentDialogTemplate, // or contentComponent: this.contentDialogTemplate
additionalActionButtons: [{
title: 'Reset',
class: 'reset-button',
onClick: () => {
this.isConfirmButtonDisabled$.next(true);
}
}] // or actionsTemplate: this.actionsDialogTemplate
};
this.dialog.open(DialogComponent, { data });
this.dialog.open(DialogComponent, { data }, width: '600px');
}
```
Note that **fixed width** may be provided which will work correctly on smaller screens. But don't specify any values for **height**, as this may break the scrollable content and hide the buttons.
To display the design well, it is necessary to provide no more than 2 additional buttons.
## Details
This component lets the user reuse styled dialog wrapper. Use the
@@ -84,3 +93,4 @@ with properties.
- [Dialog Data Interface](../interfaces/dialog.interface.md)
- [Dialog Model](../models/dialog.model.md)
- [AdditionalDialogActionButton Interface](../interfaces/additional-dialog-action-button.md)

View File

@@ -0,0 +1,36 @@
---
Title: AdditionalDialogActionButton Interface
Added: v6.10.0
Status: Active
Last reviewed: 2024-05-24
---
# [AdditionalDialogActionButton Interface](../../../lib/core/src/lib/dialogs/dialog/dialog-data.interface.ts "Defined in dialog-data.interface.ts")
Specifies interface for [Dialog Component](../dialogs/dialog.md).
## Basic usage
```ts
interface AdditionalDialogActionButton {
title: string;
onClick: (args?: any) => void;
class?: string;
}
```
## Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| title | `string` | | Button title. |
| onClick | `(args?: any) => void` | | Callback for button. (optional) |
| class | `string` | | Button class. (optional) |
Note that in order for the design to be displayed well, it is necessary to provide no more than 2 additional buttons.
## See also
- [Dialog Component](../dialogs/dialog.md)
- [Dialog Model](../models/dialog.model.md)
- [DialogData Interface](./dialog.interface.md)

View File

@@ -1,11 +1,11 @@
---
Title: Dialog Data Interface
Added: v6.9.0
Added: v6.10.0
Status: Active
Last reviewed: 2024-05-17
Last reviewed: 2024-05-24
---
# [Dialog Data Interface](../../../lib/content-services/src/lib/dialogs/dialog/dialog-data.interface.ts "Defined in dialog-data.interface.ts")
# [Dialog Data Interface](../../../lib/core/src/lib/dialogs/dialog/dialog-data.interface.ts "Defined in dialog-data.interface.ts")
Specifies interface for [Dialog Component](../dialogs/dialog.md).
@@ -25,6 +25,7 @@ interface DialogData {
actionsTemplate?: TemplateRef<any>;
descriptionTemplate?: TemplateRef<any>;
headerIcon?: string;
additionalActionButtons?: AdditionalDialogActionButton[];
}
```
@@ -34,18 +35,22 @@ interface DialogData {
| ---- | ---- | ------------- | ----------- |
| title | `string` | | It will be placed in the dialog title section. |
| headerIcon | `string` | | It will be placed in header section. Should be used with Alert dialogs. (optional) |
| description | `string` | | It will be placed first in the dialog content section. (optional) |
| description | `string` | | It will be placed first in the dialog content section. Non-scrollable content. (optional) |
| confirmButtonTitle | `string` | `COMMON.APPLY` | Confirmation action. After this, the dialog is closed and the `isConfirmButtonDisabled$` is set to `true`. (optional) |
| cancelButtonTitle | `string` | `COMMON.CANCEL` | Cancellation action. After this, the dialog is closed |
| isCancelButtonHidden | `boolean` | `false` | Toggles cancel button visibility. (optional) |
| isCloseButtonHidden | `boolean` | `false` | Toggles close button visibility. (optional) |
| isConfirmButtonDisabled$ | `Subject<boolean>` | `false` | Toggles confirm button disability. (optional) |
| dialogSize | `DialogSize` | `Medium` | Set dialog size. Can be `Large`, `Medium`, `Alert`. (optional) |
| contentText | `string` | | Inserts a content text. (optional) |
| contentComponent | `Type<any>` | | Inserts a content component. (optional) |
| contentTemplate | `TemplateRef<any>` | | Inserts a content template. (optional) |
| actionsTemplate | `TemplateRef<any>` | | Inserts a template styled on the left. Should be used for additional `mat-button` style buttons. (optional) |
| descriptionTemplate | `TemplateRef<any>` | | Inserts a description template. (optional) |
| additionalActionButtons | `AdditionalDialogActionButton[]` | | Inserts additional base-styled buttons into the action bar on the left. (optional) |
## See also
- [Dialog Component](../dialogs/dialog.md)
- [Dialog Model](../models/dialog.model.md)
- [AdditionalDialogActionButton Interface](./additional-dialog-action-button.interface.md)

View File

@@ -1,11 +1,11 @@
---
Title: Dialog Size Model
Added: v6.9.0
Added: v6.10.0
Status: Active
Last reviewed: 2024-05-17
Last reviewed: 2024-05-24
---
# [Dialog Size model](../../../lib/content-services/src/lib/dialogs/dialog/dialog.model.ts "Defined in dialog.model.ts")
# [Dialog Size model](../../../lib/core/src/lib/dialogs/dialog/dialog.model.ts "Defined in dialog.model.ts")
Sets a specific CSS class to [Dialog Component](../dialogs/dialog.md).
@@ -50,3 +50,4 @@ function openDialog() {
- [Dialog Component](../dialogs/dialog.md)
- [Dialog Data Interface](../interfaces/dialog.interface.md)
- [AdditionalDialogActionButton Interface](./additional-dialog-action-button.md)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 108 KiB