vue-devui 1.0.0-beta.9 → 1.0.0-rc.1

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 (294) hide show
  1. package/README.md +100 -72
  2. package/accordion/index.es.js +525 -39
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +34 -37
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/{time-axis → auto-complete}/index.d.ts +0 -0
  9. package/auto-complete/index.es.js +983 -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/back-top/index.es.js +5 -3
  14. package/back-top/index.umd.js +1 -1
  15. package/badge/index.es.js +13 -19
  16. package/badge/index.umd.js +1 -1
  17. package/badge/style.css +1 -1
  18. package/breadcrumb/index.es.js +2 -1
  19. package/button/index.es.js +296 -117
  20. package/button/index.umd.js +1 -1
  21. package/button/style.css +1 -1
  22. package/carousel/index.es.js +43 -57
  23. package/carousel/index.umd.js +1 -1
  24. package/cascader/index.es.js +5412 -784
  25. package/cascader/index.umd.js +27 -1
  26. package/cascader/style.css +1 -1
  27. package/checkbox/style.css +1 -1
  28. package/{toast → color-picker}/index.d.ts +0 -0
  29. package/color-picker/index.es.js +8196 -0
  30. package/color-picker/index.umd.js +27 -0
  31. package/color-picker/package.json +7 -0
  32. package/color-picker/style.css +1 -0
  33. package/comment/index.es.js +42 -13
  34. package/comment/index.umd.js +1 -1
  35. package/comment/style.css +1 -1
  36. package/countdown/index.es.js +27 -17
  37. package/countdown/index.umd.js +1 -1
  38. package/countdown/style.css +1 -1
  39. package/date-picker/index.es.js +48 -66
  40. package/date-picker/index.umd.js +1 -1
  41. package/date-picker/style.css +1 -1
  42. package/dragdrop/index.es.js +135 -10
  43. package/dragdrop/index.umd.js +1 -1
  44. package/drawer/index.es.js +169 -223
  45. package/drawer/index.umd.js +1 -1
  46. package/drawer/style.css +1 -1
  47. package/dropdown/index.es.js +463 -300
  48. package/dropdown/index.umd.js +1 -1
  49. package/dropdown/style.css +1 -1
  50. package/editable-select/index.es.js +293 -5660
  51. package/editable-select/index.umd.js +1 -27
  52. package/editable-select/style.css +1 -1
  53. package/form/index.es.js +6210 -531
  54. package/form/index.umd.js +27 -1
  55. package/form/style.css +1 -1
  56. package/fullscreen/index.es.js +112 -133
  57. package/fullscreen/index.umd.js +1 -1
  58. package/fullscreen/style.css +1 -1
  59. package/gantt/index.es.js +6 -18
  60. package/gantt/index.umd.js +1 -1
  61. package/gantt/style.css +1 -1
  62. package/grid/index.es.js +1 -1
  63. package/grid/style.css +1 -1
  64. package/icon/index.es.js +39 -56
  65. package/icon/index.umd.js +1 -1
  66. package/image-preview/index.es.js +35 -16
  67. package/image-preview/index.umd.js +1 -1
  68. package/input/index.es.js +4 -5
  69. package/input/index.umd.js +1 -1
  70. package/input/style.css +1 -1
  71. package/input-icon/index.es.js +42 -41
  72. package/input-icon/index.umd.js +1 -1
  73. package/input-icon/style.css +1 -1
  74. package/input-number/index.es.js +46 -56
  75. package/input-number/index.umd.js +1 -1
  76. package/input-number/style.css +1 -1
  77. package/list/index.d.ts +7 -0
  78. package/list/index.es.js +39 -0
  79. package/list/index.umd.js +1 -0
  80. package/{toast → list}/package.json +1 -1
  81. package/list/style.css +1 -0
  82. package/loading/index.es.js +2 -2
  83. package/modal/index.es.js +304 -765
  84. package/modal/index.umd.js +1 -1
  85. package/modal/style.css +1 -1
  86. package/nav-sprite/index.es.js +1 -675
  87. package/nav-sprite/index.umd.js +1 -1
  88. package/notification/index.d.ts +7 -0
  89. package/notification/index.es.js +284 -0
  90. package/notification/index.umd.js +1 -0
  91. package/notification/package.json +7 -0
  92. package/notification/style.css +1 -0
  93. package/nuxt/components/Accordion.js +3 -0
  94. package/nuxt/components/Alert.js +3 -0
  95. package/nuxt/components/Anchor.js +3 -0
  96. package/nuxt/components/Aside.js +3 -0
  97. package/nuxt/components/AutoComplete.js +3 -0
  98. package/nuxt/components/Avatar.js +3 -0
  99. package/nuxt/components/BackTop.js +3 -0
  100. package/nuxt/components/Badge.js +3 -0
  101. package/nuxt/components/Breadcrumb.js +3 -0
  102. package/nuxt/components/Button.js +3 -0
  103. package/nuxt/components/Card.js +3 -0
  104. package/nuxt/components/Carousel.js +3 -0
  105. package/nuxt/components/CarouselItem.js +3 -0
  106. package/nuxt/components/Cascader.js +3 -0
  107. package/nuxt/components/Checkbox.js +3 -0
  108. package/nuxt/components/Col.js +3 -0
  109. package/nuxt/components/ColorPicker.js +3 -0
  110. package/nuxt/components/Column.js +3 -0
  111. package/nuxt/components/Comment.js +3 -0
  112. package/nuxt/components/Content.js +3 -0
  113. package/nuxt/components/Countdown.js +3 -0
  114. package/nuxt/components/DatePicker.js +3 -0
  115. package/nuxt/components/Drawer.js +3 -0
  116. package/nuxt/components/DrawerService.js +3 -0
  117. package/nuxt/components/Dropdown.js +3 -0
  118. package/nuxt/components/DropdownMenu.js +3 -0
  119. package/nuxt/components/EditableSelect.js +3 -0
  120. package/nuxt/components/FixedOverlay.js +3 -0
  121. package/nuxt/components/FlexibleOverlay.js +3 -0
  122. package/nuxt/components/Footer.js +3 -0
  123. package/nuxt/components/Form.js +3 -0
  124. package/nuxt/components/FormControl.js +3 -0
  125. package/nuxt/components/FormItem.js +3 -0
  126. package/nuxt/components/FormLabel.js +3 -0
  127. package/nuxt/components/FormOperation.js +3 -0
  128. package/nuxt/components/Fullscreen.js +3 -0
  129. package/nuxt/components/Gantt.js +3 -0
  130. package/nuxt/components/Header.js +3 -0
  131. package/nuxt/components/IFileOptions.js +3 -0
  132. package/nuxt/components/IUploadOptions.js +3 -0
  133. package/nuxt/components/Icon.js +2 -0
  134. package/nuxt/components/ImagePreviewService.js +3 -0
  135. package/nuxt/components/Input.js +3 -0
  136. package/nuxt/components/InputIcon.js +3 -0
  137. package/nuxt/components/InputNumber.js +3 -0
  138. package/nuxt/components/Layout.js +3 -0
  139. package/nuxt/components/List.js +3 -0
  140. package/nuxt/components/ListItem.js +3 -0
  141. package/nuxt/components/Loading.js +3 -0
  142. package/nuxt/components/LoadingService.js +3 -0
  143. package/nuxt/components/Modal.js +3 -0
  144. package/nuxt/components/NavSprite.js +2 -0
  145. package/nuxt/components/Notification.js +3 -0
  146. package/nuxt/components/NotificationService.js +3 -0
  147. package/nuxt/components/Pagination.js +3 -0
  148. package/nuxt/components/Panel.js +3 -0
  149. package/nuxt/components/PanelBody.js +3 -0
  150. package/nuxt/components/PanelFooter.js +3 -0
  151. package/nuxt/components/PanelHeader.js +3 -0
  152. package/nuxt/components/Popover.js +3 -0
  153. package/nuxt/components/Progress.js +3 -0
  154. package/nuxt/components/QuadrantDiagram.js +3 -0
  155. package/nuxt/components/Radio.js +3 -0
  156. package/nuxt/components/RadioGroup.js +3 -0
  157. package/nuxt/components/Rate.js +3 -0
  158. package/nuxt/components/ReadTip.js +3 -0
  159. package/nuxt/components/Result.js +3 -0
  160. package/nuxt/components/Row.js +3 -0
  161. package/nuxt/components/Search.js +3 -0
  162. package/nuxt/components/Select.js +3 -0
  163. package/nuxt/components/Skeleton.js +3 -0
  164. package/nuxt/components/SkeletonItem.js +3 -0
  165. package/nuxt/components/Slider.js +3 -0
  166. package/nuxt/components/Splitter.js +3 -0
  167. package/nuxt/components/Statistic.js +3 -0
  168. package/nuxt/components/Status.js +3 -0
  169. package/nuxt/components/StepsGuide.js +3 -0
  170. package/nuxt/components/StickSlider.js +3 -0
  171. package/nuxt/components/Sticky.js +2 -0
  172. package/nuxt/components/Switch.js +3 -0
  173. package/nuxt/components/Table.js +3 -0
  174. package/nuxt/components/Tabs.js +3 -0
  175. package/nuxt/components/Tag.js +3 -0
  176. package/nuxt/components/TagInput.js +3 -0
  177. package/nuxt/components/Textarea.js +3 -0
  178. package/nuxt/components/TimePicker.js +3 -0
  179. package/nuxt/components/Timeline.js +3 -0
  180. package/nuxt/components/TimelineItem.js +3 -0
  181. package/nuxt/components/Tooltip.js +3 -0
  182. package/nuxt/components/Transfer.js +3 -0
  183. package/nuxt/components/Tree.js +3 -0
  184. package/nuxt/components/TreeSelect.js +3 -0
  185. package/nuxt/components/Upload.js +3 -0
  186. package/nuxt/components/UploadStatus.js +3 -0
  187. package/nuxt/components/alertProps.js +3 -0
  188. package/nuxt/components/badgeProps.js +3 -0
  189. package/nuxt/components/buttonProps.js +3 -0
  190. package/nuxt/components/dropdownMenuProps.js +3 -0
  191. package/nuxt/components/fixedOverlayProps.js +3 -0
  192. package/nuxt/components/flexibleOverlayProps.js +3 -0
  193. package/nuxt/components/fullscreenProps.js +3 -0
  194. package/nuxt/components/iconProps.js +2 -0
  195. package/nuxt/components/notificationProps.js +3 -0
  196. package/nuxt/components/overlayEmits.js +3 -0
  197. package/nuxt/components/overlayProps.js +3 -0
  198. package/nuxt/components/paginationProps.js +3 -0
  199. package/nuxt/components/panelProps.js +3 -0
  200. package/nuxt/components/popoverProps.js +3 -0
  201. package/nuxt/components/searchProps.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 +156 -205
  206. package/overlay/index.umd.js +1 -1
  207. package/overlay/style.css +1 -1
  208. package/package.json +12 -55
  209. package/pagination/index.es.js +11 -13
  210. package/pagination/index.umd.js +1 -1
  211. package/pagination/style.css +1 -1
  212. package/panel/index.es.js +48 -35
  213. package/panel/index.umd.js +1 -1
  214. package/popover/index.es.js +5954 -189
  215. package/popover/index.umd.js +27 -1
  216. package/popover/style.css +1 -1
  217. package/progress/index.es.js +8 -8
  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 +8 -14
  222. package/radio/index.umd.js +1 -1
  223. package/radio/style.css +1 -1
  224. package/read-tip/index.es.js +6 -3
  225. package/read-tip/style.css +1 -1
  226. package/result/index.es.js +38 -52
  227. package/result/index.umd.js +1 -1
  228. package/ripple/index.es.js +10 -6
  229. package/search/index.es.js +5428 -200
  230. package/search/index.umd.js +27 -1
  231. package/search/style.css +1 -1
  232. package/select/index.es.js +43 -42
  233. package/select/index.umd.js +1 -1
  234. package/select/style.css +1 -1
  235. package/skeleton/index.es.js +17 -17
  236. package/skeleton/index.umd.js +1 -1
  237. package/slider/index.es.js +4 -6
  238. package/slider/index.umd.js +1 -1
  239. package/slider/style.css +1 -1
  240. package/splitter/index.es.js +5896 -39
  241. package/splitter/index.umd.js +27 -1
  242. package/splitter/style.css +1 -1
  243. package/statistic/index.es.js +19 -32
  244. package/statistic/index.umd.js +1 -1
  245. package/statistic/style.css +1 -1
  246. package/status/index.es.js +1 -4
  247. package/status/index.umd.js +1 -1
  248. package/status/style.css +1 -1
  249. package/steps-guide/index.es.js +6 -3
  250. package/sticky/index.umd.js +1 -1
  251. package/style.css +1 -1
  252. package/table/index.es.js +753 -358
  253. package/table/index.umd.js +1 -1
  254. package/table/style.css +1 -1
  255. package/tabs/index.es.js +3 -4
  256. package/tabs/index.umd.js +1 -1
  257. package/tabs/style.css +1 -1
  258. package/tag/index.es.js +4 -3
  259. package/tag/index.umd.js +1 -1
  260. package/tag/style.css +1 -1
  261. package/tag-input/index.es.js +4 -14
  262. package/tag-input/index.umd.js +1 -1
  263. package/textarea/style.css +1 -1
  264. package/{theme → theme/theme.scss} +0 -0
  265. package/time-picker/index.es.js +309 -123
  266. package/time-picker/index.umd.js +1 -1
  267. package/time-picker/style.css +1 -1
  268. package/timeline/index.d.ts +7 -0
  269. package/{time-axis → timeline}/index.es.js +65 -77
  270. package/timeline/index.umd.js +1 -0
  271. package/{time-axis → timeline}/package.json +1 -1
  272. package/timeline/style.css +1 -0
  273. package/tooltip/index.es.js +5805 -141
  274. package/tooltip/index.umd.js +27 -1
  275. package/tooltip/style.css +1 -1
  276. package/transfer/index.es.js +6521 -630
  277. package/transfer/index.umd.js +27 -1
  278. package/transfer/style.css +1 -1
  279. package/tree/index.es.js +5781 -193
  280. package/tree/index.umd.js +27 -1
  281. package/tree/style.css +1 -1
  282. package/tree-select/index.es.js +138 -39
  283. package/tree-select/index.umd.js +1 -1
  284. package/tree-select/style.css +1 -1
  285. package/upload/index.es.js +450 -2669
  286. package/upload/index.umd.js +1 -1
  287. package/upload/style.css +1 -1
  288. package/vue-devui.es.js +14414 -14096
  289. package/vue-devui.umd.js +19 -19
  290. package/time-axis/index.umd.js +0 -1
  291. package/time-axis/style.css +0 -1
  292. package/toast/index.es.js +0 -2059
  293. package/toast/index.umd.js +0 -1
  294. package/toast/style.css +0 -1
