sproutcore 1.5.0.rc.1 → 1.5.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/Buildfile +9 -4
  4. data/lib/frameworks/sproutcore/README.md +1 -0
  5. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
  6. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
  7. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
  8. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
  9. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
  10. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
  11. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
  12. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
  13. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
  14. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
  15. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
  16. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
  17. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
  18. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
  19. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
  20. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
  21. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
  22. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
  23. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
  24. data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
  25. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
  28. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
  29. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
  30. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
  31. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
  32. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
  60. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
  61. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
  62. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
  63. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
  64. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
  65. data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
  66. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
  67. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
  68. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
  69. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
  70. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
  71. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
  72. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
  73. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
  74. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
  75. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
  76. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
  77. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
  78. data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
  79. data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
  80. data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
  82. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
  83. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
  84. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
  85. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
  86. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
  87. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
  88. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
  89. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
  90. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
  91. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
  92. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
  93. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
  94. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
  95. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
  96. data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
  97. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
  98. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
  99. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
  100. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
  101. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
  102. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
  103. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
  104. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
  105. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
  106. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
  107. data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
  108. data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
  109. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
  110. data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
  111. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
  112. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
  113. data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
  114. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
  115. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
  116. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
  117. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
  118. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
  119. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
  120. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
  121. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
  122. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
  123. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
  124. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
  125. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
  126. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
  127. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
  128. data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
  129. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
  130. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
  131. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
  132. data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
  133. data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
  134. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
  135. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
  136. data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
  137. data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
  138. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
  139. data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
  140. data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
  141. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
  142. data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
  143. data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
  144. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
  145. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
  146. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
  147. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
  148. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
  149. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
  150. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
  151. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
  152. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
  153. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
  154. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
  155. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
  156. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
  157. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
  158. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
  159. data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
  160. data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
  161. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
  162. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
  163. data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
  164. data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
  165. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
  166. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
  167. data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
  168. data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
  169. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
  170. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
  171. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
  172. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
  173. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
  174. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
  175. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
  176. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
  177. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
  178. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
  179. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
  180. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
  181. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  182. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
  183. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
  184. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
  185. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
  186. data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
  187. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
  188. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
  189. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
  190. data/vendor/chance/lib/chance/instance.rb +8 -6
  191. metadata +41 -31
  192. data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
  193. data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -18,13 +18,13 @@ sc_require('mixins/collection_row_delegate');
18
18
  also should provide a default rowHeight. Setting this value will allow
19
19
  the ListView to optimize its rendering.
20
20
 
21
- h2. Variable Row Heights
21
+ ## Variable Row Heights
22
22
 
23
23
  Normally you set the row height through the rowHeight property. You can
24
24
  also support custom row heights by implementing the
25
25
  contentCustomRowHeightIndexes property to return an index set.
26
26
 
27
- h2. Using ListView with Very Large Data Sets
27
+ ## Using ListView with Very Large Data Sets
28
28
 
29
29
  ListView implements incremental rendering, which means it will only render
30
30
  HTML for the items that are current visible on the screen. You can use it
@@ -54,44 +54,58 @@ sc_require('mixins/collection_row_delegate');
54
54
  @extends SC.CollectionRowDelegate
55
55
  @since SproutCore 1.0
56
56
  */
