Browse Source

fix(nc-gui): exclude barcode & qr code field from filter & group menu list

pull/8309/head
Ramesh Mane 7 months ago
parent
commit
cd102d5a52
  1. 24
      packages/nc-gui/components/smartsheet/header/Menu.vue
  2. 5
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

24
packages/nc-gui/components/smartsheet/header/Menu.vue

@ -299,6 +299,13 @@ const isDeleteAllowed = computed(() => {
const isDuplicateAllowed = computed(() => {
return column?.value && !column.value.system
})
const isFilterSupported = computed(
() =>
!!(meta.value?.columns || []).find((f) => f.id === column?.value?.id && ![UITypes.QrCode, UITypes.Barcode].includes(f.uidt)),
)
// TODO: calculate filter limit
const isFilterLimitExceeded = computed(() => false)
const isGroupedByThisField = computed(() => !!gridViewCols.value[column?.value?.id]?.group_by)
@ -385,13 +392,16 @@ const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
<a-divider v-if="!column?.pk" class="!my-0" />
<template v-if="true">
<NcMenuItem @click="filterOrGroupByThisField(SmartsheetStoreEvents.FILTER_ADD)">
<div v-e="['a:field:add:filter']" class="nc-column-filter nc-header-menu-item">
<component :is="iconMap.filter" class="text-gray-700" />
<!-- Filter by this field -->
Filter by this field
</div>
</NcMenuItem>
<NcTooltip :disabled="isFilterSupported">
<template #title> This field type doesn't support filtering </template>
<NcMenuItem @click="filterOrGroupByThisField(SmartsheetStoreEvents.FILTER_ADD)" :disabled="!isFilterSupported">
<div v-e="['a:field:add:filter']" class="nc-column-filter nc-header-menu-item">
<component :is="iconMap.filter" class="text-gray-700" />
<!-- Filter by this field -->
Filter by this field
</div>
</NcMenuItem>
</NcTooltip>
<NcTooltip :disabled="(isGroupBySupported && !isGroupByLimitExceeded) || isGroupedByThisField">
<template #title>{{

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

@ -29,6 +29,7 @@ interface Props {
webHook?: boolean
draftFilter?: Partial<FilterType>
}
const excludedFilterColUidt = [UITypes.QrCode, UITypes.Barcode]
const props = withDefaults(defineProps<Props>(), {
nestedLevel: 0,
@ -101,6 +102,8 @@ const isMounted = ref(false)
const columns = computed(() => meta.value?.columns)
const fieldsToFilter = computed(() => (columns.value || []).filter((c) => !excludedFilterColUidt.includes(c.uidt as UITypes)))
const getColumn = (filter: Filter) => {
// extract looked up column if available
return btLookupTypesMap.value[filter.fk_column_id] || columns.value?.find((col: ColumnType) => col.id === filter.fk_column_id)
@ -457,7 +460,7 @@ watch(
:key="`${i}_6`"
v-model="filter.fk_column_id"
class="nc-filter-field-select min-w-32 max-w-32 max-h-8"
:columns="columns"
:columns="fieldsToFilter"
:disabled="filter.readOnly"
@click.stop
@change="selectFilterField(filter, i)"

Loading…
Cancel
Save