Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
commit e175ae333a8a1e30081c07f16f5a1c04bb0e39c5 2 parents 39a4c2f + 1d7d8a1
@wemrysi wemrysi authored
View
71 CHANGELOG.md
@@ -1,5 +1,72 @@
-CHANGE LOG FOR 1.6
-==================
+CHANGE LOG FOR 1.6+
+===================
+
+1.7.1.beta
+----------
+
+### MINOR FEATURES
+
+* Added Safari Lion browser detection.
+* Speed improvements in renderContext, switching from joining arrays of strings to simple string concatenation.
+* Faster code escaping using regular expressions instead of DOM.
+* New flag to stop picker repositioning when the window is resized.
+* SegmentedView update to enable/disable overflow.
+* Small performance improvement for splitView.
+* New string measurement functions to optimize for string wrapping.
+* Added support for autoCorrect and autoCapitalize in TextFields.
+* Added back object types previously removed by the refactored SC.Object
+* Refactored observer paths code for a more robust handling.
+* Rewrite SC.LOG_RUNLOOP_INVOCATIONS — now renamed to SC.LOG_DEFERRED_CALLS — to work with the new runloop implementation.
+* Added this SC.RunLoop.kill to terminate cleanly a run loop in case of an error.
+* Added the ability to dynamically add substates to a statechart via a state's addSubstate method.
+* Updated the statechart tracing logic.
+* Updated SC.State. getSubstate now accepts a callback; added getState method; gotoState and gotoHistoryState now use getState
+* Updated state's gotoState and gotoHistoryState to allow for a more expressive state arg that now allows for the use of 'parentState'
+* Updated SC.State's getSubstate method to allow for path expressions. Also refacted the findFirstRelativeCurrentState method.
+* New SC globals to provide information like build mode, build number and locale.
+
+### BUG FIXES
+
+* Bug fix, when the apps don’t have a first responder at loading time the app throws an error.
+* Tweaked scrolling acceleration and speed to match native scroller.
+* Removed Internet Explorer legacy code.
+* Passing the native event when a focus or blur event is called. This makes it consistent with all the other event handlers.
+* Workarounds for mobileSafari touch handling in textfields and links.
+* IE was getting two blur/focus events.
+* Small bug fix for timers when there is no currentRunLoop.
+* Unit test updates for renderContext.
+* Reverted change to receive focus if it the view becomes key responder.
+* Disabling layout style calculations for opacity in IE, as this will always break transparent pngs.
+* Changed code to get a reliable anchor for pickers and menus.
+* Reposition pickers based on the size of the app and not the window viewport.
+* Added tooltips back to button.
+* Fix for popup_buttons as they were not rendering as expected.
+* Removing acceleration layer on sliders as this was creating GPU glitches on views appended after the slider.
+* Removing legacy handler of buttons to improve speed.
+* Bug fix to update list scrollers when adding new items to the list.
+* Changed timeout value for a faster experience in menu scrolling.
+* Removed deltaAdjust in scrollView and left only the calculations done in SC.Event.
+* Updated values in select button to fix rendering regressions.
+* Refactored childViews creation in formView.
+* Updated new selectView to correctly support width resizing.
+* Better string measurements for autoResize mixin. Also included the support to auto fit text (reduce font size if neccessary.
+* FlowedLayout fixes when the view changes visibility and code clean up.
+* Added back hints to labels.
+* Removed unneccesary font-weight label css attribute.
+* Removed zIndex in text-fields.
+* Removed preload images task for “Chance” slicing system .
+* Several modular loading bug fixes, including support for css.
+* Bug fix for string measurement. It was double escaping.
+* Observers failing in IE as strings don’t work as arrays.
+* Don't schedule multiple run loops when we only need one in SC.Binding.
+* Add in support for specifying an optional prefix that will be applied to all messages.
+* Updated observable unit tests
+* Updated SC.Logger unit tests
+* Updated SC.State's getSubstate method to allow for path expressions.
+* Updated Statechart unit tests
+* Updated state charts unit tests
+* Updated css to match abbot css fixes for $skip parameter in chance.
+* Added css style namespace to sc-focus, this was generating problems when focusing the elements the first time in the app.
1.6.0
-----
View
35 frameworks/desktop/tests/views/select/ui.js
@@ -83,9 +83,22 @@ var pane = SC.ControlTestPane.design()
isEnabledKey: 'isEnabled',
itemSortKey: 'pos',
showCheckbox: YES
- }) ;
+ })
+
+ // sample11
+ .add("SelectButtonWithEmptyName", SC.SelectView, {
+ items: [{ title: "None", icon: 'select-button-icon' },
+ { title: "Low", icon: 'select-button-icon' },
+ { title: "Medium", icon: 'select-button-icon' },
+ { title: "High", icon: 'select-button-icon' }],
+ itemTitleKey: 'title',
+ itemIconKey: 'icon',
+ emptyName: '<empty>',
+ escapeHTML: NO,
+ showCheckbox: YES
+ });
- pane.show();
+pane.show();
// ..........................................................
// TEST VIEWS
@@ -112,6 +125,7 @@ test("Check the visiblity of the selectButtons", function() {
ok(pane.view('redraw').get('isVisibleInWindow'), 'redraw.isVisibleInWindow should be YES') ;
ok(pane.view('SelectButtonWithIcon').get('isVisibleInWindow'), 'SelectButtonWithIcon.isVisibleInWindow should be YES') ;
ok(pane.view('StaticLayout').get('isVisibleInWindow'), 'StaticLayout.isVisibleInWindow should be YES') ;
+ ok(pane.view('SelectButtonWithEmptyName').get('isVisibleInWindow'), 'SelectButtonWithEmptyName.isVisibleInWindow should be YES') ;
}) ;
//test2
@@ -194,7 +208,7 @@ test("redraw", function() {
view.set('items', ['Calendar', 'Work', 'Home']);
SC.RunLoop.end();
ok(view.get('items').length === 3, "Items length should be 3");
-
+
// Can someone actually put a redraw test here?
}) ;
@@ -222,3 +236,18 @@ test("StaticLayout", function() {
ok(!view.$().hasClass('disabled'), 'should not have disabled class');
ok(!view.$().hasClass('sel'), 'should not have sel class');
});
+
+//test11
+test("SelectButtonWithEmptyName", function() {
+ var view=pane.view('SelectButtonWithEmptyName').$(),
+ label = pane.view('SelectButtonWithEmptyName').$('label');
+ console.log('label = ' + label);
+ ok(!view.hasClass('icon'), 'hasClass(Icon) should be NO') ;
+ ok(view.hasClass('sc-view'), 'hasClass(sc-view) should be YES') ;
+ ok(view.hasClass('sc-button-view'), 'hasClass(sc-button-view) should be YES') ;
+ ok(view.hasClass('sc-regular-size'), 'hasClass(sc-regular-size) should be YES') ;
+ ok(!view.hasClass('sel'), 'hasClass(sel) should be NO') ;
+ ok(!view.hasClass('disabled'), 'hasClass(disabled) should be NO') ;
+ ok(!view.hasClass('def'), 'hasClass(def) should be NO') ;
+ equals(label[0].innerHTML, '<empty>', 'The label should be "<empty>"');
+});
View
117 frameworks/desktop/views/select.js
@@ -15,7 +15,7 @@ sc_require('views/button');
Clicking the SelectView button displays a menu pane with a
list of items. The selected item will be displayed on the button.
User has the option of enabling checkbox for the selected menu item.
-
+
@extends SC.ButtonView
@version 1.0
@author Alex Iskander, Mohammed Ashik
@@ -33,6 +33,15 @@ SC.SelectView = SC.ButtonView.extend(
}.property('isEnabled'),
/**
+ If true, titles will be escaped to avoid scripting attacks.
+
+ @type Boolean
+ @default YES
+ */
+ escapeHTML: YES,
+ escapeHTMLBindingDefault: SC.Binding.oneWay().bool(),
+
+ /**
An array of items that will be form the menu you want to show.
@type Array
@@ -80,7 +89,7 @@ SC.SelectView = SC.ButtonView.extend(
@default null
*/
itemIconKey: null,
-
+
/**
Key to use to identify separators.
@@ -88,7 +97,7 @@ SC.SelectView = SC.ButtonView.extend(
@default "separator"
*/
itemSeparatorKey: "separator",
-
+
/**
Key used to indicate if the item is to be enabled.
@@ -121,7 +130,7 @@ SC.SelectView = SC.ButtonView.extend(
/**
Menu attached to the SelectView.
-
+
@type SC.View
@default SC.MenuView
*/
@@ -174,6 +183,15 @@ SC.SelectView = SC.ButtonView.extend(
showCheckbox: YES,
/**
+ Set this to non-null to place an empty option at the top of the menu.
+
+ @property
+ @type String
+ @default null
+ */
+ emptyName: null,
+
+ /**
Default value of the select button.
This will be the first item from the menu item list.
@@ -199,7 +217,7 @@ SC.SelectView = SC.ButtonView.extend(
/**
The button theme will be popup
-
+
@type String
@default 'popup'
@readOnly
@@ -211,7 +229,7 @@ SC.SelectView = SC.ButtonView.extend(
@default ['icon', 'value','controlSize','items']
@see SC.View#displayProperties
*/
- displayProperties: ['icon', 'value','controlSize','items'],
+ displayProperties: ['icon', 'value','controlSize','items', 'escapeHTML', 'emptyName'],
/**
Prefer matrix to position the select button menu such that the
@@ -259,15 +277,15 @@ SC.SelectView = SC.ButtonView.extend(
/**
Example view used for menu items.
-
+
@type SC.View
@default null
*/
exampleView: null,
-
+
/**
customView menu offset width
-
+
@type Number
@default 0
*/
@@ -289,26 +307,26 @@ SC.SelectView = SC.ButtonView.extend(
@default 0
*/
menuPaneHeightPadding: 0,
-
+
/**
The amount of space to add to the calculated width of the menu item strings to
determine the width of the menu pane.
-
+
@type Number
@default 35
*/
menuItemPadding: 35,
-
+
/**
@type Boolean
@default NO
*/
isContextMenuEnabled: NO,
-
+
/**
- This is a property to enable/disable focus rings in buttons.
+ This is a property to enable/disable focus rings in buttons.
For select_button, we are making it a default.
-
+
@type Boolean
@default YES
@see SC.ButtonView#supportFocusRing
@@ -364,9 +382,10 @@ SC.SelectView = SC.ButtonView.extend(
*/
render: function(context,firstTime) {
sc_super();
- var layoutWidth, items, len, nameKey, iconKey, valueKey, separatorKey, showCheckbox,
- currentSelectedVal, shouldLocalize, isSeparator, itemList, isChecked,
- idx, name, icon, value, item, itemEnabled, isEnabledKey;
+
+ var escapeHTML, layoutWidth, items, len, nameKey, iconKey, valueKey, separatorKey, showCheckbox,
+ currentSelectedVal, shouldLocalize, isSeparator, itemList, isChecked,
+ idx, name, icon, value, item, itemEnabled, isEnabledKey, emptyName;
items = this.get('items') ;
items = this.sortObjects(items) ;
@@ -378,7 +397,8 @@ SC.SelectView = SC.ButtonView.extend(
valueKey = this.get('itemValueKey') ;
separatorKey = this.get('itemSeparatorKey');
showCheckbox = this.get('showCheckbox') ;
- isEnabledKey = this.get('isEnabledKey');
+ isEnabledKey = this.get('itemIsEnabledKey');
+ escapeHTML = this.get('escapeHTML');
//get the current selected value
currentSelectedVal = this.get('value') ;
@@ -395,6 +415,28 @@ SC.SelectView = SC.ButtonView.extend(
//index for finding the first item in the list
idx = 0 ;
+ // Add the empty name to the list if applicable
+ emptyName = this.get('emptyName');
+
+ if(!SC.none(emptyName)) {
+ emptyName = shouldLocalize ? SC.String.loc(emptyName) : emptyName;
+ emptyName = escapeHTML ? SC.RenderContext.escapeHTML(emptyName) : emptyName;
+
+ item = SC.Object.create({
+ separator: NO,
+ title: emptyName,
+ icon: null,
+ value: null,
+ isEnabled: YES,
+ checkbox: NO,
+ target: this,
+ action: 'displaySelectedItem'
+ });
+
+ //Set the items in the itemList array
+ itemList.push(item);
+ }
+
items.forEach(function(object) {
if (object || object === 0) {
@@ -405,6 +447,7 @@ SC.SelectView = SC.ButtonView.extend(
// localize name if specified.
name = shouldLocalize? SC.String.loc(name) : name ;
+ name = escapeHTML ? SC.RenderContext.escapeHTML(name) : name;
//Get the icon value
icon = iconKey ? (object.get ?
@@ -432,11 +475,11 @@ SC.SelectView = SC.ButtonView.extend(
else {
isChecked = NO ;
}
-
+
// Check if the item is enabled
itemEnabled = (object.get ? object.get(isEnabledKey) : object[isEnabledKey]);
if (NO !== itemEnabled) itemEnabled = YES;
-
+
// get the separator
isSeparator = separatorKey ? (object.get ? object.get(separatorKey) : object[separatorKey]) : NO;
@@ -447,7 +490,7 @@ SC.SelectView = SC.ButtonView.extend(
this._defaultIcon = icon ;
}
- var item = SC.Object.create({
+ item = SC.Object.create({
separator: isSeparator,
title: name,
icon: icon,
@@ -472,9 +515,12 @@ SC.SelectView = SC.ButtonView.extend(
this.invokeLast(function() {
var value = this.get('value') ;
if(SC.none(value)) {
- this.set('value', this._defaultVal) ;
- this.set('title', this._defaultTitle) ;
- this.set('icon', this._defaultIcon) ;
+ if(SC.none(emptyName)) {
+ this.set('value', this._defaultVal) ;
+ this.set('title', this._defaultTitle) ;
+ this.set('icon', this._defaultIcon) ;
+ }
+ else this.set('title', emptyName) ;
}
});
}
@@ -493,10 +539,10 @@ SC.SelectView = SC.ButtonView.extend(
var buttonLabel, menuWidth, scrollWidth, lastMenuWidth, offsetWidth,
items, elementOffsetWidth, largestMenuWidth, item, element, idx,
value, itemList, menuControlSize, menuHeightPadding, customView,
- menu, itemsLength, itemIdx;
-
+ menu, itemsLength, itemIdx, escapeHTML;
+
buttonLabel = this.$('.sc-button-label')[0] ;
-
+
var menuWidthOffset = SC.SelectView.MENU_WIDTH_OFFSET ;
if(!this.get('isDefaultPosition')) {
switch (this.get('controlSize')) {
@@ -519,7 +565,7 @@ SC.SelectView = SC.ButtonView.extend(
}
// Get the length of the text on the button in pixels
menuWidth = this.get('layer').offsetWidth + menuWidthOffset ;
-
+
// Get the length of the text on the button in pixels
menuWidth = this.get('layer').offsetWidth ;
scrollWidth = buttonLabel.scrollWidth ;
@@ -541,7 +587,7 @@ SC.SelectView = SC.ButtonView.extend(
var customViewMenuOffsetWidth = this.get('customViewMenuOffsetWidth') ;
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' ;
className = customViewClassName ? (className + ' ' + customViewClassName) : className ;
-
+
SC.prepareStringMeasurement("", className);
for (idx = 0, itemsLength = items.length; idx < itemsLength; ++idx) {
//getting the width of largest menu item
@@ -570,9 +616,10 @@ SC.SelectView = SC.ButtonView.extend(
itemList = this.get('_itemList') ;
menuControlSize = this.get('controlSize') ;
menuHeightPadding = this.get('menuPaneHeightPadding') ;
+ escapeHTML = this.get('escapeHTML');
// get the user defined custom view
- customView = this.get('exampleView') || SC.MenuItemView;
+ customView = this.get('exampleView') || SC.MenuItemView.extend({ escapeHTML: escapeHTML });
menu = SC.MenuPane.create({
@@ -632,7 +679,7 @@ SC.SelectView = SC.ButtonView.extend(
*/
displaySelectedItem: function(menuView) {
var currentItem = menuView.get("selectedItem");
-
+
this.set("value", currentItem.get("value"));
this.set("title", currentItem.get("title"));
this.set("_itemIdx", currentItem.get("contentIndex"));
@@ -749,7 +796,7 @@ SC.SelectView = SC.ButtonView.extend(
mouseExited: function() {
return YES;
},
-
+
/**
@private
Handle Key event - Down arrow key
@@ -778,13 +825,13 @@ SC.SelectView = SC.ButtonView.extend(
}
return sc_super();
},
-
+
/** @private
Override the button isSelectedDidChange function in order to not perform any action
on selecting the select_button
*/
_button_isSelectedDidChange: function() {
-
+
}.observes('isSelected')
}) ;
View
74 frameworks/foundation/views/label.js
@@ -13,12 +13,12 @@ SC.REGULAR_WEIGHT = 'normal';
SC.BOLD_WEIGHT = 'bold';
/**
@class
-
+
Displays a static string of text.
-
- You use a label view anytime you need to display a static string of text
+
+ You use a label view anytime you need to display a static string of text
or to display text that may need to be edited using only an inline control.
-
+
@extends SC.View
@extends SC.Control
@extends SC.InlineEditable
@@ -42,30 +42,30 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
inlineEditorDelegate: SC.InlineTextFieldDelegate,
isEditable: NO,
-
+
/**
- The exampleInlineTextFieldView property is by default a
+ The exampleInlineTextFieldView property is by default a
SC.InlineTextFieldView but it can be set to a customized inline text field
view.
-
+
@property
@type {SC.View}
@default {SC.InlineTextFieldView}
*/
exampleEditor: SC.InlineTextFieldView,
-
+
/**
Specify the font weight for this. You may pass SC.REGULAR_WEIGHT, or SC.BOLD_WEIGHT.
-
+
@property {String} SC.REGULAR_WEIGHT|SC.BOLD_WEIGHT
@default null
@deprecated Use CSS instead.
*/
fontWeight: null,
-
+
/**
If true, value will be escaped to avoid scripting attacks.
-
+
This is a default value that can be overridden by the
settings on the owner view.
*/
@@ -78,25 +78,25 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
*/
localize: NO,
localizeBindingDefault: SC.Binding.oneWay().bool(),
-
+
/**
Set this to a validator or to a function and the value
will be passed through it before being set.
-
+
This is a default default that can be overidden by the
settings in the owner view.
*/
formatter: null,
- /**
+ /**
The value of the label.
-
+
You may also set the value using a content object and a contentValueKey.
-
+
@field {String}
*/
value: '',
-
+
/**
The hint to display if no value is set. Should be used only if isEditable
is set to YES.
@@ -108,10 +108,10 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
to either a CSS class name (for spriting) or an image URL.
*/
icon: null,
-
+
/**
Set the alignment of the label view.
-
+
@property {String} SC.ALIGN_LEFT|SC.ALIGN_CENTER|SC.ALIGN_RIGHT
@default null
@deprecated Use CSS instead.
@@ -139,26 +139,26 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
/**
[RO] The value that will actually be displayed.
-
- This property is dynamically computed by applying localization,
+
+ This property is dynamically computed by applying localization,
string conversion and other normalization utilities.
-
+
@field
*/
displayTitle: function() {
var value, formatter;
-
+
value = this.get('value') ;
-
+
// 1. apply the formatter
formatter = this.getDelegateProperty('formatter', this.displayDelegate) ;
if (formatter) {
- var formattedValue = (SC.typeOf(formatter) === SC.T_FUNCTION) ?
+ var formattedValue = (SC.typeOf(formatter) === SC.T_FUNCTION) ?
formatter(value, this) : formatter.fieldValueForObject(value, this) ;
if (!SC.none(formattedValue)) value = formattedValue ;
}
-
- // 2. If the returned value is an array, convert items to strings and
+
+ // 2. If the returned value is an array, convert items to strings and
// join with commas.
if (SC.typeOf(value) === SC.T_ARRAY) {
var ary = [];
@@ -169,35 +169,35 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
}
value = ary.join(',') ;
}
-
+
// 3. If value is not a string, convert to string. (handles 0)
if (!SC.none(value) && value.toString) value = value.toString() ;
-
+
// 4. Localize
if (value && this.getDelegateProperty('localize', this.displayDelegate)) value = SC.String.loc(value) ;
-
+
return value ;
}.property('value', 'localize', 'formatter').cacheable(),
-
-
+
+
/**
[RO] The hint value that will actually be displayed.
-
- This property is dynamically computed by applying localization
+
+ This property is dynamically computed by applying localization
and other normalization utilities.
-
+
*/
hintValue: function() {
var hintVal = this.get('hint');
return hintVal ;
}.property('hint').cacheable(),
-
+
/**
Event dispatcher callback.
If isEditable is set to true, opens the inline text editor view.
@param {DOMMouseEvent} evt DOM event
-
+
*/
doubleClick: function( evt ) { return this.beginEditing(); },
View
4 frameworks/runtime/core.js
@@ -39,7 +39,7 @@ window.SproutCore = window.SproutCore || SC ;
// rest of the methods go into the mixin defined below.
/**
- @version 1.6.0
+ @version 1.7.1.beta
@namespace
All SproutCore methods and functions are defined
@@ -59,7 +59,7 @@ window.SproutCore = window.SproutCore || SC ;
*/
SC = window.SC; // This is dumb but necessary for jsdoc to get it right
-SC.VERSION = '1.6.0';
+SC.VERSION = '1.7.1.beta';
/**
@private
View
10 themes/ace/resources/picker/popover/popover.css
@@ -24,7 +24,9 @@
left: -25px;
right: -25px;
- @include slices("popover_notoolbar.png", $left: 40, $top: 40, $bottom: 40, $right: 40, $fill: 1 1, skip-middle);
+ @include slices("popover_notoolbar.png", $left: 40, $top: 40, $bottom: 40, $right: 40, $fill: 1 1, $skip: middle);
+
+ .middle { display: none }
div { z-index: 5; }
}
@@ -33,7 +35,7 @@
top: -20px;
@include slices(
"popover.png", $left: 40, $top: 75, $bottom: 40, $right: 40,
- skip-left, skip-middle, skip-right, skip-bottom-left, skip-bottom, skip-bottom-right
+ $skip: left middle right bottom-left bottom bottom-left bottom-right
);
.left { top: 75px; }
@@ -45,7 +47,7 @@
bottom: -20px;
@include slices(
"popover.png", $left: 40, $bottom: 75, $top: 40, $right: 40,
- skip-left, skip-middle, skip-right, skip-top-left, skip-top, skip-top-right
+ $skip: left middle right top-left top top-right
);
.left { bottom: 75px; }
@@ -108,4 +110,4 @@
.sc-pointer { left: 70px; }
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.