Browse Source

feat: when adding new filter set logical op based on existing siblings

pull/8396/head
Pranav C 8 months ago
parent
commit
3e605e8917
  1. 1
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  2. 4
      packages/nc-gui/composables/useViewFilters.ts

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

@ -421,6 +421,7 @@ const onLogicalOpUpdate = async (filter: Filter, index: number) => {
dropdown-class-name="nc-dropdown-filter-logical-op-group"
@click.stop
@change="saveOrUpdate(filter, i)"
:disabled="(i > 1 && !isLogicalOpChangeAllowed)"
>
<a-select-option v-for="op in logicalOps" :key="op.value" :value="op.value">
<div class="flex items-center w-full justify-between w-full gap-2">

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

@ -198,13 +198,15 @@ export function useViewFilters(
}
const placeholderFilter = (): Filter => {
const logicalOps = new Set(filters.value.slice(1).map((filter) => filter.logical_op))
return {
comparison_op: comparisonOpList(options.value?.[0].uidt as UITypes).filter((compOp) =>
isComparisonOpAllowed({ fk_column_id: options.value?.[0].id }, compOp),
)?.[0].value as FilterType['comparison_op'],
value: '',
status: 'create',
logical_op: 'and',
logical_op: logicalOps.size === 1 ? logicalOps.values().next().value :'and' ,
}
}

Loading…
Cancel
Save