allow change of default operator in row definition
This commit is contained in:
parent
4c3bd32408
commit
222a578fbd
|
@ -37,7 +37,12 @@ const columnsRaw: ColumnRaw[] = [
|
||||||
"group": "distance",
|
"group": "distance",
|
||||||
"header": "km",
|
"header": "km",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"defaultWidth": 105
|
"defaultWidth": 105,
|
||||||
|
"options": {
|
||||||
|
"filter": {
|
||||||
|
"operator": "lte"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "place_country",
|
"name": "place_country",
|
||||||
|
|
|
@ -112,14 +112,14 @@ const columns: TypeColumn[] = defaultColumnRawDefinition
|
||||||
editor: editorMappings[c.type as 'string' | 'number' | 'boolean' | 'date']
|
editor: editorMappings[c.type as 'string' | 'number' | 'boolean' | 'date']
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const defaultFilterValue: TypeFilterValue = columns
|
const defaultFilterValue: TypeFilterValue = defaultColumnRawDefinition
|
||||||
.filter(({type}) => type && ['string', 'number', 'boolean', 'date'].includes(type))
|
.filter(({type}) => type && ['string', 'number', 'boolean', 'date'].includes(type))
|
||||||
.map(({name, type}) => {
|
.map(({name, type, options}) => {
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
value: null,
|
value: null,
|
||||||
operator: operatorsForType[type as 'string' | 'number' | 'date' | 'boolean']
|
operator: options?.filter?.operator || operatorsForType[type as 'string' | 'number' | 'date' | 'boolean']
|
||||||
} as unknown as TypeSingleFilterValue
|
} as unknown as TypeSingleFilterValue
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ import {Array2StringTransformOptions, DateToISOTransformOptions} from "../tableV
|
||||||
|
|
||||||
export type ColumnOptions = {
|
export type ColumnOptions = {
|
||||||
dateFormat?: string
|
dateFormat?: string
|
||||||
|
filter?: {
|
||||||
|
operator?: string
|
||||||
|
}
|
||||||
transform?: {
|
transform?: {
|
||||||
array2string?: Array2StringTransformOptions
|
array2string?: Array2StringTransformOptions
|
||||||
date2Iso?: DateToISOTransformOptions
|
date2Iso?: DateToISOTransformOptions
|
||||||
|
|
Loading…
Reference in New Issue