vue-devui 1.0.0-beta.18 → 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 (403) hide show
  1. package/README.md +94 -118
  2. package/alert/index.es.js +74 -45
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8349 -426
  6. package/auto-complete/index.umd.js +29 -1
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +153 -146
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +45 -20
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5743 -127
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +63 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8070 -255
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{accordion → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +213 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{back-top → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +60 -19
  29. package/countdown/index.umd.js +1 -1
  30. package/{anchor → date-picker-pro}/index.d.ts +0 -0
  31. package/date-picker-pro/index.es.js +12018 -0
  32. package/date-picker-pro/index.umd.js +27 -0
  33. package/date-picker-pro/package.json +7 -0
  34. package/date-picker-pro/style.css +1 -0
  35. package/drawer/index.es.js +184 -5736
  36. package/drawer/index.umd.js +1 -27
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +615 -396
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +786 -195
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +2360 -2094
  45. package/form/index.umd.js +17 -17
  46. package/form/style.css +1 -1
  47. package/fullscreen/index.es.js +137 -134
  48. package/fullscreen/index.umd.js +1 -1
  49. package/fullscreen/style.css +1 -1
  50. package/grid/index.es.js +101 -86
  51. package/grid/index.umd.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +199 -56
  54. package/icon/index.umd.js +1 -1
  55. package/icon/style.css +1 -0
  56. package/image-preview/index.es.js +55 -31
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8254 -144
  60. package/input/index.umd.js +27 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +270 -187
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/layout/index.es.js +40 -25
  66. package/layout/index.umd.js +1 -1
  67. package/layout/style.css +1 -1
  68. package/loading/index.es.js +74 -35
  69. package/loading/index.umd.js +1 -1
  70. package/loading/style.css +1 -1
  71. package/{back-top → mention}/index.d.ts +0 -0
  72. package/{color-picker → mention}/index.es.js +2983 -2861
  73. package/mention/index.umd.js +36 -0
  74. package/{anchor → mention}/package.json +1 -1
  75. package/mention/style.css +1 -0
  76. package/{breadcrumb → menu}/index.d.ts +0 -0
  77. package/menu/index.es.js +870 -0
  78. package/menu/index.umd.js +1 -0
  79. package/{toast → menu}/package.json +1 -1
  80. package/menu/style.css +1 -0
  81. package/{carousel → message}/index.d.ts +0 -0
  82. package/message/index.es.js +538 -0
  83. package/message/index.umd.js +1 -0
  84. package/{comment → message}/package.json +1 -1
  85. package/message/style.css +1 -0
  86. package/modal/index.es.js +598 -1025
  87. package/modal/index.umd.js +1 -1
  88. package/modal/style.css +1 -1
  89. package/{cascader → notification}/index.d.ts +0 -0
  90. package/notification/index.es.js +545 -0
  91. package/notification/index.umd.js +1 -0
  92. package/{accordion → notification}/package.json +1 -1
  93. package/notification/style.css +1 -0
  94. package/nuxt/components/ButtonGroup.js +3 -0
  95. package/nuxt/components/CheckboxButton.js +3 -0
  96. package/nuxt/components/CheckboxGroup.js +3 -0
  97. package/nuxt/components/Collapse.js +3 -0
  98. package/nuxt/components/CollapseItem.js +3 -0
  99. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  100. package/nuxt/components/DatePickerPro.js +3 -0
  101. package/nuxt/components/DropdownMenu.js +3 -0
  102. package/nuxt/components/DropdownPropsKey.js +3 -0
  103. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  104. package/nuxt/components/FORM_TOKEN.js +3 -0
  105. package/nuxt/components/IFileOptions.js +3 -0
  106. package/nuxt/components/IUploadOptions.js +3 -0
  107. package/nuxt/components/Icon.js +1 -0
  108. package/nuxt/components/IconGroup.js +3 -0
  109. package/nuxt/components/LABEL_DATA.js +3 -0
  110. package/nuxt/components/LoadingOptions.js +3 -0
  111. package/nuxt/components/Mention.js +3 -0
  112. package/nuxt/components/Menu.js +3 -0
  113. package/nuxt/components/MenuItem.js +3 -0
  114. package/nuxt/components/Message.js +3 -0
  115. package/nuxt/components/Notification.js +3 -0
  116. package/nuxt/components/NotificationService.js +3 -0
  117. package/nuxt/components/Option.js +3 -0
  118. package/nuxt/components/OptionGroup.js +3 -0
  119. package/nuxt/components/PanelBody.js +3 -0
  120. package/nuxt/components/PanelFooter.js +3 -0
  121. package/nuxt/components/PanelHeader.js +3 -0
  122. package/nuxt/components/RadioButton.js +3 -0
  123. package/nuxt/components/Step.js +3 -0
  124. package/nuxt/components/Steps.js +3 -0
  125. package/nuxt/components/SubMenu.js +3 -0
  126. package/nuxt/components/TABLE_TOKEN.js +3 -0
  127. package/nuxt/components/Tab.js +3 -0
  128. package/nuxt/components/TimeSelect.js +3 -0
  129. package/nuxt/components/Timeline.js +3 -0
  130. package/nuxt/components/TimelineItem.js +3 -0
  131. package/nuxt/components/UploadStatus.js +3 -0
  132. package/nuxt/components/alertProps.js +3 -0
  133. package/nuxt/components/animationInjectionKey.js +3 -0
  134. package/nuxt/components/autoCompleteProps.js +3 -0
  135. package/nuxt/components/avatarProps.js +3 -0
  136. package/nuxt/components/badgeProps.js +3 -0
  137. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  138. package/nuxt/components/buttonGroupProps.js +3 -0
  139. package/nuxt/components/cardProps.js +3 -0
  140. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  141. package/nuxt/components/checkboxGroupProps.js +3 -0
  142. package/nuxt/components/checkboxProps.js +3 -0
  143. package/nuxt/components/colProps.js +3 -0
  144. package/nuxt/components/colPropsBaseClass.js +3 -0
  145. package/nuxt/components/colPropsBaseStyle.js +3 -0
  146. package/nuxt/components/collapseItemProps.js +3 -0
  147. package/nuxt/components/collapseProps.js +3 -0
  148. package/nuxt/components/countdownProps.js +3 -0
  149. package/nuxt/components/datePickerProCommonProps.js +3 -0
  150. package/nuxt/components/datePickerProPanelProps.js +3 -0
  151. package/nuxt/components/datePickerProProps.js +3 -0
  152. package/nuxt/components/dropdownMenuProps.js +3 -0
  153. package/nuxt/components/editableSelectProps.js +3 -0
  154. package/nuxt/components/fixedOverlayProps.js +3 -0
  155. package/nuxt/components/flexibleOverlayProps.js +3 -0
  156. package/nuxt/components/formItemProps.js +3 -0
  157. package/nuxt/components/formProps.js +3 -0
  158. package/nuxt/components/fullscreenProps.js +3 -0
  159. package/nuxt/components/iconProps.js +3 -0
  160. package/nuxt/components/imagePreviewProps.js +3 -0
  161. package/nuxt/components/inputProps.js +3 -0
  162. package/nuxt/components/loadingProps.js +3 -0
  163. package/nuxt/components/mentionProps.js +3 -0
  164. package/nuxt/components/messageProps.js +3 -0
  165. package/nuxt/components/modalProps.js +3 -0
  166. package/nuxt/components/notificationProps.js +3 -0
  167. package/nuxt/components/paginationProps.js +3 -0
  168. package/nuxt/components/panelProps.js +3 -0
  169. package/nuxt/components/popoverProps.js +3 -0
  170. package/nuxt/components/progressProps.js +3 -0
  171. package/nuxt/components/rateProps.js +3 -0
  172. package/nuxt/components/resultProps.js +3 -0
  173. package/nuxt/components/roundInjectionKey.js +3 -0
  174. package/nuxt/components/rowProps.js +3 -0
  175. package/nuxt/components/screenSizes.js +3 -0
  176. package/nuxt/components/searchProps.js +3 -0
  177. package/nuxt/components/skeletonItemProps.js +3 -0
  178. package/nuxt/components/skeletonProps.js +3 -0
  179. package/nuxt/components/sliderProps.js +3 -0
  180. package/nuxt/components/splitterProps.js +3 -0
  181. package/nuxt/components/statisticProps.js +3 -0
  182. package/nuxt/components/stepProps.js +3 -0
  183. package/nuxt/components/stepsProps.js +3 -0
  184. package/nuxt/components/svgIconProps.js +3 -0
  185. package/nuxt/components/switchProps.js +3 -0
  186. package/nuxt/components/tableProps.js +3 -0
  187. package/nuxt/components/tabsProps.js +3 -0
  188. package/nuxt/components/tagProps.js +3 -0
  189. package/nuxt/components/textareaProps.js +3 -0
  190. package/nuxt/components/timeAxisProps.js +3 -0
  191. package/nuxt/components/timerPickerPanelProps.js +3 -0
  192. package/nuxt/components/tooltipProps.js +3 -0
  193. package/nuxt/components/treeNodeProps.js +3 -0
  194. package/nuxt/components/treeProps.js +3 -0
  195. package/nuxt/components/uploadProps.js +3 -0
  196. package/overlay/index.es.js +239 -314
  197. package/overlay/index.umd.js +1 -1
  198. package/overlay/style.css +1 -1
  199. package/package.json +44 -87
  200. package/pagination/index.es.js +331 -153
  201. package/pagination/index.umd.js +1 -1
  202. package/pagination/style.css +1 -1
  203. package/panel/index.es.js +45 -32
  204. package/panel/index.umd.js +1 -1
  205. package/panel/style.css +1 -1
  206. package/popover/index.es.js +6034 -215
  207. package/popover/index.umd.js +27 -1
  208. package/popover/style.css +1 -1
  209. package/progress/index.es.js +110 -56
  210. package/progress/index.umd.js +3 -3
  211. package/progress/style.css +1 -1
  212. package/radio/index.es.js +7974 -157
  213. package/radio/index.umd.js +27 -1
  214. package/radio/style.css +1 -1
  215. package/rate/index.es.js +77 -55
  216. package/rate/index.umd.js +1 -1
  217. package/rate/style.css +1 -1
  218. package/result/index.es.js +186 -57
  219. package/result/index.umd.js +1 -1
  220. package/result/style.css +1 -1
  221. package/ripple/index.es.js +47 -42
  222. package/ripple/index.umd.js +1 -1
  223. package/search/index.es.js +3868 -1149
  224. package/search/index.umd.js +18 -18
  225. package/search/style.css +1 -1
  226. package/select/index.es.js +9191 -493
  227. package/select/index.umd.js +27 -1
  228. package/select/style.css +1 -1
  229. package/skeleton/index.es.js +113 -265
  230. package/skeleton/index.umd.js +1 -1
  231. package/skeleton/style.css +1 -1
  232. package/slider/index.es.js +144 -137
  233. package/slider/index.umd.js +1 -1
  234. package/slider/style.css +1 -1
  235. package/splitter/index.es.js +6220 -226
  236. package/splitter/index.umd.js +27 -1
  237. package/splitter/style.css +1 -1
  238. package/statistic/index.es.js +41 -34
  239. package/statistic/index.umd.js +1 -1
  240. package/statistic/style.css +1 -1
  241. package/status/index.es.js +27 -6
  242. package/status/index.umd.js +1 -1
  243. package/status/style.css +1 -1
  244. package/{color-picker → steps}/index.d.ts +0 -0
  245. package/steps/index.es.js +386 -0
  246. package/steps/index.umd.js +1 -0
  247. package/{gantt → steps}/package.json +1 -1
  248. package/steps/style.css +1 -0
  249. package/style.css +1 -1
  250. package/switch/index.es.js +7804 -64
  251. package/switch/index.umd.js +27 -1
  252. package/switch/style.css +1 -1
  253. package/table/index.es.js +11010 -1367
  254. package/table/index.umd.js +27 -1
  255. package/table/style.css +1 -1
  256. package/tabs/index.es.js +356 -144
  257. package/tabs/index.umd.js +1 -1
  258. package/tabs/style.css +1 -1
  259. package/tag/index.es.js +49 -24
  260. package/tag/index.umd.js +1 -1
  261. package/tag/style.css +1 -1
  262. package/textarea/index.es.js +7924 -83
  263. package/textarea/index.umd.js +35 -1
  264. package/textarea/style.css +1 -1
  265. package/time-picker/index.es.js +8914 -602
  266. package/time-picker/index.umd.js +27 -1
  267. package/time-picker/style.css +1 -1
  268. package/{comment → time-select}/index.d.ts +0 -0
  269. package/{transfer → time-select}/index.es.js +4912 -2667
  270. package/time-select/index.umd.js +27 -0
  271. package/{breadcrumb → time-select}/package.json +1 -1
  272. package/time-select/style.css +1 -0
  273. package/{date-picker → timeline}/index.d.ts +0 -0
  274. package/timeline/index.es.js +427 -0
  275. package/timeline/index.umd.js +1 -0
  276. package/{carousel → timeline}/package.json +1 -1
  277. package/timeline/style.css +1 -0
  278. package/tooltip/index.es.js +5871 -96
  279. package/tooltip/index.umd.js +27 -1
  280. package/tooltip/style.css +1 -1
  281. package/tree/index.es.js +7556 -2491
  282. package/tree/index.umd.js +18 -18
  283. package/tree/style.css +1 -1
  284. package/upload/index.es.js +865 -6117
  285. package/upload/index.umd.js +1 -27
  286. package/upload/style.css +1 -1
  287. package/vue-devui.es.js +20283 -18856
  288. package/vue-devui.umd.js +30 -19
  289. package/accordion/index.es.js +0 -508
  290. package/accordion/index.umd.js +0 -1
  291. package/accordion/style.css +0 -1
  292. package/anchor/index.es.js +0 -263
  293. package/anchor/index.umd.js +0 -1
  294. package/anchor/style.css +0 -1
  295. package/back-top/index.es.js +0 -128
  296. package/back-top/index.umd.js +0 -1
  297. package/back-top/style.css +0 -1
  298. package/breadcrumb/index.es.js +0 -127
  299. package/breadcrumb/index.umd.js +0 -1
  300. package/breadcrumb/style.css +0 -1
  301. package/carousel/index.es.js +0 -329
  302. package/carousel/index.umd.js +0 -1
  303. package/carousel/style.css +0 -1
  304. package/cascader/index.es.js +0 -5963
  305. package/cascader/index.umd.js +0 -27
  306. package/cascader/package.json +0 -7
  307. package/cascader/style.css +0 -1
  308. package/color-picker/index.umd.js +0 -27
  309. package/color-picker/package.json +0 -7
  310. package/color-picker/style.css +0 -1
  311. package/comment/index.es.js +0 -86
  312. package/comment/index.umd.js +0 -1
  313. package/comment/style.css +0 -1
  314. package/date-picker/index.es.js +0 -1171
  315. package/date-picker/index.umd.js +0 -1
  316. package/date-picker/package.json +0 -7
  317. package/date-picker/style.css +0 -1
  318. package/dragdrop/index.d.ts +0 -7
  319. package/dragdrop/index.es.js +0 -157
  320. package/dragdrop/index.umd.js +0 -1
  321. package/dragdrop/package.json +0 -7
  322. package/gantt/index.d.ts +0 -7
  323. package/gantt/index.es.js +0 -523
  324. package/gantt/index.umd.js +0 -1
  325. package/gantt/style.css +0 -1
  326. package/input-icon/index.d.ts +0 -7
  327. package/input-icon/index.es.js +0 -331
  328. package/input-icon/index.umd.js +0 -1
  329. package/input-icon/package.json +0 -7
  330. package/input-icon/style.css +0 -1
  331. package/nav-sprite/index.d.ts +0 -7
  332. package/nav-sprite/index.es.js +0 -68
  333. package/nav-sprite/index.umd.js +0 -1
  334. package/nav-sprite/package.json +0 -7
  335. package/nuxt/components/Accordion.js +0 -3
  336. package/nuxt/components/Anchor.js +0 -3
  337. package/nuxt/components/BackTop.js +0 -3
  338. package/nuxt/components/Breadcrumb.js +0 -3
  339. package/nuxt/components/Carousel.js +0 -3
  340. package/nuxt/components/CarouselItem.js +0 -3
  341. package/nuxt/components/Cascader.js +0 -3
  342. package/nuxt/components/ColorPicker.js +0 -3
  343. package/nuxt/components/Comment.js +0 -3
  344. package/nuxt/components/DatePicker.js +0 -3
  345. package/nuxt/components/FormControl.js +0 -3
  346. package/nuxt/components/FormLabel.js +0 -3
  347. package/nuxt/components/Gantt.js +0 -3
  348. package/nuxt/components/InputIcon.js +0 -3
  349. package/nuxt/components/NavSprite.js +0 -2
  350. package/nuxt/components/QuadrantDiagram.js +0 -3
  351. package/nuxt/components/ReadTip.js +0 -3
  352. package/nuxt/components/StepsGuide.js +0 -3
  353. package/nuxt/components/StickSlider.js +0 -3
  354. package/nuxt/components/Sticky.js +0 -2
  355. package/nuxt/components/TagInput.js +0 -3
  356. package/nuxt/components/TimeAxis.js +0 -3
  357. package/nuxt/components/TimeAxisItem.js +0 -3
  358. package/nuxt/components/Toast.js +0 -3
  359. package/nuxt/components/ToastService.js +0 -3
  360. package/nuxt/components/Transfer.js +0 -3
  361. package/nuxt/components/TreeSelect.js +0 -3
  362. package/quadrant-diagram/index.d.ts +0 -7
  363. package/quadrant-diagram/index.es.js +0 -5728
  364. package/quadrant-diagram/index.umd.js +0 -27
  365. package/quadrant-diagram/package.json +0 -7
  366. package/quadrant-diagram/style.css +0 -1
  367. package/read-tip/index.d.ts +0 -7
  368. package/read-tip/index.es.js +0 -258
  369. package/read-tip/index.umd.js +0 -1
  370. package/read-tip/package.json +0 -7
  371. package/read-tip/style.css +0 -1
  372. package/steps-guide/index.d.ts +0 -7
  373. package/steps-guide/index.es.js +0 -239
  374. package/steps-guide/index.umd.js +0 -1
  375. package/steps-guide/package.json +0 -7
  376. package/steps-guide/style.css +0 -1
  377. package/sticky/index.d.ts +0 -7
  378. package/sticky/index.es.js +0 -197
  379. package/sticky/index.umd.js +0 -1
  380. package/sticky/package.json +0 -7
  381. package/tag-input/index.d.ts +0 -7
  382. package/tag-input/index.es.js +0 -329
  383. package/tag-input/index.umd.js +0 -1
  384. package/tag-input/package.json +0 -7
  385. package/tag-input/style.css +0 -1
  386. package/time-axis/index.d.ts +0 -7
  387. package/time-axis/index.es.js +0 -299
  388. package/time-axis/index.umd.js +0 -1
  389. package/time-axis/package.json +0 -7
  390. package/time-axis/style.css +0 -1
  391. package/toast/index.d.ts +0 -7
  392. package/toast/index.es.js +0 -5918
  393. package/toast/index.umd.js +0 -27
  394. package/toast/style.css +0 -1
  395. package/transfer/index.d.ts +0 -7
  396. package/transfer/index.umd.js +0 -27
  397. package/transfer/package.json +0 -7
  398. package/transfer/style.css +0 -1
  399. package/tree-select/index.d.ts +0 -7
  400. package/tree-select/index.es.js +0 -623
  401. package/tree-select/index.umd.js +0 -1
  402. package/tree-select/package.json +0 -7
  403. package/tree-select/style.css +0 -1
package/modal/index.es.js CHANGED
@@ -33,1159 +33,733 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef, h, render, readonly, toRefs, resolveDirective } from "vue";
36
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, onMounted, Teleport, h, render } from "vue";
37
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
37
38
  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
52
- },
53
- placement: {
54
- type: String,
55
- default: "center"
56
- },
57
- offsetX: {
58
- type: String,
59
- default: "0px"
39
+ modelValue: {
40
+ type: Boolean,
41
+ default: false
60
42
  },
61
- offsetY: {
43
+ title: {
62
44
  type: String,
63
- default: "0px"
45
+ default: ""
64
46
  },
65
- showAnimation: {
47
+ lockScroll: {
66
48
  type: Boolean,
67
49
  default: true
68
50
  },
69
- backdropCloseable: {
51
+ closeOnClickOverlay: {
70
52
  type: Boolean,
71
53
  default: true
72
54
  },
73
- bodyScrollable: {
55
+ beforeClose: {
56
+ type: Function
57
+ },
58
+ escapable: {
74
59
  type: Boolean,
75
60
  default: true
76
61
  },
77
- escapeable: {
62
+ showClose: {
78
63
  type: Boolean,
79
64
  default: true
80
65
  },
81
- onClose: {
82
- type: Function
83
- },
84
- beforeHidden: {
85
- type: [Object, Function]
86
- },
87
- modelValue: {
88
- type: Boolean
66
+ showOverlay: {
67
+ type: Boolean,
68
+ default: true
89
69
  },
90
- "onUpdate:modelValue": {
91
- type: Function
70
+ appendToBody: {
71
+ type: Boolean,
72
+ default: true
92
73
  }
93
74
  };
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
75
+ const DEFAULT_PREFIX = "icon";
76
+ const iconProps = {
77
+ name: {
78
+ type: String,
79
+ default: "",
80
+ required: true
117
81
  },
118
- backgroundBlock: {
119
- type: Boolean,
120
- default: false
82
+ size: {
83
+ type: [Number, String],
84
+ default: "inherit"
121
85
  },
122
- backgroundClass: {
86
+ color: {
123
87
  type: String,
124
- default: ""
88
+ default: "inherit"
125
89
  },
126
- backgroundStyle: {
127
- type: [String, Object]
90
+ component: {
91
+ type: Object,
92
+ default: null
128
93
  },
129
- onBackdropClick: {
130
- type: Function
94
+ classPrefix: {
95
+ type: String,
96
+ default: DEFAULT_PREFIX
131
97
  },
132
- backdropClose: {
98
+ operable: {
133
99
  type: Boolean,
134
- default: true
100
+ default: false
135
101
  },
136
- hasBackdrop: {
102
+ disabled: {
137
103
  type: Boolean,
138
- default: true
104
+ default: false
105
+ },
106
+ rotate: {
107
+ type: [Number, String]
139
108
  }
140
109
  };
141
- const overlayEmits = ["update:visible", "backdropClick"];
142
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
143
- overlayStyle: {
144
- type: [String, Object],
145
- default: void 0
146
- }
147
- });
148
- const flexibleOverlayProps = __spreadValues({
149
- origin: {
150
- type: Object,
151
- require: true
110
+ const svgIconProps = {
111
+ name: {
112
+ type: String,
113
+ default: "",
114
+ required: true
152
115
  },
153
- position: {
154
- type: Object,
155
- default: () => ({
156
- originX: "left",
157
- originY: "top",
158
- overlayX: "left",
159
- overlayY: "top"
160
- })
161
- }
162
- }, overlayProps);
163
- function useOverlayLogic(props, ctx) {
164
- const backgroundClass = computed(() => {
165
- return [
166
- "devui-overlay-background",
167
- props.backgroundClass,
168
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
169
- ];
170
- });
171
- const overlayClass = computed(() => {
172
- return "devui-overlay";
173
- });
174
- const handleBackdropClick = (event) => {
175
- var _a;
176
- event.preventDefault();
177
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
178
- if (props.backdropClose) {
179
- ctx.emit("update:visible", false);
180
- }
181
- };
182
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
183
- onMounted(() => {
184
- const body = document.body;
185
- const originOverflow = body.style.overflow;
186
- const originPosition = body.style.position;
187
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
188
- if (backgroundBlock) {
189
- const top = body.getBoundingClientRect().y;
190
- if (visible) {
191
- body.style.overflowY = "scroll";
192
- body.style.position = visible ? "fixed" : "";
193
- body.style.top = `${top}px`;
194
- } else {
195
- body.style.overflowY = originOverflow;
196
- body.style.position = originPosition;
197
- body.style.top = "";
198
- window.scrollTo(0, -top);
199
- }
200
- }
201
- });
202
- onUnmounted(() => {
203
- document.body.style.overflow = originOverflow;
204
- });
205
- });
206
- return {
207
- backgroundClass,
208
- overlayClass,
209
- handleBackdropClick,
210
- handleOverlayBubbleCancel
211
- };
212
- }
213
- const FixedOverlay = defineComponent({
214
- name: "DFixedOverlay",
215
- props: fixedOverlayProps,
216
- emits: overlayEmits,
217
- setup(props, ctx) {
218
- const {
219
- backgroundClass,
220
- overlayClass,
221
- handleBackdropClick,
222
- handleOverlayBubbleCancel
223
- } = useOverlayLogic(props, ctx);
224
- return () => createVNode(CommonOverlay, null, {
225
- default: () => [withDirectives(createVNode("div", {
226
- "class": backgroundClass.value,
227
- "style": props.backgroundStyle,
228
- "onClick": handleBackdropClick
229
- }, [createVNode("div", {
230
- "class": overlayClass.value,
231
- "style": props.overlayStyle,
232
- "onClick": handleOverlayBubbleCancel
233
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
234
- });
116
+ color: {
117
+ type: String,
118
+ default: "inherit"
119
+ },
120
+ size: {
121
+ type: [Number, String],
122
+ default: "inherit"
235
123
  }
236
- });
237
- function isComponent(target) {
238
- return !!(target == null ? void 0 : target.$el);
239
- }
240
- function getElement(element) {
241
- if (element instanceof Element) {
242
- return element;
124
+ };
125
+ function createBem(namespace, element, modifier) {
126
+ let cls = namespace;
127
+ if (element) {
128
+ cls += `__${element}`;
243
129
  }
244
- if (element && typeof element === "object" && element.$el instanceof Element) {
245
- return element.$el;
130
+ if (modifier) {
131
+ cls += `--${modifier}`;
246
132
  }
247
- return null;
133
+ return cls;
248
134
  }
249
- const FlexibleOverlay = defineComponent({
250
- name: "DFlexibleOverlay",
251
- props: flexibleOverlayProps,
252
- emits: overlayEmits,
253
- setup(props, ctx) {
254
- const overlayRef = ref(null);
255
- const positionedStyle = reactive({
256
- position: "absolute"
257
- });
258
- onMounted(async () => {
259
- const handleRectChange = (position, rect, origin) => {
260
- const point = calculatePosition(position, rect, origin);
261
- positionedStyle.left = `${point.x}px`;
262
- positionedStyle.top = `${point.y}px`;
263
- };
264
- const locationElements = computed(() => {
265
- const overlay2 = overlayRef.value;
266
- const origin = getOrigin(props.origin);
267
- if (!overlay2 || !origin) {
268
- return;
269
- }
270
- return {
271
- origin,
272
- overlay: overlay2
273
- };
274
- });
275
- const visibleRef = toRef(props, "visible");
276
- const positionRef = toRef(props, "position");
277
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
278
- if (!visible || !locationElements2) {
279
- return;
280
- }
281
- const {
282
- origin,
283
- overlay: overlay2
284
- } = locationElements2;
285
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
286
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
287
- onInvalidate(() => {
288
- unsubscriptions.forEach((fn) => fn());
289
- });
290
- });
291
- });
135
+ function useNamespace(block, needDot = false) {
136
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
137
+ const b = () => createBem(namespace);
138
+ const e = (element) => element ? createBem(namespace, element) : "";
139
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
140
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
141
+ return {
142
+ b,
143
+ e,
144
+ m,
145
+ em
146
+ };
147
+ }
148
+ var icon = "";
149
+ var svgIcon = defineComponent({
150
+ name: "DSvgIcon",
151
+ props: svgIconProps,
152
+ setup(props) {
292
153
  const {
293
- backgroundClass,
294
- overlayClass,
295
- handleBackdropClick,
296
- handleOverlayBubbleCancel
297
- } = useOverlayLogic(props, ctx);
298
- return () => createVNode(CommonOverlay, null, {
299
- default: () => [withDirectives(createVNode("div", {
300
- "style": props.backgroundStyle,
301
- "class": backgroundClass.value,
302
- "onClick": handleBackdropClick
303
- }, [createVNode("div", {
304
- "ref": overlayRef,
305
- "class": overlayClass.value,
306
- "style": positionedStyle,
307
- "onClick": handleOverlayBubbleCancel
308
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
154
+ name,
155
+ color,
156
+ size
157
+ } = toRefs(props);
158
+ const ns = useNamespace("svg-icon");
159
+ const iconName = computed(() => `#icon-${name.value}`);
160
+ const iconSize = computed(() => {
161
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
309
162
  });
163
+ const styles = {
164
+ width: iconSize.value,
165
+ height: iconSize.value
166
+ };
167
+ return () => {
168
+ return createVNode("svg", {
169
+ "class": ns.b(),
170
+ "style": styles
171
+ }, [createVNode("use", {
172
+ "xlink:href": iconName.value,
173
+ "fill": color.value
174
+ }, null)]);
175
+ };
310
176
  }
311
177
  });
312
- function getOrigin(origin) {
313
- if (origin instanceof Element) {
314
- return origin;
315
- }
316
- if (isRef(origin)) {
317
- return getElement(origin.value);
318
- }
319
- if (isComponent(origin)) {
320
- return getElement(origin);
321
- }
322
- return origin;
323
- }
324
- function calculatePosition(position, rect, origin) {
325
- const originRect = getOriginRect(origin);
326
- const originPoint = getOriginRelativePoint(originRect, position);
327
- return getOverlayPoint(originPoint, rect, position);
178
+ function isUrl(value) {
179
+ return /^((http|https):)?\/\//.test(value);
328
180
  }
329
- function getOriginRect(origin) {
330
- if (origin instanceof Element) {
331
- return origin.getBoundingClientRect();
332
- }
333
- const width = origin.width || 0;
334
- const height = origin.height || 0;
335
- return {
336
- top: origin.y,
337
- bottom: origin.y + height,
338
- left: origin.x,
339
- right: origin.x + width,
340
- height,
341
- width
342
- };
343
- }
344
- function getOverlayPoint(originPoint, rect, position) {
345
- let x;
181
+ function useIconDom(props, ctx) {
346
182
  const {
347
- width,
348
- height
349
- } = rect;
350
- if (position.overlayX == "center") {
351
- x = originPoint.x - width / 2;
352
- } else {
353
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
354
- }
355
- let y;
356
- if (position.overlayY == "center") {
357
- y = originPoint.y - height / 2;
358
- } else {
359
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
360
- }
361
- return {
362
- x,
363
- y
183
+ component,
184
+ name,
185
+ size,
186
+ color,
187
+ classPrefix,
188
+ rotate
189
+ } = toRefs(props);
190
+ const ns = useNamespace("icon");
191
+ const iconSize = computed(() => {
192
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
193
+ });
194
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
195
+ const imgIconDom = () => {
196
+ return createVNode("img", mergeProps({
197
+ "src": name.value,
198
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
199
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
200
+ "style": {
201
+ width: iconSize.value || "",
202
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
203
+ verticalAlign: "middle"
204
+ }
205
+ }, ctx.attrs), null);
364
206
  };
365
- }
366
- function getOriginRelativePoint(originRect, position) {
367
- let x;
368
- if (position.originX == "center") {
369
- x = originRect.left + originRect.width / 2;
370
- } else {
371
- const startX = originRect.left;
372
- const endX = originRect.right;
373
- x = position.originX == "left" ? startX : endX;
374
- }
375
- let y;
376
- if (position.originY == "center") {
377
- y = originRect.top + originRect.height / 2;
378
- } else {
379
- y = position.originY == "top" ? originRect.top : originRect.bottom;
380
- }
381
- return {
382
- x,
383
- y
207
+ const svgIconDom = () => {
208
+ return createVNode(IconComponent, mergeProps({
209
+ "name": name.value,
210
+ "color": color.value,
211
+ "size": iconSize.value,
212
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
213
+ "style": {
214
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
215
+ }
216
+ }, ctx.attrs), null);
384
217
  };
385
- }
386
- function subscribeLayoutEvent(event) {
387
- window.addEventListener("scroll", event, true);
388
- window.addEventListener("resize", event);
389
- window.addEventListener("orientationchange", event);
390
- return () => {
391
- window.removeEventListener("scroll", event, true);
392
- window.removeEventListener("resize", event);
393
- window.removeEventListener("orientationchange", event);
218
+ const fontIconDom = () => {
219
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
220
+ return createVNode("i", mergeProps({
221
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
222
+ "style": {
223
+ fontSize: iconSize.value,
224
+ color: color.value,
225
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
226
+ }
227
+ }, ctx.attrs), null);
394
228
  };
395
- }
396
- function subscribeOverlayResize(overlay2, callback) {
397
- if (overlay2 instanceof Element) {
398
- const resizeObserver = new ResizeObserver(callback);
399
- resizeObserver.observe(overlay2);
400
- return () => resizeObserver.disconnect();
401
- }
402
- return () => {
229
+ const iconDom = () => {
230
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
403
231
  };
404
- }
405
- function subscribeOriginResize(origin, callback) {
406
- if (origin instanceof Element) {
407
- const observer = new MutationObserver(callback);
408
- observer.observe(origin, {
409
- attributeFilter: ["style"]
410
- });
411
- return () => observer.disconnect();
412
- }
413
- return () => {
232
+ return {
233
+ iconDom
414
234
  };
415
235
  }
416
- const inBrowser = typeof window !== "undefined";
417
- FlexibleOverlay.install = function(app) {
418
- app.component(FlexibleOverlay.name, FlexibleOverlay);
419
- };
420
- FixedOverlay.install = function(app) {
421
- app.component(FixedOverlay.name, FixedOverlay);
422
- };
423
- var modal = "";
424
- var Modal = defineComponent({
425
- name: "DModal",
426
- props: modalProps,
427
- emits: ["onUpdate:modelValue"],
236
+ var Icon = defineComponent({
237
+ name: "DIcon",
238
+ props: iconProps,
239
+ emits: ["click"],
428
240
  setup(props, ctx) {
429
- const animatedVisible = computed(() => {
430
- return props.showAnimation ? props.modelValue : true;
431
- });
432
- const onVisibleChange = (value) => {
433
- var _a;
434
- const update = props["onUpdate:modelValue"];
435
- if (value) {
436
- update == null ? void 0 : update(value);
437
- } else {
438
- const beforeHidden = props.beforeHidden;
439
- const close = (enabledClose) => {
440
- var _a2;
441
- if (enabledClose) {
442
- update == null ? void 0 : update(false);
443
- (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
444
- }
445
- };
446
- const result = (_a = typeof beforeHidden === "function" ? beforeHidden() : beforeHidden) != null ? _a : true;
447
- if (result instanceof Promise) {
448
- result.then(close);
449
- } else {
450
- close(result);
451
- }
241
+ const {
242
+ disabled,
243
+ operable
244
+ } = toRefs(props);
245
+ const {
246
+ iconDom
247
+ } = useIconDom(props, ctx);
248
+ const ns = useNamespace("icon");
249
+ const wrapClassed = computed(() => ({
250
+ [ns.e("container")]: true,
251
+ [ns.m("disabled")]: disabled.value,
252
+ [ns.m("operable")]: operable.value
253
+ }));
254
+ const onClick = (e) => {
255
+ if (disabled.value) {
256
+ return;
452
257
  }
258
+ ctx.emit("click", e);
259
+ };
260
+ return () => {
261
+ var _a, _b, _c, _d;
262
+ return createVNode("div", {
263
+ "class": wrapClassed.value,
264
+ "onClick": onClick
265
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
453
266
  };
454
- ctx.expose({
455
- onVisibleChange
456
- });
457
- return () => createVNode(FixedOverlay, {
458
- "visible": props.modelValue,
459
- "onUpdate:visible": onVisibleChange,
460
- "backgroundClass": "devui-modal-wrapper",
461
- "backgroundBlock": !props.bodyScrollable,
462
- "backdropClose": props.backdropCloseable
463
- }, {
464
- default: () => [createVNode(Transition, {
465
- "name": "devui-modal-wipe"
466
- }, {
467
- default: () => {
468
- var _a, _b;
469
- return [animatedVisible.value ? (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a) : null];
470
- }
471
- })]
472
- });
473
267
  }
474
268
  });
475
- class CommonModalService {
476
- constructor(anchorContainer) {
477
- this.anchorContainer = anchorContainer;
478
- }
479
- renderModal(anchor, props, children) {
480
- const vnode = h(this.component(), props, children);
481
- render(vnode, anchor);
482
- return vnode;
483
- }
484
- renderNull(anchor) {
485
- setTimeout(() => {
486
- render(null, anchor);
487
- }, 500);
488
- }
489
- }
490
- class ModalService extends CommonModalService {
491
- component() {
492
- return Modal;
493
- }
494
- open(props = {}) {
495
- const anchor = document.createElement("div");
496
- this.anchorContainer.appendChild(anchor);
497
- const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
498
- const needHideOrNot = (value) => {
499
- if (!value) {
500
- hide();
501
- }
502
- };
503
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
504
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
505
- modelValue: true,
506
- "onUpdate:modelValue": onUpdateModelValue
507
- }), { default: content });
508
- };
509
- const hide = () => {
510
- var _a2, _b;
511
- const vnode = renderOrigin(resProps, (value) => {
512
- if (!value) {
513
- this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
514
- this.renderNull(anchor);
515
- } else {
516
- renderOrigin(resProps);
517
- }
518
- });
519
- (_b = (_a2 = vnode.component.exposed).onVisibleChange) == null ? void 0 : _b.call(_a2, false);
269
+ var iconGroup = "";
270
+ defineComponent({
271
+ name: "DIconGroup",
272
+ setup(_, ctx) {
273
+ const ns = useNamespace("icon-group");
274
+ return () => {
275
+ var _a, _b;
276
+ return createVNode("div", {
277
+ "class": ns.b()
278
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
520
279
  };
521
- this.renderModal(anchor, { modelValue: false });
522
- renderOrigin(resProps);
523
- return { hide };
524
280
  }
525
- }
526
- __publicField(ModalService, "token", "MODAL_SERVICE_TOKEN");
527
- const dialogProps = {
528
- width: {
529
- type: String,
530
- default: "300px"
531
- },
532
- maxHeight: {
533
- type: String
534
- },
535
- zIndex: {
536
- type: Number,
537
- default: 1050
538
- },
539
- backdropZIndex: {
540
- type: Number,
541
- default: 1049
542
- },
543
- placement: {
544
- type: String,
545
- default: "center"
546
- },
547
- offsetX: {
548
- type: String,
549
- default: "0px"
550
- },
551
- offsetY: {
552
- type: String,
553
- default: "0px"
554
- },
555
- title: {
556
- type: String
557
- },
558
- showAnimation: {
559
- type: Boolean,
560
- default: true
561
- },
562
- backdropCloseable: {
281
+ });
282
+ const fixedOverlayProps = {
283
+ modelValue: {
563
284
  type: Boolean,
564
- default: true
285
+ default: false
565
286
  },
566
- bodyScrollable: {
287
+ lockScroll: {
567
288
  type: Boolean,
568
289
  default: true
569
290
  },
570
- escapeable: {
291
+ closeOnClickOverlay: {
571
292
  type: Boolean,
572
293
  default: true
573
- },
574
- onClose: {
575
- type: Function
576
- },
577
- beforeHidden: {
578
- type: [Promise, Function]
579
- },
580
- buttons: {
581
- type: Array,
582
- default: []
583
- },
584
- dialogType: {
585
- type: String,
586
- default: "standard"
587
- },
588
- modelValue: {
589
- type: Boolean
590
- },
591
- "onUpdate:modelValue": {
592
- type: Function
593
294
  }
594
295
  };
595
- const useMoveable = (moveable = true) => {
596
- const movingX = ref(0);
597
- const movingY = ref(0);
598
- const reset = () => {
599
- movingX.value = 0;
600
- movingY.value = 0;
601
- };
602
- const handleRef = ref();
603
- const moveElRef = ref();
604
- const enabledMoving = isRef(moveable) ? moveable : ref(moveable);
605
- watch([moveElRef, handleRef], ([container, target], ov, onInvalidate) => {
606
- if (!(target instanceof HTMLElement && container instanceof HTMLElement)) {
607
- return;
608
- }
609
- target.style.cursor = "all-scroll";
610
- let startX = 0;
611
- let startY = 0;
612
- let prevMovingX = 0;
613
- let prevMovingY = 0;
614
- let containerRect = container.getBoundingClientRect();
615
- let bodyRect = document.body.getBoundingClientRect();
616
- let isDown = false;
617
- const handleMouseDown = (event) => {
618
- event.preventDefault();
619
- if (!enabledMoving.value) {
620
- return;
621
- }
622
- startX = event.clientX;
623
- startY = event.clientY;
624
- const targetRect = target.getBoundingClientRect();
625
- if ((target === event.target || target.contains(event.target)) && targetRect.x < startX && targetRect.y < startY && targetRect.width + targetRect.x >= startX && targetRect.height + targetRect.y >= startY) {
626
- isDown = true;
627
- prevMovingX = movingX.value;
628
- prevMovingY = movingY.value;
629
- bodyRect = document.body.getBoundingClientRect();
630
- containerRect = container.getBoundingClientRect();
631
- }
632
- };
633
- const handleMouseMove = (event) => {
634
- event.preventDefault();
635
- if (!isDown) {
636
- return;
637
- }
638
- const currentX = prevMovingX + event.clientX - startX;
639
- const currentY = prevMovingY + event.clientY - startY;
640
- const containerOriginX = containerRect.x - prevMovingX;
641
- const containerOriginY = containerRect.y - prevMovingY;
642
- movingX.value = getRangeValueOf(currentX, -containerOriginX, bodyRect.width - containerRect.width - containerOriginX);
643
- movingY.value = getRangeValueOf(currentY, -containerOriginY, bodyRect.height - containerRect.height - containerOriginY);
644
- };
645
- const handleMouseUp = (event) => {
646
- event.preventDefault();
647
- if (!isDown) {
648
- return;
296
+ function lockScroll() {
297
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
298
+ const scrollTop = document.documentElement.scrollTop;
299
+ const style = document.documentElement.getAttribute("style");
300
+ document.documentElement.style.position = "fixed";
301
+ document.documentElement.style.top = `-${scrollTop}px`;
302
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
303
+ document.documentElement.style.overflowY = "scroll";
304
+ return () => {
305
+ if (style) {
306
+ document.documentElement.setAttribute("style", style);
307
+ } else {
308
+ document.documentElement.removeAttribute("style");
649
309
  }
650
- isDown = false;
310
+ document.documentElement.scrollTop = scrollTop;
651
311
  };
652
- window.addEventListener("mousedown", handleMouseDown);
653
- window.addEventListener("mousemove", handleMouseMove);
654
- window.addEventListener("mouseup", handleMouseUp);
655
- onInvalidate(() => {
656
- window.removeEventListener("mousedown", handleMouseDown);
657
- window.removeEventListener("mousemove", handleMouseMove);
658
- window.removeEventListener("mouseup", handleMouseUp);
659
- });
660
- });
661
- return {
662
- movingX: readonly(movingX),
663
- movingY: readonly(movingY),
664
- handleRef,
665
- moveElRef,
666
- reset
667
- };
668
- };
669
- const getRangeValueOf = (value, min, max) => {
670
- if (value < min) {
671
- return min;
672
312
  }
673
- if (value > max) {
674
- return max;
675
- }
676
- return value;
677
- };
678
- var Icon = defineComponent({
679
- name: "DIcon",
680
- props: {
681
- name: {
682
- type: String,
683
- required: true
684
- },
685
- size: {
686
- type: String,
687
- default: "inherit"
688
- },
689
- color: {
690
- type: String,
691
- default: "inherit"
692
- },
693
- classPrefix: {
694
- type: String,
695
- default: "icon"
313
+ return;
314
+ }
315
+ function useFixedOverlay(props, ctx) {
316
+ let lockScrollCb;
317
+ const onClick = (event) => {
318
+ event.preventDefault();
319
+ ctx.emit("click", event);
320
+ if (props.closeOnClickOverlay) {
321
+ ctx.emit("update:modelValue", false);
696
322
  }
697
- },
698
- setup(props) {
699
- return __spreadValues({}, props);
700
- },
701
- render() {
323
+ };
324
+ const removeBodyAdditions = () => {
325
+ lockScrollCb == null ? void 0 : lockScrollCb();
326
+ };
327
+ watch(() => props.modelValue, (val) => {
328
+ if (val) {
329
+ props.lockScroll && (lockScrollCb = lockScroll());
330
+ } else {
331
+ removeBodyAdditions();
332
+ }
333
+ });
334
+ onUnmounted(removeBodyAdditions);
335
+ return { onClick };
336
+ }
337
+ var fixedOverlay = "";
338
+ const FixedOverlay = defineComponent({
339
+ name: "DFixedOverlay",
340
+ inheritAttrs: false,
341
+ props: fixedOverlayProps,
342
+ emits: ["update:modelValue", "click"],
343
+ setup(props, ctx) {
702
344
  const {
703
- name,
704
- size,
705
- color,
706
- classPrefix
707
- } = this;
708
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
709
- "src": name,
710
- "alt": name.split("/")[name.split("/").length - 1],
711
- "style": {
712
- width: size,
713
- verticalAlign: "text-bottom"
714
- }
715
- }, null) : createVNode("i", {
716
- "class": `${classPrefix} ${classPrefix}-${name}`,
717
- "style": {
718
- fontSize: size,
719
- color
345
+ modelValue
346
+ } = toRefs(props);
347
+ const ns = useNamespace("fixed-overlay");
348
+ const {
349
+ onClick
350
+ } = useFixedOverlay(props, ctx);
351
+ return () => createVNode(Transition, {
352
+ "name": ns.m("fade")
353
+ }, {
354
+ default: () => {
355
+ var _a, _b;
356
+ return [modelValue.value && createVNode("div", mergeProps({
357
+ "class": ns.b()
358
+ }, ctx.attrs, {
359
+ "onClick": onClick
360
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
720
361
  }
721
- }, null);
362
+ });
722
363
  }
723
364
  });
724
- Icon.install = function(app) {
725
- app.component(Icon.name, Icon);
726
- };
727
- class View {
728
- constructor() {
729
- __publicField(this, "top", "50%");
730
- __publicField(this, "left", "50%");
731
- }
732
- }
733
- const componentProps = {
734
- message: String,
735
- backdrop: Boolean,
736
- view: {
737
- type: Object,
738
- default: () => new View()
739
- },
740
- zIndex: Number,
741
- isFull: {
365
+ const flexibleOverlayProps = {
366
+ modelValue: {
742
367
  type: Boolean,
743
368
  default: false
744
- }
745
- };
746
- class LoadingProps {
747
- constructor() {
748
- __publicField(this, "target");
749
- __publicField(this, "message");
750
- __publicField(this, "loadingTemplateRef");
751
- __publicField(this, "backdrop", true);
752
- __publicField(this, "positionType", "relative");
753
- __publicField(this, "view", new View());
754
- __publicField(this, "zIndex");
755
- }
756
- }
757
- var loading = "";
758
- var Loading = defineComponent({
759
- name: "DLoading",
760
- inheritAttrs: false,
761
- props: componentProps,
762
- setup(props) {
763
- const style = {
764
- top: props.view.top,
765
- left: props.view.left,
766
- zIndex: props.zIndex
767
- };
768
- if (!props.message) {
769
- style.background = "none";
770
- }
771
- const isShow = ref(false);
772
- const open = () => {
773
- isShow.value = true;
774
- };
775
- const close = () => {
776
- isShow.value = false;
777
- };
778
- return {
779
- style,
780
- isShow,
781
- open,
782
- close
783
- };
784
369
  },
785
- render() {
786
- var _a;
787
- const {
788
- isShow,
789
- isFull,
790
- backdrop,
791
- style,
792
- message,
793
- $slots
794
- } = this;
795
- return isShow && createVNode("div", {
796
- "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
797
- }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
798
- "class": "devui-loading-wrapper"
799
- }, [backdrop ? createVNode("div", {
800
- "class": "devui-loading-mask"
801
- }, null) : null, createVNode("div", {
802
- "style": style,
803
- "class": "devui-loading-area"
804
- }, [createVNode("div", {
805
- "class": "devui-busy-default-spinner"
806
- }, [createVNode("div", {
807
- "class": "devui-loading-bar1"
808
- }, null), createVNode("div", {
809
- "class": "devui-loading-bar2"
810
- }, null), createVNode("div", {
811
- "class": "devui-loading-bar3"
812
- }, null), createVNode("div", {
813
- "class": "devui-loading-bar4"
814
- }, null)]), message ? createVNode("span", {
815
- "class": "devui-loading-text"
816
- }, [message]) : null])])]);
817
- }
818
- });
819
- const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
820
- function createComponent(Component, props, children = null) {
821
- const vnode = h(Component, __spreadValues({}, props), children);
822
- const container = document.createElement("div");
823
- vnode[COMPONENT_CONTAINER_SYMBOL] = container;
824
- render(vnode, container);
825
- return vnode.component;
826
- }
827
- function unmountComponent(ComponnetInstance) {
828
- render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
829
- }
830
- const loadingConstructor = defineComponent(Loading);
831
- const cacheInstance = /* @__PURE__ */ new WeakSet();
832
- const isEmpty = (val) => {
833
- if (!val)
834
- return true;
835
- if (Array.isArray(val))
836
- return val.length === 0;
837
- if (val instanceof Set || val instanceof Map)
838
- return val.size === 0;
839
- if (val instanceof Promise)
840
- return false;
841
- if (typeof val === "object") {
842
- try {
843
- return Object.keys(val).length === 0;
844
- } catch (e) {
845
- return false;
846
- }
847
- }
848
- return false;
849
- };
850
- const getType = (vari) => {
851
- return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
852
- };
853
- const isPromise = (value) => {
854
- const type = getType(value);
855
- switch (type) {
856
- case "promise":
857
- return [value];
858
- case "array":
859
- if (value.some((val) => getType(val) !== "promise")) {
860
- console.error(new TypeError("Binding values should all be of type Promise"));
861
- return "error";
862
- }
863
- return value;
864
- default:
865
- return false;
866
- }
867
- };
868
- const unmount = (el) => {
869
- cacheInstance.delete(el);
870
- el.instance.proxy.close();
871
- unmountComponent(el.instance);
872
- };
873
- const toggleLoading = (el, binding) => {
874
- if (binding.value) {
875
- const vals = isPromise(binding.value);
876
- if (vals === "error")
877
- return;
878
- el.instance.proxy.open();
879
- el.appendChild(el.mask);
880
- cacheInstance.add(el);
881
- if (vals) {
882
- Promise.all(vals).catch((err) => {
883
- console.error(new Error("Promise handling errors"), err);
884
- }).finally(() => {
885
- unmount(el);
886
- });
887
- }
888
- } else {
889
- unmount(el);
890
- }
891
- };
892
- const removeAttribute = (el) => {
893
- el.removeAttribute("zindex");
894
- el.removeAttribute("positiontype");
895
- el.removeAttribute("backdrop");
896
- el.removeAttribute("message");
897
- el.removeAttribute("view");
898
- el.removeAttribute("loadingtemplateref");
899
- };
900
- const handleProps = (el, vprops) => {
901
- const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
902
- const loadingTemplateRef = props.loadingTemplateRef;
903
- const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
904
- el.style.position = props.positionType;
905
- el.options = props;
906
- el.instance = loadingInstance;
907
- el.mask = loadingInstance.proxy.$el;
908
- };
909
- const loadingDirective = {
910
- mounted: function(el, binding, vnode) {
911
- handleProps(el, vnode.props);
912
- removeAttribute(el);
913
- !isEmpty(binding.value) && toggleLoading(el, binding);
370
+ origin: {
371
+ type: Object,
372
+ require: true
914
373
  },
915
- updated: function(el, binding, vnode) {
916
- if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
917
- return;
918
- !cacheInstance.has(el) && handleProps(el, vnode.props);
919
- removeAttribute(el);
920
- toggleLoading(el, binding);
921
- }
922
- };
923
- const buttonProps = {
924
- variant: {
925
- type: String,
926
- default: "outline"
374
+ position: {
375
+ type: Array,
376
+ default: ["bottom"]
927
377
  },
928
- size: {
929
- type: String,
930
- default: "md"
378
+ offset: {
379
+ type: [Number, Object],
380
+ default: 8
931
381
  },
932
- color: {
933
- type: String
382
+ shiftOffset: {
383
+ type: Number
934
384
  },
935
- icon: {
385
+ align: {
936
386
  type: String,
937
- default: ""
387
+ default: null
938
388
  },
939
- loading: {
389
+ showArrow: {
940
390
  type: Boolean,
941
391
  default: false
942
392
  },
943
- disabled: {
393
+ isArrowCenter: {
944
394
  type: Boolean,
945
- default: false
395
+ default: true
946
396
  }
947
397
  };
948
- function useButton(props, ctx) {
949
- const hasContent = computed(() => ctx.slots.default);
950
- const colorMap = {
951
- solid: "primary",
952
- outline: "secondary",
953
- text: "secondary"
398
+ function getScrollParent(element) {
399
+ const overflowRegex = /(auto|scroll|hidden)/;
400
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
401
+ const style = window.getComputedStyle(parent);
402
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
403
+ return parent;
404
+ }
405
+ }
406
+ return window;
407
+ }
408
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
409
+ let { x, y } = point;
410
+ if (!isArrowCenter) {
411
+ const { width, height } = originRect;
412
+ if (x && placement.includes("start")) {
413
+ x = 12;
414
+ }
415
+ if (x && placement.includes("end")) {
416
+ x = Math.round(width - 24);
417
+ }
418
+ if (y && placement.includes("start")) {
419
+ y = 10;
420
+ }
421
+ if (y && placement.includes("end")) {
422
+ y = height - 14;
423
+ }
424
+ }
425
+ return { x, y };
426
+ }
427
+ function useOverlay(props, emit) {
428
+ const overlayRef = ref();
429
+ const arrowRef = ref();
430
+ let originParent = null;
431
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
432
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
433
+ const staticSide = {
434
+ top: "bottom",
435
+ right: "left",
436
+ bottom: "top",
437
+ left: "right"
438
+ }[placement.split("-")[0]];
439
+ Object.assign(arrowEl.style, {
440
+ left: x ? `${x}px` : "",
441
+ top: y ? `${y}px` : "",
442
+ right: "",
443
+ bottom: "",
444
+ [staticSide]: "-4px"
445
+ });
954
446
  };
955
- const defaultColor = colorMap[props.variant];
956
- const classes = computed(() => ({
957
- "devui-btn": true,
958
- [`devui-btn-${props.variant}`]: true,
959
- [`devui-btn-${props.variant}-${props.color || defaultColor}`]: true,
960
- [`devui-btn-${props.size}`]: true,
961
- "devui-btn-icon-wrap": props.icon,
962
- "devui-btn-icon": props.icon && !hasContent.value && props.variant !== "solid"
963
- }));
964
- const iconClass = computed(() => {
965
- if (!props.icon) {
966
- return;
447
+ const updatePosition = async () => {
448
+ const hostEl = props.origin;
449
+ const overlayEl = unref(overlayRef.value);
450
+ const arrowEl = unref(arrowRef.value);
451
+ const middleware = [
452
+ offset(props.offset),
453
+ autoPlacement({
454
+ alignment: props.align,
455
+ allowedPlacements: props.position
456
+ })
457
+ ];
458
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
459
+ props.shiftOffset !== void 0 && middleware.push(shift());
460
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
461
+ strategy: "fixed",
462
+ middleware
463
+ });
464
+ let applyX = x;
465
+ let applyY = y;
466
+ if (props.shiftOffset !== void 0) {
467
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
468
+ shiftX < 0 && (applyX -= props.shiftOffset);
469
+ shiftX > 0 && (applyX += props.shiftOffset);
470
+ shiftY < 0 && (applyY -= props.shiftOffset);
471
+ shiftY > 0 && (applyY += props.shiftOffset);
967
472
  }
968
- const origin = "devui-icon-fix icon";
969
- if (hasContent.value) {
970
- return `${origin} clear-right-5`;
473
+ emit("positionChange", placement);
474
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
475
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
476
+ };
477
+ watch(() => props.modelValue, () => {
478
+ if (props.modelValue && props.origin) {
479
+ originParent = getScrollParent(props.origin);
480
+ nextTick(updatePosition);
481
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
482
+ originParent !== window && window.addEventListener("scroll", updatePosition);
483
+ window.addEventListener("resize", updatePosition);
971
484
  } else {
972
- return origin;
485
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
486
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
487
+ window.removeEventListener("resize", updatePosition);
973
488
  }
974
489
  });
975
- return { classes, iconClass };
490
+ onUnmounted(() => {
491
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
492
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
493
+ window.removeEventListener("resize", updatePosition);
494
+ });
495
+ return { arrowRef, overlayRef, updatePosition };
976
496
  }
977
- var button = "";
978
- var Button = defineComponent({
979
- name: "DButton",
980
- directives: {
981
- devLoading: loadingDirective
982
- },
983
- props: buttonProps,
984
- emits: ["click"],
985
- setup(props, ctx) {
986
- const {
987
- icon,
988
- disabled,
989
- loading: loading2
990
- } = toRefs(props);
497
+ var flexibleOverlay = "";
498
+ defineComponent({
499
+ name: "DFlexibleOverlay",
500
+ inheritAttrs: false,
501
+ props: flexibleOverlayProps,
502
+ emits: ["update:modelValue", "positionChange"],
503
+ setup(props, {
504
+ slots,
505
+ attrs,
506
+ emit,
507
+ expose
508
+ }) {
509
+ const ns = useNamespace("flexible-overlay");
991
510
  const {
992
- classes,
993
- iconClass
994
- } = useButton(props, ctx);
995
- const onClick = (e) => {
996
- if (loading2.value) {
997
- return;
998
- }
999
- ctx.emit("click", e);
1000
- };
511
+ arrowRef,
512
+ overlayRef,
513
+ updatePosition
514
+ } = useOverlay(props, emit);
515
+ expose({
516
+ updatePosition
517
+ });
1001
518
  return () => {
1002
- var _a, _b;
1003
- return withDirectives(createVNode("button", {
1004
- "class": classes.value,
1005
- "disabled": disabled.value,
1006
- "onClick": onClick
1007
- }, [icon.value && createVNode(Icon, {
1008
- "name": icon.value,
1009
- "size": "12px",
1010
- "class": iconClass.value
1011
- }, null), createVNode("span", {
1012
- "class": "button-content"
1013
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
519
+ var _a;
520
+ return props.modelValue && createVNode("div", mergeProps({
521
+ "ref": overlayRef,
522
+ "class": ns.b()
523
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
524
+ "ref": arrowRef,
525
+ "class": ns.e("arrow")
526
+ }, null)]);
1014
527
  };
1015
528
  }
1016
529
  });
1017
- function _isSlot(s) {
1018
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
530
+ const inBrowser = typeof window !== "undefined";
531
+ function useModal(props, emit) {
532
+ function close() {
533
+ emit("update:modelValue", false);
534
+ }
535
+ function execClose() {
536
+ props.beforeClose ? props.beforeClose(close) : close();
537
+ }
538
+ function onOverlayClick() {
539
+ props.closeOnClickOverlay && execClose();
540
+ }
541
+ function onCloseBtnClick() {
542
+ execClose();
543
+ }
544
+ function onKeydown(event) {
545
+ if (event["keyCode"] === 27) {
546
+ execClose();
547
+ }
548
+ }
549
+ onMounted(() => {
550
+ if (props.escapable) {
551
+ window.addEventListener("keydown", onKeydown);
552
+ }
553
+ });
554
+ onUnmounted(() => {
555
+ if (props.escapable) {
556
+ window.addEventListener("keydown", onKeydown);
557
+ }
558
+ });
559
+ return { onCloseBtnClick, onOverlayClick };
560
+ }
561
+ function useModalRender(props) {
562
+ const showContainer = ref(false);
563
+ const showModal = ref(false);
564
+ let lockScrollCb;
565
+ const removeBodyAdditions = () => {
566
+ lockScrollCb == null ? void 0 : lockScrollCb();
567
+ };
568
+ watch(() => props.modelValue, (val) => {
569
+ if (val) {
570
+ props.lockScroll && (lockScrollCb = lockScroll());
571
+ showContainer.value = true;
572
+ nextTick(() => {
573
+ showModal.value = true;
574
+ });
575
+ } else {
576
+ removeBodyAdditions();
577
+ showModal.value = false;
578
+ setTimeout(() => {
579
+ showContainer.value = false;
580
+ }, 100);
581
+ }
582
+ }, {
583
+ immediate: true
584
+ });
585
+ onUnmounted(removeBodyAdditions);
586
+ return { showContainer, showModal };
1019
587
  }
1020
- var Dialog = defineComponent({
588
+ var Header = defineComponent({
589
+ name: "DModalHeader",
590
+ setup(props, {
591
+ slots
592
+ }) {
593
+ const ns = useNamespace("modal");
594
+ return () => {
595
+ var _a;
596
+ return createVNode("div", {
597
+ "class": ns.e("header")
598
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
599
+ };
600
+ }
601
+ });
602
+ var Body = defineComponent({
603
+ name: "DModalBody",
604
+ setup(props, {
605
+ slots
606
+ }) {
607
+ const ns = useNamespace("modal");
608
+ return () => {
609
+ var _a;
610
+ return createVNode("div", {
611
+ "class": ns.e("body")
612
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
613
+ };
614
+ }
615
+ });
616
+ var modal = "";
617
+ var Modal = defineComponent({
1021
618
  name: "DModal",
1022
619
  inheritAttrs: false,
1023
- props: dialogProps,
1024
- emits: ["onUpdate:modelValue"],
1025
- setup(props, ctx) {
620
+ props: modalProps,
621
+ emits: ["update:modelValue"],
622
+ setup(props, {
623
+ slots,
624
+ attrs,
625
+ emit
626
+ }) {
627
+ const ns = useNamespace("modal");
1026
628
  const {
1027
- movingX,
1028
- movingY,
1029
- handleRef,
1030
- moveElRef,
1031
- reset
1032
- } = useMoveable();
1033
- watch(() => props.modelValue, (value) => {
1034
- if (value) {
1035
- reset();
1036
- }
1037
- });
1038
- const movingStyle = computed(() => ({
1039
- position: "relative",
1040
- left: `${movingX.value}px`,
1041
- top: `${movingY.value}px`
1042
- }));
1043
- const containerStyle = computed(() => ({
1044
- width: props.width,
1045
- maxHeight: props.maxHeight,
1046
- transform: `translate(${props.offsetX}, ${props.offsetY})`,
1047
- zIndex: props.zIndex
1048
- }));
1049
- const iconName = computed(() => {
1050
- switch (props.dialogType) {
1051
- case "standard":
1052
- return "";
1053
- case "info":
1054
- return "icon-info-o";
1055
- case "success":
1056
- return "icon-right-o";
1057
- case "warning":
1058
- return "icon-warning-o";
1059
- case "failed":
1060
- return "icon-error-o";
1061
- default:
1062
- return "";
1063
- }
1064
- });
1065
- const buttonsRef = computed(() => {
1066
- return props.buttons.map((buttonProps2, index2) => {
1067
- const {
1068
- variant,
1069
- disabled,
1070
- handler,
1071
- text
1072
- } = buttonProps2;
1073
- return createVNode(Button, {
1074
- "key": index2,
1075
- "style": {
1076
- display: "inline-block",
1077
- margin: "0 5px"
1078
- },
1079
- "variant": variant,
1080
- "disabled": disabled,
1081
- "onClick": handler
1082
- }, _isSlot(text) ? text : {
1083
- default: () => [text]
1084
- });
1085
- });
1086
- });
1087
- const modalRef = ref();
1088
- const closeModal = () => {
1089
- var _a, _b;
1090
- (_b = (_a = modalRef.value) == null ? void 0 : _a.onVisibleChange) == null ? void 0 : _b.call(_a, false);
1091
- };
1092
- ctx.expose({
1093
- closeModal
1094
- });
1095
- return () => createVNode(Modal, {
1096
- "ref": modalRef,
1097
- "width": props.width,
1098
- "maxHeight": props.maxHeight,
1099
- "offsetX": props.offsetX,
1100
- "offsetY": props.offsetY,
1101
- "zIndex": props.zIndex,
1102
- "backdropZIndex": props.backdropZIndex,
1103
- "backdropCloseable": props.backdropCloseable,
1104
- "bodyScrollable": props.bodyScrollable,
1105
- "placement": props.placement,
1106
- "onClose": props.onClose,
1107
- "beforeHidden": props.beforeHidden,
1108
- "modelValue": props.modelValue,
1109
- "onUpdate:modelValue": props["onUpdate:modelValue"]
629
+ modelValue,
630
+ title,
631
+ showClose,
632
+ showOverlay,
633
+ appendToBody
634
+ } = toRefs(props);
635
+ const {
636
+ onCloseBtnClick,
637
+ onOverlayClick
638
+ } = useModal(props, emit);
639
+ const {
640
+ showContainer,
641
+ showModal
642
+ } = useModalRender(props);
643
+ return () => createVNode(Teleport, {
644
+ "to": "body",
645
+ "disabled": !appendToBody.value
1110
646
  }, {
1111
- default: () => {
1112
- var _a, _b;
1113
- return [createVNode("div", {
1114
- "class": "devui-modal-content",
1115
- "style": [containerStyle.value, movingStyle.value],
1116
- "ref": moveElRef
1117
- }, [createVNode("div", {
1118
- "class": "devui-modal-header",
1119
- "ref": handleRef
1120
- }, [!!iconName.value ? createVNode(Icon, {
1121
- "name": iconName.value,
1122
- "size": "24px",
1123
- "class": "header-alert-icon"
1124
- }, null) : null, createVNode("span", null, [props.title]), createVNode(Button, {
1125
- "class": "btn-close",
1126
- "icon": "close",
1127
- "variant": "text-dark",
1128
- "onClick": closeModal
1129
- }, null)]), createVNode("div", {
1130
- "class": "devui-modal-body"
1131
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
1132
- "class": "devui-modal-footer"
1133
- }, [buttonsRef.value])])];
1134
- }
647
+ default: () => [showOverlay.value && createVNode(FixedOverlay, {
648
+ "modelValue": modelValue.value,
649
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
650
+ "lock-scroll": false,
651
+ "style": {
652
+ zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
653
+ }
654
+ }, null), showContainer.value && createVNode("div", {
655
+ "class": ns.e("container"),
656
+ "onClick": onOverlayClick
657
+ }, [createVNode(Transition, {
658
+ "name": ns.m("wipe")
659
+ }, {
660
+ default: () => {
661
+ var _a;
662
+ return [showModal.value && createVNode("div", mergeProps({
663
+ "class": ns.b()
664
+ }, attrs), [showClose.value && createVNode(Icon, {
665
+ "name": "close",
666
+ "class": "btn-close",
667
+ "size": "var(--devui-font-size-md,12px)",
668
+ "onClick": onCloseBtnClick
669
+ }, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
670
+ default: () => [title.value]
671
+ }), createVNode(Body, null, {
672
+ default: () => {
673
+ var _a2;
674
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
675
+ }
676
+ }), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
677
+ }
678
+ })])]
1135
679
  });
1136
680
  }
1137
681
  });
1138
- class DialogService extends CommonModalService {
682
+ var Footer = defineComponent({
683
+ name: "DModalFooter",
684
+ setup(props, {
685
+ slots
686
+ }) {
687
+ const ns = useNamespace("modal");
688
+ return () => {
689
+ var _a;
690
+ return createVNode("div", {
691
+ "class": ns.e("footer")
692
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
693
+ };
694
+ }
695
+ });
696
+ class CommonModalService {
697
+ constructor(anchorContainer) {
698
+ this.anchorContainer = anchorContainer;
699
+ }
700
+ renderModal(anchor, props, children) {
701
+ const vnode = h(this.component(), props, children);
702
+ render(vnode, anchor);
703
+ return vnode;
704
+ }
705
+ renderNull(anchor) {
706
+ setTimeout(() => {
707
+ render(null, anchor);
708
+ }, 500);
709
+ }
710
+ }
711
+ let vm;
712
+ class ModalService extends CommonModalService {
1139
713
  component() {
1140
- return Dialog;
714
+ return Modal;
1141
715
  }
1142
716
  open(props = {}) {
1143
717
  const anchor = document.createElement("div");
1144
718
  this.anchorContainer.appendChild(anchor);
1145
- const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
1146
- const needHideOrNot = (value) => {
1147
- if (!value) {
1148
- hide();
1149
- }
1150
- };
1151
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
1152
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
719
+ const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
720
+ const renderOrigin = (propsValue, onUpdateModelValue) => {
721
+ return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
1153
722
  modelValue: true,
1154
723
  "onUpdate:modelValue": onUpdateModelValue
1155
- }), { default: content });
724
+ }), { header, default: content, footer });
1156
725
  };
1157
726
  const hide = () => {
1158
- var _a2, _b;
1159
- const vnode = renderOrigin(resProps, (value) => {
727
+ var _a2, _b, _c;
728
+ const innerNeedHideOrNot = (value) => {
729
+ if (!value) {
730
+ hide();
731
+ }
732
+ };
733
+ renderOrigin(resProps, (value) => {
1160
734
  if (!value) {
1161
735
  this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
1162
736
  this.renderNull(anchor);
1163
737
  } else {
1164
- renderOrigin(resProps);
738
+ renderOrigin(resProps, innerNeedHideOrNot);
1165
739
  }
1166
740
  });
1167
- (_b = (_a2 = vnode.component.exposed).closeModal) == null ? void 0 : _b.call(_a2);
741
+ (_c = (_b = (_a2 = vm == null ? void 0 : vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
1168
742
  };
1169
- const updateButtonOptions = (buttonOptions) => {
1170
- const _a2 = resProps, { buttons } = _a2, innerResProps = __objRest(_a2, ["buttons"]);
1171
- const newButtonOptions = buttons.map((option, index2) => __spreadValues(__spreadValues({}, option), buttonOptions[index2]));
1172
- renderOrigin(__spreadProps(__spreadValues({}, innerResProps), { buttons: newButtonOptions }));
743
+ const needHideOrNot = (value) => {
744
+ if (!value) {
745
+ hide();
746
+ }
1173
747
  };
1174
748
  this.renderModal(anchor, { modelValue: false });
1175
- renderOrigin(resProps);
1176
- return { hide, updateButtonOptions };
749
+ vm = renderOrigin(resProps, needHideOrNot);
750
+ return { hide };
1177
751
  }
1178
752
  }
1179
- __publicField(DialogService, "token", "DIALOG_SERVICE_TOKEN");
1180
- Modal.install = function(app) {
1181
- app.component(Modal.name, Modal);
1182
- };
753
+ __publicField(ModalService, "token", "MODAL_SERVICE_TOKEN");
1183
754
  var index = {
1184
755
  title: "Modal \u5F39\u7A97",
1185
756
  category: "\u53CD\u9988",
1186
757
  status: "100%",
1187
758
  install(app) {
1188
- app.use(Modal);
759
+ app.component(Modal.name, Modal);
760
+ app.component(Header.name, Header);
761
+ app.component(Body.name, Body);
762
+ app.component(Footer.name, Footer);
1189
763
  if (!inBrowser) {
1190
764
  return;
1191
765
  }
@@ -1196,7 +770,6 @@ var index = {
1196
770
  document.body.appendChild(anchorsContainer);
1197
771
  }
1198
772
  app.provide(ModalService.token, new ModalService(anchorsContainer));
1199
- app.provide(DialogService.token, new DialogService(anchorsContainer));
1200
773
  }
1201
774
  };
1202
- export { Modal, index as default };
775
+ export { Modal, index as default, modalProps };