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
@@ -1,359 +1,284 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef } from "vue";
21
- var overlay = "";
22
- function _isSlot(s) {
23
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
24
- }
25
- const CommonOverlay = defineComponent({
26
- setup(props, ctx) {
27
- return () => {
28
- let _slot;
29
- return createVNode(Teleport, {
30
- "to": "#d-overlay-anchor"
31
- }, {
32
- default: () => [createVNode(Transition, {
33
- "name": "devui-overlay-fade"
34
- }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
35
- default: () => [_slot]
36
- })]
37
- });
38
- };
39
- }
40
- });
41
- const overlayProps = {
42
- visible: {
43
- type: Boolean
44
- },
45
- backgroundBlock: {
1
+ import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick } from "vue";
2
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
3
+ const fixedOverlayProps = {
4
+ modelValue: {
46
5
  type: Boolean,
47
6
  default: false
48
7
  },
49
- backgroundClass: {
50
- type: String,
51
- default: ""
52
- },
53
- backgroundStyle: {
54
- type: [String, Object]
55
- },
56
- onBackdropClick: {
57
- type: Function
58
- },
59
- backdropClose: {
8
+ lockScroll: {
60
9
  type: Boolean,
61
10
  default: true
62
11
  },
63
- hasBackdrop: {
12
+ closeOnClickOverlay: {
64
13
  type: Boolean,
65
14
  default: true
66
15
  }
67
16
  };
68
- const overlayEmits = ["update:visible", "backdropClick"];
69
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
70
- overlayStyle: {
71
- type: [String, Object],
72
- default: void 0
73
- }
74
- });
75
- const flexibleOverlayProps = __spreadValues({
76
- origin: {
77
- type: Object,
78
- require: true
79
- },
80
- position: {
81
- type: Object,
82
- default: () => ({
83
- originX: "left",
84
- originY: "top",
85
- overlayX: "left",
86
- overlayY: "top"
87
- })
17
+ function lockScroll() {
18
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
19
+ const scrollTop = document.documentElement.scrollTop;
20
+ const style = document.documentElement.getAttribute("style");
21
+ document.documentElement.style.position = "fixed";
22
+ document.documentElement.style.top = `-${scrollTop}px`;
23
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
24
+ document.documentElement.style.overflowY = "scroll";
25
+ return () => {
26
+ if (style) {
27
+ document.documentElement.setAttribute("style", style);
28
+ } else {
29
+ document.documentElement.removeAttribute("style");
30
+ }
31
+ document.documentElement.scrollTop = scrollTop;
32
+ };
88
33
  }
89
- }, overlayProps);
90
- function useOverlayLogic(props, ctx) {
91
- const backgroundClass = computed(() => {
92
- return [
93
- "devui-overlay-background",
94
- props.backgroundClass,
95
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
96
- ];
97
- });
98
- const overlayClass = computed(() => {
99
- return "devui-overlay";
100
- });
101
- const handleBackdropClick = (event) => {
102
- var _a;
34
+ return;
35
+ }
36
+ function useFixedOverlay(props, ctx) {
37
+ let lockScrollCb;
38
+ const onClick = (event) => {
103
39
  event.preventDefault();
104
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
105
- if (props.backdropClose) {
106
- ctx.emit("update:visible", false);
40
+ ctx.emit("click", event);
41
+ if (props.closeOnClickOverlay) {
42
+ ctx.emit("update:modelValue", false);
107
43
  }
108
44
  };
109
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
110
- onMounted(() => {
111
- const body = document.body;
112
- const originOverflow = body.style.overflow;
113
- const originPosition = body.style.position;
114
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
115
- if (backgroundBlock) {
116
- const top = body.getBoundingClientRect().y;
117
- if (visible) {
118
- body.style.overflowY = "scroll";
119
- body.style.position = visible ? "fixed" : "";
120
- body.style.top = `${top}px`;
121
- } else {
122
- body.style.overflowY = originOverflow;
123
- body.style.position = originPosition;
124
- body.style.top = "";
125
- window.scrollTo(0, -top);
126
- }
127
- }
128
- });
129
- onUnmounted(() => {
130
- document.body.style.overflow = originOverflow;
131
- });
45
+ const removeBodyAdditions = () => {
46
+ lockScrollCb == null ? void 0 : lockScrollCb();
47
+ };
48
+ watch(() => props.modelValue, (val) => {
49
+ if (val) {
50
+ props.lockScroll && (lockScrollCb = lockScroll());
51
+ } else {
52
+ removeBodyAdditions();
53
+ }
132
54
  });
55
+ onUnmounted(removeBodyAdditions);
56
+ return { onClick };
57
+ }
58
+ function createBem(namespace, element, modifier) {
59
+ let cls = namespace;
60
+ if (element) {
61
+ cls += `__${element}`;
62
+ }
63
+ if (modifier) {
64
+ cls += `--${modifier}`;
65
+ }
66
+ return cls;
67
+ }
68
+ function useNamespace(block, needDot = false) {
69
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
70
+ const b = () => createBem(namespace);
71
+ const e = (element) => element ? createBem(namespace, element) : "";
72
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
73
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
133
74
  return {
134
- backgroundClass,
135
- overlayClass,
136
- handleBackdropClick,
137
- handleOverlayBubbleCancel
75
+ b,
76
+ e,
77
+ m,
78
+ em
138
79
  };
139
80
  }
81
+ var fixedOverlay = "";
140
82
  const FixedOverlay = defineComponent({
141
83
  name: "DFixedOverlay",
84
+ inheritAttrs: false,
142
85
  props: fixedOverlayProps,
143
- emits: overlayEmits,
86
+ emits: ["update:modelValue", "click"],
144
87
  setup(props, ctx) {
145
88
  const {
146
- backgroundClass,
147
- overlayClass,
148
- handleBackdropClick,
149
- handleOverlayBubbleCancel
150
- } = useOverlayLogic(props, ctx);
151
- return () => createVNode(CommonOverlay, null, {
152
- default: () => [withDirectives(createVNode("div", {
153
- "class": backgroundClass.value,
154
- "style": props.backgroundStyle,
155
- "onClick": handleBackdropClick
156
- }, [createVNode("div", {
157
- "class": overlayClass.value,
158
- "style": props.overlayStyle,
159
- "onClick": handleOverlayBubbleCancel
160
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
161
- });
162
- }
163
- });
164
- function isComponent(target) {
165
- return !!(target == null ? void 0 : target.$el);
166
- }
167
- function getElement(element) {
168
- if (element instanceof Element) {
169
- return element;
170
- }
171
- if (element && typeof element === "object" && element.$el instanceof Element) {
172
- return element.$el;
173
- }
174
- return null;
175
- }
176
- const FlexibleOverlay = defineComponent({
177
- name: "DFlexibleOverlay",
178
- props: flexibleOverlayProps,
179
- emits: overlayEmits,
180
- setup(props, ctx) {
181
- const overlayRef = ref(null);
182
- const positionedStyle = reactive({
183
- position: "absolute"
184
- });
185
- onMounted(async () => {
186
- const handleRectChange = (position, rect, origin) => {
187
- const point = calculatePosition(position, rect, origin);
188
- positionedStyle.left = `${point.x}px`;
189
- positionedStyle.top = `${point.y}px`;
190
- };
191
- const locationElements = computed(() => {
192
- const overlay2 = overlayRef.value;
193
- const origin = getOrigin(props.origin);
194
- if (!overlay2 || !origin) {
195
- return;
196
- }
197
- return {
198
- origin,
199
- overlay: overlay2
200
- };
201
- });
202
- const visibleRef = toRef(props, "visible");
203
- const positionRef = toRef(props, "position");
204
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
205
- if (!visible || !locationElements2) {
206
- return;
207
- }
208
- const {
209
- origin,
210
- overlay: overlay2
211
- } = locationElements2;
212
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
213
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
214
- onInvalidate(() => {
215
- unsubscriptions.forEach((fn) => fn());
216
- });
217
- });
218
- });
89
+ modelValue
90
+ } = toRefs(props);
91
+ const ns = useNamespace("fixed-overlay");
219
92
  const {
220
- backgroundClass,
221
- overlayClass,
222
- handleBackdropClick,
223
- handleOverlayBubbleCancel
224
- } = useOverlayLogic(props, ctx);
225
- return () => createVNode(CommonOverlay, null, {
226
- default: () => [withDirectives(createVNode("div", {
227
- "style": props.backgroundStyle,
228
- "class": backgroundClass.value,
229
- "onClick": handleBackdropClick
230
- }, [createVNode("div", {
231
- "ref": overlayRef,
232
- "class": overlayClass.value,
233
- "style": positionedStyle,
234
- "onClick": handleOverlayBubbleCancel
235
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
93
+ onClick
94
+ } = useFixedOverlay(props, ctx);
95
+ return () => createVNode(Transition, {
96
+ "name": ns.m("fade")
97
+ }, {
98
+ default: () => {
99
+ var _a, _b;
100
+ return [modelValue.value && createVNode("div", mergeProps({
101
+ "class": ns.b()
102
+ }, ctx.attrs, {
103
+ "onClick": onClick
104
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
105
+ }
236
106
  });
237
107
  }
238
108
  });
239
- function getOrigin(origin) {
240
- if (origin instanceof Element) {
241
- return origin;
242
- }
243
- if (isRef(origin)) {
244
- return getElement(origin.value);
245
- }
246
- if (isComponent(origin)) {
247
- return getElement(origin);
248
- }
249
- return origin;
250
- }
251
- function calculatePosition(position, rect, origin) {
252
- const originRect = getOriginRect(origin);
253
- const originPoint = getOriginRelativePoint(originRect, position);
254
- return getOverlayPoint(originPoint, rect, position);
255
- }
256
- function getOriginRect(origin) {
257
- if (origin instanceof Element) {
258
- return origin.getBoundingClientRect();
259
- }
260
- const width = origin.width || 0;
261
- const height = origin.height || 0;
262
- return {
263
- top: origin.y,
264
- bottom: origin.y + height,
265
- left: origin.x,
266
- right: origin.x + width,
267
- height,
268
- width
269
- };
270
- }
271
- function getOverlayPoint(originPoint, rect, position) {
272
- let x;
273
- const {
274
- width,
275
- height
276
- } = rect;
277
- if (position.overlayX == "center") {
278
- x = originPoint.x - width / 2;
279
- } else {
280
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
109
+ const flexibleOverlayProps = {
110
+ modelValue: {
111
+ type: Boolean,
112
+ default: false
113
+ },
114
+ origin: {
115
+ type: Object,
116
+ require: true
117
+ },
118
+ position: {
119
+ type: Array,
120
+ default: ["bottom"]
121
+ },
122
+ offset: {
123
+ type: [Number, Object],
124
+ default: 8
125
+ },
126
+ shiftOffset: {
127
+ type: Number
128
+ },
129
+ align: {
130
+ type: String,
131
+ default: null
132
+ },
133
+ showArrow: {
134
+ type: Boolean,
135
+ default: false
136
+ },
137
+ isArrowCenter: {
138
+ type: Boolean,
139
+ default: true
281
140
  }
282
- let y;
283
- if (position.overlayY == "center") {
284
- y = originPoint.y - height / 2;
285
- } else {
286
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
141
+ };
142
+ function getScrollParent(element) {
143
+ const overflowRegex = /(auto|scroll|hidden)/;
144
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
145
+ const style = window.getComputedStyle(parent);
146
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
147
+ return parent;
148
+ }
287
149
  }
288
- return {
289
- x,
290
- y
291
- };
150
+ return window;
292
151
  }
293
- function getOriginRelativePoint(originRect, position) {
294
- let x;
295
- if (position.originX == "center") {
296
- x = originRect.left + originRect.width / 2;
297
- } else {
298
- const startX = originRect.left;
299
- const endX = originRect.right;
300
- x = position.originX == "left" ? startX : endX;
301
- }
302
- let y;
303
- if (position.originY == "center") {
304
- y = originRect.top + originRect.height / 2;
305
- } else {
306
- y = position.originY == "top" ? originRect.top : originRect.bottom;
152
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
153
+ let { x, y } = point;
154
+ if (!isArrowCenter) {
155
+ const { width, height } = originRect;
156
+ if (x && placement.includes("start")) {
157
+ x = 12;
158
+ }
159
+ if (x && placement.includes("end")) {
160
+ x = Math.round(width - 24);
161
+ }
162
+ if (y && placement.includes("start")) {
163
+ y = 10;
164
+ }
165
+ if (y && placement.includes("end")) {
166
+ y = height - 14;
167
+ }
307
168
  }
308
- return {
309
- x,
310
- y
311
- };
169
+ return { x, y };
312
170
  }
313
- function subscribeLayoutEvent(event) {
314
- window.addEventListener("scroll", event, true);
315
- window.addEventListener("resize", event);
316
- window.addEventListener("orientationchange", event);
317
- return () => {
318
- window.removeEventListener("scroll", event, true);
319
- window.removeEventListener("resize", event);
320
- window.removeEventListener("orientationchange", event);
171
+ function useOverlay(props, emit) {
172
+ const overlayRef = ref();
173
+ const arrowRef = ref();
174
+ let originParent = null;
175
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
176
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
177
+ const staticSide = {
178
+ top: "bottom",
179
+ right: "left",
180
+ bottom: "top",
181
+ left: "right"
182
+ }[placement.split("-")[0]];
183
+ Object.assign(arrowEl.style, {
184
+ left: x ? `${x}px` : "",
185
+ top: y ? `${y}px` : "",
186
+ right: "",
187
+ bottom: "",
188
+ [staticSide]: "-4px"
189
+ });
321
190
  };
322
- }
323
- function subscribeOverlayResize(overlay2, callback) {
324
- if (overlay2 instanceof Element) {
325
- const resizeObserver = new ResizeObserver(callback);
326
- resizeObserver.observe(overlay2);
327
- return () => resizeObserver.disconnect();
328
- }
329
- return () => {
191
+ const updatePosition = async () => {
192
+ const hostEl = props.origin;
193
+ const overlayEl = unref(overlayRef.value);
194
+ const arrowEl = unref(arrowRef.value);
195
+ const middleware = [
196
+ offset(props.offset),
197
+ autoPlacement({
198
+ alignment: props.align,
199
+ allowedPlacements: props.position
200
+ })
201
+ ];
202
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
203
+ props.shiftOffset !== void 0 && middleware.push(shift());
204
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
205
+ strategy: "fixed",
206
+ middleware
207
+ });
208
+ let applyX = x;
209
+ let applyY = y;
210
+ if (props.shiftOffset !== void 0) {
211
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
212
+ shiftX < 0 && (applyX -= props.shiftOffset);
213
+ shiftX > 0 && (applyX += props.shiftOffset);
214
+ shiftY < 0 && (applyY -= props.shiftOffset);
215
+ shiftY > 0 && (applyY += props.shiftOffset);
216
+ }
217
+ emit("positionChange", placement);
218
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
219
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
330
220
  };
221
+ watch(() => props.modelValue, () => {
222
+ if (props.modelValue && props.origin) {
223
+ originParent = getScrollParent(props.origin);
224
+ nextTick(updatePosition);
225
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
226
+ originParent !== window && window.addEventListener("scroll", updatePosition);
227
+ window.addEventListener("resize", updatePosition);
228
+ } else {
229
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
230
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
231
+ window.removeEventListener("resize", updatePosition);
232
+ }
233
+ });
234
+ onUnmounted(() => {
235
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
236
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
237
+ window.removeEventListener("resize", updatePosition);
238
+ });
239
+ return { arrowRef, overlayRef, updatePosition };
331
240
  }
332
- function subscribeOriginResize(origin, callback) {
333
- if (origin instanceof Element) {
334
- const observer = new MutationObserver(callback);
335
- observer.observe(origin, {
336
- attributeFilter: ["style"]
241
+ var flexibleOverlay = "";
242
+ const FlexibleOverlay = defineComponent({
243
+ name: "DFlexibleOverlay",
244
+ inheritAttrs: false,
245
+ props: flexibleOverlayProps,
246
+ emits: ["update:modelValue", "positionChange"],
247
+ setup(props, {
248
+ slots,
249
+ attrs,
250
+ emit,
251
+ expose
252
+ }) {
253
+ const ns = useNamespace("flexible-overlay");
254
+ const {
255
+ arrowRef,
256
+ overlayRef,
257
+ updatePosition
258
+ } = useOverlay(props, emit);
259
+ expose({
260
+ updatePosition
337
261
  });
338
- return () => observer.disconnect();
262
+ return () => {
263
+ var _a;
264
+ return props.modelValue && createVNode("div", mergeProps({
265
+ "ref": overlayRef,
266
+ "class": ns.b()
267
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
268
+ "ref": arrowRef,
269
+ "class": ns.e("arrow")
270
+ }, null)]);
271
+ };
339
272
  }
340
- return () => {
341
- };
342
- }
273
+ });
343
274
  const inBrowser = typeof window !== "undefined";
344
- FlexibleOverlay.install = function(app) {
345
- app.component(FlexibleOverlay.name, FlexibleOverlay);
346
- };
347
- FixedOverlay.install = function(app) {
348
- app.component(FixedOverlay.name, FixedOverlay);
349
- };
350
275
  var index = {
351
276
  title: "Overlay \u906E\u7F69\u5C42",
352
277
  category: "\u901A\u7528",
353
278
  status: "100%",
354
279
  install(app) {
355
- app.use(FixedOverlay);
356
- app.use(FlexibleOverlay);
280
+ app.component(FixedOverlay.name, FixedOverlay);
281
+ app.component(FlexibleOverlay.name, FlexibleOverlay);
357
282
  if (inBrowser && !document.getElementById("d-overlay-anchor")) {
358
283
  const overlayAnchor = document.createElement("div");
359
284
  overlayAnchor.setAttribute("id", "d-overlay-anchor");
@@ -365,4 +290,4 @@ var index = {
365
290
  }
366
291
  }
367
292
  };
368
- export { FixedOverlay, FlexibleOverlay, index as default };
293
+ export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps };
@@ -1 +1 @@
1
- var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var F=(l,t,a)=>t in l?J(l,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[t]=a,B=(l,t)=>{for(var a in t||(t={}))W.call(t,a)&&F(l,a,t[a]);if(V)for(var a of V(t))Z.call(t,a)&&F(l,a,t[a]);return l},N=(l,t)=>K(l,Q(t));(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.index={},l.Vue))})(this,function(l,t){"use strict";var a="";function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const x=t.defineComponent({setup(e,n){return()=>{let o;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},L(o=t.renderSlot(n.slots,"default"))?o:{default:()=>[o]})]})}}}),E={visible:{type:Boolean},backgroundBlock:{type:Boolean,default:!1},backgroundClass:{type:String,default:""},backgroundStyle:{type:[String,Object]},onBackdropClick:{type:Function},backdropClose:{type:Boolean,default:!0},hasBackdrop:{type:Boolean,default:!0}},S=["update:visible","backdropClick"],X=N(B({},E),{overlayStyle:{type:[String,Object],default:void 0}}),Y=B({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},E);function R(e,n){const o=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),i=t.computed(()=>"devui-overlay"),c=r=>{var d;r.preventDefault(),(d=e.onBackdropClick)==null||d.call(e),e.backdropClose&&n.emit("update:visible",!1)},s=r=>r.cancelBubble=!0;return t.onMounted(()=>{const r=document.body,d=r.style.overflow,f=r.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([p,w])=>{if(w){const C=r.getBoundingClientRect().y;p?(r.style.overflowY="scroll",r.style.position=p?"fixed":"",r.style.top=`${C}px`):(r.style.overflowY=d,r.style.position=f,r.style.top="",window.scrollTo(0,-C))}}),t.onUnmounted(()=>{document.body.style.overflow=d})}),{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}}const v=t.defineComponent({name:"DFixedOverlay",props:X,emits:S,setup(e,n){const{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}=R(e,n);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{class:o.value,style:e.backgroundStyle,onClick:c},[t.createVNode("div",{class:i.value,style:e.overlayStyle,onClick:s},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function _(e){return!!(e==null?void 0:e.$el)}function j(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}const h=t.defineComponent({name:"DFlexibleOverlay",props:Y,emits:S,setup(e,n){const o=t.ref(null),i=t.reactive({position:"absolute"});t.onMounted(async()=>{const f=(u,y,b)=>{const g=T(u,y,b);i.left=`${g.x}px`,i.top=`${g.y}px`},p=t.computed(()=>{const u=o.value,y=z(e.origin);if(!(!u||!y))return{origin:y,overlay:u}}),w=t.toRef(e,"visible"),C=t.toRef(e,"position");t.watch([p,w,C],async([u,y,b],g,G)=>{if(!y||!u)return;const{origin:m,overlay:k}=u;f(b,k.getBoundingClientRect(),m);const H=[P(()=>f(b,k.getBoundingClientRect(),m)),A(k,O=>f(b,O[0].contentRect,m)),q(m,()=>f(b,k.getBoundingClientRect(),m))];G(()=>{H.forEach(O=>O())})})});const{backgroundClass:c,overlayClass:s,handleBackdropClick:r,handleOverlayBubbleCancel:d}=R(e,n);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:c.value,onClick:r},[t.createVNode("div",{ref:o,class:s.value,style:i,onClick:d},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function z(e){return e instanceof Element?e:t.isRef(e)?j(e.value):_(e)?j(e):e}function T(e,n,o){const i=$(o),c=M(i,e);return D(c,n,e)}function $(e){if(e instanceof Element)return e.getBoundingClientRect();const n=e.width||0,o=e.height||0;return{top:e.y,bottom:e.y+o,left:e.x,right:e.x+n,height:o,width:n}}function D(e,n,o){let i;const{width:c,height:s}=n;o.overlayX=="center"?i=e.x-c/2:i=o.overlayX=="left"?e.x:e.x-c;let r;return o.overlayY=="center"?r=e.y-s/2:r=o.overlayY=="top"?e.y:e.y-s,{x:i,y:r}}function M(e,n){let o;if(n.originX=="center")o=e.left+e.width/2;else{const c=e.left,s=e.right;o=n.originX=="left"?c:s}let i;return n.originY=="center"?i=e.top+e.height/2:i=n.originY=="top"?e.top:e.bottom,{x:o,y:i}}function P(e){return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}function A(e,n){if(e instanceof Element){const o=new ResizeObserver(n);return o.observe(e),()=>o.disconnect()}return()=>{}}function q(e,n){if(e instanceof Element){const o=new MutationObserver(n);return o.observe(e,{attributeFilter:["style"]}),()=>o.disconnect()}return()=>{}}const I=typeof window!="undefined";h.install=function(e){e.component(h.name,h)},v.install=function(e){e.component(v.name,v)};var U={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.use(v),e.use(h),I&&!document.getElementById("d-overlay-anchor")){const n=document.createElement("div");n.setAttribute("id","d-overlay-anchor"),n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.zIndex="1000",document.body.appendChild(n)}}};l.FixedOverlay=v,l.FlexibleOverlay=h,l.default=U,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
1
+ (function(a,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],l):(a=typeof globalThis!="undefined"?globalThis:a||self,l(a.index={},a.Vue,a.dom))})(this,function(a,l,f){"use strict";const b={modelValue:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0}};function P(){if(document.documentElement.scrollHeight>document.documentElement.clientHeight){const e=document.documentElement.scrollTop,t=document.documentElement.getAttribute("style");return document.documentElement.style.position="fixed",document.documentElement.style.top=`-${e}px`,document.documentElement.style.width=document.documentElement.style.width||"100%",document.documentElement.style.overflowY="scroll",()=>{t?document.documentElement.setAttribute("style",t):document.documentElement.removeAttribute("style"),document.documentElement.scrollTop=e}}}function k(e,t){let n;const i=s=>{s.preventDefault(),t.emit("click",s),e.closeOnClickOverlay&&t.emit("update:modelValue",!1)},o=()=>{n==null||n()};return l.watch(()=>e.modelValue,s=>{s?e.lockScroll&&(n=P()):o()}),l.onUnmounted(o),{onClick:i}}function y(e,t,n){let i=e;return t&&(i+=`__${t}`),n&&(i+=`--${n}`),i}function g(e,t=!1){const n=t?`.devui-${e}`:`devui-${e}`;return{b:()=>y(n),e:d=>d?y(n,d):"",m:d=>d?y(n,"",d):"",em:(d,c)=>d&&c?y(n,d,c):""}}var j="";const O=l.defineComponent({name:"DFixedOverlay",inheritAttrs:!1,props:b,emits:["update:modelValue","click"],setup(e,t){const{modelValue:n}=l.toRefs(e),i=g("fixed-overlay"),{onClick:o}=k(e,t);return()=>l.createVNode(l.Transition,{name:i.m("fade")},{default:()=>{var s,r;return[n.value&&l.createVNode("div",l.mergeProps({class:i.b()},t.attrs,{onClick:o}),[(r=(s=t.slots).default)==null?void 0:r.call(s)])]}})}}),A={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function L(e){const t=/(auto|scroll|hidden)/;for(let n=e;n=n.parentElement;n.parentElement!==document.body){const i=window.getComputedStyle(n);if(t.test(i.overflow+i.overflowX+i.overflowY))return n}return window}function $(e,t,n,i){let{x:o,y:s}=t;if(!e){const{width:r,height:d}=i;o&&n.includes("start")&&(o=12),o&&n.includes("end")&&(o=Math.round(r-24)),s&&n.includes("start")&&(s=10),s&&n.includes("end")&&(s=d-14)}return{x:o,y:s}}function F(e,t){const n=l.ref(),i=l.ref();let o=null;const s=(d,c,u,m)=>{const{x:w,y:v}=$(e.isArrowCenter,u,c,m.getBoundingClientRect()),h={top:"bottom",right:"left",bottom:"top",left:"right"}[c.split("-")[0]];Object.assign(d.style,{left:w?`${w}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[h]:"-4px"})},r=async()=>{const d=e.origin,c=l.unref(n.value),u=l.unref(i.value),m=[f.offset(e.offset),f.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&m.push(f.arrow({element:u})),e.shiftOffset!==void 0&&m.push(f.shift());const{x:w,y:v,placement:h,middlewareData:V}=await f.computePosition(d,c,{strategy:"fixed",middleware:m});let p=w,x=v;if(e.shiftOffset!==void 0){const{x:C,y:B}=V.shift;C<0&&(p-=e.shiftOffset),C>0&&(p+=e.shiftOffset),B<0&&(x-=e.shiftOffset),B>0&&(x+=e.shiftOffset)}t("positionChange",h),Object.assign(c.style,{top:`${x}px`,left:`${p}px`}),e.showArrow&&s(u,h,V.arrow,c)};return l.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(o=L(e.origin),l.nextTick(r),o==null||o.addEventListener("scroll",r),o!==window&&window.addEventListener("scroll",r),window.addEventListener("resize",r)):(o==null||o.removeEventListener("scroll",r),o!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r))}),l.onUnmounted(()=>{o==null||o.removeEventListener("scroll",r),o!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}),{arrowRef:i,overlayRef:n,updatePosition:r}}var N="";const E=l.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:A,emits:["update:modelValue","positionChange"],setup(e,{slots:t,attrs:n,emit:i,expose:o}){const s=g("flexible-overlay"),{arrowRef:r,overlayRef:d,updatePosition:c}=F(e,i);return o({updatePosition:c}),()=>{var u;return e.modelValue&&l.createVNode("div",l.mergeProps({ref:d,class:s.b()},n),[(u=t.default)==null?void 0:u.call(t),e.showArrow&&l.createVNode("div",{ref:r,class:s.e("arrow")},null)])}}}),S=typeof window!="undefined";var T={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.component(O.name,O),e.component(E.name,E),S&&!document.getElementById("d-overlay-anchor")){const t=document.createElement("div");t.setAttribute("id","d-overlay-anchor"),t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="1000",document.body.appendChild(t)}}};a.FixedOverlay=O,a.FlexibleOverlay=E,a.default=T,a.fixedOverlayProps=b,a.flexibleOverlayProps=A,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
package/overlay/style.css CHANGED
@@ -1 +1 @@
1
- .devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay-background__disabled{pointer-events:none}@keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}
1
+ .devui-fixed-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1050}.devui-fixed-overlay--fade-enter-active,.devui-fixed-overlay--fade-leave-active{transition:opacity .1s cubic-bezier(0,0,1,1)}.devui-fixed-overlay--fade-enter-from,.devui-fixed-overlay--fade-leave-to{opacity:0}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 4px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-length-connected-overlay, 0 4px 8px 0) var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1000}.devui-flexible-overlay__arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}