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
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, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, h, render } from "vue";
37
- import { shift, 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,8 +54,25 @@ 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
  };
75
+ const DEFAULT_PREFIX = "icon";
59
76
  const iconProps = {
60
77
  name: {
61
78
  type: String,
@@ -63,172 +80,284 @@ const iconProps = {
63
80
  required: true
64
81
  },
65
82
  size: {
66
- type: String,
83
+ type: [Number, String],
67
84
  default: "inherit"
68
85
  },
69
86
  color: {
70
87
  type: String,
71
88
  default: "inherit"
72
89
  },
90
+ component: {
91
+ type: Object,
92
+ default: null
93
+ },
73
94
  classPrefix: {
74
95
  type: String,
75
- default: "icon"
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]
76
108
  }
77
109
  };
78
- var Icon = defineComponent({
79
- name: "DIcon",
80
- props: iconProps,
110
+ const svgIconProps = {
111
+ name: {
112
+ type: String,
113
+ default: "",
114
+ required: true
115
+ },
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,
81
152
  setup(props) {
82
153
  const {
83
154
  name,
84
- size,
85
155
  color,
86
- classPrefix
156
+ size
87
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
+ };
88
167
  return () => {
89
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
90
- "src": name.value,
91
- "alt": name.value.split("/")[name.value.split("/").length - 1],
92
- "style": {
93
- width: size.value,
94
- verticalAlign: "text-bottom"
95
- }
96
- }, null) : createVNode("i", {
97
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
98
- "style": {
99
- fontSize: size.value,
100
- color: color.value
101
- }
102
- }, null);
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)]);
103
175
  };
104
176
  }
105
177
  });
