UNPKG

gumga-date-ng

Version:

Gumga Date

1 lines 34.3 kB
!function(n){function e(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return n[a].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var t={};e.m=n,e.c=t,e.i=function(n){return n},e.d=function(n,t,a){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:a})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=4)}([function(n,e,t){"use strict";function a(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function n(n,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}return function(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}}();e.DateHoliday=function(){function n(e,t){a(this,n),this.date=moment(e,"YYYY-MM-DD"),this._holidays=t}return o(n,[{key:"isHoliday",value:function(){return void 0!=this.date.holiday(this._holidays)}},{key:"getNameHoliday",value:function(){return this.date.holiday(this._holidays)}}]),n}()},function(n,e,t){"use strict";!function(){function n(n){function e(n){return n===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(n.type||n.href||~n.tabIndex)}return{priority:100,require:"ngModel",restrict:"A",scope:!1,compile:function(){var t={maskDefinitions:{9:/\d/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},clearOnBlur:!0,eventsToHandle:["input","keyup","click","focus"]};return function(a,o,i,r){function u(n){return angular.isDefined(n)?(w(n),I?(d(),p(),!0):c()):c()}function l(n){n&&(P=n,I&&o.val(y(h(o.val()))))}function g(n){return I?(E=h(n||""),A=f(E),r.$setValidity("mask",A),A&&E.length?y(E):void 0):n}function s(n){return I?(E=h(n||""),A=f(E),r.$viewValue=E.length?y(E):"",r.$setValidity("mask",A),""===E&&i.required&&r.$setValidity("required",!r.$error.required),A?E:void 0):n}function c(){return I=!1,m(),angular.isDefined(B)?o.attr("placeholder",B):o.removeAttr("placeholder"),angular.isDefined(Z)?o.attr("maxlength",Z):o.removeAttr("maxlength"),o.val(r.$modelValue),r.$viewValue=r.$modelValue,!1}function d(){E=N=h(r.$modelValue||""),z=S=y(E),A=f(E);var n=A&&E.length?z:"";i.maxlength&&o.attr("maxlength",2*F[F.length-1]),B||o.attr("placeholder",P),o.val(n),r.$viewValue=n,r.$setValidity("mask",A)}function p(){j||(o.bind("blur",D),o.bind("mousedown mouseup",x),o.bind(G.eventsToHandle.join(" "),V),o.bind("paste",M),j=!0)}function m(){j&&(o.unbind("blur",D),o.unbind("mousedown",x),o.unbind("mouseup",x),o.unbind("input",V),o.unbind("keyup",V),o.unbind("click",V),o.unbind("focus",V),o.unbind("paste",M),j=!1)}function f(n){return!n.length||n.length>=_}function h(n){var e="",t=$.slice();return n=n.toString(),angular.forEach(Y,function(e){n=n.replace(e,"")}),angular.forEach(n.split(""),function(n){t.length&&t[0].test(n)&&(e+=n,t.shift())}),e}function y(n){var e="",t=F.slice();return angular.forEach(P.split(""),function(a,o){n.length&&o===t[0]?(e+=n.charAt(0)||"_",n=n.substr(1),t.shift()):e+=a}),e}function v(n){var e=angular.isDefined(i.gumgaDateMaskPlaceholder)?i.gumgaDateMaskPlaceholder:i.placeholder;return void 0!==e&&e[n]?e[n]:"_"}function b(){return P.replace(/[_]+/g,"_").replace(/([^_]+)([a-zA-Z0-9])([^_])/g,"$1$2_$3").split("_")}function w(n){var e=0;if(F=[],$=[],P="","string"==typeof n){_=0;var t=!1,a=0,o=n.split("");angular.forEach(o,function(n,o){G.maskDefinitions[n]?(F.push(e),P+=v(o-a),$.push(G.maskDefinitions[n]),e++,t||_++):"?"===n?(t=!0,a++):(P+=n,e++)})}F.push(F.slice().pop()+1),Y=b(),I=F.length>1}function D(){G.clearOnBlur&&(R=0,L=0,A&&0!==E.length||(z="",o.val(""),a.$apply(function(){r.$setViewValue("")})))}function x(n){"mousedown"===n.type?o.bind("mouseout",k):o.unbind("mouseout",k)}function k(){L=H(this),o.unbind("mouseout",k)}function M(){T(this,o.val().length)}function V(n){n=n||{};var e=n.which,t=n.type;if(16!==e&&91!==e){var a,i=o.val(),u=S,l=h(i),g=N,s=O(this)||0,c=R||0,d=s-c,p=F[0],m=F[l.length]||F.slice().shift(),f=L||0,v=H(this)>0,b=f>0,w=i.length>u.length||f&&i.length>u.length-f,D=i.length<u.length||f&&i.length===u.length-f,x=e>=37&&e<=40&&n.shiftKey,k=37===e,M=8===e||"keyup"!==t&&D&&-1===d,V=46===e||"keyup"!==t&&D&&0===d&&!b,$=(k||M||"click"===t)&&s>p;if(L=H(this),!x&&(!v||"click"!==t&&"keyup"!==t)){if("input"===t&&D&&!b&&l===g){for(;M&&s>p&&!C(s);)s--;for(;V&&s<m&&-1===F.indexOf(s);)s++;var P=F.indexOf(s);l=l.substring(0,P)+l.substring(P+1)}for(a=y(l),S=a,N=l,o.val(a),r.$setViewValue(l),w&&s<=p&&(s=p+1),$&&s--,s=s>m?m:s<p?p:s;!C(s)&&s>p&&s<m;)s+=$?-1:1;($&&s<m||w&&!C(c))&&s++,R=s,T(this,s)}}}function C(n){return F.indexOf(n)>-1}function O(n){if(!n)return 0;if(void 0!==n.selectionStart)return n.selectionStart;if(document.selection&&e(o[0])){n.focus();var t=document.selection.createRange();return t.moveStart("character",n.value?-n.value.length:0),t.text.length}return 0}function T(n,t){if(!n)return 0;if(0!==n.offsetWidth&&0!==n.offsetHeight)if(n.setSelectionRange)e(o[0])&&(n.focus(),n.setSelectionRange(t,t));else if(n.createTextRange){var a=n.createTextRange();a.collapse(!0),a.moveEnd("character",t),a.moveStart("character",t),a.select()}}function H(n){return n?void 0!==n.selectionStart?n.selectionEnd-n.selectionStart:document.selection?document.selection.createRange().text.length:0:0}var F,$,P,Y,_,E,z,A,S,N,R,L,I=!1,j=!1,B=i.placeholder,Z=i.maxlength,G=t;i.gumgaDateMaskOptions?(G=a.$eval(i.gumgaDateMaskOptions),angular.isObject(G)&&(G=function(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(void 0===e[t]?e[t]=angular.copy(n[t]):angular.extend(e[t],n[t]));return e}(t,G))):G=t,i.$observe("gumgaDateMask",u),angular.isDefined(i.gumgaDateMaskPlaceholder)?i.$observe("gumgaDateMaskPlaceholder",l):i.$observe("placeholder",l);var q=!1;i.$observe("modelViewValue",function(n){"true"===n&&(q=!0)}),a.$watch(i.ngModel,function(e){if(q&&e){n(i.ngModel).assign(a,r.$viewValue)}}),r.$formatters.push(g),r.$parsers.push(s),o.bind("mousedown mouseup",x)}}}}n.$inject=["$parse"],angular.module("gumga.date.mask",[]).directive("gumgaDateMask",n)}()},function(n,e,t){"use strict";!function(){var n=function(){var n={activeMobileMode:!1,background:"#1abc9c",primaryColor:"#1abc9c",fontColor:"#fff",format:"dd/MM/yyyy",minYear:1700,timeZone:"America/Sao_Paulo",maxYear:2050,position:"BOTTOM_LEFT",changeDateOnTab:!1,showCalendar:!0,closeOnChange:!1,inputProperties:{class:"form-control gmd"}},e={M:{"01/01":"Confraternização Universal","04/14":"Paixão de Cristo","04/21":"Tiradentes","05/01":"Dia do Trabalho","09/05":"Independência do Brasil","10/12":"Nossa Senhora Aparecida","11/02":"Finados","11/15":"Proclamação da República","12/25":"Natal"},W:{}},t=function(){return n},a=function(e){Object.keys(e).forEach(function(t){return n[t]=e[t]})},o=function(){return e},i=function(n,t){var a=moment(n).month()+1,o=moment(n).date();o<10&&(o="0"+o),a<10&&(a="0"+a),e.M[a+"/"+o]=t};return{getDefaultConfiguration:t,setDefaultConfiguration:a,getHolidays:o,addHoliday:i,$get:function(){return{getDefaultConfiguration:t,setDefaultConfiguration:a,getHolidays:o,addHoliday:i}}}};angular.module("gumga.date.service",[]).provider("GumgaDateService",n)}()},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=t(5),o=function(n){return n&&n.__esModule?n:{default:n}}(a),i=function(){try{return!!angular.module("gumga.layout")}catch(n){return!1}}()?'\n <div style="{{label ? \'height: 34px;\' : \'\'}}">\n <input ng-focus="config.open();inputFocused = true;"\n ng-blur="inputFocused = false;dateBlur($event);"\n ng-model="value"\n gumga-date-mask="{{mask}}"\n ng-disabled="ngDisabled"\n ng-keydown="keyPressInput($event)"\n class="gumga-date-input {{inputProperties.class}}"\n placeholder="{{inputProperties.placeholder}} "/>\n <span class="bar"></span>\n <label for="email" class="control-label" ng-if="label">{{label}}</label>\n <i class="material-icons" ng-show="icon" ng-click="iconClick($event);">{{icon}}</i>\n </div>\n ':'\n <div>\n <input ng-focus="config.open();inputFocused = true;"\n ng-blur="inputFocused = false;dateBlur($event);"\n ng-model="value"\n ng-keydown="keyPressInput($event)"\n gumga-date-mask="{{mask}}"\n ng-disabled="ngDisabled"\n class="gumga-date-input {{inputProperties.class}}"\n placeholder="{{inputProperties.placeholder}} "/>\n </div>\n ';e.default='\n <div class="date-backdrop" ng-click="config.close()" ng-show="opened && isMobile"></div>\n <style>'+o.default+"</style>\n\n "+i+'\n\n <div class="gumga-date" ng-class="{\'mobile-mode\' : isMobile}" ng-show="opened" id="gumga-date-{{uid}}" style="{{getPosition()}}">\n <div class="month" style="background:{{config.background ? config.background : getDefaultConfiguration().background}}">\n <ul>\n <span data-ng-click="alterView(\'hours\')"\n ng-hide="type == \'DATE\'" ng-show="view != \'hours\' || type == \'HOUR\'"\n class="hours">\n {{gumgaDateValue.getHours() < 10 ? "0"+gumgaDateValue.getHours() : gumgaDateValue.getHours()}}\n :\n {{gumgaDateValue.getMinutes() < 10 ? "0"+gumgaDateValue.getMinutes() : gumgaDateValue.getMinutes()}}\n </span><br>\n\n <span data-ng-click="alterView(\'days\')"\n ng-show="view == \'hours\' && (type == \'DATE\' || type == \'DATE_HOUR\') || type == \'DATE\'"\n class="hours">{{value}}</span>\n\n <br>\n <li ng-show="view != \'hours\' && (type == \'DATE\' || type == \'DATE_HOUR\')" class="prev" ng-click="handlingMonths(gumgaDateValue, -1)">&#10094;</li>\n <li ng-show="view != \'hours\' && (type == \'DATE\' || type == \'DATE_HOUR\')" class="next" ng-click="handlingMonths(gumgaDateValue, +1)">&#10095;</li>\n <li ng-show="view != \'hours\' && (type == \'DATE\' || type == \'DATE_HOUR\')" style="text-align:center">\n <span style="padding: 10px;" data-ng-click="alterView(\'months\')">{{getMonth()}}</span><br>\n <span data-ng-click="alterView(\'months\')" style="font-size:18px">{{getYear()}}</span>\n </li>\n\n <div class="gumga-date-hour" ng-show="view == \'hours\'">\n <span class="glyphicon glyphicon-chevron-up" ng-click="handlingHours(1)"></span>\n <li>{{gumgaDateValue.getHours() < 10 ? "0"+gumgaDateValue.getHours() : gumgaDateValue.getHours()}}</li>\n <span class="glyphicon glyphicon-chevron-down" ng-click="handlingHours(-1)"></span>\n </div>\n <div ng-show="view == \'hours\'" class="gumga-date-separator">\n <span>:</span>\n </div>\n <div class="gumga-date-minutes" ng-show="view == \'hours\'">\n <span class="glyphicon glyphicon-chevron-up" ng-click="handlingMinutes(1)"></span>\n <li >{{gumgaDateValue.getMinutes() < 10 ? "0"+gumgaDateValue.getMinutes() : gumgaDateValue.getMinutes()}}</li>\n <span class="glyphicon glyphicon-chevron-down" ng-click="handlingMinutes(-1)"></span>\n </div>\n\n </ul>\n </div>\n\n <div class="year-and-month" id="year-and-month-{{uid}}">\n <ul class="change-month" ng-show="view == \'months\'" ng-repeat="year in years">\n <span class="year">{{::year}}</span>\n\n <div style="width: 170px;float: right;">\n <li data-ng-repeat="month in getGumgaMonths(true)" data-ng-click="setYearAndMonth(year, month)">\n <span ng-class="{\'active\' : isThatMonth(year, month)}">{{::month}}</span>\n </li>\n </div>\n\n </ul>\n </div>\n\n <ul class="weekdays" ng-show="view == \'days\'">\n <li ng-repeat="weekday in getWeekDays()">{{weekday}}</li>\n </ul>\n <ul class="days" ng-show="view == \'days\'">\n <li data-ng-click="setDay(row, $event)" data-ng-repeat="row in rows track by $index" class="{{getWeekdayClass(row)}}">\n <span ng-class="{\'active\' : isToday(row), \'holiday\': isHoliday(row)}"\n data-tooltip="{{getNameHoliday(row)}}"\n style="{{row.style}}">\n {{row.value}}\n </span>\n </li>\n </ul>\n </div>\n\n'},function(n,e,t){"use strict";var a=t(0);!function(){t(2),t(1);var n=t(3).default,e=function(e,t,o,i){return{restrict:"E",template:n,scope:{config:"=?configuration",ngModel:"=",ngDisabled:"=?",ngBlur:"&?"},require:"^ngModel",link:function(n,r,u){function l(){var n=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(n=!0)}(navigator.userAgent||navigator.vendor||window.opera),n&&s.config.activeMobileMode}function g(n,e){s.inputFormat=s.config.format?s.config.format:s.getDefaultConfiguration().format;var t=s.getMinYear(),a=s.getMaxYear(),o=s.config.timeZone?s.config.timeZone:s.getDefaultConfiguration().timeZone,i=moment(n,s.inputFormat.toUpperCase().replace("HH:MM","hh:mm")).tz(o).toDate();n&&"Invalid Date"!=i&&i.getFullYear()>=t&&i.getFullYear()<=a?(s.gumgaDateValue=i,e||s.setNgModel(s.gumgaDateValue),s.config.change&&s.config.change(s.ngModel)):s.value=null}moment.fn.holiday=function(n){var e=1+(0|(this._d.getDate()-1)/7),t=1===this._d.getDay()&&this._d.getDate()+7>30?"5":null;return n.M[this.format("MM/DD")]||n.W[this.format("M/"+(t||e)+"/d")]};var s=n;s.uid=Math.floor(99999999*Math.random()),s.config=s.config||{},s.label=u.label,s.icon=u.icon,s.iconClick=function(n){n.stopPropagation(),r.find("input").focus()},s.isHoliday=function(n){return new a.DateHoliday(n.year+"-"+(n.mouth+1)+"-"+n.value,i.getHolidays()).isHoliday()},s.getNameHoliday=function(n){return new a.DateHoliday(n.year+"-"+(n.mouth+1)+"-"+n.value,i.getHolidays()).getNameHoliday()},s.getWeekdayClass=function(n){return moment(n.year+"-"+(n.mouth+1)+"-"+n.value,"YYYY-MM-DD").format("dddd").toLowerCase()},s.getDefaultConfiguration=function(){return i.getDefaultConfiguration()},s.dateBlur=function(n){s.ngBlur&&s.ngBlur({$event:n})},s.keyPressInput=function(n){9==n.keyCode&&s.opened&&s.config.close()},s.range=function(n,e,t){if(!s.opened)return[];t=t||1;for(var a=[],o=n;o<=e;o+=t)a.push(o);return a},s.getScrollSize=function(){if(s.gumgaDateValue){return 92*(s.gumgaDateValue.getFullYear()-s.getMinYear())-50}},s.getWeekDays=function(){return o.DATETIME_FORMATS.SHORTDAY.map(function(n){return n.substring(0,3)})},s.getGumgaMonths=function(n){return o.DATETIME_FORMATS.STANDALONEMONTH.map(function(e){return n?e.substring(0,3):e})};var c=function(n,e){return t("date")(n,e)},d=function(){s.type=-1!=s.inputFormat.toLowerCase().indexOf("hh:mm")&&-1==s.inputFormat.toLowerCase().indexOf("dd")?"HOUR":s.type,s.type=-1!=s.inputFormat.toLowerCase().indexOf("hh:mm")&&-1!=s.inputFormat.toLowerCase().indexOf("dd")?"DATE_HOUR":s.type,s.type=-1==s.inputFormat.toLowerCase().indexOf("hh:mm")&&-1!=s.inputFormat.toLowerCase().indexOf("dd")?"DATE":s.type,"HOUR"==s.type?s.alterView("hours"):s.alterView("days")},p=function(){if(s.inputFormat=s.config.format?s.config.format:s.getDefaultConfiguration().format,d(),s.mask=s.inputFormat.replace(/[a-zA-Z\d]/g,"9"),s.inputProperties={class:s.config.inputProperties&&s.config.inputProperties.class?s.config.inputProperties.class:s.getDefaultConfiguration().inputProperties.class,placeholder:s.config.inputProperties&&s.config.inputProperties.placeholder?s.config.inputProperties.placeholder:angular.noop()},s.style={fontColor:s.config.fontColor||s.getDefaultConfiguration().fontColor,background:s.config.background||s.getDefaultConfiguration().background},s.ngModel&&s.ngModel instanceof Date)s.gumgaDateValue=s.ngModel,s.setNgModel(s.gumgaDateValue);else if(s.ngModel&&"string"==typeof s.ngModel){var n=moment(s.ngModel).toDate();s.gumgaDateValue=n,s.setNgModel(s.gumgaDateValue)}else s.gumgaDateValue=new Date};s.alterView=function(n){e(function(){s.view=n,"months"==n&&(s.years||(s.years=s.range(s.getMinYear(),s.getMaxYear())),h())})};var m=void 0,f=function(n,e){angular.element(m).animate({scrollTop:n},400)};e(function(){m=document.getElementById("year-and-month-"+s.uid)},1e3);var h=function(){e(function(){var n=s.getScrollSize();f(n,m.scrollTop)})};s.handlingHours=function(n){s.gumgaDateValue.setHours(s.gumgaDateValue.getHours()+n),s.setNgModel(s.gumgaDateValue)},s.handlingMinutes=function(n){s.gumgaDateValue.setMinutes(s.gumgaDateValue.getMinutes()+n),s.setNgModel(s.gumgaDateValue)},s.isMobile=l(),s.getFormatLength=function(){return s.inputFormat?s.inputFormat.replace(/[^a-zA-Z0-9]/g,"").length:0},s.setGumgaDateValue=function(n,e){n&&g(n)},s.getMinYear=function(){return s.config.minYear?s.config.minYear:s.getDefaultConfiguration().minYear},s.getMaxYear=function(){return s.config.maxYear?s.config.maxYear:s.getDefaultConfiguration().maxYear},s.getMonth=function(){if(s.gumgaDateValue&&s.gumgaDateValue instanceof Date)return s.getGumgaMonths()[s.gumgaDateValue.getMonth()]},s.setDay=function(n,e){if(s.gumgaDateValue&&s.gumgaDateValue instanceof Date){var t=new Date;t.setYear(n.year),t.setMonth(n.mouth),t.setDate(n.value),t.setHours(s.gumgaDateValue.getHours()),t.setMinutes(s.gumgaDateValue.getMinutes()),t.setSeconds(s.gumgaDateValue.getSeconds()),s.gumgaDateValue=t,s.setNgModel(s.gumgaDateValue),s.config.change&&s.config.change(s.ngModel),(s.config.hasOwnProperty("closeOnChange")?s.config.closeOnChange:s.getDefaultConfiguration().closeOnChange)&&s.config.close()}},s.setYearAndMonth=function(n,e){s.gumgaDateValue&&s.gumgaDateValue instanceof Date&&s.getGumgaMonths(!0).forEach(function(t,a){if(t==e){var o=new Date;o.setYear(n),o.setMonth(a),o.setDate(s.gumgaDateValue.getDate()),o.setHours(s.gumgaDateValue.getHours()),o.setMinutes(s.gumgaDateValue.getMinutes()),o.setSeconds(s.gumgaDateValue.getSeconds()),s.gumgaDateValue=o,s.setNgModel(s.gumgaDateValue),s.alterView("days")}})},s.getYear=function(){if(s.gumgaDateValue)return s.gumgaDateValue.getFullYear()},s.isToday=function(n){return n.value==s.gumgaDateValue.getDate()&&n.mouth==s.gumgaDateValue.getMonth()},s.isThatMonth=function(n,e){return s.getGumgaMonths(!0)[s.gumgaDateValue.getMonth()]==e&&s.gumgaDateValue.getFullYear()==n},s.config.open=function(n){try{n&&n.stopPropagation(),(s.config.hasOwnProperty("showCalendar")?s.config.showCalendar:s.getDefaultConfiguration().showCalendar)&&(l()&&r.find("input")[0].blur(),s.opened=!0,d(),x(s.gumgaDateValue.getMonth(),s.gumgaDateValue.getFullYear()),e(function(){s.years||(s.years=s.range(s.getMinYear(),s.getMaxYear()))}))}catch(n){}},s.config.close=function(){s.opened=!1,s.alterView("days")};s.handlingMonths=function(n,e,t){s.gumgaDateValue=moment(n).add(e,"months").toDate(),s.setNgModel(s.gumgaDateValue),"months"==s.view&&h()},s.$watch("config",function(){p()},!0),s.$watch("ngModel",function(n){e(function(){if(s.ngModel&&s.ngModel instanceof Date&&(s.gumgaDateValue=s.ngModel,x(n.getMonth(),n.getFullYear()),s.value=c(angular.copy(n),s.inputFormat)),s.ngModel&&"string"==typeof s.ngModel){var e=moment(s.ngModel).toDate();s.gumgaDateValue=e,x(e.getMonth(),e.getFullYear());var t=s.config.timeZone?s.config.timeZone:s.getDefaultConfiguration().timeZone,a=moment(s.value,s.inputFormat.toUpperCase().replace("HH:MM","hh:mm")).tz(t).toDate();s.value!=c(angular.copy(e),s.inputFormat)&&a.getMinutes()!=e.getMinutes()+1&&g(c(angular.copy(e),s.inputFormat),!0)}n||s.inputFocused||(s.gumgaDateValue=new Date,x(s.gumgaDateValue.getMonth(),s.gumgaDateValue.getFullYear()),s.value=null)})},!0),s.$watch("value",function(n){return n?s.setGumgaDateValue(n):s.ngModel=null}),s.setNgModel=function(n){var e=s.config.timeZone?s.config.timeZone:s.getDefaultConfiguration().timeZone;s.ngModel=moment.tz(n,e).format(),x(n.getMonth(),n.getFullYear()),s.value=c(angular.copy(n),s.inputFormat)},r.bind("click",function(n){n.stopPropagation()});var y=function(n){var t=void 0;switch(n.keyCode){case 38:t=moment(s.gumgaDateValue).add(-7,"days").toDate();break;case 40:t=moment(s.gumgaDateValue).add(7,"days").toDate();break;case 37:t=moment(s.gumgaDateValue).add(-1,"days").toDate();break;case 39:t=moment(s.gumgaDateValue).add(1,"days").toDate();break;case 13:s.setNgModel(s.gumgaDateValue),s.config.close();break;case 9:var a=s.config.hasOwnProperty("changeDateOnTab")?s.config.changeDateOnTab:s.getDefaultConfiguration().changeDateOnTab;s.inputFocused&&!s.ngModel&&a?(s.gumgaDateValue=new Date,s.setNgModel(s.gumgaDateValue)):s.inputFocused||s.config.close()}e(function(){s.opened&&t&&(n.stopPropagation(),s.gumgaDateValue=t,s.setNgModel(s.gumgaDateValue))})},v=function(n){var t=0;switch(n.keyCode){case 38:t=moment(s.gumgaDateValue).add(1,"minutes").toDate();break;case 40:t=moment(s.gumgaDateValue).add(-1,"minutes").toDate()}e(function(){0!=t&&s.opened&&(n.stopPropagation(),s.gumgaDateValue=t,s.setNgModel(s.gumgaDateValue))})},b=document.addEventListener("click",function(n){e(s.config.close)}),w=function(){var n=angular.element("gumga-date");return n.filter(function(e){return!angular.equals(n[e],r[0])})};r.find("input")[0].addEventListener("focus",function(){angular.forEach(w(),function(n){angular.element(n).find("div.gumga-date").scope().config.close()})});var D=document.addEventListener("keydown",function(n){s.opened&&"days"==s.view?y(n):angular.noop(),s.opened&&"hours"==s.view?v(n):angular.noop()});s.$on("$destroy",function(){document.removeEventListener("click",b),document.removeEventListener("keyup",D)});var x=function(n,e){if(s.opened){for(var t=new Date(e,n,1),a=1,o=new Array(42),i=0;i<o.length;i++)o[i]="";for(var r=t.getDay();r<o.length;r++){var u=new Date(e,n,a);o[r]={value:u.getDate()},o[r].style=u.getMonth()!=n?"color: #b7aaaa !important;":"",o[r].style+=o[r].value<10?"padding-left: 9.75px;padding-right: 9.75px;":"",o[r].mouth=u.getMonth(),o[r].year=u.getFullYear(),a++}for(var l=moment(new Date(e,n,1)).add(-1,"months"),g=0;g<t.getDay();g++)o[t.getDay()-1-g]={value:l.daysInMonth()-g,style:"color: #b7aaaa !important;",mouth:l.toDate().getMonth(),year:l.toDate().getFullYear()};s.rows=o}};s.getPosition=function(){switch((s.config.position?s.config.position:s.getDefaultConfiguration().position).toUpperCase()){case"LEFT_BOTTOM":return"top: 25px;left: -235px;";case"LEFT_TOP":if("days"==s.view||"months"==s.view)return"top: -290px;left: -235px;";if("hours"==s.view)return"top: -130px;left: -235px;";break;case"BOTTOM_LEFT":return"left: 15px;";case"BOTTOM_RIGHT":return"right: 15px;";case"RIGHT_BOTTOM":return"right: -235px;";case"RIGHT_TOP":if("days"==s.view||"months"==s.view)return"top: -290px;right: -235px;";if("hours"==s.view)return"top: -130px;right: -235px;";break;case"TOP_LEFT":if("days"==s.view||"months"==s.view)return"top: -325px;left: 15px;";if("hours"==s.view)return"top: -165px; left: 15px;";break;case"TOP_RIGHT":if("days"==s.view||"months"==s.view)return"top: -325px;right: 15px;";if("hours"==s.view)return"top: -165px; right: 15px;"}}}}};e.$inject=["$timeout","$filter","$locale","GumgaDateService"],angular.module("gumga.date",["gumga.date.service","gumga.date.mask"]).directive("gumgaDate",e)}()},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default='\n\n scrollbar[orient="vertical"] scrollbarbutton,\n scrollbar[orient="vertical"] slider,\n scrollbar[orient="horizontal"] scrollbarbutton,\n scrollbar[orient="horizontal"] slider{\n display:none;\n }\n\n .gumga-date-input{\n width: 100%;\n }\n\n .year-and-month::-webkit-scrollbar {\n width: 10px;\n }\n\n .year-and-month::-webkit-scrollbar-track{\n -webkit-box-shadow: inset 0 0 6px #f5f5f5;\n }\n\n .year-and-month::-webkit-scrollbar-thumb {\n background-color: #ccc;\n outline: 1px solid slategrey;\n }\n\n .gumga-date-hour::-webkit-scrollbar, .gumga-date-minutes::-webkit-scrollbar {\n display: none;\n width: 1px;\n }\n\n .gumga-date-hour::-webkit-scrollbar-track, .gumga-date-minutes::-webkit-scrollbar-track {\n display: none;\n }\n\n .gumga-date-hour::-webkit-scrollbar-thumb, .gumga-date-minutes::-webkit-scrollbar-thumb {\n display: none;\n }\n\n gumga-date .date-backdrop{\n position: fixed;\n left: 0;\n top: 0;\n background: rgba(33,33,33,1.0);\n width: 100%;\n transition: opacity 450ms;\n height: 100%;\n z-index: 999999999;\n opacity: .48;\n }\n\n #gumga-date-{{uid}}.mobile-mode {\n position: fixed;\n left: 50% !important;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n .gumga-date {\n font-family: Verdana,sans-serif;\n box-sizing:border-box;\n width: 250px;\n box-shadow: 0 1px 3px 0 rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 2px 1px -1px rgba(0,0,0,.12);\n position: absolute;\n z-index: 999999999;\n display: inline-block;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n }\n\n .gumga-date-hour{\n width: 93px;\n float: left;\n text-align: center;\n height: 100px;\n overflow: hidden;\n overflow-y: scroll;\n }\n\n #gumga-date-{{uid}} .gumga-date-hour > span, #gumga-date-{{uid}} .gumga-date-minutes > span {\n color: {{config.fontColor ? config.fontColor : getDefaultConfiguration().fontColor}} !important;\n cursor: pointer;\n }\n\n #gumga-date-{{uid}} .gumga-date-separator{\n float: left;\n width: 13px;\n height: 100%;\n font-size: 25px;\n color: {{config.fontColor ? config.fontColor : getDefaultConfiguration().fontColor}} !important;\n padding-top: 35px;\n }\n\n .gumga-date-minutes{\n width: 93px;\n text-align: center;\n height: 100px;\n overflow: hidden;\n overflow-y: scroll;\n }\n\n .gumga-date-hour > li, .gumga-date-minutes > li{\n font-size: 40px !important;\n }\n\n #gumga-date-{{uid}} > .month > ul .hours {\n width: 100%;\n position: absolute;\n left: 0;\n top: 0;\n padding: 6px;\n font-size: 14px;\n cursor : pointer;\n text-align: center;\n color: {{style.fontColor ? style.fontColor : \'#fff\'}} !important;\n background: rgba(43, 38, 38, 0.21);\n height: 32px;\n }\n\n .gumga-date > .month > ul .hours:hover {\n font-size: 15px;\n transition: all 1s;\n }\n\n .gumga-date > .month {\n padding: 25px 25px;\n width: 100%;\n }\n\n .gumga-date > .month ul {\n margin: 0;\n list-style: none;\n padding: 0;\n }\n\n .gumga-date > .month ul li {\n color: white;\n font-size: 18px;\n text-transform: uppercase;\n cursor: pointer;\n letter-spacing: 3px;\n }\n\n .gumga-date > .month .prev {\n float: left;\n padding-top: 10px;\n outline: none;\n cursor: pointer;\n }\n\n .gumga-date > .month .next {\n float: right;\n padding-top: 10px;\n cursor: pointer;\n outline: none;\n }\n\n .gumga-date > .year-and-month {\n background-color: #eee;\n max-height: 204px;\n text-align: center;\n overflow-x: auto;\n transition-property: all;\n transition-duration: .5s;\n }\n\n .gumga-date > .weekdays, .gumga-date > .year-and-month > .change-month{\n margin: 0;\n padding: 10px 0;\n background-color: #ddd;\n padding-left: 3px;\n list-style: none;\n }\n\n .gumga-date > .year-and-month > .change-month {\n background-color: #eee;\n max-height: 210px;\n text-align: center;\n overflow: auto;\n }\n\n .gumga-date > .year-and-month > .change-month li {\n cursor: pointer;\n padding: 5px;\n width: 40px;\n text-align: center;\n float: left;\n font-size: 10px;\n }\n\n .gumga-date > .year-and-month > .change-month > .year{\n display: block;\n text-align: left;\n font-weight: 800;\n padding-left: 15px;\n margin-top: 27px;\n float: left;\n width: 60px;\n }\n\n .gumga-date > .weekdays li {\n display: inline-block;\n width: 35px;\n color: #666;\n text-align: center;\n }\n\n .gumga-date > .days {\n background: #eee;\n margin: 0;\n padding: 0;\n }\n\n .gumga-date > .days li {\n list-style-type: none;\n display: inline-block;\n width: 35.7px;\n text-align: center;\n margin-bottom: 0px;\n font-size:12px;\n color: #777;\n cursor: pointer;\n }\n\n .gumga-date > .days li .active {\n padding: 5px;\n color: white !important\n }\n\n @media screen and (max-width:720px) {\n .gumga-date > .weekdays li, .days li {width: 14.1%;}\n }\n\n @media screen and (max-width: 420px) {\n .gumga-date > .weekdays li, .days li {\n width: 14.1%;\n }\n .gumga-date > .days li .active {\n padding: 2px;\n }\n }\n\n @media screen and (max-width: 290px) {\n .gumga-date > .weekdays li, .days li {\n width: 14%;\n }\n }\n #gumga-date-{{uid}} > .month ul li {\n color: {{config.fontColor ? config.fontColor : getDefaultConfiguration().fontColor}};\n }\n #gumga-date-{{uid}} > .days li .active{\n background: {{config.primaryColor ? config.primaryColor : getDefaultConfiguration().primaryColor}} !important;\n border-radius: 50%;\n }\n #gumga-date-{{uid}} > .days li:hover{\n color: {{config.primaryColor ? config.primaryColor : getDefaultConfiguration().primaryColor}};\n }\n #gumga-date-{{uid}} > .year-and-month > .change-month li:hover{\n color: {{config.primaryColor ? config.primaryColor : getDefaultConfiguration().primaryColor}} !important;\n }\n #gumga-date-{{uid}} > .year-and-month > .change-month li .active{\n background: {{config.primaryColor ? config.primaryColor : getDefaultConfiguration().primaryColor}} !important;\n color: {{config.fontColor ? config.fontColor : getDefaultConfiguration().fontColor}} !important;\n padding: 5px;\n border-radius: 10px;\n }\n\n\n gumga-date > div {\n position: relative;\n }\n\n gumga-date i.material-icons{\n position: absolute;\n font-size: 20px;\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n margin: auto;\n top: 0;\n right: 10px;\n text-align: center;\n bottom: 0;\n padding-top: 7px;\n z-index: 2;\n cursor: pointer;\n }\n\n gumga-date li span.holiday {\n color: #F34235;\n }\n\n /* Add this attribute to the element that needs a tooltip */\n [data-tooltip] {\n position: relative;\n z-index: 2;\n cursor: pointer;\n }\n \n /* Hide the tooltip content by default */\n [data-tooltip]:before,\n [data-tooltip]:after {\n visibility: hidden;\n -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";\n filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);\n opacity: 0;\n pointer-events: none;\n }\n \n /* Position tooltip above the element */\n [data-tooltip]:before {\n position: absolute;\n bottom: 150%;\n left: 50%;\n margin-bottom: 5px;\n margin-left: -80px;\n padding: 7px;\n width: 160px;\n -webkit-border-radius: 3px;\n -moz-border-radius: 3px;\n border-radius: 3px;\n background-color: #000;\n background-color: hsla(0, 0%, 20%, 0.9);\n color: #fff;\n content: attr(data-tooltip);\n text-align: center;\n font-size: 14px;\n line-height: 1.2;\n }\n \n /* Triangle hack to make tooltip look like a speech bubble */\n [data-tooltip]:after {\n position: absolute;\n bottom: 150%;\n left: 50%;\n margin-left: -5px;\n width: 0;\n border-top: 5px solid #000;\n border-top: 5px solid hsla(0, 0%, 20%, 0.9);\n border-right: 5px solid transparent;\n border-left: 5px solid transparent;\n content: " ";\n font-size: 0;\n line-height: 0;\n }\n \n /* Show tooltip content on hover */\n [data-tooltip]:hover:before,\n [data-tooltip]:hover:after {\n visibility: visible;\n -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";\n filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);\n opacity: 1;\n }\n\n\n [data-tooltip=""]:after, [data-tooltip=""]:before{\n display: none;\n }\n\n .gumga-date > .days li{\n padding: 5px 0 5px 0;\n }\n\n gumga-date li.sunday, gumga-date li.saturday{\n background-color: rgba(255, 255, 255, 0.22);\n }\n\n\n'}]);