bm-core-ui 2.12.0-beta.7 → 2.12.0-beta.8

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.
@@ -11771,6 +11771,19 @@ export class BMCollectionViewLayoutInvalidationContext {
11771
11771
  */
11772
11772
  export class BMCollectionViewTransitionLayout extends BMCollectionViewLayout {
11773
11773
 
11774
+ /**
11775
+ * When set to `YES` this transition layout will no longer perform updates.
11776
+ *
11777
+ */
11778
+ private _transitionStopped: boolean;
11779
+
11780
+ /**
11781
+ * Stops the current transition in its tracks, instantly setting the final attributes on all cells.
11782
+ *
11783
+ */
11784
+ private _stopTransition(): void;
11785
+
11786
+
11774
11787
  /**
11775
11788
  * Controls how close to completion the transition is.
11776
11789
  *
@@ -14249,6 +14262,14 @@ export class BMCollectionView<T = any> extends BMView implements BMDragDelegate,
14249
14262
  setLayout(layout: BMCollectionViewLayout, {animated, completionHandler}?: {animated?: boolean | null | undefined, completionHandler?: (() => void) | null | undefined}): void;
14250
14263
 
14251
14264
 
14265
+ /**
14266
+ * If a layout transition is currently in progress it is stopped, allowing data updates to
14267
+ * start without affecting the retained cells.
14268
+ *
14269
+ */
14270
+ private _stopLayoutTransition(): void;
14271
+
14272
+
14252
14273
  /**
14253
14274
  * Invoked internally by CoreUI to perform a batched update of layout properties.
14254
14275
  * Using this method requires the layout object used by this collection view to support copying.
@@ -14535,6 +14556,14 @@ export class BMCollectionView<T = any> extends BMView implements BMDragDelegate,
14535
14556
  }
14536
14557
 
14537
14558
 
14559
+ /**
14560
+ * Cleans up the changes performed by the current transition.
14561
+ *
14562
+ */
14563
+ export function cleanupTransition(): void;
14564
+
14565
+
14566
+
14538
14567
  /**
14539
14568
  * @deprecated - Use the static `collectionViewForNode` factory method.
14540
14569
  *
@@ -1218,9 +1218,10 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
1218
1218
  for (var i = 0; i < retainedCellsLength; i++) {
1219
1219
  // The retained cells array resizes itself when cells are removed
1220
1220
  this.retainedCells[0]._unmanage();
1221
- }*/
1221
+ }
1222
1222
 
1223
1223
  this.retainedCells = [];
1224
+ */
1224
1225
 
1225
1226
  // Reload the layout
1226
1227
  this._reloadLayout();
@@ -5526,8 +5527,66 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5526
5527
  // regardless of where the new or old positions of cells might be
5527
5528
  let size = layout.contentSize();
5528
5529
  this._size = BMSizeMake(Math.max(this._size.width, size.width), Math.max(this._size.height, size.height));
5530
+
5531
+ /**
5532
+ * Cleans up the changes performed by the current transition.
5533
+ */
5534
+ function cleanupTransition() {
5535
+ if (self.iScroll) self.iScroll.refresh();
5536
+
5537
+ // Unmanage all outgoing supplementary views
5538
+ for (var i = 0; i < outgoingSupplementaryViewAttributes.length; i++) {
5539
+ var attribute = outgoingSupplementaryViewAttributes[i];
5540
+ var cell = self.supplementaryViewWithIdentifier(attribute.identifier, {atIndexPath: attribute.indexPath});
5541
+
5542
+ if (cell && cell.isManaged) {
5543
+ cell._unmanage();
5544
+ }
5545
+ }
5546
+
5547
+ self._applyOverflows();
5548
+
5549
+ // Restore collection and invoke the data completion callbacks unless another animation is in progress
5550
+ if (self._dataUpdatePromise == dataUpdatePromise) {
5551
+ self._collectionEnabled = YES;
5552
+ self.isUpdatingData = NO;
5553
+
5554
+ self._executeDataCompletionCallbacks();
5555
+ }
5556
+
5557
+ // If the delegate animation options contains a complete handler, invoke it here
5558
+ if (delegateOptions.complete) delegateOptions.complete();
5559
+
5560
+ // Run the completion handler if it was specified
5561
+ if (options && options.completionHandler) options.completionHandler();
5562
+
5563
+ resolveLayoutUpdate();
5564
+ }
5529
5565
 
5530
5566
  animationOptions.complete = function () {
5567
+ // If the transition was stopped, don't continue with the remaining changes
5568
+ if (self._layout != transitionLayout) {
5569
+ self._size = size.copy();
5570
+
5571
+ if (self.iScroll) {
5572
+ // Apply the new scroll offset internally to iScroll, if it changed
5573
+ if (oldBounds.origin.x != newBounds.origin.x || oldBounds.origin.y != newBounds.origin.y) {
5574
+ var targetOffset = newBounds.origin.copy();
5575
+
5576
+ targetOffset.x += self._offscreenBufferSize;
5577
+ targetOffset.y += self._offscreenBufferSize;
5578
+
5579
+ self.iScroll._translate(-targetOffset.x, -targetOffset.y);
5580
+ }
5581
+ }
5582
+
5583
+ animationCells.forEach(cell => cell.release());
5584
+ retainedCells.forEach(cell => cell.release());
5585
+
5586
+ cleanupTransition();
5587
+ return;
5588
+ }
5589
+
5531
5590
  // Request the layout page
5532
5591
  var attributes = transitionLayout.attributesForElementsInRect();
5533
5592
 
@@ -5562,35 +5621,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5562
5621
  self._layout = layout;
5563
5622
  self._transitionLayout = undefined;
5564
5623
 
5565
- if (self.iScroll) self.iScroll.refresh();
5566
-
5567
- // Unmanage all outgoing supplementary views
5568
- for (var i = 0; i < outgoingSupplementaryViewAttributes.length; i++) {
5569
- var attribute = outgoingSupplementaryViewAttributes[i];
5570
- var cell = self.supplementaryViewWithIdentifier(attribute.identifier, {atIndexPath: attribute.indexPath});
5571
-
5572
- if (cell && cell.isManaged) {
5573
- cell._unmanage();
5574
- }
5575
- }
5576
-
5577
- self._applyOverflows();
5578
-
5579
- // Restore collection invoke the data completion callbacks unless another animation is in progress
5580
- if (self._dataUpdatePromise == dataUpdatePromise) {
5581
- self._collectionEnabled = YES;
5582
- self.isUpdatingData = NO;
5583
-
5584
- self._executeDataCompletionCallbacks();
5585
- }
5586
-
5587
- // If the delegate animation options contains a complete handler, invoke it here
5588
- if (delegateOptions.complete) delegateOptions.complete();
5589
-
5590
- // Run the completion handler if it was specified
5591
- if (options && options.completionHandler) options.completionHandler();
5592
-
5593
- resolveLayoutUpdate();
5624
+ cleanupTransition();
5594
5625
  };
5595
5626
 
5596
5627
  animationOptions.queue = NO;
@@ -5688,9 +5719,16 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5688
5719
 
5689
5720
  },
