diff --git a/demo/js/base/button/demo.button.js b/demo/js/base/button/demo.button.js index 651d98e4a..981683e84 100644 --- a/demo/js/base/button/demo.button.js +++ b/demo/js/base/button/demo.button.js @@ -381,6 +381,10 @@ Demo.Button = BI.inherit(BI.Widget, { text: "文字偏左的按钮", textAlign: "left", width: 200, + }, { + type: "bi.button", + text: "小于最小宽度的按钮", + width: 50, }]; return { diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot index 03229fc15..015c39e65 100644 Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg index d42743015..2205e4bc4 100644 --- a/dist/font/iconfont.svg +++ b/dist/font/iconfont.svg @@ -14,6 +14,22 @@ /> + + + + + + + + + + + + + + + + @@ -22,11 +38,11 @@ - + - + - + @@ -558,7 +574,7 @@ - + @@ -586,7 +602,7 @@ - + @@ -624,7 +640,7 @@ - + @@ -764,7 +780,7 @@ - + @@ -954,7 +970,7 @@ - + @@ -1122,7 +1138,7 @@ - + @@ -1526,7 +1542,7 @@ - + @@ -1662,7 +1678,7 @@ - + @@ -1854,7 +1870,7 @@ - + @@ -1866,11 +1882,11 @@ - + - + diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf index 9f5992b0b..674d12bbe 100644 Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff index b80e55a8c..77bcb44e4 100644 Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2 index cf155be60..379326119 100644 Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js index 2eb0fe1df..2a9c77d85 100644 --- a/src/base/single/1.text.js +++ b/src/base/single/1.text.js @@ -65,7 +65,7 @@ tagName: "span", }); this.text.element.click(function (e) { - !o.disabled && o.invalid && o.handler.call(self, self.getValue(), self, e); + !o.disabled && !o.invalid && o.handler.call(self, self.getValue(), self, e); }); BI.createWidget({ type: "bi.default", diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 94b590f84..9965b1ff1 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -107,8 +107,9 @@ }); } - // 用于 whiteSpace - var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; + // 用户可能设置的 width 小于按钮的最小宽度 + var actualWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width; + var textWidth = iconInvisible && o.width ? actualWidth - o.hgap * 2 : null; if (BI.isNotNull(o.textWidth)) { // textWidth 需要减去图标 textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth); diff --git a/src/less/widget/multiselect/multiselect.combo.less b/src/less/widget/multiselect/multiselect.combo.less index 0399dd67a..fb8942963 100644 --- a/src/less/widget/multiselect/multiselect.combo.less +++ b/src/less/widget/multiselect/multiselect.combo.less @@ -1,9 +1,12 @@ @import "../../index.less"; + @val: transform .3s ease; -.bi-multi-select-combo{ - & .multi-select-trigger-icon-button{ + +.bi-multi-select-combo, .bi-multi-select-combo-no-bar { + & .multi-select-trigger-icon-button { font-size: @font-size-16; } + // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 & .bi-combo.bi-combo-popup + .bi-trigger-icon-button { & .x-icon { @@ -11,6 +14,7 @@ .transition(@val); } } + & .bi-combo + .bi-trigger-icon-button { & .x-icon { .rotate(0deg); diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index 0fe10f947..b06a40662 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -174,7 +174,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { value: o.value }, hideChecker: function (e) { - return self.numberCounter.element.find(e.target).length === 0; + return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; } }); @@ -199,6 +199,21 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { } }); + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + width: o.height, + height: o.height, + cls: "multi-select-trigger-icon-button" + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + self.numberCounter.hideView(); + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + this.numberCounter = BI.createWidget({ type: "bi.multi_select_check_selected_switcher", masker: { @@ -252,6 +267,11 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { right: 0, top: 0, bottom: 0 + }, { + el: triggerBtn, + right: 0, + top: 0, + bottom: 0 }, { el: { type: "bi.vertical_adapt", diff --git a/typescript/base/single/button/buttons/button.ts b/typescript/base/single/button/buttons/button.ts index 55f62ef8b..9b357ae0c 100644 --- a/typescript/base/single/button/buttons/button.ts +++ b/typescript/base/single/button/buttons/button.ts @@ -14,6 +14,9 @@ export declare class Button extends BasicButton { block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制 clear?: boolean; // 是否去掉边框和背景 ghost?: boolean; // 是否幽灵显示, 即正常状态无背景 + iconGap?: number; + iconPosition?: string; + textWidth?: number; } & AbstractLabel['props'] & IconLabel['props'] & BasicButton['props']; text: Label; @@ -26,4 +29,12 @@ export declare class Button extends BasicButton { doHighLight(...args: any[]): void; unHighLight(...args: any[]): void; + + loading(): void; + + loaded(): void; + + setIcon(iconCls: string): void; + + isLoading(): boolean; }