feat: time-picker and tooltip support configProvider.getPopupContainer
parent
06fe9ec935
commit
b2d6577b76
|
@ -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 = {
|
|||
</div>
|
||||
) : 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,
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue