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
@@ -5,7 +5,6 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
-
9
8
  sc_require('panes/palette');
10
9
 
11
10
  /**
@@ -23,200 +22,246 @@ sc_require('panes/palette');
23
22
  perfect bottom (3) > perfect right (0) > perfect left (1) > perfect top (2)
24
23
  fallback to perfect bottom (3)
25
24
  */
25
+
26
+ /**
27
+ @type String
28
+ @constant
29
+ @static
30
+ */
26
31
  SC.PICKER_MENU = 'menu';
32
+
33
+ /**
34
+ @type String
35
+ @constant
36
+ @static
37
+ */
27
38
  SC.PICKER_FIXED = 'fixed';
39
+
40
+ /**
41
+ @type String
42
+ @constant
43
+ @static
44
+ */
28
45
  SC.PICKER_POINTER = 'pointer';
46
+
47
+ /**
48
+ @type String
49
+ @constant
50
+ @static
51
+ */
29
52
  SC.PICKER_MENU_POINTER = 'menu-pointer';
53
+
30
54
  /**
31
- Pointer layout for perfect right/left/top/bottom
55
+ Pointer layout for perfect right/left/top/bottom.
56
+
57
+ @constant
58
+ @static
32
59
  */
33
60
  SC.POINTER_LAYOUT = ["perfectRight", "perfectLeft", "perfectTop", "perfectBottom"];
34
61
 
