Latest updates from IceHrmPro
This commit is contained in:
64
web/node_modules/scroll-into-view-if-needed/es/index.js
generated
vendored
Normal file
64
web/node_modules/scroll-into-view-if-needed/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import compute from 'compute-scroll-into-view';
|
||||
|
||||
function isOptionsObject(options) {
|
||||
return options === Object(options) && Object.keys(options).length !== 0;
|
||||
}
|
||||
|
||||
function defaultBehavior(actions, behavior) {
|
||||
if (behavior === void 0) {
|
||||
behavior = 'auto';
|
||||
}
|
||||
|
||||
var canSmoothScroll = 'scrollBehavior' in document.body.style;
|
||||
actions.forEach(function (_ref) {
|
||||
var el = _ref.el,
|
||||
top = _ref.top,
|
||||
left = _ref.left;
|
||||
|
||||
if (el.scroll && canSmoothScroll) {
|
||||
el.scroll({
|
||||
top: top,
|
||||
left: left,
|
||||
behavior: behavior
|
||||
});
|
||||
} else {
|
||||
el.scrollTop = top;
|
||||
el.scrollLeft = left;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getOptions(options) {
|
||||
if (options === false) {
|
||||
return {
|
||||
block: 'end',
|
||||
inline: 'nearest'
|
||||
};
|
||||
}
|
||||
|
||||
if (isOptionsObject(options)) {
|
||||
return options;
|
||||
}
|
||||
|
||||
return {
|
||||
block: 'start',
|
||||
inline: 'nearest'
|
||||
};
|
||||
}
|
||||
|
||||
function scrollIntoView(target, options) {
|
||||
var targetIsDetached = !target.ownerDocument.documentElement.contains(target);
|
||||
|
||||
if (isOptionsObject(options) && typeof options.behavior === 'function') {
|
||||
return options.behavior(targetIsDetached ? [] : compute(target, options));
|
||||
}
|
||||
|
||||
if (targetIsDetached) {
|
||||
return;
|
||||
}
|
||||
|
||||
var computeOptions = getOptions(options);
|
||||
return defaultBehavior(compute(target, computeOptions), computeOptions.behavior);
|
||||
}
|
||||
|
||||
export default scrollIntoView;
|
||||
0
web/node_modules/scroll-into-view-if-needed/es/types.js
generated
vendored
Normal file
0
web/node_modules/scroll-into-view-if-needed/es/types.js
generated
vendored
Normal file
Reference in New Issue
Block a user