Browse Source

Merge pull request #947 in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit 'c50f9df80812580d9a5402bd494402a52acfbad8':
  BI-46199 feat: combo接口
  combo弹出再内部
es6
windy 6 years ago
parent
commit
d52f7152f1
  1. 4
      demo/js/config/core.js
  2. 75
      demo/js/core/abstract/combination/demo.combo3.js
  3. 95
      dist/2.0/fineui.ie.js
  4. 95
      dist/2.0/fineui.js
  5. 19
      dist/base.js
  6. 95
      dist/bundle.ie.js
  7. 95
      dist/bundle.js
  8. 76
      dist/core.js
  9. 78
      dist/demo.js
  10. 95
      dist/fineui.ie.js
  11. 95
      dist/fineui.js
  12. 23
      dist/fineui_without_jquery_polyfill.js
  13. 4
      dist/utils.js
  14. 5
      src/base/combination/combo.js
  15. 72
      src/core/platform/web/dom.js

4
demo/js/config/core.js

@ -128,6 +128,10 @@ Demo.CORE_CONFIG = [{
pId: 10201,
text: "bi.combo(各种位置)",
value: "demo.combo2"
}, {
pId: 10201,
text: "bi.combo(內部位置)",
value: "demo.combo3"
}, {
pId: 10201,
text: "bi.expander",

75
demo/js/core/abstract/combination/demo.combo3.js

@ -0,0 +1,75 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
_createEl: function () {
return {
type: "bi.label",
cls:"bi-border",
height: "100%",
text: "点击"
};
},
oneCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 200,
height: 200
}
}
});
},
twoCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 1000,
height: 200
}
}
});
},
threeCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 400,
height: 200
}
}
});
},
render: function () {
return {
type: "bi.grid",
hgap: 10,
vgap: 5,
items: [[this.oneCombo()], [this.twoCombo()], [this.threeCombo()]]
};
}
});
BI.shortcut("demo.combo3", Demo.Func);

95
dist/2.0/fineui.ie.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -19759,6 +19759,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -19766,6 +19772,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -19783,12 +19796,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -19994,7 +20016,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20012,6 +20034,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20103,6 +20131,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -38811,7 +38881,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -38869,14 +38942,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39183,6 +39255,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

95
dist/2.0/fineui.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -19759,6 +19759,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -19766,6 +19772,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -19783,12 +19796,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -19994,7 +20016,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20012,6 +20034,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20103,6 +20131,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -39215,7 +39285,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -39273,14 +39346,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39587,6 +39659,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

19
dist/base.js vendored

@ -3324,7 +3324,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -3382,14 +3385,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -3696,6 +3698,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

95
dist/bundle.ie.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -19759,6 +19759,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -19766,6 +19772,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -19783,12 +19796,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -19994,7 +20016,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20012,6 +20034,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20103,6 +20131,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -38811,7 +38881,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -38869,14 +38942,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39183,6 +39255,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

95
dist/bundle.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -19759,6 +19759,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -19766,6 +19772,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -19783,12 +19796,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -19994,7 +20016,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20012,6 +20034,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20103,6 +20131,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -39215,7 +39285,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -39273,14 +39346,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39587,6 +39659,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

76
dist/core.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -19759,6 +19759,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -19766,6 +19772,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -19783,12 +19796,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -19994,7 +20016,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20012,6 +20034,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20103,6 +20131,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}

78
dist/demo.js vendored

