Fix Bug 49948
This commit is contained in:
parent
b8a2be840a
commit
18c637cae3
|
@ -431,10 +431,7 @@ define([
|
||||||
disabled: false,
|
disabled: false,
|
||||||
editable: true,
|
editable: true,
|
||||||
iconCls: 'btn-select-range',
|
iconCls: 'btn-select-range',
|
||||||
btnHint: '',
|
btnHint: ''
|
||||||
repeatInput: null,
|
|
||||||
showPwdOnClick: false,
|
|
||||||
btnForPwdShow : false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
template: _.template([
|
template: _.template([
|
||||||
|
@ -500,21 +497,6 @@ define([
|
||||||
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
|
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
|
||||||
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
|
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
|
||||||
}
|
}
|
||||||
if((this.type == 'password')&&(this.options.btnForPwdShow))
|
|
||||||
{
|
|
||||||
this.hidePwd = true;
|
|
||||||
this.repeatInput= this.options.repeatInput;
|
|
||||||
this.currentType = 'password';
|
|
||||||
this._btnElm = this._button.$el;
|
|
||||||
this._button.setIconCls('btn-sheet-view');
|
|
||||||
this._input.on('input', _.bind(this.checkPasswordType, this));
|
|
||||||
this._button.updateHint(this.textHintShowPwd);
|
|
||||||
if(this.options.showPwdOnClick)
|
|
||||||
this._button.on('click', _.bind(this.passwordClick, this));
|
|
||||||
else
|
|
||||||
this._btnElm.on('mousedown', _.bind(this.passwordShow, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.setEditable(this.editable);
|
this.setEditable(this.editable);
|
||||||
|
|
||||||
|
@ -559,16 +541,113 @@ define([
|
||||||
|
|
||||||
if (!this.rendered) return;
|
if (!this.rendered) return;
|
||||||
this._button.updateHint(this.options.hint);
|
this._button.updateHint(this.options.hint);
|
||||||
},
|
|
||||||
|
|
||||||
checkPasswordType: function(){
|
|
||||||
if (this._input.val() != '') {
|
|
||||||
(this._input.attr('type') !== this.currentType) && this._input.attr('type', this.currentType);
|
|
||||||
} else {
|
|
||||||
this._input.attr('type', 'text');
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
})());
|
||||||
|
|
||||||
|
Common.UI.InputFieldBtnPassword = Common.UI.InputFieldBtn.extend((function() {
|
||||||
|
return {
|
||||||
|
options: {
|
||||||
|
id: null,
|
||||||
|
cls: '',
|
||||||
|
style: '',
|
||||||
|
value: '',
|
||||||
|
name: '',
|
||||||
|
validation: null,
|
||||||
|
allowBlank: true,
|
||||||
|
placeHolder: '',
|
||||||
|
blankError: null,
|
||||||
|
spellcheck: false,
|
||||||
|
maskExp: '',
|
||||||
|
validateOnChange: false,
|
||||||
|
validateOnBlur: true,
|
||||||
|
disabled: false,
|
||||||
|
editable: true,
|
||||||
|
iconCls: 'btn-select-range',
|
||||||
|
btnHint: '',
|
||||||
|
repeatInput: null,
|
||||||
|
showPwdOnClick: true
|
||||||
|
},
|
||||||
|
render: function (parentEl) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
if (!me.rendered) {
|
||||||
|
this.cmpEl = $(this.template({
|
||||||
|
id : this.id,
|
||||||
|
cls : this.cls,
|
||||||
|
style : this.style,
|
||||||
|
value : this.value,
|
||||||
|
type : 'password',
|
||||||
|
name : this.name,
|
||||||
|
placeHolder : this.placeHolder,
|
||||||
|
spellcheck : this.spellcheck,
|
||||||
|
iconCls : this.options.iconCls,
|
||||||
|
scope : me
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (parentEl) {
|
||||||
|
this.setElement(parentEl, false);
|
||||||
|
parentEl.html(this.cmpEl);
|
||||||
|
} else {
|
||||||
|
this.$el.html(this.cmpEl);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.cmpEl = this.$el;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!me.rendered) {
|
||||||
|
var el = this.cmpEl;
|
||||||
|
|
||||||
|
this._button = new Common.UI.Button({
|
||||||
|
el: this.cmpEl.find('button'),
|
||||||
|
hint: this.options.btnHint || ''
|
||||||
|
});
|
||||||
|
this._button.on('click', _.bind(this.onButtonClick, this));
|
||||||
|
|
||||||
|
this._input = this.cmpEl.find('input').addBack().filter('input');
|
||||||
|
|
||||||
|
if (this.editable) {
|
||||||
|
this._input.on('blur', _.bind(this.onInputChanged, this));
|
||||||
|
this._input.on('keypress', _.bind(this.onKeyPress, this));
|
||||||
|
this._input.on('keydown', _.bind(this.onKeyDown, this));
|
||||||
|
this._input.on('keyup', _.bind(this.onKeyUp, this));
|
||||||
|
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
|
||||||
|
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hidePwd = true;
|
||||||
|
this.repeatInput= this.options.repeatInput;
|
||||||
|
this._btnElm = this._button.$el;
|
||||||
|
this._button.setIconCls('btn-sheet-view');
|
||||||
|
this._input.on('input', _.bind(this.checkPasswordType, this));
|
||||||
|
this._button.updateHint(this.textHintShowPwd);
|
||||||
|
if(this.options.showPwdOnClick)
|
||||||
|
this._button.on('click', _.bind(this.passwordClick, this));
|
||||||
|
else
|
||||||
|
this._btnElm.on('mousedown', _.bind(this.passwordShow, this));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.setEditable(this.editable);
|
||||||
|
|
||||||
|
if (this.disabled)
|
||||||
|
this.setDisabled(this.disabled);
|
||||||
|
|
||||||
|
if (this._input.closest('.asc-window').length>0)
|
||||||
|
var onModalClose = function() {
|
||||||
|
var errorTip = el.find('.input-error').data('bs.tooltip');
|
||||||
|
if (errorTip) errorTip.tip().remove();
|
||||||
|
Common.NotificationCenter.off({'modal:close': onModalClose});
|
||||||
|
};
|
||||||
|
Common.NotificationCenter.on({'modal:close': onModalClose});
|
||||||
|
}
|
||||||
|
|
||||||
|
me.rendered = true;
|
||||||
|
if (me.value)
|
||||||
|
me.setValue(me.value);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
passwordClick: function (e)
|
passwordClick: function (e)
|
||||||
{
|
{
|
||||||
|
@ -585,12 +664,12 @@ define([
|
||||||
passwordShow: function (e) {
|
passwordShow: function (e) {
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
this._button.setIconCls('hide-password');
|
this._button.setIconCls('hide-password');
|
||||||
this.currentType = 'text';
|
this.type = 'text';
|
||||||
|
|
||||||
this._input.attr('type', this.currentType);
|
this._input.attr('type', this.type);
|
||||||
if(this.repeatInput) {
|
if(this.repeatInput) {
|
||||||
this.repeatInput.type = this.currentType;
|
this.repeatInput.type = this.type;
|
||||||
this.repeatInput._input.attr('type', this.currentType);
|
this.repeatInput._input.attr('type', this.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.showPwdOnClick) {
|
if(this.options.showPwdOnClick) {
|
||||||
|
@ -602,12 +681,12 @@ define([
|
||||||
|
|
||||||
passwordHide: function (e) {
|
passwordHide: function (e) {
|
||||||
this._button.setIconCls('btn-sheet-view');
|
this._button.setIconCls('btn-sheet-view');
|
||||||
this.currentType = 'password';
|
this.type = 'password';
|
||||||
|
|
||||||
(this._input.val() !== '') && this._input.attr('type', this.currentType);
|
(this._input.val() !== '') && this._input.attr('type', this.type);
|
||||||
if(this.repeatInput) {
|
if(this.repeatInput) {
|
||||||
this.repeatInput.type = this.currentType;
|
this.repeatInput.type = this.type;
|
||||||
(this.repeatInput._input.val() !== '') && this.repeatInput._input.attr('type', this.currentType);
|
(this.repeatInput._input.val() !== '') && this.repeatInput._input.attr('type', this.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.showPwdOnClick) {
|
if(this.options.showPwdOnClick) {
|
||||||
|
@ -616,8 +695,8 @@ define([
|
||||||
else
|
else
|
||||||
this._btnElm.off('mouseup', this.passwordHide);
|
this._btnElm.off('mouseup', this.passwordHide);
|
||||||
},
|
},
|
||||||
textHintShowPwd: 'show password',
|
textHintShowPwd: 'Show password',
|
||||||
textHintHidePwd: 'hide password'
|
textHintHidePwd: 'Hide password'
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
});
|
});
|
|
@ -200,11 +200,11 @@ define([
|
||||||
this.previewInner = this.previewScrolled.find('div:first-child');
|
this.previewInner = this.previewScrolled.find('div:first-child');
|
||||||
|
|
||||||
if (this.type == Common.Utils.importTextType.DRM) {
|
if (this.type == Common.Utils.importTextType.DRM) {
|
||||||
this.inputPwd = new Common.UI.InputFieldBtn({
|
this.inputPwd = new Common.UI.InputFieldBtnPassword({
|
||||||
el: $('#id-password-txt'),
|
el: $('#id-password-txt'),
|
||||||
type: 'password',
|
type: 'password',
|
||||||
validateOnBlur: false,
|
validateOnBlur: false,
|
||||||
btnForPwdShow: true,
|
showPwdOnClick: false,
|
||||||
validation : function(value) {
|
validation : function(value) {
|
||||||
return me.txtIncorrectPwd;
|
return me.txtIncorrectPwd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,16 +105,14 @@ define([
|
||||||
return me.txtIncorrectPwd;
|
return me.txtIncorrectPwd;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.inputPwd = new Common.UI.InputFieldBtn({
|
this.inputPwd = new Common.UI.InputFieldBtnPassword({
|
||||||
el: $('#id-password-txt'),
|
el: $('#id-password-txt'),
|
||||||
type: 'password',
|
type: 'password',
|
||||||
allowBlank : false,
|
allowBlank : false,
|
||||||
style : 'width: 100%;',
|
style : 'width: 100%;',
|
||||||
maxLength: 255,
|
maxLength: 255,
|
||||||
validateOnBlur: false,
|
validateOnBlur: false,
|
||||||
repeatInput: this.repeatPwd,
|
repeatInput: this.repeatPwd
|
||||||
showPwdOnClick: true,
|
|
||||||
btnForPwdShow: true
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -124,15 +124,14 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.inputPwd = new Common.UI.InputFieldBtn({
|
this.inputPwd = new Common.UI.InputFieldBtnPassword({
|
||||||
el: $('#id-password-txt'),
|
el: $('#id-password-txt'),
|
||||||
type: 'password',
|
type: 'password',
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
style : 'width: 100%;',
|
style : 'width: 100%;',
|
||||||
maxLength: 255,
|
maxLength: 255,
|
||||||
validateOnBlur: false,
|
validateOnBlur: false,
|
||||||
repeatInput: this.repeatPwd,
|
repeatInput: this.repeatPwd
|
||||||
btnForPwdShow: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.type == 'sheet') {
|
if (this.type == 'sheet') {
|
||||||
|
|
Loading…
Reference in a new issue