Browse Source

Merge branch 'master' of ssh://cloud.finedevelop.com:7999/~windy/fui

es6
windy 7 years ago
parent
commit
a620118ee6
  1. 4
      demo/js/config/core.js
  2. 68
      demo/js/core/popup/demo.layer.js
  3. 38
      demo/js/core/popup/demo.popover.js
  4. 2
      dist/README.md
  5. 36
      dist/base.js
  6. 340
      dist/bundle.js
  7. 38
      dist/bundle.min.js
  8. 304
      dist/core.js
  9. 109
      dist/demo.js
  10. 340
      dist/fineui.js
  11. 48
      dist/fineui.min.js
  12. 2
      src/base/base.js
  13. 34
      src/base/layer/layer.popover.js
  14. 20
      src/core/controller/controller.layer.js
  15. 36
      src/core/controller/controller.popover.js
  16. 2
      src/core/var.js
  17. 0
      src/css/base/view/popover.css
  18. 2
      src/less/base/view/popover.less
  19. 2
      src/less/var.less
  20. 2
      utils/utils.js

4
demo/js/config/core.js

@ -160,6 +160,10 @@ Demo.CORE_CONFIG = [{
pId: 102,
id: 10202,
text: "弹出层"
}, {
pId: 10202,
text: "layer",
value: "demo.layer"
}, {
pId: 10202,
text: "bi.popover",

68
demo/js/core/popup/demo.layer.js

@ -0,0 +1,68 @@
/**
* Created by Windy on 2017/12/13.
*/
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var self = this, id1 = BI.UUID(), id2 = BI.UUID();
return {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.button",
text: "create形式创建layer, 遮住当前面板, 返回创建的面板对象",
height: 30,
handler: function () {
BI.Layers.create(id1, self, {
//偏移量
offset: {
left: 10,
right: 10,
top: 10,
bottom: 10
},
type: "bi.center_adapt",
cls: "bi-card",
items: [{
type: "bi.button",
text: "点击关闭",
handler: function () {
BI.Layers.hide(id1);
}
}]
});
BI.Layers.show(id1);
}
}, {
type: "bi.button",
text: "make形式创建layer,可以指定放到哪个面板内,这里指定当前面板(默认放在body下撑满), 返回创建的面板对象",
height: 30,
handler: function () {
BI.Layers.make(id2, self, {
//偏移量
offset: {
left: 10,
right: 10,
top: 10,
bottom: 10
},
type: "bi.center_adapt",
cls: "bi-card",
items: [{
type: "bi.button",
text: "点击关闭",
handler: function () {
BI.Layers.remove(id2);
}
}]
});
BI.Layers.show(id2);
}
}]
};
}
});
BI.shortcut("demo.layer", Demo.Func);

38
demo/js/core/popup/demo.popover.js

@ -8,19 +8,31 @@ Demo.Func = BI.inherit(BI.Widget, {
render: function () {
var id = BI.UUID();
return {
type: "bi.text_button",
text: "点击弹出Popover",
width: 200,
height: 80,
handler: function() {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
body: {
type: "bi.label",
text: "这个是body"
}
}).open(id);
}
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.text_button",
text: "点击弹出Popover",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.label",
text: "这个是body"
}
// footer: {
// type: "bi.label",
// text: "这个是footer"
// }
}).open(id);
}
}]
};
}
});

2
dist/README.md vendored

@ -1,6 +1,6 @@
#### fineui.js
整个fineui打包文件,不包括配置文件和路由
整个fineui打包文件,不包括配置文件
#### fineui.css

36
dist/base.js vendored

@ -2488,7 +2488,7 @@ BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.FloatBoxController();
BI.Popovers = new BI.PopoverController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();/**
* canvas绘图
@ -15302,14 +15302,14 @@ BI.GridView = BI.inherit(BI.Widget, {
});
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_view", BI.GridView);/**
* floatBox弹出层
* @class BI.FloatBox
* Popover弹出层
* @class BI.Popover
* @extends BI.Widget
*/
BI.FloatBox = BI.inherit(BI.Widget, {
BI.Popover = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-float-box bi-card",
return BI.extend(BI.Popover.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-popover bi-card",
width: 600,
height: 500,
header: null,
@ -15418,12 +15418,12 @@ BI.FloatBox = BI.inherit(BI.Widget, {
open: function () {
this.show();
this.fireEvent(BI.FloatBox.EVENT_OPEN);
this.fireEvent(BI.Popover.EVENT_OPEN, arguments);
},
close: function () {
this.hide();
this.fireEvent(BI.FloatBox.EVENT_CLOSE);
this.fireEvent(BI.Popover.EVENT_CLOSE, arguments);
},
setZindex: function (zindex) {
@ -15434,11 +15434,11 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.float_box", BI.FloatBox);
BI.shortcut("bi.popover", BI.Popover);
BI.BarFloatBox = BI.inherit(BI.FloatBox, {
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))]
});
},
@ -15454,7 +15454,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
value: 1,
level: "ignore",
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CANCEL, v);
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
}
}, {
@ -15463,7 +15463,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
warningTitle: o.warningTitle,
value: 0,
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v);
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
}
}]
@ -15471,12 +15471,12 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
}
});
BI.shortcut("bi.bar_float_box", BI.BarFloatBox);
BI.shortcut("bi.bar_popover", BI.BarPopover);
BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE";
BI.FloatBox.EVENT_OPEN = "EVENT_OPEN";
BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL";
BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Popover.EVENT_CLOSE = "EVENT_CLOSE";
BI.Popover.EVENT_OPEN = "EVENT_OPEN";
BI.Popover.EVENT_CANCEL = "EVENT_CANCEL";
BI.Popover.EVENT_CONFIRM = "EVENT_CONFIRM";
/**
* 下拉框弹出层, zIndex在1000w
* @class BI.PopupView

340
dist/bundle.js vendored

@ -26544,147 +26544,6 @@ BI.BubblesController = BI.inherit(BI.Controller, {
delete this.bubblesManager[name];
return this;
}
});/**
* guy
* FloatBox弹出层控制器, z-index在100w层级
* @class BI.FloatBoxController
* @extends BI.Controller
*/
BI.FloatBoxController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.FloatBoxController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_floatbox;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var floatbox = BI.createWidget({
type: "bi.float_box"
}, options, context);
this.add(name, floatbox, options, context);
return this;
},
add: function (name, floatbox, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [floatbox]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = floatbox;
(function (key) {
floatbox.on(BI.FloatBox.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var floatbox = this.get(name);
floatbox.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = floatbox.element.width(), h = floatbox.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
floatbox.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* 弹出层面板控制器, z-index在10w层级
*
@ -26714,14 +26573,15 @@ BI.LayerController = BI.inherit(BI.Controller, {
});
},
make: function (name, container, op) {
make: function (name, container, op, context) {
if (BI.isWidget(container)) {
op = op || {};
op.container = container;
} else {
context = op;
op = container;
}
return this.create(name, null, op);
return this.create(name, null, op, context);
},
create: function (name, from, op, context) {
@ -26740,10 +26600,9 @@ BI.LayerController = BI.inherit(BI.Controller, {
if (this.has(name)) {
return this.get(name);
}
var widget = BI.createWidget((op.render || {}), {
type: "bi.layout",
cls: op.cls
}, context);
var widget = BI.createWidget((op.render || {}), BI.extend({
type: "bi.layout"
}, op), context);
var layout = BI.createWidget({
type: "bi.absolute",
items: [{
@ -26770,16 +26629,16 @@ BI.LayerController = BI.inherit(BI.Controller, {
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
});
}
@ -26857,6 +26716,147 @@ BI.MaskersController = BI.inherit(BI.LayerController, {
BI.MaskersController.superclass._init.apply(this, arguments);
this.zindex = BI.zIndex_masker;
}
});/**
* guy
* popover弹出层控制器, z-index在100w层级
* @class BI.popoverController
* @extends BI.Controller
*/
BI.PopoverController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.PopoverController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.PopoverController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_popover;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var popover = BI.createWidget(options || {}, {
type: "bi.popover"
}, context);
this.add(name, popover, options, context);
return this;
},
add: function (name, popover, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [popover]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = popover;
(function (key) {
popover.on(BI.Popover.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var popover = this.get(name);
popover.show && popover.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
popover.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* window.resize 控制器
*
@ -30063,7 +30063,7 @@ _.extend(BI, {
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_floatbox: 1e6,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,
@ -36315,7 +36315,7 @@ BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.FloatBoxController();
BI.Popovers = new BI.PopoverController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();/**
* canvas绘图
@ -49129,14 +49129,14 @@ BI.GridView = BI.inherit(BI.Widget, {
});
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_view", BI.GridView);/**
* floatBox弹出层
* @class BI.FloatBox
* Popover弹出层
* @class BI.Popover
* @extends BI.Widget
*/
BI.FloatBox = BI.inherit(BI.Widget, {
BI.Popover = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-float-box bi-card",
return BI.extend(BI.Popover.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-popover bi-card",
width: 600,
height: 500,
header: null,
@ -49245,12 +49245,12 @@ BI.FloatBox = BI.inherit(BI.Widget, {
open: function () {
this.show();
this.fireEvent(BI.FloatBox.EVENT_OPEN);
this.fireEvent(BI.Popover.EVENT_OPEN, arguments);
},
close: function () {
this.hide();
this.fireEvent(BI.FloatBox.EVENT_CLOSE);
this.fireEvent(BI.Popover.EVENT_CLOSE, arguments);
},
setZindex: function (zindex) {
@ -49261,11 +49261,11 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.float_box", BI.FloatBox);
BI.shortcut("bi.popover", BI.Popover);
BI.BarFloatBox = BI.inherit(BI.FloatBox, {
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))]
});
},
@ -49281,7 +49281,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
value: 1,
level: "ignore",
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CANCEL, v);
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
}
}, {
@ -49290,7 +49290,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
warningTitle: o.warningTitle,
value: 0,
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v);
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
}
}]
@ -49298,12 +49298,12 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
}
});
BI.shortcut("bi.bar_float_box", BI.BarFloatBox);
BI.shortcut("bi.bar_popover", BI.BarPopover);
BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE";
BI.FloatBox.EVENT_OPEN = "EVENT_OPEN";
BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL";
BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Popover.EVENT_CLOSE = "EVENT_CLOSE";
BI.Popover.EVENT_OPEN = "EVENT_OPEN";
BI.Popover.EVENT_CANCEL = "EVENT_CANCEL";
BI.Popover.EVENT_CONFIRM = "EVENT_CONFIRM";
/**
* 下拉框弹出层, zIndex在1000w
* @class BI.PopupView

38
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

304
dist/core.js vendored

@ -26544,147 +26544,6 @@ BI.BubblesController = BI.inherit(BI.Controller, {
delete this.bubblesManager[name];
return this;
}
});/**
* guy
* FloatBox弹出层控制器, z-index在100w层级
* @class BI.FloatBoxController
* @extends BI.Controller
*/
BI.FloatBoxController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.FloatBoxController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_floatbox;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var floatbox = BI.createWidget({
type: "bi.float_box"
}, options, context);
this.add(name, floatbox, options, context);
return this;
},
add: function (name, floatbox, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [floatbox]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = floatbox;
(function (key) {
floatbox.on(BI.FloatBox.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var floatbox = this.get(name);
floatbox.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = floatbox.element.width(), h = floatbox.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
floatbox.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* 弹出层面板控制器, z-index在10w层级
*
@ -26714,14 +26573,15 @@ BI.LayerController = BI.inherit(BI.Controller, {
});
},
make: function (name, container, op) {
make: function (name, container, op, context) {
if (BI.isWidget(container)) {
op = op || {};
op.container = container;
} else {
context = op;
op = container;
}
return this.create(name, null, op);
return this.create(name, null, op, context);
},
create: function (name, from, op, context) {
@ -26740,10 +26600,9 @@ BI.LayerController = BI.inherit(BI.Controller, {
if (this.has(name)) {
return this.get(name);
}
var widget = BI.createWidget((op.render || {}), {
type: "bi.layout",
cls: op.cls
}, context);
var widget = BI.createWidget((op.render || {}), BI.extend({
type: "bi.layout"
}, op), context);
var layout = BI.createWidget({
type: "bi.absolute",
items: [{
@ -26770,16 +26629,16 @@ BI.LayerController = BI.inherit(BI.Controller, {
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
});
}
@ -26857,6 +26716,147 @@ BI.MaskersController = BI.inherit(BI.LayerController, {
BI.MaskersController.superclass._init.apply(this, arguments);
this.zindex = BI.zIndex_masker;
}
});/**
* guy
* popover弹出层控制器, z-index在100w层级
* @class BI.popoverController
* @extends BI.Controller
*/
BI.PopoverController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.PopoverController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.PopoverController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_popover;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var popover = BI.createWidget(options || {}, {
type: "bi.popover"
}, context);
this.add(name, popover, options, context);
return this;
},
add: function (name, popover, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [popover]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = popover;
(function (key) {
popover.on(BI.Popover.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var popover = this.get(name);
popover.show && popover.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
popover.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* window.resize 控制器
*
@ -30063,7 +30063,7 @@ _.extend(BI, {
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_floatbox: 1e6,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,

109
dist/demo.js vendored

@ -5483,6 +5483,10 @@ Demo.COMPONENT_CONFIG = [{
pId: 102,
id: 10202,
text: "弹出层"
}, {
pId: 10202,
text: "layer",
value: "demo.layer"
}, {
pId: 10202,
text: "bi.popover",
@ -8461,6 +8465,73 @@ Demo.VtapeLayout = BI.inherit(BI.Widget, {
BI.shortcut("demo.vtape", Demo.VtapeLayout);/**
* Created by Windy on 2017/12/13.
*/
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var self = this, id1 = BI.UUID(), id2 = BI.UUID();
return {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.button",
text: "create形式创建layer, 遮住当前面板, 返回创建的面板对象",
height: 30,
handler: function () {
BI.Layers.create(id1, self, {
//偏移量
offset: {
left: 10,
right: 10,
top: 10,
bottom: 10
},
type: "bi.center_adapt",
cls: "bi-card",
items: [{
type: "bi.button",
text: "点击关闭",
handler: function () {
BI.Layers.hide(id1);
}
}]
});
BI.Layers.show(id1);
}
}, {
type: "bi.button",
text: "make形式创建layer,可以指定放到哪个面板内,这里指定当前面板(默认放在body下撑满), 返回创建的面板对象",
height: 30,
handler: function () {
BI.Layers.make(id2, self, {
//偏移量
offset: {
left: 10,
right: 10,
top: 10,
bottom: 10
},
type: "bi.center_adapt",
cls: "bi-card",
items: [{
type: "bi.button",
text: "点击关闭",
handler: function () {
BI.Layers.remove(id2);
}
}]
});
BI.Layers.show(id2);
}
}]
};
}
});
BI.shortcut("demo.layer", Demo.Func);/**
* Created by Windy on 2017/12/13.
*/
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
@ -8468,19 +8539,31 @@ Demo.Func = BI.inherit(BI.Widget, {
render: function () {
var id = BI.UUID();
return {
type: "bi.text_button",
text: "点击弹出Popover",
width: 200,
height: 80,
handler: function() {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
body: {
type: "bi.label",
text: "这个是body"
}
}).open(id);
}
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.text_button",
text: "点击弹出Popover",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.label",
text: "这个是body"
}
// footer: {
// type: "bi.label",
// text: "这个是footer"
// }
}).open(id);
}
}]
};
}
});

340
dist/fineui.js vendored

@ -26787,147 +26787,6 @@ BI.BubblesController = BI.inherit(BI.Controller, {
delete this.bubblesManager[name];
return this;
}
});/**
* guy
* FloatBox弹出层控制器, z-index在100w层级
* @class BI.FloatBoxController
* @extends BI.Controller
*/
BI.FloatBoxController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.FloatBoxController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_floatbox;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var floatbox = BI.createWidget({
type: "bi.float_box"
}, options, context);
this.add(name, floatbox, options, context);
return this;
},
add: function (name, floatbox, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [floatbox]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = floatbox;
(function (key) {
floatbox.on(BI.FloatBox.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var floatbox = this.get(name);
floatbox.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = floatbox.element.width(), h = floatbox.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
floatbox.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* 弹出层面板控制器, z-index在10w层级
*
@ -26957,14 +26816,15 @@ BI.LayerController = BI.inherit(BI.Controller, {
});
},
make: function (name, container, op) {
make: function (name, container, op, context) {
if (BI.isWidget(container)) {
op = op || {};
op.container = container;
} else {
context = op;
op = container;
}
return this.create(name, null, op);
return this.create(name, null, op, context);
},
create: function (name, from, op, context) {
@ -26983,10 +26843,9 @@ BI.LayerController = BI.inherit(BI.Controller, {
if (this.has(name)) {
return this.get(name);
}
var widget = BI.createWidget((op.render || {}), {
type: "bi.layout",
cls: op.cls
}, context);
var widget = BI.createWidget((op.render || {}), BI.extend({
type: "bi.layout"
}, op), context);
var layout = BI.createWidget({
type: "bi.absolute",
items: [{
@ -27013,16 +26872,16 @@ BI.LayerController = BI.inherit(BI.Controller, {
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
});
}
@ -27100,6 +26959,147 @@ BI.MaskersController = BI.inherit(BI.LayerController, {
BI.MaskersController.superclass._init.apply(this, arguments);
this.zindex = BI.zIndex_masker;
}
});/**
* guy
* popover弹出层控制器, z-index在100w层级
* @class BI.popoverController
* @extends BI.Controller
*/
BI.PopoverController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.PopoverController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.PopoverController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_popover;
this.zindexMap = {};
},
_check: function (name) {
return BI.isNotNull(this.floatManager[name]);
},
create: function (name, options, context) {
if (this._check(name)) {
return this;
}
var popover = BI.createWidget(options || {}, {
type: "bi.popover"
}, context);
this.add(name, popover, options, context);
return this;
},
add: function (name, popover, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
return this;
}
this.floatContainer[name] = BI.createWidget({
type: "bi.absolute",
cls: "bi-popup-view",
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [popover]
}, context)),
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.floatManager[name] = popover;
(function (key) {
popover.on(BI.Popover.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
BI.createWidget({
type: "bi.absolute",
element: options.container || this.options.render,
items: [{
el: this.floatContainer[name],
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
return this;
},
open: function (name) {
if (!this._check(name)) {
return this;
}
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var popover = this.get(name);
popover.show && popover.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
}
if (top < 0) {
top = 0;
}
popover.element.css({
left: left + "px",
top: top + "px"
});
}
return this;
},
close: function (name) {
if (!this._check(name)) {
return this;
}
if (this.floatOpened[name]) {
delete this.floatOpened[name];
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
},
get: function (name) {
return this.floatManager[name];
},
remove: function (name) {
if (!this._check(name)) {
return this;
}
this.floatContainer[name].destroy();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
delete this.floatManager[name];
delete this.floatLayer[name];
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
});/**
* window.resize 控制器
*
@ -30306,7 +30306,7 @@ _.extend(BI, {
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_floatbox: 1e6,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,
@ -38121,7 +38121,7 @@ BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.FloatBoxController();
BI.Popovers = new BI.PopoverController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();/**
* canvas绘图
@ -50935,14 +50935,14 @@ BI.GridView = BI.inherit(BI.Widget, {
});
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_view", BI.GridView);/**
* floatBox弹出层
* @class BI.FloatBox
* Popover弹出层
* @class BI.Popover
* @extends BI.Widget
*/
BI.FloatBox = BI.inherit(BI.Widget, {
BI.Popover = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-float-box bi-card",
return BI.extend(BI.Popover.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-popover bi-card",
width: 600,
height: 500,
header: null,
@ -51051,12 +51051,12 @@ BI.FloatBox = BI.inherit(BI.Widget, {
open: function () {
this.show();
this.fireEvent(BI.FloatBox.EVENT_OPEN);
this.fireEvent(BI.Popover.EVENT_OPEN, arguments);
},
close: function () {
this.hide();
this.fireEvent(BI.FloatBox.EVENT_CLOSE);
this.fireEvent(BI.Popover.EVENT_CLOSE, arguments);
},
setZindex: function (zindex) {
@ -51067,11 +51067,11 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.float_box", BI.FloatBox);
BI.shortcut("bi.popover", BI.Popover);
BI.BarFloatBox = BI.inherit(BI.FloatBox, {
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))]
});
},
@ -51087,7 +51087,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
value: 1,
level: "ignore",
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CANCEL, v);
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
}
}, {
@ -51096,7 +51096,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
warningTitle: o.warningTitle,
value: 0,
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v);
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
}
}]
@ -51104,12 +51104,12 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
}
});
BI.shortcut("bi.bar_float_box", BI.BarFloatBox);
BI.shortcut("bi.bar_popover", BI.BarPopover);
BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE";
BI.FloatBox.EVENT_OPEN = "EVENT_OPEN";
BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL";
BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Popover.EVENT_CLOSE = "EVENT_CLOSE";
BI.Popover.EVENT_OPEN = "EVENT_OPEN";
BI.Popover.EVENT_CANCEL = "EVENT_CANCEL";
BI.Popover.EVENT_CONFIRM = "EVENT_CONFIRM";
/**
* 下拉框弹出层, zIndex在1000w
* @class BI.PopupView

48
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
src/base/base.js

@ -3,6 +3,6 @@ BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.FloatBoxController();
BI.Popovers = new BI.PopoverController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();

34
src/base/layer/layer.floatbox.js → src/base/layer/layer.popover.js

@ -1,12 +1,12 @@
/**
* floatBox弹出层
* @class BI.FloatBox
* Popover弹出层
* @class BI.Popover
* @extends BI.Widget
*/
BI.FloatBox = BI.inherit(BI.Widget, {
BI.Popover = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-float-box bi-card",
return BI.extend(BI.Popover.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-popover bi-card",
width: 600,
height: 500,
header: null,
@ -115,12 +115,12 @@ BI.FloatBox = BI.inherit(BI.Widget, {
open: function () {
this.show();
this.fireEvent(BI.FloatBox.EVENT_OPEN);
this.fireEvent(BI.Popover.EVENT_OPEN, arguments);
},
close: function () {
this.hide();
this.fireEvent(BI.FloatBox.EVENT_CLOSE);
this.fireEvent(BI.Popover.EVENT_CLOSE, arguments);
},
setZindex: function (zindex) {
@ -131,11 +131,11 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.float_box", BI.FloatBox);
BI.shortcut("bi.popover", BI.Popover);
BI.BarFloatBox = BI.inherit(BI.FloatBox, {
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))]
});
},
@ -151,7 +151,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
value: 1,
level: "ignore",
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CANCEL, v);
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
}
}, {
@ -160,7 +160,7 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
warningTitle: o.warningTitle,
value: 0,
handler: function (v) {
self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v);
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
}
}]
@ -168,9 +168,9 @@ BI.BarFloatBox = BI.inherit(BI.FloatBox, {
}
});
BI.shortcut("bi.bar_float_box", BI.BarFloatBox);
BI.shortcut("bi.bar_popover", BI.BarPopover);
BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE";
BI.FloatBox.EVENT_OPEN = "EVENT_OPEN";
BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL";
BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Popover.EVENT_CLOSE = "EVENT_CLOSE";
BI.Popover.EVENT_OPEN = "EVENT_OPEN";
BI.Popover.EVENT_CANCEL = "EVENT_CANCEL";
BI.Popover.EVENT_CONFIRM = "EVENT_CONFIRM";

20
src/core/controller/controller.layer.js

@ -27,14 +27,15 @@ BI.LayerController = BI.inherit(BI.Controller, {
});
},
make: function (name, container, op) {
make: function (name, container, op, context) {
if (BI.isWidget(container)) {
op = op || {};
op.container = container;
} else {
context = op;
op = container;
}
return this.create(name, null, op);
return this.create(name, null, op, context);
},
create: function (name, from, op, context) {
@ -53,10 +54,9 @@ BI.LayerController = BI.inherit(BI.Controller, {
if (this.has(name)) {
return this.get(name);
}
var widget = BI.createWidget((op.render || {}), {
type: "bi.layout",
cls: op.cls
}, context);
var widget = BI.createWidget((op.render || {}), BI.extend({
type: "bi.layout"
}, op), context);
var layout = BI.createWidget({
type: "bi.absolute",
items: [{
@ -83,16 +83,16 @@ BI.LayerController = BI.inherit(BI.Controller, {
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || ""
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
});
}

36
src/core/controller/controller.floatbox.js → src/core/controller/controller.popover.js

@ -1,25 +1,25 @@
/**
* guy
* FloatBox弹出层控制器, z-index在100w层级
* @class BI.FloatBoxController
* popover弹出层控制器, z-index在100w层级
* @class BI.popoverController
* @extends BI.Controller
*/
BI.FloatBoxController = BI.inherit(BI.Controller, {
BI.PopoverController = BI.inherit(BI.Controller, {
_defaultConfig: function () {
return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.PopoverController.superclass._defaultConfig.apply(this, arguments), {
modal: true, // 模态窗口
render: "body"
});
},
_init: function () {
BI.FloatBoxController.superclass._init.apply(this, arguments);
BI.PopoverController.superclass._init.apply(this, arguments);
this.modal = this.options.modal;
this.floatManager = {};
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_floatbox;
this.zindex = BI.zIndex_popover;
this.zindexMap = {};
},
@ -31,14 +31,14 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
if (this._check(name)) {
return this;
}
var floatbox = BI.createWidget({
type: "bi.float_box"
}, options, context);
this.add(name, floatbox, options, context);
var popover = BI.createWidget(options || {}, {
type: "bi.popover"
}, context);
this.add(name, popover, options, context);
return this;
},
add: function (name, floatbox, options, context) {
add: function (name, popover, options, context) {
var self = this;
options || (options = {});
if (this._check(name)) {
@ -50,7 +50,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
items: [{
el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute",
items: [floatbox]
items: [popover]
}, context)),
left: 0,
right: 0,
@ -58,9 +58,9 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
bottom: 0
}]
});
this.floatManager[name] = floatbox;
this.floatManager[name] = popover;
(function (key) {
floatbox.on(BI.FloatBox.EVENT_CLOSE, function () {
popover.on(BI.Popover.EVENT_CLOSE, function () {
self.close(key);
});
})(name);
@ -91,10 +91,10 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
this.modal && container.element.__buildZIndexMask__(this.zindex++);
this.get(name).setZindex(this.zindex++);
this.floatContainer[name].visible();
var floatbox = this.get(name);
floatbox.show();
var popover = this.get(name);
popover.show && popover.show();
var W = $(this.options.render).width(), H = $(this.options.render).height();
var w = floatbox.element.width(), h = floatbox.element.height();
var w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
left = 0;
@ -102,7 +102,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
if (top < 0) {
top = 0;
}
floatbox.element.css({
popover.element.css({
left: left + "px",
top: top + "px"
});

2
src/core/var.js

@ -7,7 +7,7 @@ _.extend(BI, {
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_floatbox: 1e6,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,

0
src/css/base/view/popover.css

2
src/less/base/view/floatboxview.less → src/less/base/view/popover.less

@ -1,4 +1,4 @@
@import "../../index";
.bi-float-box {
.bi-popover {
}

2
src/less/var.less

@ -3,7 +3,7 @@
@image2xUrl: 'images/2x/'; //2x图片的基本地址
@zIndex-layer: 100000;
@zIndex-floatbox: 1000000;
@zIndex-popover: 1000000;
@zIndex-popup: 10000000;
@zIndex-masker: 100000000;
@zIndex-tip: 1000000000;

2
utils/utils.js

@ -9738,7 +9738,7 @@ _.extend(BI, {
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_floatbox: 1e6,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,

Loading…
Cancel
Save