Browse Source

DESIGN-3918 feat: 将各产品线的toast间距统一,不在提供可配.整理布局

es6
zsmj 2 years ago
parent
commit
1269422950
  1. 30
      src/base/single/tip/tip.toast.js

30
src/base/single/tip/tip.toast.js

@ -11,7 +11,6 @@ BI.Toast = BI.inherit(BI.Tip, {
minWidth: 100, minWidth: 100,
closableMaxWidth: 410, closableMaxWidth: 410,
maxWidth: 400, maxWidth: 400,
hgap: 8
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -21,7 +20,10 @@ BI.Toast = BI.inherit(BI.Tip, {
level: "success", // success或warning level: "success", // success或warning
autoClose: true, autoClose: true,
closable: null, closable: null,
vgap: 7, textHeight: 20,
vgap: 10,
innerHgap: 4,
hgap: 8,
}); });
}, },
@ -46,7 +48,7 @@ BI.Toast = BI.inherit(BI.Tip, {
mouseleave: fn, mouseleave: fn,
mousemove: fn mousemove: fn
}); });
var cls = "close-font"; var cls;
switch (o.level) { switch (o.level) {
case "success": case "success":
cls = "toast-success-font"; cls = "toast-success-font";
@ -72,19 +74,18 @@ BI.Toast = BI.inherit(BI.Tip, {
var items = [{ var items = [{
type: "bi.icon_label", type: "bi.icon_label",
cls: cls + " toast-icon", cls: cls + " toast-icon",
width: 36 height: o.textHeight,
}, { }, {
el: BI.isPlainObject(o.text) ? o.text : { el: BI.isPlainObject(o.text) ? o.text : {
type: "bi.label", type: "bi.label",
whiteSpace: "normal", whiteSpace: "normal",
text: o.text, text: o.text,
textHeight: 16, textHeight: o.textHeight,
textAlign: "left" textAlign: "left"
}, },
rgap: hasCloseIcon() ? 0 : this._const.hgap
}]; }];
var columnSize = [36, "fill"]; var columnSize = ["", "fill"];
if (hasCloseIcon()) { if (hasCloseIcon()) {
items.push({ items.push({
@ -93,23 +94,20 @@ BI.Toast = BI.inherit(BI.Tip, {
handler: function () { handler: function () {
self.destroy(); self.destroy();
}, },
width: 36 height: o.textHeight,
}); });
columnSize.push(36); columnSize.push("");
} }
this.text = BI.createWidget({ return {
type: "bi.horizontal", type: "bi.horizontal",
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
element: this,
items: items, items: items,
hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
innerHgap: o.innerHgap,
columnSize: columnSize columnSize: columnSize
}); };
},
setText: function (text) {
this.text.setText(text);
}, },
beforeDestroy: function () { beforeDestroy: function () {

Loading…
Cancel
Save