vue-devui 1.0.0-beta.7 → 1.0.0-pre.0

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 (303) hide show
  1. package/README.md +81 -66
  2. package/accordion/index.es.js +522 -39
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +7 -8
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/{toast → auto-complete}/index.d.ts +0 -0
  9. package/auto-complete/index.es.js +976 -0
  10. package/auto-complete/index.umd.js +1 -0
  11. package/auto-complete/package.json +7 -0
  12. package/auto-complete/style.css +1 -0
  13. package/avatar/index.es.js +1 -1
  14. package/avatar/index.umd.js +1 -1
  15. package/back-top/index.es.js +1 -1
  16. package/back-top/index.umd.js +1 -1
  17. package/badge/index.es.js +13 -19
  18. package/badge/index.umd.js +1 -1
  19. package/button/index.es.js +263 -83
  20. package/button/index.umd.js +1 -1
  21. package/button/style.css +1 -1
  22. package/card/index.es.js +1 -1
  23. package/card/index.umd.js +1 -1
  24. package/carousel/index.es.js +7 -6
  25. package/carousel/index.umd.js +1 -1
  26. package/cascader/index.es.js +5393 -773
  27. package/cascader/index.umd.js +27 -1
  28. package/checkbox/index.es.js +1 -1
  29. package/checkbox/index.umd.js +1 -1
  30. package/checkbox/style.css +1 -1
  31. package/color-picker/index.d.ts +7 -0
  32. package/color-picker/index.es.js +8187 -0
  33. package/color-picker/index.umd.js +27 -0
  34. package/color-picker/package.json +7 -0
  35. package/color-picker/style.css +1 -0
  36. package/comment/index.es.js +42 -13
  37. package/comment/index.umd.js +1 -1
  38. package/comment/style.css +1 -1
  39. package/countdown/index.d.ts +7 -0
  40. package/countdown/index.es.js +176 -0
  41. package/countdown/index.umd.js +1 -0
  42. package/countdown/package.json +7 -0
  43. package/countdown/style.css +1 -0
  44. package/date-picker/index.es.js +11 -12
  45. package/date-picker/index.umd.js +1 -1
  46. package/date-picker/style.css +1 -1
  47. package/dragdrop/index.es.js +135 -10
  48. package/dragdrop/index.umd.js +1 -1
  49. package/drawer/index.es.js +173 -203
  50. package/drawer/index.umd.js +1 -1
  51. package/drawer/style.css +1 -1
  52. package/dropdown/index.es.js +412 -302
  53. package/dropdown/index.umd.js +1 -1
  54. package/dropdown/style.css +1 -1
  55. package/editable-select/index.es.js +275 -5610
  56. package/editable-select/index.umd.js +1 -27
  57. package/editable-select/style.css +1 -1
  58. package/form/index.es.js +6129 -461
  59. package/form/index.umd.js +27 -1
  60. package/form/style.css +1 -1
  61. package/fullscreen/index.es.js +111 -119
  62. package/fullscreen/index.umd.js +1 -1
  63. package/fullscreen/style.css +1 -1
  64. package/gantt/index.es.js +6 -18
  65. package/gantt/index.umd.js +1 -1
  66. package/gantt/style.css +1 -1
  67. package/grid/index.es.js +3 -3
  68. package/grid/index.umd.js +1 -1
  69. package/grid/style.css +1 -1
  70. package/icon/index.es.js +3 -2
  71. package/icon/index.umd.js +1 -1
  72. package/image-preview/index.es.js +78 -20
  73. package/image-preview/index.umd.js +1 -1
  74. package/image-preview/style.css +1 -1
  75. package/input/index.es.js +5 -6
  76. package/input/index.umd.js +1 -1
  77. package/input/style.css +1 -1
  78. package/input-icon/index.es.js +6 -6
  79. package/input-icon/index.umd.js +1 -1
  80. package/input-icon/style.css +1 -1
  81. package/input-number/index.es.js +2 -1
  82. package/input-number/index.umd.js +1 -1
  83. package/layout/index.es.js +1 -1
  84. package/layout/index.umd.js +1 -1
  85. package/list/index.d.ts +7 -0
  86. package/list/index.es.js +39 -0
  87. package/list/index.umd.js +1 -0
  88. package/{toast → list}/package.json +1 -1
  89. package/list/style.css +1 -0
  90. package/loading/index.es.js +3 -3
  91. package/loading/index.umd.js +1 -1
  92. package/modal/index.es.js +297 -761
  93. package/modal/index.umd.js +1 -1
  94. package/modal/style.css +1 -1
  95. package/nav-sprite/index.es.js +1 -675
  96. package/nav-sprite/index.umd.js +1 -1
  97. package/notification/index.d.ts +7 -0
  98. package/notification/index.es.js +286 -0
  99. package/notification/index.umd.js +1 -0
  100. package/notification/package.json +7 -0
  101. package/notification/style.css +1 -0
  102. package/nuxt/components/Accordion.js +3 -0
  103. package/nuxt/components/Alert.js +3 -0
  104. package/nuxt/components/Anchor.js +3 -0
  105. package/nuxt/components/Aside.js +3 -0
  106. package/nuxt/components/AutoComplete.js +3 -0
  107. package/nuxt/components/Avatar.js +3 -0
  108. package/nuxt/components/BackTop.js +3 -0
  109. package/nuxt/components/Badge.js +3 -0
  110. package/nuxt/components/Breadcrumb.js +3 -0
  111. package/nuxt/components/Button.js +3 -0
  112. package/nuxt/components/Card.js +3 -0
  113. package/nuxt/components/Carousel.js +3 -0
  114. package/nuxt/components/CarouselItem.js +3 -0
  115. package/nuxt/components/Cascader.js +3 -0
  116. package/nuxt/components/Checkbox.js +3 -0
  117. package/nuxt/components/Col.js +3 -0
  118. package/nuxt/components/ColorPicker.js +3 -0
  119. package/nuxt/components/Column.js +3 -0
  120. package/nuxt/components/Comment.js +3 -0
  121. package/nuxt/components/Content.js +3 -0
  122. package/nuxt/components/Countdown.js +3 -0
  123. package/nuxt/components/DatePicker.js +3 -0
  124. package/nuxt/components/Drawer.js +3 -0
  125. package/nuxt/components/DrawerService.js +3 -0
  126. package/nuxt/components/Dropdown.js +3 -0
  127. package/nuxt/components/DropdownMenu.js +3 -0
  128. package/nuxt/components/EditableSelect.js +3 -0
  129. package/nuxt/components/FixedOverlay.js +3 -0
  130. package/nuxt/components/FlexibleOverlay.js +3 -0
  131. package/nuxt/components/Footer.js +3 -0
  132. package/nuxt/components/Form.js +3 -0
  133. package/nuxt/components/FormControl.js +3 -0
  134. package/nuxt/components/FormItem.js +3 -0
  135. package/nuxt/components/FormLabel.js +3 -0
  136. package/nuxt/components/FormOperation.js +3 -0
  137. package/nuxt/components/Fullscreen.js +3 -0
  138. package/nuxt/components/Gantt.js +3 -0
  139. package/nuxt/components/Header.js +3 -0
  140. package/nuxt/components/IFileOptions.js +3 -0
  141. package/nuxt/components/IUploadOptions.js +3 -0
  142. package/nuxt/components/Icon.js +2 -0
  143. package/nuxt/components/ImagePreviewService.js +3 -0
  144. package/nuxt/components/Input.js +3 -0
  145. package/nuxt/components/InputIcon.js +3 -0
  146. package/nuxt/components/InputNumber.js +3 -0
  147. package/nuxt/components/Layout.js +3 -0
  148. package/nuxt/components/List.js +3 -0
  149. package/nuxt/components/ListItem.js +3 -0
  150. package/nuxt/components/Loading.js +3 -0
  151. package/nuxt/components/LoadingService.js +3 -0
  152. package/nuxt/components/Modal.js +3 -0
  153. package/nuxt/components/NavSprite.js +2 -0
  154. package/nuxt/components/Notification.js +3 -0
  155. package/nuxt/components/NotificationService.js +3 -0
  156. package/nuxt/components/Pagination.js +3 -0
  157. package/nuxt/components/Panel.js +3 -0
  158. package/nuxt/components/Popover.js +3 -0
  159. package/nuxt/components/Progress.js +3 -0
  160. package/nuxt/components/QuadrantDiagram.js +3 -0
  161. package/nuxt/components/Radio.js +3 -0
  162. package/nuxt/components/RadioGroup.js +3 -0
  163. package/nuxt/components/Rate.js +3 -0
  164. package/nuxt/components/ReadTip.js +3 -0
  165. package/nuxt/components/Result.js +3 -0
  166. package/nuxt/components/Row.js +3 -0
  167. package/nuxt/components/Search.js +3 -0
  168. package/nuxt/components/Select.js +3 -0
  169. package/nuxt/components/Skeleton.js +3 -0
  170. package/nuxt/components/SkeletonItem.js +3 -0
  171. package/nuxt/components/Slider.js +3 -0
  172. package/nuxt/components/Splitter.js +3 -0
  173. package/nuxt/components/Statistic.js +3 -0
  174. package/nuxt/components/Status.js +3 -0
  175. package/nuxt/components/StepsGuide.js +3 -0
  176. package/nuxt/components/StickSlider.js +3 -0
  177. package/nuxt/components/Sticky.js +2 -0
  178. package/nuxt/components/Switch.js +3 -0
  179. package/nuxt/components/Table.js +3 -0
  180. package/nuxt/components/Tabs.js +3 -0
  181. package/nuxt/components/Tag.js +3 -0
  182. package/nuxt/components/TagInput.js +3 -0
  183. package/nuxt/components/Textarea.js +3 -0
  184. package/nuxt/components/TimeAxis.js +3 -0
  185. package/nuxt/components/TimeAxisItem.js +3 -0
  186. package/nuxt/components/TimePicker.js +3 -0
  187. package/nuxt/components/Tooltip.js +3 -0
  188. package/nuxt/components/Transfer.js +3 -0
  189. package/nuxt/components/Tree.js +3 -0
  190. package/nuxt/components/TreeSelect.js +3 -0
  191. package/nuxt/components/Upload.js +3 -0
  192. package/nuxt/components/UploadStatus.js +3 -0
  193. package/nuxt/components/badgeProps.js +3 -0
  194. package/nuxt/components/buttonProps.js +3 -0
  195. package/nuxt/components/dropdownMenuProps.js +3 -0
  196. package/nuxt/components/fixedOverlayProps.js +3 -0
  197. package/nuxt/components/flexibleOverlayProps.js +3 -0
  198. package/nuxt/components/notificationProps.js +3 -0
  199. package/nuxt/components/overlayEmits.js +3 -0
  200. package/nuxt/components/overlayProps.js +3 -0
  201. package/nuxt/components/popoverProps.js +3 -0
  202. package/nuxt/components/tooltipProps.js +3 -0
  203. package/nuxt/components/uploadProps.js +3 -0
  204. package/nuxt/index.js +13 -0
  205. package/overlay/index.es.js +146 -200
  206. package/overlay/index.umd.js +1 -1
  207. package/overlay/style.css +1 -1
  208. package/package.json +10 -18
  209. package/pagination/index.es.js +4 -4
  210. package/pagination/index.umd.js +1 -1
  211. package/pagination/style.css +1 -1
  212. package/panel/index.es.js +3 -3
  213. package/panel/index.umd.js +1 -1
  214. package/popover/index.es.js +5948 -190
  215. package/popover/index.umd.js +27 -1
  216. package/popover/style.css +1 -1
  217. package/progress/index.es.js +9 -9
  218. package/progress/index.umd.js +3 -3
  219. package/quadrant-diagram/index.es.js +5405 -166
  220. package/quadrant-diagram/index.umd.js +27 -1
  221. package/radio/index.es.js +6 -6
  222. package/radio/index.umd.js +1 -1
  223. package/radio/style.css +1 -1
  224. package/rate/index.es.js +1 -1
  225. package/rate/index.umd.js +1 -1
  226. package/read-tip/index.es.js +21 -7
  227. package/read-tip/index.umd.js +1 -1
  228. package/read-tip/style.css +1 -1
  229. package/result/index.d.ts +7 -0
  230. package/result/index.es.js +119 -0
  231. package/result/index.umd.js +1 -0
  232. package/result/package.json +7 -0
  233. package/result/style.css +1 -0
  234. package/ripple/index.es.js +6 -3
  235. package/ripple/index.umd.js +1 -1
  236. package/search/index.es.js +5435 -201
  237. package/search/index.umd.js +27 -1
  238. package/search/style.css +1 -1
  239. package/select/index.es.js +3 -2
  240. package/select/index.umd.js +1 -1
  241. package/select/style.css +1 -1
  242. package/skeleton/index.es.js +1 -1
  243. package/skeleton/index.umd.js +1 -1
  244. package/slider/index.es.js +3 -6
  245. package/slider/index.umd.js +1 -1
  246. package/slider/style.css +1 -1
  247. package/splitter/index.es.js +5904 -60
  248. package/splitter/index.umd.js +27 -1
  249. package/splitter/style.css +1 -1
  250. package/statistic/index.d.ts +7 -0
  251. package/statistic/index.es.js +267 -0
  252. package/statistic/index.umd.js +1 -0
  253. package/statistic/package.json +7 -0
  254. package/statistic/style.css +1 -0
  255. package/status/index.es.js +2 -2
  256. package/status/index.umd.js +1 -1
  257. package/status/style.css +1 -1
  258. package/steps-guide/index.es.js +8 -6
  259. package/steps-guide/index.umd.js +1 -1
  260. package/sticky/index.umd.js +1 -1
  261. package/style.css +1 -1
  262. package/switch/index.es.js +1 -1
  263. package/switch/index.umd.js +1 -1
  264. package/table/index.es.js +701 -359
  265. package/table/index.umd.js +1 -1
  266. package/table/style.css +1 -1
  267. package/tabs/index.es.js +3 -4
  268. package/tabs/index.umd.js +1 -1
  269. package/tabs/style.css +1 -1
  270. package/tag/index.es.js +37 -11
  271. package/tag/index.umd.js +1 -1
  272. package/tag/style.css +1 -1
  273. package/tag-input/index.es.js +1 -13
  274. package/tag-input/index.umd.js +1 -1
  275. package/textarea/index.es.js +1 -1
  276. package/textarea/index.umd.js +1 -1
  277. package/textarea/style.css +1 -1
  278. package/{theme → theme/theme.scss} +0 -0
  279. package/time-axis/index.es.js +5 -2
  280. package/time-axis/index.umd.js +1 -1
  281. package/time-picker/index.es.js +269 -84
  282. package/time-picker/index.umd.js +1 -1
  283. package/time-picker/style.css +1 -1
  284. package/tooltip/index.es.js +5798 -141
  285. package/tooltip/index.umd.js +27 -1
  286. package/tooltip/style.css +1 -1
  287. package/transfer/index.es.js +6522 -635
  288. package/transfer/index.umd.js +27 -1
  289. package/transfer/style.css +1 -1
  290. package/tree/index.es.js +5858 -146
  291. package/tree/index.umd.js +27 -1
  292. package/tree/style.css +1 -1
  293. package/tree-select/index.es.js +130 -35
  294. package/tree-select/index.umd.js +1 -1
  295. package/tree-select/style.css +1 -1
  296. package/upload/index.es.js +464 -2681
  297. package/upload/index.umd.js +1 -1
  298. package/upload/style.css +1 -1
  299. package/vue-devui.es.js +15597 -14569
  300. package/vue-devui.umd.js +16 -16
  301. package/toast/index.es.js +0 -2059
  302. package/toast/index.umd.js +0 -1
  303. package/toast/style.css +0 -1
