Browse Source

Pull request #2036: KERNEL-8554 bubble支持滚动

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '04f7acc10b60dacff45f8cedc09c6217b7a22412':
  bugfix
  优化错误提示
  bugfix
  bubble使用popper.js实现
  bubble使用popper.js实现
  popper.js
es6
guy 3 years ago
parent
commit
4426e0a90c
  1. 1
      changelog.md
  2. 4
      src/base/combination/loader.js
  3. 212
      src/base/single/tip/tip.bubble.js
  4. 0
      src/core/10.worker.js
  5. 2
      src/core/2.base.js
  6. 2
      src/core/4.widget.js
  7. 6
      src/core/5.shortcut.js
  8. 31
      src/core/6.inject.js
  9. 1908
      src/core/9.popper.js
  10. 12
      src/core/action/action.js
  11. 4
      src/core/action/action.show.js
  12. 7
      src/core/behavior/0.behavior.js
  13. 11
      src/core/behavior/behavior.highlight.js
  14. 13
      src/core/behavior/behavior.redmark.js
  15. 5
      src/core/controller/0.controller.js
  16. 9
      src/core/controller/controller.broadcast.js
  17. 295
      src/core/controller/controller.bubbles.js
  18. 13
      src/core/controller/controller.layer.js
  19. 10
      src/core/controller/controller.masker.js
  20. 9
      src/core/controller/controller.popover.js
  21. 9
      src/core/controller/controller.resizer.js
  22. 11
      src/core/controller/controller.tooltips.js
  23. 13
      src/core/listener/listener.show.js
  24. 24
      src/core/logic/logic.layout.js
  25. 6
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  26. 6
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  27. 2
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  28. 2
      src/core/wrapper/layout/layout.border.js
  29. 6
      src/core/wrapper/layout/layout.card.js
  30. 4
      src/core/wrapper/layout/layout.division.js
  31. 2
      src/core/wrapper/layout/layout.grid.js
  32. 2
      src/core/wrapper/layout/layout.inline.js
  33. 4
      src/core/wrapper/layout/layout.table.js
  34. 4
      src/core/wrapper/layout/layout.tape.js
  35. 2
      src/core/wrapper/layout/layout.td.js
  36. 4
      src/core/wrapper/layout/layout.window.js
  37. 2
      src/core/wrapper/layout/middle/middle.center.js
  38. 2
      src/core/wrapper/layout/middle/middle.float.center.js
  39. 2
      src/core/wrapper/layout/middle/middle.horizontal.js
  40. 2
      src/core/wrapper/layout/middle/middle.vertical.js
  41. 4
      src/data/pool/pool.buffer.js
  42. 17
      src/less/base/single/tip/tip.bubble.less

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2021-07)
- bubble使用popper.js实现
- 优化了日期类型控件标红时的报错提示
- 支持虚拟dom
- 修复了树控件节点未初始化时调用树的getValue始终为空的问题

4
src/base/combination/loader.js

