Skip to content

Commit

Permalink
fix(DatePicker): fix error disabled (#2653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zz-ZzzZ authored and NWYLZW committed Jan 11, 2024
1 parent 297f150 commit 92a75de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/date-picker/hooks/useRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default function useRange(props: TdDateRangePickerProps) {
overlayInnerStyle: props.popupProps?.overlayInnerStyle ?? { width: 'auto' },
overlayClassName: classNames(props.popupProps?.overlayClassName, `${name}__panel-container`),
onVisibleChange: (visible: boolean, context) => {
if (props.disabled) return;
// 这里劫持了进一步向 popup 传递的 onVisibleChange 事件,为了保证可以在 Datepicker 中使用 popupProps.onVisibleChange,故此处理
props.popupProps?.onVisibleChange?.(visible, context);
// 输入框点击不关闭面板
Expand Down
1 change: 1 addition & 0 deletions src/date-picker/hooks/useSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default function useSingleInput(props: TdDatePickerProps) {
overlayInnerStyle: props.popupProps?.overlayInnerStyle ?? { width: 'auto' },
overlayClassName: classNames(props.popupProps?.overlayClassName, `${name}__panel-container`),
onVisibleChange: (visible: boolean, context: any) => {
if (props.disabled) return;
// 这里劫持了进一步向 popup 传递的 onVisibleChange 事件,为了保证可以在 Datepicker 中使用 popupProps.onVisibleChange,故此处理
props.popupProps?.onVisibleChange?.(visible, context);
if (context.trigger === 'trigger-element-mousedown') {
Expand Down

0 comments on commit 92a75de

Please sign in to comment.