@@ -1,22 +1,146 @@
1
+ const shadowId = "shadow0611";
2
+ function getElementStyle(id, styleName) {
3
+ return document.getElementById(id).currentStyle ? document.getElementById(id).currentStyle[styleName] : window.getComputedStyle(document.getElementById(id), styleName);
4
+ }
5
+ function createShadow(originId) {
6
+ const shadow = document.createElement("div");
7
+ shadow.id = shadowId;
8
+ shadow.style.background = "rgb(206, 215, 255)";
9
+ shadow.style.width = getElementStyle(originId, "width");
10
+ shadow.style.height = "20px";
11
+ return shadow;
12
+ }
13
+ function changeDragState(el, originId, dragStart, drag, dragover, drop, shouldCreateShadow, dragFlag) {
14
+ el.dataset.originId = originId;
15
+ el.dataset.dragStart = dragStart;
16
+ el.dataset.dragover = dragover;
17
+ el.dataset.drop = drop;
18
+ el.dataset.shouldCreateShadow = shouldCreateShadow;
19
+ el.dataset.dragFlag = dragFlag;
20
+ }
21
+ function computeCompareElementHeight(compareElement) {
22
+ return compareElement.getBoundingClientRect().top + Math.floor(compareElement.offsetHeight / 2);
23
+ }
24
+ function createInsertSortableShadow(sortDropArea, mouseObject, originId) {
25
+ const sortDropAreaArr = [...sortDropArea.children];
26
+ if (sortDropAreaArr.length == 0) {
27
+ if (!document.getElementById(shadowId)) {
28
+ const shadowElement = createShadow(originId);
29
+ sortDropArea.appendChild(shadowElement);
30
+ }
31
+ } else {
32
+ for (let index2 = 0; index2 < sortDropAreaArr.length; index2++) {
33
+ const compareHeight = computeCompareElementHeight(sortDropAreaArr[index2]);
34
+ document.getElementById(shadowId) ? sortDropArea.removeChild(document.getElementById(shadowId)) : null;
35
+ if (index2 == sortDropAreaArr.length - 1) {
36
+ sortDropArea.appendChild(createShadow(originId));
37
+ break;
38
+ }
39
+ if (Math.floor(mouseObject.clientY) <= compareHeight) {
40
+ sortDropArea.insertBefore(createShadow(originId), sortDropAreaArr[index2]);
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ }
46
+ function insertDragElement(dropAreaContainer, dragId, mouseObject) {
47
+ for (let index2 = 0; index2 < [...dropAreaContainer.children].length; index2++) {
48
+ if (index2 == [...dropAreaContainer.children].length - 1) {
49
+ dropAreaContainer.appendChild(document.getElementById(dragId));
50
+ break;
51
+ }
52
+ if (Math.floor(mouseObject.clientY) <= computeCompareElementHeight([...dropAreaContainer.children][index2])) {
53
+ dropAreaContainer.insertBefore(document.getElementById(dragId), [...dropAreaContainer.children][index2]);
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ function deleteInsertedSortableShadow(dropSortArea) {
59
+ if (dropSortArea) {
60
+ if (document.getElementById(shadowId)) {
61
+ if (dropSortArea.contains(document.getElementById(shadowId))) {
62
+ dropSortArea.removeChild(document.getElementById(shadowId));
63
+ }
64
+ }
65
+ }
66
+ }
1
67
  var DraggableDirective = {
2
- mounted(el) {
68
+ mounted(el, binding) {
3
69
  el.setAttribute("draggable", "true");
4
70
  el.style.cursor = "grab";
5
- el.addEventListener("dragstart", (event) => {
6
- event.dataTransfer.setData("originId", el.id);
7
- });
71
+ el.addEventListener("drag", () => {
72
+ changeDragState(el, el.id, "true", "true", "false", "false", "false", "true");
73
+ if (binding.instance.$root.dropElement && document.getElementById(shadowId)) {
74
+ deleteInsertedSortableShadow(binding.instance.$root.dropElement);
75
+ binding.instance.$root.dropElement = null;
76
+ }
77
+ }, false);
78
+ el.addEventListener("dragstart", () => {
79
+ changeDragState(el, el.id, "true", "true", "false", "false", "false", "false");
80
+ binding.instance.$root.identity = el.id;
81
+ el.dataset.dragArea = el.parentNode.className;
82
+ }, false);
8
83
  }
9
84
  };
10
85
  var DroppableDirective = {
11
- mounted(el) {
86
+ mounted(el, binding) {
12
87
  el.addEventListener("dragover", (event) => {
13
88
  event.preventDefault();
14
- });
89
+ const dragId = binding.instance.$root.identity;
90
+ changeDragState(document.getElementById(dragId), dragId, "true", "false", "true", "false", "false", "false");
91
+ document.getElementById(dragId).dataset.dropArea = [...el.childNodes][1].className;
92
+ }, false);
15
93
  el.addEventListener("drop", (event) => {
16
- const originId = event.dataTransfer.getData("originId");
17
- const originNodeCopy = document.getElementById(originId).cloneNode(true);
94
+ event.preventDefault();
95
+ const dragId = binding.instance.$root.identity;
96
+ if (document.getElementById(dragId).dataset.dropArea == document.getElementById(dragId).dataset.dragArea) {
97
+ return;
98
+ }
99
+ const childrenArr = [...Array.from(el.children)[1].children];
100
+ if (childrenArr.length > 0) {
101
+ for (let index2 = 0; index2 < childrenArr.length; index2++) {
102
+ const childrenYRange = childrenArr[index2].getBoundingClientRect().top + childrenArr[index2].offsetHeight / 2;
103
+ if (parseFloat(event.clientY) < parseFloat(childrenYRange)) {
104
+ el.children[1].insertBefore(document.getElementById(dragId), childrenArr[index2]);
105
+ break;
106
+ }
107
+ if (index2 === childrenArr.length - 1) {
108
+ el.children[1].appendChild(document.getElementById(dragId));
109
+ }
110
+ }
111
+ } else {
112
+ el.childNodes[1].appendChild(document.getElementById(dragId));
113
+ }
114
+ });
115
+ }
116
+ };
117
+ var SortableDirective = {
118
+ mounted(el, binding) {
119
+ el.addEventListener("dragover", function(event) {
120
+ event.preventDefault();
18
121
  const targetNode = event.target;
19
- targetNode.append(originNodeCopy);
122
+ const dragId = binding.instance.$root.identity;
123
+ if (!binding.instance.$root.dropElement) {
124
+ binding.instance.$root.dropElement = [...el.childNodes][1];
125
+ }
126
+ changeDragState(document.getElementById(binding.instance.$root.identity), binding.instance.$root.identity, "true", "false", "true", "false", "true", "false");
127
+ const { dragover, shouldCreateShadow } = document.getElementById(dragId).dataset;
128
+ if (dragover == "true") {
129
+ if (shouldCreateShadow == "true") {
130
+ createInsertSortableShadow([...targetNode.children][1], event, dragId);
131
+ }
132
+ }
133
+ });
134
+ el.addEventListener("drop", function(event) {
135
+ const dropArea = [...el.childNodes][1];
136
+ const dragId = binding.instance.$root.identity;
137
+ dropArea.removeChild(document.getElementById(shadowId));
138
+ if ([...dropArea.childNodes].length == 0) {
139
+ dropArea.appendChild(document.getElementById(dragId));
140
+ } else {
141
+ insertDragElement(dropArea, dragId, event);
142
+ }
143
+ changeDragState(document.getElementById(dragId), dragId, "false", "false", "false", "true", "false", "false");
20
144
  });
21
145
  }
22
146
  };
@@ -27,6 +151,7 @@ var index = {
27
151
  install(app) {
28
152
  app.directive("DDraggable", DraggableDirective);
29
153
  app.directive("DDroppable", DroppableDirective);
154
+ app.directive("DSortable", SortableDirective);
30
155
  }
31
156
  };
32
- export { DraggableDirective, DroppableDirective, index as default };
157
+ export { DraggableDirective, DroppableDirective, SortableDirective, index as default };
@@ -1 +1 @@
1
- (function(t,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(t=typeof globalThis!="undefined"?globalThis:t||self,r(t.index={}))})(this,function(t){"use strict";var r={mounted(e){e.setAttribute("draggable","true"),e.style.cursor="grab",e.addEventListener("dragstart",d=>{d.dataTransfer.setData("originId",e.id)})}},i={mounted(e){e.addEventListener("dragover",d=>{d.preventDefault()}),e.addEventListener("drop",d=>{const n=d.dataTransfer.getData("originId"),o=document.getElementById(n).cloneNode(!0);d.target.append(o)})}},a={title:"Dragdrop \u62D6\u62FD",category:"\u901A\u7528",status:"10%",install(e){e.directive("DDraggable",r),e.directive("DDroppable",i)}};t.DraggableDirective=r,t.DroppableDirective=i,t.default=a,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(l,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(l=typeof globalThis!="undefined"?globalThis:l||self,r(l.index={}))})(this,function(l){"use strict";const r="shadow0611";function h(e,t){return document.getElementById(e).currentStyle?document.getElementById(e).currentStyle[t]:window.getComputedStyle(document.getElementById(e),t)}function s(e){const t=document.createElement("div");return t.id=r,t.style.background="rgb(206, 215, 255)",t.style.width=h(e,"width"),t.style.height="20px",t}function i(e,t,a,n,d,o,c,I){e.dataset.originId=t,e.dataset.dragStart=a,e.dataset.dragover=d,e.dataset.drop=o,e.dataset.shouldCreateShadow=c,e.dataset.dragFlag=I}function u(e){return e.getBoundingClientRect().top+Math.floor(e.offsetHeight/2)}function y(e,t,a){const n=[...e.children];if(n.length==0){if(!document.getElementById(r)){const d=s(a);e.appendChild(d)}}else for(let d=0;d<n.length;d++){const o=u(n[d]);if(document.getElementById(r)&&e.removeChild(document.getElementById(r)),d==n.length-1){e.appendChild(s(a));break}if(Math.floor(t.clientY)<=o){e.insertBefore(s(a),n[d]);break}}}function E(e,t,a){for(let n=0;n<[...e.children].length;n++){if(n==[...e.children].length-1){e.appendChild(document.getElementById(t));break}if(Math.floor(a.clientY)<=u([...e.children][n])){e.insertBefore(document.getElementById(t),[...e.children][n]);break}}}function p(e){e&&document.getElementById(r)&&e.contains(document.getElementById(r))&&e.removeChild(document.getElementById(r))}var f={mounted(e,t){e.setAttribute("draggable","true"),e.style.cursor="grab",e.addEventListener("drag",()=>{i(e,e.id,"true","true","false","false","false","true"),t.instance.$root.dropElement&&document.getElementById(r)&&(p(t.instance.$root.dropElement),t.instance.$root.dropElement=null)},!1),e.addEventListener("dragstart",()=>{i(e,e.id,"true","true","false","false","false","false"),t.instance.$root.identity=e.id,e.dataset.dragArea=e.parentNode.className},!1)}},m={mounted(e,t){e.addEventListener("dragover",a=>{a.preventDefault();const n=t.instance.$root.identity;i(document.getElementById(n),n,"true","false","true","false","false","false"),document.getElementById(n).dataset.dropArea=[...e.childNodes][1].className},!1),e.addEventListener("drop",a=>{a.preventDefault();const n=t.instance.$root.identity;if(document.getElementById(n).dataset.dropArea==document.getElementById(n).dataset.dragArea)return;const d=[...Array.from(e.children)[1].children];if(d.length>0)for(let o=0;o<d.length;o++){const c=d[o].getBoundingClientRect().top+d[o].offsetHeight/2;if(parseFloat(a.clientY)<parseFloat(c)){e.children[1].insertBefore(document.getElementById(n),d[o]);break}o===d.length-1&&e.children[1].appendChild(document.getElementById(n))}else e.childNodes[1].appendChild(document.getElementById(n))})}},g={mounted(e,t){e.addEventListener("dragover",function(a){a.preventDefault();const n=a.target,d=t.instance.$root.identity;t.instance.$root.dropElement||(t.instance.$root.dropElement=[...e.childNodes][1]),i(document.getElementById(t.instance.$root.identity),t.instance.$root.identity,"true","false","true","false","true","false");const{dragover:o,shouldCreateShadow:c}=document.getElementById(d).dataset;o=="true"&&c=="true"&&y([...n.children][1],a,d)}),e.addEventListener("drop",function(a){const n=[...e.childNodes][1],d=t.instance.$root.identity;n.removeChild(document.getElementById(r)),[...n.childNodes].length==0?n.appendChild(document.getElementById(d)):E(n,d,a),i(document.getElementById(d),d,"false","false","false","true","false","false")})}},B={title:"Dragdrop \u62D6\u62FD",category:"\u901A\u7528",status:"10%",install(e){e.directive("DDraggable",f),e.directive("DDroppable",m),e.directive("DSortable",g)}};l.DraggableDirective=f,l.DroppableDirective=m,l.SortableDirective=g,l.default=B,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
@@ -14,13 +14,10 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- import { defineComponent, ref, inject, computed, createVNode, createTextVNode, toRefs, watch, provide, onUnmounted, Teleport } from "vue";
17
+ import { defineComponent, createVNode, Transition, ref, computed, watch, onUnmounted, Teleport, mergeProps, reactive, createApp, isVNode } from "vue";
18
+ import { onClickOutside } from "@vueuse/core";
18
19
  const drawerProps = {
19
- width: {
20
- type: String,
21
- default: "300px"
22
- },
23
- visible: {
20
+ modelValue: {
24
21
  type: Boolean,
25
22
  default: false
26
23
  },
@@ -28,7 +25,7 @@ const drawerProps = {
28
25
  type: Number,
29
26
  default: 1e3
30
27
  },
31
- isCover: {
28
+ showOverlay: {
32
29
  type: Boolean,
33
30
  default: true
34
31
  },
@@ -38,251 +35,200 @@ const drawerProps = {
38
35
  },
39
36
  position: {
40
37
  type: String,
41
- default: "left"
38
+ default: "right"
42
39
  },
43
- backdropCloseable: {
40
+ lockScroll: {
44
41
  type: Boolean,
45
42
  default: true
46
43
  },
47
- beforeHidden: {
48
- type: [Promise, Function]
44
+ closeOnClickOverlay: {
45
+ type: Boolean,
46
+ default: true
47
+ },
48
+ beforeClose: {
49
+ type: Function
49
50
  }
50
51
  };
51
- var drawerHeader = "";
52
- var DrawerHeader = defineComponent({
53
- name: "DrawerHeader",
54
- emits: ["toggleFullScreen", "close"],
55
- setup(props, ctx) {
56
- const isFullScreen = ref(false);
57
- const visible = inject("visible");
58
- const fullScreenClassName = computed(() => isFullScreen.value ? "icon icon-minimize" : "icon icon-maxmize");
59
- const handleFullScreen = (e) => {
60
- e.stopPropagation();
61
- isFullScreen.value = !isFullScreen.value;
62
- ctx.emit("toggleFullScreen");
63
- };
64
- const handleDrawerClose = () => {
65
- ctx.emit("close");
66
- };
67
- return {
68
- fullScreenClassName,
69
- visible,
70
- handleFullScreen,
71
- handleDrawerClose
72
- };
73
- },
74
- render() {
75
- const {
76
- handleFullScreen,
77
- handleDrawerClose,
78
- visible,
79
- fullScreenClassName
80
- } = this;
81
- if (!visible)
82
- return null;
83
- return createVNode("div", {
84
- "class": "devui-drawer-header"
85
- }, [createVNode("div", {
86
- "class": "devui-drawer-header-item"
87
- }, [createVNode("span", {
88
- "class": "devui-drawer-header-item icon icon-more-operate"
89
- }, null)]), createVNode("div", {
90
- "class": "devui-drawer-header-item",
91
- "onClick": handleFullScreen
92
- }, [createVNode("span", {
93
- "class": fullScreenClassName
94
- }, null)]), createVNode("div", {
95
- "class": "devui-drawer-header-item",
96
- "onClick": handleDrawerClose
97
- }, [createVNode("span", {
98
- "class": "icon icon-close"
99
- }, null)])]);
52
+ const drawerOverlayProps = {
53
+ visible: {
54
+ type: Boolean,
55
+ default: false
100
56
  }
101
- });
102
- var DrawerContainer = defineComponent({
103
- name: "DrawerContainer",
104
- setup() {
105
- const visible = inject("visible");
106
- return {
107
- visible
57
+ };
58
+ var drawerOverlay = "";
59
+ var DrawerOverlay = defineComponent({
60
+ name: "DDrawerOverlay",
61
+ props: drawerOverlayProps,
62
+ emits: ["click"],
63
+ setup(props, ctx) {
64
+ const handleClick = (e) => {
65
+ ctx.emit("click", e);
108
66
  };
109
- },
110
- render() {
111
- const {
112
- visible
113
- } = this;
114
- if (!visible)
115
- return null;
116
- return createVNode("div", null, [createTextVNode("\u5185\u5BB9\u533A\u57DF")]);
67
+ return () => createVNode(Transition, {
68
+ "name": "drawer-overlay-fade"
69
+ }, {
70
+ default: () => [props.visible && createVNode("div", {
71
+ "class": "devui-drawer-overlay",
72
+ "onClick": handleClick
73
+ }, null)]
74
+ });
117
75
  }
118
76
  });
119
- var drawerBody = "";
120
- var DrawerBody = defineComponent({
121
- name: "DrawerBody",
122
- setup(props, {
123
- slots
124
- }) {
125
- const isFullScreen = inject("isFullScreen");
126
- const closeDrawer = inject("closeDrawer");
127
- const zindex = inject("zindex");
128
- const isCover = inject("isCover");
129
- const position = inject("position");
130
- const width = inject("width");
131
- const visible = inject("visible");
132
- const backdropCloseable = inject("backdropCloseable");
133
- const navRight = computed(() => position.value === "right" ? {
134
- "right": 0
135
- } : {
136
- "left": 0
137
- });
138
- const navWidth = computed(() => isFullScreen.value ? "100vw" : width.value);
139
- const clickContent = (e) => {
140
- e.stopPropagation();
141
- };
142
- const handleDrawerClose = () => {
143
- if (!backdropCloseable.value)
144
- return;
145
- closeDrawer();
146
- };
147
- return {
148
- zindex,
149
- slots,
150
- isCover,
151
- navRight,
152
- navWidth,
153
- visible,
154
- clickContent,
155
- handleDrawerClose
77
+ function lockScroll() {
78
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
79
+ const scrollTop = document.documentElement.scrollTop;
80
+ const style = document.documentElement.getAttribute("style");
81
+ document.documentElement.style.position = "fixed";
82
+ document.documentElement.style.top = `-${scrollTop}px`;
83
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
84
+ document.documentElement.style.overflowY = "scroll";
85
+ return () => {
86
+ if (style) {
87
+ document.documentElement.setAttribute("style", style);
88
+ } else {
89
+ document.documentElement.removeAttribute("style");
90
+ }
91
+ document.documentElement.scrollTop = scrollTop;
156
92
  };
157
- },
158
- render() {
159
- const {
160
- zindex,
161
- slots,
162
- isCover,
163
- navRight,
164
- navWidth,
165
- visible,
166
- handleDrawerClose
167
- } = this;
168
- if (!visible)
169
- return null;
170
- return createVNode("div", {
171
- "class": "devui-drawer",
172
- "style": {
173
- zIndex: zindex
174
- },
175
- "onClick": handleDrawerClose
176
- }, [isCover ? createVNode("div", {
177
- "class": "devui-overlay-backdrop"
178
- }, null) : null, createVNode("div", {
179
- "class": "devui-overlay-wrapper"
180
- }, [createVNode("div", {
181
- "class": "devui-drawer-nav",
182
- "style": __spreadValues({
183
- "width": navWidth
184
- }, navRight)
185
- }, [createVNode("div", {
186
- "class": "devui-drawer-content",
187
- "onClick": this.clickContent
188
- }, [slots.default ? slots.default() : null])])])]);
189
93
  }
190
- });
94
+ return;
95
+ }
96
+ function useDrawer(props, emit) {
97
+ const drawerRef = ref();
98
+ const drawerClasses = computed(() => ({
99
+ "devui-drawer": true,
100
+ [`devui-drawer-${props.position}`]: true
101
+ }));
102
+ const close = () => {
103
+ emit("update:modelValue", false);
104
+ emit("close");
105
+ };
106
+ let lockScrollCb;
107
+ const execClose = () => {
108
+ props.beforeClose ? props.beforeClose(close) : close();
109
+ };
110
+ const handleOverlayClick = () => {
111
+ props.closeOnClickOverlay && execClose();
112
+ };
113
+ const handleEscClose = (e) => {
114
+ e.code === "Escape" && execClose();
115
+ };
116
+ onClickOutside(drawerRef, execClose);
117
+ const removeBodyAdditions = () => {
118
+ lockScrollCb == null ? void 0 : lockScrollCb();
119
+ document.removeEventListener("keyup", handleEscClose);
120
+ };
121
+ watch(() => props.modelValue, (val) => {
122
+ if (val) {
123
+ emit("open");
124
+ props.lockScroll && (lockScrollCb = lockScroll());
125
+ props.escKeyCloseable && document.addEventListener("keyup", handleEscClose);
126
+ } else {
127
+ removeBodyAdditions();
128
+ }
129
+ });
130
+ onUnmounted(removeBodyAdditions);
131
+ return { drawerRef, drawerClasses, handleOverlayClick };
132
+ }
133
+ var drawer = "";
191
134
  var Drawer = defineComponent({
192
135
  name: "DDrawer",
136
+ inheritAttrs: false,
193
137
  props: drawerProps,
194
- emits: ["close", "update:visible", "afterOpened"],
138
+ emits: ["close", "update:modelValue", "open"],
195
139
  setup(props, {
196
140
  emit,
197
- slots
141
+ slots,
142
+ attrs
198
143
  }) {
199
144
  const {
200
- width,
201
- visible,
202
- zIndex,
203
- isCover,
204
- escKeyCloseable,
205
- position,
206
- backdropCloseable
207
- } = toRefs(props);
208
- const isFullScreen = ref(false);
209
- const fullScreenEvent = () => {
210
- isFullScreen.value = !isFullScreen.value;
211
- };
212
- const closeDrawer = async () => {
213
- var _a;
214
- const beforeHidden = props.beforeHidden;
215
- let result = (_a = typeof beforeHidden === "function" ? beforeHidden() : beforeHidden) != null ? _a : true;
216
- if (result instanceof Promise) {
217
- console.log(result);
218
- result = await result;
219
- }
220
- if (result)
221
- return;
222
- emit("update:visible", false);
223
- emit("close");
224
- };
225
- const escCloseDrawer = (e) => {
226
- if (e.code === "Escape") {
227
- closeDrawer();
228
- }
229
- };
230
- watch(visible, (val) => {
231
- if (val) {
232
- emit("afterOpened");
233
- isFullScreen.value = false;
234
- }
235
- if (escKeyCloseable && val) {
236
- document.addEventListener("keyup", escCloseDrawer);
237
- } else {
238
- document.removeEventListener("keyup", escCloseDrawer);
239
- }
240
- });
241
- provide("closeDrawer", closeDrawer);
242
- provide("zindex", zIndex);
243
- provide("isCover", isCover);
244
- provide("position", position);
245
- provide("width", width);
246
- provide("visible", visible);
247
- provide("isFullScreen", isFullScreen);
248
- provide("backdropCloseable", backdropCloseable);
249
- onUnmounted(() => {
250
- document.removeEventListener("keyup", escCloseDrawer);
251
- });
252
- return {
253
- isFullScreen,
254
- visible,
255
- slots,
256
- fullScreenEvent,
257
- closeDrawer
258
- };
259
- },
260
- render() {
261
- const fullScreenEvent = this.fullScreenEvent;
262
- const closeDrawer = this.closeDrawer;
263
- if (!this.visible)
264
- return null;
265
- return createVNode(Teleport, {
145
+ drawerRef,
146
+ drawerClasses,
147
+ handleOverlayClick
148
+ } = useDrawer(props, emit);
149
+ return () => createVNode(Teleport, {
266
150
  "to": "body"
267
151
  }, {
268
- default: () => [createVNode(DrawerBody, null, {
269
- default: () => [createVNode(DrawerHeader, {
270
- "onToggleFullScreen": fullScreenEvent,
271
- "onClose": closeDrawer
272
- }, null), this.slots.default ? this.slots.default() : createVNode(DrawerContainer, null, null)]
152
+ default: () => [props.showOverlay && createVNode(DrawerOverlay, {
153
+ "visible": props.modelValue,
154
+ "style": {
155
+ zIndex: props.zIndex
156
+ },
157
+ "onClick": handleOverlayClick
158
+ }, null), createVNode(Transition, {
159
+ "name": `drawer-fly-${props.position}`
160
+ }, {
161
+ default: () => {
162
+ var _a;
163
+ return [props.modelValue && createVNode("div", mergeProps({
164
+ "ref": drawerRef,
165
+ "class": drawerClasses.value,
166
+ "style": {
167
+ zIndex: props.zIndex + 1
168
+ }
169
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)])];
170
+ }
273
171
  })]
274
172
  });
275
173
  }
276
174
  });
277
- Drawer.install = function(app) {
278
- app.component(Drawer.name, Drawer);
175
+ function _isSlot(s) {
176
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
177
+ }
178
+ const defaultOptions = {
179
+ modelValue: false,
180
+ content: "",
181
+ zIndex: 1e3,
182
+ showOverlay: true,
183
+ escKeyCloseable: true,
184
+ position: "right",
185
+ lockScroll: true,
186
+ closeOnClickOverlay: true
279
187
  };
188
+ function initInstance(state) {
189
+ const container = document.createElement("div");
190
+ const content = state.content;
191
+ delete state.content;
192
+ const app = createApp({
193
+ setup() {
194
+ const handleVisibleChange = () => {
195
+ state.modelValue = false;
196
+ };
197
+ onUnmounted(() => {
198
+ console.log(111);
199
+ document.body.removeChild(container);
200
+ });
201
+ return () => createVNode(Drawer, mergeProps(state, {
202
+ "onUpdate:modelValue": handleVisibleChange
203
+ }), _isSlot(content) ? content : {
204
+ default: () => [content]
205
+ });
206
+ }
207
+ });
208
+ document.body.appendChild(container);
209
+ app.mount(container);
210
+ return app;
211
+ }
212
+ class DrawerService {
213
+ open(options) {
214
+ const state = reactive(__spreadValues(__spreadValues({}, defaultOptions), options));
215
+ const app = initInstance(state);
216
+ state.modelValue = true;
217
+ return {
218
+ close: () => {
219
+ state.modelValue = false;
220
+ app.unmount();
221
+ }
222
+ };
223
+ }
224
+ }
280
225
  var index = {
281
226
  title: "Drawer \u62BD\u5C49\u677F",
282
227
  category: "\u53CD\u9988",
283
- status: "30%",
228
+ status: "75%",
284
229
  install(app) {
285
- app.use(Drawer);
230
+ app.component(Drawer.name, Drawer);
231
+ app.config.globalProperties.$drawerService = new DrawerService();
286
232
  }
287
233
  };
288
- export { Drawer, index as default };
234
+ export { Drawer, DrawerService, index as default };
@@ -1 +1 @@
1
- var j=Object.defineProperty;var D=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var N=(n,e,o)=>e in n?j(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,S=(n,e)=>{for(var o in e||(e={}))x.call(e,o)&&N(n,o,e[o]);if(D)for(var o of D(e))B.call(e,o)&&N(n,o,e[o]);return n};(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";const o={width:{type:String,default:"300px"},visible:{type:Boolean,default:!1},zIndex:{type:Number,default:1e3},isCover:{type:Boolean,default:!0},escKeyCloseable:{type:Boolean,default:!0},position:{type:String,default:"left"},backdropCloseable:{type:Boolean,default:!0},beforeHidden:{type:[Promise,Function]}};var z="",V=e.defineComponent({name:"DrawerHeader",emits:["toggleFullScreen","close"],setup(r,t){const l=e.ref(!1),s=e.inject("visible");return{fullScreenClassName:e.computed(()=>l.value?"icon icon-minimize":"icon icon-maxmize"),visible:s,handleFullScreen:f=>{f.stopPropagation(),l.value=!l.value,t.emit("toggleFullScreen")},handleDrawerClose:()=>{t.emit("close")}}},render(){const{handleFullScreen:r,handleDrawerClose:t,visible:l,fullScreenClassName:s}=this;return l?e.createVNode("div",{class:"devui-drawer-header"},[e.createVNode("div",{class:"devui-drawer-header-item"},[e.createVNode("span",{class:"devui-drawer-header-item icon icon-more-operate"},null)]),e.createVNode("div",{class:"devui-drawer-header-item",onClick:r},[e.createVNode("span",{class:s},null)]),e.createVNode("div",{class:"devui-drawer-header-item",onClick:t},[e.createVNode("span",{class:"icon icon-close"},null)])]):null}}),g=e.defineComponent({name:"DrawerContainer",setup(){return{visible:e.inject("visible")}},render(){const{visible:r}=this;return r?e.createVNode("div",null,[e.createTextVNode("\u5185\u5BB9\u533A\u57DF")]):null}}),E="",k=e.defineComponent({name:"DrawerBody",setup(r,{slots:t}){const l=e.inject("isFullScreen"),s=e.inject("closeDrawer"),a=e.inject("zindex"),c=e.inject("isCover"),u=e.inject("position"),f=e.inject("width"),C=e.inject("visible"),v=e.inject("backdropCloseable"),d=e.computed(()=>u.value==="right"?{right:0}:{left:0}),b=e.computed(()=>l.value?"100vw":f.value);return{zindex:a,slots:t,isCover:c,navRight:d,navWidth:b,visible:C,clickContent:i=>{i.stopPropagation()},handleDrawerClose:()=>{!v.value||s()}}},render(){const{zindex:r,slots:t,isCover:l,navRight:s,navWidth:a,visible:c,handleDrawerClose:u}=this;return c?e.createVNode("div",{class:"devui-drawer",style:{zIndex:r},onClick:u},[l?e.createVNode("div",{class:"devui-overlay-backdrop"},null):null,e.createVNode("div",{class:"devui-overlay-wrapper"},[e.createVNode("div",{class:"devui-drawer-nav",style:S({width:a},s)},[e.createVNode("div",{class:"devui-drawer-content",onClick:this.clickContent},[t.default?t.default():null])])])]):null}}),p=e.defineComponent({name:"DDrawer",props:o,emits:["close","update:visible","afterOpened"],setup(r,{emit:t,slots:l}){const{width:s,visible:a,zIndex:c,isCover:u,escKeyCloseable:f,position:C,backdropCloseable:v}=e.toRefs(r),d=e.ref(!1),b=()=>{d.value=!d.value},h=async()=>{var y;const i=r.beforeHidden;let w=(y=typeof i=="function"?i():i)!=null?y:!0;w instanceof Promise&&(console.log(w),w=await w),!w&&(t("update:visible",!1),t("close"))},m=i=>{i.code==="Escape"&&h()};return e.watch(a,i=>{i&&(t("afterOpened"),d.value=!1),f&&i?document.addEventListener("keyup",m):document.removeEventListener("keyup",m)}),e.provide("closeDrawer",h),e.provide("zindex",c),e.provide("isCover",u),e.provide("position",C),e.provide("width",s),e.provide("visible",a),e.provide("isFullScreen",d),e.provide("backdropCloseable",v),e.onUnmounted(()=>{document.removeEventListener("keyup",m)}),{isFullScreen:d,visible:a,slots:l,fullScreenEvent:b,closeDrawer:h}},render(){const r=this.fullScreenEvent,t=this.closeDrawer;return this.visible?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode(k,null,{default:()=>[e.createVNode(V,{onToggleFullScreen:r,onClose:t},null),this.slots.default?this.slots.default():e.createVNode(g,null,null)]})]}):null}});p.install=function(r){r.component(p.name,p)};var F={title:"Drawer \u62BD\u5C49\u677F",category:"\u53CD\u9988",status:"30%",install(r){r.use(p)}};n.Drawer=p,n.default=F,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
1
+ var x=Object.defineProperty;var C=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var v=(o,e,r)=>e in o?x(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,f=(o,e)=>{for(var r in e||(e={}))N.call(e,r)&&v(o,r,e[r]);if(C)for(var r of C(e))T.call(e,r)&&v(o,r,e[r]);return o};(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.index={},o.Vue,o.core))})(this,function(o,e,r){"use strict";const h={modelValue:{type:Boolean,default:!1},zIndex:{type:Number,default:1e3},showOverlay:{type:Boolean,default:!0},escKeyCloseable:{type:Boolean,default:!0},position:{type:String,default:"right"},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0},beforeClose:{type:Function}},b={visible:{type:Boolean,default:!1}};var B="",V=e.defineComponent({name:"DDrawerOverlay",props:b,emits:["click"],setup(t,n){const l=d=>{n.emit("click",d)};return()=>e.createVNode(e.Transition,{name:"drawer-overlay-fade"},{default:()=>[t.visible&&e.createVNode("div",{class:"devui-drawer-overlay",onClick:l},null)]})}});function O(){if(document.documentElement.scrollHeight>document.documentElement.clientHeight){const t=document.documentElement.scrollTop,n=document.documentElement.getAttribute("style");return document.documentElement.style.position="fixed",document.documentElement.style.top=`-${t}px`,document.documentElement.style.width=document.documentElement.style.width||"100%",document.documentElement.style.overflowY="scroll",()=>{n?document.documentElement.setAttribute("style",n):document.documentElement.removeAttribute("style"),document.documentElement.scrollTop=t}}}function E(t,n){const l=e.ref(),d=e.computed(()=>({"devui-drawer":!0,[`devui-drawer-${t.position}`]:!0})),c=()=>{n("update:modelValue",!1),n("close")};let a;const u=()=>{t.beforeClose?t.beforeClose(c):c()},s=()=>{t.closeOnClickOverlay&&u()},p=m=>{m.code==="Escape"&&u()};r.onClickOutside(l,u);const w=()=>{a==null||a(),document.removeEventListener("keyup",p)};return e.watch(()=>t.modelValue,m=>{m?(n("open"),t.lockScroll&&(a=O()),t.escKeyCloseable&&document.addEventListener("keyup",p)):w()}),e.onUnmounted(w),{drawerRef:l,drawerClasses:d,handleOverlayClick:s}}var I="",i=e.defineComponent({name:"DDrawer",inheritAttrs:!1,props:h,emits:["close","update:modelValue","open"],setup(t,{emit:n,slots:l,attrs:d}){const{drawerRef:c,drawerClasses:a,handleOverlayClick:u}=E(t,n);return()=>e.createVNode(e.Teleport,{to:"body"},{default:()=>[t.showOverlay&&e.createVNode(V,{visible:t.modelValue,style:{zIndex:t.zIndex},onClick:u},null),e.createVNode(e.Transition,{name:`drawer-fly-${t.position}`},{default:()=>{var s;return[t.modelValue&&e.createVNode("div",e.mergeProps({ref:c,class:a.value,style:{zIndex:t.zIndex+1}},d),[(s=l.default)==null?void 0:s.call(l)])]}})]})}});function k(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const g={modelValue:!1,content:"",zIndex:1e3,showOverlay:!0,escKeyCloseable:!0,position:"right",lockScroll:!0,closeOnClickOverlay:!0};function D(t){const n=document.createElement("div"),l=t.content;delete t.content;const d=e.createApp({setup(){const c=()=>{t.modelValue=!1};return e.onUnmounted(()=>{console.log(111),document.body.removeChild(n)}),()=>e.createVNode(i,e.mergeProps(t,{"onUpdate:modelValue":c}),k(l)?l:{default:()=>[l]})}});return document.body.appendChild(n),d.mount(n),d}class y{open(n){const l=e.reactive(f(f({},g),n)),d=D(l);return l.modelValue=!0,{close:()=>{l.modelValue=!1,d.unmount()}}}}var S={title:"Drawer \u62BD\u5C49\u677F",category:"\u53CD\u9988",status:"75%",install(t){t.component(i.name,i),t.config.globalProperties.$drawerService=new y}};o.Drawer=i,o.DrawerService=y,o.default=S,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});