Browse Source

KERNEL-12408 chore: base/layer中eslint修改

es6
chaos0156 2 years ago
parent
commit
944eb9d9b9
  1. 1
      src/base/collection/collection.js
  2. 2
      src/base/combination/group.button.js
  3. 10
      src/base/foundation/message.js
  4. 3
      src/base/grid/__test__/grid.test.js
  5. 10
      src/base/grid/grid.js
  6. 3
      src/base/layer/__test__/layer.popover.test.js
  7. 7
      src/base/layer/layer.drawer.js
  8. 5
      src/base/layer/layer.popover.js
  9. 53
      src/base/layer/layer.popup.js
  10. 3
      src/base/layer/layer.searcher.js

1
src/base/collection/collection.js

@ -310,7 +310,6 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.element.scrollTop(o.scrollTop);
this.element.scrollLeft(o.scrollLeft);
} catch (e) {
throw new Error("Failed in some way", { cause: e });
}
this._calculateChildrenToRender();
},

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

@ -85,7 +85,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts];
for (let i = layouts.length - 1; i > 0; i--) {
for (var i = layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, layouts[i], {
items: [

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);
}
};
}();
})());

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

@ -4,7 +4,6 @@
* Created by windy on 2020/3/20
*/
describe("GridTest", function () {
/**
* test_author_windy
*/
@ -38,4 +37,4 @@ describe("GridTest", function () {
// TODO 性能展示类控件,不知道要测啥,标记一下
grid.destroy();
});
});
});

10
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) {
@ -258,7 +258,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this.container.attr("items", renderedCells);
this.renderedCells = renderedCells;
this.renderedKeys = renderedKeys;
this.renderRange = {minX: minX, minY: minY, maxX: maxX, maxY: maxY};
this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY };
}
},
@ -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;
@ -333,7 +333,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (this.options.overflowX !== !!b) {
this.options.overflowX = !!b;
BI.nextTick(function () {
self.element.css({overflowX: b ? "auto" : "hidden"});
self.element.css({ overflowX: b ? "auto" : "hidden" });
});
}
},
@ -343,7 +343,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (this.options.overflowY !== !!b) {
this.options.overflowY = !!b;
BI.nextTick(function () {
self.element.css({overflowY: b ? "auto" : "hidden"});
self.element.css({ overflowY: b ? "auto" : "hidden" });
});
}
},

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

@ -5,7 +5,6 @@
*/
describe("PopoverTest", function () {
/**
* test_author_windy
*/
@ -30,4 +29,4 @@ describe("PopoverTest", function () {
done();
}, 100);
});
});
});

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);
});

5
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);
},
@ -224,7 +223,7 @@ BI.Popover = BI.inherit(BI.Widget, {
},
setZindex: function (zindex) {
this.element.css({"z-index": zindex});
this.element.css({ "z-index": zindex });
},
destroyed: function () {

53
src/base/layer/layer.popup.js

@ -50,22 +50,24 @@ 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,
"max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth
}).bind({click: fn});
}).bind({ click: fn });
this.element.bind("mousewheel", fn);
o.stopPropagation && this.element.bind({mousedown: fn, mouseup: fn, mouseover: fn});
o.stopEvent && this.element.bind({mousedown: stop, mouseup: stop, mouseover: stop});
o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn });
o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop });
this.tool = this._createTool();
this.tab = this._createTab();
this.view = this._createView();
@ -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
}]
@ -131,7 +133,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () {
var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value });
this.button_group.element.css({
"min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight,
"padding-top": o.innerVgap / BI.pixRatio + BI.pixUnit,
@ -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,14 @@ 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);
@ -399,7 +410,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVgap;
this.view.resetHeight ? this.view.resetHeight(resetHeight) :
this.view.element.css({"max-height": resetHeight / BI.pixRatio + BI.pixUnit});
this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit });
},
setValue: function (selectedValues) {

3
src/base/layer/layer.searcher.js

@ -9,12 +9,13 @@
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"),
chooseType: BI.Selection.Single,
matcher: {// 完全匹配的构造器
matcher: { // 完全匹配的构造器
type: "bi.button_group",
behaviors: {
redmark: function () {

Loading…
Cancel
Save