sproutcore 1.10.0.rc.2 → 1.10.0.rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/CHANGELOG.md +14 -0
  4. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -1
  5. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -0
  6. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +14 -0
  7. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +103 -0
  8. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +4 -4
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -1
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +5 -5
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +17 -6
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +62 -8
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +14 -2
  14. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +26 -5
  15. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/many_array.js +9 -1
  16. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +6 -2
  17. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/split_child.js +1 -1
  18. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +0 -2
  19. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/render.js +56 -54
  20. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +221 -171
  21. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +261 -315
  22. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/split_child.js +137 -122
  23. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +1 -1
  24. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +10 -7
  25. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +5 -4
  26. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +14 -14
  27. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +123 -98
  28. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_display.js +18 -6
  29. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/api.js +9 -11
  30. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +2 -2
  31. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +15 -16
  32. data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +11 -0
  33. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
  35. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +170 -153
  36. data/lib/frameworks/sproutcore/frameworks/table/views/table.js +105 -101
  37. data/lib/frameworks/sproutcore/frameworks/table/views/table_head.js +0 -7
  38. data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +46 -56
  39. data/lib/frameworks/sproutcore/frameworks/table/views/table_row.js +0 -6
  40. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +12 -4
  41. data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +3 -2
  42. data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +11 -8
  43. data/lib/frameworks/sproutcore/tests/phantomjs_runner.phantomjs +0 -1
  44. metadata +3 -3
  45. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -235
@@ -9,27 +9,31 @@ sc_require('mixins/table_delegate');
9
9
  sc_require('views/table_head');
10
10
 
11
11
  /** @class
12
-
13
- A table view renders a two-dimensional grid of data.
14
-
15
- TODO: More documentation.
16
-
12
+ Deprecated.
13
+
14
+ The default SC.TableView has several issues and therefore until a suitable
15
+ replacement is developed, this class should be considered deprecated and
16
+ should not be used.
17
+
18
+ Please try [](https://github.com/jslewis/sctable) for a decent alternative.
19
+
17
20
  @extends SC.ListView
18
21
  @extends SC.TableDelegate
22
+ @deprecated Version 1.10
19
23
  @since SproutCore 1.1
20
24
  */
21
25
 
