tmagic-editor/packages/form/src/theme/group-list.scss
roymondchen 2a4a54a495 feat(form): group-list 标题吸顶改为按 header.sticky 显式开启
默认关闭避免长列表误吸顶,嵌套层按外层真实标题/吸底按钮高度让位;属性面板列表通过 stickyAddButton 保持原表现。
2026-09-09 11:19:54 +08:00

181 lines
5.0 KiB
SCSS
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.

.m-fields-group-list {
// footer 高度由这三项派生,改 padding / 按钮尺寸时嵌套吸底按钮的偏移会跟着走;
// TableGroupList 计算 scroll-margin 时量的是同一个 footer 的实际高度,两边不会漂移
--m-group-list-footer-padding-top: 12px;
--m-group-list-footer-padding-bottom: 16px;
--m-group-list-footer-button-height: 32px;
--m-group-list-footer-height: calc(
var(--m-group-list-footer-padding-top) +
var(--m-group-list-footer-button-height) +
var(--m-group-list-footer-padding-bottom)
);
--m-group-list-footer-bg: var(--el-bg-color, #fff);
--m-group-list-header-height: 65px;
--m-group-list-header-bg: #fff;
width: 100%;
min-width: 0;
.m-fields-group-list-item.tmagic-design-card--flat:last-child {
border: 0;
}
.el-button--text {
padding: 0;
margin-bottom: 7px;
}
.el-tree-node__expand-icon {
padding: 0;
margin-bottom: 7px;
&.expand {
transform: rotate(90deg);
}
}
.m-fields-group-list-item {
overflow: visible;
border-bottom: 1px solid #ebeef5;
margin-bottom: 7px;
&:last-of-type {
border-bottom: 0;
}
.el-card__body,
.t-card__body {
overflow: visible;
> .m-container-row {
overflow: visible;
}
.tmagic-design-form-item {
margin-bottom: 16px;
}
}
.m-fields-group-list-item-header {
display: flex;
align-items: center;
gap: 8px;
}
.m-fields-group-list-item-title {
flex: 1;
min-width: 0;
}
.m-fields-group-list-item-actions {
display: flex;
align-items: center;
flex-shrink: 0;
gap: 8px;
}
}
// 嵌套吸底按钮叠在外层 footer 之上(如「新增条件」叠在「新增条件组」上面)。
// 每穿过一层「自己渲染了吸底 footer」的列表才多让出一个 footer 高度,外层没有吸底按钮时
// 内层不能凭空抬高。自定义属性不能自增,所以用 item / list 两个变量交替接力。
> .m-fields-group-list-item {
--m-group-list-item-footer-bottom: var(
--m-group-list-nested-footer-bottom,
0px
);
}
&.is-footer-sticky > .m-fields-group-list-item {
--m-group-list-item-footer-bottom: calc(
var(--m-group-list-nested-footer-bottom, 0px) +
var(--m-group-list-footer-height)
);
}
.m-fields-group-list-item .m-fields-group-list {
--m-group-list-nested-footer-bottom: var(
--m-group-list-item-footer-bottom,
0px
);
}
// 仅 header.sticky 时标题吸顶;直接子 item避免外层吸顶带动未开启的内层
&.is-header-sticky {
// 从外层 item 接过已累加的偏移;最外层没有该变量时走 fallback
--m-group-list-nested-sticky-top: var(--m-group-list-child-list-sticky-top);
--m-group-list-nested-header-z: var(--m-group-list-child-list-header-z);
> .m-fields-group-list-item {
--m-group-list-item-sticky-top: var(
--m-group-list-nested-sticky-top,
var(--m-group-list-header-sticky-top, 0px)
);
--m-group-list-item-header-z: var(--m-group-list-nested-header-z, 7);
--m-group-list-child-list-sticky-top: calc(
var(--m-group-list-item-sticky-top) + var(--m-group-list-header-height)
);
--m-group-list-child-list-header-z: calc(
var(--m-group-list-item-header-z) - 1
);
// 卡片标题吸顶;补不透明背景,避免滚动时正文透出。
// z-index 必须低于吸底 footer否则标题会盖住「新增」按钮。
> .el-card__header,
> .t-card__header {
position: sticky;
top: var(--m-group-list-item-sticky-top);
z-index: var(--m-group-list-item-header-z);
background-color: var(--m-group-list-header-bg, #fff);
}
}
}
.el-table__empty-block {
width: 100%;
min-height: 0;
}
.el-table__empty-text {
display: block;
box-sizing: border-box;
width: 100%;
}
> .m-fields-group-list-footer {
display: flex;
justify-content: space-between;
margin-top: 10px;
margin-bottom: 16px;
}
// 吸底全宽主按钮event-select / code-select / display-conds 外层列表)
// z-index 高于 item header避免吸顶标题挡住新增按钮多层时 bottom 由内层 list 累加
> .m-fields-group-list-footer.is-sticky-full {
position: sticky;
bottom: var(--m-group-list-nested-footer-bottom, 0px);
z-index: 7;
margin-bottom: 0;
padding: var(--m-group-list-footer-padding-top) 0
var(--m-group-list-footer-padding-bottom);
background-color: var(--m-group-list-footer-bg);
> div {
justify-content: stretch;
}
.el-button,
.tmagic-design-button {
width: 100%;
height: var(--m-group-list-footer-button-height);
}
}
}
/** 最外层的groupList需要每个item需要增加空白区域界限时增加outer-gorup_list可以实现 */
.m-container-group-list {
&.outer-gorup_list {
> .m-fields-group-list {
> .m-fields-group-list-item {
margin-bottom: 10px;
}
}
}
}