Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-react-base

Package Overview
Dependencies
Maintainers
3
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-react-base - npm Package Compare versions

Comparing version 17.4.51 to 18.1.36-beta

src/component-base-hybrid.d.ts

16

CHANGELOG.md

@@ -9,18 +9,2 @@ # Changelog

- `#I262905` - Resolved adding multiple CSS Class name in element.
## 17.4.41 (2020-01-07)
### Common
#### Bug Fixes
- Resolved the React `Lifecycle` warnings in the console.
## 17.4.39 (2019-12-17)
### Common
#### Bug Fixes
- Resolved the `delayUpdate` property type issue.

@@ -27,0 +11,0 @@

6

dist/ej2-react-base.umd.min.js
/*!
* filename: ej2-react-base.umd.min.js
* version : 17.4.51
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
* version : 18.1.36-beta
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
* Use of this code is subject to the terms of our license.

@@ -10,3 +10,3 @@ * A copy of the current license can be obtained at any time by e-mailing

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@syncfusion/ej2-base"],t):t(e.ej={},e.React,e.ReactDOM,e.ej2Base)}(this,function(e,t,r,i){"use strict";function n(e,t){return"string"==typeof e?d(e,t):function(t){var n=document.createElement("div");document.body.appendChild(n);var o=e,s=t;return"object"==typeof o&&(o=e.template,s=i.extend({},t,e.data||{})),r.render(o(s),n),i.detach(n),n.children}}var o=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),s=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],p=["accordion","tab","splitter"],c=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t.isReact=!0,t}return o(n,e),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0;var e=Object.keys(this.props);this.htmlattributes={},this.attrKeys=s.concat(this.controlAttributes||[]);for(var t=0,r=e;t<r.length;t++){var i=r[t];-1===i.indexOf("data-")&&-1===i.indexOf("aria-")&&-1===this.attrKeys.indexOf(i)||(this.htmlattributes[i]=this.props[i])}},n.prototype.componentDidMount=function(){var e=this;this.refreshChild(!0),this.canDelayUpdate=-1!==p.indexOf(this.getModuleName()),this.props.immediateRender?this.renderReactComponent():this.cachedTimeOut=setTimeout(function(){e.renderReactComponent()})},n.prototype.renderReactComponent=function(){var e=r.findDOMNode(this);e&&(this.isAppendCalled=!0,this.appendTo(e))},n.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},e),o=0,s=Object.keys(e);o<s.length;o++){var p=s[o],c="className"===p;if(c||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===e[p])delete n[p];else if(-1!==this.attrKeys.indexOf(p))if(c){this.props[p].split(" ").forEach(function(e){t.element.classList.remove(e)});n[p].split(" ").forEach(function(e){t.element.classList.add(e)})}else"disabled"!==p&&delete n[p]}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){t.refreshProperties(n,e)}):this.refreshProperties(n,e)},n.prototype.refreshProperties=function(e,t){Object.keys(e).length&&(this.processComplexTemplate(e,this),this.setProperties(e)),this.refreshChild(!1,t)},n.prototype.processComplexTemplate=function(e,t){var r=t.complexTemplate;if(r)for(var n in r){var o=r[n];e[n]&&i.setValue(o,i.getValue(n,e),e)}},n.prototype.getDefaultAttributes=function(){return this.htmlattributes},n.prototype.trigger=function(e,t,r){if(!0!==this.isDestroyed){"change"!==e&&"input"!==e||this.props.onChange&&t.event&&this.props.onChange.call(void 0,{syntheticEvent:t.event,nativeEvent:{text:t.value},value:t.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(e,t,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,t||this.props);if(p){if(!e&&this.skipRefresh)for(var c=0,a=this.skipRefresh;c<a.length;c++){delete p[a[c]]}if(this.prevProperties)for(var h=Object.keys(this.prevProperties),l=0;l<h.length;l++){var u=h[l];if(this.compareObjects(this.prevProperties[u],p[u]))delete p[u];else{var d={};d[u]=p[u],this.prevProperties=i.extend(this.prevProperties,d)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,e)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(e,r,i){for(var n=!1,o=0,s=t.Children.toArray(i.children);o<s.length;o++){var p=s[o],c=this.getChildType(p),a=r[c];if(c&&r){var h=this.getChildProps(t.Children.toArray(p.props.children),a);h.length&&(n=!0,e[p.type.propertyName||c]=h)}}return n?e:null},n.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},n.prototype.getChildProps=function(e,t){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n],p=!1,c=void 0;"string"==typeof t?(p=!0,c=t):c=Object.keys(t)[0];var a=s.props;if(this.getChildType(s)===c)if(p||!a.children){var h=i.extend({},a,{},!0);this.processComplexTemplate(h,s.type),r.push(h)}else{var l=this.validateChildren(i.extend({},a),t[c],a)||a;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var i=r[e];if(i.type.isService)return i.props.services}return[]},n}(t.PureComponent),a=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.render=function(){return null},t.isDirective=!0,t}(t.PureComponent),l=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.render=function(){return null},t.isService=!0,t}(t.PureComponent),d=i.getTemplateEngine();i.setTemplateEngine({compile:n}),e.ComponentBase=c,e.applyMixins=function(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(r){e.prototype[r]=t.prototype[r]})})},e.ComplexBase=h,e.Inject=u,e.compile=n,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@syncfusion/ej2-base"],t):t(e.ej={},e.React,e.ReactDOM,e.ej2Base)}(this,function(e,t,r,i){"use strict";function n(e,t){return"string"==typeof e?y(e,t):function(t,n){var o=e,s=t;if("object"==typeof o&&(o=e.template,s=i.extend({},t,e.data||{})),n&&n.isReactHybrid)return[{template:o,data:t}];var p=document.createElement("div");return document.body.appendChild(p),r.render(o(s),p),i.detach(p),p.children}}var o=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),s=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],p=["accordion","tab","splitter"],a=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t.initRenderCalled=!1,t.isReact=!0,t}return o(n,e),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0;var e=Object.keys(this.props);this.htmlattributes={},this.attrKeys=s.concat(this.controlAttributes||[]);for(var t=0,r=e;t<r.length;t++){var i=r[t];-1===i.indexOf("data-")&&-1===i.indexOf("aria-")&&-1===this.attrKeys.indexOf(i)||(this.htmlattributes[i]=this.props[i])}},n.prototype.componentDidMount=function(){var e=this;this.refreshChild(!0),this.canDelayUpdate=-1!==p.indexOf(this.getModuleName()),this.props.immediateRender?this.renderReactComponent():this.cachedTimeOut=setTimeout(function(){e.renderReactComponent()})},n.prototype.renderReactComponent=function(){var e=r.findDOMNode(this);e&&(this.isAppendCalled=!0,this.appendTo(e))},n.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;if(this.initRenderCalled){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},e),o=0,s=Object.keys(e);o<s.length;o++){var p=s[o],a="className"===p;a||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===e[p]?delete n[p]:-1!==this.attrKeys.indexOf(p)&&(a?(this.element.classList.remove(this.props[p]),this.element.classList.add(n[p])):"disabled"!==p&&delete n[p])}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){t.refreshProperties(n,e)}):this.refreshProperties(n,e)}},n.prototype.refreshProperties=function(e,t){Object.keys(e).length&&(this.processComplexTemplate(e,this),this.setProperties(e)),this.refreshChild(!1,t)},n.prototype.processComplexTemplate=function(e,t){var r=t.complexTemplate;if(r)for(var n in r){var o=r[n];e[n]&&i.setValue(o,i.getValue(n,e),e)}},n.prototype.getDefaultAttributes=function(){return this.htmlattributes},n.prototype.trigger=function(e,t,r){if(!0!==this.isDestroyed){"change"!==e&&"input"!==e||this.props.onChange&&t.event&&this.props.onChange.call(void 0,{syntheticEvent:t.event,nativeEvent:{text:t.value},value:t.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(e,t,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,t||this.props);if(p){if(!e&&this.skipRefresh)for(var a=0,h=this.skipRefresh;a<h.length;a++){delete p[h[a]]}if(this.prevProperties)for(var c=Object.keys(this.prevProperties),l=0;l<c.length;l++){var d=c[l];if(this.compareObjects(this.prevProperties[d],p[d]))delete p[d];else{var u={};u[d]=p[d],this.prevProperties=i.extend(this.prevProperties,u)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,e)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(e,r,i){for(var n=!1,o=0,s=t.Children.toArray(i.children);o<s.length;o++){var p=s[o],a=this.getChildType(p),h=r[a];if(a&&r){var c=this.getChildProps(t.Children.toArray(p.props.children),h);c.length&&(n=!0,e[p.type.propertyName||a]=c)}}return n?e:null},n.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},n.prototype.getChildProps=function(e,t){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n],p=!1,a=void 0;"string"==typeof t?(p=!0,a=t):a=Object.keys(t)[0];var h=s.props;if(this.getChildType(s)===a)if(p||!h.children){var c=i.extend({},h,{},!0);this.processComplexTemplate(c,s.type),r.push(c)}else{var l=this.validateChildren(i.extend({},h),t[a],h)||h;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var i=r[e];if(i.type.isService)return i.props.services}return[]},n}(t.PureComponent),h=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),c=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t.isReact=!0,t}return h(n,e),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0},n.prototype.generateReactElements=function(e){var r=e.children;if(r&&r.length){for(var i=[],n=0,o=r.length;n<o;n++){var s=r[n];"string"==typeof s?i.push(s):s.tagName?i.push(this.generateReactElements(s)):s.template&&i.push(t.createElement(s.template,s.data||{}))}return t.createElement(e.tagName,e.attributes,i)}return t.createElement(e.tagName,e.attributes)},n.prototype.componentDidMount=function(){this.mount&&this.mount()},n.prototype.componentDidUpdate=function(){this.currentContext(this.currentContext.calls,this.currentContext.args)},n.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},e),o=0,s=Object.keys(e);o<s.length;o++){var p=s[o],a="className"===p;a||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===e[p]?delete n[p]:-1!==this.attrKeys.indexOf(p)&&(a?(this.element.classList.remove(this.props[p]),this.element.classList.add(n[p])):"disabled"!==p&&delete n[p])}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){t.refreshProperties(n,e)}):this.refreshProperties(n,e)},n.prototype.refreshProperties=function(e,t){Object.keys(e).length&&(this.processComplexTemplate(e,this),this.setProperties(e)),this.refreshChild(!1,t)},n.prototype.processComplexTemplate=function(e,t){var r=t.complexTemplate;if(r)for(var n in r){var o=r[n];e[n]&&i.setValue(o,i.getValue(n,e),e)}},n.prototype.trigger=function(e,t,r){if(!0!==this.isDestroyed){"change"!==e&&"input"!==e||this.props.onChange&&t.event&&this.props.onChange.call(void 0,{syntheticEvent:t.event,nativeEvent:{text:t.value},value:t.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(e,t,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,t||this.props);if(p){if(!e&&this.skipRefresh)for(var a=0,h=this.skipRefresh;a<h.length;a++){delete p[h[a]]}if(this.prevProperties)for(var c=Object.keys(this.prevProperties),l=0;l<c.length;l++){var d=c[l];if(this.compareObjects(this.prevProperties[d],p[d]))delete p[d];else{var u={};u[d]=p[d],this.prevProperties=i.extend(this.prevProperties,u)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,e)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(e,r,i){for(var n=!1,o=0,s=t.Children.toArray(i.children);o<s.length;o++){var p=s[o],a=this.getChildType(p),h=r[a];if(a&&r){var c=this.getChildProps(t.Children.toArray(p.props.children),h);c.length&&(n=!0,e[p.type.propertyName||a]=c)}}return n?e:null},n.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},n.prototype.getChildProps=function(e,t){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n],p=!1,a=void 0;"string"==typeof t?(p=!0,a=t):a=Object.keys(t)[0];var h=s.props;if(this.getChildType(s)===a)if(p||!h.children){var c=i.extend({},h,{},!0);this.processComplexTemplate(c,s.type),r.push(c)}else{var l=this.validateChildren(i.extend({},h),t[a],h)||h;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var i=r[e];if(i.type.isService)return i.props.services}return[]},n}(t.PureComponent),l=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.render=function(){return null},t.isDirective=!0,t}(t.PureComponent),u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){return null},t.isService=!0,t}(t.PureComponent),y=i.getTemplateEngine();i.setTemplateEngine({compile:n}),e.ComponentBase=a,e.ComponentBaseHybrid=c,e.applyMixins=function(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(r){e.prototype[r]=t.prototype[r]})})},e.ComplexBase=d,e.Inject=f,e.compile=n,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-react-base.umd.min.js.map

@@ -1,2 +0,2 @@

import { Children, PureComponent } from 'react';
import { Children, PureComponent, createElement } from 'react';
import { findDOMNode, render } from 'react-dom';

@@ -19,2 +19,3 @@ import { detach, extend, getTemplateEngine, getValue, isNullOrUndefined, setTemplateEngine, setValue } from '@syncfusion/ej2-base';

this.isAppendCalled = false;
this.initRenderCalled = false;
this.isReact = true;

@@ -68,2 +69,5 @@ }

UNSAFE_componentWillReceiveProps(nextProps) {
if (!this.initRenderCalled) {
return;
}
if (!this.isAppendCalled) {

@@ -87,12 +91,4 @@ clearTimeout(this.cachedTimeOut);

if (isClassName) {
let delCheck = this.props[propkey];
let delSplit = delCheck.split(" ");
delSplit.forEach((delValue) => {
this.element.classList.remove(delValue);
});
let addCheck = dProps[propkey];
let addSplit = addCheck.split(" ");
addSplit.forEach((addValue) => {
this.element.classList.add(addValue);
});
this.element.classList.remove(this.props[propkey]);
this.element.classList.add(dProps[propkey]);
}

@@ -284,2 +280,268 @@ else if (propkey !== 'disabled') {

/**
* React Component Base
*/
// tslint:disable
class ComponentBaseHybrid extends PureComponent {
constructor() {
super(...arguments);
this.attrKeys = [];
this.cachedTimeOut = 0;
this.isAppendCalled = false;
this.isReact = true;
}
// Lifecycle methods are changed by React team and so we can deprecate this method and use
// Reference link:https://reactjs.org/docs/react-component.html#unsafe_componentWillMount
// tslint:disable-next-line:no-any
/**
* @private
*/
UNSAFE_componentWillMount() {
this.isReact = true;
}
/* tslint:disable:no-any */
generateReactElements(ele) {
let childrens = ele.children;
if (childrens && childrens.length) {
let childObject = [];
for (let i = 0, length = childrens.length; i < length; i++) {
let child = childrens[i];
if (typeof (child) === 'string') {
childObject.push(child);
}
else {
if (!child.tagName) {
if (child.template) {
childObject.push(createElement(child.template, child.data || {}));
}
}
else {
childObject.push(this.generateReactElements(child));
}
}
}
return createElement(ele.tagName, ele.attributes, childObject);
}
else {
return createElement(ele.tagName, ele.attributes);
}
}
componentDidMount() {
if (this.mount) {
this.mount();
}
}
componentDidUpdate() {
this.currentContext(this.currentContext.calls, this.currentContext.args);
}
// Lifecycle methods are changed by React team and so we can deprecate this method and use
// Reference link:https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
// tslint:disable-next-line:no-any
/**
* @private
*/
UNSAFE_componentWillReceiveProps(nextProps) {
if (!this.isAppendCalled) {
clearTimeout(this.cachedTimeOut);
this.isAppendCalled = true;
this.appendTo(findDOMNode(this));
}
let dProps = extend({}, nextProps);
let keys = Object.keys(nextProps);
for (let propkey of keys) {
let isClassName = propkey === 'className';
if (!isClassName && !isNullOrUndefined(this.htmlattributes[propkey]) &&
this.htmlattributes[propkey] !== dProps[propkey]) {
this.htmlattributes[propkey] = dProps[propkey];
}
if (this.props[propkey] === nextProps[propkey]) {
delete dProps[propkey];
}
else if (this.attrKeys.indexOf(propkey) !== -1) {
if (isClassName) {
this.element.classList.remove(this.props[propkey]);
this.element.classList.add(dProps[propkey]);
}
else if (propkey !== 'disabled') {
delete dProps[propkey];
}
}
}
if (dProps['children']) {
delete dProps['children'];
}
// tslint:disable-next-line:no-any
if (this.canDelayUpdate || this.props.delayUpdate) {
setTimeout(() => {
this.refreshProperties(dProps, nextProps);
});
}
else {
this.refreshProperties(dProps, nextProps);
}
}
refreshProperties(dProps, nextProps) {
if (Object.keys(dProps).length) {
// tslint:disable-next-line:no-any
this.processComplexTemplate(dProps, this);
this.setProperties(dProps);
}
this.refreshChild(false, nextProps);
}
processComplexTemplate(curObject, context) {
let compTemplate = context.complexTemplate;
if (compTemplate) {
for (let prop in compTemplate) {
let PropVal = compTemplate[prop];
if (curObject[prop]) {
setValue(PropVal, getValue(prop, curObject), curObject);
}
}
}
}
/* tslint:disable:no-any */
trigger(eventName, eventProp, successHandler) {
if (this.isDestroyed !== true) {
if ((eventName === 'change' || eventName === 'input')) {
if (this.props.onChange && eventProp.event) {
this.props.onChange.call(undefined, {
syntheticEvent: eventProp.event,
nativeEvent: { text: eventProp.value },
value: eventProp.value,
target: this
});
}
}
let prevDetection = this.isProtectedOnChange;
this.isProtectedOnChange = false;
this.modelObserver.notify(eventName, eventProp, successHandler);
this.isProtectedOnChange = prevDetection;
}
}
compareObjects(oldProps, newProps) {
return JSON.stringify(oldProps) === JSON.stringify(newProps);
}
refreshChild(silent, props) {
if (this.checkInjectedModules) {
let prevModule = this.getInjectedModules() || [];
let curModule = this.getInjectedServices() || [];
for (let mod of curModule) {
if (prevModule.indexOf(mod) === -1) {
prevModule.push(mod);
}
}
this.injectedModules = prevModule;
}
if (this.directivekeys) {
let directiveValue = this.validateChildren({}, this.directivekeys, (props || this.props));
if (directiveValue) {
if (!silent && this.skipRefresh) {
for (let fields of this.skipRefresh) {
delete directiveValue[fields];
}
}
if (this.prevProperties) {
var dKeys = Object.keys(this.prevProperties);
for (var i = 0; i < dKeys.length; i++) {
var key = dKeys[i];
if (this.compareObjects(this.prevProperties[key], directiveValue[key])) {
delete directiveValue[key];
}
else {
let obj = {};
obj[key] = directiveValue[key];
this.prevProperties = extend(this.prevProperties, obj);
}
}
}
else {
this.prevProperties = extend({}, directiveValue, {}, true);
}
this.setProperties(directiveValue, silent);
}
}
}
componentWillUnmount() {
clearTimeout(this.cachedTimeOut);
this.destroy();
}
/* tslint:disable:no-any */
validateChildren(childCache, mapper, props) {
let flag = false;
let childs = Children.toArray(props.children);
for (let child of childs) {
let ifield = this.getChildType(child);
let key = mapper[ifield];
if (ifield && mapper) {
// tslint:disable
let childProps = this.getChildProps(Children.toArray(child.props.children), key);
if (childProps.length) {
flag = true;
// tslint:disable
childCache[child.type.propertyName || ifield] = childProps;
}
}
}
if (flag) {
return childCache;
}
return null;
}
// tslint:disable:no-any
getChildType(child) {
if (child.type && child.type.isDirective) {
return child.type.moduleName || '';
}
return '';
}
getChildProps(subChild, matcher) {
let ret = [];
for (let child of subChild) {
let accessProp = false;
let key;
if (typeof matcher === 'string') {
accessProp = true;
key = matcher;
}
else {
key = Object.keys(matcher)[0];
}
let prop = child.props;
// tslint:disable-next-line:no-any
let field = this.getChildType(child);
if (field === key) {
if (accessProp || !prop.children) {
// tslint:disable
let cacheVal = extend({}, prop, {}, true);
// tslint:disable
this.processComplexTemplate(cacheVal, child.type);
ret.push(cacheVal);
}
else {
let cachedValue = this.validateChildren(extend({}, prop), matcher[key], prop) || prop;
if (cachedValue['children']) {
delete cachedValue['children'];
}
// tslint:disable
this.processComplexTemplate(cachedValue, child.type);
ret.push(cachedValue);
}
}
}
return ret;
}
// tslint:disable:no-any
getInjectedServices() {
let childs = Children.toArray(this.props.children);
for (let child of childs) {
/* tslint:disable:no-any */
if (child.type.isService) {
return child.props.services;
}
}
return [];
}
}
/* tslint:enable:no-any */
// tslint:disable-next-line:no-any

@@ -326,5 +588,3 @@ function applyMixins(derivedClass, baseClass) {

else {
return (data) => {
let ele = document.createElement('div');
document.body.appendChild(ele);
return (data, component) => {
let actTemplate = templateElement;

@@ -336,5 +596,12 @@ let actData = data;

}
render(actTemplate(actData), ele);
detach(ele);
return ele.children;
if (component && component.isReactHybrid) {
return [{ template: actTemplate, data: data }];
}
else {
let ele = document.createElement('div');
document.body.appendChild(ele);
render(actTemplate(actData), ele);
detach(ele);
return ele.children;
}
};

@@ -349,3 +616,3 @@ }

export { ComponentBase, applyMixins, ComplexBase, Inject, compile };
export { ComponentBase, ComponentBaseHybrid, applyMixins, ComplexBase, Inject, compile };
//# sourceMappingURL=ej2-react-base.es2015.js.map

@@ -1,2 +0,2 @@

import { Children, PureComponent } from 'react';
import { Children, PureComponent, createElement } from 'react';
import { findDOMNode, render } from 'react-dom';

@@ -33,2 +33,3 @@ import { detach, extend, getTemplateEngine, getValue, isNullOrUndefined, setTemplateEngine, setValue } from '@syncfusion/ej2-base';

_this.isAppendCalled = false;
_this.initRenderCalled = false;
_this.isReact = true;

@@ -86,2 +87,5 @@ return _this;

var _this = this;
if (!this.initRenderCalled) {
return;
}
if (!this.isAppendCalled) {

@@ -106,12 +110,4 @@ clearTimeout(this.cachedTimeOut);

if (isClassName) {
var delCheck = this.props[propkey];
var delSplit = delCheck.split(" ");
delSplit.forEach(function (delValue) {
_this.element.classList.remove(delValue);
});
var addCheck = dProps[propkey];
var addSplit = addCheck.split(" ");
addSplit.forEach(function (addValue) {
_this.element.classList.add(addValue);
});
this.element.classList.remove(this.props[propkey]);
this.element.classList.add(dProps[propkey]);
}

@@ -310,2 +306,292 @@ else if (propkey !== 'disabled') {

var __extends$1 = (undefined && undefined.__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 __());
};
})();
/**
* React Component Base
*/
// tslint:disable
var ComponentBaseHybrid = /** @__PURE__ @class */ (function (_super) {
__extends$1(ComponentBaseHybrid, _super);
function ComponentBaseHybrid() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.attrKeys = [];
_this.cachedTimeOut = 0;
_this.isAppendCalled = false;
_this.isReact = true;
return _this;
}
// Lifecycle methods are changed by React team and so we can deprecate this method and use
// Reference link:https://reactjs.org/docs/react-component.html#unsafe_componentWillMount
// tslint:disable-next-line:no-any
/**
* @private
*/
ComponentBaseHybrid.prototype.UNSAFE_componentWillMount = function () {
this.isReact = true;
};
/* tslint:disable:no-any */
ComponentBaseHybrid.prototype.generateReactElements = function (ele) {
var childrens = ele.children;
if (childrens && childrens.length) {
var childObject = [];
for (var i = 0, length_1 = childrens.length; i < length_1; i++) {
var child = childrens[i];
if (typeof (child) === 'string') {
childObject.push(child);
}
else {
if (!child.tagName) {
if (child.template) {
childObject.push(createElement(child.template, child.data || {}));
}
}
else {
childObject.push(this.generateReactElements(child));
}
}
}
return createElement(ele.tagName, ele.attributes, childObject);
}
else {
return createElement(ele.tagName, ele.attributes);
}
};
ComponentBaseHybrid.prototype.componentDidMount = function () {
if (this.mount) {
this.mount();
}
};
ComponentBaseHybrid.prototype.componentDidUpdate = function () {
this.currentContext(this.currentContext.calls, this.currentContext.args);
};
// Lifecycle methods are changed by React team and so we can deprecate this method and use
// Reference link:https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
// tslint:disable-next-line:no-any
/**
* @private
*/
ComponentBaseHybrid.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {
var _this = this;
if (!this.isAppendCalled) {
clearTimeout(this.cachedTimeOut);
this.isAppendCalled = true;
this.appendTo(findDOMNode(this));
}
var dProps = extend({}, nextProps);
var keys = Object.keys(nextProps);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var propkey = keys_1[_i];
var isClassName = propkey === 'className';
if (!isClassName && !isNullOrUndefined(this.htmlattributes[propkey]) &&
this.htmlattributes[propkey] !== dProps[propkey]) {
this.htmlattributes[propkey] = dProps[propkey];
}
if (this.props[propkey] === nextProps[propkey]) {
delete dProps[propkey];
}
else if (this.attrKeys.indexOf(propkey) !== -1) {
if (isClassName) {
this.element.classList.remove(this.props[propkey]);
this.element.classList.add(dProps[propkey]);
}
else if (propkey !== 'disabled') {
delete dProps[propkey];
}
}
}
if (dProps['children']) {
delete dProps['children'];
}
// tslint:disable-next-line:no-any
if (this.canDelayUpdate || this.props.delayUpdate) {
setTimeout(function () {
_this.refreshProperties(dProps, nextProps);
});
}
else {
this.refreshProperties(dProps, nextProps);
}
};
ComponentBaseHybrid.prototype.refreshProperties = function (dProps, nextProps) {
if (Object.keys(dProps).length) {
// tslint:disable-next-line:no-any
this.processComplexTemplate(dProps, this);
this.setProperties(dProps);
}
this.refreshChild(false, nextProps);
};
ComponentBaseHybrid.prototype.processComplexTemplate = function (curObject, context) {
var compTemplate = context.complexTemplate;
if (compTemplate) {
for (var prop in compTemplate) {
var PropVal = compTemplate[prop];
if (curObject[prop]) {
setValue(PropVal, getValue(prop, curObject), curObject);
}
}
}
};
/* tslint:disable:no-any */
ComponentBaseHybrid.prototype.trigger = function (eventName, eventProp, successHandler) {
if (this.isDestroyed !== true) {
if ((eventName === 'change' || eventName === 'input')) {
if (this.props.onChange && eventProp.event) {
this.props.onChange.call(undefined, {
syntheticEvent: eventProp.event,
nativeEvent: { text: eventProp.value },
value: eventProp.value,
target: this
});
}
}
var prevDetection = this.isProtectedOnChange;
this.isProtectedOnChange = false;
this.modelObserver.notify(eventName, eventProp, successHandler);
this.isProtectedOnChange = prevDetection;
}
};
ComponentBaseHybrid.prototype.compareObjects = function (oldProps, newProps) {
return JSON.stringify(oldProps) === JSON.stringify(newProps);
};
ComponentBaseHybrid.prototype.refreshChild = function (silent, props) {
if (this.checkInjectedModules) {
var prevModule = this.getInjectedModules() || [];
var curModule = this.getInjectedServices() || [];
for (var _i = 0, curModule_1 = curModule; _i < curModule_1.length; _i++) {
var mod = curModule_1[_i];
if (prevModule.indexOf(mod) === -1) {
prevModule.push(mod);
}
}
this.injectedModules = prevModule;
}
if (this.directivekeys) {
var directiveValue = this.validateChildren({}, this.directivekeys, (props || this.props));
if (directiveValue) {
if (!silent && this.skipRefresh) {
for (var _a = 0, _b = this.skipRefresh; _a < _b.length; _a++) {
var fields = _b[_a];
delete directiveValue[fields];
}
}
if (this.prevProperties) {
var dKeys = Object.keys(this.prevProperties);
for (var i = 0; i < dKeys.length; i++) {
var key = dKeys[i];
if (this.compareObjects(this.prevProperties[key], directiveValue[key])) {
delete directiveValue[key];
}
else {
var obj = {};
obj[key] = directiveValue[key];
this.prevProperties = extend(this.prevProperties, obj);
}
}
}
else {
this.prevProperties = extend({}, directiveValue, {}, true);
}
this.setProperties(directiveValue, silent);
}
}
};
ComponentBaseHybrid.prototype.componentWillUnmount = function () {
clearTimeout(this.cachedTimeOut);
this.destroy();
};
/* tslint:disable:no-any */
ComponentBaseHybrid.prototype.validateChildren = function (childCache, mapper, props) {
var flag = false;
var childs = Children.toArray(props.children);
for (var _i = 0, childs_1 = childs; _i < childs_1.length; _i++) {
var child = childs_1[_i];
var ifield = this.getChildType(child);
var key = mapper[ifield];
if (ifield && mapper) {
// tslint:disable
var childProps = this.getChildProps(Children.toArray(child.props.children), key);
if (childProps.length) {
flag = true;
// tslint:disable
childCache[child.type.propertyName || ifield] = childProps;
}
}
}
if (flag) {
return childCache;
}
return null;
};
// tslint:disable:no-any
ComponentBaseHybrid.prototype.getChildType = function (child) {
if (child.type && child.type.isDirective) {
return child.type.moduleName || '';
}
return '';
};
ComponentBaseHybrid.prototype.getChildProps = function (subChild, matcher) {
var ret = [];
for (var _i = 0, subChild_1 = subChild; _i < subChild_1.length; _i++) {
var child = subChild_1[_i];
var accessProp = false;
var key = void 0;
if (typeof matcher === 'string') {
accessProp = true;
key = matcher;
}
else {
key = Object.keys(matcher)[0];
}
var prop = child.props;
// tslint:disable-next-line:no-any
var field = this.getChildType(child);
if (field === key) {
if (accessProp || !prop.children) {
// tslint:disable
var cacheVal = extend({}, prop, {}, true);
// tslint:disable
this.processComplexTemplate(cacheVal, child.type);
ret.push(cacheVal);
}
else {
var cachedValue = this.validateChildren(extend({}, prop), matcher[key], prop) || prop;
if (cachedValue['children']) {
delete cachedValue['children'];
}
// tslint:disable
this.processComplexTemplate(cachedValue, child.type);
ret.push(cachedValue);
}
}
}
return ret;
};
// tslint:disable:no-any
ComponentBaseHybrid.prototype.getInjectedServices = function () {
var childs = Children.toArray(this.props.children);
for (var _i = 0, childs_2 = childs; _i < childs_2.length; _i++) {
var child = childs_2[_i];
/* tslint:disable:no-any */
if (child.type.isService) {
return child.props.services;
}
}
return [];
};
return ComponentBaseHybrid;
}(PureComponent));
/* tslint:enable:no-any */
// tslint:disable-next-line:no-any

