Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clear selection option in search-selector #2860

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ export class MotionMultiselectService {
}
return submitterIds.map(id => ({ id }));
}

private submitterInMotion(userId: Id, motion: ViewMotion): boolean {
return motion.submitters.some(submitter => userId == submitter.user_id);
}

private newSubmittersInMotion(userIds: Ids, motion: ViewMotion): Identifiable[] {
const newSubmitters: Id[] = userIds.filter(userId => !this.submitterInMotion(userId, motion));
return newSubmitters.map(id => ({ id }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
placeholder="{{ 'Category' | translate }}"
[repo]="categoryRepo"
[excludeIds]="true"
[addClearSelection]="true"
></os-repo-search-selector>
</mat-form-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
>
{{ noOptionsFoundLabel | translate }}
</mat-option>
<mat-option *ngIf="addClearSelection">-</mat-option>
<mat-option
#currentOption
*cdkVirtualFor="let selectableItem of filteredItemsObservable | async"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ export abstract class BaseSearchSelectorComponent extends BaseFormFieldControlCo
@Input()
public wider = false;

/**
* If true, a clear selection option is added to the selection list.
*/
@Input()
public addClearSelection = false;

public itemSizeInPx = 50;

public get panelHeight(): number {
Expand Down