35
62
  /**
36
63
  @class
37
64
 
38
- Display a non-modal pane that automatically repositions around a view so as
39
- to remain visible.
65
+ Display a non-modal pane that automatically repositions around a view so as
66
+ to remain visible.
40
67
 
41
- An `SC.PickerPane` repositions around the view to which it is anchored as the
42
- browser window is resized so as to ensure the pane's content remains visible.
43
- A picker pane is useful for displaying supplementary information and does not
44
- block the user's interaction with other UI elements. Picker panes typically
68
+ An `SC.PickerPane` repositions around the view to which it is anchored as the
69
+ browser window is resized so as to ensure the pane's content remains visible.
70
+ A picker pane is useful for displaying supplementary information and does not
71
+ block the user's interaction with other UI elements. Picker panes typically
45
72
  provide a better user experience than modal panels.
46
73
 
47
- An `SC.PickerPane` repositions itself according to the optional `preferMatrix`
48
- argument passed in the `.popup()` method call. The `preferMatrix` either
49
- specifies an offset-based arrangement behavior or a position-based arrangement
74
+ An `SC.PickerPane` repositions itself according to the optional `preferMatrix`
75
+ argument passed in the `.popup()` method call. The `preferMatrix` either
76
+ specifies an offset-based arrangement behavior or a position-based arrangement
50
77
  behavior depending on the `preferType` argument in the `.popup()` call.
51
-
78
+
52
79
  The simplest way to create and display a picker pane:
53
-
54
- {{{
55
- SC.PickerPane.create({
56
- layout: { width: 400, height: 200 },
80
+
81
+ SC.PickerPane.create({
82
+ layout: { width: 400, height: 200 },
57
83
  contentView: SC.View.extend({})
58
- }).popup(someView);
59
- }}}
60
-
61
- This displays the `SC.PickerPane` anchored to `someView`.
62
-
63
- h2. Positioning
84
+ }).popup(someView);
64
85
 
65
- Picker pane positioning can be classified into two broad categories:
66
- offset-based and position-based.
86
+ This displays the `SC.PickerPane` anchored to `someView`.
87
+
88
+ ## Positioning
67
89
 
68
- h3. Offset-based
69
-
70
- When `preferType` is unspecified, `SC.PICKER_MENU` or `SC.PICKER_FIXED`, then
71
- the `preferMatrix` array describes the offset that is used to position the
90
+ Picker pane positioning can be classified into two broad categories:
91
+ offset-based and position-based.
92
+
93
+ ### Offset-based
94
+
95
+ When `preferType` is unspecified, `SC.PICKER_MENU` or `SC.PICKER_FIXED`, then
96
+ the `preferMatrix` array describes the offset that is used to position the
72
97
  pane below the anchor. The offset is described by an array of three values,
73
- defaulting to `[1, 4, 3]`. The first value controls the x offset and the second
74
- value the y offset. The third value can be `0` (right) or `3` (bottom),
75
- controlling whether the origin of the pane is further offset by the width
76
- (in the case of 0) or the height (in the case of 3) of the anchor.
77
-
78
-
79
- h3. Position-based
80
-
81
- When `preferType` is `SC.PICKER_POINTER` or `SC.PICKER_MENU_POINTER`, then
82
- the `preferMatrix` specifies the sides in the order in which you want the
83
- `SC.PickerPane` to try to arrange itself around the view to which it is
84
- anchored. The fifth element in the `preferMatrix` specifies which side the
85
- `SC.PickerPane` should display on when there isn't enough space around any
98
+ defaulting to `[1, 4, 3]`. The first value controls the x offset and the second
99
+ value the y offset. The third value can be `0` (right) or `3` (bottom),
100
+ controlling whether the origin of the pane is further offset by the width
101
+ (in the case of 0) or the height (in the case of 3) of the anchor.
102
+
103
+ ### Position-based
104
+
105
+ When `preferType` is `SC.PICKER_POINTER` or `SC.PICKER_MENU_POINTER`, then
106
+ the `preferMatrix` specifies the sides in the order in which you want the
107
+ `SC.PickerPane` to try to arrange itself around the view to which it is
108
+ anchored. The fifth element in the `preferMatrix` specifies which side the
109
+ `SC.PickerPane` should display on when there isn't enough space around any
86
110
  of the preferred sides.
87
111
 
88
- Anchor sides are defined by their index in `SC.POINTER_LAYOUT`, where right
112
+ Anchor sides are defined by their index in `SC.POINTER_LAYOUT`, where right
89
113
  is `0`, left is `1`, top is `2`, and bottom is `3`.
90
114
 
91
- For example, the `preferMatrix` of `[3, 0, 1, 2, 2]` says: "Display below the
92
- anchor (3); if there isn't enough space then display to the right of the anchor (0).
93
- If there isn't enough space either below or to the right of the anchor, then appear
94
- to the left (1), unless there is also no space on the left, in which case display
115
+ For example, the `preferMatrix` of `[3, 0, 1, 2, 2]` says: "Display below the
116
+ anchor (3); if there isn't enough space then display to the right of the anchor (0).
117
+ If there isn't enough space either below or to the right of the anchor, then appear
118
+ to the left (1), unless there is also no space on the left, in which case display
95
119
  above the anchor (2)."
96
120
 
97
- h2. Position Rules
121
+ ## Position Rules
98
122
 
99
- When invoking `.popup()` you can optionally specify a picker position rule with
100
- the `preferType` argument.
123
+ When invoking `.popup()` you can optionally specify a picker position rule with
124
+ the `preferType` argument.
101
125
 
102
- If no `preferType` is specified, the picker pane is displayed just below the anchor.
103
- The pane will reposition automatically for optimal visibility, ensuring the top-left
126
+ If no `preferType` is specified, the picker pane is displayed just below the anchor.
127
+ The pane will reposition automatically for optimal visibility, ensuring the top-left
104
128
  corner is visible.
105
129
 
106
130
  These position rules have the following behaviors:
107
131
 
108
- h3. `SC.PICKER_MENU`
132
+ ### `SC.PICKER_MENU`
109
133
 
110
- Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]`.
111
- Furthermore, a minimum left and right padding to window, of 7px and 8px, respectively,
134
+ Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]`.
135
+ Furthermore, a minimum left and right padding to window, of 7px and 8px, respectively,
112
136
  is enforced.
113
137
 
114
138
 
115
- h3. `SC.PICKER_FIXED`
139
+ ### `SC.PICKER_FIXED`
116
140
 
117
- Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]` and
141
+ Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]` and
118
142
  skipping `fitPositionToScreen`.
119
143
 
120
144
 
121
- h3. `SC.PICKER_POINTER`
145
+ ### `SC.PICKER_POINTER`
122
146
 
123
- Positioning is position-based, with `preferMatrix` defaulting to `[0, 1, 2, 3, 2]`,
147
+ Positioning is position-based, with `preferMatrix` defaulting to `[0, 1, 2, 3, 2]`,
124
148
  i.e. right > left > top > bottom; fallback to top.
125
149
 
126
150
 
127
- h3. `SC.PICKER_MENU_POINTER`
151
+ ### `SC.PICKER_MENU_POINTER`
128
152
 
129
- Positioning is position-based, with `preferMatrix` defaulting to `[3, 0, 1, 2, 3]`,
153
+ Positioning is position-based, with `preferMatrix` defaulting to `[3, 0, 1, 2, 3]`,
130
154
  i.e. bottom, right, left, top; fallback to bottom.
131
155
 
132
156
 
133
157
 
134
- h2. Examples
158
+ ## Examples
135
159
 
136
160
  Examples for applying popular customized picker position rules:
137
161
 
138
- 1. default:
139
- {{{
140
- SC.PickerPane.create({
141
- layout: { width: 400, height: 200 },
142
- contentView: SC.View.extend({})
143
- }).popup(anchor);
144
- }}}
145
-
146
- 2. menu below the anchor with default `preferMatrix` of `[1,4,3]`:
147
- {{{
148
- SC.PickerPane.create({
149
- layout: { width: 400, height: 200 },
150
- contentView: SC.View.extend({})
151
- }).popup(anchor, SC.PICKER_MENU);
152
- }}}
153
-
154
- 3. menu on the right side of anchor with custom `preferMatrix` of `[2,6,0]`:
155
- {{{
156
- SC.PickerPane.create({
157
- layout: { width: 400, height: 200 },
158
- contentView: SC.View.extend({})
159
- }).popup(anchor, SC.PICKER_MENU, [2,6,0]);
160
- }}}
161
-
162
- 4. fixed below the anchor with default `preferMatrix` of `[1,4,3]`:
163
- {{{
164
- SC.PickerPane.create({
165
- layout: { width: 400, height: 200 },
166
- contentView: SC.View.extend({})
167
- }).popup(anchor, SC.PICKER_FIXED);
168
- }}}
169
-
170
- 5. fixed on the right side of anchor with `preferMatrix` of `[-22,-17,0]`:
171
- {{{
172
- SC.PickerPane.create({
173
- layout: { width: 400, height: 200 },
174
- contentView: SC.View.extend({})
175
- }).popup(anchor, SC.PICKER_FIXED, [-22,-17,0]);
176
- }}}
177
-
178
- 6. pointer with default `preferMatrix` of `[0,1,2,3,2]`:
179
- {{{
180
- SC.PickerPane.create({
181
- layout: { width: 400, height: 200 },
182
- contentView: SC.View.extend({})
183
- }).popup(anchor, SC.PICKER_POINTER);
184
- }}}
162
+ ### default:
163
+
164
+ SC.PickerPane.create({
165
+ layout: { width: 400, height: 200 },
166
+ contentView: SC.View.extend({})
167
+ }).popup(anchor);
168
+
169
+ ### menu below the anchor with default `preferMatrix` of `[1,4,3]`:
170
+
171
+ SC.PickerPane.create({
172
+ layout: { width: 400, height: 200 },
173
+ contentView: SC.View.extend({})
174
+ }).popup(anchor, SC.PICKER_MENU);
175
+
176
+ ### menu on the right side of anchor with custom `preferMatrix` of `[2,6,0]`:
177
+
178
+ SC.PickerPane.create({
179
+ layout: { width: 400, height: 200 },
180
+ contentView: SC.View.extend({})
181
+ }).popup(anchor, SC.PICKER_MENU, [2,6,0]);
182
+
183
+ ### fixed below the anchor with default `preferMatrix` of `[1,4,3]`:
184
+
185
+ SC.PickerPane.create({
186
+ layout: { width: 400, height: 200 },
187
+ contentView: SC.View.extend({})
188
+ }).popup(anchor, SC.PICKER_FIXED);
189
+
190
+ ### fixed on the right side of anchor with `preferMatrix` of `[-22,-17,0]`:
191
+
192
+ SC.PickerPane.create({
193
+ layout: { width: 400, height: 200 },
194
+ contentView: SC.View.extend({})
195
+ }).popup(anchor, SC.PICKER_FIXED, [-22,-17,0]);
196
+
197
+ ### pointer with default `preferMatrix` of `[0,1,2,3,2]`:
198
+
199
+ SC.PickerPane.create({
200
+ layout: { width: 400, height: 200 },
201
+ contentView: SC.View.extend({})
202
+ }).popup(anchor, SC.PICKER_POINTER);
185
203
 
186
204
  Positioning: right (0) > left (1) > top (2) > bottom (3). Fallback to top (2).
187
205
 
188
- 7. pointer with custom `preferMatrix` of `[3,0,1,2,2]`:
189
- {{{
190
- SC.PickerPane.create({
191
- layout: { width: 400, height: 200 },
192
- contentView: SC.View.extend({})
193
- }).popup(anchor, SC.PICKER_POINTER, [3,0,1,2,2]);
194
- }}}
206
+ ### pointer with custom `preferMatrix` of `[3,0,1,2,2]`:
207
+
208
+ SC.PickerPane.create({
209
+ layout: { width: 400, height: 200 },
210
+ contentView: SC.View.extend({})
211
+ }).popup(anchor, SC.PICKER_POINTER, [3,0,1,2,2]);
195
212
 
196
213
  Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to top (2).
197
214
 
198
- 8. menu-pointer with default `preferMatrix` of `[3,0,1,2,3]`:
199
- {{{
200
- SC.PickerPane.create({
201
- layout: { width: 400, height: 200 },
202
- contentView: SC.View.extend({})
203
- }).popup(anchor, SC.PICKER_MENU_POINTER);
204
- }}}
215
+ ### menu-pointer with default `preferMatrix` of `[3,0,1,2,3]`:
216
+
217
+ SC.PickerPane.create({
218
+ layout: { width: 400, height: 200 },
219
+ contentView: SC.View.extend({})
220
+ }).popup(anchor, SC.PICKER_MENU_POINTER);
205
221
 
206
222
  Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to bottom (3).
207
223
 
208
224
  @extends SC.PalettePane
209
225
  @since SproutCore 1.0
210
226
  */
