Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass getContainer down to popup #6460

Merged
merged 2 commits into from
Nov 30, 2023
Merged
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
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