Browse Source

Pull request #2362: BI-96759:toast支持closable属性,可控制是否显示关闭按钮

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

* commit '972e5c9c4f39aa57891b004b3be269b13c4a90a7':
  BI-96759:toast支持closable属性,可控制是否显示关闭按钮
es6
guy 3 years ago
parent
commit
81e6433e15
  1. 1
      changelog.md
  2. 5
      src/base/foundation/message.js
  3. 11
      src/base/single/tip/tip.toast.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2021-12)
- toast支持closable属性,可控制是否显示关闭按钮
- 新增气泡弹框控件
- BI.point支持widget添加埋点
- childContext废弃,替换成provide

5
src/base/foundation/message.js

@ -32,6 +32,7 @@ BI.Msg = function () {
cls: "bi-message-animate bi-message-leave",
level: level,
autoClose: autoClose,
closable: options.closable,
text: message,
listeners: [{
eventName: BI.Toast.EVENT_DESTORY,
@ -67,6 +68,10 @@ BI.Msg = function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy();
}, 5000);
return function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy();
};
},
_show: function (hasCancel, title, message, callback) {
BI.isNull($mask) && ($mask = BI.Widget._renderEngine.createElement("<div class=\"bi-z-index-mask\">").css({

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

@ -15,7 +15,9 @@ BI.Toast = BI.inherit(BI.Tip, {
return BI.extend(BI.Toast.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-toast",
text: "",
level: "success" // success或warning
level: "success", // success或warning
autoClose: true,
closable: null
});
},
@ -56,6 +58,9 @@ BI.Toast = BI.inherit(BI.Tip, {
break;
}
var hasCloseIcon = function () {
return o.closable === true || (o.closable === null && o.autoClose === false);
};
var items = [{
type: "bi.icon_label",
cls: cls + " toast-icon",
@ -68,12 +73,12 @@ BI.Toast = BI.inherit(BI.Tip, {
textHeight: 16,
textAlign: "left"
},
rgap: o.autoClose ? this._const.hgap : 0
rgap: hasCloseIcon() ? 0 : this._const.hgap
}];
var columnSize = [36, "fill"];
if (o.autoClose === false) {
if (hasCloseIcon()) {
items.push({
type: "bi.icon_button",
cls: "close-font toast-icon",

Loading…
Cancel
Save