@nativescript/core 9.0.0-alpha.25 → 9.0.0-alpha.26

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 (205) hide show
  1. package/application/application-common.d.ts +29 -10
  2. package/application/application-common.js +58 -5
  3. package/application/application-common.js.map +1 -1
  4. package/application/application-interfaces.d.ts +10 -0
  5. package/application/application-shims.d.ts +27 -0
  6. package/application/application-shims.js +27 -0
  7. package/application/application-shims.js.map +1 -1
  8. package/application/application.android.d.ts +3 -0
  9. package/application/application.android.js +348 -349
  10. package/application/application.android.js.map +1 -1
  11. package/application/application.ios.d.ts +3 -0
  12. package/application/application.ios.js +30 -19
  13. package/application/application.ios.js.map +1 -1
  14. package/config/config.interface.d.ts +21 -0
  15. package/connectivity/index.android.js +22 -22
  16. package/connectivity/index.android.js.map +1 -1
  17. package/core-types/index.d.ts +10 -1
  18. package/core-types/index.js +10 -1
  19. package/core-types/index.js.map +1 -1
  20. package/core-types/validators.js +12 -6
  21. package/core-types/validators.js.map +1 -1
  22. package/data/observable/index.d.ts +2 -1
  23. package/data/observable/index.js +31 -19
  24. package/data/observable/index.js.map +1 -1
  25. package/fps-meter/fps-native.ios.js +1 -1
  26. package/fps-meter/fps-native.ios.js.map +1 -1
  27. package/http/http-request/index.ios.js +1 -1
  28. package/http/http-request/index.ios.js.map +1 -1
  29. package/package.json +1 -1
  30. package/platform/screen/index.d.ts +5 -0
  31. package/platforms/android/widgets-release.aar +0 -0
  32. package/timer/index.ios.js +1 -1
  33. package/timer/index.ios.js.map +1 -1
  34. package/ui/action-bar/index.android.js +18 -18
  35. package/ui/action-bar/index.android.js.map +1 -1
  36. package/ui/action-bar/index.ios.js +2 -4
  37. package/ui/action-bar/index.ios.js.map +1 -1
  38. package/ui/animation/index.ios.js +2 -3
  39. package/ui/animation/index.ios.js.map +1 -1
  40. package/ui/button/index.android.js +20 -20
  41. package/ui/button/index.android.js.map +1 -1
  42. package/ui/button/index.ios.d.ts +2 -1
  43. package/ui/button/index.ios.js +28 -10
  44. package/ui/button/index.ios.js.map +1 -1
  45. package/ui/core/control-state-change/index.ios.js +1 -1
  46. package/ui/core/control-state-change/index.ios.js.map +1 -1
  47. package/ui/core/view/index.android.d.ts +2 -0
  48. package/ui/core/view/index.android.js +221 -194
  49. package/ui/core/view/index.android.js.map +1 -1
  50. package/ui/core/view/index.d.ts +17 -4
  51. package/ui/core/view/index.ios.d.ts +3 -2
  52. package/ui/core/view/index.ios.js +25 -11
  53. package/ui/core/view/index.ios.js.map +1 -1
  54. package/ui/core/view/view-common.d.ts +10 -8
  55. package/ui/core/view/view-common.js +7 -0
  56. package/ui/core/view/view-common.js.map +1 -1
  57. package/ui/core/view/view-helper/index.d.ts +5 -0
  58. package/ui/core/view/view-helper/index.ios.d.ts +5 -4
  59. package/ui/core/view/view-helper/index.ios.js +20 -23
  60. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  61. package/ui/core/view/view-helper/view-helper-common.js +7 -0
  62. package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
  63. package/ui/core/view-base/index.d.ts +4 -0
  64. package/ui/core/view-base/index.js +4 -0
  65. package/ui/core/view-base/index.js.map +1 -1
  66. package/ui/date-picker/index.android.js +38 -38
  67. package/ui/date-picker/index.android.js.map +1 -1
  68. package/ui/date-picker/index.ios.js +1 -1
  69. package/ui/date-picker/index.ios.js.map +1 -1
  70. package/ui/editable-text-base/index.android.js +34 -34
  71. package/ui/editable-text-base/index.android.js.map +1 -1
  72. package/ui/frame/fragment.transitions.android.d.ts +2 -1
  73. package/ui/frame/fragment.transitions.android.js +106 -104
  74. package/ui/frame/fragment.transitions.android.js.map +1 -1
  75. package/ui/frame/fragment.transitions.d.ts +3 -2
  76. package/ui/frame/index.android.js +2 -2
  77. package/ui/frame/index.android.js.map +1 -1
  78. package/ui/frame/index.ios.d.ts +2 -1
  79. package/ui/frame/index.ios.js +83 -43
  80. package/ui/frame/index.ios.js.map +1 -1
  81. package/ui/gestures/index.android.js +129 -130
  82. package/ui/gestures/index.android.js.map +1 -1
  83. package/ui/gestures/index.ios.js +3 -5
  84. package/ui/gestures/index.ios.js.map +1 -1
  85. package/ui/gestures/touch-manager.js +32 -32
  86. package/ui/gestures/touch-manager.js.map +1 -1
  87. package/ui/image/index.android.js +19 -19
  88. package/ui/image/index.android.js.map +1 -1
  89. package/ui/image-cache/index.android.js +12 -14
  90. package/ui/image-cache/index.android.js.map +1 -1
  91. package/ui/image-cache/index.ios.js +6 -6
  92. package/ui/image-cache/index.ios.js.map +1 -1
  93. package/ui/index.d.ts +1 -0
  94. package/ui/index.js +1 -0
  95. package/ui/index.js.map +1 -1
  96. package/ui/label/index.android.js +4 -1
  97. package/ui/label/index.android.js.map +1 -1
  98. package/ui/label/index.ios.d.ts +2 -1
  99. package/ui/label/index.ios.js +12 -2
  100. package/ui/label/index.ios.js.map +1 -1
  101. package/ui/layouts/flexbox-layout/index.ios.js +3 -6
  102. package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
  103. package/ui/layouts/stack-layout/index.ios.js +6 -0
  104. package/ui/layouts/stack-layout/index.ios.js.map +1 -1
  105. package/ui/list-picker/index.android.js +35 -35
  106. package/ui/list-picker/index.android.js.map +1 -1
  107. package/ui/list-picker/index.ios.js +2 -2
  108. package/ui/list-picker/index.ios.js.map +1 -1
  109. package/ui/list-view/index.android.js +278 -320
  110. package/ui/list-view/index.android.js.map +1 -1
  111. package/ui/list-view/index.d.ts +5 -0
  112. package/ui/list-view/index.ios.js +12 -27
  113. package/ui/list-view/index.ios.js.map +1 -1
  114. package/ui/page/index.ios.js +25 -64
  115. package/ui/page/index.ios.js.map +1 -1
  116. package/ui/scroll-view/index.d.ts +1 -1
  117. package/ui/scroll-view/index.ios.d.ts +2 -0
  118. package/ui/scroll-view/index.ios.js +31 -12
  119. package/ui/scroll-view/index.ios.js.map +1 -1
  120. package/ui/scroll-view/scroll-view-common.d.ts +3 -8
  121. package/ui/scroll-view/scroll-view-common.js +4 -4
  122. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  123. package/ui/search-bar/index.android.js +48 -52
  124. package/ui/search-bar/index.android.js.map +1 -1
  125. package/ui/search-bar/index.ios.js +3 -6
  126. package/ui/search-bar/index.ios.js.map +1 -1
  127. package/ui/segmented-bar/index.android.js +56 -58
  128. package/ui/segmented-bar/index.android.js.map +1 -1
  129. package/ui/segmented-bar/index.ios.js +1 -1
  130. package/ui/segmented-bar/index.ios.js.map +1 -1
  131. package/ui/slider/index.android.js +23 -25
  132. package/ui/slider/index.android.js.map +1 -1
  133. package/ui/slider/index.ios.js +2 -2
  134. package/ui/slider/index.ios.js.map +1 -1
  135. package/ui/split-view/index.android.d.ts +4 -0
  136. package/ui/split-view/index.android.js +4 -0
  137. package/ui/split-view/index.android.js.map +1 -0
  138. package/ui/split-view/index.d.ts +11 -0
  139. package/ui/split-view/index.ios.d.ts +39 -0
  140. package/ui/split-view/index.ios.js +368 -0
  141. package/ui/split-view/index.ios.js.map +1 -0
  142. package/ui/split-view/split-view-common.d.ts +51 -0
  143. package/ui/split-view/split-view-common.js +111 -0
  144. package/ui/split-view/split-view-common.js.map +1 -0
  145. package/ui/styling/style/index.d.ts +1 -0
  146. package/ui/styling/style/index.js.map +1 -1
  147. package/ui/styling/style-properties.d.ts +1 -0
  148. package/ui/styling/style-properties.js +7 -0
  149. package/ui/styling/style-properties.js.map +1 -1
  150. package/ui/switch/index.android.js +18 -18
  151. package/ui/switch/index.android.js.map +1 -1
  152. package/ui/switch/index.ios.d.ts +1 -0
  153. package/ui/switch/index.ios.js +62 -12
  154. package/ui/switch/index.ios.js.map +1 -1
  155. package/ui/tab-view/index.android.js +163 -179
  156. package/ui/tab-view/index.android.js.map +1 -1
  157. package/ui/tab-view/index.d.ts +17 -1
  158. package/ui/tab-view/index.ios.d.ts +12 -4
  159. package/ui/tab-view/index.ios.js +225 -40
  160. package/ui/tab-view/index.ios.js.map +1 -1
  161. package/ui/tab-view/tab-view-common.d.ts +12 -0
  162. package/ui/tab-view/tab-view-common.js +10 -0
  163. package/ui/tab-view/tab-view-common.js.map +1 -1
  164. package/ui/text-base/index.android.d.ts +2 -1
  165. package/ui/text-base/index.android.js +133 -101
  166. package/ui/text-base/index.android.js.map +1 -1
  167. package/ui/text-base/index.d.ts +5 -0
  168. package/ui/text-base/index.ios.js +12 -18
  169. package/ui/text-base/index.ios.js.map +1 -1
  170. package/ui/text-base/text-base-common.d.ts +2 -1
  171. package/ui/text-base/text-base-common.js +1 -0
  172. package/ui/text-base/text-base-common.js.map +1 -1
  173. package/ui/text-field/index.ios.d.ts +2 -1
  174. package/ui/text-field/index.ios.js +9 -5
  175. package/ui/text-field/index.ios.js.map +1 -1
  176. package/ui/text-view/index.ios.d.ts +2 -1
  177. package/ui/text-view/index.ios.js +12 -7
  178. package/ui/text-view/index.ios.js.map +1 -1
  179. package/ui/time-picker/index.android.js +21 -21
  180. package/ui/time-picker/index.android.js.map +1 -1
  181. package/ui/time-picker/index.ios.js +1 -1
  182. package/ui/time-picker/index.ios.js.map +1 -1
  183. package/ui/transition/fade-transition.ios.js +5 -6
  184. package/ui/transition/fade-transition.ios.js.map +1 -1
  185. package/ui/transition/modal-transition.ios.js +19 -26
  186. package/ui/transition/modal-transition.ios.js.map +1 -1
  187. package/ui/transition/page-transition.android.js +3 -12
  188. package/ui/transition/page-transition.android.js.map +1 -1
  189. package/ui/transition/page-transition.ios.js +19 -25
  190. package/ui/transition/page-transition.ios.js.map +1 -1
  191. package/ui/transition/slide-transition.ios.js +5 -6
  192. package/ui/transition/slide-transition.ios.js.map +1 -1
  193. package/ui/web-view/index.android.js +58 -62
  194. package/ui/web-view/index.android.js.map +1 -1
  195. package/ui/web-view/index.ios.js +18 -18
  196. package/ui/web-view/index.ios.js.map +1 -1
  197. package/utils/layout-helper/index.android.d.ts +1 -0
  198. package/utils/layout-helper/index.android.js +9 -0
  199. package/utils/layout-helper/index.android.js.map +1 -1
  200. package/utils/layout-helper/index.d.ts +5 -0
  201. package/utils/layout-helper/index.ios.d.ts +1 -0
  202. package/utils/layout-helper/index.ios.js +4 -0
  203. package/utils/layout-helper/index.ios.js.map +1 -1
  204. package/utils/native-helper.ios.js +20 -20
  205. package/utils/native-helper.ios.js.map +1 -1
