Skip to content

Commit a9cd4d8

Browse files
committed
Merge pull request #77 from angular-ui/paddings
Paddings
2 parents 300bfdf + effe229 commit a9cd4d8

12 files changed

+463
-188
lines changed

demo/index.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ <h1 class="page-header">Scroller Examples</h1>
5454
Top visible (Adapter)
5555
</a>
5656
</li>
57+
<li>
58+
<a href="reload100/reload100.html">
59+
Reload datasource to specified index
60+
</a>
61+
</li>
62+
<li>
63+
<a href="userIndexes/userIndexes.html">
64+
Manipulate start and end indexes outside the directive
65+
</a>
66+
</li>
5767
<li>
5868
<a href="visibility/visibility.html">
5969
Visibility
@@ -104,7 +114,7 @@ <h1 class="page-header">Scroller Examples</h1>
104114
<div class="more-wrap">
105115
<a href="https://github.com/angular-ui/ui-scroll/">read more...</a>
106116
</div>
107-
117+
108118
</div>
109119
</body>
110120
</html>

demo/reload100/reload100.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Reload 100</title>
6+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
7+
<script src="../../dist/ui-scroll.js"></script>
8+
<script src="../../dist/ui-scroll-jqlite.js"></script>
9+
<script src="reload100.js"></script>
10+
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
11+
</head>
12+
<body ng-controller="mainController" ng-app="application">
13+
14+
<div class="cont cont-global">
15+
16+
<a class="back" href="../index.html">browse other examples</a>
17+
18+
<h1 class="page-header page-header-exapmle">Reload with parameter</h1>
19+
20+
<div class="description">
21+
Here we provide an ability to reload the datasource to some specified position.
22+
</div>
23+
24+
<div class="actions" ng-init="reloadIndex = 100">
25+
<input ng-model="reloadIndex" size="2"> - index to reload <br>
26+
<button ng-click="doReload(reloadIndex)"> Reload({{reloadIndex}}) </button>
27+
</div>
28+
29+
<div ng-if="delay" class="viewport" id="viewport-serviceDatasource" ui-scroll-viewport>
30+
<div class="item" ui-scroll="item in datasource" adapter="adapter">{{item}}</div>
31+
</div>
32+
33+
</div>
34+
35+
</body>
36+
</html>

demo/reload100/reload100.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
2+
.controller('mainController', [
3+
'$scope', '$log', '$timeout', function ($scope, console, $timeout) {
4+
var datasource = {};
5+
6+
datasource.get = function (index, count, success) {
7+
$timeout(function () {
8+
var result = [];
9+
for (var i = index; i <= index + count - 1; i++) {
10+
result.push("item #" + i);
11+
}
12+
success(result);
13+
}, 100);
14+
};
15+
16+
$scope.datasource = datasource;
17+
$scope.adapter = {};
18+
19+
$scope.doReload = function () {
20+
if (angular.isFunction($scope.adapter.reload)) {
21+
var reloadIndex = parseInt($scope.reloadIndex, 10);
22+
reloadIndex = isNaN(reloadIndex) ? 1 : reloadIndex;
23+
$scope.adapter.reload(reloadIndex);
24+
}
25+
};
26+
27+
$scope.delay = false;
28+
$timeout(function() {
29+
$scope.delay = true;
30+
}, 500);
31+
32+
}
33+
]);

demo/topVisible/topVisible.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h1 class="page-header page-header-exapmle">Top visible</h1>
3333
</div>
3434

3535
<div class="viewport" id="viewport-persistentScroll" ui-scroll-viewport>
36-
<div class="item" ui-scroll="item in datasource" top-visible="topVisible">{{$index}}: {{item}}</div>
36+
<div class="item" ui-scroll="item in datasource" buffer-size="40" top-visible="topVisible">{{$index}}: {{item}}</div>
3737
</div>
3838

3939
</div>

demo/userIndexes/userIndexes.html

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>User min and max indexes</title>
6+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
7+
<script src="../../dist/ui-scroll.js"></script>
8+
<script src="../../dist/ui-scroll-jqlite.js"></script>
9+
<script src="userIndexes.js"></script>
10+
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
11+
<style type="text/css">
12+
button {
13+
width: 180px;
14+
margin-bottom: 3px;
15+
margin-right: 7px;
16+
}
17+
</style>
18+
</head>
19+
<body ng-controller="mainController" ng-app="application">
20+
21+
<div class="cont cont-global">
22+
23+
<a class="back" href="../index.html">browse other examples</a>
24+
25+
<h1 class="page-header page-header-exapmle">Set user min and max indexes</h1>
26+
27+
<div class="description">
28+
Here we provide an ability of external min and max indexes setting to let the viewport know how many items do we have.
29+
</div>
30+
31+
<div class="actions" ng-init="userMinIndex = -100; userMaxIndex = 100">
32+
<button ng-click="setUserMinIndex()"> Set minIndex = {{userMinIndex}} </button>
33+
<input ng-model="userMinIndex" size="2"> minIndex value to set
34+
<br>
35+
<button ng-click="setUserMaxIndex()"> Set maxIndex = {{userMaxIndex}} </button>
36+
<input ng-model="userMaxIndex" size="2"> maxIndex value to set
37+
<br>
38+
<button ng-click="setUserIndexes()"> Set both Indexes </button>
39+
</div>
40+
41+
<div ng-if="delay" class="viewport" id="viewport-serviceDatasource" ui-scroll-viewport>
42+
<div class="item" ui-scroll="item in datasource" adapter="adapter">{{item}}</div>
43+
</div>
44+
45+
</div>
46+
47+
</body>
48+
</html>

demo/userIndexes/userIndexes.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
2+
.controller('mainController', [
3+
'$scope', '$log', '$timeout', function ($scope, console, $timeout) {
4+
var datasource = {};
5+
6+
datasource.get = function (index, count, success) {
7+
$timeout(function () {
8+
var result = [];
9+
for (var i = index; i <= index + count - 1; i++) {
10+
result.push("item #" + i);
11+
}
12+
success(result);
13+
}, 100);
14+
};
15+
16+
$scope.datasource = datasource;
17+
$scope.adapter = {};
18+
19+
$scope.setUserMinIndex = function () {
20+
var userMinIndex = parseInt($scope.userMinIndex, 10);
21+
if(!isNaN(userMinIndex))
22+
$scope.datasource.minIndex = userMinIndex;
23+
};
24+
25+
$scope.setUserMaxIndex = function () {
26+
var userMaxIndex = parseInt($scope.userMaxIndex, 10);
27+
if(!isNaN(userMaxIndex))
28+
$scope.datasource.maxIndex = userMaxIndex;
29+
};
30+
31+
$scope.setUserIndexes = function () {
32+
$scope.setUserMinIndex();
33+
$scope.setUserMaxIndex();
34+
};
35+
36+
$scope.delay = false;
37+
$timeout(function() {
38+
$scope.delay = true;
39+
}, 500);
40+
41+
}
42+
]);

dist/ui-scroll-jqlite.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-ui-scroll
33
* https://github.com/angular-ui/ui-scroll.git
4-
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
4+
* Version: 1.4.0 -- 2016-04-04T13:14:46.276Z
55
* License: MIT
66
*/
77

dist/ui-scroll-jqlite.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)