Browse Source

Merge pull request #151 in FUI/fineui from ~GUY/fineui:master to master

* commit 'c2c060db470ec5cb22e8abf639bbad9b2ca5db68':
  update
  pager修改
  BI-10727 布局问题
es6
guy 7 years ago
parent
commit
34386925bf
  1. 8
      bi/case.js
  2. 116
      bi/widget.js
  3. 124
      dist/bundle.js
  4. 28
      dist/bundle.min.js
  5. 8
      dist/case.js
  6. 116
      dist/widget.js
  7. 8
      src/case/pager/pager.direction.js
  8. 26
      src/widget/arrangement/arrangement.js
  9. 90
      src/widget/interactivearrangement/interactivearrangement.js

8
bi/case.js

@ -8908,7 +8908,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: v.curr, value: v.curr,
title: v.curr title: v.curr,
invisible: true
}); });
this.vpager = BI.createWidget({ this.vpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -8919,6 +8920,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: v.pages, pages: v.pages,
@ -8971,7 +8973,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: h.curr, value: h.curr,
title: h.curr title: h.curr,
invisible: true
}); });
this.hpager = BI.createWidget({ this.hpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -8982,6 +8985,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: h.pages, pages: h.pages,

116
bi/widget.js

@ -1083,12 +1083,21 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
_renderRegion: function () { _renderRegion: function () {
var self = this; var items = BI.toArray(this.regions);
BI.createWidget({ BI.each(items, function (i, item) {
type: "bi.absolute", if (BI.isNotNull(item.el)) {
element: this.container, item.el.options.key = item.id;
items: BI.toArray(this.regions) } else {
item.key = item.id;
}
}); });
if (BI.isNull(this.wrapper)) {
this.wrapper = BI.createWidget({
type: "bi.absolute",
element: this.container
});
}
this.wrapper.populate(items);
}, },
getClientWidth: function () { getClientWidth: function () {
@ -1380,6 +1389,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
} }
return out; return out;
function getStatics(layout) { function getStatics(layout) {
return BI.filter(layout, function (i, l) { return BI.filter(layout, function (i, l) {
return l._static; return l._static;
@ -1824,11 +1834,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
var self = this; this.regions = {};
BI.each(this.regions, function (name, region) {
self.regions[name].el.setVisible(false);
delete self.regions[name];
});
this._populate(items); this._populate(items);
this._renderRegion(); this._renderRegion();
} }
@ -5220,11 +5226,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (vs.right.length > 0) { } else if (vs.right.length > 0) {
var temp = this._getRegionClientPosition(vs.right[0].id); var temp = this._getRegionClientPosition(vs.right[0].id);
l = temp.left + temp.width; l = temp.left + temp.width;
} else if (vs.center.length > 0) {
var temp = this._getRegionClientPosition(vs.center[0].id);
l = temp.left + temp.width / 2;
} }
var rs = vs.left.concat(vs.right); var rs = vs.left.concat(vs.right).concat(vs.center);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l)) { if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l) || self._isEqual(p.left + p.width / 2, l)) {
var topPoint = { var topPoint = {
top: p.top + p.height / 2, top: p.top + p.height / 2,
left: l left: l
@ -5269,11 +5278,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (hs.bottom.length > 0) { } else if (hs.bottom.length > 0) {
var temp = this._getRegionClientPosition(hs.bottom[0].id); var temp = this._getRegionClientPosition(hs.bottom[0].id);
t = temp.top + temp.height; t = temp.top + temp.height;
} else if (hs.middle.length > 0) {
var temp = this._getRegionClientPosition(hs.middle[0].id);
t = temp.top + temp.height / 2;
} }
var rs = hs.top.concat(hs.bottom); var rs = hs.top.concat(hs.bottom).concat(hs.middle);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t)) { if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t) || self._isEqual(p.top + p.height / 2, t)) {
var leftPoint = { var leftPoint = {
top: t, top: t,
left: p.left + p.width / 2 left: p.left + p.width / 2
@ -5309,66 +5321,18 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
_centerAlign: function (position, size, regions) { _centerAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._vAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var l;
if (cs.center.length > 0) {
var temp = this._getRegionClientPosition(cs.center[0].id);
l = temp.left + temp.width / 2;
}
BI.each(cs.center, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left + p.width / 2, l)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: l,
top: position.top + size.height / 2
}
});
}
});
return positions;
}, },
_middleAlign: function (position, size, regions) { _middleAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._hAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var t;
if (cs.middle.length > 0) {
var temp = this._getRegionClientPosition(cs.middle[0].id);
t = temp.top + temp.height / 2;
}
BI.each(cs.middle, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top + p.height / 2, t)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: position.left + size.width / 2,
top: t
}
});
}
});
return positions;
}, },
@ -5459,13 +5423,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);
@ -5503,13 +5467,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);

