diff --git a/package.json b/package.json index d51432a91..d08a28bc3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rc-picker", + "name": "@rc-component/picker", "version": "4.11.2", "description": "React date & time picker", "keywords": [ @@ -29,7 +29,7 @@ "build": "dumi build", "compile": "father build && lessc assets/index.less assets/index.css", "gh-pages": "npm run build && father doc deploy", - "prepublishOnly": "npm run compile && np --yolo --no-publish", + "prepublishOnly": "npm run compile && rc-np", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "lint:tsc": "tsc -p tsconfig.json --noEmit", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", @@ -39,18 +39,18 @@ "prepare": "npx husky" }, "dependencies": { - "@babel/runtime": "^7.24.7", - "@rc-component/trigger": "^2.0.0", + "@rc-component/resize-observer": "^1.0.0", + "@rc-component/trigger": "^3.0.0", + "@rc-component/util": "^1.2.1", "classnames": "^2.2.1", - "rc-overflow": "^1.3.2", - "rc-resize-observer": "^1.4.0", - "rc-util": "^5.43.0" + "rc-overflow": "^1.3.2" }, "engines": { "node": ">=8.x" }, "devDependencies": { "@rc-component/father-plugin": "^1.0.0", + "@rc-component/np":"^1.0.3", "@testing-library/react": "^16.0.0", "@types/classnames": "^2.2.9", "@types/jest": "^29.4.0", @@ -76,7 +76,6 @@ "mockdate": "^3.0.2", "moment": "^2.24.0", "moment-timezone": "^0.5.45", - "np": "^10.0.2", "prettier": "^3.1.0", "rc-test": "^7.0.9", "react": "^18.2.0", diff --git a/src/PickerInput/Popup/index.tsx b/src/PickerInput/Popup/index.tsx index 37e12f68f..b68fdf2af 100644 --- a/src/PickerInput/Popup/index.tsx +++ b/src/PickerInput/Popup/index.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import ResizeObserver, { type ResizeObserverProps } from 'rc-resize-observer'; +import ResizeObserver, { type ResizeObserverProps } from '@rc-component/resize-observer'; import * as React from 'react'; import type { RangeTimeProps, diff --git a/src/PickerInput/RangePicker.tsx b/src/PickerInput/RangePicker.tsx index 81800fa08..ab48627d2 100644 --- a/src/PickerInput/RangePicker.tsx +++ b/src/PickerInput/RangePicker.tsx @@ -1,8 +1,8 @@ -import { useEvent, useMergedState } from 'rc-util'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import omit from 'rc-util/lib/omit'; -import pickAttrs from 'rc-util/lib/pickAttrs'; -import warning from 'rc-util/lib/warning'; +import { useEvent, useMergedState } from '@rc-component/util'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import omit from '@rc-component/util/lib/omit'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; +import warning from '@rc-component/util/lib/warning'; import * as React from 'react'; import type { BaseInfo, diff --git a/src/PickerInput/Selector/Input.tsx b/src/PickerInput/Selector/Input.tsx index 9bf9d7edb..908dedd7a 100644 --- a/src/PickerInput/Selector/Input.tsx +++ b/src/PickerInput/Selector/Input.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; -import { useEvent } from 'rc-util'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import raf from 'rc-util/lib/raf'; +import { useEvent } from '@rc-component/util'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import raf from '@rc-component/util/lib/raf'; import * as React from 'react'; import { leftPad } from '../../utils/miscUtil'; import PickerContext from '../context'; diff --git a/src/PickerInput/Selector/RangeSelector.tsx b/src/PickerInput/Selector/RangeSelector.tsx index 36328733d..30624127c 100644 --- a/src/PickerInput/Selector/RangeSelector.tsx +++ b/src/PickerInput/Selector/RangeSelector.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; -import ResizeObserver from 'rc-resize-observer'; -import { useEvent } from 'rc-util'; +import ResizeObserver from '@rc-component/resize-observer'; +import { useEvent } from '@rc-component/util'; import * as React from 'react'; import type { RangePickerRef, SelectorProps } from '../../interface'; import PickerContext from '../context'; diff --git a/src/PickerInput/Selector/hooks/useClearIcon.tsx b/src/PickerInput/Selector/hooks/useClearIcon.tsx index 02d12399d..83335c647 100644 --- a/src/PickerInput/Selector/hooks/useClearIcon.tsx +++ b/src/PickerInput/Selector/hooks/useClearIcon.tsx @@ -1,4 +1,4 @@ -import warning from 'rc-util/lib/warning'; +import warning from '@rc-component/util/lib/warning'; import type { ReactNode } from 'react'; import * as React from 'react'; @@ -22,4 +22,3 @@ export function fillClearIcon( return config.clearIcon || clearIcon || ; } - diff --git a/src/PickerInput/Selector/hooks/useInputProps.ts b/src/PickerInput/Selector/hooks/useInputProps.ts index fa7a1c907..bfc4e0004 100644 --- a/src/PickerInput/Selector/hooks/useInputProps.ts +++ b/src/PickerInput/Selector/hooks/useInputProps.ts @@ -1,5 +1,5 @@ -import { warning } from 'rc-util'; -import pickAttrs from 'rc-util/lib/pickAttrs'; +import { warning } from '@rc-component/util'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import * as React from 'react'; import type { SelectorProps } from '../../../interface'; import { formatValue } from '../../../utils/dateUtil'; @@ -86,12 +86,7 @@ export default function useInputProps( const firstFormat = format[0]; const getText = React.useCallback( - (date: DateType) => - formatValue(date, { - locale, - format: firstFormat, - generateConfig, - }), + (date: DateType) => formatValue(date, { locale, format: firstFormat, generateConfig }), [locale, generateConfig, firstFormat], ); @@ -131,10 +126,7 @@ export default function useInputProps( return index !== undefined ? propValue[index] : propValue; } - const pickedAttrs = pickAttrs(props, { - aria: true, - data: true, - }); + const pickedAttrs = pickAttrs(props, { aria: true, data: true }); const inputProps = { ...pickedAttrs, @@ -198,9 +190,7 @@ export default function useInputProps( onInvalid(!!text, index); }, onHelp: () => { - onOpenChange(true, { - index, - }); + onOpenChange(true, { index }); }, onKeyDown: (event: React.KeyboardEvent) => { let prevented = false; @@ -218,9 +208,7 @@ export default function useInputProps( if (!event.defaultPrevented && !prevented) { switch (event.key) { case 'Escape': - onOpenChange(false, { - index, - }); + onOpenChange(false, { index }); break; case 'Enter': if (!open) { @@ -232,9 +220,7 @@ export default function useInputProps( }, // ============ Post Props ============ - ...postProps?.({ - valueTexts, - }), + ...postProps?.({ valueTexts }), }; // ============== Clean Up ============== diff --git a/src/PickerInput/SinglePicker.tsx b/src/PickerInput/SinglePicker.tsx index 552c29e7d..aeb588135 100644 --- a/src/PickerInput/SinglePicker.tsx +++ b/src/PickerInput/SinglePicker.tsx @@ -1,7 +1,7 @@ -import { useEvent, useMergedState } from 'rc-util'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import omit from 'rc-util/lib/omit'; -import pickAttrs from 'rc-util/lib/pickAttrs'; +import { useEvent, useMergedState } from '@rc-component/util'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import omit from '@rc-component/util/lib/omit'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import * as React from 'react'; import useToggleDates from '../hooks/useToggleDates'; import type { diff --git a/src/PickerInput/hooks/useCellRender.ts b/src/PickerInput/hooks/useCellRender.ts index ce8a22fd0..e374cc8e8 100644 --- a/src/PickerInput/hooks/useCellRender.ts +++ b/src/PickerInput/hooks/useCellRender.ts @@ -1,4 +1,4 @@ -import { warning } from 'rc-util'; +import { warning } from '@rc-component/util'; import * as React from 'react'; import type { CellRender, CellRenderInfo, SharedPickerProps } from '../../interface'; @@ -36,11 +36,7 @@ export default function useCellRender( // Cell render const onInternalCellRender: CellRender = React.useCallback( - (date, info) => - mergedCellRender(date, { - ...info, - range, - }), + (date, info) => mergedCellRender(date, { ...info, range }), [mergedCellRender, range], ); diff --git a/src/PickerInput/hooks/useDelayState.ts b/src/PickerInput/hooks/useDelayState.ts index d64f19639..6be0c127d 100644 --- a/src/PickerInput/hooks/useDelayState.ts +++ b/src/PickerInput/hooks/useDelayState.ts @@ -1,5 +1,5 @@ -import { useEvent, useMergedState } from 'rc-util'; -import raf from 'rc-util/lib/raf'; +import { useEvent, useMergedState } from '@rc-component/util'; +import raf from '@rc-component/util/lib/raf'; import React from 'react'; /** @@ -11,9 +11,7 @@ export default function useDelayState( defaultValue?: T, onChange?: (next: T) => void, ): [state: T, setState: (nextState: T, immediately?: boolean) => void] { - const [state, setState] = useMergedState(defaultValue, { - value, - }); + const [state, setState] = useMergedState(defaultValue, { value }); const nextValueRef = React.useRef(value); diff --git a/src/PickerInput/hooks/useDisabledBoundary.ts b/src/PickerInput/hooks/useDisabledBoundary.ts index 7f00f37c0..05609f9b2 100644 --- a/src/PickerInput/hooks/useDisabledBoundary.ts +++ b/src/PickerInput/hooks/useDisabledBoundary.ts @@ -1,4 +1,4 @@ -import { useEvent } from 'rc-util'; +import { useEvent } from '@rc-component/util'; import type { GenerateConfig } from '../../generate'; import { isSame } from '../../utils/dateUtil'; import type { DisabledDate, InternalMode, Locale } from '../../interface'; diff --git a/src/PickerInput/hooks/useFilledProps.ts b/src/PickerInput/hooks/useFilledProps.ts index 5b562f61c..26178c967 100644 --- a/src/PickerInput/hooks/useFilledProps.ts +++ b/src/PickerInput/hooks/useFilledProps.ts @@ -1,4 +1,4 @@ -import { warning } from 'rc-util'; +import { warning } from '@rc-component/util'; import * as React from 'react'; import useLocale from '../../hooks/useLocale'; import { fillShowTimeConfig, getTimeProps } from '../../hooks/useTimeConfig'; @@ -167,10 +167,7 @@ export default function useFilledProps< styles, classNames, order, - components: { - input: inputRender, - ...components, - }, + components: { input: inputRender, ...components }, clearIcon: fillClearIcon(prefixCls, allowClear, clearIcon), showTime: mergedShowTime, value: values, diff --git a/src/PickerInput/hooks/useInvalidate.ts b/src/PickerInput/hooks/useInvalidate.ts index 03de1bc68..df907bb6a 100644 --- a/src/PickerInput/hooks/useInvalidate.ts +++ b/src/PickerInput/hooks/useInvalidate.ts @@ -1,4 +1,4 @@ -import { useEvent } from 'rc-util'; +import { useEvent } from '@rc-component/util'; import type { GenerateConfig } from '../../generate'; import type { PanelMode, @@ -19,10 +19,7 @@ export default function useInvalidate( // Check disabled date const isInvalidate = useEvent( (date: DateType, info?: { from?: DateType; activeIndex: number }) => { - const outsideInfo = { - type: picker, - ...info, - }; + const outsideInfo = { type: picker, ...info }; delete outsideInfo.activeIndex; if ( @@ -37,9 +34,7 @@ export default function useInvalidate( if ((picker === 'date' || picker === 'time') && showTime) { const range = info && info.activeIndex === 1 ? 'end' : 'start'; const { disabledHours, disabledMinutes, disabledSeconds, disabledMilliseconds } = - showTime.disabledTime?.(date, range, { - from: outsideInfo.from, - }) || {}; + showTime.disabledTime?.(date, range, { from: outsideInfo.from }) || {}; const { disabledHours: legacyDisabledHours, diff --git a/src/PickerInput/hooks/useLockEffect.ts b/src/PickerInput/hooks/useLockEffect.ts index 62b487ae2..135b73c4d 100644 --- a/src/PickerInput/hooks/useLockEffect.ts +++ b/src/PickerInput/hooks/useLockEffect.ts @@ -1,5 +1,5 @@ -import { useLayoutUpdateEffect } from 'rc-util/lib/hooks/useLayoutEffect'; -import raf from 'rc-util/lib/raf'; +import { useLayoutUpdateEffect } from '@rc-component/util/lib/hooks/useLayoutEffect'; +import raf from '@rc-component/util/lib/raf'; import * as React from 'react'; /** diff --git a/src/PickerInput/hooks/usePresets.ts b/src/PickerInput/hooks/usePresets.ts index 3b95577d0..19debcd7c 100644 --- a/src/PickerInput/hooks/usePresets.ts +++ b/src/PickerInput/hooks/usePresets.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import warning from 'rc-util/lib/warning'; +import warning from '@rc-component/util/lib/warning'; import type { ValueDate } from '../../interface'; export default function usePresets( @@ -14,10 +14,7 @@ export default function usePresets( if (legacyRanges) { warning(false, '`ranges` is deprecated. Please use `presets` instead.'); - return Object.entries(legacyRanges).map(([label, value]) => ({ - label, - value, - })); + return Object.entries(legacyRanges).map(([label, value]) => ({ label, value })); } return []; diff --git a/src/PickerInput/hooks/useRangePickerValue.ts b/src/PickerInput/hooks/useRangePickerValue.ts index 2590a3355..f5181f402 100644 --- a/src/PickerInput/hooks/useRangePickerValue.ts +++ b/src/PickerInput/hooks/useRangePickerValue.ts @@ -1,5 +1,5 @@ -import { useMergedState } from 'rc-util'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import { useMergedState } from '@rc-component/util'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import * as React from 'react'; import type { GenerateConfig } from '../../generate'; import type { InternalMode, Locale, PanelMode } from '../../interface'; @@ -74,9 +74,7 @@ export default function useRangePickerValue getDefaultPickerValue(0), - { - value: startPickerValue, - }, + { value: startPickerValue }, ); const [mergedEndPickerValue, setEndPickerValue] = useMergedState(() => getDefaultPickerValue(1), { diff --git a/src/PickerInput/hooks/useRangeValue.ts b/src/PickerInput/hooks/useRangeValue.ts index 880a0aee6..89b139d84 100644 --- a/src/PickerInput/hooks/useRangeValue.ts +++ b/src/PickerInput/hooks/useRangeValue.ts @@ -1,4 +1,4 @@ -import { useEvent, useMergedState } from 'rc-util'; +import { useEvent, useMergedState } from '@rc-component/util'; import * as React from 'react'; import type { GenerateConfig } from '../../generate'; import useSyncState from '../../hooks/useSyncState'; @@ -117,9 +117,7 @@ export function useInnerValue void, ) { // This is the root value which will sync with controlled or uncontrolled value - const [innerValue, setInnerValue] = useMergedState(defaultValue, { - value, - }); + const [innerValue, setInnerValue] = useMergedState(defaultValue, { value }); const mergedValue = innerValue || (EMPTY_VALUE as ValueType); // ========================= Inner Values ========================= @@ -148,9 +146,7 @@ export function useInnerValue = { diff --git a/src/hooks/useTimeInfo.ts b/src/hooks/useTimeInfo.ts index 193d2bdaf..61a2846ef 100644 --- a/src/hooks/useTimeInfo.ts +++ b/src/hooks/useTimeInfo.ts @@ -1,4 +1,4 @@ -import { warning } from 'rc-util'; +import { warning } from '@rc-component/util'; import * as React from 'react'; import type { GenerateConfig } from '../generate'; import type { DisabledTimes, SharedTimeProps } from '../interface'; diff --git a/src/utils/warnUtil.ts b/src/utils/warnUtil.ts index 6e169a121..4cc06beab 100644 --- a/src/utils/warnUtil.ts +++ b/src/utils/warnUtil.ts @@ -1,5 +1,5 @@ import type { DisabledTimes, PickerMode } from '../interface'; -import warning from 'rc-util/lib/warning'; +import warning from '@rc-component/util/lib/warning'; export interface WarningProps extends DisabledTimes { picker?: PickerMode; diff --git a/tests/disabledTime.spec.tsx b/tests/disabledTime.spec.tsx index 43ba41dc3..b7ff950db 100644 --- a/tests/disabledTime.spec.tsx +++ b/tests/disabledTime.spec.tsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; import type { Dayjs } from 'dayjs'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import { closePicker, diff --git a/tests/keyboard.spec.tsx b/tests/keyboard.spec.tsx index f073bdcad..e8cb25c98 100644 --- a/tests/keyboard.spec.tsx +++ b/tests/keyboard.spec.tsx @@ -1,5 +1,5 @@ import { act, fireEvent, render } from '@testing-library/react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import { DateFnsSinglePicker, DayPicker, getMoment, isOpen, openPicker } from './util/commonUtil'; diff --git a/tests/loop.spec.tsx b/tests/loop.spec.tsx index 88d2ca0ec..585c268a1 100644 --- a/tests/loop.spec.tsx +++ b/tests/loop.spec.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; import dayjs from 'dayjs'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import zhCN from '../src/locale/zh_CN'; import { DayRangePicker, getMoment } from './util/commonUtil'; diff --git a/tests/multiple.spec.tsx b/tests/multiple.spec.tsx index f12facf80..67fa69df4 100644 --- a/tests/multiple.spec.tsx +++ b/tests/multiple.spec.tsx @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-loop-func */ import { fireEvent, render } from '@testing-library/react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import { DayPicker, getDay, isOpen, openPicker, selectCell } from './util/commonUtil'; diff --git a/tests/new-range.spec.tsx b/tests/new-range.spec.tsx index 3d92fee62..ff9c2f83a 100644 --- a/tests/new-range.spec.tsx +++ b/tests/new-range.spec.tsx @@ -2,8 +2,8 @@ import { act, fireEvent, render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; import 'dayjs/locale/ar'; -import { spyElementPrototype } from 'rc-util/lib/test/domHook'; -import { resetWarned } from 'rc-util/lib/warning'; +import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import type { RangePickerProps } from '../src'; import zh_CN from '../src/locale/zh_CN'; @@ -20,7 +20,7 @@ import { waitFakeTimer, } from './util/commonUtil'; -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { return () => true; }); diff --git a/tests/panel.spec.tsx b/tests/panel.spec.tsx index 39131afab..9762613c5 100644 --- a/tests/panel.spec.tsx +++ b/tests/panel.spec.tsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import type { PanelMode } from '../src/interface'; import enUS from '../src/locale/en_US'; diff --git a/tests/picker.spec.tsx b/tests/picker.spec.tsx index be3853ae6..5cd6f54af 100644 --- a/tests/picker.spec.tsx +++ b/tests/picker.spec.tsx @@ -4,9 +4,9 @@ import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; import moment from 'moment'; import 'moment/locale/zh-cn'; -import KeyCode from 'rc-util/lib/KeyCode'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; -import { resetWarned } from 'rc-util/lib/warning'; +import KeyCode from '@rc-component/util/lib/KeyCode'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import type { PickerRef } from '../src'; import type { PanelMode, PickerMode } from '../src/interface'; @@ -30,7 +30,7 @@ import { const fakeTime = getDay('1990-09-03 00:00:00').valueOf(); -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { return () => true; }); diff --git a/tests/range.spec.tsx b/tests/range.spec.tsx index 409fcc914..e584b75fc 100644 --- a/tests/range.spec.tsx +++ b/tests/range.spec.tsx @@ -4,13 +4,13 @@ import { act, createEvent, fireEvent, render } from '@testing-library/react'; import { createRoot } from 'react-dom/client'; import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; -import KeyCode from 'rc-util/lib/KeyCode'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; -import { resetWarned } from 'rc-util/lib/warning'; +import KeyCode from '@rc-component/util/lib/KeyCode'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import type { PickerRef, RangePickerProps } from '../src'; import type { PickerMode } from '../src/interface'; -import { _rs } from 'rc-resize-observer'; +import { _rs } from '@rc-component/resize-observer'; const triggerResize = (target: Element) => { act(() => { diff --git a/tests/setup.js b/tests/setup.js deleted file mode 100644 index f2601cd4d..000000000 --- a/tests/setup.js +++ /dev/null @@ -1,85 +0,0 @@ -// global.requestAnimationFrame = callback => { -// global.setTimeout(callback, 0); -// }; - -// global.cancelAnimationFrame = id => { -// global.clearTimeout(id); -// }; - -// const Enzyme = require('enzyme'); -// const Adapter = require('@wojtekmaj/enzyme-adapter-react-17'); - -// Enzyme.configure({ adapter: new Adapter() }); - -// Object.assign(Enzyme.ReactWrapper.prototype, { -// openPicker(index = 0) { -// this.find('input') -// .at(index) -// .simulate('mousedown') -// .simulate('focus'); -// }, -// closePicker(index = 0) { -// this.find('input') -// .at(index) -// .simulate('blur'); -// }, -// confirmOK() { -// this.find('.rc-picker-ok > *').simulate('click'); -// }, -// isOpen() { -// const openDiv = this.find('.rc-picker-dropdown').hostNodes(); -// return openDiv && openDiv.length && !openDiv.hasClass('rc-picker-dropdown-hidden'); -// }, -// findCell(text, index = 0) { -// let matchCell; - -// const table = this.find('table').at(index); - -// table.find('td').forEach(td => { -// if (td.text() === String(text) && td.props().className.includes('-in-view')) { -// matchCell = td; -// } -// }); -// if (!matchCell) { -// throw new Error('Cell not match in picker panel.'); -// } - -// return matchCell; -// }, -// selectCell(text, index = 0) { -// const td = this.findCell(text, index); -// td.simulate('click'); - -// return td; -// }, -// clickButton(type) { -// let matchBtn; -// this.find('button').forEach(btn => { -// if (btn.props().className.includes(`-header-${type}-btn`)) { -// matchBtn = btn; -// } -// }); - -// matchBtn.simulate('click'); - -// return matchBtn; -// }, -// clearValue() { -// this.find('.rc-picker-clear-btn').simulate('mouseDown'); -// this.find('.rc-picker-clear-btn').simulate('mouseUp'); -// }, -// keyDown(which, info = {}, index = 0) { -// let component = this.find('input'); - -// if (component.length === 0) { -// component = this.find('.rc-picker-panel'); -// } - -// component.at(index).simulate('keydown', { ...info, which }); -// }, -// inputValue(text, index = 0) { -// this.find('input') -// .at(index) -// .simulate('change', { target: { value: text } }); -// }, -// }); diff --git a/tests/time.spec.tsx b/tests/time.spec.tsx index 66652af71..e19837d0d 100644 --- a/tests/time.spec.tsx +++ b/tests/time.spec.tsx @@ -1,5 +1,5 @@ import { fireEvent, render } from '@testing-library/react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import { DayPicker, getDay, openPicker, selectCell, findCell } from './util/commonUtil'; diff --git a/tsconfig.json b/tsconfig.json index 06c770c29..f8266a862 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "paths": { "@/*": ["src/*"], "@@/*": [".dumi/tmp/*"], - "rc-picker": ["src/index.tsx"] + "@rc-component/picker": ["src/index.tsx"] } }, "include": [