Browse Source

fix(nc-gui): include unhidden fields for filter

pull/5106/head
Wing-Kam Wong 2 years ago
parent
commit
fe02c935ea
  1. 8
      packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
  2. 8
      packages/nc-gui/composables/useViewFilters.ts

8
packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue

@ -2,7 +2,7 @@
import type { SelectProps } from 'ant-design-vue' import type { SelectProps } from 'ant-design-vue'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import { FieldsInj, computed, inject, ref, resolveComponent } from '#imports' import { MetaInj, FieldsInj, computed, inject, ref, resolveComponent } from '#imports'
const { modelValue, isSort } = defineProps<{ const { modelValue, isSort } = defineProps<{
modelValue?: string modelValue?: string
@ -11,6 +11,8 @@ const { modelValue, isSort } = defineProps<{
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const meta = inject(MetaInj, ref())
const fields = inject(FieldsInj, ref()) const fields = inject(FieldsInj, ref())
const localValue = computed({ const localValue = computed({
@ -19,9 +21,9 @@ const localValue = computed({
}) })
const options = computed<SelectProps['options']>(() => const options = computed<SelectProps['options']>(() =>
fields.value meta.value?.columns
?.filter((c: ColumnType) => { ?.filter((c: ColumnType) => {
if (c.uidt === UITypes.QrCode || c.uidt === UITypes.Barcode) { if (c.uidt === UITypes.QrCode || c.uidt === UITypes.Barcode || c.uidt === UITypes.ID) {
return false return false
} else if (isSort) { } else if (isSort) {
/** ignore hasmany and manytomany relations if it's using within sort menu */ /** ignore hasmany and manytomany relations if it's using within sort menu */

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

@ -74,9 +74,11 @@ export function useViewFilters(
// nonDeletedFilters are those filters that are not deleted physically & virtually // nonDeletedFilters are those filters that are not deleted physically & virtually
const nonDeletedFilters = computed(() => filters.value.filter((f) => f.status !== 'delete')) const nonDeletedFilters = computed(() => filters.value.filter((f) => f.status !== 'delete'))
const meta = inject(MetaInj, ref())
const options = computed<SelectProps['options']>(() => const options = computed<SelectProps['options']>(() =>
fields.value?.filter((c: ColumnType) => { meta.value?.columns?.filter((c: ColumnType) => {
if (c.uidt === UITypes.QrCode || c.uidt === UITypes.Barcode) { if (c.uidt === UITypes.QrCode || c.uidt === UITypes.Barcode || c.uidt === UITypes.ID) {
return false return false
} else { } else {
const isVirtualSystemField = c.colOptions && c.system const isVirtualSystemField = c.colOptions && c.system
@ -85,8 +87,6 @@ export function useViewFilters(
}), }),
) )
const meta = inject(MetaInj, ref())
const isComparisonOpAllowed = ( const isComparisonOpAllowed = (
filter: FilterType, filter: FilterType,
compOp: { compOp: {

Loading…
Cancel
Save