Browse Source

fix: SingleSelect and MutliSelect improved for mobile view

pull/6723/head
Muhammed Mustafa 1 year ago
parent
commit
489a707aa8
  1. 7
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 8
      packages/nc-gui/components/cell/SingleSelect.vue
  3. 10
      packages/nc-gui/components/nc/Select.vue
  4. 14
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

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

@ -43,6 +43,8 @@ const { modelValue, disableOptionCreation } = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const { isMobileMode } = useGlobal()
const column = inject(ColumnInj)! const column = inject(ColumnInj)!
const readOnly = inject(ReadonlyInj)! const readOnly = inject(ReadonlyInj)!
@ -383,7 +385,7 @@ const selectedOpts = computed(() => {
:placeholder="isEditColumn ? $t('labels.optional') : ''" :placeholder="isEditColumn ? $t('labels.optional') : ''"
:bordered="false" :bordered="false"
clear-icon clear-icon
show-search :show-search="!isMobileMode"
:show-arrow="editAllowed && !(readOnly || isLockedMode)" :show-arrow="editAllowed && !(readOnly || isLockedMode)"
:open="isOpen && editAllowed" :open="isOpen && editAllowed"
:disabled="readOnly || !editAllowed || isLockedMode" :disabled="readOnly || !editAllowed || isLockedMode"
@ -392,6 +394,9 @@ const selectedOpts = computed(() => {
@search="search" @search="search"
@keydown.stop @keydown.stop
> >
<template #suffixIcon>
<GeneralIcon icon="arrowDown" class="text-gray-700 nc-select-expand-btn" />
</template>
<a-select-option <a-select-option
v-for="op of options" v-for="op of options"
:key="op.id || op.title" :key="op.id || op.title"

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

@ -37,6 +37,8 @@ const { modelValue, disableOptionCreation } = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const { isMobileMode } = useGlobal()
const column = inject(ColumnInj)! const column = inject(ColumnInj)!
const readOnly = inject(ReadonlyInj)! const readOnly = inject(ReadonlyInj)!
@ -202,6 +204,8 @@ async function addIfMissingAndSave() {
} }
const search = () => { const search = () => {
if (isMobileMode.value) return
searchVal.value = aselect.value?.$el?.querySelector('.ant-select-selection-search-input')?.value searchVal.value = aselect.value?.$el?.querySelector('.ant-select-selection-search-input')?.value
} }
@ -285,7 +289,7 @@ const selectedOpt = computed(() => {
v-else v-else
ref="aselect" ref="aselect"
v-model:value="vModel" v-model:value="vModel"
class="w-full overflow-hidden" class="w-full overflow-hidden xs:min-h-12"
:class="{ 'caret-transparent': !hasEditRoles }" :class="{ 'caret-transparent': !hasEditRoles }"
:placeholder="isEditColumn ? $t('labels.optional') : ''" :placeholder="isEditColumn ? $t('labels.optional') : ''"
:allow-clear="!column.rqd && editAllowed" :allow-clear="!column.rqd && editAllowed"
@ -294,7 +298,7 @@ const selectedOpt = computed(() => {
:disabled="readOnly || !editAllowed || isLockedMode" :disabled="readOnly || !editAllowed || isLockedMode"
:show-arrow="hasEditRoles && !(readOnly || isLockedMode) && active && vModel === null" :show-arrow="hasEditRoles && !(readOnly || isLockedMode) && active && vModel === null"
:dropdown-class-name="`nc-dropdown-single-select-cell ${isOpen && active ? 'active' : ''}`" :dropdown-class-name="`nc-dropdown-single-select-cell ${isOpen && active ? 'active' : ''}`"
:show-search="isOpen && active" :show-search="!isMobileMode && isOpen && active"
@select="onSelect" @select="onSelect"
@keydown="onKeydown($event)" @keydown="onKeydown($event)"
@search="search" @search="search"

10
packages/nc-gui/components/nc/Select.vue

@ -55,6 +55,16 @@ const onChange = (value: string) => {
</template> </template>
<style lang="scss"> <style lang="scss">
.ant-select-item {
@apply !xs:h-13;
}
.ant-select-item-option-content {
@apply !xs:mt-2.5;
}
.ant-select-item-option-state {
@apply !xs:mt-1.75;
}
.nc-select.ant-select { .nc-select.ant-select {
height: fit-content; height: fit-content;
.ant-select-selector { .ant-select-selector {

14
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -616,7 +616,7 @@ export default {
<SmartsheetDivDataCell <SmartsheetDivDataCell
v-if="col.title" v-if="col.title"
:ref="i ? null : (el: any) => (cellWrapperEl = el)" :ref="i ? null : (el: any) => (cellWrapperEl = el)"
class="!bg-white rounded-lg !w-[20rem] !xs:w-full border-1 border-gray-200 overflow-hidden px-1 min-h-[35px] flex items-center relative" class="!bg-white rounded-lg !w-[20rem] !xs:w-full border-1 border-gray-200 overflow-hidden px-1 sm:min-h-[35px] xs:min-h-13 flex items-center relative"
> >
<LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="_row.row[col.title]" :row="_row" :column="col" /> <LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="_row.row[col.title]" :row="_row" :column="col" />
@ -674,7 +674,7 @@ export default {
<LazySmartsheetDivDataCell <LazySmartsheetDivDataCell
v-if="col.title" v-if="col.title"
:ref="i ? null : (el: any) => (cellWrapperEl = el)" :ref="i ? null : (el: any) => (cellWrapperEl = el)"
class="!bg-white rounded-lg !w-[20rem] border-1 overflow-hidden border-gray-200 px-1 min-h-[35px] flex items-center relative" class="!bg-white rounded-lg !w-[20rem] border-1 overflow-hidden border-gray-200 px-1 sm:min-h-[35px] xs:min-h-13 flex items-center relative"
> >
<LazySmartsheetVirtualCell <LazySmartsheetVirtualCell
v-if="isVirtualCol(col)" v-if="isVirtualCol(col)"
@ -825,3 +825,13 @@ export default {
@apply !p-0; @apply !p-0;
} }
</style> </style>
<style lang="scss" scoped>
:deep(.ant-select-selector) {
@apply !xs:(h-full);
}
:deep(.ant-select-selection-item) {
@apply !xs:(mt-1.75 ml-1);
}
</style>

Loading…
Cancel
Save