sproutcore 1.0.1037 → 1.0.1042
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +31 -0
- data/README.txt +3 -1
- data/Rakefile +11 -4
- data/VERSION.yml +3 -3
- data/buildtasks/build.rake +5 -0
- data/frameworks/sproutcore/Buildfile +3 -1
- data/frameworks/sproutcore/frameworks/animation/Buildfile +3 -0
- data/frameworks/sproutcore/frameworks/animation/LICENSE +25 -0
- data/frameworks/sproutcore/frameworks/animation/README.md +102 -0
- data/frameworks/sproutcore/frameworks/animation/core.js +934 -0
- data/frameworks/sproutcore/frameworks/animation/tests/core.js +65 -0
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +28 -16
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +5 -2
- data/frameworks/sproutcore/frameworks/datastore/system/many_array.js +4 -0
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +27 -13
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +36 -6
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +7 -7
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +2 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +13 -0
- data/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +250 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -12
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +3 -6
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -8
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -1
- data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +11 -4
- data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +24 -23
- data/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +91 -60
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +124 -24
- data/frameworks/sproutcore/frameworks/desktop/system/drag.js +5 -5
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +33 -25
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/pane_page.js +41 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +30 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +27 -21
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +81 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +3 -4
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +65 -36
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +4 -7
- data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +8 -4
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +38 -5
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +5 -1
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -1
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +19 -13
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +30 -2
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +14 -17
- data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -2
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +58 -59
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -1
- data/frameworks/sproutcore/frameworks/desktop/views/well.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/core.js +6 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +2 -1
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +33 -30
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +8 -4
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +61 -12
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +151 -131
- data/frameworks/sproutcore/frameworks/foundation/system/datetime.js +29 -23
- data/frameworks/sproutcore/frameworks/foundation/system/event.js +18 -10
- data/frameworks/sproutcore/frameworks/foundation/system/page.js +7 -5
- data/frameworks/sproutcore/frameworks/foundation/system/ready.js +1 -0
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +9 -6
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +41 -6
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +89 -24
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +0 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +27 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +6 -6
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +65 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertLayouts.js +145 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js +48 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/nextValidKeyView.js +91 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/number.js +9 -5
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +16 -14
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +89 -67
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +221 -73
- data/frameworks/sproutcore/frameworks/runtime/core.js +43 -22
- data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +6 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +53 -34
- data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +7 -3
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +19 -19
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +132 -88
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -9
- data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +6 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +69 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +14 -2
- data/frameworks/sproutcore/license.js +3 -1
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_222222.png +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_454545.png +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_888888.png +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_ffffff.png +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-x.png +0 -0
- data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-y.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +15 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +9 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panel.css +33 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/picker.css +17 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +9 -6
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/well.css +36 -0
- data/gen/controller/templates/controllers/@filename@.js +1 -1
- data/lib/sproutcore/builders/minify.rb +45 -13
- data/lib/sproutcore/helpers/static_helper.rb +2 -2
- data/lib/sproutcore/models/manifest_entry.rb +42 -1
- data/lib/sproutcore/tools/build.rb +18 -2
- data/spec/lib/models/manifest_entry/hyperdomain_prefix.rb +34 -0
- data/vendor/yui-compressor/SCyuicompressor-2.4.2.jar +0 -0
- metadata +28 -22
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
@@ -95,13 +95,8 @@
|
|
95
95
|
border: 1px #333 solid;
|
96
96
|
}
|
97
97
|
|
98
|
-
.sc-list-item-view .sc-checkbox-view.sel {
|
99
|
-
background-image: sc_static('icons/mini_454545');
|
100
|
-
background-position: -66px -147px;
|
101
|
-
}
|
102
98
|
|
103
99
|
.sc-list-item-view .sc-checkbox-view.active {
|
104
|
-
background-image: sc_static('icons/mini_ffffff');
|
105
100
|
background-color: #333;
|
106
101
|
border-color: black;
|
107
102
|
}
|
@@ -156,13 +151,6 @@
|
|
156
151
|
right: 1px;
|
157
152
|
top: 50%;
|
158
153
|
margin-top: -8px;
|
159
|
-
background-image: sc_static('icons/mini_454545');
|
160
|
-
background-position: -32px 0;
|
161
|
-
}
|
162
|
-
|
163
|
-
.sc-list-item-view.sel .branch,
|
164
|
-
.sc-list-item-view.active .branch {
|
165
|
-
background-image: sc_static('icons/mini_ffffff');
|
166
154
|
}
|
167
155
|
|
168
156
|
/* @end */
|
@@ -24,7 +24,6 @@
|
|
24
24
|
left: 0px;
|
25
25
|
right: 0px;
|
26
26
|
line-height: 22px;
|
27
|
-
text-shadow: #b0b0b0 0px 1px 0px;
|
28
27
|
text-decoration: none ;
|
29
28
|
text-align: left;
|
30
29
|
color: black;
|
@@ -36,7 +35,6 @@
|
|
36
35
|
}
|
37
36
|
|
38
37
|
.sc-menu-item.disabled{
|
39
|
-
background-color:#E0E0E0;
|
40
38
|
border:none;
|
41
39
|
color:#A0A0A0;
|
42
40
|
}
|
@@ -75,16 +73,16 @@
|
|
75
73
|
.sc-pane.sc-panel > .sc-view.sc-menu-item.focus,
|
76
74
|
.sc-menu-item a:hover {
|
77
75
|
background-color: #5A8EC6;
|
76
|
+
color: #fff;
|
78
77
|
}
|
79
78
|
|
80
79
|
.sc-menu-item.disabled a:hover {
|
81
|
-
background-color:
|
80
|
+
background-color: transparent;
|
81
|
+
color:#A0A0A0;
|
82
82
|
}
|
83
83
|
/* @end */
|
84
84
|
|
85
85
|
.sc-menu-item div.checkbox {
|
86
|
-
background-image: sc_static('icons/mini_454545');
|
87
|
-
background-position: -66px -147px;
|
88
86
|
position: absolute;
|
89
87
|
display: block;
|
90
88
|
width: 12px;
|
@@ -96,7 +94,6 @@
|
|
96
94
|
}
|
97
95
|
|
98
96
|
.sc-menu-item.focus div.checkbox {
|
99
|
-
background-image: sc_static('icons/mini_ffffff');
|
100
97
|
}
|
101
98
|
|
102
99
|
|
@@ -19,7 +19,6 @@
|
|
19
19
|
}
|
20
20
|
|
21
21
|
.sc-pane.sc-panel > .top-right-edge {
|
22
|
-
background: static_url('images/panels/sprite-x.png') no-repeat -40px -120px;
|
23
22
|
position: absolute;
|
24
23
|
width: 40px;
|
25
24
|
height: 40px;
|
@@ -29,7 +28,6 @@
|
|
29
28
|
}
|
30
29
|
|
31
30
|
.sc-pane.sc-panel > .top-left-edge {
|
32
|
-
background: static_url('images/panels/sprite-x.png') no-repeat 0px -120px;
|
33
31
|
position: absolute;
|
34
32
|
width: 40px;
|
35
33
|
height: 40px;
|
@@ -39,7 +37,6 @@
|
|
39
37
|
}
|
40
38
|
|
41
39
|
.sc-pane.sc-panel > .bottom-left-edge {
|
42
|
-
background: static_url('images/panels/sprite-x.png') no-repeat 0px -160px;
|
43
40
|
position: absolute;
|
44
41
|
width: 40px;
|
45
42
|
height: 40px;
|
@@ -49,7 +46,6 @@
|
|
49
46
|
}
|
50
47
|
|
51
48
|
.sc-pane.sc-panel > .bottom-right-edge {
|
52
|
-
background: static_url('images/panels/sprite-x.png') no-repeat -40px -160px;
|
53
49
|
position: absolute;
|
54
50
|
width: 40px;
|
55
51
|
height: 40px;
|
@@ -59,7 +55,6 @@
|
|
59
55
|
}
|
60
56
|
|
61
57
|
.sc-pane.sc-panel > .top-edge {
|
62
|
-
background: static_url('images/panels/sprite-x.png') repeat-x 0px -230px;
|
63
58
|
position: absolute;
|
64
59
|
height: 20px;
|
65
60
|
top: -20px;
|
@@ -69,7 +64,6 @@
|
|
69
64
|
}
|
70
65
|
|
71
66
|
.sc-pane.sc-panel > .bottom-edge {
|
72
|
-
background: static_url('images/panels/sprite-x.png') repeat-x 0px -210px;
|
73
67
|
position: absolute;
|
74
68
|
height: 20px;
|
75
69
|
bottom: -20px;
|
@@ -79,7 +73,6 @@
|
|
79
73
|
}
|
80
74
|
|
81
75
|
.sc-pane.sc-panel > .left-edge {
|
82
|
-
background: static_url('images/panels/sprite-y.png') repeat-y 0px 0px;
|
83
76
|
position: absolute;
|
84
77
|
width: 20px;
|
85
78
|
top: 20px;
|
@@ -89,7 +82,6 @@
|
|
89
82
|
}
|
90
83
|
|
91
84
|
.sc-pane.sc-panel > .right-edge {
|
92
|
-
background: static_url('images/panels/sprite-y.png') repeat-y -20px 0px;
|
93
85
|
position: absolute;
|
94
86
|
width: 20px;
|
95
87
|
top: 20px;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/** SC.PickerPane Support */
|
2
2
|
|
3
3
|
.sc-pane.sc-panel.sc-picker .perfectRight {
|
4
|
-
background: static_url('images/panels/sprite-x.png') no-repeat 0px -30px;
|
5
4
|
position: absolute;
|
6
5
|
width: 25px;
|
7
6
|
height: 51px;
|
@@ -10,7 +9,6 @@
|
|
10
9
|
}
|
11
10
|
|
12
11
|
.sc-pane.sc-panel.sc-picker .perfectLeft {
|
13
|
-
background: static_url('images/panels/sprite-x.png') no-repeat -30px -30px;
|
14
12
|
position: absolute;
|
15
13
|
width: 25px;
|
16
14
|
height: 51px;
|
@@ -19,7 +17,6 @@
|
|
19
17
|
}
|
20
18
|
|
21
19
|
.sc-pane.sc-panel.sc-picker .perfectTop {
|
22
|
-
background: static_url('images/panels/sprite-x.png') no-repeat 0px -90px;
|
23
20
|
position: absolute;
|
24
21
|
width: 51px;
|
25
22
|
height: 25px;
|
@@ -29,7 +26,6 @@
|
|
29
26
|
}
|
30
27
|
|
31
28
|
.sc-pane.sc-panel.sc-picker .perfectBottom {
|
32
|
-
background: static_url('images/panels/sprite-x.png') no-repeat 0px 0px;
|
33
29
|
position: absolute;
|
34
30
|
width: 51px;
|
35
31
|
height: 25px;
|
@@ -229,7 +229,7 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
229
229
|
SC.View.extend({
|
230
230
|
layout: { bottom: 13, height: 24, right: 18, width: 466 },
|
231
231
|
childViews: ['cancelButton', 'okButton'],
|
232
|
-
classNames: ['
|
232
|
+
classNames: ['text-align-right'],
|
233
233
|
cancelButton : SC.ButtonView.extend({
|
234
234
|
useStaticLayout: YES,
|
235
235
|
actionKey: SC.BUTTON2_STATUS,
|
@@ -350,6 +350,7 @@ SC.AlertPane.show = function(message, description, caption, button1Title, button
|
|
350
350
|
title = args[idx + 3];
|
351
351
|
if (title) {
|
352
352
|
button.set('title', title).set('isVisible', YES);
|
353
|
+
if(title=='?') button.set('titleMinWidth', 0);
|
353
354
|
if (idx==2) {
|
354
355
|
var button_wrapper = ret.get('buttonThreeWrapper');
|
355
356
|
button_wrapper.set('isVisible', YES);
|
@@ -493,6 +493,10 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
493
493
|
action, isEnabled, target, idx;
|
494
494
|
if(!this.get('isEnabled')) return NO ;
|
495
495
|
this.displayItems() ;
|
496
|
+
|
497
|
+
// Make sure we redraw the menu items if they've changed
|
498
|
+
SC.RunLoop.begin().end();
|
499
|
+
|
496
500
|
items = this.get('displayItemsArray') ;
|
497
501
|
if (!items) return NO;
|
498
502
|
|
@@ -570,12 +574,15 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
570
574
|
@returns MenuItemView
|
571
575
|
*/
|
572
576
|
getPreviousEnabledMenuItem : function(menuItem) {
|
573
|
-
var content, itemView,
|
577
|
+
var content, itemView, len, idx, menuIdx, isEnabled, isSeparator,
|
578
|
+
menuItemViews = this.get('menuItemViews') ;
|
574
579
|
if(menuItemViews) {
|
575
|
-
|
576
|
-
|
580
|
+
len = menuItemViews.length ;
|
581
|
+
idx = (menuItemViews.indexOf(menuItem) === -1) ?
|
577
582
|
len : menuItemViews.indexOf(menuItem) ;
|
578
|
-
|
583
|
+
menuIdx = idx;
|
584
|
+
isEnabled = NO;
|
585
|
+
isSeparator = NO ;
|
579
586
|
while((!isEnabled || isSeparator) && --idx !== menuIdx) {
|
580
587
|
if(idx === -1) idx = len - 1;
|
581
588
|
itemView = menuItemViews[idx];
|
@@ -50,6 +50,7 @@ SC.PalettePane = SC.PanelPane.extend({
|
|
50
50
|
var f=this.get('frame');
|
51
51
|
this._mouseOffsetX = f ? (f.x - evt.pageX) : 0;
|
52
52
|
this._mouseOffsetY = f ? (f.y - evt.pageY) : 0;
|
53
|
+
return YES;
|
53
54
|
},
|
54
55
|
|
55
56
|
mouseDragged: function(evt) {
|
@@ -57,6 +58,7 @@ SC.PalettePane = SC.PanelPane.extend({
|
|
57
58
|
this.set('layout', { width: this.layout.width, height: this.layout.height, left: this._mouseOffsetX + evt.pageX, top: this._mouseOffsetY + evt.pageY });
|
58
59
|
this.updateLayout();
|
59
60
|
}
|
61
|
+
return YES;
|
60
62
|
}
|
61
63
|
|
62
64
|
|
@@ -180,7 +180,7 @@ SC.PickerPane = SC.PalettePane.extend({
|
|
180
180
|
switch (preferType) {
|
181
181
|
case SC.PICKER_MENU:
|
182
182
|
case SC.PICKER_FIXED:
|
183
|
-
if(!preferMatrix || preferMatrix.length
|
183
|
+
if(!preferMatrix || preferMatrix.length !== 3) {
|
184
184
|
// default below the anchor with fine tunned visual alignment
|
185
185
|
// for Menu to appear just below the anchorElement.
|
186
186
|
this.set('preferMatrix', [1, 4, 3]) ;
|
@@ -324,20 +324,20 @@ SC.PickerPane = SC.PalettePane.extend({
|
|
324
324
|
|
325
325
|
var prefP1 =[[a.x+a.width+(7+overlapTunningX), a.y+parseInt(a.height/2,0)-40],
|
326
326
|
[a.x-f.width-(7+overlapTunningX), a.y+parseInt(a.height/2,0)-40],
|
327
|
-
[a.x+parseInt(a.width/2
|
328
|
-
[a.x+parseInt(a.width/2
|
327
|
+
[a.x+parseInt((a.width/2)-(f.width/2),0), a.y-f.height-(17+overlapTunningY)],
|
328
|
+
[a.x+parseInt((a.width/2)-(f.width/2),0), a.y+a.height+(17+overlapTunningY)]];
|
329
329
|
// bottom-right corner of 4 perfect positioned f (4x2)
|
330
330
|
var prefP2 =[[a.x+a.width+f.width+(7+overlapTunningX), a.y+parseInt(a.height/2,0)+f.height-24],
|
331
331
|
[a.x-(7+overlapTunningX), a.y+parseInt(a.height/2,0)+f.height-24],
|
332
|
-
[a.x+parseInt(a.width/2
|
333
|
-
[a.x+parseInt(a.width/2
|
332
|
+
[a.x+parseInt((a.width/2)-(f.width/2),0)+f.width, a.y-(17+overlapTunningY)],
|
333
|
+
[a.x+parseInt((a.width/2)-(f.width/2),0)+f.width, a.y+a.height+f.height+(17+overlapTunningY)]];
|
334
334
|
// cutoff of 4 perfect positioned f: top, right, bottom, left (4x4)
|
335
335
|
var cutoffPrefP =[[prefP1[0][1]>0 ? 0 : 0-prefP1[0][1], prefP2[0][0]<w.width ? 0 : prefP2[0][0]-w.width, prefP2[0][1]<w.height ? 0 : prefP2[0][1]-w.height, prefP1[0][0]>0 ? 0 : 0-prefP1[0][0]],
|
336
336
|
[prefP1[1][1]>0 ? 0 : 0-prefP1[1][1], prefP2[1][0]<w.width ? 0 : prefP2[1][0]-w.width, prefP2[1][1]<w.height ? 0 : prefP2[1][1]-w.height, prefP1[1][0]>0 ? 0 : 0-prefP1[1][0]],
|
337
337
|
[prefP1[2][1]>0 ? 0 : 0-prefP1[2][1], prefP2[2][0]<w.width ? 0 : prefP2[2][0]-w.width, prefP2[2][1]<w.height ? 0 : prefP2[2][1]-w.height, prefP1[2][0]>0 ? 0 : 0-prefP1[2][0]],
|
338
338
|
[prefP1[3][1]>0 ? 0 : 0-prefP1[3][1], prefP2[3][0]<w.width ? 0 : prefP2[3][0]-w.width, prefP2[3][1]<w.height ? 0 : prefP2[3][1]-w.height, prefP1[3][0]>0 ? 0 : 0-prefP1[3][0]]];
|
339
339
|
|
340
|
-
if(!this.preferMatrix || this.preferMatrix.length
|
340
|
+
if(!this.preferMatrix || this.preferMatrix.length !== 5) {
|
341
341
|
// default re-position rule : perfect right (0) > perfect left (1) > perfect top (2) > perfect bottom (3)
|
342
342
|
// fallback to perfect top (2)
|
343
343
|
this.set('preferMatrix', [0,1,2,3,2]) ;
|
@@ -361,31 +361,32 @@ SC.PickerPane = SC.PalettePane.extend({
|
|
361
361
|
}
|
362
362
|
this.set('pointerPosX', 0);
|
363
363
|
|
364
|
-
for(var i=0
|
365
|
-
|
364
|
+
for(var i=0, cM, pointerLen=SC.POINTER_LAYOUT.length; i<pointerLen; i++) {
|
365
|
+
cM = m[i];
|
366
|
+
if (cutoffPrefP[cM][0]===0 && cutoffPrefP[cM][1]===0 && cutoffPrefP[cM][2]===0 && cutoffPrefP[cM][3]===0) {
|
366
367
|
// alternative i in preferMatrix by priority
|
367
|
-
if (m[4]
|
368
|
-
f.x = prefP1[
|
369
|
-
f.y = prefP1[
|
368
|
+
if (m[4] !== cM) {
|
369
|
+
f.x = prefP1[cM][0] ;
|
370
|
+
f.y = prefP1[cM][1] ;
|
370
371
|
this.set('pointerPosY', 0);
|
371
|
-
this.set('pointerPos', SC.POINTER_LAYOUT[
|
372
|
+
this.set('pointerPos', SC.POINTER_LAYOUT[cM]);
|
372
373
|
}
|
373
374
|
i = SC.POINTER_LAYOUT.length;
|
374
|
-
} else if ((
|
375
|
-
if (m[4]
|
376
|
-
f.x = prefP1[
|
377
|
-
this.set('pointerPos', SC.POINTER_LAYOUT[
|
375
|
+
} else if ((cM === 0 || cM === 1) && cutoffPrefP[cM][0]===0 && cutoffPrefP[cM][1]===0 && cutoffPrefP[cM][2] < f.height-91 && cutoffPrefP[cM][3]===0) {
|
376
|
+
if (m[4] !== cM) {
|
377
|
+
f.x = prefP1[cM][0] ;
|
378
|
+
this.set('pointerPos', SC.POINTER_LAYOUT[cM]);
|
378
379
|
}
|
379
|
-
f.y = prefP1[
|
380
|
-
this.set('pointerPosY', cutoffPrefP[
|
380
|
+
f.y = prefP1[cM][1] - cutoffPrefP[cM][2];
|
381
|
+
this.set('pointerPosY', cutoffPrefP[cM][2]);
|
381
382
|
i = SC.POINTER_LAYOUT.length;
|
382
|
-
} else if ((
|
383
|
-
if (m[4]
|
384
|
-
f.x = prefP1[
|
383
|
+
} else if ((cM === 0 || cM === 1) && cutoffPrefP[cM][0]===0 && cutoffPrefP[cM][1]===0 && cutoffPrefP[cM][2] <= f.height-57 && cutoffPrefP[cM][3]===0) {
|
384
|
+
if (m[4] !== cM) {
|
385
|
+
f.x = prefP1[cM][0] ;
|
385
386
|
}
|
386
|
-
f.y = prefP1[
|
387
|
+
f.y = prefP1[cM][1] - (f.height-57) ;
|
387
388
|
this.set('pointerPosY', (f.height-59));
|
388
|
-
this.set('pointerPos', SC.POINTER_LAYOUT[
|
389
|
+
this.set('pointerPos', SC.POINTER_LAYOUT[cM]+' extra-low');
|
389
390
|
i = SC.POINTER_LAYOUT.length;
|
390
391
|
}
|
391
392
|
}
|
@@ -255,6 +255,16 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
255
255
|
customView used to draw the menu
|
256
256
|
*/
|
257
257
|
customView: null,
|
258
|
+
|
259
|
+
/**
|
260
|
+
css classes applied to customView
|
261
|
+
*/
|
262
|
+
customViewClassName: null,
|
263
|
+
|
264
|
+
/**
|
265
|
+
customView menu offset width
|
266
|
+
*/
|
267
|
+
customViewMenuOffsetWidth: 0,
|
258
268
|
|
259
269
|
/**
|
260
270
|
This is a property for enabling/disabling ellipsis
|
@@ -279,8 +289,7 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
279
289
|
@private
|
280
290
|
*/
|
281
291
|
leftAlign: function() {
|
282
|
-
var val = 0 ;
|
283
|
-
var controlSize = this.get('controlSize') ;
|
292
|
+
var val = 0, controlSize = this.get('controlSize') ;
|
284
293
|
if(controlSize === SC.SMALL_CONTROL_SIZE) val = -14 ;
|
285
294
|
if(controlSize === SC.REGULAR_CONTROL_SIZE) val = -16 ;
|
286
295
|
return val;
|
@@ -314,57 +323,60 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
314
323
|
*/
|
315
324
|
render: function(context,firstTime) {
|
316
325
|
sc_super();
|
317
|
-
var layoutWidth
|
326
|
+
var layoutWidth, objects, len, nameKey, iconKey, valueKey, checkboxEnabled,
|
327
|
+
currentSelectedVal, shouldLocalize, separatorPostion, itemList, isChecked,
|
328
|
+
idx, name, icon, value, item;
|
329
|
+
layoutWidth = this.layout.width ;
|
318
330
|
if(firstTime && layoutWidth) {
|
319
331
|
this.adjust({ width: layoutWidth - this.SELECT_BUTTON_SPRITE_WIDTH }) ;
|
320
332
|
}
|
321
333
|
|
322
|
-
|
334
|
+
objects = this.get('objects') ;
|
323
335
|
objects = this.sortObjects(objects) ;
|
324
|
-
|
336
|
+
len = objects.length ;
|
325
337
|
|
326
338
|
//Get the namekey, iconKey and valueKey set by the user
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
339
|
+
nameKey = this.get('nameKey') ;
|
340
|
+
iconKey = this.get('iconKey') ;
|
341
|
+
valueKey = this.get('valueKey') ;
|
342
|
+
checkboxEnabled = this.get('checkboxEnabled') ;
|
331
343
|
|
332
344
|
//get the current selected value
|
333
|
-
|
345
|
+
currentSelectedVal = this.get('value') ;
|
334
346
|
|
335
347
|
// get the localization flag.
|
336
|
-
|
348
|
+
shouldLocalize = this.get('localize') ;
|
337
349
|
|
338
350
|
//get the separatorPostion
|
339
|
-
|
351
|
+
separatorPostion = this.get('separatorPostion') ;
|
340
352
|
|
341
353
|
//itemList array to set the menu items
|
342
|
-
|
354
|
+
itemList = [] ;
|
343
355
|
|
344
356
|
//to set the 'checkbox' property of menu items
|
345
|
-
|
357
|
+
isChecked = YES ;
|
346
358
|
|
347
359
|
//index for finding the first item in the list
|
348
|
-
|
360
|
+
idx = 0 ;
|
349
361
|
|
350
362
|
objects.forEach(function(object) {
|
351
363
|
if (object) {
|
352
364
|
|
353
365
|
//Get the name value. If value key is not specified convert obj
|
354
366
|
//to string
|
355
|
-
|
367
|
+
name = nameKey ? (object.get ?
|
356
368
|
object.get(nameKey) : object[nameKey]) : object.toString() ;
|
357
369
|
|
358
370
|
// localize name if specified.
|
359
371
|
name = shouldLocalize? name.loc() : name ;
|
360
372
|
|
361
373
|
//Get the icon value
|
362
|
-
|
374
|
+
icon = iconKey ? (object.get ?
|
363
375
|
object.get(iconKey) : object[iconKey]) : null ;
|
364
376
|
if (SC.none(object[iconKey])) icon = null ;
|
365
377
|
|
366
378
|
// get the value using the valueKey or the object
|
367
|
-
|
379
|
+
value = (valueKey) ? (object.get ?
|
368
380
|
object.get(valueKey) : object[valueKey]) : object ;
|
369
381
|
|
370
382
|
if (!SC.none(currentSelectedVal) && !SC.none(value)){
|
@@ -420,12 +432,14 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
420
432
|
}, this ) ;
|
421
433
|
|
422
434
|
if(firstTime) {
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
435
|
+
this.invokeLast(function() {
|
436
|
+
var value = this.get('value') ;
|
437
|
+
if(SC.none(value)) {
|
438
|
+
this.set('value', this._defaultVal) ;
|
439
|
+
this.set('title', this._defaultTitle) ;
|
440
|
+
this.set('icon', this._defaultIcon) ;
|
441
|
+
}
|
442
|
+
});
|
429
443
|
}
|
430
444
|
|
431
445
|
//Set the preference matrix for the menu pane
|
@@ -441,14 +455,19 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
441
455
|
*/
|
442
456
|
_action: function( evt )
|
443
457
|
{
|
444
|
-
var buttonLabel
|
458
|
+
var buttonLabel, menuWidth, scrollWidth, lastMenuWidth, offsetWidth,
|
459
|
+
items, elementOffsetWidth, largestMenuWidth, item, element, idx,
|
460
|
+
currSel, itemList, menuControlSize, menuHeightPadding, customView,
|
461
|
+
customMenuView, menu, itemsLength;
|
462
|
+
|
463
|
+
buttonLabel = this.$('.sc-button-label')[0] ;
|
445
464
|
// Get the length of the text on the button in pixels
|
446
|
-
|
447
|
-
|
448
|
-
|
465
|
+
menuWidth = this.get('layer').offsetWidth ;
|
466
|
+
scrollWidth = buttonLabel.scrollWidth ;
|
467
|
+
lastMenuWidth = this.get('lastMenuWidth') ;
|
449
468
|
if(scrollWidth) {
|
450
469
|
// Get the original width of the label in the button
|
451
|
-
|
470
|
+
offsetWidth = buttonLabel.offsetWidth ;
|
452
471
|
if(scrollWidth && offsetWidth) {
|
453
472
|
menuWidth = menuWidth + scrollWidth - offsetWidth ;
|
454
473
|
}
|
@@ -457,18 +476,22 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
457
476
|
lastMenuWidth = menuWidth ;
|
458
477
|
}
|
459
478
|
|
460
|
-
|
461
|
-
|
479
|
+
items = this.get('itemList') ;
|
480
|
+
|
481
|
+
var customViewClassName = this.get('customViewClassName') ;
|
482
|
+
var customViewMenuOffsetWidth = this.get('customViewMenuOffsetWidth') ;
|
483
|
+
var className = 'sc-view sc-pane sc-panel sc-palette sc-picker sc-menu select-button sc-scroll-view sc-menu-scroll-view sc-container-view menuContainer sc-button-view sc-menu-item sc-regular-size' ;
|
484
|
+
className = customViewClassName ? (className + ' ' + customViewClassName) : className ;
|
462
485
|
|
463
|
-
for (
|
486
|
+
for (idx = 0, itemsLength = items.length; idx < itemsLength; ++idx) {
|
464
487
|
//getting the width of largest menu item
|
465
|
-
|
466
|
-
|
488
|
+
item = items.objectAt(idx) ;
|
489
|
+
element = document.createElement('div') ;
|
467
490
|
element.style.cssText = 'top:-10000px; left: -10000px; position: absolute;' ;
|
468
|
-
element.className =
|
491
|
+
element.className = className ;
|
469
492
|
element.innerHTML = item.title ;
|
470
493
|
document.body.appendChild(element) ;
|
471
|
-
elementOffsetWidth = element.offsetWidth ;
|
494
|
+
elementOffsetWidth = element.offsetWidth + customViewMenuOffsetWidth;
|
472
495
|
|
473
496
|
if (!largestMenuWidth || (elementOffsetWidth > largestMenuWidth)) {
|
474
497
|
largestMenuWidth = elementOffsetWidth ;
|
@@ -479,17 +502,25 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
479
502
|
lastMenuWidth = (largestMenuWidth > lastMenuWidth) ?
|
480
503
|
largestMenuWidth: lastMenuWidth ;
|
481
504
|
|
505
|
+
// Get the window size width and compare with the lastMenuWidth.
|
506
|
+
// If it is greater than windows width then reduce the maxwidth by 25px
|
507
|
+
// so that the ellipsis property is enabled by default
|
508
|
+
var maxWidth = SC.RootResponder.responder.get('currentWindowSize').width;
|
509
|
+
if(lastMenuWidth > maxWidth) {
|
510
|
+
lastMenuWidth = (maxWidth - 25) ;
|
511
|
+
}
|
512
|
+
|
482
513
|
this.set('lastMenuWidth',lastMenuWidth) ;
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
514
|
+
currSel = this.get('currentSelItem') ;
|
515
|
+
itemList = this.get('itemList') ;
|
516
|
+
menuControlSize = this.get('controlSize') ;
|
517
|
+
menuHeightPadding = this.get('menuPaneHeightPadding') ;
|
487
518
|
|
488
519
|
// get the user defined custom view
|
489
|
-
|
490
|
-
|
520
|
+
customView = this.get('customView') ;
|
521
|
+
customMenuView = customView ? customView : SC.MenuItemView ;
|
491
522
|
|
492
|
-
|
523
|
+
menu = SC.MenuPane.create({
|
493
524
|
|
494
525
|
/**
|
495
526
|
Class name - select-button-item
|
@@ -541,30 +572,32 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
541
572
|
|
542
573
|
*/
|
543
574
|
displaySelectedItem: function() {
|
575
|
+
var menuView, currSel, itemViews, title, val, itemIdx = 0, button, object,
|
576
|
+
len, found = null, objTmp;
|
577
|
+
|
544
578
|
//Get MenuPane, currentSelectedMenuItem & menuItemView
|
545
579
|
// Get the main parent view to show the menus
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
580
|
+
|
581
|
+
menuView = this.parentMenu() ;
|
582
|
+
currSel = menuView.get('currentSelectedMenuItem') ;
|
583
|
+
itemViews = menuView.menuItemViews ;
|
584
|
+
|
551
585
|
// Fetch the index of the current selected item
|
552
|
-
var itemIdx = 0 ;
|
553
586
|
if (currSel && itemViews) {
|
554
587
|
itemIdx = itemViews.indexOf(currSel) ;
|
555
588
|
}
|
556
589
|
|
557
590
|
// Get the select button View
|
558
|
-
|
591
|
+
button = menuView.get('anchor') ;
|
559
592
|
|
560
593
|
// set the value and title
|
561
|
-
|
562
|
-
|
563
|
-
var found = null ;
|
594
|
+
object = menuView.get('items') ;
|
595
|
+
len = object.length ;
|
564
596
|
|
565
597
|
while (!found && (--len >= 0)) {
|
566
|
-
|
567
|
-
|
598
|
+
objTmp = object[len];
|
599
|
+
title = !SC.none(objTmp.title) ? objTmp.title: object.toString() ;
|
600
|
+
val = !SC.none(objTmp.value) ? objTmp.value: title ;
|
568
601
|
|
569
602
|
if (title === this.get('value') && (itemIdx === len)) {
|
570
603
|
found = object ;
|
@@ -584,11 +617,9 @@ SC.SelectButtonView = SC.ButtonView.extend(
|
|
584
617
|
place aligned to the item on the button when menu is opened.
|
585
618
|
*/
|
586
619
|
changeSelectButtonPreferMatrix: function() {
|
587
|
-
var preferMatrixAttributeTop = 0
|
588
|
-
|
589
|
-
|
590
|
-
var defPreferMatrix ;
|
591
|
-
var tempPreferMatrix ;
|
620
|
+
var preferMatrixAttributeTop = 0 ,
|
621
|
+
itemIdx = this.get('itemIdx') ,
|
622
|
+
leftAlign = this.get('leftAlign'), defPreferMatrix, tempPreferMatrix ;
|
592
623
|
|
593
624
|
if(this.get('isDefaultPosition')) {
|
594
625
|
defPreferMatrix = [leftAlign, 4, 3] ;
|