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,13 +5,39 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
/**
|
9
|
+
@static
|
10
|
+
@constant
|
11
|
+
@type String
|
12
|
+
*/
|
11
13
|
SC.TOGGLE_BEHAVIOR = 'toggle';
|
14
|
+
|
15
|
+
/**
|
16
|
+
@static
|
17
|
+
@constant
|
18
|
+
@type String
|
19
|
+
*/
|
12
20
|
SC.PUSH_BEHAVIOR = 'push';
|
21
|
+
|
22
|
+
/**
|
23
|
+
@static
|
24
|
+
@constant
|
25
|
+
@type String
|
26
|
+
*/
|
13
27
|
SC.TOGGLE_ON_BEHAVIOR = 'on';
|
28
|
+
|
29
|
+
/**
|
30
|
+
@static
|
31
|
+
@constant
|
32
|
+
@type String
|
33
|
+
*/
|
14
34
|
SC.TOGGLE_OFF_BEHAVIOR = 'off';
|
35
|
+
|
36
|
+
/**
|
37
|
+
@static
|
38
|
+
@constant
|
39
|
+
@type String
|
40
|
+
*/
|
15
41
|
SC.HOLD_BEHAVIOR = 'hold';
|
16
42
|
|
17
43
|
/** @class
|
@@ -34,10 +60,20 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
34
60
|
/** @scope SC.ButtonView.prototype */ {
|
35
61
|
|
36
62
|
/**
|
37
|
-
|
38
|
-
|
63
|
+
Tied to the isEnabled state
|
64
|
+
|
65
|
+
@type Boolean
|
66
|
+
@default YES
|
67
|
+
*/
|
68
|
+
acceptsFirstResponder: function() {
|
69
|
+
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
70
|
+
else return NO;
|
71
|
+
}.property('isEnabled'),
|
39
72
|
|
40
|
-
|
73
|
+
/**
|
74
|
+
@type Array
|
75
|
+
@default ['sc-button-view']
|
76
|
+
@see SC.View#classNames
|
41
77
|
*/
|
42
78
|
classNames: ['sc-button-view'],
|
43
79
|
|
@@ -45,12 +81,14 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
45
81
|
The theme to apply to the button. By default, a subtheme with the name of
|
46
82
|
'square' is created for backwards-compatibility.
|
47
83
|
|
48
|
-
@
|
84
|
+
@type String
|
85
|
+
@default 'square'
|
49
86
|
*/
|
50
87
|
themeName: 'square',
|
51
88
|
|
89
|
+
|
52
90
|
// ..........................................................
|
53
|
-
//
|
91
|
+
// Value Handling
|
54
92
|
//
|
55
93
|
|
56
94
|
/**
|
@@ -65,50 +103,52 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
65
103
|
YES or NO, the button will do its best to convert a value to an
|
66
104
|
appropriate state:
|
67
105
|
|
68
|
-
|
69
|
-
|
70
|
-
|
106
|
+
- null, false, 0 -> isSelected = false
|
107
|
+
- any other single value -> isSelected = true
|
108
|
+
- array -> if all values are the same state: that state. otherwise MIXED.
|
71
109
|
|
72
|
-
@
|
110
|
+
@type Object
|
111
|
+
@default null
|
73
112
|
*/
|
74
113
|
value: null,
|
75
114
|
|
76
115
|
/**
|
77
116
|
Value of a selected toggle button.
|
78
|
-
|
79
|
-
|
80
|
-
will be selected if the value property equals the targetValue.
|
117
|
+
|
118
|
+
For a toggle button, set this to any object value you want. The button
|
119
|
+
will be selected if the value property equals the targetValue. If the
|
81
120
|
value is an array of multiple items that contains the targetValue, then
|
82
121
|
the button will be set to a mixed state.
|
83
|
-
|
122
|
+
|
84
123
|
default is YES
|
85
124
|
|
86
|
-
@
|
125
|
+
@type Boolean|Object
|
126
|
+
@default YES
|
87
127
|
*/
|
88
128
|
toggleOnValue: YES,
|
89
129
|
|
90
130
|
/**
|
91
131
|
Value of an unselected toggle button.
|
92
|
-
|
132
|
+
|
93
133
|
For a toggle button, set this to any object value you want. When the
|
94
134
|
user toggle's the button off, the value of the button will be set to this
|
95
135
|
value.
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
@property {Object}
|
136
|
+
|
137
|
+
@type Boolean|Object
|
138
|
+
@default NO
|
100
139
|
*/
|
101
140
|
toggleOffValue: NO,
|
102
141
|
|
103
142
|
|
104
143
|
// ..........................................................
|
105
|
-
//
|
144
|
+
// Title Handling
|
106
145
|
//
|
107
146
|
|
108
147
|
/**
|
109
148
|
If YES, then the title will be localized.
|
110
149
|
|
111
|
-
@
|
150
|
+
@type Boolean
|
151
|
+
@default NO
|
112
152
|
*/
|
113
153
|
localize: NO,
|
114
154
|
|
@@ -118,24 +158,27 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
118
158
|
/**
|
119
159
|
The button title. If localize is YES, then this should be the localization key to display. Otherwise, this will be the actual string displayed in the title. This property is observable and bindable.
|
120
160
|
|
121
|
-
@
|
122
|
-
|
123
|
-
|
161
|
+
@type String
|
162
|
+
@default ""
|
163
|
+
*/
|
164
|
+
title: "",
|
124
165
|
|
125
166
|
/**
|
126
|
-
If
|
167
|
+
If set, the title property will be updated automatically
|
127
168
|
from the content using the key you specify.
|
128
169
|
|
129
|
-
@
|
170
|
+
@type String
|
171
|
+
@default null
|
130
172
|
*/
|
131
173
|
contentTitleKey: null,
|
132
174
|
|
133
175
|
/**
|
134
|
-
The button icon.
|
135
|
-
spriting).
|
176
|
+
The button icon. Set this to either a URL or a CSS class name (for
|
177
|
+
spriting). Note that if you pass a URL, it must contain at
|
136
178
|
least one slash to be detected as such.
|
137
179
|
|
138
|
-
@
|
180
|
+
@type String
|
181
|
+
@default null
|
139
182
|
*/
|
140
183
|
icon: null,
|
141
184
|
|
@@ -143,24 +186,27 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
143
186
|
If you set this property, the icon will be updated automatically from the
|
144
187
|
content using the key you specify.
|
145
188
|
|
146
|
-
@
|
189
|
+
@type String
|
190
|
+
@default null
|
147
191
|
*/
|
148
192
|
contentIconKey: null,
|
149
193
|
|
150
194
|
/**
|
151
|
-
If YES, button will attempt to display an ellipsis if the title cannot
|
152
|
-
fit inside of the visible area.
|
195
|
+
If YES, button will attempt to display an ellipsis if the title cannot
|
196
|
+
fit inside of the visible area. This feature is not available on all
|
153
197
|
browsers.
|
154
198
|
|
155
|
-
@
|
199
|
+
@type Boolean
|
200
|
+
@default YES
|
156
201
|
*/
|
157
202
|
needsEllipsis: YES,
|
158
203
|
|
159
204
|
/**
|
160
|
-
|
161
|
-
property if necessary.
|
205
|
+
This is generated by localizing the title property if necessary.
|
162
206
|
|
163
|
-
@
|
207
|
+
@type String
|
208
|
+
@observes 'title'
|
209
|
+
@observes 'localize'
|
164
210
|
*/
|
165
211
|
displayTitle: function() {
|
166
212
|
var ret = this.get('title');
|
@@ -170,10 +216,12 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
170
216
|
/**
|
171
217
|
The key equivalent that should trigger this button on the page.
|
172
218
|
|
173
|
-
@
|
219
|
+
@type String
|
220
|
+
@default null
|
174
221
|
*/
|
175
222
|
keyEquivalent: null,
|
176
223
|
|
224
|
+
|
177
225
|
// ..........................................................
|
178
226
|
// BEHAVIOR
|
179
227
|
//
|
@@ -182,18 +230,20 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
182
230
|
The behavioral mode of this button.
|
183
231
|
|
184
232
|
Possible values are:
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
233
|
+
|
234
|
+
- *SC.PUSH_BEHAVIOR* Pressing the button will trigger an action tied to the
|
235
|
+
button. Does not change the value of the button.
|
236
|
+
- *SC.TOGGLE_BEHAVIOR* Pressing the button will invert the current value of
|
237
|
+
the button. If the button has a mixed value, it will be set to true.
|
238
|
+
- *SC.TOGGLE_ON_BEHAVIOR* Pressing the button will set the current state to
|
239
|
+
true no matter the previous value.
|
240
|
+
- *SC.TOGGLE_OFF_BEHAVIOR* Pressing the button will set the current state to
|
241
|
+
false no matter the previous value.
|
242
|
+
- *SC.HOLD_BEHAVIOR* Pressing the button will cause the action to repeat at a
|
243
|
+
regular interval specifed by 'holdInterval'
|
244
|
+
|
245
|
+
@type String
|
246
|
+
@default SC.PUSH_BEHAVIOR
|
197
247
|
*/
|
198
248
|
buttonBehavior: SC.PUSH_BEHAVIOR,
|
199
249
|
|
@@ -201,7 +251,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
201
251
|
If buttonBehavior is SC.HOLD_BEHAVIOR, this specifies, in milliseconds,
|
202
252
|
how often to trigger the action. Ignored for other behaviors.
|
203
253
|
|
204
|
-
@
|
254
|
+
@type Number
|
255
|
+
@default 100
|
205
256
|
*/
|
206
257
|
holdInterval: 100,
|
207
258
|
|
@@ -211,7 +262,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
211
262
|
This is the same as setting the keyEquivalent to 'return'. This will also
|
212
263
|
apply the "def" classname to the button.
|
213
264
|
|
214
|
-
@
|
265
|
+
@type Boolean
|
266
|
+
@default NO
|
215
267
|
*/
|
216
268
|
isDefault: NO,
|
217
269
|
isDefaultBindingDefault: SC.Binding.oneWay().bool(),
|
@@ -220,7 +272,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
220
272
|
If YES, then this button will be triggered when you hit escape.
|
221
273
|
This is the same as setting the keyEquivalent to 'escape'.
|
222
274
|
|
223
|
-
@
|
275
|
+
@type Boolean
|
276
|
+
@default NO
|
224
277
|
*/
|
225
278
|
isCancel: NO,
|
226
279
|
isCancelBindingDefault: SC.Binding.oneWay().bool(),
|
@@ -242,7 +295,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
242
295
|
clicked. It is generally better to use the target/action approach and
|
243
296
|
to implement your code in a controller of some type.
|
244
297
|
|
245
|
-
@
|
298
|
+
@type String
|
299
|
+
@default null
|
246
300
|
*/
|
247
301
|
action: null,
|
248
302
|
|
@@ -254,52 +308,44 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
254
308
|
null, then the button will search the responder chain for a view that
|
255
309
|
implements the action when the button is pressed instead.
|
256
310
|
|
257
|
-
@
|
311
|
+
@type Object
|
312
|
+
@default null
|
258
313
|
*/
|
259
314
|
target: null,
|
260
315
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
TODO: When is this property ever changed? Is this redundant with
|
316
|
+
/*
|
317
|
+
TODO When is this property ever changed? Is this redundant with
|
265
318
|
render delegates since it can now be turned on on a theme-by-theme
|
266
319
|
basis? --TD
|
320
|
+
*/
|
321
|
+
/**
|
322
|
+
If YES, use a focus ring.
|
267
323
|
|
268
|
-
@
|
324
|
+
@type Boolean
|
325
|
+
@default NO
|
269
326
|
*/
|
270
327
|
supportFocusRing: NO,
|
271
328
|
|
272
|
-
//
|
329
|
+
// ..........................................................
|
273
330
|
// Auto Resize Support
|
331
|
+
//
|
332
|
+
//
|
274
333
|
// These properties are provided so that SC.AutoResize can be mixed in
|
275
334
|
// to enable automatic resizing of the button.
|
276
335
|
//
|
277
|
-
/**
|
278
|
-
SC.ButtonView supports automatic resizing.
|
279
336
|
|
280
|
-
|
281
|
-
@property
|
282
|
-
*/
|
337
|
+
/** @private */
|
283
338
|
supportsAutoResize: YES,
|
284
339
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
TODO: get this from the render delegate so other elements may be used.
|
289
|
-
|
290
|
-
@private
|
291
|
-
@property
|
340
|
+
/*
|
341
|
+
TODO get this from the render delegate so other elements may be used.
|
292
342
|
*/
|
343
|
+
/** @private */
|
293
344
|
autoResizeLayer: function() {
|
294
345
|
return this.get('layer');
|
295
346
|
}.property('layer').cacheable(),
|
296
347
|
|
297
|
-
/**
|
298
|
-
The text to be used to automatically resize the view: the displayTitle.
|
299
|
-
|
300
|
-
@private
|
301
|
-
@property
|
302
|
-
*/
|
348
|
+
/** @private */
|
303
349
|
autoResizeText: function() {
|
304
350
|
return this.get('displayTitle');
|
305
351
|
}.property('displayTitle').cacheable(),
|
@@ -312,7 +358,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
312
358
|
to 10.
|
313
359
|
|
314
360
|
@default 10
|
315
|
-
@
|
361
|
+
@type Number
|
316
362
|
*/
|
317
363
|
autoResizePadding: SC.propertyFromRenderDelegate('autoResizePadding', 10),
|
318
364
|
|
@@ -330,7 +376,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
330
376
|
Does nothing if the button is disabled.
|
331
377
|
|
332
378
|
@param {Event} evt
|
333
|
-
@returns {Boolean}
|
379
|
+
@returns {Boolean} YES if successful, NO otherwise
|
334
380
|
*/
|
335
381
|
triggerActionAfterDelay: function(evt) {
|
336
382
|
// If this button is disabled, we have nothing to do
|
@@ -365,6 +411,9 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
365
411
|
*/
|
366
412
|
didTriggerAction: function() {},
|
367
413
|
|
414
|
+
/*
|
415
|
+
TODO Why is this not set by the theme? --TD
|
416
|
+
*/
|
368
417
|
/**
|
369
418
|
The minimum width the button title should consume. This property is used
|
370
419
|
when generating the HTML styling for the title itself. The default
|
@@ -374,15 +423,16 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
374
423
|
Note that the title width does not exactly match the width of the button
|
375
424
|
itself. Extra padding added by the theme can impact the final total
|
376
425
|
size.
|
377
|
-
|
378
|
-
TODO: Why is this not set by the theme? --TD
|
379
426
|
|
380
|
-
@
|
427
|
+
@type Number
|
428
|
+
@default 80
|
381
429
|
*/
|
382
430
|
titleMinWidth: 80,
|
383
431
|
|
432
|
+
|
384
433
|
// ................................................................
|
385
434
|
// INTERNAL SUPPORT
|
435
|
+
//
|
386
436
|
|
387
437
|
/** @private - save keyEquivalent for later use */
|
388
438
|
init: function() {
|
@@ -398,11 +448,15 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
398
448
|
|
399
449
|
// if value is not null, update isSelected to match value. If value is
|
400
450
|
// null, we assume you may be using isSelected only.
|
401
|
-
if (!SC.none(this.get('value'))) this._button_valueDidChange();
|
451
|
+
if (!SC.none(this.get('value'))) this._button_valueDidChange();
|
402
452
|
},
|
403
453
|
|
404
454
|
/**
|
405
455
|
The WAI-ARIA role of the button.
|
456
|
+
|
457
|
+
@type String
|
458
|
+
@default 'button'
|
459
|
+
@readOnly
|
406
460
|
*/
|
407
461
|
ariaRole: 'button',
|
408
462
|
|
@@ -410,11 +464,15 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
410
464
|
// isCancel and isDefault also cause a refresh but this is implemented as
|
411
465
|
// a separate observer (see below)
|
412
466
|
|
413
|
-
/**
|
467
|
+
/**
|
414
468
|
The following properties affect how SC.ButtonView is rendered, and will
|
415
469
|
cause the view to be rerendered if they change.
|
416
470
|
|
417
|
-
@
|
471
|
+
@type Array
|
472
|
+
@default [
|
473
|
+
'icon', 'displayTitle', 'value', 'displayToolTip', 'isDefault', 'isCancel',
|
474
|
+
'escapeHTML', 'needsEllipsis', 'hint', 'titleMinWidth', 'supportFocusRing'
|
475
|
+
]
|
418
476
|
*/
|
419
477
|
displayProperties: [
|
420
478
|
'icon', 'displayTitle', 'value', 'displayToolTip', 'isDefault', 'isCancel',
|
@@ -428,16 +486,17 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
428
486
|
In this case, the 'button' property will be retrieved from the theme and
|
429
487
|
set to the render delegate of this view.
|
430
488
|
|
431
|
-
@
|
489
|
+
@type String
|
490
|
+
@default 'buttonRenderDelegate'
|
432
491
|
*/
|
433
492
|
renderDelegateName: 'buttonRenderDelegate',
|
434
493
|
|
435
494
|
/**
|
436
|
-
Updates the value, title, and icon keys based on the content object, if
|
495
|
+
Updates the value, title, and icon keys based on the content object, if
|
437
496
|
set.
|
438
497
|
|
439
|
-
@
|
440
|
-
@
|
498
|
+
@type {Object} target the target of the object that changed
|
499
|
+
@type {String} key name of property that changed
|
441
500
|
@returns {SC.ButtonView} receiver
|
442
501
|
*/
|
443
502
|
contentPropertyDidChange: function(target, key) {
|
@@ -540,7 +599,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
540
599
|
return state ;
|
541
600
|
},
|
542
601
|
|
543
|
-
|
602
|
+
/** @private
|
544
603
|
Whenever the button value changes, update the selected state to match.
|
545
604
|
*/
|
546
605
|
_button_valueDidChange: function() {
|
@@ -573,7 +632,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
573
632
|
keyEquivalent property to 'return'. This cached value is used to restore
|
574
633
|
the keyEquivalent property if isDefault is set back to NO.
|
575
634
|
|
576
|
-
@
|
635
|
+
@type String
|
577
636
|
*/
|
578
637
|
_defaultKeyEquivalent: null,
|
579
638
|
|
@@ -616,7 +675,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
616
675
|
}
|
617
676
|
}
|
618
677
|
|
619
|
-
return YES
|
678
|
+
return YES;
|
620
679
|
},
|
621
680
|
|
622
681
|
/** @private
|
@@ -654,6 +713,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
654
713
|
return YES ;
|
655
714
|
},
|
656
715
|
|
716
|
+
/** @private */
|
657
717
|
touchStart: function(touch){
|
658
718
|
var buttonBehavior = this.get('buttonBehavior');
|
659
719
|
|
@@ -676,6 +736,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
676
736
|
return YES;
|
677
737
|
},
|
678
738
|
|
739
|
+
/** @private */
|
679
740
|
touchesDragged: function(evt, touches) {
|
680
741
|
if (!this.touchIsInBoundary(evt)) {
|
681
742
|
if (!this._touch_exited) this.set('isActive', NO);
|
@@ -689,6 +750,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
689
750
|
return YES;
|
690
751
|
},
|
691
752
|
|
753
|
+
/** @private */
|
692
754
|
touchEnd: function(touch){
|
693
755
|
this._touch_exited = NO;
|
694
756
|
this.set('isActive', NO); // track independently in case isEnabled has changed
|
@@ -703,7 +765,6 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
703
765
|
return YES ;
|
704
766
|
},
|
705
767
|
|
706
|
-
|
707
768
|
/** @private */
|
708
769
|
keyDown: function(evt) {
|
709
770
|
// handle tab key
|
@@ -720,12 +781,13 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
720
781
|
return NO;
|
721
782
|
},
|
722
783
|
|
723
|
-
/** @private
|
784
|
+
/** @private
|
785
|
+
Perform an action based on the behavior of the button.
|
724
786
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
787
|
+
- toggle behavior: switch to on/off state
|
788
|
+
- on behavior: turn on.
|
789
|
+
- off behavior: turn off.
|
790
|
+
- otherwise: invoke target/action
|
729
791
|
*/
|
730
792
|
_action: function(evt, skipHoldRepeat) {
|
731
793
|
switch(this.get('buttonBehavior')) {
|
@@ -795,8 +857,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
795
857
|
},
|
796
858
|
|
797
859
|
/** @private */
|
798
|
-
_hasLegacyActionHandler: function()
|
799
|
-
{
|
860
|
+
_hasLegacyActionHandler: function() {
|
800
861
|
var action = this.get('action');
|
801
862
|
if (action && (SC.typeOf(action) === SC.T_FUNCTION)) return true;
|
802
863
|
if (action && (SC.typeOf(action) === SC.T_STRING) && (action.indexOf('.') != -1)) return true;
|
@@ -816,12 +877,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
816
877
|
}
|
817
878
|
},
|
818
879
|
|
819
|
-
/**
|
820
|
-
acceptsFirstResponder: function() {
|
821
|
-
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
822
|
-
else return NO;
|
823
|
-
}.property('isEnabled'),
|
824
|
-
|
880
|
+
/** @private */
|
825
881
|
willBecomeKeyResponderFrom: function(keyView) {
|
826
882
|
// focus the text field.
|
827
883
|
if (!this._isFocused) {
|
@@ -833,10 +889,12 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
833
889
|
}
|
834
890
|
},
|
835
891
|
|
892
|
+
/** @private */
|
836
893
|
willLoseKeyResponderTo: function(responder) {
|
837
894
|
if (this._isFocused) this._isFocused = NO ;
|
838
895
|
},
|
839
896
|
|
897
|
+
/** @private */
|
840
898
|
didAppendToDocument: function() {
|
841
899
|
if(parseInt(SC.browser.msie, 0)===7 && this.get('useStaticLayout')){
|
842
900
|
var layout = this.get('layout'),
|
@@ -22,32 +22,61 @@
|
|
22
22
|
@since SproutCore 1.0
|
23
23
|
*/
|
24
24
|
SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
25
|
-
|
25
|
+
/** @scope SC.CheckboxView.prototype */ {
|
26
26
|
|
27
|
+
/**
|
28
|
+
@type Array
|
29
|
+
@default ['sc-checkbox-view', 'sc-checkbox-control']
|
30
|
+
@see SC.View#classNames
|
31
|
+
*/
|
27
32
|
classNames: ['sc-checkbox-view', 'sc-checkbox-control'],
|
33
|
+
|
34
|
+
/**
|
35
|
+
@type String
|
36
|
+
@default 'label'
|
37
|
+
@see SC.View#tagName
|
38
|
+
*/
|
28
39
|
tagName: 'label',
|
29
40
|
|
30
41
|
/**
|
31
|
-
The WAI-ARIA role of checkbox.
|
32
|
-
changed.
|
42
|
+
The WAI-ARIA role of checkbox.
|
33
43
|
|
34
|
-
@
|
44
|
+
@type String
|
45
|
+
@readOnly
|
35
46
|
*/
|
36
47
|
ariaRole: 'checkbox',
|
37
48
|
|
38
49
|
// no special theme for Checkbox; button defaults to 'square', so we have to stop that.
|
39
50
|
themeName: null,
|
51
|
+
|
52
|
+
/**
|
53
|
+
@type String
|
54
|
+
@default 'checkboxRenderDelegate'
|
55
|
+
*/
|
40
56
|
renderDelegateName: 'checkboxRenderDelegate',
|
41
57
|
|
42
|
-
|
58
|
+
/**
|
59
|
+
Ellipsis is disabled by default to allow multiline text
|
60
|
+
|
61
|
+
@type Boolean
|
62
|
+
@default NO
|
63
|
+
*/
|
43
64
|
needsEllipsis: NO,
|
44
65
|
|
66
|
+
/**
|
67
|
+
YES if `isEnabled` is YES, NO otherwise
|
68
|
+
|
69
|
+
@type Boolean
|
70
|
+
@default NO
|
71
|
+
@observes isEnabled
|
72
|
+
*/
|
45
73
|
acceptsFirstResponder: function() {
|
46
74
|
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
47
75
|
else return NO;
|
48
76
|
}.property('isEnabled'),
|
49
77
|
|
50
78
|
|
79
|
+
/** @private */
|
51
80
|
mouseDown: function(evt) {
|
52
81
|
if(!this.get('isEnabled')) return YES;
|
53
82
|
this.set('isActive', YES);
|
@@ -58,6 +87,7 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
58
87
|
return YES;
|
59
88
|
},
|
60
89
|
|
90
|
+
/** @private */
|
61
91
|
mouseUp: function(evt) {
|
62
92
|
this.set('isActive', NO);
|
63
93
|
this._isMouseDown = NO;
|
@@ -77,10 +107,12 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
77
107
|
},
|
78
108
|
|
79
109
|
|
110
|
+
/** @private */
|
80
111
|
touchStart: function(evt) {
|
81
112
|
return this.mouseDown(evt);
|
82
113
|
},
|
83
114
|
|
115
|
+
/** @private */
|
84
116
|
touchEnd: function(evt) {
|
85
117
|
return this.mouseUp(evt);
|
86
118
|
}
|