@ -169,7 +169,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) {
o.itemsCreator.apply(this, [{times: 1}, function () {
if (arguments.length === 0) {
throw new Error("arguments can not be null!!!");
throw new Error("参数不能为空");
}
self.populate.apply(self, arguments);
o.onLoaded();
@ -257,4 +257,4 @@ BI.Loader = BI.inherit(BI.Widget, {
}
});
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.loader", BI.Loader);
BI.shortcut("bi.loader", BI.Loader);

212
src/base/single/tip/tip.bubble.js

@ -1,212 +0,0 @@
/**
* guy
* 气泡提示
* @class BI.Bubble
* @extends BI.Tip
* @type {*|void|Object}
*/
BI.Bubble = BI.inherit(BI.Tip, {
_defaultConfig: function () {
return BI.extend(BI.Bubble.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-bubble",
direction: "top",
text: "",
level: "error",
height: 18
});
},
_init: function () {
BI.Bubble.superclass._init.apply(this, arguments);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
};
this.element.bind({click: fn, mousedown: fn, mouseup: fn, mouseover: fn, mouseenter: fn, mouseleave: fn, mousemove: fn});
BI.createWidget({
type: "bi.adaptive",
element: this,
items: [this["_" + this.options.direction]()]
});
},
_createBubbleText: function () {
var o = this.options;
return (this.text = BI.createWidget({
type: "bi.label",
cls: "bubble-text" + " bubble-" + o.level,
text: o.text,
hgap: 5,
height: 18
}));
},
_top: function () {
return BI.createWidget({
type: "bi.vertical",
items: [{
el: this._createBubbleText(),
height: 18
}, {
el: {
type: "bi.layout"
},
height: 3
}]
});
},
_bottom: function () {
return BI.createWidget({
type: "bi.vertical",
items: [{
el: {
type: "bi.layout"
},
height: 3
}, {
el: this._createBubbleText(),
height: 18
}]
});
},
_left: function () {
return BI.createWidget({
type: "bi.right",
items: [{
el: {
type: "bi.layout",
width: 3,
height: 18
}
}, {
el: this._createBubbleText()
}]
});
},
_right: function () {
return BI.createWidget({
type: "bi.left",
items: [{
el: {
type: "bi.layout",
width: 3,
height: 18
}
}, {
el: this._createBubbleText()
}]
});
},
setText: function (text) {
this.text.setText(text);
}
});
BI.shortcut("bi.bubble", BI.Bubble);
BI.BubbleView = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.BubbleView.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-bubble",
direction: "top",
text: "",
level: "error",
height: 18
});
},
_init: function () {
BI.BubbleView.superclass._init.apply(this, arguments);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
};
this.element.bind({click: fn, mousedown: fn, mouseup: fn, mouseover: fn, mouseenter: fn, mouseleave: fn, mousemove: fn});
BI.createWidget({
type: "bi.adaptive",
element: this,
items: [this["_" + this.options.direction]()]
});
},
_createBubbleText: function () {
var o = this.options;
return (this.text = BI.createWidget({
type: "bi.label",
cls: "bubble-text" + " bubble-" + o.level,
text: o.text,
hgap: 5,
height: 18
}));
},
_top: function () {
return BI.createWidget({
type: "bi.vertical",
items: [{
el: this._createBubbleText(),
height: 18
}, {
el: {
type: "bi.layout"
},
height: 3
}]
});
},
_bottom: function () {
return BI.createWidget({
type: "bi.vertical",
items: [{
el: {
type: "bi.layout"
},
height: 3
}, {
el: this._createBubbleText(),
height: 18
}]
});
},
_left: function () {
return BI.createWidget({
type: "bi.right",
items: [{
el: {
type: "bi.layout",
width: 3,
height: 18
}
}, {
el: this._createBubbleText()
}]
});
},
_right: function () {
return BI.createWidget({
type: "bi.left",
items: [{
el: {
type: "bi.layout",
width: 3,
height: 18
}
}, {
el: this._createBubbleText()
}]
});
},
setText: function (text) {
this.text.setText(text);
}
});
BI.shortcut("bi.bubble_view", BI.BubbleView);

0
src/core/worker.js → src/core/10.worker.js

2
src/core/2.base.js

@ -75,7 +75,7 @@ if (!_global.BI) {
createWidgets: function (items, options, context) {
if (!BI.isArray(items)) {
throw new Error("cannot create Widgets");
throw new Error("items必须是数组", items);
}
if (BI.isWidget(options)) {
context = options;

2
src/core/4.widget.js

@ -449,7 +449,7 @@
}
name = name || widget.getName() || BI.uniqueId("widget");
if (this._children[name]) {
throw new Error("name has already been existed");
throw new Error("组件:组件名已存在,不能进行添加");
}
widget._setParent && widget._setParent(this);
widget.on(BI.Events.DESTROY, function () {

6
src/core/5.shortcut.js

@ -2,7 +2,7 @@
var kv = {};
BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) {
if (kv[xtype] != null) {
_global.console && console.error("shortcut:[" + xtype + "] has been registed");
_global.console && console.error("组件: [" + xtype + "] 已经注册过了");
}
if (cls) {
cls["xtype"] = xtype;
@ -15,7 +15,7 @@
var cls = kv[config.type];
if (!cls) {
throw new Error("组件" + config.type + "未定义");
throw new Error("组件: [" + config.type + "] 未定义");
}
var pushed = false;
var widget = new cls();
@ -88,7 +88,7 @@
if (BI.isWidget(item.el)) {
return item.el;
}
throw new Error("无法根据item创建组件");
throw new Error("组件:无法根据item创建组件", item);
};
BI._lazyCreateWidget = BI._lazyCreateWidget || function (item, options, context) {

31
src/core/6.inject.js

@ -2,7 +2,7 @@
var moduleInjection = {};
BI.module = BI.module || function (xtype, cls) {
if (moduleInjection[xtype] != null) {
_global.console && console.error("module:[" + xtype + "] has been registed");
_global.console && console.error("module[" + xtype + "] 已经注册过了");
}
moduleInjection[xtype] = cls;
};
@ -10,7 +10,7 @@
var constantInjection = {};
BI.constant = BI.constant || function (xtype, cls) {
if (constantInjection[xtype] != null) {
_global.console && console.error("constant:[" + xtype + "] has been registed");
_global.console && console.error("constant: [" + xtype + "]已经注册过了");
}
constantInjection[xtype] = cls;
};
@ -18,7 +18,7 @@
var modelInjection = {};
BI.model = BI.model || function (xtype, cls) {
if (modelInjection[xtype] != null) {
_global.console && console.error("model:[" + xtype + "] has been registed");
_global.console && console.error("model: [" + xtype + "] 已经注册过了");
}
modelInjection[xtype] = cls;
};
@ -26,7 +26,7 @@
var storeInjection = {};
BI.store = BI.store || function (xtype, cls) {
if (storeInjection[xtype] != null) {
_global.console && console.error("store:[" + xtype + "] has been registed");
_global.console && console.error("store: [" + xtype + "] 已经注册过了");
}
storeInjection[xtype] = cls;
};
@ -34,7 +34,7 @@
var serviceInjection = {};
BI.service = BI.service || function (xtype, cls) {
if (serviceInjection[xtype] != null) {
_global.console && console.error("service:[" + xtype + "] has been registed");
_global.console && console.error("service: [" + xtype + "] 已经注册过了");
}
serviceInjection[xtype] = cls;
};
@ -42,7 +42,7 @@
var providerInjection = {};
BI.provider = BI.provider || function (xtype, cls) {
if (providerInjection[xtype] != null) {
_global.console && console.error("provider:[" + xtype + "] has been registed");
_global.console && console.error("provider: [" + xtype + "] 已经注册过了");
}
providerInjection[xtype] = cls;
};
@ -138,8 +138,7 @@
BI.Modules = BI.Modules || {
getModule: function (type) {
if (!moduleInjection[type]) {
_global.console && console.error("module:[" + type + "] does not exists");
return false;
throw new Error("module: [" + type + "] 未定义");
}
return moduleInjection[type];
},
@ -150,6 +149,9 @@
BI.Constants = BI.Constants || {
getConstant: function (type) {
if (!constantInjection[type]) {
throw new Error("constant: [" + type + "] 未定义");
}
return constantInjection[type];
}
};
@ -194,6 +196,9 @@
BI.Models = BI.Models || {
getModel: function (type, config) {
if (!modelInjection[type]) {
throw new Error("model: [" + type + "] 未定义");
}
var inst = new modelInjection[type](config);
inst._constructor && inst._constructor(config);
inst.mixins && callPoint(inst, inst.mixins);
@ -206,6 +211,9 @@
BI.Stores = BI.Stores || {
getStore: function (type, config) {
if (!storeInjection[type]) {
throw new Error("store: [" + type + "] 未定义");
}
if (stores[type]) {
return stores[type];
}
@ -222,6 +230,9 @@
BI.Services = BI.Services || {
getService: function (type, config) {
if (!serviceInjection[type]) {
throw new Error("service: [" + type + "] 未定义");
}
if (services[type]) {
return services[type];
}
@ -236,6 +247,9 @@
BI.Providers = BI.Providers || {
getProvider: function (type, config) {
if (!providerInjection[type]) {
throw new Error("provider: [" + type + "] 未定义");
}
if (!providers[type]) {
providers[type] = new providerInjection[type]();
}
@ -284,5 +298,6 @@
if (providerInjection[type]) {
return BI.Providers.getProvider(type, config);
}
throw new Error("未知类型: [" + type + "] 未定义");
};
})();

1908
src/core/9.popper.js

File diff suppressed because it is too large Load Diff

12
src/core/action/action.js

@ -6,15 +6,11 @@
* @abstract
*/
BI.Action = BI.inherit(BI.OB, {
_defaultConfig: function () {
return BI.extend(BI.Action.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
src: null,
tar: null
});
},
_init: function () {
BI.Action.superclass._init.apply(this, arguments);
};
},
actionPerformed: function (src, tar, callback) {
@ -36,4 +32,4 @@ BI.ActionFactory = {
}
return new action(options);
}
};
};

4
src/core/action/action.show.js

@ -5,10 +5,6 @@
* @extends BI.Action
*/
BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
},
actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar;
tar.setVisible(true);

7
src/core/behavior/0.behavior.js

@ -26,12 +26,7 @@ BI.Behavior = BI.inherit(BI.OB, {
});
},
_init: function () {
BI.Behavior.superclass._init.apply(this, arguments);
},
doBehavior: function () {
}
});
});

11
src/core/behavior/behavior.highlight.js

@ -5,15 +5,6 @@
* @extends BI.Behavior
*/
BI.HighlightBehavior = BI.inherit(BI.Behavior, {
_defaultConfig: function () {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.HighlightBehavior.superclass._init.apply(this, arguments);
},
doBehavior: function (items) {
var args = Array.prototype.slice.call(arguments, 1),
o = this.options;
@ -39,4 +30,4 @@ BI.HighlightBehavior = BI.inherit(BI.Behavior, {
}
});
}
});
});

13
src/core/behavior/behavior.redmark.js

@ -5,17 +5,6 @@
* @extends BI.Behavior
*/
BI.RedMarkBehavior = BI.inherit(BI.Behavior, {
_defaultConfig: function () {
return BI.extend(BI.RedMarkBehavior.superclass._defaultConfig.apply(this, arguments), {
});
},
_init: function () {
BI.RedMarkBehavior.superclass._init.apply(this, arguments);
},
doBehavior: function (items) {
var args = Array.prototype.slice.call(arguments, 1),
o = this.options;
@ -31,4 +20,4 @@ BI.RedMarkBehavior = BI.inherit(BI.Behavior, {
}
});
}
});
});

5
src/core/controller/0.controller.js

@ -7,10 +7,5 @@
* @abstract
*/
BI.Controller = BI.inherit(BI.OB, {
_defaultConfig: function () {
return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), {
});
}
});
BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";

9
src/core/controller/controller.broadcast.js

@ -5,12 +5,7 @@
* @class
*/
BI.BroadcastController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.BroadcastController.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.BroadcastController.superclass._init.apply(this, arguments);
init: function () {
this._broadcasts = {};
},
@ -47,4 +42,4 @@ BI.BroadcastController = BI.inherit(BI.Controller, {
}
return this;
}
});
});

295
src/core/controller/controller.bubbles.js

@ -6,99 +6,8 @@
* @class
*/
BI.BubblesController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.BubblesController.superclass._defaultConfig.apply(this, arguments), {});
},
_const: {
bubbleHeight: 18
},
_init: function () {
BI.BubblesController.superclass._init.apply(this, arguments);
var self = this;
this.fixedBubblesManager = {};
this.fixedStoreBubbles = {};
this.bubblesManager = {};
init: function () {
this.storeBubbles = {};
BI.Resizers.add("bubbleController" + BI.uniqueId(), function () {
BI.each(self.fixedBubblesManager, function (name) {
self.remove(name);
});
self.fixedBubblesManager = {};
self.fixedStoreBubbles = {};
});
},
_createBubble: function (direct, text, level, height, fixed) {
return BI.createWidget({
type: fixed === false ? "bi.bubble_view" : "bi.bubble",
text: text,
level: level,
height: height || 18,
direction: direct
});
},
_getOffsetLeft: function (name, context, offsetStyle) {
var left = 0;
if ("center" === offsetStyle) {
left = context.element.offset().left + (context.element.bounds().width - this.get(name).element.bounds().width) / 2;
if (left < 0) {
left = 0;
}
return left;
}
if ("right" === offsetStyle) {
left = context.element.offset().left + context.element.bounds().width - this.get(name).element.bounds().width;
if (left < 0) {
left = 0;
}
return left;
}
return context.element.offset().left;
},
_getOffsetTop: function (name, context, offsetStyle) {
var top = 0;
if ("center" === offsetStyle) {
top = context.element.offset().top + (context.element.bounds().height - this.get(name).element.bounds().height) / 2;
if (top < 0) {
top = 0;
}
return top;
} else if ("right" === offsetStyle) {
top = context.element.offset().top + context.element.bounds().height - this.get(name).element.bounds().height;
if (top < 0) {
top = 0;
}
return top;
}
return context.element.offset().top;
},
_getLeftPosition: function (name, context, offsetStyle) {
var position = BI.DOM.getLeftPosition(context, this.get(name));
position.top = this._getOffsetTop(name, context, offsetStyle);
return position;
},
_getBottomPosition: function (name, context, offsetStyle) {
var position = BI.DOM.getBottomPosition(context, this.get(name));
position.left = this._getOffsetLeft(name, context, offsetStyle);
return position;
},
_getTopPosition: function (name, context, offsetStyle) {
var position = BI.DOM.getTopPosition(context, this.get(name));
position.left = this._getOffsetLeft(name, context, offsetStyle);
return position;
},
_getRightPosition: function (name, context, offsetStyle) {
var position = BI.DOM.getRightPosition(context, this.get(name));
position.top = this._getOffsetTop(name, context, offsetStyle);
return position;
},
/**
@ -111,194 +20,66 @@ BI.BubblesController = BI.inherit(BI.Controller, {
*/
show: function (name, text, context, opt) {
opt || (opt = {});
var container = opt.container || context;
var container = opt.container || "body";
var offsetStyle = opt.offsetStyle || "left";
var level = opt.level || "error";
var adjustYOffset = opt.adjustYOffset || 0;
var adjustXOffset = opt.adjustXOffset || 0;
var fixed = opt.fixed !== false;
// 如果是非固定位置(fixed)的bubble
if (fixed === false) {
if (!this.storeBubbles[name]) {
this.storeBubbles[name] = {};
}
if (!this.storeBubbles[name]["top"]) {
this.storeBubbles[name]["top"] = this._createBubble("top", text, level, null, fixed);
}
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.storeBubbles[name]["top"]
}]
// var fixed = opt.fixed !== false;
if (!this.storeBubbles[name]) {
this.storeBubbles[name] = BI.createWidget({
type: "bi.label",
cls: "bi-bubble" + " bubble-" + level,
text: text,
hgap: 5,
height: 18
});
this.set(name, this.storeBubbles[name]["top"]);
var bubble = this.storeBubbles[name]["top"];
var bounds = bubble.element.bounds();
if (BI.DOM.isTopSpaceEnough(context, this.get(name), adjustYOffset)) {
var top = -(bounds.height + adjustYOffset);
switch (offsetStyle) {
case "center":
bubble.element.css({
left: (context.element.bounds().width - bounds.width) / 2 + adjustXOffset,
top: top
});
break;
case "right":
bubble.element.css({
right: adjustXOffset,
top: top
});
break;
default:
bubble.element.css({
left: adjustXOffset,
top: top
});
break;
}
} else {
var bottom = -(bounds.height + adjustYOffset);
switch (offsetStyle) {
case "center":
bubble.element.css({
left: (context.element.bounds().width - bounds.width) / 2 + adjustXOffset,
bottom: bottom
});
break;
case "right":
bubble.element.css({
right: adjustXOffset,
bottom: bottom
});
break;
default:
bubble.element.css({
left: adjustXOffset,
bottom: bottom
});
break;
}
}
} else {
if (!this.fixedStoreBubbles[name]) {
this.fixedStoreBubbles[name] = {};
}
if (!this.fixedStoreBubbles[name]["top"]) {
this.fixedStoreBubbles[name]["top"] = this._createBubble("top", text, level, null, fixed);
}
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.fixedStoreBubbles[name]["top"]
}]
});
this.set(name, this.fixedStoreBubbles[name]["top"]);
var position = this._getTopPosition(name, context, offsetStyle);
this.get(name).element.css({left: position.left + adjustXOffset, top: position.top - adjustYOffset});
if (!BI.DOM.isTopSpaceEnough(context, this.get(name), adjustYOffset)) {
this.get(name).invisible();
if (!this.fixedStoreBubbles[name]["bottom"]) {
this.fixedStoreBubbles[name]["bottom"] = this._createBubble("bottom", text, level);
}
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.fixedStoreBubbles[name]["bottom"]
}]
});
this.set(name, this.fixedStoreBubbles[name]["bottom"]);
var position = this._getBottomPosition(name, context, offsetStyle);
this.get(name).element.css({left: position.left + adjustXOffset, top: position.top + adjustYOffset});
if (!BI.DOM.isBottomSpaceEnough(context, this.get(name), adjustYOffset)) {
this.get(name).invisible();
if (!this.fixedStoreBubbles[name]["right"]) {
this.fixedStoreBubbles[name]["right"] = this._createBubble("right", text, level);
}
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.fixedStoreBubbles[name]["right"]
}]
});
this.set(name, this.fixedStoreBubbles[name]["right"]);
var position = this._getRightPosition(name, context, offsetStyle);
this.get(name).element.css({
left: position.left + adjustXOffset,
top: position.top - adjustYOffset
});
if (!BI.DOM.isRightSpaceEnough(context, this.get(name), adjustXOffset)) {
this.get(name).invisible();
if (!this.fixedStoreBubbles[name]["left"]) {
this.fixedStoreBubbles[name]["left"] = this._createBubble("left", text, level, 30);
}
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.fixedStoreBubbles[name]["left"]
}]
});
this.set(name, this.fixedStoreBubbles[name]["left"]);
var position = this._getLeftPosition(name, context, offsetStyle);
this.get(name).element.css({
left: position.left - adjustXOffset,
top: position.top - adjustYOffset
});
}
var bubble = this.storeBubbles[name];
BI.createWidget({
type: "bi.default",
element: container,
items: [{
el: bubble
}]
});
BI.Popper.createPopper(context.element[0], bubble.element[0], {
placement: ({
left: "top-start",
center: "top",
right: "top-end"
})[offsetStyle],
strategy: "fixed",
modifiers: [
{
name: "offset",
options: {
offset: [adjustXOffset, adjustYOffset]
}
}
}
}
this.get(name).setText(text);
this.get(name).visible();
]
});
return this;
},
hide: function (name) {
if (!this.has(name)) {
return this;
}
this.get(name).invisible();
return this;
},
add: function (name, bubble) {
if (this.has(name)) {
return this;
}
this.set(name, bubble);
return this;
},
get: function (name) {
return this.fixedBubblesManager[name] || this.bubblesManager[name];
},
set: function (name, bubble, fixed) {
fixed === false ? (this.bubblesManager[name] = bubble) : (this.fixedBubblesManager[name] = bubble);
this.remove(name);
},
has: function (name) {
return this.fixedBubblesManager[name] != null || this.bubblesManager[name] != null;
return this.storeBubbles[name] != null;
},
remove: function (name) {
if (!this.has(name)) {
return this;
}
BI.each(this.fixedStoreBubbles[name], function (dir, bubble) {
bubble.destroy();
});
delete this.fixedStoreBubbles[name];
delete this.fixedBubblesManager[name];
BI.each(this.storeBubbles[name], function (dir, bubble) {
BI.each(this.storeBubbles, function (dir, bubble) {
bubble.destroy();
});
delete this.storeBubbles[name];
delete this.bubblesManager[name];
return this;
}
});

13
src/core/controller/controller.layer.js

@ -5,14 +5,13 @@
* @class
*/
BI.LayerController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.LayerController.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
render: "body"
});
};
},
_init: function () {
BI.LayerController.superclass._init.apply(this, arguments);
init: function () {
this.layerManager = {};
this.layouts = {};
this.zindex = BI.zIndex_layer;
@ -125,7 +124,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
add: function (name, layer, layout) {
if (this.has(name)) {
throw new Error("name is already exist");
throw new Error("不能创建同名的Layer");
}
layout.setVisible(false);
this.layerManager[name] = layer;
@ -167,4 +166,4 @@ BI.LayerController = BI.inherit(BI.Controller, {
this.layouts = {};
return this;
}
});
});

10
src/core/controller/controller.masker.js

@ -5,12 +5,8 @@
* @class
*/
BI.MaskersController = BI.inherit(BI.LayerController, {
_defaultConfig: function () {
return BI.extend(BI.MaskersController.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.MaskersController.superclass._init.apply(this, arguments);
init: function () {
BI.MaskersController.superclass.init.apply(this, arguments);
this.zindex = BI.zIndex_masker;
}
});
});

9
src/core/controller/controller.popover.js

@ -5,15 +5,14 @@
* @extends BI.Controller
*/
BI.PopoverController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.PopoverController.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
modal: true, // 模态窗口
render: "body"
});
};
},
_init: function () {
BI.PopoverController.superclass._init.apply(this, arguments);
init: function () {
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};

9
src/core/controller/controller.resizer.js

@ -5,12 +5,7 @@
* @class
*/
BI.ResizeController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.ResizeController.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.ResizeController.superclass._init.apply(this, arguments);
init: function () {
var self = this;
this.resizerManger = {};
var fn = BI.debounce(function (ev) {
@ -70,4 +65,4 @@ BI.ResizeController = BI.inherit(BI.Controller, {
delete this.resizerManger[name];
return this;
}
});
});

11
src/core/controller/controller.tooltips.js

@ -7,16 +7,7 @@
* @extends BI.Controller
*/
BI.TooltipsController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.TooltipsController.superclass._defaultConfig.apply(this, arguments), {});
},
_const: {
height: 18
},
_init: function () {
BI.TooltipsController.superclass._init.apply(this, arguments);
init: function () {
this.tooltipsManager = {};
this.showingTips = {};// 存储正在显示的tooltip
},

13
src/core/listener/listener.show.js

@ -6,8 +6,8 @@
* @extends BI.OB
*/
BI.ShowListener = BI.inherit(BI.OB, {
_defaultConfig: function () {
return BI.extend(BI.ShowListener.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
eventObj: BI.createWidget(),
cardLayout: null,
cardNameCreator: function (v) {
@ -16,11 +16,10 @@ BI.ShowListener = BI.inherit(BI.OB, {
cardCreator: BI.emptyFn,
afterCardCreated: BI.emptyFn,
afterCardShow: BI.emptyFn
});
};
},
_init: function () {
BI.ShowListener.superclass._init.apply(this, arguments);
init: function () {
var self = this, o = this.options;
if (o.eventObj) {
o.eventObj.on(BI.Controller.EVENT_CHANGE, function (type, v, ob) {
@ -28,7 +27,7 @@ BI.ShowListener = BI.inherit(BI.OB, {
v = v || o.eventObj.getValue();
v = BI.isArray(v) ? (v.length > 1 ? v.toString() : v[0]) : v;
if (BI.isNull(v)) {
throw new Error("value cannot be null");
throw new Error("不能为null");
}
var cardName = o.cardNameCreator(v);
if (!o.cardLayout.isCardExisted(cardName)) {
@ -46,4 +45,4 @@ BI.ShowListener = BI.inherit(BI.OB, {
}
}
});
BI.ShowListener.EVENT_CHANGE = "EVENT_CHANGE";
BI.ShowListener.EVENT_CHANGE = "EVENT_CHANGE";

24
src/core/logic/logic.layout.js

@ -7,8 +7,8 @@
* @extends BI.Logic
*/
BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
_defaultConfig: function () {
return BI.extend(BI.VerticalLayoutLogic.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
dynamic: false,
scrollable: null,
scrolly: false,
@ -20,7 +20,7 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
rgap: 0,
tgap: 0,
bgap: 0
});
};
},
createLogic: function () {
@ -56,8 +56,8 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
* @extends BI.Logic
*/
BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
_defaultConfig: function () {
return BI.extend(BI.HorizontalLayoutLogic.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
dynamic: false,
scrollable: null,
scrolly: false,
@ -69,7 +69,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
rgap: 0,
tgap: 0,
bgap: 0
});
};
},
createLogic: function () {
@ -104,8 +104,8 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
* @extends BI.OB
*/
BI.TableLayoutLogic = BI.inherit(BI.Logic, {
_defaultConfig: function () {
return BI.extend(BI.TableLayoutLogic.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
dynamic: false,
scrollable: null,
scrolly: false,
@ -117,7 +117,7 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
hgap: 0,
vgap: 0,
items: []
});
};
},
createLogic: function () {
@ -151,8 +151,8 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
* @extends BI.Logic
*/
BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
_defaultConfig: function () {
return BI.extend(BI.HorizontalFillLayoutLogic.superclass._defaultConfig.apply(this, arguments), {
props: function () {
return {
dynamic: false,
scrollable: null,
scrolly: false,
@ -164,7 +164,7 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
rgap: 0,
tgap: 0,
bgap: 0
});
};
},
createLogic: function () {

6
src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -85,7 +85,7 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -137,11 +137,11 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
this.layout.populate(items);
}
});
BI.shortcut("bi.absolute_right_vertical_adapt", BI.AbsoluteRightVerticalAdaptLayout);
BI.shortcut("bi.absolute_right_vertical_adapt", BI.AbsoluteRightVerticalAdaptLayout);

6
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -81,7 +81,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -134,7 +134,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -186,7 +186,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {

2
src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -75,7 +75,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {

2
src/core/wrapper/layout/layout.border.js

@ -22,7 +22,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (regions) {

6
src/core/wrapper/layout/layout.card.js

@ -70,7 +70,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
getCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
throw new Error("cardName不存在", cardName);
}
return this._children[this._getChildName(cardName)];
},
@ -87,7 +87,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
throw new Error("cardName不存在", cardName);
}
var child = this._children[this._getChildName(cardName)];
@ -97,7 +97,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
addCardByName: function (cardName, cardItem) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
throw new Error("cardName 已存在", cardName);
}
var widget = BI._lazyCreateWidget(cardItem, this);
widget.element.css({

4
src/core/wrapper/layout/layout.division.js

@ -47,7 +47,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -112,7 +112,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
var totalW = 0;
for (var j = 0; j < columns; j++) {
if (!map[i][j]) {
throw new Error("item be required");
throw new Error("item(" + i + "" + j + ") 必须", map);
}
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(map[i][j]);

2
src/core/wrapper/layout/layout.grid.js

@ -41,7 +41,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {

2
src/core/wrapper/layout/layout.inline.js

@ -99,7 +99,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
},
addItem: function (item) {
throw new Error("不能添加元素");
throw new Error("不能添加子组件");
},
populate: function (items) {

4
src/core/wrapper/layout/layout.table.js

@ -88,7 +88,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
}, arr[j]));
right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap);
} else {
throw new Error("item with fill can only be one");
throw new Error("构造错误", arr);
}
}
if (i >= 0 && i < arr.length) {
@ -123,7 +123,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("item must be array");
throw new Error("必须是数组", arr);
}
return BI.TableLayout.superclass.addItem.apply(this, arguments);
},

4
src/core/wrapper/layout/layout.tape.js

@ -28,7 +28,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
},
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -168,7 +168,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {

2
src/core/wrapper/layout/layout.td.js

@ -163,7 +163,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("item must be array");
throw new Error("必须是数组", arr);
}
return BI.TdLayout.superclass.addItem.apply(this, arguments);
},

4
src/core/wrapper/layout/layout.window.js

@ -31,7 +31,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -83,7 +83,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < o.rows; i++) {
for (var j = 0; j < o.columns; j++) {
if (!o.items[i][j]) {
throw new Error("item be required");
throw new Error("构造错误", o.items);
}
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(o.items[i][j]);

2
src/core/wrapper/layout/middle/middle.center.js

@ -62,7 +62,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.float.center.js

@ -61,7 +61,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.horizontal.js

@ -60,7 +60,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.vertical.js

@ -61,7 +61,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

4
src/data/pool/pool.buffer.js

@ -10,7 +10,7 @@
BI.BufferPool = {
put: function (name, cache) {
if (BI.isNotNull(Buffer[name])) {
throw new Error("Buffer Pool has the key already!");
throw new Error("key值:[" + name + "] 已存在!", Buffer);
}
Buffer[name] = cache;
},
@ -19,4 +19,4 @@
return Buffer[name];
}
};
})();
})();

17
src/less/base/single/tip/tip.bubble.less

@ -1,30 +1,29 @@
@import "../../../index";
.bi-bubble{
& .bubble-text{
.border-radius(2px);
}
.bi-bubble {
z-index: @zIndex-tip;
.border-radius(2px);
& .bubble-error{
&.bubble-error{
background: @color-bi-background-light-failure;
color: @color-bi-text-failure;
}
.bi-theme-dark & .bubble-error {
.bi-theme-dark &.bubble-error {
background: @color-bi-background-dark-failure;
}
& .bubble-common{
&.bubble-common{
background: @color-bi-background-light-highlight;
color: @color-bi-text-highlight;
}
& .bubble-success{
&.bubble-success{
background: @color-bi-background-light-success;
color: @color-bi-text-success;
}
& .bubble-warning{
&.bubble-warning{
background: @color-bi-background-light-warning;
color: @color-bi-text-redmark;
}

Loading…
Cancel
Save