@akylas/nativescript 8.9.17 → 9.0.20
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/README.md +41 -5
- package/accessibility/accessibility-common.d.ts +3 -0
- package/accessibility/accessibility-common.js +19 -0
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-css-helper.js +2 -45
- package/accessibility/accessibility-css-helper.js.map +1 -1
- package/accessibility/accessibility-service.android.js +5 -2
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/index.android.d.ts +3 -1
- package/accessibility/index.android.js +282 -138
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.d.ts +4 -0
- package/accessibility/index.ios.d.ts +1 -0
- package/accessibility/index.ios.js +6 -1
- package/accessibility/index.ios.js.map +1 -1
- package/application/application-common.d.ts +45 -18
- package/application/application-common.js +92 -19
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +32 -1
- 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 +10 -6
- package/application/application.android.js +336 -275
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +82 -3
- package/application/application.ios.d.ts +72 -16
- package/application/application.ios.js +677 -46
- package/application/application.ios.js.map +1 -1
- package/application/helpers-common.d.ts +50 -0
- package/application/helpers-common.js +153 -0
- package/application/helpers-common.js.map +1 -0
- package/application/helpers.android.d.ts +6 -0
- package/application/helpers.android.js +26 -0
- package/application/helpers.android.js.map +1 -0
- package/application/helpers.d.ts +11 -0
- package/application/helpers.ios.d.ts +8 -0
- package/application/helpers.ios.js +24 -0
- package/application/helpers.ios.js.map +1 -0
- package/application-settings/index.android.js +2 -2
- package/application-settings/index.android.js.map +1 -1
- package/cli-hooks/{before-checkForChanges.js → before-checkForChanges.mjs} +20 -14
- package/cli-hooks/postinstall.mjs +7 -0
- package/cli-hooks/preuninstall.mjs +7 -0
- package/color/color-common.d.ts +18 -19
- package/color/color-common.js +13 -14
- package/color/color-common.js.map +1 -1
- package/color/color-types.d.ts +49 -0
- package/color/color-types.js +3 -0
- package/color/color-types.js.map +1 -0
- package/color/index.ios.d.ts +2 -1
- package/color/index.ios.js.map +1 -1
- package/config/config.interface.d.ts +43 -0
- package/connectivity/index.android.js +25 -24
- package/connectivity/index.android.js.map +1 -1
- package/core-types/animation-types.d.ts +11 -0
- package/core-types/animation-types.js +13 -0
- package/core-types/animation-types.js.map +1 -0
- package/core-types/index.d.ts +12 -3
- package/core-types/index.js +13 -4
- package/core-types/index.js.map +1 -1
- package/core-types/validators.d.ts +2 -0
- package/core-types/validators.js +20 -0
- package/core-types/validators.js.map +1 -0
- package/css/css-tree-parser.js +2 -2
- package/css/css-tree-parser.js.map +1 -1
- package/css/lib/parse/index.d.ts +1 -0
- package/css/lib/parse/index.js +475 -577
- package/css/lib/parse/index.js.map +1 -0
- package/css/reworkcss.d.ts +25 -28
- package/css/reworkcss.js +5 -1
- package/css/reworkcss.js.map +1 -0
- package/css-mediaquery/index.js +1 -1
- package/css-mediaquery/index.js.map +1 -1
- package/css-value/reworkcss-value.d.ts +31 -8
- package/css-value/reworkcss-value.js +89 -111
- package/css-value/reworkcss-value.js.map +1 -0
- package/data/observable/index.d.ts +2 -1
- package/data/observable/index.js +31 -19
- package/data/observable/index.js.map +1 -1
- package/debugger/devtools-elements-interfaces.d.ts +1 -1
- package/debugger/devtools-elements.common.js +17 -8
- package/debugger/devtools-elements.common.js.map +1 -1
- package/debugger/devtools-elements.js +1 -1
- package/debugger/devtools-elements.js.map +1 -1
- package/debugger/dom-types.d.ts +24 -0
- package/debugger/{dom-node.js → dom-types.js} +11 -9
- package/debugger/dom-types.js.map +1 -0
- package/debugger/webinspector-css.d.ts +18 -18
- package/debugger/webinspector-css.js +1 -1
- package/debugger/webinspector-css.js.map +1 -1
- package/debugger/webinspector-dom.d.ts +15 -15
- package/debugger/webinspector-dom.js +1 -1
- package/debugger/webinspector-dom.js.map +1 -1
- package/debugger/webinspector-network.android.d.ts +9 -9
- package/debugger/webinspector-network.android.js +2 -2
- package/debugger/webinspector-network.android.js.map +1 -1
- package/debugger/webinspector-network.ios.d.ts +9 -9
- package/debugger/webinspector-network.ios.js +1 -1
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/fetch/{index.js → index.mjs} +20 -24
- package/file-system/file-system-access.android.js +27 -33
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.js +2 -15
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.js +5 -10
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.d.ts +1 -2
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.d.ts +1 -2
- package/fps-meter/fps-native.ios.js +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/global-types.d.ts +7 -8
- package/globals/global-utils.d.ts +27 -0
- package/globals/global-utils.js +67 -0
- package/globals/global-utils.js.map +1 -0
- package/globals/index.d.ts +3 -7
- package/globals/index.js +254 -292
- package/globals/index.js.map +1 -1
- package/globals/polyfills/polyfill-xhr.d.ts +1 -0
- package/globals/polyfills/polyfill-xhr.js +5 -0
- package/globals/polyfills/polyfill-xhr.js.map +1 -0
- package/globals/polyfills/utils.d.ts +1 -0
- package/globals/polyfills/utils.js +8 -0
- package/globals/polyfills/utils.js.map +1 -0
- package/http/http-interfaces.d.ts +83 -0
- package/http/http-interfaces.js +6 -0
- package/http/http-interfaces.js.map +1 -0
- package/http/http-request/http-request-common.d.ts +1 -0
- package/http/http-request/http-request-common.js +10 -2
- package/http/http-request/http-request-common.js.map +1 -1
- package/http/http-request/index.android.d.ts +2 -7
- package/http/http-request/index.android.js +57 -279
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.d.ts +6 -2
- package/http/http-request/index.ios.d.ts +2 -7
- package/http/http-request/index.ios.js +37 -235
- package/http/http-request/index.ios.js.map +1 -1
- package/http/http-request-internal/http-request-internal-common.d.ts +2 -0
- package/http/http-request-internal/http-request-internal-common.js +12 -0
- package/http/http-request-internal/http-request-internal-common.js.map +1 -0
- package/http/http-request-internal/index.android.d.ts +4 -0
- package/http/http-request-internal/index.android.js +204 -0
- package/http/http-request-internal/index.android.js.map +1 -0
- package/http/http-request-internal/index.d.ts +28 -0
- package/http/http-request-internal/index.ios.d.ts +4 -0
- package/http/http-request-internal/index.ios.js +181 -0
- package/http/http-request-internal/index.ios.js.map +1 -0
- package/http/index.d.ts +6 -105
- package/http/index.js +8 -12
- package/http/index.js.map +1 -1
- package/image-asset/image-asset-common.js +28 -1
- package/image-asset/image-asset-common.js.map +1 -1
- package/image-asset/index.android.js +4 -3
- package/image-asset/index.android.js.map +1 -1
- package/image-source/index.android.d.ts +1 -1
- package/image-source/index.android.js +9 -26
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.d.ts +2 -2
- package/image-source/index.ios.js +2 -9
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +13 -8
- package/index.js +5 -3
- package/index.js.map +1 -1
- package/inspector_modules.d.ts +6 -0
- package/inspector_modules.js +231 -3
- package/inspector_modules.js.map +1 -1
- package/js-libs/easysax/easysax.js +5 -3
- package/media-query-list/index.js +7 -17
- package/media-query-list/index.js.map +1 -1
- package/module-name-resolver/helpers.d.ts +14 -0
- package/module-name-resolver/helpers.js +27 -0
- package/module-name-resolver/helpers.js.map +1 -0
- package/module-name-resolver/index.d.ts +12 -22
- package/module-name-resolver/index.js +6 -18
- package/module-name-resolver/index.js.map +1 -1
- package/module-name-resolver/non-bundle-workflow-compat.js +32 -23
- package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
- package/module-name-resolver/qualifier-matcher/index.d.ts +6 -12
- package/module-name-resolver/qualifier-matcher/index.js +5 -5
- package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
- package/package.json +88 -83
- package/platform/device/index.android.js +2 -2
- package/platform/device/index.android.js.map +1 -1
- package/platform/screen/index.android.js +2 -2
- package/platform/screen/index.android.js.map +1 -1
- package/platform/screen/index.d.ts +5 -0
- package/platform/screen/index.ios.js +2 -2
- package/platform/screen/index.ios.js.map +1 -1
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +112 -113
- package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +0 -4
- package/platforms/android/java/org/nativescript/widgets/Utils.java +87 -23
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +13 -1
- package/platforms/android/native-api-usage.json +2 -0
- package/profiling/index.js +2 -1
- package/profiling/index.js.map +1 -1
- package/timer/index.android.js +15 -7
- package/timer/index.android.js.map +1 -1
- package/timer/index.ios.js +1 -1
- package/timer/index.ios.js.map +1 -1
- package/ui/action-bar/action-bar-common.js +4 -3
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +22 -22
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.ios.js +2 -5
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/index.ios.js +1 -1
- package/ui/activity-indicator/index.ios.js.map +1 -1
- package/ui/animation/animation-common.d.ts +5 -5
- package/ui/animation/animation-common.js +2 -3
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.d.ts +1 -79
- package/ui/animation/animation-interfaces.js +1 -12
- package/ui/animation/animation-interfaces.js.map +1 -1
- package/ui/animation/animation-shared.d.ts +140 -0
- package/ui/animation/animation-shared.js +4 -0
- package/ui/animation/animation-shared.js.map +1 -0
- package/ui/animation/animation-types.d.ts +1 -0
- package/ui/animation/animation-types.js +3 -0
- package/ui/animation/animation-types.js.map +1 -0
- package/ui/animation/index.android.d.ts +1 -2
- package/ui/animation/index.android.js +5 -5
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.d.ts +7 -132
- package/ui/animation/index.ios.d.ts +2 -2
- package/ui/animation/index.ios.js +9 -9
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +66 -118
- package/ui/animation/keyframe-animation.js +2 -2
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/binding-builder.d.ts +12 -15
- package/ui/builder/component-builder/index.js +5 -5
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/index.d.ts +179 -59
- package/ui/builder/index.js +447 -10
- package/ui/builder/index.js.map +1 -1
- package/ui/button/index.android.d.ts +3 -9
- package/ui/button/index.android.js +34 -43
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.d.ts +1 -1
- package/ui/button/index.ios.d.ts +3 -9
- package/ui/button/index.ios.js +43 -79
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/bindable/bindable-types.d.ts +37 -0
- package/ui/core/bindable/bindable-types.js +3 -0
- package/ui/core/bindable/bindable-types.js.map +1 -0
- package/ui/core/bindable/index.d.ts +2 -38
- package/ui/core/bindable/index.js +1 -2
- package/ui/core/bindable/index.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/properties/index.d.ts +2 -37
- package/ui/core/properties/index.js +27 -42
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/properties/property-shared.d.ts +39 -0
- package/ui/core/properties/property-shared.js +14 -0
- package/ui/core/properties/property-shared.js.map +1 -0
- package/ui/core/view/index.android.d.ts +18 -4
- package/ui/core/view/index.android.js +353 -246
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +48 -64
- package/ui/core/view/index.ios.d.ts +25 -5
- package/ui/core/view/index.ios.js +172 -25
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +91 -28
- package/ui/core/view/view-common.js +83 -27
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +6 -0
- package/ui/core/view/view-helper/index.ios.d.ts +10 -5
- package/ui/core/view/view-helper/index.ios.js +88 -23
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +8 -3
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-shared.d.ts +5 -0
- package/ui/core/view/view-helper/view-helper-shared.js +6 -0
- package/ui/core/view/view-helper/view-helper-shared.js.map +1 -0
- package/ui/core/view/view-interfaces.d.ts +54 -0
- package/ui/core/view/view-interfaces.js +2 -0
- package/ui/core/view/view-interfaces.js.map +1 -0
- package/ui/core/view-base/index.js +74 -58
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/view-base/utils.d.ts +1 -0
- package/ui/core/view-base/utils.js +9 -0
- package/ui/core/view-base/utils.js.map +1 -0
- package/ui/date-picker/index.android.js +36 -36
- 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/dialogs/dialogs-common.js +3 -3
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +8 -7
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/dialogs/index.ios.js +56 -51
- package/ui/dialogs/index.ios.js.map +1 -1
- package/ui/editable-text-base/index.android.d.ts +1 -0
- package/ui/editable-text-base/index.android.js +36 -32
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/embedding/index.android.d.ts +1 -1
- package/ui/embedding/index.d.ts +1 -1
- package/ui/frame/activity.android.js.map +1 -1
- package/ui/frame/fragment.android.js +3 -2
- package/ui/frame/fragment.android.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +15 -13
- package/ui/frame/fragment.transitions.android.js +101 -98
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.d.ts +3 -2
- package/ui/frame/frame-common.d.ts +5 -4
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/{callbacks/fragment-callbacks.d.ts → frame-helper-for-android.d.ts} +20 -1
- package/ui/frame/{callbacks/fragment-callbacks.js → frame-helper-for-android.js} +87 -48
- package/ui/frame/frame-helper-for-android.js.map +1 -0
- package/ui/frame/frame-interfaces.d.ts +40 -4
- package/ui/frame/frame-interfaces.js.map +1 -1
- package/ui/frame/frame-stack.js.map +1 -1
- package/ui/frame/index.android.d.ts +27 -15
- package/ui/frame/index.android.js +347 -83
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +18 -69
- package/ui/frame/index.ios.d.ts +7 -4
- package/ui/frame/index.ios.js +114 -48
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.d.ts +4 -273
- package/ui/gestures/gestures-common.js +3 -146
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/gestures-types.d.ts +301 -0
- package/ui/gestures/gestures-types.js +146 -0
- package/ui/gestures/gestures-types.js.map +1 -0
- package/ui/gestures/index.android.d.ts +29 -1
- package/ui/gestures/index.android.js +133 -132
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.d.ts +35 -0
- package/ui/gestures/index.ios.d.ts +35 -1
- package/ui/gestures/index.ios.js +6 -8
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +1 -1
- package/ui/gestures/touch-manager.js +32 -32
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/index.ios.js +2 -1
- package/ui/html-view/index.ios.js.map +1 -1
- package/ui/image/image-common.js +2 -1
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.android.js +18 -18
- 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 +11 -17
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +20 -8
- package/ui/index.js +22 -4
- 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 +3 -5
- package/ui/label/index.ios.js +23 -45
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/absolute-layout/index.android.js +1 -1
- package/ui/layouts/absolute-layout/index.android.js.map +1 -1
- package/ui/layouts/absolute-layout/index.d.ts +1 -1
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +2 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.android.js +1 -1
- package/ui/layouts/flexbox-layout/index.android.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/grid-layout/index.android.d.ts +1 -0
- package/ui/layouts/grid-layout/index.android.js +5 -5
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/layouts/index.d.ts +5 -1
- package/ui/layouts/index.js +2 -0
- package/ui/layouts/index.js.map +1 -1
- package/ui/layouts/layout-base.android.d.ts +3 -10
- package/ui/layouts/layout-base.android.js +8 -24
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/index.android.d.ts +5 -0
- package/ui/layouts/liquid-glass/index.android.js +8 -0
- package/ui/layouts/liquid-glass/index.android.js.map +1 -0
- package/ui/layouts/liquid-glass/index.d.ts +10 -0
- package/ui/layouts/liquid-glass/index.ios.d.ts +12 -0
- package/ui/layouts/liquid-glass/index.ios.js +106 -0
- package/ui/layouts/liquid-glass/index.ios.js.map +1 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.d.ts +3 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.js +4 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -0
- package/ui/layouts/liquid-glass-container/index.android.d.ts +3 -0
- package/ui/layouts/liquid-glass-container/index.android.js +4 -0
- package/ui/layouts/liquid-glass-container/index.android.js.map +1 -0
- package/ui/layouts/liquid-glass-container/index.d.ts +3 -0
- package/ui/layouts/liquid-glass-container/index.ios.d.ts +15 -0
- package/ui/layouts/liquid-glass-container/index.ios.js +167 -0
- package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.d.ts +4 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js +5 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -0
- package/ui/layouts/stack-layout/index.ios.js +6 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/index.android.js +1 -1
- package/ui/layouts/wrap-layout/index.android.js.map +1 -1
- package/ui/layouts/wrap-layout/index.d.ts +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.js +31 -31
- 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.d.ts +26 -1
- package/ui/list-view/index.android.js +767 -124
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +128 -1
- package/ui/list-view/index.ios.d.ts +34 -2
- package/ui/list-view/index.ios.js +558 -22
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.d.ts +22 -1
- package/ui/list-view/list-view-common.js +87 -1
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/events.d.ts +6 -0
- package/ui/page/events.js +7 -0
- package/ui/page/events.js.map +1 -0
- package/ui/page/index.android.d.ts +1 -10
- package/ui/page/index.android.js +4 -46
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.d.ts +1 -9
- package/ui/page/index.ios.d.ts +1 -3
- package/ui/page/index.ios.js +84 -142
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +3 -8
- package/ui/page/page-common.js +6 -18
- package/ui/page/page-common.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 +33 -13
- 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 +44 -48
- 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 +52 -54
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.d.ts +1 -0
- package/ui/segmented-bar/index.ios.js +10 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.js +2 -2
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.android.d.ts +1 -0
- package/ui/slider/index.android.js +92 -25
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.d.ts +1 -1
- package/ui/slider/index.ios.d.ts +1 -0
- package/ui/slider/index.ios.js +85 -3
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/split-view/index.android.d.ts +3 -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 +16 -0
- package/ui/split-view/index.ios.d.ts +51 -0
- package/ui/split-view/index.ios.js +567 -0
- package/ui/split-view/index.ios.js.map +1 -0
- package/ui/split-view/split-view-common.d.ts +59 -0
- package/ui/split-view/split-view-common.js +127 -0
- package/ui/split-view/split-view-common.js.map +1 -0
- package/ui/styling/background-common.d.ts +4 -4
- package/ui/styling/background-common.js +7 -8
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.android.d.ts +0 -6
- package/ui/styling/background.android.js +1 -53
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.d.ts +0 -3
- package/ui/styling/background.ios.d.ts +2 -1
- package/ui/styling/background.ios.js +53 -39
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/converters.d.ts +2 -2
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/css-transform.d.ts +1 -1
- package/ui/styling/css-utils.d.ts +1 -0
- package/ui/styling/css-utils.js +16 -5
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/font.android.js +2 -2
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.ios.js +10 -10
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/length-shared.d.ts +52 -0
- package/ui/styling/length-shared.js +172 -0
- package/ui/styling/length-shared.js.map +1 -0
- package/ui/styling/style/index.d.ts +4 -1
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +62 -112
- package/ui/styling/style-properties.js +50 -98
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.d.ts +85 -48
- package/ui/styling/style-scope.js +29 -39
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/styling/styling-profile.d.ts +1 -0
- package/ui/styling/styling-profile.js +4 -0
- package/ui/styling/styling-profile.js.map +1 -0
- package/ui/styling/styling-shared.d.ts +3 -0
- package/ui/styling/styling-shared.js +6 -0
- package/ui/styling/styling-shared.js.map +1 -0
- package/ui/switch/index.android.js +16 -16
- 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 +167 -158
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +22 -1
- package/ui/tab-view/index.ios.d.ts +19 -3
- package/ui/tab-view/index.ios.js +337 -61
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +15 -0
- package/ui/tab-view/tab-view-common.js +15 -0
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.d.ts +8 -18
- package/ui/text-base/index.android.js +126 -165
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.d.ts +6 -6
- package/ui/text-base/index.ios.js +16 -20
- 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 -1
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.ios.d.ts +4 -9
- package/ui/text-field/index.ios.js +55 -35
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-view/index.ios.d.ts +3 -9
- package/ui/text-view/index.ios.js +31 -78
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/time-picker/index.android.js +19 -19
- 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 +6 -7
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/index.ios.js +1 -1
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +20 -27
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +1 -1
- package/ui/transition/page-transition.android.js +7 -16
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.js +20 -26
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.ios.js +1 -1
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition.js +2 -1
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.ios.js +7 -8
- 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 +17 -17
- package/ui/web-view/index.ios.js.map +1 -1
- package/utils/animation-helpers.d.ts +27 -0
- package/utils/animation-helpers.js +48 -0
- package/utils/animation-helpers.js.map +1 -0
- package/utils/common.d.ts +4 -41
- package/utils/common.js +26 -121
- package/utils/common.js.map +1 -1
- package/utils/constants.android.d.ts +1 -0
- package/utils/constants.android.js +3 -0
- package/utils/constants.android.js.map +1 -1
- package/utils/constants.d.ts +1 -0
- package/utils/constants.ios.d.ts +1 -0
- package/utils/constants.ios.js +3 -0
- package/utils/constants.ios.js.map +1 -1
- package/utils/debug-source.d.ts +19 -0
- package/utils/debug-source.js +78 -0
- package/utils/debug-source.js.map +1 -0
- package/utils/debug.js +1 -59
- package/utils/debug.js.map +1 -1
- package/utils/index.android.d.ts +3 -1
- package/utils/index.android.js +37 -11
- package/utils/index.android.js.map +1 -1
- package/utils/index.d.ts +8 -14
- package/utils/index.ios.d.ts +4 -1
- package/utils/index.ios.js +32 -5
- package/utils/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.d.ts +1 -0
- package/utils/layout-helper/index.android.js +13 -4
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.d.ts +11 -4
- package/utils/layout-helper/index.ios.d.ts +1 -0
- package/utils/layout-helper/index.ios.js +9 -5
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/layout-helper/layout-helper-common.d.ts +0 -9
- package/utils/layout-helper/layout-helper-common.js +1 -9
- package/utils/layout-helper/layout-helper-common.js.map +1 -1
- package/utils/layout-helper/layout-helper-shared.d.ts +9 -0
- package/utils/layout-helper/layout-helper-shared.js +13 -0
- package/utils/layout-helper/layout-helper-shared.js.map +1 -0
- package/utils/{android/index.d.ts → native-helper-for-android.d.ts} +5 -3
- package/utils/{android/index.js → native-helper-for-android.js} +140 -28
- package/utils/native-helper-for-android.js.map +1 -0
- package/utils/native-helper.android.d.ts +29 -5
- package/utils/native-helper.android.js +18 -131
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +206 -258
- package/utils/native-helper.ios.d.ts +72 -3
- package/utils/native-helper.ios.js +250 -3
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/shared.d.ts +19 -0
- package/utils/shared.js +44 -0
- package/utils/shared.js.map +1 -0
- package/utils/utils-shared.d.ts +1 -0
- package/utils/utils-shared.js +8 -0
- package/utils/utils-shared.js.map +1 -0
- package/xhr/index.d.ts +6 -0
- package/xhr/index.js +27 -13
- package/xhr/index.js.map +1 -1
- package/xml/index.d.ts +94 -98
- package/xml/index.js +58 -2
- package/xml/index.js.map +1 -1
- package/cli-hooks/postinstall.js +0 -2
- package/cli-hooks/preuninstall.js +0 -2
- package/debugger/dom-node.d.ts +0 -27
- package/debugger/dom-node.js.map +0 -1
- package/polyfills/formdata.d.ts +0 -6
- package/polyfills/formdata.js +0 -16
- package/polyfills/formdata.js.map +0 -1
- package/ui/builder/xml2ui.d.ts +0 -134
- package/ui/builder/xml2ui.js +0 -394
- package/ui/builder/xml2ui.js.map +0 -1
- package/ui/frame/callbacks/activity-callbacks.d.ts +0 -20
- package/ui/frame/callbacks/activity-callbacks.js +0 -301
- package/ui/frame/callbacks/activity-callbacks.js.map +0 -1
- package/ui/frame/callbacks/fragment-callbacks.js.map +0 -1
- package/utils/android/index.js.map +0 -1
- package/utils/ios/index.d.ts +0 -39
- package/utils/ios/index.js +0 -257
- package/utils/ios/index.js.map +0 -1
|
@@ -1,42 +1,52 @@
|
|
|
1
|
-
import { ListViewBase, separatorColorProperty, itemTemplatesProperty } from './list-view-common';
|
|
2
|
-
import {
|
|
1
|
+
import { ListViewBase, separatorColorProperty, itemTemplatesProperty, stickyHeaderProperty, stickyHeaderTemplateProperty, sectionedProperty, showSearchProperty } from './list-view-common';
|
|
2
|
+
import { View } from '../core/view';
|
|
3
|
+
import { PercentLength } from '../styling/length-shared';
|
|
4
|
+
import { unsetValue } from '../core/properties/property-shared';
|
|
3
5
|
import { Color } from '../../color';
|
|
4
6
|
import { Observable } from '../../data/observable';
|
|
5
7
|
import { StackLayout } from '../layouts/stack-layout';
|
|
6
8
|
import { ProxyViewContainer } from '../proxy-view-container';
|
|
7
9
|
import { LayoutBase } from '../layouts/layout-base';
|
|
8
10
|
import { profile } from '../../profiling';
|
|
11
|
+
import { Trace } from '../../trace';
|
|
12
|
+
import { Builder } from '../builder';
|
|
13
|
+
import { Label } from '../label';
|
|
9
14
|
export * from './list-view-common';
|
|
10
15
|
const ITEMLOADING = ListViewBase.itemLoadingEvent;
|
|
11
16
|
const LOADMOREITEMS = ListViewBase.loadMoreItemsEvent;
|
|
12
17
|
const ITEMTAP = ListViewBase.itemTapEvent;
|
|
18
|
+
const SEARCHCHANGE = ListViewBase.searchChangeEvent;
|
|
19
|
+
const STICKY_HEADER_Z_INDEX = 1000;
|
|
20
|
+
const SEARCH_VIEW_Z_INDEX = 2000;
|
|
21
|
+
// View type constants for sectioned lists
|
|
22
|
+
const ITEM_VIEW_TYPE = 0;
|
|
13
23
|
let ItemClickListener;
|
|
14
24
|
function initializeItemClickListener() {
|
|
15
25
|
if (ItemClickListener) {
|
|
16
26
|
return;
|
|
17
27
|
}
|
|
18
|
-
var ItemClickListenerImpl =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}(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
|
+
ItemClickListenerImpl = __decorate([
|
|
46
|
+
Interfaces([android.widget.AdapterView.OnItemClickListener])
|
|
47
|
+
], ItemClickListenerImpl);
|
|
48
|
+
return ItemClickListenerImpl;
|
|
49
|
+
}(java.lang.Object));
|
|
40
50
|
ItemClickListener = ItemClickListenerImpl;
|
|
41
51
|
}
|
|
42
52
|
export class ListView extends ListViewBase {
|
|
@@ -46,6 +56,11 @@ export class ListView extends ListViewBase {
|
|
|
46
56
|
this._realizedItems = new Map();
|
|
47
57
|
this._availableViews = new Map();
|
|
48
58
|
this._realizedTemplates = new Map();
|
|
59
|
+
this._stickyHeaderHeight = 0;
|
|
60
|
+
this._hiddenHeaderPositions = new Set(); // Track which headers to hide
|
|
61
|
+
}
|
|
62
|
+
get hasSearchView() {
|
|
63
|
+
return !!this._searchView;
|
|
49
64
|
}
|
|
50
65
|
_ensureAvailableViews(templateKey) {
|
|
51
66
|
if (!this._availableViews.has(templateKey)) {
|
|
@@ -120,6 +135,7 @@ export class ListView extends ListViewBase {
|
|
|
120
135
|
this._androidViewId = android.view.View.generateViewId();
|
|
121
136
|
}
|
|
122
137
|
nativeView.setId(this._androidViewId);
|
|
138
|
+
// Don't setup search here - wait for onLoaded when context is properly available
|
|
123
139
|
}
|
|
124
140
|
disposeNativeView() {
|
|
125
141
|
const nativeView = this.nativeViewProtected;
|
|
@@ -130,13 +146,40 @@ export class ListView extends ListViewBase {
|
|
|
130
146
|
if (nativeView.adapter) {
|
|
131
147
|
nativeView.adapter.owner = null;
|
|
132
148
|
}
|
|
149
|
+
// Cleanup search
|
|
150
|
+
this._cleanupSearchView();
|
|
151
|
+
// Cleanup sticky header
|
|
152
|
+
this._cleanupStickyHeader();
|
|
133
153
|
this.clearRealizedCells();
|
|
134
154
|
super.disposeNativeView();
|
|
135
155
|
}
|
|
156
|
+
_cleanupStickyHeader() {
|
|
157
|
+
// Remove scroll listener
|
|
158
|
+
if (this._scrollListener) {
|
|
159
|
+
this.nativeViewProtected.setOnScrollListener(null);
|
|
160
|
+
this._scrollListener = null;
|
|
161
|
+
}
|
|
162
|
+
// Remove sticky header from parent
|
|
163
|
+
if (this._stickyHeaderView && this._stickyHeaderView.parent) {
|
|
164
|
+
this._stickyHeaderView.parent._removeView(this._stickyHeaderView);
|
|
165
|
+
}
|
|
166
|
+
this._stickyHeaderView = null;
|
|
167
|
+
this._stickyHeaderHeight = 0;
|
|
168
|
+
// Clear hidden headers
|
|
169
|
+
this._hiddenHeaderPositions.clear();
|
|
170
|
+
}
|
|
136
171
|
onLoaded() {
|
|
137
172
|
super.onLoaded();
|
|
138
173
|
// Without this call itemClick won't be fired... :(
|
|
139
174
|
this.requestLayout();
|
|
175
|
+
// Setup sticky header if enabled
|
|
176
|
+
if (this.stickyHeader && this.sectioned && this.stickyHeaderTemplate) {
|
|
177
|
+
this._setupStickyHeader();
|
|
178
|
+
}
|
|
179
|
+
// Setup search if enabled and not already set up
|
|
180
|
+
if (this.showSearch && !this._searchView && this.nativeViewProtected && this.nativeViewProtected.getAdapter()) {
|
|
181
|
+
this._setupSearchView();
|
|
182
|
+
}
|
|
140
183
|
}
|
|
141
184
|
refresh() {
|
|
142
185
|
const nativeView = this.nativeViewProtected;
|
|
@@ -149,7 +192,19 @@ export class ListView extends ListViewBase {
|
|
|
149
192
|
view.bindingContext = null;
|
|
150
193
|
}
|
|
151
194
|
});
|
|
152
|
-
|
|
195
|
+
// Safely refresh the adapter - no HeaderViewListAdapter issues since we don't use headers
|
|
196
|
+
const adapter = nativeView.getAdapter();
|
|
197
|
+
if (adapter instanceof android.widget.BaseAdapter) {
|
|
198
|
+
try {
|
|
199
|
+
adapter.notifyDataSetChanged();
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (Trace.isEnabled()) {
|
|
203
|
+
Trace.error('Error refreshing adapter, recreating: ' + error);
|
|
204
|
+
}
|
|
205
|
+
nativeView.setAdapter(new ListViewAdapterClass(this));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
153
208
|
}
|
|
154
209
|
scrollToIndex(index) {
|
|
155
210
|
const nativeView = this.nativeViewProtected;
|
|
@@ -210,6 +265,217 @@ export class ListView extends ListViewBase {
|
|
|
210
265
|
const end = nativeView.getLastVisiblePosition();
|
|
211
266
|
return index >= start && index <= end;
|
|
212
267
|
}
|
|
268
|
+
// Sticky header methods
|
|
269
|
+
_setupStickyHeader() {
|
|
270
|
+
if (!this.stickyHeader || !this.sectioned || !this.stickyHeaderTemplate) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
// Create the sticky header view
|
|
274
|
+
this._createStickyHeaderView();
|
|
275
|
+
// Add it as an overlay to the parent
|
|
276
|
+
this._addStickyHeaderToParent();
|
|
277
|
+
// Add padding to ListView so content doesn't hide behind sticky header
|
|
278
|
+
this._addListViewPadding();
|
|
279
|
+
// Setup scroll listener to update header content
|
|
280
|
+
this._setupScrollListener();
|
|
281
|
+
}
|
|
282
|
+
_createStickyHeaderView() {
|
|
283
|
+
if (this._stickyHeaderView) {
|
|
284
|
+
return; // Already created
|
|
285
|
+
}
|
|
286
|
+
// Create header view using the same template as section headers
|
|
287
|
+
if (typeof this.stickyHeaderTemplate === 'string') {
|
|
288
|
+
try {
|
|
289
|
+
this._stickyHeaderView = Builder.parse(this.stickyHeaderTemplate, this);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
// Fallback to simple label
|
|
293
|
+
this._stickyHeaderView = new Label();
|
|
294
|
+
this._stickyHeaderView.text = 'Header Error';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (!this._stickyHeaderView) {
|
|
298
|
+
// Default header
|
|
299
|
+
this._stickyHeaderView = new Label();
|
|
300
|
+
this._stickyHeaderView.text = 'Section 0';
|
|
301
|
+
}
|
|
302
|
+
// Set initial binding context (section 0)
|
|
303
|
+
this._updateStickyHeader(0);
|
|
304
|
+
}
|
|
305
|
+
_addStickyHeaderToParent() {
|
|
306
|
+
if (!this._stickyHeaderView || !this.parent) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
// Remove from current parent if it has one (likely the ListView from Builder.parse)
|
|
310
|
+
if (this._stickyHeaderView.parent) {
|
|
311
|
+
this._stickyHeaderView.parent._removeView(this._stickyHeaderView);
|
|
312
|
+
}
|
|
313
|
+
// Set proper sizing - don't stretch to fill parent
|
|
314
|
+
this._stickyHeaderView.width = { unit: '%', value: 100 };
|
|
315
|
+
this._stickyHeaderView.height = 'auto'; // Let it size to content
|
|
316
|
+
this._stickyHeaderView.verticalAlignment = 'top';
|
|
317
|
+
this._stickyHeaderView.horizontalAlignment = 'stretch';
|
|
318
|
+
// Add sticky header to the parent layout
|
|
319
|
+
// If search view exists, position sticky header after it (index 1), otherwise at top (index 0)
|
|
320
|
+
const parentLayout = this.parent;
|
|
321
|
+
const hasSearchView = this.showSearch && this._searchView && this._searchView._wrapper;
|
|
322
|
+
if (parentLayout instanceof StackLayout) {
|
|
323
|
+
const insertIndex = hasSearchView ? 1 : 0;
|
|
324
|
+
parentLayout.insertChild(this._stickyHeaderView, insertIndex);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
parentLayout._addView(this._stickyHeaderView);
|
|
328
|
+
}
|
|
329
|
+
// When search is enabled, position sticky header below search view with proper top margin
|
|
330
|
+
if (this.showSearch && this._searchView) {
|
|
331
|
+
// Add top margin to push sticky header below search view
|
|
332
|
+
this._stickyHeaderView.marginTop = 0; // Reset any previous margin
|
|
333
|
+
// Position sticky header with proper offset using native positioning
|
|
334
|
+
if (this._stickyHeaderView.nativeViewProtected) {
|
|
335
|
+
this._stickyHeaderView.nativeViewProtected.setZ(STICKY_HEADER_Z_INDEX);
|
|
336
|
+
// Use a timeout to ensure search view is measured first
|
|
337
|
+
setTimeout(() => {
|
|
338
|
+
if (this._searchView && this._searchView._wrapper) {
|
|
339
|
+
const searchWrapper = this._searchView._wrapper;
|
|
340
|
+
if (searchWrapper.nativeViewProtected) {
|
|
341
|
+
const searchHeight = searchWrapper.nativeViewProtected.getMeasuredHeight() || 50;
|
|
342
|
+
// Position sticky header below search view using translation
|
|
343
|
+
if (this._stickyHeaderView.nativeViewProtected) {
|
|
344
|
+
this._stickyHeaderView.nativeViewProtected.setTranslationY(searchHeight);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}, 100);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
// No search view - position at top
|
|
353
|
+
if (this._stickyHeaderView.nativeViewProtected) {
|
|
354
|
+
this._stickyHeaderView.nativeViewProtected.setZ(STICKY_HEADER_Z_INDEX);
|
|
355
|
+
this._stickyHeaderView.nativeViewProtected.setTranslationY(0);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
_addListViewPadding() {
|
|
360
|
+
if (!this._stickyHeaderView) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
// Calculate total top padding: search view height + sticky header height
|
|
364
|
+
let searchViewHeight = 0;
|
|
365
|
+
if (this.showSearch && this._searchView && this._searchView._wrapper) {
|
|
366
|
+
const searchWrapper = this._searchView._wrapper;
|
|
367
|
+
if (searchWrapper.nativeViewProtected && searchWrapper.nativeViewProtected.getMeasuredHeight() > 0) {
|
|
368
|
+
searchViewHeight = searchWrapper.nativeViewProtected.getMeasuredHeight();
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
searchViewHeight = 50; // Default search view height
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// Apply immediate padding with defaults to prevent content hiding
|
|
375
|
+
const defaultHeaderHeight = 50; // Reasonable default height in dp
|
|
376
|
+
const totalPadding = searchViewHeight + defaultHeaderHeight;
|
|
377
|
+
this.nativeViewProtected.setPadding(0, totalPadding, 0, 0);
|
|
378
|
+
this._stickyHeaderHeight = defaultHeaderHeight;
|
|
379
|
+
// Request layout to ensure proper measurement
|
|
380
|
+
this._stickyHeaderView.requestLayout();
|
|
381
|
+
// Then measure and adjust padding if needed using a layout listener for determinism
|
|
382
|
+
const stickyHeaderNativeView = this._stickyHeaderView && this._stickyHeaderView.nativeViewProtected;
|
|
383
|
+
if (stickyHeaderNativeView) {
|
|
384
|
+
const layoutListener = new android.view.View.OnLayoutChangeListener({
|
|
385
|
+
onLayoutChange: (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) => {
|
|
386
|
+
if (v.getMeasuredHeight() > 0) {
|
|
387
|
+
const measuredHeaderHeight = v.getMeasuredHeight();
|
|
388
|
+
let finalSearchHeight = searchViewHeight;
|
|
389
|
+
// Re-measure search view if needed
|
|
390
|
+
if (this.showSearch && this._searchView && this._searchView._wrapper) {
|
|
391
|
+
const searchWrapper = this._searchView._wrapper;
|
|
392
|
+
if (searchWrapper.nativeViewProtected && searchWrapper.nativeViewProtected.getMeasuredHeight() > 0) {
|
|
393
|
+
finalSearchHeight = searchWrapper.nativeViewProtected.getMeasuredHeight();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// Calculate final padding: search height + sticky header height + small buffer
|
|
397
|
+
const totalPaddingHeight = finalSearchHeight + measuredHeaderHeight + 4;
|
|
398
|
+
this._stickyHeaderHeight = measuredHeaderHeight;
|
|
399
|
+
this.nativeViewProtected.setPadding(0, totalPaddingHeight, 0, 0);
|
|
400
|
+
this.scrollToIndex(0);
|
|
401
|
+
// Remove the listener after first valid layout
|
|
402
|
+
v.removeOnLayoutChangeListener(layoutListener);
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
stickyHeaderNativeView.addOnLayoutChangeListener(layoutListener);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
_setupScrollListener() {
|
|
410
|
+
if (this._scrollListener) {
|
|
411
|
+
return; // Already setup
|
|
412
|
+
}
|
|
413
|
+
const owner = this;
|
|
414
|
+
this._scrollListener = new android.widget.AbsListView.OnScrollListener({
|
|
415
|
+
onScrollStateChanged(view, scrollState) {
|
|
416
|
+
// Not needed for sticky headers
|
|
417
|
+
},
|
|
418
|
+
onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount) {
|
|
419
|
+
if (owner.sectioned && owner._stickyHeaderView) {
|
|
420
|
+
const currentSection = owner._getCurrentSection(firstVisibleItem);
|
|
421
|
+
owner._updateStickyHeader(currentSection);
|
|
422
|
+
// Hide section headers when they would appear right below sticky header
|
|
423
|
+
owner._updateHiddenHeaders(firstVisibleItem);
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
this.nativeViewProtected.setOnScrollListener(this._scrollListener);
|
|
428
|
+
}
|
|
429
|
+
_getCurrentSection(firstVisibleItem) {
|
|
430
|
+
if (!this.sectioned) {
|
|
431
|
+
return 0;
|
|
432
|
+
}
|
|
433
|
+
// Convert the first visible list position to section number
|
|
434
|
+
let currentPosition = 0;
|
|
435
|
+
const sectionCount = this._getSectionCount();
|
|
436
|
+
for (let section = 0; section < sectionCount; section++) {
|
|
437
|
+
// Check if firstVisibleItem is in this section (header or items)
|
|
438
|
+
const sectionItems = this._getItemsInSection(section) || [];
|
|
439
|
+
const itemsInSection = sectionItems.length || 0;
|
|
440
|
+
const sectionEndPosition = currentPosition + 1 + itemsInSection; // +1 for header
|
|
441
|
+
if (firstVisibleItem < sectionEndPosition) {
|
|
442
|
+
return section;
|
|
443
|
+
}
|
|
444
|
+
currentPosition = sectionEndPosition;
|
|
445
|
+
}
|
|
446
|
+
return Math.max(0, sectionCount - 1); // Fallback to last section
|
|
447
|
+
}
|
|
448
|
+
_updateStickyHeader(section) {
|
|
449
|
+
if (!this._stickyHeaderView) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
// Update binding context to match the current section
|
|
453
|
+
const sectionData = this._getSectionData(section);
|
|
454
|
+
if (sectionData) {
|
|
455
|
+
this._stickyHeaderView.bindingContext = sectionData;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
this._stickyHeaderView.bindingContext = { title: `Section ${section}`, section: section };
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
_updateHiddenHeaders(firstVisibleItem) {
|
|
462
|
+
const previousHiddenHeaders = new Set(this._hiddenHeaderPositions);
|
|
463
|
+
this._hiddenHeaderPositions.clear();
|
|
464
|
+
// If we're at the very top (first item is position 0, which is the first section header),
|
|
465
|
+
// hide that section header to avoid duplication with sticky header
|
|
466
|
+
if (firstVisibleItem === 0) {
|
|
467
|
+
this._hiddenHeaderPositions.add(0); // Hide the first section header position
|
|
468
|
+
}
|
|
469
|
+
// If hidden headers changed, refresh the adapter
|
|
470
|
+
const hiddenHeadersChanged = previousHiddenHeaders.size !== this._hiddenHeaderPositions.size || [...previousHiddenHeaders].some((pos) => !this._hiddenHeaderPositions.has(pos));
|
|
471
|
+
if (hiddenHeadersChanged) {
|
|
472
|
+
// Refresh adapter to update visibility
|
|
473
|
+
const adapter = this.nativeViewProtected.getAdapter();
|
|
474
|
+
if (adapter instanceof android.widget.BaseAdapter) {
|
|
475
|
+
adapter.notifyDataSetChanged();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
213
479
|
[separatorColorProperty.getDefault]() {
|
|
214
480
|
const nativeView = this.nativeViewProtected;
|
|
215
481
|
return {
|
|
@@ -236,8 +502,199 @@ export class ListView extends ListViewBase {
|
|
|
236
502
|
if (value) {
|
|
237
503
|
this._itemTemplatesInternal = this._itemTemplatesInternal.concat(value);
|
|
238
504
|
}
|
|
239
|
-
this.nativeViewProtected
|
|
240
|
-
|
|
505
|
+
if (this.nativeViewProtected) {
|
|
506
|
+
this.nativeViewProtected.setAdapter(new ListViewAdapterClass(this));
|
|
507
|
+
this.refresh();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// Sticky header property handlers
|
|
511
|
+
[stickyHeaderProperty.setNative](value) {
|
|
512
|
+
// Refresh adapter to handle sectioned vs non-sectioned display
|
|
513
|
+
if (this.nativeViewProtected && this.nativeViewProtected.getAdapter()) {
|
|
514
|
+
this.nativeViewProtected.setAdapter(new ListViewAdapterClass(this));
|
|
515
|
+
}
|
|
516
|
+
// Setup or cleanup sticky header
|
|
517
|
+
if (value && this.sectioned && this.stickyHeaderTemplate && this.isLoaded) {
|
|
518
|
+
this._setupStickyHeader();
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
this._cleanupStickyHeader();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
[stickyHeaderTemplateProperty.setNative](value) {
|
|
525
|
+
// Refresh adapter when template changes
|
|
526
|
+
if (this.nativeViewProtected && this.nativeViewProtected.getAdapter()) {
|
|
527
|
+
this.nativeViewProtected.setAdapter(new ListViewAdapterClass(this));
|
|
528
|
+
}
|
|
529
|
+
// Recreate sticky header with new template
|
|
530
|
+
this._cleanupStickyHeader();
|
|
531
|
+
if (value && this.stickyHeader && this.sectioned && this.isLoaded) {
|
|
532
|
+
this._setupStickyHeader();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
[sectionedProperty.setNative](value) {
|
|
536
|
+
// Refresh adapter to handle sectioned vs non-sectioned data
|
|
537
|
+
if (this.nativeViewProtected && this.nativeViewProtected.getAdapter()) {
|
|
538
|
+
this.nativeViewProtected.setAdapter(new ListViewAdapterClass(this));
|
|
539
|
+
}
|
|
540
|
+
// Setup or cleanup sticky header based on sectioned state
|
|
541
|
+
if (value && this.stickyHeader && this.stickyHeaderTemplate && this.isLoaded) {
|
|
542
|
+
this._setupStickyHeader();
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
this._cleanupStickyHeader();
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// Search methods
|
|
549
|
+
_setupSearchView() {
|
|
550
|
+
if (this._searchView || !this.showSearch || !this.nativeViewProtected) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
// Create SearchView using the ListView's context
|
|
554
|
+
this._searchView = new android.widget.SearchView(this.nativeViewProtected.getContext());
|
|
555
|
+
this._searchView.setQueryHint('Search...');
|
|
556
|
+
this._searchView.setIconifiedByDefault(false);
|
|
557
|
+
this._searchView.setSubmitButtonEnabled(false);
|
|
558
|
+
// Setup search listener
|
|
559
|
+
const owner = this;
|
|
560
|
+
this._searchListener = new android.widget.SearchView.OnQueryTextListener({
|
|
561
|
+
onQueryTextChange(newText) {
|
|
562
|
+
const args = {
|
|
563
|
+
eventName: SEARCHCHANGE,
|
|
564
|
+
object: owner,
|
|
565
|
+
text: newText,
|
|
566
|
+
android: owner._searchView,
|
|
567
|
+
};
|
|
568
|
+
owner.notify(args);
|
|
569
|
+
return true;
|
|
570
|
+
},
|
|
571
|
+
onQueryTextSubmit(query) {
|
|
572
|
+
const args = {
|
|
573
|
+
eventName: SEARCHCHANGE,
|
|
574
|
+
object: owner,
|
|
575
|
+
text: query,
|
|
576
|
+
android: owner._searchView,
|
|
577
|
+
};
|
|
578
|
+
owner.notify(args);
|
|
579
|
+
return true;
|
|
580
|
+
},
|
|
581
|
+
});
|
|
582
|
+
this._searchView.setOnQueryTextListener(this._searchListener);
|
|
583
|
+
// Add search view to the parent container above the ListView
|
|
584
|
+
this._addSearchToParent();
|
|
585
|
+
// Add padding to ListView if no sticky header (otherwise sticky header method handles it)
|
|
586
|
+
if (!this.stickyHeader || !this._stickyHeaderView) {
|
|
587
|
+
this._addSearchPadding();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
_addSearchPadding() {
|
|
591
|
+
if (!this._searchView) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
// Add basic padding for search view
|
|
595
|
+
const defaultSearchHeight = 50; // Default search view height
|
|
596
|
+
this.nativeViewProtected.setPadding(0, defaultSearchHeight, 0, 0);
|
|
597
|
+
// Measure and adjust if needed
|
|
598
|
+
setTimeout(() => {
|
|
599
|
+
if (this._searchView && this._searchView._wrapper) {
|
|
600
|
+
const searchWrapper = this._searchView._wrapper;
|
|
601
|
+
if (searchWrapper.nativeViewProtected && searchWrapper.nativeViewProtected.getMeasuredHeight() > 0) {
|
|
602
|
+
const measuredHeight = searchWrapper.nativeViewProtected.getMeasuredHeight();
|
|
603
|
+
this.nativeViewProtected.setPadding(0, measuredHeight + 4, 0, 0);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}, 100);
|
|
607
|
+
}
|
|
608
|
+
_addSearchToParent() {
|
|
609
|
+
if (!this._searchView || !this.parent) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
// Get the parent layout
|
|
613
|
+
const parentLayout = this.parent;
|
|
614
|
+
// Create a simple NativeScript wrapper for the native SearchView
|
|
615
|
+
const searchView = this._searchView;
|
|
616
|
+
const searchViewWrapper = new (class extends View {
|
|
617
|
+
createNativeView() {
|
|
618
|
+
return searchView;
|
|
619
|
+
}
|
|
620
|
+
})();
|
|
621
|
+
// Set layout properties - ensure it's at the top
|
|
622
|
+
searchViewWrapper.height = 'auto';
|
|
623
|
+
searchViewWrapper.width = { unit: '%', value: 100 };
|
|
624
|
+
searchViewWrapper.verticalAlignment = 'top';
|
|
625
|
+
searchViewWrapper.horizontalAlignment = 'stretch';
|
|
626
|
+
// Always insert at position 0 (top) regardless of ListView position
|
|
627
|
+
if (parentLayout instanceof StackLayout) {
|
|
628
|
+
parentLayout.insertChild(searchViewWrapper, 0);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
// For other layout types, add as first child
|
|
632
|
+
parentLayout._addView(searchViewWrapper);
|
|
633
|
+
}
|
|
634
|
+
// Ensure search view appears above everything else
|
|
635
|
+
if (searchViewWrapper.nativeViewProtected) {
|
|
636
|
+
searchViewWrapper.nativeViewProtected.setZ(SEARCH_VIEW_Z_INDEX);
|
|
637
|
+
}
|
|
638
|
+
// Store reference for cleanup
|
|
639
|
+
this._searchView._wrapper = searchViewWrapper;
|
|
640
|
+
}
|
|
641
|
+
_cleanupSearchView() {
|
|
642
|
+
if (this._searchView) {
|
|
643
|
+
// Remove search view wrapper from parent
|
|
644
|
+
const wrapper = this._searchView._wrapper;
|
|
645
|
+
if (wrapper && wrapper.parent) {
|
|
646
|
+
wrapper.parent._removeView(wrapper);
|
|
647
|
+
}
|
|
648
|
+
// Clear listener
|
|
649
|
+
if (this._searchListener) {
|
|
650
|
+
this._searchView.setOnQueryTextListener(null);
|
|
651
|
+
this._searchListener = null;
|
|
652
|
+
}
|
|
653
|
+
this._searchView = null;
|
|
654
|
+
// Reset ListView padding if no sticky header
|
|
655
|
+
if (!this.stickyHeader || !this._stickyHeaderView) {
|
|
656
|
+
this.nativeViewProtected.setPadding(0, 0, 0, 0);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
[showSearchProperty.setNative](value) {
|
|
661
|
+
if (value) {
|
|
662
|
+
if (this.isLoaded && this.nativeViewProtected && this.nativeViewProtected.getAdapter()) {
|
|
663
|
+
this._setupSearchView();
|
|
664
|
+
// Reposition sticky header if it exists
|
|
665
|
+
if (this._stickyHeaderView) {
|
|
666
|
+
this._repositionStickyHeader();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
this._cleanupSearchView();
|
|
672
|
+
// Reposition sticky header if it exists
|
|
673
|
+
if (this._stickyHeaderView) {
|
|
674
|
+
this._repositionStickyHeader();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
_repositionStickyHeader() {
|
|
679
|
+
if (!this._stickyHeaderView || !this._stickyHeaderView.nativeViewProtected) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
// Reset positioning
|
|
683
|
+
this._stickyHeaderView.nativeViewProtected.setTranslationY(0);
|
|
684
|
+
// If search is enabled, position below search view
|
|
685
|
+
if (this.showSearch && this._searchView && this._searchView._wrapper) {
|
|
686
|
+
setTimeout(() => {
|
|
687
|
+
const searchWrapper = this._searchView._wrapper;
|
|
688
|
+
if (searchWrapper.nativeViewProtected) {
|
|
689
|
+
const searchHeight = searchWrapper.nativeViewProtected.getMeasuredHeight() || 50;
|
|
690
|
+
this._stickyHeaderView.nativeViewProtected.setTranslationY(searchHeight);
|
|
691
|
+
}
|
|
692
|
+
}, 100);
|
|
693
|
+
}
|
|
694
|
+
// Update ListView padding
|
|
695
|
+
if (this.stickyHeader && this._stickyHeaderView) {
|
|
696
|
+
this._addListViewPadding();
|
|
697
|
+
}
|
|
241
698
|
}
|
|
242
699
|
}
|
|
243
700
|
__decorate([
|
|
@@ -248,112 +705,298 @@ function ensureListViewAdapterClass() {
|
|
|
248
705
|
if (ListViewAdapterClass) {
|
|
249
706
|
return;
|
|
250
707
|
}
|
|
251
|
-
var ListViewAdapter =
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
ListViewAdapter.prototype.getCount = function () {
|
|
259
|
-
return this.owner && this.owner.items && this.owner.items.length ? this.owner.items.length : 0;
|
|
260
|
-
};
|
|
261
|
-
ListViewAdapter.prototype.getItem = function (i) {
|
|
262
|
-
if (this.owner && this.owner.items && i < this.owner.items.length) {
|
|
263
|
-
var getItem = this.owner.items.getItem;
|
|
264
|
-
return getItem ? getItem.call(this.owner.items, i) : this.owner.items[i];
|
|
708
|
+
var ListViewAdapter = (function (_super) {
|
|
709
|
+
__extends(ListViewAdapter, _super);
|
|
710
|
+
function ListViewAdapter(owner) {
|
|
711
|
+
var _this = _super.call(this) || this;
|
|
712
|
+
_this.owner = owner;
|
|
713
|
+
return global.__native(_this);
|
|
265
714
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
715
|
+
ListViewAdapter.prototype.getCount = function () {
|
|
716
|
+
if (!this.owner) {
|
|
717
|
+
return 0;
|
|
718
|
+
}
|
|
719
|
+
var count = 0;
|
|
720
|
+
if (this.owner.sectioned) {
|
|
721
|
+
var sectionCount = this.owner._getSectionCount();
|
|
722
|
+
if (!this.owner.items || sectionCount <= 0) {
|
|
723
|
+
return 0;
|
|
724
|
+
}
|
|
725
|
+
for (var i = 0; i < sectionCount; i++) {
|
|
726
|
+
var itemsInSection = this.owner._getItemsInSection(i) || [];
|
|
727
|
+
if (itemsInSection.length > 0) {
|
|
728
|
+
count += 1;
|
|
729
|
+
count += itemsInSection.length;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
var src = this.owner.items;
|
|
735
|
+
count = src && typeof src.length === "number" ? src.length : 0;
|
|
736
|
+
}
|
|
737
|
+
return Math.max(0, count);
|
|
738
|
+
};
|
|
739
|
+
ListViewAdapter.prototype.getItem = function (i) {
|
|
740
|
+
if (!this.owner || !this.owner.items) {
|
|
741
|
+
return null;
|
|
742
|
+
}
|
|
743
|
+
var totalCount = this.getCount();
|
|
744
|
+
if (i < 0 || i >= totalCount) {
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
if (this.owner.sectioned) {
|
|
748
|
+
var positionInfo = this._getPositionInfo(i);
|
|
749
|
+
if (positionInfo.isHeader) {
|
|
750
|
+
return this.owner._getSectionData(positionInfo.section);
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
return this.owner._getDataItemInSection(positionInfo.section, positionInfo.itemIndex);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
var src = this.owner.items;
|
|
758
|
+
if (src && typeof src.length === "number" && i < src.length) {
|
|
759
|
+
var getItem = src.getItem;
|
|
760
|
+
return getItem ? getItem.call(src, i) : src[i];
|
|
761
|
+
}
|
|
762
|
+
}
|
|
290
763
|
return null;
|
|
291
|
-
}
|
|
292
|
-
var totalItemCount = this.owner.items ? this.owner.items.length : 0;
|
|
293
|
-
if (index === totalItemCount - 1) {
|
|
294
|
-
this.owner.notify({
|
|
295
|
-
eventName: LOADMOREITEMS,
|
|
296
|
-
object: this.owner,
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
// Recycle an existing view or create a new one if needed.
|
|
300
|
-
var template = this.owner._getItemTemplate(index);
|
|
301
|
-
var view;
|
|
302
|
-
// convertView is of the wrong type
|
|
303
|
-
if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
|
|
304
|
-
this.owner._markViewUnused(convertView); // release this view
|
|
305
|
-
convertView = this.owner._getAvailableView(template.key); // get a view from the right type or null
|
|
306
|
-
}
|
|
307
|
-
if (convertView) {
|
|
308
|
-
view = this.owner._realizedItems.get(convertView).view;
|
|
309
|
-
}
|
|
310
|
-
if (!view) {
|
|
311
|
-
view = template.createView();
|
|
312
|
-
}
|
|
313
|
-
var args = {
|
|
314
|
-
eventName: ITEMLOADING,
|
|
315
|
-
object: this.owner,
|
|
316
|
-
index: index,
|
|
317
|
-
view: view,
|
|
318
|
-
android: parent,
|
|
319
|
-
ios: undefined,
|
|
320
764
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
765
|
+
ListViewAdapter.prototype._getPositionInfo = function (position) {
|
|
766
|
+
if (!this.owner.sectioned) {
|
|
767
|
+
return { isHeader: false, section: 0, itemIndex: position };
|
|
768
|
+
}
|
|
769
|
+
var currentPosition = 0;
|
|
770
|
+
var sectionCount = this.owner._getSectionCount();
|
|
771
|
+
for (var section = 0; section < sectionCount; section++) {
|
|
772
|
+
var itemsInSection = this.owner._getItemsInSection(section) || [];
|
|
773
|
+
if (itemsInSection.length === 0) {
|
|
774
|
+
continue;
|
|
775
|
+
}
|
|
776
|
+
if (currentPosition === position) {
|
|
777
|
+
return { isHeader: true, section: section, itemIndex: -1 };
|
|
778
|
+
}
|
|
779
|
+
currentPosition++;
|
|
780
|
+
if (position < currentPosition + itemsInSection.length) {
|
|
781
|
+
var itemIndex = position - currentPosition;
|
|
782
|
+
return { isHeader: false, section: section, itemIndex: itemIndex };
|
|
783
|
+
}
|
|
784
|
+
currentPosition += itemsInSection.length;
|
|
785
|
+
}
|
|
786
|
+
return { isHeader: false, section: 0, itemIndex: 0 };
|
|
787
|
+
};
|
|
788
|
+
ListViewAdapter.prototype.getItemId = function (i) {
|
|
789
|
+
var item = this.getItem(i);
|
|
790
|
+
var id = i;
|
|
791
|
+
if (this.owner && item && this.owner.items) {
|
|
792
|
+
id = this.owner.itemIdGenerator(item, i, this.owner.items);
|
|
793
|
+
}
|
|
794
|
+
return long(id);
|
|
795
|
+
};
|
|
796
|
+
ListViewAdapter.prototype.hasStableIds = function () {
|
|
797
|
+
return true;
|
|
798
|
+
};
|
|
799
|
+
ListViewAdapter.prototype.isEnabled = function (position) {
|
|
800
|
+
var totalCount = this.getCount();
|
|
801
|
+
if (totalCount === 0 || position < 0 || position >= totalCount) {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
if (this.owner.sectioned) {
|
|
805
|
+
var positionInfo = this._getPositionInfo(position);
|
|
806
|
+
return !positionInfo.isHeader;
|
|
807
|
+
}
|
|
808
|
+
return true;
|
|
809
|
+
};
|
|
810
|
+
ListViewAdapter.prototype.getViewTypeCount = function () {
|
|
811
|
+
var count = this.owner._itemTemplatesInternal.length;
|
|
812
|
+
if (this.owner.sectioned && this.owner.stickyHeaderTemplate) {
|
|
813
|
+
count += 1;
|
|
814
|
+
}
|
|
815
|
+
return count;
|
|
816
|
+
};
|
|
817
|
+
ListViewAdapter.prototype.getItemViewType = function (index) {
|
|
818
|
+
if (this.owner.sectioned) {
|
|
819
|
+
var positionInfo = this._getPositionInfo(index);
|
|
820
|
+
if (positionInfo.isHeader) {
|
|
821
|
+
return this.owner._itemTemplatesInternal.length;
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
var template = this.owner._getItemTemplate(positionInfo.itemIndex);
|
|
825
|
+
return this.owner._itemTemplatesInternal.indexOf(template);
|
|
826
|
+
}
|
|
328
827
|
}
|
|
329
828
|
else {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
829
|
+
var template = this.owner._getItemTemplate(index);
|
|
830
|
+
return this.owner._itemTemplatesInternal.indexOf(template);
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
ListViewAdapter.prototype.getView = function (index, convertView, parent) {
|
|
834
|
+
if (!this.owner) {
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
var totalCount = this.getCount();
|
|
838
|
+
if (index < 0 || index >= totalCount) {
|
|
839
|
+
var emptyView = new android.view.View(this.owner._context);
|
|
840
|
+
var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
|
|
841
|
+
emptyView.setLayoutParams(layoutParams);
|
|
842
|
+
return emptyView;
|
|
843
|
+
}
|
|
844
|
+
if (index === totalCount - 1) {
|
|
845
|
+
this.owner.notify({
|
|
846
|
+
eventName: LOADMOREITEMS,
|
|
847
|
+
object: this.owner,
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
if (this.owner.sectioned) {
|
|
851
|
+
var positionInfo = this._getPositionInfo(index);
|
|
852
|
+
if (positionInfo.isHeader) {
|
|
853
|
+
return this._createHeaderView(positionInfo.section, convertView, parent, index);
|
|
339
854
|
}
|
|
340
855
|
else {
|
|
341
|
-
|
|
342
|
-
sp.addChild(args.view);
|
|
343
|
-
this.owner._addView(sp);
|
|
344
|
-
convertView = sp.nativeViewProtected;
|
|
856
|
+
return this._createItemView(positionInfo.section, positionInfo.itemIndex, convertView, parent);
|
|
345
857
|
}
|
|
346
858
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
859
|
+
else {
|
|
860
|
+
return this._createItemView(0, index, convertView, parent);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
ListViewAdapter.prototype._createHeaderView = function (section, convertView, parent, index) {
|
|
864
|
+
if (this.owner._hiddenHeaderPositions.has(index)) {
|
|
865
|
+
var emptyView = new android.view.View(this.owner._context);
|
|
866
|
+
var layoutParams = new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
|
|
867
|
+
emptyView.setLayoutParams(layoutParams);
|
|
868
|
+
return emptyView;
|
|
869
|
+
}
|
|
870
|
+
var headerView = null;
|
|
871
|
+
var headerViewType = this.owner._itemTemplatesInternal.length;
|
|
872
|
+
if (convertView) {
|
|
873
|
+
var existingData = this.owner._realizedItems.get(convertView);
|
|
874
|
+
if (existingData && existingData.templateKey === "header_".concat(headerViewType)) {
|
|
875
|
+
headerView = existingData.view;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (!headerView) {
|
|
879
|
+
if (this.owner.stickyHeaderTemplate) {
|
|
880
|
+
if (typeof this.owner.stickyHeaderTemplate === "string") {
|
|
881
|
+
try {
|
|
882
|
+
headerView = Builder.parse(this.owner.stickyHeaderTemplate, this.owner);
|
|
883
|
+
}
|
|
884
|
+
catch (error) {
|
|
885
|
+
headerView = new Label();
|
|
886
|
+
headerView.text = "Header Error";
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if (!headerView) {
|
|
891
|
+
headerView = new Label();
|
|
892
|
+
headerView.text = "Section ".concat(section);
|
|
893
|
+
}
|
|
894
|
+
if (!headerView.parent) {
|
|
895
|
+
if (headerView instanceof LayoutBase && !(headerView instanceof ProxyViewContainer)) {
|
|
896
|
+
this.owner._addView(headerView);
|
|
897
|
+
convertView = headerView.nativeViewProtected;
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
var sp = new StackLayout();
|
|
901
|
+
sp.addChild(headerView);
|
|
902
|
+
this.owner._addView(sp);
|
|
903
|
+
convertView = sp.nativeViewProtected;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
this.owner._realizedItems.set(convertView, {
|
|
907
|
+
view: headerView,
|
|
908
|
+
templateKey: "header_".concat(headerViewType),
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
var sectionData = this.owner._getSectionData(section);
|
|
912
|
+
if (sectionData) {
|
|
913
|
+
headerView.bindingContext = sectionData;
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
headerView.bindingContext = { title: "Section ".concat(section), section: section };
|
|
917
|
+
}
|
|
918
|
+
return convertView;
|
|
919
|
+
};
|
|
920
|
+
ListViewAdapter.prototype._createItemView = function (section, itemIndex, convertView, parent) {
|
|
921
|
+
var template = this.owner._getItemTemplate(itemIndex);
|
|
922
|
+
var view;
|
|
923
|
+
if (convertView && this.owner._getKeyFromView(convertView) !== template.key) {
|
|
924
|
+
this.owner._markViewUnused(convertView);
|
|
925
|
+
convertView = this.owner._getAvailableView(template.key);
|
|
926
|
+
}
|
|
927
|
+
if (convertView) {
|
|
928
|
+
view = this.owner._realizedItems.get(convertView).view;
|
|
929
|
+
}
|
|
930
|
+
if (!view) {
|
|
931
|
+
view = template.createView();
|
|
932
|
+
}
|
|
933
|
+
var args = {
|
|
934
|
+
eventName: ITEMLOADING,
|
|
935
|
+
object: this.owner,
|
|
936
|
+
index: itemIndex,
|
|
937
|
+
view: view,
|
|
938
|
+
android: parent,
|
|
939
|
+
ios: undefined,
|
|
940
|
+
};
|
|
941
|
+
if (this.owner.sectioned) {
|
|
942
|
+
args.section = section;
|
|
943
|
+
}
|
|
944
|
+
this.owner.notify(args);
|
|
945
|
+
if (!args.view) {
|
|
946
|
+
args.view = this.owner._getDefaultItemContent(itemIndex);
|
|
947
|
+
}
|
|
948
|
+
if (args.view) {
|
|
949
|
+
if (this.owner._effectiveRowHeight > -1) {
|
|
950
|
+
args.view.height = this.owner.rowHeight;
|
|
951
|
+
}
|
|
952
|
+
else {
|
|
953
|
+
args.view.height = unsetValue;
|
|
954
|
+
}
|
|
955
|
+
if (this.owner.sectioned) {
|
|
956
|
+
args.view._listViewItemIndex = itemIndex;
|
|
957
|
+
args.view._listViewSectionIndex = section;
|
|
958
|
+
}
|
|
959
|
+
if (this.owner.sectioned) {
|
|
960
|
+
this.owner._prepareItemInSection(args.view, section, itemIndex);
|
|
961
|
+
}
|
|
962
|
+
else {
|
|
963
|
+
this.owner._prepareItem(args.view, itemIndex);
|
|
964
|
+
}
|
|
965
|
+
if (!args.view.parent) {
|
|
966
|
+
if (args.view instanceof LayoutBase && !(args.view instanceof ProxyViewContainer)) {
|
|
967
|
+
var mt = PercentLength.toDevicePixels(args.view.marginTop, 0, Number.NaN);
|
|
968
|
+
var mb = PercentLength.toDevicePixels(args.view.marginBottom, 0, Number.NaN);
|
|
969
|
+
var ml = PercentLength.toDevicePixels(args.view.marginLeft, 0, Number.NaN);
|
|
970
|
+
var mr = PercentLength.toDevicePixels(args.view.marginRight, 0, Number.NaN);
|
|
971
|
+
var hasMargins = mt > 0 || mb > 0 || ml > 0 || mr > 0;
|
|
972
|
+
if (hasMargins) {
|
|
973
|
+
var outer = new StackLayout();
|
|
974
|
+
outer.addChild(args.view);
|
|
975
|
+
this.owner._addView(outer);
|
|
976
|
+
convertView = outer.nativeViewProtected;
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
this.owner._addView(args.view);
|
|
980
|
+
convertView = args.view.nativeViewProtected;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
var sp = new StackLayout();
|
|
985
|
+
sp.addChild(args.view);
|
|
986
|
+
this.owner._addView(sp);
|
|
987
|
+
convertView = sp.nativeViewProtected;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
this.owner._registerViewToTemplate(template.key, convertView, args.view);
|
|
991
|
+
this.owner._markViewUsed(convertView);
|
|
992
|
+
}
|
|
993
|
+
return convertView;
|
|
994
|
+
};
|
|
995
|
+
__decorate([
|
|
996
|
+
profile
|
|
997
|
+
], ListViewAdapter.prototype, "getView", null);
|
|
998
|
+
return ListViewAdapter;
|
|
999
|
+
}(android.widget.BaseAdapter));
|
|
357
1000
|
ListViewAdapterClass = ListViewAdapter;
|
|
358
1001
|
}
|
|
359
1002
|
//# sourceMappingURL=index.android.js.map
|