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
@@ -4,33 +4,119 @@
|
|
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("system/gesture");
|
8
9
|
|
10
|
+
/*
|
11
|
+
TODO Document this class
|
12
|
+
*/
|
13
|
+
|
14
|
+
/**
|
15
|
+
@static
|
16
|
+
@type String
|
17
|
+
@constant
|
18
|
+
*/
|
9
19
|
SC.SWIPE_HORIZONTAL = "X";
|
20
|
+
|
21
|
+
/**
|
22
|
+
@static
|
23
|
+
@type String
|
24
|
+
@constant
|
25
|
+
*/
|
10
26
|
SC.SWIPE_VERTICAL = "Y";
|
27
|
+
|
28
|
+
/**
|
29
|
+
@static
|
30
|
+
@type String
|
31
|
+
@constant
|
32
|
+
*/
|
11
33
|
SC.SWIPE_ANY = "XY";
|
34
|
+
|
35
|
+
/**
|
36
|
+
@static
|
37
|
+
@type String
|
38
|
+
@constant
|
39
|
+
*/
|
12
40
|
SC.SWIPE_LEFT = "LEFT";
|
41
|
+
|
42
|
+
/**
|
43
|
+
@static
|
44
|
+
@type String
|
45
|
+
@constant
|
46
|
+
*/
|
13
47
|
SC.SWIPE_RIGHT = "RIGHT";
|
48
|
+
|
49
|
+
/**
|
50
|
+
@static
|
51
|
+
@type String
|
52
|
+
@constant
|
53
|
+
*/
|
14
54
|
SC.SWIPE_UP = "UP";
|
55
|
+
|
56
|
+
/**
|
57
|
+
@static
|
58
|
+
@type String
|
59
|
+
@constant
|
60
|
+
*/
|
15
61
|
SC.SWIPE_DOWN = "DOWN";
|
16
62
|
|
17
|
-
|
63
|
+
/**
|
64
|
+
@class
|
65
|
+
@extends SC.Gesture
|
66
|
+
*/
|
67
|
+
SC.SwipeGesture = SC.Gesture.extend(
|
68
|
+
/** @scope SC.SwipeGesture.prototype */ {
|
69
|
+
|
70
|
+
/**
|
71
|
+
@type String
|
72
|
+
@default "swipe"
|
73
|
+
@readOnly
|
74
|
+
*/
|
18
75
|
name: "swipe",
|
76
|
+
|
77
|
+
/**
|
78
|
+
@type Boolean
|
79
|
+
@default YES
|
80
|
+
@readOnly
|
81
|
+
*/
|
19
82
|
acceptsMultitouch: YES,
|
20
|
-
|
83
|
+
|
84
|
+
/**
|
85
|
+
@type String
|
86
|
+
@default SC.SWIPE_HORIZONTAL
|
87
|
+
*/
|
21
88
|
direction: SC.SWIPE_HORIZONTAL,
|
22
89
|
|
23
90
|
/**
|
24
91
|
Will be populated with the current direction of the swipe once
|
25
92
|
one has been determined.
|
93
|
+
|
94
|
+
@type String
|
95
|
+
@default null
|
26
96
|
*/
|
27
97
|
currentDirection: null,
|
28
98
|
|
99
|
+
/**
|
100
|
+
@type Number
|
101
|
+
@default 5
|
102
|
+
*/
|
29
103
|
startDistance: 5,
|
104
|
+
|
105
|
+
/**
|
106
|
+
@type Number
|
107
|
+
@default 40
|
108
|
+
*/
|
30
109
|
swipeDistance: 40,
|
31
110
|
|
32
|
-
|
111
|
+
/**
|
112
|
+
Amount of distance in the other direction to consider it a swipe
|
113
|
+
|
114
|
+
@type Number
|
115
|
+
@default 0.5
|
116
|
+
*/
|
117
|
+
tolerance: 0.5,
|
33
118
|
|
119
|
+
/** @private */
|
34
120
|
touchIsInGesture: function(touch, status) {
|
35
121
|
// if we have not "flunked" the touch before, and it has moved
|
36
122
|
if (!status.flunked) {
|
@@ -67,6 +153,7 @@ SC.SwipeGesture = SC.Gesture.extend({
|
|
67
153
|
return NO;
|
68
154
|
},
|
69
155
|
|
156
|
+
/** @private */
|
70
157
|
touchStart: function(touch) {
|
71
158
|
var d = this.get("currentDirection"),
|
72
159
|
delta = touch["page" + d] - touch["start" + d],
|
@@ -79,6 +166,7 @@ SC.SwipeGesture = SC.Gesture.extend({
|
|
79
166
|
return YES;
|
80
167
|
},
|
81
168
|
|
169
|
+
/** @private */
|
82
170
|
touchesDragged: function(evt, touches) {
|
83
171
|
var touch = touches.firstObject();
|
84
172
|
var d = this.get("currentDirection"),
|
@@ -98,12 +186,13 @@ SC.SwipeGesture = SC.Gesture.extend({
|
|
98
186
|
this.release(touch);
|
99
187
|
|
100
188
|
var allTouches = touch.touchesForResponder(this);
|
101
|
-
if (!allTouches || allTouches.length
|
189
|
+
if (!allTouches || allTouches.length === 0) this.cancel(touch, swipeDirection, delta);
|
102
190
|
} else {
|
103
191
|
this.change(touch, swipeDirection, delta);
|
104
192
|
}
|
105
193
|
},
|
106
194
|
|
195
|
+
/** @private */
|
107
196
|
touchEnd: function(touch) {
|
108
197
|
var d = this.get("currentDirection"),
|
109
198
|
o = (d === SC.SWIPE_HORIZONTAL ? "Y" : "X"),
|
@@ -136,6 +225,7 @@ SC.SwipeGesture = SC.Gesture.extend({
|
|
136
225
|
}
|
137
226
|
},
|
138
227
|
|
228
|
+
/** @private */
|
139
229
|
cancel: function(){
|
140
230
|
sc_super();
|
141
231
|
this.set('currentDirection', null);
|
@@ -4,23 +4,57 @@
|
|
4
4
|
// Author: Peter Wagenet
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
|
+
|
7
8
|
sc_require("system/gesture");
|
8
9
|
|
9
|
-
|
10
|
+
/**
|
11
|
+
@class
|
12
|
+
@extends SC.Gesture
|
13
|
+
*/
|
14
|
+
SC.TapGesture = SC.Gesture.extend(
|
15
|
+
/** @scope SC.TapGesture.prototype */{
|
16
|
+
|
17
|
+
/**
|
18
|
+
@type String
|
19
|
+
@default "tap"
|
20
|
+
@readOnly
|
21
|
+
*/
|
10
22
|
name: "tap",
|
23
|
+
|
24
|
+
/**
|
25
|
+
@type Boolean
|
26
|
+
@default NO
|
27
|
+
@readOnly
|
28
|
+
*/
|
11
29
|
acceptsMultitouch: NO,
|
12
30
|
|
31
|
+
/** @private */
|
13
32
|
_tapCount: null,
|
33
|
+
|
34
|
+
/** @private */
|
14
35
|
_candidateTouch: null,
|
36
|
+
|
37
|
+
/** @private */
|
15
38
|
_eventTimer: null,
|
16
39
|
|
40
|
+
/**
|
41
|
+
@type Number
|
42
|
+
@default 20
|
43
|
+
*/
|
17
44
|
tapWiggle: 10,
|
45
|
+
|
46
|
+
/**
|
47
|
+
@type Number
|
48
|
+
@default 200
|
49
|
+
*/
|
18
50
|
tapDelay: 200,
|
19
51
|
|
52
|
+
/** @private */
|
20
53
|
touchIsInGesture: function(touch, status) {
|
21
54
|
return !touch.tapFlunked;
|
22
55
|
},
|
23
56
|
|
57
|
+
/** @private */
|
24
58
|
touchStart: function(touch) {
|
25
59
|
// We don't want events triggering during a touch, will be reset when touch is over if it's a candidate
|
26
60
|
if (this._eventTimer) this._eventTimer.invalidate();
|
@@ -42,6 +76,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
42
76
|
return YES;
|
43
77
|
},
|
44
78
|
|
79
|
+
/** @private */
|
45
80
|
touchesDragged: function(evt, touches) {
|
46
81
|
var touch = touches[0];
|
47
82
|
|
@@ -58,6 +93,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
58
93
|
if (tooManyTouches || touchMoved) this._cancelTap(touch);
|
59
94
|
},
|
60
95
|
|
96
|
+
/** @private */
|
61
97
|
touchEnd: function(touch){
|
62
98
|
if (this._calculateDragDistance(touch) > this.get('tapWiggle') || Date.now() - this._candidateTouch.startTime > this.get('tapDelay') ) {
|
63
99
|
// Touch moved too much or took too long
|
@@ -67,6 +103,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
67
103
|
}
|
68
104
|
},
|
69
105
|
|
106
|
+
/** @private */
|
70
107
|
_addTap: function(touch){
|
71
108
|
var self = this;
|
72
109
|
|
@@ -85,6 +122,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
85
122
|
|
86
123
|
},
|
87
124
|
|
125
|
+
/** @private */
|
88
126
|
_cancelTap: function(touch){
|
89
127
|
// We don't set this on the touchStatus because the status is
|
90
128
|
// linked to an individual view/gesture and we want this to be
|
@@ -101,6 +139,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
101
139
|
|
102
140
|
},
|
103
141
|
|
142
|
+
/** @private */
|
104
143
|
_triggerTap: function(touch){
|
105
144
|
this.end(touch, this._tapCount);
|
106
145
|
|
@@ -109,6 +148,7 @@ SC.TapGesture = SC.Gesture.extend({
|
|
109
148
|
this._eventTimer = null;
|
110
149
|
},
|
111
150
|
|
151
|
+
/** @private */
|
112
152
|
_calculateDragDistance: function(touch) {
|
113
153
|
return Math.sqrt(Math.pow(touch.pageX - touch.startX, 2) + Math.pow(touch.pageY - touch.startY, 2));
|
114
154
|
}
|
@@ -45,22 +45,25 @@ SC.AutoResize = {
|
|
45
45
|
setting 'measuredSize' to the measured value (you can bind to measuredSize
|
46
46
|
and update size manually).
|
47
47
|
|
48
|
-
@
|
48
|
+
@type Boolean
|
49
|
+
@default YES
|
49
50
|
*/
|
50
51
|
shouldAutoResize: YES,
|
51
52
|
|
52
53
|
/**
|
53
54
|
If NO, prevents SC.AutoResize from doing anything at all.
|
54
55
|
|
55
|
-
@
|
56
|
+
@type Boolean
|
57
|
+
@default YES
|
56
58
|
*/
|
57
59
|
shouldMeasureSize: YES,
|
58
60
|
|
59
61
|
/**
|
60
62
|
Determines if the view's width should be resized
|
61
|
-
on calculation.
|
63
|
+
on calculation.
|
62
64
|
|
63
|
-
@
|
65
|
+
@type Boolean
|
66
|
+
@default YES
|
64
67
|
*/
|
65
68
|
shouldResizeWidth: YES,
|
66
69
|
|
@@ -69,7 +72,8 @@ SC.AutoResize = {
|
|
69
72
|
on calculation. Default is NO to retain backwards
|
70
73
|
compatibility.
|
71
74
|
|
72
|
-
@
|
75
|
+
@type Boolean
|
76
|
+
@default NO
|
73
77
|
*/
|
74
78
|
shouldResizeHeight: NO,
|
75
79
|
|
@@ -79,7 +83,7 @@ SC.AutoResize = {
|
|
79
83
|
shouldAutoResize to NO, allows you to customize the 'sizing' part, using
|
80
84
|
SC.AutoResize purely for its measuring code.
|
81
85
|
|
82
|
-
@
|
86
|
+
@type Rect
|
83
87
|
*/
|
84
88
|
measuredSize: { width: 0, height: 0 },
|
85
89
|
|
@@ -108,14 +112,19 @@ SC.AutoResize = {
|
|
108
112
|
/**
|
109
113
|
If this property is provided, all views that share the same value for this property will be resized as a batch for increased performance.
|
110
114
|
|
111
|
-
@
|
115
|
+
@type String
|
112
116
|
*/
|
113
117
|
batchResizeId: null,
|
114
118
|
|
119
|
+
/** @private */
|
115
120
|
_scar_measurementPending: NO,
|
121
|
+
|
122
|
+
/** @private */
|
116
123
|
_scar_requestedBatchResizeId: null,
|
117
124
|
|
118
|
-
|
125
|
+
/** @private
|
126
|
+
If the batch id changed while a request is out, we have to fix it
|
127
|
+
*/
|
119
128
|
_scar_batchResizeIdDidChange: function() {
|
120
129
|
var batchResizeId = this.get('batchResizeId'),
|
121
130
|
requestedBatchResizeId = this._scar_requestedBatchResizeId;
|
@@ -208,7 +217,7 @@ SC.AutoResize = {
|
|
208
217
|
},
|
209
218
|
|
210
219
|
/**
|
211
|
-
|
220
|
+
@private
|
212
221
|
*/
|
213
222
|
_scar_valueDidChange: function() {
|
214
223
|
this.scheduleMeasurement();
|
@@ -5,25 +5,27 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
8
|
/**
|
10
9
|
Used for contentIndexDisclosureState(). Indicates open branch node.
|
11
10
|
|
12
|
-
@
|
11
|
+
@type Number
|
12
|
+
@constant
|
13
13
|
*/
|
14
14
|
SC.BRANCH_OPEN = 0x0011;
|
15
15
|
|
16
16
|
/**
|
17
17
|
Used for contentIndexDisclosureState(). Indicates closed branch node.
|
18
18
|
|
19
|
-
@
|
19
|
+
@type Number
|
20
|
+
@constant
|
20
21
|
*/
|
21
22
|
SC.BRANCH_CLOSED = 0x0012;
|
22
23
|
|
23
24
|
/**
|
24
25
|
Used for contentIndexDisclosureState(). Indicates leaf node.
|
25
26
|
|
26
|
-
@
|
27
|
+
@type Number
|
28
|
+
@constant
|
27
29
|
*/
|
28
30
|
SC.LEAF_NODE = 0x0020;
|
29
31
|
|
@@ -44,7 +46,7 @@ SC.CollectionContent = {
|
|
44
46
|
/**
|
45
47
|
Used to detect the mixin by SC.CollectionView
|
46
48
|
|
47
|
-
@
|
49
|
+
@type Boolean
|
48
50
|
*/
|
49
51
|
isCollectionContent: YES,
|
50
52
|
|
@@ -15,14 +15,12 @@
|
|
15
15
|
method on your view. Your updateDisplay() method will then be called at the
|
16
16
|
end of the run loop.
|
17
17
|
|
18
|
-
|
18
|
+
## Example
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
});
|
25
|
-
}}}
|
20
|
+
MyApp.MyViewClass = SC.View.extend(SC.ContentDisplay, {
|
21
|
+
contentDisplayProperties: 'title isEnabled hasChildren'.w(),
|
22
|
+
...
|
23
|
+
});
|
26
24
|
|
27
25
|
@since SproutCore 1.0
|
28
26
|
*/
|
@@ -39,7 +37,8 @@ SC.ContentDisplay = {
|
|
39
37
|
should trigger an update of the display for your view. Changes to the
|
40
38
|
content object will only invoke your display method once per runloop.
|
41
39
|
|
42
|
-
@
|
40
|
+
@type Array
|
41
|
+
@default []
|
43
42
|
*/
|
44
43
|
contentDisplayProperties: [],
|
45
44
|
|
@@ -5,27 +5,32 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
* it be reflected in a nested view structure. If your data structures
|
26
|
-
* only have primitive values, consider using SC.Control instead.
|
8
|
+
/**
|
9
|
+
@mixin
|
10
|
+
|
11
|
+
This mixin allows a view to get its value from a content object based
|
12
|
+
on the value of its contentValueKey.
|
13
|
+
|
14
|
+
myView = SC.View.create({
|
15
|
+
content: {prop: "abc123"},
|
16
|
+
|
17
|
+
contentValueKey: 'prop'
|
18
|
+
});
|
19
|
+
|
20
|
+
// myView.get('value') will be "abc123"
|
21
|
+
|
22
|
+
This is useful if you have a nested record structure and want to have
|
23
|
+
it be reflected in a nested view structure. If your data structures
|
24
|
+
only have primitive values, consider using SC.Control instead.
|
27
25
|
*/
|
28
26
|
SC.ContentValueSupport = {
|
27
|
+
|
28
|
+
/**
|
29
|
+
Walk like a duck.
|
30
|
+
|
31
|
+
@type Boolean
|
32
|
+
@default YES
|
33
|
+
*/
|
29
34
|
hasContentValueSupport: YES,
|
30
35
|
|
31
36
|
/** @private */
|
@@ -46,7 +51,8 @@ SC.ContentValueSupport = {
|
|
46
51
|
set a content object and have the control display a single property
|
47
52
|
of that control, then you should use the content property instead.
|
48
53
|
|
49
|
-
@
|
54
|
+
@type Object
|
55
|
+
@default null
|
50
56
|
*/
|
51
57
|
value: null,
|
52
58
|
|
@@ -66,7 +72,8 @@ SC.ContentValueSupport = {
|
|
66
72
|
collection view, then it would be better to instead bind the value of
|
67
73
|
the control directly to a controller property.
|
68
74
|
|
69
|
-
@
|
75
|
+
@type SC.Object
|
76
|
+
@default null
|
70
77
|
*/
|
71
78
|
content: null,
|
72
79
|
|
@@ -76,7 +83,8 @@ SC.ContentValueSupport = {
|
|
76
83
|
content object is first set. If you have a displayDelegate, then
|
77
84
|
you can also use the contentValueKey of the displayDelegate.
|
78
85
|
|
79
|
-
@
|
86
|
+
@type String
|
87
|
+
@default null
|
80
88
|
*/
|
81
89
|
contentValueKey: null,
|
82
90
|
|
@@ -208,10 +216,12 @@ SC.ContentValueSupport = {
|
|
208
216
|
|
209
217
|
}.observes('content'),
|
210
218
|
|
211
|
-
|
219
|
+
/** @private
|
220
|
+
Since we always observe *, just call the update function
|
221
|
+
*/
|
212
222
|
_control_contentValueKeyDidChange: function() {
|
213
223
|
// notify that value did change.
|
214
224
|
this.contentPropertyDidChange(this.get('content'), '*') ;
|
215
|
-
}.observes('contentValueKey')
|
225
|
+
}.observes('contentValueKey')
|
216
226
|
};
|
217
227
|
|
@@ -11,48 +11,57 @@ sc_require('mixins/content_value_support');
|
|
11
11
|
/**
|
12
12
|
Option for controls to automatically calculate their size (should be default
|
13
13
|
on controls that use renderers).
|
14
|
+
|
15
|
+
@type String
|
16
|
+
@constant
|
14
17
|
*/
|
15
18
|
SC.AUTO_CONTROL_SIZE = '__AUTO__';
|
16
19
|
|
17
20
|
/**
|
18
21
|
Option for HUGE control size.
|
19
22
|
|
20
|
-
@
|
23
|
+
@type String
|
24
|
+
@constant
|
21
25
|
*/
|
22
26
|
SC.JUMBO_CONTROL_SIZE = 'sc-jumbo-size' ;
|
23
27
|
|
24
28
|
/**
|
25
29
|
Option for HUGE control size.
|
26
30
|
|
27
|
-
@
|
31
|
+
@type String
|
32
|
+
@constant
|
28
33
|
*/
|
29
34
|
SC.HUGE_CONTROL_SIZE = 'sc-huge-size' ;
|
30
35
|
|
31
36
|
/**
|
32
37
|
Option for large control size.
|
33
38
|
|
34
|
-
@
|
39
|
+
@type String
|
40
|
+
@constant
|
35
41
|
*/
|
36
42
|
SC.LARGE_CONTROL_SIZE = 'sc-large-size' ;
|
37
43
|
|
38
44
|
/**
|
39
45
|
Option for standard control size.
|
40
46
|
|
41
|
-
@
|
47
|
+
@type String
|
48
|
+
@constant
|
42
49
|
*/
|
43
50
|
SC.REGULAR_CONTROL_SIZE = 'sc-regular-size' ;
|
44
51
|
|
45
52
|
/**
|
46
53
|
Option for small control size.
|
47
54
|
|
48
|
-
@
|
55
|
+
@type String
|
56
|
+
@constant
|
49
57
|
*/
|
50
58
|
SC.SMALL_CONTROL_SIZE = 'sc-small-size' ;
|
51
59
|
|
52
60
|
/**
|
53
61
|
Option for tiny control size
|
54
62
|
|
55
|
-
@
|
63
|
+
@type String
|
64
|
+
@constant
|
56
65
|
*/
|
57
66
|
SC.TINY_CONTROL_SIZE = 'sc-tiny-size' ;
|
58
67
|
|
@@ -64,7 +73,7 @@ SC.TINY_CONTROL_SIZE = 'sc-tiny-size' ;
|
|
64
73
|
functionality including showing a selected state, enabled state, focus
|
65
74
|
state, etc.
|
66
75
|
|
67
|
-
|
76
|
+
## About Values and Content
|
68
77
|
|
69
78
|
Controls typically are used to represent a single value, such as a number,
|
70
79
|
boolean or string. The value a control is managing is typically stored in
|
@@ -98,7 +107,7 @@ SC.TINY_CONTROL_SIZE = 'sc-tiny-size' ;
|
|
98
107
|
properties you care about on the content object and update your view if
|
99
108
|
anything you care about has changed.
|
100
109
|
|
101
|
-
|
110
|
+
## Delegate Support
|
102
111
|
|
103
112
|
Controls can optionally get the contentDisplayProperty from a
|
104
113
|
displayDelegate, if it is set. The displayDelegate is often used to
|
@@ -107,16 +116,29 @@ SC.TINY_CONTROL_SIZE = 'sc-tiny-size' ;
|
|
107
116
|
collection view will be automatically set as its displayDelegate.
|
108
117
|
|
109
118
|
@since SproutCore 1.0
|
119
|
+
@extends SC.ContentValueSupport
|
110
120
|
*/
|
111
|
-
SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport),
|
121
|
+
SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport),
|
122
|
+
/** @scope SC.Control.prototype */{
|
112
123
|
|
124
|
+
/**
|
125
|
+
Walk like a duck
|
126
|
+
|
127
|
+
@type Boolean
|
128
|
+
@default YES
|
129
|
+
@readOnly
|
130
|
+
*/
|
113
131
|
isControl: YES,
|
114
132
|
|
115
133
|
/**
|
116
|
-
The selected state of this control.
|
117
|
-
|
134
|
+
The selected state of this control. Possible values:
|
135
|
+
|
136
|
+
- `YES`
|
137
|
+
- `NO`
|
138
|
+
- SC.MIXED_STATE.
|
118
139
|
|
119
|
-
@
|
140
|
+
@type Boolean
|
141
|
+
@default NO
|
120
142
|
*/
|
121
143
|
isSelected: NO,
|
122
144
|
|
@@ -131,7 +153,8 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
131
153
|
Changing this property value by default will cause the Control mixin to
|
132
154
|
add/remove an 'active' class name to the root element.
|
133
155
|
|
134
|
-
@
|
156
|
+
@type Boolean
|
157
|
+
@default NO
|
135
158
|
*/
|
136
159
|
isActive: NO,
|
137
160
|
|
@@ -146,7 +169,8 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
146
169
|
automatically bind the value to the property key you name here on the
|
147
170
|
content object.
|
148
171
|
|
149
|
-
@
|
172
|
+
@type String
|
173
|
+
@default null
|
150
174
|
*/
|
151
175
|
fieldKey: null,
|
152
176
|
|
@@ -157,7 +181,8 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
157
181
|
in the error explanation. If you do not set this property, then the
|
158
182
|
fieldKey or the class name will be used to generate a human readable name.
|
159
183
|
|
160
|
-
@
|
184
|
+
@type String
|
185
|
+
@default null
|
161
186
|
*/
|
162
187
|
fieldLabel: null,
|
163
188
|
|
@@ -173,7 +198,10 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
173
198
|
Try to localize using the string "ErrorLabel.{ClassName}". Return a
|
174
199
|
humanized form of the class name.
|
175
200
|
|
176
|
-
@
|
201
|
+
@field
|
202
|
+
@type String
|
203
|
+
@observes 'fieldLabel'
|
204
|
+
@observes 'fieldKey'
|
177
205
|
*/
|
178
206
|
errorLabel: function() {
|
179
207
|
var ret, fk, def ;
|
@@ -197,7 +225,8 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
197
225
|
a height, performance will be impacted as it must be calculated; if you do
|
198
226
|
this, a warning will be issued. If you don't care, use SC.CALCULATED_CONTROL_SIZE.
|
199
227
|
|
200
|
-
@
|
228
|
+
@type String
|
229
|
+
@default SC.REGULAR_CONTROL_SIZE
|
201
230
|
*/
|
202
231
|
controlSize: SC.REGULAR_CONTROL_SIZE,
|
203
232
|
|
@@ -248,6 +277,7 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport), {
|
|
248
277
|
this.$input().attr('disabled', disabled);
|
249
278
|
}
|
250
279
|
}
|
251
|
-
}
|
280
|
+
}
|
281
|
+
|
252
282
|
});
|
253
283
|
|