react-application-core
Version:
A react-based application core for the business applications.
69 lines • 2.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaterialPlugin = void 0;
var R = require("ramda");
var di_1 = require("../../../di");
var util_1 = require("../../../util");
var MaterialPlugin = /** @class */ (function () {
/**
* @stable [18.06.2019]
* @param {TComponent} component
* @param {INativeMaterialComponentFactory<TNativeMaterialComponent extends INativeMaterialComponent>} mdcFactory
*/
function MaterialPlugin(component, mdcFactory) {
this.component = component;
this.mdcFactory = mdcFactory;
}
/**
* @stable [31.08.2018]
*/
MaterialPlugin.prototype.componentDidMount = function () {
var self = this.component.selfRef;
if (!R.isNil(self)) {
this.mdc = this.mdcFactory.attachTo(self.current);
}
};
/**
* @stable [05.05.2018]
*/
MaterialPlugin.prototype.componentWillUnmount = function () {
if (this.doesMdcExist) {
this.mdc.destroy();
}
};
Object.defineProperty(MaterialPlugin.prototype, "adapter", {
/**
* @stable [15.08.2018]
*/
get: function () {
return this.mdc.foundation_.adapter_;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MaterialPlugin.prototype, "doesMdcExist", {
/**
* @stable [17.06.2019]
* @returns {boolean}
*/
get: function () {
return util_1.isDef(this.mdc);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MaterialPlugin.prototype, "t", {
/**
* @stable [22.08.2018]
* @returns {TranslatorT}
*/
get: function () {
return di_1.staticInjector(di_1.DI_TYPES.Translate);
},
enumerable: false,
configurable: true
});
return MaterialPlugin;
}());
exports.MaterialPlugin = MaterialPlugin;
//# sourceMappingURL=material.plugin.js.map