124
dist/bundle.js vendored

@ -74696,7 +74696,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: v.curr, value: v.curr,
title: v.curr title: v.curr,
invisible: true
}); });
this.vpager = BI.createWidget({ this.vpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -74707,6 +74708,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: v.pages, pages: v.pages,
@ -74759,7 +74761,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: h.curr, value: h.curr,
title: h.curr title: h.curr,
invisible: true
}); });
this.hpager = BI.createWidget({ this.hpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -74770,6 +74773,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: h.pages, pages: h.pages,
@ -79583,12 +79587,21 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
_renderRegion: function () { _renderRegion: function () {
var self = this; var items = BI.toArray(this.regions);
BI.createWidget({ BI.each(items, function (i, item) {
type: "bi.absolute", if (BI.isNotNull(item.el)) {
element: this.container, item.el.options.key = item.id;
items: BI.toArray(this.regions) } else {
item.key = item.id;
}
}); });
if (BI.isNull(this.wrapper)) {
this.wrapper = BI.createWidget({
type: "bi.absolute",
element: this.container
});
}
this.wrapper.populate(items);
}, },
getClientWidth: function () { getClientWidth: function () {
@ -79880,6 +79893,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
} }
return out; return out;
function getStatics(layout) { function getStatics(layout) {
return BI.filter(layout, function (i, l) { return BI.filter(layout, function (i, l) {
return l._static; return l._static;
@ -80324,11 +80338,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
var self = this; this.regions = {};
BI.each(this.regions, function (name, region) {
self.regions[name].el.setVisible(false);
delete self.regions[name];
});
this._populate(items); this._populate(items);
this._renderRegion(); this._renderRegion();
} }
@ -83720,11 +83730,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (vs.right.length > 0) { } else if (vs.right.length > 0) {
var temp = this._getRegionClientPosition(vs.right[0].id); var temp = this._getRegionClientPosition(vs.right[0].id);
l = temp.left + temp.width; l = temp.left + temp.width;
} else if (vs.center.length > 0) {
var temp = this._getRegionClientPosition(vs.center[0].id);
l = temp.left + temp.width / 2;
} }
var rs = vs.left.concat(vs.right); var rs = vs.left.concat(vs.right).concat(vs.center);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l)) { if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l) || self._isEqual(p.left + p.width / 2, l)) {
var topPoint = { var topPoint = {
top: p.top + p.height / 2, top: p.top + p.height / 2,
left: l left: l
@ -83769,11 +83782,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (hs.bottom.length > 0) { } else if (hs.bottom.length > 0) {
var temp = this._getRegionClientPosition(hs.bottom[0].id); var temp = this._getRegionClientPosition(hs.bottom[0].id);
t = temp.top + temp.height; t = temp.top + temp.height;
} else if (hs.middle.length > 0) {
var temp = this._getRegionClientPosition(hs.middle[0].id);
t = temp.top + temp.height / 2;
} }
var rs = hs.top.concat(hs.bottom); var rs = hs.top.concat(hs.bottom).concat(hs.middle);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t)) { if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t) || self._isEqual(p.top + p.height / 2, t)) {
var leftPoint = { var leftPoint = {
top: t, top: t,
left: p.left + p.width / 2 left: p.left + p.width / 2
@ -83809,66 +83825,18 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
_centerAlign: function (position, size, regions) { _centerAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._vAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var l;
if (cs.center.length > 0) {
var temp = this._getRegionClientPosition(cs.center[0].id);
l = temp.left + temp.width / 2;
}
BI.each(cs.center, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left + p.width / 2, l)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: l,
top: position.top + size.height / 2
}
});
}
});
return positions;
}, },
_middleAlign: function (position, size, regions) { _middleAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._hAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var t;
if (cs.middle.length > 0) {
var temp = this._getRegionClientPosition(cs.middle[0].id);
t = temp.top + temp.height / 2;
}
BI.each(cs.middle, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top + p.height / 2, t)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: position.left + size.width / 2,
top: t
}
});
}
});
return positions;
}, },
@ -83959,13 +83927,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);
@ -84003,13 +83971,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);

28
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

8
dist/case.js vendored

