feat: master-detail third pane
- MasterDetail / MasterDetailPage: add `sub` prop and `#sub` slot. The three columns share one container and are placed by left/right, so the detail pane moves between columns without remounting and keeps its scroll position. - useMasterDetailPane: add subView / openSub / closeSub, keep the sub view in query and browser history alongside detail and view. - page-layout: sub pane reuses the in-pane navbar rules; the list navbar slides out on the third level instead of being hidden. - docs: demos for the third pane, the layered navbars and PaneTransition; restore transition durations in demo previews under prefers-reduced-motion, where VitePress zeroes them. Fix the missing `split` ref in the master-detail demo and the incorrect note about the back arrow.
This commit is contained in:
@@ -154,7 +154,8 @@
|
||||
* 整页进入用 400ms 是合适的,但在右栏展开的同一时间播 400ms,
|
||||
* 内容会比列表缩窄晚 300ms 才完全显现,看起来像"详情跟不上"。
|
||||
*/
|
||||
.tui-master-detail .detail .entrance-fade-up-enter-active {
|
||||
.tui-master-detail .detail .entrance-fade-up-enter-active,
|
||||
.tui-master-detail .sub .entrance-fade-up-enter-active {
|
||||
transition-duration: 200ms;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,22 @@
|
||||
.tui-page-layout:has(> .tui-page-content > .tui-master-detail.split) > .t-navbar--fixed .t-navbar__content {
|
||||
right: auto;
|
||||
width: var(--tui-master-width, 380px);
|
||||
transition: width var(--tui-split-duration, 320ms) @split-easing;
|
||||
transition:
|
||||
width var(--tui-split-duration, 320ms) @split-easing,
|
||||
margin-left var(--tui-split-duration, 320ms) @split-easing,
|
||||
opacity .12s ease-out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三层:列表整列滑出,列表页的导航栏跟着让位。
|
||||
*
|
||||
* 用 margin-left 而不是 transform——导航栏里可能有弹层,transform 会把它们锁进来。
|
||||
* 宽度不变、只是移出可视区,回退时按原路滑回,不用重新测量。
|
||||
*/
|
||||
.tui-page-layout:has(> .tui-page-content > .tui-master-detail.split.has-sub) > .t-navbar--fixed .t-navbar__content {
|
||||
margin-left: calc(-1 * var(--tui-master-width, 380px));
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// 详情未选中、主栏占满时,导航栏也要满宽。
|
||||
@@ -179,15 +195,24 @@
|
||||
width: calc(100% - var(--tui-fixed-left, 0px));
|
||||
}
|
||||
|
||||
// 详情栏放的是整页组件时:栏位本身不再滚动,改由页面内容区滚动
|
||||
.tui-master-detail .detail:has(> .tui-page-layout) {
|
||||
// push 转场时 fixed 改以页面容器为定位基准,页面宽度已避开 rail,不能再次扣除 rail。
|
||||
.tui-app-shell.is-rail .page-transition-page[class*="push-"] .tui-page-layout:has(> .tui-page-content > .tui-master-detail.split.is-collapsed) > .t-navbar--fixed .t-navbar__content {
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
// 详情栏、子页栏放的是整页组件时:栏位本身不再滚动,改由页面内容区滚动
|
||||
.tui-master-detail .detail:has(> .tui-page-layout),
|
||||
.tui-master-detail .sub:has(> .tui-page-layout) {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
padding-top: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tui-master-detail .detail > .tui-page-layout {
|
||||
.tui-master-detail .detail > .tui-page-layout,
|
||||
.tui-master-detail .sub > .tui-page-layout {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
@@ -195,7 +220,8 @@
|
||||
}
|
||||
|
||||
// 页面导航栏浮在内容之上,而不是占位:这样滚动内容才能穿进它的毛玻璃层
|
||||
.tui-master-detail .detail > .tui-page-layout > .t-navbar--fixed {
|
||||
.tui-master-detail .detail > .tui-page-layout > .t-navbar--fixed,
|
||||
.tui-master-detail .sub > .tui-page-layout > .t-navbar--fixed {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
@@ -204,14 +230,16 @@
|
||||
}
|
||||
|
||||
// 栏内定位是相对栏位算的,必须清掉 rail 留下的左偏移,否则整条导航右移 96px
|
||||
.tui-master-detail .detail > .tui-page-layout > .t-navbar--fixed .t-navbar__content {
|
||||
.tui-master-detail .detail > .tui-page-layout > .t-navbar--fixed .t-navbar__content,
|
||||
.tui-master-detail .sub > .tui-page-layout > .t-navbar--fixed .t-navbar__content {
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// 内容区铺满栏位,顶部内边距沿用页面骨架的导航高度,滚上去就被导航盖住
|
||||
.tui-master-detail .detail > .tui-page-layout > .tui-page-content {
|
||||
.tui-master-detail .detail > .tui-page-layout > .tui-page-content,
|
||||
.tui-master-detail .sub > .tui-page-layout > .tui-page-content {
|
||||
flex: 1;
|
||||
position: static;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user