@ -3781,6 +3781,10 @@ Demo.COMPONENT_CONFIG = [{
pId: 10201,
text: "bi.combo(各种位置)",
value: "demo.combo2"
}, {
pId: 10201,
text: "bi.combo(內部位置)",
value: "demo.combo3"
}, {
pId: 10201,
text: "bi.expander",
@ -4864,6 +4868,80 @@ BI.shortcut("demo.combo2", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
_createEl: function () {
return {
type: "bi.label",
cls:"bi-border",
height: "100%",
text: "点击"
};
},
oneCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 200,
height: 200
}
}
});
},
twoCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 1000,
height: 200
}
}
});
},
threeCombo: function () {
return BI.createWidget({
type: "bi.combo",
direction: "right,innerRight",
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: this._createEl(),
popup: {
el: {
type: "bi.layout",
width: 400,
height: 200
}
}
});
},
render: function () {
return {
type: "bi.grid",
hgap: 10,
vgap: 5,
items: [[this.oneCombo()], [this.twoCombo()], [this.threeCombo()]]
};
}
});
BI.shortcut("demo.combo3", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
return {
type: "bi.vertical",

95
dist/fineui.ie.js vendored

@ -10480,8 +10480,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -20004,6 +20004,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -20011,6 +20017,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -20028,12 +20041,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -20239,7 +20261,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20257,6 +20279,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20348,6 +20376,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -39056,7 +39126,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -39114,14 +39187,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39428,6 +39500,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

95
dist/fineui.js vendored

@ -10480,8 +10480,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -20004,6 +20004,12 @@ BI.prepares.push(function () {
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -20011,6 +20017,13 @@ BI.prepares.push(function () {
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -20028,12 +20041,21 @@ BI.prepares.push(function () {
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -20239,7 +20261,7 @@ BI.prepares.push(function () {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -20257,6 +20279,12 @@ BI.prepares.push(function () {
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -20348,6 +20376,48 @@ BI.prepares.push(function () {
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}
@ -39460,7 +39530,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -39518,14 +39591,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -39832,6 +39904,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

23
dist/fineui_without_jquery_polyfill.js vendored

@ -10235,8 +10235,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
@ -26656,7 +26656,10 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
@ -26714,14 +26717,13 @@ BI.Combo = BI.inherit(BI.Widget, {
}
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
});
}))));
o.isDefaultInit && (this._assertPopupView());
BI.Resizers.add(this.getName(), BI.bind(function () {
if (this.isViewVisible()) {
@ -27028,6 +27030,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

4
dist/utils.js vendored

@ -11014,8 +11014,8 @@ if (!_global.BI) {
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr);
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr);
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);

5
src/base/combination/combo.js

@ -9,7 +9,7 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight
logic: {
dynamic: true
},
@ -383,6 +383,9 @@ BI.Combo = BI.inherit(BI.Widget, {
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
break;
case "top,custom":
case "custom,top":
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight);

72
src/core/platform/web/dom.js

@ -306,6 +306,12 @@
};
},
getInnerLeftPosition: function (combo, popup, extraWidth) {
return {
left: combo.element.offset().left + (extraWidth || 0)
};
},
getRightPosition: function (combo, popup, extraWidth) {
var el = combo.element;
return {
@ -313,6 +319,13 @@
};
},
getInnerRightPosition: function (combo, popup, extraWidth) {
var el = combo.element, viewBounds = popup.element.bounds();
return {
left: el.offset().left + el.outerWidth() - viewBounds.width - (extraWidth || 0)
};
},
getTopPosition: function (combo, popup, extraHeight) {
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
@ -330,12 +343,21 @@
return BI.DOM.getLeftPosition(combo, popup, extraWidth).left >= 0;
},
isInnerLeftSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getInnerLeftPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
return BI.DOM.getInnerRightPosition(combo, popup, extraWidth).left >= 0;
},
isTopSpaceEnough: function (combo, popup, extraHeight) {
return BI.DOM.getTopPosition(combo, popup, extraHeight).top >= 0;
},
@ -541,7 +563,7 @@
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
var leftRight = [], topBottom = [];
var leftRight = [], topBottom = [], innerLeftRight = [];
var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false;
var left, top, pos, firstDir = directions[0];
for (i = 0; i < directions.length; i++) {
@ -559,6 +581,12 @@
case "bottom":
topBottom.push(direct);
break;
case "innerLeft":
innerLeftRight.push(direct);
break;
case "innerRight":
innerLeftRight.push(direct);
break;
}
}
for (i = 0; i < directions.length; i++) {
@ -650,6 +678,48 @@
}
tbFirst = true;
break;
case "innerLeft":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isInnerLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerLeftPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerLeft,top";
}
if (tbFirst) {
pos.change = "innerLeft";
}
pos.left = left;
return pos;
}
}
lrFirst = true;
break;
case "innerRight":
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isInnerRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getInnerRightPosition(combo, popup, tW).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,bottom";
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos.dir = "innerRight,top";
}
if (tbFirst) {
pos.change = "innerRight";
}
pos.left = left;
return pos;
}
}
break;
}
}

Loading…
Cancel
Save