vue-devui 1.0.0-beta.2 → 1.0.0-beta.20220808

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 (455) hide show
  1. package/README.md +163 -172
  2. package/alert/index.d.ts +7 -0
  3. package/alert/index.es.js +79 -51
  4. package/alert/index.umd.js +1 -1
  5. package/alert/style.css +1 -1
  6. package/auto-complete/index.d.ts +7 -0
  7. package/auto-complete/index.es.js +9053 -0
  8. package/auto-complete/index.umd.js +40 -0
  9. package/auto-complete/package.json +7 -0
  10. package/auto-complete/style.css +1 -0
  11. package/avatar/index.d.ts +7 -0
  12. package/avatar/index.es.js +154 -147
  13. package/avatar/index.umd.js +1 -1
  14. package/avatar/style.css +1 -1
  15. package/badge/index.d.ts +7 -0
  16. package/badge/index.es.js +46 -21
  17. package/badge/index.umd.js +1 -1
  18. package/badge/style.css +1 -1
  19. package/button/index.d.ts +7 -0
  20. package/button/index.es.js +5921 -146
  21. package/button/index.umd.js +27 -1
  22. package/button/style.css +1 -1
  23. package/card/index.d.ts +7 -0
  24. package/card/index.es.js +64 -36
  25. package/card/index.umd.js +1 -1
  26. package/card/style.css +1 -1
  27. package/checkbox/index.d.ts +7 -0
  28. package/checkbox/index.es.js +8122 -255
  29. package/checkbox/index.umd.js +38 -1
  30. package/checkbox/style.css +1 -1
  31. package/collapse/index.d.ts +7 -0
  32. package/collapse/index.es.js +195 -0
  33. package/collapse/index.umd.js +1 -0
  34. package/{cascader → collapse}/package.json +1 -1
  35. package/collapse/style.css +1 -0
  36. package/countdown/index.d.ts +7 -0
  37. package/countdown/index.es.js +217 -0
  38. package/countdown/index.umd.js +1 -0
  39. package/{accordion → countdown}/package.json +1 -1
  40. package/countdown/style.css +1 -0
  41. package/date-picker-pro/index.d.ts +7 -0
  42. package/date-picker-pro/index.es.js +12035 -0
  43. package/date-picker-pro/index.umd.js +38 -0
  44. package/date-picker-pro/package.json +7 -0
  45. package/date-picker-pro/style.css +1 -0
  46. package/drawer/index.d.ts +7 -0
  47. package/drawer/index.es.js +205 -154
  48. package/drawer/index.umd.js +1 -1
  49. package/drawer/style.css +1 -1
  50. package/dropdown/index.d.ts +7 -0
  51. package/dropdown/index.es.js +736 -0
  52. package/dropdown/index.umd.js +1 -0
  53. package/{carousel → dropdown}/package.json +1 -1
  54. package/dropdown/style.css +1 -0
  55. package/editable-select/index.d.ts +7 -0
  56. package/editable-select/index.es.js +908 -461
  57. package/editable-select/index.umd.js +1 -1
  58. package/editable-select/style.css +1 -1
  59. package/form/index.d.ts +7 -0
  60. package/form/index.es.js +2439 -1995
  61. package/form/index.umd.js +29 -18
  62. package/form/style.css +1 -1
  63. package/fullscreen/index.d.ts +7 -0
  64. package/fullscreen/index.es.js +138 -125
  65. package/fullscreen/index.umd.js +1 -1
  66. package/fullscreen/style.css +1 -1
  67. package/grid/index.d.ts +7 -0
  68. package/grid/index.es.js +271 -0
  69. package/grid/index.umd.js +1 -0
  70. package/{toast → grid}/package.json +1 -1
  71. package/grid/style.css +1 -0
  72. package/icon/index.d.ts +7 -0
  73. package/icon/index.es.js +200 -56
  74. package/icon/index.umd.js +1 -1
  75. package/icon/style.css +1 -0
  76. package/image-preview/index.d.ts +7 -0
  77. package/image-preview/index.es.js +154 -62
  78. package/image-preview/index.umd.js +1 -1
  79. package/image-preview/style.css +1 -1
  80. package/index.d.ts +7 -0
  81. package/input/index.d.ts +7 -0
  82. package/input/index.es.js +8269 -145
  83. package/input/index.umd.js +38 -1
  84. package/input/style.css +1 -1
  85. package/input-number/index.d.ts +7 -0
  86. package/input-number/index.es.js +260 -191
  87. package/input-number/index.umd.js +1 -1
  88. package/input-number/style.css +1 -1
  89. package/layout/index.d.ts +7 -0
  90. package/layout/index.es.js +41 -26
  91. package/layout/index.umd.js +1 -1
  92. package/layout/style.css +1 -1
  93. package/loading/index.d.ts +7 -0
  94. package/loading/index.es.js +89 -73
  95. package/loading/index.umd.js +1 -1
  96. package/loading/style.css +1 -1
  97. package/mention/index.d.ts +7 -0
  98. package/mention/index.es.js +8326 -0
  99. package/mention/index.umd.js +47 -0
  100. package/mention/package.json +7 -0
  101. package/mention/style.css +1 -0
  102. package/menu/index.d.ts +7 -0
  103. package/menu/index.es.js +891 -0
  104. package/menu/index.umd.js +1 -0
  105. package/{anchor → menu}/package.json +1 -1
  106. package/menu/style.css +1 -0
  107. package/message/index.d.ts +7 -0
  108. package/message/index.es.js +533 -0
  109. package/message/index.umd.js +1 -0
  110. package/message/package.json +7 -0
  111. package/message/style.css +1 -0
  112. package/modal/index.d.ts +7 -0
  113. package/modal/index.es.js +611 -877
  114. package/modal/index.umd.js +1 -1
  115. package/modal/style.css +1 -1
  116. package/notification/index.d.ts +7 -0
  117. package/notification/index.es.js +528 -0
  118. package/notification/index.umd.js +1 -0
  119. package/notification/package.json +7 -0
  120. package/notification/style.css +1 -0
  121. package/nuxt/components/Alert.js +3 -0
  122. package/nuxt/components/Aside.js +3 -0
  123. package/nuxt/components/AutoComplete.js +3 -0
  124. package/nuxt/components/Avatar.js +3 -0
  125. package/nuxt/components/Badge.js +3 -0
  126. package/nuxt/components/Button.js +3 -0
  127. package/nuxt/components/ButtonGroup.js +3 -0
  128. package/nuxt/components/Card.js +3 -0
  129. package/nuxt/components/Checkbox.js +3 -0
  130. package/nuxt/components/CheckboxButton.js +3 -0
  131. package/nuxt/components/CheckboxGroup.js +3 -0
  132. package/nuxt/components/Col.js +3 -0
  133. package/nuxt/components/Collapse.js +3 -0
  134. package/nuxt/components/CollapseItem.js +3 -0
  135. package/nuxt/components/Column.js +3 -0
  136. package/nuxt/components/Content.js +3 -0
  137. package/nuxt/components/Countdown.js +3 -0
  138. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  139. package/nuxt/components/DatePickerPro.js +3 -0
  140. package/nuxt/components/Drawer.js +3 -0
  141. package/nuxt/components/DrawerService.js +3 -0
  142. package/nuxt/components/Dropdown.js +3 -0
  143. package/nuxt/components/DropdownMenu.js +3 -0
  144. package/nuxt/components/DropdownPropsKey.js +3 -0
  145. package/nuxt/components/EditableSelect.js +3 -0
  146. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  147. package/nuxt/components/FORM_TOKEN.js +3 -0
  148. package/nuxt/components/FixedOverlay.js +3 -0
  149. package/nuxt/components/FlexibleOverlay.js +3 -0
  150. package/nuxt/components/Footer.js +3 -0
  151. package/nuxt/components/Form.js +3 -0
  152. package/nuxt/components/FormItem.js +3 -0
  153. package/nuxt/components/FormOperation.js +3 -0
  154. package/nuxt/components/Fullscreen.js +3 -0
  155. package/nuxt/components/Header.js +3 -0
  156. package/nuxt/components/IFileOptions.js +3 -0
  157. package/nuxt/components/IUploadOptions.js +3 -0
  158. package/nuxt/components/Icon.js +3 -0
  159. package/nuxt/components/IconGroup.js +3 -0
  160. package/nuxt/components/ImagePreviewService.js +3 -0
  161. package/nuxt/components/Input.js +3 -0
  162. package/nuxt/components/InputNumber.js +3 -0
  163. package/nuxt/components/LABEL_DATA.js +3 -0
  164. package/nuxt/components/Layout.js +3 -0
  165. package/nuxt/components/Loading.js +3 -0
  166. package/nuxt/components/LoadingOptions.js +3 -0
  167. package/nuxt/components/LoadingService.js +3 -0
  168. package/nuxt/components/Mention.js +3 -0
  169. package/nuxt/components/Menu.js +3 -0
  170. package/nuxt/components/MenuItem.js +3 -0
  171. package/nuxt/components/Message.js +3 -0
  172. package/nuxt/components/Modal.js +3 -0
  173. package/nuxt/components/Notification.js +3 -0
  174. package/nuxt/components/NotificationService.js +3 -0
  175. package/nuxt/components/Option.js +3 -0
  176. package/nuxt/components/OptionGroup.js +3 -0
  177. package/nuxt/components/Pagination.js +3 -0
  178. package/nuxt/components/Panel.js +3 -0
  179. package/nuxt/components/PanelBody.js +3 -0
  180. package/nuxt/components/PanelFooter.js +3 -0
  181. package/nuxt/components/PanelHeader.js +3 -0
  182. package/nuxt/components/Popover.js +3 -0
  183. package/nuxt/components/Progress.js +3 -0
  184. package/nuxt/components/Radio.js +3 -0
  185. package/nuxt/components/RadioButton.js +3 -0
  186. package/nuxt/components/RadioGroup.js +3 -0
  187. package/nuxt/components/Rate.js +3 -0
  188. package/nuxt/components/Result.js +3 -0
  189. package/nuxt/components/Row.js +3 -0
  190. package/nuxt/components/Search.js +3 -0
  191. package/nuxt/components/Select.js +3 -0
  192. package/nuxt/components/Skeleton.js +3 -0
  193. package/nuxt/components/SkeletonItem.js +3 -0
  194. package/nuxt/components/Slider.js +3 -0
  195. package/nuxt/components/Splitter.js +3 -0
  196. package/nuxt/components/Statistic.js +3 -0
  197. package/nuxt/components/Status.js +3 -0
  198. package/nuxt/components/Step.js +3 -0
  199. package/nuxt/components/Steps.js +3 -0
  200. package/nuxt/components/SubMenu.js +3 -0
  201. package/nuxt/components/Switch.js +3 -0
  202. package/nuxt/components/TABLE_TOKEN.js +3 -0
  203. package/nuxt/components/Tab.js +3 -0
  204. package/nuxt/components/Table.js +3 -0
  205. package/nuxt/components/Tabs.js +3 -0
  206. package/nuxt/components/Tag.js +3 -0
  207. package/nuxt/components/Textarea.js +3 -0
  208. package/nuxt/components/TimePicker.js +3 -0
  209. package/nuxt/components/TimeSelect.js +3 -0
  210. package/nuxt/components/Timeline.js +3 -0
  211. package/nuxt/components/TimelineItem.js +3 -0
  212. package/nuxt/components/Tooltip.js +3 -0
  213. package/nuxt/components/Tree.js +3 -0
  214. package/nuxt/components/Upload.js +3 -0
  215. package/nuxt/components/UploadStatus.js +3 -0
  216. package/nuxt/components/alertProps.js +3 -0
  217. package/nuxt/components/animationInjectionKey.js +3 -0
  218. package/nuxt/components/autoCompleteProps.js +3 -0
  219. package/nuxt/components/avatarProps.js +3 -0
  220. package/nuxt/components/badgeProps.js +3 -0
  221. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  222. package/nuxt/components/buttonGroupProps.js +3 -0
  223. package/nuxt/components/buttonProps.js +3 -0
  224. package/nuxt/components/cardProps.js +3 -0
  225. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  226. package/nuxt/components/checkboxGroupProps.js +3 -0
  227. package/nuxt/components/checkboxProps.js +3 -0
  228. package/nuxt/components/colProps.js +3 -0
  229. package/nuxt/components/colPropsBaseClass.js +3 -0
  230. package/nuxt/components/colPropsBaseStyle.js +3 -0
  231. package/nuxt/components/collapseItemProps.js +3 -0
  232. package/nuxt/components/collapseProps.js +3 -0
  233. package/nuxt/components/countdownProps.js +3 -0
  234. package/nuxt/components/datePickerProCommonProps.js +3 -0
  235. package/nuxt/components/datePickerProPanelProps.js +3 -0
  236. package/nuxt/components/datePickerProProps.js +3 -0
  237. package/nuxt/components/dropdownMenuProps.js +3 -0
  238. package/nuxt/components/editableSelectProps.js +3 -0
  239. package/nuxt/components/fixedOverlayProps.js +3 -0
  240. package/nuxt/components/flexibleOverlayProps.js +3 -0
  241. package/nuxt/components/formItemProps.js +3 -0
  242. package/nuxt/components/formProps.js +3 -0
  243. package/nuxt/components/fullscreenProps.js +3 -0
  244. package/nuxt/components/iconProps.js +3 -0
  245. package/nuxt/components/imagePreviewProps.js +3 -0
  246. package/nuxt/components/inputProps.js +3 -0
  247. package/nuxt/components/loadingProps.js +3 -0
  248. package/nuxt/components/mentionProps.js +3 -0
  249. package/nuxt/components/messageProps.js +3 -0
  250. package/nuxt/components/modalProps.js +3 -0
  251. package/nuxt/components/notificationProps.js +3 -0
  252. package/nuxt/components/paginationProps.js +3 -0
  253. package/nuxt/components/panelProps.js +3 -0
  254. package/nuxt/components/popoverProps.js +3 -0
  255. package/nuxt/components/progressProps.js +3 -0
  256. package/nuxt/components/rateProps.js +3 -0
  257. package/nuxt/components/resultProps.js +3 -0
  258. package/nuxt/components/roundInjectionKey.js +3 -0
  259. package/nuxt/components/rowProps.js +3 -0
  260. package/nuxt/components/screenSizes.js +3 -0
  261. package/nuxt/components/searchProps.js +3 -0
  262. package/nuxt/components/skeletonItemProps.js +3 -0
  263. package/nuxt/components/skeletonProps.js +3 -0
  264. package/nuxt/components/sliderProps.js +3 -0
  265. package/nuxt/components/splitterProps.js +3 -0
  266. package/nuxt/components/statisticProps.js +3 -0
  267. package/nuxt/components/stepProps.js +3 -0
  268. package/nuxt/components/stepsProps.js +3 -0
  269. package/nuxt/components/svgIconProps.js +3 -0
  270. package/nuxt/components/switchProps.js +3 -0
  271. package/nuxt/components/tableProps.js +3 -0
  272. package/nuxt/components/tabsProps.js +3 -0
  273. package/nuxt/components/tagProps.js +3 -0
  274. package/nuxt/components/textareaProps.js +3 -0
  275. package/nuxt/components/timeAxisProps.js +3 -0
  276. package/nuxt/components/timerPickerPanelProps.js +3 -0
  277. package/nuxt/components/tooltipProps.js +3 -0
  278. package/nuxt/components/treeNodeProps.js +3 -0
  279. package/nuxt/components/treeProps.js +3 -0
  280. package/nuxt/components/uploadProps.js +3 -0
  281. package/nuxt/index.js +13 -0
  282. package/overlay/index.d.ts +7 -0
  283. package/overlay/index.es.js +245 -303
  284. package/overlay/index.umd.js +1 -1
  285. package/overlay/style.css +1 -1
  286. package/package.json +16 -84
  287. package/pagination/index.d.ts +7 -0
  288. package/pagination/index.es.js +333 -155
  289. package/pagination/index.umd.js +1 -1
  290. package/pagination/style.css +1 -1
  291. package/panel/index.d.ts +7 -0
  292. package/panel/index.es.js +48 -35
  293. package/panel/index.umd.js +1 -1
  294. package/panel/style.css +1 -1
  295. package/popover/index.d.ts +7 -0
  296. package/popover/index.es.js +6035 -204
  297. package/popover/index.umd.js +27 -1
  298. package/popover/style.css +1 -1
  299. package/progress/index.d.ts +7 -0
  300. package/progress/index.es.js +111 -57
  301. package/progress/index.umd.js +3 -3
  302. package/progress/style.css +1 -1
  303. package/radio/index.d.ts +7 -0
  304. package/radio/index.es.js +8015 -182
  305. package/radio/index.umd.js +38 -1
  306. package/radio/style.css +1 -1
  307. package/rate/index.d.ts +7 -0
  308. package/rate/index.es.js +78 -56
  309. package/rate/index.umd.js +1 -1
  310. package/rate/style.css +1 -1
  311. package/result/index.d.ts +7 -0
  312. package/result/index.es.js +248 -0
  313. package/result/index.umd.js +1 -0
  314. package/{sticky → result}/package.json +1 -1
  315. package/result/style.css +1 -0
  316. package/ripple/index.d.ts +7 -0
  317. package/ripple/index.es.js +56 -61
  318. package/ripple/index.umd.js +1 -1
  319. package/search/index.d.ts +7 -0
  320. package/search/index.es.js +8381 -406
  321. package/search/index.umd.js +38 -1
  322. package/search/style.css +1 -1
  323. package/select/index.d.ts +7 -0
  324. package/select/index.es.js +9331 -576
  325. package/select/index.umd.js +38 -1
  326. package/select/style.css +1 -1
  327. package/skeleton/index.d.ts +7 -0
  328. package/skeleton/index.es.js +115 -145
  329. package/skeleton/index.umd.js +1 -1
  330. package/skeleton/style.css +1 -1
  331. package/slider/index.d.ts +7 -0
  332. package/slider/index.es.js +148 -142
  333. package/slider/index.umd.js +1 -1
  334. package/slider/style.css +1 -1
  335. package/splitter/index.d.ts +7 -0
  336. package/splitter/index.es.js +6308 -181
  337. package/splitter/index.umd.js +27 -1
  338. package/splitter/style.css +1 -1
  339. package/statistic/index.d.ts +7 -0
  340. package/statistic/index.es.js +253 -0
  341. package/statistic/index.umd.js +1 -0
  342. package/statistic/package.json +7 -0
  343. package/statistic/style.css +1 -0
  344. package/status/index.d.ts +7 -0
  345. package/status/index.es.js +29 -8
  346. package/status/index.umd.js +1 -1
  347. package/status/style.css +1 -1
  348. package/steps/index.d.ts +7 -0
  349. package/steps/index.es.js +386 -0
  350. package/steps/index.umd.js +1 -0
  351. package/steps/package.json +7 -0
  352. package/steps/style.css +1 -0
  353. package/style.css +1 -1
  354. package/switch/index.d.ts +7 -0
  355. package/switch/index.es.js +7819 -65
  356. package/switch/index.umd.js +38 -1
  357. package/switch/style.css +1 -1
  358. package/table/index.d.ts +7 -0
  359. package/table/index.es.js +11435 -204
  360. package/table/index.umd.js +38 -1
  361. package/table/style.css +1 -1
  362. package/tabs/index.d.ts +7 -0
  363. package/tabs/index.es.js +356 -143
  364. package/tabs/index.umd.js +1 -1
  365. package/tabs/style.css +1 -1
  366. package/tag/index.d.ts +7 -0
  367. package/tag/index.es.js +156 -0
  368. package/tag/index.umd.js +1 -0
  369. package/tag/package.json +7 -0
  370. package/tag/style.css +1 -0
  371. package/textarea/index.d.ts +7 -0
  372. package/textarea/index.es.js +7989 -0
  373. package/textarea/index.umd.js +46 -0
  374. package/textarea/package.json +7 -0
  375. package/textarea/style.css +1 -0
  376. package/{theme → theme/theme.scss} +0 -0
  377. package/time-picker/index.d.ts +7 -0
  378. package/time-picker/index.es.js +9126 -597
  379. package/time-picker/index.umd.js +38 -1
  380. package/time-picker/style.css +1 -1
  381. package/time-select/index.d.ts +7 -0
  382. package/time-select/index.es.js +9606 -0
  383. package/time-select/index.umd.js +38 -0
  384. package/{breadcrumb → time-select}/package.json +1 -1
  385. package/time-select/style.css +1 -0
  386. package/timeline/index.d.ts +7 -0
  387. package/timeline/index.es.js +427 -0
  388. package/timeline/index.umd.js +1 -0
  389. package/timeline/package.json +7 -0
  390. package/timeline/style.css +1 -0
  391. package/tooltip/index.d.ts +7 -0
  392. package/tooltip/index.es.js +5870 -141
  393. package/tooltip/index.umd.js +27 -1
  394. package/tooltip/style.css +1 -1
  395. package/tree/index.d.ts +7 -0
  396. package/tree/index.es.js +11504 -692
  397. package/tree/index.umd.js +38 -1
  398. package/tree/style.css +1 -1
  399. package/upload/index.d.ts +7 -0
  400. package/upload/index.es.js +968 -2748
  401. package/upload/index.umd.js +1 -1
  402. package/upload/style.css +1 -1
  403. package/vue-devui.es.js +22816 -16568
  404. package/vue-devui.umd.js +42 -20
  405. package/accordion/index.es.js +0 -190
  406. package/accordion/index.umd.js +0 -1
  407. package/accordion/style.css +0 -1
  408. package/anchor/index.es.js +0 -263
  409. package/anchor/index.umd.js +0 -1
  410. package/anchor/style.css +0 -1
  411. package/breadcrumb/index.es.js +0 -127
  412. package/breadcrumb/index.umd.js +0 -1
  413. package/breadcrumb/style.css +0 -1
  414. package/carousel/index.es.js +0 -328
  415. package/carousel/index.umd.js +0 -1
  416. package/carousel/style.css +0 -1
  417. package/cascader/index.es.js +0 -187
  418. package/cascader/index.umd.js +0 -1
  419. package/cascader/style.css +0 -1
  420. package/date-picker/index.es.js +0 -1171
  421. package/date-picker/index.umd.js +0 -1
  422. package/date-picker/package.json +0 -7
  423. package/date-picker/style.css +0 -1
  424. package/nav-sprite/index.es.js +0 -742
  425. package/nav-sprite/index.umd.js +0 -1
  426. package/nav-sprite/package.json +0 -7
  427. package/quadrant-diagram/index.es.js +0 -489
  428. package/quadrant-diagram/index.umd.js +0 -1
  429. package/quadrant-diagram/package.json +0 -7
  430. package/quadrant-diagram/style.css +0 -1
  431. package/steps-guide/index.es.js +0 -211
  432. package/steps-guide/index.umd.js +0 -1
  433. package/steps-guide/package.json +0 -7
  434. package/steps-guide/style.css +0 -1
  435. package/sticky/index.es.js +0 -197
  436. package/sticky/index.umd.js +0 -1
  437. package/tag-input/index.es.js +0 -341
  438. package/tag-input/index.umd.js +0 -1
  439. package/tag-input/package.json +0 -7
  440. package/tag-input/style.css +0 -1
  441. package/time-axis/index.es.js +0 -79
  442. package/time-axis/index.umd.js +0 -1
  443. package/time-axis/package.json +0 -7
  444. package/time-axis/style.css +0 -1
  445. package/toast/index.es.js +0 -2059
  446. package/toast/index.umd.js +0 -1
  447. package/toast/style.css +0 -1
  448. package/transfer/index.es.js +0 -1446
  449. package/transfer/index.umd.js +0 -1
  450. package/transfer/package.json +0 -7
  451. package/transfer/style.css +0 -1
  452. package/tree-select/index.es.js +0 -203
  453. package/tree-select/index.umd.js +0 -1
  454. package/tree-select/package.json +0 -7
  455. package/tree-select/style.css +0 -1
@@ -0,0 +1,891 @@
1
+ import { ref, defineComponent, getCurrentInstance, inject, toRefs, computed, createVNode, watch, onMounted, Transition, withDirectives, vShow, watchEffect, provide, reactive } from "vue";
2
+ function createBem(namespace, element, modifier) {
3
+ let cls = namespace;
4
+ if (element) {
5
+ cls += `__${element}`;
6
+ }
7
+ if (modifier) {
8
+ cls += `--${modifier}`;
9
+ }
10
+ return cls;
11
+ }
12
+ function useNamespace(block, needDot = false) {
13
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
14
+ const b = () => createBem(namespace);
15
+ const e = (element) => element ? createBem(namespace, element) : "";
16
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
17
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
18
+ return {
19
+ b,
20
+ e,
21
+ m,
22
+ em
23
+ };
24
+ }
25
+ const elements = [];
26
+ let parents = [];
27
+ const defaultIndent = ref(24);
28
+ const ns$5 = useNamespace("menu");
29
+ const subNs$2 = useNamespace("submenu");
30
+ const menuClass = ns$5.b();
31
+ const menuItemHorizontalWrapper = `${ns$5.b()}-item-horizontal-wrapper`;
32
+ const menuItemSelect$1 = `${ns$5.b()}-item-select`;
33
+ const menuActiveParent = `${ns$5.b()}-active-parent`;
34
+ function setDefaultIndent(indent) {
35
+ defaultIndent.value = indent;
36
+ }
37
+ function pushElement(element) {
38
+ elements.push(element);
39
+ }
40
+ function addLayer() {
41
+ parents = [];
42
+ elements.forEach((val) => {
43
+ parents.push(val.el.parentElement);
44
+ });
45
+ const stack = [...parents];
46
+ const getLayerFromClass = (className) => {
47
+ var _a;
48
+ return (_a = /layer_(\d*)/gim.exec(className)) == null ? void 0 : _a[1];
49
+ };
50
+ while (stack.length) {
51
+ const shiftItem = stack.shift();
52
+ if (shiftItem == null ? void 0 : shiftItem.classList.contains(menuClass)) {
53
+ const children = shiftItem.children;
54
+ stack.unshift(...Array.from(children));
55
+ continue;
56
+ } else {
57
+ if (shiftItem.tagName === "DIV") {
58
+ if (shiftItem.classList.contains(`${ns$5.b()}-item-vertical-wrapper`) || shiftItem.classList.contains(`${subNs$2.b()}-menu-item-vertical-wrapper`)) {
59
+ const parent = shiftItem.parentElement;
60
+ stack.unshift(...Array.from(shiftItem.children));
61
+ if (parent == null ? void 0 : parent.classList.contains(menuClass)) {
62
+ shiftItem.classList.add("layer_1");
63
+ } else {
64
+ let layer = getLayerFromClass((parent == null ? void 0 : parent.classList.value) || "");
65
+ layer = Number(layer);
66
+ shiftItem.classList.add(`layer_${layer}`);
67
+ }
68
+ } else {
69
+ const parent = shiftItem.parentElement;
70
+ let layer = getLayerFromClass((parent == null ? void 0 : parent.classList.value) || "");
71
+ layer = Number(layer);
72
+ shiftItem.classList.add(`layer_${layer}`);
73
+ shiftItem.style.paddingLeft = `${(layer === 2 ? 1 : layer - 1) * defaultIndent.value}px`;
74
+ }
75
+ }
76
+ if (shiftItem.tagName === "UL") {
77
+ const parent = shiftItem.parentElement;
78
+ const children = shiftItem.children;
79
+ for (let i = 0; i < children.length; i++) {
80
+ stack.unshift(children[i]);
81
+ }
82
+ const classList = (parent == null ? void 0 : parent.classList.value) || "";
83
+ let layer = getLayerFromClass(classList);
84
+ if (parent == null ? void 0 : parent.classList.contains(menuClass)) {
85
+ layer = 1;
86
+ shiftItem.classList.add(`layer_${2}`);
87
+ } else {
88
+ shiftItem.classList.add(`layer_${Number(layer) + 1}`);
89
+ layer = Number(layer) + 1;
90
+ }
91
+ }
92
+ if (shiftItem.tagName === "LI") {
93
+ const parent = shiftItem.parentElement;
94
+ const parentClassList = (parent == null ? void 0 : parent.classList.value) || "";
95
+ let layer = getLayerFromClass(parentClassList);
96
+ getLayerFromClass(parentClassList);
97
+ layer = Number(layer);
98
+ shiftItem.style.padding = `0 ${layer * defaultIndent.value}px`;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ function getRoot(path) {
104
+ var _a;
105
+ const paths = path;
106
+ let rootElement = null;
107
+ for (let i = 0; i < paths.length; i++) {
108
+ const p = paths[i];
109
+ if ((_a = p == null ? void 0 : p.classList) == null ? void 0 : _a.contains(`${ns$5.b()}-horizontal`)) {
110
+ rootElement = p;
111
+ }
112
+ }
113
+ return rootElement;
114
+ }
115
+ function clearSelect_isHorizontal(ele, event) {
116
+ let element = event.target;
117
+ let stack = [];
118
+ const { path } = event;
119
+ const root = getRoot(path);
120
+ stack = [...Array.from(root.children)];
121
+ if (element.tagName === "SPAN") {
122
+ element = element.parentElement;
123
+ }
124
+ while (stack.length) {
125
+ const shiftItem = stack.shift();
126
+ if ((shiftItem == null ? void 0 : shiftItem.tagName) === "UL" || (shiftItem == null ? void 0 : shiftItem.classList.contains(menuItemHorizontalWrapper))) {
127
+ const children = shiftItem == null ? void 0 : shiftItem.children;
128
+ stack.unshift(...Array.from(children));
129
+ }
130
+ if (shiftItem !== element) {
131
+ shiftItem == null ? void 0 : shiftItem.classList.remove(menuItemSelect$1);
132
+ shiftItem == null ? void 0 : shiftItem.classList.remove(menuActiveParent);
133
+ }
134
+ }
135
+ }
136
+ function clearSelect_notHorizontal(ele, event) {
137
+ const stack = [];
138
+ const path = event.path || event.composedPath && event.composedPath();
139
+ for (let i = 0; i < path.length; i++) {
140
+ const e = path[i];
141
+ if (!e.classList.contains(menuClass)) {
142
+ stack.push(...Array.from(e.children));
143
+ } else {
144
+ stack.push(...Array.from(e.children));
145
+ break;
146
+ }
147
+ }
148
+ while (stack.length) {
149
+ const shiftItem = stack.shift();
150
+ if ((shiftItem == null ? void 0 : shiftItem.tagName) === "UL" || (shiftItem == null ? void 0 : shiftItem.classList.contains(menuItemHorizontalWrapper))) {
151
+ stack.push(...Array.from(shiftItem == null ? void 0 : shiftItem.children));
152
+ }
153
+ if (shiftItem !== ele) {
154
+ if ((shiftItem == null ? void 0 : shiftItem.tagName) === "DIV") {
155
+ stack.unshift(...Array.from(shiftItem == null ? void 0 : shiftItem.children));
156
+ }
157
+ shiftItem == null ? void 0 : shiftItem.classList.remove(menuItemSelect$1);
158
+ shiftItem == null ? void 0 : shiftItem.classList.remove(menuActiveParent);
159
+ }
160
+ }
161
+ }
162
+ function clearSelect(ele, event, isHorizontal = false) {
163
+ if (isHorizontal) {
164
+ clearSelect_isHorizontal(ele, event);
165
+ } else {
166
+ clearSelect_notHorizontal(ele, event);
167
+ }
168
+ }
169
+ function getLayer(el) {
170
+ var _a;
171
+ const getLayerReg = /layer_(\d{1,})/gim;
172
+ const className = el.className;
173
+ return (_a = getLayerReg.exec(className)) == null ? void 0 : _a[1];
174
+ }
175
+ const menuItemProps = {
176
+ disabled: {
177
+ type: Boolean,
178
+ default: false
179
+ },
180
+ href: {
181
+ type: String,
182
+ default: ""
183
+ },
184
+ route: {
185
+ type: [String, Object]
186
+ }
187
+ };
188
+ const ns$4 = useNamespace("menu");
189
+ function initSelect(defaultSelectKeys, keys, isMultiple, disabled) {
190
+ const isSelect = ref(false);
191
+ if (!isMultiple) {
192
+ if (defaultSelectKeys[0] === keys && !disabled.value) {
193
+ isSelect.value = true;
194
+ } else {
195
+ isSelect.value = false;
196
+ }
197
+ } else {
198
+ if (defaultSelectKeys.includes(keys)) {
199
+ isSelect.value = true;
200
+ } else {
201
+ isSelect.value = false;
202
+ }
203
+ }
204
+ return isSelect.value;
205
+ }
206
+ function addActiveParent(ele) {
207
+ var _a, _b;
208
+ let cur = ele.parentElement;
209
+ while (!cur.classList.contains(ns$4.b())) {
210
+ if (((_a = cur.firstElementChild) == null ? void 0 : _a.tagName) === "DIV") {
211
+ (_b = cur == null ? void 0 : cur.firstElementChild) == null ? void 0 : _b.classList.add(`${ns$4.b()}-active-parent`);
212
+ }
213
+ cur = cur.parentElement;
214
+ }
215
+ return cur;
216
+ }
217
+ function changeRoute(props, router, useRouter, key) {
218
+ if (useRouter && router) {
219
+ const route = props.route || key;
220
+ const routerResult = router.push(route).then((res) => {
221
+ return res;
222
+ });
223
+ return { route, routerResult };
224
+ }
225
+ return void 0;
226
+ }
227
+ const ns$3 = useNamespace("menu");
228
+ function useClick(e) {
229
+ const paths = e.path;
230
+ for (let i = 0; i < paths.length; i++) {
231
+ const path = paths[i];
232
+ if (path.classList.contains(`${ns$3.b()}-horizontal`)) {
233
+ break;
234
+ } else if (path.classList.contains(`${ns$3.b()}-item-horizontal-wrapper`)) {
235
+ continue;
236
+ } else {
237
+ if (path.tagName !== "SPAN") {
238
+ path.classList.add(`${ns$3.b()}-item-select`);
239
+ }
240
+ }
241
+ }
242
+ }
243
+ const ns$2 = useNamespace("menu");
244
+ const menuItemSelect = `${ns$2.b()}-item-select`;
245
+ const menuItemDisabled = `${ns$2.b()}-item-disabled`;
246
+ var MenuItem = defineComponent({
247
+ name: "DMenuItem",
248
+ props: menuItemProps,
249
+ setup(props, ctx) {
250
+ var _a, _b;
251
+ const instance = getCurrentInstance();
252
+ const key = String(instance == null ? void 0 : instance.vnode.key);
253
+ const mode = inject("mode");
254
+ const multiple = inject("multiple");
255
+ const indent = inject("defaultIndent");
256
+ const isCollapsed = inject("isCollapsed");
257
+ const defaultSelectKey = inject("defaultSelectKey");
258
+ const {
259
+ disabled
260
+ } = toRefs(props);
261
+ const isSelect = ref(initSelect(defaultSelectKey, key, multiple, disabled));
262
+ const isLayer1 = ref(true);
263
+ const rootMenuEmit = inject("rootMenuEmit");
264
+ const useRouter = inject("useRouter");
265
+ const router = instance == null ? void 0 : instance.appContext.config.globalProperties.$router;
266
+ const classObject = computed(() => ({
267
+ [`${ns$2.b()}-item`]: true,
268
+ [`${ns$2.b()}-item-isCollapsed`]: isCollapsed.value,
269
+ [menuItemSelect]: isSelect.value,
270
+ [menuItemDisabled]: disabled.value
271
+ }));
272
+ const onClick = (e) => {
273
+ var _a2;
274
+ e.stopPropagation();
275
+ const ele = e.currentTarget;
276
+ let changeRouteResult = void 0;
277
+ props.disabled && e.preventDefault();
278
+ if (!props.disabled) {
279
+ if (!multiple) {
280
+ clearSelect(ele, e, mode.value === "horizontal");
281
+ if (mode.value === "horizontal") {
282
+ useClick(e);
283
+ } else {
284
+ ele.classList.add(menuItemSelect);
285
+ }
286
+ changeRouteResult = changeRoute(props, router, useRouter, key);
287
+ } else {
288
+ if (ele.classList.contains(menuItemSelect)) {
289
+ ele.classList.remove(menuItemSelect);
290
+ rootMenuEmit("deselect", {
291
+ type: "deselect",
292
+ key,
293
+ el: ele,
294
+ e
295
+ });
296
+ return;
297
+ } else {
298
+ ele.classList.add(menuItemSelect);
299
+ }
300
+ }
301
+ if (changeRouteResult === void 0) {
302
+ rootMenuEmit("select", {
303
+ type: "select",
304
+ key,
305
+ el: ele,
306
+ e
307
+ });
308
+ } else {
309
+ rootMenuEmit("select", {
310
+ type: "select",
311
+ key,
312
+ el: ele,
313
+ e,
314
+ route: changeRouteResult
315
+ });
316
+ }
317
+ }
318
+ if (mode.value === "vertical") {
319
+ const target = e.currentTarget;
320
+ addActiveParent(target);
321
+ }
322
+ if (mode.value === "horizontal") {
323
+ const ul = (_a2 = ele.parentElement) == null ? void 0 : _a2.parentElement;
324
+ ul == null ? void 0 : ul.classList.add(`${ns$2.b()}-active-parent`);
325
+ }
326
+ };
327
+ const icons = createVNode("span", {
328
+ "class": `${ns$2.b()}-icon`
329
+ }, [(_b = (_a = ctx.slots).icon) == null ? void 0 : _b.call(_a)]);
330
+ const menuItems = ref(null);
331
+ watch(disabled, () => {
332
+ if (!multiple) {
333
+ classObject.value[menuItemSelect] = false;
334
+ }
335
+ });
336
+ watch(() => defaultSelectKey, (n) => {
337
+ isSelect.value = initSelect(n, key, multiple, disabled);
338
+ classObject.value[menuItemSelect] = isSelect.value;
339
+ });
340
+ onMounted(() => {
341
+ var _a2, _b2;
342
+ let oldPadding = "";
343
+ const ele = menuItems.value;
344
+ if (mode.value === "vertical") {
345
+ if ((_b2 = (_a2 = ele.parentElement) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.classList.contains(ns$2.b())) {
346
+ isLayer1.value = true;
347
+ if (isLayer1.value) {
348
+ ele.style.paddingRight = ``;
349
+ ele.style.paddingLeft = `${indent}px`;
350
+ }
351
+ watch(isCollapsed, (val) => {
352
+ if (val) {
353
+ if (ele.style.padding !== "0") {
354
+ oldPadding = ele.style.padding;
355
+ }
356
+ setTimeout(() => {
357
+ ele.style.padding = "0";
358
+ ele.style.width = "";
359
+ ele.style.textAlign = `center`;
360
+ }, 300);
361
+ ele.style.display = `block`;
362
+ } else {
363
+ ele.style.padding = `${oldPadding}`;
364
+ ele.style.textAlign = ``;
365
+ ele.style.display = `flex`;
366
+ }
367
+ });
368
+ } else {
369
+ isLayer1.value = false;
370
+ }
371
+ }
372
+ });
373
+ return () => {
374
+ return mode.value === "vertical" ? createVNode("div", {
375
+ "class": `${ns$2.b()}-item-vertical-wrapper`
376
+ }, [createVNode("li", {
377
+ "class": classObject.value,
378
+ "onClick": onClick,
379
+ "ref": menuItems
380
+ }, [ctx.slots.icon !== void 0 && icons, props.href === "" ? createVNode(Transition, {
381
+ "name": "fade"
382
+ }, {
383
+ default: () => {
384
+ var _a2, _b2;
385
+ return [withDirectives(createVNode("span", null, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, !isCollapsed.value]])];
386
+ }
387
+ }) : createVNode("a", {
388
+ "href": props.href
389
+ }, [createVNode(Transition, {
390
+ "name": "fade"
391
+ }, {
392
+ default: () => {
393
+ var _a2, _b2;
394
+ return [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)];
395
+ }
396
+ })])])]) : createVNode("li", {
397
+ "class": classObject.value,
398
+ "onClick": onClick,
399
+ "ref": menuItems
400
+ }, [ctx.slots.icon !== void 0 && icons, props.href === "" ? createVNode(Transition, {
401
+ "name": "fade"
402
+ }, {
403
+ default: () => {
404
+ var _a2, _b2;
405
+ return [withDirectives(createVNode("span", null, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, !isCollapsed.value]])];
406
+ }
407
+ }) : createVNode("a", {
408
+ "href": props.href
409
+ }, [createVNode(Transition, {
410
+ "name": "fade"
411
+ }, {
412
+ default: () => {
413
+ var _a2, _b2;
414
+ return [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)];
415
+ }
416
+ })])]);
417
+ };
418
+ }
419
+ });
420
+ function randomId(n = 8) {
421
+ const str = "abcdefghijklmnopqrstuvwxyz0123456789";
422
+ let result = "";
423
+ for (let i = 0; i < n; i++) {
424
+ result += str[parseInt((Math.random() * str.length).toString())];
425
+ }
426
+ return result;
427
+ }
428
+ function useNearestMenuElement(ele) {
429
+ while (ele && ele.tagName !== "LI" && ele.tagName !== "UL") {
430
+ ele = ele.parentElement;
431
+ }
432
+ return ele;
433
+ }
434
+ const elTransition = "0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out";
435
+ const TransitionObj = {
436
+ "before-enter"(el) {
437
+ el.style.transition = elTransition;
438
+ el.setAttribute("data-oldPadding", el.style.padding);
439
+ el.setAttribute("data-oldMargin", el.style.margin);
440
+ el.style.height = "0";
441
+ el.style.padding = "0";
442
+ el.style.margin = "0";
443
+ },
444
+ enter(el) {
445
+ el.dataset.oldOverflow = el.style.overflow;
446
+ if (el.scrollHeight !== 0) {
447
+ el.style.height = el.scrollHeight + "px";
448
+ } else {
449
+ el.style.height = "";
450
+ }
451
+ el.style.padding = el.getAttribute("data-oldPadding");
452
+ el.style.margin = el.getAttribute("data-oldMargin");
453
+ el.style.overflow = "hidden";
454
+ },
455
+ "after-enter"(el) {
456
+ el.style.transition = "";
457
+ el.style.transition = "";
458
+ el.style.height = "";
459
+ el.style.overflow = el.getAttribute("data-overflow");
460
+ },
461
+ "before-leave"(el) {
462
+ if (!el.dataset) {
463
+ el.dataset = {};
464
+ }
465
+ el.dataset.oldPaddingTop = el.style.paddingTop;
466
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
467
+ el.dataset.oldOverflow = el.style.overflow;
468
+ el.style.height = el.scrollHeight + "px";
469
+ el.style.overflow = "hidden";
470
+ },
471
+ leave(el) {
472
+ if (el.scrollHeight !== 0) {
473
+ el.style.transition = elTransition;
474
+ el.style.height = "0";
475
+ el.style.paddingTop = "0";
476
+ el.style.paddingBottom = "0";
477
+ }
478
+ },
479
+ "after-leave"(el) {
480
+ el.style.transition = "";
481
+ el.style.height = "";
482
+ el.style.overflow = el.dataset.oldOverflow;
483
+ el.style.paddingTop = el.dataset.oldPaddingTop;
484
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
485
+ }
486
+ };
487
+ var MenuTransition = defineComponent({
488
+ name: "DMenuTransition",
489
+ setup(prop, ctx) {
490
+ return () => {
491
+ return createVNode(Transition, {
492
+ "onBeforeEnter": (e) => TransitionObj["before-enter"](e),
493
+ "onBeforeLeave": (e) => TransitionObj["before-leave"](e),
494
+ "onEnter": (e) => TransitionObj["enter"](e),
495
+ "onAfterEnter": (e) => TransitionObj["after-enter"](e),
496
+ "onLeave": (e) => TransitionObj["leave"](e),
497
+ "onAfterLeave": (e) => TransitionObj["after-leave"](e)
498
+ }, {
499
+ default: () => {
500
+ var _a, _b;
501
+ return [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)];
502
+ }
503
+ });
504
+ };
505
+ }
506
+ });
507
+ const subMenuProps = {
508
+ title: {
509
+ type: String,
510
+ default: ""
511
+ },
512
+ disabled: {
513
+ type: Boolean,
514
+ default: false
515
+ }
516
+ };
517
+ const ns$1 = useNamespace("menu");
518
+ const subNs$1 = useNamespace("submenu");
519
+ const menuItemHorizontalWrapperHidden = `${ns$1.b()}-item-horizontal-wrapper-hidden`;
520
+ const menuItemHorizontalWrapperShow = `${ns$1.b()}-item-horizontal-wrapper-show`;
521
+ function useShowSubMenu(eventName, e, wrapper) {
522
+ const target = e.currentTarget;
523
+ const targetParent = target.parentElement;
524
+ const wrapperChildren = wrapper.children;
525
+ wrapper.style.padding = `0 20px !important`;
526
+ if (eventName === "mouseenter") {
527
+ if ((targetParent == null ? void 0 : targetParent.tagName) === "DIV") {
528
+ wrapper.classList.add(`${ns$1.b()}-item-horizontal-wrapper-level`);
529
+ const { width } = target.getClientRects()[0];
530
+ wrapper.style.top = `0px`;
531
+ wrapper.style.left = `${width}px`;
532
+ } else {
533
+ wrapper.style.top = `26px`;
534
+ wrapper.style.left = `0px`;
535
+ }
536
+ wrapper.classList.remove(menuItemHorizontalWrapperHidden);
537
+ wrapper.classList.add(menuItemHorizontalWrapperShow);
538
+ for (let i = 0; i < wrapperChildren.length; i++) {
539
+ const ul = wrapperChildren[i];
540
+ if (ul.tagName === "UL" && ul.classList.contains(subNs$1.b())) {
541
+ const levelUlWrapper = ul.getElementsByClassName(`${ns$1.b()}-item-horizontal-wrapper`)[0];
542
+ ul.addEventListener("mouseenter", (ev) => {
543
+ ev.stopPropagation();
544
+ useShowSubMenu("mouseenter", ev, levelUlWrapper);
545
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperHidden);
546
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperShow);
547
+ });
548
+ ul.addEventListener("mouseleave", (ev) => {
549
+ ev.stopPropagation();
550
+ useShowSubMenu("mouseleave", ev, levelUlWrapper);
551
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperShow);
552
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperHidden);
553
+ });
554
+ }
555
+ }
556
+ }
557
+ if (eventName === "mouseleave") {
558
+ wrapper.classList.remove(menuItemHorizontalWrapperShow);
559
+ wrapper.classList.add(menuItemHorizontalWrapperHidden);
560
+ }
561
+ }
562
+ const ns = useNamespace("menu");
563
+ const subNs = useNamespace("submenu");
564
+ const subMenuClass = subNs.b();
565
+ var SubMenu = defineComponent({
566
+ name: "DSubMenu",
567
+ props: subMenuProps,
568
+ setup(props, ctx) {
569
+ const isShow = ref(true);
570
+ const {
571
+ vnode: {
572
+ key
573
+ }
574
+ } = getCurrentInstance();
575
+ let key_ = String(key);
576
+ const defaultOpenKeys = inject("openKeys");
577
+ const isOpen = ref(defaultOpenKeys.value.includes(key_));
578
+ const indent = inject("defaultIndent");
579
+ const isCollapsed = inject("isCollapsed");
580
+ const mode = inject("mode");
581
+ const subMenuItemContainer = ref(null);
582
+ const parentEmit = inject("rootMenuEmit");
583
+ const isHorizontal = mode.value === "horizontal";
584
+ if (key_ === "null") {
585
+ console.warn(`[devui][menu]: Key can not be null`);
586
+ key_ = `randomKey-${randomId(16)}`;
587
+ }
588
+ const clickHandle = (e) => {
589
+ e.stopPropagation();
590
+ const ele = useNearestMenuElement(e.target);
591
+ if (ele.classList.contains(subMenuClass) && isHorizontal) {
592
+ return;
593
+ }
594
+ if (isHorizontal) {
595
+ clearSelect(ele, e, true);
596
+ useClick(e);
597
+ }
598
+ if (!props.disabled && mode.value !== "horizontal") {
599
+ const cur = useNearestMenuElement(e.target);
600
+ const idx = defaultOpenKeys.value.indexOf(key_);
601
+ if (idx >= 0 && cur.tagName === "UL") {
602
+ defaultOpenKeys.value.splice(idx, 1);
603
+ } else {
604
+ if (cur.tagName === "UL") {
605
+ defaultOpenKeys.value.push(key_);
606
+ }
607
+ }
608
+ isOpen.value = defaultOpenKeys.value.indexOf(key_) >= 0;
609
+ parentEmit("submenu-change", {
610
+ type: "submenu-change",
611
+ state: isOpen.value,
612
+ key: key_,
613
+ el: ele
614
+ });
615
+ }
616
+ };
617
+ const wrapper = ref(null);
618
+ let wrapperDom;
619
+ const subMenu = ref(null);
620
+ const title = ref(null);
621
+ let oldPadding = "";
622
+ const class_layer = ref("");
623
+ watchEffect(() => {
624
+ wrapperDom = wrapper.value;
625
+ pushElement({
626
+ el: subMenu.value
627
+ });
628
+ }, {
629
+ flush: "post"
630
+ });
631
+ watch(() => defaultOpenKeys, (n) => {
632
+ if (n.value.includes(key_)) {
633
+ isOpen.value = true;
634
+ } else {
635
+ isOpen.value = false;
636
+ }
637
+ }, {
638
+ deep: true
639
+ });
640
+ onMounted(() => {
641
+ var _a;
642
+ const subMenuTitle = title.value;
643
+ const subMenuWrapper = subMenu.value;
644
+ addLayer();
645
+ class_layer.value = `layer_${(_a = Array.from(subMenuWrapper.classList).at(-1)) == null ? void 0 : _a.replace("layer_", "")}`;
646
+ if (isHorizontal && !props.disabled) {
647
+ subMenu.value.addEventListener("mouseenter", (ev) => {
648
+ ev.stopPropagation();
649
+ useShowSubMenu("mouseenter", ev, wrapperDom);
650
+ });
651
+ subMenu.value.addEventListener("mouseleave", (ev) => {
652
+ ev.stopPropagation();
653
+ useShowSubMenu("mouseleave", ev, wrapperDom);
654
+ });
655
+ }
656
+ watch(isCollapsed, (newValue) => {
657
+ const layer = Number(getLayer(subMenuWrapper));
658
+ if (!Number.isNaN(layer)) {
659
+ layer > 2 && (isShow.value = !isCollapsed.value);
660
+ }
661
+ if (newValue) {
662
+ subMenuTitle.style.padding !== "0" && (oldPadding = subMenuTitle.style.padding);
663
+ setTimeout(() => {
664
+ subMenuTitle.style.padding = "0";
665
+ subMenuTitle.style.width = "";
666
+ subMenuTitle.style.textAlign = `center`;
667
+ }, 300);
668
+ subMenuTitle.style.display = `block`;
669
+ } else {
670
+ subMenuTitle.style.padding = `${oldPadding}`;
671
+ subMenuTitle.style.textAlign = ``;
672
+ subMenuTitle.style.display = `flex`;
673
+ }
674
+ });
675
+ });
676
+ return () => {
677
+ var _a, _b, _c, _d;
678
+ return withDirectives(createVNode("ul", {
679
+ "onClick": clickHandle,
680
+ "class": [subMenuClass, class_layer.value, props["disabled"] && `${subMenuClass}-disabled`],
681
+ "ref": subMenu
682
+ }, [createVNode("div", {
683
+ "class": [`${subMenuClass}-title`],
684
+ "style": `padding: 0 ${indent}px`,
685
+ "ref": title
686
+ }, [createVNode("span", {
687
+ "class": `${ns.b()}-icon`
688
+ }, [(_b = (_a = ctx.slots) == null ? void 0 : _a.icon) == null ? void 0 : _b.call(_a)]), withDirectives(createVNode("span", {
689
+ "class": `${subMenuClass}-title-content`
690
+ }, [props.title]), [[vShow, !isCollapsed.value]]), withDirectives(createVNode("i", {
691
+ "class": {
692
+ "icon icon-chevron-up": class_layer.value !== `layer_${subMenuClass}`,
693
+ "icon icon-chevron-right": class_layer.value === `layer_${subMenuClass}`,
694
+ "is-opened": isOpen.value
695
+ }
696
+ }, null), [[vShow, !isCollapsed.value && key !== "overflowContainer"]])]), isHorizontal ? withDirectives(createVNode("div", {
697
+ "class": `${ns.b()}-item-horizontal-wrapper ${ns.b()}-item-horizontal-wrapper-hidden`,
698
+ "ref": wrapper
699
+ }, [(_d = (_c = ctx.slots).default) == null ? void 0 : _d.call(_c)]), [[vShow, !props.disabled]]) : createVNode(MenuTransition, null, {
700
+ default: () => {
701
+ var _a2, _b2;
702
+ return [withDirectives(createVNode("div", {
703
+ "class": [`${subMenuClass}-menu-item-vertical-wrapper`],
704
+ "ref": subMenuItemContainer
705
+ }, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, isOpen.value]])];
706
+ }
707
+ })]), [[vShow, isShow.value]]);
708
+ };
709
+ }
710
+ });
711
+ const menuProps = {
712
+ width: {
713
+ type: String,
714
+ default: ""
715
+ },
716
+ collapsed: {
717
+ type: Boolean,
718
+ default: false
719
+ },
720
+ collapsedIndent: {
721
+ type: Number,
722
+ default: 24
723
+ },
724
+ indentSize: {
725
+ type: Number,
726
+ default: 24
727
+ },
728
+ multiple: {
729
+ type: Boolean,
730
+ default: false
731
+ },
732
+ openKeys: {
733
+ type: Array,
734
+ default: []
735
+ },
736
+ defaultSelectKeys: {
737
+ type: Array,
738
+ default: []
739
+ },
740
+ mode: {
741
+ type: String,
742
+ default: "vertical"
743
+ },
744
+ router: {
745
+ type: Boolean,
746
+ default: false
747
+ }
748
+ };
749
+ var menu = "";
750
+ var Menu = defineComponent({
751
+ name: "DMenu",
752
+ props: menuProps,
753
+ emits: ["select", "deselect", "submenu-change"],
754
+ setup(props, ctx) {
755
+ const ns2 = useNamespace("menu");
756
+ const {
757
+ openKeys,
758
+ mode,
759
+ collapsed
760
+ } = toRefs(props);
761
+ provide("isCollapsed", collapsed);
762
+ provide("defaultIndent", props["indentSize"]);
763
+ provide("multiple", props["multiple"]);
764
+ provide("openKeys", openKeys);
765
+ provide("defaultSelectKey", props.defaultSelectKeys);
766
+ provide("mode", mode);
767
+ provide("collapsedIndent", props["collapsedIndent"]);
768
+ provide("rootMenuEmit", ctx.emit);
769
+ provide("useRouter", props.router);
770
+ setDefaultIndent(props["indentSize"]);
771
+ const menuRoot = ref(null);
772
+ const overflowItemLength = ref(0);
773
+ const overflowContainer = ref(null);
774
+ const selectClassName = `${ns2.b()}-item-select`;
775
+ const rootClassName = computed(() => ({
776
+ [`${ns2.b()}`]: true,
777
+ [`${ns2.b()}-vertical`]: mode.value === "vertical",
778
+ [`${ns2.b()}-horizontal`]: mode.value === "horizontal",
779
+ [`${ns2.b()}-collapsed`]: collapsed.value
780
+ }));
781
+ const overflowContainerClassName = reactive({
782
+ [selectClassName]: false,
783
+ [`${ns2.b()}-overflow-container`]: true
784
+ });
785
+ const resetOverflowContainerSelectState = (e) => {
786
+ const children = Array.from(e.children);
787
+ for (const item of children) {
788
+ if (item.classList.contains(selectClassName)) {
789
+ overflowContainerClassName[selectClassName] = true;
790
+ break;
791
+ } else {
792
+ overflowContainerClassName[selectClassName] = false;
793
+ }
794
+ }
795
+ };
796
+ onMounted(() => {
797
+ var _a;
798
+ if (props["mode"] === "horizontal") {
799
+ let flag = false;
800
+ const overflowContainerElement = (_a = overflowContainer.value) == null ? void 0 : _a.$el;
801
+ const root = menuRoot.value;
802
+ const children = root.children;
803
+ const container = overflowContainerElement.children[1];
804
+ const ob = new IntersectionObserver((entries) => {
805
+ entries.forEach((entry) => {
806
+ if (!entry.isIntersecting) {
807
+ const cloneNode = entry.target.cloneNode(true);
808
+ if (entry.target.classList.contains(`${ns2.b()}-overflow-container`)) {
809
+ if (flag && entry.target.previousElementSibling && container.children.length) {
810
+ root.appendChild(entry.target.previousElementSibling);
811
+ } else {
812
+ flag = true;
813
+ }
814
+ } else {
815
+ overflowItemLength.value += 1;
816
+ entry.target.style.visibility = "hidden";
817
+ if (overflowContainerElement.nextSibling) {
818
+ root.insertBefore(entry.target, overflowContainerElement.nextSibling);
819
+ } else {
820
+ root.appendChild(entry.target);
821
+ }
822
+ container.appendChild(cloneNode);
823
+ resetOverflowContainerSelectState(container);
824
+ }
825
+ } else {
826
+ if (!entry.target.classList.contains(`${ns2.b()}-overflow-container`) && entry.target.style.visibility === "hidden") {
827
+ ob.unobserve(entry.target);
828
+ root.insertBefore(entry.target, overflowContainerElement);
829
+ entry.target.style.visibility = "";
830
+ const obItem = overflowContainerElement.previousElementSibling;
831
+ const canObAgin = obItem && entry.boundingClientRect.width % entry.target.getBoundingClientRect().width === 0;
832
+ if (canObAgin) {
833
+ ob.observe(obItem);
834
+ }
835
+ if (obItem == null ? void 0 : obItem.classList.contains("devui-submenu")) {
836
+ const sub = obItem;
837
+ const wrapper = obItem.children[1];
838
+ sub.addEventListener("mouseenter", (ev) => {
839
+ ev.stopPropagation();
840
+ useShowSubMenu("mouseenter", ev, wrapper);
841
+ });
842
+ sub.addEventListener("mouseleave", (ev) => {
843
+ ev.stopPropagation();
844
+ useShowSubMenu("mouseleave", ev, wrapper);
845
+ });
846
+ }
847
+ overflowItemLength.value -= 1;
848
+ ob.observe(entry.target);
849
+ if (container.lastChild) {
850
+ container.removeChild(container.lastChild);
851
+ }
852
+ resetOverflowContainerSelectState(container);
853
+ }
854
+ }
855
+ });
856
+ }, {
857
+ root,
858
+ threshold: 1,
859
+ rootMargin: "8px"
860
+ });
861
+ for (let i = 0; i < children.length; i++) {
862
+ ob.observe(children[i]);
863
+ }
864
+ }
865
+ });
866
+ return () => {
867
+ var _a, _b;
868
+ return createVNode("ul", {
869
+ "ref": menuRoot,
870
+ "class": rootClassName.value,
871
+ "style": [props["collapsed"] ? `width:${props["collapsedIndent"] * 2}px` : `width: ${props["width"]}`]
872
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a), withDirectives(createVNode(SubMenu, {
873
+ "ref": overflowContainer,
874
+ "key": "overflowContainer",
875
+ "title": "...",
876
+ "class": overflowContainerClassName
877
+ }, null), [[vShow, overflowItemLength.value > 0 && mode.value === "horizontal"]])]);
878
+ };
879
+ }
880
+ });
881
+ var index = {
882
+ title: "Menu \u83DC\u5355",
883
+ category: "\u5E03\u5C40",
884
+ status: "100%",
885
+ install(app) {
886
+ app.component(Menu.name, Menu);
887
+ app.component(MenuItem.name, MenuItem);
888
+ app.component(SubMenu.name, SubMenu);
889
+ }
890
+ };
891
+ export { Menu, MenuItem, SubMenu, index as default };