Browse Source

Merge pull request #8 in FUI/fineui from ~GUY/fineui:2.0 to 2.0

* commit 'c302441d95265d4e92c31dde958908f7d90607a7':
  add
  add
es6
guy 8 years ago
parent
commit
4655137c3e
  1. 113
      bi/base.js
  2. 2
      bi/case.js
  3. 267
      bi/core.js
  4. 8
      bi/widget.js
  5. 58
      demo/js/core/abstract/demo.button_group.js
  6. 113
      dist/base.js
  7. 2
      dist/case.js
  8. 267
      dist/core.js
  9. BIN
      dist/icon/loading.gif
  10. 14
      dist/resource.css
  11. 8
      dist/widget.js
  12. 58
      src/base/combination/group.button.js
  13. 53
      src/base/combination/navigation.js
  14. 2
      src/base/combination/tab.js
  15. 2
      src/case/loader/sort.list.js
  16. 88
      src/core/action/action.show.effect.js
  17. 17
      src/core/action/action.show.js
  18. 32
      src/core/action/action.show.scale.js
  19. 2
      src/core/view.js
  20. 28
      src/core/widget.js
  21. 19
      src/core/wrapper/layout.js
  22. 83
      src/core/wrapper/layout/layout.card.js
  23. 9
      src/css/resource/third/farbtastic/farbtastic.css
  24. 5
      src/css/resource/third/ztree/zTreeStyle.css
  25. 8
      src/less/resource/third/farbtastic/farbtastic.less
  26. 47
      src/less/resource/third/ztree/zTreeStyle.less
  27. 8
      src/widget/arrangement/arrangement.js

113
bi/base.js

