@nativescript-community/ui-pager 13.0.28
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 +224 -0
- package/LICENSE +201 -0
- package/angular/bundles/nativescript-community-ui-pager-angular.umd.js +753 -0
- package/angular/bundles/nativescript-community-ui-pager-angular.umd.js.map +1 -0
- package/angular/esm2015/index.js +55 -0
- package/angular/esm2015/nativescript-community-ui-pager-angular.js +2 -0
- package/angular/esm2015/pager-items-comp.js +312 -0
- package/angular/fesm2015/nativescript-community-ui-pager-angular.js +366 -0
- package/angular/fesm2015/nativescript-community-ui-pager-angular.js.map +1 -0
- package/angular/index.d.ts +18 -0
- package/angular/nativescript-community-ui-pager-angular.d.ts +2 -0
- package/angular/package.json +16 -0
- package/angular/pager-items-comp.d.ts +85 -0
- package/package.json +55 -0
- package/pager.android.d.ts +79 -0
- package/pager.android.js +954 -0
- package/pager.android.js.map +1 -0
- package/pager.common.d.ts +128 -0
- package/pager.common.js +393 -0
- package/pager.common.js.map +1 -0
- package/pager.d.ts +35 -0
- package/pager.ios.d.ts +115 -0
- package/pager.ios.js +1175 -0
- package/pager.ios.js.map +1 -0
- package/platforms/android/include.gradle +20 -0
- package/platforms/android/native-api-usage.json +10 -0
- package/platforms/ios/Podfile +1 -0
- package/platforms/ios/native-api-usage.json +7 -0
- package/react/index.d.ts +301 -0
- package/react/index.js +151 -0
- package/react/index.js.map +1 -0
- package/references.d.ts +1 -0
- package/svelte/index.d.ts +19 -0
- package/svelte/index.js +117 -0
- package/svelte/index.js.map +1 -0
- package/typings/viewpager2.d.ts +470 -0
- package/vue/index.d.ts +4 -0
- package/vue/index.js +9 -0
- package/vue/index.js.map +1 -0
- package/vue/pager.d.ts +47 -0
- package/vue/pager.js +104 -0
- package/vue/pager.js.map +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pager.common.js","sourceRoot":"../src/","sources":["pager.common.ts"],"names":[],"mappings":"AA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D,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,QAAQ,CAAoB;IAChE,IAAI,EAAE,cAAc;CACvB,CAAC,CAAC;AAEH,oBAAoB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,QAAQ,CAAqB;IAClE,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,gBAAgB;CACnC,CAAC,CAAC;AACH,qBAAqB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,QAAQ,CAAqB;IAC7D,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,gBAAgB;CACnC,CAAC,CAAC;AACH,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,QAAQ,CAAoB;IACjE,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AACH,qBAAqB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC"}
|
package/pager.d.ts
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
import { View } from '@nativescript/core';
|
2
|
+
import { PagerBase, PagerItem } from './pager.common';
|
3
|
+
|
4
|
+
export { ItemsSource, PagerError, PagerLog, PagerItem } from './pager.common';
|
5
|
+
export type Orientation = 'horizontal' | 'vertical';
|
6
|
+
|
7
|
+
export declare class Pager extends PagerBase {
|
8
|
+
cache: boolean;
|
9
|
+
|
10
|
+
itemTemplateUpdated(oldData: any, newData: any): void;
|
11
|
+
|
12
|
+
readonly android: any;
|
13
|
+
readonly ios: any;
|
14
|
+
|
15
|
+
scrollToIndexAnimated(index: number, animate: boolean): void;
|
16
|
+
|
17
|
+
eachChildView(callback: (child: View) => boolean): void;
|
18
|
+
|
19
|
+
updateNativeIndex(oldIndex: number, newIndex: number): void;
|
20
|
+
|
21
|
+
updateNativeItems(oldItems: View[], newItems: View[]): void;
|
22
|
+
|
23
|
+
refresh(): void;
|
24
|
+
|
25
|
+
disableSwipe: boolean;
|
26
|
+
disableAnimation: boolean;
|
27
|
+
|
28
|
+
requestLayout(): void;
|
29
|
+
|
30
|
+
_addChildFromBuilder(name: string, value: any): void;
|
31
|
+
|
32
|
+
_onItemsChanged(oldValue: any, newValue: any);
|
33
|
+
|
34
|
+
getChildView(index: number): PagerItem;
|
35
|
+
}
|
package/pager.ios.d.ts
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
import { View, ViewBase } from '@nativescript/core';
|
2
|
+
import { PagerBase } from './pager.common';
|
3
|
+
export * from './pager.common';
|
4
|
+
export { ItemsSource, Transformer } from './pager.common';
|
5
|
+
export declare enum ContentInsetAdjustmentBehavior {
|
6
|
+
Always = 3,
|
7
|
+
Automatic = 0,
|
8
|
+
Never = 2,
|
9
|
+
ScrollableAxes = 1
|
10
|
+
}
|
11
|
+
export declare const contentInsetAdjustmentBehaviorProperty: any;
|
12
|
+
export declare class Pager extends PagerBase {
|
13
|
+
lastEvent: number;
|
14
|
+
private _disableSwipe;
|
15
|
+
private _disableAnimation;
|
16
|
+
_layout: UICollectionViewFlowLinearLayoutImpl;
|
17
|
+
_preparingCell: boolean;
|
18
|
+
_delegate: UICollectionDelegateImpl;
|
19
|
+
nativeViewProtected: UIView;
|
20
|
+
private _dataSource;
|
21
|
+
_map: Map<PagerCell, View>;
|
22
|
+
borderRadius: number;
|
23
|
+
borderWidth: number;
|
24
|
+
borderColor: string;
|
25
|
+
backgroundColor: any;
|
26
|
+
_isRefreshing: boolean;
|
27
|
+
private _pager;
|
28
|
+
private _indicatorView;
|
29
|
+
private _observableArrayInstance;
|
30
|
+
_isInit: boolean;
|
31
|
+
_innerWidth: number;
|
32
|
+
_innerHeight: number;
|
33
|
+
_lastLayoutKey: string;
|
34
|
+
constructor();
|
35
|
+
get pager(): UICollectionView;
|
36
|
+
get indicatorView(): any;
|
37
|
+
createNativeView(): UIView;
|
38
|
+
initNativeView(): void;
|
39
|
+
_getRealWidthHeight(): {
|
40
|
+
width: number;
|
41
|
+
height: number;
|
42
|
+
};
|
43
|
+
_nextIndex(): number;
|
44
|
+
_initAutoPlay(value: boolean): void;
|
45
|
+
getPosition(index: number): number;
|
46
|
+
get itemCount(): number;
|
47
|
+
get lastIndex(): number;
|
48
|
+
get firstDummy(): number;
|
49
|
+
get lastDummy(): number;
|
50
|
+
private _setIndicator;
|
51
|
+
get _childrenCount(): number;
|
52
|
+
itemTemplateUpdated(oldData: any, newData: any): void;
|
53
|
+
_setNativeClipToBounds(): void;
|
54
|
+
eachChildView(callback: (child: View) => boolean): void;
|
55
|
+
eachChild(callback: (child: ViewBase) => boolean): void;
|
56
|
+
_updateScrollPosition(): void;
|
57
|
+
private _autoPlayInterval;
|
58
|
+
private _observableArrayHandler;
|
59
|
+
_onItemsChanged(oldValue: any, newValue: any): void;
|
60
|
+
_scrollToIndexAnimated(index: number, animate: boolean): void;
|
61
|
+
scrollToIndexAnimated(index: number, animate: boolean): void;
|
62
|
+
refresh(): void;
|
63
|
+
_isDataDirty: boolean;
|
64
|
+
onLoaded(): void;
|
65
|
+
onUnloaded(): void;
|
66
|
+
disposeNativeView(): void;
|
67
|
+
get disableAnimation(): boolean;
|
68
|
+
set disableAnimation(value: boolean);
|
69
|
+
_removeContainer(cell: PagerCell, index?: number): void;
|
70
|
+
onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
71
|
+
iosOverflowSafeAreaEnabledLayoutHackNeeded: boolean;
|
72
|
+
protected updateInnerSize(): void;
|
73
|
+
onLayout(left: number, top: number, right: number, bottom: number): void;
|
74
|
+
requestLayout(): void;
|
75
|
+
_prepareCell(cell: PagerCell, indexPath: NSIndexPath): void;
|
76
|
+
_layoutCell(cellView: View, index: NSIndexPath): void;
|
77
|
+
get horizontalOffset(): number;
|
78
|
+
get verticalOffset(): number;
|
79
|
+
_getSpacing(): number;
|
80
|
+
_getPeaking(): number;
|
81
|
+
_getSize(): {
|
82
|
+
width: number;
|
83
|
+
height: number;
|
84
|
+
};
|
85
|
+
}
|
86
|
+
declare class PagerCell extends UICollectionViewCell {
|
87
|
+
owner: WeakRef<View>;
|
88
|
+
index: number;
|
89
|
+
get view(): View;
|
90
|
+
static initWithEmptyBackground(): PagerCell;
|
91
|
+
willMoveToSuperview(newSuperview: UIView): void;
|
92
|
+
}
|
93
|
+
declare class UICollectionDelegateImpl extends NSObject implements UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
|
94
|
+
private _owner;
|
95
|
+
static initWithOwner(owner: WeakRef<Pager>): UICollectionDelegateImpl;
|
96
|
+
collectionViewLayoutInsetForSectionAtIndex(collectionView: UICollectionView, collectionViewLayout: UICollectionViewLayout, section: number): UIEdgeInsets;
|
97
|
+
collectionViewLayoutSizeForItemAtIndexPath(collectionView: UICollectionView, collectionViewLayout: UICollectionViewLayout, indexPath: NSIndexPath): CGSize;
|
98
|
+
collectionViewWillDisplayCellForItemAtIndexPath(collectionView: UICollectionView, cell: UICollectionViewCell, indexPath: NSIndexPath): void;
|
99
|
+
collectionViewLayoutMinimumLineSpacingForSectionAtIndex(collectionView: UICollectionView, collectionViewLayout: UICollectionViewLayout, section: number): number;
|
100
|
+
scrollViewWillBeginDragging(scrollView: UIScrollView): void;
|
101
|
+
scrollViewDidEndScrollingAnimation(scrollView: UIScrollView): void;
|
102
|
+
scrollViewDidScroll(scrollView: UIScrollView): void;
|
103
|
+
scrollViewDidEndDraggingWillDecelerate(scrollView: UIScrollView, decelerate: boolean): void;
|
104
|
+
scrollViewWillEndDraggingWithVelocityTargetContentOffset(scrollView: UIScrollView, velocity: CGPoint, targetContentOffset: interop.Pointer | interop.Reference<CGPoint>): void;
|
105
|
+
}
|
106
|
+
declare class UICollectionViewFlowLinearLayoutImpl extends UICollectionViewFlowLayout {
|
107
|
+
_owner: WeakRef<Pager>;
|
108
|
+
_curl: CATransition;
|
109
|
+
static initWithOwner(owner: WeakRef<Pager>): UICollectionViewFlowLinearLayoutImpl;
|
110
|
+
layoutAttributesForElementsInRect(rect: CGRect): any;
|
111
|
+
shouldInvalidateLayoutForBoundsChange(newBounds: CGRect): boolean;
|
112
|
+
initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath: NSIndexPath): UICollectionViewLayoutAttributes;
|
113
|
+
finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath: NSIndexPath): UICollectionViewLayoutAttributes;
|
114
|
+
targetContentOffsetForProposedContentOffsetWithScrollingVelocity(proposedContentOffset: CGPoint, velocity: CGPoint): CGPoint;
|
115
|
+
}
|
package/pager.ios.js
ADDED
@@ -0,0 +1,1175 @@
|
|
1
|
+
import { ChangeType, Color, Observable, ObservableArray, Property, ProxyViewContainer, StackLayout, Utils, View, profile } from '@nativescript/core';
|
2
|
+
import { layout } from '@nativescript/core/utils/utils';
|
3
|
+
import { ITEMDISPOSING, ITEMLOADING, Indicator, LOADMOREITEMS, PagerBase, autoPlayProperty, autoplayDelayProperty, disableSwipeProperty, indicatorColorProperty, indicatorProperty, indicatorSelectedColorProperty, itemTemplatesProperty, itemsProperty, orientationProperty, selectedIndexProperty, showIndicatorProperty } from './pager.common';
|
4
|
+
export * from './pager.common';
|
5
|
+
export { Transformer } from './pager.common';
|
6
|
+
function notifyForItemAtIndex(owner, nativeView, view, eventName, index) {
|
7
|
+
const args = {
|
8
|
+
eventName,
|
9
|
+
object: owner,
|
10
|
+
index,
|
11
|
+
view,
|
12
|
+
ios: nativeView,
|
13
|
+
android: undefined,
|
14
|
+
};
|
15
|
+
owner.notify(args);
|
16
|
+
return args;
|
17
|
+
}
|
18
|
+
const main_queue = dispatch_get_current_queue();
|
19
|
+
export var ContentInsetAdjustmentBehavior;
|
20
|
+
(function (ContentInsetAdjustmentBehavior) {
|
21
|
+
ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Always"] = 3] = "Always";
|
22
|
+
ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Automatic"] = 0] = "Automatic";
|
23
|
+
ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["Never"] = 2] = "Never";
|
24
|
+
ContentInsetAdjustmentBehavior[ContentInsetAdjustmentBehavior["ScrollableAxes"] = 1] = "ScrollableAxes";
|
25
|
+
})(ContentInsetAdjustmentBehavior || (ContentInsetAdjustmentBehavior = {}));
|
26
|
+
function parseContentInsetAdjustmentBehavior(value) {
|
27
|
+
if (typeof value === 'string') {
|
28
|
+
switch (value) {
|
29
|
+
case 'always':
|
30
|
+
return ContentInsetAdjustmentBehavior.Always;
|
31
|
+
case 'never':
|
32
|
+
return ContentInsetAdjustmentBehavior.Never;
|
33
|
+
case 'scrollableAxes':
|
34
|
+
return ContentInsetAdjustmentBehavior.ScrollableAxes;
|
35
|
+
default:
|
36
|
+
case 'automatic':
|
37
|
+
return ContentInsetAdjustmentBehavior.Automatic;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
return value;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
export const contentInsetAdjustmentBehaviorProperty = new Property({
|
45
|
+
name: 'contentInsetAdjustmentBehavior',
|
46
|
+
valueConverter: parseContentInsetAdjustmentBehavior,
|
47
|
+
defaultValue: ContentInsetAdjustmentBehavior.Automatic
|
48
|
+
});
|
49
|
+
var UICellView = /** @class */ (function (_super) {
|
50
|
+
__extends(UICellView, _super);
|
51
|
+
function UICellView() {
|
52
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
53
|
+
}
|
54
|
+
UICellView.prototype.layoutSubviews = function () {
|
55
|
+
var view = this.view && this.view.get();
|
56
|
+
if (!view) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
this.frame = this.superview.bounds;
|
60
|
+
var size = this.bounds.size;
|
61
|
+
View.layoutChild(null, view, 0, 0, Utils.layout.toDevicePixels(size.width), Utils.layout.toDevicePixels(size.height));
|
62
|
+
};
|
63
|
+
return UICellView;
|
64
|
+
}(UIView));
|
65
|
+
const PFLAG_FORCE_LAYOUT = 1;
|
66
|
+
export class Pager extends PagerBase {
|
67
|
+
constructor() {
|
68
|
+
super();
|
69
|
+
this.lastEvent = 0;
|
70
|
+
this._disableSwipe = false;
|
71
|
+
this._disableAnimation = false;
|
72
|
+
this._preparingCell = false;
|
73
|
+
this._isRefreshing = false;
|
74
|
+
this._isInit = false;
|
75
|
+
this._innerWidth = 0;
|
76
|
+
this._innerHeight = 0;
|
77
|
+
this._observableArrayHandler = (args) => {
|
78
|
+
if (!this.pager) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
if (this.indicatorView &&
|
82
|
+
this._observableArrayInstance &&
|
83
|
+
this._observableArrayInstance.length) {
|
84
|
+
this.indicatorView.numberOfPages = this._observableArrayInstance.length;
|
85
|
+
}
|
86
|
+
const collectionView = this.pager;
|
87
|
+
if (collectionView) {
|
88
|
+
try {
|
89
|
+
let offset = 0;
|
90
|
+
collectionView.performBatchUpdatesCompletion(() => {
|
91
|
+
this._isRefreshing = true;
|
92
|
+
const array = [];
|
93
|
+
switch (args.action) {
|
94
|
+
case ChangeType.Add:
|
95
|
+
for (let i = 0; i < args.addedCount; i++) {
|
96
|
+
array.push(NSIndexPath.indexPathForRowInSection(args.index + i, 0));
|
97
|
+
}
|
98
|
+
offset =
|
99
|
+
collectionView.contentSize.width -
|
100
|
+
collectionView.contentOffset.x;
|
101
|
+
collectionView.insertItemsAtIndexPaths(array);
|
102
|
+
break;
|
103
|
+
case ChangeType.Delete:
|
104
|
+
for (let i = 0; i < args.removed.length; i++) {
|
105
|
+
array.push(NSIndexPath.indexPathForItemInSection(args.index + i, 0));
|
106
|
+
}
|
107
|
+
collectionView.deleteItemsAtIndexPaths(array);
|
108
|
+
break;
|
109
|
+
case ChangeType.Splice:
|
110
|
+
if (args.removed && args.removed.length > 0) {
|
111
|
+
for (let i = 0; i < args.removed.length; i++) {
|
112
|
+
array.push(NSIndexPath.indexPathForRowInSection(args.index + i, 0));
|
113
|
+
}
|
114
|
+
collectionView.deleteItemsAtIndexPaths(array);
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
const addedArray = [];
|
118
|
+
for (let i = 0; i < args.addedCount; i++) {
|
119
|
+
addedArray.push(NSIndexPath.indexPathForRowInSection(args.index + i, 0));
|
120
|
+
}
|
121
|
+
collectionView.insertItemsAtIndexPaths(addedArray);
|
122
|
+
}
|
123
|
+
break;
|
124
|
+
case ChangeType.Update:
|
125
|
+
collectionView.reloadItemsAtIndexPaths([
|
126
|
+
NSIndexPath.indexPathForRowInSection(args.index, 0),
|
127
|
+
]);
|
128
|
+
break;
|
129
|
+
default:
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
this._initAutoPlay(this.autoPlay);
|
133
|
+
if (this.itemCount === 0) {
|
134
|
+
this._isInit = false;
|
135
|
+
}
|
136
|
+
}, null);
|
137
|
+
}
|
138
|
+
catch (err) { }
|
139
|
+
}
|
140
|
+
};
|
141
|
+
this._isDataDirty = false;
|
142
|
+
this.iosOverflowSafeAreaEnabledLayoutHackNeeded = true;
|
143
|
+
this._map = new Map();
|
144
|
+
}
|
145
|
+
get pager() {
|
146
|
+
return this._pager;
|
147
|
+
}
|
148
|
+
get indicatorView() {
|
149
|
+
return this._indicatorView;
|
150
|
+
}
|
151
|
+
createNativeView() {
|
152
|
+
const nativeView = UIView.new();
|
153
|
+
this._layout = UICollectionViewFlowLinearLayoutImpl.initWithOwner(new WeakRef(this));
|
154
|
+
this._layout.scrollDirection =
|
155
|
+
1;
|
156
|
+
this._layout.minimumInteritemSpacing = 0;
|
157
|
+
const pager = this._pager = UICollectionView.alloc().initWithFrameCollectionViewLayout(CGRectZero, this._layout);
|
158
|
+
pager.backgroundColor = UIColor.clearColor;
|
159
|
+
pager.autoresizesSubviews = false;
|
160
|
+
pager.autoresizingMask = 0;
|
161
|
+
pager.showsHorizontalScrollIndicator = false;
|
162
|
+
pager.showsVerticalScrollIndicator = false;
|
163
|
+
pager.decelerationRate = UIScrollViewDecelerationRateFast;
|
164
|
+
nativeView.addSubview(pager);
|
165
|
+
return nativeView;
|
166
|
+
}
|
167
|
+
initNativeView() {
|
168
|
+
super.initNativeView();
|
169
|
+
const nativeView = this.pager;
|
170
|
+
nativeView.registerClassForCellWithReuseIdentifier(PagerCell.class(), this._defaultTemplate.key);
|
171
|
+
nativeView.dataSource = this._dataSource = UICollectionViewDataSourceImpl.initWithOwner(new WeakRef(this));
|
172
|
+
nativeView.scrollEnabled = !this.disableSwipe;
|
173
|
+
if (this.orientation === 'vertical') {
|
174
|
+
this._layout.scrollDirection =
|
175
|
+
0;
|
176
|
+
nativeView.alwaysBounceVertical = true;
|
177
|
+
nativeView.alwaysBounceHorizontal = false;
|
178
|
+
}
|
179
|
+
else {
|
180
|
+
this._layout.scrollDirection =
|
181
|
+
1;
|
182
|
+
nativeView.alwaysBounceHorizontal = true;
|
183
|
+
nativeView.alwaysBounceVertical = false;
|
184
|
+
}
|
185
|
+
this._setIndicator(this.indicator);
|
186
|
+
this._delegate = UICollectionDelegateImpl.initWithOwner(new WeakRef(this));
|
187
|
+
this._setNativeClipToBounds();
|
188
|
+
this._initAutoPlay(this.autoPlay);
|
189
|
+
}
|
190
|
+
_getRealWidthHeight() {
|
191
|
+
let height = 0;
|
192
|
+
let width = 0;
|
193
|
+
width =
|
194
|
+
(layout.toDeviceIndependentPixels(this._effectiveItemWidth) -
|
195
|
+
(this.perPage * 2 * this._getSpacing() +
|
196
|
+
this._getPeaking() * 2)) /
|
197
|
+
this.perPage;
|
198
|
+
height =
|
199
|
+
(layout.toDeviceIndependentPixels(this._effectiveItemHeight) -
|
200
|
+
(this.perPage * 2 * this._getSpacing() +
|
201
|
+
this._getPeaking() * 2)) /
|
202
|
+
this.perPage;
|
203
|
+
return { height, width };
|
204
|
+
}
|
205
|
+
_nextIndex() {
|
206
|
+
if (this.circularMode) {
|
207
|
+
return 0;
|
208
|
+
}
|
209
|
+
else {
|
210
|
+
const next = this.selectedIndex + 1;
|
211
|
+
if (next > this.lastIndex) {
|
212
|
+
return 0;
|
213
|
+
}
|
214
|
+
return next;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
_initAutoPlay(value) {
|
218
|
+
if (!this.items || this.items.length === 0) {
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
if (!value) {
|
222
|
+
if (this._autoPlayInterval) {
|
223
|
+
clearInterval(this._autoPlayInterval);
|
224
|
+
this._autoPlayInterval = undefined;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
if (this.isLayoutValid && !this._autoPlayInterval) {
|
229
|
+
this._autoPlayInterval = setInterval(() => {
|
230
|
+
this.selectedIndex = this._nextIndex();
|
231
|
+
}, this.autoPlayDelay);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
getPosition(index) {
|
236
|
+
let position = index;
|
237
|
+
if (this.circularMode) {
|
238
|
+
if (position === 0) {
|
239
|
+
position = this.lastDummy;
|
240
|
+
}
|
241
|
+
else if (position === this.firstDummy) {
|
242
|
+
position = 0;
|
243
|
+
}
|
244
|
+
else {
|
245
|
+
position = position - 1;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
return position;
|
249
|
+
}
|
250
|
+
get itemCount() {
|
251
|
+
return this._childrenCount
|
252
|
+
? this._childrenCount + (this.circularMode ? 2 : 0)
|
253
|
+
: 0;
|
254
|
+
}
|
255
|
+
get lastIndex() {
|
256
|
+
if (this.items && this.items.length === 0) {
|
257
|
+
return 0;
|
258
|
+
}
|
259
|
+
return this.circularMode ? this.itemCount - 3 : this.itemCount - 1;
|
260
|
+
}
|
261
|
+
get firstDummy() {
|
262
|
+
const count = this.itemCount;
|
263
|
+
if (count === 0) {
|
264
|
+
return 0;
|
265
|
+
}
|
266
|
+
return this.itemCount - 1;
|
267
|
+
}
|
268
|
+
get lastDummy() {
|
269
|
+
return this.lastIndex;
|
270
|
+
}
|
271
|
+
_setIndicator(value) {
|
272
|
+
if (this._indicatorView) {
|
273
|
+
this._indicatorView.removeFromSuperview();
|
274
|
+
}
|
275
|
+
switch (value) {
|
276
|
+
case Indicator.None:
|
277
|
+
this._indicatorView = CHIPageControlAji.new();
|
278
|
+
break;
|
279
|
+
case Indicator.Worm:
|
280
|
+
this._indicatorView = CHIPageControlAleppo.new();
|
281
|
+
break;
|
282
|
+
case Indicator.Fill:
|
283
|
+
this._indicatorView = CHIPageControlChimayo.new();
|
284
|
+
break;
|
285
|
+
case Indicator.Swap:
|
286
|
+
this._indicatorView = CHIPageControlPuya.new();
|
287
|
+
break;
|
288
|
+
case Indicator.THIN_WORM:
|
289
|
+
this._indicatorView = CHIPageControlJalapeno.new();
|
290
|
+
break;
|
291
|
+
case Indicator.Flat:
|
292
|
+
this._indicatorView = CHIPageControlJaloro.new();
|
293
|
+
break;
|
294
|
+
default:
|
295
|
+
break;
|
296
|
+
}
|
297
|
+
this._indicatorView.tintColor = UIColor.whiteColor;
|
298
|
+
this._indicatorView.currentPageTintColor = UIColor.whiteColor;
|
299
|
+
}
|
300
|
+
get _childrenCount() {
|
301
|
+
var _a, _b;
|
302
|
+
return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this._childrenViews) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
303
|
+
}
|
304
|
+
itemTemplateUpdated(oldData, newData) { }
|
305
|
+
_setNativeClipToBounds() {
|
306
|
+
this.pager.clipsToBounds = true;
|
307
|
+
}
|
308
|
+
[orientationProperty.setNative](value) {
|
309
|
+
if (value === 'horizontal') {
|
310
|
+
this._layout.scrollDirection =
|
311
|
+
1;
|
312
|
+
}
|
313
|
+
else {
|
314
|
+
this._layout.scrollDirection =
|
315
|
+
0;
|
316
|
+
}
|
317
|
+
}
|
318
|
+
eachChildView(callback) {
|
319
|
+
this._map.forEach((view, key) => callback(view));
|
320
|
+
}
|
321
|
+
eachChild(callback) {
|
322
|
+
this._map.forEach((view, key) => callback(view));
|
323
|
+
}
|
324
|
+
_updateScrollPosition() {
|
325
|
+
const view = this.pager;
|
326
|
+
const size = this.orientation === 'vertical'
|
327
|
+
? view.contentSize.height
|
328
|
+
: view.contentSize.width;
|
329
|
+
if (!view || size === 0) {
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
this._scrollToIndexAnimated(this.selectedIndex, false);
|
333
|
+
}
|
334
|
+
[selectedIndexProperty.setNative](value) {
|
335
|
+
if (this.isLoaded) {
|
336
|
+
this.scrollToIndexAnimated(value, !this.disableAnimation);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
[itemTemplatesProperty.getDefault]() {
|
340
|
+
return null;
|
341
|
+
}
|
342
|
+
[itemTemplatesProperty.setNative](value) {
|
343
|
+
this._itemTemplatesInternal = new Array(this._defaultTemplate);
|
344
|
+
if (value) {
|
345
|
+
for (let i = 0, length = value.length; i < length; i++) {
|
346
|
+
this.pager.registerClassForCellWithReuseIdentifier(PagerCell.class(), value[i].key);
|
347
|
+
}
|
348
|
+
this._itemTemplatesInternal = this._itemTemplatesInternal.concat(value);
|
349
|
+
}
|
350
|
+
}
|
351
|
+
[itemsProperty.setNative](value) {
|
352
|
+
if (this.indicatorView && value && value.length) {
|
353
|
+
this.indicatorView.numberOfPages = value.length;
|
354
|
+
}
|
355
|
+
if (this._observableArrayInstance) {
|
356
|
+
this._observableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
|
357
|
+
this._observableArrayInstance = null;
|
358
|
+
}
|
359
|
+
if (value instanceof ObservableArray) {
|
360
|
+
this._observableArrayInstance = value;
|
361
|
+
this._observableArrayInstance.on(ObservableArray.changeEvent, this._observableArrayHandler);
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
this.refresh();
|
365
|
+
}
|
366
|
+
if (!value) {
|
367
|
+
this._isInit = false;
|
368
|
+
}
|
369
|
+
selectedIndexProperty.coerce(this);
|
370
|
+
}
|
371
|
+
[autoPlayProperty.setNative](value) {
|
372
|
+
this._initAutoPlay(value);
|
373
|
+
}
|
374
|
+
[autoplayDelayProperty.setNative](value) {
|
375
|
+
if (this._autoPlayInterval) {
|
376
|
+
clearInterval(this._autoPlayInterval);
|
377
|
+
this._autoPlayInterval = undefined;
|
378
|
+
this._initAutoPlay(this.autoPlay);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
[showIndicatorProperty.setNative](value) {
|
382
|
+
if (!this.indicatorView) {
|
383
|
+
this._setIndicator(this.indicatorView);
|
384
|
+
}
|
385
|
+
if (!this.nativeView) {
|
386
|
+
return;
|
387
|
+
}
|
388
|
+
this.indicatorView.center = CGPointMake(this.nativeView.center.x, this.nativeView.bounds.size.height -
|
389
|
+
this.indicatorView.intrinsicContentSize.height);
|
390
|
+
const hasParent = this.indicatorView.superview;
|
391
|
+
if (value) {
|
392
|
+
if (!hasParent) {
|
393
|
+
this.nativeView.addSubview(this.indicatorView);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
else {
|
397
|
+
if (hasParent) {
|
398
|
+
this.indicatorView.removeFromSuperview();
|
399
|
+
}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
_onItemsChanged(oldValue, newValue) { }
|
403
|
+
_scrollToIndexAnimated(index, animate) {
|
404
|
+
if (!this.pager)
|
405
|
+
return;
|
406
|
+
const contentSize = this.pager.contentSize;
|
407
|
+
const size = this.orientation === 'vertical'
|
408
|
+
? contentSize.height
|
409
|
+
: contentSize.width;
|
410
|
+
if (size === 0) {
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
if (this._childrenCount === 0) {
|
414
|
+
return;
|
415
|
+
}
|
416
|
+
const maxMinIndex = Math.min(Math.max(0, index), this._childrenCount - 1);
|
417
|
+
if (!this.isLoaded) {
|
418
|
+
return selectedIndexProperty.nativeValueChange(this, maxMinIndex);
|
419
|
+
}
|
420
|
+
const frame = this.page && this.page.frame;
|
421
|
+
if (this.page && frame) {
|
422
|
+
if (frame._executingContext) {
|
423
|
+
if (frame._executingContext.entry.resolvedPage !== this.page) {
|
424
|
+
return selectedIndexProperty.nativeValueChange(this, maxMinIndex);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
else if (frame.currentPage !== this.page) {
|
428
|
+
return selectedIndexProperty.nativeValueChange(this, maxMinIndex);
|
429
|
+
}
|
430
|
+
}
|
431
|
+
dispatch_async(main_queue, () => {
|
432
|
+
this.pager.scrollToItemAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(maxMinIndex, 0), this.orientation === 'vertical'
|
433
|
+
? 2
|
434
|
+
: 16, !!animate);
|
435
|
+
selectedIndexProperty.nativeValueChange(this, maxMinIndex);
|
436
|
+
});
|
437
|
+
}
|
438
|
+
scrollToIndexAnimated(index, animate) {
|
439
|
+
this._scrollToIndexAnimated(index, animate);
|
440
|
+
}
|
441
|
+
refresh() {
|
442
|
+
if (!this.isLoaded || !this.nativeView) {
|
443
|
+
this._isDataDirty = true;
|
444
|
+
return;
|
445
|
+
}
|
446
|
+
this._isDataDirty = false;
|
447
|
+
this._lastLayoutKey = this._innerWidth + '_' + this._innerHeight;
|
448
|
+
this._map.forEach((view, nativeView, map) => {
|
449
|
+
if (!(view.bindingContext instanceof Observable)) {
|
450
|
+
view.bindingContext = null;
|
451
|
+
}
|
452
|
+
});
|
453
|
+
this.pager.reloadData();
|
454
|
+
this.pager.collectionViewLayout.invalidateLayout();
|
455
|
+
this._updateScrollPosition();
|
456
|
+
this._initAutoPlay(this.autoPlay);
|
457
|
+
}
|
458
|
+
onLoaded() {
|
459
|
+
super.onLoaded();
|
460
|
+
if (this.showIndicator && this.indicatorView) {
|
461
|
+
this.nativeView.addSubview(this.indicatorView);
|
462
|
+
}
|
463
|
+
if (this._isDataDirty && this._innerWidth !== undefined && this._innerHeight !== undefined) {
|
464
|
+
this.refresh();
|
465
|
+
}
|
466
|
+
this.pager.delegate = this._delegate;
|
467
|
+
if (!this.items && this._childrenCount > 0) {
|
468
|
+
selectedIndexProperty.coerce(this);
|
469
|
+
this._updateScrollPosition();
|
470
|
+
}
|
471
|
+
}
|
472
|
+
onUnloaded() {
|
473
|
+
if (this.pager) {
|
474
|
+
this.pager.delegate = null;
|
475
|
+
}
|
476
|
+
super.onUnloaded();
|
477
|
+
}
|
478
|
+
disposeNativeView() {
|
479
|
+
this._delegate = null;
|
480
|
+
this._dataSource = null;
|
481
|
+
this._layout = null;
|
482
|
+
if (this._observableArrayInstance) {
|
483
|
+
this._observableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
|
484
|
+
this._observableArrayInstance = null;
|
485
|
+
}
|
486
|
+
super.disposeNativeView();
|
487
|
+
}
|
488
|
+
[indicatorProperty.setNative](value) {
|
489
|
+
this._setIndicator(value);
|
490
|
+
}
|
491
|
+
[indicatorColorProperty.setNative](value) {
|
492
|
+
if (this.indicatorView) {
|
493
|
+
const color = (!value || value instanceof Color) ? value : new Color(value);
|
494
|
+
this.indicatorView.tintColor = color ? color.ios : null;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
[indicatorSelectedColorProperty.setNative](value) {
|
498
|
+
if (this.indicatorView) {
|
499
|
+
const color = (!value || value instanceof Color) ? value : new Color(value);
|
500
|
+
this.indicatorView.currentPageTintColor = color ? color.ios : null;
|
501
|
+
}
|
502
|
+
}
|
503
|
+
[disableSwipeProperty.setNative](value) {
|
504
|
+
this._pager.scrollEnabled = !value;
|
505
|
+
this._disableSwipe = value;
|
506
|
+
}
|
507
|
+
[contentInsetAdjustmentBehaviorProperty.setNative](value) {
|
508
|
+
this._pager.contentInsetAdjustmentBehavior = value;
|
509
|
+
}
|
510
|
+
get disableAnimation() {
|
511
|
+
return this._disableAnimation;
|
512
|
+
}
|
513
|
+
set disableAnimation(value) {
|
514
|
+
this._disableAnimation = value;
|
515
|
+
}
|
516
|
+
_removeContainer(cell, index) {
|
517
|
+
let view = cell.view;
|
518
|
+
const args = {
|
519
|
+
eventName: ITEMDISPOSING,
|
520
|
+
object: this,
|
521
|
+
index,
|
522
|
+
android: undefined,
|
523
|
+
ios: cell,
|
524
|
+
view,
|
525
|
+
};
|
526
|
+
this.notify(args);
|
527
|
+
view = args.view;
|
528
|
+
if (view && view.parent) {
|
529
|
+
if (!(view.parent instanceof Pager)) {
|
530
|
+
this._removeView(view.parent);
|
531
|
+
}
|
532
|
+
view.parent._removeView(view);
|
533
|
+
}
|
534
|
+
this._map.delete(cell);
|
535
|
+
}
|
536
|
+
onMeasure(widthMeasureSpec, heightMeasureSpec) {
|
537
|
+
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
538
|
+
this._map.forEach((childView, pagerCell) => {
|
539
|
+
View.measureChild(this, childView, childView._currentWidthMeasureSpec, childView._currentHeightMeasureSpec);
|
540
|
+
});
|
541
|
+
}
|
542
|
+
updateInnerSize() {
|
543
|
+
const width = this.getMeasuredWidth();
|
544
|
+
const height = this.getMeasuredHeight();
|
545
|
+
this._innerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
|
546
|
+
this._innerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
|
547
|
+
}
|
548
|
+
onLayout(left, top, right, bottom) {
|
549
|
+
super.onLayout(left, top, right, bottom);
|
550
|
+
this.updateInnerSize();
|
551
|
+
if (!this.nativeView) {
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
this.pager.frame = this.nativeView.bounds;
|
555
|
+
if (this.indicatorView && this.indicatorView.intrinsicContentSize) {
|
556
|
+
this.indicatorView.center = CGPointMake(this.nativeView.center.x, this.nativeView.bounds.size.height -
|
557
|
+
this.indicatorView.intrinsicContentSize.height);
|
558
|
+
}
|
559
|
+
const layoutView = this.pager.collectionViewLayout;
|
560
|
+
if (!layoutView) {
|
561
|
+
return;
|
562
|
+
}
|
563
|
+
layoutView.invalidateLayout();
|
564
|
+
const layoutKey = this._innerWidth + '_' + this._innerHeight;
|
565
|
+
if (this._lastLayoutKey !== layoutKey) {
|
566
|
+
this.refresh();
|
567
|
+
}
|
568
|
+
}
|
569
|
+
requestLayout() {
|
570
|
+
if (!this._preparingCell) {
|
571
|
+
super.requestLayout();
|
572
|
+
}
|
573
|
+
}
|
574
|
+
_prepareCell(cell, indexPath) {
|
575
|
+
try {
|
576
|
+
this._preparingCell = true;
|
577
|
+
const index = indexPath.row;
|
578
|
+
let view = cell.view;
|
579
|
+
const template = this._getItemTemplate(indexPath.row);
|
580
|
+
if (!view) {
|
581
|
+
view = template.createView();
|
582
|
+
if (!view && this._itemViewLoader !== undefined) {
|
583
|
+
view = this._itemViewLoader(this._getItemTemplateKey(indexPath.row));
|
584
|
+
}
|
585
|
+
}
|
586
|
+
const bindingContext = this._getDataItem(indexPath.row);
|
587
|
+
const args = {
|
588
|
+
eventName: ITEMLOADING,
|
589
|
+
object: this,
|
590
|
+
index,
|
591
|
+
android: undefined,
|
592
|
+
ios: cell,
|
593
|
+
view,
|
594
|
+
bindingContext,
|
595
|
+
};
|
596
|
+
this.notify(args);
|
597
|
+
view = args.view || this._getDefaultItemContent(indexPath.row);
|
598
|
+
if (view instanceof ProxyViewContainer) {
|
599
|
+
const sp = new StackLayout();
|
600
|
+
sp.addChild(view);
|
601
|
+
view = sp;
|
602
|
+
}
|
603
|
+
if (!cell.view) {
|
604
|
+
cell.owner = new WeakRef(view);
|
605
|
+
}
|
606
|
+
else if (cell.view !== view) {
|
607
|
+
this._map.delete(cell);
|
608
|
+
this._removeContainer(cell, index);
|
609
|
+
cell.view.nativeViewProtected.removeFromSuperview();
|
610
|
+
cell.owner = new WeakRef(view);
|
611
|
+
}
|
612
|
+
if (view) {
|
613
|
+
view.bindingContext = bindingContext;
|
614
|
+
}
|
615
|
+
this._map.set(cell, view);
|
616
|
+
if (view && !view.parent) {
|
617
|
+
this._addView(view);
|
618
|
+
if (this.iosOverflowSafeArea) {
|
619
|
+
const innerView = UICellView.new();
|
620
|
+
innerView.view = new WeakRef(view);
|
621
|
+
innerView.addSubview(view.nativeViewProtected);
|
622
|
+
cell.contentView.addSubview(innerView);
|
623
|
+
}
|
624
|
+
else {
|
625
|
+
cell.contentView.addSubview(view.nativeViewProtected);
|
626
|
+
}
|
627
|
+
}
|
628
|
+
this._layoutCell(view, indexPath);
|
629
|
+
}
|
630
|
+
finally {
|
631
|
+
this._preparingCell = false;
|
632
|
+
}
|
633
|
+
}
|
634
|
+
_layoutCell(cellView, index) {
|
635
|
+
if (cellView) {
|
636
|
+
const size = this._getSize();
|
637
|
+
const width = layout.toDevicePixels(size.width);
|
638
|
+
const height = layout.toDevicePixels(size.height);
|
639
|
+
const widthMeasureSpec = layout.makeMeasureSpec(width, layout.EXACTLY);
|
640
|
+
const heightMeasureSpec = layout.makeMeasureSpec(height, layout.EXACTLY);
|
641
|
+
const measured = View.measureChild(this, cellView, widthMeasureSpec, heightMeasureSpec);
|
642
|
+
}
|
643
|
+
}
|
644
|
+
get horizontalOffset() {
|
645
|
+
return this.pager ? this.pager.contentOffset.x : 0;
|
646
|
+
}
|
647
|
+
get verticalOffset() {
|
648
|
+
return this.pager ? this.pager.contentOffset.y : 0;
|
649
|
+
}
|
650
|
+
_getSpacing() {
|
651
|
+
return layout.toDeviceIndependentPixels(this.convertToSize(this.spacing));
|
652
|
+
}
|
653
|
+
_getPeaking() {
|
654
|
+
return layout.toDeviceIndependentPixels(this.convertToSize(this.peaking));
|
655
|
+
}
|
656
|
+
_getSize() {
|
657
|
+
let width = layout.toDeviceIndependentPixels(this._effectiveItemWidth);
|
658
|
+
let height = layout.toDeviceIndependentPixels(this._effectiveItemHeight);
|
659
|
+
if (this.orientation === 'vertical') {
|
660
|
+
height =
|
661
|
+
(height - (this._getSpacing() * 2 + this._getPeaking() * 2)) /
|
662
|
+
this.perPage;
|
663
|
+
}
|
664
|
+
else {
|
665
|
+
width =
|
666
|
+
(width - (this._getSpacing() * 2 + this._getPeaking() * 2)) /
|
667
|
+
this.perPage;
|
668
|
+
}
|
669
|
+
if (Number.isNaN(width)) {
|
670
|
+
width = 0;
|
671
|
+
}
|
672
|
+
if (Number.isNaN(height)) {
|
673
|
+
height = 0;
|
674
|
+
}
|
675
|
+
return { width, height };
|
676
|
+
}
|
677
|
+
}
|
678
|
+
__decorate([
|
679
|
+
profile
|
680
|
+
], Pager.prototype, "refresh", null);
|
681
|
+
var PagerCell = /** @class */ (function (_super) {
|
682
|
+
__extends(PagerCell, _super);
|
683
|
+
function PagerCell() {
|
684
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
685
|
+
}
|
686
|
+
Object.defineProperty(PagerCell.prototype, "view", {
|
687
|
+
get: function () {
|
688
|
+
return this.owner ? this.owner.get() : null;
|
689
|
+
},
|
690
|
+
enumerable: true,
|
691
|
+
configurable: true
|
692
|
+
});
|
693
|
+
PagerCell.initWithEmptyBackground = function () {
|
694
|
+
var cell = PagerCell.new();
|
695
|
+
// Clear background by default - this will make cells transparent
|
696
|
+
cell.backgroundColor = null;
|
697
|
+
return cell;
|
698
|
+
};
|
699
|
+
PagerCell.prototype.willMoveToSuperview = function (newSuperview) {
|
700
|
+
var parent = (this.view ? this.view.parent : null);
|
701
|
+
// When inside Pager and there is no newSuperview this cell is
|
702
|
+
// removed from native visual tree so we remove it from our tree too.
|
703
|
+
if (parent && !newSuperview) {
|
704
|
+
parent._removeContainer(this, this.index);
|
705
|
+
}
|
706
|
+
};
|
707
|
+
return PagerCell;
|
708
|
+
}(UICollectionViewCell));
|
709
|
+
var UICollectionDelegateImpl = /** @class */ (function (_super) {
|
710
|
+
__extends(UICollectionDelegateImpl, _super);
|
711
|
+
function UICollectionDelegateImpl() {
|
712
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
713
|
+
}
|
714
|
+
UICollectionDelegateImpl_1 = UICollectionDelegateImpl;
|
715
|
+
UICollectionDelegateImpl.initWithOwner = function (owner) {
|
716
|
+
var delegate = UICollectionDelegateImpl_1.alloc().init();
|
717
|
+
delegate._owner = owner;
|
718
|
+
return delegate;
|
719
|
+
};
|
720
|
+
UICollectionDelegateImpl.prototype.collectionViewLayoutInsetForSectionAtIndex = function (collectionView, collectionViewLayout, section) {
|
721
|
+
var owner = this._owner ? this._owner.get() : null;
|
722
|
+
if (owner) {
|
723
|
+
var inset = owner._getSpacing() + owner._getPeaking();
|
724
|
+
if (owner.orientation === 'vertical') {
|
725
|
+
return new UIEdgeInsets({
|
726
|
+
bottom: inset,
|
727
|
+
left: 0,
|
728
|
+
right: 0,
|
729
|
+
top: inset,
|
730
|
+
});
|
731
|
+
}
|
732
|
+
return new UIEdgeInsets({
|
733
|
+
bottom: 0,
|
734
|
+
left: inset,
|
735
|
+
right: inset,
|
736
|
+
top: 0,
|
737
|
+
});
|
738
|
+
}
|
739
|
+
return new UIEdgeInsets({ bottom: 0, left: 0, right: 0, top: 0 });
|
740
|
+
};
|
741
|
+
UICollectionDelegateImpl.prototype.collectionViewLayoutSizeForItemAtIndexPath = function (collectionView, collectionViewLayout, indexPath) {
|
742
|
+
var owner = this._owner && this._owner.get();
|
743
|
+
if (!owner)
|
744
|
+
return CGSizeZero;
|
745
|
+
var size = owner._getSize();
|
746
|
+
return CGSizeMake(size.width, size.height);
|
747
|
+
};
|
748
|
+
UICollectionDelegateImpl.prototype.collectionViewWillDisplayCellForItemAtIndexPath = function (collectionView, cell, indexPath) {
|
749
|
+
var owner = this._owner && this._owner.get();
|
750
|
+
if (owner) {
|
751
|
+
if (!owner._isInit) {
|
752
|
+
owner._updateScrollPosition();
|
753
|
+
owner._isInit = true;
|
754
|
+
}
|
755
|
+
if (owner.items &&
|
756
|
+
indexPath.row === owner.lastIndex - owner.loadMoreCount) {
|
757
|
+
owner.notify({
|
758
|
+
eventName: LOADMOREITEMS,
|
759
|
+
object: owner,
|
760
|
+
});
|
761
|
+
}
|
762
|
+
}
|
763
|
+
if (cell.preservesSuperviewLayoutMargins) {
|
764
|
+
cell.preservesSuperviewLayoutMargins = false;
|
765
|
+
}
|
766
|
+
if (cell.layoutMargins) {
|
767
|
+
cell.layoutMargins = UIEdgeInsetsZero;
|
768
|
+
}
|
769
|
+
};
|
770
|
+
UICollectionDelegateImpl.prototype.collectionViewLayoutMinimumLineSpacingForSectionAtIndex = function (collectionView, collectionViewLayout, section) {
|
771
|
+
var owner = this._owner ? this._owner.get() : null;
|
772
|
+
if (!owner)
|
773
|
+
return 0;
|
774
|
+
var result = owner._getSpacing();
|
775
|
+
return result;
|
776
|
+
};
|
777
|
+
UICollectionDelegateImpl.prototype.scrollViewWillBeginDragging = function (scrollView) {
|
778
|
+
var owner = this._owner && this._owner.get();
|
779
|
+
if (owner) {
|
780
|
+
if (owner.lastEvent === 0) {
|
781
|
+
owner.notify({
|
782
|
+
eventName: Pager.swipeStartEvent,
|
783
|
+
object: owner,
|
784
|
+
});
|
785
|
+
owner.lastEvent = 1;
|
786
|
+
}
|
787
|
+
}
|
788
|
+
};
|
789
|
+
UICollectionDelegateImpl.prototype.scrollViewDidEndScrollingAnimation = function (scrollView) {
|
790
|
+
var owner = this._owner ? this._owner.get() : null;
|
791
|
+
if (owner) {
|
792
|
+
owner.notify({
|
793
|
+
eventName: Pager.swipeEvent,
|
794
|
+
object: owner,
|
795
|
+
});
|
796
|
+
}
|
797
|
+
};
|
798
|
+
UICollectionDelegateImpl.prototype.scrollViewDidScroll = function (scrollView) {
|
799
|
+
var owner = this._owner.get();
|
800
|
+
if (owner) {
|
801
|
+
var width = void 0;
|
802
|
+
var offset = void 0;
|
803
|
+
var size = owner._getRealWidthHeight();
|
804
|
+
var total = void 0;
|
805
|
+
if (owner.orientation === 'vertical') {
|
806
|
+
width = size.height;
|
807
|
+
offset = scrollView.contentOffset.y;
|
808
|
+
total =
|
809
|
+
scrollView.contentSize.height -
|
810
|
+
scrollView.bounds.size.height;
|
811
|
+
}
|
812
|
+
else {
|
813
|
+
width = size.width;
|
814
|
+
offset = scrollView.contentOffset.x;
|
815
|
+
total =
|
816
|
+
scrollView.contentSize.width - scrollView.bounds.size.width;
|
817
|
+
}
|
818
|
+
var percent = offset / total;
|
819
|
+
var progress = percent * (owner.itemCount - 1);
|
820
|
+
if (owner.indicatorView &&
|
821
|
+
owner.indicatorView.setWithProgressAnimated &&
|
822
|
+
!Number.isNaN(progress)) {
|
823
|
+
owner.indicatorView.progress = progress;
|
824
|
+
}
|
825
|
+
var index = parseInt(progress.toFixed(0), 10);
|
826
|
+
if (owner.selectedIndex !== index && !Number.isNaN(index)) {
|
827
|
+
// selectedIndexProperty.nativeValueChange(owner, index);
|
828
|
+
}
|
829
|
+
owner.notify({
|
830
|
+
object: owner,
|
831
|
+
eventName: Pager.scrollEvent,
|
832
|
+
selectedIndex: Math.floor(progress),
|
833
|
+
currentPosition: progress,
|
834
|
+
scrollX: owner.horizontalOffset,
|
835
|
+
scrollY: owner.verticalOffset,
|
836
|
+
});
|
837
|
+
if (owner.lastEvent === 1) {
|
838
|
+
owner.notify({
|
839
|
+
eventName: Pager.swipeOverEvent,
|
840
|
+
object: owner,
|
841
|
+
});
|
842
|
+
owner.lastEvent = 1;
|
843
|
+
}
|
844
|
+
// (scrollView as any).scrollToItemAtIndexPathAtScrollPositionAnimated(
|
845
|
+
// NSIndexPath.indexPathForRowInSection(Math.round(width),0), UICollectionViewScrollPosition.CenteredHorizontally, true
|
846
|
+
// );
|
847
|
+
// if(owner.circularMode){
|
848
|
+
// if(nextIndex === 0){
|
849
|
+
// selectedIndexProperty.nativeValueChange(owner, owner._childrenCount - 3);
|
850
|
+
// }else if(nextIndex === owner._childrenCount -1){
|
851
|
+
// selectedIndexProperty.nativeValueChange(owner, 0);
|
852
|
+
// }else {
|
853
|
+
// selectedIndexProperty.nativeValueChange(owner, nextIndex - 1);
|
854
|
+
// }
|
855
|
+
// }else {
|
856
|
+
// selectedIndexProperty.nativeValueChange(owner, nextIndex);
|
857
|
+
// }
|
858
|
+
/* if (!Number.isNaN(width)) {
|
859
|
+
let page = Math.ceil(width);
|
860
|
+
const doScroll = () => {
|
861
|
+
if (!Number.isNaN(width)) {
|
862
|
+
// scrollView.setContentOffsetAnimated(point, false);
|
863
|
+
scrollView.contentOffset = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
|
864
|
+
}
|
865
|
+
};
|
866
|
+
console.log('page', page, owner.itemCount, page === owner.itemCount);
|
867
|
+
if (page === 0) {
|
868
|
+
page = owner.itemCount - 2;
|
869
|
+
doScroll();
|
870
|
+
// selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
|
871
|
+
} else if (page === owner.itemCount) {
|
872
|
+
page = 1;
|
873
|
+
doScroll();
|
874
|
+
// selectedIndexProperty.nativeValueChange(owner, 0);
|
875
|
+
} else {
|
876
|
+
if (page === owner._childrenCount + 1) {
|
877
|
+
// selectedIndexProperty.nativeValueChange(owner, 0);
|
878
|
+
} else {
|
879
|
+
// selectedIndexProperty.nativeValueChange(owner, page - 1);
|
880
|
+
}
|
881
|
+
|
882
|
+
}
|
883
|
+
} */
|
884
|
+
/* if(owner){
|
885
|
+
let width = 0;
|
886
|
+
let w = (layout.toDeviceIndependentPixels(owner._effectiveItemWidth) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
|
887
|
+
let h = (layout.toDeviceIndependentPixels(owner._effectiveItemHeight) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
|
888
|
+
width = scrollView.contentOffset.x / w;
|
889
|
+
if (!Number.isNaN(width)) {
|
890
|
+
let page = Math.ceil(width);
|
891
|
+
const doScroll = () => {
|
892
|
+
if (!Number.isNaN(width)) {
|
893
|
+
const point = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
|
894
|
+
scrollView.setContentOffsetAnimated(point, false);
|
895
|
+
}
|
896
|
+
};
|
897
|
+
if (page === 0) {
|
898
|
+
page = owner.itemCount - 2;
|
899
|
+
doScroll();
|
900
|
+
selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
|
901
|
+
} else if (page === owner.itemCount -1) {
|
902
|
+
page = 1;
|
903
|
+
doScroll();
|
904
|
+
selectedIndexProperty.nativeValueChange(owner, 0);
|
905
|
+
} else {
|
906
|
+
if(page === owner.itemCount + 1){
|
907
|
+
selectedIndexProperty.nativeValueChange(owner, 0);
|
908
|
+
}else {
|
909
|
+
selectedIndexProperty.nativeValueChange(owner, page - 1);
|
910
|
+
}
|
911
|
+
}
|
912
|
+
}
|
913
|
+
} */
|
914
|
+
// scrollView.setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
|
915
|
+
// (owner.nativeView as UICollectionView).setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
|
916
|
+
}
|
917
|
+
};
|
918
|
+
UICollectionDelegateImpl.prototype.scrollViewDidEndDraggingWillDecelerate = function (scrollView, decelerate) {
|
919
|
+
};
|
920
|
+
UICollectionDelegateImpl.prototype.scrollViewWillEndDraggingWithVelocityTargetContentOffset = function (scrollView, velocity, targetContentOffset) {
|
921
|
+
var owner = this._owner ? this._owner.get() : null;
|
922
|
+
if (!owner)
|
923
|
+
return;
|
924
|
+
if (owner.lastEvent === 1) {
|
925
|
+
owner.notify({
|
926
|
+
eventName: Pager.swipeEndEvent,
|
927
|
+
object: owner,
|
928
|
+
});
|
929
|
+
owner.lastEvent = 0;
|
930
|
+
}
|
931
|
+
};
|
932
|
+
var UICollectionDelegateImpl_1;
|
933
|
+
UICollectionDelegateImpl = UICollectionDelegateImpl_1 = __decorate([
|
934
|
+
ObjCClass(UICollectionViewDelegate, UICollectionViewDelegateFlowLayout)
|
935
|
+
], UICollectionDelegateImpl);
|
936
|
+
return UICollectionDelegateImpl;
|
937
|
+
}(NSObject));
|
938
|
+
var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
|
939
|
+
__extends(UICollectionViewDataSourceImpl, _super);
|
940
|
+
function UICollectionViewDataSourceImpl() {
|
941
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
942
|
+
}
|
943
|
+
UICollectionViewDataSourceImpl_1 = UICollectionViewDataSourceImpl;
|
944
|
+
UICollectionViewDataSourceImpl.initWithOwner = function (owner) {
|
945
|
+
var delegate = UICollectionViewDataSourceImpl_1.alloc().init();
|
946
|
+
delegate._owner = owner;
|
947
|
+
return delegate;
|
948
|
+
};
|
949
|
+
UICollectionViewDataSourceImpl.prototype.collectionViewCellForItemAtIndexPath = function (collectionView, indexPath) {
|
950
|
+
var owner = this._owner ? this._owner.get() : null;
|
951
|
+
var cell;
|
952
|
+
var count = 0;
|
953
|
+
if (owner) {
|
954
|
+
count = owner._childrenCount;
|
955
|
+
if (owner.circularMode) {
|
956
|
+
count = owner.itemCount;
|
957
|
+
switch (indexPath.row) {
|
958
|
+
case 0:
|
959
|
+
indexPath = NSIndexPath.indexPathForRowInSection(owner.lastDummy, 0);
|
960
|
+
break;
|
961
|
+
case owner.firstDummy:
|
962
|
+
indexPath = NSIndexPath.indexPathForRowInSection(0, 0);
|
963
|
+
break;
|
964
|
+
default:
|
965
|
+
indexPath = NSIndexPath.indexPathForRowInSection(indexPath.row - 1, 0);
|
966
|
+
break;
|
967
|
+
}
|
968
|
+
}
|
969
|
+
}
|
970
|
+
if (owner && !owner.items && count > 0) {
|
971
|
+
var index = indexPath.row;
|
972
|
+
var data = owner._childrenViews[index];
|
973
|
+
var viewType = data.type;
|
974
|
+
owner._preparingCell = true;
|
975
|
+
collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), "static-" + viewType);
|
976
|
+
cell =
|
977
|
+
collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath("static-" + viewType, indexPath) || PagerCell.initWithEmptyBackground();
|
978
|
+
cell.index = index;
|
979
|
+
var view = data.view;
|
980
|
+
// if (view instanceof ProxyViewContainer) {
|
981
|
+
// let sp = new StackLayout();
|
982
|
+
// sp.addChild(view);
|
983
|
+
// view = sp;
|
984
|
+
// }
|
985
|
+
// If cell is reused it has old content - remove it first.
|
986
|
+
if (!cell.view) {
|
987
|
+
cell.owner = new WeakRef(view);
|
988
|
+
}
|
989
|
+
else if (cell.view !== view) {
|
990
|
+
owner._removeView(view);
|
991
|
+
cell.view.nativeViewProtected.removeFromSuperview();
|
992
|
+
cell.owner = new WeakRef(view);
|
993
|
+
}
|
994
|
+
if (view && !view.parent) {
|
995
|
+
// view['performLayout'] = () => {
|
996
|
+
// View.measureChild(
|
997
|
+
// owner,
|
998
|
+
// view,
|
999
|
+
// view._currentWidthMeasureSpec,
|
1000
|
+
// view._currentHeightMeasureSpec
|
1001
|
+
// );
|
1002
|
+
// if (view && view.isLayoutRequired) {
|
1003
|
+
// View.layoutChild(owner, view, 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
|
1004
|
+
// }
|
1005
|
+
// };
|
1006
|
+
owner._addView(view);
|
1007
|
+
// if (owner.iosOverflowSafeArea) {
|
1008
|
+
var innerView = UICellView.new();
|
1009
|
+
innerView.view = new WeakRef(view);
|
1010
|
+
innerView.addSubview(view.nativeViewProtected);
|
1011
|
+
cell.contentView.addSubview(innerView);
|
1012
|
+
// } else {
|
1013
|
+
// cell.contentView.addSubview(view.nativeViewProtected);
|
1014
|
+
// }
|
1015
|
+
}
|
1016
|
+
view.iosOverflowSafeArea = owner.iosOverflowSafeArea;
|
1017
|
+
view['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
|
1018
|
+
owner._layoutCell(view, indexPath);
|
1019
|
+
var size = owner._getSize();
|
1020
|
+
var width = layout.toDevicePixels(size.width);
|
1021
|
+
var height = layout.toDevicePixels(size.height);
|
1022
|
+
if (view && view.isLayoutRequired) {
|
1023
|
+
View.layoutChild(owner, view, 0, 0, width, height);
|
1024
|
+
}
|
1025
|
+
owner._preparingCell = false;
|
1026
|
+
return cell;
|
1027
|
+
}
|
1028
|
+
var template = owner && owner._getItemTemplate(indexPath.row);
|
1029
|
+
cell =
|
1030
|
+
collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(template.key, indexPath) || PagerCell.initWithEmptyBackground();
|
1031
|
+
cell.index = indexPath;
|
1032
|
+
if (owner) {
|
1033
|
+
var size = owner._getSize();
|
1034
|
+
owner._prepareCell(cell, indexPath);
|
1035
|
+
var cellView = cell.view;
|
1036
|
+
cellView.iosOverflowSafeArea = owner.iosOverflowSafeArea;
|
1037
|
+
cellView['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
|
1038
|
+
if (!owner.iosOverflowSafeAreaEnabled && cellView && cellView.isLayoutRequired) {
|
1039
|
+
View.layoutChild(owner, cellView, 0, 0, layout.toDevicePixels(size.width), layout.toDevicePixels(size.height));
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
return cell;
|
1043
|
+
};
|
1044
|
+
UICollectionViewDataSourceImpl.prototype.collectionViewNumberOfItemsInSection = function (collectionView, section) {
|
1045
|
+
var owner = this._owner ? this._owner.get() : null;
|
1046
|
+
// make sure we dont start to load static view if the pager is not loaded.
|
1047
|
+
// otherwise static items wont "load"
|
1048
|
+
if (!owner || !owner.isLoaded)
|
1049
|
+
return 0;
|
1050
|
+
return owner.circularMode ? owner.itemCount : owner._childrenCount;
|
1051
|
+
};
|
1052
|
+
UICollectionViewDataSourceImpl.prototype.numberOfSectionsInCollectionView = function (collectionView) {
|
1053
|
+
return 1;
|
1054
|
+
};
|
1055
|
+
var UICollectionViewDataSourceImpl_1;
|
1056
|
+
UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = __decorate([
|
1057
|
+
ObjCClass(UICollectionViewDataSource)
|
1058
|
+
], UICollectionViewDataSourceImpl);
|
1059
|
+
return UICollectionViewDataSourceImpl;
|
1060
|
+
}(NSObject));
|
1061
|
+
var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
|
1062
|
+
__extends(UICollectionViewFlowLinearLayoutImpl, _super);
|
1063
|
+
function UICollectionViewFlowLinearLayoutImpl() {
|
1064
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
1065
|
+
}
|
1066
|
+
UICollectionViewFlowLinearLayoutImpl.initWithOwner = function (owner) {
|
1067
|
+
var layout = UICollectionViewFlowLinearLayoutImpl.new();
|
1068
|
+
layout._owner = owner;
|
1069
|
+
layout._curl = CATransition.animation();
|
1070
|
+
return layout;
|
1071
|
+
};
|
1072
|
+
UICollectionViewFlowLinearLayoutImpl.prototype.layoutAttributesForElementsInRect = function (rect) {
|
1073
|
+
var owner = this._owner ? this._owner.get() : null;
|
1074
|
+
var originalLayoutAttribute = _super.prototype.layoutAttributesForElementsInRect.call(this, rect);
|
1075
|
+
var visibleLayoutAttributes = [];
|
1076
|
+
if (owner) {
|
1077
|
+
if (owner.transformers &&
|
1078
|
+
owner.transformers.indexOf('scale') > -1) {
|
1079
|
+
var count = originalLayoutAttribute.count;
|
1080
|
+
for (var i = 0; i < count; i++) {
|
1081
|
+
var attributes = originalLayoutAttribute.objectAtIndex(i);
|
1082
|
+
visibleLayoutAttributes[i] = attributes;
|
1083
|
+
var frame = attributes.frame;
|
1084
|
+
var width = attributes.frame.size.width * 0.75;
|
1085
|
+
var height = attributes.frame.size.height * 0.75;
|
1086
|
+
attributes.frame.size.width = width;
|
1087
|
+
attributes.frame.size.height = height;
|
1088
|
+
var spacing = owner.convertToSize(owner.spacing);
|
1089
|
+
var distance = Math.abs(this.collectionView.contentOffset.x +
|
1090
|
+
this.collectionView.contentInset.left +
|
1091
|
+
spacing -
|
1092
|
+
frame.origin.x);
|
1093
|
+
var scale = Math.min(Math.max(1 -
|
1094
|
+
distance /
|
1095
|
+
this.collectionView.bounds.size.width, 0.75), 1);
|
1096
|
+
attributes.transform = CGAffineTransformScale(attributes.transform, 1, scale);
|
1097
|
+
}
|
1098
|
+
}
|
1099
|
+
else {
|
1100
|
+
return originalLayoutAttribute;
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
return visibleLayoutAttributes;
|
1104
|
+
};
|
1105
|
+
UICollectionViewFlowLinearLayoutImpl.prototype.shouldInvalidateLayoutForBoundsChange = function (newBounds) {
|
1106
|
+
return true;
|
1107
|
+
};
|
1108
|
+
UICollectionViewFlowLinearLayoutImpl.prototype.initialLayoutAttributesForAppearingItemAtIndexPath = function (itemIndexPath) {
|
1109
|
+
var attrs = _super.prototype.initialLayoutAttributesForAppearingItemAtIndexPath.call(this, itemIndexPath);
|
1110
|
+
attrs.alpha = 1;
|
1111
|
+
return attrs;
|
1112
|
+
};
|
1113
|
+
UICollectionViewFlowLinearLayoutImpl.prototype.finalLayoutAttributesForDisappearingItemAtIndexPath = function (itemIndexPath) {
|
1114
|
+
var attrs = _super.prototype.finalLayoutAttributesForDisappearingItemAtIndexPath.call(this, itemIndexPath);
|
1115
|
+
attrs.alpha = 1;
|
1116
|
+
return attrs;
|
1117
|
+
};
|
1118
|
+
UICollectionViewFlowLinearLayoutImpl.prototype.targetContentOffsetForProposedContentOffsetWithScrollingVelocity = function (proposedContentOffset, velocity) {
|
1119
|
+
var owner = this._owner ? this._owner.get() : null;
|
1120
|
+
if (!this.collectionView || !owner) {
|
1121
|
+
return _super.prototype.targetContentOffsetForProposedContentOffsetWithScrollingVelocity.call(this, proposedContentOffset, velocity);
|
1122
|
+
}
|
1123
|
+
var size = owner._getRealWidthHeight();
|
1124
|
+
if (this.scrollDirection === UICollectionViewScrollDirection.Horizontal) {
|
1125
|
+
// Page width used for estimating and calculating paging.
|
1126
|
+
var pageWidth = size.width + this.minimumInteritemSpacing;
|
1127
|
+
// Make an estimation of the current page position.
|
1128
|
+
var approximatePage = this.collectionView.contentOffset.x / pageWidth;
|
1129
|
+
// Determine the current page based on velocity.
|
1130
|
+
var currentPage = velocity.x === 0
|
1131
|
+
? Math.round(approximatePage)
|
1132
|
+
: velocity.x < 0.0
|
1133
|
+
? Math.floor(approximatePage)
|
1134
|
+
: Math.ceil(approximatePage);
|
1135
|
+
// Create custom flickVelocity.
|
1136
|
+
var flickVelocity = velocity.x * 0.3;
|
1137
|
+
// Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
|
1138
|
+
var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1
|
1139
|
+
? 0
|
1140
|
+
: Math.round(flickVelocity);
|
1141
|
+
var newPageIndex = currentPage + flickedPages;
|
1142
|
+
selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
|
1143
|
+
// Calculate newHorizontalOffset.
|
1144
|
+
var newHorizontalOffset = newPageIndex * pageWidth -
|
1145
|
+
this.collectionView.contentInset.left;
|
1146
|
+
return CGPointMake(newHorizontalOffset, proposedContentOffset.y);
|
1147
|
+
}
|
1148
|
+
else {
|
1149
|
+
// Page height used for estimating and calculating paging.
|
1150
|
+
// let pageHeight = size.height + this.minimumLineSpacing;
|
1151
|
+
var pageHeight = size.height;
|
1152
|
+
// Make an estimation of the current page position.
|
1153
|
+
var approximatePage = Math.max(0, this.collectionView.contentOffset.y / pageHeight);
|
1154
|
+
// Determine the current page based on velocity.
|
1155
|
+
var currentPage = velocity.y === 0
|
1156
|
+
? Math.round(approximatePage)
|
1157
|
+
: velocity.y < 0.0
|
1158
|
+
? Math.floor(approximatePage)
|
1159
|
+
: Math.ceil(approximatePage);
|
1160
|
+
// Create custom flickVelocity.
|
1161
|
+
var flickVelocity = velocity.y * 0.3;
|
1162
|
+
// Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
|
1163
|
+
var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1
|
1164
|
+
? 0
|
1165
|
+
: Math.round(flickVelocity);
|
1166
|
+
var newPageIndex = currentPage + flickedPages;
|
1167
|
+
selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
|
1168
|
+
var newVerticalOffset = newPageIndex * pageHeight -
|
1169
|
+
this.collectionView.contentInset.top;
|
1170
|
+
return CGPointMake(proposedContentOffset.x, newVerticalOffset);
|
1171
|
+
}
|
1172
|
+
};
|
1173
|
+
return UICollectionViewFlowLinearLayoutImpl;
|
1174
|
+
}(UICollectionViewFlowLayout));
|
1175
|
+
//# sourceMappingURL=pager.ios.js.map
|