@nativescript-community/ui-pager 13.0.30 → 13.0.34

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +186 -266
  3. package/angular/esm2020/index.mjs +54 -0
  4. package/angular/esm2020/nativescript-community-ui-pager-angular.mjs +2 -0
  5. package/angular/esm2020/pager-items-comp.mjs +304 -0
  6. package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs +379 -0
  7. package/angular/fesm2015/nativescript-community-ui-pager-angular.mjs.map +1 -0
  8. package/angular/{fesm2015/nativescript-community-ui-pager-angular.js → fesm2020/nativescript-community-ui-pager-angular.mjs} +15 -24
  9. package/angular/fesm2020/nativescript-community-ui-pager-angular.mjs.map +1 -0
  10. package/angular/package.json +20 -6
  11. package/{pager.android.d.ts → index.android.d.ts} +3 -3
  12. package/{pager.android.js → index.android.js} +22 -33
  13. package/index.android.js.map +1 -0
  14. package/{pager.common.d.ts → index.common.d.ts} +2 -1
  15. package/{pager.common.js → index.common.js} +38 -43
  16. package/index.common.js.map +1 -0
  17. package/{pager.d.ts → index.d.ts} +2 -2
  18. package/{pager.ios.d.ts → index.ios.d.ts} +20 -18
  19. package/{pager.ios.js → index.ios.js} +177 -184
  20. package/index.ios.js.map +1 -0
  21. package/package.json +17 -4
  22. package/platforms/android/native-api-usage.json +7 -5
  23. package/react/index.d.ts +7 -7
  24. package/react/index.js +1 -1
  25. package/react/index.js.map +1 -1
  26. package/references.d.ts +1 -0
  27. package/svelte/index.d.ts +1 -1
  28. package/svelte/index.js +6 -6
  29. package/svelte/index.js.map +1 -1
  30. package/typings/objc!CHIPageControl.d.ts +197 -0
  31. package/vue/pager.js +15 -15
  32. package/vue/pager.js.map +1 -1
  33. package/.pnpm-debug.log +0 -1
  34. package/angular/bundles/nativescript-community-ui-pager-angular.umd.js +0 -753
  35. package/angular/bundles/nativescript-community-ui-pager-angular.umd.js.map +0 -1
  36. package/angular/esm2015/index.js +0 -55
  37. package/angular/esm2015/nativescript-community-ui-pager-angular.js +0 -2
  38. package/angular/esm2015/pager-items-comp.js +0 -312
  39. package/angular/fesm2015/nativescript-community-ui-pager-angular.js.map +0 -1
  40. package/pager.android.js.map +0 -1
  41. package/pager.common.js.map +0 -1
  42. package/pager.ios.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { ChangeType, Color, Observable, ObservableArray, Property, ProxyViewContainer, StackLayout, Utils, View, profile } from '@nativescript/core';
2
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';
3
+ import { ITEMDISPOSING, ITEMLOADING, Indicator, LOADMOREITEMS, PagerBase, autoPlayProperty, autoplayDelayProperty, disableSwipeProperty, indicatorColorProperty, indicatorProperty, indicatorSelectedColorProperty, itemTemplatesProperty, itemsProperty, orientationProperty, selectedIndexProperty, showIndicatorProperty } from './index.common';
4
+ export * from './index.common';
5
+ export { Transformer } from './index.common';
6
6
  function notifyForItemAtIndex(owner, nativeView, view, eventName, index) {
7
7
  const args = {
8
8
  eventName,
@@ -10,7 +10,7 @@ function notifyForItemAtIndex(owner, nativeView, view, eventName, index) {
10
10
  index,
11
11
  view,
12
12
  ios: nativeView,
13
- android: undefined,
13
+ android: undefined
14
14
  };
15
15
  owner.notify(args);
16
16
  return args;
@@ -67,37 +67,33 @@ export class Pager extends PagerBase {
67
67
  constructor() {
68
68
  super();
69
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;
70
+ this.mDisableSwipe = false;
71
+ this.mDisableAnimation = false;
72
+ this.mPreparingCell = false;
73
+ this.mIsRefreshing = false;
74
+ this.mIsInit = false;
75
+ this.mInnerWidth = 0;
76
+ this.mInnerHeight = 0;
77
77
  this._observableArrayHandler = (args) => {
78
78
  if (!this.pager) {
79
79
  return;
80
80
  }
81
- if (this.indicatorView &&
82
- this._observableArrayInstance &&
83
- this._observableArrayInstance.length) {
84
- this.indicatorView.numberOfPages = this._observableArrayInstance.length;
81
+ if (this.indicatorView && this.mObservableArrayInstance && this.mObservableArrayInstance.length) {
82
+ this.indicatorView.numberOfPages = this.mObservableArrayInstance.length;
85
83
  }
86
84
  const collectionView = this.pager;
87
85
  if (collectionView) {
88
86
  try {
89
87
  let offset = 0;
90
88
  collectionView.performBatchUpdatesCompletion(() => {
91
- this._isRefreshing = true;
89
+ this.mIsRefreshing = true;
92
90
  const array = [];
93
91
  switch (args.action) {
94
92
  case ChangeType.Add:
95
93
  for (let i = 0; i < args.addedCount; i++) {
96
94
  array.push(NSIndexPath.indexPathForRowInSection(args.index + i, 0));
97
95
  }
98
- offset =
99
- collectionView.contentSize.width -
100
- collectionView.contentOffset.x;
96
+ offset = collectionView.contentSize.width - collectionView.contentOffset.x;
101
97
  collectionView.insertItemsAtIndexPaths(array);
102
98
  break;
103
99
  case ChangeType.Delete:
@@ -122,16 +118,14 @@ export class Pager extends PagerBase {
122
118
  }
123
119
  break;
124
120
  case ChangeType.Update:
125
- collectionView.reloadItemsAtIndexPaths([
126
- NSIndexPath.indexPathForRowInSection(args.index, 0),
127
- ]);
121
+ collectionView.reloadItemsAtIndexPaths([NSIndexPath.indexPathForRowInSection(args.index, 0)]);
128
122
  break;
129
123
  default:
130
124
  break;
131
125
  }
132
126
  this._initAutoPlay(this.autoPlay);
133
127
  if (this.itemCount === 0) {
134
- this._isInit = false;
128
+ this.mIsInit = false;
135
129
  }
136
130
  }, null);
137
131
  }
@@ -140,21 +134,20 @@ export class Pager extends PagerBase {
140
134
  };
141
135
  this._isDataDirty = false;
142
136
  this.iosOverflowSafeAreaEnabledLayoutHackNeeded = true;
143
- this._map = new Map();
137
+ this.mMap = new Map();
144
138
  }
145
139
  get pager() {
146
- return this._pager;
140
+ return this.mPager;
147
141
  }
148
142
  get indicatorView() {
149
- return this._indicatorView;
143
+ return this.mIndicatorView;
150
144
  }
151
145
  createNativeView() {
152
146
  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);
147
+ this.mLayout = UICollectionViewFlowLinearLayoutImpl.initWithOwner(new WeakRef(this));
148
+ this.mLayout.scrollDirection = 1;
149
+ this.mLayout.minimumInteritemSpacing = 0;
150
+ const pager = (this.mPager = UICollectionView.alloc().initWithFrameCollectionViewLayout(CGRectZero, this.mLayout));
158
151
  pager.backgroundColor = UIColor.clearColor;
159
152
  pager.autoresizesSubviews = false;
160
153
  pager.autoresizingMask = 0;
@@ -168,38 +161,31 @@ export class Pager extends PagerBase {
168
161
  super.initNativeView();
169
162
  const nativeView = this.pager;
170
163
  nativeView.registerClassForCellWithReuseIdentifier(PagerCell.class(), this._defaultTemplate.key);
171
- nativeView.dataSource = this._dataSource = UICollectionViewDataSourceImpl.initWithOwner(new WeakRef(this));
164
+ nativeView.backgroundColor = UIColor.clearColor;
165
+ nativeView.autoresizesSubviews = false;
166
+ nativeView.autoresizingMask = 0;
167
+ nativeView.dataSource = this.mDataSource = UICollectionViewDataSourceImpl.initWithOwner(new WeakRef(this));
172
168
  nativeView.scrollEnabled = !this.disableSwipe;
173
169
  if (this.orientation === 'vertical') {
174
- this._layout.scrollDirection =
175
- 0;
170
+ this.mLayout.scrollDirection = 0;
176
171
  nativeView.alwaysBounceVertical = true;
177
172
  nativeView.alwaysBounceHorizontal = false;
178
173
  }
179
174
  else {
180
- this._layout.scrollDirection =
181
- 1;
175
+ this.mLayout.scrollDirection = 1;
182
176
  nativeView.alwaysBounceHorizontal = true;
183
177
  nativeView.alwaysBounceVertical = false;
184
178
  }
185
179
  this._setIndicator(this.indicator);
186
- this._delegate = UICollectionDelegateImpl.initWithOwner(new WeakRef(this));
180
+ this.mDelegate = UICollectionDelegateImpl.initWithOwner(new WeakRef(this));
187
181
  this._setNativeClipToBounds();
188
182
  this._initAutoPlay(this.autoPlay);
189
183
  }
190
184
  _getRealWidthHeight() {
191
185
  let height = 0;
192
186
  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;
187
+ width = (layout.toDeviceIndependentPixels(this._effectiveItemWidth) - (this.perPage * 2 * this._getSpacing() + this._getPeaking() * 2)) / this.perPage;
188
+ height = (layout.toDeviceIndependentPixels(this._effectiveItemHeight) - (this.perPage * 2 * this._getSpacing() + this._getPeaking() * 2)) / this.perPage;
203
189
  return { height, width };
204
190
  }
205
191
  _nextIndex() {
@@ -248,9 +234,7 @@ export class Pager extends PagerBase {
248
234
  return position;
249
235
  }
250
236
  get itemCount() {
251
- return this._childrenCount
252
- ? this._childrenCount + (this.circularMode ? 2 : 0)
253
- : 0;
237
+ return this._childrenCount ? this._childrenCount + (this.circularMode ? 2 : 0) : 0;
254
238
  }
255
239
  get lastIndex() {
256
240
  if (this.items && this.items.length === 0) {
@@ -269,33 +253,47 @@ export class Pager extends PagerBase {
269
253
  return this.lastIndex;
270
254
  }
271
255
  _setIndicator(value) {
272
- if (this._indicatorView) {
273
- this._indicatorView.removeFromSuperview();
256
+ if (this.mIndicatorView) {
257
+ this.mIndicatorView.removeFromSuperview();
274
258
  }
275
259
  switch (value) {
276
260
  case Indicator.None:
277
- this._indicatorView = CHIPageControlAji.new();
261
+ this.mIndicatorView = CHIPageControlAji.new();
278
262
  break;
279
263
  case Indicator.Worm:
280
- this._indicatorView = CHIPageControlAleppo.new();
264
+ this.mIndicatorView = CHIPageControlAleppo.new();
281
265
  break;
282
266
  case Indicator.Fill:
283
- this._indicatorView = CHIPageControlChimayo.new();
267
+ this.mIndicatorView = CHIPageControlChimayo.new();
284
268
  break;
285
269
  case Indicator.Swap:
286
- this._indicatorView = CHIPageControlPuya.new();
270
+ this.mIndicatorView = CHIPageControlPuya.new();
287
271
  break;
288
272
  case Indicator.THIN_WORM:
289
- this._indicatorView = CHIPageControlJalapeno.new();
273
+ this.mIndicatorView = CHIPageControlJalapeno.new();
290
274
  break;
291
275
  case Indicator.Flat:
292
- this._indicatorView = CHIPageControlJaloro.new();
276
+ this.mIndicatorView = CHIPageControlJaloro.new();
293
277
  break;
294
278
  default:
295
279
  break;
296
280
  }
297
- this._indicatorView.tintColor = UIColor.whiteColor;
298
- this._indicatorView.currentPageTintColor = UIColor.whiteColor;
281
+ this.mIndicatorView.tintColor = UIColor.whiteColor;
282
+ this.mIndicatorView.currentPageTintColor = UIColor.whiteColor;
283
+ switch (value) {
284
+ case Indicator.None:
285
+ case Indicator.Worm:
286
+ case Indicator.Fill:
287
+ case Indicator.Swap:
288
+ case Indicator.THIN_WORM:
289
+ case Indicator.Disabled:
290
+ this.mIndicatorView.radius = 4;
291
+ break;
292
+ case Indicator.Flat:
293
+ this.mIndicatorView.radius = 2;
294
+ this.mIndicatorView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.7, 0.5);
295
+ break;
296
+ }
299
297
  }
300
298
  get _childrenCount() {
301
299
  var _a, _b;
@@ -307,25 +305,21 @@ export class Pager extends PagerBase {
307
305
  }
308
306
  [orientationProperty.setNative](value) {
309
307
  if (value === 'horizontal') {
310
- this._layout.scrollDirection =
311
- 1;
308
+ this.mLayout.scrollDirection = 1;
312
309
  }
313
310
  else {
314
- this._layout.scrollDirection =
315
- 0;
311
+ this.mLayout.scrollDirection = 0;
316
312
  }
317
313
  }
318
314
  eachChildView(callback) {
319
- this._map.forEach((view, key) => callback(view));
315
+ this.mMap.forEach((view, key) => callback(view));
320
316
  }
321
317
  eachChild(callback) {
322
- this._map.forEach((view, key) => callback(view));
318
+ this.mMap.forEach((view, key) => callback(view));
323
319
  }
324
320
  _updateScrollPosition() {
325
321
  const view = this.pager;
326
- const size = this.orientation === 'vertical'
327
- ? view.contentSize.height
328
- : view.contentSize.width;
322
+ const size = this.orientation === 'vertical' ? view.contentSize.height : view.contentSize.width;
329
323
  if (!view || size === 0) {
330
324
  return;
331
325
  }
@@ -352,19 +346,19 @@ export class Pager extends PagerBase {
352
346
  if (this.indicatorView && value && value.length) {
353
347
  this.indicatorView.numberOfPages = value.length;
354
348
  }
355
- if (this._observableArrayInstance) {
356
- this._observableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
357
- this._observableArrayInstance = null;
349
+ if (this.mObservableArrayInstance) {
350
+ this.mObservableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
351
+ this.mObservableArrayInstance = null;
358
352
  }
359
353
  if (value instanceof ObservableArray) {
360
- this._observableArrayInstance = value;
361
- this._observableArrayInstance.on(ObservableArray.changeEvent, this._observableArrayHandler);
354
+ this.mObservableArrayInstance = value;
355
+ this.mObservableArrayInstance.on(ObservableArray.changeEvent, this._observableArrayHandler);
362
356
  }
363
357
  else {
364
358
  this.refresh();
365
359
  }
366
360
  if (!value) {
367
- this._isInit = false;
361
+ this.mIsInit = false;
368
362
  }
369
363
  selectedIndexProperty.coerce(this);
370
364
  }
@@ -385,8 +379,7 @@ export class Pager extends PagerBase {
385
379
  if (!this.nativeView) {
386
380
  return;
387
381
  }
388
- this.indicatorView.center = CGPointMake(this.nativeView.center.x, this.nativeView.bounds.size.height -
389
- this.indicatorView.intrinsicContentSize.height);
382
+ this.indicatorView.center = CGPointMake(this.nativeView.center.x, this.nativeView.bounds.size.height - this.indicatorView.intrinsicContentSize.height);
390
383
  const hasParent = this.indicatorView.superview;
391
384
  if (value) {
392
385
  if (!hasParent) {
@@ -404,9 +397,7 @@ export class Pager extends PagerBase {
404
397
  if (!this.pager)
405
398
  return;
406
399
  const contentSize = this.pager.contentSize;
407
- const size = this.orientation === 'vertical'
408
- ? contentSize.height
409
- : contentSize.width;
400
+ const size = this.orientation === 'vertical' ? contentSize.height : contentSize.width;
410
401
  if (size === 0) {
411
402
  return;
412
403
  }
@@ -429,9 +420,9 @@ export class Pager extends PagerBase {
429
420
  }
430
421
  }
431
422
  dispatch_async(main_queue, () => {
432
- this.pager.scrollToItemAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(maxMinIndex, 0), this.orientation === 'vertical'
433
- ? 2
434
- : 16, !!animate);
423
+ if (this.mDataSource.collectionViewNumberOfItemsInSection(this.pager, 0) > maxMinIndex) {
424
+ this.pager.scrollToItemAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(maxMinIndex, 0), this.orientation === 'vertical' ? 2 : 16, !!animate);
425
+ }
435
426
  selectedIndexProperty.nativeValueChange(this, maxMinIndex);
436
427
  });
437
428
  }
@@ -444,8 +435,8 @@ export class Pager extends PagerBase {
444
435
  return;
445
436
  }
446
437
  this._isDataDirty = false;
447
- this._lastLayoutKey = this._innerWidth + '_' + this._innerHeight;
448
- this._map.forEach((view, nativeView, map) => {
438
+ this.mLastLayoutKey = this.mInnerWidth + '_' + this.mInnerHeight;
439
+ this.mMap.forEach((view, nativeView, map) => {
449
440
  if (!(view.bindingContext instanceof Observable)) {
450
441
  view.bindingContext = null;
451
442
  }
@@ -460,10 +451,10 @@ export class Pager extends PagerBase {
460
451
  if (this.showIndicator && this.indicatorView) {
461
452
  this.nativeView.addSubview(this.indicatorView);
462
453
  }
463
- if (this._isDataDirty && this._innerWidth !== undefined && this._innerHeight !== undefined) {
454
+ if (this._isDataDirty && this.mInnerWidth !== undefined && this.mInnerHeight !== undefined) {
464
455
  this.refresh();
465
456
  }
466
- this.pager.delegate = this._delegate;
457
+ this.pager.delegate = this.mDelegate;
467
458
  if (!this.items && this._childrenCount > 0) {
468
459
  selectedIndexProperty.coerce(this);
469
460
  this._updateScrollPosition();
@@ -476,42 +467,78 @@ export class Pager extends PagerBase {
476
467
  super.onUnloaded();
477
468
  }
478
469
  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
- }
470
+ this.mDelegate = null;
471
+ this.mDataSource = null;
472
+ if (this.mPager) {
473
+ this.mPager.delegate = null;
474
+ this.mPager = null;
475
+ }
476
+ this.mIndicatorView = null;
477
+ this.mLayout = null;
478
+ if (this.mObservableArrayInstance) {
479
+ this.mObservableArrayInstance.off(ObservableArray.changeEvent, this._observableArrayHandler);
480
+ this.mObservableArrayInstance = null;
481
+ }
482
+ this.clearRealizedCells();
486
483
  super.disposeNativeView();
487
484
  }
485
+ clearRealizedCells() {
486
+ const that = new WeakRef(this);
487
+ this.mMap.forEach(function (value, key) {
488
+ that.get()._removeContainer(key);
489
+ that.get()._clearCellViews(key);
490
+ }, that);
491
+ this.mMap.clear();
492
+ }
493
+ _clearCellViews(cell) {
494
+ const view = cell.view;
495
+ if (!view) {
496
+ return;
497
+ }
498
+ if (view.parent && !(view.parent instanceof Pager)) {
499
+ this._removeView(view.parent);
500
+ }
501
+ cell.owner = undefined;
502
+ const preparing = this.mPreparingCell;
503
+ this.mPreparingCell = true;
504
+ if (view.parent && !(view.parent instanceof Pager)) {
505
+ if (!(view.parent instanceof Pager)) {
506
+ this._removeView(view.parent);
507
+ }
508
+ else {
509
+ view.parent._removeView(view);
510
+ }
511
+ }
512
+ this.mPreparingCell = preparing;
513
+ this.mMap.delete(cell);
514
+ }
488
515
  [indicatorProperty.setNative](value) {
489
516
  this._setIndicator(value);
490
517
  }
491
518
  [indicatorColorProperty.setNative](value) {
492
519
  if (this.indicatorView) {
493
- const color = (!value || value instanceof Color) ? value : new Color(value);
520
+ const color = !value || value instanceof Color ? value : new Color(value);
494
521
  this.indicatorView.tintColor = color ? color.ios : null;
495
522
  }
496
523
  }
497
524
  [indicatorSelectedColorProperty.setNative](value) {
498
525
  if (this.indicatorView) {
499
- const color = (!value || value instanceof Color) ? value : new Color(value);
526
+ const color = !value || value instanceof Color ? value : new Color(value);
500
527
  this.indicatorView.currentPageTintColor = color ? color.ios : null;
501
528
  }
502
529
  }
503
530
  [disableSwipeProperty.setNative](value) {
504
- this._pager.scrollEnabled = !value;
505
- this._disableSwipe = value;
531
+ this.mPager.scrollEnabled = !value;
532
+ this.mDisableSwipe = value;
506
533
  }
507
534
  [contentInsetAdjustmentBehaviorProperty.setNative](value) {
508
- this._pager.contentInsetAdjustmentBehavior = value;
535
+ this.mPager.contentInsetAdjustmentBehavior = value;
509
536
  }
510
537
  get disableAnimation() {
511
- return this._disableAnimation;
538
+ return this.mDisableAnimation;
512
539
  }
513
540
  set disableAnimation(value) {
514
- this._disableAnimation = value;
541
+ this.mDisableAnimation = value;
515
542
  }
516
543
  _removeContainer(cell, index) {
517
544
  let view = cell.view;
@@ -521,7 +548,7 @@ export class Pager extends PagerBase {
521
548
  index,
522
549
  android: undefined,
523
550
  ios: cell,
524
- view,
551
+ view
525
552
  };
526
553
  this.notify(args);
527
554
  view = args.view;
@@ -531,19 +558,19 @@ export class Pager extends PagerBase {
531
558
  }
532
559
  view.parent._removeView(view);
533
560
  }
534
- this._map.delete(cell);
561
+ this.mMap.delete(cell);
535
562
  }
536
563
  onMeasure(widthMeasureSpec, heightMeasureSpec) {
537
564
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
538
- this._map.forEach((childView, pagerCell) => {
565
+ this.mMap.forEach((childView, pagerCell) => {
539
566
  View.measureChild(this, childView, childView._currentWidthMeasureSpec, childView._currentHeightMeasureSpec);
540
567
  });
541
568
  }
542
569
  updateInnerSize() {
543
570
  const width = this.getMeasuredWidth();
544
571
  const height = this.getMeasuredHeight();
545
- this._innerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
546
- this._innerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
572
+ this.mInnerWidth = width - this.effectivePaddingLeft - this.effectivePaddingRight;
573
+ this.mInnerHeight = height - this.effectivePaddingTop - this.effectivePaddingBottom;
547
574
  }
548
575
  onLayout(left, top, right, bottom) {
549
576
  super.onLayout(left, top, right, bottom);
@@ -553,8 +580,7 @@ export class Pager extends PagerBase {
553
580
  }
554
581
  this.pager.frame = this.nativeView.bounds;
555
582
  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);
583
+ this.indicatorView.center = CGPointMake(this.nativeView.center.x, this.nativeView.bounds.size.height - this.indicatorView.intrinsicContentSize.height);
558
584
  }
559
585
  const layoutView = this.pager.collectionViewLayout;
560
586
  if (!layoutView) {
@@ -562,24 +588,24 @@ export class Pager extends PagerBase {
562
588
  }
563
589
  layoutView.invalidateLayout();
564
590
  const size = this._getSize();
565
- this._map.forEach((childView, pagerCell) => {
591
+ this.mMap.forEach((childView, pagerCell) => {
566
592
  const width = layout.toDevicePixels(size.width);
567
593
  const height = layout.toDevicePixels(size.height);
568
594
  View.layoutChild(this, childView, 0, 0, width, height);
569
595
  });
570
- const layoutKey = this._innerWidth + '_' + this._innerHeight;
571
- if (this._lastLayoutKey !== layoutKey) {
596
+ const layoutKey = this.mInnerWidth + '_' + this.mInnerHeight;
597
+ if (this.mLastLayoutKey !== layoutKey) {
572
598
  this.refresh();
573
599
  }
574
600
  }
575
601
  requestLayout() {
576
- if (!this._preparingCell) {
602
+ if (!this.mPreparingCell) {
577
603
  super.requestLayout();
578
604
  }
579
605
  }
580
606
  _prepareCell(cell, indexPath) {
581
607
  try {
582
- this._preparingCell = true;
608
+ this.mPreparingCell = true;
583
609
  const index = indexPath.row;
584
610
  let view = cell.view;
585
611
  const template = this._getItemTemplate(indexPath.row);
@@ -597,7 +623,7 @@ export class Pager extends PagerBase {
597
623
  android: undefined,
598
624
  ios: cell,
599
625
  view,
600
- bindingContext,
626
+ bindingContext
601
627
  };
602
628
  this.notify(args);
603
629
  view = args.view || this._getDefaultItemContent(indexPath.row);
@@ -610,7 +636,7 @@ export class Pager extends PagerBase {
610
636
  cell.owner = new WeakRef(view);
611
637
  }
612
638
  else if (cell.view !== view) {
613
- this._map.delete(cell);
639
+ this.mMap.delete(cell);
614
640
  this._removeContainer(cell, index);
615
641
  cell.view.nativeViewProtected.removeFromSuperview();
616
642
  cell.owner = new WeakRef(view);
@@ -618,7 +644,7 @@ export class Pager extends PagerBase {
618
644
  if (view) {
619
645
  view.bindingContext = bindingContext;
620
646
  }
621
- this._map.set(cell, view);
647
+ this.mMap.set(cell, view);
622
648
  if (view && !view.parent) {
623
649
  this._addView(view);
624
650
  if (this.iosOverflowSafeArea) {
@@ -634,7 +660,7 @@ export class Pager extends PagerBase {
634
660
  this._layoutCell(view, indexPath);
635
661
  }
636
662
  finally {
637
- this._preparingCell = false;
663
+ this.mPreparingCell = false;
638
664
  }
639
665
  }
640
666
  _layoutCell(cellView, index) {
@@ -663,14 +689,10 @@ export class Pager extends PagerBase {
663
689
  let width = layout.toDeviceIndependentPixels(this._effectiveItemWidth);
664
690
  let height = layout.toDeviceIndependentPixels(this._effectiveItemHeight);
665
691
  if (this.orientation === 'vertical') {
666
- height =
667
- (height - (this._getSpacing() * 2 + this._getPeaking() * 2)) /
668
- this.perPage;
692
+ height = (height - (this._getSpacing() * 2 + this._getPeaking() * 2)) / this.perPage;
669
693
  }
670
694
  else {
671
- width =
672
- (width - (this._getSpacing() * 2 + this._getPeaking() * 2)) /
673
- this.perPage;
695
+ width = (width - (this._getSpacing() * 2 + this._getPeaking() * 2)) / this.perPage;
674
696
  }
675
697
  if (Number.isNaN(width)) {
676
698
  width = 0;
@@ -732,14 +754,14 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
732
754
  bottom: inset,
733
755
  left: 0,
734
756
  right: 0,
735
- top: inset,
757
+ top: inset
736
758
  });
737
759
  }
738
760
  return new UIEdgeInsets({
739
761
  bottom: 0,
740
762
  left: inset,
741
763
  right: inset,
742
- top: 0,
764
+ top: 0
743
765
  });
744
766
  }
745
767
  return new UIEdgeInsets({ bottom: 0, left: 0, right: 0, top: 0 });
@@ -754,15 +776,14 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
754
776
  UICollectionDelegateImpl.prototype.collectionViewWillDisplayCellForItemAtIndexPath = function (collectionView, cell, indexPath) {
755
777
  var owner = this._owner && this._owner.get();
756
778
  if (owner) {
757
- if (!owner._isInit) {
779
+ if (!owner.mIsInit) {
758
780
  owner._updateScrollPosition();
759
- owner._isInit = true;
781
+ owner.mIsInit = true;
760
782
  }
761
- if (owner.items &&
762
- indexPath.row === owner.lastIndex - owner.loadMoreCount) {
783
+ if (owner.items && indexPath.row === owner.lastIndex - owner.loadMoreCount) {
763
784
  owner.notify({
764
785
  eventName: LOADMOREITEMS,
765
- object: owner,
786
+ object: owner
766
787
  });
767
788
  }
768
789
  }
@@ -786,7 +807,7 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
786
807
  if (owner.lastEvent === 0) {
787
808
  owner.notify({
788
809
  eventName: Pager.swipeStartEvent,
789
- object: owner,
810
+ object: owner
790
811
  });
791
812
  owner.lastEvent = 1;
792
813
  }
@@ -797,7 +818,7 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
797
818
  if (owner) {
798
819
  owner.notify({
799
820
  eventName: Pager.swipeEvent,
800
- object: owner,
821
+ object: owner
801
822
  });
802
823
  }
803
824
  };
@@ -811,21 +832,16 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
811
832
  if (owner.orientation === 'vertical') {
812
833
  width = size.height;
813
834
  offset = scrollView.contentOffset.y;
814
- total =
815
- scrollView.contentSize.height -
816
- scrollView.bounds.size.height;
835
+ total = scrollView.contentSize.height - scrollView.bounds.size.height;
817
836
  }
818
837
  else {
819
838
  width = size.width;
820
839
  offset = scrollView.contentOffset.x;
821
- total =
822
- scrollView.contentSize.width - scrollView.bounds.size.width;
840
+ total = scrollView.contentSize.width - scrollView.bounds.size.width;
823
841
  }
824
842
  var percent = offset / total;
825
843
  var progress = percent * (owner.itemCount - 1);
826
- if (owner.indicatorView &&
827
- owner.indicatorView.setWithProgressAnimated &&
828
- !Number.isNaN(progress)) {
844
+ if (owner.indicatorView && owner.indicatorView.setWithProgressAnimated && !Number.isNaN(progress)) {
829
845
  owner.indicatorView.progress = progress;
830
846
  }
831
847
  var index = parseInt(progress.toFixed(0), 10);
@@ -838,12 +854,12 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
838
854
  selectedIndex: Math.floor(progress),
839
855
  currentPosition: progress,
840
856
  scrollX: owner.horizontalOffset,
841
- scrollY: owner.verticalOffset,
857
+ scrollY: owner.verticalOffset
842
858
  });
843
859
  if (owner.lastEvent === 1) {
844
860
  owner.notify({
845
861
  eventName: Pager.swipeOverEvent,
846
- object: owner,
862
+ object: owner
847
863
  });
848
864
  owner.lastEvent = 1;
849
865
  }
@@ -921,8 +937,7 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
921
937
  // (owner.nativeView as UICollectionView).setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
922
938
  }
923
939
  };
924
- UICollectionDelegateImpl.prototype.scrollViewDidEndDraggingWillDecelerate = function (scrollView, decelerate) {
925
- };
940
+ UICollectionDelegateImpl.prototype.scrollViewDidEndDraggingWillDecelerate = function (scrollView, decelerate) { };
926
941
  UICollectionDelegateImpl.prototype.scrollViewWillEndDraggingWithVelocityTargetContentOffset = function (scrollView, velocity, targetContentOffset) {
927
942
  var owner = this._owner ? this._owner.get() : null;
928
943
  if (!owner)
@@ -930,7 +945,7 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
930
945
  if (owner.lastEvent === 1) {
931
946
  owner.notify({
932
947
  eventName: Pager.swipeEndEvent,
933
- object: owner,
948
+ object: owner
934
949
  });
935
950
  owner.lastEvent = 0;
936
951
  }
@@ -977,10 +992,9 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
977
992
  var index = indexPath.row;
978
993
  var data = owner._childrenViews[index];
979
994
  var viewType = data.type;
980
- owner._preparingCell = true;
981
- collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), "static-" + viewType);
982
- cell =
983
- collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath("static-" + viewType, indexPath) || PagerCell.initWithEmptyBackground();
995
+ owner.mPreparingCell = true;
996
+ collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), "static-".concat(viewType));
997
+ cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath("static-".concat(viewType), indexPath) || PagerCell.initWithEmptyBackground();
984
998
  cell.index = index;
985
999
  var view = data.view;
986
1000
  // if (view instanceof ProxyViewContainer) {
@@ -994,7 +1008,7 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
994
1008
  }
995
1009
  else if (cell.view !== view) {
996
1010
  owner._removeView(view);
997
- cell.view.nativeViewProtected.removeFromSuperview();
1011
+ // (cell.view.nativeViewProtected as UIView).removeFromSuperview();
998
1012
  cell.owner = new WeakRef(view);
999
1013
  }
1000
1014
  if (view && !view.parent) {
@@ -1015,7 +1029,7 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
1015
1029
  innerView.view = new WeakRef(view);
1016
1030
  innerView.addSubview(view.nativeViewProtected);
1017
1031
  cell.contentView.addSubview(innerView);
1018
- owner._map.set(cell, view);
1032
+ owner.mMap.set(cell, view);
1019
1033
  // } else {
1020
1034
  // cell.contentView.addSubview(view.nativeViewProtected);
1021
1035
  // }
@@ -1029,12 +1043,11 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
1029
1043
  if (view && view.isLayoutRequired) {
1030
1044
  View.layoutChild(owner, view, 0, 0, width, height);
1031
1045
  }
1032
- owner._preparingCell = false;
1046
+ owner.mPreparingCell = false;
1033
1047
  return cell;
1034
1048
  }
1035
1049
  var template = owner && owner._getItemTemplate(indexPath.row);
1036
- cell =
1037
- collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(template.key, indexPath) || PagerCell.initWithEmptyBackground();
1050
+ cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(template.key, indexPath) || PagerCell.initWithEmptyBackground();
1038
1051
  cell.index = indexPath;
1039
1052
  if (owner) {
1040
1053
  var size = owner._getSize();
@@ -1081,8 +1094,7 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1081
1094
  var originalLayoutAttribute = _super.prototype.layoutAttributesForElementsInRect.call(this, rect);
1082
1095
  var visibleLayoutAttributes = [];
1083
1096
  if (owner) {
1084
- if (owner.transformers &&
1085
- owner.transformers.indexOf('scale') > -1) {
1097
+ if (owner.transformers && owner.transformers.indexOf('scale') > -1) {
1086
1098
  var count = originalLayoutAttribute.count;
1087
1099
  for (var i = 0; i < count; i++) {
1088
1100
  var attributes = originalLayoutAttribute.objectAtIndex(i);
@@ -1093,13 +1105,8 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1093
1105
  attributes.frame.size.width = width;
1094
1106
  attributes.frame.size.height = height;
1095
1107
  var spacing = owner.convertToSize(owner.spacing);
1096
- var distance = Math.abs(this.collectionView.contentOffset.x +
1097
- this.collectionView.contentInset.left +
1098
- spacing -
1099
- frame.origin.x);
1100
- var scale = Math.min(Math.max(1 -
1101
- distance /
1102
- this.collectionView.bounds.size.width, 0.75), 1);
1108
+ var distance = Math.abs(this.collectionView.contentOffset.x + this.collectionView.contentInset.left + spacing - frame.origin.x);
1109
+ var scale = Math.min(Math.max(1 - distance / this.collectionView.bounds.size.width, 0.75), 1);
1103
1110
  attributes.transform = CGAffineTransformScale(attributes.transform, 1, scale);
1104
1111
  }
1105
1112
  }
@@ -1134,22 +1141,15 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1134
1141
  // Make an estimation of the current page position.
1135
1142
  var approximatePage = this.collectionView.contentOffset.x / pageWidth;
1136
1143
  // Determine the current page based on velocity.
1137
- var currentPage = velocity.x === 0
1138
- ? Math.round(approximatePage)
1139
- : velocity.x < 0.0
1140
- ? Math.floor(approximatePage)
1141
- : Math.ceil(approximatePage);
1144
+ var currentPage = velocity.x === 0 ? Math.round(approximatePage) : velocity.x < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1142
1145
  // Create custom flickVelocity.
1143
1146
  var flickVelocity = velocity.x * 0.3;
1144
1147
  // Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
1145
- var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1
1146
- ? 0
1147
- : Math.round(flickVelocity);
1148
+ var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1148
1149
  var newPageIndex = currentPage + flickedPages;
1149
1150
  selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
1150
1151
  // Calculate newHorizontalOffset.
1151
- var newHorizontalOffset = newPageIndex * pageWidth -
1152
- this.collectionView.contentInset.left;
1152
+ var newHorizontalOffset = newPageIndex * pageWidth - this.collectionView.contentInset.left;
1153
1153
  return CGPointMake(newHorizontalOffset, proposedContentOffset.y);
1154
1154
  }
1155
1155
  else {
@@ -1159,24 +1159,17 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1159
1159
  // Make an estimation of the current page position.
1160
1160
  var approximatePage = Math.max(0, this.collectionView.contentOffset.y / pageHeight);
1161
1161
  // Determine the current page based on velocity.
1162
- var currentPage = velocity.y === 0
1163
- ? Math.round(approximatePage)
1164
- : velocity.y < 0.0
1165
- ? Math.floor(approximatePage)
1166
- : Math.ceil(approximatePage);
1162
+ var currentPage = velocity.y === 0 ? Math.round(approximatePage) : velocity.y < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1167
1163
  // Create custom flickVelocity.
1168
1164
  var flickVelocity = velocity.y * 0.3;
1169
1165
  // Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
1170
- var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1
1171
- ? 0
1172
- : Math.round(flickVelocity);
1166
+ var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1173
1167
  var newPageIndex = currentPage + flickedPages;
1174
1168
  selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
1175
- var newVerticalOffset = newPageIndex * pageHeight -
1176
- this.collectionView.contentInset.top;
1169
+ var newVerticalOffset = newPageIndex * pageHeight - this.collectionView.contentInset.top;
1177
1170
  return CGPointMake(proposedContentOffset.x, newVerticalOffset);
1178
1171
  }
1179
1172
  };
1180
1173
  return UICollectionViewFlowLinearLayoutImpl;
1181
1174
  }(UICollectionViewFlowLayout));
1182
- //# sourceMappingURL=pager.ios.js.map
1175
+ //# sourceMappingURL=index.ios.js.map