-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdate-picker.min.js.map
1 lines (1 loc) · 24.8 KB
/
date-picker.min.js.map
1
{"version":3,"sources":["model.js","unit.js","unit-year.js","unit-month.js","unit-date.js","date-picker.js"],"names":["define","Backbone","Model","extend","initialize","attr","this","date","val","moment","startOf","set","updateAttrs","dateValue","format","get","year","month","changeDate","key","add","save","setDate","_","isString","parseInt","reset","View","className","events","mousewheel","mouseenter","mouseleave","click","model","validate","opts","el","classList","options","divider","dataset","_onType","onType","bind","delta","typedVal","listenTo","render","$el","html","onMouseWheel","e","clearTimeout","onMouseWheelTimeout","preventDefault","stopPropagation","originalEvent","wheelDelta","Math","abs","deltaThreshold","decrease","increase","setTimeout","activate","window","__activeDatePickerUnit","deactivate","addEventListener","remove","removeEventListener","useTypedValue","isActive","contains","which","substr","length","parentView","shiftKey","activatePrev","activateNext","String","fromCharCode","maxLength","minLength","_onTypeTimeout","typeDelay","typedValueIsValid","UnitView","placeholder","isFunction","months","monthsShort","lpad","YearView","MonthView","DateView","appendTo","document","querySelector","defaultOpts","valFormat","navLink","saveOnBlur","onSave","onBlur","y","m","d","datepicker","toLowerCase","split","unitViews","dp","forEach","renderUnit","view","append","push","activeView","v","_activate","jump","loop","indx","indexOf","nextElementSibling","blur","focus","previousElementSibling","focusLast","num","value","onHover"],"mappings":"AAAA,AAAAA,OAAA,WAAA,WAEA,MAAAC,UAAAC,MAAAC,QAEAC,WAAA,SAAAC,MAEAC,KAAAC,KAAAF,KAAAG,IAAAC,OAAAJ,KAAAG,KAAAC,SAAAC,QAAA,QACAJ,KAAAK,IAAA,eAAAN,KAAAG,KACAF,KAAAM,eAIAC,UAAA,WACA,MAAAP,MAAAC,KAAAO,OAAA,eAGAF,YAAA,WACA,GAAAJ,KAAAF,KAAAS,IAAA,MACAT,MAAAK,KACAH,IAAAA,IAAAF,KAAAO,YAAA,GACAG,KAAAR,IAAAF,KAAAC,KAAAS,OAAA,GACAC,MAAAT,IAAAF,KAA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QAKA+H,MAAA,WACA,MAAA/H,MAAA4B,MAAA3B,KAAAO,OAAAR,KAAAiC,QAAA+D,YAGA5E,MAAA,WACApB,KAAA4B,MAAAR,QACApB,KAAA4B,MAAAnB,IAAA,SAAAT,KAAA4B,MAAAnB,IAAA,iBACAT,KAAA+B,GAAAC,UAAAgC,OAAA,YAGAjD,KAAA,WACAf,KAAA4B,MAAAvB,IAAA,eAAAL,KAAA4B,MAAAnB,IAAA,QACAT,KAAA+B,GAAAC,UAAAgC,OAAA,YAGAgE,QAAA,WACAhI,KAAA+B,GAAAC,UAAAlB,IAAA;ALvOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClLA,ADmLA;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA,ADqBA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5BA,AD6BA;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxBA,ADyBA;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"date-picker.min.js","sourcesContent":["define('model',[],function(){\n\n\treturn Backbone.Model.extend({\n\t\t\n\t\tinitialize: function(attr){\n\t\t\t\n\t\t\tthis.date = attr.val ? moment(attr.val) : moment().startOf('year')\n\t\t\tthis.set('original_val', attr.val)\n\t\t\tthis.updateAttrs()\n\t\t\t\n\t\t},\n\t\t\n\t\tdateValue: function(){\n\t\t\treturn this.date.format('YYYY-MM-DD')\n\t\t},\n\t\t\n\t\tupdateAttrs: function(){\n\t\t\tvar val = this.get('val')\n\t\t\tthis.set({\n\t\t\t\t'val': val ? this.dateValue() : '',\n\t\t\t\t'year': val ? this.date.year() : '',\n\t\t\t\t'month': val ? this.date.month() : '',\n\t\t\t\t'date': val ? this.date.date() : ''\n\t\t\t})\n\t\t},\n\t\t\n\t\tchangeDate: function(key, val){\n\t\t\tif( key == 'date' ) key = 'day'\n\t\t\tthis.date.add(val, key);\n\t\t\tthis.save()\n\t\t},\n\t\t\n\t\tsetDate: function(key, val){\n\t\t\t\n\t\t\tif( key == 'month' && _.isString(val) )\n\t\t\t\tval = parseInt(val) - 1; // months are zero indexed\n\t\t\t\n\t\t\tthis.date.set(key, val);\n\t\t\tthis.save()\n\t\t},\n\t\t\n\t\tsave: function(){\n\t\t\tthis.set('val', this.dateValue())\n\t\t\tthis.updateAttrs()\n\t\t},\n\t\t\n\t\treset: function(){\n\t\t\tthis.set('val', this.get('original_val'))\n\t\t\tif( this.get('val') )\n\t\t\t\tthis.date = moment(this.get('val'))\n\t\t\tthis.updateAttrs()\n\t\t}\n\t\n\t});\n\n});\n","define('unit',[],function(){\n\n\treturn Backbone.View.extend({\n\t\n\t\tclassName: 'unit',\n\t\t\n\t\tevents: {\n\t\t\t'mousewheel': 'onMouseWheel',\n\t\t\t'mouseenter': 'activate',\n\t\t\t'mouseleave': 'deactivate',\n\t\t\t'click': 'activate'\n\t\t},\n\t\t\n\t\tval: function(){\n\t\t\treturn this.model.get(this.key)\n\t\t},\n\t\t\n\t\tformat: function(val){\n\t\t\treturn val === '' ? '__' : val;\n\t\t},\n\t\t\n\t\tvalidate: function(val){\n\t\t\treturn false\n\t\t},\n\t\t\n\t\tinitialize: function(opts){\n\t\t\t\n\t\t\tthis.el.classList.add('unit-'+this.key)\n\t\t\t\n\t\t\tif( this.options.divider )\n\t\t\t\tthis.el.dataset.divider = this.options.divider\n\t\t\t\n\t\t\tthis._onType = this.onType.bind(this)\n\t\t\t\n\t\t\tthis.delta = 0\n\t\t\tthis.typedVal = '';\n\t\t\t\n\t\t\tthis.listenTo(this.model, 'change:'+this.key, this.render)\n\t\t},\n\t\t\n\t\trender: function(){\n\t\t\t\n\t\t\tif( this.typedVal )\n\t\t\t\tthis.$el.html( this.typedVal )\n\t\t\telse\n\t\t\t\tthis.$el.html( this.format(this.val()) )\n\t\t\t\n\t\t\treturn this;\n\t\t},\n\t\t\n\t\tonMouseWheel: function(e){\n\t\t\t\n\t\t\tclearTimeout(this.onMouseWheelTimeout)\n\t\t\t\n\t\t\te.preventDefault()\n\t\t\te.stopPropagation()\n\t\t\t\n\t\t\te = e.originalEvent\n\t\t\t// var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));\n\t\t\tvar delta = e.wheelDelta\n\t\t\t\n\t\t\t// if scrolling switched directions, reset delta back to 0\n\t\t\tif( (this.delta < 0 && delta > 0) || (this.delta > 0 && delta < 0) )\n\t\t\t\tthis.delta = 0;\n\t\t\t\t\n\t\t\tthis.delta += delta;\n\t\t\t\n\t\t\t// if we've scrolled enough, trigger a value change\n\t\t\tif( Math.abs(this.delta) >= this.options.deltaThreshold ){\n\t\t\t\t\n\t\t\t\tthis.delta < 0 ? this.decrease() : this.increase()\n\t\t\t\t\n\t\t\t\t// then reset the delta to begin counting the threshold again\n\t\t\t\tthis.delta = 0;\n\t\t\t}\n\t\t\t\n\t\t\t// reset delta after scrolling has stopped\n\t\t\tthis.onMouseWheelTimeout = setTimeout(function(){\n\t\t\t\tthis.delta = 0;\n\t\t\t}.bind(this),100)\n\t\t\t\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\tdecrease: function(){\n\t\t\tthis.model.changeDate(this.key, -1)\n\t\t},\n\t\t\n\t\tincrease: function(){\n\t\t\tthis.model.changeDate(this.key, 1)\n\t\t},\n\t\t\n\t\tactivate: function(){\n\t\t\tif( window.__activeDatePickerUnit ) window.__activeDatePickerUnit.deactivate()\n\t\t\twindow.__activeDatePickerUnit = this;\n\t\t\tthis.el.classList.add('active')\n\t\t\twindow.addEventListener('keydown', this._onType)\n\t\t},\n\t\t\n\t\tdeactivate: function(){\n\t\t\tif( window.__activeDatePickerUnit == this )\n\t\t\t\twindow.__activeDatePickerUnit = null;\n\t\t\tthis.el.classList.remove('active')\n\t\t\twindow.removeEventListener('keydown', this._onType)\n\t\t\t\n\t\t\tthis.useTypedValue()\n\t\t},\n\t\t\n\t\tisActive: function(){\n\t\t\treturn this.el.classList.contains('active')\n\t\t},\n\t\t\n\t\tonType: function(e){\n\t\t\t\n\t\t\t// backspace\n\t\t\tif( e.which == 8 ){\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.typedVal = this.typedVal.substr(0, this.typedVal.length-1)\n\t\t\t\tthis.render();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t// esc\n\t\t\tif( e.which == 27 ){\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.typedVal = '';\n\t\t\t\tthis.parentView.reset()\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t// tab, left arrow, right arrow, enter\n\t\t\tif( e.which == 9 || e.which == 37 || e.which == 39 || e.which == 13){\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\t\n\t\t\t\tif( e.which == 13 )\n\t\t\t\t\tthis.deactivate()\n\t\t\t\telse if( e.shiftKey || e.which == 37 )\n\t\t\t\t\tthis.parentView.activatePrev()\n\t\t\t\telse\n\t\t\t\t\tthis.parentView.activateNext()\n\t\t\t\t\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t// only accept numbers\n\t\t\t// TODO: I think I need to get codes for number pad too\n\t\t\tif( e.which < 48 || e.which > 57 ) return;\n\t\t\t\n\t\t\tthis.typedVal += String.fromCharCode(e.which) // keep as a string so the values concatenate\n\t\t\t\n\t\t\tthis.render();\n\t\t\t\n\t\t\tif( this.maxLength && this.typedVal.length >= this.maxLength )\n\t\t\t\tthis.useTypedValue()\n\t\t\telse if( !this.minLength || this.typedVal.length >= this.minLength )\n\t\t\t\tthis._onTypeTimeout = setTimeout(this.useTypedValue.bind(this), this.options.typeDelay)\n\t\t},\n\t\t\n\t\ttypedValueIsValid: function(){\n\t\t\treturn this.validate(this.typedVal)\n\t\t},\n\t\t\n\t\tuseTypedValue: function(){\n\t\t\t\n\t\t\tif( this.typedValueIsValid() ){\n\t\t\t\tthis.model.setDate(this.key, this.typedVal)\n\t\t\t\tthis.parentView.activateNext(false)\n\t\t\t}\n\t\t\t\n\t\t\tthis.typedVal = '';\n\t\t\tthis.render();\n\t\t}\n\t\n\t});\n\n});\n","define('unit-year',['unit'], function(UnitView){\n\n\treturn UnitView.extend({\n\t\t\n\t\tkey: 'year',\n\t\tminLength: 4,\n\t\tmaxLength: 4,\n\t\t\n\t\tformat: function(val){\n\t\t\treturn val === '' ? this.options.placeholder : val;\n\t\t},\n\t\t\n\t\t// `val` will always be a number string or empty string\n\t\tvalidate: function(val){\n\t\t\tif( !val || val.length !== 4 ) return false\n\t\t\treturn true\n\t\t}\n\t\t\n\t})\n\n});\n","define('unit-month',['unit'], function(UnitView){\n\n\treturn UnitView.extend({\n\t\t\n\t\tkey: 'month',\n\t\tmaxLength: 2,\n\t\t\n\t\tformat: function(val){\n\t\t\tif( _.isFunction(this.options.format) )\n\t\t\t\treturn this.options.format(val)\n\t\t\telse if( val === '' )\n\t\t\t\treturn this.options.placeholder\n\t\t\telse if( this.options.format == 'long' )\n\t\t\t\treturn moment.months()[val]\n\t\t\telse if( this.options.format == 'short' )\n\t\t\t\treturn moment.monthsShort()[val]\n\t\t\telse\n\t\t\t\treturn _.lpad(val+1, 2, '0')\n\t\t},\n\t\t\n\t\t// `val` will always be a number string or empty string\n\t\tvalidate: function(val){\n\t\t\tif( !val || val.length > 2 ) return false\n\t\t\treturn true\n\t\t}\n\t\t\n\t})\n\n});\n","define('unit-date',['unit'], function(UnitView){\n\n\treturn UnitView.extend({\n\t\t\n\t\tkey: 'date',\n\t\tmaxLength: 2,\n\t\t\n\t\tformat: function(val){\n\t\t\tif( _.isFunction(this.options.format) )\n\t\t\t\treturn this.options.format(val)\n\t\t\telse if( val === '' )\n\t\t\t\treturn this.options.placeholder\n\t\t\telse\n\t\t\t\treturn _.lpad(val, 2, '0')\n\t\t},\n\t\t\n\t\t// `val` will always be a number string or empty string\n\t\tvalidate: function(val){\n\t\t\tif( !val || val.length > 2 ) return false\n\t\t\treturn true\n\t\t}\n\t\t\n\t})\n\n});\n","/*\n\tBackbone.js Date Picker\n\t\n\t@author Kevin Jantzer, Blackstone Audio Inc.\n\t@since 2017-04-26\n\t\n\t@TODO\n\t- add ability to scroll a unit and only change that unit (right now, if scrolling from Dec to Jan, the year will change)\n\t- add support for time?\n\t- method for \"setting\" the date after initialization\n\t- add date range limiting (min and/or max)\n\t- add option for turning scroll feature off?\n*/\ndefine('date-picker',[\n\t'model',\n\t'unit-year',\n\t'unit-month',\n\t'unit-date'\n], function(Model, YearView, MonthView, DateView){\n\n\treturn Backbone.View.extend({\n\t\n\t\tclassName: 'datepicker',\n\t\t\n\t\tevents: {\n\t\t\t'mouseenter': 'onHover',\n\t\t\t'mouseleave': 'blur'\n\t\t},\n\t\t\n\t\tappendTo: function(el){\n\t\t\tif( _.isString(el) )\n\t\t\t\tel = document.querySelector(el)\n\t\t\tthis.render().$el.appendTo(el)\n\t\t},\n\t\t\n\t\tdefaultOpts: {\n\t\t\tappendTo: null,\n\t\t\tval: '',\n\t\t\tformat: 'y-m-d',\n\t\t\tvalFormat: 'YYYY-MM-DD',\n\t\t\tclassName: '',\n\t\t\tdeltaThreshold: 70, // how much scrolling is needed to change values\n\t\t\ttypeDelay: 340, // how long between keystrokes before using value\n\t\t\tnavLink: true, // when navigating units and reaching the end, will jump to next date picker if right next\n\t\t\tsaveOnBlur: true,\n\t\t\tonSave: null,\n\t\t\tonBlur: null,\n\t\t\t\n\t\t\t// options for each unit\n\t\t\ty: {\n\t\t\t\tplaceholder: 'yyyy'\n\t\t\t}, \n\t\t\tm: {\n\t\t\t\tformat: '', // short, long, fn()\n\t\t\t\tplaceholder: 'mm'\n\t\t\t},\n\t\t\td: {\n\t\t\t\tformat: '', // fn()\n\t\t\t\tplaceholder: 'dd'\n\t\t\t}\n\t\t},\n\t\t\n\t\tinitialize: function(){\n\t\t\t\n\t\t\tif( !window.moment ) return;\n\t\t\t\n\t\t\tthis.el.datepicker = this;\n\t\t\t\n\t\t\tthis.options = _.extend({}, this.defaultOpts, this.options)\n\t\t\tthis.format = this.options.format.toLowerCase().split('')\n\t\t\tthis.unitViews = []\n\t\t\tthis.model = new Model({val: this.options.val})\n\t\t\t\n\t\t\tif( this.options.className )\n\t\t\t\tthis.el.classList.add(this.options.className)\n\t\t\t\t\n\t\t\tif( this.options.appendTo )\n\t\t\t\tthis.appendTo(this.options.appendTo)\n\t\t},\n\t\t\n\t\trender: function(){\n\t\t\t\n\t\t\tif( !window.moment ){\n\t\t\t\tthis.$el.html('missing moment.js')\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\t\n\t\t\twindow.dp = this; // TEMP\n\t\t\t\n\t\t\t// only render once\n\t\t\tif( this.unitViews.length == 0 )\n\t\t\t\tthis.format.forEach(this.renderUnit.bind(this))\n\t\t\t\n\t\t\treturn this\n\t\t},\n\t\t\n\t\trenderUnit: function(key){\n\t\t\tvar View;\n\t\t\tswitch(key){\n\t\t\t\tcase 'y': View = YearView; break;\n\t\t\t\tcase 'm': View = MonthView; break;\n\t\t\t\tcase 'd': View = DateView; break;\n\t\t\t}\n\t\t\t\n\t\t\tif( !View ){\n\t\t\t\tthis.divider = key\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tvar opts = _.extend({\n\t\t\t\tdivider: this.divider,\n\t\t\t\tdeltaThreshold: this.options.deltaThreshold,\n\t\t\t\ttypeDelay: this.options.typeDelay,\n\t\t\t\tmodel: this.model\n\t\t\t}, this.defaultOpts[key], this.options[key])\n\t\t\t\n\t\t\tvar view = new View(opts)\n\t\t\tview.parentView = this\n\t\t\tthis.$el.append( view.render().el )\n\t\t\t\n\t\t\tthis.unitViews.push(view)\n\t\t\t\n\t\t\tthis.divider = ''\n\t\t},\n\t\t\n\t\tactiveView: function(){\n\t\t\tvar view\n\t\t\tthis.unitViews.forEach(function(v){\n\t\t\t\tif( v.isActive() ) view = v\n\t\t\t})\n\t\t\treturn view\n\t\t},\n\t\t\n\t\t_activate: function(jump, loop){\n\t\t\tvar view = this.activeView();\n\t\t\tvar indx = this.unitViews.indexOf(view)\n\t\t\t\n\t\t\tif( view ){\n\t\t\t\tview.deactivate()\n\t\t\t\tindx += jump\n\t\t\t}else{\n\t\t\t\tindx = 0;\n\t\t\t}\n\t\t\t\n\t\t\tif( indx > this.unitViews.length - 1){\n\t\t\t\tif( loop === false ) return\n\t\t\t\tif( this.options.navLink && this.el.nextElementSibling && this.el.nextElementSibling.datepicker ){\n\t\t\t\t\tthis.blur();\n\t\t\t\t\tthis.el.nextElementSibling.datepicker.focus()\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tindx = 0\n\t\t\t}else if( indx < 0 ){\n\t\t\t\tif( loop === false ) return\n\t\t\t\tif( this.options.navLink && this.el.previousElementSibling && this.el.previousElementSibling.datepicker ){\n\t\t\t\t\tthis.blur();\n\t\t\t\t\tthis.el.previousElementSibling.datepicker.focusLast()\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tindx = this.unitViews.length - 1\n\t\t\t}\n\t\t\t\n\t\t\tview = this.unitViews[indx]\n\t\t\tview && view.activate()\n\t\t},\n\t\t\n\t\tactivateNext: function(loop){\n\t\t\tthis._activate(1, loop)\n\t\t},\n\t\t\n\t\tactivatePrev: function(loop){\n\t\t\tthis._activate(-1, loop)\n\t\t},\n\t\t\n\t\tfocus: function(num){\n\t\t\tthis.blur()\n\t\t\tthis.unitViews[num||0].activate()\n\t\t},\n\t\t\n\t\tfocusLast: function(){\n\t\t\tthis.focus(this.unitViews.length-1)\n\t\t},\n\t\t\n\t\tblur: function(){\n\t\t\t\n\t\t\tif( !window.moment ) return;\n\t\t\t\n\t\t\tvar view = this.activeView()\n\t\t\tview && view.deactivate()\n\t\t\t\n\t\t\tthis.el.classList.remove('editing');\n\t\t\t\n\t\t\t// value is different than last time so trigger a save request\n\t\t\tif( this.model.get('val') != this.options.val ){\n\t\t\t\t\n\t\t\t\t// if the value is the same as the original, dont consider unsaved\n\t\t\t\tif( this.model.get('val') === this.model.get('original_val') )\n\t\t\t\t\tthis.el.classList.remove('unsaved');\n\t\t\t\telse\n\t\t\t\t\tthis.el.classList.add('unsaved');\n\t\t\t\t\n\t\t\t\tthis.options.val = this.model.dateValue()\n\t\t\t\t\n\t\t\t\tif( this.options.saveOnBlur )\n\t\t\t\t\tthis.save();\n\t\t\t\t\n\t\t\t\tif( this.options.onSave )\n\t\t\t\t\tthis.options.onSave(this, this.value())\n\t\t\t}\n\t\t\t\n\t\t\tif( this.options.onBlur ){\n\t\t\t\tthis.options.onBlur(this)\n\t\t\t}\n\t\t\t\n\t\t},\n\t\t\n\t\tvalue: function(){\n\t\t\treturn this.model.date.format(this.options.valFormat)\n\t\t},\n\t\t\n\t\treset: function(){\n\t\t\tthis.model.reset()\n\t\t\tif( this.model.get('val') === this.model.get('original_val') )\n\t\t\t\tthis.el.classList.remove('unsaved');\n\t\t},\n\t\t\n\t\tsave: function(){\n\t\t\tthis.model.set('original_val', this.model.get('val'))\n\t\t\tthis.el.classList.remove('unsaved');\n\t\t},\n\t\t\n\t\tonHover: function(){\n\t\t\tthis.el.classList.add('editing');\n\t\t}\n\t\n\t});\n\n});\n"]}