@@ -25,30 +25,30 @@ function initializeItemClickListener() {
25
25
  if (ItemClickListener) {
26
26
  return;
27
27
  }
28
- var ItemClickListenerImpl = /** @class */ (function (_super) {
29
- __extends(ItemClickListenerImpl, _super);
30
- function ItemClickListenerImpl(owner) {
31
- var _this = _super.call(this) || this;
32
- _this.owner = owner;
33
- return global.__native(_this);
34
- }
35
- ItemClickListenerImpl.prototype.onItemClick = function (parent, convertView, index, id) {
36
- var owner = this.owner;
37
- var view = owner._realizedItems.get(convertView).view;
38
- owner.notify({
39
- eventName: ITEMTAP,
40
- object: owner,
41
- index: index,
42
- view: view,
43
- });
44
- };
45
- var _a;
46
- ItemClickListenerImpl = __decorate([
47
- Interfaces([android.widget.AdapterView.OnItemClickListener]),
48
- __metadata("design:paramtypes", [typeof (_a = typeof ListView !== "undefined" && ListView) === "function" ? _a : Object])
49
- ], ItemClickListenerImpl);
50
- return ItemClickListenerImpl;
51
- }(java.lang.Object));
28
+ var ItemClickListenerImpl = (function (_super) {
29
+ __extends(ItemClickListenerImpl, _super);
30
+ function ItemClickListenerImpl(owner) {
31
+ var _this = _super.call(this) || this;
32
+ _this.owner = owner;
33
+ return global.__native(_this);
34
+ }
35
+ ItemClickListenerImpl.prototype.onItemClick = function (parent, convertView, index, id) {
36
+ var owner = this.owner;
37
+ var view = owner._realizedItems.get(convertView).view;
38
+ owner.notify({
39
+ eventName: ITEMTAP,
40
+ object: owner,
41
+ index: index,
42
+ view: view,
43
+ });
44
+ };
45
+ var _a;
46
+ ItemClickListenerImpl = __decorate([
47
+ Interfaces([android.widget.AdapterView.OnItemClickListener]),
48
+ __metadata("design:paramtypes", [typeof (_a = typeof ListView !== "undefined" && ListView) === "function" ? _a : Object])
49
+ ], ItemClickListenerImpl);
50
+ return ItemClickListenerImpl;
51
+ }(java.lang.Object));
52
52
  ItemClickListener = ItemClickListenerImpl;
53
53
  }
