Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
zsmj 3 years ago
parent
commit
0cb4d09199
  1. 2
      package.json
  2. 43
      src/base/single/input/input.js
  3. 2
      src/core/wrapper/layout/layout.inline.js

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220507150550", "version": "2.0.20220510135434",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

43
src/base/single/input/input.js

@ -206,14 +206,29 @@ BI.Input = BI.inherit(BI.Single, {
this._lastValue = this.getValue(); this._lastValue = this.getValue();
}, },
_checkValidationOnValueChange: function () { _checkValidationOnValueChange: function (callback) {
var o = this.options; var self = this, o = this.options;
var v = this.getValue(); var v = this.getValue();
this.setValid( if (o.allowBlank === true && BI.trim(v) == "") {
(o.allowBlank === true && BI.trim(v) == "") || ( this.setValid(true);
BI.isNotEmptyString(BI.trim(v)) && o.validationChecker.apply(this, [BI.trim(v)]) !== false callback && callback();
) return;
); }
if (BI.trim(v) == "") {
this.setValid(false);
callback && callback();
return;
}
var checker = o.validationChecker.apply(this, [BI.trim(v)]);
if (checker instanceof Promise) {
checker.then(function (validate) {
self.setValid(validate !== false);
callback && callback();
})
} else {
this.setValid(checker !== false);
callback && callback();
}
}, },
focus: function () { focus: function () {
@ -245,14 +260,16 @@ BI.Input = BI.inherit(BI.Single, {
}, },
setValue: function (textValue) { setValue: function (textValue) {
var self = this;
this.element.val(textValue); this.element.val(textValue);
BI.nextTick(BI.bind(function () { BI.nextTick(function () {
this._checkValidationOnValueChange(); self._checkValidationOnValueChange(function () {
this._defaultState(); self._defaultState();
if (this.isValid()) { if (self.isValid()) {
this._lastValidValue = this._lastSubmitValue = this.getValue(); self._lastValidValue = self._lastSubmitValue = self.getValue();
} }
}, this)); });
});
}, },
getValue: function () { getValue: function () {

2
src/core/wrapper/layout/layout.inline.js

@ -40,7 +40,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments); var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (o.columnSize.length > 0) { if (o.columnSize.length > 0) {
if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
columnSize = null; columnSize = null;

Loading…
Cancel
Save