").css({
@@ -128,6 +133,31 @@ BI.Msg = function () {
items: [
{
type: "bi.border",
+ attributes: {
+ tabIndex: 1
+ },
+ mounted: function () {
+ this.element.keyup(function (e) {
+ if (e.keyCode === BI.KeyCode.ENTER) {
+ close();
+ if (BI.isFunction(callback)) {
+ callback.apply(null, [true]);
+ }
+ } else if (e.keyCode === BI.KeyCode.ESCAPE) {
+ close();
+ if (hasCancel === true) {
+ if (BI.isFunction(callback)) {
+ callback.apply(null, [false]);
+ }
+ }
+ }
+ });
+ try {
+ this.element.focus();
+ } catch (e) {
+
+ }
+ },
cls: "bi-card",
items: {
north: {
@@ -157,14 +187,14 @@ BI.Msg = function () {
}
}
},
- width: 60
+ width: 56
}
}
},
height: 40
},
center: {
- el: {
+ el: BI.isPlainObject(message) ? message : {
type: "bi.label",
vgap: 10,
hgap: 20,
diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js
index 6096a28c5..b264660a7 100644
--- a/src/base/grid/grid.js
+++ b/src/base/grid/grid.js
@@ -11,6 +11,9 @@ BI.GridView = BI.inherit(BI.Widget, {
baseCls: "bi-grid-view",
// width: 400, //必设
// height: 300, //必设
+ scrollable: true,
+ scrollx: false,
+ scrolly: false,
overflowX: true,
overflowY: true,
overscanColumnCount: 0,
@@ -21,7 +24,10 @@ BI.GridView = BI.inherit(BI.Widget, {
// estimatedRowSize: 30, //rowHeightGetter为function时必设
scrollLeft: 0,
scrollTop: 0,
- items: []
+ items: [],
+ itemFormatter: function (item, row, col) {
+ return item;
+ }
});
},
@@ -49,14 +55,30 @@ BI.GridView = BI.inherit(BI.Widget, {
scrollTop: o.scrollTop
});
});
+ // 兼容一下
+ var scrollable = o.scrollable, scrollx = o.scrollx, scrolly = o.scrolly;
+ if (o.overflowX === false) {
+ if (o.overflowY === false) {
+ scrollable = false;
+ } else {
+ scrollable = "y"
+ }
+ } else {
+ if (o.overflowY === false) {
+ scrollable = "x";
+ }
+ }
BI._lazyCreateWidget({
type: "bi.vertical",
element: this,
- scrollable: o.overflowX === true && o.overflowY === true,
- scrolly: o.overflowX === false && o.overflowY === true,
- scrollx: o.overflowX === true && o.overflowY === false,
+ scrollable: scrollable,
+ scrolly: scrolly,
+ scrollx: scrollx,
items: [this.container]
});
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
if (o.items.length > 0) {
this._calculateSizeAndPositionData();
this._populate();
@@ -172,12 +194,13 @@ BI.GridView = BI.inherit(BI.Widget, {
child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]);
} else {
+ var item = o.itemFormatter(o.items[rowIndex][columnIndex], rowIndex, columnIndex);
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: columnDatum.size,
height: rowDatum.size
- }, o.items[rowIndex][columnIndex], {
- cls: (o.items[rowIndex][columnIndex].cls || "") + " grid-cell" + (rowIndex === 0 ? " first-row" : "") + (columnIndex === 0 ? " first-col" : ""),
+ }, item, {
+ cls: (item.cls || "") + " grid-cell" + (rowIndex === 0 ? " first-row" : "") + (columnIndex === 0 ? " first-col" : ""),
_rowIndex: rowIndex,
_columnIndex: columnIndex,
_left: columnDatum.offset + horizontalOffsetAdjustment,
diff --git a/src/base/layer/layer.drawer.js b/src/base/layer/layer.drawer.js
new file mode 100644
index 000000000..e62c272dc
--- /dev/null
+++ b/src/base/layer/layer.drawer.js
@@ -0,0 +1,226 @@
+/**
+ * Popover弹出层,
+ * @class BI.Popover
+ * @extends BI.Widget
+ */
+BI.Drawer = BI.inherit(BI.Widget, {
+ SIZE: {
+ SMALL: "small",
+ NORMAL: "normal",
+ BIG: "big"
+ },
+ props: {
+ baseCls: "bi-drawer bi-card",
+ size: "normal",
+ placement: "right", // top/bottom/left/right
+ header: null,
+ headerHeight: 40,
+ body: null,
+ closable: true, // BI-40839 是否显示右上角的关闭按钮
+ bodyHgap: 20,
+ bodyTgap: 10,
+ bodyBgap: 10
+ },
+
+ render: function () {
+ var self = this;
+ var o = this.options;
+ var items = [{
+ el: {
+ type: "bi.htape",
+ cls: "bi-message-title bi-header-background",
+ items: [{
+ type: "bi.absolute",
+ items: [{
+ el: BI.isPlainObject(o.header) ? BI.extend({}, o.header, {
+ extraCls: "bi-font-bold"
+ }) : {
+ type: "bi.label",
+ cls: "bi-font-bold",
+ height: o.headerHeight,
+ text: o.header,
+ title: o.header,
+ textAlign: "left"
+ },
+ left: 20,
+ top: 0,
+ right: 0,
+ bottom: 0
+ }]
+ }, {
+ el: o.closable ? {
+ type: "bi.icon_button",
+ cls: "bi-message-close close-font",
+ height: o.headerHeight,
+ handler: function () {
+ self.close();
+ }
+ } : {
+ type: "bi.layout"
+ },
+ width: 56
+ }],
+ height: o.headerHeight
+ },
+ height: o.headerHeight
+ }, {
+ el: {
+ type: "bi.vertical",
+ scrolly: true,
+ cls: "drawer-body",
+ ref: function () {
+ self.body = this;
+ },
+ items: [{
+ el: o.body
+ }]
+ },
+ hgap: o.bodyHgap,
+ tgap: o.bodyTgap,
+ bgap: o.bodyBgap
+ }];
+
+ return BI.extend({
+ type: "bi.vtape",
+ items: items
+ }, this._getSuitableSize());
+ },
+
+ _getSuitableSize: function () {
+ var o = this.options;
+ var size = 0;
+ switch (o.size) {
+ case "big":
+ size = 736;
+ break;
+ case "small":
+ size = 200;
+ break;
+ case "normal":
+ default:
+ size = 378;
+ break;
+ }
+ if (o.placement === "top" || o.placement === "bottom") {
+ return {
+ height: o.height || size
+ };
+ }
+ if (o.placement === "left" || o.placement === "right") {
+ return {
+ width: o.width || size
+ };
+ }
+ },
+
+ mounted: function () {
+ var self = this, o = this.options;
+ switch (o.placement) {
+ case "right":
+ self.element.css({
+ top: 0,
+ left: "100%",
+ bottom: 0
+ });
+ break;
+ case "left":
+ self.element.css({
+ top: 0,
+ right: "100%",
+ bottom: 0
+ });
+ break;
+ case "top":
+ self.element.css({
+ left: 0,
+ right: 0,
+ bottom: "100%"
+ });
+ break;
+ case "bottom":
+ self.element.css({
+ left: 0,
+ right: 0,
+ top: "100%"
+ });
+ break;
+ }
+ },
+
+ show: function (callback) {
+ var self = this, o = this.options;
+ requestAnimationFrame(function () {
+ var size = self._getSuitableSize();
+ switch (o.placement) {
+ case "right":
+ self.element.css({
+ transform: "translateX(-" + size.width + "px)"
+ });
+ break;
+ case "left":
+ self.element.css({
+ transform: "translateX(" + size.width + "px)"
+ });
+ break;
+ case "top":
+ self.element.css({
+ transform: "translateY(" + size.height + "px)"
+ });
+ break;
+ case "bottom":
+ self.element.css({
+ transform: "translateY(-" + size.height + "px)"
+ });
+ break;
+ }
+ callback && callback();
+ });
+ },
+
+ hide: function (callback) {
+ var self = this, o = this.options;
+ requestAnimationFrame(function () {
+ switch (o.placement) {
+ case "right":
+ case "left":
+ self.element.css({
+ transform: "translateX(0px)"
+ });
+ break;
+ case "top":
+ case "bottom":
+ self.element.css({
+ transform: "translateY(0px)"
+ });
+ break;
+ }
+ setTimeout(callback, 300);
+ });
+ },
+
+ open: function () {
+ var self = this;
+ this.show(function () {
+ self.fireEvent(BI.Drawer.EVENT_OPEN);
+ });
+ },
+
+ close: function () {
+ var self = this;
+ this.hide(function () {
+ self.fireEvent(BI.Drawer.EVENT_CLOSE);
+ });
+ },
+
+ setZindex: function (zindex) {
+ this.element.css({"z-index": zindex});
+ },
+
+ destroyed: function () {
+ }
+});
+
+BI.shortcut("bi.drawer", BI.Drawer);
+
+BI.Drawer.EVENT_CLOSE = "EVENT_CLOSE";
+BI.Drawer.EVENT_OPEN = "EVENT_OPEN";
diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js
index 87bd2d405..bce738ef3 100644
--- a/src/base/layer/layer.popover.js
+++ b/src/base/layer/layer.popover.js
@@ -8,29 +8,32 @@ BI.Popover = BI.inherit(BI.Widget, {
SIZE: {
SMALL: "small",
NORMAL: "normal",
- BIG: "big",
+ BIG: "big"
},
MAX_HEIGHT: 600
},
- props: {
- baseCls: "bi-popover bi-card bi-border-radius",
- size: "normal", // small, normal, big
- logic: {
- dynamic: false,
- },
- header: null,
- headerHeight: 40,
- body: null,
- footer: null,
- footerHeight: 44,
- closable: true, // BI-40839 是否显示右上角的关闭按钮
- bodyHgap: 20,
- bodyTgap: 10
+ props: function () {
+ return {
+ baseCls: "bi-popover bi-card bi-border-radius",
+ size: "normal", // small, normal, big
+ logic: {
+ dynamic: false
+ },
+ header: null,
+ headerHeight: 40,
+ body: null,
+ footer: null,
+ footerHeight: 44,
+ closable: true, // BI-40839 是否显示右上角的关闭按钮
+ bodyHgap: BI.SIZE_CONSANTS.H_GAP_SIZE,
+ bodyTgap: BI.SIZE_CONSANTS.V_GAP_SIZE
+ };
},
render: function () {
- var self = this; var o = this.options;
+ var self = this;
+ var o = this.options;
var c = this._constant;
this.startX = 0;
this.startY = 0;
@@ -42,11 +45,11 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
- top: BI.clamp(self.startY, 0, H - self.element.height()) + "px",
+ top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize({
- target: self.element[0],
+ target: self.element[0]
});
}, function () {
self.tracker.releaseMouseMoves();
@@ -55,43 +58,43 @@ BI.Popover = BI.inherit(BI.Widget, {
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
- ref: function (_ref) {
- self.dragger = _ref;
- },
items: [{
- type: "bi.absolute",
- items: [{
- el: BI.isPlainObject(o.header) ? BI.extend({}, o.header, {
- extraCls: "bi-font-bold",
- }) : {
- type: "bi.label",
- cls: "bi-font-bold",
- height: o.headerHeight,
- text: o.header,
- title: o.header,
- textAlign: "left",
+ el: {
+ type: "bi.absolute",
+ ref: function (_ref) {
+ self.dragger = _ref;
},
- left: 20,
- top: 0,
- right: 0,
- bottom: 0,
- }],
- }, {
- el: o.closable ? {
+ items: [{
+ el: BI.isPlainObject(o.header) ? BI.extend({}, o.header, {
+ extraCls: "bi-font-bold"
+ }) : {
+ type: "bi.label",
+ cls: "bi-font-bold",
+ height: o.headerHeight,
+ text: o.header,
+ title: o.header,
+ textAlign: "left"
+ },
+ top: 0,
+ bottom: 0,
+ left: BI.SIZE_CONSANTS.H_GAP_SIZE,
+ right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE
+ }]
+ }
+ }, o.closable ? {
+ el: {
type: "bi.icon_button",
cls: "bi-message-close close-font",
height: o.headerHeight,
handler: function () {
self.close();
- },
- } : {
- type: "bi.layout",
+ }
},
- width: 56,
- }],
- height: o.headerHeight,
+ width: 56
+ } : null],
+ height: o.headerHeight
},
- height: o.headerHeight,
+ height: o.headerHeight
}, o.logic.dynamic ? {
el: {
type: "bi.vertical",
@@ -102,14 +105,14 @@ BI.Popover = BI.inherit(BI.Widget, {
},
css: {
"max-height": this._getSuitableBodyHeight(c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap),
- "min-height": this._getSuitableBodyHeight(size.height - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap),
+ "min-height": this._getSuitableBodyHeight(size.height - o.headerHeight - (o.footer ? o.footerHeight : 0) - o.bodyTgap)
},
items: [{
- el: o.body,
+ el: o.body
}],
- },
- hgap: o.bodyHgap,
- tgap: o.bodyTgap,
+ hgap: o.bodyHgap,
+ tgap: o.bodyTgap
+ }
} : {
el: {
type: "bi.absolute",
@@ -118,9 +121,9 @@ BI.Popover = BI.inherit(BI.Widget, {
left: o.bodyHgap,
top: o.bodyTgap,
right: o.bodyHgap,
- bottom: 0,
- }],
- },
+ bottom: 0
+ }]
+ }
}];
if (o.footer) {
items.push({
@@ -128,33 +131,33 @@ BI.Popover = BI.inherit(BI.Widget, {
type: "bi.absolute",
items: [{
el: o.footer,
- left: 20,
+ left: BI.SIZE_CONSANTS.H_GAP_SIZE,
top: 0,
- right: 20,
- bottom: 0,
+ right: BI.SIZE_CONSANTS.H_GAP_SIZE,
+ bottom: 0
}],
- height: o.footerHeight,
+ height: o.footerHeight
},
- height: o.footerHeight,
+ height: o.footerHeight
});
}
return BI.extend({
- type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
- width: this._getSuitableWidth(size.width),
+ width: this._getSuitableWidth(size.width)
}, o.logic.dynamic ? {
type: "bi.vertical",
- scrolly: false,
+ scrolly: false
} : {
type: "bi.vtape",
- height: this._getSuitableHeight(size.height),
+ height: this._getSuitableHeight(size.height)
});
},
// mounted之后绑定事件
mounted: function () {
- var self = this; var o = this.options;
+ var self = this;
+ var o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
@@ -202,7 +205,7 @@ BI.Popover = BI.inherit(BI.Widget, {
return {
width: o.width || size.width,
height: o.height || size.height,
- type: size.type || "default",
+ type: size.type || "default"
};
},
@@ -221,10 +224,11 @@ BI.Popover = BI.inherit(BI.Widget, {
},
setZindex: function (zindex) {
- this.element.css({ "z-index": zindex });
+ this.element.css({"z-index": zindex});
},
- destroyed: function () {},
+ destroyed: function () {
+ }
});
BI.shortcut("bi.popover", BI.Popover);
@@ -232,12 +236,13 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
- btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")],
+ btns: [BI.i18nText("BI-Basic_OK"), BI.i18nText("BI-Basic_Cancel")]
});
},
beforeCreate: function () {
- var self = this; var o = this.options;
+ var self = this;
+ var o = this.options;
o.footer || (o.footer = {
type: "bi.right_vertical_adapt",
lgap: 10,
@@ -249,7 +254,7 @@ BI.BarPopover = BI.inherit(BI.Popover, {
handler: function (v) {
self.fireEvent(BI.Popover.EVENT_CANCEL, v);
self.close(v);
- },
+ }
}, {
type: "bi.button",
text: this.options.btns[0],
@@ -258,10 +263,10 @@ BI.BarPopover = BI.inherit(BI.Popover, {
handler: function (v) {
self.fireEvent(BI.Popover.EVENT_CONFIRM, v);
self.close(v);
- },
- }],
+ }
+ }]
});
- },
+ }
});
BI.shortcut("bi.bar_popover", BI.BarPopover);
diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js
index 66db79ec7..a4cd139b3 100644
--- a/src/base/layer/layer.popup.js
+++ b/src/base/layer/layer.popup.js
@@ -4,9 +4,14 @@
* @extends BI.Widget
*/
BI.PopupView = BI.inherit(BI.Widget, {
- _defaultConfig: function () {
+ _const: {
+ TRIANGLE_LENGTH: 9
+ },
+ _defaultConfig: function (props) {
return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this, arguments), {
- _baseCls: "bi-popup-view",
+ _baseCls: "bi-popup-view" + (props.primary ? " bi-primary" : ""),
+ // 品牌色
+ primary: false,
maxWidth: "auto",
minWidth: 100,
// maxHeight: 200,
@@ -17,8 +22,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
bgap: 0,
vgap: 0,
hgap: 0,
- innerVGap: 0,
- innerHGap: 0,
+ innerVgap: 0,
+ innerHgap: 0,
+ showArrow: false,
direction: BI.Direction.Top, // 工具栏的方向
stopEvent: false, // 是否停止mousedown、mouseup事件
stopPropagation: false, // 是否停止mousedown、mouseup向上冒泡
@@ -54,12 +60,12 @@ BI.PopupView = BI.inherit(BI.Widget, {
"z-index": BI.zIndex_popup,
"min-width": BI.isNumeric(o.minWidth) ? (o.minWidth / BI.pixRatio + BI.pixUnit) : o.minWidth,
"max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth
- }).bind({ click: fn });
+ }).bind({click: fn});
this.element.bind("mousewheel", fn);
- o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn });
- o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop });
+ o.stopPropagation && this.element.bind({mousedown: fn, mouseup: fn, mouseover: fn});
+ o.stopEvent && this.element.bind({mousedown: stop, mouseup: stop, mouseover: stop});
this.tool = this._createTool();
this.tab = this._createTab();
this.view = this._createView();
@@ -82,25 +88,56 @@ BI.PopupView = BI.inherit(BI.Widget, {
bgap: o.bgap,
vgap: o.vgap,
hgap: o.hgap,
- items: BI.LogicFactory.createLogicItemsByDirection(o.direction,
- BI.extend({
- cls: "list-view-outer bi-card list-view-shadow"
+ items: BI.LogicFactory.createLogicItemsByDirection(o.direction, BI.extend({
+ cls: "list-view-outer bi-card list-view-shadow" + (o.primary ? " bi-primary" : "")
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tool, this.tab, this.view, this.toolbar)
})))
)
}))));
+ if (o.showArrow) {
+ this.arrow = BI.createWidget({
+ type: "bi.absolute",
+ cls: "bi-bubble-arrow",
+ items: [{
+ type: "bi.layout",
+ cls: "bubble-arrow"
+ }]
+ });
+ this.arrowWrapper = BI.createWidget({
+ type: "bi.absolute",
+ cls: "bi-bubble-arrow-wrapper",
+ items: [{
+ el: this.arrow,
+ }]
+ });
+ // 因为三角符号的原因位置变大了,需要占位
+ this.placeholder = BI.createWidget({
+ type: "bi.layout"
+ });
+ BI.createWidget({
+ type: "bi.absolute",
+ element: this,
+ items: [{
+ el: this.arrowWrapper,
+ left: 0,
+ top: 0,
+ }, {
+ el: this.placeholder
+ }]
+ });
+ }
},
_createView: function () {
var o = this.options;
- this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value });
+ this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group.element.css({
"min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight,
- "padding-top": o.innerVGap / BI.pixRatio + BI.pixUnit,
- "padding-bottom": o.innerVGap / BI.pixRatio + BI.pixUnit,
- "padding-left": o.innerHGap / BI.pixRatio + BI.pixUnit,
- "padding-right": o.innerHGap / BI.pixRatio + BI.pixUnit,
+ "padding-top": o.innerVgap / BI.pixRatio + BI.pixUnit,
+ "padding-bottom": o.innerVgap / BI.pixRatio + BI.pixUnit,
+ "padding-left": o.innerHgap / BI.pixRatio + BI.pixUnit,
+ "padding-right": o.innerHgap / BI.pixRatio + BI.pixUnit
});
return this.button_group;
},
@@ -145,6 +182,204 @@ BI.PopupView = BI.inherit(BI.Widget, {
});
},
+ setDirection: function (direction, position) {
+ var o = this.options;
+ if (o.showArrow) {
+ var style, wrapperStyle, placeholderStyle;
+ var adjustXOffset = position.adjustXOffset || 0;
+ var adjustYOffset = position.adjustYOffset || 0;
+ var bodyBounds = BI.Widget._renderEngine.createElement("body").bounds();
+ var bodyWidth = bodyBounds.width;
+ var bodyHeight = bodyBounds.height;
+ var popupWidth = this.element.outerWidth();
+ var popupHeight = this.element.outerHeight();
+ var offset = position.offset;
+ var offsetStyle = position.offsetStyle;
+ var middle = offsetStyle === "center" || offsetStyle === "middle";
+
+ var minLeft = Math.max(5, offset.left + 5 + popupWidth - bodyWidth);
+ var minRight = Math.max(5, popupWidth - (offset.left + 5));
+ var minTop = Math.max(5, offset.top + 5 + popupHeight - bodyHeight);
+ var minBottom = Math.max(5, popupHeight - (offset.top + 5));
+
+ var maxLeft = Math.min(popupWidth - 12 - 5, offset.left + position.width - 12 - 5);
+ var maxRight = Math.min(popupWidth - 12 - 5, bodyWidth - (offset.left + position.width - 12 - 5));
+ var maxTop = Math.min(popupHeight - 12 - 5, offset.top + position.height - 12 - 5);
+ var maxBottom = Math.min(popupHeight - 12 - 5, bodyHeight - (offset.top + position.height - 12 - 5));
+ switch (direction) {
+ case "bottom":
+ case "bottom,right":
+ direction = "bottom";
+ style = {
+ // 5表示留出一定的空间
+ left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft)
+ };
+ wrapperStyle = {
+ top: o.tgap + o.vgap,
+ left: 0,
+ right: "",
+ bottom: "",
+ };
+ placeholderStyle = {
+ left: 0,
+ right: 0,
+ height: this._const.TRIANGLE_LENGTH,
+ top: -this._const.TRIANGLE_LENGTH,
+ bottom: ""
+ };
+ break;
+ case "bottom,left":
+ direction = "bottom";
+ style = {
+ right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight)
+ };
+ wrapperStyle = {
+ top: o.bgap + o.vgap,
+ left: "",
+ right: 0,
+ bottom: "",
+ };
+ placeholderStyle = {
+ left: 0,
+ right: 0,
+ height: this._const.TRIANGLE_LENGTH,
+ top: -this._const.TRIANGLE_LENGTH,
+ bottom: ""
+ };
+ break;
+ case "top":
+ case "top,right":
+ direction = "top";
+ style = {
+ left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft)
+ };
+ wrapperStyle = {
+ bottom: o.bgap + o.vgap,
+ left: 0,
+ right: "",
+ top: "",
+ };
+ placeholderStyle = {
+ left: 0,
+ right: 0,
+ height: this._const.TRIANGLE_LENGTH,
+ top: "",
+ bottom: -this._const.TRIANGLE_LENGTH,
+ };
+ break;
+ case "top,left":
+ direction = "top";
+ style = {
+ right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight)
+ };
+ wrapperStyle = {
+ bottom: o.bgap + o.vgap,
+ right: 0,
+ left: "",
+ top: "",
+ };
+ placeholderStyle = {
+ left: 0,
+ right: 0,
+ height: this._const.TRIANGLE_LENGTH,
+ top: "",
+ bottom: -this._const.TRIANGLE_LENGTH,
+ };
+ break;
+ case "left":
+ case "left,bottom":
+ direction = "left";
+ style = {
+ top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop)
+ };
+ wrapperStyle = {
+ right: o.rgap + o.hgap,
+ top: 0,
+ bottom: "",
+ left: "",
+ };
+ placeholderStyle = {
+ top: 0,
+ bottom: 0,
+ width: this._const.TRIANGLE_LENGTH,
+ right: -this._const.TRIANGLE_LENGTH,
+ left: ""
+ };
+ break;
+ case "left,top":
+ direction = "left";
+ style = {
+ bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom)
+ };
+ wrapperStyle = {
+ right: o.rgap + o.hgap,
+ bottom: 0,
+ top: "",
+ left: "",
+ };
+ placeholderStyle = {
+ top: 0,
+ bottom: 0,
+ width: this._const.TRIANGLE_LENGTH,
+ right: -this._const.TRIANGLE_LENGTH,
+ left: ""
+ };
+ break;
+ case "right":
+ case "right,bottom":
+ direction = "right";
+ style = {
+ top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop)
+ };
+ wrapperStyle = {
+ left: o.lgap + o.hgap,
+ top: 0,
+ bottom: "",
+ right: "",
+ };
+ placeholderStyle = {
+ top: 0,
+ bottom: 0,
+ width: this._const.TRIANGLE_LENGTH,
+ left: -this._const.TRIANGLE_LENGTH,
+ right: ""
+ };
+ break;
+ case "right,top":
+ direction = "right";
+ style = {
+ bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom)
+ };
+ wrapperStyle = {
+ left: o.lgap + o.hgap,
+ bottom: 0,
+ top: "",
+ right: "",
+ };
+ placeholderStyle = {
+ top: 0,
+ bottom: 0,
+ width: this._const.TRIANGLE_LENGTH,
+ left: -this._const.TRIANGLE_LENGTH,
+ right: ""
+ };
+ break;
+ case "right,innerRight":
+ break;
+ case "right,innerLeft":
+ break;
+ case "innerRight":
+ break;
+ case "innerLeft":
+ break;
+ }
+ this.element.removeClass("left").removeClass("right").removeClass("top").removeClass("bottom").addClass(direction);
+ this.arrow.element.css(style);
+ this.arrowWrapper.element.css(wrapperStyle);
+ this.placeholder.element.css(placeholderStyle);
+ }
+ },
+
getView: function () {
return this.view;
},
@@ -162,9 +397,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
var tbHeight = this.toolbar ? (this.toolbar.attr("height") || 24) : 0,
tabHeight = this.tab ? (this.tab.attr("height") || 24) : 0,
toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
- var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVGap;
+ var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVgap;
this.view.resetHeight ? this.view.resetHeight(resetHeight) :
- this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit });
+ this.view.element.css({"max-height": resetHeight / BI.pixRatio + BI.pixUnit});
},
setValue: function (selectedValues) {
diff --git a/src/base/list/listview.js b/src/base/list/listview.js
index 2708e4823..052abc139 100644
--- a/src/base/list/listview.js
+++ b/src/base/list/listview.js
@@ -13,7 +13,10 @@ BI.ListView = BI.inherit(BI.Widget, {
blockSize: 10,
scrollTop: 0,
el: {},
- items: []
+ items: [],
+ itemFormatter: function (item, index) {
+ return item;
+ }
};
},
@@ -41,6 +44,9 @@ BI.ListView = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
this.element.scroll(function (e) {
o.scrollTop = self.element.scrollTop();
@@ -71,7 +77,9 @@ BI.ListView = BI.inherit(BI.Widget, {
};
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize);
- this.container.addItems(items, this);
+ this.container.addItems(items.map(function (item, i) {
+ return o.itemFormatter(item, index + i);
+ }), this);
var addedHeight = getElementHeight() - lastHeight;
this.cache[cnt] = {
index: index,
diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js
index 56dd68bb1..7a4a9323b 100644
--- a/src/base/list/virtualgrouplist.js
+++ b/src/base/list/virtualgrouplist.js
@@ -13,7 +13,10 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
blockSize: 10,
scrollTop: 0,
rowHeight: "auto",
- items: []
+ items: [],
+ itemFormatter: function (item, index) {
+ return item;
+ }
};
},
@@ -54,10 +57,20 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
- this.element.scroll(function (e) {
+ this.ticking = false;
+ this.element.scroll(function() {
o.scrollTop = self.element.scrollTop();
- self._calculateBlocksToRender();
+ if (!self.ticking) {
+ requestAnimationFrame(function () {
+ self._calculateBlocksToRender();
+ self.ticking = false;
+ });
+ self.ticking = true;
+ }
});
BI.ResizeDetector.addResizeListener(this, function () {
self._calculateBlocksToRender();
@@ -79,7 +92,9 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
};
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize);
- this.container.addItems(items, this);
+ this.container.addItems(items.map(function (item, i) {
+ return o.itemFormatter(item, index + i)
+ }), this);
var addedHeight = getElementHeight() - lastHeight;
this.tree.set(cnt, addedHeight);
this.renderedIndex = cnt;
@@ -107,7 +122,9 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}
}
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)));
- this.container.populate(items);
+ this.container.populate(items.map(function (item, i) {
+ return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i)
+ }));
} else {
for (var i = (start < 0 ? 0 : start); i <= end; i++) {
var index = i * o.blockSize;
@@ -116,7 +133,9 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}
}
this.container.element.height(o.rowHeight * o.items.length - topHeight);
- this.container.populate(items);
+ this.container.populate(items.map(function (item, i) {
+ return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i)
+ }));
}
},
diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js
index 7f90c763c..b7f2700c7 100644
--- a/src/base/list/virtuallist.js
+++ b/src/base/list/virtuallist.js
@@ -12,7 +12,10 @@ BI.VirtualList = BI.inherit(BI.Widget, {
overscanHeight: 100,
blockSize: 10,
scrollTop: 0,
- items: []
+ items: [],
+ itemFormatter: function (item, index) {
+ return item;
+ }
};
},
@@ -50,6 +53,9 @@ BI.VirtualList = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
this.element.scroll(function (e) {
o.scrollTop = self.element.scrollTop();
@@ -71,7 +77,9 @@ BI.VirtualList = BI.inherit(BI.Widget, {
};
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize);
- this.container.addItems(items, this);
+ this.container.addItems(items.map(function (item, i) {
+ return o.itemFormatter(item, index + i)
+ }), this);
var addedHeight = getElementHeight() - lastHeight;
this.tree.set(cnt, addedHeight);
this.renderedIndex = cnt;
@@ -128,7 +136,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
}
if (this.cache[i].destroyed === true) {
for (var j = index; j < index + o.blockSize && j < o.items.length; j++) {
- var w = this.container._addElement(j, o.items[j], this);
+ var w = this.container._addElement(j, o.itemFormatter(o.items[j], j), this);
needMount.push(w);
currentFragment.appendChild(w.element[0]);
}
diff --git a/src/base/pager/pager.js b/src/base/pager/pager.js
index 5967271b2..6689774f6 100644
--- a/src/base/pager/pager.js
+++ b/src/base/pager/pager.js
@@ -12,8 +12,6 @@ BI.Pager = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.horizontal",
- hgap: 10,
- vgap: 0
}],
dynamicShow: true, // 是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态
@@ -178,7 +176,6 @@ BI.Pager = BI.inherit(BI.Widget, {
items: BI.createItems(view, {
cls: "bi-list-item-select bi-border-radius",
height: 23,
- hgap: 10,
stopPropagation: true
}),
behaviors: o.behaviors,
diff --git a/src/base/single/0.single.js b/src/base/single/0.single.js
index 070935e24..bb926e9a2 100644
--- a/src/base/single/0.single.js
+++ b/src/base/single/0.single.js
@@ -46,8 +46,11 @@ BI.Single = BI.inherit(BI.Widget, {
},
_init: function () {
- BI.Single.superclass._init.apply(this, arguments);
var self = this, o = this.options;
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ BI.Single.superclass._init.apply(this, arguments);
if (BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({
diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js
index cc6081e7f..4a22bf531 100644
--- a/src/base/single/1.text.js
+++ b/src/base/single/1.text.js
@@ -76,7 +76,9 @@
this.text = this;
}
- var text = this._getShowText();
+ var text = BI.isFunction(o.text) ? this.__watch(o.text, function (context, newValue) {
+ self.setText(newValue);
+ }) : o.text;
// 只要不是undefined就可以显示text值,否则显示value
if (!BI.isUndefined(text)) {
this.setText(text);
diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js
index 4a5d68a0c..aab172495 100644
--- a/src/base/single/button/button.basic.js
+++ b/src/base/single/button/button.basic.js
@@ -10,6 +10,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""),
+ // el: {} // 可以通过el来创建button元素
value: "",
stopEvent: false,
stopPropagation: false,
@@ -26,15 +27,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
bubble: null
});
},
+
_init: function () {
- BI.BasicButton.superclass._init.apply(this, arguments);
+ var self = this;
var opts = this.options;
- if (opts.selected === true) {
- BI.nextTick(BI.bind(function () {
- this.setSelected(opts.selected);
- }, this));
- }
- BI.nextTick(BI.bind(this.bindEvent, this));
+ opts.selected = BI.isFunction(opts.selected) ? this.__watch(opts.selected, function (context, newValue) {
+ self.setSelected(newValue);
+ }) : opts.selected;
+ BI.BasicButton.superclass._init.apply(this, arguments);
if (opts.shadow) {
this._createShadow();
@@ -44,6 +44,20 @@ BI.BasicButton = BI.inherit(BI.Single, {
}
},
+ _initRef: function () {
+ if (this.options.selected === true) {
+ this.setSelected(true);
+ }
+ // 延迟绑定事件,这样可以将自己绑定的事情优先执行
+ BI.nextTick(this.bindEvent.bind(this));
+ BI.BasicButton.superclass._initRef.apply(this, arguments);
+ },
+
+ // 默认render方法
+ render: function () {
+ return this.options.el;
+ },
+
_createShadow: function () {
var self = this, o = this.options;
@@ -194,6 +208,12 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
}
hand.click(clk);
+ // enter键等同于点击
+ o.attributes && o.attributes.zIndex >= 0 && hand.keyup(function (e) {
+ if (e.keyCode === BI.KeyCode.ENTER) {
+ clk(e);
+ }
+ });
break;
}
});
diff --git a/src/base/single/button/button.node.js b/src/base/single/button/button.node.js
index b8fda221f..8e17a4ea5 100644
--- a/src/base/single/button/button.node.js
+++ b/src/base/single/button/button.node.js
@@ -9,18 +9,17 @@
BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
- return BI.extend( conf, {
+ return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node",
open: false
});
},
- _init: function () {
- BI.NodeButton.superclass._init.apply(this, arguments);
- var self = this;
- BI.nextTick(function () {
- self.setOpened(self.isOpened());
- });
+ _initRef: function () {
+ if (this.isOpened()) {
+ this.setOpened(this.isOpened());
+ }
+ BI.NodeButton.superclass._initRef.apply(this, arguments);
},
doClick: function () {
@@ -41,14 +40,14 @@ BI.NodeButton = BI.inherit(BI.BasicButton, {
},
triggerCollapse: function () {
- if(this.isOpened()) {
+ if (this.isOpened()) {
this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
}
},
triggerExpand: function () {
- if(!this.isOpened()) {
+ if (!this.isOpened()) {
this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
}
diff --git a/src/base/single/button/buttons/button.icon.js b/src/base/single/button/buttons/button.icon.js
index 5eb104e6d..3def60551 100644
--- a/src/base/single/button/buttons/button.icon.js
+++ b/src/base/single/button/buttons/button.icon.js
@@ -8,6 +8,12 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
var conf = BI.IconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-icon-button horizon-center",
+ hgap: 0,
+ vgap: 0,
+ tgap: 0,
+ bgap: 0,
+ lgap: 0,
+ rgap: 0,
iconWidth: null,
iconHeight: null
});
@@ -28,6 +34,12 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
BI.createWidget({
type: "bi.default",
element: this,
+ hgap: o.hgap,
+ vgap: o.vgap,
+ lgap: o.lgap,
+ rgap: o.rgap,
+ tgap: o.tgap,
+ bgap: o.bgap,
items: [this.icon]
});
} else {
@@ -35,6 +47,12 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
BI.createWidget({
element: this,
type: "bi.center_adapt",
+ hgap: o.hgap,
+ vgap: o.vgap,
+ lgap: o.lgap,
+ rgap: o.rgap,
+ tgap: o.tgap,
+ bgap: o.bgap,
items: [this.icon]
});
}
diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js
index b5dc71c27..0863d0935 100644
--- a/src/base/single/button/buttons/button.js
+++ b/src/base/single/button/buttons/button.js
@@ -16,6 +16,9 @@ BI.Button = BI.inherit(BI.BasicButton, {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""),
+ attributes: {
+ tabIndex: 1
+ },
minWidth: (props.block === true || props.clear === true) ? 0 : 80,
height: 24,
shadow: props.clear !== true,
@@ -61,7 +64,7 @@ BI.Button = BI.inherit(BI.BasicButton, {
type: "bi.icon_label",
cls: o.iconCls,
width: this._const.iconWidth,
- height: o.height,
+ height: lineHeight,
lineHeight: lineHeight,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
@@ -71,7 +74,7 @@ BI.Button = BI.inherit(BI.BasicButton, {
text: o.text,
textWidth: BI.isNotNull(o.textWidth) ? o.textWidth - this._const.iconWidth : null,
textHeight: textHeight,
- height: o.height,
+ height: lineHeight,
value: o.value
});
BI.createWidget({
@@ -125,6 +128,15 @@ BI.Button = BI.inherit(BI.BasicButton, {
}
},
+ _setEnable: function (enable) {
+ BI.Button.superclass._setEnable.apply(this, arguments);
+ if (enable === true) {
+ this.element.attr("tabIndex", 1);
+ } else if (enable === false) {
+ this.element.removeAttr("tabIndex");
+ }
+ },
+
setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text);
diff --git a/src/base/single/button/listitem/blankiconicontextitem.js b/src/base/single/button/listitem/blankiconicontextitem.js
index 9e8301a53..ed8f0b6d1 100644
--- a/src/base/single/button/listitem/blankiconicontextitem.js
+++ b/src/base/single/button/listitem/blankiconicontextitem.js
@@ -27,45 +27,46 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- var blank = BI.createWidget({
- type: "bi.layout",
- width: o.blankWidth,
- height: o.height
- });
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon1 = BI.createWidget({
- type: "bi.icon_button",
- cls: o.iconCls1,
- forceNotSelected: true,
- width: o.height,
- height: o.height
- });
- this.icon2 = BI.createWidget({
- type: "bi.icon_button",
- cls: o.iconCls2,
- forceNotSelected: true,
- width: o.height,
- height: o.height
- });
+ var self = this, o = this.options;
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", blank, this.icon1, this.icon2, this.text)
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.blankWidth, o.leftIconWrapperWidth || o.height, o.rightIconWrapperWidth || o.height, "fill"],
+ items: [{
+ type: "bi.layout",
+ width: o.blankWidth
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls1,
+ width: o.leftIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls2,
+ width: o.rightIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }]
+ };
},
doClick: function () {
diff --git a/src/base/single/button/listitem/blankicontexticonitem.js b/src/base/single/button/listitem/blankicontexticonitem.js
index 99d6ad575..815589387 100644
--- a/src/base/single/button/listitem/blankicontexticonitem.js
+++ b/src/base/single/button/listitem/blankicontexticonitem.js
@@ -28,57 +28,46 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
+ var self = this, o = this.options;
- var icon1 = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls1,
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
- BI.createWidget({
- type: "bi.absolute",
- element: this,
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.blankWidth, o.leftIconWrapperWidth || o.height, "fill", o.rightIconWrapperWidth || o.height],
items: [{
- el: {
- type: "bi.icon_label",
- cls: o.iconCls2,
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- },
- top: 0,
- bottom: 0,
- right: 0
- }]
- });
-
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.layout",
width: o.blankWidth
- }, icon1, this.text, {
- type: "bi.layout",
- width: o.height
- })
- }))));
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls1,
+ width: o.leftIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls2,
+ width: o.rightIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }]
+ };
},
doClick: function () {
diff --git a/src/base/single/button/listitem/blankicontextitem.js b/src/base/single/button/listitem/blankicontextitem.js
index d647637dc..54be05c5b 100644
--- a/src/base/single/button/listitem/blankicontextitem.js
+++ b/src/base/single/button/listitem/blankicontextitem.js
@@ -26,38 +26,40 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- var blank = BI.createWidget({
- type: "bi.layout",
- width: o.blankWidth
- });
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls,
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
+ var self = this, o = this.options;
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", blank, this.icon, this.text)
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.blankWidth, o.iconWrapperWidth || o.height, "fill"],
+ items: [{
+ type: "bi.layout",
+ width: o.blankWidth
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls,
+ width: o.iconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }]
+ };
},
doClick: function () {
diff --git a/src/base/single/button/listitem/icontexticonitem.js b/src/base/single/button/listitem/icontexticonitem.js
index 3cae823de..8db8ae483 100644
--- a/src/base/single/button/listitem/icontexticonitem.js
+++ b/src/base/single/button/listitem/icontexticonitem.js
@@ -27,55 +27,43 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
+ var self = this, o = this.options;
- var icon1 = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls1,
- width: o.leftIconWrapperWidth,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
- var blank = BI.createWidget({
- type: "bi.layout",
- width: o.height
- });
- BI.createWidget({
- type: "bi.absolute",
- element: this,
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.leftIconWrapperWidth || o.height, "fill", o.rightIconWrapperWidth || o.height],
items: [{
+ type: "bi.icon_label",
+ cls: o.iconCls1,
+ width: o.leftIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
el: {
- type: "bi.icon_label",
- cls: o.iconCls2,
- width: o.rightIconWrapperWidth,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- },
- top: 0,
- bottom: 0,
- right: 0
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls2,
+ width: o.rightIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
}]
- });
-
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", icon1, this.text, blank)
- }))));
+ };
},
doClick: function () {
diff --git a/src/base/single/button/listitem/icontextitem.js b/src/base/single/button/listitem/icontextitem.js
index 648b98381..76c19e25d 100644
--- a/src/base/single/button/listitem/icontextitem.js
+++ b/src/base/single/button/listitem/icontextitem.js
@@ -27,34 +27,44 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls,
- width: o.iconWrapperWidth || o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
+ var self = this, o = this.options;
+
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [{
+ type: "bi.icon_label",
+ cls: o.iconCls,
+ width: o.iconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }]
+ };
+ },
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.icon, this.text)
- }))));
+ doClick: function () {
+ BI.IconTextItem.superclass.doClick.apply(this, arguments);
+ if (this.isValid()) {
+ this.fireEvent(BI.IconTextItem.EVENT_CHANGE, this.getValue(), this);
+ }
},
setValue: function () {
@@ -75,13 +85,6 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
return this.text.getText();
},
- doClick: function () {
- BI.IconTextItem.superclass.doClick.apply(this, arguments);
- if (this.isValid()) {
- this.fireEvent(BI.IconTextItem.EVENT_CHANGE, this.getValue(), this);
- }
- },
-
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/base/single/button/listitem/texticonitem.js b/src/base/single/button/listitem/texticonitem.js
index 7eb468087..92c696780 100644
--- a/src/base/single/button/listitem/texticonitem.js
+++ b/src/base/single/button/listitem/texticonitem.js
@@ -15,6 +15,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
logic: {
dynamic: false
},
+ iconWrapperWidth: null,
iconHeight: null,
iconWidth: null,
iconCls: "",
@@ -26,34 +27,37 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls,
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
+ var self = this, o = this.options;
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", this.text, this.icon)
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: ["fill", o.iconWrapperWidth || o.height],
+ items: [{
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls,
+ width: o.iconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }]
+ };
},
doClick: function () {
diff --git a/src/base/single/button/node/icontexticonnode.js b/src/base/single/button/node/icontexticonnode.js
index 01870423f..79bc0167f 100644
--- a/src/base/single/button/node/icontexticonnode.js
+++ b/src/base/single/button/node/icontexticonnode.js
@@ -25,55 +25,43 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
+ var self = this, o = this.options;
- var icon1 = BI.createWidget({
- type: "bi.icon_label",
- cls: o.iconCls1,
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
- var blank = BI.createWidget({
- type: "bi.layout",
- width: o.height,
- height: o.height
- });
- BI.createWidget({
- type: "bi.absolute",
- element: this,
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.leftIconWrapperWidth || o.height, "fill", o.rightIconWrapperWidth || o.height],
items: [{
+ type: "bi.icon_label",
+ cls: o.iconCls1,
+ width: o.leftIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
el: {
- type: "bi.icon_label",
- cls: o.iconCls2,
- width: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- },
- top: 0,
- bottom: 0,
- right: 0
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls2,
+ width: o.rightIconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
}]
- });
-
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", icon1, this.text, blank)
- }))));
+ };
},
doClick: function () {
diff --git a/src/base/single/button/node/icontextnode.js b/src/base/single/button/node/icontextnode.js
index 35e5757b8..00f1adf86 100644
--- a/src/base/single/button/node/icontextnode.js
+++ b/src/base/single/button/node/icontextnode.js
@@ -24,33 +24,44 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon = BI.createWidget({
- type: "bi.icon_label",
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
+ var self = this, o = this.options;
+
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [{
+ type: "bi.icon_label",
+ cls: o.iconCls,
+ width: o.iconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }]
+ };
+ },
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon, this.text)
- }))));
+ doClick: function () {
+ BI.IconTextNode.superclass.doClick.apply(this, arguments);
+ if (this.isValid()) {
+ this.fireEvent(BI.IconTextNode.EVENT_CHANGE, this.getValue(), this);
+ }
},
setValue: function () {
@@ -71,13 +82,6 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
return this.text.getText();
},
- doClick: function () {
- BI.IconTextNode.superclass.doClick.apply(this, arguments);
- if (this.isValid()) {
- this.fireEvent(BI.IconTextNode.EVENT_CHANGE, this.getValue(), this);
- }
- },
-
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/base/single/button/node/texticonnode.js b/src/base/single/button/node/texticonnode.js
index 2231c4c88..67844bddc 100644
--- a/src/base/single/button/node/texticonnode.js
+++ b/src/base/single/button/node/texticonnode.js
@@ -23,33 +23,37 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
},
render: function () {
- var o = this.options, c = this._const;
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- hgap: o.textHgap,
- vgap: o.textVgap,
- lgap: o.textLgap,
- rgap: o.textRgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- height: o.height
- });
- this.icon = BI.createWidget({
- type: "bi.icon_label",
- width: o.height,
- height: o.height,
- iconWidth: o.iconWidth,
- iconHeight: o.iconHeight
- });
+ var self = this, o = this.options;
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", this.text, this.icon)
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: ["fill", o.iconWrapperWidth || o.height],
+ items: [{
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ height: o.height
+ }
+ }, {
+ type: "bi.icon_label",
+ cls: o.iconCls,
+ width: o.iconWrapperWidth || o.height,
+ height: o.height,
+ iconWidth: o.iconWidth,
+ iconHeight: o.iconHeight
+ }]
+ };
},
doClick: function () {
diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js
index 3191e4aeb..2d9941bb4 100644
--- a/src/base/single/editor/editor.js
+++ b/src/base/single/editor/editor.js
@@ -109,12 +109,14 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_VALID, function () {
self._checkWaterMark();
self._setErrorVisible(false);
+ self.element.removeClass("error");
self.fireEvent(BI.Editor.EVENT_VALID, arguments);
});
this.editor.on(BI.Input.EVENT_ERROR, function () {
self._checkWaterMark();
self.fireEvent(BI.Editor.EVENT_ERROR, arguments);
self._setErrorVisible(self.isEditing());
+ self.element.addClass("error");
});
this.editor.on(BI.Input.EVENT_RESTRICT, function () {
self._checkWaterMark();
@@ -269,7 +271,7 @@ BI.Editor = BI.inherit(BI.Single, {
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, {
- adjustYOffset: 2
+ adjustYOffset: o.simple ? 1 : 2
});
this._checkToolTip();
}
diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js
index d917a4762..1175d01c7 100644
--- a/src/base/single/editor/editor.multifile.js
+++ b/src/base/single/editor/editor.multifile.js
@@ -78,6 +78,10 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
this.file.select();
},
+ getQueue: function () {
+ return this.file.getQueue();
+ },
+
getValue: function () {
return this.file.getValue();
},
@@ -87,6 +91,12 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
this.file.upload();
},
+ sendFiles: function (files) {
+ this._reset();
+
+ this.file.sendFiles(files);
+ },
+
reset: function () {
this._reset();
}
diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js
index 177f33b26..67a197ddd 100644
--- a/src/base/single/editor/editor.textarea.js
+++ b/src/base/single/editor/editor.textarea.js
@@ -5,12 +5,12 @@
* @extends BI.Single
*/
BI.TextAreaEditor = BI.inherit(BI.Single, {
- _defaultConfig: function () {
+ _defaultConfig: function (conf) {
return BI.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), {
baseCls: "bi-textarea-editor",
value: "",
errorText: "",
- adjustYOffset: 2,
+ adjustYOffset: conf.simple ? 0 : 2,
adjustXOffset: 0,
offsetStyle: "left",
validationChecker: function () {
@@ -156,7 +156,9 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
},
_checkError: function () {
- this._setErrorVisible(this._isError());
+ var isError = this._isError();
+ this._setErrorVisible(isError);
+ this.element[isError ? "addClass" : "removeClass"]("error");
},
_focus: function () {
diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js
index bf4e207b9..50ec58bdc 100644
--- a/src/base/single/input/file.js
+++ b/src/base/single/input/file.js
@@ -333,11 +333,10 @@
if (isFunction(handler.onloadstart)) {
handler.onloadstart(rpe, {});
}
- with (document.body || document.documentElement) {
- appendChild(iframe);
- appendChild(form);
- form.submit();
- }
+ var d = document.body || document.documentElement;
+ d.appendChild(iframe);
+ d.appendChild(form);
+ form.submit();
return handler;
};
@@ -652,7 +651,7 @@
});
},
- setMaxFileLength: function(v) {
+ setMaxFileLength: function (v) {
this.options.maxLength = v;
if (this.wrap) {
this.wrap.maxLength = v;
@@ -671,6 +670,10 @@
return this.wrap ? this.wrap.attach_array : [];
},
+ getQueue: function () {
+ return this.wrap.files;
+ },
+
reset: function () {
if (this.wrap) {
this.wrap.attach_array = [];
@@ -679,12 +682,22 @@
}
},
+ sendFiles: function (files) {
+ if (!this.wrap) return;
+
+ this.wrap.dom.input.files = files;
+
+ var event = new CustomEvent("change");
+
+ this.wrap.dom.input.dispatchEvent(event);
+ },
+
_setEnable: function (enable) {
BI.File.superclass._setEnable.apply(this, arguments);
if (enable === true) {
- this.element.attr("disabled", "disabled");
- } else {
this.element.removeAttr("disabled");
+ } else {
+ this.element.attr("disabled", "disabled");
}
}
});
diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js
index 837d6d205..41e1ca0de 100644
--- a/src/base/single/input/input.js
+++ b/src/base/single/input/input.js
@@ -24,7 +24,7 @@ BI.Input = BI.inherit(BI.Single, {
var _keydown = BI.debounce(function (keyCode) {
self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false;
- }, 300);
+ }, BI.EVENT_RESPONSE_TIME);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
@@ -96,7 +96,7 @@ BI.Input = BI.inherit(BI.Single, {
_blur: function () {
var self = this;
if (self._keydown_ === true) {
- BI.delay(blur, 300);
+ BI.delay(blur, BI.EVENT_RESPONSE_TIME);
} else {
blur();
}
diff --git a/src/base/single/input/radio/radio.js b/src/base/single/input/radio/radio.js
index 61096af65..f17e79e9e 100644
--- a/src/base/single/input/radio/radio.js
+++ b/src/base/single/input/radio/radio.js
@@ -19,7 +19,6 @@ BI.Radio = BI.inherit(BI.BasicButton, {
var self = this, o = this.options;
return {
type: "bi.center_adapt",
- element: this.element,
items: [{
type: "bi.layout",
cls: "radio-content",
diff --git a/src/base/single/label/abstract.label.js b/src/base/single/label/abstract.label.js
index 8bbfbee15..76fb27fbd 100644
--- a/src/base/single/label/abstract.label.js
+++ b/src/base/single/label/abstract.label.js
@@ -106,6 +106,7 @@
"line-height": o.height / BI.pixRatio + BI.pixUnit
});
json.textAlign = o.textAlign;
+ delete json.maxWidth;
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
@@ -175,6 +176,7 @@
"line-height": o.height / BI.pixRatio + BI.pixUnit
});
json.textAlign = o.textAlign;
+ delete json.maxWidth;
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
@@ -251,6 +253,7 @@
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
});
}
+ delete json.maxWidth;
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
@@ -309,6 +312,7 @@
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
});
}
+ delete json.maxWidth;
this.text = BI.createWidget(BI.extend(json, { // 2.6
element: this,
hgap: o.hgap,
diff --git a/src/base/single/label/icon.label.js b/src/base/single/label/icon.label.js
index 6575564b1..b5779c3e5 100644
--- a/src/base/single/label/icon.label.js
+++ b/src/base/single/label/icon.label.js
@@ -7,6 +7,12 @@ BI.IconLabel = BI.inherit(BI.Single, {
props: {
baseCls: "bi-icon-label horizon-center",
+ hgap: 0,
+ vgap: 0,
+ tgap: 0,
+ bgap: 0,
+ lgap: 0,
+ rgap: 0,
iconWidth: null,
iconHeight: null,
lineHeight: null,
@@ -27,6 +33,12 @@ BI.IconLabel = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.default",
element: this,
+ hgap: o.hgap,
+ vgap: o.vgap,
+ lgap: o.lgap,
+ rgap: o.rgap,
+ tgap: o.tgap,
+ bgap: o.bgap,
items: [this.icon]
});
} else {
@@ -34,6 +46,12 @@ BI.IconLabel = BI.inherit(BI.Single, {
BI.createWidget({
element: this,
type: "bi.center_adapt",
+ hgap: o.hgap,
+ vgap: o.vgap,
+ lgap: o.lgap,
+ rgap: o.rgap,
+ tgap: o.tgap,
+ bgap: o.bgap,
items: [this.icon]
});
}
diff --git a/src/base/single/text.pure.js b/src/base/single/text.pure.js
index eb7f6e323..7c4d93c0c 100644
--- a/src/base/single/text.pure.js
+++ b/src/base/single/text.pure.js
@@ -10,7 +10,9 @@
render: function () {
var self = this, o = this.options;
- var text = this._getShowText();
+ var text = BI.isFunction(o.text) ? this.__watch(o.text, function (context, newValue) {
+ self.setText(newValue);
+ }) : o.text;
if (BI.isKey(text)) {
this.setText(text);
} else if (BI.isKey(o.value)) {
diff --git a/src/base/single/tip/tip.toast.js b/src/base/single/tip/tip.toast.js
index afd444fd1..ffbf2b336 100644
--- a/src/base/single/tip/tip.toast.js
+++ b/src/base/single/tip/tip.toast.js
@@ -7,22 +7,28 @@
*/
BI.Toast = BI.inherit(BI.Tip, {
_const: {
- minWidth: 200,
- hgap: 10
+ closableMinWidth: 146,
+ minWidth: 124,
+ closableMaxWidth: 410,
+ maxWidth: 400,
+ hgap: 8
},
_defaultConfig: function () {
return BI.extend(BI.Toast.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-toast",
text: "",
- level: "success" // success或warning
+ level: "success", // success或warning
+ autoClose: true,
+ closable: null
});
},
render: function () {
- var self = this, o = this.options;
+ var self = this, o = this.options, c = this._const;
this.element.css({
- minWidth: this._const.minWidth / BI.pixRatio + BI.pixUnit
+ minWidth: (o.closable ? c.closableMinWidth : c.minWidth) / BI.pixRatio + BI.pixUnit,
+ maxWidth: (o.closable ? c.closableMaxWidth : c.maxWidth) / BI.pixRatio + BI.pixUnit
});
this.element.addClass("toast-" + o.level);
var fn = function (e) {
@@ -56,24 +62,27 @@ BI.Toast = BI.inherit(BI.Tip, {
break;
}
+ var hasCloseIcon = function () {
+ return o.closable === true || (o.closable === null && o.autoClose === false);
+ };
var items = [{
type: "bi.icon_label",
cls: cls + " toast-icon",
width: 36
}, {
- el: {
+ el: BI.isPlainObject(o.text) ? o.text : {
type: "bi.label",
whiteSpace: "normal",
text: o.text,
textHeight: 16,
textAlign: "left"
},
- rgap: o.autoClose ? this._const.hgap : 0
+ rgap: hasCloseIcon() ? 0 : this._const.hgap
}];
var columnSize = [36, "fill"];
- if (o.autoClose === false) {
+ if (hasCloseIcon()) {
items.push({
type: "bi.icon_button",
cls: "close-font toast-icon",
@@ -90,7 +99,7 @@ BI.Toast = BI.inherit(BI.Tip, {
horizontalAlign: BI.HorizontalAlign.Stretch,
element: this,
items: items,
- vgap: 7,
+ vgap: 12,
columnSize: columnSize
});
},
diff --git a/src/case/button/item.multiselect.js b/src/case/button/item.multiselect.js
index 965363418..f72ea6e12 100644
--- a/src/case/button/item.multiselect.js
+++ b/src/case/button/item.multiselect.js
@@ -7,54 +7,66 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-multi-select-item",
- height: 24,
+ attributes: {
+ tabIndex: 1
+ },
+ height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
logic: {
dynamic: false
},
iconWrapperWidth: 26,
- textHgap: 0,
- textLgap: 0,
- textRgap: 0
});
},
- _init: function () {
- BI.MultiSelectItem.superclass._init.apply(this, arguments);
+
+ render: function () {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.checkbox"
});
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- whiteSpace: "nowrap",
- textHeight: o.height,
- height: o.height,
- hgap: o.hgap,
- rgap: o.rgap,
- lgap: o.textLgap,
- text: o.text,
- keyword: o.keyword,
- value: o.value,
- py: o.py
- });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
});
-
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", {
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [{
type: "bi.center_adapt",
- items: [this.checkbox],
- width: o.iconWrapperWidth
- }, this.text)
- }))));
+ items: [this.checkbox]
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ whiteSpace: "nowrap",
+ textHeight: o.height,
+ height: o.height,
+ hgap: o.textHgap,
+ rgap: o.textRgap,
+ lgap: o.textLgap,
+ vgap: o.textVgap,
+ text: o.text,
+ keyword: o.keyword,
+ value: o.value,
+ py: o.py
+ }
+ }]
+ };
},
+ // _setEnable: function (enable) {
+ // BI.MultiSelectItem.superclass._setEnable.apply(this, arguments);
+ // if (enable === true) {
+ // this.element.attr("tabIndex", 1);
+ // } else if (enable === false) {
+ // this.element.removeAttr("tabIndex");
+ // }
+ // },
+
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/case/button/item.singleselect.icontext.js b/src/case/button/item.singleselect.icontext.js
index 1a70d4c01..47960e9fa 100644
--- a/src/case/button/item.singleselect.icontext.js
+++ b/src/case/button/item.singleselect.icontext.js
@@ -8,12 +8,15 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectIconTextItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-icon-text-item bi-list-item-active",
+ attributes: {
+ tabIndex: 1
+ },
iconCls: "",
- height: 24
+ height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT
});
},
- _init: function () {
- BI.SingleSelectIconTextItem.superclass._init.apply(this, arguments);
+
+ render: function () {
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.icon_text_item",
@@ -25,6 +28,10 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, {
height: o.height,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
+ textHgap: o.textHgap,
+ textVgap: o.textVgap,
+ textLgap: o.textLgap,
+ textRgap: o.textRgap,
text: o.text,
keyword: o.keyword,
value: o.value,
@@ -35,6 +42,15 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, {
});
},
+ _setEnable: function (enable) {
+ BI.SingleSelectIconTextItem.superclass._setEnable.apply(this, arguments);
+ if (enable === true) {
+ this.element.attr("tabIndex", 1);
+ } else if (enable === false) {
+ this.element.removeAttr("tabIndex");
+ }
+ },
+
isSelected: function () {
return this.text.isSelected();
},
@@ -49,11 +65,7 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, {
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
- },
-
- doClick: function () {
- BI.SingleSelectIconTextItem.superclass.doClick.apply(this, arguments);
}
});
-BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem);
\ No newline at end of file
+BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem);
diff --git a/src/case/button/item.singleselect.js b/src/case/button/item.singleselect.js
index 910b579cd..50a1cf6db 100644
--- a/src/case/button/item.singleselect.js
+++ b/src/case/button/item.singleselect.js
@@ -2,13 +2,16 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-item bi-list-item-active",
- hgap: 10,
- height: 24,
+ attributes: {
+ tabIndex: 1
+ },
+ textHgap: 10,
+ height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
textAlign: "left"
});
},
- _init: function () {
- BI.SingleSelectItem.superclass._init.apply(this, arguments);
+
+ render: function () {
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
@@ -17,16 +20,26 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, {
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
- hgap: o.hgap,
+ hgap: o.hgap || o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
text: o.text,
keyword: o.keyword,
value: o.value,
- title: o.title || o.text,
- warningTitle: o.warningTitle,
py: o.py
});
},
+ _setEnable: function (enable) {
+ BI.SingleSelectItem.superclass._setEnable.apply(this, arguments);
+ if (enable === true) {
+ this.element.attr("tabIndex", 1);
+ } else if (enable === false) {
+ this.element.removeAttr("tabIndex");
+ }
+ },
+
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
@@ -48,4 +61,4 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, {
});
BI.SingleSelectItem.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.single_select_item", BI.SingleSelectItem);
\ No newline at end of file
+BI.shortcut("bi.single_select_item", BI.SingleSelectItem);
diff --git a/src/case/button/item.singleselect.radio.js b/src/case/button/item.singleselect.radio.js
index 0c6a55d3e..882f912e9 100644
--- a/src/case/button/item.singleselect.radio.js
+++ b/src/case/button/item.singleselect.radio.js
@@ -7,48 +7,62 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-radio-item",
+ attributes: {
+ tabIndex: 1
+ },
logic: {
dynamic: false
},
- height: 24,
+ height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 16,
- hgap: 10,
- textHgap: 0,
- textLgap: 0,
- textRgap: 0
+ textHgap: 10,
});
},
- _init: function () {
- BI.SingleSelectRadioItem.superclass._init.apply(this, arguments);
- var self = this, o = this.options;
- this.radio = BI.createWidget({
- type: "bi.radio"
- });
- this.text = BI.createWidget({
- type: "bi.label",
- cls: "list-item-text",
- textAlign: "left",
- whiteSpace: "nowrap",
- textHeight: o.height,
- height: o.height,
- hgap: o.hgap,
- rgap: o.textRgap,
- lgap: o.textLgap,
- text: o.text,
- keyword: o.keyword,
- value: o.value,
- py: o.py
- });
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("left", {
+ render: function () {
+ var self = this, o = this.options;
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [{
type: "bi.center_adapt",
- items: [this.radio],
- width: o.iconWrapperWidth
- }, this.text)
- }))));
+ items: [{
+ type: "bi.radio",
+ ref: function (_ref) {
+ self.radio = _ref;
+ },
+ }]
+ }, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ cls: "list-item-text",
+ textAlign: "left",
+ whiteSpace: "nowrap",
+ textHeight: o.height,
+ height: o.height,
+ hgap: o.hgap || o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ keyword: o.keyword,
+ value: o.value,
+ py: o.py
+ }
+ }]
+ };
+ },
+
+ _setEnable: function (enable) {
+ BI.SingleSelectRadioItem.superclass._setEnable.apply(this, arguments);
+ if (enable === true) {
+ this.element.attr("tabIndex", 1);
+ } else if (enable === false) {
+ this.element.removeAttr("tabIndex");
+ }
},
doRedMark: function () {
diff --git a/src/case/button/node/node.arrow.js b/src/case/button/node/node.arrow.js
index 38fe40ffb..6fc690d7b 100644
--- a/src/case/button/node/node.arrow.js
+++ b/src/case/button/node/node.arrow.js
@@ -16,43 +16,42 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
iconWrapperWidth: 16
});
},
- _init: function () {
+
+ render: function () {
var self = this, o = this.options;
- BI.ArrowNode.superclass._init.apply(this, arguments);
this.checkbox = BI.createWidget({
type: "bi.arrow_group_node_checkbox"
});
-
- this.text = BI.createWidget({
- type: "bi.label",
- textAlign: "left",
- whiteSpace: "nowrap",
- textHeight: o.height,
- height: o.height,
- hgap: o.hgap,
- text: o.text,
- value: o.value,
- py: o.py,
- keyword: o.keyword
- });
-
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
-
- var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
- var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: o.iconWrapperWidth,
- el: this.checkbox
- }, this.text);
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
- items: items
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [this.checkbox, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ whiteSpace: "nowrap",
+ textHeight: o.height,
+ height: o.height,
+ hgap: o.hgap || o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ py: o.py,
+ keyword: o.keyword
+ }
+ }]
+ };
},
doRedMark: function () {
diff --git a/src/case/button/node/node.first.plus.js b/src/case/button/node/node.first.plus.js
index 7969867fb..989cdec0b 100644
--- a/src/case/button/node/node.first.plus.js
+++ b/src/case/button/node/node.first.plus.js
@@ -23,7 +23,9 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.first_tree_node_checkbox",
- stopPropagation: true
+ stopPropagation: true,
+ iconHeight: o.height,
+ iconWidth: o.height
});
this.text = BI.createWidget({
type: "bi.label",
@@ -48,7 +50,7 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
diff --git a/src/case/button/node/node.last.plus.js b/src/case/button/node/node.last.plus.js
index acc72d6a3..c1a949e3b 100644
--- a/src/case/button/node/node.last.plus.js
+++ b/src/case/button/node/node.last.plus.js
@@ -23,7 +23,9 @@ BI.LastPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.last_tree_node_checkbox",
- stopPropagation: true
+ stopPropagation: true,
+ iconHeight: o.height,
+ iconWidth: o.height
});
this.text = BI.createWidget({
type: "bi.label",
@@ -48,7 +50,7 @@ BI.LastPlusGroupNode = BI.inherit(BI.NodeButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
diff --git a/src/case/button/node/node.mid.plus.js b/src/case/button/node/node.mid.plus.js
index 4615ce7b9..839565114 100644
--- a/src/case/button/node/node.mid.plus.js
+++ b/src/case/button/node/node.mid.plus.js
@@ -23,7 +23,9 @@ BI.MidPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.mid_tree_node_checkbox",
- stopPropagation: true
+ stopPropagation: true,
+ iconHeight: o.height,
+ iconWidth: o.height
});
this.text = BI.createWidget({
type: "bi.label",
@@ -48,7 +50,7 @@ BI.MidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
diff --git a/src/case/button/node/node.plus.js b/src/case/button/node/node.plus.js
index 16b78b8f1..ec38ca0e0 100644
--- a/src/case/button/node/node.plus.js
+++ b/src/case/button/node/node.plus.js
@@ -15,26 +15,17 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
id: "",
pId: "",
open: false,
+ iconWrapperWidth: null,
height: 24
});
},
- _init: function () {
- BI.PlusGroupNode.superclass._init.apply(this, arguments);
+
+ render: function () {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
- type: "bi.tree_node_checkbox"
- });
- this.text = BI.createWidget({
- type: "bi.label",
- textAlign: "left",
- whiteSpace: "nowrap",
- textHeight: o.height,
- height: o.height,
- hgap: o.hgap,
- text: o.text,
- value: o.value,
- keyword: o.keyword,
- py: o.py
+ type: "bi.tree_node_checkbox",
+ iconHeight: o.height,
+ iconWidth: o.iconWrapperWidth || o.height
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
@@ -42,16 +33,30 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
- var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
- var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: 24,
- el: this.checkbox
- }, this.text);
- BI.createWidget(BI.extend({
- element: this
- }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
- items: items
- }))));
+ return {
+ type: "bi.vertical_adapt",
+ columnSize: [o.iconWrapperWidth || o.height, "fill"],
+ items: [this.checkbox, {
+ el: {
+ type: "bi.label",
+ ref: function (_ref) {
+ self.text = _ref;
+ },
+ textAlign: "left",
+ whiteSpace: "nowrap",
+ textHeight: o.height,
+ height: o.height,
+ hgap: o.hgap || o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ text: o.text,
+ value: o.value,
+ keyword: o.keyword,
+ py: o.py
+ }
+ }]
+ };
},
doRedMark: function () {
@@ -75,4 +80,4 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
-BI.shortcut("bi.plus_group_node", BI.PlusGroupNode);
\ No newline at end of file
+BI.shortcut("bi.plus_group_node", BI.PlusGroupNode);
diff --git a/src/case/button/switch.js b/src/case/button/switch.js
index 5ae460960..e88360266 100644
--- a/src/case/button/switch.js
+++ b/src/case/button/switch.js
@@ -3,17 +3,26 @@
*/
BI.Switch = BI.inherit(BI.BasicButton, {
+ constants: {
+ CIRCLE_SIZE: 12
+ },
+
props: {
extraCls: "bi-switch",
- height: 22,
+ attributes: {
+ tabIndex: 1
+ },
+ height: 20,
width: 44,
logic: {
dynamic: false
- }
+ },
+ showTip: false
},
render: function () {
- var self = this;
+ var self = this, o = this.options, c = this.constants;
+ var tgap = (o.height - c.CIRCLE_SIZE) / 2;
return {
type: "bi.absolute",
ref: function () {
@@ -22,20 +31,51 @@ BI.Switch = BI.inherit(BI.BasicButton, {
items: [{
el: {
type: "bi.text_button",
- cls: "circle-button bi-card"
+ cls: "circle-button"
},
- width: 18,
- height: 18,
- top: 2,
- left: this.options.selected ? 24 : 2
+ width: 12,
+ height: 12,
+ top: tgap,
+ left: this.options.selected ? 28 : 4
+ }, {
+ type: "bi.label",
+ text: BI.i18nText("BI-Basic_Open"),
+ cls: "content-tip",
+ left: 8,
+ top: tgap - 2,
+ invisible: !o.showTip,
+ ref: function (ref) {
+ self.openTip = ref;
+ }
+ }, {
+ type: "bi.label",
+ text: BI.i18nText("BI-Basic_Close"),
+ cls: "content-tip",
+ right: 8,
+ top: tgap - 2,
+ invisible: !o.showTip,
+ ref: function (ref) {
+ self.closeTip = ref;
+ }
}]
};
},
+ _setEnable: function (enable) {
+ BI.Switch.superclass._setEnable.apply(this, arguments);
+ if (enable === true) {
+ this.element.attr("tabIndex", 1);
+ } else if (enable === false) {
+ this.element.removeAttr("tabIndex");
+ }
+ },
+
setSelected: function (v) {
BI.Switch.superclass.setSelected.apply(this, arguments);
- this.layout.attr("items")[0].left = v ? 24 : 2;
+ this.layout.attr("items")[0].left = v ? 28 : 4;
this.layout.resize();
+ this.options.showTip && this.openTip.setVisible(v);
+ this.options.showTip && this.closeTip.setVisible(!v);
},
doClick: function () {
@@ -44,4 +84,4 @@ BI.Switch = BI.inherit(BI.BasicButton, {
}
});
BI.Switch.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.switch", BI.Switch);
\ No newline at end of file
+BI.shortcut("bi.switch", BI.Switch);
diff --git a/src/case/button/treeitem/item.first.treeleaf.js b/src/case/button/treeitem/item.first.treeleaf.js
index afaa2f6fc..52663de39 100644
--- a/src/case/button/treeitem/item.first.treeleaf.js
+++ b/src/case/button/treeitem/item.first.treeleaf.js
@@ -28,19 +28,19 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
- width: 12,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: {
type: "bi.layout",
- cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
- width: 12,
+ cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height
}
}), {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: {
type: "bi.layout",
- cls: "first-line-conn-background",
- width: 24,
+ cls: this._getFirstLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height
}
}, {
@@ -53,6 +53,24 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
}))));
},
+ _getBaseLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "base-solid-line-conn-background";
+ default:
+ return "base-line-conn-background";
+ }
+ },
+
+ _getFirstLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "first-solid-line-conn-background";
+ default:
+ return "first-line-conn-background";
+ }
+ },
+
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/case/button/treeitem/item.last.treeleaf.js b/src/case/button/treeitem/item.last.treeleaf.js
index 8b30892a3..76449063e 100644
--- a/src/case/button/treeitem/item.last.treeleaf.js
+++ b/src/case/button/treeitem/item.last.treeleaf.js
@@ -28,19 +28,19 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
- width: 12,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: {
type: "bi.layout",
- cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
- width: 12,
+ cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height
}
}), {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: {
type: "bi.layout",
- cls: "last-line-conn-background",
- width: 24,
+ cls: this._getLastLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height
}
}, {
@@ -53,6 +53,24 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
}))));
},
+ _getBaseLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "base-solid-line-conn-background";
+ default:
+ return "base-line-conn-background";
+ }
+ },
+
+ _getLastLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "last-solid-line-conn-background";
+ default:
+ return "last-line-conn-background";
+ }
+ },
+
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/case/button/treeitem/item.mid.treeleaf.js b/src/case/button/treeitem/item.mid.treeleaf.js
index a3a7a6c93..58af36e4e 100644
--- a/src/case/button/treeitem/item.mid.treeleaf.js
+++ b/src/case/button/treeitem/item.mid.treeleaf.js
@@ -28,19 +28,19 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
- width: 12,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: {
type: "bi.layout",
- cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
- width: 12,
+ cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height
}
}), {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: {
type: "bi.layout",
- cls: "mid-line-conn-background",
- width: 24,
+ cls: this._getMidLineCls(),
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height
}
}, {
@@ -53,6 +53,24 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
}))));
},
+ _getBaseLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "base-solid-line-conn-background";
+ default:
+ return "base-line-conn-background";
+ }
+ },
+
+ _getMidLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "mid-solid-line-conn-background";
+ default:
+ return "mid-line-conn-background";
+ }
+ },
+
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
diff --git a/src/case/button/treeitem/item.root.treeleaf.js b/src/case/button/treeitem/item.root.treeleaf.js
index 8e1a9a02f..f4637afdc 100644
--- a/src/case/button/treeitem/item.root.treeleaf.js
+++ b/src/case/button/treeitem/item.root.treeleaf.js
@@ -31,10 +31,10 @@ BI.RootTreeLeafItem = BI.inherit(BI.BasicButton, {
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: {
type: "bi.layout",
- width: 24,
+ width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height
}
}, {
diff --git a/src/case/calendar/calendar.date.item.js b/src/case/calendar/calendar.date.item.js
index b8ee105c6..d575b9557 100644
--- a/src/case/calendar/calendar.date.item.js
+++ b/src/case/calendar/calendar.date.item.js
@@ -2,6 +2,11 @@
* 专门为calendar的视觉加的button,作为私有button,不能配置任何属性,也不要用这个玩意
*/
BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
+ props: function() {
+ return {
+ height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 8,
+ }
+ },
render: function () {
var self = this, o = this.options;
@@ -10,7 +15,7 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
items: [{
el: {
type: "bi.text_item",
- cls: "bi-list-item-select",
+ cls: "bi-border-radius bi-list-item-select",
textAlign: "center",
whiteSpace: "normal",
text: o.text,
@@ -21,8 +26,8 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
},
left: o.lgap,
right: o.rgap,
- top: 0,
- bottom: 0
+ top: o.tgap,
+ bottom: o.bgap
}]
};
},
@@ -50,4 +55,4 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
return this.text.getValue();
}
});
-BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem);
\ No newline at end of file
+BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem);
diff --git a/src/case/calendar/calendar.js b/src/case/calendar/calendar.js
index fb762da7e..f5a99e37d 100644
--- a/src/case/calendar/calendar.js
+++ b/src/case/calendar/calendar.js
@@ -96,12 +96,12 @@ BI.Calendar = BI.inherit(BI.Widget, {
this.days = BI.createWidget({
type: "bi.button_group",
items: BI.createItems(this._getItems(), {}),
+ value: o.year + "-" + o.month + "-" + o.day,
layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, {
columns: 7,
rows: 6,
columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7],
- rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
- vgap: 10
+ rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 8
}))]
});
this.days.on(BI.Controller.EVENT_CHANGE, function () {
@@ -111,7 +111,10 @@ BI.Calendar = BI.inherit(BI.Widget, {
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, {
- items: BI.LogicFactory.createLogicItemsByDirection("top", title, this.days)
+ items: BI.LogicFactory.createLogicItemsByDirection("top", title, {
+ el: this.days,
+ tgap: -5
+ })
}))));
},
@@ -159,11 +162,12 @@ BI.Calendar = BI.inherit(BI.Widget, {
whiteSpace: "normal",
once: false,
forceSelected: true,
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
value: o.year + "-" + month + "-" + td.text,
disabled: td.lastMonth || td.nextMonth || td.disabled,
- lgap: 5,
- rgap: 5
+ lgap: 2,
+ rgap: 2,
+ tgap: 4,
+ bgap: 4
// selected: td.currentDay
});
});
@@ -231,4 +235,4 @@ BI.extend(BI.Calendar, {
}
});
-BI.shortcut("bi.calendar", BI.Calendar);
\ No newline at end of file
+BI.shortcut("bi.calendar", BI.Calendar);
diff --git a/src/case/calendar/calendar.year.js b/src/case/calendar/calendar.year.js
index 7de781159..95fcaccdb 100644
--- a/src/case/calendar/calendar.year.js
+++ b/src/case/calendar/calendar.year.js
@@ -54,7 +54,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
})), {
type: "bi.center_adapt",
- vgap: 1
+ vgap: 2
}]
});
this.years.on(BI.Controller.EVENT_CHANGE, function () {
@@ -62,8 +62,10 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
});
BI.createWidget(BI.extend({
element: this
-
}, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, {
+ scrolly: true,
+ vgap: 5,
+ hgap: 6,
items: BI.LogicFactory.createLogicItemsByDirection("top", this.years)
}))));
},
@@ -105,7 +107,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
return BI.map(item, function (j, td) {
return BI.extend(td, {
type: "bi.text_item",
- cls: "bi-list-item-select",
+ cls: "bi-list-item-select bi-border-radius",
textAlign: "center",
whiteSpace: "normal",
once: false,
@@ -168,4 +170,4 @@ BI.extend(BI.YearCalendar, {
}
});
-BI.shortcut("bi.year_calendar", BI.YearCalendar);
\ No newline at end of file
+BI.shortcut("bi.year_calendar", BI.YearCalendar);
diff --git a/src/case/checkbox/check.arrownode.js b/src/case/checkbox/check.arrownode.js
index ebcb784d7..26447aca6 100644
--- a/src/case/checkbox/check.arrownode.js
+++ b/src/case/checkbox/check.arrownode.js
@@ -5,7 +5,7 @@
BI.ArrowTreeGroupNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend(BI.ArrowTreeGroupNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "bi-arrow-group-node-checkbox"
+ extraCls: "bi-arrow-group-node-checkbox expander-right-font"
});
},
@@ -18,4 +18,4 @@ BI.ArrowTreeGroupNodeCheckbox = BI.inherit(BI.IconButton, {
}
}
});
-BI.shortcut("bi.arrow_group_node_checkbox", BI.ArrowTreeGroupNodeCheckbox);
\ No newline at end of file
+BI.shortcut("bi.arrow_group_node_checkbox", BI.ArrowTreeGroupNodeCheckbox);
diff --git a/src/case/checkbox/check.checkingmarknode.js b/src/case/checkbox/check.checkingmarknode.js
index d801828ed..b3996691e 100644
--- a/src/case/checkbox/check.checkingmarknode.js
+++ b/src/case/checkbox/check.checkingmarknode.js
@@ -6,14 +6,9 @@
BI.CheckingMarkNode = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.CheckingMarkNode.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "check-mark-font"
});
},
- _init: function () {
- BI.CheckingMarkNode.superclass._init.apply(this, arguments);
- this.setSelected(this.options.selected);
- },
setSelected: function (v) {
BI.CheckingMarkNode.superclass.setSelected.apply(this, arguments);
if(v === true) {
@@ -23,4 +18,4 @@ BI.CheckingMarkNode = BI.inherit(BI.IconButton, {
}
}
});
-BI.shortcut("bi.checking_mark_node", BI.CheckingMarkNode);
\ No newline at end of file
+BI.shortcut("bi.checking_mark_node", BI.CheckingMarkNode);
diff --git a/src/case/checkbox/check.first.treenode.js b/src/case/checkbox/check.first.treenode.js
index 572908d8d..aa808488f 100644
--- a/src/case/checkbox/check.first.treenode.js
+++ b/src/case/checkbox/check.first.treenode.js
@@ -6,18 +6,27 @@
BI.FirstTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "tree-collapse-icon-type2",
+ extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type2" : "tree-collapse-icon-type2",
iconWidth: 24,
iconHeight: 24
});
},
+ getLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "tree-solid-expand-icon-type2";
+ default:
+ return "tree-expand-icon-type2";
+ }
+ },
+
setSelected: function (v) {
BI.FirstTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if(v === true) {
- this.element.addClass("tree-expand-icon-type2");
+ this.element.addClass(this.getLineCls());
} else {
- this.element.removeClass("tree-expand-icon-type2");
+ this.element.removeClass(this.getLineCls());
}
}
});
diff --git a/src/case/checkbox/check.last.treenode.js b/src/case/checkbox/check.last.treenode.js
index e0a9f621d..cb536f8cc 100644
--- a/src/case/checkbox/check.last.treenode.js
+++ b/src/case/checkbox/check.last.treenode.js
@@ -6,18 +6,27 @@
BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend(BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "tree-collapse-icon-type4",
+ extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type4" : "tree-collapse-icon-type4",
iconWidth: 24,
iconHeight: 24
});
},
+ getLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "tree-solid-expand-icon-type4";
+ default:
+ return "tree-expand-icon-type4";
+ }
+ },
+
setSelected: function (v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if (v === true) {
- this.element.addClass("tree-expand-icon-type4");
+ this.element.addClass(this.getLineCls());
} else {
- this.element.removeClass("tree-expand-icon-type4");
+ this.element.removeClass(this.getLineCls());
}
}
});
diff --git a/src/case/checkbox/check.mid.treenode.js b/src/case/checkbox/check.mid.treenode.js
index 7679b466e..7ec4e5230 100644
--- a/src/case/checkbox/check.mid.treenode.js
+++ b/src/case/checkbox/check.mid.treenode.js
@@ -6,18 +6,27 @@
BI.MidTreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "tree-collapse-icon-type3",
+ extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type3" : "tree-collapse-icon-type3",
iconWidth: 24,
iconHeight: 24
});
},
+ getLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "tree-solid-expand-icon-type3";
+ default:
+ return "tree-expand-icon-type3";
+ }
+ },
+
setSelected: function (v) {
BI.MidTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if(v === true) {
- this.element.addClass("tree-expand-icon-type3");
+ this.element.addClass(this.getLineCls());
} else {
- this.element.removeClass("tree-expand-icon-type3");
+ this.element.removeClass(this.getLineCls());
}
}
});
diff --git a/src/case/checkbox/check.treenode.js b/src/case/checkbox/check.treenode.js
index b5642aae4..128bb73c6 100644
--- a/src/case/checkbox/check.treenode.js
+++ b/src/case/checkbox/check.treenode.js
@@ -6,18 +6,27 @@
BI.TreeNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend( BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
- extraCls: "tree-collapse-icon-type1",
+ extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type1" : "tree-collapse-icon-type1",
iconWidth: 24,
iconHeight: 24
});
},
+ getLineCls: function () {
+ switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
+ case "solid":
+ return "tree-solid-expand-icon-type1";
+ default:
+ return "tree-expand-icon-type1";
+ }
+ },
+
setSelected: function (v) {
BI.TreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if(v) {
- this.element.addClass("tree-expand-icon-type1");
+ this.element.addClass(this.getLineCls());
} else {
- this.element.removeClass("tree-expand-icon-type1");
+ this.element.removeClass(this.getLineCls());
}
}
});
diff --git a/src/case/colorchooser/colorchooser.custom.js b/src/case/colorchooser/colorchooser.custom.js
index 49091a10a..c34d92500 100644
--- a/src/case/colorchooser/colorchooser.custom.js
+++ b/src/case/colorchooser/colorchooser.custom.js
@@ -19,13 +19,15 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.editor, {
- type: "bi.simple_hex_color_picker_editor"
+ type: "bi.simple_hex_color_picker_editor",
+ value: o.value
});
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
self.setValue(this.getValue());
});
this.farbtastic = BI.createWidget({
- type: "bi.farbtastic"
+ type: "bi.farbtastic",
+ value: o.value
});
this.farbtastic.on(BI.Farbtastic.EVENT_CHANGE, function () {
self.setValue(this.getValue());
@@ -66,4 +68,4 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
}
});
BI.CustomColorChooser.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.custom_color_chooser", BI.CustomColorChooser);
\ No newline at end of file
+BI.shortcut("bi.custom_color_chooser", BI.CustomColorChooser);
diff --git a/src/case/colorchooser/colorchooser.js b/src/case/colorchooser/colorchooser.js
index 698afa714..737b3a189 100644
--- a/src/case/colorchooser/colorchooser.js
+++ b/src/case/colorchooser/colorchooser.js
@@ -33,6 +33,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.trigger = _ref;
},
+ value: o.value,
width: o.el.type ? o.width : o.width - 2,
height: o.el.type ? o.height : o.height - 2
}, o.el),
diff --git a/src/case/colorchooser/colorchooser.popup.hex.js b/src/case/colorchooser/colorchooser.popup.hex.js
index 347dd0401..b8c98cb36 100644
--- a/src/case/colorchooser/colorchooser.popup.hex.js
+++ b/src/case/colorchooser/colorchooser.popup.hex.js
@@ -16,32 +16,59 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options;
var hasRecommendColors = BI.isNotNull(o.recommendColorsGetter());
return [{
- el: {
- type: 'bi.vertical',
- items: [{
- el: {
- type: "bi.vertical",
- hgap: 15,
- items: [BI.extend({
- type: o.simple ? "bi.simple_hex_color_picker_editor" : "bi.hex_color_picker_editor",
+ type: "bi.vertical",
+ items: [{
+ el: {
+ type: "bi.vertical",
+ hgap: 15,
+ items: [BI.extend({
+ type: o.simple ? "bi.simple_hex_color_picker_editor" : "bi.hex_color_picker_editor",
+ value: o.value,
+ height: o.simple ? 36 : 70,
+ listeners: [{
+ eventName: BI.ColorPickerEditor.EVENT_CHANGE,
+ action: function () {
+ self.setValue(this.getValue());
+ self._dealStoreColors();
+ self.fireEvent(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
+ }
+ }],
+ ref: function (_ref) {
+ self.colorEditor = _ref;
+ }
+ }, o.editor), {
+ el: {
+ type: "bi.hex_color_picker",
+ cls: "bi-border-bottom bi-border-right",
+ items: [this._digestStoreColors(this._getStoreColors())],
+ height: 22,
value: o.value,
- height: o.simple ? 36 : 70,
listeners: [{
- eventName: BI.ColorPickerEditor.EVENT_CHANGE,
+ eventName: BI.ColorPicker.EVENT_CHANGE,
action: function () {
- self.setValue(this.getValue());
+ self.setValue(this.getValue()[0]);
self._dealStoreColors();
- self.fireEvent(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
+ self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
}
}],
ref: function (_ref) {
- self.colorEditor = _ref;
+ self.storeColors = _ref;
}
- }, o.editor), {
- el: {
+ },
+ tgap: 10,
+ height: 22
+ }, {
+ el: hasRecommendColors ? {
+ type: "bi.vertical",
+ items: [{
+ type: "bi.label",
+ text: BI.i18nText("BI-Basic_Recommend_Color"),
+ textAlign: "left",
+ height: 24
+ }, {
type: "bi.hex_color_picker",
cls: "bi-border-bottom bi-border-right",
- items: [this._digestStoreColors(this._getStoreColors())],
+ items: [this._digestStoreColors(o.recommendColorsGetter())],
height: 22,
value: o.value,
listeners: [{
@@ -53,144 +80,112 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
}
}],
ref: function (_ref) {
- self.storeColors = _ref;
+ self.recommendColors = _ref;
}
- },
- tgap: 10,
- height: 22
- }, {
- el: hasRecommendColors ? {
- type: 'bi.vertical',
- items: [{
- type: 'bi.label',
- text: BI.i18nText('BI-Basic_Recommend_Color'),
- textAlign: 'left',
- height: 24,
- }, {
- type: "bi.hex_color_picker",
- cls: "bi-border-bottom bi-border-right",
- items: [this._digestStoreColors(o.recommendColorsGetter())],
- height: 22,
- value: o.value,
- listeners: [{
- eventName: BI.ColorPicker.EVENT_CHANGE,
- action: function () {
- self.setValue(this.getValue()[0]);
- self._dealStoreColors();
- self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
- }
- }],
- ref: function (_ref) {
- self.recommendColors = _ref;
- }
- }]
- } : { type: 'bi.layout' },
- tgap: hasRecommendColors ? 10 : 0,
- height: hasRecommendColors ? 47 : 0
- }, {
- el: {
- type: 'bi.layout',
- cls: 'bi-border-top',
- },
- vgap: 10,
- height: 1
- }, {
- type: 'bi.absolute',
- items: [{
- el: {
- type: "bi.hex_color_picker",
- space: true,
- value: o.value,
- listeners: [{
- eventName: BI.ColorPicker.EVENT_CHANGE,
- action: function () {
- self.setValue(this.getValue()[0]);
- self._dealStoreColors();
- self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
- }
- }],
- ref: function (_ref) {
- self.colorPicker = _ref;
- },
- },
- top: 0,
- left: 0,
- right: 0,
- bottom: 1,
- }],
- height: 80,
- }]
- }
- }, {
- el: {
- type: "bi.combo",
- cls: "bi-border-top",
- container: null,
- direction: "right,top",
- isNeedAdjustHeight: false,
+ }]
+ } : {type: "bi.layout"},
+ tgap: hasRecommendColors ? 10 : 0,
+ height: hasRecommendColors ? 47 : 0
+ }, {
el: {
- type: "bi.text_item",
- cls: "color-chooser-popup-more bi-list-item",
- textAlign: "center",
- height: 24,
- textLgap: 10,
- text: BI.i18nText("BI-Basic_More") + "..."
+ type: "bi.layout",
+ cls: "bi-border-top"
},
- popup: {
- type: "bi.popup_panel",
- buttons: [BI.i18nText("BI-Basic_Cancel"), BI.i18nText("BI-Basic_Save")],
- title: BI.i18nText("BI-Custom_Color"),
+ vgap: 10,
+ height: 1
+ }, {
+ type: "bi.absolute",
+ items: [{
el: {
- type: "bi.custom_color_chooser",
- editor: o.editor,
+ type: "bi.hex_color_picker",
+ space: true,
+ value: o.value,
+ listeners: [{
+ eventName: BI.ColorPicker.EVENT_CHANGE,
+ action: function () {
+ self.setValue(this.getValue()[0]);
+ self._dealStoreColors();
+ self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
+ }
+ }],
ref: function (_ref) {
- self.customColorChooser = _ref;
+ self.colorPicker = _ref;
}
},
- stopPropagation: false,
- bgap: -1,
- rgap: 1,
- lgap: 1,
- minWidth: 227,
- listeners: [{
- eventName: BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON,
- action: function (index) {
- switch (index) {
- case 0:
- self.more.hideView();
- break;
- case 1:
- var color = self.customColorChooser.getValue();
- // farbtastic选择器没有透明和自动选项,点击保存不应该设置透明
- if (BI.isNotEmptyString(color)) {
- self.setValue(color);
- self._dealStoreColors();
- }
- self.more.hideView();
- self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
- break;
- }
- }
- }]
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 1
+ }],
+ height: 80
+ }]
+ }
+ }, {
+ el: {
+ type: "bi.combo",
+ cls: "bi-border-top",
+ container: null,
+ direction: "right,top",
+ isNeedAdjustHeight: false,
+ el: {
+ type: "bi.text_item",
+ cls: "color-chooser-popup-more bi-list-item",
+ textAlign: "center",
+ height: 24,
+ textLgap: 10,
+ text: BI.i18nText("BI-Basic_More") + "..."
+ },
+ popup: {
+ type: "bi.popup_panel",
+ buttons: [BI.i18nText("BI-Basic_Cancel"), BI.i18nText("BI-Basic_Save")],
+ title: BI.i18nText("BI-Custom_Color"),
+ el: {
+ type: "bi.custom_color_chooser",
+ value: o.value,
+ editor: o.editor,
+ ref: function (_ref) {
+ self.customColorChooser = _ref;
+ }
},
+ stopPropagation: false,
+ bgap: -1,
+ rgap: 1,
+ lgap: 1,
+ minWidth: 227,
listeners: [{
- eventName: BI.Combo.EVENT_AFTER_POPUPVIEW,
- action: function () {
- self.customColorChooser.setValue(self.getValue());
+ eventName: BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON,
+ action: function (index) {
+ switch (index) {
+ case 0:
+ self.more.hideView();
+ break;
+ case 1:
+ var color = self.customColorChooser.getValue();
+ // farbtastic选择器没有透明和自动选项,点击保存不应该设置透明
+ if (BI.isNotEmptyString(color)) {
+ self.setValue(color);
+ self._dealStoreColors();
+ }
+ self.more.hideView();
+ self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
+ break;
+ }
}
- }],
- ref: function (_ref) {
- self.more = _ref;
- }
+ }]
},
- tgap: 10,
- height: 24
- }]
- },
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
+ listeners: [{
+ eventName: BI.Combo.EVENT_AFTER_POPUPVIEW,
+ action: function () {
+ self.customColorChooser.setValue(self.getValue());
+ }
+ }],
+ ref: function (_ref) {
+ self.more = _ref;
+ }
+ },
+ tgap: 10,
+ height: 24
+ }]
}, {
type: "bi.absolute",
items: [{
@@ -212,7 +207,6 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () {
- var self = this;
var o = this.options;
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
@@ -251,7 +245,7 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
return items;
},
- _getStoreColors: function() {
+ _getStoreColors: function () {
var self = this, o = this.options;
var colorsArray = BI.string2Array(BI.Cache.getItem("colors") || "");
return BI.filter(colorsArray, function (idx, color) {
diff --git a/src/case/colorchooser/colorchooser.trigger.js b/src/case/colorchooser/colorchooser.trigger.js
index 8efe4fb79..9f8e370e7 100644
--- a/src/case/colorchooser/colorchooser.trigger.js
+++ b/src/case/colorchooser/colorchooser.trigger.js
@@ -7,10 +7,10 @@
*/
BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
- _defaultConfig: function () {
+ _defaultConfig: function (config) {
var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
- baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow",
+ baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 22
});
},
diff --git a/src/case/colorchooser/colorchooser.trigger.long.js b/src/case/colorchooser/colorchooser.trigger.long.js
index eb15f7551..e6c518c08 100644
--- a/src/case/colorchooser/colorchooser.trigger.long.js
+++ b/src/case/colorchooser/colorchooser.trigger.long.js
@@ -7,10 +7,10 @@
*/
BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
- _defaultConfig: function () {
+ _defaultConfig: function (config) {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
- baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow",
+ baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24
});
},
diff --git a/src/case/colorchooser/colorpicker/colorpicker.hex.js b/src/case/colorchooser/colorpicker/colorpicker.hex.js
index fad7c5b84..993607841 100644
--- a/src/case/colorchooser/colorpicker/colorpicker.hex.js
+++ b/src/case/colorchooser/colorpicker/colorpicker.hex.js
@@ -110,8 +110,6 @@ BI.HexColorPicker = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
- this.colors = BI.createWidget();
-
return {
type: "bi.button_group",
items: this._digest(o.items || this._items),
@@ -167,4 +165,4 @@ BI.HexColorPicker = BI.inherit(BI.Widget, {
}
});
BI.HexColorPicker.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.hex_color_picker", BI.HexColorPicker);
\ No newline at end of file
+BI.shortcut("bi.hex_color_picker", BI.HexColorPicker);
diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
index 6aa07afe8..d2be8a8f9 100644
--- a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
+++ b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
@@ -61,7 +61,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
tgap: 10,
items: [{
type: 'bi.vertical_adapt',
- columnSize: [0.5, 'fill'],
+ columnSize: ["fill", 'fill'],
height: 24,
items: [{
type: "bi.color_picker_show_button",
@@ -72,20 +72,8 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
- if (this.isSelected()) {
- self.lastColor = self.getValue();
- self.setValue("transparent");
- } else {
- if (self.lastColor === "transparent") {
- self.lastColor = "";
- }
- self.setValue(self.lastColor || "#ffffff");
- }
- if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) ||
- self._isEmptyRGB()) {
- self.colorShow.element.css("background-color", self.getValue());
- self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
- }
+ self.setValue("transparent");
+ self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
@@ -101,16 +89,8 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
- if (this.isSelected()) {
- self.lastColor = self.getValue();
- self.setValue("");
- } else {
- self.setValue(self.lastColor || "#ffffff");
- }
- if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) {
- self.colorShow.element.css("background-color", self.getValue());
- self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
- }
+ self.setValue("");
+ self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
@@ -304,4 +284,4 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.HexColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.hex_color_picker_editor", BI.HexColorPickerEditor);
\ No newline at end of file
+BI.shortcut("bi.hex_color_picker_editor", BI.HexColorPickerEditor);
diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.js b/src/case/colorchooser/colorpicker/editor.colorpicker.js
index 4be3375a4..9d0dbbca0 100644
--- a/src/case/colorchooser/colorpicker/editor.colorpicker.js
+++ b/src/case/colorchooser/colorpicker/editor.colorpicker.js
@@ -72,16 +72,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
title: BI.i18nText("BI-Basic_Auto")
});
this.none.on(BI.IconButton.EVENT_CHANGE, function () {
- if (this.isSelected()) {
- self.lastColor = self.getValue();
- self.setValue("");
- } else {
- self.setValue(self.lastColor || "#ffffff");
- }
- if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) {
- self.colorShow.element.css("background-color", self.getValue());
- self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
- }
+ var value = self.getValue();
+ self.setValue("");
+ (value !== "") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
});
this.transparent = BI.createWidget({
@@ -94,20 +87,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
title: BI.i18nText("BI-Transparent_Color")
});
this.transparent.on(BI.IconButton.EVENT_CHANGE, function () {
- if (this.isSelected()) {
- self.lastColor = self.getValue();
- self.setValue("transparent");
- } else {
- if (self.lastColor === "transparent") {
- self.lastColor = "";
- }
- self.setValue(self.lastColor || "#ffffff");
- }
- if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) ||
- self._isEmptyRGB()) {
- self.colorShow.element.css("background-color", self.getValue());
- self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
- }
+ var value = self.getValue();
+ self.setValue("transparent");
+ (value !== "transparent") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
});
BI.createWidget({
diff --git a/src/case/colorchooser/farbtastic/farbtastic.js b/src/case/colorchooser/farbtastic/farbtastic.js
index 58eb563ca..a5ec6736b 100644
--- a/src/case/colorchooser/farbtastic/farbtastic.js
+++ b/src/case/colorchooser/farbtastic/farbtastic.js
@@ -127,42 +127,11 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
},
_HSLToRGB: function (hsl) {
- var m1, m2, r, g, b;
- var h = hsl[0], s = hsl[1], l = hsl[2];
- m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
- m1 = l * 2 - m2;
- return [this._hueToRGB(m1, m2, h + 0.33333),
- this._hueToRGB(m1, m2, h),
- this._hueToRGB(m1, m2, h - 0.33333)];
- },
-
- _hueToRGB: function (m1, m2, h) {
- h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
- if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
- if (h * 2 < 1) return m2;
- if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
- return m1;
+ return BI.DOM.hsl2rgb(hsl);
},
_RGBToHSL: function (rgb) {
- var min, max, delta, h, s, l;
- var r = rgb[0], g = rgb[1], b = rgb[2];
- min = Math.min(r, Math.min(g, b));
- max = Math.max(r, Math.max(g, b));
- delta = max - min;
- l = (min + max) / 2;
- s = 0;
- if (l > 0 && l < 1) {
- s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
- }
- h = 0;
- if (delta > 0) {
- if (max == r && max != g) h += (g - b) / delta;
- if (max == g && max != b) h += (2 + (b - r) / delta);
- if (max == b && max != r) h += (4 + (r - g) / delta);
- h /= 6;
- }
- return [h, s, l];
+ return BI.DOM.rgb2hsl(rgb);
},
_updateDisplay: function () {
diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js
index 8a0af89b3..2f1db8b2d 100644
--- a/src/case/combo/bubblecombo/combo.bubble.js
+++ b/src/case/combo/bubblecombo/combo.bubble.js
@@ -5,24 +5,23 @@
* @extends BI.Widget
*/
BI.BubbleCombo = BI.inherit(BI.Widget, {
- _const: {
- TRIANGLE_LENGTH: 9
- },
_defaultConfig: function () {
return BI.extend(BI.BubbleCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bubble-combo",
trigger: "click",
toggle: true,
+ primary: false,
direction: "bottom,left", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false,
destroyWhenHide: false,
+ hideWhenClickOutside: true,
hideWhenBlur: true,
isNeedAdjustHeight: true, // 是否需要高度调整
isNeedAdjustWidth: true,
stopPropagation: false,
adjustLength: 0, // 调整的距离
- // adjustXOffset: 0,
- // adjustYOffset: 10,
+ adjustXOffset: 0,
+ adjustYOffset: 0,
hideChecker: BI.emptyFn,
offsetStyle: "left", // left,right,center
el: {},
@@ -42,19 +41,23 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
direction: o.direction,
isDefaultInit: o.isDefaultInit,
hideWhenBlur: o.hideWhenBlur,
+ hideWhenClickOutside: o.hideWhenClickOutside,
destroyWhenHide: o.destroyWhenHide,
hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen,
isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth,
- adjustLength: this._getAdjustLength(),
stopPropagation: o.stopPropagation,
- adjustXOffset: 0,
- adjustYOffset: 0,
+ adjustXOffset: o.adjustXOffset,
+ adjustYOffset: o.adjustYOffset,
hideChecker: o.hideChecker,
offsetStyle: o.offsetStyle,
+ showArrow: true,
el: o.el,
popup: BI.extend({
- type: "bi.bubble_popup_view"
+ type: "bi.bubble_popup_view",
+ animation: "bi-zoom-big",
+ animationDuring: 200,
+ primary: o.primary
}, o.popup)
});
this.combo.on(BI.Combo.EVENT_TRIGGER_CHANGE, function () {
@@ -76,11 +79,9 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, arguments);
});
this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () {
- self._showTriangle();
self.fireEvent(BI.BubbleCombo.EVENT_AFTER_POPUPVIEW, arguments);
});
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
- self._hideTriangle();
self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW, arguments);
});
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
@@ -88,114 +89,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
});
},
- _getAdjustLength: function () {
- return this._const.TRIANGLE_LENGTH + this.options.adjustLength;
- },
-
- _createTriangle: function (direction) {
- var pos = {}, op = {};
- var adjustLength = this.options.adjustLength;
- var offset = this.element.offset();
- var left = offset.left, right = offset.left + this.element.outerWidth();
- var top = offset.top, bottom = offset.top + this.element.outerHeight();
- switch (direction) {
- case "left":
- pos = {
- top: top,
- height: this.element.outerHeight(),
- left: left - adjustLength - this._const.TRIANGLE_LENGTH
- };
- op = {width: this._const.TRIANGLE_LENGTH};
- break;
- case "right":
- pos = {
- top: top,
- height: this.element.outerHeight(),
- left: right + adjustLength
- };
- op = {width: this._const.TRIANGLE_LENGTH};
- break;
- case "top":
- pos = {
- left: left,
- width: this.element.outerWidth(),
- top: top - adjustLength - this._const.TRIANGLE_LENGTH
- };
- op = {height: this._const.TRIANGLE_LENGTH};
- break;
- case "bottom":
- pos = {
- left: left,
- width: this.element.outerWidth(),
- top: bottom + adjustLength
- };
- op = {height: this._const.TRIANGLE_LENGTH};
- break;
- default:
- break;
- }
- this.triangle && this.triangle.destroy();
- this.triangle = BI.createWidget(op, {
- type: "bi.center_adapt",
- cls: "button-combo-triangle-wrapper",
- items: [{
- type: "bi.layout",
- cls: "bubble-combo-triangle-" + direction
- }]
- });
- pos.el = this.triangle;
- BI.createWidget({
- type: "bi.absolute",
- element: this,
- items: [pos]
- });
- },
-
- _createLeftTriangle: function () {
- this._createTriangle("left");
- },
-
- _createRightTriangle: function () {
- this._createTriangle("right");
- },
-
- _createTopTriangle: function () {
- this._createTriangle("top");
- },
-
- _createBottomTriangle: function () {
- this._createTriangle("bottom");
- },
-
- _showTriangle: function () {
- var pos = this.combo.getPopupPosition();
- switch (pos.dir) {
- case "left,top":
- case "left,bottom":
- this._createLeftTriangle();
- break;
- case "right,top":
- case "right,bottom":
- this._createRightTriangle();
- break;
- case "top,left":
- case "top,right":
- this._createTopTriangle();
- break;
- case "bottom,left":
- case "bottom,right":
- this._createBottomTriangle();
- break;
- }
- },
-
- _hideTriangle: function () {
- this.triangle && this.triangle.destroy();
- this.triangle = null;
- },
-
hideView: function () {
- this._hideTriangle();
this.combo && this.combo.hideView();
},
diff --git a/src/case/combo/bubblecombo/popup.bubble.js b/src/case/combo/bubblecombo/popup.bubble.js
index 2fa9999ea..c65905821 100644
--- a/src/case/combo/bubblecombo/popup.bubble.js
+++ b/src/case/combo/bubblecombo/popup.bubble.js
@@ -9,9 +9,10 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, {
var config = BI.BubblePopupView.superclass._defaultConfig.apply(this, arguments);
return BI.extend(config, {
baseCls: config.baseCls + " bi-bubble-popup-view",
- minWidth: 220,
+ minWidth: 70,
maxWidth: 300,
- minHeight: 90
+ // minHeight: 50,
+ showArrow: true,
});
}
});
@@ -31,60 +32,65 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
buttons: [{
value: false,
text: BI.i18nText("BI-Basic_Cancel"),
- ghost: true
+ level: "ignore"
}, {
- text: BI.i18nText(BI.i18nText("BI-Basic_Sure")),
+ text: BI.i18nText(BI.i18nText("BI-Basic_OK")),
value: true
}]
});
},
- _init: function () {
- BI.BubblePopupBarView.superclass._init.apply(this, arguments);
- },
+
_createToolBar: function () {
var o = this.options, self = this;
var items = [];
BI.each(o.buttons, function (i, buttonOpt) {
if (BI.isWidget(buttonOpt)) {
- items.push(buttonOpt);
+ items.push({
+ el: buttonOpt,
+ lgap: i === 0 ? 20 : 15,
+ rgap: i === o.buttons.length - 1 ? 20 : 0
+ });
} else {
- items.push(BI.extend({
- type: "bi.button",
- height: 24,
- handler: function (v) {
- self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v);
- }
- }, buttonOpt));
+ items.push({
+ el: BI.extend({
+ type: "bi.button",
+ height: 24,
+ handler: function (v) {
+ self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v);
+ }
+ }, buttonOpt),
+ lgap: i === 0 ? 20 : 15,
+ rgap: i === o.buttons.length - 1 ? 20 : 0
+ });
}
});
return BI.createWidget({
- type: "bi.center",
- height: 44,
- rgap: 15,
- items: [{
- type: "bi.right_vertical_adapt",
- lgap: 10,
- items: items
- }]
+ type: "bi.right_vertical_adapt",
+ height: 54,
+ items: items
});
},
+ _createContent: function () {
+ return this.options.el;
+ },
+
_createView: function () {
var o = this.options;
- var button = BI.createWidget({
+ var button = BI.createWidget({
type: "bi.button_group",
- items: [o.el],
+ items: [this._createContent()],
layouts: [{
type: "bi.vertical",
cls: "bar-popup-container",
- hgap: 15,
- tgap: 10
+ hgap: BI.SIZE_CONSANTS.H_GAP_SIZE,
+ tgap: BI.SIZE_CONSANTS.V_GAP_SIZE
}]
});
- button.element.css("min-height", o.minHeight - 44);
+ button.element.css("min-height", o.minHeight - 54);
return button;
}
@@ -98,58 +104,26 @@ BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);
* @class BI.TextBubblePopupBarView
* @extends BI.BubblePopupView
*/
-BI.TextBubblePopupBarView = BI.inherit(BI.Widget, {
+BI.TextBubblePopupBarView = BI.inherit(BI.BubblePopupBarView, {
- props: function () {
- return {
- baseCls: "bi-text-bubble-bar-popup-view",
+ _defaultConfig: function () {
+ var config = BI.TextBubblePopupBarView.superclass._defaultConfig.apply(this, arguments);
+ return BI.extend(config, {
+ baseCls: config.baseCls + " bi-text-bubble-bar-popup-view",
text: "",
- buttons: [{
- level: "ignore",
- value: false,
- stopPropagation: true,
- text: BI.i18nText("BI-Basic_Cancel")
- }, {
- value: true,
- stopPropagation: true,
- text: BI.i18nText("BI-Basic_Sure")
- }]
- };
+ });
},
- render: function () {
+ _createContent: function () {
var self = this, o = this.options;
- var buttons = BI.map(o.buttons, function (index, buttonOpt) {
- if (BI.isWidget(buttonOpt)) {
- return buttonOpt;
- }
- return BI.extend({
- type: "bi.button",
- height: 24,
- handler: function (v) {
- self.fireEvent(BI.TextBubblePopupBarView.EVENT_CHANGE, v);
- }
- }, buttonOpt);
-
- });
return {
- type: "bi.bubble_bar_popup_view",
- minWidth: o.minWidth,
- maxWidth: o.maxWidth,
- minHeight: o.minHeight,
+ type: "bi.label",
+ text: o.text,
+ whiteSpace: "normal",
+ textAlign: "left",
ref: function () {
- self.popup = this;
- },
- el: {
- type: "bi.label",
- text: o.text,
- whiteSpace: "normal",
- textAlign: "left",
- ref: function () {
- self.text = this;
- }
- },
- buttons: buttons
+ self.text = this;
+ }
};
},
diff --git a/src/case/combo/iconcombo/combo.icon.js b/src/case/combo/iconcombo/combo.icon.js
index 409e1a003..81050859a 100644
--- a/src/case/combo/iconcombo/combo.icon.js
+++ b/src/case/combo/iconcombo/combo.icon.js
@@ -25,8 +25,14 @@ BI.IconCombo = BI.inherit(BI.Widget, {
},
_init: function () {
- BI.IconCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ BI.IconCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget(o.el, {
type: "bi.icon_combo_trigger",
iconCls: o.iconCls,
diff --git a/src/case/combo/iconcombo/popup.iconcombo.js b/src/case/combo/iconcombo/popup.iconcombo.js
index 0c6067bac..9b0f4cc80 100644
--- a/src/case/combo/iconcombo/popup.iconcombo.js
+++ b/src/case/combo/iconcombo/popup.iconcombo.js
@@ -19,7 +19,6 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
type: "bi.button_group",
items: BI.createItems(o.items, {
type: "bi.single_select_icon_text_item",
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
}),
chooseType: o.chooseType,
layouts: [{
@@ -47,7 +46,6 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
BI.IconComboPopup.superclass.populate.apply(this, arguments);
items = BI.createItems(items, {
type: "bi.single_select_icon_text_item",
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
});
this.popup.populate(items);
},
diff --git a/src/case/combo/iconcombo/trigger.iconcombo.js b/src/case/combo/iconcombo/trigger.iconcombo.js
index 237846521..65c353504 100644
--- a/src/case/combo/iconcombo/trigger.iconcombo.js
+++ b/src/case/combo/iconcombo/trigger.iconcombo.js
@@ -42,9 +42,9 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
cls: "icon-combo-down-icon trigger-triangle-font font-size-12",
width: 12,
height: 8,
- selected: BI.isNotEmptyString(iconCls)
+ selected: BI.isNotEmptyString(iconCls),
+ invisible: !o.isShowDown
});
- this.down.setVisible(o.isShowDown);
BI.createWidget({
type: "bi.absolute",
element: this,
@@ -99,4 +99,4 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}
});
BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);
\ No newline at end of file
+BI.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);
diff --git a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js
index 118138779..92732d9b1 100644
--- a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js
+++ b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js
@@ -3,9 +3,9 @@
* combo : icon + text + icon, popup : icon + text
*/
BI.IconTextValueCombo = BI.inherit(BI.Widget, {
- _defaultConfig: function () {
+ _defaultConfig: function (config) {
return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), {
- baseCls: "bi-icon-text-value-combo bi-border bi-border-radius",
+ baseCls: "bi-icon-text-value-combo bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24,
iconHeight: null,
iconWidth: null,
@@ -15,8 +15,14 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
- o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
+ BI.isNumeric(o.height) && (o.height -= 2);
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
BI.IconTextValueCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget({
type: "bi.select_icon_text_trigger",
diff --git a/src/case/combo/icontextvaluecombo/popup.icontextvalue.js b/src/case/combo/icontextvaluecombo/popup.icontextvalue.js
index 993bceb45..88db08e67 100644
--- a/src/case/combo/icontextvaluecombo/popup.icontextvalue.js
+++ b/src/case/combo/icontextvaluecombo/popup.icontextvalue.js
@@ -20,7 +20,6 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
type: "bi.button_group",
items: BI.createItems(o.items, {
type: "bi.single_select_icon_text_item",
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
iconWrapperWidth: o.iconWrapperWidth
@@ -55,7 +54,6 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
var o = this.options;
items = BI.createItems(items, {
type: "bi.single_select_icon_text_item",
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: o.iconWrapperWidth,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
index 05553d05a..ac3fad335 100644
--- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
+++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
@@ -15,12 +15,18 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.combo",
- cls: "bi-border bi-focus-shadow",
+ cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow",
container: o.container,
adjustLength: 2,
toggle: false,
@@ -35,7 +41,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.trigger = this;
},
items: o.items,
- height: o.height - 2,
+ height: o.height - (o.simple ? 1 : 2),
text: o.text,
defaultText: o.defaultText,
value: o.value,
diff --git a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
index 0118cf84f..dc1107fb1 100644
--- a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
+++ b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
@@ -17,11 +17,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
ref: function () {
self.popup = this;
},
- items: BI.createItems(o.items, {
- type: "bi.single_select_item",
- textAlign: o.textAlign,
- height: 24
- }),
+ items: this._formatItems(o.items),
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
@@ -45,6 +41,17 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
+ _formatItems: function (items) {
+ var o = this.options;
+ return BI.map(items, function (i, item) {
+ return BI.extend({
+ type: "bi.single_select_item",
+ textAlign: o.textAlign,
+ title: item.title || item.text
+ }, item);
+ });
+ },
+
// mounted之后做check
mounted: function() {
this.check();
@@ -53,11 +60,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
- items = BI.createItems(items, {
- type: "bi.single_select_item",
- height: 24
- });
- this.popup.populate(items, keyword);
+ this.popup.populate(this._formatItems(items), keyword);
},
getValue: function () {
diff --git a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
index 530cc2a01..1b9b9a0ce 100644
--- a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
+++ b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
@@ -4,9 +4,9 @@
* combo : text + icon, popup : check + text
*/
BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
- _defaultConfig: function () {
+ _defaultConfig: function (config) {
return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), {
- baseCls: "bi-text-value-check-combo bi-border",
+ baseCls: "bi-text-value-check-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
width: 100,
height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
@@ -16,8 +16,14 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
- o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
+ BI.isNumeric(o.height) && (o.height -= 2);
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
BI.TextValueCheckCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget({
type: "bi.select_text_trigger",
diff --git a/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js
index f5678d870..b25ccc141 100644
--- a/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js
+++ b/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js
@@ -35,11 +35,13 @@ BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
},
_formatItems: function (items) {
+ var o = this.options;
return BI.map(items, function (i, item) {
return BI.extend({
type: "bi.single_select_item",
cls: "bi-list-item",
- height: 24
+ textAlign: o.textAlign,
+ title: item.title || item.text
}, item);
});
},
diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js
index b0242a64d..6b9ef321b 100644
--- a/src/case/combo/textvaluecombo/combo.textvalue.js
+++ b/src/case/combo/textvaluecombo/combo.textvalue.js
@@ -5,9 +5,9 @@
* 参见场景dashboard布局方式选择
*/
BI.TextValueCombo = BI.inherit(BI.Widget, {
- _defaultConfig: function () {
+ _defaultConfig: function (config) {
return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), {
- baseCls: "bi-text-value-combo bi-border",
+ baseCls: "bi-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
text: "",
@@ -17,8 +17,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
- o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
+ BI.isNumeric(o.height) && (o.height -= 2);
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
BI.TextValueCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget({
type: "bi.select_text_trigger",
diff --git a/src/case/combo/textvaluecombo/combo.textvaluesmall.js b/src/case/combo/textvaluecombo/combo.textvaluesmall.js
index 70e551737..b6609544b 100644
--- a/src/case/combo/textvaluecombo/combo.textvaluesmall.js
+++ b/src/case/combo/textvaluecombo/combo.textvaluesmall.js
@@ -16,8 +16,14 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, {
},
_init: function () {
- BI.SmallTextValueCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ BI.SmallTextValueCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget(o.el, {
type: "bi.small_select_text_trigger",
items: o.items,
diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js
index 5b3c0a8ee..6702f8bfa 100644
--- a/src/case/combo/textvaluecombo/popup.textvalue.js
+++ b/src/case/combo/textvaluecombo/popup.textvalue.js
@@ -11,11 +11,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
var o = this.options, self = this;
this.popup = BI.createWidget({
type: "bi.button_group",
- items: BI.createItems(o.items, {
- type: "bi.single_select_item",
- textAlign: o.textAlign,
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
- }),
+ items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
@@ -39,13 +35,20 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
});
},
+ _formatItems: function (items) {
+ var o = this.options;
+ return BI.map(items, function (i, item) {
+ return BI.extend({
+ type: "bi.single_select_item",
+ textAlign: o.textAlign,
+ title: item.title || item.text
+ }, item);
+ });
+ },
+
populate: function (items) {
BI.TextValueComboPopup.superclass.populate.apply(this, arguments);
- items = BI.createItems(items, {
- type: "bi.single_select_item",
- height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
- });
- this.popup.populate(items);
+ this.popup.populate(this._formatItems(items));
},
getValue: function () {
@@ -58,4 +61,4 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
});
BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
-BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);
\ No newline at end of file
+BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);
diff --git a/src/case/editor/editor.clear.js b/src/case/editor/editor.clear.js
index 372d31bdd..253d32431 100644
--- a/src/case/editor/editor.clear.js
+++ b/src/case/editor/editor.clear.js
@@ -21,6 +21,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
+ simple: o.simple,
height: o.height,
watermark: o.watermark,
allowBlank: true,
@@ -32,6 +33,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.clear = BI.createWidget({
type: "bi.icon_button",
stopEvent: true,
+ invisible: !BI.isKey(o.value),
cls: "search-close-h-font"
});
this.clear.on(BI.IconButton.EVENT_CHANGE, function () {
@@ -113,12 +115,6 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.ClearEditor.EVENT_STOP);
});
-
- if (BI.isKey(o.value)) {
- this.clear.visible();
- } else {
- this.clear.invisible();
- }
},
_checkClear: function () {
@@ -179,4 +175,4 @@ BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER";
BI.ClearEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY";
-BI.shortcut("bi.clear_editor", BI.ClearEditor);
\ No newline at end of file
+BI.shortcut("bi.clear_editor", BI.ClearEditor);
diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js
index 562cbe3a4..dec410d87 100644
--- a/src/case/editor/editor.shelter.js
+++ b/src/case/editor/editor.shelter.js
@@ -30,6 +30,7 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
+ simple: o.simple,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
@@ -141,14 +142,16 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
_checkText: function () {
var o = this.options;
- if (this.editor.getValue() === "") {
- this.text.setValue(o.watermark || "");
- this.text.element.addClass("bi-water-mark");
- } else {
- this.text.setValue(this.editor.getValue());
- this.text.element.removeClass("bi-water-mark");
- }
- BI.isKey(o.keyword) && this.text.doRedMark(o.keyword);
+ BI.nextTick(BI.bind(function () {
+ if (this.editor.getValue() === "") {
+ this.text.setValue(o.watermark || "");
+ this.text.element.addClass("bi-water-mark");
+ } else {
+ this.text.setValue(this.editor.getValue());
+ this.text.element.removeClass("bi-water-mark");
+ }
+ BI.isKey(o.keyword) && this.text.doRedMark(o.keyword);
+ }, this));
},
_showInput: function () {
diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js
index 35ed78e4b..f2ae0560f 100644
--- a/src/case/editor/editor.sign.js
+++ b/src/case/editor/editor.sign.js
@@ -30,6 +30,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
+ simple: o.simple,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
@@ -176,6 +177,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
setWaterMark: function (v) {
this.options.watermark = v;
+ this._checkText();
this.editor.setWaterMark(v);
},
diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js
index dcd8e9147..d1e11b20a 100644
--- a/src/case/editor/editor.state.js
+++ b/src/case/editor/editor.state.js
@@ -32,6 +32,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.editor",
+ simple: o.simple,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js
index 6fab8d6f8..81b815441 100644
--- a/src/case/editor/editor.state.simple.js
+++ b/src/case/editor/editor.state.simple.js
@@ -31,6 +31,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
+ simple: o.simple,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
diff --git a/src/case/layer/layer.multipopup.js b/src/case/layer/layer.multipopup.js
index 3979c6927..5b69dabe3 100644
--- a/src/case/layer/layer.multipopup.js
+++ b/src/case/layer/layer.multipopup.js
@@ -10,7 +10,7 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, {
var conf = BI.MultiPopupView.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-multi-list-view",
- buttons: [BI.i18nText("BI-Basic_Sure")]
+ buttons: [BI.i18nText("BI-Basic_OK")]
});
},
diff --git a/src/case/linersegment/button.linear.segment.js b/src/case/linearsegment/button.linear.segment.js
similarity index 96%
rename from src/case/linersegment/button.linear.segment.js
rename to src/case/linearsegment/button.linear.segment.js
index be8403844..38479accb 100644
--- a/src/case/linersegment/button.linear.segment.js
+++ b/src/case/linearsegment/button.linear.segment.js
@@ -5,7 +5,7 @@ BI.LinearSegmentButton = BI.inherit(BI.BasicButton, {
once: true,
readonly: true,
hgap: 10,
- height: 25
+ height: 24
},
render: function () {
@@ -15,6 +15,7 @@ BI.LinearSegmentButton = BI.inherit(BI.BasicButton, {
type: "bi.label",
text: o.text,
height: o.height,
+ textHeight: o.height - 2,
value: o.value,
hgap: o.hgap,
ref: function () {
@@ -51,4 +52,4 @@ BI.LinearSegmentButton = BI.inherit(BI.BasicButton, {
this.text.setText(text);
}
});
-BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton);
\ No newline at end of file
+BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton);
diff --git a/src/case/linersegment/linear.segment.js b/src/case/linearsegment/linear.segment.js
similarity index 89%
rename from src/case/linersegment/linear.segment.js
rename to src/case/linearsegment/linear.segment.js
index f0060dce3..3c1b677c3 100644
--- a/src/case/linersegment/linear.segment.js
+++ b/src/case/linearsegment/linear.segment.js
@@ -6,7 +6,7 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
layouts: [{
type: "bi.center"
}],
- height: 29
+ height: 30
},
render: function () {
@@ -15,9 +15,10 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
type: "bi.button_group",
items: BI.createItems(o.items, {
type: "bi.linear_segment_button",
- height: o.height - 1
+ height: o.height
}),
layouts: o.layouts,
+ value: o.value,
listeners: [{
eventName: "__EVENT_CHANGE__",
action: function () {
@@ -48,4 +49,4 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
return this.buttonGroup.getValue();
}
});
-BI.shortcut("bi.linear_segment", BI.LinearSegment);
\ No newline at end of file
+BI.shortcut("bi.linear_segment", BI.LinearSegment);
diff --git a/src/case/pager/pager.js b/src/case/pager/pager.js
index cc057fd69..0f6bac9b5 100644
--- a/src/case/pager/pager.js
+++ b/src/case/pager/pager.js
@@ -12,8 +12,6 @@ BI.DetailPager = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.horizontal",
- hgap: 10,
- vgap: 0
}],
dynamicShow: true, // 是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态
@@ -177,8 +175,7 @@ BI.DetailPager = BI.inherit(BI.Widget, {
element: this,
items: BI.createItems(view, {
cls: "page-item bi-border bi-list-item-active",
- height: 23,
- hgap: 10
+ height: 23
}),
behaviors: o.behaviors,
layouts: o.layouts
@@ -285,4 +282,4 @@ BI.DetailPager = BI.inherit(BI.Widget, {
});
BI.DetailPager.EVENT_CHANGE = "EVENT_CHANGE";
BI.DetailPager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE";
-BI.shortcut("bi.detail_pager", BI.DetailPager);
\ No newline at end of file
+BI.shortcut("bi.detail_pager", BI.DetailPager);
diff --git a/src/case/segment/button.segment.js b/src/case/segment/button.segment.js
index 0e3ac343b..2d9d6c19a 100644
--- a/src/case/segment/button.segment.js
+++ b/src/case/segment/button.segment.js
@@ -10,7 +10,7 @@ BI.SegmentButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.SegmentButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
- baseCls: (conf.baseCls || "") + " bi-segment-button bi-list-item-select",
+ baseCls: (conf.baseCls || "") + " bi-segment-button bi-list-item-select bi-card",
shadow: true,
readonly: true,
hgap: 5
diff --git a/src/case/tree/tree.level.js b/src/case/tree/tree.level.js
index eb6d5099d..baac6a94c 100644
--- a/src/case/tree/tree.level.js
+++ b/src/case/tree/tree.level.js
@@ -26,7 +26,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
- var extend = { layer: layer };
+ var extend = { layer: layer, height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT };
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
diff --git a/src/case/tree/treeexpander/tree.expander.popup.js b/src/case/tree/treeexpander/tree.expander.popup.js
index 6deae0982..bf2c6addb 100644
--- a/src/case/tree/treeexpander/tree.expander.popup.js
+++ b/src/case/tree/treeexpander/tree.expander.popup.js
@@ -1,16 +1,19 @@
!(function () {
var Widget = BI.inherit(BI.Widget, {
- props: {
- baseCls: "bi-tree-expander-popup",
- layer: 0, // 第几层级
- el: {},
- isLastNode: false,
+ props: function () {
+ return {
+ baseCls: "bi-tree-expander-popup",
+ layer: 0, // 第几层级
+ el: {},
+ isLastNode: false,
+ };
},
render: function () {
var self = this;
var o = this.options;
+ var offset = BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2;
this.popupView = BI.createWidget(BI.extend(o.el, {
value: o.value
@@ -19,12 +22,12 @@
this.popupView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
- this.popupView.element.css("margin-left", -12 * o.layer);
- this.element.css("margin-left", 12 * o.layer);
+ this.popupView.element.css("margin-left", -offset * o.layer);
+ this.element.css("margin-left", offset * o.layer);
return {
type: "bi.vertical",
- cls: !o.isLastNode ? "line" : "",
+ cls: !o.isLastNode ? (BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "line solid" : "line") : "",
scrolly: null,
items: [
this.popupView,
diff --git a/src/case/trigger/trigger.editor.js b/src/case/trigger/trigger.editor.js
index 814f1b870..7243d528f 100644
--- a/src/case/trigger/trigger.editor.js
+++ b/src/case/trigger/trigger.editor.js
@@ -6,10 +6,6 @@
* @extends BI.Trigger
*/
BI.EditorTrigger = BI.inherit(BI.Trigger, {
- _const: {
- hgap: 4
- },
-
_defaultConfig: function () {
var conf = BI.EditorTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@@ -61,10 +57,11 @@ BI.EditorTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
- type: "bi.htape",
+ type: "bi.horizontal_fill",
items: [
{
- el: this.editor
+ el: this.editor,
+ width: "fill"
}, {
el: {
type: "bi.trigger_icon_button",
diff --git a/src/case/trigger/trigger.icon.text.js b/src/case/trigger/trigger.icon.text.js
index eac94ab50..36d156e13 100644
--- a/src/case/trigger/trigger.icon.text.js
+++ b/src/case/trigger/trigger.icon.text.js
@@ -6,9 +6,6 @@
* @extends BI.Trigger
*/
BI.IconTextTrigger = BI.inherit(BI.Trigger, {
- _const: {
- hgap: 4
- },
_defaultConfig: function () {
var conf = BI.IconTextTrigger.superclass._defaultConfig.apply(this, arguments);
@@ -23,12 +20,18 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
_init: function () {
BI.IconTextTrigger.superclass._init.apply(this, arguments);
- var self = this, o = this.options, c = this._const;
+ var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left",
height: o.height,
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ tgap: o.textTgap,
+ bgap: o.textBgap,
text: o.text
});
this.trigerButton = BI.createWidget({
@@ -38,7 +41,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
- type: "bi.htape",
+ type: "bi.horizontal_fill",
+ columnSize: [BI.isEmptyString(o.iconCls) ? 0 : (o.iconWrapperWidth || o.height), "fill", o.triggerWidth || o.height],
ref: function (_ref) {
self.wrapper = _ref;
},
@@ -53,17 +57,13 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
disableSelected: true
- },
- width: BI.isEmptyString(o.iconCls) ? 0 : (o.iconWrapperWidth || o.height)
- },
- {
+ }
+ }, {
el: this.text,
lgap: BI.isEmptyString(o.iconCls) ? 5 : 0
}, {
- el: this.trigerButton,
- width: o.triggerWidth || o.height
- }
- ]
+ el: this.trigerButton
+ }]
});
},
@@ -76,14 +76,14 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
this.icon.setIcon(iconCls);
var iconItem = this.wrapper.attr("items")[0];
var textItem = this.wrapper.attr("items")[1];
- if(BI.isNull(iconCls) || BI.isEmptyString(iconCls)) {
- if(iconItem.width !== 0) {
+ if (BI.isNull(iconCls) || BI.isEmptyString(iconCls)) {
+ if (iconItem.width !== 0) {
iconItem.width = 0;
textItem.lgap = 5;
this.wrapper.resize();
}
- }else{
- if(iconItem.width !== (o.iconWrapperWidth || o.height)) {
+ } else {
+ if (iconItem.width !== (o.iconWrapperWidth || o.height)) {
iconItem.width = (o.iconWrapperWidth || o.height);
textItem.lgap = 0;
this.wrapper.resize();
@@ -91,7 +91,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
}
},
- setTextCls: function(cls) {
+ setTextCls: function (cls) {
var o = this.options;
var oldCls = o.textCls;
o.textCls = cls;
@@ -102,4 +102,4 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
this.text.setText(text);
}
});
-BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);
\ No newline at end of file
+BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);
diff --git a/src/case/trigger/trigger.icon.text.select.js b/src/case/trigger/trigger.icon.text.select.js
index a980b055a..b0142b91e 100644
--- a/src/case/trigger/trigger.icon.text.select.js
+++ b/src/case/trigger/trigger.icon.text.select.js
@@ -23,6 +23,12 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls,
+ textHgap: o.textHgap,
+ textVgap: o.textVgap,
+ textLgap: o.textLgap,
+ textRgap: o.textRgap,
+ textTgap: o.textTgap,
+ textBgap: o.textBgap,
height: o.height,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
@@ -71,4 +77,4 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
this.options.items = items;
}
});
-BI.shortcut("bi.select_icon_text_trigger", BI.SelectIconTextTrigger);
\ No newline at end of file
+BI.shortcut("bi.select_icon_text_trigger", BI.SelectIconTextTrigger);
diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js
index 8fc69d58c..e8ee789df 100644
--- a/src/case/trigger/trigger.text.js
+++ b/src/case/trigger/trigger.text.js
@@ -6,16 +6,18 @@
* @extends BI.Trigger
*/
BI.TextTrigger = BI.inherit(BI.Trigger, {
- _const: {
- hgap: 6
- },
_defaultConfig: function () {
+ var self = this;
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24,
- textCls: ""
+ textHgap: 6,
+ textCls: "",
+ title: function () {
+ return self.text.getText();
+ }
});
},
@@ -28,12 +30,14 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
- title: function () {
- return self.text.getText();
- },
tipType: o.tipType,
warningTitle: o.warningTitle,
- hgap: c.hgap,
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ tgap: o.textTgap,
+ bgap: o.textBgap,
readonly: o.readonly
});
this.trigerButton = BI.createWidget({
@@ -43,10 +47,11 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
- type: "bi.htape",
+ type: "bi.horizontal_fill",
items: [
{
- el: this.text
+ el: this.text,
+ width: "fill"
}, {
el: this.trigerButton,
width: o.triggerWidth || o.height
@@ -72,6 +77,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
setTipType: function (v) {
this.text.options.tipType = v;
+ this.options.tipType = v;
}
});
BI.shortcut("bi.text_trigger", BI.TextTrigger);
diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js
index 03481d1f2..8b24c1c9c 100644
--- a/src/case/trigger/trigger.text.select.js
+++ b/src/case/trigger/trigger.text.select.js
@@ -10,7 +10,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-text-trigger",
- height: 24
+ height: 24,
});
},
@@ -25,6 +25,12 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
readonly: o.readonly,
text: obj.text,
textCls: obj.textCls,
+ textHgap: o.textHgap,
+ textVgap: o.textVgap,
+ textLgap: o.textLgap,
+ textRgap: o.textRgap,
+ textTgap: o.textTgap,
+ textBgap: o.textBgap,
tipType: o.tipType,
warningTitle: o.warningTitle
});
diff --git a/src/case/trigger/trigger.text.select.small.js b/src/case/trigger/trigger.text.select.small.js
index 215a04f26..9c39fe750 100644
--- a/src/case/trigger/trigger.text.select.small.js
+++ b/src/case/trigger/trigger.text.select.small.js
@@ -9,7 +9,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
return BI.extend(BI.SmallSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-small-select-text-trigger bi-border",
- height: 20
+ height: 20,
});
},
@@ -23,7 +23,13 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
element: this,
height: o.height,
text: obj.text,
- cls: obj.cls
+ cls: obj.cls,
+ textHgap: o.textHgap,
+ textVgap: o.textVgap,
+ textLgap: o.textLgap,
+ textRgap: o.textRgap,
+ textTgap: o.textTgap,
+ textBgap: o.textBgap,
});
},
@@ -61,4 +67,4 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.items = items;
}
});
-BI.shortcut("bi.small_select_text_trigger", BI.SmallSelectTextTrigger);
\ No newline at end of file
+BI.shortcut("bi.small_select_text_trigger", BI.SmallSelectTextTrigger);
diff --git a/src/case/trigger/trigger.text.small.js b/src/case/trigger/trigger.text.small.js
index 1ddc3907f..6fbb04c3c 100644
--- a/src/case/trigger/trigger.text.small.js
+++ b/src/case/trigger/trigger.text.small.js
@@ -5,15 +5,12 @@
* @extends BI.Trigger
*/
BI.SmallTextTrigger = BI.inherit(BI.Trigger, {
- _const: {
- hgap: 6
- },
-
_defaultConfig: function () {
var conf = BI.SmallTextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger",
- height: 20
+ height: 20,
+ textHgap: 6,
});
},
@@ -25,7 +22,12 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
- hgap: c.hgap
+ hgap: o.textHgap,
+ vgap: o.textVgap,
+ lgap: o.textLgap,
+ rgap: o.textRgap,
+ tgap: o.textTgap,
+ bgap: o.textBgap,
});
this.trigerButton = BI.createWidget({
type: "bi.trigger_icon_button",
@@ -34,10 +36,11 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
- type: "bi.htape",
+ type: "bi.horizontal_fill",
items: [
{
- el: this.text
+ el: this.text,
+ width: "fill"
}, {
el: this.trigerButton,
width: o.triggerWidth || o.height
@@ -54,4 +57,4 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, {
this.text.setText(text);
}
});
-BI.shortcut("bi.small_text_trigger", BI.SmallTextTrigger);
\ No newline at end of file
+BI.shortcut("bi.small_text_trigger", BI.SmallTextTrigger);
diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js
index f67c9291b..79ffd5bb6 100644
--- a/src/case/ztree/0.treeview.js
+++ b/src/case/ztree/0.treeview.js
@@ -51,11 +51,11 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
this.tree = BI.createWidget({
type: "bi.layout",
- element: "
"
});
BI.createWidget({
type: "bi.default",
- element: this.element,
+ element: this,
items: [this.tree]
});
},
@@ -140,7 +140,9 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
return true;
}
- BI.Msg.toast("Please Wait。", "warning"); // 不展开节点,也不触发onExpand事件
+ BI.Msg.toast("Please Wait。", {
+ level: "warning"
+ }); // 不展开节点,也不触发onExpand事件
return false;
}
@@ -184,6 +186,9 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
function beforeCheck (treeId, treeNode) {
+ if (treeNode.disabled) {
+ return false;
+ }
// 下面主动修改了node的halfCheck属性, 节点属性的判断依赖halfCheck,改之前就获取一下
var status = treeNode.getCheckStatus();
treeNode.halfCheck = false;
@@ -213,14 +218,23 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
function onCheck (event, treeId, treeNode) {
+ if (treeNode.disabled) {
+ return false;
+ }
self._selectTreeNode(treeId, treeNode);
}
function onExpand (event, treeId, treeNode) {
+ if (treeNode.disabled) {
+ return false;
+ }
treeNode.halfCheck = false;
}
function onCollapse (event, treeId, treeNode) {
+ if (treeNode.disabled) {
+ return false;
+ }
}
return setting;
@@ -335,22 +349,39 @@ BI.TreeView = BI.inherit(BI.Pane, {
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
n.isParent = n.isParent || n.parent;
- n.value = BI.isUndefined(n.value) ? n.text : n.value;
- n.text = BI.isUndefined(n.text) ? n.value : n.text;
- if (n.text === null) {
- n.text = "";
- }
+ // n.value = BI.isUndefined(n.value) ? n.text : n.value;
+ // n.text = BI.isUndefined(n.text) ? n.value : n.text;
+ // if (n.text === null) {
+ // n.text = "";
+ // }
if (BI.isNull(n.title)) {
n.title = n.text;
}
- // 处理标红
- if (BI.isNotNull(n.text)) {
- if (BI.isKey(o.paras.keyword)) {
- n.text = BI.$("