UNPKG

@nepwork/dashboards

Version:

Dashboards for emergencies and monitoring

42 lines 1.43 kB
/** * @license * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ export function convertToBoolProperty(val) { if (typeof val === 'string') { val = val.toLowerCase().trim(); return (val === 'true' || val === ''); } return !!val; } export function getElementHeight(el) { /** * * TODO: Move helpers in separate common module. * TODO: Provide window through di token. * */ var style = window.getComputedStyle(el); var marginTop = parseInt(style.getPropertyValue('margin-top'), 10); var marginBottom = parseInt(style.getPropertyValue('margin-bottom'), 10); return el.offsetHeight + marginTop + marginBottom; } export function firstChildNotComment(node) { var children = Array .from(node.childNodes) .filter(function (child) { return child.nodeType !== Node.COMMENT_NODE; }); return children[0]; } export function lastChildNotComment(node) { var children = Array .from(node.childNodes) .filter(function (child) { return child.nodeType !== Node.COMMENT_NODE; }); return children[children.length - 1]; } /* * @breaking-change Remove @6.0.0 */ export function emptyStatusWarning(source) { console.warn(source + ": Using empty string as a status is deprecated. Use `basic` instead."); } //# sourceMappingURL=helpers.js.map