Browse Source

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

pull/7729/head
Ramesh Mane 10 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(() => {
if (isMultiple) {
if (isMultiple.value) {
return (vModel.value || []).map((item) => item.value)
} else {
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">
<component
:is="isMultiple ? CheckboxGroup : RadioGroup"
:model-value:value="vModelListLayout"
v-model:value="vModelListLayout"
class="nc-field-layout-list"
@update:value="
(value) => {
// Todo: fix update single select user issue
vModel = isMultiple ? value : [value]
}
"
@ -379,6 +378,9 @@ const filterOption = (input: string, option: any) => {
</component>
</template>
</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>
<template v-else>
<div

Loading…
Cancel
Save