Browse Source

BI-20382

es6
guy 7 years ago
parent
commit
69a68ea5d1
  1. 32
      dist/_fineui.min.js
  2. 30
      dist/base.js
  3. 30
      dist/bundle.js
  4. 44
      dist/bundle.min.js
  5. 105
      dist/demo.js
  6. 30
      dist/fineui.js
  7. 32
      dist/fineui.min.js
  8. 4
      src/base/single/editor/editor.js
  9. 26
      src/base/single/input/input.js

32
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

30
dist/base.js vendored

@ -18602,9 +18602,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () { getValue: function () {
if (!this.isValid()) { if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue()); return this.editor.getLastValidValue();
} }
return BI.trim(this.editor.getValue()); return this.editor.getValue();
}, },
isEditing: function () { isEditing: function () {
@ -19727,7 +19727,7 @@ BI.Input = BI.inherit(BI.Single, {
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange(); self._checkValidationOnValueChange();
self._defaultState(); self._defaultState();
@ -19757,11 +19757,11 @@ BI.Input = BI.inherit(BI.Single, {
}, },
onKeyDown: function (keyCode, ctrlKey) { onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange(); this._checkValidationOnValueChange();
} }
if (this.isValid() && BI.trim(this.getValue()) !== "") { if (this.isValid() && this.getValue() !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "") if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) { || (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true; this._start = true;
this._pause = false; this._pause = false;
@ -19773,7 +19773,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange(); this._valueChange();
} else { } else {
if (keyCode == BI.KeyCode.ENTER) { if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur(); this.blur();
this.fireEvent(BI.Input.EVENT_ENTER); this.fireEvent(BI.Input.EVENT_ENTER);
} else { } else {
@ -19798,7 +19798,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE); this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState(); this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) && } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP); this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange(); this._valueChange();
@ -19818,10 +19818,10 @@ BI.Input = BI.inherit(BI.Single, {
}, },
_valueChange: function () { _valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) { if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE); this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue()); this._lastSubmitValue = this.getValue();
} }
if (this.getValue() == "") { if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -19834,10 +19834,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options; var o = this.options;
var v = this.getValue(); var v = this.getValue();
this.setValid( this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(BI.trim(v)) (BI.isNotEmptyString(v)
&& (v === this._lastValidValue || && (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false)) o.validationChecker.apply(this, [v]) !== false))
); );
}, },
@ -19897,13 +19897,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments); BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.element.removeClass("bi-input-error"); this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else { } else {
if (this._lastValidValue === this.getValue()) { if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null; this._lastValidValue = null;
} }
this.element.addClass("bi-input-error"); this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
} }
}, },

30
dist/bundle.js vendored

@ -54368,9 +54368,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () { getValue: function () {
if (!this.isValid()) { if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue()); return this.editor.getLastValidValue();
} }
return BI.trim(this.editor.getValue()); return this.editor.getValue();
}, },
isEditing: function () { isEditing: function () {
@ -55493,7 +55493,7 @@ BI.Input = BI.inherit(BI.Single, {
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange(); self._checkValidationOnValueChange();
self._defaultState(); self._defaultState();
@ -55523,11 +55523,11 @@ BI.Input = BI.inherit(BI.Single, {
}, },
onKeyDown: function (keyCode, ctrlKey) { onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange(); this._checkValidationOnValueChange();
} }
if (this.isValid() && BI.trim(this.getValue()) !== "") { if (this.isValid() && this.getValue() !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "") if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) { || (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true; this._start = true;
this._pause = false; this._pause = false;
@ -55539,7 +55539,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange(); this._valueChange();
} else { } else {
if (keyCode == BI.KeyCode.ENTER) { if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur(); this.blur();
this.fireEvent(BI.Input.EVENT_ENTER); this.fireEvent(BI.Input.EVENT_ENTER);
} else { } else {
@ -55564,7 +55564,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE); this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState(); this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) && } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP); this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange(); this._valueChange();
@ -55584,10 +55584,10 @@ BI.Input = BI.inherit(BI.Single, {
}, },
_valueChange: function () { _valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) { if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE); this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue()); this._lastSubmitValue = this.getValue();
} }
if (this.getValue() == "") { if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -55600,10 +55600,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options; var o = this.options;
var v = this.getValue(); var v = this.getValue();
this.setValid( this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(BI.trim(v)) (BI.isNotEmptyString(v)
&& (v === this._lastValidValue || && (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false)) o.validationChecker.apply(this, [v]) !== false))
); );
}, },
@ -55663,13 +55663,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments); BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.element.removeClass("bi-input-error"); this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else { } else {
if (this._lastValidValue === this.getValue()) { if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null; this._lastValidValue = null;
} }
this.element.addClass("bi-input-error"); this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
} }
}, },

44
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

105
dist/demo.js vendored

