feat(admin-web): add collapsible metadata section with toggle functionality
Frontend CI / Frontend (push) Successful in 4m9s
Frontend CI / Frontend (push) Successful in 4m9s
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<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 { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
||||||
@@ -97,6 +103,10 @@ const metadataForm = reactive({
|
|||||||
allow_web_search: false,
|
allow_web_search: false,
|
||||||
allow_user_knowledge: true,
|
allow_user_knowledge: true,
|
||||||
})
|
})
|
||||||
|
const metaCollapsed = ref(false)
|
||||||
|
function toggleMetaCollapsed() {
|
||||||
|
metaCollapsed.value = !metaCollapsed.value
|
||||||
|
}
|
||||||
|
|
||||||
const { data: promptDetail } = useQuery({
|
const { data: promptDetail } = useQuery({
|
||||||
queryKey: computed(() => ['kol', 'prompt', props.promptId]),
|
queryKey: computed(() => ['kol', 'prompt', props.promptId]),
|
||||||
@@ -607,9 +617,20 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="editor-meta-card">
|
<div class="editor-meta-card" :class="{ 'editor-meta-card--collapsed': metaCollapsed }">
|
||||||
<div class="editor-section-title">{{ t('kol.manage.editor.basicInfo') }}</div>
|
<button
|
||||||
<a-form layout="vertical" class="editor-meta-form">
|
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-form-item :label="t('common.title')" required>
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="metadataForm.name"
|
v-model:value="metadataForm.name"
|
||||||
@@ -788,6 +809,10 @@ onBeforeUnmount(() => {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.editor-meta-card.editor-meta-card--collapsed {
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.editor-section-title {
|
.editor-section-title {
|
||||||
margin: 0 0 16px;
|
margin: 0 0 16px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -795,6 +820,35 @@ onBeforeUnmount(() => {
|
|||||||
color: #111827;
|
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 {
|
.editor-meta-form {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(240px, 1.4fr) minmax(200px, 1fr);
|
grid-template-columns: minmax(240px, 1.4fr) minmax(200px, 1fr);
|
||||||
|
|||||||
Reference in New Issue
Block a user