@syncfusion/ej2-react-base
Advanced tools
Comparing version 16.4.47 to 16.4.52
@@ -5,2 +5,8 @@ # Changelog | ||
### Common | ||
#### Bug Fixes | ||
- Resolved the typing issue for `onclick` event. | ||
## 16.4.45 (2019-01-02) | ||
@@ -7,0 +13,0 @@ |
/*! | ||
* filename: ej2-react-base.umd.min.js | ||
* version : 16.4.47 | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@syncfusion/ej2-base"],e):e(t.ej={},t.React,t.ReactDOM,t.ej2Base)}(this,function(t,e,r,n){"use strict";function o(t,e){return"string"==typeof t?h(t,e):function(e){var o=document.createElement("div");document.body.appendChild(o);var i=t,s=e;return"object"==typeof i&&(i=t.template,s=n.extend({},e,t.data||{})),r.render(i(s),o),n.detach(o),o.children}}var i=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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),s=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],p=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.attrKeys=[],e.cachedTimeOut=0,e.isAppendCalled=!1,e}return i(o,t),o.prototype.componentWillMount=function(){var t=Object.keys(this.props);this.htmlattributes={},this.attrKeys=s.concat(this.controlAttributes||[]);for(var e=0,r=t;e<r.length;e++){var n=r[e];-1===n.indexOf("data-")&&-1===n.indexOf("aria-")&&-1===this.attrKeys.indexOf(n)||(this.htmlattributes[n]=this.props[n])}},o.prototype.componentDidMount=function(){var t=this;this.refreshChild(!0),this.cachedTimeOut=setTimeout(function(){var e=r.findDOMNode(t);e&&(t.isAppendCalled=!0,t.appendTo(e))})},o.prototype.componentWillReceiveProps=function(t){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var e=n.extend({},t),o=0,i=Object.keys(t);o<i.length;o++){var s=i[o];this.props[s]===t[s]?delete e[s]:-1!==this.attrKeys.indexOf(s)&&("className"===s?(this.element.classList.remove(this.props[s]),this.element.classList.add(e[s])):"disabled"!==s&&delete e[s])}e.children&&delete e.children,Object.keys(e).length&&this.setProperties(e),this.refreshChild(!1,t)},o.prototype.getDefaultAttributes=function(){return this.htmlattributes},o.prototype.refreshChild=function(t,e){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var i=o[n];-1===r.indexOf(i)&&r.push(i)}this.injectedModules=r}if(this.directivekeys){var s=this.validateChildren({},this.directivekeys,e||this.props);if(s){if(!t&&this.skipRefresh)for(var p=0,c=this.skipRefresh;p<c.length;p++){delete s[c[p]]}this.setProperties(s,t)}}},o.prototype.componentWillUnmount=function(){this.destroy()},o.prototype.validateChildren=function(t,r,n){for(var o=!1,i=0,s=e.Children.toArray(n.children);i<s.length;i++){var p=s[i],c=this.getChildType(p),u=r[c];if(c&&r){var a=this.getChildProps(e.Children.toArray(p.props.children),u);a.length&&(o=!0,t[p.type.propertyName||c]=a)}}return o?t:null},o.prototype.getChildType=function(t){return t.type&&t.type.isDirective?t.type.moduleName||"":""},o.prototype.getChildProps=function(t,e){for(var r=[],o=0,i=t;o<i.length;o++){var s=i[o],p=!1,c=void 0;"string"==typeof e?(p=!0,c=e):c=Object.keys(e)[0];var u=s.props;this.getChildType(s)===c&&(p||!u.children?r.push(n.extend({},u,{},!0)):r.push(this.validateChildren(n.extend({},u),e[c],u)||u))}return r},o.prototype.getInjectedServices=function(){for(var t=0,r=e.Children.toArray(this.props.children);t<r.length;t++){var n=r[t];if(n.type.isService)return n.props.services}return[]},o}(e.PureComponent),c=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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.render=function(){return null},e.isDirective=!0,e}(e.PureComponent),a=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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.render=function(){return null},e.isService=!0,e}(e.PureComponent),h=n.getTemplateEngine();n.setTemplateEngine({compile:o}),t.ComponentBase=p,t.applyMixins=function(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(r){t.prototype[r]=e.prototype[r]})})},t.ComplexBase=u,t.Inject=l,t.compile=o,Object.defineProperty(t,"__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,n){"use strict";function i(e,t){return"string"==typeof e?h(e,t):function(t){var i=document.createElement("div");document.body.appendChild(i);var o=e,s=t;return"object"==typeof o&&(o=e.template,s=n.extend({},t,e.data||{})),r.render(o(s),i),n.detach(i),i.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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),s=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],p=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.attrKeys=[],t.cachedTimeOut=0,t.isAppendCalled=!1,t}return o(i,e),i.prototype.componentWillMount=function(){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 n=r[t];-1===n.indexOf("data-")&&-1===n.indexOf("aria-")&&-1===this.attrKeys.indexOf(n)||(this.htmlattributes[n]=this.props[n])}},i.prototype.componentDidMount=function(){var e=this;this.refreshChild(!0),this.cachedTimeOut=setTimeout(function(){var t=r.findDOMNode(e);t&&(e.isAppendCalled=!0,e.appendTo(t))})},i.prototype.componentWillReceiveProps=function(e){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var t=n.extend({},e),i=0,o=Object.keys(e);i<o.length;i++){var s=o[i],p="className"===s;p||n.isNullOrUndefined(this.htmlattributes[s])||this.htmlattributes[s]===t[s]||(this.htmlattributes[s]=t[s]),this.props[s]===e[s]?delete t[s]:-1!==this.attrKeys.indexOf(s)&&(p?(this.element.classList.remove(this.props[s]),this.element.classList.add(t[s])):"disabled"!==s&&delete t[s])}t.children&&delete t.children,Object.keys(t).length&&this.setProperties(t),this.refreshChild(!1,e)},i.prototype.getDefaultAttributes=function(){return this.htmlattributes},i.prototype.compareObjects=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},i.prototype.refreshChild=function(e,t){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],i=0,o=this.getInjectedServices()||[];i<o.length;i++){var s=o[i];-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 u=Object.keys(this.prevProperties),l=0;l<u.length;l++){var h=u[l];this.compareObjects(this.prevProperties[h],p[h])?delete p[h]:this.prevProperties=n.extend(this.prevProperties,p)}else this.prevProperties=n.extend({},p,{},!0);this.setProperties(p,e)}}},i.prototype.componentWillUnmount=function(){this.destroy()},i.prototype.validateChildren=function(e,r,n){for(var i=!1,o=0,s=t.Children.toArray(n.children);o<s.length;o++){var p=s[o],c=this.getChildType(p),a=r[c];if(c&&r){var u=this.getChildProps(t.Children.toArray(p.props.children),a);u.length&&(i=!0,e[p.type.propertyName||c]=u)}}return i?e:null},i.prototype.getChildType=function(e){return e.type&&e.type.isDirective?e.type.moduleName||"":""},i.prototype.getChildProps=function(e,t){for(var r=[],i=0,o=e;i<o.length;i++){var s=o[i],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)r.push(n.extend({},a,{},!0));else{var u=this.validateChildren(n.extend({},a),t[c],a)||a;u.children&&delete u.children,r.push(u)}}return r},i.prototype.getInjectedServices=function(){for(var e=0,r=t.Children.toArray(this.props.children);e<r.length;e++){var n=r[e];if(n.type.isService)return n.props.services}return[]},i}(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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),l=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),h=n.getTemplateEngine();n.setTemplateEngine({compile:i}),e.ComponentBase=p,e.applyMixins=function(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(r){e.prototype[r]=t.prototype[r]})})},e.ComplexBase=a,e.Inject=l,e.compile=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-react-base.umd.min.js.map |
import { Children, PureComponent } from 'react'; | ||
import { findDOMNode, render } from 'react-dom'; | ||
import { detach, extend, getTemplateEngine, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
import { detach, extend, getTemplateEngine, isNullOrUndefined, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
@@ -51,2 +51,7 @@ /** | ||
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]) { | ||
@@ -56,3 +61,3 @@ delete dProps[propkey]; | ||
else if (this.attrKeys.indexOf(propkey) !== -1) { | ||
if (propkey === 'className') { | ||
if (isClassName) { | ||
this.element.classList.remove(this.props[propkey]); | ||
@@ -77,2 +82,5 @@ this.element.classList.add(dProps[propkey]); | ||
} | ||
compareObjects(oldProps, newProps) { | ||
return JSON.stringify(oldProps) === JSON.stringify(newProps); | ||
} | ||
refreshChild(silent, props) { | ||
@@ -97,2 +105,17 @@ if (this.checkInjectedModules) { | ||
} | ||
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 { | ||
this.prevProperties = extend(this.prevProperties, directiveValue); | ||
} | ||
} | ||
} | ||
else { | ||
this.prevProperties = extend({}, directiveValue, {}, true); | ||
} | ||
this.setProperties(directiveValue, silent); | ||
@@ -154,3 +177,7 @@ } | ||
else { | ||
ret.push(this.validateChildren(extend({}, prop), matcher[key], prop) || prop); | ||
let cachedValue = this.validateChildren(extend({}, prop), matcher[key], prop) || prop; | ||
if (cachedValue['children']) { | ||
delete cachedValue['children']; | ||
} | ||
ret.push(cachedValue); | ||
} | ||
@@ -157,0 +184,0 @@ } |
import { Children, PureComponent } from 'react'; | ||
import { findDOMNode, render } from 'react-dom'; | ||
import { detach, extend, getTemplateEngine, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
import { detach, extend, getTemplateEngine, isNullOrUndefined, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
@@ -69,2 +69,7 @@ var __extends = (undefined && undefined.__extends) || (function () { | ||
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]) { | ||
@@ -74,3 +79,3 @@ delete dProps[propkey]; | ||
else if (this.attrKeys.indexOf(propkey) !== -1) { | ||
if (propkey === 'className') { | ||
if (isClassName) { | ||
this.element.classList.remove(this.props[propkey]); | ||
@@ -95,2 +100,5 @@ this.element.classList.add(dProps[propkey]); | ||
}; | ||
ComponentBase.prototype.compareObjects = function (oldProps, newProps) { | ||
return JSON.stringify(oldProps) === JSON.stringify(newProps); | ||
}; | ||
ComponentBase.prototype.refreshChild = function (silent, props) { | ||
@@ -117,2 +125,17 @@ if (this.checkInjectedModules) { | ||
} | ||
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 { | ||
this.prevProperties = extend(this.prevProperties, directiveValue); | ||
} | ||
} | ||
} | ||
else { | ||
this.prevProperties = extend({}, directiveValue, {}, true); | ||
} | ||
this.setProperties(directiveValue, silent); | ||
@@ -176,3 +199,7 @@ } | ||
else { | ||
ret.push(this.validateChildren(extend({}, prop), matcher[key], prop) || prop); | ||
var cachedValue = this.validateChildren(extend({}, prop), matcher[key], prop) || prop; | ||
if (cachedValue['children']) { | ||
delete cachedValue['children']; | ||
} | ||
ret.push(cachedValue); | ||
} | ||
@@ -179,0 +206,0 @@ } |
/*! | ||
* filename: ej2-react-base.min.js | ||
* version : 16.4.47 | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license. | ||
*/ | ||
this.ej=this.ej||{},this.ej.reactbase=function(t,e,r,n){"use strict";function o(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(r){t.prototype[r]=e.prototype[r]})})}function i(t,e){return"string"==typeof t?d(t,e):function(e){var o=document.createElement("div");document.body.appendChild(o);var i=t,s=e;return"object"==typeof i&&(i=t.template,s=n.extend({},e,t.data||{})),r.render(i(s),o),n.detach(o),o.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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],c=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.attrKeys=[],e.cachedTimeOut=0,e.isAppendCalled=!1,e}return s(o,t),o.prototype.componentWillMount=function(){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 n=r[e];-1===n.indexOf("data-")&&-1===n.indexOf("aria-")&&-1===this.attrKeys.indexOf(n)||(this.htmlattributes[n]=this.props[n])}},o.prototype.componentDidMount=function(){var t=this;this.refreshChild(!0),this.cachedTimeOut=setTimeout(function(){var e=r.findDOMNode(t);e&&(t.isAppendCalled=!0,t.appendTo(e))})},o.prototype.componentWillReceiveProps=function(t){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var e=n.extend({},t),o=0,i=Object.keys(t);o<i.length;o++){var s=i[o];this.props[s]===t[s]?delete e[s]:-1!==this.attrKeys.indexOf(s)&&("className"===s?(this.element.classList.remove(this.props[s]),this.element.classList.add(e[s])):"disabled"!==s&&delete e[s])}e.children&&delete e.children,Object.keys(e).length&&this.setProperties(e),this.refreshChild(!1,t)},o.prototype.getDefaultAttributes=function(){return this.htmlattributes},o.prototype.refreshChild=function(t,e){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],n=0,o=this.getInjectedServices()||[];n<o.length;n++){var i=o[n];-1===r.indexOf(i)&&r.push(i)}this.injectedModules=r}if(this.directivekeys){var s=this.validateChildren({},this.directivekeys,e||this.props);if(s){if(!t&&this.skipRefresh)for(var p=0,c=this.skipRefresh;p<c.length;p++)delete s[c[p]];this.setProperties(s,t)}}},o.prototype.componentWillUnmount=function(){this.destroy()},o.prototype.validateChildren=function(t,r,n){for(var o=!1,i=0,s=e.Children.toArray(n.children);i<s.length;i++){var p=s[i],c=this.getChildType(p),a=r[c];if(c&&r){var u=this.getChildProps(e.Children.toArray(p.props.children),a);u.length&&(o=!0,t[p.type.propertyName||c]=u)}}return o?t:null},o.prototype.getChildType=function(t){return t.type&&t.type.isDirective?t.type.moduleName||"":""},o.prototype.getChildProps=function(t,e){for(var r=[],o=0,i=t;o<i.length;o++){var s=i[o],p=!1,c=void 0;"string"==typeof e?(p=!0,c=e):c=Object.keys(e)[0];var a=s.props;this.getChildType(s)===c&&(p||!a.children?r.push(n.extend({},a,{},!0)):r.push(this.validateChildren(n.extend({},a),e[c],a)||a))}return r},o.prototype.getInjectedServices=function(){for(var t=0,r=e.Children.toArray(this.props.children);t<r.length;t++){var n=r[t];if(n.type.isService)return n.props.services}return[]},o}(e.PureComponent),a=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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.render=function(){return null},e.isDirective=!0,e}(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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){return null},e.isService=!0,e}(e.PureComponent),d=n.getTemplateEngine();return n.setTemplateEngine({compile:i}),t.ComponentBase=c,t.applyMixins=o,t.ComplexBase=u,t.Inject=l,t.compile=i,t}({},React,ReactDOM,ej.base),this.ejs=ej; | ||
this.ej=this.ej||{},this.ej.reactbase=function(t,e,r,n){"use strict";function i(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?d(t,e):function(e){var i=document.createElement("div");document.body.appendChild(i);var o=t,s=e;return"object"==typeof o&&(o=t.template,s=n.extend({},e,t.data||{})),r.render(o(s),i),n.detach(i),i.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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","name","onClick","onFocus","onBlur"],c=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.attrKeys=[],e.cachedTimeOut=0,e.isAppendCalled=!1,e}return s(i,t),i.prototype.componentWillMount=function(){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 n=r[e];-1===n.indexOf("data-")&&-1===n.indexOf("aria-")&&-1===this.attrKeys.indexOf(n)||(this.htmlattributes[n]=this.props[n])}},i.prototype.componentDidMount=function(){var t=this;this.refreshChild(!0),this.cachedTimeOut=setTimeout(function(){var e=r.findDOMNode(t);e&&(t.isAppendCalled=!0,t.appendTo(e))})},i.prototype.componentWillReceiveProps=function(t){this.isAppendCalled||(clearTimeout(this.cachedTimeOut),this.isAppendCalled=!0,this.appendTo(r.findDOMNode(this)));for(var e=n.extend({},t),i=0,o=Object.keys(t);i<o.length;i++){var s=o[i],p="className"===s;p||n.isNullOrUndefined(this.htmlattributes[s])||this.htmlattributes[s]===e[s]||(this.htmlattributes[s]=e[s]),this.props[s]===t[s]?delete e[s]:-1!==this.attrKeys.indexOf(s)&&(p?(this.element.classList.remove(this.props[s]),this.element.classList.add(e[s])):"disabled"!==s&&delete e[s])}e.children&&delete e.children,Object.keys(e).length&&this.setProperties(e),this.refreshChild(!1,t)},i.prototype.getDefaultAttributes=function(){return this.htmlattributes},i.prototype.compareObjects=function(t,e){return JSON.stringify(t)===JSON.stringify(e)},i.prototype.refreshChild=function(t,e){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],i=0,o=this.getInjectedServices()||[];i<o.length;i++){var s=o[i];-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 c=0,h=this.skipRefresh;c<h.length;c++)delete p[h[c]];if(this.prevProperties)for(var a=Object.keys(this.prevProperties),l=0;l<a.length;l++){var u=a[l];this.compareObjects(this.prevProperties[u],p[u])?delete p[u]:this.prevProperties=n.extend(this.prevProperties,p)}else this.prevProperties=n.extend({},p,{},!0);this.setProperties(p,t)}}},i.prototype.componentWillUnmount=function(){this.destroy()},i.prototype.validateChildren=function(t,r,n){for(var i=!1,o=0,s=e.Children.toArray(n.children);o<s.length;o++){var p=s[o],c=this.getChildType(p),h=r[c];if(c&&r){var a=this.getChildProps(e.Children.toArray(p.props.children),h);a.length&&(i=!0,t[p.type.propertyName||c]=a)}}return i?t:null},i.prototype.getChildType=function(t){return t.type&&t.type.isDirective?t.type.moduleName||"":""},i.prototype.getChildProps=function(t,e){for(var r=[],i=0,o=t;i<o.length;i++){var s=o[i],p=!1,c=void 0;"string"==typeof e?(p=!0,c=e):c=Object.keys(e)[0];var h=s.props;if(this.getChildType(s)===c)if(p||!h.children)r.push(n.extend({},h,{},!0));else{var a=this.validateChildren(n.extend({},h),e[c],h)||h;a.children&&delete a.children,r.push(a)}}return r},i.prototype.getInjectedServices=function(){for(var t=0,r=e.Children.toArray(this.props.children);t<r.length;t++){var n=r[t];if(n.type.isService)return n.props.services}return[]},i}(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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),a=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),l=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 n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.render=function(){return null},e.isService=!0,e}(e.PureComponent),d=n.getTemplateEngine();return n.setTemplateEngine({compile:o}),t.ComponentBase=c,t.applyMixins=i,t.ComplexBase=a,t.Inject=u,t.compile=o,t}({},React,ReactDOM,ej.base),this.ejs=ej; | ||
//# sourceMappingURL=ej2-react-base.min.js.map |
/*! | ||
* filename: index.d.ts | ||
* version : 16.4.47 | ||
* version : 16.4.52 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-react-base", | ||
"version": "16.4.47", | ||
"version": "16.4.52", | ||
"description": "A common package of Essential JS 2 React base, methods and class definitions", | ||
@@ -31,3 +31,3 @@ "author": "Syncfusion Inc.", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~16.4.47" | ||
"@syncfusion/ej2-base": "~16.4.52" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -10,2 +10,3 @@ /** | ||
private destroy; | ||
private prevProperties; | ||
private checkInjectedModules; | ||
@@ -29,2 +30,3 @@ private getInjectedModules; | ||
getDefaultAttributes(): Object; | ||
compareObjects(oldProps: Object, newProps: Object): boolean; | ||
private refreshChild; | ||
@@ -31,0 +33,0 @@ componentWillUnmount(): void; |
@@ -19,3 +19,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import * as ReactDOM from 'react-dom'; | ||
import { extend } from '@syncfusion/ej2-base'; | ||
import { extend, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
var defaulthtmlkeys = ['alt', 'className', 'disabled', 'form', 'id', | ||
@@ -69,2 +69,7 @@ 'readOnly', 'style', 'tabIndex', 'title', 'type', 'name', | ||
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]) { | ||
@@ -74,3 +79,3 @@ delete dProps[propkey]; | ||
else if (this.attrKeys.indexOf(propkey) !== -1) { | ||
if (propkey === 'className') { | ||
if (isClassName) { | ||
this.element.classList.remove(this.props[propkey]); | ||
@@ -95,2 +100,5 @@ this.element.classList.add(dProps[propkey]); | ||
}; | ||
ComponentBase.prototype.compareObjects = function (oldProps, newProps) { | ||
return JSON.stringify(oldProps) === JSON.stringify(newProps); | ||
}; | ||
ComponentBase.prototype.refreshChild = function (silent, props) { | ||
@@ -117,2 +125,17 @@ if (this.checkInjectedModules) { | ||
} | ||
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 { | ||
this.prevProperties = extend(this.prevProperties, directiveValue); | ||
} | ||
} | ||
} | ||
else { | ||
this.prevProperties = extend({}, directiveValue, {}, true); | ||
} | ||
this.setProperties(directiveValue, silent); | ||
@@ -176,3 +199,7 @@ } | ||
else { | ||
ret.push(this.validateChildren(extend({}, prop), matcher[key], prop) || prop); | ||
var cachedValue = this.validateChildren(extend({}, prop), matcher[key], prop) || prop; | ||
if (cachedValue['children']) { | ||
delete cachedValue['children']; | ||
} | ||
ret.push(cachedValue); | ||
} | ||
@@ -179,0 +206,0 @@ } |
@@ -6,2 +6,4 @@ /** | ||
export declare function applyMixins(derivedClass: any, baseClass: any[]): void; | ||
declare type MouseEventHandler<T = Element> = React.EventHandler<React.MouseEvent<T>>; | ||
declare type FocusEventHandler<T = Element> = React.EventHandler<React.FocusEvent<T>>; | ||
export interface DefaultHtmlAttributes { | ||
@@ -13,2 +15,3 @@ alt?: string; | ||
id?: string; | ||
name?: string; | ||
readOnly?: boolean; | ||
@@ -19,5 +22,6 @@ style?: React.CSSProperties; | ||
type?: string; | ||
onClick?: MouseEventInit; | ||
onFocus?: FocusEventInit; | ||
onBlur?: FocusEventInit; | ||
onClick?: MouseEventHandler; | ||
onFocus?: FocusEventHandler; | ||
onBlur?: FocusEventHandler; | ||
} | ||
export {}; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136613
1060