igniteui-react-core
Version:
Ignite UI React Core.
86 lines (85 loc) • 2.79 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as React from 'react';
export class IgrTemplateView extends React.Component {
constructor(props) {
super(props);
}
render() {
if (!this.props.template) {
return null;
}
let ele = React.createElement(this.props.template, { dataContext: this.props.dataContext });
return ele;
}
}
export class IgrTemplateContainer extends React.Component {
constructor(props) {
super(props);
this._template = null;
this._containerTemplate = null;
this._dataContext = null;
if (props.owner) {
this._currentOwner = props.owner;
}
}
componentDidUpdate() {
if (this.contentReady) {
this.contentReady();
}
}
render() {
if (!this._template) {
return null;
}
let ele = React.createElement(IgrTemplateView, { dataContext: this._dataContext, template: this._template });
if (this._containerTemplate !== null) {
}
else {
if (this.props.omitContainer) {
return (React.createElement(React.Fragment, null, ele));
}
else {
return (React.createElement("div", { className: 'ui-template-container', style: { display: "contents" } }, ele));
}
}
return ele;
}
get currentOwner() {
return this._currentOwner;
}
shouldComponentUpdate(nextProps, nextState) {
if (nextProps.owner !== undefined) {
this._currentOwner = nextProps.owner;
}
return true;
}
set template(value) {
this._template = value;
this.setState({ template: this._template });
}
get template() {
return this._template;
}
set containerTemplate(value) {
this._containerTemplate = value;
this.setState({ containerTemplate: this._containerTemplate });
}
get containerTemplate() {
return this._containerTemplate;
}
set dataContext(value) {
if (this._dataContext == null && value == null) {
return;
}
this._dataContext = value;
this.setState({ dataContext: this._dataContext });
}
get dataContext() {
return this._dataContext;
}
}