diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 336f55959..93b8973c0 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -83,6 +83,9 @@ const TimePicker = { prop: 'value', event: 'change', }, + inject: { + configProvider: { default: {}}, + }, data () { const value = this.value || this.defaultValue if (value && !interopDefault(moment).isMoment(value)) { @@ -147,7 +150,7 @@ const TimePicker = { ) : null } - const { prefixCls } = props + const { prefixCls, getPopupContainer } = props let suffixIcon = getComponentFromProp(this, 'suffixIcon') suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon const clockIcon = suffixIcon && ( @@ -178,10 +181,12 @@ const TimePicker = { theme='filled' /> ) + const { getPopupContainer: getContextPopupContainer } = this.configProvider const timeProps = { props: { ...generateShowHourMinuteSecond(format), ...props, + getPopupContainer: getPopupContainer || getContextPopupContainer, format, value: this.sValue, placeholder: props.placeholder === undefined ? locale.placeholder : props.placeholder, diff --git a/components/tooltip/Tooltip.jsx b/components/tooltip/Tooltip.jsx index b9a3f2b40..ebc73829e 100644 --- a/components/tooltip/Tooltip.jsx +++ b/components/tooltip/Tooltip.jsx @@ -28,6 +28,9 @@ export default { prop: 'visible', event: 'visibleChange', }, + inject: { + configProvider: { default: {}}, + }, data () { return { sVisible: !!this.$props.visible, @@ -139,6 +142,7 @@ export default { render (h) { const { $props, $data, $slots, $listeners } = this const { prefixCls, openClassName, getPopupContainer } = $props + const { getPopupContainer: getContextPopupContainer } = this.configProvider let children = ($slots.default || []).filter(c => c.tag || c.text.trim() !== '') children = children.length === 1 ? children[0] : children let sVisible = $data.sVisible @@ -156,7 +160,7 @@ export default { const tooltipProps = { props: { ...$props, - getTooltipContainer: getPopupContainer, + getTooltipContainer: getPopupContainer || getContextPopupContainer, builtinPlacements: this.getPlacements(), visible: sVisible, }, diff --git a/components/tooltip/abstractTooltipProps.js b/components/tooltip/abstractTooltipProps.js index 1d74dd960..82858c31e 100644 --- a/components/tooltip/abstractTooltipProps.js +++ b/components/tooltip/abstractTooltipProps.js @@ -14,7 +14,6 @@ export default () => ({ prefixCls: PropTypes.string.def('ant-tooltip'), mouseEnterDelay: PropTypes.number.def(0.1), mouseLeaveDelay: PropTypes.number.def(0.1), - getTooltipContainer: PropTypes.func, getPopupContainer: PropTypes.func, arrowPointAtCenter: PropTypes.bool.def(false), autoAdjustOverflow: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]).def(true),