diff --git a/libs/platform/table/components/table-toolbar/table-toolbar.component.html b/libs/platform/table/components/table-toolbar/table-toolbar.component.html index 00722c42339..0ffe86c6a4b 100644 --- a/libs/platform/table/components/table-toolbar/table-toolbar.component.html +++ b/libs/platform/table/components/table-toolbar/table-toolbar.component.html @@ -39,6 +39,7 @@ (searchSubmit)="submitSearch($event)" (cancelSearch)="submitSearch($event)" [disableSuggestionsFoundAnnouncer]="true" + (inputChange)="searchInputChanged($event)" > } @if (editMode !== 'none') { diff --git a/libs/platform/table/components/table-toolbar/table-toolbar.component.ts b/libs/platform/table/components/table-toolbar/table-toolbar.component.ts index fe5dce63296..ca720f97228 100644 --- a/libs/platform/table/components/table-toolbar/table-toolbar.component.ts +++ b/libs/platform/table/components/table-toolbar/table-toolbar.component.ts @@ -4,7 +4,9 @@ import { ContentChild, DestroyRef, Directive, + EventEmitter, Input, + Output, Signal, TemplateRef, ViewChild, @@ -150,6 +152,20 @@ export class TableToolbarComponent implements TableToolbarInterface { @Input() headingLevel: HeadingLevel = 2; + /** Search field input text. */ + @Input() + set searchFieldInputText(text: string) { + this._searchInputText = text; + this.submitSearch({ text, category: null }); + } + get searchFieldInputText(): string { + return this._searchInputText; + } + + /** Event emitted when the search field input is changed. */ + @Output() + searchFieldInputChange = new EventEmitter(); + /** @hidden */ @ContentChild(TableToolbarActionsComponent) tableToolbarActionsComponent: TableToolbarActionsComponent; @@ -190,6 +206,11 @@ export class TableToolbarComponent implements TableToolbarInterface { this._table.search(search); } + /** @hidden */ + searchInputChanged(event: SearchInput): void { + this.searchFieldInputChange.emit(event.text); + } + /** @hidden */ openSorting(): void { this._table.openTableSortSettings.emit();