bm-core-ui 2.12.0-beta.16 → 2.12.0-beta.17

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.
@@ -489,6 +489,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
489
489
  // If this frame is assigned as part of a layout animation, don't perform any changes
490
490
  if (this._layoutAnimator) {
491
491
  Object.getOwnPropertyDescriptor(BMView.prototype, 'frame').set.call(this, frame);
492
+
492
493
  return;
493
494
  }
494
495
 
@@ -1954,7 +1955,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
1954
1955
  }
1955
1956
 
1956
1957
  if (cell._exclusivelyRendered) {
1957
- // If the cell was exclusively rendered, it should left alone
1958
+ // If the cell was exclusively rendered, it should be left alone
1958
1959
  cell._exclusivelyRendered = undefined;
1959
1960
  continue;
1960
1961
  }
@@ -2160,7 +2161,9 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
2160
2161
  const iterators = indexPaths.map(p => this._measuredSizeOfCellAtIndexPathGenerator(p, {layoutQueue: queue, dequeue: NO}));
2161
2162
 
2162
2163
  iterators.forEach(i => i.next());
2164
+ BMAnimationContextBeginStatic();
2163
2165
  queue.dequeue();
2166
+ BMAnimationApply();
2164
2167
  iterators.forEach(i => i.next());
2165
2168
  },
2166
2169
 
@@ -2424,10 +2427,16 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
2424
2427
  constraints.push(constraint);
2425
2428
  }
2426
2429
 
2430
+ cell._registerLayout();
2431
+
2427
2432
  yield;
2428
2433
 
2429
2434
  // Run a layout pass to measure the cell's subview
2430
- if (dequeue) cell.layoutIfNeeded();
2435
+ if (dequeue) {
2436
+ BMAnimationContextBeginStatic();
2437
+ cell.layoutQueue.dequeue();
2438
+ BMAnimationApply();
2439
+ }
2431
2440
 
2432
2441
  cell.layoutQueue = layoutQueue;
2433
2442
 
@@ -2460,6 +2469,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
2460
2469
  }
2461
2470
 
2462
2471
  // If the cell is still retained, reapply the previous attibutes
2472
+ BMAnimationContextBeginStatic();
2463
2473
  if (cell.retainCount > 0 && previousAttributes) {
2464
2474
  cell.attributes = previousAttributes;
2465
2475
  }
@@ -2467,6 +2477,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
2467
2477
  cell._attributes = undefined;
2468
2478
  attributes._cell = undefined;
2469
2479
  }
2480
+ BMAnimationApply();
2470
2481
 
2471
2482
  // Invalidate the cell's constraints to allow the next layout pass to correctly update the cells
2472
2483
  cell._invalidatedConstraints = YES;
@@ -5343,9 +5354,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5343
5354
  this._bounds.size.width = this._frame.size.width + 2 * this._offscreenBufferSize;
5344
5355
  this._bounds.size.height = this._frame.size.height + 2 * this._offscreenBufferSize;
5345
5356
  }
5357
+
5358
+ const oldLayout = this._layout;
5346
5359
 
5347
5360
  // Ask the new layout to prepare its layout
5348
5361
  layout.collectionView = this;
5362
+ this._layout = layout;
5349
5363
  layout.prepareLayout();
5350
5364
 
5351
5365
  var newSize = layout.contentSize();
@@ -5360,7 +5374,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5360
5374
  // }
5361
5375
 
5362
5376
  // Check to see if an offset is required
5363
- var newOffset = layout.preferredScrollOffsetForTransitionFromLayout(this._layout, {withOffset: this.scrollOffset.copy()});
5377
+ var newOffset = layout.preferredScrollOffsetForTransitionFromLayout(oldLayout, {withOffset: this.scrollOffset.copy()});
5364
5378
 
5365
5379
  // Then ensure that the new offset is constrained to the visible area
5366
5380
  newOffset.x = Math.max(0, Math.min(newOffset.x, newSize.width - this.frame.size.width));
@@ -5465,7 +5479,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5465
5479
  var attribute = newAttributes[newAttributes.length - 1];
5466
5480
 
5467
5481
  if (attribute.itemType === BMCollectionViewLayoutAttributesType.Cell) {
5468
- var oldAttribute = this._layout.attributesForCellAtIndexPath(attribute.indexPath);
5482
+ var oldAttribute = oldLayout.attributesForCellAtIndexPath(attribute.indexPath);
5469
5483
 
5470
5484
  // Create the transition attributes for this cell
5471
5485
  var transitionAttribute = _BMCollectionViewTransitionLayoutAttributesMakeWithSourceAttributes(oldAttribute, {targetAttributes: attribute});
@@ -5493,10 +5507,8 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5493
5507
  var transitionLayout = new _BMCollectionViewTransitionLayout(transitionAttributes, this._size, newSize, layout);
5494
5508
  transitionLayout.collectionView = this;
5495
5509
 
5496
- var oldLayout = this._layout;
5497
-
5498
5510
  // Unbind the old layout
5499
- this._layout.collectionView = undefined;
5511
+ oldLayout.collectionView = undefined;
5500
5512
 
5501
5513
  // Temporarily make the transition layout the current layout
5502
5514
  this._layout = transitionLayout;
@@ -3365,9 +3365,10 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
3365
3365
  }
3366
3366
  else {
3367
3367
  // Because the measured size of the cells can depend upon the size of collection view's frame, in addition
3368
- // to invalidating the layout, flow layout also invalidates the size of cells that are as wide as collection view's previous frame.
3368
+ // to invalidating the layout, flow layout also invalidates the size of cells that are as wide as collection view's previous frame
3369
+ // or wider than the new frame
3369
3370
  this.collectionView.invalidateMeasuredSizeOfCellsWithBlock(size => {
3370
- return size.width >= this.cachedLayout.availableWidth;
3371
+ return size.width >= this.cachedLayout.availableWidth || size.width >= frame.width;
3371
3372
  });
3372
3373
  }
3373
3374
 
@@ -4976,4 +4977,3 @@ BMCollectionViewFlowLayout.flowLayout = function () {
4976
4977
  }
4977
4978
 
4978
4979
  // @endtype
4979
-
@@ -978,6 +978,11 @@ _BMCollectionViewTransitionLayout.prototype = BMExtend({}, BMCollectionViewLayou
978
978
  return this.targetLayout.attributesForSupplementaryViewWithIdentifier(identifier, args);
979
979
  },
980
980
 
981
+ // @override - BMCollectionViewLayout
982
+ constraintsForMeasuringCell(cell, args) {
983
+ return this.targetLayout.constraintsForMeasuringCell(cell, args);
984
+ },
985
+
981
986
  /**
982
987
  * Invoked by the collection view at the end of a layout transition.
983
988
  * Causes the transition layout to apply the final attributes to all animated cells.