refactor: tree-ex ellipsis + listview style

This commit is contained in:
oat 2023-11-28 18:05:46 +07:00 committed by Methapon2001
parent e18450cdbd
commit d82cf45417
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
2 changed files with 19 additions and 2 deletions

View file

@ -166,7 +166,7 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
class="cursor"
>
<template v-slot:body-cell-name="nameRow">
<q-td>
<q-td style="width: 50%">
<q-icon :name="currentIcon" size="2em" color="primary" />
{{ nameRow.row.name }}
</q-td>
@ -257,9 +257,11 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
row-key="name"
hide-bottom
:rows-per-page-options="[0]"
class="cursor"
>
<template v-slot:body-cell-name="nameRow">
<q-td
style="width: 50%"
@click="
() => {
getFolder(nameRow.row.pathname)

View file

@ -3,6 +3,8 @@ import { storeToRefs } from 'pinia'
import { useTreeDataStore, type TreeDataFolder } from '@/stores/tree-data'
import { useSearchDataStore } from '@/stores/searched-data'
import { useFileInfoStore } from '@/stores/file-info-data'
import { computed } from '@vue/reactivity'
import FolderForm from './FolderForm.vue'
const { isSearch } = storeToRefs(useSearchDataStore())
const { isPreview } = storeToRefs(useFileInfoStore())
@ -17,6 +19,8 @@ const props = withDefaults(
level: 0,
}
)
const MAX_NAME_LENGTH = 20
</script>
<template>
@ -40,7 +44,12 @@ const props = withDefaults(
? 'inbox'
: 'o_folder_open'
"
:label="folder.name"
:label="
folder.name.length > MAX_NAME_LENGTH
? folder.name.slice(0, MAX_NAME_LENGTH) + '...'
: folder.name
"
class="text-overflow-handle"
v-model="folder.status"
>
<tree-explorer
@ -61,4 +70,10 @@ const props = withDefaults(
.q-item[aria-expanded='true'] .q-icon {
color: $primary;
}
.text-overflow-handle {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>