From e771b467f2539b05dc1fe62f763e659449a359fd Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Feb 2023 19:19:23 +0800 Subject: [PATCH] feat(nc-gui): move isComparisonOpAllowed to useViewFilter --- .../smartsheet/toolbar/ColumnFilter.vue | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue index 22850183d8..4e835a13c7 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue +++ b/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