From ad42bec02d39bd1707c6da2db6fbdc5f3a9f5b36 Mon Sep 17 00:00:00 2001
From: windy <1374721899@qq.com>
Date: Mon, 15 Jan 2018 10:24:32 +0800
Subject: [PATCH] =?UTF-8?q?value=E4=BC=A0=E5=80=BC=20editor?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
demo/js/base/editor/demo.editor.js | 1 +
dist/base.js | 16 ++++++++++---
dist/bundle.js | 23 +++++++++++++++----
dist/case.js | 7 ++++--
dist/demo.js | 1 +
dist/fineui.js | 23 +++++++++++++++----
src/base/combination/group.button.js | 9 ++++++--
src/base/single/editor/editor.js | 4 +++-
src/base/single/input/input.js | 3 +++
src/case/combo/staticcombo/combo.static.js | 4 +++-
.../combo/textvaluecombo/popup.textvalue.js | 3 ++-
11 files changed, 74 insertions(+), 20 deletions(-)
diff --git a/demo/js/base/editor/demo.editor.js b/demo/js/base/editor/demo.editor.js
index 6ce05ef11e..0cfba21cfa 100644
--- a/demo/js/base/editor/demo.editor.js
+++ b/demo/js/base/editor/demo.editor.js
@@ -35,6 +35,7 @@ Demo.Editor = BI.inherit(BI.Widget, {
cls: "mvc-border",
watermark: "输入'a'会有错误信息且回车键不能退出编辑",
errorText: "字段不可重名",
+ value: "a",
validationChecker: function (v) {
if (v == "a") {
return false;
diff --git a/dist/base.js b/dist/base.js
index 9cbd28d50f..c1c0198856 100644
--- a/dist/base.js
+++ b/dist/base.js
@@ -1020,6 +1020,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
+ value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@@ -1031,14 +1032,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
+ var o = this.options;
var behaviors = {};
- BI.each(this.options.behaviors, function (key, rule) {
+ BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
- this.populate(this.options.items);
+ this.populate(o.items);
+ if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
+ this.setValue(o.value);
+ }
},
_createBtns: function (items) {
@@ -18069,6 +18074,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "",
root: true,
+ value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@@ -18211,7 +18217,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
- this.setValue(this.options.value);
+ this._checkError();
+ this._checkWaterMark();
} else {
this._checkWaterMark();
}
@@ -19415,6 +19422,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
+ if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
+ this.setValue(this.options.value);
+ }
},
_focus: function () {
diff --git a/dist/bundle.js b/dist/bundle.js
index 303289c47f..291be322ba 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -26812,6 +26812,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
+ value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@@ -26823,14 +26824,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
+ var o = this.options;
var behaviors = {};
- BI.each(this.options.behaviors, function (key, rule) {
+ BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
- this.populate(this.options.items);
+ this.populate(o.items);
+ if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
+ this.setValue(o.value);
+ }
},
_createBtns: function (items) {
@@ -43861,6 +43866,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "",
root: true,
+ value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@@ -44003,7 +44009,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
- this.setValue(this.options.value);
+ this._checkError();
+ this._checkWaterMark();
} else {
this._checkWaterMark();
}
@@ -45207,6 +45214,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
+ if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
+ this.setValue(this.options.value);
+ }
},
_focus: function () {
@@ -67730,6 +67740,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
+ value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@@ -67738,7 +67749,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
- items: o.items
+ items: o.items,
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@@ -68122,7 +68134,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
- }]
+ }],
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
diff --git a/dist/case.js b/dist/case.js
index 90cbb79a67..c2151cc77a 100644
--- a/dist/case.js
+++ b/dist/case.js
@@ -5584,6 +5584,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
+ value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@@ -5592,7 +5593,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
- items: o.items
+ items: o.items,
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@@ -5976,7 +5978,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
- }]
+ }],
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
diff --git a/dist/demo.js b/dist/demo.js
index 7be427cf3d..9e088bdd5c 100644
--- a/dist/demo.js
+++ b/dist/demo.js
@@ -704,6 +704,7 @@ BI.shortcut("demo.code_editor", Demo.CodeEditor);Demo.Editor = BI.inherit(BI.Wid
cls: "mvc-border",
watermark: "输入'a'会有错误信息且回车键不能退出编辑",
errorText: "字段不可重名",
+ value: "a",
validationChecker: function (v) {
if (v == "a") {
return false;
diff --git a/dist/fineui.js b/dist/fineui.js
index 4cacfca3aa..921b5d26b0 100644
--- a/dist/fineui.js
+++ b/dist/fineui.js
@@ -28506,6 +28506,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
+ value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@@ -28517,14 +28518,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
+ var o = this.options;
var behaviors = {};
- BI.each(this.options.behaviors, function (key, rule) {
+ BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
- this.populate(this.options.items);
+ this.populate(o.items);
+ if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
+ this.setValue(o.value);
+ }
},
_createBtns: function (items) {
@@ -45555,6 +45560,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "",
root: true,
+ value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@@ -45697,7 +45703,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
- this.setValue(this.options.value);
+ this._checkError();
+ this._checkWaterMark();
} else {
this._checkWaterMark();
}
@@ -46901,6 +46908,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
+ if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
+ this.setValue(this.options.value);
+ }
},
_focus: function () {
@@ -69424,6 +69434,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
+ value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@@ -69432,7 +69443,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
- items: o.items
+ items: o.items,
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@@ -69816,7 +69828,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
- }]
+ }],
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js
index 27cfa74391..3a13f6d6e2 100644
--- a/src/base/combination/group.button.js
+++ b/src/base/combination/group.button.js
@@ -10,6 +10,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
+ value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@@ -21,14 +22,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
+ var o = this.options;
var behaviors = {};
- BI.each(this.options.behaviors, function (key, rule) {
+ BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
- this.populate(this.options.items);
+ this.populate(o.items);
+ if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
+ this.setValue(o.value);
+ }
},
_createBtns: function (items) {
diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js
index 96d90c5a0b..15a4e9c0a5 100644
--- a/src/base/single/editor/editor.js
+++ b/src/base/single/editor/editor.js
@@ -32,6 +32,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "",
root: true,
+ value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@@ -174,7 +175,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
- this.setValue(this.options.value);
+ this._checkError();
+ this._checkWaterMark();
} else {
this._checkWaterMark();
}
diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js
index a88499f2f5..1b2d29e421 100644
--- a/src/base/single/input/input.js
+++ b/src/base/single/input/input.js
@@ -57,6 +57,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
+ if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
+ this.setValue(this.options.value);
+ }
},
_focus: function () {
diff --git a/src/case/combo/staticcombo/combo.static.js b/src/case/combo/staticcombo/combo.static.js
index f0c196171c..95d3505148 100644
--- a/src/case/combo/staticcombo/combo.static.js
+++ b/src/case/combo/staticcombo/combo.static.js
@@ -23,6 +23,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
+ value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@@ -31,7 +32,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
- items: o.items
+ items: o.items,
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js
index b650383588..1efea30e88 100644
--- a/src/case/combo/textvaluecombo/popup.textvalue.js
+++ b/src/case/combo/textvaluecombo/popup.textvalue.js
@@ -19,7 +19,8 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
- }]
+ }],
+ value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {