feat(admin-web): add collapsible metadata section with toggle functionality
Frontend CI / Frontend (push) Successful in 4m9s

This commit is contained in:
Xu Liang
2026-05-09 09:40:17 +08:00
parent 8bd2d88d88
commit 1082e9010e
@@ -1,5 +1,11 @@
<script setup lang="ts">
import { EyeOutlined, LeftOutlined, SaveOutlined, SendOutlined } from '@ant-design/icons-vue'
import {
DownOutlined,
EyeOutlined,
LeftOutlined,
SaveOutlined,
SendOutlined,
} from '@ant-design/icons-vue'
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
import { message } from 'ant-design-vue'
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
@@ -97,6 +103,10 @@ const metadataForm = reactive({
allow_web_search: false,
allow_user_knowledge: true,
})
const metaCollapsed = ref(false)
function toggleMetaCollapsed() {
metaCollapsed.value = !metaCollapsed.value
}
const { data: promptDetail } = useQuery({
queryKey: computed(() => ['kol', 'prompt', props.promptId]),
@@ -607,9 +617,20 @@ onBeforeUnmount(() => {
</div>
</div>
<div class="editor-meta-card">
<div class="editor-section-title">{{ t('kol.manage.editor.basicInfo') }}</div>
<a-form layout="vertical" class="editor-meta-form">
<div class="editor-meta-card" :class="{ 'editor-meta-card--collapsed': metaCollapsed }">
<button
type="button"
class="editor-section-title editor-section-title--toggle"
:aria-expanded="!metaCollapsed"
@click="toggleMetaCollapsed"
>
<DownOutlined
class="editor-section-title__chevron"
:class="{ 'editor-section-title__chevron--collapsed': metaCollapsed }"
/>
<span>{{ t('kol.manage.editor.basicInfo') }}</span>
</button>
<a-form v-show="!metaCollapsed" layout="vertical" class="editor-meta-form">
<a-form-item :label="t('common.title')" required>
<a-input
v-model:value="metadataForm.name"
@@ -788,6 +809,10 @@ onBeforeUnmount(() => {
background: #fff;
}
.editor-meta-card.editor-meta-card--collapsed {
padding-bottom: 16px;
}
.editor-section-title {
margin: 0 0 16px;
font-size: 14px;
@@ -795,6 +820,35 @@ onBeforeUnmount(() => {
color: #111827;
}
.editor-section-title--toggle {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0;
border: none;
background: transparent;
cursor: pointer;
color: inherit;
font: inherit;
}
.editor-meta-card--collapsed .editor-section-title--toggle {
margin-bottom: 0;
}
.editor-section-title--toggle:hover {
color: #1677ff;
}
.editor-section-title__chevron {
font-size: 12px;
transition: transform 0.2s ease;
}
.editor-section-title__chevron--collapsed {
transform: rotate(-90deg);
}
.editor-meta-form {
display: grid;
grid-template-columns: minmax(240px, 1.4fr) minmax(200px, 1fr);