@@ -0,0 +1,3 @@
1
+ import '../../result/style.css'
2
+
3
+ export { Result as default } from '../../result/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { Row as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../search/style.css'
2
+
3
+ export { Search as default } from '../../search/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../select/style.css'
2
+
3
+ export { Select as default } from '../../select/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../skeleton/style.css'
2
+
3
+ export { Skeleton as default } from '../../skeleton/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../skeleton/style.css'
2
+
3
+ export { SkeletonItem as default } from '../../skeleton/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../slider/style.css'
2
+
3
+ export { Slider as default } from '../../slider/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../splitter/style.css'
2
+
3
+ export { Splitter as default } from '../../splitter/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../statistic/style.css'
2
+
3
+ export { Statistic as default } from '../../statistic/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../status/style.css'
2
+
3
+ export { Status as default } from '../../status/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../steps-guide/style.css'
2
+
3
+ export { StepsGuide as default } from '../../steps-guide/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../date-picker/style.css'
2
+
3
+ export { StickSlider as default } from '../../date-picker/index.es.js'
@@ -0,0 +1,2 @@
1
+
2
+ export { Sticky as default } from '../../sticky/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../switch/style.css'
2
+
3
+ export { Switch as default } from '../../switch/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../table/style.css'
2
+
3
+ export { Table as default } from '../../table/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tabs/style.css'
2
+
3
+ export { Tabs as default } from '../../tabs/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tag/style.css'
2
+
3
+ export { Tag as default } from '../../tag/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tag-input/style.css'
2
+
3
+ export { TagInput as default } from '../../tag-input/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../textarea/style.css'
2
+
3
+ export { Textarea as default } from '../../textarea/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../time-axis/style.css'
2
+
3
+ export { TimeAxis as default } from '../../time-axis/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../time-axis/style.css'
2
+
3
+ export { TimeAxisItem as default } from '../../time-axis/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../time-picker/style.css'
2
+
3
+ export { TimePicker as default } from '../../time-picker/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tooltip/style.css'
2
+
3
+ export { Tooltip as default } from '../../tooltip/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../transfer/style.css'
2
+
3
+ export { Transfer as default } from '../../transfer/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tree/style.css'
2
+
3
+ export { Tree as default } from '../../tree/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tree-select/style.css'
2
+
3
+ export { TreeSelect as default } from '../../tree-select/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../upload/style.css'
2
+
3
+ export { Upload as default } from '../../upload/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../upload/style.css'
2
+
3
+ export { UploadStatus as default } from '../../upload/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../badge/style.css'
2
+
3
+ export { badgeProps as default } from '../../badge/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../button/style.css'
2
+
3
+ export { buttonProps as default } from '../../button/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../dropdown/style.css'
2
+
3
+ export { dropdownMenuProps as default } from '../../dropdown/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../overlay/style.css'
2
+
3
+ export { fixedOverlayProps as default } from '../../overlay/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../overlay/style.css'
2
+
3
+ export { flexibleOverlayProps as default } from '../../overlay/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../notification/style.css'
2
+
3
+ export { notificationProps as default } from '../../notification/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../overlay/style.css'
2
+
3
+ export { overlayEmits as default } from '../../overlay/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../overlay/style.css'
2
+
3
+ export { overlayProps as default } from '../../overlay/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../popover/style.css'
2
+
3
+ export { popoverProps as default } from '../../popover/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tooltip/style.css'
2
+
3
+ export { tooltipProps as default } from '../../tooltip/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../upload/style.css'
2
+
3
+ export { uploadProps as default } from '../../upload/index.es.js'
package/nuxt/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { join } from 'pathe'
2
+ import { defineNuxtModule } from '@nuxt/kit'
3
+
4
+ export default defineNuxtModule({
5
+ hooks: {
6
+ 'components:dirs'(dirs) {
7
+ dirs.push({
8
+ path: join(__dirname,'./components'),
9
+ prefix:'D'
10
+ })
11
+ }
12
+ }
13
+ })
@@ -17,7 +17,8 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef } from "vue";
20
+ import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, nextTick, unref, mergeProps } from "vue";
21
+ import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
21
22
  var overlay = "";