22
26
  SC.TableView = SC.ListView.extend(SC.TableDelegate, {
23
- /** @scope SC.TableView.prototype */
24
-
27
+ /** @scope SC.TableView.prototype */
28
+
25
29
  // ..........................................................
26
30
  // PROPERTIES
27
- //
28
-
31
+ //
32
+
29
33
  classNames: ['sc-table-view'],
30
-
34
+
31
35
  childViews: "tableHeadView scrollView".w(),
32
-
36
+
33
37
  scrollView: SC.ScrollView.extend({
34
38
  isVisible: YES,
35
39
  layout: {
@@ -42,7 +46,7 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
42
46
  borderStyle: SC.BORDER_NONE,
43
47
  contentView: SC.View.extend({
44
48
  }),
45
-
49
+
46
50
  // FIXME: Hack.
47
51
  _sv_offsetDidChange: function() {
48
52
  this.get('parentView')._sctv_scrollOffsetDidChange();
@@ -51,9 +55,9 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
51
55
 
52
56
  hasHorizontalScroller: NO,
53
57
  hasVerticalScroller: NO,
54
-
58
+
55
59
  selectOnMouseDown: NO,
56
-
60
+
57
61
  // FIXME: Charles originally had this as an outlet, but that doesn't work.
58
62
  // Figure out why.
59
63
  containerView: function() {
@@ -61,32 +65,32 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
61
65
  return (scrollView && scrollView.get) ? scrollView.get('contentView') : null;
62
66
  //return this.get('scrollView').get('contentView');
63
67
  }.property('scrollView'),
64
-
68
+
65
69
  layout: { left: 0, right: 0, top: 0, bottom: 0 },
66
-
70
+
67
71
  init: function() {
68
72
  sc_super();
69
73
 
70
74
  window.table = this; // DEBUG
71
75
  //this._sctv_columnsDidChange();
72
76
  },
73
-
74
-
77
+
78
+
75
79
  canReorderContent: NO,
76
-
80
+
77
81
  isInDragMode: NO,
78
-
82
+
79
83
  // ..........................................................
80
84
  // EVENT RESPONDERS
81
- //
82
-
85
+ //
86
+
83
87
  mouseDownInTableHeaderView: function(evt, header) {
84
88
  var column = header.get('column');
85
-
89
+
86
90
  if (!column.get('isReorderable') && !column.get('isSortable')) {
87
91
  return NO;
88
92
  }
89
-
93
+
90
94
  // Save the mouseDown event so we can use it for mouseUp/mouseDragged.
91
95
  this._mouseDownEvent = evt;
92
96
  // Set the timer for switching from a sort action to a reorder action.
@@ -95,10 +99,10 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
95
99
  action: '_scthv_enterDragMode',
96
100
  interval: 300
97
101
  });
98
-
102
+
99
103
  return YES;
100
104
  },
101
-
105
+
102
106
  mouseUpInTableHeaderView: function(evt, header) {
103
107
  var isInDragMode = this.get('isInDragMode');
104
108
  // Only sort if we're not in drag mode (i.e., short clicks).
@@ -113,21 +117,21 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
113
117
 
114
118
  column.set('sortState', newSortState);
115
119
  }
116
-
120
+
117
121
  // Exit drag mode (and cancel any scheduled drag modes).
118
122
  // this._scthv_exitDragMode();
119
123
  this._dragging = false;
120
124
  if (this._mouseDownTimer) {
121
125
  this._mouseDownTimer.invalidate();
122
126
  }
123
-
127
+
124
128
  },
125
-
129
+
126
130
  mouseDraggedInTableHeaderView: function(evt, header) {
127
131
  SC.RunLoop.begin();
128
132
  var isInDragMode = this.get('isInDragMode');
129
133
  if (!isInDragMode) return NO;
130
-
134
+
131
135
  if (!this._dragging) {
132
136
  SC.Drag.start({
133
137
  event: this._mouseDownEvent,
@@ -138,39 +142,39 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
138
142
  });
139
143
  this._dragging = true;
140
144
  }
141
-
145
+
142
146
  return sc_super();
143
147
  SC.RunLoop.end();
144
148
  },
145
-
146
-
149
+
150
+
147
151
  // ..........................................................
148
152
  // COLUMN PROPERTIES
149
153
  //
150
-
154
+
151
155
  /**
152
156
  A collection of `SC.TableColumn` objects. Modify the array to adjust the
153
157
  columns.
154
-
158
+
155
159
  @property
156
160
  @type Array
157
161
  */
158
162
  columns: [],
159
-
163
+
160
164
  /**
161
165
  Which column will alter its size so that the columns fill the available
162
166
  width of the table. If `null`, the last column will stretch.
163
-
167
+
164
168
  @property
165
169
  @type SC.TableColumn
166
170
  */
167
171
  flexibleColumn: null,
168
-
172
+
169
173
  /**
170
174
  Which column is currently the "active" column for sorting purposes.
171
175
  Doesn't say anything about sorting direction; for that, read the
172
176
  `sortState` property of the sorted column.
173
-
177
+
174
178
  @property
175
179
  @type SC.TableColumn
176
180
  */
@@ -178,35 +182,35 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
178
182
 
179
183
  // ..........................................................
180
184
  // HEAD PROPERTIES
181
- //
185
+ //
182
186
 
183
187
  /**
184
188
  if YES, the table view will generate a head row at the top of the table
185
189
  view.
186
-
190
+
187
191
  @property
188
192
  @type Boolean
189
193
  */
190
194
  hasTableHead: YES,
191
-
195
+
192
196
  /**
193
197
  The view that serves as the head view for the table (if any).
194
-
198
+
195
199
  @property
196
200
  @type SC.View
197
201
  */
198
202
  tableHeadView: SC.TableHeadView.extend({
199
203
  layout: { top: 0, left: 0, right: 0 }
200
204
  }),
201
-
205
+
202
206
  /**
203
207
  The height of the table head in pixels.
204
-
208
+
205
209
  @property
206
210
  @type Number
207
211
  */
208
212
  tableHeadHeight: 18,
209
-
213
+
210
214
 
211
215
  // ..........................................................
212
216
  // ROW PROPERTIES
@@ -215,54 +219,54 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
215
219
  /**
216
220
  Whether all rows in the table will have the same pixel height. If so, we
217
221
  can compute offsets very cheaply.
218
-
222
+
219
223
  @property
220
224
  @type Boolean
221
225
  */
222
226
  hasUniformRowHeights: YES,
223
-
227
+
224
228
  /**
225
229
  How high each row should be, in pixels.
226
-
230
+
227
231
  @property
228
232
  @type Number
229
233
  */
230
234
  rowHeight: 18,
231
-
235
+
232
236
  /**
233
237
  Which view to use for a table row.
234
-
238
+
235
239
  @property
236
240
  @type SC.View
237
241
  */
238
242
  exampleView: SC.TableRowView,
239
-
243
+
240
244
  // ..........................................................
241
245
  // DRAG-REORDER MODE
242
- //
243
-
246
+ //
247
+
244
248
  isInColumnDragMode: NO,
245
-
246
-
247
-
249
+
250
+
251
+
248
252
  // ..........................................................
249
253
  // OTHER PROPERTIES
250
- //
251
-
254
+ //
255
+
252
256
  filterKey: null,
253
-
254
-
257
+
258
+
255
259
  /**
256
260
  Returns the top offset for the specified content index. This will take
257
261
  into account any custom row heights and group views.
258
-
262
+
259
263
  @param {Number} idx the content index
260
264
  @returns {Number} the row offset in pixels
261
265
  */
262
-
266
+
263
267
  rowOffsetForContentIndex: function(contentIndex) {
264
268
  var top = 0, idx;
265
-
269
+
266
270
  if (this.get('hasUniformRowHeights')) {
267
271
  return top + (this.get('rowHeight') * contentIndex);
268
272
  } else {
@@ -270,13 +274,13 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
270
274
  top += this.rowHeightForContentIndex(idx);
271
275
  }
272
276
  return top;
273
- }
277
+ }
274
278
  },
275
-
279
+
276
280
  /**
277
281
  Returns the row height for the specified content index. This will take
278
282
  into account custom row heights and group rows.
279
-
283
+
280
284
  @param {Number} idx content index
281
285
  @returns {Number} the row height in pixels
282
286
  */
@@ -287,12 +291,12 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
287
291
  // TODO
288
292
  }
