Feedback update for reactive filter statements

This commit is contained in:
Dean 2023-01-23 12:26:59 +00:00
parent 45b907cfde
commit 6071b650d7
1 changed files with 19 additions and 16 deletions

View File

@ -32,24 +32,9 @@
let exportFormat = FORMATS[0].key
let filterLookup
let exportOpDisplay = []
$: luceneFilter = LuceneUtils.buildLuceneQuery(filters)
$: if (filters) {
exportOpDisplay = filterDisplay()
}
$: if (sorting) {
exportOpDisplay = [
...exportOpDisplay,
{
Field: sorting.sortColumn,
Operation: "Order By",
"Field Value": sorting.sortOrder,
},
]
}
$: exportOpDisplay = buildExportOpDisplay(sorting, filterDisplay, filters)
const buildFilterLookup = () => {
return Object.keys(Constants.OperatorOptions).reduce((acc, key) => {
@ -61,6 +46,9 @@
filterLookup = buildFilterLookup()
const filterDisplay = () => {
if (!filters) {
return []
}
return filters.map(filter => {
let newFieldName = filter.field + ""
const parts = newFieldName.split(":")
@ -74,6 +62,21 @@
})
}
const buildExportOpDisplay = (sorting, filterDisplay) => {
let filterDisplayConfig = filterDisplay()
if (sorting) {
filterDisplayConfig = [
...filterDisplayConfig,
{
Field: sorting.sortColumn,
Operation: "Order By",
"Field Value": sorting.sortOrder,
},
]
}
return filterDisplayConfig
}
const displaySchema = {
Field: {
type: "string",