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.
Files changed (400) hide show
  1. package/README.md +5 -6
  2. package/package.json +9 -66
  3. package/tsconfig.json +27 -13
  4. package/{src/pixUIReactComponents/ui → ui}/components/slapface/Slapface.tsx +17 -17
  5. package/ui/sample/Slapface/SlapfaceDemo.tsx +30 -0
  6. package/.eslintignore +0 -7
  7. package/.eslintrc.js +0 -48
  8. package/.pixiderc/apps.json +0 -12
  9. package/.pixiderc/devel-config.meta.json +0 -23
  10. package/.pixiderc/postinstall.js +0 -17
  11. package/.pixiderc/util.js +0 -136
  12. package/.pixiderc/webpack.js +0 -180
  13. package/faas/helloworld.js +0 -8
  14. package/gen/pbo/pandora_pb.d.ts +0 -1179
  15. package/gen/pbo/pandora_pb.js +0 -10475
  16. package/gen/pbo/pandora_pb_service.d.ts +0 -1317
  17. package/gen/pbo/pandora_pb_service.js +0 -2307
  18. package/gen/pbo/test_pb.d.ts +0 -99
  19. package/gen/pbo/test_pb.js +0 -889
  20. package/gen/pbo/test_pb_service.d.ts +0 -82
  21. package/gen/pbo/test_pb_service.js +0 -117
  22. package/lib/assets/border.png +0 -0
  23. package/lib/assets/check.html +0 -54
  24. package/lib/assets/pixui.png +0 -0
  25. package/lib/assets/preact.png +0 -0
  26. package/lib/check/main.less +0 -63
  27. package/lib/check/main.tsx +0 -42
  28. package/lib/check/tool.js +0 -3
  29. package/lib/check/util.tsx +0 -107
  30. package/lib/dom.ts +0 -16
  31. package/lib/ext.d.ts +0 -95
  32. package/lib/grpc-web/dist/ChunkParser.js +0 -115
  33. package/lib/grpc-web/dist/ChunkParser.js.map +0 -1
  34. package/lib/grpc-web/dist/Code.js +0 -58
  35. package/lib/grpc-web/dist/Code.js.map +0 -1
  36. package/lib/grpc-web/dist/client.js +0 -299
  37. package/lib/grpc-web/dist/client.js.map +0 -1
  38. package/lib/grpc-web/dist/debug.js +0 -16
  39. package/lib/grpc-web/dist/debug.js.map +0 -1
  40. package/lib/grpc-web/dist/detach.js +0 -7
  41. package/lib/grpc-web/dist/detach.js.map +0 -1
  42. package/lib/grpc-web/dist/index.js +0 -29
  43. package/lib/grpc-web/dist/index.js.map +0 -1
  44. package/lib/grpc-web/dist/invoke.js +0 -32
  45. package/lib/grpc-web/dist/invoke.js.map +0 -1
  46. package/lib/grpc-web/dist/message.js +0 -3
  47. package/lib/grpc-web/dist/message.js.map +0 -1
  48. package/lib/grpc-web/dist/metadata.js +0 -5
  49. package/lib/grpc-web/dist/metadata.js.map +0 -1
  50. package/lib/grpc-web/dist/service.js +0 -3
  51. package/lib/grpc-web/dist/service.js.map +0 -1
  52. package/lib/grpc-web/dist/transports/Transport.js +0 -13
  53. package/lib/grpc-web/dist/transports/Transport.js.map +0 -1
  54. package/lib/grpc-web/dist/transports/http/fetch.js +0 -112
  55. package/lib/grpc-web/dist/transports/http/fetch.js.map +0 -1
  56. package/lib/grpc-web/dist/transports/http/http.js +0 -15
  57. package/lib/grpc-web/dist/transports/http/http.js.map +0 -1
  58. package/lib/grpc-web/dist/transports/http/xhr.js +0 -127
  59. package/lib/grpc-web/dist/transports/http/xhr.js.map +0 -1
  60. package/lib/grpc-web/dist/transports/http/xhrUtil.js +0 -37
  61. package/lib/grpc-web/dist/transports/http/xhrUtil.js.map +0 -1
  62. package/lib/grpc-web/dist/transports/websocket/websocket.js +0 -95
  63. package/lib/grpc-web/dist/transports/websocket/websocket.js.map +0 -1
  64. package/lib/grpc-web/dist/typings/ChunkParser.d.ts +0 -17
  65. package/lib/grpc-web/dist/typings/Code.d.ts +0 -20
  66. package/lib/grpc-web/dist/typings/client.d.ts +0 -22
  67. package/lib/grpc-web/dist/typings/debug.d.ts +0 -1
  68. package/lib/grpc-web/dist/typings/detach.d.ts +0 -1
  69. package/lib/grpc-web/dist/typings/index.d.ts +0 -60
  70. package/lib/grpc-web/dist/typings/invoke.d.ts +0 -17
  71. package/lib/grpc-web/dist/typings/message.d.ts +0 -8
  72. package/lib/grpc-web/dist/typings/metadata.d.ts +0 -2
  73. package/lib/grpc-web/dist/typings/service.d.ts +0 -16
  74. package/lib/grpc-web/dist/typings/transports/Transport.d.ts +0 -22
  75. package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +0 -6
  76. package/lib/grpc-web/dist/typings/transports/http/http.d.ts +0 -5
  77. package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +0 -27
  78. package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +0 -3
  79. package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +0 -2
  80. package/lib/grpc-web/dist/typings/unary.d.ts +0 -20
  81. package/lib/grpc-web/dist/typings/util.d.ts +0 -2
  82. package/lib/grpc-web/dist/unary.js +0 -44
  83. package/lib/grpc-web/dist/unary.js.map +0 -1
  84. package/lib/grpc-web/dist/util.js +0 -11
  85. package/lib/grpc-web/dist/util.js.map +0 -1
  86. package/lib/grpcTransport/PixHttp2Transport.ts +0 -104
  87. package/lib/grpcTransport/PixLuaTransport.ts +0 -80
  88. package/lib/pi_component/tinyList/tinyList.js +0 -573
  89. package/lib/pi_component/tinyList/tinyList.tsx +0 -586
  90. package/lib/preact/compat/src/Children.js +0 -26
  91. package/lib/preact/compat/src/PureComponent.js +0 -19
  92. package/lib/preact/compat/src/events.js +0 -36
  93. package/lib/preact/compat/src/forwardRef.js +0 -29
  94. package/lib/preact/compat/src/index.d.ts +0 -121
  95. package/lib/preact/compat/src/index.js +0 -159
  96. package/lib/preact/compat/src/internal.d.ts +0 -45
  97. package/lib/preact/compat/src/memo.js +0 -34
  98. package/lib/preact/compat/src/portals.js +0 -85
  99. package/lib/preact/compat/src/render.js +0 -166
  100. package/lib/preact/compat/src/suspense-list.d.ts +0 -14
  101. package/lib/preact/compat/src/suspense-list.js +0 -127
  102. package/lib/preact/compat/src/suspense.d.ts +0 -15
  103. package/lib/preact/compat/src/suspense.js +0 -165
  104. package/lib/preact/compat/src/util.js +0 -23
  105. package/lib/preact/hooks/src/index.d.ts +0 -133
  106. package/lib/preact/hooks/src/index.js +0 -339
  107. package/lib/preact/hooks/src/internal.d.ts +0 -55
  108. package/lib/preact/src/clone-element.js +0 -27
  109. package/lib/preact/src/compat.ts +0 -0
  110. package/lib/preact/src/component.js +0 -219
  111. package/lib/preact/src/constants.js +0 -3
  112. package/lib/preact/src/create-context.js +0 -55
  113. package/lib/preact/src/create-element.js +0 -102
  114. package/lib/preact/src/css.d.ts +0 -30341
  115. package/lib/preact/src/diff/catch-error.js +0 -41
  116. package/lib/preact/src/diff/children.js +0 -259
  117. package/lib/preact/src/diff/index.js +0 -445
  118. package/lib/preact/src/diff/props.js +0 -163
  119. package/lib/preact/src/index.d.ts +0 -275
  120. package/lib/preact/src/index.js +0 -14
  121. package/lib/preact/src/internal.d.ts +0 -94
  122. package/lib/preact/src/jsx.d.ts +0 -884
  123. package/lib/preact/src/options.js +0 -16
  124. package/lib/preact/src/render.js +0 -98
  125. package/lib/preact/src/util.js +0 -25
  126. package/lib/preact-router/.travis.yml +0 -3
  127. package/lib/preact-router/LICENSE +0 -21
  128. package/lib/preact-router/README.md +0 -254
  129. package/lib/preact-router/index.d.ts +0 -71
  130. package/lib/preact-router/match/index.d.ts +0 -16
  131. package/lib/preact-router/match/package.json +0 -13
  132. package/lib/preact-router/match/src/cjs.js +0 -4
  133. package/lib/preact-router/match/src/index.js +0 -36
  134. package/lib/preact-router/package-lock.json +0 -12330
  135. package/lib/preact-router/package.json +0 -78
  136. package/lib/preact-router/src/cjs.js +0 -11
  137. package/lib/preact-router/src/index.js +0 -270
  138. package/lib/preact-router/src/util.js +0 -87
  139. package/lib/react-window/src/FixedSizeGrid.js +0 -244
  140. package/lib/react-window/src/FixedSizeList.js +0 -130
  141. package/lib/react-window/src/VariableSizeGrid.js +0 -507
  142. package/lib/react-window/src/VariableSizeList.js +0 -316
  143. package/lib/react-window/src/__tests__/FixedSizeGrid.js +0 -1336
  144. package/lib/react-window/src/__tests__/FixedSizeList.js +0 -966
  145. package/lib/react-window/src/__tests__/VariableSizeGrid.js +0 -779
  146. package/lib/react-window/src/__tests__/VariableSizeList.js +0 -442
  147. package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +0 -912
  148. package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +0 -568
  149. package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +0 -542
  150. package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +0 -331
  151. package/lib/react-window/src/__tests__/areEqual.js +0 -32
  152. package/lib/react-window/src/__tests__/shouldComponentUpdate.js +0 -36
  153. package/lib/react-window/src/areEqual.js +0 -18
  154. package/lib/react-window/src/createGridComponent.js +0 -919
  155. package/lib/react-window/src/createListComponent.js +0 -729
  156. package/lib/react-window/src/domHelpers.js +0 -72
  157. package/lib/react-window/src/index.js +0 -9
  158. package/lib/react-window/src/shallowDiffers.js +0 -17
  159. package/lib/react-window/src/shouldComponentUpdate.js +0 -16
  160. package/lib/react-window/src/test.js.flow +0 -382
  161. package/lib/react-window/src/timer.js +0 -36
  162. package/src/app/demopage.tsx +0 -77
  163. package/src/app/index.html +0 -48
  164. package/src/app/main.tsx +0 -30
  165. package/src/asset/Textures/Alert/bg_tips.png +0 -0
  166. package/src/asset/Textures/Alert/btn_zhedie_a.png +0 -0
  167. package/src/asset/Textures/Alert/com_home_bg_left.png +0 -0
  168. package/src/asset/Textures/Alert/com_home_bg_rightbar.png +0 -0
  169. package/src/asset/Textures/Commons/com_home_bg_a.png +0 -0
  170. package/src/asset/Textures/Commons/com_home_bg_back_top.png +0 -0
  171. package/src/asset/Textures/Commons/com_home_bg_bottombar_sheet.png +0 -0
  172. package/src/asset/Textures/Commons/com_home_bg_list_xiala.png +0 -0
  173. package/src/asset/Textures/Commons/com_home_bg_rightbar_line.png +0 -0
  174. package/src/asset/Textures/Commons/com_home_bg_rightbar_selected.png +0 -0
  175. package/src/asset/Textures/Commons/com_home_bg_touxiang_140.png +0 -0
  176. package/src/asset/Textures/Commons/com_home_bg_touxiang_60.png +0 -0
  177. package/src/asset/Textures/Commons/com_home_bg_touxiang_80.png +0 -0
  178. package/src/asset/Textures/Commons/com_home_btn_back.png +0 -0
  179. package/src/asset/Textures/Commons/com_home_btn_bottombar.png +0 -0
  180. package/src/asset/Textures/Commons/com_home_btn_bottombar_fadongtai.png +0 -0
  181. package/src/asset/Textures/Commons/com_home_btn_close.png +0 -0
  182. package/src/asset/Textures/Commons/com_home_btn_guanzhu_126.png +0 -0
  183. package/src/asset/Textures/Commons/com_home_btn_guanzhu_86.png +0 -0
  184. package/src/asset/Textures/Commons/com_home_btn_left_bianji.png +0 -0
  185. package/src/asset/Textures/Commons/com_home_btn_left_dongtai.png +0 -0
  186. package/src/asset/Textures/Commons/com_home_btn_left_touxiang.png +0 -0
  187. package/src/asset/Textures/Commons/com_home_btn_selet.png +0 -0
  188. package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_126.png +0 -0
  189. package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_86.png +0 -0
  190. package/src/asset/Textures/Commons/com_home_icon_bottombar_fadongtai.png +0 -0
  191. package/src/asset/Textures/Commons/com_home_icon_bottombar_red.png +0 -0
  192. package/src/asset/Textures/Commons/com_home_icon_loading.png +0 -0
  193. package/src/asset/Textures/Commons/com_home_pic_touxiang_moren.png +0 -0
  194. package/src/asset/Textures/Commons/com_home_tab_left_a.png +0 -0
  195. package/src/asset/Textures/Commons/com_home_tab_left_b.png +0 -0
  196. package/src/asset/Textures/Commons/com_home_tab_left_c.png +0 -0
  197. package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_v.png +0 -0
  198. package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_yonghurenzheng.png +0 -0
  199. package/src/asset/Textures/Commons/feedItems/pinglun_bg.png +0 -0
  200. package/src/asset/Textures/Commons/feedItems/pinglun_bg_line.png +0 -0
  201. package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_chakan.png +0 -0
  202. package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_input.png +0 -0
  203. package/src/asset/Textures/Commons/feedItems/pinglun_bg_zan.png +0 -0
  204. package/src/asset/Textures/Commons/feedItems/pinglun_btn_middle_input.png +0 -0
  205. package/src/asset/Textures/Commons/feedItems/pinglun_btn_more.png +0 -0
  206. package/src/asset/Textures/Commons/feedItems/pinglun_btn_normal.png +0 -0
  207. package/src/asset/Textures/Commons/feedItems/pinglun_btn_photo_more.png +0 -0
  208. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a.png +0 -0
  209. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a_shadow.png +0 -0
  210. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_normal.png +0 -0
  211. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_pressed.png +0 -0
  212. package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_normal.png +0 -0
  213. package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_pressed.png +0 -0
  214. package/src/asset/Textures/Commons/feedItems/pinglun_icon_b_normal.png +0 -0
  215. package/src/asset/Textures/Commons/feedItems/pinglun_icon_c_normal.png +0 -0
  216. package/src/asset/Textures/Commons/feedItems/pinglun_icon_d.png +0 -0
  217. package/src/asset/Textures/Commons/feedItems/pinglun_icon_e.png +0 -0
  218. package/src/asset/Textures/Commons/feedItems/pinglun_icon_f_share.png +0 -0
  219. package/src/asset/Textures/Commons/feedItems/pinglun_icon_middle_input_back.png +0 -0
  220. package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn.png +0 -0
  221. package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn_pressd.png +0 -0
  222. package/src/asset/Textures/Commons/karaoke/rukou_bg_music.png +0 -0
  223. package/src/asset/Textures/Commons/karaoke/rukou_btn_a.png +0 -0
  224. package/src/asset/Textures/Commons/karaoke/rukou_btn_b.png +0 -0
  225. package/src/asset/Textures/Commons/karaoke/rukou_icon_b.png +0 -0
  226. package/src/asset/Textures/Commons/karaoke/rukou_icon_d.png +0 -0
  227. package/src/asset/Textures/Commons/karaoke/rukou_icon_e.png +0 -0
  228. package/src/asset/Textures/Commons/rukou_bg_bottombar_line.png +0 -0
  229. package/src/asset/Textures/Commons/rukou_icon_a.png +0 -0
  230. package/src/asset/Textures/Commons/tc_bianji_tab_a.png +0 -0
  231. package/src/asset/Textures/Commons/tc_zanshang_bg_line.png +0 -0
  232. package/src/asset/Textures/Commons/touxiang_bg_tishikuang.png +0 -0
  233. package/src/asset/Textures/Commons/video/rukou_icon_shipin.png +0 -0
  234. package/src/asset/Textures/Commons/video/xiangce_btn_bofang.png +0 -0
  235. package/src/asset/Textures/Commons/voice/rukou_icon_yuyin.png +0 -0
  236. package/src/asset/Textures/Commons/voice/tc_yuyin_bg.png +0 -0
  237. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_load.png +0 -0
  238. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_a.png +0 -0
  239. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_b.png +0 -0
  240. package/src/asset/Textures/Commons/xiangce_icon_bottombar_gulita.png +0 -0
  241. package/src/asset/Textures/SocialSecond/com_tc_bg.png +0 -0
  242. package/src/asset/Textures/SocialSecond/com_tc_bg_bottom.png +0 -0
  243. package/src/asset/Textures/SocialSecond/com_tc_bg_input.png +0 -0
  244. package/src/asset/Textures/SocialSecond/com_tc_bg_tips.png +0 -0
  245. package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_a.png +0 -0
  246. package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_line.png +0 -0
  247. package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo.png +0 -0
  248. package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo_line.png +0 -0
  249. package/src/asset/Textures/SocialSecond/com_tc_bg_zhaopian_line.png +0 -0
  250. package/src/asset/Textures/SocialSecond/com_tc_btn.png +0 -0
  251. package/src/asset/Textures/SocialSecond/com_tc_btn_close.png +0 -0
  252. package/src/asset/Textures/SocialSecond/com_tc_btn_upload_photo.png +0 -0
  253. package/src/asset/Textures/SocialSecond/com_tc_radio_normal.png +0 -0
  254. package/src/asset/Textures/SocialSecond/com_tc_radio_normal_@slice_0.png +0 -0
  255. package/src/asset/Textures/SocialSecond/com_tc_radio_selected.png +0 -0
  256. package/src/asset/Textures/SocialSecond/com_tc_tab_a.png +0 -0
  257. package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar.png +0 -0
  258. package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar_pre.png +0 -0
  259. package/src/asset/Textures/SocialSecond/newmessage_bg_left_line.png +0 -0
  260. package/src/asset/Textures/SocialSecond/newmessage_bg_left_normal.png +0 -0
  261. package/src/asset/Textures/SocialSecond/newmessage_bg_left_selected.png +0 -0
  262. package/src/asset/Textures/SocialSecond/newmessage_bg_middle_new.png +0 -0
  263. package/src/asset/Textures/SocialSecond/paihang_bg_list.png +0 -0
  264. package/src/asset/Textures/SocialSecond/paihang_bg_list_line.png +0 -0
  265. package/src/asset/Textures/SocialSecond/paihang_bg_list_my.png +0 -0
  266. package/src/asset/Textures/SocialSecond/paihang_bg_list_top.png +0 -0
  267. package/src/asset/Textures/SocialSecond/paihang_bg_topbar_a.png +0 -0
  268. package/src/asset/Textures/SocialSecond/paihang_icon_topbar_selected.png +0 -0
  269. package/src/asset/Textures/SocialSecond/paihang_pic_1.png +0 -0
  270. package/src/asset/Textures/SocialSecond/paihang_pic_2.png +0 -0
  271. package/src/asset/Textures/SocialSecond/tc_fadongtai_btn_close.png +0 -0
  272. package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar.png +0 -0
  273. package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar_selected.png +0 -0
  274. package/src/asset/Textures/SocialSecond/tc_liwu_bg.png +0 -0
  275. package/src/asset/Textures/SocialSecond/tc_liwu_bg_daoju.png +0 -0
  276. package/src/asset/Textures/SocialSecond/tc_liwu_btn_a.png +0 -0
  277. package/src/asset/Textures/SocialSecond/tc_liwu_btn_b.png +0 -0
  278. package/src/asset/Textures/SocialSecond/tc_liwu_btn_c.png +0 -0
  279. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju1.png +0 -0
  280. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju2.png +0 -0
  281. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju3.png +0 -0
  282. package/src/asset/Textures/SocialSecond/tc_pinglun_bg.png +0 -0
  283. package/src/asset/Textures/SocialSecond/tc_shipin_tianjiashipin.png +0 -0
  284. package/src/asset/Textures/SocialSecond/tc_yuyin_bg.png +0 -0
  285. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_delete.png +0 -0
  286. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_a.png +0 -0
  287. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_b.png +0 -0
  288. package/src/asset/Textures/SocialSecond/tc_yuyin_star.png +0 -0
  289. package/src/asset/Textures/SocialSecond/tc_yuyin_stop.png +0 -0
  290. package/src/asset/Textures/SocialSecond/tc_zanshang_bg_line.png +0 -0
  291. package/src/asset/Textures/SocialSecond/touxiang_bg_tishikuang.png +0 -0
  292. package/src/asset/Textures/SocialSecond/xiangce_huadong.png +0 -0
  293. package/src/asset/Textures/SocialSecond/xiangce_huadong_xuanzhong.png +0 -0
  294. package/src/asset/Textures/SocialSecond/xiangce_icon_xiazai.png +0 -0
  295. package/src/asset/Textures/SocialVideo/com_home_btn_close.png +0 -0
  296. package/src/asset/Textures/SocialVideo/tc_shipin_bg_guodu.png +0 -0
  297. package/src/asset/Textures/SocialVideo/tc_shipin_jinduanjian.png +0 -0
  298. package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao.png +0 -0
  299. package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao_hui.png +0 -0
  300. package/src/asset/Textures/SocialVideo/tc_shipin_play.png +0 -0
  301. package/src/asset/Textures/SocialVideo/tc_shipin_play_big.png +0 -0
  302. package/src/asset/Textures/SocialVideo/tc_shipin_stop.png +0 -0
  303. package/src/asset/laugh.gif +0 -0
  304. package/src/asset/npms.png +0 -0
  305. package/src/asset/pixui.png +0 -0
  306. package/src/asset/preact.png +0 -0
  307. package/src/asset/template.html +0 -47
  308. package/src/common/frame/appsettings.js +0 -111
  309. package/src/common/frame/common.js +0 -17
  310. package/src/common/frame/platform-api-callback.js +0 -341
  311. package/src/common/frame/platform-api.d.ts +0 -156
  312. package/src/common/frame/platform-api.js +0 -479
  313. package/src/common/main.less +0 -119
  314. package/src/pixUIReactComponents/README.md +0 -8
  315. package/src/pixUIReactComponents/package.json +0 -11
  316. package/src/pixUIReactComponents/tsconfig.json +0 -45
  317. package/src/pixUIReactComponents/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
  318. package/src/pixUIReactUtils/GenerateConstructorAndGeterSeter.js +0 -227
  319. package/src/pixUIReactUtils/MakeImage.js +0 -207
  320. package/src/pixUIReactUtils/README.md +0 -124
  321. package/src/pixUIReactUtils/Version.js +0 -3
  322. package/src/pixUIReactUtils/img/makeImage.png +0 -0
  323. package/src/pixUIReactUtils/index.js +0 -1
  324. package/src/pixUIReactUtils/package.json +0 -16
  325. package/src/preprocess/index.html +0 -48
  326. package/src/preprocess/main.tsx +0 -17
  327. package/src/preprocess/preprocesspage.tsx +0 -41
  328. /package/{src/pixUIReactComponents/cmdAfterTsBuild.js → cmdAfterTsBuild.js} +0 -0
  329. /package/{src/pixUIReactComponents/index.js → index.js} +0 -0
  330. /package/{src/pixUIReactComponents/tools → tools}/EventDispatcherJs.tsx +0 -0
  331. /package/{src/pixUIReactComponents/tools → tools}/Logger.tsx +0 -0
  332. /package/{src/pixUIReactComponents/tools → tools}/img/logger.png +0 -0
  333. /package/{src/pixUIReactComponents/tools → tools}/tools.md +0 -0
  334. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletItemAnimation.tsx +0 -0
  335. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletScreenAnimation.tsx +0 -0
  336. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/bullet.less +0 -0
  337. /package/{src/pixUIReactComponents/ui → ui}/components/button/Button.tsx +0 -0
  338. /package/{src/pixUIReactComponents/ui → ui}/components/carousel/Carousel.tsx +0 -0
  339. /package/{src/pixUIReactComponents/ui → ui}/components/checkBox/CheckBox.tsx +0 -0
  340. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/Dropdown.tsx +0 -0
  341. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownOptionUI.tsx +0 -0
  342. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownSpreadMainUI.tsx +0 -0
  343. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownUnspreadMainUI.tsx +0 -0
  344. /package/{src/pixUIReactComponents/ui → ui}/components/gradient/GradientText.tsx +0 -0
  345. /package/{src/pixUIReactComponents/ui → ui}/components/outlinetext/OutlineText.tsx +0 -0
  346. /package/{src/pixUIReactComponents/ui → ui}/components/progress/Progress.tsx +0 -0
  347. /package/{src/pixUIReactComponents/ui → ui}/components/slapface/less/Slapface.less +0 -0
  348. /package/{src/pixUIReactComponents/ui → ui}/components/slider/Slider.tsx +0 -0
  349. /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tab.tsx +0 -0
  350. /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tabs.tsx +0 -0
  351. /package/{src/pixUIReactComponents/ui → ui}/components/togglegroup/ToggleGroup.tsx +0 -0
  352. /package/{src/pixUIReactComponents/ui → ui}/components/videoplayer/VideoPlayer.tsx +0 -0
  353. /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/WaterfallComponent.jsx +0 -0
  354. /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/less/WaterfallComponent.less +0 -0
  355. /package/{src/pixUIReactComponents/ui → ui}/sample/Images.tsx +0 -0
  356. /package/{src/pixUIReactComponents/ui → ui}/sample/OutlineText/OutlineDemo.tsx +0 -0
  357. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/btn_close.png +0 -0
  358. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/changtai_button.jpg +0 -0
  359. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox0.png +0 -0
  360. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox1.png +0 -0
  361. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_down.png +0 -0
  362. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_up.png +0 -0
  363. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/dot.png +0 -0
  364. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/inner.png +0 -0
  365. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/item_reddot.png +0 -0
  366. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/loading.png +0 -0
  367. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdown.png +0 -0
  368. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdownall.png +0 -0
  369. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/outer.png +0 -0
  370. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic1.png +0 -0
  371. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic2.png +0 -0
  372. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic3.png +0 -0
  373. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic4.png +0 -0
  374. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic5.png +0 -0
  375. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic6.png +0 -0
  376. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tab_choosed.png +0 -0
  377. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tabs_bg.png +0 -0
  378. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_pause.png +0 -0
  379. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_play.png +0 -0
  380. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_reload.png +0 -0
  381. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/xuanfu_button.jpg +0 -0
  382. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/yaxia_button.jpg +0 -0
  383. /package/{src/pixUIReactComponents/ui → ui}/sample/bulletscreen/BulletDemo.tsx +0 -0
  384. /package/{src/pixUIReactComponents/ui → ui}/sample/button/ButtonDemo.tsx +0 -0
  385. /package/{src/pixUIReactComponents/ui → ui}/sample/carousel/carouselDemo.tsx +0 -0
  386. /package/{src/pixUIReactComponents/ui → ui}/sample/checkBox/checkBoxDemo.tsx +0 -0
  387. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/DropdownDemo.tsx +0 -0
  388. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownOption.tsx +0 -0
  389. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -0
  390. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -0
  391. /package/{src/pixUIReactComponents/ui → ui}/sample/gradient/GradientDemo.tsx +0 -0
  392. /package/{src/pixUIReactComponents/ui → ui}/sample/less/video.less +0 -0
  393. /package/{src/pixUIReactComponents/ui → ui}/sample/progress/ProgressDemo.tsx +0 -0
  394. /package/{src/pixUIReactComponents/ui → ui}/sample/slider/SliderDemo.tsx +0 -0
  395. /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TabDemo.tsx +0 -0
  396. /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TopTab.tsx +0 -0
  397. /package/{src/pixUIReactComponents/ui → ui}/sample/togglegroup/ToggleGroupDemo.tsx +0 -0
  398. /package/{src/pixUIReactComponents/ui → ui}/sample/videoplayer/VideoPlayerDemo.tsx +0 -0
  399. /package/{src/pixUIReactComponents/ui → ui}/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -0
  400. /package/{src/pixUIReactComponents/ui → ui}/ui.md +0 -0