57
- SC.ListView = SC.CollectionView.extend(
58
- SC.CollectionRowDelegate,
57
+ SC.ListView = SC.CollectionView.extend(SC.CollectionRowDelegate,
59
58
  /** @scope SC.ListView.prototype */ {
60
-
59
+
60
+ /**
61
+ @type Array
62
+ @default ['sc-list-view']
63
+ @see SC.View#classNames
64
+ */
61
65
  classNames: ['sc-list-view'],
62
66
 
67
+ /**
68
+ @type Boolean
69
+ @default YES
70
+ */
63
71
  acceptsFirstResponder: YES,
64
72
 
65
73
  /**
66
- * If set to YES, the default theme will show alternating rows
67
- * for the views this ListView created through exampleView property.
68
- *
69
- * @property {Boolean}
74
+ If set to YES, the default theme will show alternating rows
75
+ for the views this ListView created through exampleView property.
76
+
77
+ @type Boolean
78
+ @default NO
70
79
  */
71
80
  showAlternatingRows: NO,
72
81
 
82
+
73
83
  // ..........................................................
74
84
  // METHODS
75
85
  //
76
86
 
87
+ /** @private */
77
88
  render: function(context, firstTime) {
78
89
  context.setClass('alternating', this.get('showAlternatingRows'));
79
90
 
80
91
  return sc_super();
81
92
  },
82
93
 
94
+
83
95
  // ..........................................................
84
96
  // COLLECTION ROW DELEGATE SUPPORT
85
97
  //
86
98
 
87
-
88
99
  /**
89
- Returns the current collectionRowDelegate. This property will recompute
90
- everytime the content changes.
100
+ @field
101
+ @type Object
102
+ @observes 'delegate'
103
+ @observes 'content'
91
104
  */
92
105
  rowDelegate: function() {
93
- var del = this.delegate,
106
+ var del = this.delegate,
94
107
  content = this.get('content');
108
+
95
109
  return this.delegateFor('isCollectionRowDelegate', del, content);
96
110
  }.property('delegate', 'content').cacheable(),
97
111
 
@@ -187,6 +201,7 @@ SC.ListView = SC.CollectionView.extend(
187
201
  return this ;
188
202
  },
189
203
 
204
+
190
205
  // ..........................................................
191
206
  // ROW PROPERTIES
192
207
  //
@@ -289,7 +304,7 @@ SC.ListView = SC.CollectionView.extend(
289
304
  @returns {SC.ListView} receiver
290
305
  */
291
306
  rowHeightDidChangeForIndexes: function(indexes) {
292
- var len = this.get('length');
307
+ var len = this.get('length');
293
308
 
294
309
  // clear any cached offsets
295
310
  this._sclv_heightCache = this._sclv_offsetCache = null;
@@ -318,19 +333,20 @@ SC.ListView = SC.CollectionView.extend(
318
333
  },
319
334
 
320
335
  /**
321
-
322
336
  Computes the layout for a specific content index by combining the current
323
337
  row heights.
324
-
338
+
339
+ @param {Number} contentIndex
340
+ @returns {Hash} layout hash for the index provided
325
341
  */
326
342
  layoutForContentIndex: function(contentIndex) {
327
343
  var del = this.get('rowDelegate');
328
344
 
329
345
  return {
330
- top: this.rowOffsetForContentIndex(contentIndex),
346
+ top: this.rowOffsetForContentIndex(contentIndex),
331
347
  height: this.rowHeightForContentIndex(contentIndex) - del.get('rowPadding') * 2,
332
- left: 0,
333
- right: 0
348
+ left: 0,
349
+ right: 0
334
350
  };
335
351
  },
336
352
 
@@ -412,31 +428,32 @@ SC.ListView = SC.CollectionView.extend(
412
428
  return SC.IndexSet.create(start, end-start);
413
429
  },
414
430
 
431
+
415
432
  // ..........................................................
416
433
  // DRAG AND ROP SUPPORT
417
434
  //
418
435
 
419
-
420
436
  /**
421
437
  Default view class used to draw an insertion point. The default
422
438
  view will show a vertical line. Any view you create
423
439
  should expect an outlineLevel property set, which should impact your left
424
440
  offset.
425
441
 
426
- @property
427
- @type {SC.View}
442
+ @field
443
+ @type SC.View
428
444
  */
429
445
  insertionPointView: SC.View.extend({
430
446
  classNames: 'sc-list-insertion-point',
431
447
 
448
+ /** @private */
432
449
  render: function(context, firstTime) {
433
450
  if (firstTime) context.push('<div class="anchor"></div>');
434
451
  }
435
-
436
452
  }),
437
453
 
438
454
  /**
439
455
  Default implementation will show an insertion point
456
+ @see SC.CollectionView#showInsertionPoint
440
457
  */
441
458
  showInsertionPoint: function(itemView, dropOperation) {
442
459
  var view = this._insertionPointView;
@@ -488,6 +505,9 @@ SC.ListView = SC.CollectionView.extend(
488
505
  }
489
506
  },
490
507
 
508
+ /**
509
+ @see SC.CollectionView#hideInsertionPoint
510
+ */
491
511
  hideInsertionPoint: function() {
492
512
  if (this._lastDropOnView) {
493
513
  this._lastDropOnView.set('isSelected', NO);
@@ -504,15 +524,15 @@ SC.ListView = SC.CollectionView.extend(
504
524
  a point, relative to the top/left corner of the receiver view. The return
505
525
  value is an index plus a dropOperation, which is computed as such:
506
526
 
507
- - if outlining is not used and you are within 5px of an edge, DROP_BEFORE
508
- the item after the edge.
509
-
510
- - if outlining is used and you are within 5px of an edge and the previous
511
- item has a different outline level then the next item, then DROP_AFTER
512
- the previous item if you are closer to that outline level.
513
-
514
- - if dropOperation = SC.DROP_ON and you are over the middle of a row, then
515
- use DROP_ON.
527
+ - if outlining is not used and you are within 5px of an edge, DROP_BEFORE
528
+ the item after the edge.
529
+ - if outlining is used and you are within 5px of an edge and the previous
530
+ item has a different outline level then the next item, then DROP_AFTER
531
+ the previous item if you are closer to that outline level.
532
+ - if dropOperation = SC.DROP_ON and you are over the middle of a row, then
533
+ use DROP_ON.
534
+
535
+ @see SC.CollectionView.insertionIndexForLocation
516
536
  */
517
537
  insertionIndexForLocation: function(loc, dropOperation) {
518
538
  var locRect = {x:loc.x, y:loc.y, width:1, height:1},
@@ -546,8 +566,6 @@ SC.ListView = SC.CollectionView.extend(
546
566
  }
547
567
  }
548
568
 
549
-
550
-
551
569
  // ok, now if we are in last 10px, go to next item.
552
570
  if ((index<len) && (loc.y >= max-10)) index++;
553
571
 
@@ -613,6 +631,7 @@ SC.ListView = SC.CollectionView.extend(
613
631
  return [index, dropOperation];
614
632
  },
615
633
 
634
+ /** @private */
616
635
  mouseWheel: function(evt) {
617
636
  // The following commits changes in a list item that is being edited,
618
637
  // if the list is scrolled.
@@ -629,6 +648,7 @@ SC.ListView = SC.CollectionView.extend(
629
648
  // INTERNAL SUPPORT
630
649
  //
631
650
 
651
+ /** @private */
632
652
  init: function() {
633
653
  sc_super();
634
654
  this._sclv_rowDelegateDidChange();
@@ -6,8 +6,22 @@
6
6
  // ==========================================================================
7
7
 
8
8
 
9
+ /**
10
+ @static
11
+ @constant
12
+ */
9
13
  SC.LIST_ITEM_ACTION_CANCEL = 'sc-list-item-cancel-action';
14
+
15
+ /**
16
+ @static
17
+ @constant
18
+ */
10
19
  SC.LIST_ITEM_ACTION_REFRESH = 'sc-list-item-cancel-refresh';
20
+
21
+ /**
22
+ @static
23
+ @constant
24
+ */
11
25
  SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
12
26
 
13
27
  /**
@@ -27,20 +41,24 @@ SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
27
41
  @extends SC.StaticLayout
28
42
  @since SproutCore 1.0
29
43
  */
30
- SC.ListItemView = SC.View.extend(
31
- SC.InlineEditable,
32
- SC.Control,
44
+ SC.ListItemView = SC.View.extend(SC.InlineEditable, SC.Control,
33
45
  /** @scope SC.ListItemView.prototype */ {
34
46
 
47
+ /**
48
+ @type Array
49
+ @default ['sc-list-item-view']
50
+ @see SC.View#classNames
51
+ */
35
52
  classNames: ['sc-list-item-view'],
36
53
 
54
+ /**
55
+ @type Array
56
+ @default ['disclosureState', 'escapeHTML']
57
+ @see SC.View#displayProperties
58
+ */
37
59
  displayProperties: ['disclosureState', 'escapeHTML'],
38
60
 
39
61
 
40
- init: function() {
41
- sc_super();
42
- },
43
-
44
62
  // ..........................................................
45
63
  // KEY PROPERTIES
46
64
  //
@@ -49,6 +67,7 @@ SC.ListItemView = SC.View.extend(
49
67
  The content object the list item will display.
50
68
 
51
69
  @type SC.Object
70
+ @default null
52
71
  */
53
72
  content: null,
54
73
 
@@ -60,7 +79,8 @@ SC.ListItemView = SC.View.extend(
60
79
  in a ListView, this property would be 0.
61
80
 
62
81
  @type Number
63
- @isReadOnly
82
+ @default null
83
+ @readOnly
64
84
  */
65
85
  contentIndex: null,
66
86
 
@@ -69,6 +89,9 @@ SC.ListItemView = SC.View.extend(
69
89
 
70
90
  If false, the icon on the list item view will be hidden. Otherwise,
71
91
  space will be left for the icon next to the list item view.
92
+
93
+ @type Boolean
94
+ @default NO
72
95
  */
73
96
  hasContentIcon: NO,
74
97
 
@@ -77,6 +100,9 @@ SC.ListItemView = SC.View.extend(
77
100
 
78
101
  If false, the icon on the list item view will be hidden. Otherwise,
79
102
  space will be left for the icon next to the list item view.
103
+
104
+ @type Boolean
105
+ @default NO
80
106
  */
81
107
  hasContentRightIcon: NO,
82
108
 
@@ -85,6 +111,9 @@ SC.ListItemView = SC.View.extend(
85
111
  arrow.
86
112
 
87
113
  If false, the space for the branch arrow will be collapsed.
114
+
115
+ @type Boolean
116
+ @default NO
88
117
  */
89
118
  hasContentBranch: NO,
90
119
 
@@ -93,13 +122,17 @@ SC.ListItemView = SC.View.extend(
93
122
 
94
123
  The checkbox will only be visible if this key is not null.
95
124
 
96
- @type {String}
125
+ @type String
126
+ @default null
97
127
  */
98
128
  contentCheckboxKey: null,
99
129
 
100
130
  /**
101
131
  The URL or CSS class name to use for the icon. This is only used if
102
132
  contentIconKey is null, or returns null from the delegate.
133
+
134
+ @type String
135
+ @default null
103
136
  */
104
137
  icon: null,
105
138
 
@@ -108,12 +141,18 @@ SC.ListItemView = SC.View.extend(
108
141
 
109
142
  This property will be checked on the content object to determine the
110
143
  icon to display. It must return either a URL or a CSS class name.
144
+
145
+ @type String
146
+ @default NO
111
147
  */
112
148
  contentIconKey: null,
113
149
 
114
150
  /**
115
151
  The URL or CSS class name to use for the right icon. This is only used if
116
152
  contentRightIconKey is null, or returns null from the delegate.
153
+
154
+ @type String
155
+ @default null
117
156
  */
118
157
  rightIcon: null,
119
158
 
@@ -122,6 +161,9 @@ SC.ListItemView = SC.View.extend(
122
161
 
123
162
  This property will be checked on the content object to determine the
124
163
  icon to display. It must return either a URL or a CSS class name.
164
+
165
+ @type String
166
+ @default null
125
167
  */
126
168
  contentRightIconKey: null,
127
169
 
@@ -129,6 +171,9 @@ SC.ListItemView = SC.View.extend(
129
171
  (displayDelegate) The name of the property used for label itself
130
172
 
131
173
  If null, then the content object itself will be used..
174
+
175
+ @type String
176
+ @default null
132
177
  */
133
178
  contentValueKey: null,
134
179
 
@@ -137,6 +182,9 @@ SC.ListItemView = SC.View.extend(
137
182
  You should only disable this option if you are sure you will only
138
183
  display content that is already escaped and you need the added
139
184
  performance gain.
185
+
186
+ @type Boolean
187
+ @default YES
140
188
  */
141
189
  escapeHTML: YES,
142
190
 
@@ -146,6 +194,9 @@ SC.ListItemView = SC.View.extend(
146
194
 
147
195
  The count will only be visible if this property is not null and the
148
196
  returned value is not 0.
197
+
198
+ @type String
199
+ @default null
149
200
  */
150
201
  contentUnreadCountKey: null,
151
202
 
@@ -156,6 +207,9 @@ SC.ListItemView = SC.View.extend(
156
207
 
157
208
  If this is null, then the branch view will be completely hidden.
158
209
  Otherwise space will be allocated for it.
210
+
211
+ @type String
212
+ @default null
159
213
  */
160
214
  contentIsBranchKey: null,
161
215
 
@@ -163,17 +217,30 @@ SC.ListItemView = SC.View.extend(
163
217
  Indent to use when rendering a list item with an outline level > 0. The
164
218
  left edge of the list item will be indented by this amount for each
165
219
  outline level.
220
+
221
+ @type Number
222
+ @default 16
166
223
  */
167
224
  outlineIndent: 16,
168
225
 
169
226
  /**
170
227
  Outline level for this list item. Usually set by the collection view.
228
+
229
+ @type Number
230
+ @default 0
171
231
  */
172
232
  outlineLevel: 0,
173
233
 
174
234
  /**
175
235
  Disclosure state for this list item. Usually set by the collection view
176
- when the list item is created.
236
+ when the list item is created. Possible values:
237
+
238
+ - SC.LEAF_NODE
239
+ - SC.BRANCH_OPEN
240
+ - SC.BRANCH_CLOSED
241
+
242
+ @type String
243
+ @default SC.LEAF_NODE
177
244
  */
178
245
  disclosureState: SC.LEAF_NODE,
179
246
 
@@ -183,6 +250,7 @@ SC.ListItemView = SC.View.extend(
183
250
  */
184
251
  validator: null,
185
252
 
253
+ /** @private */
186
254
  contentPropertyDidChange: function() {
187
255
  //if (this.get('isEditing')) this.discardEditing() ;
188
256
  if (this.get('contentIsEditable') !== this.contentIsEditable()) {
@@ -193,14 +261,22 @@ SC.ListItemView = SC.View.extend(
193
261
  },
194
262
 
195
263
  /**
196
- Determines if content is editable or not. Checkboxes and other related
264
+ Determines if content is editable or not. Checkboxes and other related
197
265
  components will render disabled if an item is not editable.
266
+
267
+ @field
268
+ @type Boolean
269
+ @observes content
198
270
  */
199
271
  contentIsEditable: function() {
200
272
  var content = this.get('content');
201
273
  return content && (content.get ? content.get('isEditable')!==NO : NO);
202
274
  }.property('content').cacheable(),
203
275
 
276
+ /**
277
+ @type Object
278
+ @default SC.InlineTextFieldDelegate
279
+ */
204
280
  inlineEditorDelegate: SC.InlineTextFieldDelegate,
205
281
 
206
282
  /**
@@ -209,25 +285,13 @@ SC.ListItemView = SC.View.extend(
209
285
  selecting any label elements. If you override renderLabel() you
210
286
  probably need to override this as well.
211
287
 
212
- @returns {SC.CoreQuery} CQ object selecting label elements
288
+ @returns {jQuery} jQuery object selecting label elements
213
289
  */
214
290
  $label: function() {
215
- return this.$('label') ;
291
+ return this.$('label');
216
292
  },
217
293
 
218
- /**
219
- Generates the html string used to represent the action item for your
220
- list item. override this to return your own custom HTML
221
-
222
- @param {SC.RenderContext} context the render context
223
- @param {String} actionClassName the name of the action item
224
- @returns {void}
225
- */
226
- renderAction: function(context, actionClassName){
227
- context.push('<img src="',SC.BLANK_IMAGE_URL,'" class="action" />');
228
- },
229
-
230
- /**
294
+ /** @private
231
295
  Determines if the event occured inside an element with the specified
232
296
  classname or not.
233
297
  */
@@ -275,11 +339,10 @@ SC.ListItemView = SC.View.extend(
275
339
  },
276
340
 
277
341
  /** @private
278
- mouseDown is handled only for clicks on the checkbox view or or action
279
- button.
342
+ mouseDown is handled only for clicks on the checkbox view or or action
343
+ button.
280
344
  */
281
345
  mouseDown: function(evt) {
282
-
283
346
  // if content is not editable, then always let collection view handle the
284
347
  // event.
285
348
  if (!this.get('contentIsEditable')) return NO ;
@@ -306,6 +369,7 @@ SC.ListItemView = SC.View.extend(
306
369
  return NO ; // let the collection view handle this event
307
370
  },
308
371
 
372
+ /** @private */
309
373
  mouseUp: function(evt) {
310
374
  var ret= NO, del, checkboxKey, content, state, idx, set;
311
375
 
@@ -366,6 +430,7 @@ SC.ListItemView = SC.View.extend(
366
430
  return ret ;
367
431
  },
368
432
 
433
+ /** @private */
369
434
  mouseMoved: function(evt) {
370
435
  if (this._isMouseDownOnCheckbox && this._isInsideCheckbox(evt)) {
371
436
  this._addCheckboxActiveState() ;
@@ -389,23 +454,28 @@ SC.ListItemView = SC.View.extend(
389
454
  return NO ;
390
455
  },
391
456
 
457
+ /** @private */
392
458
  touchStart: function(evt){
393
459
  return this.mouseDown(evt);
394
460
  },
395
461
 
462
+ /** @private */
396
463
  touchEnd: function(evt){
397
464
  return this.mouseUp(evt);
398
465
  },
399
466
 
467
+ /** @private */
400
468
  touchEntered: function(evt){
401
469
  return this.mouseEntered(evt);
402
470
  },
403
471
 
472
+ /** @private */
404
473
  touchExited: function(evt){
405
474
  return this.mouseExited(evt);
406
475
  },
407
476
 
408
477
 
478
+ /** @private */
409
479
  _addCheckboxActiveState: function() {
410
480
  if (this.get('isEnabled')) {
411
481
  if (this._checkboxRenderDelegate) {
@@ -421,6 +491,7 @@ SC.ListItemView = SC.View.extend(
421
491
  }
422
492
  },
423
493
 
494
+ /** @private */
424
495
  _removeCheckboxActiveState: function() {
425
496
  if (this._checkboxRenderer) {
426
497
  var source = this._checkboxRenderSource;
@@ -434,6 +505,7 @@ SC.ListItemView = SC.View.extend(
434
505
  }
435
506
  },
436
507
 
508
+ /** @private */
437
509
  _addDisclosureActiveState: function() {
438
510
  if (this.get('isEnabled')) {
439
511
  if (this._disclosureRenderDelegate) {
@@ -449,6 +521,7 @@ SC.ListItemView = SC.View.extend(
449
521
  }
450
522
  },
451
523
 
524
+ /** @private */
452
525
  _removeDisclosureActiveState: function() {
453
526
  if (this._disclosureRenderer) {
454
527
  var source = this._disclosureRenderSource;
@@ -461,15 +534,17 @@ SC.ListItemView = SC.View.extend(
461
534
  }
462
535
  },
463
536
 
537
+ /** @private */
464
538
  _addRightIconActiveState: function() {
465
539
  this.$('img.right-icon').setClass('active', YES);
466
540
  },
467
541
 
542
+ /** @private */
468
543
  _removeRightIconActiveState: function() {
469
544
  this.$('img.right-icon').removeClass('active');
470
545
  },
471
546
 
472
- /**
547
+ /** @private
473
548
  Returns true if a click is on the label text itself to enable editing.
474
549
 
475
550
  Note that if you override renderLabel(), you probably need to override
@@ -499,14 +574,12 @@ SC.ListItemView = SC.View.extend(
499
574
  },
500
575
 
501
576
  /*
502
- * @method
503
- *
504
- * Edits the label portion of the list item. If scrollIfNeeded is YES, will
505
- * scroll to the item before editing it.
506
- *
507
- * @params {Boolean} if the parent scroll view should be scrolled to this item
508
- * before editing begins
509
- * @returns {Boolean} YES if successful
577
+ Edits the label portion of the list item. If scrollIfNeeded is YES, will
578
+ scroll to the item before editing it.
579
+
580
+ @params {Boolean} if the parent scroll view should be scrolled to this item
581
+ before editing begins
582
+ @returns {Boolean} YES if successful
510
583
  */
511
584
  beginEditing: function(original, scrollIfNeeded) {
512
585
  var el = this.$label(),
@@ -531,9 +604,7 @@ SC.ListItemView = SC.View.extend(
531
604
  }.enhance(),
532
605
 
533
606
  /*
534
- * @method
535
- *
536
- * Configures the editor to overlay the label properly.
607
+ Configures the editor to overlay the label properly.
537
608
  */
538
609
  inlineEditorWillBeginEditing: function(editor, editable, value) {
539
610
  var content = this.get('content'),
@@ -593,7 +664,7 @@ SC.ListItemView = SC.View.extend(
593
664
  Allow editing.
594
665
  */
595
666
  inlineEditorShouldBeginEditing: function(inlineEditor) {
596
- return YES ;
667
+ return YES;
597
668
  },
598
669
 
599
670
  /** @private