var Unibase; (function (Unibase) { let Apps; (function (Apps) { let Collaboration; (function (Collaboration) { let Components; (function (Components) { let Common; (function (Common) { class Util { createElement(tagName, attType, attValue) { let ele = document.createElement(tagName); ele.setAttribute(attType, attValue); return ele; } appendChildren(parent, classIndex, ...eleArray) { let parentTag = document.getElementsByClassName(parent)[classIndex]; for (let i = 0; i < eleArray.length; i++) { parentTag.appendChild(eleArray[i]); } } addAttributes(htmlElement, attrJson) { for (var attr in attrJson) { htmlElement.setAttribute(attr, attrJson[attr]); } } getCellValues(cellInfo) { var val = {}; cellInfo.value && (val["value"] = cellInfo.value.toString().trim()); cellInfo.formula && (val["formula"] = cellInfo.formula); cellInfo.format ? (val["format"] = cellInfo.format) : (val["format"] = "General"); cellInfo.hyperlink && (val["hyperlink"] = cellInfo.hyperlink); return val; } colorHash(str) { var sum = 0; for (var i in str) { sum += str.charCodeAt(i); } let r = ~~(('0.' + Math.sin(sum + 1).toString().substr(6)) * 256); let g = ~~(('0.' + Math.sin(sum + 2).toString().substr(6)) * 256); let b = ~~(('0.' + Math.sin(sum + 3).toString().substr(6)) * 256); let rgb = "rgb(" + r + ", " + g + ", " + b + ")"; let hex = "#"; hex += ("00" + r.toString(16)).substr(-2, 2).toUpperCase(); hex += ("00" + g.toString(16)).substr(-2, 2).toUpperCase(); hex += ("00" + b.toString(16)).substr(-2, 2).toUpperCase(); return { r: r, g: g, b: b, rgb: rgb, hex: hex }; } makeid(length) { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; for (var i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } static Instance() { if (this.instance === undefined) { this.instance = new Util(); } return this.instance; } } Common.Util = Util; })(Common = Components.Common || (Components.Common = {})); })(Components = Collaboration.Components || (Collaboration.Components = {})); })(Collaboration = Apps.Collaboration || (Apps.Collaboration = {})); })(Apps = Unibase.Apps || (Unibase.Apps = {})); })(Unibase || (Unibase = {}));