Browse Source

feat(nc-gui): show empty & null based on showNullAndEmptyInFilter

pull/5106/head
Wing-Kam Wong 2 years ago
parent
commit
0522c35198
  1. 15
      packages/nc-gui/composables/useViewFilters.ts

15
packages/nc-gui/composables/useViewFilters.ts

@ -11,6 +11,7 @@ import {
message,
ref,
useDebounceFn,
useGlobal,
useMetas,
useNuxtApp,
useUIPermission,
@ -33,6 +34,8 @@ export function useViewFilters(
const { nestedFilters } = useSmartsheetStoreOrThrow()
const { showNullAndEmptyInFilter } = useGlobal()
const isPublic = inject(IsPublicInj, ref(false))
const { $api, $e } = useNuxtApp()
@ -105,12 +108,14 @@ export function useViewFilters(
excludedTypes?: UITypes[]
},
) => {
// include allowed values only if selected column type matches
if (compOp.includedTypes) {
if (['empty', 'notempty', 'null', 'notnull'].includes(compOp.value)) {
// for these 4 comparisonOp, show them based on `showNullAndEmptyInFilter` in Project Settings
return showNullAndEmptyInFilter.value
} else if (compOp.includedTypes) {
// include allowed values only if selected column type matches
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) {
} else if (compOp.excludedTypes) {
// include not allowed values only if selected column type not matches
return filter.fk_column_id && !compOp.excludedTypes.includes(types.value[filter.fk_column_id])
}
return true

Loading…
Cancel
Save