Skip to content
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
@@ -0,0 +1,15 @@
import {
ContentChild,
Directive,
TemplateRef,
} from '@angular/core';

@Directive({
selector: '[uiGridCustomSearch], ui-grid-custom-search',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the usecase pls for ref?

})
export class UiGridCustomSearchDirective {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

@ContentChild(TemplateRef, {
static: true,
})
html?: TemplateRef<any>;
}
1 change: 1 addition & 0 deletions projects/angular/components/ui-grid/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export { UiGridRowCardViewDirective } from './body/ui-grid-row-card-view.directi
export { UiGridLoadingDirective } from './body/ui-grid-loading.directive';
export { UiGridNoContentDirective } from './body/ui-grid-no-content.directive';
export { UiGridSearchComponent } from './components/ui-grid-search/ui-grid-search.component';
export { UiGridCustomSearchDirective } from './components/ui-grid-search/ui-grid-custom-search.directive';
export { UiGridSearchModule } from './components/ui-grid-search/ui-grid-search.module';
export { UiGridToggleColumnsModule } from './components/ui-grid-toggle-columns/ui-grid-toggle-columns.module';
export { UiGridToggleColumnsComponent } from './components/ui-grid-toggle-columns/ui-grid-toggle-columns.component';
Expand Down
28 changes: 17 additions & 11 deletions projects/angular/components/ui-grid/src/ui-grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
<ng-container>
<ng-container *ngIf="!(hasSelection$ | async) ||
!header?.actionButtons?.length">
<ui-grid-search *ngIf="header?.search"
[debounce]="header!.searchDebounce"
[maxLength]="header!.searchMaxLength"
[placeholder]="intl.searchPlaceholder"
[searchTooltip]="intl.searchTooltip"
[clearTooltip]="intl.clearTooltip"
[tooltipDisabled]="resizeManager.isResizing"
[value]="header!.searchValue!"
(searchChange)="filterManager.searchChange($event, header!, footer)"
class="ui-grid-search ui-grid-filter-option">
</ui-grid-search>
<ng-container *ngIf="!!search; else defaultSearch">
<ng-container *ngTemplateOutlet="search.html ?? null"></ng-container>
</ng-container>

<ng-template #defaultSearch>
<ui-grid-search *ngIf="header?.search"
[debounce]="header!.searchDebounce"
[maxLength]="header!.searchMaxLength"
[placeholder]="intl.searchPlaceholder"
[searchTooltip]="intl.searchTooltip"
[clearTooltip]="intl.clearTooltip"
[tooltipDisabled]="resizeManager.isResizing"
[value]="header!.searchValue!"
(searchChange)="filterManager.searchChange($event, header!, footer)"
class="ui-grid-search ui-grid-filter-option">
</ui-grid-search>
</ng-template>

<ng-container *ngTemplateOutlet="toggleColumnsTmpl"></ng-container>

Expand Down
11 changes: 11 additions & 0 deletions projects/angular/components/ui-grid/src/ui-grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import { UiGridNoContentDirective } from './body/ui-grid-no-content.directive';
import { UiGridRowActionDirective } from './body/ui-grid-row-action.directive';
import { UiGridRowCardViewDirective } from './body/ui-grid-row-card-view.directive';
import { UiGridRowConfigDirective } from './body/ui-grid-row-config.directive';
import { UiGridCustomSearchDirective } from './components/ui-grid-search/ui-grid-custom-search.directive';
import { ISuggestDropdownValueData } from './filters/ui-grid-dropdown-filter.directive';
import { UiGridSearchFilterDirective } from './filters/ui-grid-search-filter.directive';
import { UiGridFooterDirective } from './footer/ui-grid-footer.directive';
Expand Down Expand Up @@ -548,6 +549,16 @@ export class UiGridComponent<T extends IGridDataEntry>
})
header?: UiGridHeaderDirective<T>;

/**
* Custom search directive reference.
*
* @ignore
*/
@ContentChild(UiGridCustomSearchDirective, {
static: true,
})
search?: UiGridCustomSearchDirective;

/**
* Column directive reference list.
*
Expand Down
3 changes: 3 additions & 0 deletions projects/angular/components/ui-grid/src/ui-grid.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { UiSuggestModule } from '@uipath/angular/components/ui-suggest';
import { UiNgLetModule } from '@uipath/angular/directives/ui-ng-let';
import { UiVirtualScrollViewportResizeModule } from '@uipath/angular/directives/ui-virtual-scroll-viewport-resize';

import { UiGridCustomSearchDirective } from './components/ui-grid-search/ui-grid-custom-search.directive';
import { UiGridColumnDirective } from './body/ui-grid-column.directive';
import { UiGridExpandedRowDirective } from './body/ui-grid-expanded-row.directive';
import { UiGridLoadingDirective } from './body/ui-grid-loading.directive';
Expand Down Expand Up @@ -69,6 +70,7 @@ import { UiGridComponent } from './ui-grid.component';
UiGridNoContentDirective,
UiGridLoadingDirective,
UiGridRowCardViewDirective,
UiGridCustomSearchDirective,
],
exports: [
UiGridComponent,
Expand All @@ -84,6 +86,7 @@ import { UiGridComponent } from './ui-grid.component';
UiGridNoContentDirective,
UiGridLoadingDirective,
UiGridRowCardViewDirective,
UiGridCustomSearchDirective,
],
})
export class UiGridModule { }