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,8 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
+
sc_require('views/button');
|
9
|
+
|
8
10
|
/**
|
9
11
|
@class
|
10
12
|
|
@@ -18,27 +20,24 @@
|
|
18
20
|
@version 1.0
|
19
21
|
@author Mohammed Ashik
|
20
22
|
*/
|
21
|
-
sc_require('views/button');
|
22
|
-
|
23
23
|
SC.SelectButtonView = SC.ButtonView.extend(
|
24
24
|
/** @scope SC.SelectButtonView.prototype */ {
|
25
25
|
|
26
|
+
/**
|
27
|
+
@type Boolean
|
28
|
+
@default YES
|
29
|
+
*/
|
26
30
|
escapeHTML: YES,
|
27
31
|
|
28
32
|
/**
|
29
33
|
An array of items that will be form the menu you want to show.
|
30
34
|
|
31
|
-
@
|
32
|
-
@
|
35
|
+
@type Array
|
36
|
+
@default []
|
33
37
|
*/
|
34
38
|
objects: [],
|
35
39
|
|
36
|
-
/**
|
37
|
-
Binding default for an array of objects
|
38
|
-
|
39
|
-
@property
|
40
|
-
@default SC.Binding.multiple()
|
41
|
-
*/
|
40
|
+
/** @private */
|
42
41
|
objectsBindingDefault: SC.Binding.multiple(),
|
43
42
|
|
44
43
|
/**
|
@@ -46,8 +45,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
46
45
|
menu item will be pulled from the object using the named property.
|
47
46
|
if this is null, the collection objects themselves will be used.
|
48
47
|
|
49
|
-
@
|
50
|
-
@type {String}
|
48
|
+
@type String
|
51
49
|
@default: null
|
52
50
|
*/
|
53
51
|
nameKey: null,
|
@@ -57,8 +55,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
57
55
|
be used to sort the objects. If this is not set, then nameKey will
|
58
56
|
be used.
|
59
57
|
|
60
|
-
@property
|
61
|
-
@type: {String}
|
58
|
+
@property String}
|
62
59
|
@default: null
|
63
60
|
*/
|
64
61
|
sortKey: null,
|
@@ -68,27 +65,31 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
68
65
|
as the value for the options popup. If you don't set this, then the
|
69
66
|
objects themselves will be used as the value.
|
70
67
|
|
71
|
-
@
|
72
|
-
@type {String}
|
68
|
+
@type String
|
73
69
|
@default null
|
74
70
|
*/
|
75
71
|
valueKey: null,
|
76
72
|
|
77
73
|
/**
|
78
74
|
Key used to extract icons from the objects array
|
75
|
+
|
76
|
+
@type String
|
77
|
+
@default null
|
79
78
|
*/
|
80
79
|
iconKey: null,
|
81
80
|
|
82
81
|
/**
|
83
82
|
Key used to indicate if the item is to be enabled
|
84
|
-
|
83
|
+
|
84
|
+
@type String
|
85
|
+
@default "isEnabled"
|
86
|
+
*/
|
85
87
|
isEnabledKey: "isEnabled",
|
86
88
|
|
87
89
|
/**
|
88
90
|
If true, the empty name will be localized.
|
89
91
|
|
90
|
-
@
|
91
|
-
@type {Boolean}
|
92
|
+
@type Boolean
|
92
93
|
@default YES
|
93
94
|
*/
|
94
95
|
localize: YES,
|
@@ -97,21 +98,22 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
97
98
|
if true, it means that no sorting will occur, objects will appear
|
98
99
|
in the same order as in the array
|
99
100
|
|
100
|
-
@
|
101
|
-
@type {Boolean}
|
101
|
+
@type Boolean
|
102
102
|
@default YES
|
103
103
|
*/
|
104
104
|
disableSort: YES,
|
105
105
|
|
106
106
|
/**
|
107
|
-
|
108
107
|
@property
|
109
108
|
@default ['select-button']
|
109
|
+
@see SC.View#classNames
|
110
110
|
*/
|
111
111
|
classNames: ['select-button'],
|
112
112
|
|
113
113
|
/**
|
114
114
|
Menu attached to the selectButton
|
115
|
+
|
116
|
+
@type SC.View
|
115
117
|
@default SC.MenuView
|
116
118
|
*/
|
117
119
|
menu : null,
|
@@ -119,8 +121,8 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
119
121
|
/**
|
120
122
|
Menu item list
|
121
123
|
|
122
|
-
@
|
123
|
-
@
|
124
|
+
@type Array
|
125
|
+
@default []
|
124
126
|
*/
|
125
127
|
itemList: [],
|
126
128
|
|
@@ -128,8 +130,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
128
130
|
Property to set the index of the selected menu item. This in turn
|
129
131
|
is used to calculate the preferMatrix.
|
130
132
|
|
131
|
-
@
|
132
|
-
@type {Number}
|
133
|
+
@type Number
|
133
134
|
@default null
|
134
135
|
*/
|
135
136
|
itemIdx: null,
|
@@ -137,16 +138,16 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
137
138
|
/**
|
138
139
|
Current Value of the selectButton
|
139
140
|
|
140
|
-
@
|
141
|
+
@type Object
|
141
142
|
@default null
|
142
143
|
*/
|
143
|
-
value: null
|
144
|
+
value: null,
|
144
145
|
|
145
146
|
/**
|
146
147
|
if this property is set to 'YES', a checbox is shown next to the
|
147
148
|
selected menu item.
|
148
149
|
|
149
|
-
@
|
150
|
+
@type Boolean
|
150
151
|
@default YES
|
151
152
|
*/
|
152
153
|
checkboxEnabled: YES,
|
@@ -154,47 +155,39 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
154
155
|
/**
|
155
156
|
Set this property to required display positon of separator from bottom
|
156
157
|
|
157
|
-
@private
|
158
158
|
@default null
|
159
159
|
*/
|
160
160
|
separatorPosition: null,
|
161
161
|
|
162
|
-
/**
|
162
|
+
/** @private
|
163
163
|
Default value of the select button.
|
164
164
|
This will be the first item from the menu item list.
|
165
|
-
|
166
|
-
@private
|
167
165
|
*/
|
168
166
|
_defaultVal: null,
|
169
167
|
|
170
|
-
/**
|
168
|
+
/** @private
|
171
169
|
Default title of the select button.
|
172
170
|
This will be the title corresponding to the _defaultVal.
|
173
|
-
|
174
|
-
@private
|
175
171
|
*/
|
176
172
|
_defaultTitle: null,
|
177
173
|
|
178
|
-
/**
|
174
|
+
/** @private
|
179
175
|
Default icon of the select button.
|
180
176
|
This will be the icon corresponding to the _defaultVal.
|
181
|
-
|
182
|
-
@private
|
183
177
|
*/
|
184
178
|
_defaultIcon: null,
|
185
179
|
|
186
180
|
/**
|
187
|
-
@
|
188
|
-
|
189
|
-
The button theme will be popup
|
181
|
+
@property {String|SC.Theme}
|
182
|
+
@default 'popup'
|
190
183
|
*/
|
191
184
|
theme: 'popup',
|
192
185
|
|
193
186
|
/**
|
194
187
|
Render method gets triggered when these properties change
|
195
188
|
|
196
|
-
@
|
197
|
-
@
|
189
|
+
@type Array
|
190
|
+
@default ['icon', 'value','controlSize','objects', 'objects.[]']
|
198
191
|
*/
|
199
192
|
displayProperties: ['icon', 'value','controlSize','objects', 'objects.[]'],
|
200
193
|
|
@@ -204,10 +197,8 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
204
197
|
the button. The value at the second index(0) changes based on the
|
205
198
|
postion(index) of the menu item in the menu pane.
|
206
199
|
|
207
|
-
@
|
208
|
-
@type {Array}
|
200
|
+
@type Array
|
209
201
|
@default null
|
210
|
-
|
211
202
|
*/
|
212
203
|
preferMatrix: null,
|
213
204
|
|
@@ -216,55 +207,54 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
216
207
|
This has to be accounted for while calculating the actual
|
217
208
|
width of the button
|
218
209
|
|
219
|
-
@
|
220
|
-
@type {Number}
|
210
|
+
@type Number
|
221
211
|
@default 28
|
222
212
|
*/
|
223
213
|
SELECT_BUTTON_SPRITE_WIDTH: 28,
|
224
214
|
|
225
|
-
/**
|
215
|
+
/** @private
|
226
216
|
Binds the button's selection state to the menu's visibility.
|
227
|
-
|
228
|
-
@private
|
229
217
|
*/
|
230
218
|
isActiveBinding: '*menu.isVisibleInWindow',
|
231
219
|
|
232
|
-
/**
|
220
|
+
/** @private
|
233
221
|
If this property is set to 'YES', the menu pane will be positioned
|
234
222
|
below the anchor.
|
235
|
-
|
236
|
-
@private
|
237
|
-
@default NO
|
238
223
|
*/
|
239
224
|
isDefaultPosition: NO,
|
240
225
|
|
241
|
-
/**
|
226
|
+
/** @private
|
242
227
|
lastMenuWidth is the width of the last menu which was created from
|
243
228
|
the objects of this select button.
|
244
|
-
|
245
|
-
@private
|
246
229
|
*/
|
247
230
|
lastMenuWidth: null,
|
248
231
|
|
249
232
|
/**
|
250
233
|
customView used to draw the menu
|
234
|
+
|
235
|
+
@type SC.View
|
236
|
+
@default null
|
251
237
|
*/
|
252
238
|
customView: null,
|
253
239
|
|
254
240
|
/**
|
255
|
-
|
241
|
+
CSS classes applied to customView
|
242
|
+
|
243
|
+
@type String
|
244
|
+
@default null
|
256
245
|
*/
|
257
246
|
customViewClassName: null,
|
258
247
|
|
259
248
|
/**
|
260
249
|
customView menu offset width
|
250
|
+
|
251
|
+
@type Number
|
252
|
+
@default 0
|
261
253
|
*/
|
262
254
|
customViewMenuOffsetWidth: 0,
|
263
255
|
|
264
256
|
/**
|
265
|
-
|
266
|
-
|
267
|
-
@private
|
257
|
+
@type Boolean
|
268
258
|
@default YES
|
269
259
|
*/
|
270
260
|
needsEllipsis: YES,
|
@@ -273,29 +263,29 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
273
263
|
This property allows you at add extra padding to the height
|
274
264
|
of the menu pane.
|
275
265
|
|
266
|
+
@type Number
|
276
267
|
@default 0
|
277
|
-
@property {Number} heightPadding for menu pane.
|
278
268
|
*/
|
279
269
|
menuPaneHeightPadding: 0,
|
280
270
|
|
281
271
|
/**
|
282
272
|
This is a property to enable/disable focus rings in buttons.
|
283
273
|
For select_button we are making it a default.
|
284
|
-
|
274
|
+
|
275
|
+
@type Boolean
|
285
276
|
@default YES
|
286
277
|
*/
|
287
278
|
supportFocusRing: YES,
|
288
279
|
|
289
280
|
/**
|
290
|
-
|
281
|
+
@type Boolean
|
282
|
+
@default NO
|
291
283
|
*/
|
292
284
|
isContextMenuEnabled: NO,
|
293
285
|
|
294
286
|
|
295
|
-
|
287
|
+
/**@private
|
296
288
|
Left Alignment based on the size of the button
|
297
|
-
|
298
|
-
@private
|
299
289
|
*/
|
300
290
|
leftAlign: function() {
|
301
291
|
switch (this.get('controlSize')) {
|
@@ -317,7 +307,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
317
307
|
override this method to implement your own sorting of the menu. By
|
318
308
|
default, menu items are sorted using the value shown or the sortKey
|
319
309
|
|
320
|
-
@param{SC.Array} objects the unsorted array of objects to display.
|
310
|
+
@param {SC.Array} objects the unsorted array of objects to display.
|
321
311
|
@returns sorted array of objects
|
322
312
|
*/
|
323
313
|
sortObjects: function(objects) {
|
@@ -331,15 +321,11 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
331
321
|
return (a<b) ? -1 : ((a>b) ? 1 : 0) ;
|
332
322
|
}) ;
|
333
323
|
}
|
334
|
-
return objects
|
324
|
+
return objects;
|
335
325
|
},
|
336
326
|
|
337
|
-
/**
|
338
|
-
|
339
|
-
|
340
|
-
@private
|
341
|
-
*/
|
342
|
-
render: function(context,firstTime) {
|
327
|
+
/** @private */
|
328
|
+
render: function(context, firstTime) {
|
343
329
|
sc_super();
|
344
330
|
var layoutWidth, objects, len, nameKey, iconKey, valueKey, checkboxEnabled,
|
345
331
|
currentSelectedVal, shouldLocalize, separatorPosition, itemList, isChecked,
|
@@ -478,13 +464,13 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
478
464
|
|
479
465
|
},
|
480
466
|
|
481
|
-
/**
|
482
|
-
Compares the the two values.
|
467
|
+
/** @private
|
468
|
+
Compares the the two values.
|
483
469
|
|
484
470
|
This function can be overridden if the value of the Select Button field
|
485
471
|
is an object.
|
486
472
|
*/
|
487
|
-
_equals: function
|
473
|
+
_equals: function(value1, value2) {
|
488
474
|
var ret = YES;
|
489
475
|
if (value1 && SC.typeOf(value1) === SC.T_HASH &&
|
490
476
|
value2 && SC.typeOf(value2) === SC.T_HASH) {
|
@@ -496,14 +482,12 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
496
482
|
return ret;
|
497
483
|
},
|
498
484
|
|
499
|
-
/**
|
485
|
+
/** @private
|
500
486
|
Button action handler
|
501
|
-
|
502
|
-
@private
|
487
|
+
|
503
488
|
@param {DOMMouseEvent} evt mouseup event that triggered the action
|
504
489
|
*/
|
505
|
-
_action: function(
|
506
|
-
{
|
490
|
+
_action: function(evt) {
|
507
491
|
var buttonLabel, menuWidth, scrollWidth, lastMenuWidth, offsetWidth,
|
508
492
|
items, elementOffsetWidth, largestMenuWidth, item, element, idx,
|
509
493
|
value, itemList, menuControlSize, menuHeightPadding, customView,
|
@@ -642,7 +626,6 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
642
626
|
|
643
627
|
/**
|
644
628
|
Action method for the select button menu items
|
645
|
-
|
646
629
|
*/
|
647
630
|
displaySelectedItem: function(menuView) {
|
648
631
|
var currentItem = this.getPath('menu.selectedItem');
|
@@ -722,9 +705,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
722
705
|
}
|
723
706
|
},
|
724
707
|
|
725
|
-
/**
|
726
|
-
@private
|
727
|
-
|
708
|
+
/** @private
|
728
709
|
Holding down the button should display the menu pane.
|
729
710
|
*/
|
730
711
|
mouseDown: function(evt) {
|
@@ -813,16 +794,14 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
813
794
|
return YES;
|
814
795
|
},
|
815
796
|
|
816
|
-
/**
|
797
|
+
/** @private
|
817
798
|
Override mouseExited to not remove the active state on mouseexit.
|
818
799
|
*/
|
819
800
|
mouseExited: function() {
|
820
801
|
return YES;
|
821
802
|
},
|
822
803
|
|
823
|
-
/**
|
824
|
-
@private
|
825
|
-
|
804
|
+
/** @private
|
826
805
|
Handle Key event - Down arrow key
|
827
806
|
*/
|
828
807
|
keyDown: function(event) {
|
@@ -834,9 +813,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
834
813
|
}
|
835
814
|
},
|
836
815
|
|
837
|
-
/**
|
838
|
-
@private
|
839
|
-
|
816
|
+
/** @private
|
840
817
|
Pressing the Up or Down arrow key should display the menu pane
|
841
818
|
*/
|
842
819
|
interpretKeyEvents: function(event) {
|
@@ -851,7 +828,9 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
851
828
|
return sc_super();
|
852
829
|
},
|
853
830
|
|
854
|
-
/**
|
831
|
+
/** @private
|
832
|
+
Function overridden - tied to the isEnabled state
|
833
|
+
*/
|
855
834
|
acceptsFirstResponder: function() {
|
856
835
|
return this.get('isEnabled');
|
857
836
|
}.property('isEnabled'),
|
@@ -864,32 +843,108 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
864
843
|
|
865
844
|
}.observes('isSelected'),
|
866
845
|
|
867
|
-
|
868
|
-
}
|
846
|
+
/** @private */
|
847
|
+
didAppendToDocument: function() {}
|
869
848
|
|
870
849
|
}) ;
|
871
850
|
|
872
851
|
/**
|
873
|
-
|
852
|
+
@static
|
853
|
+
@default 0
|
874
854
|
*/
|
875
855
|
SC.SelectButtonView.TINY_OFFSET_X = 0;
|
856
|
+
|
857
|
+
/**
|
858
|
+
@static
|
859
|
+
@default 0
|
860
|
+
*/
|
876
861
|
SC.SelectButtonView.TINY_OFFSET_Y = 0;
|
862
|
+
|
863
|
+
/**
|
864
|
+
@static
|
865
|
+
@default 0
|
866
|
+
*/
|
877
867
|
SC.SelectButtonView.TINY_POPUP_MENU_WIDTH_OFFSET = 0;
|
878
868
|
|
869
|
+
|
870
|
+
/**
|
871
|
+
@static
|
872
|
+
@default -18
|
873
|
+
*/
|
879
874
|
SC.SelectButtonView.SMALL_OFFSET_X = -18;
|
875
|
+
|
876
|
+
/**
|
877
|
+
@static
|
878
|
+
@default 3
|
879
|
+
*/
|
880
880
|
SC.SelectButtonView.SMALL_OFFSET_Y = 3;
|
881
|
+
|
882
|
+
/**
|
883
|
+
@static
|
884
|
+
@default 7
|
885
|
+
*/
|
881
886
|
SC.SelectButtonView.SMALL_POPUP_MENU_WIDTH_OFFSET = 7;
|
882
887
|
|
888
|
+
|
889
|
+
/**
|
890
|
+
@static
|
891
|
+
@default -17
|
892
|
+
*/
|
883
893
|
SC.SelectButtonView.REGULAR_OFFSET_X = -17;
|
894
|
+
|
895
|
+
/**
|
896
|
+
@static
|
897
|
+
@default 3
|
898
|
+
*/
|
884
899
|
SC.SelectButtonView.REGULAR_OFFSET_Y = 3;
|
900
|
+
|
901
|
+
/**
|
902
|
+
@static
|
903
|
+
@default 4
|
904
|
+
*/
|
885
905
|
SC.SelectButtonView.REGULAR_POPUP_MENU_WIDTH_OFFSET = 4;
|
886
906
|
|
907
|
+
|
908
|
+
/**
|
909
|
+
@static
|
910
|
+
@default -17
|
911
|
+
*/
|
887
912
|
SC.SelectButtonView.LARGE_OFFSET_X = -17;
|
913
|
+
|
914
|
+
/**
|
915
|
+
@static
|
916
|
+
@default 6
|
917
|
+
*/
|
888
918
|
SC.SelectButtonView.LARGE_OFFSET_Y = 6;
|
919
|
+
|
920
|
+
/**
|
921
|
+
@static
|
922
|
+
@default 3
|
923
|
+
*/
|
889
924
|
SC.SelectButtonView.LARGE_POPUP_MENU_WIDTH_OFFSET = 3;
|
890
925
|
|
926
|
+
|
927
|
+
/**
|
928
|
+
@static
|
929
|
+
@default 0
|
930
|
+
*/
|
891
931
|
SC.SelectButtonView.HUGE_OFFSET_X = 0;
|
932
|
+
|
933
|
+
/**
|
934
|
+
@static
|
935
|
+
@default 0
|
936
|
+
*/
|
892
937
|
SC.SelectButtonView.HUGE_OFFSET_Y = 0;
|
938
|
+
|
939
|
+
/**
|
940
|
+
@static
|
941
|
+
@default 0
|
942
|
+
*/
|
893
943
|
SC.SelectButtonView.HUGE_POPUP_MENU_WIDTH_OFFSET = 0;
|
894
944
|
|
945
|
+
|
946
|
+
/**
|
947
|
+
@static
|
948
|
+
@default -2
|
949
|
+
*/
|
895
950
|
SC.SelectButtonView.MENU_WIDTH_OFFSET = -2;
|
@@ -5,21 +5,20 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
8
|
sc_require('panes/panel');
|
10
9
|
|
11
10
|
/**
|
11
|
+
@class
|
12
|
+
|
12
13
|
Displays a modal sheet pane that animates from the top of the viewport.
|
13
14
|
|
14
15
|
The default way to use the sheet pane is to simply add it to your page like this:
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
})
|
21
|
-
}).append();
|
22
|
-
}}}
|
17
|
+
SC.SheetPane.create({
|
18
|
+
layout: { width: 400, height: 200, centerX: 0 },
|
19
|
+
contentView: SC.View.extend({
|
20
|
+
})
|
21
|
+
}).append();
|
23
22
|
|
24
23
|
This will cause your sheet panel to display. The default layout for a Sheet
|
25
24
|
is to cover the entire document window with a semi-opaque background, and to
|
@@ -30,21 +29,33 @@ sc_require('panes/panel');
|
|
30
29
|
@author Evin Grano
|
31
30
|
@author Tom Dale
|
32
31
|
*/
|
33
|
-
SC.SheetPane = SC.PanelPane.extend(
|
34
|
-
|
32
|
+
SC.SheetPane = SC.PanelPane.extend(
|
33
|
+
/** @scope SC.SheetPane.prototype */{
|
34
|
+
|
35
|
+
/**
|
36
|
+
@type Array
|
37
|
+
@default ['sc-sheet']
|
38
|
+
@see SC.View#classNames
|
39
|
+
*/
|
40
|
+
classNames: ['sc-sheet'],
|
35
41
|
|
36
|
-
/**
|
42
|
+
/**
|
43
|
+
@type SC.View
|
44
|
+
@default SC.ModalPane
|
45
|
+
*/
|
37
46
|
modalPane: SC.ModalPane,
|
38
47
|
|
39
48
|
/**
|
40
49
|
Speed of transition. Should be expressed in msec.
|
41
50
|
|
42
|
-
@
|
51
|
+
@type Number
|
52
|
+
@default 200
|
43
53
|
*/
|
44
54
|
transitionDuration: 200,
|
45
55
|
|
46
56
|
_state: 'NO_VIEW', // no view
|
47
57
|
|
58
|
+
/** @private */
|
48
59
|
init: function() {
|
49
60
|
sc_super();
|
50
61
|
|
@@ -102,7 +113,7 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
102
113
|
return this;
|
103
114
|
},
|
104
115
|
|
105
|
-
/**
|
116
|
+
/** @private
|
106
117
|
Once the pane has been rendered out to the DOM, begin the animation.
|
107
118
|
*/
|
108
119
|
paneDidAttach: function() {
|
@@ -113,6 +124,7 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
113
124
|
return ret;
|
114
125
|
},
|
115
126
|
|
127
|
+
/** @private */
|
116
128
|
slideDown: function(){
|
117
129
|
// setup other general state
|
118
130
|
this._state = SC.SheetPane.ANIMATING;
|
@@ -127,6 +139,7 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
127
139
|
}
|
128
140
|
},
|
129
141
|
|
142
|
+
/** @private */
|
130
143
|
slideUp: function(){
|
131
144
|
// setup other general state
|
132
145
|
this._state = SC.SheetPane.ANIMATING;
|
@@ -142,6 +155,7 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
142
155
|
}
|
143
156
|
},
|
144
157
|
|
158
|
+
/** @private */
|
145
159
|
_complete: function() {
|
146
160
|
var dir = this._direction;
|
147
161
|
|
@@ -164,11 +178,17 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
164
178
|
this.updateLayout();
|
165
179
|
},
|
166
180
|
|
167
|
-
|
181
|
+
/** @private
|
182
|
+
Needed because of the runLoop and that it is animated...
|
183
|
+
must lose focus because will break if selection is change
|
184
|
+
on text fields that don't move.
|
185
|
+
*/
|
168
186
|
blurTo: function(pane) { this.setFirstResponder(''); },
|
169
187
|
|
170
|
-
/** @private
|
171
|
-
|
188
|
+
/** @private
|
189
|
+
Called while the animation runs. Will move the content view
|
190
|
+
down until it is in position and then set the layout to the content layout
|
191
|
+
*/
|
172
192
|
tick: function() {
|
173
193
|
this._timer = null ; // clear out
|
174
194
|
|
@@ -198,9 +218,11 @@ SC.SheetPane = SC.PanelPane.extend({
|
|
198
218
|
target.updateLayout();
|
199
219
|
return this;
|
200
220
|
}
|
221
|
+
|
201
222
|
});
|
202
223
|
|
203
|
-
SC.SheetPane.mixin(
|
224
|
+
SC.SheetPane.mixin(
|
225
|
+
/** @scope SC.SheetPane */ {
|
204
226
|
|
205
227
|
ANIMATABLE_AVAILABLE: NO,
|
206
228
|
|