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

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
package/modal/index.es.js CHANGED
@@ -1,998 +1,733 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __publicField = (obj, key, value) => {
33
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
- return value;
35
- };
36
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, getCurrentInstance, nextTick, toRef, onBeforeUnmount, isRef, h, render, readonly, Fragment, mergeProps } from "vue";
1
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, nextTick, unref, onMounted, Teleport, h, render } from "vue";
2
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
37
3
  const modalProps = {
38
- width: {
39
- type: String,
40
- default: "300px"
41
- },
42
- maxHeight: {
43
- type: String
44
- },
45
- zIndex: {
46
- type: Number,
47
- default: 1050
48
- },
49
- backdropZIndex: {
50
- type: Number,
51
- default: 1049
4
+ modelValue: {
5
+ type: Boolean,
6
+ default: false
52
7
  },
53
- placement: {
8
+ title: {
54
9
  type: String,
55
- default: "center"
10
+ default: ""
56
11
  },
57
- offsetX: {
58
- type: String,
59
- default: "0px"
12
+ lockScroll: {
13
+ type: Boolean,
14
+ default: true
60
15
  },
61
- offsetY: {
62
- type: String,
63
- default: "0px"
16
+ closeOnClickOverlay: {
17
+ type: Boolean,
18
+ default: true
64
19
  },
65
- showAnimation: {
20
+ beforeClose: {
21
+ type: Function
22
+ },
23
+ escapable: {
66
24
  type: Boolean,
67
25
  default: true
68
26
  },
69
- backdropCloseable: {
27
+ showClose: {
70
28
  type: Boolean,
71
- default: false
29
+ default: true
72
30
  },
73
- bodyScrollable: {
31
+ showOverlay: {
74
32
  type: Boolean,
75
33
  default: true
76
34
  },
77
- escapeable: {
35
+ appendToBody: {
78
36
  type: Boolean,
79
37
  default: true
38
+ }
39
+ };
40
+ const DEFAULT_PREFIX = "icon";
41
+ const iconProps = {
42
+ name: {
43
+ type: String,
44
+ default: "",
45
+ required: true
80
46
  },
81
- onClose: {
82
- type: Function
47
+ size: {
48
+ type: [Number, String],
49
+ default: "inherit"
83
50
  },
84
- beforeHidden: {
85
- type: [Object, Function]
51
+ color: {
52
+ type: String,
53
+ default: "inherit"
86
54
  },
87
- modelValue: {
88
- type: Boolean
55
+ component: {
56
+ type: Object,
57
+ default: null
89
58
  },
90
- "onUpdate:modelValue": {
91
- type: Function
92
- }
93
- };
94
- var overlay = "";
95
- function _isSlot$1(s) {
96
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
97
- }
98
- const CommonOverlay = defineComponent({
99
- setup(props, ctx) {
100
- return () => {
101
- let _slot;
102
- return createVNode(Teleport, {
103
- "to": "#d-overlay-anchor"
104
- }, {
105
- default: () => [createVNode(Transition, {
106
- "name": "devui-overlay-fade"
107
- }, _isSlot$1(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
108
- default: () => [_slot]
109
- })]
110
- });
111
- };
112
- }
113
- });
114
- const overlayProps = {
115
- visible: {
116
- type: Boolean
59
+ classPrefix: {
60
+ type: String,
61
+ default: DEFAULT_PREFIX
117
62
  },
118
- "onUpdate:visible": {
119
- type: Function
63
+ operable: {
64
+ type: Boolean,
65
+ default: false
120
66
  },
121
- backgroundBlock: {
67
+ disabled: {
122
68
  type: Boolean,
123
69
  default: false
124
70
  },
125
- backgroundClass: {
71
+ rotate: {
72
+ type: [Number, String]
73
+ }
74
+ };
75
+ const svgIconProps = {
76
+ name: {
126
77
  type: String,
127
- default: ""
78
+ default: "",
79
+ required: true
128
80
  },
129
- backgroundStyle: {
130
- type: [String, Object]
131
- },
132
- backdropClick: {
133
- type: Function
81
+ color: {
82
+ type: String,
83
+ default: "inherit"
134
84
  },
135
- backdropClose: {
136
- type: Boolean,
137
- default: true
85
+ size: {
86
+ type: [Number, String],
87
+ default: "inherit"
138
88
  }
139
89
  };
140
- function useOverlayLogic(props) {
141
- const backgroundClass = computed(() => {
142
- return ["devui-overlay-background", "devui-overlay-background__color", props.backgroundClass];
143
- });
144
- const overlayClass = computed(() => {
145
- return "devui-overlay";
146
- });
147
- const handleBackdropClick = (event) => {
148
- var _a, _b;
149
- event.preventDefault();
150
- (_a = props.backdropClick) == null ? void 0 : _a.call(props);
151
- if (props.backdropClose) {
152
- (_b = props["onUpdate:visible"]) == null ? void 0 : _b.call(props, false);
153
- }
154
- };
155
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
156
- onMounted(() => {
157
- const body = document.body;
158
- const originOverflow = body.style.overflow;
159
- const originPosition = body.style.position;
160
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
161
- if (backgroundBlock) {
162
- const top = body.getBoundingClientRect().y;
163
- if (visible) {
164
- body.style.overflowY = "scroll";
165
- body.style.position = visible ? "fixed" : "";
166
- body.style.top = `${top}px`;
167
- } else {
168
- body.style.overflowY = originOverflow;
169
- body.style.position = originPosition;
170
- body.style.top = "";
171
- window.scrollTo(0, -top);
172
- }
173
- }
174
- });
175
- onUnmounted(() => {
176
- document.body.style.overflow = originOverflow;
177
- });
178
- });
90
+ function createBem(namespace, element, modifier) {
91
+ let cls = namespace;
92
+ if (element) {
93
+ cls += `__${element}`;
94
+ }
95
+ if (modifier) {
96
+ cls += `--${modifier}`;
97
+ }
98
+ return cls;
99
+ }
100
+ function useNamespace(block, needDot = false) {
101
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
102
+ const b = () => createBem(namespace);
103
+ const e = (element) => element ? createBem(namespace, element) : "";
104
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
105
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
179
106
  return {
180
- backgroundClass,
181
- overlayClass,
182
- handleBackdropClick,
183
- handleOverlayBubbleCancel
107
+ b,
108
+ e,
109
+ m,
110
+ em
184
111
  };
185
112
  }
186
- const FixedOverlay = defineComponent({
187
- name: "DFixedOverlay",
188
- props: __spreadProps(__spreadValues({}, overlayProps), {
189
- overlayStyle: {
190
- type: Object,
191
- default: void 0
192
- }
193
- }),
194
- setup(props, ctx) {
113
+ var icon = "";
114
+ var svgIcon = defineComponent({
115
+ name: "DSvgIcon",
116
+ props: svgIconProps,
117
+ setup(props) {
195
118
  const {
196
- backgroundClass,
197
- overlayClass,
198
- handleBackdropClick,
199
- handleOverlayBubbleCancel
200
- } = useOverlayLogic(props);
201
- return () => createVNode(CommonOverlay, null, {
202
- default: () => [withDirectives(createVNode("div", {
203
- "class": backgroundClass.value,
204
- "style": props.backgroundStyle,
205
- "onClick": handleBackdropClick
206
- }, [createVNode("div", {
207
- "class": overlayClass.value,
208
- "style": props.overlayStyle,
209
- "onClick": handleOverlayBubbleCancel
210
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
119
+ name,
120
+ color,
121
+ size
122
+ } = toRefs(props);
123
+ const ns = useNamespace("svg-icon");
124
+ const iconName = computed(() => `#icon-${name.value}`);
125
+ const iconSize = computed(() => {
126
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
211
127
  });
128
+ const styles = {
129
+ width: iconSize.value,
130
+ height: iconSize.value
131
+ };
132
+ return () => {
133
+ return createVNode("svg", {
134
+ "class": ns.b(),
135
+ "style": styles
136
+ }, [createVNode("use", {
137
+ "xlink:href": iconName.value,
138
+ "fill": color.value
139
+ }, null)]);
140
+ };
212
141
  }
213
142
  });
214
- const FlexibleOverlay = defineComponent({
215
- name: "DFlexibleOverlay",
216
- props: __spreadValues({
217
- origin: {
218
- type: Object,
219
- require: true
220
- },
221
- position: {
222
- type: Object,
223
- default: () => ({
224
- originX: "left",
225
- originY: "top",
226
- overlayX: "left",
227
- overlayY: "top"
228
- })
229
- }
230
- }, overlayProps),
231
- emits: ["onUpdate:visible"],
232
- setup(props, ctx) {
233
- const overlayRef = ref(null);
234
- const positionedStyle = reactive({
235
- position: "absolute"
236
- });
237
- const instance = getCurrentInstance();
238
- onMounted(async () => {
239
- await nextTick();
240
- const overlay2 = overlayRef.value;
241
- if (!overlay2) {
242
- return;
143
+ function isUrl(value) {
144
+ return /^((http|https):)?\/\//.test(value);
145
+ }
146
+ function useIconDom(props, ctx) {
147
+ const {
148
+ component,
149
+ name,
150
+ size,
151
+ color,
152
+ classPrefix,
153
+ rotate
154
+ } = toRefs(props);
155
+ const ns = useNamespace("icon");
156
+ const iconSize = computed(() => {
157
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
158
+ });
159
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
160
+ const imgIconDom = () => {
161
+ return createVNode("img", mergeProps({
162
+ "src": name.value,
163
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
164
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
165
+ "style": {
166
+ width: iconSize.value || "",
167
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
168
+ verticalAlign: "middle"
243
169
  }
244
- const origin = getOrigin(props.origin);
245
- if (!origin) {
246
- return;
170
+ }, ctx.attrs), null);
171
+ };
172
+ const svgIconDom = () => {
173
+ return createVNode(IconComponent, mergeProps({
174
+ "name": name.value,
175
+ "color": color.value,
176
+ "size": iconSize.value,
177
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
178
+ "style": {
179
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
247
180
  }
248
- const handleRectChange = (rect) => {
249
- const point = calculatePosition(props.position, rect, origin);
250
- positionedStyle.left = `${point.x}px`;
251
- positionedStyle.top = `${point.y}px`;
252
- };
253
- const handleChange = () => handleRectChange(overlay2.getBoundingClientRect());
254
- watch(toRef(props, "visible"), (visible, ov, onInvalidate) => {
255
- if (visible) {
256
- subscribeLayoutEvent(handleChange);
257
- } else {
258
- unsbscribeLayoutEvent(handleChange);
259
- }
260
- onInvalidate(() => {
261
- unsbscribeLayoutEvent(handleChange);
262
- });
263
- });
264
- watch(toRef(props, "position"), () => {
265
- handleChange();
266
- });
267
- const resizeObserver = new ResizeObserver((entries) => {
268
- handleRectChange(entries[0].contentRect);
269
- });
270
- resizeObserver.observe(overlay2);
271
- onBeforeUnmount(() => {
272
- resizeObserver.disconnect();
273
- }, instance);
274
- if (origin instanceof Element) {
275
- const observer = new MutationObserver(handleChange);
276
- observer.observe(origin, {
277
- attributeFilter: ["style"]
278
- });
279
- onBeforeUnmount(() => {
280
- observer.disconnect();
281
- }, instance);
181
+ }, ctx.attrs), null);
182
+ };
183
+ const fontIconDom = () => {
184
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
185
+ return createVNode("i", mergeProps({
186
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
187
+ "style": {
188
+ fontSize: iconSize.value,
189
+ color: color.value,
190
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
282
191
  }
283
- }, instance);
284
- const {
285
- backgroundClass,
286
- overlayClass,
287
- handleBackdropClick,
288
- handleOverlayBubbleCancel
289
- } = useOverlayLogic(props);
290
- return () => createVNode(CommonOverlay, null, {
291
- default: () => [withDirectives(createVNode("div", {
292
- "class": backgroundClass.value,
293
- "onClick": handleBackdropClick
294
- }, [createVNode("div", {
295
- "ref": overlayRef,
296
- "class": overlayClass.value,
297
- "style": positionedStyle,
298
- "onClick": handleOverlayBubbleCancel
299
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
300
- });
301
- }
302
- });
303
- function getElement(element) {
304
- if (element instanceof Element) {
305
- return element;
306
- }
307
- if (element && typeof element === "object" && element.$el instanceof Element) {
308
- return element.$el;
309
- }
310
- return null;
311
- }
312
- function getOrigin(origin) {
313
- if (origin instanceof Element) {
314
- return origin;
315
- }
316
- if (isRef(origin)) {
317
- return getElement(origin.value);
318
- }
319
- return origin;
320
- }
321
- function calculatePosition(position, panelOrRect, origin) {
322
- const originRect = getOriginRect(origin);
323
- const originPoint = getOriginRelativePoint(originRect, position);
324
- let rect;
325
- if (panelOrRect instanceof HTMLElement) {
326
- rect = panelOrRect.getBoundingClientRect();
327
- } else {
328
- rect = panelOrRect;
329
- }
330
- return getOverlayPoint(originPoint, rect, position);
331
- }
332
- function getOriginRect(origin) {
333
- if (origin instanceof Element) {
334
- return origin.getBoundingClientRect();
335
- }
336
- const width = origin.width || 0;
337
- const height = origin.height || 0;
338
- return {
339
- top: origin.y,
340
- bottom: origin.y + height,
341
- left: origin.x,
342
- right: origin.x + width,
343
- height,
344
- width
192
+ }, ctx.attrs), null);
345
193
  };
346
- }
347
- function getOverlayPoint(originPoint, rect, position) {
348
- let x;
349
- const {
350
- width,
351
- height
352
- } = rect;
353
- if (position.overlayX == "center") {
354
- x = originPoint.x - width / 2;
355
- } else {
356
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
357
- }
358
- let y;
359
- if (position.overlayY == "center") {
360
- y = originPoint.y - height / 2;
361
- } else {
362
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
363
- }
364
- return {
365
- x,
366
- y
194
+ const iconDom = () => {
195
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
367
196
  };
368
- }
369
- function getOriginRelativePoint(originRect, position) {
370
- let x;
371
- if (position.originX == "center") {
372
- x = originRect.left + originRect.width / 2;
373
- } else {
374
- const startX = originRect.left;
375
- const endX = originRect.right;
376
- x = position.originX == "left" ? startX : endX;
377
- }
378
- let y;
379
- if (position.originY == "center") {
380
- y = originRect.top + originRect.height / 2;
381
- } else {
382
- y = position.originY == "top" ? originRect.top : originRect.bottom;
383
- }
384
197
  return {
385
- x,
386
- y
198
+ iconDom
387
199
  };
388
200
  }
389
- function subscribeLayoutEvent(event) {
390
- window.addEventListener("scroll", event, true);
391
- window.addEventListener("resize", event);
392
- window.addEventListener("orientationchange", event);
393
- }
394
- function unsbscribeLayoutEvent(event) {
395
- window.removeEventListener("scroll", event, true);
396
- window.removeEventListener("resize", event);
397
- window.removeEventListener("orientationchange", event);
398
- }
399
- const inBrowser = typeof window !== "undefined";
400
- FlexibleOverlay.install = function(app) {
401
- app.component(FlexibleOverlay.name, FlexibleOverlay);
402
- };
403
- FixedOverlay.install = function(app) {
404
- app.component(FixedOverlay.name, FixedOverlay);
405
- };
406
- var modal = "";
407
- var Modal = defineComponent({
408
- name: "DModal",
409
- props: modalProps,
410
- emits: ["onUpdate:modelValue"],
201
+ var Icon = defineComponent({
202
+ name: "DIcon",
203
+ props: iconProps,
204
+ emits: ["click"],
411
205
  setup(props, ctx) {
412
- const animatedVisible = computed(() => {
413
- return props.showAnimation ? props.modelValue : true;
414
- });
415
- const onVisibleChange = (value) => {
416
- var _a;
417
- const update = props["onUpdate:modelValue"];
418
- if (value) {
419
- update == null ? void 0 : update(value);
420
- } else {
421
- const beforeHidden = props.beforeHidden;
422
- const close = (enabledClose) => {
423
- var _a2;
424
- if (enabledClose) {
425
- update == null ? void 0 : update(false);
426
- (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
427
- }
428
- };
429
- const result = (_a = typeof beforeHidden === "function" ? beforeHidden() : beforeHidden) != null ? _a : true;
430
- if (result instanceof Promise) {
431
- result.then(close);
432
- } else {
433
- close(result);
434
- }
206
+ const {
207
+ disabled,
208
+ operable
209
+ } = toRefs(props);
210
+ const {
211
+ iconDom
212
+ } = useIconDom(props, ctx);
213
+ const ns = useNamespace("icon");
214
+ const wrapClassed = computed(() => ({
215
+ [ns.e("container")]: true,
216
+ [ns.m("disabled")]: disabled.value,
217
+ [ns.m("operable")]: operable.value
218
+ }));
219
+ const onClick = (e) => {
220
+ if (disabled.value) {
221
+ return;
435
222
  }
223
+ ctx.emit("click", e);
224
+ };
225
+ return () => {
226
+ var _a, _b, _c, _d;
227
+ return createVNode("div", {
228
+ "class": wrapClassed.value,
229
+ "onClick": onClick
230
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
436
231
  };
437
- ctx.expose({
438
- onVisibleChange
439
- });
440
- return () => createVNode(FixedOverlay, {
441
- "visible": props.modelValue,
442
- "onUpdate:visible": onVisibleChange,
443
- "backgroundClass": "devui-modal-wrapper",
444
- "backgroundBlock": !props.bodyScrollable,
445
- "backdropClose": props.backdropCloseable
446
- }, {
447
- default: () => [createVNode(Transition, {
448
- "name": "devui-modal-wipe"
449
- }, {
450
- default: () => {
451
- var _a, _b;
452
- return [animatedVisible.value ? (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a) : null];
453
- }
454
- })]
455
- });
456
232
  }
457
233
  });
458
- class CommonModalService {
459
- constructor(anchorContainer) {
460
- this.anchorContainer = anchorContainer;
461
- }
462
- renderModal(anchor, props, children) {
463
- const vnode = h(this.component(), props, children);
464
- render(vnode, anchor);
465
- return vnode;
466
- }
467
- renderNull(anchor) {
468
- setTimeout(() => {
469
- render(null, anchor);
470
- }, 500);
471
- }
472
- }
473
- class ModalService extends CommonModalService {
474
- component() {
475
- return Modal;
476
- }
477
- open(props = {}) {
478
- const anchor = document.createElement("div");
479
- this.anchorContainer.appendChild(anchor);
480
- const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
481
- const needHideOrNot = (value) => {
482
- if (!value) {
483
- hide();
484
- }
485
- };
486
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
487
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
488
- modelValue: true,
489
- "onUpdate:modelValue": onUpdateModelValue
490
- }), { default: content });
491
- };
492
- const hide = () => {
493
- var _a2, _b;
494
- const vnode = renderOrigin(resProps, (value) => {
495
- if (!value) {
496
- this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
497
- this.renderNull(anchor);
498
- } else {
499
- renderOrigin(resProps);
500
- }
501
- });
502
- (_b = (_a2 = vnode.component.exposed).onVisibleChange) == null ? void 0 : _b.call(_a2, false);
234
+ var iconGroup = "";
235
+ defineComponent({
236
+ name: "DIconGroup",
237
+ setup(_, ctx) {
238
+ const ns = useNamespace("icon-group");
239
+ return () => {
240
+ var _a, _b;
241
+ return createVNode("div", {
242
+ "class": ns.b()
243
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
503
244
  };
504
- this.renderModal(anchor, { modelValue: false });
505
- renderOrigin(resProps);
506
- return { hide };
507
245
  }
508
- }
509
- __publicField(ModalService, "token", "MODAL_SERVICE_TOKEN");
510
- const dialogProps = {
511
- width: {
512
- type: String,
513
- default: "300px"
514
- },
515
- maxHeight: {
516
- type: String
517
- },
518
- zIndex: {
519
- type: Number,
520
- default: 1050
521
- },
522
- backdropZIndex: {
523
- type: Number,
524
- default: 1049
525
- },
526
- placement: {
527
- type: String,
528
- default: "center"
529
- },
530
- offsetX: {
531
- type: String,
532
- default: "0px"
533
- },
534
- offsetY: {
535
- type: String,
536
- default: "0px"
537
- },
538
- title: {
539
- type: String
540
- },
541
- showAnimation: {
542
- type: Boolean,
543
- default: true
544
- },
545
- backdropCloseable: {
246
+ });
247
+ const fixedOverlayProps = {
248
+ modelValue: {
546
249
  type: Boolean,
547
250
  default: false
548
251
  },
549
- bodyScrollable: {
252
+ lockScroll: {
550
253
  type: Boolean,
551
254
  default: true
552
255
  },
553
- escapeable: {
256
+ closeOnClickOverlay: {
554
257
  type: Boolean,
555
258
  default: true
556
- },
557
- onClose: {
558
- type: Function
559
- },
560
- beforeHidden: {
561
- type: [Promise, Function]
562
- },
563
- buttons: {
564
- type: Array,
565
- default: []
566
- },
567
- dialogType: {
568
- type: String,
569
- default: "standard"
570
- },
571
- modelValue: {
572
- type: Boolean
573
- },
574
- "onUpdate:modelValue": {
575
- type: Function
576
259
  }
577
260
  };
578
- const useMoveable = (moveable = true) => {
579
- const movingX = ref(0);
580
- const movingY = ref(0);
581
- const reset = () => {
582
- movingX.value = 0;
583
- movingY.value = 0;
584
- };
585
- const handleRef = ref();
586
- const moveElRef = ref();
587
- const enabledMoving = isRef(moveable) ? moveable : ref(moveable);
588
- watch([moveElRef, handleRef], ([container, target], ov, onInvalidate) => {
589
- if (!(target instanceof HTMLElement && container instanceof HTMLElement)) {
590
- return;
591
- }
592
- target.style.cursor = "all-scroll";
593
- let startX = 0;
594
- let startY = 0;
595
- let prevMovingX = 0;
596
- let prevMovingY = 0;
597
- let containerRect = container.getBoundingClientRect();
598
- let bodyRect = document.body.getBoundingClientRect();
599
- let isDown = false;
600
- const handleMouseDown = (event) => {
601
- event.preventDefault();
602
- if (!enabledMoving.value) {
603
- return;
604
- }
605
- startX = event.clientX;
606
- startY = event.clientY;
607
- const targetRect = target.getBoundingClientRect();
608
- if ((target === event.target || target.contains(event.target)) && targetRect.x < startX && targetRect.y < startY && targetRect.width + targetRect.x >= startX && targetRect.height + targetRect.y >= startY) {
609
- isDown = true;
610
- prevMovingX = movingX.value;
611
- prevMovingY = movingY.value;
612
- bodyRect = document.body.getBoundingClientRect();
613
- containerRect = container.getBoundingClientRect();
614
- }
615
- };
616
- const handleMouseMove = (event) => {
617
- event.preventDefault();
618
- if (!isDown) {
619
- return;
620
- }
621
- const currentX = prevMovingX + event.clientX - startX;
622
- const currentY = prevMovingY + event.clientY - startY;
623
- const containerOriginX = containerRect.x - prevMovingX;
624
- const containerOriginY = containerRect.y - prevMovingY;
625
- movingX.value = getRangeValueOf(currentX, -containerOriginX, bodyRect.width - containerRect.width - containerOriginX);
626
- movingY.value = getRangeValueOf(currentY, -containerOriginY, bodyRect.height - containerRect.height - containerOriginY);
627
- };
628
- const handleMouseUp = (event) => {
629
- event.preventDefault();
630
- if (!isDown) {
631
- return;
261
+ function lockScroll() {
262
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
263
+ const scrollTop = document.documentElement.scrollTop;
264
+ const style = document.documentElement.getAttribute("style");
265
+ document.documentElement.style.position = "fixed";
266
+ document.documentElement.style.top = `-${scrollTop}px`;
267
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
268
+ document.documentElement.style.overflowY = "scroll";
269
+ return () => {
270
+ if (style) {
271
+ document.documentElement.setAttribute("style", style);
272
+ } else {
273
+ document.documentElement.removeAttribute("style");
632
274
  }
633
- isDown = false;
275
+ document.documentElement.scrollTop = scrollTop;
634
276
  };
635
- window.addEventListener("mousedown", handleMouseDown);
636
- window.addEventListener("mousemove", handleMouseMove);
637
- window.addEventListener("mouseup", handleMouseUp);
638
- onInvalidate(() => {
639
- window.removeEventListener("mousedown", handleMouseDown);
640
- window.removeEventListener("mousemove", handleMouseMove);
641
- window.removeEventListener("mouseup", handleMouseUp);
642
- });
643
- });
644
- return {
645
- movingX: readonly(movingX),
646
- movingY: readonly(movingY),
647
- handleRef,
648
- moveElRef,
649
- reset
650
- };
651
- };
652
- const getRangeValueOf = (value, min, max) => {
653
- if (value < min) {
654
- return min;
655
- }
656
- if (value > max) {
657
- return max;
658
277
  }
659
- return value;
660
- };
661
- var Icon = defineComponent({
662
- name: "DIcon",
663
- props: {
664
- name: {
665
- type: String,
666
- required: true
667
- },
668
- size: {
669
- type: String,
670
- default: "inherit"
671
- },
672
- color: {
673
- type: String,
674
- default: "inherit"
675
- },
676
- classPrefix: {
677
- type: String,
678
- default: "icon"
278
+ return;
279
+ }
280
+ function useFixedOverlay(props, ctx) {
281
+ let lockScrollCb;
282
+ const onClick = (event) => {
283
+ event.preventDefault();
284
+ ctx.emit("click", event);
285
+ if (props.closeOnClickOverlay) {
286
+ ctx.emit("update:modelValue", false);
679
287
  }
680
- },
681
- setup(props) {
682
- return __spreadValues({}, props);
683
- },
684
- render() {
288
+ };
289
+ const removeBodyAdditions = () => {
290
+ lockScrollCb == null ? void 0 : lockScrollCb();
291
+ };
292
+ watch(() => props.modelValue, (val) => {
293
+ if (val) {
294
+ props.lockScroll && (lockScrollCb = lockScroll());
295
+ } else {
296
+ removeBodyAdditions();
297
+ }
298
+ });
299
+ onUnmounted(removeBodyAdditions);
300
+ return { onClick };
301
+ }
302
+ var fixedOverlay = "";
303
+ const FixedOverlay = defineComponent({
304
+ name: "DFixedOverlay",
305
+ inheritAttrs: false,
306
+ props: fixedOverlayProps,
307
+ emits: ["update:modelValue", "click"],
308
+ setup(props, ctx) {
685
309
  const {
686
- name,
687
- size,
688
- color,
689
- classPrefix
690
- } = this;
691
- return createVNode(Fragment, null, [/^((https?):)?\/\//.test(name) ? createVNode("img", {
692
- "src": name,
693
- "alt": name.split("/")[name.split("/").length - 1],
694
- "style": {
695
- width: size
696
- }
697
- }, null) : createVNode("i", {
698
- "class": `${classPrefix} ${classPrefix}-${name}`,
699
- "style": {
700
- fontSize: size,
701
- color
310
+ modelValue
311
+ } = toRefs(props);
312
+ const ns = useNamespace("fixed-overlay");
313
+ const {
314
+ onClick
315
+ } = useFixedOverlay(props, ctx);
316
+ return () => createVNode(Transition, {
317
+ "name": ns.m("fade")
318
+ }, {
319
+ default: () => {
320
+ var _a, _b;
321
+ return [modelValue.value && createVNode("div", mergeProps({
322
+ "class": ns.b()
323
+ }, ctx.attrs, {
324
+ "onClick": onClick
325
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
702
326
  }
703
- }, null)]);
327
+ });
704
328
  }
705
329
  });
706
- Icon.install = function(app) {
707
- app.component(Icon.name, Icon);
708
- };
709
- const buttonProps = {
710
- type: {
711
- type: String,
712
- default: "button"
713
- },
714
- btnStyle: {
715
- type: String,
716
- default: "primary"
330
+ const flexibleOverlayProps = {
331
+ modelValue: {
332
+ type: Boolean,
333
+ default: false
717
334
  },
718
- size: {
719
- type: String,
720
- default: "md"
335
+ origin: {
336
+ type: Object,
337
+ require: true
721
338
  },
722
339
  position: {
723
- type: String,
724
- default: "default"
725
- },
726
- bordered: {
727
- type: Boolean,
728
- default: false
340
+ type: Array,
341
+ default: ["bottom"]
729
342
  },
730
- icon: {
731
- type: String,
732
- default: ""
343
+ offset: {
344
+ type: [Number, Object],
345
+ default: 8
733
346
  },
734
- showLoading: {
735
- type: Boolean,
736
- default: false
347
+ shiftOffset: {
348
+ type: Number
737
349
  },
738
- width: {
739
- type: String
350
+ align: {
351
+ type: String,
352
+ default: null
740
353
  },
741
- disabled: {
354
+ showArrow: {
742
355
  type: Boolean,
743
356
  default: false
744
357
  },
745
- autofocus: {
358
+ isArrowCenter: {
746
359
  type: Boolean,
747
- default: false
748
- },
749
- onClick: {
750
- type: Function
360
+ default: true
751
361
  }
752
362
  };
753
- var button = "";
754
- var Button = defineComponent({
755
- name: "DButton",
756
- props: buttonProps,
757
- setup(props, ctx) {
758
- const buttonContent = ref(null);
759
- const onClick = (e) => {
760
- var _a;
761
- if (props.showLoading) {
762
- return;
763
- }
764
- (_a = props.onClick) == null ? void 0 : _a.call(props, e);
765
- };
766
- const hasContent = computed(() => ctx.slots.default);
767
- const btnClass = computed(() => {
768
- const {
769
- btnStyle,
770
- size,
771
- position,
772
- bordered,
773
- icon
774
- } = props;
775
- const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
776
- const borderedClass = bordered ? "bordered" : "";
777
- const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
778
- const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
779
- return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
363
+ function getScrollParent(element) {
364
+ const overflowRegex = /(auto|scroll|hidden)/;
365
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
366
+ const style = window.getComputedStyle(parent);
367
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
368
+ return parent;
369
+ }
370
+ }
371
+ return window;
372
+ }
373
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
374
+ let { x, y } = point;
375
+ if (!isArrowCenter) {
376
+ const { width, height } = originRect;
377
+ if (x && placement.includes("start")) {
378
+ x = 12;
379
+ }
380
+ if (x && placement.includes("end")) {
381
+ x = Math.round(width - 24);
382
+ }
383
+ if (y && placement.includes("start")) {
384
+ y = 10;
385
+ }
386
+ if (y && placement.includes("end")) {
387
+ y = height - 14;
388
+ }
389
+ }
390
+ return { x, y };
391
+ }
392
+ function useOverlay(props, emit) {
393
+ const overlayRef = ref();
394
+ const arrowRef = ref();
395
+ let originParent = null;
396
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
397
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
398
+ const staticSide = {
399
+ top: "bottom",
400
+ right: "left",
401
+ bottom: "top",
402
+ left: "right"
403
+ }[placement.split("-")[0]];
404
+ Object.assign(arrowEl.style, {
405
+ left: x ? `${x}px` : "",
406
+ top: y ? `${y}px` : "",
407
+ right: "",
408
+ bottom: "",
409
+ [staticSide]: "-4px"
780
410
  });
781
- const iconClass = computed(() => {
782
- if (!props.icon) {
783
- return;
784
- }
785
- const origin = "devui-icon-fix icon";
786
- if (hasContent.value) {
787
- return `${origin} clear-right-5`;
788
- } else {
789
- return origin;
790
- }
411
+ };
412
+ const updatePosition = async () => {
413
+ const hostEl = props.origin;
414
+ const overlayEl = unref(overlayRef.value);
415
+ const arrowEl = unref(arrowRef.value);
416
+ const middleware = [
417
+ offset(props.offset),
418
+ autoPlacement({
419
+ alignment: props.align,
420
+ allowedPlacements: props.position
421
+ })
422
+ ];
423
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
424
+ props.shiftOffset !== void 0 && middleware.push(shift());
425
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
426
+ strategy: "fixed",
427
+ middleware
428
+ });
429
+ let applyX = x;
430
+ let applyY = y;
431
+ if (props.shiftOffset !== void 0) {
432
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
433
+ shiftX < 0 && (applyX -= props.shiftOffset);
434
+ shiftX > 0 && (applyX += props.shiftOffset);
435
+ shiftY < 0 && (applyY -= props.shiftOffset);
436
+ shiftY > 0 && (applyY += props.shiftOffset);
437
+ }
438
+ emit("positionChange", placement);
439
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
440
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
441
+ };
442
+ watch(() => props.modelValue, () => {
443
+ if (props.modelValue && props.origin) {
444
+ originParent = getScrollParent(props.origin);
445
+ nextTick(updatePosition);
446
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
447
+ originParent !== window && window.addEventListener("scroll", updatePosition);
448
+ window.addEventListener("resize", updatePosition);
449
+ } else {
450
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
451
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
452
+ window.removeEventListener("resize", updatePosition);
453
+ }
454
+ });
455
+ onUnmounted(() => {
456
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
457
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
458
+ window.removeEventListener("resize", updatePosition);
459
+ });
460
+ return { arrowRef, overlayRef, updatePosition };
461
+ }
462
+ var flexibleOverlay = "";
463
+ defineComponent({
464
+ name: "DFlexibleOverlay",
465
+ inheritAttrs: false,
466
+ props: flexibleOverlayProps,
467
+ emits: ["update:modelValue", "positionChange"],
468
+ setup(props, {
469
+ slots,
470
+ attrs,
471
+ emit,
472
+ expose
473
+ }) {
474
+ const ns = useNamespace("flexible-overlay");
475
+ const {
476
+ arrowRef,
477
+ overlayRef,
478
+ updatePosition
479
+ } = useOverlay(props, emit);
480
+ expose({
481
+ updatePosition
791
482
  });
792
483
  return () => {
793
- var _a, _b;
794
- const {
795
- icon,
796
- type,
797
- disabled,
798
- showLoading,
799
- width
800
- } = props;
801
- return createVNode("div", mergeProps({
802
- "class": "devui-btn-host"
803
- }, ctx.attrs), [createVNode("button", {
804
- "class": btnClass.value,
805
- "type": type,
806
- "disabled": disabled,
807
- "style": {
808
- width
809
- },
810
- "onClick": onClick
811
- }, [!!icon ? createVNode(Icon, {
812
- "name": props.icon,
813
- "class": iconClass.value
814
- }, null) : null, createVNode("span", {
815
- "class": "button-content",
816
- "ref": buttonContent
817
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]);
484
+ var _a;
485
+ return props.modelValue && createVNode("div", mergeProps({
486
+ "ref": overlayRef,
487
+ "class": ns.b()
488
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
489
+ "ref": arrowRef,
490
+ "class": ns.e("arrow")
491
+ }, null)]);
818
492
  };
819
493
  }
820
494
  });
821
- Button.install = function(app) {
822
- app.component(Button.name, Button);
823
- };
824
- function _isSlot(s) {
825
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
495
+ const inBrowser = typeof window !== "undefined";
496
+ function useModal(props, emit) {
497
+ function close() {
498
+ emit("update:modelValue", false);
499
+ }
500
+ function execClose() {
501
+ props.beforeClose ? props.beforeClose(close) : close();
502
+ }
503
+ function onOverlayClick() {
504
+ props.closeOnClickOverlay && execClose();
505
+ }
506
+ function onCloseBtnClick() {
507
+ execClose();
508
+ }
509
+ function onKeydown(event) {
510
+ if (event["keyCode"] === 27) {
511
+ execClose();
512
+ }
513
+ }
514
+ onMounted(() => {
515
+ if (props.escapable) {
516
+ window.addEventListener("keydown", onKeydown);
517
+ }
518
+ });
519
+ onUnmounted(() => {
520
+ if (props.escapable) {
521
+ window.addEventListener("keydown", onKeydown);
522
+ }
523
+ });
524
+ return { onCloseBtnClick, onOverlayClick };
525
+ }
526
+ function useModalRender(props) {
527
+ const showContainer = ref(false);
528
+ const showModal = ref(false);
529
+ let lockScrollCb;
530
+ const removeBodyAdditions = () => {
531
+ lockScrollCb == null ? void 0 : lockScrollCb();
532
+ };
533
+ watch(() => props.modelValue, (val) => {
534
+ if (val) {
535
+ props.lockScroll && (lockScrollCb = lockScroll());
536
+ showContainer.value = true;
537
+ nextTick(() => {
538
+ showModal.value = true;
539
+ });
540
+ } else {
541
+ removeBodyAdditions();
542
+ showModal.value = false;
543
+ setTimeout(() => {
544
+ showContainer.value = false;
545
+ }, 100);
546
+ }
547
+ }, {
548
+ immediate: true
549
+ });
550
+ onUnmounted(removeBodyAdditions);
551
+ return { showContainer, showModal };
826
552
  }
827
- var Dialog = defineComponent({
553
+ var Header = defineComponent({
554
+ name: "DModalHeader",
555
+ setup(props, {
556
+ slots
557
+ }) {
558
+ const ns = useNamespace("modal");
559
+ return () => {
560
+ var _a;
561
+ return createVNode("div", {
562
+ "class": ns.e("header")
563
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
564
+ };
565
+ }
566
+ });
567
+ var Body = defineComponent({
568
+ name: "DModalBody",
569
+ setup(props, {
570
+ slots
571
+ }) {
572
+ const ns = useNamespace("modal");
573
+ return () => {
574
+ var _a;
575
+ return createVNode("div", {
576
+ "class": ns.e("body")
577
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
578
+ };
579
+ }
580
+ });
581
+ var modal = "";
582
+ var Modal = defineComponent({
828
583
  name: "DModal",
829
584
  inheritAttrs: false,
830
- props: dialogProps,
831
- emits: ["onUpdate:modelValue"],
832
- setup(props, ctx) {
585
+ props: modalProps,
586
+ emits: ["update:modelValue"],
587
+ setup(props, {
588
+ slots,
589
+ attrs,
590
+ emit
591
+ }) {
592
+ const ns = useNamespace("modal");
833
593
  const {
834
- movingX,
835
- movingY,
836
- handleRef,
837
- moveElRef,
838
- reset
839
- } = useMoveable();
840
- watch(() => props.modelValue, (value) => {
841
- if (value) {
842
- reset();
843
- }
844
- });
845
- const movingStyle = computed(() => ({
846
- position: "relative",
847
- left: `${movingX.value}px`,
848
- top: `${movingY.value}px`
849
- }));
850
- const containerStyle = computed(() => ({
851
- width: props.width,
852
- maxHeight: props.maxHeight,
853
- transform: `translate(${props.offsetX}, ${props.offsetY})`,
854
- zIndex: props.zIndex
855
- }));
856
- const iconName = computed(() => {
857
- switch (props.dialogType) {
858
- case "standard":
859
- return "";
860
- case "info":
861
- return "icon-info-o";
862
- case "success":
863
- return "icon-right-o";
864
- case "warning":
865
- return "icon-warning-o";
866
- case "failed":
867
- return "icon-error-o";
868
- default:
869
- return "";
870
- }
871
- });
872
- const buttonsRef = computed(() => {
873
- return props.buttons.map((buttonProps2, index2) => {
874
- const {
875
- btnStyle,
876
- disabled,
877
- handler,
878
- text
879
- } = buttonProps2;
880
- return createVNode(Button, {
881
- "key": index2,
882
- "style": {
883
- display: "inline-block",
884
- margin: "0 5px"
885
- },
886
- "btnStyle": btnStyle,
887
- "disabled": disabled,
888
- "onClick": handler
889
- }, _isSlot(text) ? text : {
890
- default: () => [text]
891
- });
892
- });
893
- });
894
- const modalRef = ref();
895
- const closeModal = () => {
896
- var _a, _b;
897
- (_b = (_a = modalRef.value) == null ? void 0 : _a.onVisibleChange) == null ? void 0 : _b.call(_a, false);
898
- };
899
- ctx.expose({
900
- closeModal
901
- });
902
- return () => createVNode(Modal, {
903
- "ref": modalRef,
904
- "width": props.width,
905
- "maxHeight": props.maxHeight,
906
- "offsetX": props.offsetX,
907
- "offsetY": props.offsetY,
908
- "zIndex": props.zIndex,
909
- "backdropZIndex": props.backdropZIndex,
910
- "backdropCloseable": props.backdropCloseable,
911
- "bodyScrollable": props.bodyScrollable,
912
- "placement": props.placement,
913
- "onClose": props.onClose,
914
- "beforeHidden": props.beforeHidden,
915
- "modelValue": props.modelValue,
916
- "onUpdate:modelValue": props["onUpdate:modelValue"]
594
+ modelValue,
595
+ title,
596
+ showClose,
597
+ showOverlay,
598
+ appendToBody
599
+ } = toRefs(props);
600
+ const {
601
+ onCloseBtnClick,
602
+ onOverlayClick
603
+ } = useModal(props, emit);
604
+ const {
605
+ showContainer,
606
+ showModal
607
+ } = useModalRender(props);
608
+ return () => createVNode(Teleport, {
609
+ "to": "body",
610
+ "disabled": !appendToBody.value
917
611
  }, {
918
- default: () => {
919
- var _a, _b;
920
- return [createVNode("div", {
921
- "class": "devui-modal-content",
922
- "style": [containerStyle.value, movingStyle.value],
923
- "ref": moveElRef
924
- }, [createVNode("div", {
925
- "class": "devui-modal-header",
926
- "ref": handleRef
927
- }, [!!iconName.value ? createVNode(Icon, {
928
- "name": iconName.value,
929
- "size": "24px",
930
- "class": "header-alert-icon"
931
- }, null) : null, createVNode("span", null, [props.title]), createVNode(Button, {
932
- "class": "btn-close",
933
- "icon": "close",
934
- "btnStyle": "text-dark",
935
- "onClick": closeModal
936
- }, null)]), createVNode("div", {
937
- "class": "devui-modal-body"
938
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
939
- "class": "devui-modal-footer"
940
- }, [buttonsRef.value])])];
941
- }
612
+ default: () => [showOverlay.value && createVNode(FixedOverlay, {
613
+ "modelValue": modelValue.value,
614
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
615
+ "lock-scroll": false,
616
+ "style": {
617
+ zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
618
+ }
619
+ }, null), showContainer.value && createVNode("div", {
620
+ "class": ns.e("container"),
621
+ "onClick": onOverlayClick
622
+ }, [createVNode(Transition, {
623
+ "name": ns.m("wipe")
624
+ }, {
625
+ default: () => {
626
+ var _a;
627
+ return [showModal.value && createVNode("div", mergeProps({
628
+ "class": ns.b()
629
+ }, attrs, {
630
+ "onClick": (e) => e.stopPropagation()
631
+ }), [showClose.value && createVNode(Icon, {
632
+ "name": "close",
633
+ "class": "btn-close",
634
+ "size": "var(--devui-font-size-md,12px)",
635
+ "onClick": onCloseBtnClick
636
+ }, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
637
+ default: () => [title.value]
638
+ }), createVNode(Body, null, {
639
+ default: () => {
640
+ var _a2;
641
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
642
+ }
643
+ }), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
644
+ }
645
+ })])]
942
646
  });
943
647
  }
944
648
  });
945
- class DialogService extends CommonModalService {
649
+ var Footer = defineComponent({
650
+ name: "DModalFooter",
651
+ setup(props, {
652
+ slots
653
+ }) {
654
+ const ns = useNamespace("modal");
655
+ return () => {
656
+ var _a;
657
+ return createVNode("div", {
658
+ "class": ns.e("footer")
659
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
660
+ };
661
+ }
662
+ });
663
+ class CommonModalService {
664
+ constructor(anchorContainer) {
665
+ this.anchorContainer = anchorContainer;
666
+ }
667
+ renderModal(anchor, props, children) {
668
+ const vnode = h(this.component(), props, children);
669
+ render(vnode, anchor);
670
+ return vnode;
671
+ }
672
+ renderNull(anchor) {
673
+ setTimeout(() => {
674
+ render(null, anchor);
675
+ }, 500);
676
+ }
677
+ }
678
+ let vm;
679
+ class ModalService extends CommonModalService {
946
680
  component() {
947
- return Dialog;
681
+ return Modal;
948
682
  }
949
683
  open(props = {}) {
950
684
  const anchor = document.createElement("div");
951
685
  this.anchorContainer.appendChild(anchor);
952
- const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
953
- const needHideOrNot = (value) => {
954
- if (!value) {
955
- hide();
956
- }
957
- };
958
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
959
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
686
+ const { header, content, footer, ...resProps } = props;
687
+ const renderOrigin = (propsValue, onUpdateModelValue) => {
688
+ return this.renderModal(anchor, {
689
+ ...propsValue,
960
690
  modelValue: true,
961
691
  "onUpdate:modelValue": onUpdateModelValue
962
- }), { default: content });
692
+ }, { header, default: content, footer });
963
693
  };
964
694
  const hide = () => {
965
- var _a2, _b;
966
- const vnode = renderOrigin(resProps, (value) => {
695
+ var _a, _b, _c;
696
+ const innerNeedHideOrNot = (value) => {
697
+ if (!value) {
698
+ hide();
699
+ }
700
+ };
701
+ renderOrigin(resProps, (value) => {
967
702
  if (!value) {
968
- this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
703
+ this.renderModal(anchor, { ...resProps, modelValue: false });
969
704
  this.renderNull(anchor);
970
705
  } else {
971
- renderOrigin(resProps);
706
+ renderOrigin(resProps, innerNeedHideOrNot);
972
707
  }
973
708
  });
974
- (_b = (_a2 = vnode.component.exposed).closeModal) == null ? void 0 : _b.call(_a2);
709
+ (_c = (_b = (_a = vm == null ? void 0 : vm.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
975
710
  };
976
- const updateButtonOptions = (buttonOptions) => {
977
- const _a2 = resProps, { buttons } = _a2, innerResProps = __objRest(_a2, ["buttons"]);
978
- const newButtonOptions = buttons.map((option, index2) => __spreadValues(__spreadValues({}, option), buttonOptions[index2]));
979
- renderOrigin(__spreadProps(__spreadValues({}, innerResProps), { buttons: newButtonOptions }));
711
+ const needHideOrNot = (value) => {
712
+ if (!value) {
713
+ hide();
714
+ }
980
715
  };
981
716
  this.renderModal(anchor, { modelValue: false });
982
- renderOrigin(resProps);
983
- return { hide, updateButtonOptions };
717
+ vm = renderOrigin(resProps, needHideOrNot);
718
+ return { hide };
984
719
  }
985
720
  }
986
- __publicField(DialogService, "token", "DIALOG_SERVICE_TOKEN");
987
- Modal.install = function(app) {
988
- app.component(Modal.name, Modal);
989
- };
721
+ ModalService.token = "MODAL_SERVICE_TOKEN";
990
722
  var index = {
991
723
  title: "Modal \u5F39\u7A97",
992
724
  category: "\u53CD\u9988",
993
- status: "\u5DF2\u5B8C\u6210",
725
+ status: "100%",
994
726
  install(app) {
995
- app.use(Modal);
727
+ app.component(Modal.name, Modal);
728
+ app.component(Header.name, Header);
729
+ app.component(Body.name, Body);
730
+ app.component(Footer.name, Footer);
996
731
  if (!inBrowser) {
997
732
  return;
998
733
  }
@@ -1003,7 +738,6 @@ var index = {
1003
738
  document.body.appendChild(anchorsContainer);
1004
739
  }
1005
740
  app.provide(ModalService.token, new ModalService(anchorsContainer));
1006
- app.provide(DialogService.token, new DialogService(anchorsContainer));
1007
741
  }
1008
742
  };
1009
- export { Modal, index as default };
743
+ export { Modal, index as default, modalProps };