![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
aurelia-v2-virtual-repeat
Advanced tools
A plugin for doing virtualization with Aurelia 2
Size:
To install the plugin, do:
npm install aurelia-v2-virtual-repeat
To register the standard behavior of the plugin in your application, add DefaultVirtualRepeatConfiguration
to your Aurelia instance:
import { DefaultVirtualRepeatConfiguration } from 'aurelia-v2-virtual-repeat';
Aurelia.register(DefaultVirtualRepeatConfiguration).app(MyApp).start();
This plugin can be used like the standard repeater, like in the following example:
<template>
<div virtual-repeat.for="item of items">
${$index} ${item}
</div>
</template>
<template>
<table>
<tr virtual-repeat.for="item of items">
<td>${$index}</td>
<td>${item}</td>
</tr>
</table>
</template>
<template>
<ul>
<li virtual-repeat.for="item of items">
${$index} ${item}
</li>
</ul>
</template>
The virtual-repeat
requires to be placed inside a "scrollable" element, which means the element should have either overflow: scroll
or overflow: auto
in its styles. An error will be throw if the virtual-repeat
is unable to locate such element.
virtual-repeat
: DOM recycling mode. In this mode, it is expected that the DOM nodes will be moved around, and only binding data will be changed. Application should be aware of this and employ reactive programming model with change handler xxxxxChanged()
to avoid surprises.<template/>
is not supported as a root of a repeat template, use a normal element instead:nth-child
and similar CSS selectors. This implementation requires appropriate shifting visible items, based on scroll position. This means DOM elements order will not stay the same, thus creating unexpected :nth-child
CSS selector behavior. To work around this, you can use contextual properties $index
, $odd
, $even
, $first
, $last
, $middle
, $length
to determine the position of an item, and apply CSS classes/styles against it, like the following example:
<template>
<div virtual-repeat.for="person of persons" class="${$odd ? 'odd' : 'even'}-row">
${person.name}
</div>
</template>
virtual-repeat
, unlike the standard repeat
. I.e: built-in template controllers: with
, if
, au-slot
cannot be used with the virtual-repeat
. This can be workaround'd by nesting other template controllers inside the repeated element, with <template/>
element, for example:
<template>
<h1>${message}</h1>
<div virtual-repeat.for="person of persons">
<template with.bind="person">
Person name is: ${name}
</template>
</div>
</template>
To develop the plugin, run
npm run test
Run unit tests in watch mode.
npm run test:watch
virtual-repeat
attribute at the moment. In the future, there will be more: non-recycling mode, variable height, and maybe an additional of <au-virtual-repeat>
custom element for more control over the behavior of the repeat.Set
& Map
are harder as they require better collection to index mappingFAQs
An Aurelia 2 virtual repeat implementation.
We found that aurelia-v2-virtual-repeat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.