@enplug/dashboard-sdk-utils
Advanced tools
Comparing version 2.1.6 to 2.1.7
{ | ||
"name": "enplug-dashboard-sdk-utils", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"homepage": "https://github.com/Enplug/dashboard-sdk-utils", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
angular.module("enplug.sdk.utils",["enplug.sdk.utils.templates"]),angular.module("enplug.sdk.utils").run(["$templateCache",function($templateCache){$templateCache.put("template/smart-table/pagination.html",'<div ng-if="pages.length >= 2"><st-summary></st-summary><ul class="pagination plain"><li><a class="ion-chevron-left" ng-click="selectPage(currentPage - 1)" ng-class="{ disabled: currentPage == 1 }"></a></li><li><a class="ion-chevron-right" ng-click="selectPage(currentPage + 1)" ng-class="{ disabled: currentPage == numPages }"></a></li></ul></div>')}]),angular.module("enplug.sdk.utils").constant("countries",[{name:"United States",code:"US"},{name:"Afghanistan",code:"AF"},{name:"Åland Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"Andorra",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D'Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:"Democratic People's Republic of Korea",code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kosovo",code:"XK"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:"Lao People's Democratic Republic",code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"Rwanda",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}]),angular.module("enplug.sdk.utils").constant("months",[{name:"January",short:"Jan",code:"01"},{name:"February",short:"Feb",code:"02"},{name:"March",short:"Mar",code:"03"},{name:"April",short:"Apr",code:"04"},{name:"May",short:"May",code:"05"},{name:"June",short:"Jun",code:"06"},{name:"July",short:"Jul",code:"07"},{name:"August",short:"Aug",code:"08"},{name:"September",short:"Sep",code:"09"},{name:"October",short:"Oct",code:"10"},{name:"November",short:"Nov",code:"11"},{name:"December",short:"Dec",code:"12"}]),angular.module("enplug.sdk.utils").constant("quotes",{random:function(){var index=Math.floor(Math.random()*this.quotes.length);return this.quotes[index]},quotes:[{text:"All great achievements require time.",author:"Maya Angelou"},{text:"You can't wait for inspiration. You have to go after it with a club.",author:"Jack London"},{text:"The perfect is the enemy of the good.",author:"Voltaire"},{text:"I play to win, whether during practice or a real game.",author:"Michael Jordan"},{text:"Many of life's failures are people who did not realize how close they were to success when they gave up.",author:"Thomas Edison"},{text:"At the age of six I wanted to be a cook. At seven I wanted to be Napoleon. And my ambition has been growing steadily ever since.",author:"Salvador Dali"},{text:"Quality is more important than quantity. One home run is much better than two doubles.",author:"Steve Jobs"},{text:"That's one small step for man, one giant leap for mankind.",author:"Neil Armstrong"},{text:"Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.",author:"Scott Adams"},{text:"Nothing will work unless you do.",author:"Maya Angelou"},{text:"The best way out is always through.",author:"Robert Frost"},{text:"An ant on the move does more than a dozing ox.",author:"Lao Tzu"},{text:"Show me a thoroughly satisfied man and I will show you a failure.",author:"Thomas Edison"},{text:"Our greatest glory is not in never failing, but in rising up every time we fail.",author:"Ralph Waldo Emerson"},{text:"Every act of creation is first of all an act of destruction.",author:"Pablo Picasso"},{text:"Fun is good.",author:"Dr. Seuss"},{text:"I steal from every movie ever made.",author:"Quentin Tarantino"},{text:"It is the working man who is the happy man. It is the idle man who is the miserable man.",author:"Ben Franklin"},{text:"A person who never made a mistake never tried anything new.",author:"Albert Einstein"},{text:"To be idle is a short road to death and to be diligent is a way of life.",author:"Buddha"},{text:"The way to get started is to quit talking and begin doing.",author:"Walt Disney"},{text:"For every dark night, there's a brigher day.",author:"Tupac Shakur"},{text:"If you love life, don't waste time, for time is what life is made up of.",author:"Bruce Lee"},{text:"You can never quit. Winners never quit, and quitters never win.",author:"Ted Turner"},{text:"Work spares us from three evils: boredom, vice and need.",author:"Voltaire"},{text:"Focus is a matter of deciding what things you're not going to do.",author:"John Carmack"},{text:"I play to win, whether during practice or a real game.",author:"Michael Jordan"},{text:"HULK SMASH!",author:"The Incredible Hulk"},{text:"The harder the conflict, the more glorious the triumph.",author:"Thomas Paine"},{text:"Everything comes to him who hustles while he waits.",author:"Thomas Edison"},{text:"You've got to jump off cliffs and build your wings on the way down.",author:"Ray Bradbury"},{text:"Amateurs practice until they get it right. Professionals practice until they can't get it wrong.",author:"Unknown"},{text:"Genius is one percent inspiration and ninety-nine percent perspiration.",author:"Thomas Edison"},{text:"A lot of times, people don't know what they want until you show it to them.",author:"Steve Jobs"},{text:"I don't know where I'm going, but I'm on my way.",author:"Carl Sagan"},{text:"Lost time is never found again.",author:"Benjamin Franklin"},{text:"Without pain, without sacrifice, we would have nothing.",author:"Tyler Durden"},{text:"I pay no attention whatever to anybody's praise or blame. I simply follow my own feelings.",author:"Wolfgang Amadeus Mozart"},{text:"You miss 100% of the shots you don't take.",author:"Wayne Gretzky"},{text:"To have a great idea, have a lot of them.",author:"Thomas Edison"},{text:"The value of an idea lies in the using of it.",author:"Thomas Edison"},{text:"Simplify, simplify, simplify.",author:"Henry David Thoreau"},{text:"There's a way to do it better - find it.",author:"Thomas Edison"},{text:"When it is obvious that the goals cannot be reached, don't adjust the goals, adjust the steps.",author:"Confucius"},{text:"During your life, never stop dreaming. No one can take away your dreams.",author:"Tupac Shakur"},{text:"Things do not happen. Things are made to happen.",author:"John F. Kennedy"},{text:"Ambition should be made of sterner stuff.",author:"William Shakespeare"},{text:"If you spend too much time thinking about a thing, you'll never get it done.",author:"Bruce Lee"},{text:"Success breeds success.",author:"Proverb"},{text:"You are never too old to set another goal or to dream a new dream.",author:"C.S. Lewis"},{text:"When you stop doing things for fun, you might as well be dead.",author:"Ernest Hemingway"},{text:"There is no substitute for hard work.",author:"Thomas Edison"},{text:"Live long and prosper.",author:"Spock"},{text:"I have not failed. I've just found 10,000 ways that won't work.",author:"Thomas Edison"},{text:"It's lack of faith that makes people afraid of meeting challenges, and I believed in myself.",author:"Muhammad Ali"},{text:"All our dreams can come true, if we have the courage to pursue them.",author:"Walt Disney"},{text:"Make everything as simple as possible, but not simpler.",author:"Albert Einstein"},{text:"Some people want it to happen, some wish it would happen, others make it happen.",author:"Michael Jordan"},{text:"I've got a theory that if you give 100% all the time, somehow things will work out in the end.",author:"Larry Bird"},{text:"The problem with the future is that it keeps turning into the present.",author:"Bill Watterson"},{text:"May the Force be with you.",author:"Han Solo"},{text:"Victory belongs to the most persevering.",author:"Napoleon Bonaparte"},{text:"I hated every minute of training, but I said, 'Dont quit. Suffer now and live the rest of your life as a champion'.",author:"Muhammad Ali"},{text:"Do things that have never been done before.",author:"Russell Kirsch"},{text:"I've failed over and over and over again in my life and that is why I succeed.",author:"Michael Jordan"},{text:"A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty.",author:"Winston Churchill"},{text:"He who hesitates is lost.",author:"Proverb"},{text:"Carpe diem, seize the day boys, make your lives extraordinary.",author:"John Keating"},{text:"Doing the best at this moment puts you in the best place for the next moment.",author:"Oprah Winfrey"},{text:"Luck is preparation meeting opportunity.",author:"Oprah Winfrey"},{text:"I have no special talent. I am only passionately curious.",author:"Albert Einstein"}]}),angular.module("enplug.sdk.utils").constant("states",[{name:"Alabama",code:"AL"},{name:"Alaska",code:"AK"},{name:"Arizona",code:"AZ"},{name:"Arkansas",code:"AR"},{name:"California",code:"CA"},{name:"Colorado",code:"CO"},{name:"Connecticut",code:"CT"},{name:"Delaware",code:"DE"},{name:"District of Columbia",code:"DC"},{name:"Florida",code:"FL"},{name:"Georgia",code:"GA"},{name:"Hawaii",code:"HI"},{name:"Idaho",code:"ID"},{name:"Illinois",code:"IL"},{name:"Indiana",code:"IN"},{name:"Iowa",code:"IA"},{name:"Kansa",code:"KS"},{name:"Kentucky",code:"KY"},{name:"Lousiana",code:"LA"},{name:"Maine",code:"ME"},{name:"Maryland",code:"MD"},{name:"Massachusetts",code:"MA"},{name:"Michigan",code:"MI"},{name:"Minnesota",code:"MN"},{name:"Mississippi",code:"MS"},{name:"Missouri",code:"MO"},{name:"Montana",code:"MT"},{name:"Nebraska",code:"NE"},{name:"Nevada",code:"NV"},{name:"New Hampshire",code:"NH"},{name:"New Jersey",code:"NJ"},{name:"New Mexico",code:"NM"},{name:"New York",code:"NY"},{name:"North Carolina",code:"NC"},{name:"North Dakota",code:"ND"},{name:"Ohio",code:"OH"},{name:"Oklahoma",code:"OK"},{name:"Oregon",code:"OR"},{name:"Pennsylvania",code:"PA"},{name:"Rhode Island",code:"RI"},{name:"South Carolina",code:"SC"},{name:"South Dakota",code:"SD"},{name:"Tennessee",code:"TN"},{name:"Texas",code:"TX"},{name:"Utah",code:"UT"},{name:"Vermont",code:"VT"},{name:"Virginia",code:"VA"},{name:"Washington",code:"WA"},{name:"West Virginia",code:"WV"},{name:"Wisconsin",code:"WI"},{name:"Wyoming",code:"WY"}]),angular.module("enplug.sdk.utils").constant("years",function(){"use strict";for(var yearsToShow=20,thisYear=(new Date).getFullYear(),years=[],year=thisYear;year<thisYear+yearsToShow;year++)years.push({name:year.toString(),code:year.toString().slice(-2)});return years}()),angular.module("enplug.sdk.utils").directive("alert",function(){"use strict";return{restrict:"E",transclude:!0,scope:!0,replace:!0,templateUrl:"sdk-utils/alert.tpl"}}),angular.module("enplug.sdk.utils").directive("displayCounter",function(){return{restrict:"E",replace:!0,scope:{count:"=",showDanger:"=",vertical:"=",disabled:"="},templateUrl:"sdk-utils/display-counter.tpl",link:function(scope,element,attrs){scope.showDanger="showDanger"in attrs&&0==scope.showDanger,scope.checkDanger=function(){scope.showDanger&&scope.count<=0?element.addClass("danger"):element.removeClass("danger")},scope.checkDanger(),"vertical"in scope&&scope.vertical===!0&&element.addClass("vertical"),"disabled"in scope&&scope.disabled===!0&&element.addClass("disabled"),scope.$watch("count",function(){scope.checkDanger()})}}}),angular.module("enplug.sdk.utils").directive("downloadCsv",["$document","$log",function($document,$log){return{restrict:"A",scope:{epDownloadCsv:"="},link:function(scope,element){element.bind("click",function(){var fileName=scope.epDownloadCsv.fileName,downloadFunction=scope.epDownloadCsv.downloadFunction;$log.debug(fileName);var promise=downloadFunction();promise.then(function(data){var downloadLink=angular.element("<a></a>").attr("href","data:text/csv;charset=utf8,"+encodeURIComponent(data)).attr("download",fileName);downloadLink.insertAfter(element),downloadLink.ready(function(){downloadLink.get(0).click(),downloadLink.remove()})})})}}}]),angular.module("enplug.sdk.utils").directive("dropdownMenu",function(){"use strict";return{link:function(scope,element){element.addClass("dropdown-menu"),element.on("click",function(event){var target=angular.element(event.target);(target.attr("href")||target.parent().attr("href"))&&scope.$emit("dropdown:toggle"),scope.$apply(function(){scope.$emit("dropdown:click")})})}}}),angular.module("enplug.sdk.utils").directive("dropdownToggle",function(){"use strict";return{link:function(scope,element){element.addClass("dropdown-toggle"),element.on("click",function(){scope.$apply(function(){scope.$broadcast("dropdown:toggle")})})}}}),angular.module("enplug.sdk.utils").directive("dropdown",["$document","$timeout",function($document,$timeout){return{scope:!0,link:function(scope,element){function closeDropdown(){element.addClass("closing"),$timeout(function(){element.removeClass("open"),element.removeClass("closing"),$document.off("click",closeDropdown)},300)}function toggle(){element.hasClass("open")?closeDropdown():open()}function open(){element.addClass("open"),$document.on("click",function(event){element[0].contains(event.target)||closeDropdown()})}element.addClass("dropdown-wrap"),scope.$on("dropdown:toggle",toggle),scope.$on("dropdown:click",toggle),scope.$on("$destroy",function(){$document.off("click",closeDropdown)})}}}]),angular.module("enplug.sdk.utils").directive("colorPicker",["$document","$timeout","ColorTools","PositionTools",function($document,$timeout,ColorTools,PositionTools){"use strict";return{restrict:"E",transclude:!0,scope:{hex:"=?",rgb:"=?",alpha:"=?"},templateUrl:"sdk-utils/color-picker.tpl",link:function(scope,element,attrs){function setHEX(val){scope.hex=val,scope.hexInput=val}function setRGB(val){scope.rgb=val,setRed(val[0]),setGreen(val[1]),setBlue(val[2])}function setRed(val){scope.red=Math.round(val)}function setGreen(val){scope.green=Math.round(val)}function setBlue(val){scope.blue=Math.round(val)}function setHue(val){scope.hue=val,$hue[0].$cursor.css("left",(1-scope.hue)*$hue[0].clientWidth+"px")}function setSaturation(val){scope.saturation=val,$saturation[0].$cursor.css("left",scope.saturation*$saturation[0].clientWidth+"px")}function setBrightness(val){scope.brightness=val,$saturation[0].$cursor.css("top",(1-val)*$saturation[0].clientHeight+"px")}function setAlpha(val){scope.alpha=parseFloat(val.toFixed(2)),scope.alphaPercent=parseFloat((100*scope.alpha).toFixed(2)),scope.noAlpha||$alpha[0].$cursor.css("left",scope.alpha*$alpha[0].clientWidth+"px")}var labelAlpha=angular.element(element[0].querySelector(".channel-alpha")),labelHex=(angular.element(element[0].querySelector(".channel-red")),angular.element(element[0].querySelector(".channel-green")),angular.element(element[0].querySelector(".channel-blue")),angular.element(element[0].querySelector(".hex-input"))),$palette=angular.element(element[0].querySelector(".palette")),$swatch=angular.element(element[0].querySelector(".swatch"));scope.opened=!1;var $hue=angular.element(element[0].querySelector(".hue"));$hue[0].$cursor=angular.element($hue[0].querySelector(".cursor"));var $alpha=angular.element(element[0].querySelector(".alpha-slider"));$alpha[0].$cursor=angular.element($alpha[0].querySelector(".cursor"));var $saturation=angular.element(element[0].querySelector(".saturation"));if($saturation[0].$cursor=angular.element($saturation[0].querySelector(".cursor")),attrs.hasOwnProperty("showAsRgb")?scope.showAs="rgb":scope.showAs="hex",scope.toggleShowAs=function(){scope.showAs="hex"==scope.showAs?"rgb":"hex"},scope.noAlpha=attrs.hasOwnProperty("noAlpha"),scope.hasOwnProperty("hex")){setHEX(scope.hex.replace(/^#/,"")),setRGB(ColorTools.hex2rgb(parseInt(scope.hex,16)));var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}else if(scope.hasOwnProperty("rgb")){setRGB(scope.rgb),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]));var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}else console.warn("[ColorPicker] Something insane just happened!");scope.hasOwnProperty("alpha")&&!isNaN(scope.alpha)||(scope.alpha=1),setAlpha(scope.alpha),$saturation.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var top=Math.max(0,Math.min($saturation[0].clientHeight,event.pageY-PositionTools.getTop($saturation[0]))),left=Math.max(0,Math.min($saturation[0].clientWidth,event.pageX-PositionTools.getLeft($saturation[0])));setSaturation(left/$saturation[0].clientWidth),setBrightness(1-top/$saturation[0].clientHeight),setRGB(ColorTools.hsl2rgb(scope.hue,scope.saturation,scope.brightness)),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]))})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),$hue.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var left=Math.max(0,Math.min($hue[0].clientWidth,event.pageX-PositionTools.getLeft($hue[0])));setHue(1-left/$hue[0].clientWidth),setRGB(ColorTools.hsl2rgb(scope.hue,scope.saturation,scope.brightness)),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]))})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),$alpha.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var left=Math.max(0,Math.min($alpha[0].clientWidth,event.pageX-PositionTools.getLeft($alpha[0])));setAlpha(left/$alpha[0].clientWidth)})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),scope.$watch("alphaPercent",function(){setAlpha(labelAlpha[0].value/100)}),scope.getHueColor=function(){var rgb=ColorTools.hsl2rgb(scope.hue,1,1),hex=ColorTools.rgb2hex(rgb[0],rgb[1],rgb[2]);return hex},scope.watchRGBInputChange=function(){setRGB([scope.red,scope.green,scope.blue]);var hsl=ColorTools.rgb2hsl(scope.red,scope.green,scope.blue);setHEX(ColorTools.rgb2hex(scope.red,scope.green,scope.blue)),setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])},scope.watchHEXInputChange=function(){labelHex[0].value.match(/[^0-9a-fA-F\.]/g)&&(labelHex[0].value=labelHex[0].value.replace(/[^0-9a-fA-F\.]/g,""));for(var fixed=labelHex[0].value.split(""),hex="",i=0,l=6;i<l;i++)hex+=i<fixed.length?fixed[i]:0;scope.hex=hex,setRGB(ColorTools.hex2rgb(parseInt(scope.hex,16)));var hsl=ColorTools.rgb2hsl(scope.red,scope.green,scope.blue);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])};var outterClickHandler=function(event){var isInside=event.pageY>PositionTools.getTop($palette[0])&&event.pageY<PositionTools.getTop($swatch[0])+$swatch[0].clientHeight+$palette[0].clientHeight&&event.pageX>PositionTools.getLeft($palette[0])&&event.pageX<PositionTools.getLeft($palette[0])+$palette[0].clientWidth;if(!isInside)return scope.$apply(function(){scope.opened=!1,$document.unbind("mousedown",outterClickHandler)})};scope.toggle=function(){scope.opened=!scope.opened,scope.opened?($timeout(function(){setAlpha(scope.alpha);var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}),$document.bind("mousedown",outterClickHandler)):$document.unbind("mousedown",outterClickHandler)},element.on("$destroy",function(){$document.unbind("mousedown",outterClickHandler)})}}}]),angular.module("enplug.sdk.utils").directive("equals",function(){function getter(property,object){var splitModel=property.split(".");return splitModel.reduce(function(map,key){return map[key]},object)}return{restrict:"A",require:"?ngModel",link:function($scope,$element,$attrs,$ngModel){function validate(){var val1=$ngModel.$viewValue,val2=getter($attrs.equals,$scope);$ngModel.$setValidity("equals",!val1||!val2||val1===val2)}$scope.$watch($attrs.ngModel,function(){validate()}),$scope.$watch($attrs.equals,function(){validate()})}}}),angular.module("enplug.sdk.utils").directive("materialCheckbox",["$log","$compile","GUID",function($log,$compile,GUID){"use strict";var ignoreAttributes=["class","field","label","ng-if","ng-show","ng-hide","ng-repeat"];return{restrict:"E",scope:{model:"=field"},transclude:!0,templateUrl:"sdk-utils/material-checkbox.tpl",link:function($scope,$element,$attrs,$ctrl,$transclude){$element.addClass("material-checkbox"),$scope.id=GUID.new(),$scope.label=$attrs.label,$transclude(function(clone){if(clone){for(var hasInput=!1,i=0;i<clone.length;i++)"input"==clone[i].nodeName.toLowerCase()&&(hasInput=!0);hasInput?($element.find("input").remove(),$element.find("label").prepend(clone),$element.find("input").attr("id",$scope.id),$element.find("input").attr("type","checkbox")):angular.element($element[0].querySelector(".checkbox-label")).append(clone)}});var input=$element.find("input")[0];angular.forEach($attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&($element.removeAttr(attr),input.setAttribute(attr,value))});var checkbox=$element.find("label")[0];$compile(checkbox)($scope)}}}]),angular.module("enplug.sdk.utils").directive("materialInput",["$log","$compile","$parse","$document","GUID",function($log,$compile,$parse,$document,GUID){"use strict";return{restrict:"E",require:"^form",scope:{model:"=field"},transclude:!0,templateUrl:"sdk-utils/material-input.tpl",link:function($scope,$element,$attrs,$form,$transclude){var ignoreAttributes=["class","label","directives","field","focus","ng-if","ng-show","ng-hide"],input=$document[0].createElement("input"),directives=$parse($attrs.directives)($scope),autofocus="undefined"!=typeof $attrs.autofocus,id=$attrs.field+"-"+GUID.new();$scope.id=id,$scope.label=$attrs.label,$element.removeAttr("label"),input.setAttribute("name",id),$element.parent().hasClass("form-group")||$element.addClass("form-group"),angular.forEach($attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&($element.removeAttr(attr),input.setAttribute(attr,value))}),input.getAttribute("type")||input.setAttribute("type","text"),input.setAttribute("class","form-control"),input.setAttribute("ng-model","model"),input.setAttribute("ng-class","{ active: model }"),input.setAttribute("ng-model-options","{ allowInvalid: true, debounce: 100 }"),input.setAttribute("id",$scope.id),angular.forEach(directives,function(value,directive){input.setAttribute(directive,value)}),$element.removeAttr("directives"),$transclude(function(clone){var hasInput=!1;if(clone){for(var newInput,i=0;i<clone.length;i++)"input"==clone[i].nodeName.toLowerCase()&&(hasInput=!0,newInput=clone[i]);hasInput?(newInput.setAttribute("class","form-control"),newInput.setAttribute("id",$scope.id),input.setAttribute("name",$scope.id),newInput.setAttribute("ng-class","{ active: model }"),newInput.setAttribute("ng-model","model"),$compile(clone)($scope),$element.prepend(clone)):$element.append(clone)}hasInput||($compile(input)($scope),$element.prepend(input))}),autofocus&&input.focus(),$scope.formField=$form[id],$scope.$watch("model",function(val){void 0!==val&&null!==val&&$scope.formField&&($scope.formField.$dirty=!0)})}}}]),angular.module("enplug.sdk.utils").directive("materialRadio",["$log","$compile",function($log,$compile){"use strict";var ignoreAttributes=["class","field","label","ng-if","ng-show","ng-hide","ng-repeat"];return{restrict:"E",scope:{model:"=field"},transclude:!0,replace:!0,templateUrl:"sdk-utils/material-radio.tpl",link:function(scope,element,attrs){element.addClass("material-radio");var input=element.find("input")[0];angular.forEach(attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&(element.removeAttr(attr),input.setAttribute(attr,value))}),$compile(input)(scope)}}}]),angular.module("enplug.sdk.utils").directive("materialSelect",["$timeout",function($timeout){"use strict";function findSelect(clone){for(var i=0;i<clone.length;i++)if("select"==clone[i].nodeName.toLowerCase())return angular.element(clone[i])}return{restrict:"E",scope:!0,transclude:!0,templateUrl:"sdk-utils/material-select.tpl",link:function(scope,element,attrs,ctrl,transclude){element.addClass("material-select"),scope.label=attrs.label,element.removeAttr("label"),transclude(function(clone){var select=findSelect(clone);select?scope.$watch("$parent."+select.attr("ng-model"),function(val){"undefined"!=typeof val&&null!==val&&(element.addClass("selected"),$timeout(function(){scope.label=select[0].options[select[0].selectedIndex].label}))}):console.warn("Warning: material-select requires a <select> element to be transcluded."); | ||
angular.module("enplug.sdk.utils",["enplug.sdk.utils.templates"]),angular.module("enplug.sdk.utils").run(["$templateCache",function($templateCache){$templateCache.put("template/smart-table/pagination.html",'<div ng-if="pages.length >= 2"><st-summary></st-summary><ul class="pagination plain"><li><a class="ion-chevron-left" ng-click="selectPage(currentPage - 1)" ng-class="{ disabled: currentPage == 1 }"></a></li><li><a class="ion-chevron-right" ng-click="selectPage(currentPage + 1)" ng-class="{ disabled: currentPage == numPages }"></a></li></ul></div>')}]),angular.module("enplug.sdk.utils").constant("countries",[{name:"United States",code:"US"},{name:"Afghanistan",code:"AF"},{name:"Åland Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"Andorra",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D'Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:"Democratic People's Republic of Korea",code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kosovo",code:"XK"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:"Lao People's Democratic Republic",code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"Rwanda",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}]),angular.module("enplug.sdk.utils").constant("months",[{name:"January",short:"Jan",code:"01"},{name:"February",short:"Feb",code:"02"},{name:"March",short:"Mar",code:"03"},{name:"April",short:"Apr",code:"04"},{name:"May",short:"May",code:"05"},{name:"June",short:"Jun",code:"06"},{name:"July",short:"Jul",code:"07"},{name:"August",short:"Aug",code:"08"},{name:"September",short:"Sep",code:"09"},{name:"October",short:"Oct",code:"10"},{name:"November",short:"Nov",code:"11"},{name:"December",short:"Dec",code:"12"}]),angular.module("enplug.sdk.utils").constant("quotes",{random:function(){var index=Math.floor(Math.random()*this.quotes.length);return this.quotes[index]},quotes:[{text:"All great achievements require time.",author:"Maya Angelou"},{text:"You can't wait for inspiration. You have to go after it with a club.",author:"Jack London"},{text:"The perfect is the enemy of the good.",author:"Voltaire"},{text:"I play to win, whether during practice or a real game.",author:"Michael Jordan"},{text:"Many of life's failures are people who did not realize how close they were to success when they gave up.",author:"Thomas Edison"},{text:"At the age of six I wanted to be a cook. At seven I wanted to be Napoleon. And my ambition has been growing steadily ever since.",author:"Salvador Dali"},{text:"Quality is more important than quantity. One home run is much better than two doubles.",author:"Steve Jobs"},{text:"That's one small step for man, one giant leap for mankind.",author:"Neil Armstrong"},{text:"Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.",author:"Scott Adams"},{text:"Nothing will work unless you do.",author:"Maya Angelou"},{text:"The best way out is always through.",author:"Robert Frost"},{text:"An ant on the move does more than a dozing ox.",author:"Lao Tzu"},{text:"Show me a thoroughly satisfied man and I will show you a failure.",author:"Thomas Edison"},{text:"Our greatest glory is not in never failing, but in rising up every time we fail.",author:"Ralph Waldo Emerson"},{text:"Every act of creation is first of all an act of destruction.",author:"Pablo Picasso"},{text:"Fun is good.",author:"Dr. Seuss"},{text:"I steal from every movie ever made.",author:"Quentin Tarantino"},{text:"It is the working man who is the happy man. It is the idle man who is the miserable man.",author:"Ben Franklin"},{text:"A person who never made a mistake never tried anything new.",author:"Albert Einstein"},{text:"To be idle is a short road to death and to be diligent is a way of life.",author:"Buddha"},{text:"The way to get started is to quit talking and begin doing.",author:"Walt Disney"},{text:"For every dark night, there's a brigher day.",author:"Tupac Shakur"},{text:"If you love life, don't waste time, for time is what life is made up of.",author:"Bruce Lee"},{text:"You can never quit. Winners never quit, and quitters never win.",author:"Ted Turner"},{text:"Work spares us from three evils: boredom, vice and need.",author:"Voltaire"},{text:"Focus is a matter of deciding what things you're not going to do.",author:"John Carmack"},{text:"I play to win, whether during practice or a real game.",author:"Michael Jordan"},{text:"HULK SMASH!",author:"The Incredible Hulk"},{text:"The harder the conflict, the more glorious the triumph.",author:"Thomas Paine"},{text:"Everything comes to him who hustles while he waits.",author:"Thomas Edison"},{text:"You've got to jump off cliffs and build your wings on the way down.",author:"Ray Bradbury"},{text:"Amateurs practice until they get it right. Professionals practice until they can't get it wrong.",author:"Unknown"},{text:"Genius is one percent inspiration and ninety-nine percent perspiration.",author:"Thomas Edison"},{text:"A lot of times, people don't know what they want until you show it to them.",author:"Steve Jobs"},{text:"I don't know where I'm going, but I'm on my way.",author:"Carl Sagan"},{text:"Lost time is never found again.",author:"Benjamin Franklin"},{text:"Without pain, without sacrifice, we would have nothing.",author:"Tyler Durden"},{text:"I pay no attention whatever to anybody's praise or blame. I simply follow my own feelings.",author:"Wolfgang Amadeus Mozart"},{text:"You miss 100% of the shots you don't take.",author:"Wayne Gretzky"},{text:"To have a great idea, have a lot of them.",author:"Thomas Edison"},{text:"The value of an idea lies in the using of it.",author:"Thomas Edison"},{text:"Simplify, simplify, simplify.",author:"Henry David Thoreau"},{text:"There's a way to do it better - find it.",author:"Thomas Edison"},{text:"When it is obvious that the goals cannot be reached, don't adjust the goals, adjust the steps.",author:"Confucius"},{text:"During your life, never stop dreaming. No one can take away your dreams.",author:"Tupac Shakur"},{text:"Things do not happen. Things are made to happen.",author:"John F. Kennedy"},{text:"Ambition should be made of sterner stuff.",author:"William Shakespeare"},{text:"If you spend too much time thinking about a thing, you'll never get it done.",author:"Bruce Lee"},{text:"Success breeds success.",author:"Proverb"},{text:"You are never too old to set another goal or to dream a new dream.",author:"C.S. Lewis"},{text:"When you stop doing things for fun, you might as well be dead.",author:"Ernest Hemingway"},{text:"There is no substitute for hard work.",author:"Thomas Edison"},{text:"Live long and prosper.",author:"Spock"},{text:"I have not failed. I've just found 10,000 ways that won't work.",author:"Thomas Edison"},{text:"It's lack of faith that makes people afraid of meeting challenges, and I believed in myself.",author:"Muhammad Ali"},{text:"All our dreams can come true, if we have the courage to pursue them.",author:"Walt Disney"},{text:"Make everything as simple as possible, but not simpler.",author:"Albert Einstein"},{text:"Some people want it to happen, some wish it would happen, others make it happen.",author:"Michael Jordan"},{text:"I've got a theory that if you give 100% all the time, somehow things will work out in the end.",author:"Larry Bird"},{text:"The problem with the future is that it keeps turning into the present.",author:"Bill Watterson"},{text:"May the Force be with you.",author:"Han Solo"},{text:"Victory belongs to the most persevering.",author:"Napoleon Bonaparte"},{text:"I hated every minute of training, but I said, 'Dont quit. Suffer now and live the rest of your life as a champion'.",author:"Muhammad Ali"},{text:"Do things that have never been done before.",author:"Russell Kirsch"},{text:"I've failed over and over and over again in my life and that is why I succeed.",author:"Michael Jordan"},{text:"A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty.",author:"Winston Churchill"},{text:"He who hesitates is lost.",author:"Proverb"},{text:"Carpe diem, seize the day boys, make your lives extraordinary.",author:"John Keating"},{text:"Doing the best at this moment puts you in the best place for the next moment.",author:"Oprah Winfrey"},{text:"Luck is preparation meeting opportunity.",author:"Oprah Winfrey"},{text:"I have no special talent. I am only passionately curious.",author:"Albert Einstein"}]}),angular.module("enplug.sdk.utils").constant("states",[{name:"Alabama",code:"AL"},{name:"Alaska",code:"AK"},{name:"Arizona",code:"AZ"},{name:"Arkansas",code:"AR"},{name:"California",code:"CA"},{name:"Colorado",code:"CO"},{name:"Connecticut",code:"CT"},{name:"Delaware",code:"DE"},{name:"District of Columbia",code:"DC"},{name:"Florida",code:"FL"},{name:"Georgia",code:"GA"},{name:"Hawaii",code:"HI"},{name:"Idaho",code:"ID"},{name:"Illinois",code:"IL"},{name:"Indiana",code:"IN"},{name:"Iowa",code:"IA"},{name:"Kansa",code:"KS"},{name:"Kentucky",code:"KY"},{name:"Lousiana",code:"LA"},{name:"Maine",code:"ME"},{name:"Maryland",code:"MD"},{name:"Massachusetts",code:"MA"},{name:"Michigan",code:"MI"},{name:"Minnesota",code:"MN"},{name:"Mississippi",code:"MS"},{name:"Missouri",code:"MO"},{name:"Montana",code:"MT"},{name:"Nebraska",code:"NE"},{name:"Nevada",code:"NV"},{name:"New Hampshire",code:"NH"},{name:"New Jersey",code:"NJ"},{name:"New Mexico",code:"NM"},{name:"New York",code:"NY"},{name:"North Carolina",code:"NC"},{name:"North Dakota",code:"ND"},{name:"Ohio",code:"OH"},{name:"Oklahoma",code:"OK"},{name:"Oregon",code:"OR"},{name:"Pennsylvania",code:"PA"},{name:"Rhode Island",code:"RI"},{name:"South Carolina",code:"SC"},{name:"South Dakota",code:"SD"},{name:"Tennessee",code:"TN"},{name:"Texas",code:"TX"},{name:"Utah",code:"UT"},{name:"Vermont",code:"VT"},{name:"Virginia",code:"VA"},{name:"Washington",code:"WA"},{name:"West Virginia",code:"WV"},{name:"Wisconsin",code:"WI"},{name:"Wyoming",code:"WY"}]),angular.module("enplug.sdk.utils").constant("years",function(){"use strict";for(var yearsToShow=20,thisYear=(new Date).getFullYear(),years=[],year=thisYear;year<thisYear+yearsToShow;year++)years.push({name:year.toString(),code:year.toString().slice(-2)});return years}()),angular.module("enplug.sdk.utils").directive("alert",function(){"use strict";return{restrict:"E",transclude:!0,scope:!0,replace:!0,templateUrl:"sdk-utils/alert.tpl"}}),angular.module("enplug.sdk.utils").directive("displayCounter",function(){return{restrict:"E",replace:!0,scope:{count:"=",showDanger:"=?",vertical:"=?",disabled:"=?"},templateUrl:"sdk-utils/display-counter.tpl",link:function(scope,element,attrs){scope.showDanger="showDanger"in attrs&&0==scope.showDanger,scope.checkDanger=function(){scope.showDanger&&scope.count<=0?element.addClass("danger"):element.removeClass("danger")},scope.checkDanger(),"vertical"in scope&&scope.vertical===!0&&element.addClass("vertical"),"disabled"in scope&&scope.disabled===!0&&element.addClass("disabled"),scope.$watch("count",function(){scope.checkDanger()})}}}),angular.module("enplug.sdk.utils").directive("downloadCsv",["$document","$log",function($document,$log){return{restrict:"A",scope:{epDownloadCsv:"="},link:function(scope,element){element.bind("click",function(){var fileName=scope.epDownloadCsv.fileName,downloadFunction=scope.epDownloadCsv.downloadFunction;$log.debug(fileName);var promise=downloadFunction();promise.then(function(data){var downloadLink=angular.element("<a></a>").attr("href","data:text/csv;charset=utf8,"+encodeURIComponent(data)).attr("download",fileName);downloadLink.insertAfter(element),downloadLink.ready(function(){downloadLink.get(0).click(),downloadLink.remove()})})})}}}]),angular.module("enplug.sdk.utils").directive("dropdownMenu",function(){"use strict";return{link:function(scope,element){element.addClass("dropdown-menu"),element.on("click",function(event){var target=angular.element(event.target);(target.attr("href")||target.parent().attr("href"))&&scope.$emit("dropdown:toggle"),scope.$apply(function(){scope.$emit("dropdown:click")})})}}}),angular.module("enplug.sdk.utils").directive("dropdownToggle",function(){"use strict";return{link:function(scope,element){element.addClass("dropdown-toggle"),element.on("click",function(){scope.$apply(function(){scope.$broadcast("dropdown:toggle")})})}}}),angular.module("enplug.sdk.utils").directive("dropdown",["$document","$timeout",function($document,$timeout){return{scope:!0,link:function(scope,element){function closeDropdown(){element.addClass("closing"),$timeout(function(){element.removeClass("open"),element.removeClass("closing"),$document.off("click",closeDropdown)},300)}function toggle(){element.hasClass("open")?closeDropdown():open()}function open(){element.addClass("open"),$document.on("click",function(event){element[0].contains(event.target)||closeDropdown()})}element.addClass("dropdown-wrap"),scope.$on("dropdown:toggle",toggle),scope.$on("dropdown:click",toggle),scope.$on("$destroy",function(){$document.off("click",closeDropdown)})}}}]),angular.module("enplug.sdk.utils").directive("colorPicker",["$document","$timeout","ColorTools","PositionTools",function($document,$timeout,ColorTools,PositionTools){"use strict";return{restrict:"E",transclude:!0,scope:{hex:"=?",rgb:"=?",alpha:"=?"},templateUrl:"sdk-utils/color-picker.tpl",link:function(scope,element,attrs){function setHEX(val){scope.hex=val,scope.hexInput=val}function setRGB(val){scope.rgb=val,setRed(val[0]),setGreen(val[1]),setBlue(val[2])}function setRed(val){scope.red=Math.round(val)}function setGreen(val){scope.green=Math.round(val)}function setBlue(val){scope.blue=Math.round(val)}function setHue(val){scope.hue=val,$hue[0].$cursor.css("left",(1-scope.hue)*$hue[0].clientWidth+"px")}function setSaturation(val){scope.saturation=val,$saturation[0].$cursor.css("left",scope.saturation*$saturation[0].clientWidth+"px")}function setBrightness(val){scope.brightness=val,$saturation[0].$cursor.css("top",(1-val)*$saturation[0].clientHeight+"px")}function setAlpha(val){scope.alpha=parseFloat(val.toFixed(2)),scope.alphaPercent=parseFloat((100*scope.alpha).toFixed(2)),scope.noAlpha||$alpha[0].$cursor.css("left",scope.alpha*$alpha[0].clientWidth+"px")}var labelAlpha=angular.element(element[0].querySelector(".channel-alpha")),labelHex=(angular.element(element[0].querySelector(".channel-red")),angular.element(element[0].querySelector(".channel-green")),angular.element(element[0].querySelector(".channel-blue")),angular.element(element[0].querySelector(".hex-input"))),$palette=angular.element(element[0].querySelector(".palette")),$swatch=angular.element(element[0].querySelector(".swatch"));scope.opened=!1;var $hue=angular.element(element[0].querySelector(".hue"));$hue[0].$cursor=angular.element($hue[0].querySelector(".cursor"));var $alpha=angular.element(element[0].querySelector(".alpha-slider"));$alpha[0].$cursor=angular.element($alpha[0].querySelector(".cursor"));var $saturation=angular.element(element[0].querySelector(".saturation"));if($saturation[0].$cursor=angular.element($saturation[0].querySelector(".cursor")),attrs.hasOwnProperty("showAsRgb")?scope.showAs="rgb":scope.showAs="hex",scope.toggleShowAs=function(){scope.showAs="hex"==scope.showAs?"rgb":"hex"},scope.noAlpha=attrs.hasOwnProperty("noAlpha"),scope.hasOwnProperty("hex")){setHEX(scope.hex.replace(/^#/,"")),setRGB(ColorTools.hex2rgb(parseInt(scope.hex,16)));var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}else if(scope.hasOwnProperty("rgb")){setRGB(scope.rgb),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]));var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}else console.warn("[ColorPicker] Something insane just happened!");scope.hasOwnProperty("alpha")&&!isNaN(scope.alpha)||(scope.alpha=1),setAlpha(scope.alpha),$saturation.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var top=Math.max(0,Math.min($saturation[0].clientHeight,event.pageY-PositionTools.getTop($saturation[0]))),left=Math.max(0,Math.min($saturation[0].clientWidth,event.pageX-PositionTools.getLeft($saturation[0])));setSaturation(left/$saturation[0].clientWidth),setBrightness(1-top/$saturation[0].clientHeight),setRGB(ColorTools.hsl2rgb(scope.hue,scope.saturation,scope.brightness)),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]))})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),$hue.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var left=Math.max(0,Math.min($hue[0].clientWidth,event.pageX-PositionTools.getLeft($hue[0])));setHue(1-left/$hue[0].clientWidth),setRGB(ColorTools.hsl2rgb(scope.hue,scope.saturation,scope.brightness)),setHEX(ColorTools.rgb2hex(scope.rgb[0],scope.rgb[1],scope.rgb[2]))})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),$alpha.on("mousedown",function(event){var mousemove,mouseup;mousemove=function(event){return scope.$apply(function(){var left=Math.max(0,Math.min($alpha[0].clientWidth,event.pageX-PositionTools.getLeft($alpha[0])));setAlpha(left/$alpha[0].clientWidth)})},mouseup=function(){$document.unbind("mousemove",mousemove),$document.unbind("mouseleave",mouseup),$document.unbind("mouseup",mouseup)},event.preventDefault(),mousemove(event),$document.on("mousemove",mousemove),$document.on("mouseleave",mouseup),$document.on("mouseup",mouseup)}),scope.$watch("alphaPercent",function(){setAlpha(labelAlpha[0].value/100)}),scope.getHueColor=function(){var rgb=ColorTools.hsl2rgb(scope.hue,1,1),hex=ColorTools.rgb2hex(rgb[0],rgb[1],rgb[2]);return hex},scope.watchRGBInputChange=function(){setRGB([scope.red,scope.green,scope.blue]);var hsl=ColorTools.rgb2hsl(scope.red,scope.green,scope.blue);setHEX(ColorTools.rgb2hex(scope.red,scope.green,scope.blue)),setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])},scope.watchHEXInputChange=function(){labelHex[0].value.match(/[^0-9a-fA-F\.]/g)&&(labelHex[0].value=labelHex[0].value.replace(/[^0-9a-fA-F\.]/g,""));for(var fixed=labelHex[0].value.split(""),hex="",i=0,l=6;i<l;i++)hex+=i<fixed.length?fixed[i]:0;scope.hex=hex,setRGB(ColorTools.hex2rgb(parseInt(scope.hex,16)));var hsl=ColorTools.rgb2hsl(scope.red,scope.green,scope.blue);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])};var outterClickHandler=function(event){var isInside=event.pageY>PositionTools.getTop($palette[0])&&event.pageY<PositionTools.getTop($swatch[0])+$swatch[0].clientHeight+$palette[0].clientHeight&&event.pageX>PositionTools.getLeft($palette[0])&&event.pageX<PositionTools.getLeft($palette[0])+$palette[0].clientWidth;if(!isInside)return scope.$apply(function(){scope.opened=!1,$document.unbind("mousedown",outterClickHandler)})};scope.toggle=function(){scope.opened=!scope.opened,scope.opened?($timeout(function(){setAlpha(scope.alpha);var hsl=ColorTools.rgb2hsl(scope.rgb[0],scope.rgb[1],scope.rgb[2]);setHue(hsl[0]),setSaturation(hsl[1]),setBrightness(hsl[2])}),$document.bind("mousedown",outterClickHandler)):$document.unbind("mousedown",outterClickHandler)},element.on("$destroy",function(){$document.unbind("mousedown",outterClickHandler)})}}}]),angular.module("enplug.sdk.utils").directive("equals",function(){function getter(property,object){var splitModel=property.split(".");return splitModel.reduce(function(map,key){return map[key]},object)}return{restrict:"A",require:"?ngModel",link:function($scope,$element,$attrs,$ngModel){function validate(){var val1=$ngModel.$viewValue,val2=getter($attrs.equals,$scope);$ngModel.$setValidity("equals",!val1||!val2||val1===val2)}$scope.$watch($attrs.ngModel,function(){validate()}),$scope.$watch($attrs.equals,function(){validate()})}}}),angular.module("enplug.sdk.utils").directive("materialCheckbox",["$log","$compile","GUID",function($log,$compile,GUID){"use strict";var ignoreAttributes=["class","field","label","ng-if","ng-show","ng-hide","ng-repeat"];return{restrict:"E",scope:{model:"=field"},transclude:!0,templateUrl:"sdk-utils/material-checkbox.tpl",link:function($scope,$element,$attrs,$ctrl,$transclude){$element.addClass("material-checkbox"),$scope.id=GUID.new(),$scope.label=$attrs.label,$transclude(function(clone){if(clone){for(var hasInput=!1,i=0;i<clone.length;i++)"input"==clone[i].nodeName.toLowerCase()&&(hasInput=!0);hasInput?($element.find("input").remove(),$element.find("label").prepend(clone),$element.find("input").attr("id",$scope.id),$element.find("input").attr("type","checkbox")):angular.element($element[0].querySelector(".checkbox-label")).append(clone)}});var input=$element.find("input")[0];angular.forEach($attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&($element.removeAttr(attr),input.setAttribute(attr,value))});var checkbox=$element.find("label")[0];$compile(checkbox)($scope)}}}]),angular.module("enplug.sdk.utils").directive("materialInput",["$log","$compile","$parse","$document","GUID",function($log,$compile,$parse,$document,GUID){"use strict";return{restrict:"E",require:"^form",scope:{model:"=field"},transclude:!0,templateUrl:"sdk-utils/material-input.tpl",link:function($scope,$element,$attrs,$form,$transclude){var ignoreAttributes=["class","label","directives","field","focus","ng-if","ng-show","ng-hide"],input=$document[0].createElement("input"),directives=$parse($attrs.directives)($scope),autofocus="undefined"!=typeof $attrs.autofocus,id=$attrs.field+"-"+GUID.new();$scope.id=id,$scope.label=$attrs.label,$element.removeAttr("label"),input.setAttribute("name",id),$element.parent().hasClass("form-group")||$element.addClass("form-group"),angular.forEach($attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&($element.removeAttr(attr),input.setAttribute(attr,value))}),input.getAttribute("type")||input.setAttribute("type","text"),input.setAttribute("class","form-control"),input.setAttribute("ng-model","model"),input.setAttribute("ng-class","{ active: model }"),input.setAttribute("ng-model-options","{ allowInvalid: true, debounce: 100 }"),input.setAttribute("id",$scope.id),angular.forEach(directives,function(value,directive){input.setAttribute(directive,value)}),$element.removeAttr("directives"),$transclude(function(clone){var hasInput=!1;if(clone){for(var newInput,i=0;i<clone.length;i++)"input"==clone[i].nodeName.toLowerCase()&&(hasInput=!0,newInput=clone[i]);hasInput?(newInput.setAttribute("class","form-control"),newInput.setAttribute("id",$scope.id),input.setAttribute("name",$scope.id),newInput.setAttribute("ng-class","{ active: model }"),newInput.setAttribute("ng-model","model"),$compile(clone)($scope),$element.prepend(clone)):$element.append(clone)}hasInput||($compile(input)($scope),$element.prepend(input))}),autofocus&&input.focus(),$scope.formField=$form[id],$scope.$watch("model",function(val){void 0!==val&&null!==val&&$scope.formField&&($scope.formField.$dirty=!0)})}}}]),angular.module("enplug.sdk.utils").directive("materialRadio",["$log","$compile",function($log,$compile){"use strict";var ignoreAttributes=["class","field","label","ng-if","ng-show","ng-hide","ng-repeat"];return{restrict:"E",scope:{model:"=field"},transclude:!0,replace:!0,templateUrl:"sdk-utils/material-radio.tpl",link:function(scope,element,attrs){element.addClass("material-radio");var input=element.find("input")[0];angular.forEach(attrs,function(value,_attr){var attr=_attr.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();attr.indexOf("$")===-1&&ignoreAttributes.indexOf(attr)===-1&&(element.removeAttr(attr),input.setAttribute(attr,value))}),$compile(input)(scope)}}}]),angular.module("enplug.sdk.utils").directive("materialSelect",["$timeout",function($timeout){"use strict";function findSelect(clone){for(var i=0;i<clone.length;i++)if("select"==clone[i].nodeName.toLowerCase())return angular.element(clone[i])}return{restrict:"E",scope:!0,transclude:!0,templateUrl:"sdk-utils/material-select.tpl",link:function(scope,element,attrs,ctrl,transclude){element.addClass("material-select"),scope.label=attrs.label,element.removeAttr("label"),transclude(function(clone){var select=findSelect(clone);select?scope.$watch("$parent."+select.attr("ng-model"),function(val){"undefined"!=typeof val&&null!==val&&(element.addClass("selected"),$timeout(function(){scope.label=select[0].options[select[0].selectedIndex].label}))}):console.warn("Warning: material-select requires a <select> element to be transcluded."); | ||
})}}}]),angular.module("enplug.sdk.utils").directive("materialSwitch",function(){"use strict";function findInput(clone){for(var i=0;i<clone.length;i++)if("input"==clone[i].nodeName.toLowerCase())return angular.element(clone[i])}return{restrict:"E",transclude:!0,replace:!0,templateUrl:"sdk-utils/material-switch.tpl",scope:{model:"="},link:function(scope,element,attrs,ctrl,transclude){scope.dirty=!1,transclude(function(clone){findInput(clone)&&angular.element(element[0].querySelector(".default-input")).remove()})}}}),angular.module("enplug.sdk.utils").directive("helpBlock",function(){"use strict";return{templateUrl:"sdk-utils/help-block.tpl",restrict:"E"}}),angular.module("enplug.sdk.utils").directive("layoutToggle",["$rootScope",function($rootScope){"use strict";return{restrict:"E",templateUrl:"sdk-utils/layout-toggle.tpl",replace:!0,link:function(scope){$rootScope.showGridLayout!==!1&&($rootScope.showGridLayout=!0),scope.toggleLayout=function(){$rootScope.showGridLayout=!$rootScope.showGridLayout}}}}]),angular.module("enplug.sdk.utils").directive("gridLayout",function(){"use strict";return{link:function(scope,element){scope.$watch("showGridLayout",function(bool){bool?element.removeClass("ng-hide"):element.addClass("ng-hide")})}}}),angular.module("enplug.sdk.utils").directive("tableLayout",function(){"use strict";return{link:function(scope,element){scope.$watch("showGridLayout",function(bool){bool?element.addClass("ng-hide"):element.removeClass("ng-hide")})}}}),angular.module("enplug.sdk.utils").directive("loading",[function(){"use strict";function isPromise(val){return"object"==typeof val&&"function"==typeof val.then}return{restrict:"E",templateUrl:"sdk-utils/loading.tpl",transclude:!0,replace:!1,scope:{isLoading:"=condition"},link:function(scope,element){element.addClass("loading-wrapper"),isPromise(scope.isLoading)?(scope.loading=!0,scope.isLoading.then(function(){scope.loading=!1},function(){scope.error=!0})):(scope.loading=scope.isLoading,scope.$watch("isLoading",function(val){scope.loading=val}))}}}]),angular.module("enplug.sdk.utils").directive("locationAware",["$location",function($location){"use strict";return{restrict:"A",replace:!1,link:function(scope,element,attrs){function getPath(){var path=attrs.href||attrs.ngHref||attrs.locationAware;if(!path){var anchor=element.find("a");anchor&&(path=anchor.attr("href")||anchor.attr("ngHref"))}return path}function checkActive(){var path=getPath();path===$location.path()?element.addClass("active"):element.removeClass("active")}checkActive(),scope.$on("$routeChangeSuccess",checkActive)}}}]),angular.module("enplug.sdk.utils").directive("notice",function(){"use strict";return{restrict:"E",transclude:!0,scope:!0,replace:!0,templateUrl:"sdk-utils/alert.tpl",link:function(scope){scope.notice=!0}}}),angular.module("enplug.sdk.utils").directive("proTip",["$log","ProTips",function($log,ProTips){return{restrict:"E",replace:!0,scope:!0,templateUrl:"sdk-utils/protip.tpl",link:function(scope,element,attrs){var path=attrs.tip,config=_.get(ProTips,path);_.isString(config)?scope.config={tip:config}:_.isObject(config)?scope.config=config:($log.error("Did not find pro tip config for path:",path),element.remove())}}}]),angular.module("enplug.sdk.utils").directive("statusButton",["$log","$timeout",function($log,$timeout){"use strict";function isPromise(val){return"object"==typeof val&&"function"==typeof val.then}var showStatusDelay=2e3;return{restrict:"E",replace:!0,scope:{condition:"=condition",action:"&"},transclude:!0,templateUrl:"sdk-utils/status-button.tpl",link:function(scope,element,attrs){function handlePromise(promise){scope.isLoading=!0,promise.then(function(){scope.success=!0},function(){scope.error=!0}).finally(function(){element[0].blur(),scope.isLoading=!1,$timeout(function(){scope.success=!1,scope.error=!1},showStatusDelay)})}element.hasClass("btn")||(element.addClass("btn"),element.addClass("btn-default")),scope.action&&element.bind("click",function(event,data){scope.$apply(function(){var promise=scope.action({data:data});isPromise(promise)?handlePromise(promise):$log.warn("Status button action must return a promise.")})}),"undefined"!=typeof attrs.condition&&(scope.isLoading=scope.condition,scope.$watch("condition",function(val){scope.isLoading=val}))}}}]),angular.module("enplug.sdk.utils").filter("stNestedSearch",[function(){function getter(model,item){var splitModel=model.split(".");return splitModel.reduce(function(map,key){return map[key]},item)}return function(items,filters){var itemsLeft=items.slice();return Object.keys(filters).forEach(function(model){var value=filters[model];itemsLeft=itemsLeft.filter(function(item){var compare=getter(model,item);if(null!==compare&&void 0!==compare)return String(compare).toLowerCase().indexOf(value.toLowerCase())>=0})}),itemsLeft}}]),angular.module("enplug.sdk.utils").filter("stNestedSort",[function(){function getter(property,item){var properties=property.split(".");return properties.reduce(function(map,key){return map[key]},item)}return function(input,property,descending){return Array.isArray(input)?input.concat().sort(function(a,b){var sortOrder=1;descending&&(sortOrder=-1);var aVal=getter(property,a),bVal=getter(property,b),result=aVal<bVal?-1:aVal>bVal?1:0;return result*sortOrder}):input}}]),angular.module("enplug.sdk.utils").directive("stSummary",[function(){return{restrict:"E",require:"^stTable",template:'<div class="summary">Showing {{ stRange.from }}-{{ stRange.to }} of {{ size }}</div>',link:function($scope,$element,$attrs,$stTable){$scope.$watch($stTable.getFilteredCollection,function(val){$scope.size=(val||[]).length}),$scope.$watch("currentPage",function(){$scope.stRange={from:null,to:null},$scope.stRange.from=$stTable.tableState().pagination.start+1,$scope.stRange.to=$scope.currentPage===$scope.numPages?$scope.size:$scope.stRange.from+$scope.stItemsByPage-1})}}}]),angular.module("enplug.sdk.utils").directive("tagInput",function(){return{restrict:"E",replace:!0,scope:{tags:"="},templateUrl:"sdk-utils/tag-input.tpl",link:function(scope,element,attrs){function processTags(offset){for(var words=scope.input.split(" "),i=offset;i<words.length;i++)scope.tags.indexOf(words[i])===-1&&scope.tags.push(words[i]),words.splice(i--,1);scope.input=words.join(" ")}scope.deleteTag=function(tag){for(var i=0,l=scope.tags.length;i<l;i++)scope.tags[i]===tag&&scope.tags.splice(i,1)},scope.handleTextChange=function(){null!=scope.input&&processTags(1)},scope.handleKeyPress=function(event){null!=scope.input&&(13!=event.charCode&&32!=event.charCode||" "!==scope.input&&0!==scope.input.length&&processTags(0))}}}}),angular.module("enplug.sdk.utils").directive("tagSelect",function(){return{restrict:"E",replace:!0,scope:{tags:"=",selectedTags:"="},templateUrl:"sdk-utils/tag-select.tpl",link:function(scope,element,attrs){scope.toggleSelection=function(tag){var index=scope.selectedTags.indexOf(tag);index>-1?scope.selectedTags.splice(index,1):scope.selectedTags.push(tag)},scope.isSelected=function(tag){return scope.selectedTags.indexOf(tag)>-1}}}}),angular.module("enplug.sdk.utils").directive("tooltip",["Tooltips",function(Tooltips){"use strict";return{restrict:"E",templateUrl:"sdk-utils/tooltip.tpl",replace:!0,scope:!0,link:function(scope,element,attrs){var tip=attrs.tip,config=_.get(Tooltips,tip)||{};"string"!=typeof config.position&&(config.position="top center"),config.text||(config.text=tip),config.link&&~config.link.location.indexOf("http")&&element.find("a").attr("target","_blank"),scope.config=config}}}]),angular.module("enplug.sdk.utils").factory("ColorTools",[function(){function rgb2hsl(r,g,b){var rr,gg,bb,h,s,r=arguments[0]/255,g=arguments[1]/255,b=arguments[2]/255,v=Math.max(r,g,b),diff=v-Math.min(r,g,b),diffc=function(c){return(v-c)/6/diff+.5};return 0==diff?h=s=0:(s=diff/v,rr=diffc(r),gg=diffc(g),bb=diffc(b),r===v?h=bb-gg:g===v?h=1/3+rr-bb:b===v&&(h=2/3+gg-rr),h<0?h+=1:h>1&&(h-=1)),[h,s,v]}function hsl2rgb(h,s,v){var r,g,b,i,f,p,q,t,hue;if(null!=h.h&&(v=h.b,s=h.s,h=h.h),h%=360,h<1&&(h*=360),s=s>1?1:s<0?0:s,v=v>1?1:v<0?0:v,hue=h,0==s)r=g=b=v;else switch(h/=60,f=h-(i=Math.floor(h)),p=v*(1-s),q=v*(1-s*f),t=v*(1-s*(1-f)),i){case 0:r=v,g=t,b=p;break;case 1:r=q,g=v,b=p;break;case 2:r=p,g=v,b=t;break;case 3:r=p,g=q,b=v;break;case 4:r=t,g=p,b=v;break;case 5:r=v,g=p,b=q}return[Math.floor(255*r),Math.floor(255*g),Math.floor(255*b)]}function hex2rgb(hex){return[hex>>16&255,hex>>8&255,255&hex]}function rgb2hex(r,g,b){for(var hex=(65536*r+256*g+b).toString(16,6);hex.length<6;)hex="0"+hex;return hex}return{rgb2hsl:rgb2hsl,hsl2rgb:hsl2rgb,hex2rgb:hex2rgb,rgb2hex:rgb2hex}}]),angular.module("enplug.sdk.utils").service("DetectChanges",["$log",function($log){"use strict";function log(field){$log.debug("Change detected:",field)}var fields=[];return{watch:function(watchForChanges,scope,verbose){return fields=[],_.isObject(scope)?(_.isArray(watchForChanges)||(watchForChanges=[watchForChanges]),watchForChanges.forEach(function(watcher){var field={property:watcher,changed:!1};field.original=_.cloneDeep(watcher.split(".").reduce(function(map,key){return map[key]},scope)),field.type=typeof field.original,fields.push(field),_.isArray(field.original)?scope.$watch(field.property,function(newValue,oldValue){field.changed=!_.isEqual(newValue,field.original),field.current=newValue,verbose&&newValue!==oldValue&&log(field)},!0):_.isDate(field.original)?(field.type="Date",scope.$watch(field.property,function(newValue){_.isDate(newValue)?field.changed=field.original.getTime()!==newValue.getTime():field.changed=!0,field.current=newValue,verbose&&log(field)})):scope.$watch(field.property,function(newValue,oldValue){field.changed=newValue!==field.original,field.current=newValue,verbose&&newValue!==oldValue&&log(field)})}),void(verbose&&$log.debug("[DetectChanges] Registered fields to watch:",fields))):void $log.error("Detect changes requires $scope.")},hasChanges:function(){var changed=_.filter(fields,{changed:!0});return changed.length>0},fieldsChanged:function(){return _.pluck(_.filter(fields,{changed:!0}),"property")},reset:function(){fields=[]}}}]),angular.module("enplug.sdk.utils").factory("GUID",[function(){function s4(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return{new:function(){return s4()+s4()+"-"+s4()+"-"+s4()+"-"+s4()+"-"+s4()+s4()+s4()}}}]),angular.module("enplug.sdk.utils").factory("PositionTools",["$window",function($window){function getOffset(element){var docElem,rect,doc;if(rect=element.getBoundingClientRect(),rect.width||rect.height||element.getClientRects().length)return doc=element.ownerDocument,docElem=doc.documentElement,{top:rect.top+$window.pageYOffset-docElem.clientTop,left:rect.left+$window.pageXOffset-docElem.clientLeft}}function getLeft(element){var docElem,rect,doc;if(rect=element.getBoundingClientRect(),rect.width||rect.height||element.getClientRects().length)return doc=element.ownerDocument,docElem=doc.documentElement,rect.left+$window.pageXOffset-docElem.clientLeft}function getTop(element){var docElem,rect,doc;if(rect=element.getBoundingClientRect(),rect.width||rect.height||element.getClientRects().length)return doc=element.ownerDocument,docElem=doc.documentElement,rect.top+$window.pageYOffset-docElem.clientTop}return{getOffset:getOffset,getLeft:getLeft,getTop:getTop}}]),angular.module("enplug.sdk.utils").factory("ScriptLoaderService",["$q","$document","$timeout",function($q,$document,$timeout){"use strict";return{loadScript:function(callback,src){var defer=$q.defer(),script=$document[0].createElement("script");return script.src=src,$document[0].body.appendChild(script),script.onload=script.onreadystatechange=function(){$timeout(function(){callback()?defer.resolve():defer.reject("Error occurred. Please try again.")})},script.onerror=function(){$timeout(function(){defer.reject("Error. Please try again.")})},defer.promise}}}]),angular.module("enplug.sdk.utils.templates",[]).run(["$templateCache",function($templateCache){"use strict";$templateCache.put("sdk-utils/alert.tpl",'<div class=alert><i ng-hide=notice class="ion-alert-circled alert-icon"></i> <i ng-show=notice class="ion-information-circled alert-icon"></i><ng-transclude class=alert-body></ng-transclude></div>'),$templateCache.put("sdk-utils/color-picker.tpl","<div class=color-picker ng-blur=close()><div class=swatch ng-style=\"{ 'background-color': '#' + hex }\" ng-click=toggle()></div><div class=transcluded ng-transclude ng-click=toggle()></div><div class=palette ng-class=\"{ 'opened': opened }\"><div class=saturation ng-class=\"{ 'no-alpha': noAlpha }\" ng-style=\"{ 'background-color': '#' + getHueColor() }\"><div class=cursor></div></div><div class=preview ng-style=\"{ 'background-color': '#' + hex }\"></div><div class=hue><div class=cursor></div></div><div class=numbers><ul class=clearfix ng-class=\"{ 'show-as-hex': showAs=='hex', 'show-as-rgb': showAs=='rgb' }\"><li class=\"\"><label>R:</label><input class=channel-red type=number name=channel-red min=0 max=255 ng-model=red ng-change=watchRGBInputChange()></li><li class=\"\"><label>G:</label><input class=channel-green type=number name=channel-green min=0 max=255 ng-model=green ng-change=watchRGBInputChange()></li><li class=\"\"><label>B:</label><input class=channel-blue type=number name=channel-blue min=0 max=255 ng-model=blue ng-change=watchRGBInputChange()></li><li class=iconic ng-click=toggleShowAs()><i class=\"icon ion-android-options\"></i></li><li class=hex-values><label>#</label><input class=hex-input name=hex-input maxlength=6 ng-model=hexInput ng-change=watchHEXInputChange()></li></ul></div><div class=alpha ng-hide=noAlpha><div class=field><label>A:</label><input class=channel-alpha type=number name=channel-alpha min=0 max=100 ng-model=alphaPercent></div><div class=alpha-slider ng-style=\"{ 'background-color': '#' + hex }\"><div class=cursor></div></div></div></div></div>"),$templateCache.put("sdk-utils/display-counter.tpl","<div class=display-counter><span ng-bind=count class=binding></span></div>"),$templateCache.put("sdk-utils/help-block.tpl",'<footer class="footer-help block-center"><div class="info-message text-gray"><i class="ion-help-circled text-primary"></i> Need help? Go to the <a href=http://support.enplug.com/hc/en-us target=_blank>Enplug Help Center</a></div></footer>'),$templateCache.put("sdk-utils/layout-toggle.tpl",'<div class="btn-group layout-toggle"><button ng-click=toggleLayout() ng-disabled=showGridLayout class="btn btn-default btn-icon btn-sm ion-android-apps grid-toggle"></button> <button ng-click=toggleLayout() ng-disabled=!showGridLayout class="btn btn-default btn-icon btn-sm ion-navicon table-toggle"></button></div>'),$templateCache.put("sdk-utils/loading.tpl","<div class=loading-directive ng-show=loading><div class=loader ng-hide=error><svg class=circular><circle class=path cx=32 cy=32 r=30 fill=none stroke-width=2></circle></svg></div><div ng-show=error><p>There was an error.</p></div></div><ng-transclude class=loading-content ng-hide=loading></ng-transclude>"),$templateCache.put("sdk-utils/material-checkbox.tpl",'<div class=checkbox><label for="{{ id }}"><input id="{{ id }}" type=checkbox ng-model=model> <span class=checkbox-material><span class=check></span></span> <span class=checkbox-label><span ng-bind=label></span></span></label></div>'),$templateCache.put("sdk-utils/material-input.tpl",'<label for="{{ ::id }}" ng-bind=::label></label><div class=validation ng-messages=formField.$error ng-if=formField.$dirty><span class=text-danger ng-message=required>This is required.</span> <span class=text-danger ng-message=email>Please enter a valid email address.</span> <span class=text-danger ng-message=url>Please enter a valid URL starting with http:// or https://</span> <span class=text-danger ng-message=equals>Passwords must match.</span></div>'),$templateCache.put("sdk-utils/material-radio.tpl","<div class=radio><label><input type=radio ng-model=model> <span class=radio-on></span> <span class=radio-off></span><ng-transclude></ng-transclude></label></div>"),$templateCache.put("sdk-utils/material-select.tpl","<span class=form-label ng-bind=label></span><ng-transclude></ng-transclude>"),$templateCache.put("sdk-utils/material-switch.tpl","<label class=material-switch ng-class=\"{ 'switch-on': model, 'switch-off': !model, dirty: dirty }\" ng-click=\"dirty = true\"><input class=default-input type=checkbox ng-model=model><ng-transclude></ng-transclude></label>"),$templateCache.put("sdk-utils/protip.tpl",'<div class=pro-tip><i class="ion-flash text-primary"></i> <strong>ProTip:</strong> <span ng-bind=::config.tip></span> <a ng-if=::config.link dynamic-click=::config.link.action dynamic-href=::config.link.location ng-bind=::config.link.text></a></div>'),$templateCache.put("sdk-utils/status-button.tpl",'<button class=status-button><i class=ion-load-a ng-show=isLoading></i> <i class=ion-checkmark-circled ng-show="!isLoading && success"></i> <i class=ion-alert-circled ng-show="!isLoading && error"></i><ng-transclude></ng-transclude></button>'),$templateCache.put("sdk-utils/tag-input.tpl",'<div class="tag-input clearfix"><ul class="list clearfix"><li class=tag ng-repeat="tag in tags track by $index">{{tag}} <i ng-click=deleteTag(tag) class="icon ion-android-close"></i></li><li><input name=fname placeholder="Add tags" ng-model=input ng-change=handleTextChange() ng-keypress="handleKeyPress($event)"></li></ul></div>'),$templateCache.put("sdk-utils/tag-select.tpl",'<div class="tag-select clearfix"><ul class="list clearfix"><li class=tag ng-repeat="tag in tags track by $index" ng-click=toggleSelection(tag) ng-class="{ \'selected\': isSelected(tag) }">{{tag}}</li></ul></div>'),$templateCache.put("sdk-utils/tooltip.tpl",'<span class=glossaryTip><sup ng-hide=::config.tooltip class="icon ion-help-circled text-gray-light"></sup> <span class=tipText ng-show=::config.tooltip ng-bind=::config.tooltip></span> <span class=tip ng-class=::config.position><span class="tip-content radius shadow"><span ng-if=config.title class="tipTitle text-gd" ng-bind=::config.title></span> <span class="tipBody text-reset" ng-bind=::config.text ng-class="{ pt: !config.title, pb: !config.link }"></span> <a ng-if=::config.link class=link-reset ng-href="{{ ::config.link.location }}" ng-bind=::config.link.title></a> <span class=tipArrow></span></span></span></span>')}]); |
{ | ||
"name": "@enplug/dashboard-sdk-utils", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/dashboard-sdk-utils.js", |
@@ -17,5 +17,5 @@ /** | ||
count: '=', | ||
showDanger: '=', | ||
vertical: '=', | ||
disabled: '=' | ||
showDanger: '=?', | ||
vertical: '=?', | ||
disabled: '=?' | ||
}, | ||
@@ -22,0 +22,0 @@ |
Sorry, the diff of this file is too big to display
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
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
588286