filterFieldsByComparator()
filterFieldsByComparator(
field
: {[key: string]
:unknown
;className
:Classname
;comparator
:string
| (f
: {[key: string]
:unknown
;className
:Classname
;comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; },operator
:string
) =>boolean
;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; },fields
:OptionList
<{[key: string]
:unknown
;className
:Classname
;comparator
:string
| (f
: {[key: string]
:unknown
;className
:Classname
;comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; },operator
:string
) =>boolean
;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; }>,operator
:string
): {[key: string]
:unknown
;className
:Classname
;comparator
:string
| (f
: {[key: string]
:unknown
;className
:Classname
;comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; },operator
:string
) =>boolean
;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; }[] | {label
:string
;options
:WithUnknownIndex
<{[key: string]
:unknown
;className
:Classname
;comparator
:string
| (f
: {[key: string]
:unknown
;className
:Classname
;comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<...>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
: ...) => ...;values
:FlexibleOptionList
<...>;valueSources
:ValueSources
| (operator
: ...) => ...; },operator
:string
) =>boolean
;defaultOperator
:string
;defaultValue
:any
;disabled
:boolean
;id
:string
;inputType
:null
|InputType
;label
:string
;name
:string
;operators
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;placeholder
:string
;validator
:RuleValidator
;value
:string
;valueEditorType
:ValueEditorType
| (operator
:string
) =>ValueEditorType
;values
:FlexibleOptionList
<{[key: string]
:unknown
;disabled
:boolean
;label
:string
;name
:string
;value
:string
; }>;valueSources
:ValueSources
| (operator
:string
) =>ValueSources
; }>[]; }[]
Defined in: packages/react-querybuilder/src/utils/filterFieldsByComparator.ts:25
For a given FullField, returns the fields
list filtered for
other fields that match by comparator
. Only fields other than the
one in question will ever be included, even if comparator
is null
or undefined
. If comparator
is a string, fields with the same value
for that property will be included. If comparator
is a function, each
field will be passed to the function along with the operator
and fields
for which the function returns true
will be included.
Parameters
Parameter | Type | Description |
---|---|---|
field | { [key: string] : unknown ; className : Classname ; comparator : string | (f : { [key: string] : unknown ; className : Classname ; comparator : string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...; defaultOperator : string ; defaultValue : any ; disabled : boolean ; id : string ; inputType : null | InputType ; label : string ; name : string ; operators : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; placeholder : string ; validator : RuleValidator ; value : string ; valueEditorType : ValueEditorType | (operator : string ) => ValueEditorType ; values : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; valueSources : ValueSources | (operator : string ) => ValueSources ; }, operator : string ) => boolean ; defaultOperator : string ; defaultValue : any ; disabled : boolean ; id : string ; inputType : null | InputType ; label : string ; name : string ; operators : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; placeholder : string ; validator : RuleValidator ; value : string ; valueEditorType : ValueEditorType | (operator : string ) => ValueEditorType ; values : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; valueSources : ValueSources | (operator : string ) => ValueSources ; } | The field in question. |
field.className ? | Classname | - |
field.comparator ? | string | (f : { [key: string] : unknown ; className : Classname ; comparator : string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...; defaultOperator : string ; defaultValue : any ; disabled : boolean ; id : string ; inputType : null | InputType ; label : string ; name : string ; operators : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; placeholder : string ; validator : RuleValidator ; value : string ; valueEditorType : ValueEditorType | (operator : string ) => ValueEditorType ; values : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; valueSources : ValueSources | (operator : string ) => ValueSources ; }, operator : string ) => boolean | - |
field.defaultOperator ? | string | - |
field.defaultValue ? | any | - |
field.disabled ? | boolean | - |
field.id ? | string | - |
field.inputType ? | null | InputType | - |
field.label | string | - |
field.name | string | - |
field.operators ? | FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }> | - |
field.placeholder ? | string | - |
field.validator ? | RuleValidator | - |
field.value | string | - |
field.valueEditorType ? | ValueEditorType | (operator : string ) => ValueEditorType | - |
field.values ? | FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }> | - |
field.valueSources ? | ValueSources | (operator : string ) => ValueSources | - |
fields | OptionList <{ [key: string] : unknown ; className : Classname ; comparator : string | (f : { [key: string] : unknown ; className : Classname ; comparator : string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...; defaultOperator : string ; defaultValue : any ; disabled : boolean ; id : string ; inputType : null | InputType ; label : string ; name : string ; operators : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; placeholder : string ; validator : RuleValidator ; value : string ; valueEditorType : ValueEditorType | (operator : string ) => ValueEditorType ; values : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; valueSources : ValueSources | (operator : string ) => ValueSources ; }, operator : string ) => boolean ; defaultOperator : string ; defaultValue : any ; disabled : boolean ; id : string ; inputType : null | InputType ; label : string ; name : string ; operators : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; placeholder : string ; validator : RuleValidator ; value : string ; valueEditorType : ValueEditorType | (operator : string ) => ValueEditorType ; values : FlexibleOptionList <{ [key: string] : unknown ; disabled : boolean ; label : string ; name : string ; value : string ; }>; valueSources : ValueSources | (operator : string ) => ValueSources ; }> | The full FullField list to be filtered. |
operator | string | - |
Returns
{ [key: string]
: unknown
; className
: Classname
; comparator
: string
| (f
: { [key: string]
: unknown
; className
: Classname
; comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...; defaultOperator
: string
; defaultValue
: any
; disabled
: boolean
; id
: string
; inputType
: null
| InputType
; label
: string
; name
: string
; operators
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; placeholder
: string
; validator
: RuleValidator
; value
: string
; valueEditorType
: ValueEditorType
| (operator
: string
) => ValueEditorType
; values
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; valueSources
: ValueSources
| (operator
: string
) => ValueSources
; }, operator
: string
) => boolean
; defaultOperator
: string
; defaultValue
: any
; disabled
: boolean
; id
: string
; inputType
: null
| InputType
; label
: string
; name
: string
; operators
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; placeholder
: string
; validator
: RuleValidator
; value
: string
; valueEditorType
: ValueEditorType
| (operator
: string
) => ValueEditorType
; values
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; valueSources
: ValueSources
| (operator
: string
) => ValueSources
; }[] | { label
: string
; options
: WithUnknownIndex
<{ [key: string]
: unknown
; className
: Classname
; comparator
: string
| (f
: { [key: string]
: unknown
; className
: Classname
; comparator
: string | ((f: { [x: string]: unknown; label: string; disabled?: boolean | undefined; name: string; value: string; id?: string | undefined; operators?: FlexibleOptionList<{ [x: string]: unknown; value?: string | undefined; label: string; disabled?: boolean | undefined; name: string; }> | undefined; ... 9 more ...; cl...; defaultOperator
: string
; defaultValue
: any
; disabled
: boolean
; id
: string
; inputType
: null
| InputType
; label
: string
; name
: string
; operators
: FlexibleOptionList
<...>; placeholder
: string
; validator
: RuleValidator
; value
: string
; valueEditorType
: ValueEditorType
| (operator
: ...) => ...; values
: FlexibleOptionList
<...>; valueSources
: ValueSources
| (operator
: ...) => ...; }, operator
: string
) => boolean
; defaultOperator
: string
; defaultValue
: any
; disabled
: boolean
; id
: string
; inputType
: null
| InputType
; label
: string
; name
: string
; operators
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; placeholder
: string
; validator
: RuleValidator
; value
: string
; valueEditorType
: ValueEditorType
| (operator
: string
) => ValueEditorType
; values
: FlexibleOptionList
<{ [key: string]
: unknown
; disabled
: boolean
; label
: string
; name
: string
; value
: string
; }>; valueSources
: ValueSources
| (operator
: string
) => ValueSources
; }>[]; }[]
API documentation is generated from the latest commit on the main
branch. It may be somewhat inconsistent with official releases of React Query Builder.