feat: time-picker and tooltip support configProvider.getPopupContainer
parent
06fe9ec935
commit
b2d6577b76
|
@ -83,6 +83,9 @@ const TimePicker = {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
configProvider: { default: {}},
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
const value = this.value || this.defaultValue
|
const value = this.value || this.defaultValue
|
||||||
if (value && !interopDefault(moment).isMoment(value)) {
|
if (value && !interopDefault(moment).isMoment(value)) {
|
||||||
|
@ -147,7 +150,7 @@ const TimePicker = {
|
||||||
</div>
|
</div>
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
const { prefixCls } = props
|
const { prefixCls, getPopupContainer } = props
|
||||||
let suffixIcon = getComponentFromProp(this, 'suffixIcon')
|
let suffixIcon = getComponentFromProp(this, 'suffixIcon')
|
||||||
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon
|
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon
|
||||||
const clockIcon = suffixIcon && (
|
const clockIcon = suffixIcon && (
|
||||||
|
@ -178,10 +181,12 @@ const TimePicker = {
|
||||||
theme='filled'
|
theme='filled'
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
const { getPopupContainer: getContextPopupContainer } = this.configProvider
|
||||||
const timeProps = {
|
const timeProps = {
|
||||||
props: {
|
props: {
|
||||||
...generateShowHourMinuteSecond(format),
|
...generateShowHourMinuteSecond(format),
|
||||||
...props,
|
...props,
|
||||||
|
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
||||||
format,
|
format,
|
||||||
value: this.sValue,
|
value: this.sValue,
|
||||||
placeholder: props.placeholder === undefined ? locale.placeholder : props.placeholder,
|
placeholder: props.placeholder === undefined ? locale.placeholder : props.placeholder,
|
||||||
|
|
|
@ -28,6 +28,9 @@ export default {
|
||||||
prop: 'visible',
|
prop: 'visible',
|
||||||
event: 'visibleChange',
|
event: 'visibleChange',
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
configProvider: { default: {}},
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
sVisible: !!this.$props.visible,
|
sVisible: !!this.$props.visible,
|
||||||
|
@ -139,6 +142,7 @@ export default {
|
||||||
render (h) {
|
render (h) {
|
||||||
const { $props, $data, $slots, $listeners } = this
|
const { $props, $data, $slots, $listeners } = this
|
||||||
const { prefixCls, openClassName, getPopupContainer } = $props
|
const { prefixCls, openClassName, getPopupContainer } = $props
|
||||||
|
const { getPopupContainer: getContextPopupContainer } = this.configProvider
|
||||||
let children = ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')
|
let children = ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')
|
||||||
children = children.length === 1 ? children[0] : children
|
children = children.length === 1 ? children[0] : children
|
||||||
let sVisible = $data.sVisible
|
let sVisible = $data.sVisible
|
||||||
|
@ -156,7 +160,7 @@ export default {
|
||||||
const tooltipProps = {
|
const tooltipProps = {
|
||||||
props: {
|
props: {
|
||||||
...$props,
|
...$props,
|
||||||
getTooltipContainer: getPopupContainer,
|
getTooltipContainer: getPopupContainer || getContextPopupContainer,
|
||||||
builtinPlacements: this.getPlacements(),
|
builtinPlacements: this.getPlacements(),
|
||||||
visible: sVisible,
|
visible: sVisible,
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,6 @@ export default () => ({
|
||||||
prefixCls: PropTypes.string.def('ant-tooltip'),
|
prefixCls: PropTypes.string.def('ant-tooltip'),
|
||||||
mouseEnterDelay: PropTypes.number.def(0.1),
|
mouseEnterDelay: PropTypes.number.def(0.1),
|
||||||
mouseLeaveDelay: PropTypes.number.def(0.1),
|
mouseLeaveDelay: PropTypes.number.def(0.1),
|
||||||
getTooltipContainer: PropTypes.func,
|
|
||||||
getPopupContainer: PropTypes.func,
|
getPopupContainer: PropTypes.func,
|
||||||
arrowPointAtCenter: PropTypes.bool.def(false),
|
arrowPointAtCenter: PropTypes.bool.def(false),
|
||||||
autoAdjustOverflow: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]).def(true),
|
autoAdjustOverflow: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]).def(true),
|
||||||
|
|
Loading…
Reference in New Issue