@ -8908,7 +8908,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: v.curr, value: v.curr,
title: v.curr title: v.curr,
invisible: true
}); });
this.vpager = BI.createWidget({ this.vpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -8919,6 +8920,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: v.pages, pages: v.pages,
@ -8971,7 +8973,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: h.curr, value: h.curr,
title: h.curr title: h.curr,
invisible: true
}); });
this.hpager = BI.createWidget({ this.hpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -8982,6 +8985,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: h.pages, pages: h.pages,

116
dist/widget.js vendored

@ -1083,12 +1083,21 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
_renderRegion: function () { _renderRegion: function () {
var self = this; var items = BI.toArray(this.regions);
BI.createWidget({ BI.each(items, function (i, item) {
type: "bi.absolute", if (BI.isNotNull(item.el)) {
element: this.container, item.el.options.key = item.id;
items: BI.toArray(this.regions) } else {
item.key = item.id;
}
}); });
if (BI.isNull(this.wrapper)) {
this.wrapper = BI.createWidget({
type: "bi.absolute",
element: this.container
});
}
this.wrapper.populate(items);
}, },
getClientWidth: function () { getClientWidth: function () {
@ -1380,6 +1389,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
} }
return out; return out;
function getStatics(layout) { function getStatics(layout) {
return BI.filter(layout, function (i, l) { return BI.filter(layout, function (i, l) {
return l._static; return l._static;
@ -1824,11 +1834,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
var self = this; this.regions = {};
BI.each(this.regions, function (name, region) {
self.regions[name].el.setVisible(false);
delete self.regions[name];
});
this._populate(items); this._populate(items);
this._renderRegion(); this._renderRegion();
} }
@ -5220,11 +5226,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (vs.right.length > 0) { } else if (vs.right.length > 0) {
var temp = this._getRegionClientPosition(vs.right[0].id); var temp = this._getRegionClientPosition(vs.right[0].id);
l = temp.left + temp.width; l = temp.left + temp.width;
} else if (vs.center.length > 0) {
var temp = this._getRegionClientPosition(vs.center[0].id);
l = temp.left + temp.width / 2;
} }
var rs = vs.left.concat(vs.right); var rs = vs.left.concat(vs.right).concat(vs.center);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l)) { if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l) || self._isEqual(p.left + p.width / 2, l)) {
var topPoint = { var topPoint = {
top: p.top + p.height / 2, top: p.top + p.height / 2,
left: l left: l
@ -5269,11 +5278,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (hs.bottom.length > 0) { } else if (hs.bottom.length > 0) {
var temp = this._getRegionClientPosition(hs.bottom[0].id); var temp = this._getRegionClientPosition(hs.bottom[0].id);
t = temp.top + temp.height; t = temp.top + temp.height;
} else if (hs.middle.length > 0) {
var temp = this._getRegionClientPosition(hs.middle[0].id);
t = temp.top + temp.height / 2;
} }
var rs = hs.top.concat(hs.bottom); var rs = hs.top.concat(hs.bottom).concat(hs.middle);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t)) { if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t) || self._isEqual(p.top + p.height / 2, t)) {
var leftPoint = { var leftPoint = {
top: t, top: t,
left: p.left + p.width / 2 left: p.left + p.width / 2
@ -5309,66 +5321,18 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
_centerAlign: function (position, size, regions) { _centerAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._vAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var l;
if (cs.center.length > 0) {
var temp = this._getRegionClientPosition(cs.center[0].id);
l = temp.left + temp.width / 2;
}
BI.each(cs.center, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left + p.width / 2, l)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: l,
top: position.top + size.height / 2
}
});
}
});
return positions;
}, },
_middleAlign: function (position, size, regions) { _middleAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._hAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var t;
if (cs.middle.length > 0) {
var temp = this._getRegionClientPosition(cs.middle[0].id);
t = temp.top + temp.height / 2;
}
BI.each(cs.middle, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top + p.height / 2, t)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: position.left + size.width / 2,
top: t
}
});
}
});
return positions;
}, },
@ -5459,13 +5423,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);
@ -5503,13 +5467,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);

8
src/case/pager/pager.direction.js

@ -69,7 +69,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: v.curr, value: v.curr,
title: v.curr title: v.curr,
invisible: true
}); });
this.vpager = BI.createWidget({ this.vpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -80,6 +81,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: v.pages, pages: v.pages,
@ -132,7 +134,8 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
width: 24, width: 24,
height: 20, height: 20,
value: h.curr, value: h.curr,
title: h.curr title: h.curr,
invisible: true
}); });
this.hpager = BI.createWidget({ this.hpager = BI.createWidget({
type: "bi.pager", type: "bi.pager",
@ -143,6 +146,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
rgap: 24, rgap: 24,
vgap: 1 vgap: 1
}], }],
invisible: true,
dynamicShow: false, dynamicShow: false,
pages: h.pages, pages: h.pages,

26
src/widget/arrangement/arrangement.js

