devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
71 lines (69 loc) • 2.34 kB
JavaScript
/**
* DevExtreme (cjs/__internal/grids/grid_core/toast/toast_view.js)
* Version: 26.1.6
* Build date: Fri Oct 16 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ToastView = void 0;
var _renderer = _interopRequireDefault(require("../../../../core/renderer"));
var _toast = _interopRequireDefault(require("../../../../ui/toast"));
var _modules = require("../modules/modules");
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
class ToastView extends _modules.View {
constructor() {
super(...arguments);
this._toastInstance = null;
this._$toastContainer = null
}
_createToastInstance(options) {
if (this._toastInstance) {
return this._toastInstance
}
if (!this._$toastContainer) {
this._$toastContainer = (0, _renderer.default)("<div>").appendTo(this.component.$element())
}
this._toastInstance = this._createComponent(this._$toastContainer, _toast.default, Object.assign({
position: {
my: "bottom",
at: "bottom",
of: this.component.$element().get(0)
}
}, options, {
visible: false
}));
return this._toastInstance
}
showToast(message) {
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
const toast = this._createToastInstance(options);
null === toast || void 0 === toast || toast.option(Object.assign({}, options, {
message: message,
visible: true
}))
}
async hideToast() {
var _this$_toastInstance;
await (null === (_this$_toastInstance = this._toastInstance) || void 0 === _this$_toastInstance ? void 0 : _this$_toastInstance.hide())
}
dispose() {
if (this._toastInstance) {
this._toastInstance.dispose();
this._toastInstance = null
}
if (this._$toastContainer) {
this._$toastContainer.remove();
this._$toastContainer = null
}
}
}
exports.ToastView = ToastView;