Browse Source

fix(swagger): ignore system fields from filter and sort

- ignore hasmany and manytomany fields from sort

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3057/head
Pranav C 2 years ago
parent
commit
83be973007
  1. 11
      packages/nc-gui-v2/components/dashboard/TreeView.vue
  2. 36
      packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue
  3. 1
      packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue

11
packages/nc-gui-v2/components/dashboard/TreeView.vue

@ -296,12 +296,19 @@ const activeTable = computed(() => {
@apply relative cursor-pointer after:(content-[''] absolute top-0 left-0 w-full h-full right-0 !bg-current transition transition-opactity duration-100 opacity-0); @apply relative cursor-pointer after:(content-[''] absolute top-0 left-0 w-full h-full right-0 !bg-current transition transition-opactity duration-100 opacity-0);
} }
.nc-tree-item svg{
@apply text-gray-500
}
.nc-tree-item.active { .nc-tree-item.active {
@apply !text-primary after:(!opacity-10); @apply !text-primary after:(!opacity-5);
svg {
@apply !text-primary
}
} }
.nc-tree-item:hover { .nc-tree-item:hover {
@apply !text-grey after:(!opacity-5); @apply !text-grey after:(!opacity-2);
} }
</style> </style>

36
packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { SelectProps } from 'ant-design-vue' import type { SelectProps } from 'ant-design-vue'
import { isVirtualCol } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import { computed } from 'vue' import { computed } from 'vue'
import { MetaInj } from '~/context' import { MetaInj } from '~/context'
import VirtualCellIcon from '~/components/smartsheet-header/VirtualCellIcon.vue' import VirtualCellIcon from '~/components/smartsheet-header/VirtualCellIcon.vue'
@ -8,9 +9,10 @@ import CellIcon from '~/components/smartsheet-header/CellIcon.vue'
interface Props { interface Props {
modelValue?: string modelValue?: string
isSort?: boolean
} }
const { modelValue } = defineProps<Props>() const { modelValue, isSort } = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
@ -48,14 +50,25 @@ const localValue = computed({
}, },
} */ } */
const options = computed<SelectProps['options']>(() => const options = computed<SelectProps['options']>(() =>
meta?.value?.columns?.map((c) => ({ meta?.value?.columns
value: c.id, ?.filter(
label: c.title, (c: ColumnType) =>
icon: h(isVirtualCol(c) ? VirtualCellIcon : CellIcon, { c &&
columnMeta: c, (isSort
}), ? !(
c, c.uidt === UITypes.LinkToAnotherRecord &&
})), (c.colOptions as LinkToAnotherRecordType).type !== RelationTypes.BELONGS_TO
)
: !c.colOptions || !c.system),
)
.map((c: ColumnType) => ({
value: c.id,
label: c.title,
icon: h(isVirtualCol(c) ? VirtualCellIcon : CellIcon, {
columnMeta: c,
}),
c,
})),
) )
const filterOption = (input: string, option: any) => { const filterOption = (input: string, option: any) => {
@ -75,7 +88,8 @@ const filterOption = (input: string, option: any) => {
> >
<a-select-option v-for="option in options" :key="option.value" :value="option.value"> <a-select-option v-for="option in options" :key="option.value" :value="option.value">
<div class="flex gap-2 text-xs items-center align-center h-full"> <div class="flex gap-2 text-xs items-center align-center h-full">
<component :is="option.icon" class="min-w-5 !mx-0" /> <span class="min-w-0"> {{ option.label }}</span> <component :is="option.icon" class="min-w-5 !mx-0" />
<span class="min-w-0"> {{ option.label }}</span>
</div> </div>
</a-select-option> </a-select-option>
</a-select> </a-select>

1
packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue

@ -59,6 +59,7 @@ watch(
v-model="sort.fk_column_id" v-model="sort.fk_column_id"
class="caption nc-sort-field-select" class="caption nc-sort-field-select"
:columns="columns" :columns="columns"
is-sort
@click.stop @click.stop
@update:model-value="saveOrUpdate(sort, i)" @update:model-value="saveOrUpdate(sort, i)"
/> />

Loading…
Cancel
Save