devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
62 lines (61 loc) • 2.58 kB
JavaScript
/**
* DevExtreme (esm/__internal/ui/drawer/drawer.rendering.strategy.shrink.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 $ from "../../../core/renderer";
import {
camelize
} from "../../../core/utils/inflector";
import {
animation
} from "../../ui/drawer/drawer.animation";
import DrawerStrategy from "../../ui/drawer/drawer.rendering.strategy";
class ShrinkStrategy extends DrawerStrategy {
_internalRenderPosition(changePositionUsingFxAnimation, whenAnimationCompleted) {
const drawer = this.getDrawerInstance();
const {
opened: isDrawerOpened,
revealMode: revealMode,
animationDuration: animationDuration
} = drawer.option();
const direction = drawer.calcTargetPosition();
const $panel = $(drawer.content());
const panelSize = this._getPanelSize(isDrawerOpened);
const panelOffset = this._getPanelOffset(isDrawerOpened);
if (changePositionUsingFxAnimation) {
if ("slide" === revealMode) {
animation.margin({
complete: () => {
null === whenAnimationCompleted || void 0 === whenAnimationCompleted || whenAnimationCompleted.resolve()
},
$element: $panel,
duration: animationDuration,
direction: direction,
margin: panelOffset
})
} else if ("expand" === revealMode) {
animation.size({
complete: () => {
null === whenAnimationCompleted || void 0 === whenAnimationCompleted || whenAnimationCompleted.resolve()
},
$element: $panel,
duration: animationDuration,
direction: direction,
size: panelSize
})
}
} else if ("slide" === revealMode) {
$panel.css(`margin${camelize(direction,true)}`, panelOffset)
} else if ("expand" === revealMode) {
$panel.css(drawer.isHorizontalDirection() ? "width" : "height", panelSize)
}
}
isViewContentFirst(position, isRtl) {
return (isRtl ? "left" === position : "right" === position) || "bottom" === position
}
}
export default ShrinkStrategy;