devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
69 lines (67 loc) • 2.93 kB
JavaScript
/**
* DevExtreme (cjs/__internal/ui/drawer/drawer.rendering.strategy.shrink.js)
* Version: 25.2.7
* Build date: Tue May 05 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _renderer = _interopRequireDefault(require("../../../core/renderer"));
var _inflector = require("../../../core/utils/inflector");
var _drawer = require("../../ui/drawer/drawer.animation");
var _drawerRendering = _interopRequireDefault(require("../../ui/drawer/drawer.rendering.strategy"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
class ShrinkStrategy extends _drawerRendering.default {
_internalRenderPosition(changePositionUsingFxAnimation, whenAnimationCompleted) {
const drawer = this.getDrawerInstance();
const {
opened: isDrawerOpened,
revealMode: revealMode,
animationDuration: animationDuration
} = drawer.option();
const direction = drawer.calcTargetPosition();
const $panel = (0, _renderer.default)(drawer.content());
const panelSize = this._getPanelSize(isDrawerOpened);
const panelOffset = this._getPanelOffset(isDrawerOpened);
if (changePositionUsingFxAnimation) {
if ("slide" === revealMode) {
_drawer.animation.margin({
complete: () => {
null === whenAnimationCompleted || void 0 === whenAnimationCompleted || whenAnimationCompleted.resolve()
},
$element: $panel,
duration: animationDuration,
direction: direction,
margin: panelOffset
})
} else if ("expand" === revealMode) {
_drawer.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${(0,_inflector.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
}
}
var _default = exports.default = ShrinkStrategy;