Skip to content

Commit b7ff555

Browse files
committed
refactor(all): rename virtual-repeat-next to infinite-scroll-next
BREAKING CHANGE: Renamed `virtual-repeat-next` to `infinite-scroll-next` to provide more meaning to the attribute.
1 parent 4da877f commit b7ff555

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ If you are running the plugin in the `skeleton-naviagion` project, make sure to
8989
#### infinite scroll
9090
```html
9191
<template>
92-
<div virtual-repeat.for="item of items" virtual-repeat-next="getMore">
92+
<div virtual-repeat.for="item of items" infinite-scroll-next="getMore">
9393
${$index} ${item}
9494
</div>
9595
</template>
@@ -108,7 +108,7 @@ export class MyVirtualList {
108108
Or to use an expression, use `.call` as shown below.
109109
```html
110110
<template>
111-
<div virtual-repeat.for="item of items" virtual-repeat-next.call="getMore($scrollContext)">
111+
<div virtual-repeat.for="item of items" infinite-scroll-next.call="getMore($scrollContext)">
112112
${$index} ${item}
113113
</div>
114114
</template>
@@ -124,7 +124,7 @@ export class MyVirtualList {
124124
}
125125
```
126126

127-
The `virtual-repeat-next` attribute can accept a function, a promise, or a function that returns a promise.
127+
The `infinite-scroll-next` attribute can accept a function, a promise, or a function that returns a promise.
128128
The bound function will be called when the scroll container has reached a point where there are no more items to move into the DOM (i.e. when it reaches the end of a list, either from the top or the bottom).
129129
There are three parameters that are passed to the function (`getMore(topIndex, isAtBottom, isAtTop)`) which helps determine the behavior or amount of items to get during scrolling.
130130
1. `topIndex` - A integer value that represents the current item that exists at the top of the rendered items in the DOM.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"build": {
125125
"resources": [
126126
"virtual-repeat",
127-
"virtual-repeat-next"
127+
"infinite-scroll-next"
128128
]
129129
},
130130
"documentation": {

src/aurelia-ui-virtualization.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {VirtualRepeat} from './virtual-repeat';
2-
import {VirtualRepeatNext} from './virtual-repeat-next';
2+
import {InfiniteScrollNext} from './infinite-scroll-next';
33

44
export function configure(config) {
55
config.globalResources(
66
'./virtual-repeat',
7-
'./virtual-repeat-next'
7+
'./infinite-scroll-next'
88
);
99
}
1010

1111
export {
1212
VirtualRepeat,
13-
VirtualRepeatNext
13+
InfiniteScrollNext
1414
};

src/virtual-repeat-next.js renamed to src/infinite-scroll-next.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {customAttribute} from 'aurelia-templating';
22

33
//Placeholder attribute to prohibit use of this attribute name in other places
44

5-
@customAttribute('virtual-repeat-next')
6-
export class VirtualRepeatNext {
5+
@customAttribute('infinite-scroll-next')
6+
export class InfiniteScrollNext {
77

88
constructor() {}
99

src/virtual-repeat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export class VirtualRepeat extends AbstractRepeater {
273273
if (!this._calledGetMore) {
274274
let executeGetMore = () => {
275275
this._calledGetMore = true;
276-
let func = (this.view(0) && this.view(0).firstChild.au) ? this.view(0).firstChild.au['virtual-repeat-next'].instruction.attributes['virtual-repeat-next'] : undefined;
276+
let func = (this.view(0) && this.view(0).firstChild.au) ? this.view(0).firstChild.au['infinite-scroll-next'].instruction.attributes['infinite-scroll-next'] : undefined;
277277
let topIndex = this._first;
278278
let isAtBottom = this._bottomBufferHeight === 0;
279279
let isAtTop = this._isAtTop;
@@ -288,7 +288,7 @@ export class VirtualRepeat extends AbstractRepeater {
288288
if (func === undefined) {
289289
return null;
290290
} else if (typeof func === 'string') {
291-
let getMoreFuncName = this.view(0).firstChild.getAttribute('virtual-repeat-next');
291+
let getMoreFuncName = this.view(0).firstChild.getAttribute('infinite-scroll-next');
292292
let funcCall = this.scope.overrideContext.bindingContext[getMoreFuncName];
293293

294294
if (typeof funcCall === 'function') {
@@ -301,13 +301,13 @@ export class VirtualRepeat extends AbstractRepeater {
301301
});
302302
}
303303
} else {
304-
throw new Error("'virtual-repeat-next' must be a function or evaluate to one");
304+
throw new Error("'infinite-scroll-next' must be a function or evaluate to one");
305305
}
306306
} else if (func.sourceExpression) {
307307
this._calledGetMore = false; //Reset for the next time
308308
return func.sourceExpression.evaluate(this.scope);
309309
} else {
310-
throw new Error("'virtual-repeat-next' must be a function or evaluate to one");
310+
throw new Error("'infinite-scroll-next' must be a function or evaluate to one");
311311
}
312312
return null;
313313
};

test/virtual-repeat-integration.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,21 +450,21 @@ describe('VirtualRepeat Integration', () => {
450450
spyOn(nestedVm, 'getNextPage').and.callThrough();
451451

452452
component = StageComponent
453-
.withResources(['src/virtual-repeat', 'src/virtual-repeat-next'])
453+
.withResources(['src/virtual-repeat', 'src/infinite-scroll-next'])
454454
.inView(`<div id="scrollContainer" style="height: 500px; overflow-y: scroll">
455-
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" virtual-repeat-next="getNextPage">\${item}</div>
455+
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" infinite-scroll-next="getNextPage">\${item}</div>
456456
</div>`)
457457
.boundTo(vm);
458458
nestedComponent = StageComponent
459-
.withResources(['src/virtual-repeat', 'src/virtual-repeat-next'])
459+
.withResources(['src/virtual-repeat', 'src/infinite-scroll-next'])
460460
.inView(`<div id="scrollContainerNested" style="height: 500px; overflow-y: scroll" repeat.for="foo of bar">
461-
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" virtual-repeat-next.call="$parent.getNextPage($scrollContext)">\${item}</div>
461+
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" infinite-scroll-next.call="$parent.getNextPage($scrollContext)">\${item}</div>
462462
</div>`)
463463
.boundTo(nestedVm);
464464
promisedComponent = StageComponent
465-
.withResources(['src/virtual-repeat', 'src/virtual-repeat-next'])
465+
.withResources(['src/virtual-repeat', 'src/infinite-scroll-next'])
466466
.inView(`<div id="scrollContainerPromise" style="height: 500px; overflow-y: scroll">
467-
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" virtual-repeat-next="getNextPage">\${item}</div>
467+
<div style="height: ${itemHeight}px;" virtual-repeat.for="item of items" infinite-scroll-next="getNextPage">\${item}</div>
468468
</div>`)
469469
.boundTo(promisedVm);
470470

0 commit comments

Comments
 (0)