UNPKG

@progress/kendo-base-component-react-wrapper

Version:

Kendo UI Base Component wrapper for React

54 lines 2.12 kB
"use strict"; /// <reference types="@progress/kendo-ui" /> 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 (b.hasOwnProperty(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 }); var React = require("react"); var KendoBaseComponent = /** @class */ (function (_super) { __extends(KendoBaseComponent, _super); function KendoBaseComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.didMount = false; _this.elementRef = function (el) { _this.domNode = el; }; _this.exposeWidget = function () { if (_this.props.widgetRef && typeof _this.props.widgetRef === 'function') { _this.props.widgetRef(_this.widgetInstance); } }; _this.overrideDestroy = function () { _this.widgetDestroy = _this.widgetInstance.destroy; _this.widgetInstance.destroy = function () { _this.destroyed = !_this.destroyed; _this.widgetDestroy.call(_this.widgetInstance); }; }; return _this; } KendoBaseComponent.prototype.componentDidMount = function () { this.exposeWidget(); this.overrideDestroy(); this.didMount = true; }; KendoBaseComponent.prototype.componentWillUnmount = function () { if (!this.destroyed) { this.widgetDestroy.call(this.widgetInstance); } this.exposeWidget(); }; return KendoBaseComponent; }(React.PureComponent)); exports.default = KendoBaseComponent; //# sourceMappingURL=index.js.map