taro-uno-ui 0.9.0-beta

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 (397) hide show
  1. package/LICENSE +100 -0
  2. package/README.md +273 -0
  3. package/dist/js/index-6NJ3A1Dn.js +26535 -0
  4. package/dist/js/index-6NJ3A1Dn.js.map +1 -0
  5. package/dist/js/index-DFdcksbe.js +1165 -0
  6. package/dist/js/index-DFdcksbe.js.map +1 -0
  7. package/dist/js/index-DXRIkWX1.js +1148 -0
  8. package/dist/js/index-DXRIkWX1.js.map +1 -0
  9. package/dist/js/index-DffLRSro.js +26519 -0
  10. package/dist/js/index-DffLRSro.js.map +1 -0
  11. package/package.json +119 -0
  12. package/src/app.config.ts +55 -0
  13. package/src/app.scss +508 -0
  14. package/src/app.tsx +44 -0
  15. package/src/components/basic/Button/Button.styles.ts +130 -0
  16. package/src/components/basic/Button/Button.test.tsx +154 -0
  17. package/src/components/basic/Button/Button.tsx +93 -0
  18. package/src/components/basic/Button/Button.types.ts +45 -0
  19. package/src/components/basic/Button/index.tsx +6 -0
  20. package/src/components/basic/Divider/Divider.styles.ts +488 -0
  21. package/src/components/basic/Divider/Divider.test.tsx +551 -0
  22. package/src/components/basic/Divider/Divider.tsx +361 -0
  23. package/src/components/basic/Divider/Divider.types.ts +261 -0
  24. package/src/components/basic/Divider/index.tsx +25 -0
  25. package/src/components/basic/Icon/Icon.styles.ts +359 -0
  26. package/src/components/basic/Icon/Icon.test.tsx +357 -0
  27. package/src/components/basic/Icon/Icon.tsx +154 -0
  28. package/src/components/basic/Icon/Icon.types.ts +210 -0
  29. package/src/components/basic/Icon/index.tsx +22 -0
  30. package/src/components/basic/Text/Text.styles.ts +500 -0
  31. package/src/components/basic/Text/Text.test.tsx +299 -0
  32. package/src/components/basic/Text/Text.tsx +340 -0
  33. package/src/components/basic/Text/Text.types.ts +319 -0
  34. package/src/components/basic/Text/index.tsx +27 -0
  35. package/src/components/basic/Typography/Typography.styles.ts +346 -0
  36. package/src/components/basic/Typography/Typography.tsx +205 -0
  37. package/src/components/basic/Typography/Typography.types.ts +296 -0
  38. package/src/components/basic/Typography/index.tsx +14 -0
  39. package/src/components/basic/index.tsx +302 -0
  40. package/src/components/common/ErrorBoundary.tsx +87 -0
  41. package/src/components/common/LazyComponent.tsx +246 -0
  42. package/src/components/common/ResponsiveContainer.tsx +93 -0
  43. package/src/components/common/ResponsiveGrid.tsx +183 -0
  44. package/src/components/common/SecurityProvider.tsx +110 -0
  45. package/src/components/common/ThemeProvider.tsx +128 -0
  46. package/src/components/common/VirtualList.tsx +368 -0
  47. package/src/components/common/__tests__/ErrorBoundary.test.tsx +249 -0
  48. package/src/components/common/index.tsx +7 -0
  49. package/src/components/display/Avatar/Avatar.styles.ts +62 -0
  50. package/src/components/display/Avatar/Avatar.test.tsx +390 -0
  51. package/src/components/display/Avatar/Avatar.tsx +79 -0
  52. package/src/components/display/Avatar/Avatar.types.ts +40 -0
  53. package/src/components/display/Avatar/index.ts +3 -0
  54. package/src/components/display/Badge/Badge.tsx +42 -0
  55. package/src/components/display/Badge/Badge.types.ts +29 -0
  56. package/src/components/display/Badge/index.ts +2 -0
  57. package/src/components/display/Calendar/Calendar.styles.ts +255 -0
  58. package/src/components/display/Calendar/Calendar.test.tsx +30 -0
  59. package/src/components/display/Calendar/Calendar.tsx +337 -0
  60. package/src/components/display/Calendar/Calendar.types.ts +91 -0
  61. package/src/components/display/Calendar/index.ts +3 -0
  62. package/src/components/display/Card/Card.styles.ts +89 -0
  63. package/src/components/display/Card/Card.test.tsx +180 -0
  64. package/src/components/display/Card/Card.tsx +135 -0
  65. package/src/components/display/Card/Card.types.ts +55 -0
  66. package/src/components/display/Card/index.ts +3 -0
  67. package/src/components/display/Carousel/Carousel.styles.ts +206 -0
  68. package/src/components/display/Carousel/Carousel.tsx +295 -0
  69. package/src/components/display/Carousel/Carousel.types.ts +57 -0
  70. package/src/components/display/Carousel/index.ts +3 -0
  71. package/src/components/display/List/List.styles.ts +79 -0
  72. package/src/components/display/List/List.tsx +115 -0
  73. package/src/components/display/List/List.types.ts +68 -0
  74. package/src/components/display/List/index.ts +3 -0
  75. package/src/components/display/Rate/Rate.styles.ts +266 -0
  76. package/src/components/display/Rate/Rate.tsx +332 -0
  77. package/src/components/display/Rate/Rate.types.ts +111 -0
  78. package/src/components/display/Rate/index.ts +28 -0
  79. package/src/components/display/Table/Table.styles.ts +269 -0
  80. package/src/components/display/Table/Table.test.tsx +343 -0
  81. package/src/components/display/Table/Table.tsx +430 -0
  82. package/src/components/display/Table/Table.types.ts +255 -0
  83. package/src/components/display/Table/index.tsx +16 -0
  84. package/src/components/display/Tag/Tag.styles.ts +197 -0
  85. package/src/components/display/Tag/Tag.test.tsx +541 -0
  86. package/src/components/display/Tag/Tag.tsx +156 -0
  87. package/src/components/display/Tag/Tag.types.ts +49 -0
  88. package/src/components/display/Tag/index.ts +3 -0
  89. package/src/components/display/Timeline/Timeline.styles.ts +211 -0
  90. package/src/components/display/Timeline/Timeline.tsx +239 -0
  91. package/src/components/display/Timeline/Timeline.types.ts +56 -0
  92. package/src/components/display/Timeline/index.ts +3 -0
  93. package/src/components/display/index.tsx +143 -0
  94. package/src/components/feedback/Loading/Loading.styles.ts +117 -0
  95. package/src/components/feedback/Loading/Loading.test.tsx +534 -0
  96. package/src/components/feedback/Loading/Loading.tsx +127 -0
  97. package/src/components/feedback/Loading/Loading.types.ts +33 -0
  98. package/src/components/feedback/Loading/index.ts +9 -0
  99. package/src/components/feedback/Message/Message.styles.ts +41 -0
  100. package/src/components/feedback/Message/Message.test.tsx +234 -0
  101. package/src/components/feedback/Message/Message.tsx +96 -0
  102. package/src/components/feedback/Message/Message.types.ts +37 -0
  103. package/src/components/feedback/Message/index.ts +9 -0
  104. package/src/components/feedback/Modal/Modal.styles.ts +21 -0
  105. package/src/components/feedback/Modal/Modal.test.tsx +11 -0
  106. package/src/components/feedback/Modal/Modal.tsx +291 -0
  107. package/src/components/feedback/Modal/Modal.types.ts +141 -0
  108. package/src/components/feedback/Modal/index.tsx +11 -0
  109. package/src/components/feedback/Notification/Notification.styles.ts +443 -0
  110. package/src/components/feedback/Notification/Notification.test.tsx +401 -0
  111. package/src/components/feedback/Notification/Notification.tsx +370 -0
  112. package/src/components/feedback/Notification/Notification.types.ts +336 -0
  113. package/src/components/feedback/Notification/NotificationManager.tsx +376 -0
  114. package/src/components/feedback/Notification/index.ts +33 -0
  115. package/src/components/feedback/Notification/index.tsx +164 -0
  116. package/src/components/feedback/Progress/Progress.styles.ts +460 -0
  117. package/src/components/feedback/Progress/Progress.test.simple.tsx +14 -0
  118. package/src/components/feedback/Progress/Progress.test.tsx +312 -0
  119. package/src/components/feedback/Progress/Progress.tsx +508 -0
  120. package/src/components/feedback/Progress/Progress.types.ts +163 -0
  121. package/src/components/feedback/Progress/index.ts +3 -0
  122. package/src/components/feedback/Progress/index.tsx +38 -0
  123. package/src/components/feedback/Progress/utils/animation.ts +204 -0
  124. package/src/components/feedback/Progress/utils/index.ts +26 -0
  125. package/src/components/feedback/Progress/utils/progress-calculator.ts +217 -0
  126. package/src/components/feedback/Result/Result.styles.ts +139 -0
  127. package/src/components/feedback/Result/Result.tsx +233 -0
  128. package/src/components/feedback/Result/Result.types.ts +128 -0
  129. package/src/components/feedback/Result/index.tsx +3 -0
  130. package/src/components/feedback/Toast/Toast.styles.ts +17 -0
  131. package/src/components/feedback/Toast/Toast.test.tsx +10 -0
  132. package/src/components/feedback/Toast/Toast.tsx +372 -0
  133. package/src/components/feedback/Toast/Toast.types.ts +86 -0
  134. package/src/components/feedback/Toast/index.tsx +3 -0
  135. package/src/components/feedback/Tooltip/Tooltip.examples.tsx +458 -0
  136. package/src/components/feedback/Tooltip/Tooltip.styles.ts +346 -0
  137. package/src/components/feedback/Tooltip/Tooltip.test.tsx +446 -0
  138. package/src/components/feedback/Tooltip/Tooltip.tsx +283 -0
  139. package/src/components/feedback/Tooltip/Tooltip.types.ts +172 -0
  140. package/src/components/feedback/Tooltip/index.ts +3 -0
  141. package/src/components/feedback/Tooltip/index.tsx +258 -0
  142. package/src/components/feedback/index.tsx +164 -0
  143. package/src/components/form/Cascader/Cascader.styles.ts +526 -0
  144. package/src/components/form/Cascader/Cascader.test.tsx +77 -0
  145. package/src/components/form/Cascader/Cascader.tsx +585 -0
  146. package/src/components/form/Cascader/Cascader.types.ts +582 -0
  147. package/src/components/form/Cascader/hooks/index.ts +3 -0
  148. package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +16 -0
  149. package/src/components/form/Cascader/hooks/useCascaderOptions.ts +109 -0
  150. package/src/components/form/Cascader/hooks/useCascaderState.ts +133 -0
  151. package/src/components/form/Cascader/index.ts +25 -0
  152. package/src/components/form/Cascader/utils/formatDisplayValue.ts +19 -0
  153. package/src/components/form/Cascader/utils/index.ts +1 -0
  154. package/src/components/form/Checkbox/Checkbox.styles.ts +608 -0
  155. package/src/components/form/Checkbox/Checkbox.test.tsx +1140 -0
  156. package/src/components/form/Checkbox/Checkbox.tsx +496 -0
  157. package/src/components/form/Checkbox/Checkbox.types.ts +472 -0
  158. package/src/components/form/Checkbox/CheckboxGroup.tsx +444 -0
  159. package/src/components/form/Checkbox/index.tsx +27 -0
  160. package/src/components/form/DatePicker/DatePicker.styles.ts +393 -0
  161. package/src/components/form/DatePicker/DatePicker.test.tsx +407 -0
  162. package/src/components/form/DatePicker/DatePicker.tsx +360 -0
  163. package/src/components/form/DatePicker/DatePicker.types.ts +247 -0
  164. package/src/components/form/DatePicker/index.tsx +15 -0
  165. package/src/components/form/Form/Form.styles.ts +357 -0
  166. package/src/components/form/Form/Form.test.tsx +122 -0
  167. package/src/components/form/Form/Form.tsx +695 -0
  168. package/src/components/form/Form/Form.types.ts +407 -0
  169. package/src/components/form/Form/index.tsx +31 -0
  170. package/src/components/form/Input/Input.enhanced.tsx +732 -0
  171. package/src/components/form/Input/Input.styles.ts +438 -0
  172. package/src/components/form/Input/Input.test.tsx +494 -0
  173. package/src/components/form/Input/Input.tsx +541 -0
  174. package/src/components/form/Input/Input.types.ts +285 -0
  175. package/src/components/form/Input/index.tsx +26 -0
  176. package/src/components/form/InputNumber/InputNumber.styles.ts +665 -0
  177. package/src/components/form/InputNumber/InputNumber.tsx +370 -0
  178. package/src/components/form/InputNumber/InputNumber.types.ts +318 -0
  179. package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +32 -0
  180. package/src/components/form/InputNumber/components/InputNumberControls.tsx +42 -0
  181. package/src/components/form/InputNumber/components/index.ts +2 -0
  182. package/src/components/form/InputNumber/hooks/index.ts +4 -0
  183. package/src/components/form/InputNumber/hooks/useInputNumberState.ts +315 -0
  184. package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +147 -0
  185. package/src/components/form/InputNumber/index.ts +25 -0
  186. package/src/components/form/Radio/Radio.styles.ts +458 -0
  187. package/src/components/form/Radio/Radio.test.tsx +547 -0
  188. package/src/components/form/Radio/Radio.tsx +283 -0
  189. package/src/components/form/Radio/Radio.types.ts +410 -0
  190. package/src/components/form/Radio/index.tsx +21 -0
  191. package/src/components/form/Select/Select.styles.ts +514 -0
  192. package/src/components/form/Select/Select.test.tsx +648 -0
  193. package/src/components/form/Select/Select.tsx +474 -0
  194. package/src/components/form/Select/Select.types.ts +428 -0
  195. package/src/components/form/Select/index.tsx +30 -0
  196. package/src/components/form/Slider/Slider.styles.ts +139 -0
  197. package/src/components/form/Slider/Slider.test.tsx +553 -0
  198. package/src/components/form/Slider/Slider.tsx +326 -0
  199. package/src/components/form/Slider/Slider.types.ts +108 -0
  200. package/src/components/form/Slider/index.tsx +10 -0
  201. package/src/components/form/Switch/Switch.styles.ts +540 -0
  202. package/src/components/form/Switch/Switch.test.tsx +345 -0
  203. package/src/components/form/Switch/Switch.tsx +464 -0
  204. package/src/components/form/Switch/Switch.types.ts +386 -0
  205. package/src/components/form/Switch/index.tsx +26 -0
  206. package/src/components/form/Textarea/Textarea.styles.ts +592 -0
  207. package/src/components/form/Textarea/Textarea.test.tsx +1075 -0
  208. package/src/components/form/Textarea/Textarea.tsx +602 -0
  209. package/src/components/form/Textarea/Textarea.types.ts +371 -0
  210. package/src/components/form/Textarea/index.tsx +26 -0
  211. package/src/components/form/TimePicker/TimePicker.styles.ts +438 -0
  212. package/src/components/form/TimePicker/TimePicker.test.tsx +306 -0
  213. package/src/components/form/TimePicker/TimePicker.tsx +228 -0
  214. package/src/components/form/TimePicker/TimePicker.types.ts +385 -0
  215. package/src/components/form/TimePicker/index.ts +21 -0
  216. package/src/components/form/Transfer/Transfer.styles.ts +502 -0
  217. package/src/components/form/Transfer/Transfer.test.tsx +316 -0
  218. package/src/components/form/Transfer/Transfer.tsx +402 -0
  219. package/src/components/form/Transfer/Transfer.types.ts +557 -0
  220. package/src/components/form/Transfer/components/TransferItem.tsx +101 -0
  221. package/src/components/form/Transfer/components/TransferList.tsx +285 -0
  222. package/src/components/form/Transfer/components/TransferOperations.tsx +84 -0
  223. package/src/components/form/Transfer/components/TransferPagination.tsx +135 -0
  224. package/src/components/form/Transfer/components/TransferSearch.tsx +88 -0
  225. package/src/components/form/Transfer/components/index.ts +6 -0
  226. package/src/components/form/Transfer/hooks/index.ts +3 -0
  227. package/src/components/form/Transfer/hooks/useTransferData.ts +192 -0
  228. package/src/components/form/Transfer/hooks/useTransferState.ts +114 -0
  229. package/src/components/form/Transfer/index.ts +33 -0
  230. package/src/components/form/Upload/Upload.styles.ts +145 -0
  231. package/src/components/form/Upload/Upload.test.tsx +10 -0
  232. package/src/components/form/Upload/Upload.tsx +451 -0
  233. package/src/components/form/Upload/Upload.types.ts +200 -0
  234. package/src/components/form/Upload/index.tsx +12 -0
  235. package/src/components/form/index.tsx +121 -0
  236. package/src/components/index.tsx +146 -0
  237. package/src/components/layout/Affix/Affix.styles.ts +37 -0
  238. package/src/components/layout/Affix/Affix.test.tsx +10 -0
  239. package/src/components/layout/Affix/Affix.tsx +91 -0
  240. package/src/components/layout/Affix/Affix.types.ts +29 -0
  241. package/src/components/layout/Affix/index.tsx +3 -0
  242. package/src/components/layout/Col/Col.styles.ts +185 -0
  243. package/src/components/layout/Col/Col.test.tsx +535 -0
  244. package/src/components/layout/Col/Col.tsx +115 -0
  245. package/src/components/layout/Col/Col.types.ts +59 -0
  246. package/src/components/layout/Col/index.tsx +3 -0
  247. package/src/components/layout/Container/Container.styles.ts +161 -0
  248. package/src/components/layout/Container/Container.test.tsx +380 -0
  249. package/src/components/layout/Container/Container.tsx +132 -0
  250. package/src/components/layout/Container/Container.types.ts +63 -0
  251. package/src/components/layout/Container/index.tsx +3 -0
  252. package/src/components/layout/Grid/Grid.styles.ts +183 -0
  253. package/src/components/layout/Grid/Grid.test.tsx +637 -0
  254. package/src/components/layout/Grid/Grid.tsx +173 -0
  255. package/src/components/layout/Grid/Grid.types.ts +78 -0
  256. package/src/components/layout/Grid/index.tsx +3 -0
  257. package/src/components/layout/Layout/Content.tsx +38 -0
  258. package/src/components/layout/Layout/Footer.tsx +38 -0
  259. package/src/components/layout/Layout/Header.tsx +38 -0
  260. package/src/components/layout/Layout/Layout.styles.ts +84 -0
  261. package/src/components/layout/Layout/Layout.test.tsx +10 -0
  262. package/src/components/layout/Layout/Layout.tsx +39 -0
  263. package/src/components/layout/Layout/Layout.types.ts +58 -0
  264. package/src/components/layout/Layout/Sider.tsx +56 -0
  265. package/src/components/layout/Layout/index.tsx +8 -0
  266. package/src/components/layout/Row/Row.styles.ts +159 -0
  267. package/src/components/layout/Row/Row.test.tsx +467 -0
  268. package/src/components/layout/Row/Row.tsx +139 -0
  269. package/src/components/layout/Row/Row.types.ts +60 -0
  270. package/src/components/layout/Row/index.tsx +3 -0
  271. package/src/components/layout/Space/Space.styles.ts +255 -0
  272. package/src/components/layout/Space/Space.test.tsx +682 -0
  273. package/src/components/layout/Space/Space.tsx +211 -0
  274. package/src/components/layout/Space/Space.types.ts +92 -0
  275. package/src/components/layout/Space/index.tsx +12 -0
  276. package/src/components/layout/index.tsx +68 -0
  277. package/src/components/navigation/Menu/Menu.styles.ts +779 -0
  278. package/src/components/navigation/Menu/Menu.tsx +355 -0
  279. package/src/components/navigation/Menu/Menu.types.ts +231 -0
  280. package/src/components/navigation/Menu/Menu.utils.ts +187 -0
  281. package/src/components/navigation/Menu/MenuItem.tsx +126 -0
  282. package/src/components/navigation/Menu/SubMenu.tsx +148 -0
  283. package/src/components/navigation/Menu/__tests__/Menu.test.tsx +687 -0
  284. package/src/components/navigation/Menu/index.tsx +124 -0
  285. package/src/components/navigation/NavBar/NavBar.styles.ts +129 -0
  286. package/src/components/navigation/NavBar/NavBar.test.tsx +287 -0
  287. package/src/components/navigation/NavBar/NavBar.tsx +231 -0
  288. package/src/components/navigation/NavBar/NavBar.types.ts +54 -0
  289. package/src/components/navigation/NavBar/index.tsx +3 -0
  290. package/src/components/navigation/Pagination/Pagination.styles.ts +187 -0
  291. package/src/components/navigation/Pagination/Pagination.test.tsx +673 -0
  292. package/src/components/navigation/Pagination/Pagination.tsx +395 -0
  293. package/src/components/navigation/Pagination/Pagination.types.ts +86 -0
  294. package/src/components/navigation/Pagination/index.ts +18 -0
  295. package/src/components/navigation/Pagination/index.tsx +9 -0
  296. package/src/components/navigation/Steps/Step.tsx +56 -0
  297. package/src/components/navigation/Steps/Steps.styles.ts +154 -0
  298. package/src/components/navigation/Steps/Steps.test.tsx +12 -0
  299. package/src/components/navigation/Steps/Steps.tsx +113 -0
  300. package/src/components/navigation/Steps/Steps.types.ts +47 -0
  301. package/src/components/navigation/Steps/index.tsx +3 -0
  302. package/src/components/navigation/Tabs/Tabs.styles.ts +199 -0
  303. package/src/components/navigation/Tabs/Tabs.test.tsx +661 -0
  304. package/src/components/navigation/Tabs/Tabs.tsx +253 -0
  305. package/src/components/navigation/Tabs/Tabs.types.ts +114 -0
  306. package/src/components/navigation/Tabs/index.tsx +3 -0
  307. package/src/components/navigation/Tree/Tree.styles.ts +553 -0
  308. package/src/components/navigation/Tree/Tree.test.basic.tsx +7 -0
  309. package/src/components/navigation/Tree/Tree.test.functional.tsx +496 -0
  310. package/src/components/navigation/Tree/Tree.test.import.check.tsx +6 -0
  311. package/src/components/navigation/Tree/Tree.test.import.tsx +6 -0
  312. package/src/components/navigation/Tree/Tree.test.minimal.tsx +5 -0
  313. package/src/components/navigation/Tree/Tree.test.simple.tsx +30 -0
  314. package/src/components/navigation/Tree/Tree.test.tsx +908 -0
  315. package/src/components/navigation/Tree/Tree.test.working.tsx +673 -0
  316. package/src/components/navigation/Tree/Tree.tsx +600 -0
  317. package/src/components/navigation/Tree/Tree.types.ts +909 -0
  318. package/src/components/navigation/Tree/Tree.utils.ts +452 -0
  319. package/src/components/navigation/Tree/index.ts +33 -0
  320. package/src/components/navigation/Tree/index.tsx +23 -0
  321. package/src/components/navigation/index.tsx +83 -0
  322. package/src/constants/index.ts +785 -0
  323. package/src/hooks/index.ts +110 -0
  324. package/src/hooks/types.ts +10 -0
  325. package/src/hooks/useAsync.ts +65 -0
  326. package/src/hooks/useEventHandling.ts +444 -0
  327. package/src/hooks/useLifecycle.ts +399 -0
  328. package/src/hooks/usePerformance.ts +441 -0
  329. package/src/hooks/usePerformanceMonitor.ts +348 -0
  330. package/src/hooks/usePlatform.ts +62 -0
  331. package/src/hooks/useRequest.test.ts +11 -0
  332. package/src/hooks/useRequest.ts +135 -0
  333. package/src/hooks/useStateManagement.ts +300 -0
  334. package/src/hooks/useStyle.ts +537 -0
  335. package/src/hooks/useTheme.ts +347 -0
  336. package/src/hooks/useVirtualScroll.ts +331 -0
  337. package/src/index.ts +298 -0
  338. package/src/platform/index.ts +1188 -0
  339. package/src/providers/AppProvider.test.tsx +63 -0
  340. package/src/providers/AppProvider.tsx +155 -0
  341. package/src/providers/index.ts +1 -0
  342. package/src/theme/ThemeProvider.tsx +283 -0
  343. package/src/theme/ThemeProvider.types.ts +26 -0
  344. package/src/theme/animations.tsx +660 -0
  345. package/src/theme/defaults.ts +188 -0
  346. package/src/theme/design-system.ts +562 -0
  347. package/src/theme/design-tokens.ts +1136 -0
  348. package/src/theme/generated/dark-theme.scss +120 -0
  349. package/src/theme/generated/tokens.css +441 -0
  350. package/src/theme/generated/tokens.scss +320 -0
  351. package/src/theme/index.ts +120 -0
  352. package/src/theme/responsive.tsx +193 -0
  353. package/src/theme/styles/mixins.scss +612 -0
  354. package/src/theme/styles/variables.scss +295 -0
  355. package/src/theme/styles.ts +403 -0
  356. package/src/theme/tokens/colors.ts +256 -0
  357. package/src/theme/tokens/effects.ts +260 -0
  358. package/src/theme/tokens/index.ts +217 -0
  359. package/src/theme/tokens/spacing.ts +137 -0
  360. package/src/theme/tokens/typography.ts +186 -0
  361. package/src/theme/types.ts +188 -0
  362. package/src/theme/useThemeUtils.ts +313 -0
  363. package/src/theme/utils.ts +501 -0
  364. package/src/theme/variables.ts +583 -0
  365. package/src/types/accessibility.ts +51 -0
  366. package/src/types/button.ts +562 -0
  367. package/src/types/component-props.ts +317 -0
  368. package/src/types/env.d.ts +20 -0
  369. package/src/types/index.ts +427 -0
  370. package/src/types/modules.d.ts +40 -0
  371. package/src/types/standardized-components.ts +544 -0
  372. package/src/types/taro-adapter.d.ts +174 -0
  373. package/src/types/taro-components.d.ts +73 -0
  374. package/src/types/utils.ts +410 -0
  375. package/src/utils/__tests__/inputValidator.test.ts +338 -0
  376. package/src/utils/__tests__/responsiveUtils.test.ts +310 -0
  377. package/src/utils/__tests__/xssProtection.test.ts +268 -0
  378. package/src/utils/cache.ts +83 -0
  379. package/src/utils/createNamespace.ts +24 -0
  380. package/src/utils/environment.ts +95 -0
  381. package/src/utils/error-handler.ts +88 -0
  382. package/src/utils/errorLogger.ts +197 -0
  383. package/src/utils/formatUtils.ts +444 -0
  384. package/src/utils/index.ts +115 -0
  385. package/src/utils/inputValidator.ts +261 -0
  386. package/src/utils/network/http-client.test.ts +18 -0
  387. package/src/utils/network/http-client.ts +151 -0
  388. package/src/utils/performance/performance.ts +850 -0
  389. package/src/utils/responsiveUtils.ts +357 -0
  390. package/src/utils/rtl-support.ts +344 -0
  391. package/src/utils/security/api-security.ts +386 -0
  392. package/src/utils/security/xss-protection.ts +69 -0
  393. package/src/utils/securityHeaders.ts +314 -0
  394. package/src/utils/typeHelpers.ts +16 -0
  395. package/src/utils/types/dataProcessing.ts +543 -0
  396. package/src/utils/types/typeHelpers.ts +187 -0
  397. package/src/utils/xssProtection.ts +420 -0
@@ -0,0 +1,49 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+
3
+ export interface TagProps {
4
+ /** 标签内容 */
5
+ children?: ReactNode;
6
+ /** 标签颜色 */
7
+ color?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | string;
8
+ /** 标签大小 */
9
+ size?: 'small' | 'medium' | 'large';
10
+ /** 标签变体 */
11
+ variant?: 'solid' | 'outline' | 'light';
12
+ /** 是否可关闭 */
13
+ closable?: boolean;
14
+ /** 是否可选择 */
15
+ checkable?: boolean;
16
+ /** 是否选中(可选择模式下) */
17
+ checked?: boolean;
18
+ /** 标签图标 */
19
+ icon?: ReactNode;
20
+ /** 点击事件 */
21
+ onClick?: (_event: any) => void;
22
+ /** 关闭事件 */
23
+ onClose?: (_event: any) => void;
24
+ /** 选择变化事件 */
25
+ onCheckedChange?: (_checked: boolean) => void;
26
+ /** 自定义样式 */
27
+ style?: CSSProperties;
28
+ /** 自定义类名 */
29
+ className?: string;
30
+ }
31
+
32
+ export interface TagRef {
33
+ /** DOM 元素 */
34
+ element: any;
35
+ /** 获取标签颜色 */
36
+ getColor: () => string;
37
+ /** 获取标签大小 */
38
+ getSize: () => 'small' | 'medium' | 'large';
39
+ /** 检查是否可关闭 */
40
+ isClosable: () => boolean;
41
+ /** 检查是否可选择 */
42
+ isCheckable: () => boolean;
43
+ /** 检查是否选中 */
44
+ isChecked: () => boolean;
45
+ /** 设置选中状态 */
46
+ setChecked: (_checked: boolean) => void;
47
+ /** 关闭标签 */
48
+ close: () => void;
49
+ }
@@ -0,0 +1,3 @@
1
+ export { Tag } from './Tag';
2
+ export { tagStyles } from './Tag.styles';
3
+ export type { TagProps, TagRef } from './Tag.types';
@@ -0,0 +1,211 @@
1
+ import type { CSSProperties } from 'react';
2
+
3
+ export const timelineStyles: Record<string, CSSProperties> = {
4
+ base: {
5
+ position: 'relative',
6
+ listStyle: 'none',
7
+ margin: 0,
8
+ padding: 0,
9
+ },
10
+
11
+ vertical: {
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ },
15
+
16
+ horizontal: {
17
+ display: 'flex',
18
+ flexDirection: 'row',
19
+ alignItems: 'flex-start',
20
+ overflowX: 'auto',
21
+ paddingBottom: '16px',
22
+ },
23
+
24
+ reverse: {
25
+ flexDirection: 'column-reverse',
26
+ },
27
+
28
+ reverseHorizontal: {
29
+ flexDirection: 'row-reverse',
30
+ },
31
+
32
+ // 时间线项
33
+ item: {
34
+ position: 'relative',
35
+ paddingBottom: '20px',
36
+ minHeight: '48px',
37
+ },
38
+
39
+ itemHorizontal: {
40
+ paddingBottom: 0,
41
+ paddingRight: '20px',
42
+ minWidth: '200px',
43
+ flexShrink: 0,
44
+ },
45
+
46
+ itemLast: {
47
+ paddingBottom: 0,
48
+ },
49
+
50
+ itemLastHorizontal: {
51
+ paddingRight: 0,
52
+ },
53
+
54
+ // 时间线线条
55
+ itemLine: {
56
+ position: 'absolute',
57
+ left: '8px',
58
+ top: '20px',
59
+ width: '1px',
60
+ height: 'calc(100% - 20px)',
61
+ backgroundColor: '#f0f0f0',
62
+ },
63
+
64
+ itemLineHorizontal: {
65
+ position: 'absolute',
66
+ left: '20px',
67
+ top: '8px',
68
+ width: 'calc(100% - 20px)',
69
+ height: '1px',
70
+ backgroundColor: '#f0f0f0',
71
+ },
72
+
73
+ itemLineLast: {
74
+ display: 'none',
75
+ },
76
+
77
+ // 节点
78
+ itemDot: {
79
+ position: 'absolute',
80
+ left: '4px',
81
+ top: '4px',
82
+ width: '8px',
83
+ height: '8px',
84
+ borderRadius: '50%',
85
+ backgroundColor: '#d9d9d9',
86
+ border: '2px solid #ffffff',
87
+ boxShadow: '0 0 0 1px #d9d9d9',
88
+ zIndex: 1,
89
+ },
90
+
91
+ itemDotHorizontal: {
92
+ position: 'absolute',
93
+ left: '4px',
94
+ top: '4px',
95
+ width: '8px',
96
+ height: '8px',
97
+ },
98
+
99
+ // 节点颜色
100
+ dotDefault: {
101
+ backgroundColor: '#d9d9d9',
102
+ boxShadow: '0 0 0 1px #d9d9d9',
103
+ },
104
+
105
+ dotPrimary: {
106
+ backgroundColor: '#1890ff',
107
+ boxShadow: '0 0 0 1px #1890ff',
108
+ },
109
+
110
+ dotSuccess: {
111
+ backgroundColor: '#52c41a',
112
+ boxShadow: '0 0 0 1px #52c41a',
113
+ },
114
+
115
+ dotWarning: {
116
+ backgroundColor: '#faad14',
117
+ boxShadow: '0 0 0 1px #faad14',
118
+ },
119
+
120
+ dotDanger: {
121
+ backgroundColor: '#ff4d4f',
122
+ boxShadow: '0 0 0 1px #ff4d4f',
123
+ },
124
+
125
+ dotInfo: {
126
+ backgroundColor: '#13c2c2',
127
+ boxShadow: '0 0 0 1px #13c2c2',
128
+ },
129
+
130
+ // 自定义节点
131
+ customDot: {
132
+ position: 'absolute',
133
+ left: '0',
134
+ top: '0',
135
+ display: 'flex',
136
+ alignItems: 'center',
137
+ justifyContent: 'center',
138
+ minWidth: '16px',
139
+ minHeight: '16px',
140
+ backgroundColor: '#ffffff',
141
+ border: '1px solid #d9d9d9',
142
+ borderRadius: '50%',
143
+ zIndex: 1,
144
+ },
145
+
146
+ // 内容
147
+ itemContent: {
148
+ marginLeft: '24px',
149
+ paddingTop: '0',
150
+ wordBreak: 'break-word',
151
+ },
152
+
153
+ itemContentHorizontal: {
154
+ marginLeft: 0,
155
+ marginTop: '24px',
156
+ paddingTop: '0',
157
+ },
158
+
159
+ itemContentRight: {
160
+ marginLeft: 0,
161
+ marginRight: '24px',
162
+ textAlign: 'right',
163
+ },
164
+
165
+ // 标题和描述
166
+ itemTitle: {
167
+ fontSize: '16px',
168
+ fontWeight: '500',
169
+ color: '#262626',
170
+ marginBottom: '4px',
171
+ lineHeight: '1.5',
172
+ },
173
+
174
+ itemDescription: {
175
+ fontSize: '14px',
176
+ color: '#8c8c8c',
177
+ lineHeight: '1.5',
178
+ marginBottom: '8px',
179
+ },
180
+
181
+ itemTimestamp: {
182
+ fontSize: '12px',
183
+ color: '#8c8c8c',
184
+ marginTop: '4px',
185
+ },
186
+
187
+ // 交替模式
188
+ itemAlternateLeft: {
189
+ paddingRight: '50%',
190
+ },
191
+
192
+ itemAlternateRight: {
193
+ paddingLeft: '50%',
194
+ textAlign: 'right',
195
+ },
196
+
197
+ itemAlternateRightContent: {
198
+ marginLeft: 0,
199
+ marginRight: '24px',
200
+ },
201
+
202
+ itemAlternateRightDot: {
203
+ right: 'calc(50% - 8px)',
204
+ left: 'auto',
205
+ },
206
+
207
+ itemAlternateRightLine: {
208
+ right: 'calc(50% - 0.5px)',
209
+ left: 'auto',
210
+ },
211
+ };
@@ -0,0 +1,239 @@
1
+ import React, { forwardRef, useImperativeHandle, useRef } from 'react';
2
+ import { View, Text } from '@tarojs/components';
3
+ import { timelineStyles } from './Timeline.styles';
4
+ import type { TimelineProps, TimelineRef, TimelineItemProps } from './Timeline.types';
5
+
6
+ /** 时间线项组件 */
7
+ export const TimelineItem: React.FC<TimelineItemProps & {
8
+ mode?: 'left' | 'right' | 'alternate';
9
+ direction?: 'vertical' | 'horizontal';
10
+ showTimestamp?: boolean;
11
+ itemIndex?: number;
12
+ }> = ({
13
+ title,
14
+ children,
15
+ description,
16
+ timestamp,
17
+ color = 'default',
18
+ dot,
19
+ position,
20
+ isLast = false,
21
+ mode = 'left',
22
+ direction = 'vertical',
23
+ showTimestamp = false,
24
+ itemIndex = 0,
25
+ style,
26
+ className,
27
+ }) => {
28
+ const isHorizontal = direction === 'horizontal';
29
+ const isAlternate = mode === 'alternate';
30
+ const isRightPosition = position === 'right' || (isAlternate && itemIndex % 2 === 1);
31
+
32
+ const getItemStyle = () => {
33
+ const baseStyle = {
34
+ ...timelineStyles['item'],
35
+ ...style,
36
+ };
37
+
38
+ if (isHorizontal) {
39
+ Object.assign(baseStyle, timelineStyles['itemHorizontal']);
40
+ if (isLast) {
41
+ Object.assign(baseStyle, timelineStyles['itemLastHorizontal']);
42
+ }
43
+ } else if (isLast) {
44
+ Object.assign(baseStyle, timelineStyles['itemLast']);
45
+ }
46
+
47
+ if (isAlternate && !isHorizontal) {
48
+ if (isRightPosition) {
49
+ Object.assign(baseStyle, timelineStyles['itemAlternateRight']);
50
+ } else {
51
+ Object.assign(baseStyle, timelineStyles['itemAlternateLeft']);
52
+ }
53
+ }
54
+
55
+ return baseStyle;
56
+ };
57
+
58
+ const getLineStyle = () => {
59
+ const baseStyle = isHorizontal
60
+ ? { ...timelineStyles['itemLineHorizontal'] }
61
+ : { ...timelineStyles['itemLine'] };
62
+
63
+ if (isLast) {
64
+ Object.assign(baseStyle, timelineStyles['itemLineLast']);
65
+ }
66
+
67
+ if (isAlternate && !isHorizontal && isRightPosition) {
68
+ Object.assign(baseStyle, timelineStyles['itemAlternateRightLine']);
69
+ }
70
+
71
+ return baseStyle;
72
+ };
73
+
74
+ const getDotStyle = () => {
75
+ const baseStyle = isHorizontal
76
+ ? { ...timelineStyles['itemDotHorizontal'] }
77
+ : { ...timelineStyles['itemDot'] };
78
+
79
+ if (!dot) {
80
+ const colorStyle = timelineStyles[`dot${color.charAt(0).toUpperCase() + color.slice(1)}` as keyof typeof timelineStyles];
81
+ if (colorStyle) {
82
+ Object.assign(baseStyle, colorStyle);
83
+ } else {
84
+ // 自定义颜色
85
+ baseStyle.backgroundColor = color;
86
+ baseStyle.boxShadow = `0 0 0 1px ${color}`;
87
+ }
88
+ }
89
+
90
+ if (isAlternate && !isHorizontal && isRightPosition) {
91
+ Object.assign(baseStyle, timelineStyles['itemAlternateRightDot']);
92
+ }
93
+
94
+ return baseStyle;
95
+ };
96
+
97
+ const getContentStyle = () => {
98
+ const baseStyle = isHorizontal
99
+ ? { ...timelineStyles['itemContentHorizontal'] }
100
+ : { ...timelineStyles['itemContent'] };
101
+
102
+ if (isRightPosition && !isHorizontal) {
103
+ if (isAlternate) {
104
+ Object.assign(baseStyle, timelineStyles['itemAlternateRightContent']);
105
+ } else {
106
+ Object.assign(baseStyle, timelineStyles['itemContentRight']);
107
+ }
108
+ }
109
+
110
+ return baseStyle;
111
+ };
112
+
113
+ return (
114
+ <View style={getItemStyle()} className={className}>
115
+ {/* 连线 */}
116
+ <View style={getLineStyle()} />
117
+
118
+ {/* 节点 */}
119
+ {dot ? (
120
+ <View style={{ ...timelineStyles['customDot'], ...getDotStyle() }}>
121
+ {dot}
122
+ </View>
123
+ ) : (
124
+ <View style={getDotStyle()} />
125
+ )}
126
+
127
+ {/* 内容 */}
128
+ <View style={getContentStyle()}>
129
+ {title && (
130
+ <Text style={timelineStyles['itemTitle']}>
131
+ {title}
132
+ </Text>
133
+ )}
134
+ {description && (
135
+ <Text style={timelineStyles['itemDescription']}>
136
+ {description}
137
+ </Text>
138
+ )}
139
+ {children}
140
+ {showTimestamp && timestamp && (
141
+ <Text style={timelineStyles['itemTimestamp']}>
142
+ {timestamp}
143
+ </Text>
144
+ )}
145
+ </View>
146
+ </View>
147
+ );
148
+ };
149
+
150
+ /** 时间线组件 */
151
+ export const TimelineComponent = forwardRef<TimelineRef, TimelineProps>((props, ref) => {
152
+ const {
153
+ items = [],
154
+ mode = 'left',
155
+ reverse = false,
156
+ showTimestamp = false,
157
+ direction = 'vertical',
158
+ style,
159
+ className,
160
+ children,
161
+ ...rest
162
+ } = props;
163
+
164
+ const elementRef = useRef<any>(null);
165
+
166
+ useImperativeHandle(ref, () => ({
167
+ element: elementRef.current,
168
+ getMode: () => mode,
169
+ getDirection: () => direction,
170
+ isReverse: () => reverse,
171
+ getItemCount: () => items.length,
172
+ }));
173
+
174
+ const getTimelineStyle = () => {
175
+ const baseStyle = {
176
+ ...timelineStyles['base'],
177
+ ...timelineStyles[direction],
178
+ ...style,
179
+ };
180
+
181
+ if (reverse) {
182
+ if (direction === 'horizontal') {
183
+ Object.assign(baseStyle, timelineStyles['reverseHorizontal']);
184
+ } else {
185
+ Object.assign(baseStyle, timelineStyles['reverse']);
186
+ }
187
+ }
188
+
189
+ return baseStyle;
190
+ };
191
+
192
+ const renderItems = () => {
193
+ if (children) {
194
+ return children;
195
+ }
196
+
197
+ const itemsToRender = reverse ? [...items].reverse() : items;
198
+
199
+ return itemsToRender.map((item, index) => {
200
+ const originalIndex = reverse ? items.length - 1 - index : index;
201
+ const isLast = index === itemsToRender.length - 1;
202
+
203
+ return (
204
+ <TimelineItem
205
+ key={originalIndex}
206
+ {...item}
207
+ mode={mode}
208
+ direction={direction}
209
+ showTimestamp={showTimestamp}
210
+ itemIndex={originalIndex}
211
+ isLast={isLast}
212
+ />
213
+ );
214
+ });
215
+ };
216
+
217
+ return (
218
+ <View
219
+ ref={elementRef}
220
+ style={getTimelineStyle()}
221
+ className={className}
222
+ {...rest}
223
+ >
224
+ {renderItems()}
225
+ </View>
226
+ );
227
+ });
228
+
229
+ TimelineComponent.displayName = 'Timeline';
230
+
231
+ // 创建复合组件类型
232
+ export interface TimelineCompoundComponent extends React.ForwardRefExoticComponent<TimelineProps & React.RefAttributes<TimelineRef>> {
233
+ Item: typeof TimelineItem;
234
+ }
235
+
236
+ export const Timeline = TimelineComponent as TimelineCompoundComponent;
237
+ Timeline.Item = TimelineItem;
238
+
239
+ export default Timeline;
@@ -0,0 +1,56 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+
3
+ export interface TimelineItemProps {
4
+ /** 时间线项标题 */
5
+ title?: ReactNode;
6
+ /** 时间线项内容 */
7
+ children?: ReactNode;
8
+ /** 时间线项描述 */
9
+ description?: ReactNode;
10
+ /** 时间戳 */
11
+ timestamp?: string;
12
+ /** 节点颜色 */
13
+ color?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | string;
14
+ /** 自定义节点 */
15
+ dot?: ReactNode;
16
+ /** 节点位置 */
17
+ position?: 'left' | 'right';
18
+ /** 是否为最后一项 */
19
+ isLast?: boolean;
20
+ /** 自定义样式 */
21
+ style?: CSSProperties;
22
+ /** 自定义类名 */
23
+ className?: string;
24
+ }
25
+
26
+ export interface TimelineProps {
27
+ /** 时间线数据源 */
28
+ items?: TimelineItemProps[];
29
+ /** 时间线模式 */
30
+ mode?: 'left' | 'right' | 'alternate';
31
+ /** 是否反向显示 */
32
+ reverse?: boolean;
33
+ /** 是否显示时间戳 */
34
+ showTimestamp?: boolean;
35
+ /** 时间线方向 */
36
+ direction?: 'vertical' | 'horizontal';
37
+ /** 自定义样式 */
38
+ style?: CSSProperties;
39
+ /** 自定义类名 */
40
+ className?: string;
41
+ /** 子节点 */
42
+ children?: ReactNode;
43
+ }
44
+
45
+ export interface TimelineRef {
46
+ /** DOM 元素 */
47
+ element: any;
48
+ /** 获取时间线模式 */
49
+ getMode: () => 'left' | 'right' | 'alternate';
50
+ /** 获取时间线方向 */
51
+ getDirection: () => 'vertical' | 'horizontal';
52
+ /** 检查是否反向 */
53
+ isReverse: () => boolean;
54
+ /** 获取项目数量 */
55
+ getItemCount: () => number;
56
+ }
@@ -0,0 +1,3 @@
1
+ export { Timeline, TimelineItem } from './Timeline';
2
+ export { timelineStyles } from './Timeline.styles';
3
+ export type { TimelineProps, TimelineRef, TimelineItemProps } from './Timeline.types';
@@ -0,0 +1,143 @@
1
+ // 导出 Avatar 组件
2
+ export { Avatar } from './Avatar';
3
+
4
+ // 导出 Badge 组件
5
+ export { Badge } from './Badge';
6
+
7
+ // 导出 Card 组件
8
+ export { Card } from './Card';
9
+
10
+ // 导出 List 组件
11
+ export { List } from './List';
12
+
13
+ // 导出 Rate 组件
14
+ export { Rate } from './Rate';
15
+
16
+ // 导出 Table 组件
17
+ export { default as Table } from './Table';
18
+
19
+ // 导出 Tag 组件
20
+ export { Tag } from './Tag';
21
+
22
+ // 导出 Timeline 组件
23
+ export { Timeline } from './Timeline';
24
+
25
+ // 导出 Calendar 组件
26
+ export { Calendar } from './Calendar';
27
+
28
+ // 导出 Carousel 组件
29
+ export { Carousel } from './Carousel';
30
+
31
+ // 导出类型定义
32
+ export type { CardProps, CardRef } from './Card';
33
+ export type { ListProps, ListRef, ListItemProps } from './List';
34
+ export type { RateProps, RateRef, RateSize, RateCharacter, StarState } from './Rate';
35
+ export type { TagProps, TagRef } from './Tag';
36
+ export type { TimelineProps, TimelineRef, TimelineItemProps } from './Timeline';
37
+ export type { CalendarProps, CalendarRef, CalendarDate, CalendarEvent } from './Calendar';
38
+ export type { CarouselProps, CarouselRef } from './Carousel';
39
+ export type {
40
+ TableProps,
41
+ TableRef,
42
+ TableColumn,
43
+ TableSortOrder,
44
+ TableFilterConfig,
45
+ TableAlign,
46
+ TableSize,
47
+ TableBorder,
48
+ TableRowSelection,
49
+ TablePagination,
50
+ TableExpandable,
51
+ } from './Table';
52
+
53
+ // 导出样式
54
+ export { CardStyles as cardStyles } from './Card/Card.styles';
55
+ export { ListStyles as listStyles } from './List/List.styles';
56
+ export { rateStyles } from './Rate/Rate.styles';
57
+ export { tagStyles } from './Tag/Tag.styles';
58
+ export { timelineStyles } from './Timeline/Timeline.styles';
59
+ export { calendarStyles } from './Calendar/Calendar.styles';
60
+ export { carouselStyles } from './Carousel/Carousel.styles';
61
+ export { tableStyles } from './Table/Table.styles';
62
+
63
+ // 展示组件工具函数
64
+ export const DisplayUtils = {
65
+ /**
66
+ * 格式化卡片数据
67
+ */
68
+ formatCardData: (data: any) => {
69
+ return {
70
+ ...data,
71
+ formattedDate: new Date().toLocaleDateString(),
72
+ };
73
+ },
74
+
75
+ /**
76
+ * 格式化表格数据
77
+ */
78
+ formatTableData: (data: any[], columns: any[]) => {
79
+ return data.map(item => {
80
+ const formattedItem: any = {};
81
+ columns.forEach(column => {
82
+ formattedItem[column.key] = item[column.key];
83
+ });
84
+ return formattedItem;
85
+ });
86
+ },
87
+
88
+ /**
89
+ * 格式化列表数据
90
+ */
91
+ formatListData: (data: any[]) => {
92
+ return data.map((item, index) => ({
93
+ ...item,
94
+ id: item.id || index,
95
+ key: item.key || index,
96
+ }));
97
+ },
98
+
99
+ /**
100
+ * 格式化标签数据
101
+ */
102
+ formatTagData: (tags: string[], colorMap?: Record<string, string>) => {
103
+ return tags.map((tag, index) => ({
104
+ key: index,
105
+ label: tag,
106
+ color: colorMap?.[tag] || 'default',
107
+ }));
108
+ },
109
+
110
+ /**
111
+ * 格式化时间线数据
112
+ */
113
+ formatTimelineData: (items: any[]) => {
114
+ return items.map((item, index) => ({
115
+ ...item,
116
+ key: item.key || index,
117
+ timestamp: item.timestamp || new Date().toISOString(),
118
+ }));
119
+ },
120
+
121
+ /**
122
+ * 格式化日历事件
123
+ */
124
+ formatCalendarEvents: (events: any[]) => {
125
+ return events.map((event, index) => ({
126
+ ...event,
127
+ id: event.id || `event-${index}`,
128
+ startTime: event.startTime || new Date().toISOString(),
129
+ type: event.type || 'default',
130
+ }));
131
+ },
132
+
133
+ /**
134
+ * 格式化轮播数据
135
+ */
136
+ formatCarouselData: (items: any[]) => {
137
+ return items.map((item, index) => ({
138
+ ...item,
139
+ key: item.key || index,
140
+ id: item.id || `slide-${index}`,
141
+ }));
142
+ },
143
+ };