|
|
|
@ -54,6 +54,8 @@ const showDeleteColumnModal = ref(false)
|
|
|
|
|
|
|
|
|
|
const { gridViewCols } = useViewColumnsOrThrow() |
|
|
|
|
|
|
|
|
|
const { fieldsToGroupBy, groupByLimit } = useViewGroupBy(view) |
|
|
|
|
|
|
|
|
|
const setAsDisplayValue = async () => { |
|
|
|
|
try { |
|
|
|
|
const currentDisplayValue = meta?.value?.columns?.find((f) => f.pv) |
|
|
|
@ -298,8 +300,13 @@ const isDuplicateAllowed = computed(() => {
|
|
|
|
|
return column?.value && !column.value.system |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const isGroupedByThisField = computed(() => { |
|
|
|
|
return !!gridViewCols.value[column?.value?.id]?.group_by |
|
|
|
|
const isGroupedByThisField = computed(() => !!gridViewCols.value[column?.value?.id]?.group_by) |
|
|
|
|
|
|
|
|
|
const isGroupBySupported = computed(() => !!(fieldsToGroupBy.value || []).find((f) => f.id === column?.value?.id)) |
|
|
|
|
|
|
|
|
|
const isGroupByLimitExceeded = computed(() => { |
|
|
|
|
const groupBy = Object.values(gridViewCols.value).filter((c) => c.group_by) |
|
|
|
|
return !(fieldsToGroupBy.value.length && fieldsToGroupBy.value.length > groupBy.length && groupBy.length < groupByLimit) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => { |
|
|
|
@ -381,24 +388,34 @@ const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
|
|
|
|
|
<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" /> |
|
|
|
|
<!-- Group by this field --> |
|
|
|
|
<!-- Filter by this field --> |
|
|
|
|
Filter by this field |
|
|
|
|
</div> |
|
|
|
|
</NcMenuItem> |
|
|
|
|
|
|
|
|
|
<NcMenuItem |
|
|
|
|
@click=" |
|
|
|
|
filterOrGroupByThisField( |
|
|
|
|
isGroupedByThisField ? SmartsheetStoreEvents.GROUP_BY_REMOVE : SmartsheetStoreEvents.GROUP_BY_ADD, |
|
|
|
|
) |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<div v-e="['a:field:add:groupby']" class="nc-column-groupby nc-header-menu-item"> |
|
|
|
|
<component :is="iconMap.group" class="text-gray-700" /> |
|
|
|
|
<!-- Group by this field --> |
|
|
|
|
{{ isGroupedByThisField ? "Don't group by this field" : 'Group by this field' }} |
|
|
|
|
</div> |
|
|
|
|
</NcMenuItem> |
|
|
|
|
<NcTooltip :disabled="(isGroupBySupported && !isGroupByLimitExceeded) || isGroupedByThisField"> |
|
|
|
|
<template #title>{{ |
|
|
|
|
!isGroupBySupported |
|
|
|
|
? "This field type doesn't support grouping" |
|
|
|
|
: isGroupByLimitExceeded |
|
|
|
|
? 'Group by limit exceeded' |
|
|
|
|
: 'ds' |
|
|
|
|
}}</template> |
|
|
|
|
<NcMenuItem |
|
|
|
|
:disabled="(!isGroupBySupported || isGroupByLimitExceeded) && !isGroupedByThisField" |
|
|
|
|
@click=" |
|
|
|
|
filterOrGroupByThisField( |
|
|
|
|
isGroupedByThisField ? SmartsheetStoreEvents.GROUP_BY_REMOVE : SmartsheetStoreEvents.GROUP_BY_ADD, |
|
|
|
|
) |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<div v-e="['a:field:add:groupby']" class="nc-column-groupby nc-header-menu-item"> |
|
|
|
|
<component :is="iconMap.group" class="text-gray-700" /> |
|
|
|
|
<!-- Group by this field --> |
|
|
|
|
{{ isGroupedByThisField ? "Don't group by this field" : 'Group by this field' }} |
|
|
|
|
</div> |
|
|
|
|
</NcMenuItem> |
|
|
|
|
</NcTooltip> |
|
|
|
|
|
|
|
|
|
<a-divider class="!my-0" /> |
|
|
|
|
</template> |
|
|
|
@ -457,7 +474,10 @@ const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
:deep(.ant-dropdown-menu-item) { |
|
|
|
|
:deep(.ant-dropdown-menu-item:not(.ant-dropdown-menu-item-disabled)) { |
|
|
|
|
@apply !hover:text-black text-gray-700; |
|
|
|
|
} |
|
|
|
|
:deep(.ant-dropdown-menu-item.ant-dropdown-menu-item-disabled .nc-icon) { |
|
|
|
|
@apply text-current; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|