289
293
  },
290
-
291
-
292
- /**
294
+
295
+
296
+ /**
293
297
  Computes the layout for a specific content index by combining the current
294
298
  row heights.
295
-
299
+
296
300
  @param {Number} index content index
297
301
  */
298
302
  layoutForContentIndex: function(index) {
@@ -303,19 +307,19 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
303
307
  right: 0
304
308
  };
305
309
  },
306
-
310
+
307
311
  createItemView: function(exampleClass, idx, attrs) {
308
312
  // Add a `tableView` attribute to each created row so it has a way to
309
313
  // refer back to this view.
310
314
  attrs.tableView = this;
311
315
  return exampleClass.create(attrs);
312
316
  },
313
-
317
+
314
318
  clippingFrame: function() {
315
319
  var cv = this.get('containerView'),
316
320
  sv = this.get('scrollView'),
317
321
  f = this.get('frame');
318
-
322
+
319
323
  if (!sv.get) {
320
324
  return f;
321
325
  }
@@ -326,9 +330,9 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
326
330
  x: sv.get('horizontalScrollOffset'),
327
331
  y: sv.get('verticalScrollOffset')
328
332
  };
329
-
333
+
330
334
  }.property('frame', 'content').cacheable(),
331
-
335
+
332
336
  _sctv_scrollOffsetDidChange: function() {
333
337
  this.notifyPropertyChange('clippingFrame');
334
338
  },
@@ -337,16 +341,16 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
337
341
  // ..........................................................
338
342
  // SUBCLASS IMPLEMENTATIONS
339
343
  //
