Browse Source

Pull request #2987: KERNEL-12408 chore: base中eslint修改

Merge in VISUAL/fineui from ~CHAOS.WANG/fineui:master to master

* commit '58b827c1f7252cf98e9d4be51a75fbb8190c3a9d':
  KERNEL-12408 chore: base中eslint修改
  KERNEL-12408 chore: base/layer中eslint修改
  KERNEL-12408 chore: base/combination中eslint修改
  chore:base中eslint修改
es6
Chaos.Wang 2 years ago
parent
commit
d8ad79eef2
  1. 3
      .eslintrc
  2. 1
      src/base/collection/__test__/collection.test.js
  3. 28
      src/base/collection/collection.js
  4. 14
      src/base/combination/bubble.js
  5. 8
      src/base/combination/combo.js
  6. 6
      src/base/combination/expander.js
  7. 22
      src/base/combination/group.button.js
  8. 7
      src/base/combination/group.virtual.js
  9. 4
      src/base/combination/loader.js
  10. 3
      src/base/combination/navigation.js
  11. 12
      src/base/combination/searcher.js
  12. 2
      src/base/combination/switcher.js
  13. 2
      src/base/combination/tab.js
  14. 25
      src/base/combination/tree.button.js
  15. 2
      src/base/foundation/__test__/message.test.js
  16. 10
      src/base/foundation/message.js
  17. 1
      src/base/grid/__test__/grid.test.js
  18. 4
      src/base/grid/grid.js
  19. 1
      src/base/layer/__test__/layer.popover.test.js
  20. 7
      src/base/layer/layer.drawer.js
  21. 3
      src/base/layer/layer.popover.js
  22. 44
      src/base/layer/layer.popup.js
  23. 1
      src/base/layer/layer.searcher.js
  24. 10
      src/base/list/listview.js
  25. 1
      src/base/list/virtualgrouplist.js
  26. 6
      src/base/list/virtuallist.js
  27. 2
      src/base/tree/customtree.js

3
.eslintrc

