Socket
Socket
Sign inDemoInstall

af-react-grid

Package Overview
Dependencies
92
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "af-react-grid",
"version": "2.0.0",
"version": "2.0.1",
"sideEffects": false,

@@ -5,0 +5,0 @@ "browserslist": [

@@ -22,3 +22,3 @@ import {

export const useDefaultCellKey = () => {
const useDefaultCellKey = () => {
const keyRef = useRef();

@@ -31,22 +31,2 @@ if( !keyRef.current ){

export const useCellStyle = cellKey => {
const GridModel = useContext( RootContext );
const type = useContext( TypeContext );
const [ curDimension, setCurDimension ] = useState( GridModel.get( cellKey ) );
useEffect(() => {
const up = () => setCurDimension( GridModel.get( cellKey ) );
const evt = `@cell/${cellKey}`;
GridModel.Events.on( evt, up );
return () => {
GridModel.Events.off( evt, up );
}
}, [ cellKey ]);
return useMemo(() => curDimension !== undefined ? ({
...ADDITIONAL_INLINE_STYLES,
[ByType[type].cssSizeProp]: curDimension
}) : undefined, [ type, curDimension ]);
}
export const Cell = ({ children: SingleChild, cellKey }) => {

@@ -60,18 +40,33 @@

const GridModel = useContext( RootContext );
const type = useContext( TypeContext );
const defaultCellKey = useDefaultCellKey();
const finalCellKey = cellKey || defaultCellKey;
const cellStyle = useCellStyle( finalCellKey, providedStyle );
const [ curDimension, setCurDimension ] = useState( GridModel.get( finalCellKey ) );
useEffect(() => {
const up = () => setCurDimension( GridModel.get( finalCellKey ) );
const evt = `@cell/${finalCellKey}`;
GridModel.Events.on( evt, up );
return () => {
if( !cellKey ){
GridModel.Events.off( evt, up );
}
}
}, [ finalCellKey ]);
const style = useMemo(() => {
if( !providedStyle ){
return cellStyle;
if( curDimension === undefined ){
return providedStyle;
}
return cellStyle && {
return {
...providedStyle,
...cellStyle
...ADDITIONAL_INLINE_STYLES,
[ByType[type].cssSizeProp]: curDimension
}
}, [ cellStyle, providedStyle ]);
}, [ curDimension, providedStyle ]);
return cloneElement( SingleChild, { [ElementRefProp]: finalCellKey, style });
}

@@ -10,5 +10,3 @@ import Container from "./Container";

createResizer,
Cell,
useCellStyle,
useDefaultCellKey
Cell
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc