mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 04:58:55 +08:00
18e85a7b81
* chore: init * chore: link picker * chore: move files * chore: update style * chore: update types * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: fix test case * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * chore: clesn up useless types * chore: update types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: fix types * chore: update style * chore: clean up * chore: update types * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * fix: format * chore: update deps * chore: feature merge master (#46794) * fix: Fix typo s/Notificaiton/Notification/ (#46775) * docs: supplement form preserve field description (#46788) close https://github.com/ant-design/ant-design/issues/46773 * docs: tweak changelog drawer width in small screen (#46791) * docs: Update compatible-style.zh-CN.md (#46790) Signed-off-by: afc163 <afc163@gmail.com> --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: hugo-syn <61210734+hugo-syn@users.noreply.github.com> Co-authored-by: Shunze Chen <qianlonwork@outlook.com> Co-authored-by: afc163 <afc163@gmail.com> * chore: update locale size * chore: lock dumi * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * chore: bump version * test: update snapshot * test: update snapshot * chore: bump version * chore: update limit * test: update snapshot * docs: update 7 days sample * chore: rm useless style * chore: clean up style * docs: add buddihist era demo * refactor: interface * chore: add multiple types * docs: add demo * chore: init style * chore: init style * chore: fill style * chore: fill style * chore: style * chore: size of it * chore: size style * docs: add align demo * docs: needConfirm * chore: fix showWeek style * test: update snapshot * chore: fix ts * chore: fix ts * chore: fix ts * chore: fix ts * fix: week style * docs: update dayjs note * fix: style missing * chore: fix footer extra style missing * test: update snapshot * test: update snapshot * test: update snapshot * test: update snapshot * chore: demo update * docs: update demo * docs: min & max date * test: update snapshot * docs: add order * chore: update deps * test: update snapshot * test: update snapshot * chore: adjust style * chore: clean up style * test: update snapshot * chore: fix comment * chore: update align * chore: bump rc-picker * test: update snapshot * test: update snapshot * test: update snapshot --------- Signed-off-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: hugo-syn <61210734+hugo-syn@users.noreply.github.com> Co-authored-by: Shunze Chen <qianlonwork@outlook.com> Co-authored-by: afc163 <afc163@gmail.com> Co-authored-by: lijianan <574980606@qq.com>
95 lines
2.7 KiB
TypeScript
95 lines
2.7 KiB
TypeScript
import * as React from 'react';
|
|
import type { Dayjs } from 'dayjs';
|
|
|
|
import genPurePanel from '../_util/PurePanel';
|
|
import type { InputStatus } from '../_util/statusUtils';
|
|
import type { AnyObject } from '../_util/type';
|
|
import { devUseWarning } from '../_util/warning';
|
|
import DatePicker from '../date-picker';
|
|
import type {
|
|
PickerProps,
|
|
PickerPropsWithMultiple,
|
|
RangePickerProps,
|
|
} from '../date-picker/generatePicker/interface';
|
|
|
|
export type PickerTimeProps<DateType extends AnyObject> = PickerPropsWithMultiple<
|
|
DateType,
|
|
Omit<PickerProps<DateType>, 'picker' | 'showTime'>
|
|
>;
|
|
|
|
export type RangePickerTimeProps<DateType extends AnyObject> = Omit<
|
|
RangePickerProps<DateType>,
|
|
'showTime' | 'picker'
|
|
>;
|
|
|
|
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker;
|
|
|
|
export interface TimePickerLocale {
|
|
placeholder?: string;
|
|
rangePlaceholder?: [string, string];
|
|
}
|
|
|
|
export interface TimeRangePickerProps extends Omit<RangePickerTimeProps<Dayjs>, 'picker'> {
|
|
popupClassName?: string;
|
|
}
|
|
|
|
const RangePicker = React.forwardRef<any, TimeRangePickerProps>((props, ref) => (
|
|
<InternalRangePicker {...props} picker="time" mode={undefined} ref={ref} />
|
|
));
|
|
|
|
export interface TimePickerProps extends Omit<PickerTimeProps<Dayjs>, 'picker'> {
|
|
addon?: () => React.ReactNode;
|
|
status?: InputStatus;
|
|
popupClassName?: string;
|
|
rootClassName?: string;
|
|
}
|
|
|
|
const TimePicker = React.forwardRef<any, TimePickerProps>(
|
|
({ addon, renderExtraFooter, ...restProps }, ref) => {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
const warning = devUseWarning('TimePicker');
|
|
|
|
warning.deprecated(!addon, 'addon', 'renderExtraFooter');
|
|
}
|
|
|
|
const internalRenderExtraFooter = React.useMemo(() => {
|
|
if (renderExtraFooter) {
|
|
return renderExtraFooter;
|
|
}
|
|
|
|
if (addon) {
|
|
return addon;
|
|
}
|
|
return undefined;
|
|
}, [addon, renderExtraFooter]);
|
|
|
|
return (
|
|
<InternalTimePicker
|
|
{...restProps}
|
|
mode={undefined}
|
|
ref={ref}
|
|
renderExtraFooter={internalRenderExtraFooter}
|
|
/>
|
|
);
|
|
},
|
|
);
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
TimePicker.displayName = 'TimePicker';
|
|
}
|
|
|
|
// We don't care debug panel
|
|
/* istanbul ignore next */
|
|
const PurePanel = genPurePanel(TimePicker, 'picker');
|
|
(TimePicker as MergedTimePicker)._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
|
|
|
type MergedTimePicker = typeof TimePicker & {
|
|
RangePicker: typeof RangePicker;
|
|
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
|
};
|
|
|
|
(TimePicker as MergedTimePicker).RangePicker = RangePicker;
|
|
(TimePicker as MergedTimePicker)._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
|
|
|
export default TimePicker as MergedTimePicker;
|