vue-devui 1.0.0-pre.0 → 1.0.0-rc.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 (347) hide show
  1. package/README.md +149 -187
  2. package/alert/index.es.js +74 -45
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8182 -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 +30 -5
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5741 -127
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +59 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8060 -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 +379 -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 +5 -7
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker/index.es.js +8159 -288
  31. package/date-picker/index.umd.js +27 -1
  32. package/date-picker/style.css +1 -1
  33. package/drawer/index.es.js +31 -4
  34. package/drawer/index.umd.js +1 -1
  35. package/drawer/style.css +1 -1
  36. package/dropdown/index.es.js +297 -181
  37. package/dropdown/index.umd.js +1 -1
  38. package/dropdown/style.css +1 -1
  39. package/editable-select/index.es.js +525 -154
  40. package/editable-select/index.umd.js +1 -1
  41. package/editable-select/style.css +1 -1
  42. package/form/index.es.js +1039 -1175
  43. package/form/index.umd.js +15 -15
  44. package/form/style.css +1 -1
  45. package/fullscreen/index.es.js +42 -21
  46. package/fullscreen/index.umd.js +1 -1
  47. package/fullscreen/style.css +1 -1
  48. package/grid/index.es.js +101 -86
  49. package/grid/index.umd.js +1 -1
  50. package/grid/style.css +1 -1
  51. package/icon/index.es.js +197 -56
  52. package/icon/index.umd.js +1 -1
  53. package/icon/style.css +1 -0
  54. package/image-preview/index.es.js +55 -31
  55. package/image-preview/index.umd.js +1 -1
  56. package/image-preview/style.css +1 -1
  57. package/input/index.es.js +8066 -144
  58. package/input/index.umd.js +27 -1
  59. package/input/style.css +1 -1
  60. package/input-number/index.es.js +269 -183
  61. package/input-number/index.umd.js +1 -1
  62. package/input-number/style.css +1 -1
  63. package/layout/index.es.js +40 -25
  64. package/layout/index.umd.js +1 -1
  65. package/layout/style.css +1 -1
  66. package/loading/index.es.js +74 -35
  67. package/loading/index.umd.js +1 -1
  68. package/loading/style.css +1 -1
  69. package/modal/index.es.js +412 -204
  70. package/modal/index.umd.js +1 -1
  71. package/modal/style.css +1 -1
  72. package/notification/index.es.js +307 -57
  73. package/notification/index.umd.js +1 -1
  74. package/notification/style.css +1 -1
  75. package/nuxt/components/ButtonGroup.js +3 -0
  76. package/nuxt/components/CheckboxButton.js +3 -0
  77. package/nuxt/components/CheckboxGroup.js +3 -0
  78. package/nuxt/components/Collapse.js +3 -0
  79. package/nuxt/components/CollapseItem.js +3 -0
  80. package/nuxt/components/DropdownPropsKey.js +3 -0
  81. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  82. package/nuxt/components/FORM_TOKEN.js +3 -0
  83. package/nuxt/components/Icon.js +1 -0
  84. package/nuxt/components/IconGroup.js +3 -0
  85. package/nuxt/components/LABEL_DATA.js +3 -0
  86. package/nuxt/components/LoadingOptions.js +3 -0
  87. package/nuxt/components/Option.js +3 -0
  88. package/nuxt/components/PanelBody.js +3 -0
  89. package/nuxt/components/PanelFooter.js +3 -0
  90. package/nuxt/components/PanelHeader.js +3 -0
  91. package/nuxt/components/RadioButton.js +3 -0
  92. package/nuxt/components/Tab.js +3 -0
  93. package/nuxt/components/Timeline.js +3 -0
  94. package/nuxt/components/TimelineItem.js +3 -0
  95. package/nuxt/components/alertProps.js +3 -0
  96. package/nuxt/components/autoCompleteProps.js +3 -0
  97. package/nuxt/components/avatarProps.js +3 -0
  98. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  99. package/nuxt/components/buttonGroupProps.js +3 -0
  100. package/nuxt/components/cardProps.js +3 -0
  101. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  102. package/nuxt/components/checkboxGroupProps.js +3 -0
  103. package/nuxt/components/checkboxProps.js +3 -0
  104. package/nuxt/components/colProps.js +3 -0
  105. package/nuxt/components/colPropsBaseClass.js +3 -0
  106. package/nuxt/components/colPropsBaseStyle.js +3 -0
  107. package/nuxt/components/collapseItemProps.js +3 -0
  108. package/nuxt/components/collapseProps.js +3 -0
  109. package/nuxt/components/countdownProps.js +3 -0
  110. package/nuxt/components/editableSelectProps.js +3 -0
  111. package/nuxt/components/formItemProps.js +3 -0
  112. package/nuxt/components/formProps.js +3 -0
  113. package/nuxt/components/fullscreenProps.js +3 -0
  114. package/nuxt/components/iconProps.js +3 -0
  115. package/nuxt/components/imagePreviewProps.js +3 -0
  116. package/nuxt/components/inputProps.js +3 -0
  117. package/nuxt/components/loadingProps.js +3 -0
  118. package/nuxt/components/modalProps.js +3 -0
  119. package/nuxt/components/paginationProps.js +3 -0
  120. package/nuxt/components/panelProps.js +3 -0
  121. package/nuxt/components/progressProps.js +3 -0
  122. package/nuxt/components/rateProps.js +3 -0
  123. package/nuxt/components/resultProps.js +3 -0
  124. package/nuxt/components/rowProps.js +3 -0
  125. package/nuxt/components/screenSizes.js +3 -0
  126. package/nuxt/components/searchProps.js +3 -0
  127. package/nuxt/components/skeletonProps.js +3 -0
  128. package/nuxt/components/sliderProps.js +3 -0
  129. package/nuxt/components/splitterProps.js +3 -0
  130. package/nuxt/components/statisticProps.js +3 -0
  131. package/nuxt/components/svgIconProps.js +3 -0
  132. package/nuxt/components/switchProps.js +3 -0
  133. package/nuxt/components/tabsProps.js +3 -0
  134. package/nuxt/components/tagProps.js +3 -0
  135. package/nuxt/components/textareaProps.js +3 -0
  136. package/nuxt/components/timeAxisProps.js +3 -0
  137. package/nuxt/components/treeProps.js +3 -0
  138. package/overlay/index.es.js +127 -149
  139. package/overlay/index.umd.js +1 -1
  140. package/overlay/style.css +1 -1
  141. package/package.json +10 -44
  142. package/pagination/index.es.js +158 -148
  143. package/pagination/index.umd.js +1 -1
  144. package/pagination/style.css +1 -1
  145. package/panel/index.es.js +45 -32
  146. package/panel/index.umd.js +1 -1
  147. package/panel/style.css +1 -1
  148. package/popover/index.es.js +317 -246
  149. package/popover/index.umd.js +15 -15
  150. package/popover/style.css +1 -1
  151. package/progress/index.es.js +110 -56
  152. package/progress/index.umd.js +3 -3
  153. package/progress/style.css +1 -1
  154. package/radio/index.es.js +7964 -157
  155. package/radio/index.umd.js +27 -1
  156. package/radio/style.css +1 -1
  157. package/rate/index.es.js +77 -55
  158. package/rate/index.umd.js +1 -1
  159. package/rate/style.css +1 -1
  160. package/result/index.es.js +184 -57
  161. package/result/index.umd.js +1 -1
  162. package/result/style.css +1 -1
  163. package/ripple/index.es.js +47 -42
  164. package/ripple/index.umd.js +1 -1
  165. package/search/index.es.js +3644 -1122
  166. package/search/index.umd.js +18 -18
  167. package/search/style.css +1 -1
  168. package/select/index.es.js +9144 -597
  169. package/select/index.umd.js +27 -1
  170. package/select/style.css +1 -1
  171. package/skeleton/index.es.js +63 -41
  172. package/skeleton/index.umd.js +1 -1
  173. package/skeleton/style.css +1 -1
  174. package/slider/index.es.js +109 -75
  175. package/slider/index.umd.js +1 -1
  176. package/slider/style.css +1 -1
  177. package/splitter/index.es.js +469 -349
  178. package/splitter/index.umd.js +15 -15
  179. package/splitter/style.css +1 -1
  180. package/statistic/index.es.js +7 -18
  181. package/statistic/index.umd.js +1 -1
  182. package/status/index.es.js +27 -6
  183. package/status/index.umd.js +1 -1
  184. package/status/style.css +1 -1
  185. package/style.css +1 -1
  186. package/switch/index.es.js +7794 -64
  187. package/switch/index.umd.js +27 -1
  188. package/switch/style.css +1 -1
  189. package/table/index.es.js +10119 -1206
  190. package/table/index.umd.js +27 -1
  191. package/table/style.css +1 -1
  192. package/tabs/index.es.js +342 -141
  193. package/tabs/index.umd.js +1 -1
  194. package/tabs/style.css +1 -1
  195. package/tag/index.es.js +49 -24
  196. package/tag/index.umd.js +1 -1
  197. package/tag/style.css +1 -1
  198. package/textarea/index.es.js +7913 -83
  199. package/textarea/index.umd.js +35 -1
  200. package/textarea/style.css +1 -1
  201. package/{anchor → timeline}/index.d.ts +0 -0
  202. package/timeline/index.es.js +425 -0
  203. package/timeline/index.umd.js +1 -0
  204. package/{back-top → timeline}/package.json +1 -1
  205. package/timeline/style.css +1 -0
  206. package/tooltip/index.es.js +308 -236
  207. package/tooltip/index.umd.js +15 -15
  208. package/tooltip/style.css +1 -1
  209. package/tree/index.es.js +4189 -1851
  210. package/tree/index.umd.js +18 -18
  211. package/tree/style.css +1 -1
  212. package/upload/index.es.js +380 -123
  213. package/upload/index.umd.js +1 -1
  214. package/upload/style.css +1 -1
  215. package/vue-devui.es.js +18121 -23161
  216. package/vue-devui.umd.js +25 -15
  217. package/accordion/index.es.js +0 -720
  218. package/accordion/index.umd.js +0 -1
  219. package/accordion/package.json +0 -7
  220. package/accordion/style.css +0 -1
  221. package/anchor/index.es.js +0 -263
  222. package/anchor/index.umd.js +0 -1
  223. package/anchor/style.css +0 -1
  224. package/back-top/index.d.ts +0 -7
  225. package/back-top/index.es.js +0 -128
  226. package/back-top/index.umd.js +0 -1
  227. package/back-top/style.css +0 -1
  228. package/breadcrumb/index.d.ts +0 -7
  229. package/breadcrumb/index.es.js +0 -127
  230. package/breadcrumb/index.umd.js +0 -1
  231. package/breadcrumb/package.json +0 -7
  232. package/breadcrumb/style.css +0 -1
  233. package/carousel/index.d.ts +0 -7
  234. package/carousel/index.es.js +0 -329
  235. package/carousel/index.umd.js +0 -1
  236. package/carousel/package.json +0 -7
  237. package/carousel/style.css +0 -1
  238. package/cascader/index.d.ts +0 -7
  239. package/cascader/index.es.js +0 -5963
  240. package/cascader/index.umd.js +0 -27
  241. package/cascader/package.json +0 -7
  242. package/cascader/style.css +0 -1
  243. package/color-picker/index.d.ts +0 -7
  244. package/color-picker/index.es.js +0 -8187
  245. package/color-picker/index.umd.js +0 -27
  246. package/color-picker/package.json +0 -7
  247. package/color-picker/style.css +0 -1
  248. package/comment/index.d.ts +0 -7
  249. package/comment/index.es.js +0 -86
  250. package/comment/index.umd.js +0 -1
  251. package/comment/package.json +0 -7
  252. package/comment/style.css +0 -1
  253. package/dragdrop/index.d.ts +0 -7
  254. package/dragdrop/index.es.js +0 -157
  255. package/dragdrop/index.umd.js +0 -1
  256. package/dragdrop/package.json +0 -7
  257. package/gantt/index.d.ts +0 -7
  258. package/gantt/index.es.js +0 -523
  259. package/gantt/index.umd.js +0 -1
  260. package/gantt/package.json +0 -7
  261. package/gantt/style.css +0 -1
  262. package/input-icon/index.d.ts +0 -7
  263. package/input-icon/index.es.js +0 -331
  264. package/input-icon/index.umd.js +0 -1
  265. package/input-icon/package.json +0 -7
  266. package/input-icon/style.css +0 -1
  267. package/list/index.d.ts +0 -7
  268. package/list/index.es.js +0 -39
  269. package/list/index.umd.js +0 -1
  270. package/list/package.json +0 -7
  271. package/list/style.css +0 -1
  272. package/nav-sprite/index.d.ts +0 -7
  273. package/nav-sprite/index.es.js +0 -68
  274. package/nav-sprite/index.umd.js +0 -1
  275. package/nav-sprite/package.json +0 -7
  276. package/nuxt/components/Accordion.js +0 -3
  277. package/nuxt/components/Anchor.js +0 -3
  278. package/nuxt/components/BackTop.js +0 -3
  279. package/nuxt/components/Breadcrumb.js +0 -3
  280. package/nuxt/components/Carousel.js +0 -3
  281. package/nuxt/components/CarouselItem.js +0 -3
  282. package/nuxt/components/Cascader.js +0 -3
  283. package/nuxt/components/ColorPicker.js +0 -3
  284. package/nuxt/components/Comment.js +0 -3
  285. package/nuxt/components/FormControl.js +0 -3
  286. package/nuxt/components/FormLabel.js +0 -3
  287. package/nuxt/components/Gantt.js +0 -3
  288. package/nuxt/components/InputIcon.js +0 -3
  289. package/nuxt/components/List.js +0 -3
  290. package/nuxt/components/ListItem.js +0 -3
  291. package/nuxt/components/NavSprite.js +0 -2
  292. package/nuxt/components/QuadrantDiagram.js +0 -3
  293. package/nuxt/components/ReadTip.js +0 -3
  294. package/nuxt/components/StepsGuide.js +0 -3
  295. package/nuxt/components/Sticky.js +0 -2
  296. package/nuxt/components/TagInput.js +0 -3
  297. package/nuxt/components/TimeAxis.js +0 -3
  298. package/nuxt/components/TimeAxisItem.js +0 -3
  299. package/nuxt/components/TimePicker.js +0 -3
  300. package/nuxt/components/Transfer.js +0 -3
  301. package/nuxt/components/TreeSelect.js +0 -3
  302. package/nuxt/components/overlayEmits.js +0 -3
  303. package/nuxt/components/overlayProps.js +0 -3
  304. package/quadrant-diagram/index.d.ts +0 -7
  305. package/quadrant-diagram/index.es.js +0 -5728
  306. package/quadrant-diagram/index.umd.js +0 -27
  307. package/quadrant-diagram/package.json +0 -7
  308. package/quadrant-diagram/style.css +0 -1
  309. package/read-tip/index.d.ts +0 -7
  310. package/read-tip/index.es.js +0 -258
  311. package/read-tip/index.umd.js +0 -1
  312. package/read-tip/package.json +0 -7
  313. package/read-tip/style.css +0 -1
  314. package/steps-guide/index.d.ts +0 -7
  315. package/steps-guide/index.es.js +0 -239
  316. package/steps-guide/index.umd.js +0 -1
  317. package/steps-guide/package.json +0 -7
  318. package/steps-guide/style.css +0 -1
  319. package/sticky/index.d.ts +0 -7
  320. package/sticky/index.es.js +0 -197
  321. package/sticky/index.umd.js +0 -1
  322. package/sticky/package.json +0 -7
  323. package/tag-input/index.d.ts +0 -7
  324. package/tag-input/index.es.js +0 -329
  325. package/tag-input/index.umd.js +0 -1
  326. package/tag-input/package.json +0 -7
  327. package/tag-input/style.css +0 -1
  328. package/time-axis/index.d.ts +0 -7
  329. package/time-axis/index.es.js +0 -299
  330. package/time-axis/index.umd.js +0 -1
  331. package/time-axis/package.json +0 -7
  332. package/time-axis/style.css +0 -1
  333. package/time-picker/index.d.ts +0 -7
  334. package/time-picker/index.es.js +0 -1237
  335. package/time-picker/index.umd.js +0 -1
  336. package/time-picker/package.json +0 -7
  337. package/time-picker/style.css +0 -1
  338. package/transfer/index.d.ts +0 -7
  339. package/transfer/index.es.js +0 -7608
  340. package/transfer/index.umd.js +0 -27
  341. package/transfer/package.json +0 -7
  342. package/transfer/style.css +0 -1
  343. package/tree-select/index.d.ts +0 -7
  344. package/tree-select/index.es.js +0 -623
  345. package/tree-select/index.umd.js +0 -1
  346. package/tree-select/package.json +0 -7
  347. package/tree-select/style.css +0 -1
