Browse Source

feat(nc-gui): move isComparisonOpAllowed to useViewFilter

pull/5106/head
Wing-Kam Wong 2 years ago
parent
commit
e771b467f2
  1. 22
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

22
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -52,6 +52,7 @@ const {
addFilterGroup,
sync,
saveOrUpdateDebounced,
isComparisonOpAllowed,
} = useViewFilters(
activeView,
parentId,
@ -117,27 +118,6 @@ const applyChanges = async (hookId?: string, _nested = false) => {
}
}
const isComparisonOpAllowed = (
filter: FilterType,
compOp: {
text: string
value: string
ignoreVal?: boolean
includedTypes?: UITypes[]
excludedTypes?: UITypes[]
},
) => {
// include allowed values only if selected column type matches
if (compOp.includedTypes) {
return filter.fk_column_id && compOp.includedTypes.includes(types.value[filter.fk_column_id])
}
// include not allowed values only if selected column type not matches
else if (compOp.excludedTypes) {
return filter.fk_column_id && !compOp.excludedTypes.includes(types.value[filter.fk_column_id])
}
return true
}
const selectFilterField = (filter: Filter, index: number) => {
// when we change the field,
// the corresponding default filter operator needs to be changed as well

Loading…
Cancel
Save