|
24 | 24 | * - All expanded props, move into expandable
|
25 | 25 | */
|
26 | 26 |
|
27 |
| -import * as React from 'react'; |
28 |
| -import isVisible from 'rc-util/lib/Dom/isVisible'; |
29 |
| -import pickAttrs from 'rc-util/lib/pickAttrs'; |
30 |
| -import { isStyleSupport } from 'rc-util/lib/Dom/styleChecker'; |
31 | 27 | import classNames from 'classnames';
|
32 |
| -import shallowEqual from 'shallowequal'; |
33 |
| -import warning from 'rc-util/lib/warning'; |
34 | 28 | import ResizeObserver from 'rc-resize-observer';
|
| 29 | +import isVisible from 'rc-util/lib/Dom/isVisible'; |
| 30 | +import { isStyleSupport } from 'rc-util/lib/Dom/styleChecker'; |
35 | 31 | import { getTargetScrollBarSize } from 'rc-util/lib/getScrollBarSize';
|
36 |
| -import ColumnGroup from './sugar/ColumnGroup'; |
37 |
| -import Column from './sugar/Column'; |
| 32 | +import pickAttrs from 'rc-util/lib/pickAttrs'; |
| 33 | +import warning from 'rc-util/lib/warning'; |
| 34 | +import * as React from 'react'; |
| 35 | +import shallowEqual from 'shallowequal'; |
| 36 | +import Body from './Body'; |
| 37 | +import ColGroup from './ColGroup'; |
| 38 | +import { EXPAND_COLUMN } from './constant'; |
| 39 | +import BodyContext from './context/BodyContext'; |
| 40 | +import ExpandedRowContext from './context/ExpandedRowContext'; |
| 41 | +import ResizeContext from './context/ResizeContext'; |
| 42 | +import StickyContext from './context/StickyContext'; |
| 43 | +import TableContext from './context/TableContext'; |
| 44 | +import FixedHolder from './FixedHolder'; |
| 45 | +import Footer, { FooterComponents } from './Footer'; |
| 46 | +import type { SummaryProps } from './Footer/Summary'; |
| 47 | +import Summary from './Footer/Summary'; |
38 | 48 | import Header from './Header/Header';
|
| 49 | +import useColumns from './hooks/useColumns'; |
| 50 | +import { useLayoutState, useTimeoutLock } from './hooks/useFrame'; |
| 51 | +import useSticky from './hooks/useSticky'; |
| 52 | +import useStickyOffsets from './hooks/useStickyOffsets'; |
39 | 53 | import type {
|
40 |
| - GetRowKey, |
41 | 54 | ColumnsType,
|
42 |
| - TableComponents, |
43 |
| - Key, |
| 55 | + ColumnType, |
| 56 | + CustomizeComponent, |
| 57 | + CustomizeScrollBody, |
44 | 58 | DefaultRecordType,
|
45 |
| - TriggerEventHandler, |
46 |
| - GetComponentProps, |
47 | 59 | ExpandableConfig,
|
48 |
| - LegacyExpandableProps, |
| 60 | + ExpandableType, |
49 | 61 | GetComponent,
|
| 62 | + GetComponentProps, |
| 63 | + GetRowKey, |
| 64 | + Key, |
| 65 | + LegacyExpandableProps, |
50 | 66 | PanelRender,
|
51 |
| - TableLayout, |
52 |
| - ExpandableType, |
53 | 67 | RowClassName,
|
54 |
| - CustomizeComponent, |
55 |
| - ColumnType, |
56 |
| - CustomizeScrollBody, |
| 68 | + TableComponents, |
| 69 | + TableLayout, |
57 | 70 | TableSticky,
|
| 71 | + TriggerEventHandler, |
58 | 72 | } from './interface';
|
59 |
| -import TableContext from './context/TableContext'; |
60 |
| -import BodyContext from './context/BodyContext'; |
61 |
| -import Body from './Body'; |
62 |
| -import useColumns from './hooks/useColumns'; |
63 |
| -import { useLayoutState, useTimeoutLock } from './hooks/useFrame'; |
64 |
| -import { getPathValue, validateValue, getColumnsKey } from './utils/valueUtil'; |
65 |
| -import ResizeContext from './context/ResizeContext'; |
66 |
| -import useStickyOffsets from './hooks/useStickyOffsets'; |
67 |
| -import ColGroup from './ColGroup'; |
68 |
| -import { getExpandableProps } from './utils/legacyUtil'; |
69 | 73 | import Panel from './Panel';
|
70 |
| -import Footer, { FooterComponents } from './Footer'; |
| 74 | +import StickyScrollBar from './stickyScrollBar'; |
| 75 | +import Column from './sugar/Column'; |
| 76 | +import ColumnGroup from './sugar/ColumnGroup'; |
71 | 77 | import { findAllChildrenKeys, renderExpandIcon } from './utils/expandUtil';
|
72 | 78 | import { getCellFixedInfo } from './utils/fixUtil';
|
73 |
| -import StickyScrollBar from './stickyScrollBar'; |
74 |
| -import useSticky from './hooks/useSticky'; |
75 |
| -import FixedHolder from './FixedHolder'; |
76 |
| -import type { SummaryProps } from './Footer/Summary'; |
77 |
| -import Summary from './Footer/Summary'; |
78 |
| -import StickyContext from './context/StickyContext'; |
79 |
| -import ExpandedRowContext from './context/ExpandedRowContext'; |
80 |
| -import { EXPAND_COLUMN } from './constant'; |
| 79 | +import { getExpandableProps } from './utils/legacyUtil'; |
| 80 | +import { getColumnsKey, getPathValue, validateValue } from './utils/valueUtil'; |
81 | 81 |
|
82 | 82 | // Used for conditions cache
|
83 | 83 | const EMPTY_DATA = [];
|
@@ -458,8 +458,15 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
|
458 | 458 | if (typeof target === 'function') {
|
459 | 459 | target(scrollLeft);
|
460 | 460 | } else if (target.scrollLeft !== scrollLeft) {
|
461 |
| - // eslint-disable-next-line no-param-reassign |
462 | 461 | target.scrollLeft = scrollLeft;
|
| 462 | + |
| 463 | + // Delay to force scroll position if not sync |
| 464 | + // ref: https://github.com/ant-design/ant-design/issues/37179 |
| 465 | + if (target.scrollLeft !== scrollLeft) { |
| 466 | + setTimeout(() => { |
| 467 | + target.scrollLeft = scrollLeft; |
| 468 | + }, 0); |
| 469 | + } |
463 | 470 | }
|
464 | 471 | }
|
465 | 472 |
|
@@ -613,7 +620,9 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
|
613 | 620 | );
|
614 | 621 |
|
615 | 622 | const captionElement =
|
616 |
| - caption !== null && caption !== undefined ? <caption className={`${prefixCls}-caption`}>{caption}</caption> : undefined; |
| 623 | + caption !== null && caption !== undefined ? ( |
| 624 | + <caption className={`${prefixCls}-caption`}>{caption}</caption> |
| 625 | + ) : undefined; |
617 | 626 |
|
618 | 627 | const customizeScrollBody = getComponent(['body']) as CustomizeScrollBody<RecordType>;
|
619 | 628 |
|
|
0 commit comments