@enact/ui 3.4.9-experimental-3 → 3.4.9-experimental-7
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/{build/A11yDecorator → A11yDecorator}/A11yDecorator.d.ts +0 -0
- package/A11yDecorator/A11yDecorator.js +79 -75
- package/A11yDecorator/tests/A11yDecorator-specs.js +90 -128
- package/AnnounceDecorator/Announce.js +136 -80
- package/{build/AnnounceDecorator → AnnounceDecorator}/AnnounceDecorator.d.ts +0 -0
- package/AnnounceDecorator/AnnounceDecorator.js +68 -53
- package/AnnounceDecorator/tests/Announce-specs.js +29 -35
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +34 -36
- package/AnnounceDecorator/tests/useAnnounce-specs.js +56 -63
- package/AnnounceDecorator/useAnnounce.js +29 -18
- package/{build/BodyText → BodyText}/BodyText.d.ts +0 -0
- package/BodyText/BodyText.js +108 -96
- package/{build/BodyText → BodyText}/BodyText.module.css +0 -0
- package/BodyText/tests/BodyText-specs.js +67 -76
- package/{build/Button → Button}/Button.d.ts +0 -0
- package/Button/Button.js +236 -215
- package/{build/Button → Button}/Button.module.css +0 -0
- package/CHANGELOG.md +18 -0
- package/{build/Cancelable → Cancelable}/Cancelable.d.ts +0 -0
- package/Cancelable/Cancelable.js +213 -184
- package/Cancelable/cancelHandler.js +36 -29
- package/Cancelable/modalHandler.js +35 -23
- package/Cancelable/tests/Cancelable-specs.js +289 -381
- package/{build/Changeable → Changeable}/Changeable.d.ts +0 -0
- package/Changeable/Changeable.js +137 -161
- package/Changeable/tests/Changeable-specs.js +262 -327
- package/{build/ComponentOverride → ComponentOverride}/ComponentOverride.d.ts +0 -0
- package/ComponentOverride/ComponentOverride.js +21 -24
- package/FloatingLayer/FloatingLayer.js +310 -261
- package/FloatingLayer/FloatingLayerDecorator.js +150 -99
- package/FloatingLayer/Scrim.js +167 -99
- package/{build/FloatingLayer → FloatingLayer}/Scrim.module.css +0 -0
- package/FloatingLayer/index.js +39 -12
- package/FloatingLayer/tests/FloatingLayer-specs.js +24 -27
- package/FloatingLayer/tests/Scrim-specs.js +21 -24
- package/FloatingLayer/useFloatingLayer.js +46 -18
- package/{build/ForwardRef → ForwardRef}/ForwardRef.d.ts +0 -0
- package/ForwardRef/ForwardRef.js +35 -34
- package/{build/GridListImageItem → GridListImageItem}/GridListImageItem.d.ts +0 -0
- package/GridListImageItem/GridListImageItem.js +244 -212
- package/{build/GridListImageItem → GridListImageItem}/GridListImageItem.module.css +0 -0
- package/{build/Group → Group}/Group.d.ts +0 -0
- package/Group/Group.js +186 -168
- package/Group/GroupItem.js +83 -79
- package/Group/tests/Group-specs.js +128 -164
- package/{build/Heading → Heading}/Heading.d.ts +0 -0
- package/Heading/Heading.js +146 -128
- package/{build/Heading → Heading}/Heading.module.css +0 -0
- package/Heading/tests/Heading-specs.js +46 -54
- package/{build/Icon → Icon}/Icon.d.ts +0 -0
- package/Icon/Icon.js +200 -189
- package/{build/Icon → Icon}/Icon.module.css +0 -0
- package/Icon/tests/Icon-specs.js +92 -126
- package/{build/IconButton → IconButton}/IconButton.d.ts +0 -0
- package/IconButton/IconButton.js +213 -181
- package/{build/IconButton → IconButton}/IconButton.module.css +0 -0
- package/{build/Image → Image}/Image.d.ts +0 -0
- package/Image/Image.js +186 -151
- package/{build/Image → Image}/Image.module.css +0 -0
- package/Image/tests/Image-specs.js +49 -51
- package/{build/ImageItem → ImageItem}/ImageItem.d.ts +0 -0
- package/ImageItem/ImageItem.js +165 -149
- package/{build/ImageItem → ImageItem}/ImageItem.module.css +0 -0
- package/ImageItem/tests/ImageItem-specs.js +128 -161
- package/{build/Item → Item}/Item.d.ts +0 -0
- package/Item/Item.js +131 -121
- package/{build/Item → Item}/Item.module.css +0 -0
- package/Item/tests/Item-specs.js +71 -88
- package/{build/LabeledIcon → LabeledIcon}/LabeledIcon.d.ts +0 -0
- package/LabeledIcon/LabeledIcon.js +235 -216
- package/{build/LabeledIcon → LabeledIcon}/LabeledIcon.module.css +0 -0
- package/LabeledIcon/tests/LabeledIcon-specs.js +49 -58
- package/Layout/Cell.js +181 -146
- package/{build/Layout → Layout}/Layout.d.ts +0 -0
- package/Layout/Layout.js +193 -282
- package/{build/Layout → Layout}/Layout.module.css +0 -0
- package/Layout/tests/Layout-specs.js +102 -109
- package/{build/Marquee → Marquee}/Marquee.module.css +0 -0
- package/Marquee/MarqueeBase.js +275 -240
- package/Marquee/MarqueeController.js +327 -292
- package/Marquee/MarqueeDecorator.js +990 -898
- package/{build/Marquee → Marquee}/index.d.ts +0 -0
- package/Marquee/index.js +39 -14
- package/Marquee/tests/Marquee-specs.js +274 -382
- package/{build/Measurable → Measurable}/Measurable.d.ts +0 -0
- package/Measurable/Measurable.js +133 -100
- package/{build/Media → Media}/Media.d.ts +0 -0
- package/Media/Media.js +317 -254
- package/Placeholder/PlaceholderControllerDecorator.js +188 -133
- package/Placeholder/PlaceholderDecorator.js +147 -95
- package/{build/Placeholder → Placeholder}/index.d.ts +0 -0
- package/Placeholder/index.js +27 -9
- package/{build/ProgressBar → ProgressBar}/ProgressBar.d.ts +0 -0
- package/ProgressBar/ProgressBar.js +183 -173
- package/{build/ProgressBar → ProgressBar}/ProgressBar.module.css +0 -0
- package/ProgressBar/tests/ProgressBar-specs.js +80 -109
- package/RadioDecorator/RadioControllerDecorator.js +104 -54
- package/{build/RadioDecorator → RadioDecorator}/RadioDecorator.d.ts +0 -0
- package/RadioDecorator/RadioDecorator.js +176 -117
- package/RadioDecorator/tests/RadioDecorator-specs.js +155 -166
- package/{build/Repeater → Repeater}/Repeater.d.ts +0 -0
- package/Repeater/Repeater.js +157 -133
- package/Repeater/tests/Repeater-specs.js +136 -155
- package/{build/Resizable → Resizable}/Resizable.d.ts +0 -0
- package/Resizable/Resizable.js +145 -101
- package/Routable/Link.js +65 -61
- package/{build/Routable → Routable}/Routable.d.ts +0 -0
- package/Routable/Routable.js +148 -109
- package/Routable/Route.js +37 -27
- package/Routable/Router.js +236 -171
- package/Routable/tests/Router-specs.js +194 -196
- package/Routable/util.js +78 -68
- package/Scrollable/ScrollAnimator.js +138 -112
- package/Scrollable/ScrollThumb.js +52 -42
- package/{build/Scrollable → Scrollable}/ScrollThumb.module.css +0 -0
- package/{build/Scrollable → Scrollable}/Scrollable.d.ts +0 -0
- package/Scrollable/Scrollable.js +1591 -1443
- package/{build/Scrollable → Scrollable}/Scrollable.module.css +0 -0
- package/Scrollable/ScrollableNative.js +1599 -1445
- package/Scrollable/Scrollbar.js +312 -221
- package/{build/Scrollable → Scrollable}/Scrollbar.module.css +0 -0
- package/{build/Scroller → Scroller}/Scroller.d.ts +0 -0
- package/Scroller/Scroller.js +249 -242
- package/{build/Scroller → Scroller}/Scroller.module.css +0 -0
- package/Scroller/ScrollerBasic.js +311 -230
- package/{build/Scroller → Scroller}/UiScroller.module.css +0 -0
- package/Scroller/UiScrollerBase.js +253 -184
- package/{build/Skinnable → Skinnable}/Skinnable.d.ts +0 -0
- package/Skinnable/Skinnable.js +182 -172
- package/Skinnable/tests/Skinnable-specs.js +388 -416
- package/Skinnable/tests/useSkins-specs.js +290 -281
- package/Skinnable/tests/util-specs.js +107 -113
- package/Skinnable/useSkins.js +51 -28
- package/Skinnable/util.js +80 -75
- package/Slider/Knob.js +85 -71
- package/Slider/PositionDecorator.js +232 -162
- package/{build/Slider → Slider}/Slider.d.ts +0 -0
- package/Slider/Slider.js +331 -312
- package/{build/Slider → Slider}/Slider.module.css +0 -0
- package/Slider/utils.js +16 -11
- package/{build/SlotItem → SlotItem}/SlotItem.d.ts +0 -0
- package/SlotItem/SlotItem.js +199 -179
- package/{build/SlotItem → SlotItem}/SlotItem.module.css +0 -0
- package/{build/Slottable → Slottable}/Slottable.d.ts +0 -0
- package/Slottable/Slottable.js +62 -48
- package/Slottable/tests/Slottable-specs.js +232 -284
- package/Slottable/tests/useSlots-specs.js +277 -313
- package/Slottable/useSlots.js +113 -90
- package/{build/Spinner → Spinner}/Spinner.d.ts +0 -0
- package/Spinner/Spinner.js +213 -178
- package/{build/Spinner → Spinner}/Spinner.module.css +0 -0
- package/Spinner/tests/Spinner-specs.js +61 -77
- package/{build/ToggleIcon → ToggleIcon}/ToggleIcon.d.ts +0 -0
- package/ToggleIcon/ToggleIcon.js +134 -123
- package/{build/ToggleIcon → ToggleIcon}/ToggleIcon.module.css +0 -0
- package/ToggleIcon/tests/ToggleIcon-specs.js +52 -71
- package/{build/ToggleItem → ToggleItem}/ToggleItem.d.ts +0 -0
- package/ToggleItem/ToggleItem.js +263 -264
- package/{build/ToggleItem → ToggleItem}/ToggleItem.module.css +0 -0
- package/ToggleItem/tests/ToggleItem-specs.js +87 -87
- package/Toggleable/Toggle.js +70 -43
- package/{build/Toggleable → Toggleable}/Toggleable.d.ts +0 -0
- package/Toggleable/Toggleable.js +219 -244
- package/Toggleable/tests/Toggleable-specs.js +416 -549
- package/Toggleable/useToggle.js +50 -24
- package/Touchable/ClickAllow.js +67 -49
- package/Touchable/Drag.js +199 -170
- package/Touchable/Flick.js +152 -122
- package/Touchable/Hold.js +259 -214
- package/{build/Touchable → Touchable}/Touchable.d.ts +0 -0
- package/Touchable/Touchable.js +643 -651
- package/Touchable/config.js +63 -44
- package/Touchable/state.js +31 -14
- package/Touchable/tests/Touchable-specs.js +462 -526
- package/{build/Transition → Transition}/Transition.d.ts +0 -0
- package/Transition/Transition.js +606 -553
- package/{build/Transition → Transition}/Transition.module.css +0 -0
- package/Transition/tests/Transition-specs.js +123 -138
- package/ViewManager/Arranger.js +82 -40
- package/ViewManager/TransitionGroup.js +502 -419
- package/ViewManager/View.js +383 -298
- package/{build/ViewManager → ViewManager}/ViewManager.d.ts +0 -0
- package/ViewManager/ViewManager.js +352 -296
- package/ViewManager/tests/View-specs.js +176 -275
- package/ViewManager/tests/ViewManager-specs.js +524 -471
- package/ViewManager/tests/test-utils.js +44 -23
- package/{build/VirtualList → VirtualList}/UiVirtualList.module.css +0 -0
- package/VirtualList/UiVirtualListBase.js +1381 -1171
- package/{build/VirtualList → VirtualList}/VirtualList.d.ts +0 -0
- package/VirtualList/VirtualList.js +541 -537
- package/{build/VirtualList → VirtualList}/VirtualList.module.css +0 -0
- package/VirtualList/VirtualListBase.js +37 -10
- package/VirtualList/VirtualListBasic.js +1468 -1241
- package/VirtualList/tests/VirtualList-specs.js +314 -345
- package/{build/index.d.ts → index.d.ts} +0 -0
- package/index.js +1 -0
- package/{build/internal → internal}/IdProvider/IdProvider.d.ts +0 -0
- package/internal/IdProvider/IdProvider.js +76 -54
- package/internal/IdProvider/Provider.js +67 -41
- package/internal/IdProvider/tests/useId-specs.js +64 -78
- package/internal/IdProvider/useId.js +27 -15
- package/{build/internal → internal}/Pure/Pure.d.ts +0 -0
- package/internal/Pure/Pure.js +98 -65
- package/{build/internal → internal}/localized-fonts/localized-fonts.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.js +179 -159
- package/{build/internal → internal}/selection/selection.d.ts +0 -0
- package/internal/selection/selection.js +49 -40
- package/internal/selection/tests/selection-specs.js +158 -253
- package/{build/internal → internal}/validators/validators.d.ts +0 -0
- package/internal/validators/validators.js +103 -55
- package/package.json +2 -2
- package/resolution/ResolutionDecorator.js +150 -97
- package/{build/resolution → resolution}/index.d.ts +0 -0
- package/resolution/index.js +39 -7
- package/resolution/resolution.js +232 -183
- package/resolution/tests/ResolutionDecorator-specs.js +42 -48
- package/resolution/tests/resolution-specs.js +90 -91
- package/useControlledState/tests/useControlledState-specs.js +100 -76
- package/{build/useControlledState → useControlledState}/useControlledState.d.ts +0 -0
- package/useControlledState/useControlledState.js +56 -38
- package/useScroll/ScrollAnimator.js +138 -112
- package/useScroll/Scrollbar.js +199 -175
- package/{build/useScroll → useScroll}/Scrollbar.module.css +0 -0
- package/useScroll/ScrollbarTrack.js +46 -28
- package/{build/useScroll → useScroll}/ScrollbarTrack.module.css +0 -0
- package/{build/useScroll → useScroll}/useScroll.d.ts +0 -0
- package/useScroll/useScroll.js +1714 -1627
- package/{build/useScroll → useScroll}/useScroll.module.css +0 -0
- package/useScroll/utilDOM.js +62 -55
- package/useScroll/utilEvent.js +33 -28
- package/BodyText/BodyText.module.less +0 -11
- package/Button/Button.module.less +0 -57
- package/FloatingLayer/Scrim.module.less +0 -8
- package/GridListImageItem/GridListImageItem.module.less +0 -33
- package/Heading/Heading.module.less +0 -20
- package/Icon/Icon.module.less +0 -38
- package/IconButton/IconButton.module.less +0 -18
- package/Image/Image.module.less +0 -21
- package/ImageItem/ImageItem.module.less +0 -29
- package/Item/Item.module.less +0 -14
- package/LabeledIcon/LabeledIcon.module.less +0 -45
- package/Layout/Layout.module.less +0 -84
- package/Marquee/Marquee.module.less +0 -49
- package/ProgressBar/ProgressBar.module.less +0 -114
- package/Scrollable/ScrollThumb.module.less +0 -46
- package/Scrollable/Scrollable.module.less +0 -42
- package/Scrollable/Scrollbar.module.less +0 -35
- package/Scroller/Scroller.module.less +0 -10
- package/Scroller/UiScroller.module.less +0 -10
- package/Slider/Slider.module.less +0 -20
- package/SlotItem/SlotItem.module.less +0 -19
- package/Spinner/Spinner.module.less +0 -52
- package/ToggleIcon/ToggleIcon.module.less +0 -14
- package/ToggleItem/ToggleItem.module.less +0 -9
- package/Transition/Transition.module.less +0 -179
- package/VirtualList/UiVirtualList.module.less +0 -31
- package/VirtualList/VirtualList.module.less +0 -39
- package/build/A11yDecorator/A11yDecorator.js +0 -129
- package/build/A11yDecorator/package.json +0 -3
- package/build/A11yDecorator/tests/A11yDecorator-specs.js +0 -90
- package/build/AnnounceDecorator/Announce.js +0 -172
- package/build/AnnounceDecorator/AnnounceDecorator.js +0 -121
- package/build/AnnounceDecorator/package.json +0 -3
- package/build/AnnounceDecorator/tests/Announce-specs.js +0 -29
- package/build/AnnounceDecorator/tests/AnnounceDecorator-specs.js +0 -34
- package/build/AnnounceDecorator/tests/useAnnounce-specs.js +0 -56
- package/build/AnnounceDecorator/useAnnounce.js +0 -61
- package/build/BodyText/BodyText.js +0 -139
- package/build/BodyText/package.json +0 -3
- package/build/BodyText/tests/BodyText-specs.js +0 -67
- package/build/Button/Button.js +0 -283
- package/build/Button/package.json +0 -3
- package/build/CHANGELOG.md +0 -1089
- package/build/Cancelable/Cancelable.js +0 -271
- package/build/Cancelable/cancelHandler.js +0 -79
- package/build/Cancelable/modalHandler.js +0 -68
- package/build/Cancelable/package.json +0 -3
- package/build/Cancelable/tests/Cancelable-specs.js +0 -289
- package/build/Changeable/Changeable.js +0 -172
- package/build/Changeable/package.json +0 -3
- package/build/Changeable/tests/Changeable-specs.js +0 -262
- package/build/ComponentOverride/ComponentOverride.js +0 -68
- package/build/ComponentOverride/package.json +0 -3
- package/build/FloatingLayer/FloatingLayer.js +0 -339
- package/build/FloatingLayer/FloatingLayerDecorator.js +0 -174
- package/build/FloatingLayer/Scrim.js +0 -199
- package/build/FloatingLayer/index.js +0 -49
- package/build/FloatingLayer/tests/FloatingLayer-specs.js +0 -29
- package/build/FloatingLayer/tests/Scrim-specs.js +0 -26
- package/build/FloatingLayer/useFloatingLayer.js +0 -53
- package/build/ForwardRef/ForwardRef.js +0 -68
- package/build/ForwardRef/package.json +0 -3
- package/build/GridListImageItem/GridListImageItem.js +0 -257
- package/build/GridListImageItem/package.json +0 -3
- package/build/Group/Group.js +0 -217
- package/build/Group/GroupItem.js +0 -109
- package/build/Group/package.json +0 -3
- package/build/Group/tests/Group-specs.js +0 -128
- package/build/Heading/Heading.js +0 -158
- package/build/Heading/package.json +0 -3
- package/build/Heading/tests/Heading-specs.js +0 -46
- package/build/Icon/Icon.js +0 -234
- package/build/Icon/package.json +0 -3
- package/build/Icon/tests/Icon-specs.js +0 -92
- package/build/IconButton/IconButton.js +0 -252
- package/build/IconButton/package.json +0 -3
- package/build/Image/Image.js +0 -219
- package/build/Image/package.json +0 -3
- package/build/Image/tests/Image-specs.js +0 -55
- package/build/ImageItem/ImageItem.js +0 -180
- package/build/ImageItem/package.json +0 -3
- package/build/ImageItem/tests/ImageItem-specs.js +0 -133
- package/build/Item/Item.js +0 -166
- package/build/Item/package.json +0 -3
- package/build/Item/tests/Item-specs.js +0 -77
- package/build/LabeledIcon/LabeledIcon.js +0 -287
- package/build/LabeledIcon/package.json +0 -3
- package/build/LabeledIcon/tests/LabeledIcon-specs.js +0 -49
- package/build/Layout/Cell.js +0 -215
- package/build/Layout/Layout.js +0 -316
- package/build/Layout/package.json +0 -3
- package/build/Layout/tests/Layout-specs.js +0 -102
- package/build/Marquee/MarqueeBase.js +0 -307
- package/build/Marquee/MarqueeController.js +0 -346
- package/build/Marquee/MarqueeDecorator.js +0 -1029
- package/build/Marquee/index.js +0 -65
- package/build/Marquee/package.json +0 -3
- package/build/Marquee/tests/Marquee-specs.js +0 -275
- package/build/Measurable/Measurable.js +0 -163
- package/build/Measurable/package.json +0 -3
- package/build/Media/Media.js +0 -389
- package/build/Media/package.json +0 -3
- package/build/Placeholder/PlaceholderControllerDecorator.js +0 -210
- package/build/Placeholder/PlaceholderDecorator.js +0 -171
- package/build/Placeholder/index.js +0 -37
- package/build/Placeholder/package.json +0 -3
- package/build/ProgressBar/ProgressBar.js +0 -200
- package/build/ProgressBar/package.json +0 -3
- package/build/ProgressBar/tests/ProgressBar-specs.js +0 -80
- package/build/README.md +0 -45
- package/build/RadioDecorator/RadioControllerDecorator.js +0 -117
- package/build/RadioDecorator/RadioDecorator.js +0 -199
- package/build/RadioDecorator/package.json +0 -3
- package/build/RadioDecorator/tests/RadioDecorator-specs.js +0 -155
- package/build/Repeater/Repeater.js +0 -190
- package/build/Repeater/package.json +0 -3
- package/build/Repeater/tests/Repeater-specs.js +0 -141
- package/build/Resizable/Resizable.js +0 -179
- package/build/Resizable/package.json +0 -3
- package/build/Routable/Link.js +0 -78
- package/build/Routable/Routable.js +0 -170
- package/build/Routable/Route.js +0 -68
- package/build/Routable/Router.js +0 -248
- package/build/Routable/package.json +0 -3
- package/build/Routable/tests/Router-specs.js +0 -200
- package/build/Routable/util.js +0 -90
- package/build/Scrollable/ScrollAnimator.js +0 -146
- package/build/Scrollable/ScrollThumb.js +0 -63
- package/build/Scrollable/Scrollable.js +0 -1612
- package/build/Scrollable/ScrollableNative.js +0 -1619
- package/build/Scrollable/Scrollbar.js +0 -344
- package/build/Scrollable/package.json +0 -3
- package/build/Scroller/Scroller.js +0 -291
- package/build/Scroller/ScrollerBasic.js +0 -322
- package/build/Scroller/UiScrollerBase.js +0 -414
- package/build/Scroller/package.json +0 -3
- package/build/Skinnable/Skinnable.js +0 -224
- package/build/Skinnable/package.json +0 -3
- package/build/Skinnable/tests/Skinnable-specs.js +0 -388
- package/build/Skinnable/tests/useSkins-specs.js +0 -290
- package/build/Skinnable/tests/util-specs.js +0 -120
- package/build/Skinnable/useSkins.js +0 -134
- package/build/Skinnable/util.js +0 -106
- package/build/Slider/Knob.js +0 -100
- package/build/Slider/PositionDecorator.js +0 -234
- package/build/Slider/Slider.js +0 -380
- package/build/Slider/package.json +0 -3
- package/build/Slider/utils.js +0 -18
- package/build/SlotItem/SlotItem.js +0 -245
- package/build/SlotItem/package.json +0 -3
- package/build/Slottable/Slottable.js +0 -95
- package/build/Slottable/package.json +0 -3
- package/build/Slottable/tests/Slottable-specs.js +0 -238
- package/build/Slottable/tests/useSlots-specs.js +0 -282
- package/build/Slottable/useSlots.js +0 -183
- package/build/Spinner/Spinner.js +0 -247
- package/build/Spinner/package.json +0 -3
- package/build/Spinner/tests/Spinner-specs.js +0 -61
- package/build/ToggleIcon/ToggleIcon.js +0 -181
- package/build/ToggleIcon/package.json +0 -3
- package/build/ToggleIcon/tests/ToggleIcon-specs.js +0 -58
- package/build/ToggleItem/ToggleItem.js +0 -306
- package/build/ToggleItem/package.json +0 -3
- package/build/ToggleItem/tests/ToggleItem-specs.js +0 -100
- package/build/Toggleable/Toggle.js +0 -74
- package/build/Toggleable/Toggleable.js +0 -250
- package/build/Toggleable/package.json +0 -3
- package/build/Toggleable/tests/Toggleable-specs.js +0 -421
- package/build/Toggleable/useToggle.js +0 -91
- package/build/Touchable/ClickAllow.js +0 -78
- package/build/Touchable/Drag.js +0 -206
- package/build/Touchable/Flick.js +0 -156
- package/build/Touchable/Hold.js +0 -262
- package/build/Touchable/Touchable.js +0 -661
- package/build/Touchable/config.js +0 -147
- package/build/Touchable/package.json +0 -3
- package/build/Touchable/state.js +0 -36
- package/build/Touchable/tests/Touchable-specs.js +0 -470
- package/build/Transition/Transition.js +0 -634
- package/build/Transition/package.json +0 -3
- package/build/Transition/tests/Transition-specs.js +0 -123
- package/build/ViewManager/Arranger.js +0 -181
- package/build/ViewManager/TransitionGroup.js +0 -547
- package/build/ViewManager/View.js +0 -403
- package/build/ViewManager/ViewManager.js +0 -386
- package/build/ViewManager/package.json +0 -3
- package/build/ViewManager/tests/View-specs.js +0 -182
- package/build/ViewManager/tests/ViewManager-specs.js +0 -524
- package/build/ViewManager/tests/test-utils.js +0 -47
- package/build/VirtualList/UiVirtualListBase.js +0 -1566
- package/build/VirtualList/VirtualList.js +0 -582
- package/build/VirtualList/VirtualListBase.js +0 -37
- package/build/VirtualList/VirtualListBasic.js +0 -1503
- package/build/VirtualList/package.json +0 -3
- package/build/VirtualList/tests/VirtualList-specs.js +0 -314
- package/build/index.js +0 -2
- package/build/internal/IdProvider/IdProvider.js +0 -99
- package/build/internal/IdProvider/Provider.js +0 -67
- package/build/internal/IdProvider/package.json +0 -3
- package/build/internal/IdProvider/tests/useId-specs.js +0 -64
- package/build/internal/IdProvider/useId.js +0 -58
- package/build/internal/Pure/Pure.js +0 -133
- package/build/internal/Pure/package.json +0 -3
- package/build/internal/localized-fonts/localized-fonts.js +0 -272
- package/build/internal/localized-fonts/package.json +0 -3
- package/build/internal/selection/package.json +0 -3
- package/build/internal/selection/selection.js +0 -78
- package/build/internal/selection/tests/selection-specs.js +0 -158
- package/build/internal/validators/package.json +0 -4
- package/build/internal/validators/validators.js +0 -163
- package/build/package-lock.json +0 -234
- package/build/package.json +0 -39
- package/build/resolution/ResolutionDecorator.js +0 -183
- package/build/resolution/index.js +0 -47
- package/build/resolution/package.json +0 -3
- package/build/resolution/resolution.js +0 -529
- package/build/resolution/tests/ResolutionDecorator-specs.js +0 -42
- package/build/resolution/tests/resolution-specs.js +0 -90
- package/build/styles/core.less +0 -91
- package/build/styles/mixins.less +0 -444
- package/build/styles/variables.less +0 -7
- package/build/useControlledState/package.json +0 -3
- package/build/useControlledState/tests/useControlledState-specs.js +0 -100
- package/build/useControlledState/useControlledState.js +0 -68
- package/build/useScroll/ScrollAnimator.js +0 -146
- package/build/useScroll/Scrollbar.js +0 -238
- package/build/useScroll/ScrollbarTrack.js +0 -62
- package/build/useScroll/package.json +0 -3
- package/build/useScroll/useScroll.js +0 -1730
- package/build/useScroll/utilDOM.js +0 -65
- package/build/useScroll/utilEvent.js +0 -39
- package/useScroll/Scrollbar.module.less +0 -37
- package/useScroll/ScrollbarTrack.module.less +0 -48
- package/useScroll/useScroll.module.less +0 -44
|
@@ -1,1730 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useScrollBase = exports.useScroll = exports.constants = exports.assignPropertiesOf = exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
|
-
var _handle = require("@enact/core/handle");
|
|
11
|
-
|
|
12
|
-
var _keymap = require("@enact/core/keymap");
|
|
13
|
-
|
|
14
|
-
var _platform = require("@enact/core/platform");
|
|
15
|
-
|
|
16
|
-
var _Registry = _interopRequireDefault(require("@enact/core/internal/Registry"));
|
|
17
|
-
|
|
18
|
-
var _util = require("@enact/core/util");
|
|
19
|
-
|
|
20
|
-
var _clamp = _interopRequireDefault(require("ramda/src/clamp"));
|
|
21
|
-
|
|
22
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
|
|
24
|
-
var _warning = _interopRequireDefault(require("warning"));
|
|
25
|
-
|
|
26
|
-
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
27
|
-
|
|
28
|
-
var _Resizable = require("../Resizable");
|
|
29
|
-
|
|
30
|
-
var _resolution = _interopRequireDefault(require("../resolution"));
|
|
31
|
-
|
|
32
|
-
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
33
|
-
|
|
34
|
-
var _ScrollAnimator = _interopRequireDefault(require("./ScrollAnimator"));
|
|
35
|
-
|
|
36
|
-
var _utilDOM = _interopRequireDefault(require("./utilDOM"));
|
|
37
|
-
|
|
38
|
-
var _utilEvent = _interopRequireDefault(require("./utilEvent"));
|
|
39
|
-
|
|
40
|
-
var _useScrollModule = _interopRequireDefault(require("./useScroll.module.css"));
|
|
41
|
-
|
|
42
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
43
|
-
|
|
44
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
-
|
|
46
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
47
|
-
|
|
48
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
49
|
-
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
51
|
-
|
|
52
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
-
|
|
54
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
55
|
-
|
|
56
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
57
|
-
|
|
58
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
59
|
-
|
|
60
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
61
|
-
|
|
62
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
63
|
-
|
|
64
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
65
|
-
|
|
66
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
67
|
-
|
|
68
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
69
|
-
|
|
70
|
-
var constants = {
|
|
71
|
-
animationDuration: 1000,
|
|
72
|
-
epsilon: 1,
|
|
73
|
-
flickConfig: {
|
|
74
|
-
maxDuration: null
|
|
75
|
-
},
|
|
76
|
-
isPageDown: (0, _keymap.is)('pageDown'),
|
|
77
|
-
isPageUp: (0, _keymap.is)('pageUp'),
|
|
78
|
-
nop: function nop() {},
|
|
79
|
-
overscrollTypeNone: 0,
|
|
80
|
-
overscrollTypeHold: 1,
|
|
81
|
-
overscrollTypeOnce: 2,
|
|
82
|
-
overscrollTypeDone: 9,
|
|
83
|
-
overscrollVelocityFactor: 300,
|
|
84
|
-
// scrollMode 'native'
|
|
85
|
-
paginationPageMultiplier: 0.66,
|
|
86
|
-
scrollStopWaiting: 200,
|
|
87
|
-
scrollWheelPageMultiplierForMaxPixel: 0.2 // The ratio of the maximum distance scrolled by wheel to the size of the viewport.
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
animationDuration = constants.animationDuration,
|
|
91
|
-
epsilon = constants.epsilon,
|
|
92
|
-
flickConfig = constants.flickConfig,
|
|
93
|
-
isPageDown = constants.isPageDown,
|
|
94
|
-
isPageUp = constants.isPageUp,
|
|
95
|
-
overscrollTypeDone = constants.overscrollTypeDone,
|
|
96
|
-
overscrollTypeHold = constants.overscrollTypeHold,
|
|
97
|
-
overscrollTypeNone = constants.overscrollTypeNone,
|
|
98
|
-
overscrollTypeOnce = constants.overscrollTypeOnce,
|
|
99
|
-
overscrollVelocityFactor = constants.overscrollVelocityFactor,
|
|
100
|
-
paginationPageMultiplier = constants.paginationPageMultiplier,
|
|
101
|
-
scrollStopWaiting = constants.scrollStopWaiting,
|
|
102
|
-
scrollWheelPageMultiplierForMaxPixel = constants.scrollWheelPageMultiplierForMaxPixel;
|
|
103
|
-
exports.constants = constants;
|
|
104
|
-
var TouchableDiv = (0, _ForwardRef["default"])({
|
|
105
|
-
prop: 'componentRef'
|
|
106
|
-
}, (0, _Touchable["default"])(function (_ref) {
|
|
107
|
-
var componentRef = _ref.componentRef,
|
|
108
|
-
rest = _objectWithoutProperties(_ref, ["componentRef"]);
|
|
109
|
-
|
|
110
|
-
return /*#__PURE__*/_react["default"].createElement("div", Object.assign({}, rest, {
|
|
111
|
-
ref: componentRef
|
|
112
|
-
}));
|
|
113
|
-
}));
|
|
114
|
-
|
|
115
|
-
var useForceUpdate = function useForceUpdate() {
|
|
116
|
-
return (0, _react.useReducer)(function (x) {
|
|
117
|
-
return x + 1;
|
|
118
|
-
}, 0);
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* A custom hook that passes scrollable behavior information as its render prop.
|
|
122
|
-
*
|
|
123
|
-
* @class
|
|
124
|
-
* @memberof ui/useScroll
|
|
125
|
-
* @ui
|
|
126
|
-
* @private
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var useScrollBase = function useScrollBase(props) {
|
|
131
|
-
var childProps = props.childProps,
|
|
132
|
-
children = props.children,
|
|
133
|
-
className = props.className,
|
|
134
|
-
clientSize = props.clientSize,
|
|
135
|
-
voiceDisabled = props['data-webos-voice-disabled'],
|
|
136
|
-
voiceFocused = props['data-webos-voice-focused'],
|
|
137
|
-
voiceGroupLabel = props['data-webos-voice-group-label'],
|
|
138
|
-
assignProperties = props.assignProperties,
|
|
139
|
-
dataSize = props.dataSize,
|
|
140
|
-
direction = props.direction,
|
|
141
|
-
horizontalScrollbar = props.horizontalScrollbar,
|
|
142
|
-
horizontalScrollbarHandle = props.horizontalScrollbarHandle,
|
|
143
|
-
itemRenderer = props.itemRenderer,
|
|
144
|
-
itemSize = props.itemSize,
|
|
145
|
-
itemSizes = props.itemSizes,
|
|
146
|
-
noScrollByDrag = props.noScrollByDrag,
|
|
147
|
-
noScrollByWheel = props.noScrollByWheel,
|
|
148
|
-
overhang = props.overhang,
|
|
149
|
-
overscrollEffectOn = props.overscrollEffectOn,
|
|
150
|
-
pageScroll = props.pageScroll,
|
|
151
|
-
role = props.role,
|
|
152
|
-
rtl = props.rtl,
|
|
153
|
-
scrollContainerRef = props.scrollContainerRef,
|
|
154
|
-
scrollContentHandle = props.scrollContentHandle,
|
|
155
|
-
scrollContentRef = props.scrollContentRef,
|
|
156
|
-
scrollMode = props.scrollMode,
|
|
157
|
-
setScrollContainerHandle = props.setScrollContainerHandle,
|
|
158
|
-
spacing = props.spacing,
|
|
159
|
-
spotlightContainerDisabled = props.spotlightContainerDisabled,
|
|
160
|
-
verticalScrollbar = props.verticalScrollbar,
|
|
161
|
-
verticalScrollbarHandle = props.verticalScrollbarHandle,
|
|
162
|
-
wrap = props.wrap,
|
|
163
|
-
rest = _objectWithoutProperties(props, ["childProps", "children", "className", "clientSize", "data-webos-voice-disabled", "data-webos-voice-focused", "data-webos-voice-group-label", "assignProperties", "dataSize", "direction", "horizontalScrollbar", "horizontalScrollbarHandle", "itemRenderer", "itemSize", "itemSizes", "noScrollByDrag", "noScrollByWheel", "overhang", "overscrollEffectOn", "pageScroll", "role", "rtl", "scrollContainerRef", "scrollContentHandle", "scrollContentRef", "scrollMode", "setScrollContainerHandle", "spacing", "spotlightContainerDisabled", "verticalScrollbar", "verticalScrollbarHandle", "wrap"]),
|
|
164
|
-
scrollClasses = (0, _classnames["default"])(_useScrollModule["default"].scroll, className); // The following props are the one having the same naming function in this scope.
|
|
165
|
-
// So it is better to use props[propName]
|
|
166
|
-
// instead of extracting it from the `props` and renaming it
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
delete rest.addEventListeners;
|
|
170
|
-
delete rest.applyOverscrollEffect;
|
|
171
|
-
delete rest.cbScrollTo;
|
|
172
|
-
delete rest.clearOverscrollEffect;
|
|
173
|
-
delete rest.handleResizeWindow;
|
|
174
|
-
delete rest.onFlick;
|
|
175
|
-
delete rest.onKeyDown;
|
|
176
|
-
delete rest.onMouseDown;
|
|
177
|
-
delete rest.onScroll;
|
|
178
|
-
delete rest.onScrollStart;
|
|
179
|
-
delete rest.onScrollStop;
|
|
180
|
-
delete rest.onWheel;
|
|
181
|
-
delete rest.removeEventListeners;
|
|
182
|
-
delete rest.scrollStopOnScroll; // scrollMode 'native'
|
|
183
|
-
|
|
184
|
-
delete rest.scrollTo;
|
|
185
|
-
delete rest.start; // scrollMode 'native'
|
|
186
|
-
|
|
187
|
-
delete rest.stop; // scrollMode 'translate'
|
|
188
|
-
// Mutable value and Hooks
|
|
189
|
-
|
|
190
|
-
var _useForceUpdate = useForceUpdate(),
|
|
191
|
-
_useForceUpdate2 = _slicedToArray(_useForceUpdate, 2),
|
|
192
|
-
forceUpdate = _useForceUpdate2[1];
|
|
193
|
-
|
|
194
|
-
var context = (0, _react.useContext)(_Resizable.ResizeContext);
|
|
195
|
-
|
|
196
|
-
var _useState = (0, _react.useState)(horizontalScrollbar === 'visible'),
|
|
197
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
198
|
-
isHorizontalScrollbarVisible = _useState2[0],
|
|
199
|
-
setIsHorizontalScrollbarVisible = _useState2[1];
|
|
200
|
-
|
|
201
|
-
var _useState3 = (0, _react.useState)(verticalScrollbar === 'visible'),
|
|
202
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
203
|
-
isVerticalScrollbarVisible = _useState4[0],
|
|
204
|
-
setIsVerticalScrollbarVisible = _useState4[1];
|
|
205
|
-
|
|
206
|
-
var mutableRef = (0, _react.useRef)({
|
|
207
|
-
overscrollEnabled: !!props.applyOverscrollEffect,
|
|
208
|
-
// Enable the early bail out of repeated scrolling to the same position
|
|
209
|
-
animationInfo: null,
|
|
210
|
-
resizeRegistry: null,
|
|
211
|
-
// constants
|
|
212
|
-
pixelPerLine: 39,
|
|
213
|
-
scrollWheelMultiplierForDeltaPixel: 1.5,
|
|
214
|
-
// The ratio of wheel 'delta' units to pixels scrolled.
|
|
215
|
-
// status
|
|
216
|
-
deferScrollTo: true,
|
|
217
|
-
isScrollAnimationTargetAccumulated: false,
|
|
218
|
-
// overscroll
|
|
219
|
-
lastInputType: null,
|
|
220
|
-
overscrollStatus: {
|
|
221
|
-
horizontal: {
|
|
222
|
-
before: {
|
|
223
|
-
type: overscrollTypeNone,
|
|
224
|
-
ratio: 0
|
|
225
|
-
},
|
|
226
|
-
after: {
|
|
227
|
-
type: overscrollTypeNone,
|
|
228
|
-
ratio: 0
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
vertical: {
|
|
232
|
-
before: {
|
|
233
|
-
type: overscrollTypeNone,
|
|
234
|
-
ratio: 0
|
|
235
|
-
},
|
|
236
|
-
after: {
|
|
237
|
-
type: overscrollTypeNone,
|
|
238
|
-
ratio: 0
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
// bounds info
|
|
243
|
-
bounds: {
|
|
244
|
-
clientWidth: 0,
|
|
245
|
-
clientHeight: 0,
|
|
246
|
-
scrollWidth: 0,
|
|
247
|
-
scrollHeight: 0,
|
|
248
|
-
maxTop: 0,
|
|
249
|
-
maxLeft: 0
|
|
250
|
-
},
|
|
251
|
-
// wheel/drag/flick info
|
|
252
|
-
wheelDirection: 0,
|
|
253
|
-
isDragging: false,
|
|
254
|
-
isTouching: false,
|
|
255
|
-
// scrollMode 'native'
|
|
256
|
-
// scroll info
|
|
257
|
-
scrolling: false,
|
|
258
|
-
scrollLeft: 0,
|
|
259
|
-
scrollTop: 0,
|
|
260
|
-
scrollToInfo: null,
|
|
261
|
-
// scroll animator
|
|
262
|
-
animator: null,
|
|
263
|
-
// non-declared-variable.
|
|
264
|
-
accumulatedTargetX: null,
|
|
265
|
-
accumulatedTargetY: null,
|
|
266
|
-
flickTarget: null,
|
|
267
|
-
dragStartX: null,
|
|
268
|
-
dragStartY: null,
|
|
269
|
-
scrollStopJob: null,
|
|
270
|
-
prevState: {
|
|
271
|
-
isHorizontalScrollbarVisible: isHorizontalScrollbarVisible,
|
|
272
|
-
isVerticalScrollbarVisible: isVerticalScrollbarVisible
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
if (mutableRef.current.animator == null) {
|
|
277
|
-
mutableRef.current.animator = new _ScrollAnimator["default"]();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
(0, _react.useLayoutEffect)(function () {
|
|
281
|
-
if (setScrollContainerHandle) {
|
|
282
|
-
setScrollContainerHandle({
|
|
283
|
-
animator: mutableRef.current.animator,
|
|
284
|
-
applyOverscrollEffect: applyOverscrollEffect,
|
|
285
|
-
bounds: mutableRef.current.bounds,
|
|
286
|
-
calculateDistanceByWheel: calculateDistanceByWheel,
|
|
287
|
-
canScrollHorizontally: canScrollHorizontally,
|
|
288
|
-
canScrollVertically: canScrollVertically,
|
|
289
|
-
checkAndApplyOverscrollEffect: checkAndApplyOverscrollEffect,
|
|
290
|
-
getScrollBounds: getScrollBounds,
|
|
291
|
-
|
|
292
|
-
get isDragging() {
|
|
293
|
-
return mutableRef.current.isDragging;
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
set isDragging(val) {
|
|
297
|
-
mutableRef.current.isDragging = val;
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
get isScrollAnimationTargetAccumulated() {
|
|
301
|
-
return mutableRef.current.isScrollAnimationTargetAccumulated;
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
set isScrollAnimationTargetAccumulated(val) {
|
|
305
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = val;
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
get lastInputType() {
|
|
309
|
-
return mutableRef.current.lastInputType;
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
set lastInputType(val) {
|
|
313
|
-
mutableRef.current.lastInputType = val;
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
get rtl() {
|
|
317
|
-
return rtl;
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
get scrollBounds() {
|
|
321
|
-
return getScrollBounds();
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
get scrollHeight() {
|
|
325
|
-
return mutableRef.current.bounds.scrollHeight;
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
get scrolling() {
|
|
329
|
-
return mutableRef.current.scrolling;
|
|
330
|
-
},
|
|
331
|
-
|
|
332
|
-
get scrollLeft() {
|
|
333
|
-
return mutableRef.current.scrollLeft;
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
scrollTo: scrollTo,
|
|
337
|
-
scrollToAccumulatedTarget: scrollToAccumulatedTarget,
|
|
338
|
-
|
|
339
|
-
get scrollToInfo() {
|
|
340
|
-
return mutableRef.current.scrollToInfo;
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
get scrollTop() {
|
|
344
|
-
return mutableRef.current.scrollTop;
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
setOverscrollStatus: setOverscrollStatus,
|
|
348
|
-
showScrollbarTrack: showScrollbarTrack,
|
|
349
|
-
start: start,
|
|
350
|
-
startHidingScrollbarTrack: startHidingScrollbarTrack,
|
|
351
|
-
stop: stop,
|
|
352
|
-
|
|
353
|
-
get wheelDirection() {
|
|
354
|
-
return mutableRef.current.wheelDirection;
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
set wheelDirection(val) {
|
|
358
|
-
mutableRef.current.wheelDirection = val;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
(0, _react.useLayoutEffect)(function () {
|
|
365
|
-
if (props.cbScrollTo) {
|
|
366
|
-
props.cbScrollTo(scrollTo);
|
|
367
|
-
}
|
|
368
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
369
|
-
|
|
370
|
-
(0, _react.useLayoutEffect)(function () {
|
|
371
|
-
var containerRef = scrollContainerRef.current;
|
|
372
|
-
|
|
373
|
-
if (!containerRef) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (typeof ResizeObserver === 'function') {
|
|
378
|
-
var resizeObserver = new ResizeObserver(function () {
|
|
379
|
-
if (scrollContentHandle.current && scrollContentHandle.current.syncClientSize) {
|
|
380
|
-
scrollContentHandle.current.syncClientSize();
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
resizeObserver.observe(containerRef);
|
|
384
|
-
return function () {
|
|
385
|
-
if (resizeObserver) {
|
|
386
|
-
resizeObserver.disconnect();
|
|
387
|
-
resizeObserver = null;
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
392
|
-
|
|
393
|
-
(0, _react.useEffect)(function () {
|
|
394
|
-
mutableRef.current.resizeRegistry.parent = context; // componentWillUnmount
|
|
395
|
-
|
|
396
|
-
return function () {
|
|
397
|
-
var _mutableRef$current = mutableRef.current,
|
|
398
|
-
animator = _mutableRef$current.animator,
|
|
399
|
-
resizeRegistry = _mutableRef$current.resizeRegistry,
|
|
400
|
-
scrolling = _mutableRef$current.scrolling,
|
|
401
|
-
scrollStopJob = _mutableRef$current.scrollStopJob; // eslint-disable-line react-hooks/exhaustive-deps
|
|
402
|
-
|
|
403
|
-
resizeRegistry.parent = null; // Before call cancelAnimationFrame, you must send scrollStop Event.
|
|
404
|
-
|
|
405
|
-
if (scrolling) {
|
|
406
|
-
forwardScrollEvent('onScrollStop', getReachedEdgeInfo());
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
scrollStopJob.stop(); // scrollMode 'translate' [
|
|
410
|
-
|
|
411
|
-
if (animator.isAnimating()) {
|
|
412
|
-
animator.stop();
|
|
413
|
-
} // scrollMode 'translate' ]
|
|
414
|
-
|
|
415
|
-
};
|
|
416
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
417
|
-
|
|
418
|
-
(0, _react.useEffect)(function () {
|
|
419
|
-
addEventListeners();
|
|
420
|
-
return function () {
|
|
421
|
-
removeEventListeners();
|
|
422
|
-
};
|
|
423
|
-
}); // scrollMode 'translate' [[
|
|
424
|
-
// TODO: consider replacing forceUpdate() by storing bounds in state rather than a non-
|
|
425
|
-
// state member.
|
|
426
|
-
|
|
427
|
-
var enqueueForceUpdate = (0, _react.useCallback)(function () {
|
|
428
|
-
scrollContentHandle.current.calculateMetrics(scrollContentHandle.current.props);
|
|
429
|
-
forceUpdate();
|
|
430
|
-
}, [forceUpdate, scrollContentHandle]);
|
|
431
|
-
|
|
432
|
-
function handleResizeWindow() {
|
|
433
|
-
var propsHandleResizeWindow = props.handleResizeWindow; // `handleSize` in `ui/resolution.ResolutionDecorator` should be executed first.
|
|
434
|
-
|
|
435
|
-
setTimeout(function () {
|
|
436
|
-
if (propsHandleResizeWindow) {
|
|
437
|
-
propsHandleResizeWindow();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if (scrollMode === 'translate') {
|
|
441
|
-
scrollTo({
|
|
442
|
-
position: {
|
|
443
|
-
x: 0,
|
|
444
|
-
y: 0
|
|
445
|
-
},
|
|
446
|
-
animate: false
|
|
447
|
-
});
|
|
448
|
-
} else {
|
|
449
|
-
scrollContentRef.current.style.scrollBehavior = null;
|
|
450
|
-
scrollContentHandle.current.scrollToPosition(0, 0);
|
|
451
|
-
scrollContentRef.current.style.scrollBehavior = 'smooth';
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
enqueueForceUpdate();
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
var handleResize = (0, _react.useCallback)(function (ev) {
|
|
459
|
-
if (ev.action === 'invalidateBounds') {
|
|
460
|
-
enqueueForceUpdate();
|
|
461
|
-
}
|
|
462
|
-
}, [enqueueForceUpdate]); // scrollMode 'translate' ]]
|
|
463
|
-
|
|
464
|
-
if (mutableRef.current.resizeRegistry == null) {
|
|
465
|
-
mutableRef.current.resizeRegistry = _Registry["default"].create(handleResize);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
(0, _react.useEffect)(function () {
|
|
469
|
-
var ref = mutableRef.current;
|
|
470
|
-
|
|
471
|
-
if (scrollMode === 'translate') {
|
|
472
|
-
ref.scrollStopJob = new _util.Job(doScrollStop, scrollStopWaiting);
|
|
473
|
-
} else {
|
|
474
|
-
ref.scrollStopJob = new _util.Job(scrollStopOnScroll, scrollStopWaiting);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
return function () {
|
|
478
|
-
if (ref.scrolling) {
|
|
479
|
-
ref.scrollStopJob.run();
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
ref.scrollStopJob.stop();
|
|
483
|
-
};
|
|
484
|
-
}, [direction, isHorizontalScrollbarVisible, isVerticalScrollbarVisible, rtl, scrollMode, spotlightContainerDisabled]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
485
|
-
|
|
486
|
-
(0, _react.useEffect)(function () {
|
|
487
|
-
var hasDataSizeChanged = scrollContentHandle.current.hasDataSizeChanged,
|
|
488
|
-
_mutableRef$current2 = mutableRef.current,
|
|
489
|
-
prevState = _mutableRef$current2.prevState,
|
|
490
|
-
resizeRegistry = _mutableRef$current2.resizeRegistry,
|
|
491
|
-
scrollToInfo = _mutableRef$current2.scrollToInfo; // Need to sync calculated client size if it is different from the real size
|
|
492
|
-
|
|
493
|
-
if (scrollContentHandle.current.syncClientSize) {
|
|
494
|
-
// If we actually synced, we need to reset scroll position.
|
|
495
|
-
if (scrollContentHandle.current.syncClientSize()) {
|
|
496
|
-
setScrollLeft(0);
|
|
497
|
-
setScrollTop(0);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
clampScrollPosition(); // scrollMode 'translate'
|
|
502
|
-
|
|
503
|
-
if (hasDataSizeChanged === false && (isHorizontalScrollbarVisible && !prevState.isHorizontalScrollbarVisible || isVerticalScrollbarVisible && !prevState.isVerticalScrollbarVisible)) {
|
|
504
|
-
mutableRef.current.deferScrollTo = false;
|
|
505
|
-
updateScrollbarTrackSize();
|
|
506
|
-
} else {
|
|
507
|
-
updateScrollbars();
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (scrollToInfo !== null) {
|
|
511
|
-
if (!mutableRef.current.deferScrollTo) {
|
|
512
|
-
scrollTo(scrollToInfo);
|
|
513
|
-
}
|
|
514
|
-
} // publish container resize changes
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
var horizontal = isHorizontalScrollbarVisible !== prevState.isHorizontalScrollbarVisible;
|
|
518
|
-
var vertical = isVerticalScrollbarVisible !== prevState.isVerticalScrollbarVisible;
|
|
519
|
-
|
|
520
|
-
if (horizontal || vertical) {
|
|
521
|
-
resizeRegistry.notify({});
|
|
522
|
-
}
|
|
523
|
-
}); // scrollMode 'translate' [[
|
|
524
|
-
|
|
525
|
-
function clampScrollPosition() {
|
|
526
|
-
var bounds = getScrollBounds();
|
|
527
|
-
|
|
528
|
-
if (mutableRef.current.scrollTop > bounds.maxTop) {
|
|
529
|
-
mutableRef.current.scrollTop = bounds.maxTop;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if (mutableRef.current.scrollLeft > bounds.maxLeft) {
|
|
533
|
-
mutableRef.current.scrollLeft = bounds.maxLeft;
|
|
534
|
-
}
|
|
535
|
-
} // scrollMode 'translate' ]]
|
|
536
|
-
// drag/flick event handlers
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
function getRtlX(x) {
|
|
540
|
-
return rtl ? -x : x;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function onMouseDown(ev) {
|
|
544
|
-
if ((0, _handle.forwardWithPrevent)('onMouseDown', ev, props)) {
|
|
545
|
-
stop();
|
|
546
|
-
}
|
|
547
|
-
} // scrollMode 'native' [[
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
function onTouchStart() {
|
|
551
|
-
mutableRef.current.isTouching = true;
|
|
552
|
-
} // scrollMode 'native' ]]
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
function onDragStart(ev) {
|
|
556
|
-
if (scrollMode === 'translate') {
|
|
557
|
-
if (ev.type === 'dragstart') return;
|
|
558
|
-
(0, _handle.forward)('onDragStart', ev, props);
|
|
559
|
-
stop();
|
|
560
|
-
mutableRef.current.isDragging = true;
|
|
561
|
-
mutableRef.current.dragStartX = mutableRef.current.scrollLeft + getRtlX(ev.x);
|
|
562
|
-
mutableRef.current.dragStartY = mutableRef.current.scrollTop + ev.y;
|
|
563
|
-
} else {
|
|
564
|
-
if (!mutableRef.current.isTouching) {
|
|
565
|
-
stop();
|
|
566
|
-
mutableRef.current.isDragging = true;
|
|
567
|
-
} // these values are used also for touch inputs
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
mutableRef.current.dragStartX = mutableRef.current.scrollLeft + getRtlX(ev.x);
|
|
571
|
-
mutableRef.current.dragStartY = mutableRef.current.scrollTop + ev.y;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function onDrag(ev) {
|
|
576
|
-
if (scrollMode === 'translate') {
|
|
577
|
-
if (ev.type === 'drag') {
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
mutableRef.current.lastInputType = 'drag';
|
|
582
|
-
(0, _handle.forward)('onDrag', ev, props);
|
|
583
|
-
start({
|
|
584
|
-
targetX: direction === 'vertical' ? 0 : mutableRef.current.dragStartX - getRtlX(ev.x),
|
|
585
|
-
// 'horizontal' or 'both'
|
|
586
|
-
targetY: direction === 'horizontal' ? 0 : mutableRef.current.dragStartY - ev.y,
|
|
587
|
-
// 'vertical' or 'both'
|
|
588
|
-
animate: false,
|
|
589
|
-
overscrollEffect: overscrollEffectOn && overscrollEffectOn.drag
|
|
590
|
-
});
|
|
591
|
-
} else {
|
|
592
|
-
var targetX = direction === 'vertical' ? 0 : mutableRef.current.dragStartX - getRtlX(ev.x),
|
|
593
|
-
// 'horizontal' or 'both'
|
|
594
|
-
targetY = direction === 'horizontal' ? 0 : mutableRef.current.dragStartY - ev.y; // 'vertical' or 'both'
|
|
595
|
-
|
|
596
|
-
mutableRef.current.lastInputType = 'drag';
|
|
597
|
-
|
|
598
|
-
if (!mutableRef.current.isTouching) {
|
|
599
|
-
start({
|
|
600
|
-
targetX: targetX,
|
|
601
|
-
targetY: targetY,
|
|
602
|
-
animate: false,
|
|
603
|
-
overscrollEffect: overscrollEffectOn && overscrollEffectOn.drag
|
|
604
|
-
});
|
|
605
|
-
} else if (mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn.drag) {
|
|
606
|
-
checkAndApplyOverscrollEffectOnDrag(targetX, targetY, overscrollTypeHold);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
function onDragEnd(ev) {
|
|
612
|
-
if (scrollMode === 'translate') {
|
|
613
|
-
if (ev.type === 'dragend') {
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
mutableRef.current.isDragging = false;
|
|
618
|
-
(0, _handle.forward)('onDragEnd', ev, props);
|
|
619
|
-
|
|
620
|
-
if (mutableRef.current.flickTarget) {
|
|
621
|
-
var _mutableRef$current$f = mutableRef.current.flickTarget,
|
|
622
|
-
targetX = _mutableRef$current$f.targetX,
|
|
623
|
-
targetY = _mutableRef$current$f.targetY,
|
|
624
|
-
duration = _mutableRef$current$f.duration;
|
|
625
|
-
mutableRef.current.lastInputType = 'drag';
|
|
626
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
627
|
-
start({
|
|
628
|
-
targetX: targetX,
|
|
629
|
-
targetY: targetY,
|
|
630
|
-
duration: duration,
|
|
631
|
-
overscrollEffect: overscrollEffectOn && overscrollEffectOn.drag
|
|
632
|
-
});
|
|
633
|
-
} else {
|
|
634
|
-
stop();
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
if (mutableRef.current.overscrollEnabled) {
|
|
638
|
-
// not check overscrollEffectOn && overscrollEffectOn.drag for safety
|
|
639
|
-
clearAllOverscrollEffects();
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
mutableRef.current.flickTarget = null;
|
|
643
|
-
} else {
|
|
644
|
-
mutableRef.current.isDragging = false;
|
|
645
|
-
mutableRef.current.lastInputType = 'drag';
|
|
646
|
-
|
|
647
|
-
if (mutableRef.current.flickTarget) {
|
|
648
|
-
var _mutableRef$current$f2 = mutableRef.current.flickTarget,
|
|
649
|
-
_targetX = _mutableRef$current$f2.targetX,
|
|
650
|
-
_targetY = _mutableRef$current$f2.targetY;
|
|
651
|
-
|
|
652
|
-
if (!mutableRef.current.isTouching) {
|
|
653
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
654
|
-
start({
|
|
655
|
-
targetX: _targetX,
|
|
656
|
-
targetY: _targetY,
|
|
657
|
-
overscrollEffect: overscrollEffectOn && overscrollEffectOn.drag
|
|
658
|
-
});
|
|
659
|
-
} else if (mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn.drag) {
|
|
660
|
-
checkAndApplyOverscrollEffectOnDrag(_targetX, _targetY, overscrollTypeOnce);
|
|
661
|
-
}
|
|
662
|
-
} else if (!mutableRef.current.isTouching) {
|
|
663
|
-
stop();
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
if (mutableRef.current.overscrollEnabled) {
|
|
667
|
-
// not check overscrollEffectOn && overscrollEffectOn.drag for safety
|
|
668
|
-
clearAllOverscrollEffects();
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
mutableRef.current.isTouching = false;
|
|
672
|
-
mutableRef.current.flickTarget = null;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
function onFlick(ev) {
|
|
677
|
-
var isVerticalFlick = ev.direction === 'vertical';
|
|
678
|
-
|
|
679
|
-
if (scrollMode === 'translate' || !mutableRef.current.isTouching) {
|
|
680
|
-
// except touch input in 'native' mode
|
|
681
|
-
mutableRef.current.flickTarget = mutableRef.current.animator.simulate(mutableRef.current.scrollLeft, mutableRef.current.scrollTop, direction !== 'vertical' && !isVerticalFlick ? getRtlX(-ev.velocityX) : 0, direction !== 'horizontal' && isVerticalFlick ? -ev.velocityY : 0);
|
|
682
|
-
} else if (mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn.drag) {
|
|
683
|
-
// overscroll is required on touch input in 'native' mode
|
|
684
|
-
mutableRef.current.flickTarget = {
|
|
685
|
-
targetX: mutableRef.current.scrollLeft + (!isVerticalFlick ? getRtlX(-ev.velocityX) : 0) * overscrollVelocityFactor,
|
|
686
|
-
// 'horizontal' or 'both'
|
|
687
|
-
targetY: mutableRef.current.scrollTop + (isVerticalFlick ? -ev.velocityY : 0) * overscrollVelocityFactor // 'vertical' or 'both'
|
|
688
|
-
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
if (props.onFlick) {
|
|
693
|
-
(0, _handle.forward)('onFlick', ev, props);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
function calculateDistanceByWheel(deltaMode, delta, maxPixel) {
|
|
698
|
-
if (deltaMode === 0) {
|
|
699
|
-
delta = (0, _clamp["default"])(-maxPixel, maxPixel, _resolution["default"].scale(delta * mutableRef.current.scrollWheelMultiplierForDeltaPixel));
|
|
700
|
-
} else if (deltaMode === 1) {
|
|
701
|
-
// line; firefox
|
|
702
|
-
delta = (0, _clamp["default"])(-maxPixel, maxPixel, _resolution["default"].scale(delta * mutableRef.current.pixelPerLine * mutableRef.current.scrollWheelMultiplierForDeltaPixel));
|
|
703
|
-
} else if (deltaMode === 2) {
|
|
704
|
-
// page
|
|
705
|
-
delta = delta < 0 ? -maxPixel : maxPixel;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
return delta;
|
|
709
|
-
}
|
|
710
|
-
/*
|
|
711
|
-
* wheel event handler;
|
|
712
|
-
* - for horizontal scroll, supports wheel action on any children nodes since web engine cannot support this
|
|
713
|
-
* - for vertical scroll, supports wheel action on scrollbars only
|
|
714
|
-
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
function onWheel(ev) {
|
|
718
|
-
if (mutableRef.current.isDragging) {
|
|
719
|
-
ev.preventDefault();
|
|
720
|
-
ev.stopPropagation();
|
|
721
|
-
} else {
|
|
722
|
-
var bounds = getScrollBounds(),
|
|
723
|
-
canScrollH = canScrollHorizontally(bounds),
|
|
724
|
-
canScrollV = canScrollVertically(bounds),
|
|
725
|
-
eventDeltaMode = ev.deltaMode,
|
|
726
|
-
eventDelta = -ev.wheelDeltaY || ev.deltaY;
|
|
727
|
-
var delta = 0;
|
|
728
|
-
mutableRef.current.lastInputType = 'wheel';
|
|
729
|
-
|
|
730
|
-
if (noScrollByWheel) {
|
|
731
|
-
if (scrollMode === 'native' && canScrollV) {
|
|
732
|
-
ev.preventDefault();
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
if (scrollMode === 'translate') {
|
|
739
|
-
if (canScrollV) {
|
|
740
|
-
delta = calculateDistanceByWheel(eventDeltaMode, eventDelta, bounds.clientHeight * scrollWheelPageMultiplierForMaxPixel);
|
|
741
|
-
} else if (canScrollH) {
|
|
742
|
-
delta = calculateDistanceByWheel(eventDeltaMode, eventDelta, bounds.clientWidth * scrollWheelPageMultiplierForMaxPixel);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
var dir = Math.sign(delta);
|
|
746
|
-
|
|
747
|
-
if (dir !== mutableRef.current.wheelDirection) {
|
|
748
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
749
|
-
mutableRef.current.wheelDirection = dir;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
(0, _handle.forward)('onWheel', {
|
|
753
|
-
delta: delta,
|
|
754
|
-
horizontalScrollbarHandle: horizontalScrollbarHandle,
|
|
755
|
-
verticalScrollbarHandle: verticalScrollbarHandle
|
|
756
|
-
}, props);
|
|
757
|
-
|
|
758
|
-
if (delta !== 0) {
|
|
759
|
-
scrollToAccumulatedTarget(delta, canScrollV, overscrollEffectOn && overscrollEffectOn.wheel);
|
|
760
|
-
ev.preventDefault();
|
|
761
|
-
ev.stopPropagation();
|
|
762
|
-
}
|
|
763
|
-
} else {
|
|
764
|
-
// scrollMode 'native'
|
|
765
|
-
var overscrollEffectRequired = mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn.wheel;
|
|
766
|
-
var needToHideScrollbarTrack = false;
|
|
767
|
-
|
|
768
|
-
if (props.onWheel) {
|
|
769
|
-
(0, _handle.forward)('onWheel', ev, props);
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
showScrollbarTrack(bounds); // FIXME This routine is a temporary support for horizontal wheel scroll.
|
|
774
|
-
// FIXME If web engine supports horizontal wheel, this routine should be refined or removed.
|
|
775
|
-
|
|
776
|
-
if (canScrollV) {
|
|
777
|
-
// This routine handles wheel events on scrollbars for vertical scroll.
|
|
778
|
-
if (eventDelta < 0 && mutableRef.current.scrollTop > 0 || eventDelta > 0 && mutableRef.current.scrollTop < bounds.maxTop) {
|
|
779
|
-
// Not to check if ev.target is a descendant of a wrapped component which may have a lot of nodes in it.
|
|
780
|
-
if (horizontalScrollbarHandle.current && horizontalScrollbarHandle.current.getContainerRef && _utilDOM["default"].containsDangerously(horizontalScrollbarHandle.current.getContainerRef(), ev.target) || verticalScrollbarHandle.current && verticalScrollbarHandle.current.getContainerRef && _utilDOM["default"].containsDangerously(verticalScrollbarHandle.current.getContainerRef(), ev.target)) {
|
|
781
|
-
delta = calculateDistanceByWheel(eventDeltaMode, eventDelta, bounds.clientHeight * scrollWheelPageMultiplierForMaxPixel);
|
|
782
|
-
needToHideScrollbarTrack = !delta;
|
|
783
|
-
ev.preventDefault();
|
|
784
|
-
} else if (overscrollEffectRequired) {
|
|
785
|
-
checkAndApplyOverscrollEffect('vertical', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
ev.stopPropagation();
|
|
789
|
-
} else {
|
|
790
|
-
if (overscrollEffectRequired && (eventDelta < 0 && mutableRef.current.scrollTop <= 0 || eventDelta > 0 && mutableRef.current.scrollTop >= bounds.maxTop)) {
|
|
791
|
-
applyOverscrollEffect('vertical', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce, 1);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
needToHideScrollbarTrack = true;
|
|
795
|
-
}
|
|
796
|
-
} else if (canScrollH) {
|
|
797
|
-
// this routine handles wheel events on any children for horizontal scroll.
|
|
798
|
-
if (eventDelta < 0 && mutableRef.current.scrollLeft > 0 || eventDelta > 0 && mutableRef.current.scrollLeft < bounds.maxLeft) {
|
|
799
|
-
delta = calculateDistanceByWheel(eventDeltaMode, eventDelta, bounds.clientWidth * scrollWheelPageMultiplierForMaxPixel);
|
|
800
|
-
needToHideScrollbarTrack = !delta;
|
|
801
|
-
ev.preventDefault();
|
|
802
|
-
ev.stopPropagation();
|
|
803
|
-
} else {
|
|
804
|
-
if (overscrollEffectRequired && (eventDelta < 0 && mutableRef.current.scrollLeft <= 0 || eventDelta > 0 && mutableRef.current.scrollLeft >= bounds.maxLeft)) {
|
|
805
|
-
applyOverscrollEffect('horizontal', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce, 1);
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
needToHideScrollbarTrack = true;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
if (delta !== 0) {
|
|
813
|
-
var _dir = Math.sign(delta); // Not to accumulate scroll position if wheel direction is different from hold direction
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
if (_dir !== mutableRef.current.wheelDirection) {
|
|
817
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
818
|
-
mutableRef.current.wheelDirection = _dir;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
scrollToAccumulatedTarget(delta, canScrollV, overscrollEffectOn && overscrollEffectOn.wheel);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
if (needToHideScrollbarTrack) {
|
|
825
|
-
startHidingScrollbarTrack();
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
} // scrollMode 'translate' [[
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
function scrollByPage(keyCode) {
|
|
833
|
-
var bounds = getScrollBounds(),
|
|
834
|
-
canScrollV = canScrollVertically(bounds),
|
|
835
|
-
pageDistance = (isPageUp(keyCode) ? -1 : 1) * (canScrollV ? bounds.clientHeight : bounds.clientWidth) * paginationPageMultiplier;
|
|
836
|
-
mutableRef.current.lastInputType = 'pageKey';
|
|
837
|
-
scrollToAccumulatedTarget(pageDistance, canScrollV, overscrollEffectOn && overscrollEffectOn.pageKey);
|
|
838
|
-
} // scrollMode 'translate' ]]
|
|
839
|
-
// scrollMode 'native' [[
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
function onScroll(ev) {
|
|
843
|
-
var _ev$target = ev.target,
|
|
844
|
-
scrollLeft = _ev$target.scrollLeft,
|
|
845
|
-
scrollTop = _ev$target.scrollTop;
|
|
846
|
-
var bounds = getScrollBounds(),
|
|
847
|
-
canScrollH = canScrollHorizontally(bounds);
|
|
848
|
-
|
|
849
|
-
if (!mutableRef.current.scrolling) {
|
|
850
|
-
scrollStartOnScroll();
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
if (rtl && canScrollH) {
|
|
854
|
-
scrollLeft = _platform.platform.ios || _platform.platform.safari ? -scrollLeft : bounds.maxLeft - scrollLeft;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
if (scrollLeft !== mutableRef.current.scrollLeft) {
|
|
858
|
-
setScrollLeft(scrollLeft);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
if (scrollTop !== mutableRef.current.scrollTop) {
|
|
862
|
-
setScrollTop(scrollTop);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
if (scrollContentHandle.current.didScroll) {
|
|
866
|
-
scrollContentHandle.current.didScroll(mutableRef.current.scrollLeft, mutableRef.current.scrollTop);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
forwardScrollEvent('onScroll');
|
|
870
|
-
mutableRef.current.scrollStopJob.start();
|
|
871
|
-
} // scrollMode 'native' ]]
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
function onKeyDown(ev) {
|
|
875
|
-
if (scrollMode === 'translate') {
|
|
876
|
-
if (props.onKeyDown) {
|
|
877
|
-
(0, _handle.forward)('onKeyDown', ev, props);
|
|
878
|
-
} else if (isPageUp(ev.keyCode) || isPageDown(ev.keyCode)) {
|
|
879
|
-
scrollByPage(ev.keyCode);
|
|
880
|
-
}
|
|
881
|
-
} else {
|
|
882
|
-
(0, _handle.forward)('onKeyDown', ev, props);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
function scrollToAccumulatedTarget(delta, vertical, overscrollEffect) {
|
|
887
|
-
if (!mutableRef.current.isScrollAnimationTargetAccumulated) {
|
|
888
|
-
mutableRef.current.accumulatedTargetX = mutableRef.current.scrollLeft;
|
|
889
|
-
mutableRef.current.accumulatedTargetY = mutableRef.current.scrollTop;
|
|
890
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = true;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
if (vertical) {
|
|
894
|
-
mutableRef.current.accumulatedTargetY += delta;
|
|
895
|
-
} else {
|
|
896
|
-
mutableRef.current.accumulatedTargetX += delta;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
start({
|
|
900
|
-
targetX: mutableRef.current.accumulatedTargetX,
|
|
901
|
-
targetY: mutableRef.current.accumulatedTargetY,
|
|
902
|
-
overscrollEffect: overscrollEffect
|
|
903
|
-
});
|
|
904
|
-
} // overscroll effect
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
function getEdgeFromPosition(position, maxPosition) {
|
|
908
|
-
if (position <= 0) {
|
|
909
|
-
return 'before';
|
|
910
|
-
/* If a scroll size or a client size is not integer,
|
|
911
|
-
browser's max scroll position could be smaller than maxPos by 1 pixel.*/
|
|
912
|
-
} else if (scrollMode === 'translate' && position >= maxPosition || scrollMode === 'native' && position >= maxPosition - 1) {
|
|
913
|
-
return 'after';
|
|
914
|
-
} else {
|
|
915
|
-
return null;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
function setOverscrollStatus(orientation, edge, overscrollEffectType, ratio) {
|
|
920
|
-
var status = mutableRef.current.overscrollStatus[orientation][edge];
|
|
921
|
-
status.type = overscrollEffectType;
|
|
922
|
-
status.ratio = ratio;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
function getOverscrollStatus(orientation, edge) {
|
|
926
|
-
return mutableRef.current.overscrollStatus[orientation][edge];
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function calculateOverscrollRatio(orientation, position) {
|
|
930
|
-
var bounds = getScrollBounds(),
|
|
931
|
-
isVertical = orientation === 'vertical',
|
|
932
|
-
baseSize = isVertical ? bounds.clientHeight : bounds.clientWidth,
|
|
933
|
-
maxPos = bounds[isVertical ? 'maxTop' : 'maxLeft'];
|
|
934
|
-
var overDistance = 0;
|
|
935
|
-
|
|
936
|
-
if (position < 0) {
|
|
937
|
-
overDistance = -position;
|
|
938
|
-
} else if (position > maxPos) {
|
|
939
|
-
overDistance = position - maxPos;
|
|
940
|
-
} else {
|
|
941
|
-
return 0;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
return Math.min(1, 2 * overDistance / baseSize);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
function applyOverscrollEffect(orientation, edge, overscrollEffectType, ratio) {
|
|
948
|
-
props.applyOverscrollEffect(orientation, edge, overscrollEffectType, ratio);
|
|
949
|
-
setOverscrollStatus(orientation, edge, overscrollEffectType === overscrollTypeOnce ? overscrollTypeDone : overscrollEffectType, ratio);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
function checkAndApplyOverscrollEffect(orientation, edge, overscrollEffectType) {
|
|
953
|
-
var ratio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
954
|
-
var isVertical = orientation === 'vertical',
|
|
955
|
-
curPos = isVertical ? mutableRef.current.scrollTop : mutableRef.current.scrollLeft,
|
|
956
|
-
maxPos = getScrollBounds()[isVertical ? 'maxTop' : 'maxLeft'];
|
|
957
|
-
|
|
958
|
-
if (scrollMode === 'translate' && edge === 'before' && curPos <= 0 || edge === 'after' && curPos >= maxPos || scrollMode === 'native' && edge === 'before' && curPos <= 0 || edge === 'after' && curPos >= maxPos - 1) {
|
|
959
|
-
// Already on the edge
|
|
960
|
-
applyOverscrollEffect(orientation, edge, overscrollEffectType, ratio);
|
|
961
|
-
} else {
|
|
962
|
-
setOverscrollStatus(orientation, edge, overscrollEffectType, ratio);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
function clearOverscrollEffect(orientation, edge) {
|
|
967
|
-
if (getOverscrollStatus(orientation, edge).type !== overscrollTypeNone) {
|
|
968
|
-
if (props.clearOverscrollEffect) {
|
|
969
|
-
props.clearOverscrollEffect(orientation, edge);
|
|
970
|
-
} else {
|
|
971
|
-
applyOverscrollEffect(orientation, edge, overscrollTypeNone, 0);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
function clearAllOverscrollEffects() {
|
|
977
|
-
['horizontal', 'vertical'].forEach(function (orientation) {
|
|
978
|
-
['before', 'after'].forEach(function (edge) {
|
|
979
|
-
clearOverscrollEffect(orientation, edge);
|
|
980
|
-
});
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
function applyOverscrollEffectOnDrag(orientation, edge, targetPosition, overscrollEffectType) {
|
|
985
|
-
if (edge) {
|
|
986
|
-
var oppositeEdge = edge === 'before' ? 'after' : 'before',
|
|
987
|
-
ratio = calculateOverscrollRatio(orientation, targetPosition);
|
|
988
|
-
applyOverscrollEffect(orientation, edge, overscrollEffectType, ratio);
|
|
989
|
-
clearOverscrollEffect(orientation, oppositeEdge);
|
|
990
|
-
} else {
|
|
991
|
-
clearOverscrollEffect(orientation, 'before');
|
|
992
|
-
clearOverscrollEffect(orientation, 'after');
|
|
993
|
-
}
|
|
994
|
-
} // scrollMode 'native' [[
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
function checkAndApplyOverscrollEffectOnDrag(targetX, targetY, overscrollEffectType) {
|
|
998
|
-
var bounds = getScrollBounds();
|
|
999
|
-
|
|
1000
|
-
if (canScrollHorizontally(bounds)) {
|
|
1001
|
-
applyOverscrollEffectOnDrag('horizontal', getEdgeFromPosition(targetX, bounds.maxLeft), targetX, overscrollEffectType);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
if (canScrollVertically(bounds)) {
|
|
1005
|
-
applyOverscrollEffectOnDrag('vertical', getEdgeFromPosition(targetY, bounds.maxTop), targetY, overscrollEffectType);
|
|
1006
|
-
}
|
|
1007
|
-
} // scrollMode 'native' ]]
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
function checkAndApplyOverscrollEffectOnScroll(orientation) {
|
|
1011
|
-
['before', 'after'].forEach(function (edge) {
|
|
1012
|
-
var _getOverscrollStatus = getOverscrollStatus(orientation, edge),
|
|
1013
|
-
ratio = _getOverscrollStatus.ratio,
|
|
1014
|
-
overscrollEffectType = _getOverscrollStatus.type;
|
|
1015
|
-
|
|
1016
|
-
if (overscrollEffectType === overscrollTypeOnce) {
|
|
1017
|
-
checkAndApplyOverscrollEffect(orientation, edge, overscrollEffectType, ratio);
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
function checkAndApplyOverscrollEffectOnStart(orientation, edge, targetPosition) {
|
|
1023
|
-
if (mutableRef.current.isDragging) {
|
|
1024
|
-
applyOverscrollEffectOnDrag(orientation, edge, targetPosition, overscrollTypeHold);
|
|
1025
|
-
} else if (edge) {
|
|
1026
|
-
checkAndApplyOverscrollEffect(orientation, edge, overscrollTypeOnce);
|
|
1027
|
-
}
|
|
1028
|
-
} // call scroll callbacks
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
function forwardScrollEvent(overscrollEffectType, reachedEdgeInfo) {
|
|
1032
|
-
(0, _handle.forward)(overscrollEffectType, {
|
|
1033
|
-
scrollLeft: mutableRef.current.scrollLeft,
|
|
1034
|
-
scrollTop: mutableRef.current.scrollTop,
|
|
1035
|
-
moreInfo: getMoreInfo(),
|
|
1036
|
-
reachedEdgeInfo: reachedEdgeInfo
|
|
1037
|
-
}, props);
|
|
1038
|
-
} // scrollMode 'native' [[
|
|
1039
|
-
// call scroll callbacks and update scrollbars for native scroll
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
function scrollStartOnScroll() {
|
|
1043
|
-
mutableRef.current.scrolling = true;
|
|
1044
|
-
showScrollbarTrack(getScrollBounds());
|
|
1045
|
-
forwardScrollEvent('onScrollStart');
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function scrollStopOnScroll() {
|
|
1049
|
-
if (props.scrollStopOnScroll) {
|
|
1050
|
-
props.scrollStopOnScroll();
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
if (mutableRef.current.overscrollEnabled && !mutableRef.current.isDragging) {
|
|
1054
|
-
// not check overscrollEffectOn && overscrollEffectOn for safety
|
|
1055
|
-
clearAllOverscrollEffects();
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
mutableRef.current.lastInputType = null;
|
|
1059
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
1060
|
-
mutableRef.current.scrolling = false;
|
|
1061
|
-
forwardScrollEvent('onScrollStop', getReachedEdgeInfo());
|
|
1062
|
-
startHidingScrollbarTrack();
|
|
1063
|
-
} // scrollMode 'native' ]]
|
|
1064
|
-
// update scroll position
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
function setScrollLeft(value) {
|
|
1068
|
-
var bounds = getScrollBounds();
|
|
1069
|
-
mutableRef.current.scrollLeft = (0, _clamp["default"])(0, bounds.maxLeft, value);
|
|
1070
|
-
|
|
1071
|
-
if (mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn[mutableRef.current.lastInputType]) {
|
|
1072
|
-
checkAndApplyOverscrollEffectOnScroll('horizontal');
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
if (isHorizontalScrollbarVisible) {
|
|
1076
|
-
updateScrollbarTrack(horizontalScrollbarHandle, bounds);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
function setScrollTop(value) {
|
|
1081
|
-
var bounds = getScrollBounds();
|
|
1082
|
-
mutableRef.current.scrollTop = (0, _clamp["default"])(0, bounds.maxTop, value);
|
|
1083
|
-
|
|
1084
|
-
if (mutableRef.current.overscrollEnabled && overscrollEffectOn && overscrollEffectOn[mutableRef.current.lastInputType]) {
|
|
1085
|
-
checkAndApplyOverscrollEffectOnScroll('vertical');
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
if (isVerticalScrollbarVisible) {
|
|
1089
|
-
updateScrollbarTrack(verticalScrollbarHandle, bounds);
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
function getReachedEdgeInfo() {
|
|
1094
|
-
var bounds = getScrollBounds(),
|
|
1095
|
-
reachedEdgeInfo = {
|
|
1096
|
-
bottom: false,
|
|
1097
|
-
left: false,
|
|
1098
|
-
right: false,
|
|
1099
|
-
top: false
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
if (canScrollHorizontally(bounds)) {
|
|
1103
|
-
var edge = getEdgeFromPosition(mutableRef.current.scrollLeft, bounds.maxLeft);
|
|
1104
|
-
|
|
1105
|
-
if (edge) {
|
|
1106
|
-
// if edge is null, no need to check which edge is reached.
|
|
1107
|
-
if (edge === 'before' && !rtl || edge === 'after' && rtl) {
|
|
1108
|
-
reachedEdgeInfo.left = true;
|
|
1109
|
-
} else {
|
|
1110
|
-
reachedEdgeInfo.right = true;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
if (canScrollVertically(bounds)) {
|
|
1116
|
-
var _edge = getEdgeFromPosition(mutableRef.current.scrollTop, bounds.maxTop);
|
|
1117
|
-
|
|
1118
|
-
if (_edge === 'before') {
|
|
1119
|
-
reachedEdgeInfo.top = true;
|
|
1120
|
-
} else if (_edge === 'after') {
|
|
1121
|
-
reachedEdgeInfo.bottom = true;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
return reachedEdgeInfo;
|
|
1126
|
-
} // scroll start/stop
|
|
1127
|
-
// scrollMode 'translate' [[
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
function doScrollStop() {
|
|
1131
|
-
mutableRef.current.scrolling = false;
|
|
1132
|
-
forwardScrollEvent('onScrollStop', getReachedEdgeInfo());
|
|
1133
|
-
} // scrollMode 'translate' ]]
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
function start(_ref2) {
|
|
1137
|
-
var targetX = _ref2.targetX,
|
|
1138
|
-
targetY = _ref2.targetY,
|
|
1139
|
-
_ref2$animate = _ref2.animate,
|
|
1140
|
-
animate = _ref2$animate === void 0 ? true : _ref2$animate,
|
|
1141
|
-
_ref2$duration = _ref2.duration,
|
|
1142
|
-
duration = _ref2$duration === void 0 ? animationDuration : _ref2$duration,
|
|
1143
|
-
_ref2$overscrollEffec = _ref2.overscrollEffect,
|
|
1144
|
-
overscrollEffect = _ref2$overscrollEffec === void 0 ? false : _ref2$overscrollEffec;
|
|
1145
|
-
var _mutableRef$current3 = mutableRef.current,
|
|
1146
|
-
scrollLeft = _mutableRef$current3.scrollLeft,
|
|
1147
|
-
scrollTop = _mutableRef$current3.scrollTop,
|
|
1148
|
-
bounds = getScrollBounds(),
|
|
1149
|
-
maxLeft = bounds.maxLeft,
|
|
1150
|
-
maxTop = bounds.maxTop;
|
|
1151
|
-
var updatedAnimationInfo = scrollMode === 'translate' ? {
|
|
1152
|
-
sourceX: scrollLeft,
|
|
1153
|
-
sourceY: scrollTop,
|
|
1154
|
-
targetX: targetX,
|
|
1155
|
-
targetY: targetY,
|
|
1156
|
-
duration: duration
|
|
1157
|
-
} : {
|
|
1158
|
-
targetX: targetX,
|
|
1159
|
-
targetY: targetY
|
|
1160
|
-
}; // bail early when scrolling to the same position
|
|
1161
|
-
|
|
1162
|
-
if ((scrollMode === 'translate' && mutableRef.current.animator.isAnimating() || scrollMode === 'native' && mutableRef.current.scrolling) && mutableRef.current.animationInfo && mutableRef.current.animationInfo.targetX === targetX && mutableRef.current.animationInfo.targetY === targetY) {
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
mutableRef.current.animationInfo = updatedAnimationInfo;
|
|
1167
|
-
|
|
1168
|
-
if (scrollMode === 'translate') {
|
|
1169
|
-
mutableRef.current.animator.stop();
|
|
1170
|
-
|
|
1171
|
-
if (!mutableRef.current.scrolling) {
|
|
1172
|
-
mutableRef.current.scrolling = true;
|
|
1173
|
-
forwardScrollEvent('onScrollStart');
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
mutableRef.current.scrollStopJob.stop();
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
if (Math.abs(maxLeft - targetX) < epsilon) {
|
|
1180
|
-
targetX = maxLeft;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
if (Math.abs(maxTop - targetY) < epsilon) {
|
|
1184
|
-
targetY = maxTop;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
if (mutableRef.current.overscrollEnabled && overscrollEffect) {
|
|
1188
|
-
if (scrollLeft !== targetX && canScrollHorizontally(bounds)) {
|
|
1189
|
-
checkAndApplyOverscrollEffectOnStart('horizontal', getEdgeFromPosition(targetX, maxLeft), targetX);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
if (scrollTop !== targetY && canScrollVertically(bounds)) {
|
|
1193
|
-
checkAndApplyOverscrollEffectOnStart('vertical', getEdgeFromPosition(targetY, maxTop), targetY);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
if (scrollMode === 'translate') {
|
|
1198
|
-
showScrollbarTrack(bounds);
|
|
1199
|
-
|
|
1200
|
-
if (scrollContentHandle.current && scrollContentHandle.current.setScrollPositionTarget) {
|
|
1201
|
-
scrollContentHandle.current.setScrollPositionTarget(targetX, targetY);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
if (animate) {
|
|
1205
|
-
mutableRef.current.animator.animate(scrollAnimation(mutableRef.current.animationInfo));
|
|
1206
|
-
} else {
|
|
1207
|
-
scroll(targetX, targetY);
|
|
1208
|
-
stop();
|
|
1209
|
-
}
|
|
1210
|
-
} else {
|
|
1211
|
-
// scrollMode 'native'
|
|
1212
|
-
if (animate) {
|
|
1213
|
-
scrollContentHandle.current.scrollToPosition(targetX, targetY);
|
|
1214
|
-
} else {
|
|
1215
|
-
scrollContentRef.current.style.scrollBehavior = null;
|
|
1216
|
-
scrollContentHandle.current.scrollToPosition(targetX, targetY);
|
|
1217
|
-
scrollContentRef.current.style.scrollBehavior = 'smooth';
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
if (props.start) {
|
|
1221
|
-
props.start(animate);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
} // scrollMode 'translate' [[
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
function scrollAnimation(animationInfo) {
|
|
1228
|
-
return function (curTime) {
|
|
1229
|
-
var sourceX = animationInfo.sourceX,
|
|
1230
|
-
sourceY = animationInfo.sourceY,
|
|
1231
|
-
targetX = animationInfo.targetX,
|
|
1232
|
-
targetY = animationInfo.targetY,
|
|
1233
|
-
duration = animationInfo.duration,
|
|
1234
|
-
bounds = getScrollBounds();
|
|
1235
|
-
|
|
1236
|
-
if (curTime < duration) {
|
|
1237
|
-
var toBeContinued = false,
|
|
1238
|
-
curTargetX = sourceX,
|
|
1239
|
-
curTargetY = sourceY;
|
|
1240
|
-
|
|
1241
|
-
if (canScrollHorizontally(bounds)) {
|
|
1242
|
-
curTargetX = mutableRef.current.animator.timingFunction(sourceX, targetX, duration, curTime);
|
|
1243
|
-
|
|
1244
|
-
if (Math.abs(curTargetX - targetX) < epsilon) {
|
|
1245
|
-
curTargetX = targetX;
|
|
1246
|
-
} else {
|
|
1247
|
-
toBeContinued = true;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
if (canScrollVertically(bounds)) {
|
|
1252
|
-
curTargetY = mutableRef.current.animator.timingFunction(sourceY, targetY, duration, curTime);
|
|
1253
|
-
|
|
1254
|
-
if (Math.abs(curTargetY - targetY) < epsilon) {
|
|
1255
|
-
curTargetY = targetY;
|
|
1256
|
-
} else {
|
|
1257
|
-
toBeContinued = true;
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
scroll(curTargetX, curTargetY);
|
|
1262
|
-
|
|
1263
|
-
if (!toBeContinued) {
|
|
1264
|
-
stop();
|
|
1265
|
-
}
|
|
1266
|
-
} else {
|
|
1267
|
-
scroll(targetX, targetY);
|
|
1268
|
-
stop();
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
function scroll(left, top) {
|
|
1274
|
-
if (left !== mutableRef.current.scrollLeft) {
|
|
1275
|
-
setScrollLeft(left);
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
if (top !== mutableRef.current.scrollTop) {
|
|
1279
|
-
setScrollTop(top);
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
scrollContentHandle.current.setScrollPosition(mutableRef.current.scrollLeft, mutableRef.current.scrollTop, rtl);
|
|
1283
|
-
forwardScrollEvent('onScroll');
|
|
1284
|
-
} // scrollMode 'translate' ]]
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
function stopForTranslate() {
|
|
1288
|
-
mutableRef.current.animator.stop();
|
|
1289
|
-
mutableRef.current.lastInputType = null;
|
|
1290
|
-
mutableRef.current.isScrollAnimationTargetAccumulated = false;
|
|
1291
|
-
startHidingScrollbarTrack();
|
|
1292
|
-
|
|
1293
|
-
if (mutableRef.current.overscrollEnabled && !mutableRef.current.isDragging) {
|
|
1294
|
-
// not check overscrollEffectOn && overscrollEffectOn for safety
|
|
1295
|
-
clearAllOverscrollEffects();
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
if (props.stop) {
|
|
1299
|
-
props.stop();
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
if (mutableRef.current.scrolling) {
|
|
1303
|
-
mutableRef.current.scrollStopJob.start();
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
function stopForNative() {
|
|
1308
|
-
scrollContentRef.current.style.scrollBehavior = null;
|
|
1309
|
-
scrollContentHandle.current.scrollToPosition(mutableRef.current.scrollLeft + (rtl ? -0.1 : 0.1), mutableRef.current.scrollTop + 0.1);
|
|
1310
|
-
scrollContentRef.current.style.scrollBehavior = 'smooth';
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
function stop() {
|
|
1314
|
-
if (scrollMode === 'translate') {
|
|
1315
|
-
stopForTranslate();
|
|
1316
|
-
} else {
|
|
1317
|
-
stopForNative();
|
|
1318
|
-
}
|
|
1319
|
-
} // scrollTo API
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
function getPositionForScrollTo(opt) {
|
|
1323
|
-
var bounds = getScrollBounds(),
|
|
1324
|
-
canScrollH = canScrollHorizontally(bounds),
|
|
1325
|
-
canScrollV = canScrollVertically(bounds);
|
|
1326
|
-
var itemPos,
|
|
1327
|
-
left = null,
|
|
1328
|
-
top = null;
|
|
1329
|
-
|
|
1330
|
-
if (opt instanceof Object) {
|
|
1331
|
-
if (opt.position instanceof Object) {
|
|
1332
|
-
if (canScrollH) {
|
|
1333
|
-
// We need '!=' to check if opt.position.x is null or undefined
|
|
1334
|
-
left = opt.position.x != null ? opt.position.x : mutableRef.current.scrollLeft;
|
|
1335
|
-
} else {
|
|
1336
|
-
left = 0;
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
if (canScrollV) {
|
|
1340
|
-
// We need '!=' to check if opt.position.y is null or undefined
|
|
1341
|
-
top = opt.position.y != null ? opt.position.y : mutableRef.current.scrollTop;
|
|
1342
|
-
} else {
|
|
1343
|
-
top = 0;
|
|
1344
|
-
}
|
|
1345
|
-
} else if (typeof opt.align === 'string') {
|
|
1346
|
-
if (canScrollH) {
|
|
1347
|
-
if (opt.align.includes('left')) {
|
|
1348
|
-
left = 0;
|
|
1349
|
-
} else if (opt.align.includes('right')) {
|
|
1350
|
-
left = bounds.maxLeft;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
if (canScrollV) {
|
|
1355
|
-
if (opt.align.includes('top')) {
|
|
1356
|
-
top = 0;
|
|
1357
|
-
} else if (opt.align.includes('bottom')) {
|
|
1358
|
-
top = bounds.maxTop;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
} else {
|
|
1362
|
-
if (typeof opt.index === 'number' && typeof scrollContentHandle.current.getItemPosition === 'function') {
|
|
1363
|
-
itemPos = scrollContentHandle.current.getItemPosition(opt.index, opt.stickTo, opt.offset);
|
|
1364
|
-
} else if (opt.node instanceof Object) {
|
|
1365
|
-
if (opt.node.nodeType === 1 && typeof scrollContentHandle.current.getNodePosition === 'function') {
|
|
1366
|
-
itemPos = scrollContentHandle.current.getNodePosition(opt.node);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
if (itemPos) {
|
|
1371
|
-
if (canScrollH) {
|
|
1372
|
-
left = itemPos.left;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
if (canScrollV) {
|
|
1376
|
-
top = itemPos.top;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
return {
|
|
1383
|
-
left: left,
|
|
1384
|
-
top: top
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
function scrollTo(opt) {
|
|
1389
|
-
if (!mutableRef.current.deferScrollTo) {
|
|
1390
|
-
var _getPositionForScroll = getPositionForScrollTo(opt),
|
|
1391
|
-
left = _getPositionForScroll.left,
|
|
1392
|
-
top = _getPositionForScroll.top;
|
|
1393
|
-
|
|
1394
|
-
var targetX = left !== null ? left : mutableRef.current.scrollLeft;
|
|
1395
|
-
var targetY = top !== null ? top : mutableRef.current.scrollTop;
|
|
1396
|
-
|
|
1397
|
-
if (props.scrollTo) {
|
|
1398
|
-
props.scrollTo(opt);
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
mutableRef.current.scrollToInfo = null;
|
|
1402
|
-
|
|
1403
|
-
if (scrollMode === 'native' && scrollContentHandle.current && scrollContentHandle.current.setScrollToPositionTarget) {
|
|
1404
|
-
scrollContentHandle.current.setScrollToPositionTarget(targetX, targetY);
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
start({
|
|
1408
|
-
targetX: targetX,
|
|
1409
|
-
targetY: targetY,
|
|
1410
|
-
animate: opt.animate
|
|
1411
|
-
});
|
|
1412
|
-
} else {
|
|
1413
|
-
mutableRef.current.scrollToInfo = opt;
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
function canScrollHorizontally(bounds) {
|
|
1418
|
-
return (direction === 'horizontal' || direction === 'both') && bounds.scrollWidth > bounds.clientWidth && !isNaN(bounds.scrollWidth);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
function canScrollVertically(bounds) {
|
|
1422
|
-
return (direction === 'vertical' || direction === 'both') && bounds.scrollHeight > bounds.clientHeight && !isNaN(bounds.scrollHeight);
|
|
1423
|
-
} // scroll bar
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
function showScrollbarTrack(bounds) {
|
|
1427
|
-
if (isHorizontalScrollbarVisible && canScrollHorizontally(bounds) && horizontalScrollbarHandle.current) {
|
|
1428
|
-
horizontalScrollbarHandle.current.showScrollbarTrack();
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
if (isVerticalScrollbarVisible && canScrollVertically(bounds) && verticalScrollbarHandle.current) {
|
|
1432
|
-
verticalScrollbarHandle.current.showScrollbarTrack();
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
function updateScrollbarTrack(scrollbarRef, bounds) {
|
|
1437
|
-
scrollbarRef.current.update(_objectSpread(_objectSpread({}, bounds), {}, {
|
|
1438
|
-
scrollLeft: mutableRef.current.scrollLeft,
|
|
1439
|
-
scrollTop: mutableRef.current.scrollTop
|
|
1440
|
-
}));
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
function startHidingScrollbarTrack() {
|
|
1444
|
-
if (isHorizontalScrollbarVisible && horizontalScrollbarHandle.current) {
|
|
1445
|
-
horizontalScrollbarHandle.current.startHidingScrollbarTrack();
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
if (isVerticalScrollbarVisible && verticalScrollbarHandle.current) {
|
|
1449
|
-
verticalScrollbarHandle.current.startHidingScrollbarTrack();
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
function updateScrollbars() {
|
|
1454
|
-
var bounds = getScrollBounds(),
|
|
1455
|
-
canScrollH = canScrollHorizontally(bounds),
|
|
1456
|
-
canScrollV = canScrollVertically(bounds),
|
|
1457
|
-
curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollH : horizontalScrollbar === 'visible',
|
|
1458
|
-
curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollV : verticalScrollbar === 'visible'; // determine if we should hide or show any scrollbars
|
|
1459
|
-
|
|
1460
|
-
var isVisibilityChanged = isHorizontalScrollbarVisible !== curHorizontalScrollbarVisible || isVerticalScrollbarVisible !== curVerticalScrollbarVisible;
|
|
1461
|
-
|
|
1462
|
-
if (isVisibilityChanged) {
|
|
1463
|
-
// one or both scrollbars have changed visibility
|
|
1464
|
-
setIsHorizontalScrollbarVisible(curHorizontalScrollbarVisible);
|
|
1465
|
-
setIsVerticalScrollbarVisible(curVerticalScrollbarVisible);
|
|
1466
|
-
} else {
|
|
1467
|
-
mutableRef.current.deferScrollTo = false;
|
|
1468
|
-
updateScrollbarTrackSize();
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
function updateScrollbarTrackSize() {
|
|
1473
|
-
var bounds = getScrollBounds(),
|
|
1474
|
-
canScrollH = canScrollHorizontally(bounds),
|
|
1475
|
-
canScrollV = canScrollVertically(bounds),
|
|
1476
|
-
curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollH : horizontalScrollbar === 'visible',
|
|
1477
|
-
curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollV : verticalScrollbar === 'visible';
|
|
1478
|
-
|
|
1479
|
-
if (curHorizontalScrollbarVisible || curVerticalScrollbarVisible) {
|
|
1480
|
-
// no visibility change but need to notify whichever scrollbars are visible of the
|
|
1481
|
-
// updated bounds and scroll position
|
|
1482
|
-
var updatedBounds = _objectSpread(_objectSpread({}, bounds), {}, {
|
|
1483
|
-
scrollLeft: mutableRef.current.scrollLeft,
|
|
1484
|
-
scrollTop: mutableRef.current.scrollTop
|
|
1485
|
-
});
|
|
1486
|
-
|
|
1487
|
-
if (curHorizontalScrollbarVisible && horizontalScrollbarHandle.current) {
|
|
1488
|
-
horizontalScrollbarHandle.current.update(updatedBounds);
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
if (curVerticalScrollbarVisible && verticalScrollbarHandle.current) {
|
|
1492
|
-
verticalScrollbarHandle.current.update(updatedBounds);
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
return true;
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
return false;
|
|
1499
|
-
} // ref
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
function getScrollBounds() {
|
|
1503
|
-
if (scrollContentHandle.current && typeof scrollContentHandle.current.getScrollBounds === 'function') {
|
|
1504
|
-
return scrollContentHandle.current.getScrollBounds();
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
function getMoreInfo() {
|
|
1509
|
-
if (scrollContentHandle.current && typeof scrollContentHandle.current.getMoreInfo === 'function') {
|
|
1510
|
-
return scrollContentHandle.current.getMoreInfo();
|
|
1511
|
-
}
|
|
1512
|
-
} // FIXME setting event handlers directly to work on the V8 snapshot.
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
function addEventListeners() {
|
|
1516
|
-
(0, _utilEvent["default"])('wheel').addEventListener(scrollContainerRef, onWheel);
|
|
1517
|
-
(0, _utilEvent["default"])('keydown').addEventListener(scrollContainerRef, onKeyDown);
|
|
1518
|
-
(0, _utilEvent["default"])('mousedown').addEventListener(scrollContainerRef, onMouseDown); // scrollMode 'native' [[
|
|
1519
|
-
|
|
1520
|
-
if (scrollMode === 'native' && scrollContentRef.current) {
|
|
1521
|
-
(0, _utilEvent["default"])('scroll').addEventListener(scrollContentRef, onScroll, {
|
|
1522
|
-
passive: true
|
|
1523
|
-
});
|
|
1524
|
-
scrollContentRef.current.style.scrollBehavior = 'smooth';
|
|
1525
|
-
} // scrollMode 'native' ]]
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
if (props.addEventListeners) {
|
|
1529
|
-
props.addEventListeners(scrollContentRef);
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
if (window) {
|
|
1533
|
-
(0, _utilEvent["default"])('resize').addEventListener(window, handleResizeWindow);
|
|
1534
|
-
}
|
|
1535
|
-
} // FIXME setting event handlers directly to work on the V8 snapshot.
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
function removeEventListeners() {
|
|
1539
|
-
(0, _utilEvent["default"])('wheel').removeEventListener(scrollContainerRef, onWheel);
|
|
1540
|
-
(0, _utilEvent["default"])('keydown').removeEventListener(scrollContainerRef, onKeyDown);
|
|
1541
|
-
(0, _utilEvent["default"])('mousedown').removeEventListener(scrollContainerRef, onMouseDown); // scrollMode 'native' [[
|
|
1542
|
-
|
|
1543
|
-
(0, _utilEvent["default"])('scroll').removeEventListener(scrollContentRef, onScroll, {
|
|
1544
|
-
passive: true
|
|
1545
|
-
}); // scrollMode 'native' ]]
|
|
1546
|
-
|
|
1547
|
-
if (props.removeEventListeners) {
|
|
1548
|
-
props.removeEventListeners(scrollContentRef);
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
(0, _utilEvent["default"])('resize').removeEventListener(window, handleResizeWindow);
|
|
1552
|
-
} // render
|
|
1553
|
-
// scrollMode 'translate' [[
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
function handleScroll() {
|
|
1557
|
-
// Prevent scroll by focus.
|
|
1558
|
-
// VirtualList and VirtualGridList DO NOT receive `onscroll` event.
|
|
1559
|
-
// Only Scroller could get `onscroll` event.
|
|
1560
|
-
if (!mutableRef.current.animator.isAnimating() && scrollContentHandle.current && scrollContentRef.current && scrollContentHandle.current.getRtlPositionX) {
|
|
1561
|
-
// For Scroller
|
|
1562
|
-
scrollContentRef.current.scrollTop = mutableRef.current.scrollTop;
|
|
1563
|
-
scrollContentRef.current.scrollLeft = scrollContentHandle.current.getRtlPositionX(mutableRef.current.scrollLeft);
|
|
1564
|
-
}
|
|
1565
|
-
} // scrollMode 'translate' ]]
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
function scrollContainerContainsDangerously(target) {
|
|
1569
|
-
return _utilDOM["default"].containsDangerously(scrollContainerRef, target);
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
assignProperties('scrollContainerProps', _objectSpread(_objectSpread({}, rest), {}, {
|
|
1573
|
-
className: [scrollClasses]
|
|
1574
|
-
}));
|
|
1575
|
-
assignProperties('scrollInnerContainerProps', {
|
|
1576
|
-
className: [_useScrollModule["default"].scrollInnerContainer]
|
|
1577
|
-
});
|
|
1578
|
-
assignProperties('scrollContentWrapperProps', _objectSpread({
|
|
1579
|
-
className: scrollMode === 'translate' ? [_useScrollModule["default"].scrollContentWrapper] : [_useScrollModule["default"].scrollContentWrapper, _useScrollModule["default"].scrollContentWrapperNative]
|
|
1580
|
-
}, !noScrollByDrag && {
|
|
1581
|
-
flickConfig: flickConfig,
|
|
1582
|
-
onDrag: onDrag,
|
|
1583
|
-
onDragEnd: onDragEnd,
|
|
1584
|
-
onDragStart: onDragStart,
|
|
1585
|
-
onFlick: onFlick,
|
|
1586
|
-
onTouchStart: scrollMode === 'native' ? onTouchStart : null // scrollMode 'native'
|
|
1587
|
-
|
|
1588
|
-
}));
|
|
1589
|
-
var voiceProps = {
|
|
1590
|
-
'data-webos-voice-disabled': voiceDisabled,
|
|
1591
|
-
'data-webos-voice-focused': voiceFocused,
|
|
1592
|
-
'data-webos-voice-group-label': voiceGroupLabel
|
|
1593
|
-
};
|
|
1594
|
-
var scrollContentProps = props.itemRenderer ? // If the child component is a VirtualList
|
|
1595
|
-
{
|
|
1596
|
-
childProps: childProps,
|
|
1597
|
-
clientSize: clientSize,
|
|
1598
|
-
dataSize: dataSize,
|
|
1599
|
-
itemRenderer: itemRenderer,
|
|
1600
|
-
itemSize: itemSize,
|
|
1601
|
-
itemSizes: itemSizes,
|
|
1602
|
-
overhang: overhang,
|
|
1603
|
-
pageScroll: pageScroll,
|
|
1604
|
-
spacing: spacing,
|
|
1605
|
-
wrap: wrap
|
|
1606
|
-
} : {
|
|
1607
|
-
children: children
|
|
1608
|
-
};
|
|
1609
|
-
assignProperties('scrollContentProps', _objectSpread(_objectSpread(_objectSpread({}, scrollContentProps), voiceProps), {}, {
|
|
1610
|
-
cbScrollTo: scrollTo,
|
|
1611
|
-
className: [_useScrollModule["default"].scrollFill],
|
|
1612
|
-
direction: direction,
|
|
1613
|
-
|
|
1614
|
-
get isHorizontalScrollbarVisible() {
|
|
1615
|
-
return isHorizontalScrollbarVisible;
|
|
1616
|
-
},
|
|
1617
|
-
|
|
1618
|
-
get isVerticalScrollbarVisible() {
|
|
1619
|
-
return isVerticalScrollbarVisible;
|
|
1620
|
-
},
|
|
1621
|
-
|
|
1622
|
-
onScroll: scrollMode === 'translate' ? handleScroll : null,
|
|
1623
|
-
role: role,
|
|
1624
|
-
rtl: rtl,
|
|
1625
|
-
scrollContainerContainsDangerously: scrollContainerContainsDangerously,
|
|
1626
|
-
scrollMode: scrollMode
|
|
1627
|
-
}));
|
|
1628
|
-
assignProperties('verticalScrollbarProps', {
|
|
1629
|
-
clientSize: clientSize,
|
|
1630
|
-
disabled: !isVerticalScrollbarVisible,
|
|
1631
|
-
rtl: rtl,
|
|
1632
|
-
vertical: true
|
|
1633
|
-
});
|
|
1634
|
-
assignProperties('horizontalScrollbarProps', {
|
|
1635
|
-
clientSize: clientSize,
|
|
1636
|
-
corner: isVerticalScrollbarVisible,
|
|
1637
|
-
disabled: !isHorizontalScrollbarVisible,
|
|
1638
|
-
rtl: rtl,
|
|
1639
|
-
vertical: false
|
|
1640
|
-
});
|
|
1641
|
-
assignProperties('resizeContextProps', {
|
|
1642
|
-
value: mutableRef.current.resizeRegistry.register
|
|
1643
|
-
});
|
|
1644
|
-
mutableRef.current.deferScrollTo = true;
|
|
1645
|
-
mutableRef.current.prevState = {
|
|
1646
|
-
isHorizontalScrollbarVisible: isHorizontalScrollbarVisible,
|
|
1647
|
-
isVerticalScrollbarVisible: isVerticalScrollbarVisible
|
|
1648
|
-
};
|
|
1649
|
-
return {
|
|
1650
|
-
scrollContentWrapper: noScrollByDrag ? 'div' : TouchableDiv,
|
|
1651
|
-
isHorizontalScrollbarVisible: isHorizontalScrollbarVisible,
|
|
1652
|
-
isVerticalScrollbarVisible: isVerticalScrollbarVisible
|
|
1653
|
-
};
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
exports.useScrollBase = useScrollBase;
|
|
1657
|
-
|
|
1658
|
-
var assignPropertiesOf = function assignPropertiesOf(instance) {
|
|
1659
|
-
return function (name, properties) {
|
|
1660
|
-
if (!instance[name]) {
|
|
1661
|
-
instance[name] = {};
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
if (typeof properties === 'object') {
|
|
1665
|
-
for (var property in properties) {
|
|
1666
|
-
if (property === 'className') {
|
|
1667
|
-
process.env.NODE_ENV !== "production" ? (0, _warning["default"])(Array.isArray(properties.className), 'Unsupported other types for `className` prop except Array') : void 0;
|
|
1668
|
-
instance[name].className = (0, _classnames["default"])(instance[name].className, properties.className);
|
|
1669
|
-
} else {
|
|
1670
|
-
process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!instance[name][property], 'Unsupported to push value in the same ' + property + ' prop.') : void 0; // Override the previous value.
|
|
1671
|
-
|
|
1672
|
-
instance[name][property] = properties[property];
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
};
|
|
1677
|
-
};
|
|
1678
|
-
|
|
1679
|
-
exports.assignPropertiesOf = assignPropertiesOf;
|
|
1680
|
-
|
|
1681
|
-
var useScroll = function useScroll(props) {
|
|
1682
|
-
// Mutable value
|
|
1683
|
-
var scrollContainerRef = (0, _react.useRef)({});
|
|
1684
|
-
var scrollContentHandle = (0, _react.useRef)({});
|
|
1685
|
-
var scrollContentRef = (0, _react.useRef)({});
|
|
1686
|
-
var itemRefs = (0, _react.useRef)([]);
|
|
1687
|
-
var horizontalScrollbarHandle = (0, _react.useRef)({});
|
|
1688
|
-
var verticalScrollbarHandle = (0, _react.useRef)({}); // Hooks
|
|
1689
|
-
|
|
1690
|
-
var collectionOfProperties = {},
|
|
1691
|
-
assignProperties = assignPropertiesOf(collectionOfProperties);
|
|
1692
|
-
|
|
1693
|
-
var _useScrollBase = useScrollBase(_objectSpread(_objectSpread({}, props), {}, {
|
|
1694
|
-
assignProperties: assignProperties,
|
|
1695
|
-
horizontalScrollbarHandle: horizontalScrollbarHandle,
|
|
1696
|
-
scrollContainerRef: scrollContainerRef,
|
|
1697
|
-
scrollContentHandle: scrollContentHandle,
|
|
1698
|
-
scrollContentRef: scrollContentRef,
|
|
1699
|
-
verticalScrollbarHandle: verticalScrollbarHandle
|
|
1700
|
-
})),
|
|
1701
|
-
scrollContentWrapper = _useScrollBase.scrollContentWrapper,
|
|
1702
|
-
isHorizontalScrollbarVisible = _useScrollBase.isHorizontalScrollbarVisible,
|
|
1703
|
-
isVerticalScrollbarVisible = _useScrollBase.isVerticalScrollbarVisible;
|
|
1704
|
-
|
|
1705
|
-
assignProperties('scrollContainerProps', {
|
|
1706
|
-
ref: scrollContainerRef
|
|
1707
|
-
});
|
|
1708
|
-
assignProperties('scrollContentProps', _objectSpread(_objectSpread({}, props.itemRenderer ? {
|
|
1709
|
-
itemRefs: itemRefs
|
|
1710
|
-
} : {}), {}, {
|
|
1711
|
-
scrollContentRef: scrollContentRef
|
|
1712
|
-
}));
|
|
1713
|
-
assignProperties('verticalScrollbarProps', {
|
|
1714
|
-
scrollbarHandle: verticalScrollbarHandle
|
|
1715
|
-
});
|
|
1716
|
-
assignProperties('horizontalScrollbarProps', {
|
|
1717
|
-
scrollbarHandle: horizontalScrollbarHandle
|
|
1718
|
-
}); // Return
|
|
1719
|
-
|
|
1720
|
-
return _objectSpread(_objectSpread({}, collectionOfProperties), {}, {
|
|
1721
|
-
scrollContentWrapper: scrollContentWrapper,
|
|
1722
|
-
scrollContentHandle: scrollContentHandle,
|
|
1723
|
-
isHorizontalScrollbarVisible: isHorizontalScrollbarVisible,
|
|
1724
|
-
isVerticalScrollbarVisible: isVerticalScrollbarVisible
|
|
1725
|
-
});
|
|
1726
|
-
};
|
|
1727
|
-
|
|
1728
|
-
exports.useScroll = useScroll;
|
|
1729
|
-
var _default = useScroll;
|
|
1730
|
-
exports["default"] = _default;
|