211
- SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
227
+ SC.PickerPane = SC.PalettePane.extend(
228
+ /** @scope SC.PickerPane.prototype */ {
229
+
230
+ /**
231
+ @type Array
232
+ @default ['sc-picker']
233
+ @see SC.View#classNames
234
+ */
235
+ classNames: ['sc-picker'],
212
236
 
213
- classNames: 'sc-picker',
237
+ /**
238
+ @type Boolean
239
+ @default YES
240
+ */
214
241
  isAnchored: YES,
215
242
 
243
+ /**
244
+ @type Boolean
245
+ @default YES
246
+ */
216
247
  isModal: YES,
217
248
 
249
+ /**
250
+ @type String
251
+ @default 'perfectRight'
252
+ */
218
253
  pointerPos: 'perfectRight',
254
+
255
+ /**
256
+ @type Number
257
+ @default 0
258
+ */
219
259
  pointerPosX: 0,
260
+
261
+ /**
262
+ @type Number
263
+ @default 0
264
+ */
220
265
  pointerPosY: 0,
221
266
 
222
267
  /**
@@ -224,42 +269,48 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
224
269
  triggered your picker to show. You can use this to properly position your
225
270
  picker.
226
271
 
227
- @property {Object}
272
+ @type HTMLElement
273
+ @default null
228
274
  */
229
275
  anchorElement: null,
230
276
 
231
- /**
277
+ /** @private
232
278
  anchor rect calculated by computeAnchorRect from init popup
233
279
 
234
- @property {Hash}
280
+ @type Hash
281
+ @default null
235
282
  */
236
283
  anchorCached: null,
237
284
 
238
285
  /**
239
286
  popular customized picker position rule
240
287
 
241
- @property {String}
288
+ @type String
289
+ @default null
242
290
  */
243
291
  preferType: null,
244
292
 
245
293
  /**
246
294
  default/custom offset or position pref matrix for specific preferType
247
295
 
248
- @property {String}
296
+ @type String
297
+ @default null
249
298
  */
250
299
  preferMatrix: null,
251
300
 
252
301
  /**
253
302
  default/custom offset of pointer for picker-pointer or pointer-menu
254
303
 
255
- @property {Array}
304
+ @type Array
305
+ @default null
256
306
  */
257
307
  pointerOffset: null,
258
308
 
259
309
  /**
260
310
  default offset of extra-right pointer for picker-pointer or pointer-menu
261
311
 
262
- @property Number
312
+ @type Number
313
+ @default 0
263
314
  */
264
315
  extraRightOffset: 0,
265
316
 
@@ -272,7 +323,8 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
272
323
  set to null, then the button will search the responder chain for a view that
273
324
  implements the action when the button is pressed instead.
274
325
 
275
- @property {Object}
326
+ @type Object
327
+ @default null
276
328
  */
277
329
  removeTarget: null,
278
330
 
@@ -290,17 +342,18 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
290
342
  Note that this property is optional. If no explicit value is provided then the
291
343
  picker pane will perform the default action which is to simply remove itself.
292
344
 
293
- @property {String}
345
+ @type String
346
+ @default null
294
347
  */
295
348
  removeAction: null,
296
349
 
297
350
  /**
298
- Displays a new picker pane according to the passed parameters.
299
- Every parameter except for the anchorViewOrElement is optional.
300
-
301
- @param {Object} anchorViewOrElement view or element to anchor to
302
- @param {String} preferType optional apply picker position rule
303
- @param {Array} preferMatrix optional apply custom offset or position pref matrix for specific preferType
351
+ Displays a new picker pane.
352
+
353
+ @param {SC.View|HTMLElement} anchorViewOrElement view or element to anchor to
354
+ @param {String} [preferType] apply picker position rule
355
+ @param {Array} [preferMatrix] apply custom offset or position pref matrix for specific preferType
356
+ @param {Number} [pointerOffset]
304
357
  @returns {SC.PickerPane} receiver
305
358
  */
306
359
  popup: function(anchorViewOrElement, preferType, preferMatrix, pointerOffset) {
@@ -731,8 +784,17 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
731
784
  }
732
785
  },
733
786
 
787
+ /**
788
+ @type Array
789
+ @default ['preferType','pointerPos','pointerPosY']
790
+ @see SC.View#displayProperties
791
+ */
734
792
  displayProperties: ['preferType','pointerPos','pointerPosY'],
735
793
 
794
+ /**
795
+ @type String
796
+ @default 'pickerRenderDelegate'
797
+ */
736
798
  renderDelegateName: 'pickerRenderDelegate',
737
799
 
738
800
  /** @private - click away picker. */
@@ -751,6 +813,7 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
751
813
  return YES ;
752
814
  },
