diff --git a/libs/core/src/lib/combobox/combobox.component.ts b/libs/core/src/lib/combobox/combobox.component.ts index cdb8e71e83b..1abdc8c4804 100644 --- a/libs/core/src/lib/combobox/combobox.component.ts +++ b/libs/core/src/lib/combobox/combobox.component.ts @@ -700,7 +700,7 @@ export class ComboboxComponent /** @hidden */ private _defaultDisplay(str: any): string { - return str; + return `${str}`; } /** @hidden */ diff --git a/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.html b/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.html new file mode 100644 index 00000000000..e2aa09f4932 --- /dev/null +++ b/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.html @@ -0,0 +1,56 @@ + +
+
+ + {{ token }} + +
+ + + {{ value ? 'Yes' : 'No' }} + + + + +
  • + {{ option.displayValue }} +
  • +
    +
    + +
    +
    diff --git a/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.ts b/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.ts new file mode 100644 index 00000000000..20fcd63635a --- /dev/null +++ b/libs/docs/platform/vhd/examples/column-template/platform-vhd-column-template-example.component.ts @@ -0,0 +1,160 @@ +import { Component, ViewEncapsulation } from '@angular/core'; +import { + ValueHelpDialogDataSource, + VhdDataProvider, + VhdDefineExcludeStrategy, + VhdDefineIncludeStrategy, + VhdExcludedEntity, + VhdIncludedEntity, + VhdValue, + VhdValueChangeEvent +} from '@fundamental-ngx/platform/value-help-dialog'; +import { Observable, of } from 'rxjs'; +import { delay } from 'rxjs/operators'; + +interface ExampleTestModel { + id: number; + name: string; + code: string; + city: string; + zipcode: string; + address: string; + nickname: string; + verified: boolean; +} + +interface FilterData { + key: string; + name: string; + label: string; + advanced: boolean; +} + +const exampleDataSource = (): { dataSource: ExampleTestModel[]; filters: FilterData[] } => { + const dataSource = Array(137) + .fill(null) + .map((_value, index) => ({ + id: index + 1, + name: `Name ${index + 1}`, + code: `${Math.floor(Math.random() * 99999)}`, + city: `City ${Math.floor(Math.random() * index)}`, + zipcode: `zipcode ${Math.floor(Math.random() * index)}`, + address: `Address ${Math.floor(Math.random() * index)}`, + nickname: `Nickname ${Math.floor(Math.random() * index)}`, + verified: Math.random() < 0.5 + })); + return { + dataSource, + filters: Object.keys(dataSource[0]).map((value, index) => ({ + key: value, + name: `${value}`, + label: `Product ${value}`, + advanced: index > 0 + })) + }; +}; + +const data = exampleDataSource(); + +@Component({ + selector: 'fdp-vhd-column-template-example', + styles: [ + ` + .vhd-custom-select { + display: block !important; + } + ` + ], + templateUrl: './platform-vhd-column-template-example.component.html', + encapsulation: ViewEncapsulation.None +}) +export class PlatformVhdColumnTemplateExampleComponent { + filters = data.filters; + dataSource = new ValueHelpDialogDataSource(new DelayedVhdDataProvider(data.dataSource)); + + actualValue: Partial> = {}; + + booleanDropdownValues = [ + { value: true, displayValue: 'Yes' }, + { value: false, displayValue: 'No' } + ]; + + actualItems: string[] = []; + formatTokenFn = (value: VhdValueChangeEvent): void => { + this.actualItems = [ + ...(value.selected || []).map((item) => item.name), + ...(value.conditions || []).map((item) => this.conditionDisplayFn(item)) + ].filter((v): v is string => !!v); + }; + conditionDisplayFn = (item: VhdIncludedEntity | VhdExcludedEntity): string | null => { + let value = (() => { + switch (item.strategy) { + case VhdDefineIncludeStrategy.empty: + case VhdDefineExcludeStrategy.not_empty: + return null; + case VhdDefineIncludeStrategy.between: + return `${item.value}...${item.valueTo}`; + case VhdDefineIncludeStrategy.contains: + return `*${item.value}*`; + case VhdDefineIncludeStrategy.equalTo: + return `=${item.value}`; + case VhdDefineIncludeStrategy.startsWith: + return `${item.value}*`; + case VhdDefineIncludeStrategy.endsWith: + return `*${item.value}`; + case VhdDefineIncludeStrategy.greaterThan: + return `>${item.value}`; + case VhdDefineIncludeStrategy.greaterThanEqual: + return `>=${item.value}`; + case VhdDefineIncludeStrategy.lessThan: + return `<${item.value}`; + case VhdDefineIncludeStrategy.lessThanEqual: + return `<=${item.value}`; + case VhdDefineExcludeStrategy.not_equalTo: + return `!(=${item.value})`; + } + })(); + if (value && item.type === 'exclude') { + value = `!(${value})`; + } + + return value; + }; + + valueChange($event: VhdValueChangeEvent): void { + this.actualValue = { ...$event }; + } +} + +// Simulating real http request by adding 300ms delay to the DataProvider's "fetch" method +class DelayedVhdDataProvider extends VhdDataProvider { + // Override default fetch method to be able to deal with booleans. + // Developers should implement own logic of filtering the data. E.g. sending http request to the backend. + fetch(params: Map): Observable { + let data = this.values; + const arrayParams = Array.from(params); + const filterFn = (row: R): boolean => { + const rowEntries = Object.entries(row) as string[][]; + return arrayParams.every(([key, value]) => { + if (key === '*') { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + return rowEntries.some(([_rowEntryKey, rowEntryValue]) => this._search(rowEntryValue, value)); + } else { + return this._search(row[key], value); + } + }); + }; + if (params.size) { + data = this.values.filter(filterFn); + } + return of(data).pipe(delay(300)); + } + + private _search(rowEntryValue: any, value: any): boolean { + if (typeof value === 'boolean') { + return rowEntryValue === value; + } else { + return String(rowEntryValue).toLowerCase().includes(value.toLowerCase()); + } + } +} diff --git a/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.html b/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.html index c27bf1fba96..0220a814b70 100644 --- a/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.html +++ b/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.html @@ -23,11 +23,28 @@ (valueChange)="valueChange($event)" headerId="fdp-vhd-header-1" > - + + + + + + diff --git a/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.ts b/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.ts index fe326e2a391..977ef3d6687 100644 --- a/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.ts +++ b/libs/docs/platform/vhd/examples/platform-vhd-basic-example.component.ts @@ -21,6 +21,7 @@ interface ExampleTestModel { zipcode: string; address: string; nickname: string; + verified: string; } interface FilterData { @@ -40,7 +41,8 @@ const exampleDataSource = (): { dataSource: ExampleTestModel[]; filters: FilterD city: `City ${Math.floor(Math.random() * index)}`, zipcode: `zipcode ${Math.floor(Math.random() * index)}`, address: `Address ${Math.floor(Math.random() * index)}`, - nickname: `Nickname ${Math.floor(Math.random() * index)}` + nickname: `Nickname ${Math.floor(Math.random() * index)}`, + verified: Math.random() < 0.5 ? 'Yes' : 'No' })); return { dataSource, @@ -65,6 +67,8 @@ export class PlatformVhdBasicExampleComponent { actualValue: Partial> = {}; + booleanDropdownValues = ['Yes', 'No']; + actualItems: string[] = []; formatTokenFn = (value: VhdValueChangeEvent): void => { this.actualItems = [ diff --git a/libs/docs/platform/vhd/platform-vhd-docs.module.ts b/libs/docs/platform/vhd/platform-vhd-docs.module.ts index a0221949375..09731669c38 100644 --- a/libs/docs/platform/vhd/platform-vhd-docs.module.ts +++ b/libs/docs/platform/vhd/platform-vhd-docs.module.ts @@ -31,6 +31,9 @@ import { import { PlatformVhdLoadingExampleComponent } from './examples/platform-vhd-loading-example.component'; import { platformContentDensityModuleDeprecationsProvider } from '@fundamental-ngx/platform/shared'; import { PlatformVhdInitialLoadingExampleComponent } from './examples/initial-loading/platform-vhd-initial-loading-example.component'; +import { PlatformVhdColumnTemplateExampleComponent } from './examples/column-template/platform-vhd-column-template-example.component'; +import { ComboboxModule } from '@fundamental-ngx/core/combobox'; +import { SelectModule } from '@fundamental-ngx/core/select'; const routes: Routes = [ { @@ -55,7 +58,9 @@ const routes: Routes = [ TokenModule, ToolbarModule, PlatformValueHelpDialogModule, - CheckboxModule + CheckboxModule, + ComboboxModule, + SelectModule ], exports: [RouterModule], declarations: [ @@ -68,7 +73,8 @@ const routes: Routes = [ PlatformVhdInputExampleComponent, PlatformVhdMobileExampleComponent, PlatformVhdStrategyLabelExampleComponent, - PlatformVhdInitialLoadingExampleComponent + PlatformVhdInitialLoadingExampleComponent, + PlatformVhdColumnTemplateExampleComponent ], providers: [ platformContentDensityModuleDeprecationsProvider('fdp-value-help-dialog'), diff --git a/libs/docs/platform/vhd/platform-vhd.docs.component.html b/libs/docs/platform/vhd/platform-vhd.docs.component.html index 71d20e39f93..eeb280ed3f4 100644 --- a/libs/docs/platform/vhd/platform-vhd.docs.component.html +++ b/libs/docs/platform/vhd/platform-vhd.docs.component.html @@ -213,3 +213,19 @@ + +Custom columns + +

    + Developers can use structural directive *fdpValueHelpColumnDef to define custom template to render + the column. +

    +

    + This example shows how to transform boolean column value into a string representation (Yes/No) with the ability + to filter by boolean values. +

    +
    + + + + diff --git a/libs/docs/platform/vhd/platform-vhd.docs.component.ts b/libs/docs/platform/vhd/platform-vhd.docs.component.ts index 5c4c7561a9d..8f216fadc33 100644 --- a/libs/docs/platform/vhd/platform-vhd.docs.component.ts +++ b/libs/docs/platform/vhd/platform-vhd.docs.component.ts @@ -25,6 +25,9 @@ const loadingVhdTs = 'platform-vhd-loading-example.component.ts'; const initialLoadingVhdHtml = 'initial-loading/platform-vhd-initial-loading-example.component.html'; const initialLoadingVhdTs = 'initial-loading/platform-vhd-initial-loading-example.component.ts'; +const customColumnVhdHtml = 'column-template/platform-vhd-column-template-example.component.html'; +const customColumnVhdTs = 'column-template/platform-vhd-column-template-example.component.ts'; + @Component({ selector: 'app-platform-vhd', templateUrl: './platform-vhd.docs.component.html' @@ -141,4 +144,18 @@ export class PlatformVhdDocsComponent { fileName: 'platform-vhd-initial-loading-example' } ]; + + customColumnValueHelpDialog: ExampleFile[] = [ + { + language: 'html', + code: getAssetFromModuleAssets(customColumnVhdHtml), + fileName: 'platform-vhd-column-template-example' + }, + { + language: 'typescript', + component: 'PlatformVhdColumnTemplateExampleComponent', + code: getAssetFromModuleAssets(customColumnVhdTs), + fileName: 'platform-vhd-column-template-example' + } + ]; } diff --git a/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.html b/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.html index 479d432f84d..c06fd582ac8 100644 --- a/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.html +++ b/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.html @@ -81,7 +81,19 @@
    *ngFor="let filter of _tableFilters.main; let rowIndex = index" [attr.aria-rowindex]="rowIndex" > - {{ row[filter.key] || '' }} + + + + + {{ row[filter.key] || '' }} + diff --git a/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.ts b/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.ts index e4065cc18c2..9333f91790f 100644 --- a/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.ts +++ b/libs/platform/src/lib/value-help-dialog/components/select-tab/select-tab.component.ts @@ -1,19 +1,24 @@ import { + AfterViewInit, + ChangeDetectionStrategy, Component, + EventEmitter, Input, + OnChanges, Output, - EventEmitter, - ChangeDetectionStrategy, SimpleChanges, + ViewChild, ViewEncapsulation, - OnChanges, - AfterViewInit, - ViewChild + inject } from '@angular/core'; - -import { InfiniteScrollDirective } from '@fundamental-ngx/core/infinite-scroll'; -import { VhdFilter, VdhTableSelection } from '../../models'; import { VhdBaseTab } from '../base-tab/vhd-base-tab.component'; +import { VhdFilter } from '../../models/vhd-filter.model'; +import { VdhTableSelection } from '../../models/vhd-table-selection.type'; +import { InfiniteScrollDirective } from '@fundamental-ngx/core/infinite-scroll'; +import { ValueHelpColumnDefDirective } from '../../directives/value-help-column-def.directive'; +import { VhdComponent } from '../../models/vhd-component.model'; +import { startWith, takeUntil } from 'rxjs'; +import { DestroyedService } from '@fundamental-ngx/cdk/utils'; let titleUniqueId = 0; @@ -22,7 +27,8 @@ let titleUniqueId = 0; templateUrl: './select-tab.component.html', styleUrls: ['./select-tab.component.scss'], encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [DestroyedService] }) export class SelectTabComponent extends VhdBaseTab implements OnChanges, AfterViewInit { /** @hidden */ @@ -125,9 +131,25 @@ export class SelectTabComponent extends VhdBaseTab implements OnChanges, Afte return this.selection === 'multi'; } + /** @hidden */ + _columnDefMap = new Map(); + + /** @hidden */ + private readonly _vhd = inject(VhdComponent, { optional: true }); + + /** @hidden */ + private readonly _destroy$ = inject(DestroyedService); + /** @hidden */ ngAfterViewInit(): void { Promise.resolve(true).then(() => this._checkScrollAndShowMore()); + + this._vhd?.columnDef.changes.pipe(startWith(null), takeUntil(this._destroy$)).subscribe(() => { + this._columnDefMap.clear(); + this._vhd?.columnDef.forEach((item) => { + this._columnDefMap.set(item.column, item); + }); + }); } /** @hidden */ diff --git a/libs/platform/src/lib/value-help-dialog/components/value-help-dialog-filter/value-help-dialog-filter.component.ts b/libs/platform/src/lib/value-help-dialog/components/value-help-dialog-filter/value-help-dialog-filter.component.ts index fa09b8ae985..7a98baae5d9 100644 --- a/libs/platform/src/lib/value-help-dialog/components/value-help-dialog-filter/value-help-dialog-filter.component.ts +++ b/libs/platform/src/lib/value-help-dialog/components/value-help-dialog-filter/value-help-dialog-filter.component.ts @@ -1,5 +1,7 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { ChangeDetectionStrategy, Component, ContentChild, Input } from '@angular/core'; +import { Nullable } from '@fundamental-ngx/cdk/utils'; +import { ValueHelpFilterDefDirective } from '../../directives/value-help-filter-def.directive'; import { VhdFilter } from '../../models/vhd-filter.model'; @Component({ @@ -36,4 +38,8 @@ export class VhdFilterComponent implements VhdFilter { /** Allow to use filter for excluding in `define conditions tab` */ @Input() exclude = true; + + /** @hidden */ + @ContentChild(ValueHelpFilterDefDirective) + filterDef: Nullable; } diff --git a/libs/platform/src/lib/value-help-dialog/directives/value-help-column-def.directive.ts b/libs/platform/src/lib/value-help-dialog/directives/value-help-column-def.directive.ts new file mode 100644 index 00000000000..389f82c35a3 --- /dev/null +++ b/libs/platform/src/lib/value-help-dialog/directives/value-help-column-def.directive.ts @@ -0,0 +1,23 @@ +import { Directive, Input, TemplateRef, inject } from '@angular/core'; + +export interface ValueHelpColumnDefContext { + $implicit: T; + key: string; + value: any; +} + +@Directive({ + selector: '[fdpValueHelpColumnDef]', + standalone: true +}) +export class ValueHelpColumnDefDirective { + /** Type support. */ + @Input('fdpValueHelpColumnDefAs') + as: T; + + /** Column key to render custom template. */ + @Input('fdpValueHelpColumnDefColumn') + column: string; + /** Template reference */ + readonly templateRef = inject>>(TemplateRef); +} diff --git a/libs/platform/src/lib/value-help-dialog/directives/value-help-filter-def.directive.ts b/libs/platform/src/lib/value-help-dialog/directives/value-help-filter-def.directive.ts new file mode 100644 index 00000000000..1e75a40f089 --- /dev/null +++ b/libs/platform/src/lib/value-help-dialog/directives/value-help-filter-def.directive.ts @@ -0,0 +1,20 @@ +import { Directive, TemplateRef, inject } from '@angular/core'; +import { VhdFilter } from '../models/vhd-filter.model'; + +interface ValueHelpFilterDefContext { + $implicit: VhdFilter; +} + +@Directive({ + selector: '[fdpValueHelpFilterDef]', + standalone: true +}) +export class ValueHelpFilterDefDirective { + /** Template reference */ + readonly templateRef = inject(TemplateRef); + + /** @hidden */ + static ngTemplateContextGuard(dir: ValueHelpFilterDefDirective, ctx: unknown): ctx is ValueHelpFilterDefContext { + return true; + } +} diff --git a/libs/platform/src/lib/value-help-dialog/index.ts b/libs/platform/src/lib/value-help-dialog/index.ts index b46c1eaf1e6..aaef99f7cc4 100644 --- a/libs/platform/src/lib/value-help-dialog/index.ts +++ b/libs/platform/src/lib/value-help-dialog/index.ts @@ -7,5 +7,7 @@ export * from './components/value-help-dialog-filter/value-help-dialog-filter.co export * from './components/value-help-dialog-search/value-help-dialog-search.component'; export * from './constans'; export * from './directives/condition-count-message.directive'; +export * from './directives/value-help-column-def.directive'; +export * from './directives/value-help-filter-def.directive'; export * from './models'; export * from './value-help-dialog/value-help-dialog.component'; diff --git a/libs/platform/src/lib/value-help-dialog/models/vhd-component.model.ts b/libs/platform/src/lib/value-help-dialog/models/vhd-component.model.ts new file mode 100644 index 00000000000..e575fe2f4ee --- /dev/null +++ b/libs/platform/src/lib/value-help-dialog/models/vhd-component.model.ts @@ -0,0 +1,6 @@ +import { QueryList } from '@angular/core'; +import { ValueHelpColumnDefDirective } from '../directives/value-help-column-def.directive'; + +export abstract class VhdComponent { + abstract columnDef: QueryList; +} diff --git a/libs/platform/src/lib/value-help-dialog/models/vhd-filter.model.ts b/libs/platform/src/lib/value-help-dialog/models/vhd-filter.model.ts index 67d78be3737..6d4c816608f 100644 --- a/libs/platform/src/lib/value-help-dialog/models/vhd-filter.model.ts +++ b/libs/platform/src/lib/value-help-dialog/models/vhd-filter.model.ts @@ -1,3 +1,6 @@ +import { Nullable } from '@fundamental-ngx/cdk/utils'; +import { ValueHelpFilterDefDirective } from '../directives/value-help-filter-def.directive'; + export interface VhdFilter { key: string; label: string; @@ -6,4 +9,5 @@ export interface VhdFilter { advanced?: boolean; include?: boolean; exclude?: boolean; + filterDef: Nullable; } diff --git a/libs/platform/src/lib/value-help-dialog/value-help-dialog.module.ts b/libs/platform/src/lib/value-help-dialog/value-help-dialog.module.ts index e4cd365656d..d004aec91b0 100644 --- a/libs/platform/src/lib/value-help-dialog/value-help-dialog.module.ts +++ b/libs/platform/src/lib/value-help-dialog/value-help-dialog.module.ts @@ -36,6 +36,8 @@ import { SelectTabComponent } from './components/select-tab/select-tab.component import { DefineTabComponent } from './components/define-tab/define-tab.component'; import { ConditionCountMessageDirective } from './directives/condition-count-message.directive'; import { ScrollbarModule } from '@fundamental-ngx/core/scrollbar'; +import { ValueHelpColumnDefDirective } from './directives/value-help-column-def.directive'; +import { ValueHelpFilterDefDirective } from './directives/value-help-filter-def.directive'; @NgModule({ declarations: [ @@ -77,14 +79,18 @@ import { ScrollbarModule } from '@fundamental-ngx/core/scrollbar'; PlatformContentDensityDeprecationsModule, ScrollbarModule, SkeletonModule, - RepeatModule + RepeatModule, + ValueHelpColumnDefDirective, + ValueHelpFilterDefDirective ], exports: [ PlatformValueHelpDialogComponent, VhdFilterComponent, VhdSearchComponent, ContentDensityModule, - PlatformContentDensityDeprecationsModule + PlatformContentDensityDeprecationsModule, + ValueHelpColumnDefDirective, + ValueHelpFilterDefDirective ] }) export class PlatformValueHelpDialogModule {} diff --git a/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.html b/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.html index 20dd10b85e0..2f3857ab275 100644 --- a/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.html +++ b/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.html @@ -192,13 +192,21 @@
    - + + + + + + diff --git a/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.ts b/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.ts index 45dac329a89..d6082775aaf 100644 --- a/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.ts +++ b/libs/platform/src/lib/value-help-dialog/value-help-dialog/value-help-dialog.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/member-ordering */ import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -35,8 +36,10 @@ import { VhdValue, VhdValueChangeEvent } from '../models'; -import { VhdFilterComponent } from '../components/value-help-dialog-filter/value-help-dialog-filter.component'; +import { VhdComponent } from '../models/vhd-component.model'; import { defaultConditionDisplayFn } from '../constans/condition-display.function'; +import { VhdFilterComponent } from '../components/value-help-dialog-filter/value-help-dialog-filter.component'; +import { ValueHelpColumnDefDirective } from '../directives/value-help-column-def.directive'; import { cloneDeep } from 'lodash-es'; export type FdpValueHelpDialogDataSource = @@ -50,9 +53,15 @@ let vhiUniqueId = 0; templateUrl: './value-help-dialog.component.html', styleUrls: ['./value-help-dialog.component.scss'], encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: VhdComponent, + useExisting: PlatformValueHelpDialogComponent + } + ] }) -export class PlatformValueHelpDialogComponent implements OnChanges, OnDestroy { +export class PlatformValueHelpDialogComponent extends VhdComponent implements OnChanges, OnDestroy { /** Id of the popover */ @Input() id: string = 'fdp-vhd-' + vhiUniqueId++; @@ -204,6 +213,10 @@ export class PlatformValueHelpDialogComponent implements OnChanges, OnD @ContentChildren(VhdFilterComponent) filters: QueryList; + /** Column definitions. */ + @ContentChildren(ValueHelpColumnDefDirective) + columnDef: QueryList; + /** @hidden Internal container for dialog */ @ViewChild('container', { read: TemplateRef }) dialogContainer: TemplateRef; @@ -282,6 +295,7 @@ export class PlatformValueHelpDialogComponent implements OnChanges, OnD private readonly _dialogService: DialogService, @Optional() private readonly _rtlService: RtlService ) { + super(); /** Default display function for define conditions */ if (!this.conditionDisplayFn || typeof this.conditionDisplayFn !== 'function') { this.conditionDisplayFn = defaultConditionDisplayFn; @@ -426,7 +440,9 @@ export class PlatformValueHelpDialogComponent implements OnChanges, OnD if (!onlySearch) { this._displayedFilters - .filter(({ value }) => !!value && value.trim().length) + .filter(({ value }) => + !!value && typeof value === 'string' ? value.trim().length : value !== undefined + ) .forEach((e) => nonEmptyFilters.set(e.key, e.value)); }