@progress/kendo-popup-common
Advanced tools
Comparing version 1.1.0 to 1.2.0-dev.201708171512
@@ -8,3 +8,6 @@ export { default as align } from "./align"; | ||
export { default as offset } from "./offset"; | ||
export { default as parentScrollPosition } from "./parent-scroll-position"; | ||
export { default as parents } from "./parents"; | ||
export { default as position } from "./position"; | ||
export { default as positionWithScroll } from "./position-with-scroll"; | ||
export { default as addScroll } from "./add-scroll"; | ||
@@ -14,2 +17,4 @@ export { default as removeScroll } from "./remove-scroll"; | ||
export { default as scrollPosition } from "./scroll-position"; | ||
export { default as siblingContainer } from "./sibling-container"; | ||
export { default as siblings } from "./siblings"; | ||
export { default as getWindow } from "./window"; | ||
@@ -16,0 +21,0 @@ export { default as getWindowViewPort } from "./window-viewport"; |
export { default as align } from './align'; | ||
export { default as AlignPoint } from './align-point'; | ||
export { default as addScroll } from './add-scroll'; | ||
export { default as applyLocationOffset } from './apply-location-offset'; | ||
export { default as boundingOffset } from './bounding-offset'; | ||
export { default as Collision } from './collision'; | ||
export { default as getDocumentElement } from './document'; | ||
export { default as isBodyOffset } from './is-body-offset'; | ||
export { default as offsetParent } from './offset-parent'; | ||
export { default as offset } from './offset'; | ||
export { default as parents } from './parents'; | ||
export { default as parentScrollPosition } from './parent-scroll-position'; | ||
export { default as position } from './position'; | ||
export { default as addScroll } from './add-scroll'; | ||
export { default as positionWithScroll } from './position-with-scroll'; | ||
export { default as removeScroll } from './remove-scroll'; | ||
export { default as restrictToView } from './restrict-to-view'; | ||
export { default as scrollPosition } from './scroll-position'; | ||
export { default as siblingContainer } from './sibling-container'; | ||
export { default as siblings } from './siblings'; | ||
export { default as getDocumentElement } from './document'; | ||
export { default as getWindow } from './window'; | ||
export { default as getWindowViewPort } from './window-viewport'; | ||
export { default as AlignPoint } from './align-point'; | ||
export { default as Collision } from './collision'; | ||
//# sourceMappingURL=main.js.map |
import Rect from "./rect"; | ||
declare var _default: (element: HTMLElement) => Rect; | ||
declare var _default: (element: HTMLElement, parent?: HTMLElement) => Rect; | ||
export default _default; |
@@ -5,7 +5,7 @@ import offsetParent from './offset-parent'; | ||
var position = function (element) { | ||
var position = function (element, parent) { | ||
var win = wnd(element); | ||
var elementStyles = win.getComputedStyle(element); | ||
var offset = offsetRect(element); | ||
var parentElement = offsetParent(element); | ||
var parentElement = parent || offsetParent(element); | ||
var parentStyles = win.getComputedStyle(parentElement); | ||
@@ -12,0 +12,0 @@ |
@@ -65,2 +65,11 @@ 'use strict'; | ||
function addScroll(rect, scroll) { | ||
return { | ||
top: rect.top + scroll.y, | ||
left: rect.left + scroll.x, | ||
height: rect.height, | ||
width: rect.width | ||
}; | ||
} | ||
function applyLocationOffset(rect, location, isOffsetBody) { | ||
@@ -107,7 +116,2 @@ var top = rect.top; | ||
var collision = { | ||
"fit": "fit", | ||
"flip": "flip" | ||
}; | ||
var getDocument = function (element) { return ( element.ownerDocument.documentElement ); }; | ||
@@ -163,9 +167,37 @@ | ||
var parents = function (element, until) { | ||
var result = []; | ||
var next = element.parentNode; | ||
while (next) { | ||
result.push(next); | ||
if (next === until) { break; } | ||
next = next.parentNode; | ||
} | ||
return result; | ||
}; | ||
var elementScrollPosition = function (element) { return ( | ||
{ | ||
x: element.scrollLeft, | ||
y: element.scrollTop | ||
} | ||
); }; | ||
function parentScrollPosition(element) { | ||
var parent = offsetParent(element); | ||
return parent ? elementScrollPosition(parent) : { x: 0, y: 0 }; | ||
} | ||
var getWindow = function (element) { return ( element.ownerDocument.defaultView ); }; | ||
var position = function (element) { | ||
var position = function (element, parent) { | ||
var win = getWindow(element); | ||
var elementStyles = win.getComputedStyle(element); | ||
var offset$$1 = offset(element); | ||
var parentElement = offsetParent(element); | ||
var parentElement = parent || offsetParent(element); | ||
var parentStyles = win.getComputedStyle(parentElement); | ||
@@ -190,10 +222,20 @@ | ||
function addScroll(rect, scroll) { | ||
var positionWithScroll = function (element, parent) { | ||
var offsetParentElement = parent ? offsetParent(parent) : null; | ||
var ref = position(element, offsetParentElement); | ||
var top = ref.top; | ||
var left = ref.left; | ||
var height = ref.height; | ||
var width = ref.width; | ||
var ref$1 = offsetParentElement ? elementScrollPosition(offsetParentElement) : parentScrollPosition(element); | ||
var x = ref$1.x; | ||
var y = ref$1.y; | ||
return { | ||
top: rect.top + scroll.y, | ||
left: rect.left + scroll.x, | ||
height: rect.height, | ||
width: rect.width | ||
top: top + y, | ||
left: left + x, | ||
height: height, | ||
width: width | ||
}; | ||
} | ||
}; | ||
@@ -209,2 +251,7 @@ function removeScroll(rect, scroll) { | ||
var collision = { | ||
"fit": "fit", | ||
"flip": "flip" | ||
}; | ||
var fit = function(position, size, viewPortSize) { | ||
@@ -318,2 +365,41 @@ var output = 0; | ||
var siblings = function (element) { | ||
var result = []; | ||
var sibling = element.parentNode.firstElementChild; | ||
while (sibling) { | ||
if (sibling !== element) { | ||
result.push(sibling); | ||
} | ||
sibling = sibling.nextElementSibling; | ||
} | ||
return result; | ||
}; | ||
/* eslint-disable no-loop-func */ | ||
var siblingContainer = function (anchor, container) { | ||
var parentElements = parents(anchor); | ||
var containerElement = container; | ||
var siblingElements; | ||
var result; | ||
while (containerElement) { | ||
siblingElements = siblings(containerElement); | ||
result = parentElements.reduce( | ||
function (list, p) { return list.concat(siblingElements.filter(function (s) { return s === p; })); }, | ||
[] | ||
)[0]; | ||
if (result) { break; } | ||
containerElement = containerElement.parentElement; | ||
} | ||
return result; | ||
}; | ||
function windowViewport(element) { | ||
@@ -329,18 +415,23 @@ var win = getWindow(element); | ||
exports.align = align; | ||
exports.AlignPoint = alignPoint; | ||
exports.addScroll = addScroll; | ||
exports.applyLocationOffset = applyLocationOffset; | ||
exports.boundingOffset = boundingOffset; | ||
exports.Collision = collision; | ||
exports.getDocumentElement = getDocument; | ||
exports.isBodyOffset = isBodyOffset; | ||
exports.offsetParent = offsetParent; | ||
exports.offset = offset; | ||
exports.parents = parents; | ||
exports.parentScrollPosition = parentScrollPosition; | ||
exports.position = position; | ||
exports.addScroll = addScroll; | ||
exports.positionWithScroll = positionWithScroll; | ||
exports.removeScroll = removeScroll; | ||
exports.restrictToView = restrictToView; | ||
exports.scrollPosition = scrollPosition; | ||
exports.siblingContainer = siblingContainer; | ||
exports.siblings = siblings; | ||
exports.getDocumentElement = getDocument; | ||
exports.getWindow = getWindow; | ||
exports.getWindowViewPort = windowViewport; | ||
exports.AlignPoint = alignPoint; | ||
exports.Collision = collision; | ||
//# sourceMappingURL=main.js.map |
{ | ||
"name": "@progress/kendo-popup-common", | ||
"description": "Kendo UI Popup common package", | ||
"version": "1.1.0", | ||
"publishConfig": { | ||
"registry": "https://registry.npm.telerik.com" | ||
}, | ||
"version": "1.2.0-dev.201708171512", | ||
"repository": { | ||
@@ -9,0 +6,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85142
86
931
2