pb-sxp-ui 1.0.0

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 (384) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/dist/index.cjs +10752 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.css +1782 -0
  6. package/dist/index.js +10721 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.min.cjs +9 -0
  9. package/dist/index.min.cjs.map +1 -0
  10. package/dist/index.min.js +9 -0
  11. package/dist/index.min.js.map +1 -0
  12. package/dist/pb-ui.js +10748 -0
  13. package/dist/pb-ui.js.map +1 -0
  14. package/dist/pb-ui.min.js +9 -0
  15. package/dist/pb-ui.min.js.map +1 -0
  16. package/es/core/Pagebuilder/PagebuilderClass.d.ts +15 -0
  17. package/es/core/Pagebuilder/PagebuilderClass.js +42 -0
  18. package/es/core/Pagebuilder/index.d.ts +3 -0
  19. package/es/core/Pagebuilder/index.js +96 -0
  20. package/es/core/Pagebuilder/type.d.ts +55 -0
  21. package/es/core/Pagebuilder/type.js +1 -0
  22. package/es/core/components/SxpPageCore/index.d.ts +11 -0
  23. package/es/core/components/SxpPageCore/index.js +26 -0
  24. package/es/core/components/SxpPageRender/ExpandableText.d.ts +12 -0
  25. package/es/core/components/SxpPageRender/ExpandableText.js +54 -0
  26. package/es/core/components/SxpPageRender/FingerSwipeTip/index.d.ts +6 -0
  27. package/es/core/components/SxpPageRender/FingerSwipeTip/index.js +19 -0
  28. package/es/core/components/SxpPageRender/Hashtag/index.d.ts +11 -0
  29. package/es/core/components/SxpPageRender/Hashtag/index.js +40 -0
  30. package/es/core/components/SxpPageRender/LikeButton/index.d.ts +10 -0
  31. package/es/core/components/SxpPageRender/LikeButton/index.js +58 -0
  32. package/es/core/components/SxpPageRender/Modal/index.d.ts +9 -0
  33. package/es/core/components/SxpPageRender/Modal/index.js +44 -0
  34. package/es/core/components/SxpPageRender/Navbar.d.ts +8 -0
  35. package/es/core/components/SxpPageRender/Navbar.js +9 -0
  36. package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
  37. package/es/core/components/SxpPageRender/PictureGroup/Picture.js +19 -0
  38. package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
  39. package/es/core/components/SxpPageRender/PictureGroup/index.js +27 -0
  40. package/es/core/components/SxpPageRender/Popup/index.d.ts +3 -0
  41. package/es/core/components/SxpPageRender/Popup/index.js +60 -0
  42. package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +14 -0
  43. package/es/core/components/SxpPageRender/ProductInfo/index.js +55 -0
  44. package/es/core/components/SxpPageRender/RenderCard.d.ts +11 -0
  45. package/es/core/components/SxpPageRender/RenderCard.js +40 -0
  46. package/es/core/components/SxpPageRender/ToggleButton/index.d.ts +10 -0
  47. package/es/core/components/SxpPageRender/ToggleButton/index.js +13 -0
  48. package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +12 -0
  49. package/es/core/components/SxpPageRender/VideoWidget/index.js +219 -0
  50. package/es/core/components/SxpPageRender/WaterFall/List.d.ts +3 -0
  51. package/es/core/components/SxpPageRender/WaterFall/List.js +173 -0
  52. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +3 -0
  53. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +317 -0
  54. package/es/core/components/SxpPageRender/WaterFall/index.d.ts +6 -0
  55. package/es/core/components/SxpPageRender/WaterFall/index.js +100 -0
  56. package/es/core/components/SxpPageRender/fakeData.d.ts +130 -0
  57. package/es/core/components/SxpPageRender/fakeData.js +899 -0
  58. package/es/core/components/SxpPageRender/index.d.ts +35 -0
  59. package/es/core/components/SxpPageRender/index.js +345 -0
  60. package/es/core/components/SxpPageRender/typing.d.ts +65 -0
  61. package/es/core/components/SxpPageRender/typing.js +1 -0
  62. package/es/core/components/SxpPageRender/useIconLink.d.ts +1 -0
  63. package/es/core/components/SxpPageRender/useIconLink.js +8 -0
  64. package/es/core/context/DataSourceProvider.d.ts +17 -0
  65. package/es/core/context/DataSourceProvider.js +45 -0
  66. package/es/core/context/EditorContext.d.ts +76 -0
  67. package/es/core/context/EditorContext.js +142 -0
  68. package/es/core/context/EditorDataProvider.d.ts +18 -0
  69. package/es/core/context/EditorDataProvider.js +20 -0
  70. package/es/core/context/SxpDataSourceProvider.d.ts +90 -0
  71. package/es/core/context/SxpDataSourceProvider.js +204 -0
  72. package/es/core/create.d.ts +37 -0
  73. package/es/core/create.js +4 -0
  74. package/es/core/hoc/withBindDataSource.d.ts +6 -0
  75. package/es/core/hoc/withBindDataSource.js +61 -0
  76. package/es/core/hooks/index.d.ts +4 -0
  77. package/es/core/hooks/index.js +4 -0
  78. package/es/core/hooks/useCurrentNode.d.ts +10 -0
  79. package/es/core/hooks/useCurrentNode.js +11 -0
  80. package/es/core/hooks/useDataSource.d.ts +2 -0
  81. package/es/core/hooks/useDataSource.js +6 -0
  82. package/es/core/hooks/useEditor.d.ts +1 -0
  83. package/es/core/hooks/useEditor.js +5 -0
  84. package/es/core/hooks/useEventReport.d.ts +5 -0
  85. package/es/core/hooks/useEventReport.js +73 -0
  86. package/es/core/hooks/useOnScreen.d.ts +2 -0
  87. package/es/core/hooks/useOnScreen.js +19 -0
  88. package/es/core/hooks/useSxpDataSource.d.ts +1 -0
  89. package/es/core/hooks/useSxpDataSource.js +5 -0
  90. package/es/core/index.d.ts +3 -0
  91. package/es/core/index.js +1 -0
  92. package/es/core/schema.d.ts +58 -0
  93. package/es/core/schema.js +1 -0
  94. package/es/core/utils/event.d.ts +7 -0
  95. package/es/core/utils/event.js +8 -0
  96. package/es/core/utils/getDataByDS.d.ts +6 -0
  97. package/es/core/utils/getDataByDS.js +39 -0
  98. package/es/core/utils/getSxpTokenInfo.d.ts +2 -0
  99. package/es/core/utils/getSxpTokenInfo.js +26 -0
  100. package/es/core/utils/localStore.d.ts +3 -0
  101. package/es/core/utils/localStore.js +14 -0
  102. package/es/core/utils/materials.d.ts +11 -0
  103. package/es/core/utils/materials.js +31 -0
  104. package/es/core/utils/sessionStore.d.ts +3 -0
  105. package/es/core/utils/sessionStore.js +26 -0
  106. package/es/core/utils/tool.d.ts +5 -0
  107. package/es/core/utils/tool.js +48 -0
  108. package/es/core/utils/unzip.d.ts +1 -0
  109. package/es/core/utils/unzip.js +10 -0
  110. package/es/index.d.ts +10 -0
  111. package/es/index.js +12 -0
  112. package/es/materials/index.d.ts +1 -0
  113. package/es/materials/index.js +1 -0
  114. package/es/materials/sxp/index.d.ts +2 -0
  115. package/es/materials/sxp/index.js +2 -0
  116. package/es/materials/sxp/popup/AppointForm/index.d.ts +18 -0
  117. package/es/materials/sxp/popup/AppointForm/index.js +77 -0
  118. package/es/materials/sxp/popup/AppointForm/interactionRender.d.ts +8 -0
  119. package/es/materials/sxp/popup/AppointForm/interactionRender.js +11 -0
  120. package/es/materials/sxp/popup/AppointForm/material.d.ts +2 -0
  121. package/es/materials/sxp/popup/AppointForm/material.js +36 -0
  122. package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +65 -0
  123. package/es/materials/sxp/popup/AppointForm/settingRender.js +90 -0
  124. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +14 -0
  125. package/es/materials/sxp/popup/CommodityDetail/index.js +85 -0
  126. package/es/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
  127. package/es/materials/sxp/popup/CommodityDetail/material.js +16 -0
  128. package/es/materials/sxp/popup/CommodityDetailDiro/index.d.ts +18 -0
  129. package/es/materials/sxp/popup/CommodityDetailDiro/index.js +162 -0
  130. package/es/materials/sxp/popup/CommodityDetailDiro/material.d.ts +2 -0
  131. package/es/materials/sxp/popup/CommodityDetailDiro/material.js +16 -0
  132. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +22 -0
  133. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +129 -0
  134. package/es/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
  135. package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +16 -0
  136. package/es/materials/sxp/popup/Prompt/index.d.ts +11 -0
  137. package/es/materials/sxp/popup/Prompt/index.js +22 -0
  138. package/es/materials/sxp/popup/Prompt/interactionRender.d.ts +8 -0
  139. package/es/materials/sxp/popup/Prompt/interactionRender.js +11 -0
  140. package/es/materials/sxp/popup/Prompt/material.d.ts +2 -0
  141. package/es/materials/sxp/popup/Prompt/material.js +28 -0
  142. package/es/materials/sxp/popup/Prompt/settingRender.d.ts +12 -0
  143. package/es/materials/sxp/popup/Prompt/settingRender.js +18 -0
  144. package/es/materials/sxp/popup/index.d.ts +5 -0
  145. package/es/materials/sxp/popup/index.js +5 -0
  146. package/es/materials/sxp/template/Appoint/index.d.ts +11 -0
  147. package/es/materials/sxp/template/Appoint/index.js +30 -0
  148. package/es/materials/sxp/template/Appoint/interactionRender.d.ts +8 -0
  149. package/es/materials/sxp/template/Appoint/interactionRender.js +11 -0
  150. package/es/materials/sxp/template/Appoint/material.d.ts +2 -0
  151. package/es/materials/sxp/template/Appoint/material.js +29 -0
  152. package/es/materials/sxp/template/Commodity/index.d.ts +11 -0
  153. package/es/materials/sxp/template/Commodity/index.js +44 -0
  154. package/es/materials/sxp/template/Commodity/interactionRender.d.ts +8 -0
  155. package/es/materials/sxp/template/Commodity/interactionRender.js +11 -0
  156. package/es/materials/sxp/template/Commodity/material.d.ts +2 -0
  157. package/es/materials/sxp/template/Commodity/material.js +26 -0
  158. package/es/materials/sxp/template/CommodityDiro/index.d.ts +11 -0
  159. package/es/materials/sxp/template/CommodityDiro/index.js +46 -0
  160. package/es/materials/sxp/template/CommodityDiro/interactionRender.d.ts +8 -0
  161. package/es/materials/sxp/template/CommodityDiro/interactionRender.js +11 -0
  162. package/es/materials/sxp/template/CommodityDiro/material.d.ts +2 -0
  163. package/es/materials/sxp/template/CommodityDiro/material.js +26 -0
  164. package/es/materials/sxp/template/CommodityDiroNew/index.d.ts +11 -0
  165. package/es/materials/sxp/template/CommodityDiroNew/index.js +46 -0
  166. package/es/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +8 -0
  167. package/es/materials/sxp/template/CommodityDiroNew/interactionRender.js +11 -0
  168. package/es/materials/sxp/template/CommodityDiroNew/material.d.ts +2 -0
  169. package/es/materials/sxp/template/CommodityDiroNew/material.js +26 -0
  170. package/es/materials/sxp/template/Link/index.d.ts +11 -0
  171. package/es/materials/sxp/template/Link/index.js +41 -0
  172. package/es/materials/sxp/template/Link/material.d.ts +2 -0
  173. package/es/materials/sxp/template/Link/material.js +26 -0
  174. package/es/materials/sxp/template/MultiCommodity/index.d.ts +12 -0
  175. package/es/materials/sxp/template/MultiCommodity/index.js +58 -0
  176. package/es/materials/sxp/template/MultiCommodity/interactionRender.d.ts +8 -0
  177. package/es/materials/sxp/template/MultiCommodity/interactionRender.js +11 -0
  178. package/es/materials/sxp/template/MultiCommodity/material.d.ts +2 -0
  179. package/es/materials/sxp/template/MultiCommodity/material.js +26 -0
  180. package/es/materials/sxp/template/MultiCommodityDiro/index.d.ts +12 -0
  181. package/es/materials/sxp/template/MultiCommodityDiro/index.js +60 -0
  182. package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +8 -0
  183. package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.js +11 -0
  184. package/es/materials/sxp/template/MultiCommodityDiro/material.d.ts +2 -0
  185. package/es/materials/sxp/template/MultiCommodityDiro/material.js +26 -0
  186. package/es/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +12 -0
  187. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +59 -0
  188. package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +8 -0
  189. package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +11 -0
  190. package/es/materials/sxp/template/MultiCommodityDiroNew/material.d.ts +2 -0
  191. package/es/materials/sxp/template/MultiCommodityDiroNew/material.js +26 -0
  192. package/es/materials/sxp/template/components/EventProvider.d.ts +10 -0
  193. package/es/materials/sxp/template/components/EventProvider.js +33 -0
  194. package/es/materials/sxp/template/components/Img.d.ts +9 -0
  195. package/es/materials/sxp/template/components/Img.js +19 -0
  196. package/es/materials/sxp/template/components/Scroll.d.ts +9 -0
  197. package/es/materials/sxp/template/components/Scroll.js +10 -0
  198. package/es/materials/sxp/template/index.d.ts +8 -0
  199. package/es/materials/sxp/template/index.js +8 -0
  200. package/lib/core/Pagebuilder/PagebuilderClass.d.ts +15 -0
  201. package/lib/core/Pagebuilder/PagebuilderClass.js +45 -0
  202. package/lib/core/Pagebuilder/index.d.ts +3 -0
  203. package/lib/core/Pagebuilder/index.js +99 -0
  204. package/lib/core/Pagebuilder/type.d.ts +55 -0
  205. package/lib/core/Pagebuilder/type.js +2 -0
  206. package/lib/core/components/SxpPageCore/index.d.ts +11 -0
  207. package/lib/core/components/SxpPageCore/index.js +29 -0
  208. package/lib/core/components/SxpPageRender/ExpandableText.d.ts +12 -0
  209. package/lib/core/components/SxpPageRender/ExpandableText.js +57 -0
  210. package/lib/core/components/SxpPageRender/FingerSwipeTip/index.d.ts +6 -0
  211. package/lib/core/components/SxpPageRender/FingerSwipeTip/index.js +22 -0
  212. package/lib/core/components/SxpPageRender/Hashtag/index.d.ts +11 -0
  213. package/lib/core/components/SxpPageRender/Hashtag/index.js +43 -0
  214. package/lib/core/components/SxpPageRender/LikeButton/index.d.ts +10 -0
  215. package/lib/core/components/SxpPageRender/LikeButton/index.js +60 -0
  216. package/lib/core/components/SxpPageRender/Modal/index.d.ts +9 -0
  217. package/lib/core/components/SxpPageRender/Modal/index.js +47 -0
  218. package/lib/core/components/SxpPageRender/Navbar.d.ts +8 -0
  219. package/lib/core/components/SxpPageRender/Navbar.js +12 -0
  220. package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
  221. package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +22 -0
  222. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
  223. package/lib/core/components/SxpPageRender/PictureGroup/index.js +30 -0
  224. package/lib/core/components/SxpPageRender/Popup/index.d.ts +3 -0
  225. package/lib/core/components/SxpPageRender/Popup/index.js +63 -0
  226. package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +14 -0
  227. package/lib/core/components/SxpPageRender/ProductInfo/index.js +58 -0
  228. package/lib/core/components/SxpPageRender/RenderCard.d.ts +11 -0
  229. package/lib/core/components/SxpPageRender/RenderCard.js +43 -0
  230. package/lib/core/components/SxpPageRender/ToggleButton/index.d.ts +10 -0
  231. package/lib/core/components/SxpPageRender/ToggleButton/index.js +16 -0
  232. package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +12 -0
  233. package/lib/core/components/SxpPageRender/VideoWidget/index.js +222 -0
  234. package/lib/core/components/SxpPageRender/WaterFall/List.d.ts +3 -0
  235. package/lib/core/components/SxpPageRender/WaterFall/List.js +177 -0
  236. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +3 -0
  237. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +321 -0
  238. package/lib/core/components/SxpPageRender/WaterFall/index.d.ts +6 -0
  239. package/lib/core/components/SxpPageRender/WaterFall/index.js +103 -0
  240. package/lib/core/components/SxpPageRender/fakeData.d.ts +130 -0
  241. package/lib/core/components/SxpPageRender/fakeData.js +902 -0
  242. package/lib/core/components/SxpPageRender/index.d.ts +35 -0
  243. package/lib/core/components/SxpPageRender/index.js +348 -0
  244. package/lib/core/components/SxpPageRender/typing.d.ts +65 -0
  245. package/lib/core/components/SxpPageRender/typing.js +2 -0
  246. package/lib/core/components/SxpPageRender/useIconLink.d.ts +1 -0
  247. package/lib/core/components/SxpPageRender/useIconLink.js +12 -0
  248. package/lib/core/context/DataSourceProvider.d.ts +17 -0
  249. package/lib/core/context/DataSourceProvider.js +48 -0
  250. package/lib/core/context/EditorContext.d.ts +76 -0
  251. package/lib/core/context/EditorContext.js +146 -0
  252. package/lib/core/context/EditorDataProvider.d.ts +18 -0
  253. package/lib/core/context/EditorDataProvider.js +25 -0
  254. package/lib/core/context/SxpDataSourceProvider.d.ts +90 -0
  255. package/lib/core/context/SxpDataSourceProvider.js +207 -0
  256. package/lib/core/create.d.ts +37 -0
  257. package/lib/core/create.js +8 -0
  258. package/lib/core/hoc/withBindDataSource.d.ts +6 -0
  259. package/lib/core/hoc/withBindDataSource.js +63 -0
  260. package/lib/core/hooks/index.d.ts +4 -0
  261. package/lib/core/hooks/index.js +7 -0
  262. package/lib/core/hooks/useCurrentNode.d.ts +10 -0
  263. package/lib/core/hooks/useCurrentNode.js +14 -0
  264. package/lib/core/hooks/useDataSource.d.ts +2 -0
  265. package/lib/core/hooks/useDataSource.js +9 -0
  266. package/lib/core/hooks/useEditor.d.ts +1 -0
  267. package/lib/core/hooks/useEditor.js +9 -0
  268. package/lib/core/hooks/useEventReport.d.ts +5 -0
  269. package/lib/core/hooks/useEventReport.js +77 -0
  270. package/lib/core/hooks/useOnScreen.d.ts +2 -0
  271. package/lib/core/hooks/useOnScreen.js +22 -0
  272. package/lib/core/hooks/useSxpDataSource.d.ts +1 -0
  273. package/lib/core/hooks/useSxpDataSource.js +9 -0
  274. package/lib/core/index.d.ts +3 -0
  275. package/lib/core/index.js +5 -0
  276. package/lib/core/schema.d.ts +58 -0
  277. package/lib/core/schema.js +2 -0
  278. package/lib/core/utils/event.d.ts +7 -0
  279. package/lib/core/utils/event.js +12 -0
  280. package/lib/core/utils/getDataByDS.d.ts +6 -0
  281. package/lib/core/utils/getDataByDS.js +41 -0
  282. package/lib/core/utils/getSxpTokenInfo.d.ts +2 -0
  283. package/lib/core/utils/getSxpTokenInfo.js +30 -0
  284. package/lib/core/utils/localStore.d.ts +3 -0
  285. package/lib/core/utils/localStore.js +19 -0
  286. package/lib/core/utils/materials.d.ts +11 -0
  287. package/lib/core/utils/materials.js +37 -0
  288. package/lib/core/utils/sessionStore.d.ts +3 -0
  289. package/lib/core/utils/sessionStore.js +32 -0
  290. package/lib/core/utils/tool.d.ts +5 -0
  291. package/lib/core/utils/tool.js +54 -0
  292. package/lib/core/utils/unzip.d.ts +1 -0
  293. package/lib/core/utils/unzip.js +15 -0
  294. package/lib/index.d.ts +10 -0
  295. package/lib/index.js +20 -0
  296. package/lib/materials/index.d.ts +1 -0
  297. package/lib/materials/index.js +4 -0
  298. package/lib/materials/sxp/index.d.ts +2 -0
  299. package/lib/materials/sxp/index.js +5 -0
  300. package/lib/materials/sxp/popup/AppointForm/index.d.ts +18 -0
  301. package/lib/materials/sxp/popup/AppointForm/index.js +79 -0
  302. package/lib/materials/sxp/popup/AppointForm/interactionRender.d.ts +8 -0
  303. package/lib/materials/sxp/popup/AppointForm/interactionRender.js +13 -0
  304. package/lib/materials/sxp/popup/AppointForm/material.d.ts +2 -0
  305. package/lib/materials/sxp/popup/AppointForm/material.js +40 -0
  306. package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +65 -0
  307. package/lib/materials/sxp/popup/AppointForm/settingRender.js +92 -0
  308. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +14 -0
  309. package/lib/materials/sxp/popup/CommodityDetail/index.js +87 -0
  310. package/lib/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
  311. package/lib/materials/sxp/popup/CommodityDetail/material.js +20 -0
  312. package/lib/materials/sxp/popup/CommodityDetailDiro/index.d.ts +18 -0
  313. package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +164 -0
  314. package/lib/materials/sxp/popup/CommodityDetailDiro/material.d.ts +2 -0
  315. package/lib/materials/sxp/popup/CommodityDetailDiro/material.js +20 -0
  316. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +22 -0
  317. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +131 -0
  318. package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
  319. package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +20 -0
  320. package/lib/materials/sxp/popup/Prompt/index.d.ts +11 -0
  321. package/lib/materials/sxp/popup/Prompt/index.js +24 -0
  322. package/lib/materials/sxp/popup/Prompt/interactionRender.d.ts +8 -0
  323. package/lib/materials/sxp/popup/Prompt/interactionRender.js +13 -0
  324. package/lib/materials/sxp/popup/Prompt/material.d.ts +2 -0
  325. package/lib/materials/sxp/popup/Prompt/material.js +32 -0
  326. package/lib/materials/sxp/popup/Prompt/settingRender.d.ts +12 -0
  327. package/lib/materials/sxp/popup/Prompt/settingRender.js +20 -0
  328. package/lib/materials/sxp/popup/index.d.ts +5 -0
  329. package/lib/materials/sxp/popup/index.js +8 -0
  330. package/lib/materials/sxp/template/Appoint/index.d.ts +11 -0
  331. package/lib/materials/sxp/template/Appoint/index.js +32 -0
  332. package/lib/materials/sxp/template/Appoint/interactionRender.d.ts +8 -0
  333. package/lib/materials/sxp/template/Appoint/interactionRender.js +13 -0
  334. package/lib/materials/sxp/template/Appoint/material.d.ts +2 -0
  335. package/lib/materials/sxp/template/Appoint/material.js +33 -0
  336. package/lib/materials/sxp/template/Commodity/index.d.ts +11 -0
  337. package/lib/materials/sxp/template/Commodity/index.js +46 -0
  338. package/lib/materials/sxp/template/Commodity/interactionRender.d.ts +8 -0
  339. package/lib/materials/sxp/template/Commodity/interactionRender.js +13 -0
  340. package/lib/materials/sxp/template/Commodity/material.d.ts +2 -0
  341. package/lib/materials/sxp/template/Commodity/material.js +30 -0
  342. package/lib/materials/sxp/template/CommodityDiro/index.d.ts +11 -0
  343. package/lib/materials/sxp/template/CommodityDiro/index.js +48 -0
  344. package/lib/materials/sxp/template/CommodityDiro/interactionRender.d.ts +8 -0
  345. package/lib/materials/sxp/template/CommodityDiro/interactionRender.js +13 -0
  346. package/lib/materials/sxp/template/CommodityDiro/material.d.ts +2 -0
  347. package/lib/materials/sxp/template/CommodityDiro/material.js +30 -0
  348. package/lib/materials/sxp/template/CommodityDiroNew/index.d.ts +11 -0
  349. package/lib/materials/sxp/template/CommodityDiroNew/index.js +48 -0
  350. package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +8 -0
  351. package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.js +13 -0
  352. package/lib/materials/sxp/template/CommodityDiroNew/material.d.ts +2 -0
  353. package/lib/materials/sxp/template/CommodityDiroNew/material.js +30 -0
  354. package/lib/materials/sxp/template/Link/index.d.ts +11 -0
  355. package/lib/materials/sxp/template/Link/index.js +43 -0
  356. package/lib/materials/sxp/template/Link/material.d.ts +2 -0
  357. package/lib/materials/sxp/template/Link/material.js +30 -0
  358. package/lib/materials/sxp/template/MultiCommodity/index.d.ts +12 -0
  359. package/lib/materials/sxp/template/MultiCommodity/index.js +60 -0
  360. package/lib/materials/sxp/template/MultiCommodity/interactionRender.d.ts +8 -0
  361. package/lib/materials/sxp/template/MultiCommodity/interactionRender.js +13 -0
  362. package/lib/materials/sxp/template/MultiCommodity/material.d.ts +2 -0
  363. package/lib/materials/sxp/template/MultiCommodity/material.js +30 -0
  364. package/lib/materials/sxp/template/MultiCommodityDiro/index.d.ts +12 -0
  365. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +62 -0
  366. package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +8 -0
  367. package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.js +13 -0
  368. package/lib/materials/sxp/template/MultiCommodityDiro/material.d.ts +2 -0
  369. package/lib/materials/sxp/template/MultiCommodityDiro/material.js +30 -0
  370. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +12 -0
  371. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +61 -0
  372. package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +8 -0
  373. package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +13 -0
  374. package/lib/materials/sxp/template/MultiCommodityDiroNew/material.d.ts +2 -0
  375. package/lib/materials/sxp/template/MultiCommodityDiroNew/material.js +30 -0
  376. package/lib/materials/sxp/template/components/EventProvider.d.ts +10 -0
  377. package/lib/materials/sxp/template/components/EventProvider.js +35 -0
  378. package/lib/materials/sxp/template/components/Img.d.ts +9 -0
  379. package/lib/materials/sxp/template/components/Img.js +22 -0
  380. package/lib/materials/sxp/template/components/Scroll.d.ts +9 -0
  381. package/lib/materials/sxp/template/components/Scroll.js +13 -0
  382. package/lib/materials/sxp/template/index.d.ts +8 -0
  383. package/lib/materials/sxp/template/index.js +11 -0
  384. package/package.json +113 -0
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ require("./List.less");
6
+ const hooks_1 = require("../../../../core/hooks");
7
+ const WaterfallFlowItem = (props) => {
8
+ const { rec, index, list, reportTagsView } = props;
9
+ const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = (0, hooks_1.useSxpDataSource)();
10
+ const [showVideo, setShowVideo] = (0, react_1.useState)(false);
11
+ const imgDom = (0, react_1.useRef)(null);
12
+ const videoDom = (0, react_1.useRef)(null);
13
+ const canvasRef = (0, react_1.useRef)(null);
14
+ const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
15
+ const src = (0, react_1.useMemo)(() => {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
17
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
18
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
19
+ }
20
+ else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.url) {
21
+ setShowVideo(true);
22
+ return (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.url;
23
+ }
24
+ else if ((_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.imgUrls) === null || _f === void 0 ? void 0 : _f.length) {
25
+ return (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.imgUrls) === null || _h === void 0 ? void 0 : _h[0];
26
+ }
27
+ else if ((_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.homePage) === null || _k === void 0 ? void 0 : _k.length) {
28
+ return (_m = (_l = rec === null || rec === void 0 ? void 0 : rec.product) === null || _l === void 0 ? void 0 : _l.homePage) === null || _m === void 0 ? void 0 : _m[0];
29
+ }
30
+ else {
31
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
32
+ }
33
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
34
+ const title = (0, react_1.useMemo)(() => {
35
+ var _a, _b;
36
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
37
+ }, [rec]);
38
+ const priceText = (0, react_1.useMemo)(() => {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.currency) && ((_b = rec === null || rec === void 0 ? void 0 : rec.product) === null || _b === void 0 ? void 0 : _b.price)) {
41
+ return `${(_f = (_e = (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.split('-')[1]) === null || _e === void 0 ? void 0 : _e.toUpperCase()) !== null && _f !== void 0 ? _f : ''}${(_j = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.toLocaleString('zh', {
42
+ minimumFractionDigits: 0
43
+ })) !== null && _j !== void 0 ? _j : ''}`;
44
+ }
45
+ else {
46
+ return null;
47
+ }
48
+ }, [rec]);
49
+ (0, react_1.useEffect)(() => {
50
+ const observer = new IntersectionObserver((entries) => {
51
+ entries.forEach((entry) => {
52
+ if (entry.isIntersecting) {
53
+ if (imgDom.current === null || src === '') {
54
+ return;
55
+ }
56
+ if (showVideo && firstFrameSrc) {
57
+ imgDom.current.src = firstFrameSrc;
58
+ }
59
+ else {
60
+ imgDom.current.src = src;
61
+ }
62
+ observer.unobserve(imgDom.current);
63
+ }
64
+ });
65
+ });
66
+ observer.observe(imgDom.current);
67
+ return () => {
68
+ observer.disconnect();
69
+ };
70
+ }, [src, showVideo, firstFrameSrc]);
71
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
72
+ const aspectRatio = videoWidth / videoHeight;
73
+ const targetHeight = targetWidth / aspectRatio;
74
+ return targetHeight;
75
+ };
76
+ (0, react_1.useEffect)(() => {
77
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
78
+ if (video === null || src === '' || !showVideo) {
79
+ return;
80
+ }
81
+ video.src = src;
82
+ video.currentTime = 1;
83
+ video.crossOrigin = 'anonymous';
84
+ video.onloadeddata = () => {
85
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
86
+ if (!canvas)
87
+ return;
88
+ const ctx = canvas.getContext('2d');
89
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
90
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
91
+ canvas.height = targetHeight;
92
+ canvas.width = targetWidth;
93
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
94
+ setFirstFrameSrc(canvas.toDataURL());
95
+ video.remove();
96
+ canvas.remove();
97
+ };
98
+ }, [src, showVideo]);
99
+ const handleClickToDetail = () => {
100
+ reportTagsView();
101
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
102
+ setTimeout(() => {
103
+ var _a;
104
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
105
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
106
+ }, 0);
107
+ };
108
+ return (react_1.default.createElement("div", { className: 'list-content-listItem', key: index, onClick: handleClickToDetail },
109
+ react_1.default.createElement("div", { className: 'list-content-listItem-picture' },
110
+ showVideo && (react_1.default.createElement("div", { style: { display: 'none' } },
111
+ react_1.default.createElement("video", { ref: videoDom, crossOrigin: 'anonymous', className: 'list-content-listItem-picture-img' }),
112
+ react_1.default.createElement("canvas", { ref: canvasRef }))),
113
+ react_1.default.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
114
+ react_1.default.createElement("div", { className: 'list-content-listItem-info' },
115
+ react_1.default.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}` }, title && title),
116
+ react_1.default.createElement("div", { className: 'list-content-listItem-info-price', hidden: !priceText }, priceText))));
117
+ };
118
+ function WaterfallList({ reportTagsView }) {
119
+ var _a, _b, _c, _d, _e, _f;
120
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage } = (0, hooks_1.useSxpDataSource)();
121
+ const [list, setList] = (0, react_1.useState)();
122
+ const [data, setData] = (0, react_1.useState)();
123
+ const [isLoadingData, setIsLoadingData] = (0, react_1.useState)(false);
124
+ const containerRef = (0, react_1.useRef)(null);
125
+ const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
126
+ const loadMoreData = (0, react_1.useCallback)(() => {
127
+ if (isLoadMore)
128
+ return;
129
+ setIsLoadMore(true);
130
+ waterFallData &&
131
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
132
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
133
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
134
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
135
+ }).then((res) => {
136
+ var _a;
137
+ setList(list === null || list === void 0 ? void 0 : list.concat((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []));
138
+ setIsLoadMore(false);
139
+ }));
140
+ }, [waterFallData, getRecommendVideos, list, isLoadMore]);
141
+ (0, react_1.useEffect)(() => {
142
+ setIsLoadingData(true);
143
+ waterFallData &&
144
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
145
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
146
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
147
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
148
+ defaultSize: hashTagSize
149
+ }).then((res) => {
150
+ var _a, _b;
151
+ setData(res);
152
+ setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
153
+ setIsLoadingData(false);
154
+ }));
155
+ }, [waterFallData, getRecommendVideos, hashTagSize]);
156
+ const handleClickLink = () => {
157
+ var _a, _b;
158
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
159
+ reportTagsView();
160
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
161
+ }
162
+ };
163
+ return (react_1.default.createElement(react_1.default.Fragment, null, isLoadingData ? (react_1.default.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
164
+ react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.createElement("div", { className: 'list' },
165
+ react_1.default.createElement("div", { className: 'list-scroll', ref: containerRef, style: {
166
+ bottom: ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) ? '100px' : 0
167
+ } },
168
+ react_1.default.createElement("div", { className: 'list-info' }, (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.info),
169
+ react_1.default.createElement("div", { hidden: !((_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.link), className: 'list-collection', onClick: handleClickLink }, ((_d = data === null || data === void 0 ? void 0 : data.tag) === null || _d === void 0 ? void 0 : _d.linkTitle) || 'Shop the collection'),
170
+ react_1.default.createElement("div", { className: 'list-content' }, list === null || list === void 0 ? void 0 : list.map((item, ind) => {
171
+ return (react_1.default.createElement(WaterfallFlowItem, { key: ind, index: ind, rec: item, list: list, reportTagsView: reportTagsView }));
172
+ })),
173
+ react_1.default.createElement("div", { hidden: !isLoadMore, style: { textAlign: 'center' } }, "loading...")),
174
+ react_1.default.createElement("div", { className: 'list-bottom', hidden: !((_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.link) },
175
+ react_1.default.createElement("button", { className: 'list-bottom-btn', onClick: handleClickLink }, ((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.linkTitle) || 'Shop the collection'))))));
176
+ }
177
+ exports.default = WaterfallList;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './WaterfallList.less';
3
+ export default function WaterfallList({ reportTagsView }: any): React.JSX.Element;
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const hooks_1 = require("../../../../core/hooks");
6
+ require("./WaterfallList.less");
7
+ const WaterfallFlowItem = (props) => {
8
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView } = props;
9
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
10
+ const [showVideo, setShowVideo] = (0, react_1.useState)(false);
11
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
12
+ const [imgInfo, setImgInfo] = (0, react_1.useState)({
13
+ height: 1,
14
+ width: 1
15
+ });
16
+ const imgDom = (0, react_1.useRef)(null);
17
+ const videoDom = (0, react_1.useRef)(null);
18
+ const canvasRef = (0, react_1.useRef)(null);
19
+ const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
20
+ const src = (0, react_1.useMemo)(() => {
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
22
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
23
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
24
+ }
25
+ else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.url) {
26
+ setShowVideo(true);
27
+ return (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.url;
28
+ }
29
+ else if ((_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.imgUrls) === null || _f === void 0 ? void 0 : _f.length) {
30
+ return (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.imgUrls) === null || _h === void 0 ? void 0 : _h[0];
31
+ }
32
+ else if ((_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.homePage) === null || _k === void 0 ? void 0 : _k.length) {
33
+ return (_m = (_l = rec === null || rec === void 0 ? void 0 : rec.product) === null || _l === void 0 ? void 0 : _l.homePage) === null || _m === void 0 ? void 0 : _m[0];
34
+ }
35
+ else {
36
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
37
+ }
38
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
39
+ const title = (0, react_1.useMemo)(() => {
40
+ var _a, _b;
41
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
42
+ }, [rec]);
43
+ const top = (0, react_1.useMemo)(() => {
44
+ var _a;
45
+ const y = style.transform
46
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
47
+ : undefined;
48
+ return y;
49
+ }, [style]);
50
+ const isImgShow = (0, react_1.useMemo)(() => {
51
+ if (top === undefined) {
52
+ return false;
53
+ }
54
+ if (top <= showBorder) {
55
+ return true;
56
+ }
57
+ else {
58
+ return false;
59
+ }
60
+ }, [top, showBorder]);
61
+ const priceText = (0, react_1.useMemo)(() => {
62
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
63
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.currency) && ((_b = rec === null || rec === void 0 ? void 0 : rec.product) === null || _b === void 0 ? void 0 : _b.price)) {
64
+ return `${(_f = (_e = (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.split('-')[1]) === null || _e === void 0 ? void 0 : _e.toUpperCase()) !== null && _f !== void 0 ? _f : ''}${(_j = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.toLocaleString('zh', {
65
+ minimumFractionDigits: 0
66
+ })) !== null && _j !== void 0 ? _j : ''}`;
67
+ }
68
+ else {
69
+ return null;
70
+ }
71
+ }, [rec]);
72
+ (0, react_1.useEffect)(() => {
73
+ if (imgDom.current === null || src === '' || isImgShow === false) {
74
+ return;
75
+ }
76
+ const img = new Image();
77
+ if (showVideo && firstFrameSrc) {
78
+ img.src = firstFrameSrc;
79
+ }
80
+ else {
81
+ img.src = src;
82
+ }
83
+ img.onload = () => {
84
+ setImgInfo({
85
+ height: img.height,
86
+ width: img.width
87
+ });
88
+ setIsLoading(true);
89
+ };
90
+ imgDom.current.src = img.src;
91
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
92
+ (0, react_1.useEffect)(() => {
93
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
94
+ if (isLoading) {
95
+ sizeChange(height + 76, index);
96
+ }
97
+ }, [imgInfo, index, unitWidth, isLoading]);
98
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
99
+ const aspectRatio = videoWidth / videoHeight;
100
+ const targetHeight = targetWidth / aspectRatio;
101
+ return targetHeight;
102
+ };
103
+ (0, react_1.useEffect)(() => {
104
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
105
+ if (video === null || src === '' || !showVideo) {
106
+ return;
107
+ }
108
+ video.src = src;
109
+ video.currentTime = 1;
110
+ video.crossOrigin = 'anonymous';
111
+ video.onloadeddata = () => {
112
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
113
+ if (!canvas)
114
+ return;
115
+ const ctx = canvas.getContext('2d');
116
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
117
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
118
+ canvas.height = targetHeight;
119
+ canvas.width = targetWidth;
120
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
121
+ setFirstFrameSrc(canvas.toDataURL());
122
+ video.remove();
123
+ canvas.remove();
124
+ };
125
+ }, [src, showVideo]);
126
+ const handleClickToDetail = () => {
127
+ reportTagsView();
128
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
129
+ setTimeout(() => {
130
+ var _a;
131
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
132
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
133
+ }, 0);
134
+ };
135
+ return (react_1.default.createElement("div", { style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
136
+ react_1.default.createElement("div", { className: 'waterFallList-content-listItem-picture' },
137
+ showVideo && (react_1.default.createElement("div", { style: { display: 'none' } },
138
+ react_1.default.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
139
+ react_1.default.createElement("canvas", { ref: canvasRef }))),
140
+ react_1.default.createElement("img", { className: 'waterFallList-content-listItem-picture-img', loading: 'lazy', ref: imgDom, style: {
141
+ visibility: isLoading ? 'visible' : 'hidden'
142
+ } })),
143
+ react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info' },
144
+ react_1.default.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}` }, title && title),
145
+ react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText }, priceText))));
146
+ };
147
+ function WaterfallList({ reportTagsView }) {
148
+ var _a, _b, _c, _d, _e, _f;
149
+ const { waterFallData, getRecommendVideos, loadingImage } = (0, hooks_1.useSxpDataSource)();
150
+ const scrollParent = (0, react_1.useRef)(null);
151
+ const [scrollTop, setScrollTop] = (0, react_1.useState)(0);
152
+ const [data, setData] = (0, react_1.useState)();
153
+ const waterfallFlowDom = (0, react_1.useRef)(null);
154
+ const [styleList, setStyleList] = (0, react_1.useState)([]);
155
+ const styleListRef = (0, react_1.useRef)();
156
+ const heightList = [170, 230, 300];
157
+ const [isLoadingData, setIsLoadingData] = (0, react_1.useState)(false);
158
+ const [list, setList] = (0, react_1.useState)([]);
159
+ const createRandomNum = (0, react_1.useCallback)((min, max) => {
160
+ return Math.floor(Math.random() * (max - min + 1)) + min;
161
+ }, []);
162
+ const waterfallFlowListInfo = (0, react_1.useRef)([]);
163
+ const [frameInfo, setFrameInfoInfo] = (0, react_1.useState)({ width: 0 });
164
+ const rowsNum = (0, react_1.useMemo)(() => {
165
+ const width = frameInfo.width || 0;
166
+ if (width >= 1200) {
167
+ return 6;
168
+ }
169
+ else if (width >= 768 && width <= 1199) {
170
+ return 4;
171
+ }
172
+ else {
173
+ return 2;
174
+ }
175
+ }, [frameInfo]);
176
+ const unitWidth = (0, react_1.useMemo)(() => {
177
+ return frameInfo.width / rowsNum - 2;
178
+ }, [rowsNum, frameInfo]);
179
+ const getStyleList = (0, react_1.useCallback)(() => {
180
+ var _a;
181
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
182
+ const bottomItemIndex = [];
183
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
184
+ const currentRow = Math.floor(i / rowsNum);
185
+ const remainder = (i % rowsNum) + 1;
186
+ let minHeightInd = 0;
187
+ let minHeight = 9999999999;
188
+ if (currentRow === 0) {
189
+ bottomItemIndex[i] = i;
190
+ }
191
+ else {
192
+ for (let j = 0; j < bottomItemIndex.length; j++) {
193
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
194
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
195
+ minHeight) {
196
+ minHeightInd = j;
197
+ minHeight =
198
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
199
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
200
+ }
201
+ }
202
+ bottomItemIndex[minHeightInd] = i;
203
+ }
204
+ if (waterfallFlowListInfo.current[i] === undefined) {
205
+ waterfallFlowListInfo.current[i] = {};
206
+ }
207
+ if (currentRow === 0) {
208
+ if (remainder === 1) {
209
+ waterfallFlowListInfo.current[i].left = 0;
210
+ }
211
+ else {
212
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
213
+ }
214
+ waterfallFlowListInfo.current[i].top = 0;
215
+ }
216
+ else {
217
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
218
+ waterfallFlowListInfo.current[i].top = minHeight;
219
+ }
220
+ waterfallFlowListInfo.current[i].height =
221
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
222
+ temporaryStyleList[i] = {
223
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
224
+ width: `${unitWidth}px`,
225
+ height: waterfallFlowListInfo.current[i].height
226
+ };
227
+ }
228
+ setStyleList([...temporaryStyleList]);
229
+ return [...temporaryStyleList];
230
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
231
+ const onSizeChange = (0, react_1.useCallback)((height, index) => {
232
+ if (waterfallFlowListInfo.current[index] === undefined) {
233
+ waterfallFlowListInfo.current[index] = {};
234
+ }
235
+ waterfallFlowListInfo.current[index].height = height;
236
+ styleListRef.current = getStyleList();
237
+ }, [getStyleList]);
238
+ (0, react_1.useEffect)(() => {
239
+ styleListRef.current = getStyleList();
240
+ }, [unitWidth, rowsNum, list]);
241
+ (0, react_1.useEffect)(() => {
242
+ setIsLoadingData(true);
243
+ waterFallData &&
244
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
245
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
246
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
247
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
248
+ }).then((res) => {
249
+ var _a, _b;
250
+ setData(res);
251
+ setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
252
+ setIsLoadingData(false);
253
+ }));
254
+ }, [waterFallData, getRecommendVideos]);
255
+ const onResize = (0, react_1.useCallback)(() => {
256
+ if (waterfallFlowDom.current === null) {
257
+ return;
258
+ }
259
+ setFrameInfoInfo({
260
+ width: waterfallFlowDom.current.getBoundingClientRect().width
261
+ });
262
+ }, []);
263
+ (0, react_1.useEffect)(() => {
264
+ if (waterfallFlowDom.current === null) {
265
+ return;
266
+ }
267
+ const resizeObserver = new ResizeObserver((entries) => {
268
+ onResize();
269
+ });
270
+ resizeObserver.observe(waterfallFlowDom.current);
271
+ return () => {
272
+ resizeObserver.disconnect();
273
+ };
274
+ }, []);
275
+ const loadMoreData = (0, react_1.useCallback)(() => {
276
+ setIsLoadingData(true);
277
+ waterFallData &&
278
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
279
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
280
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
281
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
282
+ }).then((res) => {
283
+ var _a, _b;
284
+ setList(list === null || list === void 0 ? void 0 : list.concat((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => !(item === null || item === void 0 ? void 0 : item.video))) !== null && _b !== void 0 ? _b : []));
285
+ setIsLoadingData(false);
286
+ }));
287
+ }, [waterFallData, getRecommendVideos, list]);
288
+ const onScroll = (0, react_1.useCallback)(() => {
289
+ setScrollTop(scrollParent.current.scrollTop);
290
+ }, []);
291
+ (0, react_1.useEffect)(() => {
292
+ var _a;
293
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
294
+ return () => {
295
+ var _a;
296
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
297
+ };
298
+ }, [onScroll, scrollParent]);
299
+ const handleClickLink = () => {
300
+ var _a, _b;
301
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
302
+ reportTagsView();
303
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
304
+ }
305
+ };
306
+ return (react_1.default.createElement(react_1.default.Fragment, null,
307
+ react_1.default.createElement("div", { hidden: !isLoadingData, style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
308
+ react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } })),
309
+ react_1.default.createElement("div", { className: 'waterFallList', hidden: isLoadingData },
310
+ react_1.default.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent, style: {
311
+ bottom: ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) ? '100px' : 0
312
+ } },
313
+ react_1.default.createElement("div", { className: 'waterFallList-info' }, (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.info),
314
+ react_1.default.createElement("div", { hidden: !((_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.link), className: 'waterFallList-collection', onClick: handleClickLink }, ((_d = data === null || data === void 0 ? void 0 : data.tag) === null || _d === void 0 ? void 0 : _d.linkTitle) || 'Shop the collection'),
315
+ react_1.default.createElement("div", { className: 'waterFallList-content', ref: waterfallFlowDom }, list === null || list === void 0 ? void 0 : list.map((item, ind) => {
316
+ return (react_1.default.createElement(WaterfallFlowItem, { key: ind, index: ind, rec: item, list: list, showBorder: scrollTop + scrollParent.current.clientHeight, style: styleList[ind], sizeChange: onSizeChange, unitWidth: unitWidth, reportTagsView: reportTagsView }));
317
+ }))),
318
+ react_1.default.createElement("div", { className: 'waterFallList-bottom', hidden: !((_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.link) },
319
+ react_1.default.createElement("button", { className: 'waterFallList-bottom-btn', onClick: handleClickLink }, ((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.linkTitle) || 'Shop the collection')))));
320
+ }
321
+ exports.default = WaterfallList;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface IWaterFallProps {
4
+ }
5
+ declare const _default: React.NamedExoticComponent<IWaterFallProps>;
6
+ export default _default;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const ReactDOM = tslib_1.__importStar(require("react-dom"));
6
+ require("./index.less");
7
+ const lodash_1 = require("lodash");
8
+ const Navbar_1 = tslib_1.__importDefault(require("../Navbar"));
9
+ const List_1 = tslib_1.__importDefault(require("./List"));
10
+ const left_png_1 = tslib_1.__importDefault(require("./left.png"));
11
+ const hooks_1 = require("../../../../core/hooks");
12
+ const WaterFall = () => {
13
+ const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport } = (0, hooks_1.useSxpDataSource)();
14
+ const ref = (0, react_1.useRef)(null);
15
+ const modalEleRef = (0, react_1.useRef)(null);
16
+ const [viewTime, setViewTime] = (0, react_1.useState)();
17
+ (0, react_1.useEffect)(() => {
18
+ const parentNode = document.getElementById('sxp-render');
19
+ const node = document.getElementById('water-fall');
20
+ if (node) {
21
+ modalEleRef.current = node;
22
+ }
23
+ else {
24
+ modalEleRef.current = document.createElement('div');
25
+ modalEleRef.current.setAttribute('id', 'water-fall');
26
+ parentNode === null || parentNode === void 0 ? void 0 : parentNode.appendChild(modalEleRef.current);
27
+ }
28
+ }, []);
29
+ const handleClose = () => {
30
+ const isEq = (0, lodash_1.isEqual)(rtcList, cacheRtcList);
31
+ if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
32
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
33
+ }
34
+ reportTagsView();
35
+ setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
36
+ setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
37
+ setTimeout(() => {
38
+ var _a, _b;
39
+ if (!isEq) {
40
+ (_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(cacheActiveIndex, 0, false);
41
+ }
42
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
43
+ }, 0);
44
+ };
45
+ const [recData, setRecData] = (0, react_1.useState)();
46
+ (0, react_1.useEffect)(() => {
47
+ if (waterFallData) {
48
+ setRecData(waterFallData);
49
+ }
50
+ }, [waterFallData]);
51
+ const reportTagsView = (0, react_1.useCallback)(() => {
52
+ var _a, _b, _c, _d, _e, _f;
53
+ const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
54
+ if (!rec)
55
+ return;
56
+ let fromKName = '';
57
+ if (isFromHashtag) {
58
+ fromKName = 'hashTagPage';
59
+ }
60
+ else if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
61
+ fromKName = 'videoPage';
62
+ }
63
+ else if ((_c = (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) === null || _c === void 0 ? void 0 : _c.length) {
64
+ fromKName = 'imagePage';
65
+ }
66
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
67
+ eventInfo: {
68
+ relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
69
+ position: rec === null || rec === void 0 ? void 0 : rec.position,
70
+ contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
71
+ traceInfo: JSON.stringify((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo),
72
+ hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
73
+ fromKName,
74
+ fromKPage: location === null || location === void 0 ? void 0 : location.href,
75
+ timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
76
+ eventSubject: 'clickTagsViewContents',
77
+ eventDescription: 'User click tags view contents'
78
+ }
79
+ });
80
+ }, [recData, bffEventReport, viewTime, isFromHashtag]);
81
+ (0, react_1.useEffect)(() => {
82
+ if (openHashtag) {
83
+ setViewTime(new Date());
84
+ }
85
+ }, [openHashtag]);
86
+ (0, react_1.useEffect)(() => {
87
+ const initTime = () => {
88
+ setViewTime(new Date());
89
+ };
90
+ window.addEventListener('pageshow', initTime);
91
+ return () => {
92
+ window.removeEventListener('pageshow', initTime);
93
+ };
94
+ }, []);
95
+ if (!modalEleRef.current)
96
+ return null;
97
+ return ReactDOM.createPortal(react_1.default.createElement("div", { className: 'waterfall', style: {
98
+ display: openHashtag ? 'block' : 'none'
99
+ } },
100
+ react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { top: '32px' }, onClose: handleClose }),
101
+ react_1.default.createElement(List_1.default, { reportTagsView: reportTagsView })), modalEleRef.current);
102
+ };
103
+ exports.default = (0, react_1.memo)(WaterFall);