Browse Source

Fixed merge conflict

es6
Dailer 2 years ago
parent
commit
98800e9a2c
  1. 3
      .eslintrc
  2. 4
      package.json
  3. 20
      src/base/1.pane.js
  4. 6
      src/base/collection/__test__/collection.test.js
  5. 16
      src/base/collection/collection.js
  6. 32
      src/base/combination/bubble.js
  7. 34
      src/base/combination/combo.js
  8. 14
      src/base/combination/expander.js
  9. 18
      src/base/combination/group.button.js
  10. 16
      src/base/combination/group.combo.js
  11. 14
      src/base/combination/group.virtual.js
  12. 26
      src/base/combination/loader.js
  13. 14
      src/base/combination/navigation.js
  14. 22
      src/base/combination/searcher.js
  15. 22
      src/base/combination/switcher.js
  16. 14
      src/base/combination/tab.js
  17. 4
      src/base/combination/tree.button.js
  18. 6
      src/base/context.js
  19. 6
      src/base/el.js
  20. 2
      src/base/foundation/__test__/message.test.js
  21. 56
      src/base/foundation/message.js
  22. 4
      src/base/grid/__test__/grid.test.js
  23. 18
      src/base/grid/grid.js
  24. 6
      src/base/layer/__test__/layer.popover.test.js
  25. 60
      src/base/layer/layer.drawer.js
  26. 70
      src/base/layer/layer.popover.js
  27. 94
      src/base/layer/layer.popup.js
  28. 34
      src/base/layer/layer.searcher.js
  29. 10
      src/base/list/__test__/listview.test.js
  30. 10
      src/base/list/listview.js
  31. 14
      src/base/list/virtualgrouplist.js
  32. 12
      src/base/list/virtuallist.js
  33. 40
      src/base/pager/pager.js
  34. 20
      src/base/single/1.text.js
  35. 35
      src/base/single/button/button.basic.js
  36. 3
      src/base/single/button/button.node.js
  37. 12
      src/base/single/button/node/__test__/icontexticonnode.test.js
  38. 12
      src/base/single/button/node/__test__/icontextnode.test.js
  39. 12
      src/base/single/button/node/__test__/texticonnode.test.js
  40. 15
      src/base/single/button/node/__test__/textnode.test.js
  41. 15
      src/base/single/button/node/icontexticonnode.js
  42. 13
      src/base/single/button/node/icontextnode.js
  43. 13
      src/base/single/button/node/texticonnode.js
  44. 9
      src/base/single/button/node/textnode.js
  45. 23
      src/base/single/editor/editor.js
  46. 11
      src/base/single/editor/editor.multifile.js
  47. 9
      src/base/single/html/__test__/html.test.js
  48. 24
      src/base/single/html/html.js
  49. 5
      src/base/single/icon/icon.js
  50. 5
      src/base/single/iframe/__test__/iframe.test.js
  51. 7
      src/base/single/iframe/iframe.js
  52. 5
      src/base/single/img/__test__/img.test.js
  53. 7
      src/base/single/img/img.js
  54. 7
      src/base/single/input/checkbox/checkbox.image.js
  55. 11
      src/base/single/input/checkbox/checkbox.js
  56. 37
      src/base/single/input/input.js
  57. 7
      src/base/single/input/radio/radio.image.js
  58. 11
      src/base/single/input/radio/radio.js
  59. 89
      src/base/single/label/abstract.label.js
  60. 9
      src/base/single/label/html.label.js
  61. 10
      src/base/single/label/icon.label.js
  62. 4
      src/base/single/label/label.js
  63. 7
      src/base/single/link/__test__/link.test.js
  64. 8
      src/base/single/link/link.js
  65. 9
      src/base/single/tip/0.tip.js
  66. 19
      src/base/single/tip/tip.toast.js
  67. 3
      src/base/single/trigger/trigger.js
  68. 20
      src/base/tree/customtree.js

3
.eslintrc

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

4
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20220815172431",
"version": "2.0.20220816092910",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",
@ -11,7 +11,7 @@
"@babel/core": "^7.17.4",
"@babel/polyfill": "7.6.0",
"@fui/babel-preset-fineui": "^2.0.0",
"@fui/eslint-plugin": "1.0.15",
"@fui/eslint-plugin": "^1.0.15",
"@types/node": "15.6.1",
"autoprefixer": "9.6.1",
"babel-loader": "8.0.6",

20
src/base/1.pane.js

@ -15,7 +15,7 @@ BI.Pane = BI.inherit(BI.Widget, {
loadingText: "",
loadingSize: "small",
overlap: true,
onLoaded: BI.emptyFn
onLoaded: BI.emptyFn,
});
},
@ -32,8 +32,8 @@ BI.Pane = BI.inherit(BI.Widget, {
},
cls: "bi-tips",
text: o.tipText,
height: 25
}]
height: 25,
}],
});
}
},
@ -42,7 +42,7 @@ BI.Pane = BI.inherit(BI.Widget, {
var self = this, o = this.options;
var loadingAnimation = BI.createWidget(BI.Providers.getProvider("bi.provider.system").getLoading({
loadingSize: o.loadingSize,
context: this
context: this,
}));
// pane在同步方式下由items决定tipText的显示与否
// loading的异步情况下由loaded后对面板的populate的时机决定
@ -53,7 +53,7 @@ BI.Pane = BI.inherit(BI.Widget, {
type: "bi.center_adapt",
cls: "loading-container",
items: this._getLoadingTipItems(loadingAnimation),
element: BI.Layers.make(this.getName() + "-loading", this)
element: BI.Layers.make(this.getName() + "-loading", this),
});
}
BI.Layers.show(self.getName() + "-loading");
@ -63,7 +63,7 @@ BI.Pane = BI.inherit(BI.Widget, {
type: "bi.center_adapt",
element: this,
cls: "loading-container",
items: this._getLoadingTipItems(loadingAnimation)
items: this._getLoadingTipItems(loadingAnimation),
});
}
self.fireEvent(BI.Pane.EVENT_LOADING);
@ -78,12 +78,12 @@ BI.Pane = BI.inherit(BI.Widget, {
var self = this, o = this.options;
var loadingTipItems = [{
type: "bi.horizontal_adapt",
items: [loadingTip]
items: [loadingTip],
}];
BI.isNotEmptyString(o.loadingText) && loadingTipItems.push({
type: "bi.text",
text: o.loadingText,
tgap: this._getSize(10)
tgap: this._getSize(10),
});
return [{
@ -91,7 +91,7 @@ BI.Pane = BI.inherit(BI.Widget, {
ref: function (_ref) {
self._loading = _ref;
},
items: loadingTipItems
items: loadingTipItems,
}];
},
@ -125,7 +125,7 @@ BI.Pane = BI.inherit(BI.Widget, {
populate: function (items) {
this.options.items = items || [];
this.check();
}
},
});
BI.Pane.EVENT_LOADED = "EVENT_LOADED";
BI.Pane.EVENT_LOADING = "EVENT_LOADING";

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

@ -14,7 +14,7 @@ describe("CollectionTest", function () {
for (var i = 0; i < cellCount; i++) {
items[i] = {
type: "bi.label",
text: i
text: i,
};
}
var grid = BI.Test.createWidget({
@ -27,9 +27,9 @@ describe("CollectionTest", function () {
x: index % 10 * 50,
y: Math.floor(index / 10) * 50,
width: 50,
height: 50
height: 50,
};
}
},
});
// TODO 列表展示类控件不知道该测什么,先标记一下
grid.destroy();

16
src/base/collection/collection.js

@ -24,7 +24,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
items: [],
itemFormatter: function (item, index) {
return item;
}
},
});
},
@ -38,7 +38,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
self._scrollLock = false;
}, 1000 / 60);
this.container = BI._lazyCreateWidget({
type: "bi.absolute"
type: "bi.absolute",
});
this.element.scroll(function () {
if (self._scrollLock === true) {
@ -49,7 +49,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
self._calculateChildrenToRender();
self.fireEvent(BI.CollectionView.EVENT_SCROLL, {
scrollLeft: o.scrollLeft,
scrollTop: o.scrollTop
scrollTop: o.scrollTop,
});
});
// 兼容一下
@ -71,7 +71,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrollable: scrollable,
scrolly: scrolly,
scrollx: scrollx,
items: [this.container]
items: [this.container],
});
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
self.populate(newValue);
@ -204,18 +204,18 @@ BI.CollectionView = BI.inherit(BI.Widget, {
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: datum.width,
height: datum.height
height: datum.height,
}, item, {
cls: (item.cls || "") + " collection-cell" + (datum.y === 0 ? " first-row" : "") + (datum.x === 0 ? " first-col" : ""),
_left: datum.x,
_top: datum.y
_top: datum.y,
}));
renderedCells.push({
el: child,
left: datum.x,
top: datum.y,
_left: datum.x,
_top: datum.y
_top: datum.y,
// _width: datum.width,
// _height: datum.height
});
@ -398,7 +398,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.restore();
}
this._populate(items);
}
},
});
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.collection_view", BI.CollectionView);

32
src/base/combination/bubble.js

@ -10,14 +10,14 @@
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-popper",
attributes: {
tabIndex: -1
tabIndex: -1,
},
trigger: "click", // click || hover || click-hover || ""
toggle: true,
direction: "",
placement: "bottom-start", // top-start/top/top-end/bottom-start/bottom/bottom-end/left-start/left/left-end/right-start/right/right-end
logic: {
dynamic: true
dynamic: true,
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
@ -37,7 +37,7 @@
el: {},
popup: {},
comboClass: "bi-combo-popup",
hoverClass: "bi-combo-hover"
hoverClass: "bi-combo-hover",
});
},
@ -82,11 +82,11 @@
});
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{ el: this.combo }
]
],
}))));
o.isDefaultInit && (this._assertPopupView());
},
@ -172,7 +172,7 @@
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e);
@ -195,7 +195,7 @@
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e);
@ -226,7 +226,7 @@
_initCombo: function () {
this.combo = BI.createWidget(this.options.el, {
value: this.options.value
value: this.options.value,
});
},
@ -236,7 +236,7 @@
this.popupView = BI.createWidget(BI.isFunction(this.options.popup) ? this.options.popup() : this.options.popup, {
type: "bi.bubble_popup_view",
showArrow: o.showArrow,
value: o.value
value: o.value,
}, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
@ -261,7 +261,7 @@
element: this.options.container || this,
items: [
{ el: this.popupView }
]
],
});
this._rendered = true;
}
@ -339,22 +339,22 @@
options: {
offset: function () {
return [o.adjustXOffset, (o.showArrow ? 12 : 0) + (o.adjustYOffset + o.adjustLength)];
}
}
},
},
}];
if (this.options.showArrow) {
modifiers.push({
name: "arrow",
options: {
padding: 4,
element: this.popupView.arrow.element[0]
}
element: this.popupView.arrow.element[0],
},
});
}
this.popper = BI.Popper.createPopper(this.combo.element[0], this.popupView.element[0], {
placement: o.placement,
strategy: "fixed",
modifiers: modifiers
modifiers: modifiers,
});
// this.adjustHeight(e);
@ -482,7 +482,7 @@
this.popper && this.popper.destroy();
this.popper = null;
this.popupView && this.popupView._destroy();
}
},
});
BI.Bubble.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
BI.Bubble.EVENT_CHANGE = "EVENT_CHANGE";

34
src/base/combination/combo.js

