Browse Source

Merge pull request #141396 in DEC/fineui from master to feature/x

* commit '4d716d23db091d7a5a8f314eaf43b042e5786f4d':
  KERNEL-12408:base中eslint的修改
  KERNEL-12408
master
superman 2 years ago
parent
commit
b246f3d1c4
  1. 3
      .eslintrc
  2. 1
      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": { "rules": {
"no-param-reassign": "off", "no-param-reassign": "off",
"quotes": [2, "double"], "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"], "files": ["webpack/*.js", "./*.js", "lib/**/*.js", "lib/*.js", "./bin/*.js", "./bin/**/*.js"],

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

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

7
src/base/list/virtualgrouplist.js

@ -88,10 +88,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
var minContentHeight = o.scrollTop + height + o.overscanHeight; var minContentHeight = o.scrollTop + height + o.overscanHeight;
var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1; var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1;
var lastHeight; var lastHeight;
var getElementHeight = function () { function getElementHeight () {
return self.container.element.height() + self.topBlank.element.height() + self.bottomBlank.element.height(); 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); var items = o.items.slice(index, index + o.blockSize);
this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) { this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) {
return o.itemFormatter(item, index + 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 minContentHeight = o.scrollTop + height + o.overscanHeight;
var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1; var index = (this.renderedIndex + 1) * o.blockSize, cnt = this.renderedIndex + 1;
var lastHeight; var lastHeight;
var getElementHeight = function () { function getElementHeight() {
return self.container.element.height() + self.topBlank.element.height() + self.bottomBlank.element.height(); 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); var items = o.items.slice(index, index + o.blockSize);
this.container.addItems(items.map(function (item, i) { this.container.addItems(items.map(function (item, i) {
return o.itemFormatter(item, index + 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 () { render: function () {
var self = this;
this.currPage = BI.result(this.options, "curr"); this.currPage = BI.result(this.options, "curr");
// 翻页太灵敏 // 翻页太灵敏
// this._lock = false; // this._lock = false;

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

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

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

@ -45,13 +45,13 @@
}); });
} }
if (BI.isWidthOrHeight(o.height)) { 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)) { 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)) { 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({ this.element.css({
textAlign: o.textAlign, textAlign: o.textAlign,
@ -108,6 +108,7 @@
_getShowText: function () { _getShowText: function () {
var o = this.options; var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text; var text = BI.isFunction(o.text) ? o.text() : o.text;
return BI.isKey(text) ? BI.Text.formatText(text + "") : text; return BI.isKey(text) ? BI.Text.formatText(text + "") : text;
}, },
@ -165,6 +166,7 @@
text = formatters[i](text); text = formatters[i](text);
} }
} }
return text; return text;
}; };
BI.shortcut("bi.text", BI.Text); BI.shortcut("bi.text", BI.Text);

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

@ -5,7 +5,7 @@
BI.PureText = BI.inherit(BI.Widget, { BI.PureText = BI.inherit(BI.Widget, {
props: { props: {
tagName: null tagName: null,
}, },
render: function () { render: function () {
@ -27,6 +27,7 @@
if (!BI.isKey(text)) { if (!BI.isKey(text)) {
return ""; return "";
} }
return BI.Text.formatText(text + ""); return BI.Text.formatText(text + "");
}, },
@ -38,7 +39,7 @@
setText: function (text) { setText: function (text) {
this.options.text = BI.isNotNull(text) ? text : ""; this.options.text = BI.isNotNull(text) ? text : "";
this.element.__textKeywordMarked__(this._getShowText()); this.element.__textKeywordMarked__(this._getShowText());
} },
}); });
BI.shortcut("bi.pure_text", BI.PureText); 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, { BI.Tooltip = BI.inherit(BI.Tip, {
_const: { _const: {
hgap: 8, hgap: 8,
vgap: 4 vgap: 4,
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -23,12 +23,12 @@ BI.Tooltip = BI.inherit(BI.Tip, {
}, },
render: function () { render: function () {
var self = this, o = this.options; var o = this.options;
this.element.addClass("tooltip-" + o.level); this.element.addClass("tooltip-" + o.level);
var fn = function (e) { function fn(e) {
o.stopPropagation && e.stopPropagation(); o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent(); o.stopEvent && e.stopEvent();
}; }
this.element.bind({ this.element.bind({
click: fn, click: fn,
mousedown: fn, mousedown: fn,
@ -36,7 +36,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
mouseover: fn, mouseover: fn,
mouseenter: fn, mouseenter: fn,
mouseleave: fn, mouseleave: fn,
mousemove: fn mousemove: fn,
}); });
var texts = (o.text + "").split("\n"); var texts = (o.text + "").split("\n");
@ -52,9 +52,9 @@ BI.Tooltip = BI.inherit(BI.Tip, {
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",
text: text, text: text,
textHeight: 18 textHeight: 18,
}; };
}) }),
}); });
} else { } else {
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -81,7 +81,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
setLevel: function (level) { setLevel: function (level) {
this.element.removeClass("tooltip-success").removeClass("tooltip-warning"); this.element.removeClass("tooltip-success").removeClass("tooltip-warning");
this.element.addClass("tooltip-" + level); this.element.addClass("tooltip-" + level);
} },
}); });
BI.shortcut("bi.tooltip", BI.Tooltip); BI.shortcut("bi.tooltip", BI.Tooltip);

Loading…
Cancel
Save