Skip to content

Commit 5b9d13d

Browse files
committed
chore: use create immutable
1 parent 33799fc commit 5b9d13d

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"dependencies": {
5656
"@babel/runtime": "^7.10.1",
57-
"@rc-component/context": "^1.3.0",
57+
"@rc-component/context": "^1.4.0",
5858
"classnames": "^2.2.5",
5959
"rc-resize-observer": "^1.1.0",
6060
"rc-util": "^5.27.1",

src/Body/BodyRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import classNames from 'classnames';
33
import { useEvent } from 'rc-util';
44
import * as React from 'react';
55
import Cell from '../Cell';
6-
import TableContext, { type TableContextProps } from '../context/TableContext';
6+
import TableContext, { responseImmutable, type TableContextProps } from '../context/TableContext';
77
import devRenderTimes from '../hooks/useRenderTimes';
88
import type { ColumnType, CustomizeComponent, GetComponentProps, GetRowKey } from '../interface';
99
import { getColumnsKey } from '../utils/valueUtil';

src/Body/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import * as React from 'react';
33
import type { PerfRecord } from '../context/PerfContext';
44
import PerfContext from '../context/PerfContext';
5-
import TableContext from '../context/TableContext';
5+
import TableContext, { responseImmutable } from '../context/TableContext';
66
import useFlattenRecords from '../hooks/useFlattenRecords';
77
import devRenderTimes from '../hooks/useRenderTimes';
88
import type { GetComponentProps } from '../interface';

src/Cell/useCellRender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useImmutableMark } from '@rc-component/context';
21
import useMemo from 'rc-util/lib/hooks/useMemo';
32
import isEqual from 'rc-util/lib/isEqual';
43
import getValue from 'rc-util/lib/utils/get';
@@ -7,6 +6,7 @@ import * as React from 'react';
76
import PerfContext from '../context/PerfContext';
87
import type { CellType, ColumnType, DataIndex, RenderedCell } from '../interface';
98
import { validateValue } from '../utils/valueUtil';
9+
import { useImmutableMark } from '../context/TableContext';
1010

1111
function isRenderCell<RecordType>(
1212
data: React.ReactNode | RenderedCell<RecordType>,

src/Footer/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import * as React from 'react';
3-
import TableContext from '../context/TableContext';
3+
import TableContext, { responseImmutable } from '../context/TableContext';
44
import devRenderTimes from '../hooks/useRenderTimes';
55
import type { ColumnsType, ColumnType, StickyOffsets } from '../interface';
66
import Summary from './Summary';
@@ -32,7 +32,7 @@ function Footer<RecordType>(props: FooterProps<RecordType>) {
3232
stickyOffsets,
3333
flattenColumns,
3434
scrollColumnIndex: scrollColumn?.scrollbar ? lastColumnIndex : null,
35-
columns
35+
columns,
3636
}),
3737
[scrollColumn, flattenColumns, lastColumnIndex, stickyOffsets, columns],
3838
);

src/Header/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import * as React from 'react';
3-
import TableContext from '../context/TableContext';
3+
import TableContext, { responseImmutable } from '../context/TableContext';
44
import devRenderTimes from '../hooks/useRenderTimes';
55
import type {
66
CellType,

src/StaticTable/BodyGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import classNames from 'classnames';
33
import VirtualList, { type ListProps, type ListRef } from 'rc-virtual-list';
44
import * as React from 'react';
5-
import TableContext from '../context/TableContext';
5+
import TableContext, { responseImmutable } from '../context/TableContext';
66
import useFlattenRecords, { type FlattenData } from '../hooks/useFlattenRecords';
77
import type { ColumnType, OnCustomizeScroll } from '../interface';
88
import BodyLine from './BodyLine';

src/StaticTable/BodyLine.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { responseImmutable, useContext } from '@rc-component/context';
1+
import { useContext } from '@rc-component/context';
22
import classNames from 'classnames';
33
import * as React from 'react';
44
import { useRowInfo } from '../Body/BodyRow';
5-
import TableContext from '../context/TableContext';
5+
import TableContext, { responseImmutable } from '../context/TableContext';
66
import type { FlattenData } from '../hooks/useFlattenRecords';
77
import { StaticContext } from './context';
88
import VirtualCell from './VirtualCell';

src/StaticTable/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { CompareProps, makeImmutable } from '@rc-component/context/lib/Immutable';
1+
import type { CompareProps } from '@rc-component/context/lib/Immutable';
22
import * as React from 'react';
33
import { INTERNAL_HOOKS } from '..';
44
import type { CustomizeScrollBody } from '../interface';
55
import Table, { type TableProps } from '../Table';
66
import Grid from './BodyGrid';
77
import { StaticContext } from './context';
88
import useWidthColumns from './useWidthColumns';
9+
import { makeImmutable } from '../context/TableContext';
910

1011
const renderBody: CustomizeScrollBody<any> = (rawData, props) => {
1112
const { ref, onScroll } = props;

src/Table.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
* - All expanded props, move into expandable
2525
*/
2626

27-
import { makeImmutable } from '@rc-component/context';
2827
import type { CompareProps } from '@rc-component/context/lib/Immutable';
2928
import classNames from 'classnames';
3029
import ResizeObserver from 'rc-resize-observer';
@@ -39,7 +38,7 @@ import * as React from 'react';
3938
import Body from './Body';
4039
import ColGroup from './ColGroup';
4140
import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant';
42-
import TableContext from './context/TableContext';
41+
import TableContext, { makeImmutable } from './context/TableContext';
4342
import type { FixedHeaderProps } from './FixedHolder';
4443
import FixedHolder from './FixedHolder';
4544
import Footer, { FooterComponents } from './Footer';

0 commit comments

Comments
 (0)