22
23
  function _isSlot(s) {
23
24
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -42,9 +43,6 @@ const overlayProps = {
42
43
  visible: {
43
44
  type: Boolean
44
45
  },
45
- "onUpdate:visible": {
46
- type: Function
47
- },
48
46
  backgroundBlock: {
49
47
  type: Boolean,
50
48
  default: false
@@ -56,7 +54,7 @@ const overlayProps = {
56
54
  backgroundStyle: {
57
55
  type: [String, Object]
58
56
  },
59
- backdropClick: {
57
+ onBackdropClick: {
60
58
  type: Function
61
59
  },
62
60
  backdropClose: {
@@ -68,28 +66,44 @@ const overlayProps = {
68
66
  default: true
69
67
  }
70
68
  };
69
+ const overlayEmits = ["update:visible", "backdropClick"];
71
70
  const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
72
71
  overlayStyle: {
73
72
  type: [String, Object],
74
73
  default: void 0
75
74
  }
76
75
  });
77
- const flexibleOverlayProps = __spreadValues({
76
+ const flexibleOverlayProps = {
77
+ modelValue: {
78
+ type: Boolean,
79
+ default: false
80
+ },
78
81
  origin: {
79
82
  type: Object,
80
83
  require: true
81
84
  },
82
85
  position: {
83
- type: Object,
84
- default: () => ({
85
- originX: "left",
86
- originY: "top",
87
- overlayX: "left",
88
- overlayY: "top"
89
- })
86
+ type: Array,
87
+ default: ["bottom"]
88
+ },
89
+ offset: {
90
+ type: [Number, Object],
91
+ default: 8
92
+ },
93
+ align: {
94
+ type: String,
95
+ default: null
96
+ },
97
+ showArrow: {
98
+ type: Boolean,
99
+ default: false
100
+ },
101
+ isArrowCenter: {
102
+ type: Boolean,
103
+ default: true
90
104
  }
91
- }, overlayProps);
92
- function useOverlayLogic(props) {
105
+ };
106
+ function useOverlayLogic(props, ctx) {
93
107
  const backgroundClass = computed(() => {
94
108
  return [
95
109
  "devui-overlay-background",
@@ -101,11 +115,11 @@ function useOverlayLogic(props) {
101
115
  return "devui-overlay";
102
116
  });
103
117
  const handleBackdropClick = (event) => {
104
- var _a, _b;
118
+ var _a;
105
119
  event.preventDefault();
106
- (_a = props.backdropClick) == null ? void 0 : _a.call(props);
120
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
107
121
  if (props.backdropClose) {
108
- (_b = props["onUpdate:visible"]) == null ? void 0 : _b.call(props, false);
122
+ ctx.emit("update:visible", false);
109
123
  }
110
124
  };
111
125
  const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
@@ -142,15 +156,16 @@ function useOverlayLogic(props) {
142
156
  const FixedOverlay = defineComponent({
143
157
  name: "DFixedOverlay",
144
158
  props: fixedOverlayProps,
159
+ emits: overlayEmits,
145
160
  setup(props, ctx) {
146
161
  const {
147
162
  backgroundClass,
148
163
  overlayClass,
149
164
  handleBackdropClick,
150
165
  handleOverlayBubbleCancel
151
- } = useOverlayLogic(props);
166
+ } = useOverlayLogic(props, ctx);
152
167
  return () => createVNode(CommonOverlay, null, {
153
- default: () => [withDirectives(createVNode("div", {
168
+ default: () => [props.visible && createVNode("div", {
154
169
  "class": backgroundClass.value,
155
170
  "style": props.backgroundStyle,
156
171
  "onClick": handleBackdropClick
@@ -158,203 +173,134 @@ const FixedOverlay = defineComponent({
158
173
  "class": overlayClass.value,
159
174
  "style": props.overlayStyle,
160
175
  "onClick": handleOverlayBubbleCancel
161
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
176
+ }, [renderSlot(ctx.slots, "default")])])]
162
177
  });
163
178
  }
164
179
  });
165
- function isComponent(target) {
166
- return !!(target == null ? void 0 : target.$el);
167
- }
168
- function getElement(element) {
169
- if (element instanceof Element) {
170
- return element;
180
+ function getScrollParent(element) {
181
+ const overflowRegex = /(auto|scroll|hidden)/;
182
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
183
+ const style = window.getComputedStyle(parent);
184
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
185
+ return parent;
186
+ }
171
187
  }
172
- if (element && typeof element === "object" && element.$el instanceof Element) {
173
- return element.$el;
188
+ return window;
189
+ }
190
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
191
+ let { x, y } = point;
192
+ if (!isArrowCenter) {
193
+ const { width, height } = originRect;
194
+ if (x && placement.includes("start")) {
195
+ x = 12;
196
+ }
197
+ if (x && placement.includes("end")) {
198
+ x = Math.round(width - 24);
199
+ }
200
+ if (y && placement.includes("start")) {
201
+ y = 10;
202
+ }
203
+ if (y && placement.includes("end")) {
204
+ y = height - 14;
205
+ }
174
206
  }
175
- return null;
207
+ return { x, y };
208
+ }
209
+ function useOverlay(props, emit) {
210
+ const overlayRef = ref();
211
+ const arrowRef = ref();
212
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
213
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
214
+ const staticSide = {
215
+ top: "bottom",
216
+ right: "left",
217
+ bottom: "top",
218
+ left: "right"
219
+ }[placement.split("-")[0]];
220
+ Object.assign(arrowEl.style, {
221
+ left: x ? `${x}px` : "",
222
+ top: y ? `${y}px` : "",
223
+ right: "",
224
+ bottom: "",
225
+ [staticSide]: "-4px"
226
+ });
227
+ };
228
+ const updatePosition = async () => {
229
+ const hostEl = props.origin;
230
+ const overlayEl = unref(overlayRef.value);
231
+ const arrowEl = unref(arrowRef.value);
232
+ const middleware = [
233
+ offset(props.offset),
234
+ autoPlacement({
235
+ alignment: props.align,
236
+ allowedPlacements: props.position
237
+ })
238
+ ];
239
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
240
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
241
+ strategy: "fixed",
242
+ middleware
243
+ });
244
+ emit("positionChange", placement);
245
+ Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
246
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
247
+ };
248
+ watch(() => props.modelValue, () => {
249
+ const originParent = getScrollParent(props.origin);
250
+ if (props.modelValue && props.origin) {
251
+ nextTick(updatePosition);
252
+ originParent.addEventListener("scroll", updatePosition);
253
+ originParent !== window && window.addEventListener("scroll", updatePosition);
254
+ window.addEventListener("resize", updatePosition);
255
+ } else {
256
+ originParent.removeEventListener("scroll", updatePosition);
257
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
258
+ window.removeEventListener("resize", updatePosition);
259
+ }
260
+ });
261
+ onUnmounted(() => {
262
+ const originParent = getScrollParent(props.origin);
263
+ originParent.removeEventListener("scroll", updatePosition);
264
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
265
+ window.removeEventListener("resize", updatePosition);
266
+ });
267
+ return { arrowRef, overlayRef };
176
268
  }
269
+ var flexibleOverlay = "";
177
270
  const FlexibleOverlay = defineComponent({
178
271
  name: "DFlexibleOverlay",
272
+ inheritAttrs: false,
179
273
  props: flexibleOverlayProps,
180
- emits: ["onUpdate:visible"],
181
- setup(props, ctx) {
182
- const overlayRef = ref(null);
183
- const positionedStyle = reactive({
184
- position: "absolute"
185
- });
186
- onMounted(async () => {
187
- const handleRectChange = (position, rect, origin) => {
188
- const point = calculatePosition(position, rect, origin);
189
- positionedStyle.left = `${point.x}px`;
190
- positionedStyle.top = `${point.y}px`;
191
- };
192
- const locationElements = computed(() => {
193
- const overlay2 = overlayRef.value;
194
- const origin = getOrigin(props.origin);
195
- if (!overlay2 || !origin) {
196
- return;
197
- }
198
- return {
199
- origin,
200
- overlay: overlay2
201
- };
202
- });
203
- const visibleRef = toRef(props, "visible");
204
- const positionRef = toRef(props, "position");
205
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
206
- if (!visible || !locationElements2) {
207
- return;
208
- }
209
- const {
210
- origin,
211
- overlay: overlay2
212
- } = locationElements2;
213
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
214
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
215
- onInvalidate(() => {
216
- unsubscriptions.forEach((fn) => fn());
217
- });
218
- });
219
- });
274
+ emits: ["update:modelValue", "positionChange"],
275
+ setup(props, {
276
+ slots,
277
+ attrs,
278
+ emit
279
+ }) {
220
280
  const {
221
- backgroundClass,
222
- overlayClass,
223
- handleBackdropClick,
224
- handleOverlayBubbleCancel
225
- } = useOverlayLogic(props);
226
- return () => createVNode(CommonOverlay, null, {
227
- default: () => [withDirectives(createVNode("div", {
228
- "style": props.backgroundStyle,
229
- "class": backgroundClass.value,
230
- "onClick": handleBackdropClick
231
- }, [createVNode("div", {
281
+ arrowRef,
282
+ overlayRef
283
+ } = useOverlay(props, emit);
284
+ return () => {
285
+ var _a;
286
+ return props.modelValue && createVNode("div", mergeProps({
232
287
  "ref": overlayRef,
233
- "class": overlayClass.value,
234
- "style": positionedStyle,
235
- "onClick": handleOverlayBubbleCancel
236
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
237
- });
288
+ "class": "devui-flexible-overlay"
289
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
290
+ "ref": arrowRef,
291
+ "class": "devui-flexible-overlay-arrow"
292
+ }, null)]);
293
+ };
238
294
  }
239
295
  });
240
- function getOrigin(origin) {
241
- if (origin instanceof Element) {
242
- return origin;
243
- }
244
- if (isRef(origin)) {
245
- return getElement(origin.value);
246
- }
247
- if (isComponent(origin)) {
248
- return getElement(origin);
249
- }
250
- return origin;
251
- }
252
- function calculatePosition(position, rect, origin) {
253
- const originRect = getOriginRect(origin);
254
- const originPoint = getOriginRelativePoint(originRect, position);
255
- return getOverlayPoint(originPoint, rect, position);
256
- }
257
- function getOriginRect(origin) {
258
- if (origin instanceof Element) {
259
- return origin.getBoundingClientRect();
260
- }
261
- const width = origin.width || 0;
262
- const height = origin.height || 0;
263
- return {
264
- top: origin.y,
265
- bottom: origin.y + height,
266
- left: origin.x,
267
- right: origin.x + width,
268
- height,
269
- width
270
- };
271
- }
272
- function getOverlayPoint(originPoint, rect, position) {
273
- let x;
274
- const {
275
- width,
276
- height
277
- } = rect;
278
- if (position.overlayX == "center") {
279
- x = originPoint.x - width / 2;
280
- } else {
281
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
282
- }
283
- let y;
284
- if (position.overlayY == "center") {
285
- y = originPoint.y - height / 2;
286
- } else {
287
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
288
- }
289
- return {
290
- x,
291
- y
292
- };
293
- }
294
- function getOriginRelativePoint(originRect, position) {
295
- let x;
296
- if (position.originX == "center") {
297
- x = originRect.left + originRect.width / 2;
298
- } else {
299
- const startX = originRect.left;
300
- const endX = originRect.right;
301
- x = position.originX == "left" ? startX : endX;
302
- }
303
- let y;
304
- if (position.originY == "center") {
305
- y = originRect.top + originRect.height / 2;
306
- } else {
307
- y = position.originY == "top" ? originRect.top : originRect.bottom;
308
- }
309
- return {
310
- x,
311
- y
312
- };
313
- }
314
- function subscribeLayoutEvent(event) {
315
- window.addEventListener("scroll", event, true);
316
- window.addEventListener("resize", event);
317
- window.addEventListener("orientationchange", event);
318
- return () => {
319
- window.removeEventListener("scroll", event, true);
320
- window.removeEventListener("resize", event);
321
- window.removeEventListener("orientationchange", event);
322
- };
323
- }
324
- function subscribeOverlayResize(overlay2, callback) {
325
- if (overlay2 instanceof Element) {
326
- const resizeObserver = new ResizeObserver(callback);
327
- resizeObserver.observe(overlay2);
328
- return () => resizeObserver.disconnect();
329
- }
330
- return () => {
331
- };
332
- }
333
- function subscribeOriginResize(origin, callback) {
334
- if (origin instanceof Element) {
335
- const observer = new MutationObserver(callback);
336
- observer.observe(origin, {
337
- attributeFilter: ["style"]
338
- });
339
- return () => observer.disconnect();
340
- }
341
- return () => {
342
- };
343
- }
344
296
  const inBrowser = typeof window !== "undefined";
345
- FlexibleOverlay.install = function(app) {
346
- app.component(FlexibleOverlay.name, FlexibleOverlay);
347
- };
348
- FixedOverlay.install = function(app) {
349
- app.component(FixedOverlay.name, FixedOverlay);
350
- };
351
297
  var index = {
352
298
  title: "Overlay \u906E\u7F69\u5C42",
353
299
  category: "\u901A\u7528",
354
- status: "\u5DF2\u5B8C\u6210",
300
+ status: "100%",
355
301
  install(app) {
356
- app.use(FixedOverlay);
357
- app.use(FlexibleOverlay);
302
+ app.component(FixedOverlay.name, FixedOverlay);
303
+ app.component(FlexibleOverlay.name, FlexibleOverlay);
358
304
  if (inBrowser && !document.getElementById("d-overlay-anchor")) {
359
305
  const overlayAnchor = document.createElement("div");
360
306
  overlayAnchor.setAttribute("id", "d-overlay-anchor");
@@ -366,4 +312,4 @@ var index = {
366
312
  }
367
313
  }
368
314
  };
369
- export { FixedOverlay, FlexibleOverlay, index as default };
315
+ export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps, overlayEmits, overlayProps };