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

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 +9044 -0
  8. package/auto-complete/index.umd.js +29 -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 +5927 -131
  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 +8082 -232
  29. package/checkbox/index.umd.js +27 -1
  30. package/checkbox/style.css +1 -1
  31. package/collapse/index.d.ts +7 -0
  32. package/collapse/index.es.js +213 -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 +12018 -0
  43. package/date-picker-pro/index.umd.js +27 -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 +203 -139
  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 +754 -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 +912 -442
  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 +2415 -1985
  61. package/form/index.umd.js +18 -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 +284 -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 +142 -39
  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 +8255 -145
  83. package/input/index.umd.js +27 -1
  84. package/input/style.css +1 -1
  85. package/input-number/index.d.ts +7 -0
  86. package/input-number/index.es.js +270 -186
  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 +77 -38
  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 +8310 -0
  99. package/mention/index.umd.js +36 -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 +870 -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 +538 -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 +607 -841
  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 +545 -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 +7976 -159
  305. package/radio/index.umd.js +27 -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 +51 -43
  318. package/ripple/index.umd.js +1 -1
  319. package/search/index.d.ts +7 -0
  320. package/search/index.es.js +8411 -450
  321. package/search/index.umd.js +27 -1
  322. package/search/style.css +1 -1
  323. package/select/index.d.ts +7 -0
  324. package/select/index.es.js +9295 -561
  325. package/select/index.umd.js +27 -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 +6301 -167
  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 +274 -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 +7805 -65
  356. package/switch/index.umd.js +27 -1
  357. package/switch/style.css +1 -1
  358. package/table/index.d.ts +7 -0
  359. package/table/index.es.js +11423 -207
  360. package/table/index.umd.js +27 -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 +7973 -0
  373. package/textarea/index.umd.js +35 -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 +9101 -581
  379. package/time-picker/index.umd.js +27 -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 +9585 -0
  383. package/time-select/index.umd.js +27 -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 +11438 -654
  397. package/tree/index.umd.js +27 -1
  398. package/tree/style.css +1 -1
  399. package/upload/index.d.ts +7 -0
  400. package/upload/index.es.js +981 -2719
  401. package/upload/index.umd.js +1 -1
  402. package/upload/style.css +1 -1
  403. package/vue-devui.es.js +22794 -16605
  404. package/vue-devui.umd.js +31 -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,870 @@
