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
@@ -5,6 +5,10 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
+
require("views/workspace");
|
9
|
+
require("views/toolbar");
|
10
|
+
|
11
|
+
|
8
12
|
/** @class
|
9
13
|
Master/Detail view is a simple view which manages a master view and a detail view.
|
10
14
|
This is not all that different from a SplitView, except that, for the moment (this
|
@@ -25,18 +29,33 @@
|
|
25
29
|
|
26
30
|
@since SproutCore 1.2
|
27
31
|
*/
|
28
|
-
|
29
|
-
|
32
|
+
SC.MasterDetailView = SC.View.extend(
|
33
|
+
/** @scope SC.MasterDetailView.prototype */ {
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
/**
|
36
|
+
@type Array
|
37
|
+
@default ['sc-master-detail-view']
|
38
|
+
@see SC.View#classNames
|
39
|
+
*/
|
35
40
|
classNames: ["sc-master-detail-view"],
|
36
41
|
|
42
|
+
/**
|
43
|
+
@type String
|
44
|
+
@default 'masterDetailRenderDelegate'
|
45
|
+
*/
|
46
|
+
renderDelegateName: 'masterDetailRenderDelegate',
|
47
|
+
|
48
|
+
|
49
|
+
// ..........................................................
|
50
|
+
// Properties
|
51
|
+
//
|
52
|
+
|
37
53
|
/**
|
38
54
|
The master view. For your development pleasure, it defaults to a
|
39
55
|
WorkspaceView with a top toolbar.
|
56
|
+
|
57
|
+
@type SC.View
|
58
|
+
@default SC.WorkspaceView
|
40
59
|
*/
|
41
60
|
masterView: SC.WorkspaceView.extend({
|
42
61
|
topToolbar: SC.ToolbarView.extend({
|
@@ -48,6 +67,9 @@ SC.MasterDetailView = SC.View.extend({
|
|
48
67
|
The detail view. For your development experience, it defaults to holding
|
49
68
|
a top toolbar view with a button that closes/shows master. Come take a peek at
|
50
69
|
the code to see what it looks like--it is so simple.
|
70
|
+
|
71
|
+
@type SC.View
|
72
|
+
@default SC.WorkspaceView
|
51
73
|
*/
|
52
74
|
detailView: SC.WorkspaceView.extend({
|
53
75
|
topToolbar: SC.ToolbarView.extend({
|
@@ -70,6 +92,10 @@ SC.MasterDetailView = SC.View.extend({
|
|
70
92
|
browser. Your purpose in overriding it is either to disable it from automatically
|
71
93
|
disappearing on iPad and other touch devices, or force it to appear when a desktop
|
72
94
|
browser changes.
|
95
|
+
|
96
|
+
@field
|
97
|
+
@type Boolean
|
98
|
+
@default NO
|
73
99
|
*/
|
74
100
|
autoHideMaster: function() {
|
75
101
|
if (SC.platform.touch) return YES;
|
@@ -77,13 +103,19 @@ SC.MasterDetailView = SC.View.extend({
|
|
77
103
|
}.property().cacheable(),
|
78
104
|
|
79
105
|
/**
|
80
|
-
|
106
|
+
@type Number
|
81
107
|
@default 250
|
82
108
|
*/
|
83
109
|
masterWidth: 250,
|
84
110
|
|
85
111
|
/**
|
86
112
|
A property (computed) that says whether the master view is hidden.
|
113
|
+
|
114
|
+
@field
|
115
|
+
@type Boolean
|
116
|
+
@default NO
|
117
|
+
@observes autoHideMaster
|
118
|
+
@observes orientation
|
87
119
|
*/
|
88
120
|
masterIsHidden: function() {
|
89
121
|
if (!this.get("autoHideMaster")) return NO;
|
@@ -92,10 +124,17 @@ SC.MasterDetailView = SC.View.extend({
|
|
92
124
|
}.property("autoHideMaster", "orientation"),
|
93
125
|
|
94
126
|
/**
|
95
|
-
Tracks the orientation of the view.
|
127
|
+
Tracks the orientation of the view. Possible values:
|
128
|
+
|
129
|
+
- SC.VERTICAL_ORIENTATION
|
130
|
+
- SC.HORIZONTAL_ORIENTATION
|
131
|
+
|
132
|
+
@type String
|
133
|
+
@default SC.VERTICAL_ORIENTATION
|
96
134
|
*/
|
97
135
|
orientation: SC.VERTICAL_ORIENTATION,
|
98
136
|
|
137
|
+
/** @private */
|
99
138
|
_scmd_frameDidChange: function() {
|
100
139
|
var f = this.get("frame"), ret;
|
101
140
|
if (f.width > f.height) ret = SC.HORIZONTAL_ORIENTATION;
|
@@ -104,8 +143,7 @@ SC.MasterDetailView = SC.View.extend({
|
|
104
143
|
this.setIfChanged('orientation', ret);
|
105
144
|
}.observes('frame'),
|
106
145
|
|
107
|
-
|
108
|
-
// startup (frame doesn't invalidate in this case)
|
146
|
+
/** @private */
|
109
147
|
init: function() {
|
110
148
|
sc_super();
|
111
149
|
this._scmd_frameDidChange();
|
@@ -114,8 +152,9 @@ SC.MasterDetailView = SC.View.extend({
|
|
114
152
|
|
115
153
|
/**
|
116
154
|
If the master is hidden, this toggles the master picker pane.
|
117
|
-
|
118
155
|
Of course, since pickers are modal, this actually only needs to handle showing.
|
156
|
+
|
157
|
+
@param {SC.View} view The view to anchor the picker to
|
119
158
|
*/
|
120
159
|
toggleMasterPicker: function(view) {
|
121
160
|
if (!this.get("masterIsHidden")) return;
|
@@ -126,6 +165,9 @@ SC.MasterDetailView = SC.View.extend({
|
|
126
165
|
}
|
127
166
|
},
|
128
167
|
|
168
|
+
/**
|
169
|
+
@param {SC.View} view The view to anchor the picker to
|
170
|
+
*/
|
129
171
|
showMasterPicker: function(view) {
|
130
172
|
if (this._picker && this._picker.get("isVisibleInWindow")) return;
|
131
173
|
if (!this._picker) {
|
@@ -145,33 +187,46 @@ SC.MasterDetailView = SC.View.extend({
|
|
145
187
|
}
|
146
188
|
},
|
147
189
|
|
148
|
-
|
149
|
-
|
190
|
+
/**
|
191
|
+
@param {SC.PickerPane} picker The picker to popup
|
192
|
+
@param {SC.View} view The view to anchor the picker to
|
193
|
+
*/
|
194
|
+
showPicker: function(picker, view) {
|
195
|
+
picker.popup(view, SC.PICKER_POINTER, [3, 0, 1, 2, 3], [9, -9, -18, 18]);
|
150
196
|
},
|
151
197
|
|
152
|
-
|
153
|
-
|
198
|
+
/**
|
199
|
+
@param {SC.PickerPane} picker The picker to popup
|
200
|
+
*/
|
201
|
+
hidePicker: function(picker) {
|
202
|
+
picker.remove();
|
154
203
|
},
|
155
204
|
|
156
205
|
/**
|
157
206
|
The picker pane class from which to create a picker pane.
|
158
207
|
|
159
208
|
This defaults to one with a special theme.
|
209
|
+
|
210
|
+
@type SC.PickerPane
|
211
|
+
@default SC.PickerPane
|
160
212
|
*/
|
161
213
|
pickerPane: SC.PickerPane.extend({
|
162
214
|
layout: { width: 250, height: 480 },
|
163
215
|
themeName: 'popover'
|
164
216
|
}),
|
165
217
|
|
166
|
-
/// INTERNAL CODE. HERE, THERE BE MONSTERS!
|
167
|
-
_picker: null,
|
168
|
-
pointerDistanceFromEdge: 46,
|
169
218
|
|
219
|
+
// ..........................................................
|
220
|
+
// Internal Support
|
221
|
+
//
|
170
222
|
|
171
|
-
|
223
|
+
/** @private */
|
224
|
+
_picker: null,
|
172
225
|
|
173
|
-
/**
|
174
|
-
|
226
|
+
/** @private */
|
227
|
+
pointerDistanceFromEdge: 46,
|
228
|
+
|
229
|
+
/** @private
|
175
230
|
Updates masterIsHidden in child views.
|
176
231
|
*/
|
177
232
|
_scmd_masterIsHiddenDidChange: function() {
|
@@ -180,8 +235,7 @@ SC.MasterDetailView = SC.View.extend({
|
|
180
235
|
this.get("detailView").set("masterIsHidden", mih);
|
181
236
|
}.observes("masterIsHidden"),
|
182
237
|
|
183
|
-
/**
|
184
|
-
@private
|
238
|
+
/** @private
|
185
239
|
When the frame changes, we don't need to do anything. We use smart positioning.
|
186
240
|
However, if the orientation were to change, well, then we might need to do something.
|
187
241
|
*/
|
@@ -189,15 +243,15 @@ SC.MasterDetailView = SC.View.extend({
|
|
189
243
|
this.invokeOnce("_scmd_tile");
|
190
244
|
}.observes("orientation"),
|
191
245
|
|
192
|
-
/**
|
246
|
+
/** @private
|
193
247
|
Observes properties which require retiling.
|
194
248
|
*/
|
195
249
|
_scmd_retileProperties: function() {
|
196
250
|
this.invokeOnce("_scmd_tile");
|
197
251
|
}.observes("masterIsHidden", "masterWidth"),
|
198
252
|
|
199
|
-
/**
|
200
|
-
|
253
|
+
/** @private
|
254
|
+
Instantiates master and detail views.
|
201
255
|
*/
|
202
256
|
createChildViews: function() {
|
203
257
|
var master = this.get("masterView");
|
@@ -210,9 +264,10 @@ SC.MasterDetailView = SC.View.extend({
|
|
210
264
|
this.invokeOnce("_scmd_tile");
|
211
265
|
},
|
212
266
|
|
267
|
+
/** @private */
|
213
268
|
_masterIsDrawn: NO, // whether the master is in the view
|
214
|
-
|
215
|
-
|
269
|
+
|
270
|
+
/** @private
|
216
271
|
Tiles the views as necessary.
|
217
272
|
*/
|
218
273
|
_scmd_tile: function() {
|
@@ -254,4 +309,5 @@ SC.MasterDetailView = SC.View.extend({
|
|
254
309
|
detail.set('layout', { left: 0, right: 0, top: 0, bottom: 0 });
|
255
310
|
}
|
256
311
|
}
|
312
|
+
|
257
313
|
});
|
@@ -4,6 +4,7 @@
|
|
4
4
|
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
|
+
|
7
8
|
sc_require('views/button') ;
|
8
9
|
sc_require('views/separator') ;
|
9
10
|
|
@@ -16,26 +17,41 @@ sc_require('views/separator') ;
|
|
16
17
|
@since SproutCore 1.0
|
17
18
|
*/
|
18
19
|
SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
19
|
-
/** @scope SC.MenuItemView.prototype */{
|
20
|
+
/** @scope SC.MenuItemView.prototype */ {
|
21
|
+
|
22
|
+
/**
|
23
|
+
@type Array
|
24
|
+
@default ['sc-menu-item']
|
25
|
+
@see SC.View#classNames
|
26
|
+
*/
|
27
|
+
classNames: ['sc-menu-item'],
|
20
28
|
|
29
|
+
/**
|
30
|
+
@type Array
|
31
|
+
@default ['title', 'isEnabled', 'isSeparator']
|
32
|
+
@see SC.View#displayProperties
|
33
|
+
*/
|
21
34
|
displayProperties: ['title', 'isEnabled', 'isSeparator'],
|
22
35
|
|
23
|
-
classNames: ['sc-menu-item'],
|
24
36
|
|
25
37
|
/**
|
26
|
-
The WAI-ARIA role for menu items.
|
27
|
-
changed.
|
38
|
+
The WAI-ARIA role for menu items.
|
28
39
|
|
29
|
-
@
|
40
|
+
@type String
|
41
|
+
@default 'menuitem'
|
42
|
+
@readOnly
|
30
43
|
*/
|
31
44
|
ariaRole: 'menuitem',
|
32
45
|
|
46
|
+
/**
|
47
|
+
@type Boolean
|
48
|
+
@default YES
|
49
|
+
*/
|
33
50
|
escapeHTML: YES,
|
34
51
|
|
35
52
|
/**
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@type {Boolean}
|
53
|
+
@type Boolean
|
54
|
+
@default YES
|
39
55
|
*/
|
40
56
|
acceptsFirstResponder: YES,
|
41
57
|
|
@@ -43,14 +59,17 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
43
59
|
IE only attribute to block bluring of other controls
|
44
60
|
|
45
61
|
@type Boolean
|
62
|
+
@default YES
|
46
63
|
*/
|
47
64
|
blocksIEDeactivate: YES,
|
48
65
|
|
49
66
|
/**
|
50
|
-
|
67
|
+
@type Boolean
|
68
|
+
@default NO
|
51
69
|
*/
|
52
70
|
isContextMenuEnabled: NO,
|
53
71
|
|
72
|
+
|
54
73
|
// ..........................................................
|
55
74
|
// KEY PROPERTIES
|
56
75
|
//
|
@@ -59,22 +78,25 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
59
78
|
The content object the menu view will display.
|
60
79
|
|
61
80
|
@type Object
|
81
|
+
@default null
|
62
82
|
*/
|
63
83
|
content: null,
|
64
84
|
|
65
85
|
/**
|
66
|
-
YES if this menu item represents a separator.
|
86
|
+
YES if this menu item represents a separator, NO otherwise.
|
67
87
|
|
68
|
-
@
|
88
|
+
@field
|
89
|
+
@type Boolean
|
90
|
+
@observes content
|
69
91
|
*/
|
70
92
|
isSeparator: function() {
|
71
93
|
return this.getContentProperty('itemSeparatorKey') === YES;
|
72
94
|
}.property('content').cacheable(),
|
73
95
|
|
74
96
|
/**
|
75
|
-
|
76
|
-
|
77
|
-
@
|
97
|
+
@field
|
98
|
+
@type Boolean
|
99
|
+
@observes content.isEnabled
|
78
100
|
*/
|
79
101
|
isEnabled: function() {
|
80
102
|
return this.getContentProperty('itemIsEnabledKey') !== NO &&
|
@@ -84,7 +106,9 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
84
106
|
/**
|
85
107
|
This menu item's submenu, if it exists.
|
86
108
|
|
87
|
-
@
|
109
|
+
@field
|
110
|
+
@type SC.MenuView
|
111
|
+
@observes content
|
88
112
|
*/
|
89
113
|
subMenu: function() {
|
90
114
|
var content = this.get('content'), menuItems, parentMenu;
|
@@ -115,23 +139,21 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
115
139
|
}.property('content').cacheable(),
|
116
140
|
|
117
141
|
/**
|
118
|
-
|
119
|
-
|
120
|
-
@
|
142
|
+
@type Boolean
|
143
|
+
@default NO
|
144
|
+
@observes subMenu
|
121
145
|
*/
|
122
146
|
hasSubMenu: function() {
|
123
147
|
return !!this.get('subMenu');
|
124
148
|
}.property('subMenu').cacheable(),
|
125
149
|
|
126
|
-
/**
|
127
|
-
@private
|
128
|
-
*/
|
150
|
+
/** @private */
|
129
151
|
init: function() {
|
130
152
|
sc_super();
|
131
153
|
this.contentDidChange();
|
132
154
|
},
|
133
155
|
|
134
|
-
/**
|
156
|
+
/** @private
|
135
157
|
Fills the passed html-array with strings that can be joined to form the
|
136
158
|
innerHTML of the receiver element. Also populates an array of classNames
|
137
159
|
to set on the outer element.
|
@@ -192,7 +214,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
192
214
|
context = context.end();
|
193
215
|
},
|
194
216
|
|
195
|
-
/**
|
217
|
+
/** @private
|
196
218
|
Generates the image used to represent the image icon. override this to
|
197
219
|
return your own custom HTML
|
198
220
|
|
@@ -215,7 +237,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
215
237
|
context.begin('img').addClass('image').addClass(className).attr('src', url).end() ;
|
216
238
|
},
|
217
239
|
|
218
|
-
/**
|
240
|
+
/** @private
|
219
241
|
Generates the label used to represent the menu item. override this to
|
220
242
|
return your own custom HTML
|
221
243
|
|
@@ -231,19 +253,18 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
231
253
|
context.push("<span class='value ellipsis'>"+label+"</span>") ;
|
232
254
|
},
|
233
255
|
|
234
|
-
/**
|
256
|
+
/** @private
|
235
257
|
Generates the string used to represent the branch arrow. override this to
|
236
258
|
return your own custom HTML
|
237
259
|
|
238
260
|
@param {SC.RenderContext} context the render context
|
239
261
|
@returns {void}
|
240
262
|
*/
|
241
|
-
|
242
263
|
renderBranch: function(context) {
|
243
264
|
context.push('<span class="has-branch"></span>') ;
|
244
265
|
},
|
245
266
|
|
246
|
-
/**
|
267
|
+
/** @private
|
247
268
|
Generates the string used to represent the short cut keys. override this to
|
248
269
|
return your own custom HTML
|
249
270
|
|
@@ -258,9 +279,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
258
279
|
/**
|
259
280
|
This method will check whether the current Menu Item is still
|
260
281
|
selected and then create a submenu accordignly.
|
261
|
-
|
262
|
-
@param {}
|
263
|
-
@returns void
|
264
282
|
*/
|
265
283
|
showSubMenu: function() {
|
266
284
|
var subMenu = this.get('subMenu') ;
|
@@ -272,6 +290,13 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
272
290
|
this._subMenuTimer = null;
|
273
291
|
},
|
274
292
|
|
293
|
+
/**
|
294
|
+
The title from the content property.
|
295
|
+
|
296
|
+
@field
|
297
|
+
@type String
|
298
|
+
@observes content.title
|
299
|
+
*/
|
275
300
|
title: function() {
|
276
301
|
var ret = this.getContentProperty('itemTitleKey'),
|
277
302
|
localize = this.getPath('parentMenu.localize');
|
@@ -281,6 +306,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
281
306
|
return ret||'';
|
282
307
|
}.property('content.title').cacheable(),
|
283
308
|
|
309
|
+
/** @private */
|
284
310
|
getContentProperty: function(property) {
|
285
311
|
var content = this.get('content'),
|
286
312
|
menu = this.get('parentMenu');
|
@@ -290,10 +316,12 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
290
316
|
}
|
291
317
|
},
|
292
318
|
|
319
|
+
|
293
320
|
//..........................................
|
294
321
|
// Mouse Events Handling
|
295
322
|
//
|
296
323
|
|
324
|
+
/** @private */
|
297
325
|
mouseUp: function(evt) {
|
298
326
|
// SproutCore's event system will deliver the mouseUp event to the view
|
299
327
|
// that got the mouseDown event, but for menus we want to track the mouse,
|
@@ -349,9 +377,8 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
349
377
|
return YES;
|
350
378
|
},
|
351
379
|
|
352
|
-
/**
|
380
|
+
/** @private
|
353
381
|
Actually sends the action of the menu item to the target.
|
354
|
-
@private
|
355
382
|
*/
|
356
383
|
sendAction: function() {
|
357
384
|
var action = this.getContentProperty('itemActionKey'),
|
@@ -387,15 +414,13 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
387
414
|
|
388
415
|
},
|
389
416
|
|
390
|
-
/**
|
417
|
+
/** @private
|
391
418
|
Toggles the focus class name on the menu item layer to quickly flash the
|
392
419
|
highlight. This indicates to the user that a selection has been made.
|
393
420
|
|
394
421
|
This is initially called by performAction(). flashHighlight then keeps
|
395
422
|
track of how many flashes have occurred, and calls itself until a maximum
|
396
423
|
has been reached.
|
397
|
-
|
398
|
-
@private
|
399
424
|
*/
|
400
425
|
flashHighlight: function() {
|
401
426
|
var flashCounter = this._flashCounter, layer = this.$();
|
@@ -442,8 +467,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
442
467
|
|
443
468
|
/** @private
|
444
469
|
Set the focus based on whether the current menu item is selected or not.
|
445
|
-
|
446
|
-
@returns Boolean
|
447
470
|
*/
|
448
471
|
mouseExited: function(evt) {
|
449
472
|
var parentMenu, timer;
|
@@ -470,23 +493,28 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
470
493
|
return YES ;
|
471
494
|
},
|
472
495
|
|
496
|
+
/** @private */
|
473
497
|
touchStart: function(evt){
|
474
498
|
this.mouseEntered(evt);
|
475
499
|
return YES;
|
476
500
|
},
|
477
501
|
|
502
|
+
/** @private */
|
478
503
|
touchEnd: function(evt){
|
479
504
|
return this.mouseUp(evt);
|
480
505
|
},
|
481
506
|
|
507
|
+
/** @private */
|
482
508
|
touchEntered: function(evt){
|
483
509
|
return this.mouseEntered(evt);
|
484
510
|
},
|
485
511
|
|
512
|
+
/** @private */
|
486
513
|
touchExited: function(evt){
|
487
514
|
return this.mouseExited(evt);
|
488
515
|
},
|
489
516
|
|
517
|
+
/** @private */
|
490
518
|
checkMouseLocation: function() {
|
491
519
|
var subMenu = this.get('subMenu'), parentMenu = this.get('parentMenu'),
|
492
520
|
currentMenuItem, previousMenuItem;
|
@@ -507,8 +535,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
507
535
|
|
508
536
|
/** @private
|
509
537
|
Call the moveUp function on the parent Menu
|
510
|
-
|
511
|
-
@returns Boolean
|
512
538
|
*/
|
513
539
|
moveUp: function(sender,evt) {
|
514
540
|
var menu = this.get('parentMenu') ;
|
@@ -520,8 +546,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
520
546
|
|
521
547
|
/** @private
|
522
548
|
Call the moveDown function on the parent Menu
|
523
|
-
|
524
|
-
@returns Boolean
|
525
549
|
*/
|
526
550
|
moveDown: function(sender,evt) {
|
527
551
|
var menu = this.get('parentMenu') ;
|
@@ -533,8 +557,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
533
557
|
|
534
558
|
/** @private
|
535
559
|
Call the function to create a branch
|
536
|
-
|
537
|
-
@returns Boolean
|
538
560
|
*/
|
539
561
|
moveRight: function(sender,evt) {
|
540
562
|
this.showSubMenu() ;
|
@@ -595,8 +617,6 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
595
617
|
/**
|
596
618
|
Close the parent Menu and remove the focus of the current Selected
|
597
619
|
Menu Item
|
598
|
-
|
599
|
-
@returns void
|
600
620
|
*/
|
601
621
|
closeParent: function() {
|
602
622
|
this.$().removeClass('focus') ;
|
@@ -616,9 +636,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
616
636
|
// CONTENT OBSERVING
|
617
637
|
//
|
618
638
|
|
619
|
-
/**
|
620
|
-
@private
|
621
|
-
|
639
|
+
/** @private
|
622
640
|
Add an observer to ensure that we invalidate our cached properties
|
623
641
|
whenever the content object’s associated property changes.
|
624
642
|
*/
|
@@ -641,9 +659,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
641
659
|
}.observes('content'),
|
642
660
|
|
643
661
|
|
644
|
-
/**
|
645
|
-
@private
|
646
|
-
|
662
|
+
/** @private
|
647
663
|
Invalidate our cached property whenever the content object’s associated
|
648
664
|
property changes.
|
649
665
|
*/
|