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

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