pixuireactcomponents 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/package.json +9 -66
- package/tsconfig.json +27 -13
- package/{src/pixUIReactComponents/ui → ui}/components/slapface/Slapface.tsx +17 -17
- package/ui/sample/Slapface/SlapfaceDemo.tsx +30 -0
- package/.eslintignore +0 -7
- package/.eslintrc.js +0 -48
- package/.pixiderc/apps.json +0 -12
- package/.pixiderc/devel-config.meta.json +0 -23
- package/.pixiderc/postinstall.js +0 -17
- package/.pixiderc/util.js +0 -136
- package/.pixiderc/webpack.js +0 -180
- package/faas/helloworld.js +0 -8
- package/gen/pbo/pandora_pb.d.ts +0 -1179
- package/gen/pbo/pandora_pb.js +0 -10475
- package/gen/pbo/pandora_pb_service.d.ts +0 -1317
- package/gen/pbo/pandora_pb_service.js +0 -2307
- package/gen/pbo/test_pb.d.ts +0 -99
- package/gen/pbo/test_pb.js +0 -889
- package/gen/pbo/test_pb_service.d.ts +0 -82
- package/gen/pbo/test_pb_service.js +0 -117
- package/lib/assets/border.png +0 -0
- package/lib/assets/check.html +0 -54
- package/lib/assets/pixui.png +0 -0
- package/lib/assets/preact.png +0 -0
- package/lib/check/main.less +0 -63
- package/lib/check/main.tsx +0 -42
- package/lib/check/tool.js +0 -3
- package/lib/check/util.tsx +0 -107
- package/lib/dom.ts +0 -16
- package/lib/ext.d.ts +0 -95
- package/lib/grpc-web/dist/ChunkParser.js +0 -115
- package/lib/grpc-web/dist/ChunkParser.js.map +0 -1
- package/lib/grpc-web/dist/Code.js +0 -58
- package/lib/grpc-web/dist/Code.js.map +0 -1
- package/lib/grpc-web/dist/client.js +0 -299
- package/lib/grpc-web/dist/client.js.map +0 -1
- package/lib/grpc-web/dist/debug.js +0 -16
- package/lib/grpc-web/dist/debug.js.map +0 -1
- package/lib/grpc-web/dist/detach.js +0 -7
- package/lib/grpc-web/dist/detach.js.map +0 -1
- package/lib/grpc-web/dist/index.js +0 -29
- package/lib/grpc-web/dist/index.js.map +0 -1
- package/lib/grpc-web/dist/invoke.js +0 -32
- package/lib/grpc-web/dist/invoke.js.map +0 -1
- package/lib/grpc-web/dist/message.js +0 -3
- package/lib/grpc-web/dist/message.js.map +0 -1
- package/lib/grpc-web/dist/metadata.js +0 -5
- package/lib/grpc-web/dist/metadata.js.map +0 -1
- package/lib/grpc-web/dist/service.js +0 -3
- package/lib/grpc-web/dist/service.js.map +0 -1
- package/lib/grpc-web/dist/transports/Transport.js +0 -13
- package/lib/grpc-web/dist/transports/Transport.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/fetch.js +0 -112
- package/lib/grpc-web/dist/transports/http/fetch.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/http.js +0 -15
- package/lib/grpc-web/dist/transports/http/http.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/xhr.js +0 -127
- package/lib/grpc-web/dist/transports/http/xhr.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/xhrUtil.js +0 -37
- package/lib/grpc-web/dist/transports/http/xhrUtil.js.map +0 -1
- package/lib/grpc-web/dist/transports/websocket/websocket.js +0 -95
- package/lib/grpc-web/dist/transports/websocket/websocket.js.map +0 -1
- package/lib/grpc-web/dist/typings/ChunkParser.d.ts +0 -17
- package/lib/grpc-web/dist/typings/Code.d.ts +0 -20
- package/lib/grpc-web/dist/typings/client.d.ts +0 -22
- package/lib/grpc-web/dist/typings/debug.d.ts +0 -1
- package/lib/grpc-web/dist/typings/detach.d.ts +0 -1
- package/lib/grpc-web/dist/typings/index.d.ts +0 -60
- package/lib/grpc-web/dist/typings/invoke.d.ts +0 -17
- package/lib/grpc-web/dist/typings/message.d.ts +0 -8
- package/lib/grpc-web/dist/typings/metadata.d.ts +0 -2
- package/lib/grpc-web/dist/typings/service.d.ts +0 -16
- package/lib/grpc-web/dist/typings/transports/Transport.d.ts +0 -22
- package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +0 -6
- package/lib/grpc-web/dist/typings/transports/http/http.d.ts +0 -5
- package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +0 -27
- package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +0 -3
- package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +0 -2
- package/lib/grpc-web/dist/typings/unary.d.ts +0 -20
- package/lib/grpc-web/dist/typings/util.d.ts +0 -2
- package/lib/grpc-web/dist/unary.js +0 -44
- package/lib/grpc-web/dist/unary.js.map +0 -1
- package/lib/grpc-web/dist/util.js +0 -11
- package/lib/grpc-web/dist/util.js.map +0 -1
- package/lib/grpcTransport/PixHttp2Transport.ts +0 -104
- package/lib/grpcTransport/PixLuaTransport.ts +0 -80
- package/lib/pi_component/tinyList/tinyList.js +0 -573
- package/lib/pi_component/tinyList/tinyList.tsx +0 -586
- package/lib/preact/compat/src/Children.js +0 -26
- package/lib/preact/compat/src/PureComponent.js +0 -19
- package/lib/preact/compat/src/events.js +0 -36
- package/lib/preact/compat/src/forwardRef.js +0 -29
- package/lib/preact/compat/src/index.d.ts +0 -121
- package/lib/preact/compat/src/index.js +0 -159
- package/lib/preact/compat/src/internal.d.ts +0 -45
- package/lib/preact/compat/src/memo.js +0 -34
- package/lib/preact/compat/src/portals.js +0 -85
- package/lib/preact/compat/src/render.js +0 -166
- package/lib/preact/compat/src/suspense-list.d.ts +0 -14
- package/lib/preact/compat/src/suspense-list.js +0 -127
- package/lib/preact/compat/src/suspense.d.ts +0 -15
- package/lib/preact/compat/src/suspense.js +0 -165
- package/lib/preact/compat/src/util.js +0 -23
- package/lib/preact/hooks/src/index.d.ts +0 -133
- package/lib/preact/hooks/src/index.js +0 -339
- package/lib/preact/hooks/src/internal.d.ts +0 -55
- package/lib/preact/src/clone-element.js +0 -27
- package/lib/preact/src/compat.ts +0 -0
- package/lib/preact/src/component.js +0 -219
- package/lib/preact/src/constants.js +0 -3
- package/lib/preact/src/create-context.js +0 -55
- package/lib/preact/src/create-element.js +0 -102
- package/lib/preact/src/css.d.ts +0 -30341
- package/lib/preact/src/diff/catch-error.js +0 -41
- package/lib/preact/src/diff/children.js +0 -259
- package/lib/preact/src/diff/index.js +0 -445
- package/lib/preact/src/diff/props.js +0 -163
- package/lib/preact/src/index.d.ts +0 -275
- package/lib/preact/src/index.js +0 -14
- package/lib/preact/src/internal.d.ts +0 -94
- package/lib/preact/src/jsx.d.ts +0 -884
- package/lib/preact/src/options.js +0 -16
- package/lib/preact/src/render.js +0 -98
- package/lib/preact/src/util.js +0 -25
- package/lib/preact-router/.travis.yml +0 -3
- package/lib/preact-router/LICENSE +0 -21
- package/lib/preact-router/README.md +0 -254
- package/lib/preact-router/index.d.ts +0 -71
- package/lib/preact-router/match/index.d.ts +0 -16
- package/lib/preact-router/match/package.json +0 -13
- package/lib/preact-router/match/src/cjs.js +0 -4
- package/lib/preact-router/match/src/index.js +0 -36
- package/lib/preact-router/package-lock.json +0 -12330
- package/lib/preact-router/package.json +0 -78
- package/lib/preact-router/src/cjs.js +0 -11
- package/lib/preact-router/src/index.js +0 -270
- package/lib/preact-router/src/util.js +0 -87
- package/lib/react-window/src/FixedSizeGrid.js +0 -244
- package/lib/react-window/src/FixedSizeList.js +0 -130
- package/lib/react-window/src/VariableSizeGrid.js +0 -507
- package/lib/react-window/src/VariableSizeList.js +0 -316
- package/lib/react-window/src/__tests__/FixedSizeGrid.js +0 -1336
- package/lib/react-window/src/__tests__/FixedSizeList.js +0 -966
- package/lib/react-window/src/__tests__/VariableSizeGrid.js +0 -779
- package/lib/react-window/src/__tests__/VariableSizeList.js +0 -442
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +0 -912
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +0 -568
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +0 -542
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +0 -331
- package/lib/react-window/src/__tests__/areEqual.js +0 -32
- package/lib/react-window/src/__tests__/shouldComponentUpdate.js +0 -36
- package/lib/react-window/src/areEqual.js +0 -18
- package/lib/react-window/src/createGridComponent.js +0 -919
- package/lib/react-window/src/createListComponent.js +0 -729
- package/lib/react-window/src/domHelpers.js +0 -72
- package/lib/react-window/src/index.js +0 -9
- package/lib/react-window/src/shallowDiffers.js +0 -17
- package/lib/react-window/src/shouldComponentUpdate.js +0 -16
- package/lib/react-window/src/test.js.flow +0 -382
- package/lib/react-window/src/timer.js +0 -36
- package/src/app/demopage.tsx +0 -77
- package/src/app/index.html +0 -48
- package/src/app/main.tsx +0 -30
- package/src/asset/Textures/Alert/bg_tips.png +0 -0
- package/src/asset/Textures/Alert/btn_zhedie_a.png +0 -0
- package/src/asset/Textures/Alert/com_home_bg_left.png +0 -0
- package/src/asset/Textures/Alert/com_home_bg_rightbar.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_a.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_back_top.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_bottombar_sheet.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_list_xiala.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_rightbar_line.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_rightbar_selected.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_140.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_60.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_80.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_back.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_bottombar.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_bottombar_fadongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_close.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_guanzhu_126.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_guanzhu_86.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_bianji.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_dongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_touxiang.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_selet.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_126.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_86.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_bottombar_fadongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_bottombar_red.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_loading.png +0 -0
- package/src/asset/Textures/Commons/com_home_pic_touxiang_moren.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_a.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_b.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_c.png +0 -0
- package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_v.png +0 -0
- package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_yonghurenzheng.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_line.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_chakan.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_input.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_zan.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_middle_input.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_more.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_photo_more.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a_shadow.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_pressed.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_pressed.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_b_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_c_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_d.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_e.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_f_share.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_middle_input_back.png +0 -0
- package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn.png +0 -0
- package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn_pressd.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_bg_music.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_btn_a.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_btn_b.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_b.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_d.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_e.png +0 -0
- package/src/asset/Textures/Commons/rukou_bg_bottombar_line.png +0 -0
- package/src/asset/Textures/Commons/rukou_icon_a.png +0 -0
- package/src/asset/Textures/Commons/tc_bianji_tab_a.png +0 -0
- package/src/asset/Textures/Commons/tc_zanshang_bg_line.png +0 -0
- package/src/asset/Textures/Commons/touxiang_bg_tishikuang.png +0 -0
- package/src/asset/Textures/Commons/video/rukou_icon_shipin.png +0 -0
- package/src/asset/Textures/Commons/video/xiangce_btn_bofang.png +0 -0
- package/src/asset/Textures/Commons/voice/rukou_icon_yuyin.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_load.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_a.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_b.png +0 -0
- package/src/asset/Textures/Commons/xiangce_icon_bottombar_gulita.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_bottom.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_input.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_tips.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_a.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_zhaopian_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn_close.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn_upload_photo.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_normal.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_normal_@slice_0.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_tab_a.png +0 -0
- package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar.png +0 -0
- package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar_pre.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_line.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_normal.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_middle_new.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_line.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_my.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_top.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_topbar_a.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_icon_topbar_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_pic_1.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_pic_2.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_fadongtai_btn_close.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_bg_daoju.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_a.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_b.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_c.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju1.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju2.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju3.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_pinglun_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_shipin_tianjiashipin.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_delete.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_a.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_b.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_star.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_stop.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_zanshang_bg_line.png +0 -0
- package/src/asset/Textures/SocialSecond/touxiang_bg_tishikuang.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_huadong.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_huadong_xuanzhong.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_icon_xiazai.png +0 -0
- package/src/asset/Textures/SocialVideo/com_home_btn_close.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_bg_guodu.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jinduanjian.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao_hui.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_play.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_play_big.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_stop.png +0 -0
- package/src/asset/laugh.gif +0 -0
- package/src/asset/npms.png +0 -0
- package/src/asset/pixui.png +0 -0
- package/src/asset/preact.png +0 -0
- package/src/asset/template.html +0 -47
- package/src/common/frame/appsettings.js +0 -111
- package/src/common/frame/common.js +0 -17
- package/src/common/frame/platform-api-callback.js +0 -341
- package/src/common/frame/platform-api.d.ts +0 -156
- package/src/common/frame/platform-api.js +0 -479
- package/src/common/main.less +0 -119
- package/src/pixUIReactComponents/README.md +0 -8
- package/src/pixUIReactComponents/package.json +0 -11
- package/src/pixUIReactComponents/tsconfig.json +0 -45
- package/src/pixUIReactComponents/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
- package/src/pixUIReactUtils/GenerateConstructorAndGeterSeter.js +0 -227
- package/src/pixUIReactUtils/MakeImage.js +0 -207
- package/src/pixUIReactUtils/README.md +0 -124
- package/src/pixUIReactUtils/Version.js +0 -3
- package/src/pixUIReactUtils/img/makeImage.png +0 -0
- package/src/pixUIReactUtils/index.js +0 -1
- package/src/pixUIReactUtils/package.json +0 -16
- package/src/preprocess/index.html +0 -48
- package/src/preprocess/main.tsx +0 -17
- package/src/preprocess/preprocesspage.tsx +0 -41
- /package/{src/pixUIReactComponents/cmdAfterTsBuild.js → cmdAfterTsBuild.js} +0 -0
- /package/{src/pixUIReactComponents/index.js → index.js} +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/EventDispatcherJs.tsx +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/Logger.tsx +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/img/logger.png +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/tools.md +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletItemAnimation.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletScreenAnimation.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/bullet.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/button/Button.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/carousel/Carousel.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/checkBox/CheckBox.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/Dropdown.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownOptionUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownSpreadMainUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownUnspreadMainUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/gradient/GradientText.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/outlinetext/OutlineText.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/progress/Progress.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/slapface/less/Slapface.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/slider/Slider.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tab.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tabs.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/togglegroup/ToggleGroup.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/videoplayer/VideoPlayer.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/WaterfallComponent.jsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/less/WaterfallComponent.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/Images.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/OutlineText/OutlineDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/btn_close.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/changtai_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox0.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox1.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_down.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_up.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/dot.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/inner.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/item_reddot.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/loading.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdown.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdownall.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/outer.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic1.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic2.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic3.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic4.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic5.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic6.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tab_choosed.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tabs_bg.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_pause.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_play.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_reload.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/xuanfu_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/yaxia_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/bulletscreen/BulletDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/button/ButtonDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/carousel/carouselDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/checkBox/checkBoxDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/DropdownDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownOption.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/gradient/GradientDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/less/video.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/progress/ProgressDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/slider/SliderDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TabDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TopTab.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/togglegroup/ToggleGroupDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/videoplayer/VideoPlayerDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/ui.md +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import createListComponent from './createListComponent';
|
|
4
|
-
|
|
5
|
-
import type { Props, ScrollToAlign } from './createListComponent';
|
|
6
|
-
|
|
7
|
-
const FixedSizeList = createListComponent({
|
|
8
|
-
getItemOffset: ({ itemSize }: Props<any>, index: number): number =>
|
|
9
|
-
index * ((itemSize: any): number),
|
|
10
|
-
|
|
11
|
-
getItemSize: ({ itemSize }: Props<any>, index: number): number =>
|
|
12
|
-
((itemSize: any): number),
|
|
13
|
-
|
|
14
|
-
getEstimatedTotalSize: ({ itemCount, itemSize }: Props<any>) =>
|
|
15
|
-
((itemSize: any): number) * itemCount,
|
|
16
|
-
|
|
17
|
-
getOffsetForIndexAndAlignment: (
|
|
18
|
-
{ direction, height, itemCount, itemSize, layout, width }: Props<any>,
|
|
19
|
-
index: number,
|
|
20
|
-
align: ScrollToAlign,
|
|
21
|
-
scrollOffset: number
|
|
22
|
-
): number => {
|
|
23
|
-
// TODO Deprecate direction "horizontal"
|
|
24
|
-
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
25
|
-
const size = (((isHorizontal ? width : height): any): number);
|
|
26
|
-
const lastItemOffset = Math.max(
|
|
27
|
-
0,
|
|
28
|
-
itemCount * ((itemSize: any): number) - size
|
|
29
|
-
);
|
|
30
|
-
const maxOffset = Math.min(
|
|
31
|
-
lastItemOffset,
|
|
32
|
-
index * ((itemSize: any): number)
|
|
33
|
-
);
|
|
34
|
-
const minOffset = Math.max(
|
|
35
|
-
0,
|
|
36
|
-
index * ((itemSize: any): number) - size + ((itemSize: any): number)
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
if (align === 'smart') {
|
|
40
|
-
if (
|
|
41
|
-
scrollOffset >= minOffset - size &&
|
|
42
|
-
scrollOffset <= maxOffset + size
|
|
43
|
-
) {
|
|
44
|
-
align = 'auto';
|
|
45
|
-
} else {
|
|
46
|
-
align = 'center';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
switch (align) {
|
|
51
|
-
case 'start':
|
|
52
|
-
return maxOffset;
|
|
53
|
-
case 'end':
|
|
54
|
-
return minOffset;
|
|
55
|
-
case 'center': {
|
|
56
|
-
// "Centered" offset is usually the average of the min and max.
|
|
57
|
-
// But near the edges of the list, this doesn't hold true.
|
|
58
|
-
const middleOffset = Math.round(
|
|
59
|
-
minOffset + (maxOffset - minOffset) / 2
|
|
60
|
-
);
|
|
61
|
-
if (middleOffset < Math.ceil(size / 2)) {
|
|
62
|
-
return 0; // near the beginning
|
|
63
|
-
} else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
|
|
64
|
-
return lastItemOffset; // near the end
|
|
65
|
-
} else {
|
|
66
|
-
return middleOffset;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
case 'auto':
|
|
70
|
-
default:
|
|
71
|
-
if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
|
|
72
|
-
return scrollOffset;
|
|
73
|
-
} else if (scrollOffset < minOffset) {
|
|
74
|
-
return minOffset;
|
|
75
|
-
} else {
|
|
76
|
-
return maxOffset;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
getStartIndexForOffset: (
|
|
82
|
-
{ itemCount, itemSize }: Props<any>,
|
|
83
|
-
offset: number
|
|
84
|
-
): number =>
|
|
85
|
-
Math.max(
|
|
86
|
-
0,
|
|
87
|
-
Math.min(itemCount - 1, Math.floor(offset / ((itemSize: any): number)))
|
|
88
|
-
),
|
|
89
|
-
|
|
90
|
-
getStopIndexForStartIndex: (
|
|
91
|
-
{ direction, height, itemCount, itemSize, layout, width }: Props<any>,
|
|
92
|
-
startIndex: number,
|
|
93
|
-
scrollOffset: number
|
|
94
|
-
): number => {
|
|
95
|
-
// TODO Deprecate direction "horizontal"
|
|
96
|
-
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
97
|
-
const offset = startIndex * ((itemSize: any): number);
|
|
98
|
-
const size = (((isHorizontal ? width : height): any): number);
|
|
99
|
-
const numVisibleItems = Math.ceil(
|
|
100
|
-
(size + scrollOffset - offset) / ((itemSize: any): number)
|
|
101
|
-
);
|
|
102
|
-
return Math.max(
|
|
103
|
-
0,
|
|
104
|
-
Math.min(
|
|
105
|
-
itemCount - 1,
|
|
106
|
-
startIndex + numVisibleItems - 1 // -1 is because stop index is inclusive
|
|
107
|
-
)
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
initInstanceProps(props: Props<any>): any {
|
|
112
|
-
// Noop
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
shouldResetStyleCacheOnItemSizeChange: true,
|
|
116
|
-
|
|
117
|
-
validateProps: ({ itemSize }: Props<any>): void => {
|
|
118
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
119
|
-
if (typeof itemSize !== 'number') {
|
|
120
|
-
throw Error(
|
|
121
|
-
'An invalid "itemSize" prop has been specified. ' +
|
|
122
|
-
'Value should be a number. ' +
|
|
123
|
-
`"${itemSize === null ? 'null' : typeof itemSize}" was specified.`
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
export default FixedSizeList;
|
|
@@ -1,507 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import createGridComponent from './createGridComponent';
|
|
4
|
-
|
|
5
|
-
import type { Props, ScrollToAlign } from './createGridComponent';
|
|
6
|
-
|
|
7
|
-
const DEFAULT_ESTIMATED_ITEM_SIZE = 50;
|
|
8
|
-
|
|
9
|
-
type VariableSizeProps = {|
|
|
10
|
-
estimatedColumnWidth: number,
|
|
11
|
-
estimatedRowHeight: number,
|
|
12
|
-
...Props<any>,
|
|
13
|
-
|};
|
|
14
|
-
|
|
15
|
-
type itemSizeGetter = (index: number) => number;
|
|
16
|
-
type ItemType = 'column' | 'row';
|
|
17
|
-
|
|
18
|
-
type ItemMetadata = {|
|
|
19
|
-
offset: number,
|
|
20
|
-
size: number,
|
|
21
|
-
|};
|
|
22
|
-
type ItemMetadataMap = { [index: number]: ItemMetadata };
|
|
23
|
-
type InstanceProps = {|
|
|
24
|
-
columnMetadataMap: ItemMetadataMap,
|
|
25
|
-
estimatedColumnWidth: number,
|
|
26
|
-
estimatedRowHeight: number,
|
|
27
|
-
lastMeasuredColumnIndex: number,
|
|
28
|
-
lastMeasuredRowIndex: number,
|
|
29
|
-
rowMetadataMap: ItemMetadataMap,
|
|
30
|
-
|};
|
|
31
|
-
|
|
32
|
-
const getEstimatedTotalHeight = (
|
|
33
|
-
{ rowCount }: Props<any>,
|
|
34
|
-
{ rowMetadataMap, estimatedRowHeight, lastMeasuredRowIndex }: InstanceProps
|
|
35
|
-
) => {
|
|
36
|
-
let totalSizeOfMeasuredRows = 0;
|
|
37
|
-
|
|
38
|
-
// Edge case check for when the number of items decreases while a scroll is in progress.
|
|
39
|
-
// https://github.com/bvaughn/react-window/pull/138
|
|
40
|
-
if (lastMeasuredRowIndex >= rowCount) {
|
|
41
|
-
lastMeasuredRowIndex = rowCount - 1;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (lastMeasuredRowIndex >= 0) {
|
|
45
|
-
const itemMetadata = rowMetadataMap[lastMeasuredRowIndex];
|
|
46
|
-
totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const numUnmeasuredItems = rowCount - lastMeasuredRowIndex - 1;
|
|
50
|
-
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedRowHeight;
|
|
51
|
-
|
|
52
|
-
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const getEstimatedTotalWidth = (
|
|
56
|
-
{ columnCount }: Props<any>,
|
|
57
|
-
{
|
|
58
|
-
columnMetadataMap,
|
|
59
|
-
estimatedColumnWidth,
|
|
60
|
-
lastMeasuredColumnIndex,
|
|
61
|
-
}: InstanceProps
|
|
62
|
-
) => {
|
|
63
|
-
let totalSizeOfMeasuredRows = 0;
|
|
64
|
-
|
|
65
|
-
// Edge case check for when the number of items decreases while a scroll is in progress.
|
|
66
|
-
// https://github.com/bvaughn/react-window/pull/138
|
|
67
|
-
if (lastMeasuredColumnIndex >= columnCount) {
|
|
68
|
-
lastMeasuredColumnIndex = columnCount - 1;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (lastMeasuredColumnIndex >= 0) {
|
|
72
|
-
const itemMetadata = columnMetadataMap[lastMeasuredColumnIndex];
|
|
73
|
-
totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const numUnmeasuredItems = columnCount - lastMeasuredColumnIndex - 1;
|
|
77
|
-
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedColumnWidth;
|
|
78
|
-
|
|
79
|
-
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const getItemMetadata = (
|
|
83
|
-
itemType: ItemType,
|
|
84
|
-
props: Props<any>,
|
|
85
|
-
index: number,
|
|
86
|
-
instanceProps: InstanceProps
|
|
87
|
-
): ItemMetadata => {
|
|
88
|
-
let itemMetadataMap, itemSize, lastMeasuredIndex;
|
|
89
|
-
if (itemType === 'column') {
|
|
90
|
-
itemMetadataMap = instanceProps.columnMetadataMap;
|
|
91
|
-
itemSize = ((props.columnWidth: any): itemSizeGetter);
|
|
92
|
-
lastMeasuredIndex = instanceProps.lastMeasuredColumnIndex;
|
|
93
|
-
} else {
|
|
94
|
-
itemMetadataMap = instanceProps.rowMetadataMap;
|
|
95
|
-
itemSize = ((props.rowHeight: any): itemSizeGetter);
|
|
96
|
-
lastMeasuredIndex = instanceProps.lastMeasuredRowIndex;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (index > lastMeasuredIndex) {
|
|
100
|
-
let offset = 0;
|
|
101
|
-
if (lastMeasuredIndex >= 0) {
|
|
102
|
-
const itemMetadata = itemMetadataMap[lastMeasuredIndex];
|
|
103
|
-
offset = itemMetadata.offset + itemMetadata.size;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (let i = lastMeasuredIndex + 1; i <= index; i++) {
|
|
107
|
-
let size = itemSize(i);
|
|
108
|
-
|
|
109
|
-
itemMetadataMap[i] = {
|
|
110
|
-
offset,
|
|
111
|
-
size,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
offset += size;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (itemType === 'column') {
|
|
118
|
-
instanceProps.lastMeasuredColumnIndex = index;
|
|
119
|
-
} else {
|
|
120
|
-
instanceProps.lastMeasuredRowIndex = index;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return itemMetadataMap[index];
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const findNearestItem = (
|
|
128
|
-
itemType: ItemType,
|
|
129
|
-
props: Props<any>,
|
|
130
|
-
instanceProps: InstanceProps,
|
|
131
|
-
offset: number
|
|
132
|
-
) => {
|
|
133
|
-
let itemMetadataMap, lastMeasuredIndex;
|
|
134
|
-
if (itemType === 'column') {
|
|
135
|
-
itemMetadataMap = instanceProps.columnMetadataMap;
|
|
136
|
-
lastMeasuredIndex = instanceProps.lastMeasuredColumnIndex;
|
|
137
|
-
} else {
|
|
138
|
-
itemMetadataMap = instanceProps.rowMetadataMap;
|
|
139
|
-
lastMeasuredIndex = instanceProps.lastMeasuredRowIndex;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const lastMeasuredItemOffset =
|
|
143
|
-
lastMeasuredIndex > 0 ? itemMetadataMap[lastMeasuredIndex].offset : 0;
|
|
144
|
-
|
|
145
|
-
if (lastMeasuredItemOffset >= offset) {
|
|
146
|
-
// If we've already measured items within this range just use a binary search as it's faster.
|
|
147
|
-
return findNearestItemBinarySearch(
|
|
148
|
-
itemType,
|
|
149
|
-
props,
|
|
150
|
-
instanceProps,
|
|
151
|
-
lastMeasuredIndex,
|
|
152
|
-
0,
|
|
153
|
-
offset
|
|
154
|
-
);
|
|
155
|
-
} else {
|
|
156
|
-
// If we haven't yet measured this high, fallback to an exponential search with an inner binary search.
|
|
157
|
-
// The exponential search avoids pre-computing sizes for the full set of items as a binary search would.
|
|
158
|
-
// The overall complexity for this approach is O(log n).
|
|
159
|
-
return findNearestItemExponentialSearch(
|
|
160
|
-
itemType,
|
|
161
|
-
props,
|
|
162
|
-
instanceProps,
|
|
163
|
-
Math.max(0, lastMeasuredIndex),
|
|
164
|
-
offset
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const findNearestItemBinarySearch = (
|
|
170
|
-
itemType: ItemType,
|
|
171
|
-
props: Props<any>,
|
|
172
|
-
instanceProps: InstanceProps,
|
|
173
|
-
high: number,
|
|
174
|
-
low: number,
|
|
175
|
-
offset: number
|
|
176
|
-
): number => {
|
|
177
|
-
while (low <= high) {
|
|
178
|
-
const middle = low + Math.floor((high - low) / 2);
|
|
179
|
-
const currentOffset = getItemMetadata(
|
|
180
|
-
itemType,
|
|
181
|
-
props,
|
|
182
|
-
middle,
|
|
183
|
-
instanceProps
|
|
184
|
-
).offset;
|
|
185
|
-
|
|
186
|
-
if (currentOffset === offset) {
|
|
187
|
-
return middle;
|
|
188
|
-
} else if (currentOffset < offset) {
|
|
189
|
-
low = middle + 1;
|
|
190
|
-
} else if (currentOffset > offset) {
|
|
191
|
-
high = middle - 1;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (low > 0) {
|
|
196
|
-
return low - 1;
|
|
197
|
-
} else {
|
|
198
|
-
return 0;
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const findNearestItemExponentialSearch = (
|
|
203
|
-
itemType: ItemType,
|
|
204
|
-
props: Props<any>,
|
|
205
|
-
instanceProps: InstanceProps,
|
|
206
|
-
index: number,
|
|
207
|
-
offset: number
|
|
208
|
-
): number => {
|
|
209
|
-
const itemCount = itemType === 'column' ? props.columnCount : props.rowCount;
|
|
210
|
-
let interval = 1;
|
|
211
|
-
|
|
212
|
-
while (
|
|
213
|
-
index < itemCount &&
|
|
214
|
-
getItemMetadata(itemType, props, index, instanceProps).offset < offset
|
|
215
|
-
) {
|
|
216
|
-
index += interval;
|
|
217
|
-
interval *= 2;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return findNearestItemBinarySearch(
|
|
221
|
-
itemType,
|
|
222
|
-
props,
|
|
223
|
-
instanceProps,
|
|
224
|
-
Math.min(index, itemCount - 1),
|
|
225
|
-
Math.floor(index / 2),
|
|
226
|
-
offset
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const getOffsetForIndexAndAlignment = (
|
|
231
|
-
itemType: ItemType,
|
|
232
|
-
props: Props<any>,
|
|
233
|
-
index: number,
|
|
234
|
-
align: ScrollToAlign,
|
|
235
|
-
scrollOffset: number,
|
|
236
|
-
instanceProps: InstanceProps,
|
|
237
|
-
scrollbarSize: number
|
|
238
|
-
): number => {
|
|
239
|
-
const size = itemType === 'column' ? props.width : props.height;
|
|
240
|
-
const itemMetadata = getItemMetadata(itemType, props, index, instanceProps);
|
|
241
|
-
|
|
242
|
-
// Get estimated total size after ItemMetadata is computed,
|
|
243
|
-
// To ensure it reflects actual measurements instead of just estimates.
|
|
244
|
-
const estimatedTotalSize =
|
|
245
|
-
itemType === 'column'
|
|
246
|
-
? getEstimatedTotalWidth(props, instanceProps)
|
|
247
|
-
: getEstimatedTotalHeight(props, instanceProps);
|
|
248
|
-
|
|
249
|
-
const maxOffset = Math.max(
|
|
250
|
-
0,
|
|
251
|
-
Math.min(estimatedTotalSize - size, itemMetadata.offset)
|
|
252
|
-
);
|
|
253
|
-
const minOffset = Math.max(
|
|
254
|
-
0,
|
|
255
|
-
itemMetadata.offset - size + scrollbarSize + itemMetadata.size
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
if (align === 'smart') {
|
|
259
|
-
if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
|
|
260
|
-
align = 'auto';
|
|
261
|
-
} else {
|
|
262
|
-
align = 'center';
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
switch (align) {
|
|
267
|
-
case 'start':
|
|
268
|
-
return maxOffset;
|
|
269
|
-
case 'end':
|
|
270
|
-
return minOffset;
|
|
271
|
-
case 'center':
|
|
272
|
-
return Math.round(minOffset + (maxOffset - minOffset) / 2);
|
|
273
|
-
case 'auto':
|
|
274
|
-
default:
|
|
275
|
-
if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
|
|
276
|
-
return scrollOffset;
|
|
277
|
-
} else if (minOffset > maxOffset) {
|
|
278
|
-
// Because we only take into account the scrollbar size when calculating minOffset
|
|
279
|
-
// this value can be larger than maxOffset when at the end of the list
|
|
280
|
-
return minOffset;
|
|
281
|
-
} else if (scrollOffset < minOffset) {
|
|
282
|
-
return minOffset;
|
|
283
|
-
} else {
|
|
284
|
-
return maxOffset;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const VariableSizeGrid = createGridComponent({
|
|
290
|
-
getColumnOffset: (
|
|
291
|
-
props: Props<any>,
|
|
292
|
-
index: number,
|
|
293
|
-
instanceProps: InstanceProps
|
|
294
|
-
): number => getItemMetadata('column', props, index, instanceProps).offset,
|
|
295
|
-
|
|
296
|
-
getColumnStartIndexForOffset: (
|
|
297
|
-
props: Props<any>,
|
|
298
|
-
scrollLeft: number,
|
|
299
|
-
instanceProps: InstanceProps
|
|
300
|
-
): number => findNearestItem('column', props, instanceProps, scrollLeft),
|
|
301
|
-
|
|
302
|
-
getColumnStopIndexForStartIndex: (
|
|
303
|
-
props: Props<any>,
|
|
304
|
-
startIndex: number,
|
|
305
|
-
scrollLeft: number,
|
|
306
|
-
instanceProps: InstanceProps
|
|
307
|
-
): number => {
|
|
308
|
-
const { columnCount, width } = props;
|
|
309
|
-
|
|
310
|
-
const itemMetadata = getItemMetadata(
|
|
311
|
-
'column',
|
|
312
|
-
props,
|
|
313
|
-
startIndex,
|
|
314
|
-
instanceProps
|
|
315
|
-
);
|
|
316
|
-
const maxOffset = scrollLeft + width;
|
|
317
|
-
|
|
318
|
-
let offset = itemMetadata.offset + itemMetadata.size;
|
|
319
|
-
let stopIndex = startIndex;
|
|
320
|
-
|
|
321
|
-
while (stopIndex < columnCount - 1 && offset < maxOffset) {
|
|
322
|
-
stopIndex++;
|
|
323
|
-
offset += getItemMetadata('column', props, stopIndex, instanceProps).size;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return stopIndex;
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
getColumnWidth: (
|
|
330
|
-
props: Props<any>,
|
|
331
|
-
index: number,
|
|
332
|
-
instanceProps: InstanceProps
|
|
333
|
-
): number => instanceProps.columnMetadataMap[index].size,
|
|
334
|
-
|
|
335
|
-
getEstimatedTotalHeight,
|
|
336
|
-
getEstimatedTotalWidth,
|
|
337
|
-
|
|
338
|
-
getOffsetForColumnAndAlignment: (
|
|
339
|
-
props: Props<any>,
|
|
340
|
-
index: number,
|
|
341
|
-
align: ScrollToAlign,
|
|
342
|
-
scrollOffset: number,
|
|
343
|
-
instanceProps: InstanceProps,
|
|
344
|
-
scrollbarSize: number
|
|
345
|
-
): number =>
|
|
346
|
-
getOffsetForIndexAndAlignment(
|
|
347
|
-
'column',
|
|
348
|
-
props,
|
|
349
|
-
index,
|
|
350
|
-
align,
|
|
351
|
-
scrollOffset,
|
|
352
|
-
instanceProps,
|
|
353
|
-
scrollbarSize
|
|
354
|
-
),
|
|
355
|
-
|
|
356
|
-
getOffsetForRowAndAlignment: (
|
|
357
|
-
props: Props<any>,
|
|
358
|
-
index: number,
|
|
359
|
-
align: ScrollToAlign,
|
|
360
|
-
scrollOffset: number,
|
|
361
|
-
instanceProps: InstanceProps,
|
|
362
|
-
scrollbarSize: number
|
|
363
|
-
): number =>
|
|
364
|
-
getOffsetForIndexAndAlignment(
|
|
365
|
-
'row',
|
|
366
|
-
props,
|
|
367
|
-
index,
|
|
368
|
-
align,
|
|
369
|
-
scrollOffset,
|
|
370
|
-
instanceProps,
|
|
371
|
-
scrollbarSize
|
|
372
|
-
),
|
|
373
|
-
|
|
374
|
-
getRowOffset: (
|
|
375
|
-
props: Props<any>,
|
|
376
|
-
index: number,
|
|
377
|
-
instanceProps: InstanceProps
|
|
378
|
-
): number => getItemMetadata('row', props, index, instanceProps).offset,
|
|
379
|
-
|
|
380
|
-
getRowHeight: (
|
|
381
|
-
props: Props<any>,
|
|
382
|
-
index: number,
|
|
383
|
-
instanceProps: InstanceProps
|
|
384
|
-
): number => instanceProps.rowMetadataMap[index].size,
|
|
385
|
-
|
|
386
|
-
getRowStartIndexForOffset: (
|
|
387
|
-
props: Props<any>,
|
|
388
|
-
scrollTop: number,
|
|
389
|
-
instanceProps: InstanceProps
|
|
390
|
-
): number => findNearestItem('row', props, instanceProps, scrollTop),
|
|
391
|
-
|
|
392
|
-
getRowStopIndexForStartIndex: (
|
|
393
|
-
props: Props<any>,
|
|
394
|
-
startIndex: number,
|
|
395
|
-
scrollTop: number,
|
|
396
|
-
instanceProps: InstanceProps
|
|
397
|
-
): number => {
|
|
398
|
-
const { rowCount, height } = props;
|
|
399
|
-
|
|
400
|
-
const itemMetadata = getItemMetadata(
|
|
401
|
-
'row',
|
|
402
|
-
props,
|
|
403
|
-
startIndex,
|
|
404
|
-
instanceProps
|
|
405
|
-
);
|
|
406
|
-
const maxOffset = scrollTop + height;
|
|
407
|
-
|
|
408
|
-
let offset = itemMetadata.offset + itemMetadata.size;
|
|
409
|
-
let stopIndex = startIndex;
|
|
410
|
-
|
|
411
|
-
while (stopIndex < rowCount - 1 && offset < maxOffset) {
|
|
412
|
-
stopIndex++;
|
|
413
|
-
offset += getItemMetadata('row', props, stopIndex, instanceProps).size;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return stopIndex;
|
|
417
|
-
},
|
|
418
|
-
|
|
419
|
-
initInstanceProps(props: Props<any>, instance: any): InstanceProps {
|
|
420
|
-
const {
|
|
421
|
-
estimatedColumnWidth,
|
|
422
|
-
estimatedRowHeight,
|
|
423
|
-
} = ((props: any): VariableSizeProps);
|
|
424
|
-
|
|
425
|
-
const instanceProps = {
|
|
426
|
-
columnMetadataMap: {},
|
|
427
|
-
estimatedColumnWidth: estimatedColumnWidth || DEFAULT_ESTIMATED_ITEM_SIZE,
|
|
428
|
-
estimatedRowHeight: estimatedRowHeight || DEFAULT_ESTIMATED_ITEM_SIZE,
|
|
429
|
-
lastMeasuredColumnIndex: -1,
|
|
430
|
-
lastMeasuredRowIndex: -1,
|
|
431
|
-
rowMetadataMap: {},
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
instance.resetAfterColumnIndex = (
|
|
435
|
-
columnIndex: number,
|
|
436
|
-
shouldForceUpdate?: boolean = true
|
|
437
|
-
) => {
|
|
438
|
-
instance.resetAfterIndices({ columnIndex, shouldForceUpdate });
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
instance.resetAfterRowIndex = (
|
|
442
|
-
rowIndex: number,
|
|
443
|
-
shouldForceUpdate?: boolean = true
|
|
444
|
-
) => {
|
|
445
|
-
instance.resetAfterIndices({ rowIndex, shouldForceUpdate });
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
instance.resetAfterIndices = ({
|
|
449
|
-
columnIndex,
|
|
450
|
-
rowIndex,
|
|
451
|
-
shouldForceUpdate = true,
|
|
452
|
-
}: {
|
|
453
|
-
columnIndex?: number,
|
|
454
|
-
rowIndex?: number,
|
|
455
|
-
shouldForceUpdate: boolean,
|
|
456
|
-
}) => {
|
|
457
|
-
if (typeof columnIndex === 'number') {
|
|
458
|
-
instanceProps.lastMeasuredColumnIndex = Math.min(
|
|
459
|
-
instanceProps.lastMeasuredColumnIndex,
|
|
460
|
-
columnIndex - 1
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
if (typeof rowIndex === 'number') {
|
|
464
|
-
instanceProps.lastMeasuredRowIndex = Math.min(
|
|
465
|
-
instanceProps.lastMeasuredRowIndex,
|
|
466
|
-
rowIndex - 1
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// We could potentially optimize further by only evicting styles after this index,
|
|
471
|
-
// But since styles are only cached while scrolling is in progress-
|
|
472
|
-
// It seems an unnecessary optimization.
|
|
473
|
-
// It's unlikely that resetAfterIndex() will be called while a user is scrolling.
|
|
474
|
-
instance._getItemStyleCache(-1);
|
|
475
|
-
|
|
476
|
-
if (shouldForceUpdate) {
|
|
477
|
-
instance.forceUpdate();
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
return instanceProps;
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
shouldResetStyleCacheOnItemSizeChange: false,
|
|
485
|
-
|
|
486
|
-
validateProps: ({ columnWidth, rowHeight }: Props<any>): void => {
|
|
487
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
488
|
-
if (typeof columnWidth !== 'function') {
|
|
489
|
-
throw Error(
|
|
490
|
-
'An invalid "columnWidth" prop has been specified. ' +
|
|
491
|
-
'Value should be a function. ' +
|
|
492
|
-
`"${
|
|
493
|
-
columnWidth === null ? 'null' : typeof columnWidth
|
|
494
|
-
}" was specified.`
|
|
495
|
-
);
|
|
496
|
-
} else if (typeof rowHeight !== 'function') {
|
|
497
|
-
throw Error(
|
|
498
|
-
'An invalid "rowHeight" prop has been specified. ' +
|
|
499
|
-
'Value should be a function. ' +
|
|
500
|
-
`"${rowHeight === null ? 'null' : typeof rowHeight}" was specified.`
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
export default VariableSizeGrid;
|