sproutcore 1.5.0.rc.1 → 1.5.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -8,12 +8,12 @@
|
|
8
8
|
/**
|
9
9
|
@class
|
10
10
|
|
11
|
-
A ManyArray is used to map an array of record ids back to their
|
11
|
+
A `ManyArray` is used to map an array of record ids back to their
|
12
12
|
record objects which will be materialized from the owner store on demand.
|
13
13
|
|
14
|
-
Whenever you create a toMany() relationship, the value returned from the
|
15
|
-
property will be an instance of ManyArray
|
16
|
-
behavior of ManyArray by passing settings to the toMany() helper.
|
14
|
+
Whenever you create a `toMany()` relationship, the value returned from the
|
15
|
+
property will be an instance of `ManyArray`. You can generally customize the
|
16
|
+
behavior of ManyArray by passing settings to the `toMany()` helper.
|
17
17
|
|
18
18
|
@extends SC.Enumerable
|
19
19
|
@extends SC.Array
|
@@ -24,55 +24,55 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
24
24
|
/** @scope SC.ManyArray.prototype */ {
|
25
25
|
|
26
26
|
/**
|
27
|
-
recordType will tell what type to transform the record to when
|
27
|
+
`recordType` will tell what type to transform the record to when
|
28
28
|
materializing the record.
|
29
29
|
|
30
30
|
@default null
|
31
31
|
@type String
|
32
32
|
*/
|
33
33
|
recordType: null,
|
34
|
-
|
34
|
+
|
35
35
|
/**
|
36
|
-
If set, the record will be notified whenever the array changes so that
|
36
|
+
If set, the record will be notified whenever the array changes so that
|
37
37
|
it can change its own state
|
38
|
-
|
38
|
+
|
39
39
|
@default null
|
40
40
|
@type SC.Record
|
41
41
|
*/
|
42
42
|
record: null,
|
43
|
-
|
43
|
+
|
44
44
|
/**
|
45
45
|
If set will be used by the many array to get an editable version of the
|
46
46
|
storeIds from the owner.
|
47
|
-
|
47
|
+
|
48
48
|
@default null
|
49
49
|
@type String
|
50
50
|
*/
|
51
51
|
propertyName: null,
|
52
|
-
|
53
|
-
|
52
|
+
|
53
|
+
|
54
54
|
/**
|
55
|
-
The ManyAttribute that created this array.
|
55
|
+
The `ManyAttribute` that created this array.
|
56
56
|
|
57
57
|
@default null
|
58
58
|
@type SC.ManyAttribute
|
59
59
|
*/
|
60
60
|
manyAttribute: null,
|
61
|
-
|
61
|
+
|
62
62
|
/**
|
63
|
-
The store that owns this record array. All record arrays must have a
|
63
|
+
The store that owns this record array. All record arrays must have a
|
64
64
|
store to function properly.
|
65
|
-
|
65
|
+
|
66
66
|
@type SC.Store
|
67
|
-
@property
|
67
|
+
@property
|
68
68
|
*/
|
69
69
|
store: function() {
|
70
70
|
return this.get('record').get('store');
|
71
71
|
}.property('record').cacheable(),
|
72
|
-
|
72
|
+
|
73
73
|
/**
|
74
|
-
The storeKey for the parent record of this many array. Editing this
|
75
|
-
array will place the parent record into a READY_DIRTY state.
|
74
|
+
The `storeKey` for the parent record of this many array. Editing this
|
75
|
+
array will place the parent record into a `READY_DIRTY` state.
|
76
76
|
|
77
77
|
@type Number
|
78
78
|
@property
|
@@ -83,19 +83,19 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
83
83
|
|
84
84
|
|
85
85
|
/**
|
86
|
-
Returns the
|
86
|
+
Returns the `storeId`s in read-only mode. Avoids modifying the record
|
87
87
|
unnecessarily.
|
88
|
-
|
88
|
+
|
89
89
|
@type SC.Array
|
90
|
-
@property
|
90
|
+
@property
|
91
91
|
*/
|
92
92
|
readOnlyStoreIds: function() {
|
93
93
|
return this.get('record').readAttribute(this.get('propertyName'));
|
94
94
|
}.property(),
|
95
|
-
|
96
|
-
|
95
|
+
|
96
|
+
|
97
97
|
/**
|
98
|
-
Returns an editable array of
|
98
|
+
Returns an editable array of `storeId`s. Marks the owner records as
|
99
99
|
modified.
|
100
100
|
|
101
101
|
@type {SC.Array}
|
@@ -106,49 +106,49 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
106
106
|
storeKey = this.get('storeKey'),
|
107
107
|
pname = this.get('propertyName'),
|
108
108
|
ret, hash;
|
109
|
-
|
110
|
-
ret = store.readEditableProperty(storeKey, pname);
|
109
|
+
|
110
|
+
ret = store.readEditableProperty(storeKey, pname);
|
111
111
|
if (!ret) {
|
112
112
|
hash = store.readEditableDataHash(storeKey);
|
113
|
-
ret = hash[pname] = [];
|
113
|
+
ret = hash[pname] = [];
|
114
114
|
}
|
115
|
-
|
115
|
+
|
116
116
|
if (ret !== this._prevStoreIds) this.recordPropertyDidChange();
|
117
117
|
return ret ;
|
118
118
|
}.property(),
|
119
|
-
|
120
|
-
|
119
|
+
|
120
|
+
|
121
121
|
// ..........................................................
|
122
122
|
// COMPUTED FROM OWNER
|
123
|
-
//
|
124
|
-
|
123
|
+
//
|
124
|
+
|
125
125
|
/**
|
126
126
|
Computed from owner many attribute
|
127
|
-
|
127
|
+
|
128
128
|
@type Boolean
|
129
|
-
@property
|
129
|
+
@property
|
130
130
|
*/
|
131
131
|
isEditable: function() {
|
132
132
|
// NOTE: can't use get() b/c manyAttribute looks like a computed prop
|
133
133
|
var attr = this.manyAttribute;
|
134
134
|
return attr ? attr.get('isEditable') : NO;
|
135
135
|
}.property('manyAttribute').cacheable(),
|
136
|
-
|
136
|
+
|
137
137
|
/**
|
138
138
|
Computed from owner many attribute
|
139
|
-
|
139
|
+
|
140
140
|
@type String
|
141
|
-
@property
|
141
|
+
@property
|
142
142
|
*/
|
143
143
|
inverse: function() {
|
144
144
|
// NOTE: can't use get() b/c manyAttribute looks like a computed prop
|
145
145
|
var attr = this.manyAttribute;
|
146
146
|
return attr ? attr.get('inverse') : null;
|
147
147
|
}.property('manyAttribute').cacheable(),
|
148
|
-
|
148
|
+
|
149
149
|
/**
|
150
150
|
Computed from owner many attribute
|
151
|
-
|
151
|
+
|
152
152
|
@type Boolean
|
153
153
|
@property
|
154
154
|
*/
|
@@ -160,22 +160,22 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
160
160
|
|
161
161
|
/**
|
162
162
|
Computed from owner many attribute
|
163
|
-
|
163
|
+
|
164
164
|
@type Array
|
165
|
-
@property
|
165
|
+
@property
|
166
166
|
*/
|
167
167
|
orderBy: function() {
|
168
168
|
// NOTE: can't use get() b/c manyAttribute looks like a computed prop
|
169
169
|
var attr = this.manyAttribute;
|
170
170
|
return attr ? attr.get('orderBy') : null;
|
171
171
|
}.property("manyAttribute").cacheable(),
|
172
|
-
|
172
|
+
|
173
173
|
// ..........................................................
|
174
174
|
// ARRAY PRIMITIVES
|
175
|
-
//
|
175
|
+
//
|
176
176
|
|
177
177
|
/** @private
|
178
|
-
Returned length is a pass-through to the storeIds array.
|
178
|
+
Returned length is a pass-through to the `storeIds` array.
|
179
179
|
|
180
180
|
@type Number
|
181
181
|
@property
|
@@ -190,12 +190,12 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
190
190
|
records.
|
191
191
|
*/
|
192
192
|
objectAt: function(idx) {
|
193
|
-
var recs = this._records,
|
193
|
+
var recs = this._records,
|
194
194
|
storeIds = this.get('readOnlyStoreIds'),
|
195
195
|
store = this.get('store'),
|
196
196
|
recordType = this.get('recordType'),
|
197
197
|
storeKey, ret, storeId ;
|
198
|
-
|
198
|
+
|
199
199
|
if (!storeIds || !store) return undefined; // nothing to do
|
200
200
|
if (recs && (ret=recs[idx])) return ret ; // cached
|
201
201
|
|
@@ -204,14 +204,14 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
204
204
|
storeId = storeIds.objectAt(idx);
|
205
205
|
if (storeId) {
|
206
206
|
|
207
|
-
// if record is not loaded already, then ask the data source to
|
207
|
+
// if record is not loaded already, then ask the data source to
|
208
208
|
// retrieve it
|
209
209
|
storeKey = store.storeKeyFor(recordType, storeId);
|
210
|
-
|
210
|
+
|
211
211
|
if (store.readStatus(storeKey) === SC.Record.EMPTY) {
|
212
212
|
store.retrieveRecord(recordType, null, storeKey);
|
213
213
|
}
|
214
|
-
|
214
|
+
|
215
215
|
recs[idx] = ret = store.materializeRecord(storeKey);
|
216
216
|
}
|
217
217
|
return ret ;
|
@@ -219,15 +219,15 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
219
219
|
|
220
220
|
/** @private
|
221
221
|
Pass through to the underlying array. The passed in objects must be
|
222
|
-
records, which can be converted to
|
222
|
+
records, which can be converted to `storeId`s.
|
223
223
|
*/
|
224
224
|
replace: function(idx, amt, recs) {
|
225
|
-
|
225
|
+
|
226
226
|
if (!this.get('isEditable')) {
|
227
227
|
throw "%@.%@[] is not editable".fmt(this.get('record'), this.get('propertyName'));
|
228
228
|
}
|
229
|
-
|
230
|
-
var storeIds = this.get('editableStoreIds'),
|
229
|
+
|
230
|
+
var storeIds = this.get('editableStoreIds'),
|
231
231
|
len = recs ? (recs.get ? recs.get('length') : recs.length) : 0,
|
232
232
|
record = this.get('record'),
|
233
233
|
pname = this.get('propertyName'),
|
@@ -237,24 +237,24 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
237
237
|
ids = [] ;
|
238
238
|
for(i=0;i<len;i++) ids[i] = recs.objectAt(i).get('id');
|
239
239
|
|
240
|
-
// if we have an inverse - collect the list of records we are about to
|
240
|
+
// if we have an inverse - collect the list of records we are about to
|
241
241
|
// remove
|
242
242
|
inverse = this.get('inverse');
|
243
243
|
if (inverse && amt>0) {
|
244
244
|
toRemove = SC.ManyArray._toRemove;
|
245
245
|
if (toRemove) SC.ManyArray._toRemove = null; // reuse if possible
|
246
246
|
else toRemove = [];
|
247
|
-
|
247
|
+
|
248
248
|
for(i=0;i<amt;i++) toRemove[i] = this.objectAt(idx + i);
|
249
249
|
}
|
250
|
-
|
251
|
-
// pass along - if allowed, this should trigger the content observer
|
250
|
+
|
251
|
+
// pass along - if allowed, this should trigger the content observer
|
252
252
|
storeIds.replace(idx, amt, ids);
|
253
253
|
|
254
254
|
// ok, notify records that were removed then added; this way reordered
|
255
255
|
// objects are added and removed
|
256
256
|
if (inverse) {
|
257
|
-
|
257
|
+
|
258
258
|
// notive removals
|
259
259
|
for(i=0;i<amt;i++) {
|
260
260
|
inverseRecord = toRemove[i];
|
@@ -277,77 +277,77 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
277
277
|
attr.inverseDidAddRecord(inverseRecord, inverse, record, pname);
|
278
278
|
}
|
279
279
|
}
|
280
|
-
|
280
|
+
|
281
281
|
}
|
282
282
|
|
283
283
|
// only mark record dirty if there is no inverse or we are master
|
284
284
|
if (record && (!inverse || this.get('isMaster'))) {
|
285
285
|
record.recordDidChange(pname);
|
286
|
-
}
|
287
|
-
|
286
|
+
}
|
287
|
+
|
288
288
|
this.enumerableContentDidChange(idx, amt, len - amt);
|
289
|
-
|
289
|
+
|
290
290
|
return this;
|
291
291
|
},
|
292
|
-
|
292
|
+
|
293
293
|
// ..........................................................
|
294
294
|
// INVERSE SUPPORT
|
295
|
-
//
|
296
|
-
|
295
|
+
//
|
296
|
+
|
297
297
|
/**
|
298
|
-
Called by the ManyAttribute whenever a record is removed on the inverse
|
298
|
+
Called by the `ManyAttribute` whenever a record is removed on the inverse
|
299
299
|
of the relationship.
|
300
|
-
|
300
|
+
|
301
301
|
@param {SC.Record} inverseRecord the record that was removed
|
302
302
|
@returns {SC.ManyArray} receiver
|
303
303
|
*/
|
304
304
|
removeInverseRecord: function(inverseRecord) {
|
305
|
-
|
305
|
+
|
306
306
|
if (!inverseRecord) return this; // nothing to do
|
307
307
|
var id = inverseRecord.get('id'),
|
308
308
|
storeIds = this.get('editableStoreIds'),
|
309
309
|
idx = (storeIds && id) ? storeIds.indexOf(id) : -1,
|
310
310
|
record;
|
311
|
-
|
311
|
+
|
312
312
|
if (idx >= 0) {
|
313
313
|
storeIds.removeAt(idx);
|
314
314
|
if (this.get('isMaster') && (record = this.get('record'))) {
|
315
315
|
record.recordDidChange(this.get('propertyName'));
|
316
316
|
}
|
317
317
|
}
|
318
|
-
|
318
|
+
|
319
319
|
return this;
|
320
320
|
},
|
321
321
|
|
322
322
|
/**
|
323
|
-
Called by the ManyAttribute whenever a record is added on the inverse
|
323
|
+
Called by the `ManyAttribute` whenever a record is added on the inverse
|
324
324
|
of the relationship.
|
325
|
-
|
325
|
+
|
326
326
|
@param {SC.Record} inverseRecord the record this array is a part of
|
327
327
|
@returns {SC.ManyArray} receiver
|
328
328
|
*/
|
329
329
|
addInverseRecord: function(inverseRecord) {
|
330
|
-
|
330
|
+
|
331
331
|
if (!inverseRecord) return this;
|
332
332
|
var id = inverseRecord.get('id'),
|
333
333
|
storeIds = this.get('editableStoreIds'),
|
334
334
|
orderBy = this.get('orderBy'),
|
335
335
|
len = storeIds.get('length'),
|
336
336
|
idx, record;
|
337
|
-
|
337
|
+
|
338
338
|
// find idx to insert at.
|
339
339
|
if (orderBy) {
|
340
340
|
idx = this._findInsertionLocation(inverseRecord, 0, len, orderBy);
|
341
341
|
} else idx = len;
|
342
|
-
|
342
|
+
|
343
343
|
storeIds.insertAt(idx, inverseRecord.get('id'));
|
344
344
|
if (this.get('isMaster') && (record = this.get('record'))) {
|
345
345
|
record.recordDidChange(this.get('propertyName'));
|
346
346
|
}
|
347
|
-
|
347
|
+
|
348
348
|
return this;
|
349
349
|
},
|
350
|
-
|
350
|
+
|
351
351
|
/** @private
|
352
352
|
binary search to find insertion location
|
353
353
|
*/
|
@@ -370,7 +370,7 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
370
370
|
_compare: function(a, b, orderBy) {
|
371
371
|
var t = SC.typeOf(orderBy),
|
372
372
|
ret, idx, len;
|
373
|
-
|
373
|
+
|
374
374
|
if (t === SC.T_FUNCTION) ret = orderBy(a, b);
|
375
375
|
else if (t === SC.T_STRING) ret = SC.compare(a,b);
|
376
376
|
else {
|
@@ -381,30 +381,50 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
381
381
|
|
382
382
|
return ret ;
|
383
383
|
},
|
384
|
-
|
384
|
+
|
385
385
|
// ..........................................................
|
386
386
|
// INTERNAL SUPPORT
|
387
|
-
//
|
387
|
+
//
|
388
388
|
|
389
|
-
/** @private
|
390
|
-
Invoked whenever the storeIds array changes. Observes changes.
|
389
|
+
/** @private
|
390
|
+
Invoked whenever the `storeIds` array changes. Observes changes.
|
391
391
|
*/
|
392
392
|
recordPropertyDidChange: function(keys) {
|
393
|
-
|
393
|
+
|
394
394
|
if (keys && !keys.contains(this.get('propertyName'))) return this;
|
395
|
-
|
396
|
-
var storeIds = this.get('readOnlyStoreIds');
|
395
|
+
|
396
|
+
var storeIds = this.get('readOnlyStoreIds'), oldLen, newLen;
|
397
397
|
var prev = this._prevStoreIds, f = this._storeIdsContentDidChange;
|
398
398
|
|
399
399
|
if (storeIds === prev) return this; // nothing to do
|
400
400
|
|
401
|
-
if (prev)
|
402
|
-
|
403
|
-
|
401
|
+
if (prev) {
|
402
|
+
prev.removeArrayObservers({
|
403
|
+
target: this,
|
404
|
+
willChange: this.arrayContentWillChange,
|
405
|
+
didChange: f
|
406
|
+
});
|
404
407
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
+
oldLen = prev.get('length');
|
409
|
+
} else {
|
410
|
+
oldLen = 0;
|
411
|
+
}
|
412
|
+
|
413
|
+
if (storeIds) {
|
414
|
+
storeIds.addArrayObservers({
|
415
|
+
target: this,
|
416
|
+
willChange: this.arrayContentWillChange,
|
417
|
+
didChange: f
|
418
|
+
});
|
419
|
+
|
420
|
+
newLen = storeIds.get('length');
|
421
|
+
} else {
|
422
|
+
newLen = 0;
|
423
|
+
}
|
424
|
+
|
425
|
+
this.arrayContentWillChange(0, oldLen, newLen);
|
426
|
+
this._prevStoreIds = storeIds;
|
427
|
+
this._storeIdsContentDidChange(0, oldLen, newLen);
|
408
428
|
},
|
409
429
|
|
410
430
|
/** @private
|
@@ -412,11 +432,11 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
412
432
|
dump any cached record lookup and then notify that the enumerable content
|
413
433
|
has changed.
|
414
434
|
*/
|
415
|
-
_storeIdsContentDidChange: function(
|
435
|
+
_storeIdsContentDidChange: function(start, removedCount, addedCount) {
|
416
436
|
this._records = null ; // clear cache
|
417
|
-
this.
|
437
|
+
this.arrayContentDidChange(start, removedCount, addedCount);
|
418
438
|
},
|
419
|
-
|
439
|
+
|
420
440
|
/** @private */
|
421
441
|
unknownProperty: function(key, value) {
|
422
442
|
var ret;
|
@@ -429,5 +449,5 @@ SC.ManyArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
429
449
|
sc_super();
|
430
450
|
this.recordPropertyDidChange();
|
431
451
|
}
|
432
|
-
|
452
|
+
|
433
453
|
}) ;
|
@@ -11,13 +11,13 @@ sc_require('system/store');
|
|
11
11
|
@class
|
12
12
|
|
13
13
|
A nested store can buffer changes to a parent store and then commit them
|
14
|
-
all at once. You usually will use a NestedStore as part of store chaining
|
14
|
+
all at once. You usually will use a `NestedStore` as part of store chaining
|
15
15
|
to stage changes to your object graph before sharing them with the rest of
|
16
16
|
the application.
|
17
17
|
|
18
18
|
Normally you will not create a nested store directly. Instead, you can
|
19
|
-
retrieve a nested store by using the chain() method. When you are finished
|
20
|
-
working with the nested store, destroy() will dispose of it.
|
19
|
+
retrieve a nested store by using the `chain()` method. When you are finished
|
20
|
+
working with the nested store, `destroy()` will dispose of it.
|
21
21
|
|
22
22
|
@extends SC.Store
|
23
23
|
@since SproutCore 1.0
|
@@ -37,7 +37,7 @@ SC.NestedStore = SC.Store.extend(
|
|
37
37
|
/**
|
38
38
|
The parent store this nested store is chained to. Nested stores must have
|
39
39
|
a parent store in order to function properly. Normally, you create a
|
40
|
-
nested store using the SC.Store#chain() method and this property will be
|
40
|
+
nested store using the `SC.Store#chain()` method and this property will be
|
41
41
|
set for you.
|
42
42
|
|
43
43
|
@type SC.Store
|
@@ -46,7 +46,7 @@ SC.NestedStore = SC.Store.extend(
|
|
46
46
|
parentStore: null,
|
47
47
|
|
48
48
|
/**
|
49
|
-
YES if the view is nested. Walk like a duck
|
49
|
+
`YES` if the view is nested. Walk like a duck
|
50
50
|
|
51
51
|
@type Boolean
|
52
52
|
@default YES
|
@@ -59,7 +59,7 @@ SC.NestedStore = SC.Store.extend(
|
|
59
59
|
then change the record in the parent store, the changes will not be
|
60
60
|
visible to your nested store until you commit or discard changes.
|
61
61
|
|
62
|
-
If NO
|
62
|
+
If `NO`, then the attribute hash will lock only when you write data.
|
63
63
|
|
64
64
|
Normally you want to lock your attribute hash the first time you read it.
|
65
65
|
This will make your nested store behave most consistently. However, if
|
@@ -109,8 +109,8 @@ SC.NestedStore = SC.Store.extend(
|
|
109
109
|
//
|
110
110
|
|
111
111
|
/**
|
112
|
-
find() cannot accept REMOTE queries in a nested store. This override will
|
113
|
-
verify that condition for you. See SC.Store#find() for info on using this
|
112
|
+
`find()` cannot accept REMOTE queries in a nested store. This override will
|
113
|
+
verify that condition for you. See `SC.Store#find()` for info on using this
|
114
114
|
method.
|
115
115
|
|
116
116
|
@param {SC.Query} query query object to use.
|
@@ -223,7 +223,7 @@ SC.NestedStore = SC.Store.extend(
|
|
223
223
|
},
|
224
224
|
|
225
225
|
/**
|
226
|
-
Returns the SC.Error object associated with a specific record.
|
226
|
+
Returns the `SC.Error` object associated with a specific record.
|
227
227
|
|
228
228
|
Delegates the call to the parent store.
|
229
229
|
|
@@ -237,7 +237,7 @@ SC.NestedStore = SC.Store.extend(
|
|
237
237
|
},
|
238
238
|
|
239
239
|
/**
|
240
|
-
Returns the SC.Error object associated with a specific query.
|
240
|
+
Returns the `SC.Error` object associated with a specific query.
|
241
241
|
|
242
242
|
Delegates the call to the parent store.
|
243
243
|
|
@@ -258,8 +258,8 @@ SC.NestedStore = SC.Store.extend(
|
|
258
258
|
// to use these methods.
|
259
259
|
|
260
260
|
/**
|
261
|
-
Returns the current edit status of a storekey. May be one of INHERITED
|
262
|
-
EDITABLE
|
261
|
+
Returns the current edit status of a storekey. May be one of `INHERITED`,
|
262
|
+
`EDITABLE`, and `LOCKED`. Used mostly for unit testing.
|
263
263
|
|
264
264
|
@param {Number} storeKey the store key
|
265
265
|
@returns {Number} edit status
|
@@ -399,7 +399,7 @@ SC.NestedStore = SC.Store.extend(
|
|
399
399
|
return sc_super();
|
400
400
|
},
|
401
401
|
|
402
|
-
/** @private -
|
402
|
+
/** @private - bookkeeping for a single data hash. */
|
403
403
|
dataHashDidChange: function(storeKeys, rev, statusOnly, key) {
|
404
404
|
// update the revision for storeKey. Use generateStoreKey() because that
|
405
405
|
// gaurantees a universally (to this store hierarchy anyway) unique
|