Skip to content

Commit

Permalink
fix: pass getContainer down to popup (#6460)
Browse files Browse the repository at this point in the history
* fix: pass getContainer down to popup

* fix: rename getPopupContainer to getContainer
  • Loading branch information
madiyetov authored Nov 30, 2023
1 parent 61c9d27 commit 51d00fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/calendar-picker/calendar-picker.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ When the user needs to enter a date, he can select it in the pop-up date panel.
| closeOnMaskClick | Whether to close after clicking the mask layer | `boolean` | `true` |
| onClose | Triggered when closed | `() => void` | - |
| onMaskClick | Triggered when the mask is clicked | `() => void` | - |
| getContainer | To get the specified mounted `HTML` node, the default is `body`, if `null` returned, it would be rendered to the current node | `HTMLElement \| () => HTMLElement \| null` | `() => document.body` | - |
| allowClear | Whether to allow clearing after another click. | `boolean` | `true` |
| defaultValue | The default selected date or date range. | Same as `value` prop. | - |
| max | Maximum value of a selectable range. | `Date` | - |
Expand Down
4 changes: 4 additions & 0 deletions src/components/calendar-picker/calendar-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import classNames from 'classnames'
import Button from '../button'
import Divider from '../divider'
import Popup from '../popup'
import { type GetContainer } from '../../utils/render-to-container'
import { mergeProps } from '../../utils/with-default-props'
import { useConfig } from '../config-provider'
import CalendarPickerView, {
Expand All @@ -25,6 +26,7 @@ export type CalendarPickerProps = CalendarPickerViewProps & {
closeOnMaskClick?: boolean
onClose?: () => void
onMaskClick?: () => void
getContainer?: GetContainer
} & (
| {
selectionMode?: undefined
Expand Down Expand Up @@ -68,6 +70,7 @@ export const CalendarPicker = forwardRef<
onClose,
onConfirm,
onMaskClick,
getContainer,
...calendarViewProps
} = props

Expand Down Expand Up @@ -117,6 +120,7 @@ export const CalendarPicker = forwardRef<
onClose?.()
}
}}
getContainer={getContainer}
>
<CalendarPickerView ref={calendarRef} {...calendarViewProps} />
{footer}
Expand Down

0 comments on commit 51d00fd

Please sign in to comment.