Browse Source

文本控件,当数据变化后再往外抛事件

es6
guy 4 years ago
parent
commit
d14acfa35c
  1. 9
      src/widget/multiselect/multiselect.combo.js
  2. 9
      src/widget/multiselect/multiselect.combo.nobar.js
  3. 11
      src/widget/multiselect/multiselect.insert.combo.js
  4. 7
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  5. 7
      src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js

9
src/widget/multiselect/multiselect.combo.js

@ -92,6 +92,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue("");
self._dataChange = true;
}); });
} }
}); });
@ -109,6 +110,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
} }
self._dataChange = true;
}); });
} }
self.fireEvent(BI.MultiSelectCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiSelectCombo.EVENT_SEARCHING);
@ -124,6 +126,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
} }
self._dataChange = true;
self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
@ -153,6 +156,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
listeners: [{ listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () { action: function () {
self._dataChange = true;
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
@ -190,6 +194,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self._dataChange = false;// 标记数据是否发生变化
this.setValue(self.storeValue); this.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
self._populate(); self._populate();
@ -203,7 +208,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
if (self.requesting === true) { if (self.requesting === true) {
self.wants2Quit = true; self.wants2Quit = true;
} else { } else {
self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM);
} }
}); });
@ -390,7 +395,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
callback(); callback();
function adjust () { function adjust () {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
} }
self.requesting = false; self.requesting = false;

9
src/widget/multiselect/multiselect.combo.nobar.js

@ -100,6 +100,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
} }
self._dataChange = true;
}); });
} }
}); });
@ -114,6 +115,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
} }
self._dataChange = true;
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM); self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
@ -143,6 +145,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
listeners: [{ listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () { action: function () {
self._dataChange = true;
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
@ -184,6 +187,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self._dataChange = false;// 标记数据是否发生变化
this.setValue(self.storeValue); this.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
self._populate(); self._populate();
@ -197,7 +201,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
if (self.requesting === true) { if (self.requesting === true) {
self.wants2Quit = true; self.wants2Quit = true;
} else { } else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
} }
}); });
@ -302,6 +306,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue("");
self._dataChange = true;
}); });
}, },
@ -407,7 +412,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
function adjust() { function adjust() {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
} }
self.requesting = false; self.requesting = false;

11
src/widget/multiselect/multiselect.insert.combo.js

@ -104,6 +104,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
} }
self._dataChange = true;
}); });
} }
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING);
@ -119,6 +120,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
} }
self._dataChange = true;
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM); self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM);
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
@ -148,6 +150,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
listeners: [{ listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () { action: function () {
self._dataChange = true;
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
@ -186,6 +189,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self._dataChange = false;// 标记数据是否发生变化
this.setValue(self.storeValue); this.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
self._populate(); self._populate();
@ -199,7 +203,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
if (self.requesting === true) { if (self.requesting === true) {
self.wants2Quit = true; self.wants2Quit = true;
} else { } else {
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM);
} }
}); });
@ -218,7 +222,6 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
masker: { masker: {
@ -260,7 +263,6 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -314,6 +316,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue("");
self._dataChange = true;
}); });
}, },
@ -407,7 +410,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
callback(); callback();
function adjust () { function adjust () {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
} }
self.requesting = false; self.requesting = false;

7
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -99,6 +99,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
} }
self._dataChange = true;
}); });
} }
}); });
@ -113,6 +114,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
} }
self._dataChange = true;
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数) // counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
@ -141,6 +143,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
listeners: [{ listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () { action: function () {
self._dataChange = true;
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
@ -181,6 +184,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self._dataChange = false;// 标记数据是否发生变化
this.setValue(self.storeValue); this.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
self._populate(); self._populate();
@ -194,7 +198,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
if (self.requesting === true) { if (self.requesting === true) {
self.wants2Quit = true; self.wants2Quit = true;
} else { } else {
self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM);
} }
}); });
@ -310,6 +314,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue("");
self._dataChange = true;
}); });
}, },

7
src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js

@ -81,6 +81,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self._populate(); self._populate();
self._setStartValue(""); self._setStartValue("");
self._dataChange = true;
}); });
} }
}); });
@ -98,6 +99,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
} }
self._dataChange = true;
}); });
} }
}); });
@ -112,6 +114,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
}); });
} }
self._dataChange = true;
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
@ -137,6 +140,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
listeners: [{ listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE, eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () { action: function () {
self._dataChange = true;
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
@ -172,6 +176,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self._dataChange = false;// 标记数据是否发生变化
this.setValue(self.storeValue); this.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
self._populate(); self._populate();
@ -189,7 +194,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
* 在存在标红的情况如果popover没有发生改变就确认需要同步trigger的值否则对外value值和trigger样式不统一 * 在存在标红的情况如果popover没有发生改变就确认需要同步trigger的值否则对外value值和trigger样式不统一
*/ */
assertShowValue(); assertShowValue();
self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM);
} }
}); });

Loading…
Cancel
Save