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

react-konva-grid

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-konva-grid - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

30

dist/hooks/useSelection.js

@@ -140,2 +140,8 @@ "use strict";

};
const boundsSubsetOfSelection = (bounds, selection) => {
return (bounds.top >= selection.top &&
bounds.bottom <= selection.bottom &&
bounds.left >= selection.left &&
bounds.right <= selection.right);
};
/**

@@ -521,4 +527,28 @@ * Triggers a new selection start

const bounds = selectionFromStartEnd(activeCell, coords);
const hasSelections = selections.length > 0;
const activeCellBounds = hasSelections
? selections[0].bounds
: gridRef.current.getCellBounds(activeCell);
if (!bounds)
return;
/**
* Restrict to same row and col
*/
if (bounds.bottom !== activeCellBounds.bottom ||
bounds.top !== activeCellBounds.top) {
bounds.left = activeCellBounds.left;
bounds.right = activeCellBounds.right;
}
else if (bounds.left !== activeCellBounds.left) {
bounds.top = activeCellBounds.top;
bounds.bottom = activeCellBounds.bottom;
}
/**
* If user moves back to the same selection, clear
*/
if (hasSelections &&
boundsSubsetOfSelection(bounds, selections[0].bounds)) {
setFillSelection(null);
return;
}
setFillSelection({ bounds });

@@ -525,0 +555,0 @@ gridRef.current.scrollToItem(coords);

2

package.json
{
"name": "react-konva-grid",
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets",
"version": "3.0.0",
"version": "3.0.1",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

import React, { useState, useCallback, useRef, useEffect } from "react";
import { SelectionArea, CellInterface, GridRef } from "./../Grid";
import { SelectionArea, CellInterface, GridRef, AreaProps } from "./../Grid";
import {

@@ -274,2 +274,11 @@ findNextCellWithinBounds,

const boundsSubsetOfSelection = (bounds: AreaProps, selection: AreaProps) => {
return (
bounds.top >= selection.top &&
bounds.bottom <= selection.bottom &&
bounds.left >= selection.left &&
bounds.right <= selection.right
);
};
/**

@@ -715,4 +724,32 @@ * Triggers a new selection start

const bounds = selectionFromStartEnd(activeCell, coords);
const hasSelections = selections.length > 0;
const activeCellBounds = hasSelections
? selections[0].bounds
: gridRef.current.getCellBounds(activeCell);
if (!bounds) return;
/**
* Restrict to same row and col
*/
if (
bounds.bottom !== activeCellBounds.bottom ||
bounds.top !== activeCellBounds.top
) {
bounds.left = activeCellBounds.left;
bounds.right = activeCellBounds.right;
} else if (bounds.left !== activeCellBounds.left) {
bounds.top = activeCellBounds.top;
bounds.bottom = activeCellBounds.bottom;
}
/**
* If user moves back to the same selection, clear
*/
if (
hasSelections &&
boundsSubsetOfSelection(bounds, selections[0].bounds)
) {
setFillSelection(null);
return;
}
setFillSelection({ bounds });

@@ -719,0 +756,0 @@

Sorry, the diff of this file is not supported yet

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