@nativescript-community/ui-pager 13.0.35 → 13.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ios.js CHANGED
@@ -1,6 +1,7 @@
1
+ var PagerCell_1, UICollectionDelegateImpl_1, UICollectionViewDataSourceImpl_1, UICollectionViewFlowLinearLayoutImpl_1;
1
2
  import { ChangeType, Color, Observable, ObservableArray, Property, ProxyViewContainer, StackLayout, Utils, View, ViewBase, profile } from '@nativescript/core';
2
3
  import { layout } from '@nativescript/core/utils/utils';
3
- import { ITEMDISPOSING, ITEMLOADING, Indicator, LOADMOREITEMS, PagerBase, PagerItem, autoPlayProperty, autoplayDelayProperty, disableSwipeProperty, indicatorColorProperty, indicatorProperty, indicatorSelectedColorProperty, itemTemplatesProperty, itemsProperty, orientationProperty, selectedIndexProperty, showIndicatorProperty } from './index.common';
4
+ import { Indicator, PagerBase, PagerItem, autoPlayProperty, autoplayDelayProperty, disableSwipeProperty, indicatorColorProperty, indicatorProperty, indicatorSelectedColorProperty, itemTemplatesProperty, itemsProperty, orientationProperty, selectedIndexProperty, showIndicatorProperty } from './index.common';
4
5
  export * from './index.common';
5
6
  export { Transformer } from './index.common';
6
7
  function notifyForItemAtIndex(owner, nativeView, view, eventName, index) {
@@ -46,22 +47,20 @@ export const contentInsetAdjustmentBehaviorProperty = new Property({
46
47
  valueConverter: parseContentInsetAdjustmentBehavior,
47
48
  defaultValue: ContentInsetAdjustmentBehavior.Automatic
48
49
  });
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();
50
+ let UICellView = class UICellView extends UIView {
51
+ layoutSubviews() {
52
+ const view = this.view && this.view.get();
56
53
  if (!view) {
57
54
  return;
58
55
  }
59
56
  this.frame = this.superview.bounds;
60
- var size = this.bounds.size;
57
+ const size = this.bounds.size;
61
58
  View.layoutChild(null, view, 0, 0, Utils.layout.toDevicePixels(size.width), Utils.layout.toDevicePixels(size.height));
62
- };
63
- return UICellView;
64
- }(UIView));
59
+ }
60
+ };
61
+ UICellView = __decorate([
62
+ NativeClass
63
+ ], UICellView);
65
64
  const PFLAG_FORCE_LAYOUT = 1;
