From e2163f76117b70df274776911ed9b0a09bdad5bc Mon Sep 17 00:00:00 2001 From: simonguo Date: Wed, 25 Dec 2024 17:29:49 +0800 Subject: [PATCH] refactor: use lodash-es instead of lodash --- babel.config.js | 1 - docs/App.tsx | 6 +-- docs/index.tsx | 19 +++---- package.json | 5 +- pnpm-lock.yaml | 96 ++++++---------------------------- src/Cell.tsx | 8 ++- src/ColumnResizeHandler.tsx | 4 +- src/HeaderCell.tsx | 4 +- src/Table.tsx | 7 ++- src/utils/defer.ts | 2 +- src/utils/getTableColumns.ts | 2 +- src/utils/getTotalByColumns.ts | 2 +- src/utils/mergeCells.tsx | 4 +- src/utils/prefix.ts | 6 ++- src/utils/useCellDescriptor.ts | 9 ++-- src/utils/useTableDimension.ts | 6 +-- src/utils/useTableRows.ts | 4 +- 17 files changed, 56 insertions(+), 129 deletions(-) diff --git a/babel.config.js b/babel.config.js index 2cbce7b0..d1d2be60 100644 --- a/babel.config.js +++ b/babel.config.js @@ -14,7 +14,6 @@ module.exports = (api, options) => { '@babel/typescript' ], plugins: [ - 'lodash', ['@babel/plugin-transform-class-properties', { loose: true }], '@babel/plugin-transform-optional-chaining', '@babel/plugin-transform-export-namespace-from', diff --git a/docs/App.tsx b/docs/App.tsx index 1d611119..293ee765 100644 --- a/docs/App.tsx +++ b/docs/App.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { Nav } from 'rsuite'; import CodeView from 'react-code-view'; -import Frame from './components/Frame'; import TableIcon from '@rsuite/icons/Table'; import GithubIcon from '@rsuite/icons/legacy/Github'; import BookIcon from '@rsuite/icons/legacy/Book'; -import kebabCase from 'lodash/kebabCase'; +import Frame from './components/Frame'; +import { Nav } from 'rsuite'; +import { kebabCase } from 'lodash-es'; interface ExampleType { title: string; diff --git a/docs/index.tsx b/docs/index.tsx index f4dff76f..b419d5c9 100644 --- a/docs/index.tsx +++ b/docs/index.tsx @@ -1,5 +1,12 @@ import React, { StrictMode } from 'react'; import ReactDOM from 'react-dom/client'; +import GearIcon from '@rsuite/icons/Gear'; +import ArrowDownIcon from '@rsuite/icons/ArrowDown'; +import ArrowUpIcon from '@rsuite/icons/ArrowUp'; +import SortIcon from '@rsuite/icons/Sort'; +import fakeDataForColSpan from './data/usersForColSpan'; +import fakeDataForRowSpan from './data/usersForRowSpan'; +import App from './App'; import { Popover, Whisper, @@ -16,19 +23,9 @@ import { VStack, HStack } from 'rsuite'; -import clone from 'lodash/clone'; -import isFunction from 'lodash/isFunction'; -import get from 'lodash/get'; -import without from 'lodash/without'; -import App from './App'; +import { clone, isFunction, get, without } from 'lodash-es'; import { Table, Column, Cell, HeaderCell, ColumnGroup } from '../src'; -import fakeDataForColSpan from './data/usersForColSpan'; -import fakeDataForRowSpan from './data/usersForRowSpan'; import { createUser, mockUsers, mockTreeData } from './data/mock'; -import GearIcon from '@rsuite/icons/Gear'; -import ArrowDownIcon from '@rsuite/icons/ArrowDown'; -import ArrowUpIcon from '@rsuite/icons/ArrowUp'; -import SortIcon from '@rsuite/icons/Sort'; import { useDrag, useDrop, DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; import { faker } from '@faker-js/faker'; diff --git a/package.json b/package.json index 9537f608..269795ef 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,10 @@ "@babel/runtime": "^7.20.1", "@juggle/resize-observer": "^3.4.0", "@rsuite/icons": "^1.3.0", + "@types/lodash-es": "^4.17.12", "classnames": "^2.3.1", "dom-lib": "^3.3.1", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=18", @@ -65,7 +66,6 @@ "@commitlint/config-conventional": "^13.1.0", "@faker-js/faker": "^7.6.0", "@testing-library/react": "^13.4.0", - "@types/lodash": "^4.14.165", "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", "@typescript-eslint/eslint-plugin": "^6.9.0", @@ -73,7 +73,6 @@ "autoprefixer": "^8.3.0", "babel-loader": "^8.2.2", "babel-plugin-istanbul": "^7.0.0", - "babel-plugin-lodash": "^3.3.4", "chai": "^4.3.5", "conventional-changelog-cli": "^2.1.1", "coveralls": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd22ca2d..541127f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,13 +17,16 @@ importers: '@rsuite/icons': specifier: ^1.3.0 version: 1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@types/lodash-es': + specifier: ^4.17.12 + version: 4.17.12 classnames: specifier: ^2.3.1 version: 2.5.1 dom-lib: specifier: ^3.3.1 version: 3.3.1 - lodash: + lodash-es: specifier: ^4.17.21 version: 4.17.21 devDependencies: @@ -69,9 +72,6 @@ importers: '@testing-library/react': specifier: ^13.4.0 version: 13.4.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/lodash': - specifier: ^4.14.165 - version: 4.17.7 '@types/react': specifier: ^18.2.0 version: 18.3.4 @@ -93,9 +93,6 @@ importers: babel-plugin-istanbul: specifier: ^7.0.0 version: 7.0.0 - babel-plugin-lodash: - specifier: ^3.3.4 - version: 3.3.4 chai: specifier: ^4.3.5 version: 4.5.0 @@ -304,10 +301,6 @@ packages: resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} engines: {node: '>=6.9.0'} - '@babel/generator@7.25.0': - resolution: {integrity: sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==} - engines: {node: '>=6.9.0'} - '@babel/generator@7.26.3': resolution: {integrity: sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==} engines: {node: '>=6.9.0'} @@ -355,10 +348,6 @@ packages: resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} engines: {node: '>=6.9.0'} - '@babel/helper-module-imports@7.24.7': - resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} - engines: {node: '>=6.9.0'} - '@babel/helper-module-imports@7.25.9': resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} engines: {node: '>=6.9.0'} @@ -877,18 +866,10 @@ packages: resolution: {integrity: sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==} engines: {node: '>=6.9.0'} - '@babel/template@7.25.0': - resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==} - engines: {node: '>=6.9.0'} - '@babel/template@7.25.9': resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} engines: {node: '>=6.9.0'} - '@babel/traverse@7.25.3': - resolution: {integrity: sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ==} - engines: {node: '>=6.9.0'} - '@babel/traverse@7.26.4': resolution: {integrity: sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==} engines: {node: '>=6.9.0'} @@ -1226,6 +1207,9 @@ packages: '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + '@types/lodash-es@4.17.12': + resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} + '@types/lodash@4.17.7': resolution: {integrity: sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==} @@ -1780,9 +1764,6 @@ packages: resolution: {integrity: sha512-C5OzENSx/A+gt7t4VH1I2XsflxyPUmXRFPKBxt33xncdOmq7oROVM3bZv9Ysjjkv8OJYDMa+tKuKMvqU/H3xdw==} engines: {node: '>=12'} - babel-plugin-lodash@3.3.4: - resolution: {integrity: sha512-yDZLjK7TCkWl1gpBeBGmuaDIFhZKmkoL+Cu2MUUjv5VxUZx/z7tBGBCBcQs5RI1Bkz5LLmNdjx7paOyQtMovyg==} - babel-plugin-polyfill-corejs2@0.4.11: resolution: {integrity: sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==} peerDependencies: @@ -4108,11 +4089,6 @@ packages: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} hasBin: true - jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} - hasBin: true - jsesc@3.0.2: resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} engines: {node: '>=6'} @@ -4328,6 +4304,9 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} + lodash-es@4.17.21: + resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} @@ -5548,9 +5527,6 @@ packages: require-main-filename@1.0.1: resolution: {integrity: sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==} - require-package-name@2.0.1: - resolution: {integrity: sha512-uuoJ1hU/k6M0779t3VMVIYpb2VMJk05cehCaABFhXaibcbvfgR8wKiozLjVFSzJPmQMRqIcO0HMyTFqfV09V6Q==} - requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} @@ -6785,13 +6761,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/generator@7.25.0': - dependencies: - '@babel/types': 7.25.2 - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - jsesc: 2.5.2 - '@babel/generator@7.26.3': dependencies: '@babel/parser': 7.26.3 @@ -6869,13 +6838,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-module-imports@7.24.7': - dependencies: - '@babel/traverse': 7.25.3 - '@babel/types': 7.25.2 - transitivePeerDependencies: - - supports-color - '@babel/helper-module-imports@7.25.9': dependencies: '@babel/traverse': 7.26.4 @@ -7515,30 +7477,12 @@ snapshots: dependencies: regenerator-runtime: 0.14.1 - '@babel/template@7.25.0': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/parser': 7.26.3 - '@babel/types': 7.25.2 - '@babel/template@7.25.9': dependencies: '@babel/code-frame': 7.26.2 '@babel/parser': 7.26.3 '@babel/types': 7.26.3 - '@babel/traverse@7.25.3': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/generator': 7.25.0 - '@babel/parser': 7.25.3 - '@babel/template': 7.25.0 - '@babel/types': 7.25.2 - debug: 4.3.6 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - '@babel/traverse@7.26.4': dependencies: '@babel/code-frame': 7.26.2 @@ -7978,6 +7922,10 @@ snapshots: '@types/json5@0.0.29': {} + '@types/lodash-es@4.17.12': + dependencies: + '@types/lodash': 4.17.7 + '@types/lodash@4.17.7': {} '@types/mime@1.3.5': {} @@ -8579,16 +8527,6 @@ snapshots: transitivePeerDependencies: - supports-color - babel-plugin-lodash@3.3.4: - dependencies: - '@babel/helper-module-imports': 7.24.7 - '@babel/types': 7.25.2 - glob: 7.2.3 - lodash: 4.17.21 - require-package-name: 2.0.1 - transitivePeerDependencies: - - supports-color - babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.26.0): dependencies: '@babel/compat-data': 7.25.2 @@ -11418,8 +11356,6 @@ snapshots: jsesc@0.5.0: {} - jsesc@2.5.2: {} - jsesc@3.0.2: {} jsesc@3.1.0: {} @@ -11689,6 +11625,8 @@ snapshots: dependencies: p-locate: 5.0.0 + lodash-es@4.17.21: {} + lodash.debounce@4.0.8: {} lodash.get@4.4.2: {} @@ -13040,8 +12978,6 @@ snapshots: require-main-filename@1.0.1: {} - require-package-name@2.0.1: {} - requires-port@1.0.0: {} resolve-cwd@3.0.0: diff --git a/src/Cell.tsx b/src/Cell.tsx index 4eb73243..1b331525 100644 --- a/src/Cell.tsx +++ b/src/Cell.tsx @@ -1,12 +1,10 @@ import React, { useCallback } from 'react'; -import omit from 'lodash/omit'; -import isNil from 'lodash/isNil'; -import get from 'lodash/get'; -import { LAYER_WIDTH, ROW_HEADER_HEIGHT, ROW_HEIGHT } from './constants'; -import { useClassNames, convertToFlex } from './utils'; import TableContext from './TableContext'; import ArrowRight from '@rsuite/icons/ArrowRight'; import ArrowDown from '@rsuite/icons/ArrowDown'; +import { omit, isNil, get } from 'lodash-es'; +import { LAYER_WIDTH, ROW_HEADER_HEIGHT, ROW_HEIGHT } from './constants'; +import { useClassNames, convertToFlex } from './utils'; import { StandardProps, RowDataType, RowKeyType } from './@types/common'; import { columnHandledProps } from './Column'; diff --git a/src/ColumnResizeHandler.tsx b/src/ColumnResizeHandler.tsx index 78afd169..85eea724 100644 --- a/src/ColumnResizeHandler.tsx +++ b/src/ColumnResizeHandler.tsx @@ -1,8 +1,8 @@ import React, { useCallback, useContext, useEffect, useRef } from 'react'; -import clamp from 'lodash/clamp'; import DOMMouseMoveTracker from 'dom-lib/DOMMouseMoveTracker'; -import { useClassNames } from './utils'; import TableContext from './TableContext'; +import { clamp } from 'lodash-es'; +import { useClassNames } from './utils'; import { RESIZE_MIN_WIDTH } from './constants'; import type { StandardProps } from './@types/common'; diff --git a/src/HeaderCell.tsx b/src/HeaderCell.tsx index 13169c11..72b51169 100644 --- a/src/HeaderCell.tsx +++ b/src/HeaderCell.tsx @@ -1,12 +1,12 @@ import React, { useState, useCallback } from 'react'; import classNames from 'classnames'; -import isNil from 'lodash/isNil'; import Sort from '@rsuite/icons/Sort'; import SortUp from '@rsuite/icons/SortUp'; import SortDown from '@rsuite/icons/SortDown'; import ColumnResizeHandler, { FixedType } from './ColumnResizeHandler'; -import { useUpdateEffect, useClassNames } from './utils'; import Cell, { InnerCellProps } from './Cell'; +import { useUpdateEffect, useClassNames } from './utils'; +import { isNil } from 'lodash-es'; import { RowDataType, RowKeyType } from './@types/common'; export interface HeaderCellProps diff --git a/src/Table.tsx b/src/Table.tsx index f9b7b9a1..d443eb21 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -1,8 +1,4 @@ import React, { useRef, useCallback, useImperativeHandle, useReducer, useMemo } from 'react'; -import { isElement } from './utils/react-is'; -import { getTranslateDOMPositionXY } from 'dom-lib/translateDOMPositionXY'; -import isFunction from 'lodash/isFunction'; -import debounce from 'lodash/debounce'; import Row, { RowProps } from './Row'; import CellGroup from './CellGroup'; import Scrollbar, { ScrollbarInstance } from './Scrollbar'; @@ -14,6 +10,9 @@ import Cell, { InnerCellProps } from './Cell'; import HeaderCell, { HeaderCellProps } from './HeaderCell'; import Column, { ColumnProps } from './Column'; import ColumnGroup from './ColumnGroup'; +import { debounce, isFunction } from 'lodash-es'; +import { isElement } from './utils/react-is'; +import { getTranslateDOMPositionXY } from 'dom-lib/translateDOMPositionXY'; import { SCROLLBAR_WIDTH, CELL_PADDING_HEIGHT, diff --git a/src/utils/defer.ts b/src/utils/defer.ts index 3d3ff88f..75b8b924 100644 --- a/src/utils/defer.ts +++ b/src/utils/defer.ts @@ -1,4 +1,4 @@ -import defer from 'lodash/defer'; +import { defer } from 'lodash-es'; /** * Defer callbacks to wait for DOM rendering to complete. diff --git a/src/utils/getTableColumns.ts b/src/utils/getTableColumns.ts index 72551d60..28f75430 100644 --- a/src/utils/getTableColumns.ts +++ b/src/utils/getTableColumns.ts @@ -1,6 +1,6 @@ import React from 'react'; -import flatten from 'lodash/flatten'; import ColumnGroup from '../ColumnGroup'; +import { flatten } from 'lodash-es'; import { isFragment } from './react-is'; /** diff --git a/src/utils/getTotalByColumns.ts b/src/utils/getTotalByColumns.ts index 6ae67af8..bf111e2e 100644 --- a/src/utils/getTotalByColumns.ts +++ b/src/utils/getTotalByColumns.ts @@ -1,6 +1,6 @@ import React from 'react'; -import isPlainObject from 'lodash/isPlainObject'; import getColumnProps from './getColumnProps'; +import { isPlainObject } from 'lodash-es'; import { RowDataType } from '../@types/common'; import { ColumnProps } from '../Column'; diff --git a/src/utils/mergeCells.tsx b/src/utils/mergeCells.tsx index 000cf038..6cf153c7 100644 --- a/src/utils/mergeCells.tsx +++ b/src/utils/mergeCells.tsx @@ -1,7 +1,5 @@ import React from 'react'; -import isFunction from 'lodash/isFunction'; -import get from 'lodash/get'; -import isNil from 'lodash/isNil'; +import { get, isNil, isFunction } from 'lodash-es'; import ColumnGroup from '../ColumnGroup'; import HeaderCell from '../HeaderCell'; diff --git a/src/utils/prefix.ts b/src/utils/prefix.ts index 67688a3a..5cf74fe1 100644 --- a/src/utils/prefix.ts +++ b/src/utils/prefix.ts @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import curry from 'lodash/curry'; +import { curry } from 'lodash-es'; export function prefix(pre: string, className: string | string[]): string { if (!pre || !className) { @@ -18,4 +18,6 @@ export function prefix(pre: string, className: string | string[]): string { return `${pre}-${className}`; } -export default curry(prefix); +const curryPrefix: (pre: string, className: string | string[]) => string = curry(prefix); + +export default curryPrefix; diff --git a/src/utils/useCellDescriptor.ts b/src/utils/useCellDescriptor.ts index ce1444e3..b6380681 100644 --- a/src/utils/useCellDescriptor.ts +++ b/src/utils/useCellDescriptor.ts @@ -2,18 +2,17 @@ import React, { useState, useCallback, useRef } from 'react'; import addStyle from 'dom-lib/addStyle'; import addClass from 'dom-lib/addClass'; import removeClass from 'dom-lib/removeClass'; -import omit from 'lodash/omit'; -import merge from 'lodash/merge'; -import { SCROLLBAR_WIDTH, SORT_TYPE } from '../constants'; -import { SortType, RowDataType } from '../@types/common'; import useControlled from './useControlled'; import getTableColumns from './getTableColumns'; import getTotalByColumns from './getTotalByColumns'; import getColumnProps from './getColumnProps'; import useUpdateEffect from './useUpdateEffect'; -import { ColumnProps } from '../Column'; import flushSync from './flushSync'; import useMount from './useMount'; +import { ColumnProps } from '../Column'; +import { omit, merge } from 'lodash-es'; +import { SCROLLBAR_WIDTH, SORT_TYPE } from '../constants'; +import { SortType, RowDataType } from '../@types/common'; interface CellDescriptorProps { children: React.ReactNode[]; diff --git a/src/utils/useTableDimension.ts b/src/utils/useTableDimension.ts index f4987eb4..abc2272d 100644 --- a/src/utils/useTableDimension.ts +++ b/src/utils/useTableDimension.ts @@ -2,14 +2,14 @@ import React, { useRef, useCallback, useMemo } from 'react'; import getWidth from 'dom-lib/getWidth'; import getHeight from 'dom-lib/getHeight'; import getOffset from 'dom-lib/getOffset'; -import { SCROLLBAR_WIDTH } from '../constants'; -import { ResizeObserver } from '@juggle/resize-observer'; import useMount from './useMount'; import useUpdateLayoutEffect from './useUpdateLayoutEffect'; import useIntersectionObserver from './useIntersectionObserver'; import isNumberOrTrue from './isNumberOrTrue'; +import { ResizeObserver } from '@juggle/resize-observer'; +import { debounce } from 'lodash-es'; +import { SCROLLBAR_WIDTH } from '../constants'; import { RowDataType, ElementOffset } from '../@types/common'; -import debounce from 'lodash/debounce'; interface TableDimensionProps { data?: readonly Row[]; diff --git a/src/utils/useTableRows.ts b/src/utils/useTableRows.ts index 7f81a588..3ad5a61d 100644 --- a/src/utils/useTableRows.ts +++ b/src/utils/useTableRows.ts @@ -1,9 +1,9 @@ import { useState, useCallback, useRef } from 'react'; +import { isEmpty } from 'lodash-es'; +import { RowDataType } from '../@types/common'; import getHeight from 'dom-lib/getHeight'; import useUpdateLayoutEffect from './useUpdateLayoutEffect'; import useMount from './useMount'; -import isEmpty from 'lodash/isEmpty'; -import { RowDataType } from '../@types/common'; import defer from './defer'; interface TableRowsProps {