340
-
341
-
344
+
345
+
342
346
  computeLayout: function() {
343
347
  var layout = sc_super(),
344
348
  containerView = this.get('containerView'),
345
349
  frame = this.get('frame');
346
-
350
+
347
351
  var minHeight = layout.minHeight;
348
352
  delete layout.minHeight;
349
-
353
+
350
354
 
351
355
  // FIXME: In the middle of initialization, the TableView needs to be
352
356
  // reloaded in order to become aware of the proper display state of the
@@ -357,30 +361,30 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
357
361
  // if (currentHeight !== height) {
358
362
  // this.reload();
359
363
  // }
360
-
364
+
361
365
  containerView.adjust('minHeight', minHeight);
362
366
  containerView.layoutDidChange();
363
367
 
364
368
  //containerView.adjust('height', height);
365
369
  //containerView.layoutDidChange();
366
-
367
- this.notifyPropertyChange('clippingFrame');
370
+
371
+ this.notifyPropertyChange('clippingFrame');
368
372
  return layout;
369
373
  },
370
-
371
-
374
+
375
+
372
376
  // ..........................................................
373
377
  // INTERNAL SUPPORT
374
- //
375
-
378
+ //
379
+
376
380
  // When the columns change, go through all the columns and set their tableContent to be this table's content
377
381
  // TODO: should these guys not just have a binding of this instead?
378
382
  _sctv_columnsDidChange: function() {
379
383
 
380
- var columns = this.get('columns'),
384
+ var columns = this.get('columns'),
381
385
  content = this.get('content'),
382
386
  idx;
383
-
387
+
384
388
  for (idx = 0; idx < columns.get('length'); idx++) {
385
389
  columns.objectAt(idx).set('tableContent', content);
386
390
  }
@@ -388,32 +392,32 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
388
392
  this.reload();
389
393
 
390
394
  }.observes('columns'),
391
-
395
+
392
396
  // Do stuff when our frame size changes.
393
397
  _sctv_adjustColumnWidthsOnResize: function() {
394
398
 
395
399
  var width = this.get('frame').width;
396
400
  var content = this.get('content'),
397
401
  del = this.delegateFor('isTableDelegate', this.delegate, content);
398
-
402
+
399
403
  if (this.get('columns').length == 0) return;
400
404
  width = del.tableShouldResizeWidthTo(this, width);
401
-
405
+
402
406
  var columns = this.get('columns'), totalColumnWidth = 0, idx;
403
-
407
+
404
408
  for (var idx = 0; idx < columns.length; idx++) {
405
409
  totalColumnWidth += columns.objectAt(idx).get('width');
406
410
  }
407
-
411
+
408
412
  if (width === 0) width = totalColumnWidth;
409
413
  var flexibleColumn = this.get('flexibleColumn') ||
410
414
  this.get('columns').objectAt(this.get('columns').length - 1);
411
415
  var flexibleWidth = flexibleColumn.get('width') +
412
416
  (width - totalColumnWidth);
413
-
414
- flexibleColumn.set('width', flexibleWidth);
417
+
418
+ flexibleColumn.set('width', flexibleWidth);
415
419
  }.observes('frame'),
416
-
420
+
417
421
  // =============================================================
418
422
  // = This is all terrible, but will have to do in the interim. =
419
423
  // =============================================================
@@ -422,19 +426,19 @@ SC.TableView = SC.ListView.extend(SC.TableDelegate, {
422
426
  var sortKey = sortedColumn.get('key');
423
427
  this.set('orderBy', sortKey);
424
428
  },
425
-
429
+
426
430
  _sctv_sortedColumnDidChange: function() {
427
431
  var columns = this.get('columns'),
428
432
  sortedColumn = this.get('sortedColumn'),
429
433
  column, idx;
430
-
434
+
431
435
  for (idx = 0; idx < columns.get('length'); idx++) {
432
436
  column = columns.objectAt(idx);
433
437
  if (column !== sortedColumn) {
434
438
  column.set('sortState', null);
435
439
  }
436
440
  }
437
-
441
+
438
442
  this.invokeOnce('_sctv_sortContent');
439
- }.observes('sortedColumn')
443
+ }.observes('sortedColumn')
440
444
  });
@@ -8,14 +8,7 @@
8
8
  sc_require('views/table');
9
9
  sc_require('views/table_header');
10
10
 
11
- /** @class
12
11
 
13
- The head of a `SC.TableView`. It's a special row of the table that holds
14
- the column header cells.
15
-
16
- @extends SC.View
17
- @since SproutCore 1.1
18
- */
19
12
  SC.TableHeadView = SC.View.extend({
20
13
  /** @scope SC.TableHeadView.prototype */
21
14