753
815
 
816
+ /** @private */
754
817
  mouseDown: function(evt) {
755
818
  return this.modalPaneDidClick(evt);
756
819
  },
@@ -765,13 +828,12 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
765
828
  },
766
829
 
767
830
  /**
768
- Invoked by the root responder. Re-position picker whenever the window resizes.
831
+ Invoked by the root responder. Re-position picker whenever the window resizes.
769
832
  */
770
833
  windowSizeDidChange: function(oldSize, newSize) {
771
834
  this.positionPane();
772
835
  },
773
836
 
774
-
775
837
  remove: function(){
776
838
  if(this.get('isVisibleInWindow') && this.get('isPaneAttached')) this._showOverflow();
777
839
  return sc_super();
@@ -790,12 +852,12 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
790
852
  if(windowSize.width>=minWidth && windowSize.height>=minHeight){
791
853
  SC.PICKERS_OPEN++;
792
854
  //console.log(this.toString()+" "+SC.PICKERS_OPEN);
793
- if(SC.PICKERS_OPEN > 0) body.css('overflow', 'hidden');
855
+ if(SC.PICKERS_OPEN > 0) body.css('overflow', 'hidden');
794
856
  }
795
857
  },
796
858
 
797
859
  /** @private
798
- Internal method to show the overflow on the body to make sure we don't
860
+ Internal method to show the overflow on the body to make sure we don't
799
861
  show scrollbars when the picker has shadows, as it's really anoying.
800
862
  */
