Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ render(<Picker />, mountNode);
| popupAlign | Object:alignConfig of [dom-align](https://github.com/yiminghe/dom-align) | | value will be merged into placement's popupAlign config |
| popupStyle | React.CSSProperties | | customize popup style |
| transitionName | String | '' | css class for animation |
| locale | Object | import from '@rc-component/picker/lib/locale/en_US' | @rc-component/picker locale |
| locale | Object | import from '@rc-component/picker/locale/en_US' | @rc-component/picker locale |
| inputReadOnly | boolean | false | set input to read only |
| allowClear | boolean \| { clearIcon?: ReactNode } | false | whether show clear button or customize clear button |
| autoFocus | boolean | false | whether auto focus |
Expand Down Expand Up @@ -82,7 +82,7 @@ render(<Picker />, mountNode);
| prefixCls | String | @rc-component/picker | prefixCls of this component |
| className | String | '' | additional css class of root dom |
| style | React.CSSProperties | | additional style of root dom node |
| locale | Object | import from '@rc-component/picker/lib/locale/en_US' | @rc-component/picker locale |
| locale | Object | import from '@rc-component/picker/locale/en_US' | @rc-component/picker locale |
| value | moment | | current value like input's value |
| defaultValue | moment | | defaultValue like input's defaultValue |
| defaultPickerValue | moment | | Set default display picker view date |
Expand All @@ -107,7 +107,7 @@ render(<Picker />, mountNode);
| prefixCls | String | rc-picker | prefixCls of this component |
| className | String | '' | additional css class of root dom |
| style | React.CSSProperties | | additional style of root dom node |
| locale | Object | import from '@rc-component/picker/lib/locale/en_US' | @rc-component/picker locale |
| locale | Object | import from '@rc-component/picker/locale/en_US' | @rc-component/picker locale |
| value | moment | | current value like input's value |
| defaultValue | moment | | defaultValue like input's defaultValue |
| defaultPickerValue | moment | | Set default display picker view date |
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
"@rc-component/overflow": "^1.0.0",
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/trigger": "^3.6.15",
"@rc-component/util": "^1.3.0",
"@rc-component/util": "^1.11.1",
"clsx": "^2.1.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.3",
"@testing-library/react": "^16.0.0",
"@types/jest": "^29.4.0",
Expand Down
22 changes: 14 additions & 8 deletions src/PickerInput/RangePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { useEvent, useControlledState } from '@rc-component/util';
import {
omit,
pickAttrs,
useControlledState,
useEvent,
useLayoutEffect,
warning,
} from '@rc-component/util';
import { clsx } from 'clsx';
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,
Expand Down Expand Up @@ -56,8 +59,10 @@ export type RangeValueType<DateType> = [
/** Used for change event, it should always be not undefined */
export type NoUndefinedRangeValueType<DateType> = [start: DateType | null, end: DateType | null];

export interface BaseRangePickerProps<DateType extends object>
extends Omit<SharedPickerProps<DateType>, 'showTime' | 'id'> {
export interface BaseRangePickerProps<DateType extends object> extends Omit<
SharedPickerProps<DateType>,
'showTime' | 'id'
> {
// Structure
id?: SelectorIdType;

Expand Down Expand Up @@ -132,7 +137,8 @@ export interface BaseRangePickerProps<DateType extends object>
}

export interface RangePickerProps<DateType extends object>
extends BaseRangePickerProps<DateType>,
extends
BaseRangePickerProps<DateType>,
Omit<RangeTimeProps<DateType>, 'format' | 'defaultValue' | 'defaultOpenValue'> {}

function getActiveRange(activeIndex: number) {
Expand Down
4 changes: 1 addition & 3 deletions src/PickerInput/Selector/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { clsx } from 'clsx';
import { useEvent } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import raf from '@rc-component/util/lib/raf';
import { raf, useEvent, useLayoutEffect } from '@rc-component/util';
import * as React from 'react';
import { leftPad } from '../../utils/miscUtil';
import PickerContext from '../context';
Expand Down
2 changes: 1 addition & 1 deletion src/PickerInput/Selector/hooks/useClearIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';
import type { ReactNode } from 'react';
import * as React from 'react';

Expand Down
3 changes: 1 addition & 2 deletions src/PickerInput/Selector/hooks/useInputProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { warning } from '@rc-component/util';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
import { pickAttrs, warning } from '@rc-component/util';
import * as React from 'react';
import type { SelectorProps } from '../../../interface';
import { formatValue } from '../../../utils/dateUtil';
Expand Down
5 changes: 1 addition & 4 deletions src/PickerInput/SinglePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { useEvent, useControlledState } from '@rc-component/util';
import { omit, pickAttrs, useControlledState, useEvent, useLayoutEffect } from '@rc-component/util';
import { clsx } from 'clsx';
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 {
Expand Down
3 changes: 1 addition & 2 deletions src/PickerInput/hooks/useDelayState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEvent, useControlledState } from '@rc-component/util';
import raf from '@rc-component/util/lib/raf';
import { raf, useControlledState, useEvent } from '@rc-component/util';
import React from 'react';

/**
Expand Down
3 changes: 1 addition & 2 deletions src/PickerInput/hooks/useLockEffect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useLayoutUpdateEffect } from '@rc-component/util/lib/hooks/useLayoutEffect';
import raf from '@rc-component/util/lib/raf';
import { raf, useLayoutUpdateEffect } from '@rc-component/util';
import * as React from 'react';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PickerInput/hooks/usePresets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';
import type { ValueDate } from '../../interface';

export default function usePresets<DateType = any>(
Expand Down
3 changes: 1 addition & 2 deletions src/PickerInput/hooks/useRangePickerValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useControlledState } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import { useControlledState, useLayoutEffect } from '@rc-component/util';
import * as React from 'react';
import type { GenerateConfig } from '../../generate';
import type { InternalMode, Locale, PanelMode } from '../../interface';
Expand Down
2 changes: 1 addition & 1 deletion src/PickerInput/hooks/useRangeValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEvent, useControlledState } from '@rc-component/util';
import { useControlledState, useEvent } from '@rc-component/util';
import * as React from 'react';
import type { GenerateConfig } from '../../generate';
import useSyncState from '../../hooks/useSyncState';
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clsx } from 'clsx';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import { useLayoutEffect } from '@rc-component/util';
import * as React from 'react';
import { usePanelContext } from '../../context';
import useScrollTo from './useScrollTo';
Expand Down
4 changes: 1 addition & 3 deletions src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { useEvent } from '@rc-component/util';
import raf from '@rc-component/util/lib/raf';
import isVisible from '@rc-component/util/lib/Dom/isVisible';
import { isVisible, raf, useEvent } from '@rc-component/util';
import * as React from 'react';

const SPEED_PTG = 1 / 3;
Expand Down
10 changes: 6 additions & 4 deletions src/PickerPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clsx } from 'clsx';
import { useEvent, useControlledState, warning } from '@rc-component/util';
import { useControlledState, useEvent, warning } from '@rc-component/util';
import * as React from 'react';
import useLocale from '../hooks/useLocale';
import { fillShowTimeConfig, getTimeProps } from '../hooks/useTimeConfig';
Expand Down Expand Up @@ -46,7 +46,8 @@ export interface PickerPanelRef {
}

export interface BasePickerPanelProps<DateType extends object = any>
extends Pick<
extends
Pick<
SharedPanelProps<DateType>,
// MISC
| 'locale'
Expand Down Expand Up @@ -119,8 +120,9 @@ export interface BasePickerPanelProps<DateType extends object = any>
hideHeader?: boolean;
}

export interface SinglePickerPanelProps<DateType extends object = any>
extends BasePickerPanelProps<DateType> {
export interface SinglePickerPanelProps<
DateType extends object = any,
> extends BasePickerPanelProps<DateType> {
multiple?: false;

defaultValue?: DateType | null;
Expand Down
3 changes: 1 addition & 2 deletions src/PickerTrigger/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Trigger from '@rc-component/trigger';
import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface';
import Trigger, { type AlignType, type BuildInPlacements } from '@rc-component/trigger';
import { clsx } from 'clsx';
import * as React from 'react';
import { getRealPlacement } from '../utils/uiUtil';
Expand Down
2 changes: 1 addition & 1 deletion src/generate/moment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Moment } from 'moment';
import moment from 'moment';
import { noteOnce } from '@rc-component/util/lib/warning';
import { noteOnce } from '@rc-component/util';
import type { GenerateConfig } from '.';

const generateConfig: GenerateConfig<Moment> = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/warnUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DisabledTimes, PickerMode } from '../interface';
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';

export interface WarningProps extends DisabledTimes {
picker?: PickerMode;
Expand Down
2 changes: 1 addition & 1 deletion tests/disabledTime.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render } from '@testing-library/react';
import type { Dayjs } from 'dayjs';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import {
closePicker,
Expand Down
2 changes: 1 addition & 1 deletion tests/keyboard.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { act, fireEvent, render } from '@testing-library/react';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import { DateFnsSinglePicker, DayPicker, getMoment, isOpen, openPicker } from './util/commonUtil';

Expand Down
2 changes: 1 addition & 1 deletion tests/loop.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import dayjs from 'dayjs';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import zhCN from '../src/locale/zh_CN';
import { DayRangePicker, getMoment } from './util/commonUtil';
Expand Down
2 changes: 1 addition & 1 deletion tests/multiple.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-loop-func */
import { fireEvent, render } from '@testing-library/react';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import { clearValue, DayPicker, getDay, isOpen, openPicker, selectCell } from './util/commonUtil';

Expand Down
3 changes: 1 addition & 2 deletions tests/new-range.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import { act, createEvent, fireEvent, render } from '@testing-library/react';
import dayjs, { type Dayjs } from 'dayjs';
import 'dayjs/locale/ar';
import { spyElementPrototype } from '@rc-component/util/lib/test/domHook';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned, spyElementPrototype } from '@rc-component/util';
import React from 'react';
import type { RangePickerProps } from '../src';
import zh_CN from '../src/locale/zh_CN';
Expand Down
2 changes: 1 addition & 1 deletion tests/panel.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render } from '@testing-library/react';
import dayjs, { type Dayjs } from 'dayjs';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import type { PanelMode } from '../src/interface';
import enUS from '../src/locale/en_US';
Expand Down
4 changes: 1 addition & 3 deletions tests/picker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import moment from 'moment';
import 'moment/locale/zh-cn';
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 { KeyCode, resetWarned, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Picker, { PickerPanel, type PickerRef } from '../src';
import type { PanelMode, PickerMode } from '../src/interface';
Expand Down
4 changes: 1 addition & 3 deletions tests/range.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ 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-component/util/lib/KeyCode';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { resetWarned } from '@rc-component/util/lib/warning';
import { KeyCode, resetWarned, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import type { PickerRef, RangePickerProps } from '../src';
import type { PickerMode } from '../src/interface';
Expand Down
2 changes: 1 addition & 1 deletion tests/time.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fireEvent, render } from '@testing-library/react';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import dayjs from 'dayjs';
import { DayPicker, getDay, openPicker, selectCell } from './util/commonUtil';
Expand Down
Loading