mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
parent
7682b0a4ca
commit
a9c17bae20
@ -1,4 +1,8 @@
|
||||
.#{$ns}Cards {
|
||||
// 黑科技,让 scrollIntoView 能够跑正确的位置
|
||||
margin-top: calc(var(--affix-offset-top) * -1);
|
||||
padding-top: var(--affix-offset-top);
|
||||
|
||||
&-toolbar {
|
||||
@include clearfix();
|
||||
padding: var(--Cards-toolbar-marginY) var(--Cards-toolbar-marginX)
|
||||
|
@ -1,5 +1,8 @@
|
||||
.#{$ns}List {
|
||||
position: relative;
|
||||
// 黑科技,让 scrollIntoView 能够跑正确的位置
|
||||
margin-top: calc(var(--affix-offset-top) * -1);
|
||||
padding-top: var(--affix-offset-top);
|
||||
|
||||
&-items {
|
||||
border-radius: var(--List-borderRadius);
|
||||
|
@ -1,6 +1,10 @@
|
||||
.#{$ns}Table {
|
||||
position: relative;
|
||||
|
||||
// 黑科技,让 scrollIntoView 能够跑正确的位置
|
||||
margin-top: calc(var(--affix-offset-top) * -1);
|
||||
padding-top: var(--affix-offset-top);
|
||||
|
||||
border-radius: var(--Table-borderRadius);
|
||||
margin-bottom: var(--gap-md);
|
||||
|
||||
|
@ -1435,9 +1435,13 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
this.search(undefined, undefined, undefined);
|
||||
|
||||
if (autoJumpToTopOnPagerChange && this.control) {
|
||||
(findDOMNode(this.control) as HTMLElement).scrollIntoView();
|
||||
const scrolledY = window.scrollY;
|
||||
scrolledY && window.scroll(0, scrolledY);
|
||||
if (this.control.scrollToTop) {
|
||||
this.control.scrollToTop();
|
||||
} else {
|
||||
(findDOMNode(this.control) as HTMLElement).scrollIntoView();
|
||||
const scrolledY = window.scrollY;
|
||||
scrolledY && window.scroll(0, scrolledY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,6 +548,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
resizable: true
|
||||
};
|
||||
|
||||
dom = React.createRef<HTMLDivElement>();
|
||||
table?: HTMLTableElement;
|
||||
sortable?: Sortable;
|
||||
dragTip?: HTMLElement;
|
||||
@ -989,6 +990,15 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
scoped.unRegisterComponent(this);
|
||||
}
|
||||
|
||||
scrollToTop() {
|
||||
this.dom.current?.scrollIntoView();
|
||||
if (this.props.autoFillHeight) {
|
||||
this.table?.scrollIntoView();
|
||||
}
|
||||
const scrolledY = window.scrollY;
|
||||
scrolledY && window.scroll(0, scrolledY);
|
||||
}
|
||||
|
||||
rowPathPlusOffset(path: string, offset = 0) {
|
||||
const list = path.split('.').map((item: any) => parseInt(item, 10));
|
||||
list[0] += offset;
|
||||
@ -2830,6 +2840,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={this.dom}
|
||||
className={cx('Table', {'is-mobile': mobileUI}, className, {
|
||||
'Table--unsaved': !!store.modified || !!store.moved,
|
||||
'Table--autoFillHeight': autoFillHeight
|
||||
|
Loading…
Reference in New Issue
Block a user