packageDocumentation module import { PropertyRecord , PropertyValueFormat } from "@itwin/appui-abstract" ; import { countMatchesInString } from "../../../common/countMatchesInString" ; import { FilteredType , PropertyDataFilterResult , PropertyRecordDataFiltererBase } from "./PropertyDataFiltererBase" ; public export class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase { private _filterText : string = "" ; public constructor ( filterText = "" ) { super ( ) ; this . _filterText = filterText ; } public get filterText ( ) : string { return this . _filterText ; } public set filterText ( value ) { const lowerValue = value . toLowerCase ( ) . trim ( ) ; if ( lowerValue !== this . filterText ) { this . _filterText = lowerValue ; this . onFilterChanged . raiseEvent ( ) ; } } public get isActive ( ) { return this . filterText !== "" ; } public async recordMatchesFilter ( node ) { if ( ! this . isActive ) return { matchesFilter : true } ; if ( node . value . valueFormat !== PropertyValueFormat . Primitive ) return { matchesFilter : false } ; const displayValue = node . value . displayValue ?. toLowerCase ( ) ?? "" ; const matchesCount = countMatchesInString ( displayValue , this . filterText ) ; if ( matchesCount === 0 ) return { matchesFilter : false } ; return { matchesFilter : true , shouldExpandNodeParents : true , matchesCount , filteredTypes : [ FilteredType . Value ] } ; } }