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

dynamic-virtual-scroller

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-virtual-scroller - npm Package Compare versions

Comparing version 3.0.11 to 3.0.12

2

package.json
{
"name": "dynamic-virtual-scroller",
"version": "3.0.11",
"version": "3.0.12",
"description": "A virtual scroller for the web that can handle dynamic row and column sizes.",

@@ -5,0 +5,0 @@ "main": "virtual-scroller.js",

@@ -59,2 +59,3 @@ import validateParameters from './validateParameters';

var dragState = getCleanDragState();
var attachedContainer;
var dragulaAdapter = {};

@@ -64,2 +65,8 @@ var drake = adapterConfig.drake;

drake.on('drag', function (el, source) {
/*
Multiple scroller might be attached to the same drake.
*/
if ($.contains(attachedContainer.get(0), source) === false) {
return;
}
el = $(el);

@@ -76,3 +83,3 @@ source = $(source);

var onElementMoved = function (el, container, source) {
el = $(el);

@@ -84,37 +91,14 @@ container = $(container);

var scrollerIndexBefore = parseInt(el.attr(ATTRIBUTES.index));
if (container.get(0) === dragState.container.get(0)) {
scrollContainer
.data(DATA.API)
.rowWasMovedInDom({row: el});
var scrollerIndexAfter = parseInt(el.attr(ATTRIBUTES.index));
adapterConfig.moveDataOfRow({
scrollContainer: scrollContainer,
row: el,
oldRowIndex: scrollerIndexBefore,
newRowIndex: scrollerIndexAfter
});
dragState.currentIndex = scrollerIndexAfter;
} else {
dragState.container
.closest('.' + CLASSES.container)
.data(DATA.API)
.removeRowAt({rowIndex: scrollerIndexBefore});
adapterConfig.removeDataOfRow({
row: el,
rowIndex: scrollerIndexBefore,
scrollContainer: dragState.container.closest('.' + CLASSES.container),
});
if (dragState.currentIndex === -1) {
/*
Row was dragged in
*/
var firstRenderedIndex = scrollContainer.data(DATA.API).getFirstRenderedRowIndex();
var newIndex = (firstRenderedIndex === -1 ? 0 : firstRenderedIndex) + el.index();
dragState.startIndex = newIndex;
dragState.currentIndex = newIndex;
dragState.row = el;
dragState.container = container;

@@ -128,8 +112,47 @@ adapterConfig.addDataOfRow({

scrollContainer.data(DATA.API).addRowAt({rowIndex: newIndex});
return;
}
dragState.container = container;
/*
Row was dragged around
*/
scrollContainer
.data(DATA.API)
.rowWasMovedInDom({row: el});
var scrollerIndexAfter = parseInt(el.attr(ATTRIBUTES.index));
if (scrollerIndexBefore !== scrollerIndexAfter) {
adapterConfig.moveDataOfRow({
scrollContainer: scrollContainer,
row: el,
oldRowIndex: scrollerIndexBefore,
newRowIndex: scrollerIndexAfter
});
}
dragState.currentIndex = scrollerIndexAfter;
};
drake.on('shadow', function (el, container, source) {
if ($.contains(attachedContainer.get(0), container) === false) {
/*
Row was dragged out
*/
if (dragState.currentIndex !== -1) {
dragState.container
.closest('.' + CLASSES.container)
.data(DATA.API)
.removeRowAt({rowIndex: dragState.currentIndex});
adapterConfig.removeDataOfRow({
row: $(el),
rowIndex: dragState.currentIndex,
scrollContainer: dragState.container.closest('.' + CLASSES.container),
});
dragState = getCleanDragState();
}
return;
}
dragState.shadowCount += 1;

@@ -168,2 +191,4 @@ onElementMoved(el, container, source);

}
attachedContainer = config.container;

@@ -192,2 +217,2 @@ var _renderRow = config.renderRow;

export default DragulaAdapter;
export default DragulaAdapter;

@@ -172,3 +172,3 @@ import {ATTRIBUTES, EVENTS, CLASSES} from "./constants";

return () => {
_.remove(state.subscriptions, onChangeFns);
_.remove(state.subscriptions, onChangeFn);
};

@@ -175,0 +175,0 @@ }

Sorry, the diff of this file is too big to display

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