vue-devui 1.0.0-beta.1 → 1.0.0-beta.13

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 (332) hide show
  1. package/README.md +62 -45
  2. package/accordion/index.d.ts +7 -0
  3. package/accordion/index.es.js +460 -142
  4. package/accordion/index.umd.js +1 -1
  5. package/accordion/style.css +1 -1
  6. package/alert/index.d.ts +7 -0
  7. package/alert/index.es.js +7 -5
  8. package/alert/index.umd.js +1 -1
  9. package/alert/style.css +1 -1
  10. package/anchor/index.d.ts +7 -0
  11. package/avatar/index.d.ts +7 -0
  12. package/avatar/index.es.js +1 -1
  13. package/avatar/index.umd.js +1 -1
  14. package/back-top/index.d.ts +7 -0
  15. package/back-top/index.es.js +128 -0
  16. package/back-top/index.umd.js +1 -0
  17. package/back-top/package.json +7 -0
  18. package/back-top/style.css +1 -0
  19. package/badge/index.d.ts +7 -0
  20. package/badge/index.es.js +1 -1
  21. package/badge/index.umd.js +1 -1
  22. package/breadcrumb/index.d.ts +7 -0
  23. package/button/index.d.ts +7 -0
  24. package/button/index.es.js +218 -12
  25. package/button/index.umd.js +1 -1
  26. package/button/style.css +1 -1
  27. package/card/index.d.ts +7 -0
  28. package/card/index.es.js +1 -1
  29. package/card/index.umd.js +1 -1
  30. package/carousel/index.d.ts +7 -0
  31. package/carousel/index.es.js +5 -4
  32. package/carousel/index.umd.js +1 -1
  33. package/cascader/index.d.ts +7 -0
  34. package/cascader/index.es.js +1239 -83
  35. package/cascader/index.umd.js +1 -1
  36. package/cascader/style.css +1 -1
  37. package/checkbox/index.d.ts +7 -0
  38. package/checkbox/index.es.js +43 -8
  39. package/checkbox/index.umd.js +1 -1
  40. package/color-picker/index.d.ts +7 -0
  41. package/color-picker/index.es.js +2960 -0
  42. package/color-picker/index.umd.js +1 -0
  43. package/color-picker/package.json +7 -0
  44. package/color-picker/style.css +1 -0
  45. package/comment/index.d.ts +7 -0
  46. package/comment/index.es.js +85 -0
  47. package/comment/index.umd.js +1 -0
  48. package/comment/package.json +7 -0
  49. package/comment/style.css +1 -0
  50. package/countdown/index.d.ts +7 -0
  51. package/countdown/index.es.js +176 -0
  52. package/countdown/index.umd.js +1 -0
  53. package/countdown/package.json +7 -0
  54. package/countdown/style.css +1 -0
  55. package/date-picker/index.d.ts +7 -0
  56. package/date-picker/index.es.js +32 -21
  57. package/date-picker/index.umd.js +1 -1
  58. package/date-picker/style.css +1 -1
  59. package/dragdrop/index.d.ts +7 -0
  60. package/dragdrop/index.es.js +157 -0
  61. package/dragdrop/index.umd.js +1 -0
  62. package/dragdrop/package.json +7 -0
  63. package/drawer/index.d.ts +7 -0
  64. package/drawer/index.es.js +194 -42
  65. package/drawer/index.umd.js +1 -1
  66. package/drawer/style.css +1 -1
  67. package/dropdown/index.d.ts +7 -0
  68. package/dropdown/index.es.js +535 -0
  69. package/dropdown/index.umd.js +1 -0
  70. package/dropdown/package.json +7 -0
  71. package/dropdown/style.css +1 -0
  72. package/editable-select/index.d.ts +7 -0
  73. package/editable-select/index.es.js +5782 -469
  74. package/editable-select/index.umd.js +27 -1
  75. package/editable-select/style.css +1 -1
  76. package/form/index.d.ts +7 -0
  77. package/form/index.es.js +2257 -0
  78. package/form/index.umd.js +1 -0
  79. package/form/package.json +7 -0
  80. package/form/style.css +1 -0
  81. package/fullscreen/index.d.ts +7 -0
  82. package/fullscreen/index.es.js +14 -4
  83. package/fullscreen/index.umd.js +1 -1
  84. package/gantt/index.d.ts +7 -0
  85. package/gantt/index.es.js +535 -0
  86. package/gantt/index.umd.js +1 -0
  87. package/gantt/package.json +7 -0
  88. package/gantt/style.css +1 -0
  89. package/grid/index.d.ts +7 -0
  90. package/grid/index.es.js +269 -0
  91. package/grid/index.umd.js +1 -0
  92. package/grid/package.json +7 -0
  93. package/grid/style.css +1 -0
  94. package/icon/index.d.ts +7 -0
  95. package/icon/index.es.js +6 -5
  96. package/icon/index.umd.js +1 -1
  97. package/image-preview/index.d.ts +7 -0
  98. package/image-preview/index.es.js +99 -20
  99. package/image-preview/index.umd.js +1 -1
  100. package/image-preview/style.css +1 -1
  101. package/index.d.ts +7 -0
  102. package/input/index.d.ts +7 -0
  103. package/input/index.es.js +24 -13
  104. package/input/index.umd.js +1 -1
  105. package/input-icon/index.d.ts +7 -0
  106. package/input-icon/index.es.js +332 -0
  107. package/input-icon/index.umd.js +1 -0
  108. package/input-icon/package.json +7 -0
  109. package/input-icon/style.css +1 -0
  110. package/input-number/index.d.ts +7 -0
  111. package/input-number/index.es.js +5 -4
  112. package/input-number/index.umd.js +1 -1
  113. package/layout/index.d.ts +7 -0
  114. package/layout/index.es.js +1 -1
  115. package/layout/index.umd.js +1 -1
  116. package/loading/index.d.ts +7 -0
  117. package/loading/index.es.js +1 -1
  118. package/loading/index.umd.js +1 -1
  119. package/modal/index.d.ts +7 -0
  120. package/modal/index.es.js +328 -109
  121. package/modal/index.umd.js +1 -1
  122. package/modal/style.css +1 -1
  123. package/nav-sprite/index.d.ts +7 -0
  124. package/nuxt/components/Accordion.js +3 -0
  125. package/nuxt/components/Alert.js +3 -0
  126. package/nuxt/components/Anchor.js +3 -0
  127. package/nuxt/components/Aside.js +3 -0
  128. package/nuxt/components/Avatar.js +3 -0
  129. package/nuxt/components/BackTop.js +3 -0
  130. package/nuxt/components/Badge.js +3 -0
  131. package/nuxt/components/Breadcrumb.js +3 -0
  132. package/nuxt/components/Button.js +3 -0
  133. package/nuxt/components/Card.js +3 -0
  134. package/nuxt/components/Carousel.js +3 -0
  135. package/nuxt/components/Cascader.js +3 -0
  136. package/nuxt/components/Checkbox.js +3 -0
  137. package/nuxt/components/Col.js +3 -0
  138. package/nuxt/components/ColorPicker.js +3 -0
  139. package/nuxt/components/Column.js +3 -0
  140. package/nuxt/components/Comment.js +3 -0
  141. package/nuxt/components/Content.js +3 -0
  142. package/nuxt/components/Countdown.js +3 -0
  143. package/nuxt/components/DatePicker.js +3 -0
  144. package/nuxt/components/Drawer.js +3 -0
  145. package/nuxt/components/DrawerService.js +3 -0
  146. package/nuxt/components/Dropdown.js +3 -0
  147. package/nuxt/components/EditableSelect.js +3 -0
  148. package/nuxt/components/FixedOverlay.js +3 -0
  149. package/nuxt/components/FlexibleOverlay.js +3 -0
  150. package/nuxt/components/Footer.js +3 -0
  151. package/nuxt/components/Form.js +3 -0
  152. package/nuxt/components/FormControl.js +3 -0
  153. package/nuxt/components/FormItem.js +3 -0
  154. package/nuxt/components/FormLabel.js +3 -0
  155. package/nuxt/components/FormOperation.js +3 -0
  156. package/nuxt/components/Fullscreen.js +3 -0
  157. package/nuxt/components/Gantt.js +3 -0
  158. package/nuxt/components/Header.js +3 -0
  159. package/nuxt/components/Icon.js +2 -0
  160. package/nuxt/components/ImagePreviewService.js +3 -0
  161. package/nuxt/components/Input.js +3 -0
  162. package/nuxt/components/InputIcon.js +3 -0
  163. package/nuxt/components/InputNumber.js +3 -0
  164. package/nuxt/components/Layout.js +3 -0
  165. package/nuxt/components/Loading.js +3 -0
  166. package/nuxt/components/LoadingService.js +3 -0
  167. package/nuxt/components/Modal.js +3 -0
  168. package/nuxt/components/NavSprite.js +2 -0
  169. package/nuxt/components/Pagination.js +3 -0
  170. package/nuxt/components/Panel.js +3 -0
  171. package/nuxt/components/Popover.js +3 -0
  172. package/nuxt/components/Progress.js +3 -0
  173. package/nuxt/components/QuadrantDiagram.js +3 -0
  174. package/nuxt/components/Radio.js +3 -0
  175. package/nuxt/components/RadioGroup.js +3 -0
  176. package/nuxt/components/Rate.js +3 -0
  177. package/nuxt/components/ReadTip.js +3 -0
  178. package/nuxt/components/Result.js +3 -0
  179. package/nuxt/components/Row.js +3 -0
  180. package/nuxt/components/Search.js +3 -0
  181. package/nuxt/components/Select.js +3 -0
  182. package/nuxt/components/Skeleton.js +3 -0
  183. package/nuxt/components/SkeletonItem.js +3 -0
  184. package/nuxt/components/Slider.js +3 -0
  185. package/nuxt/components/Splitter.js +3 -0
  186. package/nuxt/components/Statistic.js +3 -0
  187. package/nuxt/components/Status.js +3 -0
  188. package/nuxt/components/StepsGuide.js +3 -0
  189. package/nuxt/components/StickSlider.js +3 -0
  190. package/nuxt/components/Sticky.js +2 -0
  191. package/nuxt/components/Switch.js +3 -0
  192. package/nuxt/components/Table.js +3 -0
  193. package/nuxt/components/Tabs.js +3 -0
  194. package/nuxt/components/Tag.js +3 -0
  195. package/nuxt/components/TagInput.js +3 -0
  196. package/nuxt/components/Textarea.js +3 -0
  197. package/nuxt/components/TimeAxis.js +3 -0
  198. package/nuxt/components/TimeAxisItem.js +3 -0
  199. package/nuxt/components/TimePicker.js +3 -0
  200. package/nuxt/components/Toast.js +3 -0
  201. package/nuxt/components/ToastService.js +3 -0
  202. package/nuxt/components/Tooltip.js +3 -0
  203. package/nuxt/components/Transfer.js +3 -0
  204. package/nuxt/components/Tree.js +3 -0
  205. package/nuxt/components/TreeSelect.js +3 -0
  206. package/nuxt/components/Upload.js +3 -0
  207. package/nuxt/components/buttonProps.js +3 -0
  208. package/nuxt/index.js +13 -0
  209. package/overlay/index.d.ts +7 -0
  210. package/overlay/index.es.js +111 -94
  211. package/overlay/index.umd.js +1 -1
  212. package/overlay/style.css +1 -1
  213. package/package.json +5 -47
  214. package/pagination/index.d.ts +7 -0
  215. package/pagination/index.es.js +3 -3
  216. package/pagination/index.umd.js +1 -1
  217. package/panel/index.d.ts +7 -0
  218. package/panel/index.es.js +25 -22
  219. package/panel/index.umd.js +1 -1
  220. package/panel/style.css +1 -1
  221. package/popover/index.d.ts +7 -0
  222. package/popover/index.es.js +18 -6
  223. package/popover/index.umd.js +1 -1
  224. package/progress/index.d.ts +7 -0
  225. package/progress/index.es.js +9 -9
  226. package/progress/index.umd.js +3 -3
  227. package/quadrant-diagram/index.d.ts +7 -0
  228. package/radio/index.d.ts +7 -0
  229. package/radio/index.es.js +6 -6
  230. package/radio/index.umd.js +1 -1
  231. package/rate/index.d.ts +7 -0
  232. package/rate/index.es.js +1 -1
  233. package/rate/index.umd.js +1 -1
  234. package/read-tip/index.d.ts +7 -0
  235. package/read-tip/index.es.js +258 -0
  236. package/read-tip/index.umd.js +1 -0
  237. package/read-tip/package.json +7 -0
  238. package/read-tip/style.css +1 -0
  239. package/result/index.d.ts +7 -0
  240. package/result/index.es.js +119 -0
  241. package/result/index.umd.js +1 -0
  242. package/result/package.json +7 -0
  243. package/result/style.css +1 -0
  244. package/ripple/index.d.ts +7 -0
  245. package/ripple/index.es.js +5 -2
  246. package/ripple/index.umd.js +1 -1
  247. package/search/index.d.ts +7 -0
  248. package/search/index.es.js +35 -21
  249. package/search/index.umd.js +1 -1
  250. package/select/index.d.ts +7 -0
  251. package/select/index.es.js +47 -11
  252. package/select/index.umd.js +1 -1
  253. package/skeleton/index.d.ts +7 -0
  254. package/skeleton/index.es.js +148 -26
  255. package/skeleton/index.umd.js +1 -1
  256. package/skeleton/style.css +1 -1
  257. package/slider/index.d.ts +7 -0
  258. package/slider/index.es.js +32 -182
  259. package/slider/index.umd.js +1 -1
  260. package/slider/style.css +1 -1
  261. package/splitter/index.d.ts +7 -0
  262. package/splitter/index.es.js +295 -100
  263. package/splitter/index.umd.js +1 -1
  264. package/splitter/style.css +1 -1
  265. package/statistic/index.d.ts +7 -0
  266. package/statistic/index.es.js +280 -0
  267. package/statistic/index.umd.js +1 -0
  268. package/statistic/package.json +7 -0
  269. package/statistic/style.css +1 -0
  270. package/status/index.d.ts +7 -0
  271. package/status/index.es.js +2 -2
  272. package/status/index.umd.js +1 -1
  273. package/steps-guide/index.d.ts +7 -0
  274. package/steps-guide/index.es.js +101 -73
  275. package/steps-guide/index.umd.js +1 -1
  276. package/steps-guide/style.css +1 -1
  277. package/sticky/index.d.ts +7 -0
  278. package/style.css +1 -1
  279. package/switch/index.d.ts +7 -0
  280. package/switch/index.es.js +1 -1
  281. package/switch/index.umd.js +1 -1
  282. package/table/index.d.ts +7 -0
  283. package/table/index.es.js +1708 -156
  284. package/table/index.umd.js +1 -1
  285. package/table/style.css +1 -1
  286. package/tabs/index.d.ts +7 -0
  287. package/tabs/index.es.js +6 -3
  288. package/tabs/index.umd.js +1 -1
  289. package/tag/index.d.ts +7 -0
  290. package/tag/index.es.js +131 -0
  291. package/tag/index.umd.js +1 -0
  292. package/tag/package.json +7 -0
  293. package/tag/style.css +1 -0
  294. package/tag-input/index.d.ts +7 -0
  295. package/tag-input/index.es.js +1 -13
  296. package/tag-input/index.umd.js +1 -1
  297. package/textarea/index.d.ts +7 -0
  298. package/textarea/index.es.js +132 -0
  299. package/textarea/index.umd.js +1 -0
  300. package/textarea/package.json +7 -0
  301. package/textarea/style.css +1 -0
  302. package/time-axis/index.d.ts +7 -0
  303. package/time-axis/index.es.js +241 -21
  304. package/time-axis/index.umd.js +1 -1
  305. package/time-axis/style.css +1 -1
  306. package/time-picker/index.d.ts +7 -0
  307. package/time-picker/index.es.js +266 -32
  308. package/time-picker/index.umd.js +1 -1
  309. package/time-picker/style.css +1 -1
  310. package/toast/index.d.ts +7 -0
  311. package/toast/index.es.js +16 -12
  312. package/toast/index.umd.js +1 -1
  313. package/toast/style.css +1 -1
  314. package/tooltip/index.d.ts +7 -0
  315. package/transfer/index.d.ts +7 -0
  316. package/transfer/index.es.js +575 -83
  317. package/transfer/index.umd.js +1 -1
  318. package/transfer/style.css +1 -1
  319. package/tree/index.d.ts +7 -0
  320. package/tree/index.es.js +171 -35
  321. package/tree/index.umd.js +1 -1
  322. package/tree-select/index.d.ts +7 -0
  323. package/tree-select/index.es.js +528 -0
  324. package/tree-select/index.umd.js +1 -0
  325. package/tree-select/package.json +7 -0
  326. package/tree-select/style.css +1 -0
  327. package/upload/index.d.ts +7 -0
  328. package/upload/index.es.js +172 -513
  329. package/upload/index.umd.js +1 -1
  330. package/upload/style.css +1 -1
  331. package/vue-devui.es.js +22079 -8773
  332. package/vue-devui.umd.js +29 -3