106
- var baseOverlay = "";
107
- function _isSlot(s) {
108
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
178
+ function isUrl(value) {
179
+ return /^((http|https):)?\/\//.test(value);
109
180
  }
110
- const CommonOverlay = defineComponent({
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")],
200
+ "style": {
201
+ width: iconSize.value || "",
202
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
203
+ }
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")],
212
+ "style": {
213
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
214
+ }
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
+ };
234
+ }
235
+ var Icon = defineComponent({
236
+ name: "DIcon",
237
+ props: iconProps,
238
+ emits: ["click"],
111
239
  setup(props, ctx) {
240
+ const {
241
+ disabled,
242
+ operable
243
+ } = toRefs(props);
244
+ const {
245
+ iconDom
246
+ } = useIconDom(props, ctx);
247
+ const ns = useNamespace("icon");
248
+ const wrapClassed = computed(() => ({
249
+ [ns.e("container")]: true,
250
+ [ns.m("disabled")]: disabled.value,
251
+ [ns.m("operable")]: operable.value
252
+ }));
253
+ const onClick = (e) => {
254
+ if (disabled.value) {
255
+ return;
256
+ }
257
+ ctx.emit("click", e);
258
+ };
112
259
  return () => {
113
- let _slot;
114
- return createVNode(Teleport, {
115
- "to": "#d-overlay-anchor"
116
- }, {
117
- default: () => [createVNode(Transition, {
118
- "name": "devui-overlay-fade"
119
- }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
120
- default: () => [_slot]
121
- })]
122
- });
260
+ var _a, _b, _c, _d;
261
+ return createVNode("div", {
262
+ "class": wrapClassed.value,
263
+ "onClick": onClick
264
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
123
265
  };
124
266
  }
125
267
  });
126
- const overlayProps = {
127
- visible: {
128
- type: Boolean
129
- },
130
- backgroundBlock: {
268
+ var iconGroup = "";
269
+ defineComponent({
270
+ name: "DIconGroup",
271
+ setup(_, ctx) {
272
+ const ns = useNamespace("icon-group");
273
+ return () => {
274
+ var _a, _b;
275
+ return createVNode("div", {
276
+ "class": ns.b()
277
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
278
+ };
279
+ }
280
+ });
281
+ const fixedOverlayProps = {
282
+ modelValue: {
131
283
  type: Boolean,
132
284
  default: false
133
285
  },
134
- backgroundClass: {
135
- type: String,
136
- default: ""
137
- },
138
- backgroundStyle: {
139
- type: [String, Object]
140
- },
141
- onBackdropClick: {
142
- type: Function
143
- },
144
- backdropClose: {
286
+ lockScroll: {
145
287
  type: Boolean,
146
288
  default: true
147
289
  },
148
- hasBackdrop: {
290
+ closeOnClickOverlay: {
149
291
  type: Boolean,
150
292
  default: true
151
293
  }
152
294
  };
153
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
154
- overlayStyle: {
155
- type: [String, Object],
156
- default: void 0
295
+ function lockScroll() {
296
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
297
+ const scrollTop = document.documentElement.scrollTop;
298
+ const style = document.documentElement.getAttribute("style");
299
+ document.documentElement.style.position = "fixed";
300
+ document.documentElement.style.top = `-${scrollTop}px`;
301
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
302
+ document.documentElement.style.overflowY = "scroll";
303
+ return () => {
304
+ if (style) {
305
+ document.documentElement.setAttribute("style", style);
306
+ } else {
307
+ document.documentElement.removeAttribute("style");
308
+ }
309
+ document.documentElement.scrollTop = scrollTop;
310
+ };
157
311
  }
158
- });
159
- const overlayEmits = ["update:visible", "backdropClick"];
160
- function useOverlayLogic(props, ctx) {
161
- const backgroundClass = computed(() => {
162
- return [
163
- "devui-overlay-background",
164
- props.backgroundClass,
165
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
166
- ];
167
- });
168
- const overlayClass = computed(() => {
169
- return "devui-overlay";
170
- });
171
- const handleBackdropClick = (event) => {
172
- var _a;
312
+ return;
313
+ }
314
+ function useFixedOverlay(props, ctx) {
315
+ let lockScrollCb;
316
+ const onClick = (event) => {
173
317
  event.preventDefault();
174
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
175
- if (props.backdropClose) {
176
- ctx.emit("update:visible", false);
318
+ ctx.emit("click", event);
319
+ if (props.closeOnClickOverlay) {
320
+ ctx.emit("update:modelValue", false);
177
321
  }
178
322
  };
179
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
180
- onMounted(() => {
181
- const body = document.body;
182
- const originOverflow = body.style.overflow;
183
- const originPosition = body.style.position;
184
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
185
- if (backgroundBlock) {
186
- const top = body.getBoundingClientRect().y;
187
- if (visible) {
188
- body.style.overflowY = "scroll";
189
- body.style.position = visible ? "fixed" : "";
190
- body.style.top = `${top}px`;
191
- } else {
192
- body.style.overflowY = originOverflow;
193
- body.style.position = originPosition;
194
- body.style.top = "";
195
- window.scrollTo(0, -top);
196
- }
197
- }
198
- });
199
- onUnmounted(() => {
200
- document.body.style.overflow = originOverflow;
201
- });
202
- });
203
- return {
204
- backgroundClass,
205
- overlayClass,
206
- handleBackdropClick,
207
- handleOverlayBubbleCancel
323
+ const removeBodyAdditions = () => {
324
+ lockScrollCb == null ? void 0 : lockScrollCb();
208
325
  };
326
+ watch(() => props.modelValue, (val) => {
327
+ if (val) {
328
+ props.lockScroll && (lockScrollCb = lockScroll());
329
+ } else {
330
+ removeBodyAdditions();
331
+ }
332
+ });
333
+ onUnmounted(removeBodyAdditions);
334
+ return { onClick };
209
335
  }
210
336
  var fixedOverlay = "";
211
337
  const FixedOverlay = defineComponent({
212
338
  name: "DFixedOverlay",
339
+ inheritAttrs: false,
213
340
  props: fixedOverlayProps,
214
- emits: overlayEmits,
341
+ emits: ["update:modelValue", "click"],
215
342
  setup(props, ctx) {
216
343
  const {
217
- backgroundClass,
218
- overlayClass,
219
- handleBackdropClick,
220
- handleOverlayBubbleCancel
221
- } = useOverlayLogic(props, ctx);
222
- return () => createVNode(CommonOverlay, null, {
223
- default: () => [props.visible && createVNode("div", {
224
- "class": backgroundClass.value,
225
- "style": props.backgroundStyle,
226
- "onClick": handleBackdropClick
227
- }, [createVNode("div", {
228
- "class": overlayClass.value,
229
- "style": props.overlayStyle,
230
- "onClick": handleOverlayBubbleCancel
231
- }, [renderSlot(ctx.slots, "default")])])]
344
+ modelValue
345
+ } = toRefs(props);
346
+ const ns = useNamespace("fixed-overlay");
347
+ const {
348
+ onClick
349
+ } = useFixedOverlay(props, ctx);
350
+ return () => createVNode(Transition, {
351
+ "name": ns.m("fade")
352
+ }, {
353
+ default: () => {
354
+ var _a, _b;
355
+ return [modelValue.value && createVNode("div", mergeProps({
356
+ "class": ns.b()
357
+ }, ctx.attrs, {
358
+ "onClick": onClick
359
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
360
+ }
232
361
  });
233
362
  }
234
363
  });
@@ -249,6 +378,9 @@ const flexibleOverlayProps = {
249
378
  type: [Number, Object],
250
379
  default: 8
251
380
  },
381
+ shiftOffset: {
382
+ type: Number
383
+ },
252
384
  align: {
253
385
  type: String,
254
386
  default: null
@@ -294,6 +426,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
294
426
  function useOverlay(props, emit) {
295
427
  const overlayRef = ref();
296
428
  const arrowRef = ref();
429
+ let originParent = null;
297
430
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
298
431
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
299
432
  const staticSide = {
@@ -315,7 +448,6 @@ function useOverlay(props, emit) {
315
448
  const overlayEl = unref(overlayRef.value);
316
449
  const arrowEl = unref(arrowRef.value);
317
450
  const middleware = [
318
- shift(),
319
451
  offset(props.offset),
320
452
  autoPlacement({
321
453
  alignment: props.align,
@@ -323,30 +455,39 @@ function useOverlay(props, emit) {
323
455
  })
324
456
  ];
325
457
  props.showArrow && middleware.push(arrow({ element: arrowEl }));
458
+ props.shiftOffset !== void 0 && middleware.push(shift());
326
459
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
327
460
  strategy: "fixed",
328
461
  middleware
329
462
  });
463
+ let applyX = x;
464
+ let applyY = y;
465
+ if (props.shiftOffset !== void 0) {
466
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
467
+ shiftX < 0 && (applyX -= props.shiftOffset);
468
+ shiftX > 0 && (applyX += props.shiftOffset);
469
+ shiftY < 0 && (applyY -= props.shiftOffset);
470
+ shiftY > 0 && (applyY += props.shiftOffset);
471
+ }
330
472
  emit("positionChange", placement);
331
- Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
473
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
332
474
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
333
475
  };
334
476
  watch(() => props.modelValue, () => {
335
- const originParent = getScrollParent(props.origin);
336
477
  if (props.modelValue && props.origin) {
478
+ originParent = getScrollParent(props.origin);
337
479
  nextTick(updatePosition);
338
- originParent.addEventListener("scroll", updatePosition);
480
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
339
481
  originParent !== window && window.addEventListener("scroll", updatePosition);
340
482
  window.addEventListener("resize", updatePosition);
341
483
  } else {
342
- originParent.removeEventListener("scroll", updatePosition);
484
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
343
485
  originParent !== window && window.removeEventListener("scroll", updatePosition);
344
486
  window.removeEventListener("resize", updatePosition);
345
487
  }
346
488
  });
347
489
  onUnmounted(() => {
348
- const originParent = getScrollParent(props.origin);
349
- originParent.removeEventListener("scroll", updatePosition);
490
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
350
491
  originParent !== window && window.removeEventListener("scroll", updatePosition);
351
492
  window.removeEventListener("resize", updatePosition);
352
493
  });
@@ -364,6 +505,7 @@ defineComponent({
364
505
  emit,
365
506
  expose
366
507
  }) {
508
+ const ns = useNamespace("flexible-overlay");
367
509
  const {
368
510
  arrowRef,
369
511
  overlayRef,
@@ -376,10 +518,10 @@ defineComponent({
376
518
  var _a;
377
519
  return props.modelValue && createVNode("div", mergeProps({
378
520
  "ref": overlayRef,
379
- "class": "devui-flexible-overlay"
521
+ "class": ns.b()
380
522
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
381
523
  "ref": arrowRef,
382
- "class": "devui-flexible-overlay-arrow"
524
+ "class": ns.e("arrow")
383
525
  }, null)]);
384
526
  };
385
527
  }
@@ -389,22 +531,67 @@ function useModal(props, emit) {
389
531
  function close() {
390
532
  emit("update:modelValue", false);
391
533
  }
392
- function handleVisibleChange(val) {
393
- if (!val) {
394
- props.beforeClose ? props.beforeClose(close) : close();
534
+ function execClose() {
535
+ props.beforeClose ? props.beforeClose(close) : close();
536
+ }
537
+ function onOverlayClick() {
538
+ props.closeOnClickOverlay && execClose();
539
+ }
540
+ function onCloseBtnClick() {
541
+ execClose();
542
+ }
543
+ function onKeydown(event) {
544
+ if (event["keyCode"] === 27) {
545
+ execClose();
395
546
  }
396
547
  }
397
- return { handleVisibleChange };
548
+ onMounted(() => {
549
+ if (props.escapable) {
550
+ window.addEventListener("keydown", onKeydown);
551
+ }
552
+ });
553
+ onUnmounted(() => {
554
+ if (props.escapable) {
555
+ window.addEventListener("keydown", onKeydown);
556
+ }
557
+ });
558
+ return { onCloseBtnClick, onOverlayClick };
559
+ }
560
+ function useModalRender(props) {
561
+ const showContainer = ref(false);
562
+ const showModal = ref(false);
563
+ let lockScrollCb;
564
+ const removeBodyAdditions = () => {
565
+ lockScrollCb == null ? void 0 : lockScrollCb();
566
+ };
567
+ watch(() => props.modelValue, (val) => {
568
+ if (val) {
569
+ props.lockScroll && (lockScrollCb = lockScroll());
570
+ showContainer.value = true;
571
+ nextTick(() => {
572
+ showModal.value = true;
573
+ });
574
+ } else {
575
+ removeBodyAdditions();
576
+ showModal.value = false;
577
+ setTimeout(() => {
578
+ showContainer.value = false;
579
+ }, 100);
580
+ }
581
+ });
582
+ onUnmounted(removeBodyAdditions);
583
+ return { showContainer, showModal };
398
584
  }
399
585
  var Header = defineComponent({
400
586
  name: "DModalHeader",
401
587
  setup(props, {
402
588
  slots
403
589
  }) {
590
+ const ns = useNamespace("modal");
404
591
  return () => {
405
592
  var _a;
406
593
  return createVNode("div", {
407
- "class": "devui-modal-header"
594
+ "class": ns.e("header")
408
595
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
409
596
  };
410
597
  }
@@ -414,10 +601,11 @@ var Body = defineComponent({
414
601
  setup(props, {
415
602
  slots
416
603
  }) {
604
+ const ns = useNamespace("modal");
417
605
  return () => {
418
606
  var _a;
419
607
  return createVNode("div", {
420
- "class": "devui-modal-body"
608
+ "class": ns.e("body")
421
609
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
422
610
  };
423
611
  }
@@ -431,40 +619,50 @@ var Modal = defineComponent({
431
619
  setup(props, {
432
620
  slots,
433
621
  attrs,
434
- emit,
435
- expose
622
+ emit
436
623
  }) {
624
+ const ns = useNamespace("modal");
437
625
  const {
438
626
  modelValue,
439
- lockScroll,
440
- closeOnClickOverlay,
441
- title
627
+ title,
628
+ showClose,
629
+ showOverlay,
630
+ appendToBody
442
631
  } = toRefs(props);
443
632
  const {
444
- handleVisibleChange
633
+ onCloseBtnClick,
634
+ onOverlayClick
445
635
  } = useModal(props, emit);
446
- expose({
447
- handleVisibleChange
448
- });
449
- return () => createVNode(FixedOverlay, {
450
- "visible": modelValue.value,
451
- "onUpdate:visible": handleVisibleChange,
452
- "background-class": "devui-modal-mask",
453
- "background-block": lockScroll.value,
454
- "backdrop-close": closeOnClickOverlay.value
636
+ const {
637
+ showContainer,
638
+ showModal
639
+ } = useModalRender(props);
640
+ return () => createVNode(Teleport, {
641
+ "to": "body",
642
+ "disabled": !appendToBody.value
455
643
  }, {
456
- default: () => [createVNode(Transition, {
457
- "name": "devui-modal-wipe"
644
+ default: () => [showOverlay.value && createVNode(FixedOverlay, {
645
+ "modelValue": modelValue.value,
646
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
647
+ "lock-scroll": false,
648
+ "style": {
649
+ zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
650
+ }
651
+ }, null), showContainer.value && createVNode("div", {
652
+ "class": ns.e("container"),
653
+ "onClick": onOverlayClick
654
+ }, [createVNode(Transition, {
655
+ "name": ns.m("wipe")
458
656
  }, {
459
657
  default: () => {
460
658
  var _a;
461
- return [createVNode("div", mergeProps({
462
- "class": "devui-modal"
463
- }, attrs), [createVNode(Icon, {
659
+ return [showModal.value && createVNode("div", mergeProps({
660
+ "class": ns.b()
661
+ }, attrs), [showClose.value && createVNode(Icon, {
464
662
  "name": "close",
465
663
  "class": "btn-close",
466
664
  "size": "var(--devui-font-size-md,12px)",
467
- "onClick": () => handleVisibleChange(false)
665
+ "onClick": onCloseBtnClick
468
666
  }, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
469
667
  default: () => [title.value]
470
668
  }), createVNode(Body, null, {
@@ -474,7 +672,7 @@ var Modal = defineComponent({
474
672
  }
475
673
  }), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
476
674
  }
477
- })]
675
+ })])]
478
676
  });
479
677
  }
480
678
  });
@@ -483,10 +681,11 @@ var Footer = defineComponent({
483
681
  setup(props, {
484
682
  slots
485
683
  }) {
684
+ const ns = useNamespace("modal");
486
685
  return () => {
487
686
  var _a;
488
687
  return createVNode("div", {
489
- "class": "devui-modal-footer"
688
+ "class": ns.e("footer")
490
689
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
491
690
  };
492
691
  }
@@ -515,31 +714,36 @@ class ModalService extends CommonModalService {
515
714
  const anchor = document.createElement("div");
516
715
  this.anchorContainer.appendChild(anchor);
517
716
  const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
518
- const needHideOrNot = (value) => {
519
- if (!value) {
520
- hide();
521
- }
522
- };
523
- const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
524
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
717
+ const renderOrigin = (propsValue, onUpdateModelValue) => {
718
+ return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
525
719
  modelValue: true,
526
720
  "onUpdate:modelValue": onUpdateModelValue
527
721
  }), { header, default: content, footer });
528
722
  };
529
723
  const hide = () => {
530
- var _a2, _b;
724
+ var _a2, _b, _c;
725
+ const innerNeedHideOrNot = (value) => {
726
+ if (!value) {
727
+ hide();
728
+ }
729
+ };
531
730
  renderOrigin(resProps, (value) => {
532
731
  if (!value) {
533
732
  this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
534
733
  this.renderNull(anchor);
535
734
  } else {
536
- renderOrigin(resProps);
735
+ renderOrigin(resProps, innerNeedHideOrNot);
537
736
  }
538
737
  });
539
- (_b = (_a2 = vm.component.exposed).handleVisibleChange) == null ? void 0 : _b.call(_a2, false);
738
+ (_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);
739
+ };
740
+ const needHideOrNot = (value) => {
741
+ if (!value) {
742
+ hide();
743
+ }
540
744
  };
541
745
  this.renderModal(anchor, { modelValue: false });
542
- vm = renderOrigin(resProps);
746
+ vm = renderOrigin(resProps, needHideOrNot);
543
747
  return { hide };
544
748
  }
545
749
  }
@@ -565,4 +769,4 @@ var index = {
565
769
  app.provide(ModalService.token, new ModalService(anchorsContainer));
566
770
  }
567
771
  };
568
- export { Modal, index as default };
772
+ export { Modal, index as default, modalProps };