@syncfusion/ej2-react-base
Advanced tools
Comparing version 16.1.28 to 16.1.32
@@ -5,2 +5,8 @@ # Changelog | ||
### Common | ||
### New Features | ||
- Provided template support for Essential JS 2 React components. | ||
## 15.4.23-preview (2017-12-27) | ||
@@ -7,0 +13,0 @@ |
/*! | ||
* filename: ej2-react-base.umd.min.js | ||
* version : 16.1.28 | ||
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. | ||
* version : 16.1.32 | ||
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved. | ||
* Use of this code is subject to the terms of our license. | ||
@@ -11,3 +11,3 @@ * A copy of the current license can be obtained at any time by e-mailing | ||
!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,o){"use strict";var n=function(){var 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])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),i=["alt","className","disabled","form","id","readOnly","style","tabIndex","title","type","onClick","onFocus","onBlur"],p=function(t){function p(){return null!==t&&t.apply(this,arguments)||this}return n(p,t),p.prototype.componentWillMount=function(){var t=Object.keys(this.props);this.htmlattributes={};for(var e=i.concat(this.controlAttributes||[]),r=0,o=t;r<o.length;r++){var n=o[r];-1===n.indexOf("data-")&&-1===n.indexOf("aria-")&&-1===e.indexOf(n)||(this.htmlattributes[n]=this.props[n])}},p.prototype.componentDidMount=function(){this.refreshChild(!0);var t=r.findDOMNode(this);this.appendTo(t)},p.prototype.componentWillReceiveProps=function(t){this.setState(t),this.setProperties(t),this.refreshChild(!1,t)},p.prototype.getDefaultAttributes=function(){return this.htmlattributes},p.prototype.refreshChild=function(t,e){if(this.checkInjectedModules){for(var r=this.getInjectedModules()||[],o=0,n=this.getInjectedServices()||[];o<n.length;o++){var i=n[o];-1===r.indexOf(i)&&r.push(i)}this.injectedModules=r}if(this.directivekeys){var p=this.validateChildren({},this.directivekeys,e||this.props);if(p){if(!t&&this.skipRefresh)for(var s=0,c=this.skipRefresh;s<c.length;s++){delete p[c[s]]}this.setProperties(p,t)}}},p.prototype.componentWillUnmount=function(){this.destroy()},p.prototype.validateChildren=function(t,r,o){for(var n=!1,i=0,p=e.Children.toArray(o.children);i<p.length;i++){var s=p[i],c=this.getChildType(s),u=r[c];if(c&&r){var f=this.getChildProps(e.Children.toArray(s.props.children),u);f.length&&(n=!0,t[s.type.propertyName||c]=f)}}return n?t:null},p.prototype.getChildType=function(t){return t.type&&t.type.isDirective?t.type.moduleName||"":""},p.prototype.getChildProps=function(t,e){for(var r=[],n=0,i=t;n<i.length;n++){var p=i[n],s=!1,c=void 0;"string"==typeof e?(s=!0,c=e):c=Object.keys(e)[0];var u=p.props;this.getChildType(p)===c&&(s||!u.children?r.push(u):r.push(this.validateChildren(o.extend({},u),e[c],u)||u))}return r},p.prototype.getInjectedServices=function(){for(var t=0,r=e.Children.toArray(this.props.children);t<r.length;t++){var o=r[t];if(o.type.isService)return o.props.services}return[]},p}(e.PureComponent),s=function(){var 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])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.render=function(){return null},e.isDirective=!0,e}(e.PureComponent),u=function(){var 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])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),f=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);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=c,t.Inject=f,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!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?l(t,e):function(e){var n=document.createElement("div");return r.render(t(e),n),n.children}}var i=function(){var 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])};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","onClick","onFocus","onBlur"],s=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return i(o,t),o.prototype.componentWillMount=function(){var t=Object.keys(this.props);this.htmlattributes={};for(var e=p.concat(this.controlAttributes||[]),r=0,n=t;r<n.length;r++){var o=n[r];-1===o.indexOf("data-")&&-1===o.indexOf("aria-")&&-1===e.indexOf(o)||(this.htmlattributes[o]=this.props[o])}},o.prototype.componentDidMount=function(){this.refreshChild(!0);var t=r.findDOMNode(this);this.appendTo(t)},o.prototype.componentWillReceiveProps=function(t){this.setState(t),this.setProperties(t),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 p=this.validateChildren({},this.directivekeys,e||this.props);if(p){if(!t&&this.skipRefresh)for(var s=0,c=this.skipRefresh;s<c.length;s++){delete p[c[s]]}this.setProperties(p,t)}}},o.prototype.componentWillUnmount=function(){this.destroy()},o.prototype.validateChildren=function(t,r,n){for(var o=!1,i=0,p=e.Children.toArray(n.children);i<p.length;i++){var s=p[i],c=this.getChildType(s),u=r[c];if(c&&r){var f=this.getChildProps(e.Children.toArray(s.props.children),u);f.length&&(o=!0,t[s.type.propertyName||c]=f)}}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 p=i[o],s=!1,c=void 0;"string"==typeof e?(s=!0,c=e):c=Object.keys(e)[0];var u=p.props;this.getChildType(p)===c&&(s||!u.children?r.push(u):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=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])};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),f=function(){var 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])};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 f(e,t),e.prototype.render=function(){return null},e.isService=!0,e}(e.PureComponent),l=n.getTemplateEngine();n.setTemplateEngine({compile:o}),t.ComponentBase=s,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=a,t.compile=o,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-react-base.umd.min.js.map |
import { Children, PureComponent } from 'react'; | ||
import { findDOMNode } from 'react-dom'; | ||
import { extend } from '@syncfusion/ej2-base'; | ||
import { findDOMNode, render } from 'react-dom'; | ||
import { extend, getTemplateEngine, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
@@ -11,2 +11,3 @@ /** | ||
'onClick', 'onFocus', 'onBlur']; | ||
/* tslint:disable */ | ||
class ComponentBase extends PureComponent { | ||
@@ -63,3 +64,2 @@ componentWillMount() { | ||
} | ||
/* tslint:disable:no-any */ | ||
validateChildren(childCache, mapper, props) { | ||
@@ -72,5 +72,7 @@ let flag = false; | ||
if (ifield && mapper) { | ||
// tslint:disable:no-any | ||
let childProps = this.getChildProps(Children.toArray(child.props.children), key); | ||
if (childProps.length) { | ||
flag = true; | ||
// tslint:disable:no-any | ||
childCache[child.type.propertyName || ifield] = childProps; | ||
@@ -85,2 +87,3 @@ } | ||
} | ||
// tslint:disable:no-any | ||
getChildType(child) { | ||
@@ -118,6 +121,6 @@ if (child.type && child.type.isDirective) { | ||
} | ||
// 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) { | ||
@@ -163,6 +166,25 @@ return child.props.services; | ||
/** | ||
* Template compiler for react | ||
*/ | ||
// tslint:disable:no-any | ||
let stringCompiler = getTemplateEngine(); | ||
function compile(templateElement, helper) { | ||
if (typeof templateElement === 'string') { | ||
return stringCompiler(templateElement, helper); | ||
} | ||
else { | ||
return (data) => { | ||
let ele = document.createElement('div'); | ||
render(templateElement(data), ele); | ||
return ele.children; | ||
}; | ||
} | ||
} | ||
setTemplateEngine({ compile: compile }); | ||
/** | ||
* index for component base | ||
*/ | ||
export { ComponentBase, applyMixins, ComplexBase, Inject }; | ||
export { ComponentBase, applyMixins, ComplexBase, Inject, compile }; | ||
//# sourceMappingURL=ej2-react-base.es2015.js.map |
import { Children, PureComponent } from 'react'; | ||
import { findDOMNode } from 'react-dom'; | ||
import { extend } from '@syncfusion/ej2-base'; | ||
import { findDOMNode, render } from 'react-dom'; | ||
import { extend, getTemplateEngine, setTemplateEngine } from '@syncfusion/ej2-base'; | ||
@@ -21,2 +21,3 @@ var __extends = (undefined && undefined.__extends) || (function () { | ||
'onClick', 'onFocus', 'onBlur']; | ||
/* tslint:disable */ | ||
var ComponentBase = /** @__PURE__ @class */ (function (_super) { | ||
@@ -80,3 +81,2 @@ __extends(ComponentBase, _super); | ||
}; | ||
/* tslint:disable:no-any */ | ||
ComponentBase.prototype.validateChildren = function (childCache, mapper, props) { | ||
@@ -90,5 +90,7 @@ var flag = false; | ||
if (ifield && mapper) { | ||
// tslint:disable:no-any | ||
var childProps = this.getChildProps(Children.toArray(child.props.children), key); | ||
if (childProps.length) { | ||
flag = true; | ||
// tslint:disable:no-any | ||
childCache[child.type.propertyName || ifield] = childProps; | ||
@@ -103,2 +105,3 @@ } | ||
}; | ||
// tslint:disable:no-any | ||
ComponentBase.prototype.getChildType = function (child) { | ||
@@ -137,2 +140,3 @@ if (child.type && child.type.isDirective) { | ||
}; | ||
// tslint:disable:no-any | ||
ComponentBase.prototype.getInjectedServices = function () { | ||
@@ -142,3 +146,2 @@ var childs = Children.toArray(this.props.children); | ||
var child = childs_2[_i]; | ||
/* tslint:disable:no-any */ | ||
if (child.type.isService) { | ||
@@ -215,6 +218,25 @@ return child.props.services; | ||
/** | ||
* Template compiler for react | ||
*/ | ||
// tslint:disable:no-any | ||
var stringCompiler = getTemplateEngine(); | ||
function compile(templateElement, helper) { | ||
if (typeof templateElement === 'string') { | ||
return stringCompiler(templateElement, helper); | ||
} | ||
else { | ||
return function (data) { | ||
var ele = document.createElement('div'); | ||
render(templateElement(data), ele); | ||
return ele.children; | ||
}; | ||
} | ||
} | ||
setTemplateEngine({ compile: compile }); | ||
/** | ||
* index for component base | ||
*/ | ||
export { ComponentBase, applyMixins, ComplexBase, Inject }; | ||
export { ComponentBase, applyMixins, ComplexBase, Inject, compile }; | ||
//# sourceMappingURL=ej2-react-base.es5.js.map |
/*! | ||
* filename: index.d.ts | ||
* version : 16.1.26 | ||
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. | ||
* version : 16.1.28 | ||
* Copyright Syncfusion Inc. 2001 - 2018. 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 |
{ | ||
"name": "@syncfusion/ej2-react-base", | ||
"version": "16.1.28", | ||
"version": "16.1.32", | ||
"description": "Essential JS 2 React Base", | ||
@@ -28,3 +28,3 @@ "author": "Syncfusion Inc.", | ||
"source-map-loader": "^0.2.1", | ||
"@syncfusion/ej2-base": "~16.1.28" | ||
"@syncfusion/ej2-base": "~16.1.32" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -8,1 +8,2 @@ /** | ||
export * from './services'; | ||
export * from './template'; |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "./component-base", "./util", "./complex-base", "./services"], function (require, exports, component_base_1, util_1, complex_base_1, services_1) { | ||
define(["require", "exports", "./component-base", "./util", "./complex-base", "./services", "./template"], function (require, exports, component_base_1, util_1, complex_base_1, services_1, template_1) { | ||
"use strict"; | ||
@@ -11,2 +11,3 @@ function __export(m) { | ||
__export(services_1); | ||
__export(template_1); | ||
}); |
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 too big to display
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
2172410
27
2381