Browse Source

Merge pull request #403 in FUI/fineui from ~TELLER/fineui:bugfix/BI-20841 to master

* commit 'f65531ba91f8a44f4b8e9a048cf8b39789212b10':
  update
  update
  update
es6
guy 7 years ago
parent
commit
703f099bd2
  1. 2
      dist/_fineui.min.js
  2. 30
      dist/bundle.js
  3. 8
      dist/bundle.min.js
  4. 105
      dist/demo.js
  5. 30
      dist/fineui.js
  6. 2
      dist/fineui.min.js
  7. 30
      dist/widget.js
  8. 12
      src/widget/singleselect/singleselect.combo.js
  9. 12
      src/widget/singleselect/singleselect.loader.js
  10. 3
      src/widget/singleselect/trigger/searcher.singleselect.js

2
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

30
dist/bundle.js vendored

@ -104079,11 +104079,11 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue();
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue();
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
@ -104096,7 +104096,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue();
}); });
} }
}); });
@ -104109,7 +104109,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
self.combo.populate(); self.combo.populate();
self._setStartValue(""); self._setStartValue();
} else { } else {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -104220,9 +104220,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
_makeMap: function (values) { _makeMap: function (values) {
return BI.makeObject(values || []); return BI.makeObject(values || []);
@ -104626,20 +104624,20 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, opts.el), }, opts.el),
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
var startValue = self._startValue; var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, { BI.isNotNull(self.storeValue) && (op = BI.extend(op || {}, {
selectedValues: [self.storeValue] selectedValues: [self.storeValue]
})); }));
opts.itemsCreator(op, function (ob) { opts.itemsCreator(op, function (ob) {
hasNext = ob.hasNext; hasNext = ob.hasNext;
var firstItems = []; var firstItems = [];
if (op.times === 1 && self.storeValue) { if (op.times === 1 && BI.isNotNull(self.storeValue)) {
var json = BI.map([self.storeValue], function (i, v) { var json = BI.map([self.storeValue], function (i, v) {
var txt = opts.valueFormatter(v) || v; var txt = opts.valueFormatter(v) || v;
return { return {
text: txt, text: txt,
value: v, value: v,
title: txt, title: txt,
selected: false selected: true
}; };
}); });
firstItems = self._createItems(json); firstItems = self._createItems(json);
@ -104681,16 +104679,14 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, 30); }, 30);
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
setStartValue: function (v) { setStartValue: function (v) {
this._startValue = v; this._startValue = v;
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.button_group.setValue(this.storeValue); this.button_group.setValue(this.storeValue);
}, },
@ -104721,7 +104717,8 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}); });
BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);/** BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);
/**
* 带加载的单选下拉面板 * 带加载的单选下拉面板
* @class BI.SingleSelectPopupView * @class BI.SingleSelectPopupView
* @extends Widget * @extends Widget
@ -105412,8 +105409,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
v || (v = ""); if (BI.isNull(v)) {
if (v === "") {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));

8
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

@ -104322,11 +104322,11 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue();
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue();
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
@ -104339,7 +104339,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue();
}); });
} }
}); });
@ -104352,7 +104352,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
self.combo.populate(); self.combo.populate();
self._setStartValue(""); self._setStartValue();
} else { } else {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -104463,9 +104463,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
_makeMap: function (values) { _makeMap: function (values) {
return BI.makeObject(values || []); return BI.makeObject(values || []);
@ -104869,20 +104867,20 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, opts.el), }, opts.el),
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
var startValue = self._startValue; var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, { BI.isNotNull(self.storeValue) && (op = BI.extend(op || {}, {
selectedValues: [self.storeValue] selectedValues: [self.storeValue]
})); }));
opts.itemsCreator(op, function (ob) { opts.itemsCreator(op, function (ob) {
hasNext = ob.hasNext; hasNext = ob.hasNext;
var firstItems = []; var firstItems = [];
if (op.times === 1 && self.storeValue) { if (op.times === 1 && BI.isNotNull(self.storeValue)) {
var json = BI.map([self.storeValue], function (i, v) { var json = BI.map([self.storeValue], function (i, v) {
var txt = opts.valueFormatter(v) || v; var txt = opts.valueFormatter(v) || v;
return { return {
text: txt, text: txt,
value: v, value: v,
title: txt, title: txt,
selected: false selected: true
}; };
}); });
firstItems = self._createItems(json); firstItems = self._createItems(json);
@ -104924,16 +104922,14 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, 30); }, 30);
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
setStartValue: function (v) { setStartValue: function (v) {
this._startValue = v; this._startValue = v;
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.button_group.setValue(this.storeValue); this.button_group.setValue(this.storeValue);
}, },
@ -104964,7 +104960,8 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}); });
BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);/** BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);
/**
* 带加载的单选下拉面板 * 带加载的单选下拉面板
* @class BI.SingleSelectPopupView * @class BI.SingleSelectPopupView
* @extends Widget * @extends Widget
@ -105655,8 +105652,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
v || (v = ""); if (BI.isNull(v)) {
if (v === "") {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));

2
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

30
dist/widget.js vendored

@ -16519,11 +16519,11 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue();
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue();
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
@ -16536,7 +16536,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue();
}); });
} }
}); });
@ -16549,7 +16549,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
self.combo.populate(); self.combo.populate();
self._setStartValue(""); self._setStartValue();
} else { } else {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -16660,9 +16660,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
_makeMap: function (values) { _makeMap: function (values) {
return BI.makeObject(values || []); return BI.makeObject(values || []);
@ -17066,20 +17064,20 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, opts.el), }, opts.el),
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
var startValue = self._startValue; var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, { BI.isNotNull(self.storeValue) && (op = BI.extend(op || {}, {
selectedValues: [self.storeValue] selectedValues: [self.storeValue]
})); }));
opts.itemsCreator(op, function (ob) { opts.itemsCreator(op, function (ob) {
hasNext = ob.hasNext; hasNext = ob.hasNext;
var firstItems = []; var firstItems = [];
if (op.times === 1 && self.storeValue) { if (op.times === 1 && BI.isNotNull(self.storeValue)) {
var json = BI.map([self.storeValue], function (i, v) { var json = BI.map([self.storeValue], function (i, v) {
var txt = opts.valueFormatter(v) || v; var txt = opts.valueFormatter(v) || v;
return { return {
text: txt, text: txt,
value: v, value: v,
title: txt, title: txt,
selected: false selected: true
}; };
}); });
firstItems = self._createItems(json); firstItems = self._createItems(json);
@ -17121,16 +17119,14 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, 30); }, 30);
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
setStartValue: function (v) { setStartValue: function (v) {
this._startValue = v; this._startValue = v;
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.button_group.setValue(this.storeValue); this.button_group.setValue(this.storeValue);
}, },
@ -17161,7 +17157,8 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}); });
BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);/** BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader);
/**
* 带加载的单选下拉面板 * 带加载的单选下拉面板
* @class BI.SingleSelectPopupView * @class BI.SingleSelectPopupView
* @extends Widget * @extends Widget
@ -17852,8 +17849,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
v || (v = ""); if (BI.isNull(v)) {
if (v === "") {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));

12
src/widget/singleselect/singleselect.combo.js

@ -52,11 +52,11 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue();
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue();
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
@ -69,7 +69,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self.populate(); self.populate();
self._setStartValue(""); self._setStartValue();
}); });
} }
}); });
@ -82,7 +82,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
self.combo.populate(); self.combo.populate();
self._setStartValue(""); self._setStartValue();
} else { } else {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -193,9 +193,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
_makeMap: function (values) { _makeMap: function (values) {
return BI.makeObject(values || []); return BI.makeObject(values || []);

12
src/widget/singleselect/singleselect.loader.js

@ -55,20 +55,20 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, opts.el), }, opts.el),
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
var startValue = self._startValue; var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, { BI.isNotNull(self.storeValue) && (op = BI.extend(op || {}, {
selectedValues: [self.storeValue] selectedValues: [self.storeValue]
})); }));
opts.itemsCreator(op, function (ob) { opts.itemsCreator(op, function (ob) {
hasNext = ob.hasNext; hasNext = ob.hasNext;
var firstItems = []; var firstItems = [];
if (op.times === 1 && self.storeValue) { if (op.times === 1 && BI.isNotNull(self.storeValue)) {
var json = BI.map([self.storeValue], function (i, v) { var json = BI.map([self.storeValue], function (i, v) {
var txt = opts.valueFormatter(v) || v; var txt = opts.valueFormatter(v) || v;
return { return {
text: txt, text: txt,
value: v, value: v,
title: txt, title: txt,
selected: false selected: true
}; };
}); });
firstItems = self._createItems(json); firstItems = self._createItems(json);
@ -110,16 +110,14 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
}, 30); }, 30);
}, },
_assertValue: function (val) { _assertValue: function (val) {},
val || (val = "");
},
setStartValue: function (v) { setStartValue: function (v) {
this._startValue = v; this._startValue = v;
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.button_group.setValue(this.storeValue); this.button_group.setValue(this.storeValue);
}, },

3
src/widget/singleselect/trigger/searcher.singleselect.js

@ -110,8 +110,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
v || (v = ""); if (BI.isNull(v)) {
if (v === "") {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));

Loading…
Cancel
Save