mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
Merge branch 'develop' of ***REMOVED*** into develop
This commit is contained in:
commit
3a35c4eaff
@ -4,7 +4,7 @@
|
||||
<div
|
||||
v-if="showLightBar"
|
||||
class="n-base-select-menu-light-bar"
|
||||
:style="{ top: `${lightBarTop}px` }"
|
||||
:style="{ top: lightBarStyleTop }"
|
||||
/>
|
||||
</transition>
|
||||
</div>
|
||||
|
@ -55,7 +55,6 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
if (this.detached) {
|
||||
this.detachTarget = document.body // getScrollParent(this.$refs.self)
|
||||
this.detachContent()
|
||||
if (this.active && !this.contentContainerMounted) {
|
||||
this.contentContainerMounted = true
|
||||
|
@ -205,6 +205,7 @@ export default {
|
||||
updatePosition (el, cb) {
|
||||
if (!this.active && !this.show) return
|
||||
this._getTrackingElement()
|
||||
this.trackingElement.style.position = 'absolute'
|
||||
if (this.manuallyPositioned) {
|
||||
if (!this.trackingElement) {
|
||||
console.error('[naive-ui/placeable/updatePosition]: trackingElement not found!')
|
||||
@ -218,6 +219,10 @@ export default {
|
||||
}
|
||||
}
|
||||
const activatorRect = getActivatorRect(this.manuallyPositioned, this.x, this.y, this.trackedElement)
|
||||
const contentInner = getContentInner(this)
|
||||
if (this.widthMode === 'activator' && contentInner) {
|
||||
contentInner.style.minWidth = activatorRect.width + 'px'
|
||||
}
|
||||
const contentBoundingClientRect = {
|
||||
width: this.trackingElement.offsetWidth,
|
||||
height: this.trackingElement.offsetHeight
|
||||
@ -230,10 +235,6 @@ export default {
|
||||
offset = getPositionInAbsoluteMode(adjustedPlacement)
|
||||
}
|
||||
this.setOffsetOfTrackingElement(offset, suggestedTransformOrigin)
|
||||
const contentInner = getContentInner(this)
|
||||
if (this.widthMode === 'activator' && contentInner) {
|
||||
contentInner.style.minWidth = activatorRect.width + 'px'
|
||||
}
|
||||
if (el && cb) {
|
||||
cb(el, activatorRect, contentBoundingClientRect)
|
||||
}
|
||||
|
@ -57,8 +57,14 @@ export function getAdjustedPlacementOfTrackingElement (placement = 'bottom-start
|
||||
let adjustedPosition = position
|
||||
if (position) {
|
||||
const adjacentPositionDirection = positionDirections[placement]
|
||||
if (trackedRect[adjacentPositionDirection] + trackedRect[lengthToCompare[adjacentPositionDirection]] <= trackingRect[lengthToCompare[adjacentPositionDirection]]) {
|
||||
adjustedPosition = oppositePosition[position]
|
||||
if (trackingRect[lengthToCompare[adjacentPositionDirection]] > trackedRect[lengthToCompare[adjacentPositionDirection]]) {
|
||||
if (trackedRect[adjacentPositionDirection] + trackedRect[lengthToCompare[adjacentPositionDirection]] <= trackingRect[lengthToCompare[adjacentPositionDirection]]) {
|
||||
adjustedPosition = oppositePosition[position]
|
||||
}
|
||||
} else if (trackingRect[lengthToCompare[adjacentPositionDirection]] < trackedRect[lengthToCompare[adjacentPositionDirection]]) {
|
||||
if (trackedRect[oppositeDirection[adjacentPositionDirection]] < 0 && trackedRect[adjacentPositionDirection] > 0) {
|
||||
adjustedPosition = oppositePosition[position]
|
||||
}
|
||||
}
|
||||
}
|
||||
if (trackedRect[direction] >= trackingRect[lengthToCompare[direction]]) {
|
||||
|
Loading…
Reference in New Issue
Block a user