assets/js/romo/datepicker.js in romo-0.15.4 vs assets/js/romo/datepicker.js in romo-0.15.5

- old
+ new

@@ -61,10 +61,13 @@ this.indicatorElem = $('<i class="romo-datepicker-indicator '+indicatorClass+'"></i>'); this.indicatorElem.css({'line-height': this.elem.css('height')}); if (this.elem.prop('disabled') === true) { this.indicatorElem.addClass('disabled'); } + if (this.elem.css('display') === 'none') { + this._hide(this.indicatorElem); + } this.indicatorElem.on('click', $.proxy(this.onIndicatorClick, this)); this.elem.css({'padding-right': '22px'}); this.elem.after(this.indicatorElem); } @@ -79,10 +82,16 @@ this.doEnable(); }, this)); this.elem.on('datepicker:triggerDisable', $.proxy(function(e) { this.doDisable(); }, this)); + this.elem.on('datepicker:triggerShow', $.proxy(function(e) { + this.doShow(); + }, this)); + this.elem.on('datepicker:triggerHide', $.proxy(function(e) { + this.doHide(); + }, this)); this.elem.on('datepicker:triggerSetFormat', $.proxy(function(e) { this.doSetFormat(); }, this)); this.elem.on('datepicker:triggerSetDate', $.proxy(this.onTriggerSetDate, this)); } @@ -111,10 +120,20 @@ this.elem.prop('disabled', true); this.elem.addClass('disabled'); this.indicatorElem.addClass('disabled'); } +RomoDatepicker.prototype.doShow = function() { + this._show(this.elem); + this._show(this.indicatorElem); +} + +RomoDatepicker.prototype.doHide = function() { + this._hide(this.elem); + this._hide(this.indicatorElem); +} + RomoDatepicker.prototype.doBindDropdown = function() { this.elem.attr('data-romo-dropdown-disable-toggle', 'true'); if (this.elem.data('romo-dropdown-width') === undefined) { this.elem.attr('data-romo-dropdown-width', 'elem'); } @@ -303,9 +322,17 @@ RomoDatepicker.prototype.onPopupMouseUp = function(e) { this.popupMouseDown = false; } // private + +RomoDatepicker.prototype._show = function(elem) { + elem.css('display', ''); +} + +RomoDatepicker.prototype._hide = function(elem) { + elem.css('display', 'none'); +} RomoDatepicker.prototype._triggerSetDateChangeEvent = function() { if (this.elem.val() !== this.prevValue) { this.elem.trigger('change'); }