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. 65
      bi/base.js
  2. 2
      bi/case.js
  3. 257
      bi/core.js
  4. 8
      bi/widget.js
  5. 44
      demo/js/core/abstract/demo.button_group.js
  6. 65
      dist/base.js
  7. 2
      dist/case.js
  8. 257
      dist/core.js
  9. BIN
      dist/icon/loading.gif
  10. 14
      dist/resource.css
  11. 8
      dist/widget.js
  12. 56
      src/base/combination/group.button.js
  13. 7
      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. 9
      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. 81
      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

65
bi/base.js

@ -1034,7 +1034,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) { _packageBtns: function (btns) {
var o = this.options; var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) { for (var i = o.layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) { btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], { return BI.extend({}, o.layouts[i], {
@ -1049,6 +1048,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return btns; 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) { _packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns)); return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
}, },
@ -1064,6 +1075,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout; return layout;
}, },
//如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1
},
doBehavior: function () { doBehavior: function () {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -1078,9 +1095,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments); var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons); this.buttons = BI.concat(btns, this.buttons);
//如果是一个简单的layout if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns); this.layouts.prependItems(btns);
return; return;
} }
@ -1095,8 +1110,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.buttons = BI.concat(this.buttons, btns); this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout //如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items) if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
&& this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns); this.layouts.addItems(btns);
return; return;
} }
@ -1105,36 +1119,22 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.layouts.addItems(this._packageLayout(items).items); this.layouts.addItems(this._packageLayout(items).items);
}, },
removeItemAt: function (indexes) { removeItemAt: function (index) {
var self = this; this.buttons[index].destroy();
indexes = BI.isArray(indexes) ? indexes : [indexes]; this.layouts.removeItemAt(index);
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);
}, },
populate: function (items) { populate: function (items) {
items = items || []; items = items || [];
this.options.items = items;
this.empty(); this.empty();
this.options.items = items;
this.buttons = this._btnsCreator.apply(this, arguments); this.buttons = this._btnsCreator.apply(this, arguments);
if (this._isSimpleLayout()) {
items = this._packageSimpleItems(this.buttons);
} else {
items = this._packageItems(items, this._packageBtns(this.buttons)); items = this._packageItems(items, this._packageBtns(this.buttons));
}
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
}, },
@ -3914,8 +3914,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
}) })
}, },
_init: function(){ render: function () {
BI.Navigation.superclass._init.apply(this,arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {}; this.cardMap = {};
@ -3944,6 +3943,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this) afterCardShow: BI.bind(this.afterCardShow, this)
}) })
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) { if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex); this.setSelect(o.defaultShowIndex);
} }
@ -4615,7 +4618,7 @@ BI.Tab = BI.inherit(BI.Widget, {
logic: { logic: {
dynamic: false dynamic: false
}, },
defaultShowIndex: 0, defaultShowIndex: false,
tab: false, tab: false,
cardCreator: function (v) { cardCreator: function (v) {
return BI.createWidget(); return BI.createWidget();

2
bi/case.js

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

257
bi/core.js

@ -4587,14 +4587,6 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight(); this._initElementHeight();
}, },
setElement: function (widget) {
if (widget == this) {
return;
}
this.element = BI.isWidget(widget) ? widget.element : $(widget);
return this;
},
setEnable: function (enable) { setEnable: function (enable) {
if (enable === true) { if (enable === true) {
this.options.disabled = false; this.options.disabled = false;
@ -4676,8 +4668,17 @@ BI.Widget = BI.inherit(BI.OB, {
return widget; return widget;
}, },
removeWidget: function (name) { removeWidget: function (nameOrWidget) {
delete this._children[name]; 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) { hasWidget: function (name) {
@ -4751,6 +4752,13 @@ BI.Widget = BI.inherit(BI.OB, {
this.setVisible(true); this.setVisible(true);
}, },
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
},
empty: function () { empty: function () {
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget._unMount(); 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)); options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) { if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName); options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this; return this;
} }
this._cardLayouts[key] = BI.createWidget({ this._cardLayouts[key] = BI.createWidget({
@ -5741,6 +5748,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed(); this.destroyed();
}, },
@ -11211,7 +11219,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -11219,6 +11226,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
}); });
this.addWidget(this._getChildName(i), w);
} else { } else {
w = this.getWidgetByName(this._getChildName(i)); 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 () { empty: function () {
BI.Layout.superclass.empty.apply(this, arguments); BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = []; this.options.items = [];
@ -13273,27 +13298,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items); this.populate(this.options.items);
}, },
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () { resize: function () {
// console.log("default布局不需要resize"); // console.log("default布局不需要resize");
}, },
stroke: function (items) { stroke: function (items) {
var self = this; var self = this, o = this.options;
this.showIndex = void 0; this.showIndex = void 0;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () { 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 { } 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.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false); w.setVisible(false);
@ -13304,6 +13330,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () { update: function () {
}, },
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) { populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments); BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -13311,53 +13342,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
isCardExisted: function (cardName) { 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) { getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist"); throw new Error("cardName is not exist");
} }
return this._children[this._getCardName(cardName)]; return this._children[cardName];
}, },
deleteCardByName: function (cardName) { deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
return; throw new Error("cardName is not exist");
} }
var index = BI.findKey(this.options.items, function (i, item) { var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName; return item.cardName == cardName;
}); });
if (index > -1) {
this.options.items.splice(index, 1); this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName)); }
delete this._children[this._getCardName(cardName)]; var child = this._children[cardName];
child.destroy(); child && child.destroy();
}, },
addCardByName: function (cardName, cardItem) { addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"}) widget.element.css({
.appendTo(this.element); "position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(this._getCardName(cardName), widget); this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget; return widget;
}, },
showCardByName: function (name, action, callback) { showCardByName: function (name, action, callback) {
var self = this; var self = this;
//name不存在的时候全部隐藏 //name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name)); var exist = this.isCardExisted(name);
if (this.showIndex != null) { if (this.showIndex != null) {
this.lastShowIndex = this.showIndex; this.lastShowIndex = this.showIndex;
} }
this.showIndex = this._getCardName(name); this.showIndex = name;
var flag = false; var flag = false;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
if (self._getCardName(name) != i) { 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(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
@ -13369,8 +13409,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () { showLastCard: function () {
var self = this; var self = this;
this.showIndex = this.lastShowIndex; this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
el.setVisible(self.showIndex == i); self._children[item.cardName].setVisible(self.showIndex == i);
}) })
}, },
@ -13404,15 +13444,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
hideAllCard: function () { hideAllCard: function () {
BI.each(this._children, function (i, el) { var self = this;
el.invisible(); BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
}); });
}, },
isAllCardHide: function () { isAllCardHide: function () {
var self = this;
var flag = true; var flag = true;
BI.some(this._children, function (i, el) { BI.some(this.options.items, function (i, item) {
if (el.isVisible()) { if (self._children[item.cardName].isVisible()) {
flag = false; flag = false;
return false; return false;
} }
@ -15254,93 +15296,6 @@ BI.ActionFactory = {
return new action(options); 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 * guy
* 由一个元素切换到另一个元素的行为 * 由一个元素切换到另一个元素的行为
* @class BI.ShowAction * @class BI.ShowAction
@ -15348,8 +15303,7 @@ BI.EffectShowAction = BI.inherit(BI.Action, {
*/ */
BI.ShowAction = BI.inherit(BI.Action, { BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
});
}, },
_init: function () { _init: function () {
@ -15358,43 +15312,14 @@ BI.ShowAction = BI.inherit(BI.Action, {
actionPerformed: function (src, tar, callback) { actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar; tar = tar || this.options.tar;
tar && tar.element.show(0, callback); tar.setVisible(true);
}, callback && 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) { actionBack: function (tar, src, callback) {
tar = tar || this.options.tar; 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 * @class BI.FloatSection

8
bi/widget.js

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

44
demo/js/core/abstract/demo.button_group.js

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

65
dist/base.js vendored

@ -1034,7 +1034,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) { _packageBtns: function (btns) {
var o = this.options; var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) { for (var i = o.layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) { btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], { return BI.extend({}, o.layouts[i], {
@ -1049,6 +1048,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return btns; 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) { _packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns)); return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
}, },
@ -1064,6 +1075,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout; return layout;
}, },
//如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1
},
doBehavior: function () { doBehavior: function () {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -1078,9 +1095,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments); var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(btns, this.buttons); this.buttons = BI.concat(btns, this.buttons);
//如果是一个简单的layout if (this._isSimpleLayout() && this.layouts && this.layouts.prependItems) {
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items)
&& this.layouts && this.layouts.prependItems) {
this.layouts.prependItems(btns); this.layouts.prependItems(btns);
return; return;
} }
@ -1095,8 +1110,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.buttons = BI.concat(this.buttons, btns); this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout //如果是一个简单的layout
if (o.layouts.length === 1 && !BI.isNotEmptyArray(o.layouts[0].items) if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
&& this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns); this.layouts.addItems(btns);
return; return;
} }
@ -1105,36 +1119,22 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
this.layouts.addItems(this._packageLayout(items).items); this.layouts.addItems(this._packageLayout(items).items);
}, },
removeItemAt: function (indexes) { removeItemAt: function (index) {
var self = this; this.buttons[index].destroy();
indexes = BI.isArray(indexes) ? indexes : [indexes]; this.layouts.removeItemAt(index);
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);
}, },
populate: function (items) { populate: function (items) {
items = items || []; items = items || [];
this.options.items = items;
this.empty(); this.empty();
this.options.items = items;
this.buttons = this._btnsCreator.apply(this, arguments); this.buttons = this._btnsCreator.apply(this, arguments);
if (this._isSimpleLayout()) {
items = this._packageSimpleItems(this.buttons);
} else {
items = this._packageItems(items, this._packageBtns(this.buttons)); items = this._packageItems(items, this._packageBtns(this.buttons));
}
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
}, },
@ -3914,8 +3914,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
}) })
}, },
_init: function(){ render: function () {
BI.Navigation.superclass._init.apply(this,arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {}; this.cardMap = {};
@ -3944,6 +3943,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this) afterCardShow: BI.bind(this.afterCardShow, this)
}) })
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) { if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex); this.setSelect(o.defaultShowIndex);
} }
@ -4615,7 +4618,7 @@ BI.Tab = BI.inherit(BI.Widget, {
logic: { logic: {
dynamic: false dynamic: false
}, },
defaultShowIndex: 0, defaultShowIndex: false,
tab: false, tab: false,
cardCreator: function (v) { cardCreator: function (v) {
return BI.createWidget(); return BI.createWidget();

2
dist/case.js vendored

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

257
dist/core.js vendored

@ -14508,14 +14508,6 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight(); this._initElementHeight();
}, },
setElement: function (widget) {
if (widget == this) {
return;
}
this.element = BI.isWidget(widget) ? widget.element : $(widget);
return this;
},
setEnable: function (enable) { setEnable: function (enable) {
if (enable === true) { if (enable === true) {
this.options.disabled = false; this.options.disabled = false;
@ -14597,8 +14589,17 @@ BI.Widget = BI.inherit(BI.OB, {
return widget; return widget;
}, },
removeWidget: function (name) { removeWidget: function (nameOrWidget) {
delete this._children[name]; 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) { hasWidget: function (name) {
@ -14672,6 +14673,13 @@ BI.Widget = BI.inherit(BI.OB, {
this.setVisible(true); this.setVisible(true);
}, },
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
},
empty: function () { empty: function () {
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget._unMount(); 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)); options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) { if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName); options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this; return this;
} }
this._cardLayouts[key] = BI.createWidget({ this._cardLayouts[key] = BI.createWidget({
@ -15662,6 +15669,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed(); this.destroyed();
}, },
@ -19353,7 +19361,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -19361,6 +19368,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
}); });
this.addWidget(this._getChildName(i), w);
} else { } else {
w = this.getWidgetByName(this._getChildName(i)); 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 () { empty: function () {
BI.Layout.superclass.empty.apply(this, arguments); BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = []; this.options.items = [];
@ -19690,93 +19715,6 @@ BI.ActionFactory = {
return new action(options); 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 * guy
* 由一个元素切换到另一个元素的行为 * 由一个元素切换到另一个元素的行为
* @class BI.ShowAction * @class BI.ShowAction
@ -19784,8 +19722,7 @@ BI.EffectShowAction = BI.inherit(BI.Action, {
*/ */
BI.ShowAction = BI.inherit(BI.Action, { BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
});
}, },
_init: function () { _init: function () {
@ -19794,43 +19731,14 @@ BI.ShowAction = BI.inherit(BI.Action, {
actionPerformed: function (src, tar, callback) { actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar; tar = tar || this.options.tar;
tar && tar.element.show(0, callback); tar.setVisible(true);
}, callback && 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) { actionBack: function (tar, src, callback) {
tar = tar || this.options.tar; 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 * @class BI.FloatSection
@ -26804,27 +26712,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items); this.populate(this.options.items);
}, },
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () { resize: function () {
// console.log("default布局不需要resize"); // console.log("default布局不需要resize");
}, },
stroke: function (items) { stroke: function (items) {
var self = this; var self = this, o = this.options;
this.showIndex = void 0; this.showIndex = void 0;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () { 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 { } 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.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false); w.setVisible(false);
@ -26835,6 +26744,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () { update: function () {
}, },
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) { populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments); BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -26842,53 +26756,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
isCardExisted: function (cardName) { 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) { getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist"); throw new Error("cardName is not exist");
} }
return this._children[this._getCardName(cardName)]; return this._children[cardName];
}, },
deleteCardByName: function (cardName) { deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
return; throw new Error("cardName is not exist");
} }
var index = BI.findKey(this.options.items, function (i, item) { var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName; return item.cardName == cardName;
}); });
if (index > -1) {
this.options.items.splice(index, 1); this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName)); }
delete this._children[this._getCardName(cardName)]; var child = this._children[cardName];
child.destroy(); child && child.destroy();
}, },
addCardByName: function (cardName, cardItem) { addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"}) widget.element.css({
.appendTo(this.element); "position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(this._getCardName(cardName), widget); this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget; return widget;
}, },
showCardByName: function (name, action, callback) { showCardByName: function (name, action, callback) {
var self = this; var self = this;
//name不存在的时候全部隐藏 //name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name)); var exist = this.isCardExisted(name);
if (this.showIndex != null) { if (this.showIndex != null) {
this.lastShowIndex = this.showIndex; this.lastShowIndex = this.showIndex;
} }
this.showIndex = this._getCardName(name); this.showIndex = name;
var flag = false; var flag = false;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
if (self._getCardName(name) != i) { 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(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
@ -26900,8 +26823,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () { showLastCard: function () {
var self = this; var self = this;
this.showIndex = this.lastShowIndex; this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
el.setVisible(self.showIndex == i); self._children[item.cardName].setVisible(self.showIndex == i);
}) })
}, },
@ -26935,15 +26858,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
hideAllCard: function () { hideAllCard: function () {
BI.each(this._children, function (i, el) { var self = this;
el.invisible(); BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
}); });
}, },
isAllCardHide: function () { isAllCardHide: function () {
var self = this;
var flag = true; var flag = true;
BI.some(this._children, function (i, el) { BI.some(this.options.items, function (i, item) {
if (el.isVisible()) { if (self._children[item.cardName].isVisible()) {
flag = false; flag = false;
return 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.farbtastic { .farbtastic {
position: relative; position: relative;
} }
@ -6373,19 +6376,19 @@ textarea::-webkit-scrollbar-thumb {
height: 101px; height: 101px;
} }
.farbtastic .wheel { .farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat; background: url("third/farbtastic/wheel.png") no-repeat;
width: 195px; width: 195px;
height: 195px; height: 195px;
} }
.farbtastic .overlay { .farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat; background: url("third/farbtastic/mask.png") no-repeat;
} }
.farbtastic .marker { .farbtastic .marker {
width: 17px; width: 17px;
height: 17px; height: 17px;
margin: -8px 0 0 -8px; margin: -8px 0 0 -8px;
overflow: hidden; overflow: hidden;
background: url(third/farbtastic/marker.png) no-repeat; background: url("third/farbtastic/marker.png") no-repeat;
} }
/*------------------------------------- /*-------------------------------------
zTree Style zTree Style
@ -6396,6 +6399,9 @@ email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.ztree * { .ztree * {
padding: 0; padding: 0;
margin: 0; margin: 0;
@ -6418,7 +6424,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px; padding: 0 0 0 18px;
} }
.ztree li ul.line { .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 { .ztree li a {
padding: 1px 3px 0 0; 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) { _moveElement: function (layout, l, x, y, isUserAction) {
var self = this; var self = this;
if (l.static) { if (l._static) {
return layout; return layout;
} }
@ -3053,7 +3053,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
continue; continue;
} }
if (collision.static) { if (collision._static) {
layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction); layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction);
} else { } else {
layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction); 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++) { for (var i = 0, len = sorted.length; i < len; i++) {
var l = sorted[i]; var l = sorted[i];
if (!l.static) { if (!l._static) {
l = this._compactItem(compareWith, l, verticalCompact); l = this._compactItem(compareWith, l, verticalCompact);
compareWith.push(l); compareWith.push(l);
@ -3160,7 +3160,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;
}); });
} }
}, },

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

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

7
src/base/combination/navigation.js

@ -24,8 +24,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
}) })
}, },
_init: function(){ render: function () {
BI.Navigation.superclass._init.apply(this,arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.cardMap = {}; this.cardMap = {};
@ -54,6 +53,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this) afterCardShow: BI.bind(this.afterCardShow, this)
}) })
},
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) { if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex); this.setSelect(o.defaultShowIndex);
} }

2
src/base/combination/tab.js

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

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

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

9
src/core/action/action.show.js

@ -6,8 +6,7 @@
*/ */
BI.ShowAction = BI.inherit(BI.Action, { BI.ShowAction = BI.inherit(BI.Action, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
});
}, },
_init: function () { _init: function () {
@ -16,11 +15,13 @@ BI.ShowAction = BI.inherit(BI.Action, {
actionPerformed: function (src, tar, callback) { actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar; 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 = 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)); options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel));
if (this._cardLayouts[key]) { if (this._cardLayouts[key]) {
options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName); options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName);
this._cardLayouts[key].setElement(vessel) && this._cardLayouts[key].resize();
return this; return this;
} }
this._cardLayouts[key] = BI.createWidget({ this._cardLayouts[key] = BI.createWidget({
@ -509,6 +508,7 @@ BI.View = BI.inherit(BI.V, {
delete this._cardLayouts; delete this._cardLayouts;
delete this._cards; delete this._cards;
this.remove(); this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed(); this.destroyed();
}, },

28
src/core/widget.js

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

19
src/core/wrapper/layout.js

@ -71,7 +71,6 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item);
this.addWidget(this._getChildName(i), w);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -79,6 +78,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
}); });
this.addWidget(this._getChildName(i), w);
} else { } else {
w = this.getWidgetByName(this._getChildName(i)); 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 () { empty: function () {
BI.Layout.superclass.empty.apply(this, arguments); BI.Layout.superclass.empty.apply(this, arguments);
this.options.items = []; this.options.items = [];

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

@ -18,27 +18,28 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items); this.populate(this.options.items);
}, },
_getCardName: function (cardName) {
return this.getName() + cardName;
},
resize: function () { resize: function () {
// console.log("default布局不需要resize"); // console.log("default布局不需要resize");
}, },
stroke: function (items) { stroke: function (items) {
var self = this; var self = this, o = this.options;
this.showIndex = void 0; this.showIndex = void 0;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (!!item) {
if (!self.hasWidget(self._getCardName(item.cardName))) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
self.addWidget(self._getCardName(item.cardName), w);
w.on(BI.Events.DESTROY, function () { 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 { } 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.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"});
w.setVisible(false); w.setVisible(false);
@ -49,6 +50,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
update: function () { update: function () {
}, },
empty: function () {
BI.CardLayout.superclass.empty.apply(this, arguments);
this.options.items = [];
},
populate: function (items) { populate: function (items) {
BI.CardLayout.superclass.populate.apply(this, arguments); BI.CardLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -56,53 +62,62 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
isCardExisted: function (cardName) { 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) { getCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist"); throw new Error("cardName is not exist");
} }
return this._children[this._getCardName(cardName)]; return this._children[cardName];
}, },
deleteCardByName: function (cardName) { deleteCardByName: function (cardName) {
if (!this.hasWidget(this._getCardName(cardName))) { if (!this.isCardExisted(cardName)) {
return; throw new Error("cardName is not exist");
} }
var index = BI.findKey(this.options.items, function (i, item) { var index = BI.findKey(this.options.items, function (i, item) {
return item.cardName == cardName; return item.cardName == cardName;
}); });
if (index > -1) {
this.options.items.splice(index, 1); this.options.items.splice(index, 1);
var child = this.getWidgetByName(this._getCardName(cardName)); }
delete this._children[this._getCardName(cardName)]; var child = this._children[cardName];
child.destroy(); child && child.destroy();
}, },
addCardByName: function (cardName, cardItem) { addCardByName: function (cardName, cardItem) {
if (this.hasWidget(this._getCardName(cardName))) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
this.options.items.push({el: cardItem, cardName: cardName});
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem);
widget.element.css({"position": "relative", "top": "0", "left": "0", "width": "100%", "height": "100%"}) widget.element.css({
.appendTo(this.element); "position": "relative",
"top": "0",
"left": "0",
"width": "100%",
"height": "100%"
}).appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(this._getCardName(cardName), widget); this.addWidget(cardName, widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget; return widget;
}, },
showCardByName: function (name, action, callback) { showCardByName: function (name, action, callback) {
var self = this; var self = this;
//name不存在的时候全部隐藏 //name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name)); var exist = this.isCardExisted(name);
if (this.showIndex != null) { if (this.showIndex != null) {
this.lastShowIndex = this.showIndex; this.lastShowIndex = this.showIndex;
} }
this.showIndex = this._getCardName(name); this.showIndex = name;
var flag = false; var flag = false;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
if (self._getCardName(name) != i) { 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(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
@ -114,8 +129,8 @@ BI.CardLayout = BI.inherit(BI.Layout, {
showLastCard: function () { showLastCard: function () {
var self = this; var self = this;
this.showIndex = this.lastShowIndex; this.showIndex = this.lastShowIndex;
BI.each(this._children, function (i, el) { BI.each(this.options.items, function (i, item) {
el.setVisible(self.showIndex == i); self._children[item.cardName].setVisible(self.showIndex == i);
}) })
}, },
@ -149,15 +164,17 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
hideAllCard: function () { hideAllCard: function () {
BI.each(this._children, function (i, el) { var self = this;
el.invisible(); BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
}); });
}, },
isAllCardHide: function () { isAllCardHide: function () {
var self = this;
var flag = true; var flag = true;
BI.some(this._children, function (i, el) { BI.some(this.options.items, function (i, item) {
if (el.isVisible()) { if (self._children[item.cardName].isVisible()) {
flag = false; flag = false;
return 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.farbtastic { .farbtastic {
position: relative; position: relative;
} }
@ -36,17 +39,17 @@
height: 101px; height: 101px;
} }
.farbtastic .wheel { .farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat; background: url("third/farbtastic/wheel.png") no-repeat;
width: 195px; width: 195px;
height: 195px; height: 195px;
} }
.farbtastic .overlay { .farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat; background: url("third/farbtastic/mask.png") no-repeat;
} }
.farbtastic .marker { .farbtastic .marker {
width: 17px; width: 17px;
height: 17px; height: 17px;
margin: -8px 0 0 -8px; margin: -8px 0 0 -8px;
overflow: hidden; 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/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.ztree * { .ztree * {
padding: 0; padding: 0;
margin: 0; margin: 0;
@ -29,7 +32,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px; padding: 0 0 0 18px;
} }
.ztree li ul.line { .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 { .ztree li a {
padding: 1px 3px 0 0; 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
@import "../../../bibase";
.farbtastic { .farbtastic {
position: relative; position: relative;
} }
@ -34,18 +36,18 @@
height: 101px; height: 101px;
} }
.farbtastic .wheel { .farbtastic .wheel {
background: url(third/farbtastic/wheel.png) no-repeat; background: url("@{imageUrl}third/farbtastic/wheel.png") no-repeat;
width: 195px; width: 195px;
height: 195px; height: 195px;
} }
.farbtastic .overlay { .farbtastic .overlay {
background: url(third/farbtastic/mask.png) no-repeat; background: url("@{imageUrl}third/farbtastic/mask.png") no-repeat;
} }
.farbtastic .marker { .farbtastic .marker {
width: 17px; width: 17px;
height: 17px; height: 17px;
margin: -8px 0 0 -8px; margin: -8px 0 0 -8px;
overflow: hidden; 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/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
@import "../../../bibase";
.ztree * {padding:0; margin:0; } .ztree * {padding:0; margin:0; }
.ztree {margin:0; padding:5px; } .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{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{ 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; .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} 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; .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; border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; 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 {width:16px; height:16px; margin:0 3px 0 0; cursor: auto}
.ztree li span.button.chk.checkbox_false_full { .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 { .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 { .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 { .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_false_disable {background-position:0 -56px}
.ztree li span.button.chk.checkbox_true_full { .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 { .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 { .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 { .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.checkbox_true_disable {background-position:-14px -56px}
.ztree li span.button.chk.radio_false_full {background-position:-28px 0} .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.switch {width:25px; height:25px}
.ztree li span.button.root_open{ .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{ .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{ .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{ .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{ .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{ .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{ .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{ .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_open{background-position:-92px -72px}
.ztree li span.button.noline_close{background-position:-74px -72px} .ztree li span.button.noline_close{background-position:-74px -72px}
.ztree li span.button.root_docu{ background:none;} .ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{ .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{ .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{ .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;} .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.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.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)} 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; 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-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)} 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} .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) { _moveElement: function (layout, l, x, y, isUserAction) {
var self = this; var self = this;
if (l.static) { if (l._static) {
return layout; return layout;
} }
@ -2116,7 +2116,7 @@ BI.Arrangement = BI.inherit(BI.Widget, {
continue; continue;
} }
if (collision.static) { if (collision._static) {
layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction); layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction);
} else { } else {
layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction); 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++) { for (var i = 0, len = sorted.length; i < len; i++) {
var l = sorted[i]; var l = sorted[i];
if (!l.static) { if (!l._static) {
l = this._compactItem(compareWith, l, verticalCompact); l = this._compactItem(compareWith, l, verticalCompact);
compareWith.push(l); compareWith.push(l);
@ -2223,7 +2223,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;
}); });
} }
}, },

Loading…
Cancel
Save