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
package/modal/index.es.js CHANGED
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, getCurrentInstance, nextTick, toRef, onBeforeUnmount, isRef, h, render, readonly, Fragment, mergeProps } from "vue";
36
+ import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef, h, render, readonly, mergeProps, resolveDirective } from "vue";
37
37
  const modalProps = {
38
38
  width: {
39
39
  type: String,
@@ -68,7 +68,7 @@ const modalProps = {
68
68
  },
69
69
  backdropCloseable: {
70
70
  type: Boolean,
71
- default: false
71
+ default: true
72
72
  },
73
73
  bodyScrollable: {
74
74
  type: Boolean,
@@ -115,9 +115,6 @@ const overlayProps = {
115
115
  visible: {
116
116
  type: Boolean
117
117
  },
118
- "onUpdate:visible": {
119
- type: Function
120
- },
121
118
  backgroundBlock: {
122
119
  type: Boolean,
123
120
  default: false
@@ -129,27 +126,57 @@ const overlayProps = {
129
126
  backgroundStyle: {
130
127
  type: [String, Object]
131
128
  },
132
- backdropClick: {
129
+ onBackdropClick: {
133
130
  type: Function
134
131
  },
135
132
  backdropClose: {
136
133
  type: Boolean,
137
134
  default: true
135
+ },
136
+ hasBackdrop: {
137
+ type: Boolean,
138
+ default: true
138
139
  }
139
140
  };
140
- function useOverlayLogic(props) {
141
+ const overlayEmits = ["update:visible", "backdropClick"];
142
+ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
143
+ overlayStyle: {
144
+ type: [String, Object],
145
+ default: void 0
146
+ }
147
+ });
148
+ const flexibleOverlayProps = __spreadValues({
149
+ origin: {
150
+ type: Object,
151
+ require: true
152
+ },
153
+ position: {
154
+ type: Object,
155
+ default: () => ({
156
+ originX: "left",
157
+ originY: "top",
158
+ overlayX: "left",
159
+ overlayY: "top"
160
+ })
161
+ }
162
+ }, overlayProps);
163
+ function useOverlayLogic(props, ctx) {
141
164
  const backgroundClass = computed(() => {
142
- return ["devui-overlay-background", "devui-overlay-background__color", props.backgroundClass];
165
+ return [
166
+ "devui-overlay-background",
167
+ props.backgroundClass,
168
+ !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
169
+ ];
143
170
  });
144
171
  const overlayClass = computed(() => {
145
172
  return "devui-overlay";
146
173
  });
147
174
  const handleBackdropClick = (event) => {
148
- var _a, _b;
175
+ var _a;
149
176
  event.preventDefault();
150
- (_a = props.backdropClick) == null ? void 0 : _a.call(props);
177
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
151
178
  if (props.backdropClose) {
152
- (_b = props["onUpdate:visible"]) == null ? void 0 : _b.call(props, false);
179
+ ctx.emit("update:visible", false);
153
180
  }
154
181
  };
155
182
  const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
@@ -185,19 +212,15 @@ function useOverlayLogic(props) {
185
212
  }
186
213
  const FixedOverlay = defineComponent({
187
214
  name: "DFixedOverlay",
188
- props: __spreadProps(__spreadValues({}, overlayProps), {
189
- overlayStyle: {
190
- type: Object,
191
- default: void 0
192
- }
193
- }),
215
+ props: fixedOverlayProps,
216
+ emits: overlayEmits,
194
217
  setup(props, ctx) {
195
218
  const {
196
219
  backgroundClass,
197
220
  overlayClass,
198
221
  handleBackdropClick,
199
222
  handleOverlayBubbleCancel
200
- } = useOverlayLogic(props);
223
+ } = useOverlayLogic(props, ctx);
201
224
  return () => createVNode(CommonOverlay, null, {
202
225
  default: () => [withDirectives(createVNode("div", {
203
226
  "class": backgroundClass.value,
@@ -211,84 +234,70 @@ const FixedOverlay = defineComponent({
211
234
  });
212
235
  }
213
236
  });
237
+ function isComponent(target) {
238
+ return !!(target == null ? void 0 : target.$el);
239
+ }
240
+ function getElement(element) {
241
+ if (element instanceof Element) {
242
+ return element;
243
+ }
244
+ if (element && typeof element === "object" && element.$el instanceof Element) {
245
+ return element.$el;
246
+ }
247
+ return null;
248
+ }
214
249
  const FlexibleOverlay = defineComponent({
215
250
  name: "DFlexibleOverlay",
216
- props: __spreadValues({
217
- origin: {
218
- type: Object,
219
- require: true
220
- },
221
- position: {
222
- type: Object,
223
- default: () => ({
224
- originX: "left",
225
- originY: "top",
226
- overlayX: "left",
227
- overlayY: "top"
228
- })
229
- }
230
- }, overlayProps),
231
- emits: ["onUpdate:visible"],
251
+ props: flexibleOverlayProps,
252
+ emits: overlayEmits,
232
253
  setup(props, ctx) {
233
254
  const overlayRef = ref(null);
234
255
  const positionedStyle = reactive({
235
256
  position: "absolute"
236
257
  });
237
- const instance = getCurrentInstance();
238
258
  onMounted(async () => {
239
- await nextTick();
240
- const overlay2 = overlayRef.value;
241
- if (!overlay2) {
242
- return;
243
- }
244
- const origin = getOrigin(props.origin);
245
- if (!origin) {
246
- return;
247
- }
248
- const handleRectChange = (rect) => {
249
- const point = calculatePosition(props.position, rect, origin);
259
+ const handleRectChange = (position, rect, origin) => {
260
+ const point = calculatePosition(position, rect, origin);
250
261
  positionedStyle.left = `${point.x}px`;
251
262
  positionedStyle.top = `${point.y}px`;
252
263
  };
253
- const handleChange = () => handleRectChange(overlay2.getBoundingClientRect());
254
- watch(toRef(props, "visible"), (visible, ov, onInvalidate) => {
255
- if (visible) {
256
- subscribeLayoutEvent(handleChange);
257
- } else {
258
- unsbscribeLayoutEvent(handleChange);
264
+ const locationElements = computed(() => {
265
+ const overlay2 = overlayRef.value;
266
+ const origin = getOrigin(props.origin);
267
+ if (!overlay2 || !origin) {
268
+ return;
259
269
  }
270
+ return {
271
+ origin,
272
+ overlay: overlay2
273
+ };
274
+ });
275
+ const visibleRef = toRef(props, "visible");
276
+ const positionRef = toRef(props, "position");
277
+ watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
278
+ if (!visible || !locationElements2) {
279
+ return;
280
+ }
281
+ const {
282
+ origin,
283
+ overlay: overlay2
284
+ } = locationElements2;
285
+ handleRectChange(position, overlay2.getBoundingClientRect(), origin);
286
+ const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
260
287
  onInvalidate(() => {
261
- unsbscribeLayoutEvent(handleChange);
288
+ unsubscriptions.forEach((fn) => fn());
262
289
  });
263
290
  });
264
- watch(toRef(props, "position"), () => {
265
- handleChange();
266
- });
267
- const resizeObserver = new ResizeObserver((entries) => {
268
- handleRectChange(entries[0].contentRect);
269
- });
270
- resizeObserver.observe(overlay2);
271
- onBeforeUnmount(() => {
272
- resizeObserver.disconnect();
273
- }, instance);
274
- if (origin instanceof Element) {
275
- const observer = new MutationObserver(handleChange);
276
- observer.observe(origin, {
277
- attributeFilter: ["style"]
278
- });
279
- onBeforeUnmount(() => {
280
- observer.disconnect();
281
- }, instance);
282
- }
283
- }, instance);
291
+ });
284
292
  const {
285
293
  backgroundClass,
286
294
  overlayClass,
287
295
  handleBackdropClick,
288
296
  handleOverlayBubbleCancel
289
- } = useOverlayLogic(props);
297
+ } = useOverlayLogic(props, ctx);
290
298
  return () => createVNode(CommonOverlay, null, {
291
299
  default: () => [withDirectives(createVNode("div", {
300
+ "style": props.backgroundStyle,
292
301
  "class": backgroundClass.value,
293
302
  "onClick": handleBackdropClick
294
303
  }, [createVNode("div", {
@@ -300,15 +309,6 @@ const FlexibleOverlay = defineComponent({
300
309
  });
301
310
  }
302
311
  });
303
- function getElement(element) {
304
- if (element instanceof Element) {
305
- return element;
306
- }
307
- if (element && typeof element === "object" && element.$el instanceof Element) {
308
- return element.$el;
309
- }
310
- return null;
311
- }
312
312
  function getOrigin(origin) {
313
313
  if (origin instanceof Element) {
314
314
  return origin;
@@ -316,17 +316,14 @@ function getOrigin(origin) {
316
316
  if (isRef(origin)) {
317
317
  return getElement(origin.value);
318
318
  }
319
+ if (isComponent(origin)) {
320
+ return getElement(origin);
321
+ }
319
322
  return origin;
320
323
  }
321
- function calculatePosition(position, panelOrRect, origin) {
324
+ function calculatePosition(position, rect, origin) {
322
325
  const originRect = getOriginRect(origin);
323
326
  const originPoint = getOriginRelativePoint(originRect, position);
324
- let rect;
325
- if (panelOrRect instanceof HTMLElement) {
326
- rect = panelOrRect.getBoundingClientRect();
327
- } else {
328
- rect = panelOrRect;
329
- }
330
327
  return getOverlayPoint(originPoint, rect, position);
331
328
  }
332
329
  function getOriginRect(origin) {
@@ -390,11 +387,31 @@ function subscribeLayoutEvent(event) {
390
387
  window.addEventListener("scroll", event, true);
391
388
  window.addEventListener("resize", event);
392
389
  window.addEventListener("orientationchange", event);
390
+ return () => {
391
+ window.removeEventListener("scroll", event, true);
392
+ window.removeEventListener("resize", event);
393
+ window.removeEventListener("orientationchange", event);
394
+ };
393
395
  }
394
- function unsbscribeLayoutEvent(event) {
395
- window.removeEventListener("scroll", event, true);
396
- window.removeEventListener("resize", event);
397
- window.removeEventListener("orientationchange", event);
396
+ function subscribeOverlayResize(overlay2, callback) {
397
+ if (overlay2 instanceof Element) {
398
+ const resizeObserver = new ResizeObserver(callback);
399
+ resizeObserver.observe(overlay2);
400
+ return () => resizeObserver.disconnect();
401
+ }
402
+ return () => {
403
+ };
404
+ }
405
+ function subscribeOriginResize(origin, callback) {
406
+ if (origin instanceof Element) {
407
+ const observer = new MutationObserver(callback);
408
+ observer.observe(origin, {
409
+ attributeFilter: ["style"]
410
+ });
411
+ return () => observer.disconnect();
412
+ }
413
+ return () => {
414
+ };
398
415
  }
399
416
  const inBrowser = typeof window !== "undefined";
400
417
  FlexibleOverlay.install = function(app) {
@@ -544,7 +561,7 @@ const dialogProps = {
544
561
  },
545
562
  backdropCloseable: {
546
563
  type: Boolean,
547
- default: false
564
+ default: true
548
565
  },
549
566
  bodyScrollable: {
550
567
  type: Boolean,
@@ -688,11 +705,12 @@ var Icon = defineComponent({
688
705
  color,
689
706
  classPrefix
690
707
  } = this;
691
- return createVNode(Fragment, null, [/^((https?):)?\/\//.test(name) ? createVNode("img", {
708
+ return /^((https?):)?\/\//.test(name) ? createVNode("img", {
692
709
  "src": name,
693
710
  "alt": name.split("/")[name.split("/").length - 1],
694
711
  "style": {
695
- width: size
712
+ width: size,
713
+ verticalAlign: "text-bottom"
696
714
  }
697
715
  }, null) : createVNode("i", {
698
716
  "class": `${classPrefix} ${classPrefix}-${name}`,
@@ -700,18 +718,214 @@ var Icon = defineComponent({
700
718
  fontSize: size,
701
719
  color
702
720
  }
703
- }, null)]);
721
+ }, null);
704
722
  }
705
723
  });
706
724
  Icon.install = function(app) {
707
725
  app.component(Icon.name, Icon);
708
726
  };
727
+ class View {
728
+ constructor() {
729
+ __publicField(this, "top", "50%");
730
+ __publicField(this, "left", "50%");
731
+ }
732
+ }
733
+ const componentProps = {
734
+ message: String,
735
+ backdrop: Boolean,
736
+ view: {
737
+ type: Object,
738
+ default: () => new View()
739
+ },
740
+ zIndex: Number,
741
+ isFull: {
742
+ type: Boolean,
743
+ default: false
744
+ }
745
+ };
746
+ class LoadingProps {
747
+ constructor() {
748
+ __publicField(this, "target");
749
+ __publicField(this, "message");
750
+ __publicField(this, "loadingTemplateRef");
751
+ __publicField(this, "backdrop", true);
752
+ __publicField(this, "positionType", "relative");
753
+ __publicField(this, "view", new View());
754
+ __publicField(this, "zIndex");
755
+ }
756
+ }
757
+ var loading = "";
758
+ var Loading = defineComponent({
759
+ name: "DLoading",
760
+ inheritAttrs: false,
761
+ props: componentProps,
762
+ setup(props) {
763
+ const style = {
764
+ top: props.view.top,
765
+ left: props.view.left,
766
+ zIndex: props.zIndex
767
+ };
768
+ if (!props.message) {
769
+ style.background = "none";
770
+ }
771
+ const isShow = ref(false);
772
+ const open = () => {
773
+ isShow.value = true;
774
+ };
775
+ const close = () => {
776
+ isShow.value = false;
777
+ };
778
+ return {
779
+ style,
780
+ isShow,
781
+ open,
782
+ close
783
+ };
784
+ },
785
+ render() {
786
+ var _a;
787
+ const {
788
+ isShow,
789
+ isFull,
790
+ backdrop,
791
+ style,
792
+ message,
793
+ $slots
794
+ } = this;
795
+ return isShow && createVNode("div", {
796
+ "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
797
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
798
+ "class": "devui-loading-wrapper"
799
+ }, [backdrop ? createVNode("div", {
800
+ "class": "devui-loading-mask"
801
+ }, null) : null, createVNode("div", {
802
+ "style": style,
803
+ "class": "devui-loading-area"
804
+ }, [createVNode("div", {
805
+ "class": "devui-busy-default-spinner"
806
+ }, [createVNode("div", {
807
+ "class": "devui-loading-bar1"
808
+ }, null), createVNode("div", {
809
+ "class": "devui-loading-bar2"
810
+ }, null), createVNode("div", {
811
+ "class": "devui-loading-bar3"
812
+ }, null), createVNode("div", {
813
+ "class": "devui-loading-bar4"
814
+ }, null)]), message ? createVNode("span", {
815
+ "class": "devui-loading-text"
816
+ }, [message]) : null])])]);
817
+ }
818
+ });
819
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
820
+ function createComponent(Component, props, children = null) {
821
+ const vnode = h(Component, __spreadValues({}, props), children);
822
+ const container = document.createElement("div");
823
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
824
+ render(vnode, container);
825
+ return vnode.component;
826
+ }
827
+ function unmountComponent(ComponnetInstance) {
828
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
829
+ }
830
+ const loadingConstructor = defineComponent(Loading);
831
+ const cacheInstance = new WeakSet();
832
+ const isEmpty = (val) => {
833
+ if (!val)
834
+ return true;
835
+ if (Array.isArray(val))
836
+ return val.length === 0;
837
+ if (val instanceof Set || val instanceof Map)
838
+ return val.size === 0;
839
+ if (val instanceof Promise)
840
+ return false;
841
+ if (typeof val === "object") {
842
+ try {
843
+ return Object.keys(val).length === 0;
844
+ } catch (e) {
845
+ return false;
846
+ }
847
+ }
848
+ return false;
849
+ };
850
+ const getType = (vari) => {
851
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
852
+ };
853
+ const isPromise = (value) => {
854
+ const type = getType(value);
855
+ switch (type) {
856
+ case "promise":
857
+ return [value];
858
+ case "array":
859
+ if (value.some((val) => getType(val) !== "promise")) {
860
+ console.error(new TypeError("Binding values should all be of type Promise"));
861
+ return "error";
862
+ }
863
+ return value;
864
+ default:
865
+ return false;
866
+ }
867
+ };
868
+ const unmount = (el) => {
869
+ cacheInstance.delete(el);
870
+ el.instance.proxy.close();
871
+ unmountComponent(el.instance);
872
+ };
873
+ const toggleLoading = (el, binding) => {
874
+ if (binding.value) {
875
+ const vals = isPromise(binding.value);
876
+ if (vals === "error")
877
+ return;
878
+ el.instance.proxy.open();
879
+ el.appendChild(el.mask);
880
+ cacheInstance.add(el);
881
+ if (vals) {
882
+ Promise.all(vals).catch((err) => {
883
+ console.error(new Error("Promise handling errors"), err);
884
+ }).finally(() => {
885
+ unmount(el);
886
+ });
887
+ }
888
+ } else {
889
+ unmount(el);
890
+ }
891
+ };
892
+ const removeAttribute = (el) => {
893
+ el.removeAttribute("zindex");
894
+ el.removeAttribute("positiontype");
895
+ el.removeAttribute("backdrop");
896
+ el.removeAttribute("message");
897
+ el.removeAttribute("view");
898
+ el.removeAttribute("loadingtemplateref");
899
+ };
900
+ const handleProps = (el, vprops) => {
901
+ const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
902
+ const loadingTemplateRef = props.loadingTemplateRef;
903
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
904
+ el.style.position = props.positionType;
905
+ el.options = props;
906
+ el.instance = loadingInstance;
907
+ el.mask = loadingInstance.proxy.$el;
908
+ };
909
+ const loadingDirective = {
910
+ mounted: function(el, binding, vnode) {
911
+ handleProps(el, vnode.props);
912
+ removeAttribute(el);
913
+ !isEmpty(binding.value) && toggleLoading(el, binding);
914
+ },
915
+ updated: function(el, binding, vnode) {
916
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
917
+ return;
918
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
919
+ removeAttribute(el);
920
+ toggleLoading(el, binding);
921
+ }
922
+ };
709
923
  const buttonProps = {
710
924
  type: {
711
925
  type: String,
712
926
  default: "button"
713
927
  },
714
- btnStyle: {
928
+ variant: {
715
929
  type: String,
716
930
  default: "primary"
717
931
  },
@@ -753,6 +967,9 @@ const buttonProps = {
753
967
  var button = "";
754
968
  var Button = defineComponent({
755
969
  name: "DButton",
970
+ directives: {
971
+ devLoading: loadingDirective
972
+ },
756
973
  props: buttonProps,
757
974
  setup(props, ctx) {
758
975
  const buttonContent = ref(null);
@@ -766,15 +983,15 @@ var Button = defineComponent({
766
983
  const hasContent = computed(() => ctx.slots.default);
767
984
  const btnClass = computed(() => {
768
985
  const {
769
- btnStyle,
986
+ variant,
770
987
  size,
771
988
  position,
772
989
  bordered,
773
990
  icon
774
991
  } = props;
775
- const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
992
+ const origin = `devui-btn devui-btn-${variant} devui-btn-${size} devui-btn-${position}`;
776
993
  const borderedClass = bordered ? "bordered" : "";
777
- const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
994
+ const btnIcon = !!icon && !hasContent.value && variant !== "primary" ? "d-btn-icon" : "";
778
995
  const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
779
996
  return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
780
997
  });
@@ -800,7 +1017,7 @@ var Button = defineComponent({
800
1017
  } = props;
801
1018
  return createVNode("div", mergeProps({
802
1019
  "class": "devui-btn-host"
803
- }, ctx.attrs), [createVNode("button", {
1020
+ }, ctx.attrs), [withDirectives(createVNode("button", {
804
1021
  "class": btnClass.value,
805
1022
  "type": type,
806
1023
  "disabled": disabled,
@@ -809,16 +1026,18 @@ var Button = defineComponent({
809
1026
  },
810
1027
  "onClick": onClick
811
1028
  }, [!!icon ? createVNode(Icon, {
812
- "name": props.icon,
1029
+ "name": icon,
813
1030
  "class": iconClass.value
814
1031
  }, null) : null, createVNode("span", {
815
1032
  "class": "button-content",
816
1033
  "ref": buttonContent
817
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]);
1034
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("devLoading"), showLoading]])]);
818
1035
  };
819
1036
  }
820
1037
  });
1038
+ defineComponent(Loading);
821
1039
  Button.install = function(app) {
1040
+ app.directive("dLoading", loadingDirective);
822
1041
  app.component(Button.name, Button);
823
1042
  };
824
1043
  function _isSlot(s) {
@@ -872,7 +1091,7 @@ var Dialog = defineComponent({
872
1091
  const buttonsRef = computed(() => {
873
1092
  return props.buttons.map((buttonProps2, index2) => {
874
1093
  const {
875
- btnStyle,
1094
+ variant,
876
1095
  disabled,
877
1096
  handler,
878
1097
  text
@@ -883,7 +1102,7 @@ var Dialog = defineComponent({
883
1102
  display: "inline-block",
884
1103
  margin: "0 5px"
885
1104
  },
886
- "btnStyle": btnStyle,
1105
+ "variant": variant,
887
1106
  "disabled": disabled,
888
1107
  "onClick": handler
889
1108
  }, _isSlot(text) ? text : {
@@ -931,7 +1150,7 @@ var Dialog = defineComponent({
931
1150
  }, null) : null, createVNode("span", null, [props.title]), createVNode(Button, {
932
1151
  "class": "btn-close",
933
1152
  "icon": "close",
934
- "btnStyle": "text-dark",
1153
+ "variant": "text-dark",
935
1154
  "onClick": closeModal
936
1155
  }, null)]), createVNode("div", {
937
1156
  "class": "devui-modal-body"
@@ -990,7 +1209,7 @@ Modal.install = function(app) {
990
1209
  var index = {
991
1210
  title: "Modal \u5F39\u7A97",
992
1211
  category: "\u53CD\u9988",
993
- status: "\u5DF2\u5B8C\u6210",
1212
+ status: "100%",
994
1213
  install(app) {
995
1214
  app.use(Modal);
996
1215
  if (!inBrowser) {