Mykyta Maliarchuk c642d0e5c2
[ACS-6150] Add category selector dialog (#9423)
* [ACS-6150] add category selector dialog

* [ACS-6150] fix import

* [ACS-6150] cr fix

* [ACS-6150] cr fix

* [ACS-6150] change describe name

* [ACS-6150] linting

* [ACS-6150] style fix

* [ACS-6150] align styles
2024-03-20 08:56:01 +01:00

1.9 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Category selector dialog component v6.8.0 Active 2024-03-12

Category selector dialog component

Allows the user to select one or multiple categories.

Category selector dialog component

Dialog inputs

Name Type Default value Description
select Subject<Category[]> Emits an array of selected categories when the dialog closes
multiSelect boolean true (optional) Toggles multiselect mode

Basic Usage

constructor(private dialog: MatDialog) {}

...

function openCatDialog() {
    const data: CategorySelectorDialogOptions = {
        select: new Subject<Category[]>(),
        multiSelect: false
    };

    this.dialog.open(CategorySelectorDialogComponent, {
        data,
        width: '400px'
    });

    data.select.subscribe(
        (selections: Category[]) => {
            ...
        }
    );
}

All the results will be streamed to the select subject present in the CategorySelectorDialogOptions object passed to the dialog. When the category is selected by clicking the Select button, the options.select stream will be completed.

Details

This component lets the user select categories. Use the Angular MatDialog service to open the dialog, as shown in the example, and pass a options object with properties.

See also