From 432735f0e66687c43bc3538c93f2a430ed944f49 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 11 Feb 2022 14:58:15 +0800 Subject: [PATCH] =?UTF-8?q?icon=5Ftext=5Fitem=E6=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../button/listitem/blankiconicontextitem.js | 75 +++++++++-------- .../button/listitem/blankicontexticonitem.js | 81 ++++++++----------- .../button/listitem/blankicontextitem.js | 62 +++++++------- .../button/listitem/icontexticonitem.js | 76 +++++++---------- .../single/button/listitem/icontextitem.js | 55 ++++++------- .../single/button/listitem/texticonitem.js | 56 ++++++------- 6 files changed, 190 insertions(+), 215 deletions(-) diff --git a/src/base/single/button/listitem/blankiconicontextitem.js b/src/base/single/button/listitem/blankiconicontextitem.js index 9e8301a53..3c0fcb94b 100644 --- a/src/base/single/button/listitem/blankiconicontextitem.js +++ b/src/base/single/button/listitem/blankiconicontextitem.js @@ -27,45 +27,44 @@ 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 + }, { + 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..9085d997d 100644 --- a/src/base/single/button/listitem/blankicontexticonitem.js +++ b/src/base/single/button/listitem/blankicontexticonitem.js @@ -28,57 +28,44 @@ 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 + }, { + 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..f35dbe582 100644 --- a/src/base/single/button/listitem/blankicontextitem.js +++ b/src/base/single/button/listitem/blankicontextitem.js @@ -26,38 +26,38 @@ 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, "fill", o.iconWrapperWidth || o.height], + items: [{ + type: "bi.layout", + width: o.blankWidth + }, { + 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/listitem/icontexticonitem.js b/src/base/single/button/listitem/icontexticonitem.js index 1624e50e4..80e0d0a1c 100644 --- a/src/base/single/button/listitem/icontexticonitem.js +++ b/src/base/single/button/listitem/icontexticonitem.js @@ -27,55 +27,41 @@ 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 || o.height, - 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: [{ - el: { - type: "bi.icon_label", - cls: o.iconCls2, - width: o.rightIconWrapperWidth || o.height, - height: 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/listitem/icontextitem.js b/src/base/single/button/listitem/icontextitem.js index 44f83f376..6d3bf7199 100644 --- a/src/base/single/button/listitem/icontextitem.js +++ b/src/base/single/button/listitem/icontextitem.js @@ -27,34 +27,35 @@ 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; - 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) - })))); + 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/listitem/texticonitem.js b/src/base/single/button/listitem/texticonitem.js index 7eb468087..87d188859 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,35 @@ 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: [{ + 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 () {