5690
5721
 
5691
-
5692
-
5693
-
5722
+ /**
5723
+ * If a layout transition is currently in progress it is stopped, allowing data updates to
5724
+ * start without affecting the retained cells.
5725
+ */
5726
+ _stopLayoutTransition() {
5727
+ if (this._transitionLayout && this._layout == this._transitionLayout) {
5728
+ this._layout._stopTransition();
5729
+ this._layout = this._layout.targetLayout;
5730
+ }
5731
+ },
5694
5732
 
5695
5733
  /************************************* DATA SET UPDATE ************************************/
5696
5734
 
@@ -5860,6 +5898,9 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5860
5898
  let resolveUpdateData;
5861
5899
  const dataUpdatePromise = new Promise(function (resolve, reject) {resolveUpdateData = resolve});
5862
5900
  this._dataUpdatePromise = dataUpdatePromise;
5901
+
5902
+ // Stop any in progress layout updates
5903
+ this._stopLayoutTransition();
5863
5904
 
5864
5905
  // Update the selection index paths
5865
5906
  this._updateSelectionIndexPaths();
@@ -910,6 +910,19 @@ export var _BMCollectionViewTransitionLayout = function (attributes, initialSize
910
910
  };
911
911
 
912
912
  _BMCollectionViewTransitionLayout.prototype = BMExtend({}, BMCollectionViewLayout.prototype, {
913
+
914
+ /**
915
+ * When set to `YES` this transition layout will no longer perform updates.
916
+ */
917
+ _transitionStopped: NO, // <Boolean>
918
+
919
+ /**
920
+ * Stops the current transition in its tracks, instantly setting the final attributes on all cells.
921
+ */
922
+ _stopTransition() {
923
+ this._applyFinalAttributes();
924
+ this._transitionStopped = YES;
925
+ },
913
926
 
914
927
  /**
915
928
  * Controls how close to completion the transition is.
@@ -917,6 +930,12 @@ _BMCollectionViewTransitionLayout.prototype = BMExtend({}, BMCollectionViewLayou
917
930
  _fraction: 0, // <Number>
918
931
  get fraction() { return this._fraction; },
919
932
  set fraction(fraction) {
933
+ // If this transition was stopped, don't perform any other changes
934
+ if (this._transitionStopped) {
935
+ this._fraction = fraction;
936
+ return;
937
+ }
938
+
920
939
  // If this is no longer attached to a collection view, don't perform any changes
921
940
  if (!this.collectionView) return;
922
941
 
@@ -11771,6 +11771,19 @@ declare class BMCollectionViewLayoutInvalidationContext {
11771
11771
  */
11772
11772
  declare class BMCollectionViewTransitionLayout extends BMCollectionViewLayout {
11773
11773
 
11774
+ /**
11775
+ * When set to `YES` this transition layout will no longer perform updates.
11776
+ *
11777
+ */
11778
+ private _transitionStopped: boolean;
11779
+
11780
+ /**
11781
+ * Stops the current transition in its tracks, instantly setting the final attributes on all cells.
11782
+ *
11783
+ */
11784
+ private _stopTransition(): void;
11785
+
11786
+
11774
11787
  /**
11775
11788
  * Controls how close to completion the transition is.
11776
11789
  *
@@ -14249,6 +14262,14 @@ declare class BMCollectionView<T = any> extends BMView implements BMDragDelegate
14249
14262
  setLayout(layout: BMCollectionViewLayout, {animated, completionHandler}?: {animated?: boolean | null | undefined, completionHandler?: (() => void) | null | undefined}): void;
14250
14263
 
14251
14264
 
14265
+ /**
14266
+ * If a layout transition is currently in progress it is stopped, allowing data updates to
14267
+ * start without affecting the retained cells.
14268
+ *
14269
+ */
14270
+ private _stopLayoutTransition(): void;
14271
+
14272
+
14252
14273
  /**
14253
14274
  * Invoked internally by CoreUI to perform a batched update of layout properties.
14254
14275
  * Using this method requires the layout object used by this collection view to support copying.
@@ -14535,6 +14556,14 @@ declare class BMCollectionView<T = any> extends BMView implements BMDragDelegate
14535
14556
  }
14536
14557
 
14537
14558
 
14559
+ /**
14560
+ * Cleans up the changes performed by the current transition.
14561
+ *
14562
+ */
14563
+ declare function cleanupTransition(): void;
14564
+
14565
+
14566
+
14538
14567
  /**
14539
14568
  * @deprecated - Use the static `collectionViewForNode` factory method.
14540
14569
  *