801
863
  _showOverflow: function(){
@@ -816,21 +878,62 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
816
878
  // show/hide the body overflow.
817
879
  SC.PICKERS_OPEN = 0;
818
880
 
881
+ /**
882
+ @static
883
+ */
819
884
  SC.PickerPane.PICKER_POINTER_OFFSET = [9, -9, -18, 18];
885
+
886
+ /**
887
+ @static
888
+ */
820
889
  SC.PickerPane.PICKER_EXTRA_RIGHT_OFFSET = 20;
821
890
 
891
+ /**
892
+ @static
893
+ */
822
894
  SC.PickerPane.TINY_PICKER_MENU_POINTER_OFFSET = [9, -9, -18, 18];
895
+
896
+ /**
897
+ @static
898
+ */
823
899
  SC.PickerPane.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;
824
900
 
901
+ /**
902
+ @static
903
+ */
825
904
  SC.PickerPane.SMALL_PICKER_MENU_POINTER_OFFSET = [9, -9, -8, 8];
905
+
906
+ /**
907
+ @static
908
+ */
826
909
  SC.PickerPane.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET = 11;
827
910
 
911
+ /**
912
+ @static
913
+ */
828
914
  SC.PickerPane.REGULAR_PICKER_MENU_POINTER_OFFSET = [9, -9, -12, 12];
829
- SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET = 13;
915
+
916
+ /**
917
+ @static
918
+ */
830
919
  SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;
831
920
 
921
+ /**
922
+ @static
923
+ */
832
924
  SC.PickerPane.LARGE_PICKER_MENU_POINTER_OFFSET = [9, -9, -16, 16];
925
+
926
+ /**
927
+ @static
928
+ */
833
929
  SC.PickerPane.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET = 17;
834
930
 
931
+ /**
932
+ @static
933
+ */
835
934
  SC.PickerPane.HUGE_PICKER_MENU_POINTER_OFFSET = [9, -9, -18, 18];
935
+
936
+ /**
937
+ @static
938
+ */
836
939
  SC.PickerPane.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;