54
54
  export class ListView extends ListViewBase {
@@ -710,337 +710,295 @@ function ensureListViewAdapterClass() {
710
710
  if (ListViewAdapterClass) {
711
711
  return;
712
712
  }
713
- var ListViewAdapter = /** @class */ (function (_super) {
714
- __extends(ListViewAdapter, _super);
715
- function ListViewAdapter(owner) {
716
- var _this = _super.call(this) || this;
717
- _this.owner = owner;
718
- return global.__native(_this);
719
- }
720
- ListViewAdapter.prototype.getCount = function () {
721
- if (!this.owner) {
722
- return 0;
713
+ var ListViewAdapter = (function (_super) {
714
+ __extends(ListViewAdapter, _super);
715
+ function ListViewAdapter(owner) {
716
+ var _this = _super.call(this) || this;
717
+ _this.owner = owner;
718
+ return global.__native(_this);
723
719
  }
724
- // Ensure we always have at least the items array length, even if empty
725
- var count = 0;
726
- if (this.owner.sectioned) {
727
- // If items are not ready, report 0 to avoid early crashes
728
- var sectionCount = this.owner._getSectionCount();
729
- if (!this.owner.items || sectionCount <= 0) {
720
+ ListViewAdapter.prototype.getCount = function () {
721
+ if (!this.owner) {
730
722
  return 0;
731
723
  }
732
- // Count items + section headers
733
- for (var i = 0; i < sectionCount; i++) {
734
- var itemsInSection = this.owner._getItemsInSection(i) || [];
735
- // Only add header if section has items
736
- if (itemsInSection.length > 0) {
737
- count += 1; // Section header
738
- count += itemsInSection.length; // Items in section
724
+ var count = 0;
725
+ if (this.owner.sectioned) {
726
+ var sectionCount = this.owner._getSectionCount();
727
+ if (!this.owner.items || sectionCount <= 0) {
728
+ return 0;
729
+ }
730
+ for (var i = 0; i < sectionCount; i++) {
731
+ var itemsInSection = this.owner._getItemsInSection(i) || [];
732
+ if (itemsInSection.length > 0) {
733
+ count += 1;
734
+ count += itemsInSection.length;
735
+ }
739
736
  }
740
- }
741
- }
742
- else {
743
- var src = this.owner.items;
744
- count = src && typeof src.length === 'number' ? src.length : 0;
745
- }
746
- // Return the count, ensuring it's never negative
747
- return Math.max(0, count);
748
- };
749
- ListViewAdapter.prototype.getItem = function (i) {
750
- if (!this.owner || !this.owner.items) {
751
- return null;
752
- }
753
- // Safety check for index bounds
754
- var totalCount = this.getCount();
755
- if (i < 0 || i >= totalCount) {
756
- return null;
757
- }
758
- if (this.owner.sectioned) {
759
- var positionInfo = this._getPositionInfo(i);
760
- if (positionInfo.isHeader) {
761
- return this.owner._getSectionData(positionInfo.section);
762
737
  }
763
738
  else {
764
- return this.owner._getDataItemInSection(positionInfo.section, positionInfo.itemIndex);
765
- }
766
- }
767
- else {
768
- var src = this.owner.items;
769
- if (src && typeof src.length === 'number' && i < src.length) {
770
- var getItem = src.getItem;
771
- return getItem ? getItem.call(src, i) : src[i];
739
+ var src = this.owner.items;
740
+ count = src && typeof src.length === "number" ? src.length : 0;
772
741
  }
773
- }
774
- return null;
775
- };
776
- // Helper method to determine if position is header and get section/item info
777
- ListViewAdapter.prototype._getPositionInfo = function (position) {
778
- if (!this.owner.sectioned) {
779
- return { isHeader: false, section: 0, itemIndex: position };
780
- }
781
- var currentPosition = 0;
782
- var sectionCount = this.owner._getSectionCount();
783
- for (var section = 0; section < sectionCount; section++) {
784
- var itemsInSection = this.owner._getItemsInSection(section) || [];
785
- // Skip sections with no items (they won't have headers in our count)
786
- if (itemsInSection.length === 0) {
787
- continue;
788
- }
789
- // Check if this position is the section header
790
- if (currentPosition === position) {
791
- return { isHeader: true, section: section, itemIndex: -1 };
742
+ return Math.max(0, count);
743
+ };
744
+ ListViewAdapter.prototype.getItem = function (i) {
745
+ if (!this.owner || !this.owner.items) {
746
+ return null;
792
747
  }
793
- currentPosition++; // Move past header
794
- // Check if position is within this section's items
795
- if (position < currentPosition + itemsInSection.length) {
796
- var itemIndex = position - currentPosition;
797
- return { isHeader: false, section: section, itemIndex: itemIndex };
748
+ var totalCount = this.getCount();
749
+ if (i < 0 || i >= totalCount) {
750
+ return null;
798
751
  }
799
- currentPosition += itemsInSection.length; // Move past items
800
- }
801
- // Fallback - should not reach here with proper bounds checking
802
- return { isHeader: false, section: 0, itemIndex: 0 };
803
- };
804
- ListViewAdapter.prototype.getItemId = function (i) {
805
- var item = this.getItem(i);
806
- var id = i;
807
- if (this.owner && item && this.owner.items) {
808
- id = this.owner.itemIdGenerator(item, i, this.owner.items);
809
- }
810
- return long(id);
811
- };
812
- ListViewAdapter.prototype.hasStableIds = function () {
813
- return true;
814
- };
815
- ListViewAdapter.prototype.isEnabled = function (position) {
816
- // Safety check to prevent crashes when adapter is empty
817
- var totalCount = this.getCount();
818
- if (totalCount === 0 || position < 0 || position >= totalCount) {
819
- return false;
820
- }
821
- // For sectioned lists, check if this is a header position
822
- if (this.owner.sectioned) {
823
- var positionInfo = this._getPositionInfo(position);
824
- // Headers are typically not clickable, items are
825
- return !positionInfo.isHeader;
826
- }
827
- return true;
828
- };
829
- ListViewAdapter.prototype.getViewTypeCount = function () {
830
- var count = this.owner._itemTemplatesInternal.length;
831
- // Add 1 for header view type when sectioned
832
- if (this.owner.sectioned && this.owner.stickyHeaderTemplate) {
833
- count += 1;
834
- }
835
- return count;
836
- };
837
- ListViewAdapter.prototype.getItemViewType = function (index) {
838
- if (this.owner.sectioned) {
839
- var positionInfo = this._getPositionInfo(index);
840
- if (positionInfo.isHeader) {
841
- // Header view type is the last index (after all item template types)
842
- return this.owner._itemTemplatesInternal.length;
752
+ if (this.owner.sectioned) {
753
+ var positionInfo = this._getPositionInfo(i);
754
+ if (positionInfo.isHeader) {
755
+ return this.owner._getSectionData(positionInfo.section);
756
+ }
757
+ else {
758
+ return this.owner._getDataItemInSection(positionInfo.section, positionInfo.itemIndex);
759
+ }
843
760
  }
844
761
  else {
845
- // Get template for the actual item
846
- var template = this.owner._getItemTemplate(positionInfo.itemIndex);
847
- return this.owner._itemTemplatesInternal.indexOf(template);
762
+ var src = this.owner.items;
763
+ if (src && typeof src.length === "number" && i < src.length) {
764
+ var getItem = src.getItem;
765
+ return getItem ? getItem.call(src, i) : src[i];
766
+ }
848
767
  }
849
- }
850
- else {
851
- var template = this.owner._getItemTemplate(index);
852
- return this.owner._itemTemplatesInternal.indexOf(template);
853
- }
854
- };
855
- ListViewAdapter.prototype.getView = function (index, convertView, parent) {
856
- //this.owner._dumpRealizedTemplates();
857
- if (!this.owner) {
858
768
  return null;
859
- }
860
- // Safety check for empty adapter
861
- var totalCount = this.getCount();
862
- if (index < 0 || index >= totalCount) {
863
- // Return a minimal empty view to prevent crashes
864
- var emptyView = new android.view.View(this.owner._context);
865
- var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
866
- emptyView.setLayoutParams(layoutParams);
867
- return emptyView;
868
- }
869
- // Trigger loadMoreItems when binding the last visible row (matches prior Android behavior)
870
- if (index === totalCount - 1) {
871
- this.owner.notify({
872
- eventName: LOADMOREITEMS,
873
- object: this.owner,
874
- });
875
- }
876
- if (this.owner.sectioned) {
877
- var positionInfo = this._getPositionInfo(index);
878
- if (positionInfo.isHeader) {
879
- // Create section header view (pass index for hiding logic)
880
- return this._createHeaderView(positionInfo.section, convertView, parent, index);
769
+ };
770
+ ListViewAdapter.prototype._getPositionInfo = function (position) {
771
+ if (!this.owner.sectioned) {
772
+ return { isHeader: false, section: 0, itemIndex: position };
881
773
  }
882
- else {
883
- // Create regular item view with adjusted index
884
- return this._createItemView(positionInfo.section, positionInfo.itemIndex, convertView, parent);
774
+ var currentPosition = 0;
775
+ var sectionCount = this.owner._getSectionCount();
776
+ for (var section = 0; section < sectionCount; section++) {
777
+ var itemsInSection = this.owner._getItemsInSection(section) || [];
778
+ if (itemsInSection.length === 0) {
779
+ continue;
780
+ }
781
+ if (currentPosition === position) {
782
+ return { isHeader: true, section: section, itemIndex: -1 };
783
+ }
784
+ currentPosition++;
785
+ if (position < currentPosition + itemsInSection.length) {
786
+ var itemIndex = position - currentPosition;
787
+ return { isHeader: false, section: section, itemIndex: itemIndex };
788
+ }
789
+ currentPosition += itemsInSection.length;
885
790
  }
886
- }
887
- else {
888
- // Non-sectioned - use original logic
889
- return this._createItemView(0, index, convertView, parent);
890
- }
891
- };
892
- ListViewAdapter.prototype._createHeaderView = function (section, convertView, parent, index) {
893
- // Check if this header should be hidden to avoid duplication with sticky header
894
- if (this.owner._hiddenHeaderPositions.has(index)) {
895
- // Return an empty view with zero height
896
- var emptyView = new android.view.View(this.owner._context);
897
- var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
898
- emptyView.setLayoutParams(layoutParams);
899
- return emptyView;
900
- }
901
- var headerView = null;
902
- var headerViewType = this.owner._itemTemplatesInternal.length; // Same as getItemViewType for headers
903
- // Try to reuse convertView if it's the right type
904
- if (convertView) {
905
- var existingData = this.owner._realizedItems.get(convertView);
906
- if (existingData && existingData.templateKey === "header_".concat(headerViewType)) {
907
- headerView = existingData.view;
791
+ return { isHeader: false, section: 0, itemIndex: 0 };
792
+ };
793
+ ListViewAdapter.prototype.getItemId = function (i) {
794
+ var item = this.getItem(i);
795
+ var id = i;
796
+ if (this.owner && item && this.owner.items) {
797
+ id = this.owner.itemIdGenerator(item, i, this.owner.items);
908
798
  }
909
- }
910
- // Create new header view if we can't reuse
911
- if (!headerView) {
912
- if (this.owner.stickyHeaderTemplate) {
913
- if (typeof this.owner.stickyHeaderTemplate === 'string') {
914
- try {
915
- headerView = Builder.parse(this.owner.stickyHeaderTemplate, this.owner);
916
- }
917
- catch (error) {
918
- // Fallback to simple label
919
- headerView = new Label();
920
- headerView.text = 'Header Error';
921
- }
922
- }
799
+ return long(id);
800
+ };
801
+ ListViewAdapter.prototype.hasStableIds = function () {
802
+ return true;
803
+ };
804
+ ListViewAdapter.prototype.isEnabled = function (position) {
805
+ var totalCount = this.getCount();
806
+ if (totalCount === 0 || position < 0 || position >= totalCount) {
807
+ return false;
923
808
  }
924
- if (!headerView) {
925
- // Default header
926
- headerView = new Label();
927
- headerView.text = "Section ".concat(section);
809
+ if (this.owner.sectioned) {
810
+ var positionInfo = this._getPositionInfo(position);
811
+ return !positionInfo.isHeader;
928
812
  }
929
- // Add to parent and get native view
930
- if (!headerView.parent) {
931
- if (headerView instanceof LayoutBase && !(headerView instanceof ProxyViewContainer)) {
932
- this.owner._addView(headerView);
933
- convertView = headerView.nativeViewProtected;
813
+ return true;
814
+ };
815
+ ListViewAdapter.prototype.getViewTypeCount = function () {
816
+ var count = this.owner._itemTemplatesInternal.length;
817
+ if (this.owner.sectioned && this.owner.stickyHeaderTemplate) {
818
+ count += 1;
819
+ }
820
+ return count;
821
+ };
822
+ ListViewAdapter.prototype.getItemViewType = function (index) {
823
+ if (this.owner.sectioned) {
824
+ var positionInfo = this._getPositionInfo(index);
825
+ if (positionInfo.isHeader) {
826
+ return this.owner._itemTemplatesInternal.length;
934
827
  }
935
828
  else {
936
- var sp = new StackLayout();
937
- sp.addChild(headerView);
938
- this.owner._addView(sp);
939
- convertView = sp.nativeViewProtected;
829
+ var template = this.owner._getItemTemplate(positionInfo.itemIndex);
830
+ return this.owner._itemTemplatesInternal.indexOf(template);
940
831
  }
941
832
  }
942
- // Register the header view for recycling
943
- this.owner._realizedItems.set(convertView, {
944
- view: headerView,
945
- templateKey: "header_".concat(headerViewType),
946
- });
947
- }
948
- // Set binding context to section data (always update, even for recycled views)
949
- var sectionData = this.owner._getSectionData(section);
950
- if (sectionData) {
951
- headerView.bindingContext = sectionData;
952
- }
953
- else {
954
- headerView.bindingContext = { title: "Section ".concat(section), section: section };
955
- }
956
- return convertView;
957
- };
958
- ListViewAdapter.prototype._createItemView = function (section, itemIndex, convertView, parent) {
959
- // Use existing item creation logic but with sectioned data
960
- var template = this.owner._getItemTemplate(itemIndex);
961
- var view;
962
- // convertView is of the wrong type
963
- if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
964
- this.owner._markViewUnused(convertView); // release this view
965
- convertView = this.owner._getAvailableView(template.key); // get a view from the right type or null
966
- }
967
- if (convertView) {
968
- view = this.owner._realizedItems.get(convertView).view;
969
- }
970
- if (!view) {
971
- view = template.createView();
972
- }
973
- var args = {
974
- eventName: ITEMLOADING,
975
- object: this.owner,
976
- index: itemIndex,
977
- view: view,
978
- android: parent,
979
- ios: undefined,
980
- };
981
- this.owner.notify(args);
982
- if (!args.view) {
983
- args.view = this.owner._getDefaultItemContent(itemIndex);
984
- }
985
- if (args.view) {
986
- if (this.owner._effectiveRowHeight > -1) {
987
- args.view.height = this.owner.rowHeight;
988
- }
989
833
  else {
990
- args.view.height = unsetValue;
834
+ var template = this.owner._getItemTemplate(index);
835
+ return this.owner._itemTemplatesInternal.indexOf(template);
836
+ }
837
+ };
838
+ ListViewAdapter.prototype.getView = function (index, convertView, parent) {
839
+ if (!this.owner) {
840
+ return null;
841
+ }
842
+ var totalCount = this.getCount();
843
+ if (index < 0 || index >= totalCount) {
844
+ var emptyView = new android.view.View(this.owner._context);
845
+ var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
846
+ emptyView.setLayoutParams(layoutParams);
847
+ return emptyView;
848
+ }
849
+ if (index === totalCount - 1) {
850
+ this.owner.notify({
851
+ eventName: LOADMOREITEMS,
852
+ object: this.owner,
853
+ });
991
854
  }
992
- // Use sectioned item preparation
993
855
  if (this.owner.sectioned) {
994
- this.owner._prepareItemInSection(args.view, section, itemIndex);
856
+ var positionInfo = this._getPositionInfo(index);
857
+ if (positionInfo.isHeader) {
858
+ return this._createHeaderView(positionInfo.section, convertView, parent, index);
859
+ }
860
+ else {
861
+ return this._createItemView(positionInfo.section, positionInfo.itemIndex, convertView, parent);
862
+ }
995
863
  }
996
864
  else {
997
- this.owner._prepareItem(args.view, itemIndex);
865
+ return this._createItemView(0, index, convertView, parent);
866
+ }
867
+ };
868
+ ListViewAdapter.prototype._createHeaderView = function (section, convertView, parent, index) {
869
+ if (this.owner._hiddenHeaderPositions.has(index)) {
870
+ var emptyView = new android.view.View(this.owner._context);
871
+ var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
872
+ emptyView.setLayoutParams(layoutParams);
873
+ return emptyView;
874
+ }
875
+ var headerView = null;
876
+ var headerViewType = this.owner._itemTemplatesInternal.length;
877
+ if (convertView) {
878
+ var existingData = this.owner._realizedItems.get(convertView);
879
+ if (existingData && existingData.templateKey === "header_".concat(headerViewType)) {
880
+ headerView = existingData.view;
881
+ }
998
882
  }
999
- if (!args.view.parent) {
1000
- // Ensure margins defined on the template root are honored on Android ListView.
1001
- // ListView's children don't support layout margins, so we insert an outer wrapper
1002
- // and keep the original view (with its margins) inside. This mirrors iOS spacing.
1003
- // If the view is already a LayoutBase (typical for templates like GridLayout),
1004
- // we wrap it so its margins take effect. For non-layout roots (labels, etc.)
1005
- // we already wrap below with a StackLayout.
1006
- if (args.view instanceof LayoutBase && !(args.view instanceof ProxyViewContainer)) {
1007
- var mt = PercentLength.toDevicePixels(args.view.marginTop, 0, Number.NaN);
1008
- var mb = PercentLength.toDevicePixels(args.view.marginBottom, 0, Number.NaN);
1009
- var ml = PercentLength.toDevicePixels(args.view.marginLeft, 0, Number.NaN);
1010
- var mr = PercentLength.toDevicePixels(args.view.marginRight, 0, Number.NaN);
1011
- var hasMargins = mt > 0 || mb > 0 || ml > 0 || mr > 0;
1012
- if (hasMargins) {
1013
- var outer = new StackLayout();
1014
- outer.addChild(args.view);
1015
- this.owner._addView(outer);
1016
- convertView = outer.nativeViewProtected;
883
+ if (!headerView) {
884
+ if (this.owner.stickyHeaderTemplate) {
885
+ if (typeof this.owner.stickyHeaderTemplate === "string") {
886
+ try {
887
+ headerView = Builder.parse(this.owner.stickyHeaderTemplate, this.owner);
888
+ }
889
+ catch (error) {
890
+ headerView = new Label();
891
+ headerView.text = "Header Error";
892
+ }
893
+ }
894
+ }
895
+ if (!headerView) {
896
+ headerView = new Label();
897
+ headerView.text = "Section ".concat(section);
898
+ }
899
+ if (!headerView.parent) {
900
+ if (headerView instanceof LayoutBase && !(headerView instanceof ProxyViewContainer)) {
901
+ this.owner._addView(headerView);
902
+ convertView = headerView.nativeViewProtected;
1017
903
  }
1018
904
  else {
1019
- this.owner._addView(args.view);
1020
- convertView = args.view.nativeViewProtected;
905
+ var sp = new StackLayout();
906
+ sp.addChild(headerView);
907
+ this.owner._addView(sp);
908
+ convertView = sp.nativeViewProtected;
1021
909
  }
1022
910
  }
911
+ this.owner._realizedItems.set(convertView, {
912
+ view: headerView,
913
+ templateKey: "header_".concat(headerViewType),
914
+ });
915
+ }
916
+ var sectionData = this.owner._getSectionData(section);
917
+ if (sectionData) {
918
+ headerView.bindingContext = sectionData;
919
+ }
920
+ else {
921
+ headerView.bindingContext = { title: "Section ".concat(section), section: section };
922
+ }
923
+ return convertView;
924
+ };
925
+ ListViewAdapter.prototype._createItemView = function (section, itemIndex, convertView, parent) {
926
+ var template = this.owner._getItemTemplate(itemIndex);
927
+ var view;
928
+ if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
929
+ this.owner._markViewUnused(convertView);
930
+ convertView = this.owner._getAvailableView(template.key);
931
+ }
932
+ if (convertView) {
933
+ view = this.owner._realizedItems.get(convertView).view;
934
+ }
935
+ if (!view) {
936
+ view = template.createView();
937
+ }
938
+ var args = {
939
+ eventName: ITEMLOADING,
940
+ object: this.owner,
941
+ index: itemIndex,
942
+ view: view,
943
+ android: parent,
944
+ ios: undefined,
945
+ };
946
+ this.owner.notify(args);
947
+ if (!args.view) {
948
+ args.view = this.owner._getDefaultItemContent(itemIndex);
949
+ }
950
+ if (args.view) {
951
+ if (this.owner._effectiveRowHeight > -1) {
952
+ args.view.height = this.owner.rowHeight;
953
+ }
954
+ else {
955
+ args.view.height = unsetValue;
956
+ }
957
+ if (this.owner.sectioned) {
958
+ this.owner._prepareItemInSection(args.view, section, itemIndex);
959
+ }
1023
960
  else {
1024
- var sp = new StackLayout();
1025
- sp.addChild(args.view);
1026
- this.owner._addView(sp);
1027
- convertView = sp.nativeViewProtected;
961
+ this.owner._prepareItem(args.view, itemIndex);
962
+ }
963
+ if (!args.view.parent) {
964
+ if (args.view instanceof LayoutBase && !(args.view instanceof ProxyViewContainer)) {
965
+ var mt = PercentLength.toDevicePixels(args.view.marginTop, 0, Number.NaN);
966
+ var mb = PercentLength.toDevicePixels(args.view.marginBottom, 0, Number.NaN);
967
+ var ml = PercentLength.toDevicePixels(args.view.marginLeft, 0, Number.NaN);
968
+ var mr = PercentLength.toDevicePixels(args.view.marginRight, 0, Number.NaN);
969
+ var hasMargins = mt > 0 || mb > 0 || ml > 0 || mr > 0;
970
+ if (hasMargins) {
971
+ var outer = new StackLayout();
972
+ outer.addChild(args.view);
973
+ this.owner._addView(outer);
974
+ convertView = outer.nativeViewProtected;
975
+ }
976
+ else {
977
+ this.owner._addView(args.view);
978
+ convertView = args.view.nativeViewProtected;
979
+ }
980
+ }
981
+ else {
982
+ var sp = new StackLayout();
983
+ sp.addChild(args.view);
984
+ this.owner._addView(sp);
985
+ convertView = sp.nativeViewProtected;
986
+ }
1028
987
  }
988
+ this.owner._registerViewToTemplate(template.key, convertView, args.view);
989
+ this.owner._markViewUsed(convertView);
1029
990
  }
1030
- this.owner._registerViewToTemplate(template.key, convertView, args.view);
1031
- this.owner._markViewUsed(convertView);
1032
- }
1033
- return convertView;
1034
- };
1035
- var _a, _b, _c, _d, _e, _f;
1036
- __decorate([
1037
- profile,
1038
- __metadata("design:type", Function),
1039
- __metadata("design:paramtypes", [Number, typeof (_b = typeof android !== "undefined" && (_a = android.view) !== void 0 && _a.View) === "function" ? _b : Object, typeof (_d = typeof android !== "undefined" && (_c = android.view) !== void 0 && _c.ViewGroup) === "function" ? _d : Object]),
1040
- __metadata("design:returntype", typeof (_f = typeof android !== "undefined" && (_e = android.view) !== void 0 && _e.View) === "function" ? _f : Object)
1041
- ], ListViewAdapter.prototype, "getView", null);
1042
- return ListViewAdapter;
1043
- }(android.widget.BaseAdapter));
991
+ return convertView;
992
+ };
993
+ var _a, _b, _c, _d, _e, _f;
994
+ __decorate([
995
+ profile,
996
+ __metadata("design:type", Function),
997
+ __metadata("design:paramtypes", [Number, typeof (_b = typeof android !== "undefined" && (_a = android.view) !== void 0 && _a.View) === "function" ? _b : Object, typeof (_d = typeof android !== "undefined" && (_c = android.view) !== void 0 && _c.ViewGroup) === "function" ? _d : Object]),
998
+ __metadata("design:returntype", typeof (_f = typeof android !== "undefined" && (_e = android.view) !== void 0 && _e.View) === "function" ? _f : Object)
999
+ ], ListViewAdapter.prototype, "getView", null);
1000
+ return ListViewAdapter;
1001
+ }(android.widget.BaseAdapter));
1044
1002
  ListViewAdapterClass = ListViewAdapter;
1045
1003
  }
1046
1004
  //# sourceMappingURL=index.android.js.map