-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathAlphaJumpList.js
95 lines (85 loc) · 1.8 KB
/
AlphaJumpList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Contains the declaration for the {@link module:layout/AlphaJumpList~AlphaJumpList} kind.
* @module layout/AlphaJumpList
*/
var
kind = require('enyo/kind');
var
AlphaJumper = require('./AlphaJumper'),
List = require('./List');
/**
* {@link module:layout/AlphaJumpList~AlphaJumpList} is a
* {@link module:layout/List~List} that features an alphabetical panel from which
* a selection may be made. Actions are performed based on the item that is
* selected.
*
* ```javascript
* var
* kind = require('enyo/kind'),
* AlphaJumpList = require('layout/AlphaJumpList'),
* Item = require('onyx/Item');
*
* {kind: AlphaJumpList, onSetupItem: 'setupItem',
* onAlphaJump: 'alphaJump',
* components: [
* {name: 'divider'},
* {kind: Item}
* ]
* }
* ```
*
* @ui
* @class AlphaJumpList
* @extends module:layout/List~List
* @public
*/
module.exports = kind(
/** @lends module:layout/AlphaJumpList~AlphaJumpList.prototype */ {
/**
* @private
*/
name: 'enyo.AlphaJumpList',
/**
* @private
*/
kind: List,
/**
* @private
*/
scrollTools: [
{name: 'jumper', kind: AlphaJumper}
],
/**
* @method
* @private
*/
initComponents: function () {
this.createChrome(this.scrollTools);
List.prototype.initComponents.apply(this, arguments);
},
/**
* @method
* @private
*/
rendered: function () {
List.prototype.rendered.apply(this, arguments);
this.centerJumper();
},
/**
* @method
* @private
*/
handleResize: function () {
List.prototype.handleResize.apply(this, arguments);
this.centerJumper();
},
/**
* Vertically centers the {@link module:layout/AlphaJumper~AlphaJumper} control within the scroller.
*
* @private
*/
centerJumper: function () {
var b = this.getBounds(), sb = this.$.jumper.getBounds();
this.$.jumper.applyStyle('top', ((b.height - sb.height) / 2) + 'px');
}
});