fix: handle for mobile view

This commit is contained in:
Shariq Ansari 2024-05-31 18:26:58 +05:30
parent ed47d87315
commit b0425bb477
4 changed files with 48 additions and 7 deletions

View File

@ -2,7 +2,10 @@
<NestedPopover> <NestedPopover>
<template #target> <template #target>
<Button :label="__('Columns')"> <Button :label="__('Columns')">
<template #prefix> <template v-if="hideLabel">
<ColumnsIcon class="h-4" />
</template>
<template v-if="!hideLabel" #prefix>
<ColumnsIcon class="h-4" /> <ColumnsIcon class="h-4" />
</template> </template>
</Button> </Button>
@ -108,7 +111,11 @@
class="w-full" class="w-full"
v-model="column.width" v-model="column.width"
placeholder="10rem" placeholder="10rem"
:description="__('Width can be in number, pixel or rem (eg. 3, 30px, 10rem)')" :description="
__(
'Width can be in number, pixel or rem (eg. 3, 30px, 10rem)'
)
"
:debounce="500" :debounce="500"
/> />
</div> </div>
@ -149,6 +156,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
hideLabel: {
type: Boolean,
default: false,
},
}) })
const emit = defineEmits(['update']) const emit = defineEmits(['update'])

View File

@ -1,7 +1,7 @@
<template> <template>
<Dropdown :options="options"> <Dropdown :options="options">
<template #default="{ open }"> <template #default="{ open }">
<Button :label="__('Group By: Status')"> <Button :label="hideLabel ? __('Status') : __('Group By: Status')">
<template #prefix> <template #prefix>
<DetailsIcon /> <DetailsIcon />
</template> </template>
@ -17,7 +17,7 @@
</template> </template>
<script setup> <script setup>
import DetailsIcon from '@/components/icons/DetailsIcon.vue' import DetailsIcon from '@/components/icons/DetailsIcon.vue'
import { Dropdown } from 'frappe-ui'; import { Dropdown } from 'frappe-ui'
import { ref } from 'vue' import { ref } from 'vue'
const props = defineProps({ const props = defineProps({
@ -25,6 +25,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
hideLabel: {
type: Boolean,
default: false,
},
}) })
const list = defineModel() const list = defineModel()

View File

@ -2,7 +2,10 @@
<NestedPopover> <NestedPopover>
<template #target> <template #target>
<Button :label="__('Sort')" ref="sortButtonRef"> <Button :label="__('Sort')" ref="sortButtonRef">
<template #prefix><SortIcon class="h-4" /></template> <template v-if="hideLabel">
<SortIcon class="h-4" />
</template>
<template v-if="!hideLabel" #prefix><SortIcon class="h-4" /></template>
<template v-if="sortValues?.size" #suffix> <template v-if="sortValues?.size" #suffix>
<div <div
class="flex h-5 w-5 items-center justify-center rounded bg-gray-900 pt-[1px] text-2xs font-medium text-white" class="flex h-5 w-5 items-center justify-center rounded bg-gray-900 pt-[1px] text-2xs font-medium text-white"
@ -108,6 +111,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
hideLabel: {
type: Boolean,
default: false,
},
}) })
const emit = defineEmits(['update']) const emit = defineEmits(['update'])

View File

@ -12,7 +12,12 @@
<div v-if="isEmoji(currentView.icon)"> <div v-if="isEmoji(currentView.icon)">
{{ currentView.icon }} {{ currentView.icon }}
</div> </div>
<FeatherIcon v-else :name="currentView.icon" class="h-4" /> <FeatherIcon
v-else-if="typeof currentView.icon == 'string'"
:name="currentView.icon"
class="h-4"
/>
<component v-else :is="currentView.icon" class="h-4" />
</template> </template>
<template #suffix> <template #suffix>
<FeatherIcon <FeatherIcon
@ -43,12 +48,26 @@
:default_filters="filters" :default_filters="filters"
@update="updateFilter" @update="updateFilter"
/> />
<div class="flex gap-2"> <div class="flex gap-2">
<SortBy v-model="list" :doctype="doctype" @update="updateSort" /> <GroupBy
v-if="currentViewType === 'group_by'"
v-model="list"
:doctype="doctype"
:hideLabel="isMobileView"
@update="updateGroupBy"
/>
<SortBy
v-model="list"
:doctype="doctype"
@update="updateSort"
:hideLabel="isMobileView"
/>
<ColumnSettings <ColumnSettings
v-if="!options.hideColumnsButton" v-if="!options.hideColumnsButton"
v-model="list" v-model="list"
:doctype="doctype" :doctype="doctype"
:hideLabel="isMobileView"
@update="(isDefault) => updateColumns(isDefault)" @update="(isDefault) => updateColumns(isDefault)"
/> />
</div> </div>