Browse Source

Merge pull request #160728 in DEC/fineui from master to feature/x

* commit '7d71a3d01e4a6aceee9cf9a6a547c949f0e6fdde':
  REPORT-79369 fix:修正按钮文字计算公式 & 无jira feat:补充按钮ts类型
master
superman 2 years ago
parent
commit
1d872582eb
  1. 4
      demo/js/base/button/demo.button.js
  2. 5
      src/base/single/button/buttons/button.js
  3. 11
      typescript/base/single/button/buttons/button.ts

4
demo/js/base/button/demo.button.js

@ -381,6 +381,10 @@ Demo.Button = BI.inherit(BI.Widget, {
text: "文字偏左的按钮", text: "文字偏左的按钮",
textAlign: "left", textAlign: "left",
width: 200, width: 200,
}, {
type: "bi.button",
text: "小于最小宽度的按钮",
width: 50,
}]; }];
return { return {

5
src/base/single/button/buttons/button.js

@ -107,8 +107,9 @@
}); });
} }
// 用于 whiteSpace // 用户可能设置的 width 小于按钮的最小宽度
var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; 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)) { if (BI.isNotNull(o.textWidth)) {
// textWidth 需要减去图标 // textWidth 需要减去图标
textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth); textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth);

11
typescript/base/single/button/buttons/button.ts

@ -14,6 +14,9 @@ export declare class Button extends BasicButton {
block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制 block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制
clear?: boolean; // 是否去掉边框和背景 clear?: boolean; // 是否去掉边框和背景
ghost?: boolean; // 是否幽灵显示, 即正常状态无背景 ghost?: boolean; // 是否幽灵显示, 即正常状态无背景
iconGap?: number;
iconPosition?: string;
textWidth?: number;
} & AbstractLabel['props'] & IconLabel['props'] & BasicButton['props']; } & AbstractLabel['props'] & IconLabel['props'] & BasicButton['props'];
text: Label; text: Label;
@ -26,4 +29,12 @@ export declare class Button extends BasicButton {
doHighLight(...args: any[]): void; doHighLight(...args: any[]): void;
unHighLight(...args: any[]): void; unHighLight(...args: any[]): void;
loading(): void;
loaded(): void;
setIcon(iconCls: string): void;
isLoading(): boolean;
} }

Loading…
Cancel
Save