From 1c096f3467334f585bc5a47f74c2d952174b785b Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 11 Feb 2022 15:45:20 +0800 Subject: [PATCH] =?UTF-8?q?node=E5=AE=B6=E6=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../single/button/node/icontexticonnode.js | 76 ++++++++----------- src/base/single/button/node/icontextnode.js | 54 ++++++------- src/base/single/button/node/texticonnode.js | 54 ++++++------- 3 files changed, 87 insertions(+), 97 deletions(-) diff --git a/src/base/single/button/node/icontexticonnode.js b/src/base/single/button/node/icontexticonnode.js index 01870423f..df2e28eb5 100644 --- a/src/base/single/button/node/icontexticonnode.js +++ b/src/base/single/button/node/icontexticonnode.js @@ -25,55 +25,41 @@ 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: [{ - el: { - type: "bi.icon_label", - cls: o.iconCls2, - width: o.height, - iconWidth: o.iconWidth, - iconHeight: o.iconHeight + type: "bi.icon_label", + cls: o.iconCls1, + width: o.leftIconWrapperWidth || o.height, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }, { + type: "bi.label", + ref: function (_ref) { + self.text = _ref; }, - top: 0, - bottom: 0, - right: 0 + 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 deb2c73be..653888a4a 100644 --- a/src/base/single/button/node/icontextnode.js +++ b/src/base/single/button/node/icontextnode.js @@ -24,33 +24,35 @@ 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; - BI.createWidget(BI.extend({ - element: this - }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, { - items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon, this.text) - })))); + 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 + }, { + 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/node/texticonnode.js b/src/base/single/button/node/texticonnode.js index 2231c4c88..71217b746 100644 --- a/src/base/single/button/node/texticonnode.js +++ b/src/base/single/button/node/texticonnode.js @@ -23,33 +23,35 @@ 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: [{ + 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 () {