@@ -321,3 +607,3 @@ function applyMixins(derivedClass, baseClass) {

var __extends$1 = (undefined && undefined.__extends) || (function () {
var __extends$2 = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {

@@ -339,3 +625,3 @@ extendStatics = Object.setPrototypeOf ||

var ComplexBase = /** @__PURE__ @class */ (function (_super) {
__extends$1(ComplexBase, _super);
__extends$2(ComplexBase, _super);
function ComplexBase() {

@@ -351,3 +637,3 @@ return _super !== null && _super.apply(this, arguments) || this;

var __extends$2 = (undefined && undefined.__extends) || (function () {
var __extends$3 = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {

@@ -369,3 +655,3 @@ extendStatics = Object.setPrototypeOf ||

var Inject = /** @__PURE__ @class */ (function (_super) {
__extends$2(Inject, _super);
__extends$3(Inject, _super);
function Inject() {

@@ -392,5 +678,3 @@ return _super !== null && _super.apply(this, arguments) || this;

else {
return function (data) {
var ele = document.createElement('div');
document.body.appendChild(ele);
return function (data, component) {
var actTemplate = templateElement;

@@ -402,5 +686,12 @@ var actData = data;

}
render(actTemplate(actData), ele);
detach(ele);
return ele.children;
if (component && component.isReactHybrid) {
return [{ template: actTemplate, data: data }];
}
else {
var ele = document.createElement('div');
document.body.appendChild(ele);
render(actTemplate(actData), ele);
detach(ele);
return ele.children;
}
};

@@ -415,3 +706,3 @@ }

export { ComponentBase, applyMixins, ComplexBase, Inject, compile };
export { ComponentBase, ComponentBaseHybrid, applyMixins, ComplexBase, Inject, compile };
//# sourceMappingURL=ej2-react-base.es5.js.map
/*!
* filename: ej2-react-base.min.js
* version : 17.4.51
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
* version : 18.1.36-beta
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
* Use of this code is subject to the terms of our license.

@@ -10,3 +10,3 @@ * A copy of the current license can be obtained at any time by e-mailing

*/
this.ej=this.ej||{},this.ej.reactbase=function(t,e,r,i){"use strict";function n(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(r){t.prototype[r]=e.prototype[r]})})}function o(t,e){return"string"==typeof t?f(t,e):function(e){var n=document.createElement("div");document.body.appendChild(n);var o=t,s=e;return"object"==typeof o&&(o=t.template,s=i.extend({},e,t.data||{})),r.render(o(s),n),i.detach(n),n.children}}var s=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),p=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],a=["accordion","tab","splitter"],c=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.attrKeys=[],e.cachedTimeOut=0,e.isAppendCalled=!1,e.isReact=!0,e}return s(n,t),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0;var t=Object.keys(this.props);this.htmlattributes={},this.attrKeys=p.concat(this.controlAttributes||[]);for(var e=0,r=t;e<r.length;e++){var i=r[e];-1===i.indexOf("data-")&&-1===i.indexOf("aria-")&&-1===this.attrKeys.indexOf(i)||(this.htmlattributes[i]=this.props[i])}},n.prototype.componentDidMount=function(){var t=this;this.refreshChild(!0),this.canDelayUpdate=-1!==a.indexOf(this.getModuleName()),this.props.immediateRender?this.renderReactComponent():this.cachedTimeOut=setTimeout(function(){t.renderReactComponent()})},n.prototype.renderReactComponent=function(){var t=r.findDOMNode(this);t&&(this.isAppendCalled=!0,this.appendTo(t))},n.prototype.UNSAFE_componentWillReceiveProps=function(t){var e=this;this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},t),o=0,s=Object.keys(t);o<s.length;o++){var p=s[o],a="className"===p;a||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===t[p]?delete n[p]:-1!==this.attrKeys.indexOf(p)&&(a?(this.props[p].split(" ").forEach(function(t){e.element.classList.remove(t)}),n[p].split(" ").forEach(function(t){e.element.classList.add(t)})):"disabled"!==p&&delete n[p])}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){e.refreshProperties(n,t)}):this.refreshProperties(n,t)},n.prototype.refreshProperties=function(t,e){Object.keys(t).length&&(this.processComplexTemplate(t,this),this.setProperties(t)),this.refreshChild(!1,e)},n.prototype.processComplexTemplate=function(t,e){var r=e.complexTemplate;if(r)for(var n in r){var o=r[n];t[n]&&i.setValue(o,i.getValue(n,t),t)}},n.prototype.getDefaultAttributes=function(){return this.htmlattributes},n.prototype.trigger=function(t,e,r){if(!0!==this.isDestroyed){"change"!==t&&"input"!==t||this.props.onChange&&e.event&&this.props.onChange.call(void 0,{syntheticEvent:e.event,nativeEvent:{text:e.value},value:e.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(t,e,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(t,e){return JSON.stringify(t)===JSON.stringify(e)},n.prototype.refreshChild=function(t,e){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,e||this.props);if(p){if(!t&&this.skipRefresh)for(var a=0,c=this.skipRefresh;a<c.length;a++)delete p[c[a]];if(this.prevProperties)for(var h=Object.keys(this.prevProperties),l=0;l<h.length;l++){var u=h[l];if(this.compareObjects(this.prevProperties[u],p[u]))delete p[u];else{var d={};d[u]=p[u],this.prevProperties=i.extend(this.prevProperties,d)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,t)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(t,r,i){for(var n=!1,o=0,s=e.Children.toArray(i.children);o<s.length;o++){var p=s[o],a=this.getChildType(p),c=r[a];if(a&&r){var h=this.getChildProps(e.Children.toArray(p.props.children),c);h.length&&(n=!0,t[p.type.propertyName||a]=h)}}return n?t:null},n.prototype.getChildType=function(t){return t.type&&t.type.isDirective?t.type.moduleName||"":""},n.prototype.getChildProps=function(t,e){for(var r=[],n=0,o=t;n<o.length;n++){var s=o[n],p=!1,a=void 0;"string"==typeof e?(p=!0,a=e):a=Object.keys(e)[0];var c=s.props;if(this.getChildType(s)===a)if(p||!c.children){var h=i.extend({},c,{},!0);this.processComplexTemplate(h,s.type),r.push(h)}else{var l=this.validateChildren(i.extend({},c),e[a],c)||c;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var t=0,r=e.Children.toArray(this.props.children);t<r.length;t++){var i=r[t];if(i.type.isService)return i.props.services}return[]},n}(e.PureComponent),h=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){return null},e.isDirective=!0,e}(e.PureComponent),u=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e.prototype.render=function(){return null},e.isService=!0,e}(e.PureComponent),f=i.getTemplateEngine();return i.setTemplateEngine({compile:o}),t.ComponentBase=c,t.applyMixins=n,t.ComplexBase=l,t.Inject=d,t.compile=o,t}({},React,ReactDOM,ej.base),this.ejs=ej;
this.ej=this.ej||{},this.ej.reactbase=function(e,t,r,i){"use strict";function n(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(r){e.prototype[r]=t.prototype[r]})})}function o(e,t){return"string"==typeof e?v(e,t):function(t,n){var o=e,s=t;if("object"==typeof o&&(o=e.template,s=i.extend({},t,e.data||{})),n&&n.isReactHybrid)return[{template:o,data:t}];var p=document.createElement("div");return document.body.appendChild(p),r.render(o(s),p),i.detach(p),p.children}}var s=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),p=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],a=["accordion","tab","splitter"],h=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t.initRenderCalled=!1,t.isReact=!0,t}return s(n,e),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0;var e=Object.keys(this.props);this.htmlattributes={},this.attrKeys=p.concat(this.controlAttributes||[]);for(var t=0,r=e;t<r.length;t++){var i=r[t];-1===i.indexOf("data-")&&-1===i.indexOf("aria-")&&-1===this.attrKeys.indexOf(i)||(this.htmlattributes[i]=this.props[i])}},n.prototype.componentDidMount=function(){var e=this;this.refreshChild(!0),this.canDelayUpdate=-1!==a.indexOf(this.getModuleName()),this.props.immediateRender?this.renderReactComponent():this.cachedTimeOut=setTimeout(function(){e.renderReactComponent()})},n.prototype.renderReactComponent=function(){var e=r.findDOMNode(this);e&&(this.isAppendCalled=!0,this.appendTo(e))},n.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;if(this.initRenderCalled){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},e),o=0,s=Object.keys(e);o<s.length;o++){var p=s[o],a="className"===p;a||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===e[p]?delete n[p]:-1!==this.attrKeys.indexOf(p)&&(a?(this.element.classList.remove(this.props[p]),this.element.classList.add(n[p])):"disabled"!==p&&delete n[p])}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){t.refreshProperties(n,e)}):this.refreshProperties(n,e)}},n.prototype.refreshProperties=function(e,t){Object.keys(e).length&&(this.processComplexTemplate(e,this),this.setProperties(e)),this.refreshChild(!1,t)},n.prototype.processComplexTemplate=function(e,t){var r=t.complexTemplate;if(r)for(var n in r){var o=r[n];e[n]&&i.setValue(o,i.getValue(n,e),e)}},n.prototype.getDefaultAttributes=function(){return this.htmlattributes},n.prototype.trigger=function(e,t,r){if(!0!==this.isDestroyed){"change"!==e&&"input"!==e||this.props.onChange&&t.event&&this.props.onChange.call(void 0,{syntheticEvent:t.event,nativeEvent:{text:t.value},value:t.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(e,t,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,t||this.props);if(p){if(!e&&this.skipRefresh)for(var a=0,h=this.skipRefresh;a<h.length;a++)delete p[h[a]];if(this.prevProperties)for(var c=Object.keys(this.prevProperties),l=0;l<c.length;l++){var u=c[l];if(this.compareObjects(this.prevProperties[u],p[u]))delete p[u];else{var d={};d[u]=p[u],this.prevProperties=i.extend(this.prevProperties,d)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,e)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(e,r,i){for(var n=!1,o=0,s=t.Children.toArray(i.children);o<s.length;o++){var p=s[o],a=this.getChildType(p),h=r[a];if(a&&r){var c=this.getChildProps(t.Children.toArray(p.props.children),h);c.length&&(n=!0,e[p.type.propertyName||a]=c)}}return n?e:null},n.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},n.prototype.getChildProps=function(e,t){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n],p=!1,a=void 0;"string"==typeof t?(p=!0,a=t):a=Object.keys(t)[0];var h=s.props;if(this.getChildType(s)===a)if(p||!h.children){var c=i.extend({},h,{},!0);this.processComplexTemplate(c,s.type),r.push(c)}else{var l=this.validateChildren(i.extend({},h),t[a],h)||h;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var i=r[e];if(i.type.isService)return i.props.services}return[]},n}(t.PureComponent),c=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),l=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t.isReact=!0,t}return c(n,e),n.prototype.UNSAFE_componentWillMount=function(){this.isReact=!0},n.prototype.generateReactElements=function(e){var r=e.children;if(r&&r.length){for(var i=[],n=0,o=r.length;n<o;n++){var s=r[n];"string"==typeof s?i.push(s):s.tagName?i.push(this.generateReactElements(s)):s.template&&i.push(t.createElement(s.template,s.data||{}))}return t.createElement(e.tagName,e.attributes,i)}return t.createElement(e.tagName,e.attributes)},n.prototype.componentDidMount=function(){this.mount&&this.mount()},n.prototype.componentDidUpdate=function(){this.currentContext(this.currentContext.calls,this.currentContext.args)},n.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var n=i.extend({},e),o=0,s=Object.keys(e);o<s.length;o++){var p=s[o],a="className"===p;a||i.isNullOrUndefined(this.htmlattributes[p])||this.htmlattributes[p]===n[p]||(this.htmlattributes[p]=n[p]),this.props[p]===e[p]?delete n[p]:-1!==this.attrKeys.indexOf(p)&&(a?(this.element.classList.remove(this.props[p]),this.element.classList.add(n[p])):"disabled"!==p&&delete n[p])}n.children&&delete n.children,this.canDelayUpdate||this.props.delayUpdate?setTimeout(function(){t.refreshProperties(n,e)}):this.refreshProperties(n,e)},n.prototype.refreshProperties=function(e,t){Object.keys(e).length&&(this.processComplexTemplate(e,this),this.setProperties(e)),this.refreshChild(!1,t)},n.prototype.processComplexTemplate=function(e,t){var r=t.complexTemplate;if(r)for(var n in r){var o=r[n];e[n]&&i.setValue(o,i.getValue(n,e),e)}},n.prototype.trigger=function(e,t,r){if(!0!==this.isDestroyed){"change"!==e&&"input"!==e||this.props.onChange&&t.event&&this.props.onChange.call(void 0,{syntheticEvent:t.event,nativeEvent:{text:t.value},value:t.value,target:this});var i=this.isProtectedOnChange;this.isProtectedOnChange=!1,this.modelObserver.notify(e,t,r),this.isProtectedOnChange=i}},n.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&r.push(s)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,t||this.props);if(p){if(!e&&this.skipRefresh)for(var a=0,h=this.skipRefresh;a<h.length;a++)delete p[h[a]];if(this.prevProperties)for(var c=Object.keys(this.prevProperties),l=0;l<c.length;l++){var u=c[l];if(this.compareObjects(this.prevProperties[u],p[u]))delete p[u];else{var d={};d[u]=p[u],this.prevProperties=i.extend(this.prevProperties,d)}}else this.prevProperties=i.extend({},p,{},!0);this.setProperties(p,e)}}},n.prototype.componentWillUnmount=function(){clearTimeout(this.cachedTimeOut),this.destroy()},n.prototype.validateChildren=function(e,r,i){for(var n=!1,o=0,s=t.Children.toArray(i.children);o<s.length;o++){var p=s[o],a=this.getChildType(p),h=r[a];if(a&&r){var c=this.getChildProps(t.Children.toArray(p.props.children),h);c.length&&(n=!0,e[p.type.propertyName||a]=c)}}return n?e:null},n.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},n.prototype.getChildProps=function(e,t){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n],p=!1,a=void 0;"string"==typeof t?(p=!0,a=t):a=Object.keys(t)[0];var h=s.props;if(this.getChildType(s)===a)if(p||!h.children){var c=i.extend({},h,{},!0);this.processComplexTemplate(c,s.type),r.push(c)}else{var l=this.validateChildren(i.extend({},h),t[a],h)||h;l.children&&delete l.children,this.processComplexTemplate(l,s.type),r.push(l)}}return r},n.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var i=r[e];if(i.type.isService)return i.props.services}return[]},n}(t.PureComponent),u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){return null},t.isDirective=!0,t}(t.PureComponent),f=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.render=function(){return null},t.isService=!0,t}(t.PureComponent),v=i.getTemplateEngine();return i.setTemplateEngine({compile:o}),e.ComponentBase=h,e.ComponentBaseHybrid=l,e.applyMixins=n,e.ComplexBase=d,e.Inject=y,e.compile=o,e}({},React,ReactDOM,ej.base),this.ejs=ej;
//# sourceMappingURL=ej2-react-base.min.js.map
/*!
* filename: index.d.ts
* version : 17.4.51
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
* version : 18.1.36-beta
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
* Use of this code is subject to the terms of our license.

@@ -6,0 +6,0 @@ * A copy of the current license can be obtained at any time by e-mailing

{
"_from": "@syncfusion/ej2-react-base@*",
"_id": "@syncfusion/ej2-react-base@17.4.47",
"_id": "@syncfusion/ej2-react-base@17.2.48",
"_inBundle": false,
"_integrity": "sha512-bVnmhTHqMMdxK8l099Sw2bFm2BQ5YJyya5Cbpa5LfTuDrpHjpyqjsuL1fP/KVIRdO5Pl7T1Q8cGjRPCKoSt0cg==",
"_integrity": "sha512-3jY79iBmHWqqaLCBdM3O8hzgemHEkFqhvWIvfmPkFpS9v4lw1ViPJV7omkMvzbkKy6vvTvHYawCReii44rLlAQ==",
"_location": "/@syncfusion/ej2-react-base",

@@ -52,6 +52,6 @@ "_phantomChildren": {},

],
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-react-base/-/ej2-react-base-17.4.47.tgz",
"_shasum": "6079f073d9f53cdb96b7e9a7ade7eb75942c24ee",
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-react-base/-/ej2-react-base-17.2.48.tgz",
"_shasum": "24e7ba4f553bf20819970594e3b649079de9cb34",
"_spec": "@syncfusion/ej2-react-base@*",
"_where": "/jenkins/workspace/ation_hotfix_17.2.0.34_Vol2-DDPJ6C2YEWTWLLKKNA7AG2JBE6DYTCTNGMHGORWGAYAVCL6L7OLQ/packages/included",
"_where": "/jenkins/workspace/automation_release_18.1.0.1-52JLNOGRCDHXRVQM3W564VPLFCPHWUYDYU3I3DVRABSR7F6AIFYQ/packages/included",
"author": {

@@ -65,3 +65,3 @@ "name": "Syncfusion Inc."

"dependencies": {
"@syncfusion/ej2-base": "~17.4.51"
"@syncfusion/ej2-base": "~18.1.36-beta"
},

@@ -75,3 +75,3 @@ "deprecated": false,

"syncfusion",
"web-component",
"web-components",
"react",

@@ -89,4 +89,4 @@ "react-base",

"peerDependencies": {
"react": "15.5.4 - 16.12.0",
"react-dom": "15.5.4 - 16.12.0"
"react": "15.5.4 - 16.10.2",
"react-dom": "15.5.4 - 16.10.2"
},

@@ -98,4 +98,4 @@ "repository": {

"typings": "index.d.ts",
"version": "17.4.51",
"version": "18.1.36-beta",
"sideEffects": true
}

@@ -27,2 +27,3 @@ /**

private isAppendCalled;
private initRenderCalled;
private isReact;

@@ -29,0 +30,0 @@ private modelObserver;

@@ -32,2 +32,3 @@ var __extends = (this && this.__extends) || (function () {

_this.isAppendCalled = false;
_this.initRenderCalled = false;
_this.isReact = true;

@@ -85,2 +86,5 @@ return _this;

var _this = this;
if (!this.initRenderCalled) {
return;
}
if (!this.isAppendCalled) {

@@ -105,12 +109,4 @@ clearTimeout(this.cachedTimeOut);

if (isClassName) {
var delCheck = this.props[propkey];
var delSplit = delCheck.split(" ");
delSplit.forEach(function (delValue) {
_this.element.classList.remove(delValue);
});
var addCheck = dProps[propkey];
var addSplit = addCheck.split(" ");
addSplit.forEach(function (addValue) {
_this.element.classList.add(addValue);
});
this.element.classList.remove(this.props[propkey]);
this.element.classList.add(dProps[propkey]);
}

@@ -117,0 +113,0 @@ else if (propkey !== 'disabled') {

@@ -5,2 +5,3 @@ /**

export * from './component-base';
export * from './component-base-hybrid';
export * from './util';

@@ -7,0 +8,0 @@ export * from './complex-base';

@@ -5,2 +5,3 @@ /**

export * from './component-base';
export * from './component-base-hybrid';
export * from './util';

@@ -7,0 +8,0 @@ export * from './complex-base';

@@ -13,5 +13,3 @@ /**

else {
return function (data) {
var ele = document.createElement('div');
document.body.appendChild(ele);
return function (data, component) {
var actTemplate = templateElement;

@@ -23,5 +21,12 @@ var actData = data;

}
ReactDOM.render(actTemplate(actData), ele);
detach(ele);
return ele.children;
if (component && component.isReactHybrid) {
return [{ template: actTemplate, data: data }];
}
else {
var ele = document.createElement('div');
document.body.appendChild(ele);
ReactDOM.render(actTemplate(actData), ele);
detach(ele);
return ele.children;
}
};

@@ -28,0 +33,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc