f7ec47306c
- Removed redundant dropdown menu styles from various components and centralized them in a new `dropdown-menu.less` file. - Updated components to use the unified styles, ensuring consistency in appearance and behavior across the application. This change simplifies maintenance and enhances the visual coherence of dropdown menus.
323 lines
8.1 KiB
Plaintext
323 lines
8.1 KiB
Plaintext
/**
|
|
* 全局统一下拉菜单样式
|
|
*
|
|
* 适用于所有场景的 popup/dropdown 菜单,包括:
|
|
* - 卡片操作菜单(知识库、智能体、组织)
|
|
* - 文档操作菜单
|
|
* - 对话会话菜单
|
|
* - 上传操作菜单
|
|
*
|
|
* 使用方式:
|
|
* 1. <t-popup> + .popup-menu 自定义内容模式: overlayClassName="card-more-popup"
|
|
* 2. <t-dropdown> TDesign 下拉模式: 自动匹配全局样式
|
|
*/
|
|
|
|
/* 弹出动画 */
|
|
@keyframes dropdownSlideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-6px) scale(0.98);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0) scale(1);
|
|
}
|
|
}
|
|
|
|
@keyframes dropdownSlideInUp {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(6px) scale(0.98);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0) scale(1);
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
一、Popup 容器统一样式(<t-popup> 模式)
|
|
============================================ */
|
|
.card-more-popup {
|
|
z-index: 99 !important;
|
|
|
|
.t-popup__content {
|
|
padding: 4px !important;
|
|
margin-top: 4px !important;
|
|
min-width: 148px;
|
|
border-radius: 10px !important;
|
|
background: var(--td-bg-color-container) !important;
|
|
border: 0.5px solid var(--td-component-stroke) !important;
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
|
0 2px 4px rgba(0, 0, 0, 0.04),
|
|
0 8px 24px rgba(0, 0, 0, 0.1) !important;
|
|
backdrop-filter: blur(20px) saturate(180%) !important;
|
|
-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
|
|
animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
二、自定义菜单项统一样式(.popup-menu 模式)
|
|
============================================ */
|
|
.popup-menu {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1px;
|
|
}
|
|
|
|
.popup-menu-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 8px 12px;
|
|
cursor: pointer;
|
|
transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
|
|
color: var(--td-text-color-primary);
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
line-height: 20px;
|
|
border-radius: 6px;
|
|
position: relative;
|
|
|
|
.menu-icon {
|
|
font-size: 16px;
|
|
flex-shrink: 0;
|
|
color: var(--td-text-color-secondary);
|
|
transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
|
|
}
|
|
|
|
&:hover {
|
|
background: var(--td-bg-color-container-hover);
|
|
color: var(--td-text-color-primary);
|
|
|
|
.menu-icon {
|
|
color: var(--td-text-color-primary);
|
|
}
|
|
}
|
|
|
|
&:active {
|
|
background: var(--td-bg-color-container-active);
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
&.delete,
|
|
&.danger {
|
|
color: var(--td-error-color-6);
|
|
margin-top: 4px;
|
|
position: relative;
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: -3px;
|
|
left: 8px;
|
|
right: 8px;
|
|
height: 1px;
|
|
background: var(--td-component-stroke);
|
|
}
|
|
|
|
.menu-icon {
|
|
color: var(--td-error-color-6);
|
|
}
|
|
|
|
&:hover {
|
|
background: var(--td-error-color-1);
|
|
color: var(--td-error-color-6);
|
|
|
|
.menu-icon {
|
|
color: var(--td-error-color-6);
|
|
}
|
|
}
|
|
|
|
&:active {
|
|
background: var(--td-error-color-2);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
三、文档操作菜单统一样式(.card-more 容器)
|
|
============================================ */
|
|
.card-more {
|
|
z-index: 99 !important;
|
|
|
|
.t-popup__content {
|
|
padding: 4px !important;
|
|
margin-top: 4px !important;
|
|
min-width: 148px;
|
|
width: auto;
|
|
border-radius: 10px !important;
|
|
background: var(--td-bg-color-container) !important;
|
|
border: 0.5px solid var(--td-component-stroke) !important;
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
|
0 2px 4px rgba(0, 0, 0, 0.04),
|
|
0 8px 24px rgba(0, 0, 0, 0.1) !important;
|
|
backdrop-filter: blur(20px) saturate(180%) !important;
|
|
-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
|
|
color: var(--td-text-color-primary);
|
|
animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
四、TDesign Dropdown 统一样式
|
|
适用于 <t-dropdown> 组件(挂载到 body 上)
|
|
============================================ */
|
|
.t-popup__content {
|
|
.t-dropdown__menu {
|
|
background: var(--td-bg-color-container);
|
|
border: 0.5px solid var(--td-component-stroke);
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
|
0 2px 4px rgba(0, 0, 0, 0.04),
|
|
0 8px 24px rgba(0, 0, 0, 0.1);
|
|
backdrop-filter: blur(20px) saturate(180%);
|
|
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
|
padding: 4px;
|
|
min-width: 148px;
|
|
animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.t-dropdown__item {
|
|
padding: 8px 12px;
|
|
border-radius: 6px;
|
|
margin: 1px 0;
|
|
transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
|
|
font-size: 14px;
|
|
color: var(--td-text-color-primary);
|
|
cursor: pointer;
|
|
min-width: auto !important;
|
|
max-width: 100% !important;
|
|
display: flex !important;
|
|
align-items: center;
|
|
width: 100%;
|
|
position: relative;
|
|
|
|
&:hover {
|
|
background: var(--td-bg-color-container-hover);
|
|
color: var(--td-text-color-primary);
|
|
}
|
|
|
|
&:active {
|
|
background: var(--td-bg-color-container-active);
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.t-dropdown__item-icon {
|
|
flex-shrink: 0;
|
|
margin-right: 8px;
|
|
color: var(--td-text-color-secondary);
|
|
display: flex;
|
|
align-items: center;
|
|
transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
|
|
|
|
.t-icon {
|
|
font-size: 16px;
|
|
}
|
|
}
|
|
|
|
&:hover .t-dropdown__item-icon {
|
|
color: var(--td-text-color-primary);
|
|
}
|
|
|
|
.t-dropdown__item-text {
|
|
color: inherit !important;
|
|
font-size: 14px !important;
|
|
line-height: 20px !important;
|
|
white-space: nowrap !important;
|
|
overflow: hidden !important;
|
|
text-overflow: ellipsis !important;
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: block;
|
|
}
|
|
|
|
/* TDesign error 主题项(删除操作) */
|
|
&.t-dropdown__item--theme-error {
|
|
color: var(--td-error-color-6) !important;
|
|
margin-top: 4px;
|
|
position: relative;
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: -3px;
|
|
left: 8px;
|
|
right: 8px;
|
|
height: 1px;
|
|
background: var(--td-component-stroke);
|
|
}
|
|
|
|
.t-dropdown__item-icon {
|
|
color: var(--td-error-color-6);
|
|
}
|
|
|
|
&:hover {
|
|
background: var(--td-error-color-1);
|
|
color: var(--td-error-color-6) !important;
|
|
|
|
.t-dropdown__item-icon {
|
|
color: var(--td-error-color-6);
|
|
}
|
|
}
|
|
|
|
&:active {
|
|
background: var(--td-error-color-2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* tag 更多弹窗 */
|
|
.tag-more-popup {
|
|
z-index: 99 !important;
|
|
|
|
.t-popup__content {
|
|
padding: 4px !important;
|
|
margin-top: 4px !important;
|
|
min-width: 120px;
|
|
border-radius: 10px !important;
|
|
background: var(--td-bg-color-container) !important;
|
|
border: 0.5px solid var(--td-component-stroke) !important;
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(0, 0, 0, 0.03),
|
|
0 2px 4px rgba(0, 0, 0, 0.04),
|
|
0 8px 24px rgba(0, 0, 0, 0.1) !important;
|
|
backdrop-filter: blur(20px) saturate(180%) !important;
|
|
-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
|
|
animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
五、暗色模式增强
|
|
============================================ */
|
|
:root[theme-mode="dark"] {
|
|
.card-more-popup .t-popup__content,
|
|
.card-more .t-popup__content,
|
|
.tag-more-popup .t-popup__content {
|
|
background: rgba(36, 36, 36, 0.85) !important;
|
|
border-color: rgba(255, 255, 255, 0.08) !important;
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(255, 255, 255, 0.05),
|
|
0 2px 4px rgba(0, 0, 0, 0.12),
|
|
0 8px 32px rgba(0, 0, 0, 0.28) !important;
|
|
}
|
|
|
|
.t-popup__content .t-dropdown__menu {
|
|
background: rgba(36, 36, 36, 0.85);
|
|
border-color: rgba(255, 255, 255, 0.08);
|
|
box-shadow:
|
|
0 0 0 0.5px rgba(255, 255, 255, 0.05),
|
|
0 2px 4px rgba(0, 0, 0, 0.12),
|
|
0 8px 32px rgba(0, 0, 0, 0.28);
|
|
}
|
|
}
|