1
+ import { ref, defineComponent, getCurrentInstance, inject, toRefs, computed, createVNode, watch, onMounted, Transition, withDirectives, vShow, watchEffect, provide } 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
+ if (!props.disabled) {
278
+ if (!multiple) {
279
+ clearSelect(ele, e, mode.value === "horizontal");
280
+ if (mode.value === "horizontal") {
281
+ useClick(e);
282
+ } else {
283
+ ele.classList.add(menuItemSelect);
284
+ }
285
+ changeRouteResult = changeRoute(props, router, useRouter, key);
286
+ } else {
287
+ if (ele.classList.contains(menuItemSelect)) {
288
+ ele.classList.remove(menuItemSelect);
289
+ rootMenuEmit("deselect", {
290
+ type: "deselect",
291
+ key,
292
+ el: ele,
293
+ e
294
+ });
295
+ return;
296
+ } else {
297
+ ele.classList.add(menuItemSelect);
298
+ }
299
+ }
300
+ if (changeRouteResult === void 0) {
301
+ rootMenuEmit("select", {
302
+ type: "select",
303
+ key,
304
+ el: ele,
305
+ e
306
+ });
307
+ } else {
308
+ rootMenuEmit("select", {
309
+ type: "select",
310
+ key,
311
+ el: ele,
312
+ e,
313
+ route: changeRouteResult
314
+ });
315
+ }
316
+ }
317
+ if (mode.value === "vertical") {
318
+ const target = e.currentTarget;
319
+ addActiveParent(target);
320
+ }
321
+ if (mode.value === "horizontal") {
322
+ const ul = (_a2 = ele.parentElement) == null ? void 0 : _a2.parentElement;
323
+ ul == null ? void 0 : ul.classList.add(`${ns$2.b()}-active-parent`);
324
+ }
325
+ };
326
+ const icons = createVNode("span", {
327
+ "class": `${ns$2.b()}-icon`
328
+ }, [(_b = (_a = ctx.slots).icon) == null ? void 0 : _b.call(_a)]);
329
+ const menuItems = ref(null);
330
+ watch(disabled, () => {
331
+ classObject.value[menuItemSelect] = false;
332
+ });
333
+ watch(() => defaultSelectKey, (n) => {
334
+ isSelect.value = initSelect(n, key, multiple, disabled);
335
+ classObject.value[menuItemSelect] = isSelect.value;
336
+ });
337
+ onMounted(() => {
338
+ var _a2, _b2;
339
+ let oldPadding = "";
340
+ const ele = menuItems.value;
341
+ if (mode.value === "vertical") {
342
+ if ((_b2 = (_a2 = ele.parentElement) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.classList.contains(ns$2.b())) {
343
+ isLayer1.value = true;
344
+ if (isLayer1.value) {
345
+ ele.style.paddingRight = ``;
346
+ ele.style.paddingLeft = `${indent}px`;
347
+ }
348
+ watch(isCollapsed, (val) => {
349
+ if (val) {
350
+ if (ele.style.padding !== "0") {
351
+ oldPadding = ele.style.padding;
352
+ }
353
+ setTimeout(() => {
354
+ ele.style.padding = "0";
355
+ ele.style.width = "";
356
+ ele.style.textAlign = `center`;
357
+ }, 300);
358
+ ele.style.display = `block`;
359
+ } else {
360
+ ele.style.padding = `${oldPadding}`;
361
+ ele.style.textAlign = ``;
362
+ ele.style.display = `flex`;
363
+ }
364
+ });
365
+ } else {
366
+ isLayer1.value = false;
367
+ }
368
+ }
369
+ });
370
+ return () => {
371
+ return mode.value === "vertical" ? createVNode("div", {
372
+ "class": `${ns$2.b()}-item-vertical-wrapper`
373
+ }, [createVNode("li", {
374
+ "class": classObject.value,
375
+ "onClick": onClick,
376
+ "ref": menuItems
377
+ }, [ctx.slots.icon !== void 0 && icons, props.href === "" ? createVNode(Transition, {
378
+ "name": "fade"
379
+ }, {
380
+ default: () => {
381
+ var _a2, _b2;
382
+ return [withDirectives(createVNode("span", null, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, !isCollapsed.value]])];
383
+ }
384
+ }) : createVNode("a", {
385
+ "href": props.href
386
+ }, [createVNode(Transition, {
387
+ "name": "fade"
388
+ }, {
389
+ default: () => {
390
+ var _a2, _b2;
391
+ return [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)];
392
+ }
393
+ })])])]) : createVNode("li", {
394
+ "class": classObject.value,
395
+ "onClick": onClick,
396
+ "ref": menuItems
397
+ }, [ctx.slots.icon !== void 0 && icons, props.href === "" ? createVNode(Transition, {
398
+ "name": "fade"
399
+ }, {
400
+ default: () => {
401
+ var _a2, _b2;
402
+ return [withDirectives(createVNode("span", null, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, !isCollapsed.value]])];
403
+ }
404
+ }) : createVNode("a", {
405
+ "href": props.href
406
+ }, [createVNode(Transition, {
407
+ "name": "fade"
408
+ }, {
409
+ default: () => {
410
+ var _a2, _b2;
411
+ return [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)];
412
+ }
413
+ })])]);
414
+ };
415
+ }
416
+ });
417
+ const ns$1 = useNamespace("menu");
418
+ const subNs$1 = useNamespace("submenu");
419
+ const menuItemHorizontalWrapperHidden = `${ns$1.b()}-item-horizontal-wrapper-hidden`;
420
+ const menuItemHorizontalWrapperShow = `${ns$1.b()}-item-horizontal-wrapper-show`;
421
+ function useShowSubMenu(eventName, e, wrapper) {
422
+ const target = e.currentTarget;
423
+ const targetParent = target.parentElement;
424
+ const wrapperChildren = wrapper.children;
425
+ wrapper.style.padding = `0 20px !important`;
426
+ if (eventName === "mouseenter") {
427
+ if ((targetParent == null ? void 0 : targetParent.tagName) === "DIV") {
428
+ wrapper.classList.add(`${ns$1.b()}-item-horizontal-wrapper-level`);
429
+ const { width } = target.getClientRects()[0];
430
+ wrapper.style.top = `0px`;
431
+ wrapper.style.left = `${width}px`;
432
+ } else {
433
+ wrapper.style.top = `26px`;
434
+ wrapper.style.left = `0px`;
435
+ }
436
+ wrapper.classList.remove(menuItemHorizontalWrapperHidden);
437
+ wrapper.classList.add(menuItemHorizontalWrapperShow);
438
+ for (let i = 0; i < wrapperChildren.length; i++) {
439
+ const ul = wrapperChildren[i];
440
+ if (ul.tagName === "UL" && ul.classList.contains(subNs$1.b())) {
441
+ const levelUlWrapper = ul.getElementsByClassName(`${ns$1.b()}-item-horizontal-wrapper`)[0];
442
+ ul.addEventListener("mouseenter", (ev) => {
443
+ ev.stopPropagation();
444
+ useShowSubMenu("mouseenter", ev, levelUlWrapper);
445
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperHidden);
446
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperShow);
447
+ });
448
+ ul.addEventListener("mouseleave", (ev) => {
449
+ ev.stopPropagation();
450
+ useShowSubMenu("mouseleave", ev, levelUlWrapper);
451
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperShow);
452
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperHidden);
453
+ });
454
+ }
455
+ }
456
+ }
457
+ if (eventName === "mouseleave") {
458
+ wrapper.classList.remove(menuItemHorizontalWrapperShow);
459
+ wrapper.classList.add(menuItemHorizontalWrapperHidden);
460
+ }
461
+ }
462
+ const subMenuProps = {
463
+ title: {
464
+ type: String,
465
+ default: ""
466
+ },
467
+ disabled: {
468
+ type: Boolean,
469
+ default: false
470
+ }
471
+ };
472
+ const elTransition = "0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out";
473
+ const TransitionObj = {
474
+ "before-enter"(el) {
475
+ el.style.transition = elTransition;
476
+ el.setAttribute("data-oldPadding", el.style.padding);
477
+ el.setAttribute("data-oldMargin", el.style.margin);
478
+ el.style.height = "0";
479
+ el.style.padding = "0";
480
+ el.style.margin = "0";
481
+ },
482
+ enter(el) {
483
+ el.dataset.oldOverflow = el.style.overflow;
484
+ if (el.scrollHeight !== 0) {
485
+ el.style.height = el.scrollHeight + "px";
486
+ } else {
487
+ el.style.height = "";
488
+ }
489
+ el.style.padding = el.getAttribute("data-oldPadding");
490
+ el.style.margin = el.getAttribute("data-oldMargin");
491
+ el.style.overflow = "hidden";
492
+ },
493
+ "after-enter"(el) {
494
+ el.style.transition = "";
495
+ el.style.transition = "";
496
+ el.style.height = "";
497
+ el.style.overflow = el.getAttribute("data-overflow");
498
+ },
499
+ "before-leave"(el) {
500
+ if (!el.dataset) {
501
+ el.dataset = {};
502
+ }
503
+ el.dataset.oldPaddingTop = el.style.paddingTop;
504
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
505
+ el.dataset.oldOverflow = el.style.overflow;
506
+ el.style.height = el.scrollHeight + "px";
507
+ el.style.overflow = "hidden";
508
+ },
509
+ leave(el) {
510
+ if (el.scrollHeight !== 0) {
511
+ el.style.transition = elTransition;
512
+ el.style.height = "0";
513
+ el.style.paddingTop = "0";
514
+ el.style.paddingBottom = "0";
515
+ }
516
+ },
517
+ "after-leave"(el) {
518
+ el.style.transition = "";
519
+ el.style.height = "";
520
+ el.style.overflow = el.dataset.oldOverflow;
521
+ el.style.paddingTop = el.dataset.oldPaddingTop;
522
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
523
+ }
524
+ };
525
+ var MenuTransition = defineComponent({
526
+ name: "DMenuTransition",
527
+ setup(prop, ctx) {
528
+ return () => {
529
+ return createVNode(Transition, {
530
+ "onBeforeEnter": (e) => TransitionObj["before-enter"](e),
531
+ "onBeforeLeave": (e) => TransitionObj["before-leave"](e),
532
+ "onEnter": (e) => TransitionObj["enter"](e),
533
+ "onAfterEnter": (e) => TransitionObj["after-enter"](e),
534
+ "onLeave": (e) => TransitionObj["leave"](e),
535
+ "onAfterLeave": (e) => TransitionObj["after-leave"](e)
536
+ }, {
537
+ default: () => {
538
+ var _a, _b;
539
+ return [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)];
540
+ }
541
+ });
542
+ };
543
+ }
544
+ });
545
+ const ns = useNamespace("menu");
546
+ const subNs = useNamespace("submenu");
547
+ const subMenuClass = subNs.b();
548
+ var SubMenu = defineComponent({
549
+ name: "DSubMenu",
550
+ props: subMenuProps,
551
+ setup(props, ctx) {
552
+ const isShow = ref(true);
553
+ const {
554
+ vnode: {
555
+ key
556
+ }
557
+ } = getCurrentInstance();
558
+ const key_ = String(key);
559
+ const isOpen = ref(false);
560
+ const defaultOpenKeys = inject("openKeys");
561
+ const indent = inject("defaultIndent");
562
+ const isCollapsed = inject("isCollapsed");
563
+ const mode = inject("mode");
564
+ const subMenuItemContainer = ref(null);
565
+ const parentEmit = inject("rootMenuEmit");
566
+ const isHorizontal = mode.value === "horizontal";
567
+ if (key_ === "null") {
568
+ console.warn(`[devui][menu]: Key can not be null`);
569
+ } else {
570
+ if (defaultOpenKeys.value.includes(key_)) {
571
+ isOpen.value = true;
572
+ } else {
573
+ isOpen.value = false;
574
+ }
575
+ }
576
+ const clickHandle = (e) => {
577
+ e.preventDefault();
578
+ e.stopPropagation();
579
+ const ele = e.currentTarget;
580
+ if (ele.classList.contains(subMenuClass) && isHorizontal) {
581
+ return;
582
+ }
583
+ if (isHorizontal) {
584
+ clearSelect(ele, e, true);
585
+ useClick(e);
586
+ }
587
+ if (!props.disabled && mode.value !== "horizontal") {
588
+ const target = e.target;
589
+ let cur = e.target;
590
+ if (target.tagName === "UL") {
591
+ if (target.classList.contains(`${subMenuClass}-open`)) {
592
+ isOpen.value = !isOpen.value;
593
+ } else {
594
+ isOpen.value = isOpen.value;
595
+ }
596
+ } else {
597
+ while (cur && cur.tagName !== "UL") {
598
+ if (cur.tagName === "LI") {
599
+ break;
600
+ }
601
+ cur = cur.parentElement;
602
+ }
603
+ if (cur.tagName === "UL") {
604
+ isOpen.value = !isOpen.value;
605
+ }
606
+ }
607
+ parentEmit("submenu-change", {
608
+ type: "submenu-change",
609
+ state: isOpen.value,
610
+ key: key_,
611
+ el: cur
612
+ });
613
+ }
614
+ };
615
+ const wrapper = ref(null);
616
+ let wrapperDom;
617
+ const subMenu = ref(null);
618
+ const title = ref(null);
619
+ let oldPadding = "";
620
+ const class_layer = ref("");
621
+ watchEffect(() => {
622
+ wrapperDom = wrapper.value;
623
+ pushElement({
624
+ el: subMenu.value
625
+ });
626
+ }, {
627
+ flush: "post"
628
+ });
629
+ watch(() => defaultOpenKeys, (n) => {
630
+ if (n.value.includes(key_)) {
631
+ isOpen.value = true;
632
+ } else {
633
+ isOpen.value = false;
634
+ }
635
+ }, {
636
+ deep: true
637
+ });
638
+ onMounted(() => {
639
+ var _a;
640
+ const el = title.value;
641
+ const e = subMenu.value;
642
+ addLayer();
643
+ class_layer.value = `layer_${(_a = Array.from(e.classList).at(-1)) == null ? void 0 : _a.replace("layer_", "")}`;
644
+ if (isHorizontal) {
645
+ subMenu.value.addEventListener("mouseenter", (ev) => {
646
+ ev.stopPropagation();
647
+ useShowSubMenu("mouseenter", ev, wrapperDom);
648
+ });
649
+ subMenu.value.addEventListener("mouseleave", (ev) => {
650
+ ev.stopPropagation();
651
+ useShowSubMenu("mouseleave", ev, wrapperDom);
652
+ });
653
+ }
654
+ watch(isCollapsed, (newValue) => {
655
+ const layer = Number(getLayer(e));
656
+ if (!Number.isNaN(layer)) {
657
+ layer > 2 && (isShow.value = !isCollapsed.value);
658
+ }
659
+ if (newValue) {
660
+ el.style.padding !== "0" && (oldPadding = el.style.padding);
661
+ setTimeout(() => {
662
+ el.style.padding = "0";
663
+ el.style.width = "";
664
+ el.style.textAlign = `center`;
665
+ }, 300);
666
+ el.style.display = `block`;
667
+ } else {
668
+ el.style.padding = `${oldPadding}`;
669
+ el.style.textAlign = ``;
670
+ el.style.display = `flex`;
671
+ }
672
+ });
673
+ });
674
+ return () => {
675
+ var _a, _b, _c, _d;
676
+ return withDirectives(createVNode("ul", {
677
+ "onClick": clickHandle,
678
+ "class": [subMenuClass, class_layer.value],
679
+ "ref": subMenu
680
+ }, [createVNode("div", {
681
+ "class": [`${subMenuClass}-title`, props["disabled"] && `${subMenuClass}-disabled`],
682
+ "style": `padding: 0 ${indent}px`,
683
+ "ref": title
684
+ }, [createVNode("span", {
685
+ "class": `${ns.b()}-icon`
686
+ }, [(_b = (_a = ctx.slots) == null ? void 0 : _a.icon) == null ? void 0 : _b.call(_a)]), withDirectives(createVNode("span", {
687
+ "class": `${subMenuClass}-title-content`
688
+ }, [props.title]), [[vShow, !isCollapsed.value]]), withDirectives(createVNode("i", {
689
+ "class": {
690
+ "icon icon-chevron-up": class_layer.value !== `layer_${subMenuClass}`,
691
+ "icon icon-chevron-right": class_layer.value === `layer_${subMenuClass}`,
692
+ "is-opened": isOpen.value
693
+ }
694
+ }, null), [[vShow, !isCollapsed.value && key !== "overflowContainer"]])]), isHorizontal ? createVNode("div", {
695
+ "class": `${ns.b()}-item-horizontal-wrapper ${ns.b()}-item-horizontal-wrapper-hidden`,
696
+ "ref": wrapper
697
+ }, [(_d = (_c = ctx.slots).default) == null ? void 0 : _d.call(_c)]) : createVNode(MenuTransition, null, {
698
+ default: () => {
699
+ var _a2, _b2;
700
+ return [withDirectives(createVNode("div", {
701
+ "class": [`${subMenuClass}-menu-item-vertical-wrapper`],
702
+ "ref": subMenuItemContainer
703
+ }, [(_b2 = (_a2 = ctx.slots).default) == null ? void 0 : _b2.call(_a2)]), [[vShow, isOpen.value]])];
704
+ }
705
+ })]), [[vShow, isShow.value]]);
706
+ };
707
+ }
708
+ });
709
+ const menuProps = {
710
+ width: {
711
+ type: String,
712
+ default: ""
713
+ },
714
+ collapsed: {
715
+ type: Boolean,
716
+ default: false
717
+ },
718
+ collapsedIndent: {
719
+ type: Number,
720
+ default: 24
721
+ },
722
+ indentSize: {
723
+ type: Number,
724
+ default: 24
725
+ },
726
+ multiple: {
727
+ type: Boolean,
728
+ default: false
729
+ },
730
+ openKeys: {
731
+ type: Array,
732
+ default: []
733
+ },
734
+ defaultSelectKeys: {
735
+ type: Array,
736
+ default: []
737
+ },
738
+ mode: {
739
+ type: String,
740
+ default: "vertical"
741
+ },
742
+ router: {
743
+ type: Boolean,
744
+ default: false
745
+ }
746
+ };
747
+ var menu = "";
748
+ var Menu = defineComponent({
749
+ name: "DMenu",
750
+ props: menuProps,
751
+ emits: ["select", "deselect", "submenu-change"],
752
+ setup(props, ctx) {
753
+ const ns2 = useNamespace("menu");
754
+ const {
755
+ openKeys,
756
+ mode,
757
+ collapsed
758
+ } = toRefs(props);
759
+ provide("isCollapsed", collapsed);
760
+ provide("defaultIndent", props["indentSize"]);
761
+ provide("multiple", props["multiple"]);
762
+ provide("openKeys", openKeys);
763
+ provide("defaultSelectKey", props.defaultSelectKeys);
764
+ provide("mode", mode);
765
+ provide("collapsedIndent", props["collapsedIndent"]);
766
+ provide("rootMenuEmit", ctx.emit);
767
+ provide("useRouter", props.router);
768
+ setDefaultIndent(props["indentSize"]);
769
+ const menuRoot = ref(null);
770
+ const overflow_container = ref(null);
771
+ const overflowItemLength = ref(0);
772
+ const rootClassName = computed(() => ({
773
+ [`${ns2.b()}`]: true,
774
+ [`${ns2.b()}-vertical`]: mode.value === "vertical",
775
+ [`${ns2.b()}-horizontal`]: mode.value === "horizontal",
776
+ [`${ns2.b()}-collapsed`]: collapsed.value
777
+ }));
778
+ onMounted(() => {
779
+ var _a;
780
+ if (props["mode"] === "horizontal") {
781
+ let flag = false;
782
+ const overflowContainer = (_a = overflow_container.value) == null ? void 0 : _a.$el;
783
+ const root = menuRoot.value;
784
+ const children = root.children;
785
+ const container = overflowContainer.children[1];
786
+ const ob = new IntersectionObserver((entries) => {
787
+ entries.forEach((v) => {
788
+ if (!v.isIntersecting) {
789
+ const cloneNode = v.target.cloneNode(true);
790
+ if (v.target.classList.contains(`${ns2.b()}-overflow-container`)) {
791
+ if (flag && v.target.previousElementSibling && container.children.length) {
792
+ root.appendChild(v.target.previousElementSibling);
793
+ } else {
794
+ flag = true;
795
+ }
796
+ } else {
797
+ overflowItemLength.value += 1;
798
+ v.target.style.visibility = "hidden";
799
+ if (overflowContainer.nextSibling) {
800
+ root.insertBefore(v.target, overflowContainer.nextSibling);
801
+ } else {
802
+ root.appendChild(v.target);
803
+ }
804
+ container.appendChild(cloneNode);
805
+ }
806
+ } else {
807
+ if (!v.target.classList.contains(`${ns2.b()}-overflow-container`) && v.target.style.visibility === "hidden") {
808
+ ob.unobserve(v.target);
809
+ const el = container.lastChild;
810
+ if (el) {
811
+ root.insertBefore(el, overflowContainer);
812
+ }
813
+ const obItem = overflowContainer.previousElementSibling;
814
+ if (obItem) {
815
+ ob.observe(obItem);
816
+ }
817
+ if (obItem == null ? void 0 : obItem.classList.contains("devui-submenu")) {
818
+ const sub = obItem;
819
+ const wrapper = obItem.children[1];
820
+ sub.addEventListener("mouseenter", (ev) => {
821
+ ev.stopPropagation();
822
+ useShowSubMenu("mouseenter", ev, wrapper);
823
+ });
824
+ sub.addEventListener("mouseleave", (ev) => {
825
+ ev.stopPropagation();
826
+ useShowSubMenu("mouseleave", ev, wrapper);
827
+ });
828
+ }
829
+ v.target.style.visibility = "";
830
+ v.target.remove();
831
+ overflowItemLength.value -= 1;
832
+ }
833
+ }
834
+ });
835
+ }, {
836
+ root,
837
+ threshold: 1,
838
+ rootMargin: "8px"
839
+ });
840
+ for (let i = 0; i < children.length; i++) {
841
+ ob.observe(children[i]);
842
+ }
843
+ }
844
+ });
845
+ return () => {
846
+ var _a, _b;
847
+ return createVNode("ul", {
848
+ "ref": menuRoot,
849
+ "class": rootClassName.value,
850
+ "style": [props["collapsed"] ? `width:${props["collapsedIndent"] * 2}px` : `width: ${props["width"]}`, "white-space: nowrap"]
851
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a), withDirectives(createVNode(SubMenu, {
852
+ "ref": overflow_container,
853
+ "key": "overflowContainer",
854
+ "title": "...",
855
+ "class": `${ns2.b()}-overflow-container`
856
+ }, null), [[vShow, overflowItemLength.value > 0 && mode.value === "horizontal"]])]);
857
+ };
858
+ }
859
+ });
860
+ var index = {
861
+ title: "Menu \u83DC\u5355",
862
+ category: "\u5E03\u5C40",
863
+ status: "100%",
864
+ install(app) {
865
+ app.component(Menu.name, Menu);
866
+ app.component(MenuItem.name, MenuItem);
867
+ app.component(SubMenu.name, SubMenu);
868
+ }
869
+ };
870
+ export { Menu, MenuItem, SubMenu, index as default };