bm-core-ui 2.10.3 → 2.10.5
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.
|
@@ -4344,7 +4344,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4344
4344
|
}
|
|
4345
4345
|
|
|
4346
4346
|
do {
|
|
4347
|
-
const startingIndexPath = nextIndexPath;
|
|
4347
|
+
const startingIndexPath = nextIndexPath ?? BMIndexPathNone;
|
|
4348
4348
|
|
|
4349
4349
|
if (!nextIndexPath) {
|
|
4350
4350
|
// If no index path is currently highlighted, highlight the first index path in the data set.
|
|
@@ -4922,7 +4922,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4922
4922
|
targetOffset.x += self._offscreenBufferSize;
|
|
4923
4923
|
targetOffset.y += self._offscreenBufferSize;
|
|
4924
4924
|
|
|
4925
|
-
let controller = BMAnimationContextGetCurrent().controllerForObject(self, {node: self._contentWrapper[0]});
|
|
4925
|
+
let controller = BMAnimationContextGetCurrent().controllerForObject(self._contentWrapper[0], {node: self._contentWrapper[0]});
|
|
4926
4926
|
if (self.iScroll) {
|
|
4927
4927
|
//controller.registerCustomProperty('scrollOffset', {withHandler: fraction => {
|
|
4928
4928
|
//var offsetX = currentOffset.x + fraction * (targetOffset.x - currentOffset.x);
|
|
@@ -5625,7 +5625,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5625
5625
|
targetOffset.x += self._offscreenBufferSize;
|
|
5626
5626
|
targetOffset.y += self._offscreenBufferSize;
|
|
5627
5627
|
|
|
5628
|
-
let controller = BMAnimationContextGetCurrent().controllerForObject(self, {node: self._container[0]});
|
|
5628
|
+
let controller = BMAnimationContextGetCurrent().controllerForObject(self._container[0], {node: self._container[0]});
|
|
5629
5629
|
if (self.iScroll) {
|
|
5630
5630
|
controller.registerCustomProperty('scrollOffset', {withHandler: fraction => {
|
|
5631
5631
|
var offsetX = currentOffset.x + fraction * (targetOffset.x - currentOffset.x);
|
|
@@ -1708,6 +1708,15 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
1708
1708
|
|
|
1709
1709
|
let iterator = this._prepareLayoutWithScrollbarOffsetGenerator(useOffset);
|
|
1710
1710
|
|
|
1711
|
+
// Determine if the result is a complete layout and disable iterators
|
|
1712
|
+
// A complete layout has cached attributes for all sections and rows
|
|
1713
|
+
const sectionCount = this.collectionView.numberOfSections();
|
|
1714
|
+
const rowCount = sectionCount ? this.collectionView.numberOfObjectsInSectionAtIndex(sectionCount - 1) : 0;
|
|
1715
|
+
let isCompleteLayout = !this._expectedCellSize || !sectionCount || (
|
|
1716
|
+
this.cachedLayout?.sections?.length == sectionCount &&
|
|
1717
|
+
this.cachedLayout?.sections[sectionCount - 1].rows?.length == rowCount
|
|
1718
|
+
);
|
|
1719
|
+
|
|
1711
1720
|
// When not using automatic cell sizes, the generator function will run to finish from the first
|
|
1712
1721
|
// invocation of `next`.
|
|
1713
1722
|
// When using automatic cell sizes, the first iteration will only build a rough outline of the expected layout
|
|
@@ -1717,6 +1726,28 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
1717
1726
|
this._layoutIterator = iterator;
|
|
1718
1727
|
this.cachedLayout.iterator = iterator;
|
|
1719
1728
|
}
|
|
1729
|
+
else if (!this.cachedLayout.iterator) {
|
|
1730
|
+
// If the iterator is finished this means that either:
|
|
1731
|
+
// - the layout is actually complete which can be verified by checking the cached attribute counts
|
|
1732
|
+
// - the layout process had to be restarted with scrollbar offsets, in which case the cached layout
|
|
1733
|
+
// will have been processed to have an iterator attached to it by the time the first iterator
|
|
1734
|
+
// step returns, in this case this branch should not execute
|
|
1735
|
+
|
|
1736
|
+
if (isCompleteLayout) {
|
|
1737
|
+
// Of the result is done, update the resolved index path and size accordingly
|
|
1738
|
+
this.cachedLayout.resolvedIndexPath = BMIndexPathMakeWithRow(rowCount - 1, {inSectionAtIndex: sectionCount - 1});
|
|
1739
|
+
|
|
1740
|
+
const contentSize = this.contentSize();
|
|
1741
|
+
this.cachedLayout.resolvedWidth = contentSize.width;
|
|
1742
|
+
this.cachedLayout.resolvedHeight = contentSize.height;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
// TODO: The rest of the code must be updated to handle complete layout caches where there is no need to
|
|
1746
|
+
if (!this._layoutIterator) {
|
|
1747
|
+
this._layoutIterator = { next() {} };
|
|
1748
|
+
}
|
|
1749
|
+
this.cachedLayout.iterator = { next() {} };
|
|
1750
|
+
}
|
|
1720
1751
|
},
|
|
1721
1752
|
|
|
1722
1753
|
/**
|
|
@@ -4664,7 +4695,7 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
4664
4695
|
let previousRow;
|
|
4665
4696
|
|
|
4666
4697
|
// Find the next row, if any
|
|
4667
|
-
if (rowIndex
|
|
4698
|
+
if (rowIndex > 0) {
|
|
4668
4699
|
const previousRowIndex = rowIndex - 1;
|
|
4669
4700
|
previousRow = sectionRows[previousRowIndex];
|
|
4670
4701
|
}
|
|
@@ -4673,7 +4704,8 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
4673
4704
|
let sectionIndex = section - 1;
|
|
4674
4705
|
while (sectionIndex >= 0) {
|
|
4675
4706
|
if (this.collectionView.numberOfObjectsInSectionAtIndex(sectionIndex)) {
|
|
4676
|
-
|
|
4707
|
+
// NOTE: When using automatic cell size, there can be fewer cached sections than there are in the data set
|
|
4708
|
+
previousRow = this.cachedLayout.sections[sectionIndex]?.rows[(this.cachedLayout.sections[sectionIndex]?.rows.length || 0) - 1];
|
|
4677
4709
|
break;
|
|
4678
4710
|
}
|
|
4679
4711
|
sectionIndex--;
|
|
@@ -4803,7 +4835,7 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
4803
4835
|
let sectionIndex = section + 1;
|
|
4804
4836
|
while (sectionIndex < sectionCount) {
|
|
4805
4837
|
if (this.collectionView.numberOfObjectsInSectionAtIndex(sectionIndex)) {
|
|
4806
|
-
nextRow = this.cachedLayout.sections[sectionIndex]
|
|
4838
|
+
nextRow = this.cachedLayout.sections[sectionIndex]?.rows[0];
|
|
4807
4839
|
break;
|
|
4808
4840
|
}
|
|
4809
4841
|
sectionIndex++;
|