Browse Source

fix(nc-gui): add clear option for single select user field list type

pull/7729/head
Ramesh Mane 9 months ago
parent
commit
de22512655
  1. 8
      packages/nc-gui/components/cell/User.vue

8
packages/nc-gui/components/cell/User.vue

@ -193,7 +193,7 @@ const vModel = computed({
}) })
const vModelListLayout = computed(() => { const vModelListLayout = computed(() => {
if (isMultiple) { if (isMultiple.value) {
return (vModel.value || []).map((item) => item.value) return (vModel.value || []).map((item) => item.value)
} else { } else {
return (vModel.value || [])?.[0]?.value || '' return (vModel.value || [])?.[0]?.value || ''
@ -323,11 +323,10 @@ const filterOption = (input: string, option: any) => {
<div v-if="!isEditColumn && isForm && parseProp(column.meta)?.isList" class="w-full max-w-full"> <div v-if="!isEditColumn && isForm && parseProp(column.meta)?.isList" class="w-full max-w-full">
<component <component
:is="isMultiple ? CheckboxGroup : RadioGroup" :is="isMultiple ? CheckboxGroup : RadioGroup"
:model-value:value="vModelListLayout" v-model:value="vModelListLayout"
class="nc-field-layout-list" class="nc-field-layout-list"
@update:value=" @update:value="
(value) => { (value) => {
// Todo: fix update single select user issue
vModel = isMultiple ? value : [value] vModel = isMultiple ? value : [value]
} }
" "
@ -379,6 +378,9 @@ const filterOption = (input: string, option: any) => {
</component> </component>
</template> </template>
</component> </component>
<div v-if="!isMultiple && vModel.length" class="inline-block px-2 pt-2 cursor-pointer text-xs" @click="vModel = []">
{{ $t('labels.clearSelection') }}
</div>
</div> </div>
<template v-else> <template v-else>
<div <div

Loading…
Cancel
Save