UNPKG

gumga-date-ng

Version:

Gumga Date

1 lines 31.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}}();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")]};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)?(b(n),I?(d(),f(),!0):c()):c()}function l(n){n&&(E=n,I&&o.val(y(h(o.val()))))}function g(n){return I?(_=h(n||""),z=m(_),r.$setValidity("mask",z),z&&_.length?y(_):void 0):n}function s(n){return I?(_=h(n||""),z=m(_),r.$viewValue=_.length?y(_):"",r.$setValidity("mask",z),""===_&&i.required&&r.$setValidity("required",!r.$error.required),z?_:void 0):n}function c(){return I=!1,p(),angular.isDefined(Z)?o.attr("placeholder",Z):o.removeAttr("placeholder"),angular.isDefined(G)?o.attr("maxlength",G):o.removeAttr("maxlength"),o.val(r.$modelValue),r.$viewValue=r.$modelValue,!1}function d(){_=N=h(r.$modelValue||""),A=S=y(_),z=m(_);var n=z&&_.length?A:"";i.maxlength&&o.attr("maxlength",2*F[F.length-1]),Z||o.attr("placeholder",E),o.val(n),r.$viewValue=n,r.$setValidity("mask",z)}function f(){B||(o.bind("blur",w),o.bind("mousedown mouseup",x),o.bind(j.eventsToHandle.join(" "),V),o.bind("paste",k),B=!0)}function p(){B&&(o.unbind("blur",w),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",k),B=!1)}function m(n){return!n.length||n.length>=Y}function h(n){var e="",t=$.slice();return n=n.toString(),angular.forEach(P,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(E.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 D(){return E.replace(/[_]+/g,"_").replace(/([^_]+)([a-zA-Z0-9])([^_])/g,"$1$2_$3").split("_")}function b(n){var e=0;if(F=[],$=[],E="","string"==typeof n){Y=0;var t=!1,a=0,o=n.split("");angular.forEach(o,function(n,o){j.maskDefinitions[n]?(F.push(e),E+=v(o-a),$.push(j.maskDefinitions[n]),e++,t||Y++):"?"===n?(t=!0,a++):(E+=n,e++)})}F.push(F.slice().pop()+1),P=D(),I=F.length>1}function w(){j.clearOnBlur&&(R=0,L=0,z&&0!==_.length||(A="",o.val(""),a.$apply(function(){r.$setViewValue("")})))}function x(n){"mousedown"===n.type?o.bind("mouseout",M):o.unbind("mouseout",M)}function M(){L=H(this),o.unbind("mouseout",M)}function k(){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,f=F[0],p=F[l.length]||F.slice().shift(),m=L||0,v=H(this)>0,D=m>0,b=i.length>u.length||m&&i.length>u.length-m,w=i.length<u.length||m&&i.length===u.length-m,x=e>=37&&e<=40&&n.shiftKey,M=37===e,k=8===e||"keyup"!==t&&w&&-1===d,V=46===e||"keyup"!==t&&w&&0===d&&!D,$=(M||k||"click"===t)&&s>f;if(L=H(this),!x&&(!v||"click"!==t&&"keyup"!==t)){if("input"===t&&w&&!D&&l===g){for(;k&&s>f&&!C(s);)s--;for(;V&&s<p&&-1===F.indexOf(s);)s++;var E=F.indexOf(s);l=l.substring(0,E)+l.substring(E+1)}for(a=y(l),S=a,N=l,o.val(a),r.$setViewValue(l),b&&s<=f&&(s=f+1),$&&s--,s=s>p?p:s<f?f:s;!C(s)&&s>f&&s<p;)s+=$?-1:1;($&&s<p||b&&!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,$,E,P,Y,_,A,z,S,N,R,L,I=!1,B=!1,Z=i.placeholder,G=i.maxlength,j=t;i.gumgaDateMaskOptions?(j=a.$eval(i.gumgaDateMaskOptions),angular.isObject(j)&&(j=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,j))):j=t,i.$observe("gumgaDateMask",u),angular.isDefined(i.gumgaDateMaskPlaceholder)?i.$observe("gumgaDateMaskPlaceholder",l):i.$observe("placeholder",l);var U=!1;i.$observe("modelViewValue",function(n){"true"===n&&(U=!0)}),a.$watch(i.ngModel,function(e){if(U&&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={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 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 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 <style>"+o.default+"</style>\n\n "+i+'\n\n <div class="gumga-date" 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(n,e){g.inputFormat=g.config.format?g.config.format:g.getDefaultConfiguration().format;var t=g.getMinYear(),a=g.getMaxYear(),o=g.config.timeZone?g.config.timeZone:g.getDefaultConfiguration().timeZone,i=moment(n,g.inputFormat.toUpperCase().replace("HH:MM","hh:mm")).tz(o).toDate();n&&"Invalid Date"!=i&&i.getFullYear()>=t&&i.getFullYear()<=a?(g.gumgaDateValue=i,e||g.setNgModel(g.gumgaDateValue),g.config.change&&g.config.change(g.ngModel)):g.value=null}var g=n;g.uid=Math.floor(99999999*Math.random()),g.config=g.config||{},g.label=u.label,g.icon=u.icon,g.iconClick=function(n){n.stopPropagation(),r.find("input").focus()},g.isHoliday=function(n){return new a.DateHoliday(n.year+"-"+(n.mouth+1)+"-"+n.value,i.getHolidays()).isHoliday()},g.getNameHoliday=function(n){return new a.DateHoliday(n.year+"-"+(n.mouth+1)+"-"+n.value,i.getHolidays()).getNameHoliday()},g.getWeekdayClass=function(n){return moment(n.year+"-"+(n.mouth+1)+"-"+n.value,"YYYY-MM-DD").format("dddd").toLowerCase()},g.getDefaultConfiguration=function(){return i.getDefaultConfiguration()},g.dateBlur=function(n){g.ngBlur&&g.ngBlur({$event:n})},g.range=function(n,e,t){if(!g.opened)return[];t=t||1;for(var a=[],o=n;o<=e;o+=t)a.push(o);return a},g.getScrollSize=function(){if(g.gumgaDateValue){return 92*(g.gumgaDateValue.getFullYear()-g.getMinYear())-50}},g.getWeekDays=function(){return o.DATETIME_FORMATS.SHORTDAY.map(function(n){return n.substring(0,3)})},g.getGumgaMonths=function(n){return o.DATETIME_FORMATS.STANDALONEMONTH.map(function(e){return n?e.substring(0,3):e})};var s=function(n,e){return t("date")(n,e)},c=function(){g.type=-1!=g.inputFormat.toLowerCase().indexOf("hh:mm")&&-1==g.inputFormat.toLowerCase().indexOf("dd")?"HOUR":g.type,g.type=-1!=g.inputFormat.toLowerCase().indexOf("hh:mm")&&-1!=g.inputFormat.toLowerCase().indexOf("dd")?"DATE_HOUR":g.type,g.type=-1==g.inputFormat.toLowerCase().indexOf("hh:mm")&&-1!=g.inputFormat.toLowerCase().indexOf("dd")?"DATE":g.type,"HOUR"==g.type?g.alterView("hours"):g.alterView("days")},d=function(){if(g.inputFormat=g.config.format?g.config.format:g.getDefaultConfiguration().format,c(),g.mask=g.inputFormat.replace(/[a-zA-Z\d]/g,"9"),g.inputProperties={class:g.config.inputProperties&&g.config.inputProperties.class?g.config.inputProperties.class:g.getDefaultConfiguration().inputProperties.class,placeholder:g.config.inputProperties&&g.config.inputProperties.placeholder?g.config.inputProperties.placeholder:angular.noop()},g.style={fontColor:g.config.fontColor||g.getDefaultConfiguration().fontColor,background:g.config.background||g.getDefaultConfiguration().background},g.ngModel&&g.ngModel instanceof Date)g.gumgaDateValue=g.ngModel,g.setNgModel(g.gumgaDateValue);else if(g.ngModel&&"string"==typeof g.ngModel){var n=moment(g.ngModel).toDate();g.gumgaDateValue=n,g.setNgModel(g.gumgaDateValue)}else g.gumgaDateValue=new Date};g.alterView=function(n){e(function(){g.view=n,"months"==n&&(g.years||(g.years=g.range(g.getMinYear(),g.getMaxYear())),m())})};var f=void 0,p=function(n,e){angular.element(f).animate({scrollTop:n},400)};e(function(){f=document.getElementById("year-and-month-"+g.uid)},1e3);var m=function(){e(function(){var n=g.getScrollSize();p(n,f.scrollTop)})};g.handlingHours=function(n){g.gumgaDateValue.setHours(g.gumgaDateValue.getHours()+n),g.setNgModel(g.gumgaDateValue)},g.handlingMinutes=function(n){g.gumgaDateValue.setMinutes(g.gumgaDateValue.getMinutes()+n),g.setNgModel(g.gumgaDateValue)},g.getFormatLength=function(){return g.inputFormat?g.inputFormat.replace(/[^a-zA-Z0-9]/g,"").length:0},g.setGumgaDateValue=function(n,e){n&&l(n)},g.getMinYear=function(){return g.config.minYear?g.config.minYear:g.getDefaultConfiguration().minYear},g.getMaxYear=function(){return g.config.maxYear?g.config.maxYear:g.getDefaultConfiguration().maxYear},g.getMonth=function(){if(g.gumgaDateValue&&g.gumgaDateValue instanceof Date)return g.getGumgaMonths()[g.gumgaDateValue.getMonth()]},g.setDay=function(n,e){if(g.gumgaDateValue&&g.gumgaDateValue instanceof Date){var t=new Date;t.setYear(n.year),t.setMonth(n.mouth),t.setDate(n.value),t.setHours(g.gumgaDateValue.getHours()),t.setMinutes(g.gumgaDateValue.getMinutes()),t.setSeconds(g.gumgaDateValue.getSeconds()),g.gumgaDateValue=t,g.setNgModel(g.gumgaDateValue),g.config.change&&g.config.change(g.ngModel),(g.config.hasOwnProperty("closeOnChange")?g.config.closeOnChange:g.getDefaultConfiguration().closeOnChange)&&g.config.close()}},g.setYearAndMonth=function(n,e){g.gumgaDateValue&&g.gumgaDateValue instanceof Date&&g.getGumgaMonths(!0).forEach(function(t,a){if(t==e){var o=new Date;o.setYear(n),o.setMonth(a),o.setDate(g.gumgaDateValue.getDate()),o.setHours(g.gumgaDateValue.getHours()),o.setMinutes(g.gumgaDateValue.getMinutes()),o.setSeconds(g.gumgaDateValue.getSeconds()),g.gumgaDateValue=o,g.setNgModel(g.gumgaDateValue),g.alterView("days")}})},g.getYear=function(){if(g.gumgaDateValue)return g.gumgaDateValue.getFullYear()},g.isToday=function(n){return n.value==g.gumgaDateValue.getDate()&&n.mouth==g.gumgaDateValue.getMonth()},g.isThatMonth=function(n,e){return g.getGumgaMonths(!0)[g.gumgaDateValue.getMonth()]==e&&g.gumgaDateValue.getFullYear()==n},g.config.open=function(n){n&&n.stopPropagation(),(g.config.hasOwnProperty("showCalendar")?g.config.showCalendar:g.getDefaultConfiguration().showCalendar)&&(g.opened=!0,c(),w(g.gumgaDateValue.getMonth(),g.gumgaDateValue.getFullYear()))},g.config.close=function(){g.opened=!1,g.alterView("days")};g.handlingMonths=function(n,e){g.gumgaDateValue=moment(n).add(e,"months").toDate(),g.setNgModel(g.gumgaDateValue),"months"==g.view&&m()},g.$watch("config",function(){d()},!0),g.$watch("ngModel",function(n){e(function(){if(g.ngModel&&g.ngModel instanceof Date&&(g.gumgaDateValue=g.ngModel,w(n.getMonth(),n.getFullYear()),g.value=s(angular.copy(n),g.inputFormat)),g.ngModel&&"string"==typeof g.ngModel){var e=moment(g.ngModel).toDate();g.gumgaDateValue=e,w(e.getMonth(),e.getFullYear());var t=g.config.timeZone?g.config.timeZone:g.getDefaultConfiguration().timeZone,a=moment(g.value,g.inputFormat.toUpperCase().replace("HH:MM","hh:mm")).tz(t).toDate();g.value!=s(angular.copy(e),g.inputFormat)&&a.getMinutes()!=e.getMinutes()+1&&l(s(angular.copy(e),g.inputFormat),!0)}n||g.inputFocused||(g.gumgaDateValue=new Date,w(g.gumgaDateValue.getMonth(),g.gumgaDateValue.getFullYear()),g.value=null)})},!0),g.$watch("value",function(n){return n?g.setGumgaDateValue(n):g.ngModel=null}),g.setNgModel=function(n){var e=g.config.timeZone?g.config.timeZone:g.getDefaultConfiguration().timeZone;g.ngModel=moment.tz(n,e).format(),w(n.getMonth(),n.getFullYear()),g.value=s(angular.copy(n),g.inputFormat)},r.bind("click",function(n){n.stopPropagation()});var h=function(n){var t=void 0;switch(n.keyCode){case 38:t=moment(g.gumgaDateValue).add(-7,"days").toDate();break;case 40:t=moment(g.gumgaDateValue).add(7,"days").toDate();break;case 37:t=moment(g.gumgaDateValue).add(-1,"days").toDate();break;case 39:t=moment(g.gumgaDateValue).add(1,"days").toDate();break;case 13:g.setNgModel(g.gumgaDateValue),g.config.close();break;case 9:var a=g.config.hasOwnProperty("changeDateOnTab")?g.config.changeDateOnTab:g.getDefaultConfiguration().changeDateOnTab;g.inputFocused&&!g.ngModel&&a?(g.gumgaDateValue=new Date,g.setNgModel(g.gumgaDateValue)):g.inputFocused||g.config.close()}e(function(){g.opened&&t&&(n.stopPropagation(),g.gumgaDateValue=t,g.setNgModel(g.gumgaDateValue))})},y=function(n){var t=0;switch(n.keyCode){case 38:t=moment(g.gumgaDateValue).add(1,"minutes").toDate();break;case 40:t=moment(g.gumgaDateValue).add(-1,"minutes").toDate()}e(function(){0!=t&&g.opened&&(n.stopPropagation(),g.gumgaDateValue=t,g.setNgModel(g.gumgaDateValue))})},v=document.addEventListener("click",function(n){e(g.config.close)}),D=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(D(),function(n){angular.element(n).find("div.gumga-date").scope().config.close()})});var b=document.addEventListener("keydown",function(n){g.opened&&"days"==g.view?h(n):angular.noop(),g.opened&&"hours"==g.view?y(n):angular.noop()});g.$on("$destroy",function(){document.removeEventListener("click",v),document.removeEventListener("keyup",b)});var w=function(n,e){if(g.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"),s=0;s<t.getDay();s++)o[t.getDay()-1-s]={value:l.daysInMonth()-s,style:"color: #b7aaaa !important;",mouth:l.toDate().getMonth(),year:l.toDate().getFullYear()};g.rows=o}};g.getPosition=function(){switch((g.config.position?g.config.position:g.getDefaultConfiguration().position).toUpperCase()){case"LEFT_BOTTOM":return"top: 25px;left: -235px;";case"LEFT_TOP":if("days"==g.view||"months"==g.view)return"top: -290px;left: -235px;";if("hours"==g.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"==g.view||"months"==g.view)return"top: -290px;right: -235px;";if("hours"==g.view)return"top: -130px;right: -235px;";break;case"TOP_LEFT":if("days"==g.view||"months"==g.view)return"top: -325px;left: 15px;";if("hours"==g.view)return"top: -165px; left: 15px;";break;case"TOP_RIGHT":if("days"==g.view||"months"==g.view)return"top: -325px;right: 15px;";if("hours"==g.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 {\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: 13.1%;}\n }\n\n @media screen and (max-width: 420px) {\n .gumga-date > .weekdays li, .days li {\n width: 12.5%;\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: 12.2%;\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 }\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'}]);