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
@@ -483,7 +483,11 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
483
483
|
}
|
484
484
|
}
|
485
485
|
}
|
486
|
-
if (!this.get('isEnabled') && !this.isSeparator())
|
486
|
+
if (!this.get('isEnabled') && !this.isSeparator()) {
|
487
|
+
if (parentMenu) parentMenu.set('currentSelectedMenuItem', null);
|
488
|
+
return YES ;
|
489
|
+
}
|
490
|
+
|
487
491
|
var key = this.get('contentIsBranchKey') ;
|
488
492
|
if(key) {
|
489
493
|
var content = this.get('content') ;
|
@@ -23,7 +23,10 @@ SC.PopupButtonView = SC.ButtonView.extend({
|
|
23
23
|
preferMatrix: null,
|
24
24
|
|
25
25
|
/**private */
|
26
|
-
acceptsFirstResponder:
|
26
|
+
acceptsFirstResponder: function() {
|
27
|
+
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
28
|
+
else return NO;
|
29
|
+
}.property('isEnabled'),
|
27
30
|
/**
|
28
31
|
Overriding the default SC.ButtonView#performKeyEquivalent method to pass
|
29
32
|
it onto the menu
|
@@ -148,23 +148,22 @@ SC.ProgressView = SC.View.extend(SC.Control, {
|
|
148
148
|
if (delay===0) delay = 1000/30;
|
149
149
|
if (this.get('isRunning') && this.get('isVisibleInWindow')) {
|
150
150
|
this.displayDidChange();
|
151
|
-
this.invokeLater(this._animateProgressBar, delay,
|
151
|
+
this.invokeLater(this._animateProgressBar, delay, 10);
|
152
152
|
}
|
153
153
|
},
|
154
154
|
|
155
155
|
displayProperties: 'value minimum maximum isIndeterminate'.w(),
|
156
156
|
|
157
157
|
render: function(context, firstTime) {
|
158
|
-
var inner, animatedBackground
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
158
|
+
var inner, animatedBackground, value, cssString, backPosition,
|
159
|
+
isIndeterminate = this.get('isIndeterminate'),
|
160
|
+
isRunning = this.get('isRunning'),
|
161
|
+
isEnabled = this.get('isEnabled'),
|
162
|
+
offsetRange = this.get('offsetRange'),
|
163
|
+
offset = (isIndeterminate && isRunning) ?
|
164
|
+
(Math.floor(Date.now()/75)%offsetRange-offsetRange) : 0;
|
165
165
|
|
166
166
|
// compute value for setting the width of the inner progress
|
167
|
-
var value;
|
168
167
|
if (!isEnabled) {
|
169
168
|
value = "0%" ;
|
170
169
|
} else if (isIndeterminate) {
|
@@ -199,16 +198,23 @@ SC.ProgressView = SC.View.extend(SC.Control, {
|
|
199
198
|
context.setClass(classNames);
|
200
199
|
inner = this.$('.sc-inner');
|
201
200
|
animatedBackground = this.get('animatedBackgroundMatrix');
|
202
|
-
|
201
|
+
cssString = "width: "+value+"; ";
|
202
|
+
cssString = cssString + "left: "+offset+"; ";
|
203
203
|
if (animatedBackground.length === 3 ) {
|
204
|
-
|
205
|
-
|
206
|
-
|
204
|
+
backPosition = '0px -'+
|
205
|
+
(animatedBackground[0] +
|
206
|
+
animatedBackground[1]*this._currentBackground)+'px';
|
207
207
|
if(this._currentBackground===animatedBackground[2]-1
|
208
208
|
|| this._currentBackground===0){
|
209
209
|
this._nextBackground *= -1;
|
210
210
|
}
|
211
211
|
this._currentBackground += this._nextBackground;
|
212
|
+
|
213
|
+
cssString = cssString + "backgroundPosition: "+backPosition+"; ";
|
214
|
+
//Instead of using css() set attr for faster perf.
|
215
|
+
inner.attr('style', cssString);
|
216
|
+
}else{
|
217
|
+
inner.attr('style', cssString);
|
212
218
|
}
|
213
219
|
}
|
214
220
|
|
@@ -347,10 +347,38 @@ SC.RadioView = SC.FieldView.extend(
|
|
347
347
|
|
348
348
|
},
|
349
349
|
|
350
|
-
|
351
|
-
|
350
|
+
/**
|
351
|
+
If the user clicks inside one of the radio elements, mark it as active.
|
352
|
+
|
353
|
+
Save the element that was clicked on so we can remove the active state on
|
354
|
+
mouseUp.
|
355
|
+
*/
|
356
|
+
mouseDown: function(evt) {
|
357
|
+
var target = evt.target;
|
358
|
+
while (target) {
|
359
|
+
if (target.className && target.className.indexOf('sc-radio-button') > -1) break;
|
360
|
+
target = target.parentNode;
|
361
|
+
}
|
362
|
+
if (!target) return NO;
|
363
|
+
|
364
|
+
target = this.$(target);
|
365
|
+
target.addClass('active');
|
366
|
+
this._activeRadioButton = target;
|
367
|
+
|
352
368
|
this._field_isMouseDown = YES;
|
353
369
|
return YES;
|
370
|
+
},
|
371
|
+
|
372
|
+
/**
|
373
|
+
If we have a radio element that was clicked on previously, make sure we
|
374
|
+
remove the active state.
|
375
|
+
*/
|
376
|
+
mouseUp: function(evt) {
|
377
|
+
var active = this._activeRadioButton;
|
378
|
+
if (active) {
|
379
|
+
active.removeClass('active');
|
380
|
+
this._activeRadioButton = null;
|
381
|
+
}
|
354
382
|
}
|
355
383
|
|
356
384
|
});
|
@@ -690,13 +690,12 @@ SC.ScrollView = SC.View.extend(SC.Border, {
|
|
690
690
|
// This forces to recalculate the height of the frame when is at the bottom
|
691
691
|
// of the scroll and the content dimension are smaller that the previous one
|
692
692
|
|
693
|
-
|
694
693
|
var mxVOffSet = this.get('maximumVerticalScrollOffset'),
|
695
694
|
vOffSet = this.get('verticalScrollOffset'),
|
696
695
|
mxHOffSet = this.get('maximumHorizontalScrollOffset'),
|
697
696
|
hOffSet = this.get('horizontalScrollOffset');
|
698
|
-
var forceHeight = mxVOffSet
|
699
|
-
var forceWidth = mxHOffSet
|
697
|
+
var forceHeight = mxVOffSet<vOffSet;
|
698
|
+
var forceWidth = mxHOffSet<hOffSet;
|
700
699
|
if(forceHeight || forceWidth){
|
701
700
|
this.forceDimensionsRecalculation(forceWidth, forceHeight, vOffSet, hOffSet);
|
702
701
|
}
|
@@ -180,11 +180,9 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
180
180
|
@property {Array}
|
181
181
|
*/
|
182
182
|
displayItems: function() {
|
183
|
-
var items = this.get('items'), loc = this.get('localize')
|
184
|
-
|
185
|
-
|
186
|
-
var fetchKeys = SC._segmented_fetchKeys;
|
187
|
-
var fetchItem = SC._segmented_fetchItem;
|
183
|
+
var items = this.get('items'), loc = this.get('localize'),
|
184
|
+
keys=null, itemType, cur, ret = [], max = items.get('length'), idx,
|
185
|
+
item, fetchKeys = SC._segmented_fetchKeys, fetchItem = SC._segmented_fetchItem;
|
188
186
|
|
189
187
|
// loop through items and collect data
|
190
188
|
for(idx=0;idx<max;idx++) {
|
@@ -198,7 +196,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
198
196
|
|
199
197
|
// if the item is not an array, try to use the itemKeys.
|
200
198
|
} else if (itemType !== SC.T_ARRAY) {
|
201
|
-
|
202
199
|
// get the itemKeys the first time
|
203
200
|
if (keys===null) {
|
204
201
|
keys = this.itemKeys.map(fetchKeys,this);
|
@@ -209,7 +206,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
209
206
|
cur[cur.length] = idx; // save current index
|
210
207
|
|
211
208
|
// special case 1...if title key is null, try to make into string
|
212
|
-
if (!keys[0] && item.toString) cur[0] = item.toString();
|
209
|
+
if (!keys[0] && item.toString) cur[0] = item.toString();
|
213
210
|
|
214
211
|
// special case 2...if value key is null, use item itself
|
215
212
|
if (!keys[1]) cur[1] = item;
|
@@ -230,7 +227,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
230
227
|
|
231
228
|
// all done, return!
|
232
229
|
return ret ;
|
233
|
-
}.property('items', 'itemTitleKey', 'itemValueKey', 'itemIsEnabledKey', 'localize', 'itemIconKey', 'itemWidthKey', 'itemToolTipKey')
|
230
|
+
}.property('items', 'itemTitleKey', 'itemValueKey', 'itemIsEnabledKey', 'localize', 'itemIconKey', 'itemWidthKey', 'itemToolTipKey'),
|
234
231
|
|
235
232
|
/** If the items array itself changes, add/remove observer on item... */
|
236
233
|
itemsDidChange: function() {
|
@@ -275,7 +272,6 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
275
272
|
if (firstTime || (items !== last)) {
|
276
273
|
this._seg_displayItems = items; // save for future
|
277
274
|
this.renderDisplayItems(context, items) ;
|
278
|
-
context.addStyle('text-align', 'center');
|
279
275
|
}else{
|
280
276
|
// update selection and active state
|
281
277
|
var activeIndex = this.get('activeIndex');
|
@@ -285,13 +281,13 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
285
281
|
value = value.objectAt(0); isArray = NO ;
|
286
282
|
}
|
287
283
|
var names = {}; // reuse
|
288
|
-
|
289
284
|
var loc = items.length, cq = this.$('a.sc-segment'), item;
|
290
285
|
while(--loc>=0) {
|
291
286
|
item = items[loc];
|
292
287
|
names.sel = isArray ? (value.indexOf(item[1])>=0) : (item[1]===value);
|
293
288
|
names.active = (activeIndex === loc);
|
294
|
-
|
289
|
+
names.disabled = !item[2];
|
290
|
+
SC.$(cq[loc]).setClass(names);
|
295
291
|
}
|
296
292
|
names = items = value = items = null; // cleanup
|
297
293
|
}
|
@@ -352,9 +348,8 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
352
348
|
} else {
|
353
349
|
icon = '';
|
354
350
|
}
|
355
|
-
ic.push('<span class="sc-button-inner"><label class="sc-button-label">'
|
356
|
-
|
357
|
-
ic.push('</label></span>');
|
351
|
+
ic.push('<span class="sc-button-inner"><label class="sc-button-label">',
|
352
|
+
icon+title, '</label></span>');
|
358
353
|
ic.end();
|
359
354
|
}
|
360
355
|
},
|
@@ -374,7 +369,7 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
374
369
|
// start at the target event and go upwards until we reach either the
|
375
370
|
// root responder or find an anchor.sc-segment.
|
376
371
|
var root = this.$(), match = null ;
|
377
|
-
while(!match && (elem.length>0) && (elem
|
372
|
+
while(!match && (elem.length>0) && (elem[0]!==root[0])) {
|
378
373
|
if (elem.hasClass('sc-segment') && elem.attr('tagName')==='A') {
|
379
374
|
match = elem;
|
380
375
|
} else elem = elem.parent();
|
@@ -391,7 +386,8 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
391
386
|
var i, item, items, len, value, isArray;
|
392
387
|
if (evt.which === 9) {
|
393
388
|
var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
|
394
|
-
view.becomeFirstResponder();
|
389
|
+
if(view) view.becomeFirstResponder();
|
390
|
+
else evt.allowDefault();
|
395
391
|
return YES ; // handled
|
396
392
|
}
|
397
393
|
if (!this.get('allowsMultipleSelection') && !this.get('allowsEmptySelection')){
|
@@ -548,7 +544,8 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
548
544
|
|
549
545
|
/** tied to the isEnabled state */
|
550
546
|
acceptsFirstResponder: function() {
|
551
|
-
return this.get('isEnabled');
|
547
|
+
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
548
|
+
else return NO;
|
552
549
|
}.property('isEnabled'),
|
553
550
|
|
554
551
|
willBecomeKeyResponderFrom: function(keyView) {
|
@@ -237,7 +237,7 @@ SC.SelectFieldView = SC.FieldView.extend(
|
|
237
237
|
var value = sc_super(); // get raw value...
|
238
238
|
var valueKey = this.get('valueKey') ;
|
239
239
|
var objects = this.get('objects') ;
|
240
|
-
var found;
|
240
|
+
var found, object;
|
241
241
|
|
242
242
|
// Handle empty selection.
|
243
243
|
if (value == '***') {
|
@@ -247,10 +247,12 @@ SC.SelectFieldView = SC.FieldView.extend(
|
|
247
247
|
// object.
|
248
248
|
} else if (value && objects) {
|
249
249
|
// objects = Array.from(objects) ;
|
250
|
-
|
250
|
+
|
251
|
+
var loc = (SC.typeOf(objects.length) === SC.T_FUNCTION) ? objects.length() : objects.length;
|
252
|
+
|
251
253
|
found = null ; // matching object goes here.
|
252
254
|
while(!found && (--loc >= 0)) {
|
253
|
-
|
255
|
+
object = objects.objectAt? objects.objectAt(loc) : objects[loc] ;
|
254
256
|
|
255
257
|
// get value using valueKey if there is one or use object
|
256
258
|
// map to _guid or toString.
|
@@ -167,7 +167,8 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
167
167
|
|
168
168
|
/** tied to the isEnabled state */
|
169
169
|
acceptsFirstResponder: function() {
|
170
|
-
return this.get('isEnabled');
|
170
|
+
if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
|
171
|
+
else return NO;
|
171
172
|
}.property('isEnabled'),
|
172
173
|
|
173
174
|
willBecomeKeyResponderFrom: function(keyView) {
|
@@ -190,7 +191,8 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
190
191
|
// handle tab key
|
191
192
|
if (evt.which === 9) {
|
192
193
|
var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
|
193
|
-
view.becomeFirstResponder();
|
194
|
+
if(view) view.becomeFirstResponder();
|
195
|
+
else evt.allowDefault();
|
194
196
|
return YES ; // handled
|
195
197
|
}
|
196
198
|
|
@@ -171,16 +171,16 @@ SC.SplitView = SC.View.extend(
|
|
171
171
|
*/
|
172
172
|
thicknessForView: function(view) {
|
173
173
|
// console.log('%@.thicknessForView(%@)'.fmt(this, view));
|
174
|
-
var direction = this.get('layoutDirection')
|
175
|
-
|
174
|
+
var direction = this.get('layoutDirection') ,
|
175
|
+
ret = view.get('frame') ;
|
176
176
|
return (direction === SC.LAYOUT_HORIZONTAL) ? ret.width : ret.height ;
|
177
177
|
},
|
178
178
|
|
179
179
|
createChildViews: function() {
|
180
180
|
// console.log('%@.createChildViews()'.fmt(this));
|
181
|
-
var childViews = []
|
182
|
-
|
183
|
-
|
181
|
+
var childViews = [] ,
|
182
|
+
viewAry = ['topLeftView', 'dividerView', 'bottomRightView'] ,
|
183
|
+
view, idx, len ;
|
184
184
|
|
185
185
|
for (idx=0, len=viewAry.length; idx<len; ++idx) {
|
186
186
|
if (view = this.get(viewAry[idx])) {
|
@@ -205,17 +205,17 @@ SC.SplitView = SC.View.extend(
|
|
205
205
|
*/
|
206
206
|
updateChildLayout: function() {
|
207
207
|
// console.log('%@.updateChildLayout()'.fmt(this));
|
208
|
-
var topLeftView = this.get('topLeftView')
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
var dividerThickness = this.get('dividerThickness')
|
214
|
-
|
215
|
-
var
|
216
|
-
|
217
|
-
|
218
|
-
|
208
|
+
var topLeftView = this.get('topLeftView') ,
|
209
|
+
bottomRightView = this.get('bottomRightView') ,
|
210
|
+
dividerView = this.get('dividerView') ,
|
211
|
+
direction = this.get('layoutDirection') ,
|
212
|
+
topLeftThickness = this._desiredTopLeftThickness ;
|
213
|
+
var dividerThickness = this.get('dividerThickness') ;
|
214
|
+
dividerThickness = (!SC.none(dividerThickness)) ? dividerThickness : 7 ;
|
215
|
+
var splitViewThickness = (direction === SC.LAYOUT_HORIZONTAL) ? this.get('frame').width : this.get('frame').height ,
|
216
|
+
bottomRightThickness = splitViewThickness - dividerThickness - topLeftThickness ,
|
217
|
+
autoresizeBehavior = this.get('autoresizeBehavior') ,
|
218
|
+
layout , isCollapsed ;
|
219
219
|
|
220
220
|
// console.log('topLeftThickness == %@'.fmt(topLeftThickness));
|
221
221
|
// console.log('dividerThickness == %@'.fmt(dividerThickness));
|
@@ -226,7 +226,7 @@ SC.SplitView = SC.View.extend(
|
|
226
226
|
isCollapsed = topLeftView.get('isCollapsed') || NO ;
|
227
227
|
topLeftView.setIfChanged('isVisible', !isCollapsed) ;
|
228
228
|
layout = SC.clone(topLeftView.get('layout'));
|
229
|
-
if (direction
|
229
|
+
if (direction === SC.LAYOUT_HORIZONTAL) {
|
230
230
|
layout.top = 0 ;
|
231
231
|
layout.left = 0 ;
|
232
232
|
layout.bottom = 0 ;
|
@@ -268,7 +268,7 @@ SC.SplitView = SC.View.extend(
|
|
268
268
|
// split divider view
|
269
269
|
if (dividerView) {
|
270
270
|
layout = SC.clone(dividerView.get('layout'));
|
271
|
-
if (direction
|
271
|
+
if (direction === SC.LAYOUT_HORIZONTAL) {
|
272
272
|
layout.width = dividerThickness;
|
273
273
|
delete layout.height ;
|
274
274
|
layout.top = 0 ;
|
@@ -332,7 +332,7 @@ SC.SplitView = SC.View.extend(
|
|
332
332
|
isCollapsed = bottomRightView.get('isCollapsed') || NO ;
|
333
333
|
bottomRightView.setIfChanged('isVisible', !isCollapsed) ;
|
334
334
|
layout = SC.clone(bottomRightView.get('layout'));
|
335
|
-
if (direction
|
335
|
+
if (direction === SC.LAYOUT_HORIZONTAL) {
|
336
336
|
layout.top = 0 ;
|
337
337
|
layout.bottom = 0 ;
|
338
338
|
layout.right = 0 ;
|
@@ -387,12 +387,13 @@ SC.SplitView = SC.View.extend(
|
|
387
387
|
this.set('thumbViewCursor', SC.Cursor.create()) ;
|
388
388
|
}
|
389
389
|
|
390
|
-
var layoutDirection = this.get('layoutDirection')
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
var
|
390
|
+
var layoutDirection = this.get('layoutDirection') ,
|
391
|
+
fr = this.get('frame'),
|
392
|
+
splitViewThickness, elemRendered = this.$(),
|
393
|
+
desiredThickness = this.get('defaultThickness') ,
|
394
|
+
autoResizeBehavior = this.get('autoresizeBehavior') ;
|
395
|
+
var dividerThickness = this.get('dividerThickness') ;
|
396
|
+
dividerThickness = (!SC.none(dividerThickness)) ? dividerThickness : 7 ;
|
396
397
|
// Turn a flag on to recalculate the spliting if the desired thickness
|
397
398
|
// is a percentage
|
398
399
|
// debugger;
|
@@ -403,10 +404,10 @@ SC.SplitView = SC.View.extend(
|
|
403
404
|
|
404
405
|
|
405
406
|
if(elemRendered[0]) {
|
406
|
-
splitViewThickness = (layoutDirection
|
407
|
+
splitViewThickness = (layoutDirection === SC.LAYOUT_HORIZONTAL) ?
|
407
408
|
elemRendered[0].offsetWidth : elemRendered[0].offsetHeight ;
|
408
409
|
}else{
|
409
|
-
splitViewThickness = (layoutDirection
|
410
|
+
splitViewThickness = (layoutDirection === SC.LAYOUT_HORIZONTAL) ?
|
410
411
|
fr.width : fr.height ;
|
411
412
|
}
|
412
413
|
// if default thickness is < 1, convert from percentage to absolute
|
@@ -504,7 +505,7 @@ SC.SplitView = SC.View.extend(
|
|
504
505
|
mouseDragged: function(evt) {
|
505
506
|
// console.log('%@.mouseDragged(%@)'.fmt(this, evt));
|
506
507
|
// console.log(evt.originalEvent);
|
507
|
-
var offset = (this._layoutDirection
|
508
|
+
var offset = (this._layoutDirection === SC.LAYOUT_HORIZONTAL) ? evt.pageX - this._mouseDownX : evt.pageY - this._mouseDownY ;
|
508
509
|
this._updateTopLeftThickness(offset) ;
|
509
510
|
return YES;
|
510
511
|
},
|
@@ -525,8 +526,8 @@ SC.SplitView = SC.View.extend(
|
|
525
526
|
doubleClickInThumbView: function(evt, thumbView) {
|
526
527
|
// console.log('%@.mouseDragged(%@, %@)'.fmt(this, evt, thumbView));
|
527
528
|
// console.log(evt.originalEvent);
|
528
|
-
var view = this._topLeftView
|
529
|
-
|
529
|
+
var view = this._topLeftView,
|
530
|
+
isCollapsed = view.get('isCollapsed') || NO ;
|
530
531
|
if (!isCollapsed && !this.canCollapseView(view)) {
|
531
532
|
view = this._bottomRightView ;
|
532
533
|
isCollapsed = view.get('isCollapsed') || NO ;
|
@@ -565,33 +566,31 @@ SC.SplitView = SC.View.extend(
|
|
565
566
|
_updateTopLeftThickness: function(offset) {
|
566
567
|
// console.log('%@._updateTopLeftThickness(%@)'.fmt(this, offset));
|
567
568
|
// console.log('%@.frame = %@'.fmt(this, SC.inspect(this.get('frame'))));
|
568
|
-
var topLeftView = this._topLeftView
|
569
|
-
|
570
|
-
|
571
|
-
|
569
|
+
var topLeftView = this._topLeftView ,
|
570
|
+
bottomRightView = this._bottomRightView,
|
571
|
+
topLeftViewThickness = this.thicknessForView(topLeftView), // the current thickness, not the original thickness
|
572
|
+
bottomRightViewThickness = this.thicknessForView(bottomRightView),
|
573
|
+
minAvailable = this._dividerThickness ,
|
574
|
+
maxAvailable = 0,
|
575
|
+
proposedThickness = this._topLeftViewThickness + offset,
|
576
|
+
direction = this._layoutDirection,
|
577
|
+
bottomRightCanCollapse = this.canCollapseView(bottomRightView),
|
578
|
+
thickness = proposedThickness,
|
579
|
+
// constrain to thickness set on top/left
|
580
|
+
max = this.get('topLeftMaxThickness'),
|
581
|
+
min = this.get('topLeftMinThickness'),
|
582
|
+
bottomRightThickness, tlCollapseAtThickness, brCollapseAtThickness;
|
572
583
|
|
573
|
-
var minAvailable = this._dividerThickness ;
|
574
|
-
var maxAvailable = 0;
|
575
584
|
if (!topLeftView.get("isCollapsed")) maxAvailable += topLeftViewThickness ;
|
576
585
|
if (!bottomRightView.get("isCollapsed")) maxAvailable += bottomRightViewThickness ;
|
577
586
|
|
578
|
-
var proposedThickness = this._topLeftViewThickness + offset;
|
579
|
-
var direction = this._layoutDirection ;
|
580
|
-
var bottomRightCanCollapse = this.canCollapseView(bottomRightView);
|
581
|
-
|
582
|
-
var thickness = proposedThickness;
|
583
|
-
|
584
|
-
// constrain to thickness set on top/left
|
585
|
-
var max = this.get('topLeftMaxThickness') ;
|
586
|
-
var min = this.get('topLeftMinThickness') ;
|
587
|
-
|
588
587
|
if (!SC.none(max)) thickness = Math.min(max, thickness) ;
|
589
588
|
if (!SC.none(min)) thickness = Math.max(min, thickness) ;
|
590
589
|
|
591
590
|
// constrain to thickness set on bottom/right
|
592
591
|
max = this.get('bottomRightMaxThickness') ;
|
593
592
|
min = this.get('bottomRightMinThickness') ;
|
594
|
-
|
593
|
+
bottomRightThickness = maxAvailable - thickness ;
|
595
594
|
if (!SC.none(max)) bottomRightThickness = Math.min(max, bottomRightThickness) ;
|
596
595
|
if (!SC.none(min)) bottomRightThickness = Math.max(min, bottomRightThickness) ;
|
597
596
|
thickness = maxAvailable - bottomRightThickness ;
|
@@ -605,9 +604,9 @@ SC.SplitView = SC.View.extend(
|
|
605
604
|
// cannot be less than zero
|
606
605
|
thickness = Math.max(0, thickness) ;
|
607
606
|
|
608
|
-
|
607
|
+
tlCollapseAtThickness = topLeftView.get('collapseAtThickness') ;
|
609
608
|
if (!tlCollapseAtThickness) tlCollapseAtThickness = 0 ;
|
610
|
-
|
609
|
+
brCollapseAtThickness = bottomRightView.get('collapseAtThickness') ;
|
611
610
|
brCollapseAtThickness = SC.none(brCollapseAtThickness) ? maxAvailable : (maxAvailable - brCollapseAtThickness);
|
612
611
|
|
613
612
|
if ((proposedThickness <= tlCollapseAtThickness) && this.canCollapseView(topLeftView)) {
|
@@ -650,18 +649,18 @@ SC.SplitView = SC.View.extend(
|
|
650
649
|
_setCursorStyle: function() {
|
651
650
|
// console.log('%@._setCursorStyle()'.fmt(this));
|
652
651
|
var topLeftView = this._topLeftView ;
|
653
|
-
|
654
|
-
|
652
|
+
bottomRightView = this._bottomRightView,
|
653
|
+
thumbViewCursor = this.get('thumbViewCursor'),
|
654
|
+
// updates the cursor of the thumb view that called mouseDownInThumbView() to reflect the status of the drag
|
655
|
+
tlThickness = this.thicknessForView(topLeftView),
|
656
|
+
brThickness = this.thicknessForView(bottomRightView);
|
655
657
|
this._layoutDirection = this.get('layoutDirection') ;
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
thumbViewCursor.set('cursorStyle', this._layoutDirection == SC.LAYOUT_HORIZONTAL ? "e-resize" : "s-resize") ;
|
661
|
-
} else if (bottomRightView.get('isCollapsed') || tlThickness == this.get("topLeftMaxThickness") || brThickness == this.get("bottomRightMinThickness")) {
|
662
|
-
thumbViewCursor.set('cursorStyle', this._layoutDirection == SC.LAYOUT_HORIZONTAL ? "w-resize" : "n-resize") ;
|
658
|
+
if (topLeftView.get('isCollapsed') || tlThickness === this.get("topLeftMinThickness") || brThickness == this.get("bottomRightMaxThickness")) {
|
659
|
+
thumbViewCursor.set('cursorStyle', this._layoutDirection === SC.LAYOUT_HORIZONTAL ? "e-resize" : "s-resize") ;
|
660
|
+
} else if (bottomRightView.get('isCollapsed') || tlThickness === this.get("topLeftMaxThickness") || brThickness == this.get("bottomRightMinThickness")) {
|
661
|
+
thumbViewCursor.set('cursorStyle', this._layoutDirection === SC.LAYOUT_HORIZONTAL ? "w-resize" : "n-resize") ;
|
663
662
|
} else {
|
664
|
-
thumbViewCursor.set('cursorStyle', this._layoutDirection
|
663
|
+
thumbViewCursor.set('cursorStyle', this._layoutDirection === SC.LAYOUT_HORIZONTAL ? "ew-resize" : "ns-resize") ;
|
665
664
|
}
|
666
665
|
}.observes('layoutDirection'),
|
667
666
|
|