UNPKG

ng-zorro-antd-yj

Version:

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

112 lines 7.63 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 {?} */ const rect = elem.getBoundingClientRect(); /** @type {?} */ const 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 {?} */ const children = element.childNodes; for (let i = 0; i < children.length; i++) { /** @type {?} */ const node = children.item(i); if (filterNotEmptyNode(node)) { return node; } } return null; } /** * @param {?} element * @return {?} */ export function findLastNotEmptyNode(element) { /** @type {?} */ const children = element.childNodes; for (let i = children.length - 1; i >= 0; i--) { /** @type {?} */ const node = children.item(i); if (filterNotEmptyNode(node)) { return node; } } return null; } /** * @param {?} parent * @return {?} */ export function reverseChildNodes(parent) { /** @type {?} */ const children = parent.childNodes; /** @type {?} */ let length = children.length; if (length) { /** @type {?} */ const nodes = []; children.forEach((/** * @param {?} node * @param {?} i * @return {?} */ (node, i) => (nodes[i] = node))); while (length--) { parent.appendChild(nodes[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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNvcmUvdXRpbC9kb20udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUVBLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLFNBQVMsQ0FBQzs7Ozs7O0FBSzdDLE1BQU0sVUFBVSxXQUFXLENBQUMsQ0FBUTtJQUNsQyxDQUFDLENBQUMsZUFBZSxFQUFFLENBQUM7SUFDcEIsQ0FBQyxDQUFDLGNBQWMsRUFBRSxDQUFDO0FBQ3JCLENBQUM7Ozs7O0FBRUQsTUFBTSxVQUFVLGdCQUFnQixDQUFDLElBQWlCO0lBQ2hELElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxFQUFFLENBQUMsTUFBTSxFQUFFO1FBQ2pDLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLEVBQUUsQ0FBQztLQUM1Qjs7VUFFSyxJQUFJLEdBQUcsSUFBSSxDQUFDLHFCQUFxQixFQUFFOztVQUNuQyxHQUFHLEdBQUcsbUJBQUEsSUFBSSxDQUFDLGFBQWEsRUFBQyxDQUFDLFdBQVc7SUFDM0MsT0FBTztRQUNMLEdBQUcsRUFBRSxJQUFJLENBQUMsR0FBRyxHQUFHLG1CQUFBLEdBQUcsRUFBQyxDQUFDLFdBQVc7UUFDaEMsSUFBSSxFQUFFLElBQUksQ0FBQyxJQUFJLEdBQUcsbUJBQUEsR0FBRyxFQUFDLENBQUMsV0FBVztLQUNuQyxDQUFDO0FBQ0osQ0FBQzs7Ozs7QUFFRCxNQUFNLFVBQVUscUJBQXFCLENBQUMsT0FBb0I7O1VBQ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