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
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
require('system/drag') ;
|
9
9
|
|
10
|
-
|
11
10
|
/**
|
12
11
|
@namespace
|
13
12
|
|
@@ -17,24 +16,28 @@ require('system/drag') ;
|
|
17
16
|
*/
|
18
17
|
SC.DragDataSource = {
|
19
18
|
|
20
|
-
/**
|
19
|
+
/**
|
21
20
|
Implement this property as an array of data types you want to support
|
22
21
|
for drag operations.
|
22
|
+
|
23
|
+
@type Array
|
24
|
+
@default []
|
23
25
|
*/
|
24
26
|
dragDataTypes: [],
|
25
27
|
|
26
28
|
/**
|
27
29
|
Implement this method to return the data in the format passed. Return
|
28
30
|
null if the requested data type cannot be generated.
|
29
|
-
|
31
|
+
|
30
32
|
@param {SC.Drag} drag The Drag instance managing this drag.
|
31
33
|
@param {Object} dataType The proposed dataType to return. This will
|
32
34
|
always be one of the data types declared in dragDataTypes.
|
33
35
|
|
34
36
|
@returns The data object for the specified type
|
35
37
|
*/
|
36
|
-
dragDataForType: function(drag, dataType) {
|
37
|
-
|
38
|
-
}
|
38
|
+
dragDataForType: function(drag, dataType) {
|
39
|
+
return null;
|
40
|
+
}
|
39
41
|
|
42
|
+
};
|
40
43
|
|
@@ -5,16 +5,14 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
8
|
require('system/drag') ;
|
10
9
|
|
11
10
|
/**
|
12
|
-
@
|
11
|
+
@namespace
|
13
12
|
|
14
13
|
The DragSource protocol is used to dynamically generate multiple types of
|
15
14
|
data from a single object. You must implement this protocol if you want to
|
16
15
|
provide the data for a drag event.
|
17
|
-
|
18
16
|
*/
|
19
17
|
SC.DragSource = {
|
20
18
|
|
@@ -23,29 +21,32 @@ SC.DragSource = {
|
|
23
21
|
Return a bitwise OR'd mask of the drag operations allowed on the
|
24
22
|
specified target. If you don't care about the target, just return a
|
25
23
|
constant value.
|
26
|
-
|
24
|
+
|
25
|
+
The default implementation returns SC.DRAG_NONE
|
26
|
+
|
27
27
|
@param {SC.View} dropTarget The proposed target of the drop.
|
28
28
|
@param {SC.Drag} drag The SC.Drag instance managing this drag.
|
29
|
-
|
30
29
|
*/
|
31
|
-
dragSourceOperationMaskFor: function(drag, dropTarget) {
|
30
|
+
dragSourceOperationMaskFor: function(drag, dropTarget) {
|
31
|
+
return SC.DRAG_NONE;
|
32
|
+
},
|
32
33
|
|
33
34
|
/**
|
34
35
|
If this property is set to NO or is not implemented, then the user may
|
35
36
|
modify the drag operation by changing the modifier keys they have
|
36
37
|
pressed.
|
37
38
|
|
38
|
-
@
|
39
|
+
@type Boolean
|
40
|
+
@default NO
|
39
41
|
*/
|
40
42
|
ignoreModifierKeysWhileDragging: NO,
|
41
43
|
|
42
|
-
/**
|
44
|
+
/**
|
43
45
|
This method is called when the drag begins. You can use this to do any
|
44
46
|
visual highlighting to indicate that the receiver is the source of the
|
45
47
|
drag.
|
46
|
-
|
48
|
+
|
47
49
|
@param {SC.Drag} drag The Drag instance managing this drag.
|
48
|
-
|
49
50
|
@param {Point} loc The point in *window* coordinates where the drag
|
50
51
|
began. You can use convertOffsetFromView() to convert this to local
|
51
52
|
coordinates.
|
@@ -55,29 +56,24 @@ SC.DragSource = {
|
|
55
56
|
/**
|
56
57
|
This method is called whenever the drag image is moved. This is
|
57
58
|
similar to the dragUpdated() method called on drop targets.
|
58
|
-
|
59
|
+
|
59
60
|
@param {SC.Drag} drag The Drag instance managing this drag.
|
60
|
-
|
61
61
|
@param {Point} loc The point in *window* coordinates where the drag
|
62
62
|
mouse is. You can use convertOffsetFromView() to convert this to local
|
63
63
|
coordinates.
|
64
64
|
*/
|
65
65
|
dragDidMove: function(drag, loc) {},
|
66
66
|
|
67
|
-
/**
|
67
|
+
/**
|
68
68
|
This method is called when the drag ended. You can use this to do any
|
69
69
|
cleanup. The operation is the actual operation performed on the drag.
|
70
|
-
|
70
|
+
|
71
71
|
@param {SC.Drag} drag The drag instance managing the drag.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
@param {DragOp} op The drag operation that was performed. One of
|
72
|
+
@param {Point} loc The point in WINDOW coordinates where the drag
|
73
|
+
ended.
|
74
|
+
@param {DragOp} op The drag operation that was performed. One of
|
77
75
|
SC.DRAG_COPY, SC.DRAG_MOVE, SC.DRAG_LINK, or SC.DRAG_NONE.
|
78
|
-
|
79
76
|
*/
|
80
77
|
dragDidEnd: function(drag, loc, op) {}
|
81
|
-
|
82
|
-
} ;
|
83
78
|
|
79
|
+
};
|
@@ -5,7 +5,6 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
8
|
require('system/drag');
|
10
9
|
|
11
10
|
/**
|
@@ -19,18 +18,18 @@ require('system/drag');
|
|
19
18
|
The general call sequence for all drop targets is (in pseudo-Ragel, regex
|
20
19
|
format):
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
dragStarted
|
22
|
+
(
|
23
|
+
computeDragOperations+
|
24
|
+
(
|
25
|
+
dragEntered
|
26
|
+
dragUpdated
|
27
|
+
( computeDragOperations | dragUpdated )*
|
28
|
+
( acceptDragOperation performDragOperation? )? // mouseUp
|
29
|
+
dragExited
|
30
|
+
)*
|
31
|
+
)*
|
32
|
+
dragEnded
|
34
33
|
|
35
34
|
Thus, every drop target will have its dragStarted and dragEnded methods called
|
36
35
|
once during every drag session. computeDragOperations, if called at all, may be
|
@@ -47,6 +46,10 @@ SC.DropTarget = {
|
|
47
46
|
Drop targets must be specially registered in order to receive drop
|
48
47
|
events. SproutCore knows to register your view when this property
|
49
48
|
is true on view creation.
|
49
|
+
|
50
|
+
@type Boolean
|
51
|
+
@default YES
|
52
|
+
@constant
|
50
53
|
*/
|
51
54
|
isDropTarget: YES,
|
52
55
|
|
@@ -58,7 +61,7 @@ SC.DropTarget = {
|
|
58
61
|
The default implementation does nothing.
|
59
62
|
|
60
63
|
@param {SC.Drag} drag The current drag object.
|
61
|
-
@param {SC.Event}
|
64
|
+
@param {SC.Event} evt The most recent mouse move event. Use to get location
|
62
65
|
*/
|
63
66
|
dragStarted: function(drag, evt) {},
|
64
67
|
|
@@ -134,10 +137,13 @@ SC.DropTarget = {
|
|
134
137
|
@param {SC.Drag} drag The current drag object
|
135
138
|
@param {SC.Event} evt The most recent mouse move event. Use to get
|
136
139
|
location
|
140
|
+
|
137
141
|
@returns {DragOps} A mask of all the drag operations allowed or
|
138
142
|
SC.DRAG_NONE
|
139
143
|
*/
|
140
|
-
computeDragOperations: function(drag, evt) {
|
144
|
+
computeDragOperations: function(drag, evt) {
|
145
|
+
return SC.DRAG_NONE;
|
146
|
+
},
|
141
147
|
|
142
148
|
/**
|
143
149
|
Called when the user releases the mouse.
|
@@ -154,7 +160,9 @@ SC.DropTarget = {
|
|
154
160
|
|
155
161
|
@return {Boolean} YES if operation is OK, NO to cancel.
|
156
162
|
*/
|
157
|
-
acceptDragOperation: function(drag, op) {
|
163
|
+
acceptDragOperation: function(drag, op) {
|
164
|
+
return YES;
|
165
|
+
},
|
158
166
|
|
159
167
|
/**
|
160
168
|
Called to actually perform the drag operation.
|
@@ -172,6 +180,8 @@ SC.DropTarget = {
|
|
172
180
|
|
173
181
|
@return {DragOp} Drag Operation actually performed
|
174
182
|
*/
|
175
|
-
performDragOperation: function(drag, op) {
|
183
|
+
performDragOperation: function(drag, op) {
|
184
|
+
return SC.DRAG_NONE;
|
185
|
+
}
|
176
186
|
|
177
187
|
};
|
@@ -6,14 +6,45 @@
|
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
/**
|
10
|
+
@static
|
11
|
+
*/
|
12
|
+
SC.DRAG_LINK = 0x0004;
|
13
|
+
|
14
|
+
/**
|
15
|
+
@static
|
16
|
+
*/
|
17
|
+
SC.DRAG_COPY = 0x0001;
|
18
|
+
|
19
|
+
/**
|
20
|
+
@static
|
21
|
+
*/
|
22
|
+
SC.DRAG_MOVE = 0x0002;
|
23
|
+
|
24
|
+
/**
|
25
|
+
@static
|
26
|
+
*/
|
27
|
+
SC.DRAG_NONE = 0x0000;
|
28
|
+
|
29
|
+
/**
|
30
|
+
@static
|
31
|
+
*/
|
32
|
+
SC.DRAG_ANY = 0x000F;
|
33
|
+
|
34
|
+
/**
|
35
|
+
@static
|
36
|
+
*/
|
37
|
+
SC.DRAG_DATA = 0x0008; // includes SC.DRAG_REORDER
|
38
|
+
|
39
|
+
/**
|
40
|
+
@static
|
41
|
+
*/
|
11
42
|
SC.DRAG_AUTOSCROLL_ZONE_THICKNESS = 20;
|
12
43
|
|
13
|
-
// Add draggable and scrollable support to SC.View
|
14
44
|
SC.View.reopen(
|
15
45
|
/** @scope SC.View.prototype */ {
|
16
46
|
|
47
|
+
/** @private */
|
17
48
|
init: function(original) {
|
18
49
|
original();
|
19
50
|
|
@@ -24,6 +55,7 @@ SC.View.reopen(
|
|
24
55
|
if (this.get('isScrollable')) { SC.Drag.addScrollableView(this) ; }
|
25
56
|
}.enhance(),
|
26
57
|
|
58
|
+
/** @private */
|
27
59
|
destroy: function(original) {
|
28
60
|
// unregister for drags
|
29
61
|
if (this.get('isDropTarget')) { SC.Drag.removeDropTarget(this) ; }
|
@@ -43,45 +75,45 @@ SC.View.reopen(
|
|
43
75
|
user releases the mouse button.
|
44
76
|
|
45
77
|
To initiate a drag, you should call SC.Drag.start() with the options below
|
46
|
-
specified in a hash. Pass the ones you need to get the drag you want:
|
78
|
+
specified in a hash. Pass the ones you need to get the drag you want:
|
47
79
|
|
48
|
-
|
49
|
-
|
80
|
+
- *event: (req)* The mouse event/touch that triggered the drag. This will be used
|
81
|
+
to position the element.
|
50
82
|
|
51
|
-
|
52
|
-
|
53
|
-
|
83
|
+
- *source: (req)* The drag source object that should be consulted during
|
84
|
+
the drag operations. This is usually the container view that initiated
|
85
|
+
the drag.
|
54
86
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
87
|
+
- *dragView:* Optional view that will be used as the source image for the
|
88
|
+
drag. The drag operation will clone the DOM elements for this view and
|
89
|
+
parent them under the drag pane, which has the class name 'sc-ghost-view'.
|
90
|
+
The drag view is not moved from its original location during a drag.
|
91
|
+
If the dragView is not provided, the source is used as dragView.
|
60
92
|
|
61
|
-
|
62
|
-
|
63
|
-
|
93
|
+
- *ghost: YES | NO* If NO, the drag view image will show, but the source
|
94
|
+
dragView will not be hidden. Set to YES to make it appear that the
|
95
|
+
dragView itself is being dragged around.
|
64
96
|
|
65
|
-
|
66
|
-
|
97
|
+
- *slideBack: YES | NO* If YES and the drag operation is cancelled, the
|
98
|
+
dragView will slide back to its source origin.
|
67
99
|
|
68
|
-
|
69
|
-
|
70
|
-
|
100
|
+
- *origin:* If passed, this will be used as the origin point for the
|
101
|
+
ghostView when it slides back. You normally do not need to pass this
|
102
|
+
unless the ghost view does not appear in the main UI.
|
71
103
|
|
72
|
-
|
73
|
-
|
74
|
-
|
104
|
+
- *data:* Optional hash of data types and values. You can use this to pass
|
105
|
+
a static set of data instead of providing a dataSource. If you provide
|
106
|
+
a dataSource, it will be used instead.
|
75
107
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
108
|
+
- *dataSource:* Optional object that will provide the data for the drag to
|
109
|
+
be consumed by the drop target. If you do not pass this parameter or the
|
110
|
+
data hash, then the source object will be used if it implements the
|
111
|
+
SC.DragDataSource protocol.
|
80
112
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
113
|
+
- *anchorView:* if you pass this optional view, then the drag will only be
|
114
|
+
allowed to happen within this view. The ghostView will actually be added
|
115
|
+
as a child of this view during the drag. Normally the anchorView is the
|
116
|
+
window.
|
85
117
|
|
86
118
|
@extends SC.Object
|
87
119
|
*/
|
@@ -115,7 +147,7 @@ SC.Drag = SC.Object.extend(
|
|
115
147
|
ghostActsLikeCursor: NO,
|
116
148
|
|
117
149
|
/**
|
118
|
-
The view that was used as the source of the ghostView.
|
150
|
+
The view that was used as the source of the ghostView.
|
119
151
|
|
120
152
|
The drag view is not moved from its original location during a drag.
|
121
153
|
Instead, the DOM content of the view is cloned and managed by the
|
@@ -190,7 +222,7 @@ SC.Drag = SC.Object.extend(
|
|
190
222
|
on your dragEntered() and prepareForDragOperation() methods to determine
|
191
223
|
if you can handle any of the data types offered up by the drag source.
|
192
224
|
|
193
|
-
@
|
225
|
+
@type Array
|
194
226
|
*/
|
195
227
|
dataTypes: function() {
|
196
228
|
// first try to use the data source.
|
@@ -217,7 +249,7 @@ SC.Drag = SC.Object.extend(
|
|
217
249
|
/**
|
218
250
|
Checks for a named data type in the drag.
|
219
251
|
|
220
|
-
@param
|
252
|
+
@param {String} dataType the data type
|
221
253
|
@returns {Boolean} YES if data type is present in dataTypes array.
|
222
254
|
*/
|
223
255
|
hasDataType: function(dataType) {
|
@@ -406,6 +438,7 @@ SC.Drag = SC.Object.extend(
|
|
406
438
|
// PRIVATE PROPERTIES AND METHODS
|
407
439
|
//
|
408
440
|
|
441
|
+
/** @private */
|
409
442
|
touchStart: function(evt) {
|
410
443
|
return YES;
|
411
444
|
},
|
@@ -539,6 +572,7 @@ SC.Drag = SC.Object.extend(
|
|
539
572
|
this._dragInProgress = NO ; // required by autoscroll (invoked by a timer)
|
540
573
|
},
|
541
574
|
|
575
|
+
/** @private */
|
542
576
|
touchEnd: function(evt){
|
543
577
|
this.mouseUp(evt);
|
544
578
|
},
|
@@ -594,16 +628,15 @@ SC.Drag = SC.Object.extend(
|
|
594
628
|
loc.y -= this.ghostOffset.y ;
|
595
629
|
var gV = this.ghostView;
|
596
630
|
if(gV) {
|
597
|
-
gV.adjust({ top: loc.y, left: loc.x }) ;
|
631
|
+
gV.adjust({ top: loc.y, left: loc.x }) ;
|
598
632
|
gV.invokeOnce('updateLayout') ;
|
599
633
|
}
|
600
634
|
},
|
601
635
|
|
602
|
-
/**
|
636
|
+
/** @private
|
603
637
|
YES if the ghostView has been manually hidden.
|
604
638
|
|
605
|
-
@
|
606
|
-
@type {Boolean}
|
639
|
+
@type Boolean
|
607
640
|
@default NO
|
608
641
|
*/
|
609
642
|
_ghostViewHidden: NO,
|
@@ -946,7 +979,7 @@ SC.Drag.mixin(
|
|
946
979
|
@param {SC.View} target a view implementing the SC.DropTarget protocol
|
947
980
|
*/
|
948
981
|
addDropTarget: function(target) {
|
949
|
-
this._dropTargets[SC.guidFor(target)] = target
|
982
|
+
this._dropTargets[SC.guidFor(target)] = target;
|
950
983
|
},
|
951
984
|
|
952
985
|
/**
|
@@ -958,7 +991,7 @@ SC.Drag.mixin(
|
|
958
991
|
@param {SC.View} target A previously registered drop target
|
959
992
|
*/
|
960
993
|
removeDropTarget: function(target) {
|
961
|
-
delete this._dropTargets[SC.guidFor(target)]
|
994
|
+
delete this._dropTargets[SC.guidFor(target)];
|
962
995
|
},
|
963
996
|
|
964
997
|
/**
|
@@ -968,7 +1001,7 @@ SC.Drag.mixin(
|
|
968
1001
|
@param {SC.View} target The view that should be auto-scrolled
|
969
1002
|
*/
|
970
1003
|
addScrollableView: function(target) {
|
971
|
-
this._scrollableViews[SC.guidFor(target)] = target
|
1004
|
+
this._scrollableViews[SC.guidFor(target)] = target;
|
972
1005
|
},
|
973
1006
|
|
974
1007
|
/**
|
@@ -978,7 +1011,7 @@ SC.Drag.mixin(
|
|
978
1011
|
@param {SC.View} target A previously registered scrollable view
|
979
1012
|
*/
|
980
1013
|
removeScrollableView: function(target) {
|
981
|
-
delete this._scrollableViews[SC.guidFor(target)]
|
1014
|
+
delete this._scrollableViews[SC.guidFor(target)];
|
982
1015
|
}
|
983
1016
|
|
984
1017
|
});
|
@@ -5,8 +5,9 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
/*
|
9
|
+
TODO More docs for this class
|
10
|
+
*/
|
10
11
|
|
11
12
|
/**
|
12
13
|
@class
|
@@ -15,7 +16,7 @@ require('core');
|
|
15
16
|
do is to make sure that you register a function with this manager to undo
|
16
17
|
every change you make. You can then invoke the undo/redo methods to do it.
|
17
18
|
|
18
|
-
|
19
|
+
## Using SC.UndoManager
|
19
20
|
|
20
21
|
Typically you create an undo manager inside on of your controllers. Then,
|
21
22
|
whenever you are about to perform an action on your model object, all you
|
@@ -25,29 +26,28 @@ require('core');
|
|
25
26
|
Besure the undo function you register also saves undo functions. This makes
|
26
27
|
redo possible.
|
27
28
|
|
28
|
-
More docs TBD.
|
29
|
-
|
30
29
|
@extends SC.Object
|
31
30
|
*/
|
32
31
|
SC.UndoManager = SC.Object.extend(
|
33
|
-
/** @scope SC.UndoManager.prototype */
|
34
|
-
{
|
32
|
+
/** @scope SC.UndoManager.prototype */ {
|
35
33
|
|
36
34
|
/**
|
37
|
-
(Property) Name of the next undo action name.
|
38
|
-
|
39
35
|
Use this property to build your Undo menu name.
|
40
36
|
|
37
|
+
@field
|
38
|
+
@type String
|
39
|
+
@default null
|
41
40
|
*/
|
42
41
|
undoActionName: function() {
|
43
42
|
return this.undoStack ? this.undoStack.name : null ;
|
44
43
|
}.property('undoStack'),
|
45
44
|
|
46
45
|
/**
|
47
|
-
(Property) Name of the next return action name.
|
48
|
-
|
49
46
|
Use this property to build your Redo menu name.
|
50
47
|
|
48
|
+
@field
|
49
|
+
@type String
|
50
|
+
@default null
|
51
51
|
*/
|
52
52
|
redoActionName: function() {
|
53
53
|
return this.redoStack ? this.redoStack.name : null ;
|
@@ -57,43 +57,57 @@ SC.UndoManager = SC.Object.extend(
|
|
57
57
|
True if there is an undo action on the stack.
|
58
58
|
|
59
59
|
Use to validate your menu item.
|
60
|
+
|
61
|
+
@field
|
62
|
+
@type Boolean
|
63
|
+
@default NO
|
60
64
|
*/
|
61
65
|
canUndo: function() {
|
62
|
-
|
66
|
+
// instead of this.undoStack !== null && this.undoStack !== undefined
|
67
|
+
return this.undoStack != null;
|
63
68
|
}.property('undoStack'),
|
64
69
|
|
65
70
|
/**
|
66
|
-
True if there is an redo action on the stack.
|
71
|
+
True if there is an redo action on the stack. Use to validate your menu item.
|
67
72
|
|
68
|
-
|
73
|
+
@field
|
74
|
+
@type Boolean
|
75
|
+
@default NO
|
69
76
|
*/
|
70
77
|
canRedo: function() {
|
78
|
+
// instead of this.redoStack !== null && this.redoStack !== undefined
|
71
79
|
return this.redoStack != null;
|
72
80
|
}.property('redoStack'),
|
73
81
|
|
74
|
-
/**
|
75
|
-
Tries to undo the last action.
|
76
|
-
|
77
|
-
|
82
|
+
/**
|
83
|
+
Tries to undo the last action. Fails if an undo group is currently open.
|
84
|
+
|
85
|
+
@returns {Boolean} YES if suceeded, NO otherwise.
|
78
86
|
*/
|
79
|
-
undo: function() {
|
80
|
-
|
81
|
-
|
82
|
-
Tries to redo the last action.
|
87
|
+
undo: function() {
|
88
|
+
this._undoOrRedo('undoStack','isUndoing');
|
89
|
+
},
|
83
90
|
|
84
|
-
|
91
|
+
/**
|
92
|
+
Tries to redo the last action. Fails if a redo group is currently open.
|
93
|
+
|
94
|
+
@returns {Boolean} YES if suceeded, NO otherwise.
|
85
95
|
*/
|
86
|
-
redo: function() {
|
96
|
+
redo: function() {
|
97
|
+
this._undoOrRedo('redoStack','isRedoing');
|
98
|
+
},
|
87
99
|
|
88
100
|
/**
|
89
|
-
|
101
|
+
@type Boolean
|
102
|
+
@default NO
|
90
103
|
*/
|
91
|
-
isUndoing:
|
104
|
+
isUndoing: NO,
|
92
105
|
|
93
106
|
/**
|
94
|
-
|
107
|
+
@type Boolean
|
108
|
+
@default NO
|
95
109
|
*/
|
96
|
-
isRedoing:
|
110
|
+
isRedoing: NO,
|
97
111
|
|
98
112
|
/** @private */
|
99
113
|
groupingLevel: 0,
|
@@ -126,6 +140,8 @@ SC.UndoManager = SC.Object.extend(
|
|
126
140
|
|
127
141
|
When you are finished performing the action, balance this with a call to
|
128
142
|
endUndoGroup().
|
143
|
+
|
144
|
+
@param {String} name
|
129
145
|
*/
|
130
146
|
beginUndoGroup: function(name) {
|
131
147
|
// is a group already active? Just increment the counter.
|
@@ -141,7 +157,12 @@ SC.UndoManager = SC.Object.extend(
|
|
141
157
|
}
|
142
158
|
},
|
143
159
|
|
144
|
-
/**
|
160
|
+
/**
|
161
|
+
@throws {Error} If there is no active group
|
162
|
+
|
163
|
+
@param {String} name
|
164
|
+
@see beginUndoGroup()
|
165
|
+
*/
|
145
166
|
endUndoGroup: function(name) {
|
146
167
|
// if more than one groups are active, just decrement the counter.
|
147
168
|
if (!this._activeGroup) raise("endUndoGroup() called outside group.") ;
|
@@ -156,9 +177,13 @@ SC.UndoManager = SC.Object.extend(
|
|
156
177
|
},
|
157
178
|
|
158
179
|
/**
|
159
|
-
Change the name of the current undo group.
|
160
|
-
|
180
|
+
Change the name of the current undo group.
|
181
|
+
|
161
182
|
Normally you don't want to do this as it will effect the whole group.
|
183
|
+
|
184
|
+
@param {String} name
|
185
|
+
|
186
|
+
@throws {Error} If there is no active group
|
162
187
|
*/
|
163
188
|
setActionName: function(name) {
|
164
189
|
if (!this._activeGroup) raise("setActionName() called outside group.") ;
|
@@ -168,8 +193,18 @@ SC.UndoManager = SC.Object.extend(
|
|
168
193
|
// --------------------------------
|
169
194
|
// PRIVATE
|
170
195
|
//
|
171
|
-
|
172
|
-
|
196
|
+
|
197
|
+
/** @private */
|
198
|
+
_activeGroup: null,
|
199
|
+
|
200
|
+
/** @private */
|
201
|
+
undoStack: null,
|
202
|
+
|
203
|
+
/** @private */
|
204
|
+
redoStack: null,
|
205
|
+
|
206
|
+
/** @private */
|
207
|
+
_undoOrRedo: function(stack, state) {
|
173
208
|
if (this._activeGroup) return false ;
|
174
209
|
if (this.get(stack) == null) return true; // noting to do.
|
175
210
|
|