Browse Source

KERNEL-11034 refactor: 去掉FineUI中Array.prototype的拓展

es6
zsmj 3 years ago
parent
commit
a5a237e3c6
  1. 5
      src/core/controller/controller.broadcast.js
  2. 20
      src/widget/multiselect/multiselect.combo.js
  3. 2
      src/widget/multiselect/multiselect.combo.nobar.js
  4. 3
      src/widget/multiselect/multiselect.insert.combo.js
  5. 3
      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) {
var self = this;
if (fn) {
BI.remove(this._broadcasts[name], function (idx) {
return self._broadcasts[name].indexOf(fn) === idx;
});
this._broadcasts[name].remove(fn);
BI.remove(this._broadcasts[name], fn);
if (this._broadcasts[name].length === 0) {
delete this._broadcasts[name];
}

20
src/widget/multiselect/multiselect.combo.js

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

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

@ -23,7 +23,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue);
BI.pushDistinct(self.storeValue.assist, self._startValue);
} else {
BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue);

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

@ -24,7 +24,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
if (self.storeValue.type === BI.Selection.All) {
BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue);
BI.pushDistinct(self.storeValue.assist, self._startValue);
} else {
BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue);
@ -403,6 +403,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM);

3
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) {
BI.remove(self.storeValue.value, self._startValue);
self.storeValue.assist = self.storeValue.assist || [];
self.storeValue.assist.pushDistinct(self._startValue);
BI.pushDistinct(self.storeValue.assist, self._startValue);
} else {
BI.pushDistinct(self.storeValue.value, self._startValue);
BI.remove(self.storeValue.assist, self._startValue);
@ -400,6 +400,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM);

Loading…
Cancel
Save