66
65
  export class Pager extends PagerBase {
67
66
  constructor() {
@@ -543,7 +542,7 @@ export class Pager extends PagerBase {
543
542
  _removeContainer(cell, index) {
544
543
  let view = cell.view;
545
544
  const args = {
546
- eventName: ITEMDISPOSING,
545
+ eventName: Pager.itemDisposingEvent,
547
546
  object: this,
548
547
  index,
549
548
  android: undefined,
@@ -617,7 +616,7 @@ export class Pager extends PagerBase {
617
616
  }
618
617
  const bindingContext = this._getDataItem(indexPath.row);
619
618
  const args = {
620
- eventName: ITEMLOADING,
619
+ eventName: Pager.itemLoadingEvent,
621
620
  object: this,
622
621
  index,
623
622
  android: undefined,
@@ -706,49 +705,35 @@ export class Pager extends PagerBase {
706
705
  __decorate([
707
706
  profile
708
707
  ], Pager.prototype, "refresh", null);
709
- var PagerCell = /** @class */ (function (_super) {
710
- __extends(PagerCell, _super);
711
- function PagerCell() {
712
- return _super !== null && _super.apply(this, arguments) || this;
713
- }
714
- Object.defineProperty(PagerCell.prototype, "view", {
715
- get: function () {
716
- return this.owner ? this.owner.get() : null;
717
- },
718
- enumerable: true,
719
- configurable: true
720
- });
721
- PagerCell.initWithEmptyBackground = function () {
722
- var cell = PagerCell.new();
723
- // Clear background by default - this will make cells transparent
708
+ let PagerCell = PagerCell_1 = class PagerCell extends UICollectionViewCell {
709
+ get view() {
710
+ return this.owner ? this.owner.get() : null;
711
+ }
712
+ static initWithEmptyBackground() {
713
+ const cell = PagerCell_1.new();
724
714
  cell.backgroundColor = null;
725
715
  return cell;
726
- };
727
- PagerCell.prototype.willMoveToSuperview = function (newSuperview) {
728
- var parent = (this.view ? this.view.parent : null);
729
- // When inside Pager and there is no newSuperview this cell is
730
- // removed from native visual tree so we remove it from our tree too.
716
+ }
717
+ willMoveToSuperview(newSuperview) {
718
+ const parent = (this.view ? this.view.parent : null);
731
719
  if (parent && !newSuperview) {
732
720
  parent._removeContainer(this, this.index);
733
721
  }
734
- };
735
- return PagerCell;
736
- }(UICollectionViewCell));
737
- var UICollectionDelegateImpl = /** @class */ (function (_super) {
738
- __extends(UICollectionDelegateImpl, _super);
739
- function UICollectionDelegateImpl() {
740
- return _super !== null && _super.apply(this, arguments) || this;
741
- }
742
- UICollectionDelegateImpl_1 = UICollectionDelegateImpl;
743
- UICollectionDelegateImpl.initWithOwner = function (owner) {
744
- var delegate = UICollectionDelegateImpl_1.alloc().init();
722
+ }
723
+ };
724
+ PagerCell = PagerCell_1 = __decorate([
725
+ NativeClass
726
+ ], PagerCell);
727
+ let UICollectionDelegateImpl = UICollectionDelegateImpl_1 = class UICollectionDelegateImpl extends NSObject {
728
+ static initWithOwner(owner) {
729
+ const delegate = UICollectionDelegateImpl_1.alloc().init();
745
730
  delegate._owner = owner;
746
731
  return delegate;
747
- };
748
- UICollectionDelegateImpl.prototype.collectionViewLayoutInsetForSectionAtIndex = function (collectionView, collectionViewLayout, section) {
749
- var owner = this._owner ? this._owner.get() : null;
732
+ }
733
+ collectionViewLayoutInsetForSectionAtIndex(collectionView, collectionViewLayout, section) {
734
+ const owner = this._owner ? this._owner.get() : null;
750
735
  if (owner) {
751
- var inset = owner._getSpacing() + owner._getPeaking();
736
+ const inset = owner._getSpacing() + owner._getPeaking();
752
737
  if (owner.orientation === 'vertical') {
753
738
  return new UIEdgeInsets({
754
739
  bottom: inset,
@@ -765,16 +750,16 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
765
750
  });
766
751
  }
767
752
  return new UIEdgeInsets({ bottom: 0, left: 0, right: 0, top: 0 });
768
- };
769
- UICollectionDelegateImpl.prototype.collectionViewLayoutSizeForItemAtIndexPath = function (collectionView, collectionViewLayout, indexPath) {
770
- var owner = this._owner && this._owner.get();
753
+ }
754
+ collectionViewLayoutSizeForItemAtIndexPath(collectionView, collectionViewLayout, indexPath) {
755
+ const owner = this._owner && this._owner.get();
771
756
  if (!owner)
772
757
  return CGSizeZero;
773
- var size = owner._getSize();
758
+ const size = owner._getSize();
774
759
  return CGSizeMake(size.width, size.height);
775
- };
776
- UICollectionDelegateImpl.prototype.collectionViewWillDisplayCellForItemAtIndexPath = function (collectionView, cell, indexPath) {
777
- var owner = this._owner && this._owner.get();
760
+ }
761
+ collectionViewWillDisplayCellForItemAtIndexPath(collectionView, cell, indexPath) {
762
+ const owner = this._owner && this._owner.get();
778
763
  if (owner) {
779
764
  if (!owner.mIsInit) {
780
765
  owner._updateScrollPosition();
@@ -782,7 +767,7 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
782
767
  }
783
768
  if (owner.items && indexPath.row === owner.lastIndex - owner.loadMoreCount) {
784
769
  owner.notify({
785
- eventName: LOADMOREITEMS,
770
+ eventName: Pager.loadMoreItemsEvent,
786
771
  object: owner
787
772
  });
788
773
  }
@@ -793,16 +778,16 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
793
778
  if (cell.layoutMargins) {
794
779
  cell.layoutMargins = UIEdgeInsetsZero;
795
780
  }
796
- };
797
- UICollectionDelegateImpl.prototype.collectionViewLayoutMinimumLineSpacingForSectionAtIndex = function (collectionView, collectionViewLayout, section) {
798
- var owner = this._owner ? this._owner.get() : null;
781
+ }
782
+ collectionViewLayoutMinimumLineSpacingForSectionAtIndex(collectionView, collectionViewLayout, section) {
783
+ const owner = this._owner ? this._owner.get() : null;
799
784
  if (!owner)
800
785
  return 0;
801
- var result = owner._getSpacing();
786
+ const result = owner._getSpacing();
802
787
  return result;
803
- };
804
- UICollectionDelegateImpl.prototype.scrollViewWillBeginDragging = function (scrollView) {
805
- var owner = this._owner && this._owner.get();
788
+ }
789
+ scrollViewWillBeginDragging(scrollView) {
790
+ const owner = this._owner && this._owner.get();
806
791
  if (owner) {
807
792
  if (owner.lastEvent === 0) {
808
793
  owner.notify({
@@ -812,23 +797,23 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
812
797
  owner.lastEvent = 1;
813
798
  }
814
799
  }
815
- };
816
- UICollectionDelegateImpl.prototype.scrollViewDidEndScrollingAnimation = function (scrollView) {
817
- var owner = this._owner ? this._owner.get() : null;
800
+ }
801
+ scrollViewDidEndScrollingAnimation(scrollView) {
802
+ const owner = this._owner ? this._owner.get() : null;
818
803
  if (owner) {
819
804
  owner.notify({
820
805
  eventName: Pager.swipeEvent,
821
806
  object: owner
822
807
  });
823
808
  }
824
- };
825
- UICollectionDelegateImpl.prototype.scrollViewDidScroll = function (scrollView) {
826
- var owner = this._owner.get();
809
+ }
810
+ scrollViewDidScroll(scrollView) {
811
+ const owner = this._owner.get();
827
812
  if (owner) {
828
- var width = void 0;
829
- var offset = void 0;
830
- var size = owner._getRealWidthHeight();
831
- var total = void 0;
813
+ let width;
814
+ let offset;
815
+ const size = owner._getRealWidthHeight();
816
+ let total;
832
817
  if (owner.orientation === 'vertical') {
833
818
  width = size.height;
834
819
  offset = scrollView.contentOffset.y;
@@ -839,14 +824,13 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
839
824
  offset = scrollView.contentOffset.x;
840
825
  total = scrollView.contentSize.width - scrollView.bounds.size.width;
841
826
  }
842
- var percent = offset / total;
843
- var progress = percent * (owner.itemCount - 1);
827
+ const percent = offset / total;
828
+ const progress = percent * (owner.itemCount - 1);
844
829
  if (owner.indicatorView && owner.indicatorView.setWithProgressAnimated && !Number.isNaN(progress)) {
845
830
  owner.indicatorView.progress = progress;
846
831
  }
847
- var index = parseInt(progress.toFixed(0), 10);
832
+ const index = parseInt(progress.toFixed(0), 10);
848
833
  if (owner.selectedIndex !== index && !Number.isNaN(index)) {
849
- // selectedIndexProperty.nativeValueChange(owner, index);
850
834
  }
851
835
  owner.notify({
852
836
  object: owner,
@@ -863,83 +847,11 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
863
847
  });
864
848
  owner.lastEvent = 1;
865
849
  }
866
- // (scrollView as any).scrollToItemAtIndexPathAtScrollPositionAnimated(
867
- // NSIndexPath.indexPathForRowInSection(Math.round(width),0), UICollectionViewScrollPosition.CenteredHorizontally, true
868
- // );
869
- // if(owner.circularMode){
870
- // if(nextIndex === 0){
871
- // selectedIndexProperty.nativeValueChange(owner, owner._childrenCount - 3);
872
- // }else if(nextIndex === owner._childrenCount -1){
873
- // selectedIndexProperty.nativeValueChange(owner, 0);
874
- // }else {
875
- // selectedIndexProperty.nativeValueChange(owner, nextIndex - 1);
876
- // }
877
- // }else {
878
- // selectedIndexProperty.nativeValueChange(owner, nextIndex);
879
- // }
880
- /* if (!Number.isNaN(width)) {
881
- let page = Math.ceil(width);
882
- const doScroll = () => {
883
- if (!Number.isNaN(width)) {
884
- // scrollView.setContentOffsetAnimated(point, false);
885
- scrollView.contentOffset = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
886
- }
887
- };
888
- console.log('page', page, owner.itemCount, page === owner.itemCount);
889
- if (page === 0) {
890
- page = owner.itemCount - 2;
891
- doScroll();
892
- // selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
893
- } else if (page === owner.itemCount) {
894
- page = 1;
895
- doScroll();
896
- // selectedIndexProperty.nativeValueChange(owner, 0);
897
- } else {
898
- if (page === owner._childrenCount + 1) {
899
- // selectedIndexProperty.nativeValueChange(owner, 0);
900
- } else {
901
- // selectedIndexProperty.nativeValueChange(owner, page - 1);
902
- }
903
-
904
- }
905
- } */
906
- /* if(owner){
907
- let width = 0;
908
- let w = (layout.toDeviceIndependentPixels(owner._effectiveItemWidth) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
909
- let h = (layout.toDeviceIndependentPixels(owner._effectiveItemHeight) - (((owner.perPage * 2) * owner._getSpacing()) + (owner._getPeaking() * 2))) / owner.perPage;
910
- width = scrollView.contentOffset.x / w;
911
- if (!Number.isNaN(width)) {
912
- let page = Math.ceil(width);
913
- const doScroll = () => {
914
- if (!Number.isNaN(width)) {
915
- const point = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
916
- scrollView.setContentOffsetAnimated(point, false);
917
- }
918
- };
919
- if (page === 0) {
920
- page = owner.itemCount - 2;
921
- doScroll();
922
- selectedIndexProperty.nativeValueChange(owner, owner.itemCount - 3);
923
- } else if (page === owner.itemCount -1) {
924
- page = 1;
925
- doScroll();
926
- selectedIndexProperty.nativeValueChange(owner, 0);
927
- } else {
928
- if(page === owner.itemCount + 1){
929
- selectedIndexProperty.nativeValueChange(owner, 0);
930
- }else {
931
- selectedIndexProperty.nativeValueChange(owner, page - 1);
932
- }
933
- }
934
- }
935
- } */
936
- // scrollView.setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
937
- // (owner.nativeView as UICollectionView).setContentOffsetAnimated(CGPointMake((w * width) + 1, 0),false);
938
850
  }
939
- };
940
- UICollectionDelegateImpl.prototype.scrollViewDidEndDraggingWillDecelerate = function (scrollView, decelerate) { };
941
- UICollectionDelegateImpl.prototype.scrollViewWillEndDraggingWithVelocityTargetContentOffset = function (scrollView, velocity, targetContentOffset) {
942
- var owner = this._owner ? this._owner.get() : null;
851
+ }
852
+ scrollViewDidEndDraggingWillDecelerate(scrollView, decelerate) { }
853
+ scrollViewWillEndDraggingWithVelocityTargetContentOffset(scrollView, velocity, targetContentOffset) {
854
+ const owner = this._owner ? this._owner.get() : null;
943
855
  if (!owner)
944
856
  return;
945
857
  if (owner.lastEvent === 1) {
@@ -949,28 +861,22 @@ var UICollectionDelegateImpl = /** @class */ (function (_super) {
949
861
  });
950
862
  owner.lastEvent = 0;
951
863
  }
952
- };
953
- var UICollectionDelegateImpl_1;
954
- UICollectionDelegateImpl = UICollectionDelegateImpl_1 = __decorate([
955
- ObjCClass(UICollectionViewDelegate, UICollectionViewDelegateFlowLayout)
956
- ], UICollectionDelegateImpl);
957
- return UICollectionDelegateImpl;
958
- }(NSObject));
959
- var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
960
- __extends(UICollectionViewDataSourceImpl, _super);
961
- function UICollectionViewDataSourceImpl() {
962
- return _super !== null && _super.apply(this, arguments) || this;
963
- }
964
- UICollectionViewDataSourceImpl_1 = UICollectionViewDataSourceImpl;
965
- UICollectionViewDataSourceImpl.initWithOwner = function (owner) {
966
- var delegate = UICollectionViewDataSourceImpl_1.alloc().init();
864
+ }
865
+ };
866
+ UICollectionDelegateImpl = UICollectionDelegateImpl_1 = __decorate([
867
+ NativeClass,
868
+ ObjCClass(UICollectionViewDelegate, UICollectionViewDelegateFlowLayout)
869
+ ], UICollectionDelegateImpl);
870
+ let UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = class UICollectionViewDataSourceImpl extends NSObject {
871
+ static initWithOwner(owner) {
872
+ const delegate = UICollectionViewDataSourceImpl_1.alloc().init();
967
873
  delegate._owner = owner;
968
874
  return delegate;
969
- };
970
- UICollectionViewDataSourceImpl.prototype.collectionViewCellForItemAtIndexPath = function (collectionView, indexPath) {
971
- var owner = this._owner ? this._owner.get() : null;
972
- var cell;
973
- var count = 0;
875
+ }
876
+ collectionViewCellForItemAtIndexPath(collectionView, indexPath) {
877
+ const owner = this._owner ? this._owner.get() : null;
878
+ let cell;
879
+ let count = 0;
974
880
  if (owner) {
975
881
  count = owner._childrenCount;
976
882
  if (owner.circularMode) {
@@ -989,70 +895,48 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
989
895
  }
990
896
  }
991
897
  if (owner && !owner.items && count > 0) {
992
- var index = indexPath.row;
993
- var data = owner._childrenViews[index];
994
- var viewType = data.type;
898
+ const index = indexPath.row;
899
+ const data = owner._childrenViews[index];
900
+ const viewType = data.type;
995
901
  owner.mPreparingCell = true;
996
- collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), "static-".concat(viewType));
997
- cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath("static-".concat(viewType), indexPath) || PagerCell.initWithEmptyBackground();
902
+ collectionView.registerClassForCellWithReuseIdentifier(PagerCell.class(), `static-${viewType}`);
903
+ cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(`static-${viewType}`, indexPath) || PagerCell.initWithEmptyBackground();
998
904
  cell.index = index;
999
- var view = data.view;
1000
- // if (view instanceof ProxyViewContainer) {
1001
- // let sp = new StackLayout();
1002
- // sp.addChild(view);
1003
- // view = sp;
1004
- // }
1005
- // If cell is reused it has old content - remove it first.
905
+ const view = data.view;
1006
906
  if (!cell.view) {
1007
907
  cell.owner = new WeakRef(view);
1008
908
  }
1009
909
  else if (cell.view !== view) {
1010
910
  owner._removeView(view);
1011
- // (cell.view.nativeViewProtected as UIView).removeFromSuperview();
1012
911
  cell.owner = new WeakRef(view);
1013
912
  }
1014
913
  if (view && !view.parent) {
1015
- // view['performLayout'] = () => {
1016
- // View.measureChild(
1017
- // owner,
1018
- // view,
1019
- // view._currentWidthMeasureSpec,
1020
- // view._currentHeightMeasureSpec
1021
- // );
1022
- // if (view && view.isLayoutRequired) {
1023
- // View.layoutChild(owner, view, 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
1024
- // }
1025
- // };
1026
914
  owner._addView(view);
1027
- // if (owner.iosOverflowSafeArea) {
1028
- var innerView = UICellView.new();
915
+ const innerView = UICellView.new();
1029
916
  innerView.view = new WeakRef(view);
1030
917
  innerView.addSubview(view.nativeViewProtected);
1031
918
  cell.contentView.addSubview(innerView);
1032
919
  owner.mMap.set(cell, view);
1033
- // } else {
1034
- // cell.contentView.addSubview(view.nativeViewProtected);
1035
- // }
1036
920
  }
1037
921
  view.iosOverflowSafeArea = owner.iosOverflowSafeArea;
1038
922
  view['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
1039
923
  owner._layoutCell(view, indexPath);
1040
- var size = owner._getSize();
1041
- var width = layout.toDevicePixels(size.width);
1042
- var height = layout.toDevicePixels(size.height);
924
+ const size = owner._getSize();
925
+ const width = layout.toDevicePixels(size.width);
926
+ const height = layout.toDevicePixels(size.height);
1043
927
  if (view && view.isLayoutRequired) {
1044
928
  View.layoutChild(owner, view, 0, 0, width, height);
1045
929
  }
1046
930
  owner.mPreparingCell = false;
1047
931
  return cell;
1048
932
  }
1049
- var template = owner && owner._getItemTemplate(indexPath.row);
933
+ const template = owner && owner._getItemTemplate(indexPath.row);
1050
934
  cell = collectionView.dequeueReusableCellWithReuseIdentifierForIndexPath(template.key, indexPath) || PagerCell.initWithEmptyBackground();
1051
935
  cell.index = indexPath;
1052
936
  if (owner) {
1053
- var size = owner._getSize();
937
+ const size = owner._getSize();
1054
938
  owner._prepareCell(cell, indexPath);
1055
- var cellView = cell.view;
939
+ const cellView = cell.view;
1056
940
  cellView.iosOverflowSafeArea = owner.iosOverflowSafeArea;
1057
941
  cellView['iosIgnoreSafeArea'] = owner['iosIgnoreSafeArea'];
1058
942
  if (!owner.iosOverflowSafeAreaEnabled && cellView && cellView.isLayoutRequired) {
@@ -1060,53 +944,46 @@ var UICollectionViewDataSourceImpl = /** @class */ (function (_super) {
1060
944
  }
1061
945
  }
1062
946
  return cell;
1063
- };
1064
- UICollectionViewDataSourceImpl.prototype.collectionViewNumberOfItemsInSection = function (collectionView, section) {
1065
- var owner = this._owner ? this._owner.get() : null;
1066
- // make sure we dont start to load static view if the pager is not loaded.
1067
- // otherwise static items wont "load"
947
+ }
948
+ collectionViewNumberOfItemsInSection(collectionView, section) {
949
+ const owner = this._owner ? this._owner.get() : null;
1068
950
  if (!owner || !owner.isLoaded)
1069
951
  return 0;
1070
952
  return owner.circularMode ? owner.itemCount : owner._childrenCount;
1071
- };
1072
- UICollectionViewDataSourceImpl.prototype.numberOfSectionsInCollectionView = function (collectionView) {
953
+ }
954
+ numberOfSectionsInCollectionView(collectionView) {
1073
955
  return 1;
1074
- };
1075
- var UICollectionViewDataSourceImpl_1;
1076
- UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = __decorate([
1077
- ObjCClass(UICollectionViewDataSource)
1078
- ], UICollectionViewDataSourceImpl);
1079
- return UICollectionViewDataSourceImpl;
1080
- }(NSObject));
1081
- var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1082
- __extends(UICollectionViewFlowLinearLayoutImpl, _super);
1083
- function UICollectionViewFlowLinearLayoutImpl() {
1084
- return _super !== null && _super.apply(this, arguments) || this;
1085
- }
1086
- UICollectionViewFlowLinearLayoutImpl.initWithOwner = function (owner) {
1087
- var layout = UICollectionViewFlowLinearLayoutImpl.new();
956
+ }
957
+ };
958
+ UICollectionViewDataSourceImpl = UICollectionViewDataSourceImpl_1 = __decorate([
959
+ NativeClass,
960
+ ObjCClass(UICollectionViewDataSource)
961
+ ], UICollectionViewDataSourceImpl);
962
+ let UICollectionViewFlowLinearLayoutImpl = UICollectionViewFlowLinearLayoutImpl_1 = class UICollectionViewFlowLinearLayoutImpl extends UICollectionViewFlowLayout {
963
+ static initWithOwner(owner) {
964
+ const layout = UICollectionViewFlowLinearLayoutImpl_1.new();
1088
965
  layout._owner = owner;
1089
966
  layout._curl = CATransition.animation();
1090
967
  return layout;
1091
- };
1092
- UICollectionViewFlowLinearLayoutImpl.prototype.layoutAttributesForElementsInRect = function (rect) {
1093
- var owner = this._owner ? this._owner.get() : null;
1094
- var originalLayoutAttribute = _super.prototype.layoutAttributesForElementsInRect.call(this, rect);
1095
- var visibleLayoutAttributes = [];
968
+ }
969
+ layoutAttributesForElementsInRect(rect) {
970
+ const owner = this._owner ? this._owner.get() : null;
971
+ const originalLayoutAttribute = super.layoutAttributesForElementsInRect(rect);
972
+ const visibleLayoutAttributes = [];
1096
973
  if (owner) {
1097
974
  if (owner.transformers && owner.transformers.indexOf('scale') > -1) {
1098
- var count = originalLayoutAttribute.count;
1099
- for (var i = 0; i < count; i++) {
1100
- var attributes = originalLayoutAttribute.objectAtIndex(i);
975
+ const count = originalLayoutAttribute.count;
976
+ for (let i = 0; i < count; i++) {
977
+ const attributes = originalLayoutAttribute.objectAtIndex(i);
1101
978
  visibleLayoutAttributes[i] = attributes;
1102
- var frame = attributes.frame;
1103
- var width = attributes.frame.size.width * 0.75;
1104
- var height = attributes.frame.size.height * 0.75;
979
+ const frame = attributes.frame;
980
+ const width = attributes.frame.size.width * 0.75;
981
+ const height = attributes.frame.size.height * 0.75;
1105
982
  attributes.frame.size.width = width;
1106
983
  attributes.frame.size.height = height;
1107
- var spacing = owner.convertToSize(owner.spacing);
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);
984
+ const spacing = owner.convertToSize(owner.spacing);
985
+ const distance = Math.abs(this.collectionView.contentOffset.x + this.collectionView.contentInset.left + spacing - frame.origin.x);
986
+ const scale = Math.min(Math.max(1 - distance / this.collectionView.bounds.size.width, 0.75), 1);
1110
987
  attributes.transform = CGAffineTransformScale(attributes.transform, 1, scale);
1111
988
  }
1112
989
  }
@@ -1115,61 +992,51 @@ var UICollectionViewFlowLinearLayoutImpl = /** @class */ (function (_super) {
1115
992
  }
1116
993
  }
1117
994
  return visibleLayoutAttributes;
1118
- };
1119
- UICollectionViewFlowLinearLayoutImpl.prototype.shouldInvalidateLayoutForBoundsChange = function (newBounds) {
995
+ }
996
+ shouldInvalidateLayoutForBoundsChange(newBounds) {
1120
997
  return true;
1121
- };
1122
- UICollectionViewFlowLinearLayoutImpl.prototype.initialLayoutAttributesForAppearingItemAtIndexPath = function (itemIndexPath) {
1123
- var attrs = _super.prototype.initialLayoutAttributesForAppearingItemAtIndexPath.call(this, itemIndexPath);
998
+ }
999
+ initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath) {
1000
+ const attrs = super.initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath);
1124
1001
  attrs.alpha = 1;
1125
1002
  return attrs;
1126
- };
1127
- UICollectionViewFlowLinearLayoutImpl.prototype.finalLayoutAttributesForDisappearingItemAtIndexPath = function (itemIndexPath) {
1128
- var attrs = _super.prototype.finalLayoutAttributesForDisappearingItemAtIndexPath.call(this, itemIndexPath);
1003
+ }
1004
+ finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath) {
1005
+ const attrs = super.finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath);
1129
1006
  attrs.alpha = 1;
1130
1007
  return attrs;
1131
- };
1132
- UICollectionViewFlowLinearLayoutImpl.prototype.targetContentOffsetForProposedContentOffsetWithScrollingVelocity = function (proposedContentOffset, velocity) {
1133
- var owner = this._owner ? this._owner.get() : null;
1008
+ }
1009
+ targetContentOffsetForProposedContentOffsetWithScrollingVelocity(proposedContentOffset, velocity) {
1010
+ const owner = this._owner ? this._owner.get() : null;
1134
1011
  if (!this.collectionView || !owner) {
1135
- return _super.prototype.targetContentOffsetForProposedContentOffsetWithScrollingVelocity.call(this, proposedContentOffset, velocity);
1136
- }
1137
- var size = owner._getRealWidthHeight();
1138
- if (this.scrollDirection === UICollectionViewScrollDirection.Horizontal) {
1139
- // Page width used for estimating and calculating paging.
1140
- var pageWidth = size.width + this.minimumInteritemSpacing;
1141
- // Make an estimation of the current page position.
1142
- var approximatePage = this.collectionView.contentOffset.x / pageWidth;
1143
- // Determine the current page based on velocity.
1144
- var currentPage = velocity.x === 0 ? Math.round(approximatePage) : velocity.x < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1145
- // Create custom flickVelocity.
1146
- var flickVelocity = velocity.x * 0.3;
1147
- // Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
1148
- var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1149
- var newPageIndex = currentPage + flickedPages;
1012
+ return super.targetContentOffsetForProposedContentOffsetWithScrollingVelocity(proposedContentOffset, velocity);
1013
+ }
1014
+ const size = owner._getRealWidthHeight();
1015
+ if (this.scrollDirection === 1) {
1016
+ const pageWidth = size.width + this.minimumInteritemSpacing;
1017
+ const approximatePage = this.collectionView.contentOffset.x / pageWidth;
1018
+ const currentPage = velocity.x === 0 ? Math.round(approximatePage) : velocity.x < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1019
+ const flickVelocity = velocity.x * 0.3;
1020
+ const flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1021
+ const newPageIndex = currentPage + flickedPages;
1150
1022
  selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
1151
- // Calculate newHorizontalOffset.
1152
- var newHorizontalOffset = newPageIndex * pageWidth - this.collectionView.contentInset.left;
1023
+ const newHorizontalOffset = newPageIndex * pageWidth - this.collectionView.contentInset.left;
1153
1024
  return CGPointMake(newHorizontalOffset, proposedContentOffset.y);
1154
1025
  }
1155
1026
  else {
1156
- // Page height used for estimating and calculating paging.
1157
- // let pageHeight = size.height + this.minimumLineSpacing;
1158
- var pageHeight = size.height;
1159
- // Make an estimation of the current page position.
1160
- var approximatePage = Math.max(0, this.collectionView.contentOffset.y / pageHeight);
1161
- // Determine the current page based on velocity.
1162
- var currentPage = velocity.y === 0 ? Math.round(approximatePage) : velocity.y < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1163
- // Create custom flickVelocity.
1164
- var flickVelocity = velocity.y * 0.3;
1165
- // Check how many pages the user flicked, if <= 1 then flickedPages should return 0.
1166
- var flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1167
- var newPageIndex = currentPage + flickedPages;
1027
+ const pageHeight = size.height;
1028
+ const approximatePage = Math.max(0, this.collectionView.contentOffset.y / pageHeight);
1029
+ const currentPage = velocity.y === 0 ? Math.round(approximatePage) : velocity.y < 0.0 ? Math.floor(approximatePage) : Math.ceil(approximatePage);
1030
+ const flickVelocity = velocity.y * 0.3;
1031
+ const flickedPages = Math.abs(Math.round(flickVelocity)) <= 1 ? 0 : Math.round(flickVelocity);
1032
+ const newPageIndex = currentPage + flickedPages;
1168
1033
  selectedIndexProperty.nativeValueChange(owner, Math.min(Math.max(newPageIndex, 0), owner._childrenCount - 1));
1169
- var newVerticalOffset = newPageIndex * pageHeight - this.collectionView.contentInset.top;
1034
+ const newVerticalOffset = newPageIndex * pageHeight - this.collectionView.contentInset.top;
1170
1035
  return CGPointMake(proposedContentOffset.x, newVerticalOffset);
1171
1036
  }
1172
- };
1173
- return UICollectionViewFlowLinearLayoutImpl;
1174
- }(UICollectionViewFlowLayout));
1037
+ }
1038
+ };
1039
+ UICollectionViewFlowLinearLayoutImpl = UICollectionViewFlowLinearLayoutImpl_1 = __decorate([
1040
+ NativeClass
1041
+ ], UICollectionViewFlowLinearLayoutImpl);
1175
1042
  //# sourceMappingURL=index.ios.js.map