@ -2,7 +2,8 @@
"env": {
"browser": true,
"node": true,
"es6": true
"es6": true,
"jest": true
},
"globals": {
"window": true,

1
src/base/collection/__test__/collection.test.js

@ -5,7 +5,6 @@
*/
describe("CollectionTest", function () {
/**
* test_author_windy
*/

28
src/base/collection/collection.js

@ -58,7 +58,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
if (o.overflowY === false) {
scrollable = false;
} else {
scrollable = "y"
scrollable = "y";
}
} else {
if (o.overflowY === false) {
@ -101,10 +101,10 @@ BI.CollectionView = BI.inherit(BI.Widget, {
for (var index = 0, len = o.items.length; index < len; index++) {
var cellMetadatum = o.cellSizeAndPositionGetter(index);
if (cellMetadatum.height == null || isNaN(cellMetadatum.height) ||
cellMetadatum.width == null || isNaN(cellMetadatum.width) ||
cellMetadatum.x == null || isNaN(cellMetadatum.x) ||
cellMetadatum.y == null || isNaN(cellMetadatum.y)) {
if (BI.isNull(cellMetadatum.height) || isNaN(cellMetadatum.height) ||
BI.isNull(cellMetadatum.width) || isNaN(cellMetadatum.width) ||
BI.isNull(cellMetadatum.x) || isNaN(cellMetadatum.x) ||
BI.isNull(cellMetadatum.y) || isNaN(cellMetadatum.y)) {
throw Error();
}
@ -124,16 +124,18 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_cellRenderers: function (height, width, x, y) {
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y);
return this._cellGroupRenderer();
},
_cellGroupRenderer: function () {
var self = this, o = this.options;
var self = this;
var rendered = [];
BI.each(this._lastRenderedCellIndices, function (i, index) {
var cellMetadata = self._sectionManager.getCellMetadata(index);
rendered.push(cellMetadata);
});
return rendered;
},
@ -167,16 +169,16 @@ BI.CollectionView = BI.inherit(BI.Widget, {
var topMap = BI.invert(tops);
// 存储上下左右四个边界
var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {};
var assertMinBorder = function (border, offset) {
if (border[offset] == null) {
function assertMinBorder(border, offset) {
if (BI.isNull(border[offset])) {
border[offset] = Number.MAX_VALUE;
}
};
var assertMaxBorder = function (border, offset) {
if (border[offset] == null) {
}
function assertMaxBorder(border, offset) {
if (BI.isNull(border[offset])) {
border[offset] = 0;
}
};
}
for (var i = 0, len = childrenToDisplay.length; i < len; i++) {
var datum = childrenToDisplay[i];
var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1];
@ -213,7 +215,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
left: datum.x,
top: datum.y,
_left: datum.x,
_top: datum.y,
_top: datum.y
// _width: datum.width,
// _height: datum.height
});

14
src/base/combination/bubble.js

@ -6,6 +6,7 @@
BI.Bubble = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.Bubble.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-popper",
attributes: {
@ -36,7 +37,7 @@
el: {},
popup: {},
comboClass: "bi-combo-popup",
hoverClass: "bi-combo-hover",
hoverClass: "bi-combo-hover"
});
},
@ -104,14 +105,14 @@
_initPullDownAction: function () {
var self = this, o = this.options;
var evs = (this.options.trigger || "").split(",");
var st = function (e) {
function st (e) {
if (o.stopEvent) {
e.stopEvent();
}
if (o.stopPropagation) {
e.stopPropagation();
}
};
}
var enterPopup = false;
@ -217,6 +218,8 @@
}
});
break;
default:
break;
}
});
},
@ -229,7 +232,7 @@
_assertPopupView: function () {
var self = this, o = this.options;
if (this.popupView == null) {
if (BI.isNull(this.popupView)) {
this.popupView = BI.createWidget(BI.isFunction(this.options.popup) ? this.options.popup() : this.options.popup, {
type: "bi.bubble_popup_view",
showArrow: o.showArrow,
@ -286,6 +289,7 @@
return;
}
this._hideView(e);
return true;
},
@ -319,7 +323,7 @@
},
_popupView: function (e) {
var self = this, o = this.options;
var o = this.options;
this._assertPopupViewRender();
this.fireEvent(BI.Bubble.EVENT_BEFORE_POPUPVIEW);
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下

8
src/base/combination/combo.js

@ -1,6 +1,7 @@
!(function () {
var needHideWhenAnotherComboOpen = {};
var currentOpenedCombos = {};
/**
* @class BI.Combo
* @extends BI.Widget
@ -11,6 +12,7 @@
},
_defaultConfig: function () {
var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""),
attributes: {
@ -107,7 +109,7 @@
_assertPopupView: function () {
var self = this, o = this.options;
if (this.popupView == null) {
if (BI.isNull(this.popupView)) {
this.popupView = BI.createWidget(BI.isFunction(this.options.popup) ? this.options.popup() : this.options.popup, {
type: "bi.popup_view",
showArrow: o.showArrow,
@ -280,10 +282,12 @@
delete p.adaptHeight;
p.dir = "right";
break;
default:
break;
}
if ("adaptHeight" in p) {
this.resetListHeight(p["adaptHeight"]);
this.resetListHeight(p.adaptHeight);
}
var width = this.combo.element.outerWidth();
var height = this.combo.element.outerHeight();

6
src/base/combination/expander.js

@ -126,6 +126,8 @@ BI.Expander = BI.inherit(BI.Widget, {
}));
}
break;
default:
break;
}
});
},
@ -136,7 +138,7 @@ BI.Expander = BI.inherit(BI.Widget, {
_assertPopupView: function () {
var self = this, o = this.options;
if (this.popupView == null) {
if (BI.isNull(this.popupView)) {
this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group",
cls: "expander-popup",
@ -255,6 +257,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (this.expander.options.id === id) {
return this.expander;
}
return this.popupView && this.popupView.getNodeById(id);
},
@ -262,6 +265,7 @@ BI.Expander = BI.inherit(BI.Widget, {
if (this.expander.getValue() === value) {
return this.expander;
}
return this.popupView && this.popupView.getNodeByValue(value);
},

22
src/base/combination/group.button.js

@ -42,7 +42,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
_createBtns: function (items) {
var o = this.options;
return BI.createWidgets(BI.createItems(items, {
type: "bi.text_button"
}), this);
@ -66,6 +65,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
case BI.ButtonGroup.CHOOSE_TYPE_NONE:
self.setValue([]);
break;
default:
break;
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.ButtonGroup.EVENT_CHANGE, value, obj);
@ -95,15 +96,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
});
});
}
return btns;
},
_packageSimpleItems: function (btns) {
var o = this.options;
return BI.map(o.items, function (i, item) {
if (BI.stripEL(item) === item) {
return btns[i];
}
return BI.extend({}, item, {
el: btns[i]
});
@ -122,12 +126,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
lay = BI.formatEL(lay.items[0]).el;
}
lay.items = items;
return layout;
},
// 如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return BI.isArray(o.layouts) ? (o.layouts.length === 1 && !BI.isArray(o.items[0])) : true;
},
@ -140,12 +146,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
prependItems: function (items) {
var o = this.options;
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons);
if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns);
return;
}
@ -154,13 +160,13 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
addItems: function (items) {
var o = this.options;
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(this.buttons, btns);
// 如果是一个简单的layout
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns);
return;
}
@ -257,6 +263,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
v.push(item.getValue());
}
});
return v;
},
@ -267,6 +274,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
v.push(item.getValue());
}
});
return v;
},
@ -285,6 +293,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
btns.push(item);
}
});
return btns;
},
@ -295,6 +304,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
btns.push(item);
}
});
return btns;
},
@ -303,9 +313,11 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
BI.any(this.buttons, function (i, item) {
if (item.isEnabled() && item.getValue() === value) {
index = i;
return true;
}
});
return index;
},
@ -314,9 +326,11 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
BI.any(this.buttons, function (i, item) {
if (item.isEnabled() && item.options.id === id) {
node = item;
return true;
}
});
return node;
},
@ -325,9 +339,11 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
BI.any(this.buttons, function (i, item) {
if (item.isEnabled() && item.getValue() === value) {
node = item;
return true;
}
});
return node;
},

7
src/base/combination/group.virtual.js

@ -29,9 +29,10 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
var o = this.options;
var map = this.buttonMap = {};
var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts];
for (var i = layouts.length - 1; i > 0; i--) {
for (let i = layouts.length - 1; i > 0; i--) {
items = BI.map(items, function (k, it) {
var el = BI.stripEL(it);
return BI.extend({}, layouts[i], {
items: [
BI.extend({}, layouts[i].el, {
@ -47,6 +48,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
});
});
}
return items;
},
@ -60,6 +62,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
lay = BI.formatEL(lay.items[0]).el;
}
lay.items = items;
return layout;
},
@ -93,6 +96,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
}
}
});
return v;
},
@ -119,6 +123,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
}
}
});
return v;
},

4
src/base/combination/loader.js

@ -122,6 +122,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (BI.isNumber(o.count)) {
return this.count < o.count;
}
return !!o.hasPrev.apply(this, [{
times: this.times,
count: this.count
@ -133,6 +134,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (BI.isNumber(o.count)) {
return this.count < o.count;
}
return !!o.hasNext.apply(this, [{
times: this.times,
count: this.count
@ -175,6 +177,7 @@ BI.Loader = BI.inherit(BI.Widget, {
self.populate.apply(self, arguments);
o.onLoaded();
}]);
return false;
}
this.options.items = items;
@ -195,6 +198,7 @@ BI.Loader = BI.inherit(BI.Widget, {
this.prev.invisible();
}
}
return true;
},

3
src/base/combination/navigation.js

@ -45,6 +45,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
cardCreator: function (v) {
var card = o.cardCreator(v);
self.cardMap[v] = card;
return card;
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
@ -54,7 +55,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
if (BI.isFunction(o.showIndex)) {
this.__watch(o.showIndex, function (context, newValue) {
self.setSelect(newValue);
})
});
}
},

12
src/base/combination/searcher.js

@ -82,6 +82,8 @@ BI.Searcher = BI.inherit(BI.Widget, {
self._pauseSearch();
}
break;
default:
break;
}
});
},
@ -109,6 +111,8 @@ BI.Searcher = BI.inherit(BI.Widget, {
values.push(obj.getValue());
o.adapter && o.adapter.setValue(values);
break;
default:
break;
}
}
self.fireEvent(BI.Searcher.EVENT_CHANGE, value, obj);
@ -140,7 +144,6 @@ BI.Searcher = BI.inherit(BI.Widget, {
},
_pauseSearch: function () {
var o = this.options, name = this.getName();
this._stop = true;
BI.nextTick(function (name) {
BI.Maskers.hide(name);
@ -153,7 +156,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
},
_stopSearch: function () {
var o = this.options, name = this.getName();
var name = this.getName();
this._stop = true;
BI.Maskers.hide(name);
if (this._isSearching === true) {
@ -175,6 +178,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
this.popupView.populate(find, match, keyword);
o.isAutoSync && o.adapter && o.adapter.getValue && this.popupView.setValue(o.adapter.getValue());
self.fireEvent(BI.Searcher.EVENT_SEARCHING);
return;
}
this.popupView.loading && this.popupView.loading();
@ -203,6 +207,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
if (BI.isEmptyString(res[res.length - 1])) {
res = res.slice(0, res.length - 1);
}
return BI.isNull(res) ? "" : res[res.length - 1];
}
},
@ -246,6 +251,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
hasMatched: function () {
this._assertPopupView();
return this.popupView.hasMatched();
},
@ -288,8 +294,8 @@ BI.Searcher = BI.inherit(BI.Widget, {
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue();
return this.popupView.getValue();
},
populate: function (result, searchResult, keyword) {

2
src/base/combination/switcher.js

@ -265,6 +265,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
if (this.switcher.attr("id") === id) {
return this.switcher;
}
return this.popupView && this.popupView.getNodeById(id);
},
@ -272,6 +273,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
if (this.switcher.getValue() === value) {
return this.switcher;
}
return this.popupView && this.popupView.getNodeByValue(value);
},

2
src/base/combination/tab.js

@ -112,7 +112,7 @@ BI.Tab = BI.inherit(BI.Widget, {
},
removeTab: function (cardname) {
var self = this, o = this.options;
var self = this;
BI.any(this.cardMap, function (name, card) {
if (BI.isEqual(name, (cardname + ""))) {
self.layout.deleteCardByName(name);

25
src/base/combination/tree.button.js

@ -16,6 +16,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (!BI.isFunction(item.setSelected)) {
item.setNotSelectedValue(v);
return;
}
if (BI.deepContains(v, item.getValue())) {
@ -31,6 +32,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (BI.isFunction(item.setEnabledValue)) {
item.setEnabledValue(v);
return;
}
if (BI.deepContains(v, item.getValue())) {
@ -46,6 +48,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (!BI.isFunction(item.setSelected)) {
item.setValue(v);
return;
}
if (BI.deepContains(v, item.getValue())) {
@ -61,12 +64,14 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && !BI.isFunction(item.setSelected)) {
v = BI.concat(v, item.getNotSelectedValue());
return;
}
if (item.isEnabled() && item.isSelected && !item.isSelected()) {
v.push(item.getValue());
}
});
return v;
},
@ -75,12 +80,14 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && !BI.isFunction(item.setSelected)) {
v = BI.concat(v, item.getValue());
return;
}
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
});
return v;
},
@ -89,12 +96,14 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && !BI.isFunction(item.setSelected)) {
btns = btns.concat(item.getSelectedButtons());
return;
}
if (item.isSelected && item.isSelected()) {
btns.push(item);
}
});
return btns;
},
@ -103,12 +112,14 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && !BI.isFunction(item.setSelected)) {
btns = btns.concat(item.getNotSelectedButtons());
return;
}
if (item.isSelected && !item.isSelected()) {
btns.push(item);
}
});
return btns;
},
@ -118,12 +129,14 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && !BI.isFunction(item.setSelected)) {
leaves = leaves.concat(item.getAllLeaves());
return;
}
if (item.isEnabled()) {
leaves.push(item);
}
});
return leaves;
},
@ -133,9 +146,11 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
var vs = item.getValue();
if (item.isEnabled() && (vs === value || BI.contains(vs, value))) {
index = i;
return true;
}
});
return index;
},
@ -145,14 +160,17 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
if (item.isEnabled()) {
if (item.attr("id") === id) {
node = item;
return true;
} else if (BI.isFunction(item.getNodeById)) {
if (node = item.getNodeById(id)) {
node = item.getNodeById(id);
if (node) {
return true;
}
}
}
});
return node;
},
@ -161,15 +179,18 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.any(this.buttons, function (i, item) {
if (item.isEnabled()) {
if (BI.isFunction(item.getNodeByValue)) {
if (node = item.getNodeByValue(value)) {
node = item.getNodeByValue(value);
if (node) {
return true;
}
} else if (item.attr("value") === value) {
node = item;
return true;
}
}
});
return node;
}
});

2
src/base/foundation/__test__/message.test.js

@ -4,7 +4,6 @@
* Created by windy on 2020/3/9
*/
describe("MessageTest", function () {
/**
* test_author_windy
*/
@ -44,4 +43,3 @@ describe("MessageTest", function () {
expect(body.find(".bi-toast").length).to.equal(1);
});
});

10
src/base/foundation/message.js

@ -3,8 +3,7 @@
* 弹出提示消息框用于模拟阻塞操作通过回调函数实现
* @class BI.Msg
*/
BI.Msg = function () {
BI.Msg = ((function () {
var $mask, $pop;
var messageShows = [];
@ -69,6 +68,7 @@ BI.Msg = function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy?.();
}, 5000);
return function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy?.();
@ -92,14 +92,14 @@ BI.Msg = function () {
right: 0,
bottom: 0
}).appendTo("body");
var close = function () {
function close () {
messageShows[messageShows.length - 1].destroy();
messageShows.pop();
if (messageShows.length === 0) {
$mask.remove();
$mask = null;
}
};
}
var controlItems = [];
if (hasCancel === true) {
controlItems.push({
@ -231,4 +231,4 @@ BI.Msg = function () {
messageShows[messageShows.length] = BI.createWidget(conf);
}
};
}();
})());

1
src/base/grid/__test__/grid.test.js

@ -4,7 +4,6 @@
* Created by windy on 2020/3/20
*/
describe("GridTest", function () {
/**
* test_author_windy
*/

4
src/base/grid/grid.js

@ -61,7 +61,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (o.overflowY === false) {
scrollable = false;
} else {
scrollable = "y"
scrollable = "y";
}
} else {
if (o.overflowY === false) {
@ -279,7 +279,7 @@ BI.GridView = BI.inherit(BI.Widget, {
},
_populate: function (items) {
var self = this, o = this.options;
var o = this.options;
this._reRange();
if (items && items !== this.options.items) {
this.options.items = items;

1
src/base/layer/__test__/layer.popover.test.js

@ -5,7 +5,6 @@
*/
describe("PopoverTest", function () {
/**
* test_author_windy
*/

7
src/base/layer/layer.drawer.js

@ -144,6 +144,8 @@ BI.Drawer = BI.inherit(BI.Widget, {
top: "100%"
});
break;
default:
break;
}
},
@ -172,6 +174,8 @@ BI.Drawer = BI.inherit(BI.Widget, {
top: "calc(100% - " + size.height + "px)"
});
break;
default:
break;
}
callback && callback();
});
@ -180,7 +184,6 @@ BI.Drawer = BI.inherit(BI.Widget, {
hide: function (callback) {
var self = this, o = this.options;
requestAnimationFrame(function () {
var size = self._getSuitableSize();
switch (o.placement) {
case "right":
self.element.css({
@ -202,6 +205,8 @@ BI.Drawer = BI.inherit(BI.Widget, {
top: "100%"
});
break;
default:
break;
}
setTimeout(callback, 300);
});

3
src/base/layer/layer.popover.js

@ -157,7 +157,6 @@ BI.Popover = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this;
var o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
@ -168,7 +167,7 @@ BI.Popover = BI.inherit(BI.Widget, {
_getSuitableBodyHeight: function (height) {
var o = this.options;
var c = this._constant;
return BI.clamp(height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap);
},

44
src/base/layer/layer.popup.js

@ -50,12 +50,14 @@ BI.PopupView = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
var fn = function (e) {
function fn (e) {
e.stopPropagation();
}, stop = function (e) {
}
function stop (e) {
e.stopEvent();
return false;
};
}
this.element.css({
"z-index": BI.zIndex_popup,
"min-width": BI.isNumeric(o.minWidth) ? (o.minWidth / BI.pixRatio + BI.pixUnit) : o.minWidth,
@ -108,7 +110,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
type: "bi.absolute",
cls: "bi-bubble-arrow-wrapper",
items: [{
el: this.arrow,
el: this.arrow
}]
});
// 因为三角符号的原因位置变大了,需要占位
@ -121,7 +123,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
items: [{
el: this.arrowWrapper,
left: 0,
top: 0,
top: 0
}, {
el: this.placeholder
}]
@ -139,6 +141,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
"padding-left": o.innerHgap / BI.pixRatio + BI.pixUnit,
"padding-right": o.innerHgap / BI.pixRatio + BI.pixUnit
});
return this.button_group;
},
@ -147,6 +150,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) {
return;
}
return BI.createWidget(o.tool);
},
@ -155,6 +159,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (o.tabs.length === 0) {
return;
}
return BI.createWidget({
type: "bi.center",
cls: "list-view-tab",
@ -218,7 +223,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
top: o.tgap + o.vgap,
left: 0,
right: "",
bottom: "",
bottom: ""
};
placeholderStyle = {
left: 0,
@ -237,7 +242,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
top: o.bgap + o.vgap,
left: "",
right: 0,
bottom: "",
bottom: ""
};
placeholderStyle = {
left: 0,
@ -257,14 +262,14 @@ BI.PopupView = BI.inherit(BI.Widget, {
bottom: o.bgap + o.vgap,
left: 0,
right: "",
top: "",
top: ""
};
placeholderStyle = {
left: 0,
right: 0,
height: this._const.TRIANGLE_LENGTH,
top: "",
bottom: -this._const.TRIANGLE_LENGTH,
bottom: -this._const.TRIANGLE_LENGTH
};
break;
case "top,left":
@ -276,14 +281,14 @@ BI.PopupView = BI.inherit(BI.Widget, {
bottom: o.bgap + o.vgap,
right: 0,
left: "",
top: "",
top: ""
};
placeholderStyle = {
left: 0,
right: 0,
height: this._const.TRIANGLE_LENGTH,
top: "",
bottom: -this._const.TRIANGLE_LENGTH,
bottom: -this._const.TRIANGLE_LENGTH
};
break;
case "left":
@ -296,7 +301,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
right: o.rgap + o.hgap,
top: 0,
bottom: "",
left: "",
left: ""
};
placeholderStyle = {
top: 0,
@ -315,7 +320,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
right: o.rgap + o.hgap,
bottom: 0,
top: "",
left: "",
left: ""
};
placeholderStyle = {
top: 0,
@ -335,7 +340,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
left: o.lgap + o.hgap,
top: 0,
bottom: "",
right: "",
right: ""
};
placeholderStyle = {
top: 0,
@ -354,7 +359,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
left: o.lgap + o.hgap,
bottom: 0,
top: "",
right: "",
right: ""
};
placeholderStyle = {
top: 0,
@ -372,8 +377,15 @@ BI.PopupView = BI.inherit(BI.Widget, {
break;
case "innerLeft":
break;
default:
break;
}
this.element.removeClass("left").removeClass("right").removeClass("top").removeClass("bottom").addClass(direction);
this.element
.removeClass("left")
.removeClass("right")
.removeClass("top")
.removeClass("bottom")
.addClass(direction);
this.arrow.element.css(style);
this.arrowWrapper.element.css(wrapperStyle);
this.placeholder.element.css(placeholderStyle);

1
src/base/layer/layer.searcher.js

@ -9,6 +9,7 @@
BI.SearcherView = BI.inherit(BI.Pane, {
_defaultConfig: function () {
var conf = BI.SearcherView.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-searcher-view bi-card",
tipText: BI.i18nText("BI-No_Select"),

10
src/base/list/listview.js

@ -21,13 +21,13 @@ BI.ListView = BI.inherit(BI.Widget, {
},
init: function () {
var self = this;
this.renderedIndex = -1;
this.cache = {};
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
items: [BI.extend({
@ -72,10 +72,11 @@ BI.ListView = BI.inherit(BI.Widget, {
var index = (this.cache[this.renderedIndex] && (this.cache[this.renderedIndex].index + o.blockSize)) || 0;
var cnt = this.renderedIndex + 1;
var lastHeight;
var getElementHeight = function () {
function getElementHeight () {
return self.container.element.height();
};
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) {
}
lastHeight = getElementHeight();
while ((lastHeight) < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize);
this.container.addItems(items.map(function (item, i) {
return o.itemFormatter(item, index + i);
@ -93,7 +94,6 @@ BI.ListView = BI.inherit(BI.Widget, {
},
_calculateBlocksToRender: function () {
var o = this.options;
this._renderMoreIf();
},

1
src/base/list/virtualgrouplist.js

@ -27,6 +27,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
items: [{

6
src/base/list/virtuallist.js

@ -20,13 +20,13 @@ BI.VirtualList = BI.inherit(BI.Widget, {
},
init: function () {
var self = this;
this.renderedIndex = -1;
this.cache = {};
},
render: function () {
var self = this, o = this.options;
var self = this;
return {
type: "bi.vertical",
items: [{
@ -45,7 +45,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
ref: function () {
self.bottomBlank = this;
}
}],
}]
};
},

2
src/base/tree/customtree.js

@ -68,6 +68,7 @@ BI.CustomTree = BI.inherit(BI.Widget, {
}
var args = Array.prototype.slice.call(arguments, 0);
args[0].node = node;
return o.itemsCreator.apply(self, args);
};
BI.isNull(item.popup.el) && (item.popup.el = BI.deepClone(o.el));
@ -76,6 +77,7 @@ BI.CustomTree = BI.inherit(BI.Widget, {
items.push(node);
}
});
return items;
},

Loading…
Cancel
Save