fix: allow is operator in Select & Link also like, not like in Select field
This commit is contained in:
parent
4175371708
commit
322f9d7dda
@ -223,11 +223,23 @@ function getOperators(fieldtype, fieldname) {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (typeSelect.includes(fieldtype) || typeLink.includes(fieldtype)) {
|
if (typeSelect.includes(fieldtype)) {
|
||||||
options.push(
|
options.push(
|
||||||
...[
|
...[
|
||||||
{ label: 'Equals', value: 'equals' },
|
{ label: 'Equals', value: 'equals' },
|
||||||
{ label: 'Not Equals', value: 'not equals' },
|
{ label: 'Not Equals', value: 'not equals' },
|
||||||
|
{ label: 'Is', value: 'is' },
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (typeLink.includes(fieldtype)) {
|
||||||
|
options.push(
|
||||||
|
...[
|
||||||
|
{ label: 'Equals', value: 'equals' },
|
||||||
|
{ label: 'Not Equals', value: 'not equals' },
|
||||||
|
{ label: 'Is', value: 'is' },
|
||||||
|
{ label: 'Like', value: 'like' },
|
||||||
|
{ label: 'Not Like', value: 'not like' },
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -253,17 +265,7 @@ function getOperators(fieldtype, fieldname) {
|
|||||||
function getValSelect(f) {
|
function getValSelect(f) {
|
||||||
const { field, operator } = f
|
const { field, operator } = f
|
||||||
const { fieldtype, options } = field
|
const { fieldtype, options } = field
|
||||||
if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) {
|
if (operator == 'is') {
|
||||||
const _options =
|
|
||||||
fieldtype == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
|
||||||
return h(FormControl, {
|
|
||||||
type: 'select',
|
|
||||||
options: _options.map((o) => ({
|
|
||||||
label: o,
|
|
||||||
value: o,
|
|
||||||
})),
|
|
||||||
})
|
|
||||||
} else if (operator == 'is') {
|
|
||||||
return h(FormControl, {
|
return h(FormControl, {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: [
|
options: [
|
||||||
@ -282,6 +284,18 @@ function getValSelect(f) {
|
|||||||
type: 'select',
|
type: 'select',
|
||||||
options: timespanOptions,
|
options: timespanOptions,
|
||||||
})
|
})
|
||||||
|
} else if (operator == 'like') {
|
||||||
|
return h(FormControl, { type: 'text' })
|
||||||
|
} else if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) {
|
||||||
|
const _options =
|
||||||
|
fieldtype == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
||||||
|
return h(FormControl, {
|
||||||
|
type: 'select',
|
||||||
|
options: _options.map((o) => ({
|
||||||
|
label: o,
|
||||||
|
value: o,
|
||||||
|
})),
|
||||||
|
})
|
||||||
} else if (typeLink.includes(fieldtype)) {
|
} else if (typeLink.includes(fieldtype)) {
|
||||||
return h(Link, { class: 'form-control', doctype: options })
|
return h(Link, { class: 'form-control', doctype: options })
|
||||||
} else if (typeNumber.includes(fieldtype)) {
|
} else if (typeNumber.includes(fieldtype)) {
|
||||||
@ -309,7 +323,7 @@ function getDefaultValue(field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultOperator(fieldtype) {
|
function getDefaultOperator(fieldtype) {
|
||||||
if (typeSelect.includes(fieldtype) || typeLink.includes(fieldtype)) {
|
if (typeSelect.includes(fieldtype)) {
|
||||||
return 'equals'
|
return 'equals'
|
||||||
}
|
}
|
||||||
if (typeCheck.includes(fieldtype) || typeNumber.includes(fieldtype)) {
|
if (typeCheck.includes(fieldtype) || typeNumber.includes(fieldtype)) {
|
||||||
@ -391,7 +405,16 @@ function updateOperator(event, filter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isSameTypeOperator(oldOperator, newOperator) {
|
function isSameTypeOperator(oldOperator, newOperator) {
|
||||||
let textOperators = ['like', 'not like', 'equals', 'not equals', '>', '<', '>=', '<=']
|
let textOperators = [
|
||||||
|
'like',
|
||||||
|
'not like',
|
||||||
|
'equals',
|
||||||
|
'not equals',
|
||||||
|
'>',
|
||||||
|
'<',
|
||||||
|
'>=',
|
||||||
|
'<=',
|
||||||
|
]
|
||||||
if (
|
if (
|
||||||
textOperators.includes(oldOperator) &&
|
textOperators.includes(oldOperator) &&
|
||||||
textOperators.includes(newOperator)
|
textOperators.includes(newOperator)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user