Skip to content

Commit a220cee

Browse files
committed
padding module
1 parent b688de5 commit a220cee

File tree

7 files changed

+110
-111
lines changed

7 files changed

+110
-111
lines changed

dist/ui-scroll-jqlite.js

Lines changed: 1 addition & 1 deletion
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.1 -- 2016-04-18T20:39:03.966Z
4+
* Version: 1.4.1 -- 2016-04-18T22:35:24.296Z
55
* License: MIT
66
*/
77

dist/ui-scroll-jqlite.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll.js

Lines changed: 60 additions & 61 deletions
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.1 -- 2016-04-18T20:39:03.966Z
4+
* Version: 1.4.1 -- 2016-04-18T22:35:24.296Z
55
* License: MIT
66
*/
77

@@ -226,38 +226,6 @@ module.exports = exports['default'];
226226
},{}],3:[function(require,module,exports){
227227
'use strict';
228228

229-
exports.__esModule = true;
230-
exports['default'] = Cache;
231-
232-
function Cache() {
233-
var cache = Object.create(Array.prototype);
234-
235-
angular.extend(cache, {
236-
add: function add(item) {
237-
for (var i = cache.length - 1; i >= 0; i--) {
238-
if (cache[i].index === item.scope.$index) {
239-
cache[i].height = item.element.outerHeight();
240-
return;
241-
}
242-
}
243-
cache.push({
244-
index: item.scope.$index,
245-
height: item.element.outerHeight()
246-
});
247-
},
248-
clear: function clear() {
249-
cache.length = 0;
250-
}
251-
});
252-
253-
return cache;
254-
}
255-
256-
module.exports = exports['default'];
257-
258-
},{}],4:[function(require,module,exports){
259-
'use strict';
260-
261229
exports.__esModule = true;
262230

263231
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
@@ -342,6 +310,59 @@ var ElementRoutines = (function () {
342310
exports['default'] = ElementRoutines;
343311
module.exports = exports['default'];
344312

313+
},{}],4:[function(require,module,exports){
314+
'use strict';
315+
316+
exports.__esModule = true;
317+
exports['default'] = Padding;
318+
function Cache() {
319+
var cache = Object.create(Array.prototype);
320+
321+
angular.extend(cache, {
322+
add: function add(item) {
323+
for (var i = cache.length - 1; i >= 0; i--) {
324+
if (cache[i].index === item.scope.$index) {
325+
cache[i].height = item.element.outerHeight();
326+
return;
327+
}
328+
}
329+
cache.push({
330+
index: item.scope.$index,
331+
height: item.element.outerHeight()
332+
});
333+
},
334+
clear: function clear() {
335+
cache.length = 0;
336+
}
337+
});
338+
339+
return cache;
340+
}
341+
342+
function Padding(template) {
343+
var result = undefined;
344+
345+
switch (template.tagName) {
346+
case 'dl':
347+
throw new Error('ui-scroll directive does not support <' + template.tagName + '> as a repeating tag: ' + template.outerHTML);
348+
case 'tr':
349+
var table = angular.element('<table><tr><td><div></div></td></tr></table>');
350+
result = table.find('tr');
351+
break;
352+
case 'li':
353+
result = angular.element('<li></li>');
354+
break;
355+
default:
356+
result = angular.element('<div></div>');
357+
}
358+
359+
result.cache = new Cache();
360+
361+
return result;
362+
}
363+
364+
module.exports = exports['default'];
365+
345366
},{}],5:[function(require,module,exports){
346367
'use strict';
347368

@@ -350,9 +371,9 @@ exports['default'] = Viewport;
350371

351372
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
352373

353-
var _cache = require('./cache');
374+
var _padding = require('./padding');
354375

355-
var _cache2 = _interopRequireDefault(_cache);
376+
var _padding2 = _interopRequireDefault(_padding);
356377

357378
function Viewport(elementRoutines, buffer, element, controllers, attrs) {
358379
var PADDING_MIN = 0.3;
@@ -366,36 +387,14 @@ function Viewport(elementRoutines, buffer, element, controllers, attrs) {
366387
'display': 'block'
367388
});
368389

369-
function Padding(template) {
370-
var result = undefined;
371-
372-
switch (template.tagName) {
373-
case 'dl':
374-
throw new Error('ui-scroll directive does not support <' + template.tagName + '> as a repeating tag: ' + template.outerHTML);
375-
case 'tr':
376-
var table = angular.element('<table><tr><td><div></div></td></tr></table>');
377-
result = table.find('tr');
378-
break;
379-
case 'li':
380-
result = angular.element('<li></li>');
381-
break;
382-
default:
383-
result = angular.element('<div></div>');
384-
}
385-
386-
result.cache = new _cache2['default']();
387-
388-
return result;
389-
}
390-
391390
function bufferPadding() {
392391
return viewport.outerHeight() * Math.max(PADDING_MIN, +attrs.padding || PADDING_DEFAULT); // some extra space to initiate preload
393392
}
394393

395394
angular.extend(viewport, {
396395
createPaddingElements: function createPaddingElements(template) {
397-
topPadding = new Padding(template);
398-
bottomPadding = new Padding(template);
396+
topPadding = new _padding2['default'](template);
397+
bottomPadding = new _padding2['default'](template);
399398
element.before(topPadding);
400399
element.after(bottomPadding);
401400
},
@@ -565,7 +564,7 @@ function Viewport(elementRoutines, buffer, element, controllers, attrs) {
565564

566565
module.exports = exports['default'];
567566

568-
},{'./cache':3}],6:[function(require,module,exports){
567+
},{'./padding':4}],6:[function(require,module,exports){
569568
/*!
570569
globals: angular, window
571570
List of used element methods available in JQuery but not in JQuery Lite
@@ -1012,5 +1011,5 @@ angular.module('ui.scroll', []).directive('uiScrollViewport', function () {
10121011
}
10131012
}]);
10141013

1015-
},{'./modules/adapter.js':1,'./modules/buffer.js':2,'./modules/elementRoutines.js':4,'./modules/viewport.js':5}]},{},[6]);
1014+
},{'./modules/adapter.js':1,'./modules/buffer.js':2,'./modules/elementRoutines.js':3,'./modules/viewport.js':5}]},{},[6]);
10161015
}());

0 commit comments

Comments
 (0)