bm-core-ui 2.10.5 → 2.11.1
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.
- package/build/@types/index.d.ts +312 -12
- package/build/BMCodeEditor/BMCodeEditor.js +2 -2
- package/build/BMCollectionView/BMCollectionView.js +302 -56
- package/build/BMCollectionView/BMCollectionViewCell.js +54 -27
- package/build/BMCollectionView/BMCollectionViewFlowLayout.js +2 -1
- package/build/BMCollectionView/BMCollectionViewMasonryLayout.js +1 -1
- package/build/BMCollectionView/BMCollectionViewStackLayout.js +1 -1
- package/build/BMCollectionView/BMCollectionViewTileLayout.js +1 -1
- package/build/BMWindow/BMWindow.js +141 -0
- package/build/Core/BMAnimationContext.js +93 -5
- package/lib/@types/BMCoreUI.min.d.ts +312 -12
- package/lib/BMCoreUI.min.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {BMIndexPathNone} from '../Core/BMIndexPath'
|
|
|
9
9
|
import {BMAnimateWithBlock, BMAnimationContextBeginStatic, BMAnimationContextGetCurrent, BMAnimationContextAddCompletionHandler, BMAnimationApply, __BMVelocityAnimate, BMHook} from '../Core/BMAnimationContext'
|
|
10
10
|
import {BMView, BMViewLayoutQueue} from '../BMView/BMView_v2.5'
|
|
11
11
|
import {BMCollectionViewLayoutAttributesMakeForCellAtIndexPath, BMCollectionViewLayoutAttributesType, BMCollectionViewLayoutAttributesStyleDefaults, _BMCollectionViewTransitionLayoutAttributesMakeWithSourceAttributes} from './BMCollectionViewLayoutAttributes'
|
|
12
|
-
import {BMJQueryShim, BMCollectionViewCell} from './BMCollectionViewCell'
|
|
12
|
+
import {BMJQueryShim, BMCollectionViewCell, BMCollectionViewCellReuseState} from './BMCollectionViewCell'
|
|
13
13
|
import {BMCollectionViewFlowLayout} from './BMCollectionViewFlowLayout'
|
|
14
14
|
import {_BMCollectionViewTransitionLayout} from './BMCollectionViewLayout'
|
|
15
15
|
import {IScroll} from '../iScroll/iscroll-probe'
|
|
@@ -271,20 +271,44 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
271
271
|
* An optional delegate object that can receive various callbacks from the collection view.
|
|
272
272
|
*/
|
|
273
273
|
delegate: undefined, // <BMCollectionViewDelegate, nullable>
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Set to `YES` if a legacy data set is being used. When a legacy
|
|
277
|
+
*/
|
|
278
|
+
_usesLegacyDataSet: NO,
|
|
274
279
|
|
|
275
280
|
/**
|
|
276
|
-
*
|
|
281
|
+
* @deprecated Use the `dataSource` property instead.
|
|
282
|
+
*
|
|
283
|
+
* ---
|
|
284
|
+
* A data set object that specifies how many objects are in this collection view and configures their contents.
|
|
277
285
|
*/
|
|
278
286
|
_dataSet: undefined, // <BMCollectionViewDataSet>
|
|
279
287
|
get dataSet() { return this._dataSet; },
|
|
280
288
|
set dataSet(dataSet) {
|
|
281
|
-
//this.dataSetWillChangeToDataSet(dataSet);
|
|
282
|
-
|
|
283
289
|
var oldDataSet = this._dataSet;
|
|
290
|
+
|
|
291
|
+
this._usesLegacyDataSet = YES;
|
|
284
292
|
this._dataSet = dataSet;
|
|
293
|
+
this._dataSource = BMCollectionViewDataSourceAdapter.adapterWithDataSet(dataSet);
|
|
285
294
|
|
|
286
295
|
this.dataSetDidChangeFromDataSet(oldDataSet);
|
|
287
296
|
},
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* A required data source object that specifies how many objects are in this collection view and configures their contents.
|
|
300
|
+
*/
|
|
301
|
+
_dataSource: undefined, // <BMCollectionViewDataSource>
|
|
302
|
+
get dataSource() { return this._dataSource; },
|
|
303
|
+
set dataSource(source) {
|
|
304
|
+
const oldDataSet = this._dataSet;
|
|
305
|
+
|
|
306
|
+
this._usesLegacyDataSet = NO;
|
|
307
|
+
this._dataSource = source;
|
|
308
|
+
this._dataSet = BMCollectionViewDataSetAdapter.adapterWithDataSource(source);
|
|
309
|
+
|
|
310
|
+
this.dataSetDidChangeFromDataSet(oldDataSet);
|
|
311
|
+
},
|
|
288
312
|
|
|
289
313
|
/**
|
|
290
314
|
* The collection view's container element.
|
|
@@ -874,8 +898,6 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
874
898
|
|
|
875
899
|
// Android is weird about handling touch events, so iScroll is required for it
|
|
876
900
|
if (/android/i.test(window.navigator.userAgent)) useCustomScroll = YES;
|
|
877
|
-
|
|
878
|
-
//var useCustomScroll = (false && this.customScrollRequired === undefined) || this.customScrollRequired;
|
|
879
901
|
|
|
880
902
|
this._prepareFrame();
|
|
881
903
|
|
|
@@ -1008,6 +1030,11 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
1008
1030
|
}
|
|
1009
1031
|
|
|
1010
1032
|
if (shouldRunIntroAnimation) {
|
|
1033
|
+
this.isUpdatingData = YES;
|
|
1034
|
+
|
|
1035
|
+
let resolveLayoutUpdate;
|
|
1036
|
+
this._dataUpdatePromise = new Promise($1 => resolveLayoutUpdate = $1);
|
|
1037
|
+
|
|
1011
1038
|
var visibleBounds = this._bounds.rectWithInset(BMInset.insetWithEqualInsets(this._offscreenBufferSize));
|
|
1012
1039
|
|
|
1013
1040
|
var animatedCells = this.retainedCells.slice();
|
|
@@ -1046,6 +1073,20 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
1046
1073
|
var cell = animatedCells[i];
|
|
1047
1074
|
cell.attributes = cell.attributes.targetAttributes;
|
|
1048
1075
|
}
|
|
1076
|
+
|
|
1077
|
+
const completionHandler = () => {
|
|
1078
|
+
self.isUpdatingData = NO;
|
|
1079
|
+
self._executeDataCompletionCallbacks();
|
|
1080
|
+
|
|
1081
|
+
resolveLayoutUpdate();
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
if (animatedCells.length) {
|
|
1085
|
+
BMAnimationContextAddCompletionHandler(completionHandler);
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
completionHandler();
|
|
1089
|
+
}
|
|
1049
1090
|
}, BMExtend({
|
|
1050
1091
|
duration: _BMCollectionViewAnimationDurationDefault,
|
|
1051
1092
|
easing: _BMCollectionViewAnimationEasingDefault,
|
|
@@ -1844,6 +1885,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
1844
1885
|
var allCellsLength = this.allCells.length;
|
|
1845
1886
|
for (var i = 0; i < allCellsLength; i++) {
|
|
1846
1887
|
var cell = this.allCells[i];
|
|
1888
|
+
|
|
1889
|
+
// Don't manipulate cells that are in the process of being deleted, as they don't
|
|
1890
|
+
// have valid index paths
|
|
1891
|
+
if (cell._reuseState == BMCollectionViewCellReuseState.Deleting) {
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1847
1894
|
|
|
1848
1895
|
if (cell._exclusivelyRendered) {
|
|
1849
1896
|
// If the cell was exclusively rendered, it should left alone
|
|
@@ -2485,15 +2532,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2485
2532
|
|
|
2486
2533
|
var cell = Object.create(cellClass.prototype).initWithCollectionView(this, {reuseIdentifier: identifier, node: node, kind: BMCollectionViewLayoutAttributesType.Cell});
|
|
2487
2534
|
cell.layoutQueue = this._cellLayoutQueue;
|
|
2488
|
-
//BMCollectionViewCellMakeForCollectionView(this, {withReuseIdentifier: identifier});
|
|
2489
|
-
|
|
2490
2535
|
|
|
2491
|
-
//cell.element = $('<div style="position: absolute; left: 0px; top: 0px; visibility: hidden; overflow: visible;">');
|
|
2492
|
-
//if (this.customScroll) cell.element.css({'will-change': 'transform'});
|
|
2493
2536
|
// When using custom classes, it is no longer the data set object's responsibility to provide the contents for the cell
|
|
2494
|
-
if (cellClass == BMCollectionViewCell
|
|
2537
|
+
if (cellClass == BMCollectionViewCell && this._usesLegacyDataSet) {
|
|
2538
|
+
cell.element.append(this._dataSet.contentsForCellWithReuseIdentifier(identifier));
|
|
2539
|
+
}
|
|
2495
2540
|
|
|
2496
|
-
|
|
2497
2541
|
this._contentWrapper.append(cell.element);
|
|
2498
2542
|
|
|
2499
2543
|
// Attach event handlers to the cells
|
|
@@ -2551,7 +2595,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2551
2595
|
const which = event.which || event.button;
|
|
2552
2596
|
|
|
2553
2597
|
// Don't handle non-left clicks here
|
|
2554
|
-
if (
|
|
2598
|
+
if (event.originalEvent.type != 'touchstart' && which != 1) return;
|
|
2555
2599
|
|
|
2556
2600
|
// Don't handle events originating from buttons and input elements or their direct descendants as well as several whitelisted class names
|
|
2557
2601
|
if (event.target.nodeName == 'BUTTON' || event.target.nodeName == 'INPUT' || event.target.nodeName == 'LABEL' || event.target.nodeName == 'A' ||
|
|
@@ -2788,7 +2832,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2788
2832
|
const which = event.which || event.button;
|
|
2789
2833
|
|
|
2790
2834
|
// Don't handle non-left clicks here
|
|
2791
|
-
if (
|
|
2835
|
+
if (event.originalEvent.type == 'mouseup' && which != 1) return;
|
|
2792
2836
|
|
|
2793
2837
|
if (event.originalEvent.type == 'touchend') {
|
|
2794
2838
|
// Don't handle other touches than the tracked touch
|
|
@@ -3774,7 +3818,9 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
3774
3818
|
cell.layoutQueue = this._cellLayoutQueue;
|
|
3775
3819
|
|
|
3776
3820
|
// When using custom classes, it is no longer the data set object's responsibility to provide the contents for the cell
|
|
3777
|
-
if (cellClass == BMCollectionViewCell
|
|
3821
|
+
if (cellClass == BMCollectionViewCell && this._usesLegacyDataSet) {
|
|
3822
|
+
cell.element.append(this._dataSet.contentsForSupplementaryViewWithIdentifier(identifier));
|
|
3823
|
+
}
|
|
3778
3824
|
this._contentWrapper.append(cell.element);
|
|
3779
3825
|
|
|
3780
3826
|
return cell;
|
|
@@ -3947,7 +3993,15 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
3947
3993
|
for (var i = 0; i < this.allCells.length; i++) {
|
|
3948
3994
|
var cell = this.allCells[i];
|
|
3949
3995
|
|
|
3950
|
-
if (cell.itemType != options.ofType)
|
|
3996
|
+
if (cell.itemType != options.ofType) {
|
|
3997
|
+
continue;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
// Cells that are in the process of being deleted cannot be returned by this method
|
|
4001
|
+
if (cell._reuseState == BMCollectionViewCellReuseState.Deleting) {
|
|
4002
|
+
continue;
|
|
4003
|
+
}
|
|
4004
|
+
|
|
3951
4005
|
if (cell.indexPath.isLooselyEqualToIndexPath(indexPath, {usingComparator: this.identityComparator})) {
|
|
3952
4006
|
return cell;
|
|
3953
4007
|
}
|
|
@@ -4540,7 +4594,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4540
4594
|
* }
|
|
4541
4595
|
*/
|
|
4542
4596
|
setLayout: function (layout, options) {
|
|
4543
|
-
// If there is an in-progress animated update, schedule this call for
|
|
4597
|
+
// If there is an in-progress animated update, schedule this call for when that update finishes
|
|
4544
4598
|
if (this.isUpdatingData) {
|
|
4545
4599
|
var self = this;
|
|
4546
4600
|
this.registerDataCompletionCallback(function () {
|
|
@@ -4571,7 +4625,8 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4571
4625
|
BMAnimationContextBeginStatic();
|
|
4572
4626
|
|
|
4573
4627
|
let resolveLayoutUpdate;
|
|
4574
|
-
|
|
4628
|
+
const dataUpdatePromise = new Promise($1 => resolveLayoutUpdate = $1);
|
|
4629
|
+
this._dataUpdatePromise = dataUpdatePromise;
|
|
4575
4630
|
|
|
4576
4631
|
// Discard the cached attribute pages
|
|
4577
4632
|
this.attributeCache = {};
|
|
@@ -4590,8 +4645,14 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4590
4645
|
var animationCells = [];
|
|
4591
4646
|
|
|
4592
4647
|
for (var i = 0; i < retainedCellsLength; i++) {
|
|
4593
|
-
|
|
4594
|
-
|
|
4648
|
+
const cell = this.allCells[i];
|
|
4649
|
+
|
|
4650
|
+
// Skip over any cells that are in the process of being deleted
|
|
4651
|
+
if (cell._reuseState == BMCollectionViewCellReuseState.Deleting) {
|
|
4652
|
+
continue;
|
|
4653
|
+
}
|
|
4654
|
+
currentAttributes.push(cell.attributes);
|
|
4655
|
+
animationCells.push(cell);
|
|
4595
4656
|
}
|
|
4596
4657
|
|
|
4597
4658
|
var oldOffset = this.scrollOffset;
|
|
@@ -4791,7 +4852,6 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4791
4852
|
var animationOptions = BMExtend({
|
|
4792
4853
|
duration: _BMCollectionViewAnimationDurationDefault,
|
|
4793
4854
|
easing: _BMCollectionViewAnimationEasingDefault,
|
|
4794
|
-
queue: '_BMCollectionViewTransitionLayoutQueue'
|
|
4795
4855
|
}, delegateOptions);
|
|
4796
4856
|
|
|
4797
4857
|
/*animationOptions.progress = function (elements, complete, remaining, start, tween) {
|
|
@@ -4855,16 +4915,21 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4855
4915
|
}
|
|
4856
4916
|
}
|
|
4857
4917
|
|
|
4858
|
-
self.
|
|
4859
|
-
|
|
4918
|
+
self._applyOverflows();
|
|
4919
|
+
|
|
4920
|
+
// Restore collection invoke the data completion callbacks unless another animation is in progress
|
|
4921
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
4922
|
+
self._collectionEnabled = YES;
|
|
4923
|
+
self.isUpdatingData = NO;
|
|
4924
|
+
|
|
4925
|
+
self._executeDataCompletionCallbacks();
|
|
4926
|
+
}
|
|
4927
|
+
|
|
4928
|
+
// If the delegate animation options contains a complete handler, invoke it here
|
|
4929
|
+
if (delegateOptions.complete) delegateOptions.complete();
|
|
4860
4930
|
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
// If the delegate animation options contains a complete handler, invoke it here
|
|
4864
|
-
if (delegateOptions.complete) delegateOptions.complete();
|
|
4865
|
-
|
|
4866
|
-
// Run the completion handler if it was specified
|
|
4867
|
-
if (options && options.completionHandler) options.completionHandler();
|
|
4931
|
+
// Run the completion handler if it was specified
|
|
4932
|
+
if (options && options.completionHandler) options.completionHandler();
|
|
4868
4933
|
|
|
4869
4934
|
resolveLayoutUpdate();
|
|
4870
4935
|
};
|
|
@@ -5055,6 +5120,14 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5055
5120
|
* This promise resolves resolves when the operation and its associated animations complete.
|
|
5056
5121
|
*/
|
|
5057
5122
|
_dataUpdatePromise: undefined, // <Promise<void>, nullable>
|
|
5123
|
+
|
|
5124
|
+
/**
|
|
5125
|
+
* A promise initialized during data updates or similar operations such as animated layout updates.
|
|
5126
|
+
* This promise resolves resolves when the operation and its associated animations complete.
|
|
5127
|
+
*/
|
|
5128
|
+
get dataUpdated() { // <Promise<void>, nullable>
|
|
5129
|
+
return this._dataUpdatePromise;
|
|
5130
|
+
},
|
|
5058
5131
|
|
|
5059
5132
|
/**
|
|
5060
5133
|
* Should be invoked when the entire data set is updated in bulk.
|
|
@@ -5083,11 +5156,13 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5083
5156
|
var self = this;
|
|
5084
5157
|
|
|
5085
5158
|
let resolveUpdateData;
|
|
5086
|
-
|
|
5159
|
+
const dataUpdatePromise = new Promise(function (resolve, reject) {resolveUpdateData = resolve});
|
|
5160
|
+
this._dataUpdatePromise = dataUpdatePromise;
|
|
5087
5161
|
|
|
5088
5162
|
// Update the selection index paths
|
|
5089
5163
|
this._updateSelectionIndexPaths();
|
|
5090
5164
|
|
|
5165
|
+
// When not animated, invalidate the layout, to obtain the new set of cells that should be displayed
|
|
5091
5166
|
if (!animated) {
|
|
5092
5167
|
this.layout.collectionViewWillStartUpdates(undefined);
|
|
5093
5168
|
|
|
@@ -5098,14 +5173,20 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5098
5173
|
self.layout.collectionViewDidStartUpdates();
|
|
5099
5174
|
|
|
5100
5175
|
// Have the data set refresh the contents of each cell
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
if (
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5176
|
+
if (this._usesLegacyDataSet) {
|
|
5177
|
+
for (let i = 0; i < this.allCells.length; i++) {
|
|
5178
|
+
let cell = this.allCells[i];
|
|
5179
|
+
|
|
5180
|
+
if (cell.itemType === BMCollectionViewLayoutAttributesType.Cell) {
|
|
5181
|
+
if (this.dataSet.updateCell) {
|
|
5182
|
+
this.dataSet.updateCell(cell, {atIndexPath: cell.indexPath});
|
|
5183
|
+
}
|
|
5184
|
+
}
|
|
5185
|
+
else if (cell.itemType === BMCollectionViewLayoutAttributesType.SupplementaryView) {
|
|
5186
|
+
if (this.dataSet.updateSupplementaryView) {
|
|
5187
|
+
this.dataSet.updateSupplementaryView(cell, {withIdentifier: cell.reuseIdentifier, atIndexPath: cell.indexPath});
|
|
5188
|
+
}
|
|
5189
|
+
}
|
|
5109
5190
|
}
|
|
5110
5191
|
}
|
|
5111
5192
|
|
|
@@ -5184,7 +5265,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5184
5265
|
this._size = currentSize;
|
|
5185
5266
|
|
|
5186
5267
|
// Disable scrolling and interaction during update
|
|
5187
|
-
this._container[0].style.pointerEvents = 'none';
|
|
5268
|
+
this._container[0].style.pointerEvents = 'none';
|
|
5188
5269
|
var containerScrollOffset = this.scrollOffset;
|
|
5189
5270
|
if (!this.iScroll) this._container[0].scrollTo(containerScrollOffset.x, containerScrollOffset.y);
|
|
5190
5271
|
if (this.scrollView) this.scrollView.scrollingEnabled = NO;
|
|
@@ -5214,6 +5295,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5214
5295
|
// Compare the current content to the new content and data set
|
|
5215
5296
|
for (var i = 0; i < oldCells.length; i++) {
|
|
5216
5297
|
var cell = oldCells[i];
|
|
5298
|
+
|
|
5299
|
+
// If this cell is in the process of being deleted by a previous data update, don't do any
|
|
5300
|
+
// additional processing on it
|
|
5301
|
+
if (cell._reuseState == BMCollectionViewCellReuseState.Deleting) {
|
|
5302
|
+
continue;
|
|
5303
|
+
}
|
|
5217
5304
|
|
|
5218
5305
|
var foundCell = NO;
|
|
5219
5306
|
|
|
@@ -5485,11 +5572,10 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5485
5572
|
}
|
|
5486
5573
|
animationComplete = YES;
|
|
5487
5574
|
|
|
5488
|
-
// Apply the new size now
|
|
5489
|
-
if (
|
|
5575
|
+
// Apply the new size now, unless another animation is in progress
|
|
5576
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
5577
|
+
const contentSize = self.layout.contentSize();
|
|
5490
5578
|
self._contentWrapper.css({width: contentSize.width + 'px'});
|
|
5491
|
-
}
|
|
5492
|
-
if (!contentSizeHeightApplied) {
|
|
5493
5579
|
self._contentWrapper.css({height: contentSize.height + 'px'});
|
|
5494
5580
|
}
|
|
5495
5581
|
|
|
@@ -5514,17 +5600,21 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5514
5600
|
deletedCells[i].recycle();
|
|
5515
5601
|
}
|
|
5516
5602
|
|
|
5517
|
-
|
|
5518
|
-
self.
|
|
5603
|
+
// If another update is not in progress, re-enable scrolling and collection
|
|
5604
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
5605
|
+
self._applyOverflows();
|
|
5606
|
+
self._container[0].style.pointerEvents = 'inherit';//.css({'pointer-events': 'inherit'});
|
|
5607
|
+
|
|
5608
|
+
if (self.scrollView) self.scrollView.scrollingEnabled = YES;
|
|
5519
5609
|
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
self._collectionEnabled = YES;
|
|
5523
|
-
|
|
5524
|
-
// Set the updating flag back to NO
|
|
5525
|
-
self.isUpdatingData = NO;
|
|
5610
|
+
self._collectionEnabled = YES;
|
|
5526
5611
|
|
|
5527
|
-
|
|
5612
|
+
// Set the updating flag back to NO
|
|
5613
|
+
self.isUpdatingData = NO;
|
|
5614
|
+
|
|
5615
|
+
// Only execute data completion callbacks after all pending updates have finished
|
|
5616
|
+
self._executeDataCompletionCallbacks();
|
|
5617
|
+
}
|
|
5528
5618
|
|
|
5529
5619
|
if (options && options.completionHandler) options.completionHandler();
|
|
5530
5620
|
if (delegateOptions.complete) delegateOptions.complete.apply(this, arguments);
|
|
@@ -5592,7 +5682,13 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5592
5682
|
|
|
5593
5683
|
let animationBlock = function () {
|
|
5594
5684
|
|
|
5595
|
-
// Apply the animations
|
|
5685
|
+
// Apply the animations that have been previously prepared on each cell
|
|
5686
|
+
|
|
5687
|
+
// Update the state of the cells that are being deleted, this will allow future animations
|
|
5688
|
+
// to skip animating them
|
|
5689
|
+
for (const cell of deletedCells) {
|
|
5690
|
+
cell._reuseState = BMCollectionViewCellReuseState.Deleting;
|
|
5691
|
+
}
|
|
5596
5692
|
|
|
5597
5693
|
// Apply the drop shadow animations if needed
|
|
5598
5694
|
if (self._droppedShadows) {
|
|
@@ -5983,7 +6079,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5983
6079
|
animation.targets.push({element: self._container[0], properties: {tween: 1}, complete: _ => {
|
|
5984
6080
|
self._container[0].style.pointerEvents = 'inherit';
|
|
5985
6081
|
self._isPerformingAnimatedScrolling = NO;
|
|
5986
|
-
}, options: {progress: progress
|
|
6082
|
+
}, options: {progress: progress}});
|
|
5987
6083
|
},
|
|
5988
6084
|
targetOffset: offset.copy(),
|
|
5989
6085
|
startingOffset: self.scrollOffset.copy()
|
|
@@ -6266,4 +6362,154 @@ export function BMCollectionViewMakeWithContainer(container, options) {
|
|
|
6266
6362
|
return new BMCollectionView().initWithDOMNode(container[0], options);
|
|
6267
6363
|
}
|
|
6268
6364
|
|
|
6269
|
-
// @endtype
|
|
6365
|
+
// @endtype
|
|
6366
|
+
|
|
6367
|
+
// #region Data Set Adapter
|
|
6368
|
+
|
|
6369
|
+
// A class that makes it possible to use the data source interface for collection views
|
|
6370
|
+
// that are still configured using the deprecated data set objects. These objects are automatically
|
|
6371
|
+
// created by collection views when the `dataSet` property is set.
|
|
6372
|
+
class BMCollectionViewDataSourceAdapter {
|
|
6373
|
+
constructor(dataSet) {
|
|
6374
|
+
this._dataSet = dataSet;
|
|
6375
|
+
}
|
|
6376
|
+
|
|
6377
|
+
collectionViewNumberOfSections(collectionView) {
|
|
6378
|
+
return this._dataSet.numberOfSections();
|
|
6379
|
+
}
|
|
6380
|
+
|
|
6381
|
+
collectionViewNumberOfObjectsInSectionAtIndex(collectionView, index) {
|
|
6382
|
+
return this._dataSet.numberOfObjectsInSectionAtIndex(index);
|
|
6383
|
+
}
|
|
6384
|
+
|
|
6385
|
+
collectionViewIndexPathForObjectAtRow(collectionView, row, args) {
|
|
6386
|
+
return this._dataSet.indexPathForObjectAtRow(row, args);
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6389
|
+
collectionViewIndexPathForObject(collectionView, object) {
|
|
6390
|
+
return this._dataSet.indexPathForObject(object);
|
|
6391
|
+
}
|
|
6392
|
+
|
|
6393
|
+
collectionViewCellForItemAtIndexPath(collectionView, indexPath) {
|
|
6394
|
+
return this._dataSet.cellForItemAtIndexPath(indexPath);
|
|
6395
|
+
}
|
|
6396
|
+
|
|
6397
|
+
collectionViewCellForSupplementaryViewWithIdentifier(collectionView, identifier, args) {
|
|
6398
|
+
return this._dataSet.cellForSupplementaryViewWithIdentifier(identifier, args);
|
|
6399
|
+
}
|
|
6400
|
+
|
|
6401
|
+
collectionViewUseOldData(collectionView, use) {
|
|
6402
|
+
return this._dataSet.useOldData(use);
|
|
6403
|
+
}
|
|
6404
|
+
|
|
6405
|
+
collectionViewIsUsingOldData(collectionView) {
|
|
6406
|
+
return this._dataSet.isUsingOldData();
|
|
6407
|
+
}
|
|
6408
|
+
|
|
6409
|
+
collectionViewMoveItemFromIndexPath(collectionView, indexPath, args) {
|
|
6410
|
+
return this._dataSet.moveItemFromIndexPath(indexPath, args);
|
|
6411
|
+
}
|
|
6412
|
+
|
|
6413
|
+
collectionViewMoveItemsFromIndexPaths(collectionView, indexPaths, args) {
|
|
6414
|
+
return this._dataSet.moveItemsFromIndexPaths(indexPaths, args);
|
|
6415
|
+
}
|
|
6416
|
+
|
|
6417
|
+
collectionViewRemoveItemsAtIndexPaths(collectionView, indexPaths) {
|
|
6418
|
+
return this._dataSet.removeItemsAtIndexPaths(indexPaths);
|
|
6419
|
+
}
|
|
6420
|
+
|
|
6421
|
+
collectionViewInsertItems(collectionView, items, args) {
|
|
6422
|
+
return this._dataSet.insertItems(items, args);
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6425
|
+
static adapterWithDataSet(dataSet) {
|
|
6426
|
+
return new this(dataSet);
|
|
6427
|
+
}
|
|
6428
|
+
}
|
|
6429
|
+
|
|
6430
|
+
// #endregion
|
|
6431
|
+
|
|
6432
|
+
|
|
6433
|
+
|
|
6434
|
+
// #region Data Set Adapter
|
|
6435
|
+
|
|
6436
|
+
// A class that makes it possible to use the old data set interface for collection views
|
|
6437
|
+
// that are configured using data source objects for compatibility with older code that still
|
|
6438
|
+
// references the deprecated data set property. These objects are automatically
|
|
6439
|
+
// created by collection views when the `dataSource` property is set.
|
|
6440
|
+
class BMCollectionViewDataSetAdapter {
|
|
6441
|
+
constructor(collectionView, dataSource) {
|
|
6442
|
+
this._collectionView = collectionView;
|
|
6443
|
+
this._dataSource = dataSource;
|
|
6444
|
+
}
|
|
6445
|
+
|
|
6446
|
+
numberOfSections() {
|
|
6447
|
+
return this._dataSource.collectionViewNumberOfSections(this._collectionView);
|
|
6448
|
+
}
|
|
6449
|
+
|
|
6450
|
+
numberOfObjectsInSectionAtIndex(index) {
|
|
6451
|
+
return this._dataSource.collectionViewNumberOfObjectsInSectionAtIndex(this._collectionView, index);
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
indexPathForObjectAtRow(row, args) {
|
|
6455
|
+
return this._dataSource.collectionViewNumberOfObjectsInSectionAtIndex(this._collectionView, row, args);
|
|
6456
|
+
}
|
|
6457
|
+
|
|
6458
|
+
indexPathForObject(object) {
|
|
6459
|
+
return this._dataSource.collectionViewIndexPathForObject(this._collectionView, object);
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6462
|
+
contentsForCellWithReuseIdentifier(identifier) {
|
|
6463
|
+
throw new Error(`contentsForCellWithReuseIdentifier is unsupported when using data source objects`);
|
|
6464
|
+
}
|
|
6465
|
+
|
|
6466
|
+
cellForItemAtIndexPath(indexPath) {
|
|
6467
|
+
return this._dataSource.collectionViewCellForItemAtIndexPath(this._collectionView, indexPath);
|
|
6468
|
+
}
|
|
6469
|
+
|
|
6470
|
+
contentsForSupplementaryViewWithIdentifier(identifier) {
|
|
6471
|
+
throw new Error(`contentsForSupplementaryViewWithIdentifier is unsupported when using data source objects`);
|
|
6472
|
+
}
|
|
6473
|
+
|
|
6474
|
+
cellForSupplementaryViewWithIdentifier(identifier, args) {
|
|
6475
|
+
return this._dataSource.collectionViewCellForSupplementaryViewWithIdentifier(this._collectionView, identifier, args);
|
|
6476
|
+
}
|
|
6477
|
+
|
|
6478
|
+
updateCell(cell, {atIndexPath: indexPath}) {
|
|
6479
|
+
throw new Error(`updateCell is unsupported when using data source objects`);
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6482
|
+
updateSupplementaryView(view, {withIdentifier: identifier, atIndexPath: indexPath}) {
|
|
6483
|
+
throw new Error(`updateSupplementaryView is unsupported when using data source objects`);
|
|
6484
|
+
}
|
|
6485
|
+
|
|
6486
|
+
useOldData(use) {
|
|
6487
|
+
return this._dataSource.collectionViewUseOldData(this._collectionView, use);
|
|
6488
|
+
}
|
|
6489
|
+
|
|
6490
|
+
isUsingOldData() {
|
|
6491
|
+
return this._dataSource.collectionViewIsUsingOldData(this._collectionView);
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6494
|
+
moveItemFromIndexPath(indexPath, args) {
|
|
6495
|
+
return this._dataSource.collectionViewMoveItemFromIndexPath(this._collectionView, indexPath, args);
|
|
6496
|
+
}
|
|
6497
|
+
|
|
6498
|
+
moveItemsFromIndexPaths(indexPaths, args) {
|
|
6499
|
+
return this._dataSource.collectionViewMoveItemsFromIndexPaths(this._collectionView, indexPaths, args);
|
|
6500
|
+
}
|
|
6501
|
+
|
|
6502
|
+
removeItemsAtIndexPaths(indexPaths) {
|
|
6503
|
+
return this._dataSource.collectionViewRemoveItemsAtIndexPaths(this._collectionView, indexPaths);
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6506
|
+
insertItems(items, args) {
|
|
6507
|
+
return this._dataSource.collectionViewInsertItems(this._collectionView, items, args);
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6510
|
+
static adapterWithDataSource(collectionView, dataSource) {
|
|
6511
|
+
return new this(collectionView, dataSource);
|
|
6512
|
+
}
|
|
6513
|
+
}
|
|
6514
|
+
|
|
6515
|
+
// #endregion
|