react-application-core
Version:
A react-based application core for the business applications.
65 lines • 2.69 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationContainer = void 0;
var React = require("react");
var R = require("ramda");
var action_1 = require("../../action");
var util_1 = require("../../util");
var snackbar_1 = require("../snackbar");
var generic_container_1 = require("../base/generic.container");
var NotificationContainer = /** @class */ (function (_super) {
__extends(NotificationContainer, _super);
/**
* @stable [13.02.2020]
* @param {IUniversalContainerProps} props
*/
function NotificationContainer(props) {
var _this = _super.call(this, props) || this;
_this.clearCurrentNotification = _this.clearCurrentNotification.bind(_this);
return _this;
}
/**
* @stable [13.02.2020]
* @returns {JSX.Element}
*/
NotificationContainer.prototype.render = function () {
return (React.createElement(React.Fragment, null,
this.props.children,
this.snackbarElement));
};
Object.defineProperty(NotificationContainer.prototype, "snackbarElement", {
/**
* @stable [13.02.2020]
* @returns {JSX.Element}
*/
get: function () {
var notification = this.props.notification;
var hasError = !R.isNil(notification.error);
return (React.createElement(snackbar_1.Snackbar, { message: util_1.NvlUtils.nvl(notification.error, notification.info), error: hasError, afterShow: this.clearCurrentNotification }));
},
enumerable: false,
configurable: true
});
/**
* @stable [12.06.2020]
*/
NotificationContainer.prototype.clearCurrentNotification = function () {
this.dispatchPlainAction(action_1.NotificationActionBuilder.buildPlainClearAction());
};
return NotificationContainer;
}(generic_container_1.GenericContainer));
exports.NotificationContainer = NotificationContainer;
//# sourceMappingURL=notification.container.js.map