@@ -1,779 +0,0 @@
1
- import React, { createRef, PureComponent } from 'react';
2
- import { render } from 'react-dom';
3
- import { Simulate } from 'react-dom/test-utils';
4
- import ReactTestRenderer from 'react-test-renderer';
5
- import { VariableSizeGrid } from '..';
6
- import * as domHelpers from '../domHelpers';
7
-
8
- const simulateScroll = (instance, { scrollLeft, scrollTop }) => {
9
- instance._outerRef.scrollLeft = scrollLeft;
10
- instance._outerRef.scrollTop = scrollTop;
11
- Simulate.scroll(instance._outerRef);
12
- };
13
-
14
- const findScrollContainer = rendered => rendered.root.children[0].children[0];
15
-
16
- describe('VariableSizeGrid', () => {
17
- let columnWidth,
18
- defaultProps,
19
- getScrollbarSize,
20
- itemRenderer,
21
- onItemsRendered,
22
- rowHeight;
23
-
24
- // Use PureComponent to test memoization.
25
- // Pass through to itemRenderer mock for easier test assertions.
26
- class PureItemRenderer extends PureComponent {
27
- render() {
28
- return itemRenderer(this.props);
29
- }
30
- }
31
-
32
- const findItemRendererCall = (rowIndex: number, columnIndex: number) => {
33
- const found = itemRenderer.mock.calls.find(
34
- ([params]) =>
35
- params.rowIndex === rowIndex && params.columnIndex === columnIndex
36
- );
37
- return found.length === 1 ? found[0] : null;
38
- };
39
-
40
- beforeEach(() => {
41
- jest.useFakeTimers();
42
-
43
- // JSdom does not do actual layout and so doesn't return meaningful values here.
44
- // For the purposes of our tests though, we can mock out semi-meaningful values.
45
- // This mock is required for e.g. "onScroll" tests to work properly.
46
- Object.defineProperties(HTMLElement.prototype, {
47
- clientWidth: {
48
- configurable: true,
49
- get: function() {
50
- return parseInt(this.style.width, 10) || 0;
51
- },
52
- },
53
- clientHeight: {
54
- configurable: true,
55
- get: function() {
56
- return parseInt(this.style.height, 10) || 0;
57
- },
58
- },
59
- scrollHeight: {
60
- configurable: true,
61
- get: () => Number.MAX_SAFE_INTEGER,
62
- },
63
- scrollWidth: {
64
- configurable: true,
65
- get: () => Number.MAX_SAFE_INTEGER,
66
- },
67
- });
68
-
69
- // Mock the DOM helper util for testing purposes.
70
- getScrollbarSize = domHelpers.getScrollbarSize = jest.fn(() => 0);
71
-
72
- itemRenderer = jest.fn(({ style, ...rest }) => (
73
- <div style={style}>{JSON.stringify(rest, null, 2)}</div>
74
- ));
75
- onItemsRendered = jest.fn();
76
- columnWidth = jest.fn(index => 50 + index);
77
- rowHeight = jest.fn(index => 25 + index);
78
- defaultProps = {
79
- children: PureItemRenderer,
80
- columnCount: 10,
81
- columnWidth,
82
- height: 100,
83
- onItemsRendered,
84
- rowCount: 20,
85
- rowHeight,
86
- width: 200,
87
- };
88
- });
89
-
90
- // Much of the shared Grid functionality is already tested by VariableSizeGrid tests.
91
- // This test covers functionality that is unique to VariableSizeGrid.
92
-
93
- it('should render an empty grid', () => {
94
- ReactTestRenderer.create(
95
- <VariableSizeGrid {...defaultProps} columnCount={0} rowCount={0} />
96
- );
97
- ReactTestRenderer.create(
98
- <VariableSizeGrid {...defaultProps} columnCount={0} />
99
- );
100
- ReactTestRenderer.create(
101
- <VariableSizeGrid {...defaultProps} rowCount={0} />
102
- );
103
- expect(itemRenderer).not.toHaveBeenCalled();
104
- expect(columnWidth).not.toHaveBeenCalled();
105
- expect(rowHeight).not.toHaveBeenCalled();
106
- expect(onItemsRendered).not.toHaveBeenCalled();
107
- });
108
-
109
- it('changing item size does not impact the rendered items', () => {
110
- const rendered = ReactTestRenderer.create(
111
- <VariableSizeGrid {...defaultProps} />
112
- );
113
- itemRenderer.mockClear();
114
- rendered.update(
115
- <VariableSizeGrid
116
- {...defaultProps}
117
- columnWidth={index => 100}
118
- rowHeight={index => 50}
119
- />
120
- );
121
- expect(itemRenderer).not.toHaveBeenCalled();
122
- });
123
-
124
- describe('estimatedColumnWidth and estimatedRowHeight', () => {
125
- it('should estimate an initial scrollable size based on this value', () => {
126
- const columnWidth = jest.fn(() => 50);
127
- const rowHeight = jest.fn(() => 25);
128
- const rendered = ReactTestRenderer.create(
129
- <VariableSizeGrid
130
- {...defaultProps}
131
- columnCount={50}
132
- columnWidth={columnWidth}
133
- estimatedColumnWidth={200}
134
- estimatedRowHeight={100}
135
- overscanColumnCount={0}
136
- overscanRowCount={0}
137
- rowCount={50}
138
- rowHeight={rowHeight}
139
- />
140
- );
141
- // We'll render 5 columns and 5 rows initially (250px wide by 125px tall).
142
- // The remaining 45 columns and 45 rows will be estimated (9,000px wide by 4,500px tall).
143
- expect(columnWidth).toHaveBeenCalledTimes(5);
144
- expect(rowHeight).toHaveBeenCalledTimes(5);
145
- const scrollContainer = findScrollContainer(rendered);
146
- expect(scrollContainer.props.style.width).toEqual(9250);
147
- expect(scrollContainer.props.style.height).toEqual(4625);
148
- });
149
-
150
- it('should udpate the scrollable size as more items are measured', () => {
151
- const columnWidth = jest.fn(() => 50);
152
- const rowHeight = jest.fn(() => 25);
153
- const rendered = ReactTestRenderer.create(
154
- <VariableSizeGrid
155
- {...defaultProps}
156
- columnCount={50}
157
- columnWidth={columnWidth}
158
- estimatedColumnWidth={200}
159
- estimatedRowHeight={100}
160
- overscanColumnCount={0}
161
- overscanRowCount={0}
162
- rowCount={50}
163
- rowHeight={rowHeight}
164
- />
165
- );
166
- rendered.getInstance().scrollToItem({ columnIndex: 13, rowIndex: 23 });
167
- // At this point we have measured 15 columns and 25 rows (750px wide by 625px tall).
168
- // The remaining 35 columns and 25 rows will be estimated (7,000px wide by 2,500px tall).
169
- expect(columnWidth).toHaveBeenCalledTimes(15);
170
- expect(rowHeight).toHaveBeenCalledTimes(25);
171
- const scrollContainer = findScrollContainer(rendered);
172
- expect(scrollContainer.props.style.width).toEqual(7750);
173
- expect(scrollContainer.props.style.height).toEqual(3125);
174
- });
175
- });
176
-
177
- describe('scrollToItem method', () => {
178
- it('should not set invalid offsets when the list contains few items', () => {
179
- const onScroll = jest.fn();
180
- const rendered = ReactTestRenderer.create(
181
- <VariableSizeGrid
182
- {...defaultProps}
183
- columnCount={1}
184
- rowCount={2}
185
- onScroll={onScroll}
186
- />
187
- );
188
- expect(onItemsRendered).toMatchSnapshot();
189
- onItemsRendered.mockClear();
190
- rendered.getInstance().scrollToItem(0);
191
- expect(onItemsRendered).not.toHaveBeenCalled();
192
- });
193
-
194
- it('should scroll to the correct item for align = "auto"', () => {
195
- const rendered = ReactTestRenderer.create(
196
- <VariableSizeGrid {...defaultProps} />
197
- );
198
- // Scroll down enough to show item 10 at the bottom.
199
- rendered
200
- .getInstance()
201
- .scrollToItem({ columnIndex: 5, rowIndex: 5, align: 'auto' });
202
- // No need to scroll again; item 9 is already visible.
203
- // Overscan indices will change though, since direction changes.
204
- rendered
205
- .getInstance()
206
- .scrollToItem({ columnIndex: 4, rowIndex: 4, align: 'auto' });
207
- // Scroll up enough to show item 2 at the top.
208
- rendered
209
- .getInstance()
210
- .scrollToItem({ columnIndex: 2, rowIndex: 2, align: 'auto' });
211
- // Scroll down to row 10, without changing scrollLeft
212
- rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'auto' });
213
- // Scroll left to column 0, without changing scrollTop
214
- rendered.getInstance().scrollToItem({ columnIndex: 0, align: 'auto' });
215
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
216
- });
217
-
218
- it('scroll with align = "auto" should work with partially-visible items', () => {
219
- const rendered = ReactTestRenderer.create(
220
- // Create list where items don't fit exactly into container.
221
- // The container has space for 3 1/3 items.
222
- <VariableSizeGrid
223
- {...defaultProps}
224
- columnCount={100}
225
- columnWidth={() => 70}
226
- rowCount={100}
227
- rowHeight={() => 30}
228
- />
229
- );
230
- // Scroll down enough to show row 10 at the bottom a nd column 10 at the right.
231
- // Should show 4 rows: 3 full and one partial at the beginning
232
- // Should show 3 columns: 2 full and one partial at the beginning
233
- rendered
234
- .getInstance()
235
- .scrollToItem({ columnIndex: 10, rowIndex: 10, align: 'auto' });
236
- // No need to scroll again; row and column 9 are already visible.
237
- // Because there's no scrolling, it won't call onItemsRendered.
238
- rendered
239
- .getInstance()
240
- .scrollToItem({ columnIndex: 9, rowIndex: 9, align: 'auto' });
241
- // Scroll to near the end. row 96 and column 97 will be partly visible.
242
- rendered
243
- .getInstance()
244
- .scrollToItem({ columnIndex: 99, rowIndex: 99, align: 'auto' });
245
- // Scroll back to row 91 and column 97.
246
- // This will cause row 99 and column 99 to be partly viisble
247
- // Even though a scroll happened, none of the items rendered have changed.
248
- rendered
249
- .getInstance()
250
- .scrollToItem({ columnIndex: 97, rowIndex: 96, align: 'auto' });
251
- // Scroll forward again. Because row and column #99 were already partly visible,
252
- // all props of the onItemsRendered will be the same.
253
- rendered
254
- .getInstance()
255
- .scrollToItem({ columnIndex: 99, rowIndex: 99, align: 'auto' });
256
- // Scroll to the second row and column.
257
- // This should leave row 4 and column 3 partly visible.
258
- rendered
259
- .getInstance()
260
- .scrollToItem({ columnIndex: 1, rowIndex: 1, align: 'auto' });
261
- // Scroll to the first row and column.
262
- // This should leave row 3 and column 2 partly visible.
263
- rendered
264
- .getInstance()
265
- .scrollToItem({ columnIndex: 0, rowIndex: 0, align: 'auto' });
266
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
267
- });
268
-
269
- it('should scroll to the correct item for align = "auto" at the bottom of the grid', () => {
270
- getScrollbarSize.mockImplementation(() => 20);
271
-
272
- const rendered = ReactTestRenderer.create(
273
- <VariableSizeGrid {...defaultProps} />
274
- );
275
- onItemsRendered.mockClear();
276
-
277
- // Scroll down to the last row in the list.
278
- rendered
279
- .getInstance()
280
- .scrollToItem({ columnIndex: 5, rowIndex: 19, align: 'auto' });
281
-
282
- expect(onItemsRendered).toHaveBeenCalledTimes(1);
283
- expect(onItemsRendered).toHaveBeenLastCalledWith(
284
- expect.objectContaining({
285
- visibleRowStartIndex: 18,
286
- visibleRowStopIndex: 19,
287
- })
288
- );
289
- // Repeat the previous scrollToItem call.
290
- rendered
291
- .getInstance()
292
- .scrollToItem({ columnIndex: 5, rowIndex: 19, align: 'auto' });
293
-
294
- // Shouldn't have been called again
295
- expect(onItemsRendered).toHaveBeenCalledTimes(1);
296
- expect(onItemsRendered).toHaveBeenLastCalledWith(
297
- expect.objectContaining({
298
- visibleRowStartIndex: 18,
299
- visibleRowStopIndex: 19,
300
- })
301
- );
302
- });
303
-
304
- it('should scroll to the correct item for align = "auto" at the right hand side of the grid', () => {
305
- getScrollbarSize.mockImplementation(() => 20);
306
-
307
- const rendered = ReactTestRenderer.create(
308
- <VariableSizeGrid {...defaultProps} width={120} />
309
- );
310
- onItemsRendered.mockClear();
311
-
312
- // Scroll scross to the last row in the list.
313
- rendered
314
- .getInstance()
315
- .scrollToItem({ columnIndex: 9, rowIndex: 10, align: 'auto' });
316
-
317
- expect(onItemsRendered).toHaveBeenCalledTimes(1);
318
- expect(onItemsRendered).toHaveBeenLastCalledWith(
319
- expect.objectContaining({
320
- visibleColumnStartIndex: 8,
321
- visibleColumnStopIndex: 9,
322
- })
323
- );
324
- // Repeat the previous scrollToItem call.
325
- rendered
326
- .getInstance()
327
- .scrollToItem({ columnIndex: 9, rowIndex: 10, align: 'auto' });
328
-
329
- // Shouldn't have been called again
330
- expect(onItemsRendered).toHaveBeenCalledTimes(1);
331
- expect(onItemsRendered).toHaveBeenLastCalledWith(
332
- expect.objectContaining({
333
- visibleColumnStartIndex: 8,
334
- visibleColumnStopIndex: 9,
335
- })
336
- );
337
- });
338
-
339
- it('should scroll to the correct item for align = "start"', () => {
340
- const rendered = ReactTestRenderer.create(
341
- <VariableSizeGrid {...defaultProps} />
342
- );
343
- // Scroll down enough to show item 10 at the top.
344
- rendered
345
- .getInstance()
346
- .scrollToItem({ columnIndex: 5, rowIndex: 5, align: 'start' });
347
- // Scroll back up so that item 9 is at the top.
348
- // Overscroll direction wil change too.
349
- rendered
350
- .getInstance()
351
- .scrollToItem({ columnIndex: 4, rowIndex: 4, align: 'start' });
352
- // Item 99 can't align at the top because there aren't enough items.
353
- // Scroll down as far as possible though.
354
- // Overscroll direction wil change again.
355
- rendered
356
- .getInstance()
357
- .scrollToItem({ columnIndex: 9, rowIndex: 19, align: 'start' });
358
- // Scroll up to row 10, without changing scrollLeft
359
- rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'start' });
360
- // Scroll left to column 0, without changing scrollTop
361
- rendered.getInstance().scrollToItem({ columnIndex: 0, align: 'start' });
362
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
363
- });
364
-
365
- it('should scroll to the correct item for align = "end"', () => {
366
- const rendered = ReactTestRenderer.create(
367
- <VariableSizeGrid {...defaultProps} />
368
- );
369
- // Scroll down enough to show item 10 at the bottom.
370
- rendered
371
- .getInstance()
372
- .scrollToItem({ columnIndex: 5, rowIndex: 5, align: 'end' });
373
- // Scroll back up so that item 9 is at the bottom.
374
- // Overscroll direction wil change too.
375
- rendered
376
- .getInstance()
377
- .scrollToItem({ columnIndex: 4, rowIndex: 4, align: 'end' });
378
- // Item 1 can't align at the bottom because it's too close to the beginning.
379
- // Scroll up as far as possible though.
380
- // Overscroll direction wil change again.
381
- rendered
382
- .getInstance()
383
- .scrollToItem({ columnIndex: 1, rowIndex: 1, align: 'end' });
384
- // Scroll down to row 10, without changing scrollLeft
385
- rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'end' });
386
- // Scroll right to column 9, without changing scrollTop
387
- rendered.getInstance().scrollToItem({ columnIndex: 9, align: 'end' });
388
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
389
- });
390
-
391
- it('should scroll to the correct item for align = "center"', () => {
392
- const rendered = ReactTestRenderer.create(
393
- <VariableSizeGrid {...defaultProps} />
394
- );
395
- // Scroll down enough to show item 10 in the middle.
396
- rendered
397
- .getInstance()
398
- .scrollToItem({ columnIndex: 5, rowIndex: 5, align: 'center' });
399
- // Scroll back up so that item 9 is in the middle.
400
- // Overscroll direction wil change too.
401
- rendered
402
- .getInstance()
403
- .scrollToItem({ columnIndex: 4, rowIndex: 4, align: 'center' });
404
- // Item 1 can't align in the middle because it's too close to the beginning.
405
- // Scroll up as far as possible though.
406
- // Overscroll direction wil change again.
407
- rendered
408
- .getInstance()
409
- .scrollToItem({ columnIndex: 1, rowIndex: 1, align: 'center' });
410
- // Item 99 can't align in the middle because it's too close to the end.
411
- // Scroll down as far as possible though.
412
- // Overscroll direction wil change again.
413
- rendered
414
- .getInstance()
415
- .scrollToItem({ columnIndex: 9, rowIndex: 19, align: 'center' });
416
- // Scroll up to row 10, without changing scrollLeft
417
- rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'center' });
418
- // Scroll left to column 3, without changing scrollTop
419
- rendered.getInstance().scrollToItem({ columnIndex: 3, align: 'center' });
420
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
421
- });
422
-
423
- it('should scroll to the correct item for align = "smart"', () => {
424
- const rendered = ReactTestRenderer.create(
425
- <VariableSizeGrid {...defaultProps} />
426
- );
427
-
428
- // Scroll down enough to show item 10 at the center.
429
- // It was further than one screen away, so it gets centered.
430
- rendered
431
- .getInstance()
432
- .scrollToItem({ columnIndex: 10, rowIndex: 10, align: 'smart' });
433
- // No need to scroll again; item 9 is already visible.
434
- // Overscan indices will change though, since direction changes.
435
- rendered
436
- .getInstance()
437
- .scrollToItem({ columnIndex: 9, rowIndex: 9, align: 'smart' });
438
- // Scroll up enough to show item 2 as close to the center as we can.
439
- rendered
440
- .getInstance()
441
- .scrollToItem({ columnIndex: 2, rowIndex: 2, align: 'smart' });
442
- // Scroll down to row 10, without changing scrollLeft
443
- rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'smart' });
444
- // Scroll left to column 0, without changing scrollTop
445
- rendered.getInstance().scrollToItem({ columnIndex: 0, align: 'smart' });
446
-
447
- // Scrolling within a distance of a single screen from viewport
448
- // should have the 'auto' behavior of scrolling as little as possible.
449
- rendered
450
- .getInstance()
451
- .scrollToItem({ columnIndex: 5, rowIndex: 5, align: 'smart' });
452
- rendered
453
- .getInstance()
454
- .scrollToItem({ columnIndex: 10, rowIndex: 10, align: 'smart' });
455
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
456
- });
457
-
458
- it('should account for scrollbar size', () => {
459
- const onScroll = jest.fn();
460
- const rendered = ReactTestRenderer.create(
461
- <VariableSizeGrid {...defaultProps} onScroll={onScroll} />
462
- );
463
-
464
- onScroll.mockClear();
465
- rendered
466
- .getInstance()
467
- .scrollToItem({ columnIndex: 5, rowIndex: 10, align: 'end' });
468
-
469
- // With hidden scrollbars (size === 0) we would expect...
470
- expect(onScroll).toHaveBeenCalledWith({
471
- horizontalScrollDirection: 'forward',
472
- scrollLeft: 115,
473
- scrollTop: 230,
474
- scrollUpdateWasRequested: true,
475
- verticalScrollDirection: 'forward',
476
- });
477
-
478
- getScrollbarSize.mockImplementation(() => 20);
479
-
480
- onScroll.mockClear();
481
- rendered
482
- .getInstance()
483
- .scrollToItem({ columnIndex: 5, rowIndex: 10, align: 'end' });
484
-
485
- // With scrollbars of size 20 we would expect those values ot increase by 20px
486
- expect(onScroll).toHaveBeenCalledWith({
487
- horizontalScrollDirection: 'forward',
488
- scrollLeft: 135,
489
- scrollTop: 250,
490
- scrollUpdateWasRequested: true,
491
- verticalScrollDirection: 'forward',
492
- });
493
- });
494
-
495
- it('should not account for scrollbar size when no scrollbar is visible for a particular direction', () => {
496
- getScrollbarSize.mockImplementation(() => 20);
497
-
498
- const onScroll = jest.fn();
499
- const rendered = ReactTestRenderer.create(
500
- <VariableSizeGrid
501
- {...defaultProps}
502
- columnCount={1}
503
- onScroll={onScroll}
504
- />
505
- );
506
-
507
- onScroll.mockClear();
508
- rendered
509
- .getInstance()
510
- .scrollToItem({ columnIndex: 0, rowIndex: 10, align: 'end' });
511
-
512
- // Since there aren't enough columns to require horizontal scrolling,
513
- // the additional 20px for the scrollbar should not be taken into consideration.
514
- expect(onScroll).toHaveBeenCalledWith({
515
- horizontalScrollDirection: 'backward',
516
- scrollLeft: 0,
517
- scrollTop: 230,
518
- scrollUpdateWasRequested: true,
519
- verticalScrollDirection: 'forward',
520
- });
521
-
522
- rendered.update(
523
- <VariableSizeGrid {...defaultProps} rowCount={1} onScroll={onScroll} />
524
- );
525
-
526
- onScroll.mockClear();
527
- rendered
528
- .getInstance()
529
- .scrollToItem({ columnIndex: 5, rowIndex: 0, align: 'end' });
530
-
531
- // Since there aren't enough rows to require vertical scrolling,
532
- // the additional 20px for the scrollbar should not be taken into consideration.
533
- expect(onScroll).toHaveBeenCalledWith({
534
- horizontalScrollDirection: 'forward',
535
- scrollLeft: 115,
536
- scrollTop: 0,
537
- scrollUpdateWasRequested: true,
538
- verticalScrollDirection: 'backward',
539
- });
540
- });
541
- });
542
-
543
- describe('resetAfterIndex method', () => {
544
- it('should recalculate the estimated total size', () => {
545
- const columnWidth = jest.fn(() => 75);
546
- const rowHeight = jest.fn(() => 35);
547
- const rendered = ReactTestRenderer.create(
548
- <VariableSizeGrid
549
- {...defaultProps}
550
- columnWidth={index => 50}
551
- rowHeight={index => 25}
552
- />
553
- );
554
- rendered.getInstance().scrollToItem({ columnIndex: 9, rowIndex: 19 });
555
- // We've measured every item initially.
556
- const scrollContainer = findScrollContainer(rendered);
557
- expect(scrollContainer.props.style.height).toEqual(500);
558
- expect(scrollContainer.props.style.width).toEqual(500);
559
- // Supplying new item sizes alone should not impact anything.
560
- rendered.update(
561
- <VariableSizeGrid
562
- {...defaultProps}
563
- columnWidth={columnWidth}
564
- rowHeight={rowHeight}
565
- />
566
- );
567
- expect(scrollContainer.props.style.height).toEqual(500);
568
- expect(scrollContainer.props.style.width).toEqual(500);
569
- // Reset styles after index 75,
570
- // And verify that the new estimated total takes this into account.
571
- // This means 5 columns at 50px each and 5 at 75px each (625),
572
- // And 15 rows at 25px each and 5 at 35px each (550px).
573
- rendered
574
- .getInstance()
575
- .resetAfterIndices({ columnIndex: 5, rowIndex: 15 });
576
- rendered.getInstance().scrollToItem({ columnIndex: 9, rowIndex: 19 });
577
- expect(columnWidth).toHaveBeenCalledTimes(5);
578
- expect(rowHeight).toHaveBeenCalledTimes(5);
579
- expect(scrollContainer.props.style.height).toEqual(550);
580
- expect(scrollContainer.props.style.width).toEqual(625);
581
- });
582
-
583
- it('should delay the recalculation of the estimated total size if shouldForceUpdate is false', () => {
584
- const rendered = ReactTestRenderer.create(
585
- <VariableSizeGrid
586
- {...defaultProps}
587
- estimatedColumnWidth={30}
588
- estimatedRowHeight={30}
589
- overscanColumnCount={1}
590
- overscanRowCount={1}
591
- columnWidth={index => 50}
592
- rowHeight={index => 25}
593
- />
594
- );
595
- const scrollContainer = findScrollContainer(rendered);
596
- // The estimated total height should be (100 + 25 * 1 + 30 * 15)px = 575px.
597
- // The estimated total width should be (200 + 50 * 1 + 30 * 5)px = 400px.
598
- expect(scrollContainer.props.style.height).toEqual(575);
599
- expect(scrollContainer.props.style.width).toEqual(400);
600
- // Supplying new item sizes alone should not impact anything.
601
- // Although the grid get re-rendered by passing inline functions,
602
- // but it still use the cached metrics to calculate the estimated size.
603
- rendered.update(
604
- <VariableSizeGrid
605
- {...defaultProps}
606
- estimatedColumnWidth={30}
607
- estimatedRowHeight={30}
608
- overscanColumnCount={1}
609
- overscanRowCount={1}
610
- columnWidth={index => 40}
611
- rowHeight={index => 20}
612
- />
613
- );
614
- expect(scrollContainer.props.style.height).toEqual(575);
615
- expect(scrollContainer.props.style.width).toEqual(400);
616
- // Reset calculation cache but don't re-render the grid,
617
- // the estimated total size should stay the same.
618
- rendered.getInstance().resetAfterIndices({
619
- columnIndex: 0,
620
- rowIndex: 0,
621
- shouldForceUpdate: false,
622
- });
623
- expect(scrollContainer.props.style.height).toEqual(575);
624
- expect(scrollContainer.props.style.width).toEqual(400);
625
- // Pass inline function to make the grid re-render.
626
- rendered.update(
627
- <VariableSizeGrid
628
- {...defaultProps}
629
- estimatedColumnWidth={30}
630
- estimatedRowHeight={30}
631
- overscanColumnCount={1}
632
- overscanRowCount={1}
633
- columnWidth={index => 40}
634
- rowHeight={index => 20}
635
- />
636
- );
637
- // The estimated total height should be (100 + 20 * 1 + 30 * 14)px = 540px.
638
- // The estimated total width should be (200 + 40 * 1 + 30 * 4)px = 360px.
639
- expect(scrollContainer.props.style.height).toEqual(540);
640
- expect(scrollContainer.props.style.width).toEqual(360);
641
- });
642
-
643
- it('should re-render items after the specified index with updated styles', () => {
644
- const columnWidth = jest.fn(() => 75);
645
- const rowHeight = jest.fn(() => 35);
646
- const rendered = ReactTestRenderer.create(
647
- <VariableSizeGrid
648
- {...defaultProps}
649
- columnWidth={index => 50}
650
- rowHeight={index => 25}
651
- />
652
- );
653
- // We've rendered 5 columns and 5 rows initially.
654
- expect(itemRenderer).toHaveBeenCalledTimes(25);
655
- expect(findItemRendererCall(3, 3).style.height).toBe(25);
656
- expect(findItemRendererCall(3, 3).style.width).toBe(50);
657
- // Supplying new item sizes alone should not impact anything.
658
- rendered.update(
659
- <VariableSizeGrid
660
- {...defaultProps}
661
- columnCount={5}
662
- columnWidth={columnWidth}
663
- rowCount={5}
664
- rowHeight={rowHeight}
665
- />
666
- );
667
- // Reset styles for columns and rows 4 and 5.
668
- // And verify that the affected rows are re-rendered with new styles.
669
- itemRenderer.mockClear();
670
- rendered.getInstance().resetAfterIndices({ columnIndex: 3, rowIndex: 3 });
671
- expect(itemRenderer).toHaveBeenCalledTimes(25);
672
- expect(findItemRendererCall(3, 3).style.height).toBe(35);
673
- expect(findItemRendererCall(3, 3).style.width).toBe(75);
674
- });
675
- });
676
-
677
- describe('props validation', () => {
678
- beforeEach(() => spyOn(console, 'error'));
679
-
680
- it('should fail if non-function columnWidth is provided', () => {
681
- expect(() =>
682
- ReactTestRenderer.create(
683
- <VariableSizeGrid {...defaultProps} columnWidth={123} />
684
- )
685
- ).toThrow(
686
- 'An invalid "columnWidth" prop has been specified. ' +
687
- 'Value should be a function. "number" was specified.'
688
- );
689
- });
690
-
691
- it('should fail if non-function rowHeight is provided', () => {
692
- expect(() =>
693
- ReactTestRenderer.create(
694
- <VariableSizeGrid {...defaultProps} rowHeight={123} />
695
- )
696
- ).toThrow(
697
- 'An invalid "rowHeight" prop has been specified. ' +
698
- 'Value should be a function. "number" was specified.'
699
- );
700
- });
701
- });
702
-
703
- describe('onScroll', () => {
704
- it('scrolling should report partial items correctly in onItemsRendered', () => {
705
- // Use ReactDOM renderer so the container ref works correctly.
706
- const instance = render(
707
- <VariableSizeGrid
708
- {...defaultProps}
709
- columnCount={100}
710
- columnWidth={() => 100}
711
- initialScrollLeft={20}
712
- initialScrollTop={10}
713
- rowCount={100}
714
- rowHeight={() => 25}
715
- />,
716
- document.createElement('div')
717
- );
718
- // grid 200w x 100h
719
- // columnWidth: 100, rowHeight: 25,
720
- // columnCount: 100, rowCount: 100
721
- // Scroll 2 items fwd, but thanks to the initialScrollOffset, we should
722
- // still be showing partials on both ends.
723
- instance.scrollTo({ scrollLeft: 150, scrollTop: 40 });
724
- // Scroll a little fwd to cause partials to be hidden
725
- instance.scrollTo({ scrollLeft: 200, scrollTop: 50 });
726
- // Scroll backwards to show partials again
727
- instance.scrollTo({ scrollLeft: 150, scrollTop: 40 });
728
- // Scroll near the end so that the last item is shown
729
- // as a partial.
730
- instance.scrollTo({
731
- scrollLeft: 98 * 100 - 5,
732
- scrollTop: 96 * 25 - 5,
733
- });
734
- // Scroll to the end. No partials.
735
- instance.scrollTo({
736
- scrollLeft: 98 * 100,
737
- scrollTop: 96 * 25,
738
- });
739
- // Verify that backwards scrolling near the end works OK.
740
- instance.scrollTo({
741
- scrollLeft: 98 * 100 - 5,
742
- scrollTop: 96 * 25 - 5,
743
- });
744
- expect(onItemsRendered.mock.calls).toMatchSnapshot();
745
- });
746
- });
747
-
748
- // https://github.com/bvaughn/react-window/pull/138
749
- it('should descrease scroll size when itemCount decreases', () => {
750
- const innerRef = createRef();
751
- const gridRef = createRef();
752
-
753
- class Wrapper extends PureComponent {
754
- state = { columnCount: 100, rowCount: 200 };
755
- render() {
756
- return (
757
- <VariableSizeGrid
758
- {...defaultProps}
759
- columnCount={this.state.columnCount}
760
- innerRef={innerRef}
761
- ref={gridRef}
762
- rowCount={this.state.rowCount}
763
- />
764
- );
765
- }
766
- }
767
-
768
- // Use ReactDOM renderer so "scroll" events work correctly.
769
- const instance = render(<Wrapper />, document.createElement('div'));
770
-
771
- // Simulate scrolling past several rows.
772
- simulateScroll(gridRef.current, { scrollLeft: 3000, scrollTop: 4000 });
773
-
774
- // Decrease itemCount a lot and verify the scroll height is descreased as well.
775
- instance.setState({ columnCount: 2, rowCount: 4 });
776
- expect(innerRef.current.style.height).toEqual('106px');
777
- expect(innerRef.current.style.width).toEqual('101px');
778
- });
779
- });