Skip to content

Commit d17f0e5

Browse files
committed
feat(filter-bar): provide translatable remove button label
1 parent 8ec0a4d commit d17f0e5

File tree

7 files changed

+28
-2
lines changed

7 files changed

+28
-2
lines changed

api-goldens/element-ng/filter-bar/index.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class SiFilterBarComponent {
2929
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
3030
readonly filterDefaultText: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>;
3131
readonly filters: _angular_core.ModelSignal<Filter[]>;
32+
readonly removeButtonLabel: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>;
3233
readonly resetFilters: _angular_core.OutputEmitterRef<void>;
3334
readonly resetText: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>;
3435
}
@@ -43,6 +44,7 @@ export class SiFilterPillComponent {
4344
// (undocumented)
4445
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
4546
readonly filter: _angular_core.InputSignal<Filter>;
47+
readonly removeButtonLabel: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>;
4648
// (undocumented)
4749
readonly totalPills: _angular_core.InputSignal<number>;
4850
}

api-goldens/element-ng/translate/index.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ export interface SiTranslatableKeys {
220220
// (undocumented)
221221
'SI_FILTER_BAR.NO_FILTERS'?: string;
222222
// (undocumented)
223+
'SI_FILTER_BAR.REMOVE_LABEL'?: string;
224+
// (undocumented)
223225
'SI_FILTER_BAR.RESET_FILTERS'?: string;
224226
// (undocumented)
225227
'SI_FILTERED_SEARCH.CLEAR'?: string;

projects/element-ng/filter-bar/si-filter-bar.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[totalPills]="$count"
77
[filter]="filter"
88
[disabled]="disabled()"
9+
[removeButtonLabel]="removeButtonLabel()"
910
(deleteFilters)="deleteFilters($event)"
1011
/>
1112
</div>
@@ -27,6 +28,7 @@
2728
title: '',
2829
filterName: ''
2930
}"
31+
[removeButtonLabel]="removeButtonLabel()"
3032
(deleteFilters)="deleteOverflowFilter()"
3133
/>
3234
@if (allowReset() && this.filters().length) {

projects/element-ng/filter-bar/si-filter-bar.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ export class SiFilterBarComponent {
8989
t(() => $localize`:@@SI_FILTER_BAR.COLLAPSED_FILTERS_DESCRIPTION:+ {{count}} filters`)
9090
);
9191

92+
/**
93+
* Pill remove button label.
94+
*
95+
* @defaultValue
96+
* ```
97+
* t(() => $localize`:@@SI_FILTER_BAR.REMOVE_LABEL:Remove`)
98+
* ```
99+
*/
100+
readonly removeButtonLabel = input(t(() => $localize`:@@SI_FILTER_BAR.REMOVE_LABEL:Remove`));
101+
92102
/**
93103
* Output callback to be executed when the reset filter is clicked
94104
*/

projects/element-ng/filter-bar/si-filter-pill.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
type="button"
2323
class="btn-remove element-cancel btn btn-circle btn-ghost focus-inside ms-0 btn-sm"
2424
role="button"
25-
aria-label="Remove"
25+
[attr.aria-label]="removeButtonLabel() | translate"
2626
[disabled]="disabled()"
2727
(keydown.enter)="deleteClicked()"
2828
(click)="deleteClicked()"

projects/element-ng/filter-bar/si-filter-pill.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import { NgTemplateOutlet } from '@angular/common';
66
import { booleanAttribute, Component, input, output } from '@angular/core';
7-
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
7+
import { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';
88

99
import { Filter } from './filter';
1010

@@ -26,6 +26,15 @@ export class SiFilterPillComponent {
2626
/** @defaultValue 0 */
2727
readonly totalPills = input(0);
2828

29+
/**
30+
* Remove button label.
31+
*
32+
* @defaultValue
33+
* ```
34+
* t(() => $localize`:@@SI_FILTER_BAR.REMOVE_LABEL:Remove`)
35+
* ```
36+
*/
37+
readonly removeButtonLabel = input(t(() => $localize`:@@SI_FILTER_BAR.REMOVE_LABEL:Remove`));
2938
/**
3039
* Output callback event which will provide you the name of the deleted filter
3140
* pill if a filter was deleted.

projects/element-ng/translate/si-translatable-keys.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export interface SiTranslatableKeys {
113113
'SI_FILTERED_SEARCH.SUBMIT_BUTTON'?: string;
114114
'SI_FILTER_BAR.COLLAPSED_FILTERS_DESCRIPTION'?: string;
115115
'SI_FILTER_BAR.NO_FILTERS'?: string;
116+
'SI_FILTER_BAR.REMOVE_LABEL'?: string;
116117
'SI_FILTER_BAR.RESET_FILTERS'?: string;
117118
'SI_FORM_CONTAINER.ERROR.DATE_FORMAT'?: string;
118119
'SI_FORM_CONTAINER.ERROR.DATE_FORMAT_END'?: string;

0 commit comments

Comments
 (0)