New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

virtual-each

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-each

A port of react-infinite-list to Ember.

latest
Source
npmnpm
Version
0.6.3
Version published
Weekly downloads
345
40.82%
Maintainers
3
Weekly downloads
 
Created
Source

virtual-each

Ember Observer Score Ember badge NPM Version Build Status Dependency Status devDependency Status

A direct port of react-infinite-list to Ember. This was created as a benchmark exercise.

This component will only ever render DOM nodes for what can fill the view port. Using the power of Glimmer, it will reuse the DOM nodes it's already created and swap out the content as the user scrolls.

If you want a more flexible virtualization component, please try ember-collection.

Install

ember install virtual-each

Usage

{{#virtual-each items
  height=200
  itemHeight=36
  onScrollBottomed=(action 'handlePageBottom')
  positionIndex=0
  as |item actualIndex virtualIndex|
}}
  <div class="person-row">
    <img src={{item.picture}} />
    <div>
      <div>{{actualIndex}}. {{item.name.last}}, {{item.name.first}}</div>
      <div class="company">{{item.company}}</div>
    </div>
  </div>
{{else}}
  <strong>No results</strong>
{{/virtual-each}}

Attributes

  • height: fixed height of the component (required)
  • itemHeight: fixed row height (required)
  • onScrollBottomed: invoked when scrolled to the bottom of the list (optional)
  • positionIndex: start at or scroll to a specific item based on the item index (optional)

CSS

Add the following CSS snippet to styles/app.css:

.virtual-each {
  overflow-y: auto;
}

.infinite-list-content {
  list-style: none;
  margin: 0;
  padding: 0;
}

Known "Gotchas"

  • Not defining an itemHeight, or defining a less-than expected height, will result in unexpected jumping behavior during scrolling. itemHeight should be set to exact height of a row.

Demo

Requirements

  • Ember >= 2.12.0

Contributing

Install

  • git clone this repository
  • npm install
  • bower install
  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Keywords

ember-addon

FAQs

Package last updated on 15 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts