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 1.0.4 to 1.0.5

2

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

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

@@ -740,2 +740,21 @@ window.VirtualScroller = (function ($, _) {

renderManager.isRowRendered = function (params) {
params = validateParameters(params, {
rowIndex: {type: 'number'}
});
return !!renderManager.state.children[params.rowIndex];
};
renderManager.isColumnRendered = function (params) {
params = validateParameters(params, {
rowIndex: {type: 'number', default: _.findIndex(renderManager.rowStates, function (state) {
return !!state;
})},
columnIndex: {type: 'number'}
});
var rowState = renderManager.rowStates[params.rowIndex];
return !!rowState.children[params.columnIndex];
};
renderManager.reevaluateRowSizeAtIndex = function (params) {

@@ -1332,3 +1351,8 @@

.css('height', '');
}
},
isRowRendered: renderManager.isRowRendered,
isColumnRendered: renderManager.isColumnRendered,
};

@@ -1423,66 +1447,62 @@

Dom Cache Adapter
TODO: React to all dynamic changes like rowRemoved, rowAdded, rerender, ...
*/
VirtualScroller.DomCacheAdapter = function (scrollerConfig) {
// VirtualScroller.DomCacheAdapter = function (scrollerConfig) {
//
// var rowCache = {};
// var columnCache = {};
//
// var oldOnBeforeRowRemoved = scrollerConfig.onBeforeRowRemoved;
// scrollerConfig.onBeforeRowRemoved = function (params) {
// if (oldOnBeforeRowRemoved) {
// oldOnBeforeRowRemoved(params);
// }
// rowCache[params.rowIndex] = params.row;
// params.row.detach();
// params.row.find('[virtual-scroller-index]').each(function (index, column) {
// column = $(column);
// var columnIndex = parseInt(column.attr('virtual-scroller-index'));
// columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
// columnCache[params.rowIndex][columnIndex] = column;
// });
// return false;
// };
//
// var oldRenderRow = scrollerConfig.renderRow;
// scrollerConfig.renderRow = function (params) {
// if (rowCache[params.rowIndex]) {
// return rowCache[params.rowIndex];
// }
// return oldRenderRow(params);
// };
//
// if (scrollerConfig.renderColumn) {
//
// var oldOnBeforeColumnRemoved = scrollerConfig.onBeforeColumnRemoved;
// scrollerConfig.onBeforeColumnRemoved = function (params) {
// if (oldOnBeforeRowRemoved) {
// oldOnBeforeRowRemoved(params);
// }
// columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
// columnCache[params.rowIndex][params.columnIndex] = params.column;
// params.column.detach();
// return false;
// };
//
// var oldRenderColumn = scrollerConfig.renderColumn;
// scrollerConfig.renderColumn = function (params) {
// if (columnCache[params.rowIndex] && columnCache[params.rowIndex][params.columnIndex]) {
// return columnCache[params.rowIndex][params.columnIndex];
// }
// return oldRenderColumn(params);
// };
// }
//
//
// return scrollerConfig;
// };
/*
TODO: React to all dynamic changes like rowRemoved, rowAdded, rerender, ...
*/
var rowCache = {};
var columnCache = {};
var oldOnBeforeRowRemoved = scrollerConfig.onBeforeRowRemoved;
scrollerConfig.onBeforeRowRemoved = function (params) {
if (oldOnBeforeRowRemoved) {
oldOnBeforeRowRemoved(params);
}
rowCache[params.rowIndex] = params.row;
params.row.detach();
params.row.find('[virtual-scroller-index]').each(function (index, column) {
column = $(column);
var columnIndex = parseInt(column.attr('virtual-scroller-index'));
columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
columnCache[params.rowIndex][columnIndex] = column;
});
return false;
};
var oldRenderRow = scrollerConfig.renderRow;
scrollerConfig.renderRow = function (params) {
if (rowCache[params.rowIndex]) {
console.log('got it from cache');
return rowCache[params.rowIndex];
}
return oldRenderRow(params);
};
if (scrollerConfig.renderColumn) {
var oldOnBeforeColumnRemoved = scrollerConfig.onBeforeColumnRemoved;
scrollerConfig.onBeforeColumnRemoved = function (params) {
if (oldOnBeforeRowRemoved) {
oldOnBeforeRowRemoved(params);
}
columnCache[params.rowIndex] = columnCache[params.rowIndex] || {};
columnCache[params.rowIndex][params.columnIndex] = params.column;
params.column.detach();
return false;
};
var oldRenderColumn = scrollerConfig.renderColumn;
scrollerConfig.renderColumn = function (params) {
if (columnCache[params.rowIndex] && columnCache[params.rowIndex][params.columnIndex]) {
return columnCache[params.rowIndex][params.columnIndex];
}
return oldRenderColumn(params);
};
}
return scrollerConfig;
};
return VirtualScroller;
}(jQuery, _));

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