@ -8,7 +8,7 @@
*/
BI.Combo = BI.inherit(BI.Bubble, {
_const: {
TRIANGLE_LENGTH: 12
TRIANGLE_LENGTH: 12,
},
_defaultConfig: function () {
var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
@ -16,13 +16,13 @@
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""),
attributes: {
tabIndex: -1
tabIndex: -1,
},
trigger: "click", // click || hover || click-hover || ""
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft
logic: {
dynamic: true
dynamic: true,
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
@ -44,7 +44,7 @@
popup: {},
comboClass: "bi-combo-popup",
hoverClass: "bi-combo-hover",
belowMouse: false
belowMouse: false,
});
},
@ -92,11 +92,11 @@
});
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{ el: this.combo }
]
{ el: this.combo, }
],
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function (e) {
@ -113,7 +113,7 @@
this.popupView = BI.createWidget(BI.isFunction(this.options.popup) ? this.options.popup() : this.options.popup, {
type: "bi.popup_view",
showArrow: o.showArrow,
value: o.value
value: o.value,
}, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
@ -160,7 +160,7 @@
this._assertPopupViewRender();
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW);
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
this.popupView.css({ left: -999999999, top: -99999999 });
this.popupView.css({ left: -999999999, top: -99999999, });
this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function (i, combo) {
if (i !== self.getName()) {
@ -197,7 +197,7 @@
offset: function () {
return {
left: e.pageX,
top: e.pageY
top: e.pageY,
};
},
bounds: function () {
@ -206,7 +206,7 @@
x: e.offsetX,
y: e.offsetY,
width: 0,
height: 24
height: 24,
};
},
outerWidth: function () {
@ -214,8 +214,8 @@
},
outerHeight: function () {
return 24;
}
}
},
},
} : this.combo;
switch (o.direction) {
case "bottom":
@ -297,16 +297,16 @@
offsetStyle: o.offsetStyle,
adjustXOffset: o.adjustXOffset,
adjustYOffset: o.adjustYOffset,
offset: this.combo.element.offset()
offset: this.combo.element.offset(),
});
if ("left" in p) {
this.popupView.element.css({
left: p.left
left: p.left,
});
}
if ("top" in p) {
this.popupView.element.css({
top: p.top
top: p.top,
});
}
this.position = p;
@ -326,7 +326,7 @@
this.popupView && this.popupView._destroy();
delete needHideWhenAnotherComboOpen[this.getName()];
delete currentOpenedCombos[this.getName()];
}
},
});
BI.Combo.closeAll = function () {
BI.each(currentOpenedCombos, function (i, combo) {

14
src/base/combination/expander.js

@ -17,7 +17,7 @@ BI.Expander = BI.inherit(BI.Widget, {
el: {},
popup: {},
expanderClass: "bi-expander-popup",
hoverClass: "bi-expander-hover"
hoverClass: "bi-expander-hover",
});
},
@ -66,7 +66,7 @@ BI.Expander = BI.inherit(BI.Widget, {
element: this,
items: [
{ el: this.expander }
]
],
});
o.isDefaultInit && this._assertPopupView();
if (this.expander.isOpened() === true) {
@ -122,7 +122,7 @@ BI.Expander = BI.inherit(BI.Widget, {
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
}));
}
break;
@ -145,9 +145,9 @@ BI.Expander = BI.inherit(BI.Widget, {
layouts: [{
type: "bi.vertical",
hgap: 0,
vgap: 0
vgap: 0,
}],
value: o.value
value: o.value,
}, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -172,7 +172,7 @@ BI.Expander = BI.inherit(BI.Widget, {
element: this,
items: [
{ el: this.popupView }
]
],
});
this._rendered = true;
}
@ -271,7 +271,7 @@ BI.Expander = BI.inherit(BI.Widget, {
destroy: function () {
BI.Expander.superclass.destroy.apply(this, arguments);
}
},
});
BI.Expander.EVENT_EXPAND = "EVENT_EXPAND";
BI.Expander.EVENT_COLLAPSE = "EVENT_COLLAPSE";

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

@ -15,8 +15,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
layouts: [{
type: "bi.center",
hgap: 0,
vgap: 0
}]
vgap: 0,
}],
});
},
@ -25,7 +25,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var behaviors = {};
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
rule: rule,
});
});
this.behaviors = behaviors;
@ -43,7 +43,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_createBtns: function (items) {
return BI.createWidgets(BI.createItems(items, {
type: "bi.text_button"
type: "bi.text_button",
}), this);
},
@ -90,9 +90,9 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return BI.extend({}, layouts[i], {
items: [
BI.extend({}, layouts[i].el, {
el: it
el: it,
})
]
],
});
});
}
@ -109,7 +109,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}
return BI.extend({}, item, {
el: btns[i]
el: btns[i],
});
});
},
@ -365,14 +365,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
destroy: function () {
BI.ButtonGroup.superclass.destroy.apply(this, arguments);
this.options.items = [];
}
},
});
BI.extend(BI.ButtonGroup, {
CHOOSE_TYPE_SINGLE: BI.Selection.Single,
CHOOSE_TYPE_MULTI: BI.Selection.Multi,
CHOOSE_TYPE_ALL: BI.Selection.All,
CHOOSE_TYPE_NONE: BI.Selection.None,
CHOOSE_TYPE_DEFAULT: BI.Selection.Default
CHOOSE_TYPE_DEFAULT: BI.Selection.Default,
});
BI.ButtonGroup.EVENT_CHANGE = "EVENT_CHANGE";

16
src/base/combination/group.combo.js

@ -23,10 +23,10 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
type: "bi.button_tree",
chooseType: 0,
layouts: [{
type: "bi.vertical"
}]
}
}
type: "bi.vertical",
}],
},
},
});
},
@ -71,9 +71,9 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
el: item,
popup: BI.extend({}, o.popup, {
el: BI.extend({
items: children
}, o.popup.el)
})
items: children,
}, o.popup.el),
}),
});
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -89,7 +89,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
setValue: function (v) {
this.combo.setValue(v);
}
},
});
BI.ComboGroup.EVENT_CHANGE = "EVENT_CHANGE";

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

@ -6,8 +6,8 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
layouts: [{
type: "bi.center",
hgap: 0,
vgap: 0
}]
vgap: 0,
}],
});
},
@ -41,10 +41,10 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
if (BI.isKey(map[el.value])) {
map[el.value] = _ref;
}
}
}, el)
},
}, el),
})
]
],
});
});
}
@ -135,10 +135,10 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
this.layouts = BI.createWidget(BI.extend({ element: this }, this._packageLayout(items)));
} else {
this.layouts.populate(items, {
context: this
context: this,
});
}
}
},
});
BI.VirtualGroup.EVENT_CHANGE = "EVENT_CHANGE";

26
src/base/combination/loader.js

@ -14,12 +14,12 @@ BI.Loader = BI.inherit(BI.Widget, {
isDefaultInit: true, // 是否默认初始化数据
logic: {
dynamic: true,
scrolly: true
scrolly: true,
},
// 下面是button_group的属性
el: {
type: "bi.button_group"
type: "bi.button_group",
},
items: [],
@ -31,7 +31,7 @@ BI.Loader = BI.inherit(BI.Widget, {
prev: false,
next: {},
hasPrev: BI.emptyFn,
hasNext: BI.emptyFn
hasNext: BI.emptyFn,
});
},
@ -61,7 +61,7 @@ BI.Loader = BI.inherit(BI.Widget, {
}
if (o.prev !== false) {
this.prev = BI.createWidget(BI.extend({
type: "bi.loading_bar"
type: "bi.loading_bar",
}, o.prev));
this.prev.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
@ -76,9 +76,9 @@ BI.Loader = BI.inherit(BI.Widget, {
items: o.items,
behaviors: {},
layouts: [{
type: "bi.vertical"
type: "bi.vertical",
}],
value: o.value
value: o.value,
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -89,7 +89,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (o.next !== false) {
this.next = BI.createWidget(BI.extend({
type: "bi.loading_bar"
type: "bi.loading_bar",
}, o.next));
this.next.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
@ -99,11 +99,11 @@ BI.Loader = BI.inherit(BI.Widget, {
}
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({
scrolly: true
scrolly: true,
}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.prev, this.button_group, this.next)
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.prev, this.button_group, this.next),
}))));
o.isDefaultInit && BI.isEmpty(o.items) && BI.nextTick(BI.bind(function () {
@ -125,7 +125,7 @@ BI.Loader = BI.inherit(BI.Widget, {
return !!o.hasPrev.apply(this, [{
times: this.times,
count: this.count
count: this.count,
}]);
},
@ -137,7 +137,7 @@ BI.Loader = BI.inherit(BI.Widget, {
return !!o.hasNext.apply(this, [{
times: this.times,
count: this.count
count: this.count,
}]);
},
@ -259,7 +259,7 @@ BI.Loader = BI.inherit(BI.Widget, {
destroy: function () {
BI.Loader.superclass.destroy.apply(this, arguments);
}
},
});
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.loader", BI.Loader);

14
src/base/combination/navigation.js

@ -7,7 +7,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), {
direction: "bottom", // top, bottom, left, right, custom
logic: {
dynamic: false
dynamic: false,
},
single: false,
showIndex: false,
@ -17,7 +17,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
},
afterCardCreated: BI.emptyFn,
afterCardShow: BI.emptyFn
afterCardShow: BI.emptyFn,
});
},
@ -27,12 +27,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
this.cardMap = {};
this.showIndex = 0;
this.layout = BI.createWidget({
type: "bi.card"
type: "bi.card",
});
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tab, this.layout)
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tab, this.layout),
}))));
@ -49,7 +49,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
return card;
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
afterCardShow: BI.bind(this.afterCardShow, this),
});
if (BI.isFunction(o.showIndex)) {
@ -162,7 +162,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
destroy: function () {
BI.Navigation.superclass.destroy.apply(this, arguments);
}
},
});
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";

22
src/base/combination/searcher.js

@ -28,17 +28,17 @@ BI.Searcher = BI.inherit(BI.Widget, {
},
el: {
type: "bi.search_editor"
type: "bi.search_editor",
},
popup: {
type: "bi.searcher_view"
type: "bi.searcher_view",
},
adapter: null,
masker: { // masker层
offset: {}
}
offset: {},
},
});
},
@ -46,7 +46,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.search_editor"
type: "bi.search_editor",
});
BI.createWidget({
@ -58,13 +58,13 @@ BI.Searcher = BI.inherit(BI.Widget, {
bgap: o.bgap,
vgap: o.vgap,
hgap: o.hgap,
items: [this.editor]
items: [this.editor],
});
o.isDefaultInit && (this._assertPopupView());
var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
this.editor.on(BI.Controller.EVENT_CHANGE, function (type) {
switch (type) {
@ -93,7 +93,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
if ((o.masker && !BI.Maskers.has(this.getName())) || (o.masker === false && !this.popupView)) {
this.popupView = BI.createWidget(o.popup, {
type: "bi.searcher_view",
chooseType: o.chooseType
chooseType: o.chooseType,
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -125,7 +125,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
if (o.masker && !BI.Maskers.has(this.getName())) {
BI.Maskers.create(this.getName(), o.adapter, BI.extend({
container: this,
render: this.popupView
render: this.popupView,
}, o.masker), this);
}
},
@ -185,7 +185,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
o.onSearch({
times: 1,
keyword: keyword,
selectedValues: o.adapter && o.adapter.getValue()
selectedValues: o.adapter && o.adapter.getValue(),
}, function (searchResult, matchResult) {
if (!self._stop && keyword === self.editor.getValue()) {
var args = [].slice.call(arguments);
@ -325,7 +325,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
setWaterMark: function (v) {
this.editor.setWaterMark(v);
}
},
});
BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.Searcher.EVENT_START = "EVENT_START";

22
src/base/combination/switcher.js

@ -18,7 +18,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
adapter: null,
masker: {},
switcherClass: "bi-switcher-popup",
hoverClass: "bi-switcher-hover"
hoverClass: "bi-switcher-hover",
});
},
@ -65,8 +65,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
scrolly: false,
element: this,
items: [
{ el: this.switcher }
]
{ el: this.switcher, }
],
});
o.isDefaultInit && (this._assertPopupView());
},
@ -119,7 +119,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
}));
}
break;
@ -129,7 +129,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
_initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el, {
value: this.options.value
value: this.options.value,
});
},
@ -138,14 +138,14 @@ BI.Switcher = BI.inherit(BI.Widget, {
if (!this._created) {
this.popupView = BI.createWidget(o.popup, {
type: "bi.button_group",
element: o.adapter && BI.Maskers.create(this.getName(), o.adapter, BI.extend({ container: this }, o.masker)),
element: o.adapter && BI.Maskers.create(this.getName(), o.adapter, BI.extend({ container: this, }, o.masker)),
cls: "switcher-popup",
layouts: [{
type: "bi.vertical",
hgap: 0,
vgap: 0
vgap: 0,
}],
value: o.value
value: o.value,
}, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -159,8 +159,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
scrolly: false,
element: this,
items: [
{ el: this.popupView }
]
{ el: this.popupView, }
],
});
}
this._created = true;
@ -279,7 +279,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
empty: function () {
this.popupView && this.popupView.empty();
}
},
});
BI.Switcher.EVENT_EXPAND = "EVENT_EXPAND";
BI.Switcher.EVENT_COLLAPSE = "EVENT_COLLAPSE";

14
src/base/combination/tab.js

@ -9,14 +9,14 @@ BI.Tab = BI.inherit(BI.Widget, {
direction: "top", // top, bottom, left, right, custom
single: false, // 是不是单页面
logic: {
dynamic: false
dynamic: false,
},
showIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();
},
keepAlives: []
keepAlives: [],
});
},
@ -30,13 +30,13 @@ BI.Tab = BI.inherit(BI.Widget, {
}
this.cardMap = {};
this.layout = BI.createWidget({
type: "bi.card"
type: "bi.card",
});
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tab, this.layout)
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tab, this.layout),
}))));
var listener = new BI.ShowListener({
@ -51,7 +51,7 @@ BI.Tab = BI.inherit(BI.Widget, {
afterCardShow: function (v) {
self._deleteOtherCards(v);
self.curr = v;
}
},
});
listener.on(BI.ShowListener.EVENT_CHANGE, function (value) {
self.fireEvent(BI.Tab.EVENT_CHANGE, value, self);
@ -170,7 +170,7 @@ BI.Tab = BI.inherit(BI.Widget, {
destroy: function () {
this.cardMap = {};
BI.Tab.superclass.destroy.apply(this, arguments);
}
},
});
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";

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

@ -7,7 +7,7 @@
BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
_defaultConfig: function () {
return BI.extend(BI.ButtonTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-button-tree"
baseCls: "bi-button-tree",
});
},
@ -192,7 +192,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
});
return node;
}
},
});
BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE";

6
src/base/context.js

@ -10,13 +10,13 @@ BI.Context = BI.inherit(BI.Widget, {
context: "",
watch: {},
el: {},
items: []
items: [],
},
render: function () {
var self = this, o = this.options;
this.context = BI.createWidget(o.items[0] || o.el, {
element: this
element: this,
});
this.context.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -40,6 +40,6 @@ BI.Context = BI.inherit(BI.Widget, {
populate: function () {
this.context.populate.apply(this, arguments);
}
},
});
BI.shortcut("bi.context", BI.Context);

6
src/base/el.js

@ -9,14 +9,14 @@ BI.EL = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.EL.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-el",
el: {}
el: {},
});
},
render: function () {
var self = this, o = this.options;
this.ele = BI.createWidget(o.el, {
element: this
element: this,
});
this.ele.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -33,6 +33,6 @@ BI.EL = BI.inherit(BI.Widget, {
populate: function () {
this.ele.populate.apply(this, arguments);
}
},
});
BI.shortcut("bi.el", BI.EL);

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

@ -23,7 +23,7 @@ describe("MessageTest", function () {
*/
it("toast_hand_close", function (done) {
BI.Msg.toast("message", {
autoClose: false
autoClose: false,
});
var body = BI.Widget._renderEngine.createElement("body");
expect(body.find(".bi-toast").length).to.equal(1);

56
src/base/foundation/message.js

@ -44,8 +44,8 @@ BI.Msg = ((function () {
_height += element.outerHeight() + 10;
});
callback();
}
}]
},
}],
});
var height = BI.SIZE_CONSANTS.TOAST_TOP;
BI.each(toastStack, function (i, element) {
@ -57,8 +57,8 @@ BI.Msg = ((function () {
items: [{
el: toast,
left: "50%",
top: height
}]
top: height,
}],
});
toastStack.push(toast.element);
toast.element.css({ "margin-left": -1 * toast.element.outerWidth() / 2 });
@ -82,7 +82,7 @@ BI.Msg = ((function () {
left: 0,
right: 0,
bottom: 0,
opacity: 0.5
opacity: 0.5,
}).appendTo("body"));
$pop = BI.Widget._renderEngine.createElement("<div class=\"bi-message-depend\">").css({
position: "absolute",
@ -90,7 +90,7 @@ BI.Msg = ((function () {
top: 0,
left: 0,
right: 0,
bottom: 0
bottom: 0,
}).appendTo("body");
function close () {
messageShows[messageShows.length - 1].destroy();
@ -112,8 +112,8 @@ BI.Msg = ((function () {
if (BI.isFunction(callback)) {
callback.apply(null, [false]);
}
}
}
},
},
});
}
controlItems.push({
@ -125,8 +125,8 @@ BI.Msg = ((function () {
if (BI.isFunction(callback)) {
callback.apply(null, [true]);
}
}
}
},
},
});
var conf = {
element: $pop,
@ -135,7 +135,7 @@ BI.Msg = ((function () {
{
type: "bi.border",
attributes: {
tabIndex: 1
tabIndex: 1,
},
mounted: function () {
this.element.keyup(function (e) {
@ -173,8 +173,8 @@ BI.Msg = ((function () {
text: title || BI.i18nText("BI-Basic_Prompt"),
textAlign: "left",
hgap: 20,
height: 40
}
height: 40,
},
},
east: {
el: {
@ -186,13 +186,13 @@ BI.Msg = ((function () {
if (BI.isFunction(callback)) {
callback.apply(null, [false]);
}
}
},
},
width: 56
}
}
width: 56,
},
},
},
height: 40
height: 40,
},
center: {
el: BI.isPlainObject(message) ? message : {
@ -200,8 +200,8 @@ BI.Msg = ((function () {
vgap: 10,
hgap: 20,
whiteSpace: "normal",
text: message
}
text: message,
},
},
south: {
el: {
@ -210,25 +210,25 @@ BI.Msg = ((function () {
el: {
type: "bi.right_vertical_adapt",
lgap: 10,
items: controlItems
items: controlItems,
},
top: 0,
left: 20,
right: 20,
bottom: 0
}]
bottom: 0,
}],
},
height: 44
}
height: 44,
},
},
width: 450,
height: 200
height: 200,
}
]
],
};
messageShows[messageShows.length] = BI.createWidget(conf);
}
},
};
})());

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

@ -15,7 +15,7 @@ describe("GridTest", function () {
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: i + "-" + j
text: i + "-" + j,
};
}
}
@ -32,7 +32,7 @@ describe("GridTest", function () {
},
columnWidthGetter: function () {
return 100;
}
},
});
// TODO 性能展示类控件,不知道要测啥,标记一下
grid.destroy();

18
src/base/grid/grid.js

@ -27,7 +27,7 @@ BI.GridView = BI.inherit(BI.Widget, {
items: [],
itemFormatter: function (item, row, col) {
return item;
}
},
});
},
@ -41,7 +41,7 @@ BI.GridView = BI.inherit(BI.Widget, {
self._scrollLock = false;
}, 1000 / 60);
this.container = BI._lazyCreateWidget({
type: "bi.absolute"
type: "bi.absolute",
});
this.element.scroll(function () {
if (self._scrollLock === true) {
@ -52,7 +52,7 @@ BI.GridView = BI.inherit(BI.Widget, {
self._calculateChildrenToRender();
self.fireEvent(BI.GridView.EVENT_SCROLL, {
scrollLeft: o.scrollLeft,
scrollTop: o.scrollTop
scrollTop: o.scrollTop,
});
});
// 兼容一下
@ -74,7 +74,7 @@ BI.GridView = BI.inherit(BI.Widget, {
scrollable: scrollable,
scrolly: scrolly,
scrollx: scrollx,
items: [this.container]
items: [this.container],
});
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
self.populate(newValue);
@ -115,7 +115,7 @@ BI.GridView = BI.inherit(BI.Widget, {
_getOverscanIndices: function (cellCount, overscanCellsCount, startIndex, stopIndex) {
return {
overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount),
};
},
@ -197,20 +197,20 @@ BI.GridView = BI.inherit(BI.Widget, {
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: columnDatum.size,
height: rowDatum.size
height: rowDatum.size,
}, item, {
cls: (item.cls || "") + " grid-cell" + (rowIndex === 0 ? " first-row" : "") + (columnIndex === 0 ? " first-col" : ""),
_rowIndex: rowIndex,
_columnIndex: columnIndex,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
_top: rowDatum.offset + verticalOffsetAdjustment,
}), this);
renderedCells.push({
el: child,
left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
_top: rowDatum.offset + verticalOffsetAdjustment,
// _width: columnDatum.size,
// _height: rowDatum.size
});
@ -398,7 +398,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this.restore();
}
this._populate(items);
}
},
});
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_view", BI.GridView);

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

@ -16,12 +16,12 @@ describe("PopoverTest", function () {
size: "normal",
header: {
type: "bi.label",
text: "这个是header"
text: "这个是header",
},
body: {
type: "bi.label",
text: "这个是body"
}
text: "这个是body",
},
}).open(id);
BI.delay(function () {
expect(BI.Widget._renderEngine.createElement("body").find(".bi-popup-view .bi-z-index-mask").length).to.equal(1);

60
src/base/layer/layer.drawer.js

@ -7,7 +7,7 @@ BI.Drawer = BI.inherit(BI.Widget, {
SIZE: {
SMALL: "small",
NORMAL: "normal",
BIG: "big"
BIG: "big",
},
props: {
baseCls: "bi-drawer bi-card",
@ -19,7 +19,7 @@ BI.Drawer = BI.inherit(BI.Widget, {
closable: true, // BI-40839 是否显示右上角的关闭按钮
bodyHgap: 20,
bodyTgap: 10,
bodyBgap: 10
bodyBgap: 10,
},
render: function () {
@ -33,20 +33,20 @@ BI.Drawer = BI.inherit(BI.Widget, {
type: "bi.absolute",
items: [{
el: BI.isPlainObject(o.header) ? BI.extend({}, o.header, {
extraCls: "bi-font-bold"
extraCls: "bi-font-bold",
}) : {
type: "bi.label",
cls: "bi-font-bold",
height: o.headerHeight,
text: o.header,
title: o.header,
textAlign: "left"
textAlign: "left",
},
left: 20,
top: 0,
right: 0,
bottom: 0
}]
bottom: 0,
}],
}, {
el: o.closable ? {
type: "bi.icon_button",
@ -54,15 +54,15 @@ BI.Drawer = BI.inherit(BI.Widget, {
height: o.headerHeight,
handler: function () {
self.close();
}
},
} : {
type: "bi.layout"
type: "bi.layout",
},
width: 56
width: 56,
}],
height: o.headerHeight
height: o.headerHeight,
},
height: o.headerHeight
height: o.headerHeight,
}, {
el: {
type: "bi.vertical",
@ -72,17 +72,17 @@ BI.Drawer = BI.inherit(BI.Widget, {
self.body = this;
},
items: [{
el: o.body
}]
el: o.body,
}],
},
hgap: o.bodyHgap,
tgap: o.bodyTgap,
bgap: o.bodyBgap
bgap: o.bodyBgap,
}];
return BI.extend({
type: "bi.vtape",
items: items
items: items,
}, this._getSuitableSize());
},
@ -103,12 +103,12 @@ BI.Drawer = BI.inherit(BI.Widget, {
}
if (o.placement === "top" || o.placement === "bottom") {
return {
height: o.height || size
height: o.height || size,
};
}
if (o.placement === "left" || o.placement === "right") {
return {
width: o.width || size
width: o.width || size,
};
}
},
@ -120,28 +120,28 @@ BI.Drawer = BI.inherit(BI.Widget, {
self.element.css({
top: 0,
left: "100%",
bottom: 0
bottom: 0,
});
break;
case "left":
self.element.css({
top: 0,
right: "100%",
bottom: 0
bottom: 0,
});
break;
case "top":
self.element.css({
left: 0,
right: 0,
bottom: "100%"
bottom: "100%",
});
break;
case "bottom":
self.element.css({
left: 0,
right: 0,
top: "100%"
top: "100%",
});
break;
default:
@ -156,22 +156,22 @@ BI.Drawer = BI.inherit(BI.Widget, {
switch (o.placement) {
case "right":
self.element.css({
left: "calc(100% - " + size.width + "px)"
left: "calc(100% - " + size.width + "px)",
});
break;
case "left":
self.element.css({
right: "calc(100% - " + size.width + "px)"
right: "calc(100% - " + size.width + "px)",
});
break;
case "top":
self.element.css({
bottom: "calc(100% - " + size.height + "px)"
bottom: "calc(100% - " + size.height + "px)",
});
break;
case "bottom":
self.element.css({
top: "calc(100% - " + size.height + "px)"
top: "calc(100% - " + size.height + "px)",
});
break;
default:
@ -187,22 +187,22 @@ BI.Drawer = BI.inherit(BI.Widget, {
switch (o.placement) {
case "right":
self.element.css({
left: "100%"
left: "100%",
});
break;
case "left":
self.element.css({
right: "100%"
right: "100%",
});
break;
case "top":
self.element.css({
bottom: "100%"
bottom: "100%",
});
break;
case "bottom":
self.element.css({
top: "100%"
top: "100%",
});
break;
default:
@ -231,7 +231,7 @@ BI.Drawer = BI.inherit(BI.Widget, {
},
destroyed: function () {
}
},
});
BI.shortcut("bi.drawer", BI.Drawer);

70
src/base/layer/layer.popover.js

@ -8,9 +8,9 @@ BI.Popover = BI.inherit(BI.Widget, {
SIZE: {
SMALL: "small",
NORMAL: "normal",
BIG: "big"
BIG: "big",
},
MAX_HEIGHT: 600
MAX_HEIGHT: 600,
},
props: function () {
@ -18,7 +18,7 @@ BI.Popover = BI.inherit(BI.Widget, {
baseCls: "bi-popover bi-card bi-border-radius",
size: "normal", // small, normal, big
logic: {
dynamic: false
dynamic: false,
},
header: null,
headerHeight: 40,
@ -27,7 +27,7 @@ BI.Popover = BI.inherit(BI.Widget, {
footerHeight: 44,
closable: true, // BI-40839 是否显示右上角的关闭按钮
bodyHgap: BI.SIZE_CONSANTS.H_GAP_SIZE,
bodyTgap: BI.SIZE_CONSANTS.V_GAP_SIZE
bodyTgap: BI.SIZE_CONSANTS.V_GAP_SIZE,
};
},
@ -45,11 +45,11 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px",
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize({
target: self.element[0]
target: self.element[0],
});
}, function () {
self.tracker.releaseMouseMoves();
@ -66,21 +66,21 @@ BI.Popover = BI.inherit(BI.Widget, {
},
items: [{
el: BI.isPlainObject(o.header) ? BI.extend({}, o.header, {
extraCls: "bi-font-bold"
extraCls: "bi-font-bold",
}) : {
type: "bi.label",
cls: "bi-font-bold",
height: o.headerHeight,
text: o.header,
title: o.header,
textAlign: "left"
textAlign: "left",
},
top: 0,
bottom: 0,
left: BI.SIZE_CONSANTS.H_GAP_SIZE,
right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE
}]
}
right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE,
}],
},
}, o.closable ? {
el: {
type: "bi.icon_button",
@ -88,13 +88,13 @@ BI.Popover = BI.inherit(BI.Widget, {
height: o.headerHeight,
handler: function () {
self.close();
}
},
},
width: 56
width: 56,
} : null],
height: o.headerHeight
height: o.headerHeight,
},
height: o.headerHeight
height: o.headerHeight,
}, o.logic.dynamic ? {
el: {
type: "bi.vertical",
@ -105,14 +105,14 @@ BI.Popover = BI.inherit(BI.Widget, {
},
css: {
"max-height": this._getSuitableBodyHeight(c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap),
"min-height": this._getSuitableBodyHeight(size.height - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap)
"min-height": this._getSuitableBodyHeight(size.height - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap),
},
items: [{
el: o.body
el: o.body,
}],
hgap: o.bodyHgap,
tgap: o.bodyTgap
}
tgap: o.bodyTgap,
},
} : {
el: {
type: "bi.absolute",
@ -121,9 +121,9 @@ BI.Popover = BI.inherit(BI.Widget, {
left: o.bodyHgap,
top: o.bodyTgap,
right: o.bodyHgap,
bottom: 0
}]
}
bottom: 0,
}],
},
}];
if (o.footer) {
items.push({
@ -134,23 +134,23 @@ BI.Popover = BI.inherit(BI.Widget, {
left: BI.SIZE_CONSANTS.H_GAP_SIZE,
top: 0,
right: BI.SIZE_CONSANTS.H_GAP_SIZE,
bottom: 0
bottom: 0,
}],
height: o.footerHeight
height: o.footerHeight,
},
height: o.footerHeight
height: o.footerHeight,
});
}
return BI.extend({
items: items,
width: this._getSuitableWidth(size.width)
width: this._getSuitableWidth(size.width),
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
scrolly: false,
} : {
type: "bi.vtape",
height: this._getSuitableHeight(size.height)
height: this._getSuitableHeight(size.height),
});
},
@ -203,7 +203,7 @@ BI.Popover = BI.inherit(BI.Widget, {
return {
width: o.width || size.width,
height: o.height || size.height,
type: size.type || "default"
type: size.type || "default",
};
},
@ -226,7 +226,7 @@ BI.Popover = BI.inherit(BI.Widget, {
},
destroyed: function () {
}
},
});
BI.shortcut("bi.popover", BI.Popover);
@ -234,7 +234,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText("BI-Basic_OK"), BI.i18nText("BI-Basic_Cancel")]
btns: [BI.i18nText("BI-Basic_OK"), BI.i18nText("BI-Basic_Cancel")],
});
},
@ -252,7 +252,7 @@ BI.BarPopover = BI.inherit(BI.Popover, {
handler: function (v) {
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
}
},
}, {
type: "bi.button",
text: this.options.btns[0],
@ -261,10 +261,10 @@ BI.BarPopover = BI.inherit(BI.Popover, {
handler: function (v) {
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
}
}]
},
}],
});
}
},
});
BI.shortcut("bi.bar_popover", BI.BarPopover);

94
src/base/layer/layer.popup.js

@ -5,7 +5,7 @@
*/
BI.PopupView = BI.inherit(BI.Widget, {
_const: {
TRIANGLE_LENGTH: 12
TRIANGLE_LENGTH: 12,
},
_defaultConfig: function (props) {
return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this, arguments), {
@ -29,7 +29,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
stopEvent: false, // 是否停止mousedown、mouseup事件
stopPropagation: false, // 是否停止mousedown、mouseup向上冒泡
logic: {
dynamic: true
dynamic: true,
},
tool: false, // 自定义工具栏
@ -42,9 +42,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
chooseType: 0,
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}
type: "bi.vertical",
}],
},
});
},
@ -61,7 +61,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
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
"max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth,
}).bind({ click: fn });
this.element.bind("mousewheel", fn);
@ -81,7 +81,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
});
BI.createWidget(BI.extend({
element: this
element: this,
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
scrolly: false,
lgap: o.lgap,
@ -91,11 +91,11 @@ BI.PopupView = BI.inherit(BI.Widget, {
vgap: o.vgap,
hgap: o.hgap,
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, BI.extend({
cls: "list-view-outer bi-card list-view-shadow" + (o.primary ? " bi-primary" : "")
cls: "list-view-outer bi-card list-view-shadow" + (o.primary ? " bi-primary" : ""),
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tool, this.tab, this.view, this.toolbar)
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tool, this.tab, this.view, this.toolbar),
})))
)
),
}))));
if (o.showArrow) {
this.arrow = BI.createWidget({
@ -103,19 +103,19 @@ BI.PopupView = BI.inherit(BI.Widget, {
cls: "bi-bubble-arrow",
items: [{
type: "bi.layout",
cls: "bubble-arrow"
}]
cls: "bubble-arrow",
}],
});
this.arrowWrapper = BI.createWidget({
type: "bi.absolute",
cls: "bi-bubble-arrow-wrapper",
items: [{
el: this.arrow
}]
el: this.arrow,
}],
});
// 因为三角符号的原因位置变大了,需要占位
this.placeholder = BI.createWidget({
type: "bi.layout"
type: "bi.layout",
});
BI.createWidget({
type: "bi.absolute",
@ -123,10 +123,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
items: [{
el: this.arrowWrapper,
left: 0,
top: 0
top: 0,
}, {
el: this.placeholder
}]
el: this.placeholder,
}],
});
}
},
@ -139,7 +139,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
"padding-top": o.innerVgap / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.innerVgap / BI.pixRatio + BI.pixUnit,
"padding-left": o.innerHgap / BI.pixRatio + BI.pixUnit,
"padding-right": o.innerHgap / BI.pixRatio + BI.pixUnit
"padding-right": o.innerHgap / BI.pixRatio + BI.pixUnit,
});
return this.button_group;
@ -165,7 +165,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
cls: "list-view-tab",
height: 25,
items: o.tabs,
value: o.value
value: o.value,
});
},
@ -182,8 +182,8 @@ BI.PopupView = BI.inherit(BI.Widget, {
items: BI.createItems(o.buttons, {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
isShadowShowingOnSelected: true,
}),
});
},
@ -217,156 +217,156 @@ BI.PopupView = BI.inherit(BI.Widget, {
direction = "bottom";
style = {
// 5表示留出一定的空间
left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 8, minLeft, maxLeft)
left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 8, minLeft, maxLeft),
};
wrapperStyle = {
top: o.tgap + o.vgap,
left: 0,
right: "",
bottom: ""
bottom: "",
};
placeholderStyle = {
left: 0,
right: 0,
height: this._const.TRIANGLE_LENGTH,
top: -this._const.TRIANGLE_LENGTH,
bottom: ""
bottom: "",
};
break;
case "bottom,left":
direction = "bottom";
style = {
right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 8, minRight, maxRight)
right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 8, minRight, maxRight),
};
wrapperStyle = {
top: o.bgap + o.vgap,
left: "",
right: 0,
bottom: ""
bottom: "",
};
placeholderStyle = {
left: 0,
right: 0,
height: this._const.TRIANGLE_LENGTH,
top: -this._const.TRIANGLE_LENGTH,
bottom: ""
bottom: "",
};
break;
case "top":
case "top,right":
direction = "top";
style = {
left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 8, minLeft, maxLeft)
left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 8, minLeft, maxLeft),
};
wrapperStyle = {
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":
direction = "top";
style = {
right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 8, minRight, maxRight)
right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 8, minRight, maxRight),
};
wrapperStyle = {
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":
case "left,bottom":
direction = "left";
style = {
top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 8, minTop, maxTop)
top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 8, minTop, maxTop),
};
wrapperStyle = {
right: o.rgap + o.hgap,
top: 0,
bottom: "",
left: ""
left: "",
};
placeholderStyle = {
top: 0,
bottom: 0,
width: this._const.TRIANGLE_LENGTH,
right: -this._const.TRIANGLE_LENGTH,
left: ""
left: "",
};
break;
case "left,top":
direction = "left";
style = {
bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 8, minBottom, maxBottom)
bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 8, minBottom, maxBottom),
};
wrapperStyle = {
right: o.rgap + o.hgap,
bottom: 0,
top: "",
left: ""
left: "",
};
placeholderStyle = {
top: 0,
bottom: 0,
width: this._const.TRIANGLE_LENGTH,
right: -this._const.TRIANGLE_LENGTH,
left: ""
left: "",
};
break;
case "right":
case "right,bottom":
direction = "right";
style = {
top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 8, minTop, maxTop)
top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 8, minTop, maxTop),
};
wrapperStyle = {
left: o.lgap + o.hgap,
top: 0,
bottom: "",
right: ""
right: "",
};
placeholderStyle = {
top: 0,
bottom: 0,
width: this._const.TRIANGLE_LENGTH,
left: -this._const.TRIANGLE_LENGTH,
right: ""
right: "",
};
break;
case "right,top":
direction = "right";
style = {
bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 8, minBottom, maxBottom)
bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 8, minBottom, maxBottom),
};
wrapperStyle = {
left: o.lgap + o.hgap,
bottom: 0,
top: "",
right: ""
right: "",
};
placeholderStyle = {
top: 0,
bottom: 0,
width: this._const.TRIANGLE_LENGTH,
left: -this._const.TRIANGLE_LENGTH,
right: ""
right: "",
};
break;
case "right,innerRight":
@ -421,7 +421,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
getValue: function () {
return this.view.getValue();
}
},
});
BI.PopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.popup_view", BI.PopupView);

