Socket
Socket
Sign inDemoInstall

rc-util

Package Overview
Dependencies
Maintainers
2
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-util - npm Package Compare versions

Comparing version 4.0.4 to 5.0.0-beta.0

4

es/Dom/class.js

@@ -6,3 +6,3 @@ export function hasClass(node, className) {

var originClass = node.className;
return originClass.indexOf(className) > -1;
return (' ' + originClass + ' ').indexOf(' ' + className + ' ') > -1;
}

@@ -26,5 +26,5 @@

var originClass = node.className;
node.className = originClass.replace(className, '');
node.className = (' ' + originClass + ' ').replace(' ' + className + ' ', '');
}
}
}

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

import _extends from 'babel-runtime/helpers/extends';
import ReactDOM from 'react-dom';

@@ -11,7 +10,3 @@

export default function getContainerRenderMixin(config) {
var _config$autoMount = config.autoMount,
autoMount = _config$autoMount === undefined ? true : _config$autoMount,
_config$autoDestroy = config.autoDestroy,
autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy,
isVisible = config.isVisible,
var isVisible = config.isVisible,
getComponent = config.getComponent,

@@ -22,4 +17,2 @@ _config$getContainer = config.getContainer,

var mixin = void 0;
function _renderComponent(instance, componentArg, ready) {

@@ -30,8 +23,3 @@ if (!isVisible || instance._component || isVisible(instance)) {

}
var component = void 0;
if (instance.getComponent) {
component = instance.getComponent(componentArg);
} else {
component = getComponent(instance, componentArg);
}
var component = getComponent(instance, componentArg);
ReactDOM.unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() {

@@ -46,21 +34,2 @@ instance._component = this;

if (autoMount) {
mixin = _extends({}, mixin, {
componentDidMount: function componentDidMount() {
_renderComponent(this);
},
componentDidUpdate: function componentDidUpdate() {
_renderComponent(this);
}
});
}
if (!autoMount || !autoDestroy) {
mixin = _extends({}, mixin, {
renderComponent: function renderComponent(componentArg, ready) {
_renderComponent(this, componentArg, ready);
}
});
}
function _removeContainer(instance) {

@@ -75,17 +44,12 @@ if (instance._container) {

if (autoDestroy) {
mixin = _extends({}, mixin, {
componentWillUnmount: function componentWillUnmount() {
_removeContainer(this);
}
});
} else {
mixin = _extends({}, mixin, {
removeContainer: function removeContainer() {
_removeContainer(this);
}
});
}
var mixin = {
renderComponent: function renderComponent(componentArg, ready) {
_renderComponent(this, componentArg, ready);
},
removeContainer: function removeContainer() {
_removeContainer(this);
}
};
return mixin;
}

@@ -14,3 +14,3 @@ 'use strict';

var originClass = node.className;
return originClass.indexOf(className) > -1;
return (' ' + originClass + ' ').indexOf(' ' + className + ' ') > -1;
}

@@ -34,5 +34,5 @@

var originClass = node.className;
node.className = originClass.replace(className, '');
node.className = (' ' + originClass + ' ').replace(' ' + className + ' ', '');
}
}
}

@@ -6,7 +6,2 @@ 'use strict';

});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports['default'] = getContainerRenderMixin;

@@ -27,7 +22,3 @@

function getContainerRenderMixin(config) {
var _config$autoMount = config.autoMount,
autoMount = _config$autoMount === undefined ? true : _config$autoMount,
_config$autoDestroy = config.autoDestroy,
autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy,
isVisible = config.isVisible,
var isVisible = config.isVisible,
getComponent = config.getComponent,

@@ -38,4 +29,2 @@ _config$getContainer = config.getContainer,

var mixin = void 0;
function _renderComponent(instance, componentArg, ready) {

@@ -46,8 +35,3 @@ if (!isVisible || instance._component || isVisible(instance)) {

}
var component = void 0;
if (instance.getComponent) {
component = instance.getComponent(componentArg);
} else {
component = getComponent(instance, componentArg);
}
var component = getComponent(instance, componentArg);
_reactDom2['default'].unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() {

@@ -62,21 +46,2 @@ instance._component = this;

if (autoMount) {
mixin = (0, _extends3['default'])({}, mixin, {
componentDidMount: function componentDidMount() {
_renderComponent(this);
},
componentDidUpdate: function componentDidUpdate() {
_renderComponent(this);
}
});
}
if (!autoMount || !autoDestroy) {
mixin = (0, _extends3['default'])({}, mixin, {
renderComponent: function renderComponent(componentArg, ready) {
_renderComponent(this, componentArg, ready);
}
});
}
function _removeContainer(instance) {

@@ -91,15 +56,10 @@ if (instance._container) {

if (autoDestroy) {
mixin = (0, _extends3['default'])({}, mixin, {
componentWillUnmount: function componentWillUnmount() {
_removeContainer(this);
}
});
} else {
mixin = (0, _extends3['default'])({}, mixin, {
removeContainer: function removeContainer() {
_removeContainer(this);
}
});
}
var mixin = {
renderComponent: function renderComponent(componentArg, ready) {
_renderComponent(this, componentArg, ready);
},
removeContainer: function removeContainer() {
_removeContainer(this);
}
};

@@ -106,0 +66,0 @@ return mixin;

{
"name": "rc-util",
"version": "4.0.4",
"version": "5.0.0-beta.0",
"description": "Common Utils For React Component",

@@ -27,2 +27,3 @@ "keywords": [

"build": "rc-tools run build",
"compile": "rc-tools run compile",
"pub": "rc-tools run pub --babel-runtime",

@@ -29,0 +30,0 @@ "lint": "rc-tools run lint",

@@ -63,4 +63,2 @@ # rc-util

|-------|------|-------------|---------|
| autoMount | boolean | Whether to render component into container automatically | true |
| autoDestroy | boolean | Whether to remove container automatically while the component is unmounted | true |
| isVisible | (instance): boolean | A function to get current visibility of the component | - |

@@ -67,0 +65,0 @@ | getComponent | (instance, extra): ReactNode | A function to get the component which will be rendered into container | - |

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