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
|
<div
|
||||||
v-if="showLightBar"
|
v-if="showLightBar"
|
||||||
class="n-base-select-menu-light-bar"
|
class="n-base-select-menu-light-bar"
|
||||||
:style="{ top: `${lightBarTop}px` }"
|
:style="{ top: lightBarStyleTop }"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +55,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
if (this.detached) {
|
if (this.detached) {
|
||||||
this.detachTarget = document.body // getScrollParent(this.$refs.self)
|
|
||||||
this.detachContent()
|
this.detachContent()
|
||||||
if (this.active && !this.contentContainerMounted) {
|
if (this.active && !this.contentContainerMounted) {
|
||||||
this.contentContainerMounted = true
|
this.contentContainerMounted = true
|
||||||
|
@ -205,6 +205,7 @@ export default {
|
|||||||
updatePosition (el, cb) {
|
updatePosition (el, cb) {
|
||||||
if (!this.active && !this.show) return
|
if (!this.active && !this.show) return
|
||||||
this._getTrackingElement()
|
this._getTrackingElement()
|
||||||
|
this.trackingElement.style.position = 'absolute'
|
||||||
if (this.manuallyPositioned) {
|
if (this.manuallyPositioned) {
|
||||||
if (!this.trackingElement) {
|
if (!this.trackingElement) {
|
||||||
console.error('[naive-ui/placeable/updatePosition]: trackingElement not found!')
|
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 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 = {
|
const contentBoundingClientRect = {
|
||||||
width: this.trackingElement.offsetWidth,
|
width: this.trackingElement.offsetWidth,
|
||||||
height: this.trackingElement.offsetHeight
|
height: this.trackingElement.offsetHeight
|
||||||
@ -230,10 +235,6 @@ export default {
|
|||||||
offset = getPositionInAbsoluteMode(adjustedPlacement)
|
offset = getPositionInAbsoluteMode(adjustedPlacement)
|
||||||
}
|
}
|
||||||
this.setOffsetOfTrackingElement(offset, suggestedTransformOrigin)
|
this.setOffsetOfTrackingElement(offset, suggestedTransformOrigin)
|
||||||
const contentInner = getContentInner(this)
|
|
||||||
if (this.widthMode === 'activator' && contentInner) {
|
|
||||||
contentInner.style.minWidth = activatorRect.width + 'px'
|
|
||||||
}
|
|
||||||
if (el && cb) {
|
if (el && cb) {
|
||||||
cb(el, activatorRect, contentBoundingClientRect)
|
cb(el, activatorRect, contentBoundingClientRect)
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,14 @@ export function getAdjustedPlacementOfTrackingElement (placement = 'bottom-start
|
|||||||
let adjustedPosition = position
|
let adjustedPosition = position
|
||||||
if (position) {
|
if (position) {
|
||||||
const adjacentPositionDirection = positionDirections[placement]
|
const adjacentPositionDirection = positionDirections[placement]
|
||||||
if (trackedRect[adjacentPositionDirection] + trackedRect[lengthToCompare[adjacentPositionDirection]] <= trackingRect[lengthToCompare[adjacentPositionDirection]]) {
|
if (trackingRect[lengthToCompare[adjacentPositionDirection]] > trackedRect[lengthToCompare[adjacentPositionDirection]]) {
|
||||||
adjustedPosition = oppositePosition[position]
|
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]]) {
|
if (trackedRect[direction] >= trackingRect[lengthToCompare[direction]]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user