34
src/base/layer/layer.searcher.js

@ -20,25 +20,25 @@ BI.SearcherView = BI.inherit(BI.Pane, {
behaviors: {
redmark: function () {
return true;
}
},
},
items: [],
layouts: [{
type: "bi.vertical"
}]
type: "bi.vertical",
}],
},
searcher: {
type: "bi.button_group",
behaviors: {
redmark: function () {
return true;
}
},
},
items: [],
layouts: [{
type: "bi.vertical"
}]
}
type: "bi.vertical",
}],
},
});
},
@ -51,12 +51,12 @@ BI.SearcherView = BI.inherit(BI.Pane, {
behaviors: {
redmark: function () {
return true;
}
},
},
layouts: [{
type: "bi.vertical"
type: "bi.vertical",
}],
value: o.value
value: o.value,
});
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -71,8 +71,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
items: [{
type: "bi.layout",
height: 1,
cls: "searcher-view-spliter bi-background"
}]
cls: "searcher-view-spliter bi-background",
}],
});
this.searcher = BI.createWidget(o.searcher, {
type: "bi.button_group",
@ -80,12 +80,12 @@ BI.SearcherView = BI.inherit(BI.Pane, {
behaviors: {
redmark: function () {
return true;
}
},
},
layouts: [{
type: "bi.vertical"
type: "bi.vertical",
}],
value: o.value
value: o.value,
});
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -97,7 +97,7 @@ BI.SearcherView = BI.inherit(BI.Pane, {
BI.createWidget({
type: "bi.vertical",
element: this,
items: [this.matcher, this.spliter, this.searcher]
items: [this.matcher, this.spliter, this.searcher],
});
},
@ -134,7 +134,7 @@ BI.SearcherView = BI.inherit(BI.Pane, {
hasMatched: function () {
return this.matcher.getAllButtons().length > 0;
}
},
});
BI.SearcherView.EVENT_CHANGE = "EVENT_CHANGE";

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

@ -13,16 +13,16 @@ describe("ListView && VirtualList", function () {
var a = BI.Test.createWidget({
type: "bi.list_view",
el: {
type: "bi.left"
type: "bi.left",
},
items: BI.map(BI.range(0, 100), function (i, item) {
return BI.extend({}, item, {
type: "bi.label",
width: 200,
height: 200,
text: (i + 1)
text: (i + 1),
});
})
}),
});
a.destroy();
});
@ -38,9 +38,9 @@ describe("ListView && VirtualList", function () {
return BI.extend({}, item, {
type: "bi.label",
height: 30,
text: (i + 1) + "." + item.text
text: (i + 1) + "." + item.text,
});
})
}),
});
a.destroy();
});

10
src/base/list/listview.js

@ -16,7 +16,7 @@ BI.ListView = BI.inherit(BI.Widget, {
items: [],
itemFormatter: function (item, index) {
return item;
}
},
};
},
@ -35,9 +35,9 @@ BI.ListView = BI.inherit(BI.Widget, {
scrolly: false,
ref: function (_ref) {
self.container = _ref;
}
},
}, o.el)],
element: this
element: this,
};
},
@ -85,7 +85,7 @@ BI.ListView = BI.inherit(BI.Widget, {
this.cache[cnt] = {
index: index,
scrollTop: lastHeight,
height: addedHeight
height: addedHeight,
};
this.renderedIndex = cnt;
cnt++;
@ -127,7 +127,7 @@ BI.ListView = BI.inherit(BI.Widget, {
destroyed: function () {
this.restore();
}
},
});
BI.shortcut("bi.list_view", BI.ListView);

14
src/base/list/virtualgrouplist.js

@ -17,7 +17,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
el: {},
itemFormatter: function (item, index) {
return item;
}
},
};
},
@ -34,7 +34,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
type: "bi.layout",
ref: function () {
self.topBlank = this;
}
},
}, {
type: "bi.virtual_group",
height: o.rowHeight * o.items.length,
@ -43,15 +43,15 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
},
layouts: [BI.extend({
type: "bi.vertical",
scrolly: false
}, o.el)]
scrolly: false,
}, o.el)],
}, {
type: "bi.layout",
ref: function () {
self.bottomBlank = this;
}
},
}],
element: this
element: this,
};
},
@ -178,7 +178,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
populate: function (items) {
this._populate(items);
}
},
});
BI.shortcut("bi.virtual_group_list", BI.VirtualGroupList);

12
src/base/list/virtuallist.js

@ -15,7 +15,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
items: [],
itemFormatter: function (item, index) {
return item;
}
},
};
},
@ -33,19 +33,19 @@ BI.VirtualList = BI.inherit(BI.Widget, {
type: "bi.layout",
ref: function () {
self.topBlank = this;
}
},
}, {
type: "bi.vertical",
scrolly: false,
ref: function () {
self.container = this;
}
},
}, {
type: "bi.layout",
ref: function () {
self.bottomBlank = this;
}
}]
},
}],
};
},
@ -203,7 +203,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
destroyed: function () {
this.cache = {};
this.renderedIndex = -1;
}
},
});
BI.shortcut("bi.virtual_list", BI.VirtualList);

40
src/base/pager/pager.js

@ -13,7 +13,7 @@ BI.Pager = BI.inherit(BI.Widget, {
layouts: [{
type: "bi.horizontal",
hgap: 10,
vgap: 0
vgap: 0,
}],
dynamicShow: true, // 是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态
@ -36,7 +36,7 @@ BI.Pager = BI.inherit(BI.Widget, {
return 1;
},
hasPrev: BI.emptyFn, // pages不可用时有效
hasNext: BI.emptyFn // pages不可用时有效
hasNext: BI.emptyFn, // pages不可用时有效
});
},
@ -78,13 +78,13 @@ BI.Pager = BI.inherit(BI.Widget, {
view.push({
text: prev,
value: "prev",
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false)
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false),
});
} else {
view.push({
el: BI.extend({
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false)
}, prev)
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false),
}, prev),
});
}
}
@ -94,13 +94,13 @@ BI.Pager = BI.inherit(BI.Widget, {
view.push({
text: first,
value: "first",
disabled: !(dict.index > 1 && groups !== 0)
disabled: !(dict.index > 1 && groups !== 0),
});
if (dict.index > 1 && groups !== 0 && groups !== pages - 1) {
view.push({
type: "bi.label",
cls: "page-ellipsis",
text: "\u2026"
text: "\u2026",
});
}
}
@ -126,12 +126,12 @@ BI.Pager = BI.inherit(BI.Widget, {
view.push({
text: s,
value: s,
selected: true
selected: true,
});
} else {
view.push({
text: s,
value: s
value: s,
});
}
}
@ -142,13 +142,13 @@ BI.Pager = BI.inherit(BI.Widget, {
view.push({
type: "bi.label",
cls: "page-ellipsis",
text: "\u2026"
text: "\u2026",
});
}
view.push({
text: last,
value: "last",
disabled: !(pages > groups && dict.end < pages && groups !== 0)
disabled: !(pages > groups && dict.end < pages && groups !== 0),
});
}
@ -158,20 +158,20 @@ BI.Pager = BI.inherit(BI.Widget, {
view.push((function () {
if (BI.isKey(next)) {
if (pages === false) {
return { text: next, value: "next", disabled: o.hasNext(curr) === false };
return { text: next, value: "next", disabled: o.hasNext(curr) === false, };
}
return (dict.flow && curr === pages)
?
{ text: next, value: "next", disabled: true }
{ text: next, value: "next", disabled: true, }
:
{ text: next, value: "next", disabled: !(curr !== pages && next || dict.flow) };
{ text: next, value: "next", disabled: !(curr !== pages && next || dict.flow), };
}
return {
el: BI.extend({
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow)
}, next)
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow),
}, next),
};
}()));
}
@ -184,13 +184,13 @@ BI.Pager = BI.inherit(BI.Widget, {
cls: "bi-list-item-select bi-border-radius",
height: 23,
hgap: v.el ? 0 : 10,
stopPropagation: true
stopPropagation: true,
}, BI.stripEL(v));
return BI.formatEL(v);
}),
behaviors: o.behaviors,
layouts: o.layouts
layouts: o.layouts,
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
// if (self._lock === true) {
@ -219,7 +219,7 @@ BI.Pager = BI.inherit(BI.Widget, {
}
o.jump.apply(self, [{
pages: pages,
curr: self.currPage
curr: self.currPage,
}]);
self._populate();
self.fireEvent(BI.Pager.EVENT_CHANGE, obj);
@ -292,7 +292,7 @@ BI.Pager = BI.inherit(BI.Widget, {
populate: function () {
this._populate();
}
},
});
BI.Pager.EVENT_CHANGE = "EVENT_CHANGE";
BI.Pager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE";

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

@ -19,29 +19,29 @@
tgap: 0,
bgap: 0,
py: "",
highLight: false
highLight: false,
},
render: function () {
var self = this, o = this.options;
if (o.hgap + o.lgap > 0) {
this.element.css({
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.hgap + o.rgap > 0) {
this.element.css({
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.vgap + o.tgap > 0) {
this.element.css({
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.vgap + o.bgap > 0) {
this.element.css({
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
});
}
if (BI.isWidthOrHeight(o.height)) {
@ -57,12 +57,12 @@
textAlign: o.textAlign,
whiteSpace: this._getTextWrap(),
textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "",
overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : "")
overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : ""),
});
if (o.handler && o.handler !== BI.emptyFn) {
this.text = BI.createWidget({
type: "bi.layout",
tagName: "span"
tagName: "span",
});
this.text.element.click(function (e) {
o.handler.call(self, self.getValue(), self, e);
@ -70,7 +70,7 @@
BI.createWidget({
type: "bi.default",
element: this,
items: [this.text]
items: [this.text],
});
} else {
this.text = this;
@ -154,7 +154,7 @@
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this._doRedMark(this.options.keyword);
}
},
});
var formatters = [];
BI.Text.addTextFormatter = function (formatter) {
@ -166,7 +166,7 @@
text = formatters[i](text);
}
}
return text;
};
BI.shortcut("bi.text", BI.Text);

35
src/base/single/button/button.basic.js

@ -8,6 +8,7 @@
BI.BasicButton = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""),
// el: {} // 可以通过el来创建button元素
@ -21,10 +22,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
disableSelected: false, // 使能选中
shadow: false,
isShadowShowingOnSelected: false, // 选中状态下是否显示阴影
isShadowShowingOnSelected: false, // 选中状态下是否显示阴影
trigger: null,
handler: BI.emptyFn,
bubble: null
bubble: null,
});
},
@ -63,11 +64,11 @@ BI.BasicButton = BI.inherit(BI.Single, {
_createShadow: function () {
var self = this, o = this.options;
var assertMask = function () {
function assertMask() {
if (!self.$mask) {
self.$mask = BI.createWidget(BI.isObject(o.shadow) ? o.shadow : {}, {
type: "bi.layout",
cls: "bi-button-mask"
cls: "bi-button-mask",
});
self.$mask.invisible();
BI.createWidget({
@ -78,11 +79,11 @@ BI.BasicButton = BI.inherit(BI.Single, {
left: 0,
right: 0,
top: 0,
bottom: 0
}]
bottom: 0,
}],
});
}
};
}
this.element.mouseup(function () {
if (!self._hover && !o.isShadowShowingOnSelected) {
@ -223,7 +224,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
// 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
function ev(e) {
@ -257,7 +258,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
},
el: {
type: "bi.layout",
height: "100%"
height: "100%",
},
popup: {
type: "bi.text_bubble_bar_popup_view",
@ -272,21 +273,21 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (v) {
onClick.apply(self, arguments);
}
}
}]
},
}],
},
listeners: [{
eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {
popup.populate(getBubble());
}
}]
},
}],
},
left: 0,
right: 0,
bottom: 0,
top: 0
}]
top: 0,
}],
});
}
if (self.combo.isViewVisible()) {
@ -294,6 +295,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
} else {
self.combo.showView();
}
return;
}
onClick.apply(self, arguments);
@ -304,6 +306,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (BI.isFunction(bubble)) {
return bubble();
}
return bubble;
}
},
@ -436,7 +439,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
empty: function () {
BI.Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName());
BI.BasicButton.superclass.empty.apply(this, arguments);
}
},
});
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";
BI.shortcut("bi.basic_button", BI.BasicButton);

3
src/base/single/button/button.node.js

@ -9,6 +9,7 @@
BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node",
open: false,
@ -48,6 +49,6 @@ BI.NodeButton = BI.inherit(BI.BasicButton, {
this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
}
}
},
});
BI.shortcut("bi.node_button", BI.NodeButton);

12
src/base/single/button/node/__test__/icontexticonnode.test.js

@ -4,13 +4,12 @@
*/
describe("IconTextIconNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node"
type: "bi.icon_text_icon_node",
});
iconTextIconNode.setText("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -34,7 +33,7 @@ describe("IconTextIconNodeTest", function () {
*/
it("setValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node"
type: "bi.icon_text_icon_node",
});
iconTextIconNode.setValue("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -48,7 +47,7 @@ describe("IconTextIconNodeTest", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA",
readonly: true
readonly: true,
});
iconTextIconNode.setValue("BBB");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -61,7 +60,7 @@ describe("IconTextIconNodeTest", function () {
it("getValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA"
value: "AAA",
});
expect(iconTextIconNode.getValue()).to.equal("AAA");
iconTextIconNode.destroy();
@ -91,7 +90,7 @@ describe("IconTextIconNodeTest", function () {
text: "AAA",
handler: function () {
this.setText("click");
}
},
});
BI.nextTick(function () {
iconTextIconNode.element.click();
@ -100,5 +99,4 @@ describe("IconTextIconNodeTest", function () {
done();
});
});
});

12
src/base/single/button/node/__test__/icontextnode.test.js

@ -4,13 +4,12 @@
*/
describe("IconTextNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node"
type: "bi.icon_text_node",
});
iconTextNode.setText("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
@ -34,7 +33,7 @@ describe("IconTextNodeTest", function () {
*/
it("setValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node"
type: "bi.icon_text_node",
});
iconTextNode.setValue("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
@ -48,7 +47,7 @@ describe("IconTextNodeTest", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA",
readonly: true
readonly: true,
});
iconTextNode.setValue("BBB");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
@ -61,7 +60,7 @@ describe("IconTextNodeTest", function () {
it("getValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA"
value: "AAA",
});
expect(iconTextNode.getValue()).to.equal("AAA");
iconTextNode.destroy();
@ -91,7 +90,7 @@ describe("IconTextNodeTest", function () {
text: "AAA",
handler: function () {
this.setText("click");
}
},
});
BI.nextTick(function () {
iconTextNode.element.click();
@ -100,5 +99,4 @@ describe("IconTextNodeTest", function () {
done();
});
});
});

12
src/base/single/button/node/__test__/texticonnode.test.js

@ -4,13 +4,12 @@
*/
describe("TextIconNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node"
type: "bi.text_icon_node",
});
textIconNode.setText("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -34,7 +33,7 @@ describe("TextIconNodeTest", function () {
*/
it("setValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node"
type: "bi.text_icon_node",
});
textIconNode.setValue("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -48,7 +47,7 @@ describe("TextIconNodeTest", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA",
readonly: true
readonly: true,
});
textIconNode.setValue("BBB");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
@ -61,7 +60,7 @@ describe("TextIconNodeTest", function () {
it("getValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA"
value: "AAA",
});
expect(textIconNode.getValue()).to.equal("AAA");
textIconNode.destroy();
@ -91,7 +90,7 @@ describe("TextIconNodeTest", function () {
text: "AAA",
handler: function () {
this.setText("click");
}
},
});
BI.nextTick(function () {
textIconNode.element.click();
@ -100,5 +99,4 @@ describe("TextIconNodeTest", function () {
done();
});
});
});

15
src/base/single/button/node/__test__/textnode.test.js

@ -4,13 +4,12 @@
*/
describe("TextNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node"
type: "bi.text_node",
});
textNode.setText("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
@ -24,7 +23,7 @@ describe("TextNodeTest", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
whiteSpace: "normal"
whiteSpace: "normal",
});
expect(textNode.getText()).to.equal("AAA");
textNode.destroy();
@ -35,7 +34,7 @@ describe("TextNodeTest", function () {
*/
it("setValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node"
type: "bi.text_node",
});
textNode.setValue("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
@ -49,7 +48,7 @@ describe("TextNodeTest", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA",
readonly: true
readonly: true,
});
textNode.setValue("BBB");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
@ -62,7 +61,7 @@ describe("TextNodeTest", function () {
it("getValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA"
value: "AAA",
});
expect(textNode.getValue()).to.equal("AAA");
textNode.destroy();
@ -92,7 +91,7 @@ describe("TextNodeTest", function () {
text: "AAA",
handler: function () {
this.setText("click");
}
},
});
BI.nextTick(function () {
textNode.element.click();
@ -101,6 +100,4 @@ describe("TextNodeTest", function () {
done();
});
});
});

15
src/base/single/button/node/icontexticonnode.js

@ -8,6 +8,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.IconTextIconNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-icon-node",
iconCls1: "close-ha-font",
@ -17,7 +18,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0
textRgap: 0,
});
},
@ -33,7 +34,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
width: o.leftIconWrapperWidth || o.height,
height: o.height,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
iconHeight: o.iconHeight,
}, {
el: {
type: "bi.label",
@ -48,16 +49,16 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height
}
height: o.height,
},
}, {
type: "bi.icon_label",
cls: o.iconCls2,
width: o.rightIconWrapperWidth || o.height,
height: o.height,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
}]
iconHeight: o.iconHeight,
}],
};
},
@ -92,7 +93,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
getText: function () {
return this.text.getText();
}
},
});
BI.IconTextIconNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_icon_node", BI.IconTextIconNode);

13
src/base/single/button/node/icontextnode.js

@ -8,6 +8,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.IconTextNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-node",
cls: "close-ha-font",
@ -16,7 +17,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0
textRgap: 0,
});
},
@ -32,7 +33,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
width: o.iconWrapperWidth || o.height,
height: o.height,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
iconHeight: o.iconHeight,
}, {
el: {
type: "bi.label",
@ -48,9 +49,9 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height
}
}]
height: o.height,
},
}],
};
},
@ -85,7 +86,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
}
},
});
BI.IconTextNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_node", BI.IconTextNode);

13
src/base/single/button/node/texticonnode.js

@ -7,6 +7,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.TextIconNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-icon-node",
cls: "close-ha-font",
@ -15,7 +16,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0
textRgap: 0,
});
},
@ -40,16 +41,16 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height
}
height: o.height,
},
}, {
type: "bi.icon_label",
cls: o.iconCls,
width: o.iconWrapperWidth || o.height,
height: o.height,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
}]
iconHeight: o.iconHeight,
}],
};
},
@ -84,7 +85,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
}
},
});
BI.TextIconNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_icon_node", BI.TextIconNode);

9
src/base/single/button/node/textnode.js

@ -9,6 +9,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.TextNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-node",
textAlign: "left",
@ -16,7 +17,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0
textRgap: 0,
});
},
@ -27,7 +28,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
element: this,
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textHeight: o.whiteSpace == "nowrap" ? o.height : o.textHeight,
textHeight: o.whiteSpace === "nowrap" ? o.height : o.textHeight,
height: o.height,
hgap: o.textHgap,
vgap: o.textVgap,
@ -36,7 +37,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
py: o.py,
});
},
@ -71,7 +72,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
getText: function () {
return this.text.getText();
}
},
});
BI.TextNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_node", BI.TextNode);

23
src/base/single/editor/editor.js

@ -38,7 +38,7 @@ BI.Editor = BI.inherit(BI.Single, {
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank
allowBlank: o.allowBlank,
}));
this.editor.element.css({
width: "100%",
@ -46,7 +46,7 @@ BI.Editor = BI.inherit(BI.Single, {
border: "none",
outline: "none",
padding: "0",
margin: "0"
margin: "0",
});
var items = [{
@ -60,19 +60,19 @@ BI.Editor = BI.inherit(BI.Single, {
left: 0,
right: 0,
top: 0,
bottom: 0
}]
bottom: 0,
}],
},
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
bottom: o.vgap + o.bgap,
}];
BI.createWidget({
type: "bi.absolute",
element: this,
items: items
items: items,
});
this.setWaterMark(this.options.watermark);
@ -159,6 +159,7 @@ BI.Editor = BI.inherit(BI.Single, {
});
this.element.click(function (e) {
e.stopPropagation();
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
@ -194,7 +195,7 @@ BI.Editor = BI.inherit(BI.Single, {
height: o.height - 2 * o.vgap - o.tgap,
hgap: 2,
whiteSpace: "nowrap",
textAlign: "left"
textAlign: "left",
});
this.watermark.element.bind({
mousedown: function (e) {
@ -204,7 +205,7 @@ BI.Editor = BI.inherit(BI.Single, {
self.editor.isEditing() && self.editor.blur();
}
e.stopEvent();
}
},
});
this.watermark.element.bind("click", function (e) {
if (self.isEnabled()) {
@ -240,7 +241,6 @@ BI.Editor = BI.inherit(BI.Single, {
},
setWaterMark: function (v) {
this.options.watermark = v;
if (BI.isNull(this.watermark)) {
@ -269,7 +269,7 @@ BI.Editor = BI.inherit(BI.Single, {
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, {
adjustYOffset: o.simple ? 1 : 2
adjustYOffset: o.simple ? 1 : 2,
});
this._checkToolTip();
}
@ -332,6 +332,7 @@ BI.Editor = BI.inherit(BI.Single, {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
}
return BI.trim(this.editor.getValue());
},
@ -345,7 +346,7 @@ BI.Editor = BI.inherit(BI.Single, {
destroyed: function () {
BI.Bubbles.remove(this.getName());
}
},
});
BI.Editor.EVENT_CHANGE = "EVENT_CHANGE";
BI.Editor.EVENT_FOCUS = "EVENT_FOCUS";

11
src/base/single/editor/editor.multifile.js

@ -9,12 +9,13 @@
BI.MultifileEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.MultifileEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false,
maxSize: -1, // 1024 * 1024
accept: "",
url: ""
url: "",
});
},
@ -57,13 +58,13 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
el: {
type: "bi.adaptive",
scrollable: false,
items: [this.file]
items: [this.file],
},
top: 0,
right: 0,
left: 0,
bottom: 0
}]
bottom: 0,
}],
});
},
@ -104,7 +105,7 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
reset: function () {
this._reset();
}
},
});
BI.MultifileEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultifileEditor.EVENT_UPLOADSTART = "EVENT_UPLOADSTART";

9
src/base/single/html/__test__/html.test.js

@ -5,14 +5,13 @@
*/
describe("HtmlTest", function () {
/**
* test_author_windy
*/
it("html_h1", function () {
var a = BI.Test.createWidget({
type: "bi.html",
text: "<h1>在bi.html标签中使用html原生标签</h1>"
text: "<h1>在bi.html标签中使用html原生标签</h1>",
});
expect(a.element.find("h1").length).to.equal(1);
a.destroy();
@ -32,11 +31,11 @@ describe("HtmlTest", function () {
highLight: true,
hgap: 10,
vgap: 10,
handler: BI.emptyFn
handler: BI.emptyFn,
});
a.setValue("DDDDD");
a.setStyle({"background-color": "red"});
a.setStyle({ "background-color": "red" });
expect(a.text.element.css("background-color")).to.equal("rgb(255, 0, 0)");
a.destroy();
});
});
});

24
src/base/single/html/html.js

@ -25,43 +25,43 @@ BI.Html = BI.inherit(BI.Single, {
var self = this, o = this.options;
if (o.hgap + o.lgap > 0) {
this.element.css({
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.hgap + o.rgap > 0) {
this.element.css({
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.vgap + o.tgap > 0) {
this.element.css({
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
});
}
if (o.vgap + o.bgap > 0) {
this.element.css({
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
});
}
if (BI.isNumber(o.height)) {
this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit});
this.element.css({ lineHeight: o.height / BI.pixRatio + BI.pixUnit });
}
if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit});
this.element.css({ lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit });
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth});
this.element.css({ maxWidth: o.maxWidth });
}
this.element.css({
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textOverflow: o.whiteSpace === 'nowrap' ? "ellipsis" : "",
overflow: o.whiteSpace === "nowrap" ? "" : "auto"
textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "",
overflow: o.whiteSpace === "nowrap" ? "" : "auto",
});
if (o.handler) {
this.text = BI.createWidget({
type: "bi.layout",
tagName: "span"
tagName: "span",
});
this.text.element.click(function () {
o.handler(self.getValue());
@ -69,7 +69,7 @@ BI.Html = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.default",
element: this,
items: [this.text]
items: [this.text],
});
} else {
this.text = this;
@ -108,7 +108,7 @@ BI.Html = BI.inherit(BI.Single, {
BI.Html.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(text);
}
},
});
BI.shortcut("bi.html", BI.Html);

5
src/base/single/icon/icon.js

@ -6,9 +6,10 @@
BI.Icon = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.Icon.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
tagName: "i",
baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block"
baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block",
});
},
@ -16,6 +17,6 @@ BI.Icon = BI.inherit(BI.Single, {
if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack");
}
}
},
});
BI.shortcut("bi.icon", BI.Icon);

5
src/base/single/iframe/__test__/iframe.test.js

@ -5,13 +5,12 @@
*/
describe("IframeTest", function () {
/**
* test_author_windy
*/
it("directionPager", function () {
var a = BI.Test.createWidget({
type: "bi.iframe"
type: "bi.iframe",
});
a.setSrc("http://www.baidu.com");
a.setName("testIFrame");
@ -20,4 +19,4 @@ describe("IframeTest", function () {
expect(a.getName(), "testIFrame");
a.destroy();
});
});
});

7
src/base/single/iframe/iframe.js

@ -7,6 +7,7 @@
BI.Iframe = BI.inherit(BI.Single, {
_defaultConfig: function (config) {
var conf = BI.Iframe.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
tagName: "iframe",
baseCls: (conf.baseCls || "") + " bi-iframe",
@ -14,7 +15,7 @@ BI.Iframe = BI.inherit(BI.Single, {
name: "",
attributes: {},
width: "100%",
height: "100%"
height: "100%",
});
},
@ -31,7 +32,7 @@ BI.Iframe = BI.inherit(BI.Single, {
this.options.attributes = BI.extend({
frameborder: 0,
src: o.src,
name: o.name
name: o.name,
}, this.options.attributes);
},
@ -51,7 +52,7 @@ BI.Iframe = BI.inherit(BI.Single, {
getName: function () {
return this.options.name;
}
},
});
BI.shortcut("bi.iframe", BI.Iframe);

5
src/base/single/img/__test__/img.test.js

@ -5,7 +5,6 @@
*/
describe("ImgTest", function () {
/**
* test_author_windy
*/
@ -13,11 +12,11 @@ describe("ImgTest", function () {
var a = BI.Test.createWidget({
type: "bi.img",
iconWidth: 36,
iconHeight: 36
iconHeight: 36,
});
a.setSrc("test.png");
expect(a.element.attr("src")).to.equal("test.png");
expect(a.getSrc()).to.equal("test.png");
a.destroy();
});
});
});

7
src/base/single/img/img.js

@ -9,13 +9,14 @@
BI.Img = BI.inherit(BI.Single, {
_defaultConfig: function (config) {
var conf = BI.Img.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
tagName: "img",
baseCls: (conf.baseCls || "") + " bi-img display-block",
src: "",
attributes: config.src ? { src: config.src } : {},
width: "100%",
height: "100%"
height: "100%",
});
},
@ -23,7 +24,7 @@ BI.Img = BI.inherit(BI.Single, {
BI.Img.superclass._initProps.apply(this, arguments);
var o = this.options;
this.options.attributes = BI.extend({
src: o.src
src: o.src,
}, this.options.attributes);
},
@ -34,7 +35,7 @@ BI.Img = BI.inherit(BI.Single, {
getSrc: function () {
return this.options.src;
}
},
});
BI.shortcut("bi.img", BI.Img);

7
src/base/single/input/checkbox/checkbox.image.js

@ -6,6 +6,7 @@
BI.ImageCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
var conf = BI.ImageCheckbox.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-image-checkbox check-box-icon",
selected: false,
@ -13,10 +14,10 @@ BI.ImageCheckbox = BI.inherit(BI.IconButton, {
width: 16,
height: 16,
iconWidth: 16,
iconHeight: 16
iconHeight: 16,
});
}
},
});
BI.ImageCheckbox.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;
BI.shortcut("bi.image_checkbox", BI.ImageCheckbox);
BI.shortcut("bi.image_checkbox", BI.ImageCheckbox);

11
src/base/single/input/checkbox/checkbox.js

@ -12,11 +12,12 @@ BI.Checkbox = BI.inherit(BI.BasicButton, {
width: 14,
height: 14,
iconWidth: 14,
iconHeight: 14
iconHeight: 14,
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.center_adapt",
items: [{
@ -26,8 +27,8 @@ BI.Checkbox = BI.inherit(BI.BasicButton, {
},
cls: "checkbox-content",
width: o.iconWidth,
height: o.iconHeight
}]
height: o.iconHeight,
}],
};
},
@ -42,7 +43,7 @@ BI.Checkbox = BI.inherit(BI.BasicButton, {
doClick: function () {
BI.Checkbox.superclass.doClick.apply(this, arguments);
if(this.isValid()) {
if (this.isValid()) {
this.fireEvent(BI.Checkbox.EVENT_CHANGE);
}
},
@ -54,7 +55,7 @@ BI.Checkbox = BI.inherit(BI.BasicButton, {
} else {
this.checkbox.element.removeClass("bi-high-light-background");
}
}
},
});
BI.Checkbox.EVENT_CHANGE = "EVENT_CHANGE";

37
src/base/single/input/input.js

@ -7,12 +7,13 @@
BI.Input = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.Input.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-input display-block overflow-dot",
tagName: "input",
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn, // 按确定键能否退出编辑
allowBlank: false
allowBlank: false,
});
},
@ -27,15 +28,15 @@ BI.Input = BI.inherit(BI.Single, {
}, BI.EVENT_RESPONSE_TIME);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
this._focusDebounce = BI.debounce(BI.bind(this._focus, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
"trailing": false,
});
this.element
.keydown(function (e) {
@ -86,7 +87,7 @@ BI.Input = BI.inherit(BI.Single, {
this.element.addClass("bi-input-focus");
this._checkValidationOnValueChange();
this._isEditing = true;
if (this.getValue() == "") {
if (this.getValue() === "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_EMPTY);
}
@ -139,7 +140,7 @@ BI.Input = BI.inherit(BI.Single, {
this._checkValidationOnValueChange();
}
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || BI.isNull(this._lastValue) || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
@ -147,7 +148,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_START);
}
}
if (keyCode == BI.KeyCode.ENTER) {
if (BI.isEqual(keyCode, BI.KeyCode.ENTER)) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
this.blur();
this.fireEvent(BI.Input.EVENT_ENTER);
@ -155,20 +156,20 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_RESTRICT);
}
}
if (keyCode == BI.KeyCode.SPACE) {
if (BI.isEqual(keyCode, BI.KeyCode.SPACE)) {
this.fireEvent(BI.Input.EVENT_SPACE);
}
if (keyCode == BI.KeyCode.BACKSPACE && this._lastValue == "") {
if (BI.isEqual(keyCode, BI.KeyCode.BACKSPACE) && this._lastValue === "") {
this.fireEvent(BI.Input.EVENT_REMOVE);
}
if (keyCode == BI.KeyCode.BACKSPACE || keyCode == BI.KeyCode.DELETE) {
if (BI.isEqual(keyCode, BI.KeyCode.BACKSPACE) || BI.isEqual(keyCode, BI.KeyCode.DELETE)) {
this.fireEvent(BI.Input.EVENT_BACKSPACE);
}
this.fireEvent(BI.Input.EVENT_KEY_DOWN, arguments);
// _valueChange中会更新_lastValue, 这边缓存用以后续STOP事件服务
var lastValue = this._lastValue;
if(BI.trim(this.getValue()) !== BI.trim(this._lastValue || "")){
if (BI.trim(this.getValue()) !== BI.trim(this._lastValue || "")) {
this._valueChange();
}
if (BI.isEndWithBlank(this.getValue())) {
@ -185,7 +186,7 @@ BI.Input = BI.inherit(BI.Single, {
// 初始状态
_defaultState: function () {
if (this.getValue() == "") {
if (this.getValue() === "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_EMPTY);
}
@ -199,7 +200,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue());
}
if (this.getValue() == "") {
if (this.getValue() === "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_EMPTY);
}
@ -209,14 +210,16 @@ BI.Input = BI.inherit(BI.Single, {
_checkValidationOnValueChange: function (callback) {
var self = this, o = this.options;
var v = this.getValue();
if (o.allowBlank === true && BI.trim(v) == "") {
if (o.allowBlank === true && BI.trim(v) === "") {
this.setValid(true);
callback && callback();
return;
}
if (BI.trim(v) == "") {
if (BI.trim(v) === "") {
this.setValid(false);
callback && callback();
return;
}
var checker = o.validationChecker.apply(this, [BI.trim(v)]);
@ -224,7 +227,7 @@ BI.Input = BI.inherit(BI.Single, {
checker.then(function (validate) {
self.setValid(validate !== false);
callback && callback();
})
});
} else {
this.setValid(checker !== false);
callback && callback();
@ -306,7 +309,7 @@ BI.Input = BI.inherit(BI.Single, {
_setEnable: function (b) {
BI.Input.superclass._setEnable.apply(this, [b]);
this.element[0].disabled = !b;
}
},
});
BI.Input.EVENT_CHANGE = "EVENT_CHANGE";

7
src/base/single/input/radio/radio.image.js

@ -6,6 +6,7 @@
BI.ImageRadio = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
var conf = BI.ImageRadio.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-radio radio-icon",
selected: false,
@ -13,16 +14,16 @@ BI.ImageRadio = BI.inherit(BI.IconButton, {
width: 16,
height: 16,
iconWidth: 16,
iconHeight: 16
iconHeight: 16,
});
},
doClick: function () {
BI.ImageRadio.superclass.doClick.apply(this, arguments);
if(this.isValid()) {
if (this.isValid()) {
this.fireEvent(BI.ImageRadio.EVENT_CHANGE);
}
}
},
});
BI.ImageRadio.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;

11
src/base/single/input/radio/radio.js

@ -12,11 +12,12 @@ BI.Radio = BI.inherit(BI.BasicButton, {
width: 14,
height: 14,
iconWidth: 14,
iconHeight: 14
iconHeight: 14,
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.center_adapt",
items: [{
@ -26,8 +27,8 @@ BI.Radio = BI.inherit(BI.BasicButton, {
self.radio = _ref;
},
width: o.iconWidth,
height: o.iconHeight
}]
height: o.iconHeight,
}],
};
},
@ -42,7 +43,7 @@ BI.Radio = BI.inherit(BI.BasicButton, {
doClick: function () {
BI.Radio.superclass.doClick.apply(this, arguments);
if(this.isValid()) {
if (this.isValid()) {
this.fireEvent(BI.Radio.EVENT_CHANGE);
}
},
@ -54,7 +55,7 @@ BI.Radio = BI.inherit(BI.BasicButton, {
} else {
this.radio.element.removeClass("bi-high-light-background");
}
}
},
});
BI.Radio.EVENT_CHANGE = "EVENT_CHANGE";

89
src/base/single/label/abstract.label.js

@ -6,6 +6,7 @@
_defaultConfig: function (props) {
var conf = BI.AbstractLabel.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
textAlign: "center",
whiteSpace: "nowrap", // normal or nowrap
@ -36,11 +37,13 @@
if (BI.isFunction(text)) {
return text();
}
return text;
},
_createJson: function () {
var o = this.options;
return {
type: "bi.text",
textAlign: o.textAlign,
@ -52,7 +55,7 @@
py: o.py,
keyword: o.keyword,
highLight: o.highLight,
handler: o.handler
handler: o.handler,
};
},
@ -80,10 +83,11 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
BI.createWidget({ // 1.2
@ -93,10 +97,11 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
if (o.whiteSpace === "normal") { // 1.3
@ -106,7 +111,7 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
});
this.text = BI.createWidget(json);
BI.createWidget({
@ -114,13 +119,14 @@
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
scrollable: o.whiteSpace === "normal",
element: this,
items: [this.text]
items: [this.text],
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) { // 1.4
this.element.css({
"line-height": o.height / BI.pixRatio + BI.pixUnit
"line-height": o.height / BI.pixRatio + BI.pixUnit,
});
json.textAlign = o.textAlign;
delete json.maxWidth;
@ -131,8 +137,9 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
return;
}
BI.extend(json, { // 1.5
@ -142,7 +149,7 @@
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
maxWidth: "100%"
maxWidth: "100%",
});
this.text = BI.createWidget(json);
BI.createWidget({
@ -150,11 +157,12 @@
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
scrollable: o.whiteSpace === "normal",
element: this,
items: [this.text]
items: [this.text],
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { // 1.6
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { // 1.6
json.maxWidth = o.textWidth;
BI.createWidget({
type: "bi.center_adapt",
@ -163,10 +171,11 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
if (o.whiteSpace === "normal") { // 1.7
@ -176,7 +185,7 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
});
this.text = BI.createWidget(json);
BI.createWidget({
@ -184,13 +193,14 @@
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
scrollable: true,
element: this,
items: [this.text]
items: [this.text],
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) { // 1.8
this.element.css({
"line-height": o.height / BI.pixRatio + BI.pixUnit
"line-height": o.height / BI.pixRatio + BI.pixUnit,
});
json.textAlign = o.textAlign;
delete json.maxWidth;
@ -201,8 +211,9 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
return;
}
this.text = BI.createWidget(BI.extend(json, {
@ -211,13 +222,13 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
BI.createWidget({
type: "bi.center_adapt",
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
element: this,
items: [this.text]
items: [this.text],
});
},
@ -238,10 +249,11 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
BI.createWidget({ // 2.2
@ -258,16 +270,17 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) { // 2.3
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit,
});
}
delete json.maxWidth;
@ -278,8 +291,9 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
return;
}
json.maxWidth = o.width - 2 * o.hgap - o.lgap - o.rgap;
@ -296,14 +310,15 @@
bgap: o.bgap,
element: this,
items: [{
el: (this.text = BI.createWidget(json))
}]
el: (this.text = BI.createWidget(json)),
}],
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.maxWidth = o.textWidth;
BI.createWidget({ // 2.5
BI.createWidget({ // 2.5
type: adaptLayout,
horizontalAlign: o.textAlign,
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
@ -317,16 +332,17 @@
element: this,
items: [
{
el: (this.text = BI.createWidget(json))
el: (this.text = BI.createWidget(json)),
}
]
],
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit,
});
}
delete json.maxWidth;
@ -337,8 +353,9 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
return;
}
this.text = BI.createWidget(BI.extend(json, {
@ -347,7 +364,7 @@
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
}));
BI.createWidget({
type: adaptLayout,
@ -355,7 +372,7 @@
columnSize: ["auto"], // important! 让文字在flex布局下shrink为1
element: this,
scrollable: o.whiteSpace === "normal",
items: [this.text]
items: [this.text],
});
},
@ -394,6 +411,6 @@
this.options.text = v;
this.text.setValue(v);
}
}
},
});
}());

9
src/base/single/label/html.label.js

@ -5,11 +5,12 @@
BI.HtmlLabel = BI.inherit(BI.AbstractLabel, {
props: {
baseCls: "bi-html-label"
baseCls: "bi-html-label",
},
_createJson: function () {
var o = this.options;
return {
type: "bi.html",
textAlign: o.textAlign,
@ -17,9 +18,9 @@ BI.HtmlLabel = BI.inherit(BI.AbstractLabel, {
lineHeight: o.textHeight,
text: o.text,
value: o.value,
handler: o.handler
handler: o.handler,
};
}
},
});
BI.shortcut("bi.html_label", BI.HtmlLabel);
BI.shortcut("bi.html_label", BI.HtmlLabel);

10
src/base/single/label/icon.label.js

@ -21,12 +21,12 @@ BI.IconLabel = BI.inherit(BI.Single, {
render: function () {
var o = this.options;
this.element.css({
textAlign: "center"
textAlign: "center",
});
this.icon = BI.createWidget({
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
height: o.iconHeight,
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", (o.lineHeight || o.height) / BI.pixRatio + BI.pixUnit);
@ -39,7 +39,7 @@ BI.IconLabel = BI.inherit(BI.Single, {
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
items: [this.icon]
items: [this.icon],
});
} else {
this.element.css("lineHeight", "1");
@ -52,9 +52,9 @@ BI.IconLabel = BI.inherit(BI.Single, {
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
items: [this.icon]
items: [this.icon],
});
}
}
},
});
BI.shortcut("bi.icon_label", BI.IconLabel);

4
src/base/single/label/label.js

@ -7,7 +7,7 @@ BI.Label = BI.inherit(BI.AbstractLabel, {
props: {
baseCls: "bi-label",
py: "",
keyword: ""
keyword: "",
},
doRedMark: function () {
@ -16,7 +16,7 @@ BI.Label = BI.inherit(BI.AbstractLabel, {
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
}
},
});
BI.shortcut("bi.label", BI.Label);

7
src/base/single/link/__test__/link.test.js

@ -5,15 +5,14 @@
*/
describe("LinkTest", function () {
/**
* test_author_windy
*/
it("link", function () {
var a = BI.Test.createWidget({
type: "bi.link"
type: "bi.link",
});
expect(a.element.is('a')).to.equal(true);
expect(a.element.is("a")).to.equal(true);
a.destroy();
});
});
});

8
src/base/single/link/link.js

@ -6,16 +6,18 @@
BI.Link = BI.inherit(BI.Label, {
_defaultConfig: function () {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-link display-block",
tagName: "a",
href: "",
target: "_blank"
target: "_blank",
});
},
_createJson: function () {
var o = this.options;
return {
type: "bi.a",
textAlign: o.textAlign,
@ -26,9 +28,9 @@ BI.Link = BI.inherit(BI.Label, {
value: o.value,
py: o.py,
href: o.href,
target: o.target
target: o.target,
};
}
},
});
BI.shortcut("bi.link", BI.Link);

9
src/base/single/tip/0.tip.js

@ -9,14 +9,15 @@
BI.Tip = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.Tip.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-tip",
zIndex: BI.zIndex_tip
zIndex: BI.zIndex_tip,
});
},
_init: function () {
BI.Tip.superclass._init.apply(this, arguments);
this.element.css({zIndex: this.options.zIndex});
}
});
this.element.css({ zIndex: this.options.zIndex });
},
});

19
src/base/single/tip/tip.toast.js

@ -31,14 +31,15 @@ BI.Toast = BI.inherit(BI.Tip, {
var self = this, o = this.options, c = this._const;
this.element.css({
minWidth: (o.closable ? c.closableMinWidth : c.minWidth) / BI.pixRatio + BI.pixUnit,
maxWidth: (o.closable ? c.closableMaxWidth : c.maxWidth) / BI.pixRatio + BI.pixUnit
maxWidth: (o.closable ? c.closableMaxWidth : c.maxWidth) / BI.pixRatio + BI.pixUnit,
});
this.element.addClass("toast-" + o.level);
var fn = function (e) {
function fn(e) {
e.stopPropagation();
e.stopEvent();
return false;
};
}
this.element.bind({
click: fn,
mousedown: fn,
@ -46,7 +47,7 @@ BI.Toast = BI.inherit(BI.Tip, {
mouseover: fn,
mouseenter: fn,
mouseleave: fn,
mousemove: fn
mousemove: fn,
});
var cls;
switch (o.level) {
@ -68,9 +69,9 @@ BI.Toast = BI.inherit(BI.Tip, {
break;
}
var hasCloseIcon = function () {
function hasCloseIcon() {
return o.closable === true || (o.closable === null && o.autoClose === false);
};
}
var items = [{
type: "bi.icon_label",
cls: cls + " toast-icon",
@ -81,7 +82,7 @@ BI.Toast = BI.inherit(BI.Tip, {
whiteSpace: "normal",
text: o.text,
textHeight: o.textHeight,
textAlign: "left"
textAlign: "left",
},
}];
@ -106,13 +107,13 @@ BI.Toast = BI.inherit(BI.Tip, {
hgap: o.hgap,
vgap: o.vgap,
innerHgap: o.innerHgap,
columnSize: columnSize
columnSize: columnSize,
};
},
beforeDestroy: function () {
this.fireEvent(BI.Toast.EVENT_DESTORY);
}
},
});
BI.Toast.EVENT_DESTORY = "EVENT_DESTORY";
BI.shortcut("bi.toast", BI.Toast);

3
src/base/single/trigger/trigger.js

@ -7,9 +7,10 @@
BI.Trigger = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-trigger cursor-pointer",
height: 24
height: 24,
});
},

20
src/base/tree/customtree.js

@ -13,8 +13,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
expander: {
el: {},
popup: {
type: "bi.custom_tree"
}
type: "bi.custom_tree",
},
},
items: [],
@ -24,9 +24,9 @@ BI.CustomTree = BI.inherit(BI.Widget, {
type: "bi.button_tree",
chooseType: 0,
layouts: [{
type: "bi.vertical"
}]
}
type: "bi.vertical",
}],
},
});
},
@ -45,12 +45,12 @@ BI.CustomTree = BI.inherit(BI.Widget, {
var item = BI.extend({
type: "bi.expander",
el: {
value: node.value
value: node.value,
},
popup: { type: "bi.custom_tree" }
popup: { type: "bi.custom_tree" },
}, BI.deepClone(o.expander), {
id: node.id,
pId: node.pId
pId: node.pId,
});
var el = BI.stripEL(node);
if (!BI.isWidget(el)) {
@ -94,7 +94,7 @@ BI.CustomTree = BI.inherit(BI.Widget, {
callback.apply(null, args);
}]);
},
value: o.value
value: o.value,
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -143,7 +143,7 @@ BI.CustomTree = BI.inherit(BI.Widget, {
empty: function () {
this.tree.empty();
}
},
});
BI.CustomTree.EVENT_CHANGE = "EVENT_CHANGE";

Loading…
Cancel
Save