Browse Source

allow change of default operator in row definition

feature/show-filtered-on-map
winzlieb 5 months ago
parent
commit
222a578fbd
  1. 7
      frontend/search/components/config/defaultColumnRawDefinition.ts
  2. 6
      frontend/search/components/ngo/HostOfferLookupTable.tsx
  3. 3
      frontend/search/components/util/datagrid/columnRaw.ts

7
frontend/search/components/config/defaultColumnRawDefinition.ts

@ -37,7 +37,12 @@ const columnsRaw: ColumnRaw[] = [
"group": "distance",
"header": "km",
"type": "number",
"defaultWidth": 105
"defaultWidth": 105,
"options": {
"filter": {
"operator": "lte"
}
}
},
{
"name": "place_country",

6
frontend/search/components/ngo/HostOfferLookupTable.tsx

@ -112,14 +112,14 @@ const columns: TypeColumn[] = defaultColumnRawDefinition
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))
.map(({name, type}) => {
.map(({name, type, options}) => {
return {
name,
type,
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
})

3
frontend/search/components/util/datagrid/columnRaw.ts

@ -2,6 +2,9 @@ import {Array2StringTransformOptions, DateToISOTransformOptions} from "../tableV
export type ColumnOptions = {
dateFormat?: string
filter?: {
operator?: string
}
transform?: {
array2string?: Array2StringTransformOptions
date2Iso?: DateToISOTransformOptions

Loading…
Cancel
Save