sproutcore 1.11.0.rc2 → 1.11.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +10 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +114 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +1 -7
- data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +167 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +24 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/stack_layout.js +737 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +0 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +11 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/{desktop/protocols/responder.js → core_foundation/protocols/responder_protocol.js} +83 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/{sparse_array_delegate.js → sparse_array_delegate_protocol.js} +11 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +11 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +0 -22
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +61 -56
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +63 -39
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +28 -28
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +10 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +102 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +103 -103
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/replaceAllChildren_test.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +77 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +18 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +42 -49
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +16 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +241 -102
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +993 -610
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +6 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +94 -27
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +133 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +30 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +73 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/conflictedStoreKeys_test.js +156 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +61 -37
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +68 -39
- data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +8 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +80 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_data_source.js → drag_data_source_protocol.js} +16 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_source.js → drag_source_protocol.js} +28 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drop_target.js → drop_target_protocol.js} +73 -75
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +39 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +120 -97
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowSizeForContentIndex.js +26 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/{dividers.js → dividers_test.js} +38 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +29 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +13 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +41 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +41 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -12
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +14 -10
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +104 -63
- data/lib/frameworks/sproutcore/frameworks/foundation/protocols/swap_transition_protocol.js +9 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +33 -33
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/transitions/view_transitions_test.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +0 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +0 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +12 -8
- data/lib/frameworks/sproutcore/frameworks/media/resources/silence.mp3 +0 -0
- data/lib/frameworks/sproutcore/frameworks/media/tests/audio.js +69 -0
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +11 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/protocols/mixin_protocol.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +447 -137
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +9 -15
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +19 -17
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +188 -16
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/panes/template.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/panes/template.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +43 -26
- data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +9 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +0 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/scroll/scroll.css +3 -0
- data/sproutcore.gemspec +3 -3
- metadata +19 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +0 -465
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +0 -472
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js +0 -87
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +0 -89
@@ -550,7 +550,7 @@ SC.State = SC.Object.extend(
|
|
550
550
|
|
551
551
|
@param {String} name a unique name for the given substate.
|
552
552
|
@param {SC.State} state a class that derives from `SC.State`
|
553
|
-
@param {
|
553
|
+
@param {Object} [attr] literal to be applied to the substate
|
554
554
|
@returns {SC.State} an instance of the given state class
|
555
555
|
*/
|
556
556
|
addSubstate: function(name, state, attr) {
|
@@ -18,20 +18,3 @@ test("Template panes append a main pane to the document body", function() {
|
|
18
18
|
pane.remove();
|
19
19
|
pane.destroy();
|
20
20
|
});
|
21
|
-
|
22
|
-
test("Template panes should be awoken", function(){
|
23
|
-
var didAwake = false;
|
24
|
-
|
25
|
-
var originalAwake = SC.MainPane.prototype.awake; // null for now, but just in case
|
26
|
-
SC.MainPane.prototype.awake = function(){ didAwake = true; }
|
27
|
-
|
28
|
-
var pane = SC.TemplatePane.append({
|
29
|
-
layerId: 'template-panes-are-so-cool',
|
30
|
-
template: SC.Handlebars.compile('<h1>foo bar baz</h1>')
|
31
|
-
});
|
32
|
-
|
33
|
-
SC.MainPane.prototype.awake = originalAwake;
|
34
|
-
|
35
|
-
ok(didAwake, "should have awoken the pane");
|
36
|
-
pane.destroy();
|
37
|
-
});
|
@@ -33,16 +33,18 @@ test("creating a collection view works", function() {
|
|
33
33
|
var selectCollectionView = CollectionView.create({ tagName: "select" });
|
34
34
|
var customTagCollectionView = CollectionView.create({ tagName: "p", itemView: CustomChildView });
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
SC.run(function () {
|
37
|
+
defaultCollectionView.createLayer();
|
38
|
+
ulCollectionView.createLayer();
|
39
|
+
olCollectionView.createLayer();
|
40
|
+
dlCollectionView.createLayer();
|
41
|
+
dlCollectionView2.createLayer();
|
42
|
+
dlCollectionView3.createLayer();
|
43
|
+
dlCollectionView4.createLayer();
|
44
|
+
dlCollectionView5.createLayer();
|
45
|
+
selectCollectionView.createLayer();
|
46
|
+
customTagCollectionView.createLayer();
|
47
|
+
});
|
46
48
|
|
47
49
|
ok(defaultCollectionView.$().is("ul"), "Unordered list collection view was rendered (Default)");
|
48
50
|
equals(defaultCollectionView.$('li').length, 1, "List item was rendered (Default)");
|
@@ -87,7 +89,9 @@ test("not passing a block to the collection helper creates a collection", functi
|
|
87
89
|
template: SC.Handlebars.compile('{{collection "TemplateTests.CollectionTestView"}}')
|
88
90
|
});
|
89
91
|
|
90
|
-
|
92
|
+
SC.run(function () {
|
93
|
+
view.createLayer();
|
94
|
+
});
|
91
95
|
equals(view.$('aside').length, 3, 'one aside element is created for each content item');
|
92
96
|
});
|
93
97
|
|
@@ -100,7 +104,9 @@ test("passing a block to the collection helper sets it as the template for examp
|
|
100
104
|
template: SC.Handlebars.compile('{{#collection "TemplateTests.CollectionTestView"}} <aside></aside> {{/collection}}')
|
101
105
|
});
|
102
106
|
|
103
|
-
|
107
|
+
SC.run(function () {
|
108
|
+
view.createLayer();
|
109
|
+
});
|
104
110
|
equals(view.$('aside').length, 3, 'one aside element is created for each content item');
|
105
111
|
});
|
106
112
|
|
@@ -113,7 +119,9 @@ test("a block passed to a collection helper defaults to the content property of
|
|
113
119
|
template: SC.Handlebars.compile('{{#collection "TemplateTests.CollectionTestView"}} <aside>{{content}}</aside> {{/collection}}')
|
114
120
|
});
|
115
121
|
|
116
|
-
|
122
|
+
SC.run(function () {
|
123
|
+
view.createLayer();
|
124
|
+
});
|
117
125
|
|
118
126
|
equals(view.$('li:has(aside:contains("foo")) + li:has(aside:contains("bar")) + li:has(aside:contains("baz"))').length, 1, 'one aside element is created for each content item');
|
119
127
|
});
|
@@ -127,13 +135,18 @@ test("a block passed to a collection helper defaults to the view", function() {
|
|
127
135
|
template: SC.Handlebars.compile('{{#collection "TemplateTests.CollectionTestView"}} <aside>{{content}}</aside> {{/collection}}')
|
128
136
|
});
|
129
137
|
|
130
|
-
|
138
|
+
SC.run(function () {
|
139
|
+
view.createLayer();
|
140
|
+
});
|
141
|
+
|
131
142
|
equals(view.$('li:has(aside:contains("foo")) + li:has(aside:contains("bar")) + li:has(aside:contains("baz"))').length, 1, 'precond - one aside element is created for each content item');
|
132
143
|
|
133
144
|
SC.run(function() {
|
134
145
|
TemplateTests.CollectionTestView.set('content', []);
|
135
146
|
});
|
136
147
|
equals(view.$('aside').length, 0, "all list item views should be removed from DOM");
|
148
|
+
|
149
|
+
view.destroyLayer();
|
137
150
|
});
|
138
151
|
|
139
152
|
test("should include an id attribute if id is set in the options hash", function() {
|
@@ -141,7 +154,9 @@ test("should include an id attribute if id is set in the options hash", function
|
|
141
154
|
template: SC.Handlebars.compile('{{#collection "TemplateTests.CollectionTestView" id="baz"}}foo{{/collection}}')
|
142
155
|
});
|
143
156
|
|
144
|
-
|
157
|
+
SC.run(function () {
|
158
|
+
view.createLayer();
|
159
|
+
});
|
145
160
|
equals(view.$('ul#baz').length, 1, "adds an id attribute");
|
146
161
|
});
|
147
162
|
|
@@ -153,7 +168,9 @@ test("should give its item views the class specified by itemClass", function() {
|
|
153
168
|
template: SC.Handlebars.compile('{{#collection "TemplateTests.itemClassTestCollectionView" itemClass="baz"}}foo{{/collection}}')
|
154
169
|
});
|
155
170
|
|
156
|
-
|
171
|
+
SC.run(function () {
|
172
|
+
view.createLayer();
|
173
|
+
});
|
157
174
|
equals(view.$('ul li.baz').length, 3, "adds class attribute");
|
158
175
|
});
|
159
176
|
|
@@ -266,7 +283,7 @@ test("should re-render when the content object changes", function() {
|
|
266
283
|
template: SC.Handlebars.compile('{{#collection TemplateTests.RerenderTest}}{{content}}{{/collection}}')
|
267
284
|
});
|
268
285
|
|
269
|
-
view.createLayer();
|
286
|
+
SC.run(function() { view.createLayer(); });
|
270
287
|
|
271
288
|
SC.run(function() {
|
272
289
|
view.childViews[0].set('content', ['bing', 'bat', 'bang']);
|
@@ -290,7 +307,7 @@ test("should allow changes to content object before layer is created", function(
|
|
290
307
|
view.set('content', [1, 2, 3]);
|
291
308
|
view.set('content', [1, 2]);
|
292
309
|
|
293
|
-
view.createLayer();
|
310
|
+
SC.run(function() { view.createLayer(); });
|
294
311
|
ok(view.$('li').length);
|
295
312
|
});
|
296
313
|
|
@@ -299,10 +316,10 @@ test("should allow changing content property to be null", function() {
|
|
299
316
|
content: [1, 2, 3]
|
300
317
|
});
|
301
318
|
|
302
|
-
view.createLayer();
|
319
|
+
SC.run(function() { view.createLayer(); });
|
303
320
|
equals(view.$('li').length, 3, "precond - creates three elements");
|
304
321
|
|
305
|
-
view.set('content', null);
|
322
|
+
SC.run(function() { view.set('content', null); });
|
306
323
|
equals(view.$('li').length, 0, "should not create any li elements");
|
307
324
|
});
|
308
325
|
|
@@ -326,7 +343,7 @@ test("collection view within a collection view with default content should rende
|
|
326
343
|
template: SC.Handlebars.compile('{{collection "TemplateTests.OuterCollectionView"}}')
|
327
344
|
});
|
328
345
|
|
329
|
-
view.createLayer();
|
346
|
+
SC.run(function() { view.createLayer(); });
|
330
347
|
|
331
348
|
equals(view.$('ul ul:eq(0) li').length, 3, 'first nested collection view should have 3 list items');
|
332
349
|
equals(view.$('ul ul:eq(1) li').length, 2, 'second nested collection view should have 2 list items');
|
@@ -353,7 +370,7 @@ test("collection view within a collection view should have the right childViews"
|
|
353
370
|
template: SC.Handlebars.compile('{{collection "TemplateTests.OuterCollectionView"}}')
|
354
371
|
});
|
355
372
|
|
356
|
-
view.createLayer();
|
373
|
+
SC.run(function() { view.createLayer(); });
|
357
374
|
|
358
375
|
var outer = view.childViews[0];
|
359
376
|
var firstInner = outer.childViews[0].childViews[0];
|
@@ -376,7 +393,7 @@ test("should render inverse template when its present and there is no content",
|
|
376
393
|
template: SC.Handlebars.compile('{{collection "TemplateTests.CollectionTestView"}}')
|
377
394
|
});
|
378
395
|
|
379
|
-
view.createLayer();
|
396
|
+
SC.run(function() { view.createLayer(); });
|
380
397
|
|
381
398
|
equals(view.$('h1').text(), 'inverse', 'collection view with no content and inverse template should render inverse template');
|
382
399
|
});
|
@@ -397,7 +414,7 @@ test("should render inverse template name when its present and there is no conte
|
|
397
414
|
template: SC.Handlebars.compile('{{collection "TemplateTests.CollectionTestView"}}')
|
398
415
|
});
|
399
416
|
|
400
|
-
view.createLayer();
|
417
|
+
SC.run(function() { view.createLayer(); });
|
401
418
|
|
402
419
|
equals(view.$('h1').text(), 'inverse template from file', 'collection view with no content and inverse template name should render template');
|
403
420
|
});
|
@@ -425,7 +442,7 @@ test("#collection helper should raise an error when passing a first argument tha
|
|
425
442
|
var errored = false;
|
426
443
|
|
427
444
|
try {
|
428
|
-
view.createLayer();
|
445
|
+
SC.run(function() { view.createLayer(); });
|
429
446
|
} catch(e) {
|
430
447
|
errored = true;
|
431
448
|
}
|
@@ -438,7 +455,7 @@ test("should still cleanup childViews after removed from DOM", function() {
|
|
438
455
|
content: [1, 2, 3]
|
439
456
|
});
|
440
457
|
|
441
|
-
view.createLayer();
|
458
|
+
SC.run(function() { view.createLayer(); });
|
442
459
|
equals(view.get('childViews').length, 3, "precond - creates three child views");
|
443
460
|
|
444
461
|
view.destroyLayer();
|
@@ -174,8 +174,15 @@ SC._BindableSpan = SC.TemplateView.extend(
|
|
174
174
|
elem = context.element();
|
175
175
|
this.$().replaceWith(elem);
|
176
176
|
this.set('layer', elem);
|
177
|
-
|
178
|
-
this.
|
177
|
+
|
178
|
+
this._sc_addRenderedStateObservers();
|
179
|
+
this._callOnChildViews('_sc_addRenderedStateObservers');
|
180
|
+
|
181
|
+
// Notify for each child (that changed state) in reverse so that each child is in the proper
|
182
|
+
// state before its parent potentially alters its state. For example, a parent could modify
|
183
|
+
// children in `didCreateLayer`.
|
184
|
+
this._callOnChildViews('_notifyDidRender', false);
|
185
|
+
this._notifyDidRender();
|
179
186
|
}
|
180
187
|
});
|
181
188
|
|
data/sproutcore.gemspec
CHANGED
@@ -7,7 +7,7 @@ is_jruby = (os == "java")
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'sproutcore'
|
9
9
|
s.version = SproutCore::VERSION
|
10
|
-
s.authors = '
|
10
|
+
s.authors = '7x7 Software, Inc., Apple Inc. and contributors'
|
11
11
|
s.email = 'community@sproutcore.com'
|
12
12
|
s.license = 'MIT'
|
13
13
|
s.homepage = 'http://www.sproutcore.com'
|
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_dependency 'erubis', "~> 2.6"
|
22
22
|
s.add_dependency 'thor', '~> 0.18'
|
23
23
|
s.add_dependency 'sass', '~> 3.1'
|
24
|
-
s.add_dependency 'haml', '~>
|
24
|
+
s.add_dependency 'haml', '~> 4.0'
|
25
25
|
|
26
|
-
s.add_dependency 'compass', '~> 0
|
26
|
+
s.add_dependency 'compass', '~> 1.0'
|
27
27
|
s.add_dependency 'chunky_png', '~> 1.2'
|
28
28
|
|
29
29
|
s.add_dependency 'eventmachine', '~> 1.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sproutcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.0.
|
4
|
+
version: 1.11.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- 7x7 Software, Inc., Apple Inc. and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -100,28 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '4.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '4.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: compass
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0
|
117
|
+
version: '1.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0
|
124
|
+
version: '1.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: chunky_png
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1139,8 +1139,7 @@ files:
|
|
1139
1139
|
- lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js
|
1140
1140
|
- lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js
|
1141
1141
|
- lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js
|
1142
|
-
- lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/
|
1143
|
-
- lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js
|
1142
|
+
- lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/stack_layout.js
|
1144
1143
|
- lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js
|
1145
1144
|
- lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js
|
1146
1145
|
- lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js
|
@@ -1164,7 +1163,8 @@ files:
|
|
1164
1163
|
- lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js
|
1165
1164
|
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js
|
1166
1165
|
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js
|
1167
|
-
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/
|
1166
|
+
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/responder_protocol.js
|
1167
|
+
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/sparse_array_delegate_protocol.js
|
1168
1168
|
- lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js
|
1169
1169
|
- lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js
|
1170
1170
|
- lib/frameworks/sproutcore/frameworks/core_foundation/system/bezier_curves.js
|
@@ -1268,8 +1268,6 @@ files:
|
|
1268
1268
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/attribute_bindings_test.js
|
1269
1269
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/background_color.js
|
1270
1270
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js
|
1271
|
-
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js
|
1272
|
-
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js
|
1273
1271
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/childViewLayout_test.js
|
1274
1272
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js
|
1275
1273
|
- lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js
|
@@ -1416,6 +1414,7 @@ files:
|
|
1416
1414
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
|
1417
1415
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js
|
1418
1416
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js
|
1417
|
+
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/conflictedStoreKeys_test.js
|
1419
1418
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js
|
1420
1419
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js
|
1421
1420
|
- lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js
|
@@ -1507,10 +1506,9 @@ files:
|
|
1507
1506
|
- lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js
|
1508
1507
|
- lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js
|
1509
1508
|
- lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js
|
1510
|
-
- lib/frameworks/sproutcore/frameworks/desktop/protocols/
|
1511
|
-
- lib/frameworks/sproutcore/frameworks/desktop/protocols/
|
1512
|
-
- lib/frameworks/sproutcore/frameworks/desktop/protocols/
|
1513
|
-
- lib/frameworks/sproutcore/frameworks/desktop/protocols/responder.js
|
1509
|
+
- lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source_protocol.js
|
1510
|
+
- lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source_protocol.js
|
1511
|
+
- lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target_protocol.js
|
1514
1512
|
- lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js
|
1515
1513
|
- lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js
|
1516
1514
|
- lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js
|
@@ -1683,7 +1681,7 @@ files:
|
|
1683
1681
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js
|
1684
1682
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js
|
1685
1683
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/children.js
|
1686
|
-
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/
|
1684
|
+
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/dividers_test.js
|
1687
1685
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js
|
1688
1686
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/split_child.js
|
1689
1687
|
- lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/split_thumb.js
|
@@ -1932,8 +1930,10 @@ files:
|
|
1932
1930
|
- lib/frameworks/sproutcore/frameworks/media/render_delegates/media_slider.js
|
1933
1931
|
- lib/frameworks/sproutcore/frameworks/media/resources/controls.png
|
1934
1932
|
- lib/frameworks/sproutcore/frameworks/media/resources/playeras3.fla
|
1933
|
+
- lib/frameworks/sproutcore/frameworks/media/resources/silence.mp3
|
1935
1934
|
- lib/frameworks/sproutcore/frameworks/media/resources/video.css
|
1936
1935
|
- lib/frameworks/sproutcore/frameworks/media/resources/videoCanvas.swf
|
1936
|
+
- lib/frameworks/sproutcore/frameworks/media/tests/audio.js
|
1937
1937
|
- lib/frameworks/sproutcore/frameworks/media/tests/media_capabilities.js
|
1938
1938
|
- lib/frameworks/sproutcore/frameworks/media/views/audio.js
|
1939
1939
|
- lib/frameworks/sproutcore/frameworks/media/views/controls.js
|
@@ -1986,6 +1986,7 @@ files:
|
|
1986
1986
|
- lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js
|
1987
1987
|
- lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js
|
1988
1988
|
- lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js
|
1989
|
+
- lib/frameworks/sproutcore/frameworks/runtime/protocols/mixin_protocol.js
|
1989
1990
|
- lib/frameworks/sproutcore/frameworks/runtime/README
|
1990
1991
|
- lib/frameworks/sproutcore/frameworks/runtime/system/binding.js
|
1991
1992
|
- lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js
|
@@ -2302,6 +2303,7 @@ files:
|
|
2302
2303
|
- lib/frameworks/sproutcore/themes/ace/resources/radio/radio_selected.png
|
2303
2304
|
- lib/frameworks/sproutcore/themes/ace/resources/radio/radio_selected_active.png
|
2304
2305
|
- lib/frameworks/sproutcore/themes/ace/resources/radio/radio_unselected.png
|
2306
|
+
- lib/frameworks/sproutcore/themes/ace/resources/scroll/scroll.css
|
2305
2307
|
- lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css
|
2306
2308
|
- lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_overlay.css
|
2307
2309
|
- lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/thumb.png
|
@@ -1,465 +0,0 @@
|
|
1
|
-
// ==========================================================================
|
2
|
-
// Project: SproutCore
|
3
|
-
// Copyright: @2013 7x7 Software, Inc.
|
4
|
-
// License: Licensed under MIT license (see license.js)
|
5
|
-
// ==========================================================================
|
6
|
-
sc_require('views/view');
|
7
|
-
|
8
|
-
|
9
|
-
SC.mixin(SC.View,
|
10
|
-
/** @scope SC.View */ {
|
11
|
-
|
12
|
-
/**
|
13
|
-
This child layout plugin automatically positions the view's child views in a
|
14
|
-
horizontal stack and optionally adjusts the view's width to fit. It does this
|
15
|
-
by checking the width of each child view and positioning the following child
|
16
|
-
views accordingly. Afterwards, by default, any time that a child view's
|
17
|
-
width or visibility changes, the view will use this plugin to re-adjust all
|
18
|
-
following child views' positions and potentially its own width appropriately.
|
19
|
-
|
20
|
-
This allows you to stack absolutely positioned views that dynamically change
|
21
|
-
their width and/or visibility without having to resort to using browser
|
22
|
-
flow layout.
|
23
|
-
|
24
|
-
For example,
|
25
|
-
|
26
|
-
MyApp.MyView = SC.View.extend({
|
27
|
-
|
28
|
-
// Child views will be stacked in order horizontally.
|
29
|
-
childViewLayout: SC.View.HORIZONTAL_STACK,
|
30
|
-
|
31
|
-
// The order of child views is important!
|
32
|
-
childViews: ['sectionA', 'sectionB', 'sectionC'],
|
33
|
-
|
34
|
-
// The view will resize itself to fit its children.
|
35
|
-
// i.e. We don't need to specify layout.width, this is automatic.
|
36
|
-
// The actual layout will become { left: 10, bottom: 20, top: 20, width: 270 } initially.
|
37
|
-
layout: { left: 10, bottom: 20, top: 20 },
|
38
|
-
|
39
|
-
sectionA: SC.View.design({
|
40
|
-
|
41
|
-
// We don't need to specify layout.left, this is automatic.
|
42
|
-
// The actual layout will become { left: 0, bottom: 0, top: 0, width: 100 } initially.
|
43
|
-
layout: { width: 100 }
|
44
|
-
|
45
|
-
}),
|
46
|
-
|
47
|
-
sectionB: SC.View.design({
|
48
|
-
|
49
|
-
// We don't need to specify layout.left, this is automatic.
|
50
|
-
// The actual layout will become { border: 1, left: 100, bottom: 0, top: 0, width: 50 } initially.
|
51
|
-
layout: { border: 1, width: 50 }
|
52
|
-
|
53
|
-
}),
|
54
|
-
|
55
|
-
sectionC: SC.View.design({
|
56
|
-
|
57
|
-
// We don't need to specify layout.left, this is automatic.
|
58
|
-
// The actual layout will become { left: 150, bottom: 10, top: 10, width: 120 } initially.
|
59
|
-
layout: { right: 10, top: 10, width: 120 }
|
60
|
-
|
61
|
-
})
|
62
|
-
|
63
|
-
});
|
64
|
-
|
65
|
-
## Modify the default behavior with `childViewLayoutOptions`
|
66
|
-
|
67
|
-
To modify the plugin behavior for all child view layouts, you can set the
|
68
|
-
following child view layout options in `childViewLayoutOptions` on the view:
|
69
|
-
|
70
|
-
- paddingBefore - Adds padding before the first child view. Default: 0
|
71
|
-
- paddingAfter - Adds padding after the last child view. Default: 0
|
72
|
-
- spacing - Adds spacing between each child view. Default: 0
|
73
|
-
- resizeToFit - Whether to resize the view to fit the child views (requires that each child view has a layout width). Default: true
|
74
|
-
|
75
|
-
For example,
|
76
|
-
|
77
|
-
MyApp.MyView = SC.View.extend({
|
78
|
-
|
79
|
-
// Child views will be stacked in order horizontally.
|
80
|
-
childViewLayout: SC.View.HORIZONTAL_STACK,
|
81
|
-
|
82
|
-
// Change the behavior of the HORIZONTAL_STACK plugin
|
83
|
-
childViewLayoutOptions: {
|
84
|
-
paddingBefore: 10,
|
85
|
-
paddingAfter: 20,
|
86
|
-
spacing: 5
|
87
|
-
},
|
88
|
-
|
89
|
-
// The order of child views is important!
|
90
|
-
childViews: ['sectionA', 'sectionB', 'sectionC'],
|
91
|
-
|
92
|
-
// The view will resize itself to fit its children. The actual layout will become { left: 10, bottom: 20, top: 20, width: 310 }
|
93
|
-
layout: { left: 10, bottom: 20, top: 20 }, // Don't need to specify layout.width, this is automatic.
|
94
|
-
|
95
|
-
sectionA: SC.View.design({
|
96
|
-
|
97
|
-
// Actual layout will become { left: 10, bottom: 0, top: 0, width: 100 }
|
98
|
-
layout: { width: 100 } // Don't need to specify layout.left, this is automatic.
|
99
|
-
|
100
|
-
}),
|
101
|
-
|
102
|
-
sectionB: SC.View.design({
|
103
|
-
|
104
|
-
// Actual layout will become { border: 1, left: 115, bottom: 0, top: 0, width: 50 }
|
105
|
-
layout: { border: 1, width: 50 } // Don't need to specify layout.left, this is automatic.
|
106
|
-
|
107
|
-
}),
|
108
|
-
|
109
|
-
sectionC: SC.View.design({
|
110
|
-
|
111
|
-
// Actual layout will become { left: 170, top: 10, bottom: 10, width: 120 }
|
112
|
-
layout: { top: 10, bottom: 10, width: 120 } // Don't need to specify layout.left, this is automatic.
|
113
|
-
|
114
|
-
})
|
115
|
-
|
116
|
-
});
|
117
|
-
|
118
|
-
If `resizeToFit` is set to `false`, the view will not adjust itself to fit
|
119
|
-
its child views. This means that when `resizeToFit` is false, the view should
|
120
|
-
specify its width component in its layout. A direct effect of this is the
|
121
|
-
possibility for the child views to automatically expand or shrink in order to
|
122
|
-
fill the empty, unclaimed space of the view.
|
123
|
-
|
124
|
-
This available space is shared between all children that don't specify a fixed width
|
125
|
-
such that their final width is calculated proportionally to the value of the
|
126
|
-
property `fillRatio`.
|
127
|
-
|
128
|
-
For simplicity, when none of the children specifies `fillRatio`,
|
129
|
-
you can ignore the last child view's layout width and the last child view
|
130
|
-
will stretch to fill the parent view.
|
131
|
-
|
132
|
-
For example,
|
133
|
-
|
134
|
-
MyApp.MyView = SC.View.extend({
|
135
|
-
|
136
|
-
// Child views will be stacked in order horizontally.
|
137
|
-
childViewLayout: SC.View.HORIZONTAL_STACK,
|
138
|
-
|
139
|
-
// Change the behavior of the HORIZONTAL_STACK plugin
|
140
|
-
childViewLayoutOptions: {
|
141
|
-
paddingBefore: 10,
|
142
|
-
paddingAfter: 20,
|
143
|
-
spacing: 5,
|
144
|
-
resizeToFit: false // Setting this to false, so that the child views stretch/contract to fit the parent's size.
|
145
|
-
},
|
146
|
-
|
147
|
-
// The order of child views is important!
|
148
|
-
childViews: ['sectionA', 'sectionB', 'sectionC'],
|
149
|
-
|
150
|
-
// The parent view will not resize itself to fit its contents, so we specify the width.
|
151
|
-
layout: { left: 10, bottom: 20, top: 20, width: 500 },
|
152
|
-
|
153
|
-
sectionA: SC.View.design({
|
154
|
-
|
155
|
-
// We don't need to specify layout.left, this is automatic. This child will not stretch, its width is set.
|
156
|
-
// Actual layout will become { left: 10, bottom: 0, top: 0, width: 100 }
|
157
|
-
layout: { width: 100 }
|
158
|
-
|
159
|
-
}),
|
160
|
-
|
161
|
-
sectionB: SC.View.design({
|
162
|
-
|
163
|
-
// The unclaimed space so far is 500 - 10 - 100 - 5 - 5 - 20, or 360px. This space will be shared between
|
164
|
-
// the two last sections, because we won't specity a width on them.
|
165
|
-
// This view will get 1/3 of the available space, because the other flexibile view has a ratio of 2.
|
166
|
-
fillRatio: 1,
|
167
|
-
|
168
|
-
// This section will take 1/3 * 360px = 120px.
|
169
|
-
// Actual layout will become { border: 1, left: 115, bottom: 0, top: 0, right: 265 }, in other words, width == 120
|
170
|
-
// We don't need to specify layout.left, layout.right or layout.width, this is automatic.
|
171
|
-
layout: { border: 1 }
|
172
|
-
|
173
|
-
}),
|
174
|
-
|
175
|
-
sectionC: SC.View.design({
|
176
|
-
|
177
|
-
// This view will get 2/3 of the available space, because the other flexibile view has a ratio of 1.
|
178
|
-
fillRatio: 2,
|
179
|
-
|
180
|
-
// This section will take 2/3 * 360px = 240px.
|
181
|
-
// Actual layout will become { left: 240, top: 10, bottom: 10, right: 20 }, in other words, width == 240
|
182
|
-
// We don't need to specify layout.left, layout.right or layout.width, this is automatic.
|
183
|
-
layout: { top: 10, bottom: 10 }
|
184
|
-
|
185
|
-
})
|
186
|
-
|
187
|
-
});
|
188
|
-
|
189
|
-
## Modify specific child view layouts
|
190
|
-
|
191
|
-
To adjust the child layout on a granular level per child view, you can
|
192
|
-
also set the following properties on each child view:
|
193
|
-
|
194
|
-
- marginBefore - Specify the minimum spacing above the child view.
|
195
|
-
- marginAfter - Specify the minimum spacing below the child view.
|
196
|
-
- useAbsoluteLayout - Don't include this child view in automatic layout, use absolute positioning based on the child view's `layout` property.
|
197
|
-
- useStaticLayout - Don't include this child view in automatic layout. This child view uses relative positioning and is not eligible for automatic layout.
|
198
|
-
- isVisible - Non-visible child views are not included in the stack.
|
199
|
-
- fillRatio - When the parent view is configured with a fixed dimension, children not specifying a width but specifying fillRatio will be resized to fill the unclaimed space proportionally to this ratio.
|
200
|
-
|
201
|
-
For example,
|
202
|
-
|
203
|
-
MyApp.MyView = SC.View.extend({
|
204
|
-
|
205
|
-
// Child views will be stacked in order horizontally.
|
206
|
-
childViewLayout: SC.View.HORIZONTAL_STACK,
|
207
|
-
|
208
|
-
// Actual layout will become { left: 10, right: 10, top: 20, width: 570 }
|
209
|
-
layout: { left: 10, right: 10, top: 20 },
|
210
|
-
|
211
|
-
// Keep the child views ordered!
|
212
|
-
childViews: ['sectionA', 'float', 'sectionB', 'sectionC'],
|
213
|
-
|
214
|
-
sectionA: SC.View.design({
|
215
|
-
// Actual layout will become { left: 0, right: 50, top: 0, width: 100 }
|
216
|
-
layout: { right: 50, width: 100 },
|
217
|
-
// The following child view will be at least 50px further right.
|
218
|
-
marginAfter: 50
|
219
|
-
}),
|
220
|
-
|
221
|
-
float: SC.View.design({
|
222
|
-
// This view will not be included in automatic layout and will not effect the stack.
|
223
|
-
layout: { top: 5, right: 5, height: 50, width: 50 },
|
224
|
-
useAbsoluteLayout: true
|
225
|
-
}),
|
226
|
-
|
227
|
-
sectionB: SC.View.design({
|
228
|
-
// Actual layout will become { left: 1500, right: 0, top: 0, width: 120 }
|
229
|
-
layout: { width: 120 }
|
230
|
-
}),
|
231
|
-
|
232
|
-
sectionC: SC.View.design({
|
233
|
-
// Actual layout will become { left: 470, bottom: 0, top: 0, width: 100 }
|
234
|
-
layout: { width: 100 },
|
235
|
-
// This child view will be at least 200px to the right of the previous.
|
236
|
-
marginBefore: 200
|
237
|
-
})
|
238
|
-
|
239
|
-
});
|
240
|
-
|
241
|
-
### A Note About Spacing
|
242
|
-
|
243
|
-
Note that the spacing attribute in `childViewLayoutOptions` becomes the
|
244
|
-
_minimum margin between child views, without explicitly overriding it from
|
245
|
-
both sides using `marginAfter` and `marginBefore`_. For example, if `spacing`
|
246
|
-
is 25, setting `marginAfter` to 10 on a child view will not result in the
|
247
|
-
next child view being 10px to the right of it, unless the next child view also
|
248
|
-
specified `marginBefore` as 10.
|
249
|
-
|
250
|
-
What this means is that it takes less configuration if you set `spacing` to
|
251
|
-
be the _smallest margin you wish to exist between child views_ and then use
|
252
|
-
the overrides to grow the margin if necessary. For example, if `spacing`
|
253
|
-
is 5, setting `marginAfter` to 10 on a child view will result in the next
|
254
|
-
child view being 10px to the right of it, without having to also specify
|
255
|
-
`marginBefore` on that next child view.
|
256
|
-
|
257
|
-
@extends SC.ChildViewLayoutProtocol
|
258
|
-
@since Version 1.10
|
259
|
-
*/
|
260
|
-
HORIZONTAL_STACK: {
|
261
|
-
|
262
|
-
/** @private Properties to observe on child views that affect the overall child view layout. */
|
263
|
-
childLayoutProperties: ['marginBefore', 'marginAfter', 'isVisible'],
|
264
|
-
|
265
|
-
/** @private When resizeToFit is false, then we need to know when the view's frame changes. */
|
266
|
-
layoutDependsOnSize: function (view) {
|
267
|
-
var options = view.get('childViewLayoutOptions');
|
268
|
-
|
269
|
-
if (options) {
|
270
|
-
return SC.none(options.resizeToFit) ? false : !options.resizeToFit;
|
271
|
-
} else {
|
272
|
-
return false;
|
273
|
-
}
|
274
|
-
},
|
275
|
-
|
276
|
-
/** @private */
|
277
|
-
layoutChildViews: function (view) {
|
278
|
-
var childViews = view.get('childViews'),
|
279
|
-
options = view.get('childViewLayoutOptions') || {},
|
280
|
-
resizeToFit = SC.none(options.resizeToFit) ? true : options.resizeToFit,
|
281
|
-
lastMargin = 0, // Used to avoid adding spacing to the final margin.
|
282
|
-
marginAfter = options.paddingBefore || 0,
|
283
|
-
paddingAfter = options.paddingAfter || 0,
|
284
|
-
leftPosition = 0,
|
285
|
-
provisionedSpace = 0,
|
286
|
-
autoFillAvailableSpace = 0,
|
287
|
-
totalAvailableSpace = 0,
|
288
|
-
totalFillAvailableSpaceRatio = 0,
|
289
|
-
spacing = options.spacing || 0,
|
290
|
-
childView,
|
291
|
-
fillRatio,
|
292
|
-
layout,
|
293
|
-
marginBefore,
|
294
|
-
i, len;
|
295
|
-
|
296
|
-
// if the view is not configured to resize to fit content, then we give a chance to the children to fill the available space
|
297
|
-
// we make a 1st pass to check the conditions, to evaluate the available space and the proportions between children
|
298
|
-
if (!resizeToFit) {
|
299
|
-
|
300
|
-
totalAvailableSpace = view.get('frame').width;
|
301
|
-
|
302
|
-
// if the view is not configured to resize and it doesn't have yet a width, it doesn't make sense to layout children
|
303
|
-
if (!totalAvailableSpace) {
|
304
|
-
return;
|
305
|
-
}
|
306
|
-
|
307
|
-
for (i = 0, len = childViews.get('length'); i < len; i++) {
|
308
|
-
childView = childViews.objectAt(i);
|
309
|
-
|
310
|
-
// Ignore child views with useAbsoluteLayout true, useStaticLayout true or that are not visible.
|
311
|
-
if (!childView.get('isVisible') ||
|
312
|
-
childView.get('useAbsoluteLayout') ||
|
313
|
-
childView.get('useStaticLayout')) {
|
314
|
-
continue;
|
315
|
-
}
|
316
|
-
|
317
|
-
layout = childView.get('layout');
|
318
|
-
|
319
|
-
// Determine the left margin.
|
320
|
-
marginBefore = childView.get('marginBefore') || 0;
|
321
|
-
provisionedSpace += Math.max(marginAfter, marginBefore);
|
322
|
-
|
323
|
-
// if the width is not set, let's check if is possible to resize the view
|
324
|
-
if (SC.none(layout.width)) {
|
325
|
-
fillRatio = childView.get('fillRatio');
|
326
|
-
|
327
|
-
if (!SC.none(fillRatio)) {
|
328
|
-
totalFillAvailableSpaceRatio += fillRatio;
|
329
|
-
} else {
|
330
|
-
// if none of the child views has fillRatio defined, allow the last one to stretch and fill the available space.
|
331
|
-
if (i == len - 1 && totalFillAvailableSpaceRatio === 0) {
|
332
|
-
totalFillAvailableSpaceRatio = 1;
|
333
|
-
}
|
334
|
-
//@if(debug)
|
335
|
-
// Add some developer support.
|
336
|
-
else {
|
337
|
-
// even if we don't have a width set, as last instance we accept the presence of minWidth
|
338
|
-
if (SC.none(layout.minWidth))
|
339
|
-
{
|
340
|
-
SC.warn('Developer Warning: The SC.View.HORIZONTAL_STACK plugin requires that each childView layout contains at least a width or has a configured fillRatio. The layout may also optionally contain top and bottom, top and height, bottom and height or centerY and height. The childView %@ has an invalid layout/fillRatio: %@'.fmt(childView, SC.stringFromLayout(layout)));
|
341
|
-
return;
|
342
|
-
}
|
343
|
-
}
|
344
|
-
//@endif
|
345
|
-
}
|
346
|
-
} else {
|
347
|
-
provisionedSpace += childView.getPath('borderFrame.width');
|
348
|
-
}
|
349
|
-
|
350
|
-
// Determine the right margin.
|
351
|
-
lastMargin = childView.get('marginAfter') || 0;
|
352
|
-
marginAfter = lastMargin || spacing;
|
353
|
-
}
|
354
|
-
|
355
|
-
// consider the end padding when calculating the provisionedSpace
|
356
|
-
if (provisionedSpace !== 0 || totalFillAvailableSpaceRatio !== 0) {
|
357
|
-
provisionedSpace += Math.max(lastMargin, paddingAfter);
|
358
|
-
}
|
359
|
-
|
360
|
-
autoFillAvailableSpace = Math.max(0, totalAvailableSpace - provisionedSpace);
|
361
|
-
}
|
362
|
-
|
363
|
-
// reset the references for the effective layout
|
364
|
-
lastMargin = 0;
|
365
|
-
marginAfter = options.paddingBefore || 0;
|
366
|
-
paddingAfter = options.paddingAfter || 0;
|
367
|
-
|
368
|
-
for (i = 0, len = childViews.get('length'); i < len; i++) {
|
369
|
-
var width,
|
370
|
-
adjustLeft,
|
371
|
-
adjustRight;
|
372
|
-
|
373
|
-
childView = childViews.objectAt(i);
|
374
|
-
|
375
|
-
// Ignore child views with useAbsoluteLayout true, useStaticLayout true or that are not visible.
|
376
|
-
if (!childView.get('isVisible') ||
|
377
|
-
childView.get('useAbsoluteLayout') ||
|
378
|
-
childView.get('useStaticLayout')) {
|
379
|
-
continue;
|
380
|
-
}
|
381
|
-
|
382
|
-
layout = childView.get('layout');
|
383
|
-
|
384
|
-
//@if(debug)
|
385
|
-
// Add some developer support. The case of !resizeToFit was already checked above
|
386
|
-
if (resizeToFit && SC.none(layout.width) && SC.none(layout.minWidth)) {
|
387
|
-
SC.warn('Developer Warning: The SC.View.HORIZONTAL_STACK plugin, when configured with resizeToFit, requires that each childView layout contains at least a width/minWidth and optionally also top and bottom, top and height, bottom and height or centerY and height. The childView %@ has an invalid layout: %@'.fmt(childView, SC.stringFromLayout(layout)));
|
388
|
-
return;
|
389
|
-
}
|
390
|
-
//@endif
|
391
|
-
|
392
|
-
// Determine the left margin.
|
393
|
-
marginBefore = childView.get('marginBefore') || 0;
|
394
|
-
leftPosition += Math.max(marginAfter, marginBefore);
|
395
|
-
|
396
|
-
// Try to avoid useless adjustments left or right or left then right.
|
397
|
-
// The required adjustments will be merged into a single call
|
398
|
-
adjustLeft = layout.left !== leftPosition;
|
399
|
-
|
400
|
-
childView.beginPropertyChanges();
|
401
|
-
if (!resizeToFit && !layout.width) {
|
402
|
-
var rightPosition;
|
403
|
-
|
404
|
-
fillRatio = childView.get('fillRatio');
|
405
|
-
|
406
|
-
// if the last child doesn't define fillRatio, default it to 1 as above during the 1st pass
|
407
|
-
if (i == len - 1 && SC.none(fillRatio)) {
|
408
|
-
fillRatio = 1;
|
409
|
-
}
|
410
|
-
|
411
|
-
// we should get here only in two cases: 1. child defines fillRatio, 2. child defines a minWidth
|
412
|
-
// if both defined, we prefer to handle fillRatio, the other case being handled below by the normal adjustment to left
|
413
|
-
if (!SC.none(fillRatio)) {
|
414
|
-
var currentAvailableSpaceRatio = (fillRatio / totalFillAvailableSpaceRatio);
|
415
|
-
|
416
|
-
// calculate the width according to fillRatio and totalFillAvailableSpaceRatio
|
417
|
-
// but set the "right" position so any subsequent layout is not considering the width as fixed
|
418
|
-
width = Math.ceil(autoFillAvailableSpace * currentAvailableSpaceRatio);
|
419
|
-
|
420
|
-
// INCOMPLETE: We need to flag this view as constrained and re-compute all the auto-fill amounts
|
421
|
-
// Constrain the width to the maximum width allowed.
|
422
|
-
// var maxWidth = layout.maxWidth;
|
423
|
-
// if (!SC.none(maxWidth)) {
|
424
|
-
// // Constrain the width according to maxWidth. Which frees up additional available space for further child views.
|
425
|
-
// if (width > maxWidth) {
|
426
|
-
// width = maxWidth;
|
427
|
-
// }
|
428
|
-
// }
|
429
|
-
|
430
|
-
// Determine the right position. If the position overflows (i.e. goes negative) because of rounding up, stop at 0.
|
431
|
-
rightPosition = Math.max(0, totalAvailableSpace - leftPosition - width);
|
432
|
-
adjustRight = layout.right !== rightPosition;
|
433
|
-
|
434
|
-
if (adjustRight) {
|
435
|
-
childView.adjust('right', rightPosition);
|
436
|
-
}
|
437
|
-
}
|
438
|
-
}
|
439
|
-
|
440
|
-
if (adjustLeft) {
|
441
|
-
childView.adjust('left', leftPosition);
|
442
|
-
}
|
443
|
-
childView.endPropertyChanges();
|
444
|
-
|
445
|
-
leftPosition += childView.getPath('borderFrame.width');
|
446
|
-
|
447
|
-
// Determine the right margin.
|
448
|
-
lastMargin = childView.get('marginAfter') || 0;
|
449
|
-
marginAfter = lastMargin || spacing;
|
450
|
-
}
|
451
|
-
|
452
|
-
// If the current size is 0 (all children are hidden), it doesn't make sense to add the padding
|
453
|
-
if (leftPosition !== 0) {
|
454
|
-
leftPosition += Math.max(lastMargin, paddingAfter);
|
455
|
-
}
|
456
|
-
|
457
|
-
// Adjust our frame to fit as well, this ensures that scrolling works.
|
458
|
-
if (resizeToFit && view.getPath('layout.width') !== leftPosition) {
|
459
|
-
view.adjust('width', leftPosition);
|
460
|
-
}
|
461
|
-
}
|
462
|
-
|
463
|
-
}
|
464
|
-
|
465
|
-
});
|