@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.
- package/application/application-common.d.ts +29 -10
- package/application/application-common.js +58 -5
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +10 -0
- package/application/application-shims.d.ts +27 -0
- package/application/application-shims.js +27 -0
- package/application/application-shims.js.map +1 -1
- package/application/application.android.d.ts +3 -0
- package/application/application.android.js +348 -349
- package/application/application.android.js.map +1 -1
- package/application/application.ios.d.ts +3 -0
- package/application/application.ios.js +30 -19
- package/application/application.ios.js.map +1 -1
- package/config/config.interface.d.ts +21 -0
- package/connectivity/index.android.js +22 -22
- package/connectivity/index.android.js.map +1 -1
- package/core-types/index.d.ts +10 -1
- package/core-types/index.js +10 -1
- package/core-types/index.js.map +1 -1
- package/core-types/validators.js +12 -6
- package/core-types/validators.js.map +1 -1
- package/data/observable/index.d.ts +2 -1
- package/data/observable/index.js +31 -19
- package/data/observable/index.js.map +1 -1
- package/fps-meter/fps-native.ios.js +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/http/http-request/index.ios.js +1 -1
- package/http/http-request/index.ios.js.map +1 -1
- package/package.json +1 -1
- package/platform/screen/index.d.ts +5 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/timer/index.ios.js +1 -1
- package/timer/index.ios.js.map +1 -1
- package/ui/action-bar/index.android.js +18 -18
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.ios.js +2 -4
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/animation/index.ios.js +2 -3
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/button/index.android.js +20 -20
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.d.ts +2 -1
- package/ui/button/index.ios.js +28 -10
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js +1 -1
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/view/index.android.d.ts +2 -0
- package/ui/core/view/index.android.js +221 -194
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +17 -4
- package/ui/core/view/index.ios.d.ts +3 -2
- package/ui/core/view/index.ios.js +25 -11
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +10 -8
- package/ui/core/view/view-common.js +7 -0
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +5 -0
- package/ui/core/view/view-helper/index.ios.d.ts +5 -4
- package/ui/core/view/view-helper/index.ios.js +20 -23
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +7 -0
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view-base/index.d.ts +4 -0
- package/ui/core/view-base/index.js +4 -0
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/date-picker/index.android.js +38 -38
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js +1 -1
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/editable-text-base/index.android.js +34 -34
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +2 -1
- package/ui/frame/fragment.transitions.android.js +106 -104
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.d.ts +3 -2
- package/ui/frame/index.android.js +2 -2
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.ios.d.ts +2 -1
- package/ui/frame/index.ios.js +83 -43
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/index.android.js +129 -130
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +3 -5
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.js +32 -32
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/image/index.android.js +19 -19
- package/ui/image/index.android.js.map +1 -1
- package/ui/image-cache/index.android.js +12 -14
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js +6 -6
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +1 -0
- package/ui/index.js +1 -0
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js +4 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.d.ts +2 -1
- package/ui/label/index.ios.js +12 -2
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.ios.js +3 -6
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/index.ios.js +6 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/list-picker/index.android.js +35 -35
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js +2 -2
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-view/index.android.js +278 -320
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +5 -0
- package/ui/list-view/index.ios.js +12 -27
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/page/index.ios.js +25 -64
- package/ui/page/index.ios.js.map +1 -1
- package/ui/scroll-view/index.d.ts +1 -1
- package/ui/scroll-view/index.ios.d.ts +2 -0
- package/ui/scroll-view/index.ios.js +31 -12
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +3 -8
- package/ui/scroll-view/scroll-view-common.js +4 -4
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js +48 -52
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js +3 -6
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/index.android.js +56 -58
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js +1 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/slider/index.android.js +23 -25
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js +2 -2
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/split-view/index.android.d.ts +4 -0
- package/ui/split-view/index.android.js +4 -0
- package/ui/split-view/index.android.js.map +1 -0
- package/ui/split-view/index.d.ts +11 -0
- package/ui/split-view/index.ios.d.ts +39 -0
- package/ui/split-view/index.ios.js +368 -0
- package/ui/split-view/index.ios.js.map +1 -0
- package/ui/split-view/split-view-common.d.ts +51 -0
- package/ui/split-view/split-view-common.js +111 -0
- package/ui/split-view/split-view-common.js.map +1 -0
- package/ui/styling/style/index.d.ts +1 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +1 -0
- package/ui/styling/style-properties.js +7 -0
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/switch/index.android.js +18 -18
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.d.ts +1 -0
- package/ui/switch/index.ios.js +62 -12
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/tab-view/index.android.js +163 -179
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +17 -1
- package/ui/tab-view/index.ios.d.ts +12 -4
- package/ui/tab-view/index.ios.js +225 -40
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +12 -0
- package/ui/tab-view/tab-view-common.js +10 -0
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.d.ts +2 -1
- package/ui/text-base/index.android.js +133 -101
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.d.ts +5 -0
- package/ui/text-base/index.ios.js +12 -18
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/text-base-common.d.ts +2 -1
- package/ui/text-base/text-base-common.js +1 -0
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.ios.d.ts +2 -1
- package/ui/text-field/index.ios.js +9 -5
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-view/index.ios.d.ts +2 -1
- package/ui/text-view/index.ios.js +12 -7
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/time-picker/index.android.js +21 -21
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js +1 -1
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/transition/fade-transition.ios.js +5 -6
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +19 -26
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.js +3 -12
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.js +19 -25
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/slide-transition.ios.js +5 -6
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/web-view/index.android.js +58 -62
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js +18 -18
- package/ui/web-view/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.d.ts +1 -0
- package/utils/layout-helper/index.android.js +9 -0
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.d.ts +5 -0
- package/utils/layout-helper/index.ios.d.ts +1 -0
- package/utils/layout-helper/index.ios.js +4 -0
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/native-helper.ios.js +20 -20
- 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 =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 =
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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
|
-
|
|
725
|
-
|
|
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
|
-
|
|
733
|
-
|
|
734
|
-
var
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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
|
-
|
|
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
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
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
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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
|
-
|
|
846
|
-
|
|
847
|
-
|
|
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
|
-
|
|
861
|
-
|
|
862
|
-
|
|
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
|
-
|
|
883
|
-
|
|
884
|
-
|
|
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
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
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
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
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 (
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
headerView.text = "Section ".concat(section);
|
|
809
|
+
if (this.owner.sectioned) {
|
|
810
|
+
var positionInfo = this._getPositionInfo(position);
|
|
811
|
+
return !positionInfo.isHeader;
|
|
928
812
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
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
|
|
937
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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 (!
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
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
|
-
|
|
1020
|
-
|
|
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
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
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
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
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
|