From 7210168eb53484f232d13b923513dd7ad7a570b4 Mon Sep 17 00:00:00 2001 From: treecat Date: Thu, 1 Sep 2022 10:26:25 +0800 Subject: [PATCH] =?UTF-8?q?Pull=20request=20#3033:=20REPORT-79369=20fix:?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8C=89=E9=92=AE=E6=96=87=E5=AD=97=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=85=AC=E5=BC=8F=20&=20=E6=97=A0jira=20feat:?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8C=89=E9=92=AEts=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge in VISUAL/fineui from ~TREECAT/fineui:master to master * commit '51a1dad7694f894e5ba6284178e15f8ecfc9cd4e': REPORT-79369 fix:修正按钮文字计算公式 & 无jira feat:补充按钮ts类型 --- demo/js/base/button/demo.button.js | 4 ++++ src/base/single/button/buttons/button.js | 5 +++-- typescript/base/single/button/buttons/button.ts | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) 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/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/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; }