* 新增自适应数值与窗口分析工具,提升交互体验 * 优化回收站模块逻辑,增加展示与选择功能 * 引入 Macaron 主题配置文件并更新 Tailwind 配置 * 精简基础组件代码,移除冗余样式与设置项 * 完善测试用例,覆盖 UI 系统与回收站工作流 * 更新多语言配置,支持功能变更后的文案需求
80 lines
5.5 KiB
Vue
80 lines
5.5 KiB
Vue
<template>
|
|
<div class="trash-item-info min-w-0" :class="{ 'trash-item-info--dark': isDarkMode }">
|
|
<div class="flex min-w-0 items-start gap-3">
|
|
<div class="trash-file-icon flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl" :class="`trash-tone-${info.tone}`">
|
|
<component :is="item.isTrashPurged ? FileX2Icon : item.text != null ? FileTextIcon : FileIcon" class="h-5 w-5" aria-hidden="true" />
|
|
</div>
|
|
<div class="min-w-0 flex-1">
|
|
<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1.5">
|
|
<p class="trash-file-name min-w-0 text-sm font-semibold leading-6 sm:text-base">{{ name }}</p>
|
|
<span class="trash-state shrink-0 rounded-full border px-2.5 py-0.5 text-xs font-medium" :class="`trash-tone-${info.tone}`">{{ info.state }}</span>
|
|
<span class="trash-reason-tag shrink-0 rounded-full px-2.5 py-0.5 text-xs" :class="item.trashReason === 'manual' ? 'trash-reason-manual' : item.trashReason === 'batch_delete' ? 'trash-tone-permanent' : 'trash-tone-warning'" :title="`移入原因:${info.reason}`">{{ info.reason }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="trash-detail-grid mt-3">
|
|
<dl v-for="field in fields" :key="field.label" class="trash-detail-card theme-2026-card-hover fcb-secondary-card min-w-0 rounded-2xl border px-3 py-2.5">
|
|
<dt class="trash-time-label text-xs leading-5">{{ field.label }}</dt>
|
|
<dd class="mt-1 break-words text-xs font-medium leading-5 tabular-nums" :class="field.mono ? 'font-mono tracking-wide' : ''" :title="field.title">{{ field.value }}</dd>
|
|
<span v-if="field.reminder" class="trash-remaining mt-1 inline-block rounded-full px-2 py-0.5 text-[11px]" :class="`trash-tone-${info.tone}`">{{ field.reminder }}</span>
|
|
</dl>
|
|
<div v-if="$slots.actions" class="trash-item-actions"><slot name="actions" /></div>
|
|
</div>
|
|
<p v-if="info.note" class="trash-time-label mt-3 text-xs leading-5">{{ info.note }}</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { FileIcon, FileTextIcon, FileX2Icon } from 'lucide-vue-next'
|
|
import type { TrashFileItem } from '@/types'
|
|
import { formatFileSize } from '@/utils/common'
|
|
import { formatTrashTime, getTrashPresentation } from '@/utils/trashPresentation'
|
|
|
|
const props = defineProps<{ item: TrashFileItem; isDarkMode: boolean; now: number }>()
|
|
const info = computed(() => getTrashPresentation(props.item, props.now))
|
|
const name = computed(() => props.item.name || `${props.item.prefix || ''}${props.item.suffix || ''}` || '未命名文件')
|
|
const sizeText = computed(() => {
|
|
const size = Number(props.item.size)
|
|
return Number.isFinite(size) && size >= 0 ? formatFileSize(size, 1) : '未记录'
|
|
})
|
|
const fields = computed(() => [
|
|
{ label: '原取件码', value: props.item.code || '未记录', mono: true },
|
|
{ label: '文件大小', value: sizeText.value },
|
|
{ label: '移入时间', value: formatTrashTime(props.item.trashedAt, props.now), title: formatTrashTime(props.item.trashedAt) },
|
|
{ label: info.value.timeLabel, value: info.value.timeText, reminder: info.value.reminder,
|
|
title: props.item.isTrashPermanent && !props.item.isTrashPurged ? undefined : formatTrashTime(props.item.isTrashPurged ? props.item.trashPurgedAt : props.item.trashExpiresAt) }
|
|
])
|
|
</script>
|
|
|
|
<style scoped>
|
|
.trash-item-info { container-type: inline-size; container-name: trash-record; color: #294851; --trash-muted: #617980; --trash-line: #d7e3e5; --trash-surface: #edf3f6; }
|
|
.trash-item-info--dark { color: #dbe9ee; --trash-muted: #a9bdc2; --trash-line: #495765; --trash-surface: #303946; }
|
|
.trash-file-name { overflow-wrap: anywhere; }
|
|
.trash-file-meta dt, .trash-time-label { color: var(--trash-muted); }
|
|
.trash-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
|
|
.trash-detail-card { margin: 0; min-height: 72px; background: var(--trash-surface) !important; border-color: var(--trash-line) !important; }
|
|
.trash-item-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: center; grid-column: 1 / -1; }
|
|
@container trash-record (min-width: 620px) {
|
|
.trash-detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
.trash-item-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; grid-column: 1 / -1; }
|
|
}
|
|
@container trash-record (min-width: 1000px) {
|
|
.trash-detail-grid { grid-template-columns: minmax(100px,125px) minmax(90px,110px) minmax(100px,130px) minmax(140px,180px) minmax(400px,1fr); align-items: center; gap: 10px; }
|
|
.trash-item-actions { grid-column: auto; align-items: center; }
|
|
}
|
|
.trash-item-actions :deep(button) { white-space: nowrap; }
|
|
.trash-detail-grid .trash-detail-card:hover { transform: translateY(-2px) !important; }
|
|
@media (prefers-reduced-motion: reduce), (hover: none) { .trash-detail-grid .trash-detail-card:hover { transform: none !important; } }
|
|
.trash-state { border-color: var(--trash-line); }
|
|
.trash-tone-normal { background: #e4f0ed; color: #355e56; }
|
|
.trash-tone-warning { background: #fff0d8; color: #885512; }
|
|
.trash-tone-permanent { background: #eeebf8; color: #62528e; }
|
|
.trash-tone-muted { background: #e8edef; color: #596b73; }
|
|
.trash-item-info--dark .trash-tone-normal { background: #29473f; color: #c0e5d8; }
|
|
.trash-item-info--dark .trash-tone-warning { background: #514026; color: #f5d599; }
|
|
.trash-item-info--dark .trash-tone-permanent { background: #3e3556; color: #ddd2f6; }
|
|
.trash-item-info--dark .trash-tone-muted { background: #344249; color: #bbc9cf; }
|
|
.trash-reason-manual { background: var(--fcb-button-primary-bg); color: var(--fcb-button-primary-text); }
|
|
</style>
|