Files
eip4-web/src/shell/amis-theme.css

700 lines
22 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* ============================================================================
EIP4 amis 主题覆盖层 — F2-12 二轮打磨
原理:amis 6.x SDK 的 cxd 主题通过 :root / .amis-scope .AMISCSSWrapper
暴露设计 token,本文件在 theme.css 之后加载,用品牌色/圆角/字体/中性色
覆盖 amis 默认值,使 amis 区域与壳层视觉一致。
深色模式:[data-dark="1"] 下再次覆盖为暗色 token。
============================================================================ */
/* ============================================================================
1. 亮色模式 — 品牌色 token 对齐
amis 品牌色阶 brand-5 = 主色,brand-4 = active,brand-6 = hover
EIP4 主色 #2B5CE6,对应生成 10 级色阶
============================================================================ */
:root,
.amis-scope .AMISCSSWrapper {
/* 品牌色阶(brand-5 对齐 EIP4 --brand)*/
--colors-brand-1: #0a1e5c;
--colors-brand-2: #0f2b80;
--colors-brand-3: #183ba3;
--colors-brand-4: #2250cc; /* active */
--colors-brand-5: #2B5CE6; /* 主色 = theme.css --brand */
--colors-brand-6: #4a75ed; /* hover */
--colors-brand-7: #7097f2;
--colors-brand-8: #a3bcf7;
--colors-brand-9: #d5e0fb;
--colors-brand-10: #eaf0fd;
/* 中性色对齐 theme.css */
--colors-neutral-text-2: #1c2128; /* --text */
--colors-neutral-text-4: #555c66; /* --text-2 */
--colors-neutral-text-5: #8b929c; /* --text-3 */
--colors-neutral-text-6: #aab0b9;
--colors-neutral-text-8: #e2e5ea; /* --line */
--colors-neutral-text-9: #f6f7f9; /* --surface-2 */
--colors-neutral-text-10: #f6f7f9;
--colors-neutral-text-11: #ffffff; /* white */
--colors-neutral-fill-3: #f6f7f9; /* --surface-2 */
--colors-neutral-fill-8: #e2e5ea; /* --line */
--colors-neutral-fill-9: #f6f7f9;
--colors-neutral-fill-10: #f6f7f9;
--colors-neutral-fill-11: #ffffff; /* --surface */
--colors-neutral-fill-12: #eef1fd;
--colors-neutral-line-7: #cdd2d9; /* --line-strong */
--colors-neutral-line-8: #e2e5ea; /* --line */
--colors-neutral-line-9: #f6f7f9;
--colors-neutral-line-10: #f6f7f9;
/* 功能色对齐 theme.css */
--colors-success-4: #178c55;
--colors-success-5: #1f9e62; /* --ok */
--colors-success-6: #28b070;
--colors-success-10: #e2f5ec; /* --ok-soft */
--colors-warning-4: #c27908;
--colors-warning-5: #d8860b; /* --warn */
--colors-warning-6: #e8970e;
--colors-warning-10: #faf0dc; /* --warn-soft */
--colors-error-4: #c03b32;
--colors-error-5: #d1453b; /* --err */
--colors-error-6: #de5047;
--colors-error-10: #fbe9e7; /* --err-soft */
/* 圆角对齐 theme.css --radius / --radius-lg */
--borders-radius-2: 4px;
--borders-radius-3: 6px; /* 原 4px → 6px,对齐 --radius */
--borders-radius-4: 6px; /* 原 6px,保持 */
--borders-radius-5: 10px; /* 对齐 --radius-lg */
--borders-radius-6: 10px;
/* 字体族对齐 theme.css */
--fonts-base-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
"Microsoft YaHei", "Helvetica Neue", sans-serif;
/* 字号对齐(fonts-size-7 = base 14px, fonts-size-8 = sm 12px) */
--fonts-size-7: 14px;
--fonts-size-8: 12px;
--fonts-size-6: 16px;
/* 行高 */
--fonts-lineHeight-2: 1.5;
/* 背景色对齐 */
--background: #eef0f3; /* --bg */
}
/* ============================================================================
2. 深色模式 token 覆盖
[data-dark="1"] 挂在 <html> 上;amis 区域跟随宿主深色变量
============================================================================ */
[data-dark="1"] :root,
[data-dark="1"],
[data-dark="1"] .amis-scope .AMISCSSWrapper {
/* 背景 / 表面 */
--colors-neutral-fill-11: #1e232b; /* --surface */
--colors-neutral-fill-10: #262c36; /* --surface-2 */
--colors-neutral-fill-9: #262c36;
--colors-neutral-fill-8: #323945; /* --line */
--colors-neutral-fill-3: #323945;
--colors-neutral-fill-12: #1e2540;
/* 线条 */
--colors-neutral-line-8: #323945; /* --line */
--colors-neutral-line-7: #424b59; /* --line-strong */
--colors-neutral-line-9: #262c36;
--colors-neutral-line-10: #1e232b;
/* 文字 */
--colors-neutral-text-2: #e8eaee; /* --text */
--colors-neutral-text-4: #a3aab5; /* --text-2 */
--colors-neutral-text-5: #6d7480; /* --text-3 */
--colors-neutral-text-6: #6d7480;
--colors-neutral-text-8: #323945;
--colors-neutral-text-9: #262c36;
--colors-neutral-text-10: #1e232b;
--colors-neutral-text-11: #ffffff;
/* 背景 */
--background: #15181d; /* --bg dark */
/* 深色品牌色(整体加亮) */
--colors-brand-5: #4a75ed;
--colors-brand-4: #3a65e0;
--colors-brand-6: #6a8ff2;
--colors-brand-10: #1e2a4a;
/* 深色功能色 */
--colors-success-5: #28b070;
--colors-success-10: #18352a; /* --ok-soft dark */
--colors-warning-5: #e8970e;
--colors-warning-10: #3a2e15; /* --warn-soft dark */
--colors-error-5: #de5047;
--colors-error-10: #3c211f; /* --err-soft dark */
}
/* ============================================================================
3. 状态标签风格 — amis mapping 渲染的 .label 类
原型:浅底 + 前置色点,逼近 theme.css .tag-* 风格
amis mapping 输出 <span class="label label-success"> 等 HTML 字符串
============================================================================ */
.amis-scope .label,
.cxd-Html .label {
display: inline-flex;
align-items: center;
gap: 5px;
height: 22px;
padding: 0 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 400;
white-space: nowrap;
line-height: 1;
}
/* 前置圆点 */
.amis-scope .label::before,
.cxd-Html .label::before {
content: '';
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
flex-shrink: 0;
}
/* label-success → ok 绿 */
.amis-scope .label-success,
.cxd-Html .label-success {
background: #e2f5ec;
color: #1f9e62;
}
/* label-warning → warn 橙 */
.amis-scope .label-warning,
.cxd-Html .label-warning {
background: #faf0dc;
color: #d8860b;
}
/* label-danger → err 红 */
.amis-scope .label-danger,
.cxd-Html .label-danger {
background: #fbe9e7;
color: #d1453b;
}
/* label-default / label-info → 灰 */
.amis-scope .label-default,
.amis-scope .label-info,
.cxd-Html .label-default,
.cxd-Html .label-info {
background: #f6f7f9;
color: #555c66;
border: 1px solid #e2e5ea;
}
/* 深色模式下标签颜色映射 */
[data-dark="1"] .amis-scope .label-success,
[data-dark="1"] .cxd-Html .label-success {
background: #18352a;
color: #4cc98a;
}
[data-dark="1"] .amis-scope .label-warning,
[data-dark="1"] .cxd-Html .label-warning {
background: #3a2e15;
color: #f0ad3a;
}
[data-dark="1"] .amis-scope .label-danger,
[data-dark="1"] .cxd-Html .label-danger {
background: #3c211f;
color: #eb6d62;
}
[data-dark="1"] .amis-scope .label-default,
[data-dark="1"] .amis-scope .label-info,
[data-dark="1"] .cxd-Html .label-default,
[data-dark="1"] .cxd-Html .label-info {
background: #323945;
color: #a3aab5;
border-color: #424b59;
}
/* ============================================================================
4. 查询面板布局密度 — 压缩 filter 区 Form 行间距
amis filter 用 .cxd-Form--normal 渲染,item-gap 控制行间距
============================================================================ */
.amis-scope .cxd-Crud-filter .cxd-Form-item,
.amis-scope .cxd-CRUD-filter .cxd-Form-item {
margin-bottom: 10px;
}
/* filter 标签宽度压缩,与原型对齐(原型约 60px label) */
.amis-scope .cxd-Crud-filter .cxd-Form-label,
.amis-scope .cxd-CRUD-filter .cxd-Form-label {
min-width: 56px;
max-width: 80px;
font-size: 13px;
color: #555c66;
}
/* 查询/重置按钮区紧凑 */
.amis-scope .cxd-Crud-filter .cxd-Form-group--justify,
.amis-scope .cxd-CRUD-filter .cxd-Form-group--justify {
gap: 8px;
}
/* ============================================================================
5. 表格密度 — 对齐 theme.css --row-h: 42px
amis TableCell-height 默认 2.5rem(40px),微调为 42px
============================================================================ */
.amis-scope .cxd-Table-content .cxd-Table td,
.amis-scope .cxd-Table-content .cxd-Table th {
height: 42px;
padding-top: 0;
padding-bottom: 0;
}
/* 表头字号 */
.amis-scope .cxd-Table-content .cxd-Table th {
font-size: 12.5px;
font-weight: 500;
color: #555c66;
}
/* 深色模式表头 */
[data-dark="1"] .amis-scope .cxd-Table-content .cxd-Table th {
color: #a3aab5;
}
/* ============================================================================
6. amis 页面容器背景对齐 --bg
============================================================================ */
.amis-scope .cxd-Page {
background: transparent;
}
.amis-scope .cxd-Page > .cxd-Page-content {
padding: 16px;
}
/* ============================================================================
7. 主按钮圆角对齐
============================================================================ */
.amis-scope .cxd-Button--primary,
.amis-scope .cxd-Button--default {
border-radius: var(--borders-radius-3, 6px);
}
/* ============================================================================
8. 分页位置(amis footerToolbar pagination 默认 flex-end,可接受;
headerToolbar pagination 保留原位)
此处仅确保 footerToolbar 对齐右侧
============================================================================ */
.amis-scope .cxd-Crud-footToolbar {
justify-content: flex-end;
padding: 10px 0 4px;
}
/* ============================================================================
9. TreeGrid 左树高度跟随视口
amis 的 .cxd-Tree--outline 默认 max-height:300px,多级分类树会「只露一半」、
下方大片留白。转换器给 treegrid 左树挂 className eip4-treegrid-tree
(见 TemplateToAmisConverter.convertTreeGrid),这里把其内树容器抬到视口相对
高度并内部滚动——填满可用区域、超出在树内滚(既非定高只露一半,也非随内容无限撑高)。
============================================================================ */
.amis-scope .eip4-treegrid-tree .cxd-Tree,
.amis-scope .eip4-treegrid-tree.cxd-Tree {
max-height: calc(100vh - 230px);
}
/* ============================================================================
10. P0 · L1 列表密度与表头打磨 — 2026-06-15(基于真实 DOM 实测校准)
实测本 SDK 列表:amis 全用 CSS 变量驱动单元格——
padding=var(--TableCell-paddingY/X)、字号=var(--Table-fontSize)、
表头=var(--Table-thead-fontSize/color)、字重=var(--fontWeightNormal)。
实测行高 45px、表头 14px/400 与正文无层次、hover/选中无视觉反馈。
故此处覆盖 amis 自身变量(最稳,无特异性之争;同本文件覆盖 --colors-* 路子),
统一全站列表(M1,占 60%)密度基调。第 5 节 `.cxd-Table-content .cxd-Table td`
在本 SDK 不匹配(死选择器),保留无害。
============================================================================ */
/* 10a. 覆盖 amis 表格密度/表头设计变量 */
:root,
.amis-scope .AMISCSSWrapper {
--TableCell-paddingY: 7px; /* 行密度:默认 calc(~11px) → 7px,行高 45→~38px */
--Table-fontSize: 13px; /* 正文 12 → 13,密而可读 */
--Table-thead-fontSize: 12.5px; /* 表头小一号 */
--Table-thead-color: #555c66; /* 表头中性色 = --text-2 */
}
[data-dark="1"] :root,
[data-dark="1"],
[data-dark="1"] .amis-scope .AMISCSSWrapper {
--Table-thead-color: #a3aab5;
}
/* 10b. 表头字重/字距:amis 用 var(--fontWeightNormal),此处定向加粗(匹配 amis 选择器特异性) */
.amis-scope .cxd-Table-table > thead > tr > th {
font-weight: 600;
letter-spacing: .02em;
}
/* 10c. 行 hover:当前无反馈 → 品牌淡底,强化"指到哪一行" */
.amis-scope .cxd-Table-table > tbody > tr:hover > td {
background-color: color-mix(in srgb, #2B5CE6, transparent 95%);
}
/* 10d. 行选中(勾选):当前 SDK 无选中样式 → 品牌淡底 + 左侧色条,强化痛点②选中可见性 */
.amis-scope .cxd-Table-table > tbody > tr.is-checked > td {
background-color: color-mix(in srgb, #2B5CE6, transparent 90%);
}
.amis-scope .cxd-Table-table > tbody > tr.is-checked > td:first-child {
box-shadow: inset 3px 0 0 #2B5CE6;
}
/* ============================================================================
11. P0 · L1 按钮层次 + 表单密度 — 2026-06-15(基于真实 DOM 实测校准)
实测:工具栏 10+ 个 default 按钮全是同一灰底 #f6f7f9(糊成"灰墙"、删除的
破坏性也看不出);表单行距 --Form-item-gap=24px(偏松,内容多的弹窗易溢出)。
============================================================================ */
/* 11a. 表单密度:行距 24px → 16px,弹窗/表单容纳更多、不挤(全局 amis 变量) */
:root,
.amis-scope .AMISCSSWrapper {
--Form-item-gap: 16px;
}
/* 11b. 默认按钮:灰底 → 白底 + 描边(更轻、更现代,似壳层 .btn),hover 品牌色 */
.amis-scope .cxd-Button--default {
background: #ffffff;
border-color: #cdd2d9; /* --line-strong */
color: #555c66; /* --text-2 */
}
.amis-scope .cxd-Button--default:hover {
background: #ffffff;
border-color: #2B5CE6;
color: #2B5CE6;
}
[data-dark="1"] .amis-scope .cxd-Button--default {
background: transparent;
border-color: #424b59;
color: #a3aab5;
}
/* 11c. 危险按钮(删除):红字 + 红描边,hover 红底,明确"破坏性"语义 */
.amis-scope .cxd-Button--danger {
background: #ffffff;
border-color: color-mix(in srgb, #d1453b, transparent 55%);
color: #d1453b;
}
.amis-scope .cxd-Button--danger:hover {
background: #fbe9e7; /* --err-soft */
border-color: #d1453b;
color: #d1453b;
}
/* ============================================================================
12. P0 · L1 内容多的主子表弹窗 — 2026-06-15(基于真实 13 行子表实测校准)
实测三因:①子表行 47px(列为可编辑控件,32px input+padding 撑高)
②弹窗 1034px > 视口(操作条够不到) ③子表表头非 sticky(滚动列头消失)。
三项均 L1/L2 解决,不碰 SDK。
============================================================================ */
/* 12a. 子表行密度:控件 32→28px + 单元格 padding 7→4px → 行高 ~47→~37px */
.amis-scope .cxd-InputTable .cxd-Table-table > tbody > tr > td {
padding-top: 4px;
padding-bottom: 4px;
}
.amis-scope .cxd-InputTable .cxd-Table-table .cxd-TextControl-input,
.amis-scope .cxd-InputTable .cxd-Table-table .cxd-Select,
.amis-scope .cxd-InputTable .cxd-Table-table .cxd-Number,
.amis-scope .cxd-InputTable .cxd-Table-table .cxd-Form-control {
min-height: 28px;
}
/* 12b. 弹窗高度封顶到视口 + body 内部滚动(操作条/底部按钮常驻可达) */
.amis-scope .cxd-Modal-content {
max-height: 90vh;
display: flex;
flex-direction: column;
}
.amis-scope .cxd-Modal-content > .cxd-Modal-body {
overflow-y: auto;
flex: 1 1 auto;
min-height: 0;
}
/* 12c. 子表表头 sticky:随 body 滚动钉在顶部,列头不丢 */
.amis-scope .cxd-InputTable .cxd-Table-table > thead > tr > th {
position: sticky;
top: 0;
z-index: 3;
}
/* ============================================================================
13. P0 · L1 输入控件字号统一 — 2026-06-15(基于真实 DOM 实测校准)
实测:输入框字号 14px,与表格正文 13px 不一致 → 统一到 13px。
(注:输入框边框 #e2e5ea 偏浅,但 amis 把 --Form-input-borderColor 声明得离
元素过近、token 覆盖压不动,直接改 border-color 又会破坏 hover/focus 态,
差异本身很小,故不强改。)
============================================================================ */
:root,
.amis-scope .AMISCSSWrapper {
--Form-input-fontSize: 13px; /* 与表格正文 13px 一致(原 14px) */
}
/* ============================================================================
15. 旧 UserSelectWindow 等价选人弹窗
左侧分组 + 双列穿梭 + 右侧已选过滤,替代普通 tabs-transfer-picker 的树选择误差。
============================================================================ */
.eip4-user-transfer-control {
min-height: 32px;
border: 1px solid #d7dde8;
border-radius: 6px;
background: #fff;
color: #1f2937;
display: flex;
align-items: center;
gap: 8px;
padding: 5px 9px;
cursor: pointer;
max-width: 100%;
}
.eip4-user-transfer-control.is-empty {
color: #9aa3b2;
}
.eip4-user-transfer-control.is-disabled {
background: #f3f5f8;
cursor: not-allowed;
}
.eip4-user-transfer-control > span {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.eip4-user-transfer-control > button,
.eip4-user-transfer-head > button {
border: 0;
background: transparent;
color: #667085;
cursor: pointer;
font-size: 18px;
line-height: 1;
}
.eip4-user-transfer-mask {
position: fixed;
inset: 0;
z-index: 2600;
background: rgba(17, 24, 39, .38);
display: flex;
align-items: center;
justify-content: center;
}
.eip4-user-transfer-dialog {
width: min(1120px, calc(100vw - 40px));
height: min(720px, calc(100vh - 40px));
background: #fff;
border-radius: 8px;
box-shadow: 0 24px 72px rgba(15, 23, 42, .26);
display: flex;
flex-direction: column;
overflow: hidden;
}
.eip4-user-transfer-head,
.eip4-user-transfer-foot {
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid #e5eaf2;
}
.eip4-user-transfer-head h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
.eip4-user-transfer-foot {
justify-content: flex-end;
gap: 10px;
border-top: 1px solid #e5eaf2;
border-bottom: 0;
}
.eip4-user-transfer-foot button,
.eip4-user-transfer-actions button {
min-width: 72px;
height: 34px;
border: 1px solid #cfd6e3;
border-radius: 6px;
background: #fff;
color: #344054;
cursor: pointer;
}
.eip4-user-transfer-foot button.primary {
border-color: #2f63e6;
background: #2f63e6;
color: #fff;
}
.eip4-user-transfer-foot button:disabled,
.eip4-user-transfer-actions button:disabled {
opacity: .45;
cursor: not-allowed;
}
.eip4-user-transfer-body {
flex: 1 1 auto;
min-height: 0;
display: grid;
grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
gap: 16px;
padding: 16px;
}
.eip4-user-transfer-panel {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.eip4-user-transfer-title,
.eip4-user-transfer-count {
color: #344054;
font-size: 13px;
line-height: 24px;
}
.eip4-user-transfer-tabs {
border: 1px solid #d7dde8;
border-radius: 6px;
overflow: hidden;
margin-bottom: 8px;
}
.eip4-user-transfer-tabs button {
width: 100%;
min-height: 34px;
border: 0;
border-bottom: 1px solid #e5eaf2;
background: #fff;
color: #344054;
display: block;
text-align: left;
padding: 7px 10px;
cursor: pointer;
}
.eip4-user-transfer-tabs button:last-child {
border-bottom: 0;
}
.eip4-user-transfer-tabs button.is-active {
background: #eef4ff;
color: #1f54d7;
font-weight: 600;
}
.eip4-user-transfer-group {
display: grid;
grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
gap: 8px;
margin-bottom: 8px;
}
.eip4-user-transfer-group input,
.eip4-user-transfer-group select,
.eip4-user-transfer-search {
height: 32px;
border: 1px solid #d7dde8;
border-radius: 6px;
padding: 0 9px;
color: #1f2937;
background: #fff;
min-width: 0;
}
.eip4-user-transfer-search {
margin-bottom: 8px;
}
.eip4-user-transfer-list {
flex: 1 1 auto;
min-height: 220px;
width: 100%;
border: 1px solid #cfd6e3;
border-radius: 6px;
padding: 4px;
font-size: 13px;
color: #1f2937;
}
.eip4-user-transfer-list option {
padding: 5px 8px;
}
.eip4-user-transfer-actions {
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
gap: 14px;
}
@media (max-width: 760px) {
.eip4-user-transfer-dialog {
width: calc(100vw - 20px);
height: calc(100vh - 20px);
}
.eip4-user-transfer-body {
grid-template-columns: 1fr;
}
.eip4-user-transfer-actions {
flex-direction: row;
}
}
/* ============================================================================
14. 查看(只读/静态)态隐藏必填星号 * — 2026-06-15
只读页的红 * 无意义(不可填、不校验)。静态渲染的必填项 value 部分是静态文本、
无输入控件(实测 .cxd-Form-value 内为 .cxd-TplField,无 input),据此 :has 判定
后隐藏 *;编辑态必填项 value 含 input/textarea/Select → 不命中,* 照常显示。
(实测查看 5★全隐、修改 5★全显。)
============================================================================ */
.amis-scope .cxd-Form-item.is-required:not(:has(.cxd-Form-value input, .cxd-Form-value textarea, .cxd-Form-value .cxd-Select)) .cxd-Form-star {
display: none;
}
/* ============================================================================
15. 隐藏冗余的页标题栏 — 2026-06-15
顶部多 Tab 已显示页名,页内 .cxd-Page-title 重复、白占 ~45px 垂直空间(ERP 该省)。
实测页头(.cxd-Page-header)仅含标题、无工具栏 → 整条隐藏;用 :has 保留少数含
.cxd-Page-toolbar(页级操作)的页头,避免误伤。crud 自带 headerToolbar 不受影响。
============================================================================ */
.amis-scope .cxd-Page-header:not(:has(.cxd-Page-toolbar)) {
display: none;
}