@@ -0,0 +1,535 @@
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 { ref, watch, defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, onUnmounted, withDirectives, vShow, reactive, toRef, isRef, toRefs } from "vue";
21
+ const dropdownProps = {
22
+ origin: {
23
+ type: Object
24
+ },
25
+ isOpen: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ trigger: {
34
+ type: String,
35
+ default: "click"
36
+ },
37
+ closeScope: {
38
+ type: String,
39
+ default: "all"
40
+ },
41
+ closeOnMouseLeaveMenu: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ showAnimation: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ width: {
50
+ type: [Number, String],
51
+ default: "102px"
52
+ }
53
+ };
54
+ function isComponent(target) {
55
+ return !!(target == null ? void 0 : target.$el);
56
+ }
57
+ function getElement(element) {
58
+ if (element instanceof Element) {
59
+ return element;
60
+ }
61
+ if (element && typeof element === "object" && element.$el instanceof Element) {
62
+ return element.$el;
63
+ }
64
+ return null;
65
+ }
66
+ function subscribeEvent(dom, type, callback) {
67
+ dom == null ? void 0 : dom.addEventListener(type, callback);
68
+ return () => {
69
+ dom == null ? void 0 : dom.removeEventListener(type, callback);
70
+ };
71
+ }
72
+ const useDropdown = ({
73
+ visible,
74
+ trigger,
75
+ origin,
76
+ closeScope,
77
+ closeOnMouseLeaveMenu
78
+ }) => {
79
+ const dropdownElRef = ref();
80
+ const closeByScope = () => {
81
+ if (closeScope.value === "none") {
82
+ return;
83
+ }
84
+ visible.value = false;
85
+ };
86
+ watch([trigger, origin, dropdownElRef], ([trigger2, origin2, dropdownEl], ov, onInvalidate) => {
87
+ const originEl = getElement(origin2);
88
+ if (!originEl || !dropdownEl) {
89
+ return;
90
+ }
91
+ const subscriptions = [
92
+ subscribeEvent(dropdownEl, "click", () => {
93
+ if (closeScope.value === "all") {
94
+ visible.value = false;
95
+ }
96
+ })
97
+ ];
98
+ if (trigger2 === "click") {
99
+ subscriptions.push(subscribeEvent(originEl, "click", () => visible.value = !visible.value), subscribeEvent(document, "click", (e) => {
100
+ if (!visible.value) {
101
+ return;
102
+ }
103
+ const target = e.target;
104
+ const isContain = originEl.contains(target) || dropdownEl.contains(target);
105
+ if (isContain) {
106
+ return;
107
+ }
108
+ closeByScope();
109
+ }), subscribeEvent(dropdownEl, "mouseleave", () => {
110
+ if (closeOnMouseLeaveMenu.value) {
111
+ visible.value = false;
112
+ }
113
+ }));
114
+ } else if (trigger2 === "hover") {
115
+ let overlayEnter = false;
116
+ let originEnter = false;
117
+ const handleLeave = async (elementType) => {
118
+ await new Promise((resolve) => setTimeout(resolve, 50));
119
+ if (elementType === "origin" && overlayEnter || elementType === "dropdown" && originEnter) {
120
+ return;
121
+ }
122
+ closeByScope();
123
+ };
124
+ subscriptions.push(subscribeEvent(originEl, "mouseenter", () => {
125
+ originEnter = true;
126
+ visible.value = true;
127
+ }), subscribeEvent(originEl, "mouseleave", () => {
128
+ originEnter = false;
129
+ if (!closeOnMouseLeaveMenu.value) {
130
+ handleLeave("origin");
131
+ }
132
+ }), subscribeEvent(dropdownEl, "mouseenter", () => {
133
+ overlayEnter = true;
134
+ visible.value = true;
135
+ }), subscribeEvent(dropdownEl, "mouseleave", () => {
136
+ overlayEnter = false;
137
+ handleLeave("dropdown");
138
+ }));
139
+ }
140
+ onInvalidate(() => subscriptions.forEach((v) => v()));
141
+ });
142
+ return { dropdownEl: dropdownElRef };
143
+ };
144
+ var overlay = "";
145
+ function _isSlot(s) {
146
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
147
+ }
148
+ const CommonOverlay = defineComponent({
149
+ setup(props, ctx) {
150
+ return () => {
151
+ let _slot;
152
+ return createVNode(Teleport, {
153
+ "to": "#d-overlay-anchor"
154
+ }, {
155
+ default: () => [createVNode(Transition, {
156
+ "name": "devui-overlay-fade"
157
+ }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
158
+ default: () => [_slot]
159
+ })]
160
+ });
161
+ };
162
+ }
163
+ });
164
+ const overlayProps = {
165
+ visible: {
166
+ type: Boolean
167
+ },
168
+ backgroundBlock: {
169
+ type: Boolean,
170
+ default: false
171
+ },
172
+ backgroundClass: {
173
+ type: String,
174
+ default: ""
175
+ },
176
+ backgroundStyle: {
177
+ type: [String, Object]
178
+ },
179
+ onBackdropClick: {
180
+ type: Function
181
+ },
182
+ backdropClose: {
183
+ type: Boolean,
184
+ default: true
185
+ },
186
+ hasBackdrop: {
187
+ type: Boolean,
188
+ default: true
189
+ }
190
+ };
191
+ const overlayEmits = ["update:visible", "backdropClick"];
192
+ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
193
+ overlayStyle: {
194
+ type: [String, Object],
195
+ default: void 0
196
+ }
197
+ });
198
+ const flexibleOverlayProps = __spreadValues({
199
+ origin: {
200
+ type: Object,
201
+ require: true
202
+ },
203
+ position: {
204
+ type: Object,
205
+ default: () => ({
206
+ originX: "left",
207
+ originY: "top",
208
+ overlayX: "left",
209
+ overlayY: "top"
210
+ })
211
+ }
212
+ }, overlayProps);
213
+ function useOverlayLogic(props, ctx) {
214
+ const backgroundClass = computed(() => {
215
+ return [
216
+ "devui-overlay-background",
217
+ props.backgroundClass,
218
+ !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
219
+ ];
220
+ });
221
+ const overlayClass = computed(() => {
222
+ return "devui-overlay";
223
+ });
224
+ const handleBackdropClick = (event) => {
225
+ var _a;
226
+ event.preventDefault();
227
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
228
+ if (props.backdropClose) {
229
+ ctx.emit("update:visible", false);
230
+ }
231
+ };
232
+ const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
233
+ onMounted(() => {
234
+ const body = document.body;
235
+ const originOverflow = body.style.overflow;
236
+ const originPosition = body.style.position;
237
+ watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
238
+ if (backgroundBlock) {
239
+ const top = body.getBoundingClientRect().y;
240
+ if (visible) {
241
+ body.style.overflowY = "scroll";
242
+ body.style.position = visible ? "fixed" : "";
243
+ body.style.top = `${top}px`;
244
+ } else {
245
+ body.style.overflowY = originOverflow;
246
+ body.style.position = originPosition;
247
+ body.style.top = "";
248
+ window.scrollTo(0, -top);
249
+ }
250
+ }
251
+ });
252
+ onUnmounted(() => {
253
+ document.body.style.overflow = originOverflow;
254
+ });
255
+ });
256
+ return {
257
+ backgroundClass,
258
+ overlayClass,
259
+ handleBackdropClick,
260
+ handleOverlayBubbleCancel
261
+ };
262
+ }
263
+ const FixedOverlay = defineComponent({
264
+ name: "DFixedOverlay",
265
+ props: fixedOverlayProps,
266
+ emits: overlayEmits,
267
+ setup(props, ctx) {
268
+ const {
269
+ backgroundClass,
270
+ overlayClass,
271
+ handleBackdropClick,
272
+ handleOverlayBubbleCancel
273
+ } = useOverlayLogic(props, ctx);
274
+ return () => createVNode(CommonOverlay, null, {
275
+ default: () => [withDirectives(createVNode("div", {
276
+ "class": backgroundClass.value,
277
+ "style": props.backgroundStyle,
278
+ "onClick": handleBackdropClick
279
+ }, [createVNode("div", {
280
+ "class": overlayClass.value,
281
+ "style": props.overlayStyle,
282
+ "onClick": handleOverlayBubbleCancel
283
+ }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
284
+ });
285
+ }
286
+ });
287
+ const FlexibleOverlay = defineComponent({
288
+ name: "DFlexibleOverlay",
289
+ props: flexibleOverlayProps,
290
+ emits: overlayEmits,
291
+ setup(props, ctx) {
292
+ const overlayRef = ref(null);
293
+ const positionedStyle = reactive({
294
+ position: "absolute"
295
+ });
296
+ onMounted(async () => {
297
+ const handleRectChange = (position, rect, origin) => {
298
+ const point = calculatePosition(position, rect, origin);
299
+ positionedStyle.left = `${point.x}px`;
300
+ positionedStyle.top = `${point.y}px`;
301
+ };
302
+ const locationElements = computed(() => {
303
+ const overlay2 = overlayRef.value;
304
+ const origin = getOrigin(props.origin);
305
+ if (!overlay2 || !origin) {
306
+ return;
307
+ }
308
+ return {
309
+ origin,
310
+ overlay: overlay2
311
+ };
312
+ });
313
+ const visibleRef = toRef(props, "visible");
314
+ const positionRef = toRef(props, "position");
315
+ watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
316
+ if (!visible || !locationElements2) {
317
+ return;
318
+ }
319
+ const {
320
+ origin,
321
+ overlay: overlay2
322
+ } = locationElements2;
323
+ handleRectChange(position, overlay2.getBoundingClientRect(), origin);
324
+ const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
325
+ onInvalidate(() => {
326
+ unsubscriptions.forEach((fn) => fn());
327
+ });
328
+ });
329
+ });
330
+ const {
331
+ backgroundClass,
332
+ overlayClass,
333
+ handleBackdropClick,
334
+ handleOverlayBubbleCancel
335
+ } = useOverlayLogic(props, ctx);
336
+ return () => createVNode(CommonOverlay, null, {
337
+ default: () => [withDirectives(createVNode("div", {
338
+ "style": props.backgroundStyle,
339
+ "class": backgroundClass.value,
340
+ "onClick": handleBackdropClick
341
+ }, [createVNode("div", {
342
+ "ref": overlayRef,
343
+ "class": overlayClass.value,
344
+ "style": positionedStyle,
345
+ "onClick": handleOverlayBubbleCancel
346
+ }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
347
+ });
348
+ }
349
+ });
350
+ function getOrigin(origin) {
351
+ if (origin instanceof Element) {
352
+ return origin;
353
+ }
354
+ if (isRef(origin)) {
355
+ return getElement(origin.value);
356
+ }
357
+ if (isComponent(origin)) {
358
+ return getElement(origin);
359
+ }
360
+ return origin;
361
+ }
362
+ function calculatePosition(position, rect, origin) {
363
+ const originRect = getOriginRect(origin);
364
+ const originPoint = getOriginRelativePoint(originRect, position);
365
+ return getOverlayPoint(originPoint, rect, position);
366
+ }
367
+ function getOriginRect(origin) {
368
+ if (origin instanceof Element) {
369
+ return origin.getBoundingClientRect();
370
+ }
371
+ const width = origin.width || 0;
372
+ const height = origin.height || 0;
373
+ return {
374
+ top: origin.y,
375
+ bottom: origin.y + height,
376
+ left: origin.x,
377
+ right: origin.x + width,
378
+ height,
379
+ width
380
+ };
381
+ }
382
+ function getOverlayPoint(originPoint, rect, position) {
383
+ let x;
384
+ const {
385
+ width,
386
+ height
387
+ } = rect;
388
+ if (position.overlayX == "center") {
389
+ x = originPoint.x - width / 2;
390
+ } else {
391
+ x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
392
+ }
393
+ let y;
394
+ if (position.overlayY == "center") {
395
+ y = originPoint.y - height / 2;
396
+ } else {
397
+ y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
398
+ }
399
+ return {
400
+ x,
401
+ y
402
+ };
403
+ }
404
+ function getOriginRelativePoint(originRect, position) {
405
+ let x;
406
+ if (position.originX == "center") {
407
+ x = originRect.left + originRect.width / 2;
408
+ } else {
409
+ const startX = originRect.left;
410
+ const endX = originRect.right;
411
+ x = position.originX == "left" ? startX : endX;
412
+ }
413
+ let y;
414
+ if (position.originY == "center") {
415
+ y = originRect.top + originRect.height / 2;
416
+ } else {
417
+ y = position.originY == "top" ? originRect.top : originRect.bottom;
418
+ }
419
+ return {
420
+ x,
421
+ y
422
+ };
423
+ }
424
+ function subscribeLayoutEvent(event) {
425
+ window.addEventListener("scroll", event, true);
426
+ window.addEventListener("resize", event);
427
+ window.addEventListener("orientationchange", event);
428
+ return () => {
429
+ window.removeEventListener("scroll", event, true);
430
+ window.removeEventListener("resize", event);
431
+ window.removeEventListener("orientationchange", event);
432
+ };
433
+ }
434
+ function subscribeOverlayResize(overlay2, callback) {
435
+ if (overlay2 instanceof Element) {
436
+ const resizeObserver = new ResizeObserver(callback);
437
+ resizeObserver.observe(overlay2);
438
+ return () => resizeObserver.disconnect();
439
+ }
440
+ return () => {
441
+ };
442
+ }
443
+ function subscribeOriginResize(origin, callback) {
444
+ if (origin instanceof Element) {
445
+ const observer = new MutationObserver(callback);
446
+ observer.observe(origin, {
447
+ attributeFilter: ["style"]
448
+ });
449
+ return () => observer.disconnect();
450
+ }
451
+ return () => {
452
+ };
453
+ }
454
+ FlexibleOverlay.install = function(app) {
455
+ app.component(FlexibleOverlay.name, FlexibleOverlay);
456
+ };
457
+ FixedOverlay.install = function(app) {
458
+ app.component(FixedOverlay.name, FixedOverlay);
459
+ };
460
+ var dropdown = "";
461
+ var Dropdown = defineComponent({
462
+ name: "DDropdown",
463
+ props: dropdownProps,
464
+ emits: [],
465
+ setup(props, ctx) {
466
+ const {
467
+ isOpen,
468
+ origin,
469
+ trigger,
470
+ closeScope,
471
+ closeOnMouseLeaveMenu
472
+ } = toRefs(props);
473
+ const visible = ref(false);
474
+ watch(isOpen, (value) => {
475
+ visible.value = value;
476
+ }, {
477
+ immediate: true
478
+ });
479
+ const position = {
480
+ originX: "center",
481
+ originY: "bottom",
482
+ overlayX: "center",
483
+ overlayY: "top"
484
+ };
485
+ const {
486
+ dropdownEl
487
+ } = useDropdown({
488
+ visible,
489
+ origin,
490
+ trigger,
491
+ closeScope,
492
+ closeOnMouseLeaveMenu
493
+ });
494
+ const animatedVisible = computed(() => {
495
+ return props.showAnimation ? visible.value : true;
496
+ });
497
+ const wrapStyle = computed(() => typeof props.width === "string" ? {
498
+ width: props.width
499
+ } : {
500
+ width: `${props.width}px`
501
+ });
502
+ return () => createVNode(FlexibleOverlay, {
503
+ "origin": props.origin,
504
+ "visible": visible.value,
505
+ "onUpdate:visible": ($event) => visible.value = $event,
506
+ "position": position,
507
+ "hasBackdrop": false
508
+ }, {
509
+ default: () => [createVNode(Transition, {
510
+ "name": "devui-dropdown-fade"
511
+ }, {
512
+ default: () => {
513
+ var _a, _b;
514
+ return [withDirectives(createVNode("div", {
515
+ "ref": dropdownEl,
516
+ "class": "devui-dropdown-menu-wrap",
517
+ "style": wrapStyle.value
518
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, animatedVisible.value]])];
519
+ }
520
+ })]
521
+ });
522
+ }
523
+ });
524
+ Dropdown.install = function(app) {
525
+ app.component(Dropdown.name, Dropdown);
526
+ };
527
+ var index = {
528
+ title: "Dropdown \u4E0B\u62C9\u83DC\u5355",
529
+ category: "\u5BFC\u822A",
530
+ status: "10%",
531
+ install(app) {
532
+ app.use(Dropdown);
533
+ }
534
+ };
535
+ export { Dropdown, index as default };
@@ -0,0 +1 @@
1
+ var Q=Object.defineProperty,W=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var X=(i,t,v)=>t in i?Q(i,t,{enumerable:!0,configurable:!0,writable:!0,value:v}):i[t]=v,R=(i,t)=>{for(var v in t||(t={}))ee.call(t,v)&&X(i,v,t[v]);if(j)for(var v of j(t))te.call(t,v)&&X(i,v,t[v]);return i},Y=(i,t)=>W(i,Z(t));(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";const v={origin:{type:Object},isOpen:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},closeScope:{type:String,default:"all"},closeOnMouseLeaveMenu:{type:Boolean,default:!1},showAnimation:{type:Boolean,default:!0},width:{type:[Number,String],default:"102px"}};function _(e){return!!(e==null?void 0:e.$el)}function S(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}function w(e,o,n){return e==null||e.addEventListener(o,n),()=>{e==null||e.removeEventListener(o,n)}}const F=({visible:e,trigger:o,origin:n,closeScope:r,closeOnMouseLeaveMenu:s})=>{const u=t.ref(),l=()=>{r.value!=="none"&&(e.value=!1)};return t.watch([o,n,u],([c,b,f],m,h)=>{const a=S(b);if(!a||!f)return;const y=[w(f,"click",()=>{r.value==="all"&&(e.value=!1)})];if(c==="click")y.push(w(a,"click",()=>e.value=!e.value),w(document,"click",d=>{if(!e.value)return;const p=d.target;a.contains(p)||f.contains(p)||l()}),w(f,"mouseleave",()=>{s.value&&(e.value=!1)}));else if(c==="hover"){let d=!1,p=!1;const O=async g=>{await new Promise(k=>setTimeout(k,50)),!(g==="origin"&&d||g==="dropdown"&&p)&&l()};y.push(w(a,"mouseenter",()=>{p=!0,e.value=!0}),w(a,"mouseleave",()=>{p=!1,s.value||O("origin")}),w(f,"mouseenter",()=>{d=!0,e.value=!0}),w(f,"mouseleave",()=>{d=!1,O("dropdown")}))}h(()=>y.forEach(d=>d()))}),{dropdownEl:u}};var ne="";function M(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const V=t.defineComponent({setup(e,o){return()=>{let n;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},M(n=t.renderSlot(o.slots,"default"))?n:{default:()=>[n]})]})}}}),D={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}},N=["update:visible","backdropClick"],T=Y(R({},D),{overlayStyle:{type:[String,Object],default:void 0}}),$=R({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},D);function L(e,o){const n=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),r=t.computed(()=>"devui-overlay"),s=l=>{var c;l.preventDefault(),(c=e.onBackdropClick)==null||c.call(e),e.backdropClose&&o.emit("update:visible",!1)},u=l=>l.cancelBubble=!0;return t.onMounted(()=>{const l=document.body,c=l.style.overflow,b=l.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([f,m])=>{if(m){const h=l.getBoundingClientRect().y;f?(l.style.overflowY="scroll",l.style.position=f?"fixed":"",l.style.top=`${h}px`):(l.style.overflowY=c,l.style.position=b,l.style.top="",window.scrollTo(0,-h))}}),t.onUnmounted(()=>{document.body.style.overflow=c})}),{backgroundClass:n,overlayClass:r,handleBackdropClick:s,handleOverlayBubbleCancel:u}}const E=t.defineComponent({name:"DFixedOverlay",props:T,emits:N,setup(e,o){const{backgroundClass:n,overlayClass:r,handleBackdropClick:s,handleOverlayBubbleCancel:u}=L(e,o);return()=>t.createVNode(V,null,{default:()=>[t.withDirectives(t.createVNode("div",{class:n.value,style:e.backgroundStyle,onClick:s},[t.createVNode("div",{class:r.value,style:e.overlayStyle,onClick:u},[t.renderSlot(o.slots,"default")])]),[[t.vShow,e.visible]])]})}}),B=t.defineComponent({name:"DFlexibleOverlay",props:$,emits:N,setup(e,o){const n=t.ref(null),r=t.reactive({position:"absolute"});t.onMounted(async()=>{const b=(a,y,d)=>{const p=P(a,y,d);r.left=`${p.x}px`,r.top=`${p.y}px`},f=t.computed(()=>{const a=n.value,y=z(e.origin);if(!(!a||!y))return{origin:y,overlay:a}}),m=t.toRef(e,"visible"),h=t.toRef(e,"position");t.watch([f,m,h],async([a,y,d],p,O)=>{if(!y||!a)return;const{origin:g,overlay:k}=a;b(d,k.getBoundingClientRect(),g);const K=[G(()=>b(d,k.getBoundingClientRect(),g)),H(k,x=>b(d,x[0].contentRect,g)),I(g,()=>b(d,k.getBoundingClientRect(),g))];O(()=>{K.forEach(x=>x())})})});const{backgroundClass:s,overlayClass:u,handleBackdropClick:l,handleOverlayBubbleCancel:c}=L(e,o);return()=>t.createVNode(V,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:s.value,onClick:l},[t.createVNode("div",{ref:n,class:u.value,style:r,onClick:c},[t.renderSlot(o.slots,"default")])]),[[t.vShow,e.visible]])]})}});function z(e){return e instanceof Element?e:t.isRef(e)?S(e.value):_(e)?S(e):e}function P(e,o,n){const r=A(n),s=U(r,e);return q(s,o,e)}function A(e){if(e instanceof Element)return e.getBoundingClientRect();const o=e.width||0,n=e.height||0;return{top:e.y,bottom:e.y+n,left:e.x,right:e.x+o,height:n,width:o}}function q(e,o,n){let r;const{width:s,height:u}=o;n.overlayX=="center"?r=e.x-s/2:r=n.overlayX=="left"?e.x:e.x-s;let l;return n.overlayY=="center"?l=e.y-u/2:l=n.overlayY=="top"?e.y:e.y-u,{x:r,y:l}}function U(e,o){let n;if(o.originX=="center")n=e.left+e.width/2;else{const s=e.left,u=e.right;n=o.originX=="left"?s:u}let r;return o.originY=="center"?r=e.top+e.height/2:r=o.originY=="top"?e.top:e.bottom,{x:n,y:r}}function G(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 H(e,o){if(e instanceof Element){const n=new ResizeObserver(o);return n.observe(e),()=>n.disconnect()}return()=>{}}function I(e,o){if(e instanceof Element){const n=new MutationObserver(o);return n.observe(e,{attributeFilter:["style"]}),()=>n.disconnect()}return()=>{}}B.install=function(e){e.component(B.name,B)},E.install=function(e){e.component(E.name,E)};var oe="",C=t.defineComponent({name:"DDropdown",props:v,emits:[],setup(e,o){const{isOpen:n,origin:r,trigger:s,closeScope:u,closeOnMouseLeaveMenu:l}=t.toRefs(e),c=t.ref(!1);t.watch(n,a=>{c.value=a},{immediate:!0});const b={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{dropdownEl:f}=F({visible:c,origin:r,trigger:s,closeScope:u,closeOnMouseLeaveMenu:l}),m=t.computed(()=>e.showAnimation?c.value:!0),h=t.computed(()=>typeof e.width=="string"?{width:e.width}:{width:`${e.width}px`});return()=>t.createVNode(B,{origin:e.origin,visible:c.value,"onUpdate:visible":a=>c.value=a,position:b,hasBackdrop:!1},{default:()=>[t.createVNode(t.Transition,{name:"devui-dropdown-fade"},{default:()=>{var a,y;return[t.withDirectives(t.createVNode("div",{ref:f,class:"devui-dropdown-menu-wrap",style:h.value},[(y=(a=o.slots).default)==null?void 0:y.call(a)]),[[t.vShow,m.value]])]}})]})}});C.install=function(e){e.component(C.name,C)};var J={title:"Dropdown \u4E0B\u62C9\u83DC\u5355",category:"\u5BFC\u822A",status:"10%",install(e){e.use(C)}};i.Dropdown=C,i.default=J,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "dropdown",
3
+ "version": "0.0.0",
4
+ "main": "index.umd.js",
5
+ "module": "index.es.js",
6
+ "style": "style.css"
7
+ }
@@ -0,0 +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}.devui-dropdown span.icon-chevron-down,.devui-dropdown span.icon-select-arrow{display:inline-block;vertical-align:text-top}.devui-dropdown-menu-wrap .devui-dropdown-menu{width:100%}.devui-dropdown-animation span.icon-chevron-down,.devui-dropdown-animation span.icon-select-arrow{transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-dropdown.open span.icon-chevron-down,.devui-dropdown.open span.icon-select-arrow{transform:rotate(180deg)}@keyframes d-dropdown-fade{0%{opacity:0;transform:scaleY(.9999) scaleY(0)}to{opacity:1;transform:scaleY(.8) scaleY(4px)}}.devui-dropdown-fade-enter{opacity:0}.devui-dropdown-fade-enter-active{animation-name:d-dropdown-fade;animation-duration:.3s}.devui-dropdown-fade-leave{opacity:1}.devui-dropdown-fade-leave-active{animation-name:d-dropdown-fade;animation-duration:.3s;animation-direction:reverse}
@@ -0,0 +1,7 @@
1
+ import { App } from 'vue';
2
+ declare function install(app: App): void
3
+ declare const _default: {
4
+ install: typeof install;
5
+ version: string;
6
+ };
7
+ export default _default;