vue-devui 1.0.0-rc.1 → 1.0.0-rc.12

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 (352) hide show
  1. package/README.md +70 -121
  2. package/alert/index.es.js +46 -15
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8204 -296
  6. package/auto-complete/index.umd.js +29 -1
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +153 -146
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +36 -5
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5727 -111
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +63 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8068 -255
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{accordion → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +213 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{anchor → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +59 -19
  29. package/countdown/index.umd.js +1 -1
  30. package/{anchor → date-picker-pro}/index.d.ts +0 -0
  31. package/date-picker-pro/index.es.js +10856 -0
  32. package/date-picker-pro/index.umd.js +27 -0
  33. package/{breadcrumb → date-picker-pro}/package.json +1 -1
  34. package/date-picker-pro/style.css +1 -0
  35. package/drawer/index.es.js +31 -4
  36. package/drawer/index.umd.js +1 -1
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +210 -149
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +569 -159
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +1048 -1187
  45. package/form/index.umd.js +15 -15
  46. package/form/style.css +1 -1
  47. package/fullscreen/index.es.js +29 -5
  48. package/fullscreen/index.umd.js +1 -1
  49. package/fullscreen/style.css +1 -1
  50. package/grid/index.es.js +101 -86
  51. package/grid/index.umd.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +183 -23
  54. package/icon/index.umd.js +1 -1
  55. package/icon/style.css +1 -0
  56. package/image-preview/index.es.js +53 -30
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8101 -144
  60. package/input/index.umd.js +27 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +274 -177
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/layout/index.es.js +40 -25
  66. package/layout/index.umd.js +1 -1
  67. package/layout/style.css +1 -1
  68. package/loading/index.es.js +74 -35
  69. package/loading/index.umd.js +1 -1
  70. package/loading/style.css +1 -1
  71. package/modal/index.es.js +375 -171
  72. package/modal/index.umd.js +1 -1
  73. package/modal/style.css +1 -1
  74. package/notification/index.es.js +293 -40
  75. package/notification/index.umd.js +1 -1
  76. package/notification/style.css +1 -1
  77. package/nuxt/components/ButtonGroup.js +3 -0
  78. package/nuxt/components/CheckboxButton.js +3 -0
  79. package/nuxt/components/CheckboxGroup.js +3 -0
  80. package/nuxt/components/Collapse.js +3 -0
  81. package/nuxt/components/CollapseItem.js +3 -0
  82. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  83. package/nuxt/components/DatePickerPro.js +3 -0
  84. package/nuxt/components/DropdownPropsKey.js +3 -0
  85. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  86. package/nuxt/components/FORM_TOKEN.js +3 -0
  87. package/nuxt/components/Icon.js +1 -0
  88. package/nuxt/components/IconGroup.js +3 -0
  89. package/nuxt/components/LABEL_DATA.js +3 -0
  90. package/nuxt/components/LoadingOptions.js +3 -0
  91. package/nuxt/components/Option.js +3 -0
  92. package/nuxt/components/OptionGroup.js +3 -0
  93. package/nuxt/components/RadioButton.js +3 -0
  94. package/nuxt/components/Step.js +3 -0
  95. package/nuxt/components/Steps.js +3 -0
  96. package/nuxt/components/TABLE_TOKEN.js +3 -0
  97. package/nuxt/components/Tab.js +3 -0
  98. package/nuxt/components/TimeSelect.js +3 -0
  99. package/nuxt/components/autoCompleteProps.js +3 -0
  100. package/nuxt/components/avatarProps.js +3 -0
  101. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  102. package/nuxt/components/buttonGroupProps.js +3 -0
  103. package/nuxt/components/cardProps.js +3 -0
  104. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  105. package/nuxt/components/checkboxGroupProps.js +3 -0
  106. package/nuxt/components/checkboxProps.js +3 -0
  107. package/nuxt/components/colProps.js +3 -0
  108. package/nuxt/components/colPropsBaseClass.js +3 -0
  109. package/nuxt/components/colPropsBaseStyle.js +3 -0
  110. package/nuxt/components/collapseItemProps.js +3 -0
  111. package/nuxt/components/collapseProps.js +3 -0
  112. package/nuxt/components/countdownProps.js +3 -0
  113. package/nuxt/components/datePickerProCommonProps.js +3 -0
  114. package/nuxt/components/datePickerProPanelProps.js +3 -0
  115. package/nuxt/components/datePickerProProps.js +3 -0
  116. package/nuxt/components/editableSelectProps.js +3 -0
  117. package/nuxt/components/formItemProps.js +3 -0
  118. package/nuxt/components/formProps.js +3 -0
  119. package/nuxt/components/iconProps.js +1 -0
  120. package/nuxt/components/imagePreviewProps.js +3 -0
  121. package/nuxt/components/inputProps.js +3 -0
  122. package/nuxt/components/loadingProps.js +3 -0
  123. package/nuxt/components/modalProps.js +3 -0
  124. package/nuxt/components/progressProps.js +3 -0
  125. package/nuxt/components/rateProps.js +3 -0
  126. package/nuxt/components/resultProps.js +3 -0
  127. package/nuxt/components/rowProps.js +3 -0
  128. package/nuxt/components/screenSizes.js +3 -0
  129. package/nuxt/components/skeletonProps.js +3 -0
  130. package/nuxt/components/sliderProps.js +3 -0
  131. package/nuxt/components/splitterProps.js +3 -0
  132. package/nuxt/components/statisticProps.js +3 -0
  133. package/nuxt/components/stepProps.js +3 -0
  134. package/nuxt/components/stepsProps.js +3 -0
  135. package/nuxt/components/svgIconProps.js +3 -0
  136. package/nuxt/components/switchProps.js +3 -0
  137. package/nuxt/components/tableProps.js +3 -0
  138. package/nuxt/components/tabsProps.js +3 -0
  139. package/nuxt/components/tagProps.js +3 -0
  140. package/nuxt/components/textareaProps.js +3 -0
  141. package/nuxt/components/timeAxisProps.js +3 -0
  142. package/nuxt/components/timerPickerPanelProps.js +3 -0
  143. package/nuxt/components/treeProps.js +3 -0
  144. package/overlay/index.es.js +104 -133
  145. package/overlay/index.umd.js +1 -1
  146. package/overlay/style.css +1 -1
  147. package/package.json +4 -2
  148. package/pagination/index.es.js +171 -141
  149. package/pagination/index.umd.js +1 -1
  150. package/pagination/style.css +1 -1
  151. package/panel/style.css +1 -1
  152. package/popover/index.es.js +294 -230
  153. package/popover/index.umd.js +15 -15
  154. package/popover/style.css +1 -1
  155. package/progress/index.es.js +110 -56
  156. package/progress/index.umd.js +3 -3
  157. package/progress/style.css +1 -1
  158. package/radio/index.es.js +7967 -146
  159. package/radio/index.umd.js +27 -1
  160. package/radio/style.css +1 -1
  161. package/rate/index.es.js +77 -55
  162. package/rate/index.umd.js +1 -1
  163. package/rate/style.css +1 -1
  164. package/result/index.es.js +170 -27
  165. package/result/index.umd.js +1 -1
  166. package/result/style.css +1 -1
  167. package/ripple/index.es.js +43 -42
  168. package/ripple/index.umd.js +1 -1
  169. package/search/index.es.js +3660 -1097
  170. package/search/index.umd.js +18 -18
  171. package/search/style.css +1 -1
  172. package/select/index.es.js +8998 -487
  173. package/select/index.umd.js +27 -1
  174. package/select/style.css +1 -1
  175. package/skeleton/index.es.js +46 -24
  176. package/skeleton/index.umd.js +1 -1
  177. package/skeleton/style.css +1 -1
  178. package/slider/index.es.js +144 -138
  179. package/slider/index.umd.js +1 -1
  180. package/slider/style.css +1 -1
  181. package/splitter/index.es.js +468 -340
  182. package/splitter/index.umd.js +16 -16
  183. package/splitter/style.css +1 -1
  184. package/statistic/index.es.js +41 -34
  185. package/statistic/index.umd.js +1 -1
  186. package/statistic/style.css +1 -1
  187. package/status/index.es.js +26 -2
  188. package/status/index.umd.js +1 -1
  189. package/status/style.css +1 -1
  190. package/{back-top → steps}/index.d.ts +0 -0
  191. package/steps/index.es.js +385 -0
  192. package/steps/index.umd.js +1 -0
  193. package/{gantt → steps}/package.json +1 -1
  194. package/steps/style.css +1 -0
  195. package/style.css +1 -1
  196. package/switch/index.es.js +7802 -64
  197. package/switch/index.umd.js +27 -1
  198. package/switch/style.css +1 -1
  199. package/table/index.es.js +10315 -1147
  200. package/table/index.umd.js +27 -1
  201. package/table/style.css +1 -1
  202. package/tabs/index.es.js +345 -142
  203. package/tabs/index.umd.js +1 -1
  204. package/tabs/style.css +1 -1
  205. package/tag/index.es.js +47 -23
  206. package/tag/index.umd.js +1 -1
  207. package/tag/style.css +1 -1
  208. package/textarea/index.es.js +7921 -83
  209. package/textarea/index.umd.js +35 -1
  210. package/textarea/style.css +1 -1
  211. package/time-picker/index.es.js +8704 -559
  212. package/time-picker/index.umd.js +27 -1
  213. package/time-picker/style.css +1 -1
  214. package/{breadcrumb → time-select}/index.d.ts +0 -0
  215. package/{color-picker → time-select}/index.es.js +4116 -2914
  216. package/time-select/index.umd.js +27 -0
  217. package/{back-top → time-select}/package.json +1 -1
  218. package/time-select/style.css +1 -0
  219. package/timeline/index.es.js +177 -37
  220. package/timeline/index.umd.js +1 -1
  221. package/timeline/style.css +1 -1
  222. package/tooltip/index.es.js +286 -221
  223. package/tooltip/index.umd.js +15 -15
  224. package/tooltip/style.css +1 -1
  225. package/tree/index.es.js +5325 -1855
  226. package/tree/index.umd.js +18 -18
  227. package/tree/style.css +1 -1
  228. package/upload/index.es.js +456 -133
  229. package/upload/index.umd.js +1 -1
  230. package/upload/style.css +1 -1
  231. package/vue-devui.es.js +14986 -16343
  232. package/vue-devui.umd.js +30 -20
  233. package/accordion/index.es.js +0 -723
  234. package/accordion/index.umd.js +0 -1
  235. package/accordion/package.json +0 -7
  236. package/accordion/style.css +0 -1
  237. package/anchor/index.es.js +0 -263
  238. package/anchor/index.umd.js +0 -1
  239. package/anchor/style.css +0 -1
  240. package/back-top/index.es.js +0 -130
  241. package/back-top/index.umd.js +0 -1
  242. package/back-top/style.css +0 -1
  243. package/breadcrumb/index.es.js +0 -128
  244. package/breadcrumb/index.umd.js +0 -1
  245. package/breadcrumb/style.css +0 -1
  246. package/carousel/index.d.ts +0 -7
  247. package/carousel/index.es.js +0 -314
  248. package/carousel/index.umd.js +0 -1
  249. package/carousel/package.json +0 -7
  250. package/carousel/style.css +0 -1
  251. package/cascader/index.d.ts +0 -7
  252. package/cascader/index.es.js +0 -5971
  253. package/cascader/index.umd.js +0 -27
  254. package/cascader/package.json +0 -7
  255. package/cascader/style.css +0 -1
  256. package/color-picker/index.d.ts +0 -7
  257. package/color-picker/index.umd.js +0 -27
  258. package/color-picker/package.json +0 -7
  259. package/color-picker/style.css +0 -1
  260. package/comment/index.d.ts +0 -7
  261. package/comment/index.es.js +0 -86
  262. package/comment/index.umd.js +0 -1
  263. package/comment/package.json +0 -7
  264. package/comment/style.css +0 -1
  265. package/date-picker/index.d.ts +0 -7
  266. package/date-picker/index.es.js +0 -1154
  267. package/date-picker/index.umd.js +0 -1
  268. package/date-picker/package.json +0 -7
  269. package/date-picker/style.css +0 -1
  270. package/dragdrop/index.d.ts +0 -7
  271. package/dragdrop/index.es.js +0 -157
  272. package/dragdrop/index.umd.js +0 -1
  273. package/dragdrop/package.json +0 -7
  274. package/gantt/index.d.ts +0 -7
  275. package/gantt/index.es.js +0 -523
  276. package/gantt/index.umd.js +0 -1
  277. package/gantt/style.css +0 -1
  278. package/input-icon/index.d.ts +0 -7
  279. package/input-icon/index.es.js +0 -332
  280. package/input-icon/index.umd.js +0 -1
  281. package/input-icon/package.json +0 -7
  282. package/input-icon/style.css +0 -1
  283. package/list/index.d.ts +0 -7
  284. package/list/index.es.js +0 -39
  285. package/list/index.umd.js +0 -1
  286. package/list/package.json +0 -7
  287. package/list/style.css +0 -1
  288. package/nav-sprite/index.d.ts +0 -7
  289. package/nav-sprite/index.es.js +0 -68
  290. package/nav-sprite/index.umd.js +0 -1
  291. package/nav-sprite/package.json +0 -7
  292. package/nuxt/components/Accordion.js +0 -3
  293. package/nuxt/components/Anchor.js +0 -3
  294. package/nuxt/components/BackTop.js +0 -3
  295. package/nuxt/components/Breadcrumb.js +0 -3
  296. package/nuxt/components/Carousel.js +0 -3
  297. package/nuxt/components/CarouselItem.js +0 -3
  298. package/nuxt/components/Cascader.js +0 -3
  299. package/nuxt/components/ColorPicker.js +0 -3
  300. package/nuxt/components/Comment.js +0 -3
  301. package/nuxt/components/DatePicker.js +0 -3
  302. package/nuxt/components/FormControl.js +0 -3
  303. package/nuxt/components/FormLabel.js +0 -3
  304. package/nuxt/components/Gantt.js +0 -3
  305. package/nuxt/components/InputIcon.js +0 -3
  306. package/nuxt/components/List.js +0 -3
  307. package/nuxt/components/ListItem.js +0 -3
  308. package/nuxt/components/NavSprite.js +0 -2
  309. package/nuxt/components/QuadrantDiagram.js +0 -3
  310. package/nuxt/components/ReadTip.js +0 -3
  311. package/nuxt/components/StepsGuide.js +0 -3
  312. package/nuxt/components/StickSlider.js +0 -3
  313. package/nuxt/components/Sticky.js +0 -2
  314. package/nuxt/components/TagInput.js +0 -3
  315. package/nuxt/components/Transfer.js +0 -3
  316. package/nuxt/components/TreeSelect.js +0 -3
  317. package/nuxt/components/overlayEmits.js +0 -3
  318. package/nuxt/components/overlayProps.js +0 -3
  319. package/quadrant-diagram/index.d.ts +0 -7
  320. package/quadrant-diagram/index.es.js +0 -5728
  321. package/quadrant-diagram/index.umd.js +0 -27
  322. package/quadrant-diagram/package.json +0 -7
  323. package/quadrant-diagram/style.css +0 -1
  324. package/read-tip/index.d.ts +0 -7
  325. package/read-tip/index.es.js +0 -261
  326. package/read-tip/index.umd.js +0 -1
  327. package/read-tip/package.json +0 -7
  328. package/read-tip/style.css +0 -1
  329. package/steps-guide/index.d.ts +0 -7
  330. package/steps-guide/index.es.js +0 -242
  331. package/steps-guide/index.umd.js +0 -1
  332. package/steps-guide/package.json +0 -7
  333. package/steps-guide/style.css +0 -1
  334. package/sticky/index.d.ts +0 -7
  335. package/sticky/index.es.js +0 -197
  336. package/sticky/index.umd.js +0 -1
  337. package/sticky/package.json +0 -7
  338. package/tag-input/index.d.ts +0 -7
  339. package/tag-input/index.es.js +0 -331
  340. package/tag-input/index.umd.js +0 -1
  341. package/tag-input/package.json +0 -7
  342. package/tag-input/style.css +0 -1
  343. package/transfer/index.d.ts +0 -7
  344. package/transfer/index.es.js +0 -7615
  345. package/transfer/index.umd.js +0 -27
  346. package/transfer/package.json +0 -7
  347. package/transfer/style.css +0 -1
  348. package/tree-select/index.d.ts +0 -7
  349. package/tree-select/index.es.js +0 -627
  350. package/tree-select/index.umd.js +0 -1
  351. package/tree-select/package.json +0 -7
  352. package/tree-select/style.css +0 -1
@@ -53,14 +53,41 @@ const drawerOverlayProps = {
53
53
  visible: {
54
54
  type: Boolean,
55
55
  default: false
56
+ },
57
+ onClick: {
58
+ type: Function
56
59
  }
57
60
  };
61
+ function createBem(namespace, element, modifier) {
62
+ let cls = namespace;
63
+ if (element) {
64
+ cls += `__${element}`;
65
+ }
66
+ if (modifier) {
67
+ cls += `--${modifier}`;
68
+ }
69
+ return cls;
70
+ }
71
+ function useNamespace(block, needDot = false) {
72
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
73
+ const b = () => createBem(namespace);
74
+ const e = (element) => element ? createBem(namespace, element) : "";
75
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
76
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
77
+ return {
78
+ b,
79
+ e,
80
+ m,
81
+ em
82
+ };
83
+ }
58
84
  var drawerOverlay = "";
59
85
  var DrawerOverlay = defineComponent({
60
86
  name: "DDrawerOverlay",
61
87
  props: drawerOverlayProps,
62
88
  emits: ["click"],
63
89
  setup(props, ctx) {
90
+ const ns = useNamespace("drawer");
64
91
  const handleClick = (e) => {
65
92
  ctx.emit("click", e);
66
93
  };
@@ -68,7 +95,7 @@ var DrawerOverlay = defineComponent({
68
95
  "name": "drawer-overlay-fade"
69
96
  }, {
70
97
  default: () => [props.visible && createVNode("div", {
71
- "class": "devui-drawer-overlay",
98
+ "class": ns.e("overlay"),
72
99
  "onClick": handleClick
73
100
  }, null)]
74
101
  });
@@ -94,10 +121,11 @@ function lockScroll() {
94
121
  return;
95
122
  }
96
123
  function useDrawer(props, emit) {
124
+ const ns = useNamespace("drawer");
97
125
  const drawerRef = ref();
98
126
  const drawerClasses = computed(() => ({
99
- "devui-drawer": true,
100
- [`devui-drawer-${props.position}`]: true
127
+ [ns.b()]: true,
128
+ [ns.m(props.position)]: true
101
129
  }));
102
130
  const close = () => {
103
131
  emit("update:modelValue", false);
@@ -195,7 +223,6 @@ function initInstance(state) {
195
223
  state.modelValue = false;
196
224
  };
197
225
  onUnmounted(() => {
198
- console.log(111);
199
226
  document.body.removeChild(container);
200
227
  });
201
228
  return () => createVNode(Drawer, mergeProps(state, {
@@ -1 +1 @@
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"});
1
+ var T=Object.defineProperty;var h=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var V=(l,t,a)=>t in l?T(l,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[t]=a,p=(l,t)=>{for(var a in t||(t={}))I.call(t,a)&&V(l,a,t[a]);if(h)for(var a of h(t))$.call(t,a)&&V(l,a,t[a]);return l};(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.index={},l.Vue,l.core))})(this,function(l,t,a){"use strict";const O={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}},E={visible:{type:Boolean,default:!1},onClick:{type:Function}};function i(e,o,n){let r=e;return o&&(r+=`__${o}`),n&&(r+=`--${n}`),r}function w(e,o=!1){const n=o?`.devui-${e}`:`devui-${e}`;return{b:()=>i(n),e:c=>c?i(n,c):"",m:c=>c?i(n,"",c):"",em:(c,f)=>c&&f?i(n,c,f):""}}var z="",k=t.defineComponent({name:"DDrawerOverlay",props:E,emits:["click"],setup(e,o){const n=w("drawer"),r=d=>{o.emit("click",d)};return()=>t.createVNode(t.Transition,{name:"drawer-overlay-fade"},{default:()=>[e.visible&&t.createVNode("div",{class:n.e("overlay"),onClick:r},null)]})}});function g(){if(document.documentElement.scrollHeight>document.documentElement.clientHeight){const e=document.documentElement.scrollTop,o=document.documentElement.getAttribute("style");return document.documentElement.style.position="fixed",document.documentElement.style.top=`-${e}px`,document.documentElement.style.width=document.documentElement.style.width||"100%",document.documentElement.style.overflowY="scroll",()=>{o?document.documentElement.setAttribute("style",o):document.documentElement.removeAttribute("style"),document.documentElement.scrollTop=e}}}function D(e,o){const n=w("drawer"),r=t.ref(),d=t.computed(()=>({[n.b()]:!0,[n.m(e.position)]:!0})),s=()=>{o("update:modelValue",!1),o("close")};let u;const c=()=>{e.beforeClose?e.beforeClose(s):s()},f=()=>{e.closeOnClickOverlay&&c()},b=y=>{y.code==="Escape"&&c()};a.onClickOutside(r,c);const v=()=>{u==null||u(),document.removeEventListener("keyup",b)};return t.watch(()=>e.modelValue,y=>{y?(o("open"),e.lockScroll&&(u=g()),e.escKeyCloseable&&document.addEventListener("keyup",b)):v()}),t.onUnmounted(v),{drawerRef:r,drawerClasses:d,handleOverlayClick:f}}var A="",m=t.defineComponent({name:"DDrawer",inheritAttrs:!1,props:O,emits:["close","update:modelValue","open"],setup(e,{emit:o,slots:n,attrs:r}){const{drawerRef:d,drawerClasses:s,handleOverlayClick:u}=D(e,o);return()=>t.createVNode(t.Teleport,{to:"body"},{default:()=>[e.showOverlay&&t.createVNode(k,{visible:e.modelValue,style:{zIndex:e.zIndex},onClick:u},null),t.createVNode(t.Transition,{name:`drawer-fly-${e.position}`},{default:()=>{var c;return[e.modelValue&&t.createVNode("div",t.mergeProps({ref:d,class:s.value,style:{zIndex:e.zIndex+1}},r),[(c=n.default)==null?void 0:c.call(n)])]}})]})}});function S(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const x={modelValue:!1,content:"",zIndex:1e3,showOverlay:!0,escKeyCloseable:!0,position:"right",lockScroll:!0,closeOnClickOverlay:!0};function N(e){const o=document.createElement("div"),n=e.content;delete e.content;const r=t.createApp({setup(){const d=()=>{e.modelValue=!1};return t.onUnmounted(()=>{document.body.removeChild(o)}),()=>t.createVNode(m,t.mergeProps(e,{"onUpdate:modelValue":d}),S(n)?n:{default:()=>[n]})}});return document.body.appendChild(o),r.mount(o),r}class C{open(o){const n=t.reactive(p(p({},x),o)),r=N(n);return n.modelValue=!0,{close:()=>{n.modelValue=!1,r.unmount()}}}}var B={title:"Drawer \u62BD\u5C49\u677F",category:"\u53CD\u9988",status:"75%",install(e){e.component(m.name,m),e.config.globalProperties.$drawerService=new C}};l.Drawer=m,l.DrawerService=C,l.default=B,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
package/drawer/style.css CHANGED
@@ -1 +1 @@
1
- .devui-drawer-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--devui-shadow, rgba(0, 0, 0, .2))}.drawer-overlay-fade-enter-active,.drawer-overlay-fade-leave-active{transition:opacity .1s linear}.drawer-overlay-fade-enter-from,.drawer-overlay-fade-leave-to{opacity:0}.devui-drawer{position:fixed;top:0;bottom:0;width:300px;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-base-bg, #ffffff);transform:translate(0);opacity:1;overflow:auto;box-shadow:var(--devui-shadow-fullscreen-overlay, 0 8px 40px 0) var(--devui-shadow, rgba(0, 0, 0, .2))}.devui-drawer-left{left:0}.devui-drawer-right{right:0}.drawer-fly-right-enter-active{transition:all .3s cubic-bezier(.16,.75,.5,1)}.drawer-fly-right-leave-active{transition:all .3s cubic-bezier(.5,0,.84,.25)}.drawer-fly-right-enter-from,.drawer-fly-right-leave-to{opacity:0;transform:translate(100%)}.drawer-fly-left-enter-active{transition:all .3s cubic-bezier(.16,.75,.5,1)}.drawer-fly-left-leave-active{transition:all .3s cubic-bezier(.5,0,.84,.25)}.drawer-fly-left-enter-from,.drawer-fly-left-leave-to{opacity:0;transform:translate(-100%)}
1
+ .devui-drawer__overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--devui-shadow, rgba(37, 43, 58, .2))}.drawer-overlay-fade-enter-active,.drawer-overlay-fade-leave-active{transition:opacity .1s linear}.drawer-overlay-fade-enter-from,.drawer-overlay-fade-leave-to{opacity:0}.devui-drawer{position:fixed;top:0;bottom:0;width:300px;border-radius:var(--devui-border-radius, 4px);background-color:var(--devui-base-bg, #ffffff);transform:translate(0);opacity:1;overflow:auto;box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 12px 24px 0) var(--devui-shadow, rgba(37, 43, 58, .2))}.devui-drawer--left{left:0}.devui-drawer--right{right:0}.drawer-fly-right-enter-active{transition:all .3s cubic-bezier(.16,.75,.5,1)}.drawer-fly-right-leave-active{transition:all .3s cubic-bezier(.5,0,.84,.25)}.drawer-fly-right-enter-from,.drawer-fly-right-leave-to{opacity:0;transform:translate(100%)}.drawer-fly-left-enter-active{transition:all .3s cubic-bezier(.16,.75,.5,1)}.drawer-fly-left-leave-active{transition:all .3s cubic-bezier(.5,0,.84,.25)}.drawer-fly-left-enter-from,.drawer-fly-left-leave-to{opacity:0;transform:translate(-100%)}
@@ -17,8 +17,8 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { toRefs, watch, onMounted, onUnmounted, ref, computed, defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, unref, nextTick, mergeProps, Fragment, withDirectives, vShow } from "vue";
21
- import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
20
+ import { toRefs, watch, onMounted, onUnmounted, ref, computed, defineComponent, createVNode, Transition, mergeProps, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow } from "vue";
21
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
22
22
  import { onClickOutside } from "@vueuse/core";
23
23
  const dropdownProps = {
24
24
  visible: {
@@ -45,6 +45,9 @@ const dropdownProps = {
45
45
  type: [Number, Object],
46
46
  default: 4
47
47
  },
48
+ shiftOffset: {
49
+ type: Number
50
+ },
48
51
  closeOnMouseLeaveMenu: {
49
52
  type: Boolean,
50
53
  default: false
@@ -62,6 +65,7 @@ const dropdownProps = {
62
65
  default: true
63
66
  }
64
67
  };
68
+ const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
65
69
  function getElement(element) {
66
70
  if (element instanceof Element) {
67
71
  return element;
@@ -107,7 +111,7 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
107
111
  setTimeout(() => {
108
112
  subscriptions.push(subscribeEvent(document, "click", (e) => {
109
113
  const dropdownValues = [...dropdownMap.values()];
110
- if (!isOpen.value || closeScope.value === "none" || dropdownEl.contains(e.target) && closeScope.value === "blank" || dropdownValues.some((item) => {
114
+ if (!isOpen.value || closeScope.value === "none" || (dropdownEl == null ? void 0 : dropdownEl.contains(e.target)) && closeScope.value === "blank" || dropdownValues.some((item) => {
111
115
  var _a;
112
116
  return (_a = item.toggleEl) == null ? void 0 : _a.contains(e.target);
113
117
  }) && dropdownValues.some((item) => {
@@ -222,132 +226,109 @@ function useOverlayProps(props, currentPosition, isOpen) {
222
226
  });
223
227
  return { overlayModelValue, overlayShowValue, styles, classes, handlePositionChange };
224
228
  }
225
- var baseOverlay = "";
226
- function _isSlot(s) {
227
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
228
- }
229
- const CommonOverlay = defineComponent({
230
- setup(props, ctx) {
231
- return () => {
232
- let _slot;
233
- return createVNode(Teleport, {
234
- "to": "#d-overlay-anchor"
235
- }, {
236
- default: () => [createVNode(Transition, {
237
- "name": "devui-overlay-fade"
238
- }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
239
- default: () => [_slot]
240
- })]
241
- });
242
- };
243
- }
244
- });
245
- const overlayProps = {
246
- visible: {
247
- type: Boolean
248
- },
249
- backgroundBlock: {
229
+ const fixedOverlayProps = {
230
+ modelValue: {
250
231
  type: Boolean,
251
232
  default: false
252
233
  },
253
- backgroundClass: {
254
- type: String,
255
- default: ""
256
- },
257
- backgroundStyle: {
258
- type: [String, Object]
259
- },
260
- onBackdropClick: {
261
- type: Function
262
- },
263
- backdropClose: {
234
+ lockScroll: {
264
235
  type: Boolean,
265
236
  default: true
266
237
  },
267
- hasBackdrop: {
238
+ closeOnClickOverlay: {
268
239
  type: Boolean,
269
240
  default: true
270
241
  }
271
242
  };
272
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
273
- overlayStyle: {
274
- type: [String, Object],
275
- default: void 0
243
+ function lockScroll() {
244
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
245
+ const scrollTop = document.documentElement.scrollTop;
246
+ const style = document.documentElement.getAttribute("style");
247
+ document.documentElement.style.position = "fixed";
248
+ document.documentElement.style.top = `-${scrollTop}px`;
249
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
250
+ document.documentElement.style.overflowY = "scroll";
251
+ return () => {
252
+ if (style) {
253
+ document.documentElement.setAttribute("style", style);
254
+ } else {
255
+ document.documentElement.removeAttribute("style");
256
+ }
257
+ document.documentElement.scrollTop = scrollTop;
258
+ };
276
259
  }
277
- });
278
- const overlayEmits = ["update:visible", "backdropClick"];
279
- function useOverlayLogic(props, ctx) {
280
- const backgroundClass = computed(() => {
281
- return [
282
- "devui-overlay-background",
283
- props.backgroundClass,
284
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
285
- ];
286
- });
287
- const overlayClass = computed(() => {
288
- return "devui-overlay";
289
- });
290
- const handleBackdropClick = (event) => {
291
- var _a;
260
+ return;
261
+ }
262
+ function useFixedOverlay(props, ctx) {
263
+ let lockScrollCb;
264
+ const onClick = (event) => {
292
265
  event.preventDefault();
293
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
294
- if (props.backdropClose) {
295
- ctx.emit("update:visible", false);
266
+ ctx.emit("click", event);
267
+ if (props.closeOnClickOverlay) {
268
+ ctx.emit("update:modelValue", false);
296
269
  }
297
270
  };
298
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
299
- onMounted(() => {
300
- const body = document.body;
301
- const originOverflow = body.style.overflow;
302
- const originPosition = body.style.position;
303
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
304
- if (backgroundBlock) {
305
- const top = body.getBoundingClientRect().y;
306
- if (visible) {
307
- body.style.overflowY = "scroll";
308
- body.style.position = visible ? "fixed" : "";
309
- body.style.top = `${top}px`;
310
- } else {
311
- body.style.overflowY = originOverflow;
312
- body.style.position = originPosition;
313
- body.style.top = "";
314
- window.scrollTo(0, -top);
315
- }
316
- }
317
- });
318
- onUnmounted(() => {
319
- document.body.style.overflow = originOverflow;
320
- });
271
+ const removeBodyAdditions = () => {
272
+ lockScrollCb == null ? void 0 : lockScrollCb();
273
+ };
274
+ watch(() => props.modelValue, (val) => {
275
+ if (val) {
276
+ props.lockScroll && (lockScrollCb = lockScroll());
277
+ } else {
278
+ removeBodyAdditions();
279
+ }
321
280
  });
281
+ onUnmounted(removeBodyAdditions);
282
+ return { onClick };
283
+ }
284
+ function createBem(namespace, element, modifier) {
285
+ let cls = namespace;
286
+ if (element) {
287
+ cls += `__${element}`;
288
+ }
289
+ if (modifier) {
290
+ cls += `--${modifier}`;
291
+ }
292
+ return cls;
293
+ }
294
+ function useNamespace(block, needDot = false) {
295
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
296
+ const b = () => createBem(namespace);
297
+ const e = (element) => element ? createBem(namespace, element) : "";
298
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
299
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
322
300
  return {
323
- backgroundClass,
324
- overlayClass,
325
- handleBackdropClick,
326
- handleOverlayBubbleCancel
301
+ b,
302
+ e,
303
+ m,
304
+ em
327
305
  };
328
306
  }
329
307
  var fixedOverlay = "";
330
308
  defineComponent({
331
309
  name: "DFixedOverlay",
310
+ inheritAttrs: false,
332
311
  props: fixedOverlayProps,
333
- emits: overlayEmits,
312
+ emits: ["update:modelValue", "click"],
334
313
  setup(props, ctx) {
335
314
  const {
336
- backgroundClass,
337
- overlayClass,
338
- handleBackdropClick,
339
- handleOverlayBubbleCancel
340
- } = useOverlayLogic(props, ctx);
341
- return () => createVNode(CommonOverlay, null, {
342
- default: () => [props.visible && createVNode("div", {
343
- "class": backgroundClass.value,
344
- "style": props.backgroundStyle,
345
- "onClick": handleBackdropClick
346
- }, [createVNode("div", {
347
- "class": overlayClass.value,
348
- "style": props.overlayStyle,
349
- "onClick": handleOverlayBubbleCancel
350
- }, [renderSlot(ctx.slots, "default")])])]
315
+ modelValue
316
+ } = toRefs(props);
317
+ const ns2 = useNamespace("fixed-overlay");
318
+ const {
319
+ onClick
320
+ } = useFixedOverlay(props, ctx);
321
+ return () => createVNode(Transition, {
322
+ "name": ns2.m("fade")
323
+ }, {
324
+ default: () => {
325
+ var _a, _b;
326
+ return [modelValue.value && createVNode("div", mergeProps({
327
+ "class": ns2.b()
328
+ }, ctx.attrs, {
329
+ "onClick": onClick
330
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
331
+ }
351
332
  });
352
333
  }
353
334
  });
@@ -368,6 +349,9 @@ const flexibleOverlayProps = {
368
349
  type: [Number, Object],
369
350
  default: 8
370
351
  },
352
+ shiftOffset: {
353
+ type: Number
354
+ },
371
355
  align: {
372
356
  type: String,
373
357
  default: null
@@ -413,6 +397,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
413
397
  function useOverlay(props, emit) {
414
398
  const overlayRef = ref();
415
399
  const arrowRef = ref();
400
+ let originParent = null;
416
401
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
417
402
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
418
403
  const staticSide = {
@@ -434,7 +419,6 @@ function useOverlay(props, emit) {
434
419
  const overlayEl = unref(overlayRef.value);
435
420
  const arrowEl = unref(arrowRef.value);
436
421
  const middleware = [
437
- shift(),
438
422
  offset(props.offset),
439
423
  autoPlacement({
440
424
  alignment: props.align,
@@ -442,30 +426,39 @@ function useOverlay(props, emit) {
442
426
  })
443
427
  ];
444
428
  props.showArrow && middleware.push(arrow({ element: arrowEl }));
429
+ props.shiftOffset !== void 0 && middleware.push(shift());
445
430
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
446
431
  strategy: "fixed",
447
432
  middleware
448
433
  });
434
+ let applyX = x;
435
+ let applyY = y;
436
+ if (props.shiftOffset !== void 0) {
437
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
438
+ shiftX < 0 && (applyX -= props.shiftOffset);
439
+ shiftX > 0 && (applyX += props.shiftOffset);
440
+ shiftY < 0 && (applyY -= props.shiftOffset);
441
+ shiftY > 0 && (applyY += props.shiftOffset);
442
+ }
449
443
  emit("positionChange", placement);
450
- Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
444
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
451
445
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
452
446
  };
453
447
  watch(() => props.modelValue, () => {
454
- const originParent = getScrollParent(props.origin);
455
448
  if (props.modelValue && props.origin) {
449
+ originParent = getScrollParent(props.origin);
456
450
  nextTick(updatePosition);
457
- originParent.addEventListener("scroll", updatePosition);
451
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
458
452
  originParent !== window && window.addEventListener("scroll", updatePosition);
459
453
  window.addEventListener("resize", updatePosition);
460
454
  } else {
461
- originParent.removeEventListener("scroll", updatePosition);
455
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
462
456
  originParent !== window && window.removeEventListener("scroll", updatePosition);
463
457
  window.removeEventListener("resize", updatePosition);
464
458
  }
465
459
  });
466
460
  onUnmounted(() => {
467
- const originParent = getScrollParent(props.origin);
468
- originParent.removeEventListener("scroll", updatePosition);
461
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
469
462
  originParent !== window && window.removeEventListener("scroll", updatePosition);
470
463
  window.removeEventListener("resize", updatePosition);
471
464
  });
@@ -483,6 +476,7 @@ const FlexibleOverlay = defineComponent({
483
476
  emit,
484
477
  expose
485
478
  }) {
479
+ const ns2 = useNamespace("flexible-overlay");
486
480
  const {
487
481
  arrowRef,
488
482
  overlayRef,
@@ -495,14 +489,69 @@ const FlexibleOverlay = defineComponent({
495
489
  var _a;
496
490
  return props.modelValue && createVNode("div", mergeProps({
497
491
  "ref": overlayRef,
498
- "class": "devui-flexible-overlay"
492
+ "class": ns2.b()
499
493
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
500
494
  "ref": arrowRef,
501
- "class": "devui-flexible-overlay-arrow"
495
+ "class": ns2.e("arrow")
502
496
  }, null)]);
503
497
  };
504
498
  }
505
499
  });
500
+ const isObject = (val) => val !== null && typeof val === "object";
501
+ const ns = useNamespace("popper-trigger");
502
+ function wrapContent(content) {
503
+ return h("span", { class: ns.b() }, content);
504
+ }
505
+ function getFirstValidChild(nodes) {
506
+ for (const child of nodes) {
507
+ if (isObject(child)) {
508
+ if (child.type === Comment) {
509
+ continue;
510
+ }
511
+ if (child.type === "svg" || child.type === Text) {
512
+ return wrapContent(child);
513
+ }
514
+ if (child.type === Fragment) {
515
+ return getFirstValidChild(child.children);
516
+ }
517
+ return child;
518
+ }
519
+ return wrapContent(child);
520
+ }
521
+ return null;
522
+ }
523
+ var PopperTrigger = defineComponent({
524
+ name: "DPopperTrigger",
525
+ setup(_, ctx) {
526
+ const {
527
+ slots,
528
+ attrs
529
+ } = ctx;
530
+ return () => {
531
+ var _a;
532
+ const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots, attrs);
533
+ const triggerRef = inject(POPPER_TRIGGER_TOKEN);
534
+ if (!defaultSlot) {
535
+ return null;
536
+ }
537
+ const firstValidChild = getFirstValidChild(defaultSlot);
538
+ if (!firstValidChild) {
539
+ return null;
540
+ }
541
+ return withDirectives(cloneVNode(firstValidChild, attrs), [[{
542
+ mounted(el) {
543
+ triggerRef.value = el;
544
+ },
545
+ updated(el) {
546
+ triggerRef.value = el;
547
+ },
548
+ unmounted() {
549
+ triggerRef.value = null;
550
+ }
551
+ }]]);
552
+ };
553
+ }
554
+ });
506
555
  var dropdown = "";
507
556
  let dropdownId = 1;
508
557
  var Dropdown = defineComponent({
@@ -521,6 +570,8 @@ var Dropdown = defineComponent({
521
570
  position,
522
571
  align,
523
572
  offset: offset2,
573
+ destroyOnHide,
574
+ shiftOffset,
524
575
  showAnimation
525
576
  } = toRefs(props);
526
577
  const origin = ref();
@@ -529,6 +580,8 @@ var Dropdown = defineComponent({
529
580
  const id = `dropdown_${dropdownId++}`;
530
581
  const isOpen = ref(false);
531
582
  const currentPosition = ref("bottom");
583
+ const ns2 = useNamespace("dropdown");
584
+ provide(POPPER_TRIGGER_TOKEN, origin);
532
585
  useDropdownEvent({
533
586
  id,
534
587
  isOpen,
@@ -545,43 +598,50 @@ var Dropdown = defineComponent({
545
598
  classes,
546
599
  handlePositionChange
547
600
  } = useOverlayProps(props, currentPosition, isOpen);
601
+ watch(overlayShowValue, (overlayShowValueVal) => {
602
+ nextTick(() => {
603
+ if (!destroyOnHide.value && overlayShowValueVal) {
604
+ overlayRef.value.updatePosition();
605
+ }
606
+ });
607
+ });
548
608
  expose({
549
609
  updatePosition: () => overlayRef.value.updatePosition()
550
610
  });
551
- return () => {
552
- var _a;
553
- return createVNode(Fragment, null, [createVNode("div", {
554
- "ref": origin,
555
- "class": "devui-dropdown-toggle"
556
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
557
- "to": "body"
611
+ return () => createVNode(Fragment, null, [createVNode(PopperTrigger, null, {
612
+ default: () => {
613
+ var _a;
614
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
615
+ }
616
+ }), createVNode(Teleport, {
617
+ "to": "body"
618
+ }, {
619
+ default: () => [createVNode(Transition, {
620
+ "name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""
558
621
  }, {
559
- default: () => [createVNode(Transition, {
560
- "name": showAnimation.value ? `devui-dropdown-fade-${currentPosition.value}` : ""
622
+ default: () => [withDirectives(createVNode(FlexibleOverlay, {
623
+ "modelValue": overlayModelValue.value,
624
+ "onUpdate:modelValue": ($event) => overlayModelValue.value = $event,
625
+ "ref": overlayRef,
626
+ "origin": origin.value,
627
+ "position": position.value,
628
+ "align": align.value,
629
+ "offset": offset2.value,
630
+ "shiftOffset": shiftOffset == null ? void 0 : shiftOffset.value,
631
+ "onPositionChange": handlePositionChange,
632
+ "class": classes.value,
633
+ "style": styles.value
561
634
  }, {
562
- default: () => [withDirectives(createVNode(FlexibleOverlay, {
563
- "modelValue": overlayModelValue.value,
564
- "onUpdate:modelValue": ($event) => overlayModelValue.value = $event,
565
- "ref": overlayRef,
566
- "origin": origin.value,
567
- "position": position.value,
568
- "align": align.value,
569
- "offset": offset2.value,
570
- "onPositionChange": handlePositionChange,
571
- "class": classes.value,
572
- "style": styles.value
573
- }, {
574
- default: () => {
575
- var _a2;
576
- return [createVNode("div", mergeProps({
577
- "ref": dropdownRef,
578
- "class": "devui-dropdown-menu-wrap"
579
- }, attrs), [(_a2 = slots.menu) == null ? void 0 : _a2.call(slots)])];
580
- }
581
- }), [[vShow, overlayShowValue.value]])]
582
- })]
583
- })]);
584
- };
635
+ default: () => {
636
+ var _a;
637
+ return [createVNode("div", mergeProps({
638
+ "ref": dropdownRef,
639
+ "class": ns2.e("menu-wrap")
640
+ }, attrs), [(_a = slots.menu) == null ? void 0 : _a.call(slots)])];
641
+ }
642
+ }), [[vShow, overlayShowValue.value]])]
643
+ })]
644
+ })]);
585
645
  }
586
646
  });
587
647
  const dropdownMenuProps = {
@@ -639,6 +699,7 @@ var DropdownMenu = defineComponent({
639
699
  overlayClass
640
700
  } = toRefs(props);
641
701
  const dropdownMenuRef = ref(null);
702
+ const ns2 = useNamespace("dropdown");
642
703
  onClickOutside(dropdownMenuRef, (value) => {
643
704
  var _a, _b;
644
705
  if (((_a = clickOutside.value) == null ? void 0 : _a.call(clickOutside)) && !((_b = origin == null ? void 0 : origin.value) == null ? void 0 : _b.contains(value.target))) {
@@ -656,7 +717,7 @@ var DropdownMenu = defineComponent({
656
717
  "to": "body"
657
718
  }, {
658
719
  default: () => [createVNode(Transition, {
659
- "name": showAnimation.value ? `devui-dropdown-fade-${currentPosition.value}` : ""
720
+ "name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""
660
721
  }, {
661
722
  default: () => [createVNode(FlexibleOverlay, {
662
723
  "modelValue": modelValue.value,
@@ -673,7 +734,7 @@ var DropdownMenu = defineComponent({
673
734
  var _a;
674
735
  return [createVNode("div", mergeProps({
675
736
  "ref": dropdownMenuRef,
676
- "class": "devui-dropdown-menu-wrap"
737
+ "class": ns2.e("menu-wrap")
677
738
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)])];
678
739
  }
679
740
  })]
@@ -684,7 +745,7 @@ var DropdownMenu = defineComponent({
684
745
  var index = {
685
746
  title: "Dropdown \u4E0B\u62C9\u83DC\u5355",
686
747
  category: "\u5BFC\u822A",
687
- status: "10%",
748
+ status: "50%",
688
749
  install(app) {
689
750
  app.component(Dropdown.name, Dropdown);
690
751
  app.component(DropdownMenu.name, DropdownMenu);