package/modal/index.es.js CHANGED
@@ -33,8 +33,8 @@ 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, ref, nextTick, unref, mergeProps, toRefs, h, render } from "vue";
37
- import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
36
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, onMounted, Teleport, h, render } from "vue";
37
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
38
38
  const modalProps = {
39
39
  modelValue: {
40
40
  type: Boolean,
@@ -54,109 +54,310 @@ const modalProps = {
54
54
  },
55
55
  beforeClose: {
56
56
  type: Function
57
+ },
58
+ escapable: {
59
+ type: Boolean,
60
+ default: true
61
+ },
62
+ showClose: {
63
+ type: Boolean,
64
+ default: true
65
+ },
66
+ showOverlay: {
67
+ type: Boolean,
68
+ default: true
69
+ },
70
+ appendToBody: {
71
+ type: Boolean,
72
+ default: true
57
73
  }
58
74
  };
59
- var Icon = defineComponent({
60
- name: "DIcon",
61
- props: {
62
- name: {
63
- type: String,
64
- required: true
65
- },
66
- size: {
67
- type: String,
68
- default: "inherit"
69
- },
70
- color: {
71
- type: String,
72
- default: "inherit"
73
- },
74
- classPrefix: {
75
- type: String,
76
- default: "icon"
77
- }
75
+ const DEFAULT_PREFIX = "icon";
76
+ const iconProps = {
77
+ name: {
78
+ type: String,
79
+ default: "",
80
+ required: true
78
81
  },
79
- setup(props) {
80
- return __spreadValues({}, props);
82
+ size: {
83
+ type: [Number, String],
84
+ default: "inherit"
85
+ },
86
+ color: {
87
+ type: String,
88
+ default: "inherit"
89
+ },
90
+ component: {
91
+ type: Object,
92
+ default: null
93
+ },
94
+ classPrefix: {
95
+ type: String,
96
+ default: DEFAULT_PREFIX
97
+ },
98
+ operable: {
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ disabled: {
103
+ type: Boolean,
104
+ default: false
105
+ },
106
+ rotate: {
107
+ type: [Number, String]
108
+ }
109
+ };
110
+ const svgIconProps = {
111
+ name: {
112
+ type: String,
113
+ default: "",
114
+ required: true
81
115
  },
82
- render() {
116
+ color: {
117
+ type: String,
118
+ default: "inherit"
119
+ },
120
+ size: {
121
+ type: [Number, String],
122
+ default: "inherit"
123
+ }
124
+ };
125
+ function createBem(namespace, element, modifier) {
126
+ let cls = namespace;
127
+ if (element) {
128
+ cls += `__${element}`;
129
+ }
130
+ if (modifier) {
131
+ cls += `--${modifier}`;
132
+ }
133
+ return cls;
134
+ }
135
+ function useNamespace(block, needDot = false) {
136
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
137
+ const b = () => createBem(namespace);
138
+ const e = (element) => element ? createBem(namespace, element) : "";
139
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
140
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
141
+ return {
142
+ b,
143
+ e,
144
+ m,
145
+ em
146
+ };
147
+ }
148
+ var icon = "";
149
+ var svgIcon = defineComponent({
150
+ name: "DSvgIcon",
151
+ props: svgIconProps,
152
+ setup(props) {
83
153
  const {
84
154
  name,
85
- size,
86
155
  color,
87
- classPrefix
88
- } = this;
89
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
90
- "src": name,
91
- "alt": name.split("/")[name.split("/").length - 1],
156
+ size
157
+ } = toRefs(props);
158
+ const ns = useNamespace("svg-icon");
159
+ const iconName = computed(() => `#icon-${name.value}`);
160
+ const iconSize = computed(() => {
161
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
162
+ });
163
+ const styles = {
164
+ width: iconSize.value,
165
+ height: iconSize.value
166
+ };
167
+ return () => {
168
+ return createVNode("svg", {
169
+ "class": ns.b(),
170
+ "style": styles
171
+ }, [createVNode("use", {
172
+ "xlink:href": iconName.value,
173
+ "fill": color.value
174
+ }, null)]);
175
+ };
176
+ }
177
+ });
178
+ function isUrl(value) {
179
+ return /^((http|https):)?\/\//.test(value);
180
+ }
181
+ function useIconDom(props, ctx) {
182
+ const {
183
+ component,
184
+ name,
185
+ size,
186
+ color,
187
+ classPrefix,
188
+ rotate
189
+ } = toRefs(props);
190
+ const ns = useNamespace("icon");
191
+ const iconSize = computed(() => {
192
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
193
+ });
194
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
195
+ const imgIconDom = () => {
196
+ return createVNode("img", mergeProps({
197
+ "src": name.value,
198
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
199
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
92
200
  "style": {
93
- width: size,
94
- verticalAlign: "text-bottom"
201
+ width: iconSize.value || "",
202
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
95
203
  }
96
- }, null) : createVNode("i", {
97
- "class": `${classPrefix} ${classPrefix}-${name}`,
204
+ }, ctx.attrs), null);
205
+ };
206
+ const svgIconDom = () => {
207
+ return createVNode(IconComponent, mergeProps({
208
+ "name": name.value,
209
+ "color": color.value,
210
+ "size": iconSize.value,
211
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
98
212
  "style": {
99
- fontSize: size,
100
- color
213
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
101
214
  }
102
- }, null);
103
- }
104
- });
105
- Icon.install = function(app) {
106
- app.component(Icon.name, Icon);
107
- };
108
- var overlay = "";
109
- function _isSlot(s) {
110
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
215
+ }, ctx.attrs), null);
216
+ };
217
+ const fontIconDom = () => {
218
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
219
+ return createVNode("i", mergeProps({
220
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
221
+ "style": {
222
+ fontSize: iconSize.value,
223
+ color: color.value,
224
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
225
+ }
226
+ }, ctx.attrs), null);
227
+ };
228
+ const iconDom = () => {
229
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
230
+ };
231
+ return {
232
+ iconDom
233
+ };
111
234
  }
112
- const CommonOverlay = defineComponent({
235
+ var Icon = defineComponent({
236
+ name: "DIcon",
237
+ props: iconProps,
113
238
  setup(props, ctx) {
239
+ const {
240
+ disabled,
241
+ operable
242
+ } = toRefs(props);
243
+ const {
244
+ iconDom
245
+ } = useIconDom(props, ctx);
246
+ const ns = useNamespace("icon");
247
+ const wrapClassed = computed(() => ({
248
+ [ns.e("container")]: true,
249
+ [ns.m("disabled")]: disabled.value,
250
+ [ns.m("operable")]: operable.value
251
+ }));
252
+ const onClick = (e) => {
253
+ if (disabled.value) {
254
+ e.preventDefault();
255
+ e.stopImmediatePropagation();
256
+ }
257
+ };
114
258
  return () => {
115
- let _slot;
116
- return createVNode(Teleport, {
117
- "to": "#d-overlay-anchor"
118
- }, {
119
- default: () => [createVNode(Transition, {
120
- "name": "devui-overlay-fade"
121
- }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
122
- default: () => [_slot]
123
- })]
124
- });
259
+ var _a, _b, _c, _d;
260
+ return createVNode("div", {
261
+ "class": wrapClassed.value,
262
+ "onClick": onClick
263
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
125
264
  };
126
265
  }
127
266
  });
128
- const overlayProps = {
129
- visible: {
130
- type: Boolean
131
- },
132
- backgroundBlock: {
267
+ var iconGroup = "";
268
+ defineComponent({
269
+ name: "DIconGroup",
270
+ setup(_, ctx) {
271
+ const ns = useNamespace("icon-group");
272
+ return () => {
273
+ var _a, _b;
274
+ return createVNode("div", {
275
+ "class": ns.b()
276
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
277
+ };
278
+ }
279
+ });
280
+ const fixedOverlayProps = {
281
+ modelValue: {
133
282
  type: Boolean,
134
283
  default: false
135
284
  },
136
- backgroundClass: {
137
- type: String,
138
- default: ""
139
- },
140
- backgroundStyle: {
141
- type: [String, Object]
142
- },
143
- onBackdropClick: {
144
- type: Function
145
- },
146
- backdropClose: {
285
+ lockScroll: {
147
286
  type: Boolean,
148
287
  default: true
149
288
  },
150
- hasBackdrop: {
289
+ closeOnClickOverlay: {
151
290
  type: Boolean,
152
291
  default: true
153
292
  }
154
293
  };
155
- const overlayEmits = ["update:visible", "backdropClick"];
156
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
157
- overlayStyle: {
158
- type: [String, Object],
159
- default: void 0
294
+ function lockScroll() {
295
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
296
+ const scrollTop = document.documentElement.scrollTop;
297
+ const style = document.documentElement.getAttribute("style");
298
+ document.documentElement.style.position = "fixed";
299
+ document.documentElement.style.top = `-${scrollTop}px`;
300
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
301
+ document.documentElement.style.overflowY = "scroll";
302
+ return () => {
303
+ if (style) {
304
+ document.documentElement.setAttribute("style", style);
305
+ } else {
306
+ document.documentElement.removeAttribute("style");
307
+ }
308
+ document.documentElement.scrollTop = scrollTop;
309
+ };
310
+ }
311
+ return;
312
+ }
313
+ function useFixedOverlay(props, ctx) {
314
+ let lockScrollCb;
315
+ const onClick = (event) => {
316
+ event.preventDefault();
317
+ ctx.emit("click", event);
318
+ if (props.closeOnClickOverlay) {
319
+ ctx.emit("update:modelValue", false);
320
+ }
321
+ };
322
+ const removeBodyAdditions = () => {
323
+ lockScrollCb == null ? void 0 : lockScrollCb();
324
+ };
325
+ watch(() => props.modelValue, (val) => {
326
+ if (val) {
327
+ props.lockScroll && (lockScrollCb = lockScroll());
328
+ } else {
329
+ removeBodyAdditions();
330
+ }
331
+ });
332
+ onUnmounted(removeBodyAdditions);
333
+ return { onClick };
334
+ }
335
+ var fixedOverlay = "";
336
+ const FixedOverlay = defineComponent({
337
+ name: "DFixedOverlay",
338
+ inheritAttrs: false,
339
+ props: fixedOverlayProps,
340
+ emits: ["update:modelValue", "click"],
341
+ setup(props, ctx) {
342
+ const {
343
+ modelValue
344
+ } = toRefs(props);
345
+ const ns = useNamespace("fixed-overlay");
346
+ const {
347
+ onClick
348
+ } = useFixedOverlay(props, ctx);
349
+ return () => createVNode(Transition, {
350
+ "name": ns.m("fade")
351
+ }, {
352
+ default: () => {
353
+ var _a, _b;
354
+ return [modelValue.value && createVNode("div", mergeProps({
355
+ "class": ns.b()
356
+ }, ctx.attrs, {
357
+ "onClick": onClick
358
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
359
+ }
360
+ });
160
361
  }
161
362
  });
162
363
  const flexibleOverlayProps = {
@@ -176,6 +377,9 @@ const flexibleOverlayProps = {
176
377
  type: [Number, Object],
177
378
  default: 8
178
379
  },
380
+ shiftOffset: {
381
+ type: Number
382
+ },
179
383
  align: {
180
384
  type: String,
181
385
  default: null
@@ -189,80 +393,6 @@ const flexibleOverlayProps = {
189
393
  default: true
190
394
  }
191
395
  };
192
- function useOverlayLogic(props, ctx) {
193
- const backgroundClass = computed(() => {
194
- return [
195
- "devui-overlay-background",
196
- props.backgroundClass,
197
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
198
- ];
199
- });
200
- const overlayClass = computed(() => {
201
- return "devui-overlay";
202
- });
203
- const handleBackdropClick = (event) => {
204
- var _a;
205
- event.preventDefault();
206
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
207
- if (props.backdropClose) {
208
- ctx.emit("update:visible", false);
209
- }
210
- };
211
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
212
- onMounted(() => {
213
- const body = document.body;
214
- const originOverflow = body.style.overflow;
215
- const originPosition = body.style.position;
216
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
217
- if (backgroundBlock) {
218
- const top = body.getBoundingClientRect().y;
219
- if (visible) {
220
- body.style.overflowY = "scroll";
221
- body.style.position = visible ? "fixed" : "";
222
- body.style.top = `${top}px`;
223
- } else {
224
- body.style.overflowY = originOverflow;
225
- body.style.position = originPosition;
226
- body.style.top = "";
227
- window.scrollTo(0, -top);
228
- }
229
- }
230
- });
231
- onUnmounted(() => {
232
- document.body.style.overflow = originOverflow;
233
- });
234
- });
235
- return {
236
- backgroundClass,
237
- overlayClass,
238
- handleBackdropClick,
239
- handleOverlayBubbleCancel
240
- };
241
- }
242
- const FixedOverlay = defineComponent({
243
- name: "DFixedOverlay",
244
- props: fixedOverlayProps,
245
- emits: overlayEmits,
246
- setup(props, ctx) {
247
- const {
248
- backgroundClass,
249
- overlayClass,
250
- handleBackdropClick,
251
- handleOverlayBubbleCancel
252
- } = useOverlayLogic(props, ctx);
253
- return () => createVNode(CommonOverlay, null, {
254
- default: () => [props.visible && createVNode("div", {
255
- "class": backgroundClass.value,
256
- "style": props.backgroundStyle,
257
- "onClick": handleBackdropClick
258
- }, [createVNode("div", {
259
- "class": overlayClass.value,
260
- "style": props.overlayStyle,
261
- "onClick": handleOverlayBubbleCancel
262
- }, [renderSlot(ctx.slots, "default")])])]
263
- });
264
- }
265
- });
266
396
  function getScrollParent(element) {
267
397
  const overflowRegex = /(auto|scroll|hidden)/;
268
398
  for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
@@ -295,6 +425,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
295
425
  function useOverlay(props, emit) {
296
426
  const overlayRef = ref();
297
427
  const arrowRef = ref();
428
+ let originParent = null;
298
429
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
299
430
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
300
431
  const staticSide = {
@@ -323,34 +454,43 @@ function useOverlay(props, emit) {
323
454
  })
324
455
  ];
325
456
  props.showArrow && middleware.push(arrow({ element: arrowEl }));
457
+ props.shiftOffset !== void 0 && middleware.push(shift());
326
458
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
327
459
  strategy: "fixed",
328
460
  middleware
329
461
  });
462
+ let applyX = x;
463
+ let applyY = y;
464
+ if (props.shiftOffset !== void 0) {
465
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
466
+ shiftX < 0 && (applyX -= props.shiftOffset);
467
+ shiftX > 0 && (applyX += props.shiftOffset);
468
+ shiftY < 0 && (applyY -= props.shiftOffset);
469
+ shiftY > 0 && (applyY += props.shiftOffset);
470
+ }
330
471
  emit("positionChange", placement);
331
- Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
472
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
332
473
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
333
474
  };
334
475
  watch(() => props.modelValue, () => {
335
- const originParent = getScrollParent(props.origin);
336
476
  if (props.modelValue && props.origin) {
477
+ originParent = getScrollParent(props.origin);
337
478
  nextTick(updatePosition);
338
- originParent.addEventListener("scroll", updatePosition);
479
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
339
480
  originParent !== window && window.addEventListener("scroll", updatePosition);
340
481
  window.addEventListener("resize", updatePosition);
341
482
  } else {
342
- originParent.removeEventListener("scroll", updatePosition);
483
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
343
484
  originParent !== window && window.removeEventListener("scroll", updatePosition);
344
485
  window.removeEventListener("resize", updatePosition);
345
486
  }
346
487
  });
347
488
  onUnmounted(() => {
348
- const originParent = getScrollParent(props.origin);
349
- originParent.removeEventListener("scroll", updatePosition);
489
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
350
490
  originParent !== window && window.removeEventListener("scroll", updatePosition);
351
491
  window.removeEventListener("resize", updatePosition);
352
492
  });
353
- return { arrowRef, overlayRef };
493
+ return { arrowRef, overlayRef, updatePosition };
354
494
  }
355
495
  var flexibleOverlay = "";
356
496
  defineComponent({
@@ -361,20 +501,26 @@ defineComponent({
361
501
  setup(props, {
362
502
  slots,
363
503
  attrs,
364
- emit
504
+ emit,
505
+ expose
365
506
  }) {
507
+ const ns = useNamespace("flexible-overlay");
366
508
  const {
367
509
  arrowRef,
368
- overlayRef
510
+ overlayRef,
511
+ updatePosition
369
512
  } = useOverlay(props, emit);
513
+ expose({
514
+ updatePosition
515
+ });
370
516
  return () => {
371
517
  var _a;
372
518
  return props.modelValue && createVNode("div", mergeProps({
373
519
  "ref": overlayRef,
374
- "class": "devui-flexible-overlay"
520
+ "class": ns.b()
375
521
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
376
522
  "ref": arrowRef,
377
- "class": "devui-flexible-overlay-arrow"
523
+ "class": ns.e("arrow")
378
524
  }, null)]);
379
525
  };
380
526
  }
@@ -384,22 +530,67 @@ function useModal(props, emit) {
384
530
  function close() {
385
531
  emit("update:modelValue", false);
386
532
  }
387
- function handleVisibleChange(val) {
388
- if (!val) {
389
- props.beforeClose ? props.beforeClose(close) : close();
533
+ function execClose() {
534
+ props.beforeClose ? props.beforeClose(close) : close();
535
+ }
536
+ function onOverlayClick() {
537
+ props.closeOnClickOverlay && execClose();
538
+ }
539
+ function onCloseBtnClick() {
540
+ execClose();
541
+ }
542
+ function onKeydown(event) {
543
+ if (event["keyCode"] === 27) {
544
+ execClose();
390
545
  }
391
546
  }
392
- return { handleVisibleChange };
547
+ onMounted(() => {
548
+ if (props.escapable) {
549
+ window.addEventListener("keydown", onKeydown);
550
+ }
551
+ });
552
+ onUnmounted(() => {
553
+ if (props.escapable) {
554
+ window.addEventListener("keydown", onKeydown);
555
+ }
556
+ });
557
+ return { onCloseBtnClick, onOverlayClick };
558
+ }
559
+ function useModalRender(props) {
560
+ const showContainer = ref(false);
561
+ const showModal = ref(false);
562
+ let lockScrollCb;
563
+ const removeBodyAdditions = () => {
564
+ lockScrollCb == null ? void 0 : lockScrollCb();
565
+ };
566
+ watch(() => props.modelValue, (val) => {
567
+ if (val) {
568
+ props.lockScroll && (lockScrollCb = lockScroll());
569
+ showContainer.value = true;
570
+ nextTick(() => {
571
+ showModal.value = true;
572
+ });
573
+ } else {
574
+ removeBodyAdditions();
575
+ showModal.value = false;
576
+ setTimeout(() => {
577
+ showContainer.value = false;
578
+ }, 100);
579
+ }
580
+ });
581
+ onUnmounted(removeBodyAdditions);
582
+ return { showContainer, showModal };
393
583
  }
394
584
  var Header = defineComponent({
395
585
  name: "DModalHeader",
396
586
  setup(props, {
397
587
  slots
398
588
  }) {
589
+ const ns = useNamespace("modal");
399
590
  return () => {
400
591
  var _a;
401
592
  return createVNode("div", {
402
- "class": "devui-modal-header"
593
+ "class": ns.e("header")
403
594
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
404
595
  };
405
596
  }
@@ -409,10 +600,11 @@ var Body = defineComponent({
409
600
  setup(props, {
410
601
  slots
411
602
  }) {
603
+ const ns = useNamespace("modal");
412
604
  return () => {
413
605
  var _a;
414
606
  return createVNode("div", {
415
- "class": "devui-modal-body"
607
+ "class": ns.e("body")
416
608
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
417
609
  };
418
610
  }
@@ -426,40 +618,50 @@ var Modal = defineComponent({
426
618
  setup(props, {
427
619
  slots,
428
620
  attrs,
429
- emit,
430
- expose
621
+ emit
431
622
  }) {
623
+ const ns = useNamespace("modal");
432
624
  const {
433
625
  modelValue,
434
- lockScroll,
435
- closeOnClickOverlay,
436
- title
626
+ title,
627
+ showClose,
628
+ showOverlay,
629
+ appendToBody
437
630
  } = toRefs(props);
438
631
  const {
439
- handleVisibleChange
632
+ onCloseBtnClick,
633
+ onOverlayClick
440
634
  } = useModal(props, emit);
441
- expose({
442
- handleVisibleChange
443
- });
444
- return () => createVNode(FixedOverlay, {
445
- "visible": modelValue.value,
446
- "onUpdate:visible": handleVisibleChange,
447
- "background-class": "devui-modal-mask",
448
- "background-block": lockScroll.value,
449
- "backdrop-close": closeOnClickOverlay.value
635
+ const {
636
+ showContainer,
637
+ showModal
638
+ } = useModalRender(props);
639
+ return () => createVNode(Teleport, {
640
+ "to": "body",
641
+ "disabled": !appendToBody.value
450
642
  }, {
451
- default: () => [createVNode(Transition, {
452
- "name": "devui-modal-wipe"
643
+ default: () => [showOverlay.value && createVNode(FixedOverlay, {
644
+ "modelValue": modelValue.value,
645
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
646
+ "lock-scroll": false,
647
+ "style": {
648
+ zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
649
+ }
650
+ }, null), showContainer.value && createVNode("div", {
651
+ "class": ns.e("container"),
652
+ "onClick": onOverlayClick
653
+ }, [createVNode(Transition, {
654
+ "name": ns.m("wipe")
453
655
  }, {
454
656
  default: () => {
455
657
  var _a;
456
- return [createVNode("div", mergeProps({
457
- "class": "devui-modal"
458
- }, attrs), [createVNode(Icon, {
658
+ return [showModal.value && createVNode("div", mergeProps({
659
+ "class": ns.b()
660
+ }, attrs), [showClose.value && createVNode(Icon, {
459
661
  "name": "close",
460
662
  "class": "btn-close",
461
663
  "size": "var(--devui-font-size-md,12px)",
462
- "onClick": () => handleVisibleChange(false)
664
+ "onClick": onCloseBtnClick
463
665
  }, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
464
666
  default: () => [title.value]
465
667
  }), createVNode(Body, null, {
@@ -469,7 +671,7 @@ var Modal = defineComponent({
469
671
  }
470
672
  }), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
471
673
  }
472
- })]
674
+ })])]
473
675
  });
474
676
  }
475
677
  });
@@ -478,10 +680,11 @@ var Footer = defineComponent({
478
680
  setup(props, {
479
681
  slots
480
682
  }) {
683
+ const ns = useNamespace("modal");
481
684
  return () => {
482
685
  var _a;
483
686
  return createVNode("div", {
484
- "class": "devui-modal-footer"
687
+ "class": ns.e("footer")
485
688
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
486
689
  };
487
690
  }
@@ -510,31 +713,36 @@ class ModalService extends CommonModalService {
510
713
  const anchor = document.createElement("div");
511
714
  this.anchorContainer.appendChild(anchor);
512
715
  const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
513
- const needHideOrNot = (value) => {
514
- if (!value) {
515
- hide();
516
- }
517
- };
518
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
519
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
716
+ const renderOrigin = (propsValue, onUpdateModelValue) => {
717
+ return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
520
718
  modelValue: true,
521
719
  "onUpdate:modelValue": onUpdateModelValue
522
720
  }), { header, default: content, footer });
523
721
  };
524
722
  const hide = () => {
525
- var _a2, _b;
723
+ var _a2, _b, _c;
724
+ const innerNeedHideOrNot = (value) => {
725
+ if (!value) {
726
+ hide();
727
+ }
728
+ };
526
729
  renderOrigin(resProps, (value) => {
527
730
  if (!value) {
528
731
  this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
529
732
  this.renderNull(anchor);
530
733
  } else {
531
- renderOrigin(resProps);
734
+ renderOrigin(resProps, innerNeedHideOrNot);
532
735
  }
533
736
  });
534
- (_b = (_a2 = vm.component.exposed).handleVisibleChange) == null ? void 0 : _b.call(_a2, false);
737
+ (_c = (_b = (_a2 = vm == null ? void 0 : vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
738
+ };
739
+ const needHideOrNot = (value) => {
740
+ if (!value) {
741
+ hide();
742
+ }
535
743
  };
536
744
  this.renderModal(anchor, { modelValue: false });
537
- vm = renderOrigin(resProps);
745
+ vm = renderOrigin(resProps, needHideOrNot);
538
746
  return { hide };
539
747
  }
540
748
  }
@@ -560,4 +768,4 @@ var index = {
560
768
  app.provide(ModalService.token, new ModalService(anchorsContainer));
561
769
  }
562
770
  };
563
- export { Modal, index as default };
771
+ export { Modal, index as default, modalProps };