@ -1034,7 +1034,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], {
@ -1049,6 +1048,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return btns;
},
_packageSimpleItems: function (btns) {
var o = this.options;
return BI.map(o.items, function (i, item) {
if (BI.stripEL(item) === item) {
return btns[i];
}
return BI.extend({}, item, {
el: btns[i]
})
})
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
@ -1064,6 +1075,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout;
},
//如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1
},
doBehavior: function () {
var args = Array.prototype.slice.call(arguments);
@ -1078,9 +1095,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.prependItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns);
return;
}
@ -1095,8 +1110,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.addItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns);
return;
}
@ -1105,36 +1119,22 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.layouts.addItems(this._packageLayout(items).items);
},
removeItemAt: function (indexes) {
var self = this;
indexes = BI.isArray(indexes) ? indexes : [indexes];
var buttons = [];
BI.each(indexes, function (i, index) {
buttons.push(self.buttons[index]);
});
BI.each(buttons, function (i, btn) {
btn && btn.destroy();
})
},
removeItems: function (v) {
v = BI.isArray(v) ? v : [v];
var indexes = [];
BI.each(this.buttons, function (i, item) {
if (BI.deepContains(v, item.getValue())) {
indexes.push(i);
}
});
this.removeItemAt(indexes);
removeItemAt: function (index) {
this.buttons[index].destroy();
this.layouts.removeItemAt(index);
},
populate: function (items) {
items = items || [];
this.options.items = items;
this.empty();
this.options.items = items;
this.buttons = this._btnsCreator.apply(this, arguments);
items = this._packageItems(items, this._packageBtns(this.buttons));
if (this._isSimpleLayout()) {
items = this._packageSimpleItems(this.buttons);
} else {
items = this._packageItems(items, this._packageBtns(this.buttons));
}
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
},
@ -3893,8 +3893,8 @@ BI.shortcut("bi.loader", BI.Loader);/**
*/
BI.Navigation = BI.inherit(BI.Widget, {
_defaultConfig: function(){
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this,arguments), {
_defaultConfig: function () {
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), {
direction: "bottom",//top, bottom, left, right, custom
logic: {
dynamic: false
@ -3905,7 +3905,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
items: [],
layouts: []
},
cardCreator: function(v){
cardCreator: function (v) {
return BI.createWidget();
},
@ -3914,8 +3914,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
})
},
_init: function(){
BI.Navigation.superclass._init.apply(this,arguments);
render: function () {
var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {};
@ -3933,10 +3932,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
new BI.ShowListener({
eventObj: this.tab,
cardLayout: this.layout,
cardNameCreator: function(v){
cardNameCreator: function (v) {
return self.showIndex + v;
},
cardCreator: function(v){
cardCreator: function (v) {
var card = o.cardCreator(v);
self.cardMap[v] = card;
return card;
@ -3944,37 +3943,41 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
if(o.defaultShowIndex !== false){
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
},
afterCardCreated: function(v){
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function(type, value, obj){
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if(type === BI.Events.CLICK) {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function(v){
afterCardShow: function (v) {
this.showIndex = v;
this.options.afterCardShow.apply(this, arguments);
},
populate: function(){
populate: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.populate.apply(card, arguments);
}
},
setSelect: function(v){
setSelect: function (v) {
this.showIndex = v;
if(!this.layout.isCardExisted(v)){
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
@ -3984,12 +3987,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
BI.nextTick(BI.bind(this.afterCardShow, this, v));
},
getSelect: function(){
getSelect: function () {
return this.showIndex;
},
getSelectedCard: function(){
if(BI.isKey(this.showIndex)){
getSelectedCard: function () {
if (BI.isKey(this.showIndex)) {
return this.cardMap[this.showIndex];
}
},
@ -3997,9 +4000,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
setValue: function(v){
setValue: function (v) {
var card = this.layout.getShowingCard();
if(card){
if (card) {
card.setValue(v);
}
},
@ -4007,19 +4010,19 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
getValue: function(){
getValue: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.getValue();
}
},
empty: function(){
empty: function () {
this.layout.deleteAllCard();
this.cardMap = {};
},
destroy: function(){
destroy: function () {
BI.Navigation.superclass.destroy.apply(this, arguments);
}
});
@ -4615,7 +4618,7 @@ BI.Tab = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();

2
bi/case.js

@ -8384,7 +8384,7 @@ BI.SortList = BI.inherit(BI.Widget, {
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
type: "bi.label",
type: "bi.layout",
cls: "bi-sortable-holder",
height: $currentItem.outerHeight()
});

267
bi/core.js

@ -4587,14 +4587,6 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight();
},
setElement: function (widget) {
if (widget == this) {
return;
}
this.element = BI.isWidget(widget) ? widget.element : $(widget);
return this;
},
setEnable: function (enable) {
if (enable === true) {
this.options.disabled = false;
@ -4676,8 +4668,17 @@ BI.Widget = BI.inherit(BI.OB, {
return widget;
},
removeWidget: function (name) {
delete this._children[name];
removeWidget: function (nameOrWidget) {
var self = this;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, widget) {
if (widget === nameOrWidget) {
delete self._children[name];
}
})
} else {
delete this._children[nameOrWidget];
}
},
hasWidget: function (name) {
@ -4751,6 +4752,13 @@ BI.Widget = BI.inherit(BI.OB, {
this.setVisible(true);
},
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
},
empty: function () {
BI.each(this._children, function (i, widget) {
widget._unMount();
@ -5383,7 +5391,6 @@ BI.View = BI.inherit(BI.V, {
options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this;
}
this._cardLayouts[key] = BI.createWidget({
@ -5741,6 +5748,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts;
delete this._cards;
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
},
@ -11211,7 +11219,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w;
if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) {
if (child === w) {
@ -11219,6 +11226,7 @@ BI.Layout = BI.inherit(BI.Widget, {
}
});
});
this.addWidget(this._getChildName(i), w);
} else {
w = this.getWidgetByName(this._getChildName(i));
}
@ -11489,6 +11497,23 @@ BI.Layout = BI.inherit(BI.Widget, {
});
},
removeWidget: function (nameOrWidget) {
var removeIndex;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeIndex = name;
}
})
} else {
removeIndex = nameOrWidget;
}
if (removeIndex) {
this.options.items.splice(removeIndex, 1);
}
BI.Layout.superclass.removeWidget.apply(this, arguments);
},
empty: function () {
BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = [];
@ -13273,27 +13298,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () {
// console.log("default布局不需要resize");
},
stroke: function (items) {
var self = this;
var self = this, o = this.options;
this.showIndex = void 0;
BI.each(items, function (i, item) {
if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () {
delete self._children[self._getCardName(item.cardName)];
var index = BI.findKey(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
o.items.splice(index, 1);
}
});
self.addWidget(item.cardName, w);
} else {
var w = self.getWidgetByName(self._getCardName(item.cardName));
var w = self.getWidgetByName(item.cardName);
}
w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false);
@ -13304,6 +13330,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () {
},
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount();
@ -13311,53 +13342,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
isCardExisted: function (cardName) {
return this.hasWidget(this._getCardName(cardName));
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
});
},
getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
return this._children[this._getCardName(cardName)];
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
return;
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName;
});
this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName));
delete this._children[this._getCardName(cardName)];
child.destroy();
if (index > -1) {
this.options.items.splice(index, 1);
}
var child = this._children[cardName];
child && child.destroy();
},
addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
}
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"})
.appendTo(this.element);
widget.element.css({
"position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible();
this.addWidget(this._getCardName(cardName), widget);
this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget;
},
showCardByName: function (name, action, callback) {
var self = this;
//name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name));
var exist = this.isCardExisted(name);
if (this.showIndex != null) {
this.lastShowIndex = this.showIndex;
}
this.showIndex = this._getCardName(name);
this.showIndex = name;
var flag = false;
BI.each(this._children, function (i, el) {
if (self._getCardName(name) != i) {
BI.each(this.options.items, function (i, item) {
var el = self._children[item.cardName];
if (name != item.cardName) {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else {
@ -13369,8 +13409,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () {
var self = this;
this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) {
el.setVisible(self.showIndex == i);
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i);
})
},
@ -13404,15 +13444,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
hideAllCard: function () {
BI.each(this._children, function (i, el) {
el.invisible();
var self = this;
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
});
},
isAllCardHide: function () {
var self = this;
var flag = true;
BI.some(this._children, function (i, el) {
if (el.isVisible()) {
BI.some(this.options.items, function (i, item) {
if (self._children[item.cardName].isVisible()) {
flag = false;
return false;
}
@ -15254,147 +15296,30 @@ BI.ActionFactory = {
return new action(options);
}
}/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.EffectShowAction
* @extends BI.Action
*/
BI.EffectShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.EffectShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.EffectShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
src = src || this.options.src ,tar = tar || this.options.tar || "body";
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: tar.element.width(),
height: tar.element.height(),
top: tar.element.offset().top,
left: tar.element.offset().left
});
src.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
tar && tar.element.show(0, callback);
})
} else {
tar && tar.element.show(0, callback);
}
},
actionBack: function(tar, src, callback){
src = src || this.options.src || $("body"),tar = tar || this.options.tar;
tar && tar.element.hide();
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: src.element.width(),
height: src.element.height(),
top: src.element.offset().top,
left: src.element.offset().left
});
tar.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
callback && callback();
})
} else {
callback && callback();
}
}
});/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.ShowAction
* @extends BI.Action
*/
BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.ShowAction.superclass._init.apply(this, arguments);
},
actionPerformed: function(src, tar, callback){
tar = tar || this.options.tar;
tar && tar.element.show(0, callback);
},
actionBack: function(tar, src, callback){
tar = tar || this.options.tar;
tar.element.hide(0, callback);
}
});/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.ScaleShowAction
* @extends BI.Action
* @abstract
*/
BI.ScaleShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ScaleShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.ScaleShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.show("scale", {percent:110}, 200, callback) : tar.element.show(0,callback);
tar.setVisible(true);
callback && callback();
},
actionBack : function(tar, src, callback){
actionBack: function (tar, src, callback) {
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.hide("scale", {percent:0}, 200, callback) : tar.element.hide(0,callback);
tar.setVisible(false);
callback && callback();
}
});/**
* @class BI.FloatSection

8
bi/widget.js

@ -3020,7 +3020,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_moveElement: function (layout, l, x, y, isUserAction) {
var self = this;
if (l.static) {
if (l._static) {
return layout;
}
@ -3053,7 +3053,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
continue;
}
if (collision.static) {
if (collision._static) {
layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction);
} else {
layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction);
@ -3146,7 +3146,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
for (var i = 0, len = sorted.length; i < len; i++) {
var l = sorted[i];
if (!l.static) {
if (!l._static) {
l = this._compactItem(compareWith, l, verticalCompact);
compareWith.push(l);
@ -3160,7 +3160,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
return out;
function getStatics(layout) {
return BI.filter(layout, function (i, l) {
return l.static;
return l._static;
});
}
},

58
demo/js/core/abstract/demo.button_group.js

@ -3,21 +3,59 @@ Demo.Func = BI.inherit(BI.Widget, {
baseCls: "demo-func"
},
render: function () {
var ref;
return {
type: "bi.button_group",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE,
layouts: [{
type: "bi.vertical"
}, {
type: "bi.center_adapt",
}],
type: "bi.vertical",
items: [{
type: "bi.label",
text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)"
type: "bi.button_group",
ref: function (_ref) {
ref = _ref;
},
chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE,
layouts: [{
type: "bi.vertical",
items: [{
type: "bi.vtape",
height: 200,
}]
}],
items: [{
el: {
type: "bi.label",
text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)"
},
height: 150,
}, {
el: {
type: "bi.button",
text: "1"
}
}]
}, {
type: "bi.button",
text: "1"
text: "populate",
handler: function () {
ref.populate([{
el: {
type: "bi.label",
text: "1"
},
height: 50
}, {
el: {
type: "bi.button",
text: "2"
},
height: 50
}, {
el: {
type: "bi.label",
text: "3"
}
}])
}
}]
}
}
});

113
dist/base.js vendored

@ -1034,7 +1034,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], {
@ -1049,6 +1048,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return btns;
},
_packageSimpleItems: function (btns) {
var o = this.options;
return BI.map(o.items, function (i, item) {
if (BI.stripEL(item) === item) {
return btns[i];
}
return BI.extend({}, item, {
el: btns[i]
})
})
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
@ -1064,6 +1075,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout;
},
//如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1
},
doBehavior: function () {
var args = Array.prototype.slice.call(arguments);
@ -1078,9 +1095,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.prependItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns);
return;
}
@ -1095,8 +1110,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.addItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns);
return;
}
@ -1105,36 +1119,22 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.layouts.addItems(this._packageLayout(items).items);
},
removeItemAt: function (indexes) {
var self = this;
indexes = BI.isArray(indexes) ? indexes : [indexes];
var buttons = [];
BI.each(indexes, function (i, index) {
buttons.push(self.buttons[index]);
});
BI.each(buttons, function (i, btn) {
btn && btn.destroy();
})
},
removeItems: function (v) {
v = BI.isArray(v) ? v : [v];
var indexes = [];
BI.each(this.buttons, function (i, item) {
if (BI.deepContains(v, item.getValue())) {
indexes.push(i);
}
});
this.removeItemAt(indexes);
removeItemAt: function (index) {
this.buttons[index].destroy();
this.layouts.removeItemAt(index);
},
populate: function (items) {
items = items || [];
this.options.items = items;
this.empty();
this.options.items = items;
this.buttons = this._btnsCreator.apply(this, arguments);
items = this._packageItems(items, this._packageBtns(this.buttons));
if (this._isSimpleLayout()) {
items = this._packageSimpleItems(this.buttons);
} else {
items = this._packageItems(items, this._packageBtns(this.buttons));
}
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
},
@ -3893,8 +3893,8 @@ BI.shortcut("bi.loader", BI.Loader);/**
*/
BI.Navigation = BI.inherit(BI.Widget, {
_defaultConfig: function(){
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this,arguments), {
_defaultConfig: function () {
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), {
direction: "bottom",//top, bottom, left, right, custom
logic: {
dynamic: false
@ -3905,7 +3905,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
items: [],
layouts: []
},
cardCreator: function(v){
cardCreator: function (v) {
return BI.createWidget();
},
@ -3914,8 +3914,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
})
},
_init: function(){
BI.Navigation.superclass._init.apply(this,arguments);
render: function () {
var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {};
@ -3933,10 +3932,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
new BI.ShowListener({
eventObj: this.tab,
cardLayout: this.layout,
cardNameCreator: function(v){
cardNameCreator: function (v) {
return self.showIndex + v;
},
cardCreator: function(v){
cardCreator: function (v) {
var card = o.cardCreator(v);
self.cardMap[v] = card;
return card;
@ -3944,37 +3943,41 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
if(o.defaultShowIndex !== false){
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
},
afterCardCreated: function(v){
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function(type, value, obj){
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if(type === BI.Events.CLICK) {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function(v){
afterCardShow: function (v) {
this.showIndex = v;
this.options.afterCardShow.apply(this, arguments);
},
populate: function(){
populate: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.populate.apply(card, arguments);
}
},
setSelect: function(v){
setSelect: function (v) {
this.showIndex = v;
if(!this.layout.isCardExisted(v)){
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
@ -3984,12 +3987,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
BI.nextTick(BI.bind(this.afterCardShow, this, v));
},
getSelect: function(){
getSelect: function () {
return this.showIndex;
},
getSelectedCard: function(){
if(BI.isKey(this.showIndex)){
getSelectedCard: function () {
if (BI.isKey(this.showIndex)) {
return this.cardMap[this.showIndex];
}
},
@ -3997,9 +4000,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
setValue: function(v){
setValue: function (v) {
var card = this.layout.getShowingCard();
if(card){
if (card) {
card.setValue(v);
}
},
@ -4007,19 +4010,19 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
getValue: function(){
getValue: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.getValue();
}
},
empty: function(){
empty: function () {
this.layout.deleteAllCard();
this.cardMap = {};
},
destroy: function(){
destroy: function () {
BI.Navigation.superclass.destroy.apply(this, arguments);
}
});
@ -4615,7 +4618,7 @@ BI.Tab = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();

2
dist/case.js vendored

@ -8384,7 +8384,7 @@ BI.SortList = BI.inherit(BI.Widget, {
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
type: "bi.label",
type: "bi.layout",
cls: "bi-sortable-holder",
height: $currentItem.outerHeight()
});

267
dist/core.js vendored

@ -14508,14 +14508,6 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight();
},
setElement: function (widget) {
if (widget == this) {
return;
}
this.element = BI.isWidget(widget) ? widget.element : $(widget);
return this;
},
setEnable: function (enable) {
if (enable === true) {
this.options.disabled = false;
@ -14597,8 +14589,17 @@ BI.Widget = BI.inherit(BI.OB, {
return widget;
},
removeWidget: function (name) {
delete this._children[name];
removeWidget: function (nameOrWidget) {
var self = this;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, widget) {
if (widget === nameOrWidget) {
delete self._children[name];
}
})
} else {
delete this._children[nameOrWidget];
}
},
hasWidget: function (name) {
@ -14672,6 +14673,13 @@ BI.Widget = BI.inherit(BI.OB, {
this.setVisible(true);
},
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
},
empty: function () {
BI.each(this._children, function (i, widget) {
widget._unMount();
@ -15304,7 +15312,6 @@ BI.View = BI.inherit(BI.V, {
options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this;
}
this._cardLayouts[key] = BI.createWidget({
@ -15662,6 +15669,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts;
delete this._cards;
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
},
@ -19353,7 +19361,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w;
if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) {
if (child === w) {
@ -19361,6 +19368,7 @@ BI.Layout = BI.inherit(BI.Widget, {
}
});
});
this.addWidget(this._getChildName(i), w);
} else {
w = this.getWidgetByName(this._getChildName(i));
}
@ -19631,6 +19639,23 @@ BI.Layout = BI.inherit(BI.Widget, {
});
},
removeWidget: function (nameOrWidget) {
var removeIndex;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeIndex = name;
}
})
} else {
removeIndex = nameOrWidget;
}
if (removeIndex) {
this.options.items.splice(removeIndex, 1);
}
BI.Layout.superclass.removeWidget.apply(this, arguments);
},
empty: function () {
BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = [];
@ -19690,147 +19715,30 @@ BI.ActionFactory = {
return new action(options);
}
}/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.EffectShowAction
* @extends BI.Action
*/
BI.EffectShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.EffectShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.EffectShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
src = src || this.options.src ,tar = tar || this.options.tar || "body";
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: tar.element.width(),
height: tar.element.height(),
top: tar.element.offset().top,
left: tar.element.offset().left
});
src.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
tar && tar.element.show(0, callback);
})
} else {
tar && tar.element.show(0, callback);
}
},
actionBack: function(tar, src, callback){
src = src || this.options.src || $("body"),tar = tar || this.options.tar;
tar && tar.element.hide();
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: src.element.width(),
height: src.element.height(),
top: src.element.offset().top,
left: src.element.offset().left
});
tar.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
callback && callback();
})
} else {
callback && callback();
}
}
});/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.ShowAction
* @extends BI.Action
*/
BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.ShowAction.superclass._init.apply(this, arguments);
},
actionPerformed: function(src, tar, callback){
actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar;
tar && tar.element.show(0, callback);
tar.setVisible(true);
callback && callback();
},
actionBack: function(tar, src, callback){
actionBack: function (tar, src, callback) {
tar = tar || this.options.tar;
tar.element.hide(0, callback);
}
});/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.ScaleShowAction
* @extends BI.Action
* @abstract
*/
BI.ScaleShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ScaleShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.ScaleShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.show("scale", {percent:110}, 200, callback) : tar.element.show(0,callback);
},
actionBack : function(tar, src, callback){
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.hide("scale", {percent:0}, 200, callback) : tar.element.hide(0,callback);
tar.setVisible(false);
callback && callback();
}
});/**
* @class BI.FloatSection
@ -26804,27 +26712,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () {
// console.log("default布局不需要resize");
},
stroke: function (items) {
var self = this;
var self = this, o = this.options;
this.showIndex = void 0;
BI.each(items, function (i, item) {
if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () {
delete self._children[self._getCardName(item.cardName)];
var index = BI.findKey(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
o.items.splice(index, 1);
}
});
self.addWidget(item.cardName, w);
} else {
var w = self.getWidgetByName(self._getCardName(item.cardName));
var w = self.getWidgetByName(item.cardName);
}
w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false);
@ -26835,6 +26744,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () {
},
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount();
@ -26842,53 +26756,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
isCardExisted: function (cardName) {
return this.hasWidget(this._getCardName(cardName));
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
});
},
getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
return this._children[this._getCardName(cardName)];
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
return;
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName;
});
this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName));
delete this._children[this._getCardName(cardName)];
child.destroy();
if (index > -1) {
this.options.items.splice(index, 1);
}
var child = this._children[cardName];
child && child.destroy();
},
addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
}
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"})
.appendTo(this.element);
widget.element.css({
"position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible();
this.addWidget(this._getCardName(cardName), widget);
this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget;
},
showCardByName: function (name, action, callback) {
var self = this;
//name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name));
var exist = this.isCardExisted(name);
if (this.showIndex != null) {
this.lastShowIndex = this.showIndex;
}
this.showIndex = this._getCardName(name);
this.showIndex = name;
var flag = false;
BI.each(this._children, function (i, el) {
if (self._getCardName(name) != i) {
BI.each(this.options.items, function (i, item) {
var el = self._children[item.cardName];
if (name != item.cardName) {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else {
@ -26900,8 +26823,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () {
var self = this;
this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) {
el.setVisible(self.showIndex == i);
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i);
})
},
@ -26935,15 +26858,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
hideAllCard: function () {
BI.each(this._children, function (i, el) {
el.invisible();
var self = this;
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
});
},
isAllCardHide: function () {
var self = this;
var flag = true;
BI.some(this._children, function (i, el) {
if (el.isVisible()) {
BI.some(this.options.items, function (i, item) {
if (self._children[item.cardName].isVisible()) {
flag = false;
return false;
}

BIN
dist/icon/loading.gif vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

14
dist/resource.css vendored

@ -6353,6 +6353,9 @@ textarea::-webkit-scrollbar-thumb {
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.farbtastic {
position: relative;
}
@ -6373,19 +6376,19 @@ textarea::-webkit-scrollbar-thumb {
height: 101px;
}
.farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat;
background: url("third/farbtastic/wheel.png") no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat;
background: url("third/farbtastic/mask.png") no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(third/farbtastic/marker.png) no-repeat;
background: url("third/farbtastic/marker.png") no-repeat;
}
/*-------------------------------------
zTree Style
@ -6396,6 +6399,9 @@ email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/
-------------------------------------*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.ztree * {
padding: 0;
margin: 0;
@ -6418,7 +6424,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px;
}
.ztree li ul.line {
background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y;
background: url("icon/tree-vertical-line-1.png") 0 0 repeat-y;
}
.ztree li a {
padding: 1px 3px 0 0;

8
dist/widget.js vendored

@ -3020,7 +3020,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_moveElement: function (layout, l, x, y, isUserAction) {
var self = this;
if (l.static) {
if (l._static) {
return layout;
}
@ -3053,7 +3053,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
continue;
}
if (collision.static) {
if (collision._static) {
layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction);
} else {
layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction);
@ -3146,7 +3146,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
for (var i = 0, len = sorted.length; i < len; i++) {
var l = sorted[i];
if (!l.static) {
if (!l._static) {
l = this._compactItem(compareWith, l, verticalCompact);
compareWith.push(l);
@ -3160,7 +3160,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
return out;
function getStatics(layout) {
return BI.filter(layout, function (i, l) {
return l.static;
return l._static;
});
}
},

58
src/base/combination/group.button.js

@ -71,7 +71,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], {
@ -86,6 +85,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return btns;
},
_packageSimpleItems: function (btns) {
var o = this.options;
return BI.map(o.items, function (i, item) {
if (BI.stripEL(item) === item) {
return btns[i];
}
return BI.extend({}, item, {
el: btns[i]
})
})
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
@ -101,6 +112,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout;
},
//如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1
},
doBehavior: function () {
var args = Array.prototype.slice.call(arguments);
@ -115,9 +132,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.prependItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns);
return;
}
@ -132,8 +147,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.addItems) {
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns);
return;
}
@ -142,36 +156,22 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.layouts.addItems(this._packageLayout(items).items);
},
removeItemAt: function (indexes) {
var self = this;
indexes = BI.isArray(indexes) ? indexes : [indexes];
var buttons = [];
BI.each(indexes, function (i, index) {
buttons.push(self.buttons[index]);
});
BI.each(buttons, function (i, btn) {
btn && btn.destroy();
})
},
removeItems: function (v) {
v = BI.isArray(v) ? v : [v];
var indexes = [];
BI.each(this.buttons, function (i, item) {
if (BI.deepContains(v, item.getValue())) {
indexes.push(i);
}
});
this.removeItemAt(indexes);
removeItemAt: function (index) {
this.buttons[index].destroy();
this.layouts.removeItemAt(index);
},
populate: function (items) {
items = items || [];
this.options.items = items;
this.empty();
this.options.items = items;
this.buttons = this._btnsCreator.apply(this, arguments);
items = this._packageItems(items, this._packageBtns(this.buttons));
if (this._isSimpleLayout()) {
items = this._packageSimpleItems(this.buttons);
} else {
items = this._packageItems(items, this._packageBtns(this.buttons));
}
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
},

53
src/base/combination/navigation.js

@ -3,8 +3,8 @@
*/
BI.Navigation = BI.inherit(BI.Widget, {
_defaultConfig: function(){
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this,arguments), {
_defaultConfig: function () {
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), {
direction: "bottom",//top, bottom, left, right, custom
logic: {
dynamic: false
@ -15,7 +15,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
items: [],
layouts: []
},
cardCreator: function(v){
cardCreator: function (v) {
return BI.createWidget();
},
@ -24,8 +24,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
})
},
_init: function(){
BI.Navigation.superclass._init.apply(this,arguments);
render: function () {
var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {};
@ -43,10 +42,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
new BI.ShowListener({
eventObj: this.tab,
cardLayout: this.layout,
cardNameCreator: function(v){
cardNameCreator: function (v) {
return self.showIndex + v;
},
cardCreator: function(v){
cardCreator: function (v) {
var card = o.cardCreator(v);
self.cardMap[v] = card;
return card;
@ -54,37 +53,41 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
if(o.defaultShowIndex !== false){
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
},
afterCardCreated: function(v){
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function(type, value, obj){
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if(type === BI.Events.CLICK) {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function(v){
afterCardShow: function (v) {
this.showIndex = v;
this.options.afterCardShow.apply(this, arguments);
},
populate: function(){
populate: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.populate.apply(card, arguments);
}
},
setSelect: function(v){
setSelect: function (v) {
this.showIndex = v;
if(!this.layout.isCardExisted(v)){
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
@ -94,12 +97,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
BI.nextTick(BI.bind(this.afterCardShow, this, v));
},
getSelect: function(){
getSelect: function () {
return this.showIndex;
},
getSelectedCard: function(){
if(BI.isKey(this.showIndex)){
getSelectedCard: function () {
if (BI.isKey(this.showIndex)) {
return this.cardMap[this.showIndex];
}
},
@ -107,9 +110,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
setValue: function(v){
setValue: function (v) {
var card = this.layout.getShowingCard();
if(card){
if (card) {
card.setValue(v);
}
},
@ -117,19 +120,19 @@ BI.Navigation = BI.inherit(BI.Widget, {
/**
* @override
*/
getValue: function(){
getValue: function () {
var card = this.layout.getShowingCard();
if(card){
if (card) {
return card.getValue();
}
},
empty: function(){
empty: function () {
this.layout.deleteAllCard();
this.cardMap = {};
},
destroy: function(){
destroy: function () {
BI.Navigation.superclass.destroy.apply(this, arguments);
}
});

2
src/base/combination/tab.js

@ -10,7 +10,7 @@ BI.Tab = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();

2
src/case/loader/sort.list.js

@ -65,7 +65,7 @@ BI.SortList = BI.inherit(BI.Widget, {
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
type: "bi.label",
type: "bi.layout",
cls: "bi-sortable-holder",
height: $currentItem.outerHeight()
});

88
src/core/action/action.show.effect.js

@ -1,88 +0,0 @@
/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.EffectShowAction
* @extends BI.Action
*/
BI.EffectShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.EffectShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.EffectShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
src = src || this.options.src ,tar = tar || this.options.tar || "body";
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: tar.element.width(),
height: tar.element.height(),
top: tar.element.offset().top,
left: tar.element.offset().left
});
src.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
tar && tar.element.show(0, callback);
})
} else {
tar && tar.element.show(0, callback);
}
},
actionBack: function(tar, src, callback){
src = src || this.options.src || $("body"),tar = tar || this.options.tar;
tar && tar.element.hide();
if(this._checkBrowser()) {
var transferEl = BI.createWidget({
type: "bi.layout",
cls: "bi-transfer-temp-el"
})
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [transferEl]
})
transferEl.element.css({
width: src.element.width(),
height: src.element.height(),
top: src.element.offset().top,
left: src.element.offset().left
});
tar.element.effect("transfer", {
to: transferEl.element,
className: "ui-effects-transfer"
}, 400, function () {
transferEl.destroy();
callback && callback();
})
} else {
callback && callback();
}
}
});

17
src/core/action/action.show.js

@ -5,22 +5,23 @@
* @extends BI.Action
*/
BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.ShowAction.superclass._init.apply(this, arguments);
},
actionPerformed: function(src, tar, callback){
actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar;
tar && tar.element.show(0, callback);
tar.setVisible(true);
callback && callback();
},
actionBack: function(tar, src, callback){
actionBack: function (tar, src, callback) {
tar = tar || this.options.tar;
tar.element.hide(0, callback);
tar.setVisible(false);
callback && callback();
}
});

32
src/core/action/action.show.scale.js

@ -1,32 +0,0 @@
/**
* guy
* 由一个元素切换到另一个元素的行为
* @class BI.ScaleShowAction
* @extends BI.Action
* @abstract
*/
BI.ScaleShowAction = BI.inherit(BI.Action, {
_defaultConfig: function() {
return BI.extend(BI.ScaleShowAction.superclass._defaultConfig.apply(this, arguments), {
});
},
_init : function() {
BI.ScaleShowAction.superclass._init.apply(this, arguments);
},
_checkBrowser: function(){
return false;
// return !(BI.isFireFox() && parseInt($.browser.version) < 10);
},
actionPerformed: function(src, tar, callback){
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.show("scale", {percent:110}, 200, callback) : tar.element.show(0,callback);
},
actionBack : function(tar, src, callback){
tar = tar || this.options.tar;
this._checkBrowser() ? tar.element.hide("scale", {percent:0}, 200, callback) : tar.element.hide(0,callback);
}
});

2
src/core/view.js

@ -151,7 +151,6 @@ BI.View = BI.inherit(BI.V, {
options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this;
}
this._cardLayouts[key] = BI.createWidget({
@ -509,6 +508,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts;
delete this._cards;
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
},

28
src/core/widget.js

@ -209,14 +209,6 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight();
},
setElement: function (widget) {
if (widget == this) {
return;
}
this.element = BI.isWidget(widget) ? widget.element : $(widget);
return this;
},
setEnable: function (enable) {
if (enable === true) {
this.options.disabled = false;
@ -298,8 +290,17 @@ BI.Widget = BI.inherit(BI.OB, {
return widget;
},
removeWidget: function (name) {
delete this._children[name];
removeWidget: function (nameOrWidget) {
var self = this;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, widget) {
if (widget === nameOrWidget) {
delete self._children[name];
}
})
} else {
delete this._children[nameOrWidget];
}
},
hasWidget: function (name) {
@ -373,6 +374,13 @@ BI.Widget = BI.inherit(BI.OB, {
this.setVisible(true);
},
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
},
empty: function () {
BI.each(this._children, function (i, widget) {
widget._unMount();

19
src/core/wrapper/layout.js

@ -71,7 +71,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w;
if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) {
if (child === w) {
@ -79,6 +78,7 @@ BI.Layout = BI.inherit(BI.Widget, {
}
});
});
this.addWidget(this._getChildName(i), w);
} else {
w = this.getWidgetByName(this._getChildName(i));
}
@ -349,6 +349,23 @@ BI.Layout = BI.inherit(BI.Widget, {
});
},
removeWidget: function (nameOrWidget) {
var removeIndex;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeIndex = name;
}
})
} else {
removeIndex = nameOrWidget;
}
if (removeIndex) {
this.options.items.splice(removeIndex, 1);
}
BI.Layout.superclass.removeWidget.apply(this, arguments);
},
empty: function () {
BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = [];

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

@ -18,27 +18,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () {
// console.log("default布局不需要resize");
},
stroke: function (items) {
var self = this;
var self = this, o = this.options;
this.showIndex = void 0;
BI.each(items, function (i, item) {
if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () {
delete self._children[self._getCardName(item.cardName)];
var index = BI.findKey(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
o.items.splice(index, 1);
}
});
self.addWidget(item.cardName, w);
} else {
var w = self.getWidgetByName(self._getCardName(item.cardName));
var w = self.getWidgetByName(item.cardName);
}
w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false);
@ -49,6 +50,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () {
},
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount();
@ -56,53 +62,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
isCardExisted: function (cardName) {
return this.hasWidget(this._getCardName(cardName));
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
});
},
getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
return this._children[this._getCardName(cardName)];
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) {
return;
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName;
});
this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName));
delete this._children[this._getCardName(cardName)];
child.destroy();
if (index > -1) {
this.options.items.splice(index, 1);
}
var child = this._children[cardName];
child && child.destroy();
},
addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
}
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"})
.appendTo(this.element);
widget.element.css({
"position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible();
this.addWidget(this._getCardName(cardName), widget);
this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget;
},
showCardByName: function (name, action, callback) {
var self = this;
//name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name));
var exist = this.isCardExisted(name);
if (this.showIndex != null) {
this.lastShowIndex = this.showIndex;
}
this.showIndex = this._getCardName(name);
this.showIndex = name;
var flag = false;
BI.each(this._children, function (i, el) {
if (self._getCardName(name) != i) {
BI.each(this.options.items, function (i, item) {
var el = self._children[item.cardName];
if (name != item.cardName) {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else {
@ -114,8 +129,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () {
var self = this;
this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) {
el.setVisible(self.showIndex == i);
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i);
})
},
@ -149,15 +164,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
hideAllCard: function () {
BI.each(this._children, function (i, el) {
el.invisible();
var self = this;
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
});
},
isAllCardHide: function () {
var self = this;
var flag = true;
BI.some(this._children, function (i, el) {
if (el.isVisible()) {
BI.some(this.options.items, function (i, item) {
if (self._children[item.cardName].isVisible()) {
flag = false;
return false;
}

9
src/css/resource/third/farbtastic/farbtastic.css

@ -16,6 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.farbtastic {
position: relative;
}
@ -36,17 +39,17 @@
height: 101px;
}
.farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat;
background: url("third/farbtastic/wheel.png") no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat;
background: url("third/farbtastic/mask.png") no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(third/farbtastic/marker.png) no-repeat;
background: url("third/farbtastic/marker.png") no-repeat;
}

5
src/css/resource/third/ztree/zTreeStyle.css

@ -7,6 +7,9 @@ email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/
-------------------------------------*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.ztree * {
padding: 0;
margin: 0;
@ -29,7 +32,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px;
}
.ztree li ul.line {
background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y;
background: url("icon/tree-vertical-line-1.png") 0 0 repeat-y;
}
.ztree li a {
padding: 1px 3px 0 0;

8
src/less/resource/third/farbtastic/farbtastic.less

@ -16,6 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "../../../bibase";
.farbtastic {
position: relative;
}
@ -34,18 +36,18 @@
height: 101px;
}
.farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat;
background: url("@{imageUrl}third/farbtastic/wheel.png") no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat;
background: url("@{imageUrl}third/farbtastic/mask.png") no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(third/farbtastic/marker.png) no-repeat;
background: url("@{imageUrl}third/farbtastic/marker.png") no-repeat;
}

47
src/less/resource/third/ztree/zTreeStyle.less

@ -7,12 +7,13 @@ email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/
-------------------------------------*/
@import "../../../bibase";
.ztree * {padding:0; margin:0; }
.ztree {margin:0; padding:5px; }
.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(icon/tree-vertical-line-1.png) 0 0 repeat-y;}
.ztree li ul.line{ background:url("@{imageUrl}icon/tree-vertical-line-1.png") 0 0 repeat-y;}
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:24px; background-color: transparent;
text-decoration:none; vertical-align:top; display: inline-block}
@ -28,33 +29,33 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("third/ztree/img/zTreeStandard.png"); *background-image:url("third/ztree/img/zTreeStandard.gif")}
background-image:url("@{imageUrl}third/ztree/img/zTreeStandard.png"); *background-image:url("@{imageUrl}third/ztree/img/zTreeStandard.gif")}
.ztree li span.button.chk {width:16px; height:16px; margin:0 3px 0 0; cursor: auto}
.ztree li span.button.chk.checkbox_false_full {
background-image:url("icon/check-box-normal.png");
background-image:url("@{imageUrl}icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_full_focus {
background-image:url("icon/check-box-normal.png");
background-image:url("@{imageUrl}icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_part {
background-image:url("icon/half_selected.png");
background-image:url("@{imageUrl}icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_part_focus {
background-image:url("icon/half_selected.png");
background-image:url("@{imageUrl}icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
.ztree li span.button.chk.checkbox_true_full {
background-image:url("icon/check-box-active.png");
background-image:url("@{imageUrl}icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_full_focus {
background-image:url("icon/check-box-active.png");
background-image:url("@{imageUrl}icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_part {
background-image:url("icon/half_selected.png");
background-image:url("@{imageUrl}icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_part_focus {
background-image:url("icon/half_selected.png");
background-image:url("@{imageUrl}icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
@ -70,40 +71,40 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.switch {width:25px; height:25px}
.ztree li span.button.root_open{
background-image:url("icon/tree-expand-1.png");
background-image:url("@{imageUrl}icon/tree-expand-1.png");
}
.ztree li span.button.root_close{
background-image:url("icon/tree-collapse-1.png");
background-image:url("@{imageUrl}icon/tree-collapse-1.png");
}
.ztree li span.button.roots_open{
background-image:url("icon/tree-expand-2.png");
background-image:url("@{imageUrl}icon/tree-expand-2.png");
}
.ztree li span.button.roots_close{
background-image:url("icon/tree-collapse-2.png");
background-image:url("@{imageUrl}icon/tree-collapse-2.png");
}
.ztree li span.button.center_open{
background-image:url("icon/tree-expand-3.png");
background-image:url("@{imageUrl}icon/tree-expand-3.png");
}
.ztree li span.button.center_close{
background-image:url("icon/tree-collapse-3.png");
background-image:url("@{imageUrl}icon/tree-collapse-3.png");
}
.ztree li span.button.bottom_open{
background-image:url("icon/tree-expand-4.png");
background-image:url("@{imageUrl}icon/tree-expand-4.png");
}
.ztree li span.button.bottom_close{
background-image:url("icon/tree-collapse-4.png");
background-image:url("@{imageUrl}icon/tree-collapse-4.png");
}
.ztree li span.button.noline_open{background-position:-92px -72px}
.ztree li span.button.noline_close{background-position:-74px -72px}
.ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{
background-image:url("icon/tree-vertical-line-2.png");
background-image:url("@{imageUrl}icon/tree-vertical-line-2.png");
}
.ztree li span.button.center_docu{
background-image:url("icon/tree-vertical-line-3.png");
background-image:url("@{imageUrl}icon/tree-vertical-line-3.png");
}
.ztree li span.button.bottom_docu{
background-image:url("icon/tree-vertical-line-4.png");
background-image:url("@{imageUrl}icon/tree-vertical-line-4.png");
}
.ztree li span.button.noline_docu{ background:none;}
@ -113,13 +114,13 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("@{imageUrl}third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-position:-110px -80px; background-image:url("third/ztree/img/zTreeStandard.png"); *background-image:url("third/ztree/img/zTreeStandard.gif")}
background-position:-110px -80px; background-image:url("@{imageUrl}third/ztree/img/zTreeStandard.png"); *background-image:url("@{imageUrl}third/ztree/img/zTreeStandard.gif")}
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}

8
src/widget/arrangement/arrangement.js

@ -2083,7 +2083,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_moveElement: function (layout, l, x, y, isUserAction) {
var self = this;
if (l.static) {
if (l._static) {
return layout;
}
@ -2116,7 +2116,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
continue;
}
if (collision.static) {
if (collision._static) {
layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction);
} else {
layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction);
@ -2209,7 +2209,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
for (var i = 0, len = sorted.length; i < len; i++) {
var l = sorted[i];
if (!l.static) {
if (!l._static) {
l = this._compactItem(compareWith, l, verticalCompact);
compareWith.push(l);
@ -2223,7 +2223,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
return out;
function getStatics(layout) {
return BI.filter(layout, function (i, l) {
return l.static;
return l._static;
});
}
},

Loading…
Cancel
Save