@nativescript-community/ui-pager 13.0.33 → 13.0.36
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/CHANGELOG.md +24 -0
- package/angular/esm2020/index.mjs +55 -0
- package/angular/{esm2015/nativescript-community-ui-pager-angular.js → esm2020/nativescript-community-ui-pager-angular.mjs} +0 -0
- package/angular/esm2020/pager-items-comp.mjs +304 -0
- package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs +379 -0
- package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs.map +1 -0
- package/angular/{fesm2015/nativescript-community-ui-pager-angular.js → fesm2020/nativescript-community-ui-pager-angular.mjs} +15 -24
- package/angular/fesm2020/nativescript-community-ui-pager-angular.mjs.map +1 -0
- package/angular/package.json +20 -6
- package/index.android.js +336 -350
- package/index.android.js.map +1 -1
- package/index.common.d.ts +1 -4
- package/index.common.js +4 -7
- package/index.common.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.ios.d.ts +15 -15
- package/index.ios.js +259 -375
- package/index.ios.js.map +1 -1
- package/package.json +9 -4
- package/react/index.d.ts +5 -5
- package/react/index.js +4 -2
- package/react/index.js.map +1 -1
- package/references.d.ts +1 -0
- package/svelte/index.js +3 -2
- package/svelte/index.js.map +1 -1
- package/typings/objc!CHIPageControl.d.ts +197 -0
- package/vue/pager.js +15 -15
- package/vue/pager.js.map +1 -1
- package/.pnpm-debug.log +0 -1
- package/angular/bundles/nativescript-community-ui-pager-angular.umd.js +0 -759
- package/angular/bundles/nativescript-community-ui-pager-angular.umd.js.map +0 -1
- package/angular/esm2015/index.js +0 -55
- package/angular/esm2015/pager-items-comp.js +0 -312
- package/angular/fesm2015/nativescript-community-ui-pager-angular.js.map +0 -1
package/index.ios.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
var PagerCell_1, UICollectionDelegateImpl_1, UICollectionViewDataSourceImpl_1, UICollectionViewFlowLinearLayoutImpl_1;
|
2
|
+
import { ChangeType, Color, Observable, ObservableArray, Property, ProxyViewContainer, StackLayout, Utils, View, ViewBase, profile } from '@nativescript/core';
|
2
3
|
import { layout } from '@nativescript/core/utils/utils';
|
3
|
-
import {
|
4
|
+
import { Indicator, PagerBase, PagerItem, autoPlayProperty, autoplayDelayProperty, disableSwipeProperty, indicatorColorProperty, indicatorProperty, indicatorSelectedColorProperty, itemTemplatesProperty, itemsProperty, orientationProperty, selectedIndexProperty, showIndicatorProperty } from './index.common';
|
4
5
|
export * from './index.common';
|
5
6
|
export { Transformer } from './index.common';
|
6
7
|
function notifyForItemAtIndex(owner, nativeView, view, eventName, index) {
|
@@ -46,47 +47,45 @@ export const contentInsetAdjustmentBehaviorProperty = new Property({
|
|
46
47
|
valueConverter: parseContentInsetAdjustmentBehavior,
|
47
48
|
defaultValue: ContentInsetAdjustmentBehavior.Automatic
|
48
49
|
});
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
53
|
-
}
|
54
|
-
UICellView.prototype.layoutSubviews = function () {
|
55
|
-
var view = this.view && this.view.get();
|
50
|
+
let UICellView = class UICellView extends UIView {
|
51
|
+
layoutSubviews() {
|
52
|
+
const view = this.view && this.view.get();
|
56
53
|
if (!view) {
|
57
54
|
return;
|
58
55
|
}
|
59
56
|
this.frame = this.superview.bounds;
|
60
|
-
|
57
|
+
const size = this.bounds.size;
|
61
58
|
View.layoutChild(null, view, 0, 0, Utils.layout.toDevicePixels(size.width), Utils.layout.toDevicePixels(size.height));
|
62
|
-
}
|
63
|
-
|
64
|
-
|
59
|
+
}
|
60
|
+
};
|
61
|
+
UICellView = __decorate([
|
62
|
+
NativeClass
|
63
|
+
], UICellView);
|
65
64
|
const PFLAG_FORCE_LAYOUT = 1;
|
66
65
|
export class Pager extends PagerBase {
|
67
66
|
constructor() {
|
68
67
|
super();
|
69
68
|
this.lastEvent = 0;
|
70
|
-
this.
|
71
|
-
this.
|
72
|
-
this.
|
73
|
-
this.
|
74
|
-
this.
|
75
|
-
this.
|
76
|
-
this.
|
69
|
+
this.mDisableSwipe = false;
|
70
|
+
this.mDisableAnimation = false;
|
71
|
+
this.mPreparingCell = false;
|
72
|
+
this.mIsRefreshing = false;
|
73
|
+
this.mIsInit = false;
|
74
|
+
this.mInnerWidth = 0;
|
75
|
+
this.mInnerHeight = 0;
|
77
76
|
this._observableArrayHandler = (args) => {
|
78
77
|
if (!this.pager) {
|
79
78
|
return;
|
80
79
|
}
|
81
|
-
if (this.indicatorView && this.
|
82
|
-
this.indicatorView.numberOfPages = this.
|
80
|
+
if (this.indicatorView && this.mObservableArrayInstance && this.mObservableArrayInstance.length) {
|
81
|
+
this.indicatorView.numberOfPages = this.mObservableArrayInstance.length;
|
83
82
|
}
|
84
83
|
const collectionView = this.pager;
|
85
84
|
if (collectionView) {
|
86
85
|
try {
|
87
86
|
let offset = 0;
|
88
87
|
collectionView.performBatchUpdatesCompletion(() => {
|
89
|
-
this.
|
88
|
+
this.mIsRefreshing = true;
|
90
89
|
const array = [];
|
91
90
|
switch (args.action) {
|
92
91
|
case ChangeType.Add:
|
@@ -125,7 +124,7 @@ export class Pager extends PagerBase {
|
|
125
124
|
}
|
126
125
|
this._initAutoPlay(this.autoPlay);
|
127
126
|
if (this.itemCount === 0) {
|
128
|
-
this.
|
127
|
+
this.mIsInit = false;
|
129
128
|
}
|
130
129
|
}, null);
|
131
130
|
}
|
@@ -134,20 +133,20 @@ export class Pager extends PagerBase {
|
|
134
133
|
};
|
135
134
|
this._isDataDirty = false;
|
136
135
|
this.iosOverflowSafeAreaEnabledLayoutHackNeeded = true;
|
137
|
-
this.
|
136
|
+
this.mMap = new Map();
|
138
137
|
}
|
139
138
|
get pager() {
|
140
|
-
return this.
|
139
|
+
return this.mPager;
|
141
140
|
}
|
142
141
|
get indicatorView() {
|
143
|
-
return this.
|
142
|
+
return this.mIndicatorView;
|
144
143
|
}
|
145
144
|
createNativeView() {
|
146
145
|
const nativeView = UIView.new();
|
147
|
-
this.
|
148
|
-
this.
|
149
|
-
this.
|
150
|
-
const pager = (this.
|
146
|
+
this.mLayout = UICollectionViewFlowLinearLayoutImpl.initWithOwner(new WeakRef(this));
|
147
|
+
this.mLayout.scrollDirection = 1;
|
148
|
+
this.mLayout.minimumInteritemSpacing = 0;
|
149
|
+
const pager = (this.mPager = UICollectionView.alloc().initWithFrameCollectionViewLayout(CGRectZero, this.mLayout));
|
151
150
|
pager.backgroundColor = UIColor.clearColor;
|
152
151
|
pager.autoresizesSubviews = false;
|
153
152
|
pager.autoresizingMask = 0;
|
@@ -161,20 +160,23 @@ export class Pager extends PagerBase {
|
|
161
160
|
super.initNativeView();
|
162
161
|
const nativeView = this.pager;
|
163
162
|
nativeView.registerClassForCellWithReuseIdentifier(PagerCell.class(), this._defaultTemplate.key);
|
164
|
-
nativeView.
|
163
|
+
nativeView.backgroundColor = UIColor.clearColor;
|
164
|
+
nativeView.autoresizesSubviews = false;
|
165
|
+
nativeView.autoresizingMask = 0;
|
166
|
+
nativeView.dataSource = this.mDataSource = UICollectionViewDataSourceImpl.initWithOwner(new WeakRef(this));
|
165
167
|
nativeView.scrollEnabled = !this.disableSwipe;
|
166
168
|
if (this.orientation === 'vertical') {
|
167
|
-
this.
|
169
|
+
this.mLayout.scrollDirection = 0;
|
168
170
|
nativeView.alwaysBounceVertical = true;
|
169
171
|
nativeView.alwaysBounceHorizontal = false;
|
170
172
|
}
|
171
173
|
else {
|
172
|
-
this.
|
174
|
+
this.mLayout.scrollDirection = 1;
|
173
175
|
nativeView.alwaysBounceHorizontal = true;
|
174
176
|
nativeView.alwaysBounceVertical = false;
|
175
177
|
}
|
176
178
|
this._setIndicator(this.indicator);
|
177
|
-
this.
|
179
|
+
this.mDelegate = UICollectionDelegateImpl.initWithOwner(new WeakRef(this));
|
178
180
|
this._setNativeClipToBounds();
|
179
181
|
this._initAutoPlay(this.autoPlay);
|
180
182
|
}
|
@@ -250,33 +252,47 @@ export class Pager extends PagerBase {
|
|
250
252
|
return this.lastIndex;
|
251
253
|
}
|
252
254
|
_setIndicator(value) {
|
253
|
-
if (this.
|
254
|
-
this.
|
255
|
+
if (this.mIndicatorView) {
|
256
|
+
this.mIndicatorView.removeFromSuperview();
|
255
257
|
}
|
256
258
|
switch (value) {
|
257
259
|
case Indicator.None:
|
258
|
-
this.
|
260
|
+
this.mIndicatorView = CHIPageControlAji.new();
|
259
261
|
break;
|
260
262
|
case Indicator.Worm:
|
261
|
-
this.
|
263
|
+
this.mIndicatorView = CHIPageControlAleppo.new();
|
262
264
|
break;
|
263
265
|
case Indicator.Fill:
|
264
|
-
this.
|
266
|
+
this.mIndicatorView = CHIPageControlChimayo.new();
|
265
267
|
break;
|
266
268
|
case Indicator.Swap:
|
267
|
-
this.
|
269
|
+
this.mIndicatorView = CHIPageControlPuya.new();
|
268
270
|
break;
|
269
271
|
case Indicator.THIN_WORM:
|
270
|
-
this.
|
272
|
+
this.mIndicatorView = CHIPageControlJalapeno.new();
|
271
273
|
break;
|
272
274
|
case Indicator.Flat:
|
273
|
-
this.
|
275
|
+
this.mIndicatorView = CHIPageControlJaloro.new();
|
274
276
|
break;
|
275
277
|
default:
|
276
278
|
break;
|
277
279
|
}
|
278
|
-
this.
|
279
|
-
this.
|
280
|
+
this.mIndicatorView.tintColor = UIColor.whiteColor;
|
281
|
+
this.mIndicatorView.currentPageTintColor = UIColor.whiteColor;
|
282
|
+
switch (value) {
|
283
|
+
case Indicator.None:
|
284
|
+
case Indicator.Worm:
|
285
|
+
case Indicator.Fill:
|
286
|
+
case Indicator.Swap:
|
287
|
+
case Indicator.THIN_WORM:
|
288
|
+
case Indicator.Disabled:
|
289
|
+
this.mIndicatorView.radius = 4;
|
290
|
+
break;
|
291
|
+
case Indicator.Flat:
|
292
|
+
this.mIndicatorView.radius = 2;
|
293
|
+
this.mIndicatorView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.7, 0.5);
|
294
|
+
break;
|
295
|
+
}
|
280
296
|
}
|
281
297
|
get _childrenCount() {
|
282
298
|
var _a, _b;
|
@@ -288,17 +304,17 @@ export class Pager extends PagerBase {
|
|
288
304
|
}
|
289
305
|
[orientationProperty.setNative](value) {
|
290
306
|
if (value === 'horizontal') {
|
291
|
-
this.
|
307
|
+
this.mLayout.scrollDirection = 1;
|
292
308
|
}
|
293
309
|
else {
|
294
|
-
this.
|
310
|
+
this.mLayout.scrollDirection = 0;
|
295
311
|
}
|
296
312
|
}
|
297
313
|
eachChildView(callback) {
|
298
|
-
this.
|
314
|
+
this.mMap.forEach((view, key) => callback(view));
|
299
315
|
}
|
300
316
|
eachChild(callback) {
|
301
|
-
this.
|
317
|
+
this.mMap.forEach((view, key) => callback(view));
|
302
318
|
}
|
303
319
|
_updateScrollPosition() {
|
304
320
|
const view = this.pager;
|
@@ -329,19 +345,19 @@ export class Pager extends PagerBase {
|
|
329
345
|
if (this.indicatorView && value && value.length) {
|
330
346
|
this.indicatorView.numberOfPages = value.length;
|
331
347
|
}
|
332
|
-
if (this.
|
333
|
-
this.
|
334
|
-
this.
|
348
|
+
if (this.mObservableArrayInstance) {
|
349
|
+
this.mObservableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
|
350
|
+
this.mObservableArrayInstance = null;
|
335
351
|
}
|
336
352
|
if (value instanceof ObservableArray) {
|
337
|
-
this.
|
338
|
-
this.
|
353
|
+
this.mObservableArrayInstance = value;
|
354
|
+
this.mObservableArrayInstance.on(ObservableArray.changeEvent, this._observableArrayHandler);
|
339
355
|
}
|
340
356
|
else {
|
341
357
|
this.refresh();
|
342
358
|
}
|
343
359
|
if (!value) {
|
344
|
-
this.
|
360
|
+
this.mIsInit = false;
|
345
361
|
}
|
346
362
|
selectedIndexProperty.coerce(this);
|
347
363
|
}
|
@@ -403,7 +419,7 @@ export class Pager extends PagerBase {
|
|
403
419
|
}
|
404
420
|
}
|
405
421
|
dispatch_async(main_queue, () => {
|
406
|
-
if (this.
|
422
|
+
if (this.mDataSource.collectionViewNumberOfItemsInSection(this.pager, 0) > maxMinIndex) {
|
407
423
|
this.pager.scrollToItemAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(maxMinIndex, 0), this.orientation === 'vertical' ? 2 : 16, !!animate);
|
408
424
|
}
|
409
425
|
selectedIndexProperty.nativeValueChange(this, maxMinIndex);
|
@@ -418,8 +434,8 @@ export class Pager extends PagerBase {
|
|
418
434
|
return;
|
419
435
|
}
|
420
436
|
this._isDataDirty = false;
|
421
|
-
this.
|
422
|
-
this.
|
437
|
+
this.mLastLayoutKey = this.mInnerWidth + '_' + this.mInnerHeight;
|
438
|
+
this.mMap.forEach((view, nativeView, map) => {
|
423
439
|
if (!(view.bindingContext instanceof Observable)) {
|
424
440
|
view.bindingContext = null;
|
425
441
|
}
|
@@ -434,10 +450,10 @@ export class Pager extends PagerBase {
|
|
434
450
|
if (this.showIndicator && this.indicatorView) {
|
435
451
|
this.nativeView.addSubview(this.indicatorView);
|
436
452
|
}
|
437
|
-
if (this._isDataDirty && this.
|
453
|
+
if (this._isDataDirty && this.mInnerWidth !== undefined && this.mInnerHeight !== undefined) {
|
438
454
|
this.refresh();
|
439
455
|
}
|
440
|
-
this.pager.delegate = this.
|
456
|
+
this.pager.delegate = this.mDelegate;
|
441
457
|
if (!this.items && this._childrenCount > 0) {
|
442
458
|
selectedIndexProperty.coerce(this);
|
443
459
|
this._updateScrollPosition();
|
@@ -450,28 +466,28 @@ export class Pager extends PagerBase {
|
|
450
466
|
super.onUnloaded();
|
451
467
|
}
|
452
468
|
disposeNativeView() {
|
453
|
-
this.
|
454
|
-
this.
|
455
|
-
if (this.
|
456
|
-
this.
|
457
|
-
this.
|
458
|
-
}
|
459
|
-
this.
|
460
|
-
this.
|
461
|
-
if (this.
|
462
|
-
this.
|
463
|
-
this.
|
469
|
+
this.mDelegate = null;
|
470
|
+
this.mDataSource = null;
|
471
|
+
if (this.mPager) {
|
472
|
+
this.mPager.delegate = null;
|
473
|
+
this.mPager = null;
|
474
|
+
}
|
475
|
+
this.mIndicatorView = null;
|
476
|
+
this.mLayout = null;
|
477
|
+
if (this.mObservableArrayInstance) {
|
478
|
+
this.mObservableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
|
479
|
+
this.mObservableArrayInstance = null;
|
464
480
|
}
|
465
481
|
this.clearRealizedCells();
|
466
482
|
super.disposeNativeView();
|
467
483
|
}
|
468
484
|
clearRealizedCells() {
|
469
485
|
const that = new WeakRef(this);
|
470
|
-
this.
|
486
|
+
this.mMap.forEach(function (value, key) {
|
471
487
|
that.get()._removeContainer(key);
|
472
488
|
that.get()._clearCellViews(key);
|
473
489
|
}, that);
|
474
|
-
this.
|
490
|
+
this.mMap.clear();
|
475
491
|
}
|
476
492
|
_clearCellViews(cell) {
|
477
493
|
const view = cell.view;
|
@@ -482,8 +498,8 @@ export class Pager extends PagerBase {
|
|
482
498
|
this._removeView(view.parent);
|
483
499
|
}
|
484
500
|
cell.owner = undefined;
|
485
|
-
const preparing = this.
|
486
|
-
this.
|
501
|
+
const preparing = this.mPreparingCell;
|
502
|
+
this.mPreparingCell = true;
|
487
503
|
if (view.parent && !(view.parent instanceof Pager)) {
|
488
504
|
if (!(view.parent instanceof Pager)) {
|
489
505
|
this._removeView(view.parent);
|
@@ -492,8 +508,8 @@ export class Pager extends PagerBase {
|
|
492
508
|
view.parent._removeView(view);
|
493
509
|
}
|
494
510
|
}
|
495
|
-
this.
|
496
|
-
this.
|
511
|
+
this.mPreparingCell = preparing;
|
512
|
+
this.mMap.delete(cell);
|
497
513
|
}
|
498
514
|
[indicatorProperty.setNative](value) {
|
499
515
|
this._setIndicator(value);
|
@@ -511,22 +527,22 @@ export class Pager extends PagerBase {
|
|
511
527
|
}
|
512
528
|
}
|
513
529
|
[disableSwipeProperty.setNative](value) {
|
514
|
-
this.
|
515
|
-
this.
|
530
|
+
this.mPager.scrollEnabled = !value;
|
531
|
+
this.mDisableSwipe = value;
|
516
532
|
}
|
517
533
|
[contentInsetAdjustmentBehaviorProperty.setNative](value) {
|
518
|
-
this.
|
534
|
+
this.mPager.contentInsetAdjustmentBehavior = value;
|
519
535
|
}
|
520
536
|
get disableAnimation() {
|
521
|
-
return this.
|
537
|
+
return this.mDisableAnimation;
|
522
538
|
}
|
523
539
|
set disableAnimation(value) {
|
524
|
-
this.
|
540
|
+
this.mDisableAnimation = value;
|
525
541
|
}
|
526
542
|
_removeContainer(cell, index) {
|
527
543
|
let view = cell.view;
|
528
544
|
const args = {
|
529
|
-
eventName:
|
545
|
+
eventName: Pager.itemDisposingEvent,
|
530
546
|
object: this,
|
531
547
|
index,
|
532
548
|
android: undefined,
|
@@ -541,19 +557,19 @@ export class Pager extends PagerBase {
|
|
541
557
|
}
|
542
558
|
view.parent._removeView(view);
|
543
559
|
}
|
544
|
-
this.
|
560
|
+
this.mMap.delete(cell);
|
545
561
|
}
|
546
562
|
onMeasure(widthMeasureSpec, heightMeasureSpec) {
|
547
563
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
548
|
-
this.
|
564
|
+
this.mMap.forEach((childView, pagerCell) => {
|
549
565
|
View.measureChild(this, childView, childView._currentWidthMeasureSpec, childView._currentHeightMeasureSpec);
|
550
566
|
});
|
551
567
|
}
|
552
568
|
updateInnerSize() {
|
553
569
|
const width = this.getMeasuredWidth();
|
554
570
|
const height = this.getMeasuredHeight();
|
555
|
-
this.
|
556
|
-
this.
|
571
|
+
this.mInnerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
|
572
|
+
this.mInnerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
|
557
573
|
}
|
558
574
|
onLayout(left, top, right, bottom) {
|
559
575
|
super.onLayout(left, top, right, bottom);
|
@@ -571,24 +587,24 @@ export class Pager extends PagerBase {
|
|
571
587
|
}
|
572
588
|
layoutView.invalidateLayout();
|
573
589
|
const size = this._getSize();
|
574
|
-
this.
|
590
|
+
this.mMap.forEach((childView, pagerCell) => {
|
575
591
|
const width = layout.toDevicePixels(size.width);
|
576
592
|
const height = layout.toDevicePixels(size.height);
|
577
593
|
View.layoutChild(this, childView, 0, 0, width, height);
|
578
594
|
});
|
579
|
-
const layoutKey = this.
|
580
|
-
if (this.
|
595
|
+
const layoutKey = this.mInnerWidth + '_' + this.mInnerHeight;
|
596
|
+
if (this.mLastLayoutKey !== layoutKey) {
|
581
597
|
this.refresh();
|
582
598
|
}
|
583
599
|
}
|
584
600
|
requestLayout() {
|
585
|
-
if (!this.
|
601
|
+
if (!this.mPreparingCell) {
|
586
602
|
super.requestLayout();
|
587
603
|
}
|
588
604
|
}
|
589
605
|
_prepareCell(cell, indexPath) {
|
590
606
|
try {
|
591
|
-
this.
|
607
|
+
this.mPreparingCell = true;
|
592
608
|
const index = indexPath.row;
|
593
609
|
let view = cell.view;
|
594
610
|
const template = this._getItemTemplate(indexPath.row);
|
@@ -600,7 +616,7 @@ export class Pager extends PagerBase {
|
|
600
616
|
}
|
601
617
|
const bindingContext = this._getDataItem(indexPath.row);
|
602
618
|
const args = {
|
603
|
-
eventName:
|
619
|
+
eventName: Pager.itemLoadingEvent,
|
604
620
|
object: this,
|
605
621
|
index,
|
606
622
|
android: undefined,
|
@@ -619,7 +635,7 @@ export class Pager extends PagerBase {
|
|
619
635
|
cell.owner = new WeakRef(view);
|
620
636
|
}
|
621
637
|
else if (cell.view !== view) {
|
622
|
-
this.
|
638
|
+
this.mMap.delete(cell);
|
623
639
|
this._removeContainer(cell, index);
|
624
640
|
cell.view.nativeViewProtected.removeFromSuperview();
|
625
641
|
cell.owner = new WeakRef(view);
|
@@ -627,7 +643,7 @@ export class Pager extends PagerBase {
|
|
627
643
|
if (view) {
|
628
644
|
view.bindingContext = bindingContext;
|
629
645
|
}
|
630
|
-
this.
|
646
|
+
this.mMap.set(cell, view);
|
631
647
|
if (view && !view.parent) {
|
632
648
|
this._addView(view);
|
633
649
|
if (this.iosOverflowSafeArea) {
|
@@ -643,7 +659,7 @@ export class Pager extends PagerBase {
|
|
643
659
|
this._layoutCell(view, indexPath);
|
644
660
|
}
|
645
661
|
finally {
|
646
|
-
this.
|
662
|
+
this.mPreparingCell = false;
|
647
663
|
}
|
648
664
|
}
|
649
665
|
_layoutCell(cellView, index) {
|
@@ -689,49 +705,35 @@ export class Pager extends PagerBase {
|
|
689
705
|
__decorate([
|
690
706
|
profile
|
691
707
|
], Pager.prototype, "refresh", null);
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
get: function () {
|
699
|
-
return this.owner ? this.owner.get() : null;
|
700
|
-
},
|
701
|
-
enumerable: true,
|
702
|
-
configurable: true
|
703
|
-
});
|
704
|
-
PagerCell.initWithEmptyBackground = function () {
|
705
|
-
var cell = PagerCell.new();
|
706
|
-
// Clear background by default - this will make cells transparent
|
708
|
+
let PagerCell = PagerCell_1 = class PagerCell extends UICollectionViewCell {
|
709
|
+
get view() {
|
710
|
+
return this.owner ? this.owner.get() : null;
|
711
|
+
}
|
712
|
+
static initWithEmptyBackground() {
|
713
|
+
const cell = PagerCell_1.new();
|
707
714
|
cell.backgroundColor = null;
|
708
715
|
return cell;
|
709
|
-
}
|
710
|
-
|
711
|
-
|
712
|
-
// When inside Pager and there is no newSuperview this cell is
|
713
|
-
// removed from native visual tree so we remove it from our tree too.
|
716
|
+
}
|
717
|
+
willMoveToSuperview(newSuperview) {
|
718
|
+
const parent = (this.view ? this.view.parent : null);
|
714
719
|
if (parent && !newSuperview) {
|
715
720
|
parent._removeContainer(this, this.index);
|
716
721
|
}
|
717
|
-
}
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
UICollectionDelegateImpl_1 = UICollectionDelegateImpl;
|
726
|
-
UICollectionDelegateImpl.initWithOwner = function (owner) {
|
727
|
-
var delegate = UICollectionDelegateImpl_1.alloc().init();
|
722
|
+
}
|
723
|
+
};
|
724
|
+
PagerCell = PagerCell_1 = __decorate([
|
725
|
+
NativeClass
|
726
|
+
], PagerCell);
|
727
|
+
let UICollectionDelegateImpl = UICollectionDelegateImpl_1 = class UICollectionDelegateImpl extends NSObject {
|
728
|
+
static initWithOwner(owner) {
|
729
|
+
const delegate = UICollectionDelegateImpl_1.alloc().init();
|
728
730
|
delegate._owner = owner;
|
729
731
|
return delegate;
|
730
|
-
}
|
731
|
-
|
732
|
-
|
732
|
+
}
|
733
|
+
collectionViewLayoutInsetForSectionAtIndex(collectionView, collectionViewLayout, section) {
|
734
|
+
const owner = this._owner ? this._owner.get() : null;
|
733
735
|
if (owner) {
|
734
|
-
|
736
|
+
const inset = owner._getSpacing() + owner._getPeaking();
|
735
737
|
if (owner.orientation === 'vertical') {
|
736
738
|
return new UIEdgeInsets({
|
737
739
|
bottom: inset,
|
@@ -748,24 +750,24 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
748
750
|
});
|
749
751
|
}
|
750
752
|
return new UIEdgeInsets({ bottom: 0, left: 0, right: 0, top: 0 });
|
751
|
-
}
|
752
|
-
|
753
|
-
|
753
|
+
}
|
754
|
+
collectionViewLayoutSizeForItemAtIndexPath(collectionView, collectionViewLayout, indexPath) {
|
755
|
+
const owner = this._owner && this._owner.get();
|
754
756
|
if (!owner)
|
755
757
|
return CGSizeZero;
|
756
|
-
|
758
|
+
const size = owner._getSize();
|
757
759
|
return CGSizeMake(size.width, size.height);
|
758
|
-
}
|
759
|
-
|
760
|
-
|
760
|
+
}
|
761
|
+
collectionViewWillDisplayCellForItemAtIndexPath(collectionView, cell, indexPath) {
|
762
|
+
const owner = this._owner && this._owner.get();
|
761
763
|
if (owner) {
|
762
|
-
if (!owner.
|
764
|
+
if (!owner.mIsInit) {
|
763
765
|
owner._updateScrollPosition();
|
764
|
-
owner.
|
766
|
+
owner.mIsInit = true;
|
765
767
|
}
|
766
768
|
if (owner.items && indexPath.row === owner.lastIndex - owner.loadMoreCount) {
|
767
769
|
owner.notify({
|
768
|
-
eventName:
|
770
|
+
eventName: Pager.loadMoreItemsEvent,
|
769
771
|
object: owner
|
770
772
|
});
|
771
773
|
}
|
@@ -776,16 +778,16 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
776
778
|
if (cell.layoutMargins) {
|
777
779
|
cell.layoutMargins = UIEdgeInsetsZero;
|
778
780
|
}
|
779
|
-
}
|
780
|
-
|
781
|
-
|
781
|
+
}
|
782
|
+
collectionViewLayoutMinimumLineSpacingForSectionAtIndex(collectionView, collectionViewLayout, section) {
|
783
|
+
const owner = this._owner ? this._owner.get() : null;
|
782
784
|
if (!owner)
|
783
785
|
return 0;
|
784
|
-
|
786
|
+
const result = owner._getSpacing();
|
785
787
|
return result;
|
786
|
-
}
|
787
|
-
|
788
|
-
|
788
|
+
}
|
789
|
+
scrollViewWillBeginDragging(scrollView) {
|
790
|
+
const owner = this._owner && this._owner.get();
|
789
791
|
if (owner) {
|
790
792
|
if (owner.lastEvent === 0) {
|
791
793
|
owner.notify({
|
@@ -795,23 +797,23 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
795
797
|
owner.lastEvent = 1;
|
796
798
|
}
|
797
799
|
}
|
798
|
-
}
|
799
|
-
|
800
|
-
|
800
|
+
}
|
801
|
+
scrollViewDidEndScrollingAnimation(scrollView) {
|
802
|
+
const owner = this._owner ? this._owner.get() : null;
|
801
803
|
if (owner) {
|
802
804
|
owner.notify({
|
803
805
|
eventName: Pager.swipeEvent,
|
804
806
|
object: owner
|
805
807
|
});
|
806
808
|
}
|
807
|
-
}
|
808
|
-
|
809
|
-
|
809
|
+
}
|
810
|
+
scrollViewDidScroll(scrollView) {
|
811
|
+
const owner = this._owner.get();
|
810
812
|
if (owner) {
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
813
|
+
let width;
|
814
|
+
let offset;
|
815
|
+
const size = owner._getRealWidthHeight();
|
816
|
+
let total;
|
815
817
|
if (owner.orientation === 'vertical') {
|
816
818
|
width = size.height;
|
817
819
|
offset = scrollView.contentOffset.y;
|
@@ -822,14 +824,13 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
822
824
|
offset = scrollView.contentOffset.x;
|
823
825
|
total = scrollView.contentSize.width - scrollView.bounds.size.width;
|
824
826
|
}
|
825
|
-
|
826
|
-
|
827
|
+
const percent = offset / total;
|
828
|
+
const progress = percent * (owner.itemCount - 1);
|
827
829
|
if (owner.indicatorView && owner.indicatorView.setWithProgressAnimated && !Number.isNaN(progress)) {
|
828
830
|
owner.indicatorView.progress = progress;
|
829
831
|
}
|
830
|
-
|
832
|
+
const index = parseInt(progress.toFixed(0), 10);
|
831
833
|
if (owner.selectedIndex !== index && !Number.isNaN(index)) {
|
832
|
-
// selectedIndexProperty.nativeValueChange(owner, index);
|
833
834
|
}
|
834
835
|
owner.notify({
|
835
836
|
object: owner,
|
@@ -846,83 +847,11 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
846
847
|
});
|
847
848
|
owner.lastEvent = 1;
|
848
849
|
}
|
849
|
-
// (scrollView as any).scrollToItemAtIndexPathAtScrollPositionAnimated(
|
850
|
-
// NSIndexPath.indexPathForRowInSection(Math.round(width),0), UICollectionViewScrollPosition.CenteredHorizontally, true
|
851
|
-
// );
|
852
|
-
// if(owner.circularMode){
|
853
|
-
// if(nextIndex === 0){
|
854
|
-
// selectedIndexProperty.nativeValueChange(owner, owner._childrenCount - 3);
|
855
|
-
// }else if(nextIndex === owner._childrenCount -1){
|
856
|
-
// selectedIndexProperty.nativeValueChange(owner, 0);
|
857
|
-
// }else {
|
858
|
-
// selectedIndexProperty.nativeValueChange(owner, nextIndex - 1);
|
859
|
-
// }
|
860
|
-
// }else {
|
861
|
-
// selectedIndexProperty.nativeValueChange(owner, nextIndex);
|
862
|
-
// }
|
863
|
-
/* if (!Number.isNaN(width)) {
|
864
|
-
let page = Math.ceil(width);
|
865
|
-
const doScroll = () => {
|
866
|
-
if (!Number.isNaN(width)) {
|
867
|
-
// scrollView.setContentOffsetAnimated(point, false);
|
868
|
-
scrollView.contentOffset = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
|
869
|
-
}
|
870
|
-
};
|
871
|
-
console.log('page', page, owner.itemCount, page === owner.itemCount);
|
872
|
-
if (page === 0) {
|
873
|
-
page = owner.itemCount - 2;
|
874
|
-
doScroll();
|
875
|
-
// selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
|
876
|
-
} else if (page === owner.itemCount) {
|
877
|
-
page = 1;
|
878
|
-
doScroll();
|
879
|
-
// selectedIndexProperty.nativeValueChange(owner, 0);
|
880
|
-
} else {
|
881
|
-
if (page === owner._childrenCount + 1) {
|
882
|
-
// selectedIndexProperty.nativeValueChange(owner, 0);
|
883
|
-
} else {
|
884
|
-
// selectedIndexProperty.nativeValueChange(owner, page - 1);
|
885
|
-
}
|
886
|
-
|
887
|
-
}
|
888
|
-
} */
|
889
|
-
/* if(owner){
|
890
|
-
let width = 0;
|
891
|
-
let w = (layout.toDeviceIndependentPixels(owner._effectiveItemWidth) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
|
892
|
-
let h = (layout.toDeviceIndependentPixels(owner._effectiveItemHeight) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
|
893
|
-
width = scrollView.contentOffset.x / w;
|
894
|
-
if (!Number.isNaN(width)) {
|
895
|
-
let page = Math.ceil(width);
|
896
|
-
const doScroll = () => {
|
897
|
-
if (!Number.isNaN(width)) {
|
898
|
-
const point = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
|
899
|
-
scrollView.setContentOffsetAnimated(point, false);
|
900
|
-
}
|
901
|
-
};
|
902
|
-
if (page === 0) {
|
903
|
-
page = owner.itemCount - 2;
|
904
|
-
doScroll();
|
905
|
-
selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
|
906
|
-
} else if (page === owner.itemCount -1) {
|
907
|
-
page = 1;
|
908
|
-
doScroll();
|
909
|
-
selectedIndexProperty.nativeValueChange(owner, 0);
|
910
|
-
} else {
|
911
|
-
if(page === owner.itemCount + 1){
|
912
|
-
selectedIndexProperty.nativeValueChange(owner, 0);
|
913
|
-
}else {
|
914
|
-
selectedIndexProperty.nativeValueChange(owner, page - 1);
|
915
|
-
}
|
916
|
-
}
|
917
|
-
}
|
918
|
-
} */
|
919
|
-
// scrollView.setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
|
920
|
-
// (owner.nativeView as UICollectionView).setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
|
921
850
|
}
|
922
|
-
}
|
923
|
-
|
924
|
-
|
925
|
-
|
851
|
+
}
|
852
|
+
scrollViewDidEndDraggingWillDecelerate(scrollView, decelerate) { }
|
853
|
+
scrollViewWillEndDraggingWithVelocityTargetContentOffset(scrollView, velocity, targetContentOffset) {
|
854
|
+
const owner = this._owner ? this._owner.get() : null;
|
926
855
|
if (!owner)
|
927
856
|
return;
|
928
857
|
if (owner.lastEvent === 1) {
|
@@ -932,28 +861,22 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
|
932
861
|
});
|
933
862
|
owner.lastEvent = 0;
|
934
863
|
}
|
935
|
-
}
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
function UICollectionViewDataSourceImpl() {
|
945
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
946
|
-
}
|
947
|
-
UICollectionViewDataSourceImpl_1 = UICollectionViewDataSourceImpl;
|
948
|
-
UICollectionViewDataSourceImpl.initWithOwner = function (owner) {
|
949
|
-
var delegate = UICollectionViewDataSourceImpl_1.alloc().init();
|
864
|
+
}
|
865
|
+
};
|
866
|
+
UICollectionDelegateImpl = UICollectionDelegateImpl_1 = __decorate([
|
867
|
+
NativeClass,
|
868
|
+
ObjCClass(UICollectionViewDelegate, UICollectionViewDelegateFlowLayout)
|
869
|
+
], UICollectionDelegateImpl);
|
870
|
+
let UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = class UICollectionViewDataSourceImpl extends NSObject {
|
871
|
+
static initWithOwner(owner) {
|
872
|
+
const delegate = UICollectionViewDataSourceImpl_1.alloc().init();
|
950
873
|
delegate._owner = owner;
|
951
874
|
return delegate;
|
952
|
-
}
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
875
|
+
}
|
876
|
+
collectionViewCellForItemAtIndexPath(collectionView, indexPath) {
|
877
|
+
const owner = this._owner ? this._owner.get() : null;
|
878
|
+
let cell;
|
879
|
+
let count = 0;
|
957
880
|
if (owner) {
|
958
881
|
count = owner._childrenCount;
|
959
882
|
if (owner.circularMode) {
|
@@ -972,70 +895,48 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
|
|
972
895
|
}
|
973
896
|
}
|
974
897
|
if (owner && !owner.items && count > 0) {
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
owner.
|
979
|
-
collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(),
|
980
|
-
cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(
|
898
|
+
const index = indexPath.row;
|
899
|
+
const data = owner._childrenViews[index];
|
900
|
+
const viewType = data.type;
|
901
|
+
owner.mPreparingCell = true;
|
902
|
+
collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), `static-${viewType}`);
|
903
|
+
cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(`static-${viewType}`, indexPath) || PagerCell.initWithEmptyBackground();
|
981
904
|
cell.index = index;
|
982
|
-
|
983
|
-
// if (view instanceof ProxyViewContainer) {
|
984
|
-
// let sp = new StackLayout();
|
985
|
-
// sp.addChild(view);
|
986
|
-
// view = sp;
|
987
|
-
// }
|
988
|
-
// If cell is reused it has old content - remove it first.
|
905
|
+
const view = data.view;
|
989
906
|
if (!cell.view) {
|
990
907
|
cell.owner = new WeakRef(view);
|
991
908
|
}
|
992
909
|
else if (cell.view !== view) {
|
993
910
|
owner._removeView(view);
|
994
|
-
// (cell.view.nativeViewProtected as UIView).removeFromSuperview();
|
995
911
|
cell.owner = new WeakRef(view);
|
996
912
|
}
|
997
913
|
if (view && !view.parent) {
|
998
|
-
// view['performLayout'] = () => {
|
999
|
-
// View.measureChild(
|
1000
|
-
// owner,
|
1001
|
-
// view,
|
1002
|
-
// view._currentWidthMeasureSpec,
|
1003
|
-
// view._currentHeightMeasureSpec
|
1004
|
-
// );
|
1005
|
-
// if (view && view.isLayoutRequired) {
|
1006
|
-
// View.layoutChild(owner, view, 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
|
1007
|
-
// }
|
1008
|
-
// };
|
1009
914
|
owner._addView(view);
|
1010
|
-
|
1011
|
-
var innerView = UICellView.new();
|
915
|
+
const innerView = UICellView.new();
|
1012
916
|
innerView.view = new WeakRef(view);
|
1013
917
|
innerView.addSubview(view.nativeViewProtected);
|
1014
918
|
cell.contentView.addSubview(innerView);
|
1015
|
-
owner.
|
1016
|
-
// } else {
|
1017
|
-
// cell.contentView.addSubview(view.nativeViewProtected);
|
1018
|
-
// }
|
919
|
+
owner.mMap.set(cell, view);
|
1019
920
|
}
|
1020
921
|
view.iosOverflowSafeArea = owner.iosOverflowSafeArea;
|
1021
922
|
view['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
|
1022
923
|
owner._layoutCell(view, indexPath);
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
924
|
+
const size = owner._getSize();
|
925
|
+
const width = layout.toDevicePixels(size.width);
|
926
|
+
const height = layout.toDevicePixels(size.height);
|
1026
927
|
if (view && view.isLayoutRequired) {
|
1027
928
|
View.layoutChild(owner, view, 0, 0, width, height);
|
1028
929
|
}
|
1029
|
-
owner.
|
930
|
+
owner.mPreparingCell = false;
|
1030
931
|
return cell;
|
1031
932
|
}
|
1032
|
-
|
933
|
+
const template = owner && owner._getItemTemplate(indexPath.row);
|
1033
934
|
cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(template.key, indexPath) || PagerCell.initWithEmptyBackground();
|
1034
935
|
cell.index = indexPath;
|
1035
936
|
if (owner) {
|
1036
|
-
|
937
|
+
const size = owner._getSize();
|
1037
938
|
owner._prepareCell(cell, indexPath);
|
1038
|
-
|
939
|
+
const cellView = cell.view;
|
1039
940
|
cellView.iosOverflowSafeArea = owner.iosOverflowSafeArea;
|
1040
941
|
cellView['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
|
1041
942
|
if (!owner.iosOverflowSafeAreaEnabled && cellView && cellView.isLayoutRequired) {
|
@@ -1043,53 +944,46 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
|
|
1043
944
|
}
|
1044
945
|
}
|
1045
946
|
return cell;
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
|
1049
|
-
// make sure we dont start to load static view if the pager is not loaded.
|
1050
|
-
// otherwise static items wont "load"
|
947
|
+
}
|
948
|
+
collectionViewNumberOfItemsInSection(collectionView, section) {
|
949
|
+
const owner = this._owner ? this._owner.get() : null;
|
1051
950
|
if (!owner || !owner.isLoaded)
|
1052
951
|
return 0;
|
1053
952
|
return owner.circularMode ? owner.itemCount : owner._childrenCount;
|
1054
|
-
}
|
1055
|
-
|
953
|
+
}
|
954
|
+
numberOfSectionsInCollectionView(collectionView) {
|
1056
955
|
return 1;
|
1057
|
-
}
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
function UICollectionViewFlowLinearLayoutImpl() {
|
1067
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
1068
|
-
}
|
1069
|
-
UICollectionViewFlowLinearLayoutImpl.initWithOwner = function (owner) {
|
1070
|
-
var layout = UICollectionViewFlowLinearLayoutImpl.new();
|
956
|
+
}
|
957
|
+
};
|
958
|
+
UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = __decorate([
|
959
|
+
NativeClass,
|
960
|
+
ObjCClass(UICollectionViewDataSource)
|
961
|
+
], UICollectionViewDataSourceImpl);
|
962
|
+
let UICollectionViewFlowLinearLayoutImpl = UICollectionViewFlowLinearLayoutImpl_1 = class UICollectionViewFlowLinearLayoutImpl extends UICollectionViewFlowLayout {
|
963
|
+
static initWithOwner(owner) {
|
964
|
+
const layout = UICollectionViewFlowLinearLayoutImpl_1.new();
|
1071
965
|
layout._owner = owner;
|
1072
966
|
layout._curl = CATransition.animation();
|
1073
967
|
return layout;
|
1074
|
-
}
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
968
|
+
}
|
969
|
+
layoutAttributesForElementsInRect(rect) {
|
970
|
+
const owner = this._owner ? this._owner.get() : null;
|
971
|
+
const originalLayoutAttribute = super.layoutAttributesForElementsInRect(rect);
|
972
|
+
const visibleLayoutAttributes = [];
|
1079
973
|
if (owner) {
|
1080
974
|
if (owner.transformers && owner.transformers.indexOf('scale') > -1) {
|
1081
|
-
|
1082
|
-
for (
|
1083
|
-
|
975
|
+
const count = originalLayoutAttribute.count;
|
976
|
+
for (let i = 0; i < count; i++) {
|
977
|
+
const attributes = originalLayoutAttribute.objectAtIndex(i);
|
1084
978
|
visibleLayoutAttributes[i] = attributes;
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
979
|
+
const frame = attributes.frame;
|
980
|
+
const width = attributes.frame.size.width * 0.75;
|
981
|
+
const height = attributes.frame.size.height * 0.75;
|
1088
982
|
attributes.frame.size.width = width;
|
1089
983
|
attributes.frame.size.height = height;
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
984
|
+
const spacing = owner.convertToSize(owner.spacing);
|
985
|
+
const distance = Math.abs(this.collectionView.contentOffset.x + this.collectionView.contentInset.left + spacing - frame.origin.x);
|
986
|
+
const scale = Math.min(Math.max(1 - distance / this.collectionView.bounds.size.width, 0.75), 1);
|
1093
987
|
attributes.transform = CGAffineTransformScale(attributes.transform, 1, scale);
|
1094
988
|
}
|
1095
989
|
}
|
@@ -1098,61 +992,51 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
|
|
1098
992
|
}
|
1099
993
|
}
|
1100
994
|
return visibleLayoutAttributes;
|
1101
|
-
}
|
1102
|
-
|
995
|
+
}
|
996
|
+
shouldInvalidateLayoutForBoundsChange(newBounds) {
|
1103
997
|
return true;
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
|
998
|
+
}
|
999
|
+
initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath) {
|
1000
|
+
const attrs = super.initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath);
|
1107
1001
|
attrs.alpha = 1;
|
1108
1002
|
return attrs;
|
1109
|
-
}
|
1110
|
-
|
1111
|
-
|
1003
|
+
}
|
1004
|
+
finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath) {
|
1005
|
+
const attrs = super.finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath);
|
1112
1006
|
attrs.alpha = 1;
|
1113
1007
|
return attrs;
|
1114
|
-
}
|
1115
|
-
|
1116
|
-
|
1008
|
+
}
|
1009
|
+
targetContentOffsetForProposedContentOffsetWithScrollingVelocity(proposedContentOffset, velocity) {
|
1010
|
+
const owner = this._owner ? this._owner.get() : null;
|
1117
1011
|
if (!this.collectionView || !owner) {
|
1118
|
-
return
|
1119
|
-
}
|
1120
|
-
|
1121
|
-
if (this.scrollDirection ===
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
// Create custom flickVelocity.
|
1129
|
-
var flickVelocity = velocity.x * 0.3;
|
1130
|
-
// Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
|
1131
|
-
var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
|
1132
|
-
var newPageIndex = currentPage + flickedPages;
|
1012
|
+
return super.targetContentOffsetForProposedContentOffsetWithScrollingVelocity(proposedContentOffset, velocity);
|
1013
|
+
}
|
1014
|
+
const size = owner._getRealWidthHeight();
|
1015
|
+
if (this.scrollDirection === 1) {
|
1016
|
+
const pageWidth = size.width + this.minimumInteritemSpacing;
|
1017
|
+
const approximatePage = this.collectionView.contentOffset.x / pageWidth;
|
1018
|
+
const currentPage = velocity.x === 0 ? Math.round(approximatePage) : velocity.x < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
|
1019
|
+
const flickVelocity = velocity.x * 0.3;
|
1020
|
+
const flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
|
1021
|
+
const newPageIndex = currentPage + flickedPages;
|
1133
1022
|
selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
|
1134
|
-
|
1135
|
-
var newHorizontalOffset = newPageIndex * pageWidth - this.collectionView.contentInset.left;
|
1023
|
+
const newHorizontalOffset = newPageIndex * pageWidth - this.collectionView.contentInset.left;
|
1136
1024
|
return CGPointMake(newHorizontalOffset, proposedContentOffset.y);
|
1137
1025
|
}
|
1138
1026
|
else {
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
var currentPage = velocity.y === 0 ? Math.round(approximatePage) : velocity.y < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
|
1146
|
-
// Create custom flickVelocity.
|
1147
|
-
var flickVelocity = velocity.y * 0.3;
|
1148
|
-
// Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
|
1149
|
-
var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
|
1150
|
-
var newPageIndex = currentPage + flickedPages;
|
1027
|
+
const pageHeight = size.height;
|
1028
|
+
const approximatePage = Math.max(0, this.collectionView.contentOffset.y / pageHeight);
|
1029
|
+
const currentPage = velocity.y === 0 ? Math.round(approximatePage) : velocity.y < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
|
1030
|
+
const flickVelocity = velocity.y * 0.3;
|
1031
|
+
const flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
|
1032
|
+
const newPageIndex = currentPage + flickedPages;
|
1151
1033
|
selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
|
1152
|
-
|
1034
|
+
const newVerticalOffset = newPageIndex * pageHeight - this.collectionView.contentInset.top;
|
1153
1035
|
return CGPointMake(proposedContentOffset.x, newVerticalOffset);
|
1154
1036
|
}
|
1155
|
-
}
|
1156
|
-
|
1157
|
-
|
1037
|
+
}
|
1038
|
+
};
|
1039
|
+
UICollectionViewFlowLinearLayoutImpl = UICollectionViewFlowLinearLayoutImpl_1 = __decorate([
|
1040
|
+
NativeClass
|
1041
|
+
], UICollectionViewFlowLinearLayoutImpl);
|
1158
1042
|
//# sourceMappingURL=index.ios.js.map
|