define(["require", "exports", "@syncfusion/ej2-base", "react-dom", "react"], function (require, exports, ej2_base_1, ReactDOM, React) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stringCompiler = ej2_base_1.getTemplateEngine();
function compile(templateElement, helper) {
Iif (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
return stringCompiler(templateElement, helper);
}
else {
return function (data, component, prop, element) {
var actTemplate = templateElement;
var actData = data;
if (typeof actTemplate === 'object') {
actTemplate = templateElement.template;
actData = ej2_base_1.extend({}, data, templateElement.data || {});
}
var cEle;
Iif (element) {
cEle = element;
}
else {
cEle = document.createElement('div');
}
var rele = React.createElement(actTemplate, actData);
var portal = ReactDOM.createPortal(rele, cEle);
portal.propName = prop;
Eif (!component.portals) {
component.portals = [portal];
}
else {
component.portals.push(portal);
}
Eif (!element) {
return [cEle];
}
};
}
}
exports.compile = compile;
ej2_base_1.setTemplateEngine({ compile: compile });
});
|