-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from bigopon/master
feat(VirtualRepeat): handle null / undefined, empty collection
- Loading branch information
Showing
6 changed files
with
109 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { NullRepeatStrategy } from "aurelia-templating-resources"; | ||
|
||
export class NullVirtualRepeatStrategy extends NullRepeatStrategy { | ||
instanceChanged(repeat) { | ||
super.instanceChanged(repeat); | ||
repeat._resetCalculation(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import {RepeatStrategyLocator} from 'aurelia-templating-resources'; | ||
import {ArrayVirtualRepeatStrategy} from './array-virtual-repeat-strategy'; | ||
import {NullVirtualRepeatStrategy} from './null-virtual-repeat-strategy' | ||
|
||
export class VirtualRepeatStrategyLocator extends RepeatStrategyLocator { | ||
constructor() { | ||
super(); | ||
this.matchers = []; | ||
this.strategies = []; | ||
|
||
this.addStrategy(items => items === null || items === undefined, new NullVirtualRepeatStrategy()); | ||
this.addStrategy(items => items instanceof Array, new ArrayVirtualRepeatStrategy()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters