@trionesdev/antd-mobile-base-react 0.0.2-beta.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 (404) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/ActionSheet/ActionSheet.d.ts +25 -0
  4. package/dist/ActionSheet/ActionSheet.js +77 -0
  5. package/dist/ActionSheet/index.d.ts +3 -0
  6. package/dist/ActionSheet/index.js +2 -0
  7. package/dist/ActionSheet/style.scss +51 -0
  8. package/dist/Alert/alert.d.ts +32 -0
  9. package/dist/Alert/alert.js +49 -0
  10. package/dist/Alert/index.d.ts +3 -0
  11. package/dist/Alert/index.js +2 -0
  12. package/dist/Alert/style.scss +69 -0
  13. package/dist/Avatar/avatar.d.ts +14 -0
  14. package/dist/Avatar/avatar.js +40 -0
  15. package/dist/Avatar/index.d.ts +3 -0
  16. package/dist/Avatar/index.js +2 -0
  17. package/dist/Avatar/style.scss +16 -0
  18. package/dist/Badge/badge.d.ts +14 -0
  19. package/dist/Badge/badge.js +82 -0
  20. package/dist/Badge/index.d.ts +3 -0
  21. package/dist/Badge/index.js +2 -0
  22. package/dist/Badge/style.scss +100 -0
  23. package/dist/Card/card.d.ts +21 -0
  24. package/dist/Card/card.js +48 -0
  25. package/dist/Card/index.d.ts +4 -0
  26. package/dist/Card/index.js +3 -0
  27. package/dist/Card/native-props.d.ts +8 -0
  28. package/dist/Card/native-props.js +27 -0
  29. package/dist/Card/style.scss +35 -0
  30. package/dist/CascaderPicker/cascader-picker.d.ts +27 -0
  31. package/dist/CascaderPicker/cascader-picker.js +88 -0
  32. package/dist/CascaderPicker/index.d.ts +3 -0
  33. package/dist/CascaderPicker/index.js +2 -0
  34. package/dist/CascaderPicker/style.scss +42 -0
  35. package/dist/CascaderView/cascader-column-item.d.ts +8 -0
  36. package/dist/CascaderView/cascader-column-item.js +19 -0
  37. package/dist/CascaderView/cascader-column.d.ts +9 -0
  38. package/dist/CascaderView/cascader-column.js +26 -0
  39. package/dist/CascaderView/cascader-view.d.ts +18 -0
  40. package/dist/CascaderView/cascader-view.js +243 -0
  41. package/dist/CascaderView/index.d.ts +3 -0
  42. package/dist/CascaderView/index.js +2 -0
  43. package/dist/CascaderView/style.scss +22 -0
  44. package/dist/CascaderView/types.d.ts +11 -0
  45. package/dist/CascaderView/types.js +1 -0
  46. package/dist/Cell/CellGroup.d.ts +3 -0
  47. package/dist/Cell/CellGroup.js +41 -0
  48. package/dist/Cell/cell.d.ts +4 -0
  49. package/dist/Cell/cell.js +31 -0
  50. package/dist/Cell/index.d.ts +9 -0
  51. package/dist/Cell/index.js +5 -0
  52. package/dist/Cell/styles.scss +52 -0
  53. package/dist/Cell/types.d.ts +41 -0
  54. package/dist/Cell/types.js +1 -0
  55. package/dist/Checkbox/checkbox-button.d.ts +3 -0
  56. package/dist/Checkbox/checkbox-button.js +42 -0
  57. package/dist/Checkbox/checkbox-group.d.ts +3 -0
  58. package/dist/Checkbox/checkbox-group.js +32 -0
  59. package/dist/Checkbox/checkbox.d.ts +4 -0
  60. package/dist/Checkbox/checkbox.js +47 -0
  61. package/dist/Checkbox/group-context.d.ts +3 -0
  62. package/dist/Checkbox/group-context.js +2 -0
  63. package/dist/Checkbox/index.d.ts +11 -0
  64. package/dist/Checkbox/index.js +7 -0
  65. package/dist/Checkbox/index.scss +151 -0
  66. package/dist/Checkbox/types.d.ts +20 -0
  67. package/dist/Checkbox/types.js +1 -0
  68. package/dist/ConfigProvider/config-provider.d.ts +57 -0
  69. package/dist/ConfigProvider/config-provider.js +41 -0
  70. package/dist/ConfigProvider/index.d.ts +9 -0
  71. package/dist/ConfigProvider/index.js +6 -0
  72. package/dist/DemoBlock/index.d.ts +10 -0
  73. package/dist/DemoBlock/index.js +15 -0
  74. package/dist/DemoBlock/index.scss +20 -0
  75. package/dist/DemoDescription/index.d.ts +6 -0
  76. package/dist/DemoDescription/index.js +7 -0
  77. package/dist/DemoDescription/index.scss +3 -0
  78. package/dist/Descriptions/DescriptionItem.d.ts +5 -0
  79. package/dist/Descriptions/DescriptionItem.js +67 -0
  80. package/dist/Descriptions/Descriptions.d.ts +4 -0
  81. package/dist/Descriptions/Descriptions.js +229 -0
  82. package/dist/Descriptions/index.d.ts +9 -0
  83. package/dist/Descriptions/index.js +5 -0
  84. package/dist/Descriptions/style.scss +65 -0
  85. package/dist/Descriptions/types.d.ts +90 -0
  86. package/dist/Descriptions/types.js +1 -0
  87. package/dist/Divider/divider.d.ts +17 -0
  88. package/dist/Divider/divider.js +36 -0
  89. package/dist/Divider/index.d.ts +3 -0
  90. package/dist/Divider/index.js +2 -0
  91. package/dist/Divider/style.scss +62 -0
  92. package/dist/Ellipsis/ellipsis.d.ts +16 -0
  93. package/dist/Ellipsis/ellipsis.js +77 -0
  94. package/dist/Ellipsis/index.d.ts +3 -0
  95. package/dist/Ellipsis/index.js +2 -0
  96. package/dist/Ellipsis/style.scss +13 -0
  97. package/dist/Ellipsis/useMeasure.d.ts +2 -0
  98. package/dist/Ellipsis/useMeasure.js +123 -0
  99. package/dist/Empty/empty-icon.d.ts +3 -0
  100. package/dist/Empty/empty-icon.js +12 -0
  101. package/dist/Empty/empty.d.ts +12 -0
  102. package/dist/Empty/empty.js +48 -0
  103. package/dist/Empty/images/empty.png +0 -0
  104. package/dist/Empty/index.d.ts +3 -0
  105. package/dist/Empty/index.js +2 -0
  106. package/dist/Empty/style.scss +29 -0
  107. package/dist/ErrorBlock/create-error-block.d.ts +13 -0
  108. package/dist/ErrorBlock/create-error-block.js +44 -0
  109. package/dist/ErrorBlock/demo/base.d.ts +3 -0
  110. package/dist/ErrorBlock/demo/base.js +23 -0
  111. package/dist/ErrorBlock/error-block.d.ts +2 -0
  112. package/dist/ErrorBlock/error-block.js +9 -0
  113. package/dist/ErrorBlock/images/busy.d.ts +2 -0
  114. package/dist/ErrorBlock/images/busy.js +90 -0
  115. package/dist/ErrorBlock/images/busy.png +0 -0
  116. package/dist/ErrorBlock/images/default.d.ts +2 -0
  117. package/dist/ErrorBlock/images/default.js +166 -0
  118. package/dist/ErrorBlock/images/default.png +0 -0
  119. package/dist/ErrorBlock/images/disconnected.d.ts +2 -0
  120. package/dist/ErrorBlock/images/disconnected.js +123 -0
  121. package/dist/ErrorBlock/images/disconnected.png +0 -0
  122. package/dist/ErrorBlock/images/empty.d.ts +2 -0
  123. package/dist/ErrorBlock/images/empty.js +119 -0
  124. package/dist/ErrorBlock/images/empty.png +0 -0
  125. package/dist/ErrorBlock/images/index.d.ts +4 -0
  126. package/dist/ErrorBlock/images/index.js +4 -0
  127. package/dist/ErrorBlock/index.d.ts +7 -0
  128. package/dist/ErrorBlock/index.js +3 -0
  129. package/dist/ErrorBlock/style.scss +62 -0
  130. package/dist/Footer/footer.d.ts +20 -0
  131. package/dist/Footer/footer.js +66 -0
  132. package/dist/Footer/index.d.ts +3 -0
  133. package/dist/Footer/index.js +2 -0
  134. package/dist/Footer/style.scss +55 -0
  135. package/dist/Form/FormItem/form-item-input.d.ts +15 -0
  136. package/dist/Form/FormItem/form-item-input.js +39 -0
  137. package/dist/Form/FormItem/form-item-label.d.ts +13 -0
  138. package/dist/Form/FormItem/form-item-label.js +25 -0
  139. package/dist/Form/FormItem/form-item.d.ts +21 -0
  140. package/dist/Form/FormItem/form-item.js +70 -0
  141. package/dist/Form/FormItem/index.d.ts +5 -0
  142. package/dist/Form/FormItem/index.js +3 -0
  143. package/dist/Form/context.d.ts +12 -0
  144. package/dist/Form/context.js +6 -0
  145. package/dist/Form/form.d.ts +44 -0
  146. package/dist/Form/form.js +31 -0
  147. package/dist/Form/hooks/useForm.d.ts +2 -0
  148. package/dist/Form/hooks/useForm.js +24 -0
  149. package/dist/Form/hooks/useFormContext.d.ts +2 -0
  150. package/dist/Form/hooks/useFormContext.js +6 -0
  151. package/dist/Form/index.d.ts +12 -0
  152. package/dist/Form/index.js +8 -0
  153. package/dist/Form/interface.d.ts +3 -0
  154. package/dist/Form/interface.js +1 -0
  155. package/dist/Form/style.scss +45 -0
  156. package/dist/Grid/grid.d.ts +16 -0
  157. package/dist/Grid/grid.js +35 -0
  158. package/dist/Grid/index.d.ts +7 -0
  159. package/dist/Grid/index.js +4 -0
  160. package/dist/Grid/style.scss +17 -0
  161. package/dist/Icon/check-icon.d.ts +3 -0
  162. package/dist/Icon/check-icon.js +10 -0
  163. package/dist/Icon/demo/base.d.ts +6 -0
  164. package/dist/Icon/demo/base.js +41 -0
  165. package/dist/Input/base-input.d.ts +14 -0
  166. package/dist/Input/base-input.js +63 -0
  167. package/dist/Input/index.d.ts +12 -0
  168. package/dist/Input/index.js +9 -0
  169. package/dist/Input/index.scss +173 -0
  170. package/dist/Input/input-affix-wrapper.d.ts +8 -0
  171. package/dist/Input/input-affix-wrapper.js +50 -0
  172. package/dist/Input/input-opt.d.ts +16 -0
  173. package/dist/Input/input-opt.js +93 -0
  174. package/dist/Input/input-password.d.ts +7 -0
  175. package/dist/Input/input-password.js +47 -0
  176. package/dist/Input/input.d.ts +15 -0
  177. package/dist/Input/input.js +47 -0
  178. package/dist/Input/textarea.d.ts +13 -0
  179. package/dist/Input/textarea.js +45 -0
  180. package/dist/Input/types.d.ts +1 -0
  181. package/dist/Input/types.js +1 -0
  182. package/dist/InputNumber/index.d.ts +3 -0
  183. package/dist/InputNumber/index.js +2 -0
  184. package/dist/InputNumber/input-number.d.ts +13 -0
  185. package/dist/InputNumber/input-number.js +69 -0
  186. package/dist/InputNumber/style.scss +43 -0
  187. package/dist/Mask/index.d.ts +3 -0
  188. package/dist/Mask/index.js +2 -0
  189. package/dist/Mask/mask-modal.d.ts +45 -0
  190. package/dist/Mask/mask-modal.js +32 -0
  191. package/dist/Mask/mask.d.ts +5 -0
  192. package/dist/Mask/mask.js +19 -0
  193. package/dist/Mask/style.scss +20 -0
  194. package/dist/NavBar/index.d.ts +3 -0
  195. package/dist/NavBar/index.js +2 -0
  196. package/dist/NavBar/nav-bar.d.ts +31 -0
  197. package/dist/NavBar/nav-bar.js +36 -0
  198. package/dist/NavBar/style.scss +61 -0
  199. package/dist/NoticeBar/index.d.ts +3 -0
  200. package/dist/NoticeBar/index.js +2 -0
  201. package/dist/NoticeBar/notice-bar.d.ts +64 -0
  202. package/dist/NoticeBar/notice-bar.js +119 -0
  203. package/dist/NoticeBar/style.scss +130 -0
  204. package/dist/PageIndicator/index.d.ts +3 -0
  205. package/dist/PageIndicator/index.js +2 -0
  206. package/dist/PageIndicator/page-indicator.d.ts +10 -0
  207. package/dist/PageIndicator/page-indicator.js +27 -0
  208. package/dist/PageIndicator/style.scss +59 -0
  209. package/dist/Picker/index.d.ts +3 -0
  210. package/dist/Picker/index.js +2 -0
  211. package/dist/Picker/picker.d.ts +19 -0
  212. package/dist/Picker/picker.js +97 -0
  213. package/dist/Picker/style.scss +41 -0
  214. package/dist/PickerView/index.d.ts +4 -0
  215. package/dist/PickerView/index.js +2 -0
  216. package/dist/PickerView/picker-view-column-item.d.ts +7 -0
  217. package/dist/PickerView/picker-view-column-item.js +11 -0
  218. package/dist/PickerView/picker-view-column.d.ts +10 -0
  219. package/dist/PickerView/picker-view-column.js +117 -0
  220. package/dist/PickerView/picker-view.d.ts +12 -0
  221. package/dist/PickerView/picker-view.js +60 -0
  222. package/dist/PickerView/style.scss +72 -0
  223. package/dist/PickerView/types.d.ts +4 -0
  224. package/dist/PickerView/types.js +1 -0
  225. package/dist/Popup/index.d.ts +3 -0
  226. package/dist/Popup/index.js +2 -0
  227. package/dist/Popup/popup-modal.d.ts +52 -0
  228. package/dist/Popup/popup-modal.js +74 -0
  229. package/dist/Popup/popup.d.ts +4 -0
  230. package/dist/Popup/popup.js +56 -0
  231. package/dist/Popup/style.scss +53 -0
  232. package/dist/Radio/GroupContext.d.ts +10 -0
  233. package/dist/Radio/GroupContext.js +2 -0
  234. package/dist/Radio/RadioButton.d.ts +3 -0
  235. package/dist/Radio/RadioButton.js +60 -0
  236. package/dist/Radio/RadioGroup.d.ts +3 -0
  237. package/dist/Radio/RadioGroup.js +60 -0
  238. package/dist/Radio/index.d.ts +11 -0
  239. package/dist/Radio/index.js +14 -0
  240. package/dist/Radio/radio.d.ts +4 -0
  241. package/dist/Radio/radio.js +78 -0
  242. package/dist/Radio/style.scss +138 -0
  243. package/dist/Radio/types.d.ts +58 -0
  244. package/dist/Radio/types.js +1 -0
  245. package/dist/Rate/index.d.ts +3 -0
  246. package/dist/Rate/index.js +2 -0
  247. package/dist/Rate/rate.d.ts +50 -0
  248. package/dist/Rate/rate.js +100 -0
  249. package/dist/Rate/style.scss +37 -0
  250. package/dist/Result/demo/base.d.ts +3 -0
  251. package/dist/Result/demo/base.js +57 -0
  252. package/dist/Result/index.d.ts +3 -0
  253. package/dist/Result/index.js +2 -0
  254. package/dist/Result/result.d.ts +10 -0
  255. package/dist/Result/result.js +28 -0
  256. package/dist/Result/style.scss +73 -0
  257. package/dist/Result/use-result-icon.d.ts +2 -0
  258. package/dist/Result/use-result-icon.js +53 -0
  259. package/dist/SafeArea/index.d.ts +4 -0
  260. package/dist/SafeArea/index.js +3 -0
  261. package/dist/SafeArea/safe-area.d.ts +14 -0
  262. package/dist/SafeArea/safe-area.js +23 -0
  263. package/dist/SafeArea/style.scss +18 -0
  264. package/dist/Scaffold/index.d.ts +3 -0
  265. package/dist/Scaffold/index.js +2 -0
  266. package/dist/Scaffold/scaffold.d.ts +11 -0
  267. package/dist/Scaffold/scaffold.js +19 -0
  268. package/dist/Scaffold/style.scss +16 -0
  269. package/dist/ScrollView/index.d.ts +4 -0
  270. package/dist/ScrollView/index.js +2 -0
  271. package/dist/ScrollView/scroll-view.d.ts +4 -0
  272. package/dist/ScrollView/scroll-view.js +55 -0
  273. package/dist/ScrollView/style.scss +19 -0
  274. package/dist/ScrollView/types.d.ts +26 -0
  275. package/dist/ScrollView/types.js +1 -0
  276. package/dist/SideBar/SideBarContext.d.ts +18 -0
  277. package/dist/SideBar/SideBarContext.js +2 -0
  278. package/dist/SideBar/index.d.ts +3 -0
  279. package/dist/SideBar/index.js +2 -0
  280. package/dist/SideBar/side-bar.d.ts +25 -0
  281. package/dist/SideBar/side-bar.js +351 -0
  282. package/dist/SideBar/style.scss +85 -0
  283. package/dist/SideBar/types.d.ts +7 -0
  284. package/dist/SideBar/types.js +1 -0
  285. package/dist/Space/index.d.ts +3 -0
  286. package/dist/Space/index.js +2 -0
  287. package/dist/Space/space.d.ts +38 -0
  288. package/dist/Space/space.js +61 -0
  289. package/dist/Space/style.scss +77 -0
  290. package/dist/SpinLoading/demo/base.d.ts +3 -0
  291. package/dist/SpinLoading/demo/base.js +21 -0
  292. package/dist/SpinLoading/index.d.ts +3 -0
  293. package/dist/SpinLoading/index.js +2 -0
  294. package/dist/SpinLoading/spin-loading.d.ts +10 -0
  295. package/dist/SpinLoading/spin-loading.js +59 -0
  296. package/dist/SpinLoading/spin-loading.scss +40 -0
  297. package/dist/Steps/HorizontalSteps.d.ts +3 -0
  298. package/dist/Steps/HorizontalSteps.js +85 -0
  299. package/dist/Steps/Point.d.ts +6 -0
  300. package/dist/Steps/Point.js +13 -0
  301. package/dist/Steps/Steps.d.ts +4 -0
  302. package/dist/Steps/Steps.js +26 -0
  303. package/dist/Steps/VerticalSteps.d.ts +3 -0
  304. package/dist/Steps/VerticalSteps.js +92 -0
  305. package/dist/Steps/context.d.ts +8 -0
  306. package/dist/Steps/context.js +5 -0
  307. package/dist/Steps/index.d.ts +4 -0
  308. package/dist/Steps/index.js +2 -0
  309. package/dist/Steps/style.scss +146 -0
  310. package/dist/Steps/types.d.ts +23 -0
  311. package/dist/Steps/types.js +4 -0
  312. package/dist/Switch/index.d.ts +3 -0
  313. package/dist/Switch/index.js +2 -0
  314. package/dist/Switch/style.scss +128 -0
  315. package/dist/Switch/switch.d.ts +21 -0
  316. package/dist/Switch/switch.js +96 -0
  317. package/dist/TabBar/TabBarContext.d.ts +10 -0
  318. package/dist/TabBar/TabBarContext.js +2 -0
  319. package/dist/TabBar/demo/base.d.ts +6 -0
  320. package/dist/TabBar/demo/base.js +26 -0
  321. package/dist/TabBar/index.d.ts +7 -0
  322. package/dist/TabBar/index.js +3 -0
  323. package/dist/TabBar/index.scss +36 -0
  324. package/dist/TabBar/tab-bar.d.ts +61 -0
  325. package/dist/TabBar/tab-bar.js +86 -0
  326. package/dist/Tabs/context.d.ts +11 -0
  327. package/dist/Tabs/context.js +4 -0
  328. package/dist/Tabs/demo/base.d.ts +3 -0
  329. package/dist/Tabs/demo/base.js +59 -0
  330. package/dist/Tabs/index.d.ts +9 -0
  331. package/dist/Tabs/index.js +5 -0
  332. package/dist/Tabs/style.scss +108 -0
  333. package/dist/Tabs/tab-nav.d.ts +9 -0
  334. package/dist/Tabs/tab-nav.js +25 -0
  335. package/dist/Tabs/tab-pane.d.ts +7 -0
  336. package/dist/Tabs/tab-pane.js +17 -0
  337. package/dist/Tabs/tab.d.ts +7 -0
  338. package/dist/Tabs/tab.js +6 -0
  339. package/dist/Tabs/tabs.d.ts +25 -0
  340. package/dist/Tabs/tabs.js +156 -0
  341. package/dist/Tag/demo/base.d.ts +7 -0
  342. package/dist/Tag/demo/base.js +67 -0
  343. package/dist/Tag/demo/style.scss +8 -0
  344. package/dist/Tag/index.d.ts +3 -0
  345. package/dist/Tag/index.js +2 -0
  346. package/dist/Tag/style.scss +86 -0
  347. package/dist/Tag/tag.d.ts +30 -0
  348. package/dist/Tag/tag.js +44 -0
  349. package/dist/Toast/index.d.ts +5 -0
  350. package/dist/Toast/index.js +3 -0
  351. package/dist/Toast/style.scss +63 -0
  352. package/dist/Toast/toast-modal.d.ts +18 -0
  353. package/dist/Toast/toast-modal.js +112 -0
  354. package/dist/Toast/toast.d.ts +7 -0
  355. package/dist/Toast/toast.js +78 -0
  356. package/dist/VerificationCodeInput/demo/base.d.ts +3 -0
  357. package/dist/VerificationCodeInput/demo/base.js +11 -0
  358. package/dist/VerificationCodeInput/index.d.ts +3 -0
  359. package/dist/VerificationCodeInput/index.js +2 -0
  360. package/dist/VerificationCodeInput/style.scss +20 -0
  361. package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
  362. package/dist/VerificationCodeInput/verification-code-input.js +99 -0
  363. package/dist/WaterMark/index.d.ts +3 -0
  364. package/dist/WaterMark/index.js +2 -0
  365. package/dist/WaterMark/style.scss +17 -0
  366. package/dist/WaterMark/water-mark.d.ts +22 -0
  367. package/dist/WaterMark/water-mark.js +108 -0
  368. package/dist/index.d.ts +90 -0
  369. package/dist/index.js +46 -0
  370. package/dist/locales/base.d.ts +139 -0
  371. package/dist/locales/base.js +139 -0
  372. package/dist/locales/en-US.d.ts +139 -0
  373. package/dist/locales/en-US.js +4 -0
  374. package/dist/locales/zh-CN.d.ts +3 -0
  375. package/dist/locales/zh-CN.js +140 -0
  376. package/dist/style/index.d.ts +1 -0
  377. package/dist/style/index.js +5 -0
  378. package/dist/style/style.scss +52 -0
  379. package/dist/style/theme-dark.scss +24 -0
  380. package/dist/style/theme-default.scss +54 -0
  381. package/dist/style/variable.scss +168 -0
  382. package/dist/types.d.ts +9 -0
  383. package/dist/types.js +1 -0
  384. package/dist/utils/datetime-utils.d.ts +3 -0
  385. package/dist/utils/datetime-utils.js +18 -0
  386. package/dist/utils/dev-log.d.ts +3 -0
  387. package/dist/utils/dev-log.js +36 -0
  388. package/dist/utils/is-dev.d.ts +1 -0
  389. package/dist/utils/is-dev.js +1 -0
  390. package/dist/utils/merge-locale.d.ts +1 -0
  391. package/dist/utils/merge-locale.js +16 -0
  392. package/dist/utils/native-props.d.ts +10 -0
  393. package/dist/utils/native-props.js +39 -0
  394. package/dist/utils/random-utils.d.ts +3 -0
  395. package/dist/utils/random-utils.js +13 -0
  396. package/dist/utils/to-css-length.d.ts +1 -0
  397. package/dist/utils/to-css-length.js +3 -0
  398. package/dist/utils/type.d.ts +65 -0
  399. package/dist/utils/type.js +48 -0
  400. package/dist/utils/with-default-props.d.ts +9 -0
  401. package/dist/utils/with-default-props.js +33 -0
  402. package/dist/utils/with-stop-propagation.d.ts +4 -0
  403. package/dist/utils/with-stop-propagation.js +38 -0
  404. package/package.json +55 -0
