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,7 +5,6 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
|
9
8
|
sc_require('panes/palette');
|
10
9
|
|
11
10
|
/**
|
@@ -23,200 +22,246 @@ sc_require('panes/palette');
|
|
23
22
|
perfect bottom (3) > perfect right (0) > perfect left (1) > perfect top (2)
|
24
23
|
fallback to perfect bottom (3)
|
25
24
|
*/
|
25
|
+
|
26
|
+
/**
|
27
|
+
@type String
|
28
|
+
@constant
|
29
|
+
@static
|
30
|
+
*/
|
26
31
|
SC.PICKER_MENU = 'menu';
|
32
|
+
|
33
|
+
/**
|
34
|
+
@type String
|
35
|
+
@constant
|
36
|
+
@static
|
37
|
+
*/
|
27
38
|
SC.PICKER_FIXED = 'fixed';
|
39
|
+
|
40
|
+
/**
|
41
|
+
@type String
|
42
|
+
@constant
|
43
|
+
@static
|
44
|
+
*/
|
28
45
|
SC.PICKER_POINTER = 'pointer';
|
46
|
+
|
47
|
+
/**
|
48
|
+
@type String
|
49
|
+
@constant
|
50
|
+
@static
|
51
|
+
*/
|
29
52
|
SC.PICKER_MENU_POINTER = 'menu-pointer';
|
53
|
+
|
30
54
|
/**
|
31
|
-
Pointer layout for perfect right/left/top/bottom
|
55
|
+
Pointer layout for perfect right/left/top/bottom.
|
56
|
+
|
57
|
+
@constant
|
58
|
+
@static
|
32
59
|
*/
|
33
60
|
SC.POINTER_LAYOUT = ["perfectRight", "perfectLeft", "perfectTop", "perfectBottom"];
|
34
61
|
|
35
62
|
/**
|
36
63
|
@class
|
37
64
|
|
38
|
-
Display a non-modal pane that automatically repositions around a view so as
|
39
|
-
to remain visible.
|
65
|
+
Display a non-modal pane that automatically repositions around a view so as
|
66
|
+
to remain visible.
|
40
67
|
|
41
|
-
An `SC.PickerPane` repositions around the view to which it is anchored as the
|
42
|
-
browser window is resized so as to ensure the pane's content remains visible.
|
43
|
-
A picker pane is useful for displaying supplementary information and does not
|
44
|
-
block the user's interaction with other UI elements. Picker panes typically
|
68
|
+
An `SC.PickerPane` repositions around the view to which it is anchored as the
|
69
|
+
browser window is resized so as to ensure the pane's content remains visible.
|
70
|
+
A picker pane is useful for displaying supplementary information and does not
|
71
|
+
block the user's interaction with other UI elements. Picker panes typically
|
45
72
|
provide a better user experience than modal panels.
|
46
73
|
|
47
|
-
An `SC.PickerPane` repositions itself according to the optional `preferMatrix`
|
48
|
-
argument passed in the `.popup()` method call. The `preferMatrix` either
|
49
|
-
specifies an offset-based arrangement behavior or a position-based arrangement
|
74
|
+
An `SC.PickerPane` repositions itself according to the optional `preferMatrix`
|
75
|
+
argument passed in the `.popup()` method call. The `preferMatrix` either
|
76
|
+
specifies an offset-based arrangement behavior or a position-based arrangement
|
50
77
|
behavior depending on the `preferType` argument in the `.popup()` call.
|
51
|
-
|
78
|
+
|
52
79
|
The simplest way to create and display a picker pane:
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
layout: { width: 400, height: 200 },
|
80
|
+
|
81
|
+
SC.PickerPane.create({
|
82
|
+
layout: { width: 400, height: 200 },
|
57
83
|
contentView: SC.View.extend({})
|
58
|
-
|
59
|
-
}}}
|
60
|
-
|
61
|
-
This displays the `SC.PickerPane` anchored to `someView`.
|
62
|
-
|
63
|
-
h2. Positioning
|
84
|
+
}).popup(someView);
|
64
85
|
|
65
|
-
|
66
|
-
|
86
|
+
This displays the `SC.PickerPane` anchored to `someView`.
|
87
|
+
|
88
|
+
## Positioning
|
67
89
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
90
|
+
Picker pane positioning can be classified into two broad categories:
|
91
|
+
offset-based and position-based.
|
92
|
+
|
93
|
+
### Offset-based
|
94
|
+
|
95
|
+
When `preferType` is unspecified, `SC.PICKER_MENU` or `SC.PICKER_FIXED`, then
|
96
|
+
the `preferMatrix` array describes the offset that is used to position the
|
72
97
|
pane below the anchor. The offset is described by an array of three values,
|
73
|
-
defaulting to `[1, 4, 3]`. The first value controls the x offset and the second
|
74
|
-
value the y offset. The third value can be `0` (right) or `3` (bottom),
|
75
|
-
controlling whether the origin of the pane is further offset by the width
|
76
|
-
(in the case of 0) or the height (in the case of 3) of the anchor.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
`SC.PickerPane` should display on when there isn't enough space around any
|
98
|
+
defaulting to `[1, 4, 3]`. The first value controls the x offset and the second
|
99
|
+
value the y offset. The third value can be `0` (right) or `3` (bottom),
|
100
|
+
controlling whether the origin of the pane is further offset by the width
|
101
|
+
(in the case of 0) or the height (in the case of 3) of the anchor.
|
102
|
+
|
103
|
+
### Position-based
|
104
|
+
|
105
|
+
When `preferType` is `SC.PICKER_POINTER` or `SC.PICKER_MENU_POINTER`, then
|
106
|
+
the `preferMatrix` specifies the sides in the order in which you want the
|
107
|
+
`SC.PickerPane` to try to arrange itself around the view to which it is
|
108
|
+
anchored. The fifth element in the `preferMatrix` specifies which side the
|
109
|
+
`SC.PickerPane` should display on when there isn't enough space around any
|
86
110
|
of the preferred sides.
|
87
111
|
|
88
|
-
Anchor sides are defined by their index in `SC.POINTER_LAYOUT`, where right
|
112
|
+
Anchor sides are defined by their index in `SC.POINTER_LAYOUT`, where right
|
89
113
|
is `0`, left is `1`, top is `2`, and bottom is `3`.
|
90
114
|
|
91
|
-
For example, the `preferMatrix` of `[3, 0, 1, 2, 2]` says: "Display below the
|
92
|
-
anchor (3); if there isn't enough space then display to the right of the anchor (0).
|
93
|
-
If there isn't enough space either below or to the right of the anchor, then appear
|
94
|
-
to the left (1), unless there is also no space on the left, in which case display
|
115
|
+
For example, the `preferMatrix` of `[3, 0, 1, 2, 2]` says: "Display below the
|
116
|
+
anchor (3); if there isn't enough space then display to the right of the anchor (0).
|
117
|
+
If there isn't enough space either below or to the right of the anchor, then appear
|
118
|
+
to the left (1), unless there is also no space on the left, in which case display
|
95
119
|
above the anchor (2)."
|
96
120
|
|
97
|
-
|
121
|
+
## Position Rules
|
98
122
|
|
99
|
-
When invoking `.popup()` you can optionally specify a picker position rule with
|
100
|
-
the `preferType` argument.
|
123
|
+
When invoking `.popup()` you can optionally specify a picker position rule with
|
124
|
+
the `preferType` argument.
|
101
125
|
|
102
|
-
If no `preferType` is specified, the picker pane is displayed just below the anchor.
|
103
|
-
The pane will reposition automatically for optimal visibility, ensuring the top-left
|
126
|
+
If no `preferType` is specified, the picker pane is displayed just below the anchor.
|
127
|
+
The pane will reposition automatically for optimal visibility, ensuring the top-left
|
104
128
|
corner is visible.
|
105
129
|
|
106
130
|
These position rules have the following behaviors:
|
107
131
|
|
108
|
-
|
132
|
+
### `SC.PICKER_MENU`
|
109
133
|
|
110
|
-
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]`.
|
111
|
-
Furthermore, a minimum left and right padding to window, of 7px and 8px, respectively,
|
134
|
+
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]`.
|
135
|
+
Furthermore, a minimum left and right padding to window, of 7px and 8px, respectively,
|
112
136
|
is enforced.
|
113
137
|
|
114
138
|
|
115
|
-
|
139
|
+
### `SC.PICKER_FIXED`
|
116
140
|
|
117
|
-
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]` and
|
141
|
+
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]` and
|
118
142
|
skipping `fitPositionToScreen`.
|
119
143
|
|
120
144
|
|
121
|
-
|
145
|
+
### `SC.PICKER_POINTER`
|
122
146
|
|
123
|
-
Positioning is position-based, with `preferMatrix` defaulting to `[0, 1, 2, 3, 2]`,
|
147
|
+
Positioning is position-based, with `preferMatrix` defaulting to `[0, 1, 2, 3, 2]`,
|
124
148
|
i.e. right > left > top > bottom; fallback to top.
|
125
149
|
|
126
150
|
|
127
|
-
|
151
|
+
### `SC.PICKER_MENU_POINTER`
|
128
152
|
|
129
|
-
Positioning is position-based, with `preferMatrix` defaulting to `[3, 0, 1, 2, 3]`,
|
153
|
+
Positioning is position-based, with `preferMatrix` defaulting to `[3, 0, 1, 2, 3]`,
|
130
154
|
i.e. bottom, right, left, top; fallback to bottom.
|
131
155
|
|
132
156
|
|
133
157
|
|
134
|
-
|
158
|
+
## Examples
|
135
159
|
|
136
160
|
Examples for applying popular customized picker position rules:
|
137
161
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
{{{
|
180
|
-
SC.PickerPane.create({
|
181
|
-
layout: { width: 400, height: 200 },
|
182
|
-
contentView: SC.View.extend({})
|
183
|
-
}).popup(anchor, SC.PICKER_POINTER);
|
184
|
-
}}}
|
162
|
+
### default:
|
163
|
+
|
164
|
+
SC.PickerPane.create({
|
165
|
+
layout: { width: 400, height: 200 },
|
166
|
+
contentView: SC.View.extend({})
|
167
|
+
}).popup(anchor);
|
168
|
+
|
169
|
+
### menu below the anchor with default `preferMatrix` of `[1,4,3]`:
|
170
|
+
|
171
|
+
SC.PickerPane.create({
|
172
|
+
layout: { width: 400, height: 200 },
|
173
|
+
contentView: SC.View.extend({})
|
174
|
+
}).popup(anchor, SC.PICKER_MENU);
|
175
|
+
|
176
|
+
### menu on the right side of anchor with custom `preferMatrix` of `[2,6,0]`:
|
177
|
+
|
178
|
+
SC.PickerPane.create({
|
179
|
+
layout: { width: 400, height: 200 },
|
180
|
+
contentView: SC.View.extend({})
|
181
|
+
}).popup(anchor, SC.PICKER_MENU, [2,6,0]);
|
182
|
+
|
183
|
+
### fixed below the anchor with default `preferMatrix` of `[1,4,3]`:
|
184
|
+
|
185
|
+
SC.PickerPane.create({
|
186
|
+
layout: { width: 400, height: 200 },
|
187
|
+
contentView: SC.View.extend({})
|
188
|
+
}).popup(anchor, SC.PICKER_FIXED);
|
189
|
+
|
190
|
+
### fixed on the right side of anchor with `preferMatrix` of `[-22,-17,0]`:
|
191
|
+
|
192
|
+
SC.PickerPane.create({
|
193
|
+
layout: { width: 400, height: 200 },
|
194
|
+
contentView: SC.View.extend({})
|
195
|
+
}).popup(anchor, SC.PICKER_FIXED, [-22,-17,0]);
|
196
|
+
|
197
|
+
### pointer with default `preferMatrix` of `[0,1,2,3,2]`:
|
198
|
+
|
199
|
+
SC.PickerPane.create({
|
200
|
+
layout: { width: 400, height: 200 },
|
201
|
+
contentView: SC.View.extend({})
|
202
|
+
}).popup(anchor, SC.PICKER_POINTER);
|
185
203
|
|
186
204
|
Positioning: right (0) > left (1) > top (2) > bottom (3). Fallback to top (2).
|
187
205
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
}}}
|
206
|
+
### pointer with custom `preferMatrix` of `[3,0,1,2,2]`:
|
207
|
+
|
208
|
+
SC.PickerPane.create({
|
209
|
+
layout: { width: 400, height: 200 },
|
210
|
+
contentView: SC.View.extend({})
|
211
|
+
}).popup(anchor, SC.PICKER_POINTER, [3,0,1,2,2]);
|
195
212
|
|
196
213
|
Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to top (2).
|
197
214
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
}}}
|
215
|
+
### menu-pointer with default `preferMatrix` of `[3,0,1,2,3]`:
|
216
|
+
|
217
|
+
SC.PickerPane.create({
|
218
|
+
layout: { width: 400, height: 200 },
|
219
|
+
contentView: SC.View.extend({})
|
220
|
+
}).popup(anchor, SC.PICKER_MENU_POINTER);
|
205
221
|
|
206
222
|
Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to bottom (3).
|
207
223
|
|
208
224
|
@extends SC.PalettePane
|
209
225
|
@since SproutCore 1.0
|
210
226
|
*/
|
211
|
-
SC.PickerPane = SC.PalettePane.extend(
|
227
|
+
SC.PickerPane = SC.PalettePane.extend(
|
228
|
+
/** @scope SC.PickerPane.prototype */ {
|
229
|
+
|
230
|
+
/**
|
231
|
+
@type Array
|
232
|
+
@default ['sc-picker']
|
233
|
+
@see SC.View#classNames
|
234
|
+
*/
|
235
|
+
classNames: ['sc-picker'],
|
212
236
|
|
213
|
-
|
237
|
+
/**
|
238
|
+
@type Boolean
|
239
|
+
@default YES
|
240
|
+
*/
|
214
241
|
isAnchored: YES,
|
215
242
|
|
243
|
+
/**
|
244
|
+
@type Boolean
|
245
|
+
@default YES
|
246
|
+
*/
|
216
247
|
isModal: YES,
|
217
248
|
|
249
|
+
/**
|
250
|
+
@type String
|
251
|
+
@default 'perfectRight'
|
252
|
+
*/
|
218
253
|
pointerPos: 'perfectRight',
|
254
|
+
|
255
|
+
/**
|
256
|
+
@type Number
|
257
|
+
@default 0
|
258
|
+
*/
|
219
259
|
pointerPosX: 0,
|
260
|
+
|
261
|
+
/**
|
262
|
+
@type Number
|
263
|
+
@default 0
|
264
|
+
*/
|
220
265
|
pointerPosY: 0,
|
221
266
|
|
222
267
|
/**
|
@@ -224,42 +269,48 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
224
269
|
triggered your picker to show. You can use this to properly position your
|
225
270
|
picker.
|
226
271
|
|
227
|
-
@
|
272
|
+
@type HTMLElement
|
273
|
+
@default null
|
228
274
|
*/
|
229
275
|
anchorElement: null,
|
230
276
|
|
231
|
-
/**
|
277
|
+
/** @private
|
232
278
|
anchor rect calculated by computeAnchorRect from init popup
|
233
279
|
|
234
|
-
@
|
280
|
+
@type Hash
|
281
|
+
@default null
|
235
282
|
*/
|
236
283
|
anchorCached: null,
|
237
284
|
|
238
285
|
/**
|
239
286
|
popular customized picker position rule
|
240
287
|
|
241
|
-
@
|
288
|
+
@type String
|
289
|
+
@default null
|
242
290
|
*/
|
243
291
|
preferType: null,
|
244
292
|
|
245
293
|
/**
|
246
294
|
default/custom offset or position pref matrix for specific preferType
|
247
295
|
|
248
|
-
@
|
296
|
+
@type String
|
297
|
+
@default null
|
249
298
|
*/
|
250
299
|
preferMatrix: null,
|
251
300
|
|
252
301
|
/**
|
253
302
|
default/custom offset of pointer for picker-pointer or pointer-menu
|
254
303
|
|
255
|
-
@
|
304
|
+
@type Array
|
305
|
+
@default null
|
256
306
|
*/
|
257
307
|
pointerOffset: null,
|
258
308
|
|
259
309
|
/**
|
260
310
|
default offset of extra-right pointer for picker-pointer or pointer-menu
|
261
311
|
|
262
|
-
@
|
312
|
+
@type Number
|
313
|
+
@default 0
|
263
314
|
*/
|
264
315
|
extraRightOffset: 0,
|
265
316
|
|
@@ -272,7 +323,8 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
272
323
|
set to null, then the button will search the responder chain for a view that
|
273
324
|
implements the action when the button is pressed instead.
|
274
325
|
|
275
|
-
@
|
326
|
+
@type Object
|
327
|
+
@default null
|
276
328
|
*/
|
277
329
|
removeTarget: null,
|
278
330
|
|
@@ -290,17 +342,18 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
290
342
|
Note that this property is optional. If no explicit value is provided then the
|
291
343
|
picker pane will perform the default action which is to simply remove itself.
|
292
344
|
|
293
|
-
@
|
345
|
+
@type String
|
346
|
+
@default null
|
294
347
|
*/
|
295
348
|
removeAction: null,
|
296
349
|
|
297
350
|
/**
|
298
|
-
Displays a new picker pane
|
299
|
-
|
300
|
-
|
301
|
-
@param {
|
302
|
-
@param {
|
303
|
-
@param {
|
351
|
+
Displays a new picker pane.
|
352
|
+
|
353
|
+
@param {SC.View|HTMLElement} anchorViewOrElement view or element to anchor to
|
354
|
+
@param {String} [preferType] apply picker position rule
|
355
|
+
@param {Array} [preferMatrix] apply custom offset or position pref matrix for specific preferType
|
356
|
+
@param {Number} [pointerOffset]
|
304
357
|
@returns {SC.PickerPane} receiver
|
305
358
|
*/
|
306
359
|
popup: function(anchorViewOrElement, preferType, preferMatrix, pointerOffset) {
|
@@ -731,8 +784,17 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
731
784
|
}
|
732
785
|
},
|
733
786
|
|
787
|
+
/**
|
788
|
+
@type Array
|
789
|
+
@default ['preferType','pointerPos','pointerPosY']
|
790
|
+
@see SC.View#displayProperties
|
791
|
+
*/
|
734
792
|
displayProperties: ['preferType','pointerPos','pointerPosY'],
|
735
793
|
|
794
|
+
/**
|
795
|
+
@type String
|
796
|
+
@default 'pickerRenderDelegate'
|
797
|
+
*/
|
736
798
|
renderDelegateName: 'pickerRenderDelegate',
|
737
799
|
|
738
800
|
/** @private - click away picker. */
|
@@ -751,6 +813,7 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
751
813
|
return YES ;
|
752
814
|
},
|
753
815
|
|
816
|
+
/** @private */
|
754
817
|
mouseDown: function(evt) {
|
755
818
|
return this.modalPaneDidClick(evt);
|
756
819
|
},
|
@@ -765,13 +828,12 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
765
828
|
},
|
766
829
|
|
767
830
|
/**
|
768
|
-
Invoked by the root responder. Re-position picker whenever the window resizes.
|
831
|
+
Invoked by the root responder. Re-position picker whenever the window resizes.
|
769
832
|
*/
|
770
833
|
windowSizeDidChange: function(oldSize, newSize) {
|
771
834
|
this.positionPane();
|
772
835
|
},
|
773
836
|
|
774
|
-
|
775
837
|
remove: function(){
|
776
838
|
if(this.get('isVisibleInWindow') && this.get('isPaneAttached')) this._showOverflow();
|
777
839
|
return sc_super();
|
@@ -790,12 +852,12 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
790
852
|
if(windowSize.width>=minWidth && windowSize.height>=minHeight){
|
791
853
|
SC.PICKERS_OPEN++;
|
792
854
|
//console.log(this.toString()+" "+SC.PICKERS_OPEN);
|
793
|
-
if(SC.PICKERS_OPEN > 0) body.css('overflow', 'hidden');
|
855
|
+
if(SC.PICKERS_OPEN > 0) body.css('overflow', 'hidden');
|
794
856
|
}
|
795
857
|
},
|
796
858
|
|
797
859
|
/** @private
|
798
|
-
Internal method to show the overflow on the body to make sure we don't
|
860
|
+
Internal method to show the overflow on the body to make sure we don't
|
799
861
|
show scrollbars when the picker has shadows, as it's really anoying.
|
800
862
|
*/
|
801
863
|
_showOverflow: function(){
|
@@ -816,21 +878,62 @@ SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
|
816
878
|
// show/hide the body overflow.
|
817
879
|
SC.PICKERS_OPEN = 0;
|
818
880
|
|
881
|
+
/**
|
882
|
+
@static
|
883
|
+
*/
|
819
884
|
SC.PickerPane.PICKER_POINTER_OFFSET = [9, -9, -18, 18];
|
885
|
+
|
886
|
+
/**
|
887
|
+
@static
|
888
|
+
*/
|
820
889
|
SC.PickerPane.PICKER_EXTRA_RIGHT_OFFSET = 20;
|
821
890
|
|
891
|
+
/**
|
892
|
+
@static
|
893
|
+
*/
|
822
894
|
SC.PickerPane.TINY_PICKER_MENU_POINTER_OFFSET = [9, -9, -18, 18];
|
895
|
+
|
896
|
+
/**
|
897
|
+
@static
|
898
|
+
*/
|
823
899
|
SC.PickerPane.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;
|
824
900
|
|
901
|
+
/**
|
902
|
+
@static
|
903
|
+
*/
|
825
904
|
SC.PickerPane.SMALL_PICKER_MENU_POINTER_OFFSET = [9, -9, -8, 8];
|
905
|
+
|
906
|
+
/**
|
907
|
+
@static
|
908
|
+
*/
|
826
909
|
SC.PickerPane.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET = 11;
|
827
910
|
|
911
|
+
/**
|
912
|
+
@static
|
913
|
+
*/
|
828
914
|
SC.PickerPane.REGULAR_PICKER_MENU_POINTER_OFFSET = [9, -9, -12, 12];
|
829
|
-
|
915
|
+
|
916
|
+
/**
|
917
|
+
@static
|
918
|
+
*/
|
830
919
|
SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;
|
831
920
|
|
921
|
+
/**
|
922
|
+
@static
|
923
|
+
*/
|
832
924
|
SC.PickerPane.LARGE_PICKER_MENU_POINTER_OFFSET = [9, -9, -16, 16];
|
925
|
+
|
926
|
+
/**
|
927
|
+
@static
|
928
|
+
*/
|
833
929
|
SC.PickerPane.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET = 17;
|
834
930
|
|
931
|
+
/**
|
932
|
+
@static
|
933
|
+
*/
|
835
934
|
SC.PickerPane.HUGE_PICKER_MENU_POINTER_OFFSET = [9, -9, -18, 18];
|
935
|
+
|
936
|
+
/**
|
937
|
+
@static
|
938
|
+
*/
|
836
939
|
SC.PickerPane.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET = 12;
|