@ -11014,111 +11014,6 @@ BI.shortcut("demo.tmp", Demo.Func);
}); });
BI.shortcut("demo.fix_global_watcher", Demo.Fix); BI.shortcut("demo.fix_global_watcher", Demo.Fix);
}());(function () {
var State = BI.inherit(Fix.Model, {
state: function () {
return {
name: "原始属性",
info: {
age: 12,
sex: "male",
birth: {
year: 2018,
month: 9,
day: 11
}
},
career: [{
a: 1,
b: 2,
c: 3
}]
};
},
computed: {
b: function () {
return this.model.name + "-计算属性";
},
birth: function () {
return this.model.info.birth;
}
}
});
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return new State();
},
watch: {
b: function () {
this.button.setText(this.model.b);
},
"birth.**": function () {
console.log(123);
}
},
render: function () {
var self = this;
return {
type: "bi.vertical",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.name = "这是改变后的属性";
},
text: this.model.b
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.birth.year = 2019;
},
text: "birthYearButton"
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.career.push({
year: 2017,
month: 3,
day: 24
});
},
text: "careerAddButton"
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.career[0].a = 24;
},
text: "careerChangeButton"
}
}]
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_immutable", Demo.Fix);
}());/** }());/**
* @Author: Young * @Author: Young
* @CreationDate 2017-11-06 10:32 * @CreationDate 2017-11-06 10:32

30
dist/fineui.js vendored

@ -54611,9 +54611,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () { getValue: function () {
if (!this.isValid()) { if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue()); return this.editor.getLastValidValue();
} }
return BI.trim(this.editor.getValue()); return this.editor.getValue();
}, },
isEditing: function () { isEditing: function () {
@ -55736,7 +55736,7 @@ BI.Input = BI.inherit(BI.Single, {
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange(); self._checkValidationOnValueChange();
self._defaultState(); self._defaultState();
@ -55766,11 +55766,11 @@ BI.Input = BI.inherit(BI.Single, {
}, },
onKeyDown: function (keyCode, ctrlKey) { onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange(); this._checkValidationOnValueChange();
} }
if (this.isValid() && BI.trim(this.getValue()) !== "") { if (this.isValid() && this.getValue() !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "") if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) { || (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true; this._start = true;
this._pause = false; this._pause = false;
@ -55782,7 +55782,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange(); this._valueChange();
} else { } else {
if (keyCode == BI.KeyCode.ENTER) { if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur(); this.blur();
this.fireEvent(BI.Input.EVENT_ENTER); this.fireEvent(BI.Input.EVENT_ENTER);
} else { } else {
@ -55807,7 +55807,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE); this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState(); this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) && } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP); this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange(); this._valueChange();
@ -55827,10 +55827,10 @@ BI.Input = BI.inherit(BI.Single, {
}, },
_valueChange: function () { _valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) { if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE); this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue()); this._lastSubmitValue = this.getValue();
} }
if (this.getValue() == "") { if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -55843,10 +55843,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options; var o = this.options;
var v = this.getValue(); var v = this.getValue();
this.setValid( this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(BI.trim(v)) (BI.isNotEmptyString(v)
&& (v === this._lastValidValue || && (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false)) o.validationChecker.apply(this, [v]) !== false))
); );
}, },
@ -55906,13 +55906,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments); BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.element.removeClass("bi-input-error"); this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else { } else {
if (this._lastValidValue === this.getValue()) { if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null; this._lastValidValue = null;
} }
this.element.addClass("bi-input-error"); this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
} }
}, },

32
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

4
src/base/single/editor/editor.js

@ -288,9 +288,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () { getValue: function () {
if (!this.isValid()) { if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue()); return this.editor.getLastValidValue();
} }
return BI.trim(this.editor.getValue()); return this.editor.getValue();
}, },
isEditing: function () { isEditing: function () {

26
src/base/single/input/input.js

@ -88,7 +88,7 @@ BI.Input = BI.inherit(BI.Single, {
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange(); self._checkValidationOnValueChange();
self._defaultState(); self._defaultState();
@ -118,11 +118,11 @@ BI.Input = BI.inherit(BI.Single, {
}, },
onKeyDown: function (keyCode, ctrlKey) { onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange(); this._checkValidationOnValueChange();
} }
if (this.isValid() && BI.trim(this.getValue()) !== "") { if (this.isValid() && this.getValue() !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "") if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) { || (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true; this._start = true;
this._pause = false; this._pause = false;
@ -134,7 +134,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange(); this._valueChange();
} else { } else {
if (keyCode == BI.KeyCode.ENTER) { if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur(); this.blur();
this.fireEvent(BI.Input.EVENT_ENTER); this.fireEvent(BI.Input.EVENT_ENTER);
} else { } else {
@ -159,7 +159,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE); this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState(); this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) && } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP); this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange(); this._valueChange();
@ -179,10 +179,10 @@ BI.Input = BI.inherit(BI.Single, {
}, },
_valueChange: function () { _valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) { if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE); this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue()); this._lastSubmitValue = this.getValue();
} }
if (this.getValue() == "") { if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -195,10 +195,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options; var o = this.options;
var v = this.getValue(); var v = this.getValue();
this.setValid( this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(BI.trim(v)) (BI.isNotEmptyString(v)
&& (v === this._lastValidValue || && (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false)) o.validationChecker.apply(this, [v]) !== false))
); );
}, },
@ -258,13 +258,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments); BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.element.removeClass("bi-input-error"); this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else { } else {
if (this._lastValidValue === this.getValue()) { if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null; this._lastValidValue = null;
} }
this.element.addClass("bi-input-error"); this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this); this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
} }
}, },

Loading…
Cancel
Save