Browse Source

Pull request #2990: KERNEL-12408:base中eslint的修改

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

* commit '1d8eb1bce678c80fc12188a9d0cfc48441ff3df9':
  KERNEL-12408:base中eslint的修改
  KERNEL-12408
es6
Chaos.Wang 2 years ago
parent
commit
4d716d23db
  1. 3
      .eslintrc
  2. 3
      src/base/list/__test__/listview.test.js
  3. 7
      src/base/list/virtualgrouplist.js
  4. 7
      src/base/list/virtuallist.js
  5. 1
      src/base/pager/pager.js
  6. 12
      src/base/single/0.single.js
  7. 8
      src/base/single/1.text.js
  8. 5
      src/base/single/text.pure.js
  9. 16
      src/base/single/tip/tip.tooltip.js

3
.eslintrc

@ -31,7 +31,8 @@
"rules": {
"no-param-reassign": "off",
"quotes": [2, "double"],
"comma-dangle": ["error", "never"] // 多行对象字面量中要求拖尾逗号
"comma-dangle": ["error", "always"], // 多行对象字面量中要求拖尾逗号
"no-empty":["error", { "allowEmptyCatch": true }]
}
}, {
"files": ["webpack/*.js", "./*.js", "lib/**/*.js", "lib/*.js", "./bin/*.js", "./bin/**/*.js"],

3
src/base/list/__test__/listview.test.js

@ -6,7 +6,6 @@
// TODO 展示类控件测什么没想好标记一下
describe("ListView && VirtualList", function () {
/**
* test_author_windy
*/
@ -45,4 +44,4 @@ describe("ListView && VirtualList", function () {
});
a.destroy();
});
});
});

7
src/base/list/virtualgrouplist.js

@ -88,10 +88,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
var minContentHeight = o.scrollTop + height + o.overscanHeight;
var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1;
var lastHeight;
var getElementHeight = function () {
function getElementHeight () {
return self.container.element.height() + self.topBlank.element.height() + self.bottomBlank.element.height();
};
while ((lastHeight = this.renderedIndex === -1 ? 0 : getElementHeight()) < minContentHeight && index < o.items.length) {
}
lastHeight = this.renderedIndex === -1 ? 0 : getElementHeight();
while (lastHeight < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize);
this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) {
return o.itemFormatter(item, index + i);

7
src/base/list/virtuallist.js

@ -71,10 +71,11 @@ BI.VirtualList = BI.inherit(BI.Widget, {
var minContentHeight = o.scrollTop + height + o.overscanHeight;
var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1;
var lastHeight;
var getElementHeight = function () {
function getElementHeight() {
return self.container.element.height() + self.topBlank.element.height() + self.bottomBlank.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);

1
src/base/pager/pager.js

@ -41,7 +41,6 @@ BI.Pager = BI.inherit(BI.Widget, {
},
render: function () {
var self = this;
this.currPage = BI.result(this.options, "curr");
// 翻页太灵敏
// this._lock = false;

12
src/base/single/0.single.js

@ -15,13 +15,14 @@ var delayingTooltips;
BI.Single = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.Single.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
readonly: false,
title: null,
warningTitle: null,
tipType: null, // success或warning
belowMouse: false, // title是否跟随鼠标
enableHover: false
belowMouse: false, // title是否跟随鼠标
enableHover: false,
});
},
@ -70,7 +71,7 @@ BI.Single = BI.inherit(BI.Widget, {
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({
belowMouse: o.belowMouse,
container: o.container
container: o.container,
});
}
},
@ -136,7 +137,6 @@ BI.Single = BI.inherit(BI.Widget, {
}
}
}, 500);
});
this.element.on("mouseleave.title" + this.getName(), function (e) {
self._e = null;
@ -193,6 +193,7 @@ BI.Single = BI.inherit(BI.Widget, {
if (BI.isFunction(title)) {
return title();
}
return title;
},
@ -201,6 +202,7 @@ BI.Single = BI.inherit(BI.Widget, {
if (BI.isFunction(title)) {
return title();
}
return title;
},
@ -222,6 +224,6 @@ BI.Single = BI.inherit(BI.Widget, {
this.showTimeout = null;
}
BI.Tooltips.remove(this.getName());
}
},
});
BI.shortcut("bi.single", BI.Single);

8
src/base/single/1.text.js

@ -45,13 +45,13 @@
});
}
if (BI.isWidthOrHeight(o.height)) {
this.element.css({lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height});
this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height });
}
if (BI.isWidthOrHeight(o.lineHeight)) {
this.element.css({lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight});
this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight });
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth});
this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth });
}
this.element.css({
textAlign: o.textAlign,
@ -108,6 +108,7 @@
_getShowText: function () {
var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text;
return BI.isKey(text) ? BI.Text.formatText(text + "") : text;
},
@ -165,6 +166,7 @@
text = formatters[i](text);
}
}
return text;
};
BI.shortcut("bi.text", BI.Text);

5
src/base/single/text.pure.js

@ -5,7 +5,7 @@
BI.PureText = BI.inherit(BI.Widget, {
props: {
tagName: null
tagName: null,
},
render: function () {
@ -27,6 +27,7 @@
if (!BI.isKey(text)) {
return "";
}
return BI.Text.formatText(text + "");
},
@ -38,7 +39,7 @@
setText: function (text) {
this.options.text = BI.isNotNull(text) ? text : "";
this.element.__textKeywordMarked__(this._getShowText());
}
},
});
BI.shortcut("bi.pure_text", BI.PureText);
}());

16
src/base/single/tip/tip.tooltip.js

@ -8,7 +8,7 @@
BI.Tooltip = BI.inherit(BI.Tip, {
_const: {
hgap: 8,
vgap: 4
vgap: 4,
},
_defaultConfig: function () {
@ -23,12 +23,12 @@ BI.Tooltip = BI.inherit(BI.Tip, {
},
render: function () {
var self = this, o = this.options;
var o = this.options;
this.element.addClass("tooltip-" + o.level);
var fn = function (e) {
function fn(e) {
o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent();
};
}
this.element.bind({
click: fn,
mousedown: fn,
@ -36,7 +36,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
mouseover: fn,
mouseenter: fn,
mouseleave: fn,
mousemove: fn
mousemove: fn,
});
var texts = (o.text + "").split("\n");
@ -52,9 +52,9 @@ BI.Tooltip = BI.inherit(BI.Tip, {
textAlign: o.textAlign,
whiteSpace: "normal",
text: text,
textHeight: 18
textHeight: 18,
};
})
}),
});
} else {
this.text = BI.createWidget({
@ -81,7 +81,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
setLevel: function (level) {
this.element.removeClass("tooltip-success").removeClass("tooltip-warning");
this.element.addClass("tooltip-" + level);
}
},
});
BI.shortcut("bi.tooltip", BI.Tooltip);

Loading…
Cancel
Save