diff --git a/now.json b/now.json deleted file mode 100644 index 5060a6c12..000000000 --- a/now.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": 2, - "name": "rc-table", - "builds": [ - { - "src": "package.json", - "use": "@now/static-build", - "config": { "distDir": "dist" } - } - ], - "routes": [ - { "src": "/(.*)", "dest": "/dist/$1" } - ] -} diff --git a/package.json b/package.json index f2e1a66ac..efc325a03 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"", "test": "vitest --watch false", "coverage": "vitest run --coverage", - "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", + "prepublishOnly": "npm run compile && rc-np", "lint": "eslint src/ --ext .tsx,.ts", "tsc": "tsc -p tsconfig.json --noEmit", "now-build": "npm run docs:build", @@ -56,11 +56,12 @@ "@rc-component/context": "^1.4.0", "@rc-component/util": "^1.1.0", "classnames": "^2.2.5", - "rc-resize-observer": "^1.1.0", + "@rc-component/resize-observer": "^1.0.0", "rc-virtual-list": "^3.14.2" }, "devDependencies": { "@rc-component/father-plugin": "^2.0.1", + "@rc-component/np": "^1.0.3", "@testing-library/jest-dom": "^6.4.0", "@testing-library/react": "^12.1.5", "@types/enzyme": "^3.10.5", @@ -88,7 +89,6 @@ "jsdom": "^25.0.0", "less": "^4.1.3", "lint-staged": "^15.1.0", - "np": "^10.0.1", "prettier": "^3.1.0", "rc-animate": "^3.0.0", "rc-dropdown": "~4.0.1", diff --git a/src/Body/MeasureCell.tsx b/src/Body/MeasureCell.tsx index 1fc8d9cdf..1c938687f 100644 --- a/src/Body/MeasureCell.tsx +++ b/src/Body/MeasureCell.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import ResizeObserver from 'rc-resize-observer'; +import ResizeObserver from '@rc-component/resize-observer'; export interface MeasureCellProps { columnKey: React.Key; diff --git a/src/Body/MeasureRow.tsx b/src/Body/MeasureRow.tsx index 3dbd12113..0c1d03114 100644 --- a/src/Body/MeasureRow.tsx +++ b/src/Body/MeasureRow.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import ResizeObserver from 'rc-resize-observer'; +import ResizeObserver from '@rc-component/resize-observer'; import MeasureCell from './MeasureCell'; export interface MeasureCellProps { diff --git a/src/Table.tsx b/src/Table.tsx index 2923df584..52d4d772e 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -26,7 +26,7 @@ import type { CompareProps } from '@rc-component/context/lib/Immutable'; import classNames from 'classnames'; -import ResizeObserver from 'rc-resize-observer'; +import ResizeObserver from '@rc-component/resize-observer'; import isVisible from '@rc-component/util/lib/Dom/isVisible'; import { isStyleSupport } from '@rc-component/util/lib/Dom/styleChecker'; import { getTargetScrollBarSize } from '@rc-component/util/lib/getScrollBarSize'; diff --git a/tests/FixedColumn-IE.spec.jsx b/tests/FixedColumn-IE.spec.jsx index 8ba3cacae..2666d1a90 100644 --- a/tests/FixedColumn-IE.spec.jsx +++ b/tests/FixedColumn-IE.spec.jsx @@ -3,7 +3,7 @@ import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import { act } from 'react-dom/test-utils'; // eslint-disable-next-line @typescript-eslint/no-unused-vars -import RcResizeObserver from 'rc-resize-observer'; +import RcResizeObserver from '@rc-component/resize-observer'; import Table from '../src'; vi.mock('@rc-component/util/lib/Dom/styleChecker', () => { diff --git a/tests/FixedColumn.spec.tsx b/tests/FixedColumn.spec.tsx index bde68c79a..93e0c883d 100644 --- a/tests/FixedColumn.spec.tsx +++ b/tests/FixedColumn.spec.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { render } from '@testing-library/react'; -import RcResizeObserver, { _rs } from 'rc-resize-observer'; +import RcResizeObserver, { _rs } from '@rc-component/resize-observer'; import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { act } from 'react-dom/test-utils'; import Table, { type ColumnsType } from '../src'; diff --git a/tests/FixedHeader.spec.jsx b/tests/FixedHeader.spec.jsx index fb564e964..1ccff8a49 100644 --- a/tests/FixedHeader.spec.jsx +++ b/tests/FixedHeader.spec.jsx @@ -1,5 +1,5 @@ import { mount } from 'enzyme'; -import RcResizeObserver from 'rc-resize-observer'; +import RcResizeObserver from '@rc-component/resize-observer'; import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import { act } from 'react-dom/test-utils'; diff --git a/tests/Virtual.spec.tsx b/tests/Virtual.spec.tsx index 921453e77..947a32593 100644 --- a/tests/Virtual.spec.tsx +++ b/tests/Virtual.spec.tsx @@ -1,6 +1,6 @@ import { act, fireEvent, render } from '@testing-library/react'; -import { _rs as onEsResize } from 'rc-resize-observer/es/utils/observerUtil'; -import { _rs as onLibResize } from 'rc-resize-observer/lib/utils/observerUtil'; +import { _rs as onEsResize } from '@rc-component/resize-observer/es/utils/observerUtil'; +import { _rs as onLibResize } from '@rc-component/resize-observer/lib/utils/observerUtil'; import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; diff --git a/tests/setup.ts b/tests/setup.ts index 00aa9c818..d4de21086 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -13,3 +13,18 @@ const Enzyme = require('enzyme'); const Adapter = require('enzyme-adapter-react-16'); Enzyme.configure({ adapter: new Adapter() }); + +// Mock ResizeObserver +global.ResizeObserver = class ResizeObserver implements ResizeObserver { + callback: ResizeObserverCallback; + + constructor(callback: ResizeObserverCallback) { + this.callback = callback; + } + observe(ele) { + // Mock trigger first time + this.callback([{ target: ele }] as any, this); + } + unobserve() {} + disconnect() {} +};