UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

112 lines 7.65 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { filterNotEmptyNode } from './check'; /** * Silent an event by stopping and preventing it. * @param {?} e * @return {?} */ export function silentEvent(e) { e.stopPropagation(); e.preventDefault(); } /** * @param {?} elem * @return {?} */ export function getElementOffset(elem) { if (!elem.getClientRects().length) { return { top: 0, left: 0 }; } /** @type {?} */ var rect = elem.getBoundingClientRect(); /** @type {?} */ var win = (/** @type {?} */ (elem.ownerDocument)).defaultView; return { top: rect.top + (/** @type {?} */ (win)).pageYOffset, left: rect.left + (/** @type {?} */ (win)).pageXOffset }; } /** * @param {?} element * @return {?} */ export function findFirstNotEmptyNode(element) { /** @type {?} */ var children = element.childNodes; for (var i = 0; i < children.length; i++) { /** @type {?} */ var node = children.item(i); if (filterNotEmptyNode(node)) { return node; } } return null; } /** * @param {?} element * @return {?} */ export function findLastNotEmptyNode(element) { /** @type {?} */ var children = element.childNodes; for (var i = children.length - 1; i >= 0; i--) { /** @type {?} */ var node = children.item(i); if (filterNotEmptyNode(node)) { return node; } } return null; } /** * @param {?} parent * @return {?} */ export function reverseChildNodes(parent) { /** @type {?} */ var children = parent.childNodes; /** @type {?} */ var length = children.length; if (length) { /** @type {?} */ var nodes_1 = []; children.forEach((/** * @param {?} node * @param {?} i * @return {?} */ function (node, i) { return (nodes_1[i] = node); })); while (length--) { parent.appendChild(nodes_1[length]); } } } /** * @record */ export function MouseTouchObserverConfig() { } if (false) { /** @type {?} */ MouseTouchObserverConfig.prototype.end; /** @type {?} */ MouseTouchObserverConfig.prototype.move; /** @type {?} */ MouseTouchObserverConfig.prototype.pluckKey; /** @type {?} */ MouseTouchObserverConfig.prototype.start; /** @type {?|undefined} */ MouseTouchObserverConfig.prototype.end$; /** @type {?|undefined} */ MouseTouchObserverConfig.prototype.moveResolved$; /** @type {?|undefined} */ MouseTouchObserverConfig.prototype.startPlucked$; /** * @param {?} e * @return {?} */ MouseTouchObserverConfig.prototype.filter = function (e) { }; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNvcmUvdXRpbC9kb20udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUVBLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLFNBQVMsQ0FBQzs7Ozs7O0FBSzdDLE1BQU0sVUFBVSxXQUFXLENBQUMsQ0FBUTtJQUNsQyxDQUFDLENBQUMsZUFBZSxFQUFFLENBQUM7SUFDcEIsQ0FBQyxDQUFDLGNBQWMsRUFBRSxDQUFDO0FBQ3JCLENBQUM7Ozs7O0FBRUQsTUFBTSxVQUFVLGdCQUFnQixDQUFDLElBQWlCO0lBQ2hELElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxFQUFFLENBQUMsTUFBTSxFQUFFO1FBQ2pDLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLEVBQUUsQ0FBQztLQUM1Qjs7UUFFSyxJQUFJLEdBQUcsSUFBSSxDQUFDLHFCQUFxQixFQUFFOztRQUNuQyxHQUFHLEdBQUcsbUJBQUEsSUFBSSxDQUFDLGFBQWEsRUFBQyxDQUFDLFdBQVc7SUFDM0MsT0FBTztRQUNMLEdBQUcsRUFBRSxJQUFJLENBQUMsR0FBRyxHQUFHLG1CQUFBLEdBQUcsRUFBQyxDQUFDLFdBQVc7UUFDaEMsSUFBSSxFQUFFLElBQUksQ0FBQyxJQUFJLEdBQUcsbUJBQUEsR0FBRyxFQUFDLENBQUMsV0FBVztLQUNuQyxDQUFDO0FBQ0osQ0FBQzs7Ozs7QUFFRCxNQUFNLFVBQVUscUJBQXFCLENBQUMsT0FB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