Fix view filters not accounting for invalid column names
This commit is contained in:
parent
845a350505
commit
39c992c6ae
|
@ -82,34 +82,30 @@
|
||||||
|
|
||||||
function isMultipleChoice(field) {
|
function isMultipleChoice(field) {
|
||||||
return (
|
return (
|
||||||
(viewTable.schema[field].constraints &&
|
viewTable.schema[field]?.constraints?.inclusion?.length ||
|
||||||
viewTable.schema[field].constraints.inclusion &&
|
viewTable.schema[field]?.type === "boolean"
|
||||||
viewTable.schema[field].constraints.inclusion.length) ||
|
|
||||||
viewTable.schema[field].type === "boolean"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function fieldOptions(field) {
|
function fieldOptions(field) {
|
||||||
return viewTable.schema[field].type === "options"
|
return viewTable.schema[field]?.type === "options"
|
||||||
? viewTable.schema[field].constraints.inclusion
|
? viewTable.schema[field]?.constraints.inclusion
|
||||||
: [true, false]
|
: [true, false]
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDate(field) {
|
function isDate(field) {
|
||||||
return viewTable.schema[field].type === "datetime"
|
return viewTable.schema[field]?.type === "datetime"
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNumber(field) {
|
function isNumber(field) {
|
||||||
return viewTable.schema[field].type === "number"
|
return viewTable.schema[field]?.type === "number"
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldChanged = filter => ev => {
|
const fieldChanged = filter => ev => {
|
||||||
// reset if type changed
|
// Reset if type changed
|
||||||
if (
|
const oldType = viewTable.schema[filter.key]?.type
|
||||||
filter.key &&
|
const newType = viewTable.schema[ev.detail]?.type
|
||||||
ev.detail &&
|
if (filter.key && ev.detail && oldType !== newType) {
|
||||||
viewTable.schema[filter.key].type !== viewTable.schema[ev.detail].type
|
|
||||||
) {
|
|
||||||
filter.value = ""
|
filter.value = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue