|
|
|
@ -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,13 +61,13 @@ 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 |
|
|
|
|
}).bind({ click: fn }); |
|
|
|
|
"max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth, |
|
|
|
|
}).bind({ click: fn, }); |
|
|
|
|
|
|
|
|
|
this.element.bind("mousewheel", fn); |
|
|
|
|
|
|
|
|
|
o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn }); |
|
|
|
|
o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop }); |
|
|
|
|
o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn, }); |
|
|
|
|
o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop, }); |
|
|
|
|
this.tool = this._createTool(); |
|
|
|
|
this.tab = this._createTab(); |
|
|
|
|
this.view = this._createView(); |
|
|
|
@ -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,23 +123,23 @@ BI.PopupView = BI.inherit(BI.Widget, {
|
|
|
|
|
items: [{ |
|
|
|
|
el: this.arrowWrapper, |
|
|
|
|
left: 0, |
|
|
|
|
top: 0 |
|
|
|
|
top: 0, |
|
|
|
|
}, { |
|
|
|
|
el: this.placeholder |
|
|
|
|
}] |
|
|
|
|
el: this.placeholder, |
|
|
|
|
}], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_createView: function () { |
|
|
|
|
var o = this.options; |
|
|
|
|
this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value }); |
|
|
|
|
this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value, }); |
|
|
|
|
this.button_group.element.css({ |
|
|
|
|
"min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight, |
|
|
|
|
"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": |
|
|
|
@ -411,7 +411,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
|
|
|
|
|
toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0); |
|
|
|
|
var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVgap; |
|
|
|
|
this.view.resetHeight ? this.view.resetHeight(resetHeight) : |
|
|
|
|
this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit }); |
|
|
|
|
this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit, }); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (selectedValues) { |
|
|
|
@ -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); |
|
|
|
|