|
1 | 1 | /**
|
2 | 2 | * Contains the declaration for the {@link module:enyo/NewDataList~NewDataList} kind.
|
| 3 | +* |
3 | 4 | * @wip
|
| 5 | +* @public |
4 | 6 | * @module enyo/NewDataList
|
5 | 7 | */
|
6 | 8 |
|
|
15 | 17 | VirtualDataRepeater = require('./VirtualDataRepeater');
|
16 | 18 |
|
17 | 19 | /**
|
18 |
| -* {@link module:enyo/NewDataList~NewDataList} is a work-in-progress |
| 20 | +* {@link module:enyo/NewDataList~NewDataList} is new virtual list implementation. |
| 21 | +* |
| 22 | +* It is intended to replace the older {@link module:enyo/DataList~DataList}, |
| 23 | +* {@link module:enyo/DataGridList~DataGridList} and probably |
| 24 | +* {@link module:layout/List~List}, but as of the Enyo 2.7 release is a work in |
| 25 | +* progress and currently lacks many of the features of those older implementations. |
| 26 | +* |
| 27 | +* The most significant difference between `NewDataList` and `DataList` / `DataGridList` |
| 28 | +* is that `NewDataList` "virtualizes" items one at a time, not a page at a time. This |
| 29 | +* approach performs somewhat better in general and most notably disributes the cost of |
| 30 | +* virtualization over time, which produces smoother frame rates. |
| 31 | +* |
| 32 | +* `NewDataList` supports both linear and grid layouts, in either horizontal or |
| 33 | +* vertical direction. |
| 34 | +* |
| 35 | +* Notes: |
| 36 | +* * List items must be styled with `position: absolute` to be laid out properly, |
| 37 | +* but `NewDataList` does not currently provide any default style rules for items, |
| 38 | +* so you need to specify `position: absolute` in your items' classes or style attributes. |
| 39 | +* * `NewDataList` currently supports only explicitly sized items; neither variable-size |
| 40 | +* items nor "naturally" sized items are currently supported. |
19 | 41 | *
|
20 | 42 | * @class NewDataList
|
21 | 43 | * @extends module:enyo/VirtualDataRepeater~VirtualDataRepeater
|
22 | 44 | * @wip
|
23 | 45 | * @ui
|
| 46 | +* @public |
24 | 47 | */
|
25 | 48 | module.exports = kind(
|
26 | 49 | /** @lends module:enyo/NewDataList~NewDataList.prototype */ {
|
27 | 50 | name: 'enyo.NewDataList',
|
28 | 51 | kind: VirtualDataRepeater,
|
| 52 | + /** |
| 53 | + * The direction of the layout, which may be either `'vertical'` |
| 54 | + * or `'horizontal'`. |
| 55 | + * |
| 56 | + * @type {String} |
| 57 | + * @default 'vertical' |
| 58 | + * @public |
| 59 | + */ |
29 | 60 | direction: 'vertical',
|
| 61 | + /** |
| 62 | + * The height of each list item, in pixels. |
| 63 | + * |
| 64 | + * Required for grid layouts and linear vertical layouts; may be |
| 65 | + * omitted for linear horizontal layouts. |
| 66 | + * |
| 67 | + * @type {Number} |
| 68 | + * @default 100 |
| 69 | + * @public |
| 70 | + */ |
30 | 71 | itemHeight: 100,
|
| 72 | + /** |
| 73 | + * The width of each list item, in pixels. |
| 74 | + * |
| 75 | + * Required for grid layouts and linear horizontal layouts; may be |
| 76 | + * omitted for linear vertical layouts. |
| 77 | + * |
| 78 | + * @type {Number} |
| 79 | + * @default 100 |
| 80 | + * @public |
| 81 | + */ |
31 | 82 | itemWidth: 100,
|
| 83 | + /** |
| 84 | + * The space between list items, in pixels. |
| 85 | + * |
| 86 | + * @type {Number} |
| 87 | + * @default 0 |
| 88 | + * @public |
| 89 | + */ |
32 | 90 | spacing: 0,
|
| 91 | + /** |
| 92 | + * The number of rows (only applies to horizontally scrolling grid layouts). |
| 93 | + * |
| 94 | + * To specify a horizontally scrolling grid layout, set `rows` to `2` or more |
| 95 | + * and `direction` to `horizontal`. |
| 96 | + * |
| 97 | + * @type {Number} |
| 98 | + * @default 'auto' |
| 99 | + * @public |
| 100 | + */ |
33 | 101 | rows: 'auto',
|
| 102 | + /** |
| 103 | + * The number of columns (only applies to vertically scrolling grid layouts). |
| 104 | + * |
| 105 | + * To specify a vertically scrolling grid layout, set `columns` to `2` or more |
| 106 | + * and `direction` to `vertical`. |
| 107 | + * |
| 108 | + * @type {Number} |
| 109 | + * @default 'auto' |
| 110 | + * @public |
| 111 | + */ |
34 | 112 | columns: 'auto',
|
| 113 | + /** |
| 114 | + * This number determines how many "extra" items the list will generate, beyond |
| 115 | + * the number required to fill the list's viewport. Higher numbers result in more |
| 116 | + * extra items being generated. |
| 117 | + * |
| 118 | + * You should generally not need to adjust this value. |
| 119 | + * |
| 120 | + * @type {Number} |
| 121 | + * @default 3 |
| 122 | + * @public |
| 123 | + */ |
35 | 124 | overhang: 3,
|
36 |
| - // Experimental |
| 125 | + /** |
| 126 | + * This feature is experimental, and only partly functional. |
| 127 | + * |
| 128 | + * When `scrollToBoundaries` is set to `true`, the list will come to rest on an |
| 129 | + * item boundary, such that the first visible item is fully within the list's |
| 130 | + * viewport, not partially outside. |
| 131 | + * |
| 132 | + * Important limitation: this feature currently only works when scrolling in |
| 133 | + * response to wheel events or when scrolling to explicitly provided coordinates; |
| 134 | + * it does not work when scrolling in response to touch or mouse events. |
| 135 | + * |
| 136 | + * @type {Boolean} |
| 137 | + * @default false |
| 138 | + * @public |
| 139 | + */ |
37 | 140 | scrollToBoundaries: false,
|
| 141 | + /** |
| 142 | + * @private |
| 143 | + */ |
38 | 144 | mixins: [Scrollable],
|
| 145 | + /** |
| 146 | + * @private |
| 147 | + */ |
39 | 148 | observers: [
|
40 | 149 | {method: 'reset', path: [
|
41 | 150 | 'direction', 'columns', 'rows',
|
|
0 commit comments