From 51d00fd33bc912d38556fcb3e169f92975d1a3cd Mon Sep 17 00:00:00 2001 From: Makha Date: Thu, 30 Nov 2023 13:34:19 +0600 Subject: [PATCH] fix: pass getContainer down to popup (#6460) * fix: pass getContainer down to popup * fix: rename getPopupContainer to getContainer --- src/components/calendar-picker/calendar-picker.en.md | 1 + src/components/calendar-picker/calendar-picker.tsx | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/components/calendar-picker/calendar-picker.en.md b/src/components/calendar-picker/calendar-picker.en.md index 9ecb697a2f..db326e76d2 100644 --- a/src/components/calendar-picker/calendar-picker.en.md +++ b/src/components/calendar-picker/calendar-picker.en.md @@ -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` | - | diff --git a/src/components/calendar-picker/calendar-picker.tsx b/src/components/calendar-picker/calendar-picker.tsx index 808e408bdd..314ed1e24e 100644 --- a/src/components/calendar-picker/calendar-picker.tsx +++ b/src/components/calendar-picker/calendar-picker.tsx @@ -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, { @@ -25,6 +26,7 @@ export type CalendarPickerProps = CalendarPickerViewProps & { closeOnMaskClick?: boolean onClose?: () => void onMaskClick?: () => void + getContainer?: GetContainer } & ( | { selectionMode?: undefined @@ -68,6 +70,7 @@ export const CalendarPicker = forwardRef< onClose, onConfirm, onMaskClick, + getContainer, ...calendarViewProps } = props @@ -117,6 +120,7 @@ export const CalendarPicker = forwardRef< onClose?.() } }} + getContainer={getContainer} > {footer}