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.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -11,24 +11,26 @@ sc_require('views/list_item');
|
|
11
11
|
/**
|
12
12
|
Special drag operation passed to delegate if the collection view proposes
|
13
13
|
to perform a reorder event.
|
14
|
+
|
15
|
+
@static
|
16
|
+
@constant
|
14
17
|
*/
|
15
|
-
SC.DRAG_REORDER = 0x0010
|
18
|
+
SC.DRAG_REORDER = 0x0010;
|
16
19
|
|
17
|
-
/**
|
18
|
-
|
20
|
+
/**
|
21
|
+
@static
|
22
|
+
@static
|
23
|
+
@default NO
|
19
24
|
*/
|
20
|
-
SC.
|
25
|
+
SC.BENCHMARK_RELOAD = NO;
|
21
26
|
|
22
|
-
|
23
|
-
SC.
|
24
|
-
|
25
|
-
SC.BENCHMARK_RELOAD = NO ;
|
27
|
+
/*
|
28
|
+
TODO Document SC.CollectionView
|
29
|
+
*/
|
26
30
|
|
27
31
|
/**
|
28
32
|
@class
|
29
33
|
|
30
|
-
TODO: Document SC.CollectionView
|
31
|
-
|
32
34
|
Renders a collection of views from a source array of model objects.
|
33
35
|
|
34
36
|
The CollectionView is the root view class for rendering collections of
|
@@ -48,13 +50,32 @@ SC.BENCHMARK_RELOAD = NO ;
|
|
48
50
|
@extends SC.CollectionContent
|
49
51
|
@since SproutCore 0.9
|
50
52
|
*/
|
51
|
-
SC.CollectionView = SC.View.extend(
|
52
|
-
SC.CollectionViewDelegate,
|
53
|
-
SC.CollectionContent,
|
53
|
+
SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionContent,
|
54
54
|
/** @scope SC.CollectionView.prototype */ {
|
55
55
|
|
56
|
+
/**
|
57
|
+
@type Array
|
58
|
+
@default ['sc-collection-view']
|
59
|
+
@see SC.View#classNames
|
60
|
+
*/
|
56
61
|
classNames: ['sc-collection-view'],
|
57
62
|
|
63
|
+
/**
|
64
|
+
@type Array
|
65
|
+
@default ['isFirstResponder', 'isEnabled', 'isActive']
|
66
|
+
*/
|
67
|
+
displayProperties: ['isFirstResponder', 'isEnabled', 'isActive'],
|
68
|
+
|
69
|
+
/**
|
70
|
+
@type String
|
71
|
+
@default 'collectionRenderDelegate'
|
72
|
+
*/
|
73
|
+
renderDelegateName: 'collectionRenderDelegate',
|
74
|
+
|
75
|
+
/**
|
76
|
+
@type Number
|
77
|
+
@default 200
|
78
|
+
*/
|
58
79
|
ACTION_DELAY: 200,
|
59
80
|
|
60
81
|
// ......................................
|
@@ -62,7 +83,10 @@ SC.CollectionView = SC.View.extend(
|
|
62
83
|
//
|
63
84
|
|
64
85
|
/**
|
65
|
-
If YES, uses the
|
86
|
+
If YES, uses the experimental fast CollectionView path.
|
87
|
+
|
88
|
+
@type Boolean
|
89
|
+
@default NO
|
66
90
|
*/
|
67
91
|
useFastPath: NO,
|
68
92
|
|
@@ -80,7 +104,8 @@ SC.CollectionView = SC.View.extend(
|
|
80
104
|
Usually you will want to bind this property to a controller property
|
81
105
|
that actually contains the array of objects you to display.
|
82
106
|
|
83
|
-
@type
|
107
|
+
@type SC.Array
|
108
|
+
@default null
|
84
109
|
*/
|
85
110
|
content: null,
|
86
111
|
|
@@ -90,8 +115,8 @@ SC.CollectionView = SC.View.extend(
|
|
90
115
|
/**
|
91
116
|
The current length of the content.
|
92
117
|
|
93
|
-
@
|
94
|
-
@
|
118
|
+
@type Number
|
119
|
+
@default 0
|
95
120
|
*/
|
96
121
|
length: 0,
|
97
122
|
|
@@ -108,8 +133,10 @@ SC.CollectionView = SC.View.extend(
|
|
108
133
|
To change the nowShowing index set, you must create a new index set and
|
109
134
|
apply it.
|
110
135
|
|
111
|
-
@
|
112
|
-
@type
|
136
|
+
@field
|
137
|
+
@type SC.IndexSet
|
138
|
+
@observes length
|
139
|
+
@observes clippingFrame
|
113
140
|
*/
|
114
141
|
nowShowing: function() {
|
115
142
|
return this.computeNowShowing();
|
@@ -123,7 +150,8 @@ SC.CollectionView = SC.View.extend(
|
|
123
150
|
Any item views representing content objects in this set will have their
|
124
151
|
isSelected property set to YES automatically.
|
125
152
|
|
126
|
-
@type
|
153
|
+
@type SC.SelectionSet
|
154
|
+
@default null
|
127
155
|
*/
|
128
156
|
selection: null,
|
129
157
|
|
@@ -134,7 +162,8 @@ SC.CollectionView = SC.View.extend(
|
|
134
162
|
have items in your selectedIndexes property, they will still be reflected
|
135
163
|
visually.
|
136
164
|
|
137
|
-
@type
|
165
|
+
@type Boolean
|
166
|
+
@default YES
|
138
167
|
*/
|
139
168
|
isSelectable: YES,
|
140
169
|
|
@@ -142,14 +171,15 @@ SC.CollectionView = SC.View.extend(
|
|
142
171
|
isSelectableBindingDefault: SC.Binding.bool(),
|
143
172
|
|
144
173
|
/**
|
145
|
-
Enable or disable the view.
|
174
|
+
Enable or disable the view.
|
146
175
|
|
147
176
|
The collection view will set the isEnabled property of its item views to
|
148
177
|
reflect the same view of this property. Whenever isEnabled is false,
|
149
178
|
the collection view will also be not selectable or editable, regardless of
|
150
179
|
the settings for isEditable & isSelectable.
|
151
180
|
|
152
|
-
@type
|
181
|
+
@type Boolean
|
182
|
+
@default YES
|
153
183
|
*/
|
154
184
|
isEnabled: YES,
|
155
185
|
|
@@ -164,7 +194,8 @@ SC.CollectionView = SC.View.extend(
|
|
164
194
|
the user will not be able to reorder, add, or delete items regardless of
|
165
195
|
the canReorderContent and canDeleteContent and isDropTarget properties.
|
166
196
|
|
167
|
-
@type
|
197
|
+
@type Boolean
|
198
|
+
@default YES
|
168
199
|
*/
|
169
200
|
isEditable: YES,
|
170
201
|
|
@@ -178,7 +209,8 @@ SC.CollectionView = SC.View.extend(
|
|
178
209
|
If you also accept drops, this will allow the user to drop items into
|
179
210
|
specific points in the list. Otherwise items will be added to the end.
|
180
211
|
|
181
|
-
@type
|
212
|
+
@type Boolean
|
213
|
+
@default NO
|
182
214
|
*/
|
183
215
|
canReorderContent: NO,
|
184
216
|
|
@@ -191,7 +223,8 @@ SC.CollectionView = SC.View.extend(
|
|
191
223
|
If true the user will be allowed to delete selected items using the delete
|
192
224
|
key. Otherwise deletes will not be permitted.
|
193
225
|
|
194
|
-
@type
|
226
|
+
@type Boolean
|
227
|
+
@default NO
|
195
228
|
*/
|
196
229
|
canDeleteContent: NO,
|
197
230
|
|
@@ -203,7 +236,7 @@ SC.CollectionView = SC.View.extend(
|
|
203
236
|
This will only work if isEditable is YES and the item view implements
|
204
237
|
the beginEditing() method.
|
205
238
|
|
206
|
-
@type
|
239
|
+
@type Boolean
|
207
240
|
*/
|
208
241
|
canEditContent: NO,
|
209
242
|
|
@@ -217,7 +250,8 @@ SC.CollectionView = SC.View.extend(
|
|
217
250
|
cause it to be registered as a drop target, activating the other drop
|
218
251
|
machinery.
|
219
252
|
|
220
|
-
@type
|
253
|
+
@type Boolean
|
254
|
+
@default NO
|
221
255
|
*/
|
222
256
|
isDropTarget: NO,
|
223
257
|
|
@@ -228,7 +262,8 @@ SC.CollectionView = SC.View.extend(
|
|
228
262
|
click behavior. Command modifiers will be ignored and instead clicking
|
229
263
|
once will select an item and clicking on it again will deselect it.
|
230
264
|
|
231
|
-
@type
|
265
|
+
@type Boolean
|
266
|
+
@default NO
|
232
267
|
*/
|
233
268
|
useToggleSelection: NO,
|
234
269
|
|
@@ -244,8 +279,9 @@ SC.CollectionView = SC.View.extend(
|
|
244
279
|
|
245
280
|
Use this if you are using the collection view as a menu of items.
|
246
281
|
|
247
|
-
@
|
248
|
-
|
282
|
+
@type Boolean
|
283
|
+
@default NO
|
284
|
+
*/
|
249
285
|
actOnSelect: NO,
|
250
286
|
|
251
287
|
|
@@ -256,10 +292,11 @@ SC.CollectionView = SC.View.extend(
|
|
256
292
|
|
257
293
|
In some UI scenarios, you might want to prevent selection until
|
258
294
|
the mouse is released, so you can perform, for instance, a drag operation
|
259
|
-
without actually selecting the target item.
|
295
|
+
without actually selecting the target item.
|
260
296
|
|
261
|
-
@
|
262
|
-
|
297
|
+
@type Boolean
|
298
|
+
@default YES
|
299
|
+
*/
|
263
300
|
selectOnMouseDown: YES,
|
264
301
|
|
265
302
|
/**
|
@@ -273,9 +310,9 @@ SC.CollectionView = SC.View.extend(
|
|
273
310
|
For best results, the view you set here should understand the following
|
274
311
|
properties:
|
275
312
|
|
276
|
-
|
277
|
-
|
278
|
-
|
313
|
+
- *content* The content object from the content array your view should display
|
314
|
+
- *isEnabled* True if the view should appear enabled
|
315
|
+
- *isSelected* True if the view should appear selected
|
279
316
|
|
280
317
|
In general you do not want your child views to actually respond to mouse
|
281
318
|
and keyboard events themselves. It is better to let the collection view
|
@@ -285,7 +322,8 @@ SC.CollectionView = SC.View.extend(
|
|
285
322
|
you should be sure to actually call the same method on the collection view
|
286
323
|
to give it the chance to perform its own selection housekeeping.
|
287
324
|
|
288
|
-
@
|
325
|
+
@type SC.View
|
326
|
+
@default SC.ListItemView
|
289
327
|
*/
|
290
328
|
exampleView: SC.ListItemView,
|
291
329
|
|
@@ -293,7 +331,8 @@ SC.CollectionView = SC.View.extend(
|
|
293
331
|
If set, this key will be used to get the example view for a given
|
294
332
|
content object. The exampleView property will be ignored.
|
295
333
|
|
296
|
-
@
|
334
|
+
@type String
|
335
|
+
@default null
|
297
336
|
*/
|
298
337
|
contentExampleViewKey: null,
|
299
338
|
|
@@ -308,7 +347,8 @@ SC.CollectionView = SC.View.extend(
|
|
308
347
|
If you leave this set to null then the regular example view will be used
|
309
348
|
with the isGroupView property set to YES on the item view.
|
310
349
|
|
311
|
-
@
|
350
|
+
@type SC.View
|
351
|
+
@default null
|
312
352
|
*/
|
313
353
|
groupExampleView: null,
|
314
354
|
|
@@ -316,7 +356,8 @@ SC.CollectionView = SC.View.extend(
|
|
316
356
|
If set, this key will be used to get the example view for a given
|
317
357
|
content object. The groupExampleView property will be ignored.
|
318
358
|
|
319
|
-
@
|
359
|
+
@type String
|
360
|
+
@default null
|
320
361
|
*/
|
321
362
|
contentGroupExampleViewKey: null,
|
322
363
|
|
@@ -337,7 +378,8 @@ SC.CollectionView = SC.View.extend(
|
|
337
378
|
deprecated for future use. You should generally use the responder chain
|
338
379
|
to handle your action for you.
|
339
380
|
|
340
|
-
@
|
381
|
+
@type String
|
382
|
+
@default null
|
341
383
|
*/
|
342
384
|
action: null,
|
343
385
|
|
@@ -352,7 +394,8 @@ SC.CollectionView = SC.View.extend(
|
|
352
394
|
This property is ignored if you use the deprecated approach of making the
|
353
395
|
action property a function.
|
354
396
|
|
355
|
-
@
|
397
|
+
@type String|Object
|
398
|
+
@default null
|
356
399
|
*/
|
357
400
|
target: null,
|
358
401
|
|
@@ -372,12 +415,16 @@ SC.CollectionView = SC.View.extend(
|
|
372
415
|
view. You can also ignore this property if you like. The collection view
|
373
416
|
itself does not use this property to impact rendering.
|
374
417
|
|
375
|
-
@
|
418
|
+
@type String
|
419
|
+
@default null
|
376
420
|
*/
|
377
421
|
contentValueKey: null,
|
378
422
|
|
379
423
|
/**
|
380
424
|
Enables keyboard-based navigate, deletion, etc. if set to true.
|
425
|
+
|
426
|
+
@type Boolean
|
427
|
+
@default NO
|
381
428
|
*/
|
382
429
|
acceptsFirstResponder: NO,
|
383
430
|
|
@@ -386,6 +433,7 @@ SC.CollectionView = SC.View.extend(
|
|
386
433
|
add/remove an 'active' class name to the root element.
|
387
434
|
|
388
435
|
@type Boolean
|
436
|
+
@default NO
|
389
437
|
*/
|
390
438
|
isActive: NO,
|
391
439
|
|
@@ -398,6 +446,7 @@ SC.CollectionView = SC.View.extend(
|
|
398
446
|
different than 0.
|
399
447
|
|
400
448
|
@type Number
|
449
|
+
@default 0
|
401
450
|
*/
|
402
451
|
calculatedHeight: 0,
|
403
452
|
|
@@ -409,6 +458,7 @@ SC.CollectionView = SC.View.extend(
|
|
409
458
|
different than 0.
|
410
459
|
|
411
460
|
@type Number
|
461
|
+
@default 0
|
412
462
|
*/
|
413
463
|
calculatedWidth: 0,
|
414
464
|
|
@@ -428,7 +478,9 @@ SC.CollectionView = SC.View.extend(
|
|
428
478
|
|
429
479
|
@returns {Hash} layout properties
|
430
480
|
*/
|
431
|
-
computeLayout: function() {
|
481
|
+
computeLayout: function() {
|
482
|
+
return null;
|
483
|
+
},
|
432
484
|
|
433
485
|
/**
|
434
486
|
Override to compute the layout of the itemView for the content at the
|
@@ -440,7 +492,7 @@ SC.CollectionView = SC.View.extend(
|
|
440
492
|
@returns {Hash} a view layout
|
441
493
|
*/
|
442
494
|
layoutForContentIndex: function(contentIndex) {
|
443
|
-
return null
|
495
|
+
return null;
|
444
496
|
},
|
445
497
|
|
446
498
|
/**
|
@@ -449,7 +501,9 @@ SC.CollectionView = SC.View.extend(
|
|
449
501
|
|
450
502
|
This is used by the default contentIndexesInRect() implementation.
|
451
503
|
|
452
|
-
@
|
504
|
+
@field
|
505
|
+
@type SC.IndexSet
|
506
|
+
@observes length
|
453
507
|
*/
|
454
508
|
allContentIndexes: function() {
|
455
509
|
return SC.IndexSet.create(0, this.get('length')).freeze();
|
@@ -463,8 +517,6 @@ SC.CollectionView = SC.View.extend(
|
|
463
517
|
|
464
518
|
Override this method to implement incremental rendering.
|
465
519
|
|
466
|
-
The default simply returns the current content length.
|
467
|
-
|
468
520
|
@param {Rect} rect the visible rect
|
469
521
|
@returns {SC.IndexSet} now showing indexes
|
470
522
|
*/
|
@@ -493,7 +545,7 @@ SC.CollectionView = SC.View.extend(
|
|
493
545
|
if (max > len) r = r.copy().remove(len, max-len).freeze();
|
494
546
|
}
|
495
547
|
|
496
|
-
return r
|
548
|
+
return r;
|
497
549
|
},
|
498
550
|
|
499
551
|
/**
|
@@ -514,8 +566,7 @@ SC.CollectionView = SC.View.extend(
|
|
514
566
|
|
515
567
|
@returns {void}
|
516
568
|
*/
|
517
|
-
showInsertionPoint: function(itemView, dropOperation) {
|
518
|
-
},
|
569
|
+
showInsertionPoint: function(itemView, dropOperation) {},
|
519
570
|
|
520
571
|
/**
|
521
572
|
Override to hide the insertion point when a drag ends.
|
@@ -531,8 +582,8 @@ SC.CollectionView = SC.View.extend(
|
|
531
582
|
|
532
583
|
@returns {void}
|
533
584
|
*/
|
534
|
-
hideInsertionPoint: function() {
|
535
|
-
|
585
|
+
hideInsertionPoint: function() {},
|
586
|
+
|
536
587
|
|
537
588
|
// ..........................................................
|
538
589
|
// DELEGATE SUPPORT
|
@@ -553,7 +604,8 @@ SC.CollectionView = SC.View.extend(
|
|
553
604
|
automatically set as the delegate. Usually you will work with a
|
554
605
|
CollectionView in this way rather than setting a delegate explicitly.
|
555
606
|
|
556
|
-
@type
|
607
|
+
@type SC.CollectionViewDelegate
|
608
|
+
@default null
|
557
609
|
*/
|
558
610
|
delegate: null,
|
559
611
|
|
@@ -562,8 +614,8 @@ SC.CollectionView = SC.View.extend(
|
|
562
614
|
will be either the delegate, content, or the collection view itself,
|
563
615
|
whichever implements the SC.CollectionViewDelegate mixin.
|
564
616
|
|
565
|
-
@
|
566
|
-
@type
|
617
|
+
@field
|
618
|
+
@type Object
|
567
619
|
*/
|
568
620
|
selectionDelegate: function() {
|
569
621
|
var del = this.get('delegate'), content = this.get('content');
|
@@ -576,8 +628,8 @@ SC.CollectionView = SC.View.extend(
|
|
576
628
|
the content will usually also be the content delegate, though you
|
577
629
|
could implement your own delegate if you prefer.
|
578
630
|
|
579
|
-
@
|
580
|
-
@type
|
631
|
+
@field
|
632
|
+
@type Object
|
581
633
|
*/
|
582
634
|
contentDelegate: function() {
|
583
635
|
var del = this.get('delegate'), content = this.get('content');
|
@@ -594,6 +646,7 @@ SC.CollectionView = SC.View.extend(
|
|
594
646
|
return this.get('contentDelegate').contentGroupIndexes(this, this.get('content'));
|
595
647
|
}.property('contentDelegate', 'content').cacheable(),
|
596
648
|
|
649
|
+
|
597
650
|
// ..........................................................
|
598
651
|
// CONTENT CHANGES
|
599
652
|
//
|
@@ -636,9 +689,7 @@ SC.CollectionView = SC.View.extend(
|
|
636
689
|
@param {SC.IndexSet} indexes the indexes in the content array affected
|
637
690
|
@returns {void}
|
638
691
|
*/
|
639
|
-
contentPropertyDidChange: function(target, key, indexes) {
|
640
|
-
// Default Does Nothing
|
641
|
-
},
|
692
|
+
contentPropertyDidChange: function(target, key, indexes) {},
|
642
693
|
|
643
694
|
/**
|
644
695
|
Called whenever the view needs to updates it's contentRangeObserver to
|
@@ -670,7 +721,7 @@ SC.CollectionView = SC.View.extend(
|
|
670
721
|
content.updateRangeObserver(observer, nowShowing);
|
671
722
|
} else {
|
672
723
|
var func = this.contentRangeDidChange;
|
673
|
-
observer = content.addRangeObserver(nowShowing, this, func, null);
|
724
|
+
observer = content.addRangeObserver(nowShowing, this, func, null);
|
674
725
|
this._cv_contentRangeObserver = observer ;
|
675
726
|
}
|
676
727
|
|
@@ -681,7 +732,7 @@ SC.CollectionView = SC.View.extend(
|
|
681
732
|
observer. This is called whenever the content array changes. You will
|
682
733
|
not usually call this method yourself but you may override it if you
|
683
734
|
provide your own range observer behavior.
|
684
|
-
|
735
|
+
|
685
736
|
Note that if you override this method you should probably also override
|
686
737
|
updateRangeObserver() to create or update a range oberver as needed.
|
687
738
|
|
@@ -712,17 +763,17 @@ SC.CollectionView = SC.View.extend(
|
|
712
763
|
/** @private
|
713
764
|
Whenever content property changes to a new value:
|
714
765
|
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
766
|
+
- remove any old observers
|
767
|
+
- setup new observers (maybe wait until end of runloop to do this?)
|
768
|
+
- recalc height/reload content
|
769
|
+
- set content as delegate if delegate was old content
|
770
|
+
- reset selection
|
771
|
+
|
721
772
|
Whenever content array mutates:
|
722
773
|
|
723
|
-
|
724
|
-
|
725
|
-
|
774
|
+
- possibly stop observing property changes on objects, observe new objs
|
775
|
+
- reload effected item views
|
776
|
+
- update layout for receiver
|
726
777
|
*/
|
727
778
|
_cv_contentDidChange: function() {
|
728
779
|
var content = this.get('content'),
|
@@ -755,10 +806,8 @@ SC.CollectionView = SC.View.extend(
|
|
755
806
|
//
|
756
807
|
|
757
808
|
/** @private
|
758
|
-
|
759
809
|
The indexes that need to be reloaded. Must be one of YES, NO, or an
|
760
810
|
SC.IndexSet.
|
761
|
-
|
762
811
|
*/
|
763
812
|
_invalidIndexes: NO,
|
764
813
|
|
@@ -801,8 +850,8 @@ SC.CollectionView = SC.View.extend(
|
|
801
850
|
Note that this method will also invoke two other callback methods if you
|
802
851
|
define them on your subclass:
|
803
852
|
|
804
|
-
|
805
|
-
|
853
|
+
- *willReload()* is called just before the items are reloaded
|
854
|
+
- *didReload()* is called jsut after items are reloaded
|
806
855
|
|
807
856
|
You can use these two methods to setup and teardown caching, which may
|
808
857
|
reduce overall cost of a reload. Each method will be passed an index set
|
@@ -1002,15 +1051,20 @@ SC.CollectionView = SC.View.extend(
|
|
1002
1051
|
|
1003
1052
|
return this ;
|
1004
1053
|
},
|
1005
|
-
|
1006
|
-
displayProperties: 'isFirstResponder isEnabled isActive'.w(),
|
1007
|
-
renderDelegateName: 'collectionRenderDelegate',
|
1008
|
-
|
1009
1054
|
|
1055
|
+
/** @private */
|
1010
1056
|
_TMP_ATTRS: {},
|
1057
|
+
|
1058
|
+
/** @private */
|
1011
1059
|
_COLLECTION_CLASS_NAMES: 'sc-collection-item'.w(),
|
1060
|
+
|
1061
|
+
/** @private */
|
1012
1062
|
_GROUP_COLLECTION_CLASS_NAMES: 'sc-collection-item sc-group-item'.w(),
|
1063
|
+
|
1064
|
+
/** @private */
|
1013
1065
|
_VIEW_POOL: null,
|
1066
|
+
|
1067
|
+
/** @private */
|
1014
1068
|
_GROUP_VIEW_POOL: null,
|
1015
1069
|
|
1016
1070
|
/**
|
@@ -1178,6 +1232,7 @@ SC.CollectionView = SC.View.extend(
|
|
1178
1232
|
return this.itemViewForContentIndex(this.get('content').indexOf(object));
|
1179
1233
|
},
|
1180
1234
|
|
1235
|
+
/** @private */
|
1181
1236
|
_TMP_LAYERID: [],
|
1182
1237
|
|
1183
1238
|
/**
|
@@ -1329,12 +1384,10 @@ SC.CollectionView = SC.View.extend(
|
|
1329
1384
|
//
|
1330
1385
|
|
1331
1386
|
/** @private
|
1332
|
-
|
1333
1387
|
Called whenever the selection object is changed to a new value. Begins
|
1334
1388
|
observing the selection for changes.
|
1335
|
-
|
1336
1389
|
*/
|
1337
|
-
_cv_selectionDidChange: function() {
|
1390
|
+
_cv_selectionDidChange: function() {
|
1338
1391
|
var sel = this.get('selection'),
|
1339
1392
|
last = this._cv_selection,
|
1340
1393
|
func = this._cv_selectionContentDidChange;
|
@@ -1348,10 +1401,8 @@ SC.CollectionView = SC.View.extend(
|
|
1348
1401
|
}.observes('selection'),
|
1349
1402
|
|
1350
1403
|
/** @private
|
1351
|
-
|
1352
1404
|
Called whenever the selection object or its content changes. This will
|
1353
1405
|
repaint any items that changed their selection state.
|
1354
|
-
|
1355
1406
|
*/
|
1356
1407
|
_cv_selectionContentDidChange: function() {
|
1357
1408
|
var sel = this.get('selection'),
|
@@ -1457,7 +1508,6 @@ SC.CollectionView = SC.View.extend(
|
|
1457
1508
|
@returns {SC.CollectionView} receiver
|
1458
1509
|
*/
|
1459
1510
|
select: function(indexes, extend) {
|
1460
|
-
|
1461
1511
|
var content = this.get('content'),
|
1462
1512
|
del = this.get('selectionDelegate'),
|
1463
1513
|
groupIndexes = this.get('_contentGroupIndexes'),
|
@@ -1509,8 +1559,8 @@ SC.CollectionView = SC.View.extend(
|
|
1509
1559
|
return this;
|
1510
1560
|
},
|
1511
1561
|
|
1512
|
-
/**
|
1513
|
-
Primtive to remove the indexes from the selection.
|
1562
|
+
/**
|
1563
|
+
Primtive to remove the indexes from the selection.
|
1514
1564
|
|
1515
1565
|
@param {Number|SC.IndexSet} indexes index or indexes to select
|
1516
1566
|
@returns {SC.CollectionView} receiver
|
@@ -1547,15 +1597,14 @@ SC.CollectionView = SC.View.extend(
|
|
1547
1597
|
delegate. If a non-selectable item is found, the index is skipped. If
|
1548
1598
|
no item is found, selection index is returned unmodified.
|
1549
1599
|
|
1550
|
-
Return value will always be in the range of the bottom of the current
|
1551
|
-
selection index and the proposed index.
|
1600
|
+
Return value will always be in the range of the bottom of the current
|
1601
|
+
selection index and the proposed index.
|
1552
1602
|
|
1553
1603
|
@param {Number} proposedIndex the desired index to select
|
1554
1604
|
@param {Number} bottom optional bottom of selection use as fallback
|
1555
1605
|
@returns {Number} next selectable index.
|
1556
1606
|
*/
|
1557
1607
|
_findNextSelectableItemFromIndex: function(proposedIndex, bottom) {
|
1558
|
-
|
1559
1608
|
var lim = this.get('length'),
|
1560
1609
|
range = SC.IndexSet.create(),
|
1561
1610
|
content = this.get('content'),
|
@@ -1596,7 +1645,6 @@ SC.CollectionView = SC.View.extend(
|
|
1596
1645
|
|
1597
1646
|
@param {Integer} proposedIndex the desired index to select
|
1598
1647
|
@returns {Integer} the previous selectable index. This will always be in the range of the top of the current selection index and the proposed index.
|
1599
|
-
@private
|
1600
1648
|
*/
|
1601
1649
|
_findPreviousSelectableItemFromIndex: function(proposedIndex, top) {
|
1602
1650
|
var range = SC.IndexSet.create(),
|
@@ -1641,15 +1689,15 @@ SC.CollectionView = SC.View.extend(
|
|
1641
1689
|
|
1642
1690
|
Selection does not wrap around.
|
1643
1691
|
|
1644
|
-
@param
|
1645
|
-
instead of replaced.
|
1646
|
-
@param
|
1692
|
+
@param {Boolean} [extend] If true, the selection will be extended
|
1693
|
+
instead of replaced. Defaults to false.
|
1694
|
+
@param {Integer} [numberOfItems] The number of previous to be
|
1647
1695
|
selected. Defaults to 1
|
1648
|
-
|
1696
|
+
@returns {SC.CollectionView} receiver
|
1649
1697
|
*/
|
1650
1698
|
selectPreviousItem: function(extend, numberOfItems) {
|
1651
|
-
if (SC.none(numberOfItems)) numberOfItems = 1
|
1652
|
-
if (SC.none(extend)) extend = false
|
1699
|
+
if (SC.none(numberOfItems)) numberOfItems = 1;
|
1700
|
+
if (SC.none(extend)) extend = false;
|
1653
1701
|
|
1654
1702
|
var sel = this.get('selection'),
|
1655
1703
|
content = this.get('content');
|
@@ -1704,10 +1752,10 @@ SC.CollectionView = SC.View.extend(
|
|
1704
1752
|
|
1705
1753
|
Selection does not wrap around.
|
1706
1754
|
|
1707
|
-
@param
|
1708
|
-
instead of replaced.
|
1709
|
-
@param
|
1710
|
-
selected.
|
1755
|
+
@param {Boolean} [extend] If true, the selection will be extended
|
1756
|
+
instead of replaced. Defaults to false.
|
1757
|
+
@param {Integer} [numberOfItems] The number of items to be
|
1758
|
+
selected. Defaults to 1.
|
1711
1759
|
@returns {SC.CollectionView} receiver
|
1712
1760
|
*/
|
1713
1761
|
selectNextItem: function(extend, numberOfItems) {
|
@@ -2021,8 +2069,6 @@ SC.CollectionView = SC.View.extend(
|
|
2021
2069
|
return true ;
|
2022
2070
|
},
|
2023
2071
|
|
2024
|
-
|
2025
|
-
|
2026
2072
|
/** @private
|
2027
2073
|
if content value is editable and we have one item selected, then edit.
|
2028
2074
|
otherwise, invoke action.
|
@@ -2078,7 +2124,6 @@ SC.CollectionView = SC.View.extend(
|
|
2078
2124
|
@returns {Boolean} Usually YES.
|
2079
2125
|
*/
|
2080
2126
|
mouseDown: function(ev) {
|
2081
|
-
|
2082
2127
|
// When the user presses the mouse down, we don't do much just yet.
|
2083
2128
|
// Instead, we just need to save a bunch of state about the mouse down
|
2084
2129
|
// so we can choose the right thing to do later.
|
@@ -2299,6 +2344,8 @@ SC.CollectionView = SC.View.extend(
|
|
2299
2344
|
// ..........................................................
|
2300
2345
|
// TOUCH EVENTS
|
2301
2346
|
//
|
2347
|
+
|
2348
|
+
/** @private */
|
2302
2349
|
touchStart: function(touch, evt) {
|
2303
2350
|
// become first responder if possible.
|
2304
2351
|
this.becomeFirstResponder() ;
|
@@ -2319,6 +2366,7 @@ SC.CollectionView = SC.View.extend(
|
|
2319
2366
|
return YES;
|
2320
2367
|
},
|
2321
2368
|
|
2369
|
+
/** @private */
|
2322
2370
|
touchesDragged: function(evt, touches) {
|
2323
2371
|
touches.forEach(function(touch){
|
2324
2372
|
if (
|
@@ -2332,6 +2380,7 @@ SC.CollectionView = SC.View.extend(
|
|
2332
2380
|
|
2333
2381
|
},
|
2334
2382
|
|
2383
|
+
/** @private */
|
2335
2384
|
touchEnd: function(touch) {
|
2336
2385
|
var itemView = this.itemViewForEvent(touch),
|
2337
2386
|
contentIndex = itemView ? itemView.get('contentIndex') : -1,
|
@@ -2355,6 +2404,7 @@ SC.CollectionView = SC.View.extend(
|
|
2355
2404
|
}
|
2356
2405
|
},
|
2357
2406
|
|
2407
|
+
/** @private */
|
2358
2408
|
touchCancelled: function(evt) {
|
2359
2409
|
// Remove fake selection
|
2360
2410
|
if (this._touchSelectedView) { this._touchSelectedView.set('isSelected', NO); }
|
@@ -2415,7 +2465,7 @@ SC.CollectionView = SC.View.extend(
|
|
2415
2465
|
collection view instance. You can use this data type to detect reorders
|
2416
2466
|
if necessary.
|
2417
2467
|
|
2418
|
-
@
|
2468
|
+
@field
|
2419
2469
|
@type String
|
2420
2470
|
*/
|
2421
2471
|
reorderDataType: function() {
|
@@ -2430,6 +2480,7 @@ SC.CollectionView = SC.View.extend(
|
|
2430
2480
|
code.
|
2431
2481
|
|
2432
2482
|
@type SC.IndexSet
|
2483
|
+
@default null
|
2433
2484
|
*/
|
2434
2485
|
dragContent: null,
|
2435
2486
|
|
@@ -2440,6 +2491,7 @@ SC.CollectionView = SC.View.extend(
|
|
2440
2491
|
location.
|
2441
2492
|
|
2442
2493
|
@type Number
|
2494
|
+
@default null
|
2443
2495
|
*/
|
2444
2496
|
proposedInsertionIndex: null,
|
2445
2497
|
|
@@ -2450,7 +2502,7 @@ SC.CollectionView = SC.View.extend(
|
|
2450
2502
|
operation.
|
2451
2503
|
|
2452
2504
|
@type Number
|
2453
|
-
@
|
2505
|
+
@default null
|
2454
2506
|
*/
|
2455
2507
|
proposedDropOperation: null,
|
2456
2508
|
|
@@ -2464,7 +2516,6 @@ SC.CollectionView = SC.View.extend(
|
|
2464
2516
|
- a mouse down event was saved by the mouseDown method.
|
2465
2517
|
*/
|
2466
2518
|
mouseDragged: function(ev) {
|
2467
|
-
|
2468
2519
|
var del = this.get('selectionDelegate'),
|
2469
2520
|
content = this.get('content'),
|
2470
2521
|
sel = this.get('selection'),
|
@@ -2601,7 +2652,7 @@ SC.CollectionView = SC.View.extend(
|
|
2601
2652
|
property will consult the collection view delegate if one is provided. It
|
2602
2653
|
will also do the right thing if you have set canReorderContent to YES.
|
2603
2654
|
|
2604
|
-
@
|
2655
|
+
@field
|
2605
2656
|
@type Array
|
2606
2657
|
*/
|
2607
2658
|
dragDataTypes: function() {
|
@@ -2613,14 +2664,14 @@ SC.CollectionView = SC.View.extend(
|
|
2613
2664
|
if (this.get('canReorderContent')) {
|
2614
2665
|
ret = ret ? ret.copy() : [];
|
2615
2666
|
key = this.get('reorderDataType');
|
2616
|
-
if (ret.indexOf(key) < 0) ret.push(key);
|
2667
|
+
if (ret.indexOf(key) < 0) ret.push(key);
|
2617
2668
|
}
|
2618
2669
|
|
2619
2670
|
return ret ? ret : [];
|
2620
2671
|
}.property(),
|
2621
2672
|
|
2622
2673
|
/**
|
2623
|
-
Implements the drag data source protocol method.
|
2674
|
+
Implements the drag data source protocol method. The implementation of
|
2624
2675
|
this method will consult the collection view delegate if one has been
|
2625
2676
|
provided. It also respects the canReoderContent method.
|
2626
2677
|
*/
|
@@ -2651,7 +2702,6 @@ SC.CollectionView = SC.View.extend(
|
|
2651
2702
|
@returns {Number} logical OR'd mask of allowed drag operations.
|
2652
2703
|
*/
|
2653
2704
|
computeDragOperations: function(drag, evt) {
|
2654
|
-
|
2655
2705
|
// the proposed drag operation is DRAG_REORDER only if we can reorder
|
2656
2706
|
// content and the drag contains reorder content.
|
2657
2707
|
var op = SC.DRAG_NONE,
|
@@ -2681,7 +2731,6 @@ SC.CollectionView = SC.View.extend(
|
|
2681
2731
|
Returns three params: [drop index, drop operation, allowed drag ops]
|
2682
2732
|
*/
|
2683
2733
|
_computeDropOperationState: function(drag, evt, dragOp) {
|
2684
|
-
|
2685
2734
|
// get the insertion index for this location. This can be computed
|
2686
2735
|
// by a subclass using whatever method. This method is not expected to
|
2687
2736
|
// do any data valdidation, just to map the location to an insertion
|
@@ -2791,9 +2840,11 @@ SC.CollectionView = SC.View.extend(
|
|
2791
2840
|
determine the drop location and then consult the collection view delegate
|
2792
2841
|
if you implement those methods. Otherwise it will handle reordering
|
2793
2842
|
content on its own.
|
2843
|
+
|
2844
|
+
@param {SC.Drag} drag The drag that was updated
|
2845
|
+
@param {SC.Event} evt The event for the drag
|
2794
2846
|
*/
|
2795
2847
|
dragUpdated: function(drag, evt) {
|
2796
|
-
|
2797
2848
|
var op = drag.get('allowedDragOperations'),
|
2798
2849
|
state = this._computeDropOperationState(drag, evt, op),
|
2799
2850
|
idx = state[0], dropOp = state[1], dragOp = state[2];
|
@@ -2829,16 +2880,23 @@ SC.CollectionView = SC.View.extend(
|
|
2829
2880
|
|
2830
2881
|
/**
|
2831
2882
|
Implements the SC.DropTarget protocol.
|
2883
|
+
|
2884
|
+
@returns {Boolean} YES
|
2832
2885
|
*/
|
2833
|
-
acceptDragOperation: function(drag, op) {
|
2886
|
+
acceptDragOperation: function(drag, op) {
|
2887
|
+
return YES;
|
2888
|
+
},
|
2834
2889
|
|
2835
2890
|
/**
|
2836
|
-
Implements the SC.DropTarget protocol.
|
2891
|
+
Implements the SC.DropTarget protocol. Consults the collection view
|
2837
2892
|
delegate to actually perform the operation unless the operation is
|
2838
2893
|
reordering content.
|
2894
|
+
|
2895
|
+
@param {SC.Drag} drag The drag to perform the operation on
|
2896
|
+
@param {Number} op The drag operation to perform
|
2897
|
+
@return {Number} The operation performed
|
2839
2898
|
*/
|
2840
|
-
performDragOperation: function(drag, op) {
|
2841
|
-
|
2899
|
+
performDragOperation: function(drag, op) {
|
2842
2900
|
// Get the correct insertion point, drop operation, etc.
|
2843
2901
|
var state = this._computeDropOperationState(drag, null, op),
|
2844
2902
|
idx = state[0], dropOp = state[1], dragOp = state[2],
|
@@ -2905,9 +2963,11 @@ SC.CollectionView = SC.View.extend(
|
|
2905
2963
|
/**
|
2906
2964
|
Default delegate method implementation, returns YES if canReorderContent
|
2907
2965
|
is also true.
|
2966
|
+
|
2967
|
+
@param {SC.View} view
|
2908
2968
|
*/
|
2909
2969
|
collectionViewShouldBeginDrag: function(view) {
|
2910
|
-
return this.get('canReorderContent')
|
2970
|
+
return this.get('canReorderContent');
|
2911
2971
|
},
|
2912
2972
|
|
2913
2973
|
|
@@ -2941,9 +3001,9 @@ SC.CollectionView = SC.View.extend(
|
|
2941
3001
|
If an insertion is NOT allowed, you should return -1 as the insertion
|
2942
3002
|
point. In this case, the drop operation will be ignored.
|
2943
3003
|
|
2944
|
-
@param
|
2945
|
-
@param
|
2946
|
-
@returns {Array} [
|
3004
|
+
@param {Point} loc the mouse location.
|
3005
|
+
@param {DropOp} dropOperation the preferred drop operation.
|
3006
|
+
@returns {Array} format: [index, op]
|
2947
3007
|
*/
|
2948
3008
|
insertionIndexForLocation: function(loc, dropOperation) {
|
2949
3009
|
return -1;
|
@@ -2972,7 +3032,10 @@ SC.CollectionView = SC.View.extend(
|
|
2972
3032
|
return this.get('isSelectable') ;
|
2973
3033
|
},
|
2974
3034
|
|
3035
|
+
/** @private */
|
2975
3036
|
_TMP_DIFF1: SC.IndexSet.create(),
|
3037
|
+
|
3038
|
+
/** @private */
|
2976
3039
|
_TMP_DIFF2: SC.IndexSet.create(),
|
2977
3040
|
|
2978
3041
|
/** @private
|
@@ -3011,6 +3074,7 @@ SC.CollectionView = SC.View.extend(
|
|
3011
3074
|
|
3012
3075
|
}.observes('nowShowing'),
|
3013
3076
|
|
3077
|
+
/** @private */
|
3014
3078
|
init: function() {
|
3015
3079
|
sc_super();
|
3016
3080
|
if (this.useFastPath) this.mixin(SC.CollectionFastPath);
|