|
|
@ -1,67 +1,31 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by GUY on 2015/6/26. |
|
|
|
* Created by GUY on 2021/11/7. |
|
|
|
* 属性 |
|
|
|
|
|
|
|
* textAlign |
|
|
|
|
|
|
|
* whiteSpace |
|
|
|
|
|
|
|
* textWidth |
|
|
|
|
|
|
|
* textHeight |
|
|
|
|
|
|
|
* highLight |
|
|
|
|
|
|
|
* keyword |
|
|
|
|
|
|
|
* py |
|
|
|
|
|
|
|
* handler |
|
|
|
|
|
|
|
* 方法 |
|
|
|
|
|
|
|
* setText |
|
|
|
|
|
|
|
* setStyle |
|
|
|
|
|
|
|
* doRedMark |
|
|
|
|
|
|
|
* unRedMark |
|
|
|
|
|
|
|
* doHighLight |
|
|
|
|
|
|
|
* unHighLight |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
!(function () { |
|
|
|
!(function () { |
|
|
|
|
|
|
|
// 实现一个简易版的ButtonGroup,FineUI中的ButtonGroup太复杂了。而且对于要单选多选这种功能,应该交给具体的List组件去解决。本ButtonGroup主要职责是在布局的基础之上提供刷新的功能
|
|
|
|
var Widget = BI.inherit(BI.Widget, { |
|
|
|
var Widget = BI.inherit(BI.Widget, { |
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
var layout = o.layouts[0]; |
|
|
|
var layout = o.layouts[0]; |
|
|
|
if (layout.scrollable) { |
|
|
|
// 将布局中的属性要处理下
|
|
|
|
this.element.css("overflow", "auto"); |
|
|
|
return BI.extend({}, layout, { |
|
|
|
} |
|
|
|
ref: function (_ref) { |
|
|
|
if (layout.scrollx) { |
|
|
|
self.list = _ref; |
|
|
|
this.element.css("overflow-x", "auto"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (layout.scrolly) { |
|
|
|
|
|
|
|
this.element.css("overflow-y", "auto"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.populate(o.items); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
items: o.items |
|
|
|
_mountChildren: function () { |
|
|
|
}) |
|
|
|
var self = this, o = this.options; |
|
|
|
|
|
|
|
for (var key in this._children) { |
|
|
|
|
|
|
|
var child = this._children[key]; |
|
|
|
|
|
|
|
if (child.element !== self.element) { |
|
|
|
|
|
|
|
this.element.append(child.element); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BI.Services.getService("swing.layout.service").layout(this.element, o.layouts[0]); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
populate: function (items) { |
|
|
|
populate: function (items) { |
|
|
|
var self = this, o = this.options; |
|
|
|
this.list.populate(items); |
|
|
|
this.element.empty(); |
|
|
|
|
|
|
|
this._children = []; |
|
|
|
|
|
|
|
BI.each(items, function (i, item) { |
|
|
|
|
|
|
|
self._children.push(BI.createWidget(item)); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this._mountChildren(); |
|
|
|
|
|
|
|
this.element.updateUI(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.shortcut("swing.button_group", Widget); |
|
|
|
BI.shortcut("swing.button_group", Widget); |
|
|
|
|
|
|
|
|
|
|
|
// 这里仅实现通过button_group来动态创建组件并能刷新的功能
|
|
|
|
// 这里仅实现通过button_group来动态创建组件并能刷新的功能
|
|
|
|
BI.config("bi.button_group", function (config) { |
|
|
|
BI.config("bi.button_group", function (config) { |
|
|
|
return BI.extend({}, config,{ |
|
|
|
return BI.extend({}, config, { |
|
|
|
type: "swing.button_group" |
|
|
|
type: "swing.button_group" |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|