first commit
This commit is contained in:
41
frontend/node_modules/rc-dialog/lib/util.js
generated
vendored
Normal file
41
frontend/node_modules/rc-dialog/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getMotionName = getMotionName;
|
||||
exports.offset = offset;
|
||||
// =============================== Motion ===============================
|
||||
function getMotionName(prefixCls, transitionName, animationName) {
|
||||
var motionName = transitionName;
|
||||
if (!motionName && animationName) {
|
||||
motionName = "".concat(prefixCls, "-").concat(animationName);
|
||||
}
|
||||
return motionName;
|
||||
}
|
||||
|
||||
// =============================== Offset ===============================
|
||||
function getScroll(w, top) {
|
||||
var ret = w["page".concat(top ? 'Y' : 'X', "Offset")];
|
||||
var method = "scroll".concat(top ? 'Top' : 'Left');
|
||||
if (typeof ret !== 'number') {
|
||||
var d = w.document;
|
||||
ret = d.documentElement[method];
|
||||
if (typeof ret !== 'number') {
|
||||
ret = d.body[method];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function offset(el) {
|
||||
var rect = el.getBoundingClientRect();
|
||||
var pos = {
|
||||
left: rect.left,
|
||||
top: rect.top
|
||||
};
|
||||
var doc = el.ownerDocument;
|
||||
var w = doc.defaultView || doc.parentWindow;
|
||||
pos.left += getScroll(w);
|
||||
pos.top += getScroll(w, true);
|
||||
return pos;
|
||||
}
|
||||
Reference in New Issue
Block a user