antd.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /**
  2. * Copyright [2022] [https://www.xiaonuo.vip]
  3. * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
  4. * 1.请不要删除和修改根目录下的LICENSE文件。
  5. * 2.请不要删除和修改Snowy源码头部的版权声明。
  6. * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
  7. * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
  8. * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
  9. * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
  10. */
  11. function kebabCase(value) {
  12. return value
  13. .replace(/([A-Z])/g, ' $1')
  14. .trim()
  15. .split(' ')
  16. .join('-')
  17. .toLowerCase()
  18. }
  19. const antComponents = [
  20. 'Affix',
  21. 'Alert',
  22. 'Anchor',
  23. 'AnchorLink',
  24. 'AutoComplete',
  25. 'AutoCompleteOptGroup',
  26. 'AutoCompleteOption',
  27. 'Avatar',
  28. 'AvatarGroup',
  29. 'BackTop',
  30. 'Badge',
  31. 'BadgeRibbon',
  32. 'Breadcrumb',
  33. 'BreadcrumbItem',
  34. 'BreadcrumbSeparator',
  35. 'Button',
  36. 'ButtonGroup',
  37. 'Calendar',
  38. 'Card',
  39. 'CardGrid',
  40. 'CardMeta',
  41. 'Carousel',
  42. 'Cascader',
  43. 'CheckableTag',
  44. 'Checkbox',
  45. 'CheckboxGroup',
  46. 'Col',
  47. 'Collapse',
  48. 'CollapsePanel',
  49. 'Comment',
  50. 'ConfigProvider',
  51. 'DatePicker',
  52. 'Descriptions',
  53. 'DescriptionsItem',
  54. 'DirectoryTree',
  55. 'Divider',
  56. 'Drawer',
  57. 'Dropdown',
  58. 'DropdownButton',
  59. 'Empty',
  60. 'Form',
  61. 'FormItem',
  62. 'FormItemRest',
  63. 'Image',
  64. 'ImagePreviewGroup',
  65. 'Input',
  66. 'InputGroup',
  67. 'InputNumber',
  68. 'InputPassword',
  69. 'InputSearch',
  70. 'Layout',
  71. 'LayoutContent',
  72. 'LayoutFooter',
  73. 'LayoutHeader',
  74. 'LayoutSider',
  75. 'List',
  76. 'ListItem',
  77. 'ListItemMeta',
  78. 'LocaleProvider',
  79. 'Mentions',
  80. 'MentionsOption',
  81. 'Menu',
  82. 'MenuDivider',
  83. 'MenuItem',
  84. 'MenuItemGroup',
  85. 'Modal',
  86. 'MonthPicker',
  87. 'PageHeader',
  88. 'Pagination',
  89. 'Popconfirm',
  90. 'Popover',
  91. 'Progress',
  92. 'QuarterPicker',
  93. 'Radio',
  94. 'RadioButton',
  95. 'RadioGroup',
  96. 'RangePicker',
  97. 'Rate',
  98. 'Result',
  99. 'Row',
  100. 'Select',
  101. 'SelectOptGroup',
  102. 'SelectOption',
  103. 'Skeleton',
  104. 'SkeletonAvatar',
  105. 'SkeletonButton',
  106. 'SkeletonImage',
  107. 'SkeletonInput',
  108. 'Slider',
  109. 'Space',
  110. 'Spin',
  111. 'Statistic',
  112. 'StatisticCountdown',
  113. 'Step',
  114. 'Steps',
  115. 'SubMenu',
  116. 'Switch',
  117. 'TabPane',
  118. 'Table',
  119. 'TableColumn',
  120. 'TableColumnGroup',
  121. 'TableSummary',
  122. 'TableSummaryCell',
  123. 'TableSummaryRow',
  124. 'Tabs',
  125. 'Tag',
  126. 'Textarea',
  127. 'TimePicker',
  128. 'TimeRangePicker',
  129. 'Timeline',
  130. 'TimelineItem',
  131. 'Tooltip',
  132. 'Transfer',
  133. 'Tree',
  134. 'TreeNode',
  135. 'TreeSelect',
  136. 'TreeSelectNode',
  137. 'Typography',
  138. 'TypographyLink',
  139. 'TypographyParagraph',
  140. 'TypographyText',
  141. 'TypographyTitle',
  142. 'Upload',
  143. 'UploadDragger',
  144. 'WeekPicker'
  145. ]
  146. const matchComponents = [
  147. {
  148. pattern: /^Avatar/,
  149. styleDir: 'avatar'
  150. },
  151. {
  152. pattern: /^AutoComplete/,
  153. styleDir: 'auto-complete'
  154. },
  155. {
  156. pattern: /^Anchor/,
  157. styleDir: 'anchor'
  158. },
  159. {
  160. pattern: /^Badge/,
  161. styleDir: 'badge'
  162. },
  163. {
  164. pattern: /^Breadcrumb/,
  165. styleDir: 'breadcrumb'
  166. },
  167. {
  168. pattern: /^Button/,
  169. styleDir: 'button'
  170. },
  171. {
  172. pattern: /^Checkbox/,
  173. styleDir: 'checkbox'
  174. },
  175. {
  176. pattern: /^Card/,
  177. styleDir: 'card'
  178. },
  179. {
  180. pattern: /^Collapse/,
  181. styleDir: 'collapse'
  182. },
  183. {
  184. pattern: /^Descriptions/,
  185. styleDir: 'descriptions'
  186. },
  187. {
  188. pattern: /^RangePicker|^WeekPicker|^MonthPicker|^QuarterPicker/,
  189. styleDir: 'date-picker'
  190. },
  191. {
  192. pattern: /^TimeRangePicker/,
  193. styleDir: 'time-picker'
  194. },
  195. {
  196. pattern: /^Dropdown/,
  197. styleDir: 'dropdown'
  198. },
  199. {
  200. pattern: /^Form/,
  201. styleDir: 'form'
  202. },
  203. {
  204. pattern: /^InputNumber/,
  205. styleDir: 'input-number'
  206. },
  207. {
  208. pattern: /^Input|^Textarea/,
  209. styleDir: 'input'
  210. },
  211. {
  212. pattern: /^Statistic/,
  213. styleDir: 'statistic'
  214. },
  215. {
  216. pattern: /^CheckableTag/,
  217. styleDir: 'tag'
  218. },
  219. {
  220. pattern: /^Layout/,
  221. styleDir: 'layout'
  222. },
  223. {
  224. pattern: /^Menu|^SubMenu/,
  225. styleDir: 'menu'
  226. },
  227. {
  228. pattern: /^Table/,
  229. styleDir: 'table'
  230. },
  231. {
  232. pattern: /^Radio/,
  233. styleDir: 'radio'
  234. },
  235. {
  236. pattern: /^Image/,
  237. styleDir: 'image'
  238. },
  239. {
  240. pattern: /^List/,
  241. styleDir: 'list'
  242. },
  243. {
  244. pattern: /^Tab/,
  245. styleDir: 'tabs'
  246. },
  247. {
  248. pattern: /^Mentions/,
  249. styleDir: 'mentions'
  250. },
  251. {
  252. pattern: /^Step/,
  253. styleDir: 'steps'
  254. },
  255. {
  256. pattern: /^Skeleton/,
  257. styleDir: 'skeleton'
  258. },
  259. {
  260. pattern: /^Select/,
  261. styleDir: 'select'
  262. },
  263. {
  264. pattern: /^TreeSelect/,
  265. styleDir: 'tree-select'
  266. },
  267. {
  268. pattern: /^Tree|^DirectoryTree/,
  269. styleDir: 'tree'
  270. },
  271. {
  272. pattern: /^Typography/,
  273. styleDir: 'typography'
  274. },
  275. {
  276. pattern: /^Timeline/,
  277. styleDir: 'timeline'
  278. },
  279. {
  280. pattern: /^Upload/,
  281. styleDir: 'upload'
  282. }
  283. ]
  284. const antStyleDeps = Array.from(
  285. new Set(
  286. antComponents.map((name) => {
  287. for (let i = 0; i < matchComponents.length; i++) {
  288. if (name.match(matchComponents[i].pattern)) {
  289. return matchComponents[i].styleDir
  290. }
  291. }
  292. return kebabCase(name)
  293. })
  294. )
  295. ).map((name) => {
  296. return `ant-design-vue/es/${name}/style`
  297. })
  298. export default antStyleDeps