devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
108 lines (107 loc) • 3.28 kB
JavaScript
/**
* DevExtreme (cjs/__internal/ui/drawer/drawer.animation.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/
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.animation = void 0;
var _animation = require("../../../common/core/animation");
var _inflector = require("../../../core/utils/inflector");
const animation = exports.animation = {
getMoveToConfig(direction, position) {
switch (direction) {
case "right":
return {
transform: `translate(${position}px, 0px)`
};
case "left":
return {
left: position
};
case "top":
case "bottom":
return {
top: position
};
default:
return
}
},
moveTo(config) {
const {
$element: $element,
position: position,
direction: direction = "left",
duration: duration,
complete: complete
} = config;
const toConfig = this.getMoveToConfig(direction, position);
const animationType = "right" === direction ? "custom" : "slide";
_animation.fx.animate($element.get(0), {
type: animationType,
to: toConfig,
duration: duration,
complete: complete
})
},
margin(config) {
const {
$element: $element,
margin: margin,
direction: direction = "left",
duration: duration,
complete: complete
} = config;
const marginName = `margin${(0,_inflector.camelize)(direction,true)}`;
const toConfig = {
[marginName]: margin
};
_animation.fx.animate($element.get(0), {
to: toConfig,
duration: duration,
complete: complete
})
},
fade($element, config, duration, completeAction) {
_animation.fx.animate($element.get(0), {
type: "fade",
to: config.to,
from: config.from,
duration: duration,
complete: completeAction
})
},
size(config) {
const {
$element: $element,
size: size,
direction: direction = "left",
marginTop: marginTop = 0,
duration: duration,
complete: complete
} = config;
const toConfig = {};
if ("right" === direction || "left" === direction) {
toConfig.width = size
} else {
toConfig.height = size
}
if ("bottom" === direction) {
toConfig.marginTop = marginTop
}
_animation.fx.animate($element.get(0), {
to: toConfig,
duration: duration,
complete: complete
})
},
complete($element) {
_animation.fx.stop($element.get(0), true)
}
};