Browse Source

Pull request #2572: 无JIRA任务 textHgap

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '2d27257f50784b53cefb1eadffcca4e8c0337d9a':
  新特性
  bugfix
es6
guy 3 years ago
parent
commit
c13d4fac92
  1. 23
      src/case/trigger/trigger.icon.text.js
  2. 16
      src/case/trigger/trigger.text.js

23
src/case/trigger/trigger.icon.text.js

@ -6,15 +6,18 @@
* @extends BI.Trigger * @extends BI.Trigger
*/ */
BI.IconTextTrigger = BI.inherit(BI.Trigger, { BI.IconTextTrigger = BI.inherit(BI.Trigger, {
_const: {
hgap: 4
},
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.IconTextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.IconTextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0,
textTgap: 0,
textBgap: 0,
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,
textCls: "" textCls: ""
@ -23,12 +26,18 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
_init: function () { _init: function () {
BI.IconTextTrigger.superclass._init.apply(this, arguments); 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({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: o.textHgap,
vgap: o.textVgap,
lgap: o.textLgap,
rgap: o.textRgap,
tgap: o.textTgap,
bgap: o.textBgap,
text: o.text text: o.text
}); });
this.trigerButton = BI.createWidget({ this.trigerButton = BI.createWidget({
@ -38,7 +47,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.htape", type: "bi.horizontal_fill",
ref: function (_ref) { ref: function (_ref) {
self.wrapper = _ref; self.wrapper = _ref;
}, },
@ -76,13 +85,13 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
this.icon.setIcon(iconCls); this.icon.setIcon(iconCls);
var iconItem = this.wrapper.attr("items")[0]; var iconItem = this.wrapper.attr("items")[0];
var textItem = this.wrapper.attr("items")[1]; var textItem = this.wrapper.attr("items")[1];
if(BI.isNull(iconCls) || BI.isEmptyString(iconCls)) { if (BI.isNull(iconCls) || BI.isEmptyString(iconCls)) {
if(iconItem.width !== 0) { if(iconItem.width !== 0) {
iconItem.width = 0; iconItem.width = 0;
textItem.lgap = 5; textItem.lgap = 5;
this.wrapper.resize(); this.wrapper.resize();
} }
}else{ } else {
if(iconItem.width !== (o.iconWrapperWidth || o.height)) { if(iconItem.width !== (o.iconWrapperWidth || o.height)) {
iconItem.width = (o.iconWrapperWidth || o.height); iconItem.width = (o.iconWrapperWidth || o.height);
textItem.lgap = 0; textItem.lgap = 0;

16
src/case/trigger/trigger.text.js

@ -6,9 +6,6 @@
* @extends BI.Trigger * @extends BI.Trigger
*/ */
BI.TextTrigger = BI.inherit(BI.Trigger, { BI.TextTrigger = BI.inherit(BI.Trigger, {
_const: {
hgap: 6
},
_defaultConfig: function () { _defaultConfig: function () {
var self = this; var self = this;
@ -16,6 +13,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
textHgap: 6,
textVgap: 0,
textLgap: 0,
textRgap: 0,
textTgap: 0,
textBgap: 0,
textCls: "", textCls: "",
title: function () { title: function () {
return self.text.getText(); return self.text.getText();
@ -34,7 +37,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
text: o.text, text: o.text,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle, 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 readonly: o.readonly
}); });
this.trigerButton = BI.createWidget({ this.trigerButton = BI.createWidget({

Loading…
Cancel
Save