@@ -0,0 +1,26 @@
1
+ import React, { ReactNode } from "react";
2
+ export type ScrollEvent = {
3
+ target?: any;
4
+ detail: {
5
+ deltaX?: number;
6
+ deltaY?: number;
7
+ scrollLeft?: number;
8
+ scrollTop?: number;
9
+ scrollHeight?: number;
10
+ scrollWidth?: number;
11
+ };
12
+ };
13
+ export type ScrollViewProps = {
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ children?: ReactNode;
17
+ onScroll?: (e: ScrollEvent) => void;
18
+ showScrollbar?: boolean;
19
+ scrollX?: boolean;
20
+ scrollY?: boolean;
21
+ scrollTop?: number;
22
+ upperThreshold?: number;
23
+ lowerThreshold?: number;
24
+ onScrollToUpper?: () => void;
25
+ onScrollToLower?: () => void;
26
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { ScrollDetail } from './types';
3
+ type SideBarContextType = {
4
+ activeKey?: string;
5
+ setActiveKey?: (key: string) => void;
6
+ mode?: 'switch' | 'scroll';
7
+ scrollDetail?: ScrollDetail;
8
+ setScrollDetail?: (detail: ScrollDetail) => void;
9
+ activeChangeCallback?: (targetScrollTop: number) => void;
10
+ onMoveToTab?: (activeKey: string) => void;
11
+ asyncRender?: boolean;
12
+ contentRef?: any;
13
+ contentWheelRef?: any;
14
+ manual?: boolean;
15
+ setManul?: (manual: boolean) => void;
16
+ };
17
+ export declare const SideBarContext: import("react").Context<SideBarContextType>;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export var SideBarContext = /*#__PURE__*/createContext({});
@@ -0,0 +1,3 @@
1
+ import { SideBar, SideBarProps } from "./side-bar";
2
+ export type { SideBarProps };
3
+ export default SideBar;
@@ -0,0 +1,2 @@
1
+ import { SideBar } from "./side-bar";
2
+ export default SideBar;
@@ -0,0 +1,25 @@
1
+ import React, { FC } from 'react';
2
+ import './style.scss';
3
+ type sideBarMode = 'switch' | 'scroll';
4
+ export type SideBarItemProps = {
5
+ key: string;
6
+ title?: string;
7
+ content?: React.ReactNode;
8
+ };
9
+ export type SideBarProps = {
10
+ activeKey?: string;
11
+ defaultActiveKey?: string;
12
+ items?: SideBarItemProps[];
13
+ /**
14
+ * 交互模式 `switch` 页面切换,`scroll` 滚动展示
15
+ */
16
+ mode?: sideBarMode;
17
+ /**
18
+ * @description 是否异步渲染内容
19
+ * @default false
20
+ */
21
+ asyncRender?: boolean;
22
+ tabWidth?: number;
23
+ };
24
+ export declare const SideBar: FC<SideBarProps>;
25
+ export {};
@@ -0,0 +1,351 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ import classNames from 'classnames';
16
+ import React, { memo, useContext, useEffect, useMemo, useRef, useState } from 'react';
17
+ import ScrollView from "../ScrollView";
18
+ import { SideBarContext } from "./SideBarContext";
19
+ import "./style.scss";
20
+ var sideBarCls = 'triones-antm-sidebar';
21
+ var SideBarTab = function SideBarTab(_ref) {
22
+ var tabKey = _ref.tabKey,
23
+ title = _ref.title;
24
+ var _useContext = useContext(SideBarContext),
25
+ activeKey = _useContext.activeKey,
26
+ setActiveKey = _useContext.setActiveKey;
27
+ var tabRef = useRef();
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ ref: tabRef,
30
+ className: classNames("".concat(sideBarCls, "-tab"), _defineProperty({}, "".concat(sideBarCls, "-tab-active"), activeKey === tabKey)),
31
+ onClick: function onClick() {
32
+ setActiveKey === null || setActiveKey === void 0 || setActiveKey(tabKey);
33
+ }
34
+ }, title);
35
+ };
36
+ var SideBarContent = /*#__PURE__*/memo(function (_ref2) {
37
+ var _contentItemRef$curre;
38
+ var tabKey = _ref2.tabKey,
39
+ content = _ref2.content;
40
+ var _useState = useState(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ rendered = _useState2[0],
43
+ setRendered = _useState2[1];
44
+ var contentItemRef = useRef();
45
+ var frameRef = useRef();
46
+ var _useContext2 = useContext(SideBarContext),
47
+ activeKey = _useContext2.activeKey,
48
+ mode = _useContext2.mode,
49
+ activeChangeCallback = _useContext2.activeChangeCallback,
50
+ onMoveToTab = _useContext2.onMoveToTab,
51
+ scrollDetail = _useContext2.scrollDetail,
52
+ asyncRender = _useContext2.asyncRender,
53
+ contentRef = _useContext2.contentRef,
54
+ contentWheelRef = _useContext2.contentWheelRef,
55
+ manual = _useContext2.manual;
56
+ var computeContentOffsetTop = /*#__PURE__*/function () {
57
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
59
+ while (1) switch (_context.prev = _context.next) {
60
+ case 0:
61
+ return _context.abrupt("return", contentItemRef.current.offsetTop);
62
+ case 1:
63
+ case "end":
64
+ return _context.stop();
65
+ }
66
+ }, _callee);
67
+ }));
68
+ return function computeContentOffsetTop() {
69
+ return _ref3.apply(this, arguments);
70
+ };
71
+ }();
72
+
73
+ /**
74
+ * 计算当前页顶部,距离可滚动区域顶部的距离
75
+ */
76
+ var computeReactiveOffsetTop = /*#__PURE__*/function () {
77
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
78
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
79
+ while (1) switch (_context2.prev = _context2.next) {
80
+ case 0:
81
+ return _context2.abrupt("return", contentItemRef.current.offsetTop - Math.abs(scrollDetail.top));
82
+ case 1:
83
+ case "end":
84
+ return _context2.stop();
85
+ }
86
+ }, _callee2);
87
+ }));
88
+ return function computeReactiveOffsetTop() {
89
+ return _ref4.apply(this, arguments);
90
+ };
91
+ }();
92
+
93
+ /**
94
+ * 计算当前页底部,距离可滚动区域顶部的距离
95
+ */
96
+ var computeReactiveOffsetBottom = /*#__PURE__*/function () {
97
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
98
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
99
+ while (1) switch (_context3.prev = _context3.next) {
100
+ case 0:
101
+ return _context3.abrupt("return", contentItemRef.current.offsetTop + contentItemRef.current.offsetHeight - Math.abs(scrollDetail.top));
102
+ case 1:
103
+ case "end":
104
+ return _context3.stop();
105
+ }
106
+ }, _callee3);
107
+ }));
108
+ return function computeReactiveOffsetBottom() {
109
+ return _ref5.apply(this, arguments);
110
+ };
111
+ }();
112
+ useEffect(function () {
113
+ if (activeKey === tabKey) {
114
+ setRendered(true);
115
+ if (mode === 'scroll' && !manual) {
116
+ Promise.all([]).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
117
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
118
+ while (1) switch (_context4.prev = _context4.next) {
119
+ case 0:
120
+ _context4.t0 = activeChangeCallback === null || activeChangeCallback === void 0;
121
+ if (_context4.t0) {
122
+ _context4.next = 7;
123
+ break;
124
+ }
125
+ _context4.t1 = activeChangeCallback;
126
+ _context4.next = 5;
127
+ return computeContentOffsetTop();
128
+ case 5:
129
+ _context4.t2 = _context4.sent;
130
+ (0, _context4.t1)(_context4.t2);
131
+ case 7:
132
+ case "end":
133
+ return _context4.stop();
134
+ }
135
+ }, _callee4);
136
+ })));
137
+ }
138
+ }
139
+ }, [activeKey]);
140
+
141
+ /**
142
+ * 监听滚动变化,只有在人为操作的时候才监听滚动的位置是否需要切换tab,如果是切换tab 引发的滚动则不执行
143
+ */
144
+ useEffect(function () {
145
+ // return;
146
+ if (mode === 'scroll' && manual) {
147
+ if (frameRef.current) {
148
+ cancelAnimationFrame(frameRef.current);
149
+ }
150
+ frameRef.current = requestAnimationFrame( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
151
+ var reactiveOffsetTop, reactiveOffsetBottom;
152
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
153
+ while (1) switch (_context5.prev = _context5.next) {
154
+ case 0:
155
+ if (!(activeKey !== tabKey)) {
156
+ _context5.next = 8;
157
+ break;
158
+ }
159
+ _context5.next = 3;
160
+ return computeReactiveOffsetTop();
161
+ case 3:
162
+ reactiveOffsetTop = _context5.sent;
163
+ _context5.next = 6;
164
+ return computeReactiveOffsetBottom();
165
+ case 6:
166
+ reactiveOffsetBottom = _context5.sent;
167
+ if (-50 <= reactiveOffsetTop && reactiveOffsetTop <= 0 || 0 <= reactiveOffsetBottom && reactiveOffsetBottom <= 50) {
168
+ onMoveToTab === null || onMoveToTab === void 0 || onMoveToTab(tabKey);
169
+ }
170
+ case 8:
171
+ case "end":
172
+ return _context5.stop();
173
+ }
174
+ }, _callee5);
175
+ })));
176
+ }
177
+ }, [scrollDetail]);
178
+ return /*#__PURE__*/React.createElement("div", {
179
+ ref: contentItemRef,
180
+ id: (_contentItemRef$curre = contentItemRef.current) === null || _contentItemRef$curre === void 0 ? void 0 : _contentItemRef$curre.uid,
181
+ className: classNames("".concat(sideBarCls, "-content-item"), _defineProperty({}, "".concat(sideBarCls, "-content-item-active"), activeKey === tabKey))
182
+ }, asyncRender ? rendered && content : content);
183
+ });
184
+ var SideBarContents = /*#__PURE__*/memo(function (_ref8) {
185
+ var items = _ref8.items;
186
+ return /*#__PURE__*/React.createElement(React.Fragment, null, items.map(function (item, index) {
187
+ return /*#__PURE__*/React.createElement(SideBarContent, {
188
+ key: "".concat(item.tabKey, "-content"),
189
+ tabKey: item.tabKey,
190
+ content: item.content
191
+ // activeChangeCallback={handleSelectScroll}
192
+ });
193
+ }));
194
+ });
195
+ export var SideBar = function SideBar(_ref9) {
196
+ var _contentRef$current;
197
+ var activeKey = _ref9.activeKey,
198
+ defaultActiveKey = _ref9.defaultActiveKey,
199
+ _ref9$items = _ref9.items,
200
+ items = _ref9$items === void 0 ? [] : _ref9$items,
201
+ _ref9$mode = _ref9.mode,
202
+ mode = _ref9$mode === void 0 ? 'switch' : _ref9$mode,
203
+ _ref9$asyncRender = _ref9.asyncRender,
204
+ asyncRender = _ref9$asyncRender === void 0 ? false : _ref9$asyncRender,
205
+ _ref9$tabWidth = _ref9.tabWidth,
206
+ tabWidth = _ref9$tabWidth === void 0 ? 100 : _ref9$tabWidth;
207
+ var contentRef = useRef();
208
+ var contentWheelRef = useRef();
209
+ var frameRef = useRef();
210
+ var _useState3 = useState([]),
211
+ _useState4 = _slicedToArray(_useState3, 2),
212
+ internalItems = _useState4[0],
213
+ setInternalItems = _useState4[1];
214
+ var _useState5 = useState(activeKey || defaultActiveKey),
215
+ _useState6 = _slicedToArray(_useState5, 2),
216
+ internalActiveKey = _useState6[0],
217
+ setInternalActiveKey = _useState6[1];
218
+ var _useState7 = useState(false),
219
+ _useState8 = _slicedToArray(_useState7, 2),
220
+ manual = _useState8[0],
221
+ setManual = _useState8[1];
222
+ var _useState9 = useState({
223
+ top: 0
224
+ }),
225
+ _useState10 = _slicedToArray(_useState9, 2),
226
+ scrollDetail = _useState10[0],
227
+ setScrollDetail = _useState10[1];
228
+ var scrollTop = useMemo(function () {
229
+ if (!scrollDetail.manual) {
230
+ return scrollDetail.top;
231
+ }
232
+ return 0;
233
+ }, [scrollDetail === null || scrollDetail === void 0 ? void 0 : scrollDetail.top]);
234
+ var handleSelectScroll = function handleSelectScroll(scrollTop) {
235
+ if (mode === 'scroll' && !manual) {
236
+ setScrollDetail({
237
+ manual: manual,
238
+ top: scrollTop
239
+ });
240
+ }
241
+ };
242
+ var handleActiveChange = function handleActiveChange(tabKey) {
243
+ setInternalActiveKey(tabKey);
244
+ };
245
+ useEffect(function () {
246
+ setInternalItems(items === null || items === void 0 ? void 0 : items.map(function (item) {
247
+ return {
248
+ tabKey: item.key,
249
+ title: item.title,
250
+ content: item.content
251
+ };
252
+ }));
253
+ if (!internalActiveKey) {
254
+ var _items$;
255
+ setInternalActiveKey(items === null || items === void 0 || (_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.key);
256
+ }
257
+ }, [items]);
258
+ useEffect(function () {
259
+ if (undefined !== activeKey) {
260
+ setInternalActiveKey(activeKey);
261
+ }
262
+ }, [activeKey]);
263
+ useEffect(function () {
264
+ if (mode === 'scroll') {
265
+ // setContentEl(taroExtend.$(contentRef.current));
266
+ // setContentWheelEl(taroExtend.$(contentWheelRef.current));
267
+ }
268
+ return function () {
269
+ if (frameRef.current) {
270
+ cancelAnimationFrame(frameRef.current);
271
+ }
272
+ };
273
+ }, []);
274
+ return /*#__PURE__*/React.createElement(SideBarContext.Provider, {
275
+ value: {
276
+ activeKey: internalActiveKey,
277
+ setActiveKey: setInternalActiveKey,
278
+ mode: mode,
279
+ scrollDetail: scrollDetail,
280
+ setScrollDetail: setScrollDetail,
281
+ contentWheelRef: contentWheelRef,
282
+ contentRef: contentRef,
283
+ activeChangeCallback: handleSelectScroll,
284
+ asyncRender: asyncRender,
285
+ onMoveToTab: handleActiveChange,
286
+ manual: manual,
287
+ setManul: setManual
288
+ }
289
+ }, /*#__PURE__*/React.createElement("div", {
290
+ className: classNames("".concat(sideBarCls), "".concat(sideBarCls, "-").concat(mode, "-mode"))
291
+ }, /*#__PURE__*/React.createElement("div", {
292
+ className: classNames("".concat(sideBarCls, "-tabs")),
293
+ style: {
294
+ width: tabWidth
295
+ }
296
+ }, internalItems.map(function (item, index) {
297
+ return /*#__PURE__*/React.createElement(SideBarTab, _extends({
298
+ key: "".concat(item.tabKey, "-tab")
299
+ }, item, {
300
+ tabKey: item.tabKey,
301
+ activeKey: internalActiveKey,
302
+ onActiveChange: handleActiveChange
303
+ }));
304
+ })), /*#__PURE__*/React.createElement("div", {
305
+ ref: contentRef,
306
+ id: (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.uid,
307
+ className: classNames("".concat(sideBarCls, "-content")),
308
+ onTouchStart: function onTouchStart(e) {
309
+ setManual(true);
310
+ },
311
+ onTouchEnd: function onTouchEnd(e) {
312
+ setManual(false);
313
+ },
314
+ onMouseEnter: function onMouseEnter(e) {
315
+ setManual(true);
316
+ },
317
+ onMouseLeave: function onMouseLeave(e) {
318
+ setManual(false);
319
+ },
320
+ onMouseOut: function onMouseOut(e) {
321
+ setManual(false);
322
+ },
323
+ onMouseOver: function onMouseOver(e) {
324
+ setManual(true);
325
+ },
326
+ onMouseMove: function onMouseMove(e) {
327
+ setManual(true);
328
+ }
329
+ }, mode === 'scroll' && /*#__PURE__*/React.createElement(ScrollView, {
330
+ style: {
331
+ height: '100%'
332
+ },
333
+ scrollY: true,
334
+ scrollTop: scrollTop,
335
+ onScroll: function onScroll(e) {
336
+ //如果是脚本触发的滚动,则不处理,避免在滚动过程中,触发滚动事件,导致滚动停止
337
+ if (manual) {
338
+ setScrollDetail({
339
+ manual: manual,
340
+ top: e.detail.scrollTop
341
+ });
342
+ }
343
+ }
344
+ }, /*#__PURE__*/React.createElement("div", {
345
+ ref: contentWheelRef
346
+ }, /*#__PURE__*/React.createElement(SideBarContents, {
347
+ items: internalItems
348
+ }))), mode === 'switch' && /*#__PURE__*/React.createElement(SideBarContents, {
349
+ items: internalItems
350
+ }))));
351
+ };
@@ -0,0 +1,85 @@
1
+ @import "../style/variable";
2
+
3
+ $trionesSideBarCls: 'triones-antm-sidebar';
4
+
5
+ .#{$trionesSideBarCls} {
6
+ display: flex;
7
+ height: 100%;
8
+
9
+
10
+ &-tabs {
11
+ min-width: 0;
12
+ background-color: $trionesColorFill;
13
+ overflow: auto;
14
+ scrollbar-width: thin;
15
+ flex-shrink: 0;
16
+ }
17
+
18
+ &-tab {
19
+ cursor: pointer;
20
+ padding: $trionesPadding $trionesPadding;
21
+ color: $trionesColorTextSecondary;
22
+
23
+ &-active {
24
+ color: $trionesColorPrimaryText;
25
+ background-color: $trionesColorBgBase;
26
+ }
27
+
28
+ }
29
+
30
+ &-content {
31
+ flex: 1 auto;
32
+ min-width: 0;
33
+ overflow: hidden;
34
+ //overflow-y: auto;
35
+ //scrollbar-width: none;
36
+ position: relative;
37
+ user-select: none;
38
+ touch-action: none;
39
+
40
+
41
+ &-wheel {
42
+ width: 100%;
43
+ cursor: grab;
44
+ position: absolute;
45
+ }
46
+
47
+ &-item {
48
+
49
+ &-active {
50
+ display: block;
51
+ }
52
+ }
53
+ }
54
+
55
+ &-switch-mode {
56
+ .#{$trionesSideBarCls} {
57
+ &-content {
58
+
59
+ &-item {
60
+ height: 100%;
61
+ display: none;
62
+ &-active {
63
+ display: block;
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ &-scroll-mode {
71
+ .#{$trionesSideBarCls} {
72
+ &-content {
73
+
74
+ &-item {
75
+
76
+
77
+ &-active {
78
+ display: block;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ }
@@ -0,0 +1,7 @@
1
+ export type ScrollDetail = {
2
+ /**
3
+ * 是否是人为滚动
4
+ */
5
+ manual?: boolean;
6
+ top?: number;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Space } from './space';
2
+ export type { SpaceProps } from './space';
3
+ export default Space;
@@ -0,0 +1,2 @@
1
+ import { Space } from "./space";
2
+ export default Space;
@@ -0,0 +1,38 @@
1
+ import React, { CSSProperties, FC, ReactNode } from 'react';
2
+ import './style.scss';
3
+ export type Size = 'small' | 'middle' | 'large' | number;
4
+ export type SpaceProps = {
5
+ className?: string;
6
+ /**
7
+ * @description 间距方向
8
+ */
9
+ direction?: 'horizontal' | 'vertical';
10
+ /**
11
+ * @description 垂直对齐方式
12
+ */
13
+ align?: 'start' | 'end' | 'center' | 'baseline';
14
+ /**
15
+ * @description 垂直对齐方式
16
+ */
17
+ justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';
18
+ /**
19
+ * @description 换行
20
+ */
21
+ wrap?: boolean;
22
+ /**
23
+ * @description 是否为块级元素
24
+ */
25
+ block?: boolean;
26
+ /**
27
+ * @description 点击事件
28
+ * @param event
29
+ */
30
+ onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
31
+ children?: ReactNode;
32
+ /**
33
+ * @description 间距大小
34
+ */
35
+ size?: Size | Size[];
36
+ style?: CSSProperties;
37
+ };
38
+ export declare const Space: FC<SpaceProps>;
@@ -0,0 +1,61 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import classNames from 'classnames';
8
+ import React, { useMemo } from 'react';
9
+ import "./style.scss";
10
+ var classPrefix = "triones-antm-space";
11
+ export var Space = function Space(_ref) {
12
+ var children = _ref.children,
13
+ className = _ref.className,
14
+ _ref$direction = _ref.direction,
15
+ direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
16
+ align = _ref.align,
17
+ justify = _ref.justify,
18
+ wrap = _ref.wrap,
19
+ block = _ref.block,
20
+ onClick = _ref.onClick,
21
+ _ref$size = _ref.size,
22
+ size = _ref$size === void 0 ? 'small' : _ref$size,
23
+ style = _ref.style;
24
+ var sizeValue = function sizeValue(size) {
25
+ if (typeof size === 'number') {
26
+ return "".concat(size, "Px");
27
+ } else if (size === 'small') {
28
+ return '8Px';
29
+ } else if (size === 'middle') {
30
+ return '16Px';
31
+ } else if (size === 'large') {
32
+ return '24Px';
33
+ }
34
+ };
35
+ var columnGapValue = useMemo(function () {
36
+ if (Array.isArray(size)) {
37
+ return sizeValue(size[1]);
38
+ } else {
39
+ return sizeValue(size);
40
+ }
41
+ }, [size]);
42
+ var rowGapValue = useMemo(function () {
43
+ if (Array.isArray(size)) {
44
+ return sizeValue(size[1]);
45
+ } else {
46
+ return sizeValue(size);
47
+ }
48
+ }, [size]);
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: classNames(classPrefix, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix, "-wrap"), wrap), "".concat(classPrefix, "-block"), block), "".concat(classPrefix, "-").concat(direction), true), "".concat(classPrefix, "-align-").concat(align), !!align), "".concat(classPrefix, "-justify-").concat(justify), !!justify)),
51
+ style: _objectSpread(_objectSpread({}, style), {}, {
52
+ columnGap: columnGapValue,
53
+ rowGap: rowGapValue
54
+ }),
55
+ onClick: onClick
56
+ }, React.Children.map(children, function (child) {
57
+ return child !== null && child !== undefined && /*#__PURE__*/React.createElement("div", {
58
+ className: "".concat(classPrefix, "-item")
59
+ }, child);
60
+ }));
61
+ };