devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
69 lines (68 loc) • 2.74 kB
JavaScript
/**
* DevExtreme (esm/__internal/ui/drawer/drawer.rendering.strategy.push.js)
* Version: 25.2.5
* Build date: Fri Feb 20 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
move
} from "../../../common/core/animation/translator";
import $ from "../../../core/renderer";
import {
animation
} from "../../ui/drawer/drawer.animation";
import DrawerStrategy from "../../ui/drawer/drawer.rendering.strategy";
class PushStrategy extends DrawerStrategy {
_internalRenderPosition(changePositionUsingFxAnimation, whenAnimationCompleted) {
const drawer = this.getDrawerInstance();
const {
opened: isDrawerOpened,
animationDuration: animationDuration
} = drawer.option();
const openedPanelSize = this._getPanelSize(true);
const contentPosition = this._getPanelSize(isDrawerOpened) * drawer._getPositionCorrection();
$(drawer.content()).css(drawer.isHorizontalDirection() ? "width" : "height", openedPanelSize);
if (drawer.getMinSize()) {
let paddingCssPropertyName = "padding";
switch (drawer.calcTargetPosition()) {
case "left":
paddingCssPropertyName += "Right";
break;
case "right":
paddingCssPropertyName += "Left";
break;
case "top":
paddingCssPropertyName += "Bottom";
break;
case "bottom":
paddingCssPropertyName += "Top"
}
$(drawer.viewContent()).css(paddingCssPropertyName, drawer.getMinSize())
}
if (changePositionUsingFxAnimation) {
animation.moveTo({
$element: $(drawer.viewContent()),
position: contentPosition,
direction: drawer.calcTargetPosition(),
duration: animationDuration,
complete: () => {
null === whenAnimationCompleted || void 0 === whenAnimationCompleted || whenAnimationCompleted.resolve()
}
})
} else if (drawer.isHorizontalDirection()) {
move($(drawer.viewContent()), {
left: contentPosition
})
} else {
move($(drawer.viewContent()), {
top: contentPosition
})
}
}
onPanelContentRendered() {
$(this.getDrawerInstance().viewContent()).addClass("dx-theme-background-color")
}
}
export default PushStrategy;