@ -284,12 +284,21 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
_renderRegion: function () { _renderRegion: function () {
var self = this; var items = BI.toArray(this.regions);
BI.createWidget({ BI.each(items, function (i, item) {
type: "bi.absolute", if (BI.isNotNull(item.el)) {
element: this.container, item.el.options.key = item.id;
items: BI.toArray(this.regions) } else {
item.key = item.id;
}
}); });
if (BI.isNull(this.wrapper)) {
this.wrapper = BI.createWidget({
type: "bi.absolute",
element: this.container
});
}
this.wrapper.populate(items);
}, },
getClientWidth: function () { getClientWidth: function () {
@ -581,6 +590,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
} }
return out; return out;
function getStatics(layout) { function getStatics(layout) {
return BI.filter(layout, function (i, l) { return BI.filter(layout, function (i, l) {
return l._static; return l._static;
@ -1025,11 +1035,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
var self = this; this.regions = {};
BI.each(this.regions, function (name, region) {
self.regions[name].el.setVisible(false);
delete self.regions[name];
});
this._populate(items); this._populate(items);
this._renderRegion(); this._renderRegion();
} }

90
src/widget/interactivearrangement/interactivearrangement.js

@ -115,11 +115,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (vs.right.length > 0) { } else if (vs.right.length > 0) {
var temp = this._getRegionClientPosition(vs.right[0].id); var temp = this._getRegionClientPosition(vs.right[0].id);
l = temp.left + temp.width; l = temp.left + temp.width;
} else if (vs.center.length > 0) {
var temp = this._getRegionClientPosition(vs.center[0].id);
l = temp.left + temp.width / 2;
} }
var rs = vs.left.concat(vs.right); var rs = vs.left.concat(vs.right).concat(vs.center);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l)) { if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l) || self._isEqual(p.left + p.width / 2, l)) {
var topPoint = { var topPoint = {
top: p.top + p.height / 2, top: p.top + p.height / 2,
left: l left: l
@ -164,11 +167,14 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} else if (hs.bottom.length > 0) { } else if (hs.bottom.length > 0) {
var temp = this._getRegionClientPosition(hs.bottom[0].id); var temp = this._getRegionClientPosition(hs.bottom[0].id);
t = temp.top + temp.height; t = temp.top + temp.height;
} else if (hs.middle.length > 0) {
var temp = this._getRegionClientPosition(hs.middle[0].id);
t = temp.top + temp.height / 2;
} }
var rs = hs.top.concat(hs.bottom); var rs = hs.top.concat(hs.bottom).concat(hs.middle);
BI.each(rs, function (i, region) { BI.each(rs, function (i, region) {
var p = self._getRegionClientPosition(region.id); var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t)) { if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t) || self._isEqual(p.top + p.height / 2, t)) {
var leftPoint = { var leftPoint = {
top: t, top: t,
left: p.left + p.width / 2 left: p.left + p.width / 2
@ -204,66 +210,18 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
_centerAlign: function (position, size, regions) { _centerAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._vAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var l;
if (cs.center.length > 0) {
var temp = this._getRegionClientPosition(cs.center[0].id);
l = temp.left + temp.width / 2;
}
BI.each(cs.center, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.left + p.width / 2, l)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: l,
top: position.top + size.height / 2
}
});
}
});
return positions;
}, },
_middleAlign: function (position, size, regions) { _middleAlign: function (position, size, regions) {
var self = this; var self = this;
var cs = this._positionAt({ return this._hAlign({
left: position.left + size.width / 2, left: position.left + size.width / 2,
top: position.top + size.height / 2 top: position.top + size.height / 2
}, regions); }, regions);
var positions = [];
var t;
if (cs.middle.length > 0) {
var temp = this._getRegionClientPosition(cs.middle[0].id);
t = temp.top + temp.height / 2;
}
BI.each(cs.middle, function (i, region) {
var p = self._getRegionClientPosition(region.id);
if (self._isEqual(p.top + p.height / 2, t)) {
var topPoint = {
top: p.top + p.height / 2,
left: p.left + p.width / 2
};
positions.push({
id: p.id,
start: topPoint,
end: {
left: position.left + size.width / 2,
top: t
}
});
}
});
return positions;
}, },
@ -354,13 +312,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);
@ -398,13 +356,13 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
} }
var other = this._getRegionExcept(name, regions); var other = this._getRegionExcept(name, regions);
position = position || { position = position || {
left: me.left, left: me.left,
top: me.top top: me.top
}; };
size = size || { size = size || {
width: me.width, width: me.width,
height: me.height height: me.height
}; };
var left = this._leftAlign(position, size, other); var left = this._leftAlign(position, size, other);
var right = this._rightAlign(position, size, other); var right = this._rightAlign(position, size, other);
var top = this._topAlign(position, size, other, other); var top = this._topAlign(position, size, other, other);

Loading…
Cancel
Save