sproutcore 1.0.1003 → 1.0.1008
Sign up to get free protection for your applications and to get access to all the features.
- data/Buildfile +15 -3
- data/Rakefile +3 -7
- data/VERSION.yml +2 -2
- data/buildtasks/manifest.rake +2 -0
- data/frameworks/sproutcore/Buildfile +2 -0
- data/frameworks/sproutcore/HISTORY +218 -203
- data/frameworks/sproutcore/README +47 -6
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
- data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
- data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
- data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
- data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
- data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
- data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
- data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
- data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
- data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
- data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
- data/frameworks/sproutcore/lib/index.rhtml +6 -20
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
- data/gen/data-source/Buildfile +18 -0
- data/gen/data-source/README +1 -0
- data/gen/data-source/USAGE +15 -0
- data/gen/data-source/templates/data_sources/@filename@.js +64 -0
- data/lib/sproutcore/builders/combine.rb +23 -0
- data/lib/sproutcore/builders/javascript.rb +27 -2
- data/lib/sproutcore/buildfile/task.rb +1 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +79 -0
- data/lib/sproutcore/models/manifest.rb +2 -2
- data/lib/sproutcore/models/target.rb +1 -1
- data/lib/sproutcore/tools/build.rb +1 -1
- data/lib/sproutcore/tools/docs.rb +3 -3
- data/lib/sproutcore/tools/gen.rb +17 -15
- data/lib/sproutcore/tools/manifest.rb +9 -9
- data/lib/sproutcore/tools/server.rb +3 -3
- data/lib/sproutcore/tools.rb +259 -250
- data/lib/sproutcore.rb +9 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
- data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
- data/spec/lib/models/manifest/find_entry.rb +12 -0
- data/spec/lib/tools/gen_spec.rb +1 -0
- data/spec/lib/tools/tools_spec.rb +1 -0
- data/sproutcore-abbot.gemspec +36 -44
- metadata +43 -44
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/lib/thor/CHANGELOG.rdoc +0 -52
- data/lib/thor/LICENSE +0 -20
- data/lib/thor/README.markdown +0 -76
- data/lib/thor/Rakefile +0 -6
- data/lib/thor/Thorfile +0 -45
- data/lib/thor/bin/rake2thor +0 -83
- data/lib/thor/bin/thor +0 -7
- data/lib/thor/lib/thor/error.rb +0 -3
- data/lib/thor/lib/thor/options.rb +0 -267
- data/lib/thor/lib/thor/ordered_hash.rb +0 -64
- data/lib/thor/lib/thor/runner.rb +0 -305
- data/lib/thor/lib/thor/task.rb +0 -83
- data/lib/thor/lib/thor/task_hash.rb +0 -22
- data/lib/thor/lib/thor/tasks/package.rb +0 -18
- data/lib/thor/lib/thor/tasks.rb +0 -77
- data/lib/thor/lib/thor/util.rb +0 -75
- data/lib/thor/lib/thor.rb +0 -170
- data/lib/thor/script/destroy +0 -14
- data/lib/thor/script/generate +0 -14
- data/lib/thor/spec/fixtures/task.thor +0 -10
- data/lib/thor/spec/options_spec.rb +0 -271
- data/lib/thor/spec/ordered_hash_spec.rb +0 -84
- data/lib/thor/spec/spec.opts +0 -1
- data/lib/thor/spec/spec_helper.rb +0 -30
- data/lib/thor/spec/task_spec.rb +0 -11
- data/lib/thor/spec/tasks_spec.rb +0 -28
- data/lib/thor/spec/thor_runner_spec.rb +0 -194
- data/lib/thor/spec/thor_spec.rb +0 -206
- data/lib/thor/spec/util_spec.rb +0 -99
- data/lib/thor/task.thor +0 -15
- data/lib/thor/thor.gemspec +0 -29
@@ -82,6 +82,11 @@ sc_require('views/text_field') ;
|
|
82
82
|
SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
83
83
|
/** @scope SC.InlineTextFieldView.prototype */ {
|
84
84
|
|
85
|
+
/**
|
86
|
+
Over-write magic number from SC.TextFieldView
|
87
|
+
*/
|
88
|
+
_topOffsetForFirefoxCursorFix: 0,
|
89
|
+
|
85
90
|
/**
|
86
91
|
Invoked by the class method to begin editing on an inline editor.
|
87
92
|
|
@@ -93,7 +98,10 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
93
98
|
@returns {Boolean} YES if editor began editing, NO if it failed.
|
94
99
|
*/
|
95
100
|
beginEditing: function(options) {
|
96
|
-
|
101
|
+
if (!options) return;
|
102
|
+
|
103
|
+
var layout={}, pane, delLayout, paneElem;
|
104
|
+
|
97
105
|
// end existing editing if necessary
|
98
106
|
this.beginPropertyChanges();
|
99
107
|
if (this.get('isEditing') && !this.blurEditor()) {
|
@@ -111,6 +119,11 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
111
119
|
|
112
120
|
this._originalValue = options.value || '' ;
|
113
121
|
this._multiline = (options.multiline !== undefined) ? options.multiline : NO ;
|
122
|
+
if(this._multiline){
|
123
|
+
this.set('isTextArea', YES);
|
124
|
+
}else{
|
125
|
+
this.set('isTextArea', NO);
|
126
|
+
}
|
114
127
|
this._commitOnBlur = (options.commitOnBlur !== undefined) ? options.commitOnBlur : YES ;
|
115
128
|
|
116
129
|
// set field values
|
@@ -126,15 +139,17 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
126
139
|
|
127
140
|
layout.height = this._optframe.height;
|
128
141
|
layout.width=this._optframe.width;
|
129
|
-
|
130
|
-
|
142
|
+
delLayout = this._delegate.get('layout');
|
143
|
+
paneElem = pane.$()[0];
|
144
|
+
if(this._optIsCollection && delLayout.left){
|
145
|
+
layout.left=this._optframe.x-delLayout.left-paneElem.offsetLeft-1;
|
131
146
|
}else{
|
132
|
-
layout.left=this._optframe.x-
|
147
|
+
layout.left=this._optframe.x-paneElem.offsetLeft-1;
|
133
148
|
}
|
134
|
-
if(this._optIsCollection &&
|
135
|
-
layout.top=this._optframe.y-
|
149
|
+
if(this._optIsCollection && delLayout.top){
|
150
|
+
layout.top=this._optframe.y-delLayout.top-paneElem.offsetTop;
|
136
151
|
}else{
|
137
|
-
layout.top=this._optframe.y-
|
152
|
+
layout.top=this._optframe.y-paneElem.offsetTop;
|
138
153
|
}
|
139
154
|
|
140
155
|
this.set('layout', layout);
|
@@ -146,7 +161,6 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
146
161
|
|
147
162
|
SC.RunLoop.begin().end();
|
148
163
|
|
149
|
-
|
150
164
|
var del = this._delegate ;
|
151
165
|
|
152
166
|
this._className = this.getDelegateProperty(del,"inlineEditorClassName");
|
@@ -158,15 +172,17 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
158
172
|
// this.resizeToFit(this.getFieldValue()) ;
|
159
173
|
|
160
174
|
// allow notifications to go
|
161
|
-
|
175
|
+
|
162
176
|
|
163
177
|
// and become first responder
|
164
|
-
this.
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
178
|
+
this._previousFirstResponder = pane ? pane.get('firstResponder') : null;
|
179
|
+
|
180
|
+
this.endPropertyChanges() ;
|
181
|
+
|
169
182
|
this.invokeDelegateMethod(del, 'inlineEditorDidBeginEditing', this) ;
|
183
|
+
//if(SC.browser.mozilla)this.invokeOnce(this.becomeFirstResponder) ;
|
184
|
+
this.invokeLast(this.becomeFirstResponder) ;
|
185
|
+
|
170
186
|
},
|
171
187
|
|
172
188
|
|
@@ -230,7 +246,14 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
230
246
|
|
231
247
|
// resign first responder if not done already. This may call us in a
|
232
248
|
// loop but since isEditing is already NO, nothing will happen.
|
233
|
-
if (this.get('isFirstResponder'))
|
249
|
+
if (this.get('isFirstResponder')) {
|
250
|
+
var pane = this.get('pane');
|
251
|
+
if (pane && this._previousFirstResponder) {
|
252
|
+
pane.makeFirstResponder(this._previousFirstResponder);
|
253
|
+
} else this.resignFirstResponder();
|
254
|
+
}
|
255
|
+
this._previousFirstResponder = null ; // clearout no matter what
|
256
|
+
|
234
257
|
if (this.get('parentNode')) this.removeFromParent() ;
|
235
258
|
|
236
259
|
return YES ;
|
@@ -283,7 +306,7 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
283
306
|
/** @private */
|
284
307
|
keyDown: function(evt) {
|
285
308
|
var ret = this.interpretKeyEvents(evt) ;
|
286
|
-
|
309
|
+
this.fieldValueDidChange(true);
|
287
310
|
return !ret ? NO : ret ;
|
288
311
|
},
|
289
312
|
|
@@ -296,17 +319,22 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
296
319
|
// remove it from the DOM key events are no longer sent to the browser.
|
297
320
|
/** @private */
|
298
321
|
willRemoveFromParent: function() {
|
299
|
-
this.$(
|
322
|
+
this.$input()[0].blur();
|
300
323
|
},
|
301
324
|
|
302
325
|
// ask owner to end editing.
|
303
326
|
/** @private */
|
304
327
|
willLoseFirstResponder: function(responder) {
|
305
328
|
if (responder !== this) return;
|
329
|
+
|
330
|
+
// if we're about to lose first responder for any reason other than
|
331
|
+
// ending editing, make sure we clear the previous first responder so
|
332
|
+
// isn't cached
|
333
|
+
this._previousFirstResponder = null;
|
306
334
|
|
307
335
|
// should have been covered by willRemoveFromParent, but this was needed
|
308
336
|
// too.
|
309
|
-
this.$(
|
337
|
+
this.$input()[0].blur();
|
310
338
|
return this.blurEditor() ;
|
311
339
|
},
|
312
340
|
|
@@ -334,6 +362,7 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
334
362
|
/** @private */
|
335
363
|
insertNewline: function(evt) {
|
336
364
|
if (this._multiline) {
|
365
|
+
evt.allowDefault();
|
337
366
|
return arguments.callee.base.call(this, evt) ;
|
338
367
|
} else {
|
339
368
|
// TODO : this is a work around. There is a bug where the
|
@@ -354,8 +383,9 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
354
383
|
// editable, begins editing.
|
355
384
|
/** @private */
|
356
385
|
insertTab: function(evt) {
|
357
|
-
|
386
|
+
this.resignFirstResponder();
|
358
387
|
this.commitEditing() ;
|
388
|
+
var next = this._delegate.nextValidKeyView();
|
359
389
|
if(next) next.beginEditing();
|
360
390
|
return YES ;
|
361
391
|
},
|
@@ -366,9 +396,20 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
|
|
366
396
|
this.commitEditing() ;
|
367
397
|
if(prev) prev.beginEditing();
|
368
398
|
return YES ;
|
399
|
+
},
|
400
|
+
|
401
|
+
/** @private */
|
402
|
+
deleteForward: function(evt) {
|
403
|
+
evt.allowDefault();
|
404
|
+
return YES;
|
405
|
+
},
|
406
|
+
|
407
|
+
/** @private */
|
408
|
+
deleteBackward: function(evt) {
|
409
|
+
evt.allowDefault();
|
410
|
+
return YES ;
|
369
411
|
}
|
370
|
-
|
371
|
-
|
412
|
+
|
372
413
|
});
|
373
414
|
|
374
415
|
|
@@ -459,6 +500,14 @@ SC.InlineTextFieldView.mixin(
|
|
459
500
|
if(s && s.length>0) styles = styles + "line-height: " + s + " !important; ";
|
460
501
|
s=SC.getStyle(el,'text-align');
|
461
502
|
if(s && s.length>0) styles = styles + "text-align: " + s + " !important; ";
|
503
|
+
s=SC.getStyle(el,'top-margin');
|
504
|
+
if(s && s.length>0) styles = styles + "top-margin: " + s + " !important; ";
|
505
|
+
s=SC.getStyle(el,'bottom-margin');
|
506
|
+
if(s && s.length>0) styles = styles + "bottom-margin: " + s + " !important; ";
|
507
|
+
s=SC.getStyle(el,'left-margin');
|
508
|
+
if(s && s.length>0) styles = styles + "left-margin: " + s + " !important; ";
|
509
|
+
s=SC.getStyle(el,'right-margin');
|
510
|
+
if(s && s.length>0) styles = styles + "right-margin: " + s + " !important; ";
|
462
511
|
|
463
512
|
return styles;
|
464
513
|
},
|
@@ -62,6 +62,19 @@ SC.SelectionSupport = {
|
|
62
62
|
*/
|
63
63
|
allowsEmptySelection: YES,
|
64
64
|
|
65
|
+
/**
|
66
|
+
Override to return the first selectable object. For example, if you
|
67
|
+
have groups or want to otherwise limit the kinds of objects that can be
|
68
|
+
selected.
|
69
|
+
|
70
|
+
the default imeplementation returns firstObject property.
|
71
|
+
|
72
|
+
@returns {Object} first selectable object
|
73
|
+
*/
|
74
|
+
firstSelectableObject: function() {
|
75
|
+
return this.get('firstObject');
|
76
|
+
}.property(),
|
77
|
+
|
65
78
|
/**
|
66
79
|
This is the current selection. You can make this selection and another
|
67
80
|
controller's selection work in concert by binding them together. You
|
@@ -70,44 +83,57 @@ SC.SelectionSupport = {
|
|
70
83
|
@property {SC.SelectionSet}
|
71
84
|
*/
|
72
85
|
selection: function(key, value) {
|
73
|
-
var content, empty;
|
74
|
-
|
75
|
-
if (value !== undefined) {
|
76
|
-
|
77
|
-
// are we even allowing selection at all? Also, must be enumerable
|
78
|
-
if (this.get('allowsSelection') && value && value.isEnumerable) {
|
79
86
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
// check to see if we're attempting to set an empty array
|
84
|
-
// if that's not allowed, set to the first available item in
|
85
|
-
// arrangedObjects
|
86
|
-
case 0:
|
87
|
-
empty = this.get('allowsEmptySelection');
|
88
|
-
content = this.get('arrangedObjects');
|
89
|
-
if (empty && content && content.get('length')>0) {
|
90
|
-
value = SC.SelectionSet.create().add(content, 0).freeze();
|
91
|
-
} else value = null ;
|
92
|
-
break;
|
93
|
-
|
94
|
-
// single items are always allows
|
95
|
-
case 1:
|
96
|
-
break;
|
87
|
+
var old = this._scsel_selection,
|
88
|
+
oldlen = old ? old.get('length') : 0,
|
89
|
+
content, empty, len;
|
97
90
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
91
|
+
// whenever we have to recompute selection, reapply all the conditions to
|
92
|
+
// the selection. This ensures that changing the conditions immediately
|
93
|
+
// updates the selection.
|
94
|
+
//
|
95
|
+
// Note also if we don't allowSelection, we don't clear the old selection;
|
96
|
+
// we just don't allow it to be changed.
|
97
|
+
if ((value === undefined) || !this.get('allowsSelection')) value = old ;
|
98
|
+
|
99
|
+
len = (value && value.isEnumerable) ? value.get('length') : 0;
|
100
|
+
|
101
|
+
// if we don't allow multiple selection
|
102
|
+
if ((len>1) && !this.get('allowsMultipleSelection')) {
|
103
|
+
|
104
|
+
if (oldlen>1) {
|
105
|
+
value = SC.SelectionSet.create()
|
106
|
+
.addObject(old.get('firstObject')).freeze();
|
107
|
+
len = 1;
|
108
|
+
} else {
|
109
|
+
value = old;
|
110
|
+
len = oldlen;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
// if we don't allow empty selection, block that also. select first
|
115
|
+
// selectable item if necessary.
|
116
|
+
if ((len===0) && !this.get('allowsEmptySelection')) {
|
117
|
+
if (oldlen===0) {
|
118
|
+
value = this.get('firstSelectableObject');
|
119
|
+
if (value) value = SC.SelectionSet.create().addObject(value).freeze();
|
120
|
+
else value = SC.SelectionSet.EMPTY;
|
121
|
+
len = value.get('length');
|
122
|
+
|
123
|
+
} else {
|
124
|
+
value = old;
|
125
|
+
len = oldlen;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
// if value is empty or is not enumerable, then use empty set
|
130
|
+
if (len===0) value = SC.SelectionSet.EMPTY;
|
131
|
+
|
132
|
+
// always use a frozen copy...
|
133
|
+
value = value.frozenCopy();
|
134
|
+
this._scsel_selection = value;
|
135
|
+
|
136
|
+
return value;
|
111
137
|
|
112
138
|
}.property('arrangedObjects', 'allowsEmptySelection',
|
113
139
|
'allowsMultipleSelection', 'allowsSelection').cacheable(),
|
@@ -205,28 +231,36 @@ SC.SelectionSupport = {
|
|
205
231
|
|
206
232
|
var content = this.get('arrangedObjects'),
|
207
233
|
sel = this.get('selection'),
|
208
|
-
|
234
|
+
ret = sel,
|
235
|
+
indexes, len, max;
|
209
236
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
ret = SC.SelectionSet.EMPTY;
|
215
|
-
|
216
|
-
|
217
|
-
// selection is allowed, make sure it is valid
|
218
|
-
} else {
|
219
|
-
|
220
|
-
// remove from the sel any items selected beyond the length of the new
|
221
|
-
// arrangedObjects
|
222
|
-
indexes = content ? sel.indexSetForSource(content) : null;
|
223
|
-
len = content ? content.get('length') : 0;
|
237
|
+
// first, make sure selection goes beyond current items...
|
238
|
+
if (ret && content && ret.get('sources').indexOf(content)>=0) {
|
239
|
+
indexes = ret.indexSetForSource(content);
|
240
|
+
len = content.get('length') ;
|
224
241
|
max = indexes ? indexes.get('max') : 0;
|
225
|
-
if (max > len) ret = sel.copy().constrain(content).freeze();
|
226
242
|
|
243
|
+
// to clean this up, just copy the selection and remove the extra
|
244
|
+
// indexes
|
245
|
+
if (max > len) {
|
246
|
+
ret = ret.copy().remove(content, len, max-len).freeze();
|
247
|
+
this.set('selection', ret);
|
248
|
+
}
|
227
249
|
}
|
228
|
-
|
229
|
-
if
|
250
|
+
|
251
|
+
// if we didn't have to recompute the selection anyway, do a quick check
|
252
|
+
// to make sure there are no constraints that need to be recomputed.
|
253
|
+
if (ret === sel) {
|
254
|
+
len = sel ? sel.get('length') : 0;
|
255
|
+
max = content ? content.get('length') : 0;
|
256
|
+
|
257
|
+
// need to recompute if the selection is empty and it shouldn't be but
|
258
|
+
// only if we have some content; otherwise what's the point?
|
259
|
+
if ((len===0) && !this.get('allowsEmptySelection') && max>0) {
|
260
|
+
this.notifyPropertyChange('selection');
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
230
264
|
return this ;
|
231
265
|
}
|
232
266
|
|
@@ -84,31 +84,6 @@ SC.StaticLayout = {
|
|
84
84
|
context.setClass('sc-static-layout', this.get('useStaticLayout'));
|
85
85
|
},
|
86
86
|
|
87
|
-
/**
|
88
|
-
Not available on views with static layout. Calling this method will raise
|
89
|
-
an exception.
|
90
|
-
|
91
|
-
@function
|
92
|
-
*/
|
93
|
-
convertFrameToView: null,
|
94
|
-
|
95
|
-
/**
|
96
|
-
Not available on views with static layout. Calling this method will raise
|
97
|
-
an exception.
|
98
|
-
|
99
|
-
@function
|
100
|
-
*/
|
101
|
-
convertFrameFromView: null,
|
102
|
-
|
103
|
-
/**
|
104
|
-
Frame is not available on views with static layout. This property will
|
105
|
-
always return null.
|
106
|
-
|
107
|
-
@function
|
108
|
-
*/
|
109
|
-
frame: null,
|
110
|
-
|
111
|
-
|
112
87
|
/**
|
113
88
|
clippingFrame is not available on views with static layout. This
|
114
89
|
property will always return null.
|
@@ -312,13 +312,31 @@ SC.String = {
|
|
312
312
|
},
|
313
313
|
|
314
314
|
/**
|
315
|
-
Removes any extra whitespace from the edges of the
|
315
|
+
Removes any extra whitespace from the edges of the string. This method is
|
316
316
|
also aliased as strip().
|
317
317
|
|
318
318
|
@returns {String} the trimmed string
|
319
319
|
*/
|
320
320
|
trim: function () {
|
321
321
|
return this.replace(/^\s+|\s+$/g,"");
|
322
|
+
},
|
323
|
+
|
324
|
+
/**
|
325
|
+
Removes any extra whitespace from the left edge of the string.
|
326
|
+
|
327
|
+
@returns {String} the trimmed string
|
328
|
+
*/
|
329
|
+
trimLeft: function () {
|
330
|
+
return this.replace(/^\s+/g,"");
|
331
|
+
},
|
332
|
+
|
333
|
+
/**
|
334
|
+
Removes any extra whitespace from the right edge of the string.
|
335
|
+
|
336
|
+
@returns {String} the trimmed string
|
337
|
+
*/
|
338
|
+
trimRight: function () {
|
339
|
+
return this.replace(/\s+$/g,"");
|
322
340
|
}
|
323
341
|
|
324
342
|
};
|
@@ -327,7 +345,10 @@ SC.String = {
|
|
327
345
|
SC.String.strip = SC.String.trim; // convenience alias.
|
328
346
|
|
329
347
|
// Apply SC.String mixin to built-in String object
|
330
|
-
SC.
|
348
|
+
SC.supplement(String.prototype, SC.String) ;
|
349
|
+
|
350
|
+
/** @private */
|
351
|
+
String.prototype.loc = SC.String.loc; // Two places define it, and we want the version at SC.String.loc
|
331
352
|
|
332
353
|
/** @private */
|
333
354
|
SC.String.fmt = String.prototype.fmt; // copy from runtime
|
@@ -112,12 +112,6 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
112
112
|
*/
|
113
113
|
currentWindowSize: null,
|
114
114
|
|
115
|
-
/** @private
|
116
|
-
|
117
|
-
@property {SC.Pane}
|
118
|
-
*/
|
119
|
-
previousKeyPane: null,
|
120
|
-
|
121
115
|
/**
|
122
116
|
The parent dimensions are always the last known window size.
|
123
117
|
|
@@ -378,12 +372,6 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
378
372
|
didBecomeKeyPaneFrom: function(pane) {
|
379
373
|
var isKeyPane = this.get('isKeyPane');
|
380
374
|
this.set('isKeyPane', YES);
|
381
|
-
// check if the previousKeyPane is a menu. If it is a menu, don't set as
|
382
|
-
// a previous keypane, set the previousKeyPane to the keypane before
|
383
|
-
// the menu as it is an the menu is an intermediate pane that you dont want to go back to.
|
384
|
-
if(pane && pane.kindOf(SC.MenuPane)) this.set('previousKeyPane', pane.get('previousKeyPane'));
|
385
|
-
else if(pane) this.set('previousKeyPane', pane);
|
386
|
-
else this.set('previousKeyPane', null);
|
387
375
|
this._forwardKeyChange(!isKeyPane, 'didBecomeKeyResponderFrom', pane, YES);
|
388
376
|
return this ;
|
389
377
|
},
|
@@ -473,16 +461,14 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
473
461
|
if (dom.parentNode) dom.parentNode.removeChild(dom) ;
|
474
462
|
dom = null ;
|
475
463
|
|
476
|
-
//
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
responder.panes.remove(this) ;
|
485
|
-
this.rootResponder = responder = null ;
|
464
|
+
// resign keyPane status, if we had it
|
465
|
+
this.resignKeyPane();
|
466
|
+
|
467
|
+
// remove the pane
|
468
|
+
var rootResponder = this.rootResponder ;
|
469
|
+
if (this.get('isMainPane')) rootResponder.makeMainPane(null) ;
|
470
|
+
rootResponder.panes.remove(this) ;
|
471
|
+
this.rootResponder = null ;
|
486
472
|
|
487
473
|
// clean up some of my own properties
|
488
474
|
this.set('isPaneAttached', NO) ;
|
@@ -503,6 +489,11 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
503
489
|
appendTo: function(elem) {
|
504
490
|
var layer = this.get('layer');
|
505
491
|
if (!layer) layer =this.createLayer().get('layer');
|
492
|
+
|
493
|
+
if (this.get('isPaneAttached') && (layer.parentNode === elem)) {
|
494
|
+
return this; // nothing to do
|
495
|
+
}
|
496
|
+
|
506
497
|
elem.insertBefore(layer, null); // add to DOM
|
507
498
|
elem = layer = null ;
|
508
499
|
|
@@ -516,8 +507,15 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
516
507
|
@returns {SC.Pane} receiver
|
517
508
|
*/
|
518
509
|
prependTo: function(elem) {
|
510
|
+
if (this.get('isPaneAttached')) return this;
|
511
|
+
|
519
512
|
var layer = this.get('layer');
|
520
513
|
if (!layer) layer =this.createLayer().get('layer');
|
514
|
+
|
515
|
+
if (this.get('isPaneAttached') && (layer.parentNode === elem)) {
|
516
|
+
return this; // nothing to do
|
517
|
+
}
|
518
|
+
|
521
519
|
elem.insertBefore(layer, elem.firstChild); // add to DOM
|
522
520
|
elem = layer = null ;
|
523
521
|
|
@@ -532,10 +530,17 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
532
530
|
@returns {SC.Pane} receiver
|
533
531
|
*/
|
534
532
|
before: function(elem) {
|
533
|
+
if (this.get('isPaneAttached')) return this;
|
534
|
+
|
535
535
|
var layer = this.get('layer');
|
536
536
|
if (!layer) layer =this.createLayer().get('layer');
|
537
537
|
|
538
538
|
var parent = elem.parentNode ;
|
539
|
+
|
540
|
+
if (this.get('isPaneAttached') && (layer.parentNode === parent)) {
|
541
|
+
return this; // nothing to do
|
542
|
+
}
|
543
|
+
|
539
544
|
parent.insertBefore(layer, elem); // add to DOM
|
540
545
|
parent = elem = layer = null ;
|
541
546
|
|
@@ -550,11 +555,17 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
|
|
550
555
|
@returns {SC.Pane} receiver
|
551
556
|
*/
|
552
557
|
after: function(elem) {
|
558
|
+
|
553
559
|
var layer = this.get('layer');
|
554
560
|
if (!layer) layer =this.createLayer().get('layer');
|
555
561
|
|
556
562
|
var parent = elem.parentNode ;
|
557
|
-
|
563
|
+
|
564
|
+
if (this.get('isPaneAttached') && (layer.parentNode === parent)) {
|
565
|
+
return this; // nothing to do
|
566
|
+
}
|
567
|
+
|
568
|
+
parent.insertBefore(layer, elem.nextSibling); // add to DOM
|
558
569
|
parent = elem = layer = null ;
|
559
570
|
|
560
571
|
return this.paneDidAttach(); // do the rest of the setup
|
@@ -209,11 +209,31 @@ SC.TreeItemObserver = SC.Object.extend(SC.Array, SC.CollectionContent, {
|
|
209
209
|
range you replace must lie entirely within the same parent item, otherwise
|
210
210
|
this will raise an exception.
|
211
211
|
|
212
|
+
h3. The Operation Parameter
|
213
|
+
|
212
214
|
Note that this replace method accepts an additional parameter "operation"
|
213
215
|
which is used when you try to insert an item on a boundary between
|
214
216
|
branches whether it should be inserted at the end of the previous group
|
215
217
|
after the group. If you don't pass operation, the default is
|
216
218
|
SC.DROP_BEFORE, which is the expected behavior.
|
219
|
+
|
220
|
+
Even if the operation is SC.DROP_AFTER, you should still pass the actual
|
221
|
+
index where you expect the item to be inserted. For example, if you want
|
222
|
+
to insert AFTER the last index of an 3-item array, you would still call:
|
223
|
+
|
224
|
+
{{{
|
225
|
+
observer.replace(3, 0, [object1 .. objectN], SC.DROP_AFTER)
|
226
|
+
}}}
|
227
|
+
|
228
|
+
The operation is simply used to disambiguate whether the insertion is
|
229
|
+
intended to be AFTER the previous item or BEFORE the items you are
|
230
|
+
replacing.
|
231
|
+
|
232
|
+
@param {Number} start the starting index
|
233
|
+
@param {Number} amt the number of items to replace
|
234
|
+
@param {SC.Array} objects array of objects to insert
|
235
|
+
@param {Number} operation either SC.DROP_BEFORE or SC.DROP_AFTER
|
236
|
+
@returns {SC.TreeItemObserver} receiver
|
217
237
|
*/
|
218
238
|
replace: function(start, amt, objects, operation) {
|
219
239
|
|