Browse Source

Pull request #2649: KERNEL-11034 refactor: 去掉FineUI中Array.prototype的拓展

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'a7120f930ef2bc4cff1bf2822bf26d83b72c1d9c':
  无JIRA fix: 修复半选按钮的样式
  Revert "无JIRA  去掉无意义的scrolly"
  KERNEL-11034 refactor: 去掉FineUI中Array.prototype的拓展
  无JIRA  去掉无意义的scrolly
es6
Dailer 3 years ago
parent
commit
335423a991
  1. 5
      src/core/controller/controller.broadcast.js
  2. 5
      src/less/base/single/button/button.half.less
  3. 24
      src/widget/multiselect/multiselect.combo.js
  4. 6
      src/widget/multiselect/multiselect.combo.nobar.js
  5. 17
      src/widget/multiselect/multiselect.insert.combo.js
  6. 15
      src/widget/multiselect/multiselect.insert.combo.nobar.js

5
src/core/controller/controller.broadcast.js

@ -30,10 +30,7 @@ BI.BroadcastController = BI.inherit(BI.Controller, {
remove: function (name, fn) { remove: function (name, fn) {
var self = this; var self = this;
if (fn) { if (fn) {
BI.remove(this._broadcasts[name], function (idx) { BI.remove(this._broadcasts[name], fn);
return self._broadcasts[name].indexOf(fn) === idx;
});
this._broadcasts[name].remove(fn);
if (this._broadcasts[name].length === 0) { if (this._broadcasts[name].length === 0) {
delete this._broadcasts[name]; delete this._broadcasts[name];
} }

5
src/less/base/single/button/button.half.less

@ -3,6 +3,7 @@
.bi-half-button { .bi-half-button {
.border-radius(2px); .border-radius(2px);
box-sizing: border-box; box-sizing: border-box;
&:after { &:after {
position: absolute; position: absolute;
left: 2px; left: 2px;
@ -12,8 +13,8 @@
background-color: @color-bi-background-half-button-content; background-color: @color-bi-background-half-button-content;
content: ''; content: '';
} }
&,
.disabled { &.disabled {
&:after { &:after {
background-color: @color-bi-background-disabled-half-button-content; background-color: @color-bi-background-disabled-half-button-content;
} }

24
src/widget/multiselect/multiselect.combo.js

@ -17,14 +17,15 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
var self = this; var o = this.options; var self = this;
var o = this.options;
BI.MultiSelectCombo.superclass._init.apply(this, arguments); BI.MultiSelectCombo.superclass._init.apply(this, arguments);
var assertShowValue = function () { var assertShowValue = function () {
if (BI.isKey(self._startValue)) { if (BI.isKey(self._startValue)) {
if (self.storeValue.type === BI.Selection.All) { if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue); BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || []; self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue); BI.pushDistinct(self.storeValue.assist, self._startValue);
} else { } else {
BI.pushDistinct(self.storeValue.value, self._startValue); BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue); BI.remove(self.storeValue.assist, self._startValue);
@ -280,7 +281,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_itemsCreator4Trigger: function (op, callback) { _itemsCreator4Trigger: function (op, callback) {
var self = this; var o = this.options; var self = this;
var o = this.options;
o.itemsCreator(op, function (res) { o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) { if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉 // 预防trigger内部把当前的storeValue改掉
@ -311,7 +313,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_joinKeywords: function (keywords, callback) { _joinKeywords: function (keywords, callback) {
var self = this; var o = this.options; var self = this;
var o = this.options;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.requesting = true; this.requesting = true;
o.itemsCreator({ o.itemsCreator({
@ -322,7 +325,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
digest(values); digest(values);
}); });
function digest (items) { function digest(items) {
var selectedMap = self._makeMap(items); var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) { BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) { if (BI.isNotNull(selectedMap[val])) {
@ -334,7 +337,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_joinAll: function (res, callback) { _joinAll: function (res, callback) {
var self = this; var o = this.options; var self = this;
var o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
if (this.storeValue.type === res.type) { if (this.storeValue.type === res.type) {
@ -385,11 +389,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_adjust: function (callback) { _adjust: function (callback) {
var self = this; var o = this.options; var self = this;
var o = this.options;
adjust(); adjust();
callback(); callback();
function adjust () { function adjust() {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
@ -399,7 +404,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
_join: function (res, callback) { _join: function (res, callback) {
var self = this; var o = this.options; var self = this;
var o = this.options;
this._assertValue(res); this._assertValue(res);
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) { if (this.storeValue.type === res.type) {

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

@ -23,7 +23,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
if (self.storeValue.type === BI.Selection.All) { if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue); BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || []; self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue); BI.pushDistinct(self.storeValue.assist, self._startValue);
} else { } else {
BI.pushDistinct(self.storeValue.value, self._startValue); BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue); BI.remove(self.storeValue.assist, self._startValue);
@ -461,11 +461,11 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
this.combo.populate.apply(this.combo, arguments); this.combo.populate.apply(this.combo, arguments);
}, },
showView:function (){ showView: function () {
this.combo.showView(); this.combo.showView();
}, },
hideView:function (){ hideView: function () {
this.combo.hideView(); this.combo.hideView();
}, },

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

@ -21,10 +21,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
BI.MultiSelectInsertCombo.superclass._init.apply(this, arguments); BI.MultiSelectInsertCombo.superclass._init.apply(this, arguments);
var assertShowValue = function () { var assertShowValue = function () {
if (BI.isKey(self._startValue)) { if (BI.isKey(self._startValue)) {
if(self.storeValue.type === BI.Selection.All) { if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue); BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || []; self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue); BI.pushDistinct(self.storeValue.assist, self._startValue);
} else { } else {
BI.pushDistinct(self.storeValue.value, self._startValue); BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue); BI.remove(self.storeValue.assist, self._startValue);
@ -282,7 +282,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_itemsCreator4Trigger: function(op, callback) { _itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options; var self = this, o = this.options;
o.itemsCreator(op, function (res) { o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) { if (op.times === 1 && BI.isNotNull(op.keywords)) {
@ -313,7 +313,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_stopEditing: function() { _stopEditing: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
@ -340,7 +340,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
digest(); digest();
function digest () { function digest() {
BI.each(keywords, function (i, val) { BI.each(keywords, function (i, val) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}); });
@ -403,7 +403,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
adjust(); adjust();
callback(); callback();
function adjust () {
function adjust() {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
@ -450,11 +451,11 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.combo.populate.apply(this.combo, arguments); this.combo.populate.apply(this.combo, arguments);
}, },
showView:function (){ showView: function () {
this.combo.showView(); this.combo.showView();
}, },
hideView:function (){ hideView: function () {
this.combo.hideView(); this.combo.hideView();
}, },

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

@ -23,7 +23,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
if (self.storeValue.type === BI.Selection.All) { if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue); BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || []; self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue); BI.pushDistinct(self.storeValue.assist, self._startValue);
} else { } else {
BI.pushDistinct(self.storeValue.value, self._startValue); BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue); BI.remove(self.storeValue.assist, self._startValue);
@ -279,7 +279,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_itemsCreator4Trigger: function(op, callback) { _itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options; var self = this, o = this.options;
o.itemsCreator(op, function (res) { o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) { if (op.times === 1 && BI.isNotNull(op.keywords)) {
@ -310,7 +310,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_stopEditing: function() { _stopEditing: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
@ -337,7 +337,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
digest(); digest();
function digest () { function digest() {
BI.each(keywords, function (i, val) { BI.each(keywords, function (i, val) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}); });
@ -400,7 +400,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
adjust(); adjust();
callback(); callback();
function adjust () {
function adjust() {
if (self.wants2Quit === true) { if (self.wants2Quit === true) {
self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false; self.wants2Quit = false;
@ -446,11 +447,11 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.combo.populate.apply(this.combo, arguments); this.combo.populate.apply(this.combo, arguments);
}, },
showView:function (){ showView: function () {
this.combo.showView(); this.combo.showView();
}, },
hideView:function (){ hideView: function () {
this.combo.hideView(); this.combo.hideView();
}, },

Loading…
Cancel
Save