Skip to content

Commit 9ed8385

Browse files
Yuiai01dujiaqizombieJ
authored
fix: delete redundant params (#675)
* fix: delete redundant param * chore: fix type --------- Co-authored-by: dujiaqi <[email protected]> Co-authored-by: 二货机器人 <[email protected]>
1 parent e1e0d09 commit 9ed8385

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

src/Picker.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
359359
},
360360
onFocus,
361361
onBlur: onInternalBlur,
362-
changeOnBlur,
363362
});
364363

365364
// ============================= Sync ==============================

src/interface.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ export type PickerMode = Exclude<PanelMode, 'datetime' | 'decade'>;
4747

4848
export type CellRenderInfo<DateType> = {
4949
// The cell wrapper element
50-
originNode: React.ReactElement,
51-
today: DateType,
50+
originNode: React.ReactElement;
51+
today: DateType;
5252
// mask current cell as start or end when range picker
53-
range?: 'start' | 'end',
54-
type: PanelMode,
55-
locale?: Locale,
56-
subType?: 'hour' | 'minute' | 'second' | 'meridiem'
53+
range?: 'start' | 'end';
54+
type: PanelMode;
55+
locale?: Locale;
56+
subType?: 'hour' | 'minute' | 'second' | 'meridiem';
5757
};
5858

59-
export type CellRender<DateType, CurrentType = DateType> = (current: CurrentType, info: CellRenderInfo<DateType>) => React.ReactNode;
59+
export type CellRender<DateType, CurrentType = DateType | number> = (
60+
current: CurrentType,
61+
info: CellRenderInfo<DateType>,
62+
) => React.ReactNode;
6063

6164
export type PanelRefProps = {
6265
onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => boolean;
@@ -132,6 +135,6 @@ export interface PresetDate<T> {
132135
// https://stackoverflow.com/a/39495173; need TypeScript >= 4.5
133136
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
134137
? Acc[number]
135-
: Enumerate<N, [...Acc, Acc['length']]>
138+
: Enumerate<N, [...Acc, Acc['length']]>;
136139

137-
export type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>
140+
export type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;

src/panels/TimePanel/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as React from 'react';
21
import classNames from 'classnames';
3-
import TimeHeader from './TimeHeader';
4-
import type { BodyOperationRef } from './TimeBody';
5-
import TimeBody from './TimeBody';
6-
import type { PanelSharedProps, DisabledTimes, IntRange } from '../../interface';
2+
import * as React from 'react';
3+
import type { DisabledTimes, IntRange, PanelSharedProps } from '../../interface';
74
import { createKeyDownHandler } from '../../utils/uiUtil';
5+
import type { BodyOperationRef, TimeBodyProps } from './TimeBody';
6+
import TimeBody from './TimeBody';
7+
import TimeHeader from './TimeHeader';
88

99
export type SharedTimeProps<DateType> = {
1010
format?: string;
@@ -33,7 +33,8 @@ export type TimePanelProps<DateType> = {
3333
format?: string;
3434
active?: boolean;
3535
} & PanelSharedProps<DateType> &
36-
SharedTimeProps<DateType>;
36+
SharedTimeProps<DateType> &
37+
Pick<TimeBodyProps<DateType>, 'cellRender'>;
3738

3839
const countBoolean = (boolList: (boolean | undefined)[]) =>
3940
boolList.filter((bool) => bool !== false).length;

tests/disabledTime.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ describe('Picker.DisabledTime', () => {
107107
}
108108
},
109109
disabledSeconds: (_, selectMinute) => {
110-
console.log(selectMinute)
111110
if (selectMinute === 2) {
112111
return [0, 1];
113112
} else {

0 commit comments

Comments
 (0)