Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

af-react-grid

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

af-react-grid - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

4

babel.config.js
module.exports = {
"presets": [ [ "@babel/env", { "modules": false } ], "@babel/react" ],
"presets": [ [ "@babel/env", { "modules": false } ], "@babel/react", "@emotion/babel-preset-css-prop" ],
"plugins": [

@@ -9,5 +9,5 @@ "@babel/plugin-syntax-dynamic-import",

"test": {
"presets": [ [ "@babel/env" ], "@babel/react" ]
"presets": [ [ "@babel/env" ], "@babel/react", "@emotion/babel-preset-css-prop" ]
}
}
}
import React from "react";
import { jsx, css } from "@emotion/core";
import Container from "Container";
import Resizer from "Resizer";
import DefaultResizer from "Resizer";
const baseResizerClass = css`
flex-basis: 1px;
display: flex;
position: relative;
background: green;
z-index: 1;
&:after {
position: absolute;
content: "";
}
`;
const colResizer = css`
cursor: row-resize;
&:after {
height: 11px;
left: 0;
right: 0;
top: -5px;
}
`;
const rowResizer = css`
cursor: col-resize;
&:after {
width: 11px;
top: 0;
bottom: 0;
left: -5px;
}
`;
const Resizer = React.memo( props => (
<DefaultResizer
{...props}
css={css`
${baseResizerClass}
${props.type==="col" ? colResizer : rowResizer}
`}
/>
));
Resizer.isResizer = true;
class Grid extends React.Component{

@@ -7,0 +52,0 @@

{
"name": "af-react-grid",
"version": "1.1.8",
"version": "1.1.9",
"sideEffects": false,

@@ -38,2 +38,4 @@ "browserslist": [

"dependencies": {
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14",
"classnames": "^2.2.6",

@@ -57,2 +59,3 @@ "emotion": "^10.0.14",

"@babel/runtime": "^7.5.5",
"@emotion/babel-preset-css-prop": "^10.0.14",
"babel-core": "^7.0.0-bridge.0",

@@ -77,3 +80,3 @@ "babel-jest": "^24.8.0",

"rollup-plugin-strip-prop-types": "^1.0.2",
"webpack": "^4.36.1",
"webpack": "^4.37.0",
"webpack-cli": "^3.3.6",

@@ -80,0 +83,0 @@ "webpack-dev-server": "^3.7.2"

@@ -6,19 +6,2 @@ import { css } from "emotion";

export const DEFAULT_RESIZER_STYLES = {
flexShrink: 0,
flexGrow: 0,
flexBasis: 7,
position: "relative",
background: "#fff",
zIndex: 10,
'&[data-resizer-type="row"]': {
cursor: "col-resize"
},
'&[data-resizer-type="col"]': {
cursor: "row-resize"
}
}
const rowClassName = css`

@@ -25,0 +8,0 @@ display: flex;

import React, { createRef, isValidElement, Children, useReducer, useRef, useEffect, useCallback } from "react";
import PropTypes from "prop-types";
import Resizer from "../Resizer";
import StateSaver from "./StateSaver";

@@ -8,3 +7,3 @@ import { css, cx } from "emotion";

import { memoizeOneNumericArg, clamp, getCorrectProperty, getNodeFromRef } from "../utils";
import { ByType, UNIQUE_HASH, DEFAULT_RESIZER_STYLES } from "../constants";
import { ByType, UNIQUE_HASH } from "../constants";

@@ -19,10 +18,7 @@ function childrenMapper( el ){

const { resizerChildren, type: curType, localStorageKey } = this.props;
const { type: curType, localStorageKey } = this.props;
/* If we just use defaultProps, resizerClassName will not be passed down to nested Containers proprly */
const realResizerClassName = getCorrectProperty( this.props, "resizerClassName", Container.defaultResizerClass );
const curIndex = this._refsArrIterator;
if( type === Resizer ){
if( type.isResizer ){
return React.cloneElement( el, {

@@ -32,5 +28,4 @@ index: curIndex,

onStart: this.dragStartHandler,
type: curType,
className: getCorrectProperty( props, "className", realResizerClassName )
}, getCorrectProperty( props, "children", resizerChildren ) );
type: curType
});
}

@@ -64,4 +59,2 @@

/* We sacrifice performance in order to make code more compact here */
passProps.resizerClassName = getCorrectProperty( props, "resizerClassName", realResizerClassName );
passProps.resizerChildren = getCorrectProperty( props, "resizerChildren", resizerChildren );
passProps.localStorageKey = getCorrectProperty( props, "localStorageKey", localStorageKey + "_" + stateKey );

@@ -87,5 +80,2 @@ }

},
resizerChildren: PropTypes.node,
resizerClassName: PropTypes.string,
defaultResizerStyle: PropTypes.oneOfType([ PropTypes.object, PropTypes.func ]),
localStorageKey: PropTypes.string

@@ -98,7 +88,2 @@ }

static setGlobalDefaultResizersStyle( newStyle ){
const st = Container.defaultResizerStyle = typeof newStyle === "function" ? newStyle( Container.defaultResizerStyle ) : newStyle;
Container.defaultResizerClass = css( st );
}
constructor( props ){

@@ -108,11 +93,2 @@ super( props );

this.state = StateSaver.getStylesInfo( props.localStorageKey );
const { defaultResizerStyle: ds } = props;
if( ds ){
this.defaultResizerClass = typeof ds === "function" ? ds( Container.defaultResizerStyle ) : ds;
}
else{
this.defaultResizerClass = getCorrectProperty( props, "resizerClassName", Container.defaultResizerClass );
}
}

@@ -326,4 +302,2 @@

Container.setGlobalDefaultResizersStyle( DEFAULT_RESIZER_STYLES );
export default Container;

@@ -5,3 +5,3 @@ import React from "react";

const Resizer = React.memo(({
const Resizer = ({
className,

@@ -25,4 +25,6 @@ type,

</DraggableCore>
));
);
Resizer.isResizer = true;
Resizer.propTypes = {

@@ -29,0 +31,0 @@ type: PropTypes.oneOf([ "row", "col" ]),

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