Browse Source

fix(gui): close options list when if not active or editable

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4957/head
Pranav C 2 years ago
parent
commit
1c3629f6e7
  1. 8
      packages/nc-gui/components/cell/MultiSelect.vue

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

@ -233,7 +233,7 @@ async function addIfMissingAndSave() {
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped // Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped
if (!isMysql(column.value.base_id)) { if (!isMysql(column.value.base_id)) {
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'") updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, '\'')
} }
} }
@ -276,10 +276,11 @@ const onTagClick = (e: Event, onClose: Function) => {
</script> </script>
<template> <template>
<div class="nc-multi-select h-full w-full flex items-center"
@click="isOpen = editAllowed && !isOpen" :class="{ 'read-only': readOnly }">
<a-select <a-select
ref="aselect" ref="aselect"
v-model:value="vModel" v-model:value="vModel"
v-model:open="isOpen"
mode="multiple" mode="multiple"
class="w-full overflow-hidden" class="w-full overflow-hidden"
:bordered="false" :bordered="false"
@ -287,12 +288,12 @@ const onTagClick = (e: Event, onClose: Function) => {
show-search show-search
:show-arrow="hasEditRoles && !readOnly && (editable || (active && vModel.length === 0))" :show-arrow="hasEditRoles && !readOnly && (editable || (active && vModel.length === 0))"
:open="isOpen && (active || editable)" :open="isOpen && (active || editable)"
@update:open="isOpen = $event"
:disabled="readOnly" :disabled="readOnly"
:class="{ '!ml-[-8px]': readOnly, 'caret-transparent': !hasEditRoles }" :class="{ '!ml-[-8px]': readOnly, 'caret-transparent': !hasEditRoles }"
:dropdown-class-name="`nc-dropdown-multi-select-cell ${isOpen ? 'active' : ''}`" :dropdown-class-name="`nc-dropdown-multi-select-cell ${isOpen ? 'active' : ''}`"
@search="search" @search="search"
@keydown.stop @keydown.stop
@click="isOpen = editAllowed && !isOpen"
> >
<a-select-option <a-select-option
v-for="op of options" v-for="op of options"
@ -359,6 +360,7 @@ const onTagClick = (e: Event, onClose: Function) => {
</a-tag> </a-tag>
</template> </template>
</a-select> </a-select>
</div>
</template> </template>
<style scoped> <style scoped>

Loading…
Cancel
Save