Skip to content
Snippets Groups Projects
Commit 298f0246 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Merge branch 'operon-struct-type' into operon-struct-type-article-update

parents 9d69d844 887cdfdd
No related branches found
No related tags found
No related merge requests found
Pipeline #129156 waiting for manual action with stages
in 7 minutes and 52 seconds
...@@ -193,6 +193,7 @@ function updateAutocompleteFocused(isFocused: boolean) { ...@@ -193,6 +193,7 @@ function updateAutocompleteFocused(isFocused: boolean) {
function emitUpdateModelValue(filters: MaybeRef<FilterItem[] | undefined>) { function emitUpdateModelValue(filters: MaybeRef<FilterItem[] | undefined>) {
console.log("emitupdatemodelValue")
console.log(filters) console.log(filters)
emit('update:modelValue', toValue(filters)) emit('update:modelValue', toValue(filters))
...@@ -204,21 +205,23 @@ function clearFilters() { ...@@ -204,21 +205,23 @@ function clearFilters() {
function deleteOneFilter(index: number) { function deleteOneFilter(index: number) {
const toValFilterItems = toValue(props.modelValue) const toValFilterItems = toValue(props.modelValue)
console.log(toValFilterItems)
const cloneFilters = toValFilterItems?.slice(0)
// check if the next item is an outeroperator // check if the next item is an outeroperator
const nextFilterItem = toValFilterItems?.slice(index + 1, index + 2) const nextFilterItem = cloneFilters?.slice(index + 1, index + 2)
if (index + 1 === toValFilterItems?.length && toValFilterItems?.length >= 7) { if (index + 1 === cloneFilters?.length && cloneFilters?.length >= 7) {
// need to remove the previous outer operator // need to remove the previous outer operator
toValFilterItems?.splice(index - 3, 4) cloneFilters?.splice(index - 3, 4)
} }
else if (nextFilterItem?.length === 1 && nextFilterItem[0].type === 'outerOperator') { else if (nextFilterItem?.length === 1 && nextFilterItem[0].type === 'outerOperator') {
toValFilterItems?.splice(index - 2, 4) cloneFilters?.splice(index - 2, 4)
} }
else { else {
toValFilterItems?.splice(index - 2, 3) cloneFilters?.splice(index - 2, 3)
} }
emitUpdateModelValue(toValFilterItems) emitUpdateModelValue(cloneFilters)
} }
function isItemFilter(type: string | undefined) { function isItemFilter(type: string | undefined) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment